diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index 6f260117ad..8338528c42 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -30,12 +30,12 @@ jobs: env: GITHUB_CONTEXT: ${{ toJson(github) }} run: echo "$GITHUB_CONTEXT" - - uses: actions/checkout@v2.2.0 + - uses: actions/checkout@v3 with: submodules: false fetch-depth: 1 - name: Set up Python 3 - uses: actions/setup-python@v2 + uses: actions/setup-python@v4 with: python-version: "3.x" - name: Get CP deps @@ -92,25 +92,25 @@ jobs: working-directory: tests - name: Build mpy-cross.static-aarch64 run: make -C mpy-cross -j2 -f Makefile.static-aarch64 - - uses: actions/upload-artifact@v2 + - uses: actions/upload-artifact@v3 with: name: mpy-cross.static-aarch64 path: mpy-cross/mpy-cross.static-aarch64 - name: Build mpy-cross.static-raspbian run: make -C mpy-cross -j2 -f Makefile.static-raspbian - - uses: actions/upload-artifact@v2 + - uses: actions/upload-artifact@v3 with: name: mpy-cross.static-raspbian path: mpy-cross/mpy-cross.static-raspbian - name: Build mpy-cross.static run: make -C mpy-cross -j2 -f Makefile.static - - uses: actions/upload-artifact@v2 + - uses: actions/upload-artifact@v3 with: name: mpy-cross.static-amd64-linux path: mpy-cross/mpy-cross.static - name: Build mpy-cross.static-mingw run: make -C mpy-cross -j2 -f Makefile.static-mingw - - uses: actions/upload-artifact@v2 + - uses: actions/upload-artifact@v3 with: name: mpy-cross.static-x64-windows path: mpy-cross/mpy-cross.static.exe @@ -143,18 +143,18 @@ jobs: mpy-cross-mac: - runs-on: macos-10.15 + runs-on: macos-11 steps: - name: Dump GitHub context env: GITHUB_CONTEXT: ${{ toJson(github) }} run: echo "$GITHUB_CONTEXT" - - uses: actions/checkout@v2.2.0 + - uses: actions/checkout@v3 with: submodules: false fetch-depth: 1 - name: Set up Python 3 - uses: actions/setup-python@v2 + uses: actions/setup-python@v4 with: python-version: "3.x" - name: Get CP deps @@ -174,29 +174,27 @@ jobs: msgfmt --version - name: Build mpy-cross run: make -C mpy-cross -j2 - - uses: actions/upload-artifact@v2 + - uses: actions/upload-artifact@v3 with: - name: mpy-cross-macos-catalina + name: mpy-cross-macos-11-x64 path: mpy-cross/mpy-cross - - name: Select SDK for M1 build - run: sudo xcode-select -switch /Applications/Xcode_12.3.app - name: Build mpy-cross (arm64) run: make -C mpy-cross -j2 -f Makefile.m1 V=2 - - uses: actions/upload-artifact@v2 + - uses: actions/upload-artifact@v3 with: - name: mpy-cross-macos-bigsur-arm64 + name: mpy-cross-macos-11-arm64 path: mpy-cross/mpy-cross-arm64 - name: Make universal binary run: lipo -create -output mpy-cross-macos-universal mpy-cross/mpy-cross mpy-cross/mpy-cross-arm64 - - uses: actions/upload-artifact@v2 + - uses: actions/upload-artifact@v3 with: - name: mpy-cross-macos-universal + name: mpy-cross-macos-11-universal path: mpy-cross-macos-universal - name: Upload mpy-cross build to S3 run: | - [ -z "$AWS_ACCESS_KEY_ID" ] || aws s3 cp mpy-cross-macos-universal s3://adafruit-circuit-python/bin/mpy-cross/mpy-cross-macos-universal-${{ env.CP_VERSION }} --no-progress --region us-east-1 - [ -z "$AWS_ACCESS_KEY_ID" ] || aws s3 cp mpy-cross/mpy-cross-arm64 s3://adafruit-circuit-python/bin/mpy-cross/mpy-cross-macos-bigsur-${{ env.CP_VERSION }}-arm64 --no-progress --region us-east-1 - [ -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 + [ -z "$AWS_ACCESS_KEY_ID" ] || aws s3 cp mpy-cross-macos-universal s3://adafruit-circuit-python/bin/mpy-cross/mpy-cross-macos-11-${{ env.CP_VERSION }}-universal --no-progress --region us-east-1 + [ -z "$AWS_ACCESS_KEY_ID" ] || aws s3 cp mpy-cross/mpy-cross-arm64 s3://adafruit-circuit-python/bin/mpy-cross/mpy-cross-macos-11-${{ env.CP_VERSION }}-arm64 --no-progress --region us-east-1 + [ -z "$AWS_ACCESS_KEY_ID" ] || aws s3 cp mpy-cross/mpy-cross s3://adafruit-circuit-python/bin/mpy-cross/mpy-cross-macos-11-${{ env.CP_VERSION }}-x64 --no-progress --region us-east-1 env: AWS_PAGER: '' AWS_ACCESS_KEY_ID: ${{ secrets.AWS_ACCESS_KEY_ID }} @@ -209,7 +207,7 @@ jobs: needs: test if: ${{ needs.test.outputs.build-doc == 'True' }} steps: - - uses: actions/checkout@v2.2.0 + - uses: actions/checkout@v3 with: submodules: false fetch-depth: 1 @@ -220,7 +218,7 @@ jobs: tools/describe || git log --parents HEAD~4.. echo >>$GITHUB_ENV CP_VERSION=$(tools/describe) - name: Set up Python 3 - uses: actions/setup-python@v2 + uses: actions/setup-python@v4 with: python-version: "3.x" - name: Install dependencies @@ -231,20 +229,20 @@ jobs: pip install -r requirements-ci.txt -r requirements-doc.txt - name: Build and Validate Stubs run: make check-stubs -j2 - - uses: actions/upload-artifact@v2 + - uses: actions/upload-artifact@v3 with: name: stubs path: circuitpython-stubs/dist/* - 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 + - uses: actions/upload-artifact@v3 with: name: docs path: _build/html - name: Test Documentation Build (LaTeX/PDF) run: | make latexpdf - - uses: actions/upload-artifact@v2 + - uses: actions/upload-artifact@v3 with: name: docs path: _build/latex @@ -278,21 +276,22 @@ jobs: if: ${{ needs.test.outputs.boards-arm != '[]' }} steps: - name: Set up Python 3 - uses: actions/setup-python@v2 + uses: actions/setup-python@v4 with: python-version: "3.x" - - uses: actions/checkout@v2.2.0 + - uses: actions/checkout@v3 with: submodules: false fetch-depth: 1 - name: Get CP deps run: python tools/ci_fetch_deps.py ${{ matrix.board }} ${{ github.sha }} + - uses: carlosperate/arm-none-eabi-gcc-action@v1 + with: + release: '10-2020-q4' - name: Install dependencies run: | sudo apt-get install -y gettext pip install -r requirements-ci.txt -r requirements-dev.txt - wget --no-verbose https://adafruit-circuit-python.s3.amazonaws.com/gcc-arm-none-eabi-10-2020-q4-major-x86_64-linux.tar.bz2 - sudo tar -C /usr --strip-components=1 -xaf gcc-arm-none-eabi-10-2020-q4-major-x86_64-linux.tar.bz2 - name: Versions run: | gcc --version @@ -307,7 +306,7 @@ jobs: working-directory: tools env: BOARDS: ${{ matrix.board }} - - uses: actions/upload-artifact@v2 + - uses: actions/upload-artifact@v3 with: name: ${{ matrix.board }} path: bin/${{ matrix.board }} @@ -330,10 +329,10 @@ jobs: if: ${{ needs.test.outputs.boards-riscv != '[]' }} steps: - name: Set up Python 3 - uses: actions/setup-python@v2 + uses: actions/setup-python@v4 with: python-version: "3.x" - - uses: actions/checkout@v2.2.0 + - uses: actions/checkout@v3 with: submodules: false fetch-depth: 1 @@ -359,7 +358,7 @@ jobs: working-directory: tools env: BOARDS: ${{ matrix.board }} - - uses: actions/upload-artifact@v2 + - uses: actions/upload-artifact@v3 with: name: ${{ matrix.board }} path: bin/${{ matrix.board }} @@ -382,10 +381,11 @@ jobs: if: ${{ needs.test.outputs.boards-espressif != '[]' }} steps: - name: Set up Python 3 - uses: actions/setup-python@v2 + id: py3 + uses: actions/setup-python@v4 with: python-version: "3.x" - - uses: actions/checkout@v2.2.0 + - uses: actions/checkout@v3 with: submodules: false fetch-depth: 1 @@ -395,12 +395,12 @@ jobs: run: | tools/describe || git log --parents HEAD~4.. echo >>$GITHUB_ENV CP_VERSION=$(tools/describe) - - uses: actions/cache@v2 + - uses: actions/cache@v3 name: Fetch IDF tool cache id: idf-cache with: path: ${{ github.workspace }}/.idf_tools - key: ${{ runner.os }}-idf-tools-${{ hashFiles('.git/modules/ports/espressif/esp-idf/HEAD') }}-20220404 + key: ${{ runner.os }}-idf-tools-${{ hashFiles('.git/modules/ports/espressif/esp-idf/HEAD') }}-${{ steps.py3.outputs.python-path }}-20220404 - name: Clone IDF submodules run: | (cd $IDF_PATH && git submodule update --init) @@ -449,7 +449,7 @@ jobs: IDF_PATH: ${{ github.workspace }}/ports/espressif/esp-idf IDF_TOOLS_PATH: ${{ github.workspace }}/.idf_tools BOARDS: ${{ matrix.board }} - - uses: actions/upload-artifact@v2 + - uses: actions/upload-artifact@v3 with: name: ${{ matrix.board }} path: bin/${{ matrix.board }} @@ -471,10 +471,10 @@ jobs: if: ${{ needs.test.outputs.boards-aarch != '[]' }} steps: - name: Set up Python 3 - uses: actions/setup-python@v2 + uses: actions/setup-python@v4 with: python-version: "3.x" - - uses: actions/checkout@v2.2.0 + - uses: actions/checkout@v3 with: submodules: false fetch-depth: 1 @@ -486,8 +486,9 @@ jobs: pip install -r requirements-ci.txt -r requirements-dev.txt wget --no-verbose https://adafruit-circuit-python.s3.amazonaws.com/gcc-arm-10.3-2021.07-x86_64-aarch64-none-elf.tar.xz sudo tar -C /usr --strip-components=1 -xaf gcc-arm-10.3-2021.07-x86_64-aarch64-none-elf.tar.xz - wget --no-verbose https://adafruit-circuit-python.s3.amazonaws.com/gcc-arm-none-eabi-10-2020-q4-major-x86_64-linux.tar.bz2 - sudo tar -C /usr --strip-components=1 -xaf gcc-arm-none-eabi-10-2020-q4-major-x86_64-linux.tar.bz2 + - uses: carlosperate/arm-none-eabi-gcc-action@v1 + with: + release: '10-2020-q4' - name: Install mkfs.fat run: | wget https://github.com/dosfstools/dosfstools/releases/download/v4.2/dosfstools-4.2.tar.gz @@ -513,7 +514,7 @@ jobs: working-directory: tools env: BOARDS: ${{ matrix.board }} - - uses: actions/upload-artifact@v2 + - uses: actions/upload-artifact@v3 with: name: ${{ matrix.board }} path: bin/${{ matrix.board }} diff --git a/.github/workflows/create_website_pr.yml b/.github/workflows/create_website_pr.yml index 2367b6c475..75de556c68 100644 --- a/.github/workflows/create_website_pr.yml +++ b/.github/workflows/create_website_pr.yml @@ -16,12 +16,12 @@ jobs: env: GITHUB_CONTEXT: ${{ toJson(github) }} run: echo "$GITHUB_CONTEXT" - - uses: actions/checkout@v2.2.0 + - uses: actions/checkout@v3 with: submodules: false fetch-depth: 1 - name: Set up Python 3 - uses: actions/setup-python@v2 + uses: actions/setup-python@v4 with: python-version: "3.x" - name: Get CP deps diff --git a/.github/workflows/ports_windows.yml b/.github/workflows/ports_windows.yml index bc5f837745..6d38f3b853 100644 --- a/.github/workflows/ports_windows.yml +++ b/.github/workflows/ports_windows.yml @@ -71,7 +71,7 @@ jobs: which python; python --version; python -c "import cascadetoml" which python3; python3 --version; python3 -c "import cascadetoml" - - uses: actions/checkout@v2.2.0 + - uses: actions/checkout@v3 with: submodules: false fetch-depth: 1 diff --git a/.github/workflows/pre-commit.yml b/.github/workflows/pre-commit.yml index 52e2d2b714..a23dcd1d11 100644 --- a/.github/workflows/pre-commit.yml +++ b/.github/workflows/pre-commit.yml @@ -14,33 +14,32 @@ concurrency: jobs: pre-commit: - runs-on: ubuntu-20.04 + runs-on: ubuntu-22.04 steps: - - uses: actions/checkout@v2.2.0 + - uses: actions/checkout@v3 - name: Set up Python 3 - uses: actions/setup-python@v2 + uses: actions/setup-python@v4 with: python-version: "3.x" - name: Install deps run: | - sudo apt-add-repository -y -u ppa:pybricks/ppa sudo apt-get install -y gettext uncrustify pip3 install black polib pyyaml - name: Populate selected submodules run: git submodule update --init extmod/ulab - name: Set PY run: echo >>$GITHUB_ENV PY="$(python -c 'import hashlib, sys;print(hashlib.sha256(sys.version.encode()+sys.executable.encode()).hexdigest())')" - - uses: actions/cache@v2 + - uses: actions/cache@v3 with: path: ~/.cache/pre-commit key: pre-commit|${{ env.PY }}|${{ hashFiles('.pre-commit-config.yaml') }} - - uses: pre-commit/action@v1.1.0 + - uses: pre-commit/action@v3.0.0 - name: Make patch if: failure() run: git diff > ~/pre-commit.patch - name: Upload patch if: failure() - uses: actions/upload-artifact@v2 + uses: actions/upload-artifact@v3 with: name: patch path: ~/pre-commit.patch diff --git a/.gitmodules b/.gitmodules index 93eed8c4c3..0d521b5ff0 100644 --- a/.gitmodules +++ b/.gitmodules @@ -145,10 +145,10 @@ url = https://github.com/adafruit/Adafruit_CircuitPython_RFM69.git [submodule "ports/espressif/esp-idf"] path = ports/espressif/esp-idf - url = https://github.com/espressif/esp-idf.git - branch = release/v4.4 + url = https://github.com/adafruit/esp-idf.git + branch = circuitpython8 [submodule "ports/espressif/certificates/nina-fw"] - path = ports/espressif/certificates/nina-fw + path = lib/certificates/nina-fw url = https://github.com/adafruit/nina-fw.git [submodule "frozen/Adafruit_CircuitPython_ST7789"] path = frozen/Adafruit_CircuitPython_ST7789 @@ -289,3 +289,33 @@ [submodule "frozen/pew-pewpew-lcd"] path = frozen/pew-pewpew-lcd url = https://github.com/pypewpew/pew-pewpew-lcd.git +[submodule "frozen/mixgo_cp_lib"] + path = frozen/mixgo_cp_lib + url = https://github.com/dahanzimin/circuitpython_lib.git +[submodule "frozen/Adafruit_CircuitPython_IS31FL3731"] + path = frozen/Adafruit_CircuitPython_IS31FL3731 + url = https://github.com/adafruit/Adafruit_CircuitPython_IS31FL3731.git +[submodule "frozen/Adafruit_CircuitPython_Ticks"] + path = frozen/Adafruit_CircuitPython_Ticks + url = https://github.com/adafruit/Adafruit_CircuitPython_Ticks.git +[submodule "frozen/Adafruit_CircuitPython_asyncio"] + path = frozen/Adafruit_CircuitPython_asyncio + url = https://github.com/adafruit/Adafruit_CircuitPython_asyncio.git +[submodule "frozen/circuitpython_ef_music"] + path = frozen/circuitpython_ef_music + url = https://github.com/elecfreaks/circuitpython_ef_music.git +[submodule "frozen/circuitpython_picoed"] + path = frozen/circuitpython_picoed + url = https://github.com/elecfreaks/circuitpython_picoed.git +[submodule "ports/espressif/esp32-camera"] + path = ports/espressif/esp32-camera + url = https://github.com/adafruit/esp32-camera/ +[submodule "ports/raspberrypi/lib/cyw43-driver"] + path = ports/raspberrypi/lib/cyw43-driver + url = https://github.com/georgerobotics/cyw43-driver.git +[submodule "ports/raspberrypi/lib/lwip"] + path = ports/raspberrypi/lib/lwip + url = https://github.com/lwip-tcpip/lwip.git +[submodule "lib/mbedtls"] + path = lib/mbedtls + url = https://github.com/ARMmbed/mbedtls.git diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml index bcf7f8da2b..1905b233cf 100644 --- a/.pre-commit-config.yaml +++ b/.pre-commit-config.yaml @@ -10,7 +10,7 @@ repos: - id: end-of-file-fixer exclude: '^(tests/.*\.exp|tests/cmdline/.*|tests/.*/data/.*|ports/espressif/esp-idf-config/.*|ports/espressif/boards/.*/sdkconfig)' - id: trailing-whitespace - exclude: '^(tests/.*\.exp|tests/cmdline/.*|tests/.*/data/.*)' + exclude: '^(tests/.*\.exp|tests/cmdline/.*|tests/.*/data/.*|lib/mbedtls_errors/.*)' - repo: local hooks: - id: translations diff --git a/BUILDING.md b/BUILDING.md index fc7b116595..37800e689f 100644 --- a/BUILDING.md +++ b/BUILDING.md @@ -70,7 +70,7 @@ The test suite in the top level `tests` directory. It needs the unix port to ru Then you can run the test suite: cd ../../tests - ./run-tests + ./run-tests.py A successful run will say something like diff --git a/LICENSE b/LICENSE index 2b9a64b89a..5b8797814f 100644 --- a/LICENSE +++ b/LICENSE @@ -1,6 +1,6 @@ -The MIT License (MIT) +MIT License -Copyright (c) 2013-2022 Damien P. George +Copyright (c) 2013-2022 Damien P. George and others Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal @@ -9,77 +9,13 @@ 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 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. - --------------------------------------------------------------------------------- - -Unless specified otherwise (see below), the above license and copyright applies -to all files in this repository. - -Individual files may include additional copyright holders. - -The various ports of MicroPython may include third-party software that is -licensed under different terms. These licenses are summarised in the tree -below, please refer to these files and directories for further license and -copyright information. Note that (L)GPL-licensed code listed below is only -used during the build process and is not part of the compiled source code. - -/ (MIT) - /drivers - /cc3000 (BSD-3-clause) - /cc3100 (BSD-3-clause) - /wiznet5k (BSD-3-clause) - /lib - /asf4 (Apache-2.0) - /axtls (BSD-3-clause) - /config - /scripts - /config (GPL-2.0-or-later) - /Rules.mak (GPL-2.0) - /berkeley-db-1xx (BSD-4-clause) - /btstack (See btstack/LICENSE) - /cmsis (BSD-3-clause) - /crypto-algorithms (NONE) - /libhydrogen (ISC) - /littlefs (BSD-3-clause) - /lwip (BSD-3-clause) - /mynewt-nimble (Apache-2.0) - /nrfx (BSD-3-clause) - /nxp_driver (BSD-3-Clause) - /oofatfs (BSD-1-clause) - /pico-sdk (BSD-3-clause) - /re15 (BSD-3-clause) - /stm32lib (BSD-3-clause) - /tinytest (BSD-3-clause) - /tinyusb (MIT) - /uzlib (Zlib) - /logo (uses OFL-1.1) - /ports - /cc3200 - /hal (BSD-3-clause) - /simplelink (BSD-3-clause) - /FreeRTOS (GPL-2.0 with FreeRTOS exception) - /stm32 - /usbd*.c (MCD-ST Liberty SW License Agreement V2) - /stm32_it.* (MIT + BSD-3-clause) - /system_stm32*.c (MIT + BSD-3-clause) - /boards - /startup_stm32*.s (BSD-3-clause) - /*/stm32*.h (BSD-3-clause) - /usbdev (MCD-ST Liberty SW License Agreement V2) - /usbhost (MCD-ST Liberty SW License Agreement V2) - /teensy - /core (PJRC.COM) - /zephyr - /src (Apache-2.0) - /tools - /dfu.py (LGPL-3.0-only) +OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE +SOFTWARE. diff --git a/LICENSE_MicroPython b/LICENSE_MicroPython new file mode 100644 index 0000000000..2b9a64b89a --- /dev/null +++ b/LICENSE_MicroPython @@ -0,0 +1,85 @@ +The MIT License (MIT) + +Copyright (c) 2013-2022 Damien P. George + +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. + +-------------------------------------------------------------------------------- + +Unless specified otherwise (see below), the above license and copyright applies +to all files in this repository. + +Individual files may include additional copyright holders. + +The various ports of MicroPython may include third-party software that is +licensed under different terms. These licenses are summarised in the tree +below, please refer to these files and directories for further license and +copyright information. Note that (L)GPL-licensed code listed below is only +used during the build process and is not part of the compiled source code. + +/ (MIT) + /drivers + /cc3000 (BSD-3-clause) + /cc3100 (BSD-3-clause) + /wiznet5k (BSD-3-clause) + /lib + /asf4 (Apache-2.0) + /axtls (BSD-3-clause) + /config + /scripts + /config (GPL-2.0-or-later) + /Rules.mak (GPL-2.0) + /berkeley-db-1xx (BSD-4-clause) + /btstack (See btstack/LICENSE) + /cmsis (BSD-3-clause) + /crypto-algorithms (NONE) + /libhydrogen (ISC) + /littlefs (BSD-3-clause) + /lwip (BSD-3-clause) + /mynewt-nimble (Apache-2.0) + /nrfx (BSD-3-clause) + /nxp_driver (BSD-3-Clause) + /oofatfs (BSD-1-clause) + /pico-sdk (BSD-3-clause) + /re15 (BSD-3-clause) + /stm32lib (BSD-3-clause) + /tinytest (BSD-3-clause) + /tinyusb (MIT) + /uzlib (Zlib) + /logo (uses OFL-1.1) + /ports + /cc3200 + /hal (BSD-3-clause) + /simplelink (BSD-3-clause) + /FreeRTOS (GPL-2.0 with FreeRTOS exception) + /stm32 + /usbd*.c (MCD-ST Liberty SW License Agreement V2) + /stm32_it.* (MIT + BSD-3-clause) + /system_stm32*.c (MIT + BSD-3-clause) + /boards + /startup_stm32*.s (BSD-3-clause) + /*/stm32*.h (BSD-3-clause) + /usbdev (MCD-ST Liberty SW License Agreement V2) + /usbhost (MCD-ST Liberty SW License Agreement V2) + /teensy + /core (PJRC.COM) + /zephyr + /src (Apache-2.0) + /tools + /dfu.py (LGPL-3.0-only) diff --git a/README.rst b/README.rst index 801466cbad..d8a35fb98c 100644 --- a/README.rst +++ b/README.rst @@ -84,15 +84,19 @@ common set of requirements. If you'd like to use the term "CircuitPython" and Blinka for your product here is what we ask: -* Your product is supported by the primary +- Your product is supported by the primary `"adafruit/circuitpython" `_ repo. This way we can update any custom code as we update the CircuitPython internals. -* Your product is listed on `circuitpython.org `__ (source +- Your product is listed on `circuitpython.org `__ (source `here `_). This is to ensure that a user of your product can always download the latest version of CircuitPython from the standard place. -* Your product has a user accessible USB plug which appears as a CIRCUITPY drive when plugged in - AND/OR provides file and serial access over Bluetooth Low Energy. Boards that do not support USB - should be clearly marked as BLE-only CircuitPython. +- Your product supports at least one standard "`Workflow `__" for serial and file access: + + - With a user accessible USB plug which appears as a CIRCUITPY drive when plugged in. + - With file and serial access over Bluetooth Low Energy using the BLE Workflow. + - With file access over WiFi using the WiFi Workflow with serial access over USB and/or WebSocket. + +- Boards that do not support the USB Workflow should be clearly marked. If you choose not to meet these requirements, then we ask you call your version of CircuitPython something else (for example, SuperDuperPython) and not use the Blinka logo. You can say it is @@ -120,7 +124,7 @@ Behavior make each file independent from each other. - ``boot.py`` runs only once on start up before - USB is initialized. This lays the ground work for configuring USB at + workflows are initialized. This lays the ground work for configuring USB at startup rather than it being fixed. Since serial is not available, output is written to ``boot_out.txt``. - ``code.py`` (or ``main.py``) is run after every reload until it @@ -135,7 +139,10 @@ Behavior possible to fix code that causes nasty crashes by making it available through mass storage after the crash. A reset (the button) is needed after it's fixed to get back into normal mode. - RGB status LED indicating CircuitPython state. -- Re-runs ``code.py`` or other main file after file system writes over USB mass storage. (Disable with + - One green flash - code completed without error. + - Two red flashes - code ended due to an exception. + - Three yellow flashes - safe mode. May be due to CircuitPython internal error. +- Re-runs ``code.py`` or other main file after file system writes by a workflow. (Disable with ``supervisor.disable_autoreload()``) - Autoreload is disabled while the REPL is active. - Main is one of these: ``code.txt``, ``code.py``, ``main.py``, @@ -213,7 +220,7 @@ Supported Support status ================ ============================================================ atmel-samd ``SAMD21`` stable | ``SAMD51`` stable cxd56 stable -espressif ``ESP32-C3`` beta | ``ESP32-S2`` stable | ``ESP32-S3`` beta +espressif ``ESP32`` beta | ``ESP32-C3`` beta | ``ESP32-S2`` stable | ``ESP32-S3`` beta litex alpha mimxrt10xx alpha nrf stable diff --git a/conf.py b/conf.py index c92e8bb719..90f58979d9 100644 --- a/conf.py +++ b/conf.py @@ -52,8 +52,8 @@ subprocess.check_output(["make", "stubs"]) #modules_support_matrix = shared_bindings_matrix.support_matrix_excluded_boards() modules_support_matrix = shared_bindings_matrix.support_matrix_by_board() modules_support_matrix_reverse = defaultdict(list) -for board, modules in modules_support_matrix.items(): - for module in modules[0]: +for board, matrix_info in modules_support_matrix.items(): + for module in matrix_info["modules"]: modules_support_matrix_reverse[module].append(board) modules_support_matrix_reverse = dict( @@ -199,6 +199,7 @@ exclude_patterns = ["**/build*", "ports/cxd56/spresense-exported-sdk", "ports/espressif/certificates", "ports/espressif/esp-idf", + "ports/espressif/esp32-camera", "ports/espressif/.idf_tools", "ports/espressif/peripherals", "ports/litex/hw", @@ -212,6 +213,7 @@ exclude_patterns = ["**/build*", "ports/nrf/peripherals", "ports/nrf/usb", "ports/raspberrypi/sdk", + "ports/raspberrypi/lib", "ports/stm/st_driver", "ports/stm/packages", "ports/stm/peripherals", diff --git a/data/nvm.toml b/data/nvm.toml index 266ea20ed8..2d292ad4e6 160000 --- a/data/nvm.toml +++ b/data/nvm.toml @@ -1 +1 @@ -Subproject commit 266ea20ed80104c315dcb124b482fa5f9f48cdec +Subproject commit 2d292ad4e67890d4b85b027431ba9fef7bf561fd diff --git a/devices/ble_hci/common-hal/_bleio/Adapter.c b/devices/ble_hci/common-hal/_bleio/Adapter.c index 839519dc33..8c7b8f67eb 100644 --- a/devices/ble_hci/common-hal/_bleio/Adapter.c +++ b/devices/ble_hci/common-hal/_bleio/Adapter.c @@ -49,6 +49,10 @@ #include "shared-bindings/_bleio/ScanEntry.h" #include "shared-bindings/time/__init__.h" +#if CIRCUITPY_DOTENV +#include "shared-module/dotenv/__init__.h" +#endif + #define MSEC_TO_UNITS(TIME, RESOLUTION) (((TIME) * 1000) / (RESOLUTION)) #define SEC_TO_UNITS(TIME, RESOLUTION) (((TIME) * 1000000) / (RESOLUTION)) #define UNITS_TO_SEC(TIME, RESOLUTION) (((TIME)*(RESOLUTION)) / 1000000) @@ -278,17 +282,27 @@ char default_ble_name[] = { 'C', 'I', 'R', 'C', 'U', 'I', 'T', 'P', 'Y', 0, 0, 0 // Get various values and limits set by the adapter. // Set event mask. STATIC void bleio_adapter_hci_init(bleio_adapter_obj_t *self) { + mp_int_t name_len = 0; - const size_t len = sizeof(default_ble_name); + #if CIRCUITPY_DOTENV + char ble_name[32]; + name_len = dotenv_get_key("/.env", "CIRCUITPY_BLE_NAME", ble_name, sizeof(ble_name) - 1); + if (name_len > 0) { + self->name = mp_obj_new_str(ble_name, (size_t)name_len); + } + #endif - bt_addr_t addr; - hci_check_error(hci_read_bd_addr(&addr)); + if (name_len <= 0) { + name_len = sizeof(default_ble_name); + bt_addr_t addr; + hci_check_error(hci_read_bd_addr(&addr)); - default_ble_name[len - 4] = nibble_to_hex_lower[addr.val[1] >> 4 & 0xf]; - default_ble_name[len - 3] = nibble_to_hex_lower[addr.val[1] & 0xf]; - default_ble_name[len - 2] = nibble_to_hex_lower[addr.val[0] >> 4 & 0xf]; - default_ble_name[len - 1] = nibble_to_hex_lower[addr.val[0] & 0xf]; - self->name = mp_obj_new_str(default_ble_name, len); + default_ble_name[name_len - 4] = nibble_to_hex_lower[addr.val[1] >> 4 & 0xf]; + default_ble_name[name_len - 3] = nibble_to_hex_lower[addr.val[1] & 0xf]; + default_ble_name[name_len - 2] = nibble_to_hex_lower[addr.val[0] >> 4 & 0xf]; + default_ble_name[name_len - 1] = nibble_to_hex_lower[addr.val[0] & 0xf]; + self->name = mp_obj_new_str(default_ble_name, (uint8_t)name_len); + } // Get version information. if (hci_read_local_version(&self->hci_version, &self->hci_revision, &self->lmp_version, diff --git a/devices/ble_hci/common-hal/_bleio/Characteristic.c b/devices/ble_hci/common-hal/_bleio/Characteristic.c index e2f9cad0ef..b6e144f191 100644 --- a/devices/ble_hci/common-hal/_bleio/Characteristic.c +++ b/devices/ble_hci/common-hal/_bleio/Characteristic.c @@ -57,9 +57,9 @@ void common_hal_bleio_characteristic_construct(bleio_characteristic_obj_t *self, self->value = mp_obj_new_bytes(initial_value_bufinfo->buf, initial_value_bufinfo->len); const mp_int_t max_length_max = 512; - if (max_length < 0 || max_length > max_length_max) { - mp_raise_ValueError(translate("max_length must be <= 512")); - } + + mp_arg_validate_int_range(max_length, 0, max_length_max, MP_QSTR_max_length); + self->max_length = max_length; self->fixed_length = fixed_length; diff --git a/devices/ble_hci/common-hal/_bleio/CharacteristicBuffer.c b/devices/ble_hci/common-hal/_bleio/CharacteristicBuffer.c index 0d87f03ae3..5c8c659e36 100644 --- a/devices/ble_hci/common-hal/_bleio/CharacteristicBuffer.c +++ b/devices/ble_hci/common-hal/_bleio/CharacteristicBuffer.c @@ -93,6 +93,7 @@ bool common_hal_bleio_characteristic_buffer_deinited(bleio_characteristic_buffer void common_hal_bleio_characteristic_buffer_deinit(bleio_characteristic_buffer_obj_t *self) { if (!common_hal_bleio_characteristic_buffer_deinited(self)) { bleio_characteristic_clear_observer(self->characteristic); + ringbuf_deinit(&self->ringbuf); } } diff --git a/devices/ble_hci/common-hal/_bleio/PacketBuffer.c b/devices/ble_hci/common-hal/_bleio/PacketBuffer.c index 7380d7ed4f..b690909029 100644 --- a/devices/ble_hci/common-hal/_bleio/PacketBuffer.c +++ b/devices/ble_hci/common-hal/_bleio/PacketBuffer.c @@ -37,13 +37,13 @@ #include "supervisor/shared/tick.h" STATIC void write_to_ringbuf(bleio_packet_buffer_obj_t *self, uint8_t *data, uint16_t len) { - if (len + sizeof(uint16_t) > ringbuf_capacity(&self->ringbuf)) { + if (len + sizeof(uint16_t) > ringbuf_size(&self->ringbuf)) { // This shouldn't happen. return; } // Push all the data onto the ring buffer. // Make room for the new value by dropping the oldest packets first. - while (ringbuf_capacity(&self->ringbuf) - ringbuf_num_filled(&self->ringbuf) < len + sizeof(uint16_t)) { + while (ringbuf_size(&self->ringbuf) - ringbuf_num_filled(&self->ringbuf) < len + sizeof(uint16_t)) { uint16_t packet_length; ringbuf_get_n(&self->ringbuf, (uint8_t *)&packet_length, sizeof(uint16_t)); for (uint16_t i = 0; i < packet_length; i++) { @@ -264,5 +264,6 @@ bool common_hal_bleio_packet_buffer_deinited(bleio_packet_buffer_obj_t *self) { void common_hal_bleio_packet_buffer_deinit(bleio_packet_buffer_obj_t *self) { if (!common_hal_bleio_packet_buffer_deinited(self)) { bleio_characteristic_clear_observer(self->characteristic); + ringbuf_deinit(&self->ringbuf); } } diff --git a/devices/ble_hci/common-hal/_bleio/att.c b/devices/ble_hci/common-hal/_bleio/att.c index abfe7429f4..f649967ca9 100644 --- a/devices/ble_hci/common-hal/_bleio/att.c +++ b/devices/ble_hci/common-hal/_bleio/att.c @@ -44,6 +44,7 @@ #include "shared-bindings/_bleio/Service.h" #include "shared-bindings/_bleio/UUID.h" #include "supervisor/shared/tick.h" +#include "supervisor/shared/translate/translate.h" STATIC uint16_t max_mtu = BT_ATT_DEFAULT_LE_MTU; // 23 STATIC unsigned long timeout = 5000; diff --git a/license.rst b/docs/LICENSE.md similarity index 78% rename from license.rst rename to docs/LICENSE.md index 7e97341cda..a63dd7c965 100644 --- a/license.rst +++ b/docs/LICENSE.md @@ -1,9 +1,8 @@ -MicroPython & CircuitPython license information -=============================================== +# MicroPython & CircuitPython License -The MIT License (MIT) +MIT License -Copyright (c) 2013-2017 Damien P. George, and others +Copyright (c) 2013-2022 Damien P. George and others Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal @@ -12,13 +11,13 @@ 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 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. +OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE +SOFTWARE. diff --git a/docs/design_guide.rst b/docs/design_guide.rst index fdb8f9b019..4170d499fe 100644 --- a/docs/design_guide.rst +++ b/docs/design_guide.rst @@ -141,7 +141,7 @@ statement will ensure hardware isn't enabled longer than needed. Verify your device -------------------------------------------------------------------------------- -Whenever possible, make sure device you are talking to is the device you expect. +Whenever possible, make sure the device you are talking to is the device you expect. If not, raise a RuntimeError. Beware that I2C addresses can be identical on different devices so read registers you know to make sure they match your expectation. Validating this upfront will help catch mistakes. @@ -202,10 +202,10 @@ interchangeably with the CPython name. This is confusing. Instead, think up a new name that is related to the extra functionality you are adding. For example, storage mounting and unmounting related functions were moved from -``uos`` into a new `storage` module. Terminal related functions were moved into -`multiterminal`. These names better match their functionality and do not -conflict with CPython names. Make sure to check that you don't conflict with -CPython libraries too. That way we can port the API to CPython in the future. +``uos`` into a new `storage` module. These names better match their +functionality and do not conflict with CPython names. Make sure to check that +you don't conflict with CPython libraries too. That way we can port the API to +CPython in the future. Example ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ @@ -213,7 +213,7 @@ Example When adding extra functionality to CircuitPython to mimic what a normal operating system would do, either copy an existing CPython API (for example file writing) or create a separate module to achieve what you want. For example, -mounting and unmount drives is not a part of CPython so it should be done in a +mounting and unmounting drives is not a part of CPython so it should be done in a module, such as a new ``storage`` module, that is only available in CircuitPython. That way when someone moves the code to CPython they know what parts need to be adapted. @@ -309,7 +309,7 @@ following structure: param_type ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -The type of the parameter. This could be among other `int`, `float`, `str` `bool`, etc. +The type of the parameter. This could be, among others, ``int``, ``float``, ``str``, ``bool``, etc. To document an object in the CircuitPython domain, you need to include a ``~`` before the definition as shown in the following example: @@ -494,6 +494,45 @@ backticks ``:class:`~adafruit_motor.servo.Servo```. You must also add the refer "adafruit_motor": ("https://circuitpython.readthedocs.io/projects/motor/en/latest/", None,), +Use ``adafruit_register`` when possible +-------------------------------------------------------------------------------- +`Register `_ is +a foundational library that manages packing and unpacking data from I2C device +registers. There is also `Register SPI `_ +for SPI devices. When possible, use one of these libraries for unpacking and +packing registers. This ensures the packing code is shared amongst all +registers (even across drivers). Furthermore, it simplifies device definitions +by making them declarative (only data.) + +Values with non-consecutive bits in a register or that represent FIFO endpoints +may not map well to existing register classes. In unique cases like these, it is +ok to read and write the register directly. + +*Do not* add all registers from a datasheet upfront. Instead, only add the ones +necessary for the functionality the driver exposes. Adding them all will lead to +unnecessary file size and API clutter. See `this video about outside-in design +from @tannewt `_. + +I2C Example +^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + +.. code-block:: python + + from adafruit_register import i2c_bit + from adafruit_bus_device import i2c_device + + class HelloWorldDevice: + """Device with two bits to control when the words 'hello' and 'world' are lit.""" + + hello = i2c_bit.RWBit(0x0, 0x0) + """Bit to indicate if hello is lit.""" + + world = i2c_bit.RWBit(0x1, 0x0) + """Bit to indicate if world is lit.""" + + def __init__(self, i2c, device_address=0x0): + self.i2c_device = i2c_device.I2CDevice(i2c, device_address) + Use BusDevice -------------------------------------------------------------------------------- @@ -668,8 +707,24 @@ when using ``const()``, keep in mind these general guide lines: - Always use via an import, ex: ``from micropython import const`` - Limit use to global (module level) variables only. -- If user will not need access to variable, prefix name with a leading - underscore, ex: ``_SOME_CONST``. +- Only used when the user will not need access to variable and prefix name with + a leading underscore, ex: ``_SOME_CONST``. + +Example +^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + +.. code-block:: python + + from adafruit_bus_device import i2c_device + from micropython import const + + _DEFAULT_I2C_ADDR = const(0x42) + + class Widget: + """A generic widget.""" + + def __init__(self, i2c, address=_DEFAULT_I2C_ADDR): + self.i2c_device = i2c_device.I2CDevice(i2c, address) Libraries Examples ------------------ @@ -751,6 +806,16 @@ properties. | ``sound_level`` | float | non-unit-specific sound level (monotonic but not actual decibels) | +-----------------------+-----------------------+-------------------------------------------------------------------------+ +Driver constant naming +-------------------------------------------------------------------------------- + +When adding variables for constant values for a driver. Do not include the +device's name in the variable name. For example, in ``adafruit_fancy123.py``, +variables should not start with ``FANCY123_``. Adding this prefix increases RAM +usage and .mpy file size because variable names are preserved. User code should +refer to these constants as ``adafruit_fancy123.HELLO_WORLD`` for clarity. +``adafruit_fancy123.FANCY123_HELLO_WORLD`` would be overly verbose. + Adding native modules -------------------------------------------------------------------------------- diff --git a/docs/environment.rst b/docs/environment.rst new file mode 100644 index 0000000000..5766b54380 --- /dev/null +++ b/docs/environment.rst @@ -0,0 +1,58 @@ +Environment Variables +===================== + +CircuitPython 8.0.0 introduces support for environment variables. Environment +variables are commonly used to store "secrets" such as Wi-Fi passwords and API +keys. This method *does not* make them secure. It only separates them from the +code. + +CircuitPython supports these by mimicking the `dotenv `_ +CPython library. Other languages such as Javascript, PHP and Ruby also have +dotenv libraries. + +These libraries store environment variables in a ``.env`` file. Here is a simple +example: + +.. code-block:: bash + + KEY1='value1' + # Comment + KEY2='value2 + is multiple lines' + +CircuitPython uses the ``.env`` at the drive root (no folder) as the environment. +User code can access the values from the file using `os.getenv()`. It is +recommended to save any values used repeatedly in a variable because `os.getenv()` +will parse the ``/.env`` on every access. + +CircuitPython behavior +---------------------- + +CircuitPython will also read the environment to configure its behavior. Other +keys are ignored by CircuitPython. Here are the keys it uses: + +CIRCUITPY_BLE_NAME +~~~~~~~~~~~~~~~~~~ +Default BLE name the board advertises as, including for the BLE workflow. + +CIRCUITPY_RESERVED_PSRAM +~~~~~~~~~~~~~~~~~~~~~~~~ +On boards with Espressif microcontrollers with PSRAM (also called SPIRAM), permanently reserve a portion of PSRAM for use by esp-idf. +This storage is removed from the CircuitPython "heap" and is available for allocation by esp-idf routines in the core instead. +Generally, only set this to a non-zero value when it is required by a specific core module. + +CIRCUITPY_WEB_API_PASSWORD +~~~~~~~~~~~~~~~~~~~~~~~~~~ +Password required to make modifications to the board from the Web Workflow. + +CIRCUITPY_WEB_API_PORT +~~~~~~~~~~~~~~~~~~~~~~ +TCP port number used for the web HTTP API. Defaults to 80 when omitted. + +CIRCUITPY_WIFI_PASSWORD +~~~~~~~~~~~~~~~~~~~~~~~ +Wi-Fi password used to auto connect to CIRCUITPY_WIFI_SSID. + +CIRCUITPY_WIFI_SSID +~~~~~~~~~~~~~~~~~~~ +Wi-Fi SSID to auto-connect to even if user code is not running. diff --git a/docs/index.rst b/docs/index.rst index 6e9789852e..abc0236995 100644 --- a/docs/index.rst +++ b/docs/index.rst @@ -22,6 +22,8 @@ Full Table of Contents supported_ports.rst troubleshooting.rst drivers.rst + workflows + environment.rst .. toctree:: :maxdepth: 1 @@ -46,7 +48,7 @@ Full Table of Contents ../CONTRIBUTING ../BUILDING ../CODE_OF_CONDUCT - ../license.rst + ../docs/LICENSE ../WEBUSB_README Indices and tables diff --git a/docs/library/builtins.rst b/docs/library/builtins.rst index a3be5ae16e..5358f3cda3 100644 --- a/docs/library/builtins.rst +++ b/docs/library/builtins.rst @@ -1,8 +1,11 @@ :mod:`builtins` -- builtin functions and exceptions =================================================== +.. module:: builtins + :synopsis: builtin Python functions + All builtin functions and exceptions are described here. They are also -available via ``builtins`` module. +available via the ``builtins`` module. For more information about built-ins, see the following CPython documentation: diff --git a/docs/library/collections.rst b/docs/library/collections.rst index b7a5fb1765..2cc1a215d1 100644 --- a/docs/library/collections.rst +++ b/docs/library/collections.rst @@ -28,7 +28,7 @@ Classes - The optional *flags* can be 1 to check for overflow when adding items. - As well as supporting `bool` and `len`, deque objects have the following + As well as supporting ``bool`` and ``len``, deque objects have the following methods: .. method:: deque.append(x) diff --git a/docs/library/hashlib.rst b/docs/library/hashlib.rst index 8e5ebc2d1a..061f9fd1e0 100644 --- a/docs/library/hashlib.rst +++ b/docs/library/hashlib.rst @@ -5,6 +5,7 @@ .. module:: hashlib :synopsis: hashing algorithms + :noindex: |see_cpython_module| :mod:`cpython:hashlib`. diff --git a/docs/library/micropython.rst b/docs/library/micropython.rst index 2623aab582..dddb813d34 100644 --- a/docs/library/micropython.rst +++ b/docs/library/micropython.rst @@ -76,7 +76,7 @@ Functions .. function:: heap_locked() Lock or unlock the heap. When locked no memory allocation can occur and a - `MemoryError` will be raised if any heap allocation is attempted. + ``MemoryError`` will be raised if any heap allocation is attempted. `heap_locked()` returns a true value if the heap is currently locked. These functions can be nested, ie `heap_lock()` can be called multiple times diff --git a/docs/porting.rst b/docs/porting.rst index 013c367291..f4ed2ab4cc 100644 --- a/docs/porting.rst +++ b/docs/porting.rst @@ -71,7 +71,7 @@ as a natural "TODO" list. An example minimal build list is shown below: CIRCUITPY_SDCARDIO = 0 CIRCUITPY_FRAMEBUFFERIO = 0 CIRCUITPY_FREQUENCYIO = 0 - CIRCUITPY_I2CPERIPHERAL = 0 + CIRCUITPY_I2CTARGET = 0 # Requires SPI, PulseIO (stub ok): CIRCUITPY_DISPLAYIO = 0 @@ -79,8 +79,6 @@ as a natural "TODO" list. An example minimal build list is shown below: # any port once their prerequisites in common-hal are complete. # Requires DigitalIO: CIRCUITPY_BITBANGIO = 0 - # Requires DigitalIO - CIRCUITPY_GAMEPADSHIFT = 0 # Requires neopixel_write or SPI (dotstar) CIRCUITPY_PIXELBUF = 0 # Requires OS diff --git a/docs/redirects.txt b/docs/redirects.txt index 248a042e7a..b8282635ab 100644 --- a/docs/redirects.txt +++ b/docs/redirects.txt @@ -45,12 +45,10 @@ shared-bindings/audiomp3/__init__.rst shared-bindings/audiomp3/ shared-bindings/audiopwmio/PWMAudioOut.rst shared-bindings/audiopwmio/#audiopwmio.PWMAudioOut shared-bindings/audiopwmio/__init__.rst shared-bindings/audiopwmio/ shared-bindings/bitbangio/I2C.rst shared-bindings/bitbangio/#bitbangio.I2C -shared-bindings/bitbangio/OneWire.rst shared-bindings/bitbangio/#bitbangio.OneWire shared-bindings/bitbangio/SPI.rst shared-bindings/bitbangio/#bitbangio.SPI shared-bindings/bitbangio/__init__.rst shared-bindings/bitbangio/ shared-bindings/board/__init__.rst shared-bindings/board/ shared-bindings/busio/I2C.rst shared-bindings/busio/#busio.I2C -shared-bindings/busio/OneWire.rst shared-bindings/busio/#busio.OneWire shared-bindings/busio/Parity.rst shared-bindings/busio/#busio.Parity shared-bindings/busio/SPI.rst shared-bindings/busio/#busio.SPI shared-bindings/busio/UART.rst shared-bindings/busio/#busio.UART @@ -82,10 +80,6 @@ shared-bindings/framebufferio/FramebufferDisplay.rst shared-bindings/framebuffer shared-bindings/framebufferio/__init__.rst shared-bindings/framebufferio/ shared-bindings/frequencyio/FrequencyIn.rst shared-bindings/frequencyio/#frequencyio.FrequencyIn shared-bindings/frequencyio/__init__.rst shared-bindings/frequencyio/ -shared-bindings/gamepad/GamePad.rst shared-bindings/gamepad/#gamepad.GamePad -shared-bindings/gamepad/__init__.rst shared-bindings/gamepad/ -shared-bindings/gamepadshift/GamePadShift.rst shared-bindings/gamepadshift/#gamepadshift.GamePadShift -shared-bindings/gamepadshift/__init__.rst shared-bindings/gamepadshift/ shared-bindings/gnss/__init__.rst shared-bindings/gnss/ shared-bindings/i2cperipheral/__init__.rst shared-bindings/i2cperipheral/ shared-bindings/i2csecondary/__init__.rst shared-bindings/i2csecondary/ @@ -96,11 +90,11 @@ shared-bindings/microcontroller/Pin.rst shared-bindings/microcontroller/#microco shared-bindings/microcontroller/Processor.rst shared-bindings/microcontroller/#microcontroller.Processor shared-bindings/microcontroller/RunMode.rst shared-bindings/microcontroller/#microcontroller.RunMode shared-bindings/microcontroller/__init__.rst shared-bindings/microcontroller/ -shared-bindings/multiterminal/__init__.rst shared-bindings/multiterminal/ shared-bindings/neopixel_write/__init__.rst shared-bindings/neopixel_write/ shared-bindings/network/__init__.rst shared-bindings/network/ shared-bindings/nvm/ByteArray.rst shared-bindings/nvm/#nvm.ByteArray shared-bindings/nvm/__init__.rst shared-bindings/nvm/ +shared-bindings/onewireio/OneWire.rst shared-bindings/onewireio/#onewireio.OneWire shared-bindings/os/__init__.rst shared-bindings/os/ shared-bindings/protomatter/__init__.rst shared-bindings/protomatter/ shared-bindings/ps2io/Ps2.rst shared-bindings/ps2io/#ps2io.Ps2 diff --git a/docs/shared_bindings_matrix.py b/docs/shared_bindings_matrix.py index 961b38370d..5b9b63d8fd 100644 --- a/docs/shared_bindings_matrix.py +++ b/docs/shared_bindings_matrix.py @@ -32,7 +32,7 @@ from concurrent.futures import ThreadPoolExecutor SUPPORTED_PORTS = ['atmel-samd', 'broadcom', 'cxd56', 'espressif', 'litex', 'mimxrt10xx', 'nrf', 'raspberrypi', 'stm'] -aliases_by_board = { +ALIASES_BY_BOARD = { "circuitplayground_express": [ "circuitplayground_express_4h", "circuitplayground_express_digikey_pycon2019", @@ -40,10 +40,9 @@ aliases_by_board = { "pybadge": ["edgebadge"], "pyportal": ["pyportal_pynt"], "gemma_m0": ["gemma_m0_pycon2018"], - "pewpew10": ["pewpew13"], } -aliases_brand_names = { +ALIASES_BRAND_NAMES = { "circuitplayground_express_4h": "Adafruit Circuit Playground Express 4-H", "circuitplayground_express_digikey_pycon2019": @@ -54,19 +53,27 @@ aliases_brand_names = { "Adafruit PyPortal Pynt", "gemma_m0_pycon2018": "Adafruit Gemma M0 PyCon 2018", - "pewpew13": - "PewPew 13", } -additional_modules = { - "fontio": "CIRCUITPY_DISPLAYIO", - "terminalio": "CIRCUITPY_DISPLAYIO", +ADDITIONAL_MODULES = { + "_asyncio": "MICROPY_PY_UASYNCIO", "adafruit_bus_device": "CIRCUITPY_BUSDEVICE", "adafruit_pixelbuf": "CIRCUITPY_PIXELBUF", + "array": "CIRCUITPY_ARRAY", + # always available, so depend on something that's always 1. + "builtins": "CIRCUITPY", + "collections": "CIRCUITPY_COLLECTIONS", + "fontio": "CIRCUITPY_DISPLAYIO", + "io": "CIRCUITPY_IO", + "select": "MICROPY_PY_USELECT_SELECT", + "terminalio": "CIRCUITPY_DISPLAYIO", + "sys": "CIRCUITPY_SYS", "usb": "CIRCUITPY_USB_HOST", } -frozen_excludes = ["examples", "docs", "tests", "utils", "conf.py", "setup.py"] +MODULES_NOT_IN_SHARED_BINDINGS = ["_asyncio", "array", "binascii", "builtins", "collections", "errno", "json", "re", "select", "sys", "ulab"] + +FROZEN_EXCLUDES = ["examples", "docs", "tests", "utils", "conf.py", "setup.py"] """Files and dirs at the root of a frozen directory that should be ignored. This is the same list as in the preprocess_frozen_modules script.""" @@ -74,7 +81,7 @@ repository_urls = {} """Cache of repository URLs for frozen modules.""" def get_circuitpython_root_dir(): - """ The path to the root './circuitpython' directory + """ The path to the root './circuitpython' directory. """ file_path = pathlib.Path(__file__).resolve() root_dir = file_path.parent.parent @@ -82,10 +89,38 @@ def get_circuitpython_root_dir(): return root_dir def get_shared_bindings(): - """ Get a list of modules in shared-bindings based on folder names + """ Get a list of modules in shared-bindings based on folder names. """ shared_bindings_dir = get_circuitpython_root_dir() / "shared-bindings" - return [item.name for item in shared_bindings_dir.iterdir()] + ["binascii", "errno", "json", "re", "ulab"] + return [item.name for item in shared_bindings_dir.iterdir()] + MODULES_NOT_IN_SHARED_BINDINGS + + +def get_board_mapping(): + """ + Compiles the list of boards from the directories, with aliases and mapping + to the port. + """ + boards = {} + for port in SUPPORTED_PORTS: + board_path = os.path.join("../ports", port, "boards") + for board_path in os.scandir(board_path): + if board_path.is_dir(): + board_files = os.listdir(board_path.path) + board_id = board_path.name + aliases = ALIASES_BY_BOARD.get(board_path.name, []) + boards[board_id] = { + "port": port, + "download_count": 0, + "aliases": aliases, + } + for alias in aliases: + boards[alias] = { + "port": port, + "download_count": 0, + "alias": True, + "aliases": [], + } + return boards def read_mpconfig(): @@ -112,8 +147,8 @@ def build_module_map(): full_build = False for module in modules: full_name = module - if module in additional_modules: - search_identifier = additional_modules[module] + if module in ADDITIONAL_MODULES: + search_identifier = ADDITIONAL_MODULES[module] else: search_identifier = 'CIRCUITPY_'+module.lstrip("_").upper() re_pattern = f"{re.escape(search_identifier)}\s*\??=\s*(.+)" @@ -204,27 +239,33 @@ def get_repository_url(directory): repository_urls[directory] = path return path -def frozen_modules_from_dirs(frozen_mpy_dirs): +def frozen_modules_from_dirs(frozen_mpy_dirs, withurl): """ Go through the list of frozen directories and extract the python modules. Paths are of the type: $(TOP)/frozen/Adafruit_CircuitPython_CircuitPlayground $(TOP)/frozen/circuitpython-stage/meowbit Python modules are at the root of the path, and are python files or directories - containing python files. Except the ones in the frozen_excludes list. + containing python files. Except the ones in the FROZEN_EXCLUDES list. """ frozen_modules = [] for frozen_path in filter(lambda x: x, frozen_mpy_dirs.split(" ")): source_dir = get_circuitpython_root_dir() / frozen_path[7:] url_repository = get_repository_url(source_dir) for sub in source_dir.glob("*"): - if sub.name in frozen_excludes: + if sub.name in FROZEN_EXCLUDES: continue if sub.name.endswith(".py"): - frozen_modules.append((sub.name[:-3], url_repository)) + if withurl: + frozen_modules.append((sub.name[:-3], url_repository)) + else: + frozen_modules.append(sub.name[:-3]) continue if next(sub.glob("**/*.py"), None): # tests if not empty - frozen_modules.append((sub.name, url_repository)) + if withurl: + frozen_modules.append((sub.name, url_repository)) + else: + frozen_modules.append(sub.name) return frozen_modules def lookup_setting(settings, key, default=''): @@ -244,7 +285,7 @@ def all_ports_all_boards(ports=SUPPORTED_PORTS): continue yield (port, entry) -def support_matrix_by_board(use_branded_name=True): +def support_matrix_by_board(use_branded_name=True, withurl=True): """ Compiles a list of the available core modules available for each board. """ @@ -272,29 +313,49 @@ def support_matrix_by_board(use_branded_name=True): board_modules.append(base[module]['name']) board_modules.sort() + if "CIRCUITPY_BUILD_EXTENSIONS" in settings: + board_extensions = [ + extension.strip() for extension in + settings["CIRCUITPY_BUILD_EXTENSIONS"].split(",") + ] + else: + raise OSError(f"Board extensions undefined: {board_name}.") + frozen_modules = [] if "FROZEN_MPY_DIRS" in settings: - frozen_modules = frozen_modules_from_dirs(settings["FROZEN_MPY_DIRS"]) + frozen_modules = frozen_modules_from_dirs(settings["FROZEN_MPY_DIRS"], withurl) if frozen_modules: frozen_modules.sort() # generate alias boards too - board_matrix = [(board_name, (board_modules, frozen_modules))] - if entry.name in aliases_by_board: - for alias in aliases_by_board[entry.name]: + board_matrix = [( + board_name, { + "modules": board_modules, + "frozen_libraries": frozen_modules, + "extensions": board_extensions, + } + )] + if entry.name in ALIASES_BY_BOARD: + for alias in ALIASES_BY_BOARD[entry.name]: if use_branded_name: - if alias in aliases_brand_names: - alias = aliases_brand_names[alias] + if alias in ALIASES_BRAND_NAMES: + alias = ALIASES_BRAND_NAMES[alias] else: alias = alias.replace("_"," ").title() - board_matrix.append( (alias, (board_modules, frozen_modules)) ) + board_matrix.append(( + alias, { + "modules": board_modules, + "frozen_libraries": frozen_modules, + "extensions": board_extensions, + }, + )) return board_matrix # this is now a list of (board,modules) executor = ThreadPoolExecutor(max_workers=os.cpu_count()) mapped_exec = executor.map(support_matrix, all_ports_all_boards()) # flatmap with comprehensions - boards = dict(sorted([board for matrix in mapped_exec for board in matrix])) + boards = dict(sorted([board for matrix in mapped_exec for board in matrix], key=lambda x: x[0])) return boards diff --git a/docs/workflows.md b/docs/workflows.md new file mode 100644 index 0000000000..26f5179b51 --- /dev/null +++ b/docs/workflows.md @@ -0,0 +1,430 @@ +# Workflows + +Workflows are the process used to 1) manipulate files on the CircuitPython device and 2) interact +with the serial connection to CircuitPython. The serial connection is usually used to access the +REPL. + +Starting with CircuitPython 3.x we moved to a USB-only workflow. Prior to that, we used the serial +connection alone to do the whole workflow. In CircuitPython 7.x, a BLE workflow was added with the +advantage of working with mobile devices. CircuitPython 8.x added a web workflow that works over the +local network (usually Wi-Fi) and a web browser. Other clients can also use the Web REST API. Boards +should clearly document which workflows are supported. + +Code for workflows lives in `supervisor/shared`. + +The workflow APIs are documented here. + +## USB + +These USB interfaces are enabled by default on boards with USB support. They are usable once the +device has been plugged into a host. + +### CIRCUITPY drive +CircuitPython exposes a standard mass storage (MSC) interface to enable file manipulation over a +standard interface. This interface works underneath the file system at the block level so using it +excludes other types of workflows from manipulating the file system at the same time. + +### CDC serial +CircuitPython exposes one CDC USB interface for CircuitPython serial. This is a standard serial +USB interface. + +TODO: Document how it designates itself from the user CDC. + +Setting baudrate 1200 and disconnecting will reboot into a bootloader. (Used by Arduino to trigger +a reset into bootloader.) + +## BLE + +The BLE workflow is enabled for nRF boards. By default, to prevent malicious access, it is disabled. +To connect to the BLE workflow, press the reset button while the status led blinks blue quickly +after the safe mode blinks. The board will restart and broadcast the file transfer service UUID +(`0xfebb`) along with the board's [Creation IDs](https://github.com/creationid/creators). This +public broadcast is done at a lower transmit level so the devices must be closer. On connection, the +device will need to pair and bond. Once bonded, the device will broadcast whenever disconnected +using a rotating key rather than a static one. Non-bonded devices won't be able to resolve it. After +connection, the central device can discover two default services. One for file transfer and one for +CircuitPython specifically that includes serial characteristics. + +To change the default BLE advertising name without (or before) running user code, the desired name +can be put in the `/.env` file. The key is `CIRCUITPY_BLE_NAME`. It's limited to approximately +30 characters depending on the port's settings and will be truncated if longer. + +### File Transfer API + +CircuitPython uses [an open File Transfer API](https://github.com/adafruit/Adafruit_CircuitPython_BLE_File_Transfer) +to enable file system access. + +### CircuitPython Service + +The base UUID for the CircuitPython service is `ADAFXXXX-4369-7263-7569-7450794686e`. The `XXXX` is +replaced by the four specific digits below. The service itself is `0001`. + +#### TX - `0002` / RX - `0003` + +These characteristic work just like the Nordic Uart Service (NUS) but have different UUIDs to prevent +conflicts with user created NUS services. + +#### Version - `0100` +Read-only characteristic that returns the UTF-8 encoded version string. + +## Web + +The web workflow is depends on adding Wi-Fi credentials into the `/.env` file. The keys are +`CIRCUITPY_WIFI_SSID` and `CIRCUITPY_WIFI_PASSWORD`. Once these are defined, CircuitPython will +automatically connect to the network and start the webserver used for the workflow. The webserver +is on port 80 unless overridden by `CIRCUITPY_WEB_API_PORT`. It also enables MDNS. + +Here is an example `/.env`: + +```bash +# To auto-connect to Wi-Fi +CIRCUITPY_WIFI_SSID='scottswifi' +CIRCUITPY_WIFI_PASSWORD='secretpassword' + +# To enable modifying files from the web. Change this too! +# Leave the User field blank in the browser. +CIRCUITPY_WEB_API_PASSWORD='passw0rd' + +CIRCUITPY_WEB_API_PORT=80 +``` + +MDNS is used to resolve [`circuitpython.local`](http://circuitpython.local) to a device specific +hostname of the form `cpy-XXXXXX.local`. The `XXXXXX` is based on network MAC address. The device +also provides the MDNS service with service type `_circuitpython` and protocol `_tcp`. + +### HTTP +The web server is HTTP 1.1 and may use chunked responses so that it doesn't need to precompute +content length. + +The API generally consists of an HTTP method such as GET or PUT and a path. Requests and responses +also have headers. Responses will contain a status code and status text such as `404 Not Found`. +This API tries to use standard status codes to encode the status of the various operations. The +[Mozilla Developer Network HTTP docs](https://developer.mozilla.org/en-US/docs/Web/HTTP/Basics_of_HTTP) +are a great reference. + +#### Examples +The examples use `curl`, a common command line program for issuing HTTP requests. The examples below +use `circuitpython.local` as the easiest way to work. If you have multiple active devices, you'll +want to use the specific `cpy-XXXXXX.local` version. + +The examples also use `passw0rd` as the password placeholder. Replace it with your password before +running the example. + +### `/` +The root welcome page links to the file system page and also displays other CircuitPython devices +found using MDNS service discovery. This allows web browsers to find other devices from one. (All +devices will respond to `circuitpython.local` so the device redirected to may vary.) + +### CORS +The web server will allow requests from `cpy-XXXXXX.local`, `127.0.0.1`, the device's IP and +`code.circuitpython.org`. (`circuitpython.local` requests will be redirected to `cpy-XXXXXX.local`.) + +### File REST API +All file system related APIs are protected by HTTP basic authentication. It is *NOT* secure but will +hopefully prevent some griefing in shared settings. The password is sent unencrypted so do not reuse +a password with something important. The user field is left blank. + +The password is taken from `/.env` with the key `CIRCUITPY_WEB_API_PASSWORD`. If this is unset, the +server will respond with `403 Forbidden`. When a password is set, but not provided in a request, it +will respond `401 Unauthorized`. + +#### `/fs/` + +The `/fs/` page will respond with a directory browsing HTML once authenticated. This page is always +gzipped. If the `Accept: application/json` header is provided, then the JSON representation of the +root will be returned. + +##### OPTIONS +When requested with the `OPTIONS` method, the server will respond with CORS related headers. Most +aren't needed for API use. They are there for the web browser. + +* `Access-Control-Allow-Methods` - Varies with USB state. `GET, OPTIONS` when USB is active. `GET, OPTIONS, PUT, DELETE, MOVE` otherwise. + +Example: + +```sh +curl -v -u :passw0rd -X OPTIONS -L --location-trusted http://circuitpython.local/fs/ +``` + +#### `/fs//` +Directory paths must end with a /. Otherwise, the path is assumed to be a file. + +##### GET +Returns a JSON representation of the directory. + +* `200 OK` - Directory exists and JSON returned +* `401 Unauthorized` - Incorrect password +* `403 Forbidden` - No `CIRCUITPY_WEB_API_PASSWORD` set +* `404 Not Found` - Missing directory + +Returns information about each file in the directory: + +* `name` - File name. No trailing `/` on directory names +* `directory` - `true` when a directory. `false` otherwise +* `modified_ns` - File modification time in nanoseconds since January 1st, 1970. May not use full resolution +* `file_size` - File size in bytes. `0` for directories + +Example: + +```sh +curl -v -u :passw0rd -H "Accept: application/json" -L --location-trusted http://circuitpython.local/fs/lib/hello/ +``` + +```json +[ + { + "name": "world.txt", + "directory": false, + "modified_ns": 946934328000000000, + "file_size": 12 + } +] +``` + +##### PUT +Tries to make a directory at the given path. Request body is ignored. The custom `X-Timestamp` +header can provide a timestamp in milliseconds since January 1st, 1970 (to match JavaScript's file +time resolution) used for the directories modification time. The RTC time will used otherwise. + +Returns: + +* `204 No Content` - Directory exists +* `201 Created` - Directory created +* `401 Unauthorized` - Incorrect password +* `403 Forbidden` - No `CIRCUITPY_WEB_API_PASSWORD` set +* `409 Conflict` - USB is active and preventing file system modification +* `404 Not Found` - Missing parent directory +* `500 Server Error` - Other, unhandled error + +Example: + +```sh +curl -v -u :passw0rd -X PUT -L --location-trusted http://circuitpython.local/fs/lib/hello/world/ +``` + +##### Move +Moves the directory at the given path to ``X-Destination``. Also known as rename. + +The custom `X-Destination` header stores the destination path of the directory. + +* `201 Created` - Directory renamed +* `401 Unauthorized` - Incorrect password +* `403 Forbidden` - No `CIRCUITPY_WEB_API_PASSWORD` set +* `404 Not Found` - Source directory not found or destination path is missing +* `409 Conflict` - USB is active and preventing file system modification +* `412 Precondition Failed` - The destination path is already in use + +Example: + +```sh +curl -v -u :passw0rd -X MOVE -H "X-Destination: /fs/lib/hello2/" -L --location-trusted http://circuitpython.local/fs/lib/hello/ +``` + +##### DELETE +Deletes the directory and all of its contents. + +* `204 No Content` - Directory and its contents deleted +* `401 Unauthorized` - Incorrect password +* `403 Forbidden` - No `CIRCUITPY_WEB_API_PASSWORD` set +* `404 Not Found` - No directory +* `409 Conflict` - USB is active and preventing file system modification + +Example: + +```sh +curl -v -u :passw0rd -X DELETE -L --location-trusted http://circuitpython.local/fs/lib/hello2/world/ +``` + + +#### `/fs/` + +##### PUT +Stores the provided content to the file path. + +The custom `X-Timestamp` header can provide a timestamp in milliseconds since January 1st, 1970 +(to match JavaScript's file time resolution) used for the directories modification time. The RTC +time will used otherwise. + +Returns: + +* `201 Created` - File created and saved +* `204 No Content` - File existed and overwritten +* `401 Unauthorized` - Incorrect password +* `403 Forbidden` - No `CIRCUITPY_WEB_API_PASSWORD` set +* `404 Not Found` - Missing parent directory +* `409 Conflict` - USB is active and preventing file system modification +* `413 Payload Too Large` - `Expect` header not sent and file is too large +* `417 Expectation Failed` - `Expect` header sent and file is too large +* `500 Server Error` - Other, unhandled error + +If the client sends the `Expect` header, the server will reply with `100 Continue` when ok. + +Example: + +```sh +echo "Hello world" >> test.txt +curl -v -u :passw0rd -T test.txt -L --location-trusted http://circuitpython.local/fs/lib/hello/world.txt +``` + +##### GET +Returns the raw file contents. `Content-Type` will be set based on extension: + +* `text/plain` - `.py`, `.txt` +* `text/javascript` - `.js` +* `text/html` - `.html` +* `application/json` - `.json` +* `application/octet-stream` - Everything else + +Will return: +* `200 OK` - File exists and file returned +* `401 Unauthorized` - Incorrect password +* `403 Forbidden` - No `CIRCUITPY_WEB_API_PASSWORD` set +* `404 Not Found` - Missing file + +Example: + +```sh +curl -v -u :passw0rd -L --location-trusted http://circuitpython.local/fs/lib/hello/world.txt +``` + + +##### Move +Moves the file at the given path to the ``X-Destination``. Also known as rename. + +The custom `X-Destination` header stores the destination path of the file. + +* `201 Created` - File renamed +* `401 Unauthorized` - Incorrect password +* `403 Forbidden` - No `CIRCUITPY_WEB_API_PASSWORD` set +* `404 Not Found` - Source file not found or destination path is missing +* `409 Conflict` - USB is active and preventing file system modification +* `412 Precondition Failed` - The destination path is already in use + +Example: + +```sh +curl -v -u :passw0rd -X MOVE -H "X-Destination: /fs/lib/hello/world2.txt" -L --location-trusted http://circuitpython.local/fs/lib/hello/world.txt +``` + + +##### DELETE +Deletes the file. + + +* `204 No Content` - File existed and deleted +* `401 Unauthorized` - Incorrect password +* `403 Forbidden` - No `CIRCUITPY_WEB_API_PASSWORD` set +* `404 Not Found` - File not found +* `409 Conflict` - USB is active and preventing file system modification + +Example: + +```sh +curl -v -u :passw0rd -X DELETE -L --location-trusted http://circuitpython.local/fs/lib/hello/world2.txt +``` + +### `/cp/` + +`/cp/` serves basic info about the CircuitPython device and others discovered through MDNS. It is +not protected by basic auth in case the device is someone elses. + +Only `GET` requests are supported and will return `405 Method Not Allowed` otherwise. + +#### `/cp/devices.json` + +Returns information about other devices found on the network using MDNS. + +* `total`: Total MDNS response count. May be more than in `devices` if internal limits were hit. +* `devices`: List of discovered devices. + * `hostname`: MDNS hostname + * `instance_name`: MDNS instance name. Defaults to human readable board name. + * `port`: Port of CircuitPython Web API + * `ip`: IP address + +Example: +```sh +curl -v -L http://circuitpython.local/cp/devices.json +``` + +```json +{ + "total": 1, + "devices": [ + { + "hostname": "cpy-951032", + "instance_name": "Adafruit Feather ESP32-S2 TFT", + "port": 80, + "ip": "192.168.1.235" + } + ] +} +``` + +#### `/cp/serial/` + + +Serves a basic serial terminal program when a `GET` request is received without the +`Upgrade: websocket` header. Otherwise the socket is upgraded to a WebSocket. See WebSockets below for more detail. + +This is an authenticated endpoint in both modes. + +#### `/cp/version.json` + +Returns information about the device. + +* `web_api_version`: Always `1`. This versions the rest of the API and new versions may not be backwards compatible. +* `version`: CircuitPython build version. +* `build_date`: CircuitPython build date. +* `board_name`: Human readable name of the board. +* `mcu_name`: Human readable name of the microcontroller. +* `board_id`: Board id used in code and on circuitpython.org. +* `creator_id`: Creator ID for the board. +* `creation_id`: Creation ID for the board, set by the creator. +* `hostname`: MDNS hostname. +* `port`: Port of CircuitPython Web Service. +* `ip`: IP address of the device. + +Example: +```sh +curl -v -L http://circuitpython.local/cp/version.json +``` + +```json +{ + "web_api_version": 1, + "version": "8.0.0-alpha.1-20-ge1d4518a9-dirty", + "build_date": "2022-06-24", + "board_name": "ESP32-S3-USB-OTG-N8", + "mcu_name": "ESP32S3", + "board_id": "espressif_esp32s3_usb_otg_n8", + "creator_id": 12346, + "creation_id": 28683, + "hostname": "cpy-f57ce8", + "port": 80, + "ip": "192.168.1.94" +} +``` + +#### `/code/` + +The `/code/` page returns a small static html page that will pull in and load the full code editor from +[code.circuitpython.org](https://code.circuitpython.org) for a full code editor experience. Because most +of the resources reside online instead of the device, an active internet connection is required. + +### Static files + +* `/favicon.ico` - Blinka +* `/directory.js` - JavaScript for `/fs/` +* `/welcome.js` - JavaScript for `/` + +### WebSocket + +The CircuitPython serial interactions are available over a WebSocket. A WebSocket begins as a +special HTTP request that gets upgraded to a WebSocket. Authentication happens before upgrading. + +WebSockets are *not* bare sockets once upgraded. Instead they have their own framing format for data. +CircuitPython can handle PING and CLOSE opcodes. All others are treated as TEXT. Data to +CircuitPython is expected to be masked UTF-8, as the spec requires. Data from CircuitPython to the +client is unmasked. It is also unbuffered so the client will get a variety of frame sizes. + +Only one WebSocket at a time is supported. diff --git a/extmod/moduasyncio.c b/extmod/moduasyncio.c index 016ffcbc99..c4c4d36ad8 100644 --- a/extmod/moduasyncio.c +++ b/extmod/moduasyncio.c @@ -33,6 +33,8 @@ #include "shared-bindings/supervisor/__init__.h" #endif +#include "supervisor/shared/translate/translate.h" + #if MICROPY_PY_UASYNCIO // Used when task cannot be guaranteed to be non-NULL. diff --git a/extmod/modubinascii.c b/extmod/modubinascii.c index 7157be31fa..5aa9eacefd 100644 --- a/extmod/modubinascii.c +++ b/extmod/modubinascii.c @@ -11,6 +11,8 @@ #include "py/runtime.h" #include "py/binary.h" +#include "supervisor/shared/translate/translate.h" + static void check_not_unicode(const mp_obj_t arg) { #if MICROPY_CPYTHON_COMPAT if (mp_obj_is_str(arg)) { diff --git a/extmod/moductypes.c b/extmod/moductypes.c index 265cbd6d5d..f770ead006 100644 --- a/extmod/moductypes.c +++ b/extmod/moductypes.c @@ -11,7 +11,7 @@ #include "py/objtuple.h" #include "py/binary.h" -#include "supervisor/shared/translate.h" +#include "supervisor/shared/translate/translate.h" #if MICROPY_PY_UCTYPES diff --git a/extmod/moduhashlib.c b/extmod/moduhashlib.c index 741f43c74c..a84254c566 100644 --- a/extmod/moduhashlib.c +++ b/extmod/moduhashlib.c @@ -8,7 +8,7 @@ #include "py/runtime.h" -#include "supervisor/shared/translate.h" +#include "supervisor/shared/translate/translate.h" #if MICROPY_PY_UHASHLIB diff --git a/extmod/moduheapq.c b/extmod/moduheapq.c index 34867a5838..0200245f86 100644 --- a/extmod/moduheapq.c +++ b/extmod/moduheapq.c @@ -6,7 +6,7 @@ #include "py/objlist.h" #include "py/runtime.h" -#include "supervisor/shared/translate.h" +#include "supervisor/shared/translate/translate.h" #if MICROPY_PY_UHEAPQ diff --git a/extmod/modujson.c b/extmod/modujson.c index 9a4db7c273..cff02ae95c 100644 --- a/extmod/modujson.c +++ b/extmod/modujson.c @@ -13,7 +13,7 @@ #include "py/runtime.h" #include "py/stream.h" -#include "supervisor/shared/translate.h" +#include "supervisor/shared/translate/translate.h" #if MICROPY_PY_UJSON diff --git a/extmod/modutimeq.c b/extmod/modutimeq.c index 495675ad1d..fcef14ce98 100644 --- a/extmod/modutimeq.c +++ b/extmod/modutimeq.c @@ -10,7 +10,7 @@ #include "py/runtime.h" #include "py/smallint.h" -#include "supervisor/shared/translate.h" +#include "supervisor/shared/translate/translate.h" #if MICROPY_PY_UTIMEQ diff --git a/extmod/moduzlib.c b/extmod/moduzlib.c index b1eeac934b..6a1a2d6111 100644 --- a/extmod/moduzlib.c +++ b/extmod/moduzlib.c @@ -10,7 +10,7 @@ #include "py/stream.h" #include "py/mperrno.h" -#include "supervisor/shared/translate.h" +#include "supervisor/shared/translate/translate.h" #if MICROPY_PY_UZLIB diff --git a/extmod/ulab b/extmod/ulab index 5d01882c41..57de23c1fb 160000 --- a/extmod/ulab +++ b/extmod/ulab @@ -1 +1 @@ -Subproject commit 5d01882c41dbc4115bc94f0b61c093d5a6b812b6 +Subproject commit 57de23c1fb434ba99aaafe1d00bd77d5cdf5d66b diff --git a/extmod/vfs_fat.c b/extmod/vfs_fat.c index 208cf101f9..d19a53a9ef 100644 --- a/extmod/vfs_fat.c +++ b/extmod/vfs_fat.c @@ -20,7 +20,7 @@ #include "extmod/vfs_fat.h" #include "shared/timeutils/timeutils.h" #include "supervisor/filesystem.h" -#include "supervisor/shared/translate.h" +#include "supervisor/shared/translate/translate.h" #if FF_MAX_SS == FF_MIN_SS #define SECSIZE(fs) (FF_MIN_SS) @@ -30,6 +30,11 @@ #define mp_obj_fat_vfs_t fs_user_mount_t +// Factoring this common call saves about 90 bytes. +STATIC NORETURN void mp_raise_OSError_fresult(FRESULT res) { + mp_raise_OSError(fresult_to_errno_table[res]); +} + STATIC mp_import_stat_t fat_vfs_import_stat(void *vfs_in, const char *path) { fs_user_mount_t *vfs = vfs_in; FILINFO fno; @@ -64,7 +69,7 @@ STATIC mp_obj_t fat_vfs_make_new(const mp_obj_type_t *type, size_t n_args, size_ // don't error out if no filesystem, to let mkfs()/mount() create one if wanted vfs->blockdev.flags |= MP_BLOCKDEV_FLAG_NO_FILESYSTEM; } else if (res != FR_OK) { - mp_raise_OSError(fresult_to_errno_table[res]); + mp_raise_OSError_fresult(res); } return MP_OBJ_FROM_PTR(vfs); @@ -97,7 +102,7 @@ STATIC mp_obj_t fat_vfs_mkfs(mp_obj_t bdev_in) { res = f_mkfs(&vfs->fatfs, FM_FAT32, 0, working_buf, sizeof(working_buf)); } if (res != FR_OK) { - mp_raise_OSError(fresult_to_errno_table[res]); + mp_raise_OSError_fresult(res); } return mp_const_none; @@ -172,7 +177,7 @@ STATIC mp_obj_t fat_vfs_ilistdir_func(size_t n_args, const mp_obj_t *args) { iter->is_str = is_str_type; FRESULT res = f_opendir(&self->fatfs, &iter->dir, path); if (res != FR_OK) { - mp_raise_OSError(fresult_to_errno_table[res]); + mp_raise_OSError_fresult(res); } return MP_OBJ_FROM_PTR(iter); @@ -188,7 +193,7 @@ STATIC mp_obj_t fat_vfs_remove_internal(mp_obj_t vfs_in, mp_obj_t path_in, mp_in FRESULT res = f_stat(&self->fatfs, path, &fno); if (res != FR_OK) { - mp_raise_OSError(fresult_to_errno_table[res]); + mp_raise_OSError_fresult(res); } // check if path is a file or directory @@ -196,7 +201,7 @@ STATIC mp_obj_t fat_vfs_remove_internal(mp_obj_t vfs_in, mp_obj_t path_in, mp_in res = f_unlink(&self->fatfs, path); if (res != FR_OK) { - mp_raise_OSError(fresult_to_errno_table[res]); + mp_raise_OSError_fresult(res); } return mp_const_none; } else { @@ -226,7 +231,7 @@ STATIC mp_obj_t fat_vfs_rename(mp_obj_t vfs_in, mp_obj_t path_in, mp_obj_t path_ FILINFO fno; FRESULT res = f_stat(&self->fatfs, old_path, &fno); if (res != FR_OK) { - mp_raise_OSError(fresult_to_errno_table[res]); + mp_raise_OSError_fresult(res); } if ((fno.fattrib & AM_DIR) != 0 && strlen(new_path) > strlen(old_path) && @@ -245,7 +250,7 @@ STATIC mp_obj_t fat_vfs_rename(mp_obj_t vfs_in, mp_obj_t path_in, mp_obj_t path_ if (res == FR_OK) { return mp_const_none; } else { - mp_raise_OSError(fresult_to_errno_table[res]); + mp_raise_OSError_fresult(res); } } @@ -259,7 +264,7 @@ STATIC mp_obj_t fat_vfs_mkdir(mp_obj_t vfs_in, mp_obj_t path_o) { if (res == FR_OK) { return mp_const_none; } else { - mp_raise_OSError(fresult_to_errno_table[res]); + mp_raise_OSError_fresult(res); } } STATIC MP_DEFINE_CONST_FUN_OBJ_2(fat_vfs_mkdir_obj, fat_vfs_mkdir); @@ -273,7 +278,7 @@ STATIC mp_obj_t fat_vfs_chdir(mp_obj_t vfs_in, mp_obj_t path_in) { FRESULT res = f_chdir(&self->fatfs, path); if (res != FR_OK) { - mp_raise_OSError(fresult_to_errno_table[res]); + mp_raise_OSError_fresult(res); } return mp_const_none; @@ -286,7 +291,7 @@ STATIC mp_obj_t fat_vfs_getcwd(mp_obj_t vfs_in) { char buf[MICROPY_ALLOC_PATH_MAX + 1]; FRESULT res = f_getcwd(&self->fatfs, buf, sizeof(buf)); if (res != FR_OK) { - mp_raise_OSError(fresult_to_errno_table[res]); + mp_raise_OSError_fresult(res); } return mp_obj_new_str(buf, strlen(buf)); } @@ -307,7 +312,7 @@ STATIC mp_obj_t fat_vfs_stat(mp_obj_t vfs_in, mp_obj_t path_in) { } else { FRESULT res = f_stat(&self->fatfs, path, &fno); if (res != FR_OK) { - mp_raise_OSError(fresult_to_errno_table[res]); + mp_raise_OSError_fresult(res); } } @@ -357,7 +362,7 @@ STATIC mp_obj_t fat_vfs_statvfs(mp_obj_t vfs_in, mp_obj_t path_in) { FATFS *fatfs = &self->fatfs; FRESULT res = f_getfree(fatfs, &nclst); if (FR_OK != res) { - mp_raise_OSError(fresult_to_errno_table[res]); + mp_raise_OSError_fresult(res); } mp_obj_tuple_t *t = MP_OBJ_TO_PTR(mp_obj_new_tuple(10, NULL)); @@ -395,7 +400,7 @@ STATIC mp_obj_t vfs_fat_mount(mp_obj_t self_in, mp_obj_t readonly, mp_obj_t mkfs res = f_mkfs(&self->fatfs, FM_FAT | FM_SFD, 0, working_buf, sizeof(working_buf)); } if (res != FR_OK) { - mp_raise_OSError(fresult_to_errno_table[res]); + mp_raise_OSError_fresult(res); } self->blockdev.flags &= ~MP_BLOCKDEV_FLAG_NO_FILESYSTEM; @@ -416,7 +421,7 @@ STATIC mp_obj_t vfs_fat_getlabel(mp_obj_t self_in) { char working_buf[12]; FRESULT res = f_getlabel(&self->fatfs, working_buf, NULL); if (res != FR_OK) { - mp_raise_OSError(fresult_to_errno_table[res]); + mp_raise_OSError_fresult(res); } return mp_obj_new_str(working_buf, strlen(working_buf)); } @@ -431,7 +436,7 @@ STATIC mp_obj_t vfs_fat_setlabel(mp_obj_t self_in, mp_obj_t label_in) { if (res == FR_WRITE_PROTECTED) { mp_raise_msg(&mp_type_OSError, MP_ERROR_TEXT("Read-only filesystem")); } - mp_raise_OSError(fresult_to_errno_table[res]); + mp_raise_OSError_fresult(res); } return mp_const_none; } diff --git a/extmod/vfs_fat_file.c b/extmod/vfs_fat_file.c index 65ee5f9024..2415f7d3c1 100644 --- a/extmod/vfs_fat_file.c +++ b/extmod/vfs_fat_file.c @@ -182,7 +182,7 @@ STATIC mp_obj_t file_open(fs_user_mount_t *vfs, const mp_obj_type_t *type, mp_ar } if (rwxa_count != 1 || plus_count > 1 || bt_count > 1 || bad_mode) { - mp_raise_ValueError(translate("Invalid mode")); + mp_arg_error_invalid(MP_QSTR_mode); } assert(vfs != NULL); diff --git a/extmod/vfs_posix_file.c b/extmod/vfs_posix_file.c index a984ace4a2..94ddbe5f7b 100644 --- a/extmod/vfs_posix_file.c +++ b/extmod/vfs_posix_file.c @@ -8,7 +8,7 @@ #include "py/runtime.h" #include "py/stream.h" #include "extmod/vfs_posix.h" -#include "supervisor/shared/translate.h" +#include "supervisor/shared/translate/translate.h" #if (defined(MICROPY_VFS_POSIX) && MICROPY_VFS_POSIX) || (defined(MICROPY_VFS_POSIX_FILE) && MICROPY_VFS_POSIX_FILE) diff --git a/frozen/Adafruit_CircuitPython_APDS9960 b/frozen/Adafruit_CircuitPython_APDS9960 index 9bd4882092..ba05423ed9 160000 --- a/frozen/Adafruit_CircuitPython_APDS9960 +++ b/frozen/Adafruit_CircuitPython_APDS9960 @@ -1 +1 @@ -Subproject commit 9bd48820928afad549832fe9b4ae497b224007f0 +Subproject commit ba05423ed9aae09ce293603b519a4ac644ef0dab diff --git a/frozen/Adafruit_CircuitPython_BLE b/frozen/Adafruit_CircuitPython_BLE index 13c529288e..4fd499e397 160000 --- a/frozen/Adafruit_CircuitPython_BLE +++ b/frozen/Adafruit_CircuitPython_BLE @@ -1 +1 @@ -Subproject commit 13c529288e9431541fe58cf7992d4f53f7ca3b76 +Subproject commit 4fd499e39720f8ce970cceeb97c2a85c485f7335 diff --git a/frozen/Adafruit_CircuitPython_BLE_Apple_Notification_Center b/frozen/Adafruit_CircuitPython_BLE_Apple_Notification_Center index 258bb62c58..b06b47037a 160000 --- a/frozen/Adafruit_CircuitPython_BLE_Apple_Notification_Center +++ b/frozen/Adafruit_CircuitPython_BLE_Apple_Notification_Center @@ -1 +1 @@ -Subproject commit 258bb62c58e545c38749b8a66f5872035b2384cb +Subproject commit b06b47037aed97475b1676b104d1f4b05c3f5e86 diff --git a/frozen/Adafruit_CircuitPython_BusDevice b/frozen/Adafruit_CircuitPython_BusDevice index b96f0d2794..9ace770b04 160000 --- a/frozen/Adafruit_CircuitPython_BusDevice +++ b/frozen/Adafruit_CircuitPython_BusDevice @@ -1 +1 @@ -Subproject commit b96f0d279481446017ca1cc1ff4abf1f5a10346f +Subproject commit 9ace770b048be9ab0da4a154af279dbb643bbdb0 diff --git a/frozen/Adafruit_CircuitPython_CircuitPlayground b/frozen/Adafruit_CircuitPython_CircuitPlayground index f82d3ef195..47f848f13f 160000 --- a/frozen/Adafruit_CircuitPython_CircuitPlayground +++ b/frozen/Adafruit_CircuitPython_CircuitPlayground @@ -1 +1 @@ -Subproject commit f82d3ef195256aa71d274a34ea25f760d7e651d1 +Subproject commit 47f848f13f75d2f62d16407edaaf6dd0ec1fc3cc diff --git a/frozen/Adafruit_CircuitPython_Crickit b/frozen/Adafruit_CircuitPython_Crickit index 938f6bb335..a37c7cc836 160000 --- a/frozen/Adafruit_CircuitPython_Crickit +++ b/frozen/Adafruit_CircuitPython_Crickit @@ -1 +1 @@ -Subproject commit 938f6bb335ba5e4c56a8062c591ff9f3c18c4297 +Subproject commit a37c7cc83685f2ff84a171a519207567a75d0947 diff --git a/frozen/Adafruit_CircuitPython_DRV2605 b/frozen/Adafruit_CircuitPython_DRV2605 index 8e7e111a9f..4a4619a524 160000 --- a/frozen/Adafruit_CircuitPython_DRV2605 +++ b/frozen/Adafruit_CircuitPython_DRV2605 @@ -1 +1 @@ -Subproject commit 8e7e111a9ff39d3f4311caa7babeb451422c759f +Subproject commit 4a4619a524918f2705c05ca4959385937afa9a7c diff --git a/frozen/Adafruit_CircuitPython_DS3231 b/frozen/Adafruit_CircuitPython_DS3231 index df24498154..726270f510 160000 --- a/frozen/Adafruit_CircuitPython_DS3231 +++ b/frozen/Adafruit_CircuitPython_DS3231 @@ -1 +1 @@ -Subproject commit df2449815433e05ea0f89c19518ccde7a10a2faa +Subproject commit 726270f5103d9d94810eb8b52041b7521afafc5c diff --git a/frozen/Adafruit_CircuitPython_Display_Shapes b/frozen/Adafruit_CircuitPython_Display_Shapes index 2fad6f2f98..288a4f553d 160000 --- a/frozen/Adafruit_CircuitPython_Display_Shapes +++ b/frozen/Adafruit_CircuitPython_Display_Shapes @@ -1 +1 @@ -Subproject commit 2fad6f2f98c0df135e2306d32af18bb2796b852c +Subproject commit 288a4f553d2f616331b5a042568c97b5bb0e44a7 diff --git a/frozen/Adafruit_CircuitPython_Display_Text b/frozen/Adafruit_CircuitPython_Display_Text index de3276cc08..41f06c33ef 160000 --- a/frozen/Adafruit_CircuitPython_Display_Text +++ b/frozen/Adafruit_CircuitPython_Display_Text @@ -1 +1 @@ -Subproject commit de3276cc08ba13901d1f69060ff7501c1699bc4d +Subproject commit 41f06c33ef7a029210416ac61319698f5768e83e diff --git a/frozen/Adafruit_CircuitPython_DotStar b/frozen/Adafruit_CircuitPython_DotStar index a90579e1e1..d645fc2ade 160000 --- a/frozen/Adafruit_CircuitPython_DotStar +++ b/frozen/Adafruit_CircuitPython_DotStar @@ -1 +1 @@ -Subproject commit a90579e1e1e1c973e6ba8f6cf8e914d77fc8f0f2 +Subproject commit d645fc2aded3606e5b0c17689e9f29e7e56bb612 diff --git a/frozen/Adafruit_CircuitPython_ESP32SPI b/frozen/Adafruit_CircuitPython_ESP32SPI index ddd26eb4ab..ee6bfcf9e6 160000 --- a/frozen/Adafruit_CircuitPython_ESP32SPI +++ b/frozen/Adafruit_CircuitPython_ESP32SPI @@ -1 +1 @@ -Subproject commit ddd26eb4abcd3c10ae5dd33b1345d10d58707995 +Subproject commit ee6bfcf9e676eb435c8890db37f07719984a60a1 diff --git a/frozen/Adafruit_CircuitPython_FakeRequests b/frozen/Adafruit_CircuitPython_FakeRequests index f6cdec74b6..8eedf860be 160000 --- a/frozen/Adafruit_CircuitPython_FakeRequests +++ b/frozen/Adafruit_CircuitPython_FakeRequests @@ -1 +1 @@ -Subproject commit f6cdec74b64112016c459abe4a5d31a3b34caeb3 +Subproject commit 8eedf860beca0d32219189b72ea6fc8eea7e66db diff --git a/frozen/Adafruit_CircuitPython_FocalTouch b/frozen/Adafruit_CircuitPython_FocalTouch index a77f0f9c2e..3d7d404a1c 160000 --- a/frozen/Adafruit_CircuitPython_FocalTouch +++ b/frozen/Adafruit_CircuitPython_FocalTouch @@ -1 +1 @@ -Subproject commit a77f0f9c2e8f64568bbb68254d0134fbc7b5a8af +Subproject commit 3d7d404a1cafc02f6c3391b100157490132e5c5f diff --git a/frozen/Adafruit_CircuitPython_HID b/frozen/Adafruit_CircuitPython_HID index 2fddabcaf0..93c7e0ed55 160000 --- a/frozen/Adafruit_CircuitPython_HID +++ b/frozen/Adafruit_CircuitPython_HID @@ -1 +1 @@ -Subproject commit 2fddabcaf0df1763111ed9dbf9e2d4cdb5b0434e +Subproject commit 93c7e0ed55e7ed011908ac9a1c0f8228f0f4323b diff --git a/frozen/Adafruit_CircuitPython_IRRemote b/frozen/Adafruit_CircuitPython_IRRemote index 1e478b1530..992b601e24 160000 --- a/frozen/Adafruit_CircuitPython_IRRemote +++ b/frozen/Adafruit_CircuitPython_IRRemote @@ -1 +1 @@ -Subproject commit 1e478b1530b3be81bd84f13620d0a23502d377f1 +Subproject commit 992b601e2469f30e95ec35c9859b4aa2cd917504 diff --git a/frozen/Adafruit_CircuitPython_IS31FL3731 b/frozen/Adafruit_CircuitPython_IS31FL3731 new file mode 160000 index 0000000000..794488d1de --- /dev/null +++ b/frozen/Adafruit_CircuitPython_IS31FL3731 @@ -0,0 +1 @@ +Subproject commit 794488d1de3d17d1a08887c4a651cfac2c5a1524 diff --git a/frozen/Adafruit_CircuitPython_LC709203F b/frozen/Adafruit_CircuitPython_LC709203F index a9cf0cde77..1919916dcf 160000 --- a/frozen/Adafruit_CircuitPython_LC709203F +++ b/frozen/Adafruit_CircuitPython_LC709203F @@ -1 +1 @@ -Subproject commit a9cf0cde77c185c6bbc79a3b6d77dd024a9683d2 +Subproject commit 1919916dcf57e0879832b9c274c5fb77712d7775 diff --git a/frozen/Adafruit_CircuitPython_LIS3DH b/frozen/Adafruit_CircuitPython_LIS3DH index acc4bdd73f..18eaddb96a 160000 --- a/frozen/Adafruit_CircuitPython_LIS3DH +++ b/frozen/Adafruit_CircuitPython_LIS3DH @@ -1 +1 @@ -Subproject commit acc4bdd73fdceb74d75cd5a1f261ae157ee32613 +Subproject commit 18eaddb96aa6599901ef2ff0e140e89a2de8c5d0 diff --git a/frozen/Adafruit_CircuitPython_LSM6DS b/frozen/Adafruit_CircuitPython_LSM6DS index 3d1aab0daf..c8e82b96c6 160000 --- a/frozen/Adafruit_CircuitPython_LSM6DS +++ b/frozen/Adafruit_CircuitPython_LSM6DS @@ -1 +1 @@ -Subproject commit 3d1aab0daf63c3b4476f73cba39cf5da49e1e4aa +Subproject commit c8e82b96c68041a11a52f3053d0d2733ae2d1a49 diff --git a/frozen/Adafruit_CircuitPython_MIDI b/frozen/Adafruit_CircuitPython_MIDI index 3d871907f0..b6891e7341 160000 --- a/frozen/Adafruit_CircuitPython_MIDI +++ b/frozen/Adafruit_CircuitPython_MIDI @@ -1 +1 @@ -Subproject commit 3d871907f0187c627277382f184209f5520703a6 +Subproject commit b6891e734183f978e7b3d0a363140e98635c0a04 diff --git a/frozen/Adafruit_CircuitPython_Motor b/frozen/Adafruit_CircuitPython_Motor index 207953aac0..31c819f377 160000 --- a/frozen/Adafruit_CircuitPython_Motor +++ b/frozen/Adafruit_CircuitPython_Motor @@ -1 +1 @@ -Subproject commit 207953aac033d40728b5f8dd7fd73d90facbca5c +Subproject commit 31c819f377cf71f61cfb84eae159f1f948980db7 diff --git a/frozen/Adafruit_CircuitPython_NeoPixel b/frozen/Adafruit_CircuitPython_NeoPixel index 36d4a31010..1064fdee5a 160000 --- a/frozen/Adafruit_CircuitPython_NeoPixel +++ b/frozen/Adafruit_CircuitPython_NeoPixel @@ -1 +1 @@ -Subproject commit 36d4a31010461e47f265553ebd764c69d38a254c +Subproject commit 1064fdee5a1421f528af452be5e45ae95ef2b89a diff --git a/frozen/Adafruit_CircuitPython_PortalBase b/frozen/Adafruit_CircuitPython_PortalBase index bcfaae874f..7eeea1aaf6 160000 --- a/frozen/Adafruit_CircuitPython_PortalBase +++ b/frozen/Adafruit_CircuitPython_PortalBase @@ -1 +1 @@ -Subproject commit bcfaae874fbae294ce04549d55b96d6b41603944 +Subproject commit 7eeea1aaf6bb5fa0deb080a1dc1aa3cd103f9aad diff --git a/frozen/Adafruit_CircuitPython_ProgressBar b/frozen/Adafruit_CircuitPython_ProgressBar index 011acd627f..cad34af526 160000 --- a/frozen/Adafruit_CircuitPython_ProgressBar +++ b/frozen/Adafruit_CircuitPython_ProgressBar @@ -1 +1 @@ -Subproject commit 011acd627fc24342c397fc640b204a798f7b69dd +Subproject commit cad34af5267aca3665fdaf1ea5a0eee921d13f06 diff --git a/frozen/Adafruit_CircuitPython_RFM69 b/frozen/Adafruit_CircuitPython_RFM69 index c58defd709..a815f364ba 160000 --- a/frozen/Adafruit_CircuitPython_RFM69 +++ b/frozen/Adafruit_CircuitPython_RFM69 @@ -1 +1 @@ -Subproject commit c58defd70947531c5a9c37ddcb569f240567a78b +Subproject commit a815f364badc0dac3fe49e7d8206d00ce95894e1 diff --git a/frozen/Adafruit_CircuitPython_RFM9x b/frozen/Adafruit_CircuitPython_RFM9x index 2d8310f19d..df4c73a5e7 160000 --- a/frozen/Adafruit_CircuitPython_RFM9x +++ b/frozen/Adafruit_CircuitPython_RFM9x @@ -1 +1 @@ -Subproject commit 2d8310f19d1bdce817df13e807b409b5b057fc21 +Subproject commit df4c73a5e719f17fae0309e811ff17627cd0f268 diff --git a/frozen/Adafruit_CircuitPython_Register b/frozen/Adafruit_CircuitPython_Register index 49ab415d6b..f611d5e31c 160000 --- a/frozen/Adafruit_CircuitPython_Register +++ b/frozen/Adafruit_CircuitPython_Register @@ -1 +1 @@ -Subproject commit 49ab415d6b601c99979262f9e91c21dcb3a927a7 +Subproject commit f611d5e31c9735a3c3ac43185e35dcd5f659e3aa diff --git a/frozen/Adafruit_CircuitPython_Requests b/frozen/Adafruit_CircuitPython_Requests index 2e6b3f9fee..a5d56f3e48 160000 --- a/frozen/Adafruit_CircuitPython_Requests +++ b/frozen/Adafruit_CircuitPython_Requests @@ -1 +1 @@ -Subproject commit 2e6b3f9feeacc678402454f7d3416b04a9a93e17 +Subproject commit a5d56f3e4866c8dbb343e03500355a42c46e557a diff --git a/frozen/Adafruit_CircuitPython_SD b/frozen/Adafruit_CircuitPython_SD index da02c76d4c..c59df6b8c3 160000 --- a/frozen/Adafruit_CircuitPython_SD +++ b/frozen/Adafruit_CircuitPython_SD @@ -1 +1 @@ -Subproject commit da02c76d4c802cd5abac73a5f274243b05e8cb35 +Subproject commit c59df6b8c3d8006c290b63e95996e49e8e7124c0 diff --git a/frozen/Adafruit_CircuitPython_ST7789 b/frozen/Adafruit_CircuitPython_ST7789 index 850c3dc512..9ff56ce53f 160000 --- a/frozen/Adafruit_CircuitPython_ST7789 +++ b/frozen/Adafruit_CircuitPython_ST7789 @@ -1 +1 @@ -Subproject commit 850c3dc512f7feae1eaad20bdc1c5e4c63c92f08 +Subproject commit 9ff56ce53f05e23ff678965ba54af89b24b1199a diff --git a/frozen/Adafruit_CircuitPython_SimpleIO b/frozen/Adafruit_CircuitPython_SimpleIO index 272d225365..0a8fcbfc92 160000 --- a/frozen/Adafruit_CircuitPython_SimpleIO +++ b/frozen/Adafruit_CircuitPython_SimpleIO @@ -1 +1 @@ -Subproject commit 272d225365eed46916390cf1f393dd08bc00b7d4 +Subproject commit 0a8fcbfc92060eb298ea52d5e88587b37347a0be diff --git a/frozen/Adafruit_CircuitPython_SimpleMath b/frozen/Adafruit_CircuitPython_SimpleMath index fad0f89e76..dc605bb229 160000 --- a/frozen/Adafruit_CircuitPython_SimpleMath +++ b/frozen/Adafruit_CircuitPython_SimpleMath @@ -1 +1 @@ -Subproject commit fad0f89e760829a76f553ef8459f61001597a846 +Subproject commit dc605bb22914d77d80c5342cbb4c10f773aede95 diff --git a/frozen/Adafruit_CircuitPython_Thermistor b/frozen/Adafruit_CircuitPython_Thermistor index e86f258e43..43a4f15d60 160000 --- a/frozen/Adafruit_CircuitPython_Thermistor +++ b/frozen/Adafruit_CircuitPython_Thermistor @@ -1 +1 @@ -Subproject commit e86f258e43591ce4a04661277e77e9fdf6fec27e +Subproject commit 43a4f15d604919d6e143e975a85abf7b96a4061d diff --git a/frozen/Adafruit_CircuitPython_Ticks b/frozen/Adafruit_CircuitPython_Ticks new file mode 160000 index 0000000000..5436a0f27f --- /dev/null +++ b/frozen/Adafruit_CircuitPython_Ticks @@ -0,0 +1 @@ +Subproject commit 5436a0f27f33b364035ce499c020b274d77a25b7 diff --git a/frozen/Adafruit_CircuitPython_asyncio b/frozen/Adafruit_CircuitPython_asyncio new file mode 160000 index 0000000000..3e8c50eb22 --- /dev/null +++ b/frozen/Adafruit_CircuitPython_asyncio @@ -0,0 +1 @@ +Subproject commit 3e8c50eb2230de7b8a20dedac33334b5dbdee21e diff --git a/frozen/Adafruit_CircuitPython_seesaw b/frozen/Adafruit_CircuitPython_seesaw index 3aaf72165b..6234787515 160000 --- a/frozen/Adafruit_CircuitPython_seesaw +++ b/frozen/Adafruit_CircuitPython_seesaw @@ -1 +1 @@ -Subproject commit 3aaf72165bc6ba10bf5219716c8654651649f87b +Subproject commit 6234787515e2f0ece40b6408722ff0b42824038e diff --git a/frozen/circuitpython-stage b/frozen/circuitpython-stage index 3bdd335452..4124dfbdaa 160000 --- a/frozen/circuitpython-stage +++ b/frozen/circuitpython-stage @@ -1 +1 @@ -Subproject commit 3bdd335452ff14a53d1e840de043e3159cb3b829 +Subproject commit 4124dfbdaadce1966f457d7d6c6984e9832999bf diff --git a/frozen/circuitpython_ef_music b/frozen/circuitpython_ef_music new file mode 160000 index 0000000000..6e8eedb147 --- /dev/null +++ b/frozen/circuitpython_ef_music @@ -0,0 +1 @@ +Subproject commit 6e8eedb1475e2b91f8dea7bceebb20e44d70b171 diff --git a/frozen/circuitpython_picoed b/frozen/circuitpython_picoed new file mode 160000 index 0000000000..53f1560246 --- /dev/null +++ b/frozen/circuitpython_picoed @@ -0,0 +1 @@ +Subproject commit 53f15602460329f69fef95498e6b8293aebb513a diff --git a/frozen/mixgo_cp_lib b/frozen/mixgo_cp_lib new file mode 160000 index 0000000000..d5e3e809d7 --- /dev/null +++ b/frozen/mixgo_cp_lib @@ -0,0 +1 @@ +Subproject commit d5e3e809d7aa938b233b49526c55bfd2e314272c diff --git a/frozen/pew-pewpew-lcd b/frozen/pew-pewpew-lcd index 837f3e5f16..6452f2a78f 160000 --- a/frozen/pew-pewpew-lcd +++ b/frozen/pew-pewpew-lcd @@ -1 +1 @@ -Subproject commit 837f3e5f16accae5b3677954921b5ddd517f0799 +Subproject commit 6452f2a78f32cf3b5d07e699f26d25e9c4d10d09 diff --git a/ports/espressif/certificates/README.md b/lib/certificates/README.md similarity index 100% rename from ports/espressif/certificates/README.md rename to lib/certificates/README.md diff --git a/ports/espressif/certificates/nina-fw b/lib/certificates/nina-fw similarity index 100% rename from ports/espressif/certificates/nina-fw rename to lib/certificates/nina-fw diff --git a/lib/mbedtls b/lib/mbedtls new file mode 160000 index 0000000000..1bc2c9cb8b --- /dev/null +++ b/lib/mbedtls @@ -0,0 +1 @@ +Subproject commit 1bc2c9cb8b8fe4659bd94b8ebba5a4c02029b7fa diff --git a/lib/mbedtls_errors/README.md b/lib/mbedtls_errors/README.md new file mode 100644 index 0000000000..0e13021eb1 --- /dev/null +++ b/lib/mbedtls_errors/README.md @@ -0,0 +1,42 @@ +MBEDTLS Error Strings for MicroPython +===================================== + +This directory contains source code and tools to rework the Mbedtls error strings for +micropython to use less space. In short, instead of storing and printing something like +"SSL - Our own certificate(s) is/are too large to send in an SSL message" it prints +the name of the error #define, which would be "MBEDTLS_ERR_SSL_CERTIFICATE_TOO_LARGE" in +this case, and only stores `SSL_CERTIFICATE_TOO_LARGE` in flash. The exact Mbedtls error +defines are used because they're easy to search for to find more detailed information. + +Mbedtls defines a specific format for error value #defines and +includes a Perl script to gather all `MBEDTLS_ERR` defines from includes files together with +english error text. From that the Perl script generates `mbedtls_strerror()`. The files in this +directory modify this process to produce a more space efficient error lookup table with +shorter error strings. + +The files are as follows: +- `generate_errors.diff` - diff for original mbedtls perl script +- `error.fmt` - modified code template for MicroPython +- `mp_mbedtls_errors.c` - source file with `mbedtls_strerror` this is built using the include + files in `../mbedtls` +- `do-mp.sh` - shell script to produce `mp_mbedtls_errors.c` +- `tester.c` - simple C main to test `mp_mbedtls_errors.c` locally on a dev box +- `do-test.sh` - shell script to produce `mp_mbedtls_errors.c` and compile the `tester` app +- `do-esp32.sh` - shell script to produce `esp32_mbedtls_errors.c` -- see below + +In order not to store multiple copies of `mbedtls_errors.c` +([https://github.com/micropython/micropython/pull/5819#discussion_r445528006](see)) +it is assumed that all ports use the same version of mbedtls with the same error #defines. +This is true as of MP v1.13, and ESP-IDF versions 3.3.2 and 4.0.1. If anything changes in the +future the `do-esp32.sh` script can be used to generate an esp32-specific version. + +### How-to + +- To build MicroPython all that is needed is to include the `mp_mbedtls_errors.c` into the build + (the Makefiles do this automatically). Note that Perl is not needed for routine MicroPython + builds. +- When a new version of Mbedtls is pulled-in the `do-mp.sh` script should be run to + re-generate `mp_mbedtls_errors.c`. +- The `tester` app should be run if changes to the string handling in `error.fmt` are made: + it tests that there is not an off-by-one error in the string copying/appending, etc. +- To include `mbedtls_strerror` error strings define `MBEDTLS_ERROR_C` in the build. diff --git a/lib/mbedtls_errors/do-esp32.sh b/lib/mbedtls_errors/do-esp32.sh new file mode 100755 index 0000000000..6fd4682415 --- /dev/null +++ b/lib/mbedtls_errors/do-esp32.sh @@ -0,0 +1,7 @@ +#! /bin/bash -e +# Generate esp32_mbedtls_errors.c for use in the Esp32 port, with the ESP-IDF version of mbedtls +# The IDF_PATH env var must be set to the top-level dir of ESPIDF +echo "IDF_PATH=$IDF_PATH" +MBEDTLS=$IDF_PATH/components/mbedtls/mbedtls +patch -o esp32_generate_errors.pl $MBEDTLS/scripts/generate_errors.pl +#endif + +#if defined(MBEDTLS_PLATFORM_C) +#include "mbedtls/platform.h" +#else +#define mbedtls_snprintf snprintf +#define mbedtls_time_t time_t +#endif + +#if defined(MBEDTLS_ERROR_C) + +#include + +HEADER_INCLUDED + +// Error code table type +struct ssl_errs { + int16_t errnum; + const char *errstr; +}; + +// Table of high level error codes +static const struct ssl_errs mbedtls_high_level_error_tab[] = { +// BEGIN generated code +HIGH_LEVEL_CODE_CHECKS +// END generated code +}; + +static const struct ssl_errs mbedtls_low_level_error_tab[] = { +// Low level error codes +// +// BEGIN generated code +LOW_LEVEL_CODE_CHECKS +// END generated code +}; + +static const char *mbedtls_err_prefix = "MBEDTLS_ERR_"; +#define MBEDTLS_ERR_PREFIX_LEN ( sizeof("MBEDTLS_ERR_")-1 ) + +// copy error text into buffer, ensure null termination, return strlen of result +static size_t mbedtls_err_to_str(int err, const struct ssl_errs tab[], int tab_len, char *buf, size_t buflen) { + if (buflen == 0) return 0; + + // prefix for all error names + strncpy(buf, mbedtls_err_prefix, buflen); + if (buflen <= MBEDTLS_ERR_PREFIX_LEN+1) { + buf[buflen-1] = 0; + return buflen-1; + } + + // append error name from table + for (int i = 0; i < tab_len; i++) { + if (tab[i].errnum == err) { + strncpy(buf+MBEDTLS_ERR_PREFIX_LEN, tab[i].errstr, buflen-MBEDTLS_ERR_PREFIX_LEN); + buf[buflen-1] = 0; + return strlen(buf); + } + } + + mbedtls_snprintf(buf+MBEDTLS_ERR_PREFIX_LEN, buflen-MBEDTLS_ERR_PREFIX_LEN, "UNKNOWN (0x%04X)", + err); + return strlen(buf); +} + +#define ARRAY_SIZE(a) (sizeof(a) / sizeof((a)[0])) + +void mbedtls_strerror(int ret, char *buf, size_t buflen) { + int use_ret; + + if (buflen == 0) return; + + buf[buflen-1] = 0; + + if (ret < 0) ret = -ret; + + // + // High-level error codes + // + uint8_t got_hl = (ret & 0xFF80) != 0; + if (got_hl) { + use_ret = ret & 0xFF80; + + // special case +#if defined(MBEDTLS_SSL_TLS_C) + if (use_ret == -(MBEDTLS_ERR_SSL_FATAL_ALERT_MESSAGE)) { + strncpy(buf, "MBEDTLS_ERR_SSL_FATAL_ALERT_MESSAGE", buflen); + buf[buflen-1] = 0; + return; + } +#endif + + size_t len = mbedtls_err_to_str(use_ret, mbedtls_high_level_error_tab, + ARRAY_SIZE(mbedtls_high_level_error_tab), buf, buflen); + + buf += len; + buflen -= len; + if (buflen == 0) return; + } + + // + // Low-level error codes + // + use_ret = ret & ~0xFF80; + + if (use_ret == 0) return; + + // If high level code is present, make a concatenation between both error strings. + if (got_hl) { + if (buflen < 2) return; + *buf++ = '+'; + buflen--; + } + + mbedtls_err_to_str(use_ret, mbedtls_low_level_error_tab, + ARRAY_SIZE(mbedtls_low_level_error_tab), buf, buflen); +} + +#else /* MBEDTLS_ERROR_C */ + +#if defined(MBEDTLS_ERROR_STRERROR_DUMMY) + +/* + * Provide an non-function in case MBEDTLS_ERROR_C is not defined + */ +void mbedtls_strerror( int ret, char *buf, size_t buflen ) +{ + ((void) ret); + + if( buflen > 0 ) + buf[0] = '\0'; +} + +#endif /* MBEDTLS_ERROR_STRERROR_DUMMY */ + +#endif /* MBEDTLS_ERROR_C */ diff --git a/lib/mbedtls_errors/generate_errors.diff b/lib/mbedtls_errors/generate_errors.diff new file mode 100644 index 0000000000..ad24c372fa --- /dev/null +++ b/lib/mbedtls_errors/generate_errors.diff @@ -0,0 +1,22 @@ +--- generate_errors_orig.pl 2020-06-20 08:40:38.819060379 -0700 ++++ generate_errors.pl 2020-06-20 08:47:26.511163591 -0700 +@@ -162,16 +162,12 @@ + + if ($error_name eq "MBEDTLS_ERR_SSL_FATAL_ALERT_MESSAGE") + { +- ${$code_check} .= "${white_space}if( use_ret == -($error_name) )\n". +- "${white_space}\{\n". +- "${white_space} mbedtls_snprintf( buf, buflen, \"$module_name - $description\" );\n". +- "${white_space} return;\n". +- "${white_space}}\n" ++ # no-op, this case is hard-coded in error.fmt + } + else + { +- ${$code_check} .= "${white_space}if( use_ret == -($error_name) )\n". +- "${white_space} mbedtls_snprintf( buf, buflen, \"$module_name - $description\" );\n" ++ my $error_text = $error_name =~ s/^MBEDTLS_ERR_//r; ++ ${$code_check} .= "${white_space}{ -($error_name), \"$error_text\" },\n" + } + }; + diff --git a/lib/mbedtls_errors/mp_mbedtls_errors.c b/lib/mbedtls_errors/mp_mbedtls_errors.c new file mode 100644 index 0000000000..03a91f0dc9 --- /dev/null +++ b/lib/mbedtls_errors/mp_mbedtls_errors.c @@ -0,0 +1,705 @@ +/* + * Error message information + * + * Copyright (C) 2006-2015, ARM Limited, All Rights Reserved + * SPDX-License-Identifier: Apache-2.0 + * + * Licensed under the Apache License, Version 2.0 (the "License"); you may + * not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT + * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * + * This file is part of mbed TLS (https://tls.mbed.org) + */ + +#if !defined(MBEDTLS_CONFIG_FILE) +#include "mbedtls/config.h" +#else +#include MBEDTLS_CONFIG_FILE +#endif + +#if defined(MBEDTLS_ERROR_C) || defined(MBEDTLS_ERROR_STRERROR_DUMMY) +#include "mbedtls/error.h" +#include +#endif + +#if defined(MBEDTLS_PLATFORM_C) +#include "mbedtls/platform.h" +#else +#define mbedtls_snprintf snprintf +#define mbedtls_time_t time_t +#endif + +#if defined(MBEDTLS_ERROR_C) + +#include + +#if defined(MBEDTLS_AES_C) +#include "mbedtls/aes.h" +#endif + +#if defined(MBEDTLS_ARC4_C) +#include "mbedtls/arc4.h" +#endif + +#if defined(MBEDTLS_ARIA_C) +#include "mbedtls/aria.h" +#endif + +#if defined(MBEDTLS_BASE64_C) +#include "mbedtls/base64.h" +#endif + +#if defined(MBEDTLS_BIGNUM_C) +#include "mbedtls/bignum.h" +#endif + +#if defined(MBEDTLS_BLOWFISH_C) +#include "mbedtls/blowfish.h" +#endif + +#if defined(MBEDTLS_CAMELLIA_C) +#include "mbedtls/camellia.h" +#endif + +#if defined(MBEDTLS_CCM_C) +#include "mbedtls/ccm.h" +#endif + +#if defined(MBEDTLS_CHACHA20_C) +#include "mbedtls/chacha20.h" +#endif + +#if defined(MBEDTLS_CHACHAPOLY_C) +#include "mbedtls/chachapoly.h" +#endif + +#if defined(MBEDTLS_CIPHER_C) +#include "mbedtls/cipher.h" +#endif + +#if defined(MBEDTLS_CMAC_C) +#include "mbedtls/cmac.h" +#endif + +#if defined(MBEDTLS_CTR_DRBG_C) +#include "mbedtls/ctr_drbg.h" +#endif + +#if defined(MBEDTLS_DES_C) +#include "mbedtls/des.h" +#endif + +#if defined(MBEDTLS_DHM_C) +#include "mbedtls/dhm.h" +#endif + +#if defined(MBEDTLS_ECP_C) +#include "mbedtls/ecp.h" +#endif + +#if defined(MBEDTLS_ENTROPY_C) +#include "mbedtls/entropy.h" +#endif + +#if defined(MBEDTLS_GCM_C) +#include "mbedtls/gcm.h" +#endif + +#if defined(MBEDTLS_HKDF_C) +#include "mbedtls/hkdf.h" +#endif + +#if defined(MBEDTLS_HMAC_DRBG_C) +#include "mbedtls/hmac_drbg.h" +#endif + +#if defined(MBEDTLS_MD_C) +#include "mbedtls/md.h" +#endif + +#if defined(MBEDTLS_MD2_C) +#include "mbedtls/md2.h" +#endif + +#if defined(MBEDTLS_MD4_C) +#include "mbedtls/md4.h" +#endif + +#if defined(MBEDTLS_MD5_C) +#include "mbedtls/md5.h" +#endif + +#if defined(MBEDTLS_NET_C) +#include "mbedtls/net_sockets.h" +#endif + +#if defined(MBEDTLS_OID_C) +#include "mbedtls/oid.h" +#endif + +#if defined(MBEDTLS_PADLOCK_C) +#include "mbedtls/padlock.h" +#endif + +#if defined(MBEDTLS_PEM_PARSE_C) || defined(MBEDTLS_PEM_WRITE_C) +#include "mbedtls/pem.h" +#endif + +#if defined(MBEDTLS_PK_C) +#include "mbedtls/pk.h" +#endif + +#if defined(MBEDTLS_PKCS12_C) +#include "mbedtls/pkcs12.h" +#endif + +#if defined(MBEDTLS_PKCS5_C) +#include "mbedtls/pkcs5.h" +#endif + +#if defined(MBEDTLS_PLATFORM_C) +#include "mbedtls/platform.h" +#endif + +#if defined(MBEDTLS_POLY1305_C) +#include "mbedtls/poly1305.h" +#endif + +#if defined(MBEDTLS_RIPEMD160_C) +#include "mbedtls/ripemd160.h" +#endif + +#if defined(MBEDTLS_RSA_C) +#include "mbedtls/rsa.h" +#endif + +#if defined(MBEDTLS_SHA1_C) +#include "mbedtls/sha1.h" +#endif + +#if defined(MBEDTLS_SHA256_C) +#include "mbedtls/sha256.h" +#endif + +#if defined(MBEDTLS_SHA512_C) +#include "mbedtls/sha512.h" +#endif + +#if defined(MBEDTLS_SSL_TLS_C) +#include "mbedtls/ssl.h" +#endif + +#if defined(MBEDTLS_THREADING_C) +#include "mbedtls/threading.h" +#endif + +#if defined(MBEDTLS_X509_USE_C) || defined(MBEDTLS_X509_CREATE_C) +#include "mbedtls/x509.h" +#endif + +#if defined(MBEDTLS_XTEA_C) +#include "mbedtls/xtea.h" +#endif + + +// Error code table type +struct ssl_errs { + int16_t errnum; + const char *errstr; +}; + +// Table of high level error codes +static const struct ssl_errs mbedtls_high_level_error_tab[] = { +// BEGIN generated code +#if defined(MBEDTLS_CIPHER_C) + { -(MBEDTLS_ERR_CIPHER_FEATURE_UNAVAILABLE), "CIPHER_FEATURE_UNAVAILABLE" }, + { -(MBEDTLS_ERR_CIPHER_BAD_INPUT_DATA), "CIPHER_BAD_INPUT_DATA" }, + { -(MBEDTLS_ERR_CIPHER_ALLOC_FAILED), "CIPHER_ALLOC_FAILED" }, + { -(MBEDTLS_ERR_CIPHER_INVALID_PADDING), "CIPHER_INVALID_PADDING" }, + { -(MBEDTLS_ERR_CIPHER_FULL_BLOCK_EXPECTED), "CIPHER_FULL_BLOCK_EXPECTED" }, + { -(MBEDTLS_ERR_CIPHER_AUTH_FAILED), "CIPHER_AUTH_FAILED" }, + { -(MBEDTLS_ERR_CIPHER_INVALID_CONTEXT), "CIPHER_INVALID_CONTEXT" }, + { -(MBEDTLS_ERR_CIPHER_HW_ACCEL_FAILED), "CIPHER_HW_ACCEL_FAILED" }, +#endif /* MBEDTLS_CIPHER_C */ + +#if defined(MBEDTLS_DHM_C) + { -(MBEDTLS_ERR_DHM_BAD_INPUT_DATA), "DHM_BAD_INPUT_DATA" }, + { -(MBEDTLS_ERR_DHM_READ_PARAMS_FAILED), "DHM_READ_PARAMS_FAILED" }, + { -(MBEDTLS_ERR_DHM_MAKE_PARAMS_FAILED), "DHM_MAKE_PARAMS_FAILED" }, + { -(MBEDTLS_ERR_DHM_READ_PUBLIC_FAILED), "DHM_READ_PUBLIC_FAILED" }, + { -(MBEDTLS_ERR_DHM_MAKE_PUBLIC_FAILED), "DHM_MAKE_PUBLIC_FAILED" }, + { -(MBEDTLS_ERR_DHM_CALC_SECRET_FAILED), "DHM_CALC_SECRET_FAILED" }, + { -(MBEDTLS_ERR_DHM_INVALID_FORMAT), "DHM_INVALID_FORMAT" }, + { -(MBEDTLS_ERR_DHM_ALLOC_FAILED), "DHM_ALLOC_FAILED" }, + { -(MBEDTLS_ERR_DHM_FILE_IO_ERROR), "DHM_FILE_IO_ERROR" }, + { -(MBEDTLS_ERR_DHM_HW_ACCEL_FAILED), "DHM_HW_ACCEL_FAILED" }, + { -(MBEDTLS_ERR_DHM_SET_GROUP_FAILED), "DHM_SET_GROUP_FAILED" }, +#endif /* MBEDTLS_DHM_C */ + +#if defined(MBEDTLS_ECP_C) + { -(MBEDTLS_ERR_ECP_BAD_INPUT_DATA), "ECP_BAD_INPUT_DATA" }, + { -(MBEDTLS_ERR_ECP_BUFFER_TOO_SMALL), "ECP_BUFFER_TOO_SMALL" }, + { -(MBEDTLS_ERR_ECP_FEATURE_UNAVAILABLE), "ECP_FEATURE_UNAVAILABLE" }, + { -(MBEDTLS_ERR_ECP_VERIFY_FAILED), "ECP_VERIFY_FAILED" }, + { -(MBEDTLS_ERR_ECP_ALLOC_FAILED), "ECP_ALLOC_FAILED" }, + { -(MBEDTLS_ERR_ECP_RANDOM_FAILED), "ECP_RANDOM_FAILED" }, + { -(MBEDTLS_ERR_ECP_INVALID_KEY), "ECP_INVALID_KEY" }, + { -(MBEDTLS_ERR_ECP_SIG_LEN_MISMATCH), "ECP_SIG_LEN_MISMATCH" }, + { -(MBEDTLS_ERR_ECP_HW_ACCEL_FAILED), "ECP_HW_ACCEL_FAILED" }, + { -(MBEDTLS_ERR_ECP_IN_PROGRESS), "ECP_IN_PROGRESS" }, +#endif /* MBEDTLS_ECP_C */ + +#if defined(MBEDTLS_MD_C) + { -(MBEDTLS_ERR_MD_FEATURE_UNAVAILABLE), "MD_FEATURE_UNAVAILABLE" }, + { -(MBEDTLS_ERR_MD_BAD_INPUT_DATA), "MD_BAD_INPUT_DATA" }, + { -(MBEDTLS_ERR_MD_ALLOC_FAILED), "MD_ALLOC_FAILED" }, + { -(MBEDTLS_ERR_MD_FILE_IO_ERROR), "MD_FILE_IO_ERROR" }, + { -(MBEDTLS_ERR_MD_HW_ACCEL_FAILED), "MD_HW_ACCEL_FAILED" }, +#endif /* MBEDTLS_MD_C */ + +#if defined(MBEDTLS_PEM_PARSE_C) || defined(MBEDTLS_PEM_WRITE_C) + { -(MBEDTLS_ERR_PEM_NO_HEADER_FOOTER_PRESENT), "PEM_NO_HEADER_FOOTER_PRESENT" }, + { -(MBEDTLS_ERR_PEM_INVALID_DATA), "PEM_INVALID_DATA" }, + { -(MBEDTLS_ERR_PEM_ALLOC_FAILED), "PEM_ALLOC_FAILED" }, + { -(MBEDTLS_ERR_PEM_INVALID_ENC_IV), "PEM_INVALID_ENC_IV" }, + { -(MBEDTLS_ERR_PEM_UNKNOWN_ENC_ALG), "PEM_UNKNOWN_ENC_ALG" }, + { -(MBEDTLS_ERR_PEM_PASSWORD_REQUIRED), "PEM_PASSWORD_REQUIRED" }, + { -(MBEDTLS_ERR_PEM_PASSWORD_MISMATCH), "PEM_PASSWORD_MISMATCH" }, + { -(MBEDTLS_ERR_PEM_FEATURE_UNAVAILABLE), "PEM_FEATURE_UNAVAILABLE" }, + { -(MBEDTLS_ERR_PEM_BAD_INPUT_DATA), "PEM_BAD_INPUT_DATA" }, +#endif /* MBEDTLS_PEM_PARSE_C || MBEDTLS_PEM_WRITE_C */ + +#if defined(MBEDTLS_PK_C) + { -(MBEDTLS_ERR_PK_ALLOC_FAILED), "PK_ALLOC_FAILED" }, + { -(MBEDTLS_ERR_PK_TYPE_MISMATCH), "PK_TYPE_MISMATCH" }, + { -(MBEDTLS_ERR_PK_BAD_INPUT_DATA), "PK_BAD_INPUT_DATA" }, + { -(MBEDTLS_ERR_PK_FILE_IO_ERROR), "PK_FILE_IO_ERROR" }, + { -(MBEDTLS_ERR_PK_KEY_INVALID_VERSION), "PK_KEY_INVALID_VERSION" }, + { -(MBEDTLS_ERR_PK_KEY_INVALID_FORMAT), "PK_KEY_INVALID_FORMAT" }, + { -(MBEDTLS_ERR_PK_UNKNOWN_PK_ALG), "PK_UNKNOWN_PK_ALG" }, + { -(MBEDTLS_ERR_PK_PASSWORD_REQUIRED), "PK_PASSWORD_REQUIRED" }, + { -(MBEDTLS_ERR_PK_PASSWORD_MISMATCH), "PK_PASSWORD_MISMATCH" }, + { -(MBEDTLS_ERR_PK_INVALID_PUBKEY), "PK_INVALID_PUBKEY" }, + { -(MBEDTLS_ERR_PK_INVALID_ALG), "PK_INVALID_ALG" }, + { -(MBEDTLS_ERR_PK_UNKNOWN_NAMED_CURVE), "PK_UNKNOWN_NAMED_CURVE" }, + { -(MBEDTLS_ERR_PK_FEATURE_UNAVAILABLE), "PK_FEATURE_UNAVAILABLE" }, + { -(MBEDTLS_ERR_PK_SIG_LEN_MISMATCH), "PK_SIG_LEN_MISMATCH" }, + { -(MBEDTLS_ERR_PK_HW_ACCEL_FAILED), "PK_HW_ACCEL_FAILED" }, +#endif /* MBEDTLS_PK_C */ + +#if defined(MBEDTLS_PKCS12_C) + { -(MBEDTLS_ERR_PKCS12_BAD_INPUT_DATA), "PKCS12_BAD_INPUT_DATA" }, + { -(MBEDTLS_ERR_PKCS12_FEATURE_UNAVAILABLE), "PKCS12_FEATURE_UNAVAILABLE" }, + { -(MBEDTLS_ERR_PKCS12_PBE_INVALID_FORMAT), "PKCS12_PBE_INVALID_FORMAT" }, + { -(MBEDTLS_ERR_PKCS12_PASSWORD_MISMATCH), "PKCS12_PASSWORD_MISMATCH" }, +#endif /* MBEDTLS_PKCS12_C */ + +#if defined(MBEDTLS_PKCS5_C) + { -(MBEDTLS_ERR_PKCS5_BAD_INPUT_DATA), "PKCS5_BAD_INPUT_DATA" }, + { -(MBEDTLS_ERR_PKCS5_INVALID_FORMAT), "PKCS5_INVALID_FORMAT" }, + { -(MBEDTLS_ERR_PKCS5_FEATURE_UNAVAILABLE), "PKCS5_FEATURE_UNAVAILABLE" }, + { -(MBEDTLS_ERR_PKCS5_PASSWORD_MISMATCH), "PKCS5_PASSWORD_MISMATCH" }, +#endif /* MBEDTLS_PKCS5_C */ + +#if defined(MBEDTLS_RSA_C) + { -(MBEDTLS_ERR_RSA_BAD_INPUT_DATA), "RSA_BAD_INPUT_DATA" }, + { -(MBEDTLS_ERR_RSA_INVALID_PADDING), "RSA_INVALID_PADDING" }, + { -(MBEDTLS_ERR_RSA_KEY_GEN_FAILED), "RSA_KEY_GEN_FAILED" }, + { -(MBEDTLS_ERR_RSA_KEY_CHECK_FAILED), "RSA_KEY_CHECK_FAILED" }, + { -(MBEDTLS_ERR_RSA_PUBLIC_FAILED), "RSA_PUBLIC_FAILED" }, + { -(MBEDTLS_ERR_RSA_PRIVATE_FAILED), "RSA_PRIVATE_FAILED" }, + { -(MBEDTLS_ERR_RSA_VERIFY_FAILED), "RSA_VERIFY_FAILED" }, + { -(MBEDTLS_ERR_RSA_OUTPUT_TOO_LARGE), "RSA_OUTPUT_TOO_LARGE" }, + { -(MBEDTLS_ERR_RSA_RNG_FAILED), "RSA_RNG_FAILED" }, + { -(MBEDTLS_ERR_RSA_UNSUPPORTED_OPERATION), "RSA_UNSUPPORTED_OPERATION" }, + { -(MBEDTLS_ERR_RSA_HW_ACCEL_FAILED), "RSA_HW_ACCEL_FAILED" }, +#endif /* MBEDTLS_RSA_C */ + +#if defined(MBEDTLS_SSL_TLS_C) + { -(MBEDTLS_ERR_SSL_FEATURE_UNAVAILABLE), "SSL_FEATURE_UNAVAILABLE" }, + { -(MBEDTLS_ERR_SSL_BAD_INPUT_DATA), "SSL_BAD_INPUT_DATA" }, + { -(MBEDTLS_ERR_SSL_INVALID_MAC), "SSL_INVALID_MAC" }, + { -(MBEDTLS_ERR_SSL_INVALID_RECORD), "SSL_INVALID_RECORD" }, + { -(MBEDTLS_ERR_SSL_CONN_EOF), "SSL_CONN_EOF" }, + { -(MBEDTLS_ERR_SSL_UNKNOWN_CIPHER), "SSL_UNKNOWN_CIPHER" }, + { -(MBEDTLS_ERR_SSL_NO_CIPHER_CHOSEN), "SSL_NO_CIPHER_CHOSEN" }, + { -(MBEDTLS_ERR_SSL_NO_RNG), "SSL_NO_RNG" }, + { -(MBEDTLS_ERR_SSL_NO_CLIENT_CERTIFICATE), "SSL_NO_CLIENT_CERTIFICATE" }, + { -(MBEDTLS_ERR_SSL_CERTIFICATE_TOO_LARGE), "SSL_CERTIFICATE_TOO_LARGE" }, + { -(MBEDTLS_ERR_SSL_CERTIFICATE_REQUIRED), "SSL_CERTIFICATE_REQUIRED" }, + { -(MBEDTLS_ERR_SSL_PRIVATE_KEY_REQUIRED), "SSL_PRIVATE_KEY_REQUIRED" }, + { -(MBEDTLS_ERR_SSL_CA_CHAIN_REQUIRED), "SSL_CA_CHAIN_REQUIRED" }, + { -(MBEDTLS_ERR_SSL_UNEXPECTED_MESSAGE), "SSL_UNEXPECTED_MESSAGE" }, + { -(MBEDTLS_ERR_SSL_PEER_VERIFY_FAILED), "SSL_PEER_VERIFY_FAILED" }, + { -(MBEDTLS_ERR_SSL_PEER_CLOSE_NOTIFY), "SSL_PEER_CLOSE_NOTIFY" }, + { -(MBEDTLS_ERR_SSL_BAD_HS_CLIENT_HELLO), "SSL_BAD_HS_CLIENT_HELLO" }, + { -(MBEDTLS_ERR_SSL_BAD_HS_SERVER_HELLO), "SSL_BAD_HS_SERVER_HELLO" }, + { -(MBEDTLS_ERR_SSL_BAD_HS_CERTIFICATE), "SSL_BAD_HS_CERTIFICATE" }, + { -(MBEDTLS_ERR_SSL_BAD_HS_CERTIFICATE_REQUEST), "SSL_BAD_HS_CERTIFICATE_REQUEST" }, + { -(MBEDTLS_ERR_SSL_BAD_HS_SERVER_KEY_EXCHANGE), "SSL_BAD_HS_SERVER_KEY_EXCHANGE" }, + { -(MBEDTLS_ERR_SSL_BAD_HS_SERVER_HELLO_DONE), "SSL_BAD_HS_SERVER_HELLO_DONE" }, + { -(MBEDTLS_ERR_SSL_BAD_HS_CLIENT_KEY_EXCHANGE), "SSL_BAD_HS_CLIENT_KEY_EXCHANGE" }, + { -(MBEDTLS_ERR_SSL_BAD_HS_CLIENT_KEY_EXCHANGE_RP), "SSL_BAD_HS_CLIENT_KEY_EXCHANGE_RP" }, + { -(MBEDTLS_ERR_SSL_BAD_HS_CLIENT_KEY_EXCHANGE_CS), "SSL_BAD_HS_CLIENT_KEY_EXCHANGE_CS" }, + { -(MBEDTLS_ERR_SSL_BAD_HS_CERTIFICATE_VERIFY), "SSL_BAD_HS_CERTIFICATE_VERIFY" }, + { -(MBEDTLS_ERR_SSL_BAD_HS_CHANGE_CIPHER_SPEC), "SSL_BAD_HS_CHANGE_CIPHER_SPEC" }, + { -(MBEDTLS_ERR_SSL_BAD_HS_FINISHED), "SSL_BAD_HS_FINISHED" }, + { -(MBEDTLS_ERR_SSL_ALLOC_FAILED), "SSL_ALLOC_FAILED" }, + { -(MBEDTLS_ERR_SSL_HW_ACCEL_FAILED), "SSL_HW_ACCEL_FAILED" }, + { -(MBEDTLS_ERR_SSL_HW_ACCEL_FALLTHROUGH), "SSL_HW_ACCEL_FALLTHROUGH" }, + { -(MBEDTLS_ERR_SSL_COMPRESSION_FAILED), "SSL_COMPRESSION_FAILED" }, + { -(MBEDTLS_ERR_SSL_BAD_HS_PROTOCOL_VERSION), "SSL_BAD_HS_PROTOCOL_VERSION" }, + { -(MBEDTLS_ERR_SSL_BAD_HS_NEW_SESSION_TICKET), "SSL_BAD_HS_NEW_SESSION_TICKET" }, + { -(MBEDTLS_ERR_SSL_SESSION_TICKET_EXPIRED), "SSL_SESSION_TICKET_EXPIRED" }, + { -(MBEDTLS_ERR_SSL_PK_TYPE_MISMATCH), "SSL_PK_TYPE_MISMATCH" }, + { -(MBEDTLS_ERR_SSL_UNKNOWN_IDENTITY), "SSL_UNKNOWN_IDENTITY" }, + { -(MBEDTLS_ERR_SSL_INTERNAL_ERROR), "SSL_INTERNAL_ERROR" }, + { -(MBEDTLS_ERR_SSL_COUNTER_WRAPPING), "SSL_COUNTER_WRAPPING" }, + { -(MBEDTLS_ERR_SSL_WAITING_SERVER_HELLO_RENEGO), "SSL_WAITING_SERVER_HELLO_RENEGO" }, + { -(MBEDTLS_ERR_SSL_HELLO_VERIFY_REQUIRED), "SSL_HELLO_VERIFY_REQUIRED" }, + { -(MBEDTLS_ERR_SSL_BUFFER_TOO_SMALL), "SSL_BUFFER_TOO_SMALL" }, + { -(MBEDTLS_ERR_SSL_NO_USABLE_CIPHERSUITE), "SSL_NO_USABLE_CIPHERSUITE" }, + { -(MBEDTLS_ERR_SSL_WANT_READ), "SSL_WANT_READ" }, + { -(MBEDTLS_ERR_SSL_WANT_WRITE), "SSL_WANT_WRITE" }, + { -(MBEDTLS_ERR_SSL_TIMEOUT), "SSL_TIMEOUT" }, + { -(MBEDTLS_ERR_SSL_CLIENT_RECONNECT), "SSL_CLIENT_RECONNECT" }, + { -(MBEDTLS_ERR_SSL_UNEXPECTED_RECORD), "SSL_UNEXPECTED_RECORD" }, + { -(MBEDTLS_ERR_SSL_NON_FATAL), "SSL_NON_FATAL" }, + { -(MBEDTLS_ERR_SSL_INVALID_VERIFY_HASH), "SSL_INVALID_VERIFY_HASH" }, + { -(MBEDTLS_ERR_SSL_CONTINUE_PROCESSING), "SSL_CONTINUE_PROCESSING" }, + { -(MBEDTLS_ERR_SSL_ASYNC_IN_PROGRESS), "SSL_ASYNC_IN_PROGRESS" }, + { -(MBEDTLS_ERR_SSL_EARLY_MESSAGE), "SSL_EARLY_MESSAGE" }, + { -(MBEDTLS_ERR_SSL_CRYPTO_IN_PROGRESS), "SSL_CRYPTO_IN_PROGRESS" }, +#endif /* MBEDTLS_SSL_TLS_C */ + +#if defined(MBEDTLS_X509_USE_C) || defined(MBEDTLS_X509_CREATE_C) + { -(MBEDTLS_ERR_X509_FEATURE_UNAVAILABLE), "X509_FEATURE_UNAVAILABLE" }, + { -(MBEDTLS_ERR_X509_UNKNOWN_OID), "X509_UNKNOWN_OID" }, + { -(MBEDTLS_ERR_X509_INVALID_FORMAT), "X509_INVALID_FORMAT" }, + { -(MBEDTLS_ERR_X509_INVALID_VERSION), "X509_INVALID_VERSION" }, + { -(MBEDTLS_ERR_X509_INVALID_SERIAL), "X509_INVALID_SERIAL" }, + { -(MBEDTLS_ERR_X509_INVALID_ALG), "X509_INVALID_ALG" }, + { -(MBEDTLS_ERR_X509_INVALID_NAME), "X509_INVALID_NAME" }, + { -(MBEDTLS_ERR_X509_INVALID_DATE), "X509_INVALID_DATE" }, + { -(MBEDTLS_ERR_X509_INVALID_SIGNATURE), "X509_INVALID_SIGNATURE" }, + { -(MBEDTLS_ERR_X509_INVALID_EXTENSIONS), "X509_INVALID_EXTENSIONS" }, + { -(MBEDTLS_ERR_X509_UNKNOWN_VERSION), "X509_UNKNOWN_VERSION" }, + { -(MBEDTLS_ERR_X509_UNKNOWN_SIG_ALG), "X509_UNKNOWN_SIG_ALG" }, + { -(MBEDTLS_ERR_X509_SIG_MISMATCH), "X509_SIG_MISMATCH" }, + { -(MBEDTLS_ERR_X509_CERT_VERIFY_FAILED), "X509_CERT_VERIFY_FAILED" }, + { -(MBEDTLS_ERR_X509_CERT_UNKNOWN_FORMAT), "X509_CERT_UNKNOWN_FORMAT" }, + { -(MBEDTLS_ERR_X509_BAD_INPUT_DATA), "X509_BAD_INPUT_DATA" }, + { -(MBEDTLS_ERR_X509_ALLOC_FAILED), "X509_ALLOC_FAILED" }, + { -(MBEDTLS_ERR_X509_FILE_IO_ERROR), "X509_FILE_IO_ERROR" }, + { -(MBEDTLS_ERR_X509_BUFFER_TOO_SMALL), "X509_BUFFER_TOO_SMALL" }, + { -(MBEDTLS_ERR_X509_FATAL_ERROR), "X509_FATAL_ERROR" }, +#endif /* MBEDTLS_X509_USE_C || MBEDTLS_X509_CREATE_C */ +// END generated code +}; + +static const struct ssl_errs mbedtls_low_level_error_tab[] = { +// Low level error codes +// +// BEGIN generated code +#if defined(MBEDTLS_AES_C) + { -(MBEDTLS_ERR_AES_INVALID_KEY_LENGTH), "AES_INVALID_KEY_LENGTH" }, + { -(MBEDTLS_ERR_AES_INVALID_INPUT_LENGTH), "AES_INVALID_INPUT_LENGTH" }, + { -(MBEDTLS_ERR_AES_BAD_INPUT_DATA), "AES_BAD_INPUT_DATA" }, + { -(MBEDTLS_ERR_AES_FEATURE_UNAVAILABLE), "AES_FEATURE_UNAVAILABLE" }, + { -(MBEDTLS_ERR_AES_HW_ACCEL_FAILED), "AES_HW_ACCEL_FAILED" }, +#endif /* MBEDTLS_AES_C */ + +#if defined(MBEDTLS_ARC4_C) + { -(MBEDTLS_ERR_ARC4_HW_ACCEL_FAILED), "ARC4_HW_ACCEL_FAILED" }, +#endif /* MBEDTLS_ARC4_C */ + +#if defined(MBEDTLS_ARIA_C) + { -(MBEDTLS_ERR_ARIA_BAD_INPUT_DATA), "ARIA_BAD_INPUT_DATA" }, + { -(MBEDTLS_ERR_ARIA_INVALID_INPUT_LENGTH), "ARIA_INVALID_INPUT_LENGTH" }, + { -(MBEDTLS_ERR_ARIA_FEATURE_UNAVAILABLE), "ARIA_FEATURE_UNAVAILABLE" }, + { -(MBEDTLS_ERR_ARIA_HW_ACCEL_FAILED), "ARIA_HW_ACCEL_FAILED" }, +#endif /* MBEDTLS_ARIA_C */ + +#if defined(MBEDTLS_ASN1_PARSE_C) + { -(MBEDTLS_ERR_ASN1_OUT_OF_DATA), "ASN1_OUT_OF_DATA" }, + { -(MBEDTLS_ERR_ASN1_UNEXPECTED_TAG), "ASN1_UNEXPECTED_TAG" }, + { -(MBEDTLS_ERR_ASN1_INVALID_LENGTH), "ASN1_INVALID_LENGTH" }, + { -(MBEDTLS_ERR_ASN1_LENGTH_MISMATCH), "ASN1_LENGTH_MISMATCH" }, + { -(MBEDTLS_ERR_ASN1_INVALID_DATA), "ASN1_INVALID_DATA" }, + { -(MBEDTLS_ERR_ASN1_ALLOC_FAILED), "ASN1_ALLOC_FAILED" }, + { -(MBEDTLS_ERR_ASN1_BUF_TOO_SMALL), "ASN1_BUF_TOO_SMALL" }, +#endif /* MBEDTLS_ASN1_PARSE_C */ + +#if defined(MBEDTLS_BASE64_C) + { -(MBEDTLS_ERR_BASE64_BUFFER_TOO_SMALL), "BASE64_BUFFER_TOO_SMALL" }, + { -(MBEDTLS_ERR_BASE64_INVALID_CHARACTER), "BASE64_INVALID_CHARACTER" }, +#endif /* MBEDTLS_BASE64_C */ + +#if defined(MBEDTLS_BIGNUM_C) + { -(MBEDTLS_ERR_MPI_FILE_IO_ERROR), "MPI_FILE_IO_ERROR" }, + { -(MBEDTLS_ERR_MPI_BAD_INPUT_DATA), "MPI_BAD_INPUT_DATA" }, + { -(MBEDTLS_ERR_MPI_INVALID_CHARACTER), "MPI_INVALID_CHARACTER" }, + { -(MBEDTLS_ERR_MPI_BUFFER_TOO_SMALL), "MPI_BUFFER_TOO_SMALL" }, + { -(MBEDTLS_ERR_MPI_NEGATIVE_VALUE), "MPI_NEGATIVE_VALUE" }, + { -(MBEDTLS_ERR_MPI_DIVISION_BY_ZERO), "MPI_DIVISION_BY_ZERO" }, + { -(MBEDTLS_ERR_MPI_NOT_ACCEPTABLE), "MPI_NOT_ACCEPTABLE" }, + { -(MBEDTLS_ERR_MPI_ALLOC_FAILED), "MPI_ALLOC_FAILED" }, +#endif /* MBEDTLS_BIGNUM_C */ + +#if defined(MBEDTLS_BLOWFISH_C) + { -(MBEDTLS_ERR_BLOWFISH_BAD_INPUT_DATA), "BLOWFISH_BAD_INPUT_DATA" }, + { -(MBEDTLS_ERR_BLOWFISH_INVALID_INPUT_LENGTH), "BLOWFISH_INVALID_INPUT_LENGTH" }, + { -(MBEDTLS_ERR_BLOWFISH_HW_ACCEL_FAILED), "BLOWFISH_HW_ACCEL_FAILED" }, +#endif /* MBEDTLS_BLOWFISH_C */ + +#if defined(MBEDTLS_CAMELLIA_C) + { -(MBEDTLS_ERR_CAMELLIA_BAD_INPUT_DATA), "CAMELLIA_BAD_INPUT_DATA" }, + { -(MBEDTLS_ERR_CAMELLIA_INVALID_INPUT_LENGTH), "CAMELLIA_INVALID_INPUT_LENGTH" }, + { -(MBEDTLS_ERR_CAMELLIA_HW_ACCEL_FAILED), "CAMELLIA_HW_ACCEL_FAILED" }, +#endif /* MBEDTLS_CAMELLIA_C */ + +#if defined(MBEDTLS_CCM_C) + { -(MBEDTLS_ERR_CCM_BAD_INPUT), "CCM_BAD_INPUT" }, + { -(MBEDTLS_ERR_CCM_AUTH_FAILED), "CCM_AUTH_FAILED" }, + { -(MBEDTLS_ERR_CCM_HW_ACCEL_FAILED), "CCM_HW_ACCEL_FAILED" }, +#endif /* MBEDTLS_CCM_C */ + +#if defined(MBEDTLS_CHACHA20_C) + { -(MBEDTLS_ERR_CHACHA20_BAD_INPUT_DATA), "CHACHA20_BAD_INPUT_DATA" }, + { -(MBEDTLS_ERR_CHACHA20_FEATURE_UNAVAILABLE), "CHACHA20_FEATURE_UNAVAILABLE" }, + { -(MBEDTLS_ERR_CHACHA20_HW_ACCEL_FAILED), "CHACHA20_HW_ACCEL_FAILED" }, +#endif /* MBEDTLS_CHACHA20_C */ + +#if defined(MBEDTLS_CHACHAPOLY_C) + { -(MBEDTLS_ERR_CHACHAPOLY_BAD_STATE), "CHACHAPOLY_BAD_STATE" }, + { -(MBEDTLS_ERR_CHACHAPOLY_AUTH_FAILED), "CHACHAPOLY_AUTH_FAILED" }, +#endif /* MBEDTLS_CHACHAPOLY_C */ + +#if defined(MBEDTLS_CMAC_C) + { -(MBEDTLS_ERR_CMAC_HW_ACCEL_FAILED), "CMAC_HW_ACCEL_FAILED" }, +#endif /* MBEDTLS_CMAC_C */ + +#if defined(MBEDTLS_CTR_DRBG_C) + { -(MBEDTLS_ERR_CTR_DRBG_ENTROPY_SOURCE_FAILED), "CTR_DRBG_ENTROPY_SOURCE_FAILED" }, + { -(MBEDTLS_ERR_CTR_DRBG_REQUEST_TOO_BIG), "CTR_DRBG_REQUEST_TOO_BIG" }, + { -(MBEDTLS_ERR_CTR_DRBG_INPUT_TOO_BIG), "CTR_DRBG_INPUT_TOO_BIG" }, + { -(MBEDTLS_ERR_CTR_DRBG_FILE_IO_ERROR), "CTR_DRBG_FILE_IO_ERROR" }, +#endif /* MBEDTLS_CTR_DRBG_C */ + +#if defined(MBEDTLS_DES_C) + { -(MBEDTLS_ERR_DES_INVALID_INPUT_LENGTH), "DES_INVALID_INPUT_LENGTH" }, + { -(MBEDTLS_ERR_DES_HW_ACCEL_FAILED), "DES_HW_ACCEL_FAILED" }, +#endif /* MBEDTLS_DES_C */ + +#if defined(MBEDTLS_ENTROPY_C) + { -(MBEDTLS_ERR_ENTROPY_SOURCE_FAILED), "ENTROPY_SOURCE_FAILED" }, + { -(MBEDTLS_ERR_ENTROPY_MAX_SOURCES), "ENTROPY_MAX_SOURCES" }, + { -(MBEDTLS_ERR_ENTROPY_NO_SOURCES_DEFINED), "ENTROPY_NO_SOURCES_DEFINED" }, + { -(MBEDTLS_ERR_ENTROPY_NO_STRONG_SOURCE), "ENTROPY_NO_STRONG_SOURCE" }, + { -(MBEDTLS_ERR_ENTROPY_FILE_IO_ERROR), "ENTROPY_FILE_IO_ERROR" }, +#endif /* MBEDTLS_ENTROPY_C */ + +#if defined(MBEDTLS_GCM_C) + { -(MBEDTLS_ERR_GCM_AUTH_FAILED), "GCM_AUTH_FAILED" }, + { -(MBEDTLS_ERR_GCM_HW_ACCEL_FAILED), "GCM_HW_ACCEL_FAILED" }, + { -(MBEDTLS_ERR_GCM_BAD_INPUT), "GCM_BAD_INPUT" }, +#endif /* MBEDTLS_GCM_C */ + +#if defined(MBEDTLS_HKDF_C) + { -(MBEDTLS_ERR_HKDF_BAD_INPUT_DATA), "HKDF_BAD_INPUT_DATA" }, +#endif /* MBEDTLS_HKDF_C */ + +#if defined(MBEDTLS_HMAC_DRBG_C) + { -(MBEDTLS_ERR_HMAC_DRBG_REQUEST_TOO_BIG), "HMAC_DRBG_REQUEST_TOO_BIG" }, + { -(MBEDTLS_ERR_HMAC_DRBG_INPUT_TOO_BIG), "HMAC_DRBG_INPUT_TOO_BIG" }, + { -(MBEDTLS_ERR_HMAC_DRBG_FILE_IO_ERROR), "HMAC_DRBG_FILE_IO_ERROR" }, + { -(MBEDTLS_ERR_HMAC_DRBG_ENTROPY_SOURCE_FAILED), "HMAC_DRBG_ENTROPY_SOURCE_FAILED" }, +#endif /* MBEDTLS_HMAC_DRBG_C */ + +#if defined(MBEDTLS_MD2_C) + { -(MBEDTLS_ERR_MD2_HW_ACCEL_FAILED), "MD2_HW_ACCEL_FAILED" }, +#endif /* MBEDTLS_MD2_C */ + +#if defined(MBEDTLS_MD4_C) + { -(MBEDTLS_ERR_MD4_HW_ACCEL_FAILED), "MD4_HW_ACCEL_FAILED" }, +#endif /* MBEDTLS_MD4_C */ + +#if defined(MBEDTLS_MD5_C) + { -(MBEDTLS_ERR_MD5_HW_ACCEL_FAILED), "MD5_HW_ACCEL_FAILED" }, +#endif /* MBEDTLS_MD5_C */ + +#if defined(MBEDTLS_NET_C) + { -(MBEDTLS_ERR_NET_SOCKET_FAILED), "NET_SOCKET_FAILED" }, + { -(MBEDTLS_ERR_NET_CONNECT_FAILED), "NET_CONNECT_FAILED" }, + { -(MBEDTLS_ERR_NET_BIND_FAILED), "NET_BIND_FAILED" }, + { -(MBEDTLS_ERR_NET_LISTEN_FAILED), "NET_LISTEN_FAILED" }, + { -(MBEDTLS_ERR_NET_ACCEPT_FAILED), "NET_ACCEPT_FAILED" }, + { -(MBEDTLS_ERR_NET_RECV_FAILED), "NET_RECV_FAILED" }, + { -(MBEDTLS_ERR_NET_SEND_FAILED), "NET_SEND_FAILED" }, + { -(MBEDTLS_ERR_NET_CONN_RESET), "NET_CONN_RESET" }, + { -(MBEDTLS_ERR_NET_UNKNOWN_HOST), "NET_UNKNOWN_HOST" }, + { -(MBEDTLS_ERR_NET_BUFFER_TOO_SMALL), "NET_BUFFER_TOO_SMALL" }, + { -(MBEDTLS_ERR_NET_INVALID_CONTEXT), "NET_INVALID_CONTEXT" }, + { -(MBEDTLS_ERR_NET_POLL_FAILED), "NET_POLL_FAILED" }, + { -(MBEDTLS_ERR_NET_BAD_INPUT_DATA), "NET_BAD_INPUT_DATA" }, +#endif /* MBEDTLS_NET_C */ + +#if defined(MBEDTLS_OID_C) + { -(MBEDTLS_ERR_OID_NOT_FOUND), "OID_NOT_FOUND" }, + { -(MBEDTLS_ERR_OID_BUF_TOO_SMALL), "OID_BUF_TOO_SMALL" }, +#endif /* MBEDTLS_OID_C */ + +#if defined(MBEDTLS_PADLOCK_C) + { -(MBEDTLS_ERR_PADLOCK_DATA_MISALIGNED), "PADLOCK_DATA_MISALIGNED" }, +#endif /* MBEDTLS_PADLOCK_C */ + +#if defined(MBEDTLS_PLATFORM_C) + { -(MBEDTLS_ERR_PLATFORM_HW_ACCEL_FAILED), "PLATFORM_HW_ACCEL_FAILED" }, + { -(MBEDTLS_ERR_PLATFORM_FEATURE_UNSUPPORTED), "PLATFORM_FEATURE_UNSUPPORTED" }, +#endif /* MBEDTLS_PLATFORM_C */ + +#if defined(MBEDTLS_POLY1305_C) + { -(MBEDTLS_ERR_POLY1305_BAD_INPUT_DATA), "POLY1305_BAD_INPUT_DATA" }, + { -(MBEDTLS_ERR_POLY1305_FEATURE_UNAVAILABLE), "POLY1305_FEATURE_UNAVAILABLE" }, + { -(MBEDTLS_ERR_POLY1305_HW_ACCEL_FAILED), "POLY1305_HW_ACCEL_FAILED" }, +#endif /* MBEDTLS_POLY1305_C */ + +#if defined(MBEDTLS_RIPEMD160_C) + { -(MBEDTLS_ERR_RIPEMD160_HW_ACCEL_FAILED), "RIPEMD160_HW_ACCEL_FAILED" }, +#endif /* MBEDTLS_RIPEMD160_C */ + +#if defined(MBEDTLS_SHA1_C) + { -(MBEDTLS_ERR_SHA1_HW_ACCEL_FAILED), "SHA1_HW_ACCEL_FAILED" }, + { -(MBEDTLS_ERR_SHA1_BAD_INPUT_DATA), "SHA1_BAD_INPUT_DATA" }, +#endif /* MBEDTLS_SHA1_C */ + +#if defined(MBEDTLS_SHA256_C) + { -(MBEDTLS_ERR_SHA256_HW_ACCEL_FAILED), "SHA256_HW_ACCEL_FAILED" }, + { -(MBEDTLS_ERR_SHA256_BAD_INPUT_DATA), "SHA256_BAD_INPUT_DATA" }, +#endif /* MBEDTLS_SHA256_C */ + +#if defined(MBEDTLS_SHA512_C) + { -(MBEDTLS_ERR_SHA512_HW_ACCEL_FAILED), "SHA512_HW_ACCEL_FAILED" }, + { -(MBEDTLS_ERR_SHA512_BAD_INPUT_DATA), "SHA512_BAD_INPUT_DATA" }, +#endif /* MBEDTLS_SHA512_C */ + +#if defined(MBEDTLS_THREADING_C) + { -(MBEDTLS_ERR_THREADING_FEATURE_UNAVAILABLE), "THREADING_FEATURE_UNAVAILABLE" }, + { -(MBEDTLS_ERR_THREADING_BAD_INPUT_DATA), "THREADING_BAD_INPUT_DATA" }, + { -(MBEDTLS_ERR_THREADING_MUTEX_ERROR), "THREADING_MUTEX_ERROR" }, +#endif /* MBEDTLS_THREADING_C */ + +#if defined(MBEDTLS_XTEA_C) + { -(MBEDTLS_ERR_XTEA_INVALID_INPUT_LENGTH), "XTEA_INVALID_INPUT_LENGTH" }, + { -(MBEDTLS_ERR_XTEA_HW_ACCEL_FAILED), "XTEA_HW_ACCEL_FAILED" }, +#endif /* MBEDTLS_XTEA_C */ +// END generated code +}; + +static const char *mbedtls_err_prefix = "MBEDTLS_ERR_"; +#define MBEDTLS_ERR_PREFIX_LEN ( sizeof("MBEDTLS_ERR_")-1 ) + +// copy error text into buffer, ensure null termination, return strlen of result +static size_t mbedtls_err_to_str(int err, const struct ssl_errs tab[], int tab_len, char *buf, size_t buflen) { + if (buflen == 0) return 0; + + // prefix for all error names + strncpy(buf, mbedtls_err_prefix, buflen); + if (buflen <= MBEDTLS_ERR_PREFIX_LEN+1) { + buf[buflen-1] = 0; + return buflen-1; + } + + // append error name from table + for (int i = 0; i < tab_len; i++) { + if (tab[i].errnum == err) { + strncpy(buf+MBEDTLS_ERR_PREFIX_LEN, tab[i].errstr, buflen-MBEDTLS_ERR_PREFIX_LEN); + buf[buflen-1] = 0; + return strlen(buf); + } + } + + mbedtls_snprintf(buf+MBEDTLS_ERR_PREFIX_LEN, buflen-MBEDTLS_ERR_PREFIX_LEN, "UNKNOWN (0x%04X)", + err); + return strlen(buf); +} + +#define ARRAY_SIZE(a) (sizeof(a) / sizeof((a)[0])) + +void mbedtls_strerror(int ret, char *buf, size_t buflen) { + int use_ret; + + if (buflen == 0) return; + + buf[buflen-1] = 0; + + if (ret < 0) ret = -ret; + + // + // High-level error codes + // + uint8_t got_hl = (ret & 0xFF80) != 0; + if (got_hl) { + use_ret = ret & 0xFF80; + + // special case +#if defined(MBEDTLS_SSL_TLS_C) + if (use_ret == -(MBEDTLS_ERR_SSL_FATAL_ALERT_MESSAGE)) { + strncpy(buf, "MBEDTLS_ERR_SSL_FATAL_ALERT_MESSAGE", buflen); + buf[buflen-1] = 0; + return; + } +#endif + + size_t len = mbedtls_err_to_str(use_ret, mbedtls_high_level_error_tab, + ARRAY_SIZE(mbedtls_high_level_error_tab), buf, buflen); + + buf += len; + buflen -= len; + if (buflen == 0) return; + } + + // + // Low-level error codes + // + use_ret = ret & ~0xFF80; + + if (use_ret == 0) return; + + // If high level code is present, make a concatenation between both error strings. + if (got_hl) { + if (buflen < 2) return; + *buf++ = '+'; + buflen--; + } + + mbedtls_err_to_str(use_ret, mbedtls_low_level_error_tab, + ARRAY_SIZE(mbedtls_low_level_error_tab), buf, buflen); +} + +#else /* MBEDTLS_ERROR_C */ + +#if defined(MBEDTLS_ERROR_STRERROR_DUMMY) + +/* + * Provide an non-function in case MBEDTLS_ERROR_C is not defined + */ +void mbedtls_strerror( int ret, char *buf, size_t buflen ) +{ + ((void) ret); + + if( buflen > 0 ) + buf[0] = '\0'; +} + +#endif /* MBEDTLS_ERROR_STRERROR_DUMMY */ + +#endif /* MBEDTLS_ERROR_C */ diff --git a/lib/mbedtls_errors/tester.c b/lib/mbedtls_errors/tester.c new file mode 100644 index 0000000000..6f1c788f50 --- /dev/null +++ b/lib/mbedtls_errors/tester.c @@ -0,0 +1,58 @@ +#include "mbedtls/error.h" +#include +#include + +// test_code checks that the provided code results in the provided error string for any size +// buffer. It calls mbedtls_strerror() to fill a buffer that is from 1 to 100 bytes in length +// and then checks that the buffer contents is OK and that a few guard bytes before and after +// the buffer were not overwritten. +int test_code(int code, char *str) { + char buf[100]; + int ok = 1; + int res; + + // test zero-length buffer + memset(buf, -3, 100); + mbedtls_strerror(code, buf + 4, 0); + for (int i = 0; i < 10; i++) { + if (buf[i] != -3) { + printf("Error: guard overwritten buflen=0 i=%d buf[i]=%d\n", i, buf[i]); + ok = 0; + } + } + + // test + for (size_t buflen = 1; buflen < 90; buflen++) { + memset(buf, -3, 100); + mbedtls_strerror(code, buf + 4, buflen); + for (int i = 0; i < 4; i++) { + if (buf[i] != -3) { + printf("Error: pre-guard overwritten buflen=%d i=%d buf[i]=%d\n", buflen, i, buf[i]); + ok = 0; + } + } + for (int i = 4 + buflen; i < 100; i++) { + if (buf[i] != -3) { + printf("Error: post-guard overwritten buflen=%d i=%d buf[i]=%d\n", buflen, i, buf[i]); + ok = 0; + } + } + char exp[100]; + strncpy(exp, str, buflen); + exp[buflen - 1] = 0; + if (strcmp(buf + 4, exp) != 0) { + printf("Error: expected %s, got %s\n", exp, buf); + ok = 0; + } + } + + printf("Test %x -> %s is %s\n", code, str, ok?"OK":"*** BAD ***"); +} + +int main() { + test_code(0x7200, "MBEDTLS_ERR_SSL_INVALID_RECORD"); + test_code(0x7780, "MBEDTLS_ERR_SSL_FATAL_ALERT_MESSAGE"); + test_code(0x0074, "MBEDTLS_ERR_SHA256_BAD_INPUT_DATA"); + test_code(0x6600 | 0x0074, "MBEDTLS_ERR_SSL_INVALID_VERIFY_HASH+MBEDTLS_ERR_SHA256_BAD_INPUT_DATA"); + test_code(103, "MBEDTLS_ERR_UNKNOWN (0x0067)"); +} diff --git a/locale/ID.po b/locale/ID.po index c16258bf52..2dae1a04b4 100644 --- a/locale/ID.po +++ b/locale/ID.po @@ -65,6 +65,11 @@ msgstr "output:\n" msgid "%%c requires int or char" msgstr "%%c harus int atau char" +#: main.c +#, c-format +msgid "%02X" +msgstr "" + #: shared-bindings/rgbmatrix/RGBMatrix.c #, c-format msgid "" @@ -72,10 +77,27 @@ msgid "" msgstr "" "%d pin alamat, %d rgb pin dan %d ubin menunjukkan ketinggian %d, bukan %d" +#: ports/atmel-samd/common-hal/alarm/__init__.c +#: ports/cxd56/common-hal/analogio/AnalogOut.c ports/cxd56/common-hal/rtc/RTC.c +#: ports/espressif/common-hal/rtc/RTC.c +#: ports/mimxrt10xx/common-hal/analogio/AnalogOut.c +#: ports/mimxrt10xx/common-hal/rtc/RTC.c ports/nrf/common-hal/alarm/__init__.c +#: ports/nrf/common-hal/analogio/AnalogOut.c ports/nrf/common-hal/rtc/RTC.c +#: ports/raspberrypi/common-hal/alarm/__init__.c +#: ports/raspberrypi/common-hal/analogio/AnalogOut.c +#: ports/raspberrypi/common-hal/rtc/RTC.c ports/stm/common-hal/alarm/__init__.c +#: ports/stm/common-hal/rtc/RTC.c +msgid "%q" +msgstr "" + #: shared-bindings/microcontroller/Pin.c msgid "%q and %q contain duplicate pins" msgstr "%q dan %q berisi pin duplikat" +#: ports/atmel-samd/common-hal/audioio/AudioOut.c +msgid "%q and %q must be different" +msgstr "" + #: shared-bindings/microcontroller/Pin.c msgid "%q contains duplicate pins" msgstr "%q berisi pin duplikat" @@ -84,16 +106,12 @@ msgstr "%q berisi pin duplikat" msgid "%q failure: %d" msgstr "%q gagal: %d" +#: shared-bindings/digitalio/DigitalInOut.c #: shared-bindings/microcontroller/Pin.c msgid "%q in use" msgstr "%q sedang digunakan" -#: ports/atmel-samd/common-hal/pulseio/PulseIn.c -#: ports/cxd56/common-hal/pulseio/PulseIn.c -#: ports/nrf/common-hal/pulseio/PulseIn.c -#: ports/raspberrypi/common-hal/pulseio/PulseIn.c -#: ports/stm/common-hal/pulseio/PulseIn.c py/obj.c py/objstr.c -#: py/objstrunicode.c +#: py/obj.c py/objstr.c py/objstrunicode.c msgid "%q index out of range" msgstr "%q indeks di luar batas" @@ -101,14 +119,34 @@ msgstr "%q indeks di luar batas" msgid "%q indices must be integers, not %s" msgstr "indeks %q harus bilangan bulat, bukan %s" +#: shared-module/bitbangio/SPI.c +msgid "%q init failed" +msgstr "" + +#: py/argcheck.c +msgid "%q length must be %d" +msgstr "" + #: py/argcheck.c msgid "%q length must be %d-%d" msgstr "%q panjang harus %d-%d" -#: shared-bindings/busio/I2C.c shared-bindings/usb_hid/Device.c +#: py/argcheck.c +msgid "%q length must be <= %d" +msgstr "" + +#: py/argcheck.c +msgid "%q length must be >= %d" +msgstr "" + +#: shared-bindings/busio/I2C.c msgid "%q length must be >= 1" msgstr "%q panjang harus >= 1" +#: py/argcheck.c +msgid "%q must be %d" +msgstr "" + #: py/argcheck.c msgid "%q must be %d-%d" msgstr "%q harus %d-%d" @@ -125,30 +163,18 @@ msgstr "%q harus <= %d" msgid "%q must be >= %d" msgstr "%q harus >= %d" -#: py/argcheck.c shared-bindings/memorymonitor/AllocationAlarm.c -msgid "%q must be >= 0" -msgstr "%q harus >= 0" - -#: shared-bindings/_bleio/CharacteristicBuffer.c -#: shared-bindings/_bleio/PacketBuffer.c shared-bindings/displayio/Group.c -#: shared-bindings/displayio/Shape.c -#: shared-bindings/memorymonitor/AllocationAlarm.c -#: shared-bindings/vectorio/Circle.c shared-bindings/vectorio/Rectangle.c -msgid "%q must be >= 1" -msgstr "%q harus >= 1" +#: shared-bindings/analogbufio/BufferedIn.c +#: shared-bindings/audiocore/RawSample.c +msgid "%q must be a bytearray or array of type 'h', 'H', 'b', or 'B'" +msgstr "" #: py/argcheck.c msgid "%q must be a string" msgstr "%q harus berupa string" -#: shared-module/vectorio/Polygon.c -msgid "%q must be a tuple of length 2" -msgstr "%q harus berupa tuple dengan panjang 2" - -#: ports/espressif/common-hal/imagecapture/ParallelImageCapture.c -#: shared-module/vectorio/VectorShape.c -msgid "%q must be between %d and %d" -msgstr "%q harus antara %d dan %d" +#: py/argcheck.c +msgid "%q must be an int" +msgstr "" #: py/argcheck.c msgid "%q must be of type %q" @@ -166,7 +192,11 @@ msgstr "%q harus pangkat 2" msgid "%q out of bounds" msgstr "" +#: ports/atmel-samd/common-hal/pulseio/PulseIn.c +#: ports/cxd56/common-hal/pulseio/PulseIn.c +#: ports/nrf/common-hal/pulseio/PulseIn.c #: ports/raspberrypi/common-hal/rp2pio/StateMachine.c +#: ports/stm/common-hal/pulseio/PulseIn.c py/argcheck.c #: shared-bindings/canio/Match.c msgid "%q out of range" msgstr "%q di luar jangkauan" @@ -175,10 +205,6 @@ msgstr "%q di luar jangkauan" msgid "%q pin invalid" msgstr "pin %q tidak valid" -#: shared-bindings/fontio/BuiltinFont.c -msgid "%q should be an int" -msgstr "%q harus berupa int" - #: shared-bindings/usb_hid/Device.c msgid "%q with a report ID of 0 must be of length 1" msgstr "" @@ -191,7 +217,11 @@ msgstr "%q() mengambil posisi argumen %d tapi %d yang diberikan" msgid "%q, %q, and %q must all be the same length" msgstr "%q, %q, dan %q semuanya harus memiliki panjang yang sama" -#: ports/espressif/bindings/espidf/__init__.c ports/espressif/esp_error.c +#: py/objint.c +msgid "%q=%q" +msgstr "" + +#: ports/espressif/common-hal/espidf/__init__.c ports/espressif/esp_error.c #, c-format msgid "%s error 0x%x" msgstr "%s kesalahan 0x%x" @@ -276,7 +306,7 @@ msgstr "" msgid "'%s' object doesn't support item deletion" msgstr "" -#: py/runtime.c +#: ports/raspberrypi/common-hal/wifi/Radio.c py/runtime.c msgid "'%s' object has no attribute '%q'" msgstr "Objek '%s' tidak memiliki atribut '%q'" @@ -341,10 +371,6 @@ msgstr "'yield from' di dalam fungsi async" msgid "'yield' outside function" msgstr "'yield' diluar fungsi" -#: shared-module/vectorio/VectorShape.c -msgid "(x,y) integers required" -msgstr "" - #: py/compile.c msgid "*x must be assignment target" msgstr "*x harus menjadi target assignment" @@ -380,16 +406,12 @@ msgstr "ADC2 sedang digunakan oleh WiFi" msgid "Address must be %d bytes long" msgstr "Alamat harus sepanjang %d byte" -#: shared-bindings/_bleio/Address.c -msgid "Address type out of range" -msgstr "Jenis alamat di luar batas" - #: ports/espressif/common-hal/canio/CAN.c msgid "All CAN peripherals are in use" msgstr "" #: ports/espressif/common-hal/busio/I2C.c -#: ports/espressif/common-hal/i2cperipheral/I2CPeripheral.c +#: ports/espressif/common-hal/i2ctarget/I2CTarget.c #: ports/nrf/common-hal/busio/I2C.c msgid "All I2C peripherals are in use" msgstr "Semua perangkat I2C sedang digunakan" @@ -426,7 +448,6 @@ msgstr "" msgid "All event channels in use" msgstr "Semua channel event sedang digunakan" -#: ports/raspberrypi/common-hal/pulseio/PulseIn.c #: ports/raspberrypi/common-hal/rp2pio/StateMachine.c msgid "All state machines in use" msgstr "" @@ -471,28 +492,10 @@ msgid "Already running" msgstr "" #: ports/espressif/common-hal/wifi/Radio.c +#: ports/raspberrypi/common-hal/wifi/Radio.c msgid "Already scanning for wifi networks" msgstr "" -#: ports/cxd56/common-hal/analogio/AnalogIn.c -msgid "AnalogIn not supported on given pin" -msgstr "AnalogIn tidak didukung pada pin yang diberikan" - -#: ports/cxd56/common-hal/analogio/AnalogOut.c -#: ports/mimxrt10xx/common-hal/analogio/AnalogOut.c -#: ports/nrf/common-hal/analogio/AnalogOut.c -#: ports/raspberrypi/common-hal/analogio/AnalogOut.c -msgid "AnalogOut functionality not supported" -msgstr "fungsionalitas AnalogOut tidak didukung" - -#: shared-bindings/analogio/AnalogOut.c -msgid "AnalogOut is only 16 bits. Value must be less than 65536." -msgstr "AnalogOut hanya 16 bit. Nilai harus kurang dari 65536." - -#: ports/atmel-samd/common-hal/analogio/AnalogOut.c -msgid "AnalogOut not supported on given pin" -msgstr "pin yang dipakai tidak mendukung AnalogOut" - #: ports/stm/common-hal/audiopwmio/PWMAudioOut.c msgid "Another PWMAudioOut is already active" msgstr "" @@ -531,7 +534,7 @@ msgstr "" msgid "AuthMode.OPEN is not used with password" msgstr "" -#: shared-bindings/wifi/Radio.c +#: shared-bindings/wifi/Radio.c supervisor/shared/web_workflow/web_workflow.c msgid "Authentication failure" msgstr "" @@ -564,11 +567,6 @@ msgstr "" 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." @@ -610,11 +608,6 @@ msgstr "Buffer + offset terlalu kecil %d %d %d" msgid "Buffer elements must be 4 bytes long or less" msgstr "" -#: shared-module/usb_hid/Device.c -#, c-format -msgid "Buffer incorrect size. Should be %d bytes." -msgstr "Ukuran buffer salah. Seharusnya %d byte." - #: shared-bindings/framebufferio/FramebufferDisplay.c msgid "Buffer is not a bytearray." msgstr "Buffer bukan bytearray." @@ -624,7 +617,6 @@ msgstr "Buffer bukan bytearray." msgid "Buffer is too small" msgstr "Buffer terlalu kecil" -#: ports/nrf/common-hal/audiopwmio/PWMAudioOut.c #: ports/stm/common-hal/audiopwmio/PWMAudioOut.c #, c-format msgid "Buffer length %d too big. It must be less than %d" @@ -639,10 +631,6 @@ msgstr "Panjang buffer harus kelipatan 512" msgid "Buffer must be a multiple of 512 bytes" msgstr "" -#: shared-bindings/bitbangio/I2C.c -msgid "Buffer must be at least length 1" -msgstr "Penyangga harus memiliki panjang setidaknya 1" - #: shared-bindings/_bleio/PacketBuffer.c #, c-format msgid "Buffer too short by %d bytes" @@ -664,10 +652,6 @@ msgstr "Pin bus %d sudah digunakan" msgid "Byte buffer must be 16 bytes." msgstr "Byte buffer harus 16 byte." -#: shared-bindings/alarm/SleepMemory.c shared-bindings/nvm/ByteArray.c -msgid "Bytes must be between 0 and 255." -msgstr "Bytes harus di antara 0 dan 255." - #: shared-bindings/aesio/aes.c msgid "CBC blocks must be multiples of 16 bytes" msgstr "Blok CBC harus merupakan kelipatan 16 byte" @@ -676,7 +660,7 @@ msgstr "Blok CBC harus merupakan kelipatan 16 byte" msgid "CIRCUITPY drive could not be found or created." msgstr "" -#: ports/espressif/bindings/espidf/__init__.c ports/espressif/esp_error.c +#: ports/espressif/common-hal/espidf/__init__.c ports/espressif/esp_error.c msgid "CRC or checksum was invalid" msgstr "" @@ -684,6 +668,10 @@ msgstr "" msgid "Call super().__init__() before accessing native object." msgstr "Panggil super().__init__() sebelum mengakses objek asli." +#: ports/cxd56/common-hal/camera/Camera.c +msgid "Camera init" +msgstr "" + #: ports/espressif/common-hal/alarm/pin/PinAlarm.c msgid "Can only alarm on RTC IO from deep sleep." msgstr "" @@ -733,20 +721,10 @@ msgstr "" "Tidak dapat memiliki respon pindaian untuk penyebaran yang terhubung dan " "diperluas." -#: ports/atmel-samd/common-hal/audioio/AudioOut.c -msgid "Cannot output both channels on the same pin" -msgstr "" -"Tidak dapat menggunakan output di kedua channel dengan menggunakan pin yang " -"sama" - #: ports/espressif/common-hal/alarm/pin/PinAlarm.c msgid "Cannot pull on input-only pin." msgstr "" -#: shared-module/bitbangio/SPI.c -msgid "Cannot read without MISO pin." -msgstr "Tidak dapat membaca tanpa pin MISO." - #: shared-bindings/audiobusio/PDMIn.c msgid "Cannot record to a file" msgstr "Tidak dapat merekam ke file" @@ -758,10 +736,8 @@ msgstr "" #: ports/atmel-samd/common-hal/microcontroller/__init__.c #: ports/cxd56/common-hal/microcontroller/__init__.c #: ports/mimxrt10xx/common-hal/microcontroller/__init__.c -msgid "Cannot reset into bootloader because no bootloader is present." +msgid "Cannot reset into bootloader because no bootloader is present" msgstr "" -"Tidak dapat melakukan reset ke bootloader karena tidak ada bootloader yang " -"terisi" #: ports/espressif/common-hal/socketpool/Socket.c msgid "Cannot set socket options" @@ -781,8 +757,8 @@ msgid "Cannot subclass slice" msgstr "Tidak dapat membuat subkelas dari irisan" #: shared-module/bitbangio/SPI.c -msgid "Cannot transfer without MOSI and MISO pins." -msgstr "Tidak dapat transfer tanpa pin MOSI dan MISO." +msgid "Cannot transfer without MOSI and MISO pins" +msgstr "" #: shared-bindings/pwmio/PWMOut.c msgid "Cannot vary frequency on a timer that is already in use" @@ -790,14 +766,13 @@ msgstr "" "Tidak dapat membuat variasi frekuensi pada penghitung waktu yang sudah " "digunakan" -#: ports/espressif/common-hal/alarm/pin/PinAlarm.c #: ports/nrf/common-hal/alarm/pin/PinAlarm.c -msgid "Cannot wake on pin edge. Only level." +msgid "Cannot wake on pin edge, only level" msgstr "" -#: shared-module/bitbangio/SPI.c -msgid "Cannot write without MOSI pin." -msgstr "Tidak dapat menulis tanpa pin MOSI." +#: ports/espressif/common-hal/alarm/pin/PinAlarm.c +msgid "Cannot wake on pin edge. Only level." +msgstr "" #: shared-bindings/_bleio/CharacteristicBuffer.c msgid "CharacteristicBuffer writing not provided" @@ -811,10 +786,6 @@ msgstr "Kode inti CircuitPython mengalami crash. Aduh!\n" msgid "CircuitPython was unable to allocate the heap." msgstr "" -#: shared-module/bitbangio/SPI.c -msgid "Clock pin init failed." -msgstr "Init pin clock gagal." - #: shared-module/bitbangio/I2C.c msgid "Clock stretch too long" msgstr "Peregangan clock terlalu panjang" @@ -823,11 +794,6 @@ msgstr "Peregangan clock terlalu panjang" msgid "Clock unit in use" msgstr "Clock unit sedang digunakan" -#: shared-bindings/displayio/FourWire.c shared-bindings/displayio/I2CDisplay.c -#: shared-bindings/paralleldisplay/ParallelBus.c -msgid "Command must be an int between 0 and 255" -msgstr "Perintah harus berupa int di antara 0 dan 255" - #: shared-bindings/_bleio/Connection.c msgid "" "Connection has been disconnected and can no longer be used. Create a new " @@ -839,35 +805,6 @@ msgstr "" msgid "Corrupt .mpy file" msgstr "File .mpy rusak" -#: ports/cxd56/common-hal/camera/Camera.c -msgid "Could not initialize Camera" -msgstr "" - -#: ports/cxd56/common-hal/gnss/GNSS.c -msgid "Could not initialize GNSS" -msgstr "" - -#: ports/cxd56/common-hal/sdioio/SDCard.c -msgid "Could not initialize SDCard" -msgstr "" - -#: ports/atmel-samd/common-hal/busio/UART.c ports/cxd56/common-hal/busio/UART.c -#: ports/espressif/common-hal/busio/UART.c -msgid "Could not initialize UART" -msgstr "Tidak dapat menginisialisasi UART" - -#: ports/stm/common-hal/pwmio/PWMOut.c -msgid "Could not re-init channel" -msgstr "Tidak dapat menginisialisasi ulang kanal" - -#: ports/stm/common-hal/pwmio/PWMOut.c -msgid "Could not re-init timer" -msgstr "Tidak dapat menginisialisasi ulang timer" - -#: ports/stm/common-hal/pwmio/PWMOut.c -msgid "Could not restart PWM" -msgstr "Tidak dapat memulai ulang PWM" - #: ports/espressif/common-hal/neopixel_write/__init__.c msgid "Could not retrieve clock" msgstr "" @@ -888,20 +825,6 @@ msgstr "Tidak dapat memulai interupsi, RX sibuk" msgid "Couldn't allocate decoder" msgstr "Tidak dapat mengalokasikan dekoder" -#: shared-module/audiocore/WaveFile.c shared-module/audiomixer/Mixer.c -#: shared-module/audiomp3/MP3Decoder.c -msgid "Couldn't allocate first buffer" -msgstr "Tidak dapat mengalokasikan penyangga pertama" - -#: shared-module/audiomp3/MP3Decoder.c -msgid "Couldn't allocate input buffer" -msgstr "Tidak dapat mengalokasikan penyangga masukan" - -#: shared-module/audiocore/WaveFile.c shared-module/audiomixer/Mixer.c -#: shared-module/audiomp3/MP3Decoder.c -msgid "Couldn't allocate second buffer" -msgstr "Tidak dapat mengalokasikan penyangga kedua" - #: supervisor/shared/safe_mode.c msgid "Crash into the HardFault_Handler." msgstr "Gagal ke HardFault_Handler." @@ -949,10 +872,6 @@ msgstr "Kapasitas tujuan lebih kecil dari destination_length." msgid "Device in use" msgstr "Perangkat sedang digunakan" -#: ports/cxd56/common-hal/digitalio/DigitalInOut.c -msgid "DigitalInOut not supported on given pin" -msgstr "DigitalInOut tidak didukung pada pin yang diberikan" - #: shared-bindings/displayio/Display.c #: shared-bindings/framebufferio/FramebufferDisplay.c msgid "Display must have a 16 bit colorspace." @@ -964,6 +883,10 @@ msgstr "Tampilan harus memiliki ruang warna 16 bit." msgid "Display rotation must be in 90 degree increments" msgstr "Rotasi tampilan harus dalam kelipatan 90 derajat" +#: main.c +msgid "Done" +msgstr "" + #: shared-bindings/digitalio/DigitalInOut.c msgid "Drive mode not used when direction is input." msgstr "Mode kendara tidak digunakan saat arah input." @@ -997,21 +920,20 @@ msgstr "Error pada regex" msgid "Error: Failure to bind" msgstr "" -#: ports/raspberrypi/bindings/rp2pio/StateMachine.c py/enum.c -#: shared-bindings/_bleio/__init__.c shared-bindings/aesio/aes.c -#: shared-bindings/busio/SPI.c shared-bindings/microcontroller/Pin.c +#: py/enum.c shared-bindings/_bleio/__init__.c shared-bindings/aesio/aes.c +#: shared-bindings/alarm/__init__.c shared-bindings/busio/SPI.c +#: shared-bindings/microcontroller/Pin.c #: shared-bindings/neopixel_write/__init__.c msgid "Expected a %q" msgstr "Diharapkan %q" -#: shared-bindings/alarm/__init__.c -msgid "Expected an alarm" +#: ports/raspberrypi/bindings/cyw43/__init__.c +msgid "Expected a %q or %q" msgstr "" -#: shared-module/adafruit_pixelbuf/PixelBuf.c -#, c-format -msgid "Expected tuple of length %d, got %d" -msgstr "Diharapkan tuple dengan panjang %d, didapatkan %d" +#: shared-bindings/alarm/__init__.c +msgid "Expected an %q" +msgstr "" #: ports/espressif/common-hal/_bleio/Adapter.c #: ports/nrf/common-hal/_bleio/Adapter.c @@ -1039,21 +961,9 @@ msgstr "Gagal mengirim perintah." msgid "Failed to acquire mutex, err 0x%04x" msgstr "Gagal memperoleh mutex, err 0x%04x" -#: ports/mimxrt10xx/common-hal/busio/UART.c ports/nrf/common-hal/busio/UART.c -#: ports/raspberrypi/common-hal/busio/UART.c -msgid "Failed to allocate RX buffer" -msgstr "Gagal untuk mengalokasikan buffer RX" - -#: ports/atmel-samd/common-hal/busio/UART.c -#: ports/atmel-samd/common-hal/pulseio/PulseIn.c -#: ports/cxd56/common-hal/pulseio/PulseIn.c -#: ports/espressif/common-hal/pulseio/PulseIn.c -#: ports/nrf/common-hal/pulseio/PulseIn.c -#: ports/raspberrypi/common-hal/pulseio/PulseIn.c -#: ports/stm/common-hal/pulseio/PulseIn.c -#, c-format -msgid "Failed to allocate RX buffer of %d bytes" -msgstr "Gagal untuk megalokasikan buffer RX dari %d byte" +#: shared-module/rgbmatrix/RGBMatrix.c +msgid "Failed to allocate %q buffer" +msgstr "" #: ports/espressif/common-hal/wifi/__init__.c msgid "Failed to allocate Wifi memory" @@ -1076,10 +986,6 @@ msgstr "Gagal terhubung: kesalahan internal" msgid "Failed to connect: timeout" msgstr "Gagal terhubung: habis waktu" -#: ports/espressif/common-hal/wifi/__init__.c -msgid "Failed to init wifi" -msgstr "" - #: shared-module/audiomp3/MP3Decoder.c msgid "Failed to parse MP3 file" msgstr "Gagal mengurai file MP3" @@ -1123,11 +1029,6 @@ msgstr "" msgid "Format not supported" msgstr "" -#: shared-module/framebufferio/FramebufferDisplay.c -#, c-format -msgid "Framebuffer requires %d bytes" -msgstr "" - #: ports/mimxrt10xx/common-hal/microcontroller/Processor.c msgid "" "Frequency must be 24, 150, 396, 450, 528, 600, 720, 816, 912, 960 or 1008 Mhz" @@ -1142,7 +1043,11 @@ msgstr "Frekuensi harus cocok dengan PWMOut yang ada menggunakan timer ini" msgid "Function requires lock" msgstr "Fungsinya membutuhkan kunci" -#: ports/espressif/bindings/espidf/__init__.c ports/espressif/esp_error.c +#: ports/cxd56/common-hal/gnss/GNSS.c +msgid "GNSS init" +msgstr "" + +#: ports/espressif/common-hal/espidf/__init__.c ports/espressif/esp_error.c msgid "Generic Failure" msgstr "" @@ -1169,19 +1074,16 @@ msgstr "Perangkat keras sibuk, coba pin alternatif" msgid "Hardware in use, try alternative pins" msgstr "Perangkat keras sedang digunakan, coba pin alternatif" -#: shared-bindings/wifi/Radio.c -msgid "Hostname must be between 1 and 253 characters" -msgstr "" - #: extmod/vfs_posix_file.c py/objstringio.c msgid "I/O operation on closed file" msgstr "operasi I/O pada file tertutup" #: ports/stm/common-hal/busio/I2C.c -msgid "I2C Init Error" -msgstr "Gagal Inisialisasi I2C" +msgid "I2C init error" +msgstr "" #: ports/raspberrypi/common-hal/busio/I2C.c +#: ports/raspberrypi/common-hal/i2ctarget/I2CTarget.c msgid "I2C peripheral in use" msgstr "" @@ -1288,75 +1190,37 @@ msgstr "" msgid "Internal error #%d" msgstr "Kesalahan internal #%d" -#: shared-bindings/sdioio/SDCard.c shared-module/usb_hid/Device.c +#: supervisor/shared/safe_mode.c +msgid "Internal watchdog timer expired." +msgstr "" + +#: py/argcheck.c shared-bindings/digitalio/DigitalInOut.c msgid "Invalid %q" msgstr "" -#: ports/atmel-samd/common-hal/audiobusio/I2SOut.c -#: ports/atmel-samd/common-hal/audiobusio/PDMIn.c -#: ports/atmel-samd/common-hal/imagecapture/ParallelImageCapture.c -#: ports/mimxrt10xx/common-hal/busio/UART.c +#: shared-bindings/microcontroller/Pin.c msgid "Invalid %q pin" msgstr "%q pada tidak valid" -#: ports/stm/common-hal/busio/I2C.c ports/stm/common-hal/busio/SPI.c -#: ports/stm/common-hal/busio/UART.c ports/stm/common-hal/canio/CAN.c -#: ports/stm/common-hal/sdioio/SDCard.c -msgid "Invalid %q pin selection" -msgstr "" - #: ports/stm/common-hal/analogio/AnalogIn.c msgid "Invalid ADC Unit value" msgstr "Nilai Unit ADC tidak valid" -#: ports/espressif/common-hal/wifi/Radio.c -msgid "Invalid AuthMode" -msgstr "" - #: ports/espressif/common-hal/_bleio/__init__.c #: ports/nrf/common-hal/_bleio/__init__.c msgid "Invalid BLE parameter" msgstr "" -#: shared-module/displayio/OnDiskBitmap.c -msgid "Invalid BMP file" -msgstr "File BMP tidak valid" - #: shared-bindings/wifi/Radio.c msgid "Invalid BSSID" msgstr "" -#: ports/espressif/common-hal/analogio/AnalogOut.c -#: ports/stm/common-hal/analogio/AnalogOut.c -msgid "Invalid DAC pin supplied" -msgstr "Pin DAC yang diberikan tidak valid" - #: shared-bindings/wifi/Radio.c msgid "Invalid MAC address" msgstr "" -#: shared-bindings/synthio/__init__.c -msgid "Invalid MIDI file" -msgstr "" - -#: ports/atmel-samd/common-hal/pwmio/PWMOut.c -#: ports/cxd56/common-hal/pwmio/PWMOut.c -#: ports/espressif/common-hal/pwmio/PWMOut.c -#: ports/mimxrt10xx/common-hal/pwmio/PWMOut.c -#: ports/nrf/common-hal/pwmio/PWMOut.c -#: ports/raspberrypi/common-hal/pwmio/PWMOut.c shared-bindings/pwmio/PWMOut.c -msgid "Invalid PWM frequency" -msgstr "Frekuensi PWM tidak valid" - -#: ports/espressif/common-hal/analogio/AnalogIn.c -msgid "Invalid Pin" -msgstr "" - -#: ports/espressif/bindings/espidf/__init__.c -#: ports/espressif/common-hal/busio/I2C.c -#: ports/espressif/common-hal/i2cperipheral/I2CPeripheral.c -#: ports/espressif/esp_error.c py/moduerrno.c -#: shared-module/rgbmatrix/RGBMatrix.c +#: ports/espressif/common-hal/espidf/__init__.c ports/espressif/esp_error.c +#: py/moduerrno.c msgid "Invalid argument" msgstr "Argumen tidak valid" @@ -1364,42 +1228,11 @@ msgstr "Argumen tidak valid" msgid "Invalid bits per value" msgstr "Bit per nilai tidak valid" -#: ports/nrf/common-hal/busio/UART.c ports/raspberrypi/common-hal/busio/UART.c -#: ports/stm/common-hal/busio/UART.c -msgid "Invalid buffer size" -msgstr "Ukuran buffer tidak valid" - -#: shared-bindings/adafruit_pixelbuf/PixelBuf.c -msgid "Invalid byteorder string" -msgstr "String byteorder tidak valid" - -#: ports/atmel-samd/common-hal/frequencyio/FrequencyIn.c -#: ports/espressif/common-hal/frequencyio/FrequencyIn.c -msgid "Invalid capture period. Valid range: 1 - 500" -msgstr "Periode penangkapan tidak valid. Kisaran yang valid: 1 - 500" - -#: shared-bindings/audiomixer/Mixer.c -msgid "Invalid channel count" -msgstr "Jumlah kanal tidak valid" - -#: ports/atmel-samd/common-hal/imagecapture/ParallelImageCapture.c -#, c-format -msgid "Invalid data_count %d" -msgstr "" - #: ports/atmel-samd/common-hal/imagecapture/ParallelImageCapture.c #, c-format msgid "Invalid data_pins[%d]" msgstr "" -#: shared-bindings/digitalio/DigitalInOut.c -msgid "Invalid direction." -msgstr "Arah tidak valid." - -#: shared-module/audiocore/WaveFile.c -msgid "Invalid file" -msgstr "File tidak valid" - #: shared-module/audiocore/WaveFile.c msgid "Invalid format chunk size" msgstr "Ukuran potongan format tidak valid" @@ -1408,107 +1241,27 @@ msgstr "Ukuran potongan format tidak valid" msgid "Invalid memory access." msgstr "Akses memori tidak valid." -#: extmod/vfs_fat_file.c -msgid "Invalid mode" -msgstr "" - #: ports/espressif/common-hal/wifi/Radio.c msgid "Invalid multicast MAC address" msgstr "" -#: shared-bindings/bitbangio/SPI.c shared-bindings/busio/SPI.c -msgid "Invalid number of bits" -msgstr "Jumlah bit tidak valid" - -#: shared-bindings/bitbangio/SPI.c shared-bindings/busio/SPI.c -#: shared-bindings/displayio/FourWire.c -msgid "Invalid phase" -msgstr "Fase tidak valid" - -#: ports/atmel-samd/common-hal/audioio/AudioOut.c -#: ports/atmel-samd/common-hal/touchio/TouchIn.c -#: ports/espressif/common-hal/alarm/touch/TouchAlarm.c -#: ports/espressif/common-hal/touchio/TouchIn.c -#: ports/nrf/common-hal/alarm/pin/PinAlarm.c shared-bindings/pwmio/PWMOut.c -#: shared-module/rgbmatrix/RGBMatrix.c -msgid "Invalid pin" -msgstr "Pin tidak valid" - -#: ports/atmel-samd/common-hal/audioio/AudioOut.c -msgid "Invalid pin for left channel" -msgstr "Pin untuk channel kiri tidak valid" - -#: ports/atmel-samd/common-hal/audioio/AudioOut.c -msgid "Invalid pin for right channel" -msgstr "Pin untuk channel kanan tidak valid" - -#: ports/atmel-samd/common-hal/busio/I2C.c -#: ports/atmel-samd/common-hal/busio/SPI.c -#: ports/atmel-samd/common-hal/busio/UART.c -#: ports/atmel-samd/common-hal/i2cperipheral/I2CPeripheral.c -#: ports/cxd56/common-hal/busio/I2C.c ports/cxd56/common-hal/busio/SPI.c -#: ports/cxd56/common-hal/busio/UART.c ports/cxd56/common-hal/sdioio/SDCard.c -#: ports/espressif/common-hal/busio/I2C.c -#: ports/espressif/common-hal/busio/SPI.c -#: ports/espressif/common-hal/busio/UART.c -#: ports/espressif/common-hal/canio/CAN.c -#: ports/espressif/common-hal/i2cperipheral/I2CPeripheral.c -#: ports/mimxrt10xx/common-hal/busio/I2C.c -#: ports/mimxrt10xx/common-hal/busio/SPI.c -#: ports/mimxrt10xx/common-hal/usb_host/Port.c ports/nrf/common-hal/busio/I2C.c -#: ports/raspberrypi/common-hal/busio/I2C.c -#: ports/raspberrypi/common-hal/busio/SPI.c -#: ports/raspberrypi/common-hal/busio/UART.c shared-bindings/busio/SPI.c #: shared-bindings/busio/UART.c msgid "Invalid pins" msgstr "Pin-pin tidak valid" -#: shared-bindings/bitbangio/SPI.c shared-bindings/busio/SPI.c -#: shared-bindings/displayio/FourWire.c -msgid "Invalid polarity" -msgstr "Polaritas tidak valid" - -#: shared-bindings/_bleio/Characteristic.c -msgid "Invalid properties" -msgstr "Properti tidak valid" - -#: shared-bindings/microcontroller/__init__.c -msgid "Invalid run mode." -msgstr "Mode operasi tidak valid." - -#: shared-module/_bleio/Attribute.c -msgid "Invalid security_mode" -msgstr "security_mode tidak valid" - -#: ports/espressif/bindings/espidf/__init__.c ports/espressif/esp_error.c +#: ports/espressif/common-hal/espidf/__init__.c ports/espressif/esp_error.c msgid "Invalid size" msgstr "" #: ports/espressif/common-hal/ssl/SSLContext.c +#: ports/raspberrypi/common-hal/ssl/SSLSocket.c msgid "Invalid socket for TLS" msgstr "" -#: ports/espressif/bindings/espidf/__init__.c ports/espressif/esp_error.c +#: ports/espressif/common-hal/espidf/__init__.c ports/espressif/esp_error.c msgid "Invalid state" msgstr "" -#: shared-bindings/audiomixer/Mixer.c -msgid "Invalid voice" -msgstr "Suara tidak valid" - -#: shared-bindings/audiomixer/Mixer.c -msgid "Invalid voice count" -msgstr "Hitungan suara tidak valid" - -#: shared-module/audiocore/WaveFile.c -msgid "Invalid wave file" -msgstr "File wave tidak valid" - -#: ports/mimxrt10xx/common-hal/busio/UART.c ports/nrf/common-hal/busio/UART.c -#: ports/raspberrypi/common-hal/busio/UART.c ports/stm/common-hal/busio/UART.c -msgid "Invalid word/bit length" -msgstr "Panjang kata/bit tidak valid" - #: shared-bindings/aesio/aes.c msgid "Key must be 16, 24, or 32 bytes long" msgstr "Panjang kunci harus 16, 24, atau 32 byte" @@ -1522,24 +1275,16 @@ msgid "LHS of keyword arg must be an id" msgstr "LHS dari keyword arg harus menjadi sebuah id" #: shared-module/displayio/Group.c -msgid "Layer already in a group." -msgstr "Layer sudah ada dalam grup." - -#: shared-module/displayio/Group.c -msgid "Layer must be a Group or TileGrid subclass." -msgstr "Layer harus sebuah Grup atau subklas dari TileGrid." - -#: ports/espressif/bindings/espidf/__init__.c ports/espressif/esp_error.c -msgid "MAC address was invalid" +msgid "Layer already in a group" msgstr "" -#: shared-module/bitbangio/SPI.c -msgid "MISO pin init failed." -msgstr "Pin MISO gagal inisialisasi." +#: shared-module/displayio/Group.c +msgid "Layer must be a Group or TileGrid subclass" +msgstr "" -#: shared-module/bitbangio/SPI.c -msgid "MOSI pin init failed." -msgstr "Pin MOSI gagal inisialisasi." +#: ports/espressif/common-hal/espidf/__init__.c ports/espressif/esp_error.c +msgid "MAC address was invalid" +msgstr "" #: shared-bindings/is31fl3741/IS31FL3741.c msgid "Mapping must be a tuple" @@ -1550,10 +1295,6 @@ msgstr "" msgid "Maximum x value when mirrored is %d" msgstr "Nilai x maksimum ketika dicerminkan adalah %d" -#: shared-bindings/canio/Message.c -msgid "Messages limited to 8 bytes" -msgstr "" - #: shared-bindings/audiobusio/PDMIn.c msgid "Microphone startup delay must be in range 0.0 to 1.0" msgstr "Penundaan mulai mikrofon harus dalam kisaran 0,0 hingga 1,0" @@ -1567,10 +1308,14 @@ msgstr "" msgid "Mismatched swap flag" msgstr "" -#: ports/mimxrt10xx/common-hal/busio/SPI.c ports/stm/common-hal/busio/SPI.c +#: ports/mimxrt10xx/common-hal/busio/SPI.c msgid "Missing MISO or MOSI Pin" msgstr "Tidak menemukan Pin MISO atau MOSI" +#: ports/stm/common-hal/busio/SPI.c +msgid "Missing MISO or MOSI pin" +msgstr "" + #: ports/raspberrypi/common-hal/rp2pio/StateMachine.c #, c-format msgid "Missing first_in_pin. Instruction %d reads pin(s)" @@ -1606,11 +1351,6 @@ msgstr "" msgid "Missing jmp_pin. Instruction %d jumps on pin" msgstr "" -#: shared-module/usb_hid/Device.c -#, c-format -msgid "More than %d report ids not supported" -msgstr "" - #: shared-bindings/busio/UART.c shared-bindings/displayio/Group.c msgid "Must be a %q subclass." msgstr "Harus berupa subclass %q." @@ -1670,16 +1410,28 @@ msgstr "" msgid "No I2C device at address: 0x%x" msgstr "" +#: supervisor/shared/web_workflow/web_workflow.c +msgid "No IP" +msgstr "" + #: ports/espressif/common-hal/busio/SPI.c -#: ports/mimxrt10xx/common-hal/busio/SPI.c ports/stm/common-hal/busio/SPI.c +#: ports/mimxrt10xx/common-hal/busio/SPI.c msgid "No MISO Pin" msgstr "Tidak ada Pin MISO" +#: ports/stm/common-hal/busio/SPI.c shared-module/bitbangio/SPI.c +msgid "No MISO pin" +msgstr "" + #: ports/espressif/common-hal/busio/SPI.c -#: ports/mimxrt10xx/common-hal/busio/SPI.c ports/stm/common-hal/busio/SPI.c +#: ports/mimxrt10xx/common-hal/busio/SPI.c msgid "No MOSI Pin" msgstr "Tidak ada Pin MOSI" +#: ports/stm/common-hal/busio/SPI.c shared-module/bitbangio/SPI.c +msgid "No MOSI pin" +msgstr "" + #: ports/atmel-samd/common-hal/busio/UART.c #: ports/espressif/common-hal/busio/UART.c #: ports/mimxrt10xx/common-hal/busio/UART.c ports/nrf/common-hal/busio/UART.c @@ -1718,16 +1470,6 @@ msgstr "Tidak ada GCLK yang kosong" msgid "No hardware random available" msgstr "Tidak ada perangkat keras acak yang tersedia" -#: ports/atmel-samd/common-hal/ps2io/Ps2.c -msgid "No hardware support on clk pin" -msgstr "Tidak ada dukungan perangkat keras pada pin clk" - -#: ports/atmel-samd/common-hal/alarm/pin/PinAlarm.c -#: ports/atmel-samd/common-hal/frequencyio/FrequencyIn.c -#: ports/atmel-samd/common-hal/pulseio/PulseIn.c -msgid "No hardware support on pin" -msgstr "Tidak ada dukungan hardware untuk pin" - #: ports/raspberrypi/common-hal/rp2pio/StateMachine.c msgid "No in in program" msgstr "" @@ -1826,16 +1568,26 @@ msgstr "" msgid "Odd parity is not supported" msgstr "Parity ganjil tidak didukung" +#: supervisor/shared/bluetooth/bluetooth.c +msgid "Off" +msgstr "" + +#: supervisor/shared/bluetooth/bluetooth.c +msgid "Ok" +msgstr "" + #: ports/atmel-samd/common-hal/audiobusio/PDMIn.c #: ports/raspberrypi/common-hal/audiobusio/PDMIn.c msgid "Only 8 or 16 bit mono with " msgstr "Hanya 8 atau 16 bit mono dengan " #: ports/espressif/common-hal/wifi/__init__.c +#: ports/raspberrypi/common-hal/wifi/__init__.c msgid "Only IPv4 addresses supported" msgstr "Hanya alamat IPv4 yang didukung" -#: ports/espressif/common-hal/socketpool/SocketPool.c +#: ports/espressif/common-hal/socketpool/Socket.c +#: ports/raspberrypi/common-hal/socketpool/Socket.c msgid "Only IPv4 sockets supported" msgstr "Hanysa socket IPv4 yang didukung" @@ -1872,15 +1624,19 @@ msgstr "" msgid "Only one TouchAlarm can be set in deep sleep." msgstr "" -#: ports/espressif/common-hal/i2cperipheral/I2CPeripheral.c +#: ports/espressif/common-hal/i2ctarget/I2CTarget.c +#: ports/raspberrypi/common-hal/i2ctarget/I2CTarget.c msgid "Only one address is allowed" msgstr "" #: ports/atmel-samd/common-hal/alarm/time/TimeAlarm.c -#: ports/espressif/common-hal/alarm/time/TimeAlarm.c #: ports/nrf/common-hal/alarm/time/TimeAlarm.c -#: ports/raspberrypi/common-hal/alarm/time/TimeAlarm.c #: ports/stm/common-hal/alarm/time/TimeAlarm.c +msgid "Only one alarm.time alarm can be set" +msgstr "" + +#: ports/espressif/common-hal/alarm/time/TimeAlarm.c +#: ports/raspberrypi/common-hal/alarm/time/TimeAlarm.c msgid "Only one alarm.time alarm can be set." msgstr "" @@ -1892,19 +1648,20 @@ msgstr "" msgid "Operation not permitted" msgstr "" -#: ports/espressif/bindings/espidf/__init__.c ports/espressif/esp_error.c +#: ports/espressif/common-hal/espidf/__init__.c ports/espressif/esp_error.c msgid "Operation or feature not supported" msgstr "" -#: ports/espressif/bindings/espidf/__init__.c ports/espressif/esp_error.c +#: ports/espressif/common-hal/espidf/__init__.c ports/espressif/esp_error.c msgid "Operation timed out" msgstr "Waktu habis" -#: ports/espressif/bindings/espidf/__init__.c ports/espressif/esp_error.c +#: ports/espressif/common-hal/espidf/__init__.c ports/espressif/esp_error.c msgid "Out of memory" msgstr "Kehabisan memori" -#: ports/espressif/common-hal/socketpool/SocketPool.c +#: ports/espressif/common-hal/socketpool/Socket.c +#: ports/raspberrypi/common-hal/socketpool/Socket.c msgid "Out of sockets" msgstr "Kehabisan socket" @@ -1912,11 +1669,6 @@ msgstr "Kehabisan socket" msgid "Out-buffer elements must be <= 4 bytes long" msgstr "" -#: shared-bindings/bitops/__init__.c -#, c-format -msgid "Output buffer must be at least %d bytes" -msgstr "" - #: shared-bindings/audiobusio/PDMIn.c msgid "Oversample must be multiple of 8." msgstr "Sampel berlebihan harus kelipatan 8." @@ -1925,11 +1677,6 @@ msgstr "Sampel berlebihan harus kelipatan 8." msgid "PDMIn not available" msgstr "" -#: shared-bindings/pwmio/PWMOut.c -msgid "" -"PWM duty_cycle must be between 0 and 65535 inclusive (16 bit resolution)" -msgstr "PWM duty_cycle harus antara 0 dan 65535 inklusif (resolusi 16 bit)" - #: shared-bindings/pwmio/PWMOut.c msgid "" "PWM frequency not writable when variable_frequency is False on construction." @@ -1937,6 +1684,10 @@ msgstr "" "Frekuensi PWM tidak dapat ditulis ketika variabel_frequency Salah pada " "konstruksi." +#: ports/stm/common-hal/pwmio/PWMOut.c +msgid "PWM restart" +msgstr "" + #: ports/raspberrypi/common-hal/countio/Counter.c msgid "PWM slice already in use" msgstr "" @@ -1953,36 +1704,20 @@ msgstr "Periferal sedang digunakan" msgid "Permission denied" msgstr "Izin ditolak" -#: ports/atmel-samd/common-hal/alarm/pin/PinAlarm.c #: ports/stm/common-hal/alarm/pin/PinAlarm.c msgid "Pin cannot wake from Deep Sleep" msgstr "" -#: ports/raspberrypi/bindings/rp2pio/StateMachine.c -msgid "Pin count must be at least 1" -msgstr "" - #: ports/raspberrypi/common-hal/rp2pio/StateMachine.c msgid "Pin count too large" msgstr "Jumlah pin terlalu besar" -#: ports/atmel-samd/common-hal/analogio/AnalogIn.c -#: ports/cxd56/common-hal/analogio/AnalogIn.c -#: ports/espressif/common-hal/analogio/AnalogIn.c -#: ports/mimxrt10xx/common-hal/analogio/AnalogIn.c -#: ports/nrf/common-hal/analogio/AnalogIn.c -#: ports/raspberrypi/common-hal/analogio/AnalogIn.c -#: ports/stm/common-hal/analogio/AnalogIn.c -msgid "Pin does not have ADC capabilities" -msgstr "Pin tidak mempunya kemampuan untuk ADC (Analog Digital Converter)" - #: ports/stm/common-hal/alarm/pin/PinAlarm.c #: ports/stm/common-hal/pulseio/PulseIn.c msgid "Pin interrupt already in use" msgstr "" #: shared-bindings/adafruit_bus_device/spi_device/SPIDevice.c -#: shared-bindings/digitalio/DigitalInOut.c msgid "Pin is input only" msgstr "" @@ -2047,18 +1782,10 @@ msgstr "" msgid "Program does OUT without loading OSR" msgstr "" -#: ports/raspberrypi/bindings/rp2pio/StateMachine.c -msgid "Program must contain at least one 16-bit instruction." -msgstr "" - #: ports/raspberrypi/bindings/rp2pio/StateMachine.c msgid "Program size invalid" msgstr "" -#: ports/raspberrypi/bindings/rp2pio/StateMachine.c -msgid "Program too large" -msgstr "" - #: shared-bindings/digitalio/DigitalInOut.c msgid "Pull not used when direction is output." msgstr "Pull tidak digunakan saat arah output." @@ -2080,8 +1807,9 @@ msgstr "Kesalahan DeInit RNG" msgid "RNG Init Error" msgstr "Kesalahan Init RNG" -#: ports/nrf/common-hal/busio/UART.c -msgid "RS485 Not yet supported on this device" +#: ports/atmel-samd/common-hal/busio/UART.c ports/cxd56/common-hal/busio/UART.c +#: ports/nrf/common-hal/busio/UART.c ports/stm/common-hal/busio/UART.c +msgid "RS485" msgstr "" #: ports/espressif/common-hal/busio/UART.c @@ -2089,21 +1817,10 @@ msgstr "" msgid "RS485 inversion specified when not in RS485 mode" msgstr "Pembalikan RS485 ditentukan saat tidak dalam mode RS485" -#: ports/cxd56/common-hal/rtc/RTC.c ports/espressif/common-hal/rtc/RTC.c -#: ports/mimxrt10xx/common-hal/rtc/RTC.c ports/nrf/common-hal/rtc/RTC.c -#: ports/raspberrypi/common-hal/rtc/RTC.c -msgid "RTC calibration is not supported on this board" -msgstr "Kalibrasi RTC tidak didukung pada board ini" - #: shared-bindings/alarm/time/TimeAlarm.c shared-bindings/time/__init__.c msgid "RTC is not supported on this board" msgstr "RTC tidak didukung di board ini" -#: ports/atmel-samd/common-hal/busio/UART.c ports/cxd56/common-hal/busio/UART.c -#: ports/stm/common-hal/busio/UART.c -msgid "RTS/CTS/RS485 Not yet supported on this device" -msgstr "RTS/CTS/RS485 Belum didukung pada perangkat ini" - #: ports/stm/common-hal/os/__init__.c msgid "Random number generation error" msgstr "Kesalahan pembuatan nomor acak" @@ -2121,10 +1838,14 @@ msgstr "sistem file (filesystem) bersifat Read-only" msgid "Read-only object" msgstr "Objek Read-only" -#: ports/espressif/bindings/espidf/__init__.c ports/espressif/esp_error.c +#: ports/espressif/common-hal/espidf/__init__.c ports/espressif/esp_error.c msgid "Received response was invalid" msgstr "" +#: supervisor/shared/bluetooth/bluetooth.c +msgid "Reconnecting" +msgstr "" + #: shared-bindings/displayio/EPaperDisplay.c msgid "Refresh too soon" msgstr "Segarkan terlalu cepat" @@ -2137,7 +1858,7 @@ msgstr "" msgid "Requested AES mode is unsupported" msgstr "Mode AES yang diminta tidak didukung" -#: ports/espressif/bindings/espidf/__init__.c ports/espressif/esp_error.c +#: ports/espressif/common-hal/espidf/__init__.c ports/espressif/esp_error.c msgid "Requested resource not found" msgstr "" @@ -2155,6 +1876,10 @@ msgstr "" msgid "SD card CSD format not supported" msgstr "" +#: ports/cxd56/common-hal/sdioio/SDCard.c +msgid "SDCard init" +msgstr "" + #: ports/stm/common-hal/sdioio/SDCard.c #, c-format msgid "SDIO GetCardInfo Error %d" @@ -2165,30 +1890,21 @@ msgstr "" msgid "SDIO Init Error %d" msgstr "" -#: ports/stm/common-hal/busio/SPI.c -msgid "SPI Init Error" -msgstr "Kesalahan Init SPI" - -#: ports/stm/common-hal/busio/SPI.c -msgid "SPI Re-initialization error" -msgstr "Kesalahan Inisialisasi ulang SPI" - #: ports/espressif/common-hal/busio/SPI.c msgid "SPI configuration failed" msgstr "" +#: ports/stm/common-hal/busio/SPI.c +msgid "SPI init error" +msgstr "" + #: ports/raspberrypi/common-hal/busio/SPI.c msgid "SPI peripheral in use" msgstr "" -#: shared-bindings/audiomixer/Mixer.c -msgid "Sample rate must be positive" -msgstr "Tingkat sampel harus positif" - -#: ports/atmel-samd/common-hal/audioio/AudioOut.c -#, c-format -msgid "Sample rate too high. It must be less than %d" -msgstr "Nilai sampel terlalu tinggi. Nilai harus kurang dari %d" +#: ports/stm/common-hal/busio/SPI.c +msgid "SPI re-init" +msgstr "" #: shared-bindings/is31fl3741/FrameBuffer.c msgid "Scale dimensions must divide by 3" @@ -2208,14 +1924,6 @@ msgstr "Serializer sedang digunakan" msgid "Server side context cannot have hostname" msgstr "" -#: ports/raspberrypi/bindings/rp2pio/StateMachine.c -msgid "Set pin count must be between 1 and 5" -msgstr "" - -#: ports/raspberrypi/bindings/rp2pio/StateMachine.c -msgid "Side set pin count must be between 1 and 5" -msgstr "" - #: ports/cxd56/common-hal/camera/Camera.c msgid "Size not supported" msgstr "" @@ -2236,6 +1944,7 @@ msgid "Slices not supported" msgstr "Potongan tidak didukung" #: ports/espressif/common-hal/socketpool/SocketPool.c +#: ports/raspberrypi/common-hal/socketpool/SocketPool.c msgid "SocketPool can only be used with wifi.radio" msgstr "" @@ -2251,10 +1960,6 @@ msgstr "" msgid "Splitting with sub-captures" msgstr "Memisahkan dengan menggunakan sub-captures" -#: shared-bindings/supervisor/__init__.c -msgid "Stack size must be at least 256" -msgstr "Ukuran stack minimal harus 256" - #: ports/raspberrypi/common-hal/audiopwmio/PWMAudioOut.c msgid "Stereo left must be on PWM channel A" msgstr "" @@ -2263,10 +1968,6 @@ msgstr "" msgid "Stereo right must be on PWM channel B" msgstr "" -#: shared-bindings/multiterminal/__init__.c -msgid "Stream missing readinto() or write() method." -msgstr "Aliran tidak menemukan metode readinto() atau write()." - #: ports/mimxrt10xx/common-hal/busio/UART.c ports/stm/common-hal/busio/UART.c msgid "Supply at least one UART pin" msgstr "Berikan setidaknya satu pin UART" @@ -2340,10 +2041,6 @@ msgstr "Tinggi tile harus persis membagi tinggi bitmap" msgid "Tile index out of bounds" msgstr "Indeks ubin di luar batas" -#: shared-bindings/displayio/TileGrid.c -msgid "Tile value out of bounds" -msgstr "Nilai ubin di luar batas" - #: shared-bindings/displayio/TileGrid.c msgid "Tile width must exactly divide bitmap width" msgstr "Lebar ubin harus persis membagi lebar bitmap" @@ -2363,6 +2060,9 @@ msgid "To exit, please reset the board without " msgstr "Untuk keluar, silahkan reset board tanpa " #: ports/atmel-samd/common-hal/audiobusio/I2SOut.c +msgid "Too many channels in sample" +msgstr "" + #: ports/raspberrypi/common-hal/audiobusio/I2SOut.c msgid "Too many channels in sample." msgstr "Terlalu banyak channel dalam sampel" @@ -2395,24 +2095,25 @@ msgid "Tuple or struct_time argument required" msgstr "Diperlukan argumen Tuple atau struct_time" #: ports/stm/common-hal/busio/UART.c -msgid "UART Buffer allocation error" -msgstr "Kesalahan alokasi Buffer UART" +msgid "UART de-init" +msgstr "" + +#: ports/atmel-samd/common-hal/busio/UART.c ports/cxd56/common-hal/busio/UART.c +#: ports/espressif/common-hal/busio/UART.c ports/stm/common-hal/busio/UART.c +msgid "UART init" +msgstr "" #: ports/stm/common-hal/busio/UART.c -msgid "UART De-init error" -msgstr "Kesalahan UART De-init" +msgid "UART re-init" +msgstr "" #: ports/stm/common-hal/busio/UART.c -msgid "UART Init Error" -msgstr "Kesalahan Init UART" +msgid "UART write" +msgstr "" -#: ports/stm/common-hal/busio/UART.c -msgid "UART Re-init error" -msgstr "Kesalahan Re-init UART" - -#: ports/stm/common-hal/busio/UART.c -msgid "UART write error" -msgstr "Kesalahan penulisan UART" +#: main.c +msgid "UID:" +msgstr "" #: shared-module/usb_hid/Device.c msgid "USB busy" @@ -2537,6 +2238,11 @@ msgstr "" msgid "Unknown system firmware error: %d" msgstr "" +#: ports/raspberrypi/common-hal/wifi/__init__.c +#, c-format +msgid "Unkown error code %d" +msgstr "" + #: shared-bindings/adafruit_pixelbuf/PixelBuf.c #, c-format msgid "Unmatched number of items on RHS (expected %d, got %d)." @@ -2550,12 +2256,6 @@ msgstr "" "Masalah yang tidak ditentukan. Bisa jadi permintaan pemasangan pada " "perangkat lain ditolak atau diabaikan." -#: ports/atmel-samd/common-hal/busio/I2C.c ports/cxd56/common-hal/busio/I2C.c -#: ports/espressif/common-hal/busio/UART.c -#: ports/raspberrypi/common-hal/busio/I2C.c ports/stm/common-hal/busio/I2C.c -msgid "Unsupported baudrate" -msgstr "Baudrate tidak didukung" - #: shared-bindings/bitmaptools/__init__.c msgid "Unsupported colorspace" msgstr "" @@ -2568,6 +2268,10 @@ msgstr "Tipe bus tampilan tidak didukung" msgid "Unsupported format" msgstr "Format tidak didukung" +#: shared-bindings/hashlib/__init__.c +msgid "Unsupported hash algorithm" +msgstr "" + #: ports/espressif/common-hal/dualbank/__init__.c msgid "Update Failed" msgstr "" @@ -2586,7 +2290,7 @@ msgstr "Panjang nilai != Panjang tetap yang dibutuhkan" msgid "Value length > max_length" msgstr "Panjang nilai > max_length" -#: ports/espressif/bindings/espidf/__init__.c ports/espressif/esp_error.c +#: ports/espressif/common-hal/espidf/__init__.c ports/espressif/esp_error.c msgid "Version was invalid" msgstr "" @@ -2616,10 +2320,6 @@ msgstr "" msgid "WatchDogTimer.timeout must be greater than 0" msgstr "" -#: supervisor/shared/safe_mode.c -msgid "Watchdog timer expired." -msgstr "" - #: py/builtinhelp.c #, c-format msgid "" @@ -2630,8 +2330,8 @@ msgid "" "To list built-in modules type `help(\"modules\")`.\n" msgstr "" -#: shared-bindings/wifi/Radio.c -msgid "WiFi password must be between 8 and 63 characters" +#: supervisor/shared/web_workflow/web_workflow.c +msgid "Wi-Fi: " msgstr "" #: main.c @@ -2672,11 +2372,7 @@ msgstr "__new__ arg harus berupa user-type" msgid "a bytes-like object is required" msgstr "sebuah objek menyerupai byte (bytes-like) dibutuhkan" -#: shared-bindings/i2cperipheral/I2CPeripheral.c -msgid "address out of bounds" -msgstr "alamat di luar batas" - -#: shared-bindings/i2cperipheral/I2CPeripheral.c +#: shared-bindings/i2ctarget/I2CTarget.c msgid "addresses is empty" msgstr "alamatnya kosong" @@ -2725,6 +2421,10 @@ msgstr "argumen harus berupa ndarrays" msgid "array and index length must be equal" msgstr "" +#: extmod/ulab/code/numpy/io/io.c +msgid "array has too many dimensions" +msgstr "" + #: py/objarray.c shared-bindings/alarm/SleepMemory.c #: shared-bindings/nvm/ByteArray.c msgid "array/bytes required on right side" @@ -2786,10 +2486,6 @@ msgstr "" msgid "bits must be 32 or less" msgstr "" -#: shared-bindings/busio/UART.c -msgid "bits must be in range 5 to 9" -msgstr "" - #: shared-bindings/audiomixer/Mixer.c msgid "bits_per_sample must be 8 or 16" msgstr "" @@ -2827,11 +2523,6 @@ msgstr "" msgid "byteorder is not a string" msgstr "" -#: ports/atmel-samd/common-hal/busio/UART.c -#: ports/espressif/common-hal/busio/UART.c -msgid "bytes > 8 bits not supported" -msgstr "byte > 8 bit tidak didukung" - #: py/objarray.c msgid "bytes length not a multiple of item size" msgstr "" @@ -2840,7 +2531,7 @@ msgstr "" msgid "bytes value out of range" msgstr "" -#: ports/atmel-samd/bindings/samd/Clock.c ports/atmel-samd/common-hal/rtc/RTC.c +#: ports/atmel-samd/bindings/samd/Clock.c msgid "calibration is out of range" msgstr "kalibrasi keluar dari jangkauan" @@ -2848,12 +2539,9 @@ msgstr "kalibrasi keluar dari jangkauan" msgid "calibration is read only" msgstr "kalibrasi adalah read only" -#: ports/atmel-samd/common-hal/rtc/RTC.c -msgid "calibration value out of range +/-127" -msgstr "nilai kalibrasi keluar dari jangkauan +/-127" - +#: shared-module/vectorio/Circle.c shared-module/vectorio/Polygon.c #: shared-module/vectorio/Rectangle.c -msgid "can only be registered in one parent" +msgid "can only have one parent" msgstr "" #: py/emitinlinethumb.c @@ -2876,8 +2564,7 @@ msgstr "tidak dapat menetapkan ke ekspresi" msgid "can't cancel self" msgstr "" -#: py/obj.c py/objint.c shared-bindings/i2cperipheral/I2CPeripheral.c -#: shared-module/adafruit_pixelbuf/PixelBuf.c +#: py/obj.c py/objint.c shared-module/adafruit_pixelbuf/PixelBuf.c msgid "can't convert %q to %q" msgstr "" @@ -3024,6 +2711,10 @@ msgstr "" msgid "casting" msgstr "" +#: ports/stm/common-hal/pwmio/PWMOut.c +msgid "channel re-init" +msgstr "" + #: shared-bindings/_stage/Text.c msgid "chars buffer too small" msgstr "" @@ -3036,10 +2727,6 @@ msgstr "" msgid "chr() arg not in range(256)" msgstr "" -#: shared-module/vectorio/Circle.c -msgid "circle can only be registered in one parent" -msgstr "" - #: shared-bindings/bitmaptools/__init__.c msgid "clip point must be (x,y) tuple" msgstr "" @@ -3064,10 +2751,6 @@ msgstr "" msgid "color must be between 0x000000 and 0xffffff" msgstr "" -#: shared-bindings/displayio/ColorConverter.c -msgid "color should be an int" -msgstr "" - #: py/emitnative.c msgid "comparison of int and uint" msgstr "" @@ -3104,6 +2787,10 @@ msgstr "" msgid "convolve arguments must not be empty" msgstr "" +#: extmod/ulab/code/numpy/io/io.c +msgid "corrupted file" +msgstr "" + #: extmod/ulab/code/numpy/poly.c msgid "could not invert Vandermonde matrix" msgstr "" @@ -3154,10 +2841,6 @@ msgstr "" msgid "destination buffer must be an array of type 'H' for bit_depth = 16" msgstr "" -#: shared-bindings/audiobusio/PDMIn.c -msgid "destination_length must be an int >= 0" -msgstr "" - #: py/objdict.c msgid "dict update sequence has wrong length" msgstr "" @@ -3195,6 +2878,10 @@ msgstr "" msgid "empty" msgstr "" +#: extmod/ulab/code/numpy/io/io.c +msgid "empty file" +msgstr "" + #: extmod/moduasyncio.c extmod/moduheapq.c extmod/modutimeq.c msgid "empty heap" msgstr "heap kosong" @@ -3211,10 +2898,6 @@ msgstr "" msgid "end of format while looking for conversion specifier" msgstr "" -#: shared-bindings/displayio/Shape.c -msgid "end_x should be an int" -msgstr "" - #: shared-bindings/alarm/time/TimeAlarm.c msgid "epoch_time not supported on this board" msgstr "" @@ -3224,6 +2907,12 @@ msgstr "" msgid "error = 0x%08lX" msgstr "error = 0x%08lX" +#: ports/espressif/common-hal/esp32_camera/Camera.c +msgid "" +"esp32_camera.Camera requires reserved PSRAM to be configured. See the " +"documentation for instructions." +msgstr "" + #: py/runtime.c msgid "exceptions must derive from BaseException" msgstr "" @@ -3298,7 +2987,7 @@ msgstr "" msgid "first argument must be a tuple of ndarrays" msgstr "" -#: extmod/ulab/code/numpy/vector.c +#: extmod/ulab/code/numpy/transform.c extmod/ulab/code/numpy/vector.c msgid "first argument must be an ndarray" msgstr "" @@ -3446,7 +3135,7 @@ msgstr "" msgid "incorrect padding" msgstr "lapisan (padding) tidak benar" -#: extmod/ulab/code/ndarray.c +#: extmod/ulab/code/ndarray.c extmod/ulab/code/numpy/transform.c msgid "index is out of bounds" msgstr "" @@ -3464,6 +3153,10 @@ msgstr "" msgid "indices must be integers, slices, or Boolean lists" msgstr "" +#: ports/espressif/common-hal/busio/I2C.c +msgid "init I2C" +msgstr "" + #: extmod/ulab/code/scipy/optimize/optimize.c msgid "initial values must be iterable" msgstr "" @@ -3509,6 +3202,10 @@ msgstr "" msgid "input matrix is singular" msgstr "" +#: extmod/ulab/code/numpy/create.c +msgid "input must be 1- or 2-d" +msgstr "" + #: extmod/ulab/code/numpy/carray/carray.c msgid "input must be a 1D ndarray" msgstr "" @@ -3517,11 +3214,7 @@ msgstr "" msgid "input must be a dense ndarray" msgstr "" -#: extmod/ulab/code/numpy/create.c -msgid "input must be a tensor of rank 2" -msgstr "" - -#: extmod/ulab/code/numpy/create.c extmod/ulab/code/user/user.c +#: extmod/ulab/code/user/user.c msgid "input must be an ndarray" msgstr "" @@ -3571,6 +3264,10 @@ msgstr "" msgid "invalid bits_per_pixel %d, must be, 1, 2, 4, 8, 16, 24, or 32" msgstr "" +#: ports/raspberrypi/common-hal/ssl/SSLSocket.c +msgid "invalid cert" +msgstr "cert tidak valid" + #: shared-bindings/bitmaptools/__init__.c #, c-format msgid "invalid element size %d for bits_per_pixel %d\n" @@ -3597,10 +3294,18 @@ msgstr "" msgid "invalid hostname" msgstr "" +#: ports/raspberrypi/common-hal/ssl/SSLSocket.c +msgid "invalid key" +msgstr "key tidak valid" + #: py/compile.c msgid "invalid micropython decorator" msgstr "micropython decorator tidak valid" +#: ports/espressif/common-hal/esp32_camera/Camera.c +msgid "invalid setting" +msgstr "" + #: shared-bindings/random/__init__.c msgid "invalid step" msgstr "" @@ -3714,10 +3419,6 @@ msgstr "" msgid "matrix is not positive definite" msgstr "" -#: ports/espressif/common-hal/wifi/Radio.c -msgid "max_connections must be between 0 and 10" -msgstr "" - #: ports/espressif/common-hal/_bleio/Descriptor.c #: ports/nrf/common-hal/_bleio/Characteristic.c #: ports/nrf/common-hal/_bleio/Descriptor.c @@ -3725,12 +3426,8 @@ msgstr "" msgid "max_length must be 0-%d when fixed_length is %s" msgstr "" -#: shared-bindings/_bleio/Characteristic.c shared-bindings/_bleio/Descriptor.c -msgid "max_length must be >= 0" -msgstr "" - #: extmod/ulab/code/ndarray.c -msgid "maximum number of dimensions is 4" +msgid "maximum number of dimensions is " msgstr "" #: py/runtime.c @@ -3864,7 +3561,7 @@ msgstr "" msgid "no response from SD card" msgstr "" -#: py/objobject.c py/runtime.c +#: ports/espressif/common-hal/esp32_camera/Camera.c py/objobject.c py/runtime.c msgid "no such attribute" msgstr "" @@ -3975,7 +3672,11 @@ msgstr "" msgid "odd-length string" msgstr "panjang data string memiliki keganjilan (odd-length)" -#: extmod/ulab/code/numpy/create.c extmod/ulab/code/utils/utils.c +#: supervisor/shared/web_workflow/web_workflow.c +msgid "off" +msgstr "" + +#: extmod/ulab/code/utils/utils.c msgid "offset is too large" msgstr "" @@ -4072,10 +3773,6 @@ msgstr "" msgid "palette must be 32 bytes long" msgstr "" -#: shared-bindings/displayio/Palette.c -msgid "palette_index should be an int" -msgstr "" - #: py/emitinlinextensa.c msgid "parameters must be registers in sequence a2 to a5" msgstr "" @@ -4100,10 +3797,6 @@ msgstr "" msgid "poll on file not available on win32" msgstr "" -#: shared-module/vectorio/Polygon.c -msgid "polygon can only be registered in one parent" -msgstr "" - #: ports/espressif/common-hal/pulseio/PulseIn.c msgid "pop from an empty PulseIn" msgstr "Muncul dari PulseIn yang kosong" @@ -4129,7 +3822,23 @@ msgstr "" msgid "pow() with 3 arguments requires integers" msgstr "" +#: ports/espressif/boards/adafruit_qtpy_esp32_pico/mpconfigboard.h +msgid "pressing BOOT button at start up.\n" +msgstr "" + +#: ports/espressif/boards/adafruit_feather_esp32_v2/mpconfigboard.h +msgid "pressing SW38 button at start up.\n" +msgstr "" + +#: ports/espressif/boards/hardkernel_odroid_go/mpconfigboard.h +msgid "pressing VOLUME button at start up.\n" +msgstr "" + #: ports/espressif/boards/adafruit_qtpy_esp32c3/mpconfigboard.h +#: ports/espressif/boards/beetle-esp32-c3/mpconfigboard.h +#: ports/espressif/boards/espressif_esp32s2_devkitc_1_n8r2/mpconfigboard.h +#: ports/espressif/boards/lolin_c3_mini/mpconfigboard.h +#: ports/espressif/boards/microdev_micro_c3/mpconfigboard.h #: supervisor/shared/safe_mode.c msgid "pressing boot button at start up.\n" msgstr "" @@ -4150,14 +3859,6 @@ msgstr "" msgid "pull masks conflict with direction masks" msgstr "" -#: ports/raspberrypi/bindings/rp2pio/StateMachine.c -msgid "pull_threshold must be between 1 and 32" -msgstr "" - -#: ports/raspberrypi/bindings/rp2pio/StateMachine.c -msgid "push_threshold must be between 1 and 32" -msgstr "" - #: extmod/modutimeq.c msgid "queue overflow" msgstr "antrian meluap (overflow)" @@ -4209,12 +3910,6 @@ msgstr "" msgid "rsplit(None,n)" msgstr "" -#: shared-bindings/audiocore/RawSample.c -msgid "" -"sample_source buffer must be a bytearray or array of type 'h', 'H', 'b' or " -"'B'" -msgstr "" - #: ports/atmel-samd/common-hal/audiobusio/PDMIn.c #: ports/raspberrypi/common-hal/audiobusio/PDMIn.c msgid "sampling rate out of range" @@ -4312,26 +4007,14 @@ msgstr "" msgid "source_bitmap must have value_count of 8" msgstr "" -#: shared-bindings/wifi/Radio.c -msgid "ssid can't be more than 32 bytes" -msgstr "" - #: py/objstr.c msgid "start/end indices" msgstr "" -#: shared-bindings/displayio/Shape.c -msgid "start_x should be an int" -msgstr "" - #: shared-bindings/random/__init__.c msgid "step must be non-zero" msgstr "" -#: shared-bindings/busio/UART.c -msgid "stop must be 1 or 2" -msgstr "" - #: shared-bindings/random/__init__.c msgid "stop not reachable from start" msgstr "" @@ -4380,10 +4063,6 @@ msgstr "sintaksis error pada pendeskripsi uctypes" msgid "threshold must be in the range 0-65536" msgstr "" -#: shared-bindings/rgbmatrix/RGBMatrix.c -msgid "tile must be greater than zero" -msgstr "" - #: shared-bindings/time/__init__.c msgid "time.struct_time() takes a 9-sequence" msgstr "" @@ -4403,10 +4082,6 @@ msgstr "" msgid "timeout must be < 655.35 secs" msgstr "" -#: shared-bindings/_bleio/CharacteristicBuffer.c -msgid "timeout must be >= 0.0" -msgstr "waktu habis harus >= 0,0" - #: shared-module/sdcardio/SDCard.c msgid "timeout waiting for v1 card" msgstr "" @@ -4415,6 +4090,10 @@ msgstr "" msgid "timeout waiting for v2 card" msgstr "" +#: ports/stm/common-hal/pwmio/PWMOut.c +msgid "timer re-init" +msgstr "" + #: shared-bindings/time/__init__.c msgid "timestamp out of range for platform time_t" msgstr "" @@ -4480,14 +4159,10 @@ msgstr "" msgid "type is not an acceptable base type" msgstr "" -#: py/runtime.c +#: py/objgenerator.c py/runtime.c msgid "type object '%q' has no attribute '%q'" msgstr "" -#: py/objgenerator.c -msgid "type object 'generator' has no attribute '__await__'" -msgstr "" - #: py/objtype.c msgid "type takes 1 or 3 arguments" msgstr "" @@ -4546,7 +4221,6 @@ msgid "unreadable attribute" msgstr "" #: shared-bindings/displayio/TileGrid.c shared-bindings/vectorio/VectorShape.c -#: shared-module/vectorio/Polygon.c shared-module/vectorio/VectorShape.c msgid "unsupported %q type" msgstr "" @@ -4585,6 +4259,14 @@ msgstr "" msgid "unsupported types for %q: '%q', '%q'" msgstr "" +#: extmod/ulab/code/numpy/io/io.c +msgid "usecols is too high" +msgstr "" + +#: extmod/ulab/code/numpy/io/io.c +msgid "usecols keyword must be specified" +msgstr "" + #: py/objint.c #, c-format msgid "value must fit in %d byte(s)" @@ -4606,20 +4288,19 @@ msgstr "" msgid "watchdog timeout must be greater than 0" msgstr "" -#: shared-bindings/bitops/__init__.c -#, c-format -msgid "width must be from 2 to 8 (inclusive), not %d" -msgstr "" - #: shared-bindings/is31fl3741/FrameBuffer.c -#: shared-bindings/rgbmatrix/RGBMatrix.c msgid "width must be greater than zero" msgstr "" #: ports/espressif/common-hal/wifi/Radio.c +#: ports/raspberrypi/common-hal/wifi/Radio.c msgid "wifi is not enabled" msgstr "wifi tidak diaktifkan" +#: ports/raspberrypi/common-hal/wifi/Monitor.c +msgid "wifi.Monitor not available" +msgstr "" + #: shared-bindings/_bleio/Adapter.c msgid "window must be <= interval" msgstr "jendela harus <= interval" @@ -4632,7 +4313,17 @@ msgstr "indeks sumbu salah" msgid "wrong axis specified" msgstr "sumbu yang ditentukan salah" -#: extmod/ulab/code/numpy/compare.c extmod/ulab/code/numpy/vector.c +#: extmod/ulab/code/numpy/io/io.c +msgid "wrong dtype" +msgstr "" + +#: extmod/ulab/code/numpy/transform.c +msgid "wrong index type" +msgstr "" + +#: extmod/ulab/code/numpy/compare.c extmod/ulab/code/numpy/create.c +#: extmod/ulab/code/numpy/io/io.c extmod/ulab/code/numpy/transform.c +#: extmod/ulab/code/numpy/vector.c msgid "wrong input type" msgstr "tipe input salah" @@ -4640,6 +4331,10 @@ msgstr "tipe input salah" msgid "wrong length of condition array" msgstr "" +#: extmod/ulab/code/numpy/transform.c +msgid "wrong length of index array" +msgstr "" + #: extmod/ulab/code/numpy/create.c py/objarray.c py/objstr.c msgid "wrong number of arguments" msgstr "jumlah argumen salah" @@ -4660,10 +4355,6 @@ msgstr "nilai x di luar batas" msgid "xTaskCreate failed" msgstr "xTaskCreate gagal" -#: shared-bindings/displayio/Shape.c -msgid "y should be an int" -msgstr "y harus menjadi int" - #: shared-module/displayio/Shape.c msgid "y value out of bounds" msgstr "Nilai y di luar batas" @@ -4684,6 +4375,261 @@ msgstr "zi harus berjenis float" msgid "zi must be of shape (n_section, 2)" msgstr "Zi harus berbentuk (n_section, 2)" +#~ msgid "Stream missing readinto() or write() method." +#~ msgstr "Aliran tidak menemukan metode readinto() atau write()." + +#~ msgid "%q must be >= 0" +#~ msgstr "%q harus >= 0" + +#~ msgid "%q must be >= 1" +#~ msgstr "%q harus >= 1" + +#~ msgid "address out of bounds" +#~ msgstr "alamat di luar batas" + +#~ msgid "y should be an int" +#~ msgstr "y harus menjadi int" + +#~ msgid "%q must be a tuple of length 2" +#~ msgstr "%q harus berupa tuple dengan panjang 2" + +#~ msgid "%q must be between %d and %d" +#~ msgstr "%q harus antara %d dan %d" + +#~ msgid "%q should be an int" +#~ msgstr "%q harus berupa int" + +#~ msgid "Address type out of range" +#~ msgstr "Jenis alamat di luar batas" + +#~ msgid "AnalogIn not supported on given pin" +#~ msgstr "AnalogIn tidak didukung pada pin yang diberikan" + +#~ msgid "AnalogOut functionality not supported" +#~ msgstr "fungsionalitas AnalogOut tidak didukung" + +#~ msgid "AnalogOut is only 16 bits. Value must be less than 65536." +#~ msgstr "AnalogOut hanya 16 bit. Nilai harus kurang dari 65536." + +#~ msgid "AnalogOut not supported on given pin" +#~ msgstr "pin yang dipakai tidak mendukung AnalogOut" + +#, c-format +#~ msgid "Buffer incorrect size. Should be %d bytes." +#~ msgstr "Ukuran buffer salah. Seharusnya %d byte." + +#~ msgid "Buffer must be at least length 1" +#~ msgstr "Penyangga harus memiliki panjang setidaknya 1" + +#~ msgid "Bytes must be between 0 and 255." +#~ msgstr "Bytes harus di antara 0 dan 255." + +#~ msgid "Cannot output both channels on the same pin" +#~ msgstr "" +#~ "Tidak dapat menggunakan output di kedua channel dengan menggunakan pin " +#~ "yang sama" + +#~ msgid "Cannot read without MISO pin." +#~ msgstr "Tidak dapat membaca tanpa pin MISO." + +#~ msgid "Cannot reset into bootloader because no bootloader is present." +#~ msgstr "" +#~ "Tidak dapat melakukan reset ke bootloader karena tidak ada bootloader " +#~ "yang terisi" + +#~ msgid "Cannot transfer without MOSI and MISO pins." +#~ msgstr "Tidak dapat transfer tanpa pin MOSI dan MISO." + +#~ msgid "Cannot write without MOSI pin." +#~ msgstr "Tidak dapat menulis tanpa pin MOSI." + +#~ msgid "Clock pin init failed." +#~ msgstr "Init pin clock gagal." + +#~ msgid "Command must be an int between 0 and 255" +#~ msgstr "Perintah harus berupa int di antara 0 dan 255" + +#~ msgid "Could not initialize UART" +#~ msgstr "Tidak dapat menginisialisasi UART" + +#~ msgid "Could not re-init channel" +#~ msgstr "Tidak dapat menginisialisasi ulang kanal" + +#~ msgid "Could not re-init timer" +#~ msgstr "Tidak dapat menginisialisasi ulang timer" + +#~ msgid "Could not restart PWM" +#~ msgstr "Tidak dapat memulai ulang PWM" + +#~ msgid "Couldn't allocate first buffer" +#~ msgstr "Tidak dapat mengalokasikan penyangga pertama" + +#~ msgid "Couldn't allocate input buffer" +#~ msgstr "Tidak dapat mengalokasikan penyangga masukan" + +#~ msgid "Couldn't allocate second buffer" +#~ msgstr "Tidak dapat mengalokasikan penyangga kedua" + +#~ msgid "DigitalInOut not supported on given pin" +#~ msgstr "DigitalInOut tidak didukung pada pin yang diberikan" + +#, c-format +#~ msgid "Expected tuple of length %d, got %d" +#~ msgstr "Diharapkan tuple dengan panjang %d, didapatkan %d" + +#~ msgid "Failed to allocate RX buffer" +#~ msgstr "Gagal untuk mengalokasikan buffer RX" + +#, c-format +#~ msgid "Failed to allocate RX buffer of %d bytes" +#~ msgstr "Gagal untuk megalokasikan buffer RX dari %d byte" + +#~ msgid "I2C Init Error" +#~ msgstr "Gagal Inisialisasi I2C" + +#~ msgid "Invalid BMP file" +#~ msgstr "File BMP tidak valid" + +#~ msgid "Invalid DAC pin supplied" +#~ msgstr "Pin DAC yang diberikan tidak valid" + +#~ msgid "Invalid PWM frequency" +#~ msgstr "Frekuensi PWM tidak valid" + +#~ msgid "Invalid buffer size" +#~ msgstr "Ukuran buffer tidak valid" + +#~ msgid "Invalid byteorder string" +#~ msgstr "String byteorder tidak valid" + +#~ msgid "Invalid capture period. Valid range: 1 - 500" +#~ msgstr "Periode penangkapan tidak valid. Kisaran yang valid: 1 - 500" + +#~ msgid "Invalid channel count" +#~ msgstr "Jumlah kanal tidak valid" + +#~ msgid "Invalid direction." +#~ msgstr "Arah tidak valid." + +#~ msgid "Invalid file" +#~ msgstr "File tidak valid" + +#~ msgid "Invalid number of bits" +#~ msgstr "Jumlah bit tidak valid" + +#~ msgid "Invalid phase" +#~ msgstr "Fase tidak valid" + +#~ msgid "Invalid pin" +#~ msgstr "Pin tidak valid" + +#~ msgid "Invalid pin for left channel" +#~ msgstr "Pin untuk channel kiri tidak valid" + +#~ msgid "Invalid pin for right channel" +#~ msgstr "Pin untuk channel kanan tidak valid" + +#~ msgid "Invalid polarity" +#~ msgstr "Polaritas tidak valid" + +#~ msgid "Invalid properties" +#~ msgstr "Properti tidak valid" + +#~ msgid "Invalid run mode." +#~ msgstr "Mode operasi tidak valid." + +#~ msgid "Invalid security_mode" +#~ msgstr "security_mode tidak valid" + +#~ msgid "Invalid voice" +#~ msgstr "Suara tidak valid" + +#~ msgid "Invalid voice count" +#~ msgstr "Hitungan suara tidak valid" + +#~ msgid "Invalid wave file" +#~ msgstr "File wave tidak valid" + +#~ msgid "Invalid word/bit length" +#~ msgstr "Panjang kata/bit tidak valid" + +#~ msgid "Layer already in a group." +#~ msgstr "Layer sudah ada dalam grup." + +#~ msgid "Layer must be a Group or TileGrid subclass." +#~ msgstr "Layer harus sebuah Grup atau subklas dari TileGrid." + +#~ msgid "MISO pin init failed." +#~ msgstr "Pin MISO gagal inisialisasi." + +#~ msgid "MOSI pin init failed." +#~ msgstr "Pin MOSI gagal inisialisasi." + +#~ msgid "No hardware support on clk pin" +#~ msgstr "Tidak ada dukungan perangkat keras pada pin clk" + +#~ msgid "No hardware support on pin" +#~ msgstr "Tidak ada dukungan hardware untuk pin" + +#~ msgid "" +#~ "PWM duty_cycle must be between 0 and 65535 inclusive (16 bit resolution)" +#~ msgstr "PWM duty_cycle harus antara 0 dan 65535 inklusif (resolusi 16 bit)" + +#~ msgid "Pin does not have ADC capabilities" +#~ msgstr "Pin tidak mempunya kemampuan untuk ADC (Analog Digital Converter)" + +#~ msgid "RTC calibration is not supported on this board" +#~ msgstr "Kalibrasi RTC tidak didukung pada board ini" + +#~ msgid "RTS/CTS/RS485 Not yet supported on this device" +#~ msgstr "RTS/CTS/RS485 Belum didukung pada perangkat ini" + +#~ msgid "SPI Init Error" +#~ msgstr "Kesalahan Init SPI" + +#~ msgid "SPI Re-initialization error" +#~ msgstr "Kesalahan Inisialisasi ulang SPI" + +#~ msgid "Sample rate must be positive" +#~ msgstr "Tingkat sampel harus positif" + +#, c-format +#~ msgid "Sample rate too high. It must be less than %d" +#~ msgstr "Nilai sampel terlalu tinggi. Nilai harus kurang dari %d" + +#~ msgid "Stack size must be at least 256" +#~ msgstr "Ukuran stack minimal harus 256" + +#~ msgid "Tile value out of bounds" +#~ msgstr "Nilai ubin di luar batas" + +#~ msgid "UART Buffer allocation error" +#~ msgstr "Kesalahan alokasi Buffer UART" + +#~ msgid "UART De-init error" +#~ msgstr "Kesalahan UART De-init" + +#~ msgid "UART Init Error" +#~ msgstr "Kesalahan Init UART" + +#~ msgid "UART Re-init error" +#~ msgstr "Kesalahan Re-init UART" + +#~ msgid "UART write error" +#~ msgstr "Kesalahan penulisan UART" + +#~ msgid "Unsupported baudrate" +#~ msgstr "Baudrate tidak didukung" + +#~ msgid "bytes > 8 bits not supported" +#~ msgstr "byte > 8 bit tidak didukung" + +#~ msgid "calibration value out of range +/-127" +#~ msgstr "nilai kalibrasi keluar dari jangkauan +/-127" + +#~ msgid "timeout must be >= 0.0" +#~ msgstr "waktu habis harus >= 0,0" + #~ msgid "Unsupported operation" #~ msgstr "Operasi yang tidak didukung" @@ -4839,12 +4785,6 @@ msgstr "Zi harus berbentuk (n_section, 2)" #~ msgid "Corrupt raw code" #~ msgstr "Kode raw rusak" -#~ msgid "invalid cert" -#~ msgstr "cert tidak valid" - -#~ msgid "invalid key" -#~ msgstr "key tidak valid" - #~ msgid "Viper functions don't currently support more than 4 arguments" #~ msgstr "Fungsi Viper saat ini tidak mendukung lebih dari 4 argumen" diff --git a/locale/circuitpython.pot b/locale/circuitpython.pot index 9f4bf97a73..b6e0c7468c 100644 --- a/locale/circuitpython.pot +++ b/locale/circuitpython.pot @@ -60,16 +60,38 @@ msgstr "" msgid "%%c requires int or char" msgstr "" +#: main.c +#, c-format +msgid "%02X" +msgstr "" + #: shared-bindings/rgbmatrix/RGBMatrix.c #, c-format msgid "" "%d address pins, %d rgb pins and %d tiles indicate a height of %d, not %d" msgstr "" +#: ports/atmel-samd/common-hal/alarm/__init__.c +#: ports/cxd56/common-hal/analogio/AnalogOut.c ports/cxd56/common-hal/rtc/RTC.c +#: ports/espressif/common-hal/rtc/RTC.c +#: ports/mimxrt10xx/common-hal/analogio/AnalogOut.c +#: ports/mimxrt10xx/common-hal/rtc/RTC.c ports/nrf/common-hal/alarm/__init__.c +#: ports/nrf/common-hal/analogio/AnalogOut.c ports/nrf/common-hal/rtc/RTC.c +#: ports/raspberrypi/common-hal/alarm/__init__.c +#: ports/raspberrypi/common-hal/analogio/AnalogOut.c +#: ports/raspberrypi/common-hal/rtc/RTC.c ports/stm/common-hal/alarm/__init__.c +#: ports/stm/common-hal/rtc/RTC.c +msgid "%q" +msgstr "" + #: shared-bindings/microcontroller/Pin.c msgid "%q and %q contain duplicate pins" msgstr "" +#: ports/atmel-samd/common-hal/audioio/AudioOut.c +msgid "%q and %q must be different" +msgstr "" + #: shared-bindings/microcontroller/Pin.c msgid "%q contains duplicate pins" msgstr "" @@ -78,16 +100,12 @@ msgstr "" msgid "%q failure: %d" msgstr "" +#: shared-bindings/digitalio/DigitalInOut.c #: shared-bindings/microcontroller/Pin.c msgid "%q in use" msgstr "" -#: ports/atmel-samd/common-hal/pulseio/PulseIn.c -#: ports/cxd56/common-hal/pulseio/PulseIn.c -#: ports/nrf/common-hal/pulseio/PulseIn.c -#: ports/raspberrypi/common-hal/pulseio/PulseIn.c -#: ports/stm/common-hal/pulseio/PulseIn.c py/obj.c py/objstr.c -#: py/objstrunicode.c +#: py/obj.c py/objstr.c py/objstrunicode.c msgid "%q index out of range" msgstr "" @@ -95,14 +113,34 @@ msgstr "" msgid "%q indices must be integers, not %s" msgstr "" +#: shared-module/bitbangio/SPI.c +msgid "%q init failed" +msgstr "" + +#: py/argcheck.c +msgid "%q length must be %d" +msgstr "" + #: py/argcheck.c msgid "%q length must be %d-%d" msgstr "" -#: shared-bindings/busio/I2C.c shared-bindings/usb_hid/Device.c +#: py/argcheck.c +msgid "%q length must be <= %d" +msgstr "" + +#: py/argcheck.c +msgid "%q length must be >= %d" +msgstr "" + +#: shared-bindings/busio/I2C.c msgid "%q length must be >= 1" msgstr "" +#: py/argcheck.c +msgid "%q must be %d" +msgstr "" + #: py/argcheck.c msgid "%q must be %d-%d" msgstr "" @@ -119,29 +157,17 @@ msgstr "" msgid "%q must be >= %d" msgstr "" -#: py/argcheck.c shared-bindings/memorymonitor/AllocationAlarm.c -msgid "%q must be >= 0" -msgstr "" - -#: shared-bindings/_bleio/CharacteristicBuffer.c -#: shared-bindings/_bleio/PacketBuffer.c shared-bindings/displayio/Group.c -#: shared-bindings/displayio/Shape.c -#: shared-bindings/memorymonitor/AllocationAlarm.c -#: shared-bindings/vectorio/Circle.c shared-bindings/vectorio/Rectangle.c -msgid "%q must be >= 1" +#: shared-bindings/analogbufio/BufferedIn.c +#: shared-bindings/audiocore/RawSample.c +msgid "%q must be a bytearray or array of type 'h', 'H', 'b', or 'B'" msgstr "" #: py/argcheck.c msgid "%q must be a string" msgstr "" -#: shared-module/vectorio/Polygon.c -msgid "%q must be a tuple of length 2" -msgstr "" - -#: ports/espressif/common-hal/imagecapture/ParallelImageCapture.c -#: shared-module/vectorio/VectorShape.c -msgid "%q must be between %d and %d" +#: py/argcheck.c +msgid "%q must be an int" msgstr "" #: py/argcheck.c @@ -160,7 +186,11 @@ msgstr "" msgid "%q out of bounds" msgstr "" +#: ports/atmel-samd/common-hal/pulseio/PulseIn.c +#: ports/cxd56/common-hal/pulseio/PulseIn.c +#: ports/nrf/common-hal/pulseio/PulseIn.c #: ports/raspberrypi/common-hal/rp2pio/StateMachine.c +#: ports/stm/common-hal/pulseio/PulseIn.c py/argcheck.c #: shared-bindings/canio/Match.c msgid "%q out of range" msgstr "" @@ -169,10 +199,6 @@ msgstr "" msgid "%q pin invalid" msgstr "" -#: shared-bindings/fontio/BuiltinFont.c -msgid "%q should be an int" -msgstr "" - #: shared-bindings/usb_hid/Device.c msgid "%q with a report ID of 0 must be of length 1" msgstr "" @@ -185,7 +211,11 @@ msgstr "" msgid "%q, %q, and %q must all be the same length" msgstr "" -#: ports/espressif/bindings/espidf/__init__.c ports/espressif/esp_error.c +#: py/objint.c +msgid "%q=%q" +msgstr "" + +#: ports/espressif/common-hal/espidf/__init__.c ports/espressif/esp_error.c #, c-format msgid "%s error 0x%x" msgstr "" @@ -270,7 +300,7 @@ msgstr "" msgid "'%s' object doesn't support item deletion" msgstr "" -#: py/runtime.c +#: ports/raspberrypi/common-hal/wifi/Radio.c py/runtime.c msgid "'%s' object has no attribute '%q'" msgstr "" @@ -335,10 +365,6 @@ msgstr "" msgid "'yield' outside function" msgstr "" -#: shared-module/vectorio/VectorShape.c -msgid "(x,y) integers required" -msgstr "" - #: py/compile.c msgid "*x must be assignment target" msgstr "" @@ -374,16 +400,12 @@ msgstr "" msgid "Address must be %d bytes long" msgstr "" -#: shared-bindings/_bleio/Address.c -msgid "Address type out of range" -msgstr "" - #: ports/espressif/common-hal/canio/CAN.c msgid "All CAN peripherals are in use" msgstr "" #: ports/espressif/common-hal/busio/I2C.c -#: ports/espressif/common-hal/i2cperipheral/I2CPeripheral.c +#: ports/espressif/common-hal/i2ctarget/I2CTarget.c #: ports/nrf/common-hal/busio/I2C.c msgid "All I2C peripherals are in use" msgstr "" @@ -420,7 +442,6 @@ msgstr "" msgid "All event channels in use" msgstr "" -#: ports/raspberrypi/common-hal/pulseio/PulseIn.c #: ports/raspberrypi/common-hal/rp2pio/StateMachine.c msgid "All state machines in use" msgstr "" @@ -465,28 +486,10 @@ msgid "Already running" msgstr "" #: ports/espressif/common-hal/wifi/Radio.c +#: ports/raspberrypi/common-hal/wifi/Radio.c msgid "Already scanning for wifi networks" msgstr "" -#: ports/cxd56/common-hal/analogio/AnalogIn.c -msgid "AnalogIn not supported on given pin" -msgstr "" - -#: ports/cxd56/common-hal/analogio/AnalogOut.c -#: ports/mimxrt10xx/common-hal/analogio/AnalogOut.c -#: ports/nrf/common-hal/analogio/AnalogOut.c -#: ports/raspberrypi/common-hal/analogio/AnalogOut.c -msgid "AnalogOut functionality not supported" -msgstr "" - -#: shared-bindings/analogio/AnalogOut.c -msgid "AnalogOut is only 16 bits. Value must be less than 65536." -msgstr "" - -#: ports/atmel-samd/common-hal/analogio/AnalogOut.c -msgid "AnalogOut not supported on given pin" -msgstr "" - #: ports/stm/common-hal/audiopwmio/PWMAudioOut.c msgid "Another PWMAudioOut is already active" msgstr "" @@ -525,7 +528,7 @@ msgstr "" msgid "AuthMode.OPEN is not used with password" msgstr "" -#: shared-bindings/wifi/Radio.c +#: shared-bindings/wifi/Radio.c supervisor/shared/web_workflow/web_workflow.c msgid "Authentication failure" msgstr "" @@ -556,11 +559,6 @@ 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 "" @@ -602,11 +600,6 @@ msgstr "" msgid "Buffer elements must be 4 bytes long or less" msgstr "" -#: shared-module/usb_hid/Device.c -#, c-format -msgid "Buffer incorrect size. Should be %d bytes." -msgstr "" - #: shared-bindings/framebufferio/FramebufferDisplay.c msgid "Buffer is not a bytearray." msgstr "" @@ -616,7 +609,6 @@ msgstr "" msgid "Buffer is too small" msgstr "" -#: ports/nrf/common-hal/audiopwmio/PWMAudioOut.c #: ports/stm/common-hal/audiopwmio/PWMAudioOut.c #, c-format msgid "Buffer length %d too big. It must be less than %d" @@ -631,10 +623,6 @@ msgstr "" msgid "Buffer must be a multiple of 512 bytes" msgstr "" -#: shared-bindings/bitbangio/I2C.c -msgid "Buffer must be at least length 1" -msgstr "" - #: shared-bindings/_bleio/PacketBuffer.c #, c-format msgid "Buffer too short by %d bytes" @@ -656,10 +644,6 @@ msgstr "" msgid "Byte buffer must be 16 bytes." msgstr "" -#: shared-bindings/alarm/SleepMemory.c shared-bindings/nvm/ByteArray.c -msgid "Bytes must be between 0 and 255." -msgstr "" - #: shared-bindings/aesio/aes.c msgid "CBC blocks must be multiples of 16 bytes" msgstr "" @@ -668,7 +652,7 @@ msgstr "" msgid "CIRCUITPY drive could not be found or created." msgstr "" -#: ports/espressif/bindings/espidf/__init__.c ports/espressif/esp_error.c +#: ports/espressif/common-hal/espidf/__init__.c ports/espressif/esp_error.c msgid "CRC or checksum was invalid" msgstr "" @@ -676,6 +660,10 @@ msgstr "" msgid "Call super().__init__() before accessing native object." msgstr "" +#: ports/cxd56/common-hal/camera/Camera.c +msgid "Camera init" +msgstr "" + #: ports/espressif/common-hal/alarm/pin/PinAlarm.c msgid "Can only alarm on RTC IO from deep sleep." msgstr "" @@ -723,18 +711,10 @@ msgstr "" msgid "Cannot have scan responses for extended, connectable advertisements." msgstr "" -#: ports/atmel-samd/common-hal/audioio/AudioOut.c -msgid "Cannot output both channels on the same pin" -msgstr "" - #: ports/espressif/common-hal/alarm/pin/PinAlarm.c msgid "Cannot pull on input-only pin." msgstr "" -#: shared-module/bitbangio/SPI.c -msgid "Cannot read without MISO pin." -msgstr "" - #: shared-bindings/audiobusio/PDMIn.c msgid "Cannot record to a file" msgstr "" @@ -746,7 +726,7 @@ msgstr "" #: ports/atmel-samd/common-hal/microcontroller/__init__.c #: ports/cxd56/common-hal/microcontroller/__init__.c #: ports/mimxrt10xx/common-hal/microcontroller/__init__.c -msgid "Cannot reset into bootloader because no bootloader is present." +msgid "Cannot reset into bootloader because no bootloader is present" msgstr "" #: ports/espressif/common-hal/socketpool/Socket.c @@ -767,20 +747,19 @@ msgid "Cannot subclass slice" msgstr "" #: shared-module/bitbangio/SPI.c -msgid "Cannot transfer without MOSI and MISO pins." +msgid "Cannot transfer without MOSI and MISO pins" msgstr "" #: shared-bindings/pwmio/PWMOut.c msgid "Cannot vary frequency on a timer that is already in use" msgstr "" -#: ports/espressif/common-hal/alarm/pin/PinAlarm.c #: ports/nrf/common-hal/alarm/pin/PinAlarm.c -msgid "Cannot wake on pin edge. Only level." +msgid "Cannot wake on pin edge, only level" msgstr "" -#: shared-module/bitbangio/SPI.c -msgid "Cannot write without MOSI pin." +#: ports/espressif/common-hal/alarm/pin/PinAlarm.c +msgid "Cannot wake on pin edge. Only level." msgstr "" #: shared-bindings/_bleio/CharacteristicBuffer.c @@ -795,10 +774,6 @@ msgstr "" msgid "CircuitPython was unable to allocate the heap." msgstr "" -#: shared-module/bitbangio/SPI.c -msgid "Clock pin init failed." -msgstr "" - #: shared-module/bitbangio/I2C.c msgid "Clock stretch too long" msgstr "" @@ -807,11 +782,6 @@ msgstr "" msgid "Clock unit in use" msgstr "" -#: shared-bindings/displayio/FourWire.c shared-bindings/displayio/I2CDisplay.c -#: shared-bindings/paralleldisplay/ParallelBus.c -msgid "Command must be an int between 0 and 255" -msgstr "" - #: shared-bindings/_bleio/Connection.c msgid "" "Connection has been disconnected and can no longer be used. Create a new " @@ -822,35 +792,6 @@ msgstr "" msgid "Corrupt .mpy file" msgstr "" -#: ports/cxd56/common-hal/camera/Camera.c -msgid "Could not initialize Camera" -msgstr "" - -#: ports/cxd56/common-hal/gnss/GNSS.c -msgid "Could not initialize GNSS" -msgstr "" - -#: ports/cxd56/common-hal/sdioio/SDCard.c -msgid "Could not initialize SDCard" -msgstr "" - -#: ports/atmel-samd/common-hal/busio/UART.c ports/cxd56/common-hal/busio/UART.c -#: ports/espressif/common-hal/busio/UART.c -msgid "Could not initialize UART" -msgstr "" - -#: ports/stm/common-hal/pwmio/PWMOut.c -msgid "Could not re-init channel" -msgstr "" - -#: ports/stm/common-hal/pwmio/PWMOut.c -msgid "Could not re-init timer" -msgstr "" - -#: ports/stm/common-hal/pwmio/PWMOut.c -msgid "Could not restart PWM" -msgstr "" - #: ports/espressif/common-hal/neopixel_write/__init__.c msgid "Could not retrieve clock" msgstr "" @@ -871,20 +812,6 @@ msgstr "" msgid "Couldn't allocate decoder" msgstr "" -#: shared-module/audiocore/WaveFile.c shared-module/audiomixer/Mixer.c -#: shared-module/audiomp3/MP3Decoder.c -msgid "Couldn't allocate first buffer" -msgstr "" - -#: shared-module/audiomp3/MP3Decoder.c -msgid "Couldn't allocate input buffer" -msgstr "" - -#: shared-module/audiocore/WaveFile.c shared-module/audiomixer/Mixer.c -#: shared-module/audiomp3/MP3Decoder.c -msgid "Couldn't allocate second buffer" -msgstr "" - #: supervisor/shared/safe_mode.c msgid "Crash into the HardFault_Handler." msgstr "" @@ -932,10 +859,6 @@ msgstr "" msgid "Device in use" msgstr "" -#: ports/cxd56/common-hal/digitalio/DigitalInOut.c -msgid "DigitalInOut not supported on given pin" -msgstr "" - #: shared-bindings/displayio/Display.c #: shared-bindings/framebufferio/FramebufferDisplay.c msgid "Display must have a 16 bit colorspace." @@ -947,6 +870,10 @@ msgstr "" msgid "Display rotation must be in 90 degree increments" msgstr "" +#: main.c +msgid "Done" +msgstr "" + #: shared-bindings/digitalio/DigitalInOut.c msgid "Drive mode not used when direction is input." msgstr "" @@ -980,20 +907,19 @@ msgstr "" msgid "Error: Failure to bind" msgstr "" -#: ports/raspberrypi/bindings/rp2pio/StateMachine.c py/enum.c -#: shared-bindings/_bleio/__init__.c shared-bindings/aesio/aes.c -#: shared-bindings/busio/SPI.c shared-bindings/microcontroller/Pin.c +#: py/enum.c shared-bindings/_bleio/__init__.c shared-bindings/aesio/aes.c +#: shared-bindings/alarm/__init__.c shared-bindings/busio/SPI.c +#: shared-bindings/microcontroller/Pin.c #: shared-bindings/neopixel_write/__init__.c msgid "Expected a %q" msgstr "" -#: shared-bindings/alarm/__init__.c -msgid "Expected an alarm" +#: ports/raspberrypi/bindings/cyw43/__init__.c +msgid "Expected a %q or %q" msgstr "" -#: shared-module/adafruit_pixelbuf/PixelBuf.c -#, c-format -msgid "Expected tuple of length %d, got %d" +#: shared-bindings/alarm/__init__.c +msgid "Expected an %q" msgstr "" #: ports/espressif/common-hal/_bleio/Adapter.c @@ -1022,20 +948,8 @@ msgstr "" msgid "Failed to acquire mutex, err 0x%04x" msgstr "" -#: ports/mimxrt10xx/common-hal/busio/UART.c ports/nrf/common-hal/busio/UART.c -#: ports/raspberrypi/common-hal/busio/UART.c -msgid "Failed to allocate RX buffer" -msgstr "" - -#: ports/atmel-samd/common-hal/busio/UART.c -#: ports/atmel-samd/common-hal/pulseio/PulseIn.c -#: ports/cxd56/common-hal/pulseio/PulseIn.c -#: ports/espressif/common-hal/pulseio/PulseIn.c -#: ports/nrf/common-hal/pulseio/PulseIn.c -#: ports/raspberrypi/common-hal/pulseio/PulseIn.c -#: ports/stm/common-hal/pulseio/PulseIn.c -#, c-format -msgid "Failed to allocate RX buffer of %d bytes" +#: shared-module/rgbmatrix/RGBMatrix.c +msgid "Failed to allocate %q buffer" msgstr "" #: ports/espressif/common-hal/wifi/__init__.c @@ -1059,10 +973,6 @@ msgstr "" msgid "Failed to connect: timeout" msgstr "" -#: ports/espressif/common-hal/wifi/__init__.c -msgid "Failed to init wifi" -msgstr "" - #: shared-module/audiomp3/MP3Decoder.c msgid "Failed to parse MP3 file" msgstr "" @@ -1106,11 +1016,6 @@ msgstr "" msgid "Format not supported" msgstr "" -#: shared-module/framebufferio/FramebufferDisplay.c -#, c-format -msgid "Framebuffer requires %d bytes" -msgstr "" - #: ports/mimxrt10xx/common-hal/microcontroller/Processor.c msgid "" "Frequency must be 24, 150, 396, 450, 528, 600, 720, 816, 912, 960 or 1008 Mhz" @@ -1125,7 +1030,11 @@ msgstr "" msgid "Function requires lock" msgstr "" -#: ports/espressif/bindings/espidf/__init__.c ports/espressif/esp_error.c +#: ports/cxd56/common-hal/gnss/GNSS.c +msgid "GNSS init" +msgstr "" + +#: ports/espressif/common-hal/espidf/__init__.c ports/espressif/esp_error.c msgid "Generic Failure" msgstr "" @@ -1152,19 +1061,16 @@ msgstr "" msgid "Hardware in use, try alternative pins" msgstr "" -#: shared-bindings/wifi/Radio.c -msgid "Hostname must be between 1 and 253 characters" -msgstr "" - #: extmod/vfs_posix_file.c py/objstringio.c msgid "I/O operation on closed file" msgstr "" #: ports/stm/common-hal/busio/I2C.c -msgid "I2C Init Error" +msgid "I2C init error" msgstr "" #: ports/raspberrypi/common-hal/busio/I2C.c +#: ports/raspberrypi/common-hal/i2ctarget/I2CTarget.c msgid "I2C peripheral in use" msgstr "" @@ -1269,75 +1175,37 @@ msgstr "" msgid "Internal error #%d" msgstr "" -#: shared-bindings/sdioio/SDCard.c shared-module/usb_hid/Device.c +#: supervisor/shared/safe_mode.c +msgid "Internal watchdog timer expired." +msgstr "" + +#: py/argcheck.c shared-bindings/digitalio/DigitalInOut.c msgid "Invalid %q" msgstr "" -#: ports/atmel-samd/common-hal/audiobusio/I2SOut.c -#: ports/atmel-samd/common-hal/audiobusio/PDMIn.c -#: ports/atmel-samd/common-hal/imagecapture/ParallelImageCapture.c -#: ports/mimxrt10xx/common-hal/busio/UART.c +#: shared-bindings/microcontroller/Pin.c msgid "Invalid %q pin" msgstr "" -#: ports/stm/common-hal/busio/I2C.c ports/stm/common-hal/busio/SPI.c -#: ports/stm/common-hal/busio/UART.c ports/stm/common-hal/canio/CAN.c -#: ports/stm/common-hal/sdioio/SDCard.c -msgid "Invalid %q pin selection" -msgstr "" - #: ports/stm/common-hal/analogio/AnalogIn.c msgid "Invalid ADC Unit value" msgstr "" -#: ports/espressif/common-hal/wifi/Radio.c -msgid "Invalid AuthMode" -msgstr "" - #: ports/espressif/common-hal/_bleio/__init__.c #: ports/nrf/common-hal/_bleio/__init__.c msgid "Invalid BLE parameter" msgstr "" -#: shared-module/displayio/OnDiskBitmap.c -msgid "Invalid BMP file" -msgstr "" - #: shared-bindings/wifi/Radio.c msgid "Invalid BSSID" msgstr "" -#: ports/espressif/common-hal/analogio/AnalogOut.c -#: ports/stm/common-hal/analogio/AnalogOut.c -msgid "Invalid DAC pin supplied" -msgstr "" - #: shared-bindings/wifi/Radio.c msgid "Invalid MAC address" msgstr "" -#: shared-bindings/synthio/__init__.c -msgid "Invalid MIDI file" -msgstr "" - -#: ports/atmel-samd/common-hal/pwmio/PWMOut.c -#: ports/cxd56/common-hal/pwmio/PWMOut.c -#: ports/espressif/common-hal/pwmio/PWMOut.c -#: ports/mimxrt10xx/common-hal/pwmio/PWMOut.c -#: ports/nrf/common-hal/pwmio/PWMOut.c -#: ports/raspberrypi/common-hal/pwmio/PWMOut.c shared-bindings/pwmio/PWMOut.c -msgid "Invalid PWM frequency" -msgstr "" - -#: ports/espressif/common-hal/analogio/AnalogIn.c -msgid "Invalid Pin" -msgstr "" - -#: ports/espressif/bindings/espidf/__init__.c -#: ports/espressif/common-hal/busio/I2C.c -#: ports/espressif/common-hal/i2cperipheral/I2CPeripheral.c -#: ports/espressif/esp_error.c py/moduerrno.c -#: shared-module/rgbmatrix/RGBMatrix.c +#: ports/espressif/common-hal/espidf/__init__.c ports/espressif/esp_error.c +#: py/moduerrno.c msgid "Invalid argument" msgstr "" @@ -1345,42 +1213,11 @@ msgstr "" msgid "Invalid bits per value" msgstr "" -#: ports/nrf/common-hal/busio/UART.c ports/raspberrypi/common-hal/busio/UART.c -#: ports/stm/common-hal/busio/UART.c -msgid "Invalid buffer size" -msgstr "" - -#: shared-bindings/adafruit_pixelbuf/PixelBuf.c -msgid "Invalid byteorder string" -msgstr "" - -#: ports/atmel-samd/common-hal/frequencyio/FrequencyIn.c -#: ports/espressif/common-hal/frequencyio/FrequencyIn.c -msgid "Invalid capture period. Valid range: 1 - 500" -msgstr "" - -#: shared-bindings/audiomixer/Mixer.c -msgid "Invalid channel count" -msgstr "" - -#: ports/atmel-samd/common-hal/imagecapture/ParallelImageCapture.c -#, c-format -msgid "Invalid data_count %d" -msgstr "" - #: ports/atmel-samd/common-hal/imagecapture/ParallelImageCapture.c #, c-format msgid "Invalid data_pins[%d]" msgstr "" -#: shared-bindings/digitalio/DigitalInOut.c -msgid "Invalid direction." -msgstr "" - -#: shared-module/audiocore/WaveFile.c -msgid "Invalid file" -msgstr "" - #: shared-module/audiocore/WaveFile.c msgid "Invalid format chunk size" msgstr "" @@ -1389,107 +1226,27 @@ msgstr "" msgid "Invalid memory access." msgstr "" -#: extmod/vfs_fat_file.c -msgid "Invalid mode" -msgstr "" - #: ports/espressif/common-hal/wifi/Radio.c msgid "Invalid multicast MAC address" msgstr "" -#: shared-bindings/bitbangio/SPI.c shared-bindings/busio/SPI.c -msgid "Invalid number of bits" -msgstr "" - -#: shared-bindings/bitbangio/SPI.c shared-bindings/busio/SPI.c -#: shared-bindings/displayio/FourWire.c -msgid "Invalid phase" -msgstr "" - -#: ports/atmel-samd/common-hal/audioio/AudioOut.c -#: ports/atmel-samd/common-hal/touchio/TouchIn.c -#: ports/espressif/common-hal/alarm/touch/TouchAlarm.c -#: ports/espressif/common-hal/touchio/TouchIn.c -#: ports/nrf/common-hal/alarm/pin/PinAlarm.c shared-bindings/pwmio/PWMOut.c -#: shared-module/rgbmatrix/RGBMatrix.c -msgid "Invalid pin" -msgstr "" - -#: ports/atmel-samd/common-hal/audioio/AudioOut.c -msgid "Invalid pin for left channel" -msgstr "" - -#: ports/atmel-samd/common-hal/audioio/AudioOut.c -msgid "Invalid pin for right channel" -msgstr "" - -#: ports/atmel-samd/common-hal/busio/I2C.c -#: ports/atmel-samd/common-hal/busio/SPI.c -#: ports/atmel-samd/common-hal/busio/UART.c -#: ports/atmel-samd/common-hal/i2cperipheral/I2CPeripheral.c -#: ports/cxd56/common-hal/busio/I2C.c ports/cxd56/common-hal/busio/SPI.c -#: ports/cxd56/common-hal/busio/UART.c ports/cxd56/common-hal/sdioio/SDCard.c -#: ports/espressif/common-hal/busio/I2C.c -#: ports/espressif/common-hal/busio/SPI.c -#: ports/espressif/common-hal/busio/UART.c -#: ports/espressif/common-hal/canio/CAN.c -#: ports/espressif/common-hal/i2cperipheral/I2CPeripheral.c -#: ports/mimxrt10xx/common-hal/busio/I2C.c -#: ports/mimxrt10xx/common-hal/busio/SPI.c -#: ports/mimxrt10xx/common-hal/usb_host/Port.c ports/nrf/common-hal/busio/I2C.c -#: ports/raspberrypi/common-hal/busio/I2C.c -#: ports/raspberrypi/common-hal/busio/SPI.c -#: ports/raspberrypi/common-hal/busio/UART.c shared-bindings/busio/SPI.c #: shared-bindings/busio/UART.c msgid "Invalid pins" msgstr "" -#: shared-bindings/bitbangio/SPI.c shared-bindings/busio/SPI.c -#: shared-bindings/displayio/FourWire.c -msgid "Invalid polarity" -msgstr "" - -#: shared-bindings/_bleio/Characteristic.c -msgid "Invalid properties" -msgstr "" - -#: shared-bindings/microcontroller/__init__.c -msgid "Invalid run mode." -msgstr "" - -#: shared-module/_bleio/Attribute.c -msgid "Invalid security_mode" -msgstr "" - -#: ports/espressif/bindings/espidf/__init__.c ports/espressif/esp_error.c +#: ports/espressif/common-hal/espidf/__init__.c ports/espressif/esp_error.c msgid "Invalid size" msgstr "" #: ports/espressif/common-hal/ssl/SSLContext.c +#: ports/raspberrypi/common-hal/ssl/SSLSocket.c msgid "Invalid socket for TLS" msgstr "" -#: ports/espressif/bindings/espidf/__init__.c ports/espressif/esp_error.c +#: ports/espressif/common-hal/espidf/__init__.c ports/espressif/esp_error.c msgid "Invalid state" msgstr "" -#: shared-bindings/audiomixer/Mixer.c -msgid "Invalid voice" -msgstr "" - -#: shared-bindings/audiomixer/Mixer.c -msgid "Invalid voice count" -msgstr "" - -#: shared-module/audiocore/WaveFile.c -msgid "Invalid wave file" -msgstr "" - -#: ports/mimxrt10xx/common-hal/busio/UART.c ports/nrf/common-hal/busio/UART.c -#: ports/raspberrypi/common-hal/busio/UART.c ports/stm/common-hal/busio/UART.c -msgid "Invalid word/bit length" -msgstr "" - #: shared-bindings/aesio/aes.c msgid "Key must be 16, 24, or 32 bytes long" msgstr "" @@ -1503,25 +1260,17 @@ msgid "LHS of keyword arg must be an id" msgstr "" #: shared-module/displayio/Group.c -msgid "Layer already in a group." +msgid "Layer already in a group" msgstr "" #: shared-module/displayio/Group.c -msgid "Layer must be a Group or TileGrid subclass." +msgid "Layer must be a Group or TileGrid subclass" msgstr "" -#: ports/espressif/bindings/espidf/__init__.c ports/espressif/esp_error.c +#: ports/espressif/common-hal/espidf/__init__.c ports/espressif/esp_error.c msgid "MAC address was invalid" msgstr "" -#: shared-module/bitbangio/SPI.c -msgid "MISO pin init failed." -msgstr "" - -#: shared-module/bitbangio/SPI.c -msgid "MOSI pin init failed." -msgstr "" - #: shared-bindings/is31fl3741/IS31FL3741.c msgid "Mapping must be a tuple" msgstr "" @@ -1531,10 +1280,6 @@ msgstr "" msgid "Maximum x value when mirrored is %d" msgstr "" -#: shared-bindings/canio/Message.c -msgid "Messages limited to 8 bytes" -msgstr "" - #: shared-bindings/audiobusio/PDMIn.c msgid "Microphone startup delay must be in range 0.0 to 1.0" msgstr "" @@ -1548,10 +1293,14 @@ msgstr "" msgid "Mismatched swap flag" msgstr "" -#: ports/mimxrt10xx/common-hal/busio/SPI.c ports/stm/common-hal/busio/SPI.c +#: ports/mimxrt10xx/common-hal/busio/SPI.c msgid "Missing MISO or MOSI Pin" msgstr "" +#: ports/stm/common-hal/busio/SPI.c +msgid "Missing MISO or MOSI pin" +msgstr "" + #: ports/raspberrypi/common-hal/rp2pio/StateMachine.c #, c-format msgid "Missing first_in_pin. Instruction %d reads pin(s)" @@ -1587,11 +1336,6 @@ msgstr "" msgid "Missing jmp_pin. Instruction %d jumps on pin" msgstr "" -#: shared-module/usb_hid/Device.c -#, c-format -msgid "More than %d report ids not supported" -msgstr "" - #: shared-bindings/busio/UART.c shared-bindings/displayio/Group.c msgid "Must be a %q subclass." msgstr "" @@ -1651,16 +1395,28 @@ msgstr "" msgid "No I2C device at address: 0x%x" msgstr "" -#: ports/espressif/common-hal/busio/SPI.c -#: ports/mimxrt10xx/common-hal/busio/SPI.c ports/stm/common-hal/busio/SPI.c -msgid "No MISO Pin" +#: supervisor/shared/web_workflow/web_workflow.c +msgid "No IP" msgstr "" #: ports/espressif/common-hal/busio/SPI.c -#: ports/mimxrt10xx/common-hal/busio/SPI.c ports/stm/common-hal/busio/SPI.c +#: ports/mimxrt10xx/common-hal/busio/SPI.c +msgid "No MISO Pin" +msgstr "" + +#: ports/stm/common-hal/busio/SPI.c shared-module/bitbangio/SPI.c +msgid "No MISO pin" +msgstr "" + +#: ports/espressif/common-hal/busio/SPI.c +#: ports/mimxrt10xx/common-hal/busio/SPI.c msgid "No MOSI Pin" msgstr "" +#: ports/stm/common-hal/busio/SPI.c shared-module/bitbangio/SPI.c +msgid "No MOSI pin" +msgstr "" + #: ports/atmel-samd/common-hal/busio/UART.c #: ports/espressif/common-hal/busio/UART.c #: ports/mimxrt10xx/common-hal/busio/UART.c ports/nrf/common-hal/busio/UART.c @@ -1699,16 +1455,6 @@ msgstr "" msgid "No hardware random available" msgstr "" -#: ports/atmel-samd/common-hal/ps2io/Ps2.c -msgid "No hardware support on clk pin" -msgstr "" - -#: ports/atmel-samd/common-hal/alarm/pin/PinAlarm.c -#: ports/atmel-samd/common-hal/frequencyio/FrequencyIn.c -#: ports/atmel-samd/common-hal/pulseio/PulseIn.c -msgid "No hardware support on pin" -msgstr "" - #: ports/raspberrypi/common-hal/rp2pio/StateMachine.c msgid "No in in program" msgstr "" @@ -1806,16 +1552,26 @@ msgstr "" msgid "Odd parity is not supported" msgstr "" +#: supervisor/shared/bluetooth/bluetooth.c +msgid "Off" +msgstr "" + +#: supervisor/shared/bluetooth/bluetooth.c +msgid "Ok" +msgstr "" + #: ports/atmel-samd/common-hal/audiobusio/PDMIn.c #: ports/raspberrypi/common-hal/audiobusio/PDMIn.c msgid "Only 8 or 16 bit mono with " msgstr "" #: ports/espressif/common-hal/wifi/__init__.c +#: ports/raspberrypi/common-hal/wifi/__init__.c msgid "Only IPv4 addresses supported" msgstr "" -#: ports/espressif/common-hal/socketpool/SocketPool.c +#: ports/espressif/common-hal/socketpool/Socket.c +#: ports/raspberrypi/common-hal/socketpool/Socket.c msgid "Only IPv4 sockets supported" msgstr "" @@ -1848,15 +1604,19 @@ msgstr "" msgid "Only one TouchAlarm can be set in deep sleep." msgstr "" -#: ports/espressif/common-hal/i2cperipheral/I2CPeripheral.c +#: ports/espressif/common-hal/i2ctarget/I2CTarget.c +#: ports/raspberrypi/common-hal/i2ctarget/I2CTarget.c msgid "Only one address is allowed" msgstr "" #: ports/atmel-samd/common-hal/alarm/time/TimeAlarm.c -#: ports/espressif/common-hal/alarm/time/TimeAlarm.c #: ports/nrf/common-hal/alarm/time/TimeAlarm.c -#: ports/raspberrypi/common-hal/alarm/time/TimeAlarm.c #: ports/stm/common-hal/alarm/time/TimeAlarm.c +msgid "Only one alarm.time alarm can be set" +msgstr "" + +#: ports/espressif/common-hal/alarm/time/TimeAlarm.c +#: ports/raspberrypi/common-hal/alarm/time/TimeAlarm.c msgid "Only one alarm.time alarm can be set." msgstr "" @@ -1868,19 +1628,20 @@ msgstr "" msgid "Operation not permitted" msgstr "" -#: ports/espressif/bindings/espidf/__init__.c ports/espressif/esp_error.c +#: ports/espressif/common-hal/espidf/__init__.c ports/espressif/esp_error.c msgid "Operation or feature not supported" msgstr "" -#: ports/espressif/bindings/espidf/__init__.c ports/espressif/esp_error.c +#: ports/espressif/common-hal/espidf/__init__.c ports/espressif/esp_error.c msgid "Operation timed out" msgstr "" -#: ports/espressif/bindings/espidf/__init__.c ports/espressif/esp_error.c +#: ports/espressif/common-hal/espidf/__init__.c ports/espressif/esp_error.c msgid "Out of memory" msgstr "" -#: ports/espressif/common-hal/socketpool/SocketPool.c +#: ports/espressif/common-hal/socketpool/Socket.c +#: ports/raspberrypi/common-hal/socketpool/Socket.c msgid "Out of sockets" msgstr "" @@ -1888,11 +1649,6 @@ msgstr "" msgid "Out-buffer elements must be <= 4 bytes long" msgstr "" -#: shared-bindings/bitops/__init__.c -#, c-format -msgid "Output buffer must be at least %d bytes" -msgstr "" - #: shared-bindings/audiobusio/PDMIn.c msgid "Oversample must be multiple of 8." msgstr "" @@ -1903,12 +1659,11 @@ msgstr "" #: shared-bindings/pwmio/PWMOut.c msgid "" -"PWM duty_cycle must be between 0 and 65535 inclusive (16 bit resolution)" +"PWM frequency not writable when variable_frequency is False on construction." msgstr "" -#: shared-bindings/pwmio/PWMOut.c -msgid "" -"PWM frequency not writable when variable_frequency is False on construction." +#: ports/stm/common-hal/pwmio/PWMOut.c +msgid "PWM restart" msgstr "" #: ports/raspberrypi/common-hal/countio/Counter.c @@ -1927,36 +1682,20 @@ msgstr "" msgid "Permission denied" msgstr "" -#: ports/atmel-samd/common-hal/alarm/pin/PinAlarm.c #: ports/stm/common-hal/alarm/pin/PinAlarm.c msgid "Pin cannot wake from Deep Sleep" msgstr "" -#: ports/raspberrypi/bindings/rp2pio/StateMachine.c -msgid "Pin count must be at least 1" -msgstr "" - #: ports/raspberrypi/common-hal/rp2pio/StateMachine.c msgid "Pin count too large" msgstr "" -#: ports/atmel-samd/common-hal/analogio/AnalogIn.c -#: ports/cxd56/common-hal/analogio/AnalogIn.c -#: ports/espressif/common-hal/analogio/AnalogIn.c -#: ports/mimxrt10xx/common-hal/analogio/AnalogIn.c -#: ports/nrf/common-hal/analogio/AnalogIn.c -#: ports/raspberrypi/common-hal/analogio/AnalogIn.c -#: ports/stm/common-hal/analogio/AnalogIn.c -msgid "Pin does not have ADC capabilities" -msgstr "" - #: ports/stm/common-hal/alarm/pin/PinAlarm.c #: ports/stm/common-hal/pulseio/PulseIn.c msgid "Pin interrupt already in use" msgstr "" #: shared-bindings/adafruit_bus_device/spi_device/SPIDevice.c -#: shared-bindings/digitalio/DigitalInOut.c msgid "Pin is input only" msgstr "" @@ -2016,18 +1755,10 @@ msgstr "" msgid "Program does OUT without loading OSR" msgstr "" -#: ports/raspberrypi/bindings/rp2pio/StateMachine.c -msgid "Program must contain at least one 16-bit instruction." -msgstr "" - #: ports/raspberrypi/bindings/rp2pio/StateMachine.c msgid "Program size invalid" msgstr "" -#: ports/raspberrypi/bindings/rp2pio/StateMachine.c -msgid "Program too large" -msgstr "" - #: shared-bindings/digitalio/DigitalInOut.c msgid "Pull not used when direction is output." msgstr "" @@ -2049,8 +1780,9 @@ msgstr "" msgid "RNG Init Error" msgstr "" -#: ports/nrf/common-hal/busio/UART.c -msgid "RS485 Not yet supported on this device" +#: ports/atmel-samd/common-hal/busio/UART.c ports/cxd56/common-hal/busio/UART.c +#: ports/nrf/common-hal/busio/UART.c ports/stm/common-hal/busio/UART.c +msgid "RS485" msgstr "" #: ports/espressif/common-hal/busio/UART.c @@ -2058,21 +1790,10 @@ msgstr "" msgid "RS485 inversion specified when not in RS485 mode" msgstr "" -#: ports/cxd56/common-hal/rtc/RTC.c ports/espressif/common-hal/rtc/RTC.c -#: ports/mimxrt10xx/common-hal/rtc/RTC.c ports/nrf/common-hal/rtc/RTC.c -#: ports/raspberrypi/common-hal/rtc/RTC.c -msgid "RTC calibration is not supported on this board" -msgstr "" - #: shared-bindings/alarm/time/TimeAlarm.c shared-bindings/time/__init__.c msgid "RTC is not supported on this board" msgstr "" -#: ports/atmel-samd/common-hal/busio/UART.c ports/cxd56/common-hal/busio/UART.c -#: ports/stm/common-hal/busio/UART.c -msgid "RTS/CTS/RS485 Not yet supported on this device" -msgstr "" - #: ports/stm/common-hal/os/__init__.c msgid "Random number generation error" msgstr "" @@ -2090,10 +1811,14 @@ msgstr "" msgid "Read-only object" msgstr "" -#: ports/espressif/bindings/espidf/__init__.c ports/espressif/esp_error.c +#: ports/espressif/common-hal/espidf/__init__.c ports/espressif/esp_error.c msgid "Received response was invalid" msgstr "" +#: supervisor/shared/bluetooth/bluetooth.c +msgid "Reconnecting" +msgstr "" + #: shared-bindings/displayio/EPaperDisplay.c msgid "Refresh too soon" msgstr "" @@ -2106,7 +1831,7 @@ msgstr "" msgid "Requested AES mode is unsupported" msgstr "" -#: ports/espressif/bindings/espidf/__init__.c ports/espressif/esp_error.c +#: ports/espressif/common-hal/espidf/__init__.c ports/espressif/esp_error.c msgid "Requested resource not found" msgstr "" @@ -2122,6 +1847,10 @@ msgstr "" msgid "SD card CSD format not supported" msgstr "" +#: ports/cxd56/common-hal/sdioio/SDCard.c +msgid "SDCard init" +msgstr "" + #: ports/stm/common-hal/sdioio/SDCard.c #, c-format msgid "SDIO GetCardInfo Error %d" @@ -2132,29 +1861,20 @@ msgstr "" msgid "SDIO Init Error %d" msgstr "" -#: ports/stm/common-hal/busio/SPI.c -msgid "SPI Init Error" -msgstr "" - -#: ports/stm/common-hal/busio/SPI.c -msgid "SPI Re-initialization error" -msgstr "" - #: ports/espressif/common-hal/busio/SPI.c msgid "SPI configuration failed" msgstr "" +#: ports/stm/common-hal/busio/SPI.c +msgid "SPI init error" +msgstr "" + #: ports/raspberrypi/common-hal/busio/SPI.c msgid "SPI peripheral in use" msgstr "" -#: shared-bindings/audiomixer/Mixer.c -msgid "Sample rate must be positive" -msgstr "" - -#: ports/atmel-samd/common-hal/audioio/AudioOut.c -#, c-format -msgid "Sample rate too high. It must be less than %d" +#: ports/stm/common-hal/busio/SPI.c +msgid "SPI re-init" msgstr "" #: shared-bindings/is31fl3741/FrameBuffer.c @@ -2175,14 +1895,6 @@ msgstr "" msgid "Server side context cannot have hostname" msgstr "" -#: ports/raspberrypi/bindings/rp2pio/StateMachine.c -msgid "Set pin count must be between 1 and 5" -msgstr "" - -#: ports/raspberrypi/bindings/rp2pio/StateMachine.c -msgid "Side set pin count must be between 1 and 5" -msgstr "" - #: ports/cxd56/common-hal/camera/Camera.c msgid "Size not supported" msgstr "" @@ -2203,6 +1915,7 @@ msgid "Slices not supported" msgstr "" #: ports/espressif/common-hal/socketpool/SocketPool.c +#: ports/raspberrypi/common-hal/socketpool/SocketPool.c msgid "SocketPool can only be used with wifi.radio" msgstr "" @@ -2218,10 +1931,6 @@ msgstr "" msgid "Splitting with sub-captures" msgstr "" -#: shared-bindings/supervisor/__init__.c -msgid "Stack size must be at least 256" -msgstr "" - #: ports/raspberrypi/common-hal/audiopwmio/PWMAudioOut.c msgid "Stereo left must be on PWM channel A" msgstr "" @@ -2230,10 +1939,6 @@ msgstr "" msgid "Stereo right must be on PWM channel B" msgstr "" -#: shared-bindings/multiterminal/__init__.c -msgid "Stream missing readinto() or write() method." -msgstr "" - #: ports/mimxrt10xx/common-hal/busio/UART.c ports/stm/common-hal/busio/UART.c msgid "Supply at least one UART pin" msgstr "" @@ -2307,10 +2012,6 @@ msgstr "" msgid "Tile index out of bounds" msgstr "" -#: shared-bindings/displayio/TileGrid.c -msgid "Tile value out of bounds" -msgstr "" - #: shared-bindings/displayio/TileGrid.c msgid "Tile width must exactly divide bitmap width" msgstr "" @@ -2330,6 +2031,9 @@ msgid "To exit, please reset the board without " msgstr "" #: ports/atmel-samd/common-hal/audiobusio/I2SOut.c +msgid "Too many channels in sample" +msgstr "" + #: ports/raspberrypi/common-hal/audiobusio/I2SOut.c msgid "Too many channels in sample." msgstr "" @@ -2362,23 +2066,24 @@ msgid "Tuple or struct_time argument required" msgstr "" #: ports/stm/common-hal/busio/UART.c -msgid "UART Buffer allocation error" +msgid "UART de-init" +msgstr "" + +#: ports/atmel-samd/common-hal/busio/UART.c ports/cxd56/common-hal/busio/UART.c +#: ports/espressif/common-hal/busio/UART.c ports/stm/common-hal/busio/UART.c +msgid "UART init" msgstr "" #: ports/stm/common-hal/busio/UART.c -msgid "UART De-init error" +msgid "UART re-init" msgstr "" #: ports/stm/common-hal/busio/UART.c -msgid "UART Init Error" +msgid "UART write" msgstr "" -#: ports/stm/common-hal/busio/UART.c -msgid "UART Re-init error" -msgstr "" - -#: ports/stm/common-hal/busio/UART.c -msgid "UART write error" +#: main.c +msgid "UID:" msgstr "" #: shared-module/usb_hid/Device.c @@ -2504,6 +2209,11 @@ msgstr "" msgid "Unknown system firmware error: %d" msgstr "" +#: ports/raspberrypi/common-hal/wifi/__init__.c +#, c-format +msgid "Unkown error code %d" +msgstr "" + #: shared-bindings/adafruit_pixelbuf/PixelBuf.c #, c-format msgid "Unmatched number of items on RHS (expected %d, got %d)." @@ -2515,12 +2225,6 @@ msgid "" "declined or ignored." msgstr "" -#: ports/atmel-samd/common-hal/busio/I2C.c ports/cxd56/common-hal/busio/I2C.c -#: ports/espressif/common-hal/busio/UART.c -#: ports/raspberrypi/common-hal/busio/I2C.c ports/stm/common-hal/busio/I2C.c -msgid "Unsupported baudrate" -msgstr "" - #: shared-bindings/bitmaptools/__init__.c msgid "Unsupported colorspace" msgstr "" @@ -2533,6 +2237,10 @@ msgstr "" msgid "Unsupported format" msgstr "" +#: shared-bindings/hashlib/__init__.c +msgid "Unsupported hash algorithm" +msgstr "" + #: ports/espressif/common-hal/dualbank/__init__.c msgid "Update Failed" msgstr "" @@ -2551,7 +2259,7 @@ msgstr "" msgid "Value length > max_length" msgstr "" -#: ports/espressif/bindings/espidf/__init__.c ports/espressif/esp_error.c +#: ports/espressif/common-hal/espidf/__init__.c ports/espressif/esp_error.c msgid "Version was invalid" msgstr "" @@ -2581,10 +2289,6 @@ msgstr "" msgid "WatchDogTimer.timeout must be greater than 0" msgstr "" -#: supervisor/shared/safe_mode.c -msgid "Watchdog timer expired." -msgstr "" - #: py/builtinhelp.c #, c-format msgid "" @@ -2595,8 +2299,8 @@ msgid "" "To list built-in modules type `help(\"modules\")`.\n" msgstr "" -#: shared-bindings/wifi/Radio.c -msgid "WiFi password must be between 8 and 63 characters" +#: supervisor/shared/web_workflow/web_workflow.c +msgid "Wi-Fi: " msgstr "" #: main.c @@ -2637,11 +2341,7 @@ msgstr "" msgid "a bytes-like object is required" msgstr "" -#: shared-bindings/i2cperipheral/I2CPeripheral.c -msgid "address out of bounds" -msgstr "" - -#: shared-bindings/i2cperipheral/I2CPeripheral.c +#: shared-bindings/i2ctarget/I2CTarget.c msgid "addresses is empty" msgstr "" @@ -2690,6 +2390,10 @@ msgstr "" msgid "array and index length must be equal" msgstr "" +#: extmod/ulab/code/numpy/io/io.c +msgid "array has too many dimensions" +msgstr "" + #: py/objarray.c shared-bindings/alarm/SleepMemory.c #: shared-bindings/nvm/ByteArray.c msgid "array/bytes required on right side" @@ -2751,10 +2455,6 @@ msgstr "" msgid "bits must be 32 or less" msgstr "" -#: shared-bindings/busio/UART.c -msgid "bits must be in range 5 to 9" -msgstr "" - #: shared-bindings/audiomixer/Mixer.c msgid "bits_per_sample must be 8 or 16" msgstr "" @@ -2792,11 +2492,6 @@ msgstr "" msgid "byteorder is not a string" msgstr "" -#: ports/atmel-samd/common-hal/busio/UART.c -#: ports/espressif/common-hal/busio/UART.c -msgid "bytes > 8 bits not supported" -msgstr "" - #: py/objarray.c msgid "bytes length not a multiple of item size" msgstr "" @@ -2805,7 +2500,7 @@ msgstr "" msgid "bytes value out of range" msgstr "" -#: ports/atmel-samd/bindings/samd/Clock.c ports/atmel-samd/common-hal/rtc/RTC.c +#: ports/atmel-samd/bindings/samd/Clock.c msgid "calibration is out of range" msgstr "" @@ -2813,12 +2508,9 @@ msgstr "" msgid "calibration is read only" msgstr "" -#: ports/atmel-samd/common-hal/rtc/RTC.c -msgid "calibration value out of range +/-127" -msgstr "" - +#: shared-module/vectorio/Circle.c shared-module/vectorio/Polygon.c #: shared-module/vectorio/Rectangle.c -msgid "can only be registered in one parent" +msgid "can only have one parent" msgstr "" #: py/emitinlinethumb.c @@ -2841,8 +2533,7 @@ msgstr "" msgid "can't cancel self" msgstr "" -#: py/obj.c py/objint.c shared-bindings/i2cperipheral/I2CPeripheral.c -#: shared-module/adafruit_pixelbuf/PixelBuf.c +#: py/obj.c py/objint.c shared-module/adafruit_pixelbuf/PixelBuf.c msgid "can't convert %q to %q" msgstr "" @@ -2989,6 +2680,10 @@ msgstr "" msgid "casting" msgstr "" +#: ports/stm/common-hal/pwmio/PWMOut.c +msgid "channel re-init" +msgstr "" + #: shared-bindings/_stage/Text.c msgid "chars buffer too small" msgstr "" @@ -3001,10 +2696,6 @@ msgstr "" msgid "chr() arg not in range(256)" msgstr "" -#: shared-module/vectorio/Circle.c -msgid "circle can only be registered in one parent" -msgstr "" - #: shared-bindings/bitmaptools/__init__.c msgid "clip point must be (x,y) tuple" msgstr "" @@ -3029,10 +2720,6 @@ msgstr "" msgid "color must be between 0x000000 and 0xffffff" msgstr "" -#: shared-bindings/displayio/ColorConverter.c -msgid "color should be an int" -msgstr "" - #: py/emitnative.c msgid "comparison of int and uint" msgstr "" @@ -3069,6 +2756,10 @@ msgstr "" msgid "convolve arguments must not be empty" msgstr "" +#: extmod/ulab/code/numpy/io/io.c +msgid "corrupted file" +msgstr "" + #: extmod/ulab/code/numpy/poly.c msgid "could not invert Vandermonde matrix" msgstr "" @@ -3119,10 +2810,6 @@ msgstr "" msgid "destination buffer must be an array of type 'H' for bit_depth = 16" msgstr "" -#: shared-bindings/audiobusio/PDMIn.c -msgid "destination_length must be an int >= 0" -msgstr "" - #: py/objdict.c msgid "dict update sequence has wrong length" msgstr "" @@ -3160,6 +2847,10 @@ msgstr "" msgid "empty" msgstr "" +#: extmod/ulab/code/numpy/io/io.c +msgid "empty file" +msgstr "" + #: extmod/moduasyncio.c extmod/moduheapq.c extmod/modutimeq.c msgid "empty heap" msgstr "" @@ -3176,10 +2867,6 @@ msgstr "" msgid "end of format while looking for conversion specifier" msgstr "" -#: shared-bindings/displayio/Shape.c -msgid "end_x should be an int" -msgstr "" - #: shared-bindings/alarm/time/TimeAlarm.c msgid "epoch_time not supported on this board" msgstr "" @@ -3189,6 +2876,12 @@ msgstr "" msgid "error = 0x%08lX" msgstr "" +#: ports/espressif/common-hal/esp32_camera/Camera.c +msgid "" +"esp32_camera.Camera requires reserved PSRAM to be configured. See the " +"documentation for instructions." +msgstr "" + #: py/runtime.c msgid "exceptions must derive from BaseException" msgstr "" @@ -3263,7 +2956,7 @@ msgstr "" msgid "first argument must be a tuple of ndarrays" msgstr "" -#: extmod/ulab/code/numpy/vector.c +#: extmod/ulab/code/numpy/transform.c extmod/ulab/code/numpy/vector.c msgid "first argument must be an ndarray" msgstr "" @@ -3411,7 +3104,7 @@ msgstr "" msgid "incorrect padding" msgstr "" -#: extmod/ulab/code/ndarray.c +#: extmod/ulab/code/ndarray.c extmod/ulab/code/numpy/transform.c msgid "index is out of bounds" msgstr "" @@ -3429,6 +3122,10 @@ msgstr "" msgid "indices must be integers, slices, or Boolean lists" msgstr "" +#: ports/espressif/common-hal/busio/I2C.c +msgid "init I2C" +msgstr "" + #: extmod/ulab/code/scipy/optimize/optimize.c msgid "initial values must be iterable" msgstr "" @@ -3474,6 +3171,10 @@ msgstr "" msgid "input matrix is singular" msgstr "" +#: extmod/ulab/code/numpy/create.c +msgid "input must be 1- or 2-d" +msgstr "" + #: extmod/ulab/code/numpy/carray/carray.c msgid "input must be a 1D ndarray" msgstr "" @@ -3482,11 +3183,7 @@ msgstr "" msgid "input must be a dense ndarray" msgstr "" -#: extmod/ulab/code/numpy/create.c -msgid "input must be a tensor of rank 2" -msgstr "" - -#: extmod/ulab/code/numpy/create.c extmod/ulab/code/user/user.c +#: extmod/ulab/code/user/user.c msgid "input must be an ndarray" msgstr "" @@ -3536,6 +3233,10 @@ msgstr "" msgid "invalid bits_per_pixel %d, must be, 1, 2, 4, 8, 16, 24, or 32" msgstr "" +#: ports/raspberrypi/common-hal/ssl/SSLSocket.c +msgid "invalid cert" +msgstr "" + #: shared-bindings/bitmaptools/__init__.c #, c-format msgid "invalid element size %d for bits_per_pixel %d\n" @@ -3562,10 +3263,18 @@ msgstr "" msgid "invalid hostname" msgstr "" +#: ports/raspberrypi/common-hal/ssl/SSLSocket.c +msgid "invalid key" +msgstr "" + #: py/compile.c msgid "invalid micropython decorator" msgstr "" +#: ports/espressif/common-hal/esp32_camera/Camera.c +msgid "invalid setting" +msgstr "" + #: shared-bindings/random/__init__.c msgid "invalid step" msgstr "" @@ -3679,10 +3388,6 @@ msgstr "" msgid "matrix is not positive definite" msgstr "" -#: ports/espressif/common-hal/wifi/Radio.c -msgid "max_connections must be between 0 and 10" -msgstr "" - #: ports/espressif/common-hal/_bleio/Descriptor.c #: ports/nrf/common-hal/_bleio/Characteristic.c #: ports/nrf/common-hal/_bleio/Descriptor.c @@ -3690,12 +3395,8 @@ msgstr "" msgid "max_length must be 0-%d when fixed_length is %s" msgstr "" -#: shared-bindings/_bleio/Characteristic.c shared-bindings/_bleio/Descriptor.c -msgid "max_length must be >= 0" -msgstr "" - #: extmod/ulab/code/ndarray.c -msgid "maximum number of dimensions is 4" +msgid "maximum number of dimensions is " msgstr "" #: py/runtime.c @@ -3829,7 +3530,7 @@ msgstr "" msgid "no response from SD card" msgstr "" -#: py/objobject.c py/runtime.c +#: ports/espressif/common-hal/esp32_camera/Camera.c py/objobject.c py/runtime.c msgid "no such attribute" msgstr "" @@ -3940,7 +3641,11 @@ msgstr "" msgid "odd-length string" msgstr "" -#: extmod/ulab/code/numpy/create.c extmod/ulab/code/utils/utils.c +#: supervisor/shared/web_workflow/web_workflow.c +msgid "off" +msgstr "" + +#: extmod/ulab/code/utils/utils.c msgid "offset is too large" msgstr "" @@ -4036,10 +3741,6 @@ msgstr "" msgid "palette must be 32 bytes long" msgstr "" -#: shared-bindings/displayio/Palette.c -msgid "palette_index should be an int" -msgstr "" - #: py/emitinlinextensa.c msgid "parameters must be registers in sequence a2 to a5" msgstr "" @@ -4064,10 +3765,6 @@ msgstr "" msgid "poll on file not available on win32" msgstr "" -#: shared-module/vectorio/Polygon.c -msgid "polygon can only be registered in one parent" -msgstr "" - #: ports/espressif/common-hal/pulseio/PulseIn.c msgid "pop from an empty PulseIn" msgstr "" @@ -4093,7 +3790,23 @@ msgstr "" msgid "pow() with 3 arguments requires integers" msgstr "" +#: ports/espressif/boards/adafruit_qtpy_esp32_pico/mpconfigboard.h +msgid "pressing BOOT button at start up.\n" +msgstr "" + +#: ports/espressif/boards/adafruit_feather_esp32_v2/mpconfigboard.h +msgid "pressing SW38 button at start up.\n" +msgstr "" + +#: ports/espressif/boards/hardkernel_odroid_go/mpconfigboard.h +msgid "pressing VOLUME button at start up.\n" +msgstr "" + #: ports/espressif/boards/adafruit_qtpy_esp32c3/mpconfigboard.h +#: ports/espressif/boards/beetle-esp32-c3/mpconfigboard.h +#: ports/espressif/boards/espressif_esp32s2_devkitc_1_n8r2/mpconfigboard.h +#: ports/espressif/boards/lolin_c3_mini/mpconfigboard.h +#: ports/espressif/boards/microdev_micro_c3/mpconfigboard.h #: supervisor/shared/safe_mode.c msgid "pressing boot button at start up.\n" msgstr "" @@ -4114,14 +3827,6 @@ msgstr "" msgid "pull masks conflict with direction masks" msgstr "" -#: ports/raspberrypi/bindings/rp2pio/StateMachine.c -msgid "pull_threshold must be between 1 and 32" -msgstr "" - -#: ports/raspberrypi/bindings/rp2pio/StateMachine.c -msgid "push_threshold must be between 1 and 32" -msgstr "" - #: extmod/modutimeq.c msgid "queue overflow" msgstr "" @@ -4173,12 +3878,6 @@ msgstr "" msgid "rsplit(None,n)" msgstr "" -#: shared-bindings/audiocore/RawSample.c -msgid "" -"sample_source buffer must be a bytearray or array of type 'h', 'H', 'b' or " -"'B'" -msgstr "" - #: ports/atmel-samd/common-hal/audiobusio/PDMIn.c #: ports/raspberrypi/common-hal/audiobusio/PDMIn.c msgid "sampling rate out of range" @@ -4276,26 +3975,14 @@ msgstr "" msgid "source_bitmap must have value_count of 8" msgstr "" -#: shared-bindings/wifi/Radio.c -msgid "ssid can't be more than 32 bytes" -msgstr "" - #: py/objstr.c msgid "start/end indices" msgstr "" -#: shared-bindings/displayio/Shape.c -msgid "start_x should be an int" -msgstr "" - #: shared-bindings/random/__init__.c msgid "step must be non-zero" msgstr "" -#: shared-bindings/busio/UART.c -msgid "stop must be 1 or 2" -msgstr "" - #: shared-bindings/random/__init__.c msgid "stop not reachable from start" msgstr "" @@ -4344,10 +4031,6 @@ msgstr "" msgid "threshold must be in the range 0-65536" msgstr "" -#: shared-bindings/rgbmatrix/RGBMatrix.c -msgid "tile must be greater than zero" -msgstr "" - #: shared-bindings/time/__init__.c msgid "time.struct_time() takes a 9-sequence" msgstr "" @@ -4367,10 +4050,6 @@ msgstr "" msgid "timeout must be < 655.35 secs" msgstr "" -#: shared-bindings/_bleio/CharacteristicBuffer.c -msgid "timeout must be >= 0.0" -msgstr "" - #: shared-module/sdcardio/SDCard.c msgid "timeout waiting for v1 card" msgstr "" @@ -4379,6 +4058,10 @@ msgstr "" msgid "timeout waiting for v2 card" msgstr "" +#: ports/stm/common-hal/pwmio/PWMOut.c +msgid "timer re-init" +msgstr "" + #: shared-bindings/time/__init__.c msgid "timestamp out of range for platform time_t" msgstr "" @@ -4444,14 +4127,10 @@ msgstr "" msgid "type is not an acceptable base type" msgstr "" -#: py/runtime.c +#: py/objgenerator.c py/runtime.c msgid "type object '%q' has no attribute '%q'" msgstr "" -#: py/objgenerator.c -msgid "type object 'generator' has no attribute '__await__'" -msgstr "" - #: py/objtype.c msgid "type takes 1 or 3 arguments" msgstr "" @@ -4510,7 +4189,6 @@ msgid "unreadable attribute" msgstr "" #: shared-bindings/displayio/TileGrid.c shared-bindings/vectorio/VectorShape.c -#: shared-module/vectorio/Polygon.c shared-module/vectorio/VectorShape.c msgid "unsupported %q type" msgstr "" @@ -4549,6 +4227,14 @@ msgstr "" msgid "unsupported types for %q: '%q', '%q'" msgstr "" +#: extmod/ulab/code/numpy/io/io.c +msgid "usecols is too high" +msgstr "" + +#: extmod/ulab/code/numpy/io/io.c +msgid "usecols keyword must be specified" +msgstr "" + #: py/objint.c #, c-format msgid "value must fit in %d byte(s)" @@ -4570,20 +4256,19 @@ msgstr "" msgid "watchdog timeout must be greater than 0" msgstr "" -#: shared-bindings/bitops/__init__.c -#, c-format -msgid "width must be from 2 to 8 (inclusive), not %d" -msgstr "" - #: shared-bindings/is31fl3741/FrameBuffer.c -#: shared-bindings/rgbmatrix/RGBMatrix.c msgid "width must be greater than zero" msgstr "" #: ports/espressif/common-hal/wifi/Radio.c +#: ports/raspberrypi/common-hal/wifi/Radio.c msgid "wifi is not enabled" msgstr "" +#: ports/raspberrypi/common-hal/wifi/Monitor.c +msgid "wifi.Monitor not available" +msgstr "" + #: shared-bindings/_bleio/Adapter.c msgid "window must be <= interval" msgstr "" @@ -4596,7 +4281,17 @@ msgstr "" msgid "wrong axis specified" msgstr "" -#: extmod/ulab/code/numpy/compare.c extmod/ulab/code/numpy/vector.c +#: extmod/ulab/code/numpy/io/io.c +msgid "wrong dtype" +msgstr "" + +#: extmod/ulab/code/numpy/transform.c +msgid "wrong index type" +msgstr "" + +#: extmod/ulab/code/numpy/compare.c extmod/ulab/code/numpy/create.c +#: extmod/ulab/code/numpy/io/io.c extmod/ulab/code/numpy/transform.c +#: extmod/ulab/code/numpy/vector.c msgid "wrong input type" msgstr "" @@ -4604,6 +4299,10 @@ msgstr "" msgid "wrong length of condition array" msgstr "" +#: extmod/ulab/code/numpy/transform.c +msgid "wrong length of index array" +msgstr "" + #: extmod/ulab/code/numpy/create.c py/objarray.c py/objstr.c msgid "wrong number of arguments" msgstr "" @@ -4624,10 +4323,6 @@ msgstr "" msgid "xTaskCreate failed" msgstr "" -#: shared-bindings/displayio/Shape.c -msgid "y should be an int" -msgstr "" - #: shared-module/displayio/Shape.c msgid "y value out of bounds" msgstr "" diff --git a/locale/cs.po b/locale/cs.po index 5a87f5bc06..9bb05d77d0 100644 --- a/locale/cs.po +++ b/locale/cs.po @@ -6,15 +6,15 @@ msgstr "" "Project-Id-Version: PACKAGE VERSION\n" "Report-Msgid-Bugs-To: \n" "POT-Creation-Date: 2021-01-04 12:55-0600\n" -"PO-Revision-Date: 2021-12-23 01:53+0000\n" -"Last-Translator: dronecz \n" +"PO-Revision-Date: 2022-06-11 10:17+0000\n" +"Last-Translator: Matěj Soukup \n" "Language-Team: LANGUAGE \n" "Language: cs\n" "MIME-Version: 1.0\n" "Content-Type: text/plain; charset=UTF-8\n" "Content-Transfer-Encoding: 8bit\n" "Plural-Forms: nplurals=3; plural=(n==1) ? 0 : (n>=2 && n<=4) ? 1 : 2;\n" -"X-Generator: Weblate 4.10.1\n" +"X-Generator: Weblate 4.13-dev\n" #: main.c msgid "" @@ -29,6 +29,8 @@ msgid "" "\n" "Code stopped by auto-reload. Reloading soon.\n" msgstr "" +"\n" +"Kód byl zastaven kvůli automatickému načtení. K načtení dojde brzy.\n" #: supervisor/shared/safe_mode.c msgid "" @@ -65,16 +67,38 @@ msgstr " výstup:\n" msgid "%%c requires int or char" msgstr "%%c vyžaduje int nebo char" +#: main.c +#, c-format +msgid "%02X" +msgstr "" + #: shared-bindings/rgbmatrix/RGBMatrix.c #, c-format msgid "" "%d address pins, %d rgb pins and %d tiles indicate a height of %d, not %d" msgstr "%d adresní pin, %d rgb pin a %d dlaždice indikuje výšku %d, ne %d" +#: ports/atmel-samd/common-hal/alarm/__init__.c +#: ports/cxd56/common-hal/analogio/AnalogOut.c ports/cxd56/common-hal/rtc/RTC.c +#: ports/espressif/common-hal/rtc/RTC.c +#: ports/mimxrt10xx/common-hal/analogio/AnalogOut.c +#: ports/mimxrt10xx/common-hal/rtc/RTC.c ports/nrf/common-hal/alarm/__init__.c +#: ports/nrf/common-hal/analogio/AnalogOut.c ports/nrf/common-hal/rtc/RTC.c +#: ports/raspberrypi/common-hal/alarm/__init__.c +#: ports/raspberrypi/common-hal/analogio/AnalogOut.c +#: ports/raspberrypi/common-hal/rtc/RTC.c ports/stm/common-hal/alarm/__init__.c +#: ports/stm/common-hal/rtc/RTC.c +msgid "%q" +msgstr "%q" + #: shared-bindings/microcontroller/Pin.c msgid "%q and %q contain duplicate pins" msgstr "%q a %q obsahují duplicitní piny" +#: ports/atmel-samd/common-hal/audioio/AudioOut.c +msgid "%q and %q must be different" +msgstr "%q a %q musí být rozdílné" + #: shared-bindings/microcontroller/Pin.c msgid "%q contains duplicate pins" msgstr "%q obsahuje duplicitní piny" @@ -83,16 +107,12 @@ msgstr "%q obsahuje duplicitní piny" msgid "%q failure: %d" msgstr "%q: selhání %d" +#: shared-bindings/digitalio/DigitalInOut.c #: shared-bindings/microcontroller/Pin.c msgid "%q in use" msgstr "%q se právě používá" -#: ports/atmel-samd/common-hal/pulseio/PulseIn.c -#: ports/cxd56/common-hal/pulseio/PulseIn.c -#: ports/nrf/common-hal/pulseio/PulseIn.c -#: ports/raspberrypi/common-hal/pulseio/PulseIn.c -#: ports/stm/common-hal/pulseio/PulseIn.c py/obj.c py/objstr.c -#: py/objstrunicode.c +#: py/obj.c py/objstr.c py/objstrunicode.c msgid "%q index out of range" msgstr "Index %q je mimo rozsah" @@ -100,13 +120,33 @@ msgstr "Index %q je mimo rozsah" msgid "%q indices must be integers, not %s" msgstr "Indexy %q musí být celá čísla, nikoli %s" +#: shared-module/bitbangio/SPI.c +msgid "%q init failed" +msgstr "Inicializace %q selhala" + +#: py/argcheck.c +msgid "%q length must be %d" +msgstr "Délka %q musí být %d" + #: py/argcheck.c msgid "%q length must be %d-%d" -msgstr "%q délka musí být %d-%d" +msgstr "%q délka musí být %d-%d" -#: shared-bindings/busio/I2C.c shared-bindings/usb_hid/Device.c +#: py/argcheck.c +msgid "%q length must be <= %d" +msgstr "Délka %q musí být <= %d" + +#: py/argcheck.c +msgid "%q length must be >= %d" +msgstr "Délka %q musí být >= %d" + +#: shared-bindings/busio/I2C.c msgid "%q length must be >= 1" -msgstr "%q délka musí být >= 1" +msgstr "%q délka musí být >= 1" + +#: py/argcheck.c +msgid "%q must be %d" +msgstr "%q musí být %d" #: py/argcheck.c msgid "%q must be %d-%d" @@ -114,7 +154,7 @@ msgstr "%q musí být %d-%d" #: shared-bindings/displayio/Display.c msgid "%q must be 1 when %q is True" -msgstr "" +msgstr "%q musí být 1, pokud %q je True" #: py/argcheck.c shared-bindings/gifio/GifWriter.c msgid "%q must be <= %d" @@ -124,30 +164,18 @@ msgstr "%q musí být <= %d" msgid "%q must be >= %d" msgstr "%q musí být >= %d" -#: py/argcheck.c shared-bindings/memorymonitor/AllocationAlarm.c -msgid "%q must be >= 0" -msgstr "%q musí být >= 0" - -#: shared-bindings/_bleio/CharacteristicBuffer.c -#: shared-bindings/_bleio/PacketBuffer.c shared-bindings/displayio/Group.c -#: shared-bindings/displayio/Shape.c -#: shared-bindings/memorymonitor/AllocationAlarm.c -#: shared-bindings/vectorio/Circle.c shared-bindings/vectorio/Rectangle.c -msgid "%q must be >= 1" -msgstr "%q musí být > = 1" +#: shared-bindings/analogbufio/BufferedIn.c +#: shared-bindings/audiocore/RawSample.c +msgid "%q must be a bytearray or array of type 'h', 'H', 'b', or 'B'" +msgstr "" #: py/argcheck.c msgid "%q must be a string" msgstr "%q musí být string" -#: shared-module/vectorio/Polygon.c -msgid "%q must be a tuple of length 2" -msgstr "%q musí být n-tice délky 2" - -#: ports/espressif/common-hal/imagecapture/ParallelImageCapture.c -#: shared-module/vectorio/VectorShape.c -msgid "%q must be between %d and %d" -msgstr "%q musí být mezi %d a %d" +#: py/argcheck.c +msgid "%q must be an int" +msgstr "%q musí být int" #: py/argcheck.c msgid "%q must be of type %q" @@ -155,7 +183,7 @@ msgstr "%q musí být typu %q" #: shared-bindings/digitalio/Pull.c msgid "%q must be of type %q or None" -msgstr "" +msgstr "%q musí být typu %q nebo None" #: ports/atmel-samd/common-hal/busio/UART.c msgid "%q must be power of 2" @@ -165,7 +193,11 @@ msgstr "%q musí být mocnina 2" msgid "%q out of bounds" msgstr "%q je mimo hranice" +#: ports/atmel-samd/common-hal/pulseio/PulseIn.c +#: ports/cxd56/common-hal/pulseio/PulseIn.c +#: ports/nrf/common-hal/pulseio/PulseIn.c #: ports/raspberrypi/common-hal/rp2pio/StateMachine.c +#: ports/stm/common-hal/pulseio/PulseIn.c py/argcheck.c #: shared-bindings/canio/Match.c msgid "%q out of range" msgstr "%q je mimo rozsah" @@ -174,10 +206,6 @@ msgstr "%q je mimo rozsah" msgid "%q pin invalid" msgstr "pin %q není platný" -#: shared-bindings/fontio/BuiltinFont.c -msgid "%q should be an int" -msgstr "%q by měl být int" - #: shared-bindings/usb_hid/Device.c msgid "%q with a report ID of 0 must be of length 1" msgstr "%q s ID 0 musím být délky 1" @@ -190,7 +218,11 @@ msgstr "%q() vyžaduje %d pozičních argumentů, ale %d jich bylo zadáno" msgid "%q, %q, and %q must all be the same length" msgstr "%q, %q, a %q musí mít všechny shodnou délku" -#: ports/espressif/bindings/espidf/__init__.c ports/espressif/esp_error.c +#: py/objint.c +msgid "%q=%q" +msgstr "" + +#: ports/espressif/common-hal/espidf/__init__.c ports/espressif/esp_error.c #, c-format msgid "%s error 0x%x" msgstr "%s chyba 0x%x" @@ -223,17 +255,17 @@ msgstr "'%s' očekává popisek" #: py/emitinlinethumb.c py/emitinlinextensa.c #, c-format msgid "'%s' expects a register" -msgstr "'%s' očekává register" +msgstr "'%s' očekává registr" #: py/emitinlinethumb.c #, c-format msgid "'%s' expects a special register" -msgstr "'%s' očekává speciální register" +msgstr "'%s' očekává speciální registr" #: py/emitinlinethumb.c #, c-format msgid "'%s' expects an FPU register" -msgstr "'%s' očekává register FPU" +msgstr "'%s' očekává registr FPU" #: py/emitinlinethumb.c #, c-format @@ -275,7 +307,7 @@ msgstr "'%s' objekt nepodporuje přiřazení položky" msgid "'%s' object doesn't support item deletion" msgstr "'%s' objekt nepodporuje smazání položky" -#: py/runtime.c +#: ports/raspberrypi/common-hal/wifi/Radio.c py/runtime.c msgid "'%s' object has no attribute '%q'" msgstr "'%s' objekt nemá žádný atribut '%q'" @@ -290,59 +322,55 @@ msgstr "" #: shared-module/struct/__init__.c msgid "'S' and 'O' are not supported format types" -msgstr "" +msgstr "'S' a 'O' nejsou podporované typy formátů" #: py/compile.c msgid "'align' requires 1 argument" -msgstr "" +msgstr "'align' vyžaduje 1 argument" #: py/compile.c msgid "'await' outside function" -msgstr "" +msgstr "'await' je volán mimo funkci" #: py/compile.c msgid "'await', 'async for' or 'async with' outside async function" -msgstr "" +msgstr "'await', 'async for' nebo 'async' je volán mimo async" #: py/compile.c msgid "'break' outside loop" -msgstr "" +msgstr "'break' je volán vně cyklu" #: py/compile.c msgid "'continue' outside loop" -msgstr "" +msgstr "'continue' je volán vně cyklu" #: py/objgenerator.c msgid "'coroutine' object is not an iterator" -msgstr "" +msgstr "Objekt 'coroutine' není iterátor" #: py/compile.c msgid "'data' requires at least 2 arguments" -msgstr "" +msgstr "'data' vyžaduje nejméně 2 argumenty" #: py/compile.c msgid "'data' requires integer arguments" -msgstr "" +msgstr "'data' vyžaduje celočíselné argumenty" #: py/compile.c msgid "'label' requires 1 argument" -msgstr "" +msgstr "'label' vyžaduje 1 argument" #: py/compile.c msgid "'return' outside function" -msgstr "" +msgstr "'return' je volán mimo funkci" #: py/compile.c msgid "'yield from' inside async function" -msgstr "" +msgstr "'yield from' volán uvnitř funkce async" #: py/compile.c msgid "'yield' outside function" -msgstr "" - -#: shared-module/vectorio/VectorShape.c -msgid "(x,y) integers required" -msgstr "" +msgstr "'yield' je volán mimo funkci" #: py/compile.c msgid "*x must be assignment target" @@ -350,7 +378,7 @@ msgstr "" #: py/obj.c msgid ", in %q\n" -msgstr ", v %q\n" +msgstr ", v% q\n" #: py/objcomplex.c msgid "0.0 to a complex power" @@ -358,74 +386,69 @@ msgstr "" #: py/modbuiltins.c msgid "3-arg pow() not supported" -msgstr "" +msgstr "pow() nepodporuje 3 argumenty" #: shared-module/msgpack/__init__.c msgid "64 bit types" -msgstr "" +msgstr "64 bit typy" #: ports/atmel-samd/common-hal/alarm/pin/PinAlarm.c #: ports/atmel-samd/common-hal/countio/Counter.c #: ports/atmel-samd/common-hal/rotaryio/IncrementalEncoder.c msgid "A hardware interrupt channel is already in use" -msgstr "" +msgstr "Kanál hardwarového přerušení je již používán" #: ports/espressif/common-hal/analogio/AnalogIn.c msgid "ADC2 is being used by WiFi" -msgstr "" +msgstr "WiFi používá ADC2" #: shared-bindings/_bleio/Address.c shared-bindings/ipaddress/IPv4Address.c #, c-format msgid "Address must be %d bytes long" -msgstr "" - -#: shared-bindings/_bleio/Address.c -msgid "Address type out of range" -msgstr "" +msgstr "Adresa musí být %d bajtů dlouhá" #: ports/espressif/common-hal/canio/CAN.c msgid "All CAN peripherals are in use" -msgstr "" +msgstr "Všechny CAN periferie jsou používány" #: ports/espressif/common-hal/busio/I2C.c -#: ports/espressif/common-hal/i2cperipheral/I2CPeripheral.c +#: ports/espressif/common-hal/i2ctarget/I2CTarget.c #: ports/nrf/common-hal/busio/I2C.c msgid "All I2C peripherals are in use" -msgstr "" +msgstr "Všechny I2C periferie jsou používány" #: ports/espressif/common-hal/countio/Counter.c #: ports/espressif/common-hal/frequencyio/FrequencyIn.c #: ports/espressif/common-hal/rotaryio/IncrementalEncoder.c msgid "All PCNT units in use" -msgstr "" +msgstr "Všechny PCNT jednotky jsou používány" #: ports/atmel-samd/common-hal/canio/Listener.c #: ports/espressif/common-hal/canio/Listener.c #: ports/stm/common-hal/canio/Listener.c msgid "All RX FIFOs in use" -msgstr "" +msgstr "Všechny RX FIFO jsou používány" #: ports/espressif/common-hal/busio/SPI.c ports/nrf/common-hal/busio/SPI.c msgid "All SPI peripherals are in use" -msgstr "" +msgstr "Všechny SPI periferie jsou používány" #: ports/espressif/common-hal/busio/UART.c ports/nrf/common-hal/busio/UART.c #: ports/raspberrypi/common-hal/busio/UART.c msgid "All UART peripherals are in use" -msgstr "" +msgstr "Všechny UART periferie jsou používány" #: ports/nrf/common-hal/countio/Counter.c #: ports/nrf/common-hal/pulseio/PulseIn.c #: ports/nrf/common-hal/rotaryio/IncrementalEncoder.c #: shared-bindings/pwmio/PWMOut.c msgid "All channels in use" -msgstr "" +msgstr "Všechny kanály jsou používány" #: ports/atmel-samd/common-hal/audioio/AudioOut.c msgid "All event channels in use" -msgstr "" +msgstr "Všechny kanály událostí jsou již používány" -#: ports/raspberrypi/common-hal/pulseio/PulseIn.c #: ports/raspberrypi/common-hal/rp2pio/StateMachine.c msgid "All state machines in use" msgstr "" @@ -436,7 +459,7 @@ msgstr "" #: shared-bindings/pwmio/PWMOut.c msgid "All timers for this pin are in use" -msgstr "" +msgstr "Všechny časovače pro tento pin jsou používány" #: ports/atmel-samd/common-hal/_pew/PewPew.c #: ports/atmel-samd/common-hal/audioio/AudioOut.c @@ -453,12 +476,12 @@ msgstr "" #: ports/raspberrypi/common-hal/audiopwmio/PWMAudioOut.c #: ports/stm/peripherals/timers.c shared-bindings/pwmio/PWMOut.c msgid "All timers in use" -msgstr "" +msgstr "Všechny časovače jsou použity" #: ports/espressif/common-hal/_bleio/Adapter.c #: ports/nrf/common-hal/_bleio/Adapter.c msgid "Already advertising." -msgstr "" +msgstr "Již propagujeme." #: ports/atmel-samd/common-hal/canio/Listener.c msgid "Already have all-matches listener" @@ -467,189 +490,156 @@ msgstr "" #: shared-module/memorymonitor/AllocationAlarm.c #: shared-module/memorymonitor/AllocationSize.c msgid "Already running" -msgstr "" +msgstr "Již běží" #: ports/espressif/common-hal/wifi/Radio.c +#: ports/raspberrypi/common-hal/wifi/Radio.c msgid "Already scanning for wifi networks" -msgstr "" - -#: ports/cxd56/common-hal/analogio/AnalogIn.c -msgid "AnalogIn not supported on given pin" -msgstr "" - -#: ports/cxd56/common-hal/analogio/AnalogOut.c -#: ports/mimxrt10xx/common-hal/analogio/AnalogOut.c -#: ports/nrf/common-hal/analogio/AnalogOut.c -#: ports/raspberrypi/common-hal/analogio/AnalogOut.c -msgid "AnalogOut functionality not supported" -msgstr "" - -#: shared-bindings/analogio/AnalogOut.c -msgid "AnalogOut is only 16 bits. Value must be less than 65536." -msgstr "" - -#: ports/atmel-samd/common-hal/analogio/AnalogOut.c -msgid "AnalogOut not supported on given pin" -msgstr "" +msgstr "Již skenuje wifi sítě" #: ports/stm/common-hal/audiopwmio/PWMAudioOut.c msgid "Another PWMAudioOut is already active" -msgstr "" +msgstr "Jiný PWMAudioOut je již aktivní" #: ports/atmel-samd/common-hal/pulseio/PulseOut.c #: ports/cxd56/common-hal/pulseio/PulseOut.c msgid "Another send is already active" -msgstr "" +msgstr "Další odesílání je již aktivní" #: shared-bindings/pulseio/PulseOut.c msgid "Array must contain halfwords (type 'H')" -msgstr "" +msgstr "Pole musí obsahovat poloviční slova (typ „H“)" #: shared-bindings/alarm/SleepMemory.c shared-bindings/nvm/ByteArray.c msgid "Array values should be single bytes." -msgstr "" +msgstr "Hodnoty pole by měly být jednoduché bajty." #: shared-bindings/microcontroller/Pin.c msgid "At most %d %q may be specified (not %d)" -msgstr "" +msgstr "Lze zadat maximálně %d %q (nikoli %d)" #: shared-module/memorymonitor/AllocationAlarm.c #, c-format msgid "Attempt to allocate %d blocks" -msgstr "" +msgstr "Pokus o alokování %d bloků" #: supervisor/shared/safe_mode.c msgid "Attempted heap allocation when VM not running." -msgstr "" +msgstr "Pokus o alokaci haldy, když neběží VM." #: ports/raspberrypi/audio_dma.c msgid "Audio conversion not implemented" -msgstr "" +msgstr "Konverze audia není implementována" #: shared-bindings/wifi/Radio.c msgid "AuthMode.OPEN is not used with password" -msgstr "" +msgstr "AuthMode.OPEN nepoužívá heslo" -#: shared-bindings/wifi/Radio.c +#: shared-bindings/wifi/Radio.c supervisor/shared/web_workflow/web_workflow.c msgid "Authentication failure" -msgstr "" +msgstr "Autentizace selhala" #: main.c msgid "Auto-reload is off.\n" -msgstr "Automatické načtení je vypnuté.\n" +msgstr "Automatické načtení je vypnuto.\n" #: main.c msgid "" "Auto-reload is on. Simply save files over USB to run them or enter REPL to " "disable.\n" msgstr "" -"Automatické načtení je zapnuté. Stačí uložit soubory na USB nebo vstoupit " -"do REPLu pro jeho zakázání.\n" +"Automatické opětovné načtení je zapnuto. Jednoduše uložte soubory přes USB a " +"spusťte je, nebo vypněte REPL.\n" #: ports/espressif/common-hal/canio/CAN.c msgid "Baudrate not supported by peripheral" -msgstr "" +msgstr "Baudrate není podporován periférií" #: shared-module/displayio/Display.c #: shared-module/framebufferio/FramebufferDisplay.c msgid "Below minimum frame rate" -msgstr "" +msgstr "Pod minimální obnovovací frekvencí" #: ports/raspberrypi/common-hal/audiobusio/I2SOut.c msgid "Bit clock and word select must be sequential pins" -msgstr "" +msgstr "Bitové hodiny a výběr slov musí být sekvenční piny" #: ports/atmel-samd/common-hal/audiobusio/I2SOut.c 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 "" +msgstr "Výběr bitových hodin a slov musí sdílet jednotku hodin" #: shared-bindings/audiobusio/PDMIn.c msgid "Bit depth must be multiple of 8." -msgstr "" +msgstr "Bitová hloubka musí být násobkem 8." #: shared-bindings/bitmaptools/__init__.c msgid "Bitmap size and bits per value must match" -msgstr "" +msgstr "Velikost bitmapy a počet bitů na hodnotu se musí shodovat" #: supervisor/shared/safe_mode.c msgid "Boot device must be first device (interface #0)." -msgstr "" +msgstr "Bootovací zařízení musí být první (rozhraní #0)." #: ports/mimxrt10xx/common-hal/busio/UART.c msgid "Both RX and TX required for flow control" -msgstr "" +msgstr "RX a TX jsou vyžadovány pro kontrolu toku" #: ports/atmel-samd/common-hal/rotaryio/IncrementalEncoder.c msgid "Both pins must support hardware interrupts" -msgstr "" +msgstr "Oba piny musí podporovat hardwarové přerušení" #: shared-bindings/displayio/Display.c #: shared-bindings/framebufferio/FramebufferDisplay.c #: shared-bindings/is31fl3741/FrameBuffer.c #: shared-bindings/rgbmatrix/RGBMatrix.c msgid "Brightness must be 0-1.0" -msgstr "" +msgstr "Jas musí být 0-1,0" #: shared-bindings/displayio/Display.c #: shared-bindings/framebufferio/FramebufferDisplay.c msgid "Brightness not adjustable" -msgstr "" +msgstr "Jas není nastavitelný" #: shared-bindings/_bleio/UUID.c #, c-format msgid "Buffer + offset too small %d %d %d" -msgstr "" +msgstr "Vyrovnávací paměť + offset je příliš malý %d %d %d" #: ports/raspberrypi/bindings/rp2pio/StateMachine.c msgid "Buffer elements must be 4 bytes long or less" -msgstr "" - -#: shared-module/usb_hid/Device.c -#, c-format -msgid "Buffer incorrect size. Should be %d bytes." -msgstr "" +msgstr "Prvky bufferu musí být 4 bajty dlouhé nebo méně" #: shared-bindings/framebufferio/FramebufferDisplay.c msgid "Buffer is not a bytearray." -msgstr "" +msgstr "Buffer není bytearray." #: ports/cxd56/common-hal/camera/Camera.c shared-bindings/displayio/Display.c #: shared-bindings/framebufferio/FramebufferDisplay.c msgid "Buffer is too small" -msgstr "" +msgstr "Vyrovnávací paměť je příliš malá" -#: ports/nrf/common-hal/audiopwmio/PWMAudioOut.c #: ports/stm/common-hal/audiopwmio/PWMAudioOut.c #, c-format msgid "Buffer length %d too big. It must be less than %d" -msgstr "" +msgstr "Délka vyrovnávací paměti %d je příliš velká. Musí být menší než %d" #: ports/atmel-samd/common-hal/sdioio/SDCard.c #: ports/cxd56/common-hal/sdioio/SDCard.c shared-module/sdcardio/SDCard.c msgid "Buffer length must be a multiple of 512" -msgstr "" +msgstr "Délka vyrovnávací paměti musí být násobkem 512" #: ports/stm/common-hal/sdioio/SDCard.c shared-bindings/floppyio/__init__.c msgid "Buffer must be a multiple of 512 bytes" -msgstr "" - -#: shared-bindings/bitbangio/I2C.c -msgid "Buffer must be at least length 1" -msgstr "" +msgstr "Buffer musí být násobkem 512 bajtů" #: shared-bindings/_bleio/PacketBuffer.c #, c-format msgid "Buffer too short by %d bytes" -msgstr "" +msgstr "Buffer je příliš krátký o %d bajtů" #: ports/espressif/common-hal/imagecapture/ParallelImageCapture.c msgid "Buffers must be same size" -msgstr "" +msgstr "Buffery musí mít stejnou velikost" #: ports/atmel-samd/common-hal/paralleldisplay/ParallelBus.c #: ports/espressif/common-hal/paralleldisplay/ParallelBus.c @@ -657,31 +647,31 @@ msgstr "" #: ports/raspberrypi/common-hal/paralleldisplay/ParallelBus.c #, c-format msgid "Bus pin %d is already in use" -msgstr "" +msgstr "Sběrnicový pin %d je již používán" #: shared-bindings/_bleio/UUID.c msgid "Byte buffer must be 16 bytes." -msgstr "" - -#: shared-bindings/alarm/SleepMemory.c shared-bindings/nvm/ByteArray.c -msgid "Bytes must be between 0 and 255." -msgstr "" +msgstr "Bajtový buffer musí být 16 bajtů." #: shared-bindings/aesio/aes.c msgid "CBC blocks must be multiples of 16 bytes" -msgstr "" +msgstr "Bloky CBC musí být násobky 16 bajtů" #: supervisor/shared/safe_mode.c msgid "CIRCUITPY drive could not be found or created." -msgstr "" +msgstr "Disk CIRCUITPY nelze nalézt nebo vytvořit." -#: ports/espressif/bindings/espidf/__init__.c ports/espressif/esp_error.c +#: ports/espressif/common-hal/espidf/__init__.c ports/espressif/esp_error.c msgid "CRC or checksum was invalid" msgstr "" #: py/objtype.c msgid "Call super().__init__() before accessing native object." -msgstr "" +msgstr "Volání super().__init__() před přístupem k nativnímu objektu." + +#: ports/cxd56/common-hal/camera/Camera.c +msgid "Camera init" +msgstr "Inizializace kamery" #: ports/espressif/common-hal/alarm/pin/PinAlarm.c msgid "Can only alarm on RTC IO from deep sleep." @@ -698,63 +688,56 @@ msgstr "" #: ports/espressif/common-hal/_bleio/Characteristic.c #: ports/nrf/common-hal/_bleio/Characteristic.c msgid "Can't set CCCD on local Characteristic" -msgstr "" +msgstr "Nelze nastavit CCCD na místní charakteristiku" #: shared-bindings/storage/__init__.c shared-bindings/usb_cdc/__init__.c #: shared-bindings/usb_hid/__init__.c shared-bindings/usb_midi/__init__.c msgid "Cannot change USB devices now" -msgstr "" +msgstr "Nelze změnit USB zařízení" #: shared-bindings/_bleio/Adapter.c msgid "Cannot create a new Adapter; use _bleio.adapter;" -msgstr "" +msgstr "Není možné vytvořit nový adaptér; použití _bleio.adapter;" #: shared-bindings/displayio/Bitmap.c #: shared-bindings/memorymonitor/AllocationSize.c #: shared-bindings/pulseio/PulseIn.c msgid "Cannot delete values" -msgstr "" +msgstr "Nelze odstranit hodnoty" #: ports/atmel-samd/common-hal/digitalio/DigitalInOut.c #: ports/mimxrt10xx/common-hal/digitalio/DigitalInOut.c #: ports/nrf/common-hal/digitalio/DigitalInOut.c #: ports/raspberrypi/common-hal/digitalio/DigitalInOut.c msgid "Cannot get pull while in output mode" -msgstr "" +msgstr "Nelze získat ve výstupním režimu" #: ports/nrf/common-hal/microcontroller/Processor.c msgid "Cannot get temperature" -msgstr "" +msgstr "Nelze získat teplotu" #: shared-bindings/_bleio/Adapter.c msgid "Cannot have scan responses for extended, connectable advertisements." msgstr "" -#: ports/atmel-samd/common-hal/audioio/AudioOut.c -msgid "Cannot output both channels on the same pin" -msgstr "" - #: ports/espressif/common-hal/alarm/pin/PinAlarm.c msgid "Cannot pull on input-only pin." msgstr "" -#: shared-module/bitbangio/SPI.c -msgid "Cannot read without MISO pin." -msgstr "" - #: shared-bindings/audiobusio/PDMIn.c msgid "Cannot record to a file" -msgstr "" +msgstr "Nelze nahrávat do souboru" #: shared-module/storage/__init__.c msgid "Cannot remount '/' when visible via USB." -msgstr "" +msgstr "Není možné znovu připojit '/', pokud je viditelné pomocí USB." #: ports/atmel-samd/common-hal/microcontroller/__init__.c #: ports/cxd56/common-hal/microcontroller/__init__.c #: ports/mimxrt10xx/common-hal/microcontroller/__init__.c -msgid "Cannot reset into bootloader because no bootloader is present." +msgid "Cannot reset into bootloader because no bootloader is present" msgstr "" +"Reset do bootloaderu není možný, protože žádný bootloader není přítomen" #: ports/espressif/common-hal/socketpool/Socket.c msgid "Cannot set socket options" @@ -762,101 +745,63 @@ msgstr "" #: shared-bindings/digitalio/DigitalInOut.c msgid "Cannot set value when direction is input." -msgstr "" +msgstr "Nelze nastavit hodnotu, když směr je vstup." #: ports/espressif/common-hal/busio/UART.c #: ports/mimxrt10xx/common-hal/busio/UART.c msgid "Cannot specify RTS or CTS in RS485 mode" -msgstr "" +msgstr "Nelze určit RTS nebo CTS v režimu RS485" #: py/objslice.c msgid "Cannot subclass slice" -msgstr "" +msgstr "Nelze použít řez podtřídy" #: shared-module/bitbangio/SPI.c -msgid "Cannot transfer without MOSI and MISO pins." +msgid "Cannot transfer without MOSI and MISO pins" msgstr "" #: shared-bindings/pwmio/PWMOut.c msgid "Cannot vary frequency on a timer that is already in use" +msgstr "Nelze měnit frekvenci časovače, který je již používán" + +#: ports/nrf/common-hal/alarm/pin/PinAlarm.c +msgid "Cannot wake on pin edge, only level" msgstr "" #: ports/espressif/common-hal/alarm/pin/PinAlarm.c -#: ports/nrf/common-hal/alarm/pin/PinAlarm.c msgid "Cannot wake on pin edge. Only level." msgstr "" -#: shared-module/bitbangio/SPI.c -msgid "Cannot write without MOSI pin." -msgstr "" - #: shared-bindings/_bleio/CharacteristicBuffer.c msgid "CharacteristicBuffer writing not provided" -msgstr "" +msgstr "CharacteristicBuffer psaní není poskytováno" #: supervisor/shared/safe_mode.c msgid "CircuitPython core code crashed hard. Whoops!\n" -msgstr "" +msgstr "Jádro kódu CircuitPython tvrdě havarovalo. Jejda!\n" #: supervisor/shared/safe_mode.c msgid "CircuitPython was unable to allocate the heap." -msgstr "" - -#: shared-module/bitbangio/SPI.c -msgid "Clock pin init failed." -msgstr "" +msgstr "CircuitPython nedokázal alokovat haldu." #: shared-module/bitbangio/I2C.c msgid "Clock stretch too long" -msgstr "" +msgstr "Hodiny jsou příliš dlouhé" #: ports/atmel-samd/common-hal/audiobusio/I2SOut.c msgid "Clock unit in use" -msgstr "" - -#: shared-bindings/displayio/FourWire.c shared-bindings/displayio/I2CDisplay.c -#: shared-bindings/paralleldisplay/ParallelBus.c -msgid "Command must be an int between 0 and 255" -msgstr "" +msgstr "Jednotka hodin je používána" #: shared-bindings/_bleio/Connection.c msgid "" "Connection has been disconnected and can no longer be used. Create a new " "connection." msgstr "" +"Připojení bylo odpojeno a nelze jej dále používat. Vytvořte nové připojení." #: py/persistentcode.c msgid "Corrupt .mpy file" -msgstr "" - -#: ports/cxd56/common-hal/camera/Camera.c -msgid "Could not initialize Camera" -msgstr "" - -#: ports/cxd56/common-hal/gnss/GNSS.c -msgid "Could not initialize GNSS" -msgstr "" - -#: ports/cxd56/common-hal/sdioio/SDCard.c -msgid "Could not initialize SDCard" -msgstr "" - -#: ports/atmel-samd/common-hal/busio/UART.c ports/cxd56/common-hal/busio/UART.c -#: ports/espressif/common-hal/busio/UART.c -msgid "Could not initialize UART" -msgstr "" - -#: ports/stm/common-hal/pwmio/PWMOut.c -msgid "Could not re-init channel" -msgstr "" - -#: ports/stm/common-hal/pwmio/PWMOut.c -msgid "Could not re-init timer" -msgstr "" - -#: ports/stm/common-hal/pwmio/PWMOut.c -msgid "Could not restart PWM" -msgstr "" +msgstr "Poškozený soubor .mpy" #: ports/espressif/common-hal/neopixel_write/__init__.c msgid "Could not retrieve clock" @@ -864,58 +809,44 @@ msgstr "" #: shared-bindings/_bleio/Adapter.c msgid "Could not set address" -msgstr "" +msgstr "Není možné nastavit adresu" #: shared-bindings/pwmio/PWMOut.c msgid "Could not start PWM" -msgstr "" +msgstr "Nelze spustit PWM" #: ports/stm/common-hal/busio/UART.c msgid "Could not start interrupt, RX busy" -msgstr "" +msgstr "Nelze začít přerušení, RX je zaneprázdněn" #: shared-module/audiomp3/MP3Decoder.c msgid "Couldn't allocate decoder" -msgstr "" - -#: shared-module/audiocore/WaveFile.c shared-module/audiomixer/Mixer.c -#: shared-module/audiomp3/MP3Decoder.c -msgid "Couldn't allocate first buffer" -msgstr "" - -#: shared-module/audiomp3/MP3Decoder.c -msgid "Couldn't allocate input buffer" -msgstr "" - -#: shared-module/audiocore/WaveFile.c shared-module/audiomixer/Mixer.c -#: shared-module/audiomp3/MP3Decoder.c -msgid "Couldn't allocate second buffer" -msgstr "" +msgstr "Dekodér nelze přiřadit" #: supervisor/shared/safe_mode.c msgid "Crash into the HardFault_Handler." -msgstr "" +msgstr "Pád do HardFault_Handler." #: ports/stm/common-hal/analogio/AnalogOut.c msgid "DAC Channel Init Error" -msgstr "" +msgstr "Chyba inicializace kanálu DAC" #: ports/stm/common-hal/analogio/AnalogOut.c msgid "DAC Device Init Error" -msgstr "" +msgstr "Chyba inicializace zařízení DAC" #: ports/atmel-samd/common-hal/audioio/AudioOut.c msgid "DAC already in use" -msgstr "" +msgstr "DAC se již používá" #: ports/atmel-samd/common-hal/paralleldisplay/ParallelBus.c #: ports/nrf/common-hal/paralleldisplay/ParallelBus.c msgid "Data 0 pin must be byte aligned" -msgstr "" +msgstr "Datový pin 0 musí být zarovnán na bajty" #: shared-module/audiocore/WaveFile.c msgid "Data chunk must follow fmt chunk" -msgstr "" +msgstr "Datový blok musí následovat fmt blok" #: ports/espressif/common-hal/_bleio/Adapter.c #: ports/nrf/common-hal/_bleio/Adapter.c @@ -925,7 +856,7 @@ msgstr "" #: ports/espressif/common-hal/_bleio/Adapter.c #: ports/nrf/common-hal/_bleio/Adapter.c msgid "Data too large for advertisement packet" -msgstr "" +msgstr "Data jsou příliš velká pro propagovaný paket" #: ports/stm/common-hal/alarm/pin/PinAlarm.c msgid "Deep sleep pins must use a rising edge with pulldown" @@ -933,25 +864,25 @@ msgstr "" #: shared-bindings/audiobusio/PDMIn.c msgid "Destination capacity is smaller than destination_length." -msgstr "" +msgstr "Cílová kapacita je menší než destination_length." #: ports/nrf/common-hal/audiobusio/I2SOut.c msgid "Device in use" -msgstr "" - -#: ports/cxd56/common-hal/digitalio/DigitalInOut.c -msgid "DigitalInOut not supported on given pin" -msgstr "" +msgstr "Zařízení je používáno" #: shared-bindings/displayio/Display.c #: shared-bindings/framebufferio/FramebufferDisplay.c msgid "Display must have a 16 bit colorspace." -msgstr "" +msgstr "Displej musí mít 16bitový barevný prostor." #: shared-bindings/displayio/Display.c #: shared-bindings/displayio/EPaperDisplay.c #: shared-bindings/framebufferio/FramebufferDisplay.c msgid "Display rotation must be in 90 degree increments" +msgstr "Otočení displeje musí být po 90 stupních" + +#: main.c +msgid "Done" msgstr "" #: shared-bindings/digitalio/DigitalInOut.c @@ -960,7 +891,7 @@ msgstr "" #: shared-bindings/aesio/aes.c msgid "ECB only operates on 16 bytes at a time" -msgstr "" +msgstr "ECB operuje najednou pouze 16 bajtů" #: ports/espressif/common-hal/busio/SPI.c #: ports/espressif/common-hal/canio/CAN.c @@ -972,35 +903,34 @@ msgstr "" #: ports/atmel-samd/common-hal/pulseio/PulseIn.c #: ports/cxd56/common-hal/pulseio/PulseIn.c msgid "EXTINT channel already in use" -msgstr "" +msgstr "EXTINT kanál se již používá" #: shared-module/synthio/MidiTrack.c #, c-format msgid "Error in MIDI stream at position %d" -msgstr "" +msgstr "Chyba v MIDI přenosu na pozici %d" #: extmod/modure.c msgid "Error in regex" -msgstr "" +msgstr "Chyba v regulárním výrazu" #: shared-bindings/socketpool/Socket.c shared-bindings/ssl/SSLSocket.c msgid "Error: Failure to bind" msgstr "" -#: ports/raspberrypi/bindings/rp2pio/StateMachine.c py/enum.c -#: shared-bindings/_bleio/__init__.c shared-bindings/aesio/aes.c -#: shared-bindings/busio/SPI.c shared-bindings/microcontroller/Pin.c +#: py/enum.c shared-bindings/_bleio/__init__.c shared-bindings/aesio/aes.c +#: shared-bindings/alarm/__init__.c shared-bindings/busio/SPI.c +#: shared-bindings/microcontroller/Pin.c #: shared-bindings/neopixel_write/__init__.c msgid "Expected a %q" +msgstr "Očekává se %q" + +#: ports/raspberrypi/bindings/cyw43/__init__.c +msgid "Expected a %q or %q" msgstr "" #: shared-bindings/alarm/__init__.c -msgid "Expected an alarm" -msgstr "" - -#: shared-module/adafruit_pixelbuf/PixelBuf.c -#, c-format -msgid "Expected tuple of length %d, got %d" +msgid "Expected an %q" msgstr "" #: ports/espressif/common-hal/_bleio/Adapter.c @@ -1014,7 +944,7 @@ msgstr "" #: extmod/ulab/code/numpy/fft/fft_tools.c msgid "FFT is implemented for linear arrays only" -msgstr "" +msgstr "FFT je implementován pouze pro lineární pole" #: ports/espressif/common-hal/ssl/SSLSocket.c msgid "Failed SSL handshake" @@ -1022,32 +952,20 @@ msgstr "" #: shared-bindings/ps2io/Ps2.c msgid "Failed sending command." -msgstr "" +msgstr "Nepodařilo se odeslat příkaz." #: ports/nrf/sd_mutex.c #, c-format msgid "Failed to acquire mutex, err 0x%04x" msgstr "" -#: ports/mimxrt10xx/common-hal/busio/UART.c ports/nrf/common-hal/busio/UART.c -#: ports/raspberrypi/common-hal/busio/UART.c -msgid "Failed to allocate RX buffer" -msgstr "" - -#: ports/atmel-samd/common-hal/busio/UART.c -#: ports/atmel-samd/common-hal/pulseio/PulseIn.c -#: ports/cxd56/common-hal/pulseio/PulseIn.c -#: ports/espressif/common-hal/pulseio/PulseIn.c -#: ports/nrf/common-hal/pulseio/PulseIn.c -#: ports/raspberrypi/common-hal/pulseio/PulseIn.c -#: ports/stm/common-hal/pulseio/PulseIn.c -#, c-format -msgid "Failed to allocate RX buffer of %d bytes" -msgstr "" +#: shared-module/rgbmatrix/RGBMatrix.c +msgid "Failed to allocate %q buffer" +msgstr "Chyba alokace %q bufferu" #: ports/espressif/common-hal/wifi/__init__.c msgid "Failed to allocate Wifi memory" -msgstr "" +msgstr "Chyba alokace paměti WiFi" #: ports/espressif/common-hal/wifi/ScannedNetworks.c msgid "Failed to allocate wifi scan memory" @@ -1060,19 +978,15 @@ msgstr "" #: ports/espressif/common-hal/_bleio/Adapter.c #: ports/nrf/common-hal/_bleio/Adapter.c msgid "Failed to connect: internal error" -msgstr "" +msgstr "Připojení se nezdařilo: interní chyba" #: ports/nrf/common-hal/_bleio/Adapter.c msgid "Failed to connect: timeout" -msgstr "" - -#: ports/espressif/common-hal/wifi/__init__.c -msgid "Failed to init wifi" -msgstr "" +msgstr "Nepodařilo se připojit: časový limit" #: shared-module/audiomp3/MP3Decoder.c msgid "Failed to parse MP3 file" -msgstr "" +msgstr "Soubor MP3 se nepodařilo analyzovat" #: ports/nrf/sd_mutex.c #, c-format @@ -1081,15 +995,15 @@ msgstr "" #: supervisor/shared/safe_mode.c msgid "Failed to write internal flash." -msgstr "" +msgstr "Nepodařilo se zapsat do interní paměti." #: supervisor/shared/safe_mode.c msgid "Fatal error." -msgstr "" +msgstr "Fatální chyba." #: py/moduerrno.c msgid "File exists" -msgstr "" +msgstr "soubor existuje" #: ports/atmel-samd/common-hal/canio/Listener.c #: ports/espressif/common-hal/canio/Listener.c @@ -1099,7 +1013,7 @@ msgstr "" #: ports/espressif/common-hal/dualbank/__init__.c msgid "Firmware image is invalid" -msgstr "" +msgstr "Obraz firmwaru je nevalidní" #: shared-bindings/bitmaptools/__init__.c msgid "For L8 colorspace, input bitmap must have 8 bits per pixel" @@ -1111,17 +1025,14 @@ msgstr "" #: ports/cxd56/common-hal/camera/Camera.c msgid "Format not supported" -msgstr "" - -#: shared-module/framebufferio/FramebufferDisplay.c -#, c-format -msgid "Framebuffer requires %d bytes" -msgstr "" +msgstr "Formát není podporován" #: ports/mimxrt10xx/common-hal/microcontroller/Processor.c msgid "" "Frequency must be 24, 150, 396, 450, 528, 600, 720, 816, 912, 960 or 1008 Mhz" msgstr "" +"Frekvence musí být 24, 150, 396, 450, 528, 600, 720, 816, 912, 960 nebo 1008 " +"Mhz" #: shared-bindings/pwmio/PWMOut.c msgid "Frequency must match existing PWMOut using this timer" @@ -1130,17 +1041,21 @@ msgstr "" #: shared-bindings/bitbangio/I2C.c shared-bindings/bitbangio/SPI.c #: shared-bindings/busio/I2C.c shared-bindings/busio/SPI.c msgid "Function requires lock" -msgstr "" +msgstr "Funkce vyžaduje zámek" -#: ports/espressif/bindings/espidf/__init__.c ports/espressif/esp_error.c +#: ports/cxd56/common-hal/gnss/GNSS.c +msgid "GNSS init" +msgstr "Inicializace GNSS" + +#: ports/espressif/common-hal/espidf/__init__.c ports/espressif/esp_error.c msgid "Generic Failure" -msgstr "" +msgstr "Základní chyba" #: shared-bindings/displayio/Display.c #: shared-bindings/displayio/EPaperDisplay.c #: shared-bindings/framebufferio/FramebufferDisplay.c msgid "Group already used" -msgstr "" +msgstr "Skupina již byla použita" #: ports/atmel-samd/common-hal/busio/SPI.c ports/cxd56/common-hal/busio/SPI.c #: ports/espressif/common-hal/busio/SPI.c @@ -1153,27 +1068,24 @@ msgstr "" #: ports/stm/common-hal/busio/SPI.c ports/stm/common-hal/canio/CAN.c #: ports/stm/common-hal/sdioio/SDCard.c msgid "Hardware busy, try alternative pins" -msgstr "" +msgstr "Hardware je zaneprázdněn, zkuste alternativní piny" #: ports/mimxrt10xx/common-hal/busio/UART.c ports/stm/common-hal/busio/UART.c msgid "Hardware in use, try alternative pins" -msgstr "" - -#: shared-bindings/wifi/Radio.c -msgid "Hostname must be between 1 and 253 characters" -msgstr "" +msgstr "Hardware je používán, zkuste alternativní piny" #: extmod/vfs_posix_file.c py/objstringio.c msgid "I/O operation on closed file" msgstr "" #: ports/stm/common-hal/busio/I2C.c -msgid "I2C Init Error" -msgstr "" +msgid "I2C init error" +msgstr "Chyba inicializace I2C" #: ports/raspberrypi/common-hal/busio/I2C.c +#: ports/raspberrypi/common-hal/i2ctarget/I2CTarget.c msgid "I2C peripheral in use" -msgstr "" +msgstr "Periférie I2C je používána" #: shared-bindings/audiobusio/I2SOut.c msgid "I2SOut not available" @@ -1182,7 +1094,7 @@ msgstr "" #: shared-bindings/aesio/aes.c #, c-format msgid "IV must be %d bytes long" -msgstr "" +msgstr "IV musí být dlouhé %d bajtů" #: ports/raspberrypi/bindings/rp2pio/StateMachine.c msgid "In-buffer elements must be <= 4 bytes long" @@ -1193,10 +1105,12 @@ msgid "" "Incompatible .mpy file. Please update all .mpy files. See http://adafru.it/" "mpy-update for more info." msgstr "" +"Nekompatibilní soubor .mpy. Aktualizujte prosím všechny soubory .mpy. Další " +"informace naleznete na adrese http://adafru.it/mpy-update." #: shared-bindings/_pew/PewPew.c msgid "Incorrect buffer size" -msgstr "" +msgstr "Nesprávná velikost vyrovnávací paměti" #: ports/raspberrypi/bindings/rp2pio/StateMachine.c msgid "Init program size invalid" @@ -1221,11 +1135,11 @@ msgstr "" #: ports/atmel-samd/common-hal/pulseio/PulseIn.c msgid "Input taking too long" -msgstr "" +msgstr "Vstup trval příliš dlouho" #: ports/espressif/common-hal/neopixel_write/__init__.c py/moduerrno.c msgid "Input/output error" -msgstr "" +msgstr "Vstupně/výstupní chyba" #: ports/raspberrypi/common-hal/rp2pio/StateMachine.c #, c-format @@ -1249,11 +1163,11 @@ msgstr "" #: ports/nrf/common-hal/_bleio/__init__.c msgid "Insufficient authentication" -msgstr "" +msgstr "Nedostatečná autentizace" #: ports/nrf/common-hal/_bleio/__init__.c msgid "Insufficient encryption" -msgstr "" +msgstr "Nedostatečné šifrování" #: ports/espressif/common-hal/wifi/Radio.c msgid "Interface must be started" @@ -1269,265 +1183,108 @@ msgstr "" #: ports/espressif/common-hal/paralleldisplay/ParallelBus.c msgid "Internal error" -msgstr "" +msgstr "Interní chyba" #: shared-module/rgbmatrix/RGBMatrix.c #, c-format msgid "Internal error #%d" +msgstr "Vnitřní chyba #%d" + +#: supervisor/shared/safe_mode.c +msgid "Internal watchdog timer expired." msgstr "" -#: shared-bindings/sdioio/SDCard.c shared-module/usb_hid/Device.c +#: py/argcheck.c shared-bindings/digitalio/DigitalInOut.c msgid "Invalid %q" msgstr "" -#: ports/atmel-samd/common-hal/audiobusio/I2SOut.c -#: ports/atmel-samd/common-hal/audiobusio/PDMIn.c -#: ports/atmel-samd/common-hal/imagecapture/ParallelImageCapture.c -#: ports/mimxrt10xx/common-hal/busio/UART.c +#: shared-bindings/microcontroller/Pin.c msgid "Invalid %q pin" -msgstr "" - -#: ports/stm/common-hal/busio/I2C.c ports/stm/common-hal/busio/SPI.c -#: ports/stm/common-hal/busio/UART.c ports/stm/common-hal/canio/CAN.c -#: ports/stm/common-hal/sdioio/SDCard.c -msgid "Invalid %q pin selection" -msgstr "" +msgstr "Neplatný pin %q" #: ports/stm/common-hal/analogio/AnalogIn.c msgid "Invalid ADC Unit value" -msgstr "" - -#: ports/espressif/common-hal/wifi/Radio.c -msgid "Invalid AuthMode" -msgstr "" +msgstr "Neplatná hodnota jednotky ADC" #: ports/espressif/common-hal/_bleio/__init__.c #: ports/nrf/common-hal/_bleio/__init__.c msgid "Invalid BLE parameter" -msgstr "" - -#: shared-module/displayio/OnDiskBitmap.c -msgid "Invalid BMP file" -msgstr "" +msgstr "Chybný BLE parametr" #: shared-bindings/wifi/Radio.c msgid "Invalid BSSID" -msgstr "" - -#: ports/espressif/common-hal/analogio/AnalogOut.c -#: ports/stm/common-hal/analogio/AnalogOut.c -msgid "Invalid DAC pin supplied" -msgstr "" +msgstr "Chybné BSSID" #: shared-bindings/wifi/Radio.c msgid "Invalid MAC address" -msgstr "" +msgstr "Chybná MAC adresa" -#: shared-bindings/synthio/__init__.c -msgid "Invalid MIDI file" -msgstr "" - -#: ports/atmel-samd/common-hal/pwmio/PWMOut.c -#: ports/cxd56/common-hal/pwmio/PWMOut.c -#: ports/espressif/common-hal/pwmio/PWMOut.c -#: ports/mimxrt10xx/common-hal/pwmio/PWMOut.c -#: ports/nrf/common-hal/pwmio/PWMOut.c -#: ports/raspberrypi/common-hal/pwmio/PWMOut.c shared-bindings/pwmio/PWMOut.c -msgid "Invalid PWM frequency" -msgstr "" - -#: ports/espressif/common-hal/analogio/AnalogIn.c -msgid "Invalid Pin" -msgstr "" - -#: ports/espressif/bindings/espidf/__init__.c -#: ports/espressif/common-hal/busio/I2C.c -#: ports/espressif/common-hal/i2cperipheral/I2CPeripheral.c -#: ports/espressif/esp_error.c py/moduerrno.c -#: shared-module/rgbmatrix/RGBMatrix.c +#: ports/espressif/common-hal/espidf/__init__.c ports/espressif/esp_error.c +#: py/moduerrno.c msgid "Invalid argument" -msgstr "" +msgstr "Neplatný argument" #: shared-module/displayio/Bitmap.c msgid "Invalid bits per value" msgstr "" -#: ports/nrf/common-hal/busio/UART.c ports/raspberrypi/common-hal/busio/UART.c -#: ports/stm/common-hal/busio/UART.c -msgid "Invalid buffer size" -msgstr "" - -#: shared-bindings/adafruit_pixelbuf/PixelBuf.c -msgid "Invalid byteorder string" -msgstr "" - -#: ports/atmel-samd/common-hal/frequencyio/FrequencyIn.c -#: ports/espressif/common-hal/frequencyio/FrequencyIn.c -msgid "Invalid capture period. Valid range: 1 - 500" -msgstr "" - -#: shared-bindings/audiomixer/Mixer.c -msgid "Invalid channel count" -msgstr "" - -#: ports/atmel-samd/common-hal/imagecapture/ParallelImageCapture.c -#, c-format -msgid "Invalid data_count %d" -msgstr "" - #: ports/atmel-samd/common-hal/imagecapture/ParallelImageCapture.c #, c-format msgid "Invalid data_pins[%d]" -msgstr "" - -#: shared-bindings/digitalio/DigitalInOut.c -msgid "Invalid direction." -msgstr "" - -#: shared-module/audiocore/WaveFile.c -msgid "Invalid file" -msgstr "" +msgstr "Chybný data_pin[%d]" #: shared-module/audiocore/WaveFile.c msgid "Invalid format chunk size" -msgstr "" +msgstr "Neplatná velikost bloku" #: supervisor/shared/safe_mode.c msgid "Invalid memory access." -msgstr "" - -#: extmod/vfs_fat_file.c -msgid "Invalid mode" -msgstr "" +msgstr "Neplatný přístup k paměti." #: ports/espressif/common-hal/wifi/Radio.c msgid "Invalid multicast MAC address" -msgstr "" +msgstr "Chybná multicastová MAC adresa" -#: shared-bindings/bitbangio/SPI.c shared-bindings/busio/SPI.c -msgid "Invalid number of bits" -msgstr "" - -#: shared-bindings/bitbangio/SPI.c shared-bindings/busio/SPI.c -#: shared-bindings/displayio/FourWire.c -msgid "Invalid phase" -msgstr "" - -#: ports/atmel-samd/common-hal/audioio/AudioOut.c -#: ports/atmel-samd/common-hal/touchio/TouchIn.c -#: ports/espressif/common-hal/alarm/touch/TouchAlarm.c -#: ports/espressif/common-hal/touchio/TouchIn.c -#: ports/nrf/common-hal/alarm/pin/PinAlarm.c shared-bindings/pwmio/PWMOut.c -#: shared-module/rgbmatrix/RGBMatrix.c -msgid "Invalid pin" -msgstr "" - -#: ports/atmel-samd/common-hal/audioio/AudioOut.c -msgid "Invalid pin for left channel" -msgstr "" - -#: ports/atmel-samd/common-hal/audioio/AudioOut.c -msgid "Invalid pin for right channel" -msgstr "" - -#: ports/atmel-samd/common-hal/busio/I2C.c -#: ports/atmel-samd/common-hal/busio/SPI.c -#: ports/atmel-samd/common-hal/busio/UART.c -#: ports/atmel-samd/common-hal/i2cperipheral/I2CPeripheral.c -#: ports/cxd56/common-hal/busio/I2C.c ports/cxd56/common-hal/busio/SPI.c -#: ports/cxd56/common-hal/busio/UART.c ports/cxd56/common-hal/sdioio/SDCard.c -#: ports/espressif/common-hal/busio/I2C.c -#: ports/espressif/common-hal/busio/SPI.c -#: ports/espressif/common-hal/busio/UART.c -#: ports/espressif/common-hal/canio/CAN.c -#: ports/espressif/common-hal/i2cperipheral/I2CPeripheral.c -#: ports/mimxrt10xx/common-hal/busio/I2C.c -#: ports/mimxrt10xx/common-hal/busio/SPI.c -#: ports/mimxrt10xx/common-hal/usb_host/Port.c ports/nrf/common-hal/busio/I2C.c -#: ports/raspberrypi/common-hal/busio/I2C.c -#: ports/raspberrypi/common-hal/busio/SPI.c -#: ports/raspberrypi/common-hal/busio/UART.c shared-bindings/busio/SPI.c #: shared-bindings/busio/UART.c msgid "Invalid pins" -msgstr "" +msgstr "Neplatné piny" -#: shared-bindings/bitbangio/SPI.c shared-bindings/busio/SPI.c -#: shared-bindings/displayio/FourWire.c -msgid "Invalid polarity" -msgstr "" - -#: shared-bindings/_bleio/Characteristic.c -msgid "Invalid properties" -msgstr "" - -#: shared-bindings/microcontroller/__init__.c -msgid "Invalid run mode." -msgstr "" - -#: shared-module/_bleio/Attribute.c -msgid "Invalid security_mode" -msgstr "" - -#: ports/espressif/bindings/espidf/__init__.c ports/espressif/esp_error.c +#: ports/espressif/common-hal/espidf/__init__.c ports/espressif/esp_error.c msgid "Invalid size" -msgstr "" +msgstr "Chybná velikost" #: ports/espressif/common-hal/ssl/SSLContext.c +#: ports/raspberrypi/common-hal/ssl/SSLSocket.c msgid "Invalid socket for TLS" -msgstr "" +msgstr "Chybný soket pro TLS" -#: ports/espressif/bindings/espidf/__init__.c ports/espressif/esp_error.c +#: ports/espressif/common-hal/espidf/__init__.c ports/espressif/esp_error.c msgid "Invalid state" -msgstr "" - -#: shared-bindings/audiomixer/Mixer.c -msgid "Invalid voice" -msgstr "" - -#: shared-bindings/audiomixer/Mixer.c -msgid "Invalid voice count" -msgstr "" - -#: shared-module/audiocore/WaveFile.c -msgid "Invalid wave file" -msgstr "" - -#: ports/mimxrt10xx/common-hal/busio/UART.c ports/nrf/common-hal/busio/UART.c -#: ports/raspberrypi/common-hal/busio/UART.c ports/stm/common-hal/busio/UART.c -msgid "Invalid word/bit length" -msgstr "" +msgstr "Chybný stav" #: shared-bindings/aesio/aes.c msgid "Key must be 16, 24, or 32 bytes long" -msgstr "" +msgstr "Klíč musí být dlouhý 16, 24 nebo 32 bajtů" #: shared-module/is31fl3741/FrameBuffer.c msgid "LED mappings must match display size" -msgstr "" +msgstr "Mapování LED musí korespondovat s velikostí displeje" #: py/compile.c msgid "LHS of keyword arg must be an id" msgstr "" #: shared-module/displayio/Group.c -msgid "Layer already in a group." +msgid "Layer already in a group" msgstr "" #: shared-module/displayio/Group.c -msgid "Layer must be a Group or TileGrid subclass." +msgid "Layer must be a Group or TileGrid subclass" msgstr "" -#: ports/espressif/bindings/espidf/__init__.c ports/espressif/esp_error.c +#: ports/espressif/common-hal/espidf/__init__.c ports/espressif/esp_error.c msgid "MAC address was invalid" -msgstr "" - -#: shared-module/bitbangio/SPI.c -msgid "MISO pin init failed." -msgstr "" - -#: shared-module/bitbangio/SPI.c -msgid "MOSI pin init failed." -msgstr "" +msgstr "MAC adresa byla chybná" #: shared-bindings/is31fl3741/IS31FL3741.c msgid "Mapping must be a tuple" @@ -1536,11 +1293,7 @@ msgstr "" #: shared-module/displayio/Shape.c #, c-format msgid "Maximum x value when mirrored is %d" -msgstr "" - -#: shared-bindings/canio/Message.c -msgid "Messages limited to 8 bytes" -msgstr "" +msgstr "Maximální hodnota x při zrcadlení je %d" #: shared-bindings/audiobusio/PDMIn.c msgid "Microphone startup delay must be in range 0.0 to 1.0" @@ -1555,9 +1308,13 @@ msgstr "" msgid "Mismatched swap flag" msgstr "" -#: ports/mimxrt10xx/common-hal/busio/SPI.c ports/stm/common-hal/busio/SPI.c +#: ports/mimxrt10xx/common-hal/busio/SPI.c msgid "Missing MISO or MOSI Pin" -msgstr "" +msgstr "Chybí pin MISO nebo MOSI" + +#: ports/stm/common-hal/busio/SPI.c +msgid "Missing MISO or MOSI pin" +msgstr "Chybějící MISO nebo MOSI pin" #: ports/raspberrypi/common-hal/rp2pio/StateMachine.c #, c-format @@ -1594,23 +1351,18 @@ msgstr "" msgid "Missing jmp_pin. Instruction %d jumps on pin" msgstr "" -#: shared-module/usb_hid/Device.c -#, c-format -msgid "More than %d report ids not supported" -msgstr "" - #: shared-bindings/busio/UART.c shared-bindings/displayio/Group.c msgid "Must be a %q subclass." -msgstr "" +msgstr "Musí být podtřída %q." #: ports/mimxrt10xx/common-hal/busio/SPI.c shared-bindings/busio/SPI.c msgid "Must provide MISO or MOSI pin" -msgstr "" +msgstr "Musí poskytnout pin MISO nebo MOSI" #: shared-bindings/rgbmatrix/RGBMatrix.c #, c-format msgid "Must use a multiple of 6 rgb pins, not %d" -msgstr "" +msgstr "Je nutné použít několik kolíků 6 rgb, nikoli %d" #: supervisor/shared/safe_mode.c msgid "NLR jump failed. Likely memory corruption." @@ -1618,15 +1370,15 @@ msgstr "" #: ports/espressif/common-hal/nvm/ByteArray.c msgid "NVS Error" -msgstr "" +msgstr "Chyba NVS" #: py/qstr.c msgid "Name too long" -msgstr "" +msgstr "Jméno je příliš dlouhé" #: shared-bindings/displayio/TileGrid.c msgid "New bitmap must be same size as old bitmap" -msgstr "" +msgstr "Nová bitmapa musí mít stejnou velikost jako původní bitmapa" #: ports/espressif/common-hal/_bleio/__init__.c msgid "Nimble out of memory" @@ -1635,19 +1387,19 @@ msgstr "" #: ports/espressif/common-hal/_bleio/Characteristic.c #: ports/nrf/common-hal/_bleio/Characteristic.c msgid "No CCCD for this Characteristic" -msgstr "" +msgstr "Žádné CCCD pro tuto charakteristiku" #: ports/atmel-samd/common-hal/analogio/AnalogOut.c #: ports/stm/common-hal/analogio/AnalogOut.c msgid "No DAC on chip" -msgstr "" +msgstr "Žádný DAC na čipu" #: ports/atmel-samd/common-hal/audiobusio/I2SOut.c #: ports/atmel-samd/common-hal/audioio/AudioOut.c #: ports/raspberrypi/common-hal/audiobusio/I2SOut.c #: ports/raspberrypi/common-hal/audiopwmio/PWMAudioOut.c msgid "No DMA channel found" -msgstr "" +msgstr "Nebyl nalezen žádný kanál DMA" #: ports/raspberrypi/common-hal/audiopwmio/PWMAudioOut.c msgid "No DMA pacing timer found" @@ -1656,35 +1408,47 @@ msgstr "" #: shared-module/adafruit_bus_device/i2c_device/I2CDevice.c #, c-format msgid "No I2C device at address: 0x%x" +msgstr "Žádné I2C zařízení na adrese: 0x%x" + +#: supervisor/shared/web_workflow/web_workflow.c +msgid "No IP" msgstr "" #: ports/espressif/common-hal/busio/SPI.c -#: ports/mimxrt10xx/common-hal/busio/SPI.c ports/stm/common-hal/busio/SPI.c +#: ports/mimxrt10xx/common-hal/busio/SPI.c msgid "No MISO Pin" -msgstr "" +msgstr "Žádný pin MISO" + +#: ports/stm/common-hal/busio/SPI.c shared-module/bitbangio/SPI.c +msgid "No MISO pin" +msgstr "Žádný MISO pin" #: ports/espressif/common-hal/busio/SPI.c -#: ports/mimxrt10xx/common-hal/busio/SPI.c ports/stm/common-hal/busio/SPI.c +#: ports/mimxrt10xx/common-hal/busio/SPI.c msgid "No MOSI Pin" -msgstr "" +msgstr "Žádný pin MOSI" + +#: ports/stm/common-hal/busio/SPI.c shared-module/bitbangio/SPI.c +msgid "No MOSI pin" +msgstr "Žádný MOSI pin" #: ports/atmel-samd/common-hal/busio/UART.c #: ports/espressif/common-hal/busio/UART.c #: ports/mimxrt10xx/common-hal/busio/UART.c ports/nrf/common-hal/busio/UART.c #: ports/raspberrypi/common-hal/busio/UART.c ports/stm/common-hal/busio/UART.c msgid "No RX pin" -msgstr "" +msgstr "Žádný RX pin" #: ports/atmel-samd/common-hal/busio/UART.c #: ports/espressif/common-hal/busio/UART.c #: ports/mimxrt10xx/common-hal/busio/UART.c ports/nrf/common-hal/busio/UART.c #: ports/raspberrypi/common-hal/busio/UART.c ports/stm/common-hal/busio/UART.c msgid "No TX pin" -msgstr "" +msgstr "Žádný TX pin" #: ports/atmel-samd/common-hal/frequencyio/FrequencyIn.c msgid "No available clocks" -msgstr "" +msgstr "Žádné dostupné hodiny" #: ports/espressif/common-hal/imagecapture/ParallelImageCapture.c msgid "No capture in progress" @@ -1692,30 +1456,20 @@ msgstr "" #: shared-bindings/_bleio/PacketBuffer.c msgid "No connection: length cannot be determined" -msgstr "" +msgstr "Žádné připojení: nelze určit délku" #: shared-bindings/board/__init__.c msgid "No default %q bus" -msgstr "" +msgstr "Žádná výchozí sběrnice %q" #: ports/atmel-samd/common-hal/touchio/TouchIn.c msgid "No free GCLKs" -msgstr "" +msgstr "Žádné volné GCLK" #: shared-bindings/os/__init__.c msgid "No hardware random available" msgstr "" -#: ports/atmel-samd/common-hal/ps2io/Ps2.c -msgid "No hardware support on clk pin" -msgstr "" - -#: ports/atmel-samd/common-hal/alarm/pin/PinAlarm.c -#: ports/atmel-samd/common-hal/frequencyio/FrequencyIn.c -#: ports/atmel-samd/common-hal/pulseio/PulseIn.c -msgid "No hardware support on pin" -msgstr "" - #: ports/raspberrypi/common-hal/rp2pio/StateMachine.c msgid "No in in program" msgstr "" @@ -1726,7 +1480,7 @@ msgstr "" #: shared-bindings/aesio/aes.c msgid "No key was specified" -msgstr "" +msgstr "Nebyl zadán klíč" #: shared-bindings/time/__init__.c msgid "No long integer support" @@ -1735,11 +1489,11 @@ msgstr "" #: shared-module/usb_hid/__init__.c #, c-format msgid "No more than %d HID devices allowed" -msgstr "" +msgstr "Ne více než %d HID zařízení je povoleno" #: shared-bindings/wifi/Radio.c msgid "No network with that ssid" -msgstr "" +msgstr "Žádná síť s takovým SSID" #: ports/raspberrypi/common-hal/rp2pio/StateMachine.c msgid "No out in program" @@ -1754,23 +1508,23 @@ msgstr "" #: shared-module/touchio/TouchIn.c msgid "No pulldown on pin; 1Mohm recommended" -msgstr "" +msgstr "Žádný pulldown na pinu; doporučeno 1Mohm" #: py/moduerrno.c msgid "No space left on device" -msgstr "" +msgstr "Na zařízení nezůstal žádný prostor" #: py/moduerrno.c msgid "No such device" -msgstr "" +msgstr "Žádné takové zařízení" #: py/moduerrno.c msgid "No such file/directory" -msgstr "" +msgstr "Žádný takový soubor / adresář" #: shared-module/rgbmatrix/RGBMatrix.c msgid "No timer available" -msgstr "" +msgstr "Není k dispozici žádný časovač" #: supervisor/shared/safe_mode.c msgid "Nordic system firmware failure assertion." @@ -1782,18 +1536,18 @@ msgstr "" #: shared-bindings/ipaddress/IPv4Address.c shared-bindings/ipaddress/__init__.c msgid "Not a valid IP string" -msgstr "" +msgstr "Nevalidní IP string" #: ports/espressif/common-hal/_bleio/__init__.c #: ports/nrf/common-hal/_bleio/__init__.c #: shared-bindings/_bleio/CharacteristicBuffer.c msgid "Not connected" -msgstr "" +msgstr "Nepřipojený" #: shared-bindings/audiobusio/I2SOut.c shared-bindings/audioio/AudioOut.c #: shared-bindings/audiopwmio/PWMAudioOut.c msgid "Not playing" -msgstr "" +msgstr "Nehraje" #: shared-bindings/_bleio/__init__.c msgid "Not settable" @@ -1802,29 +1556,40 @@ msgstr "" #: ports/espressif/common-hal/paralleldisplay/ParallelBus.c #, c-format msgid "Number of data_pins must be 8 or 16, not %d" -msgstr "" +msgstr "Počet data_pins musí být 8 nebo 16, nikoli %d" #: shared-bindings/util.c msgid "" "Object has been deinitialized and can no longer be used. Create a new object." msgstr "" +"Objekt byl deinicializován a nelze jej dále používat. Vytvořte nový objekt." #: ports/nrf/common-hal/busio/UART.c msgid "Odd parity is not supported" msgstr "" +#: supervisor/shared/bluetooth/bluetooth.c +msgid "Off" +msgstr "" + +#: supervisor/shared/bluetooth/bluetooth.c +msgid "Ok" +msgstr "" + #: ports/atmel-samd/common-hal/audiobusio/PDMIn.c #: ports/raspberrypi/common-hal/audiobusio/PDMIn.c msgid "Only 8 or 16 bit mono with " msgstr "" #: ports/espressif/common-hal/wifi/__init__.c +#: ports/raspberrypi/common-hal/wifi/__init__.c msgid "Only IPv4 addresses supported" -msgstr "" +msgstr "Pouze IPv4 adresy podporovány" -#: ports/espressif/common-hal/socketpool/SocketPool.c +#: ports/espressif/common-hal/socketpool/Socket.c +#: ports/raspberrypi/common-hal/socketpool/Socket.c msgid "Only IPv4 sockets supported" -msgstr "" +msgstr "Pouze IPv4 sokety podporovány" #: shared-module/displayio/OnDiskBitmap.c #, c-format @@ -1855,15 +1620,19 @@ msgstr "" msgid "Only one TouchAlarm can be set in deep sleep." msgstr "" -#: ports/espressif/common-hal/i2cperipheral/I2CPeripheral.c +#: ports/espressif/common-hal/i2ctarget/I2CTarget.c +#: ports/raspberrypi/common-hal/i2ctarget/I2CTarget.c msgid "Only one address is allowed" msgstr "" #: ports/atmel-samd/common-hal/alarm/time/TimeAlarm.c -#: ports/espressif/common-hal/alarm/time/TimeAlarm.c #: ports/nrf/common-hal/alarm/time/TimeAlarm.c -#: ports/raspberrypi/common-hal/alarm/time/TimeAlarm.c #: ports/stm/common-hal/alarm/time/TimeAlarm.c +msgid "Only one alarm.time alarm can be set" +msgstr "" + +#: ports/espressif/common-hal/alarm/time/TimeAlarm.c +#: ports/raspberrypi/common-hal/alarm/time/TimeAlarm.c msgid "Only one alarm.time alarm can be set." msgstr "" @@ -1875,19 +1644,20 @@ msgstr "" msgid "Operation not permitted" msgstr "" -#: ports/espressif/bindings/espidf/__init__.c ports/espressif/esp_error.c +#: ports/espressif/common-hal/espidf/__init__.c ports/espressif/esp_error.c msgid "Operation or feature not supported" msgstr "" -#: ports/espressif/bindings/espidf/__init__.c ports/espressif/esp_error.c +#: ports/espressif/common-hal/espidf/__init__.c ports/espressif/esp_error.c msgid "Operation timed out" msgstr "" -#: ports/espressif/bindings/espidf/__init__.c ports/espressif/esp_error.c +#: ports/espressif/common-hal/espidf/__init__.c ports/espressif/esp_error.c msgid "Out of memory" msgstr "" -#: ports/espressif/common-hal/socketpool/SocketPool.c +#: ports/espressif/common-hal/socketpool/Socket.c +#: ports/raspberrypi/common-hal/socketpool/Socket.c msgid "Out of sockets" msgstr "" @@ -1895,11 +1665,6 @@ msgstr "" msgid "Out-buffer elements must be <= 4 bytes long" msgstr "" -#: shared-bindings/bitops/__init__.c -#, c-format -msgid "Output buffer must be at least %d bytes" -msgstr "" - #: shared-bindings/audiobusio/PDMIn.c msgid "Oversample must be multiple of 8." msgstr "" @@ -1910,12 +1675,11 @@ msgstr "" #: shared-bindings/pwmio/PWMOut.c msgid "" -"PWM duty_cycle must be between 0 and 65535 inclusive (16 bit resolution)" +"PWM frequency not writable when variable_frequency is False on construction." msgstr "" -#: shared-bindings/pwmio/PWMOut.c -msgid "" -"PWM frequency not writable when variable_frequency is False on construction." +#: ports/stm/common-hal/pwmio/PWMOut.c +msgid "PWM restart" msgstr "" #: ports/raspberrypi/common-hal/countio/Counter.c @@ -1934,36 +1698,20 @@ msgstr "" msgid "Permission denied" msgstr "" -#: ports/atmel-samd/common-hal/alarm/pin/PinAlarm.c #: ports/stm/common-hal/alarm/pin/PinAlarm.c msgid "Pin cannot wake from Deep Sleep" msgstr "" -#: ports/raspberrypi/bindings/rp2pio/StateMachine.c -msgid "Pin count must be at least 1" -msgstr "" - #: ports/raspberrypi/common-hal/rp2pio/StateMachine.c msgid "Pin count too large" msgstr "" -#: ports/atmel-samd/common-hal/analogio/AnalogIn.c -#: ports/cxd56/common-hal/analogio/AnalogIn.c -#: ports/espressif/common-hal/analogio/AnalogIn.c -#: ports/mimxrt10xx/common-hal/analogio/AnalogIn.c -#: ports/nrf/common-hal/analogio/AnalogIn.c -#: ports/raspberrypi/common-hal/analogio/AnalogIn.c -#: ports/stm/common-hal/analogio/AnalogIn.c -msgid "Pin does not have ADC capabilities" -msgstr "" - #: ports/stm/common-hal/alarm/pin/PinAlarm.c #: ports/stm/common-hal/pulseio/PulseIn.c msgid "Pin interrupt already in use" msgstr "" #: shared-bindings/adafruit_bus_device/spi_device/SPIDevice.c -#: shared-bindings/digitalio/DigitalInOut.c msgid "Pin is input only" msgstr "" @@ -2025,18 +1773,10 @@ msgstr "" msgid "Program does OUT without loading OSR" msgstr "" -#: ports/raspberrypi/bindings/rp2pio/StateMachine.c -msgid "Program must contain at least one 16-bit instruction." -msgstr "" - #: ports/raspberrypi/bindings/rp2pio/StateMachine.c msgid "Program size invalid" msgstr "" -#: ports/raspberrypi/bindings/rp2pio/StateMachine.c -msgid "Program too large" -msgstr "" - #: shared-bindings/digitalio/DigitalInOut.c msgid "Pull not used when direction is output." msgstr "" @@ -2058,8 +1798,9 @@ msgstr "" msgid "RNG Init Error" msgstr "" -#: ports/nrf/common-hal/busio/UART.c -msgid "RS485 Not yet supported on this device" +#: ports/atmel-samd/common-hal/busio/UART.c ports/cxd56/common-hal/busio/UART.c +#: ports/nrf/common-hal/busio/UART.c ports/stm/common-hal/busio/UART.c +msgid "RS485" msgstr "" #: ports/espressif/common-hal/busio/UART.c @@ -2067,21 +1808,10 @@ msgstr "" msgid "RS485 inversion specified when not in RS485 mode" msgstr "" -#: ports/cxd56/common-hal/rtc/RTC.c ports/espressif/common-hal/rtc/RTC.c -#: ports/mimxrt10xx/common-hal/rtc/RTC.c ports/nrf/common-hal/rtc/RTC.c -#: ports/raspberrypi/common-hal/rtc/RTC.c -msgid "RTC calibration is not supported on this board" -msgstr "" - #: shared-bindings/alarm/time/TimeAlarm.c shared-bindings/time/__init__.c msgid "RTC is not supported on this board" msgstr "" -#: ports/atmel-samd/common-hal/busio/UART.c ports/cxd56/common-hal/busio/UART.c -#: ports/stm/common-hal/busio/UART.c -msgid "RTS/CTS/RS485 Not yet supported on this device" -msgstr "" - #: ports/stm/common-hal/os/__init__.c msgid "Random number generation error" msgstr "" @@ -2099,10 +1829,14 @@ msgstr "" msgid "Read-only object" msgstr "" -#: ports/espressif/bindings/espidf/__init__.c ports/espressif/esp_error.c +#: ports/espressif/common-hal/espidf/__init__.c ports/espressif/esp_error.c msgid "Received response was invalid" msgstr "" +#: supervisor/shared/bluetooth/bluetooth.c +msgid "Reconnecting" +msgstr "" + #: shared-bindings/displayio/EPaperDisplay.c msgid "Refresh too soon" msgstr "" @@ -2115,7 +1849,7 @@ msgstr "" msgid "Requested AES mode is unsupported" msgstr "" -#: ports/espressif/bindings/espidf/__init__.c ports/espressif/esp_error.c +#: ports/espressif/common-hal/espidf/__init__.c ports/espressif/esp_error.c msgid "Requested resource not found" msgstr "" @@ -2131,6 +1865,10 @@ msgstr "" msgid "SD card CSD format not supported" msgstr "" +#: ports/cxd56/common-hal/sdioio/SDCard.c +msgid "SDCard init" +msgstr "" + #: ports/stm/common-hal/sdioio/SDCard.c #, c-format msgid "SDIO GetCardInfo Error %d" @@ -2141,29 +1879,20 @@ msgstr "" msgid "SDIO Init Error %d" msgstr "" -#: ports/stm/common-hal/busio/SPI.c -msgid "SPI Init Error" -msgstr "" - -#: ports/stm/common-hal/busio/SPI.c -msgid "SPI Re-initialization error" -msgstr "" - #: ports/espressif/common-hal/busio/SPI.c msgid "SPI configuration failed" msgstr "" +#: ports/stm/common-hal/busio/SPI.c +msgid "SPI init error" +msgstr "" + #: ports/raspberrypi/common-hal/busio/SPI.c msgid "SPI peripheral in use" msgstr "" -#: shared-bindings/audiomixer/Mixer.c -msgid "Sample rate must be positive" -msgstr "" - -#: ports/atmel-samd/common-hal/audioio/AudioOut.c -#, c-format -msgid "Sample rate too high. It must be less than %d" +#: ports/stm/common-hal/busio/SPI.c +msgid "SPI re-init" msgstr "" #: shared-bindings/is31fl3741/FrameBuffer.c @@ -2184,14 +1913,6 @@ msgstr "" msgid "Server side context cannot have hostname" msgstr "" -#: ports/raspberrypi/bindings/rp2pio/StateMachine.c -msgid "Set pin count must be between 1 and 5" -msgstr "" - -#: ports/raspberrypi/bindings/rp2pio/StateMachine.c -msgid "Side set pin count must be between 1 and 5" -msgstr "" - #: ports/cxd56/common-hal/camera/Camera.c msgid "Size not supported" msgstr "" @@ -2212,6 +1933,7 @@ msgid "Slices not supported" msgstr "" #: ports/espressif/common-hal/socketpool/SocketPool.c +#: ports/raspberrypi/common-hal/socketpool/SocketPool.c msgid "SocketPool can only be used with wifi.radio" msgstr "" @@ -2227,10 +1949,6 @@ msgstr "" msgid "Splitting with sub-captures" msgstr "" -#: shared-bindings/supervisor/__init__.c -msgid "Stack size must be at least 256" -msgstr "" - #: ports/raspberrypi/common-hal/audiopwmio/PWMAudioOut.c msgid "Stereo left must be on PWM channel A" msgstr "" @@ -2239,10 +1957,6 @@ msgstr "" msgid "Stereo right must be on PWM channel B" msgstr "" -#: shared-bindings/multiterminal/__init__.c -msgid "Stream missing readinto() or write() method." -msgstr "" - #: ports/mimxrt10xx/common-hal/busio/UART.c ports/stm/common-hal/busio/UART.c msgid "Supply at least one UART pin" msgstr "" @@ -2316,10 +2030,6 @@ msgstr "" msgid "Tile index out of bounds" msgstr "" -#: shared-bindings/displayio/TileGrid.c -msgid "Tile value out of bounds" -msgstr "" - #: shared-bindings/displayio/TileGrid.c msgid "Tile width must exactly divide bitmap width" msgstr "" @@ -2339,6 +2049,9 @@ msgid "To exit, please reset the board without " msgstr "" #: ports/atmel-samd/common-hal/audiobusio/I2SOut.c +msgid "Too many channels in sample" +msgstr "" + #: ports/raspberrypi/common-hal/audiobusio/I2SOut.c msgid "Too many channels in sample." msgstr "" @@ -2371,23 +2084,24 @@ msgid "Tuple or struct_time argument required" msgstr "" #: ports/stm/common-hal/busio/UART.c -msgid "UART Buffer allocation error" +msgid "UART de-init" +msgstr "" + +#: ports/atmel-samd/common-hal/busio/UART.c ports/cxd56/common-hal/busio/UART.c +#: ports/espressif/common-hal/busio/UART.c ports/stm/common-hal/busio/UART.c +msgid "UART init" msgstr "" #: ports/stm/common-hal/busio/UART.c -msgid "UART De-init error" +msgid "UART re-init" msgstr "" #: ports/stm/common-hal/busio/UART.c -msgid "UART Init Error" +msgid "UART write" msgstr "" -#: ports/stm/common-hal/busio/UART.c -msgid "UART Re-init error" -msgstr "" - -#: ports/stm/common-hal/busio/UART.c -msgid "UART write error" +#: main.c +msgid "UID:" msgstr "" #: shared-module/usb_hid/Device.c @@ -2513,6 +2227,11 @@ msgstr "" msgid "Unknown system firmware error: %d" msgstr "" +#: ports/raspberrypi/common-hal/wifi/__init__.c +#, c-format +msgid "Unkown error code %d" +msgstr "" + #: shared-bindings/adafruit_pixelbuf/PixelBuf.c #, c-format msgid "Unmatched number of items on RHS (expected %d, got %d)." @@ -2524,12 +2243,6 @@ msgid "" "declined or ignored." msgstr "" -#: ports/atmel-samd/common-hal/busio/I2C.c ports/cxd56/common-hal/busio/I2C.c -#: ports/espressif/common-hal/busio/UART.c -#: ports/raspberrypi/common-hal/busio/I2C.c ports/stm/common-hal/busio/I2C.c -msgid "Unsupported baudrate" -msgstr "" - #: shared-bindings/bitmaptools/__init__.c msgid "Unsupported colorspace" msgstr "" @@ -2542,6 +2255,10 @@ msgstr "" msgid "Unsupported format" msgstr "" +#: shared-bindings/hashlib/__init__.c +msgid "Unsupported hash algorithm" +msgstr "" + #: ports/espressif/common-hal/dualbank/__init__.c msgid "Update Failed" msgstr "" @@ -2560,7 +2277,7 @@ msgstr "" msgid "Value length > max_length" msgstr "" -#: ports/espressif/bindings/espidf/__init__.c ports/espressif/esp_error.c +#: ports/espressif/common-hal/espidf/__init__.c ports/espressif/esp_error.c msgid "Version was invalid" msgstr "" @@ -2590,10 +2307,6 @@ msgstr "" msgid "WatchDogTimer.timeout must be greater than 0" msgstr "" -#: supervisor/shared/safe_mode.c -msgid "Watchdog timer expired." -msgstr "" - #: py/builtinhelp.c #, c-format msgid "" @@ -2604,8 +2317,8 @@ msgid "" "To list built-in modules type `help(\"modules\")`.\n" msgstr "" -#: shared-bindings/wifi/Radio.c -msgid "WiFi password must be between 8 and 63 characters" +#: supervisor/shared/web_workflow/web_workflow.c +msgid "Wi-Fi: " msgstr "" #: main.c @@ -2646,11 +2359,7 @@ msgstr "" msgid "a bytes-like object is required" msgstr "" -#: shared-bindings/i2cperipheral/I2CPeripheral.c -msgid "address out of bounds" -msgstr "" - -#: shared-bindings/i2cperipheral/I2CPeripheral.c +#: shared-bindings/i2ctarget/I2CTarget.c msgid "addresses is empty" msgstr "" @@ -2699,6 +2408,10 @@ msgstr "" msgid "array and index length must be equal" msgstr "" +#: extmod/ulab/code/numpy/io/io.c +msgid "array has too many dimensions" +msgstr "" + #: py/objarray.c shared-bindings/alarm/SleepMemory.c #: shared-bindings/nvm/ByteArray.c msgid "array/bytes required on right side" @@ -2760,10 +2473,6 @@ msgstr "" msgid "bits must be 32 or less" msgstr "" -#: shared-bindings/busio/UART.c -msgid "bits must be in range 5 to 9" -msgstr "" - #: shared-bindings/audiomixer/Mixer.c msgid "bits_per_sample must be 8 or 16" msgstr "" @@ -2801,11 +2510,6 @@ msgstr "" msgid "byteorder is not a string" msgstr "" -#: ports/atmel-samd/common-hal/busio/UART.c -#: ports/espressif/common-hal/busio/UART.c -msgid "bytes > 8 bits not supported" -msgstr "" - #: py/objarray.c msgid "bytes length not a multiple of item size" msgstr "" @@ -2814,7 +2518,7 @@ msgstr "" msgid "bytes value out of range" msgstr "" -#: ports/atmel-samd/bindings/samd/Clock.c ports/atmel-samd/common-hal/rtc/RTC.c +#: ports/atmel-samd/bindings/samd/Clock.c msgid "calibration is out of range" msgstr "" @@ -2822,12 +2526,9 @@ msgstr "" msgid "calibration is read only" msgstr "" -#: ports/atmel-samd/common-hal/rtc/RTC.c -msgid "calibration value out of range +/-127" -msgstr "" - +#: shared-module/vectorio/Circle.c shared-module/vectorio/Polygon.c #: shared-module/vectorio/Rectangle.c -msgid "can only be registered in one parent" +msgid "can only have one parent" msgstr "" #: py/emitinlinethumb.c @@ -2850,8 +2551,7 @@ msgstr "" msgid "can't cancel self" msgstr "" -#: py/obj.c py/objint.c shared-bindings/i2cperipheral/I2CPeripheral.c -#: shared-module/adafruit_pixelbuf/PixelBuf.c +#: py/obj.c py/objint.c shared-module/adafruit_pixelbuf/PixelBuf.c msgid "can't convert %q to %q" msgstr "" @@ -2998,6 +2698,10 @@ msgstr "" msgid "casting" msgstr "" +#: ports/stm/common-hal/pwmio/PWMOut.c +msgid "channel re-init" +msgstr "" + #: shared-bindings/_stage/Text.c msgid "chars buffer too small" msgstr "" @@ -3010,10 +2714,6 @@ msgstr "" msgid "chr() arg not in range(256)" msgstr "" -#: shared-module/vectorio/Circle.c -msgid "circle can only be registered in one parent" -msgstr "" - #: shared-bindings/bitmaptools/__init__.c msgid "clip point must be (x,y) tuple" msgstr "" @@ -3038,10 +2738,6 @@ msgstr "" msgid "color must be between 0x000000 and 0xffffff" msgstr "" -#: shared-bindings/displayio/ColorConverter.c -msgid "color should be an int" -msgstr "" - #: py/emitnative.c msgid "comparison of int and uint" msgstr "" @@ -3078,6 +2774,10 @@ msgstr "" msgid "convolve arguments must not be empty" msgstr "" +#: extmod/ulab/code/numpy/io/io.c +msgid "corrupted file" +msgstr "" + #: extmod/ulab/code/numpy/poly.c msgid "could not invert Vandermonde matrix" msgstr "" @@ -3128,10 +2828,6 @@ msgstr "" msgid "destination buffer must be an array of type 'H' for bit_depth = 16" msgstr "" -#: shared-bindings/audiobusio/PDMIn.c -msgid "destination_length must be an int >= 0" -msgstr "" - #: py/objdict.c msgid "dict update sequence has wrong length" msgstr "" @@ -3169,6 +2865,10 @@ msgstr "" msgid "empty" msgstr "" +#: extmod/ulab/code/numpy/io/io.c +msgid "empty file" +msgstr "" + #: extmod/moduasyncio.c extmod/moduheapq.c extmod/modutimeq.c msgid "empty heap" msgstr "" @@ -3185,10 +2885,6 @@ msgstr "" msgid "end of format while looking for conversion specifier" msgstr "" -#: shared-bindings/displayio/Shape.c -msgid "end_x should be an int" -msgstr "" - #: shared-bindings/alarm/time/TimeAlarm.c msgid "epoch_time not supported on this board" msgstr "" @@ -3198,6 +2894,12 @@ msgstr "" msgid "error = 0x%08lX" msgstr "" +#: ports/espressif/common-hal/esp32_camera/Camera.c +msgid "" +"esp32_camera.Camera requires reserved PSRAM to be configured. See the " +"documentation for instructions." +msgstr "" + #: py/runtime.c msgid "exceptions must derive from BaseException" msgstr "" @@ -3272,7 +2974,7 @@ msgstr "" msgid "first argument must be a tuple of ndarrays" msgstr "" -#: extmod/ulab/code/numpy/vector.c +#: extmod/ulab/code/numpy/transform.c extmod/ulab/code/numpy/vector.c msgid "first argument must be an ndarray" msgstr "" @@ -3420,7 +3122,7 @@ msgstr "" msgid "incorrect padding" msgstr "" -#: extmod/ulab/code/ndarray.c +#: extmod/ulab/code/ndarray.c extmod/ulab/code/numpy/transform.c msgid "index is out of bounds" msgstr "" @@ -3438,6 +3140,10 @@ msgstr "" msgid "indices must be integers, slices, or Boolean lists" msgstr "" +#: ports/espressif/common-hal/busio/I2C.c +msgid "init I2C" +msgstr "" + #: extmod/ulab/code/scipy/optimize/optimize.c msgid "initial values must be iterable" msgstr "" @@ -3483,6 +3189,10 @@ msgstr "" msgid "input matrix is singular" msgstr "" +#: extmod/ulab/code/numpy/create.c +msgid "input must be 1- or 2-d" +msgstr "" + #: extmod/ulab/code/numpy/carray/carray.c msgid "input must be a 1D ndarray" msgstr "" @@ -3491,11 +3201,7 @@ msgstr "" msgid "input must be a dense ndarray" msgstr "" -#: extmod/ulab/code/numpy/create.c -msgid "input must be a tensor of rank 2" -msgstr "" - -#: extmod/ulab/code/numpy/create.c extmod/ulab/code/user/user.c +#: extmod/ulab/code/user/user.c msgid "input must be an ndarray" msgstr "" @@ -3545,6 +3251,10 @@ msgstr "" msgid "invalid bits_per_pixel %d, must be, 1, 2, 4, 8, 16, 24, or 32" msgstr "" +#: ports/raspberrypi/common-hal/ssl/SSLSocket.c +msgid "invalid cert" +msgstr "" + #: shared-bindings/bitmaptools/__init__.c #, c-format msgid "invalid element size %d for bits_per_pixel %d\n" @@ -3571,10 +3281,18 @@ msgstr "" msgid "invalid hostname" msgstr "" +#: ports/raspberrypi/common-hal/ssl/SSLSocket.c +msgid "invalid key" +msgstr "" + #: py/compile.c msgid "invalid micropython decorator" msgstr "" +#: ports/espressif/common-hal/esp32_camera/Camera.c +msgid "invalid setting" +msgstr "" + #: shared-bindings/random/__init__.c msgid "invalid step" msgstr "" @@ -3688,10 +3406,6 @@ msgstr "" msgid "matrix is not positive definite" msgstr "" -#: ports/espressif/common-hal/wifi/Radio.c -msgid "max_connections must be between 0 and 10" -msgstr "" - #: ports/espressif/common-hal/_bleio/Descriptor.c #: ports/nrf/common-hal/_bleio/Characteristic.c #: ports/nrf/common-hal/_bleio/Descriptor.c @@ -3699,12 +3413,8 @@ msgstr "" msgid "max_length must be 0-%d when fixed_length is %s" msgstr "" -#: shared-bindings/_bleio/Characteristic.c shared-bindings/_bleio/Descriptor.c -msgid "max_length must be >= 0" -msgstr "" - #: extmod/ulab/code/ndarray.c -msgid "maximum number of dimensions is 4" +msgid "maximum number of dimensions is " msgstr "" #: py/runtime.c @@ -3838,7 +3548,7 @@ msgstr "" msgid "no response from SD card" msgstr "" -#: py/objobject.c py/runtime.c +#: ports/espressif/common-hal/esp32_camera/Camera.c py/objobject.c py/runtime.c msgid "no such attribute" msgstr "" @@ -3949,7 +3659,11 @@ msgstr "" msgid "odd-length string" msgstr "" -#: extmod/ulab/code/numpy/create.c extmod/ulab/code/utils/utils.c +#: supervisor/shared/web_workflow/web_workflow.c +msgid "off" +msgstr "" + +#: extmod/ulab/code/utils/utils.c msgid "offset is too large" msgstr "" @@ -4045,10 +3759,6 @@ msgstr "" msgid "palette must be 32 bytes long" msgstr "" -#: shared-bindings/displayio/Palette.c -msgid "palette_index should be an int" -msgstr "" - #: py/emitinlinextensa.c msgid "parameters must be registers in sequence a2 to a5" msgstr "" @@ -4073,10 +3783,6 @@ msgstr "" msgid "poll on file not available on win32" msgstr "" -#: shared-module/vectorio/Polygon.c -msgid "polygon can only be registered in one parent" -msgstr "" - #: ports/espressif/common-hal/pulseio/PulseIn.c msgid "pop from an empty PulseIn" msgstr "" @@ -4102,7 +3808,23 @@ msgstr "" msgid "pow() with 3 arguments requires integers" msgstr "" +#: ports/espressif/boards/adafruit_qtpy_esp32_pico/mpconfigboard.h +msgid "pressing BOOT button at start up.\n" +msgstr "" + +#: ports/espressif/boards/adafruit_feather_esp32_v2/mpconfigboard.h +msgid "pressing SW38 button at start up.\n" +msgstr "" + +#: ports/espressif/boards/hardkernel_odroid_go/mpconfigboard.h +msgid "pressing VOLUME button at start up.\n" +msgstr "" + #: ports/espressif/boards/adafruit_qtpy_esp32c3/mpconfigboard.h +#: ports/espressif/boards/beetle-esp32-c3/mpconfigboard.h +#: ports/espressif/boards/espressif_esp32s2_devkitc_1_n8r2/mpconfigboard.h +#: ports/espressif/boards/lolin_c3_mini/mpconfigboard.h +#: ports/espressif/boards/microdev_micro_c3/mpconfigboard.h #: supervisor/shared/safe_mode.c msgid "pressing boot button at start up.\n" msgstr "" @@ -4123,14 +3845,6 @@ msgstr "" msgid "pull masks conflict with direction masks" msgstr "" -#: ports/raspberrypi/bindings/rp2pio/StateMachine.c -msgid "pull_threshold must be between 1 and 32" -msgstr "" - -#: ports/raspberrypi/bindings/rp2pio/StateMachine.c -msgid "push_threshold must be between 1 and 32" -msgstr "" - #: extmod/modutimeq.c msgid "queue overflow" msgstr "" @@ -4182,12 +3896,6 @@ msgstr "" msgid "rsplit(None,n)" msgstr "" -#: shared-bindings/audiocore/RawSample.c -msgid "" -"sample_source buffer must be a bytearray or array of type 'h', 'H', 'b' or " -"'B'" -msgstr "" - #: ports/atmel-samd/common-hal/audiobusio/PDMIn.c #: ports/raspberrypi/common-hal/audiobusio/PDMIn.c msgid "sampling rate out of range" @@ -4285,26 +3993,14 @@ msgstr "" msgid "source_bitmap must have value_count of 8" msgstr "" -#: shared-bindings/wifi/Radio.c -msgid "ssid can't be more than 32 bytes" -msgstr "" - #: py/objstr.c msgid "start/end indices" msgstr "" -#: shared-bindings/displayio/Shape.c -msgid "start_x should be an int" -msgstr "" - #: shared-bindings/random/__init__.c msgid "step must be non-zero" msgstr "" -#: shared-bindings/busio/UART.c -msgid "stop must be 1 or 2" -msgstr "" - #: shared-bindings/random/__init__.c msgid "stop not reachable from start" msgstr "" @@ -4353,10 +4049,6 @@ msgstr "" msgid "threshold must be in the range 0-65536" msgstr "" -#: shared-bindings/rgbmatrix/RGBMatrix.c -msgid "tile must be greater than zero" -msgstr "" - #: shared-bindings/time/__init__.c msgid "time.struct_time() takes a 9-sequence" msgstr "" @@ -4376,10 +4068,6 @@ msgstr "" msgid "timeout must be < 655.35 secs" msgstr "" -#: shared-bindings/_bleio/CharacteristicBuffer.c -msgid "timeout must be >= 0.0" -msgstr "" - #: shared-module/sdcardio/SDCard.c msgid "timeout waiting for v1 card" msgstr "" @@ -4388,6 +4076,10 @@ msgstr "" msgid "timeout waiting for v2 card" msgstr "" +#: ports/stm/common-hal/pwmio/PWMOut.c +msgid "timer re-init" +msgstr "" + #: shared-bindings/time/__init__.c msgid "timestamp out of range for platform time_t" msgstr "" @@ -4453,14 +4145,10 @@ msgstr "" msgid "type is not an acceptable base type" msgstr "" -#: py/runtime.c +#: py/objgenerator.c py/runtime.c msgid "type object '%q' has no attribute '%q'" msgstr "" -#: py/objgenerator.c -msgid "type object 'generator' has no attribute '__await__'" -msgstr "" - #: py/objtype.c msgid "type takes 1 or 3 arguments" msgstr "" @@ -4519,7 +4207,6 @@ msgid "unreadable attribute" msgstr "" #: shared-bindings/displayio/TileGrid.c shared-bindings/vectorio/VectorShape.c -#: shared-module/vectorio/Polygon.c shared-module/vectorio/VectorShape.c msgid "unsupported %q type" msgstr "" @@ -4558,6 +4245,14 @@ msgstr "" msgid "unsupported types for %q: '%q', '%q'" msgstr "" +#: extmod/ulab/code/numpy/io/io.c +msgid "usecols is too high" +msgstr "" + +#: extmod/ulab/code/numpy/io/io.c +msgid "usecols keyword must be specified" +msgstr "" + #: py/objint.c #, c-format msgid "value must fit in %d byte(s)" @@ -4579,20 +4274,19 @@ msgstr "" msgid "watchdog timeout must be greater than 0" msgstr "" -#: shared-bindings/bitops/__init__.c -#, c-format -msgid "width must be from 2 to 8 (inclusive), not %d" -msgstr "" - #: shared-bindings/is31fl3741/FrameBuffer.c -#: shared-bindings/rgbmatrix/RGBMatrix.c msgid "width must be greater than zero" msgstr "" #: ports/espressif/common-hal/wifi/Radio.c +#: ports/raspberrypi/common-hal/wifi/Radio.c msgid "wifi is not enabled" msgstr "" +#: ports/raspberrypi/common-hal/wifi/Monitor.c +msgid "wifi.Monitor not available" +msgstr "" + #: shared-bindings/_bleio/Adapter.c msgid "window must be <= interval" msgstr "" @@ -4605,7 +4299,17 @@ msgstr "" msgid "wrong axis specified" msgstr "" -#: extmod/ulab/code/numpy/compare.c extmod/ulab/code/numpy/vector.c +#: extmod/ulab/code/numpy/io/io.c +msgid "wrong dtype" +msgstr "" + +#: extmod/ulab/code/numpy/transform.c +msgid "wrong index type" +msgstr "" + +#: extmod/ulab/code/numpy/compare.c extmod/ulab/code/numpy/create.c +#: extmod/ulab/code/numpy/io/io.c extmod/ulab/code/numpy/transform.c +#: extmod/ulab/code/numpy/vector.c msgid "wrong input type" msgstr "" @@ -4613,6 +4317,10 @@ msgstr "" msgid "wrong length of condition array" msgstr "" +#: extmod/ulab/code/numpy/transform.c +msgid "wrong length of index array" +msgstr "" + #: extmod/ulab/code/numpy/create.c py/objarray.c py/objstr.c msgid "wrong number of arguments" msgstr "" @@ -4633,10 +4341,6 @@ msgstr "" msgid "xTaskCreate failed" msgstr "" -#: shared-bindings/displayio/Shape.c -msgid "y should be an int" -msgstr "" - #: shared-module/displayio/Shape.c msgid "y value out of bounds" msgstr "" @@ -4657,6 +4361,24 @@ msgstr "" msgid "zi must be of shape (n_section, 2)" msgstr "" +#~ msgid "%q must be >= 0" +#~ msgstr "%q musí být >= 0" + +#~ msgid "%q must be >= 1" +#~ msgstr "%q musí být > = 1" + +#~ msgid "Failed to init wifi" +#~ msgstr "Chyba inicializace WiFi" + +#~ msgid "%q must be a tuple of length 2" +#~ msgstr "%q musí být n-tice délky 2" + +#~ msgid "%q must be between %d and %d" +#~ msgstr "%q musí být mezi %d a %d" + +#~ msgid "%q should be an int" +#~ msgstr "%q by měl být int" + #~ msgid "" #~ "\n" #~ "Code stopped by auto-reload.\n" diff --git a/locale/de_DE.po b/locale/de_DE.po index 498b1fdaf4..bec093fd7e 100644 --- a/locale/de_DE.po +++ b/locale/de_DE.po @@ -6,14 +6,14 @@ msgstr "" "Project-Id-Version: \n" "Report-Msgid-Bugs-To: \n" "POT-Creation-Date: 2021-01-04 12:55-0600\n" -"PO-Revision-Date: 2022-03-24 15:57+0000\n" -"Last-Translator: Fabian Affolter \n" +"PO-Revision-Date: 2022-08-14 12:14+0000\n" +"Last-Translator: Can Kocyigit \n" "Language: de_DE\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.12-dev\n" +"X-Generator: Weblate 4.14-dev\n" #: main.c msgid "" @@ -66,6 +66,11 @@ msgstr " Ausgabe:\n" msgid "%%c requires int or char" msgstr "%%c erwartet Int oder Char" +#: main.c +#, c-format +msgid "%02X" +msgstr "" + #: shared-bindings/rgbmatrix/RGBMatrix.c #, c-format msgid "" @@ -74,10 +79,27 @@ msgstr "" "%d Adress-Pins, %d RGB-Pins und %d Kacheln indizieren eine Höhe von %d, " "nicht %d" +#: ports/atmel-samd/common-hal/alarm/__init__.c +#: ports/cxd56/common-hal/analogio/AnalogOut.c ports/cxd56/common-hal/rtc/RTC.c +#: ports/espressif/common-hal/rtc/RTC.c +#: ports/mimxrt10xx/common-hal/analogio/AnalogOut.c +#: ports/mimxrt10xx/common-hal/rtc/RTC.c ports/nrf/common-hal/alarm/__init__.c +#: ports/nrf/common-hal/analogio/AnalogOut.c ports/nrf/common-hal/rtc/RTC.c +#: ports/raspberrypi/common-hal/alarm/__init__.c +#: ports/raspberrypi/common-hal/analogio/AnalogOut.c +#: ports/raspberrypi/common-hal/rtc/RTC.c ports/stm/common-hal/alarm/__init__.c +#: ports/stm/common-hal/rtc/RTC.c +msgid "%q" +msgstr "%q" + #: shared-bindings/microcontroller/Pin.c msgid "%q and %q contain duplicate pins" msgstr "%q und %q enthalten doppelte Pins" +#: ports/atmel-samd/common-hal/audioio/AudioOut.c +msgid "%q and %q must be different" +msgstr "%q und %q müssen unterschiedlich sein" + #: shared-bindings/microcontroller/Pin.c msgid "%q contains duplicate pins" msgstr "%q enthält doppelte Pins" @@ -86,16 +108,12 @@ msgstr "%q enthält doppelte Pins" msgid "%q failure: %d" msgstr "%q Fehler: %d" +#: shared-bindings/digitalio/DigitalInOut.c #: shared-bindings/microcontroller/Pin.c msgid "%q in use" msgstr "%q in Benutzung" -#: ports/atmel-samd/common-hal/pulseio/PulseIn.c -#: ports/cxd56/common-hal/pulseio/PulseIn.c -#: ports/nrf/common-hal/pulseio/PulseIn.c -#: ports/raspberrypi/common-hal/pulseio/PulseIn.c -#: ports/stm/common-hal/pulseio/PulseIn.c py/obj.c py/objstr.c -#: py/objstrunicode.c +#: py/obj.c py/objstr.c py/objstrunicode.c msgid "%q index out of range" msgstr "Der Index %q befindet sich außerhalb des Bereiches" @@ -103,21 +121,41 @@ msgstr "Der Index %q befindet sich außerhalb des Bereiches" msgid "%q indices must be integers, not %s" msgstr "%q Indizes müssen Integer sein, nicht %s" +#: shared-module/bitbangio/SPI.c +msgid "%q init failed" +msgstr "%q Initialisierung ist gescheitert" + +#: py/argcheck.c +msgid "%q length must be %d" +msgstr "%q länge muss %d betragen" + #: py/argcheck.c msgid "%q length must be %d-%d" msgstr "%q Länge muss %d-%d sein" -#: shared-bindings/busio/I2C.c shared-bindings/usb_hid/Device.c +#: py/argcheck.c +msgid "%q length must be <= %d" +msgstr "%q länge muss kleiner oder gleich %d sein" + +#: py/argcheck.c +msgid "%q length must be >= %d" +msgstr "%q länge muss größer oder gleich %d sein" + +#: shared-bindings/busio/I2C.c msgid "%q length must be >= 1" msgstr "%q Länge muss >= 1 sein" +#: py/argcheck.c +msgid "%q must be %d" +msgstr "%q muss %d entsprechen" + #: py/argcheck.c msgid "%q must be %d-%d" msgstr "%q muss %d-%d sein" #: shared-bindings/displayio/Display.c msgid "%q must be 1 when %q is True" -msgstr "" +msgstr "%q muss 1 sein, wenn %q wahr ist" #: py/argcheck.c shared-bindings/gifio/GifWriter.c msgid "%q must be <= %d" @@ -127,30 +165,18 @@ msgstr "%q muss <= %d sein" msgid "%q must be >= %d" msgstr "%q muss >= %d sein" -#: py/argcheck.c shared-bindings/memorymonitor/AllocationAlarm.c -msgid "%q must be >= 0" -msgstr "%q muss >= 0 sein" - -#: shared-bindings/_bleio/CharacteristicBuffer.c -#: shared-bindings/_bleio/PacketBuffer.c shared-bindings/displayio/Group.c -#: shared-bindings/displayio/Shape.c -#: shared-bindings/memorymonitor/AllocationAlarm.c -#: shared-bindings/vectorio/Circle.c shared-bindings/vectorio/Rectangle.c -msgid "%q must be >= 1" -msgstr "%q muss >= 1 sein" +#: shared-bindings/analogbufio/BufferedIn.c +#: shared-bindings/audiocore/RawSample.c +msgid "%q must be a bytearray or array of type 'h', 'H', 'b', or 'B'" +msgstr "" #: py/argcheck.c msgid "%q must be a string" msgstr "%q muss ein String sein" -#: shared-module/vectorio/Polygon.c -msgid "%q must be a tuple of length 2" -msgstr "%q muss ein Tupel der Länge 2 sein" - -#: ports/espressif/common-hal/imagecapture/ParallelImageCapture.c -#: shared-module/vectorio/VectorShape.c -msgid "%q must be between %d and %d" -msgstr "%q muss zwischen %d und %d sein" +#: py/argcheck.c +msgid "%q must be an int" +msgstr "%q muss vom Typ Integer sein" #: py/argcheck.c msgid "%q must be of type %q" @@ -168,7 +194,11 @@ msgstr "%q muss eine Potenz von 2 sein" msgid "%q out of bounds" msgstr "%q außerhalb der Grenzen" +#: ports/atmel-samd/common-hal/pulseio/PulseIn.c +#: ports/cxd56/common-hal/pulseio/PulseIn.c +#: ports/nrf/common-hal/pulseio/PulseIn.c #: ports/raspberrypi/common-hal/rp2pio/StateMachine.c +#: ports/stm/common-hal/pulseio/PulseIn.c py/argcheck.c #: shared-bindings/canio/Match.c msgid "%q out of range" msgstr "%q außerhalb des Bereichs" @@ -177,10 +207,6 @@ msgstr "%q außerhalb des Bereichs" msgid "%q pin invalid" msgstr "%q Pin ungültig" -#: shared-bindings/fontio/BuiltinFont.c -msgid "%q should be an int" -msgstr "%q sollte ein integer sein" - #: shared-bindings/usb_hid/Device.c msgid "%q with a report ID of 0 must be of length 1" msgstr "%q mit Berichts-ID von 0 muss von Länge 1 sein" @@ -194,7 +220,11 @@ msgstr "" msgid "%q, %q, and %q must all be the same length" msgstr "%q, %q und %q müssen alle die gleiche Länge haben" -#: ports/espressif/bindings/espidf/__init__.c ports/espressif/esp_error.c +#: py/objint.c +msgid "%q=%q" +msgstr "%q=%q" + +#: ports/espressif/common-hal/espidf/__init__.c ports/espressif/esp_error.c #, c-format msgid "%s error 0x%x" msgstr "%s Fehler 0x%x" @@ -279,7 +309,7 @@ msgstr "'%s' Objekt unterstützt keine Element-Zuordnung" msgid "'%s' object doesn't support item deletion" msgstr "'%s' Objekt unterstützt keine Löschung von Elementen" -#: py/runtime.c +#: ports/raspberrypi/common-hal/wifi/Radio.c py/runtime.c msgid "'%s' object has no attribute '%q'" msgstr "'%s' Objekt hat kein Attribut '%q'" @@ -344,10 +374,6 @@ msgstr "'yield from' innerhalb einer async Funktion" msgid "'yield' outside function" msgstr "'yield' außerhalb einer Funktion" -#: shared-module/vectorio/VectorShape.c -msgid "(x,y) integers required" -msgstr "(x,y) Integer benötigt" - #: py/compile.c msgid "*x must be assignment target" msgstr "*x muss Zuordnungsziel sein" @@ -383,16 +409,12 @@ msgstr "ADC2 wird vom WiFi benutzt" msgid "Address must be %d bytes long" msgstr "Die Adresse muss %d Bytes lang sein" -#: shared-bindings/_bleio/Address.c -msgid "Address type out of range" -msgstr "Adresstyp außerhalb des zulässigen Bereichs" - #: ports/espressif/common-hal/canio/CAN.c msgid "All CAN peripherals are in use" msgstr "Alle CAN-Schnittstellen sind in Benutzung" #: ports/espressif/common-hal/busio/I2C.c -#: ports/espressif/common-hal/i2cperipheral/I2CPeripheral.c +#: ports/espressif/common-hal/i2ctarget/I2CTarget.c #: ports/nrf/common-hal/busio/I2C.c msgid "All I2C peripherals are in use" msgstr "Alle I2C-Peripheriegeräte sind in Benutzung" @@ -429,7 +451,6 @@ msgstr "Alle Kanäle werden verwendet" msgid "All event channels in use" msgstr "Alle Event-Kanäle werden benutzt" -#: ports/raspberrypi/common-hal/pulseio/PulseIn.c #: ports/raspberrypi/common-hal/rp2pio/StateMachine.c msgid "All state machines in use" msgstr "Alle State-Maschinen in Verwendung" @@ -474,28 +495,10 @@ msgid "Already running" msgstr "Läuft bereits" #: ports/espressif/common-hal/wifi/Radio.c +#: ports/raspberrypi/common-hal/wifi/Radio.c msgid "Already scanning for wifi networks" msgstr "Sucht bereits nach Wifi-Netzwerken" -#: ports/cxd56/common-hal/analogio/AnalogIn.c -msgid "AnalogIn not supported on given pin" -msgstr "AnalogIn ist an diesem Pin nicht unterstützt" - -#: ports/cxd56/common-hal/analogio/AnalogOut.c -#: ports/mimxrt10xx/common-hal/analogio/AnalogOut.c -#: ports/nrf/common-hal/analogio/AnalogOut.c -#: ports/raspberrypi/common-hal/analogio/AnalogOut.c -msgid "AnalogOut functionality not supported" -msgstr "AnalogOut-Funktion wird nicht unterstützt" - -#: shared-bindings/analogio/AnalogOut.c -msgid "AnalogOut is only 16 bits. Value must be less than 65536." -msgstr "AnalogOut kann nur 16 Bit. Der Wert muss unter 65536 liegen." - -#: ports/atmel-samd/common-hal/analogio/AnalogOut.c -msgid "AnalogOut not supported on given pin" -msgstr "AnalogOut ist an diesem Pin nicht unterstützt" - #: ports/stm/common-hal/audiopwmio/PWMAudioOut.c msgid "Another PWMAudioOut is already active" msgstr "Ein anderer PWMAudioOut ist bereits aktiv" @@ -534,7 +537,7 @@ msgstr "Audio-Konvertierung nicht implementiert" msgid "AuthMode.OPEN is not used with password" msgstr "AuthMode.OPEN wird mit Passwort nicht verwendet" -#: shared-bindings/wifi/Radio.c +#: shared-bindings/wifi/Radio.c supervisor/shared/web_workflow/web_workflow.c msgid "Authentication failure" msgstr "Authentifizierungsfehler" @@ -567,11 +570,6 @@ msgstr "Bit clock und word select müssen geordnete Pins sein" 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 "Bittiefe muss zwischen 1 und 6 liegen, nicht %d" - #: shared-bindings/audiobusio/PDMIn.c msgid "Bit depth must be multiple of 8." msgstr "Bit depth muss ein Vielfaches von 8 sein." @@ -613,11 +611,6 @@ msgstr "Buffer + Offset zu klein %d %d %d" msgid "Buffer elements must be 4 bytes long or less" msgstr "Puffer-Elemente müssen 4 Bytes lang oder kürzer sein" -#: shared-module/usb_hid/Device.c -#, c-format -msgid "Buffer incorrect size. Should be %d bytes." -msgstr "Der Puffergröße ist inkorrekt. Sie sollte %d bytes haben." - #: shared-bindings/framebufferio/FramebufferDisplay.c msgid "Buffer is not a bytearray." msgstr "Der Buffer ist kein Byte-Array." @@ -627,7 +620,6 @@ msgstr "Der Buffer ist kein Byte-Array." msgid "Buffer is too small" msgstr "Der Puffer ist zu klein" -#: ports/nrf/common-hal/audiopwmio/PWMAudioOut.c #: ports/stm/common-hal/audiopwmio/PWMAudioOut.c #, c-format msgid "Buffer length %d too big. It must be less than %d" @@ -642,10 +634,6 @@ msgstr "Die Pufferlänge muss ein vielfaches von 512 sein" msgid "Buffer must be a multiple of 512 bytes" msgstr "Der Puffer muss ein vielfaches von 512 bytes sein" -#: shared-bindings/bitbangio/I2C.c -msgid "Buffer must be at least length 1" -msgstr "Der Puffer muss eine Mindestenslänge von 1 haben" - #: shared-bindings/_bleio/PacketBuffer.c #, c-format msgid "Buffer too short by %d bytes" @@ -667,10 +655,6 @@ msgstr "Bus-Pin %d wird schon benutzt" msgid "Byte buffer must be 16 bytes." msgstr "Der Puffer muss 16 Bytes lang sein." -#: shared-bindings/alarm/SleepMemory.c shared-bindings/nvm/ByteArray.c -msgid "Bytes must be between 0 and 255." -msgstr "Ein Bytes kann nur Werte zwischen 0 und 255 annehmen." - #: shared-bindings/aesio/aes.c msgid "CBC blocks must be multiples of 16 bytes" msgstr "CBC-Blöcke müssen ein Vielfaches von 16 Bytes sein" @@ -679,7 +663,7 @@ msgstr "CBC-Blöcke müssen ein Vielfaches von 16 Bytes sein" msgid "CIRCUITPY drive could not be found or created." msgstr "CIRCUITPY-Laufwerk konnte nicht gefunden oder erzeugt werden." -#: ports/espressif/bindings/espidf/__init__.c ports/espressif/esp_error.c +#: ports/espressif/common-hal/espidf/__init__.c ports/espressif/esp_error.c msgid "CRC or checksum was invalid" msgstr "CRC oder Checksumme ungültig" @@ -687,6 +671,10 @@ msgstr "CRC oder Checksumme ungültig" msgid "Call super().__init__() before accessing native object." msgstr "Rufe super().__init__() vor dem Zugriff auf ein natives Objekt auf." +#: ports/cxd56/common-hal/camera/Camera.c +msgid "Camera init" +msgstr "Kamera Initialiserung" + #: ports/espressif/common-hal/alarm/pin/PinAlarm.c msgid "Can only alarm on RTC IO from deep sleep." msgstr "Alarm der RTC IO kann nur im deep sleep ausgeführt werden." @@ -737,18 +725,10 @@ msgid "Cannot have scan responses for extended, connectable advertisements." msgstr "" "Es können keine Scanantworten für erweiterte, verbindbare Anzeigen vorliegen." -#: ports/atmel-samd/common-hal/audioio/AudioOut.c -msgid "Cannot output both channels on the same pin" -msgstr "Kann nicht beite Kanäle auf dem gleichen Pin ausgeben" - #: ports/espressif/common-hal/alarm/pin/PinAlarm.c msgid "Cannot pull on input-only pin." msgstr "Kann nicht 'pull' an einem 'input-only' pin." -#: shared-module/bitbangio/SPI.c -msgid "Cannot read without MISO pin." -msgstr "Kann ohne MISO-Pin nicht lesen." - #: shared-bindings/audiobusio/PDMIn.c msgid "Cannot record to a file" msgstr "Aufnahme in eine Datei nicht möglich" @@ -760,8 +740,8 @@ msgstr "'/' kann nicht wiedereingehängt werden, wenn per USB sichtbar." #: ports/atmel-samd/common-hal/microcontroller/__init__.c #: ports/cxd56/common-hal/microcontroller/__init__.c #: ports/mimxrt10xx/common-hal/microcontroller/__init__.c -msgid "Cannot reset into bootloader because no bootloader is present." -msgstr "Reset zum Bootloader nicht möglich, da Bootloader nicht vorhanden." +msgid "Cannot reset into bootloader because no bootloader is present" +msgstr "Kann nicht in den Bootloader resetten, weil keiner vorhanden ist" #: ports/espressif/common-hal/socketpool/Socket.c msgid "Cannot set socket options" @@ -781,23 +761,23 @@ msgid "Cannot subclass slice" msgstr "Slice kann keine sub-klasse sein" #: shared-module/bitbangio/SPI.c -msgid "Cannot transfer without MOSI and MISO pins." -msgstr "Übertragung ohne MOSI- und MISO-Pins nicht möglich." +msgid "Cannot transfer without MOSI and MISO pins" +msgstr "Kann nicht ohne MISO und MOSI Pins transferieren" #: shared-bindings/pwmio/PWMOut.c msgid "Cannot vary frequency on a timer that is already in use" msgstr "" "Die Frequenz eines bereits verwendeten Timers kann nicht variiert werden" -#: ports/espressif/common-hal/alarm/pin/PinAlarm.c #: ports/nrf/common-hal/alarm/pin/PinAlarm.c +#, fuzzy +msgid "Cannot wake on pin edge, only level" +msgstr "Kann nicht durch \"Pin edge\" geweckt werden nur durch \"level\"" + +#: ports/espressif/common-hal/alarm/pin/PinAlarm.c msgid "Cannot wake on pin edge. Only level." msgstr "Kann nicht auf Flanke wecken, nur auf Level." -#: shared-module/bitbangio/SPI.c -msgid "Cannot write without MOSI pin." -msgstr "Kann nicht ohne MOSI-Pin schreiben." - #: shared-bindings/_bleio/CharacteristicBuffer.c msgid "CharacteristicBuffer writing not provided" msgstr "Schreiben von CharacteristicBuffer ist nicht vorgesehen" @@ -810,10 +790,6 @@ msgstr "Der CircuitPython-Kerncode ist hart abgestürzt. Hoppla!\n" msgid "CircuitPython was unable to allocate the heap." msgstr "CircuitPython war es nicht möglich heap-Speicher zu allozieren." -#: shared-module/bitbangio/SPI.c -msgid "Clock pin init failed." -msgstr "Clock pin init fehlgeschlagen." - #: shared-module/bitbangio/I2C.c msgid "Clock stretch too long" msgstr "Clock stretch zu lang" @@ -822,11 +798,6 @@ msgstr "Clock stretch zu lang" msgid "Clock unit in use" msgstr "Clock unit wird benutzt" -#: shared-bindings/displayio/FourWire.c shared-bindings/displayio/I2CDisplay.c -#: shared-bindings/paralleldisplay/ParallelBus.c -msgid "Command must be an int between 0 and 255" -msgstr "Der Befehl muss ein int zwischen 0 und 255 sein" - #: shared-bindings/_bleio/Connection.c msgid "" "Connection has been disconnected and can no longer be used. Create a new " @@ -839,35 +810,6 @@ msgstr "" msgid "Corrupt .mpy file" msgstr "Beschädigte .mpy Datei" -#: ports/cxd56/common-hal/camera/Camera.c -msgid "Could not initialize Camera" -msgstr "Konnte Kamera nicht initialisieren" - -#: ports/cxd56/common-hal/gnss/GNSS.c -msgid "Could not initialize GNSS" -msgstr "GNSS konnte nicht initialisiert werden" - -#: ports/cxd56/common-hal/sdioio/SDCard.c -msgid "Could not initialize SDCard" -msgstr "Konnte SDKarte nicht initialisieren" - -#: ports/atmel-samd/common-hal/busio/UART.c ports/cxd56/common-hal/busio/UART.c -#: ports/espressif/common-hal/busio/UART.c -msgid "Could not initialize UART" -msgstr "Konnte UART nicht initialisieren" - -#: ports/stm/common-hal/pwmio/PWMOut.c -msgid "Could not re-init channel" -msgstr "Kanal konnte nicht neu initiiert werden" - -#: ports/stm/common-hal/pwmio/PWMOut.c -msgid "Could not re-init timer" -msgstr "Timer konnte nicht neu gestartet werden" - -#: ports/stm/common-hal/pwmio/PWMOut.c -msgid "Could not restart PWM" -msgstr "PWM konnte nicht neu gestartet werden" - #: ports/espressif/common-hal/neopixel_write/__init__.c msgid "Could not retrieve clock" msgstr "Clock konnte nicht ermittelt werden" @@ -888,27 +830,13 @@ msgstr "Interrupt konnte nicht gestartet werden, RX beschäftigt" msgid "Couldn't allocate decoder" msgstr "Decoder konnte nicht zugeordnet werden" -#: shared-module/audiocore/WaveFile.c shared-module/audiomixer/Mixer.c -#: shared-module/audiomp3/MP3Decoder.c -msgid "Couldn't allocate first buffer" -msgstr "Konnte first buffer nicht zuteilen" - -#: shared-module/audiomp3/MP3Decoder.c -msgid "Couldn't allocate input buffer" -msgstr "Eingabepuffer konnte nicht reserviert werden" - -#: shared-module/audiocore/WaveFile.c shared-module/audiomixer/Mixer.c -#: shared-module/audiomp3/MP3Decoder.c -msgid "Couldn't allocate second buffer" -msgstr "Konnte second buffer nicht zuteilen" - #: supervisor/shared/safe_mode.c msgid "Crash into the HardFault_Handler." msgstr "Absturz in den HardFault_Handler." #: ports/stm/common-hal/analogio/AnalogOut.c msgid "DAC Channel Init Error" -msgstr "DAC Kanal Initialisierungsfehler" +msgstr "DAC-Kanal-Initialisierungsfehler" #: ports/stm/common-hal/analogio/AnalogOut.c msgid "DAC Device Init Error" @@ -949,10 +877,6 @@ msgstr "Die Zielkapazität ist kleiner als destination_length." msgid "Device in use" msgstr "Gerät in Benutzung" -#: ports/cxd56/common-hal/digitalio/DigitalInOut.c -msgid "DigitalInOut not supported on given pin" -msgstr "DigitalInOut wird auf dem angegebenen Pin nicht unterstützt" - #: shared-bindings/displayio/Display.c #: shared-bindings/framebufferio/FramebufferDisplay.c msgid "Display must have a 16 bit colorspace." @@ -964,6 +888,10 @@ msgstr "Display muss einen 16 Bit Farbraum haben." msgid "Display rotation must be in 90 degree increments" msgstr "Die Rotation der Anzeige muss in 90-Grad-Schritten erfolgen" +#: main.c +msgid "Done" +msgstr "Fertig" + #: shared-bindings/digitalio/DigitalInOut.c msgid "Drive mode not used when direction is input." msgstr "Drive mode wird nicht verwendet, wenn die Richtung input ist." @@ -997,21 +925,20 @@ msgstr "Fehler in regex" msgid "Error: Failure to bind" msgstr "Error: Bind Fehler" -#: ports/raspberrypi/bindings/rp2pio/StateMachine.c py/enum.c -#: shared-bindings/_bleio/__init__.c shared-bindings/aesio/aes.c -#: shared-bindings/busio/SPI.c shared-bindings/microcontroller/Pin.c +#: py/enum.c shared-bindings/_bleio/__init__.c shared-bindings/aesio/aes.c +#: shared-bindings/alarm/__init__.c shared-bindings/busio/SPI.c +#: shared-bindings/microcontroller/Pin.c #: shared-bindings/neopixel_write/__init__.c msgid "Expected a %q" msgstr "Erwartet ein(e) %q" -#: shared-bindings/alarm/__init__.c -msgid "Expected an alarm" -msgstr "Alarm erwartet" +#: ports/raspberrypi/bindings/cyw43/__init__.c +msgid "Expected a %q or %q" +msgstr "" -#: shared-module/adafruit_pixelbuf/PixelBuf.c -#, c-format -msgid "Expected tuple of length %d, got %d" -msgstr "Habe ein Tupel der Länge %d erwartet aber %d erhalten" +#: shared-bindings/alarm/__init__.c +msgid "Expected an %q" +msgstr "" #: ports/espressif/common-hal/_bleio/Adapter.c #: ports/nrf/common-hal/_bleio/Adapter.c @@ -1040,21 +967,9 @@ msgstr "Kommando nicht gesendet." msgid "Failed to acquire mutex, err 0x%04x" msgstr "Mutex konnte nicht akquiriert werden. Status: 0x%04x" -#: ports/mimxrt10xx/common-hal/busio/UART.c ports/nrf/common-hal/busio/UART.c -#: ports/raspberrypi/common-hal/busio/UART.c -msgid "Failed to allocate RX buffer" -msgstr "Konnte keinen RX Buffer allozieren" - -#: ports/atmel-samd/common-hal/busio/UART.c -#: ports/atmel-samd/common-hal/pulseio/PulseIn.c -#: ports/cxd56/common-hal/pulseio/PulseIn.c -#: ports/espressif/common-hal/pulseio/PulseIn.c -#: ports/nrf/common-hal/pulseio/PulseIn.c -#: ports/raspberrypi/common-hal/pulseio/PulseIn.c -#: ports/stm/common-hal/pulseio/PulseIn.c -#, c-format -msgid "Failed to allocate RX buffer of %d bytes" -msgstr "Konnte keine RX Buffer mit %d allozieren" +#: shared-module/rgbmatrix/RGBMatrix.c +msgid "Failed to allocate %q buffer" +msgstr "Allokieren des %q Buffers ist fehlgeschlagen" #: ports/espressif/common-hal/wifi/__init__.c msgid "Failed to allocate Wifi memory" @@ -1077,10 +992,6 @@ msgstr "Verbindung fehlgeschlagen: interner Fehler" msgid "Failed to connect: timeout" msgstr "Verbindung nicht erfolgreich: timeout" -#: ports/espressif/common-hal/wifi/__init__.c -msgid "Failed to init wifi" -msgstr "Wifi Initialisierung ist fehlgeschlagen" - #: shared-module/audiomp3/MP3Decoder.c msgid "Failed to parse MP3 file" msgstr "MP3-Datei konnte nicht analysiert werden" @@ -1124,15 +1035,12 @@ msgstr "Für RGB-Farbräume muss die Eingabe-Bitmap 16 Bit pro Pixel haben" msgid "Format not supported" msgstr "Format nicht unterstützt" -#: shared-module/framebufferio/FramebufferDisplay.c -#, c-format -msgid "Framebuffer requires %d bytes" -msgstr "Framepuffer benötigt %d bytes" - #: ports/mimxrt10xx/common-hal/microcontroller/Processor.c msgid "" "Frequency must be 24, 150, 396, 450, 528, 600, 720, 816, 912, 960 or 1008 Mhz" msgstr "" +"Die Frequenz muss 24, 150, 396, 450, 528, 600, 720, 816, 912, 960 oder 1008 " +"MHz betragen" #: shared-bindings/pwmio/PWMOut.c msgid "Frequency must match existing PWMOut using this timer" @@ -1145,7 +1053,11 @@ msgstr "" msgid "Function requires lock" msgstr "Die Funktion erwartet, dass der 'lock'-Befehl zuvor ausgeführt wurde" -#: ports/espressif/bindings/espidf/__init__.c ports/espressif/esp_error.c +#: ports/cxd56/common-hal/gnss/GNSS.c +msgid "GNSS init" +msgstr "GNSS Initialisierung" + +#: ports/espressif/common-hal/espidf/__init__.c ports/espressif/esp_error.c msgid "Generic Failure" msgstr "Generischer Fehler" @@ -1172,19 +1084,16 @@ msgstr "Hardware beschäftigt, versuchen Sie alternative Pins" msgid "Hardware in use, try alternative pins" msgstr "Hardware in Benutzung, probiere alternative Pins" -#: shared-bindings/wifi/Radio.c -msgid "Hostname must be between 1 and 253 characters" -msgstr "Der Hostname muss zwischen 1 und 253 Zeichen haben" - #: extmod/vfs_posix_file.c py/objstringio.c msgid "I/O operation on closed file" msgstr "Lese/Schreibe-operation an geschlossener Datei" #: ports/stm/common-hal/busio/I2C.c -msgid "I2C Init Error" -msgstr "I2C-Init-Fehler" +msgid "I2C init error" +msgstr "I2C Initialisierungsfehler" #: ports/raspberrypi/common-hal/busio/I2C.c +#: ports/raspberrypi/common-hal/i2ctarget/I2CTarget.c msgid "I2C peripheral in use" msgstr "I2C Peripherie in Verwendung" @@ -1295,75 +1204,37 @@ msgstr "Interner Fehler" msgid "Internal error #%d" msgstr "Interner Fehler #%d" -#: shared-bindings/sdioio/SDCard.c shared-module/usb_hid/Device.c +#: supervisor/shared/safe_mode.c +msgid "Internal watchdog timer expired." +msgstr "Der Interne WatchDog Timer ist abgelaufen." + +#: py/argcheck.c shared-bindings/digitalio/DigitalInOut.c msgid "Invalid %q" msgstr "Ungültiger %q" -#: ports/atmel-samd/common-hal/audiobusio/I2SOut.c -#: ports/atmel-samd/common-hal/audiobusio/PDMIn.c -#: ports/atmel-samd/common-hal/imagecapture/ParallelImageCapture.c -#: ports/mimxrt10xx/common-hal/busio/UART.c +#: shared-bindings/microcontroller/Pin.c msgid "Invalid %q pin" msgstr "Ungültiger %q Pin" -#: ports/stm/common-hal/busio/I2C.c ports/stm/common-hal/busio/SPI.c -#: ports/stm/common-hal/busio/UART.c ports/stm/common-hal/canio/CAN.c -#: ports/stm/common-hal/sdioio/SDCard.c -msgid "Invalid %q pin selection" -msgstr "Ungültige %q Pin-Auswahl" - #: ports/stm/common-hal/analogio/AnalogIn.c msgid "Invalid ADC Unit value" msgstr "Ungültiger ADC-Einheitenwert" -#: ports/espressif/common-hal/wifi/Radio.c -msgid "Invalid AuthMode" -msgstr "Ungültiges AuthMode" - #: ports/espressif/common-hal/_bleio/__init__.c #: ports/nrf/common-hal/_bleio/__init__.c msgid "Invalid BLE parameter" msgstr "Ungültiges BLE Parameter" -#: shared-module/displayio/OnDiskBitmap.c -msgid "Invalid BMP file" -msgstr "Ungültige BMP-Datei" - #: shared-bindings/wifi/Radio.c msgid "Invalid BSSID" msgstr "Ungültige BSSID" -#: ports/espressif/common-hal/analogio/AnalogOut.c -#: ports/stm/common-hal/analogio/AnalogOut.c -msgid "Invalid DAC pin supplied" -msgstr "Ungültiger DAC-Pin angegeben" - #: shared-bindings/wifi/Radio.c msgid "Invalid MAC address" msgstr "Ungültige MAC-Adresse" -#: shared-bindings/synthio/__init__.c -msgid "Invalid MIDI file" -msgstr "Ungültige MIDI Datei" - -#: ports/atmel-samd/common-hal/pwmio/PWMOut.c -#: ports/cxd56/common-hal/pwmio/PWMOut.c -#: ports/espressif/common-hal/pwmio/PWMOut.c -#: ports/mimxrt10xx/common-hal/pwmio/PWMOut.c -#: ports/nrf/common-hal/pwmio/PWMOut.c -#: ports/raspberrypi/common-hal/pwmio/PWMOut.c shared-bindings/pwmio/PWMOut.c -msgid "Invalid PWM frequency" -msgstr "Ungültige PWM Frequenz" - -#: ports/espressif/common-hal/analogio/AnalogIn.c -msgid "Invalid Pin" -msgstr "Ungültiger Pin" - -#: ports/espressif/bindings/espidf/__init__.c -#: ports/espressif/common-hal/busio/I2C.c -#: ports/espressif/common-hal/i2cperipheral/I2CPeripheral.c -#: ports/espressif/esp_error.c py/moduerrno.c -#: shared-module/rgbmatrix/RGBMatrix.c +#: ports/espressif/common-hal/espidf/__init__.c ports/espressif/esp_error.c +#: py/moduerrno.c msgid "Invalid argument" msgstr "Ungültiges Argument" @@ -1371,42 +1242,11 @@ msgstr "Ungültiges Argument" msgid "Invalid bits per value" msgstr "Ungültige Bits pro Wert" -#: ports/nrf/common-hal/busio/UART.c ports/raspberrypi/common-hal/busio/UART.c -#: ports/stm/common-hal/busio/UART.c -msgid "Invalid buffer size" -msgstr "Ungültige Puffergröße" - -#: shared-bindings/adafruit_pixelbuf/PixelBuf.c -msgid "Invalid byteorder string" -msgstr "Ungültige Byteorder-String" - -#: ports/atmel-samd/common-hal/frequencyio/FrequencyIn.c -#: ports/espressif/common-hal/frequencyio/FrequencyIn.c -msgid "Invalid capture period. Valid range: 1 - 500" -msgstr "Ungültiger Aufnahmezeitraum. Gültiger Bereich: 1 - 500" - -#: shared-bindings/audiomixer/Mixer.c -msgid "Invalid channel count" -msgstr "Ungültige Anzahl von Kanälen" - -#: ports/atmel-samd/common-hal/imagecapture/ParallelImageCapture.c -#, c-format -msgid "Invalid data_count %d" -msgstr "Ungültiger data_count %d" - #: ports/atmel-samd/common-hal/imagecapture/ParallelImageCapture.c #, c-format msgid "Invalid data_pins[%d]" msgstr "Ungültige data_pins[%d]" -#: shared-bindings/digitalio/DigitalInOut.c -msgid "Invalid direction." -msgstr "Ungültige Richtung." - -#: shared-module/audiocore/WaveFile.c -msgid "Invalid file" -msgstr "Ungültige Datei" - #: shared-module/audiocore/WaveFile.c msgid "Invalid format chunk size" msgstr "Ungültige format chunk size" @@ -1415,107 +1255,27 @@ msgstr "Ungültige format chunk size" msgid "Invalid memory access." msgstr "Ungültiger Speicherzugriff." -#: extmod/vfs_fat_file.c -msgid "Invalid mode" -msgstr "Ungültiger Modus" - #: ports/espressif/common-hal/wifi/Radio.c msgid "Invalid multicast MAC address" msgstr "Ungültige Multicast-MAC-Adresse" -#: shared-bindings/bitbangio/SPI.c shared-bindings/busio/SPI.c -msgid "Invalid number of bits" -msgstr "Ungültige Anzahl von Bits" - -#: shared-bindings/bitbangio/SPI.c shared-bindings/busio/SPI.c -#: shared-bindings/displayio/FourWire.c -msgid "Invalid phase" -msgstr "Ungültige Phase" - -#: ports/atmel-samd/common-hal/audioio/AudioOut.c -#: ports/atmel-samd/common-hal/touchio/TouchIn.c -#: ports/espressif/common-hal/alarm/touch/TouchAlarm.c -#: ports/espressif/common-hal/touchio/TouchIn.c -#: ports/nrf/common-hal/alarm/pin/PinAlarm.c shared-bindings/pwmio/PWMOut.c -#: shared-module/rgbmatrix/RGBMatrix.c -msgid "Invalid pin" -msgstr "Ungültiger Pin" - -#: ports/atmel-samd/common-hal/audioio/AudioOut.c -msgid "Invalid pin for left channel" -msgstr "Ungültiger Pin für linken Kanal" - -#: ports/atmel-samd/common-hal/audioio/AudioOut.c -msgid "Invalid pin for right channel" -msgstr "Ungültiger Pin für rechten Kanal" - -#: ports/atmel-samd/common-hal/busio/I2C.c -#: ports/atmel-samd/common-hal/busio/SPI.c -#: ports/atmel-samd/common-hal/busio/UART.c -#: ports/atmel-samd/common-hal/i2cperipheral/I2CPeripheral.c -#: ports/cxd56/common-hal/busio/I2C.c ports/cxd56/common-hal/busio/SPI.c -#: ports/cxd56/common-hal/busio/UART.c ports/cxd56/common-hal/sdioio/SDCard.c -#: ports/espressif/common-hal/busio/I2C.c -#: ports/espressif/common-hal/busio/SPI.c -#: ports/espressif/common-hal/busio/UART.c -#: ports/espressif/common-hal/canio/CAN.c -#: ports/espressif/common-hal/i2cperipheral/I2CPeripheral.c -#: ports/mimxrt10xx/common-hal/busio/I2C.c -#: ports/mimxrt10xx/common-hal/busio/SPI.c -#: ports/mimxrt10xx/common-hal/usb_host/Port.c ports/nrf/common-hal/busio/I2C.c -#: ports/raspberrypi/common-hal/busio/I2C.c -#: ports/raspberrypi/common-hal/busio/SPI.c -#: ports/raspberrypi/common-hal/busio/UART.c shared-bindings/busio/SPI.c #: shared-bindings/busio/UART.c msgid "Invalid pins" msgstr "Ungültige Pins" -#: shared-bindings/bitbangio/SPI.c shared-bindings/busio/SPI.c -#: shared-bindings/displayio/FourWire.c -msgid "Invalid polarity" -msgstr "Ungültige Polarität" - -#: shared-bindings/_bleio/Characteristic.c -msgid "Invalid properties" -msgstr "Ungültige Eigenschaften" - -#: shared-bindings/microcontroller/__init__.c -msgid "Invalid run mode." -msgstr "Ungültiger Ausführungsmodus." - -#: shared-module/_bleio/Attribute.c -msgid "Invalid security_mode" -msgstr "Ungültiger security_mode" - -#: ports/espressif/bindings/espidf/__init__.c ports/espressif/esp_error.c +#: ports/espressif/common-hal/espidf/__init__.c ports/espressif/esp_error.c msgid "Invalid size" msgstr "Ungültige Größe" #: ports/espressif/common-hal/ssl/SSLContext.c +#: ports/raspberrypi/common-hal/ssl/SSLSocket.c msgid "Invalid socket for TLS" msgstr "Ungültiges Socket für TLS" -#: ports/espressif/bindings/espidf/__init__.c ports/espressif/esp_error.c +#: ports/espressif/common-hal/espidf/__init__.c ports/espressif/esp_error.c msgid "Invalid state" msgstr "Ungültiger Zustand" -#: shared-bindings/audiomixer/Mixer.c -msgid "Invalid voice" -msgstr "Ungültige Stimme" - -#: shared-bindings/audiomixer/Mixer.c -msgid "Invalid voice count" -msgstr "Ungültige Anzahl von Stimmen" - -#: shared-module/audiocore/WaveFile.c -msgid "Invalid wave file" -msgstr "Ungültige wave Datei" - -#: ports/mimxrt10xx/common-hal/busio/UART.c ports/nrf/common-hal/busio/UART.c -#: ports/raspberrypi/common-hal/busio/UART.c ports/stm/common-hal/busio/UART.c -msgid "Invalid word/bit length" -msgstr "Ungültige Wort- / Bitlänge" - #: shared-bindings/aesio/aes.c msgid "Key must be 16, 24, or 32 bytes long" msgstr "Der Schlüssel muss 16, 24 oder 32 Byte lang sein" @@ -1529,25 +1289,17 @@ msgid "LHS of keyword arg must be an id" msgstr "LHS des Schlüsselwortarguments muss eine id sein" #: shared-module/displayio/Group.c -msgid "Layer already in a group." -msgstr "Layer ist bereits in einer Gruppe." +msgid "Layer already in a group" +msgstr "Ebene ist bereits in der Gruppe" #: shared-module/displayio/Group.c -msgid "Layer must be a Group or TileGrid subclass." -msgstr "Layer muss eine Group- oder TileGrid-Unterklasse sein." +msgid "Layer must be a Group or TileGrid subclass" +msgstr "Ebene muss eine Gruppe oder eine TileGrid Subklasse sein" -#: ports/espressif/bindings/espidf/__init__.c ports/espressif/esp_error.c +#: ports/espressif/common-hal/espidf/__init__.c ports/espressif/esp_error.c msgid "MAC address was invalid" msgstr "MAC Adresse war ungültig" -#: shared-module/bitbangio/SPI.c -msgid "MISO pin init failed." -msgstr "MISO pin Initialisierung fehlgeschlagen." - -#: shared-module/bitbangio/SPI.c -msgid "MOSI pin init failed." -msgstr "MOSI pin Initialisierung fehlgeschlagen." - #: shared-bindings/is31fl3741/IS31FL3741.c msgid "Mapping must be a tuple" msgstr "Zuordnung muss ein Tupel sein" @@ -1557,10 +1309,6 @@ msgstr "Zuordnung muss ein Tupel sein" msgid "Maximum x value when mirrored is %d" msgstr "Maximaler x-Wert beim Spiegeln ist %d" -#: shared-bindings/canio/Message.c -msgid "Messages limited to 8 bytes" -msgstr "Meldungen auf 8 Bytes limitiert" - #: shared-bindings/audiobusio/PDMIn.c msgid "Microphone startup delay must be in range 0.0 to 1.0" msgstr "" @@ -1569,16 +1317,20 @@ msgstr "" #: ports/raspberrypi/bindings/rp2pio/StateMachine.c #: ports/raspberrypi/common-hal/rp2pio/StateMachine.c msgid "Mismatched data size" -msgstr "" +msgstr "Nicht übereinstimmende Datengröße" #: ports/raspberrypi/common-hal/rp2pio/StateMachine.c msgid "Mismatched swap flag" -msgstr "" +msgstr "Nicht übereinstimmendes Swap-Flag" -#: ports/mimxrt10xx/common-hal/busio/SPI.c ports/stm/common-hal/busio/SPI.c +#: ports/mimxrt10xx/common-hal/busio/SPI.c msgid "Missing MISO or MOSI Pin" msgstr "Fehlender MISO- oder MOSI-Pin" +#: ports/stm/common-hal/busio/SPI.c +msgid "Missing MISO or MOSI pin" +msgstr "MISO oder MOSI Pin fehlt" + #: ports/raspberrypi/common-hal/rp2pio/StateMachine.c #, c-format msgid "Missing first_in_pin. Instruction %d reads pin(s)" @@ -1614,11 +1366,6 @@ msgstr "Fehlender first_set_pin. Instruktion %d setzt Pin(s)" msgid "Missing jmp_pin. Instruction %d jumps on pin" msgstr "jmp_pin fehlt. Befehl %d springt auf Pin" -#: shared-module/usb_hid/Device.c -#, c-format -msgid "More than %d report ids not supported" -msgstr "Mehr als %d Berichts-IDs werden nicht unterstützt" - #: shared-bindings/busio/UART.c shared-bindings/displayio/Group.c msgid "Must be a %q subclass." msgstr "Muss eine %q Unterklasse sein." @@ -1646,7 +1393,7 @@ msgstr "Name zu lang" #: shared-bindings/displayio/TileGrid.c msgid "New bitmap must be same size as old bitmap" -msgstr "" +msgstr "Neue Bitmap muss die gleiche Größe wie alte Bitmap haben" #: ports/espressif/common-hal/_bleio/__init__.c msgid "Nimble out of memory" @@ -1678,16 +1425,28 @@ msgstr "Kein DMA-Pacing Timer gefunden" msgid "No I2C device at address: 0x%x" msgstr "Kein I2C-Gerät an Adresse: 0x%x" +#: supervisor/shared/web_workflow/web_workflow.c +msgid "No IP" +msgstr "Keine IP" + #: ports/espressif/common-hal/busio/SPI.c -#: ports/mimxrt10xx/common-hal/busio/SPI.c ports/stm/common-hal/busio/SPI.c +#: ports/mimxrt10xx/common-hal/busio/SPI.c msgid "No MISO Pin" msgstr "Kein MISO-Pin" +#: ports/stm/common-hal/busio/SPI.c shared-module/bitbangio/SPI.c +msgid "No MISO pin" +msgstr "Miso Pin fehlt" + #: ports/espressif/common-hal/busio/SPI.c -#: ports/mimxrt10xx/common-hal/busio/SPI.c ports/stm/common-hal/busio/SPI.c +#: ports/mimxrt10xx/common-hal/busio/SPI.c msgid "No MOSI Pin" msgstr "Kein MOSI-Pin" +#: ports/stm/common-hal/busio/SPI.c shared-module/bitbangio/SPI.c +msgid "No MOSI pin" +msgstr "MOSI Pin fehlt" + #: ports/atmel-samd/common-hal/busio/UART.c #: ports/espressif/common-hal/busio/UART.c #: ports/mimxrt10xx/common-hal/busio/UART.c ports/nrf/common-hal/busio/UART.c @@ -1726,16 +1485,6 @@ msgstr "Keine freien GCLKs" msgid "No hardware random available" msgstr "Kein hardware random verfügbar" -#: ports/atmel-samd/common-hal/ps2io/Ps2.c -msgid "No hardware support on clk pin" -msgstr "Keine Hardwareunterstützung am clk Pin" - -#: ports/atmel-samd/common-hal/alarm/pin/PinAlarm.c -#: ports/atmel-samd/common-hal/frequencyio/FrequencyIn.c -#: ports/atmel-samd/common-hal/pulseio/PulseIn.c -msgid "No hardware support on pin" -msgstr "Keine Hardwareunterstützung an diesem Pin" - #: ports/raspberrypi/common-hal/rp2pio/StateMachine.c msgid "No in in program" msgstr "Nicht in Programm" @@ -1782,7 +1531,7 @@ msgstr "Kein Speicherplatz mehr verfügbar auf dem Gerät" #: py/moduerrno.c msgid "No such device" -msgstr "" +msgstr "Kein solches Gerät" #: py/moduerrno.c msgid "No such file/directory" @@ -1835,16 +1584,26 @@ msgstr "" msgid "Odd parity is not supported" msgstr "Eine ungerade Parität wird nicht unterstützt" +#: supervisor/shared/bluetooth/bluetooth.c +msgid "Off" +msgstr "Aus" + +#: supervisor/shared/bluetooth/bluetooth.c +msgid "Ok" +msgstr "Ok" + #: ports/atmel-samd/common-hal/audiobusio/PDMIn.c #: ports/raspberrypi/common-hal/audiobusio/PDMIn.c msgid "Only 8 or 16 bit mono with " msgstr "Nur 8 oder 16 bit mono mit " #: ports/espressif/common-hal/wifi/__init__.c +#: ports/raspberrypi/common-hal/wifi/__init__.c msgid "Only IPv4 addresses supported" msgstr "Nur IPv4-Adressen werden unterstützt" -#: ports/espressif/common-hal/socketpool/SocketPool.c +#: ports/espressif/common-hal/socketpool/Socket.c +#: ports/raspberrypi/common-hal/socketpool/Socket.c msgid "Only IPv4 sockets supported" msgstr "Nur IPv4-Sockets werden unterstützt" @@ -1881,15 +1640,19 @@ msgstr "" msgid "Only one TouchAlarm can be set in deep sleep." msgstr "Nur ein TouchAlarm kann in Deep Sleep gesetzt werden." -#: ports/espressif/common-hal/i2cperipheral/I2CPeripheral.c +#: ports/espressif/common-hal/i2ctarget/I2CTarget.c +#: ports/raspberrypi/common-hal/i2ctarget/I2CTarget.c msgid "Only one address is allowed" msgstr "Nur eine Adresse ist erlaubt" #: ports/atmel-samd/common-hal/alarm/time/TimeAlarm.c -#: ports/espressif/common-hal/alarm/time/TimeAlarm.c #: ports/nrf/common-hal/alarm/time/TimeAlarm.c -#: ports/raspberrypi/common-hal/alarm/time/TimeAlarm.c #: ports/stm/common-hal/alarm/time/TimeAlarm.c +msgid "Only one alarm.time alarm can be set" +msgstr "Nur ein alarm.time Alarm kann gesetzt werden" + +#: ports/espressif/common-hal/alarm/time/TimeAlarm.c +#: ports/raspberrypi/common-hal/alarm/time/TimeAlarm.c msgid "Only one alarm.time alarm can be set." msgstr "Nur eine alarm-time kann gesetzt werden." @@ -1899,21 +1662,22 @@ msgstr "Nur eine Farbe kann transparent sein zu einer Zeit" #: py/moduerrno.c msgid "Operation not permitted" -msgstr "" +msgstr "Operation nicht erlaubt" -#: ports/espressif/bindings/espidf/__init__.c ports/espressif/esp_error.c +#: ports/espressif/common-hal/espidf/__init__.c ports/espressif/esp_error.c msgid "Operation or feature not supported" msgstr "Vorgang oder Funktion wird nicht unterstützt" -#: ports/espressif/bindings/espidf/__init__.c ports/espressif/esp_error.c +#: ports/espressif/common-hal/espidf/__init__.c ports/espressif/esp_error.c msgid "Operation timed out" msgstr "Zeit für Vorgang abgelaufen" -#: ports/espressif/bindings/espidf/__init__.c ports/espressif/esp_error.c +#: ports/espressif/common-hal/espidf/__init__.c ports/espressif/esp_error.c msgid "Out of memory" msgstr "Kein Speicher mehr verfügbar" -#: ports/espressif/common-hal/socketpool/SocketPool.c +#: ports/espressif/common-hal/socketpool/Socket.c +#: ports/raspberrypi/common-hal/socketpool/Socket.c msgid "Out of sockets" msgstr "Keine Sockets mehr verfügbar" @@ -1921,11 +1685,6 @@ msgstr "Keine Sockets mehr verfügbar" msgid "Out-buffer elements must be <= 4 bytes long" msgstr "Out-Buffer-Elemente müssen <= 4 bytes lang sein" -#: shared-bindings/bitops/__init__.c -#, c-format -msgid "Output buffer must be at least %d bytes" -msgstr "Ausgabe-Buffer muss mindestens %d Bytes sein" - #: shared-bindings/audiobusio/PDMIn.c msgid "Oversample must be multiple of 8." msgstr "Oversample muss ein Vielfaches von 8 sein." @@ -1934,16 +1693,15 @@ msgstr "Oversample muss ein Vielfaches von 8 sein." msgid "PDMIn not available" msgstr "PDMIn nicht verfügbar" -#: shared-bindings/pwmio/PWMOut.c -msgid "" -"PWM duty_cycle must be between 0 and 65535 inclusive (16 bit resolution)" -msgstr "PWM duty_cycle muss zwischen 0 und 65535 (16 Bit-Auflösung) liegen" - #: shared-bindings/pwmio/PWMOut.c msgid "" "PWM frequency not writable when variable_frequency is False on construction." msgstr "Die PWM-Frequenz ist nicht schreibbar, wenn variable_Frequenz = False." +#: ports/stm/common-hal/pwmio/PWMOut.c +msgid "PWM restart" +msgstr "PWM Neustart" + #: ports/raspberrypi/common-hal/countio/Counter.c msgid "PWM slice already in use" msgstr "PWM-Stück wird bereits verwendet" @@ -1960,36 +1718,20 @@ msgstr "Peripheriegerät wird bereits verwendet" msgid "Permission denied" msgstr "Zugriff verweigert" -#: ports/atmel-samd/common-hal/alarm/pin/PinAlarm.c #: ports/stm/common-hal/alarm/pin/PinAlarm.c msgid "Pin cannot wake from Deep Sleep" msgstr "Pin kann nicht aus Deep Sleep aufwachen" -#: ports/raspberrypi/bindings/rp2pio/StateMachine.c -msgid "Pin count must be at least 1" -msgstr "Pin-Anzahl muss mindestens 1 sein" - #: ports/raspberrypi/common-hal/rp2pio/StateMachine.c msgid "Pin count too large" msgstr "Pin-Anzahl zu gross" -#: ports/atmel-samd/common-hal/analogio/AnalogIn.c -#: ports/cxd56/common-hal/analogio/AnalogIn.c -#: ports/espressif/common-hal/analogio/AnalogIn.c -#: ports/mimxrt10xx/common-hal/analogio/AnalogIn.c -#: ports/nrf/common-hal/analogio/AnalogIn.c -#: ports/raspberrypi/common-hal/analogio/AnalogIn.c -#: ports/stm/common-hal/analogio/AnalogIn.c -msgid "Pin does not have ADC capabilities" -msgstr "Pin hat keine ADC-Funktionalität" - #: ports/stm/common-hal/alarm/pin/PinAlarm.c #: ports/stm/common-hal/pulseio/PulseIn.c msgid "Pin interrupt already in use" msgstr "Pin-Interrupt wird bereits verwendet" #: shared-bindings/adafruit_bus_device/spi_device/SPIDevice.c -#: shared-bindings/digitalio/DigitalInOut.c msgid "Pin is input only" msgstr "Pin kann nur als Eingang verwendet werden" @@ -2055,18 +1797,10 @@ msgstr "Programm macht IN ohne Laden von ISR" msgid "Program does OUT without loading OSR" msgstr "Programm macht OUT ohne Laden von OSR" -#: ports/raspberrypi/bindings/rp2pio/StateMachine.c -msgid "Program must contain at least one 16-bit instruction." -msgstr "Programm muss mindestens eine 16-Bit-Instruktion enthalten." - #: ports/raspberrypi/bindings/rp2pio/StateMachine.c msgid "Program size invalid" msgstr "Programm-Größe ist ungültig" -#: ports/raspberrypi/bindings/rp2pio/StateMachine.c -msgid "Program too large" -msgstr "Das Programm ist zu groß" - #: shared-bindings/digitalio/DigitalInOut.c msgid "Pull not used when direction is output." msgstr "Pull wird nicht verwendet, wenn die Richtung output ist." @@ -2088,30 +1822,20 @@ msgstr "RNG DeInit-Fehler" msgid "RNG Init Error" msgstr "RNG Init-Fehler" -#: ports/nrf/common-hal/busio/UART.c -msgid "RS485 Not yet supported on this device" -msgstr "RS485 wird von diesem Gerät nicht unterstützt" +#: ports/atmel-samd/common-hal/busio/UART.c ports/cxd56/common-hal/busio/UART.c +#: ports/nrf/common-hal/busio/UART.c ports/stm/common-hal/busio/UART.c +msgid "RS485" +msgstr "RS485" #: ports/espressif/common-hal/busio/UART.c #: ports/mimxrt10xx/common-hal/busio/UART.c msgid "RS485 inversion specified when not in RS485 mode" msgstr "RS485-Inversion angegeben, wenn nicht im RS485-Modus" -#: ports/cxd56/common-hal/rtc/RTC.c ports/espressif/common-hal/rtc/RTC.c -#: ports/mimxrt10xx/common-hal/rtc/RTC.c ports/nrf/common-hal/rtc/RTC.c -#: ports/raspberrypi/common-hal/rtc/RTC.c -msgid "RTC calibration is not supported on this board" -msgstr "Die RTC-Kalibrierung wird auf diesem Board nicht unterstützt" - #: shared-bindings/alarm/time/TimeAlarm.c shared-bindings/time/__init__.c msgid "RTC is not supported on this board" msgstr "Eine RTC wird auf diesem Board nicht unterstützt" -#: ports/atmel-samd/common-hal/busio/UART.c ports/cxd56/common-hal/busio/UART.c -#: ports/stm/common-hal/busio/UART.c -msgid "RTS/CTS/RS485 Not yet supported on this device" -msgstr "RTS / CTS / RS485 Wird von diesem Gerät noch nicht unterstützt" - #: ports/stm/common-hal/os/__init__.c msgid "Random number generation error" msgstr "Fehler bei der Erzeugung von Zufallszahlen" @@ -2129,10 +1853,14 @@ msgstr "Schreibgeschützte Dateisystem" msgid "Read-only object" msgstr "Schreibgeschützte Objekt" -#: ports/espressif/bindings/espidf/__init__.c ports/espressif/esp_error.c +#: ports/espressif/common-hal/espidf/__init__.c ports/espressif/esp_error.c msgid "Received response was invalid" msgstr "Erhaltene Antwort ist ungültig" +#: supervisor/shared/bluetooth/bluetooth.c +msgid "Reconnecting" +msgstr "Wiederherstellung der Verbindungen" + #: shared-bindings/displayio/EPaperDisplay.c msgid "Refresh too soon" msgstr "Zu früh neu geladen" @@ -2145,7 +1873,7 @@ msgstr "RemoteTransmissionRequests limitiert auf 8 Bytes" msgid "Requested AES mode is unsupported" msgstr "Der angeforderte AES-Modus wird nicht unterstützt" -#: ports/espressif/bindings/espidf/__init__.c ports/espressif/esp_error.c +#: ports/espressif/common-hal/espidf/__init__.c ports/espressif/esp_error.c msgid "Requested resource not found" msgstr "Angefragte Ressource nicht gefunden" @@ -2161,6 +1889,10 @@ msgstr "Sicherheitsmodus aktiv! Gespeicherter Code wird nicht ausgeführt\n" msgid "SD card CSD format not supported" msgstr "SD-Card CSD-Format nicht unterstützt" +#: ports/cxd56/common-hal/sdioio/SDCard.c +msgid "SDCard init" +msgstr "SDCard Initialisierung" + #: ports/stm/common-hal/sdioio/SDCard.c #, c-format msgid "SDIO GetCardInfo Error %d" @@ -2171,30 +1903,21 @@ msgstr "SDIO GetCardInfo-Fehler %d" msgid "SDIO Init Error %d" msgstr "SDIO-Init-Fehler %d" -#: ports/stm/common-hal/busio/SPI.c -msgid "SPI Init Error" -msgstr "SPI-Init-Fehler" - -#: ports/stm/common-hal/busio/SPI.c -msgid "SPI Re-initialization error" -msgstr "SPI-Neuinitialisierungsfehler" - #: ports/espressif/common-hal/busio/SPI.c msgid "SPI configuration failed" msgstr "SPI-Konfiguration fehlgeschlagen" +#: ports/stm/common-hal/busio/SPI.c +msgid "SPI init error" +msgstr "SPI Initialisierungsfehler" + #: ports/raspberrypi/common-hal/busio/SPI.c msgid "SPI peripheral in use" msgstr "SPI-Peripheriegeräte wird bereits verwendet" -#: shared-bindings/audiomixer/Mixer.c -msgid "Sample rate must be positive" -msgstr "Abtastrate muss positiv sein" - -#: ports/atmel-samd/common-hal/audioio/AudioOut.c -#, c-format -msgid "Sample rate too high. It must be less than %d" -msgstr "Abtastrate zu hoch. Wert muss unter %d liegen" +#: ports/stm/common-hal/busio/SPI.c +msgid "SPI re-init" +msgstr "SPI wird erneut initialisiert" #: shared-bindings/is31fl3741/FrameBuffer.c msgid "Scale dimensions must divide by 3" @@ -2214,14 +1937,6 @@ msgstr "Serializer wird benutzt" msgid "Server side context cannot have hostname" msgstr "Serverseitiger Kontext kann keinen Hostnamen haben" -#: ports/raspberrypi/bindings/rp2pio/StateMachine.c -msgid "Set pin count must be between 1 and 5" -msgstr "Die Anzahl der Pins muss zwischen 1 und 5 liegen" - -#: ports/raspberrypi/bindings/rp2pio/StateMachine.c -msgid "Side set pin count must be between 1 and 5" -msgstr "Die Anzahl der Pins für Side set muss zwischen 1 und 5 liegen" - #: ports/cxd56/common-hal/camera/Camera.c msgid "Size not supported" msgstr "Größe nicht unterstützt" @@ -2242,6 +1957,7 @@ msgid "Slices not supported" msgstr "Slices werden nicht unterstützt" #: ports/espressif/common-hal/socketpool/SocketPool.c +#: ports/raspberrypi/common-hal/socketpool/SocketPool.c msgid "SocketPool can only be used with wifi.radio" msgstr "SocketPool kann nur mit wifi.radio verwendet werden" @@ -2257,10 +1973,6 @@ msgstr "Geben Sie genau einen von data0 oder data_pins an" msgid "Splitting with sub-captures" msgstr "Splitting mit sub-captures" -#: shared-bindings/supervisor/__init__.c -msgid "Stack size must be at least 256" -msgstr "Die Stackgröße sollte mindestens 256 sein" - #: ports/raspberrypi/common-hal/audiopwmio/PWMAudioOut.c msgid "Stereo left must be on PWM channel A" msgstr "Stereo links muss sich auf PWM-Kanal A befinden" @@ -2269,10 +1981,6 @@ msgstr "Stereo links muss sich auf PWM-Kanal A befinden" msgid "Stereo right must be on PWM channel B" msgstr "Stereo rechts muss sich auf PWM-Kanal B befinden" -#: shared-bindings/multiterminal/__init__.c -msgid "Stream missing readinto() or write() method." -msgstr "Stream fehlt readinto() oder write() Methode." - #: ports/mimxrt10xx/common-hal/busio/UART.c ports/stm/common-hal/busio/UART.c msgid "Supply at least one UART pin" msgstr "Geben Sie mindestens einen UART-Pin an" @@ -2358,10 +2066,6 @@ msgstr "Die Kachelhöhe muss die Bitmaphöhe genau teilen" msgid "Tile index out of bounds" msgstr "Kachel index außerhalb der Grenzen" -#: shared-bindings/displayio/TileGrid.c -msgid "Tile value out of bounds" -msgstr "Kachelwert außerhalb der Grenzen" - #: shared-bindings/displayio/TileGrid.c msgid "Tile width must exactly divide bitmap width" msgstr "Die Kachelbreite muss die Bitmap-Breite genau teilen" @@ -2382,6 +2086,9 @@ msgid "To exit, please reset the board without " msgstr "Zum beenden, resette bitte das board ohne " #: ports/atmel-samd/common-hal/audiobusio/I2SOut.c +msgid "Too many channels in sample" +msgstr "Zu viele Kanäle im Beispiel" + #: ports/raspberrypi/common-hal/audiobusio/I2SOut.c msgid "Too many channels in sample." msgstr "Zu viele Kanäle im sample." @@ -2414,24 +2121,25 @@ msgid "Tuple or struct_time argument required" msgstr "Tuple- oder struct_time-Argument erforderlich" #: ports/stm/common-hal/busio/UART.c -msgid "UART Buffer allocation error" -msgstr "UART Buffer reservierungs Fehler" +msgid "UART de-init" +msgstr "UART wird de-initialisiert" + +#: ports/atmel-samd/common-hal/busio/UART.c ports/cxd56/common-hal/busio/UART.c +#: ports/espressif/common-hal/busio/UART.c ports/stm/common-hal/busio/UART.c +msgid "UART init" +msgstr "UART Initialisierung" #: ports/stm/common-hal/busio/UART.c -msgid "UART De-init error" -msgstr "UART De-Init-Fehler" +msgid "UART re-init" +msgstr "UART wird wieder Initialisiert" #: ports/stm/common-hal/busio/UART.c -msgid "UART Init Error" -msgstr "UART Init Fehler" +msgid "UART write" +msgstr "UART wird geschrieben" -#: ports/stm/common-hal/busio/UART.c -msgid "UART Re-init error" -msgstr "UART Re-Init-Fehler" - -#: ports/stm/common-hal/busio/UART.c -msgid "UART write error" -msgstr "UART-Schreibfehler" +#: main.c +msgid "UID:" +msgstr "" #: shared-module/usb_hid/Device.c msgid "USB busy" @@ -2556,6 +2264,11 @@ msgstr "Unbekannter Systemfirmware Fehler: %04x" msgid "Unknown system firmware error: %d" msgstr "Unbekannter System-Firmware-Fehler: %d" +#: ports/raspberrypi/common-hal/wifi/__init__.c +#, c-format +msgid "Unkown error code %d" +msgstr "" + #: shared-bindings/adafruit_pixelbuf/PixelBuf.c #, c-format msgid "Unmatched number of items on RHS (expected %d, got %d)." @@ -2571,12 +2284,6 @@ msgstr "" "Nicht näher bezeichnetes Problem. Möglicherweise wurde die Pairing-" "Eingabeaufforderung auf dem anderen Gerät abgelehnt oder ignoriert." -#: ports/atmel-samd/common-hal/busio/I2C.c ports/cxd56/common-hal/busio/I2C.c -#: ports/espressif/common-hal/busio/UART.c -#: ports/raspberrypi/common-hal/busio/I2C.c ports/stm/common-hal/busio/I2C.c -msgid "Unsupported baudrate" -msgstr "Baudrate wird nicht unterstützt" - #: shared-bindings/bitmaptools/__init__.c msgid "Unsupported colorspace" msgstr "Nicht unterstützter Farbraum" @@ -2589,6 +2296,10 @@ msgstr "Nicht unterstützter display bus type" msgid "Unsupported format" msgstr "Nicht unterstütztes Format" +#: shared-bindings/hashlib/__init__.c +msgid "Unsupported hash algorithm" +msgstr "Hash Algorithmus wird nicht unterstützt" + #: ports/espressif/common-hal/dualbank/__init__.c msgid "Update Failed" msgstr "Update fehlgeschlagen" @@ -2607,7 +2318,7 @@ msgstr "Wert Länge != Erforderliche feste Länge" msgid "Value length > max_length" msgstr "Länge des Wertes > max_length" -#: ports/espressif/bindings/espidf/__init__.c ports/espressif/esp_error.c +#: ports/espressif/common-hal/espidf/__init__.c ports/espressif/esp_error.c msgid "Version was invalid" msgstr "Version ist ungültig" @@ -2642,10 +2353,6 @@ msgstr "" msgid "WatchDogTimer.timeout must be greater than 0" msgstr "WatchDogTimer.timeout muss größer als 0 sein" -#: supervisor/shared/safe_mode.c -msgid "Watchdog timer expired." -msgstr "Watchdog timer abgelaufen." - #: py/builtinhelp.c #, c-format msgid "" @@ -2661,9 +2368,9 @@ msgstr "" "\n" "Um die vorhandenen Module anzuzeigen, gebe `help(\"modules\")` ein.\n" -#: shared-bindings/wifi/Radio.c -msgid "WiFi password must be between 8 and 63 characters" -msgstr "WiFi Passwort muss zwischen 8 und 63 Zeichen lang sein" +#: supervisor/shared/web_workflow/web_workflow.c +msgid "Wi-Fi: " +msgstr "Wi-Fi: " #: main.c msgid "Woken up by alarm.\n" @@ -2705,11 +2412,7 @@ msgstr "__new__ arg muss user-type sein" msgid "a bytes-like object is required" msgstr "ein Byte-ähnliches Objekt ist erforderlich" -#: shared-bindings/i2cperipheral/I2CPeripheral.c -msgid "address out of bounds" -msgstr "Adresse außerhalb der Grenzen" - -#: shared-bindings/i2cperipheral/I2CPeripheral.c +#: shared-bindings/i2ctarget/I2CTarget.c msgid "addresses is empty" msgstr "addresses ist leer" @@ -2758,6 +2461,10 @@ msgstr "Argumente müssen ndarrays sein" msgid "array and index length must be equal" msgstr "Array- und Indexlänge müssen gleich sein" +#: extmod/ulab/code/numpy/io/io.c +msgid "array has too many dimensions" +msgstr "Das Array hat zu viele Dimensionen" + #: py/objarray.c shared-bindings/alarm/SleepMemory.c #: shared-bindings/nvm/ByteArray.c msgid "array/bytes required on right side" @@ -2819,10 +2526,6 @@ msgstr "Bitmap-Größen müssen übereinstimmen" msgid "bits must be 32 or less" msgstr "bits müssen 32 oder kleiner sein" -#: shared-bindings/busio/UART.c -msgid "bits must be in range 5 to 9" -msgstr "bits müssen zwischen 5 und 9 liegen" - #: shared-bindings/audiomixer/Mixer.c msgid "bits_per_sample must be 8 or 16" msgstr "Es müssen 8 oder 16 bits_per_sample sein" @@ -2860,11 +2563,6 @@ msgstr "Der Puffer ist zu klein für die angefragten Bytes" msgid "byteorder is not a string" msgstr "Byteorder ist kein String" -#: ports/atmel-samd/common-hal/busio/UART.c -#: ports/espressif/common-hal/busio/UART.c -msgid "bytes > 8 bits not supported" -msgstr "bytes mit mehr als 8 bits werden nicht unterstützt" - #: py/objarray.c msgid "bytes length not a multiple of item size" msgstr "Byte-Länge ist kein vielfaches der Item-Größe" @@ -2873,7 +2571,7 @@ msgstr "Byte-Länge ist kein vielfaches der Item-Größe" msgid "bytes value out of range" msgstr "Byte-Wert außerhalb des Bereichs" -#: ports/atmel-samd/bindings/samd/Clock.c ports/atmel-samd/common-hal/rtc/RTC.c +#: ports/atmel-samd/bindings/samd/Clock.c msgid "calibration is out of range" msgstr "Kalibrierung ist außerhalb der Reichweite" @@ -2881,13 +2579,10 @@ msgstr "Kalibrierung ist außerhalb der Reichweite" msgid "calibration is read only" msgstr "Kalibrierung ist Schreibgeschützt" -#: ports/atmel-samd/common-hal/rtc/RTC.c -msgid "calibration value out of range +/-127" -msgstr "Kalibrierwert nicht im Bereich von +/-127" - +#: shared-module/vectorio/Circle.c shared-module/vectorio/Polygon.c #: shared-module/vectorio/Rectangle.c -msgid "can only be registered in one parent" -msgstr "kann nur bei einem Elternteil registriert werden" +msgid "can only have one parent" +msgstr "kann nur ein Elternteil haben" #: py/emitinlinethumb.c msgid "can only have up to 4 parameters to Thumb assembly" @@ -2911,8 +2606,7 @@ msgstr "kann keinem Ausdruck zuweisen" msgid "can't cancel self" msgstr "kann self nicht abbrechen" -#: py/obj.c py/objint.c shared-bindings/i2cperipheral/I2CPeripheral.c -#: shared-module/adafruit_pixelbuf/PixelBuf.c +#: py/obj.c py/objint.c shared-module/adafruit_pixelbuf/PixelBuf.c msgid "can't convert %q to %q" msgstr "kann %q nicht zu %q konvertieren" @@ -3065,6 +2759,10 @@ msgstr "Kann nicht eindeutig die Größe (sizeof) des Skalars ermitteln" msgid "casting" msgstr "Umwandlung (cast)" +#: ports/stm/common-hal/pwmio/PWMOut.c +msgid "channel re-init" +msgstr "Kanal wird erneut initialisiert" + #: shared-bindings/_stage/Text.c msgid "chars buffer too small" msgstr "(char) Zeichenpuffer zu klein" @@ -3077,10 +2775,6 @@ msgstr "chr() arg ist nicht in range(0x110000)" msgid "chr() arg not in range(256)" msgstr "chr() arg ist nicht in range(256)" -#: shared-module/vectorio/Circle.c -msgid "circle can only be registered in one parent" -msgstr "Kreis kann nur in einem Elternteil registriert werden" - #: shared-bindings/bitmaptools/__init__.c msgid "clip point must be (x,y) tuple" msgstr "clip Punkt muss ein (x,y) Tupel sein" @@ -3107,10 +2801,6 @@ msgstr "" msgid "color must be between 0x000000 and 0xffffff" msgstr "Farbe muss zwischen 0x000000 und 0xffffff liegen" -#: shared-bindings/displayio/ColorConverter.c -msgid "color should be an int" -msgstr "Farbe sollte ein int sein" - #: py/emitnative.c msgid "comparison of int and uint" msgstr "Vergleich von int und uint" @@ -3147,6 +2837,10 @@ msgstr "Convolve-Argumente müssen ndarrays sein" msgid "convolve arguments must not be empty" msgstr "Convolve Argumente dürfen nicht leer sein" +#: extmod/ulab/code/numpy/io/io.c +msgid "corrupted file" +msgstr "Korrupte Datei" + #: extmod/ulab/code/numpy/poly.c msgid "could not invert Vandermonde matrix" msgstr "Vandermonde-Matrix konnte nicht invertiert werden" @@ -3199,10 +2893,6 @@ msgstr "" msgid "destination buffer must be an array of type 'H' for bit_depth = 16" msgstr "Der Zielpuffer muss ein Array vom Typ 'H' für bit_depth = 16 sein" -#: shared-bindings/audiobusio/PDMIn.c -msgid "destination_length must be an int >= 0" -msgstr "destination_length muss ein int >= 0 sein" - #: py/objdict.c msgid "dict update sequence has wrong length" msgstr "Die Wörterbuch-Aktualisierungssequenz hat eine falsche Länge" @@ -3240,6 +2930,10 @@ msgstr "dtype muss Float oder komplex sein" msgid "empty" msgstr "leer" +#: extmod/ulab/code/numpy/io/io.c +msgid "empty file" +msgstr "Leere Datei" + #: extmod/moduasyncio.c extmod/moduheapq.c extmod/modutimeq.c msgid "empty heap" msgstr "leerer heap" @@ -3256,10 +2950,6 @@ msgstr "leere Sequenz" msgid "end of format while looking for conversion specifier" msgstr "Ende des Formats wärend der Suche nach einem conversion specifier" -#: shared-bindings/displayio/Shape.c -msgid "end_x should be an int" -msgstr "end_x sollte ein int sein" - #: shared-bindings/alarm/time/TimeAlarm.c msgid "epoch_time not supported on this board" msgstr "epoch_time wird auf diesem Board nicht unterstützt" @@ -3269,6 +2959,12 @@ msgstr "epoch_time wird auf diesem Board nicht unterstützt" msgid "error = 0x%08lX" msgstr "Fehler = 0x%08lX" +#: ports/espressif/common-hal/esp32_camera/Camera.c +msgid "" +"esp32_camera.Camera requires reserved PSRAM to be configured. See the " +"documentation for instructions." +msgstr "" + #: py/runtime.c msgid "exceptions must derive from BaseException" msgstr "Exceptions müssen von BaseException abgeleitet sein" @@ -3343,7 +3039,7 @@ msgstr "das erste Argument muss eine Funktion sein" msgid "first argument must be a tuple of ndarrays" msgstr "das erste Argument muss ein Tupel von ndarrays sein" -#: extmod/ulab/code/numpy/vector.c +#: extmod/ulab/code/numpy/transform.c extmod/ulab/code/numpy/vector.c msgid "first argument must be an ndarray" msgstr "Das erste Argument muss ein Ndarray sein" @@ -3381,7 +3077,7 @@ msgstr "Format erfordert ein Wörterbuch (dict)" #: shared-bindings/microcontroller/Processor.c msgid "frequency is read-only for this board" -msgstr "" +msgstr "Frequenz ist für dieses Board schreibgeschützt" #: py/objdeque.c msgid "full" @@ -3493,7 +3189,7 @@ msgstr "unvollständiger Formatschlüssel" msgid "incorrect padding" msgstr "padding ist inkorrekt" -#: extmod/ulab/code/ndarray.c +#: extmod/ulab/code/ndarray.c extmod/ulab/code/numpy/transform.c msgid "index is out of bounds" msgstr "Index ist außerhalb der Grenzen" @@ -3511,6 +3207,10 @@ msgstr "Indizes müssen Integer sein" msgid "indices must be integers, slices, or Boolean lists" msgstr "Indizes müssen Integer, Slices oder Boolesche Listen sein" +#: ports/espressif/common-hal/busio/I2C.c +msgid "init I2C" +msgstr "initialisiere I2C" + #: extmod/ulab/code/scipy/optimize/optimize.c msgid "initial values must be iterable" msgstr "Ausgangswerte müssen iterierbar sein" @@ -3556,6 +3256,10 @@ msgstr "Eingabematrix ist asymmetrisch" msgid "input matrix is singular" msgstr "Eingabematrix ist singulär" +#: extmod/ulab/code/numpy/create.c +msgid "input must be 1- or 2-d" +msgstr "Eingabe muss 1- oder 2-d sein" + #: extmod/ulab/code/numpy/carray/carray.c msgid "input must be a 1D ndarray" msgstr "Eingabe muss ein 1D ndarray sein" @@ -3564,11 +3268,7 @@ msgstr "Eingabe muss ein 1D ndarray sein" msgid "input must be a dense ndarray" msgstr "Eingabe muss ein dichtes ndarray sein" -#: extmod/ulab/code/numpy/create.c -msgid "input must be a tensor of rank 2" -msgstr "Eingabe muss ein Tensor von Rang 2 sein" - -#: extmod/ulab/code/numpy/create.c extmod/ulab/code/user/user.c +#: extmod/ulab/code/user/user.c msgid "input must be an ndarray" msgstr "Eingabe muss ein ndarray sein" @@ -3618,6 +3318,10 @@ msgstr "ungültige Architektur" msgid "invalid bits_per_pixel %d, must be, 1, 2, 4, 8, 16, 24, or 32" msgstr "ungültige Bits_pro_Pixel %d, muss 1, 2, 4, 8, 16, 24 oder 32 sein" +#: ports/raspberrypi/common-hal/ssl/SSLSocket.c +msgid "invalid cert" +msgstr "ungültiges cert" + #: shared-bindings/bitmaptools/__init__.c #, c-format msgid "invalid element size %d for bits_per_pixel %d\n" @@ -3644,10 +3348,18 @@ msgstr "ungültiger Formatbezeichner" msgid "invalid hostname" msgstr "ungültiger Hostname" +#: ports/raspberrypi/common-hal/ssl/SSLSocket.c +msgid "invalid key" +msgstr "ungültiger Schlüssel" + #: py/compile.c msgid "invalid micropython decorator" msgstr "ungültiger micropython decorator" +#: ports/espressif/common-hal/esp32_camera/Camera.c +msgid "invalid setting" +msgstr "Invalide Einstellung" + #: shared-bindings/random/__init__.c msgid "invalid step" msgstr "ungültiger Schritt (step)" @@ -3767,10 +3479,6 @@ msgstr "Mathe-Domain-Fehler" msgid "matrix is not positive definite" msgstr "Matrix ist nicht positiv definitiv" -#: ports/espressif/common-hal/wifi/Radio.c -msgid "max_connections must be between 0 and 10" -msgstr "max_connections muss zwischen 0 und 10 liegen" - #: ports/espressif/common-hal/_bleio/Descriptor.c #: ports/nrf/common-hal/_bleio/Characteristic.c #: ports/nrf/common-hal/_bleio/Descriptor.c @@ -3778,13 +3486,9 @@ msgstr "max_connections muss zwischen 0 und 10 liegen" msgid "max_length must be 0-%d when fixed_length is %s" msgstr "max_length muss 0-%d sein, wenn fixed_length %s ist" -#: shared-bindings/_bleio/Characteristic.c shared-bindings/_bleio/Descriptor.c -msgid "max_length must be >= 0" -msgstr "max_length muss >= 0 sein" - #: extmod/ulab/code/ndarray.c -msgid "maximum number of dimensions is 4" -msgstr "die maximale Anzahl der Dimensionen beträgt 4" +msgid "maximum number of dimensions is " +msgstr "Maximale Anzahl an Dimensionen ist " #: py/runtime.c msgid "maximum recursion depth exceeded" @@ -3917,7 +3621,7 @@ msgstr "kein Reset Pin verfügbar" msgid "no response from SD card" msgstr "keine Antwort von der SD-Karte" -#: py/objobject.c py/runtime.c +#: ports/espressif/common-hal/esp32_camera/Camera.c py/objobject.c py/runtime.c msgid "no such attribute" msgstr "kein solches Attribut" @@ -4029,7 +3733,11 @@ msgstr "Objekt mit Pufferprotokoll (buffer protocol) erforderlich" msgid "odd-length string" msgstr "String mit ungerader Länge" -#: extmod/ulab/code/numpy/create.c extmod/ulab/code/utils/utils.c +#: supervisor/shared/web_workflow/web_workflow.c +msgid "off" +msgstr "aus" + +#: extmod/ulab/code/utils/utils.c msgid "offset is too large" msgstr "Offset ist zu groß" @@ -4129,10 +3837,6 @@ msgstr "pack erwartete %d Artikel zum Packen (erhalten %d)" msgid "palette must be 32 bytes long" msgstr "Die Palette muss 32 Byte lang sein" -#: shared-bindings/displayio/Palette.c -msgid "palette_index should be an int" -msgstr "palette_index sollte ein int sein" - #: py/emitinlinextensa.c msgid "parameters must be registers in sequence a2 to a5" msgstr "Die Parameter müssen Register der Reihenfolge a2 bis a5 sein" @@ -4157,10 +3861,6 @@ msgstr "pixel_shader muss displayio.Palette oder displayio.ColorConverter sein" msgid "poll on file not available on win32" msgstr "Abfrage der Datei unter Win32 nicht verfügbar" -#: shared-module/vectorio/Polygon.c -msgid "polygon can only be registered in one parent" -msgstr "Polygon kann nur in einem übergeordneten Element registriert werden" - #: ports/espressif/common-hal/pulseio/PulseIn.c msgid "pop from an empty PulseIn" msgstr "pop von einem leeren PulseIn" @@ -4186,7 +3886,23 @@ msgstr "pow() drittes Argument darf nicht 0 sein" msgid "pow() with 3 arguments requires integers" msgstr "pow() mit 3 Argumenten erfordert Integer" +#: ports/espressif/boards/adafruit_qtpy_esp32_pico/mpconfigboard.h +msgid "pressing BOOT button at start up.\n" +msgstr "BOOT Taste wird beim Starten gedrückt.\n" + +#: ports/espressif/boards/adafruit_feather_esp32_v2/mpconfigboard.h +msgid "pressing SW38 button at start up.\n" +msgstr "SW38 Taste wird beim Starten gedrückt.\n" + +#: ports/espressif/boards/hardkernel_odroid_go/mpconfigboard.h +msgid "pressing VOLUME button at start up.\n" +msgstr "VOLUME Taste wird beim Starten gedrückt.\n" + #: ports/espressif/boards/adafruit_qtpy_esp32c3/mpconfigboard.h +#: ports/espressif/boards/beetle-esp32-c3/mpconfigboard.h +#: ports/espressif/boards/espressif_esp32s2_devkitc_1_n8r2/mpconfigboard.h +#: ports/espressif/boards/lolin_c3_mini/mpconfigboard.h +#: ports/espressif/boards/microdev_micro_c3/mpconfigboard.h #: supervisor/shared/safe_mode.c msgid "pressing boot button at start up.\n" msgstr "Drücken der Boot-Taste beim Start.\n" @@ -4207,14 +3923,6 @@ msgstr "Drücken der linken Taste beim Einschalten\n" msgid "pull masks conflict with direction masks" msgstr "Pull-Masken kollidieren mit Richtungsmasken" -#: ports/raspberrypi/bindings/rp2pio/StateMachine.c -msgid "pull_threshold must be between 1 and 32" -msgstr "pull_threshold muss zwischen 1 und 32 liegen" - -#: ports/raspberrypi/bindings/rp2pio/StateMachine.c -msgid "push_threshold must be between 1 and 32" -msgstr "push_threshold muss zwischen 1 und 32 liegen" - #: extmod/modutimeq.c msgid "queue overflow" msgstr "Warteschlangenüberlauf" @@ -4266,14 +3974,6 @@ msgstr "Roll-Argument muss ein ndarray sein" msgid "rsplit(None,n)" msgstr "rsplit(None,n)" -#: shared-bindings/audiocore/RawSample.c -msgid "" -"sample_source buffer must be a bytearray or array of type 'h', 'H', 'b' or " -"'B'" -msgstr "" -"sample_source buffer muss ein Bytearray oder ein Array vom Typ 'h', 'H', 'b' " -"oder 'B' sein" - #: ports/atmel-samd/common-hal/audiobusio/PDMIn.c #: ports/raspberrypi/common-hal/audiobusio/PDMIn.c msgid "sampling rate out of range" @@ -4371,26 +4071,14 @@ msgstr "source_bitmap muss value_count von 65536 haben" msgid "source_bitmap must have value_count of 8" msgstr "source_bitmap muss value_count von 8 haben" -#: shared-bindings/wifi/Radio.c -msgid "ssid can't be more than 32 bytes" -msgstr "ssid kann nicht mehr als 32 Bytes lang sein" - #: py/objstr.c msgid "start/end indices" msgstr "start/end Indizes" -#: shared-bindings/displayio/Shape.c -msgid "start_x should be an int" -msgstr "start_x sollte ein int sein" - #: shared-bindings/random/__init__.c msgid "step must be non-zero" msgstr "Schritt (step) darf nicht Null sein" -#: shared-bindings/busio/UART.c -msgid "stop must be 1 or 2" -msgstr "stop muss 1 oder 2 sein" - #: shared-bindings/random/__init__.c msgid "stop not reachable from start" msgstr "stop ist von start aus nicht erreichbar" @@ -4440,10 +4128,6 @@ msgstr "Syntaxfehler in uctypes Deskriptor" msgid "threshold must be in the range 0-65536" msgstr "threshold muss im Intervall 0-65536 liegen" -#: shared-bindings/rgbmatrix/RGBMatrix.c -msgid "tile must be greater than zero" -msgstr "Kachel muss größer als Null sein" - #: shared-bindings/time/__init__.c msgid "time.struct_time() takes a 9-sequence" msgstr "time.struct_time() nimmt eine 9-Sequenz an" @@ -4463,10 +4147,6 @@ msgstr "Das Zeitlimit muss 0,0-100,0 Sekunden betragen" msgid "timeout must be < 655.35 secs" msgstr "timeout muss kleiner als 655.35 Sekunden sein" -#: shared-bindings/_bleio/CharacteristicBuffer.c -msgid "timeout must be >= 0.0" -msgstr "timeout muss >= 0.0 sein" - #: shared-module/sdcardio/SDCard.c msgid "timeout waiting for v1 card" msgstr "Zeitlimit beim warten auf v1 Karte" @@ -4475,6 +4155,10 @@ msgstr "Zeitlimit beim warten auf v1 Karte" msgid "timeout waiting for v2 card" msgstr "Zeitlimit beim warten auf v2 Karte" +#: ports/stm/common-hal/pwmio/PWMOut.c +msgid "timer re-init" +msgstr "Timer wird neu initialisiert" + #: shared-bindings/time/__init__.c msgid "timestamp out of range for platform time_t" msgstr "Zeitstempel außerhalb des Bereichs für Plattform time_t" @@ -4540,14 +4224,10 @@ msgstr "Typ '%q' ist kein akzeptierter Basis-Typ" msgid "type is not an acceptable base type" msgstr "Typ ist kein akzeptierter Basis-Typ" -#: py/runtime.c +#: py/objgenerator.c py/runtime.c msgid "type object '%q' has no attribute '%q'" msgstr "Typ vom Objekt '%q' hat kein Attribut '%q'" -#: py/objgenerator.c -msgid "type object 'generator' has no attribute '__await__'" -msgstr "Das Typ-Objekt 'generator' hat kein Attribut '__await__'" - #: py/objtype.c msgid "type takes 1 or 3 arguments" msgstr "Typ akzeptiert 1 oder 3 Argumente" @@ -4608,7 +4288,6 @@ msgid "unreadable attribute" msgstr "nicht lesbares Attribut" #: shared-bindings/displayio/TileGrid.c shared-bindings/vectorio/VectorShape.c -#: shared-module/vectorio/Polygon.c shared-module/vectorio/VectorShape.c msgid "unsupported %q type" msgstr "Nicht unterstützter %q-Typ" @@ -4647,6 +4326,14 @@ msgstr "nicht unterstützter Typ für Operator" msgid "unsupported types for %q: '%q', '%q'" msgstr "nicht unterstützte Typen für %q: '%q', '%q'" +#: extmod/ulab/code/numpy/io/io.c +msgid "usecols is too high" +msgstr "usecols ist zu hoch/groß" + +#: extmod/ulab/code/numpy/io/io.c +msgid "usecols keyword must be specified" +msgstr "usecols muss definiert sein" + #: py/objint.c #, c-format msgid "value must fit in %d byte(s)" @@ -4668,20 +4355,19 @@ msgstr "watchdog nicht initialisiert" msgid "watchdog timeout must be greater than 0" msgstr "watchdog Zeitlimit muss größer als 0 sein" -#: shared-bindings/bitops/__init__.c -#, c-format -msgid "width must be from 2 to 8 (inclusive), not %d" -msgstr "breite muss zwischen (inklusive) 2 und 8 liegen, nicht %d" - #: shared-bindings/is31fl3741/FrameBuffer.c -#: shared-bindings/rgbmatrix/RGBMatrix.c msgid "width must be greater than zero" msgstr "Breite muss größer als 0 sein" #: ports/espressif/common-hal/wifi/Radio.c +#: ports/raspberrypi/common-hal/wifi/Radio.c msgid "wifi is not enabled" msgstr "wifi ist nicht aktiviert" +#: ports/raspberrypi/common-hal/wifi/Monitor.c +msgid "wifi.Monitor not available" +msgstr "" + #: shared-bindings/_bleio/Adapter.c msgid "window must be <= interval" msgstr "Fenster muss <= Intervall sein" @@ -4694,7 +4380,17 @@ msgstr "falscher Achsenindex" msgid "wrong axis specified" msgstr "falsche Achse gewählt" -#: extmod/ulab/code/numpy/compare.c extmod/ulab/code/numpy/vector.c +#: extmod/ulab/code/numpy/io/io.c +msgid "wrong dtype" +msgstr "Falsches dtype" + +#: extmod/ulab/code/numpy/transform.c +msgid "wrong index type" +msgstr "falscher Indextyp" + +#: extmod/ulab/code/numpy/compare.c extmod/ulab/code/numpy/create.c +#: extmod/ulab/code/numpy/io/io.c extmod/ulab/code/numpy/transform.c +#: extmod/ulab/code/numpy/vector.c msgid "wrong input type" msgstr "falscher Eingabetyp" @@ -4702,6 +4398,10 @@ msgstr "falscher Eingabetyp" msgid "wrong length of condition array" msgstr "falsche Länge des Array von Bedingungen" +#: extmod/ulab/code/numpy/transform.c +msgid "wrong length of index array" +msgstr "Falsche Länge des Index Arrays" + #: extmod/ulab/code/numpy/create.c py/objarray.c py/objstr.c msgid "wrong number of arguments" msgstr "falsche Anzahl an Argumenten" @@ -4722,10 +4422,6 @@ msgstr "x Wert außerhalb der Grenzen" msgid "xTaskCreate failed" msgstr "xTaskCreate fehlgeschlagen" -#: shared-bindings/displayio/Shape.c -msgid "y should be an int" -msgstr "y sollte ein int sein" - #: shared-module/displayio/Shape.c msgid "y value out of bounds" msgstr "y Wert außerhalb der Grenzen" @@ -4746,6 +4442,411 @@ msgstr "zi muss eine Gleitkommazahl sein" msgid "zi must be of shape (n_section, 2)" msgstr "zi muss die Form (n_section, 2) haben" +#~ msgid "Stream missing readinto() or write() method." +#~ msgstr "Stream fehlt readinto() oder write() Methode." + +#~ msgid "%q must be >= 0" +#~ msgstr "%q muss >= 0 sein" + +#~ msgid "%q must be >= 1" +#~ msgstr "%q muss >= 1 sein" + +#~ msgid "address out of bounds" +#~ msgstr "Adresse außerhalb der Grenzen" + +#~ msgid "destination_length must be an int >= 0" +#~ msgstr "destination_length muss ein int >= 0 sein" + +#~ msgid "type object 'generator' has no attribute '__await__'" +#~ msgstr "Das Typ-Objekt 'generator' hat kein Attribut '__await__'" + +#~ msgid "color should be an int" +#~ msgstr "Farbe sollte ein int sein" + +#~ msgid "end_x should be an int" +#~ msgstr "end_x sollte ein int sein" + +#~ msgid "palette_index should be an int" +#~ msgstr "palette_index sollte ein int sein" + +#~ msgid "start_x should be an int" +#~ msgstr "start_x sollte ein int sein" + +#~ msgid "y should be an int" +#~ msgstr "y sollte ein int sein" + +#~ msgid "" +#~ "sample_source buffer must be a bytearray or array of type 'h', 'H', 'b' " +#~ "or 'B'" +#~ msgstr "" +#~ "sample_source buffer muss ein Bytearray oder ein Array vom Typ 'h', 'H', " +#~ "'b' oder 'B' sein" + +#~ msgid "Expected an alarm" +#~ msgstr "Alarm erwartet" + +#~ msgid "All I2C targets are in use" +#~ msgstr "Alle I2C-Ziele sind in Verwendung" + +#~ msgid "Failed to init wifi" +#~ msgstr "Wifi Initialisierung ist fehlgeschlagen" + +#~ msgid "input must be a tensor of rank 2" +#~ msgstr "Eingabe muss ein Tensor von Rang 2 sein" + +#~ msgid "maximum number of dimensions is 4" +#~ msgstr "die maximale Anzahl der Dimensionen beträgt 4" + +#~ msgid "Watchdog timer expired." +#~ msgstr "Watchdog timer abgelaufen." + +#~ msgid "ssid can't be more than 32 bytes" +#~ msgstr "ssid kann nicht mehr als 32 Bytes lang sein" + +#~ msgid "%q must be a tuple of length 2" +#~ msgstr "%q muss ein Tupel der Länge 2 sein" + +#~ msgid "%q must be between %d and %d" +#~ msgstr "%q muss zwischen %d und %d sein" + +#~ msgid "%q should be an int" +#~ msgstr "%q sollte ein integer sein" + +#~ msgid "(x,y) integers required" +#~ msgstr "(x,y) Integer benötigt" + +#~ msgid "Address type out of range" +#~ msgstr "Adresstyp außerhalb des zulässigen Bereichs" + +#~ msgid "AnalogIn not supported on given pin" +#~ msgstr "AnalogIn ist an diesem Pin nicht unterstützt" + +#~ msgid "AnalogOut functionality not supported" +#~ msgstr "AnalogOut-Funktion wird nicht unterstützt" + +#~ msgid "AnalogOut is only 16 bits. Value must be less than 65536." +#~ msgstr "AnalogOut kann nur 16 Bit. Der Wert muss unter 65536 liegen." + +#~ msgid "AnalogOut not supported on given pin" +#~ msgstr "AnalogOut ist an diesem Pin nicht unterstützt" + +#, c-format +#~ msgid "Bit depth must be from 1 to 6 inclusive, not %d" +#~ msgstr "Bittiefe muss zwischen 1 und 6 liegen, nicht %d" + +#, c-format +#~ msgid "Buffer incorrect size. Should be %d bytes." +#~ msgstr "Der Puffergröße ist inkorrekt. Sie sollte %d bytes haben." + +#~ msgid "Buffer must be at least length 1" +#~ msgstr "Der Puffer muss eine Mindestenslänge von 1 haben" + +#~ msgid "Bytes must be between 0 and 255." +#~ msgstr "Ein Bytes kann nur Werte zwischen 0 und 255 annehmen." + +#~ msgid "Cannot output both channels on the same pin" +#~ msgstr "Kann nicht beite Kanäle auf dem gleichen Pin ausgeben" + +#~ msgid "Cannot read without MISO pin." +#~ msgstr "Kann ohne MISO-Pin nicht lesen." + +#~ msgid "Cannot reset into bootloader because no bootloader is present." +#~ msgstr "Reset zum Bootloader nicht möglich, da Bootloader nicht vorhanden." + +#~ msgid "Cannot transfer without MOSI and MISO pins." +#~ msgstr "Übertragung ohne MOSI- und MISO-Pins nicht möglich." + +#~ msgid "Cannot write without MOSI pin." +#~ msgstr "Kann nicht ohne MOSI-Pin schreiben." + +#~ msgid "Clock pin init failed." +#~ msgstr "Clock pin init fehlgeschlagen." + +#~ msgid "Command must be an int between 0 and 255" +#~ msgstr "Der Befehl muss ein int zwischen 0 und 255 sein" + +#~ msgid "Could not initialize Camera" +#~ msgstr "Konnte Kamera nicht initialisieren" + +#~ msgid "Could not initialize GNSS" +#~ msgstr "GNSS konnte nicht initialisiert werden" + +#~ msgid "Could not initialize SDCard" +#~ msgstr "Konnte SDKarte nicht initialisieren" + +#~ msgid "Could not initialize UART" +#~ msgstr "Konnte UART nicht initialisieren" + +#~ msgid "Could not re-init channel" +#~ msgstr "Kanal konnte nicht neu initiiert werden" + +#~ msgid "Could not re-init timer" +#~ msgstr "Timer konnte nicht neu gestartet werden" + +#~ msgid "Could not restart PWM" +#~ msgstr "PWM konnte nicht neu gestartet werden" + +#~ msgid "Couldn't allocate first buffer" +#~ msgstr "Konnte first buffer nicht zuteilen" + +#~ msgid "Couldn't allocate input buffer" +#~ msgstr "Eingabepuffer konnte nicht zugewiesen werden" + +#~ msgid "Couldn't allocate second buffer" +#~ msgstr "Konnte second buffer nicht zuteilen" + +#~ msgid "DigitalInOut not supported on given pin" +#~ msgstr "DigitalInOut wird auf dem angegebenen Pin nicht unterstützt" + +#, c-format +#~ msgid "Expected tuple of length %d, got %d" +#~ msgstr "Habe ein Tupel der Länge %d erwartet aber %d erhalten" + +#~ msgid "Failed to allocate RX buffer" +#~ msgstr "Konnte keinen RX Buffer allozieren" + +#, c-format +#~ msgid "Failed to allocate RX buffer of %d bytes" +#~ msgstr "Konnte keine RX Buffer mit %d allozieren" + +#, c-format +#~ msgid "Framebuffer requires %d bytes" +#~ msgstr "Framepuffer benötigt %d bytes" + +#~ msgid "Hostname must be between 1 and 253 characters" +#~ msgstr "Der Hostname muss zwischen 1 und 253 Zeichen haben" + +#~ msgid "I2C Init Error" +#~ msgstr "I2C-Init-Fehler" + +#~ msgid "Invalid %q pin selection" +#~ msgstr "Ungültige %q Pin-Auswahl" + +#~ msgid "Invalid AuthMode" +#~ msgstr "Ungültiges AuthMode" + +#~ msgid "Invalid BMP file" +#~ msgstr "Ungültige BMP-Datei" + +#~ msgid "Invalid DAC pin supplied" +#~ msgstr "Ungültiger DAC-Pin angegeben" + +#~ msgid "Invalid MIDI file" +#~ msgstr "Ungültige MIDI Datei" + +#~ msgid "Invalid PWM frequency" +#~ msgstr "Ungültige PWM Frequenz" + +#~ msgid "Invalid Pin" +#~ msgstr "Ungültiger Pin" + +#~ msgid "Invalid buffer size" +#~ msgstr "Ungültige Puffergröße" + +#~ msgid "Invalid byteorder string" +#~ msgstr "Ungültige Byteorder-String" + +#~ msgid "Invalid capture period. Valid range: 1 - 500" +#~ msgstr "Ungültiger Aufnahmezeitraum. Gültiger Bereich: 1 - 500" + +#~ msgid "Invalid channel count" +#~ msgstr "Ungültige Anzahl von Kanälen" + +#, c-format +#~ msgid "Invalid data_count %d" +#~ msgstr "Ungültiger data_count %d" + +#~ msgid "Invalid direction." +#~ msgstr "Ungültige Richtung." + +#~ msgid "Invalid file" +#~ msgstr "Ungültige Datei" + +#~ msgid "Invalid mode" +#~ msgstr "Ungültiger Modus" + +#~ msgid "Invalid number of bits" +#~ msgstr "Ungültige Anzahl von Bits" + +#~ msgid "Invalid phase" +#~ msgstr "Ungültige Phase" + +#~ msgid "Invalid pin" +#~ msgstr "Ungültiger Pin" + +#~ msgid "Invalid pin for left channel" +#~ msgstr "Ungültiger Pin für linken Kanal" + +#~ msgid "Invalid pin for right channel" +#~ msgstr "Ungültiger Pin für rechten Kanal" + +#~ msgid "Invalid polarity" +#~ msgstr "Ungültige Polarität" + +#~ msgid "Invalid properties" +#~ msgstr "Ungültige Eigenschaften" + +#~ msgid "Invalid run mode." +#~ msgstr "Ungültiger Ausführungsmodus." + +#~ msgid "Invalid security_mode" +#~ msgstr "Ungültiger security_mode" + +#~ msgid "Invalid voice" +#~ msgstr "Ungültige Stimme" + +#~ msgid "Invalid voice count" +#~ msgstr "Ungültige Anzahl von Stimmen" + +#~ msgid "Invalid wave file" +#~ msgstr "Ungültige wave Datei" + +#~ msgid "Invalid word/bit length" +#~ msgstr "Ungültige Wort- / Bitlänge" + +#~ msgid "Layer already in a group." +#~ msgstr "Layer ist bereits in einer Gruppe." + +#~ msgid "Layer must be a Group or TileGrid subclass." +#~ msgstr "Layer muss eine Group- oder TileGrid-Unterklasse sein." + +#~ msgid "MISO pin init failed." +#~ msgstr "MISO pin Initialisierung fehlgeschlagen." + +#~ msgid "MOSI pin init failed." +#~ msgstr "MOSI pin Initialisierung fehlgeschlagen." + +#~ msgid "Messages limited to 8 bytes" +#~ msgstr "Meldungen auf 8 Bytes limitiert" + +#, c-format +#~ msgid "More than %d report ids not supported" +#~ msgstr "Mehr als %d Berichts-IDs werden nicht unterstützt" + +#~ msgid "No hardware support on clk pin" +#~ msgstr "Keine Hardwareunterstützung am clk Pin" + +#~ msgid "No hardware support on pin" +#~ msgstr "Keine Hardwareunterstützung an diesem Pin" + +#, c-format +#~ msgid "Output buffer must be at least %d bytes" +#~ msgstr "Ausgabe-Buffer muss mindestens %d Bytes sein" + +#~ msgid "" +#~ "PWM duty_cycle must be between 0 and 65535 inclusive (16 bit resolution)" +#~ msgstr "PWM duty_cycle muss zwischen 0 und 65535 (16 Bit-Auflösung) liegen" + +#~ msgid "Pin count must be at least 1" +#~ msgstr "Pin-Anzahl muss mindestens 1 sein" + +#~ msgid "Pin does not have ADC capabilities" +#~ msgstr "Pin hat keine ADC-Funktionalität" + +#~ msgid "Program must contain at least one 16-bit instruction." +#~ msgstr "Programm muss mindestens eine 16-Bit-Instruktion enthalten." + +#~ msgid "Program too large" +#~ msgstr "Das Programm ist zu groß" + +#~ msgid "RS485 Not yet supported on this device" +#~ msgstr "RS485 wird von diesem Gerät nicht unterstützt" + +#~ msgid "RTC calibration is not supported on this board" +#~ msgstr "Die RTC-Kalibrierung wird auf diesem Board nicht unterstützt" + +#~ msgid "RTS/CTS/RS485 Not yet supported on this device" +#~ msgstr "RTS / CTS / RS485 Wird von diesem Gerät noch nicht unterstützt" + +#~ msgid "SPI Init Error" +#~ msgstr "SPI-Init-Fehler" + +#~ msgid "SPI Re-initialization error" +#~ msgstr "SPI-Neuinitialisierungsfehler" + +#~ msgid "Sample rate must be positive" +#~ msgstr "Abtastrate muss positiv sein" + +#, c-format +#~ msgid "Sample rate too high. It must be less than %d" +#~ msgstr "Abtastrate zu hoch. Wert muss unter %d liegen" + +#~ msgid "Set pin count must be between 1 and 5" +#~ msgstr "Die Anzahl der Pins muss zwischen 1 und 5 liegen" + +#~ msgid "Side set pin count must be between 1 and 5" +#~ msgstr "Die Anzahl der Pins für Side set muss zwischen 1 und 5 liegen" + +#~ msgid "Stack size must be at least 256" +#~ msgstr "Die Stackgröße sollte mindestens 256 sein" + +#~ msgid "Tile value out of bounds" +#~ msgstr "Kachelwert außerhalb der Grenzen" + +#~ msgid "UART Buffer allocation error" +#~ msgstr "UART Buffer reservierungs Fehler" + +#~ msgid "UART De-init error" +#~ msgstr "UART De-Init-Fehler" + +#~ msgid "UART Init Error" +#~ msgstr "UART Init Fehler" + +#~ msgid "UART Re-init error" +#~ msgstr "UART Re-Init-Fehler" + +#~ msgid "UART write error" +#~ msgstr "UART-Schreibfehler" + +#~ msgid "Unsupported baudrate" +#~ msgstr "Baudrate wird nicht unterstützt" + +#~ msgid "WiFi password must be between 8 and 63 characters" +#~ msgstr "WiFi Passwort muss zwischen 8 und 63 Zeichen lang sein" + +#~ msgid "bits must be in range 5 to 9" +#~ msgstr "bits müssen zwischen 5 und 9 liegen" + +#~ msgid "bytes > 8 bits not supported" +#~ msgstr "bytes mit mehr als 8 bits werden nicht unterstützt" + +#~ msgid "calibration value out of range +/-127" +#~ msgstr "Kalibrierwert nicht im Bereich von +/-127" + +#~ msgid "can only be registered in one parent" +#~ msgstr "kann nur bei einem Elternteil registriert werden" + +#~ msgid "circle can only be registered in one parent" +#~ msgstr "Kreis kann nur in einem Elternteil registriert werden" + +#~ msgid "max_connections must be between 0 and 10" +#~ msgstr "max_connections muss zwischen 0 und 10 liegen" + +#~ msgid "max_length must be >= 0" +#~ msgstr "max_length muss >= 0 sein" + +#~ msgid "polygon can only be registered in one parent" +#~ msgstr "Polygon kann nur in einem übergeordneten Element registriert werden" + +#~ msgid "pull_threshold must be between 1 and 32" +#~ msgstr "pull_threshold muss zwischen 1 und 32 liegen" + +#~ msgid "push_threshold must be between 1 and 32" +#~ msgstr "push_threshold muss zwischen 1 und 32 liegen" + +#~ msgid "stop must be 1 or 2" +#~ msgstr "stop muss 1 oder 2 sein" + +#~ msgid "tile must be greater than zero" +#~ msgstr "Kachel muss größer als Null sein" + +#~ msgid "timeout must be >= 0.0" +#~ msgstr "timeout muss >= 0.0 sein" + +#, c-format +#~ msgid "width must be from 2 to 8 (inclusive), not %d" +#~ msgstr "breite muss zwischen (inklusive) 2 und 8 liegen, nicht %d" + #~ msgid "Unsupported operation" #~ msgstr "Nicht unterstützte Operation" @@ -4999,12 +5100,6 @@ msgstr "zi muss die Form (n_section, 2) haben" #~ msgid "can only save bytecode" #~ msgstr "kann nur Bytecode speichern" -#~ msgid "invalid cert" -#~ msgstr "ungültiges cert" - -#~ msgid "invalid key" -#~ msgstr "ungültiger Schlüssel" - #~ msgid "Viper functions don't currently support more than 4 arguments" #~ msgstr "Viper-Funktionen unterstützen derzeit nicht mehr als 4 Argumente" @@ -5159,9 +5254,6 @@ msgstr "zi muss die Form (n_section, 2) haben" #~ msgid "wrong argument type" #~ msgstr "falscher Argumenttyp" -#~ msgid "wrong index type" -#~ msgstr "falscher Indextyp" - #~ msgid "" #~ "\n" #~ "To exit, please reset the board without " diff --git a/locale/el.po b/locale/el.po index 2c21d3b972..d2ce8ed68d 100644 --- a/locale/el.po +++ b/locale/el.po @@ -8,25 +8,32 @@ msgstr "" "Project-Id-Version: PACKAGE VERSION\n" "Report-Msgid-Bugs-To: \n" "POT-Creation-Date: 2021-01-04 12:55-0600\n" -"PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n" -"Last-Translator: Automatically generated\n" +"PO-Revision-Date: 2022-10-05 12:23+0000\n" +"Last-Translator: Bill Sideris \n" "Language-Team: none\n" "Language: el\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.14.1\n" #: main.c msgid "" "\n" "Code done running.\n" msgstr "" +"\n" +"Η εκτέλεση του κώδικα ολοκληρώθηκε.\n" #: main.c msgid "" "\n" "Code stopped by auto-reload. Reloading soon.\n" msgstr "" +"\n" +"Ο κώδικας σταμάτησε λόγω της αυτόματης επαναφόρτωσης. Η επαναφόρτωση θα " +"γίνει σύντομα.\n" #: supervisor/shared/safe_mode.c msgid "" @@ -34,30 +41,39 @@ msgid "" "Please file an issue with the contents of your CIRCUITPY drive at \n" "https://github.com/adafruit/circuitpython/issues\n" msgstr "" +"\n" +"Παρακαλώ δημιουγήστε ενα πρόβλημα με τα περιεχόμενα του CIRCUITPY δίσκου " +"στο\n" +"https://github.com/adafruit/circuitpython/issues\n" #: py/obj.c msgid " File \"%q\"" -msgstr "" +msgstr " Αρχείο \"%q\"" #: py/obj.c msgid " File \"%q\", line %d" -msgstr "" +msgstr " Αρχείο \"%q\", γραμμή %d" #: py/builtinhelp.c msgid " is of type %q\n" -msgstr "" +msgstr " είναι τύπου %q\n" #: main.c msgid " not found.\n" -msgstr "" +msgstr " δεν βρέθηκε.\n" #: main.c msgid " output:\n" -msgstr "" +msgstr " έξοδος:\n" #: py/objstr.c #, c-format msgid "%%c requires int or char" +msgstr "%%c απαιτεί int ή char" + +#: main.c +#, c-format +msgid "%02X" msgstr "" #: shared-bindings/rgbmatrix/RGBMatrix.c @@ -65,373 +81,391 @@ msgstr "" msgid "" "%d address pins, %d rgb pins and %d tiles indicate a height of %d, not %d" msgstr "" +"%d pin διεύθυνσης, %d rgb ping και %d πλακίδια αναδεικνύουν ύψος %d, όχι %d" + +#: ports/atmel-samd/common-hal/alarm/__init__.c +#: ports/cxd56/common-hal/analogio/AnalogOut.c ports/cxd56/common-hal/rtc/RTC.c +#: ports/espressif/common-hal/rtc/RTC.c +#: ports/mimxrt10xx/common-hal/analogio/AnalogOut.c +#: ports/mimxrt10xx/common-hal/rtc/RTC.c ports/nrf/common-hal/alarm/__init__.c +#: ports/nrf/common-hal/analogio/AnalogOut.c ports/nrf/common-hal/rtc/RTC.c +#: ports/raspberrypi/common-hal/alarm/__init__.c +#: ports/raspberrypi/common-hal/analogio/AnalogOut.c +#: ports/raspberrypi/common-hal/rtc/RTC.c ports/stm/common-hal/alarm/__init__.c +#: ports/stm/common-hal/rtc/RTC.c +msgid "%q" +msgstr "%q" #: shared-bindings/microcontroller/Pin.c msgid "%q and %q contain duplicate pins" -msgstr "" +msgstr "%q και %q περιέχουν διπλότυπα pins" + +#: ports/atmel-samd/common-hal/audioio/AudioOut.c +msgid "%q and %q must be different" +msgstr "%q και %q πρεπει να είναι διαφορετικά" #: shared-bindings/microcontroller/Pin.c msgid "%q contains duplicate pins" -msgstr "" +msgstr "%q περιέχει διπλότυπα pins" #: ports/atmel-samd/common-hal/sdioio/SDCard.c msgid "%q failure: %d" -msgstr "" +msgstr "%q αποτυχία: %d" +#: shared-bindings/digitalio/DigitalInOut.c #: shared-bindings/microcontroller/Pin.c msgid "%q in use" -msgstr "" +msgstr "%q είναι σε χρήση" + +#: py/obj.c py/objstr.c py/objstrunicode.c +msgid "%q index out of range" +msgstr "%q δείκτης εκτός εμβέλειας" + +#: py/obj.c +msgid "%q indices must be integers, not %s" +msgstr "%q δείκτες πρέπει να είναι ακέραιοι, όχι %s" + +#: shared-module/bitbangio/SPI.c +msgid "%q init failed" +msgstr "%q εκκίνηση απέτυχε" + +#: py/argcheck.c +msgid "%q length must be %d" +msgstr "%q μήκος πρέπει να είναι %d" + +#: py/argcheck.c +msgid "%q length must be %d-%d" +msgstr "%q μήκος πρέπει να είναι %d-%d" + +#: py/argcheck.c +msgid "%q length must be <= %d" +msgstr "%q μήκος πρέπει να είναι <= %d" + +#: py/argcheck.c +msgid "%q length must be >= %d" +msgstr "%q μήκος πρέπει να είναι >= %d" + +#: shared-bindings/busio/I2C.c +msgid "%q length must be >= 1" +msgstr "%q μήκος πρέπει να είναι >= 1" + +#: py/argcheck.c +msgid "%q must be %d" +msgstr "%q πρέπει να είναι %d" + +#: py/argcheck.c +msgid "%q must be %d-%d" +msgstr "%q πρέπει να είναι %d-%d" + +#: shared-bindings/displayio/Display.c +msgid "%q must be 1 when %q is True" +msgstr "%q πρέπει να είναι 1 όταν %q είναι True" + +#: py/argcheck.c shared-bindings/gifio/GifWriter.c +msgid "%q must be <= %d" +msgstr "%q πρέπει να είναι <= %d" + +#: py/argcheck.c +msgid "%q must be >= %d" +msgstr "%q πρέπει να είναι >= %d" + +#: shared-bindings/analogbufio/BufferedIn.c +#: shared-bindings/audiocore/RawSample.c +msgid "%q must be a bytearray or array of type 'h', 'H', 'b', or 'B'" +msgstr "%q πρέπει να είναι bytearray ή array τύπου 'h', 'H', 'b', ή 'B'" + +#: py/argcheck.c +msgid "%q must be a string" +msgstr "%q πρέπει να είναι string" + +#: py/argcheck.c +msgid "%q must be an int" +msgstr "%q πρέπει να είναι int" + +#: py/argcheck.c +msgid "%q must be of type %q" +msgstr "%q πρέπει να είναι τύπου %q" + +#: shared-bindings/digitalio/Pull.c +msgid "%q must be of type %q or None" +msgstr "%q πρέπει να είναι τύπου %q ή None" + +#: ports/atmel-samd/common-hal/busio/UART.c +msgid "%q must be power of 2" +msgstr "%q πρέπει να είναι δύναμη του 2" + +#: shared-bindings/wifi/Monitor.c +msgid "%q out of bounds" +msgstr "%q εκτός ορίων" #: ports/atmel-samd/common-hal/pulseio/PulseIn.c #: ports/cxd56/common-hal/pulseio/PulseIn.c #: ports/nrf/common-hal/pulseio/PulseIn.c -#: ports/raspberrypi/common-hal/pulseio/PulseIn.c -#: ports/stm/common-hal/pulseio/PulseIn.c py/obj.c py/objstr.c -#: py/objstrunicode.c -msgid "%q index out of range" -msgstr "" - -#: py/obj.c -msgid "%q indices must be integers, not %s" -msgstr "" - -#: py/argcheck.c -msgid "%q length must be %d-%d" -msgstr "" - -#: shared-bindings/busio/I2C.c shared-bindings/usb_hid/Device.c -msgid "%q length must be >= 1" -msgstr "" - -#: py/argcheck.c -msgid "%q must be %d-%d" -msgstr "" - -#: shared-bindings/displayio/Display.c -msgid "%q must be 1 when %q is True" -msgstr "" - -#: py/argcheck.c shared-bindings/gifio/GifWriter.c -msgid "%q must be <= %d" -msgstr "" - -#: py/argcheck.c -msgid "%q must be >= %d" -msgstr "" - -#: py/argcheck.c shared-bindings/memorymonitor/AllocationAlarm.c -msgid "%q must be >= 0" -msgstr "" - -#: shared-bindings/_bleio/CharacteristicBuffer.c -#: shared-bindings/_bleio/PacketBuffer.c shared-bindings/displayio/Group.c -#: shared-bindings/displayio/Shape.c -#: shared-bindings/memorymonitor/AllocationAlarm.c -#: shared-bindings/vectorio/Circle.c shared-bindings/vectorio/Rectangle.c -msgid "%q must be >= 1" -msgstr "" - -#: py/argcheck.c -msgid "%q must be a string" -msgstr "" - -#: shared-module/vectorio/Polygon.c -msgid "%q must be a tuple of length 2" -msgstr "" - -#: ports/espressif/common-hal/imagecapture/ParallelImageCapture.c -#: shared-module/vectorio/VectorShape.c -msgid "%q must be between %d and %d" -msgstr "" - -#: py/argcheck.c -msgid "%q must be of type %q" -msgstr "" - -#: shared-bindings/digitalio/Pull.c -msgid "%q must be of type %q or None" -msgstr "" - -#: ports/atmel-samd/common-hal/busio/UART.c -msgid "%q must be power of 2" -msgstr "" - -#: shared-bindings/wifi/Monitor.c -msgid "%q out of bounds" -msgstr "" - #: ports/raspberrypi/common-hal/rp2pio/StateMachine.c +#: ports/stm/common-hal/pulseio/PulseIn.c py/argcheck.c #: shared-bindings/canio/Match.c msgid "%q out of range" -msgstr "" +msgstr "%q εκτός εμβέλειας" #: ports/atmel-samd/common-hal/microcontroller/Pin.c msgid "%q pin invalid" -msgstr "" - -#: shared-bindings/fontio/BuiltinFont.c -msgid "%q should be an int" -msgstr "" +msgstr "%q άκυρο pin" #: shared-bindings/usb_hid/Device.c msgid "%q with a report ID of 0 must be of length 1" -msgstr "" +msgstr "%q με ID αναφοράς 0 πρέπει να έχει μήκος 1" #: py/bc.c py/objnamedtuple.c msgid "%q() takes %d positional arguments but %d were given" -msgstr "" +msgstr "%q() παίρνει %d ορίσματα θέσεως αλλά %d δόθηκαν" #: shared-bindings/usb_hid/Device.c msgid "%q, %q, and %q must all be the same length" -msgstr "" +msgstr "%q, %q, και %q πρέπει να είναι όλα του ιδίου μήκους" -#: ports/espressif/bindings/espidf/__init__.c ports/espressif/esp_error.c +#: py/objint.c +msgid "%q=%q" +msgstr "%q=%q" + +#: ports/espressif/common-hal/espidf/__init__.c ports/espressif/esp_error.c #, c-format msgid "%s error 0x%x" -msgstr "" +msgstr "%s σφάλμα 0x%x" #: py/argcheck.c msgid "'%q' argument required" -msgstr "" +msgstr "'%q' όρισμα απαιτείται" #: py/proto.c msgid "'%q' object does not support '%q'" -msgstr "" +msgstr "'%q' αντικείμενο δεν υποστηρίζει '%q'" #: py/runtime.c msgid "'%q' object is not an iterator" -msgstr "" +msgstr "'%q' αντικείμενο δεν είναι επαναλήπτης" #: py/objtype.c py/runtime.c shared-module/atexit/__init__.c msgid "'%q' object is not callable" -msgstr "" +msgstr "'%q' αντικείμενο δεν καλείται" #: py/runtime.c msgid "'%q' object is not iterable" -msgstr "" +msgstr "'%q' αντικείμενο δεν είναι επαναληπτικό" #: py/emitinlinethumb.c py/emitinlinextensa.c #, c-format msgid "'%s' expects a label" -msgstr "" +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 msgid "'%s' expects an FPU register" -msgstr "" +msgstr "'%s' περιμένει έναν FPU καταχωρητή" #: py/emitinlinethumb.c #, c-format msgid "'%s' expects an address of the form [a, b]" -msgstr "" +msgstr "'%s' περιμένει μια διεύθυνση της μορφής [a, b]" #: py/emitinlinethumb.c py/emitinlinextensa.c #, c-format msgid "'%s' expects an integer" -msgstr "" +msgstr "'%s' περιμένει έναν ακέραιο" #: py/emitinlinethumb.c #, c-format msgid "'%s' expects at most r%d" -msgstr "" +msgstr "'%s' περιμένει το πολύ r%d" #: py/emitinlinethumb.c #, c-format msgid "'%s' expects {r0, r1, ...}" -msgstr "" +msgstr "'%s' περιμένει {r0, r1, ...}" #: py/emitinlinextensa.c #, c-format msgid "'%s' integer %d isn't within range %d..%d" -msgstr "" +msgstr "'%s' ακέραιος %d δεν είναι μέσα στο επιτρεπτό εύρος %d..%d" #: py/emitinlinethumb.c #, c-format msgid "'%s' integer 0x%x doesn't fit in mask 0x%x" -msgstr "" +msgstr "'%s' ακέραιος 0x%x δεν χωράει στην μάσκα 0x%x" #: py/obj.c #, c-format msgid "'%s' object doesn't support item assignment" -msgstr "" +msgstr "'%s' αντικείμενο δεν υποστηρίζει ορισμό πράγματος" #: py/obj.c #, c-format msgid "'%s' object doesn't support item deletion" -msgstr "" +msgstr "'%s' αντικείμενο δεν υποστηρίζει διαγραφή πράγματος" -#: py/runtime.c +#: ports/raspberrypi/common-hal/wifi/Radio.c py/runtime.c msgid "'%s' object has no attribute '%q'" -msgstr "" +msgstr "'%s' αντικείμενο δεν έχει γνώρισμα '%q'" #: py/obj.c #, c-format msgid "'%s' object isn't subscriptable" -msgstr "" +msgstr "'%s' αντικείμενο δεν είναι subscriptable" #: py/objstr.c msgid "'=' alignment not allowed in string format specifier" -msgstr "" +msgstr "Ευθυγράμμιση του '=' δεν επιτρέπεται εντός προσδιοριστή string format" #: shared-module/struct/__init__.c msgid "'S' and 'O' are not supported format types" -msgstr "" +msgstr "'S' και 'O' δεν είναι υποστηριζόμενοι τύποι format" #: py/compile.c msgid "'align' requires 1 argument" -msgstr "" +msgstr "'align' απαιτεί τουλάχιστον ένα όρισμα" #: py/compile.c msgid "'await' outside function" -msgstr "" +msgstr "'await' εκτός συνάρτησης" #: py/compile.c msgid "'await', 'async for' or 'async with' outside async function" -msgstr "" +msgstr "'await', 'async for' ή 'async with' εκτός ασύνχρονης συνάρτησης" #: py/compile.c msgid "'break' outside loop" -msgstr "" +msgstr "'break' εκτός επανάληψης" #: py/compile.c msgid "'continue' outside loop" -msgstr "" +msgstr "'continue' εκτός επανάληψης" #: py/objgenerator.c msgid "'coroutine' object is not an iterator" -msgstr "" +msgstr "'coroutine' αντικείμενο δεν μπορεί να χρησιμοποιηθεί σαν επαναλήπτης" #: py/compile.c msgid "'data' requires at least 2 arguments" -msgstr "" +msgstr "'data' απαιτεί τουλάχιστον 2 παραμέτρους" #: py/compile.c msgid "'data' requires integer arguments" -msgstr "" +msgstr "'data' απαιτεί ακέραιες παραμέτρους" #: py/compile.c msgid "'label' requires 1 argument" -msgstr "" +msgstr "'label' απαιτεί ένα όρισμα" #: py/compile.c msgid "'return' outside function" -msgstr "" +msgstr "'return' εκτός συνάρτησης" #: py/compile.c msgid "'yield from' inside async function" -msgstr "" +msgstr "'yield from' εκτός ασύνχρονης συνάρτησης" #: py/compile.c msgid "'yield' outside function" -msgstr "" - -#: shared-module/vectorio/VectorShape.c -msgid "(x,y) integers required" -msgstr "" +msgstr "'yield' εκτός συνάρτησης" #: py/compile.c msgid "*x must be assignment target" -msgstr "" +msgstr "*x πρέπει να είναι στόχος ανάθεσης" #: py/obj.c msgid ", in %q\n" -msgstr "" +msgstr ", στο %q\n" #: py/objcomplex.c msgid "0.0 to a complex power" -msgstr "" +msgstr "0.0 σε μία σύνθετη δύναμη" #: py/modbuiltins.c msgid "3-arg pow() not supported" -msgstr "" +msgstr "pow() με 3 παραμέτρους δεν υποστηρίζεται" #: shared-module/msgpack/__init__.c +#, fuzzy msgid "64 bit types" -msgstr "" +msgstr "64 bit τύποι" #: ports/atmel-samd/common-hal/alarm/pin/PinAlarm.c #: ports/atmel-samd/common-hal/countio/Counter.c #: ports/atmel-samd/common-hal/rotaryio/IncrementalEncoder.c msgid "A hardware interrupt channel is already in use" -msgstr "" +msgstr "Ένα κανάλι interrupt υλικού είναι ήδη σε χρήση" #: ports/espressif/common-hal/analogio/AnalogIn.c msgid "ADC2 is being used by WiFi" -msgstr "" +msgstr "Το ADC2 χρησιμοποιείται απο το WIFI" #: shared-bindings/_bleio/Address.c shared-bindings/ipaddress/IPv4Address.c #, c-format msgid "Address must be %d bytes long" -msgstr "" - -#: shared-bindings/_bleio/Address.c -msgid "Address type out of range" -msgstr "" +msgstr "Η διεύθυνση πρέπει να είναι %d bytes μεγάλη" #: ports/espressif/common-hal/canio/CAN.c msgid "All CAN peripherals are in use" -msgstr "" +msgstr "Όλα τα περιφεριακά CAN είναι σε χρήση" #: ports/espressif/common-hal/busio/I2C.c -#: ports/espressif/common-hal/i2cperipheral/I2CPeripheral.c +#: ports/espressif/common-hal/i2ctarget/I2CTarget.c #: ports/nrf/common-hal/busio/I2C.c msgid "All I2C peripherals are in use" -msgstr "" +msgstr "Όλα τα I2C περιφεριακά ειναι σε χρήση" #: ports/espressif/common-hal/countio/Counter.c #: ports/espressif/common-hal/frequencyio/FrequencyIn.c #: ports/espressif/common-hal/rotaryio/IncrementalEncoder.c msgid "All PCNT units in use" -msgstr "" +msgstr "Όλες οι μονάδες PCNT είναι σε χρήση" #: ports/atmel-samd/common-hal/canio/Listener.c #: ports/espressif/common-hal/canio/Listener.c #: ports/stm/common-hal/canio/Listener.c msgid "All RX FIFOs in use" -msgstr "" +msgstr "Όλα τα RX FIFOs είναι σε χρήση" #: ports/espressif/common-hal/busio/SPI.c ports/nrf/common-hal/busio/SPI.c msgid "All SPI peripherals are in use" -msgstr "" +msgstr "Όλα τα SPI περιφεριακά είναι σε χρήση" #: ports/espressif/common-hal/busio/UART.c ports/nrf/common-hal/busio/UART.c #: ports/raspberrypi/common-hal/busio/UART.c msgid "All UART peripherals are in use" -msgstr "" +msgstr "Όλα τα UART περιφεριακά ειναι σε χρήση" #: ports/nrf/common-hal/countio/Counter.c #: ports/nrf/common-hal/pulseio/PulseIn.c #: ports/nrf/common-hal/rotaryio/IncrementalEncoder.c #: shared-bindings/pwmio/PWMOut.c msgid "All channels in use" -msgstr "" +msgstr "Όλα τα κανάλια είναι σε χρήση" #: ports/atmel-samd/common-hal/audioio/AudioOut.c msgid "All event channels in use" -msgstr "" +msgstr "Όλα τα κανάλια συμβάντων είναι σε χρήση" -#: ports/raspberrypi/common-hal/pulseio/PulseIn.c #: ports/raspberrypi/common-hal/rp2pio/StateMachine.c msgid "All state machines in use" -msgstr "" +msgstr "Όλες οι μηχανές κατάστασης είναι σε χρήση" #: ports/atmel-samd/audio_dma.c msgid "All sync event channels in use" -msgstr "" +msgstr "Όλα τα κανάλια συμβάντων συγχρονισμού είναι σε χρήση" #: shared-bindings/pwmio/PWMOut.c msgid "All timers for this pin are in use" -msgstr "" +msgstr "Όλοι οι χρονιστές για αυτό το pin χρησιμοποιούνται ήδη" #: ports/atmel-samd/common-hal/_pew/PewPew.c #: ports/atmel-samd/common-hal/audioio/AudioOut.c @@ -448,201 +482,170 @@ msgstr "" #: ports/raspberrypi/common-hal/audiopwmio/PWMAudioOut.c #: ports/stm/peripherals/timers.c shared-bindings/pwmio/PWMOut.c msgid "All timers in use" -msgstr "" +msgstr "Όλοι οι χρονιστές βρίσκονται σε χρήση" #: ports/espressif/common-hal/_bleio/Adapter.c #: ports/nrf/common-hal/_bleio/Adapter.c msgid "Already advertising." -msgstr "" +msgstr "Ήδη διαφημίζουμε." #: ports/atmel-samd/common-hal/canio/Listener.c msgid "Already have all-matches listener" -msgstr "" +msgstr "Ύπάρχει ήδη all-matches ακροατής" #: shared-module/memorymonitor/AllocationAlarm.c #: shared-module/memorymonitor/AllocationSize.c msgid "Already running" -msgstr "" +msgstr "Τρέχει ήδη" #: ports/espressif/common-hal/wifi/Radio.c +#: ports/raspberrypi/common-hal/wifi/Radio.c msgid "Already scanning for wifi networks" -msgstr "" - -#: ports/cxd56/common-hal/analogio/AnalogIn.c -msgid "AnalogIn not supported on given pin" -msgstr "" - -#: ports/cxd56/common-hal/analogio/AnalogOut.c -#: ports/mimxrt10xx/common-hal/analogio/AnalogOut.c -#: ports/nrf/common-hal/analogio/AnalogOut.c -#: ports/raspberrypi/common-hal/analogio/AnalogOut.c -msgid "AnalogOut functionality not supported" -msgstr "" - -#: shared-bindings/analogio/AnalogOut.c -msgid "AnalogOut is only 16 bits. Value must be less than 65536." -msgstr "" - -#: ports/atmel-samd/common-hal/analogio/AnalogOut.c -msgid "AnalogOut not supported on given pin" -msgstr "" +msgstr "Ήδη γίνεται σάρωση για δίκτυα wifi" #: ports/stm/common-hal/audiopwmio/PWMAudioOut.c msgid "Another PWMAudioOut is already active" -msgstr "" +msgstr "Και άλλο PWMAudioOut είναι σε χρήση" #: ports/atmel-samd/common-hal/pulseio/PulseOut.c #: ports/cxd56/common-hal/pulseio/PulseOut.c msgid "Another send is already active" -msgstr "" +msgstr "Άλλη αποστολή είναι ήδη ενεργή" #: shared-bindings/pulseio/PulseOut.c msgid "Array must contain halfwords (type 'H')" -msgstr "" +msgstr "H παράταξη πρέπει να περιέχει halfwords (τύπου 'H')" #: shared-bindings/alarm/SleepMemory.c shared-bindings/nvm/ByteArray.c msgid "Array values should be single bytes." -msgstr "" +msgstr "Η τιμές της παράταξη πρέπει να είναι μονά bytes." #: shared-bindings/microcontroller/Pin.c msgid "At most %d %q may be specified (not %d)" -msgstr "" +msgstr "Το πολύ %d %q μπορεί να είναι καθορισμένα (όχι %d)" #: shared-module/memorymonitor/AllocationAlarm.c #, c-format msgid "Attempt to allocate %d blocks" -msgstr "" +msgstr "Προσπάθεια να δεσμευτούν %d blocks" #: supervisor/shared/safe_mode.c msgid "Attempted heap allocation when VM not running." -msgstr "" +msgstr "Προσπάθεια δέσμευσης heap όταν το VM δεν τρέχει." #: ports/raspberrypi/audio_dma.c msgid "Audio conversion not implemented" -msgstr "" +msgstr "Η μετατροπή ήχου δεν υποστηρίζεται" #: shared-bindings/wifi/Radio.c msgid "AuthMode.OPEN is not used with password" -msgstr "" +msgstr "AuthMode.OPEN δεν μπορεί να χρησιμοποιηθεί με κωδικό" -#: shared-bindings/wifi/Radio.c +#: shared-bindings/wifi/Radio.c supervisor/shared/web_workflow/web_workflow.c msgid "Authentication failure" -msgstr "" +msgstr "Αποτυχία αυθεντικοποίησης" #: main.c msgid "Auto-reload is off.\n" -msgstr "" +msgstr "Η αυτόματη επαναφόρτωση είναι απενεργοποιημένη.\n" #: main.c msgid "" "Auto-reload is on. Simply save files over USB to run them or enter REPL to " "disable.\n" msgstr "" +"Η αυτόματη επαναφόρτωση είναι ενεργή. Αποθηκεύστε αρχεία μέσω USB για να " +"τρέξετε ή ανοίξτε το REPL για απενεργοποίηση.\n" #: ports/espressif/common-hal/canio/CAN.c msgid "Baudrate not supported by peripheral" -msgstr "" +msgstr "Baudrate δεν υποστηρίζεται από την περιφεριακή συσκευή" #: shared-module/displayio/Display.c #: shared-module/framebufferio/FramebufferDisplay.c msgid "Below minimum frame rate" -msgstr "" +msgstr "Χαμηλότερο από το ελάχιστο frame rate" #: ports/raspberrypi/common-hal/audiobusio/I2SOut.c msgid "Bit clock and word select must be sequential pins" -msgstr "" +msgstr "Ρολόι bit και word select πρέπει να είναι διαδοχικά pins" #: ports/atmel-samd/common-hal/audiobusio/I2SOut.c 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 "" +msgstr "Ρολόι bit και word select πρέπει να μοιράζονται μια μονάδα ρολογιού" #: shared-bindings/audiobusio/PDMIn.c msgid "Bit depth must be multiple of 8." -msgstr "" +msgstr "Βάθος bit πρέπει να είναι πολλαπλάσιο του 8." #: shared-bindings/bitmaptools/__init__.c msgid "Bitmap size and bits per value must match" -msgstr "" +msgstr "Το μέγεθος του bitmap και τα bits ανα τιμή πρέπει να ταιριάζουν" #: supervisor/shared/safe_mode.c msgid "Boot device must be first device (interface #0)." -msgstr "" +msgstr "Η συσκευή boot πρέπει να είναι η πρώτη συσκευή (interface #0)." #: ports/mimxrt10xx/common-hal/busio/UART.c msgid "Both RX and TX required for flow control" -msgstr "" +msgstr "Και RX και TX απαιτούνται για έλεγχο flow" #: ports/atmel-samd/common-hal/rotaryio/IncrementalEncoder.c msgid "Both pins must support hardware interrupts" -msgstr "" +msgstr "Και τα δύο pin πρέπει να υποστηρίζουν interrupts υλικού" #: shared-bindings/displayio/Display.c #: shared-bindings/framebufferio/FramebufferDisplay.c #: shared-bindings/is31fl3741/FrameBuffer.c #: shared-bindings/rgbmatrix/RGBMatrix.c msgid "Brightness must be 0-1.0" -msgstr "" +msgstr "Η φωτινότητα πρέπει να είναι μεταξύ 0-1.0" #: shared-bindings/displayio/Display.c #: shared-bindings/framebufferio/FramebufferDisplay.c msgid "Brightness not adjustable" -msgstr "" +msgstr "H φωτεινότητα δεν μπορεί να προσαρμοστεί" #: shared-bindings/_bleio/UUID.c #, c-format msgid "Buffer + offset too small %d %d %d" -msgstr "" +msgstr "Buffer + offset είναι πολύ μικρά %d %d %d" #: ports/raspberrypi/bindings/rp2pio/StateMachine.c msgid "Buffer elements must be 4 bytes long or less" -msgstr "" - -#: shared-module/usb_hid/Device.c -#, c-format -msgid "Buffer incorrect size. Should be %d bytes." -msgstr "" +msgstr "Στοιχεία του buffer πρέπει να είναι το πολύ 4 bytes" #: shared-bindings/framebufferio/FramebufferDisplay.c msgid "Buffer is not a bytearray." -msgstr "" +msgstr "Το buffer δεν είναι ένα bytearray." #: ports/cxd56/common-hal/camera/Camera.c shared-bindings/displayio/Display.c #: shared-bindings/framebufferio/FramebufferDisplay.c msgid "Buffer is too small" -msgstr "" +msgstr "Πολύ μικρό buffer" -#: ports/nrf/common-hal/audiopwmio/PWMAudioOut.c #: ports/stm/common-hal/audiopwmio/PWMAudioOut.c #, c-format msgid "Buffer length %d too big. It must be less than %d" -msgstr "" +msgstr "Το μήκος buffer %d είναι πολύ μεγάλο. Πρέπει ν α είναι λιγότερο απο %d" #: ports/atmel-samd/common-hal/sdioio/SDCard.c #: ports/cxd56/common-hal/sdioio/SDCard.c shared-module/sdcardio/SDCard.c msgid "Buffer length must be a multiple of 512" -msgstr "" +msgstr "Το μήκος buffer πρέπει να είναι πολλαπλάσιο του 512" #: ports/stm/common-hal/sdioio/SDCard.c shared-bindings/floppyio/__init__.c msgid "Buffer must be a multiple of 512 bytes" -msgstr "" - -#: shared-bindings/bitbangio/I2C.c -msgid "Buffer must be at least length 1" -msgstr "" +msgstr "Buffer πρέπει να είναι πολλαπλάσιο των 512 bytes" #: shared-bindings/_bleio/PacketBuffer.c #, c-format msgid "Buffer too short by %d bytes" -msgstr "" +msgstr "Buffer πολύ μικρό κατα %d bytes" #: ports/espressif/common-hal/imagecapture/ParallelImageCapture.c msgid "Buffers must be same size" -msgstr "" +msgstr "Τα Buffers πρέπει να είναι του ιδίου μεγέθους" #: ports/atmel-samd/common-hal/paralleldisplay/ParallelBus.c #: ports/espressif/common-hal/paralleldisplay/ParallelBus.c @@ -650,279 +653,228 @@ msgstr "" #: ports/raspberrypi/common-hal/paralleldisplay/ParallelBus.c #, c-format msgid "Bus pin %d is already in use" -msgstr "" +msgstr "Bus pin %d είναι ήδη σε χρήση" #: shared-bindings/_bleio/UUID.c msgid "Byte buffer must be 16 bytes." -msgstr "" - -#: shared-bindings/alarm/SleepMemory.c shared-bindings/nvm/ByteArray.c -msgid "Bytes must be between 0 and 255." -msgstr "" +msgstr "Byte buffer πρέπει να είναι 16 bytes." #: shared-bindings/aesio/aes.c msgid "CBC blocks must be multiples of 16 bytes" -msgstr "" +msgstr "CBC blocks πρέπει να είναι πολλαπλάσια του 16 bytes" #: supervisor/shared/safe_mode.c msgid "CIRCUITPY drive could not be found or created." -msgstr "" +msgstr "Ο CIRCUITPY δίσκος δεν μπόρεσε να βρεθεί ή να δημιουργηθεί." -#: ports/espressif/bindings/espidf/__init__.c ports/espressif/esp_error.c +#: ports/espressif/common-hal/espidf/__init__.c ports/espressif/esp_error.c msgid "CRC or checksum was invalid" -msgstr "" +msgstr "CRC ή checksum ήταν άκυρο" #: py/objtype.c msgid "Call super().__init__() before accessing native object." -msgstr "" +msgstr "Κλήση super().__init__() πρίν την πρόσβαση του τοπικού αντικειμένου." + +#: ports/cxd56/common-hal/camera/Camera.c +msgid "Camera init" +msgstr "Εκκίνηση κάμερας" #: ports/espressif/common-hal/alarm/pin/PinAlarm.c msgid "Can only alarm on RTC IO from deep sleep." -msgstr "" +msgstr "Μόνο IO alarm ή RTC επιτρέπονται από βαθύ ύπνο." #: ports/espressif/common-hal/alarm/pin/PinAlarm.c msgid "Can only alarm on one low pin while others alarm high from deep sleep." msgstr "" +"Μόνο ένα alarm από low pin ενώ τα άλλα alarm θα είναι απο high σε βαθύ ύπνο." #: ports/espressif/common-hal/alarm/pin/PinAlarm.c msgid "Can only alarm on two low pins from deep sleep." -msgstr "" +msgstr "Μπορεί να γίνει alarm μόνο σε δύο low pins σε βαθύ ύπνο." #: ports/espressif/common-hal/_bleio/Characteristic.c #: ports/nrf/common-hal/_bleio/Characteristic.c msgid "Can't set CCCD on local Characteristic" -msgstr "" +msgstr "Δεν μπορεί να οριστεί CCCD σε τοπικό Characteristic" #: shared-bindings/storage/__init__.c shared-bindings/usb_cdc/__init__.c #: shared-bindings/usb_hid/__init__.c shared-bindings/usb_midi/__init__.c msgid "Cannot change USB devices now" -msgstr "" +msgstr "Δεν μπορούν να αλλάξουν οι USB συσκευές τώρα" #: shared-bindings/_bleio/Adapter.c msgid "Cannot create a new Adapter; use _bleio.adapter;" msgstr "" +"Δεν μπορεί να δημιουργηθεί νέο Adapter; χρησιμοποιείστε _bleio.adapter;" #: shared-bindings/displayio/Bitmap.c #: shared-bindings/memorymonitor/AllocationSize.c #: shared-bindings/pulseio/PulseIn.c msgid "Cannot delete values" -msgstr "" +msgstr "Δεν μπορούν να διαγραφούν οι τιμές" #: ports/atmel-samd/common-hal/digitalio/DigitalInOut.c #: ports/mimxrt10xx/common-hal/digitalio/DigitalInOut.c #: ports/nrf/common-hal/digitalio/DigitalInOut.c #: ports/raspberrypi/common-hal/digitalio/DigitalInOut.c msgid "Cannot get pull while in output mode" -msgstr "" +msgstr "Δεν γίνεται να διαβαστεί το pull όσο είναι σε output mode" #: ports/nrf/common-hal/microcontroller/Processor.c msgid "Cannot get temperature" -msgstr "" +msgstr "Δεν μπορεί να διαβαστεί η θερμοκρασία" #: shared-bindings/_bleio/Adapter.c msgid "Cannot have scan responses for extended, connectable advertisements." msgstr "" - -#: ports/atmel-samd/common-hal/audioio/AudioOut.c -msgid "Cannot output both channels on the same pin" -msgstr "" +"Δεν μπορούμε να έχουμε απαντήσεις scan για εκτεταμένες, συνδεόμενες " +"διαφημήσεις." #: ports/espressif/common-hal/alarm/pin/PinAlarm.c msgid "Cannot pull on input-only pin." -msgstr "" - -#: shared-module/bitbangio/SPI.c -msgid "Cannot read without MISO pin." -msgstr "" +msgstr "Δεν γίνεται pull σε pin μόνο για εισόδο." #: shared-bindings/audiobusio/PDMIn.c msgid "Cannot record to a file" -msgstr "" +msgstr "Δεν μπορεί να γίνει καταγραφή σε αρχείο" #: shared-module/storage/__init__.c msgid "Cannot remount '/' when visible via USB." -msgstr "" +msgstr "Δεν μπορεί να γίνει remount του '/' όταν είναι ορατό μέσω USB." #: ports/atmel-samd/common-hal/microcontroller/__init__.c #: ports/cxd56/common-hal/microcontroller/__init__.c #: ports/mimxrt10xx/common-hal/microcontroller/__init__.c -msgid "Cannot reset into bootloader because no bootloader is present." +msgid "Cannot reset into bootloader because no bootloader is present" msgstr "" +"Δεν μπορεί να γίνει επανεκκίνηση στον bootloader διότι δεν υπάρχει " +"bootloader παρόν" #: ports/espressif/common-hal/socketpool/Socket.c msgid "Cannot set socket options" -msgstr "" +msgstr "Δεν μπορεί να γίνει ρύθμιση των επιλογών του socket" #: shared-bindings/digitalio/DigitalInOut.c msgid "Cannot set value when direction is input." -msgstr "" +msgstr "Δεν μπορεί να οριστεί τιμή οταν η κατεύθυνση είναι input." #: ports/espressif/common-hal/busio/UART.c #: ports/mimxrt10xx/common-hal/busio/UART.c msgid "Cannot specify RTS or CTS in RS485 mode" -msgstr "" +msgstr "Δεν μπορεί να οριστεί RTS ή CTS σε RS485 mode" #: py/objslice.c msgid "Cannot subclass slice" -msgstr "" +msgstr "Δεν γίνεται υποκατηγορία ενός slice" #: shared-module/bitbangio/SPI.c -msgid "Cannot transfer without MOSI and MISO pins." -msgstr "" +msgid "Cannot transfer without MOSI and MISO pins" +msgstr "Δεν μπορεί να γίνει μεταφορά χωρίς MOSI και MISO pins" #: shared-bindings/pwmio/PWMOut.c msgid "Cannot vary frequency on a timer that is already in use" msgstr "" +"Δεν μπορεί να γίνει δυναμική μεταβολή της συχνότητας σε έναν χρονιστή που " +"είναι ήδη σε χρήση" + +#: ports/nrf/common-hal/alarm/pin/PinAlarm.c +msgid "Cannot wake on pin edge, only level" +msgstr "Δεν γίνεται αφύπνηση σε pin edge, αλλά μόνο σε level" #: ports/espressif/common-hal/alarm/pin/PinAlarm.c -#: ports/nrf/common-hal/alarm/pin/PinAlarm.c msgid "Cannot wake on pin edge. Only level." -msgstr "" - -#: shared-module/bitbangio/SPI.c -msgid "Cannot write without MOSI pin." -msgstr "" +msgstr "Δεν μπορεί να γίνει αφύπνηση σε pin edge. Μόνο level." #: shared-bindings/_bleio/CharacteristicBuffer.c msgid "CharacteristicBuffer writing not provided" -msgstr "" +msgstr "Δεν υποστηρίζονται εγγραφές στο CharacteristicBuffer" #: supervisor/shared/safe_mode.c msgid "CircuitPython core code crashed hard. Whoops!\n" -msgstr "" +msgstr "Ο πυρήνας της CircuitPython κατέρευσε. Οουπς!\n" #: supervisor/shared/safe_mode.c msgid "CircuitPython was unable to allocate the heap." -msgstr "" - -#: shared-module/bitbangio/SPI.c -msgid "Clock pin init failed." -msgstr "" +msgstr "Η CircuitPython δεν μπορέσε να δεσμεύσει το heap." #: shared-module/bitbangio/I2C.c msgid "Clock stretch too long" -msgstr "" +msgstr "Stretch ρολογιού πολύ μεγάλο" #: ports/atmel-samd/common-hal/audiobusio/I2SOut.c msgid "Clock unit in use" -msgstr "" - -#: shared-bindings/displayio/FourWire.c shared-bindings/displayio/I2CDisplay.c -#: shared-bindings/paralleldisplay/ParallelBus.c -msgid "Command must be an int between 0 and 255" -msgstr "" +msgstr "Μονάδα ρολογιού ήδη σε χρήση" #: shared-bindings/_bleio/Connection.c msgid "" "Connection has been disconnected and can no longer be used. Create a new " "connection." msgstr "" +"Έχει γίνει αποσύνδεση και αυτή η συνδεση δεν μπορεί να χρησιμοποιηθεί. " +"Δημιουργήστε μια νέα σύνδεση." #: py/persistentcode.c msgid "Corrupt .mpy file" -msgstr "" - -#: ports/cxd56/common-hal/camera/Camera.c -msgid "Could not initialize Camera" -msgstr "" - -#: ports/cxd56/common-hal/gnss/GNSS.c -msgid "Could not initialize GNSS" -msgstr "" - -#: ports/cxd56/common-hal/sdioio/SDCard.c -msgid "Could not initialize SDCard" -msgstr "" - -#: ports/atmel-samd/common-hal/busio/UART.c ports/cxd56/common-hal/busio/UART.c -#: ports/espressif/common-hal/busio/UART.c -msgid "Could not initialize UART" -msgstr "" - -#: ports/stm/common-hal/pwmio/PWMOut.c -msgid "Could not re-init channel" -msgstr "" - -#: ports/stm/common-hal/pwmio/PWMOut.c -msgid "Could not re-init timer" -msgstr "" - -#: ports/stm/common-hal/pwmio/PWMOut.c -msgid "Could not restart PWM" -msgstr "" +msgstr "Κατεστραμένο .mpy αρχείο" #: ports/espressif/common-hal/neopixel_write/__init__.c msgid "Could not retrieve clock" -msgstr "" +msgstr "Δεν μπόρεσε να ανακληθεί το ρολόι" #: shared-bindings/_bleio/Adapter.c msgid "Could not set address" -msgstr "" +msgstr "Δεν μπόρεσε να ρυθμιστεί η διεύθυνση" #: shared-bindings/pwmio/PWMOut.c msgid "Could not start PWM" -msgstr "" +msgstr "Δεν μπόρεσε να ξεκινήσει το PWM" #: ports/stm/common-hal/busio/UART.c msgid "Could not start interrupt, RX busy" -msgstr "" +msgstr "Δεν μπόρεσε να εκκινηθεί το interrupt, RX κατειλημμένο" #: shared-module/audiomp3/MP3Decoder.c msgid "Couldn't allocate decoder" -msgstr "" - -#: shared-module/audiocore/WaveFile.c shared-module/audiomixer/Mixer.c -#: shared-module/audiomp3/MP3Decoder.c -msgid "Couldn't allocate first buffer" -msgstr "" - -#: shared-module/audiomp3/MP3Decoder.c -msgid "Couldn't allocate input buffer" -msgstr "" - -#: shared-module/audiocore/WaveFile.c shared-module/audiomixer/Mixer.c -#: shared-module/audiomp3/MP3Decoder.c -msgid "Couldn't allocate second buffer" -msgstr "" +msgstr "Δεν μπόρεσε να δεσμευτεί decoder" #: supervisor/shared/safe_mode.c msgid "Crash into the HardFault_Handler." -msgstr "" +msgstr "Κατέρευσε μέσα στο HardFault_Handler." #: ports/stm/common-hal/analogio/AnalogOut.c msgid "DAC Channel Init Error" -msgstr "" +msgstr "Σφάλμα εκκίνησης καναλιού DAC" #: ports/stm/common-hal/analogio/AnalogOut.c msgid "DAC Device Init Error" -msgstr "" +msgstr "Σφάλμα εκκίνησης συσκευής DAC" #: ports/atmel-samd/common-hal/audioio/AudioOut.c msgid "DAC already in use" -msgstr "" +msgstr "DAC είναι ήδη σε χρήση" #: ports/atmel-samd/common-hal/paralleldisplay/ParallelBus.c #: ports/nrf/common-hal/paralleldisplay/ParallelBus.c msgid "Data 0 pin must be byte aligned" -msgstr "" +msgstr "Το Data 0 pin πρέπει να είναι byte aligned" #: shared-module/audiocore/WaveFile.c msgid "Data chunk must follow fmt chunk" -msgstr "" +msgstr "Το data chunk πρέπει να ακολουθεί το fmt chunk" #: ports/espressif/common-hal/_bleio/Adapter.c #: ports/nrf/common-hal/_bleio/Adapter.c msgid "Data not supported with directed advertising" -msgstr "" +msgstr "Δεν υποστηρίζονται δεδομένα με κατευθυνόμενη διαφήμιση" #: ports/espressif/common-hal/_bleio/Adapter.c #: ports/nrf/common-hal/_bleio/Adapter.c msgid "Data too large for advertisement packet" -msgstr "" +msgstr "Τα δεδομένα είναι πολύ μεγάλα για πακέτο διαφημίσεων" #: ports/stm/common-hal/alarm/pin/PinAlarm.c msgid "Deep sleep pins must use a rising edge with pulldown" -msgstr "" +msgstr "Τα pins βαθύ ύπνου πρέπει να χρησιμοποιούν rising edge με pulldown" #: shared-bindings/audiobusio/PDMIn.c msgid "Destination capacity is smaller than destination_length." @@ -932,10 +884,6 @@ msgstr "" msgid "Device in use" msgstr "" -#: ports/cxd56/common-hal/digitalio/DigitalInOut.c -msgid "DigitalInOut not supported on given pin" -msgstr "" - #: shared-bindings/displayio/Display.c #: shared-bindings/framebufferio/FramebufferDisplay.c msgid "Display must have a 16 bit colorspace." @@ -947,6 +895,10 @@ msgstr "" msgid "Display rotation must be in 90 degree increments" msgstr "" +#: main.c +msgid "Done" +msgstr "" + #: shared-bindings/digitalio/DigitalInOut.c msgid "Drive mode not used when direction is input." msgstr "" @@ -980,20 +932,19 @@ msgstr "" msgid "Error: Failure to bind" msgstr "" -#: ports/raspberrypi/bindings/rp2pio/StateMachine.c py/enum.c -#: shared-bindings/_bleio/__init__.c shared-bindings/aesio/aes.c -#: shared-bindings/busio/SPI.c shared-bindings/microcontroller/Pin.c +#: py/enum.c shared-bindings/_bleio/__init__.c shared-bindings/aesio/aes.c +#: shared-bindings/alarm/__init__.c shared-bindings/busio/SPI.c +#: shared-bindings/microcontroller/Pin.c #: shared-bindings/neopixel_write/__init__.c msgid "Expected a %q" msgstr "" -#: shared-bindings/alarm/__init__.c -msgid "Expected an alarm" +#: ports/raspberrypi/bindings/cyw43/__init__.c +msgid "Expected a %q or %q" msgstr "" -#: shared-module/adafruit_pixelbuf/PixelBuf.c -#, c-format -msgid "Expected tuple of length %d, got %d" +#: shared-bindings/alarm/__init__.c +msgid "Expected an %q" msgstr "" #: ports/espressif/common-hal/_bleio/Adapter.c @@ -1022,20 +973,8 @@ msgstr "" msgid "Failed to acquire mutex, err 0x%04x" msgstr "" -#: ports/mimxrt10xx/common-hal/busio/UART.c ports/nrf/common-hal/busio/UART.c -#: ports/raspberrypi/common-hal/busio/UART.c -msgid "Failed to allocate RX buffer" -msgstr "" - -#: ports/atmel-samd/common-hal/busio/UART.c -#: ports/atmel-samd/common-hal/pulseio/PulseIn.c -#: ports/cxd56/common-hal/pulseio/PulseIn.c -#: ports/espressif/common-hal/pulseio/PulseIn.c -#: ports/nrf/common-hal/pulseio/PulseIn.c -#: ports/raspberrypi/common-hal/pulseio/PulseIn.c -#: ports/stm/common-hal/pulseio/PulseIn.c -#, c-format -msgid "Failed to allocate RX buffer of %d bytes" +#: shared-module/rgbmatrix/RGBMatrix.c +msgid "Failed to allocate %q buffer" msgstr "" #: ports/espressif/common-hal/wifi/__init__.c @@ -1059,10 +998,6 @@ msgstr "" msgid "Failed to connect: timeout" msgstr "" -#: ports/espressif/common-hal/wifi/__init__.c -msgid "Failed to init wifi" -msgstr "" - #: shared-module/audiomp3/MP3Decoder.c msgid "Failed to parse MP3 file" msgstr "" @@ -1106,11 +1041,6 @@ msgstr "" msgid "Format not supported" msgstr "" -#: shared-module/framebufferio/FramebufferDisplay.c -#, c-format -msgid "Framebuffer requires %d bytes" -msgstr "" - #: ports/mimxrt10xx/common-hal/microcontroller/Processor.c msgid "" "Frequency must be 24, 150, 396, 450, 528, 600, 720, 816, 912, 960 or 1008 Mhz" @@ -1125,7 +1055,11 @@ msgstr "" msgid "Function requires lock" msgstr "" -#: ports/espressif/bindings/espidf/__init__.c ports/espressif/esp_error.c +#: ports/cxd56/common-hal/gnss/GNSS.c +msgid "GNSS init" +msgstr "" + +#: ports/espressif/common-hal/espidf/__init__.c ports/espressif/esp_error.c msgid "Generic Failure" msgstr "" @@ -1152,19 +1086,16 @@ msgstr "" msgid "Hardware in use, try alternative pins" msgstr "" -#: shared-bindings/wifi/Radio.c -msgid "Hostname must be between 1 and 253 characters" -msgstr "" - #: extmod/vfs_posix_file.c py/objstringio.c msgid "I/O operation on closed file" msgstr "" #: ports/stm/common-hal/busio/I2C.c -msgid "I2C Init Error" +msgid "I2C init error" msgstr "" #: ports/raspberrypi/common-hal/busio/I2C.c +#: ports/raspberrypi/common-hal/i2ctarget/I2CTarget.c msgid "I2C peripheral in use" msgstr "" @@ -1269,75 +1200,37 @@ msgstr "" msgid "Internal error #%d" msgstr "" -#: shared-bindings/sdioio/SDCard.c shared-module/usb_hid/Device.c +#: supervisor/shared/safe_mode.c +msgid "Internal watchdog timer expired." +msgstr "" + +#: py/argcheck.c shared-bindings/digitalio/DigitalInOut.c msgid "Invalid %q" msgstr "" -#: ports/atmel-samd/common-hal/audiobusio/I2SOut.c -#: ports/atmel-samd/common-hal/audiobusio/PDMIn.c -#: ports/atmel-samd/common-hal/imagecapture/ParallelImageCapture.c -#: ports/mimxrt10xx/common-hal/busio/UART.c +#: shared-bindings/microcontroller/Pin.c msgid "Invalid %q pin" msgstr "" -#: ports/stm/common-hal/busio/I2C.c ports/stm/common-hal/busio/SPI.c -#: ports/stm/common-hal/busio/UART.c ports/stm/common-hal/canio/CAN.c -#: ports/stm/common-hal/sdioio/SDCard.c -msgid "Invalid %q pin selection" -msgstr "" - #: ports/stm/common-hal/analogio/AnalogIn.c msgid "Invalid ADC Unit value" msgstr "" -#: ports/espressif/common-hal/wifi/Radio.c -msgid "Invalid AuthMode" -msgstr "" - #: ports/espressif/common-hal/_bleio/__init__.c #: ports/nrf/common-hal/_bleio/__init__.c msgid "Invalid BLE parameter" msgstr "" -#: shared-module/displayio/OnDiskBitmap.c -msgid "Invalid BMP file" -msgstr "" - #: shared-bindings/wifi/Radio.c msgid "Invalid BSSID" msgstr "" -#: ports/espressif/common-hal/analogio/AnalogOut.c -#: ports/stm/common-hal/analogio/AnalogOut.c -msgid "Invalid DAC pin supplied" -msgstr "" - #: shared-bindings/wifi/Radio.c msgid "Invalid MAC address" msgstr "" -#: shared-bindings/synthio/__init__.c -msgid "Invalid MIDI file" -msgstr "" - -#: ports/atmel-samd/common-hal/pwmio/PWMOut.c -#: ports/cxd56/common-hal/pwmio/PWMOut.c -#: ports/espressif/common-hal/pwmio/PWMOut.c -#: ports/mimxrt10xx/common-hal/pwmio/PWMOut.c -#: ports/nrf/common-hal/pwmio/PWMOut.c -#: ports/raspberrypi/common-hal/pwmio/PWMOut.c shared-bindings/pwmio/PWMOut.c -msgid "Invalid PWM frequency" -msgstr "" - -#: ports/espressif/common-hal/analogio/AnalogIn.c -msgid "Invalid Pin" -msgstr "" - -#: ports/espressif/bindings/espidf/__init__.c -#: ports/espressif/common-hal/busio/I2C.c -#: ports/espressif/common-hal/i2cperipheral/I2CPeripheral.c -#: ports/espressif/esp_error.c py/moduerrno.c -#: shared-module/rgbmatrix/RGBMatrix.c +#: ports/espressif/common-hal/espidf/__init__.c ports/espressif/esp_error.c +#: py/moduerrno.c msgid "Invalid argument" msgstr "" @@ -1345,42 +1238,11 @@ msgstr "" msgid "Invalid bits per value" msgstr "" -#: ports/nrf/common-hal/busio/UART.c ports/raspberrypi/common-hal/busio/UART.c -#: ports/stm/common-hal/busio/UART.c -msgid "Invalid buffer size" -msgstr "" - -#: shared-bindings/adafruit_pixelbuf/PixelBuf.c -msgid "Invalid byteorder string" -msgstr "" - -#: ports/atmel-samd/common-hal/frequencyio/FrequencyIn.c -#: ports/espressif/common-hal/frequencyio/FrequencyIn.c -msgid "Invalid capture period. Valid range: 1 - 500" -msgstr "" - -#: shared-bindings/audiomixer/Mixer.c -msgid "Invalid channel count" -msgstr "" - -#: ports/atmel-samd/common-hal/imagecapture/ParallelImageCapture.c -#, c-format -msgid "Invalid data_count %d" -msgstr "" - #: ports/atmel-samd/common-hal/imagecapture/ParallelImageCapture.c #, c-format msgid "Invalid data_pins[%d]" msgstr "" -#: shared-bindings/digitalio/DigitalInOut.c -msgid "Invalid direction." -msgstr "" - -#: shared-module/audiocore/WaveFile.c -msgid "Invalid file" -msgstr "" - #: shared-module/audiocore/WaveFile.c msgid "Invalid format chunk size" msgstr "" @@ -1389,107 +1251,27 @@ msgstr "" msgid "Invalid memory access." msgstr "" -#: extmod/vfs_fat_file.c -msgid "Invalid mode" -msgstr "" - #: ports/espressif/common-hal/wifi/Radio.c msgid "Invalid multicast MAC address" msgstr "" -#: shared-bindings/bitbangio/SPI.c shared-bindings/busio/SPI.c -msgid "Invalid number of bits" -msgstr "" - -#: shared-bindings/bitbangio/SPI.c shared-bindings/busio/SPI.c -#: shared-bindings/displayio/FourWire.c -msgid "Invalid phase" -msgstr "" - -#: ports/atmel-samd/common-hal/audioio/AudioOut.c -#: ports/atmel-samd/common-hal/touchio/TouchIn.c -#: ports/espressif/common-hal/alarm/touch/TouchAlarm.c -#: ports/espressif/common-hal/touchio/TouchIn.c -#: ports/nrf/common-hal/alarm/pin/PinAlarm.c shared-bindings/pwmio/PWMOut.c -#: shared-module/rgbmatrix/RGBMatrix.c -msgid "Invalid pin" -msgstr "" - -#: ports/atmel-samd/common-hal/audioio/AudioOut.c -msgid "Invalid pin for left channel" -msgstr "" - -#: ports/atmel-samd/common-hal/audioio/AudioOut.c -msgid "Invalid pin for right channel" -msgstr "" - -#: ports/atmel-samd/common-hal/busio/I2C.c -#: ports/atmel-samd/common-hal/busio/SPI.c -#: ports/atmel-samd/common-hal/busio/UART.c -#: ports/atmel-samd/common-hal/i2cperipheral/I2CPeripheral.c -#: ports/cxd56/common-hal/busio/I2C.c ports/cxd56/common-hal/busio/SPI.c -#: ports/cxd56/common-hal/busio/UART.c ports/cxd56/common-hal/sdioio/SDCard.c -#: ports/espressif/common-hal/busio/I2C.c -#: ports/espressif/common-hal/busio/SPI.c -#: ports/espressif/common-hal/busio/UART.c -#: ports/espressif/common-hal/canio/CAN.c -#: ports/espressif/common-hal/i2cperipheral/I2CPeripheral.c -#: ports/mimxrt10xx/common-hal/busio/I2C.c -#: ports/mimxrt10xx/common-hal/busio/SPI.c -#: ports/mimxrt10xx/common-hal/usb_host/Port.c ports/nrf/common-hal/busio/I2C.c -#: ports/raspberrypi/common-hal/busio/I2C.c -#: ports/raspberrypi/common-hal/busio/SPI.c -#: ports/raspberrypi/common-hal/busio/UART.c shared-bindings/busio/SPI.c #: shared-bindings/busio/UART.c msgid "Invalid pins" msgstr "" -#: shared-bindings/bitbangio/SPI.c shared-bindings/busio/SPI.c -#: shared-bindings/displayio/FourWire.c -msgid "Invalid polarity" -msgstr "" - -#: shared-bindings/_bleio/Characteristic.c -msgid "Invalid properties" -msgstr "" - -#: shared-bindings/microcontroller/__init__.c -msgid "Invalid run mode." -msgstr "" - -#: shared-module/_bleio/Attribute.c -msgid "Invalid security_mode" -msgstr "" - -#: ports/espressif/bindings/espidf/__init__.c ports/espressif/esp_error.c +#: ports/espressif/common-hal/espidf/__init__.c ports/espressif/esp_error.c msgid "Invalid size" msgstr "" #: ports/espressif/common-hal/ssl/SSLContext.c +#: ports/raspberrypi/common-hal/ssl/SSLSocket.c msgid "Invalid socket for TLS" msgstr "" -#: ports/espressif/bindings/espidf/__init__.c ports/espressif/esp_error.c +#: ports/espressif/common-hal/espidf/__init__.c ports/espressif/esp_error.c msgid "Invalid state" msgstr "" -#: shared-bindings/audiomixer/Mixer.c -msgid "Invalid voice" -msgstr "" - -#: shared-bindings/audiomixer/Mixer.c -msgid "Invalid voice count" -msgstr "" - -#: shared-module/audiocore/WaveFile.c -msgid "Invalid wave file" -msgstr "" - -#: ports/mimxrt10xx/common-hal/busio/UART.c ports/nrf/common-hal/busio/UART.c -#: ports/raspberrypi/common-hal/busio/UART.c ports/stm/common-hal/busio/UART.c -msgid "Invalid word/bit length" -msgstr "" - #: shared-bindings/aesio/aes.c msgid "Key must be 16, 24, or 32 bytes long" msgstr "" @@ -1503,25 +1285,17 @@ msgid "LHS of keyword arg must be an id" msgstr "" #: shared-module/displayio/Group.c -msgid "Layer already in a group." +msgid "Layer already in a group" msgstr "" #: shared-module/displayio/Group.c -msgid "Layer must be a Group or TileGrid subclass." +msgid "Layer must be a Group or TileGrid subclass" msgstr "" -#: ports/espressif/bindings/espidf/__init__.c ports/espressif/esp_error.c +#: ports/espressif/common-hal/espidf/__init__.c ports/espressif/esp_error.c msgid "MAC address was invalid" msgstr "" -#: shared-module/bitbangio/SPI.c -msgid "MISO pin init failed." -msgstr "" - -#: shared-module/bitbangio/SPI.c -msgid "MOSI pin init failed." -msgstr "" - #: shared-bindings/is31fl3741/IS31FL3741.c msgid "Mapping must be a tuple" msgstr "" @@ -1531,10 +1305,6 @@ msgstr "" msgid "Maximum x value when mirrored is %d" msgstr "" -#: shared-bindings/canio/Message.c -msgid "Messages limited to 8 bytes" -msgstr "" - #: shared-bindings/audiobusio/PDMIn.c msgid "Microphone startup delay must be in range 0.0 to 1.0" msgstr "" @@ -1548,10 +1318,14 @@ msgstr "" msgid "Mismatched swap flag" msgstr "" -#: ports/mimxrt10xx/common-hal/busio/SPI.c ports/stm/common-hal/busio/SPI.c +#: ports/mimxrt10xx/common-hal/busio/SPI.c msgid "Missing MISO or MOSI Pin" msgstr "" +#: ports/stm/common-hal/busio/SPI.c +msgid "Missing MISO or MOSI pin" +msgstr "" + #: ports/raspberrypi/common-hal/rp2pio/StateMachine.c #, c-format msgid "Missing first_in_pin. Instruction %d reads pin(s)" @@ -1587,11 +1361,6 @@ msgstr "" msgid "Missing jmp_pin. Instruction %d jumps on pin" msgstr "" -#: shared-module/usb_hid/Device.c -#, c-format -msgid "More than %d report ids not supported" -msgstr "" - #: shared-bindings/busio/UART.c shared-bindings/displayio/Group.c msgid "Must be a %q subclass." msgstr "" @@ -1651,16 +1420,28 @@ msgstr "" msgid "No I2C device at address: 0x%x" msgstr "" -#: ports/espressif/common-hal/busio/SPI.c -#: ports/mimxrt10xx/common-hal/busio/SPI.c ports/stm/common-hal/busio/SPI.c -msgid "No MISO Pin" +#: supervisor/shared/web_workflow/web_workflow.c +msgid "No IP" msgstr "" #: ports/espressif/common-hal/busio/SPI.c -#: ports/mimxrt10xx/common-hal/busio/SPI.c ports/stm/common-hal/busio/SPI.c +#: ports/mimxrt10xx/common-hal/busio/SPI.c +msgid "No MISO Pin" +msgstr "" + +#: ports/stm/common-hal/busio/SPI.c shared-module/bitbangio/SPI.c +msgid "No MISO pin" +msgstr "" + +#: ports/espressif/common-hal/busio/SPI.c +#: ports/mimxrt10xx/common-hal/busio/SPI.c msgid "No MOSI Pin" msgstr "" +#: ports/stm/common-hal/busio/SPI.c shared-module/bitbangio/SPI.c +msgid "No MOSI pin" +msgstr "" + #: ports/atmel-samd/common-hal/busio/UART.c #: ports/espressif/common-hal/busio/UART.c #: ports/mimxrt10xx/common-hal/busio/UART.c ports/nrf/common-hal/busio/UART.c @@ -1699,16 +1480,6 @@ msgstr "" msgid "No hardware random available" msgstr "" -#: ports/atmel-samd/common-hal/ps2io/Ps2.c -msgid "No hardware support on clk pin" -msgstr "" - -#: ports/atmel-samd/common-hal/alarm/pin/PinAlarm.c -#: ports/atmel-samd/common-hal/frequencyio/FrequencyIn.c -#: ports/atmel-samd/common-hal/pulseio/PulseIn.c -msgid "No hardware support on pin" -msgstr "" - #: ports/raspberrypi/common-hal/rp2pio/StateMachine.c msgid "No in in program" msgstr "" @@ -1806,16 +1577,26 @@ msgstr "" msgid "Odd parity is not supported" msgstr "" +#: supervisor/shared/bluetooth/bluetooth.c +msgid "Off" +msgstr "" + +#: supervisor/shared/bluetooth/bluetooth.c +msgid "Ok" +msgstr "" + #: ports/atmel-samd/common-hal/audiobusio/PDMIn.c #: ports/raspberrypi/common-hal/audiobusio/PDMIn.c msgid "Only 8 or 16 bit mono with " msgstr "" #: ports/espressif/common-hal/wifi/__init__.c +#: ports/raspberrypi/common-hal/wifi/__init__.c msgid "Only IPv4 addresses supported" msgstr "" -#: ports/espressif/common-hal/socketpool/SocketPool.c +#: ports/espressif/common-hal/socketpool/Socket.c +#: ports/raspberrypi/common-hal/socketpool/Socket.c msgid "Only IPv4 sockets supported" msgstr "" @@ -1848,15 +1629,19 @@ msgstr "" msgid "Only one TouchAlarm can be set in deep sleep." msgstr "" -#: ports/espressif/common-hal/i2cperipheral/I2CPeripheral.c +#: ports/espressif/common-hal/i2ctarget/I2CTarget.c +#: ports/raspberrypi/common-hal/i2ctarget/I2CTarget.c msgid "Only one address is allowed" msgstr "" #: ports/atmel-samd/common-hal/alarm/time/TimeAlarm.c -#: ports/espressif/common-hal/alarm/time/TimeAlarm.c #: ports/nrf/common-hal/alarm/time/TimeAlarm.c -#: ports/raspberrypi/common-hal/alarm/time/TimeAlarm.c #: ports/stm/common-hal/alarm/time/TimeAlarm.c +msgid "Only one alarm.time alarm can be set" +msgstr "" + +#: ports/espressif/common-hal/alarm/time/TimeAlarm.c +#: ports/raspberrypi/common-hal/alarm/time/TimeAlarm.c msgid "Only one alarm.time alarm can be set." msgstr "" @@ -1868,19 +1653,20 @@ msgstr "" msgid "Operation not permitted" msgstr "" -#: ports/espressif/bindings/espidf/__init__.c ports/espressif/esp_error.c +#: ports/espressif/common-hal/espidf/__init__.c ports/espressif/esp_error.c msgid "Operation or feature not supported" msgstr "" -#: ports/espressif/bindings/espidf/__init__.c ports/espressif/esp_error.c +#: ports/espressif/common-hal/espidf/__init__.c ports/espressif/esp_error.c msgid "Operation timed out" msgstr "" -#: ports/espressif/bindings/espidf/__init__.c ports/espressif/esp_error.c +#: ports/espressif/common-hal/espidf/__init__.c ports/espressif/esp_error.c msgid "Out of memory" msgstr "" -#: ports/espressif/common-hal/socketpool/SocketPool.c +#: ports/espressif/common-hal/socketpool/Socket.c +#: ports/raspberrypi/common-hal/socketpool/Socket.c msgid "Out of sockets" msgstr "" @@ -1888,11 +1674,6 @@ msgstr "" msgid "Out-buffer elements must be <= 4 bytes long" msgstr "" -#: shared-bindings/bitops/__init__.c -#, c-format -msgid "Output buffer must be at least %d bytes" -msgstr "" - #: shared-bindings/audiobusio/PDMIn.c msgid "Oversample must be multiple of 8." msgstr "" @@ -1903,12 +1684,11 @@ msgstr "" #: shared-bindings/pwmio/PWMOut.c msgid "" -"PWM duty_cycle must be between 0 and 65535 inclusive (16 bit resolution)" +"PWM frequency not writable when variable_frequency is False on construction." msgstr "" -#: shared-bindings/pwmio/PWMOut.c -msgid "" -"PWM frequency not writable when variable_frequency is False on construction." +#: ports/stm/common-hal/pwmio/PWMOut.c +msgid "PWM restart" msgstr "" #: ports/raspberrypi/common-hal/countio/Counter.c @@ -1927,36 +1707,20 @@ msgstr "" msgid "Permission denied" msgstr "" -#: ports/atmel-samd/common-hal/alarm/pin/PinAlarm.c #: ports/stm/common-hal/alarm/pin/PinAlarm.c msgid "Pin cannot wake from Deep Sleep" msgstr "" -#: ports/raspberrypi/bindings/rp2pio/StateMachine.c -msgid "Pin count must be at least 1" -msgstr "" - #: ports/raspberrypi/common-hal/rp2pio/StateMachine.c msgid "Pin count too large" msgstr "" -#: ports/atmel-samd/common-hal/analogio/AnalogIn.c -#: ports/cxd56/common-hal/analogio/AnalogIn.c -#: ports/espressif/common-hal/analogio/AnalogIn.c -#: ports/mimxrt10xx/common-hal/analogio/AnalogIn.c -#: ports/nrf/common-hal/analogio/AnalogIn.c -#: ports/raspberrypi/common-hal/analogio/AnalogIn.c -#: ports/stm/common-hal/analogio/AnalogIn.c -msgid "Pin does not have ADC capabilities" -msgstr "" - #: ports/stm/common-hal/alarm/pin/PinAlarm.c #: ports/stm/common-hal/pulseio/PulseIn.c msgid "Pin interrupt already in use" msgstr "" #: shared-bindings/adafruit_bus_device/spi_device/SPIDevice.c -#: shared-bindings/digitalio/DigitalInOut.c msgid "Pin is input only" msgstr "" @@ -2003,10 +1767,12 @@ msgstr "" #: main.c msgid "Press any key to enter the REPL. Use CTRL-D to reload.\n" msgstr "" +"Πατήστε οποιοδήποτε πλήκτρο για να μπείτε στο REPL. Πατήστε CTRL-D για " +"επαναφόρτωση.\n" #: main.c msgid "Pretending to deep sleep until alarm, CTRL-C or file write.\n" -msgstr "" +msgstr "Προσποίηση βαθύ ύπνου μεχρι γεγονότος, CTRL-C ή εγγραφή αρχείου.\n" #: ports/raspberrypi/common-hal/rp2pio/StateMachine.c msgid "Program does IN without loading ISR" @@ -2016,18 +1782,10 @@ msgstr "" msgid "Program does OUT without loading OSR" msgstr "" -#: ports/raspberrypi/bindings/rp2pio/StateMachine.c -msgid "Program must contain at least one 16-bit instruction." -msgstr "" - #: ports/raspberrypi/bindings/rp2pio/StateMachine.c msgid "Program size invalid" msgstr "" -#: ports/raspberrypi/bindings/rp2pio/StateMachine.c -msgid "Program too large" -msgstr "" - #: shared-bindings/digitalio/DigitalInOut.c msgid "Pull not used when direction is output." msgstr "" @@ -2049,8 +1807,9 @@ msgstr "" msgid "RNG Init Error" msgstr "" -#: ports/nrf/common-hal/busio/UART.c -msgid "RS485 Not yet supported on this device" +#: ports/atmel-samd/common-hal/busio/UART.c ports/cxd56/common-hal/busio/UART.c +#: ports/nrf/common-hal/busio/UART.c ports/stm/common-hal/busio/UART.c +msgid "RS485" msgstr "" #: ports/espressif/common-hal/busio/UART.c @@ -2058,21 +1817,10 @@ msgstr "" msgid "RS485 inversion specified when not in RS485 mode" msgstr "" -#: ports/cxd56/common-hal/rtc/RTC.c ports/espressif/common-hal/rtc/RTC.c -#: ports/mimxrt10xx/common-hal/rtc/RTC.c ports/nrf/common-hal/rtc/RTC.c -#: ports/raspberrypi/common-hal/rtc/RTC.c -msgid "RTC calibration is not supported on this board" -msgstr "" - #: shared-bindings/alarm/time/TimeAlarm.c shared-bindings/time/__init__.c msgid "RTC is not supported on this board" msgstr "" -#: ports/atmel-samd/common-hal/busio/UART.c ports/cxd56/common-hal/busio/UART.c -#: ports/stm/common-hal/busio/UART.c -msgid "RTS/CTS/RS485 Not yet supported on this device" -msgstr "" - #: ports/stm/common-hal/os/__init__.c msgid "Random number generation error" msgstr "" @@ -2090,10 +1838,14 @@ msgstr "" msgid "Read-only object" msgstr "" -#: ports/espressif/bindings/espidf/__init__.c ports/espressif/esp_error.c +#: ports/espressif/common-hal/espidf/__init__.c ports/espressif/esp_error.c msgid "Received response was invalid" msgstr "" +#: supervisor/shared/bluetooth/bluetooth.c +msgid "Reconnecting" +msgstr "" + #: shared-bindings/displayio/EPaperDisplay.c msgid "Refresh too soon" msgstr "" @@ -2106,7 +1858,7 @@ msgstr "" msgid "Requested AES mode is unsupported" msgstr "" -#: ports/espressif/bindings/espidf/__init__.c ports/espressif/esp_error.c +#: ports/espressif/common-hal/espidf/__init__.c ports/espressif/esp_error.c msgid "Requested resource not found" msgstr "" @@ -2122,6 +1874,10 @@ msgstr "" msgid "SD card CSD format not supported" msgstr "" +#: ports/cxd56/common-hal/sdioio/SDCard.c +msgid "SDCard init" +msgstr "" + #: ports/stm/common-hal/sdioio/SDCard.c #, c-format msgid "SDIO GetCardInfo Error %d" @@ -2132,29 +1888,20 @@ msgstr "" msgid "SDIO Init Error %d" msgstr "" -#: ports/stm/common-hal/busio/SPI.c -msgid "SPI Init Error" -msgstr "" - -#: ports/stm/common-hal/busio/SPI.c -msgid "SPI Re-initialization error" -msgstr "" - #: ports/espressif/common-hal/busio/SPI.c msgid "SPI configuration failed" msgstr "" +#: ports/stm/common-hal/busio/SPI.c +msgid "SPI init error" +msgstr "" + #: ports/raspberrypi/common-hal/busio/SPI.c msgid "SPI peripheral in use" msgstr "" -#: shared-bindings/audiomixer/Mixer.c -msgid "Sample rate must be positive" -msgstr "" - -#: ports/atmel-samd/common-hal/audioio/AudioOut.c -#, c-format -msgid "Sample rate too high. It must be less than %d" +#: ports/stm/common-hal/busio/SPI.c +msgid "SPI re-init" msgstr "" #: shared-bindings/is31fl3741/FrameBuffer.c @@ -2175,14 +1922,6 @@ msgstr "" msgid "Server side context cannot have hostname" msgstr "" -#: ports/raspberrypi/bindings/rp2pio/StateMachine.c -msgid "Set pin count must be between 1 and 5" -msgstr "" - -#: ports/raspberrypi/bindings/rp2pio/StateMachine.c -msgid "Side set pin count must be between 1 and 5" -msgstr "" - #: ports/cxd56/common-hal/camera/Camera.c msgid "Size not supported" msgstr "" @@ -2203,6 +1942,7 @@ msgid "Slices not supported" msgstr "" #: ports/espressif/common-hal/socketpool/SocketPool.c +#: ports/raspberrypi/common-hal/socketpool/SocketPool.c msgid "SocketPool can only be used with wifi.radio" msgstr "" @@ -2218,10 +1958,6 @@ msgstr "" msgid "Splitting with sub-captures" msgstr "" -#: shared-bindings/supervisor/__init__.c -msgid "Stack size must be at least 256" -msgstr "" - #: ports/raspberrypi/common-hal/audiopwmio/PWMAudioOut.c msgid "Stereo left must be on PWM channel A" msgstr "" @@ -2230,10 +1966,6 @@ msgstr "" msgid "Stereo right must be on PWM channel B" msgstr "" -#: shared-bindings/multiterminal/__init__.c -msgid "Stream missing readinto() or write() method." -msgstr "" - #: ports/mimxrt10xx/common-hal/busio/UART.c ports/stm/common-hal/busio/UART.c msgid "Supply at least one UART pin" msgstr "" @@ -2307,10 +2039,6 @@ msgstr "" msgid "Tile index out of bounds" msgstr "" -#: shared-bindings/displayio/TileGrid.c -msgid "Tile value out of bounds" -msgstr "" - #: shared-bindings/displayio/TileGrid.c msgid "Tile width must exactly divide bitmap width" msgstr "" @@ -2330,6 +2058,9 @@ msgid "To exit, please reset the board without " msgstr "" #: ports/atmel-samd/common-hal/audiobusio/I2SOut.c +msgid "Too many channels in sample" +msgstr "" + #: ports/raspberrypi/common-hal/audiobusio/I2SOut.c msgid "Too many channels in sample." msgstr "" @@ -2362,23 +2093,24 @@ msgid "Tuple or struct_time argument required" msgstr "" #: ports/stm/common-hal/busio/UART.c -msgid "UART Buffer allocation error" +msgid "UART de-init" +msgstr "" + +#: ports/atmel-samd/common-hal/busio/UART.c ports/cxd56/common-hal/busio/UART.c +#: ports/espressif/common-hal/busio/UART.c ports/stm/common-hal/busio/UART.c +msgid "UART init" msgstr "" #: ports/stm/common-hal/busio/UART.c -msgid "UART De-init error" +msgid "UART re-init" msgstr "" #: ports/stm/common-hal/busio/UART.c -msgid "UART Init Error" +msgid "UART write" msgstr "" -#: ports/stm/common-hal/busio/UART.c -msgid "UART Re-init error" -msgstr "" - -#: ports/stm/common-hal/busio/UART.c -msgid "UART write error" +#: main.c +msgid "UID:" msgstr "" #: shared-module/usb_hid/Device.c @@ -2504,6 +2236,11 @@ msgstr "" msgid "Unknown system firmware error: %d" msgstr "" +#: ports/raspberrypi/common-hal/wifi/__init__.c +#, c-format +msgid "Unkown error code %d" +msgstr "" + #: shared-bindings/adafruit_pixelbuf/PixelBuf.c #, c-format msgid "Unmatched number of items on RHS (expected %d, got %d)." @@ -2515,12 +2252,6 @@ msgid "" "declined or ignored." msgstr "" -#: ports/atmel-samd/common-hal/busio/I2C.c ports/cxd56/common-hal/busio/I2C.c -#: ports/espressif/common-hal/busio/UART.c -#: ports/raspberrypi/common-hal/busio/I2C.c ports/stm/common-hal/busio/I2C.c -msgid "Unsupported baudrate" -msgstr "" - #: shared-bindings/bitmaptools/__init__.c msgid "Unsupported colorspace" msgstr "" @@ -2533,6 +2264,10 @@ msgstr "" msgid "Unsupported format" msgstr "" +#: shared-bindings/hashlib/__init__.c +msgid "Unsupported hash algorithm" +msgstr "" + #: ports/espressif/common-hal/dualbank/__init__.c msgid "Update Failed" msgstr "" @@ -2551,7 +2286,7 @@ msgstr "" msgid "Value length > max_length" msgstr "" -#: ports/espressif/bindings/espidf/__init__.c ports/espressif/esp_error.c +#: ports/espressif/common-hal/espidf/__init__.c ports/espressif/esp_error.c msgid "Version was invalid" msgstr "" @@ -2581,10 +2316,6 @@ msgstr "" msgid "WatchDogTimer.timeout must be greater than 0" msgstr "" -#: supervisor/shared/safe_mode.c -msgid "Watchdog timer expired." -msgstr "" - #: py/builtinhelp.c #, c-format msgid "" @@ -2595,8 +2326,8 @@ msgid "" "To list built-in modules type `help(\"modules\")`.\n" msgstr "" -#: shared-bindings/wifi/Radio.c -msgid "WiFi password must be between 8 and 63 characters" +#: supervisor/shared/web_workflow/web_workflow.c +msgid "Wi-Fi: " msgstr "" #: main.c @@ -2637,11 +2368,7 @@ msgstr "" msgid "a bytes-like object is required" msgstr "" -#: shared-bindings/i2cperipheral/I2CPeripheral.c -msgid "address out of bounds" -msgstr "" - -#: shared-bindings/i2cperipheral/I2CPeripheral.c +#: shared-bindings/i2ctarget/I2CTarget.c msgid "addresses is empty" msgstr "" @@ -2690,6 +2417,10 @@ msgstr "" msgid "array and index length must be equal" msgstr "" +#: extmod/ulab/code/numpy/io/io.c +msgid "array has too many dimensions" +msgstr "" + #: py/objarray.c shared-bindings/alarm/SleepMemory.c #: shared-bindings/nvm/ByteArray.c msgid "array/bytes required on right side" @@ -2751,10 +2482,6 @@ msgstr "" msgid "bits must be 32 or less" msgstr "" -#: shared-bindings/busio/UART.c -msgid "bits must be in range 5 to 9" -msgstr "" - #: shared-bindings/audiomixer/Mixer.c msgid "bits_per_sample must be 8 or 16" msgstr "" @@ -2792,11 +2519,6 @@ msgstr "" msgid "byteorder is not a string" msgstr "" -#: ports/atmel-samd/common-hal/busio/UART.c -#: ports/espressif/common-hal/busio/UART.c -msgid "bytes > 8 bits not supported" -msgstr "" - #: py/objarray.c msgid "bytes length not a multiple of item size" msgstr "" @@ -2805,7 +2527,7 @@ msgstr "" msgid "bytes value out of range" msgstr "" -#: ports/atmel-samd/bindings/samd/Clock.c ports/atmel-samd/common-hal/rtc/RTC.c +#: ports/atmel-samd/bindings/samd/Clock.c msgid "calibration is out of range" msgstr "" @@ -2813,12 +2535,9 @@ msgstr "" msgid "calibration is read only" msgstr "" -#: ports/atmel-samd/common-hal/rtc/RTC.c -msgid "calibration value out of range +/-127" -msgstr "" - +#: shared-module/vectorio/Circle.c shared-module/vectorio/Polygon.c #: shared-module/vectorio/Rectangle.c -msgid "can only be registered in one parent" +msgid "can only have one parent" msgstr "" #: py/emitinlinethumb.c @@ -2841,8 +2560,7 @@ msgstr "" msgid "can't cancel self" msgstr "" -#: py/obj.c py/objint.c shared-bindings/i2cperipheral/I2CPeripheral.c -#: shared-module/adafruit_pixelbuf/PixelBuf.c +#: py/obj.c py/objint.c shared-module/adafruit_pixelbuf/PixelBuf.c msgid "can't convert %q to %q" msgstr "" @@ -2989,6 +2707,10 @@ msgstr "" msgid "casting" msgstr "" +#: ports/stm/common-hal/pwmio/PWMOut.c +msgid "channel re-init" +msgstr "" + #: shared-bindings/_stage/Text.c msgid "chars buffer too small" msgstr "" @@ -3001,10 +2723,6 @@ msgstr "" msgid "chr() arg not in range(256)" msgstr "" -#: shared-module/vectorio/Circle.c -msgid "circle can only be registered in one parent" -msgstr "" - #: shared-bindings/bitmaptools/__init__.c msgid "clip point must be (x,y) tuple" msgstr "" @@ -3029,10 +2747,6 @@ msgstr "" msgid "color must be between 0x000000 and 0xffffff" msgstr "" -#: shared-bindings/displayio/ColorConverter.c -msgid "color should be an int" -msgstr "" - #: py/emitnative.c msgid "comparison of int and uint" msgstr "" @@ -3069,6 +2783,10 @@ msgstr "" msgid "convolve arguments must not be empty" msgstr "" +#: extmod/ulab/code/numpy/io/io.c +msgid "corrupted file" +msgstr "" + #: extmod/ulab/code/numpy/poly.c msgid "could not invert Vandermonde matrix" msgstr "" @@ -3119,10 +2837,6 @@ msgstr "" msgid "destination buffer must be an array of type 'H' for bit_depth = 16" msgstr "" -#: shared-bindings/audiobusio/PDMIn.c -msgid "destination_length must be an int >= 0" -msgstr "" - #: py/objdict.c msgid "dict update sequence has wrong length" msgstr "" @@ -3160,6 +2874,10 @@ msgstr "" msgid "empty" msgstr "" +#: extmod/ulab/code/numpy/io/io.c +msgid "empty file" +msgstr "" + #: extmod/moduasyncio.c extmod/moduheapq.c extmod/modutimeq.c msgid "empty heap" msgstr "" @@ -3176,10 +2894,6 @@ msgstr "" msgid "end of format while looking for conversion specifier" msgstr "" -#: shared-bindings/displayio/Shape.c -msgid "end_x should be an int" -msgstr "" - #: shared-bindings/alarm/time/TimeAlarm.c msgid "epoch_time not supported on this board" msgstr "" @@ -3189,6 +2903,12 @@ msgstr "" msgid "error = 0x%08lX" msgstr "" +#: ports/espressif/common-hal/esp32_camera/Camera.c +msgid "" +"esp32_camera.Camera requires reserved PSRAM to be configured. See the " +"documentation for instructions." +msgstr "" + #: py/runtime.c msgid "exceptions must derive from BaseException" msgstr "" @@ -3263,7 +2983,7 @@ msgstr "" msgid "first argument must be a tuple of ndarrays" msgstr "" -#: extmod/ulab/code/numpy/vector.c +#: extmod/ulab/code/numpy/transform.c extmod/ulab/code/numpy/vector.c msgid "first argument must be an ndarray" msgstr "" @@ -3411,7 +3131,7 @@ msgstr "" msgid "incorrect padding" msgstr "" -#: extmod/ulab/code/ndarray.c +#: extmod/ulab/code/ndarray.c extmod/ulab/code/numpy/transform.c msgid "index is out of bounds" msgstr "" @@ -3429,6 +3149,10 @@ msgstr "" msgid "indices must be integers, slices, or Boolean lists" msgstr "" +#: ports/espressif/common-hal/busio/I2C.c +msgid "init I2C" +msgstr "" + #: extmod/ulab/code/scipy/optimize/optimize.c msgid "initial values must be iterable" msgstr "" @@ -3474,6 +3198,10 @@ msgstr "" msgid "input matrix is singular" msgstr "" +#: extmod/ulab/code/numpy/create.c +msgid "input must be 1- or 2-d" +msgstr "" + #: extmod/ulab/code/numpy/carray/carray.c msgid "input must be a 1D ndarray" msgstr "" @@ -3482,11 +3210,7 @@ msgstr "" msgid "input must be a dense ndarray" msgstr "" -#: extmod/ulab/code/numpy/create.c -msgid "input must be a tensor of rank 2" -msgstr "" - -#: extmod/ulab/code/numpy/create.c extmod/ulab/code/user/user.c +#: extmod/ulab/code/user/user.c msgid "input must be an ndarray" msgstr "" @@ -3536,6 +3260,10 @@ msgstr "" msgid "invalid bits_per_pixel %d, must be, 1, 2, 4, 8, 16, 24, or 32" msgstr "" +#: ports/raspberrypi/common-hal/ssl/SSLSocket.c +msgid "invalid cert" +msgstr "" + #: shared-bindings/bitmaptools/__init__.c #, c-format msgid "invalid element size %d for bits_per_pixel %d\n" @@ -3562,10 +3290,18 @@ msgstr "" msgid "invalid hostname" msgstr "" +#: ports/raspberrypi/common-hal/ssl/SSLSocket.c +msgid "invalid key" +msgstr "" + #: py/compile.c msgid "invalid micropython decorator" msgstr "" +#: ports/espressif/common-hal/esp32_camera/Camera.c +msgid "invalid setting" +msgstr "" + #: shared-bindings/random/__init__.c msgid "invalid step" msgstr "" @@ -3679,10 +3415,6 @@ msgstr "" msgid "matrix is not positive definite" msgstr "" -#: ports/espressif/common-hal/wifi/Radio.c -msgid "max_connections must be between 0 and 10" -msgstr "" - #: ports/espressif/common-hal/_bleio/Descriptor.c #: ports/nrf/common-hal/_bleio/Characteristic.c #: ports/nrf/common-hal/_bleio/Descriptor.c @@ -3690,12 +3422,8 @@ msgstr "" msgid "max_length must be 0-%d when fixed_length is %s" msgstr "" -#: shared-bindings/_bleio/Characteristic.c shared-bindings/_bleio/Descriptor.c -msgid "max_length must be >= 0" -msgstr "" - #: extmod/ulab/code/ndarray.c -msgid "maximum number of dimensions is 4" +msgid "maximum number of dimensions is " msgstr "" #: py/runtime.c @@ -3829,7 +3557,7 @@ msgstr "" msgid "no response from SD card" msgstr "" -#: py/objobject.c py/runtime.c +#: ports/espressif/common-hal/esp32_camera/Camera.c py/objobject.c py/runtime.c msgid "no such attribute" msgstr "" @@ -3940,7 +3668,11 @@ msgstr "" msgid "odd-length string" msgstr "" -#: extmod/ulab/code/numpy/create.c extmod/ulab/code/utils/utils.c +#: supervisor/shared/web_workflow/web_workflow.c +msgid "off" +msgstr "" + +#: extmod/ulab/code/utils/utils.c msgid "offset is too large" msgstr "" @@ -4036,10 +3768,6 @@ msgstr "" msgid "palette must be 32 bytes long" msgstr "" -#: shared-bindings/displayio/Palette.c -msgid "palette_index should be an int" -msgstr "" - #: py/emitinlinextensa.c msgid "parameters must be registers in sequence a2 to a5" msgstr "" @@ -4064,10 +3792,6 @@ msgstr "" msgid "poll on file not available on win32" msgstr "" -#: shared-module/vectorio/Polygon.c -msgid "polygon can only be registered in one parent" -msgstr "" - #: ports/espressif/common-hal/pulseio/PulseIn.c msgid "pop from an empty PulseIn" msgstr "" @@ -4093,7 +3817,23 @@ msgstr "" msgid "pow() with 3 arguments requires integers" msgstr "" +#: ports/espressif/boards/adafruit_qtpy_esp32_pico/mpconfigboard.h +msgid "pressing BOOT button at start up.\n" +msgstr "" + +#: ports/espressif/boards/adafruit_feather_esp32_v2/mpconfigboard.h +msgid "pressing SW38 button at start up.\n" +msgstr "" + +#: ports/espressif/boards/hardkernel_odroid_go/mpconfigboard.h +msgid "pressing VOLUME button at start up.\n" +msgstr "" + #: ports/espressif/boards/adafruit_qtpy_esp32c3/mpconfigboard.h +#: ports/espressif/boards/beetle-esp32-c3/mpconfigboard.h +#: ports/espressif/boards/espressif_esp32s2_devkitc_1_n8r2/mpconfigboard.h +#: ports/espressif/boards/lolin_c3_mini/mpconfigboard.h +#: ports/espressif/boards/microdev_micro_c3/mpconfigboard.h #: supervisor/shared/safe_mode.c msgid "pressing boot button at start up.\n" msgstr "" @@ -4114,14 +3854,6 @@ msgstr "" msgid "pull masks conflict with direction masks" msgstr "" -#: ports/raspberrypi/bindings/rp2pio/StateMachine.c -msgid "pull_threshold must be between 1 and 32" -msgstr "" - -#: ports/raspberrypi/bindings/rp2pio/StateMachine.c -msgid "push_threshold must be between 1 and 32" -msgstr "" - #: extmod/modutimeq.c msgid "queue overflow" msgstr "" @@ -4173,12 +3905,6 @@ msgstr "" msgid "rsplit(None,n)" msgstr "" -#: shared-bindings/audiocore/RawSample.c -msgid "" -"sample_source buffer must be a bytearray or array of type 'h', 'H', 'b' or " -"'B'" -msgstr "" - #: ports/atmel-samd/common-hal/audiobusio/PDMIn.c #: ports/raspberrypi/common-hal/audiobusio/PDMIn.c msgid "sampling rate out of range" @@ -4276,26 +4002,14 @@ msgstr "" msgid "source_bitmap must have value_count of 8" msgstr "" -#: shared-bindings/wifi/Radio.c -msgid "ssid can't be more than 32 bytes" -msgstr "" - #: py/objstr.c msgid "start/end indices" msgstr "" -#: shared-bindings/displayio/Shape.c -msgid "start_x should be an int" -msgstr "" - #: shared-bindings/random/__init__.c msgid "step must be non-zero" msgstr "" -#: shared-bindings/busio/UART.c -msgid "stop must be 1 or 2" -msgstr "" - #: shared-bindings/random/__init__.c msgid "stop not reachable from start" msgstr "" @@ -4344,10 +4058,6 @@ msgstr "" msgid "threshold must be in the range 0-65536" msgstr "" -#: shared-bindings/rgbmatrix/RGBMatrix.c -msgid "tile must be greater than zero" -msgstr "" - #: shared-bindings/time/__init__.c msgid "time.struct_time() takes a 9-sequence" msgstr "" @@ -4367,10 +4077,6 @@ msgstr "" msgid "timeout must be < 655.35 secs" msgstr "" -#: shared-bindings/_bleio/CharacteristicBuffer.c -msgid "timeout must be >= 0.0" -msgstr "" - #: shared-module/sdcardio/SDCard.c msgid "timeout waiting for v1 card" msgstr "" @@ -4379,6 +4085,10 @@ msgstr "" msgid "timeout waiting for v2 card" msgstr "" +#: ports/stm/common-hal/pwmio/PWMOut.c +msgid "timer re-init" +msgstr "" + #: shared-bindings/time/__init__.c msgid "timestamp out of range for platform time_t" msgstr "" @@ -4444,14 +4154,10 @@ msgstr "" msgid "type is not an acceptable base type" msgstr "" -#: py/runtime.c +#: py/objgenerator.c py/runtime.c msgid "type object '%q' has no attribute '%q'" msgstr "" -#: py/objgenerator.c -msgid "type object 'generator' has no attribute '__await__'" -msgstr "" - #: py/objtype.c msgid "type takes 1 or 3 arguments" msgstr "" @@ -4510,7 +4216,6 @@ msgid "unreadable attribute" msgstr "" #: shared-bindings/displayio/TileGrid.c shared-bindings/vectorio/VectorShape.c -#: shared-module/vectorio/Polygon.c shared-module/vectorio/VectorShape.c msgid "unsupported %q type" msgstr "" @@ -4549,6 +4254,14 @@ msgstr "" msgid "unsupported types for %q: '%q', '%q'" msgstr "" +#: extmod/ulab/code/numpy/io/io.c +msgid "usecols is too high" +msgstr "" + +#: extmod/ulab/code/numpy/io/io.c +msgid "usecols keyword must be specified" +msgstr "" + #: py/objint.c #, c-format msgid "value must fit in %d byte(s)" @@ -4570,20 +4283,19 @@ msgstr "" msgid "watchdog timeout must be greater than 0" msgstr "" -#: shared-bindings/bitops/__init__.c -#, c-format -msgid "width must be from 2 to 8 (inclusive), not %d" -msgstr "" - #: shared-bindings/is31fl3741/FrameBuffer.c -#: shared-bindings/rgbmatrix/RGBMatrix.c msgid "width must be greater than zero" msgstr "" #: ports/espressif/common-hal/wifi/Radio.c +#: ports/raspberrypi/common-hal/wifi/Radio.c msgid "wifi is not enabled" msgstr "" +#: ports/raspberrypi/common-hal/wifi/Monitor.c +msgid "wifi.Monitor not available" +msgstr "" + #: shared-bindings/_bleio/Adapter.c msgid "window must be <= interval" msgstr "" @@ -4596,7 +4308,17 @@ msgstr "" msgid "wrong axis specified" msgstr "" -#: extmod/ulab/code/numpy/compare.c extmod/ulab/code/numpy/vector.c +#: extmod/ulab/code/numpy/io/io.c +msgid "wrong dtype" +msgstr "" + +#: extmod/ulab/code/numpy/transform.c +msgid "wrong index type" +msgstr "" + +#: extmod/ulab/code/numpy/compare.c extmod/ulab/code/numpy/create.c +#: extmod/ulab/code/numpy/io/io.c extmod/ulab/code/numpy/transform.c +#: extmod/ulab/code/numpy/vector.c msgid "wrong input type" msgstr "" @@ -4604,6 +4326,10 @@ msgstr "" msgid "wrong length of condition array" msgstr "" +#: extmod/ulab/code/numpy/transform.c +msgid "wrong length of index array" +msgstr "" + #: extmod/ulab/code/numpy/create.c py/objarray.c py/objstr.c msgid "wrong number of arguments" msgstr "" @@ -4624,10 +4350,6 @@ msgstr "" msgid "xTaskCreate failed" msgstr "" -#: shared-bindings/displayio/Shape.c -msgid "y should be an int" -msgstr "" - #: shared-module/displayio/Shape.c msgid "y value out of bounds" msgstr "" @@ -4647,3 +4369,9 @@ msgstr "" #: extmod/ulab/code/scipy/signal/signal.c msgid "zi must be of shape (n_section, 2)" msgstr "" + +#~ msgid "%q must be >= 0" +#~ msgstr "%q πρέπει να είναι >= 0" + +#~ msgid "%q must be >= 1" +#~ msgstr "%q πρέπει να είναι >= 1" diff --git a/locale/en_GB.po b/locale/en_GB.po index 399fbfd5e7..da587c2653 100644 --- a/locale/en_GB.po +++ b/locale/en_GB.po @@ -7,15 +7,15 @@ msgid "" msgstr "" "Project-Id-Version: PACKAGE VERSION\n" "Report-Msgid-Bugs-To: \n" -"PO-Revision-Date: 2021-09-21 03:37+0000\n" -"Last-Translator: James Carr \n" +"PO-Revision-Date: 2022-05-22 00:18+0000\n" +"Last-Translator: Dan Halbert \n" "Language-Team: none\n" "Language: en_GB\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.9-dev\n" +"X-Generator: Weblate 4.13-dev\n" #: main.c msgid "" @@ -26,10 +26,13 @@ msgstr "" "Code done running.\n" #: main.c +#, fuzzy msgid "" "\n" "Code stopped by auto-reload. Reloading soon.\n" msgstr "" +"\n" +"Code stopped by auto-reload. Reloading soon.\n" #: supervisor/shared/safe_mode.c msgid "" @@ -66,6 +69,11 @@ msgstr " output:\n" msgid "%%c requires int or char" msgstr "%%c requires int or char" +#: main.c +#, c-format +msgid "%02X" +msgstr "" + #: shared-bindings/rgbmatrix/RGBMatrix.c #, c-format msgid "" @@ -73,10 +81,27 @@ msgid "" msgstr "" "%d address pins, %d rgb pins and %d tiles indicate a height of %d, not %d" +#: ports/atmel-samd/common-hal/alarm/__init__.c +#: ports/cxd56/common-hal/analogio/AnalogOut.c ports/cxd56/common-hal/rtc/RTC.c +#: ports/espressif/common-hal/rtc/RTC.c +#: ports/mimxrt10xx/common-hal/analogio/AnalogOut.c +#: ports/mimxrt10xx/common-hal/rtc/RTC.c ports/nrf/common-hal/alarm/__init__.c +#: ports/nrf/common-hal/analogio/AnalogOut.c ports/nrf/common-hal/rtc/RTC.c +#: ports/raspberrypi/common-hal/alarm/__init__.c +#: ports/raspberrypi/common-hal/analogio/AnalogOut.c +#: ports/raspberrypi/common-hal/rtc/RTC.c ports/stm/common-hal/alarm/__init__.c +#: ports/stm/common-hal/rtc/RTC.c +msgid "%q" +msgstr "" + #: shared-bindings/microcontroller/Pin.c msgid "%q and %q contain duplicate pins" msgstr "%q and %q contain duplicate pins" +#: ports/atmel-samd/common-hal/audioio/AudioOut.c +msgid "%q and %q must be different" +msgstr "" + #: shared-bindings/microcontroller/Pin.c msgid "%q contains duplicate pins" msgstr "%q contains duplicate pins" @@ -85,16 +110,12 @@ msgstr "%q contains duplicate pins" msgid "%q failure: %d" msgstr "%q failure: %d" +#: shared-bindings/digitalio/DigitalInOut.c #: shared-bindings/microcontroller/Pin.c msgid "%q in use" msgstr "%q in use" -#: ports/atmel-samd/common-hal/pulseio/PulseIn.c -#: ports/cxd56/common-hal/pulseio/PulseIn.c -#: ports/nrf/common-hal/pulseio/PulseIn.c -#: ports/raspberrypi/common-hal/pulseio/PulseIn.c -#: ports/stm/common-hal/pulseio/PulseIn.c py/obj.c py/objstr.c -#: py/objstrunicode.c +#: py/obj.c py/objstr.c py/objstrunicode.c msgid "%q index out of range" msgstr "%q index out of range" @@ -102,14 +123,34 @@ msgstr "%q index out of range" msgid "%q indices must be integers, not %s" msgstr "%q indices must be integers, not %s" +#: shared-module/bitbangio/SPI.c +msgid "%q init failed" +msgstr "" + +#: py/argcheck.c +msgid "%q length must be %d" +msgstr "" + #: py/argcheck.c msgid "%q length must be %d-%d" msgstr "%q length must be %d-%d" -#: shared-bindings/busio/I2C.c shared-bindings/usb_hid/Device.c +#: py/argcheck.c +msgid "%q length must be <= %d" +msgstr "" + +#: py/argcheck.c +msgid "%q length must be >= %d" +msgstr "" + +#: shared-bindings/busio/I2C.c msgid "%q length must be >= 1" msgstr "%q length must be >= 1" +#: py/argcheck.c +msgid "%q must be %d" +msgstr "" + #: py/argcheck.c msgid "%q must be %d-%d" msgstr "%q must be %d-%d" @@ -126,30 +167,18 @@ msgstr "" msgid "%q must be >= %d" msgstr "%q must be >= %d" -#: py/argcheck.c shared-bindings/memorymonitor/AllocationAlarm.c -msgid "%q must be >= 0" -msgstr "%q must be >= 0" - -#: shared-bindings/_bleio/CharacteristicBuffer.c -#: shared-bindings/_bleio/PacketBuffer.c shared-bindings/displayio/Group.c -#: shared-bindings/displayio/Shape.c -#: shared-bindings/memorymonitor/AllocationAlarm.c -#: shared-bindings/vectorio/Circle.c shared-bindings/vectorio/Rectangle.c -msgid "%q must be >= 1" -msgstr "%q must be >= 1" +#: shared-bindings/analogbufio/BufferedIn.c +#: shared-bindings/audiocore/RawSample.c +msgid "%q must be a bytearray or array of type 'h', 'H', 'b', or 'B'" +msgstr "" #: py/argcheck.c msgid "%q must be a string" msgstr "%q must be a string" -#: shared-module/vectorio/Polygon.c -msgid "%q must be a tuple of length 2" -msgstr "%q must be a tuple of length 2" - -#: ports/espressif/common-hal/imagecapture/ParallelImageCapture.c -#: shared-module/vectorio/VectorShape.c -msgid "%q must be between %d and %d" -msgstr "%q must be between %d and %d" +#: py/argcheck.c +msgid "%q must be an int" +msgstr "" #: py/argcheck.c msgid "%q must be of type %q" @@ -167,7 +196,11 @@ msgstr "%q must be power of 2" msgid "%q out of bounds" msgstr "" +#: ports/atmel-samd/common-hal/pulseio/PulseIn.c +#: ports/cxd56/common-hal/pulseio/PulseIn.c +#: ports/nrf/common-hal/pulseio/PulseIn.c #: ports/raspberrypi/common-hal/rp2pio/StateMachine.c +#: ports/stm/common-hal/pulseio/PulseIn.c py/argcheck.c #: shared-bindings/canio/Match.c msgid "%q out of range" msgstr "%q out of range" @@ -176,10 +209,6 @@ msgstr "%q out of range" msgid "%q pin invalid" msgstr "%q pin invalid" -#: shared-bindings/fontio/BuiltinFont.c -msgid "%q should be an int" -msgstr "%q should be an int" - #: shared-bindings/usb_hid/Device.c msgid "%q with a report ID of 0 must be of length 1" msgstr "" @@ -192,7 +221,11 @@ msgstr "%q() takes %d positional arguments but %d were given" msgid "%q, %q, and %q must all be the same length" msgstr "%q, %q, and %q must all be the same length" -#: ports/espressif/bindings/espidf/__init__.c ports/espressif/esp_error.c +#: py/objint.c +msgid "%q=%q" +msgstr "" + +#: ports/espressif/common-hal/espidf/__init__.c ports/espressif/esp_error.c #, c-format msgid "%s error 0x%x" msgstr "%s error 0x%x" @@ -277,7 +310,7 @@ msgstr "'%s' object doesn't support item assignment" msgid "'%s' object doesn't support item deletion" msgstr "'%s' object doesn't support item deletion" -#: py/runtime.c +#: ports/raspberrypi/common-hal/wifi/Radio.c py/runtime.c msgid "'%s' object has no attribute '%q'" msgstr "'%s' object has no attribute '%q'" @@ -342,10 +375,6 @@ msgstr "'yield from' inside async function" msgid "'yield' outside function" msgstr "'yield' outside function" -#: shared-module/vectorio/VectorShape.c -msgid "(x,y) integers required" -msgstr "(x,y) integers required" - #: py/compile.c msgid "*x must be assignment target" msgstr "*x must be assignment target" @@ -381,16 +410,12 @@ msgstr "ADC2 is being used by WiFi" msgid "Address must be %d bytes long" msgstr "Address must be %d bytes long" -#: shared-bindings/_bleio/Address.c -msgid "Address type out of range" -msgstr "Address type out of range" - #: ports/espressif/common-hal/canio/CAN.c msgid "All CAN peripherals are in use" msgstr "All CAN peripherals are in use" #: ports/espressif/common-hal/busio/I2C.c -#: ports/espressif/common-hal/i2cperipheral/I2CPeripheral.c +#: ports/espressif/common-hal/i2ctarget/I2CTarget.c #: ports/nrf/common-hal/busio/I2C.c msgid "All I2C peripherals are in use" msgstr "All I2C peripherals are in use" @@ -427,7 +452,6 @@ msgstr "All channels in use" msgid "All event channels in use" msgstr "All event channels in use" -#: ports/raspberrypi/common-hal/pulseio/PulseIn.c #: ports/raspberrypi/common-hal/rp2pio/StateMachine.c msgid "All state machines in use" msgstr "All state machines in use" @@ -472,28 +496,10 @@ msgid "Already running" msgstr "Already running" #: ports/espressif/common-hal/wifi/Radio.c +#: ports/raspberrypi/common-hal/wifi/Radio.c msgid "Already scanning for wifi networks" msgstr "Already scanning for WiFi networks" -#: ports/cxd56/common-hal/analogio/AnalogIn.c -msgid "AnalogIn not supported on given pin" -msgstr "AnalogIn not supported on given pin" - -#: ports/cxd56/common-hal/analogio/AnalogOut.c -#: ports/mimxrt10xx/common-hal/analogio/AnalogOut.c -#: ports/nrf/common-hal/analogio/AnalogOut.c -#: ports/raspberrypi/common-hal/analogio/AnalogOut.c -msgid "AnalogOut functionality not supported" -msgstr "AnalogOut functionality not supported" - -#: shared-bindings/analogio/AnalogOut.c -msgid "AnalogOut is only 16 bits. Value must be less than 65536." -msgstr "AnalogOut is only 16 bits. Value must be less than 65536." - -#: ports/atmel-samd/common-hal/analogio/AnalogOut.c -msgid "AnalogOut not supported on given pin" -msgstr "AnalogOut not supported on given pin" - #: ports/stm/common-hal/audiopwmio/PWMAudioOut.c msgid "Another PWMAudioOut is already active" msgstr "Another PWMAudioOut is already active" @@ -532,7 +538,7 @@ msgstr "Audio conversion not implemented" msgid "AuthMode.OPEN is not used with password" msgstr "AuthMode.OPEN is not used with password" -#: shared-bindings/wifi/Radio.c +#: shared-bindings/wifi/Radio.c supervisor/shared/web_workflow/web_workflow.c msgid "Authentication failure" msgstr "Authentication failure" @@ -565,11 +571,6 @@ msgstr "Bit clock and word select must be sequential pins" msgid "Bit clock and word select must share a clock unit" msgstr "Bit clock and word select must share a clock unit" -#: shared-bindings/rgbmatrix/RGBMatrix.c -#, c-format -msgid "Bit depth must be from 1 to 6 inclusive, not %d" -msgstr "Bit depth must be from 1 to 6 inclusive, not %d" - #: shared-bindings/audiobusio/PDMIn.c msgid "Bit depth must be multiple of 8." msgstr "Bit depth must be multiple of 8." @@ -611,11 +612,6 @@ msgstr "Buffer + offset too small %d %d %d" msgid "Buffer elements must be 4 bytes long or less" msgstr "Buffer elements must be 4 bytes long or less" -#: shared-module/usb_hid/Device.c -#, c-format -msgid "Buffer incorrect size. Should be %d bytes." -msgstr "Buffer incorrect size. Should be %d bytes." - #: shared-bindings/framebufferio/FramebufferDisplay.c msgid "Buffer is not a bytearray." msgstr "Buffer is not a bytearray." @@ -625,7 +621,6 @@ msgstr "Buffer is not a bytearray." msgid "Buffer is too small" msgstr "Buffer is too small" -#: ports/nrf/common-hal/audiopwmio/PWMAudioOut.c #: ports/stm/common-hal/audiopwmio/PWMAudioOut.c #, c-format msgid "Buffer length %d too big. It must be less than %d" @@ -640,10 +635,6 @@ msgstr "Buffer length must be a multiple of 512" msgid "Buffer must be a multiple of 512 bytes" msgstr "Buffer must be a multiple of 512 bytes" -#: shared-bindings/bitbangio/I2C.c -msgid "Buffer must be at least length 1" -msgstr "Buffer must be at least length 1" - #: shared-bindings/_bleio/PacketBuffer.c #, c-format msgid "Buffer too short by %d bytes" @@ -665,10 +656,6 @@ msgstr "Bus pin %d is already in use" msgid "Byte buffer must be 16 bytes." msgstr "Byte buffer must be 16 bytes." -#: shared-bindings/alarm/SleepMemory.c shared-bindings/nvm/ByteArray.c -msgid "Bytes must be between 0 and 255." -msgstr "Bytes must be between 0 and 255." - #: shared-bindings/aesio/aes.c msgid "CBC blocks must be multiples of 16 bytes" msgstr "CBC blocks must be multiples of 16 bytes" @@ -677,7 +664,7 @@ msgstr "CBC blocks must be multiples of 16 bytes" msgid "CIRCUITPY drive could not be found or created." msgstr "" -#: ports/espressif/bindings/espidf/__init__.c ports/espressif/esp_error.c +#: ports/espressif/common-hal/espidf/__init__.c ports/espressif/esp_error.c msgid "CRC or checksum was invalid" msgstr "CRC or checksum was invalid" @@ -685,6 +672,10 @@ msgstr "CRC or checksum was invalid" msgid "Call super().__init__() before accessing native object." msgstr "Call super().__init__() before accessing native object." +#: ports/cxd56/common-hal/camera/Camera.c +msgid "Camera init" +msgstr "" + #: ports/espressif/common-hal/alarm/pin/PinAlarm.c msgid "Can only alarm on RTC IO from deep sleep." msgstr "Can only alarm on RTC IO from deep sleep." @@ -732,18 +723,10 @@ msgstr "Cannot get temperature" msgid "Cannot have scan responses for extended, connectable advertisements." msgstr "Cannot have scan responses for extended, connectable advertisements." -#: ports/atmel-samd/common-hal/audioio/AudioOut.c -msgid "Cannot output both channels on the same pin" -msgstr "Cannot output both channels on the same pin" - #: ports/espressif/common-hal/alarm/pin/PinAlarm.c msgid "Cannot pull on input-only pin." msgstr "Cannot pull on input-only pin." -#: shared-module/bitbangio/SPI.c -msgid "Cannot read without MISO pin." -msgstr "Cannot read without MISO pin." - #: shared-bindings/audiobusio/PDMIn.c msgid "Cannot record to a file" msgstr "Cannot record to a file" @@ -755,8 +738,8 @@ msgstr "Cannot remount '/' when visible via USB." #: ports/atmel-samd/common-hal/microcontroller/__init__.c #: ports/cxd56/common-hal/microcontroller/__init__.c #: ports/mimxrt10xx/common-hal/microcontroller/__init__.c -msgid "Cannot reset into bootloader because no bootloader is present." -msgstr "Cannot reset into bootloader because no bootloader is present." +msgid "Cannot reset into bootloader because no bootloader is present" +msgstr "" #: ports/espressif/common-hal/socketpool/Socket.c msgid "Cannot set socket options" @@ -776,22 +759,21 @@ msgid "Cannot subclass slice" msgstr "Cannot subclass slice" #: shared-module/bitbangio/SPI.c -msgid "Cannot transfer without MOSI and MISO pins." -msgstr "Cannot transfer without MOSI and MISO pins." +msgid "Cannot transfer without MOSI and MISO pins" +msgstr "" #: shared-bindings/pwmio/PWMOut.c msgid "Cannot vary frequency on a timer that is already in use" msgstr "Cannot vary frequency on a timer that is already in use" -#: ports/espressif/common-hal/alarm/pin/PinAlarm.c #: ports/nrf/common-hal/alarm/pin/PinAlarm.c +msgid "Cannot wake on pin edge, only level" +msgstr "" + +#: ports/espressif/common-hal/alarm/pin/PinAlarm.c msgid "Cannot wake on pin edge. Only level." msgstr "Cannot wake on pin edge. Only level." -#: shared-module/bitbangio/SPI.c -msgid "Cannot write without MOSI pin." -msgstr "Cannot write without MOSI pin." - #: shared-bindings/_bleio/CharacteristicBuffer.c msgid "CharacteristicBuffer writing not provided" msgstr "CharacteristicBuffer writing not provided" @@ -804,10 +786,6 @@ msgstr "CircuitPython core code crashed hard. Crikey!\n" msgid "CircuitPython was unable to allocate the heap." msgstr "CircuitPython was unable to allocate the heap." -#: shared-module/bitbangio/SPI.c -msgid "Clock pin init failed." -msgstr "Clock pin init failed." - #: shared-module/bitbangio/I2C.c msgid "Clock stretch too long" msgstr "Clock stretch too long" @@ -816,11 +794,6 @@ msgstr "Clock stretch too long" msgid "Clock unit in use" msgstr "Clock unit in use" -#: shared-bindings/displayio/FourWire.c shared-bindings/displayio/I2CDisplay.c -#: shared-bindings/paralleldisplay/ParallelBus.c -msgid "Command must be an int between 0 and 255" -msgstr "Command must be an int between 0 and 255" - #: shared-bindings/_bleio/Connection.c msgid "" "Connection has been disconnected and can no longer be used. Create a new " @@ -833,35 +806,6 @@ msgstr "" msgid "Corrupt .mpy file" msgstr "Corrupt .mpy file" -#: ports/cxd56/common-hal/camera/Camera.c -msgid "Could not initialize Camera" -msgstr "Could not initialise camera" - -#: ports/cxd56/common-hal/gnss/GNSS.c -msgid "Could not initialize GNSS" -msgstr "Could not initialise GNSS" - -#: ports/cxd56/common-hal/sdioio/SDCard.c -msgid "Could not initialize SDCard" -msgstr "Could not initialise SDCard" - -#: ports/atmel-samd/common-hal/busio/UART.c ports/cxd56/common-hal/busio/UART.c -#: ports/espressif/common-hal/busio/UART.c -msgid "Could not initialize UART" -msgstr "Could not initialise UART" - -#: ports/stm/common-hal/pwmio/PWMOut.c -msgid "Could not re-init channel" -msgstr "Could not reinit channel" - -#: ports/stm/common-hal/pwmio/PWMOut.c -msgid "Could not re-init timer" -msgstr "Could not reinit timer" - -#: ports/stm/common-hal/pwmio/PWMOut.c -msgid "Could not restart PWM" -msgstr "Could not restart PWM" - #: ports/espressif/common-hal/neopixel_write/__init__.c msgid "Could not retrieve clock" msgstr "Could not retrieve clock" @@ -882,20 +826,6 @@ msgstr "Could not start interrupt, RX busy" msgid "Couldn't allocate decoder" msgstr "Couldn't allocate decoder" -#: shared-module/audiocore/WaveFile.c shared-module/audiomixer/Mixer.c -#: shared-module/audiomp3/MP3Decoder.c -msgid "Couldn't allocate first buffer" -msgstr "Couldn't allocate first buffer" - -#: shared-module/audiomp3/MP3Decoder.c -msgid "Couldn't allocate input buffer" -msgstr "Couldn't allocate input buffer" - -#: shared-module/audiocore/WaveFile.c shared-module/audiomixer/Mixer.c -#: shared-module/audiomp3/MP3Decoder.c -msgid "Couldn't allocate second buffer" -msgstr "Couldn't allocate second buffer" - #: supervisor/shared/safe_mode.c msgid "Crash into the HardFault_Handler." msgstr "Crash into the HardFault_Handler." @@ -943,10 +873,6 @@ msgstr "Destination capacity is smaller than destination_length." msgid "Device in use" msgstr "Device in use" -#: ports/cxd56/common-hal/digitalio/DigitalInOut.c -msgid "DigitalInOut not supported on given pin" -msgstr "DigitalInOut not supported on given pin" - #: shared-bindings/displayio/Display.c #: shared-bindings/framebufferio/FramebufferDisplay.c msgid "Display must have a 16 bit colorspace." @@ -958,6 +884,10 @@ msgstr "Display must have a 16 bit colourspace." msgid "Display rotation must be in 90 degree increments" msgstr "Display rotation must be in 90 degree increments" +#: main.c +msgid "Done" +msgstr "" + #: shared-bindings/digitalio/DigitalInOut.c msgid "Drive mode not used when direction is input." msgstr "Drive mode not used when direction is input." @@ -991,21 +921,20 @@ msgstr "Error in regex" msgid "Error: Failure to bind" msgstr "Error: Failure to bind" -#: ports/raspberrypi/bindings/rp2pio/StateMachine.c py/enum.c -#: shared-bindings/_bleio/__init__.c shared-bindings/aesio/aes.c -#: shared-bindings/busio/SPI.c shared-bindings/microcontroller/Pin.c +#: py/enum.c shared-bindings/_bleio/__init__.c shared-bindings/aesio/aes.c +#: shared-bindings/alarm/__init__.c shared-bindings/busio/SPI.c +#: shared-bindings/microcontroller/Pin.c #: shared-bindings/neopixel_write/__init__.c msgid "Expected a %q" msgstr "Expected a %q" -#: shared-bindings/alarm/__init__.c -msgid "Expected an alarm" -msgstr "Expected an alarm" +#: ports/raspberrypi/bindings/cyw43/__init__.c +msgid "Expected a %q or %q" +msgstr "" -#: shared-module/adafruit_pixelbuf/PixelBuf.c -#, c-format -msgid "Expected tuple of length %d, got %d" -msgstr "Expected tuple of length %d, got %d" +#: shared-bindings/alarm/__init__.c +msgid "Expected an %q" +msgstr "" #: ports/espressif/common-hal/_bleio/Adapter.c #: ports/nrf/common-hal/_bleio/Adapter.c @@ -1033,21 +962,9 @@ msgstr "Failed sending command." msgid "Failed to acquire mutex, err 0x%04x" msgstr "Failed to acquire mutex, err 0x%04x" -#: ports/mimxrt10xx/common-hal/busio/UART.c ports/nrf/common-hal/busio/UART.c -#: ports/raspberrypi/common-hal/busio/UART.c -msgid "Failed to allocate RX buffer" -msgstr "Failed to allocate RX buffer" - -#: ports/atmel-samd/common-hal/busio/UART.c -#: ports/atmel-samd/common-hal/pulseio/PulseIn.c -#: ports/cxd56/common-hal/pulseio/PulseIn.c -#: ports/espressif/common-hal/pulseio/PulseIn.c -#: ports/nrf/common-hal/pulseio/PulseIn.c -#: ports/raspberrypi/common-hal/pulseio/PulseIn.c -#: ports/stm/common-hal/pulseio/PulseIn.c -#, c-format -msgid "Failed to allocate RX buffer of %d bytes" -msgstr "Failed to allocate RX buffer of %d bytes" +#: shared-module/rgbmatrix/RGBMatrix.c +msgid "Failed to allocate %q buffer" +msgstr "" #: ports/espressif/common-hal/wifi/__init__.c msgid "Failed to allocate Wifi memory" @@ -1070,10 +987,6 @@ msgstr "Failed to connect: internal error" msgid "Failed to connect: timeout" msgstr "Failed to connect: timeout" -#: ports/espressif/common-hal/wifi/__init__.c -msgid "Failed to init wifi" -msgstr "Failed to init WiFi" - #: shared-module/audiomp3/MP3Decoder.c msgid "Failed to parse MP3 file" msgstr "Failed to parse MP3 file" @@ -1117,11 +1030,6 @@ msgstr "" msgid "Format not supported" msgstr "Format not supported" -#: shared-module/framebufferio/FramebufferDisplay.c -#, c-format -msgid "Framebuffer requires %d bytes" -msgstr "Framebuffer requires %d bytes" - #: ports/mimxrt10xx/common-hal/microcontroller/Processor.c msgid "" "Frequency must be 24, 150, 396, 450, 528, 600, 720, 816, 912, 960 or 1008 Mhz" @@ -1136,7 +1044,11 @@ msgstr "Frequency must match existing PWMOut using this timer" msgid "Function requires lock" msgstr "Function requires lock" -#: ports/espressif/bindings/espidf/__init__.c ports/espressif/esp_error.c +#: ports/cxd56/common-hal/gnss/GNSS.c +msgid "GNSS init" +msgstr "" + +#: ports/espressif/common-hal/espidf/__init__.c ports/espressif/esp_error.c msgid "Generic Failure" msgstr "Generic Failure" @@ -1163,19 +1075,16 @@ msgstr "Hardware busy, try alternative pins" msgid "Hardware in use, try alternative pins" msgstr "Hardware in use, try alternative pins" -#: shared-bindings/wifi/Radio.c -msgid "Hostname must be between 1 and 253 characters" -msgstr "Hostname must be between 1 and 253 characters" - #: extmod/vfs_posix_file.c py/objstringio.c msgid "I/O operation on closed file" msgstr "I/O operation on closed file" #: ports/stm/common-hal/busio/I2C.c -msgid "I2C Init Error" -msgstr "I2C init error" +msgid "I2C init error" +msgstr "" #: ports/raspberrypi/common-hal/busio/I2C.c +#: ports/raspberrypi/common-hal/i2ctarget/I2CTarget.c msgid "I2C peripheral in use" msgstr "I2C peripheral in use" @@ -1282,75 +1191,37 @@ msgstr "" msgid "Internal error #%d" msgstr "Internal error #%d" -#: shared-bindings/sdioio/SDCard.c shared-module/usb_hid/Device.c +#: supervisor/shared/safe_mode.c +msgid "Internal watchdog timer expired." +msgstr "" + +#: py/argcheck.c shared-bindings/digitalio/DigitalInOut.c msgid "Invalid %q" msgstr "Invalid %q" -#: ports/atmel-samd/common-hal/audiobusio/I2SOut.c -#: ports/atmel-samd/common-hal/audiobusio/PDMIn.c -#: ports/atmel-samd/common-hal/imagecapture/ParallelImageCapture.c -#: ports/mimxrt10xx/common-hal/busio/UART.c +#: shared-bindings/microcontroller/Pin.c msgid "Invalid %q pin" msgstr "Invalid %q pin" -#: ports/stm/common-hal/busio/I2C.c ports/stm/common-hal/busio/SPI.c -#: ports/stm/common-hal/busio/UART.c ports/stm/common-hal/canio/CAN.c -#: ports/stm/common-hal/sdioio/SDCard.c -msgid "Invalid %q pin selection" -msgstr "Invalid %q pin selection" - #: ports/stm/common-hal/analogio/AnalogIn.c msgid "Invalid ADC Unit value" msgstr "Invalid ADC unit value" -#: ports/espressif/common-hal/wifi/Radio.c -msgid "Invalid AuthMode" -msgstr "Invalid AuthMode" - #: ports/espressif/common-hal/_bleio/__init__.c #: ports/nrf/common-hal/_bleio/__init__.c msgid "Invalid BLE parameter" msgstr "Invalid BLE parameter" -#: shared-module/displayio/OnDiskBitmap.c -msgid "Invalid BMP file" -msgstr "Invalid BMP file" - #: shared-bindings/wifi/Radio.c msgid "Invalid BSSID" msgstr "Invalid BSSID" -#: ports/espressif/common-hal/analogio/AnalogOut.c -#: ports/stm/common-hal/analogio/AnalogOut.c -msgid "Invalid DAC pin supplied" -msgstr "Invalid DAC pin supplied" - #: shared-bindings/wifi/Radio.c msgid "Invalid MAC address" msgstr "" -#: shared-bindings/synthio/__init__.c -msgid "Invalid MIDI file" -msgstr "Invalid MIDI file" - -#: ports/atmel-samd/common-hal/pwmio/PWMOut.c -#: ports/cxd56/common-hal/pwmio/PWMOut.c -#: ports/espressif/common-hal/pwmio/PWMOut.c -#: ports/mimxrt10xx/common-hal/pwmio/PWMOut.c -#: ports/nrf/common-hal/pwmio/PWMOut.c -#: ports/raspberrypi/common-hal/pwmio/PWMOut.c shared-bindings/pwmio/PWMOut.c -msgid "Invalid PWM frequency" -msgstr "Invalid PWM frequency" - -#: ports/espressif/common-hal/analogio/AnalogIn.c -msgid "Invalid Pin" -msgstr "Invalid pin" - -#: ports/espressif/bindings/espidf/__init__.c -#: ports/espressif/common-hal/busio/I2C.c -#: ports/espressif/common-hal/i2cperipheral/I2CPeripheral.c -#: ports/espressif/esp_error.c py/moduerrno.c -#: shared-module/rgbmatrix/RGBMatrix.c +#: ports/espressif/common-hal/espidf/__init__.c ports/espressif/esp_error.c +#: py/moduerrno.c msgid "Invalid argument" msgstr "Invalid argument" @@ -1358,42 +1229,11 @@ msgstr "Invalid argument" msgid "Invalid bits per value" msgstr "Invalid bits per value" -#: ports/nrf/common-hal/busio/UART.c ports/raspberrypi/common-hal/busio/UART.c -#: ports/stm/common-hal/busio/UART.c -msgid "Invalid buffer size" -msgstr "Invalid buffer size" - -#: shared-bindings/adafruit_pixelbuf/PixelBuf.c -msgid "Invalid byteorder string" -msgstr "Invalid byteorder string" - -#: ports/atmel-samd/common-hal/frequencyio/FrequencyIn.c -#: ports/espressif/common-hal/frequencyio/FrequencyIn.c -msgid "Invalid capture period. Valid range: 1 - 500" -msgstr "Invalid capture period. Valid range: 1 - 500" - -#: shared-bindings/audiomixer/Mixer.c -msgid "Invalid channel count" -msgstr "Invalid channel count" - -#: ports/atmel-samd/common-hal/imagecapture/ParallelImageCapture.c -#, c-format -msgid "Invalid data_count %d" -msgstr "Invalid data_count %d" - #: ports/atmel-samd/common-hal/imagecapture/ParallelImageCapture.c #, c-format msgid "Invalid data_pins[%d]" msgstr "Invalid data_pins[%d]" -#: shared-bindings/digitalio/DigitalInOut.c -msgid "Invalid direction." -msgstr "Invalid direction." - -#: shared-module/audiocore/WaveFile.c -msgid "Invalid file" -msgstr "Invalid file" - #: shared-module/audiocore/WaveFile.c msgid "Invalid format chunk size" msgstr "Invalid format chunk size" @@ -1402,107 +1242,27 @@ msgstr "Invalid format chunk size" msgid "Invalid memory access." msgstr "Invalid memory access." -#: extmod/vfs_fat_file.c -msgid "Invalid mode" -msgstr "" - #: ports/espressif/common-hal/wifi/Radio.c msgid "Invalid multicast MAC address" msgstr "" -#: shared-bindings/bitbangio/SPI.c shared-bindings/busio/SPI.c -msgid "Invalid number of bits" -msgstr "Invalid number of bits" - -#: shared-bindings/bitbangio/SPI.c shared-bindings/busio/SPI.c -#: shared-bindings/displayio/FourWire.c -msgid "Invalid phase" -msgstr "Invalid phase" - -#: ports/atmel-samd/common-hal/audioio/AudioOut.c -#: ports/atmel-samd/common-hal/touchio/TouchIn.c -#: ports/espressif/common-hal/alarm/touch/TouchAlarm.c -#: ports/espressif/common-hal/touchio/TouchIn.c -#: ports/nrf/common-hal/alarm/pin/PinAlarm.c shared-bindings/pwmio/PWMOut.c -#: shared-module/rgbmatrix/RGBMatrix.c -msgid "Invalid pin" -msgstr "Invalid pin" - -#: ports/atmel-samd/common-hal/audioio/AudioOut.c -msgid "Invalid pin for left channel" -msgstr "Invalid pin for left channel" - -#: ports/atmel-samd/common-hal/audioio/AudioOut.c -msgid "Invalid pin for right channel" -msgstr "Invalid pin for right channel" - -#: ports/atmel-samd/common-hal/busio/I2C.c -#: ports/atmel-samd/common-hal/busio/SPI.c -#: ports/atmel-samd/common-hal/busio/UART.c -#: ports/atmel-samd/common-hal/i2cperipheral/I2CPeripheral.c -#: ports/cxd56/common-hal/busio/I2C.c ports/cxd56/common-hal/busio/SPI.c -#: ports/cxd56/common-hal/busio/UART.c ports/cxd56/common-hal/sdioio/SDCard.c -#: ports/espressif/common-hal/busio/I2C.c -#: ports/espressif/common-hal/busio/SPI.c -#: ports/espressif/common-hal/busio/UART.c -#: ports/espressif/common-hal/canio/CAN.c -#: ports/espressif/common-hal/i2cperipheral/I2CPeripheral.c -#: ports/mimxrt10xx/common-hal/busio/I2C.c -#: ports/mimxrt10xx/common-hal/busio/SPI.c -#: ports/mimxrt10xx/common-hal/usb_host/Port.c ports/nrf/common-hal/busio/I2C.c -#: ports/raspberrypi/common-hal/busio/I2C.c -#: ports/raspberrypi/common-hal/busio/SPI.c -#: ports/raspberrypi/common-hal/busio/UART.c shared-bindings/busio/SPI.c #: shared-bindings/busio/UART.c msgid "Invalid pins" msgstr "Invalid pins" -#: shared-bindings/bitbangio/SPI.c shared-bindings/busio/SPI.c -#: shared-bindings/displayio/FourWire.c -msgid "Invalid polarity" -msgstr "Invalid polarity" - -#: shared-bindings/_bleio/Characteristic.c -msgid "Invalid properties" -msgstr "Invalid properties" - -#: shared-bindings/microcontroller/__init__.c -msgid "Invalid run mode." -msgstr "Invalid run mode." - -#: shared-module/_bleio/Attribute.c -msgid "Invalid security_mode" -msgstr "Invalid security_mode" - -#: ports/espressif/bindings/espidf/__init__.c ports/espressif/esp_error.c +#: ports/espressif/common-hal/espidf/__init__.c ports/espressif/esp_error.c msgid "Invalid size" msgstr "Invalid size" #: ports/espressif/common-hal/ssl/SSLContext.c +#: ports/raspberrypi/common-hal/ssl/SSLSocket.c msgid "Invalid socket for TLS" msgstr "Invalid socket for TLS" -#: ports/espressif/bindings/espidf/__init__.c ports/espressif/esp_error.c +#: ports/espressif/common-hal/espidf/__init__.c ports/espressif/esp_error.c msgid "Invalid state" msgstr "Invalid state" -#: shared-bindings/audiomixer/Mixer.c -msgid "Invalid voice" -msgstr "Invalid voice" - -#: shared-bindings/audiomixer/Mixer.c -msgid "Invalid voice count" -msgstr "Invalid voice count" - -#: shared-module/audiocore/WaveFile.c -msgid "Invalid wave file" -msgstr "Invalid wave file" - -#: ports/mimxrt10xx/common-hal/busio/UART.c ports/nrf/common-hal/busio/UART.c -#: ports/raspberrypi/common-hal/busio/UART.c ports/stm/common-hal/busio/UART.c -msgid "Invalid word/bit length" -msgstr "Invalid word/bit length" - #: shared-bindings/aesio/aes.c msgid "Key must be 16, 24, or 32 bytes long" msgstr "Key must be 16, 24, or 32 bytes long" @@ -1516,25 +1276,17 @@ msgid "LHS of keyword arg must be an id" msgstr "LHS of keyword arg must be an id" #: shared-module/displayio/Group.c -msgid "Layer already in a group." -msgstr "Layer already in a group." +msgid "Layer already in a group" +msgstr "" #: shared-module/displayio/Group.c -msgid "Layer must be a Group or TileGrid subclass." -msgstr "Layer must be a Group or TileGrid subclass." +msgid "Layer must be a Group or TileGrid subclass" +msgstr "" -#: ports/espressif/bindings/espidf/__init__.c ports/espressif/esp_error.c +#: ports/espressif/common-hal/espidf/__init__.c ports/espressif/esp_error.c msgid "MAC address was invalid" msgstr "MAC address was invalid" -#: shared-module/bitbangio/SPI.c -msgid "MISO pin init failed." -msgstr "MISO pin init failed." - -#: shared-module/bitbangio/SPI.c -msgid "MOSI pin init failed." -msgstr "MOSI pin init failed." - #: shared-bindings/is31fl3741/IS31FL3741.c msgid "Mapping must be a tuple" msgstr "" @@ -1544,10 +1296,6 @@ msgstr "" msgid "Maximum x value when mirrored is %d" msgstr "Maximum x value when mirrored is %d" -#: shared-bindings/canio/Message.c -msgid "Messages limited to 8 bytes" -msgstr "Messages limited to 8 bytes" - #: shared-bindings/audiobusio/PDMIn.c msgid "Microphone startup delay must be in range 0.0 to 1.0" msgstr "Microphone startup delay must be in range 0.0 to 1.0" @@ -1561,10 +1309,14 @@ msgstr "" msgid "Mismatched swap flag" msgstr "" -#: ports/mimxrt10xx/common-hal/busio/SPI.c ports/stm/common-hal/busio/SPI.c +#: ports/mimxrt10xx/common-hal/busio/SPI.c msgid "Missing MISO or MOSI Pin" msgstr "Missing MISO or MOSI pin" +#: ports/stm/common-hal/busio/SPI.c +msgid "Missing MISO or MOSI pin" +msgstr "" + #: ports/raspberrypi/common-hal/rp2pio/StateMachine.c #, c-format msgid "Missing first_in_pin. Instruction %d reads pin(s)" @@ -1600,11 +1352,6 @@ msgstr "Missing first_set_pin. Instruction %d sets pin(s)" msgid "Missing jmp_pin. Instruction %d jumps on pin" msgstr "Missing jmp_pin. Instruction %d jumps on pin" -#: shared-module/usb_hid/Device.c -#, c-format -msgid "More than %d report ids not supported" -msgstr "More than %d report ids not supported" - #: shared-bindings/busio/UART.c shared-bindings/displayio/Group.c msgid "Must be a %q subclass." msgstr "Must be a %q subclass." @@ -1664,16 +1411,28 @@ msgstr "No DMA pacing timer found" msgid "No I2C device at address: 0x%x" msgstr "" +#: supervisor/shared/web_workflow/web_workflow.c +msgid "No IP" +msgstr "" + #: ports/espressif/common-hal/busio/SPI.c -#: ports/mimxrt10xx/common-hal/busio/SPI.c ports/stm/common-hal/busio/SPI.c +#: ports/mimxrt10xx/common-hal/busio/SPI.c msgid "No MISO Pin" msgstr "No MISO pin" +#: ports/stm/common-hal/busio/SPI.c shared-module/bitbangio/SPI.c +msgid "No MISO pin" +msgstr "" + #: ports/espressif/common-hal/busio/SPI.c -#: ports/mimxrt10xx/common-hal/busio/SPI.c ports/stm/common-hal/busio/SPI.c +#: ports/mimxrt10xx/common-hal/busio/SPI.c msgid "No MOSI Pin" msgstr "No MOSI pin" +#: ports/stm/common-hal/busio/SPI.c shared-module/bitbangio/SPI.c +msgid "No MOSI pin" +msgstr "" + #: ports/atmel-samd/common-hal/busio/UART.c #: ports/espressif/common-hal/busio/UART.c #: ports/mimxrt10xx/common-hal/busio/UART.c ports/nrf/common-hal/busio/UART.c @@ -1712,16 +1471,6 @@ msgstr "No free GCLKs" msgid "No hardware random available" msgstr "No hardware random available" -#: ports/atmel-samd/common-hal/ps2io/Ps2.c -msgid "No hardware support on clk pin" -msgstr "No hardware support on clk pin" - -#: ports/atmel-samd/common-hal/alarm/pin/PinAlarm.c -#: ports/atmel-samd/common-hal/frequencyio/FrequencyIn.c -#: ports/atmel-samd/common-hal/pulseio/PulseIn.c -msgid "No hardware support on pin" -msgstr "No hardware support on pin" - #: ports/raspberrypi/common-hal/rp2pio/StateMachine.c msgid "No in in program" msgstr "No in in program" @@ -1820,16 +1569,26 @@ msgstr "" msgid "Odd parity is not supported" msgstr "Odd parity is not supported" +#: supervisor/shared/bluetooth/bluetooth.c +msgid "Off" +msgstr "" + +#: supervisor/shared/bluetooth/bluetooth.c +msgid "Ok" +msgstr "" + #: ports/atmel-samd/common-hal/audiobusio/PDMIn.c #: ports/raspberrypi/common-hal/audiobusio/PDMIn.c msgid "Only 8 or 16 bit mono with " msgstr "Only 8 or 16 bit mono with " #: ports/espressif/common-hal/wifi/__init__.c +#: ports/raspberrypi/common-hal/wifi/__init__.c msgid "Only IPv4 addresses supported" msgstr "Only IPv4 addresses supported" -#: ports/espressif/common-hal/socketpool/SocketPool.c +#: ports/espressif/common-hal/socketpool/Socket.c +#: ports/raspberrypi/common-hal/socketpool/Socket.c msgid "Only IPv4 sockets supported" msgstr "Only IPv4 sockets supported" @@ -1865,15 +1624,19 @@ msgstr "" msgid "Only one TouchAlarm can be set in deep sleep." msgstr "Only one TouchAlarm can be set in deep sleep." -#: ports/espressif/common-hal/i2cperipheral/I2CPeripheral.c +#: ports/espressif/common-hal/i2ctarget/I2CTarget.c +#: ports/raspberrypi/common-hal/i2ctarget/I2CTarget.c msgid "Only one address is allowed" msgstr "" #: ports/atmel-samd/common-hal/alarm/time/TimeAlarm.c -#: ports/espressif/common-hal/alarm/time/TimeAlarm.c #: ports/nrf/common-hal/alarm/time/TimeAlarm.c -#: ports/raspberrypi/common-hal/alarm/time/TimeAlarm.c #: ports/stm/common-hal/alarm/time/TimeAlarm.c +msgid "Only one alarm.time alarm can be set" +msgstr "" + +#: ports/espressif/common-hal/alarm/time/TimeAlarm.c +#: ports/raspberrypi/common-hal/alarm/time/TimeAlarm.c msgid "Only one alarm.time alarm can be set." msgstr "Only one alarm.time alarm can be set." @@ -1885,19 +1648,20 @@ msgstr "Only one colour can be transparent at a time" msgid "Operation not permitted" msgstr "" -#: ports/espressif/bindings/espidf/__init__.c ports/espressif/esp_error.c +#: ports/espressif/common-hal/espidf/__init__.c ports/espressif/esp_error.c msgid "Operation or feature not supported" msgstr "Operation or feature not supported" -#: ports/espressif/bindings/espidf/__init__.c ports/espressif/esp_error.c +#: ports/espressif/common-hal/espidf/__init__.c ports/espressif/esp_error.c msgid "Operation timed out" msgstr "Operation timed out" -#: ports/espressif/bindings/espidf/__init__.c ports/espressif/esp_error.c +#: ports/espressif/common-hal/espidf/__init__.c ports/espressif/esp_error.c msgid "Out of memory" msgstr "Out of memory" -#: ports/espressif/common-hal/socketpool/SocketPool.c +#: ports/espressif/common-hal/socketpool/Socket.c +#: ports/raspberrypi/common-hal/socketpool/Socket.c msgid "Out of sockets" msgstr "Out of sockets" @@ -1905,11 +1669,6 @@ msgstr "Out of sockets" msgid "Out-buffer elements must be <= 4 bytes long" msgstr "Out-buffer elements must be <= 4 bytes long" -#: shared-bindings/bitops/__init__.c -#, c-format -msgid "Output buffer must be at least %d bytes" -msgstr "Output buffer must be at least %d bytes" - #: shared-bindings/audiobusio/PDMIn.c msgid "Oversample must be multiple of 8." msgstr "Oversample must be multiple of 8." @@ -1920,15 +1679,13 @@ msgstr "PDMIn not available" #: shared-bindings/pwmio/PWMOut.c msgid "" -"PWM duty_cycle must be between 0 and 65535 inclusive (16 bit resolution)" +"PWM frequency not writable when variable_frequency is False on construction." msgstr "" -"PWM duty_cycle must be between 0 and 65535 inclusive (16 bit resolution)" +"PWM frequency not writable when variable_frequency is False on construction." -#: shared-bindings/pwmio/PWMOut.c -msgid "" -"PWM frequency not writable when variable_frequency is False on construction." +#: ports/stm/common-hal/pwmio/PWMOut.c +msgid "PWM restart" msgstr "" -"PWM frequency not writable when variable_frequency is False on construction." #: ports/raspberrypi/common-hal/countio/Counter.c msgid "PWM slice already in use" @@ -1946,36 +1703,20 @@ msgstr "Peripheral in use" msgid "Permission denied" msgstr "Permission denied" -#: ports/atmel-samd/common-hal/alarm/pin/PinAlarm.c #: ports/stm/common-hal/alarm/pin/PinAlarm.c msgid "Pin cannot wake from Deep Sleep" msgstr "Pin cannot wake from Deep Sleep" -#: ports/raspberrypi/bindings/rp2pio/StateMachine.c -msgid "Pin count must be at least 1" -msgstr "Pin count must be at least 1" - #: ports/raspberrypi/common-hal/rp2pio/StateMachine.c msgid "Pin count too large" msgstr "Pin count too large" -#: ports/atmel-samd/common-hal/analogio/AnalogIn.c -#: ports/cxd56/common-hal/analogio/AnalogIn.c -#: ports/espressif/common-hal/analogio/AnalogIn.c -#: ports/mimxrt10xx/common-hal/analogio/AnalogIn.c -#: ports/nrf/common-hal/analogio/AnalogIn.c -#: ports/raspberrypi/common-hal/analogio/AnalogIn.c -#: ports/stm/common-hal/analogio/AnalogIn.c -msgid "Pin does not have ADC capabilities" -msgstr "Pin does not have ADC capabilities" - #: ports/stm/common-hal/alarm/pin/PinAlarm.c #: ports/stm/common-hal/pulseio/PulseIn.c msgid "Pin interrupt already in use" msgstr "Pin interrupt already in use" #: shared-bindings/adafruit_bus_device/spi_device/SPIDevice.c -#: shared-bindings/digitalio/DigitalInOut.c msgid "Pin is input only" msgstr "Pin is input only" @@ -2038,18 +1779,10 @@ msgstr "Program does IN without loading ISR" msgid "Program does OUT without loading OSR" msgstr "Program does OUT without loading OSR" -#: ports/raspberrypi/bindings/rp2pio/StateMachine.c -msgid "Program must contain at least one 16-bit instruction." -msgstr "Program must contain at least one 16-bit instruction." - #: ports/raspberrypi/bindings/rp2pio/StateMachine.c msgid "Program size invalid" msgstr "Program size invalid" -#: ports/raspberrypi/bindings/rp2pio/StateMachine.c -msgid "Program too large" -msgstr "Program too large" - #: shared-bindings/digitalio/DigitalInOut.c msgid "Pull not used when direction is output." msgstr "Pull not used when direction is output." @@ -2071,30 +1804,20 @@ msgstr "RNG deinit Error" msgid "RNG Init Error" msgstr "RNG init Error" -#: ports/nrf/common-hal/busio/UART.c -msgid "RS485 Not yet supported on this device" -msgstr "RS485 not yet supported on this device" +#: ports/atmel-samd/common-hal/busio/UART.c ports/cxd56/common-hal/busio/UART.c +#: ports/nrf/common-hal/busio/UART.c ports/stm/common-hal/busio/UART.c +msgid "RS485" +msgstr "" #: ports/espressif/common-hal/busio/UART.c #: ports/mimxrt10xx/common-hal/busio/UART.c msgid "RS485 inversion specified when not in RS485 mode" msgstr "RS485 inversion specified when not in RS485 mode" -#: ports/cxd56/common-hal/rtc/RTC.c ports/espressif/common-hal/rtc/RTC.c -#: ports/mimxrt10xx/common-hal/rtc/RTC.c ports/nrf/common-hal/rtc/RTC.c -#: ports/raspberrypi/common-hal/rtc/RTC.c -msgid "RTC calibration is not supported on this board" -msgstr "RTC calibration is not supported on this board" - #: shared-bindings/alarm/time/TimeAlarm.c shared-bindings/time/__init__.c msgid "RTC is not supported on this board" msgstr "RTC is not supported on this board" -#: ports/atmel-samd/common-hal/busio/UART.c ports/cxd56/common-hal/busio/UART.c -#: ports/stm/common-hal/busio/UART.c -msgid "RTS/CTS/RS485 Not yet supported on this device" -msgstr "RTS/CTS/RS485 not yet supported on this device" - #: ports/stm/common-hal/os/__init__.c msgid "Random number generation error" msgstr "Random number generation error" @@ -2112,10 +1835,14 @@ msgstr "Read-only filesystem" msgid "Read-only object" msgstr "Read-only object" -#: ports/espressif/bindings/espidf/__init__.c ports/espressif/esp_error.c +#: ports/espressif/common-hal/espidf/__init__.c ports/espressif/esp_error.c msgid "Received response was invalid" msgstr "Received response was invalid" +#: supervisor/shared/bluetooth/bluetooth.c +msgid "Reconnecting" +msgstr "" + #: shared-bindings/displayio/EPaperDisplay.c msgid "Refresh too soon" msgstr "Refresh too soon" @@ -2128,7 +1855,7 @@ msgstr "RemoteTransmissionRequests limited to 8 bytes" msgid "Requested AES mode is unsupported" msgstr "Requested AES mode is unsupported" -#: ports/espressif/bindings/espidf/__init__.c ports/espressif/esp_error.c +#: ports/espressif/common-hal/espidf/__init__.c ports/espressif/esp_error.c msgid "Requested resource not found" msgstr "Requested resource not found" @@ -2144,6 +1871,10 @@ msgstr "Running in safe mode! Not running saved code.\n" msgid "SD card CSD format not supported" msgstr "SD card CSD format not supported" +#: ports/cxd56/common-hal/sdioio/SDCard.c +msgid "SDCard init" +msgstr "" + #: ports/stm/common-hal/sdioio/SDCard.c #, c-format msgid "SDIO GetCardInfo Error %d" @@ -2154,30 +1885,21 @@ msgstr "SDIO GetCardInfo error %d" msgid "SDIO Init Error %d" msgstr "SDIO init error %d" -#: ports/stm/common-hal/busio/SPI.c -msgid "SPI Init Error" -msgstr "SPI init error" - -#: ports/stm/common-hal/busio/SPI.c -msgid "SPI Re-initialization error" -msgstr "SPI reinitialisation error" - #: ports/espressif/common-hal/busio/SPI.c msgid "SPI configuration failed" msgstr "SPI configuration failed" +#: ports/stm/common-hal/busio/SPI.c +msgid "SPI init error" +msgstr "" + #: ports/raspberrypi/common-hal/busio/SPI.c msgid "SPI peripheral in use" msgstr "SPI peripheral in use" -#: shared-bindings/audiomixer/Mixer.c -msgid "Sample rate must be positive" -msgstr "Sample rate must be positive" - -#: ports/atmel-samd/common-hal/audioio/AudioOut.c -#, c-format -msgid "Sample rate too high. It must be less than %d" -msgstr "Sample rate too high. It must be less than %d" +#: ports/stm/common-hal/busio/SPI.c +msgid "SPI re-init" +msgstr "" #: shared-bindings/is31fl3741/FrameBuffer.c msgid "Scale dimensions must divide by 3" @@ -2197,14 +1919,6 @@ msgstr "Serialiser in use" msgid "Server side context cannot have hostname" msgstr "Server side context cannot have hostname" -#: ports/raspberrypi/bindings/rp2pio/StateMachine.c -msgid "Set pin count must be between 1 and 5" -msgstr "Set pin count must be between 1 and 5" - -#: ports/raspberrypi/bindings/rp2pio/StateMachine.c -msgid "Side set pin count must be between 1 and 5" -msgstr "Side set pin count must be between 1 and 5" - #: ports/cxd56/common-hal/camera/Camera.c msgid "Size not supported" msgstr "Size not supported" @@ -2225,6 +1939,7 @@ msgid "Slices not supported" msgstr "Slices not supported" #: ports/espressif/common-hal/socketpool/SocketPool.c +#: ports/raspberrypi/common-hal/socketpool/SocketPool.c msgid "SocketPool can only be used with wifi.radio" msgstr "SocketPool can only be used with wifi.radio" @@ -2240,10 +1955,6 @@ msgstr "" msgid "Splitting with sub-captures" msgstr "Splitting with sub-captures" -#: shared-bindings/supervisor/__init__.c -msgid "Stack size must be at least 256" -msgstr "Stack size must be at least 256" - #: ports/raspberrypi/common-hal/audiopwmio/PWMAudioOut.c msgid "Stereo left must be on PWM channel A" msgstr "Stereo left must be on PWM channel A" @@ -2252,10 +1963,6 @@ msgstr "Stereo left must be on PWM channel A" msgid "Stereo right must be on PWM channel B" msgstr "Stereo right must be on PWM channel B" -#: shared-bindings/multiterminal/__init__.c -msgid "Stream missing readinto() or write() method." -msgstr "Stream missing readinto() or write() method." - #: ports/mimxrt10xx/common-hal/busio/UART.c ports/stm/common-hal/busio/UART.c msgid "Supply at least one UART pin" msgstr "Supply at least one UART pin" @@ -2336,10 +2043,6 @@ msgstr "Tile height must exactly divide bitmap height" msgid "Tile index out of bounds" msgstr "Tile index out of bounds" -#: shared-bindings/displayio/TileGrid.c -msgid "Tile value out of bounds" -msgstr "Tile value out of bounds" - #: shared-bindings/displayio/TileGrid.c msgid "Tile width must exactly divide bitmap width" msgstr "Tile width must exactly divide bitmap width" @@ -2359,6 +2062,9 @@ msgid "To exit, please reset the board without " msgstr "To exit, please reset the board without " #: ports/atmel-samd/common-hal/audiobusio/I2SOut.c +msgid "Too many channels in sample" +msgstr "" + #: ports/raspberrypi/common-hal/audiobusio/I2SOut.c msgid "Too many channels in sample." msgstr "Too many channels in sample." @@ -2391,24 +2097,25 @@ msgid "Tuple or struct_time argument required" msgstr "Tuple or struct_time argument required" #: ports/stm/common-hal/busio/UART.c -msgid "UART Buffer allocation error" -msgstr "UART buffer allocation error" +msgid "UART de-init" +msgstr "" + +#: ports/atmel-samd/common-hal/busio/UART.c ports/cxd56/common-hal/busio/UART.c +#: ports/espressif/common-hal/busio/UART.c ports/stm/common-hal/busio/UART.c +msgid "UART init" +msgstr "" #: ports/stm/common-hal/busio/UART.c -msgid "UART De-init error" -msgstr "UART deinit error" +msgid "UART re-init" +msgstr "" #: ports/stm/common-hal/busio/UART.c -msgid "UART Init Error" -msgstr "UART init Error" +msgid "UART write" +msgstr "" -#: ports/stm/common-hal/busio/UART.c -msgid "UART Re-init error" -msgstr "UART reinit error" - -#: ports/stm/common-hal/busio/UART.c -msgid "UART write error" -msgstr "UART write error" +#: main.c +msgid "UID:" +msgstr "" #: shared-module/usb_hid/Device.c msgid "USB busy" @@ -2533,6 +2240,11 @@ msgstr "Unknown system firmware error: %04x" msgid "Unknown system firmware error: %d" msgstr "" +#: ports/raspberrypi/common-hal/wifi/__init__.c +#, c-format +msgid "Unkown error code %d" +msgstr "" + #: shared-bindings/adafruit_pixelbuf/PixelBuf.c #, c-format msgid "Unmatched number of items on RHS (expected %d, got %d)." @@ -2546,12 +2258,6 @@ msgstr "" "Unspecified issue. Can be that the pairing prompt on the other device was " "declined or ignored." -#: ports/atmel-samd/common-hal/busio/I2C.c ports/cxd56/common-hal/busio/I2C.c -#: ports/espressif/common-hal/busio/UART.c -#: ports/raspberrypi/common-hal/busio/I2C.c ports/stm/common-hal/busio/I2C.c -msgid "Unsupported baudrate" -msgstr "Unsupported baudrate" - #: shared-bindings/bitmaptools/__init__.c msgid "Unsupported colorspace" msgstr "" @@ -2564,6 +2270,10 @@ msgstr "Unsupported display bus type" msgid "Unsupported format" msgstr "Unsupported format" +#: shared-bindings/hashlib/__init__.c +msgid "Unsupported hash algorithm" +msgstr "" + #: ports/espressif/common-hal/dualbank/__init__.c msgid "Update Failed" msgstr "Update failed" @@ -2582,7 +2292,7 @@ msgstr "Value length != required fixed length" msgid "Value length > max_length" msgstr "Value length > max_length" -#: ports/espressif/bindings/espidf/__init__.c ports/espressif/esp_error.c +#: ports/espressif/common-hal/espidf/__init__.c ports/espressif/esp_error.c msgid "Version was invalid" msgstr "Version was invalid" @@ -2612,10 +2322,6 @@ msgstr "WatchDogTimer.mode cannot be changed once set to WatchDogMode.RESET" msgid "WatchDogTimer.timeout must be greater than 0" msgstr "WatchDogTimer.timeout must be greater than 0" -#: supervisor/shared/safe_mode.c -msgid "Watchdog timer expired." -msgstr "WatchDog timer expired." - #: py/builtinhelp.c #, c-format msgid "" @@ -2626,9 +2332,9 @@ msgid "" "To list built-in modules type `help(\"modules\")`.\n" msgstr "" -#: shared-bindings/wifi/Radio.c -msgid "WiFi password must be between 8 and 63 characters" -msgstr "WiFi password must be between 8 and 63 characters" +#: supervisor/shared/web_workflow/web_workflow.c +msgid "Wi-Fi: " +msgstr "" #: main.c msgid "Woken up by alarm.\n" @@ -2669,11 +2375,7 @@ msgstr "__new__ arg must be a user-type" msgid "a bytes-like object is required" msgstr "a bytes-like object is required" -#: shared-bindings/i2cperipheral/I2CPeripheral.c -msgid "address out of bounds" -msgstr "address out of bounds" - -#: shared-bindings/i2cperipheral/I2CPeripheral.c +#: shared-bindings/i2ctarget/I2CTarget.c msgid "addresses is empty" msgstr "addresses is empty" @@ -2722,6 +2424,10 @@ msgstr "arguments must be ndarrays" msgid "array and index length must be equal" msgstr "array and index length must be equal" +#: extmod/ulab/code/numpy/io/io.c +msgid "array has too many dimensions" +msgstr "" + #: py/objarray.c shared-bindings/alarm/SleepMemory.c #: shared-bindings/nvm/ByteArray.c msgid "array/bytes required on right side" @@ -2783,10 +2489,6 @@ msgstr "" msgid "bits must be 32 or less" msgstr "bits must be 32 or less" -#: shared-bindings/busio/UART.c -msgid "bits must be in range 5 to 9" -msgstr "bits must be in range 5 to 9" - #: shared-bindings/audiomixer/Mixer.c msgid "bits_per_sample must be 8 or 16" msgstr "bits_per_sample must be 8 or 16" @@ -2824,11 +2526,6 @@ msgstr "Buffer too small for requested bytes" msgid "byteorder is not a string" msgstr "Byteorder is not a string" -#: ports/atmel-samd/common-hal/busio/UART.c -#: ports/espressif/common-hal/busio/UART.c -msgid "bytes > 8 bits not supported" -msgstr "Bytes > 8 bits not supported" - #: py/objarray.c msgid "bytes length not a multiple of item size" msgstr "Bytes length not a multiple of item size" @@ -2837,7 +2534,7 @@ msgstr "Bytes length not a multiple of item size" msgid "bytes value out of range" msgstr "Bytes value out of range" -#: ports/atmel-samd/bindings/samd/Clock.c ports/atmel-samd/common-hal/rtc/RTC.c +#: ports/atmel-samd/bindings/samd/Clock.c msgid "calibration is out of range" msgstr "Calibration is out of range" @@ -2845,12 +2542,9 @@ msgstr "Calibration is out of range" msgid "calibration is read only" msgstr "Calibration is read only" -#: ports/atmel-samd/common-hal/rtc/RTC.c -msgid "calibration value out of range +/-127" -msgstr "Calibration value out of range +/-127" - +#: shared-module/vectorio/Circle.c shared-module/vectorio/Polygon.c #: shared-module/vectorio/Rectangle.c -msgid "can only be registered in one parent" +msgid "can only have one parent" msgstr "" #: py/emitinlinethumb.c @@ -2873,8 +2567,7 @@ msgstr "Can't assign to expression" msgid "can't cancel self" msgstr "can't cancel self" -#: py/obj.c py/objint.c shared-bindings/i2cperipheral/I2CPeripheral.c -#: shared-module/adafruit_pixelbuf/PixelBuf.c +#: py/obj.c py/objint.c shared-module/adafruit_pixelbuf/PixelBuf.c msgid "can't convert %q to %q" msgstr "Can't convert %q to %q" @@ -3023,6 +2716,10 @@ msgstr "cannot unambiguously get sizeof scalar" msgid "casting" msgstr "casting" +#: ports/stm/common-hal/pwmio/PWMOut.c +msgid "channel re-init" +msgstr "" + #: shared-bindings/_stage/Text.c msgid "chars buffer too small" msgstr "chars buffer too small" @@ -3035,10 +2732,6 @@ msgstr "chr() arg not in range(0x110000)" msgid "chr() arg not in range(256)" msgstr "chr() arg not in range(256)" -#: shared-module/vectorio/Circle.c -msgid "circle can only be registered in one parent" -msgstr "circle can only be registered in one parent" - #: shared-bindings/bitmaptools/__init__.c msgid "clip point must be (x,y) tuple" msgstr "clip point must be (x,y) tuple" @@ -3063,10 +2756,6 @@ msgstr "colour buffer must be a bytearray or array of type 'b' or 'B'" msgid "color must be between 0x000000 and 0xffffff" msgstr "colour must be between 0x000000 and 0xffffff" -#: shared-bindings/displayio/ColorConverter.c -msgid "color should be an int" -msgstr "colour should be an int" - #: py/emitnative.c msgid "comparison of int and uint" msgstr "comparison of int and uint" @@ -3103,6 +2792,10 @@ msgstr "convolve arguments must be ndarrays" msgid "convolve arguments must not be empty" msgstr "convolve arguments must not be empty" +#: extmod/ulab/code/numpy/io/io.c +msgid "corrupted file" +msgstr "" + #: extmod/ulab/code/numpy/poly.c msgid "could not invert Vandermonde matrix" msgstr "could not invert Vandermonde matrix" @@ -3154,10 +2847,6 @@ msgstr "" msgid "destination buffer must be an array of type 'H' for bit_depth = 16" msgstr "destination buffer must be an array of type 'H' for bit_depth = 16" -#: shared-bindings/audiobusio/PDMIn.c -msgid "destination_length must be an int >= 0" -msgstr "destination_length must be an int >= 0" - #: py/objdict.c msgid "dict update sequence has wrong length" msgstr "dict update sequence has wrong length" @@ -3195,6 +2884,10 @@ msgstr "" msgid "empty" msgstr "empty" +#: extmod/ulab/code/numpy/io/io.c +msgid "empty file" +msgstr "" + #: extmod/moduasyncio.c extmod/moduheapq.c extmod/modutimeq.c msgid "empty heap" msgstr "empty heap" @@ -3211,10 +2904,6 @@ msgstr "empty sequence" msgid "end of format while looking for conversion specifier" msgstr "end of format while looking for conversion specifier" -#: shared-bindings/displayio/Shape.c -msgid "end_x should be an int" -msgstr "end_x should be an int" - #: shared-bindings/alarm/time/TimeAlarm.c msgid "epoch_time not supported on this board" msgstr "epoch_time not supported on this board" @@ -3224,6 +2913,12 @@ msgstr "epoch_time not supported on this board" msgid "error = 0x%08lX" msgstr "error = 0x%08lX" +#: ports/espressif/common-hal/esp32_camera/Camera.c +msgid "" +"esp32_camera.Camera requires reserved PSRAM to be configured. See the " +"documentation for instructions." +msgstr "" + #: py/runtime.c msgid "exceptions must derive from BaseException" msgstr "exceptions must derive from BaseException" @@ -3298,7 +2993,7 @@ msgstr "first argument must be a function" msgid "first argument must be a tuple of ndarrays" msgstr "first argument must be a tuple of ndarrays" -#: extmod/ulab/code/numpy/vector.c +#: extmod/ulab/code/numpy/transform.c extmod/ulab/code/numpy/vector.c msgid "first argument must be an ndarray" msgstr "first argument must be an ndarray" @@ -3446,7 +3141,7 @@ msgstr "incomplete format key" msgid "incorrect padding" msgstr "incorrect padding" -#: extmod/ulab/code/ndarray.c +#: extmod/ulab/code/ndarray.c extmod/ulab/code/numpy/transform.c msgid "index is out of bounds" msgstr "index is out of bounds" @@ -3464,6 +3159,10 @@ msgstr "indices must be integers" msgid "indices must be integers, slices, or Boolean lists" msgstr "indices must be integers, slices, or Boolean lists" +#: ports/espressif/common-hal/busio/I2C.c +msgid "init I2C" +msgstr "" + #: extmod/ulab/code/scipy/optimize/optimize.c msgid "initial values must be iterable" msgstr "initial values must be iterable" @@ -3509,6 +3208,10 @@ msgstr "input matrix is asymmetric" msgid "input matrix is singular" msgstr "input matrix is singular" +#: extmod/ulab/code/numpy/create.c +msgid "input must be 1- or 2-d" +msgstr "" + #: extmod/ulab/code/numpy/carray/carray.c msgid "input must be a 1D ndarray" msgstr "" @@ -3517,11 +3220,7 @@ msgstr "" msgid "input must be a dense ndarray" msgstr "input must be a dense ndarray" -#: extmod/ulab/code/numpy/create.c -msgid "input must be a tensor of rank 2" -msgstr "input must be a tensor of rank 2" - -#: extmod/ulab/code/numpy/create.c extmod/ulab/code/user/user.c +#: extmod/ulab/code/user/user.c msgid "input must be an ndarray" msgstr "input must be an ndarray" @@ -3571,6 +3270,10 @@ msgstr "invalid architecture" msgid "invalid bits_per_pixel %d, must be, 1, 2, 4, 8, 16, 24, or 32" msgstr "invalid bits_per_pixel %d, must be, 1, 2, 4, 8, 16, 24, or 32" +#: ports/raspberrypi/common-hal/ssl/SSLSocket.c +msgid "invalid cert" +msgstr "invalid cert" + #: shared-bindings/bitmaptools/__init__.c #, c-format msgid "invalid element size %d for bits_per_pixel %d\n" @@ -3597,10 +3300,18 @@ msgstr "invalid format specifier" msgid "invalid hostname" msgstr "invalid hostname" +#: ports/raspberrypi/common-hal/ssl/SSLSocket.c +msgid "invalid key" +msgstr "invalid key" + #: py/compile.c msgid "invalid micropython decorator" msgstr "invalid micropython decorator" +#: ports/espressif/common-hal/esp32_camera/Camera.c +msgid "invalid setting" +msgstr "" + #: shared-bindings/random/__init__.c msgid "invalid step" msgstr "invalid step" @@ -3714,10 +3425,6 @@ msgstr "math domain error" msgid "matrix is not positive definite" msgstr "matrix is not positive definite" -#: ports/espressif/common-hal/wifi/Radio.c -msgid "max_connections must be between 0 and 10" -msgstr "" - #: ports/espressif/common-hal/_bleio/Descriptor.c #: ports/nrf/common-hal/_bleio/Characteristic.c #: ports/nrf/common-hal/_bleio/Descriptor.c @@ -3725,13 +3432,9 @@ msgstr "" msgid "max_length must be 0-%d when fixed_length is %s" msgstr "max_length must be 0-%d when fixed_length is %s" -#: shared-bindings/_bleio/Characteristic.c shared-bindings/_bleio/Descriptor.c -msgid "max_length must be >= 0" -msgstr "max_length must be >= 0" - #: extmod/ulab/code/ndarray.c -msgid "maximum number of dimensions is 4" -msgstr "maximum number of dimensions is 4" +msgid "maximum number of dimensions is " +msgstr "" #: py/runtime.c msgid "maximum recursion depth exceeded" @@ -3864,7 +3567,7 @@ msgstr "no reset pin available" msgid "no response from SD card" msgstr "no response from SD card" -#: py/objobject.c py/runtime.c +#: ports/espressif/common-hal/esp32_camera/Camera.c py/objobject.c py/runtime.c msgid "no such attribute" msgstr "no such attribute" @@ -3975,7 +3678,11 @@ msgstr "object with buffer protocol required" msgid "odd-length string" msgstr "odd-length string" -#: extmod/ulab/code/numpy/create.c extmod/ulab/code/utils/utils.c +#: supervisor/shared/web_workflow/web_workflow.c +msgid "off" +msgstr "" + +#: extmod/ulab/code/utils/utils.c msgid "offset is too large" msgstr "offset is too large" @@ -4071,10 +3778,6 @@ msgstr "pack expected %d items for packing (got %d)" msgid "palette must be 32 bytes long" msgstr "palette must be 32 bytes long" -#: shared-bindings/displayio/Palette.c -msgid "palette_index should be an int" -msgstr "palette_index should be an int" - #: py/emitinlinextensa.c msgid "parameters must be registers in sequence a2 to a5" msgstr "parameters must be registers in sequence a2 to a5" @@ -4099,10 +3802,6 @@ msgstr "pixel_shader must be displayio.Palette or displayio.ColorConverter" msgid "poll on file not available on win32" msgstr "" -#: shared-module/vectorio/Polygon.c -msgid "polygon can only be registered in one parent" -msgstr "polygon can only be registered in one parent" - #: ports/espressif/common-hal/pulseio/PulseIn.c msgid "pop from an empty PulseIn" msgstr "pop from an empty PulseIn" @@ -4128,7 +3827,23 @@ msgstr "pow() 3rd argument cannot be 0" msgid "pow() with 3 arguments requires integers" msgstr "pow() with 3 arguments requires integers" +#: ports/espressif/boards/adafruit_qtpy_esp32_pico/mpconfigboard.h +msgid "pressing BOOT button at start up.\n" +msgstr "" + +#: ports/espressif/boards/adafruit_feather_esp32_v2/mpconfigboard.h +msgid "pressing SW38 button at start up.\n" +msgstr "" + +#: ports/espressif/boards/hardkernel_odroid_go/mpconfigboard.h +msgid "pressing VOLUME button at start up.\n" +msgstr "" + #: ports/espressif/boards/adafruit_qtpy_esp32c3/mpconfigboard.h +#: ports/espressif/boards/beetle-esp32-c3/mpconfigboard.h +#: ports/espressif/boards/espressif_esp32s2_devkitc_1_n8r2/mpconfigboard.h +#: ports/espressif/boards/lolin_c3_mini/mpconfigboard.h +#: ports/espressif/boards/microdev_micro_c3/mpconfigboard.h #: supervisor/shared/safe_mode.c msgid "pressing boot button at start up.\n" msgstr "pressing boot button at start up.\n" @@ -4149,14 +3864,6 @@ msgstr "pressing the left button at start up\n" msgid "pull masks conflict with direction masks" msgstr "pull masks conflict with direction masks" -#: ports/raspberrypi/bindings/rp2pio/StateMachine.c -msgid "pull_threshold must be between 1 and 32" -msgstr "pull_threshold must be between 1 and 32" - -#: ports/raspberrypi/bindings/rp2pio/StateMachine.c -msgid "push_threshold must be between 1 and 32" -msgstr "push_threshold must be between 1 and 32" - #: extmod/modutimeq.c msgid "queue overflow" msgstr "queue overflow" @@ -4208,14 +3915,6 @@ msgstr "roll argument must be an ndarray" msgid "rsplit(None,n)" msgstr "rsplit(None,n)" -#: shared-bindings/audiocore/RawSample.c -msgid "" -"sample_source buffer must be a bytearray or array of type 'h', 'H', 'b' or " -"'B'" -msgstr "" -"sample_source buffer must be a bytearray or array of type 'h', 'H', 'b' or " -"'B'" - #: ports/atmel-samd/common-hal/audiobusio/PDMIn.c #: ports/raspberrypi/common-hal/audiobusio/PDMIn.c msgid "sampling rate out of range" @@ -4313,26 +4012,14 @@ msgstr "" msgid "source_bitmap must have value_count of 8" msgstr "" -#: shared-bindings/wifi/Radio.c -msgid "ssid can't be more than 32 bytes" -msgstr "" - #: py/objstr.c msgid "start/end indices" msgstr "start/end indices" -#: shared-bindings/displayio/Shape.c -msgid "start_x should be an int" -msgstr "start_x should be an int" - #: shared-bindings/random/__init__.c msgid "step must be non-zero" msgstr "step must be non-zero" -#: shared-bindings/busio/UART.c -msgid "stop must be 1 or 2" -msgstr "stop must be 1 or 2" - #: shared-bindings/random/__init__.c msgid "stop not reachable from start" msgstr "stop not reachable from start" @@ -4381,10 +4068,6 @@ msgstr "syntax error in uctypes descriptor" msgid "threshold must be in the range 0-65536" msgstr "threshold must be in the range 0-65536" -#: shared-bindings/rgbmatrix/RGBMatrix.c -msgid "tile must be greater than zero" -msgstr "tile must be greater than zero" - #: shared-bindings/time/__init__.c msgid "time.struct_time() takes a 9-sequence" msgstr "time.struct_time() takes a 9-sequence" @@ -4404,10 +4087,6 @@ msgstr "timeout must be 0.0-100.0 seconds" msgid "timeout must be < 655.35 secs" msgstr "timeout must be < 655.35 secs" -#: shared-bindings/_bleio/CharacteristicBuffer.c -msgid "timeout must be >= 0.0" -msgstr "timeout must be >= 0.0" - #: shared-module/sdcardio/SDCard.c msgid "timeout waiting for v1 card" msgstr "timeout waiting for v1 card" @@ -4416,6 +4095,10 @@ msgstr "timeout waiting for v1 card" msgid "timeout waiting for v2 card" msgstr "timeout waiting for v2 card" +#: ports/stm/common-hal/pwmio/PWMOut.c +msgid "timer re-init" +msgstr "" + #: shared-bindings/time/__init__.c msgid "timestamp out of range for platform time_t" msgstr "timestamp out of range for platform time_t" @@ -4481,14 +4164,10 @@ msgstr "type '%q' is not an acceptable base type" msgid "type is not an acceptable base type" msgstr "type is not an acceptable base type" -#: py/runtime.c +#: py/objgenerator.c py/runtime.c msgid "type object '%q' has no attribute '%q'" msgstr "type object '%q' has no attribute '%q'" -#: py/objgenerator.c -msgid "type object 'generator' has no attribute '__await__'" -msgstr "type object 'generator' has no attribute '__await__'" - #: py/objtype.c msgid "type takes 1 or 3 arguments" msgstr "type takes 1 or 3 arguments" @@ -4547,7 +4226,6 @@ msgid "unreadable attribute" msgstr "unreadable attribute" #: shared-bindings/displayio/TileGrid.c shared-bindings/vectorio/VectorShape.c -#: shared-module/vectorio/Polygon.c shared-module/vectorio/VectorShape.c msgid "unsupported %q type" msgstr "unsupported %q type" @@ -4586,6 +4264,14 @@ msgstr "unsupported type for operator" msgid "unsupported types for %q: '%q', '%q'" msgstr "unsupported types for %q: '%q', '%q'" +#: extmod/ulab/code/numpy/io/io.c +msgid "usecols is too high" +msgstr "" + +#: extmod/ulab/code/numpy/io/io.c +msgid "usecols keyword must be specified" +msgstr "" + #: py/objint.c #, c-format msgid "value must fit in %d byte(s)" @@ -4607,20 +4293,19 @@ msgstr "WatchDog not initialised" msgid "watchdog timeout must be greater than 0" msgstr "WatchDog timeout must be greater than 0" -#: shared-bindings/bitops/__init__.c -#, c-format -msgid "width must be from 2 to 8 (inclusive), not %d" -msgstr "width must be from 2 to 8 (inclusive), not %d" - #: shared-bindings/is31fl3741/FrameBuffer.c -#: shared-bindings/rgbmatrix/RGBMatrix.c msgid "width must be greater than zero" msgstr "width must be greater than zero" #: ports/espressif/common-hal/wifi/Radio.c +#: ports/raspberrypi/common-hal/wifi/Radio.c msgid "wifi is not enabled" msgstr "WiFi is not enabled" +#: ports/raspberrypi/common-hal/wifi/Monitor.c +msgid "wifi.Monitor not available" +msgstr "" + #: shared-bindings/_bleio/Adapter.c msgid "window must be <= interval" msgstr "window must be <= interval" @@ -4633,7 +4318,17 @@ msgstr "wrong axis index" msgid "wrong axis specified" msgstr "wrong axis specified" -#: extmod/ulab/code/numpy/compare.c extmod/ulab/code/numpy/vector.c +#: extmod/ulab/code/numpy/io/io.c +msgid "wrong dtype" +msgstr "" + +#: extmod/ulab/code/numpy/transform.c +msgid "wrong index type" +msgstr "" + +#: extmod/ulab/code/numpy/compare.c extmod/ulab/code/numpy/create.c +#: extmod/ulab/code/numpy/io/io.c extmod/ulab/code/numpy/transform.c +#: extmod/ulab/code/numpy/vector.c msgid "wrong input type" msgstr "wrong input type" @@ -4641,6 +4336,10 @@ msgstr "wrong input type" msgid "wrong length of condition array" msgstr "" +#: extmod/ulab/code/numpy/transform.c +msgid "wrong length of index array" +msgstr "" + #: extmod/ulab/code/numpy/create.c py/objarray.c py/objstr.c msgid "wrong number of arguments" msgstr "wrong number of arguments" @@ -4661,10 +4360,6 @@ msgstr "x value out of bounds" msgid "xTaskCreate failed" msgstr "xTaskCreate failed" -#: shared-bindings/displayio/Shape.c -msgid "y should be an int" -msgstr "y should be an int" - #: shared-module/displayio/Shape.c msgid "y value out of bounds" msgstr "y value out of bounds" @@ -4685,6 +4380,397 @@ msgstr "zi must be of float type" msgid "zi must be of shape (n_section, 2)" msgstr "zi must be of shape (n_section, 2)" +#~ msgid "Stream missing readinto() or write() method." +#~ msgstr "Stream missing readinto() or write() method." + +#~ msgid "%q must be >= 0" +#~ msgstr "%q must be >= 0" + +#~ msgid "%q must be >= 1" +#~ msgstr "%q must be >= 1" + +#~ msgid "address out of bounds" +#~ msgstr "address out of bounds" + +#~ msgid "destination_length must be an int >= 0" +#~ msgstr "destination_length must be an int >= 0" + +#~ msgid "type object 'generator' has no attribute '__await__'" +#~ msgstr "type object 'generator' has no attribute '__await__'" + +#~ msgid "color should be an int" +#~ msgstr "colour should be an int" + +#~ msgid "end_x should be an int" +#~ msgstr "end_x should be an int" + +#~ msgid "palette_index should be an int" +#~ msgstr "palette_index should be an int" + +#~ msgid "start_x should be an int" +#~ msgstr "start_x should be an int" + +#~ msgid "y should be an int" +#~ msgstr "y should be an int" + +#~ msgid "" +#~ "sample_source buffer must be a bytearray or array of type 'h', 'H', 'b' " +#~ "or 'B'" +#~ msgstr "" +#~ "sample_source buffer must be a bytearray or array of type 'h', 'H', 'b' " +#~ "or 'B'" + +#~ msgid "Expected an alarm" +#~ msgstr "Expected an alarm" + +#~ msgid "Failed to init wifi" +#~ msgstr "Failed to init WiFi" + +#~ msgid "input must be a tensor of rank 2" +#~ msgstr "input must be a tensor of rank 2" + +#~ msgid "maximum number of dimensions is 4" +#~ msgstr "maximum number of dimensions is 4" + +#~ msgid "Watchdog timer expired." +#~ msgstr "WatchDog timer expired." + +#~ msgid "%q must be a tuple of length 2" +#~ msgstr "%q must be a tuple of length 2" + +#~ msgid "%q must be between %d and %d" +#~ msgstr "%q must be between %d and %d" + +#~ msgid "%q should be an int" +#~ msgstr "%q should be an int" + +#~ msgid "(x,y) integers required" +#~ msgstr "(x,y) integers required" + +#~ msgid "Address type out of range" +#~ msgstr "Address type out of range" + +#~ msgid "AnalogIn not supported on given pin" +#~ msgstr "AnalogIn not supported on given pin" + +#~ msgid "AnalogOut functionality not supported" +#~ msgstr "AnalogOut functionality not supported" + +#~ msgid "AnalogOut is only 16 bits. Value must be less than 65536." +#~ msgstr "AnalogOut is only 16 bits. Value must be less than 65536." + +#~ msgid "AnalogOut not supported on given pin" +#~ msgstr "AnalogOut not supported on given pin" + +#, c-format +#~ msgid "Bit depth must be from 1 to 6 inclusive, not %d" +#~ msgstr "Bit depth must be from 1 to 6 inclusive, not %d" + +#, c-format +#~ msgid "Buffer incorrect size. Should be %d bytes." +#~ msgstr "Buffer incorrect size. Should be %d bytes." + +#~ msgid "Buffer must be at least length 1" +#~ msgstr "Buffer must be at least length 1" + +#~ msgid "Bytes must be between 0 and 255." +#~ msgstr "Bytes must be between 0 and 255." + +#~ msgid "Cannot output both channels on the same pin" +#~ msgstr "Cannot output both channels on the same pin" + +#~ msgid "Cannot read without MISO pin." +#~ msgstr "Cannot read without MISO pin." + +#~ msgid "Cannot reset into bootloader because no bootloader is present." +#~ msgstr "Cannot reset into bootloader because no bootloader is present." + +#~ msgid "Cannot transfer without MOSI and MISO pins." +#~ msgstr "Cannot transfer without MOSI and MISO pins." + +#~ msgid "Cannot write without MOSI pin." +#~ msgstr "Cannot write without MOSI pin." + +#~ msgid "Clock pin init failed." +#~ msgstr "Clock pin init failed." + +#~ msgid "Command must be an int between 0 and 255" +#~ msgstr "Command must be an int between 0 and 255" + +#~ msgid "Could not initialize Camera" +#~ msgstr "Could not initialise camera" + +#~ msgid "Could not initialize GNSS" +#~ msgstr "Could not initialise GNSS" + +#~ msgid "Could not initialize SDCard" +#~ msgstr "Could not initialise SDCard" + +#~ msgid "Could not initialize UART" +#~ msgstr "Could not initialise UART" + +#~ msgid "Could not re-init channel" +#~ msgstr "Could not reinit channel" + +#~ msgid "Could not re-init timer" +#~ msgstr "Could not reinit timer" + +#~ msgid "Could not restart PWM" +#~ msgstr "Could not restart PWM" + +#~ msgid "Couldn't allocate first buffer" +#~ msgstr "Couldn't allocate first buffer" + +#~ msgid "Couldn't allocate input buffer" +#~ msgstr "Couldn't allocate input buffer" + +#~ msgid "Couldn't allocate second buffer" +#~ msgstr "Couldn't allocate second buffer" + +#~ msgid "DigitalInOut not supported on given pin" +#~ msgstr "DigitalInOut not supported on given pin" + +#, c-format +#~ msgid "Expected tuple of length %d, got %d" +#~ msgstr "Expected tuple of length %d, got %d" + +#~ msgid "Failed to allocate RX buffer" +#~ msgstr "Failed to allocate RX buffer" + +#, c-format +#~ msgid "Failed to allocate RX buffer of %d bytes" +#~ msgstr "Failed to allocate RX buffer of %d bytes" + +#, c-format +#~ msgid "Framebuffer requires %d bytes" +#~ msgstr "Framebuffer requires %d bytes" + +#~ msgid "Hostname must be between 1 and 253 characters" +#~ msgstr "Hostname must be between 1 and 253 characters" + +#~ msgid "I2C Init Error" +#~ msgstr "I2C init error" + +#~ msgid "Invalid %q pin selection" +#~ msgstr "Invalid %q pin selection" + +#~ msgid "Invalid AuthMode" +#~ msgstr "Invalid AuthMode" + +#~ msgid "Invalid BMP file" +#~ msgstr "Invalid BMP file" + +#~ msgid "Invalid DAC pin supplied" +#~ msgstr "Invalid DAC pin supplied" + +#~ msgid "Invalid MIDI file" +#~ msgstr "Invalid MIDI file" + +#~ msgid "Invalid PWM frequency" +#~ msgstr "Invalid PWM frequency" + +#~ msgid "Invalid Pin" +#~ msgstr "Invalid pin" + +#~ msgid "Invalid buffer size" +#~ msgstr "Invalid buffer size" + +#~ msgid "Invalid byteorder string" +#~ msgstr "Invalid byteorder string" + +#~ msgid "Invalid capture period. Valid range: 1 - 500" +#~ msgstr "Invalid capture period. Valid range: 1 - 500" + +#~ msgid "Invalid channel count" +#~ msgstr "Invalid channel count" + +#, c-format +#~ msgid "Invalid data_count %d" +#~ msgstr "Invalid data_count %d" + +#~ msgid "Invalid direction." +#~ msgstr "Invalid direction." + +#~ msgid "Invalid file" +#~ msgstr "Invalid file" + +#~ msgid "Invalid number of bits" +#~ msgstr "Invalid number of bits" + +#~ msgid "Invalid phase" +#~ msgstr "Invalid phase" + +#~ msgid "Invalid pin" +#~ msgstr "Invalid pin" + +#~ msgid "Invalid pin for left channel" +#~ msgstr "Invalid pin for left channel" + +#~ msgid "Invalid pin for right channel" +#~ msgstr "Invalid pin for right channel" + +#~ msgid "Invalid polarity" +#~ msgstr "Invalid polarity" + +#~ msgid "Invalid properties" +#~ msgstr "Invalid properties" + +#~ msgid "Invalid run mode." +#~ msgstr "Invalid run mode." + +#~ msgid "Invalid security_mode" +#~ msgstr "Invalid security_mode" + +#~ msgid "Invalid voice" +#~ msgstr "Invalid voice" + +#~ msgid "Invalid voice count" +#~ msgstr "Invalid voice count" + +#~ msgid "Invalid wave file" +#~ msgstr "Invalid wave file" + +#~ msgid "Invalid word/bit length" +#~ msgstr "Invalid word/bit length" + +#~ msgid "Layer already in a group." +#~ msgstr "Layer already in a group." + +#~ msgid "Layer must be a Group or TileGrid subclass." +#~ msgstr "Layer must be a Group or TileGrid subclass." + +#~ msgid "MISO pin init failed." +#~ msgstr "MISO pin init failed." + +#~ msgid "MOSI pin init failed." +#~ msgstr "MOSI pin init failed." + +#~ msgid "Messages limited to 8 bytes" +#~ msgstr "Messages limited to 8 bytes" + +#, c-format +#~ msgid "More than %d report ids not supported" +#~ msgstr "More than %d report ids not supported" + +#~ msgid "No hardware support on clk pin" +#~ msgstr "No hardware support on clk pin" + +#~ msgid "No hardware support on pin" +#~ msgstr "No hardware support on pin" + +#, c-format +#~ msgid "Output buffer must be at least %d bytes" +#~ msgstr "Output buffer must be at least %d bytes" + +#~ msgid "" +#~ "PWM duty_cycle must be between 0 and 65535 inclusive (16 bit resolution)" +#~ msgstr "" +#~ "PWM duty_cycle must be between 0 and 65535 inclusive (16 bit resolution)" + +#~ msgid "Pin count must be at least 1" +#~ msgstr "Pin count must be at least 1" + +#~ msgid "Pin does not have ADC capabilities" +#~ msgstr "Pin does not have ADC capabilities" + +#~ msgid "Program must contain at least one 16-bit instruction." +#~ msgstr "Program must contain at least one 16-bit instruction." + +#~ msgid "Program too large" +#~ msgstr "Program too large" + +#~ msgid "RS485 Not yet supported on this device" +#~ msgstr "RS485 not yet supported on this device" + +#~ msgid "RTC calibration is not supported on this board" +#~ msgstr "RTC calibration is not supported on this board" + +#~ msgid "RTS/CTS/RS485 Not yet supported on this device" +#~ msgstr "RTS/CTS/RS485 not yet supported on this device" + +#~ msgid "SPI Init Error" +#~ msgstr "SPI init error" + +#~ msgid "SPI Re-initialization error" +#~ msgstr "SPI reinitialisation error" + +#~ msgid "Sample rate must be positive" +#~ msgstr "Sample rate must be positive" + +#, c-format +#~ msgid "Sample rate too high. It must be less than %d" +#~ msgstr "Sample rate too high. It must be less than %d" + +#~ msgid "Set pin count must be between 1 and 5" +#~ msgstr "Set pin count must be between 1 and 5" + +#~ msgid "Side set pin count must be between 1 and 5" +#~ msgstr "Side set pin count must be between 1 and 5" + +#~ msgid "Stack size must be at least 256" +#~ msgstr "Stack size must be at least 256" + +#~ msgid "Tile value out of bounds" +#~ msgstr "Tile value out of bounds" + +#~ msgid "UART Buffer allocation error" +#~ msgstr "UART buffer allocation error" + +#~ msgid "UART De-init error" +#~ msgstr "UART deinit error" + +#~ msgid "UART Init Error" +#~ msgstr "UART init Error" + +#~ msgid "UART Re-init error" +#~ msgstr "UART reinit error" + +#~ msgid "UART write error" +#~ msgstr "UART write error" + +#~ msgid "Unsupported baudrate" +#~ msgstr "Unsupported baudrate" + +#~ msgid "WiFi password must be between 8 and 63 characters" +#~ msgstr "WiFi password must be between 8 and 63 characters" + +#~ msgid "bits must be in range 5 to 9" +#~ msgstr "bits must be in range 5 to 9" + +#~ msgid "bytes > 8 bits not supported" +#~ msgstr "Bytes > 8 bits not supported" + +#~ msgid "calibration value out of range +/-127" +#~ msgstr "Calibration value out of range +/-127" + +#~ msgid "circle can only be registered in one parent" +#~ msgstr "circle can only be registered in one parent" + +#~ msgid "max_length must be >= 0" +#~ msgstr "max_length must be >= 0" + +#~ msgid "polygon can only be registered in one parent" +#~ msgstr "polygon can only be registered in one parent" + +#~ msgid "pull_threshold must be between 1 and 32" +#~ msgstr "pull_threshold must be between 1 and 32" + +#~ msgid "push_threshold must be between 1 and 32" +#~ msgstr "push_threshold must be between 1 and 32" + +#~ msgid "stop must be 1 or 2" +#~ msgstr "stop must be 1 or 2" + +#~ msgid "tile must be greater than zero" +#~ msgstr "tile must be greater than zero" + +#~ msgid "timeout must be >= 0.0" +#~ msgstr "timeout must be >= 0.0" + +#, c-format +#~ msgid "width must be from 2 to 8 (inclusive), not %d" +#~ msgstr "width must be from 2 to 8 (inclusive), not %d" + #~ msgid "Unsupported operation" #~ msgstr "Unsupported operation" @@ -4974,12 +5060,6 @@ msgstr "zi must be of shape (n_section, 2)" #~ msgid "can only save bytecode" #~ msgstr "Can only save bytecode" -#~ msgid "invalid cert" -#~ msgstr "invalid cert" - -#~ msgid "invalid key" -#~ msgstr "invalid key" - #~ msgid "Viper functions don't currently support more than 4 arguments" #~ msgstr "Viper functions don't currently support more than 4 arguments" diff --git a/locale/es.po b/locale/es.po index d1e4f3205e..2397b2947e 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: 2021-01-04 12:55-0600\n" -"PO-Revision-Date: 2021-08-23 14:19+0000\n" -"Last-Translator: Jeff Epler \n" +"PO-Revision-Date: 2022-09-23 17:20+0000\n" +"Last-Translator: Alvaro Figueroa \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.8.1-dev\n" +"X-Generator: Weblate 4.14.1\n" #: main.c msgid "" @@ -31,6 +31,8 @@ msgid "" "\n" "Code stopped by auto-reload. Reloading soon.\n" msgstr "" +"\n" +"Código detenido por la auto-recarga. Recargando pronto.\n" #: supervisor/shared/safe_mode.c msgid "" @@ -67,6 +69,11 @@ msgstr " salida:\n" msgid "%%c requires int or char" msgstr "%%c requiere int o char" +#: main.c +#, c-format +msgid "%02X" +msgstr "" + #: shared-bindings/rgbmatrix/RGBMatrix.c #, c-format msgid "" @@ -75,28 +82,42 @@ msgstr "" "%d pines de dirección, %d pines rgb y %d tiles indican una altura de %d, y " "no de %d" +#: ports/atmel-samd/common-hal/alarm/__init__.c +#: ports/cxd56/common-hal/analogio/AnalogOut.c ports/cxd56/common-hal/rtc/RTC.c +#: ports/espressif/common-hal/rtc/RTC.c +#: ports/mimxrt10xx/common-hal/analogio/AnalogOut.c +#: ports/mimxrt10xx/common-hal/rtc/RTC.c ports/nrf/common-hal/alarm/__init__.c +#: ports/nrf/common-hal/analogio/AnalogOut.c ports/nrf/common-hal/rtc/RTC.c +#: ports/raspberrypi/common-hal/alarm/__init__.c +#: ports/raspberrypi/common-hal/analogio/AnalogOut.c +#: ports/raspberrypi/common-hal/rtc/RTC.c ports/stm/common-hal/alarm/__init__.c +#: ports/stm/common-hal/rtc/RTC.c +#, fuzzy +msgid "%q" +msgstr "%q" + #: shared-bindings/microcontroller/Pin.c msgid "%q and %q contain duplicate pins" -msgstr "" +msgstr "%q y %q contienen pines duplicados" + +#: ports/atmel-samd/common-hal/audioio/AudioOut.c +msgid "%q and %q must be different" +msgstr "%q y %q deben ser diferentes" #: shared-bindings/microcontroller/Pin.c msgid "%q contains duplicate pins" -msgstr "" +msgstr "%q contiene pines duplicados" #: ports/atmel-samd/common-hal/sdioio/SDCard.c msgid "%q failure: %d" msgstr "%q fallo: %d" +#: shared-bindings/digitalio/DigitalInOut.c #: shared-bindings/microcontroller/Pin.c msgid "%q in use" msgstr "%q está siendo utilizado" -#: ports/atmel-samd/common-hal/pulseio/PulseIn.c -#: ports/cxd56/common-hal/pulseio/PulseIn.c -#: ports/nrf/common-hal/pulseio/PulseIn.c -#: ports/raspberrypi/common-hal/pulseio/PulseIn.c -#: ports/stm/common-hal/pulseio/PulseIn.c py/obj.c py/objstr.c -#: py/objstrunicode.c +#: py/obj.c py/objstr.c py/objstrunicode.c msgid "%q index out of range" msgstr "%q indice fuera de rango" @@ -104,13 +125,33 @@ msgstr "%q indice fuera de rango" msgid "%q indices must be integers, not %s" msgstr "%q indices deben ser enteros, no %s" +#: shared-module/bitbangio/SPI.c +msgid "%q init failed" +msgstr "%q inicializado fallido" + +#: py/argcheck.c +msgid "%q length must be %d" +msgstr "%q tamaño debe ser %d" + #: py/argcheck.c msgid "%q length must be %d-%d" -msgstr "" +msgstr "%q tamaño debe ser %d-%d" -#: shared-bindings/busio/I2C.c shared-bindings/usb_hid/Device.c +#: py/argcheck.c +msgid "%q length must be <= %d" +msgstr "%q tamaño debe ser <= %d" + +#: py/argcheck.c +msgid "%q length must be >= %d" +msgstr "%q tamaño debe ser >= %d" + +#: shared-bindings/busio/I2C.c msgid "%q length must be >= 1" -msgstr "" +msgstr "%q tamaño debe ser >= 1" + +#: py/argcheck.c +msgid "%q must be %d" +msgstr "%q debe ser %d" #: py/argcheck.c msgid "%q must be %d-%d" @@ -118,40 +159,28 @@ msgstr "%q debe ser %d-%d" #: shared-bindings/displayio/Display.c msgid "%q must be 1 when %q is True" -msgstr "" +msgstr "%q debe ser 1 cuando %q es True" #: py/argcheck.c shared-bindings/gifio/GifWriter.c msgid "%q must be <= %d" -msgstr "" +msgstr "%q debe ser <= %d" #: py/argcheck.c msgid "%q must be >= %d" msgstr "%q debe ser >= %d" -#: py/argcheck.c shared-bindings/memorymonitor/AllocationAlarm.c -msgid "%q must be >= 0" -msgstr "%q debe ser >= 0" - -#: shared-bindings/_bleio/CharacteristicBuffer.c -#: shared-bindings/_bleio/PacketBuffer.c shared-bindings/displayio/Group.c -#: shared-bindings/displayio/Shape.c -#: shared-bindings/memorymonitor/AllocationAlarm.c -#: shared-bindings/vectorio/Circle.c shared-bindings/vectorio/Rectangle.c -msgid "%q must be >= 1" -msgstr "%q debe ser >= 1" +#: shared-bindings/analogbufio/BufferedIn.c +#: shared-bindings/audiocore/RawSample.c +msgid "%q must be a bytearray or array of type 'h', 'H', 'b', or 'B'" +msgstr "" #: py/argcheck.c msgid "%q must be a string" msgstr "%q debe ser una cadena" -#: shared-module/vectorio/Polygon.c -msgid "%q must be a tuple of length 2" -msgstr "%q debe ser una tupla de longitud 2" - -#: ports/espressif/common-hal/imagecapture/ParallelImageCapture.c -#: shared-module/vectorio/VectorShape.c -msgid "%q must be between %d and %d" -msgstr "%q debe estar entre %d y %d" +#: py/argcheck.c +msgid "%q must be an int" +msgstr "" #: py/argcheck.c msgid "%q must be of type %q" @@ -169,7 +198,11 @@ msgstr "" msgid "%q out of bounds" msgstr "" +#: ports/atmel-samd/common-hal/pulseio/PulseIn.c +#: ports/cxd56/common-hal/pulseio/PulseIn.c +#: ports/nrf/common-hal/pulseio/PulseIn.c #: ports/raspberrypi/common-hal/rp2pio/StateMachine.c +#: ports/stm/common-hal/pulseio/PulseIn.c py/argcheck.c #: shared-bindings/canio/Match.c msgid "%q out of range" msgstr "%q fuera de rango" @@ -178,10 +211,6 @@ msgstr "%q fuera de rango" msgid "%q pin invalid" msgstr "pin inválido %q" -#: shared-bindings/fontio/BuiltinFont.c -msgid "%q should be an int" -msgstr "%q debe ser un int" - #: shared-bindings/usb_hid/Device.c msgid "%q with a report ID of 0 must be of length 1" msgstr "" @@ -194,7 +223,11 @@ msgstr "%q() toma %d argumentos posicionales pero %d fueron dados" msgid "%q, %q, and %q must all be the same length" msgstr "" -#: ports/espressif/bindings/espidf/__init__.c ports/espressif/esp_error.c +#: py/objint.c +msgid "%q=%q" +msgstr "" + +#: ports/espressif/common-hal/espidf/__init__.c ports/espressif/esp_error.c #, c-format msgid "%s error 0x%x" msgstr "%s error 0x%x" @@ -279,7 +312,7 @@ msgstr "'%s' el objeto no tiene capacidad de asignación de item" msgid "'%s' object doesn't support item deletion" msgstr "'%s' el objeto no tiene capacidad de borrado de item" -#: py/runtime.c +#: ports/raspberrypi/common-hal/wifi/Radio.c py/runtime.c msgid "'%s' object has no attribute '%q'" msgstr "objeto '%s' no tiene atributo '%q'" @@ -344,10 +377,6 @@ msgstr "'yield from' dentro de una función asincrónica" msgid "'yield' outside function" msgstr "'yield' fuera de una función" -#: shared-module/vectorio/VectorShape.c -msgid "(x,y) integers required" -msgstr "" - #: py/compile.c msgid "*x must be assignment target" msgstr "*x debe ser objetivo de la tarea" @@ -383,16 +412,12 @@ msgstr "ADC2 está siendo usado por WiFi" msgid "Address must be %d bytes long" msgstr "La dirección debe tener %d bytes de largo" -#: shared-bindings/_bleio/Address.c -msgid "Address type out of range" -msgstr "Tipo de dirección fuera de rango" - #: ports/espressif/common-hal/canio/CAN.c msgid "All CAN peripherals are in use" msgstr "Todos los periféricos CAN están en uso" #: ports/espressif/common-hal/busio/I2C.c -#: ports/espressif/common-hal/i2cperipheral/I2CPeripheral.c +#: ports/espressif/common-hal/i2ctarget/I2CTarget.c #: ports/nrf/common-hal/busio/I2C.c msgid "All I2C peripherals are in use" msgstr "Todos los periféricos I2C están siendo usados" @@ -429,7 +454,6 @@ msgstr "Todos los canales esta en uso" msgid "All event channels in use" msgstr "Todos los canales de eventos estan siendo usados" -#: ports/raspberrypi/common-hal/pulseio/PulseIn.c #: ports/raspberrypi/common-hal/rp2pio/StateMachine.c msgid "All state machines in use" msgstr "Todas las máquinas de estado en uso" @@ -476,28 +500,10 @@ msgid "Already running" msgstr "Ya está en ejecución" #: ports/espressif/common-hal/wifi/Radio.c +#: ports/raspberrypi/common-hal/wifi/Radio.c msgid "Already scanning for wifi networks" msgstr "Ya se están buscando redes wifi" -#: ports/cxd56/common-hal/analogio/AnalogIn.c -msgid "AnalogIn not supported on given pin" -msgstr "El pin proporcionado no soporta AnalogIn" - -#: ports/cxd56/common-hal/analogio/AnalogOut.c -#: ports/mimxrt10xx/common-hal/analogio/AnalogOut.c -#: ports/nrf/common-hal/analogio/AnalogOut.c -#: ports/raspberrypi/common-hal/analogio/AnalogOut.c -msgid "AnalogOut functionality not supported" -msgstr "Funcionalidad AnalogOut no soportada" - -#: shared-bindings/analogio/AnalogOut.c -msgid "AnalogOut is only 16 bits. Value must be less than 65536." -msgstr "AnalogOut es solo de 16 bits. El valor debe ser menor que 65536." - -#: ports/atmel-samd/common-hal/analogio/AnalogOut.c -msgid "AnalogOut not supported on given pin" -msgstr "El pin proporcionado no soporta AnalogOut" - #: ports/stm/common-hal/audiopwmio/PWMAudioOut.c msgid "Another PWMAudioOut is already active" msgstr "Otra salida PWMAudioOut esta ya activada" @@ -536,7 +542,7 @@ msgstr "" msgid "AuthMode.OPEN is not used with password" msgstr "AuthMode.OPEN no se usa con contraseña" -#: shared-bindings/wifi/Radio.c +#: shared-bindings/wifi/Radio.c supervisor/shared/web_workflow/web_workflow.c msgid "Authentication failure" msgstr "Fallo de autenticación" @@ -569,11 +575,6 @@ msgstr "Le reloj de bit y de selector de palabra deben ser pines secuenciales" 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 "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." msgstr "Bits depth debe ser múltiplo de 8." @@ -616,11 +617,6 @@ msgid "Buffer elements must be 4 bytes long or less" msgstr "" "Los elementos del búfer deben de ser de una longitud de 4 bytes o menos" -#: shared-module/usb_hid/Device.c -#, c-format -msgid "Buffer incorrect size. Should be %d bytes." -msgstr "Tamaño de buffer incorrecto. Debe ser de %d bytes." - #: shared-bindings/framebufferio/FramebufferDisplay.c msgid "Buffer is not a bytearray." msgstr "Buffer no es un bytearray." @@ -630,7 +626,6 @@ msgstr "Buffer no es un bytearray." msgid "Buffer is too small" msgstr "El buffer es muy pequeño" -#: ports/nrf/common-hal/audiopwmio/PWMAudioOut.c #: ports/stm/common-hal/audiopwmio/PWMAudioOut.c #, c-format msgid "Buffer length %d too big. It must be less than %d" @@ -645,10 +640,6 @@ msgstr "El tamaño del búfer debe ser múltiplo de 512" msgid "Buffer must be a multiple of 512 bytes" msgstr "Búfer deber ser un múltiplo de 512 bytes" -#: shared-bindings/bitbangio/I2C.c -msgid "Buffer must be at least length 1" -msgstr "Buffer debe ser de longitud 1 como minimo" - #: shared-bindings/_bleio/PacketBuffer.c #, c-format msgid "Buffer too short by %d bytes" @@ -670,10 +661,6 @@ msgstr "Bus pin %d ya está siendo utilizado" msgid "Byte buffer must be 16 bytes." msgstr "Búfer Byte debe de ser 16 bytes." -#: shared-bindings/alarm/SleepMemory.c shared-bindings/nvm/ByteArray.c -msgid "Bytes must be between 0 and 255." -msgstr "Bytes debe estar entre 0 y 255." - #: shared-bindings/aesio/aes.c msgid "CBC blocks must be multiples of 16 bytes" msgstr "Los bloques CBC deben ser múltiplos de 16 bytes" @@ -682,7 +669,7 @@ msgstr "Los bloques CBC deben ser múltiplos de 16 bytes" msgid "CIRCUITPY drive could not be found or created." msgstr "" -#: ports/espressif/bindings/espidf/__init__.c ports/espressif/esp_error.c +#: ports/espressif/common-hal/espidf/__init__.c ports/espressif/esp_error.c msgid "CRC or checksum was invalid" msgstr "CRC o suma de comprobación inválida" @@ -690,6 +677,10 @@ msgstr "CRC o suma de comprobación inválida" msgid "Call super().__init__() before accessing native object." msgstr "Llame a super().__init__() antes de acceder al objeto nativo." +#: ports/cxd56/common-hal/camera/Camera.c +msgid "Camera init" +msgstr "" + #: ports/espressif/common-hal/alarm/pin/PinAlarm.c msgid "Can only alarm on RTC IO from deep sleep." msgstr "Solo puede alertar en RTC IO de deep sleep." @@ -741,18 +732,10 @@ msgstr "" "No se pueden obtener respuestas de exploración para anuncios extendidos y " "conectables." -#: ports/atmel-samd/common-hal/audioio/AudioOut.c -msgid "Cannot output both channels on the same pin" -msgstr "No se puede tener ambos canales en el mismo pin" - #: ports/espressif/common-hal/alarm/pin/PinAlarm.c msgid "Cannot pull on input-only pin." msgstr "No puede hacer pull en un pin de entrada sola." -#: shared-module/bitbangio/SPI.c -msgid "Cannot read without MISO pin." -msgstr "No se puede leer sin pin MISO." - #: shared-bindings/audiobusio/PDMIn.c msgid "Cannot record to a file" msgstr "No se puede grabar en un archivo" @@ -764,8 +747,8 @@ msgstr "No se puede remountar '/' cuanto se es visible vía USB." #: ports/atmel-samd/common-hal/microcontroller/__init__.c #: ports/cxd56/common-hal/microcontroller/__init__.c #: ports/mimxrt10xx/common-hal/microcontroller/__init__.c -msgid "Cannot reset into bootloader because no bootloader is present." -msgstr "No se puede reiniciar a bootloader porque no hay bootloader presente." +msgid "Cannot reset into bootloader because no bootloader is present" +msgstr "" #: ports/espressif/common-hal/socketpool/Socket.c msgid "Cannot set socket options" @@ -785,22 +768,21 @@ msgid "Cannot subclass slice" msgstr "No se puede manejar la partición en una subclase" #: shared-module/bitbangio/SPI.c -msgid "Cannot transfer without MOSI and MISO pins." -msgstr "No se puede transmitir sin pines MOSI y MISO." +msgid "Cannot transfer without MOSI and MISO pins" +msgstr "" #: shared-bindings/pwmio/PWMOut.c msgid "Cannot vary frequency on a timer that is already in use" msgstr "No puede variar la frecuencia en un temporizador que ya está en uso" -#: ports/espressif/common-hal/alarm/pin/PinAlarm.c #: ports/nrf/common-hal/alarm/pin/PinAlarm.c +msgid "Cannot wake on pin edge, only level" +msgstr "" + +#: ports/espressif/common-hal/alarm/pin/PinAlarm.c msgid "Cannot wake on pin edge. Only level." msgstr "No puede despertar en pin edge, solo en nivel." -#: shared-module/bitbangio/SPI.c -msgid "Cannot write without MOSI pin." -msgstr "No se puede escribir sin pin MOSI." - #: shared-bindings/_bleio/CharacteristicBuffer.c msgid "CharacteristicBuffer writing not provided" msgstr "CharateristicBuffer escritura no proporcionada" @@ -813,10 +795,6 @@ msgstr "El código central de CircuitPython se estrelló con fuerza. ¡Whoops!\n msgid "CircuitPython was unable to allocate the heap." msgstr "CircuitPython no puedo encontrar el montículo." -#: shared-module/bitbangio/SPI.c -msgid "Clock pin init failed." -msgstr "Iniciado de pin de reloj fallido." - #: shared-module/bitbangio/I2C.c msgid "Clock stretch too long" msgstr "Estirado de reloj demasiado largo" @@ -825,11 +803,6 @@ msgstr "Estirado de reloj demasiado largo" msgid "Clock unit in use" msgstr "Clock unit está siendo utilizado" -#: shared-bindings/displayio/FourWire.c shared-bindings/displayio/I2CDisplay.c -#: shared-bindings/paralleldisplay/ParallelBus.c -msgid "Command must be an int between 0 and 255" -msgstr "Command debe ser un int entre 0 y 255" - #: shared-bindings/_bleio/Connection.c msgid "" "Connection has been disconnected and can no longer be used. Create a new " @@ -842,35 +815,6 @@ msgstr "" msgid "Corrupt .mpy file" msgstr "Archivo .mpy corrupto" -#: ports/cxd56/common-hal/camera/Camera.c -msgid "Could not initialize Camera" -msgstr "No se puede inicializar Camera" - -#: ports/cxd56/common-hal/gnss/GNSS.c -msgid "Could not initialize GNSS" -msgstr "No se pudo inicializar el GNSS" - -#: ports/cxd56/common-hal/sdioio/SDCard.c -msgid "Could not initialize SDCard" -msgstr "No se pudo inicializar SDCard" - -#: ports/atmel-samd/common-hal/busio/UART.c ports/cxd56/common-hal/busio/UART.c -#: ports/espressif/common-hal/busio/UART.c -msgid "Could not initialize UART" -msgstr "No se puede inicializar la UART" - -#: ports/stm/common-hal/pwmio/PWMOut.c -msgid "Could not re-init channel" -msgstr "No se pudo reiniciar el canal" - -#: ports/stm/common-hal/pwmio/PWMOut.c -msgid "Could not re-init timer" -msgstr "No se pudo reiniciar el temporizador" - -#: ports/stm/common-hal/pwmio/PWMOut.c -msgid "Could not restart PWM" -msgstr "No se pudo reiniciar el PWM" - #: ports/espressif/common-hal/neopixel_write/__init__.c msgid "Could not retrieve clock" msgstr "No puedo traer el reloj" @@ -891,20 +835,6 @@ msgstr "No se pudo iniciar la interrupción, RX ocupado" msgid "Couldn't allocate decoder" msgstr "No se pudo encontrar el decodificador" -#: shared-module/audiocore/WaveFile.c shared-module/audiomixer/Mixer.c -#: shared-module/audiomp3/MP3Decoder.c -msgid "Couldn't allocate first buffer" -msgstr "No se pudo asignar el primer buffer" - -#: shared-module/audiomp3/MP3Decoder.c -msgid "Couldn't allocate input buffer" -msgstr "No se pudo encontrar el buffer de entrada" - -#: shared-module/audiocore/WaveFile.c shared-module/audiomixer/Mixer.c -#: shared-module/audiomp3/MP3Decoder.c -msgid "Couldn't allocate second buffer" -msgstr "No se pudo asignar el segundo buffer" - #: supervisor/shared/safe_mode.c msgid "Crash into the HardFault_Handler." msgstr "Choque contra el HardFault_Handler." @@ -953,10 +883,6 @@ msgstr "Capacidad de destino es mas pequeña que destination_length." msgid "Device in use" msgstr "Dispositivo en uso" -#: ports/cxd56/common-hal/digitalio/DigitalInOut.c -msgid "DigitalInOut not supported on given pin" -msgstr "DigitalInOut no es compatible con un pin dado" - #: shared-bindings/displayio/Display.c #: shared-bindings/framebufferio/FramebufferDisplay.c msgid "Display must have a 16 bit colorspace." @@ -968,6 +894,10 @@ msgstr "La pantalla debe tener un espacio de color de 16 bits." msgid "Display rotation must be in 90 degree increments" msgstr "Rotación de display debe ser en incrementos de 90 grados" +#: main.c +msgid "Done" +msgstr "" + #: shared-bindings/digitalio/DigitalInOut.c msgid "Drive mode not used when direction is input." msgstr "Modo Drive no se usa cuando la dirección es input." @@ -1001,21 +931,20 @@ msgstr "Error en regex" msgid "Error: Failure to bind" msgstr "Error: fallo al vincular" -#: ports/raspberrypi/bindings/rp2pio/StateMachine.c py/enum.c -#: shared-bindings/_bleio/__init__.c shared-bindings/aesio/aes.c -#: shared-bindings/busio/SPI.c shared-bindings/microcontroller/Pin.c +#: py/enum.c shared-bindings/_bleio/__init__.c shared-bindings/aesio/aes.c +#: shared-bindings/alarm/__init__.c shared-bindings/busio/SPI.c +#: shared-bindings/microcontroller/Pin.c #: shared-bindings/neopixel_write/__init__.c msgid "Expected a %q" msgstr "Se espera un %q" -#: shared-bindings/alarm/__init__.c -msgid "Expected an alarm" -msgstr "Un objecto alarm era esperado" +#: ports/raspberrypi/bindings/cyw43/__init__.c +msgid "Expected a %q or %q" +msgstr "" -#: shared-module/adafruit_pixelbuf/PixelBuf.c -#, c-format -msgid "Expected tuple of length %d, got %d" -msgstr "Se esperaba un tuple de %d, se obtuvo %d" +#: shared-bindings/alarm/__init__.c +msgid "Expected an %q" +msgstr "" #: ports/espressif/common-hal/_bleio/Adapter.c #: ports/nrf/common-hal/_bleio/Adapter.c @@ -1043,21 +972,9 @@ msgstr "Fallo enviando comando." msgid "Failed to acquire mutex, err 0x%04x" msgstr "No se puede adquirir el mutex, error 0x%04x" -#: ports/mimxrt10xx/common-hal/busio/UART.c ports/nrf/common-hal/busio/UART.c -#: ports/raspberrypi/common-hal/busio/UART.c -msgid "Failed to allocate RX buffer" -msgstr "Ha fallado la asignación del buffer RX" - -#: ports/atmel-samd/common-hal/busio/UART.c -#: ports/atmel-samd/common-hal/pulseio/PulseIn.c -#: ports/cxd56/common-hal/pulseio/PulseIn.c -#: ports/espressif/common-hal/pulseio/PulseIn.c -#: ports/nrf/common-hal/pulseio/PulseIn.c -#: ports/raspberrypi/common-hal/pulseio/PulseIn.c -#: ports/stm/common-hal/pulseio/PulseIn.c -#, c-format -msgid "Failed to allocate RX buffer of %d bytes" -msgstr "Falló la asignación del buffer RX de %d bytes" +#: shared-module/rgbmatrix/RGBMatrix.c +msgid "Failed to allocate %q buffer" +msgstr "" #: ports/espressif/common-hal/wifi/__init__.c msgid "Failed to allocate Wifi memory" @@ -1080,10 +997,6 @@ msgstr "Error al conectar: error interno" msgid "Failed to connect: timeout" msgstr "Error al conectar: tiempo de espera agotado" -#: ports/espressif/common-hal/wifi/__init__.c -msgid "Failed to init wifi" -msgstr "Fallo al inicializar wifi" - #: shared-module/audiomp3/MP3Decoder.c msgid "Failed to parse MP3 file" msgstr "Error al analizar el archivo MP3" @@ -1127,11 +1040,6 @@ msgstr "" msgid "Format not supported" msgstr "Sin capacidades para el formato" -#: shared-module/framebufferio/FramebufferDisplay.c -#, c-format -msgid "Framebuffer requires %d bytes" -msgstr "Framebuffer requiere %d bytes" - #: ports/mimxrt10xx/common-hal/microcontroller/Processor.c msgid "" "Frequency must be 24, 150, 396, 450, 528, 600, 720, 816, 912, 960 or 1008 Mhz" @@ -1147,7 +1055,11 @@ msgstr "" msgid "Function requires lock" msgstr "La función requiere lock" -#: ports/espressif/bindings/espidf/__init__.c ports/espressif/esp_error.c +#: ports/cxd56/common-hal/gnss/GNSS.c +msgid "GNSS init" +msgstr "" + +#: ports/espressif/common-hal/espidf/__init__.c ports/espressif/esp_error.c msgid "Generic Failure" msgstr "Fallo Genérico" @@ -1174,19 +1086,16 @@ msgstr "Hardware ocupado, pruebe pines alternativos" msgid "Hardware in use, try alternative pins" msgstr "Hardware en uso, pruebe pines alternativos" -#: shared-bindings/wifi/Radio.c -msgid "Hostname must be between 1 and 253 characters" -msgstr "Hostname debe ser entre 1 y 253 caracteres" - #: extmod/vfs_posix_file.c py/objstringio.c msgid "I/O operation on closed file" msgstr "Operación I/O en archivo cerrado" #: ports/stm/common-hal/busio/I2C.c -msgid "I2C Init Error" -msgstr "I2C Error de inicio" +msgid "I2C init error" +msgstr "" #: ports/raspberrypi/common-hal/busio/I2C.c +#: ports/raspberrypi/common-hal/i2ctarget/I2CTarget.c msgid "I2C peripheral in use" msgstr "Dispositivo I2C en uso" @@ -1300,75 +1209,37 @@ msgstr "" msgid "Internal error #%d" msgstr "Error interno #%d" -#: shared-bindings/sdioio/SDCard.c shared-module/usb_hid/Device.c +#: supervisor/shared/safe_mode.c +msgid "Internal watchdog timer expired." +msgstr "" + +#: py/argcheck.c shared-bindings/digitalio/DigitalInOut.c msgid "Invalid %q" msgstr "%q inválido" -#: ports/atmel-samd/common-hal/audiobusio/I2SOut.c -#: ports/atmel-samd/common-hal/audiobusio/PDMIn.c -#: ports/atmel-samd/common-hal/imagecapture/ParallelImageCapture.c -#: ports/mimxrt10xx/common-hal/busio/UART.c +#: shared-bindings/microcontroller/Pin.c msgid "Invalid %q pin" msgstr "Pin %q inválido" -#: ports/stm/common-hal/busio/I2C.c ports/stm/common-hal/busio/SPI.c -#: ports/stm/common-hal/busio/UART.c ports/stm/common-hal/canio/CAN.c -#: ports/stm/common-hal/sdioio/SDCard.c -msgid "Invalid %q pin selection" -msgstr "selección inválida de pin %q" - #: ports/stm/common-hal/analogio/AnalogIn.c msgid "Invalid ADC Unit value" msgstr "Valor de unidad de ADC no válido" -#: ports/espressif/common-hal/wifi/Radio.c -msgid "Invalid AuthMode" -msgstr "AuthMode invalido" - #: ports/espressif/common-hal/_bleio/__init__.c #: ports/nrf/common-hal/_bleio/__init__.c msgid "Invalid BLE parameter" msgstr "Parámetro BLE invalido" -#: shared-module/displayio/OnDiskBitmap.c -msgid "Invalid BMP file" -msgstr "Archivo BMP inválido" - #: shared-bindings/wifi/Radio.c msgid "Invalid BSSID" msgstr "BSSID inválido" -#: ports/espressif/common-hal/analogio/AnalogOut.c -#: ports/stm/common-hal/analogio/AnalogOut.c -msgid "Invalid DAC pin supplied" -msgstr "Pin suministrado inválido para DAC" - #: shared-bindings/wifi/Radio.c msgid "Invalid MAC address" msgstr "" -#: shared-bindings/synthio/__init__.c -msgid "Invalid MIDI file" -msgstr "Archivo MIDI inválido" - -#: ports/atmel-samd/common-hal/pwmio/PWMOut.c -#: ports/cxd56/common-hal/pwmio/PWMOut.c -#: ports/espressif/common-hal/pwmio/PWMOut.c -#: ports/mimxrt10xx/common-hal/pwmio/PWMOut.c -#: ports/nrf/common-hal/pwmio/PWMOut.c -#: ports/raspberrypi/common-hal/pwmio/PWMOut.c shared-bindings/pwmio/PWMOut.c -msgid "Invalid PWM frequency" -msgstr "Frecuencia PWM inválida" - -#: ports/espressif/common-hal/analogio/AnalogIn.c -msgid "Invalid Pin" -msgstr "Pin inválido" - -#: ports/espressif/bindings/espidf/__init__.c -#: ports/espressif/common-hal/busio/I2C.c -#: ports/espressif/common-hal/i2cperipheral/I2CPeripheral.c -#: ports/espressif/esp_error.c py/moduerrno.c -#: shared-module/rgbmatrix/RGBMatrix.c +#: ports/espressif/common-hal/espidf/__init__.c ports/espressif/esp_error.c +#: py/moduerrno.c msgid "Invalid argument" msgstr "Argumento inválido" @@ -1376,42 +1247,11 @@ msgstr "Argumento inválido" msgid "Invalid bits per value" msgstr "Inválido bits por valor" -#: ports/nrf/common-hal/busio/UART.c ports/raspberrypi/common-hal/busio/UART.c -#: ports/stm/common-hal/busio/UART.c -msgid "Invalid buffer size" -msgstr "Tamaño de buffer inválido" - -#: shared-bindings/adafruit_pixelbuf/PixelBuf.c -msgid "Invalid byteorder string" -msgstr "Cadena de byteorder inválida" - -#: ports/atmel-samd/common-hal/frequencyio/FrequencyIn.c -#: ports/espressif/common-hal/frequencyio/FrequencyIn.c -msgid "Invalid capture period. Valid range: 1 - 500" -msgstr "Inválido periodo de captura. Rango válido: 1 - 500" - -#: shared-bindings/audiomixer/Mixer.c -msgid "Invalid channel count" -msgstr "Cuenta de canales inválida" - -#: ports/atmel-samd/common-hal/imagecapture/ParallelImageCapture.c -#, c-format -msgid "Invalid data_count %d" -msgstr "data_count inválido %d" - #: ports/atmel-samd/common-hal/imagecapture/ParallelImageCapture.c #, c-format msgid "Invalid data_pins[%d]" msgstr "Inválidos los data_pins[%d]" -#: shared-bindings/digitalio/DigitalInOut.c -msgid "Invalid direction." -msgstr "Dirección inválida." - -#: shared-module/audiocore/WaveFile.c -msgid "Invalid file" -msgstr "Archivo inválido" - #: shared-module/audiocore/WaveFile.c msgid "Invalid format chunk size" msgstr "Formato de fragmento de formato no válido" @@ -1420,107 +1260,27 @@ msgstr "Formato de fragmento de formato no válido" msgid "Invalid memory access." msgstr "Acceso a memoria no válido." -#: extmod/vfs_fat_file.c -msgid "Invalid mode" -msgstr "" - #: ports/espressif/common-hal/wifi/Radio.c msgid "Invalid multicast MAC address" msgstr "" -#: shared-bindings/bitbangio/SPI.c shared-bindings/busio/SPI.c -msgid "Invalid number of bits" -msgstr "Numero inválido de bits" - -#: shared-bindings/bitbangio/SPI.c shared-bindings/busio/SPI.c -#: shared-bindings/displayio/FourWire.c -msgid "Invalid phase" -msgstr "Fase inválida" - -#: ports/atmel-samd/common-hal/audioio/AudioOut.c -#: ports/atmel-samd/common-hal/touchio/TouchIn.c -#: ports/espressif/common-hal/alarm/touch/TouchAlarm.c -#: ports/espressif/common-hal/touchio/TouchIn.c -#: ports/nrf/common-hal/alarm/pin/PinAlarm.c shared-bindings/pwmio/PWMOut.c -#: shared-module/rgbmatrix/RGBMatrix.c -msgid "Invalid pin" -msgstr "Pin inválido" - -#: ports/atmel-samd/common-hal/audioio/AudioOut.c -msgid "Invalid pin for left channel" -msgstr "Pin inválido para canal izquierdo" - -#: ports/atmel-samd/common-hal/audioio/AudioOut.c -msgid "Invalid pin for right channel" -msgstr "Pin inválido para canal derecho" - -#: ports/atmel-samd/common-hal/busio/I2C.c -#: ports/atmel-samd/common-hal/busio/SPI.c -#: ports/atmel-samd/common-hal/busio/UART.c -#: ports/atmel-samd/common-hal/i2cperipheral/I2CPeripheral.c -#: ports/cxd56/common-hal/busio/I2C.c ports/cxd56/common-hal/busio/SPI.c -#: ports/cxd56/common-hal/busio/UART.c ports/cxd56/common-hal/sdioio/SDCard.c -#: ports/espressif/common-hal/busio/I2C.c -#: ports/espressif/common-hal/busio/SPI.c -#: ports/espressif/common-hal/busio/UART.c -#: ports/espressif/common-hal/canio/CAN.c -#: ports/espressif/common-hal/i2cperipheral/I2CPeripheral.c -#: ports/mimxrt10xx/common-hal/busio/I2C.c -#: ports/mimxrt10xx/common-hal/busio/SPI.c -#: ports/mimxrt10xx/common-hal/usb_host/Port.c ports/nrf/common-hal/busio/I2C.c -#: ports/raspberrypi/common-hal/busio/I2C.c -#: ports/raspberrypi/common-hal/busio/SPI.c -#: ports/raspberrypi/common-hal/busio/UART.c shared-bindings/busio/SPI.c #: shared-bindings/busio/UART.c msgid "Invalid pins" msgstr "pines inválidos" -#: shared-bindings/bitbangio/SPI.c shared-bindings/busio/SPI.c -#: shared-bindings/displayio/FourWire.c -msgid "Invalid polarity" -msgstr "Polaridad inválida" - -#: shared-bindings/_bleio/Characteristic.c -msgid "Invalid properties" -msgstr "Propiedades inválidas" - -#: shared-bindings/microcontroller/__init__.c -msgid "Invalid run mode." -msgstr "Modo de ejecución inválido." - -#: shared-module/_bleio/Attribute.c -msgid "Invalid security_mode" -msgstr "'security_mode' no válido" - -#: ports/espressif/bindings/espidf/__init__.c ports/espressif/esp_error.c +#: ports/espressif/common-hal/espidf/__init__.c ports/espressif/esp_error.c msgid "Invalid size" msgstr "Tamaño incorrecto" #: ports/espressif/common-hal/ssl/SSLContext.c +#: ports/raspberrypi/common-hal/ssl/SSLSocket.c msgid "Invalid socket for TLS" msgstr "socket invalido para TLS" -#: ports/espressif/bindings/espidf/__init__.c ports/espressif/esp_error.c +#: ports/espressif/common-hal/espidf/__init__.c ports/espressif/esp_error.c msgid "Invalid state" msgstr "Estado invalido" -#: shared-bindings/audiomixer/Mixer.c -msgid "Invalid voice" -msgstr "Voz inválida" - -#: shared-bindings/audiomixer/Mixer.c -msgid "Invalid voice count" -msgstr "Cuenta de voces inválida" - -#: shared-module/audiocore/WaveFile.c -msgid "Invalid wave file" -msgstr "Archivo wave inválido" - -#: ports/mimxrt10xx/common-hal/busio/UART.c ports/nrf/common-hal/busio/UART.c -#: ports/raspberrypi/common-hal/busio/UART.c ports/stm/common-hal/busio/UART.c -msgid "Invalid word/bit length" -msgstr "Tamaño no válido de palabra/bit" - #: shared-bindings/aesio/aes.c msgid "Key must be 16, 24, or 32 bytes long" msgstr "La llave debe tener 16, 24 o 32 bytes de longitud" @@ -1534,25 +1294,17 @@ msgid "LHS of keyword arg must be an id" msgstr "LHS del agumento por palabra clave deberia ser un identificador" #: shared-module/displayio/Group.c -msgid "Layer already in a group." -msgstr "La capa ya pertenece a un grupo." +msgid "Layer already in a group" +msgstr "" #: shared-module/displayio/Group.c -msgid "Layer must be a Group or TileGrid subclass." -msgstr "Layer debe ser una subclase de Group o TileGrid." +msgid "Layer must be a Group or TileGrid subclass" +msgstr "" -#: ports/espressif/bindings/espidf/__init__.c ports/espressif/esp_error.c +#: ports/espressif/common-hal/espidf/__init__.c ports/espressif/esp_error.c msgid "MAC address was invalid" msgstr "La dirección MAC es incorrecta" -#: shared-module/bitbangio/SPI.c -msgid "MISO pin init failed." -msgstr "MISO pin init fallido." - -#: shared-module/bitbangio/SPI.c -msgid "MOSI pin init failed." -msgstr "MOSI pin init fallido." - #: shared-bindings/is31fl3741/IS31FL3741.c msgid "Mapping must be a tuple" msgstr "" @@ -1562,10 +1314,6 @@ msgstr "" msgid "Maximum x value when mirrored is %d" msgstr "Valor máximo de x cuando se refleja es %d" -#: shared-bindings/canio/Message.c -msgid "Messages limited to 8 bytes" -msgstr "Mensajes limitados a 8 bytes" - #: shared-bindings/audiobusio/PDMIn.c msgid "Microphone startup delay must be in range 0.0 to 1.0" msgstr "Micrófono demora de inicio debe estar en el rango 0.0 a 1.0" @@ -1579,10 +1327,14 @@ msgstr "" msgid "Mismatched swap flag" msgstr "" -#: ports/mimxrt10xx/common-hal/busio/SPI.c ports/stm/common-hal/busio/SPI.c +#: ports/mimxrt10xx/common-hal/busio/SPI.c msgid "Missing MISO or MOSI Pin" msgstr "Falta el pin MISO o MOSI" +#: ports/stm/common-hal/busio/SPI.c +msgid "Missing MISO or MOSI pin" +msgstr "" + #: ports/raspberrypi/common-hal/rp2pio/StateMachine.c #, c-format msgid "Missing first_in_pin. Instruction %d reads pin(s)" @@ -1622,11 +1374,6 @@ msgstr "" msgid "Missing jmp_pin. Instruction %d jumps on pin" msgstr "" -#: shared-module/usb_hid/Device.c -#, c-format -msgid "More than %d report ids not supported" -msgstr "" - #: shared-bindings/busio/UART.c shared-bindings/displayio/Group.c msgid "Must be a %q subclass." msgstr "Debe de ser una subclase de %q." @@ -1686,16 +1433,28 @@ msgstr "timer por establecedor de paso DMA no encontrado" msgid "No I2C device at address: 0x%x" msgstr "" +#: supervisor/shared/web_workflow/web_workflow.c +msgid "No IP" +msgstr "" + #: ports/espressif/common-hal/busio/SPI.c -#: ports/mimxrt10xx/common-hal/busio/SPI.c ports/stm/common-hal/busio/SPI.c +#: ports/mimxrt10xx/common-hal/busio/SPI.c msgid "No MISO Pin" msgstr "Sin pin MISO" +#: ports/stm/common-hal/busio/SPI.c shared-module/bitbangio/SPI.c +msgid "No MISO pin" +msgstr "" + #: ports/espressif/common-hal/busio/SPI.c -#: ports/mimxrt10xx/common-hal/busio/SPI.c ports/stm/common-hal/busio/SPI.c +#: ports/mimxrt10xx/common-hal/busio/SPI.c msgid "No MOSI Pin" msgstr "Sin pin MOSI" +#: ports/stm/common-hal/busio/SPI.c shared-module/bitbangio/SPI.c +msgid "No MOSI pin" +msgstr "" + #: ports/atmel-samd/common-hal/busio/UART.c #: ports/espressif/common-hal/busio/UART.c #: ports/mimxrt10xx/common-hal/busio/UART.c ports/nrf/common-hal/busio/UART.c @@ -1734,16 +1493,6 @@ msgstr "Sin GCLKs libres" msgid "No hardware random available" msgstr "No hay hardware random disponible" -#: ports/atmel-samd/common-hal/ps2io/Ps2.c -msgid "No hardware support on clk pin" -msgstr "Sin soporte de hardware en el pin clk" - -#: ports/atmel-samd/common-hal/alarm/pin/PinAlarm.c -#: ports/atmel-samd/common-hal/frequencyio/FrequencyIn.c -#: ports/atmel-samd/common-hal/pulseio/PulseIn.c -msgid "No hardware support on pin" -msgstr "Sin soporte de hardware en pin" - #: ports/raspberrypi/common-hal/rp2pio/StateMachine.c msgid "No in in program" msgstr "No hay \"in\" en el programa" @@ -1843,16 +1592,26 @@ msgstr "" msgid "Odd parity is not supported" msgstr "Paridad impar no soportada" +#: supervisor/shared/bluetooth/bluetooth.c +msgid "Off" +msgstr "" + +#: supervisor/shared/bluetooth/bluetooth.c +msgid "Ok" +msgstr "" + #: ports/atmel-samd/common-hal/audiobusio/PDMIn.c #: ports/raspberrypi/common-hal/audiobusio/PDMIn.c msgid "Only 8 or 16 bit mono with " msgstr "Solo mono de 8 ó 16 bit con " #: ports/espressif/common-hal/wifi/__init__.c +#: ports/raspberrypi/common-hal/wifi/__init__.c msgid "Only IPv4 addresses supported" msgstr "Solo hay capacidad para direcciones IPv4" -#: ports/espressif/common-hal/socketpool/SocketPool.c +#: ports/espressif/common-hal/socketpool/Socket.c +#: ports/raspberrypi/common-hal/socketpool/Socket.c msgid "Only IPv4 sockets supported" msgstr "Solo se admiten sockets IPv4" @@ -1889,15 +1648,19 @@ msgstr "" msgid "Only one TouchAlarm can be set in deep sleep." msgstr "Solamente una TouchAlarm puede ser configurada durante deep sleep." -#: ports/espressif/common-hal/i2cperipheral/I2CPeripheral.c +#: ports/espressif/common-hal/i2ctarget/I2CTarget.c +#: ports/raspberrypi/common-hal/i2ctarget/I2CTarget.c msgid "Only one address is allowed" msgstr "" #: ports/atmel-samd/common-hal/alarm/time/TimeAlarm.c -#: ports/espressif/common-hal/alarm/time/TimeAlarm.c #: ports/nrf/common-hal/alarm/time/TimeAlarm.c -#: ports/raspberrypi/common-hal/alarm/time/TimeAlarm.c #: ports/stm/common-hal/alarm/time/TimeAlarm.c +msgid "Only one alarm.time alarm can be set" +msgstr "" + +#: ports/espressif/common-hal/alarm/time/TimeAlarm.c +#: ports/raspberrypi/common-hal/alarm/time/TimeAlarm.c msgid "Only one alarm.time alarm can be set." msgstr "Solamente una alarm.time puede ser configurada." @@ -1909,19 +1672,20 @@ msgstr "Solo un color puede ser transparente a la vez" msgid "Operation not permitted" msgstr "" -#: ports/espressif/bindings/espidf/__init__.c ports/espressif/esp_error.c +#: ports/espressif/common-hal/espidf/__init__.c ports/espressif/esp_error.c msgid "Operation or feature not supported" msgstr "Operación no característica no soportada" -#: ports/espressif/bindings/espidf/__init__.c ports/espressif/esp_error.c +#: ports/espressif/common-hal/espidf/__init__.c ports/espressif/esp_error.c msgid "Operation timed out" msgstr "Tiempo de espera agotado" -#: ports/espressif/bindings/espidf/__init__.c ports/espressif/esp_error.c +#: ports/espressif/common-hal/espidf/__init__.c ports/espressif/esp_error.c msgid "Out of memory" msgstr "Memoria agotada" -#: ports/espressif/common-hal/socketpool/SocketPool.c +#: ports/espressif/common-hal/socketpool/Socket.c +#: ports/raspberrypi/common-hal/socketpool/Socket.c msgid "Out of sockets" msgstr "Se acabaron los enchufes" @@ -1929,11 +1693,6 @@ msgstr "Se acabaron los enchufes" msgid "Out-buffer elements must be <= 4 bytes long" msgstr "Los elementos del búfer de salida deben ser de una longitud <= 4 bytes" -#: shared-bindings/bitops/__init__.c -#, c-format -msgid "Output buffer must be at least %d bytes" -msgstr "buffer de salida debe ser de por lo menos %d bytes" - #: shared-bindings/audiobusio/PDMIn.c msgid "Oversample must be multiple of 8." msgstr "El sobremuestreo debe ser un múltiplo de 8." @@ -1942,11 +1701,6 @@ msgstr "El sobremuestreo debe ser un múltiplo de 8." msgid "PDMIn not available" msgstr "PDMIn no esta disponible" -#: shared-bindings/pwmio/PWMOut.c -msgid "" -"PWM duty_cycle must be between 0 and 65535 inclusive (16 bit resolution)" -msgstr "PWM duty_cycle debe ser entre 0 y 65535 inclusivo (16 bit resolution)" - #: shared-bindings/pwmio/PWMOut.c msgid "" "PWM frequency not writable when variable_frequency is False on construction." @@ -1954,6 +1708,10 @@ msgstr "" "La frecuencia de PWM no se puede escribir variable_frequency es False en la " "construcción." +#: ports/stm/common-hal/pwmio/PWMOut.c +msgid "PWM restart" +msgstr "" + #: ports/raspberrypi/common-hal/countio/Counter.c msgid "PWM slice already in use" msgstr "Segmento PWM ya esta en uso" @@ -1970,36 +1728,20 @@ msgstr "Periférico en uso" msgid "Permission denied" msgstr "Permiso denegado" -#: ports/atmel-samd/common-hal/alarm/pin/PinAlarm.c #: ports/stm/common-hal/alarm/pin/PinAlarm.c msgid "Pin cannot wake from Deep Sleep" msgstr "El Pin no se puede despertar de un sueño profundo" -#: ports/raspberrypi/bindings/rp2pio/StateMachine.c -msgid "Pin count must be at least 1" -msgstr "El total de pines debe ser por lo menos 1" - #: ports/raspberrypi/common-hal/rp2pio/StateMachine.c msgid "Pin count too large" msgstr "Total de pines demasiado grande" -#: ports/atmel-samd/common-hal/analogio/AnalogIn.c -#: ports/cxd56/common-hal/analogio/AnalogIn.c -#: ports/espressif/common-hal/analogio/AnalogIn.c -#: ports/mimxrt10xx/common-hal/analogio/AnalogIn.c -#: ports/nrf/common-hal/analogio/AnalogIn.c -#: ports/raspberrypi/common-hal/analogio/AnalogIn.c -#: ports/stm/common-hal/analogio/AnalogIn.c -msgid "Pin does not have ADC capabilities" -msgstr "Pin no tiene capacidad ADC" - #: ports/stm/common-hal/alarm/pin/PinAlarm.c #: ports/stm/common-hal/pulseio/PulseIn.c msgid "Pin interrupt already in use" msgstr "Interrupción de Pin ya está en uso" #: shared-bindings/adafruit_bus_device/spi_device/SPIDevice.c -#: shared-bindings/digitalio/DigitalInOut.c msgid "Pin is input only" msgstr "El pin es solo de entrada" @@ -2065,18 +1807,10 @@ msgstr "El programa hace un IN sin cargar ISR" msgid "Program does OUT without loading OSR" msgstr "El programa hace OUT sin cargar OSR" -#: ports/raspberrypi/bindings/rp2pio/StateMachine.c -msgid "Program must contain at least one 16-bit instruction." -msgstr "El programa debe contener por lo menos una instrucción de 16 bits." - #: ports/raspberrypi/bindings/rp2pio/StateMachine.c msgid "Program size invalid" msgstr "El tamaño del programa no es correcto" -#: ports/raspberrypi/bindings/rp2pio/StateMachine.c -msgid "Program too large" -msgstr "Programa demasiado grande" - #: shared-bindings/digitalio/DigitalInOut.c msgid "Pull not used when direction is output." msgstr "Pull no se usa cuando la dirección es output." @@ -2098,30 +1832,20 @@ msgstr "Error de desinicialización de RNG" msgid "RNG Init Error" msgstr "Error de inicialización de RNG" -#: ports/nrf/common-hal/busio/UART.c -msgid "RS485 Not yet supported on this device" -msgstr "RS485 no esta soportado todavía en este dispositivo" +#: ports/atmel-samd/common-hal/busio/UART.c ports/cxd56/common-hal/busio/UART.c +#: ports/nrf/common-hal/busio/UART.c ports/stm/common-hal/busio/UART.c +msgid "RS485" +msgstr "" #: ports/espressif/common-hal/busio/UART.c #: ports/mimxrt10xx/common-hal/busio/UART.c msgid "RS485 inversion specified when not in RS485 mode" msgstr "Se especifica inversión de RS485 si no está en modo RS485" -#: ports/cxd56/common-hal/rtc/RTC.c ports/espressif/common-hal/rtc/RTC.c -#: ports/mimxrt10xx/common-hal/rtc/RTC.c ports/nrf/common-hal/rtc/RTC.c -#: ports/raspberrypi/common-hal/rtc/RTC.c -msgid "RTC calibration is not supported on this board" -msgstr "Calibración de RTC no es soportada en esta placa" - #: shared-bindings/alarm/time/TimeAlarm.c shared-bindings/time/__init__.c msgid "RTC is not supported on this board" msgstr "RTC no soportado en esta placa" -#: ports/atmel-samd/common-hal/busio/UART.c ports/cxd56/common-hal/busio/UART.c -#: ports/stm/common-hal/busio/UART.c -msgid "RTS/CTS/RS485 Not yet supported on this device" -msgstr "Sin capacidad de RTS/CTS/RS485 para este dispositivo" - #: ports/stm/common-hal/os/__init__.c msgid "Random number generation error" msgstr "Error de generación de números aleatorios" @@ -2139,10 +1863,14 @@ msgstr "Sistema de archivos de solo-Lectura" msgid "Read-only object" msgstr "Objeto de solo-lectura" -#: ports/espressif/bindings/espidf/__init__.c ports/espressif/esp_error.c +#: ports/espressif/common-hal/espidf/__init__.c ports/espressif/esp_error.c msgid "Received response was invalid" msgstr "La respuesta recibida es invalida" +#: supervisor/shared/bluetooth/bluetooth.c +msgid "Reconnecting" +msgstr "" + #: shared-bindings/displayio/EPaperDisplay.c msgid "Refresh too soon" msgstr "Refresco demasiado pronto" @@ -2155,7 +1883,7 @@ msgstr "RemoteTransmissionRequests limitado a 8 bytes" msgid "Requested AES mode is unsupported" msgstr "El modo AES solicitado no es compatible" -#: ports/espressif/bindings/espidf/__init__.c ports/espressif/esp_error.c +#: ports/espressif/common-hal/espidf/__init__.c ports/espressif/esp_error.c msgid "Requested resource not found" msgstr "Recurso solicitado no encontrado" @@ -2172,6 +1900,10 @@ msgstr "" msgid "SD card CSD format not supported" msgstr "Sin capacidad para formato CSD para tarjeta SD" +#: ports/cxd56/common-hal/sdioio/SDCard.c +msgid "SDCard init" +msgstr "" + #: ports/stm/common-hal/sdioio/SDCard.c #, c-format msgid "SDIO GetCardInfo Error %d" @@ -2182,30 +1914,21 @@ msgstr "Error SDIO GetCardInfo %d" msgid "SDIO Init Error %d" msgstr "Error de iniciado de SDIO %d" -#: ports/stm/common-hal/busio/SPI.c -msgid "SPI Init Error" -msgstr "Error de inicio de SPI" - -#: ports/stm/common-hal/busio/SPI.c -msgid "SPI Re-initialization error" -msgstr "Error de reinicialización de SPI" - #: ports/espressif/common-hal/busio/SPI.c msgid "SPI configuration failed" msgstr "Configuración de SPI fallida" +#: ports/stm/common-hal/busio/SPI.c +msgid "SPI init error" +msgstr "" + #: ports/raspberrypi/common-hal/busio/SPI.c msgid "SPI peripheral in use" msgstr "Periférico SPI en uso" -#: shared-bindings/audiomixer/Mixer.c -msgid "Sample rate must be positive" -msgstr "Sample rate debe ser positivo" - -#: ports/atmel-samd/common-hal/audioio/AudioOut.c -#, c-format -msgid "Sample rate too high. It must be less than %d" -msgstr "Frecuencia de muestreo demasiado alta. Debe ser menor a %d" +#: ports/stm/common-hal/busio/SPI.c +msgid "SPI re-init" +msgstr "" #: shared-bindings/is31fl3741/FrameBuffer.c msgid "Scale dimensions must divide by 3" @@ -2225,14 +1948,6 @@ msgstr "Serializer está siendo utilizado" msgid "Server side context cannot have hostname" msgstr "El contexto del lado del servidor no puede tener un hostname" -#: ports/raspberrypi/bindings/rp2pio/StateMachine.c -msgid "Set pin count must be between 1 and 5" -msgstr "La suma de pines configurados debe estar entre 1 y 5" - -#: ports/raspberrypi/bindings/rp2pio/StateMachine.c -msgid "Side set pin count must be between 1 and 5" -msgstr "El conteo de pines de Side set debe estar entre 1 y 5" - #: ports/cxd56/common-hal/camera/Camera.c msgid "Size not supported" msgstr "Sin capacidades para el tamaño" @@ -2253,6 +1968,7 @@ msgid "Slices not supported" msgstr "Rebanadas no soportadas" #: ports/espressif/common-hal/socketpool/SocketPool.c +#: ports/raspberrypi/common-hal/socketpool/SocketPool.c msgid "SocketPool can only be used with wifi.radio" msgstr "SocketPool solo se puede usar con wifi.radio" @@ -2268,10 +1984,6 @@ msgstr "" msgid "Splitting with sub-captures" msgstr "Dividiendo con sub-capturas" -#: shared-bindings/supervisor/__init__.c -msgid "Stack size must be at least 256" -msgstr "El tamaño de la pila debe ser de al menos 256" - #: ports/raspberrypi/common-hal/audiopwmio/PWMAudioOut.c msgid "Stereo left must be on PWM channel A" msgstr "Estéreo izquierdo debe estar en el canal PWM A" @@ -2280,10 +1992,6 @@ msgstr "Estéreo izquierdo debe estar en el canal PWM A" msgid "Stereo right must be on PWM channel B" msgstr "Estéreo derecho debe estar en el canal PWM B" -#: shared-bindings/multiterminal/__init__.c -msgid "Stream missing readinto() or write() method." -msgstr "A Stream le falta el método readinto() o write()." - #: ports/mimxrt10xx/common-hal/busio/UART.c ports/stm/common-hal/busio/UART.c msgid "Supply at least one UART pin" msgstr "Suministre al menos un pin UART" @@ -2365,10 +2073,6 @@ msgstr "La altura del Tile debe dividir exacto la altura del bitmap" msgid "Tile index out of bounds" msgstr "Índice de mosaico fuera de límites" -#: shared-bindings/displayio/TileGrid.c -msgid "Tile value out of bounds" -msgstr "Valor de mosaico fuera de límites" - #: shared-bindings/displayio/TileGrid.c msgid "Tile width must exactly divide bitmap width" msgstr "Ancho del Tile debe dividir exactamente el ancho de mapa de bits" @@ -2390,6 +2094,9 @@ msgid "To exit, please reset the board without " msgstr "Para salir, por favor reinicia la tarjeta sin " #: ports/atmel-samd/common-hal/audiobusio/I2SOut.c +msgid "Too many channels in sample" +msgstr "" + #: ports/raspberrypi/common-hal/audiobusio/I2SOut.c msgid "Too many channels in sample." msgstr "Demasiados canales en sample." @@ -2422,24 +2129,25 @@ msgid "Tuple or struct_time argument required" msgstr "Argumento tuple o struct_time requerido" #: ports/stm/common-hal/busio/UART.c -msgid "UART Buffer allocation error" -msgstr "No se pudo encontrar el búfer para UART" +msgid "UART de-init" +msgstr "" + +#: ports/atmel-samd/common-hal/busio/UART.c ports/cxd56/common-hal/busio/UART.c +#: ports/espressif/common-hal/busio/UART.c ports/stm/common-hal/busio/UART.c +msgid "UART init" +msgstr "" #: ports/stm/common-hal/busio/UART.c -msgid "UART De-init error" -msgstr "Error de desinicialización de UART" +msgid "UART re-init" +msgstr "" #: ports/stm/common-hal/busio/UART.c -msgid "UART Init Error" -msgstr "Error de inicialización de UART" +msgid "UART write" +msgstr "" -#: ports/stm/common-hal/busio/UART.c -msgid "UART Re-init error" -msgstr "Error de reinicialización de UART" - -#: ports/stm/common-hal/busio/UART.c -msgid "UART write error" -msgstr "Error de escritura UART" +#: main.c +msgid "UID:" +msgstr "" #: shared-module/usb_hid/Device.c msgid "USB busy" @@ -2564,6 +2272,11 @@ msgstr "Error desconocido en el firmware sistema: %04x" msgid "Unknown system firmware error: %d" msgstr "" +#: ports/raspberrypi/common-hal/wifi/__init__.c +#, c-format +msgid "Unkown error code %d" +msgstr "" + #: shared-bindings/adafruit_pixelbuf/PixelBuf.c #, c-format msgid "Unmatched number of items on RHS (expected %d, got %d)." @@ -2577,12 +2290,6 @@ msgstr "" "Problema no especificado. Puede ser que la señal de emparejamiento del otro " "dispositivo fue denegada o ignorada." -#: ports/atmel-samd/common-hal/busio/I2C.c ports/cxd56/common-hal/busio/I2C.c -#: ports/espressif/common-hal/busio/UART.c -#: ports/raspberrypi/common-hal/busio/I2C.c ports/stm/common-hal/busio/I2C.c -msgid "Unsupported baudrate" -msgstr "Baudrate no soportado" - #: shared-bindings/bitmaptools/__init__.c msgid "Unsupported colorspace" msgstr "" @@ -2595,6 +2302,10 @@ msgstr "Sin capacidad de bus tipo display" msgid "Unsupported format" msgstr "Formato no soportado" +#: shared-bindings/hashlib/__init__.c +msgid "Unsupported hash algorithm" +msgstr "" + #: ports/espressif/common-hal/dualbank/__init__.c msgid "Update Failed" msgstr "La actualización fallo" @@ -2613,7 +2324,7 @@ msgstr "Tamaño del valor != del tamaño fijo requerido" msgid "Value length > max_length" msgstr "Tamaño de valor > max_length" -#: ports/espressif/bindings/espidf/__init__.c ports/espressif/esp_error.c +#: ports/espressif/common-hal/espidf/__init__.c ports/espressif/esp_error.c msgid "Version was invalid" msgstr "La versión era invalida" @@ -2646,10 +2357,6 @@ msgstr "" msgid "WatchDogTimer.timeout must be greater than 0" msgstr "WatchDogTimer.timeout debe ser mayor a 0" -#: supervisor/shared/safe_mode.c -msgid "Watchdog timer expired." -msgstr "Temporizador de perro guardián expirado." - #: py/builtinhelp.c #, c-format msgid "" @@ -2660,9 +2367,9 @@ msgid "" "To list built-in modules type `help(\"modules\")`.\n" msgstr "" -#: shared-bindings/wifi/Radio.c -msgid "WiFi password must be between 8 and 63 characters" -msgstr "La clave de WiFi debe ser entre 8 y 63 caracteres" +#: supervisor/shared/web_workflow/web_workflow.c +msgid "Wi-Fi: " +msgstr "" #: main.c msgid "Woken up by alarm.\n" @@ -2704,11 +2411,7 @@ msgstr "__new__ arg debe ser un user-type" msgid "a bytes-like object is required" msgstr "se requiere un objeto bytes-like" -#: shared-bindings/i2cperipheral/I2CPeripheral.c -msgid "address out of bounds" -msgstr "address fuera de límites" - -#: shared-bindings/i2cperipheral/I2CPeripheral.c +#: shared-bindings/i2ctarget/I2CTarget.c msgid "addresses is empty" msgstr "addresses esta vacío" @@ -2757,6 +2460,10 @@ msgstr "argumentos deben ser ndarrays" msgid "array and index length must be equal" msgstr "Longitud del array e índice tienen que ser iguales" +#: extmod/ulab/code/numpy/io/io.c +msgid "array has too many dimensions" +msgstr "" + #: py/objarray.c shared-bindings/alarm/SleepMemory.c #: shared-bindings/nvm/ByteArray.c msgid "array/bytes required on right side" @@ -2818,10 +2525,6 @@ msgstr "" msgid "bits must be 32 or less" msgstr "los bits deben ser 32 o menos" -#: shared-bindings/busio/UART.c -msgid "bits must be in range 5 to 9" -msgstr "los bits deben estar en el rango de 5 a 9" - #: shared-bindings/audiomixer/Mixer.c msgid "bits_per_sample must be 8 or 16" msgstr "bits_per_sample debe ser 8 ó 16" @@ -2859,11 +2562,6 @@ msgstr "búfer muy pequeño para los bytes solicitados" msgid "byteorder is not a string" msgstr "byteorder no es una cadena" -#: ports/atmel-samd/common-hal/busio/UART.c -#: ports/espressif/common-hal/busio/UART.c -msgid "bytes > 8 bits not supported" -msgstr "bytes > 8 bits no soportados" - #: py/objarray.c msgid "bytes length not a multiple of item size" msgstr "el tamaño en bytes no es un múltiplo del tamaño del item" @@ -2872,7 +2570,7 @@ msgstr "el tamaño en bytes no es un múltiplo del tamaño del item" msgid "bytes value out of range" msgstr "valor de bytes fuera de rango" -#: ports/atmel-samd/bindings/samd/Clock.c ports/atmel-samd/common-hal/rtc/RTC.c +#: ports/atmel-samd/bindings/samd/Clock.c msgid "calibration is out of range" msgstr "calibration esta fuera de rango" @@ -2880,12 +2578,9 @@ msgstr "calibration esta fuera de rango" msgid "calibration is read only" msgstr "calibration es de solo lectura" -#: ports/atmel-samd/common-hal/rtc/RTC.c -msgid "calibration value out of range +/-127" -msgstr "Valor de calibración fuera del rango +/-127" - +#: shared-module/vectorio/Circle.c shared-module/vectorio/Polygon.c #: shared-module/vectorio/Rectangle.c -msgid "can only be registered in one parent" +msgid "can only have one parent" msgstr "" #: py/emitinlinethumb.c @@ -2908,8 +2603,7 @@ msgstr "no se puede asignar a la expresión" msgid "can't cancel self" msgstr "no se puede cancelar a si mismo" -#: py/obj.c py/objint.c shared-bindings/i2cperipheral/I2CPeripheral.c -#: shared-module/adafruit_pixelbuf/PixelBuf.c +#: py/obj.c py/objint.c shared-module/adafruit_pixelbuf/PixelBuf.c msgid "can't convert %q to %q" msgstr "no puede convertir %q a %q" @@ -3061,6 +2755,10 @@ msgstr "no se puede sin ambiguedades traer el sizeof del escalar" msgid "casting" msgstr "convirtiendo tipo" +#: ports/stm/common-hal/pwmio/PWMOut.c +msgid "channel re-init" +msgstr "" + #: shared-bindings/_stage/Text.c msgid "chars buffer too small" msgstr "chars buffer es demasiado pequeño" @@ -3073,10 +2771,6 @@ msgstr "El argumento de chr() esta fuera de rango(0x110000)" msgid "chr() arg not in range(256)" msgstr "El argumento de chr() no esta en el rango(256)" -#: shared-module/vectorio/Circle.c -msgid "circle can only be registered in one parent" -msgstr "circulo solo puede ser registrado con un pariente" - #: shared-bindings/bitmaptools/__init__.c msgid "clip point must be (x,y) tuple" msgstr "El punto de recorte debe ser una tupla (x, y)" @@ -3101,10 +2795,6 @@ msgstr "color buffer deberia ser un bytearray o array de tipo 'b' o 'B'" msgid "color must be between 0x000000 and 0xffffff" msgstr "color debe estar entre 0x000000 y 0xffffff" -#: shared-bindings/displayio/ColorConverter.c -msgid "color should be an int" -msgstr "color deberia ser un int" - #: py/emitnative.c msgid "comparison of int and uint" msgstr "comparación entre int y uint" @@ -3141,6 +2831,10 @@ msgstr "los argumentos para convolve deben ser ndarrays" msgid "convolve arguments must not be empty" msgstr "los argumentos para convolve no deben estar vacíos" +#: extmod/ulab/code/numpy/io/io.c +msgid "corrupted file" +msgstr "" + #: extmod/ulab/code/numpy/poly.c msgid "could not invert Vandermonde matrix" msgstr "no se pudo invertir la matriz de Vandermonde" @@ -3193,10 +2887,6 @@ msgstr "" msgid "destination buffer must be an array of type 'H' for bit_depth = 16" msgstr "el buffer de destino debe ser un array de tipo 'H' para bit_depth = 16" -#: shared-bindings/audiobusio/PDMIn.c -msgid "destination_length must be an int >= 0" -msgstr "destination_length debe ser un int >= 0" - #: py/objdict.c msgid "dict update sequence has wrong length" msgstr "la secuencia de actualizacion del dict tiene una longitud incorrecta" @@ -3234,6 +2924,10 @@ msgstr "" msgid "empty" msgstr "vacío" +#: extmod/ulab/code/numpy/io/io.c +msgid "empty file" +msgstr "" + #: extmod/moduasyncio.c extmod/moduheapq.c extmod/modutimeq.c msgid "empty heap" msgstr "heap vacío" @@ -3250,10 +2944,6 @@ msgstr "secuencia vacía" msgid "end of format while looking for conversion specifier" msgstr "el final del formato mientras se busca el especificador de conversión" -#: shared-bindings/displayio/Shape.c -msgid "end_x should be an int" -msgstr "end_x debe ser un int" - #: shared-bindings/alarm/time/TimeAlarm.c msgid "epoch_time not supported on this board" msgstr "epoch_time no esta soportado en esta tarjeta" @@ -3263,6 +2953,12 @@ msgstr "epoch_time no esta soportado en esta tarjeta" msgid "error = 0x%08lX" msgstr "error = 0x%08lX" +#: ports/espressif/common-hal/esp32_camera/Camera.c +msgid "" +"esp32_camera.Camera requires reserved PSRAM to be configured. See the " +"documentation for instructions." +msgstr "" + #: py/runtime.c msgid "exceptions must derive from BaseException" msgstr "las excepciones deben derivar de BaseException" @@ -3337,7 +3033,7 @@ msgstr "el primer argumento debe ser una función" msgid "first argument must be a tuple of ndarrays" msgstr "Primer argumento tiene que ser una tupla de ndarrays" -#: extmod/ulab/code/numpy/vector.c +#: extmod/ulab/code/numpy/transform.c extmod/ulab/code/numpy/vector.c msgid "first argument must be an ndarray" msgstr "el primer argumento debe ser ndarray" @@ -3485,7 +3181,7 @@ msgstr "formato de llave incompleto" msgid "incorrect padding" msgstr "relleno (padding) incorrecto" -#: extmod/ulab/code/ndarray.c +#: extmod/ulab/code/ndarray.c extmod/ulab/code/numpy/transform.c msgid "index is out of bounds" msgstr "el índice está fuera de límites" @@ -3503,6 +3199,10 @@ msgstr "indices deben ser enteros" msgid "indices must be integers, slices, or Boolean lists" msgstr "los índices deben ser enteros, particiones o listas de booleanos" +#: ports/espressif/common-hal/busio/I2C.c +msgid "init I2C" +msgstr "" + #: extmod/ulab/code/scipy/optimize/optimize.c msgid "initial values must be iterable" msgstr "los valores iniciales deben permitir iteración" @@ -3548,6 +3248,10 @@ msgstr "la matriz de entrada es asimétrica" msgid "input matrix is singular" msgstr "la matriz de entrada es singular" +#: extmod/ulab/code/numpy/create.c +msgid "input must be 1- or 2-d" +msgstr "" + #: extmod/ulab/code/numpy/carray/carray.c msgid "input must be a 1D ndarray" msgstr "" @@ -3556,11 +3260,7 @@ msgstr "" msgid "input must be a dense ndarray" msgstr "Entrada tiene que ser un ndarray denso" -#: extmod/ulab/code/numpy/create.c -msgid "input must be a tensor of rank 2" -msgstr "Entrada tiene que ser un tensor de rango 2" - -#: extmod/ulab/code/numpy/create.c extmod/ulab/code/user/user.c +#: extmod/ulab/code/user/user.c msgid "input must be an ndarray" msgstr "Entrada tiene que ser un ndarray" @@ -3610,6 +3310,10 @@ msgstr "arquitectura inválida" msgid "invalid bits_per_pixel %d, must be, 1, 2, 4, 8, 16, 24, or 32" msgstr "" +#: ports/raspberrypi/common-hal/ssl/SSLSocket.c +msgid "invalid cert" +msgstr "certificado inválido" + #: shared-bindings/bitmaptools/__init__.c #, c-format msgid "invalid element size %d for bits_per_pixel %d\n" @@ -3636,10 +3340,18 @@ msgstr "especificador de formato inválido" msgid "invalid hostname" msgstr "hostname inválido" +#: ports/raspberrypi/common-hal/ssl/SSLSocket.c +msgid "invalid key" +msgstr "llave inválida" + #: py/compile.c msgid "invalid micropython decorator" msgstr "decorador de micropython inválido" +#: ports/espressif/common-hal/esp32_camera/Camera.c +msgid "invalid setting" +msgstr "" + #: shared-bindings/random/__init__.c msgid "invalid step" msgstr "paso inválido" @@ -3756,10 +3468,6 @@ msgstr "error de dominio matemático" msgid "matrix is not positive definite" msgstr "matrix no es definida positiva" -#: ports/espressif/common-hal/wifi/Radio.c -msgid "max_connections must be between 0 and 10" -msgstr "" - #: ports/espressif/common-hal/_bleio/Descriptor.c #: ports/nrf/common-hal/_bleio/Characteristic.c #: ports/nrf/common-hal/_bleio/Descriptor.c @@ -3767,13 +3475,9 @@ msgstr "" msgid "max_length must be 0-%d when fixed_length is %s" msgstr "max_length debe ser 0-%d cuando fixed_length es %s" -#: shared-bindings/_bleio/Characteristic.c shared-bindings/_bleio/Descriptor.c -msgid "max_length must be >= 0" -msgstr "max_length debe ser >= 0" - #: extmod/ulab/code/ndarray.c -msgid "maximum number of dimensions is 4" -msgstr "Máximo número de dimensiones es 4" +msgid "maximum number of dimensions is " +msgstr "" #: py/runtime.c msgid "maximum recursion depth exceeded" @@ -3907,7 +3611,7 @@ msgstr "no hay pin de reinicio disponible" msgid "no response from SD card" msgstr "no hay respuesta de la tarjeta SD" -#: py/objobject.c py/runtime.c +#: ports/espressif/common-hal/esp32_camera/Camera.c py/objobject.c py/runtime.c msgid "no such attribute" msgstr "no hay tal atributo" @@ -4021,7 +3725,11 @@ msgstr "objeto con protocolo de buffer requerido" msgid "odd-length string" msgstr "string de longitud impar" -#: extmod/ulab/code/numpy/create.c extmod/ulab/code/utils/utils.c +#: supervisor/shared/web_workflow/web_workflow.c +msgid "off" +msgstr "" + +#: extmod/ulab/code/utils/utils.c msgid "offset is too large" msgstr "offset es demasiado grande" @@ -4117,10 +3825,6 @@ msgstr "pack espera %d items para empaquetado (se recibió %d)" msgid "palette must be 32 bytes long" msgstr "palette debe ser 32 bytes de largo" -#: shared-bindings/displayio/Palette.c -msgid "palette_index should be an int" -msgstr "palette_index deberia ser un int" - #: py/emitinlinextensa.c msgid "parameters must be registers in sequence a2 to a5" msgstr "los parámetros deben ser registros en secuencia de a2 a a5" @@ -4145,10 +3849,6 @@ msgstr "pixel_shader debe ser displayio.Palette o displayio.ColorConverter" msgid "poll on file not available on win32" msgstr "" -#: shared-module/vectorio/Polygon.c -msgid "polygon can only be registered in one parent" -msgstr "el polígono solo se puede registrar en uno de los padres" - #: ports/espressif/common-hal/pulseio/PulseIn.c msgid "pop from an empty PulseIn" msgstr "pop de un PulseIn vacío" @@ -4174,7 +3874,23 @@ 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/espressif/boards/adafruit_qtpy_esp32_pico/mpconfigboard.h +msgid "pressing BOOT button at start up.\n" +msgstr "" + +#: ports/espressif/boards/adafruit_feather_esp32_v2/mpconfigboard.h +msgid "pressing SW38 button at start up.\n" +msgstr "" + +#: ports/espressif/boards/hardkernel_odroid_go/mpconfigboard.h +msgid "pressing VOLUME button at start up.\n" +msgstr "" + #: ports/espressif/boards/adafruit_qtpy_esp32c3/mpconfigboard.h +#: ports/espressif/boards/beetle-esp32-c3/mpconfigboard.h +#: ports/espressif/boards/espressif_esp32s2_devkitc_1_n8r2/mpconfigboard.h +#: ports/espressif/boards/lolin_c3_mini/mpconfigboard.h +#: ports/espressif/boards/microdev_micro_c3/mpconfigboard.h #: supervisor/shared/safe_mode.c msgid "pressing boot button at start up.\n" msgstr "presionando botón de arranque al inicio.\n" @@ -4195,14 +3911,6 @@ msgstr "presione el botón izquierdo al arranque\n" msgid "pull masks conflict with direction masks" msgstr "máscara de pull en conflicto con máscara de dirección" -#: ports/raspberrypi/bindings/rp2pio/StateMachine.c -msgid "pull_threshold must be between 1 and 32" -msgstr "pull_threshold debe esta entre 1 y 32" - -#: ports/raspberrypi/bindings/rp2pio/StateMachine.c -msgid "push_threshold must be between 1 and 32" -msgstr "push_threshold debe esta entre 1 y 32" - #: extmod/modutimeq.c msgid "queue overflow" msgstr "desbordamiento de cola(queue)" @@ -4254,14 +3962,6 @@ msgstr "Argumento enrolado tiene que ser un ndarray" msgid "rsplit(None,n)" msgstr "rsplit(None,n)" -#: shared-bindings/audiocore/RawSample.c -msgid "" -"sample_source buffer must be a bytearray or array of type 'h', 'H', 'b' or " -"'B'" -msgstr "" -"sample_source buffer debe ser un bytearray o un array de tipo 'h', 'H', 'b' " -"o'B'" - #: ports/atmel-samd/common-hal/audiobusio/PDMIn.c #: ports/raspberrypi/common-hal/audiobusio/PDMIn.c msgid "sampling rate out of range" @@ -4359,26 +4059,14 @@ msgstr "" msgid "source_bitmap must have value_count of 8" msgstr "" -#: shared-bindings/wifi/Radio.c -msgid "ssid can't be more than 32 bytes" -msgstr "" - #: py/objstr.c msgid "start/end indices" msgstr "índices inicio/final" -#: shared-bindings/displayio/Shape.c -msgid "start_x should be an int" -msgstr "start_x deberia ser un int" - #: shared-bindings/random/__init__.c msgid "step must be non-zero" msgstr "paso debe ser numero no cero" -#: shared-bindings/busio/UART.c -msgid "stop must be 1 or 2" -msgstr "stop debe ser 1 ó 2" - #: shared-bindings/random/__init__.c msgid "stop not reachable from start" msgstr "stop no se puede alcanzar del principio" @@ -4427,10 +4115,6 @@ msgstr "error de sintaxis en el descriptor uctypes" msgid "threshold must be in the range 0-65536" msgstr "limite debe ser en el rango 0-65536" -#: shared-bindings/rgbmatrix/RGBMatrix.c -msgid "tile must be greater than zero" -msgstr "tile debe sera mas grande que cero" - #: shared-bindings/time/__init__.c msgid "time.struct_time() takes a 9-sequence" msgstr "time.struct_time() toma un sequencio 9" @@ -4451,10 +4135,6 @@ msgstr "el tiempo de espera debe ser 0.0-100.0 segundos" msgid "timeout must be < 655.35 secs" msgstr "timeout debe ser < 655.35 segundos" -#: shared-bindings/_bleio/CharacteristicBuffer.c -msgid "timeout must be >= 0.0" -msgstr "tiempo muerto debe ser >= 0.0" - #: shared-module/sdcardio/SDCard.c msgid "timeout waiting for v1 card" msgstr "tiempo de espera agotado esperando por tarjeta v1" @@ -4463,6 +4143,10 @@ msgstr "tiempo de espera agotado esperando por tarjeta v1" msgid "timeout waiting for v2 card" msgstr "tiempo de espera agotado esperando a tarjeta v2" +#: ports/stm/common-hal/pwmio/PWMOut.c +msgid "timer re-init" +msgstr "" + #: shared-bindings/time/__init__.c msgid "timestamp out of range for platform time_t" msgstr "timestamp fuera de rango para plataform time_t" @@ -4528,14 +4212,10 @@ msgstr "type '%q' no es un tipo de base aceptable" msgid "type is not an acceptable base type" msgstr "type no es un tipo de base aceptable" -#: py/runtime.c +#: py/objgenerator.c py/runtime.c msgid "type object '%q' has no attribute '%q'" msgstr "objeto de tipo '%q' no tiene atributo '%q'" -#: py/objgenerator.c -msgid "type object 'generator' has no attribute '__await__'" -msgstr "objeto tipo 'generator' no tiene un atributo '__await__'" - #: py/objtype.c msgid "type takes 1 or 3 arguments" msgstr "type acepta 1 ó 3 argumentos" @@ -4594,7 +4274,6 @@ msgid "unreadable attribute" msgstr "atributo no legible" #: shared-bindings/displayio/TileGrid.c shared-bindings/vectorio/VectorShape.c -#: shared-module/vectorio/Polygon.c shared-module/vectorio/VectorShape.c msgid "unsupported %q type" msgstr "tipo de %q no soportado" @@ -4633,6 +4312,14 @@ msgstr "tipo de operador no soportado" msgid "unsupported types for %q: '%q', '%q'" msgstr "tipos no soportados para %q: '%q', '%q'" +#: extmod/ulab/code/numpy/io/io.c +msgid "usecols is too high" +msgstr "" + +#: extmod/ulab/code/numpy/io/io.c +msgid "usecols keyword must be specified" +msgstr "" + #: py/objint.c #, c-format msgid "value must fit in %d byte(s)" @@ -4654,20 +4341,19 @@ msgstr "watchdog no inicializado" msgid "watchdog timeout must be greater than 0" msgstr "el tiempo de espera del perro guardián debe ser mayor a 0" -#: shared-bindings/bitops/__init__.c -#, c-format -msgid "width must be from 2 to 8 (inclusive), not %d" -msgstr "ancho debe estar entre 2 y 8 (inclusivamente), no %d" - #: shared-bindings/is31fl3741/FrameBuffer.c -#: shared-bindings/rgbmatrix/RGBMatrix.c msgid "width must be greater than zero" msgstr "el ancho debe ser mayor que cero" #: ports/espressif/common-hal/wifi/Radio.c +#: ports/raspberrypi/common-hal/wifi/Radio.c msgid "wifi is not enabled" msgstr "wifi no esta habilitado" +#: ports/raspberrypi/common-hal/wifi/Monitor.c +msgid "wifi.Monitor not available" +msgstr "" + #: shared-bindings/_bleio/Adapter.c msgid "window must be <= interval" msgstr "la ventana debe ser <= intervalo" @@ -4680,7 +4366,17 @@ msgstr "indice de eje erróneo" msgid "wrong axis specified" msgstr "eje especificado erróneo" -#: extmod/ulab/code/numpy/compare.c extmod/ulab/code/numpy/vector.c +#: extmod/ulab/code/numpy/io/io.c +msgid "wrong dtype" +msgstr "" + +#: extmod/ulab/code/numpy/transform.c +msgid "wrong index type" +msgstr "tipo de índice incorrecto" + +#: extmod/ulab/code/numpy/compare.c extmod/ulab/code/numpy/create.c +#: extmod/ulab/code/numpy/io/io.c extmod/ulab/code/numpy/transform.c +#: extmod/ulab/code/numpy/vector.c msgid "wrong input type" msgstr "tipo de entrada incorrecta" @@ -4688,6 +4384,10 @@ msgstr "tipo de entrada incorrecta" msgid "wrong length of condition array" msgstr "" +#: extmod/ulab/code/numpy/transform.c +msgid "wrong length of index array" +msgstr "" + #: extmod/ulab/code/numpy/create.c py/objarray.c py/objstr.c msgid "wrong number of arguments" msgstr "numero erroneo de argumentos" @@ -4708,10 +4408,6 @@ msgstr "valor x fuera de límites" msgid "xTaskCreate failed" msgstr "fallo en xTaskCreate" -#: shared-bindings/displayio/Shape.c -msgid "y should be an int" -msgstr "y deberia ser un int" - #: shared-module/displayio/Shape.c msgid "y value out of bounds" msgstr "valor y fuera de límites" @@ -4732,6 +4428,391 @@ msgstr "zi debe ser de tipo flotante" msgid "zi must be of shape (n_section, 2)" msgstr "zi debe ser una forma (n_section,2)" +#~ msgid "Stream missing readinto() or write() method." +#~ msgstr "A Stream le falta el método readinto() o write()." + +#~ msgid "%q must be >= 0" +#~ msgstr "%q debe ser >= 0" + +#~ msgid "%q must be >= 1" +#~ msgstr "%q debe ser >= 1" + +#~ msgid "address out of bounds" +#~ msgstr "address fuera de límites" + +#~ msgid "destination_length must be an int >= 0" +#~ msgstr "destination_length debe ser un int >= 0" + +#~ msgid "type object 'generator' has no attribute '__await__'" +#~ msgstr "objeto tipo 'generator' no tiene un atributo '__await__'" + +#~ msgid "color should be an int" +#~ msgstr "color deberia ser un int" + +#~ msgid "end_x should be an int" +#~ msgstr "end_x debe ser un int" + +#~ msgid "palette_index should be an int" +#~ msgstr "palette_index deberia ser un int" + +#~ msgid "start_x should be an int" +#~ msgstr "start_x deberia ser un int" + +#~ msgid "y should be an int" +#~ msgstr "y deberia ser un int" + +#~ msgid "" +#~ "sample_source buffer must be a bytearray or array of type 'h', 'H', 'b' " +#~ "or 'B'" +#~ msgstr "" +#~ "sample_source buffer debe ser un bytearray o un array de tipo 'h', 'H', " +#~ "'b' o'B'" + +#~ msgid "Expected an alarm" +#~ msgstr "Un objecto alarm era esperado" + +#~ msgid "Failed to init wifi" +#~ msgstr "Fallo al inicializar wifi" + +#~ msgid "input must be a tensor of rank 2" +#~ msgstr "Entrada tiene que ser un tensor de rango 2" + +#~ msgid "maximum number of dimensions is 4" +#~ msgstr "Máximo número de dimensiones es 4" + +#~ msgid "Watchdog timer expired." +#~ msgstr "Temporizador de perro guardián expirado." + +#~ msgid "%q must be a tuple of length 2" +#~ msgstr "%q debe ser una tupla de longitud 2" + +#~ msgid "%q must be between %d and %d" +#~ msgstr "%q debe estar entre %d y %d" + +#~ msgid "%q should be an int" +#~ msgstr "%q debe ser un int" + +#~ msgid "Address type out of range" +#~ msgstr "Tipo de dirección fuera de rango" + +#~ msgid "AnalogIn not supported on given pin" +#~ msgstr "El pin proporcionado no soporta AnalogIn" + +#~ msgid "AnalogOut functionality not supported" +#~ msgstr "Funcionalidad AnalogOut no soportada" + +#~ msgid "AnalogOut is only 16 bits. Value must be less than 65536." +#~ msgstr "AnalogOut es solo de 16 bits. El valor debe ser menor que 65536." + +#~ msgid "AnalogOut not supported on given pin" +#~ msgstr "El pin proporcionado no soporta AnalogOut" + +#, c-format +#~ msgid "Bit depth must be from 1 to 6 inclusive, not %d" +#~ msgstr "Bit depth tiene que ser de 1 a 6 inclusivo, no %d" + +#, c-format +#~ msgid "Buffer incorrect size. Should be %d bytes." +#~ msgstr "Tamaño de buffer incorrecto. Debe ser de %d bytes." + +#~ msgid "Buffer must be at least length 1" +#~ msgstr "Buffer debe ser de longitud 1 como minimo" + +#~ msgid "Bytes must be between 0 and 255." +#~ msgstr "Bytes debe estar entre 0 y 255." + +#~ msgid "Cannot output both channels on the same pin" +#~ msgstr "No se puede tener ambos canales en el mismo pin" + +#~ msgid "Cannot read without MISO pin." +#~ msgstr "No se puede leer sin pin MISO." + +#~ msgid "Cannot reset into bootloader because no bootloader is present." +#~ msgstr "" +#~ "No se puede reiniciar a bootloader porque no hay bootloader presente." + +#~ msgid "Cannot transfer without MOSI and MISO pins." +#~ msgstr "No se puede transmitir sin pines MOSI y MISO." + +#~ msgid "Cannot write without MOSI pin." +#~ msgstr "No se puede escribir sin pin MOSI." + +#~ msgid "Clock pin init failed." +#~ msgstr "Iniciado de pin de reloj fallido." + +#~ msgid "Command must be an int between 0 and 255" +#~ msgstr "Command debe ser un int entre 0 y 255" + +#~ msgid "Could not initialize Camera" +#~ msgstr "No se puede inicializar Camera" + +#~ msgid "Could not initialize GNSS" +#~ msgstr "No se pudo inicializar el GNSS" + +#~ msgid "Could not initialize SDCard" +#~ msgstr "No se pudo inicializar SDCard" + +#~ msgid "Could not initialize UART" +#~ msgstr "No se puede inicializar la UART" + +#~ msgid "Could not re-init channel" +#~ msgstr "No se pudo reiniciar el canal" + +#~ msgid "Could not re-init timer" +#~ msgstr "No se pudo reiniciar el temporizador" + +#~ msgid "Could not restart PWM" +#~ msgstr "No se pudo reiniciar el PWM" + +#~ msgid "Couldn't allocate first buffer" +#~ msgstr "No se pudo asignar el primer buffer" + +#~ msgid "Couldn't allocate input buffer" +#~ msgstr "No se pudo encontrar el buffer de entrada" + +#~ msgid "Couldn't allocate second buffer" +#~ msgstr "No se pudo asignar el segundo buffer" + +#~ msgid "DigitalInOut not supported on given pin" +#~ msgstr "DigitalInOut no es compatible con un pin dado" + +#, c-format +#~ msgid "Expected tuple of length %d, got %d" +#~ msgstr "Se esperaba un tuple de %d, se obtuvo %d" + +#~ msgid "Failed to allocate RX buffer" +#~ msgstr "Ha fallado la asignación del buffer RX" + +#, c-format +#~ msgid "Failed to allocate RX buffer of %d bytes" +#~ msgstr "Falló la asignación del buffer RX de %d bytes" + +#, c-format +#~ msgid "Framebuffer requires %d bytes" +#~ msgstr "Framebuffer requiere %d bytes" + +#~ msgid "Hostname must be between 1 and 253 characters" +#~ msgstr "Hostname debe ser entre 1 y 253 caracteres" + +#~ msgid "I2C Init Error" +#~ msgstr "I2C Error de inicio" + +#~ msgid "Invalid %q pin selection" +#~ msgstr "selección inválida de pin %q" + +#~ msgid "Invalid AuthMode" +#~ msgstr "AuthMode invalido" + +#~ msgid "Invalid BMP file" +#~ msgstr "Archivo BMP inválido" + +#~ msgid "Invalid DAC pin supplied" +#~ msgstr "Pin suministrado inválido para DAC" + +#~ msgid "Invalid MIDI file" +#~ msgstr "Archivo MIDI inválido" + +#~ msgid "Invalid PWM frequency" +#~ msgstr "Frecuencia PWM inválida" + +#~ msgid "Invalid Pin" +#~ msgstr "Pin inválido" + +#~ msgid "Invalid buffer size" +#~ msgstr "Tamaño de buffer inválido" + +#~ msgid "Invalid byteorder string" +#~ msgstr "Cadena de byteorder inválida" + +#~ msgid "Invalid capture period. Valid range: 1 - 500" +#~ msgstr "Inválido periodo de captura. Rango válido: 1 - 500" + +#~ msgid "Invalid channel count" +#~ msgstr "Cuenta de canales inválida" + +#, c-format +#~ msgid "Invalid data_count %d" +#~ msgstr "data_count inválido %d" + +#~ msgid "Invalid direction." +#~ msgstr "Dirección inválida." + +#~ msgid "Invalid file" +#~ msgstr "Archivo inválido" + +#~ msgid "Invalid number of bits" +#~ msgstr "Numero inválido de bits" + +#~ msgid "Invalid phase" +#~ msgstr "Fase inválida" + +#~ msgid "Invalid pin" +#~ msgstr "Pin inválido" + +#~ msgid "Invalid pin for left channel" +#~ msgstr "Pin inválido para canal izquierdo" + +#~ msgid "Invalid pin for right channel" +#~ msgstr "Pin inválido para canal derecho" + +#~ msgid "Invalid polarity" +#~ msgstr "Polaridad inválida" + +#~ msgid "Invalid properties" +#~ msgstr "Propiedades inválidas" + +#~ msgid "Invalid run mode." +#~ msgstr "Modo de ejecución inválido." + +#~ msgid "Invalid security_mode" +#~ msgstr "'security_mode' no válido" + +#~ msgid "Invalid voice" +#~ msgstr "Voz inválida" + +#~ msgid "Invalid voice count" +#~ msgstr "Cuenta de voces inválida" + +#~ msgid "Invalid wave file" +#~ msgstr "Archivo wave inválido" + +#~ msgid "Invalid word/bit length" +#~ msgstr "Tamaño no válido de palabra/bit" + +#~ msgid "Layer already in a group." +#~ msgstr "La capa ya pertenece a un grupo." + +#~ msgid "Layer must be a Group or TileGrid subclass." +#~ msgstr "Layer debe ser una subclase de Group o TileGrid." + +#~ msgid "MISO pin init failed." +#~ msgstr "MISO pin init fallido." + +#~ msgid "MOSI pin init failed." +#~ msgstr "MOSI pin init fallido." + +#~ msgid "Messages limited to 8 bytes" +#~ msgstr "Mensajes limitados a 8 bytes" + +#~ msgid "No hardware support on clk pin" +#~ msgstr "Sin soporte de hardware en el pin clk" + +#~ msgid "No hardware support on pin" +#~ msgstr "Sin soporte de hardware en pin" + +#, c-format +#~ msgid "Output buffer must be at least %d bytes" +#~ msgstr "buffer de salida debe ser de por lo menos %d bytes" + +#~ msgid "" +#~ "PWM duty_cycle must be between 0 and 65535 inclusive (16 bit resolution)" +#~ msgstr "" +#~ "PWM duty_cycle debe ser entre 0 y 65535 inclusivo (16 bit resolution)" + +#~ msgid "Pin count must be at least 1" +#~ msgstr "El total de pines debe ser por lo menos 1" + +#~ msgid "Pin does not have ADC capabilities" +#~ msgstr "Pin no tiene capacidad ADC" + +#~ msgid "Program must contain at least one 16-bit instruction." +#~ msgstr "El programa debe contener por lo menos una instrucción de 16 bits." + +#~ msgid "Program too large" +#~ msgstr "Programa demasiado grande" + +#~ msgid "RS485 Not yet supported on this device" +#~ msgstr "RS485 no esta soportado todavía en este dispositivo" + +#~ msgid "RTC calibration is not supported on this board" +#~ msgstr "Calibración de RTC no es soportada en esta placa" + +#~ msgid "RTS/CTS/RS485 Not yet supported on this device" +#~ msgstr "Sin capacidad de RTS/CTS/RS485 para este dispositivo" + +#~ msgid "SPI Init Error" +#~ msgstr "Error de inicio de SPI" + +#~ msgid "SPI Re-initialization error" +#~ msgstr "Error de reinicialización de SPI" + +#~ msgid "Sample rate must be positive" +#~ msgstr "Sample rate debe ser positivo" + +#, c-format +#~ msgid "Sample rate too high. It must be less than %d" +#~ msgstr "Frecuencia de muestreo demasiado alta. Debe ser menor a %d" + +#~ msgid "Set pin count must be between 1 and 5" +#~ msgstr "La suma de pines configurados debe estar entre 1 y 5" + +#~ msgid "Side set pin count must be between 1 and 5" +#~ msgstr "El conteo de pines de Side set debe estar entre 1 y 5" + +#~ msgid "Stack size must be at least 256" +#~ msgstr "El tamaño de la pila debe ser de al menos 256" + +#~ msgid "Tile value out of bounds" +#~ msgstr "Valor de mosaico fuera de límites" + +#~ msgid "UART Buffer allocation error" +#~ msgstr "No se pudo encontrar el búfer para UART" + +#~ msgid "UART De-init error" +#~ msgstr "Error de desinicialización de UART" + +#~ msgid "UART Init Error" +#~ msgstr "Error de inicialización de UART" + +#~ msgid "UART Re-init error" +#~ msgstr "Error de reinicialización de UART" + +#~ msgid "UART write error" +#~ msgstr "Error de escritura UART" + +#~ msgid "Unsupported baudrate" +#~ msgstr "Baudrate no soportado" + +#~ msgid "WiFi password must be between 8 and 63 characters" +#~ msgstr "La clave de WiFi debe ser entre 8 y 63 caracteres" + +#~ msgid "bits must be in range 5 to 9" +#~ msgstr "los bits deben estar en el rango de 5 a 9" + +#~ msgid "bytes > 8 bits not supported" +#~ msgstr "bytes > 8 bits no soportados" + +#~ msgid "calibration value out of range +/-127" +#~ msgstr "Valor de calibración fuera del rango +/-127" + +#~ msgid "circle can only be registered in one parent" +#~ msgstr "circulo solo puede ser registrado con un pariente" + +#~ msgid "max_length must be >= 0" +#~ msgstr "max_length debe ser >= 0" + +#~ msgid "polygon can only be registered in one parent" +#~ msgstr "el polígono solo se puede registrar en uno de los padres" + +#~ msgid "pull_threshold must be between 1 and 32" +#~ msgstr "pull_threshold debe esta entre 1 y 32" + +#~ msgid "push_threshold must be between 1 and 32" +#~ msgstr "push_threshold debe esta entre 1 y 32" + +#~ msgid "stop must be 1 or 2" +#~ msgstr "stop debe ser 1 ó 2" + +#~ msgid "tile must be greater than zero" +#~ msgstr "tile debe sera mas grande que cero" + +#~ msgid "timeout must be >= 0.0" +#~ msgstr "tiempo muerto debe ser >= 0.0" + +#, c-format +#~ msgid "width must be from 2 to 8 (inclusive), not %d" +#~ msgstr "ancho debe estar entre 2 y 8 (inclusivamente), no %d" + #~ msgid "Unsupported operation" #~ msgstr "Operación no soportada" @@ -5042,12 +5123,6 @@ msgstr "zi debe ser una forma (n_section,2)" #~ msgid "can only save bytecode" #~ msgstr "solo puede almacenar bytecode" -#~ msgid "invalid cert" -#~ msgstr "certificado inválido" - -#~ msgid "invalid key" -#~ msgstr "llave inválida" - #~ msgid "Viper functions don't currently support more than 4 arguments" #~ msgstr "funciones Viper no soportan por el momento, más de 4 argumentos" @@ -5257,9 +5332,6 @@ msgstr "zi debe ser una forma (n_section,2)" #~ msgid "wrong argument type" #~ msgstr "tipo de argumento incorrecto" -#~ msgid "wrong index type" -#~ msgstr "tipo de índice incorrecto" - #~ msgid "specify size or data, but not both" #~ msgstr "especifique o tamaño o datos, pero no ambos" diff --git a/locale/fil.po b/locale/fil.po index ea43686206..49f5eaef2c 100644 --- a/locale/fil.po +++ b/locale/fil.po @@ -61,16 +61,38 @@ msgstr " output:\n" msgid "%%c requires int or char" msgstr "%%c nangangailangan ng int o char" +#: main.c +#, c-format +msgid "%02X" +msgstr "" + #: shared-bindings/rgbmatrix/RGBMatrix.c #, c-format msgid "" "%d address pins, %d rgb pins and %d tiles indicate a height of %d, not %d" msgstr "" +#: ports/atmel-samd/common-hal/alarm/__init__.c +#: ports/cxd56/common-hal/analogio/AnalogOut.c ports/cxd56/common-hal/rtc/RTC.c +#: ports/espressif/common-hal/rtc/RTC.c +#: ports/mimxrt10xx/common-hal/analogio/AnalogOut.c +#: ports/mimxrt10xx/common-hal/rtc/RTC.c ports/nrf/common-hal/alarm/__init__.c +#: ports/nrf/common-hal/analogio/AnalogOut.c ports/nrf/common-hal/rtc/RTC.c +#: ports/raspberrypi/common-hal/alarm/__init__.c +#: ports/raspberrypi/common-hal/analogio/AnalogOut.c +#: ports/raspberrypi/common-hal/rtc/RTC.c ports/stm/common-hal/alarm/__init__.c +#: ports/stm/common-hal/rtc/RTC.c +msgid "%q" +msgstr "" + #: shared-bindings/microcontroller/Pin.c msgid "%q and %q contain duplicate pins" msgstr "" +#: ports/atmel-samd/common-hal/audioio/AudioOut.c +msgid "%q and %q must be different" +msgstr "" + #: shared-bindings/microcontroller/Pin.c msgid "%q contains duplicate pins" msgstr "" @@ -79,16 +101,12 @@ msgstr "" msgid "%q failure: %d" msgstr "" +#: shared-bindings/digitalio/DigitalInOut.c #: shared-bindings/microcontroller/Pin.c msgid "%q in use" msgstr "%q ay ginagamit" -#: ports/atmel-samd/common-hal/pulseio/PulseIn.c -#: ports/cxd56/common-hal/pulseio/PulseIn.c -#: ports/nrf/common-hal/pulseio/PulseIn.c -#: ports/raspberrypi/common-hal/pulseio/PulseIn.c -#: ports/stm/common-hal/pulseio/PulseIn.c py/obj.c py/objstr.c -#: py/objstrunicode.c +#: py/obj.c py/objstr.c py/objstrunicode.c msgid "%q index out of range" msgstr "%q indeks wala sa sakop" @@ -96,14 +114,34 @@ msgstr "%q indeks wala sa sakop" msgid "%q indices must be integers, not %s" msgstr "%q indeks ay dapat integers, hindi %s" +#: shared-module/bitbangio/SPI.c +msgid "%q init failed" +msgstr "" + +#: py/argcheck.c +msgid "%q length must be %d" +msgstr "" + #: py/argcheck.c msgid "%q length must be %d-%d" msgstr "" -#: shared-bindings/busio/I2C.c shared-bindings/usb_hid/Device.c +#: py/argcheck.c +msgid "%q length must be <= %d" +msgstr "" + +#: py/argcheck.c +msgid "%q length must be >= %d" +msgstr "" + +#: shared-bindings/busio/I2C.c msgid "%q length must be >= 1" msgstr "" +#: py/argcheck.c +msgid "%q must be %d" +msgstr "" + #: py/argcheck.c msgid "%q must be %d-%d" msgstr "" @@ -120,30 +158,17 @@ msgstr "" msgid "%q must be >= %d" msgstr "" -#: py/argcheck.c shared-bindings/memorymonitor/AllocationAlarm.c -msgid "%q must be >= 0" +#: shared-bindings/analogbufio/BufferedIn.c +#: shared-bindings/audiocore/RawSample.c +msgid "%q must be a bytearray or array of type 'h', 'H', 'b', or 'B'" msgstr "" -#: shared-bindings/_bleio/CharacteristicBuffer.c -#: shared-bindings/_bleio/PacketBuffer.c shared-bindings/displayio/Group.c -#: shared-bindings/displayio/Shape.c -#: shared-bindings/memorymonitor/AllocationAlarm.c -#: shared-bindings/vectorio/Circle.c shared-bindings/vectorio/Rectangle.c -#, fuzzy -msgid "%q must be >= 1" -msgstr "aarehas na haba dapat ang buffer slices" - #: py/argcheck.c msgid "%q must be a string" msgstr "" -#: shared-module/vectorio/Polygon.c -msgid "%q must be a tuple of length 2" -msgstr "" - -#: ports/espressif/common-hal/imagecapture/ParallelImageCapture.c -#: shared-module/vectorio/VectorShape.c -msgid "%q must be between %d and %d" +#: py/argcheck.c +msgid "%q must be an int" msgstr "" #: py/argcheck.c @@ -162,7 +187,11 @@ msgstr "" msgid "%q out of bounds" msgstr "" +#: ports/atmel-samd/common-hal/pulseio/PulseIn.c +#: ports/cxd56/common-hal/pulseio/PulseIn.c +#: ports/nrf/common-hal/pulseio/PulseIn.c #: ports/raspberrypi/common-hal/rp2pio/StateMachine.c +#: ports/stm/common-hal/pulseio/PulseIn.c py/argcheck.c #: shared-bindings/canio/Match.c msgid "%q out of range" msgstr "" @@ -171,11 +200,6 @@ msgstr "" msgid "%q pin invalid" msgstr "" -#: shared-bindings/fontio/BuiltinFont.c -#, fuzzy -msgid "%q should be an int" -msgstr "y ay dapat int" - #: shared-bindings/usb_hid/Device.c msgid "%q with a report ID of 0 must be of length 1" msgstr "" @@ -189,7 +213,11 @@ msgstr "" msgid "%q, %q, and %q must all be the same length" msgstr "" -#: ports/espressif/bindings/espidf/__init__.c ports/espressif/esp_error.c +#: py/objint.c +msgid "%q=%q" +msgstr "" + +#: ports/espressif/common-hal/espidf/__init__.c ports/espressif/esp_error.c #, c-format msgid "%s error 0x%x" msgstr "" @@ -274,7 +302,7 @@ msgstr "" msgid "'%s' object doesn't support item deletion" msgstr "" -#: py/runtime.c +#: ports/raspberrypi/common-hal/wifi/Radio.c py/runtime.c msgid "'%s' object has no attribute '%q'" msgstr "'%s' object ay walang attribute '%q'" @@ -339,10 +367,6 @@ msgstr "" msgid "'yield' outside function" msgstr "'yield' sa labas ng function" -#: shared-module/vectorio/VectorShape.c -msgid "(x,y) integers required" -msgstr "" - #: py/compile.c msgid "*x must be assignment target" msgstr "*x ay dapat na assignment target" @@ -378,16 +402,12 @@ msgstr "" msgid "Address must be %d bytes long" msgstr "ang palette ay dapat 32 bytes ang haba" -#: shared-bindings/_bleio/Address.c -msgid "Address type out of range" -msgstr "" - #: ports/espressif/common-hal/canio/CAN.c msgid "All CAN peripherals are in use" msgstr "" #: ports/espressif/common-hal/busio/I2C.c -#: ports/espressif/common-hal/i2cperipheral/I2CPeripheral.c +#: ports/espressif/common-hal/i2ctarget/I2CTarget.c #: ports/nrf/common-hal/busio/I2C.c msgid "All I2C peripherals are in use" msgstr "Lahat ng I2C peripherals ginagamit" @@ -425,7 +445,6 @@ msgstr "" msgid "All event channels in use" msgstr "Lahat ng event channels ginagamit" -#: ports/raspberrypi/common-hal/pulseio/PulseIn.c #: ports/raspberrypi/common-hal/rp2pio/StateMachine.c msgid "All state machines in use" msgstr "" @@ -470,28 +489,10 @@ msgid "Already running" msgstr "" #: ports/espressif/common-hal/wifi/Radio.c +#: ports/raspberrypi/common-hal/wifi/Radio.c msgid "Already scanning for wifi networks" msgstr "" -#: ports/cxd56/common-hal/analogio/AnalogIn.c -msgid "AnalogIn not supported on given pin" -msgstr "" - -#: ports/cxd56/common-hal/analogio/AnalogOut.c -#: ports/mimxrt10xx/common-hal/analogio/AnalogOut.c -#: ports/nrf/common-hal/analogio/AnalogOut.c -#: ports/raspberrypi/common-hal/analogio/AnalogOut.c -msgid "AnalogOut functionality not supported" -msgstr "Hindi supportado ang AnalogOut" - -#: shared-bindings/analogio/AnalogOut.c -msgid "AnalogOut is only 16 bits. Value must be less than 65536." -msgstr "AnalogOut ay 16 bits. Value ay dapat hindi hihigit pa sa 65536." - -#: ports/atmel-samd/common-hal/analogio/AnalogOut.c -msgid "AnalogOut not supported on given pin" -msgstr "Hindi supportado ang AnalogOut sa ibinigay na pin" - #: ports/stm/common-hal/audiopwmio/PWMAudioOut.c msgid "Another PWMAudioOut is already active" msgstr "" @@ -530,7 +531,7 @@ msgstr "" msgid "AuthMode.OPEN is not used with password" msgstr "" -#: shared-bindings/wifi/Radio.c +#: shared-bindings/wifi/Radio.c supervisor/shared/web_workflow/web_workflow.c msgid "Authentication failure" msgstr "" @@ -563,11 +564,6 @@ 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." @@ -609,11 +605,6 @@ msgstr "" msgid "Buffer elements must be 4 bytes long or less" msgstr "" -#: shared-module/usb_hid/Device.c -#, c-format -msgid "Buffer incorrect size. Should be %d bytes." -msgstr "Mali ang size ng buffer. Dapat %d bytes." - #: shared-bindings/framebufferio/FramebufferDisplay.c msgid "Buffer is not a bytearray." msgstr "" @@ -623,7 +614,6 @@ msgstr "" msgid "Buffer is too small" msgstr "" -#: ports/nrf/common-hal/audiopwmio/PWMAudioOut.c #: ports/stm/common-hal/audiopwmio/PWMAudioOut.c #, c-format msgid "Buffer length %d too big. It must be less than %d" @@ -638,10 +628,6 @@ msgstr "" msgid "Buffer must be a multiple of 512 bytes" msgstr "" -#: shared-bindings/bitbangio/I2C.c -msgid "Buffer must be at least length 1" -msgstr "Buffer dapat ay hindi baba sa 1 na haba" - #: shared-bindings/_bleio/PacketBuffer.c #, c-format msgid "Buffer too short by %d bytes" @@ -664,10 +650,6 @@ msgstr "Ginagamit na ang DAC" msgid "Byte buffer must be 16 bytes." msgstr "buffer ay dapat bytes-like object" -#: shared-bindings/alarm/SleepMemory.c shared-bindings/nvm/ByteArray.c -msgid "Bytes must be between 0 and 255." -msgstr "Sa gitna ng 0 o 255 dapat ang bytes." - #: shared-bindings/aesio/aes.c msgid "CBC blocks must be multiples of 16 bytes" msgstr "" @@ -676,7 +658,7 @@ msgstr "" msgid "CIRCUITPY drive could not be found or created." msgstr "" -#: ports/espressif/bindings/espidf/__init__.c ports/espressif/esp_error.c +#: ports/espressif/common-hal/espidf/__init__.c ports/espressif/esp_error.c msgid "CRC or checksum was invalid" msgstr "" @@ -684,6 +666,10 @@ msgstr "" msgid "Call super().__init__() before accessing native object." msgstr "" +#: ports/cxd56/common-hal/camera/Camera.c +msgid "Camera init" +msgstr "" + #: ports/espressif/common-hal/alarm/pin/PinAlarm.c msgid "Can only alarm on RTC IO from deep sleep." msgstr "" @@ -732,18 +718,10 @@ msgstr "Hindi makuha ang temperatura. status 0x%02x" msgid "Cannot have scan responses for extended, connectable advertisements." msgstr "" -#: ports/atmel-samd/common-hal/audioio/AudioOut.c -msgid "Cannot output both channels on the same pin" -msgstr "Hindi maaaring output ang mga parehong channel sa parehong pin" - #: ports/espressif/common-hal/alarm/pin/PinAlarm.c msgid "Cannot pull on input-only pin." msgstr "" -#: shared-module/bitbangio/SPI.c -msgid "Cannot read without MISO pin." -msgstr "Hindi maaring mabasa kapag walang MISO pin." - #: shared-bindings/audiobusio/PDMIn.c msgid "Cannot record to a file" msgstr "Hindi ma-record sa isang file" @@ -755,8 +733,8 @@ msgstr "" #: ports/atmel-samd/common-hal/microcontroller/__init__.c #: ports/cxd56/common-hal/microcontroller/__init__.c #: ports/mimxrt10xx/common-hal/microcontroller/__init__.c -msgid "Cannot reset into bootloader because no bootloader is present." -msgstr "Hindi ma-reset sa bootloader dahil walang bootloader." +msgid "Cannot reset into bootloader because no bootloader is present" +msgstr "" #: ports/espressif/common-hal/socketpool/Socket.c msgid "Cannot set socket options" @@ -776,21 +754,20 @@ msgid "Cannot subclass slice" msgstr "Hindi magawa ang sublcass slice" #: shared-module/bitbangio/SPI.c -msgid "Cannot transfer without MOSI and MISO pins." -msgstr "Hindi maaaring ilipat kapag walang MOSI at MISO pin." +msgid "Cannot transfer without MOSI and MISO pins" +msgstr "" #: shared-bindings/pwmio/PWMOut.c msgid "Cannot vary frequency on a timer that is already in use" msgstr "" -#: ports/espressif/common-hal/alarm/pin/PinAlarm.c #: ports/nrf/common-hal/alarm/pin/PinAlarm.c -msgid "Cannot wake on pin edge. Only level." +msgid "Cannot wake on pin edge, only level" msgstr "" -#: shared-module/bitbangio/SPI.c -msgid "Cannot write without MOSI pin." -msgstr "Hindi maaring isulat kapag walang MOSI pin." +#: ports/espressif/common-hal/alarm/pin/PinAlarm.c +msgid "Cannot wake on pin edge. Only level." +msgstr "" #: shared-bindings/_bleio/CharacteristicBuffer.c msgid "CharacteristicBuffer writing not provided" @@ -804,10 +781,6 @@ msgstr "" msgid "CircuitPython was unable to allocate the heap." msgstr "" -#: shared-module/bitbangio/SPI.c -msgid "Clock pin init failed." -msgstr "Nabigo sa pag init ng Clock pin." - #: shared-module/bitbangio/I2C.c msgid "Clock stretch too long" msgstr "Masyadong mahaba ang Clock stretch" @@ -816,12 +789,6 @@ msgstr "Masyadong mahaba ang Clock stretch" msgid "Clock unit in use" msgstr "Clock unit ginagamit" -#: shared-bindings/displayio/FourWire.c shared-bindings/displayio/I2CDisplay.c -#: shared-bindings/paralleldisplay/ParallelBus.c -#, fuzzy -msgid "Command must be an int between 0 and 255" -msgstr "Sa gitna ng 0 o 255 dapat ang bytes." - #: shared-bindings/_bleio/Connection.c msgid "" "Connection has been disconnected and can no longer be used. Create a new " @@ -832,35 +799,6 @@ msgstr "" msgid "Corrupt .mpy file" msgstr "" -#: ports/cxd56/common-hal/camera/Camera.c -msgid "Could not initialize Camera" -msgstr "" - -#: ports/cxd56/common-hal/gnss/GNSS.c -msgid "Could not initialize GNSS" -msgstr "" - -#: ports/cxd56/common-hal/sdioio/SDCard.c -msgid "Could not initialize SDCard" -msgstr "" - -#: ports/atmel-samd/common-hal/busio/UART.c ports/cxd56/common-hal/busio/UART.c -#: ports/espressif/common-hal/busio/UART.c -msgid "Could not initialize UART" -msgstr "Hindi ma-initialize ang UART" - -#: ports/stm/common-hal/pwmio/PWMOut.c -msgid "Could not re-init channel" -msgstr "" - -#: ports/stm/common-hal/pwmio/PWMOut.c -msgid "Could not re-init timer" -msgstr "" - -#: ports/stm/common-hal/pwmio/PWMOut.c -msgid "Could not restart PWM" -msgstr "" - #: ports/espressif/common-hal/neopixel_write/__init__.c msgid "Could not retrieve clock" msgstr "" @@ -881,20 +819,6 @@ msgstr "" msgid "Couldn't allocate decoder" msgstr "" -#: shared-module/audiocore/WaveFile.c shared-module/audiomixer/Mixer.c -#: shared-module/audiomp3/MP3Decoder.c -msgid "Couldn't allocate first buffer" -msgstr "Hindi ma-iallocate ang first buffer" - -#: shared-module/audiomp3/MP3Decoder.c -msgid "Couldn't allocate input buffer" -msgstr "" - -#: shared-module/audiocore/WaveFile.c shared-module/audiomixer/Mixer.c -#: shared-module/audiomp3/MP3Decoder.c -msgid "Couldn't allocate second buffer" -msgstr "Hindi ma-iallocate ang second buffer" - #: supervisor/shared/safe_mode.c msgid "Crash into the HardFault_Handler." msgstr "" @@ -945,10 +869,6 @@ msgstr "" msgid "Device in use" msgstr "" -#: ports/cxd56/common-hal/digitalio/DigitalInOut.c -msgid "DigitalInOut not supported on given pin" -msgstr "" - #: shared-bindings/displayio/Display.c #: shared-bindings/framebufferio/FramebufferDisplay.c msgid "Display must have a 16 bit colorspace." @@ -960,6 +880,10 @@ msgstr "" msgid "Display rotation must be in 90 degree increments" msgstr "" +#: main.c +msgid "Done" +msgstr "" + #: shared-bindings/digitalio/DigitalInOut.c msgid "Drive mode not used when direction is input." msgstr "Drive mode ay hindi ginagamit kapag ang direksyon ay input." @@ -993,20 +917,19 @@ msgstr "May pagkakamali sa REGEX" msgid "Error: Failure to bind" msgstr "" -#: ports/raspberrypi/bindings/rp2pio/StateMachine.c py/enum.c -#: shared-bindings/_bleio/__init__.c shared-bindings/aesio/aes.c -#: shared-bindings/busio/SPI.c shared-bindings/microcontroller/Pin.c +#: py/enum.c shared-bindings/_bleio/__init__.c shared-bindings/aesio/aes.c +#: shared-bindings/alarm/__init__.c shared-bindings/busio/SPI.c +#: shared-bindings/microcontroller/Pin.c #: shared-bindings/neopixel_write/__init__.c msgid "Expected a %q" msgstr "Umasa ng %q" -#: shared-bindings/alarm/__init__.c -msgid "Expected an alarm" +#: ports/raspberrypi/bindings/cyw43/__init__.c +msgid "Expected a %q or %q" msgstr "" -#: shared-module/adafruit_pixelbuf/PixelBuf.c -#, c-format -msgid "Expected tuple of length %d, got %d" +#: shared-bindings/alarm/__init__.c +msgid "Expected an %q" msgstr "" #: ports/espressif/common-hal/_bleio/Adapter.c @@ -1035,21 +958,9 @@ msgstr "" msgid "Failed to acquire mutex, err 0x%04x" msgstr "Nabigo sa pag kuha ng mutex, status: 0x%08lX" -#: ports/mimxrt10xx/common-hal/busio/UART.c ports/nrf/common-hal/busio/UART.c -#: ports/raspberrypi/common-hal/busio/UART.c -msgid "Failed to allocate RX buffer" -msgstr "Nabigong ilaan ang RX buffer" - -#: ports/atmel-samd/common-hal/busio/UART.c -#: ports/atmel-samd/common-hal/pulseio/PulseIn.c -#: ports/cxd56/common-hal/pulseio/PulseIn.c -#: ports/espressif/common-hal/pulseio/PulseIn.c -#: ports/nrf/common-hal/pulseio/PulseIn.c -#: ports/raspberrypi/common-hal/pulseio/PulseIn.c -#: ports/stm/common-hal/pulseio/PulseIn.c -#, c-format -msgid "Failed to allocate RX buffer of %d bytes" -msgstr "Nabigong ilaan ang RX buffer ng %d bytes" +#: shared-module/rgbmatrix/RGBMatrix.c +msgid "Failed to allocate %q buffer" +msgstr "" #: ports/espressif/common-hal/wifi/__init__.c msgid "Failed to allocate Wifi memory" @@ -1072,10 +983,6 @@ msgstr "" msgid "Failed to connect: timeout" msgstr "" -#: ports/espressif/common-hal/wifi/__init__.c -msgid "Failed to init wifi" -msgstr "" - #: shared-module/audiomp3/MP3Decoder.c msgid "Failed to parse MP3 file" msgstr "" @@ -1119,11 +1026,6 @@ msgstr "" msgid "Format not supported" msgstr "" -#: shared-module/framebufferio/FramebufferDisplay.c -#, c-format -msgid "Framebuffer requires %d bytes" -msgstr "" - #: ports/mimxrt10xx/common-hal/microcontroller/Processor.c msgid "" "Frequency must be 24, 150, 396, 450, 528, 600, 720, 816, 912, 960 or 1008 Mhz" @@ -1138,7 +1040,11 @@ msgstr "" msgid "Function requires lock" msgstr "Function nangangailangan ng lock" -#: ports/espressif/bindings/espidf/__init__.c ports/espressif/esp_error.c +#: ports/cxd56/common-hal/gnss/GNSS.c +msgid "GNSS init" +msgstr "" + +#: ports/espressif/common-hal/espidf/__init__.c ports/espressif/esp_error.c msgid "Generic Failure" msgstr "" @@ -1165,19 +1071,16 @@ msgstr "" msgid "Hardware in use, try alternative pins" msgstr "" -#: shared-bindings/wifi/Radio.c -msgid "Hostname must be between 1 and 253 characters" -msgstr "" - #: extmod/vfs_posix_file.c py/objstringio.c msgid "I/O operation on closed file" msgstr "I/O operasyon sa saradong file" #: ports/stm/common-hal/busio/I2C.c -msgid "I2C Init Error" +msgid "I2C init error" msgstr "" #: ports/raspberrypi/common-hal/busio/I2C.c +#: ports/raspberrypi/common-hal/i2ctarget/I2CTarget.c msgid "I2C peripheral in use" msgstr "" @@ -1284,75 +1187,37 @@ msgstr "" msgid "Internal error #%d" msgstr "" -#: shared-bindings/sdioio/SDCard.c shared-module/usb_hid/Device.c +#: supervisor/shared/safe_mode.c +msgid "Internal watchdog timer expired." +msgstr "" + +#: py/argcheck.c shared-bindings/digitalio/DigitalInOut.c msgid "Invalid %q" msgstr "" -#: ports/atmel-samd/common-hal/audiobusio/I2SOut.c -#: ports/atmel-samd/common-hal/audiobusio/PDMIn.c -#: ports/atmel-samd/common-hal/imagecapture/ParallelImageCapture.c -#: ports/mimxrt10xx/common-hal/busio/UART.c +#: shared-bindings/microcontroller/Pin.c msgid "Invalid %q pin" msgstr "Mali ang %q pin" -#: ports/stm/common-hal/busio/I2C.c ports/stm/common-hal/busio/SPI.c -#: ports/stm/common-hal/busio/UART.c ports/stm/common-hal/canio/CAN.c -#: ports/stm/common-hal/sdioio/SDCard.c -msgid "Invalid %q pin selection" -msgstr "" - #: ports/stm/common-hal/analogio/AnalogIn.c msgid "Invalid ADC Unit value" msgstr "" -#: ports/espressif/common-hal/wifi/Radio.c -msgid "Invalid AuthMode" -msgstr "" - #: ports/espressif/common-hal/_bleio/__init__.c #: ports/nrf/common-hal/_bleio/__init__.c msgid "Invalid BLE parameter" msgstr "" -#: shared-module/displayio/OnDiskBitmap.c -msgid "Invalid BMP file" -msgstr "Mali ang BMP file" - #: shared-bindings/wifi/Radio.c msgid "Invalid BSSID" msgstr "" -#: ports/espressif/common-hal/analogio/AnalogOut.c -#: ports/stm/common-hal/analogio/AnalogOut.c -msgid "Invalid DAC pin supplied" -msgstr "" - #: shared-bindings/wifi/Radio.c msgid "Invalid MAC address" msgstr "" -#: shared-bindings/synthio/__init__.c -msgid "Invalid MIDI file" -msgstr "" - -#: ports/atmel-samd/common-hal/pwmio/PWMOut.c -#: ports/cxd56/common-hal/pwmio/PWMOut.c -#: ports/espressif/common-hal/pwmio/PWMOut.c -#: ports/mimxrt10xx/common-hal/pwmio/PWMOut.c -#: ports/nrf/common-hal/pwmio/PWMOut.c -#: ports/raspberrypi/common-hal/pwmio/PWMOut.c shared-bindings/pwmio/PWMOut.c -msgid "Invalid PWM frequency" -msgstr "Mali ang PWM frequency" - -#: ports/espressif/common-hal/analogio/AnalogIn.c -msgid "Invalid Pin" -msgstr "" - -#: ports/espressif/bindings/espidf/__init__.c -#: ports/espressif/common-hal/busio/I2C.c -#: ports/espressif/common-hal/i2cperipheral/I2CPeripheral.c -#: ports/espressif/esp_error.c py/moduerrno.c -#: shared-module/rgbmatrix/RGBMatrix.c +#: ports/espressif/common-hal/espidf/__init__.c ports/espressif/esp_error.c +#: py/moduerrno.c msgid "Invalid argument" msgstr "Maling argumento" @@ -1360,42 +1225,11 @@ msgstr "Maling argumento" msgid "Invalid bits per value" msgstr "" -#: ports/nrf/common-hal/busio/UART.c ports/raspberrypi/common-hal/busio/UART.c -#: ports/stm/common-hal/busio/UART.c -msgid "Invalid buffer size" -msgstr "Mali ang buffer size" - -#: shared-bindings/adafruit_pixelbuf/PixelBuf.c -msgid "Invalid byteorder string" -msgstr "" - -#: ports/atmel-samd/common-hal/frequencyio/FrequencyIn.c -#: ports/espressif/common-hal/frequencyio/FrequencyIn.c -msgid "Invalid capture period. Valid range: 1 - 500" -msgstr "" - -#: shared-bindings/audiomixer/Mixer.c -msgid "Invalid channel count" -msgstr "Maling bilang ng channel" - -#: ports/atmel-samd/common-hal/imagecapture/ParallelImageCapture.c -#, c-format -msgid "Invalid data_count %d" -msgstr "" - #: ports/atmel-samd/common-hal/imagecapture/ParallelImageCapture.c #, c-format msgid "Invalid data_pins[%d]" msgstr "" -#: shared-bindings/digitalio/DigitalInOut.c -msgid "Invalid direction." -msgstr "Mali ang direksyon." - -#: shared-module/audiocore/WaveFile.c -msgid "Invalid file" -msgstr "Mali ang file" - #: shared-module/audiocore/WaveFile.c msgid "Invalid format chunk size" msgstr "Mali ang format ng chunk size" @@ -1404,107 +1238,27 @@ msgstr "Mali ang format ng chunk size" msgid "Invalid memory access." msgstr "" -#: extmod/vfs_fat_file.c -msgid "Invalid mode" -msgstr "" - #: ports/espressif/common-hal/wifi/Radio.c msgid "Invalid multicast MAC address" msgstr "" -#: shared-bindings/bitbangio/SPI.c shared-bindings/busio/SPI.c -msgid "Invalid number of bits" -msgstr "Mali ang bilang ng bits" - -#: shared-bindings/bitbangio/SPI.c shared-bindings/busio/SPI.c -#: shared-bindings/displayio/FourWire.c -msgid "Invalid phase" -msgstr "Mali ang phase" - -#: ports/atmel-samd/common-hal/audioio/AudioOut.c -#: ports/atmel-samd/common-hal/touchio/TouchIn.c -#: ports/espressif/common-hal/alarm/touch/TouchAlarm.c -#: ports/espressif/common-hal/touchio/TouchIn.c -#: ports/nrf/common-hal/alarm/pin/PinAlarm.c shared-bindings/pwmio/PWMOut.c -#: shared-module/rgbmatrix/RGBMatrix.c -msgid "Invalid pin" -msgstr "Mali ang pin" - -#: ports/atmel-samd/common-hal/audioio/AudioOut.c -msgid "Invalid pin for left channel" -msgstr "Mali ang pin para sa kaliwang channel" - -#: ports/atmel-samd/common-hal/audioio/AudioOut.c -msgid "Invalid pin for right channel" -msgstr "Mali ang pin para sa kanang channel" - -#: ports/atmel-samd/common-hal/busio/I2C.c -#: ports/atmel-samd/common-hal/busio/SPI.c -#: ports/atmel-samd/common-hal/busio/UART.c -#: ports/atmel-samd/common-hal/i2cperipheral/I2CPeripheral.c -#: ports/cxd56/common-hal/busio/I2C.c ports/cxd56/common-hal/busio/SPI.c -#: ports/cxd56/common-hal/busio/UART.c ports/cxd56/common-hal/sdioio/SDCard.c -#: ports/espressif/common-hal/busio/I2C.c -#: ports/espressif/common-hal/busio/SPI.c -#: ports/espressif/common-hal/busio/UART.c -#: ports/espressif/common-hal/canio/CAN.c -#: ports/espressif/common-hal/i2cperipheral/I2CPeripheral.c -#: ports/mimxrt10xx/common-hal/busio/I2C.c -#: ports/mimxrt10xx/common-hal/busio/SPI.c -#: ports/mimxrt10xx/common-hal/usb_host/Port.c ports/nrf/common-hal/busio/I2C.c -#: ports/raspberrypi/common-hal/busio/I2C.c -#: ports/raspberrypi/common-hal/busio/SPI.c -#: ports/raspberrypi/common-hal/busio/UART.c shared-bindings/busio/SPI.c #: shared-bindings/busio/UART.c msgid "Invalid pins" msgstr "Mali ang pins" -#: shared-bindings/bitbangio/SPI.c shared-bindings/busio/SPI.c -#: shared-bindings/displayio/FourWire.c -msgid "Invalid polarity" -msgstr "Mali ang polarity" - -#: shared-bindings/_bleio/Characteristic.c -msgid "Invalid properties" -msgstr "" - -#: shared-bindings/microcontroller/__init__.c -msgid "Invalid run mode." -msgstr "Mali ang run mode." - -#: shared-module/_bleio/Attribute.c -msgid "Invalid security_mode" -msgstr "" - -#: ports/espressif/bindings/espidf/__init__.c ports/espressif/esp_error.c +#: ports/espressif/common-hal/espidf/__init__.c ports/espressif/esp_error.c msgid "Invalid size" msgstr "" #: ports/espressif/common-hal/ssl/SSLContext.c +#: ports/raspberrypi/common-hal/ssl/SSLSocket.c msgid "Invalid socket for TLS" msgstr "" -#: ports/espressif/bindings/espidf/__init__.c ports/espressif/esp_error.c +#: ports/espressif/common-hal/espidf/__init__.c ports/espressif/esp_error.c msgid "Invalid state" msgstr "" -#: shared-bindings/audiomixer/Mixer.c -msgid "Invalid voice" -msgstr "" - -#: shared-bindings/audiomixer/Mixer.c -msgid "Invalid voice count" -msgstr "Maling bilang ng voice" - -#: shared-module/audiocore/WaveFile.c -msgid "Invalid wave file" -msgstr "May hindi tama sa wave file" - -#: ports/mimxrt10xx/common-hal/busio/UART.c ports/nrf/common-hal/busio/UART.c -#: ports/raspberrypi/common-hal/busio/UART.c ports/stm/common-hal/busio/UART.c -msgid "Invalid word/bit length" -msgstr "" - #: shared-bindings/aesio/aes.c msgid "Key must be 16, 24, or 32 bytes long" msgstr "" @@ -1518,25 +1272,17 @@ msgid "LHS of keyword arg must be an id" msgstr "LHS ng keyword arg ay dapat na id" #: shared-module/displayio/Group.c -msgid "Layer already in a group." +msgid "Layer already in a group" msgstr "" #: shared-module/displayio/Group.c -msgid "Layer must be a Group or TileGrid subclass." +msgid "Layer must be a Group or TileGrid subclass" msgstr "" -#: ports/espressif/bindings/espidf/__init__.c ports/espressif/esp_error.c +#: ports/espressif/common-hal/espidf/__init__.c ports/espressif/esp_error.c msgid "MAC address was invalid" msgstr "" -#: shared-module/bitbangio/SPI.c -msgid "MISO pin init failed." -msgstr "Hindi ma-initialize ang MISO pin." - -#: shared-module/bitbangio/SPI.c -msgid "MOSI pin init failed." -msgstr "Hindi ma-initialize ang MOSI pin." - #: shared-bindings/is31fl3741/IS31FL3741.c msgid "Mapping must be a tuple" msgstr "" @@ -1546,10 +1292,6 @@ msgstr "" msgid "Maximum x value when mirrored is %d" msgstr "" -#: shared-bindings/canio/Message.c -msgid "Messages limited to 8 bytes" -msgstr "" - #: shared-bindings/audiobusio/PDMIn.c msgid "Microphone startup delay must be in range 0.0 to 1.0" msgstr "Ang delay ng startup ng mikropono ay dapat na nasa 0.0 hanggang 1.0" @@ -1563,10 +1305,14 @@ msgstr "" msgid "Mismatched swap flag" msgstr "" -#: ports/mimxrt10xx/common-hal/busio/SPI.c ports/stm/common-hal/busio/SPI.c +#: ports/mimxrt10xx/common-hal/busio/SPI.c msgid "Missing MISO or MOSI Pin" msgstr "" +#: ports/stm/common-hal/busio/SPI.c +msgid "Missing MISO or MOSI pin" +msgstr "" + #: ports/raspberrypi/common-hal/rp2pio/StateMachine.c #, c-format msgid "Missing first_in_pin. Instruction %d reads pin(s)" @@ -1602,11 +1348,6 @@ msgstr "" msgid "Missing jmp_pin. Instruction %d jumps on pin" msgstr "" -#: shared-module/usb_hid/Device.c -#, c-format -msgid "More than %d report ids not supported" -msgstr "" - #: shared-bindings/busio/UART.c shared-bindings/displayio/Group.c msgid "Must be a %q subclass." msgstr "" @@ -1666,16 +1407,28 @@ msgstr "" msgid "No I2C device at address: 0x%x" msgstr "" -#: ports/espressif/common-hal/busio/SPI.c -#: ports/mimxrt10xx/common-hal/busio/SPI.c ports/stm/common-hal/busio/SPI.c -msgid "No MISO Pin" +#: supervisor/shared/web_workflow/web_workflow.c +msgid "No IP" msgstr "" #: ports/espressif/common-hal/busio/SPI.c -#: ports/mimxrt10xx/common-hal/busio/SPI.c ports/stm/common-hal/busio/SPI.c +#: ports/mimxrt10xx/common-hal/busio/SPI.c +msgid "No MISO Pin" +msgstr "" + +#: ports/stm/common-hal/busio/SPI.c shared-module/bitbangio/SPI.c +msgid "No MISO pin" +msgstr "" + +#: ports/espressif/common-hal/busio/SPI.c +#: ports/mimxrt10xx/common-hal/busio/SPI.c msgid "No MOSI Pin" msgstr "" +#: ports/stm/common-hal/busio/SPI.c shared-module/bitbangio/SPI.c +msgid "No MOSI pin" +msgstr "" + #: ports/atmel-samd/common-hal/busio/UART.c #: ports/espressif/common-hal/busio/UART.c #: ports/mimxrt10xx/common-hal/busio/UART.c ports/nrf/common-hal/busio/UART.c @@ -1714,16 +1467,6 @@ msgstr "Walang libreng GCLKs" msgid "No hardware random available" msgstr "Walang magagamit na hardware random" -#: ports/atmel-samd/common-hal/ps2io/Ps2.c -msgid "No hardware support on clk pin" -msgstr "" - -#: ports/atmel-samd/common-hal/alarm/pin/PinAlarm.c -#: ports/atmel-samd/common-hal/frequencyio/FrequencyIn.c -#: ports/atmel-samd/common-hal/pulseio/PulseIn.c -msgid "No hardware support on pin" -msgstr "Walang support sa hardware ang pin" - #: ports/raspberrypi/common-hal/rp2pio/StateMachine.c msgid "No in in program" msgstr "" @@ -1824,16 +1567,26 @@ msgstr "" msgid "Odd parity is not supported" msgstr "Odd na parity ay hindi supportado" +#: supervisor/shared/bluetooth/bluetooth.c +msgid "Off" +msgstr "" + +#: supervisor/shared/bluetooth/bluetooth.c +msgid "Ok" +msgstr "" + #: ports/atmel-samd/common-hal/audiobusio/PDMIn.c #: ports/raspberrypi/common-hal/audiobusio/PDMIn.c msgid "Only 8 or 16 bit mono with " msgstr "Tanging 8 o 16 na bit mono na may " #: ports/espressif/common-hal/wifi/__init__.c +#: ports/raspberrypi/common-hal/wifi/__init__.c msgid "Only IPv4 addresses supported" msgstr "" -#: ports/espressif/common-hal/socketpool/SocketPool.c +#: ports/espressif/common-hal/socketpool/Socket.c +#: ports/raspberrypi/common-hal/socketpool/Socket.c msgid "Only IPv4 sockets supported" msgstr "" @@ -1866,15 +1619,19 @@ msgstr "" msgid "Only one TouchAlarm can be set in deep sleep." msgstr "" -#: ports/espressif/common-hal/i2cperipheral/I2CPeripheral.c +#: ports/espressif/common-hal/i2ctarget/I2CTarget.c +#: ports/raspberrypi/common-hal/i2ctarget/I2CTarget.c msgid "Only one address is allowed" msgstr "" #: ports/atmel-samd/common-hal/alarm/time/TimeAlarm.c -#: ports/espressif/common-hal/alarm/time/TimeAlarm.c #: ports/nrf/common-hal/alarm/time/TimeAlarm.c -#: ports/raspberrypi/common-hal/alarm/time/TimeAlarm.c #: ports/stm/common-hal/alarm/time/TimeAlarm.c +msgid "Only one alarm.time alarm can be set" +msgstr "" + +#: ports/espressif/common-hal/alarm/time/TimeAlarm.c +#: ports/raspberrypi/common-hal/alarm/time/TimeAlarm.c msgid "Only one alarm.time alarm can be set." msgstr "" @@ -1886,19 +1643,20 @@ msgstr "" msgid "Operation not permitted" msgstr "" -#: ports/espressif/bindings/espidf/__init__.c ports/espressif/esp_error.c +#: ports/espressif/common-hal/espidf/__init__.c ports/espressif/esp_error.c msgid "Operation or feature not supported" msgstr "" -#: ports/espressif/bindings/espidf/__init__.c ports/espressif/esp_error.c +#: ports/espressif/common-hal/espidf/__init__.c ports/espressif/esp_error.c msgid "Operation timed out" msgstr "" -#: ports/espressif/bindings/espidf/__init__.c ports/espressif/esp_error.c +#: ports/espressif/common-hal/espidf/__init__.c ports/espressif/esp_error.c msgid "Out of memory" msgstr "" -#: ports/espressif/common-hal/socketpool/SocketPool.c +#: ports/espressif/common-hal/socketpool/Socket.c +#: ports/raspberrypi/common-hal/socketpool/Socket.c msgid "Out of sockets" msgstr "" @@ -1906,11 +1664,6 @@ msgstr "" msgid "Out-buffer elements must be <= 4 bytes long" msgstr "" -#: shared-bindings/bitops/__init__.c -#, c-format -msgid "Output buffer must be at least %d bytes" -msgstr "" - #: shared-bindings/audiobusio/PDMIn.c msgid "Oversample must be multiple of 8." msgstr "Oversample ay dapat multiple ng 8." @@ -1919,17 +1672,16 @@ msgstr "Oversample ay dapat multiple ng 8." msgid "PDMIn not available" msgstr "" -#: shared-bindings/pwmio/PWMOut.c -msgid "" -"PWM duty_cycle must be between 0 and 65535 inclusive (16 bit resolution)" -msgstr "PWM duty_cycle ay dapat sa loob ng 0 at 65535 (16 bit resolution)" - #: shared-bindings/pwmio/PWMOut.c msgid "" "PWM frequency not writable when variable_frequency is False on construction." msgstr "" "PWM frequency hindi writable kapag variable_frequency ay False sa pag buo." +#: ports/stm/common-hal/pwmio/PWMOut.c +msgid "PWM restart" +msgstr "" + #: ports/raspberrypi/common-hal/countio/Counter.c msgid "PWM slice already in use" msgstr "" @@ -1946,36 +1698,20 @@ msgstr "" msgid "Permission denied" msgstr "Walang pahintulot" -#: ports/atmel-samd/common-hal/alarm/pin/PinAlarm.c #: ports/stm/common-hal/alarm/pin/PinAlarm.c msgid "Pin cannot wake from Deep Sleep" msgstr "" -#: ports/raspberrypi/bindings/rp2pio/StateMachine.c -msgid "Pin count must be at least 1" -msgstr "" - #: ports/raspberrypi/common-hal/rp2pio/StateMachine.c msgid "Pin count too large" msgstr "" -#: ports/atmel-samd/common-hal/analogio/AnalogIn.c -#: ports/cxd56/common-hal/analogio/AnalogIn.c -#: ports/espressif/common-hal/analogio/AnalogIn.c -#: ports/mimxrt10xx/common-hal/analogio/AnalogIn.c -#: ports/nrf/common-hal/analogio/AnalogIn.c -#: ports/raspberrypi/common-hal/analogio/AnalogIn.c -#: ports/stm/common-hal/analogio/AnalogIn.c -msgid "Pin does not have ADC capabilities" -msgstr "Ang pin ay walang kakayahan sa ADC" - #: ports/stm/common-hal/alarm/pin/PinAlarm.c #: ports/stm/common-hal/pulseio/PulseIn.c msgid "Pin interrupt already in use" msgstr "" #: shared-bindings/adafruit_bus_device/spi_device/SPIDevice.c -#: shared-bindings/digitalio/DigitalInOut.c msgid "Pin is input only" msgstr "" @@ -2035,18 +1771,10 @@ msgstr "" msgid "Program does OUT without loading OSR" msgstr "" -#: ports/raspberrypi/bindings/rp2pio/StateMachine.c -msgid "Program must contain at least one 16-bit instruction." -msgstr "" - #: ports/raspberrypi/bindings/rp2pio/StateMachine.c msgid "Program size invalid" msgstr "" -#: ports/raspberrypi/bindings/rp2pio/StateMachine.c -msgid "Program too large" -msgstr "" - #: shared-bindings/digitalio/DigitalInOut.c msgid "Pull not used when direction is output." msgstr "Pull hindi ginagamit kapag ang direksyon ay output." @@ -2068,8 +1796,9 @@ msgstr "" msgid "RNG Init Error" msgstr "" -#: ports/nrf/common-hal/busio/UART.c -msgid "RS485 Not yet supported on this device" +#: ports/atmel-samd/common-hal/busio/UART.c ports/cxd56/common-hal/busio/UART.c +#: ports/nrf/common-hal/busio/UART.c ports/stm/common-hal/busio/UART.c +msgid "RS485" msgstr "" #: ports/espressif/common-hal/busio/UART.c @@ -2077,21 +1806,10 @@ msgstr "" msgid "RS485 inversion specified when not in RS485 mode" msgstr "" -#: ports/cxd56/common-hal/rtc/RTC.c ports/espressif/common-hal/rtc/RTC.c -#: ports/mimxrt10xx/common-hal/rtc/RTC.c ports/nrf/common-hal/rtc/RTC.c -#: ports/raspberrypi/common-hal/rtc/RTC.c -msgid "RTC calibration is not supported on this board" -msgstr "RTC calibration ay hindi supportado ng board na ito" - #: shared-bindings/alarm/time/TimeAlarm.c shared-bindings/time/__init__.c msgid "RTC is not supported on this board" msgstr "Hindi supportado ang RTC sa board na ito" -#: ports/atmel-samd/common-hal/busio/UART.c ports/cxd56/common-hal/busio/UART.c -#: ports/stm/common-hal/busio/UART.c -msgid "RTS/CTS/RS485 Not yet supported on this device" -msgstr "" - #: ports/stm/common-hal/os/__init__.c msgid "Random number generation error" msgstr "" @@ -2110,10 +1828,14 @@ msgstr "Basahin-lamang mode" msgid "Read-only object" msgstr "Basahin-lamang" -#: ports/espressif/bindings/espidf/__init__.c ports/espressif/esp_error.c +#: ports/espressif/common-hal/espidf/__init__.c ports/espressif/esp_error.c msgid "Received response was invalid" msgstr "" +#: supervisor/shared/bluetooth/bluetooth.c +msgid "Reconnecting" +msgstr "" + #: shared-bindings/displayio/EPaperDisplay.c msgid "Refresh too soon" msgstr "" @@ -2126,7 +1848,7 @@ msgstr "" msgid "Requested AES mode is unsupported" msgstr "" -#: ports/espressif/bindings/espidf/__init__.c ports/espressif/esp_error.c +#: ports/espressif/common-hal/espidf/__init__.c ports/espressif/esp_error.c msgid "Requested resource not found" msgstr "" @@ -2142,6 +1864,10 @@ msgstr "Tumatakbo sa safe mode! Hindi tumatakbo ang nai-save na code.\n" msgid "SD card CSD format not supported" msgstr "" +#: ports/cxd56/common-hal/sdioio/SDCard.c +msgid "SDCard init" +msgstr "" + #: ports/stm/common-hal/sdioio/SDCard.c #, c-format msgid "SDIO GetCardInfo Error %d" @@ -2152,30 +1878,21 @@ msgstr "" msgid "SDIO Init Error %d" msgstr "" -#: ports/stm/common-hal/busio/SPI.c -msgid "SPI Init Error" -msgstr "" - -#: ports/stm/common-hal/busio/SPI.c -msgid "SPI Re-initialization error" -msgstr "" - #: ports/espressif/common-hal/busio/SPI.c msgid "SPI configuration failed" msgstr "" +#: ports/stm/common-hal/busio/SPI.c +msgid "SPI init error" +msgstr "" + #: ports/raspberrypi/common-hal/busio/SPI.c msgid "SPI peripheral in use" msgstr "" -#: shared-bindings/audiomixer/Mixer.c -msgid "Sample rate must be positive" -msgstr "Sample rate ay dapat positibo" - -#: ports/atmel-samd/common-hal/audioio/AudioOut.c -#, c-format -msgid "Sample rate too high. It must be less than %d" -msgstr "Sample rate ay masyadong mataas. Ito ay dapat hindi hiigit sa %d" +#: ports/stm/common-hal/busio/SPI.c +msgid "SPI re-init" +msgstr "" #: shared-bindings/is31fl3741/FrameBuffer.c msgid "Scale dimensions must divide by 3" @@ -2195,14 +1912,6 @@ msgstr "Serializer ginagamit" msgid "Server side context cannot have hostname" msgstr "" -#: ports/raspberrypi/bindings/rp2pio/StateMachine.c -msgid "Set pin count must be between 1 and 5" -msgstr "" - -#: ports/raspberrypi/bindings/rp2pio/StateMachine.c -msgid "Side set pin count must be between 1 and 5" -msgstr "" - #: ports/cxd56/common-hal/camera/Camera.c msgid "Size not supported" msgstr "" @@ -2223,6 +1932,7 @@ msgid "Slices not supported" msgstr "Hindi suportado ang Slices" #: ports/espressif/common-hal/socketpool/SocketPool.c +#: ports/raspberrypi/common-hal/socketpool/SocketPool.c msgid "SocketPool can only be used with wifi.radio" msgstr "" @@ -2238,10 +1948,6 @@ msgstr "" msgid "Splitting with sub-captures" msgstr "Binibiyak gamit ang sub-captures" -#: shared-bindings/supervisor/__init__.c -msgid "Stack size must be at least 256" -msgstr "Ang laki ng stack ay dapat na hindi bababa sa 256" - #: ports/raspberrypi/common-hal/audiopwmio/PWMAudioOut.c msgid "Stereo left must be on PWM channel A" msgstr "" @@ -2250,10 +1956,6 @@ msgstr "" msgid "Stereo right must be on PWM channel B" msgstr "" -#: shared-bindings/multiterminal/__init__.c -msgid "Stream missing readinto() or write() method." -msgstr "Stream kulang ng readinto() o write() method." - #: ports/mimxrt10xx/common-hal/busio/UART.c ports/stm/common-hal/busio/UART.c msgid "Supply at least one UART pin" msgstr "" @@ -2327,10 +2029,6 @@ msgstr "" msgid "Tile index out of bounds" msgstr "" -#: shared-bindings/displayio/TileGrid.c -msgid "Tile value out of bounds" -msgstr "" - #: shared-bindings/displayio/TileGrid.c msgid "Tile width must exactly divide bitmap width" msgstr "" @@ -2350,6 +2048,9 @@ msgid "To exit, please reset the board without " msgstr "Para lumabas, paki-reset ang board na wala ang " #: ports/atmel-samd/common-hal/audiobusio/I2SOut.c +msgid "Too many channels in sample" +msgstr "" + #: ports/raspberrypi/common-hal/audiobusio/I2SOut.c msgid "Too many channels in sample." msgstr "Sobra ang channels sa sample." @@ -2382,23 +2083,24 @@ msgid "Tuple or struct_time argument required" msgstr "Tuple o struct_time argument kailangan" #: ports/stm/common-hal/busio/UART.c -msgid "UART Buffer allocation error" +msgid "UART de-init" +msgstr "" + +#: ports/atmel-samd/common-hal/busio/UART.c ports/cxd56/common-hal/busio/UART.c +#: ports/espressif/common-hal/busio/UART.c ports/stm/common-hal/busio/UART.c +msgid "UART init" msgstr "" #: ports/stm/common-hal/busio/UART.c -msgid "UART De-init error" +msgid "UART re-init" msgstr "" #: ports/stm/common-hal/busio/UART.c -msgid "UART Init Error" +msgid "UART write" msgstr "" -#: ports/stm/common-hal/busio/UART.c -msgid "UART Re-init error" -msgstr "" - -#: ports/stm/common-hal/busio/UART.c -msgid "UART write error" +#: main.c +msgid "UID:" msgstr "" #: shared-module/usb_hid/Device.c @@ -2525,6 +2227,11 @@ msgstr "" msgid "Unknown system firmware error: %d" msgstr "" +#: ports/raspberrypi/common-hal/wifi/__init__.c +#, c-format +msgid "Unkown error code %d" +msgstr "" + #: shared-bindings/adafruit_pixelbuf/PixelBuf.c #, c-format msgid "Unmatched number of items on RHS (expected %d, got %d)." @@ -2536,12 +2243,6 @@ msgid "" "declined or ignored." msgstr "" -#: ports/atmel-samd/common-hal/busio/I2C.c ports/cxd56/common-hal/busio/I2C.c -#: ports/espressif/common-hal/busio/UART.c -#: ports/raspberrypi/common-hal/busio/I2C.c ports/stm/common-hal/busio/I2C.c -msgid "Unsupported baudrate" -msgstr "Hindi supportadong baudrate" - #: shared-bindings/bitmaptools/__init__.c msgid "Unsupported colorspace" msgstr "" @@ -2555,6 +2256,10 @@ msgstr "Hindi supportadong tipo ng bitmap" msgid "Unsupported format" msgstr "Hindi supportadong format" +#: shared-bindings/hashlib/__init__.c +msgid "Unsupported hash algorithm" +msgstr "" + #: ports/espressif/common-hal/dualbank/__init__.c msgid "Update Failed" msgstr "" @@ -2573,7 +2278,7 @@ msgstr "" msgid "Value length > max_length" msgstr "" -#: ports/espressif/bindings/espidf/__init__.c ports/espressif/esp_error.c +#: ports/espressif/common-hal/espidf/__init__.c ports/espressif/esp_error.c msgid "Version was invalid" msgstr "" @@ -2603,10 +2308,6 @@ msgstr "" msgid "WatchDogTimer.timeout must be greater than 0" msgstr "" -#: supervisor/shared/safe_mode.c -msgid "Watchdog timer expired." -msgstr "" - #: py/builtinhelp.c #, c-format msgid "" @@ -2617,8 +2318,8 @@ msgid "" "To list built-in modules type `help(\"modules\")`.\n" msgstr "" -#: shared-bindings/wifi/Radio.c -msgid "WiFi password must be between 8 and 63 characters" +#: supervisor/shared/web_workflow/web_workflow.c +msgid "Wi-Fi: " msgstr "" #: main.c @@ -2659,11 +2360,7 @@ msgstr "__new__ arg ay dapat na user-type" msgid "a bytes-like object is required" msgstr "a bytes-like object ay kailangan" -#: shared-bindings/i2cperipheral/I2CPeripheral.c -msgid "address out of bounds" -msgstr "wala sa sakop ang address" - -#: shared-bindings/i2cperipheral/I2CPeripheral.c +#: shared-bindings/i2ctarget/I2CTarget.c msgid "addresses is empty" msgstr "walang laman ang address" @@ -2712,6 +2409,10 @@ msgstr "" msgid "array and index length must be equal" msgstr "" +#: extmod/ulab/code/numpy/io/io.c +msgid "array has too many dimensions" +msgstr "" + #: py/objarray.c shared-bindings/alarm/SleepMemory.c #: shared-bindings/nvm/ByteArray.c msgid "array/bytes required on right side" @@ -2773,10 +2474,6 @@ msgstr "" msgid "bits must be 32 or less" msgstr "" -#: shared-bindings/busio/UART.c -msgid "bits must be in range 5 to 9" -msgstr "" - #: shared-bindings/audiomixer/Mixer.c msgid "bits_per_sample must be 8 or 16" msgstr "bits_per_sample ay dapat 8 o 16" @@ -2815,11 +2512,6 @@ msgstr "" msgid "byteorder is not a string" msgstr "" -#: ports/atmel-samd/common-hal/busio/UART.c -#: ports/espressif/common-hal/busio/UART.c -msgid "bytes > 8 bits not supported" -msgstr "hindi sinusuportahan ang bytes > 8 bits" - #: py/objarray.c msgid "bytes length not a multiple of item size" msgstr "" @@ -2828,7 +2520,7 @@ msgstr "" msgid "bytes value out of range" msgstr "bytes value wala sa sakop" -#: ports/atmel-samd/bindings/samd/Clock.c ports/atmel-samd/common-hal/rtc/RTC.c +#: ports/atmel-samd/bindings/samd/Clock.c msgid "calibration is out of range" msgstr "kalibrasion ay wala sa sakop" @@ -2836,12 +2528,9 @@ msgstr "kalibrasion ay wala sa sakop" msgid "calibration is read only" msgstr "pagkakalibrate ay basahin lamang" -#: ports/atmel-samd/common-hal/rtc/RTC.c -msgid "calibration value out of range +/-127" -msgstr "ang halaga ng pagkakalibrate ay wala sa sakop +/-127" - +#: shared-module/vectorio/Circle.c shared-module/vectorio/Polygon.c #: shared-module/vectorio/Rectangle.c -msgid "can only be registered in one parent" +msgid "can only have one parent" msgstr "" #: py/emitinlinethumb.c @@ -2865,8 +2554,7 @@ msgstr "hindi ma i-assign sa expression" msgid "can't cancel self" msgstr "" -#: py/obj.c py/objint.c shared-bindings/i2cperipheral/I2CPeripheral.c -#: shared-module/adafruit_pixelbuf/PixelBuf.c +#: py/obj.c py/objint.c shared-module/adafruit_pixelbuf/PixelBuf.c msgid "can't convert %q to %q" msgstr "" @@ -3018,6 +2706,10 @@ msgstr "" msgid "casting" msgstr "casting" +#: ports/stm/common-hal/pwmio/PWMOut.c +msgid "channel re-init" +msgstr "" + #: shared-bindings/_stage/Text.c msgid "chars buffer too small" msgstr "masyadong maliit ang buffer" @@ -3030,10 +2722,6 @@ msgstr "chr() arg wala sa sakop ng range(0x110000)" msgid "chr() arg not in range(256)" msgstr "chr() arg wala sa sakop ng range(256)" -#: shared-module/vectorio/Circle.c -msgid "circle can only be registered in one parent" -msgstr "" - #: shared-bindings/bitmaptools/__init__.c msgid "clip point must be (x,y) tuple" msgstr "" @@ -3058,10 +2746,6 @@ msgstr "ang color buffer ay dapat bytearray o array na type ‘b’ or ‘B’" msgid "color must be between 0x000000 and 0xffffff" msgstr "color ay dapat mula sa 0x000000 hangang 0xffffff" -#: shared-bindings/displayio/ColorConverter.c -msgid "color should be an int" -msgstr "color ay dapat na int" - #: py/emitnative.c msgid "comparison of int and uint" msgstr "" @@ -3098,6 +2782,10 @@ msgstr "" msgid "convolve arguments must not be empty" msgstr "" +#: extmod/ulab/code/numpy/io/io.c +msgid "corrupted file" +msgstr "" + #: extmod/ulab/code/numpy/poly.c msgid "could not invert Vandermonde matrix" msgstr "" @@ -3152,10 +2840,6 @@ msgstr "" "ang destination buffer ay dapat na isang array ng uri 'H' para sa bit_depth " "= 16" -#: shared-bindings/audiobusio/PDMIn.c -msgid "destination_length must be an int >= 0" -msgstr "ang destination_length ay dapat na isang int >= 0" - #: py/objdict.c msgid "dict update sequence has wrong length" msgstr "may mali sa haba ng dict update sequence" @@ -3193,6 +2877,10 @@ msgstr "" msgid "empty" msgstr "walang laman" +#: extmod/ulab/code/numpy/io/io.c +msgid "empty file" +msgstr "" + #: extmod/moduasyncio.c extmod/moduheapq.c extmod/modutimeq.c msgid "empty heap" msgstr "walang laman ang heap" @@ -3209,11 +2897,6 @@ msgstr "walang laman ang sequence" msgid "end of format while looking for conversion specifier" msgstr "sa huli ng format habang naghahanap sa conversion specifier" -#: shared-bindings/displayio/Shape.c -#, fuzzy -msgid "end_x should be an int" -msgstr "y ay dapat int" - #: shared-bindings/alarm/time/TimeAlarm.c msgid "epoch_time not supported on this board" msgstr "" @@ -3223,6 +2906,12 @@ msgstr "" msgid "error = 0x%08lX" msgstr "" +#: ports/espressif/common-hal/esp32_camera/Camera.c +msgid "" +"esp32_camera.Camera requires reserved PSRAM to be configured. See the " +"documentation for instructions." +msgstr "" + #: py/runtime.c msgid "exceptions must derive from BaseException" msgstr "ang mga exceptions ay dapat makuha mula sa BaseException" @@ -3297,7 +2986,7 @@ msgstr "" msgid "first argument must be a tuple of ndarrays" msgstr "" -#: extmod/ulab/code/numpy/vector.c +#: extmod/ulab/code/numpy/transform.c extmod/ulab/code/numpy/vector.c msgid "first argument must be an ndarray" msgstr "" @@ -3446,7 +3135,7 @@ msgstr "hindi kumpleto ang format key" msgid "incorrect padding" msgstr "mali ang padding" -#: extmod/ulab/code/ndarray.c +#: extmod/ulab/code/ndarray.c extmod/ulab/code/numpy/transform.c msgid "index is out of bounds" msgstr "" @@ -3464,6 +3153,10 @@ msgstr "ang mga indeks ay dapat na integer" msgid "indices must be integers, slices, or Boolean lists" msgstr "" +#: ports/espressif/common-hal/busio/I2C.c +msgid "init I2C" +msgstr "" + #: extmod/ulab/code/scipy/optimize/optimize.c msgid "initial values must be iterable" msgstr "" @@ -3509,6 +3202,10 @@ msgstr "" msgid "input matrix is singular" msgstr "" +#: extmod/ulab/code/numpy/create.c +msgid "input must be 1- or 2-d" +msgstr "" + #: extmod/ulab/code/numpy/carray/carray.c msgid "input must be a 1D ndarray" msgstr "" @@ -3517,11 +3214,7 @@ msgstr "" msgid "input must be a dense ndarray" msgstr "" -#: extmod/ulab/code/numpy/create.c -msgid "input must be a tensor of rank 2" -msgstr "" - -#: extmod/ulab/code/numpy/create.c extmod/ulab/code/user/user.c +#: extmod/ulab/code/user/user.c msgid "input must be an ndarray" msgstr "" @@ -3571,6 +3264,10 @@ msgstr "" msgid "invalid bits_per_pixel %d, must be, 1, 2, 4, 8, 16, 24, or 32" msgstr "" +#: ports/raspberrypi/common-hal/ssl/SSLSocket.c +msgid "invalid cert" +msgstr "mali ang cert" + #: shared-bindings/bitmaptools/__init__.c #, c-format msgid "invalid element size %d for bits_per_pixel %d\n" @@ -3597,10 +3294,18 @@ msgstr "mali ang format specifier" msgid "invalid hostname" msgstr "" +#: ports/raspberrypi/common-hal/ssl/SSLSocket.c +msgid "invalid key" +msgstr "mali ang key" + #: py/compile.c msgid "invalid micropython decorator" msgstr "mali ang micropython decorator" +#: ports/espressif/common-hal/esp32_camera/Camera.c +msgid "invalid setting" +msgstr "" + #: shared-bindings/random/__init__.c msgid "invalid step" msgstr "mali ang step" @@ -3718,10 +3423,6 @@ msgstr "may pagkakamali sa math domain" msgid "matrix is not positive definite" msgstr "" -#: ports/espressif/common-hal/wifi/Radio.c -msgid "max_connections must be between 0 and 10" -msgstr "" - #: ports/espressif/common-hal/_bleio/Descriptor.c #: ports/nrf/common-hal/_bleio/Characteristic.c #: ports/nrf/common-hal/_bleio/Descriptor.c @@ -3729,12 +3430,8 @@ msgstr "" msgid "max_length must be 0-%d when fixed_length is %s" msgstr "" -#: shared-bindings/_bleio/Characteristic.c shared-bindings/_bleio/Descriptor.c -msgid "max_length must be >= 0" -msgstr "" - #: extmod/ulab/code/ndarray.c -msgid "maximum number of dimensions is 4" +msgid "maximum number of dimensions is " msgstr "" #: py/runtime.c @@ -3868,7 +3565,7 @@ msgstr "" msgid "no response from SD card" msgstr "" -#: py/objobject.c py/runtime.c +#: ports/espressif/common-hal/esp32_camera/Camera.c py/objobject.c py/runtime.c msgid "no such attribute" msgstr "walang ganoon na attribute" @@ -3979,7 +3676,11 @@ msgstr "object na may buffer protocol kinakailangan" msgid "odd-length string" msgstr "odd-length string" -#: extmod/ulab/code/numpy/create.c extmod/ulab/code/utils/utils.c +#: supervisor/shared/web_workflow/web_workflow.c +msgid "off" +msgstr "" + +#: extmod/ulab/code/utils/utils.c msgid "offset is too large" msgstr "" @@ -4076,10 +3777,6 @@ msgstr "" msgid "palette must be 32 bytes long" msgstr "ang palette ay dapat 32 bytes ang haba" -#: shared-bindings/displayio/Palette.c -msgid "palette_index should be an int" -msgstr "palette_index ay dapat na int" - #: py/emitinlinextensa.c msgid "parameters must be registers in sequence a2 to a5" msgstr "ang mga parameter ay dapat na nagrerehistro sa sequence a2 hanggang a5" @@ -4105,10 +3802,6 @@ msgstr "pixel_shader ay dapat displayio.Palette o displayio.ColorConverter" msgid "poll on file not available on win32" msgstr "" -#: shared-module/vectorio/Polygon.c -msgid "polygon can only be registered in one parent" -msgstr "" - #: ports/espressif/common-hal/pulseio/PulseIn.c msgid "pop from an empty PulseIn" msgstr "pop mula sa walang laman na PulseIn" @@ -4134,7 +3827,23 @@ 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/espressif/boards/adafruit_qtpy_esp32_pico/mpconfigboard.h +msgid "pressing BOOT button at start up.\n" +msgstr "" + +#: ports/espressif/boards/adafruit_feather_esp32_v2/mpconfigboard.h +msgid "pressing SW38 button at start up.\n" +msgstr "" + +#: ports/espressif/boards/hardkernel_odroid_go/mpconfigboard.h +msgid "pressing VOLUME button at start up.\n" +msgstr "" + #: ports/espressif/boards/adafruit_qtpy_esp32c3/mpconfigboard.h +#: ports/espressif/boards/beetle-esp32-c3/mpconfigboard.h +#: ports/espressif/boards/espressif_esp32s2_devkitc_1_n8r2/mpconfigboard.h +#: ports/espressif/boards/lolin_c3_mini/mpconfigboard.h +#: ports/espressif/boards/microdev_micro_c3/mpconfigboard.h #: supervisor/shared/safe_mode.c msgid "pressing boot button at start up.\n" msgstr "" @@ -4155,14 +3864,6 @@ msgstr "" msgid "pull masks conflict with direction masks" msgstr "" -#: ports/raspberrypi/bindings/rp2pio/StateMachine.c -msgid "pull_threshold must be between 1 and 32" -msgstr "" - -#: ports/raspberrypi/bindings/rp2pio/StateMachine.c -msgid "push_threshold must be between 1 and 32" -msgstr "" - #: extmod/modutimeq.c msgid "queue overflow" msgstr "puno na ang pila (overflow)" @@ -4214,14 +3915,6 @@ msgstr "" msgid "rsplit(None,n)" msgstr "rsplit(None,n)" -#: shared-bindings/audiocore/RawSample.c -msgid "" -"sample_source buffer must be a bytearray or array of type 'h', 'H', 'b' or " -"'B'" -msgstr "" -"ang sample_source buffer ay dapat na isang bytearray o array ng uri na 'h', " -"'H', 'b' o'B'" - #: ports/atmel-samd/common-hal/audiobusio/PDMIn.c #: ports/raspberrypi/common-hal/audiobusio/PDMIn.c msgid "sampling rate out of range" @@ -4319,27 +4012,14 @@ msgstr "" msgid "source_bitmap must have value_count of 8" msgstr "" -#: shared-bindings/wifi/Radio.c -msgid "ssid can't be more than 32 bytes" -msgstr "" - #: py/objstr.c msgid "start/end indices" msgstr "start/end indeks" -#: shared-bindings/displayio/Shape.c -#, fuzzy -msgid "start_x should be an int" -msgstr "y ay dapat int" - #: shared-bindings/random/__init__.c msgid "step must be non-zero" msgstr "step ay dapat hindi zero" -#: shared-bindings/busio/UART.c -msgid "stop must be 1 or 2" -msgstr "stop dapat 1 o 2" - #: shared-bindings/random/__init__.c msgid "stop not reachable from start" msgstr "stop hindi maabot sa simula" @@ -4388,10 +4068,6 @@ msgstr "may pagkakamali sa sintaks sa uctypes descriptor" msgid "threshold must be in the range 0-65536" msgstr "ang threshold ay dapat sa range 0-65536" -#: shared-bindings/rgbmatrix/RGBMatrix.c -msgid "tile must be greater than zero" -msgstr "" - #: shared-bindings/time/__init__.c msgid "time.struct_time() takes a 9-sequence" msgstr "time.struct_time() kumukuha ng 9-sequence" @@ -4411,11 +4087,6 @@ msgstr "" msgid "timeout must be < 655.35 secs" msgstr "" -#: shared-bindings/_bleio/CharacteristicBuffer.c -#, fuzzy -msgid "timeout must be >= 0.0" -msgstr "bits ay dapat walo (8)" - #: shared-module/sdcardio/SDCard.c msgid "timeout waiting for v1 card" msgstr "" @@ -4424,6 +4095,10 @@ msgstr "" msgid "timeout waiting for v2 card" msgstr "" +#: ports/stm/common-hal/pwmio/PWMOut.c +msgid "timer re-init" +msgstr "" + #: shared-bindings/time/__init__.c msgid "timestamp out of range for platform time_t" msgstr "wala sa sakop ng timestamp ang platform time_t" @@ -4489,14 +4164,10 @@ msgstr "hindi maari ang type na '%q' para sa base type" msgid "type is not an acceptable base type" msgstr "hindi puede ang type para sa base type" -#: py/runtime.c +#: py/objgenerator.c py/runtime.c msgid "type object '%q' has no attribute '%q'" msgstr "type object '%q' ay walang attribute '%q'" -#: py/objgenerator.c -msgid "type object 'generator' has no attribute '__await__'" -msgstr "" - #: py/objtype.c msgid "type takes 1 or 3 arguments" msgstr "type kumuhuha ng 1 o 3 arguments" @@ -4555,7 +4226,6 @@ msgid "unreadable attribute" msgstr "hindi mabasa ang attribute" #: shared-bindings/displayio/TileGrid.c shared-bindings/vectorio/VectorShape.c -#: shared-module/vectorio/Polygon.c shared-module/vectorio/VectorShape.c msgid "unsupported %q type" msgstr "Hindi supportadong tipo ng %q" @@ -4594,6 +4264,14 @@ msgstr "hindi sinusuportahang type para sa operator" msgid "unsupported types for %q: '%q', '%q'" msgstr "" +#: extmod/ulab/code/numpy/io/io.c +msgid "usecols is too high" +msgstr "" + +#: extmod/ulab/code/numpy/io/io.c +msgid "usecols keyword must be specified" +msgstr "" + #: py/objint.c #, c-format msgid "value must fit in %d byte(s)" @@ -4615,20 +4293,19 @@ msgstr "" msgid "watchdog timeout must be greater than 0" msgstr "" -#: shared-bindings/bitops/__init__.c -#, c-format -msgid "width must be from 2 to 8 (inclusive), not %d" -msgstr "" - #: shared-bindings/is31fl3741/FrameBuffer.c -#: shared-bindings/rgbmatrix/RGBMatrix.c msgid "width must be greater than zero" msgstr "" #: ports/espressif/common-hal/wifi/Radio.c +#: ports/raspberrypi/common-hal/wifi/Radio.c msgid "wifi is not enabled" msgstr "" +#: ports/raspberrypi/common-hal/wifi/Monitor.c +msgid "wifi.Monitor not available" +msgstr "" + #: shared-bindings/_bleio/Adapter.c msgid "window must be <= interval" msgstr "" @@ -4641,7 +4318,17 @@ msgstr "" msgid "wrong axis specified" msgstr "" -#: extmod/ulab/code/numpy/compare.c extmod/ulab/code/numpy/vector.c +#: extmod/ulab/code/numpy/io/io.c +msgid "wrong dtype" +msgstr "" + +#: extmod/ulab/code/numpy/transform.c +msgid "wrong index type" +msgstr "" + +#: extmod/ulab/code/numpy/compare.c extmod/ulab/code/numpy/create.c +#: extmod/ulab/code/numpy/io/io.c extmod/ulab/code/numpy/transform.c +#: extmod/ulab/code/numpy/vector.c msgid "wrong input type" msgstr "" @@ -4649,6 +4336,10 @@ msgstr "" msgid "wrong length of condition array" msgstr "" +#: extmod/ulab/code/numpy/transform.c +msgid "wrong length of index array" +msgstr "" + #: extmod/ulab/code/numpy/create.c py/objarray.c py/objstr.c msgid "wrong number of arguments" msgstr "mali ang bilang ng argumento" @@ -4670,10 +4361,6 @@ msgstr "wala sa sakop ang address" msgid "xTaskCreate failed" msgstr "" -#: shared-bindings/displayio/Shape.c -msgid "y should be an int" -msgstr "y ay dapat int" - #: shared-module/displayio/Shape.c #, fuzzy msgid "y value out of bounds" @@ -4695,6 +4382,194 @@ msgstr "" msgid "zi must be of shape (n_section, 2)" msgstr "" +#~ msgid "Stream missing readinto() or write() method." +#~ msgstr "Stream kulang ng readinto() o write() method." + +#, fuzzy +#~ msgid "%q must be >= 1" +#~ msgstr "aarehas na haba dapat ang buffer slices" + +#~ msgid "address out of bounds" +#~ msgstr "wala sa sakop ang address" + +#~ msgid "destination_length must be an int >= 0" +#~ msgstr "ang destination_length ay dapat na isang int >= 0" + +#~ msgid "color should be an int" +#~ msgstr "color ay dapat na int" + +#, fuzzy +#~ msgid "end_x should be an int" +#~ msgstr "y ay dapat int" + +#~ msgid "palette_index should be an int" +#~ msgstr "palette_index ay dapat na int" + +#, fuzzy +#~ msgid "start_x should be an int" +#~ msgstr "y ay dapat int" + +#~ msgid "y should be an int" +#~ msgstr "y ay dapat int" + +#~ msgid "" +#~ "sample_source buffer must be a bytearray or array of type 'h', 'H', 'b' " +#~ "or 'B'" +#~ msgstr "" +#~ "ang sample_source buffer ay dapat na isang bytearray o array ng uri na " +#~ "'h', 'H', 'b' o'B'" + +#, fuzzy +#~ msgid "%q should be an int" +#~ msgstr "y ay dapat int" + +#~ msgid "AnalogOut functionality not supported" +#~ msgstr "Hindi supportado ang AnalogOut" + +#~ msgid "AnalogOut is only 16 bits. Value must be less than 65536." +#~ msgstr "AnalogOut ay 16 bits. Value ay dapat hindi hihigit pa sa 65536." + +#~ msgid "AnalogOut not supported on given pin" +#~ msgstr "Hindi supportado ang AnalogOut sa ibinigay na pin" + +#, c-format +#~ msgid "Buffer incorrect size. Should be %d bytes." +#~ msgstr "Mali ang size ng buffer. Dapat %d bytes." + +#~ msgid "Buffer must be at least length 1" +#~ msgstr "Buffer dapat ay hindi baba sa 1 na haba" + +#~ msgid "Bytes must be between 0 and 255." +#~ msgstr "Sa gitna ng 0 o 255 dapat ang bytes." + +#~ msgid "Cannot output both channels on the same pin" +#~ msgstr "Hindi maaaring output ang mga parehong channel sa parehong pin" + +#~ msgid "Cannot read without MISO pin." +#~ msgstr "Hindi maaring mabasa kapag walang MISO pin." + +#~ msgid "Cannot reset into bootloader because no bootloader is present." +#~ msgstr "Hindi ma-reset sa bootloader dahil walang bootloader." + +#~ msgid "Cannot transfer without MOSI and MISO pins." +#~ msgstr "Hindi maaaring ilipat kapag walang MOSI at MISO pin." + +#~ msgid "Cannot write without MOSI pin." +#~ msgstr "Hindi maaring isulat kapag walang MOSI pin." + +#~ msgid "Clock pin init failed." +#~ msgstr "Nabigo sa pag init ng Clock pin." + +#, fuzzy +#~ msgid "Command must be an int between 0 and 255" +#~ msgstr "Sa gitna ng 0 o 255 dapat ang bytes." + +#~ msgid "Could not initialize UART" +#~ msgstr "Hindi ma-initialize ang UART" + +#~ msgid "Couldn't allocate first buffer" +#~ msgstr "Hindi ma-iallocate ang first buffer" + +#~ msgid "Couldn't allocate second buffer" +#~ msgstr "Hindi ma-iallocate ang second buffer" + +#~ msgid "Failed to allocate RX buffer" +#~ msgstr "Nabigong ilaan ang RX buffer" + +#, c-format +#~ msgid "Failed to allocate RX buffer of %d bytes" +#~ msgstr "Nabigong ilaan ang RX buffer ng %d bytes" + +#~ msgid "Invalid BMP file" +#~ msgstr "Mali ang BMP file" + +#~ msgid "Invalid PWM frequency" +#~ msgstr "Mali ang PWM frequency" + +#~ msgid "Invalid buffer size" +#~ msgstr "Mali ang buffer size" + +#~ msgid "Invalid channel count" +#~ msgstr "Maling bilang ng channel" + +#~ msgid "Invalid direction." +#~ msgstr "Mali ang direksyon." + +#~ msgid "Invalid file" +#~ msgstr "Mali ang file" + +#~ msgid "Invalid number of bits" +#~ msgstr "Mali ang bilang ng bits" + +#~ msgid "Invalid phase" +#~ msgstr "Mali ang phase" + +#~ msgid "Invalid pin" +#~ msgstr "Mali ang pin" + +#~ msgid "Invalid pin for left channel" +#~ msgstr "Mali ang pin para sa kaliwang channel" + +#~ msgid "Invalid pin for right channel" +#~ msgstr "Mali ang pin para sa kanang channel" + +#~ msgid "Invalid polarity" +#~ msgstr "Mali ang polarity" + +#~ msgid "Invalid run mode." +#~ msgstr "Mali ang run mode." + +#~ msgid "Invalid voice count" +#~ msgstr "Maling bilang ng voice" + +#~ msgid "Invalid wave file" +#~ msgstr "May hindi tama sa wave file" + +#~ msgid "MISO pin init failed." +#~ msgstr "Hindi ma-initialize ang MISO pin." + +#~ msgid "MOSI pin init failed." +#~ msgstr "Hindi ma-initialize ang MOSI pin." + +#~ msgid "No hardware support on pin" +#~ msgstr "Walang support sa hardware ang pin" + +#~ msgid "" +#~ "PWM duty_cycle must be between 0 and 65535 inclusive (16 bit resolution)" +#~ msgstr "PWM duty_cycle ay dapat sa loob ng 0 at 65535 (16 bit resolution)" + +#~ msgid "Pin does not have ADC capabilities" +#~ msgstr "Ang pin ay walang kakayahan sa ADC" + +#~ msgid "RTC calibration is not supported on this board" +#~ msgstr "RTC calibration ay hindi supportado ng board na ito" + +#~ msgid "Sample rate must be positive" +#~ msgstr "Sample rate ay dapat positibo" + +#, c-format +#~ msgid "Sample rate too high. It must be less than %d" +#~ msgstr "Sample rate ay masyadong mataas. Ito ay dapat hindi hiigit sa %d" + +#~ msgid "Stack size must be at least 256" +#~ msgstr "Ang laki ng stack ay dapat na hindi bababa sa 256" + +#~ msgid "Unsupported baudrate" +#~ msgstr "Hindi supportadong baudrate" + +#~ msgid "bytes > 8 bits not supported" +#~ msgstr "hindi sinusuportahan ang bytes > 8 bits" + +#~ msgid "calibration value out of range +/-127" +#~ msgstr "ang halaga ng pagkakalibrate ay wala sa sakop +/-127" + +#~ msgid "stop must be 1 or 2" +#~ msgstr "stop dapat 1 o 2" + +#, fuzzy +#~ msgid "timeout must be >= 0.0" +#~ msgstr "bits ay dapat walo (8)" + #~ msgid "Unsupported operation" #~ msgstr "Hindi sinusuportahang operasyon" @@ -4800,12 +4675,6 @@ msgstr "" #~ msgid "can only save bytecode" #~ msgstr "maaring i-save lamang ang bytecode" -#~ msgid "invalid cert" -#~ msgstr "mali ang cert" - -#~ msgid "invalid key" -#~ msgstr "mali ang key" - #~ msgid "Viper functions don't currently support more than 4 arguments" #~ msgstr "" #~ "Ang mga function ng Viper ay kasalukuyang hindi sumusuporta sa higit sa 4 " diff --git a/locale/fr.po b/locale/fr.po index 27fdb3a54a..40bc8ec33b 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: 2021-01-04 12:55-0600\n" -"PO-Revision-Date: 2021-12-13 05:53+0000\n" -"Last-Translator: Jeff Epler \n" +"PO-Revision-Date: 2022-08-29 18:20+0000\n" +"Last-Translator: Maxime Leroy \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.10-dev\n" +"X-Generator: Weblate 4.14.1-dev\n" #: main.c msgid "" @@ -30,6 +30,9 @@ msgid "" "\n" "Code stopped by auto-reload. Reloading soon.\n" msgstr "" +"\n" +"Le code a été arrêté par l'actualisation automatique. Rechargement " +"prochain.\n" #: supervisor/shared/safe_mode.c msgid "" @@ -67,6 +70,11 @@ msgstr " sortie :\n" msgid "%%c requires int or char" msgstr "%%c nécessite un chiffre entier 'int' ou un caractère 'char'" +#: main.c +#, c-format +msgid "%02X" +msgstr "" + #: shared-bindings/rgbmatrix/RGBMatrix.c #, c-format msgid "" @@ -75,10 +83,27 @@ msgstr "" "%d broches d'adresse, %d broches RGB et %d pour tile indique une hauteur de " "%d, et non %d" +#: ports/atmel-samd/common-hal/alarm/__init__.c +#: ports/cxd56/common-hal/analogio/AnalogOut.c ports/cxd56/common-hal/rtc/RTC.c +#: ports/espressif/common-hal/rtc/RTC.c +#: ports/mimxrt10xx/common-hal/analogio/AnalogOut.c +#: ports/mimxrt10xx/common-hal/rtc/RTC.c ports/nrf/common-hal/alarm/__init__.c +#: ports/nrf/common-hal/analogio/AnalogOut.c ports/nrf/common-hal/rtc/RTC.c +#: ports/raspberrypi/common-hal/alarm/__init__.c +#: ports/raspberrypi/common-hal/analogio/AnalogOut.c +#: ports/raspberrypi/common-hal/rtc/RTC.c ports/stm/common-hal/alarm/__init__.c +#: ports/stm/common-hal/rtc/RTC.c +msgid "%q" +msgstr "%q" + #: shared-bindings/microcontroller/Pin.c msgid "%q and %q contain duplicate pins" msgstr "%q et %q contiennent des broches en double" +#: ports/atmel-samd/common-hal/audioio/AudioOut.c +msgid "%q and %q must be different" +msgstr "%q et %q doivent être différents" + #: shared-bindings/microcontroller/Pin.c msgid "%q contains duplicate pins" msgstr "%q contient des broches en double" @@ -87,16 +112,12 @@ msgstr "%q contient des broches en double" msgid "%q failure: %d" msgstr "Échec de %q : %d" +#: shared-bindings/digitalio/DigitalInOut.c #: shared-bindings/microcontroller/Pin.c msgid "%q in use" msgstr "%q en cours d'utilisation" -#: ports/atmel-samd/common-hal/pulseio/PulseIn.c -#: ports/cxd56/common-hal/pulseio/PulseIn.c -#: ports/nrf/common-hal/pulseio/PulseIn.c -#: ports/raspberrypi/common-hal/pulseio/PulseIn.c -#: ports/stm/common-hal/pulseio/PulseIn.c py/obj.c py/objstr.c -#: py/objstrunicode.c +#: py/obj.c py/objstr.c py/objstrunicode.c msgid "%q index out of range" msgstr "index %q hors de portée" @@ -104,21 +125,41 @@ msgstr "index %q hors de portée" msgid "%q indices must be integers, not %s" msgstr "les indices %q doivent être des entiers, pas %s" +#: shared-module/bitbangio/SPI.c +msgid "%q init failed" +msgstr "échec de l'initialisation %q" + +#: py/argcheck.c +msgid "%q length must be %d" +msgstr "La longeur de %q doit être %d" + #: py/argcheck.c msgid "%q length must be %d-%d" msgstr "La longueur de %q doit être %d-%d" -#: shared-bindings/busio/I2C.c shared-bindings/usb_hid/Device.c +#: py/argcheck.c +msgid "%q length must be <= %d" +msgstr "La longeur de %q doit être <= %d" + +#: py/argcheck.c +msgid "%q length must be >= %d" +msgstr "La longeur de %q doit être >= %d" + +#: shared-bindings/busio/I2C.c msgid "%q length must be >= 1" msgstr "La longueur de %q doit être >= 1" +#: py/argcheck.c +msgid "%q must be %d" +msgstr "%q doit être %d" + #: py/argcheck.c msgid "%q must be %d-%d" msgstr "%q doit être %d-%d" #: shared-bindings/displayio/Display.c msgid "%q must be 1 when %q is True" -msgstr "" +msgstr "%q doit être 1 quand %q est True" #: py/argcheck.c shared-bindings/gifio/GifWriter.c msgid "%q must be <= %d" @@ -128,30 +169,18 @@ msgstr "%q doit être <= %d" msgid "%q must be >= %d" msgstr "%q doit être >= %d" -#: py/argcheck.c shared-bindings/memorymonitor/AllocationAlarm.c -msgid "%q must be >= 0" -msgstr "%q doit être >= 0" - -#: shared-bindings/_bleio/CharacteristicBuffer.c -#: shared-bindings/_bleio/PacketBuffer.c shared-bindings/displayio/Group.c -#: shared-bindings/displayio/Shape.c -#: shared-bindings/memorymonitor/AllocationAlarm.c -#: shared-bindings/vectorio/Circle.c shared-bindings/vectorio/Rectangle.c -msgid "%q must be >= 1" -msgstr "%q doit être >= 1" +#: shared-bindings/analogbufio/BufferedIn.c +#: shared-bindings/audiocore/RawSample.c +msgid "%q must be a bytearray or array of type 'h', 'H', 'b', or 'B'" +msgstr "" #: py/argcheck.c msgid "%q must be a string" msgstr "%q doit être une chaîne de caractères" -#: shared-module/vectorio/Polygon.c -msgid "%q must be a tuple of length 2" -msgstr "%q doit être un tuple de longueur 2" - -#: ports/espressif/common-hal/imagecapture/ParallelImageCapture.c -#: shared-module/vectorio/VectorShape.c -msgid "%q must be between %d and %d" -msgstr "%q doit être entre %d et %d" +#: py/argcheck.c +msgid "%q must be an int" +msgstr "%q doit être un entier" #: py/argcheck.c msgid "%q must be of type %q" @@ -159,7 +188,7 @@ msgstr "%q doit être du type %q" #: shared-bindings/digitalio/Pull.c msgid "%q must be of type %q or None" -msgstr "" +msgstr "%q doit être du type %q ou None" #: ports/atmel-samd/common-hal/busio/UART.c msgid "%q must be power of 2" @@ -169,7 +198,11 @@ msgstr "%q doit être une puissance de 2" msgid "%q out of bounds" msgstr "%q est hors limites" +#: ports/atmel-samd/common-hal/pulseio/PulseIn.c +#: ports/cxd56/common-hal/pulseio/PulseIn.c +#: ports/nrf/common-hal/pulseio/PulseIn.c #: ports/raspberrypi/common-hal/rp2pio/StateMachine.c +#: ports/stm/common-hal/pulseio/PulseIn.c py/argcheck.c #: shared-bindings/canio/Match.c msgid "%q out of range" msgstr "%q est hors de porté" @@ -178,10 +211,6 @@ msgstr "%q est hors de porté" msgid "%q pin invalid" msgstr "broche %q invalide" -#: shared-bindings/fontio/BuiltinFont.c -msgid "%q should be an int" -msgstr "%q doit être un chiffre entier (int)" - #: shared-bindings/usb_hid/Device.c msgid "%q with a report ID of 0 must be of length 1" msgstr "%q avec un identifiant de rapport à 0 doit être de longueur 1" @@ -194,7 +223,11 @@ msgstr "%q() prend %d paramètres positionnels mais %d ont été donnés" msgid "%q, %q, and %q must all be the same length" msgstr "%q, %q, et %q doivent tous être de la même longueur" -#: ports/espressif/bindings/espidf/__init__.c ports/espressif/esp_error.c +#: py/objint.c +msgid "%q=%q" +msgstr "%q=%q" + +#: ports/espressif/common-hal/espidf/__init__.c ports/espressif/esp_error.c #, c-format msgid "%s error 0x%x" msgstr "%s erreur 0x%x" @@ -279,7 +312,7 @@ msgstr "l'objet %s ne supporte pas l'assignation d'éléments" msgid "'%s' object doesn't support item deletion" msgstr "L'objet '%s' ne prend pas en charge la suppression d'éléments" -#: py/runtime.c +#: ports/raspberrypi/common-hal/wifi/Radio.c py/runtime.c msgid "'%s' object has no attribute '%q'" msgstr "l'objet '%s' n'a pas d'attribut '%q'" @@ -344,10 +377,6 @@ msgstr "'yield from' dans une fonction async" msgid "'yield' outside function" msgstr "'yield' dehors d'une fonction" -#: shared-module/vectorio/VectorShape.c -msgid "(x,y) integers required" -msgstr "Des entiers (x,y) requis" - #: py/compile.c msgid "*x must be assignment target" msgstr "*x doit être la cible de l'assignement" @@ -383,16 +412,12 @@ msgstr "ADC2 est utilisé pars le Wifi" msgid "Address must be %d bytes long" msgstr "L'adresse doit être longue de %d octets" -#: shared-bindings/_bleio/Address.c -msgid "Address type out of range" -msgstr "Type d'adresse hors portée" - #: ports/espressif/common-hal/canio/CAN.c msgid "All CAN peripherals are in use" msgstr "Tous les périphériques CAN sont utilisés" #: ports/espressif/common-hal/busio/I2C.c -#: ports/espressif/common-hal/i2cperipheral/I2CPeripheral.c +#: ports/espressif/common-hal/i2ctarget/I2CTarget.c #: ports/nrf/common-hal/busio/I2C.c msgid "All I2C peripherals are in use" msgstr "Tous les périphériques I2C sont utilisés" @@ -429,7 +454,6 @@ msgstr "Tout les canaux sont utilisés" msgid "All event channels in use" msgstr "Tous les canaux d'événements sont utilisés" -#: ports/raspberrypi/common-hal/pulseio/PulseIn.c #: ports/raspberrypi/common-hal/rp2pio/StateMachine.c msgid "All state machines in use" msgstr "Tous les automates finis sont utilisés" @@ -474,30 +498,10 @@ msgid "Already running" msgstr "Déjà en cours d'exécution" #: ports/espressif/common-hal/wifi/Radio.c +#: ports/raspberrypi/common-hal/wifi/Radio.c msgid "Already scanning for wifi networks" msgstr "Déjà à la recherche des réseaux wifi" -#: ports/cxd56/common-hal/analogio/AnalogIn.c -msgid "AnalogIn not supported on given pin" -msgstr "'AnalogOut' n'est pas supporté sur la broche indiquée" - -#: ports/cxd56/common-hal/analogio/AnalogOut.c -#: ports/mimxrt10xx/common-hal/analogio/AnalogOut.c -#: ports/nrf/common-hal/analogio/AnalogOut.c -#: ports/raspberrypi/common-hal/analogio/AnalogOut.c -msgid "AnalogOut functionality not supported" -msgstr "Fonctionnalité AnalogOut non supportée" - -#: shared-bindings/analogio/AnalogOut.c -msgid "AnalogOut is only 16 bits. Value must be less than 65536." -msgstr "" -"AnalogOut est seulement 16 bits. Les valeurs doivent être inférieures à " -"65536." - -#: ports/atmel-samd/common-hal/analogio/AnalogOut.c -msgid "AnalogOut not supported on given pin" -msgstr "'AnalogOut' n'est pas supporté sur la broche indiquée" - #: ports/stm/common-hal/audiopwmio/PWMAudioOut.c msgid "Another PWMAudioOut is already active" msgstr "Un autre PWMAudioOut est déjà actif" @@ -538,7 +542,7 @@ msgstr "La conversion audio n'est pas implémentée" msgid "AuthMode.OPEN is not used with password" msgstr "AuthMode.OPEN n'est pas utilisé avec un mot de passe" -#: shared-bindings/wifi/Radio.c +#: shared-bindings/wifi/Radio.c supervisor/shared/web_workflow/web_workflow.c msgid "Authentication failure" msgstr "Échec d'authentification" @@ -565,17 +569,14 @@ msgstr "Au-dessous de la fréquence d'images minimale" #: ports/raspberrypi/common-hal/audiobusio/I2SOut.c msgid "Bit clock and word select must be sequential pins" -msgstr "Bit clock et word select doivent êtres sur des broches séquentielles" +msgstr "" +"La sélection du bit d'horloge et de mot doit être sur des broches " +"séquentielles" #: ports/atmel-samd/common-hal/audiobusio/I2SOut.c 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 "Bit depth doit être entre 1 et 6 inclusivement, et non %d" - #: shared-bindings/audiobusio/PDMIn.c msgid "Bit depth must be multiple of 8." msgstr "La profondeur de bit doit être un multiple de 8." @@ -615,12 +616,7 @@ msgstr "Tampon + décalage trop petit %d %d %d" #: ports/raspberrypi/bindings/rp2pio/StateMachine.c msgid "Buffer elements must be 4 bytes long or less" -msgstr "Éléments du tampon doit être 4 octets ou moins" - -#: shared-module/usb_hid/Device.c -#, c-format -msgid "Buffer incorrect size. Should be %d bytes." -msgstr "Tampon de taille incorrect. Devrait être de %d octets." +msgstr "Les éléments du tampon doivent faire 4 octets ou moins" #: shared-bindings/framebufferio/FramebufferDisplay.c msgid "Buffer is not a bytearray." @@ -631,7 +627,6 @@ msgstr "Le tampon n'est pas un 'bytearray'." msgid "Buffer is too small" msgstr "Le tampon est trop petit" -#: ports/nrf/common-hal/audiopwmio/PWMAudioOut.c #: ports/stm/common-hal/audiopwmio/PWMAudioOut.c #, c-format msgid "Buffer length %d too big. It must be less than %d" @@ -646,10 +641,6 @@ msgstr "La longueur de la mémoire tampon doit être un multiple de 512" msgid "Buffer must be a multiple of 512 bytes" msgstr "La mémoire tampon doit être un multiple de 512" -#: shared-bindings/bitbangio/I2C.c -msgid "Buffer must be at least length 1" -msgstr "Le tampon doit être de longueur au moins 1" - #: shared-bindings/_bleio/PacketBuffer.c #, c-format msgid "Buffer too short by %d bytes" @@ -671,19 +662,15 @@ msgstr "La broche %d du bus est déjà utilisée" msgid "Byte buffer must be 16 bytes." msgstr "Le tampon doit être de 16 octets." -#: shared-bindings/alarm/SleepMemory.c shared-bindings/nvm/ByteArray.c -msgid "Bytes must be between 0 and 255." -msgstr "Les octets 'bytes' doivent être entre 0 et 255." - #: shared-bindings/aesio/aes.c msgid "CBC blocks must be multiples of 16 bytes" msgstr "Les blocs CBC doivent être des multiples de 16 octets" #: supervisor/shared/safe_mode.c msgid "CIRCUITPY drive could not be found or created." -msgstr "" +msgstr "L’appareil CIRCUITPY ne peut pas être trouvé ou créé." -#: ports/espressif/bindings/espidf/__init__.c ports/espressif/esp_error.c +#: ports/espressif/common-hal/espidf/__init__.c ports/espressif/esp_error.c msgid "CRC or checksum was invalid" msgstr "CRC ou somme de contrôle invalide" @@ -691,20 +678,24 @@ msgstr "CRC ou somme de contrôle invalide" msgid "Call super().__init__() before accessing native object." msgstr "Appelez super().__init__() avant d'accéder à l'objet natif." +#: ports/cxd56/common-hal/camera/Camera.c +msgid "Camera init" +msgstr "Initialisation de la caméra" + #: ports/espressif/common-hal/alarm/pin/PinAlarm.c msgid "Can only alarm on RTC IO from deep sleep." -msgstr "L'alarme peut seulement être depuis TRC IO depuis le someil profond." +msgstr "L'alarme ne peut être que sur TRC IO depuis un sommeil profond." #: ports/espressif/common-hal/alarm/pin/PinAlarm.c msgid "Can only alarm on one low pin while others alarm high from deep sleep." msgstr "" "L'alarme peut seulement être sur une broche basse tandis que d'autres " -"alarment sont sur des broches hautes depuis le someil profond." +"alarment sont sur des broches hautes depuis le sommeil profond." #: ports/espressif/common-hal/alarm/pin/PinAlarm.c msgid "Can only alarm on two low pins from deep sleep." msgstr "" -"L'alarme peut seulement être sur deux broches basses depuis le someil " +"L'alarme peut seulement être sur deux broches basses depuis le sommeil " "profond." #: ports/espressif/common-hal/_bleio/Characteristic.c @@ -745,18 +736,10 @@ msgstr "" "Impossible d'avoir des réponses d'analyse pour les publicités étendues et " "connectables." -#: ports/atmel-samd/common-hal/audioio/AudioOut.c -msgid "Cannot output both channels on the same pin" -msgstr "Les 2 canaux de sortie ne peuvent être sur la même broche" - #: ports/espressif/common-hal/alarm/pin/PinAlarm.c msgid "Cannot pull on input-only pin." msgstr "Ne peut tirer ('pull') sur une broche d'entrée ('input') seule." -#: shared-module/bitbangio/SPI.c -msgid "Cannot read without MISO pin." -msgstr "Impossible de lire sans broche MISO." - #: shared-bindings/audiobusio/PDMIn.c msgid "Cannot record to a file" msgstr "Impossible d'enregistrer vers un fichier" @@ -768,9 +751,9 @@ msgstr "Ne peut démonter '/' quand est visible par USB." #: ports/atmel-samd/common-hal/microcontroller/__init__.c #: ports/cxd56/common-hal/microcontroller/__init__.c #: ports/mimxrt10xx/common-hal/microcontroller/__init__.c -msgid "Cannot reset into bootloader because no bootloader is present." +msgid "Cannot reset into bootloader because no bootloader is present" msgstr "" -"Ne peut être redémarré vers le bootloader car il n'y a pas de bootloader." +"Impossible de redémarrer dans le bootloader puisque aucun n'est présent" #: ports/espressif/common-hal/socketpool/Socket.c msgid "Cannot set socket options" @@ -791,21 +774,23 @@ msgid "Cannot subclass slice" msgstr "On ne peut faire de sous-classes de tranches" #: shared-module/bitbangio/SPI.c -msgid "Cannot transfer without MOSI and MISO pins." -msgstr "Pas de transfert sans broches MOSI et MISO." +msgid "Cannot transfer without MOSI and MISO pins" +msgstr "Impossible de transférer sans une broche MOSI ou MISO" #: shared-bindings/pwmio/PWMOut.c msgid "Cannot vary frequency on a timer that is already in use" msgstr "Impossible de faire varier la fréquence sur un minuteur déjà utilisée" -#: ports/espressif/common-hal/alarm/pin/PinAlarm.c #: ports/nrf/common-hal/alarm/pin/PinAlarm.c -msgid "Cannot wake on pin edge. Only level." -msgstr "Ne peut reveillé sur le board de broche. Seuleument à niveau." +msgid "Cannot wake on pin edge, only level" +msgstr "" +"Impossible de réveiller via une bordure d'une broche, seulement via un niveau" -#: shared-module/bitbangio/SPI.c -msgid "Cannot write without MOSI pin." -msgstr "Impossible d'écrire sans broche MOSI." +#: ports/espressif/common-hal/alarm/pin/PinAlarm.c +msgid "Cannot wake on pin edge. Only level." +msgstr "" +"Impossible de réveiller via une bordure d'une broche. Seulement via un " +"niveau." #: shared-bindings/_bleio/CharacteristicBuffer.c msgid "CharacteristicBuffer writing not provided" @@ -813,16 +798,12 @@ msgstr "Ecriture sur 'CharacteristicBuffer' non fournie" #: supervisor/shared/safe_mode.c msgid "CircuitPython core code crashed hard. Whoops!\n" -msgstr "Le code principal de CircuitPython s'est écrasé durement. Oups !\n" +msgstr "Le code principal de CircuitPython s'est complètement planté. Oups !\n" #: supervisor/shared/safe_mode.c msgid "CircuitPython was unable to allocate the heap." msgstr "CircuitPython n'as pu faire l'allocation de la pile." -#: shared-module/bitbangio/SPI.c -msgid "Clock pin init failed." -msgstr "Échec de l'initialization de la broche d'horloge." - #: shared-module/bitbangio/I2C.c msgid "Clock stretch too long" msgstr "Période de l'horloge trop longue" @@ -831,11 +812,6 @@ msgstr "Période de l'horloge trop longue" msgid "Clock unit in use" msgstr "Horloge en cours d'utilisation" -#: shared-bindings/displayio/FourWire.c shared-bindings/displayio/I2CDisplay.c -#: shared-bindings/paralleldisplay/ParallelBus.c -msgid "Command must be an int between 0 and 255" -msgstr "La commande doit être un chiffre entier entre 0 et 255" - #: shared-bindings/_bleio/Connection.c msgid "" "Connection has been disconnected and can no longer be used. Create a new " @@ -848,35 +824,6 @@ msgstr "" msgid "Corrupt .mpy file" msgstr "Fichier .mpy corrompu" -#: ports/cxd56/common-hal/camera/Camera.c -msgid "Could not initialize Camera" -msgstr "Impossible d'initialiser Camera" - -#: ports/cxd56/common-hal/gnss/GNSS.c -msgid "Could not initialize GNSS" -msgstr "Impossible d'initialiser GNSS" - -#: ports/cxd56/common-hal/sdioio/SDCard.c -msgid "Could not initialize SDCard" -msgstr "Impossible d'initialiser la carte SD" - -#: ports/atmel-samd/common-hal/busio/UART.c ports/cxd56/common-hal/busio/UART.c -#: ports/espressif/common-hal/busio/UART.c -msgid "Could not initialize UART" -msgstr "Impossible d'initialiser UART" - -#: ports/stm/common-hal/pwmio/PWMOut.c -msgid "Could not re-init channel" -msgstr "Impossible de réinitialiser le canal" - -#: ports/stm/common-hal/pwmio/PWMOut.c -msgid "Could not re-init timer" -msgstr "Impossible de réinitialiser le minuteur" - -#: ports/stm/common-hal/pwmio/PWMOut.c -msgid "Could not restart PWM" -msgstr "Impossible de redémarrer PWM" - #: ports/espressif/common-hal/neopixel_write/__init__.c msgid "Could not retrieve clock" msgstr "Impossible d’obtenir l’horloge" @@ -897,20 +844,6 @@ msgstr "Impossible de démarrer l'interruption, RX occupé" msgid "Couldn't allocate decoder" msgstr "Impossible d'allouer le décodeur" -#: shared-module/audiocore/WaveFile.c shared-module/audiomixer/Mixer.c -#: shared-module/audiomp3/MP3Decoder.c -msgid "Couldn't allocate first buffer" -msgstr "Impossible d'allouer le premier tampon" - -#: shared-module/audiomp3/MP3Decoder.c -msgid "Couldn't allocate input buffer" -msgstr "Impossible d'allouer le tampon d'entrée" - -#: shared-module/audiocore/WaveFile.c shared-module/audiomixer/Mixer.c -#: shared-module/audiomp3/MP3Decoder.c -msgid "Couldn't allocate second buffer" -msgstr "Impossible d'allouer le deuxième tampon" - #: supervisor/shared/safe_mode.c msgid "Crash into the HardFault_Handler." msgstr "Échec vers le HardFault_Handler." @@ -959,10 +892,6 @@ msgstr "La capacité de destination est plus petite que 'destination_length'." msgid "Device in use" msgstr "Appareil utilisé" -#: ports/cxd56/common-hal/digitalio/DigitalInOut.c -msgid "DigitalInOut not supported on given pin" -msgstr "DigitalInOut non pris en charge sur la broche donnée" - #: shared-bindings/displayio/Display.c #: shared-bindings/framebufferio/FramebufferDisplay.c msgid "Display must have a 16 bit colorspace." @@ -974,6 +903,10 @@ msgstr "L'affichage doit avoir un espace colorimétrique de 16 bits." msgid "Display rotation must be in 90 degree increments" msgstr "La rotation d'affichage doit se faire par incréments de 90 degrés" +#: main.c +msgid "Done" +msgstr "OK" + #: shared-bindings/digitalio/DigitalInOut.c msgid "Drive mode not used when direction is input." msgstr "" @@ -1008,21 +941,20 @@ msgstr "Erreur dans l'expression régulière" msgid "Error: Failure to bind" msgstr "Erreur : Impossible de lier" -#: ports/raspberrypi/bindings/rp2pio/StateMachine.c py/enum.c -#: shared-bindings/_bleio/__init__.c shared-bindings/aesio/aes.c -#: shared-bindings/busio/SPI.c shared-bindings/microcontroller/Pin.c +#: py/enum.c shared-bindings/_bleio/__init__.c shared-bindings/aesio/aes.c +#: shared-bindings/alarm/__init__.c shared-bindings/busio/SPI.c +#: shared-bindings/microcontroller/Pin.c #: shared-bindings/neopixel_write/__init__.c msgid "Expected a %q" msgstr "Attendu un %q" -#: shared-bindings/alarm/__init__.c -msgid "Expected an alarm" -msgstr "Une alarme était prévue" +#: ports/raspberrypi/bindings/cyw43/__init__.c +msgid "Expected a %q or %q" +msgstr "" -#: shared-module/adafruit_pixelbuf/PixelBuf.c -#, c-format -msgid "Expected tuple of length %d, got %d" -msgstr "Tuple de longueur %d attendu, obtenu %d" +#: shared-bindings/alarm/__init__.c +msgid "Expected an %q" +msgstr "" #: ports/espressif/common-hal/_bleio/Adapter.c #: ports/nrf/common-hal/_bleio/Adapter.c @@ -1051,21 +983,9 @@ msgstr "Échec de l'envoi de la commande." msgid "Failed to acquire mutex, err 0x%04x" msgstr "Echec de l'obtention de mutex, err 0x%04x" -#: ports/mimxrt10xx/common-hal/busio/UART.c ports/nrf/common-hal/busio/UART.c -#: ports/raspberrypi/common-hal/busio/UART.c -msgid "Failed to allocate RX buffer" -msgstr "Echec de l'allocation du tampon RX" - -#: ports/atmel-samd/common-hal/busio/UART.c -#: ports/atmel-samd/common-hal/pulseio/PulseIn.c -#: ports/cxd56/common-hal/pulseio/PulseIn.c -#: ports/espressif/common-hal/pulseio/PulseIn.c -#: ports/nrf/common-hal/pulseio/PulseIn.c -#: ports/raspberrypi/common-hal/pulseio/PulseIn.c -#: ports/stm/common-hal/pulseio/PulseIn.c -#, c-format -msgid "Failed to allocate RX buffer of %d bytes" -msgstr "Echec de l'allocation de %d octets du tampon RX" +#: shared-module/rgbmatrix/RGBMatrix.c +msgid "Failed to allocate %q buffer" +msgstr "Échec d'allocation du tampon %q" #: ports/espressif/common-hal/wifi/__init__.c msgid "Failed to allocate Wifi memory" @@ -1088,10 +1008,6 @@ msgstr "Impossible de se connecter : erreur interne" msgid "Failed to connect: timeout" msgstr "Impossible de se connecter: délai dépassé" -#: ports/espressif/common-hal/wifi/__init__.c -msgid "Failed to init wifi" -msgstr "Echec de l'initialisation du Wifi" - #: shared-module/audiomp3/MP3Decoder.c msgid "Failed to parse MP3 file" msgstr "Impossible d'analyser le fichier MP3" @@ -1131,21 +1047,18 @@ msgstr "" #: shared-bindings/bitmaptools/__init__.c msgid "For RGB colorspaces, input bitmap must have 16 bits per pixel" msgstr "" -"Avec l'espace de couleur RGB, l'image d'entrée doit avoir 16 bits par pixel" +"Avec l'espace de couleur RVB, l'image d'entrée doit avoir 16 bits par pixel" #: ports/cxd56/common-hal/camera/Camera.c msgid "Format not supported" msgstr "Format non supporté" -#: shared-module/framebufferio/FramebufferDisplay.c -#, c-format -msgid "Framebuffer requires %d bytes" -msgstr "FrameBuffer nécessite %d octets" - #: ports/mimxrt10xx/common-hal/microcontroller/Processor.c msgid "" "Frequency must be 24, 150, 396, 450, 528, 600, 720, 816, 912, 960 or 1008 Mhz" msgstr "" +"La fréquence doit être 24, 150, 396, 450, 528, 600, 720, 816, 912, 960 ou " +"1008 MHz" #: shared-bindings/pwmio/PWMOut.c msgid "Frequency must match existing PWMOut using this timer" @@ -1158,7 +1071,11 @@ msgstr "" msgid "Function requires lock" msgstr "La fonction nécessite un verrou ('lock')" -#: ports/espressif/bindings/espidf/__init__.c ports/espressif/esp_error.c +#: ports/cxd56/common-hal/gnss/GNSS.c +msgid "GNSS init" +msgstr "Initialisation GNSS" + +#: ports/espressif/common-hal/espidf/__init__.c ports/espressif/esp_error.c msgid "Generic Failure" msgstr "Échec génerique" @@ -1172,8 +1089,9 @@ msgstr "Groupe déjà utilisé" #: ports/espressif/common-hal/busio/SPI.c #: ports/mimxrt10xx/common-hal/busio/SPI.c ports/nrf/common-hal/busio/SPI.c #: ports/raspberrypi/common-hal/busio/SPI.c +#, fuzzy msgid "Half duplex SPI is not implemented" -msgstr "" +msgstr "Le half duplex du SPI n'est pas implémenté" #: ports/mimxrt10xx/common-hal/busio/SPI.c ports/stm/common-hal/busio/I2C.c #: ports/stm/common-hal/busio/SPI.c ports/stm/common-hal/canio/CAN.c @@ -1185,19 +1103,16 @@ msgstr "Matériel occupé, essayez d'autres broches" msgid "Hardware in use, try alternative pins" msgstr "Matériel utilisé, essayez d'autres broches" -#: shared-bindings/wifi/Radio.c -msgid "Hostname must be between 1 and 253 characters" -msgstr "Hostname doit être entre 1 et 253 caractères" - #: extmod/vfs_posix_file.c py/objstringio.c msgid "I/O operation on closed file" msgstr "Opération d'E/S sur un fichier fermé" #: ports/stm/common-hal/busio/I2C.c -msgid "I2C Init Error" +msgid "I2C init error" msgstr "Erreur d'initialisation I2C" #: ports/raspberrypi/common-hal/busio/I2C.c +#: ports/raspberrypi/common-hal/i2ctarget/I2CTarget.c msgid "I2C peripheral in use" msgstr "périphérique I2C utilisé" @@ -1313,75 +1228,38 @@ msgstr "Erreur interne" msgid "Internal error #%d" msgstr "Erreur interne #%d" -#: shared-bindings/sdioio/SDCard.c shared-module/usb_hid/Device.c +#: supervisor/shared/safe_mode.c +#, fuzzy +msgid "Internal watchdog timer expired." +msgstr "Le minuteur du watchdog interne a expiré." + +#: py/argcheck.c shared-bindings/digitalio/DigitalInOut.c msgid "Invalid %q" msgstr "%q invalide" -#: ports/atmel-samd/common-hal/audiobusio/I2SOut.c -#: ports/atmel-samd/common-hal/audiobusio/PDMIn.c -#: ports/atmel-samd/common-hal/imagecapture/ParallelImageCapture.c -#: ports/mimxrt10xx/common-hal/busio/UART.c +#: shared-bindings/microcontroller/Pin.c msgid "Invalid %q pin" msgstr "Broche invalide pour '%q'" -#: ports/stm/common-hal/busio/I2C.c ports/stm/common-hal/busio/SPI.c -#: ports/stm/common-hal/busio/UART.c ports/stm/common-hal/canio/CAN.c -#: ports/stm/common-hal/sdioio/SDCard.c -msgid "Invalid %q pin selection" -msgstr "Sélection de broche %q invalide" - #: ports/stm/common-hal/analogio/AnalogIn.c msgid "Invalid ADC Unit value" msgstr "Valeur d'unité ADC non valide" -#: ports/espressif/common-hal/wifi/Radio.c -msgid "Invalid AuthMode" -msgstr "AuthMode invalide" - #: ports/espressif/common-hal/_bleio/__init__.c #: ports/nrf/common-hal/_bleio/__init__.c msgid "Invalid BLE parameter" msgstr "Paramètre BLE invalide" -#: shared-module/displayio/OnDiskBitmap.c -msgid "Invalid BMP file" -msgstr "Fichier BMP invalide" - #: shared-bindings/wifi/Radio.c msgid "Invalid BSSID" msgstr "BSSID invalide" -#: ports/espressif/common-hal/analogio/AnalogOut.c -#: ports/stm/common-hal/analogio/AnalogOut.c -msgid "Invalid DAC pin supplied" -msgstr "Broche DAC non valide fournie" - #: shared-bindings/wifi/Radio.c msgid "Invalid MAC address" msgstr "Adresse MAC invalide" -#: shared-bindings/synthio/__init__.c -msgid "Invalid MIDI file" -msgstr "Fichier MIDI invalide" - -#: ports/atmel-samd/common-hal/pwmio/PWMOut.c -#: ports/cxd56/common-hal/pwmio/PWMOut.c -#: ports/espressif/common-hal/pwmio/PWMOut.c -#: ports/mimxrt10xx/common-hal/pwmio/PWMOut.c -#: ports/nrf/common-hal/pwmio/PWMOut.c -#: ports/raspberrypi/common-hal/pwmio/PWMOut.c shared-bindings/pwmio/PWMOut.c -msgid "Invalid PWM frequency" -msgstr "Fréquence de PWM invalide" - -#: ports/espressif/common-hal/analogio/AnalogIn.c -msgid "Invalid Pin" -msgstr "Broche invalide" - -#: ports/espressif/bindings/espidf/__init__.c -#: ports/espressif/common-hal/busio/I2C.c -#: ports/espressif/common-hal/i2cperipheral/I2CPeripheral.c -#: ports/espressif/esp_error.c py/moduerrno.c -#: shared-module/rgbmatrix/RGBMatrix.c +#: ports/espressif/common-hal/espidf/__init__.c ports/espressif/esp_error.c +#: py/moduerrno.c msgid "Invalid argument" msgstr "Paramètre invalide" @@ -1389,42 +1267,11 @@ msgstr "Paramètre invalide" msgid "Invalid bits per value" msgstr "Bits par valeur invalides" -#: ports/nrf/common-hal/busio/UART.c ports/raspberrypi/common-hal/busio/UART.c -#: ports/stm/common-hal/busio/UART.c -msgid "Invalid buffer size" -msgstr "Longueur de tampon invalide" - -#: shared-bindings/adafruit_pixelbuf/PixelBuf.c -msgid "Invalid byteorder string" -msgstr "Chaîne byteorder non valide" - -#: ports/atmel-samd/common-hal/frequencyio/FrequencyIn.c -#: ports/espressif/common-hal/frequencyio/FrequencyIn.c -msgid "Invalid capture period. Valid range: 1 - 500" -msgstr "Période de capture invalide. Portée valide : 1 à 500" - -#: shared-bindings/audiomixer/Mixer.c -msgid "Invalid channel count" -msgstr "Nombre de canaux invalide" - -#: ports/atmel-samd/common-hal/imagecapture/ParallelImageCapture.c -#, c-format -msgid "Invalid data_count %d" -msgstr "data_count invalide %d" - #: ports/atmel-samd/common-hal/imagecapture/ParallelImageCapture.c #, c-format msgid "Invalid data_pins[%d]" msgstr "data_pins[%d] invalide" -#: shared-bindings/digitalio/DigitalInOut.c -msgid "Invalid direction." -msgstr "Direction invalide." - -#: shared-module/audiocore/WaveFile.c -msgid "Invalid file" -msgstr "Fichier invalide" - #: shared-module/audiocore/WaveFile.c msgid "Invalid format chunk size" msgstr "Taille de bloc de formatage invalide" @@ -1433,107 +1280,27 @@ msgstr "Taille de bloc de formatage invalide" msgid "Invalid memory access." msgstr "Accès à la mémoire invalide." -#: extmod/vfs_fat_file.c -msgid "Invalid mode" -msgstr "" - #: ports/espressif/common-hal/wifi/Radio.c msgid "Invalid multicast MAC address" msgstr "Adresse MAC multicast invalide" -#: shared-bindings/bitbangio/SPI.c shared-bindings/busio/SPI.c -msgid "Invalid number of bits" -msgstr "Nombre de bits invalide" - -#: shared-bindings/bitbangio/SPI.c shared-bindings/busio/SPI.c -#: shared-bindings/displayio/FourWire.c -msgid "Invalid phase" -msgstr "Phase invalide" - -#: ports/atmel-samd/common-hal/audioio/AudioOut.c -#: ports/atmel-samd/common-hal/touchio/TouchIn.c -#: ports/espressif/common-hal/alarm/touch/TouchAlarm.c -#: ports/espressif/common-hal/touchio/TouchIn.c -#: ports/nrf/common-hal/alarm/pin/PinAlarm.c shared-bindings/pwmio/PWMOut.c -#: shared-module/rgbmatrix/RGBMatrix.c -msgid "Invalid pin" -msgstr "Broche invalide" - -#: ports/atmel-samd/common-hal/audioio/AudioOut.c -msgid "Invalid pin for left channel" -msgstr "Broche invalide pour le canal gauche" - -#: ports/atmel-samd/common-hal/audioio/AudioOut.c -msgid "Invalid pin for right channel" -msgstr "Broche invalide pour le canal droit" - -#: ports/atmel-samd/common-hal/busio/I2C.c -#: ports/atmel-samd/common-hal/busio/SPI.c -#: ports/atmel-samd/common-hal/busio/UART.c -#: ports/atmel-samd/common-hal/i2cperipheral/I2CPeripheral.c -#: ports/cxd56/common-hal/busio/I2C.c ports/cxd56/common-hal/busio/SPI.c -#: ports/cxd56/common-hal/busio/UART.c ports/cxd56/common-hal/sdioio/SDCard.c -#: ports/espressif/common-hal/busio/I2C.c -#: ports/espressif/common-hal/busio/SPI.c -#: ports/espressif/common-hal/busio/UART.c -#: ports/espressif/common-hal/canio/CAN.c -#: ports/espressif/common-hal/i2cperipheral/I2CPeripheral.c -#: ports/mimxrt10xx/common-hal/busio/I2C.c -#: ports/mimxrt10xx/common-hal/busio/SPI.c -#: ports/mimxrt10xx/common-hal/usb_host/Port.c ports/nrf/common-hal/busio/I2C.c -#: ports/raspberrypi/common-hal/busio/I2C.c -#: ports/raspberrypi/common-hal/busio/SPI.c -#: ports/raspberrypi/common-hal/busio/UART.c shared-bindings/busio/SPI.c #: shared-bindings/busio/UART.c msgid "Invalid pins" msgstr "Broches invalides" -#: shared-bindings/bitbangio/SPI.c shared-bindings/busio/SPI.c -#: shared-bindings/displayio/FourWire.c -msgid "Invalid polarity" -msgstr "Polarité invalide" - -#: shared-bindings/_bleio/Characteristic.c -msgid "Invalid properties" -msgstr "Propriétés invalides" - -#: shared-bindings/microcontroller/__init__.c -msgid "Invalid run mode." -msgstr "Mode de lancement invalide." - -#: shared-module/_bleio/Attribute.c -msgid "Invalid security_mode" -msgstr "'security_mode' invalide" - -#: ports/espressif/bindings/espidf/__init__.c ports/espressif/esp_error.c +#: ports/espressif/common-hal/espidf/__init__.c ports/espressif/esp_error.c msgid "Invalid size" msgstr "Taille invalide" #: ports/espressif/common-hal/ssl/SSLContext.c +#: ports/raspberrypi/common-hal/ssl/SSLSocket.c msgid "Invalid socket for TLS" msgstr "Socket non valide pour TLS" -#: ports/espressif/bindings/espidf/__init__.c ports/espressif/esp_error.c +#: ports/espressif/common-hal/espidf/__init__.c ports/espressif/esp_error.c msgid "Invalid state" msgstr "État invalide" -#: shared-bindings/audiomixer/Mixer.c -msgid "Invalid voice" -msgstr "Voix invalide" - -#: shared-bindings/audiomixer/Mixer.c -msgid "Invalid voice count" -msgstr "Nombre de voix invalide" - -#: shared-module/audiocore/WaveFile.c -msgid "Invalid wave file" -msgstr "Fichier WAVE invalide" - -#: ports/mimxrt10xx/common-hal/busio/UART.c ports/nrf/common-hal/busio/UART.c -#: ports/raspberrypi/common-hal/busio/UART.c ports/stm/common-hal/busio/UART.c -msgid "Invalid word/bit length" -msgstr "Longueur de mot / bit invalide" - #: shared-bindings/aesio/aes.c msgid "Key must be 16, 24, or 32 bytes long" msgstr "La clé doit comporter 16, 24 ou 32 octets" @@ -1547,38 +1314,27 @@ msgid "LHS of keyword arg must be an id" msgstr "La partie gauche de l'argument nommé doit être un identifiant" #: shared-module/displayio/Group.c -msgid "Layer already in a group." -msgstr "Couche déjà dans un groupe." +msgid "Layer already in a group" +msgstr "Ce calque est déjà dans un groupe" #: shared-module/displayio/Group.c -msgid "Layer must be a Group or TileGrid subclass." -msgstr "'Layer' doit être un 'Group' ou une sous-classe 'TileGrid'." +msgid "Layer must be a Group or TileGrid subclass" +msgstr "Le calque doit être une sous-classe de Group ou TileGrid" -#: ports/espressif/bindings/espidf/__init__.c ports/espressif/esp_error.c +#: ports/espressif/common-hal/espidf/__init__.c ports/espressif/esp_error.c msgid "MAC address was invalid" msgstr "Adresse physique (MAC) invalide" -#: shared-module/bitbangio/SPI.c -msgid "MISO pin init failed." -msgstr "Échec de l'initialization de la broche MISO." - -#: shared-module/bitbangio/SPI.c -msgid "MOSI pin init failed." -msgstr "Échec de l'initialization de la broche MOSI." - #: shared-bindings/is31fl3741/IS31FL3741.c +#, fuzzy msgid "Mapping must be a tuple" -msgstr "" +msgstr "Le mapping doit être un tuple" #: shared-module/displayio/Shape.c #, c-format msgid "Maximum x value when mirrored is %d" msgstr "La valeur maximale de x est %d lors d'une opération miroir" -#: shared-bindings/canio/Message.c -msgid "Messages limited to 8 bytes" -msgstr "Messages limités à 8 octets" - #: shared-bindings/audiobusio/PDMIn.c msgid "Microphone startup delay must be in range 0.0 to 1.0" msgstr "Le délais au démarrage du micro doit être entre 0.0 et 1.0" @@ -1586,16 +1342,20 @@ msgstr "Le délais au démarrage du micro doit être entre 0.0 et 1.0" #: ports/raspberrypi/bindings/rp2pio/StateMachine.c #: ports/raspberrypi/common-hal/rp2pio/StateMachine.c msgid "Mismatched data size" -msgstr "" +msgstr "La taille des données ne correspond pas" #: ports/raspberrypi/common-hal/rp2pio/StateMachine.c msgid "Mismatched swap flag" -msgstr "" +msgstr "Le drapeau d'échange ne correspond pas" -#: ports/mimxrt10xx/common-hal/busio/SPI.c ports/stm/common-hal/busio/SPI.c +#: ports/mimxrt10xx/common-hal/busio/SPI.c msgid "Missing MISO or MOSI Pin" msgstr "Broche MISO ou MOSI manquante" +#: ports/stm/common-hal/busio/SPI.c +msgid "Missing MISO or MOSI pin" +msgstr "La broche MISO ou MOSI est manquante" + #: ports/raspberrypi/common-hal/rp2pio/StateMachine.c #, c-format msgid "Missing first_in_pin. Instruction %d reads pin(s)" @@ -1633,11 +1393,6 @@ msgstr "first_set_pin manquant. L'instruction %d règle la/les broche(s)" msgid "Missing jmp_pin. Instruction %d jumps on pin" msgstr "jmp_pin manquant. L'instruction %d va passer à la broche" -#: shared-module/usb_hid/Device.c -#, c-format -msgid "More than %d report ids not supported" -msgstr "Plus de %d identifiants de rapport ne sont pas supportés" - #: shared-bindings/busio/UART.c shared-bindings/displayio/Group.c msgid "Must be a %q subclass." msgstr "Doit être une sous-classe de %q." @@ -1665,11 +1420,12 @@ msgstr "Nom trop long" #: shared-bindings/displayio/TileGrid.c msgid "New bitmap must be same size as old bitmap" -msgstr "" +msgstr "La taille du nouveau bitmap doit être la même que l'ancien" #: ports/espressif/common-hal/_bleio/__init__.c +#, fuzzy msgid "Nimble out of memory" -msgstr "" +msgstr "Nimble n'a plus de mémoire" #: ports/espressif/common-hal/_bleio/Characteristic.c #: ports/nrf/common-hal/_bleio/Characteristic.c @@ -1695,18 +1451,30 @@ msgstr "Aucun minuteur de rythme DMA trouvé" #: shared-module/adafruit_bus_device/i2c_device/I2CDevice.c #, c-format msgid "No I2C device at address: 0x%x" -msgstr "" +msgstr "Aucun périphérique I2S à l'adresse : 0x%x" + +#: supervisor/shared/web_workflow/web_workflow.c +msgid "No IP" +msgstr "Aucune IP" #: ports/espressif/common-hal/busio/SPI.c -#: ports/mimxrt10xx/common-hal/busio/SPI.c ports/stm/common-hal/busio/SPI.c +#: ports/mimxrt10xx/common-hal/busio/SPI.c msgid "No MISO Pin" msgstr "Pas de broche MISO" +#: ports/stm/common-hal/busio/SPI.c shared-module/bitbangio/SPI.c +msgid "No MISO pin" +msgstr "Aucune broche MISO" + #: ports/espressif/common-hal/busio/SPI.c -#: ports/mimxrt10xx/common-hal/busio/SPI.c ports/stm/common-hal/busio/SPI.c +#: ports/mimxrt10xx/common-hal/busio/SPI.c msgid "No MOSI Pin" msgstr "Pas de broche MOSI" +#: ports/stm/common-hal/busio/SPI.c shared-module/bitbangio/SPI.c +msgid "No MOSI pin" +msgstr "Aucune broche MOSI" + #: ports/atmel-samd/common-hal/busio/UART.c #: ports/espressif/common-hal/busio/UART.c #: ports/mimxrt10xx/common-hal/busio/UART.c ports/nrf/common-hal/busio/UART.c @@ -1745,16 +1513,6 @@ msgstr "Pas de GCLK libre" msgid "No hardware random available" msgstr "Aucunes source de valeurs aléatoire matérielle disponible" -#: ports/atmel-samd/common-hal/ps2io/Ps2.c -msgid "No hardware support on clk pin" -msgstr "Pas de support matériel sur la broche clk" - -#: ports/atmel-samd/common-hal/alarm/pin/PinAlarm.c -#: ports/atmel-samd/common-hal/frequencyio/FrequencyIn.c -#: ports/atmel-samd/common-hal/pulseio/PulseIn.c -msgid "No hardware support on pin" -msgstr "Pas de support matériel pour cette broche" - #: ports/raspberrypi/common-hal/rp2pio/StateMachine.c msgid "No in in program" msgstr "Programme n'a pas de \"in\"" @@ -1789,7 +1547,7 @@ msgstr "Aucun out dans le programme" #: ports/mimxrt10xx/common-hal/busio/I2C.c ports/nrf/common-hal/busio/I2C.c #: ports/raspberrypi/common-hal/busio/I2C.c msgid "No pull up found on SDA or SCL; check your wiring" -msgstr "Aucun pull up trouvé sur SDA ou SCL; vérifiez votre cablage" +msgstr "Aucun pull up trouvé sur SDA ou SCL; vérifiez votre câblage" #: shared-module/touchio/TouchIn.c msgid "No pulldown on pin; 1Mohm recommended" @@ -1801,7 +1559,7 @@ msgstr "Aucun espace libre sur le dispositif" #: py/moduerrno.c msgid "No such device" -msgstr "" +msgstr "Aucun périphérique correspondant" #: py/moduerrno.c msgid "No such file/directory" @@ -1847,23 +1605,33 @@ msgstr "Le nombre de data_pins doit être 8 ou 16, et non %d" msgid "" "Object has been deinitialized and can no longer be used. Create a new object." msgstr "" -"L'objet a été désinitialisé et ne peut plus être utilisé. Créez un nouvel " +"L'objet a été dés-initialisé et ne peut plus être utilisé. Créez un nouvel " "objet." #: ports/nrf/common-hal/busio/UART.c msgid "Odd parity is not supported" msgstr "Parité impaire non supportée" +#: supervisor/shared/bluetooth/bluetooth.c +msgid "Off" +msgstr "Inactif" + +#: supervisor/shared/bluetooth/bluetooth.c +msgid "Ok" +msgstr "OK" + #: ports/atmel-samd/common-hal/audiobusio/PDMIn.c #: ports/raspberrypi/common-hal/audiobusio/PDMIn.c msgid "Only 8 or 16 bit mono with " msgstr "Uniquement 8 ou 16 bit mono avec " #: ports/espressif/common-hal/wifi/__init__.c +#: ports/raspberrypi/common-hal/wifi/__init__.c msgid "Only IPv4 addresses supported" msgstr "Seulement les adresses IPv4 sont supportées" -#: ports/espressif/common-hal/socketpool/SocketPool.c +#: ports/espressif/common-hal/socketpool/Socket.c +#: ports/raspberrypi/common-hal/socketpool/Socket.c msgid "Only IPv4 sockets supported" msgstr "Seulement les sockets IPv4 sont supportés" @@ -1898,17 +1666,21 @@ msgstr "" #: ports/espressif/common-hal/alarm/touch/TouchAlarm.c msgid "Only one TouchAlarm can be set in deep sleep." -msgstr "Seulement une TouchAlarm peu être réglée en someil profond." +msgstr "Seulement une TouchAlarm peu être réglée en sommeil profond." -#: ports/espressif/common-hal/i2cperipheral/I2CPeripheral.c +#: ports/espressif/common-hal/i2ctarget/I2CTarget.c +#: ports/raspberrypi/common-hal/i2ctarget/I2CTarget.c msgid "Only one address is allowed" msgstr "Seulement une adresse est autorisée" #: ports/atmel-samd/common-hal/alarm/time/TimeAlarm.c -#: ports/espressif/common-hal/alarm/time/TimeAlarm.c #: ports/nrf/common-hal/alarm/time/TimeAlarm.c -#: ports/raspberrypi/common-hal/alarm/time/TimeAlarm.c #: ports/stm/common-hal/alarm/time/TimeAlarm.c +msgid "Only one alarm.time alarm can be set" +msgstr "Seule une alarme alarm.time peut être définie" + +#: ports/espressif/common-hal/alarm/time/TimeAlarm.c +#: ports/raspberrypi/common-hal/alarm/time/TimeAlarm.c msgid "Only one alarm.time alarm can be set." msgstr "Seulement une alarme alarm.time peut être réglée." @@ -1918,21 +1690,22 @@ msgstr "Une seule couleur peut être transparente à la fois" #: py/moduerrno.c msgid "Operation not permitted" -msgstr "" +msgstr "Cette opération n'est pas permise" -#: ports/espressif/bindings/espidf/__init__.c ports/espressif/esp_error.c +#: ports/espressif/common-hal/espidf/__init__.c ports/espressif/esp_error.c msgid "Operation or feature not supported" msgstr "Opération ou fonction non supportée" -#: ports/espressif/bindings/espidf/__init__.c ports/espressif/esp_error.c +#: ports/espressif/common-hal/espidf/__init__.c ports/espressif/esp_error.c msgid "Operation timed out" msgstr "Timeout de l'opération" -#: ports/espressif/bindings/espidf/__init__.c ports/espressif/esp_error.c +#: ports/espressif/common-hal/espidf/__init__.c ports/espressif/esp_error.c msgid "Out of memory" msgstr "Hors de mémoire" -#: ports/espressif/common-hal/socketpool/SocketPool.c +#: ports/espressif/common-hal/socketpool/Socket.c +#: ports/raspberrypi/common-hal/socketpool/Socket.c msgid "Out of sockets" msgstr "Plus de sockets" @@ -1940,11 +1713,6 @@ msgstr "Plus de sockets" msgid "Out-buffer elements must be <= 4 bytes long" msgstr "Éléments du tampon de sortie doivent être <= à 4 octets" -#: shared-bindings/bitops/__init__.c -#, c-format -msgid "Output buffer must be at least %d bytes" -msgstr "Tampon de sortie doit être au moins %d octets" - #: shared-bindings/audiobusio/PDMIn.c msgid "Oversample must be multiple of 8." msgstr "Le sur-échantillonage doit être un multiple de 8." @@ -1953,13 +1721,6 @@ msgstr "Le sur-échantillonage doit être un multiple de 8." msgid "PDMIn not available" msgstr "PDMIn non disponible" -#: shared-bindings/pwmio/PWMOut.c -msgid "" -"PWM duty_cycle must be between 0 and 65535 inclusive (16 bit resolution)" -msgstr "" -"La valeur de duty_cycle de PWM doit être entre 0 et 65535 inclusivement " -"(résolution de 16 bits)" - #: shared-bindings/pwmio/PWMOut.c msgid "" "PWM frequency not writable when variable_frequency is False on construction." @@ -1967,6 +1728,10 @@ msgstr "" "La fréquence de PWM n'est pas modifiable quand variable_frequency est False " "à la construction." +#: ports/stm/common-hal/pwmio/PWMOut.c +msgid "PWM restart" +msgstr "Redémarrage PWM" + #: ports/raspberrypi/common-hal/countio/Counter.c msgid "PWM slice already in use" msgstr "PWM slice déja utilisée" @@ -1983,36 +1748,20 @@ msgstr "Périphérique en utilisation" msgid "Permission denied" msgstr "Permission refusée" -#: ports/atmel-samd/common-hal/alarm/pin/PinAlarm.c #: ports/stm/common-hal/alarm/pin/PinAlarm.c msgid "Pin cannot wake from Deep Sleep" msgstr "La broche ne peut être réveillée depuis un sommeil profond" -#: ports/raspberrypi/bindings/rp2pio/StateMachine.c -msgid "Pin count must be at least 1" -msgstr "Nombre de broches doit être au moins 1" - #: ports/raspberrypi/common-hal/rp2pio/StateMachine.c msgid "Pin count too large" msgstr "Nombre de broches trop élevé" -#: ports/atmel-samd/common-hal/analogio/AnalogIn.c -#: ports/cxd56/common-hal/analogio/AnalogIn.c -#: ports/espressif/common-hal/analogio/AnalogIn.c -#: ports/mimxrt10xx/common-hal/analogio/AnalogIn.c -#: ports/nrf/common-hal/analogio/AnalogIn.c -#: ports/raspberrypi/common-hal/analogio/AnalogIn.c -#: ports/stm/common-hal/analogio/AnalogIn.c -msgid "Pin does not have ADC capabilities" -msgstr "La broche 'pin' ne supporte pas les capacitées ADC" - #: ports/stm/common-hal/alarm/pin/PinAlarm.c #: ports/stm/common-hal/pulseio/PulseIn.c msgid "Pin interrupt already in use" msgstr "L'interruption de cette broche est déjà utilisée" #: shared-bindings/adafruit_bus_device/spi_device/SPIDevice.c -#: shared-bindings/digitalio/DigitalInOut.c msgid "Pin is input only" msgstr "La broche est entrée uniquement" @@ -2068,7 +1817,8 @@ msgstr "" #: main.c msgid "Pretending to deep sleep until alarm, CTRL-C or file write.\n" msgstr "" -"Feinte de someil profond jusqu'à l'alarme, CTRL-C ou écriture au fichier.\n" +"Feinte un sommeil profond jusqu'à l'alarme, CTRL-C ou l'écriture d'un " +"fichier.\n" #: ports/raspberrypi/common-hal/rp2pio/StateMachine.c msgid "Program does IN without loading ISR" @@ -2078,18 +1828,10 @@ msgstr "Le programme fait des entrées sans charger d'ISR" msgid "Program does OUT without loading OSR" msgstr "Le programme fait des sorties sans charger d'OSR" -#: ports/raspberrypi/bindings/rp2pio/StateMachine.c -msgid "Program must contain at least one 16-bit instruction." -msgstr "Le programme doit contenir au moins une instruction de 16 bits." - #: ports/raspberrypi/bindings/rp2pio/StateMachine.c msgid "Program size invalid" msgstr "Taille du programme invalide" -#: ports/raspberrypi/bindings/rp2pio/StateMachine.c -msgid "Program too large" -msgstr "Programme trop grand" - #: shared-bindings/digitalio/DigitalInOut.c msgid "Pull not used when direction is output." msgstr "Le tirage 'pull' n'est pas utilisé quand la direction est 'output'." @@ -2101,7 +1843,7 @@ msgstr "Mode RAISE n'est pas implémenté" #: ports/raspberrypi/common-hal/countio/Counter.c msgid "RISE_AND_FALL not available on this chip" -msgstr "" +msgstr "RISE_AND_FALL n'est pas disponible sur cette puce" #: ports/stm/common-hal/os/__init__.c msgid "RNG DeInit Error" @@ -2111,30 +1853,20 @@ msgstr "Erreur de désinitialisation du RNG" msgid "RNG Init Error" msgstr "Erreur d'initialisation du RNG" -#: ports/nrf/common-hal/busio/UART.c -msgid "RS485 Not yet supported on this device" -msgstr "RS485 n'est pas encore supporté sur cet appareil" +#: ports/atmel-samd/common-hal/busio/UART.c ports/cxd56/common-hal/busio/UART.c +#: ports/nrf/common-hal/busio/UART.c ports/stm/common-hal/busio/UART.c +msgid "RS485" +msgstr "RS485" #: ports/espressif/common-hal/busio/UART.c #: ports/mimxrt10xx/common-hal/busio/UART.c msgid "RS485 inversion specified when not in RS485 mode" msgstr "Inversion RS485 spécifiée sans être en mode RS485" -#: ports/cxd56/common-hal/rtc/RTC.c ports/espressif/common-hal/rtc/RTC.c -#: ports/mimxrt10xx/common-hal/rtc/RTC.c ports/nrf/common-hal/rtc/RTC.c -#: ports/raspberrypi/common-hal/rtc/RTC.c -msgid "RTC calibration is not supported on this board" -msgstr "La calibration du RTC non supportée sur cette carte" - #: shared-bindings/alarm/time/TimeAlarm.c shared-bindings/time/__init__.c msgid "RTC is not supported on this board" msgstr "RTC non supporté sur cette carte" -#: ports/atmel-samd/common-hal/busio/UART.c ports/cxd56/common-hal/busio/UART.c -#: ports/stm/common-hal/busio/UART.c -msgid "RTS/CTS/RS485 Not yet supported on this device" -msgstr "RTS / CTS / RS485 Pas encore supporté sur cet appareil" - #: ports/stm/common-hal/os/__init__.c msgid "Random number generation error" msgstr "Erreur de génération de chiffres aléatoires" @@ -2152,10 +1884,14 @@ msgstr "Système de fichier en lecture seule" msgid "Read-only object" msgstr "Objet en lecture seule" -#: ports/espressif/bindings/espidf/__init__.c ports/espressif/esp_error.c +#: ports/espressif/common-hal/espidf/__init__.c ports/espressif/esp_error.c msgid "Received response was invalid" msgstr "Réponse reçue invalide" +#: supervisor/shared/bluetooth/bluetooth.c +msgid "Reconnecting" +msgstr "Reconnexion" + #: shared-bindings/displayio/EPaperDisplay.c msgid "Refresh too soon" msgstr "Rafraîchissement trop tôt" @@ -2168,7 +1904,7 @@ msgstr "RemoteTransmissionRequests limité à 8 octets" msgid "Requested AES mode is unsupported" msgstr "Le mode AES demandé n'est pas supporté" -#: ports/espressif/bindings/espidf/__init__.c ports/espressif/esp_error.c +#: ports/espressif/common-hal/espidf/__init__.c ports/espressif/esp_error.c msgid "Requested resource not found" msgstr "Resource demandée non trouvée" @@ -2184,6 +1920,10 @@ msgstr "Mode sans-échec ! Le code sauvegardé n'est pas éxecuté.\n" msgid "SD card CSD format not supported" msgstr "Le format de carte SD CSD n'est pas supporté" +#: ports/cxd56/common-hal/sdioio/SDCard.c +msgid "SDCard init" +msgstr "Initialisation SDCard" + #: ports/stm/common-hal/sdioio/SDCard.c #, c-format msgid "SDIO GetCardInfo Error %d" @@ -2194,30 +1934,21 @@ msgstr "Erreur de SDIO GetCardInfo %d" msgid "SDIO Init Error %d" msgstr "Erreur d'initialisation SDIO %d" -#: ports/stm/common-hal/busio/SPI.c -msgid "SPI Init Error" -msgstr "Erreur d'initialisation SPI" - -#: ports/stm/common-hal/busio/SPI.c -msgid "SPI Re-initialization error" -msgstr "Erreur de réinitialisation SPI" - #: ports/espressif/common-hal/busio/SPI.c msgid "SPI configuration failed" msgstr "La configuration SPI a échoué" +#: ports/stm/common-hal/busio/SPI.c +msgid "SPI init error" +msgstr "Erreur d'initialisation SPI" + #: ports/raspberrypi/common-hal/busio/SPI.c msgid "SPI peripheral in use" msgstr "Périphérique SPI utilisé" -#: shared-bindings/audiomixer/Mixer.c -msgid "Sample rate must be positive" -msgstr "Le taux d'échantillonage doit être positif" - -#: ports/atmel-samd/common-hal/audioio/AudioOut.c -#, c-format -msgid "Sample rate too high. It must be less than %d" -msgstr "Taux d'échantillonage trop élevé. Doit être inférieur à %d" +#: ports/stm/common-hal/busio/SPI.c +msgid "SPI re-init" +msgstr "Ré-initialisation du SPI" #: shared-bindings/is31fl3741/FrameBuffer.c msgid "Scale dimensions must divide by 3" @@ -2237,14 +1968,6 @@ msgstr "Sérialiseur en cours d'utilisation" msgid "Server side context cannot have hostname" msgstr "Un contexte niveau serveur ne peut avoir de hostname" -#: ports/raspberrypi/bindings/rp2pio/StateMachine.c -msgid "Set pin count must be between 1 and 5" -msgstr "Nombre de broches configurées doit être entre 1 et 5" - -#: ports/raspberrypi/bindings/rp2pio/StateMachine.c -msgid "Side set pin count must be between 1 and 5" -msgstr "Nombre de broches Side configurées doit être entre 1 et 5" - #: ports/cxd56/common-hal/camera/Camera.c msgid "Size not supported" msgstr "Taille n'est pas supportée" @@ -2265,6 +1988,7 @@ msgid "Slices not supported" msgstr "Tranches non supportées" #: ports/espressif/common-hal/socketpool/SocketPool.c +#: ports/raspberrypi/common-hal/socketpool/SocketPool.c msgid "SocketPool can only be used with wifi.radio" msgstr "SocketPool ne s'utilise qu'avec wifi.radio" @@ -2280,10 +2004,6 @@ msgstr "Spécifiez une unique broche parmi data0 ou data_pins" msgid "Splitting with sub-captures" msgstr "Fractionnement avec des sous-captures" -#: shared-bindings/supervisor/__init__.c -msgid "Stack size must be at least 256" -msgstr "La pile doit être au moins de 256" - #: ports/raspberrypi/common-hal/audiopwmio/PWMAudioOut.c msgid "Stereo left must be on PWM channel A" msgstr "Canal stéréo gauche doit être sur le canal PWM A" @@ -2292,10 +2012,6 @@ msgstr "Canal stéréo gauche doit être sur le canal PWM A" msgid "Stereo right must be on PWM channel B" msgstr "Canal stéréo droit doit être sur le canal PWM B" -#: shared-bindings/multiterminal/__init__.c -msgid "Stream missing readinto() or write() method." -msgstr "Il manque une méthode readinto() ou write() au flux." - #: ports/mimxrt10xx/common-hal/busio/UART.c ports/stm/common-hal/busio/UART.c msgid "Supply at least one UART pin" msgstr "Fournissez au moins une broche UART" @@ -2380,10 +2096,6 @@ msgstr "La hauteur de la tuile doit diviser exactement la hauteur de l'image" msgid "Tile index out of bounds" msgstr "Index des tuiles hors limites" -#: shared-bindings/displayio/TileGrid.c -msgid "Tile value out of bounds" -msgstr "Valeur de tuile hors limites" - #: shared-bindings/displayio/TileGrid.c msgid "Tile width must exactly divide bitmap width" msgstr "La largeur de la tuile doit diviser exactement la largeur de l'image" @@ -2403,6 +2115,9 @@ msgid "To exit, please reset the board without " msgstr "Pour quitter, SVP redémarrez la carte sans " #: ports/atmel-samd/common-hal/audiobusio/I2SOut.c +msgid "Too many channels in sample" +msgstr "Trop de canaux dans l'échantillon" + #: ports/raspberrypi/common-hal/audiobusio/I2SOut.c msgid "Too many channels in sample." msgstr "Trop de canaux dans l'échantillon." @@ -2435,24 +2150,25 @@ msgid "Tuple or struct_time argument required" msgstr "Paramètre de type tuple ou struct_time requis" #: ports/stm/common-hal/busio/UART.c -msgid "UART Buffer allocation error" -msgstr "Erreur d'allocation de tampon UART" +msgid "UART de-init" +msgstr "Dé-initialisation du UART" + +#: ports/atmel-samd/common-hal/busio/UART.c ports/cxd56/common-hal/busio/UART.c +#: ports/espressif/common-hal/busio/UART.c ports/stm/common-hal/busio/UART.c +msgid "UART init" +msgstr "Initialisation UART" #: ports/stm/common-hal/busio/UART.c -msgid "UART De-init error" -msgstr "Erreur de désactivation UART" +msgid "UART re-init" +msgstr "Ré-initialisation du UART" #: ports/stm/common-hal/busio/UART.c -msgid "UART Init Error" -msgstr "Erreur d'initialisation UART" +msgid "UART write" +msgstr "Écriture UART" -#: ports/stm/common-hal/busio/UART.c -msgid "UART Re-init error" -msgstr "Erreur de réinitialisation UART" - -#: ports/stm/common-hal/busio/UART.c -msgid "UART write error" -msgstr "Erreur d'écriture UART" +#: main.c +msgid "UID:" +msgstr "" #: shared-module/usb_hid/Device.c msgid "USB busy" @@ -2516,7 +2232,7 @@ msgstr "Impossible de lire les données de la palette de couleurs" #: ports/espressif/common-hal/mdns/Server.c msgid "Unable to start mDNS query" -msgstr "" +msgstr "Impossible de lancer la requête mDNS" #: shared-bindings/nvm/ByteArray.c msgid "Unable to write to nvm." @@ -2538,12 +2254,12 @@ msgstr "Erreur ESP TLS non gérée %d %d %x %d" #: ports/espressif/common-hal/_bleio/__init__.c #, c-format msgid "Unknown BLE error at %s:%d: %d" -msgstr "" +msgstr "Erreur BLE inconnue à %s:%d : %d" #: ports/espressif/common-hal/_bleio/__init__.c #, c-format msgid "Unknown BLE error: %d" -msgstr "" +msgstr "Erreur BLE inconnue : %d" #: shared-bindings/wifi/Radio.c #, c-format @@ -2568,7 +2284,7 @@ msgstr "Erreur de sécurité inconnue : 0x%04x" #: ports/espressif/common-hal/_bleio/__init__.c #, c-format msgid "Unknown system firmware error at %s:%d: %d" -msgstr "" +msgstr "Erreur du firmware système inconnue à %s:%d : %d" #: ports/nrf/common-hal/_bleio/__init__.c #, c-format @@ -2578,6 +2294,11 @@ msgstr "Faute inconnue du logiciel systême : %04x" #: ports/espressif/common-hal/_bleio/__init__.c #, c-format msgid "Unknown system firmware error: %d" +msgstr "Erreur du firmware système inconnue : %d" + +#: ports/raspberrypi/common-hal/wifi/__init__.c +#, c-format +msgid "Unkown error code %d" msgstr "" #: shared-bindings/adafruit_pixelbuf/PixelBuf.c @@ -2594,12 +2315,6 @@ msgstr "" "Problème non spécifié. Il se peut que l'invite d'association sur l'autre " "appareil ait été refusée ou ignorée." -#: ports/atmel-samd/common-hal/busio/I2C.c ports/cxd56/common-hal/busio/I2C.c -#: ports/espressif/common-hal/busio/UART.c -#: ports/raspberrypi/common-hal/busio/I2C.c ports/stm/common-hal/busio/I2C.c -msgid "Unsupported baudrate" -msgstr "Débit en bauds non supporté" - #: shared-bindings/bitmaptools/__init__.c msgid "Unsupported colorspace" msgstr "Espace de couleur non supporté" @@ -2612,6 +2327,10 @@ msgstr "Type de bus d'affichage non supporté" msgid "Unsupported format" msgstr "Format non supporté" +#: shared-bindings/hashlib/__init__.c +msgid "Unsupported hash algorithm" +msgstr "Algorithme de hachage non supporté" + #: ports/espressif/common-hal/dualbank/__init__.c msgid "Update Failed" msgstr "Mise-à-jour échouée" @@ -2630,7 +2349,7 @@ msgstr "Longueur de valeur != Longueur fixe requise" msgid "Value length > max_length" msgstr "Longueur de la valeur > max_length" -#: ports/espressif/bindings/espidf/__init__.c ports/espressif/esp_error.c +#: ports/espressif/common-hal/espidf/__init__.c ports/espressif/esp_error.c msgid "Version was invalid" msgstr "Version est invalide" @@ -2647,7 +2366,7 @@ msgstr "ATTENTION : le nom de fichier de votre code a deux extensions\n" #: ports/raspberrypi/common-hal/watchdog/WatchDogTimer.c msgid "WatchDogTimer cannot be deinitialized once mode is set to RESET" msgstr "" -"WatchDogTimer ne peut pas être désinitialisé une fois que le mode est réglé " +"WatchDogTimer ne peut pas être dés-initialisé une fois que le mode est réglé " "sur RESET" #: shared-bindings/watchdog/WatchDogTimer.c @@ -2664,10 +2383,6 @@ msgstr "" msgid "WatchDogTimer.timeout must be greater than 0" msgstr "WatchDogTimer.timeout doit être supérieur à 0" -#: supervisor/shared/safe_mode.c -msgid "Watchdog timer expired." -msgstr "Le minuteur Watchdog a expiré." - #: py/builtinhelp.c #, c-format msgid "" @@ -2683,9 +2398,9 @@ msgstr "" "\n" "Pour lister les modules internes, entrez `help(\"modules\")`.\n" -#: shared-bindings/wifi/Radio.c -msgid "WiFi password must be between 8 and 63 characters" -msgstr "Le mot de passe WiFi doit faire entre 8 et 63 caractères" +#: supervisor/shared/web_workflow/web_workflow.c +msgid "Wi-Fi: " +msgstr "Wi-Fi : " #: main.c msgid "Woken up by alarm.\n" @@ -2704,8 +2419,8 @@ msgstr "Vous êtres en mode sûr parce que :\n" msgid "" "You pressed the reset button during boot. Press again to exit safe mode." msgstr "" -"Vous avez pressé le bouton de reset pendant le démarrage. Pressez le à " -"nouveau pour sortir du mode sûr." +"Vous avez pressé le bouton reset pendant le démarrage. Pressez-le à nouveau " +"pour sortir du mode sûr." #: supervisor/shared/safe_mode.c msgid "You requested starting safe mode by " @@ -2727,11 +2442,7 @@ msgstr "l'argument __new__ doit être d'un type défini par l'utilisateur" msgid "a bytes-like object is required" msgstr "un objet 'bytes-like' est requis" -#: shared-bindings/i2cperipheral/I2CPeripheral.c -msgid "address out of bounds" -msgstr "adresse hors limites" - -#: shared-bindings/i2cperipheral/I2CPeripheral.c +#: shared-bindings/i2ctarget/I2CTarget.c msgid "addresses is empty" msgstr "adresses vides" @@ -2780,6 +2491,10 @@ msgstr "les paramètres doivent être des ndarrays" msgid "array and index length must be equal" msgstr "la taille de la matrice et de l'index doivent être égaux" +#: extmod/ulab/code/numpy/io/io.c +msgid "array has too many dimensions" +msgstr "la tableau à trop de dimensions" + #: py/objarray.c shared-bindings/alarm/SleepMemory.c #: shared-bindings/nvm/ByteArray.c msgid "array/bytes required on right side" @@ -2841,10 +2556,6 @@ msgstr "Les tailles des images doivent correspondre" msgid "bits must be 32 or less" msgstr "Les bits doivent être 32 ou moins" -#: shared-bindings/busio/UART.c -msgid "bits must be in range 5 to 9" -msgstr "les bits doivent être compris entre 5 et 9" - #: shared-bindings/audiomixer/Mixer.c msgid "bits_per_sample must be 8 or 16" msgstr "'bits_per_sample' doivent être 8 ou 16" @@ -2859,7 +2570,7 @@ msgstr "tampon est plus petit que la taille demandée" #: extmod/ulab/code/numpy/create.c extmod/ulab/code/utils/utils.c msgid "buffer size must be a multiple of element size" -msgstr "taille du tampon doit être un multiple de la taille de l'élement" +msgstr "taille du tampon doit être un multiple de la taille de l’élément" #: shared-module/struct/__init__.c msgid "buffer size must match format" @@ -2882,11 +2593,6 @@ msgstr "tampon trop petit pour le nombre d'octets demandé" msgid "byteorder is not a string" msgstr "byteorder n'est pas une chaîne" -#: ports/atmel-samd/common-hal/busio/UART.c -#: ports/espressif/common-hal/busio/UART.c -msgid "bytes > 8 bits not supported" -msgstr "octets > 8 bits non supporté" - #: py/objarray.c msgid "bytes length not a multiple of item size" msgstr "bytes length n'est pas un multiple de la taille d'un élément" @@ -2895,7 +2601,7 @@ msgstr "bytes length n'est pas un multiple de la taille d'un élément" msgid "bytes value out of range" msgstr "valeur des octets hors bornes" -#: ports/atmel-samd/bindings/samd/Clock.c ports/atmel-samd/common-hal/rtc/RTC.c +#: ports/atmel-samd/bindings/samd/Clock.c msgid "calibration is out of range" msgstr "étalonnage hors bornes" @@ -2903,21 +2609,18 @@ msgstr "étalonnage hors bornes" msgid "calibration is read only" msgstr "étalonnage en lecture seule" -#: ports/atmel-samd/common-hal/rtc/RTC.c -msgid "calibration value out of range +/-127" -msgstr "valeur de étalonnage hors bornes +/-127" - +#: shared-module/vectorio/Circle.c shared-module/vectorio/Polygon.c #: shared-module/vectorio/Rectangle.c -msgid "can only be registered in one parent" -msgstr "" +msgid "can only have one parent" +msgstr "ne peut avoir qu'un seul parent" #: py/emitinlinethumb.c msgid "can only have up to 4 parameters to Thumb assembly" -msgstr "il peut y avoir jusqu'à 4 paramètres pour l'assemblage Thumb" +msgstr "il ne peut pas y avoir plus de 4 paramètres pour l'assemblage Thumb" #: py/emitinlinextensa.c msgid "can only have up to 4 parameters to Xtensa assembly" -msgstr "maximum 4 paramètres pour l'assembleur Xtensa" +msgstr "il ne peut pas y avoir plus de 4 paramètres pour l'assemblage Xtensa" #: py/objtype.c msgid "can't add special method to already-subclassed class" @@ -2932,8 +2635,7 @@ msgstr "ne peut pas assigner à une expression" msgid "can't cancel self" msgstr "ne peut pas s'annuler soi-même" -#: py/obj.c py/objint.c shared-bindings/i2cperipheral/I2CPeripheral.c -#: shared-module/adafruit_pixelbuf/PixelBuf.c +#: py/obj.c py/objint.c shared-module/adafruit_pixelbuf/PixelBuf.c msgid "can't convert %q to %q" msgstr "impossible de convertir %q en %q" @@ -2952,7 +2654,7 @@ msgstr "impossible de convertir l'objet '%q' en '%q' implicitement" #: extmod/ulab/code/numpy/vector.c msgid "can't convert complex to float" -msgstr "" +msgstr "ne peut convertir un complexe en flottant" #: py/obj.c msgid "can't convert to %q" @@ -3008,7 +2710,7 @@ msgstr "impossible de charger avec l'indice '%q'" #: py/builtinimport.c msgid "can't perform relative import" -msgstr "" +msgstr "ne peut importer relativement" #: py/objgenerator.c msgid "can't send non-None value to a just-started generator" @@ -3060,11 +2762,11 @@ msgstr "output ne peut être projeté sans règle de projection" #: extmod/ulab/code/ndarray.c msgid "cannot convert complex to dtype" -msgstr "" +msgstr "ne peut convertir un complexe en dtype" #: extmod/ulab/code/ndarray.c msgid "cannot convert complex type" -msgstr "" +msgstr "ne peut convertir un type complexe" #: py/objtype.c msgid "cannot create '%q' instances" @@ -3086,6 +2788,10 @@ msgstr "ne peut récupérer sans ambigüité le sizeof d'un scalaire" msgid "casting" msgstr "typage" +#: ports/stm/common-hal/pwmio/PWMOut.c +msgid "channel re-init" +msgstr "Ré-initialisation du canal" + #: shared-bindings/_stage/Text.c msgid "chars buffer too small" msgstr "tampon de caractères trop petit" @@ -3098,10 +2804,6 @@ msgstr "paramètre de chr() hors les bornes de range(0x11000)" msgid "chr() arg not in range(256)" msgstr "paramètre de chr() hors les bornes de range(256)" -#: shared-module/vectorio/Circle.c -msgid "circle can only be registered in one parent" -msgstr "le cercle ne peut être enregistré que dans un seul parent" - #: shared-bindings/bitmaptools/__init__.c msgid "clip point must be (x,y) tuple" msgstr "point de coupure doît être un tuple (x,y)" @@ -3121,16 +2823,14 @@ msgstr "" #: shared-bindings/displayio/Palette.c msgid "color buffer must be a bytearray or array of type 'b' or 'B'" -msgstr "tampon color doit être un bytearray ou une matrice de type 'b' ou 'B'" +msgstr "" +"le tampon de couleurs doit être un bytearray ou une matrice de type 'b' ou " +"'B'" #: shared-bindings/displayio/Palette.c msgid "color must be between 0x000000 and 0xffffff" msgstr "la couleur doit être entre 0x000000 et 0xffffff" -#: shared-bindings/displayio/ColorConverter.c -msgid "color should be an int" -msgstr "la couleur doit être un entier 'int'" - #: py/emitnative.c msgid "comparison of int and uint" msgstr "comparaison entre int et uint" @@ -3167,6 +2867,10 @@ msgstr "les paramêtres pour convolve doivent être des ndarrays" msgid "convolve arguments must not be empty" msgstr "les arguments convolve ne doivent pas être vides" +#: extmod/ulab/code/numpy/io/io.c +msgid "corrupted file" +msgstr "fichier corrompu" + #: extmod/ulab/code/numpy/poly.c msgid "could not invert Vandermonde matrix" msgstr "n'a pas pu inverser la matrice Vandermonde" @@ -3220,10 +2924,6 @@ msgstr "" "le tampon de destination doit être une matrice de type 'H' pour bit_depth = " "16" -#: shared-bindings/audiobusio/PDMIn.c -msgid "destination_length must be an int >= 0" -msgstr "destination_length doit être un entier >= 0" - #: py/objdict.c msgid "dict update sequence has wrong length" msgstr "la séquence de mise à jour de dict a une mauvaise longueur" @@ -3255,12 +2955,16 @@ msgstr "division par zéro" #: extmod/ulab/code/numpy/vector.c msgid "dtype must be float, or complex" -msgstr "" +msgstr "le dtype doit être un flottant, ou un complexe" #: py/objdeque.c msgid "empty" msgstr "vide" +#: extmod/ulab/code/numpy/io/io.c +msgid "empty file" +msgstr "fichier vide" + #: extmod/moduasyncio.c extmod/moduheapq.c extmod/modutimeq.c msgid "empty heap" msgstr "tas vide" @@ -3277,10 +2981,6 @@ msgstr "séquence vide" msgid "end of format while looking for conversion specifier" msgstr "fin de format en cherchant une spécification de conversion" -#: shared-bindings/displayio/Shape.c -msgid "end_x should be an int" -msgstr "end_x doit être un entier 'int'" - #: shared-bindings/alarm/time/TimeAlarm.c msgid "epoch_time not supported on this board" msgstr "epoch_time n'est pas supporté sur ce panneau" @@ -3290,6 +2990,12 @@ msgstr "epoch_time n'est pas supporté sur ce panneau" msgid "error = 0x%08lX" msgstr "erreur = 0x%08lX" +#: ports/espressif/common-hal/esp32_camera/Camera.c +msgid "" +"esp32_camera.Camera requires reserved PSRAM to be configured. See the " +"documentation for instructions." +msgstr "" + #: py/runtime.c msgid "exceptions must derive from BaseException" msgstr "les exceptions doivent dériver de 'BaseException'" @@ -3364,7 +3070,7 @@ msgstr "le premier argument doit être une fonction" msgid "first argument must be a tuple of ndarrays" msgstr "le premier paramêtre doit être un tuple de ndarrays" -#: extmod/ulab/code/numpy/vector.c +#: extmod/ulab/code/numpy/transform.c extmod/ulab/code/numpy/vector.c msgid "first argument must be an ndarray" msgstr "le premier paramêtre doit être un ndarray" @@ -3402,7 +3108,7 @@ msgstr "le format nécessite un dict" #: shared-bindings/microcontroller/Processor.c msgid "frequency is read-only for this board" -msgstr "" +msgstr "la fréquence est en lecture seule pour cette carte" #: py/objdeque.c msgid "full" @@ -3431,7 +3137,7 @@ msgstr "fonction définie que pour les ndarrays" #: extmod/ulab/code/numpy/carray/carray.c msgid "function is implemented for ndarrays only" -msgstr "" +msgstr "la fonction n'est implémentée que pour les ndarrays" #: py/argcheck.c #, c-format @@ -3512,7 +3218,7 @@ msgstr "clé de format incomplète" msgid "incorrect padding" msgstr "espacement incorrect" -#: extmod/ulab/code/ndarray.c +#: extmod/ulab/code/ndarray.c extmod/ulab/code/numpy/transform.c msgid "index is out of bounds" msgstr "l'index est hors limites" @@ -3531,6 +3237,10 @@ msgid "indices must be integers, slices, or Boolean lists" msgstr "" "les indices doivent être des entiers, des tranches ou des listes booléennes" +#: ports/espressif/common-hal/busio/I2C.c +msgid "init I2C" +msgstr "initialisation I2C" + #: extmod/ulab/code/scipy/optimize/optimize.c msgid "initial values must be iterable" msgstr "les valeurs initiales doivent être itérables" @@ -3565,7 +3275,7 @@ msgstr "les données d'entrée doivent être un itérable" #: extmod/ulab/code/numpy/vector.c msgid "input dtype must be float or complex" -msgstr "" +msgstr "le dtype d'entrée doit être un flottant ou un complexe" #: extmod/ulab/code/numpy/linalg/linalg.c msgid "input matrix is asymmetric" @@ -3576,25 +3286,25 @@ msgstr "la matrice d'entrée est asymétrique" msgid "input matrix is singular" msgstr "la matrice d'entrée est singulière" +#: extmod/ulab/code/numpy/create.c +msgid "input must be 1- or 2-d" +msgstr "l'entrée doit être 1D ou 2D" + #: extmod/ulab/code/numpy/carray/carray.c msgid "input must be a 1D ndarray" -msgstr "" +msgstr "l'entrée doit être un ndarray 1D" #: extmod/ulab/code/scipy/linalg/linalg.c extmod/ulab/code/user/user.c msgid "input must be a dense ndarray" msgstr "l'entrée doit être un ndarray dense" -#: extmod/ulab/code/numpy/create.c -msgid "input must be a tensor of rank 2" -msgstr "l'entrée doit être un tenseur de rang 2" - -#: extmod/ulab/code/numpy/create.c extmod/ulab/code/user/user.c +#: extmod/ulab/code/user/user.c msgid "input must be an ndarray" msgstr "l'entrée doit être un ndarray" #: extmod/ulab/code/numpy/carray/carray.c msgid "input must be an ndarray, or a scalar" -msgstr "" +msgstr "l'entrée doit être un ndarray, ou un scalaire" #: extmod/ulab/code/scipy/signal/signal.c msgid "input must be one-dimensional" @@ -3618,7 +3328,7 @@ msgstr "les entrées ne sont pas itérables" #: py/parsenum.c msgid "int() arg 2 must be >= 2 and <= 36" -msgstr "l'argument 2 de int() doit être >=2 et <=36" +msgstr "Le deuxième argument de int() doit être compris entre 2 et 36 inclus" #: extmod/ulab/code/numpy/approx.c msgid "interp is defined for 1D iterables of equal length" @@ -3639,6 +3349,10 @@ msgid "invalid bits_per_pixel %d, must be, 1, 2, 4, 8, 16, 24, or 32" msgstr "" "%d est invalide pour bits_per_pixel, doit être 1, 2, 4, 8, 16, 24, ou 32" +#: ports/raspberrypi/common-hal/ssl/SSLSocket.c +msgid "invalid cert" +msgstr "certificat invalide" + #: shared-bindings/bitmaptools/__init__.c #, c-format msgid "invalid element size %d for bits_per_pixel %d\n" @@ -3665,10 +3379,18 @@ msgstr "spécification de format invalide" msgid "invalid hostname" msgstr "hostname incorrect" +#: ports/raspberrypi/common-hal/ssl/SSLSocket.c +msgid "invalid key" +msgstr "clé invalide" + #: py/compile.c msgid "invalid micropython decorator" msgstr "décorateur micropython invalide" +#: ports/espressif/common-hal/esp32_camera/Camera.c +msgid "invalid setting" +msgstr "réglage invalide" + #: shared-bindings/random/__init__.c msgid "invalid step" msgstr "pas invalide" @@ -3701,7 +3423,8 @@ msgstr "l'argument 1 de issubclass() doit être une classe" #: py/objtype.c msgid "issubclass() arg 2 must be a class or a tuple of classes" msgstr "" -"l'argument 2 de issubclass() doit être une classe ou un tuple de classes" +"le deuxième argument de issubclass() doit être une classe ou un tuple de " +"classes" #: extmod/ulab/code/numpy/linalg/linalg.c msgid "iterations did not converge" @@ -3764,11 +3487,11 @@ msgstr "loopback + silent mode non pris en charge par le périphérique" #: ports/espressif/common-hal/mdns/Server.c msgid "mDNS already initialized" -msgstr "" +msgstr "mDNS a déjà été initialisé" #: ports/espressif/common-hal/mdns/Server.c msgid "mDNS only works with built-in WiFi" -msgstr "" +msgstr "mDNS ne fonctionne que avec le WiFi intégré" #: py/parse.c msgid "malformed f-string" @@ -3786,10 +3509,6 @@ msgstr "erreur de domaine math" msgid "matrix is not positive definite" msgstr "la matrice n'est pas définie positive" -#: ports/espressif/common-hal/wifi/Radio.c -msgid "max_connections must be between 0 and 10" -msgstr "" - #: ports/espressif/common-hal/_bleio/Descriptor.c #: ports/nrf/common-hal/_bleio/Characteristic.c #: ports/nrf/common-hal/_bleio/Descriptor.c @@ -3797,13 +3516,9 @@ msgstr "" msgid "max_length must be 0-%d when fixed_length is %s" msgstr "max_length doit être 0-%d lorsque fixed_length est %s" -#: shared-bindings/_bleio/Characteristic.c shared-bindings/_bleio/Descriptor.c -msgid "max_length must be >= 0" -msgstr "max_length doit être >= 0" - #: extmod/ulab/code/ndarray.c -msgid "maximum number of dimensions is 4" -msgstr "nombre maximal de dimensions est 4" +msgid "maximum number of dimensions is " +msgstr "le nombre maximal de dimensions est " #: py/runtime.c msgid "maximum recursion depth exceeded" @@ -3936,7 +3651,7 @@ msgstr "pas de broche de réinitialisation disponible" msgid "no response from SD card" msgstr "pas de réponse de la carte SD" -#: py/objobject.c py/runtime.c +#: ports/espressif/common-hal/esp32_camera/Camera.c py/objobject.c py/runtime.c msgid "no such attribute" msgstr "pas de tel attribut" @@ -3989,7 +3704,7 @@ msgstr "pas assez d'arguments pour la chaîne de format" #: extmod/ulab/code/numpy/carray/carray_tools.c msgid "not implemented for complex dtype" -msgstr "" +msgstr "n'est pas implémenté pour les dtype complexes" #: extmod/ulab/code/numpy/create.c msgid "number of points must be at least 2" @@ -4049,7 +3764,11 @@ msgstr "un objet avec un protocole de tampon est nécessaire" msgid "odd-length string" msgstr "chaîne de longueur impaire" -#: extmod/ulab/code/numpy/create.c extmod/ulab/code/utils/utils.c +#: supervisor/shared/web_workflow/web_workflow.c +msgid "off" +msgstr "inactif" + +#: extmod/ulab/code/utils/utils.c msgid "offset is too large" msgstr "offset est trop large" @@ -4059,7 +3778,8 @@ msgstr "offset doit être >= 0" #: extmod/ulab/code/numpy/create.c msgid "offset must be non-negative and no greater than buffer length" -msgstr "offset doit être non-négatif, et au plus la taille du tampon" +msgstr "" +"offset ne doit pas être négatif, et pas plus grand que la taille du tampon" #: py/objstr.c py/objstrunicode.c msgid "offset out of bounds" @@ -4115,8 +3835,7 @@ msgstr "ord attend un caractère" #, c-format msgid "ord() expected a character, but string of length %d found" msgstr "" -"ord() attend un caractère mais une chaîne de caractère de longueur %d a été " -"trouvée" +"ord() attend un caractère mais une chaîne de %d caractères a été trouvée" #: extmod/ulab/code/utils/utils.c msgid "out array is too small" @@ -4147,10 +3866,6 @@ msgstr "pack attend %d element(s) (%d reçu)" msgid "palette must be 32 bytes long" msgstr "la palette doit être longue de 32 octets" -#: shared-bindings/displayio/Palette.c -msgid "palette_index should be an int" -msgstr "palette_index devrait être un entier 'int'" - #: py/emitinlinextensa.c msgid "parameters must be registers in sequence a2 to a5" msgstr "les paramètres doivent être des registres dans la séquence a2 à a5" @@ -4174,11 +3889,7 @@ msgstr "" #: extmod/vfs_posix_file.c msgid "poll on file not available on win32" -msgstr "" - -#: shared-module/vectorio/Polygon.c -msgid "polygon can only be registered in one parent" -msgstr "le polygone ne peut être enregistré que dans un parent" +msgstr "le polling sur un fichier n'est pas disponible sous win32" #: ports/espressif/common-hal/pulseio/PulseIn.c msgid "pop from an empty PulseIn" @@ -4205,7 +3916,23 @@ 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/espressif/boards/adafruit_qtpy_esp32_pico/mpconfigboard.h +msgid "pressing BOOT button at start up.\n" +msgstr "presser le bouton BOOT au démarrage.\n" + +#: ports/espressif/boards/adafruit_feather_esp32_v2/mpconfigboard.h +msgid "pressing SW38 button at start up.\n" +msgstr "presser le bouton SW38 au démarrage.\n" + +#: ports/espressif/boards/hardkernel_odroid_go/mpconfigboard.h +msgid "pressing VOLUME button at start up.\n" +msgstr "presser le bouton VOLUME au démarrage.\n" + #: ports/espressif/boards/adafruit_qtpy_esp32c3/mpconfigboard.h +#: ports/espressif/boards/beetle-esp32-c3/mpconfigboard.h +#: ports/espressif/boards/espressif_esp32s2_devkitc_1_n8r2/mpconfigboard.h +#: ports/espressif/boards/lolin_c3_mini/mpconfigboard.h +#: ports/espressif/boards/microdev_micro_c3/mpconfigboard.h #: supervisor/shared/safe_mode.c msgid "pressing boot button at start up.\n" msgstr "bouton boot appuyé lors du démarrage.\n" @@ -4226,14 +3953,6 @@ msgstr "appuyer le bouton de gauche au démarage\n" msgid "pull masks conflict with direction masks" msgstr "masque pull est en conflit avec les masques de direction" -#: ports/raspberrypi/bindings/rp2pio/StateMachine.c -msgid "pull_threshold must be between 1 and 32" -msgstr "pull_threshold doit être entre 1 et 32" - -#: ports/raspberrypi/bindings/rp2pio/StateMachine.c -msgid "push_threshold must be between 1 and 32" -msgstr "push_threshold doit être entre 1 et 32" - #: extmod/modutimeq.c msgid "queue overflow" msgstr "dépassement de file" @@ -4285,14 +4004,6 @@ msgstr "paramêtre roll doit être un ndarray" msgid "rsplit(None,n)" msgstr "rsplit(None, n)" -#: shared-bindings/audiocore/RawSample.c -msgid "" -"sample_source buffer must be a bytearray or array of type 'h', 'H', 'b' or " -"'B'" -msgstr "" -"tampon sample_source doit être un bytearray ou une matrice de type 'h', 'H', " -"'b' ou 'B'" - #: ports/atmel-samd/common-hal/audiobusio/PDMIn.c #: ports/raspberrypi/common-hal/audiobusio/PDMIn.c msgid "sampling rate out of range" @@ -4390,26 +4101,14 @@ msgstr "source_bitmap doit avoir une value_count de 65536" msgid "source_bitmap must have value_count of 8" msgstr "source_bitmap doit avoir une value_count de 8" -#: shared-bindings/wifi/Radio.c -msgid "ssid can't be more than 32 bytes" -msgstr "un ssid ne peut pas faire plus de 32 octets" - #: py/objstr.c msgid "start/end indices" msgstr "indices de début/fin" -#: shared-bindings/displayio/Shape.c -msgid "start_x should be an int" -msgstr "'start_x' doit être un entier 'int'" - #: shared-bindings/random/__init__.c msgid "step must be non-zero" msgstr "le pas 'step' doit être non nul" -#: shared-bindings/busio/UART.c -msgid "stop must be 1 or 2" -msgstr "stop doit être 1 ou 2" - #: shared-bindings/random/__init__.c msgid "stop not reachable from start" msgstr "stop n'est pas accessible au démarrage" @@ -4459,10 +4158,6 @@ msgstr "erreur de syntaxe dans le descripteur d'uctypes" msgid "threshold must be in the range 0-65536" msgstr "le seuil doit être dans la portée 0-65536" -#: shared-bindings/rgbmatrix/RGBMatrix.c -msgid "tile must be greater than zero" -msgstr "tile doit être plus que zéro" - #: shared-bindings/time/__init__.c msgid "time.struct_time() takes a 9-sequence" msgstr "time.struct_time() prend une séquence de longueur 9" @@ -4482,10 +4177,6 @@ msgstr "le délai doit être compris entre 0.0 et 100.0 secondes" msgid "timeout must be < 655.35 secs" msgstr "le délai (timeout) doit être < 655.35 secondes" -#: shared-bindings/_bleio/CharacteristicBuffer.c -msgid "timeout must be >= 0.0" -msgstr "'timeout' doit être >= 0.0" - #: shared-module/sdcardio/SDCard.c msgid "timeout waiting for v1 card" msgstr "Délai d’expiration dépassé en attendant une carte v1" @@ -4494,6 +4185,10 @@ msgstr "Délai d’expiration dépassé en attendant une carte v1" msgid "timeout waiting for v2 card" msgstr "Délai d’expiration dépassé en attendant une carte v2" +#: ports/stm/common-hal/pwmio/PWMOut.c +msgid "timer re-init" +msgstr "Ré-initialisation du miniteur" + #: shared-bindings/time/__init__.c msgid "timestamp out of range for platform time_t" msgstr "timestamp hors bornes pour 'time_t' de la plateforme" @@ -4559,14 +4254,10 @@ msgstr "le type '%q' n'est pas un type de base accepté" msgid "type is not an acceptable base type" msgstr "le type n'est pas un type de base accepté" -#: py/runtime.c +#: py/objgenerator.c py/runtime.c msgid "type object '%q' has no attribute '%q'" msgstr "l'objet de type '%q' n'a pas d'attribut '%q'" -#: py/objgenerator.c -msgid "type object 'generator' has no attribute '__await__'" -msgstr "le type 'generator' n'a pas d'attribut '__await__'" - #: py/objtype.c msgid "type takes 1 or 3 arguments" msgstr "le type prend 1 ou 3 arguments" @@ -4625,7 +4316,6 @@ msgid "unreadable attribute" msgstr "attribut illisible" #: shared-bindings/displayio/TileGrid.c shared-bindings/vectorio/VectorShape.c -#: shared-module/vectorio/Polygon.c shared-module/vectorio/VectorShape.c msgid "unsupported %q type" msgstr "type %q non pris on charge" @@ -4664,6 +4354,14 @@ msgstr "type non supporté pour l'opérateur" msgid "unsupported types for %q: '%q', '%q'" msgstr "types non supportés pour %q: '%q', '%q'" +#: extmod/ulab/code/numpy/io/io.c +msgid "usecols is too high" +msgstr "usecols est trop grand" + +#: extmod/ulab/code/numpy/io/io.c +msgid "usecols keyword must be specified" +msgstr "le mot-clé \"usecols\" doit être spécifié" + #: py/objint.c #, c-format msgid "value must fit in %d byte(s)" @@ -4685,20 +4383,19 @@ msgstr "chien de garde (watchdog) non initialisé" msgid "watchdog timeout must be greater than 0" msgstr "watchdog timeout doit être supérieur à 0" -#: shared-bindings/bitops/__init__.c -#, c-format -msgid "width must be from 2 to 8 (inclusive), not %d" -msgstr "width doit être entre 2 et 8 (inclusivement), non %d" - #: shared-bindings/is31fl3741/FrameBuffer.c -#: shared-bindings/rgbmatrix/RGBMatrix.c msgid "width must be greater than zero" msgstr "width doit être plus que zero" #: ports/espressif/common-hal/wifi/Radio.c +#: ports/raspberrypi/common-hal/wifi/Radio.c msgid "wifi is not enabled" msgstr "wifi n’est pas activé" +#: ports/raspberrypi/common-hal/wifi/Monitor.c +msgid "wifi.Monitor not available" +msgstr "" + #: shared-bindings/_bleio/Adapter.c msgid "window must be <= interval" msgstr "la fenêtre (window) doit être <= intervalle (interval)" @@ -4711,13 +4408,27 @@ msgstr "index d'axe incorrecte" msgid "wrong axis specified" msgstr "axe incorrecte spécifiée" -#: extmod/ulab/code/numpy/compare.c extmod/ulab/code/numpy/vector.c +#: extmod/ulab/code/numpy/io/io.c +msgid "wrong dtype" +msgstr "dtype invalide" + +#: extmod/ulab/code/numpy/transform.c +msgid "wrong index type" +msgstr "type d'index incorrect" + +#: extmod/ulab/code/numpy/compare.c extmod/ulab/code/numpy/create.c +#: extmod/ulab/code/numpy/io/io.c extmod/ulab/code/numpy/transform.c +#: extmod/ulab/code/numpy/vector.c msgid "wrong input type" msgstr "type d'entrée incorrect" #: extmod/ulab/code/numpy/transform.c msgid "wrong length of condition array" -msgstr "" +msgstr "mauvaise taille du tableau de condition" + +#: extmod/ulab/code/numpy/transform.c +msgid "wrong length of index array" +msgstr "mauvaise longueur du tableau d'indices" #: extmod/ulab/code/numpy/create.c py/objarray.c py/objstr.c msgid "wrong number of arguments" @@ -4739,10 +4450,6 @@ msgstr "valeur x hors limites" msgid "xTaskCreate failed" msgstr "Échec de xTaskCreate" -#: shared-bindings/displayio/Shape.c -msgid "y should be an int" -msgstr "'y' doit être un entier 'int'" - #: shared-module/displayio/Shape.c msgid "y value out of bounds" msgstr "valeur y hors limites" @@ -4763,6 +4470,407 @@ msgstr "zi doit être de type float" msgid "zi must be of shape (n_section, 2)" msgstr "zi doit être de forme (n_section, 2)" +#~ msgid "Stream missing readinto() or write() method." +#~ msgstr "Il manque une méthode readinto() ou write() au flux." + +#~ msgid "%q must be >= 0" +#~ msgstr "%q doit être >= 0" + +#~ msgid "%q must be >= 1" +#~ msgstr "%q doit être >= 1" + +#~ msgid "address out of bounds" +#~ msgstr "adresse hors limites" + +#~ msgid "destination_length must be an int >= 0" +#~ msgstr "destination_length doit être un entier >= 0" + +#~ msgid "type object 'generator' has no attribute '__await__'" +#~ msgstr "le type 'generator' n'a pas d'attribut '__await__'" + +#~ msgid "color should be an int" +#~ msgstr "la couleur doit être un entier 'int'" + +#~ msgid "end_x should be an int" +#~ msgstr "end_x doit être un entier 'int'" + +#~ msgid "palette_index should be an int" +#~ msgstr "palette_index devrait être un entier 'int'" + +#~ msgid "start_x should be an int" +#~ msgstr "'start_x' doit être un entier 'int'" + +#~ msgid "y should be an int" +#~ msgstr "'y' doit être un entier 'int'" + +#~ msgid "" +#~ "sample_source buffer must be a bytearray or array of type 'h', 'H', 'b' " +#~ "or 'B'" +#~ msgstr "" +#~ "tampon sample_source doit être un bytearray ou une matrice de type 'h', " +#~ "'H', 'b' ou 'B'" + +#~ msgid "Expected an alarm" +#~ msgstr "Une alarme était prévue" + +#~ msgid "All I2C targets are in use" +#~ msgstr "Toutes les cibles I2C sont utilisées" + +#~ msgid "Failed to init wifi" +#~ msgstr "Echec de l'initialisation du Wifi" + +#~ msgid "input must be a tensor of rank 2" +#~ msgstr "l'entrée doit être un tenseur de rang 2" + +#~ msgid "maximum number of dimensions is 4" +#~ msgstr "nombre maximal de dimensions est 4" + +#~ msgid "Watchdog timer expired." +#~ msgstr "Le minuteur Watchdog a expiré." + +#~ msgid "ssid can't be more than 32 bytes" +#~ msgstr "un ssid ne peut pas faire plus de 32 octets" + +#~ msgid "%q must be a tuple of length 2" +#~ msgstr "%q doit être un tuple de longueur 2" + +#~ msgid "%q must be between %d and %d" +#~ msgstr "%q doit être entre %d et %d" + +#~ msgid "%q should be an int" +#~ msgstr "%q doit être un chiffre entier (int)" + +#~ msgid "(x,y) integers required" +#~ msgstr "Des entiers (x,y) requis" + +#~ msgid "Address type out of range" +#~ msgstr "Type d'adresse hors portée" + +#~ msgid "AnalogIn not supported on given pin" +#~ msgstr "'AnalogOut' n'est pas supporté sur la broche indiquée" + +#~ msgid "AnalogOut functionality not supported" +#~ msgstr "Fonctionnalité AnalogOut non supportée" + +#~ msgid "AnalogOut is only 16 bits. Value must be less than 65536." +#~ msgstr "" +#~ "AnalogOut est seulement 16 bits. Les valeurs doivent être inférieures à " +#~ "65536." + +#~ msgid "AnalogOut not supported on given pin" +#~ msgstr "'AnalogOut' n'est pas supporté sur la broche indiquée" + +#, c-format +#~ msgid "Bit depth must be from 1 to 6 inclusive, not %d" +#~ msgstr "Bit depth doit être entre 1 et 6 inclusivement, et non %d" + +#, c-format +#~ msgid "Buffer incorrect size. Should be %d bytes." +#~ msgstr "Tampon de taille incorrect. Devrait être de %d octets." + +#~ msgid "Buffer must be at least length 1" +#~ msgstr "Le tampon doit être de longueur au moins 1" + +#~ msgid "Bytes must be between 0 and 255." +#~ msgstr "Les octets 'bytes' doivent être entre 0 et 255." + +#~ msgid "Cannot output both channels on the same pin" +#~ msgstr "Les 2 canaux de sortie ne peuvent être sur la même broche" + +#~ msgid "Cannot read without MISO pin." +#~ msgstr "Impossible de lire sans broche MISO." + +#~ msgid "Cannot reset into bootloader because no bootloader is present." +#~ msgstr "" +#~ "Ne peut être redémarré vers le bootloader car il n'y a pas de bootloader." + +#~ msgid "Cannot transfer without MOSI and MISO pins." +#~ msgstr "Pas de transfert sans broches MOSI et MISO." + +#~ msgid "Cannot write without MOSI pin." +#~ msgstr "Impossible d'écrire sans broche MOSI." + +#~ msgid "Clock pin init failed." +#~ msgstr "Échec de l'initialization de la broche d'horloge." + +#~ msgid "Command must be an int between 0 and 255" +#~ msgstr "La commande doit être un chiffre entier entre 0 et 255" + +#~ msgid "Could not initialize Camera" +#~ msgstr "Impossible d'initialiser Camera" + +#~ msgid "Could not initialize GNSS" +#~ msgstr "Impossible d'initialiser GNSS" + +#~ msgid "Could not initialize SDCard" +#~ msgstr "Impossible d'initialiser la carte SD" + +#~ msgid "Could not initialize UART" +#~ msgstr "Impossible d'initialiser UART" + +#~ msgid "Could not re-init channel" +#~ msgstr "Impossible de réinitialiser le canal" + +#~ msgid "Could not re-init timer" +#~ msgstr "Impossible de réinitialiser le minuteur" + +#~ msgid "Could not restart PWM" +#~ msgstr "Impossible de redémarrer PWM" + +#~ msgid "Couldn't allocate first buffer" +#~ msgstr "Impossible d'allouer le premier tampon" + +#~ msgid "Couldn't allocate input buffer" +#~ msgstr "Impossible d'allouer le tampon d'entrée" + +#~ msgid "Couldn't allocate second buffer" +#~ msgstr "Impossible d'allouer le deuxième tampon" + +#~ msgid "DigitalInOut not supported on given pin" +#~ msgstr "DigitalInOut non pris en charge sur la broche donnée" + +#, c-format +#~ msgid "Expected tuple of length %d, got %d" +#~ msgstr "Tuple de longueur %d attendu, obtenu %d" + +#~ msgid "Failed to allocate RX buffer" +#~ msgstr "Echec de l'allocation du tampon RX" + +#, c-format +#~ msgid "Failed to allocate RX buffer of %d bytes" +#~ msgstr "Echec de l'allocation de %d octets du tampon RX" + +#, c-format +#~ msgid "Framebuffer requires %d bytes" +#~ msgstr "FrameBuffer nécessite %d octets" + +#~ msgid "Hostname must be between 1 and 253 characters" +#~ msgstr "Hostname doit être entre 1 et 253 caractères" + +#~ msgid "I2C Init Error" +#~ msgstr "Erreur d'initialisation I2C" + +#~ msgid "Invalid %q pin selection" +#~ msgstr "Sélection de broche %q invalide" + +#~ msgid "Invalid AuthMode" +#~ msgstr "AuthMode invalide" + +#~ msgid "Invalid BMP file" +#~ msgstr "Fichier BMP invalide" + +#~ msgid "Invalid DAC pin supplied" +#~ msgstr "Broche DAC non valide fournie" + +#~ msgid "Invalid MIDI file" +#~ msgstr "Fichier MIDI invalide" + +#~ msgid "Invalid PWM frequency" +#~ msgstr "Fréquence de PWM invalide" + +#~ msgid "Invalid Pin" +#~ msgstr "Broche invalide" + +#~ msgid "Invalid buffer size" +#~ msgstr "Longueur de tampon invalide" + +#~ msgid "Invalid byteorder string" +#~ msgstr "Chaîne byteorder non valide" + +#~ msgid "Invalid capture period. Valid range: 1 - 500" +#~ msgstr "Période de capture invalide. Portée valide : 1 à 500" + +#~ msgid "Invalid channel count" +#~ msgstr "Nombre de canaux invalide" + +#, c-format +#~ msgid "Invalid data_count %d" +#~ msgstr "data_count invalide %d" + +#~ msgid "Invalid direction." +#~ msgstr "Direction invalide." + +#~ msgid "Invalid file" +#~ msgstr "Fichier invalide" + +#~ msgid "Invalid number of bits" +#~ msgstr "Nombre de bits invalide" + +#~ msgid "Invalid phase" +#~ msgstr "Phase invalide" + +#~ msgid "Invalid pin" +#~ msgstr "Broche invalide" + +#~ msgid "Invalid pin for left channel" +#~ msgstr "Broche invalide pour le canal gauche" + +#~ msgid "Invalid pin for right channel" +#~ msgstr "Broche invalide pour le canal droit" + +#~ msgid "Invalid polarity" +#~ msgstr "Polarité invalide" + +#~ msgid "Invalid properties" +#~ msgstr "Propriétés invalides" + +#~ msgid "Invalid run mode." +#~ msgstr "Mode de lancement invalide." + +#~ msgid "Invalid security_mode" +#~ msgstr "'security_mode' invalide" + +#~ msgid "Invalid voice" +#~ msgstr "Voix invalide" + +#~ msgid "Invalid voice count" +#~ msgstr "Nombre de voix invalide" + +#~ msgid "Invalid wave file" +#~ msgstr "Fichier WAVE invalide" + +#~ msgid "Invalid word/bit length" +#~ msgstr "Longueur de mot / bit invalide" + +#~ msgid "Layer already in a group." +#~ msgstr "Couche déjà dans un groupe." + +#~ msgid "Layer must be a Group or TileGrid subclass." +#~ msgstr "'Layer' doit être un 'Group' ou une sous-classe 'TileGrid'." + +#~ msgid "MISO pin init failed." +#~ msgstr "Échec de l'initialization de la broche MISO." + +#~ msgid "MOSI pin init failed." +#~ msgstr "Échec de l'initialization de la broche MOSI." + +#~ msgid "Messages limited to 8 bytes" +#~ msgstr "Messages limités à 8 octets" + +#, c-format +#~ msgid "More than %d report ids not supported" +#~ msgstr "Plus de %d identifiants de rapport ne sont pas supportés" + +#~ msgid "No hardware support on clk pin" +#~ msgstr "Pas de support matériel sur la broche clk" + +#~ msgid "No hardware support on pin" +#~ msgstr "Pas de support matériel pour cette broche" + +#, c-format +#~ msgid "Output buffer must be at least %d bytes" +#~ msgstr "Tampon de sortie doit être au moins %d octets" + +#~ msgid "" +#~ "PWM duty_cycle must be between 0 and 65535 inclusive (16 bit resolution)" +#~ msgstr "" +#~ "La valeur de duty_cycle de PWM doit être entre 0 et 65535 inclusivement " +#~ "(résolution de 16 bits)" + +#~ msgid "Pin count must be at least 1" +#~ msgstr "Nombre de broches doit être au moins 1" + +#~ msgid "Pin does not have ADC capabilities" +#~ msgstr "La broche 'pin' ne supporte pas les capacitées ADC" + +#~ msgid "Program must contain at least one 16-bit instruction." +#~ msgstr "Le programme doit contenir au moins une instruction de 16 bits." + +#~ msgid "Program too large" +#~ msgstr "Programme trop grand" + +#~ msgid "RS485 Not yet supported on this device" +#~ msgstr "RS485 n'est pas encore supporté sur cet appareil" + +#~ msgid "RTC calibration is not supported on this board" +#~ msgstr "La calibration du RTC non supportée sur cette carte" + +#~ msgid "RTS/CTS/RS485 Not yet supported on this device" +#~ msgstr "RTS / CTS / RS485 Pas encore supporté sur cet appareil" + +#~ msgid "SPI Init Error" +#~ msgstr "Erreur d'initialisation SPI" + +#~ msgid "SPI Re-initialization error" +#~ msgstr "Erreur de réinitialisation SPI" + +#~ msgid "Sample rate must be positive" +#~ msgstr "Le taux d'échantillonage doit être positif" + +#, c-format +#~ msgid "Sample rate too high. It must be less than %d" +#~ msgstr "Taux d'échantillonage trop élevé. Doit être inférieur à %d" + +#~ msgid "Set pin count must be between 1 and 5" +#~ msgstr "Nombre de broches configurées doit être entre 1 et 5" + +#~ msgid "Side set pin count must be between 1 and 5" +#~ msgstr "Nombre de broches Side configurées doit être entre 1 et 5" + +#~ msgid "Stack size must be at least 256" +#~ msgstr "La pile doit être au moins de 256" + +#~ msgid "Tile value out of bounds" +#~ msgstr "Valeur de tuile hors limites" + +#~ msgid "UART Buffer allocation error" +#~ msgstr "Erreur d'allocation de tampon UART" + +#~ msgid "UART De-init error" +#~ msgstr "Erreur de désactivation UART" + +#~ msgid "UART Init Error" +#~ msgstr "Erreur d'initialisation UART" + +#~ msgid "UART Re-init error" +#~ msgstr "Erreur de réinitialisation UART" + +#~ msgid "UART write error" +#~ msgstr "Erreur d'écriture UART" + +#~ msgid "Unsupported baudrate" +#~ msgstr "Débit en bauds non supporté" + +#~ msgid "WiFi password must be between 8 and 63 characters" +#~ msgstr "Le mot de passe WiFi doit faire entre 8 et 63 caractères" + +#~ msgid "bits must be in range 5 to 9" +#~ msgstr "les bits doivent être compris entre 5 et 9" + +#~ msgid "bytes > 8 bits not supported" +#~ msgstr "octets > 8 bits non supporté" + +#~ msgid "calibration value out of range +/-127" +#~ msgstr "valeur de étalonnage hors bornes +/-127" + +#~ msgid "circle can only be registered in one parent" +#~ msgstr "le cercle ne peut être enregistré que dans un seul parent" + +#~ msgid "max_length must be >= 0" +#~ msgstr "max_length doit être >= 0" + +#~ msgid "polygon can only be registered in one parent" +#~ msgstr "le polygone ne peut être enregistré que dans un parent" + +#~ msgid "pull_threshold must be between 1 and 32" +#~ msgstr "pull_threshold doit être entre 1 et 32" + +#~ msgid "push_threshold must be between 1 and 32" +#~ msgstr "push_threshold doit être entre 1 et 32" + +#~ msgid "stop must be 1 or 2" +#~ msgstr "stop doit être 1 ou 2" + +#~ msgid "tile must be greater than zero" +#~ msgstr "tile doit être plus que zéro" + +#~ msgid "timeout must be >= 0.0" +#~ msgstr "'timeout' doit être >= 0.0" + +#, c-format +#~ msgid "width must be from 2 to 8 (inclusive), not %d" +#~ msgstr "width doit être entre 2 et 8 (inclusivement), non %d" + #~ msgid "Unsupported operation" #~ msgstr "Opération non supportée" @@ -5068,12 +5176,6 @@ msgstr "zi doit être de forme (n_section, 2)" #~ msgid "can only save bytecode" #~ msgstr "ne peut sauvegarder que du bytecode" -#~ msgid "invalid cert" -#~ msgstr "certificat invalide" - -#~ msgid "invalid key" -#~ msgstr "clé invalide" - #~ msgid "Viper functions don't currently support more than 4 arguments" #~ msgstr "" #~ "les fonctions de Viper ne supportent pas plus de 4 arguments actuellement" @@ -5290,9 +5392,6 @@ msgstr "zi doit être de forme (n_section, 2)" #~ msgid "wrong argument type" #~ msgstr "type d'argument incorrect" -#~ msgid "wrong index type" -#~ msgstr "type d'index incorrect" - #~ msgid "Must provide SCK pin" #~ msgstr "Vous devez fournir un code PIN SCK" diff --git a/locale/hi.po b/locale/hi.po index 5f18b16a23..82915d1a7a 100644 --- a/locale/hi.po +++ b/locale/hi.po @@ -60,16 +60,38 @@ msgstr "" msgid "%%c requires int or char" msgstr "" +#: main.c +#, c-format +msgid "%02X" +msgstr "" + #: shared-bindings/rgbmatrix/RGBMatrix.c #, c-format msgid "" "%d address pins, %d rgb pins and %d tiles indicate a height of %d, not %d" msgstr "" +#: ports/atmel-samd/common-hal/alarm/__init__.c +#: ports/cxd56/common-hal/analogio/AnalogOut.c ports/cxd56/common-hal/rtc/RTC.c +#: ports/espressif/common-hal/rtc/RTC.c +#: ports/mimxrt10xx/common-hal/analogio/AnalogOut.c +#: ports/mimxrt10xx/common-hal/rtc/RTC.c ports/nrf/common-hal/alarm/__init__.c +#: ports/nrf/common-hal/analogio/AnalogOut.c ports/nrf/common-hal/rtc/RTC.c +#: ports/raspberrypi/common-hal/alarm/__init__.c +#: ports/raspberrypi/common-hal/analogio/AnalogOut.c +#: ports/raspberrypi/common-hal/rtc/RTC.c ports/stm/common-hal/alarm/__init__.c +#: ports/stm/common-hal/rtc/RTC.c +msgid "%q" +msgstr "" + #: shared-bindings/microcontroller/Pin.c msgid "%q and %q contain duplicate pins" msgstr "" +#: ports/atmel-samd/common-hal/audioio/AudioOut.c +msgid "%q and %q must be different" +msgstr "" + #: shared-bindings/microcontroller/Pin.c msgid "%q contains duplicate pins" msgstr "" @@ -78,16 +100,12 @@ msgstr "" msgid "%q failure: %d" msgstr "" +#: shared-bindings/digitalio/DigitalInOut.c #: shared-bindings/microcontroller/Pin.c msgid "%q in use" msgstr "" -#: ports/atmel-samd/common-hal/pulseio/PulseIn.c -#: ports/cxd56/common-hal/pulseio/PulseIn.c -#: ports/nrf/common-hal/pulseio/PulseIn.c -#: ports/raspberrypi/common-hal/pulseio/PulseIn.c -#: ports/stm/common-hal/pulseio/PulseIn.c py/obj.c py/objstr.c -#: py/objstrunicode.c +#: py/obj.c py/objstr.c py/objstrunicode.c msgid "%q index out of range" msgstr "" @@ -95,14 +113,34 @@ msgstr "" msgid "%q indices must be integers, not %s" msgstr "" +#: shared-module/bitbangio/SPI.c +msgid "%q init failed" +msgstr "" + +#: py/argcheck.c +msgid "%q length must be %d" +msgstr "" + #: py/argcheck.c msgid "%q length must be %d-%d" msgstr "" -#: shared-bindings/busio/I2C.c shared-bindings/usb_hid/Device.c +#: py/argcheck.c +msgid "%q length must be <= %d" +msgstr "" + +#: py/argcheck.c +msgid "%q length must be >= %d" +msgstr "" + +#: shared-bindings/busio/I2C.c msgid "%q length must be >= 1" msgstr "" +#: py/argcheck.c +msgid "%q must be %d" +msgstr "" + #: py/argcheck.c msgid "%q must be %d-%d" msgstr "" @@ -119,29 +157,17 @@ msgstr "" msgid "%q must be >= %d" msgstr "" -#: py/argcheck.c shared-bindings/memorymonitor/AllocationAlarm.c -msgid "%q must be >= 0" -msgstr "" - -#: shared-bindings/_bleio/CharacteristicBuffer.c -#: shared-bindings/_bleio/PacketBuffer.c shared-bindings/displayio/Group.c -#: shared-bindings/displayio/Shape.c -#: shared-bindings/memorymonitor/AllocationAlarm.c -#: shared-bindings/vectorio/Circle.c shared-bindings/vectorio/Rectangle.c -msgid "%q must be >= 1" +#: shared-bindings/analogbufio/BufferedIn.c +#: shared-bindings/audiocore/RawSample.c +msgid "%q must be a bytearray or array of type 'h', 'H', 'b', or 'B'" msgstr "" #: py/argcheck.c msgid "%q must be a string" msgstr "" -#: shared-module/vectorio/Polygon.c -msgid "%q must be a tuple of length 2" -msgstr "" - -#: ports/espressif/common-hal/imagecapture/ParallelImageCapture.c -#: shared-module/vectorio/VectorShape.c -msgid "%q must be between %d and %d" +#: py/argcheck.c +msgid "%q must be an int" msgstr "" #: py/argcheck.c @@ -160,7 +186,11 @@ msgstr "" msgid "%q out of bounds" msgstr "" +#: ports/atmel-samd/common-hal/pulseio/PulseIn.c +#: ports/cxd56/common-hal/pulseio/PulseIn.c +#: ports/nrf/common-hal/pulseio/PulseIn.c #: ports/raspberrypi/common-hal/rp2pio/StateMachine.c +#: ports/stm/common-hal/pulseio/PulseIn.c py/argcheck.c #: shared-bindings/canio/Match.c msgid "%q out of range" msgstr "" @@ -169,10 +199,6 @@ msgstr "" msgid "%q pin invalid" msgstr "" -#: shared-bindings/fontio/BuiltinFont.c -msgid "%q should be an int" -msgstr "" - #: shared-bindings/usb_hid/Device.c msgid "%q with a report ID of 0 must be of length 1" msgstr "" @@ -185,7 +211,11 @@ msgstr "" msgid "%q, %q, and %q must all be the same length" msgstr "" -#: ports/espressif/bindings/espidf/__init__.c ports/espressif/esp_error.c +#: py/objint.c +msgid "%q=%q" +msgstr "" + +#: ports/espressif/common-hal/espidf/__init__.c ports/espressif/esp_error.c #, c-format msgid "%s error 0x%x" msgstr "" @@ -270,7 +300,7 @@ msgstr "" msgid "'%s' object doesn't support item deletion" msgstr "" -#: py/runtime.c +#: ports/raspberrypi/common-hal/wifi/Radio.c py/runtime.c msgid "'%s' object has no attribute '%q'" msgstr "" @@ -335,10 +365,6 @@ msgstr "" msgid "'yield' outside function" msgstr "" -#: shared-module/vectorio/VectorShape.c -msgid "(x,y) integers required" -msgstr "" - #: py/compile.c msgid "*x must be assignment target" msgstr "" @@ -374,16 +400,12 @@ msgstr "" msgid "Address must be %d bytes long" msgstr "" -#: shared-bindings/_bleio/Address.c -msgid "Address type out of range" -msgstr "" - #: ports/espressif/common-hal/canio/CAN.c msgid "All CAN peripherals are in use" msgstr "" #: ports/espressif/common-hal/busio/I2C.c -#: ports/espressif/common-hal/i2cperipheral/I2CPeripheral.c +#: ports/espressif/common-hal/i2ctarget/I2CTarget.c #: ports/nrf/common-hal/busio/I2C.c msgid "All I2C peripherals are in use" msgstr "" @@ -420,7 +442,6 @@ msgstr "" msgid "All event channels in use" msgstr "" -#: ports/raspberrypi/common-hal/pulseio/PulseIn.c #: ports/raspberrypi/common-hal/rp2pio/StateMachine.c msgid "All state machines in use" msgstr "" @@ -465,28 +486,10 @@ msgid "Already running" msgstr "" #: ports/espressif/common-hal/wifi/Radio.c +#: ports/raspberrypi/common-hal/wifi/Radio.c msgid "Already scanning for wifi networks" msgstr "" -#: ports/cxd56/common-hal/analogio/AnalogIn.c -msgid "AnalogIn not supported on given pin" -msgstr "" - -#: ports/cxd56/common-hal/analogio/AnalogOut.c -#: ports/mimxrt10xx/common-hal/analogio/AnalogOut.c -#: ports/nrf/common-hal/analogio/AnalogOut.c -#: ports/raspberrypi/common-hal/analogio/AnalogOut.c -msgid "AnalogOut functionality not supported" -msgstr "" - -#: shared-bindings/analogio/AnalogOut.c -msgid "AnalogOut is only 16 bits. Value must be less than 65536." -msgstr "" - -#: ports/atmel-samd/common-hal/analogio/AnalogOut.c -msgid "AnalogOut not supported on given pin" -msgstr "" - #: ports/stm/common-hal/audiopwmio/PWMAudioOut.c msgid "Another PWMAudioOut is already active" msgstr "" @@ -525,7 +528,7 @@ msgstr "" msgid "AuthMode.OPEN is not used with password" msgstr "" -#: shared-bindings/wifi/Radio.c +#: shared-bindings/wifi/Radio.c supervisor/shared/web_workflow/web_workflow.c msgid "Authentication failure" msgstr "" @@ -556,11 +559,6 @@ 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 "" @@ -602,11 +600,6 @@ msgstr "" msgid "Buffer elements must be 4 bytes long or less" msgstr "" -#: shared-module/usb_hid/Device.c -#, c-format -msgid "Buffer incorrect size. Should be %d bytes." -msgstr "" - #: shared-bindings/framebufferio/FramebufferDisplay.c msgid "Buffer is not a bytearray." msgstr "" @@ -616,7 +609,6 @@ msgstr "" msgid "Buffer is too small" msgstr "" -#: ports/nrf/common-hal/audiopwmio/PWMAudioOut.c #: ports/stm/common-hal/audiopwmio/PWMAudioOut.c #, c-format msgid "Buffer length %d too big. It must be less than %d" @@ -631,10 +623,6 @@ msgstr "" msgid "Buffer must be a multiple of 512 bytes" msgstr "" -#: shared-bindings/bitbangio/I2C.c -msgid "Buffer must be at least length 1" -msgstr "" - #: shared-bindings/_bleio/PacketBuffer.c #, c-format msgid "Buffer too short by %d bytes" @@ -656,10 +644,6 @@ msgstr "" msgid "Byte buffer must be 16 bytes." msgstr "" -#: shared-bindings/alarm/SleepMemory.c shared-bindings/nvm/ByteArray.c -msgid "Bytes must be between 0 and 255." -msgstr "" - #: shared-bindings/aesio/aes.c msgid "CBC blocks must be multiples of 16 bytes" msgstr "" @@ -668,7 +652,7 @@ msgstr "" msgid "CIRCUITPY drive could not be found or created." msgstr "" -#: ports/espressif/bindings/espidf/__init__.c ports/espressif/esp_error.c +#: ports/espressif/common-hal/espidf/__init__.c ports/espressif/esp_error.c msgid "CRC or checksum was invalid" msgstr "" @@ -676,6 +660,10 @@ msgstr "" msgid "Call super().__init__() before accessing native object." msgstr "" +#: ports/cxd56/common-hal/camera/Camera.c +msgid "Camera init" +msgstr "" + #: ports/espressif/common-hal/alarm/pin/PinAlarm.c msgid "Can only alarm on RTC IO from deep sleep." msgstr "" @@ -723,18 +711,10 @@ msgstr "" msgid "Cannot have scan responses for extended, connectable advertisements." msgstr "" -#: ports/atmel-samd/common-hal/audioio/AudioOut.c -msgid "Cannot output both channels on the same pin" -msgstr "" - #: ports/espressif/common-hal/alarm/pin/PinAlarm.c msgid "Cannot pull on input-only pin." msgstr "" -#: shared-module/bitbangio/SPI.c -msgid "Cannot read without MISO pin." -msgstr "" - #: shared-bindings/audiobusio/PDMIn.c msgid "Cannot record to a file" msgstr "" @@ -746,7 +726,7 @@ msgstr "" #: ports/atmel-samd/common-hal/microcontroller/__init__.c #: ports/cxd56/common-hal/microcontroller/__init__.c #: ports/mimxrt10xx/common-hal/microcontroller/__init__.c -msgid "Cannot reset into bootloader because no bootloader is present." +msgid "Cannot reset into bootloader because no bootloader is present" msgstr "" #: ports/espressif/common-hal/socketpool/Socket.c @@ -767,20 +747,19 @@ msgid "Cannot subclass slice" msgstr "" #: shared-module/bitbangio/SPI.c -msgid "Cannot transfer without MOSI and MISO pins." +msgid "Cannot transfer without MOSI and MISO pins" msgstr "" #: shared-bindings/pwmio/PWMOut.c msgid "Cannot vary frequency on a timer that is already in use" msgstr "" -#: ports/espressif/common-hal/alarm/pin/PinAlarm.c #: ports/nrf/common-hal/alarm/pin/PinAlarm.c -msgid "Cannot wake on pin edge. Only level." +msgid "Cannot wake on pin edge, only level" msgstr "" -#: shared-module/bitbangio/SPI.c -msgid "Cannot write without MOSI pin." +#: ports/espressif/common-hal/alarm/pin/PinAlarm.c +msgid "Cannot wake on pin edge. Only level." msgstr "" #: shared-bindings/_bleio/CharacteristicBuffer.c @@ -795,10 +774,6 @@ msgstr "" msgid "CircuitPython was unable to allocate the heap." msgstr "" -#: shared-module/bitbangio/SPI.c -msgid "Clock pin init failed." -msgstr "" - #: shared-module/bitbangio/I2C.c msgid "Clock stretch too long" msgstr "" @@ -807,11 +782,6 @@ msgstr "" msgid "Clock unit in use" msgstr "" -#: shared-bindings/displayio/FourWire.c shared-bindings/displayio/I2CDisplay.c -#: shared-bindings/paralleldisplay/ParallelBus.c -msgid "Command must be an int between 0 and 255" -msgstr "" - #: shared-bindings/_bleio/Connection.c msgid "" "Connection has been disconnected and can no longer be used. Create a new " @@ -822,35 +792,6 @@ msgstr "" msgid "Corrupt .mpy file" msgstr "" -#: ports/cxd56/common-hal/camera/Camera.c -msgid "Could not initialize Camera" -msgstr "" - -#: ports/cxd56/common-hal/gnss/GNSS.c -msgid "Could not initialize GNSS" -msgstr "" - -#: ports/cxd56/common-hal/sdioio/SDCard.c -msgid "Could not initialize SDCard" -msgstr "" - -#: ports/atmel-samd/common-hal/busio/UART.c ports/cxd56/common-hal/busio/UART.c -#: ports/espressif/common-hal/busio/UART.c -msgid "Could not initialize UART" -msgstr "" - -#: ports/stm/common-hal/pwmio/PWMOut.c -msgid "Could not re-init channel" -msgstr "" - -#: ports/stm/common-hal/pwmio/PWMOut.c -msgid "Could not re-init timer" -msgstr "" - -#: ports/stm/common-hal/pwmio/PWMOut.c -msgid "Could not restart PWM" -msgstr "" - #: ports/espressif/common-hal/neopixel_write/__init__.c msgid "Could not retrieve clock" msgstr "" @@ -871,20 +812,6 @@ msgstr "" msgid "Couldn't allocate decoder" msgstr "" -#: shared-module/audiocore/WaveFile.c shared-module/audiomixer/Mixer.c -#: shared-module/audiomp3/MP3Decoder.c -msgid "Couldn't allocate first buffer" -msgstr "" - -#: shared-module/audiomp3/MP3Decoder.c -msgid "Couldn't allocate input buffer" -msgstr "" - -#: shared-module/audiocore/WaveFile.c shared-module/audiomixer/Mixer.c -#: shared-module/audiomp3/MP3Decoder.c -msgid "Couldn't allocate second buffer" -msgstr "" - #: supervisor/shared/safe_mode.c msgid "Crash into the HardFault_Handler." msgstr "" @@ -932,10 +859,6 @@ msgstr "" msgid "Device in use" msgstr "" -#: ports/cxd56/common-hal/digitalio/DigitalInOut.c -msgid "DigitalInOut not supported on given pin" -msgstr "" - #: shared-bindings/displayio/Display.c #: shared-bindings/framebufferio/FramebufferDisplay.c msgid "Display must have a 16 bit colorspace." @@ -947,6 +870,10 @@ msgstr "" msgid "Display rotation must be in 90 degree increments" msgstr "" +#: main.c +msgid "Done" +msgstr "" + #: shared-bindings/digitalio/DigitalInOut.c msgid "Drive mode not used when direction is input." msgstr "" @@ -980,20 +907,19 @@ msgstr "" msgid "Error: Failure to bind" msgstr "" -#: ports/raspberrypi/bindings/rp2pio/StateMachine.c py/enum.c -#: shared-bindings/_bleio/__init__.c shared-bindings/aesio/aes.c -#: shared-bindings/busio/SPI.c shared-bindings/microcontroller/Pin.c +#: py/enum.c shared-bindings/_bleio/__init__.c shared-bindings/aesio/aes.c +#: shared-bindings/alarm/__init__.c shared-bindings/busio/SPI.c +#: shared-bindings/microcontroller/Pin.c #: shared-bindings/neopixel_write/__init__.c msgid "Expected a %q" msgstr "" -#: shared-bindings/alarm/__init__.c -msgid "Expected an alarm" +#: ports/raspberrypi/bindings/cyw43/__init__.c +msgid "Expected a %q or %q" msgstr "" -#: shared-module/adafruit_pixelbuf/PixelBuf.c -#, c-format -msgid "Expected tuple of length %d, got %d" +#: shared-bindings/alarm/__init__.c +msgid "Expected an %q" msgstr "" #: ports/espressif/common-hal/_bleio/Adapter.c @@ -1022,20 +948,8 @@ msgstr "" msgid "Failed to acquire mutex, err 0x%04x" msgstr "" -#: ports/mimxrt10xx/common-hal/busio/UART.c ports/nrf/common-hal/busio/UART.c -#: ports/raspberrypi/common-hal/busio/UART.c -msgid "Failed to allocate RX buffer" -msgstr "" - -#: ports/atmel-samd/common-hal/busio/UART.c -#: ports/atmel-samd/common-hal/pulseio/PulseIn.c -#: ports/cxd56/common-hal/pulseio/PulseIn.c -#: ports/espressif/common-hal/pulseio/PulseIn.c -#: ports/nrf/common-hal/pulseio/PulseIn.c -#: ports/raspberrypi/common-hal/pulseio/PulseIn.c -#: ports/stm/common-hal/pulseio/PulseIn.c -#, c-format -msgid "Failed to allocate RX buffer of %d bytes" +#: shared-module/rgbmatrix/RGBMatrix.c +msgid "Failed to allocate %q buffer" msgstr "" #: ports/espressif/common-hal/wifi/__init__.c @@ -1059,10 +973,6 @@ msgstr "" msgid "Failed to connect: timeout" msgstr "" -#: ports/espressif/common-hal/wifi/__init__.c -msgid "Failed to init wifi" -msgstr "" - #: shared-module/audiomp3/MP3Decoder.c msgid "Failed to parse MP3 file" msgstr "" @@ -1106,11 +1016,6 @@ msgstr "" msgid "Format not supported" msgstr "" -#: shared-module/framebufferio/FramebufferDisplay.c -#, c-format -msgid "Framebuffer requires %d bytes" -msgstr "" - #: ports/mimxrt10xx/common-hal/microcontroller/Processor.c msgid "" "Frequency must be 24, 150, 396, 450, 528, 600, 720, 816, 912, 960 or 1008 Mhz" @@ -1125,7 +1030,11 @@ msgstr "" msgid "Function requires lock" msgstr "" -#: ports/espressif/bindings/espidf/__init__.c ports/espressif/esp_error.c +#: ports/cxd56/common-hal/gnss/GNSS.c +msgid "GNSS init" +msgstr "" + +#: ports/espressif/common-hal/espidf/__init__.c ports/espressif/esp_error.c msgid "Generic Failure" msgstr "" @@ -1152,19 +1061,16 @@ msgstr "" msgid "Hardware in use, try alternative pins" msgstr "" -#: shared-bindings/wifi/Radio.c -msgid "Hostname must be between 1 and 253 characters" -msgstr "" - #: extmod/vfs_posix_file.c py/objstringio.c msgid "I/O operation on closed file" msgstr "" #: ports/stm/common-hal/busio/I2C.c -msgid "I2C Init Error" +msgid "I2C init error" msgstr "" #: ports/raspberrypi/common-hal/busio/I2C.c +#: ports/raspberrypi/common-hal/i2ctarget/I2CTarget.c msgid "I2C peripheral in use" msgstr "" @@ -1269,75 +1175,37 @@ msgstr "" msgid "Internal error #%d" msgstr "" -#: shared-bindings/sdioio/SDCard.c shared-module/usb_hid/Device.c +#: supervisor/shared/safe_mode.c +msgid "Internal watchdog timer expired." +msgstr "" + +#: py/argcheck.c shared-bindings/digitalio/DigitalInOut.c msgid "Invalid %q" msgstr "" -#: ports/atmel-samd/common-hal/audiobusio/I2SOut.c -#: ports/atmel-samd/common-hal/audiobusio/PDMIn.c -#: ports/atmel-samd/common-hal/imagecapture/ParallelImageCapture.c -#: ports/mimxrt10xx/common-hal/busio/UART.c +#: shared-bindings/microcontroller/Pin.c msgid "Invalid %q pin" msgstr "" -#: ports/stm/common-hal/busio/I2C.c ports/stm/common-hal/busio/SPI.c -#: ports/stm/common-hal/busio/UART.c ports/stm/common-hal/canio/CAN.c -#: ports/stm/common-hal/sdioio/SDCard.c -msgid "Invalid %q pin selection" -msgstr "" - #: ports/stm/common-hal/analogio/AnalogIn.c msgid "Invalid ADC Unit value" msgstr "" -#: ports/espressif/common-hal/wifi/Radio.c -msgid "Invalid AuthMode" -msgstr "" - #: ports/espressif/common-hal/_bleio/__init__.c #: ports/nrf/common-hal/_bleio/__init__.c msgid "Invalid BLE parameter" msgstr "" -#: shared-module/displayio/OnDiskBitmap.c -msgid "Invalid BMP file" -msgstr "" - #: shared-bindings/wifi/Radio.c msgid "Invalid BSSID" msgstr "" -#: ports/espressif/common-hal/analogio/AnalogOut.c -#: ports/stm/common-hal/analogio/AnalogOut.c -msgid "Invalid DAC pin supplied" -msgstr "" - #: shared-bindings/wifi/Radio.c msgid "Invalid MAC address" msgstr "" -#: shared-bindings/synthio/__init__.c -msgid "Invalid MIDI file" -msgstr "" - -#: ports/atmel-samd/common-hal/pwmio/PWMOut.c -#: ports/cxd56/common-hal/pwmio/PWMOut.c -#: ports/espressif/common-hal/pwmio/PWMOut.c -#: ports/mimxrt10xx/common-hal/pwmio/PWMOut.c -#: ports/nrf/common-hal/pwmio/PWMOut.c -#: ports/raspberrypi/common-hal/pwmio/PWMOut.c shared-bindings/pwmio/PWMOut.c -msgid "Invalid PWM frequency" -msgstr "" - -#: ports/espressif/common-hal/analogio/AnalogIn.c -msgid "Invalid Pin" -msgstr "" - -#: ports/espressif/bindings/espidf/__init__.c -#: ports/espressif/common-hal/busio/I2C.c -#: ports/espressif/common-hal/i2cperipheral/I2CPeripheral.c -#: ports/espressif/esp_error.c py/moduerrno.c -#: shared-module/rgbmatrix/RGBMatrix.c +#: ports/espressif/common-hal/espidf/__init__.c ports/espressif/esp_error.c +#: py/moduerrno.c msgid "Invalid argument" msgstr "" @@ -1345,42 +1213,11 @@ msgstr "" msgid "Invalid bits per value" msgstr "" -#: ports/nrf/common-hal/busio/UART.c ports/raspberrypi/common-hal/busio/UART.c -#: ports/stm/common-hal/busio/UART.c -msgid "Invalid buffer size" -msgstr "" - -#: shared-bindings/adafruit_pixelbuf/PixelBuf.c -msgid "Invalid byteorder string" -msgstr "" - -#: ports/atmel-samd/common-hal/frequencyio/FrequencyIn.c -#: ports/espressif/common-hal/frequencyio/FrequencyIn.c -msgid "Invalid capture period. Valid range: 1 - 500" -msgstr "" - -#: shared-bindings/audiomixer/Mixer.c -msgid "Invalid channel count" -msgstr "" - -#: ports/atmel-samd/common-hal/imagecapture/ParallelImageCapture.c -#, c-format -msgid "Invalid data_count %d" -msgstr "" - #: ports/atmel-samd/common-hal/imagecapture/ParallelImageCapture.c #, c-format msgid "Invalid data_pins[%d]" msgstr "" -#: shared-bindings/digitalio/DigitalInOut.c -msgid "Invalid direction." -msgstr "" - -#: shared-module/audiocore/WaveFile.c -msgid "Invalid file" -msgstr "" - #: shared-module/audiocore/WaveFile.c msgid "Invalid format chunk size" msgstr "" @@ -1389,107 +1226,27 @@ msgstr "" msgid "Invalid memory access." msgstr "" -#: extmod/vfs_fat_file.c -msgid "Invalid mode" -msgstr "" - #: ports/espressif/common-hal/wifi/Radio.c msgid "Invalid multicast MAC address" msgstr "" -#: shared-bindings/bitbangio/SPI.c shared-bindings/busio/SPI.c -msgid "Invalid number of bits" -msgstr "" - -#: shared-bindings/bitbangio/SPI.c shared-bindings/busio/SPI.c -#: shared-bindings/displayio/FourWire.c -msgid "Invalid phase" -msgstr "" - -#: ports/atmel-samd/common-hal/audioio/AudioOut.c -#: ports/atmel-samd/common-hal/touchio/TouchIn.c -#: ports/espressif/common-hal/alarm/touch/TouchAlarm.c -#: ports/espressif/common-hal/touchio/TouchIn.c -#: ports/nrf/common-hal/alarm/pin/PinAlarm.c shared-bindings/pwmio/PWMOut.c -#: shared-module/rgbmatrix/RGBMatrix.c -msgid "Invalid pin" -msgstr "" - -#: ports/atmel-samd/common-hal/audioio/AudioOut.c -msgid "Invalid pin for left channel" -msgstr "" - -#: ports/atmel-samd/common-hal/audioio/AudioOut.c -msgid "Invalid pin for right channel" -msgstr "" - -#: ports/atmel-samd/common-hal/busio/I2C.c -#: ports/atmel-samd/common-hal/busio/SPI.c -#: ports/atmel-samd/common-hal/busio/UART.c -#: ports/atmel-samd/common-hal/i2cperipheral/I2CPeripheral.c -#: ports/cxd56/common-hal/busio/I2C.c ports/cxd56/common-hal/busio/SPI.c -#: ports/cxd56/common-hal/busio/UART.c ports/cxd56/common-hal/sdioio/SDCard.c -#: ports/espressif/common-hal/busio/I2C.c -#: ports/espressif/common-hal/busio/SPI.c -#: ports/espressif/common-hal/busio/UART.c -#: ports/espressif/common-hal/canio/CAN.c -#: ports/espressif/common-hal/i2cperipheral/I2CPeripheral.c -#: ports/mimxrt10xx/common-hal/busio/I2C.c -#: ports/mimxrt10xx/common-hal/busio/SPI.c -#: ports/mimxrt10xx/common-hal/usb_host/Port.c ports/nrf/common-hal/busio/I2C.c -#: ports/raspberrypi/common-hal/busio/I2C.c -#: ports/raspberrypi/common-hal/busio/SPI.c -#: ports/raspberrypi/common-hal/busio/UART.c shared-bindings/busio/SPI.c #: shared-bindings/busio/UART.c msgid "Invalid pins" msgstr "" -#: shared-bindings/bitbangio/SPI.c shared-bindings/busio/SPI.c -#: shared-bindings/displayio/FourWire.c -msgid "Invalid polarity" -msgstr "" - -#: shared-bindings/_bleio/Characteristic.c -msgid "Invalid properties" -msgstr "" - -#: shared-bindings/microcontroller/__init__.c -msgid "Invalid run mode." -msgstr "" - -#: shared-module/_bleio/Attribute.c -msgid "Invalid security_mode" -msgstr "" - -#: ports/espressif/bindings/espidf/__init__.c ports/espressif/esp_error.c +#: ports/espressif/common-hal/espidf/__init__.c ports/espressif/esp_error.c msgid "Invalid size" msgstr "" #: ports/espressif/common-hal/ssl/SSLContext.c +#: ports/raspberrypi/common-hal/ssl/SSLSocket.c msgid "Invalid socket for TLS" msgstr "" -#: ports/espressif/bindings/espidf/__init__.c ports/espressif/esp_error.c +#: ports/espressif/common-hal/espidf/__init__.c ports/espressif/esp_error.c msgid "Invalid state" msgstr "" -#: shared-bindings/audiomixer/Mixer.c -msgid "Invalid voice" -msgstr "" - -#: shared-bindings/audiomixer/Mixer.c -msgid "Invalid voice count" -msgstr "" - -#: shared-module/audiocore/WaveFile.c -msgid "Invalid wave file" -msgstr "" - -#: ports/mimxrt10xx/common-hal/busio/UART.c ports/nrf/common-hal/busio/UART.c -#: ports/raspberrypi/common-hal/busio/UART.c ports/stm/common-hal/busio/UART.c -msgid "Invalid word/bit length" -msgstr "" - #: shared-bindings/aesio/aes.c msgid "Key must be 16, 24, or 32 bytes long" msgstr "" @@ -1503,25 +1260,17 @@ msgid "LHS of keyword arg must be an id" msgstr "" #: shared-module/displayio/Group.c -msgid "Layer already in a group." +msgid "Layer already in a group" msgstr "" #: shared-module/displayio/Group.c -msgid "Layer must be a Group or TileGrid subclass." +msgid "Layer must be a Group or TileGrid subclass" msgstr "" -#: ports/espressif/bindings/espidf/__init__.c ports/espressif/esp_error.c +#: ports/espressif/common-hal/espidf/__init__.c ports/espressif/esp_error.c msgid "MAC address was invalid" msgstr "" -#: shared-module/bitbangio/SPI.c -msgid "MISO pin init failed." -msgstr "" - -#: shared-module/bitbangio/SPI.c -msgid "MOSI pin init failed." -msgstr "" - #: shared-bindings/is31fl3741/IS31FL3741.c msgid "Mapping must be a tuple" msgstr "" @@ -1531,10 +1280,6 @@ msgstr "" msgid "Maximum x value when mirrored is %d" msgstr "" -#: shared-bindings/canio/Message.c -msgid "Messages limited to 8 bytes" -msgstr "" - #: shared-bindings/audiobusio/PDMIn.c msgid "Microphone startup delay must be in range 0.0 to 1.0" msgstr "" @@ -1548,10 +1293,14 @@ msgstr "" msgid "Mismatched swap flag" msgstr "" -#: ports/mimxrt10xx/common-hal/busio/SPI.c ports/stm/common-hal/busio/SPI.c +#: ports/mimxrt10xx/common-hal/busio/SPI.c msgid "Missing MISO or MOSI Pin" msgstr "" +#: ports/stm/common-hal/busio/SPI.c +msgid "Missing MISO or MOSI pin" +msgstr "" + #: ports/raspberrypi/common-hal/rp2pio/StateMachine.c #, c-format msgid "Missing first_in_pin. Instruction %d reads pin(s)" @@ -1587,11 +1336,6 @@ msgstr "" msgid "Missing jmp_pin. Instruction %d jumps on pin" msgstr "" -#: shared-module/usb_hid/Device.c -#, c-format -msgid "More than %d report ids not supported" -msgstr "" - #: shared-bindings/busio/UART.c shared-bindings/displayio/Group.c msgid "Must be a %q subclass." msgstr "" @@ -1651,16 +1395,28 @@ msgstr "" msgid "No I2C device at address: 0x%x" msgstr "" -#: ports/espressif/common-hal/busio/SPI.c -#: ports/mimxrt10xx/common-hal/busio/SPI.c ports/stm/common-hal/busio/SPI.c -msgid "No MISO Pin" +#: supervisor/shared/web_workflow/web_workflow.c +msgid "No IP" msgstr "" #: ports/espressif/common-hal/busio/SPI.c -#: ports/mimxrt10xx/common-hal/busio/SPI.c ports/stm/common-hal/busio/SPI.c +#: ports/mimxrt10xx/common-hal/busio/SPI.c +msgid "No MISO Pin" +msgstr "" + +#: ports/stm/common-hal/busio/SPI.c shared-module/bitbangio/SPI.c +msgid "No MISO pin" +msgstr "" + +#: ports/espressif/common-hal/busio/SPI.c +#: ports/mimxrt10xx/common-hal/busio/SPI.c msgid "No MOSI Pin" msgstr "" +#: ports/stm/common-hal/busio/SPI.c shared-module/bitbangio/SPI.c +msgid "No MOSI pin" +msgstr "" + #: ports/atmel-samd/common-hal/busio/UART.c #: ports/espressif/common-hal/busio/UART.c #: ports/mimxrt10xx/common-hal/busio/UART.c ports/nrf/common-hal/busio/UART.c @@ -1699,16 +1455,6 @@ msgstr "" msgid "No hardware random available" msgstr "" -#: ports/atmel-samd/common-hal/ps2io/Ps2.c -msgid "No hardware support on clk pin" -msgstr "" - -#: ports/atmel-samd/common-hal/alarm/pin/PinAlarm.c -#: ports/atmel-samd/common-hal/frequencyio/FrequencyIn.c -#: ports/atmel-samd/common-hal/pulseio/PulseIn.c -msgid "No hardware support on pin" -msgstr "" - #: ports/raspberrypi/common-hal/rp2pio/StateMachine.c msgid "No in in program" msgstr "" @@ -1806,16 +1552,26 @@ msgstr "" msgid "Odd parity is not supported" msgstr "" +#: supervisor/shared/bluetooth/bluetooth.c +msgid "Off" +msgstr "" + +#: supervisor/shared/bluetooth/bluetooth.c +msgid "Ok" +msgstr "" + #: ports/atmel-samd/common-hal/audiobusio/PDMIn.c #: ports/raspberrypi/common-hal/audiobusio/PDMIn.c msgid "Only 8 or 16 bit mono with " msgstr "" #: ports/espressif/common-hal/wifi/__init__.c +#: ports/raspberrypi/common-hal/wifi/__init__.c msgid "Only IPv4 addresses supported" msgstr "" -#: ports/espressif/common-hal/socketpool/SocketPool.c +#: ports/espressif/common-hal/socketpool/Socket.c +#: ports/raspberrypi/common-hal/socketpool/Socket.c msgid "Only IPv4 sockets supported" msgstr "" @@ -1848,15 +1604,19 @@ msgstr "" msgid "Only one TouchAlarm can be set in deep sleep." msgstr "" -#: ports/espressif/common-hal/i2cperipheral/I2CPeripheral.c +#: ports/espressif/common-hal/i2ctarget/I2CTarget.c +#: ports/raspberrypi/common-hal/i2ctarget/I2CTarget.c msgid "Only one address is allowed" msgstr "" #: ports/atmel-samd/common-hal/alarm/time/TimeAlarm.c -#: ports/espressif/common-hal/alarm/time/TimeAlarm.c #: ports/nrf/common-hal/alarm/time/TimeAlarm.c -#: ports/raspberrypi/common-hal/alarm/time/TimeAlarm.c #: ports/stm/common-hal/alarm/time/TimeAlarm.c +msgid "Only one alarm.time alarm can be set" +msgstr "" + +#: ports/espressif/common-hal/alarm/time/TimeAlarm.c +#: ports/raspberrypi/common-hal/alarm/time/TimeAlarm.c msgid "Only one alarm.time alarm can be set." msgstr "" @@ -1868,19 +1628,20 @@ msgstr "" msgid "Operation not permitted" msgstr "" -#: ports/espressif/bindings/espidf/__init__.c ports/espressif/esp_error.c +#: ports/espressif/common-hal/espidf/__init__.c ports/espressif/esp_error.c msgid "Operation or feature not supported" msgstr "" -#: ports/espressif/bindings/espidf/__init__.c ports/espressif/esp_error.c +#: ports/espressif/common-hal/espidf/__init__.c ports/espressif/esp_error.c msgid "Operation timed out" msgstr "" -#: ports/espressif/bindings/espidf/__init__.c ports/espressif/esp_error.c +#: ports/espressif/common-hal/espidf/__init__.c ports/espressif/esp_error.c msgid "Out of memory" msgstr "" -#: ports/espressif/common-hal/socketpool/SocketPool.c +#: ports/espressif/common-hal/socketpool/Socket.c +#: ports/raspberrypi/common-hal/socketpool/Socket.c msgid "Out of sockets" msgstr "" @@ -1888,11 +1649,6 @@ msgstr "" msgid "Out-buffer elements must be <= 4 bytes long" msgstr "" -#: shared-bindings/bitops/__init__.c -#, c-format -msgid "Output buffer must be at least %d bytes" -msgstr "" - #: shared-bindings/audiobusio/PDMIn.c msgid "Oversample must be multiple of 8." msgstr "" @@ -1903,12 +1659,11 @@ msgstr "" #: shared-bindings/pwmio/PWMOut.c msgid "" -"PWM duty_cycle must be between 0 and 65535 inclusive (16 bit resolution)" +"PWM frequency not writable when variable_frequency is False on construction." msgstr "" -#: shared-bindings/pwmio/PWMOut.c -msgid "" -"PWM frequency not writable when variable_frequency is False on construction." +#: ports/stm/common-hal/pwmio/PWMOut.c +msgid "PWM restart" msgstr "" #: ports/raspberrypi/common-hal/countio/Counter.c @@ -1927,36 +1682,20 @@ msgstr "" msgid "Permission denied" msgstr "" -#: ports/atmel-samd/common-hal/alarm/pin/PinAlarm.c #: ports/stm/common-hal/alarm/pin/PinAlarm.c msgid "Pin cannot wake from Deep Sleep" msgstr "" -#: ports/raspberrypi/bindings/rp2pio/StateMachine.c -msgid "Pin count must be at least 1" -msgstr "" - #: ports/raspberrypi/common-hal/rp2pio/StateMachine.c msgid "Pin count too large" msgstr "" -#: ports/atmel-samd/common-hal/analogio/AnalogIn.c -#: ports/cxd56/common-hal/analogio/AnalogIn.c -#: ports/espressif/common-hal/analogio/AnalogIn.c -#: ports/mimxrt10xx/common-hal/analogio/AnalogIn.c -#: ports/nrf/common-hal/analogio/AnalogIn.c -#: ports/raspberrypi/common-hal/analogio/AnalogIn.c -#: ports/stm/common-hal/analogio/AnalogIn.c -msgid "Pin does not have ADC capabilities" -msgstr "" - #: ports/stm/common-hal/alarm/pin/PinAlarm.c #: ports/stm/common-hal/pulseio/PulseIn.c msgid "Pin interrupt already in use" msgstr "" #: shared-bindings/adafruit_bus_device/spi_device/SPIDevice.c -#: shared-bindings/digitalio/DigitalInOut.c msgid "Pin is input only" msgstr "" @@ -2016,18 +1755,10 @@ msgstr "" msgid "Program does OUT without loading OSR" msgstr "" -#: ports/raspberrypi/bindings/rp2pio/StateMachine.c -msgid "Program must contain at least one 16-bit instruction." -msgstr "" - #: ports/raspberrypi/bindings/rp2pio/StateMachine.c msgid "Program size invalid" msgstr "" -#: ports/raspberrypi/bindings/rp2pio/StateMachine.c -msgid "Program too large" -msgstr "" - #: shared-bindings/digitalio/DigitalInOut.c msgid "Pull not used when direction is output." msgstr "" @@ -2049,8 +1780,9 @@ msgstr "" msgid "RNG Init Error" msgstr "" -#: ports/nrf/common-hal/busio/UART.c -msgid "RS485 Not yet supported on this device" +#: ports/atmel-samd/common-hal/busio/UART.c ports/cxd56/common-hal/busio/UART.c +#: ports/nrf/common-hal/busio/UART.c ports/stm/common-hal/busio/UART.c +msgid "RS485" msgstr "" #: ports/espressif/common-hal/busio/UART.c @@ -2058,21 +1790,10 @@ msgstr "" msgid "RS485 inversion specified when not in RS485 mode" msgstr "" -#: ports/cxd56/common-hal/rtc/RTC.c ports/espressif/common-hal/rtc/RTC.c -#: ports/mimxrt10xx/common-hal/rtc/RTC.c ports/nrf/common-hal/rtc/RTC.c -#: ports/raspberrypi/common-hal/rtc/RTC.c -msgid "RTC calibration is not supported on this board" -msgstr "" - #: shared-bindings/alarm/time/TimeAlarm.c shared-bindings/time/__init__.c msgid "RTC is not supported on this board" msgstr "" -#: ports/atmel-samd/common-hal/busio/UART.c ports/cxd56/common-hal/busio/UART.c -#: ports/stm/common-hal/busio/UART.c -msgid "RTS/CTS/RS485 Not yet supported on this device" -msgstr "" - #: ports/stm/common-hal/os/__init__.c msgid "Random number generation error" msgstr "" @@ -2090,10 +1811,14 @@ msgstr "" msgid "Read-only object" msgstr "" -#: ports/espressif/bindings/espidf/__init__.c ports/espressif/esp_error.c +#: ports/espressif/common-hal/espidf/__init__.c ports/espressif/esp_error.c msgid "Received response was invalid" msgstr "" +#: supervisor/shared/bluetooth/bluetooth.c +msgid "Reconnecting" +msgstr "" + #: shared-bindings/displayio/EPaperDisplay.c msgid "Refresh too soon" msgstr "" @@ -2106,7 +1831,7 @@ msgstr "" msgid "Requested AES mode is unsupported" msgstr "" -#: ports/espressif/bindings/espidf/__init__.c ports/espressif/esp_error.c +#: ports/espressif/common-hal/espidf/__init__.c ports/espressif/esp_error.c msgid "Requested resource not found" msgstr "" @@ -2122,6 +1847,10 @@ msgstr "" msgid "SD card CSD format not supported" msgstr "" +#: ports/cxd56/common-hal/sdioio/SDCard.c +msgid "SDCard init" +msgstr "" + #: ports/stm/common-hal/sdioio/SDCard.c #, c-format msgid "SDIO GetCardInfo Error %d" @@ -2132,29 +1861,20 @@ msgstr "" msgid "SDIO Init Error %d" msgstr "" -#: ports/stm/common-hal/busio/SPI.c -msgid "SPI Init Error" -msgstr "" - -#: ports/stm/common-hal/busio/SPI.c -msgid "SPI Re-initialization error" -msgstr "" - #: ports/espressif/common-hal/busio/SPI.c msgid "SPI configuration failed" msgstr "" +#: ports/stm/common-hal/busio/SPI.c +msgid "SPI init error" +msgstr "" + #: ports/raspberrypi/common-hal/busio/SPI.c msgid "SPI peripheral in use" msgstr "" -#: shared-bindings/audiomixer/Mixer.c -msgid "Sample rate must be positive" -msgstr "" - -#: ports/atmel-samd/common-hal/audioio/AudioOut.c -#, c-format -msgid "Sample rate too high. It must be less than %d" +#: ports/stm/common-hal/busio/SPI.c +msgid "SPI re-init" msgstr "" #: shared-bindings/is31fl3741/FrameBuffer.c @@ -2175,14 +1895,6 @@ msgstr "" msgid "Server side context cannot have hostname" msgstr "" -#: ports/raspberrypi/bindings/rp2pio/StateMachine.c -msgid "Set pin count must be between 1 and 5" -msgstr "" - -#: ports/raspberrypi/bindings/rp2pio/StateMachine.c -msgid "Side set pin count must be between 1 and 5" -msgstr "" - #: ports/cxd56/common-hal/camera/Camera.c msgid "Size not supported" msgstr "" @@ -2203,6 +1915,7 @@ msgid "Slices not supported" msgstr "" #: ports/espressif/common-hal/socketpool/SocketPool.c +#: ports/raspberrypi/common-hal/socketpool/SocketPool.c msgid "SocketPool can only be used with wifi.radio" msgstr "" @@ -2218,10 +1931,6 @@ msgstr "" msgid "Splitting with sub-captures" msgstr "" -#: shared-bindings/supervisor/__init__.c -msgid "Stack size must be at least 256" -msgstr "" - #: ports/raspberrypi/common-hal/audiopwmio/PWMAudioOut.c msgid "Stereo left must be on PWM channel A" msgstr "" @@ -2230,10 +1939,6 @@ msgstr "" msgid "Stereo right must be on PWM channel B" msgstr "" -#: shared-bindings/multiterminal/__init__.c -msgid "Stream missing readinto() or write() method." -msgstr "" - #: ports/mimxrt10xx/common-hal/busio/UART.c ports/stm/common-hal/busio/UART.c msgid "Supply at least one UART pin" msgstr "" @@ -2307,10 +2012,6 @@ msgstr "" msgid "Tile index out of bounds" msgstr "" -#: shared-bindings/displayio/TileGrid.c -msgid "Tile value out of bounds" -msgstr "" - #: shared-bindings/displayio/TileGrid.c msgid "Tile width must exactly divide bitmap width" msgstr "" @@ -2330,6 +2031,9 @@ msgid "To exit, please reset the board without " msgstr "" #: ports/atmel-samd/common-hal/audiobusio/I2SOut.c +msgid "Too many channels in sample" +msgstr "" + #: ports/raspberrypi/common-hal/audiobusio/I2SOut.c msgid "Too many channels in sample." msgstr "" @@ -2362,23 +2066,24 @@ msgid "Tuple or struct_time argument required" msgstr "" #: ports/stm/common-hal/busio/UART.c -msgid "UART Buffer allocation error" +msgid "UART de-init" +msgstr "" + +#: ports/atmel-samd/common-hal/busio/UART.c ports/cxd56/common-hal/busio/UART.c +#: ports/espressif/common-hal/busio/UART.c ports/stm/common-hal/busio/UART.c +msgid "UART init" msgstr "" #: ports/stm/common-hal/busio/UART.c -msgid "UART De-init error" +msgid "UART re-init" msgstr "" #: ports/stm/common-hal/busio/UART.c -msgid "UART Init Error" +msgid "UART write" msgstr "" -#: ports/stm/common-hal/busio/UART.c -msgid "UART Re-init error" -msgstr "" - -#: ports/stm/common-hal/busio/UART.c -msgid "UART write error" +#: main.c +msgid "UID:" msgstr "" #: shared-module/usb_hid/Device.c @@ -2504,6 +2209,11 @@ msgstr "" msgid "Unknown system firmware error: %d" msgstr "" +#: ports/raspberrypi/common-hal/wifi/__init__.c +#, c-format +msgid "Unkown error code %d" +msgstr "" + #: shared-bindings/adafruit_pixelbuf/PixelBuf.c #, c-format msgid "Unmatched number of items on RHS (expected %d, got %d)." @@ -2515,12 +2225,6 @@ msgid "" "declined or ignored." msgstr "" -#: ports/atmel-samd/common-hal/busio/I2C.c ports/cxd56/common-hal/busio/I2C.c -#: ports/espressif/common-hal/busio/UART.c -#: ports/raspberrypi/common-hal/busio/I2C.c ports/stm/common-hal/busio/I2C.c -msgid "Unsupported baudrate" -msgstr "" - #: shared-bindings/bitmaptools/__init__.c msgid "Unsupported colorspace" msgstr "" @@ -2533,6 +2237,10 @@ msgstr "" msgid "Unsupported format" msgstr "" +#: shared-bindings/hashlib/__init__.c +msgid "Unsupported hash algorithm" +msgstr "" + #: ports/espressif/common-hal/dualbank/__init__.c msgid "Update Failed" msgstr "" @@ -2551,7 +2259,7 @@ msgstr "" msgid "Value length > max_length" msgstr "" -#: ports/espressif/bindings/espidf/__init__.c ports/espressif/esp_error.c +#: ports/espressif/common-hal/espidf/__init__.c ports/espressif/esp_error.c msgid "Version was invalid" msgstr "" @@ -2581,10 +2289,6 @@ msgstr "" msgid "WatchDogTimer.timeout must be greater than 0" msgstr "" -#: supervisor/shared/safe_mode.c -msgid "Watchdog timer expired." -msgstr "" - #: py/builtinhelp.c #, c-format msgid "" @@ -2595,8 +2299,8 @@ msgid "" "To list built-in modules type `help(\"modules\")`.\n" msgstr "" -#: shared-bindings/wifi/Radio.c -msgid "WiFi password must be between 8 and 63 characters" +#: supervisor/shared/web_workflow/web_workflow.c +msgid "Wi-Fi: " msgstr "" #: main.c @@ -2637,11 +2341,7 @@ msgstr "" msgid "a bytes-like object is required" msgstr "" -#: shared-bindings/i2cperipheral/I2CPeripheral.c -msgid "address out of bounds" -msgstr "" - -#: shared-bindings/i2cperipheral/I2CPeripheral.c +#: shared-bindings/i2ctarget/I2CTarget.c msgid "addresses is empty" msgstr "" @@ -2690,6 +2390,10 @@ msgstr "" msgid "array and index length must be equal" msgstr "" +#: extmod/ulab/code/numpy/io/io.c +msgid "array has too many dimensions" +msgstr "" + #: py/objarray.c shared-bindings/alarm/SleepMemory.c #: shared-bindings/nvm/ByteArray.c msgid "array/bytes required on right side" @@ -2751,10 +2455,6 @@ msgstr "" msgid "bits must be 32 or less" msgstr "" -#: shared-bindings/busio/UART.c -msgid "bits must be in range 5 to 9" -msgstr "" - #: shared-bindings/audiomixer/Mixer.c msgid "bits_per_sample must be 8 or 16" msgstr "" @@ -2792,11 +2492,6 @@ msgstr "" msgid "byteorder is not a string" msgstr "" -#: ports/atmel-samd/common-hal/busio/UART.c -#: ports/espressif/common-hal/busio/UART.c -msgid "bytes > 8 bits not supported" -msgstr "" - #: py/objarray.c msgid "bytes length not a multiple of item size" msgstr "" @@ -2805,7 +2500,7 @@ msgstr "" msgid "bytes value out of range" msgstr "" -#: ports/atmel-samd/bindings/samd/Clock.c ports/atmel-samd/common-hal/rtc/RTC.c +#: ports/atmel-samd/bindings/samd/Clock.c msgid "calibration is out of range" msgstr "" @@ -2813,12 +2508,9 @@ msgstr "" msgid "calibration is read only" msgstr "" -#: ports/atmel-samd/common-hal/rtc/RTC.c -msgid "calibration value out of range +/-127" -msgstr "" - +#: shared-module/vectorio/Circle.c shared-module/vectorio/Polygon.c #: shared-module/vectorio/Rectangle.c -msgid "can only be registered in one parent" +msgid "can only have one parent" msgstr "" #: py/emitinlinethumb.c @@ -2841,8 +2533,7 @@ msgstr "" msgid "can't cancel self" msgstr "" -#: py/obj.c py/objint.c shared-bindings/i2cperipheral/I2CPeripheral.c -#: shared-module/adafruit_pixelbuf/PixelBuf.c +#: py/obj.c py/objint.c shared-module/adafruit_pixelbuf/PixelBuf.c msgid "can't convert %q to %q" msgstr "" @@ -2989,6 +2680,10 @@ msgstr "" msgid "casting" msgstr "" +#: ports/stm/common-hal/pwmio/PWMOut.c +msgid "channel re-init" +msgstr "" + #: shared-bindings/_stage/Text.c msgid "chars buffer too small" msgstr "" @@ -3001,10 +2696,6 @@ msgstr "" msgid "chr() arg not in range(256)" msgstr "" -#: shared-module/vectorio/Circle.c -msgid "circle can only be registered in one parent" -msgstr "" - #: shared-bindings/bitmaptools/__init__.c msgid "clip point must be (x,y) tuple" msgstr "" @@ -3029,10 +2720,6 @@ msgstr "" msgid "color must be between 0x000000 and 0xffffff" msgstr "" -#: shared-bindings/displayio/ColorConverter.c -msgid "color should be an int" -msgstr "" - #: py/emitnative.c msgid "comparison of int and uint" msgstr "" @@ -3069,6 +2756,10 @@ msgstr "" msgid "convolve arguments must not be empty" msgstr "" +#: extmod/ulab/code/numpy/io/io.c +msgid "corrupted file" +msgstr "" + #: extmod/ulab/code/numpy/poly.c msgid "could not invert Vandermonde matrix" msgstr "" @@ -3119,10 +2810,6 @@ msgstr "" msgid "destination buffer must be an array of type 'H' for bit_depth = 16" msgstr "" -#: shared-bindings/audiobusio/PDMIn.c -msgid "destination_length must be an int >= 0" -msgstr "" - #: py/objdict.c msgid "dict update sequence has wrong length" msgstr "" @@ -3160,6 +2847,10 @@ msgstr "" msgid "empty" msgstr "" +#: extmod/ulab/code/numpy/io/io.c +msgid "empty file" +msgstr "" + #: extmod/moduasyncio.c extmod/moduheapq.c extmod/modutimeq.c msgid "empty heap" msgstr "" @@ -3176,10 +2867,6 @@ msgstr "" msgid "end of format while looking for conversion specifier" msgstr "" -#: shared-bindings/displayio/Shape.c -msgid "end_x should be an int" -msgstr "" - #: shared-bindings/alarm/time/TimeAlarm.c msgid "epoch_time not supported on this board" msgstr "" @@ -3189,6 +2876,12 @@ msgstr "" msgid "error = 0x%08lX" msgstr "" +#: ports/espressif/common-hal/esp32_camera/Camera.c +msgid "" +"esp32_camera.Camera requires reserved PSRAM to be configured. See the " +"documentation for instructions." +msgstr "" + #: py/runtime.c msgid "exceptions must derive from BaseException" msgstr "" @@ -3263,7 +2956,7 @@ msgstr "" msgid "first argument must be a tuple of ndarrays" msgstr "" -#: extmod/ulab/code/numpy/vector.c +#: extmod/ulab/code/numpy/transform.c extmod/ulab/code/numpy/vector.c msgid "first argument must be an ndarray" msgstr "" @@ -3411,7 +3104,7 @@ msgstr "" msgid "incorrect padding" msgstr "" -#: extmod/ulab/code/ndarray.c +#: extmod/ulab/code/ndarray.c extmod/ulab/code/numpy/transform.c msgid "index is out of bounds" msgstr "" @@ -3429,6 +3122,10 @@ msgstr "" msgid "indices must be integers, slices, or Boolean lists" msgstr "" +#: ports/espressif/common-hal/busio/I2C.c +msgid "init I2C" +msgstr "" + #: extmod/ulab/code/scipy/optimize/optimize.c msgid "initial values must be iterable" msgstr "" @@ -3474,6 +3171,10 @@ msgstr "" msgid "input matrix is singular" msgstr "" +#: extmod/ulab/code/numpy/create.c +msgid "input must be 1- or 2-d" +msgstr "" + #: extmod/ulab/code/numpy/carray/carray.c msgid "input must be a 1D ndarray" msgstr "" @@ -3482,11 +3183,7 @@ msgstr "" msgid "input must be a dense ndarray" msgstr "" -#: extmod/ulab/code/numpy/create.c -msgid "input must be a tensor of rank 2" -msgstr "" - -#: extmod/ulab/code/numpy/create.c extmod/ulab/code/user/user.c +#: extmod/ulab/code/user/user.c msgid "input must be an ndarray" msgstr "" @@ -3536,6 +3233,10 @@ msgstr "" msgid "invalid bits_per_pixel %d, must be, 1, 2, 4, 8, 16, 24, or 32" msgstr "" +#: ports/raspberrypi/common-hal/ssl/SSLSocket.c +msgid "invalid cert" +msgstr "" + #: shared-bindings/bitmaptools/__init__.c #, c-format msgid "invalid element size %d for bits_per_pixel %d\n" @@ -3562,10 +3263,18 @@ msgstr "" msgid "invalid hostname" msgstr "" +#: ports/raspberrypi/common-hal/ssl/SSLSocket.c +msgid "invalid key" +msgstr "" + #: py/compile.c msgid "invalid micropython decorator" msgstr "" +#: ports/espressif/common-hal/esp32_camera/Camera.c +msgid "invalid setting" +msgstr "" + #: shared-bindings/random/__init__.c msgid "invalid step" msgstr "" @@ -3679,10 +3388,6 @@ msgstr "" msgid "matrix is not positive definite" msgstr "" -#: ports/espressif/common-hal/wifi/Radio.c -msgid "max_connections must be between 0 and 10" -msgstr "" - #: ports/espressif/common-hal/_bleio/Descriptor.c #: ports/nrf/common-hal/_bleio/Characteristic.c #: ports/nrf/common-hal/_bleio/Descriptor.c @@ -3690,12 +3395,8 @@ msgstr "" msgid "max_length must be 0-%d when fixed_length is %s" msgstr "" -#: shared-bindings/_bleio/Characteristic.c shared-bindings/_bleio/Descriptor.c -msgid "max_length must be >= 0" -msgstr "" - #: extmod/ulab/code/ndarray.c -msgid "maximum number of dimensions is 4" +msgid "maximum number of dimensions is " msgstr "" #: py/runtime.c @@ -3829,7 +3530,7 @@ msgstr "" msgid "no response from SD card" msgstr "" -#: py/objobject.c py/runtime.c +#: ports/espressif/common-hal/esp32_camera/Camera.c py/objobject.c py/runtime.c msgid "no such attribute" msgstr "" @@ -3940,7 +3641,11 @@ msgstr "" msgid "odd-length string" msgstr "" -#: extmod/ulab/code/numpy/create.c extmod/ulab/code/utils/utils.c +#: supervisor/shared/web_workflow/web_workflow.c +msgid "off" +msgstr "" + +#: extmod/ulab/code/utils/utils.c msgid "offset is too large" msgstr "" @@ -4036,10 +3741,6 @@ msgstr "" msgid "palette must be 32 bytes long" msgstr "" -#: shared-bindings/displayio/Palette.c -msgid "palette_index should be an int" -msgstr "" - #: py/emitinlinextensa.c msgid "parameters must be registers in sequence a2 to a5" msgstr "" @@ -4064,10 +3765,6 @@ msgstr "" msgid "poll on file not available on win32" msgstr "" -#: shared-module/vectorio/Polygon.c -msgid "polygon can only be registered in one parent" -msgstr "" - #: ports/espressif/common-hal/pulseio/PulseIn.c msgid "pop from an empty PulseIn" msgstr "" @@ -4093,7 +3790,23 @@ msgstr "" msgid "pow() with 3 arguments requires integers" msgstr "" +#: ports/espressif/boards/adafruit_qtpy_esp32_pico/mpconfigboard.h +msgid "pressing BOOT button at start up.\n" +msgstr "" + +#: ports/espressif/boards/adafruit_feather_esp32_v2/mpconfigboard.h +msgid "pressing SW38 button at start up.\n" +msgstr "" + +#: ports/espressif/boards/hardkernel_odroid_go/mpconfigboard.h +msgid "pressing VOLUME button at start up.\n" +msgstr "" + #: ports/espressif/boards/adafruit_qtpy_esp32c3/mpconfigboard.h +#: ports/espressif/boards/beetle-esp32-c3/mpconfigboard.h +#: ports/espressif/boards/espressif_esp32s2_devkitc_1_n8r2/mpconfigboard.h +#: ports/espressif/boards/lolin_c3_mini/mpconfigboard.h +#: ports/espressif/boards/microdev_micro_c3/mpconfigboard.h #: supervisor/shared/safe_mode.c msgid "pressing boot button at start up.\n" msgstr "" @@ -4114,14 +3827,6 @@ msgstr "" msgid "pull masks conflict with direction masks" msgstr "" -#: ports/raspberrypi/bindings/rp2pio/StateMachine.c -msgid "pull_threshold must be between 1 and 32" -msgstr "" - -#: ports/raspberrypi/bindings/rp2pio/StateMachine.c -msgid "push_threshold must be between 1 and 32" -msgstr "" - #: extmod/modutimeq.c msgid "queue overflow" msgstr "" @@ -4173,12 +3878,6 @@ msgstr "" msgid "rsplit(None,n)" msgstr "" -#: shared-bindings/audiocore/RawSample.c -msgid "" -"sample_source buffer must be a bytearray or array of type 'h', 'H', 'b' or " -"'B'" -msgstr "" - #: ports/atmel-samd/common-hal/audiobusio/PDMIn.c #: ports/raspberrypi/common-hal/audiobusio/PDMIn.c msgid "sampling rate out of range" @@ -4276,26 +3975,14 @@ msgstr "" msgid "source_bitmap must have value_count of 8" msgstr "" -#: shared-bindings/wifi/Radio.c -msgid "ssid can't be more than 32 bytes" -msgstr "" - #: py/objstr.c msgid "start/end indices" msgstr "" -#: shared-bindings/displayio/Shape.c -msgid "start_x should be an int" -msgstr "" - #: shared-bindings/random/__init__.c msgid "step must be non-zero" msgstr "" -#: shared-bindings/busio/UART.c -msgid "stop must be 1 or 2" -msgstr "" - #: shared-bindings/random/__init__.c msgid "stop not reachable from start" msgstr "" @@ -4344,10 +4031,6 @@ msgstr "" msgid "threshold must be in the range 0-65536" msgstr "" -#: shared-bindings/rgbmatrix/RGBMatrix.c -msgid "tile must be greater than zero" -msgstr "" - #: shared-bindings/time/__init__.c msgid "time.struct_time() takes a 9-sequence" msgstr "" @@ -4367,10 +4050,6 @@ msgstr "" msgid "timeout must be < 655.35 secs" msgstr "" -#: shared-bindings/_bleio/CharacteristicBuffer.c -msgid "timeout must be >= 0.0" -msgstr "" - #: shared-module/sdcardio/SDCard.c msgid "timeout waiting for v1 card" msgstr "" @@ -4379,6 +4058,10 @@ msgstr "" msgid "timeout waiting for v2 card" msgstr "" +#: ports/stm/common-hal/pwmio/PWMOut.c +msgid "timer re-init" +msgstr "" + #: shared-bindings/time/__init__.c msgid "timestamp out of range for platform time_t" msgstr "" @@ -4444,14 +4127,10 @@ msgstr "" msgid "type is not an acceptable base type" msgstr "" -#: py/runtime.c +#: py/objgenerator.c py/runtime.c msgid "type object '%q' has no attribute '%q'" msgstr "" -#: py/objgenerator.c -msgid "type object 'generator' has no attribute '__await__'" -msgstr "" - #: py/objtype.c msgid "type takes 1 or 3 arguments" msgstr "" @@ -4510,7 +4189,6 @@ msgid "unreadable attribute" msgstr "" #: shared-bindings/displayio/TileGrid.c shared-bindings/vectorio/VectorShape.c -#: shared-module/vectorio/Polygon.c shared-module/vectorio/VectorShape.c msgid "unsupported %q type" msgstr "" @@ -4549,6 +4227,14 @@ msgstr "" msgid "unsupported types for %q: '%q', '%q'" msgstr "" +#: extmod/ulab/code/numpy/io/io.c +msgid "usecols is too high" +msgstr "" + +#: extmod/ulab/code/numpy/io/io.c +msgid "usecols keyword must be specified" +msgstr "" + #: py/objint.c #, c-format msgid "value must fit in %d byte(s)" @@ -4570,20 +4256,19 @@ msgstr "" msgid "watchdog timeout must be greater than 0" msgstr "" -#: shared-bindings/bitops/__init__.c -#, c-format -msgid "width must be from 2 to 8 (inclusive), not %d" -msgstr "" - #: shared-bindings/is31fl3741/FrameBuffer.c -#: shared-bindings/rgbmatrix/RGBMatrix.c msgid "width must be greater than zero" msgstr "" #: ports/espressif/common-hal/wifi/Radio.c +#: ports/raspberrypi/common-hal/wifi/Radio.c msgid "wifi is not enabled" msgstr "" +#: ports/raspberrypi/common-hal/wifi/Monitor.c +msgid "wifi.Monitor not available" +msgstr "" + #: shared-bindings/_bleio/Adapter.c msgid "window must be <= interval" msgstr "" @@ -4596,7 +4281,17 @@ msgstr "" msgid "wrong axis specified" msgstr "" -#: extmod/ulab/code/numpy/compare.c extmod/ulab/code/numpy/vector.c +#: extmod/ulab/code/numpy/io/io.c +msgid "wrong dtype" +msgstr "" + +#: extmod/ulab/code/numpy/transform.c +msgid "wrong index type" +msgstr "" + +#: extmod/ulab/code/numpy/compare.c extmod/ulab/code/numpy/create.c +#: extmod/ulab/code/numpy/io/io.c extmod/ulab/code/numpy/transform.c +#: extmod/ulab/code/numpy/vector.c msgid "wrong input type" msgstr "" @@ -4604,6 +4299,10 @@ msgstr "" msgid "wrong length of condition array" msgstr "" +#: extmod/ulab/code/numpy/transform.c +msgid "wrong length of index array" +msgstr "" + #: extmod/ulab/code/numpy/create.c py/objarray.c py/objstr.c msgid "wrong number of arguments" msgstr "" @@ -4624,10 +4323,6 @@ msgstr "" msgid "xTaskCreate failed" msgstr "" -#: shared-bindings/displayio/Shape.c -msgid "y should be an int" -msgstr "" - #: shared-module/displayio/Shape.c msgid "y value out of bounds" msgstr "" diff --git a/locale/it_IT.po b/locale/it_IT.po index 08fd145a80..acb4273138 100644 --- a/locale/it_IT.po +++ b/locale/it_IT.po @@ -66,6 +66,11 @@ msgstr " output:\n" msgid "%%c requires int or char" msgstr "%%c necessita di int o char" +#: main.c +#, c-format +msgid "%02X" +msgstr "" + #: shared-bindings/rgbmatrix/RGBMatrix.c #, c-format msgid "" @@ -73,10 +78,27 @@ msgid "" msgstr "" "%d pin indirizzo, %d pin rgb e %d tessere indicano l'altezza di %d, non %d" +#: ports/atmel-samd/common-hal/alarm/__init__.c +#: ports/cxd56/common-hal/analogio/AnalogOut.c ports/cxd56/common-hal/rtc/RTC.c +#: ports/espressif/common-hal/rtc/RTC.c +#: ports/mimxrt10xx/common-hal/analogio/AnalogOut.c +#: ports/mimxrt10xx/common-hal/rtc/RTC.c ports/nrf/common-hal/alarm/__init__.c +#: ports/nrf/common-hal/analogio/AnalogOut.c ports/nrf/common-hal/rtc/RTC.c +#: ports/raspberrypi/common-hal/alarm/__init__.c +#: ports/raspberrypi/common-hal/analogio/AnalogOut.c +#: ports/raspberrypi/common-hal/rtc/RTC.c ports/stm/common-hal/alarm/__init__.c +#: ports/stm/common-hal/rtc/RTC.c +msgid "%q" +msgstr "" + #: shared-bindings/microcontroller/Pin.c msgid "%q and %q contain duplicate pins" msgstr "" +#: ports/atmel-samd/common-hal/audioio/AudioOut.c +msgid "%q and %q must be different" +msgstr "" + #: shared-bindings/microcontroller/Pin.c msgid "%q contains duplicate pins" msgstr "" @@ -85,16 +107,12 @@ msgstr "" msgid "%q failure: %d" msgstr "%q fallito: %d" +#: shared-bindings/digitalio/DigitalInOut.c #: shared-bindings/microcontroller/Pin.c msgid "%q in use" msgstr "%q in uso" -#: ports/atmel-samd/common-hal/pulseio/PulseIn.c -#: ports/cxd56/common-hal/pulseio/PulseIn.c -#: ports/nrf/common-hal/pulseio/PulseIn.c -#: ports/raspberrypi/common-hal/pulseio/PulseIn.c -#: ports/stm/common-hal/pulseio/PulseIn.c py/obj.c py/objstr.c -#: py/objstrunicode.c +#: py/obj.c py/objstr.c py/objstrunicode.c msgid "%q index out of range" msgstr "indice %q fuori intervallo" @@ -102,14 +120,34 @@ msgstr "indice %q fuori intervallo" msgid "%q indices must be integers, not %s" msgstr "gli indici %q devono essere interi, non %s" +#: shared-module/bitbangio/SPI.c +msgid "%q init failed" +msgstr "" + +#: py/argcheck.c +msgid "%q length must be %d" +msgstr "" + #: py/argcheck.c msgid "%q length must be %d-%d" msgstr "" -#: shared-bindings/busio/I2C.c shared-bindings/usb_hid/Device.c +#: py/argcheck.c +msgid "%q length must be <= %d" +msgstr "" + +#: py/argcheck.c +msgid "%q length must be >= %d" +msgstr "" + +#: shared-bindings/busio/I2C.c msgid "%q length must be >= 1" msgstr "" +#: py/argcheck.c +msgid "%q must be %d" +msgstr "" + #: py/argcheck.c msgid "%q must be %d-%d" msgstr "" @@ -126,30 +164,17 @@ msgstr "" msgid "%q must be >= %d" msgstr "" -#: py/argcheck.c shared-bindings/memorymonitor/AllocationAlarm.c -msgid "%q must be >= 0" -msgstr "%q deve essere >= 0" - -#: shared-bindings/_bleio/CharacteristicBuffer.c -#: shared-bindings/_bleio/PacketBuffer.c shared-bindings/displayio/Group.c -#: shared-bindings/displayio/Shape.c -#: shared-bindings/memorymonitor/AllocationAlarm.c -#: shared-bindings/vectorio/Circle.c shared-bindings/vectorio/Rectangle.c -#, fuzzy -msgid "%q must be >= 1" -msgstr "slice del buffer devono essere della stessa lunghezza" +#: shared-bindings/analogbufio/BufferedIn.c +#: shared-bindings/audiocore/RawSample.c +msgid "%q must be a bytearray or array of type 'h', 'H', 'b', or 'B'" +msgstr "" #: py/argcheck.c msgid "%q must be a string" msgstr "" -#: shared-module/vectorio/Polygon.c -msgid "%q must be a tuple of length 2" -msgstr "%q deve essere una tupla di lunghezza 2" - -#: ports/espressif/common-hal/imagecapture/ParallelImageCapture.c -#: shared-module/vectorio/VectorShape.c -msgid "%q must be between %d and %d" +#: py/argcheck.c +msgid "%q must be an int" msgstr "" #: py/argcheck.c @@ -168,7 +193,11 @@ msgstr "" msgid "%q out of bounds" msgstr "" +#: ports/atmel-samd/common-hal/pulseio/PulseIn.c +#: ports/cxd56/common-hal/pulseio/PulseIn.c +#: ports/nrf/common-hal/pulseio/PulseIn.c #: ports/raspberrypi/common-hal/rp2pio/StateMachine.c +#: ports/stm/common-hal/pulseio/PulseIn.c py/argcheck.c #: shared-bindings/canio/Match.c msgid "%q out of range" msgstr "%q oltre il limite" @@ -177,10 +206,6 @@ msgstr "%q oltre il limite" msgid "%q pin invalid" msgstr "%q pin non valido" -#: shared-bindings/fontio/BuiltinFont.c -msgid "%q should be an int" -msgstr "%q dovrebbe essere un int" - #: shared-bindings/usb_hid/Device.c msgid "%q with a report ID of 0 must be of length 1" msgstr "" @@ -193,7 +218,11 @@ msgstr "%q() prende %d argomenti posizionali ma ne sono stati forniti %d" msgid "%q, %q, and %q must all be the same length" msgstr "" -#: ports/espressif/bindings/espidf/__init__.c ports/espressif/esp_error.c +#: py/objint.c +msgid "%q=%q" +msgstr "" + +#: ports/espressif/common-hal/espidf/__init__.c ports/espressif/esp_error.c #, c-format msgid "%s error 0x%x" msgstr "%s errore 0x%x" @@ -278,7 +307,7 @@ msgstr "" msgid "'%s' object doesn't support item deletion" msgstr "" -#: py/runtime.c +#: ports/raspberrypi/common-hal/wifi/Radio.c py/runtime.c msgid "'%s' object has no attribute '%q'" msgstr "l'oggetto '%s' non ha l'attributo '%q'" @@ -344,10 +373,6 @@ msgstr "'yield from' è nella funzione sincronizzazione" msgid "'yield' outside function" msgstr "'yield' al di fuori della funzione" -#: shared-module/vectorio/VectorShape.c -msgid "(x,y) integers required" -msgstr "" - #: py/compile.c msgid "*x must be assignment target" msgstr "*x deve essere il bersaglio del assegnamento" @@ -383,16 +408,12 @@ msgstr "ADC2 sta usando il WiFi" msgid "Address must be %d bytes long" msgstr "L'indirizzo deve essere lungo %d byte" -#: shared-bindings/_bleio/Address.c -msgid "Address type out of range" -msgstr "Tipo di indirizzo fuori intervallo" - #: ports/espressif/common-hal/canio/CAN.c msgid "All CAN peripherals are in use" msgstr "Tutte le periferiche CAN sono in uso" #: ports/espressif/common-hal/busio/I2C.c -#: ports/espressif/common-hal/i2cperipheral/I2CPeripheral.c +#: ports/espressif/common-hal/i2ctarget/I2CTarget.c #: ports/nrf/common-hal/busio/I2C.c msgid "All I2C peripherals are in use" msgstr "Tutte le periferiche I2C sono in uso" @@ -430,7 +451,6 @@ msgstr "" msgid "All event channels in use" msgstr "Tutti i canali eventi utilizati" -#: ports/raspberrypi/common-hal/pulseio/PulseIn.c #: ports/raspberrypi/common-hal/rp2pio/StateMachine.c msgid "All state machines in use" msgstr "Tutte le state machines sono in uso" @@ -475,28 +495,10 @@ msgid "Already running" msgstr "Già in funzione" #: ports/espressif/common-hal/wifi/Radio.c +#: ports/raspberrypi/common-hal/wifi/Radio.c msgid "Already scanning for wifi networks" msgstr "Già in ricerca di collegamenti WiFi" -#: ports/cxd56/common-hal/analogio/AnalogIn.c -msgid "AnalogIn not supported on given pin" -msgstr "" - -#: ports/cxd56/common-hal/analogio/AnalogOut.c -#: ports/mimxrt10xx/common-hal/analogio/AnalogOut.c -#: ports/nrf/common-hal/analogio/AnalogOut.c -#: ports/raspberrypi/common-hal/analogio/AnalogOut.c -msgid "AnalogOut functionality not supported" -msgstr "funzionalità AnalogOut non supportata" - -#: shared-bindings/analogio/AnalogOut.c -msgid "AnalogOut is only 16 bits. Value must be less than 65536." -msgstr "AnalogOut ha solo 16 bit. Il valore deve essere meno di 65536." - -#: ports/atmel-samd/common-hal/analogio/AnalogOut.c -msgid "AnalogOut not supported on given pin" -msgstr "AnalogOut non supportato sul pin scelto" - #: ports/stm/common-hal/audiopwmio/PWMAudioOut.c msgid "Another PWMAudioOut is already active" msgstr "" @@ -535,7 +537,7 @@ msgstr "" msgid "AuthMode.OPEN is not used with password" msgstr "" -#: shared-bindings/wifi/Radio.c +#: shared-bindings/wifi/Radio.c supervisor/shared/web_workflow/web_workflow.c msgid "Authentication failure" msgstr "Autenticazione Fallita" @@ -569,11 +571,6 @@ 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 "La profondità dei bit deve essere inclusiva da 1 a 6, non %d" - #: shared-bindings/audiobusio/PDMIn.c msgid "Bit depth must be multiple of 8." msgstr "La profondità di bit deve essere un multiplo di 8." @@ -615,11 +612,6 @@ msgstr "Buffer + offset troppo piccolo %d %d %d" msgid "Buffer elements must be 4 bytes long or less" msgstr "" -#: shared-module/usb_hid/Device.c -#, c-format -msgid "Buffer incorrect size. Should be %d bytes." -msgstr "Buffer di lunghezza non valida. Dovrebbe essere di %d bytes." - #: shared-bindings/framebufferio/FramebufferDisplay.c msgid "Buffer is not a bytearray." msgstr "Buffer non è un array di bites." @@ -629,7 +621,6 @@ msgstr "Buffer non è un array di bites." msgid "Buffer is too small" msgstr "Buffer troppo piccolo" -#: ports/nrf/common-hal/audiopwmio/PWMAudioOut.c #: ports/stm/common-hal/audiopwmio/PWMAudioOut.c #, c-format msgid "Buffer length %d too big. It must be less than %d" @@ -644,10 +635,6 @@ msgstr "La lunghezza del buffer deve essere un multiplo di 512" msgid "Buffer must be a multiple of 512 bytes" msgstr "Il buffer deve essere un multiplo di 512 bytes" -#: shared-bindings/bitbangio/I2C.c -msgid "Buffer must be at least length 1" -msgstr "Il buffer deve essere lungo almeno 1" - #: shared-bindings/_bleio/PacketBuffer.c #, c-format msgid "Buffer too short by %d bytes" @@ -669,10 +656,6 @@ msgstr "Bus pin %d è già in uso" msgid "Byte buffer must be 16 bytes." msgstr "I buffer byte devono essere di almeno 16 bytes." -#: shared-bindings/alarm/SleepMemory.c shared-bindings/nvm/ByteArray.c -msgid "Bytes must be between 0 and 255." -msgstr "I byte devono essere compresi tra 0 e 255." - #: shared-bindings/aesio/aes.c msgid "CBC blocks must be multiples of 16 bytes" msgstr "I blocchi CBC devono essere multipli di 16 bytes" @@ -681,7 +664,7 @@ msgstr "I blocchi CBC devono essere multipli di 16 bytes" msgid "CIRCUITPY drive could not be found or created." msgstr "" -#: ports/espressif/bindings/espidf/__init__.c ports/espressif/esp_error.c +#: ports/espressif/common-hal/espidf/__init__.c ports/espressif/esp_error.c msgid "CRC or checksum was invalid" msgstr "CRC o controllo totale è risultato non valido" @@ -689,6 +672,10 @@ msgstr "CRC o controllo totale è risultato non valido" msgid "Call super().__init__() before accessing native object." msgstr "Chiama super().__init__() prima di accedere ad un oggetto nativo." +#: ports/cxd56/common-hal/camera/Camera.c +msgid "Camera init" +msgstr "" + #: ports/espressif/common-hal/alarm/pin/PinAlarm.c msgid "Can only alarm on RTC IO from deep sleep." msgstr "" @@ -737,18 +724,10 @@ msgstr "Impossibile leggere la temperatura. status: 0x%02x" msgid "Cannot have scan responses for extended, connectable advertisements." msgstr "" -#: ports/atmel-samd/common-hal/audioio/AudioOut.c -msgid "Cannot output both channels on the same pin" -msgstr "Impossibile dare in output entrambi i canal sullo stesso pin" - #: ports/espressif/common-hal/alarm/pin/PinAlarm.c msgid "Cannot pull on input-only pin." msgstr "" -#: shared-module/bitbangio/SPI.c -msgid "Cannot read without MISO pin." -msgstr "Impossibile leggere senza pin MISO." - #: shared-bindings/audiobusio/PDMIn.c msgid "Cannot record to a file" msgstr "Impossibile registrare in un file" @@ -760,9 +739,8 @@ msgstr "" #: ports/atmel-samd/common-hal/microcontroller/__init__.c #: ports/cxd56/common-hal/microcontroller/__init__.c #: ports/mimxrt10xx/common-hal/microcontroller/__init__.c -msgid "Cannot reset into bootloader because no bootloader is present." +msgid "Cannot reset into bootloader because no bootloader is present" msgstr "" -"Impossibile resettare nel bootloader poiché nessun bootloader è presente." #: ports/espressif/common-hal/socketpool/Socket.c msgid "Cannot set socket options" @@ -782,21 +760,20 @@ msgid "Cannot subclass slice" msgstr "Impossibile subclasare slice" #: shared-module/bitbangio/SPI.c -msgid "Cannot transfer without MOSI and MISO pins." -msgstr "Impossibile trasferire senza i pin MOSI e MISO." +msgid "Cannot transfer without MOSI and MISO pins" +msgstr "" #: shared-bindings/pwmio/PWMOut.c msgid "Cannot vary frequency on a timer that is already in use" msgstr "" -#: ports/espressif/common-hal/alarm/pin/PinAlarm.c #: ports/nrf/common-hal/alarm/pin/PinAlarm.c -msgid "Cannot wake on pin edge. Only level." +msgid "Cannot wake on pin edge, only level" msgstr "" -#: shared-module/bitbangio/SPI.c -msgid "Cannot write without MOSI pin." -msgstr "Impossibile scrivere senza pin MOSI." +#: ports/espressif/common-hal/alarm/pin/PinAlarm.c +msgid "Cannot wake on pin edge. Only level." +msgstr "" #: shared-bindings/_bleio/CharacteristicBuffer.c msgid "CharacteristicBuffer writing not provided" @@ -810,10 +787,6 @@ msgstr "" msgid "CircuitPython was unable to allocate the heap." msgstr "" -#: shared-module/bitbangio/SPI.c -msgid "Clock pin init failed." -msgstr "Inizializzazione del pin di clock fallita." - #: shared-module/bitbangio/I2C.c msgid "Clock stretch too long" msgstr "Orologio e troppo allungato" @@ -822,12 +795,6 @@ msgstr "Orologio e troppo allungato" msgid "Clock unit in use" msgstr "Unità di clock in uso" -#: shared-bindings/displayio/FourWire.c shared-bindings/displayio/I2CDisplay.c -#: shared-bindings/paralleldisplay/ParallelBus.c -#, fuzzy -msgid "Command must be an int between 0 and 255" -msgstr "I byte devono essere compresi tra 0 e 255" - #: shared-bindings/_bleio/Connection.c msgid "" "Connection has been disconnected and can no longer be used. Create a new " @@ -838,35 +805,6 @@ msgstr "" msgid "Corrupt .mpy file" msgstr "" -#: ports/cxd56/common-hal/camera/Camera.c -msgid "Could not initialize Camera" -msgstr "" - -#: ports/cxd56/common-hal/gnss/GNSS.c -msgid "Could not initialize GNSS" -msgstr "" - -#: ports/cxd56/common-hal/sdioio/SDCard.c -msgid "Could not initialize SDCard" -msgstr "" - -#: ports/atmel-samd/common-hal/busio/UART.c ports/cxd56/common-hal/busio/UART.c -#: ports/espressif/common-hal/busio/UART.c -msgid "Could not initialize UART" -msgstr "Impossibile inizializzare l'UART" - -#: ports/stm/common-hal/pwmio/PWMOut.c -msgid "Could not re-init channel" -msgstr "" - -#: ports/stm/common-hal/pwmio/PWMOut.c -msgid "Could not re-init timer" -msgstr "" - -#: ports/stm/common-hal/pwmio/PWMOut.c -msgid "Could not restart PWM" -msgstr "" - #: ports/espressif/common-hal/neopixel_write/__init__.c msgid "Could not retrieve clock" msgstr "" @@ -887,20 +825,6 @@ msgstr "" msgid "Couldn't allocate decoder" msgstr "" -#: shared-module/audiocore/WaveFile.c shared-module/audiomixer/Mixer.c -#: shared-module/audiomp3/MP3Decoder.c -msgid "Couldn't allocate first buffer" -msgstr "Impossibile allocare il primo buffer" - -#: shared-module/audiomp3/MP3Decoder.c -msgid "Couldn't allocate input buffer" -msgstr "" - -#: shared-module/audiocore/WaveFile.c shared-module/audiomixer/Mixer.c -#: shared-module/audiomp3/MP3Decoder.c -msgid "Couldn't allocate second buffer" -msgstr "Impossibile allocare il secondo buffer" - #: supervisor/shared/safe_mode.c msgid "Crash into the HardFault_Handler." msgstr "" @@ -950,10 +874,6 @@ msgstr "La capacità di destinazione è più piccola di destination_length." msgid "Device in use" msgstr "" -#: ports/cxd56/common-hal/digitalio/DigitalInOut.c -msgid "DigitalInOut not supported on given pin" -msgstr "" - #: shared-bindings/displayio/Display.c #: shared-bindings/framebufferio/FramebufferDisplay.c msgid "Display must have a 16 bit colorspace." @@ -965,6 +885,10 @@ msgstr "" msgid "Display rotation must be in 90 degree increments" msgstr "" +#: main.c +msgid "Done" +msgstr "" + #: shared-bindings/digitalio/DigitalInOut.c msgid "Drive mode not used when direction is input." msgstr "" @@ -998,20 +922,19 @@ msgstr "Errore nella regex" msgid "Error: Failure to bind" msgstr "" -#: ports/raspberrypi/bindings/rp2pio/StateMachine.c py/enum.c -#: shared-bindings/_bleio/__init__.c shared-bindings/aesio/aes.c -#: shared-bindings/busio/SPI.c shared-bindings/microcontroller/Pin.c +#: py/enum.c shared-bindings/_bleio/__init__.c shared-bindings/aesio/aes.c +#: shared-bindings/alarm/__init__.c shared-bindings/busio/SPI.c +#: shared-bindings/microcontroller/Pin.c #: shared-bindings/neopixel_write/__init__.c msgid "Expected a %q" msgstr "Atteso un %q" -#: shared-bindings/alarm/__init__.c -msgid "Expected an alarm" +#: ports/raspberrypi/bindings/cyw43/__init__.c +msgid "Expected a %q or %q" msgstr "" -#: shared-module/adafruit_pixelbuf/PixelBuf.c -#, c-format -msgid "Expected tuple of length %d, got %d" +#: shared-bindings/alarm/__init__.c +msgid "Expected an %q" msgstr "" #: ports/espressif/common-hal/_bleio/Adapter.c @@ -1040,21 +963,9 @@ msgstr "" msgid "Failed to acquire mutex, err 0x%04x" msgstr "Impossibile acquisire il mutex, err 0x%04x" -#: ports/mimxrt10xx/common-hal/busio/UART.c ports/nrf/common-hal/busio/UART.c -#: ports/raspberrypi/common-hal/busio/UART.c -msgid "Failed to allocate RX buffer" -msgstr "Impossibile allocare buffer RX" - -#: ports/atmel-samd/common-hal/busio/UART.c -#: ports/atmel-samd/common-hal/pulseio/PulseIn.c -#: ports/cxd56/common-hal/pulseio/PulseIn.c -#: ports/espressif/common-hal/pulseio/PulseIn.c -#: ports/nrf/common-hal/pulseio/PulseIn.c -#: ports/raspberrypi/common-hal/pulseio/PulseIn.c -#: ports/stm/common-hal/pulseio/PulseIn.c -#, c-format -msgid "Failed to allocate RX buffer of %d bytes" -msgstr "Fallita allocazione del buffer RX di %d byte" +#: shared-module/rgbmatrix/RGBMatrix.c +msgid "Failed to allocate %q buffer" +msgstr "" #: ports/espressif/common-hal/wifi/__init__.c msgid "Failed to allocate Wifi memory" @@ -1077,10 +988,6 @@ msgstr "" msgid "Failed to connect: timeout" msgstr "" -#: ports/espressif/common-hal/wifi/__init__.c -msgid "Failed to init wifi" -msgstr "" - #: shared-module/audiomp3/MP3Decoder.c msgid "Failed to parse MP3 file" msgstr "" @@ -1124,11 +1031,6 @@ msgstr "" msgid "Format not supported" msgstr "" -#: shared-module/framebufferio/FramebufferDisplay.c -#, c-format -msgid "Framebuffer requires %d bytes" -msgstr "" - #: ports/mimxrt10xx/common-hal/microcontroller/Processor.c msgid "" "Frequency must be 24, 150, 396, 450, 528, 600, 720, 816, 912, 960 or 1008 Mhz" @@ -1143,7 +1045,11 @@ msgstr "" msgid "Function requires lock" msgstr "" -#: ports/espressif/bindings/espidf/__init__.c ports/espressif/esp_error.c +#: ports/cxd56/common-hal/gnss/GNSS.c +msgid "GNSS init" +msgstr "" + +#: ports/espressif/common-hal/espidf/__init__.c ports/espressif/esp_error.c msgid "Generic Failure" msgstr "" @@ -1170,19 +1076,16 @@ msgstr "" msgid "Hardware in use, try alternative pins" msgstr "" -#: shared-bindings/wifi/Radio.c -msgid "Hostname must be between 1 and 253 characters" -msgstr "" - #: extmod/vfs_posix_file.c py/objstringio.c msgid "I/O operation on closed file" msgstr "operazione I/O su file chiuso" #: ports/stm/common-hal/busio/I2C.c -msgid "I2C Init Error" +msgid "I2C init error" msgstr "" #: ports/raspberrypi/common-hal/busio/I2C.c +#: ports/raspberrypi/common-hal/i2ctarget/I2CTarget.c msgid "I2C peripheral in use" msgstr "" @@ -1289,75 +1192,37 @@ msgstr "" msgid "Internal error #%d" msgstr "" -#: shared-bindings/sdioio/SDCard.c shared-module/usb_hid/Device.c +#: supervisor/shared/safe_mode.c +msgid "Internal watchdog timer expired." +msgstr "" + +#: py/argcheck.c shared-bindings/digitalio/DigitalInOut.c msgid "Invalid %q" msgstr "" -#: ports/atmel-samd/common-hal/audiobusio/I2SOut.c -#: ports/atmel-samd/common-hal/audiobusio/PDMIn.c -#: ports/atmel-samd/common-hal/imagecapture/ParallelImageCapture.c -#: ports/mimxrt10xx/common-hal/busio/UART.c +#: shared-bindings/microcontroller/Pin.c msgid "Invalid %q pin" msgstr "Pin %q non valido" -#: ports/stm/common-hal/busio/I2C.c ports/stm/common-hal/busio/SPI.c -#: ports/stm/common-hal/busio/UART.c ports/stm/common-hal/canio/CAN.c -#: ports/stm/common-hal/sdioio/SDCard.c -msgid "Invalid %q pin selection" -msgstr "" - #: ports/stm/common-hal/analogio/AnalogIn.c msgid "Invalid ADC Unit value" msgstr "" -#: ports/espressif/common-hal/wifi/Radio.c -msgid "Invalid AuthMode" -msgstr "" - #: ports/espressif/common-hal/_bleio/__init__.c #: ports/nrf/common-hal/_bleio/__init__.c msgid "Invalid BLE parameter" msgstr "" -#: shared-module/displayio/OnDiskBitmap.c -msgid "Invalid BMP file" -msgstr "File BMP non valido" - #: shared-bindings/wifi/Radio.c msgid "Invalid BSSID" msgstr "" -#: ports/espressif/common-hal/analogio/AnalogOut.c -#: ports/stm/common-hal/analogio/AnalogOut.c -msgid "Invalid DAC pin supplied" -msgstr "" - #: shared-bindings/wifi/Radio.c msgid "Invalid MAC address" msgstr "" -#: shared-bindings/synthio/__init__.c -msgid "Invalid MIDI file" -msgstr "" - -#: ports/atmel-samd/common-hal/pwmio/PWMOut.c -#: ports/cxd56/common-hal/pwmio/PWMOut.c -#: ports/espressif/common-hal/pwmio/PWMOut.c -#: ports/mimxrt10xx/common-hal/pwmio/PWMOut.c -#: ports/nrf/common-hal/pwmio/PWMOut.c -#: ports/raspberrypi/common-hal/pwmio/PWMOut.c shared-bindings/pwmio/PWMOut.c -msgid "Invalid PWM frequency" -msgstr "Frequenza PWM non valida" - -#: ports/espressif/common-hal/analogio/AnalogIn.c -msgid "Invalid Pin" -msgstr "" - -#: ports/espressif/bindings/espidf/__init__.c -#: ports/espressif/common-hal/busio/I2C.c -#: ports/espressif/common-hal/i2cperipheral/I2CPeripheral.c -#: ports/espressif/esp_error.c py/moduerrno.c -#: shared-module/rgbmatrix/RGBMatrix.c +#: ports/espressif/common-hal/espidf/__init__.c ports/espressif/esp_error.c +#: py/moduerrno.c msgid "Invalid argument" msgstr "Argomento non valido" @@ -1365,44 +1230,11 @@ msgstr "Argomento non valido" msgid "Invalid bits per value" msgstr "bits per valore invalido" -#: ports/nrf/common-hal/busio/UART.c ports/raspberrypi/common-hal/busio/UART.c -#: ports/stm/common-hal/busio/UART.c -#, fuzzy -msgid "Invalid buffer size" -msgstr "lunghezza del buffer non valida" - -#: shared-bindings/adafruit_pixelbuf/PixelBuf.c -msgid "Invalid byteorder string" -msgstr "" - -#: ports/atmel-samd/common-hal/frequencyio/FrequencyIn.c -#: ports/espressif/common-hal/frequencyio/FrequencyIn.c -msgid "Invalid capture period. Valid range: 1 - 500" -msgstr "periodo di cattura invalido. Zona valida: 1 - 500" - -#: shared-bindings/audiomixer/Mixer.c -#, fuzzy -msgid "Invalid channel count" -msgstr "Argomento non valido" - -#: ports/atmel-samd/common-hal/imagecapture/ParallelImageCapture.c -#, c-format -msgid "Invalid data_count %d" -msgstr "" - #: ports/atmel-samd/common-hal/imagecapture/ParallelImageCapture.c #, c-format msgid "Invalid data_pins[%d]" msgstr "" -#: shared-bindings/digitalio/DigitalInOut.c -msgid "Invalid direction." -msgstr "Direzione non valida." - -#: shared-module/audiocore/WaveFile.c -msgid "Invalid file" -msgstr "File non valido" - #: shared-module/audiocore/WaveFile.c msgid "Invalid format chunk size" msgstr "" @@ -1411,108 +1243,27 @@ msgstr "" msgid "Invalid memory access." msgstr "" -#: extmod/vfs_fat_file.c -msgid "Invalid mode" -msgstr "" - #: ports/espressif/common-hal/wifi/Radio.c msgid "Invalid multicast MAC address" msgstr "" -#: shared-bindings/bitbangio/SPI.c shared-bindings/busio/SPI.c -msgid "Invalid number of bits" -msgstr "Numero di bit non valido" - -#: shared-bindings/bitbangio/SPI.c shared-bindings/busio/SPI.c -#: shared-bindings/displayio/FourWire.c -msgid "Invalid phase" -msgstr "Fase non valida" - -#: ports/atmel-samd/common-hal/audioio/AudioOut.c -#: ports/atmel-samd/common-hal/touchio/TouchIn.c -#: ports/espressif/common-hal/alarm/touch/TouchAlarm.c -#: ports/espressif/common-hal/touchio/TouchIn.c -#: ports/nrf/common-hal/alarm/pin/PinAlarm.c shared-bindings/pwmio/PWMOut.c -#: shared-module/rgbmatrix/RGBMatrix.c -msgid "Invalid pin" -msgstr "Pin non valido" - -#: ports/atmel-samd/common-hal/audioio/AudioOut.c -msgid "Invalid pin for left channel" -msgstr "Pin non valido per il canale sinistro" - -#: ports/atmel-samd/common-hal/audioio/AudioOut.c -msgid "Invalid pin for right channel" -msgstr "Pin non valido per il canale destro" - -#: ports/atmel-samd/common-hal/busio/I2C.c -#: ports/atmel-samd/common-hal/busio/SPI.c -#: ports/atmel-samd/common-hal/busio/UART.c -#: ports/atmel-samd/common-hal/i2cperipheral/I2CPeripheral.c -#: ports/cxd56/common-hal/busio/I2C.c ports/cxd56/common-hal/busio/SPI.c -#: ports/cxd56/common-hal/busio/UART.c ports/cxd56/common-hal/sdioio/SDCard.c -#: ports/espressif/common-hal/busio/I2C.c -#: ports/espressif/common-hal/busio/SPI.c -#: ports/espressif/common-hal/busio/UART.c -#: ports/espressif/common-hal/canio/CAN.c -#: ports/espressif/common-hal/i2cperipheral/I2CPeripheral.c -#: ports/mimxrt10xx/common-hal/busio/I2C.c -#: ports/mimxrt10xx/common-hal/busio/SPI.c -#: ports/mimxrt10xx/common-hal/usb_host/Port.c ports/nrf/common-hal/busio/I2C.c -#: ports/raspberrypi/common-hal/busio/I2C.c -#: ports/raspberrypi/common-hal/busio/SPI.c -#: ports/raspberrypi/common-hal/busio/UART.c shared-bindings/busio/SPI.c #: shared-bindings/busio/UART.c msgid "Invalid pins" msgstr "Pin non validi" -#: shared-bindings/bitbangio/SPI.c shared-bindings/busio/SPI.c -#: shared-bindings/displayio/FourWire.c -msgid "Invalid polarity" -msgstr "Polarità non valida" - -#: shared-bindings/_bleio/Characteristic.c -msgid "Invalid properties" -msgstr "" - -#: shared-bindings/microcontroller/__init__.c -msgid "Invalid run mode." -msgstr "Modalità di esecuzione non valida." - -#: shared-module/_bleio/Attribute.c -msgid "Invalid security_mode" -msgstr "" - -#: ports/espressif/bindings/espidf/__init__.c ports/espressif/esp_error.c +#: ports/espressif/common-hal/espidf/__init__.c ports/espressif/esp_error.c msgid "Invalid size" msgstr "" #: ports/espressif/common-hal/ssl/SSLContext.c +#: ports/raspberrypi/common-hal/ssl/SSLSocket.c msgid "Invalid socket for TLS" msgstr "" -#: ports/espressif/bindings/espidf/__init__.c ports/espressif/esp_error.c +#: ports/espressif/common-hal/espidf/__init__.c ports/espressif/esp_error.c msgid "Invalid state" msgstr "" -#: shared-bindings/audiomixer/Mixer.c -msgid "Invalid voice" -msgstr "" - -#: shared-bindings/audiomixer/Mixer.c -#, fuzzy -msgid "Invalid voice count" -msgstr "Tipo di servizio non valido" - -#: shared-module/audiocore/WaveFile.c -msgid "Invalid wave file" -msgstr "File wave non valido" - -#: ports/mimxrt10xx/common-hal/busio/UART.c ports/nrf/common-hal/busio/UART.c -#: ports/raspberrypi/common-hal/busio/UART.c ports/stm/common-hal/busio/UART.c -msgid "Invalid word/bit length" -msgstr "" - #: shared-bindings/aesio/aes.c msgid "Key must be 16, 24, or 32 bytes long" msgstr "" @@ -1526,24 +1277,16 @@ msgid "LHS of keyword arg must be an id" msgstr "" #: shared-module/displayio/Group.c -msgid "Layer already in a group." +msgid "Layer already in a group" msgstr "" #: shared-module/displayio/Group.c -msgid "Layer must be a Group or TileGrid subclass." -msgstr "Layer deve essere un Group o TileGrid subclass" - -#: ports/espressif/bindings/espidf/__init__.c ports/espressif/esp_error.c -msgid "MAC address was invalid" +msgid "Layer must be a Group or TileGrid subclass" msgstr "" -#: shared-module/bitbangio/SPI.c -msgid "MISO pin init failed." -msgstr "inizializzazione del pin MISO fallita." - -#: shared-module/bitbangio/SPI.c -msgid "MOSI pin init failed." -msgstr "inizializzazione del pin MOSI fallita." +#: ports/espressif/common-hal/espidf/__init__.c ports/espressif/esp_error.c +msgid "MAC address was invalid" +msgstr "" #: shared-bindings/is31fl3741/IS31FL3741.c msgid "Mapping must be a tuple" @@ -1554,10 +1297,6 @@ msgstr "" msgid "Maximum x value when mirrored is %d" msgstr "Valore massimo di x quando rispachiato è %d" -#: shared-bindings/canio/Message.c -msgid "Messages limited to 8 bytes" -msgstr "" - #: shared-bindings/audiobusio/PDMIn.c msgid "Microphone startup delay must be in range 0.0 to 1.0" msgstr "" @@ -1572,10 +1311,14 @@ msgstr "" msgid "Mismatched swap flag" msgstr "" -#: ports/mimxrt10xx/common-hal/busio/SPI.c ports/stm/common-hal/busio/SPI.c +#: ports/mimxrt10xx/common-hal/busio/SPI.c msgid "Missing MISO or MOSI Pin" msgstr "" +#: ports/stm/common-hal/busio/SPI.c +msgid "Missing MISO or MOSI pin" +msgstr "" + #: ports/raspberrypi/common-hal/rp2pio/StateMachine.c #, c-format msgid "Missing first_in_pin. Instruction %d reads pin(s)" @@ -1611,11 +1354,6 @@ msgstr "" msgid "Missing jmp_pin. Instruction %d jumps on pin" msgstr "" -#: shared-module/usb_hid/Device.c -#, c-format -msgid "More than %d report ids not supported" -msgstr "" - #: shared-bindings/busio/UART.c shared-bindings/displayio/Group.c msgid "Must be a %q subclass." msgstr "" @@ -1675,16 +1413,28 @@ msgstr "" msgid "No I2C device at address: 0x%x" msgstr "" -#: ports/espressif/common-hal/busio/SPI.c -#: ports/mimxrt10xx/common-hal/busio/SPI.c ports/stm/common-hal/busio/SPI.c -msgid "No MISO Pin" +#: supervisor/shared/web_workflow/web_workflow.c +msgid "No IP" msgstr "" #: ports/espressif/common-hal/busio/SPI.c -#: ports/mimxrt10xx/common-hal/busio/SPI.c ports/stm/common-hal/busio/SPI.c +#: ports/mimxrt10xx/common-hal/busio/SPI.c +msgid "No MISO Pin" +msgstr "" + +#: ports/stm/common-hal/busio/SPI.c shared-module/bitbangio/SPI.c +msgid "No MISO pin" +msgstr "" + +#: ports/espressif/common-hal/busio/SPI.c +#: ports/mimxrt10xx/common-hal/busio/SPI.c msgid "No MOSI Pin" msgstr "" +#: ports/stm/common-hal/busio/SPI.c shared-module/bitbangio/SPI.c +msgid "No MOSI pin" +msgstr "" + #: ports/atmel-samd/common-hal/busio/UART.c #: ports/espressif/common-hal/busio/UART.c #: ports/mimxrt10xx/common-hal/busio/UART.c ports/nrf/common-hal/busio/UART.c @@ -1723,16 +1473,6 @@ msgstr "Nessun GCLK libero" msgid "No hardware random available" msgstr "Nessun generatore hardware di numeri casuali disponibile" -#: ports/atmel-samd/common-hal/ps2io/Ps2.c -msgid "No hardware support on clk pin" -msgstr "" - -#: ports/atmel-samd/common-hal/alarm/pin/PinAlarm.c -#: ports/atmel-samd/common-hal/frequencyio/FrequencyIn.c -#: ports/atmel-samd/common-hal/pulseio/PulseIn.c -msgid "No hardware support on pin" -msgstr "Nessun supporto hardware sul pin" - #: ports/raspberrypi/common-hal/rp2pio/StateMachine.c msgid "No in in program" msgstr "" @@ -1834,16 +1574,26 @@ msgstr "" msgid "Odd parity is not supported" msgstr "operazione I2C non supportata" +#: supervisor/shared/bluetooth/bluetooth.c +msgid "Off" +msgstr "" + +#: supervisor/shared/bluetooth/bluetooth.c +msgid "Ok" +msgstr "" + #: ports/atmel-samd/common-hal/audiobusio/PDMIn.c #: ports/raspberrypi/common-hal/audiobusio/PDMIn.c msgid "Only 8 or 16 bit mono with " msgstr "" #: ports/espressif/common-hal/wifi/__init__.c +#: ports/raspberrypi/common-hal/wifi/__init__.c msgid "Only IPv4 addresses supported" msgstr "" -#: ports/espressif/common-hal/socketpool/SocketPool.c +#: ports/espressif/common-hal/socketpool/Socket.c +#: ports/raspberrypi/common-hal/socketpool/Socket.c msgid "Only IPv4 sockets supported" msgstr "" @@ -1876,15 +1626,19 @@ msgstr "" msgid "Only one TouchAlarm can be set in deep sleep." msgstr "" -#: ports/espressif/common-hal/i2cperipheral/I2CPeripheral.c +#: ports/espressif/common-hal/i2ctarget/I2CTarget.c +#: ports/raspberrypi/common-hal/i2ctarget/I2CTarget.c msgid "Only one address is allowed" msgstr "" #: ports/atmel-samd/common-hal/alarm/time/TimeAlarm.c -#: ports/espressif/common-hal/alarm/time/TimeAlarm.c #: ports/nrf/common-hal/alarm/time/TimeAlarm.c -#: ports/raspberrypi/common-hal/alarm/time/TimeAlarm.c #: ports/stm/common-hal/alarm/time/TimeAlarm.c +msgid "Only one alarm.time alarm can be set" +msgstr "" + +#: ports/espressif/common-hal/alarm/time/TimeAlarm.c +#: ports/raspberrypi/common-hal/alarm/time/TimeAlarm.c msgid "Only one alarm.time alarm can be set." msgstr "" @@ -1896,19 +1650,20 @@ msgstr "" msgid "Operation not permitted" msgstr "" -#: ports/espressif/bindings/espidf/__init__.c ports/espressif/esp_error.c +#: ports/espressif/common-hal/espidf/__init__.c ports/espressif/esp_error.c msgid "Operation or feature not supported" msgstr "" -#: ports/espressif/bindings/espidf/__init__.c ports/espressif/esp_error.c +#: ports/espressif/common-hal/espidf/__init__.c ports/espressif/esp_error.c msgid "Operation timed out" msgstr "" -#: ports/espressif/bindings/espidf/__init__.c ports/espressif/esp_error.c +#: ports/espressif/common-hal/espidf/__init__.c ports/espressif/esp_error.c msgid "Out of memory" msgstr "" -#: ports/espressif/common-hal/socketpool/SocketPool.c +#: ports/espressif/common-hal/socketpool/Socket.c +#: ports/raspberrypi/common-hal/socketpool/Socket.c msgid "Out of sockets" msgstr "" @@ -1916,11 +1671,6 @@ msgstr "" msgid "Out-buffer elements must be <= 4 bytes long" msgstr "" -#: shared-bindings/bitops/__init__.c -#, c-format -msgid "Output buffer must be at least %d bytes" -msgstr "" - #: shared-bindings/audiobusio/PDMIn.c msgid "Oversample must be multiple of 8." msgstr "L'oversampling deve essere multiplo di 8." @@ -1929,13 +1679,6 @@ msgstr "L'oversampling deve essere multiplo di 8." msgid "PDMIn not available" msgstr "" -#: shared-bindings/pwmio/PWMOut.c -msgid "" -"PWM duty_cycle must be between 0 and 65535 inclusive (16 bit resolution)" -msgstr "" -"duty_cycle del PWM deve essere compresa tra 0 e 65535 inclusiva (risoluzione " -"a 16 bit)" - #: shared-bindings/pwmio/PWMOut.c #, fuzzy msgid "" @@ -1944,6 +1687,10 @@ msgstr "" "frequenza PWM frequency non è scrivibile quando variable_frequency è " "impostato nel costruttore a False." +#: ports/stm/common-hal/pwmio/PWMOut.c +msgid "PWM restart" +msgstr "" + #: ports/raspberrypi/common-hal/countio/Counter.c msgid "PWM slice already in use" msgstr "" @@ -1960,36 +1707,20 @@ msgstr "" msgid "Permission denied" msgstr "Permesso negato" -#: ports/atmel-samd/common-hal/alarm/pin/PinAlarm.c #: ports/stm/common-hal/alarm/pin/PinAlarm.c msgid "Pin cannot wake from Deep Sleep" msgstr "" -#: ports/raspberrypi/bindings/rp2pio/StateMachine.c -msgid "Pin count must be at least 1" -msgstr "" - #: ports/raspberrypi/common-hal/rp2pio/StateMachine.c msgid "Pin count too large" msgstr "" -#: ports/atmel-samd/common-hal/analogio/AnalogIn.c -#: ports/cxd56/common-hal/analogio/AnalogIn.c -#: ports/espressif/common-hal/analogio/AnalogIn.c -#: ports/mimxrt10xx/common-hal/analogio/AnalogIn.c -#: ports/nrf/common-hal/analogio/AnalogIn.c -#: ports/raspberrypi/common-hal/analogio/AnalogIn.c -#: ports/stm/common-hal/analogio/AnalogIn.c -msgid "Pin does not have ADC capabilities" -msgstr "Il pin non ha capacità di ADC" - #: ports/stm/common-hal/alarm/pin/PinAlarm.c #: ports/stm/common-hal/pulseio/PulseIn.c msgid "Pin interrupt already in use" msgstr "" #: shared-bindings/adafruit_bus_device/spi_device/SPIDevice.c -#: shared-bindings/digitalio/DigitalInOut.c msgid "Pin is input only" msgstr "" @@ -2050,18 +1781,10 @@ msgstr "" msgid "Program does OUT without loading OSR" msgstr "" -#: ports/raspberrypi/bindings/rp2pio/StateMachine.c -msgid "Program must contain at least one 16-bit instruction." -msgstr "" - #: ports/raspberrypi/bindings/rp2pio/StateMachine.c msgid "Program size invalid" msgstr "" -#: ports/raspberrypi/bindings/rp2pio/StateMachine.c -msgid "Program too large" -msgstr "" - #: shared-bindings/digitalio/DigitalInOut.c msgid "Pull not used when direction is output." msgstr "" @@ -2083,8 +1806,9 @@ msgstr "" msgid "RNG Init Error" msgstr "" -#: ports/nrf/common-hal/busio/UART.c -msgid "RS485 Not yet supported on this device" +#: ports/atmel-samd/common-hal/busio/UART.c ports/cxd56/common-hal/busio/UART.c +#: ports/nrf/common-hal/busio/UART.c ports/stm/common-hal/busio/UART.c +msgid "RS485" msgstr "" #: ports/espressif/common-hal/busio/UART.c @@ -2092,21 +1816,10 @@ msgstr "" msgid "RS485 inversion specified when not in RS485 mode" msgstr "" -#: ports/cxd56/common-hal/rtc/RTC.c ports/espressif/common-hal/rtc/RTC.c -#: ports/mimxrt10xx/common-hal/rtc/RTC.c ports/nrf/common-hal/rtc/RTC.c -#: ports/raspberrypi/common-hal/rtc/RTC.c -msgid "RTC calibration is not supported on this board" -msgstr "calibrazione RTC non supportata su questa scheda" - #: shared-bindings/alarm/time/TimeAlarm.c shared-bindings/time/__init__.c msgid "RTC is not supported on this board" msgstr "RTC non supportato su questa scheda" -#: ports/atmel-samd/common-hal/busio/UART.c ports/cxd56/common-hal/busio/UART.c -#: ports/stm/common-hal/busio/UART.c -msgid "RTS/CTS/RS485 Not yet supported on this device" -msgstr "" - #: ports/stm/common-hal/os/__init__.c msgid "Random number generation error" msgstr "" @@ -2125,10 +1838,14 @@ msgstr "Filesystem in sola lettura" msgid "Read-only object" msgstr "Sola lettura" -#: ports/espressif/bindings/espidf/__init__.c ports/espressif/esp_error.c +#: ports/espressif/common-hal/espidf/__init__.c ports/espressif/esp_error.c msgid "Received response was invalid" msgstr "" +#: supervisor/shared/bluetooth/bluetooth.c +msgid "Reconnecting" +msgstr "" + #: shared-bindings/displayio/EPaperDisplay.c msgid "Refresh too soon" msgstr "" @@ -2141,7 +1858,7 @@ msgstr "" msgid "Requested AES mode is unsupported" msgstr "" -#: ports/espressif/bindings/espidf/__init__.c ports/espressif/esp_error.c +#: ports/espressif/common-hal/espidf/__init__.c ports/espressif/esp_error.c msgid "Requested resource not found" msgstr "" @@ -2157,6 +1874,10 @@ msgstr "Modalità sicura in esecuzione! Codice salvato non in esecuzione.\n" msgid "SD card CSD format not supported" msgstr "" +#: ports/cxd56/common-hal/sdioio/SDCard.c +msgid "SDCard init" +msgstr "" + #: ports/stm/common-hal/sdioio/SDCard.c #, c-format msgid "SDIO GetCardInfo Error %d" @@ -2167,32 +1888,21 @@ msgstr "" msgid "SDIO Init Error %d" msgstr "" -#: ports/stm/common-hal/busio/SPI.c -msgid "SPI Init Error" -msgstr "" - -#: ports/stm/common-hal/busio/SPI.c -msgid "SPI Re-initialization error" -msgstr "" - #: ports/espressif/common-hal/busio/SPI.c msgid "SPI configuration failed" msgstr "" +#: ports/stm/common-hal/busio/SPI.c +msgid "SPI init error" +msgstr "" + #: ports/raspberrypi/common-hal/busio/SPI.c msgid "SPI peripheral in use" msgstr "" -#: shared-bindings/audiomixer/Mixer.c -#, fuzzy -msgid "Sample rate must be positive" -msgstr "STA deve essere attiva" - -#: ports/atmel-samd/common-hal/audioio/AudioOut.c -#, c-format -msgid "Sample rate too high. It must be less than %d" +#: ports/stm/common-hal/busio/SPI.c +msgid "SPI re-init" msgstr "" -"Frequenza di campionamento troppo alta. Il valore deve essere inferiore a %d" #: shared-bindings/is31fl3741/FrameBuffer.c msgid "Scale dimensions must divide by 3" @@ -2212,14 +1922,6 @@ msgstr "Serializer in uso" msgid "Server side context cannot have hostname" msgstr "" -#: ports/raspberrypi/bindings/rp2pio/StateMachine.c -msgid "Set pin count must be between 1 and 5" -msgstr "" - -#: ports/raspberrypi/bindings/rp2pio/StateMachine.c -msgid "Side set pin count must be between 1 and 5" -msgstr "" - #: ports/cxd56/common-hal/camera/Camera.c msgid "Size not supported" msgstr "" @@ -2240,6 +1942,7 @@ msgid "Slices not supported" msgstr "Slice non supportate" #: ports/espressif/common-hal/socketpool/SocketPool.c +#: ports/raspberrypi/common-hal/socketpool/SocketPool.c msgid "SocketPool can only be used with wifi.radio" msgstr "" @@ -2255,10 +1958,6 @@ msgstr "" msgid "Splitting with sub-captures" msgstr "Suddivisione con sotto-catture" -#: shared-bindings/supervisor/__init__.c -msgid "Stack size must be at least 256" -msgstr "La dimensione dello stack deve essere almeno 256" - #: ports/raspberrypi/common-hal/audiopwmio/PWMAudioOut.c msgid "Stereo left must be on PWM channel A" msgstr "" @@ -2267,10 +1966,6 @@ msgstr "" msgid "Stereo right must be on PWM channel B" msgstr "" -#: shared-bindings/multiterminal/__init__.c -msgid "Stream missing readinto() or write() method." -msgstr "Metodi mancanti readinto() o write() allo stream." - #: ports/mimxrt10xx/common-hal/busio/UART.c ports/stm/common-hal/busio/UART.c msgid "Supply at least one UART pin" msgstr "" @@ -2344,10 +2039,6 @@ msgstr "" msgid "Tile index out of bounds" msgstr "" -#: shared-bindings/displayio/TileGrid.c -msgid "Tile value out of bounds" -msgstr "" - #: shared-bindings/displayio/TileGrid.c msgid "Tile width must exactly divide bitmap width" msgstr "" @@ -2367,6 +2058,9 @@ msgid "To exit, please reset the board without " msgstr "Per uscire resettare la scheda senza " #: ports/atmel-samd/common-hal/audiobusio/I2SOut.c +msgid "Too many channels in sample" +msgstr "" + #: ports/raspberrypi/common-hal/audiobusio/I2SOut.c msgid "Too many channels in sample." msgstr "" @@ -2399,23 +2093,24 @@ msgid "Tuple or struct_time argument required" msgstr "Tupla o struct_time richiesto come argomento" #: ports/stm/common-hal/busio/UART.c -msgid "UART Buffer allocation error" +msgid "UART de-init" +msgstr "" + +#: ports/atmel-samd/common-hal/busio/UART.c ports/cxd56/common-hal/busio/UART.c +#: ports/espressif/common-hal/busio/UART.c ports/stm/common-hal/busio/UART.c +msgid "UART init" msgstr "" #: ports/stm/common-hal/busio/UART.c -msgid "UART De-init error" +msgid "UART re-init" msgstr "" #: ports/stm/common-hal/busio/UART.c -msgid "UART Init Error" +msgid "UART write" msgstr "" -#: ports/stm/common-hal/busio/UART.c -msgid "UART Re-init error" -msgstr "" - -#: ports/stm/common-hal/busio/UART.c -msgid "UART write error" +#: main.c +msgid "UID:" msgstr "" #: shared-module/usb_hid/Device.c @@ -2542,6 +2237,11 @@ msgstr "" msgid "Unknown system firmware error: %d" msgstr "" +#: ports/raspberrypi/common-hal/wifi/__init__.c +#, c-format +msgid "Unkown error code %d" +msgstr "" + #: shared-bindings/adafruit_pixelbuf/PixelBuf.c #, c-format msgid "Unmatched number of items on RHS (expected %d, got %d)." @@ -2553,12 +2253,6 @@ msgid "" "declined or ignored." msgstr "" -#: ports/atmel-samd/common-hal/busio/I2C.c ports/cxd56/common-hal/busio/I2C.c -#: ports/espressif/common-hal/busio/UART.c -#: ports/raspberrypi/common-hal/busio/I2C.c ports/stm/common-hal/busio/I2C.c -msgid "Unsupported baudrate" -msgstr "baudrate non supportato" - #: shared-bindings/bitmaptools/__init__.c msgid "Unsupported colorspace" msgstr "" @@ -2572,6 +2266,10 @@ msgstr "tipo di bitmap non supportato" msgid "Unsupported format" msgstr "Formato non supportato" +#: shared-bindings/hashlib/__init__.c +msgid "Unsupported hash algorithm" +msgstr "" + #: ports/espressif/common-hal/dualbank/__init__.c msgid "Update Failed" msgstr "" @@ -2590,7 +2288,7 @@ msgstr "" msgid "Value length > max_length" msgstr "" -#: ports/espressif/bindings/espidf/__init__.c ports/espressif/esp_error.c +#: ports/espressif/common-hal/espidf/__init__.c ports/espressif/esp_error.c msgid "Version was invalid" msgstr "" @@ -2620,10 +2318,6 @@ msgstr "" msgid "WatchDogTimer.timeout must be greater than 0" msgstr "" -#: supervisor/shared/safe_mode.c -msgid "Watchdog timer expired." -msgstr "" - #: py/builtinhelp.c #, c-format msgid "" @@ -2634,8 +2328,8 @@ msgid "" "To list built-in modules type `help(\"modules\")`.\n" msgstr "" -#: shared-bindings/wifi/Radio.c -msgid "WiFi password must be between 8 and 63 characters" +#: supervisor/shared/web_workflow/web_workflow.c +msgid "Wi-Fi: " msgstr "" #: main.c @@ -2676,11 +2370,7 @@ msgstr "" msgid "a bytes-like object is required" msgstr "un oggetto byte-like è richiesto" -#: shared-bindings/i2cperipheral/I2CPeripheral.c -msgid "address out of bounds" -msgstr "indirizzo fuori limite" - -#: shared-bindings/i2cperipheral/I2CPeripheral.c +#: shared-bindings/i2ctarget/I2CTarget.c msgid "addresses is empty" msgstr "gli indirizzi sono vuoti" @@ -2729,6 +2419,10 @@ msgstr "" msgid "array and index length must be equal" msgstr "" +#: extmod/ulab/code/numpy/io/io.c +msgid "array has too many dimensions" +msgstr "" + #: py/objarray.c shared-bindings/alarm/SleepMemory.c #: shared-bindings/nvm/ByteArray.c msgid "array/bytes required on right side" @@ -2790,10 +2484,6 @@ msgstr "" msgid "bits must be 32 or less" msgstr "" -#: shared-bindings/busio/UART.c -msgid "bits must be in range 5 to 9" -msgstr "" - #: shared-bindings/audiomixer/Mixer.c #, fuzzy msgid "bits_per_sample must be 8 or 16" @@ -2834,11 +2524,6 @@ msgstr "" msgid "byteorder is not a string" msgstr "" -#: ports/atmel-samd/common-hal/busio/UART.c -#: ports/espressif/common-hal/busio/UART.c -msgid "bytes > 8 bits not supported" -msgstr "byte > 8 bit non supportati" - #: py/objarray.c msgid "bytes length not a multiple of item size" msgstr "" @@ -2847,7 +2532,7 @@ msgstr "" msgid "bytes value out of range" msgstr "valore byte fuori intervallo" -#: ports/atmel-samd/bindings/samd/Clock.c ports/atmel-samd/common-hal/rtc/RTC.c +#: ports/atmel-samd/bindings/samd/Clock.c msgid "calibration is out of range" msgstr "la calibrazione è fuori intervallo" @@ -2855,12 +2540,9 @@ msgstr "la calibrazione è fuori intervallo" msgid "calibration is read only" msgstr "la calibrazione è in sola lettura" -#: ports/atmel-samd/common-hal/rtc/RTC.c -msgid "calibration value out of range +/-127" -msgstr "valore di calibrazione fuori intervallo +/-127" - +#: shared-module/vectorio/Circle.c shared-module/vectorio/Polygon.c #: shared-module/vectorio/Rectangle.c -msgid "can only be registered in one parent" +msgid "can only have one parent" msgstr "" #: py/emitinlinethumb.c @@ -2884,8 +2566,7 @@ msgstr "impossibile assegnare all'espressione" msgid "can't cancel self" msgstr "" -#: py/obj.c py/objint.c shared-bindings/i2cperipheral/I2CPeripheral.c -#: shared-module/adafruit_pixelbuf/PixelBuf.c +#: py/obj.c py/objint.c shared-module/adafruit_pixelbuf/PixelBuf.c msgid "can't convert %q to %q" msgstr "" @@ -3032,6 +2713,10 @@ msgstr "" msgid "casting" msgstr "casting" +#: ports/stm/common-hal/pwmio/PWMOut.c +msgid "channel re-init" +msgstr "" + #: shared-bindings/_stage/Text.c msgid "chars buffer too small" msgstr "buffer dei caratteri troppo piccolo" @@ -3044,10 +2729,6 @@ msgstr "argomento di chr() non è in range(0x110000)" msgid "chr() arg not in range(256)" msgstr "argomento di chr() non è in range(256)" -#: shared-module/vectorio/Circle.c -msgid "circle can only be registered in one parent" -msgstr "" - #: shared-bindings/bitmaptools/__init__.c msgid "clip point must be (x,y) tuple" msgstr "" @@ -3074,10 +2755,6 @@ msgstr "" msgid "color must be between 0x000000 and 0xffffff" msgstr "il colore deve essere compreso tra 0x000000 e 0xffffff" -#: shared-bindings/displayio/ColorConverter.c -msgid "color should be an int" -msgstr "il colore deve essere un int" - #: py/emitnative.c msgid "comparison of int and uint" msgstr "" @@ -3114,6 +2791,10 @@ msgstr "" msgid "convolve arguments must not be empty" msgstr "" +#: extmod/ulab/code/numpy/io/io.c +msgid "corrupted file" +msgstr "" + #: extmod/ulab/code/numpy/poly.c msgid "could not invert Vandermonde matrix" msgstr "" @@ -3167,10 +2848,6 @@ msgid "destination buffer must be an array of type 'H' for bit_depth = 16" msgstr "" "il buffer di destinazione deve essere un array di tipo 'H' con bit_depth = 16" -#: shared-bindings/audiobusio/PDMIn.c -msgid "destination_length must be an int >= 0" -msgstr "destination_length deve essere un int >= 0" - #: py/objdict.c msgid "dict update sequence has wrong length" msgstr "sequanza di aggiornamento del dizionario ha la lunghezza errata" @@ -3208,6 +2885,10 @@ msgstr "" msgid "empty" msgstr "vuoto" +#: extmod/ulab/code/numpy/io/io.c +msgid "empty file" +msgstr "" + #: extmod/moduasyncio.c extmod/moduheapq.c extmod/modutimeq.c msgid "empty heap" msgstr "heap vuoto" @@ -3224,11 +2905,6 @@ msgstr "sequenza vuota" msgid "end of format while looking for conversion specifier" msgstr "" -#: shared-bindings/displayio/Shape.c -#, fuzzy -msgid "end_x should be an int" -msgstr "y dovrebbe essere un int" - #: shared-bindings/alarm/time/TimeAlarm.c msgid "epoch_time not supported on this board" msgstr "" @@ -3238,6 +2914,12 @@ msgstr "" msgid "error = 0x%08lX" msgstr "errore = 0x%08lX" +#: ports/espressif/common-hal/esp32_camera/Camera.c +msgid "" +"esp32_camera.Camera requires reserved PSRAM to be configured. See the " +"documentation for instructions." +msgstr "" + #: py/runtime.c msgid "exceptions must derive from BaseException" msgstr "le eccezioni devono derivare da BaseException" @@ -3312,7 +2994,7 @@ msgstr "" msgid "first argument must be a tuple of ndarrays" msgstr "" -#: extmod/ulab/code/numpy/vector.c +#: extmod/ulab/code/numpy/transform.c extmod/ulab/code/numpy/vector.c msgid "first argument must be an ndarray" msgstr "" @@ -3461,7 +3143,7 @@ msgstr "" msgid "incorrect padding" msgstr "padding incorretto" -#: extmod/ulab/code/ndarray.c +#: extmod/ulab/code/ndarray.c extmod/ulab/code/numpy/transform.c msgid "index is out of bounds" msgstr "" @@ -3479,6 +3161,10 @@ msgstr "gli indici devono essere interi" msgid "indices must be integers, slices, or Boolean lists" msgstr "" +#: ports/espressif/common-hal/busio/I2C.c +msgid "init I2C" +msgstr "" + #: extmod/ulab/code/scipy/optimize/optimize.c msgid "initial values must be iterable" msgstr "" @@ -3524,6 +3210,10 @@ msgstr "" msgid "input matrix is singular" msgstr "" +#: extmod/ulab/code/numpy/create.c +msgid "input must be 1- or 2-d" +msgstr "" + #: extmod/ulab/code/numpy/carray/carray.c msgid "input must be a 1D ndarray" msgstr "" @@ -3532,11 +3222,7 @@ msgstr "" msgid "input must be a dense ndarray" msgstr "" -#: extmod/ulab/code/numpy/create.c -msgid "input must be a tensor of rank 2" -msgstr "" - -#: extmod/ulab/code/numpy/create.c extmod/ulab/code/user/user.c +#: extmod/ulab/code/user/user.c msgid "input must be an ndarray" msgstr "" @@ -3586,6 +3272,10 @@ msgstr "" msgid "invalid bits_per_pixel %d, must be, 1, 2, 4, 8, 16, 24, or 32" msgstr "" +#: ports/raspberrypi/common-hal/ssl/SSLSocket.c +msgid "invalid cert" +msgstr "certificato non valido" + #: shared-bindings/bitmaptools/__init__.c #, c-format msgid "invalid element size %d for bits_per_pixel %d\n" @@ -3612,10 +3302,18 @@ msgstr "specificatore di formato non valido" msgid "invalid hostname" msgstr "" +#: ports/raspberrypi/common-hal/ssl/SSLSocket.c +msgid "invalid key" +msgstr "chiave non valida" + #: py/compile.c msgid "invalid micropython decorator" msgstr "decoratore non valido in micropython" +#: ports/espressif/common-hal/esp32_camera/Camera.c +msgid "invalid setting" +msgstr "" + #: shared-bindings/random/__init__.c msgid "invalid step" msgstr "step non valida" @@ -3734,10 +3432,6 @@ msgstr "errore di dominio matematico" msgid "matrix is not positive definite" msgstr "" -#: ports/espressif/common-hal/wifi/Radio.c -msgid "max_connections must be between 0 and 10" -msgstr "" - #: ports/espressif/common-hal/_bleio/Descriptor.c #: ports/nrf/common-hal/_bleio/Characteristic.c #: ports/nrf/common-hal/_bleio/Descriptor.c @@ -3745,12 +3439,8 @@ msgstr "" msgid "max_length must be 0-%d when fixed_length is %s" msgstr "" -#: shared-bindings/_bleio/Characteristic.c shared-bindings/_bleio/Descriptor.c -msgid "max_length must be >= 0" -msgstr "" - #: extmod/ulab/code/ndarray.c -msgid "maximum number of dimensions is 4" +msgid "maximum number of dimensions is " msgstr "" #: py/runtime.c @@ -3884,7 +3574,7 @@ msgstr "" msgid "no response from SD card" msgstr "" -#: py/objobject.c py/runtime.c +#: ports/espressif/common-hal/esp32_camera/Camera.c py/objobject.c py/runtime.c msgid "no such attribute" msgstr "attributo inesistente" @@ -3997,7 +3687,11 @@ msgstr "" msgid "odd-length string" msgstr "stringa di lunghezza dispari" -#: extmod/ulab/code/numpy/create.c extmod/ulab/code/utils/utils.c +#: supervisor/shared/web_workflow/web_workflow.c +msgid "off" +msgstr "" + +#: extmod/ulab/code/utils/utils.c msgid "offset is too large" msgstr "" @@ -4095,10 +3789,6 @@ msgstr "" msgid "palette must be 32 bytes long" msgstr "la palette deve essere lunga 32 byte" -#: shared-bindings/displayio/Palette.c -msgid "palette_index should be an int" -msgstr "palette_index deve essere un int" - #: py/emitinlinextensa.c msgid "parameters must be registers in sequence a2 to a5" msgstr "parametri devono essere i registri in sequenza da a2 a a5" @@ -4125,10 +3815,6 @@ msgstr "pixel_shader deve essere displayio.Palette o displayio.ColorConverter" msgid "poll on file not available on win32" msgstr "" -#: shared-module/vectorio/Polygon.c -msgid "polygon can only be registered in one parent" -msgstr "" - #: ports/espressif/common-hal/pulseio/PulseIn.c msgid "pop from an empty PulseIn" msgstr "pop sun un PulseIn vuoto" @@ -4154,7 +3840,23 @@ 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/espressif/boards/adafruit_qtpy_esp32_pico/mpconfigboard.h +msgid "pressing BOOT button at start up.\n" +msgstr "" + +#: ports/espressif/boards/adafruit_feather_esp32_v2/mpconfigboard.h +msgid "pressing SW38 button at start up.\n" +msgstr "" + +#: ports/espressif/boards/hardkernel_odroid_go/mpconfigboard.h +msgid "pressing VOLUME button at start up.\n" +msgstr "" + #: ports/espressif/boards/adafruit_qtpy_esp32c3/mpconfigboard.h +#: ports/espressif/boards/beetle-esp32-c3/mpconfigboard.h +#: ports/espressif/boards/espressif_esp32s2_devkitc_1_n8r2/mpconfigboard.h +#: ports/espressif/boards/lolin_c3_mini/mpconfigboard.h +#: ports/espressif/boards/microdev_micro_c3/mpconfigboard.h #: supervisor/shared/safe_mode.c msgid "pressing boot button at start up.\n" msgstr "" @@ -4175,14 +3877,6 @@ msgstr "" msgid "pull masks conflict with direction masks" msgstr "" -#: ports/raspberrypi/bindings/rp2pio/StateMachine.c -msgid "pull_threshold must be between 1 and 32" -msgstr "" - -#: ports/raspberrypi/bindings/rp2pio/StateMachine.c -msgid "push_threshold must be between 1 and 32" -msgstr "" - #: extmod/modutimeq.c msgid "queue overflow" msgstr "overflow della coda" @@ -4234,14 +3928,6 @@ msgstr "" msgid "rsplit(None,n)" msgstr "" -#: shared-bindings/audiocore/RawSample.c -msgid "" -"sample_source buffer must be a bytearray or array of type 'h', 'H', 'b' or " -"'B'" -msgstr "" -"il buffer sample_source deve essere un bytearray o un array di tipo 'h', " -"'H', 'b' o 'B'" - #: ports/atmel-samd/common-hal/audiobusio/PDMIn.c #: ports/raspberrypi/common-hal/audiobusio/PDMIn.c msgid "sampling rate out of range" @@ -4339,27 +4025,14 @@ msgstr "" msgid "source_bitmap must have value_count of 8" msgstr "" -#: shared-bindings/wifi/Radio.c -msgid "ssid can't be more than 32 bytes" -msgstr "" - #: py/objstr.c msgid "start/end indices" msgstr "" -#: shared-bindings/displayio/Shape.c -#, fuzzy -msgid "start_x should be an int" -msgstr "y dovrebbe essere un int" - #: shared-bindings/random/__init__.c msgid "step must be non-zero" msgstr "step deve essere non zero" -#: shared-bindings/busio/UART.c -msgid "stop must be 1 or 2" -msgstr "" - #: shared-bindings/random/__init__.c msgid "stop not reachable from start" msgstr "stop non raggiungibile dall'inizio" @@ -4408,10 +4081,6 @@ msgstr "errore di sintassi nel descrittore uctypes" msgid "threshold must be in the range 0-65536" msgstr "la soglia deve essere nell'intervallo 0-65536" -#: shared-bindings/rgbmatrix/RGBMatrix.c -msgid "tile must be greater than zero" -msgstr "" - #: shared-bindings/time/__init__.c msgid "time.struct_time() takes a 9-sequence" msgstr "" @@ -4431,11 +4100,6 @@ msgstr "" msgid "timeout must be < 655.35 secs" msgstr "" -#: shared-bindings/_bleio/CharacteristicBuffer.c -#, fuzzy -msgid "timeout must be >= 0.0" -msgstr "i bit devono essere 8" - #: shared-module/sdcardio/SDCard.c msgid "timeout waiting for v1 card" msgstr "" @@ -4444,6 +4108,10 @@ msgstr "" msgid "timeout waiting for v2 card" msgstr "" +#: ports/stm/common-hal/pwmio/PWMOut.c +msgid "timer re-init" +msgstr "" + #: shared-bindings/time/__init__.c msgid "timestamp out of range for platform time_t" msgstr "timestamp è fuori intervallo per il time_t della piattaforma" @@ -4509,14 +4177,10 @@ msgstr "il tipo '%q' non è un tipo di base accettabile" msgid "type is not an acceptable base type" msgstr "il tipo non è un tipo di base accettabile" -#: py/runtime.c +#: py/objgenerator.c py/runtime.c msgid "type object '%q' has no attribute '%q'" msgstr "l'oggetto di tipo '%q' non ha l'attributo '%q'" -#: py/objgenerator.c -msgid "type object 'generator' has no attribute '__await__'" -msgstr "" - #: py/objtype.c msgid "type takes 1 or 3 arguments" msgstr "tipo prende 1 o 3 argomenti" @@ -4575,7 +4239,6 @@ msgid "unreadable attribute" msgstr "attributo non leggibile" #: shared-bindings/displayio/TileGrid.c shared-bindings/vectorio/VectorShape.c -#: shared-module/vectorio/Polygon.c shared-module/vectorio/VectorShape.c msgid "unsupported %q type" msgstr "tipo di %q non supportato" @@ -4614,6 +4277,14 @@ msgstr "tipo non supportato per l'operando" msgid "unsupported types for %q: '%q', '%q'" msgstr "" +#: extmod/ulab/code/numpy/io/io.c +msgid "usecols is too high" +msgstr "" + +#: extmod/ulab/code/numpy/io/io.c +msgid "usecols keyword must be specified" +msgstr "" + #: py/objint.c #, c-format msgid "value must fit in %d byte(s)" @@ -4635,20 +4306,19 @@ msgstr "" msgid "watchdog timeout must be greater than 0" msgstr "" -#: shared-bindings/bitops/__init__.c -#, c-format -msgid "width must be from 2 to 8 (inclusive), not %d" -msgstr "" - #: shared-bindings/is31fl3741/FrameBuffer.c -#: shared-bindings/rgbmatrix/RGBMatrix.c msgid "width must be greater than zero" msgstr "" #: ports/espressif/common-hal/wifi/Radio.c +#: ports/raspberrypi/common-hal/wifi/Radio.c msgid "wifi is not enabled" msgstr "" +#: ports/raspberrypi/common-hal/wifi/Monitor.c +msgid "wifi.Monitor not available" +msgstr "" + #: shared-bindings/_bleio/Adapter.c msgid "window must be <= interval" msgstr "" @@ -4661,7 +4331,17 @@ msgstr "" msgid "wrong axis specified" msgstr "" -#: extmod/ulab/code/numpy/compare.c extmod/ulab/code/numpy/vector.c +#: extmod/ulab/code/numpy/io/io.c +msgid "wrong dtype" +msgstr "" + +#: extmod/ulab/code/numpy/transform.c +msgid "wrong index type" +msgstr "" + +#: extmod/ulab/code/numpy/compare.c extmod/ulab/code/numpy/create.c +#: extmod/ulab/code/numpy/io/io.c extmod/ulab/code/numpy/transform.c +#: extmod/ulab/code/numpy/vector.c msgid "wrong input type" msgstr "" @@ -4669,6 +4349,10 @@ msgstr "" msgid "wrong length of condition array" msgstr "" +#: extmod/ulab/code/numpy/transform.c +msgid "wrong length of index array" +msgstr "" + #: extmod/ulab/code/numpy/create.c py/objarray.c py/objstr.c msgid "wrong number of arguments" msgstr "numero di argomenti errato" @@ -4690,10 +4374,6 @@ msgstr "indirizzo fuori limite" msgid "xTaskCreate failed" msgstr "" -#: shared-bindings/displayio/Shape.c -msgid "y should be an int" -msgstr "y dovrebbe essere un int" - #: shared-module/displayio/Shape.c #, fuzzy msgid "y value out of bounds" @@ -4715,6 +4395,218 @@ msgstr "" msgid "zi must be of shape (n_section, 2)" msgstr "" +#~ msgid "Stream missing readinto() or write() method." +#~ msgstr "Metodi mancanti readinto() o write() allo stream." + +#~ msgid "%q must be >= 0" +#~ msgstr "%q deve essere >= 0" + +#, fuzzy +#~ msgid "%q must be >= 1" +#~ msgstr "slice del buffer devono essere della stessa lunghezza" + +#~ msgid "address out of bounds" +#~ msgstr "indirizzo fuori limite" + +#~ msgid "destination_length must be an int >= 0" +#~ msgstr "destination_length deve essere un int >= 0" + +#~ msgid "color should be an int" +#~ msgstr "il colore deve essere un int" + +#, fuzzy +#~ msgid "end_x should be an int" +#~ msgstr "y dovrebbe essere un int" + +#~ msgid "palette_index should be an int" +#~ msgstr "palette_index deve essere un int" + +#, fuzzy +#~ msgid "start_x should be an int" +#~ msgstr "y dovrebbe essere un int" + +#~ msgid "y should be an int" +#~ msgstr "y dovrebbe essere un int" + +#~ msgid "" +#~ "sample_source buffer must be a bytearray or array of type 'h', 'H', 'b' " +#~ "or 'B'" +#~ msgstr "" +#~ "il buffer sample_source deve essere un bytearray o un array di tipo 'h', " +#~ "'H', 'b' o 'B'" + +#~ msgid "%q must be a tuple of length 2" +#~ msgstr "%q deve essere una tupla di lunghezza 2" + +#~ msgid "%q should be an int" +#~ msgstr "%q dovrebbe essere un int" + +#~ msgid "Address type out of range" +#~ msgstr "Tipo di indirizzo fuori intervallo" + +#~ msgid "AnalogOut functionality not supported" +#~ msgstr "funzionalità AnalogOut non supportata" + +#~ msgid "AnalogOut is only 16 bits. Value must be less than 65536." +#~ msgstr "AnalogOut ha solo 16 bit. Il valore deve essere meno di 65536." + +#~ msgid "AnalogOut not supported on given pin" +#~ msgstr "AnalogOut non supportato sul pin scelto" + +#, c-format +#~ msgid "Bit depth must be from 1 to 6 inclusive, not %d" +#~ msgstr "La profondità dei bit deve essere inclusiva da 1 a 6, non %d" + +#, c-format +#~ msgid "Buffer incorrect size. Should be %d bytes." +#~ msgstr "Buffer di lunghezza non valida. Dovrebbe essere di %d bytes." + +#~ msgid "Buffer must be at least length 1" +#~ msgstr "Il buffer deve essere lungo almeno 1" + +#~ msgid "Bytes must be between 0 and 255." +#~ msgstr "I byte devono essere compresi tra 0 e 255." + +#~ msgid "Cannot output both channels on the same pin" +#~ msgstr "Impossibile dare in output entrambi i canal sullo stesso pin" + +#~ msgid "Cannot read without MISO pin." +#~ msgstr "Impossibile leggere senza pin MISO." + +#~ msgid "Cannot reset into bootloader because no bootloader is present." +#~ msgstr "" +#~ "Impossibile resettare nel bootloader poiché nessun bootloader è presente." + +#~ msgid "Cannot transfer without MOSI and MISO pins." +#~ msgstr "Impossibile trasferire senza i pin MOSI e MISO." + +#~ msgid "Cannot write without MOSI pin." +#~ msgstr "Impossibile scrivere senza pin MOSI." + +#~ msgid "Clock pin init failed." +#~ msgstr "Inizializzazione del pin di clock fallita." + +#, fuzzy +#~ msgid "Command must be an int between 0 and 255" +#~ msgstr "I byte devono essere compresi tra 0 e 255" + +#~ msgid "Could not initialize UART" +#~ msgstr "Impossibile inizializzare l'UART" + +#~ msgid "Couldn't allocate first buffer" +#~ msgstr "Impossibile allocare il primo buffer" + +#~ msgid "Couldn't allocate second buffer" +#~ msgstr "Impossibile allocare il secondo buffer" + +#~ msgid "Failed to allocate RX buffer" +#~ msgstr "Impossibile allocare buffer RX" + +#, c-format +#~ msgid "Failed to allocate RX buffer of %d bytes" +#~ msgstr "Fallita allocazione del buffer RX di %d byte" + +#~ msgid "Invalid BMP file" +#~ msgstr "File BMP non valido" + +#~ msgid "Invalid PWM frequency" +#~ msgstr "Frequenza PWM non valida" + +#, fuzzy +#~ msgid "Invalid buffer size" +#~ msgstr "lunghezza del buffer non valida" + +#~ msgid "Invalid capture period. Valid range: 1 - 500" +#~ msgstr "periodo di cattura invalido. Zona valida: 1 - 500" + +#, fuzzy +#~ msgid "Invalid channel count" +#~ msgstr "Argomento non valido" + +#~ msgid "Invalid direction." +#~ msgstr "Direzione non valida." + +#~ msgid "Invalid file" +#~ msgstr "File non valido" + +#~ msgid "Invalid number of bits" +#~ msgstr "Numero di bit non valido" + +#~ msgid "Invalid phase" +#~ msgstr "Fase non valida" + +#~ msgid "Invalid pin" +#~ msgstr "Pin non valido" + +#~ msgid "Invalid pin for left channel" +#~ msgstr "Pin non valido per il canale sinistro" + +#~ msgid "Invalid pin for right channel" +#~ msgstr "Pin non valido per il canale destro" + +#~ msgid "Invalid polarity" +#~ msgstr "Polarità non valida" + +#~ msgid "Invalid run mode." +#~ msgstr "Modalità di esecuzione non valida." + +#, fuzzy +#~ msgid "Invalid voice count" +#~ msgstr "Tipo di servizio non valido" + +#~ msgid "Invalid wave file" +#~ msgstr "File wave non valido" + +#~ msgid "Layer must be a Group or TileGrid subclass." +#~ msgstr "Layer deve essere un Group o TileGrid subclass" + +#~ msgid "MISO pin init failed." +#~ msgstr "inizializzazione del pin MISO fallita." + +#~ msgid "MOSI pin init failed." +#~ msgstr "inizializzazione del pin MOSI fallita." + +#~ msgid "No hardware support on pin" +#~ msgstr "Nessun supporto hardware sul pin" + +#~ msgid "" +#~ "PWM duty_cycle must be between 0 and 65535 inclusive (16 bit resolution)" +#~ msgstr "" +#~ "duty_cycle del PWM deve essere compresa tra 0 e 65535 inclusiva " +#~ "(risoluzione a 16 bit)" + +#~ msgid "Pin does not have ADC capabilities" +#~ msgstr "Il pin non ha capacità di ADC" + +#~ msgid "RTC calibration is not supported on this board" +#~ msgstr "calibrazione RTC non supportata su questa scheda" + +#, fuzzy +#~ msgid "Sample rate must be positive" +#~ msgstr "STA deve essere attiva" + +#, c-format +#~ msgid "Sample rate too high. It must be less than %d" +#~ msgstr "" +#~ "Frequenza di campionamento troppo alta. Il valore deve essere inferiore a " +#~ "%d" + +#~ msgid "Stack size must be at least 256" +#~ msgstr "La dimensione dello stack deve essere almeno 256" + +#~ msgid "Unsupported baudrate" +#~ msgstr "baudrate non supportato" + +#~ msgid "bytes > 8 bits not supported" +#~ msgstr "byte > 8 bit non supportati" + +#~ msgid "calibration value out of range +/-127" +#~ msgstr "valore di calibrazione fuori intervallo +/-127" + +#, fuzzy +#~ msgid "timeout must be >= 0.0" +#~ msgstr "i bit devono essere 8" + #~ msgid "Unsupported operation" #~ msgstr "Operazione non supportata" @@ -4819,12 +4711,6 @@ msgstr "" #~ msgid "can only save bytecode" #~ msgstr "È possibile salvare solo bytecode" -#~ msgid "invalid cert" -#~ msgstr "certificato non valido" - -#~ msgid "invalid key" -#~ msgstr "chiave non valida" - #~ msgid "Viper functions don't currently support more than 4 arguments" #~ msgstr "Le funzioni Viper non supportano più di 4 argomenti al momento" diff --git a/locale/ja.po b/locale/ja.po index d5615d92f8..2db88128a2 100644 --- a/locale/ja.po +++ b/locale/ja.po @@ -65,16 +65,38 @@ msgstr " 出力:\n" msgid "%%c requires int or char" msgstr "%%c にはintまたはcharが必要" +#: main.c +#, c-format +msgid "%02X" +msgstr "" + #: shared-bindings/rgbmatrix/RGBMatrix.c #, c-format msgid "" "%d address pins, %d rgb pins and %d tiles indicate a height of %d, not %d" msgstr "" +#: ports/atmel-samd/common-hal/alarm/__init__.c +#: ports/cxd56/common-hal/analogio/AnalogOut.c ports/cxd56/common-hal/rtc/RTC.c +#: ports/espressif/common-hal/rtc/RTC.c +#: ports/mimxrt10xx/common-hal/analogio/AnalogOut.c +#: ports/mimxrt10xx/common-hal/rtc/RTC.c ports/nrf/common-hal/alarm/__init__.c +#: ports/nrf/common-hal/analogio/AnalogOut.c ports/nrf/common-hal/rtc/RTC.c +#: ports/raspberrypi/common-hal/alarm/__init__.c +#: ports/raspberrypi/common-hal/analogio/AnalogOut.c +#: ports/raspberrypi/common-hal/rtc/RTC.c ports/stm/common-hal/alarm/__init__.c +#: ports/stm/common-hal/rtc/RTC.c +msgid "%q" +msgstr "" + #: shared-bindings/microcontroller/Pin.c msgid "%q and %q contain duplicate pins" msgstr "" +#: ports/atmel-samd/common-hal/audioio/AudioOut.c +msgid "%q and %q must be different" +msgstr "" + #: shared-bindings/microcontroller/Pin.c msgid "%q contains duplicate pins" msgstr "" @@ -83,16 +105,12 @@ msgstr "" msgid "%q failure: %d" msgstr "%q 失敗: %d" +#: shared-bindings/digitalio/DigitalInOut.c #: shared-bindings/microcontroller/Pin.c msgid "%q in use" msgstr "%qは使用中" -#: ports/atmel-samd/common-hal/pulseio/PulseIn.c -#: ports/cxd56/common-hal/pulseio/PulseIn.c -#: ports/nrf/common-hal/pulseio/PulseIn.c -#: ports/raspberrypi/common-hal/pulseio/PulseIn.c -#: ports/stm/common-hal/pulseio/PulseIn.c py/obj.c py/objstr.c -#: py/objstrunicode.c +#: py/obj.c py/objstr.c py/objstrunicode.c msgid "%q index out of range" msgstr "%q インデックスは範囲外" @@ -100,14 +118,34 @@ msgstr "%q インデックスは範囲外" msgid "%q indices must be integers, not %s" msgstr "" +#: shared-module/bitbangio/SPI.c +msgid "%q init failed" +msgstr "" + +#: py/argcheck.c +msgid "%q length must be %d" +msgstr "" + #: py/argcheck.c msgid "%q length must be %d-%d" msgstr "" -#: shared-bindings/busio/I2C.c shared-bindings/usb_hid/Device.c +#: py/argcheck.c +msgid "%q length must be <= %d" +msgstr "" + +#: py/argcheck.c +msgid "%q length must be >= %d" +msgstr "" + +#: shared-bindings/busio/I2C.c msgid "%q length must be >= 1" msgstr "" +#: py/argcheck.c +msgid "%q must be %d" +msgstr "" + #: py/argcheck.c msgid "%q must be %d-%d" msgstr "" @@ -124,29 +162,17 @@ msgstr "" msgid "%q must be >= %d" msgstr "" -#: py/argcheck.c shared-bindings/memorymonitor/AllocationAlarm.c -msgid "%q must be >= 0" -msgstr "%qは0以上でなければなりません" - -#: shared-bindings/_bleio/CharacteristicBuffer.c -#: shared-bindings/_bleio/PacketBuffer.c shared-bindings/displayio/Group.c -#: shared-bindings/displayio/Shape.c -#: shared-bindings/memorymonitor/AllocationAlarm.c -#: shared-bindings/vectorio/Circle.c shared-bindings/vectorio/Rectangle.c -msgid "%q must be >= 1" -msgstr "%qは1以上でなければなりません" +#: shared-bindings/analogbufio/BufferedIn.c +#: shared-bindings/audiocore/RawSample.c +msgid "%q must be a bytearray or array of type 'h', 'H', 'b', or 'B'" +msgstr "" #: py/argcheck.c msgid "%q must be a string" msgstr "" -#: shared-module/vectorio/Polygon.c -msgid "%q must be a tuple of length 2" -msgstr "%qは長さ2のタプルでなければなりません" - -#: ports/espressif/common-hal/imagecapture/ParallelImageCapture.c -#: shared-module/vectorio/VectorShape.c -msgid "%q must be between %d and %d" +#: py/argcheck.c +msgid "%q must be an int" msgstr "" #: py/argcheck.c @@ -165,7 +191,11 @@ msgstr "" msgid "%q out of bounds" msgstr "" +#: ports/atmel-samd/common-hal/pulseio/PulseIn.c +#: ports/cxd56/common-hal/pulseio/PulseIn.c +#: ports/nrf/common-hal/pulseio/PulseIn.c #: ports/raspberrypi/common-hal/rp2pio/StateMachine.c +#: ports/stm/common-hal/pulseio/PulseIn.c py/argcheck.c #: shared-bindings/canio/Match.c msgid "%q out of range" msgstr "%q が範囲外" @@ -174,10 +204,6 @@ msgstr "%q が範囲外" msgid "%q pin invalid" msgstr "%q ピンは無効" -#: shared-bindings/fontio/BuiltinFont.c -msgid "%q should be an int" -msgstr "%qはint型でなければなりません" - #: shared-bindings/usb_hid/Device.c msgid "%q with a report ID of 0 must be of length 1" msgstr "" @@ -190,7 +216,11 @@ msgstr "%q() は %d 個の位置引数を取りますが、%d 個与えられま msgid "%q, %q, and %q must all be the same length" msgstr "" -#: ports/espressif/bindings/espidf/__init__.c ports/espressif/esp_error.c +#: py/objint.c +msgid "%q=%q" +msgstr "" + +#: ports/espressif/common-hal/espidf/__init__.c ports/espressif/esp_error.c #, c-format msgid "%s error 0x%x" msgstr "" @@ -275,7 +305,7 @@ msgstr "" msgid "'%s' object doesn't support item deletion" msgstr "" -#: py/runtime.c +#: ports/raspberrypi/common-hal/wifi/Radio.c py/runtime.c msgid "'%s' object has no attribute '%q'" msgstr "" @@ -340,10 +370,6 @@ msgstr "" msgid "'yield' outside function" msgstr "関数外でのyield" -#: shared-module/vectorio/VectorShape.c -msgid "(x,y) integers required" -msgstr "" - #: py/compile.c msgid "*x must be assignment target" msgstr "*xは代入先でなければなりません" @@ -379,16 +405,12 @@ msgstr "" msgid "Address must be %d bytes long" msgstr "アドレスは、%dバイト長でなければなりません" -#: shared-bindings/_bleio/Address.c -msgid "Address type out of range" -msgstr "address_typeが範囲外" - #: ports/espressif/common-hal/canio/CAN.c msgid "All CAN peripherals are in use" msgstr "全てのCAN周辺機器が使用中" #: ports/espressif/common-hal/busio/I2C.c -#: ports/espressif/common-hal/i2cperipheral/I2CPeripheral.c +#: ports/espressif/common-hal/i2ctarget/I2CTarget.c #: ports/nrf/common-hal/busio/I2C.c msgid "All I2C peripherals are in use" msgstr "全てのI2C周辺機器が使用中" @@ -425,7 +447,6 @@ msgstr "" msgid "All event channels in use" msgstr "全てのイベントチャネルが使用中" -#: ports/raspberrypi/common-hal/pulseio/PulseIn.c #: ports/raspberrypi/common-hal/rp2pio/StateMachine.c msgid "All state machines in use" msgstr "" @@ -470,28 +491,10 @@ msgid "Already running" msgstr "すでに実行中" #: ports/espressif/common-hal/wifi/Radio.c +#: ports/raspberrypi/common-hal/wifi/Radio.c msgid "Already scanning for wifi networks" msgstr "" -#: ports/cxd56/common-hal/analogio/AnalogIn.c -msgid "AnalogIn not supported on given pin" -msgstr "指定のピンはAnalogInに対応していません" - -#: ports/cxd56/common-hal/analogio/AnalogOut.c -#: ports/mimxrt10xx/common-hal/analogio/AnalogOut.c -#: ports/nrf/common-hal/analogio/AnalogOut.c -#: ports/raspberrypi/common-hal/analogio/AnalogOut.c -msgid "AnalogOut functionality not supported" -msgstr "AnalogOut機能に対応していません" - -#: shared-bindings/analogio/AnalogOut.c -msgid "AnalogOut is only 16 bits. Value must be less than 65536." -msgstr "AnalogOutは16ビットです。値は65536以下でなければなりません" - -#: ports/atmel-samd/common-hal/analogio/AnalogOut.c -msgid "AnalogOut not supported on given pin" -msgstr "指定のピンはAnalogOutに対応していません" - #: ports/stm/common-hal/audiopwmio/PWMAudioOut.c msgid "Another PWMAudioOut is already active" msgstr "" @@ -530,7 +533,7 @@ msgstr "" msgid "AuthMode.OPEN is not used with password" msgstr "" -#: shared-bindings/wifi/Radio.c +#: shared-bindings/wifi/Radio.c supervisor/shared/web_workflow/web_workflow.c msgid "Authentication failure" msgstr "認証失敗" @@ -563,11 +566,6 @@ 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の倍数でなければなりません" @@ -609,11 +607,6 @@ msgstr "buffer + offsetが小さすぎます %d %d %d" msgid "Buffer elements must be 4 bytes long or less" msgstr "" -#: shared-module/usb_hid/Device.c -#, c-format -msgid "Buffer incorrect size. Should be %d bytes." -msgstr "バッファサイズが不正です。%dバイトでなければなりません" - #: shared-bindings/framebufferio/FramebufferDisplay.c msgid "Buffer is not a bytearray." msgstr "バッファがbytearrayではありません" @@ -623,7 +616,6 @@ msgstr "バッファがbytearrayではありません" msgid "Buffer is too small" msgstr "バッファが小さすぎます" -#: ports/nrf/common-hal/audiopwmio/PWMAudioOut.c #: ports/stm/common-hal/audiopwmio/PWMAudioOut.c #, c-format msgid "Buffer length %d too big. It must be less than %d" @@ -638,10 +630,6 @@ msgstr "バッファ長は512の倍数でなければなりません" msgid "Buffer must be a multiple of 512 bytes" msgstr "バッファは512の倍数でなければなりません" -#: shared-bindings/bitbangio/I2C.c -msgid "Buffer must be at least length 1" -msgstr "バッファ長は少なくとも1以上でなければなりません" - #: shared-bindings/_bleio/PacketBuffer.c #, c-format msgid "Buffer too short by %d bytes" @@ -663,10 +651,6 @@ msgstr "Busピン%dはすでに使用中" msgid "Byte buffer must be 16 bytes." msgstr "バッファは16バイトでなければなりません" -#: shared-bindings/alarm/SleepMemory.c shared-bindings/nvm/ByteArray.c -msgid "Bytes must be between 0 and 255." -msgstr "バイト値は0から255の間でなければなりません" - #: shared-bindings/aesio/aes.c msgid "CBC blocks must be multiples of 16 bytes" msgstr "CBCブロックは16バイトの整数倍でなければなりません" @@ -675,7 +659,7 @@ msgstr "CBCブロックは16バイトの整数倍でなければなりません" msgid "CIRCUITPY drive could not be found or created." msgstr "" -#: ports/espressif/bindings/espidf/__init__.c ports/espressif/esp_error.c +#: ports/espressif/common-hal/espidf/__init__.c ports/espressif/esp_error.c msgid "CRC or checksum was invalid" msgstr "" @@ -685,6 +669,10 @@ msgstr "" "ネイティブオブジェクトにアクセスする前にsuper().__init__()を呼び出してくださ" "い" +#: ports/cxd56/common-hal/camera/Camera.c +msgid "Camera init" +msgstr "" + #: ports/espressif/common-hal/alarm/pin/PinAlarm.c msgid "Can only alarm on RTC IO from deep sleep." msgstr "" @@ -732,18 +720,10 @@ msgstr "温度を取得できません" msgid "Cannot have scan responses for extended, connectable advertisements." msgstr "" -#: ports/atmel-samd/common-hal/audioio/AudioOut.c -msgid "Cannot output both channels on the same pin" -msgstr "同じピン上の両チャネルに出力できません" - #: ports/espressif/common-hal/alarm/pin/PinAlarm.c msgid "Cannot pull on input-only pin." msgstr "" -#: shared-module/bitbangio/SPI.c -msgid "Cannot read without MISO pin." -msgstr "MISOピンなしで読み込めません" - #: shared-bindings/audiobusio/PDMIn.c msgid "Cannot record to a file" msgstr "ファイルへ記録できません" @@ -755,8 +735,8 @@ msgstr "" #: ports/atmel-samd/common-hal/microcontroller/__init__.c #: ports/cxd56/common-hal/microcontroller/__init__.c #: ports/mimxrt10xx/common-hal/microcontroller/__init__.c -msgid "Cannot reset into bootloader because no bootloader is present." -msgstr "ブートローダが存在しないためブートローダへとリセットできません" +msgid "Cannot reset into bootloader because no bootloader is present" +msgstr "" #: ports/espressif/common-hal/socketpool/Socket.c msgid "Cannot set socket options" @@ -776,21 +756,20 @@ msgid "Cannot subclass slice" msgstr "sliceをサブクラス化することはできません" #: shared-module/bitbangio/SPI.c -msgid "Cannot transfer without MOSI and MISO pins." -msgstr "MOSIピンとMISOピンなしに転送できません" +msgid "Cannot transfer without MOSI and MISO pins" +msgstr "" #: shared-bindings/pwmio/PWMOut.c msgid "Cannot vary frequency on a timer that is already in use" msgstr "使用中のタイマー上では周波数を変えられません" -#: ports/espressif/common-hal/alarm/pin/PinAlarm.c #: ports/nrf/common-hal/alarm/pin/PinAlarm.c -msgid "Cannot wake on pin edge. Only level." +msgid "Cannot wake on pin edge, only level" msgstr "" -#: shared-module/bitbangio/SPI.c -msgid "Cannot write without MOSI pin." -msgstr "MOSIピンなしで書き込みできません" +#: ports/espressif/common-hal/alarm/pin/PinAlarm.c +msgid "Cannot wake on pin edge. Only level." +msgstr "" #: shared-bindings/_bleio/CharacteristicBuffer.c msgid "CharacteristicBuffer writing not provided" @@ -804,10 +783,6 @@ msgstr "CircuitPythonのコアコードが激しくクラッシュしました msgid "CircuitPython was unable to allocate the heap." msgstr "CircuitPythonはヒープを確保できませんでした" -#: shared-module/bitbangio/SPI.c -msgid "Clock pin init failed." -msgstr "クロックピン初期化に失敗" - #: shared-module/bitbangio/I2C.c msgid "Clock stretch too long" msgstr "クロックのストレッチが長すぎ" @@ -816,11 +791,6 @@ msgstr "クロックのストレッチが長すぎ" msgid "Clock unit in use" msgstr "クロックユニットは使用中" -#: shared-bindings/displayio/FourWire.c shared-bindings/displayio/I2CDisplay.c -#: shared-bindings/paralleldisplay/ParallelBus.c -msgid "Command must be an int between 0 and 255" -msgstr "commandは0から255の間の整数でなければなりません" - #: shared-bindings/_bleio/Connection.c msgid "" "Connection has been disconnected and can no longer be used. Create a new " @@ -831,35 +801,6 @@ msgstr "接続は切断済みでもう使えません。新しい接続を作成 msgid "Corrupt .mpy file" msgstr "破損した .mpy ファイル" -#: ports/cxd56/common-hal/camera/Camera.c -msgid "Could not initialize Camera" -msgstr "カメラを初期化できません" - -#: ports/cxd56/common-hal/gnss/GNSS.c -msgid "Could not initialize GNSS" -msgstr "GNSSを初期化できません" - -#: ports/cxd56/common-hal/sdioio/SDCard.c -msgid "Could not initialize SDCard" -msgstr "SDカードを初期化できません" - -#: ports/atmel-samd/common-hal/busio/UART.c ports/cxd56/common-hal/busio/UART.c -#: ports/espressif/common-hal/busio/UART.c -msgid "Could not initialize UART" -msgstr "UARTを初期化できません" - -#: ports/stm/common-hal/pwmio/PWMOut.c -msgid "Could not re-init channel" -msgstr "チャネルを再初期化できません" - -#: ports/stm/common-hal/pwmio/PWMOut.c -msgid "Could not re-init timer" -msgstr "タイマーを再初期化できません" - -#: ports/stm/common-hal/pwmio/PWMOut.c -msgid "Could not restart PWM" -msgstr "PWMを再スタートできません" - #: ports/espressif/common-hal/neopixel_write/__init__.c msgid "Could not retrieve clock" msgstr "" @@ -880,20 +821,6 @@ msgstr "割り込みをスタートできません。RXビジー" msgid "Couldn't allocate decoder" msgstr "デコーダを確保できません" -#: shared-module/audiocore/WaveFile.c shared-module/audiomixer/Mixer.c -#: shared-module/audiomp3/MP3Decoder.c -msgid "Couldn't allocate first buffer" -msgstr "1つ目のバッファを確保できません" - -#: shared-module/audiomp3/MP3Decoder.c -msgid "Couldn't allocate input buffer" -msgstr "入力バッファを確保できません" - -#: shared-module/audiocore/WaveFile.c shared-module/audiomixer/Mixer.c -#: shared-module/audiomp3/MP3Decoder.c -msgid "Couldn't allocate second buffer" -msgstr "2つ目のバッファを確保できません" - #: supervisor/shared/safe_mode.c msgid "Crash into the HardFault_Handler." msgstr "クラッシュしてHardFault_Handlerに入りました" @@ -941,10 +868,6 @@ msgstr "宛先バッファがdestination_lengthより小さい" msgid "Device in use" msgstr "デバイス使用中" -#: ports/cxd56/common-hal/digitalio/DigitalInOut.c -msgid "DigitalInOut not supported on given pin" -msgstr "指定されたピンはDigitalInOutに対応していません" - #: shared-bindings/displayio/Display.c #: shared-bindings/framebufferio/FramebufferDisplay.c msgid "Display must have a 16 bit colorspace." @@ -956,6 +879,10 @@ msgstr "ディスプレイは16ビット色空間を持たなければなりま msgid "Display rotation must be in 90 degree increments" msgstr "ディスプレイの回転は90度の倍数でなければなりません" +#: main.c +msgid "Done" +msgstr "" + #: shared-bindings/digitalio/DigitalInOut.c msgid "Drive mode not used when direction is input." msgstr "方向がinputのときドライブモードは使われません" @@ -989,20 +916,19 @@ msgstr "正規表現にエラーがあります" msgid "Error: Failure to bind" msgstr "" -#: ports/raspberrypi/bindings/rp2pio/StateMachine.c py/enum.c -#: shared-bindings/_bleio/__init__.c shared-bindings/aesio/aes.c -#: shared-bindings/busio/SPI.c shared-bindings/microcontroller/Pin.c +#: py/enum.c shared-bindings/_bleio/__init__.c shared-bindings/aesio/aes.c +#: shared-bindings/alarm/__init__.c shared-bindings/busio/SPI.c +#: shared-bindings/microcontroller/Pin.c #: shared-bindings/neopixel_write/__init__.c msgid "Expected a %q" msgstr "%qが必要" -#: shared-bindings/alarm/__init__.c -msgid "Expected an alarm" +#: ports/raspberrypi/bindings/cyw43/__init__.c +msgid "Expected a %q or %q" msgstr "" -#: shared-module/adafruit_pixelbuf/PixelBuf.c -#, c-format -msgid "Expected tuple of length %d, got %d" +#: shared-bindings/alarm/__init__.c +msgid "Expected an %q" msgstr "" #: ports/espressif/common-hal/_bleio/Adapter.c @@ -1031,21 +957,9 @@ msgstr "コマンド送信に失敗" msgid "Failed to acquire mutex, err 0x%04x" msgstr "ミューテックスの取得に失敗。エラー 0x%04x" -#: ports/mimxrt10xx/common-hal/busio/UART.c ports/nrf/common-hal/busio/UART.c -#: ports/raspberrypi/common-hal/busio/UART.c -msgid "Failed to allocate RX buffer" -msgstr "RXバッファの確保に失敗" - -#: ports/atmel-samd/common-hal/busio/UART.c -#: ports/atmel-samd/common-hal/pulseio/PulseIn.c -#: ports/cxd56/common-hal/pulseio/PulseIn.c -#: ports/espressif/common-hal/pulseio/PulseIn.c -#: ports/nrf/common-hal/pulseio/PulseIn.c -#: ports/raspberrypi/common-hal/pulseio/PulseIn.c -#: ports/stm/common-hal/pulseio/PulseIn.c -#, c-format -msgid "Failed to allocate RX buffer of %d bytes" -msgstr "%dバイトのRXバッファの確保に失敗" +#: shared-module/rgbmatrix/RGBMatrix.c +msgid "Failed to allocate %q buffer" +msgstr "" #: ports/espressif/common-hal/wifi/__init__.c msgid "Failed to allocate Wifi memory" @@ -1068,10 +982,6 @@ msgstr "接続失敗: 内部エラー" msgid "Failed to connect: timeout" msgstr "接続失敗: タイムアウト" -#: ports/espressif/common-hal/wifi/__init__.c -msgid "Failed to init wifi" -msgstr "" - #: shared-module/audiomp3/MP3Decoder.c msgid "Failed to parse MP3 file" msgstr "MP3ファイルのパーズに失敗" @@ -1115,11 +1025,6 @@ msgstr "" msgid "Format not supported" msgstr "非対応の形式" -#: shared-module/framebufferio/FramebufferDisplay.c -#, c-format -msgid "Framebuffer requires %d bytes" -msgstr "" - #: ports/mimxrt10xx/common-hal/microcontroller/Processor.c msgid "" "Frequency must be 24, 150, 396, 450, 528, 600, 720, 816, 912, 960 or 1008 Mhz" @@ -1134,7 +1039,11 @@ msgstr "このタイマーを使う既存のPWMOutと周波数を一致させる msgid "Function requires lock" msgstr "" -#: ports/espressif/bindings/espidf/__init__.c ports/espressif/esp_error.c +#: ports/cxd56/common-hal/gnss/GNSS.c +msgid "GNSS init" +msgstr "" + +#: ports/espressif/common-hal/espidf/__init__.c ports/espressif/esp_error.c msgid "Generic Failure" msgstr "" @@ -1161,19 +1070,16 @@ msgstr "ハードウェアビジー。代替のピンを試してください" msgid "Hardware in use, try alternative pins" msgstr "ハードウェア使用中。代わりのピンを試してください" -#: shared-bindings/wifi/Radio.c -msgid "Hostname must be between 1 and 253 characters" -msgstr "" - #: extmod/vfs_posix_file.c py/objstringio.c msgid "I/O operation on closed file" msgstr "閉じられたファイルへのI/O操作" #: ports/stm/common-hal/busio/I2C.c -msgid "I2C Init Error" -msgstr "I2C初期化エラー" +msgid "I2C init error" +msgstr "" #: ports/raspberrypi/common-hal/busio/I2C.c +#: ports/raspberrypi/common-hal/i2ctarget/I2CTarget.c msgid "I2C peripheral in use" msgstr "" @@ -1280,75 +1186,37 @@ msgstr "" msgid "Internal error #%d" msgstr "内部エラー #%d" -#: shared-bindings/sdioio/SDCard.c shared-module/usb_hid/Device.c +#: supervisor/shared/safe_mode.c +msgid "Internal watchdog timer expired." +msgstr "" + +#: py/argcheck.c shared-bindings/digitalio/DigitalInOut.c msgid "Invalid %q" msgstr "不正な %q" -#: ports/atmel-samd/common-hal/audiobusio/I2SOut.c -#: ports/atmel-samd/common-hal/audiobusio/PDMIn.c -#: ports/atmel-samd/common-hal/imagecapture/ParallelImageCapture.c -#: ports/mimxrt10xx/common-hal/busio/UART.c +#: shared-bindings/microcontroller/Pin.c msgid "Invalid %q pin" msgstr "不正な%qピン" -#: ports/stm/common-hal/busio/I2C.c ports/stm/common-hal/busio/SPI.c -#: ports/stm/common-hal/busio/UART.c ports/stm/common-hal/canio/CAN.c -#: ports/stm/common-hal/sdioio/SDCard.c -msgid "Invalid %q pin selection" -msgstr "不正な%qピン選択" - #: ports/stm/common-hal/analogio/AnalogIn.c msgid "Invalid ADC Unit value" msgstr "不正なADCユニット値" -#: ports/espressif/common-hal/wifi/Radio.c -msgid "Invalid AuthMode" -msgstr "" - #: ports/espressif/common-hal/_bleio/__init__.c #: ports/nrf/common-hal/_bleio/__init__.c msgid "Invalid BLE parameter" msgstr "" -#: shared-module/displayio/OnDiskBitmap.c -msgid "Invalid BMP file" -msgstr "不正なBMPファイル" - #: shared-bindings/wifi/Radio.c msgid "Invalid BSSID" msgstr "不正なBSSID" -#: ports/espressif/common-hal/analogio/AnalogOut.c -#: ports/stm/common-hal/analogio/AnalogOut.c -msgid "Invalid DAC pin supplied" -msgstr "不正なDACピンが与えられました" - #: shared-bindings/wifi/Radio.c msgid "Invalid MAC address" msgstr "" -#: shared-bindings/synthio/__init__.c -msgid "Invalid MIDI file" -msgstr "" - -#: ports/atmel-samd/common-hal/pwmio/PWMOut.c -#: ports/cxd56/common-hal/pwmio/PWMOut.c -#: ports/espressif/common-hal/pwmio/PWMOut.c -#: ports/mimxrt10xx/common-hal/pwmio/PWMOut.c -#: ports/nrf/common-hal/pwmio/PWMOut.c -#: ports/raspberrypi/common-hal/pwmio/PWMOut.c shared-bindings/pwmio/PWMOut.c -msgid "Invalid PWM frequency" -msgstr "無効なPWM周波数" - -#: ports/espressif/common-hal/analogio/AnalogIn.c -msgid "Invalid Pin" -msgstr "" - -#: ports/espressif/bindings/espidf/__init__.c -#: ports/espressif/common-hal/busio/I2C.c -#: ports/espressif/common-hal/i2cperipheral/I2CPeripheral.c -#: ports/espressif/esp_error.c py/moduerrno.c -#: shared-module/rgbmatrix/RGBMatrix.c +#: ports/espressif/common-hal/espidf/__init__.c ports/espressif/esp_error.c +#: py/moduerrno.c msgid "Invalid argument" msgstr "不正な引数" @@ -1356,42 +1224,11 @@ msgstr "不正な引数" msgid "Invalid bits per value" msgstr "不正なbits per value" -#: ports/nrf/common-hal/busio/UART.c ports/raspberrypi/common-hal/busio/UART.c -#: ports/stm/common-hal/busio/UART.c -msgid "Invalid buffer size" -msgstr "不正なバッファサイズ" - -#: shared-bindings/adafruit_pixelbuf/PixelBuf.c -msgid "Invalid byteorder string" -msgstr "不正なバイトオーダー文字列" - -#: ports/atmel-samd/common-hal/frequencyio/FrequencyIn.c -#: ports/espressif/common-hal/frequencyio/FrequencyIn.c -msgid "Invalid capture period. Valid range: 1 - 500" -msgstr "不正なキャプチャ周期。有効な周期は1-500" - -#: shared-bindings/audiomixer/Mixer.c -msgid "Invalid channel count" -msgstr "不正なチャンネル数" - -#: ports/atmel-samd/common-hal/imagecapture/ParallelImageCapture.c -#, c-format -msgid "Invalid data_count %d" -msgstr "" - #: ports/atmel-samd/common-hal/imagecapture/ParallelImageCapture.c #, c-format msgid "Invalid data_pins[%d]" msgstr "" -#: shared-bindings/digitalio/DigitalInOut.c -msgid "Invalid direction." -msgstr "不正な方向" - -#: shared-module/audiocore/WaveFile.c -msgid "Invalid file" -msgstr "不正なファイル" - #: shared-module/audiocore/WaveFile.c msgid "Invalid format chunk size" msgstr "フォーマットチャンクのサイズが不正" @@ -1400,107 +1237,27 @@ msgstr "フォーマットチャンクのサイズが不正" msgid "Invalid memory access." msgstr "不正なメモリアクセス" -#: extmod/vfs_fat_file.c -msgid "Invalid mode" -msgstr "" - #: ports/espressif/common-hal/wifi/Radio.c msgid "Invalid multicast MAC address" msgstr "" -#: shared-bindings/bitbangio/SPI.c shared-bindings/busio/SPI.c -msgid "Invalid number of bits" -msgstr "不正なビット数" - -#: shared-bindings/bitbangio/SPI.c shared-bindings/busio/SPI.c -#: shared-bindings/displayio/FourWire.c -msgid "Invalid phase" -msgstr "不正なphase" - -#: ports/atmel-samd/common-hal/audioio/AudioOut.c -#: ports/atmel-samd/common-hal/touchio/TouchIn.c -#: ports/espressif/common-hal/alarm/touch/TouchAlarm.c -#: ports/espressif/common-hal/touchio/TouchIn.c -#: ports/nrf/common-hal/alarm/pin/PinAlarm.c shared-bindings/pwmio/PWMOut.c -#: shared-module/rgbmatrix/RGBMatrix.c -msgid "Invalid pin" -msgstr "不正なピン" - -#: ports/atmel-samd/common-hal/audioio/AudioOut.c -msgid "Invalid pin for left channel" -msgstr "左チャネルのピンが不正" - -#: ports/atmel-samd/common-hal/audioio/AudioOut.c -msgid "Invalid pin for right channel" -msgstr "右チャネルのピンが不正" - -#: ports/atmel-samd/common-hal/busio/I2C.c -#: ports/atmel-samd/common-hal/busio/SPI.c -#: ports/atmel-samd/common-hal/busio/UART.c -#: ports/atmel-samd/common-hal/i2cperipheral/I2CPeripheral.c -#: ports/cxd56/common-hal/busio/I2C.c ports/cxd56/common-hal/busio/SPI.c -#: ports/cxd56/common-hal/busio/UART.c ports/cxd56/common-hal/sdioio/SDCard.c -#: ports/espressif/common-hal/busio/I2C.c -#: ports/espressif/common-hal/busio/SPI.c -#: ports/espressif/common-hal/busio/UART.c -#: ports/espressif/common-hal/canio/CAN.c -#: ports/espressif/common-hal/i2cperipheral/I2CPeripheral.c -#: ports/mimxrt10xx/common-hal/busio/I2C.c -#: ports/mimxrt10xx/common-hal/busio/SPI.c -#: ports/mimxrt10xx/common-hal/usb_host/Port.c ports/nrf/common-hal/busio/I2C.c -#: ports/raspberrypi/common-hal/busio/I2C.c -#: ports/raspberrypi/common-hal/busio/SPI.c -#: ports/raspberrypi/common-hal/busio/UART.c shared-bindings/busio/SPI.c #: shared-bindings/busio/UART.c msgid "Invalid pins" msgstr "ピンが不正" -#: shared-bindings/bitbangio/SPI.c shared-bindings/busio/SPI.c -#: shared-bindings/displayio/FourWire.c -msgid "Invalid polarity" -msgstr "不正な極性" - -#: shared-bindings/_bleio/Characteristic.c -msgid "Invalid properties" -msgstr "不正なプロパティ" - -#: shared-bindings/microcontroller/__init__.c -msgid "Invalid run mode." -msgstr "不正なrun mode" - -#: shared-module/_bleio/Attribute.c -msgid "Invalid security_mode" -msgstr "不正なsecurity_mode" - -#: ports/espressif/bindings/espidf/__init__.c ports/espressif/esp_error.c +#: ports/espressif/common-hal/espidf/__init__.c ports/espressif/esp_error.c msgid "Invalid size" msgstr "" #: ports/espressif/common-hal/ssl/SSLContext.c +#: ports/raspberrypi/common-hal/ssl/SSLSocket.c msgid "Invalid socket for TLS" msgstr "" -#: ports/espressif/bindings/espidf/__init__.c ports/espressif/esp_error.c +#: ports/espressif/common-hal/espidf/__init__.c ports/espressif/esp_error.c msgid "Invalid state" msgstr "" -#: shared-bindings/audiomixer/Mixer.c -msgid "Invalid voice" -msgstr "不正なボイス" - -#: shared-bindings/audiomixer/Mixer.c -msgid "Invalid voice count" -msgstr "不正なボイス数" - -#: shared-module/audiocore/WaveFile.c -msgid "Invalid wave file" -msgstr "不正なwaveファイル" - -#: ports/mimxrt10xx/common-hal/busio/UART.c ports/nrf/common-hal/busio/UART.c -#: ports/raspberrypi/common-hal/busio/UART.c ports/stm/common-hal/busio/UART.c -msgid "Invalid word/bit length" -msgstr "不正なワード/ビット長" - #: shared-bindings/aesio/aes.c msgid "Key must be 16, 24, or 32 bytes long" msgstr "Keyの長さは、16, 24, 32バイトのいずれかでなければなりません" @@ -1514,24 +1271,16 @@ msgid "LHS of keyword arg must be an id" msgstr "キーワード引数の左辺には識別子が必要" #: shared-module/displayio/Group.c -msgid "Layer already in a group." -msgstr "レイヤはすでにグループに含まれています" - -#: shared-module/displayio/Group.c -msgid "Layer must be a Group or TileGrid subclass." -msgstr "レイヤはGroupかTileGridのサブクラスでなければなりません" - -#: ports/espressif/bindings/espidf/__init__.c ports/espressif/esp_error.c -msgid "MAC address was invalid" +msgid "Layer already in a group" msgstr "" -#: shared-module/bitbangio/SPI.c -msgid "MISO pin init failed." -msgstr "MISOピン初期化に失敗" +#: shared-module/displayio/Group.c +msgid "Layer must be a Group or TileGrid subclass" +msgstr "" -#: shared-module/bitbangio/SPI.c -msgid "MOSI pin init failed." -msgstr "MOSIピン初期化に失敗" +#: ports/espressif/common-hal/espidf/__init__.c ports/espressif/esp_error.c +msgid "MAC address was invalid" +msgstr "" #: shared-bindings/is31fl3741/IS31FL3741.c msgid "Mapping must be a tuple" @@ -1542,10 +1291,6 @@ msgstr "" msgid "Maximum x value when mirrored is %d" msgstr "" -#: shared-bindings/canio/Message.c -msgid "Messages limited to 8 bytes" -msgstr "" - #: shared-bindings/audiobusio/PDMIn.c msgid "Microphone startup delay must be in range 0.0 to 1.0" msgstr "マイクのスタートアップディレイは 0.0 から 1.0 の間でなければなりません" @@ -1559,10 +1304,14 @@ msgstr "" msgid "Mismatched swap flag" msgstr "" -#: ports/mimxrt10xx/common-hal/busio/SPI.c ports/stm/common-hal/busio/SPI.c +#: ports/mimxrt10xx/common-hal/busio/SPI.c msgid "Missing MISO or MOSI Pin" msgstr "MISOまたはMOSIピンがありません" +#: ports/stm/common-hal/busio/SPI.c +msgid "Missing MISO or MOSI pin" +msgstr "" + #: ports/raspberrypi/common-hal/rp2pio/StateMachine.c #, c-format msgid "Missing first_in_pin. Instruction %d reads pin(s)" @@ -1598,11 +1347,6 @@ msgstr "" msgid "Missing jmp_pin. Instruction %d jumps on pin" msgstr "" -#: shared-module/usb_hid/Device.c -#, c-format -msgid "More than %d report ids not supported" -msgstr "" - #: shared-bindings/busio/UART.c shared-bindings/displayio/Group.c msgid "Must be a %q subclass." msgstr "%q のサブクラスでなければなりません" @@ -1662,16 +1406,28 @@ msgstr "" msgid "No I2C device at address: 0x%x" msgstr "" +#: supervisor/shared/web_workflow/web_workflow.c +msgid "No IP" +msgstr "" + #: ports/espressif/common-hal/busio/SPI.c -#: ports/mimxrt10xx/common-hal/busio/SPI.c ports/stm/common-hal/busio/SPI.c +#: ports/mimxrt10xx/common-hal/busio/SPI.c msgid "No MISO Pin" msgstr "MISOピンなし" +#: ports/stm/common-hal/busio/SPI.c shared-module/bitbangio/SPI.c +msgid "No MISO pin" +msgstr "" + #: ports/espressif/common-hal/busio/SPI.c -#: ports/mimxrt10xx/common-hal/busio/SPI.c ports/stm/common-hal/busio/SPI.c +#: ports/mimxrt10xx/common-hal/busio/SPI.c msgid "No MOSI Pin" msgstr "MOSIピンがありません" +#: ports/stm/common-hal/busio/SPI.c shared-module/bitbangio/SPI.c +msgid "No MOSI pin" +msgstr "" + #: ports/atmel-samd/common-hal/busio/UART.c #: ports/espressif/common-hal/busio/UART.c #: ports/mimxrt10xx/common-hal/busio/UART.c ports/nrf/common-hal/busio/UART.c @@ -1710,16 +1466,6 @@ msgstr "使われていないGCLKがありません" msgid "No hardware random available" msgstr "利用可能なハードウェア乱数なし" -#: ports/atmel-samd/common-hal/ps2io/Ps2.c -msgid "No hardware support on clk pin" -msgstr "clkピンにハードウェア対応がありません" - -#: ports/atmel-samd/common-hal/alarm/pin/PinAlarm.c -#: ports/atmel-samd/common-hal/frequencyio/FrequencyIn.c -#: ports/atmel-samd/common-hal/pulseio/PulseIn.c -msgid "No hardware support on pin" -msgstr "ピンにハードウェア対応がありません" - #: ports/raspberrypi/common-hal/rp2pio/StateMachine.c msgid "No in in program" msgstr "" @@ -1819,16 +1565,26 @@ msgstr "" msgid "Odd parity is not supported" msgstr "奇数パリティには対応していません" +#: supervisor/shared/bluetooth/bluetooth.c +msgid "Off" +msgstr "" + +#: supervisor/shared/bluetooth/bluetooth.c +msgid "Ok" +msgstr "" + #: ports/atmel-samd/common-hal/audiobusio/PDMIn.c #: ports/raspberrypi/common-hal/audiobusio/PDMIn.c msgid "Only 8 or 16 bit mono with " msgstr "8または16ビットの " #: ports/espressif/common-hal/wifi/__init__.c +#: ports/raspberrypi/common-hal/wifi/__init__.c msgid "Only IPv4 addresses supported" msgstr "" -#: ports/espressif/common-hal/socketpool/SocketPool.c +#: ports/espressif/common-hal/socketpool/Socket.c +#: ports/raspberrypi/common-hal/socketpool/Socket.c msgid "Only IPv4 sockets supported" msgstr "" @@ -1861,15 +1617,19 @@ msgstr "" msgid "Only one TouchAlarm can be set in deep sleep." msgstr "" -#: ports/espressif/common-hal/i2cperipheral/I2CPeripheral.c +#: ports/espressif/common-hal/i2ctarget/I2CTarget.c +#: ports/raspberrypi/common-hal/i2ctarget/I2CTarget.c msgid "Only one address is allowed" msgstr "" #: ports/atmel-samd/common-hal/alarm/time/TimeAlarm.c -#: ports/espressif/common-hal/alarm/time/TimeAlarm.c #: ports/nrf/common-hal/alarm/time/TimeAlarm.c -#: ports/raspberrypi/common-hal/alarm/time/TimeAlarm.c #: ports/stm/common-hal/alarm/time/TimeAlarm.c +msgid "Only one alarm.time alarm can be set" +msgstr "" + +#: ports/espressif/common-hal/alarm/time/TimeAlarm.c +#: ports/raspberrypi/common-hal/alarm/time/TimeAlarm.c msgid "Only one alarm.time alarm can be set." msgstr "" @@ -1881,19 +1641,20 @@ msgstr "" msgid "Operation not permitted" msgstr "" -#: ports/espressif/bindings/espidf/__init__.c ports/espressif/esp_error.c +#: ports/espressif/common-hal/espidf/__init__.c ports/espressif/esp_error.c msgid "Operation or feature not supported" msgstr "" -#: ports/espressif/bindings/espidf/__init__.c ports/espressif/esp_error.c +#: ports/espressif/common-hal/espidf/__init__.c ports/espressif/esp_error.c msgid "Operation timed out" msgstr "" -#: ports/espressif/bindings/espidf/__init__.c ports/espressif/esp_error.c +#: ports/espressif/common-hal/espidf/__init__.c ports/espressif/esp_error.c msgid "Out of memory" msgstr "" -#: ports/espressif/common-hal/socketpool/SocketPool.c +#: ports/espressif/common-hal/socketpool/Socket.c +#: ports/raspberrypi/common-hal/socketpool/Socket.c msgid "Out of sockets" msgstr "" @@ -1901,11 +1662,6 @@ msgstr "" msgid "Out-buffer elements must be <= 4 bytes long" msgstr "" -#: shared-bindings/bitops/__init__.c -#, c-format -msgid "Output buffer must be at least %d bytes" -msgstr "" - #: shared-bindings/audiobusio/PDMIn.c msgid "Oversample must be multiple of 8." msgstr "オーバーサンプルは8の倍数でなければなりません" @@ -1914,17 +1670,15 @@ msgstr "オーバーサンプルは8の倍数でなければなりません" msgid "PDMIn not available" msgstr "" -#: shared-bindings/pwmio/PWMOut.c -msgid "" -"PWM duty_cycle must be between 0 and 65535 inclusive (16 bit resolution)" -msgstr "" -"PWMのduty_cycle値は0から65535の間でなければなりません(16ビット解像度)" - #: shared-bindings/pwmio/PWMOut.c msgid "" "PWM frequency not writable when variable_frequency is False on construction." msgstr "PWM周波数は生成時のvariable_frequencyがFalseのとき書き換え不可" +#: ports/stm/common-hal/pwmio/PWMOut.c +msgid "PWM restart" +msgstr "" + #: ports/raspberrypi/common-hal/countio/Counter.c msgid "PWM slice already in use" msgstr "" @@ -1941,36 +1695,20 @@ msgstr "" msgid "Permission denied" msgstr "パーミッション拒否" -#: ports/atmel-samd/common-hal/alarm/pin/PinAlarm.c #: ports/stm/common-hal/alarm/pin/PinAlarm.c msgid "Pin cannot wake from Deep Sleep" msgstr "" -#: ports/raspberrypi/bindings/rp2pio/StateMachine.c -msgid "Pin count must be at least 1" -msgstr "" - #: ports/raspberrypi/common-hal/rp2pio/StateMachine.c msgid "Pin count too large" msgstr "" -#: ports/atmel-samd/common-hal/analogio/AnalogIn.c -#: ports/cxd56/common-hal/analogio/AnalogIn.c -#: ports/espressif/common-hal/analogio/AnalogIn.c -#: ports/mimxrt10xx/common-hal/analogio/AnalogIn.c -#: ports/nrf/common-hal/analogio/AnalogIn.c -#: ports/raspberrypi/common-hal/analogio/AnalogIn.c -#: ports/stm/common-hal/analogio/AnalogIn.c -msgid "Pin does not have ADC capabilities" -msgstr "ピンにADCの能力がありません" - #: ports/stm/common-hal/alarm/pin/PinAlarm.c #: ports/stm/common-hal/pulseio/PulseIn.c msgid "Pin interrupt already in use" msgstr "" #: shared-bindings/adafruit_bus_device/spi_device/SPIDevice.c -#: shared-bindings/digitalio/DigitalInOut.c msgid "Pin is input only" msgstr "ピンは入力専用" @@ -2030,18 +1768,10 @@ msgstr "" msgid "Program does OUT without loading OSR" msgstr "" -#: ports/raspberrypi/bindings/rp2pio/StateMachine.c -msgid "Program must contain at least one 16-bit instruction." -msgstr "" - #: ports/raspberrypi/bindings/rp2pio/StateMachine.c msgid "Program size invalid" msgstr "" -#: ports/raspberrypi/bindings/rp2pio/StateMachine.c -msgid "Program too large" -msgstr "" - #: shared-bindings/digitalio/DigitalInOut.c msgid "Pull not used when direction is output." msgstr "方向がoutputのときpullは使われません" @@ -2063,8 +1793,9 @@ msgstr "RNG解体エラー" msgid "RNG Init Error" msgstr "乱数生成器の初期化エラー" -#: ports/nrf/common-hal/busio/UART.c -msgid "RS485 Not yet supported on this device" +#: ports/atmel-samd/common-hal/busio/UART.c ports/cxd56/common-hal/busio/UART.c +#: ports/nrf/common-hal/busio/UART.c ports/stm/common-hal/busio/UART.c +msgid "RS485" msgstr "" #: ports/espressif/common-hal/busio/UART.c @@ -2072,21 +1803,10 @@ msgstr "" msgid "RS485 inversion specified when not in RS485 mode" msgstr "" -#: ports/cxd56/common-hal/rtc/RTC.c ports/espressif/common-hal/rtc/RTC.c -#: ports/mimxrt10xx/common-hal/rtc/RTC.c ports/nrf/common-hal/rtc/RTC.c -#: ports/raspberrypi/common-hal/rtc/RTC.c -msgid "RTC calibration is not supported on this board" -msgstr "このボードはRTCのキャリブレーションに非対応" - #: shared-bindings/alarm/time/TimeAlarm.c shared-bindings/time/__init__.c msgid "RTC is not supported on this board" msgstr "このボードはRTCに対応していません" -#: ports/atmel-samd/common-hal/busio/UART.c ports/cxd56/common-hal/busio/UART.c -#: ports/stm/common-hal/busio/UART.c -msgid "RTS/CTS/RS485 Not yet supported on this device" -msgstr "RTS/CTS/RS485はこのデバイスでは未対応" - #: ports/stm/common-hal/os/__init__.c msgid "Random number generation error" msgstr "乱数生成エラー" @@ -2104,10 +1824,14 @@ msgstr "読み込み専用のファイルシステム" msgid "Read-only object" msgstr "読み込み専用のオブジェクト" -#: ports/espressif/bindings/espidf/__init__.c ports/espressif/esp_error.c +#: ports/espressif/common-hal/espidf/__init__.c ports/espressif/esp_error.c msgid "Received response was invalid" msgstr "" +#: supervisor/shared/bluetooth/bluetooth.c +msgid "Reconnecting" +msgstr "" + #: shared-bindings/displayio/EPaperDisplay.c msgid "Refresh too soon" msgstr "リフレッシュが早すぎます" @@ -2120,7 +1844,7 @@ msgstr "" msgid "Requested AES mode is unsupported" msgstr "要求のAESモードは非対応" -#: ports/espressif/bindings/espidf/__init__.c ports/espressif/esp_error.c +#: ports/espressif/common-hal/espidf/__init__.c ports/espressif/esp_error.c msgid "Requested resource not found" msgstr "" @@ -2136,6 +1860,10 @@ msgstr "セーフモードで実行中! 保存されたコードは実行し msgid "SD card CSD format not supported" msgstr "SDカードのCSDフォーマットは非対応" +#: ports/cxd56/common-hal/sdioio/SDCard.c +msgid "SDCard init" +msgstr "" + #: ports/stm/common-hal/sdioio/SDCard.c #, c-format msgid "SDIO GetCardInfo Error %d" @@ -2146,30 +1874,21 @@ msgstr "" msgid "SDIO Init Error %d" msgstr "SDIO初期化エラー %d" -#: ports/stm/common-hal/busio/SPI.c -msgid "SPI Init Error" -msgstr "SPI初期化エラー" - -#: ports/stm/common-hal/busio/SPI.c -msgid "SPI Re-initialization error" -msgstr "SPI再初期化エラー" - #: ports/espressif/common-hal/busio/SPI.c msgid "SPI configuration failed" msgstr "" +#: ports/stm/common-hal/busio/SPI.c +msgid "SPI init error" +msgstr "" + #: ports/raspberrypi/common-hal/busio/SPI.c msgid "SPI peripheral in use" msgstr "" -#: shared-bindings/audiomixer/Mixer.c -msgid "Sample rate must be positive" -msgstr "サンプルレートは正数でなければなりません" - -#: ports/atmel-samd/common-hal/audioio/AudioOut.c -#, c-format -msgid "Sample rate too high. It must be less than %d" -msgstr "サンプルレートは%d以下でなければなりません" +#: ports/stm/common-hal/busio/SPI.c +msgid "SPI re-init" +msgstr "" #: shared-bindings/is31fl3741/FrameBuffer.c msgid "Scale dimensions must divide by 3" @@ -2189,14 +1908,6 @@ msgstr "シリアライザは使用中" msgid "Server side context cannot have hostname" msgstr "" -#: ports/raspberrypi/bindings/rp2pio/StateMachine.c -msgid "Set pin count must be between 1 and 5" -msgstr "" - -#: ports/raspberrypi/bindings/rp2pio/StateMachine.c -msgid "Side set pin count must be between 1 and 5" -msgstr "" - #: ports/cxd56/common-hal/camera/Camera.c msgid "Size not supported" msgstr "サイズは対応していません" @@ -2217,6 +1928,7 @@ msgid "Slices not supported" msgstr "スライスは対応していません" #: ports/espressif/common-hal/socketpool/SocketPool.c +#: ports/raspberrypi/common-hal/socketpool/SocketPool.c msgid "SocketPool can only be used with wifi.radio" msgstr "" @@ -2232,10 +1944,6 @@ msgstr "" msgid "Splitting with sub-captures" msgstr "" -#: shared-bindings/supervisor/__init__.c -msgid "Stack size must be at least 256" -msgstr "スタックサイズは少なくとも256以上でなければなりません" - #: ports/raspberrypi/common-hal/audiopwmio/PWMAudioOut.c msgid "Stereo left must be on PWM channel A" msgstr "" @@ -2244,10 +1952,6 @@ msgstr "" msgid "Stereo right must be on PWM channel B" msgstr "" -#: shared-bindings/multiterminal/__init__.c -msgid "Stream missing readinto() or write() method." -msgstr "ストリームにreadinto()またはwrite()メソッドがありません" - #: ports/mimxrt10xx/common-hal/busio/UART.c ports/stm/common-hal/busio/UART.c msgid "Supply at least one UART pin" msgstr "少なくとも1つのUARTピンが必要" @@ -2321,10 +2025,6 @@ msgstr "タイルの高さはビットマップの高さを割り切れる値で msgid "Tile index out of bounds" msgstr "タイルのインデクスが範囲外" -#: shared-bindings/displayio/TileGrid.c -msgid "Tile value out of bounds" -msgstr "タイル値が範囲外" - #: shared-bindings/displayio/TileGrid.c msgid "Tile width must exactly divide bitmap width" msgstr "タイルの幅はビットマップの幅を割り切れる値でなければなりません" @@ -2344,6 +2044,9 @@ msgid "To exit, please reset the board without " msgstr "" #: ports/atmel-samd/common-hal/audiobusio/I2SOut.c +msgid "Too many channels in sample" +msgstr "" + #: ports/raspberrypi/common-hal/audiobusio/I2SOut.c msgid "Too many channels in sample." msgstr "サンプルのチャンネル数が多すぎます" @@ -2376,24 +2079,25 @@ msgid "Tuple or struct_time argument required" msgstr "" #: ports/stm/common-hal/busio/UART.c -msgid "UART Buffer allocation error" -msgstr "UARTバッファの確保エラー" +msgid "UART de-init" +msgstr "" + +#: ports/atmel-samd/common-hal/busio/UART.c ports/cxd56/common-hal/busio/UART.c +#: ports/espressif/common-hal/busio/UART.c ports/stm/common-hal/busio/UART.c +msgid "UART init" +msgstr "" #: ports/stm/common-hal/busio/UART.c -msgid "UART De-init error" -msgstr "UART解放エラー" +msgid "UART re-init" +msgstr "" #: ports/stm/common-hal/busio/UART.c -msgid "UART Init Error" -msgstr "UARTの初期化エラー" +msgid "UART write" +msgstr "" -#: ports/stm/common-hal/busio/UART.c -msgid "UART Re-init error" -msgstr "UARTの再初期化エラー" - -#: ports/stm/common-hal/busio/UART.c -msgid "UART write error" -msgstr "UART書き込みエラー" +#: main.c +msgid "UID:" +msgstr "" #: shared-module/usb_hid/Device.c msgid "USB busy" @@ -2519,6 +2223,11 @@ msgstr "" msgid "Unknown system firmware error: %d" msgstr "" +#: ports/raspberrypi/common-hal/wifi/__init__.c +#, c-format +msgid "Unkown error code %d" +msgstr "" + #: shared-bindings/adafruit_pixelbuf/PixelBuf.c #, c-format msgid "Unmatched number of items on RHS (expected %d, got %d)." @@ -2530,12 +2239,6 @@ msgid "" "declined or ignored." msgstr "" -#: ports/atmel-samd/common-hal/busio/I2C.c ports/cxd56/common-hal/busio/I2C.c -#: ports/espressif/common-hal/busio/UART.c -#: ports/raspberrypi/common-hal/busio/I2C.c ports/stm/common-hal/busio/I2C.c -msgid "Unsupported baudrate" -msgstr "非対応のbaudrate" - #: shared-bindings/bitmaptools/__init__.c msgid "Unsupported colorspace" msgstr "" @@ -2548,6 +2251,10 @@ msgstr "" msgid "Unsupported format" msgstr "非対応の形式" +#: shared-bindings/hashlib/__init__.c +msgid "Unsupported hash algorithm" +msgstr "" + #: ports/espressif/common-hal/dualbank/__init__.c msgid "Update Failed" msgstr "" @@ -2566,7 +2273,7 @@ msgstr "" msgid "Value length > max_length" msgstr "" -#: ports/espressif/bindings/espidf/__init__.c ports/espressif/esp_error.c +#: ports/espressif/common-hal/espidf/__init__.c ports/espressif/esp_error.c msgid "Version was invalid" msgstr "" @@ -2596,10 +2303,6 @@ msgstr "WatchDogTimer.modeはいったんWatchDogMode.RESETに設定すると変 msgid "WatchDogTimer.timeout must be greater than 0" msgstr "WatchDogTimer.timeoutは0以上でなければなりません" -#: supervisor/shared/safe_mode.c -msgid "Watchdog timer expired." -msgstr "" - #: py/builtinhelp.c #, c-format msgid "" @@ -2610,9 +2313,9 @@ msgid "" "To list built-in modules type `help(\"modules\")`.\n" msgstr "" -#: shared-bindings/wifi/Radio.c -msgid "WiFi password must be between 8 and 63 characters" -msgstr "WiFiパスワードは8〜63文字でなければなりません" +#: supervisor/shared/web_workflow/web_workflow.c +msgid "Wi-Fi: " +msgstr "" #: main.c msgid "Woken up by alarm.\n" @@ -2652,11 +2355,7 @@ msgstr "__new__の引数はユーザ型でなければなりません" msgid "a bytes-like object is required" msgstr "bytes-likeオブジェクトが必要" -#: shared-bindings/i2cperipheral/I2CPeripheral.c -msgid "address out of bounds" -msgstr "アドレスが範囲外" - -#: shared-bindings/i2cperipheral/I2CPeripheral.c +#: shared-bindings/i2ctarget/I2CTarget.c msgid "addresses is empty" msgstr "" @@ -2705,6 +2404,10 @@ msgstr "引数はndarrayでなければなりません" msgid "array and index length must be equal" msgstr "" +#: extmod/ulab/code/numpy/io/io.c +msgid "array has too many dimensions" +msgstr "" + #: py/objarray.c shared-bindings/alarm/SleepMemory.c #: shared-bindings/nvm/ByteArray.c msgid "array/bytes required on right side" @@ -2766,10 +2469,6 @@ msgstr "" msgid "bits must be 32 or less" msgstr "" -#: shared-bindings/busio/UART.c -msgid "bits must be in range 5 to 9" -msgstr "" - #: shared-bindings/audiomixer/Mixer.c msgid "bits_per_sample must be 8 or 16" msgstr "bits_per_sampleは8または16でなければなりません" @@ -2807,11 +2506,6 @@ msgstr "" msgid "byteorder is not a string" msgstr "byteorderが文字列ではありません" -#: ports/atmel-samd/common-hal/busio/UART.c -#: ports/espressif/common-hal/busio/UART.c -msgid "bytes > 8 bits not supported" -msgstr "" - #: py/objarray.c msgid "bytes length not a multiple of item size" msgstr "" @@ -2820,7 +2514,7 @@ msgstr "" msgid "bytes value out of range" msgstr "範囲外のバイト値" -#: ports/atmel-samd/bindings/samd/Clock.c ports/atmel-samd/common-hal/rtc/RTC.c +#: ports/atmel-samd/bindings/samd/Clock.c msgid "calibration is out of range" msgstr "キャリブレーションが範囲外" @@ -2828,12 +2522,9 @@ msgstr "キャリブレーションが範囲外" msgid "calibration is read only" msgstr "calibrationは読み込み専用" -#: ports/atmel-samd/common-hal/rtc/RTC.c -msgid "calibration value out of range +/-127" -msgstr "" - +#: shared-module/vectorio/Circle.c shared-module/vectorio/Polygon.c #: shared-module/vectorio/Rectangle.c -msgid "can only be registered in one parent" +msgid "can only have one parent" msgstr "" #: py/emitinlinethumb.c @@ -2856,8 +2547,7 @@ msgstr "式には代入できません" msgid "can't cancel self" msgstr "" -#: py/obj.c py/objint.c shared-bindings/i2cperipheral/I2CPeripheral.c -#: shared-module/adafruit_pixelbuf/PixelBuf.c +#: py/obj.c py/objint.c shared-module/adafruit_pixelbuf/PixelBuf.c msgid "can't convert %q to %q" msgstr "%qを%qに変換できません" @@ -3004,6 +2694,10 @@ msgstr "" msgid "casting" msgstr "" +#: ports/stm/common-hal/pwmio/PWMOut.c +msgid "channel re-init" +msgstr "" + #: shared-bindings/_stage/Text.c msgid "chars buffer too small" msgstr "" @@ -3016,10 +2710,6 @@ msgstr "" msgid "chr() arg not in range(256)" msgstr "" -#: shared-module/vectorio/Circle.c -msgid "circle can only be registered in one parent" -msgstr "" - #: shared-bindings/bitmaptools/__init__.c msgid "clip point must be (x,y) tuple" msgstr "" @@ -3046,10 +2736,6 @@ msgstr "" msgid "color must be between 0x000000 and 0xffffff" msgstr "色は0x000000から0xffffffでなければなりません" -#: shared-bindings/displayio/ColorConverter.c -msgid "color should be an int" -msgstr "" - #: py/emitnative.c msgid "comparison of int and uint" msgstr "" @@ -3086,6 +2772,10 @@ msgstr "convolve引数はndarrayでなければなりません" msgid "convolve arguments must not be empty" msgstr "" +#: extmod/ulab/code/numpy/io/io.c +msgid "corrupted file" +msgstr "" + #: extmod/ulab/code/numpy/poly.c msgid "could not invert Vandermonde matrix" msgstr "ヴァンデルモンド行列の逆行列を求められません" @@ -3138,10 +2828,6 @@ msgstr "" msgid "destination buffer must be an array of type 'H' for bit_depth = 16" msgstr "bit_depath = 16用のバッファはタイプ'H'のarrayでなければなりません" -#: shared-bindings/audiobusio/PDMIn.c -msgid "destination_length must be an int >= 0" -msgstr "desitination_lengthは正の整数でなければなりません" - #: py/objdict.c msgid "dict update sequence has wrong length" msgstr "" @@ -3179,6 +2865,10 @@ msgstr "" msgid "empty" msgstr "" +#: extmod/ulab/code/numpy/io/io.c +msgid "empty file" +msgstr "" + #: extmod/moduasyncio.c extmod/moduheapq.c extmod/modutimeq.c msgid "empty heap" msgstr "" @@ -3195,10 +2885,6 @@ msgstr "" msgid "end of format while looking for conversion specifier" msgstr "" -#: shared-bindings/displayio/Shape.c -msgid "end_x should be an int" -msgstr "end_xは整数でなければなりません" - #: shared-bindings/alarm/time/TimeAlarm.c msgid "epoch_time not supported on this board" msgstr "" @@ -3208,6 +2894,12 @@ msgstr "" msgid "error = 0x%08lX" msgstr "error = 0x1%08lX" +#: ports/espressif/common-hal/esp32_camera/Camera.c +msgid "" +"esp32_camera.Camera requires reserved PSRAM to be configured. See the " +"documentation for instructions." +msgstr "" + #: py/runtime.c msgid "exceptions must derive from BaseException" msgstr "例外はBaseExceptionから派生していなければなりません" @@ -3282,7 +2974,7 @@ msgstr "1つ目の引数は関数でなければなりません" msgid "first argument must be a tuple of ndarrays" msgstr "" -#: extmod/ulab/code/numpy/vector.c +#: extmod/ulab/code/numpy/transform.c extmod/ulab/code/numpy/vector.c msgid "first argument must be an ndarray" msgstr "1つ目の引数はndarrayでなければなりません" @@ -3430,7 +3122,7 @@ msgstr "" msgid "incorrect padding" msgstr "" -#: extmod/ulab/code/ndarray.c +#: extmod/ulab/code/ndarray.c extmod/ulab/code/numpy/transform.c msgid "index is out of bounds" msgstr "" @@ -3449,6 +3141,10 @@ msgid "indices must be integers, slices, or Boolean lists" msgstr "" "インデクスは、整数、スライス、boolのリストのいずれかでなければなりません" +#: ports/espressif/common-hal/busio/I2C.c +msgid "init I2C" +msgstr "" + #: extmod/ulab/code/scipy/optimize/optimize.c msgid "initial values must be iterable" msgstr "" @@ -3494,6 +3190,10 @@ msgstr "入力行列が非対称" msgid "input matrix is singular" msgstr "入力が非正則行列" +#: extmod/ulab/code/numpy/create.c +msgid "input must be 1- or 2-d" +msgstr "" + #: extmod/ulab/code/numpy/carray/carray.c msgid "input must be a 1D ndarray" msgstr "" @@ -3502,11 +3202,7 @@ msgstr "" msgid "input must be a dense ndarray" msgstr "" -#: extmod/ulab/code/numpy/create.c -msgid "input must be a tensor of rank 2" -msgstr "" - -#: extmod/ulab/code/numpy/create.c extmod/ulab/code/user/user.c +#: extmod/ulab/code/user/user.c msgid "input must be an ndarray" msgstr "" @@ -3556,6 +3252,10 @@ msgstr "" msgid "invalid bits_per_pixel %d, must be, 1, 2, 4, 8, 16, 24, or 32" msgstr "" +#: ports/raspberrypi/common-hal/ssl/SSLSocket.c +msgid "invalid cert" +msgstr "不正な証明書" + #: shared-bindings/bitmaptools/__init__.c #, c-format msgid "invalid element size %d for bits_per_pixel %d\n" @@ -3582,10 +3282,18 @@ msgstr "" msgid "invalid hostname" msgstr "不正なホスト名" +#: ports/raspberrypi/common-hal/ssl/SSLSocket.c +msgid "invalid key" +msgstr "不正な鍵" + #: py/compile.c msgid "invalid micropython decorator" msgstr "不正なmicropythonデコレータ" +#: ports/espressif/common-hal/esp32_camera/Camera.c +msgid "invalid setting" +msgstr "" + #: shared-bindings/random/__init__.c msgid "invalid step" msgstr "不正なステップ" @@ -3699,10 +3407,6 @@ msgstr "定義域エラー" msgid "matrix is not positive definite" msgstr "正定値行列ではありません" -#: ports/espressif/common-hal/wifi/Radio.c -msgid "max_connections must be between 0 and 10" -msgstr "" - #: ports/espressif/common-hal/_bleio/Descriptor.c #: ports/nrf/common-hal/_bleio/Characteristic.c #: ports/nrf/common-hal/_bleio/Descriptor.c @@ -3710,12 +3414,8 @@ msgstr "" msgid "max_length must be 0-%d when fixed_length is %s" msgstr "" -#: shared-bindings/_bleio/Characteristic.c shared-bindings/_bleio/Descriptor.c -msgid "max_length must be >= 0" -msgstr "" - #: extmod/ulab/code/ndarray.c -msgid "maximum number of dimensions is 4" +msgid "maximum number of dimensions is " msgstr "" #: py/runtime.c @@ -3849,7 +3549,7 @@ msgstr "利用可能なリセットピンがありません" msgid "no response from SD card" msgstr "SDカードからの応答がありません" -#: py/objobject.c py/runtime.c +#: ports/espressif/common-hal/esp32_camera/Camera.c py/objobject.c py/runtime.c msgid "no such attribute" msgstr "指定の属性はありません" @@ -3960,7 +3660,11 @@ msgstr "" msgid "odd-length string" msgstr "奇数長の文字列" -#: extmod/ulab/code/numpy/create.c extmod/ulab/code/utils/utils.c +#: supervisor/shared/web_workflow/web_workflow.c +msgid "off" +msgstr "" + +#: extmod/ulab/code/utils/utils.c msgid "offset is too large" msgstr "" @@ -4056,10 +3760,6 @@ msgstr "" msgid "palette must be 32 bytes long" msgstr "パレットの長さは32バイトでなければなりません" -#: shared-bindings/displayio/Palette.c -msgid "palette_index should be an int" -msgstr "palette_indexには整数が必要" - #: py/emitinlinextensa.c msgid "parameters must be registers in sequence a2 to a5" msgstr "" @@ -4086,10 +3786,6 @@ msgstr "" msgid "poll on file not available on win32" msgstr "" -#: shared-module/vectorio/Polygon.c -msgid "polygon can only be registered in one parent" -msgstr "" - #: ports/espressif/common-hal/pulseio/PulseIn.c msgid "pop from an empty PulseIn" msgstr "" @@ -4115,7 +3811,23 @@ msgstr "pow()の3つ目の引数は0にできません" msgid "pow() with 3 arguments requires integers" msgstr "pow()の第3引数には整数が必要" +#: ports/espressif/boards/adafruit_qtpy_esp32_pico/mpconfigboard.h +msgid "pressing BOOT button at start up.\n" +msgstr "" + +#: ports/espressif/boards/adafruit_feather_esp32_v2/mpconfigboard.h +msgid "pressing SW38 button at start up.\n" +msgstr "" + +#: ports/espressif/boards/hardkernel_odroid_go/mpconfigboard.h +msgid "pressing VOLUME button at start up.\n" +msgstr "" + #: ports/espressif/boards/adafruit_qtpy_esp32c3/mpconfigboard.h +#: ports/espressif/boards/beetle-esp32-c3/mpconfigboard.h +#: ports/espressif/boards/espressif_esp32s2_devkitc_1_n8r2/mpconfigboard.h +#: ports/espressif/boards/lolin_c3_mini/mpconfigboard.h +#: ports/espressif/boards/microdev_micro_c3/mpconfigboard.h #: supervisor/shared/safe_mode.c msgid "pressing boot button at start up.\n" msgstr "" @@ -4136,14 +3848,6 @@ msgstr "" msgid "pull masks conflict with direction masks" msgstr "" -#: ports/raspberrypi/bindings/rp2pio/StateMachine.c -msgid "pull_threshold must be between 1 and 32" -msgstr "" - -#: ports/raspberrypi/bindings/rp2pio/StateMachine.c -msgid "push_threshold must be between 1 and 32" -msgstr "" - #: extmod/modutimeq.c msgid "queue overflow" msgstr "キューがオーバーフローしました" @@ -4195,13 +3899,6 @@ msgstr "" msgid "rsplit(None,n)" msgstr "rsplit(None,n)" -#: shared-bindings/audiocore/RawSample.c -msgid "" -"sample_source buffer must be a bytearray or array of type 'h', 'H', 'b' or " -"'B'" -msgstr "" -"sample_source バッファには bytearray または 'h','H','b','B'型のarrayが必要" - #: ports/atmel-samd/common-hal/audiobusio/PDMIn.c #: ports/raspberrypi/common-hal/audiobusio/PDMIn.c msgid "sampling rate out of range" @@ -4299,26 +3996,14 @@ msgstr "" msgid "source_bitmap must have value_count of 8" msgstr "" -#: shared-bindings/wifi/Radio.c -msgid "ssid can't be more than 32 bytes" -msgstr "" - #: py/objstr.c msgid "start/end indices" msgstr "" -#: shared-bindings/displayio/Shape.c -msgid "start_x should be an int" -msgstr "" - #: shared-bindings/random/__init__.c msgid "step must be non-zero" msgstr "stepは非ゼロ値でなければなりません" -#: shared-bindings/busio/UART.c -msgid "stop must be 1 or 2" -msgstr "stopは1または2のいずれか" - #: shared-bindings/random/__init__.c msgid "stop not reachable from start" msgstr "" @@ -4367,10 +4052,6 @@ msgstr "uctypedディスクリプタの構文エラー" msgid "threshold must be in the range 0-65536" msgstr "threshouldは0から65536まで" -#: shared-bindings/rgbmatrix/RGBMatrix.c -msgid "tile must be greater than zero" -msgstr "" - #: shared-bindings/time/__init__.c msgid "time.struct_time() takes a 9-sequence" msgstr "time.struct_time()は9要素のシーケンスを受け取ります" @@ -4390,10 +4071,6 @@ msgstr "timeoutは0.0〜100.0秒でなければなりません" msgid "timeout must be < 655.35 secs" msgstr "" -#: shared-bindings/_bleio/CharacteristicBuffer.c -msgid "timeout must be >= 0.0" -msgstr "timeoutは0.0以上でなければなりません" - #: shared-module/sdcardio/SDCard.c msgid "timeout waiting for v1 card" msgstr "v1カードの待機がタイムアウト" @@ -4402,6 +4079,10 @@ msgstr "v1カードの待機がタイムアウト" msgid "timeout waiting for v2 card" msgstr "v2カードの待機がタイムアウトしました" +#: ports/stm/common-hal/pwmio/PWMOut.c +msgid "timer re-init" +msgstr "" + #: shared-bindings/time/__init__.c msgid "timestamp out of range for platform time_t" msgstr "timestampがプラットフォームのtime_tの範囲外" @@ -4467,14 +4148,10 @@ msgstr "型'%q'はベース型として使えません" msgid "type is not an acceptable base type" msgstr "この型はベース型にできません" -#: py/runtime.c +#: py/objgenerator.c py/runtime.c msgid "type object '%q' has no attribute '%q'" msgstr "" -#: py/objgenerator.c -msgid "type object 'generator' has no attribute '__await__'" -msgstr "" - #: py/objtype.c msgid "type takes 1 or 3 arguments" msgstr "typeは1つか3つの引数をとります" @@ -4533,7 +4210,6 @@ msgid "unreadable attribute" msgstr "読み込み不可能な属性" #: shared-bindings/displayio/TileGrid.c shared-bindings/vectorio/VectorShape.c -#: shared-module/vectorio/Polygon.c shared-module/vectorio/VectorShape.c msgid "unsupported %q type" msgstr "非対応の型 %q" @@ -4572,6 +4248,14 @@ msgstr "演算子が対応していない型" msgid "unsupported types for %q: '%q', '%q'" msgstr "%q が対応していない型: '%q', '%q'" +#: extmod/ulab/code/numpy/io/io.c +msgid "usecols is too high" +msgstr "" + +#: extmod/ulab/code/numpy/io/io.c +msgid "usecols keyword must be specified" +msgstr "" + #: py/objint.c #, c-format msgid "value must fit in %d byte(s)" @@ -4593,20 +4277,19 @@ msgstr "" msgid "watchdog timeout must be greater than 0" msgstr "watchdogのtimeoutは0以上でなければなりません" -#: shared-bindings/bitops/__init__.c -#, c-format -msgid "width must be from 2 to 8 (inclusive), not %d" -msgstr "" - #: shared-bindings/is31fl3741/FrameBuffer.c -#: shared-bindings/rgbmatrix/RGBMatrix.c msgid "width must be greater than zero" msgstr "" #: ports/espressif/common-hal/wifi/Radio.c +#: ports/raspberrypi/common-hal/wifi/Radio.c msgid "wifi is not enabled" msgstr "" +#: ports/raspberrypi/common-hal/wifi/Monitor.c +msgid "wifi.Monitor not available" +msgstr "" + #: shared-bindings/_bleio/Adapter.c msgid "window must be <= interval" msgstr "windowはinterval以下でなければなりません" @@ -4619,7 +4302,17 @@ msgstr "" msgid "wrong axis specified" msgstr "" -#: extmod/ulab/code/numpy/compare.c extmod/ulab/code/numpy/vector.c +#: extmod/ulab/code/numpy/io/io.c +msgid "wrong dtype" +msgstr "" + +#: extmod/ulab/code/numpy/transform.c +msgid "wrong index type" +msgstr "インデクスの型が不正" + +#: extmod/ulab/code/numpy/compare.c extmod/ulab/code/numpy/create.c +#: extmod/ulab/code/numpy/io/io.c extmod/ulab/code/numpy/transform.c +#: extmod/ulab/code/numpy/vector.c msgid "wrong input type" msgstr "" @@ -4627,6 +4320,10 @@ msgstr "" msgid "wrong length of condition array" msgstr "" +#: extmod/ulab/code/numpy/transform.c +msgid "wrong length of index array" +msgstr "" + #: extmod/ulab/code/numpy/create.c py/objarray.c py/objstr.c msgid "wrong number of arguments" msgstr "" @@ -4647,10 +4344,6 @@ msgstr "xが範囲外" msgid "xTaskCreate failed" msgstr "" -#: shared-bindings/displayio/Shape.c -msgid "y should be an int" -msgstr "yは整数でなければなりません" - #: shared-module/displayio/Shape.c msgid "y value out of bounds" msgstr "yが範囲外" @@ -4671,6 +4364,278 @@ msgstr "ziはfloat値でなければなりません" msgid "zi must be of shape (n_section, 2)" msgstr "" +#~ msgid "Stream missing readinto() or write() method." +#~ msgstr "ストリームにreadinto()またはwrite()メソッドがありません" + +#~ msgid "%q must be >= 0" +#~ msgstr "%qは0以上でなければなりません" + +#~ msgid "%q must be >= 1" +#~ msgstr "%qは1以上でなければなりません" + +#~ msgid "address out of bounds" +#~ msgstr "アドレスが範囲外" + +#~ msgid "destination_length must be an int >= 0" +#~ msgstr "desitination_lengthは正の整数でなければなりません" + +#~ msgid "end_x should be an int" +#~ msgstr "end_xは整数でなければなりません" + +#~ msgid "palette_index should be an int" +#~ msgstr "palette_indexには整数が必要" + +#~ msgid "y should be an int" +#~ msgstr "yは整数でなければなりません" + +#~ msgid "" +#~ "sample_source buffer must be a bytearray or array of type 'h', 'H', 'b' " +#~ "or 'B'" +#~ msgstr "" +#~ "sample_source バッファには bytearray または 'h','H','b','B'型のarrayが必要" + +#~ msgid "%q must be a tuple of length 2" +#~ msgstr "%qは長さ2のタプルでなければなりません" + +#~ msgid "%q should be an int" +#~ msgstr "%qはint型でなければなりません" + +#~ msgid "Address type out of range" +#~ msgstr "address_typeが範囲外" + +#~ msgid "AnalogIn not supported on given pin" +#~ msgstr "指定のピンはAnalogInに対応していません" + +#~ msgid "AnalogOut functionality not supported" +#~ msgstr "AnalogOut機能に対応していません" + +#~ msgid "AnalogOut is only 16 bits. Value must be less than 65536." +#~ msgstr "AnalogOutは16ビットです。値は65536以下でなければなりません" + +#~ msgid "AnalogOut not supported on given pin" +#~ msgstr "指定のピンはAnalogOutに対応していません" + +#, c-format +#~ msgid "Buffer incorrect size. Should be %d bytes." +#~ msgstr "バッファサイズが不正です。%dバイトでなければなりません" + +#~ msgid "Buffer must be at least length 1" +#~ msgstr "バッファ長は少なくとも1以上でなければなりません" + +#~ msgid "Bytes must be between 0 and 255." +#~ msgstr "バイト値は0から255の間でなければなりません" + +#~ msgid "Cannot output both channels on the same pin" +#~ msgstr "同じピン上の両チャネルに出力できません" + +#~ msgid "Cannot read without MISO pin." +#~ msgstr "MISOピンなしで読み込めません" + +#~ msgid "Cannot reset into bootloader because no bootloader is present." +#~ msgstr "ブートローダが存在しないためブートローダへとリセットできません" + +#~ msgid "Cannot transfer without MOSI and MISO pins." +#~ msgstr "MOSIピンとMISOピンなしに転送できません" + +#~ msgid "Cannot write without MOSI pin." +#~ msgstr "MOSIピンなしで書き込みできません" + +#~ msgid "Clock pin init failed." +#~ msgstr "クロックピン初期化に失敗" + +#~ msgid "Command must be an int between 0 and 255" +#~ msgstr "commandは0から255の間の整数でなければなりません" + +#~ msgid "Could not initialize Camera" +#~ msgstr "カメラを初期化できません" + +#~ msgid "Could not initialize GNSS" +#~ msgstr "GNSSを初期化できません" + +#~ msgid "Could not initialize SDCard" +#~ msgstr "SDカードを初期化できません" + +#~ msgid "Could not initialize UART" +#~ msgstr "UARTを初期化できません" + +#~ msgid "Could not re-init channel" +#~ msgstr "チャネルを再初期化できません" + +#~ msgid "Could not re-init timer" +#~ msgstr "タイマーを再初期化できません" + +#~ msgid "Could not restart PWM" +#~ msgstr "PWMを再スタートできません" + +#~ msgid "Couldn't allocate first buffer" +#~ msgstr "1つ目のバッファを確保できません" + +#~ msgid "Couldn't allocate input buffer" +#~ msgstr "入力バッファを確保できません" + +#~ msgid "Couldn't allocate second buffer" +#~ msgstr "2つ目のバッファを確保できません" + +#~ msgid "DigitalInOut not supported on given pin" +#~ msgstr "指定されたピンはDigitalInOutに対応していません" + +#~ msgid "Failed to allocate RX buffer" +#~ msgstr "RXバッファの確保に失敗" + +#, c-format +#~ msgid "Failed to allocate RX buffer of %d bytes" +#~ msgstr "%dバイトのRXバッファの確保に失敗" + +#~ msgid "I2C Init Error" +#~ msgstr "I2C初期化エラー" + +#~ msgid "Invalid %q pin selection" +#~ msgstr "不正な%qピン選択" + +#~ msgid "Invalid BMP file" +#~ msgstr "不正なBMPファイル" + +#~ msgid "Invalid DAC pin supplied" +#~ msgstr "不正なDACピンが与えられました" + +#~ msgid "Invalid PWM frequency" +#~ msgstr "無効なPWM周波数" + +#~ msgid "Invalid buffer size" +#~ msgstr "不正なバッファサイズ" + +#~ msgid "Invalid byteorder string" +#~ msgstr "不正なバイトオーダー文字列" + +#~ msgid "Invalid capture period. Valid range: 1 - 500" +#~ msgstr "不正なキャプチャ周期。有効な周期は1-500" + +#~ msgid "Invalid channel count" +#~ msgstr "不正なチャンネル数" + +#~ msgid "Invalid direction." +#~ msgstr "不正な方向" + +#~ msgid "Invalid file" +#~ msgstr "不正なファイル" + +#~ msgid "Invalid number of bits" +#~ msgstr "不正なビット数" + +#~ msgid "Invalid phase" +#~ msgstr "不正なphase" + +#~ msgid "Invalid pin" +#~ msgstr "不正なピン" + +#~ msgid "Invalid pin for left channel" +#~ msgstr "左チャネルのピンが不正" + +#~ msgid "Invalid pin for right channel" +#~ msgstr "右チャネルのピンが不正" + +#~ msgid "Invalid polarity" +#~ msgstr "不正な極性" + +#~ msgid "Invalid properties" +#~ msgstr "不正なプロパティ" + +#~ msgid "Invalid run mode." +#~ msgstr "不正なrun mode" + +#~ msgid "Invalid security_mode" +#~ msgstr "不正なsecurity_mode" + +#~ msgid "Invalid voice" +#~ msgstr "不正なボイス" + +#~ msgid "Invalid voice count" +#~ msgstr "不正なボイス数" + +#~ msgid "Invalid wave file" +#~ msgstr "不正なwaveファイル" + +#~ msgid "Invalid word/bit length" +#~ msgstr "不正なワード/ビット長" + +#~ msgid "Layer already in a group." +#~ msgstr "レイヤはすでにグループに含まれています" + +#~ msgid "Layer must be a Group or TileGrid subclass." +#~ msgstr "レイヤはGroupかTileGridのサブクラスでなければなりません" + +#~ msgid "MISO pin init failed." +#~ msgstr "MISOピン初期化に失敗" + +#~ msgid "MOSI pin init failed." +#~ msgstr "MOSIピン初期化に失敗" + +#~ msgid "No hardware support on clk pin" +#~ msgstr "clkピンにハードウェア対応がありません" + +#~ msgid "No hardware support on pin" +#~ msgstr "ピンにハードウェア対応がありません" + +#~ msgid "" +#~ "PWM duty_cycle must be between 0 and 65535 inclusive (16 bit resolution)" +#~ msgstr "" +#~ "PWMのduty_cycle値は0から65535の間でなければなりません(16ビット解像度)" + +#~ msgid "Pin does not have ADC capabilities" +#~ msgstr "ピンにADCの能力がありません" + +#~ msgid "RTC calibration is not supported on this board" +#~ msgstr "このボードはRTCのキャリブレーションに非対応" + +#~ msgid "RTS/CTS/RS485 Not yet supported on this device" +#~ msgstr "RTS/CTS/RS485はこのデバイスでは未対応" + +#~ msgid "SPI Init Error" +#~ msgstr "SPI初期化エラー" + +#~ msgid "SPI Re-initialization error" +#~ msgstr "SPI再初期化エラー" + +#~ msgid "Sample rate must be positive" +#~ msgstr "サンプルレートは正数でなければなりません" + +#, c-format +#~ msgid "Sample rate too high. It must be less than %d" +#~ msgstr "サンプルレートは%d以下でなければなりません" + +#~ msgid "Stack size must be at least 256" +#~ msgstr "スタックサイズは少なくとも256以上でなければなりません" + +#~ msgid "Tile value out of bounds" +#~ msgstr "タイル値が範囲外" + +#~ msgid "UART Buffer allocation error" +#~ msgstr "UARTバッファの確保エラー" + +#~ msgid "UART De-init error" +#~ msgstr "UART解放エラー" + +#~ msgid "UART Init Error" +#~ msgstr "UARTの初期化エラー" + +#~ msgid "UART Re-init error" +#~ msgstr "UARTの再初期化エラー" + +#~ msgid "UART write error" +#~ msgstr "UART書き込みエラー" + +#~ msgid "Unsupported baudrate" +#~ msgstr "非対応のbaudrate" + +#~ msgid "WiFi password must be between 8 and 63 characters" +#~ msgstr "WiFiパスワードは8〜63文字でなければなりません" + +#~ msgid "stop must be 1 or 2" +#~ msgstr "stopは1または2のいずれか" + +#~ msgid "timeout must be >= 0.0" +#~ msgstr "timeoutは0.0以上でなければなりません" + #~ msgid "Unsupported operation" #~ msgstr "非対応の操作" @@ -4853,12 +4818,6 @@ msgstr "" #~ msgid "Corrupt raw code" #~ msgstr "破損したraw code" -#~ msgid "invalid cert" -#~ msgstr "不正な証明書" - -#~ msgid "invalid key" -#~ msgstr "不正な鍵" - #~ msgid "parameter annotation must be an identifier" #~ msgstr "引数アノテーションは識別子でなければなりません" @@ -4971,9 +4930,6 @@ msgstr "" #~ msgid "wrong argument type" #~ msgstr "引数の型が不正" -#~ msgid "wrong index type" -#~ msgstr "インデクスの型が不正" - #~ msgid "Must provide SCK pin" #~ msgstr "SCKピンが必要" diff --git a/locale/ko.po b/locale/ko.po index 21e4bd346a..2a99cf8cd4 100644 --- a/locale/ko.po +++ b/locale/ko.po @@ -61,16 +61,38 @@ msgstr " 산출:\n" msgid "%%c requires int or char" msgstr "%%c 전수(int)또는 캐릭터(char)필요합니다" +#: main.c +#, c-format +msgid "%02X" +msgstr "" + #: shared-bindings/rgbmatrix/RGBMatrix.c #, c-format msgid "" "%d address pins, %d rgb pins and %d tiles indicate a height of %d, not %d" msgstr "" +#: ports/atmel-samd/common-hal/alarm/__init__.c +#: ports/cxd56/common-hal/analogio/AnalogOut.c ports/cxd56/common-hal/rtc/RTC.c +#: ports/espressif/common-hal/rtc/RTC.c +#: ports/mimxrt10xx/common-hal/analogio/AnalogOut.c +#: ports/mimxrt10xx/common-hal/rtc/RTC.c ports/nrf/common-hal/alarm/__init__.c +#: ports/nrf/common-hal/analogio/AnalogOut.c ports/nrf/common-hal/rtc/RTC.c +#: ports/raspberrypi/common-hal/alarm/__init__.c +#: ports/raspberrypi/common-hal/analogio/AnalogOut.c +#: ports/raspberrypi/common-hal/rtc/RTC.c ports/stm/common-hal/alarm/__init__.c +#: ports/stm/common-hal/rtc/RTC.c +msgid "%q" +msgstr "" + #: shared-bindings/microcontroller/Pin.c msgid "%q and %q contain duplicate pins" msgstr "" +#: ports/atmel-samd/common-hal/audioio/AudioOut.c +msgid "%q and %q must be different" +msgstr "" + #: shared-bindings/microcontroller/Pin.c msgid "%q contains duplicate pins" msgstr "" @@ -79,16 +101,12 @@ msgstr "" msgid "%q failure: %d" msgstr "" +#: shared-bindings/digitalio/DigitalInOut.c #: shared-bindings/microcontroller/Pin.c msgid "%q in use" msgstr "%q 사용 중입니다" -#: ports/atmel-samd/common-hal/pulseio/PulseIn.c -#: ports/cxd56/common-hal/pulseio/PulseIn.c -#: ports/nrf/common-hal/pulseio/PulseIn.c -#: ports/raspberrypi/common-hal/pulseio/PulseIn.c -#: ports/stm/common-hal/pulseio/PulseIn.c py/obj.c py/objstr.c -#: py/objstrunicode.c +#: py/obj.c py/objstr.c py/objstrunicode.c msgid "%q index out of range" msgstr "%q 인덱스 범위를 벗어났습니다" @@ -96,14 +114,34 @@ msgstr "%q 인덱스 범위를 벗어났습니다" msgid "%q indices must be integers, not %s" msgstr "%q 인덱스는 %s 가 아닌 정수 여야합니다" +#: shared-module/bitbangio/SPI.c +msgid "%q init failed" +msgstr "" + +#: py/argcheck.c +msgid "%q length must be %d" +msgstr "" + #: py/argcheck.c msgid "%q length must be %d-%d" msgstr "" -#: shared-bindings/busio/I2C.c shared-bindings/usb_hid/Device.c +#: py/argcheck.c +msgid "%q length must be <= %d" +msgstr "" + +#: py/argcheck.c +msgid "%q length must be >= %d" +msgstr "" + +#: shared-bindings/busio/I2C.c msgid "%q length must be >= 1" msgstr "" +#: py/argcheck.c +msgid "%q must be %d" +msgstr "" + #: py/argcheck.c msgid "%q must be %d-%d" msgstr "" @@ -120,29 +158,17 @@ msgstr "" msgid "%q must be >= %d" msgstr "" -#: py/argcheck.c shared-bindings/memorymonitor/AllocationAlarm.c -msgid "%q must be >= 0" +#: shared-bindings/analogbufio/BufferedIn.c +#: shared-bindings/audiocore/RawSample.c +msgid "%q must be a bytearray or array of type 'h', 'H', 'b', or 'B'" msgstr "" -#: shared-bindings/_bleio/CharacteristicBuffer.c -#: shared-bindings/_bleio/PacketBuffer.c shared-bindings/displayio/Group.c -#: shared-bindings/displayio/Shape.c -#: shared-bindings/memorymonitor/AllocationAlarm.c -#: shared-bindings/vectorio/Circle.c shared-bindings/vectorio/Rectangle.c -msgid "%q must be >= 1" -msgstr "%q 는 >=1이어야합니다" - #: py/argcheck.c msgid "%q must be a string" msgstr "" -#: shared-module/vectorio/Polygon.c -msgid "%q must be a tuple of length 2" -msgstr "" - -#: ports/espressif/common-hal/imagecapture/ParallelImageCapture.c -#: shared-module/vectorio/VectorShape.c -msgid "%q must be between %d and %d" +#: py/argcheck.c +msgid "%q must be an int" msgstr "" #: py/argcheck.c @@ -161,7 +187,11 @@ msgstr "" msgid "%q out of bounds" msgstr "" +#: ports/atmel-samd/common-hal/pulseio/PulseIn.c +#: ports/cxd56/common-hal/pulseio/PulseIn.c +#: ports/nrf/common-hal/pulseio/PulseIn.c #: ports/raspberrypi/common-hal/rp2pio/StateMachine.c +#: ports/stm/common-hal/pulseio/PulseIn.c py/argcheck.c #: shared-bindings/canio/Match.c msgid "%q out of range" msgstr "" @@ -170,10 +200,6 @@ msgstr "" msgid "%q pin invalid" msgstr "" -#: shared-bindings/fontio/BuiltinFont.c -msgid "%q should be an int" -msgstr "%q 는 정수(int) 여야합니다" - #: shared-bindings/usb_hid/Device.c msgid "%q with a report ID of 0 must be of length 1" msgstr "" @@ -186,7 +212,11 @@ msgstr "" msgid "%q, %q, and %q must all be the same length" msgstr "" -#: ports/espressif/bindings/espidf/__init__.c ports/espressif/esp_error.c +#: py/objint.c +msgid "%q=%q" +msgstr "" + +#: ports/espressif/common-hal/espidf/__init__.c ports/espressif/esp_error.c #, c-format msgid "%s error 0x%x" msgstr "" @@ -271,7 +301,7 @@ msgstr "" msgid "'%s' object doesn't support item deletion" msgstr "" -#: py/runtime.c +#: ports/raspberrypi/common-hal/wifi/Radio.c py/runtime.c msgid "'%s' object has no attribute '%q'" msgstr "" @@ -336,10 +366,6 @@ msgstr "" msgid "'yield' outside function" msgstr "'yield' 는 함수 외부에 존재합니다" -#: shared-module/vectorio/VectorShape.c -msgid "(x,y) integers required" -msgstr "" - #: py/compile.c msgid "*x must be assignment target" msgstr "" @@ -375,16 +401,12 @@ msgstr "" msgid "Address must be %d bytes long" msgstr "" -#: shared-bindings/_bleio/Address.c -msgid "Address type out of range" -msgstr "" - #: ports/espressif/common-hal/canio/CAN.c msgid "All CAN peripherals are in use" msgstr "" #: ports/espressif/common-hal/busio/I2C.c -#: ports/espressif/common-hal/i2cperipheral/I2CPeripheral.c +#: ports/espressif/common-hal/i2ctarget/I2CTarget.c #: ports/nrf/common-hal/busio/I2C.c msgid "All I2C peripherals are in use" msgstr "사용중인 모든 I2C주변 기기" @@ -421,7 +443,6 @@ msgstr "" msgid "All event channels in use" msgstr "" -#: ports/raspberrypi/common-hal/pulseio/PulseIn.c #: ports/raspberrypi/common-hal/rp2pio/StateMachine.c msgid "All state machines in use" msgstr "" @@ -466,28 +487,10 @@ msgid "Already running" msgstr "" #: ports/espressif/common-hal/wifi/Radio.c +#: ports/raspberrypi/common-hal/wifi/Radio.c msgid "Already scanning for wifi networks" msgstr "" -#: ports/cxd56/common-hal/analogio/AnalogIn.c -msgid "AnalogIn not supported on given pin" -msgstr "" - -#: ports/cxd56/common-hal/analogio/AnalogOut.c -#: ports/mimxrt10xx/common-hal/analogio/AnalogOut.c -#: ports/nrf/common-hal/analogio/AnalogOut.c -#: ports/raspberrypi/common-hal/analogio/AnalogOut.c -msgid "AnalogOut functionality not supported" -msgstr "" - -#: shared-bindings/analogio/AnalogOut.c -msgid "AnalogOut is only 16 bits. Value must be less than 65536." -msgstr "" - -#: ports/atmel-samd/common-hal/analogio/AnalogOut.c -msgid "AnalogOut not supported on given pin" -msgstr "" - #: ports/stm/common-hal/audiopwmio/PWMAudioOut.c msgid "Another PWMAudioOut is already active" msgstr "" @@ -526,7 +529,7 @@ msgstr "" msgid "AuthMode.OPEN is not used with password" msgstr "" -#: shared-bindings/wifi/Radio.c +#: shared-bindings/wifi/Radio.c supervisor/shared/web_workflow/web_workflow.c msgid "Authentication failure" msgstr "" @@ -559,11 +562,6 @@ 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 "" @@ -605,11 +603,6 @@ msgstr "" msgid "Buffer elements must be 4 bytes long or less" msgstr "" -#: shared-module/usb_hid/Device.c -#, c-format -msgid "Buffer incorrect size. Should be %d bytes." -msgstr "잘못된 크기의 버퍼. %d 바이트 여야합니다." - #: shared-bindings/framebufferio/FramebufferDisplay.c msgid "Buffer is not a bytearray." msgstr "" @@ -619,7 +612,6 @@ msgstr "" msgid "Buffer is too small" msgstr "" -#: ports/nrf/common-hal/audiopwmio/PWMAudioOut.c #: ports/stm/common-hal/audiopwmio/PWMAudioOut.c #, c-format msgid "Buffer length %d too big. It must be less than %d" @@ -634,10 +626,6 @@ msgstr "" msgid "Buffer must be a multiple of 512 bytes" msgstr "" -#: shared-bindings/bitbangio/I2C.c -msgid "Buffer must be at least length 1" -msgstr "잘못된 크기의 버퍼. >1 여야합니다" - #: shared-bindings/_bleio/PacketBuffer.c #, c-format msgid "Buffer too short by %d bytes" @@ -659,10 +647,6 @@ msgstr "" msgid "Byte buffer must be 16 bytes." msgstr "잘못된 크기의 버퍼. 16 바이트 여야합니다." -#: shared-bindings/alarm/SleepMemory.c shared-bindings/nvm/ByteArray.c -msgid "Bytes must be between 0 and 255." -msgstr "바이트는 0에서 255 사이 여야합니다." - #: shared-bindings/aesio/aes.c msgid "CBC blocks must be multiples of 16 bytes" msgstr "" @@ -671,7 +655,7 @@ msgstr "" msgid "CIRCUITPY drive could not be found or created." msgstr "" -#: ports/espressif/bindings/espidf/__init__.c ports/espressif/esp_error.c +#: ports/espressif/common-hal/espidf/__init__.c ports/espressif/esp_error.c msgid "CRC or checksum was invalid" msgstr "" @@ -679,6 +663,10 @@ msgstr "" msgid "Call super().__init__() before accessing native object." msgstr "" +#: ports/cxd56/common-hal/camera/Camera.c +msgid "Camera init" +msgstr "" + #: ports/espressif/common-hal/alarm/pin/PinAlarm.c msgid "Can only alarm on RTC IO from deep sleep." msgstr "" @@ -726,18 +714,10 @@ msgstr "온도 데이터를 수신 할 수 없습니다" msgid "Cannot have scan responses for extended, connectable advertisements." msgstr "" -#: ports/atmel-samd/common-hal/audioio/AudioOut.c -msgid "Cannot output both channels on the same pin" -msgstr "" - #: ports/espressif/common-hal/alarm/pin/PinAlarm.c msgid "Cannot pull on input-only pin." msgstr "" -#: shared-module/bitbangio/SPI.c -msgid "Cannot read without MISO pin." -msgstr "MISO핀이 없으면 읽을 수 없습니다" - #: shared-bindings/audiobusio/PDMIn.c msgid "Cannot record to a file" msgstr "파일에 녹음 할 수 없습니다" @@ -749,7 +729,7 @@ msgstr "" #: ports/atmel-samd/common-hal/microcontroller/__init__.c #: ports/cxd56/common-hal/microcontroller/__init__.c #: ports/mimxrt10xx/common-hal/microcontroller/__init__.c -msgid "Cannot reset into bootloader because no bootloader is present." +msgid "Cannot reset into bootloader because no bootloader is present" msgstr "" #: ports/espressif/common-hal/socketpool/Socket.c @@ -770,20 +750,19 @@ msgid "Cannot subclass slice" msgstr "" #: shared-module/bitbangio/SPI.c -msgid "Cannot transfer without MOSI and MISO pins." +msgid "Cannot transfer without MOSI and MISO pins" msgstr "" #: shared-bindings/pwmio/PWMOut.c msgid "Cannot vary frequency on a timer that is already in use" msgstr "" -#: ports/espressif/common-hal/alarm/pin/PinAlarm.c #: ports/nrf/common-hal/alarm/pin/PinAlarm.c -msgid "Cannot wake on pin edge. Only level." +msgid "Cannot wake on pin edge, only level" msgstr "" -#: shared-module/bitbangio/SPI.c -msgid "Cannot write without MOSI pin." +#: ports/espressif/common-hal/alarm/pin/PinAlarm.c +msgid "Cannot wake on pin edge. Only level." msgstr "" #: shared-bindings/_bleio/CharacteristicBuffer.c @@ -798,10 +777,6 @@ msgstr "" msgid "CircuitPython was unable to allocate the heap." msgstr "" -#: shared-module/bitbangio/SPI.c -msgid "Clock pin init failed." -msgstr "" - #: shared-module/bitbangio/I2C.c msgid "Clock stretch too long" msgstr "" @@ -810,11 +785,6 @@ msgstr "" msgid "Clock unit in use" msgstr "" -#: shared-bindings/displayio/FourWire.c shared-bindings/displayio/I2CDisplay.c -#: shared-bindings/paralleldisplay/ParallelBus.c -msgid "Command must be an int between 0 and 255" -msgstr "명령은 0에서 255 사이의 정수(int) 여야합니다" - #: shared-bindings/_bleio/Connection.c msgid "" "Connection has been disconnected and can no longer be used. Create a new " @@ -825,35 +795,6 @@ msgstr "" msgid "Corrupt .mpy file" msgstr "" -#: ports/cxd56/common-hal/camera/Camera.c -msgid "Could not initialize Camera" -msgstr "" - -#: ports/cxd56/common-hal/gnss/GNSS.c -msgid "Could not initialize GNSS" -msgstr "" - -#: ports/cxd56/common-hal/sdioio/SDCard.c -msgid "Could not initialize SDCard" -msgstr "" - -#: ports/atmel-samd/common-hal/busio/UART.c ports/cxd56/common-hal/busio/UART.c -#: ports/espressif/common-hal/busio/UART.c -msgid "Could not initialize UART" -msgstr "" - -#: ports/stm/common-hal/pwmio/PWMOut.c -msgid "Could not re-init channel" -msgstr "" - -#: ports/stm/common-hal/pwmio/PWMOut.c -msgid "Could not re-init timer" -msgstr "" - -#: ports/stm/common-hal/pwmio/PWMOut.c -msgid "Could not restart PWM" -msgstr "" - #: ports/espressif/common-hal/neopixel_write/__init__.c msgid "Could not retrieve clock" msgstr "" @@ -874,20 +815,6 @@ msgstr "" msgid "Couldn't allocate decoder" msgstr "" -#: shared-module/audiocore/WaveFile.c shared-module/audiomixer/Mixer.c -#: shared-module/audiomp3/MP3Decoder.c -msgid "Couldn't allocate first buffer" -msgstr "" - -#: shared-module/audiomp3/MP3Decoder.c -msgid "Couldn't allocate input buffer" -msgstr "" - -#: shared-module/audiocore/WaveFile.c shared-module/audiomixer/Mixer.c -#: shared-module/audiomp3/MP3Decoder.c -msgid "Couldn't allocate second buffer" -msgstr "" - #: supervisor/shared/safe_mode.c msgid "Crash into the HardFault_Handler." msgstr "" @@ -935,10 +862,6 @@ msgstr "" msgid "Device in use" msgstr "" -#: ports/cxd56/common-hal/digitalio/DigitalInOut.c -msgid "DigitalInOut not supported on given pin" -msgstr "" - #: shared-bindings/displayio/Display.c #: shared-bindings/framebufferio/FramebufferDisplay.c msgid "Display must have a 16 bit colorspace." @@ -950,6 +873,10 @@ msgstr "" msgid "Display rotation must be in 90 degree increments" msgstr "" +#: main.c +msgid "Done" +msgstr "" + #: shared-bindings/digitalio/DigitalInOut.c msgid "Drive mode not used when direction is input." msgstr "" @@ -983,20 +910,19 @@ msgstr "Regex에 오류가 있습니다." msgid "Error: Failure to bind" msgstr "" -#: ports/raspberrypi/bindings/rp2pio/StateMachine.c py/enum.c -#: shared-bindings/_bleio/__init__.c shared-bindings/aesio/aes.c -#: shared-bindings/busio/SPI.c shared-bindings/microcontroller/Pin.c +#: py/enum.c shared-bindings/_bleio/__init__.c shared-bindings/aesio/aes.c +#: shared-bindings/alarm/__init__.c shared-bindings/busio/SPI.c +#: shared-bindings/microcontroller/Pin.c #: shared-bindings/neopixel_write/__init__.c msgid "Expected a %q" msgstr "%q 이 예상되었습니다." -#: shared-bindings/alarm/__init__.c -msgid "Expected an alarm" +#: ports/raspberrypi/bindings/cyw43/__init__.c +msgid "Expected a %q or %q" msgstr "" -#: shared-module/adafruit_pixelbuf/PixelBuf.c -#, c-format -msgid "Expected tuple of length %d, got %d" +#: shared-bindings/alarm/__init__.c +msgid "Expected an %q" msgstr "" #: ports/espressif/common-hal/_bleio/Adapter.c @@ -1025,20 +951,8 @@ msgstr "" msgid "Failed to acquire mutex, err 0x%04x" msgstr "" -#: ports/mimxrt10xx/common-hal/busio/UART.c ports/nrf/common-hal/busio/UART.c -#: ports/raspberrypi/common-hal/busio/UART.c -msgid "Failed to allocate RX buffer" -msgstr "" - -#: ports/atmel-samd/common-hal/busio/UART.c -#: ports/atmel-samd/common-hal/pulseio/PulseIn.c -#: ports/cxd56/common-hal/pulseio/PulseIn.c -#: ports/espressif/common-hal/pulseio/PulseIn.c -#: ports/nrf/common-hal/pulseio/PulseIn.c -#: ports/raspberrypi/common-hal/pulseio/PulseIn.c -#: ports/stm/common-hal/pulseio/PulseIn.c -#, c-format -msgid "Failed to allocate RX buffer of %d bytes" +#: shared-module/rgbmatrix/RGBMatrix.c +msgid "Failed to allocate %q buffer" msgstr "" #: ports/espressif/common-hal/wifi/__init__.c @@ -1062,10 +976,6 @@ msgstr "" msgid "Failed to connect: timeout" msgstr "" -#: ports/espressif/common-hal/wifi/__init__.c -msgid "Failed to init wifi" -msgstr "" - #: shared-module/audiomp3/MP3Decoder.c msgid "Failed to parse MP3 file" msgstr "" @@ -1109,11 +1019,6 @@ msgstr "" msgid "Format not supported" msgstr "" -#: shared-module/framebufferio/FramebufferDisplay.c -#, c-format -msgid "Framebuffer requires %d bytes" -msgstr "" - #: ports/mimxrt10xx/common-hal/microcontroller/Processor.c msgid "" "Frequency must be 24, 150, 396, 450, 528, 600, 720, 816, 912, 960 or 1008 Mhz" @@ -1128,7 +1033,11 @@ msgstr "" msgid "Function requires lock" msgstr "" -#: ports/espressif/bindings/espidf/__init__.c ports/espressif/esp_error.c +#: ports/cxd56/common-hal/gnss/GNSS.c +msgid "GNSS init" +msgstr "" + +#: ports/espressif/common-hal/espidf/__init__.c ports/espressif/esp_error.c msgid "Generic Failure" msgstr "" @@ -1155,19 +1064,16 @@ msgstr "" msgid "Hardware in use, try alternative pins" msgstr "" -#: shared-bindings/wifi/Radio.c -msgid "Hostname must be between 1 and 253 characters" -msgstr "" - #: extmod/vfs_posix_file.c py/objstringio.c msgid "I/O operation on closed file" msgstr "" #: ports/stm/common-hal/busio/I2C.c -msgid "I2C Init Error" +msgid "I2C init error" msgstr "" #: ports/raspberrypi/common-hal/busio/I2C.c +#: ports/raspberrypi/common-hal/i2ctarget/I2CTarget.c msgid "I2C peripheral in use" msgstr "" @@ -1272,75 +1178,37 @@ msgstr "" msgid "Internal error #%d" msgstr "" -#: shared-bindings/sdioio/SDCard.c shared-module/usb_hid/Device.c +#: supervisor/shared/safe_mode.c +msgid "Internal watchdog timer expired." +msgstr "" + +#: py/argcheck.c shared-bindings/digitalio/DigitalInOut.c msgid "Invalid %q" msgstr "" -#: ports/atmel-samd/common-hal/audiobusio/I2SOut.c -#: ports/atmel-samd/common-hal/audiobusio/PDMIn.c -#: ports/atmel-samd/common-hal/imagecapture/ParallelImageCapture.c -#: ports/mimxrt10xx/common-hal/busio/UART.c +#: shared-bindings/microcontroller/Pin.c msgid "Invalid %q pin" msgstr "" -#: ports/stm/common-hal/busio/I2C.c ports/stm/common-hal/busio/SPI.c -#: ports/stm/common-hal/busio/UART.c ports/stm/common-hal/canio/CAN.c -#: ports/stm/common-hal/sdioio/SDCard.c -msgid "Invalid %q pin selection" -msgstr "" - #: ports/stm/common-hal/analogio/AnalogIn.c msgid "Invalid ADC Unit value" msgstr "" -#: ports/espressif/common-hal/wifi/Radio.c -msgid "Invalid AuthMode" -msgstr "" - #: ports/espressif/common-hal/_bleio/__init__.c #: ports/nrf/common-hal/_bleio/__init__.c msgid "Invalid BLE parameter" msgstr "" -#: shared-module/displayio/OnDiskBitmap.c -msgid "Invalid BMP file" -msgstr "" - #: shared-bindings/wifi/Radio.c msgid "Invalid BSSID" msgstr "" -#: ports/espressif/common-hal/analogio/AnalogOut.c -#: ports/stm/common-hal/analogio/AnalogOut.c -msgid "Invalid DAC pin supplied" -msgstr "" - #: shared-bindings/wifi/Radio.c msgid "Invalid MAC address" msgstr "" -#: shared-bindings/synthio/__init__.c -msgid "Invalid MIDI file" -msgstr "" - -#: ports/atmel-samd/common-hal/pwmio/PWMOut.c -#: ports/cxd56/common-hal/pwmio/PWMOut.c -#: ports/espressif/common-hal/pwmio/PWMOut.c -#: ports/mimxrt10xx/common-hal/pwmio/PWMOut.c -#: ports/nrf/common-hal/pwmio/PWMOut.c -#: ports/raspberrypi/common-hal/pwmio/PWMOut.c shared-bindings/pwmio/PWMOut.c -msgid "Invalid PWM frequency" -msgstr "" - -#: ports/espressif/common-hal/analogio/AnalogIn.c -msgid "Invalid Pin" -msgstr "" - -#: ports/espressif/bindings/espidf/__init__.c -#: ports/espressif/common-hal/busio/I2C.c -#: ports/espressif/common-hal/i2cperipheral/I2CPeripheral.c -#: ports/espressif/esp_error.c py/moduerrno.c -#: shared-module/rgbmatrix/RGBMatrix.c +#: ports/espressif/common-hal/espidf/__init__.c ports/espressif/esp_error.c +#: py/moduerrno.c msgid "Invalid argument" msgstr "" @@ -1348,42 +1216,11 @@ msgstr "" msgid "Invalid bits per value" msgstr "" -#: ports/nrf/common-hal/busio/UART.c ports/raspberrypi/common-hal/busio/UART.c -#: ports/stm/common-hal/busio/UART.c -msgid "Invalid buffer size" -msgstr "" - -#: shared-bindings/adafruit_pixelbuf/PixelBuf.c -msgid "Invalid byteorder string" -msgstr "" - -#: ports/atmel-samd/common-hal/frequencyio/FrequencyIn.c -#: ports/espressif/common-hal/frequencyio/FrequencyIn.c -msgid "Invalid capture period. Valid range: 1 - 500" -msgstr "" - -#: shared-bindings/audiomixer/Mixer.c -msgid "Invalid channel count" -msgstr "" - -#: ports/atmel-samd/common-hal/imagecapture/ParallelImageCapture.c -#, c-format -msgid "Invalid data_count %d" -msgstr "" - #: ports/atmel-samd/common-hal/imagecapture/ParallelImageCapture.c #, c-format msgid "Invalid data_pins[%d]" msgstr "" -#: shared-bindings/digitalio/DigitalInOut.c -msgid "Invalid direction." -msgstr "" - -#: shared-module/audiocore/WaveFile.c -msgid "Invalid file" -msgstr "파일이 유효하지 않습니다" - #: shared-module/audiocore/WaveFile.c msgid "Invalid format chunk size" msgstr "형식 청크 크기가 잘못되었습니다" @@ -1392,107 +1229,27 @@ msgstr "형식 청크 크기가 잘못되었습니다" msgid "Invalid memory access." msgstr "" -#: extmod/vfs_fat_file.c -msgid "Invalid mode" -msgstr "" - #: ports/espressif/common-hal/wifi/Radio.c msgid "Invalid multicast MAC address" msgstr "" -#: shared-bindings/bitbangio/SPI.c shared-bindings/busio/SPI.c -msgid "Invalid number of bits" -msgstr "비트 수가 유효하지 않습니다" - -#: shared-bindings/bitbangio/SPI.c shared-bindings/busio/SPI.c -#: shared-bindings/displayio/FourWire.c -msgid "Invalid phase" -msgstr "단계가 잘못되었습니다" - -#: ports/atmel-samd/common-hal/audioio/AudioOut.c -#: ports/atmel-samd/common-hal/touchio/TouchIn.c -#: ports/espressif/common-hal/alarm/touch/TouchAlarm.c -#: ports/espressif/common-hal/touchio/TouchIn.c -#: ports/nrf/common-hal/alarm/pin/PinAlarm.c shared-bindings/pwmio/PWMOut.c -#: shared-module/rgbmatrix/RGBMatrix.c -msgid "Invalid pin" -msgstr "핀이 잘못되었습니다" - -#: ports/atmel-samd/common-hal/audioio/AudioOut.c -msgid "Invalid pin for left channel" -msgstr "왼쪽 채널 핀이 유효하지 않습니다" - -#: ports/atmel-samd/common-hal/audioio/AudioOut.c -msgid "Invalid pin for right channel" -msgstr "오른쪽 채널 핀이 잘못되었습니다" - -#: ports/atmel-samd/common-hal/busio/I2C.c -#: ports/atmel-samd/common-hal/busio/SPI.c -#: ports/atmel-samd/common-hal/busio/UART.c -#: ports/atmel-samd/common-hal/i2cperipheral/I2CPeripheral.c -#: ports/cxd56/common-hal/busio/I2C.c ports/cxd56/common-hal/busio/SPI.c -#: ports/cxd56/common-hal/busio/UART.c ports/cxd56/common-hal/sdioio/SDCard.c -#: ports/espressif/common-hal/busio/I2C.c -#: ports/espressif/common-hal/busio/SPI.c -#: ports/espressif/common-hal/busio/UART.c -#: ports/espressif/common-hal/canio/CAN.c -#: ports/espressif/common-hal/i2cperipheral/I2CPeripheral.c -#: ports/mimxrt10xx/common-hal/busio/I2C.c -#: ports/mimxrt10xx/common-hal/busio/SPI.c -#: ports/mimxrt10xx/common-hal/usb_host/Port.c ports/nrf/common-hal/busio/I2C.c -#: ports/raspberrypi/common-hal/busio/I2C.c -#: ports/raspberrypi/common-hal/busio/SPI.c -#: ports/raspberrypi/common-hal/busio/UART.c shared-bindings/busio/SPI.c #: shared-bindings/busio/UART.c msgid "Invalid pins" msgstr "핀이 유효하지 않습니다" -#: shared-bindings/bitbangio/SPI.c shared-bindings/busio/SPI.c -#: shared-bindings/displayio/FourWire.c -msgid "Invalid polarity" -msgstr "" - -#: shared-bindings/_bleio/Characteristic.c -msgid "Invalid properties" -msgstr "" - -#: shared-bindings/microcontroller/__init__.c -msgid "Invalid run mode." -msgstr "" - -#: shared-module/_bleio/Attribute.c -msgid "Invalid security_mode" -msgstr "" - -#: ports/espressif/bindings/espidf/__init__.c ports/espressif/esp_error.c +#: ports/espressif/common-hal/espidf/__init__.c ports/espressif/esp_error.c msgid "Invalid size" msgstr "" #: ports/espressif/common-hal/ssl/SSLContext.c +#: ports/raspberrypi/common-hal/ssl/SSLSocket.c msgid "Invalid socket for TLS" msgstr "" -#: ports/espressif/bindings/espidf/__init__.c ports/espressif/esp_error.c +#: ports/espressif/common-hal/espidf/__init__.c ports/espressif/esp_error.c msgid "Invalid state" msgstr "" -#: shared-bindings/audiomixer/Mixer.c -msgid "Invalid voice" -msgstr "" - -#: shared-bindings/audiomixer/Mixer.c -msgid "Invalid voice count" -msgstr "" - -#: shared-module/audiocore/WaveFile.c -msgid "Invalid wave file" -msgstr "" - -#: ports/mimxrt10xx/common-hal/busio/UART.c ports/nrf/common-hal/busio/UART.c -#: ports/raspberrypi/common-hal/busio/UART.c ports/stm/common-hal/busio/UART.c -msgid "Invalid word/bit length" -msgstr "" - #: shared-bindings/aesio/aes.c msgid "Key must be 16, 24, or 32 bytes long" msgstr "" @@ -1506,25 +1263,17 @@ msgid "LHS of keyword arg must be an id" msgstr "" #: shared-module/displayio/Group.c -msgid "Layer already in a group." +msgid "Layer already in a group" msgstr "" #: shared-module/displayio/Group.c -msgid "Layer must be a Group or TileGrid subclass." +msgid "Layer must be a Group or TileGrid subclass" msgstr "" -#: ports/espressif/bindings/espidf/__init__.c ports/espressif/esp_error.c +#: ports/espressif/common-hal/espidf/__init__.c ports/espressif/esp_error.c msgid "MAC address was invalid" msgstr "" -#: shared-module/bitbangio/SPI.c -msgid "MISO pin init failed." -msgstr "" - -#: shared-module/bitbangio/SPI.c -msgid "MOSI pin init failed." -msgstr "" - #: shared-bindings/is31fl3741/IS31FL3741.c msgid "Mapping must be a tuple" msgstr "" @@ -1534,10 +1283,6 @@ msgstr "" msgid "Maximum x value when mirrored is %d" msgstr "" -#: shared-bindings/canio/Message.c -msgid "Messages limited to 8 bytes" -msgstr "" - #: shared-bindings/audiobusio/PDMIn.c msgid "Microphone startup delay must be in range 0.0 to 1.0" msgstr "" @@ -1551,10 +1296,14 @@ msgstr "" msgid "Mismatched swap flag" msgstr "" -#: ports/mimxrt10xx/common-hal/busio/SPI.c ports/stm/common-hal/busio/SPI.c +#: ports/mimxrt10xx/common-hal/busio/SPI.c msgid "Missing MISO or MOSI Pin" msgstr "" +#: ports/stm/common-hal/busio/SPI.c +msgid "Missing MISO or MOSI pin" +msgstr "" + #: ports/raspberrypi/common-hal/rp2pio/StateMachine.c #, c-format msgid "Missing first_in_pin. Instruction %d reads pin(s)" @@ -1590,11 +1339,6 @@ msgstr "" msgid "Missing jmp_pin. Instruction %d jumps on pin" msgstr "" -#: shared-module/usb_hid/Device.c -#, c-format -msgid "More than %d report ids not supported" -msgstr "" - #: shared-bindings/busio/UART.c shared-bindings/displayio/Group.c msgid "Must be a %q subclass." msgstr "" @@ -1654,16 +1398,28 @@ msgstr "" msgid "No I2C device at address: 0x%x" msgstr "" -#: ports/espressif/common-hal/busio/SPI.c -#: ports/mimxrt10xx/common-hal/busio/SPI.c ports/stm/common-hal/busio/SPI.c -msgid "No MISO Pin" +#: supervisor/shared/web_workflow/web_workflow.c +msgid "No IP" msgstr "" #: ports/espressif/common-hal/busio/SPI.c -#: ports/mimxrt10xx/common-hal/busio/SPI.c ports/stm/common-hal/busio/SPI.c +#: ports/mimxrt10xx/common-hal/busio/SPI.c +msgid "No MISO Pin" +msgstr "" + +#: ports/stm/common-hal/busio/SPI.c shared-module/bitbangio/SPI.c +msgid "No MISO pin" +msgstr "" + +#: ports/espressif/common-hal/busio/SPI.c +#: ports/mimxrt10xx/common-hal/busio/SPI.c msgid "No MOSI Pin" msgstr "" +#: ports/stm/common-hal/busio/SPI.c shared-module/bitbangio/SPI.c +msgid "No MOSI pin" +msgstr "" + #: ports/atmel-samd/common-hal/busio/UART.c #: ports/espressif/common-hal/busio/UART.c #: ports/mimxrt10xx/common-hal/busio/UART.c ports/nrf/common-hal/busio/UART.c @@ -1702,16 +1458,6 @@ msgstr "" msgid "No hardware random available" msgstr "" -#: ports/atmel-samd/common-hal/ps2io/Ps2.c -msgid "No hardware support on clk pin" -msgstr "" - -#: ports/atmel-samd/common-hal/alarm/pin/PinAlarm.c -#: ports/atmel-samd/common-hal/frequencyio/FrequencyIn.c -#: ports/atmel-samd/common-hal/pulseio/PulseIn.c -msgid "No hardware support on pin" -msgstr "" - #: ports/raspberrypi/common-hal/rp2pio/StateMachine.c msgid "No in in program" msgstr "" @@ -1809,16 +1555,26 @@ msgstr "" msgid "Odd parity is not supported" msgstr "" +#: supervisor/shared/bluetooth/bluetooth.c +msgid "Off" +msgstr "" + +#: supervisor/shared/bluetooth/bluetooth.c +msgid "Ok" +msgstr "" + #: ports/atmel-samd/common-hal/audiobusio/PDMIn.c #: ports/raspberrypi/common-hal/audiobusio/PDMIn.c msgid "Only 8 or 16 bit mono with " msgstr "" #: ports/espressif/common-hal/wifi/__init__.c +#: ports/raspberrypi/common-hal/wifi/__init__.c msgid "Only IPv4 addresses supported" msgstr "" -#: ports/espressif/common-hal/socketpool/SocketPool.c +#: ports/espressif/common-hal/socketpool/Socket.c +#: ports/raspberrypi/common-hal/socketpool/Socket.c msgid "Only IPv4 sockets supported" msgstr "" @@ -1851,15 +1607,19 @@ msgstr "" msgid "Only one TouchAlarm can be set in deep sleep." msgstr "" -#: ports/espressif/common-hal/i2cperipheral/I2CPeripheral.c +#: ports/espressif/common-hal/i2ctarget/I2CTarget.c +#: ports/raspberrypi/common-hal/i2ctarget/I2CTarget.c msgid "Only one address is allowed" msgstr "" #: ports/atmel-samd/common-hal/alarm/time/TimeAlarm.c -#: ports/espressif/common-hal/alarm/time/TimeAlarm.c #: ports/nrf/common-hal/alarm/time/TimeAlarm.c -#: ports/raspberrypi/common-hal/alarm/time/TimeAlarm.c #: ports/stm/common-hal/alarm/time/TimeAlarm.c +msgid "Only one alarm.time alarm can be set" +msgstr "" + +#: ports/espressif/common-hal/alarm/time/TimeAlarm.c +#: ports/raspberrypi/common-hal/alarm/time/TimeAlarm.c msgid "Only one alarm.time alarm can be set." msgstr "" @@ -1871,19 +1631,20 @@ msgstr "" msgid "Operation not permitted" msgstr "" -#: ports/espressif/bindings/espidf/__init__.c ports/espressif/esp_error.c +#: ports/espressif/common-hal/espidf/__init__.c ports/espressif/esp_error.c msgid "Operation or feature not supported" msgstr "" -#: ports/espressif/bindings/espidf/__init__.c ports/espressif/esp_error.c +#: ports/espressif/common-hal/espidf/__init__.c ports/espressif/esp_error.c msgid "Operation timed out" msgstr "" -#: ports/espressif/bindings/espidf/__init__.c ports/espressif/esp_error.c +#: ports/espressif/common-hal/espidf/__init__.c ports/espressif/esp_error.c msgid "Out of memory" msgstr "" -#: ports/espressif/common-hal/socketpool/SocketPool.c +#: ports/espressif/common-hal/socketpool/Socket.c +#: ports/raspberrypi/common-hal/socketpool/Socket.c msgid "Out of sockets" msgstr "" @@ -1891,11 +1652,6 @@ msgstr "" msgid "Out-buffer elements must be <= 4 bytes long" msgstr "" -#: shared-bindings/bitops/__init__.c -#, c-format -msgid "Output buffer must be at least %d bytes" -msgstr "" - #: shared-bindings/audiobusio/PDMIn.c msgid "Oversample must be multiple of 8." msgstr "" @@ -1906,12 +1662,11 @@ msgstr "" #: shared-bindings/pwmio/PWMOut.c msgid "" -"PWM duty_cycle must be between 0 and 65535 inclusive (16 bit resolution)" +"PWM frequency not writable when variable_frequency is False on construction." msgstr "" -#: shared-bindings/pwmio/PWMOut.c -msgid "" -"PWM frequency not writable when variable_frequency is False on construction." +#: ports/stm/common-hal/pwmio/PWMOut.c +msgid "PWM restart" msgstr "" #: ports/raspberrypi/common-hal/countio/Counter.c @@ -1930,36 +1685,20 @@ msgstr "" msgid "Permission denied" msgstr "" -#: ports/atmel-samd/common-hal/alarm/pin/PinAlarm.c #: ports/stm/common-hal/alarm/pin/PinAlarm.c msgid "Pin cannot wake from Deep Sleep" msgstr "" -#: ports/raspberrypi/bindings/rp2pio/StateMachine.c -msgid "Pin count must be at least 1" -msgstr "" - #: ports/raspberrypi/common-hal/rp2pio/StateMachine.c msgid "Pin count too large" msgstr "" -#: ports/atmel-samd/common-hal/analogio/AnalogIn.c -#: ports/cxd56/common-hal/analogio/AnalogIn.c -#: ports/espressif/common-hal/analogio/AnalogIn.c -#: ports/mimxrt10xx/common-hal/analogio/AnalogIn.c -#: ports/nrf/common-hal/analogio/AnalogIn.c -#: ports/raspberrypi/common-hal/analogio/AnalogIn.c -#: ports/stm/common-hal/analogio/AnalogIn.c -msgid "Pin does not have ADC capabilities" -msgstr "" - #: ports/stm/common-hal/alarm/pin/PinAlarm.c #: ports/stm/common-hal/pulseio/PulseIn.c msgid "Pin interrupt already in use" msgstr "" #: shared-bindings/adafruit_bus_device/spi_device/SPIDevice.c -#: shared-bindings/digitalio/DigitalInOut.c msgid "Pin is input only" msgstr "" @@ -2019,18 +1758,10 @@ msgstr "" msgid "Program does OUT without loading OSR" msgstr "" -#: ports/raspberrypi/bindings/rp2pio/StateMachine.c -msgid "Program must contain at least one 16-bit instruction." -msgstr "" - #: ports/raspberrypi/bindings/rp2pio/StateMachine.c msgid "Program size invalid" msgstr "" -#: ports/raspberrypi/bindings/rp2pio/StateMachine.c -msgid "Program too large" -msgstr "" - #: shared-bindings/digitalio/DigitalInOut.c msgid "Pull not used when direction is output." msgstr "" @@ -2052,8 +1783,9 @@ msgstr "" msgid "RNG Init Error" msgstr "" -#: ports/nrf/common-hal/busio/UART.c -msgid "RS485 Not yet supported on this device" +#: ports/atmel-samd/common-hal/busio/UART.c ports/cxd56/common-hal/busio/UART.c +#: ports/nrf/common-hal/busio/UART.c ports/stm/common-hal/busio/UART.c +msgid "RS485" msgstr "" #: ports/espressif/common-hal/busio/UART.c @@ -2061,21 +1793,10 @@ msgstr "" msgid "RS485 inversion specified when not in RS485 mode" msgstr "" -#: ports/cxd56/common-hal/rtc/RTC.c ports/espressif/common-hal/rtc/RTC.c -#: ports/mimxrt10xx/common-hal/rtc/RTC.c ports/nrf/common-hal/rtc/RTC.c -#: ports/raspberrypi/common-hal/rtc/RTC.c -msgid "RTC calibration is not supported on this board" -msgstr "" - #: shared-bindings/alarm/time/TimeAlarm.c shared-bindings/time/__init__.c msgid "RTC is not supported on this board" msgstr "" -#: ports/atmel-samd/common-hal/busio/UART.c ports/cxd56/common-hal/busio/UART.c -#: ports/stm/common-hal/busio/UART.c -msgid "RTS/CTS/RS485 Not yet supported on this device" -msgstr "" - #: ports/stm/common-hal/os/__init__.c msgid "Random number generation error" msgstr "" @@ -2093,10 +1814,14 @@ msgstr "" msgid "Read-only object" msgstr "" -#: ports/espressif/bindings/espidf/__init__.c ports/espressif/esp_error.c +#: ports/espressif/common-hal/espidf/__init__.c ports/espressif/esp_error.c msgid "Received response was invalid" msgstr "" +#: supervisor/shared/bluetooth/bluetooth.c +msgid "Reconnecting" +msgstr "" + #: shared-bindings/displayio/EPaperDisplay.c msgid "Refresh too soon" msgstr "" @@ -2109,7 +1834,7 @@ msgstr "" msgid "Requested AES mode is unsupported" msgstr "" -#: ports/espressif/bindings/espidf/__init__.c ports/espressif/esp_error.c +#: ports/espressif/common-hal/espidf/__init__.c ports/espressif/esp_error.c msgid "Requested resource not found" msgstr "" @@ -2125,6 +1850,10 @@ msgstr "" msgid "SD card CSD format not supported" msgstr "" +#: ports/cxd56/common-hal/sdioio/SDCard.c +msgid "SDCard init" +msgstr "" + #: ports/stm/common-hal/sdioio/SDCard.c #, c-format msgid "SDIO GetCardInfo Error %d" @@ -2135,29 +1864,20 @@ msgstr "" msgid "SDIO Init Error %d" msgstr "" -#: ports/stm/common-hal/busio/SPI.c -msgid "SPI Init Error" -msgstr "" - -#: ports/stm/common-hal/busio/SPI.c -msgid "SPI Re-initialization error" -msgstr "" - #: ports/espressif/common-hal/busio/SPI.c msgid "SPI configuration failed" msgstr "" +#: ports/stm/common-hal/busio/SPI.c +msgid "SPI init error" +msgstr "" + #: ports/raspberrypi/common-hal/busio/SPI.c msgid "SPI peripheral in use" msgstr "" -#: shared-bindings/audiomixer/Mixer.c -msgid "Sample rate must be positive" -msgstr "" - -#: ports/atmel-samd/common-hal/audioio/AudioOut.c -#, c-format -msgid "Sample rate too high. It must be less than %d" +#: ports/stm/common-hal/busio/SPI.c +msgid "SPI re-init" msgstr "" #: shared-bindings/is31fl3741/FrameBuffer.c @@ -2178,14 +1898,6 @@ msgstr "" msgid "Server side context cannot have hostname" msgstr "" -#: ports/raspberrypi/bindings/rp2pio/StateMachine.c -msgid "Set pin count must be between 1 and 5" -msgstr "" - -#: ports/raspberrypi/bindings/rp2pio/StateMachine.c -msgid "Side set pin count must be between 1 and 5" -msgstr "" - #: ports/cxd56/common-hal/camera/Camera.c msgid "Size not supported" msgstr "" @@ -2206,6 +1918,7 @@ msgid "Slices not supported" msgstr "" #: ports/espressif/common-hal/socketpool/SocketPool.c +#: ports/raspberrypi/common-hal/socketpool/SocketPool.c msgid "SocketPool can only be used with wifi.radio" msgstr "" @@ -2221,10 +1934,6 @@ msgstr "" msgid "Splitting with sub-captures" msgstr "" -#: shared-bindings/supervisor/__init__.c -msgid "Stack size must be at least 256" -msgstr "" - #: ports/raspberrypi/common-hal/audiopwmio/PWMAudioOut.c msgid "Stereo left must be on PWM channel A" msgstr "" @@ -2233,10 +1942,6 @@ msgstr "" msgid "Stereo right must be on PWM channel B" msgstr "" -#: shared-bindings/multiterminal/__init__.c -msgid "Stream missing readinto() or write() method." -msgstr "" - #: ports/mimxrt10xx/common-hal/busio/UART.c ports/stm/common-hal/busio/UART.c msgid "Supply at least one UART pin" msgstr "" @@ -2310,10 +2015,6 @@ msgstr "" msgid "Tile index out of bounds" msgstr "" -#: shared-bindings/displayio/TileGrid.c -msgid "Tile value out of bounds" -msgstr "" - #: shared-bindings/displayio/TileGrid.c msgid "Tile width must exactly divide bitmap width" msgstr "" @@ -2333,6 +2034,9 @@ msgid "To exit, please reset the board without " msgstr "" #: ports/atmel-samd/common-hal/audiobusio/I2SOut.c +msgid "Too many channels in sample" +msgstr "" + #: ports/raspberrypi/common-hal/audiobusio/I2SOut.c msgid "Too many channels in sample." msgstr "" @@ -2365,23 +2069,24 @@ msgid "Tuple or struct_time argument required" msgstr "" #: ports/stm/common-hal/busio/UART.c -msgid "UART Buffer allocation error" +msgid "UART de-init" +msgstr "" + +#: ports/atmel-samd/common-hal/busio/UART.c ports/cxd56/common-hal/busio/UART.c +#: ports/espressif/common-hal/busio/UART.c ports/stm/common-hal/busio/UART.c +msgid "UART init" msgstr "" #: ports/stm/common-hal/busio/UART.c -msgid "UART De-init error" +msgid "UART re-init" msgstr "" #: ports/stm/common-hal/busio/UART.c -msgid "UART Init Error" +msgid "UART write" msgstr "" -#: ports/stm/common-hal/busio/UART.c -msgid "UART Re-init error" -msgstr "" - -#: ports/stm/common-hal/busio/UART.c -msgid "UART write error" +#: main.c +msgid "UID:" msgstr "" #: shared-module/usb_hid/Device.c @@ -2508,6 +2213,11 @@ msgstr "" msgid "Unknown system firmware error: %d" msgstr "" +#: ports/raspberrypi/common-hal/wifi/__init__.c +#, c-format +msgid "Unkown error code %d" +msgstr "" + #: shared-bindings/adafruit_pixelbuf/PixelBuf.c #, c-format msgid "Unmatched number of items on RHS (expected %d, got %d)." @@ -2519,12 +2229,6 @@ msgid "" "declined or ignored." msgstr "" -#: ports/atmel-samd/common-hal/busio/I2C.c ports/cxd56/common-hal/busio/I2C.c -#: ports/espressif/common-hal/busio/UART.c -#: ports/raspberrypi/common-hal/busio/I2C.c ports/stm/common-hal/busio/I2C.c -msgid "Unsupported baudrate" -msgstr "" - #: shared-bindings/bitmaptools/__init__.c msgid "Unsupported colorspace" msgstr "" @@ -2537,6 +2241,10 @@ msgstr "" msgid "Unsupported format" msgstr "" +#: shared-bindings/hashlib/__init__.c +msgid "Unsupported hash algorithm" +msgstr "" + #: ports/espressif/common-hal/dualbank/__init__.c msgid "Update Failed" msgstr "" @@ -2555,7 +2263,7 @@ msgstr "" msgid "Value length > max_length" msgstr "" -#: ports/espressif/bindings/espidf/__init__.c ports/espressif/esp_error.c +#: ports/espressif/common-hal/espidf/__init__.c ports/espressif/esp_error.c msgid "Version was invalid" msgstr "" @@ -2585,10 +2293,6 @@ msgstr "" msgid "WatchDogTimer.timeout must be greater than 0" msgstr "" -#: supervisor/shared/safe_mode.c -msgid "Watchdog timer expired." -msgstr "" - #: py/builtinhelp.c #, c-format msgid "" @@ -2599,8 +2303,8 @@ msgid "" "To list built-in modules type `help(\"modules\")`.\n" msgstr "" -#: shared-bindings/wifi/Radio.c -msgid "WiFi password must be between 8 and 63 characters" +#: supervisor/shared/web_workflow/web_workflow.c +msgid "Wi-Fi: " msgstr "" #: main.c @@ -2641,11 +2345,7 @@ msgstr "" msgid "a bytes-like object is required" msgstr "" -#: shared-bindings/i2cperipheral/I2CPeripheral.c -msgid "address out of bounds" -msgstr "" - -#: shared-bindings/i2cperipheral/I2CPeripheral.c +#: shared-bindings/i2ctarget/I2CTarget.c msgid "addresses is empty" msgstr "" @@ -2694,6 +2394,10 @@ msgstr "" msgid "array and index length must be equal" msgstr "" +#: extmod/ulab/code/numpy/io/io.c +msgid "array has too many dimensions" +msgstr "" + #: py/objarray.c shared-bindings/alarm/SleepMemory.c #: shared-bindings/nvm/ByteArray.c msgid "array/bytes required on right side" @@ -2755,10 +2459,6 @@ msgstr "" msgid "bits must be 32 or less" msgstr "" -#: shared-bindings/busio/UART.c -msgid "bits must be in range 5 to 9" -msgstr "" - #: shared-bindings/audiomixer/Mixer.c msgid "bits_per_sample must be 8 or 16" msgstr "bits_per_sample은 8 또는 16이어야합니다." @@ -2796,11 +2496,6 @@ msgstr "" msgid "byteorder is not a string" msgstr "" -#: ports/atmel-samd/common-hal/busio/UART.c -#: ports/espressif/common-hal/busio/UART.c -msgid "bytes > 8 bits not supported" -msgstr "" - #: py/objarray.c msgid "bytes length not a multiple of item size" msgstr "" @@ -2809,7 +2504,7 @@ msgstr "" msgid "bytes value out of range" msgstr "" -#: ports/atmel-samd/bindings/samd/Clock.c ports/atmel-samd/common-hal/rtc/RTC.c +#: ports/atmel-samd/bindings/samd/Clock.c msgid "calibration is out of range" msgstr "" @@ -2817,12 +2512,9 @@ msgstr "" msgid "calibration is read only" msgstr "" -#: ports/atmel-samd/common-hal/rtc/RTC.c -msgid "calibration value out of range +/-127" -msgstr "" - +#: shared-module/vectorio/Circle.c shared-module/vectorio/Polygon.c #: shared-module/vectorio/Rectangle.c -msgid "can only be registered in one parent" +msgid "can only have one parent" msgstr "" #: py/emitinlinethumb.c @@ -2845,8 +2537,7 @@ msgstr "" msgid "can't cancel self" msgstr "" -#: py/obj.c py/objint.c shared-bindings/i2cperipheral/I2CPeripheral.c -#: shared-module/adafruit_pixelbuf/PixelBuf.c +#: py/obj.c py/objint.c shared-module/adafruit_pixelbuf/PixelBuf.c msgid "can't convert %q to %q" msgstr "" @@ -2993,6 +2684,10 @@ msgstr "" msgid "casting" msgstr "" +#: ports/stm/common-hal/pwmio/PWMOut.c +msgid "channel re-init" +msgstr "" + #: shared-bindings/_stage/Text.c msgid "chars buffer too small" msgstr "" @@ -3005,10 +2700,6 @@ msgstr "" msgid "chr() arg not in range(256)" msgstr "" -#: shared-module/vectorio/Circle.c -msgid "circle can only be registered in one parent" -msgstr "" - #: shared-bindings/bitmaptools/__init__.c msgid "clip point must be (x,y) tuple" msgstr "" @@ -3033,10 +2724,6 @@ msgstr "" msgid "color must be between 0x000000 and 0xffffff" msgstr "" -#: shared-bindings/displayio/ColorConverter.c -msgid "color should be an int" -msgstr "" - #: py/emitnative.c msgid "comparison of int and uint" msgstr "" @@ -3073,6 +2760,10 @@ msgstr "" msgid "convolve arguments must not be empty" msgstr "" +#: extmod/ulab/code/numpy/io/io.c +msgid "corrupted file" +msgstr "" + #: extmod/ulab/code/numpy/poly.c msgid "could not invert Vandermonde matrix" msgstr "" @@ -3123,10 +2814,6 @@ msgstr "" msgid "destination buffer must be an array of type 'H' for bit_depth = 16" msgstr "" -#: shared-bindings/audiobusio/PDMIn.c -msgid "destination_length must be an int >= 0" -msgstr "" - #: py/objdict.c msgid "dict update sequence has wrong length" msgstr "" @@ -3164,6 +2851,10 @@ msgstr "" msgid "empty" msgstr "" +#: extmod/ulab/code/numpy/io/io.c +msgid "empty file" +msgstr "" + #: extmod/moduasyncio.c extmod/moduheapq.c extmod/modutimeq.c msgid "empty heap" msgstr "" @@ -3180,10 +2871,6 @@ msgstr "" msgid "end of format while looking for conversion specifier" msgstr "" -#: shared-bindings/displayio/Shape.c -msgid "end_x should be an int" -msgstr "" - #: shared-bindings/alarm/time/TimeAlarm.c msgid "epoch_time not supported on this board" msgstr "" @@ -3193,6 +2880,12 @@ msgstr "" msgid "error = 0x%08lX" msgstr "" +#: ports/espressif/common-hal/esp32_camera/Camera.c +msgid "" +"esp32_camera.Camera requires reserved PSRAM to be configured. See the " +"documentation for instructions." +msgstr "" + #: py/runtime.c msgid "exceptions must derive from BaseException" msgstr "" @@ -3267,7 +2960,7 @@ msgstr "" msgid "first argument must be a tuple of ndarrays" msgstr "" -#: extmod/ulab/code/numpy/vector.c +#: extmod/ulab/code/numpy/transform.c extmod/ulab/code/numpy/vector.c msgid "first argument must be an ndarray" msgstr "" @@ -3415,7 +3108,7 @@ msgstr "" msgid "incorrect padding" msgstr "" -#: extmod/ulab/code/ndarray.c +#: extmod/ulab/code/ndarray.c extmod/ulab/code/numpy/transform.c msgid "index is out of bounds" msgstr "" @@ -3433,6 +3126,10 @@ msgstr "" msgid "indices must be integers, slices, or Boolean lists" msgstr "" +#: ports/espressif/common-hal/busio/I2C.c +msgid "init I2C" +msgstr "" + #: extmod/ulab/code/scipy/optimize/optimize.c msgid "initial values must be iterable" msgstr "" @@ -3478,6 +3175,10 @@ msgstr "" msgid "input matrix is singular" msgstr "" +#: extmod/ulab/code/numpy/create.c +msgid "input must be 1- or 2-d" +msgstr "" + #: extmod/ulab/code/numpy/carray/carray.c msgid "input must be a 1D ndarray" msgstr "" @@ -3486,11 +3187,7 @@ msgstr "" msgid "input must be a dense ndarray" msgstr "" -#: extmod/ulab/code/numpy/create.c -msgid "input must be a tensor of rank 2" -msgstr "" - -#: extmod/ulab/code/numpy/create.c extmod/ulab/code/user/user.c +#: extmod/ulab/code/user/user.c msgid "input must be an ndarray" msgstr "" @@ -3540,6 +3237,10 @@ msgstr "" msgid "invalid bits_per_pixel %d, must be, 1, 2, 4, 8, 16, 24, or 32" msgstr "" +#: ports/raspberrypi/common-hal/ssl/SSLSocket.c +msgid "invalid cert" +msgstr "cert가 유효하지 않습니다" + #: shared-bindings/bitmaptools/__init__.c #, c-format msgid "invalid element size %d for bits_per_pixel %d\n" @@ -3566,10 +3267,18 @@ msgstr "형식 지정자(format specifier)가 유효하지 않습니다" msgid "invalid hostname" msgstr "" +#: ports/raspberrypi/common-hal/ssl/SSLSocket.c +msgid "invalid key" +msgstr "키가 유효하지 않습니다" + #: py/compile.c msgid "invalid micropython decorator" msgstr "" +#: ports/espressif/common-hal/esp32_camera/Camera.c +msgid "invalid setting" +msgstr "" + #: shared-bindings/random/__init__.c msgid "invalid step" msgstr "단계(step)가 유효하지 않습니다" @@ -3683,10 +3392,6 @@ msgstr "" msgid "matrix is not positive definite" msgstr "" -#: ports/espressif/common-hal/wifi/Radio.c -msgid "max_connections must be between 0 and 10" -msgstr "" - #: ports/espressif/common-hal/_bleio/Descriptor.c #: ports/nrf/common-hal/_bleio/Characteristic.c #: ports/nrf/common-hal/_bleio/Descriptor.c @@ -3694,12 +3399,8 @@ msgstr "" msgid "max_length must be 0-%d when fixed_length is %s" msgstr "" -#: shared-bindings/_bleio/Characteristic.c shared-bindings/_bleio/Descriptor.c -msgid "max_length must be >= 0" -msgstr "" - #: extmod/ulab/code/ndarray.c -msgid "maximum number of dimensions is 4" +msgid "maximum number of dimensions is " msgstr "" #: py/runtime.c @@ -3833,7 +3534,7 @@ msgstr "" msgid "no response from SD card" msgstr "" -#: py/objobject.c py/runtime.c +#: ports/espressif/common-hal/esp32_camera/Camera.c py/objobject.c py/runtime.c msgid "no such attribute" msgstr "" @@ -3944,7 +3645,11 @@ msgstr "" msgid "odd-length string" msgstr "" -#: extmod/ulab/code/numpy/create.c extmod/ulab/code/utils/utils.c +#: supervisor/shared/web_workflow/web_workflow.c +msgid "off" +msgstr "" + +#: extmod/ulab/code/utils/utils.c msgid "offset is too large" msgstr "" @@ -4040,10 +3745,6 @@ msgstr "" msgid "palette must be 32 bytes long" msgstr "" -#: shared-bindings/displayio/Palette.c -msgid "palette_index should be an int" -msgstr "" - #: py/emitinlinextensa.c msgid "parameters must be registers in sequence a2 to a5" msgstr "" @@ -4068,10 +3769,6 @@ msgstr "" msgid "poll on file not available on win32" msgstr "" -#: shared-module/vectorio/Polygon.c -msgid "polygon can only be registered in one parent" -msgstr "" - #: ports/espressif/common-hal/pulseio/PulseIn.c msgid "pop from an empty PulseIn" msgstr "" @@ -4097,7 +3794,23 @@ msgstr "" msgid "pow() with 3 arguments requires integers" msgstr "" +#: ports/espressif/boards/adafruit_qtpy_esp32_pico/mpconfigboard.h +msgid "pressing BOOT button at start up.\n" +msgstr "" + +#: ports/espressif/boards/adafruit_feather_esp32_v2/mpconfigboard.h +msgid "pressing SW38 button at start up.\n" +msgstr "" + +#: ports/espressif/boards/hardkernel_odroid_go/mpconfigboard.h +msgid "pressing VOLUME button at start up.\n" +msgstr "" + #: ports/espressif/boards/adafruit_qtpy_esp32c3/mpconfigboard.h +#: ports/espressif/boards/beetle-esp32-c3/mpconfigboard.h +#: ports/espressif/boards/espressif_esp32s2_devkitc_1_n8r2/mpconfigboard.h +#: ports/espressif/boards/lolin_c3_mini/mpconfigboard.h +#: ports/espressif/boards/microdev_micro_c3/mpconfigboard.h #: supervisor/shared/safe_mode.c msgid "pressing boot button at start up.\n" msgstr "" @@ -4118,14 +3831,6 @@ msgstr "" msgid "pull masks conflict with direction masks" msgstr "" -#: ports/raspberrypi/bindings/rp2pio/StateMachine.c -msgid "pull_threshold must be between 1 and 32" -msgstr "" - -#: ports/raspberrypi/bindings/rp2pio/StateMachine.c -msgid "push_threshold must be between 1 and 32" -msgstr "" - #: extmod/modutimeq.c msgid "queue overflow" msgstr "" @@ -4177,12 +3882,6 @@ msgstr "" msgid "rsplit(None,n)" msgstr "" -#: shared-bindings/audiocore/RawSample.c -msgid "" -"sample_source buffer must be a bytearray or array of type 'h', 'H', 'b' or " -"'B'" -msgstr "" - #: ports/atmel-samd/common-hal/audiobusio/PDMIn.c #: ports/raspberrypi/common-hal/audiobusio/PDMIn.c msgid "sampling rate out of range" @@ -4280,26 +3979,14 @@ msgstr "" msgid "source_bitmap must have value_count of 8" msgstr "" -#: shared-bindings/wifi/Radio.c -msgid "ssid can't be more than 32 bytes" -msgstr "" - #: py/objstr.c msgid "start/end indices" msgstr "" -#: shared-bindings/displayio/Shape.c -msgid "start_x should be an int" -msgstr "" - #: shared-bindings/random/__init__.c msgid "step must be non-zero" msgstr "" -#: shared-bindings/busio/UART.c -msgid "stop must be 1 or 2" -msgstr "" - #: shared-bindings/random/__init__.c msgid "stop not reachable from start" msgstr "" @@ -4348,10 +4035,6 @@ msgstr "" msgid "threshold must be in the range 0-65536" msgstr "" -#: shared-bindings/rgbmatrix/RGBMatrix.c -msgid "tile must be greater than zero" -msgstr "" - #: shared-bindings/time/__init__.c msgid "time.struct_time() takes a 9-sequence" msgstr "" @@ -4371,10 +4054,6 @@ msgstr "" msgid "timeout must be < 655.35 secs" msgstr "" -#: shared-bindings/_bleio/CharacteristicBuffer.c -msgid "timeout must be >= 0.0" -msgstr "" - #: shared-module/sdcardio/SDCard.c msgid "timeout waiting for v1 card" msgstr "" @@ -4383,6 +4062,10 @@ msgstr "" msgid "timeout waiting for v2 card" msgstr "" +#: ports/stm/common-hal/pwmio/PWMOut.c +msgid "timer re-init" +msgstr "" + #: shared-bindings/time/__init__.c msgid "timestamp out of range for platform time_t" msgstr "" @@ -4448,14 +4131,10 @@ msgstr "" msgid "type is not an acceptable base type" msgstr "" -#: py/runtime.c +#: py/objgenerator.c py/runtime.c msgid "type object '%q' has no attribute '%q'" msgstr "" -#: py/objgenerator.c -msgid "type object 'generator' has no attribute '__await__'" -msgstr "" - #: py/objtype.c msgid "type takes 1 or 3 arguments" msgstr "" @@ -4514,7 +4193,6 @@ msgid "unreadable attribute" msgstr "" #: shared-bindings/displayio/TileGrid.c shared-bindings/vectorio/VectorShape.c -#: shared-module/vectorio/Polygon.c shared-module/vectorio/VectorShape.c msgid "unsupported %q type" msgstr "" @@ -4553,6 +4231,14 @@ msgstr "" msgid "unsupported types for %q: '%q', '%q'" msgstr "" +#: extmod/ulab/code/numpy/io/io.c +msgid "usecols is too high" +msgstr "" + +#: extmod/ulab/code/numpy/io/io.c +msgid "usecols keyword must be specified" +msgstr "" + #: py/objint.c #, c-format msgid "value must fit in %d byte(s)" @@ -4574,20 +4260,19 @@ msgstr "" msgid "watchdog timeout must be greater than 0" msgstr "" -#: shared-bindings/bitops/__init__.c -#, c-format -msgid "width must be from 2 to 8 (inclusive), not %d" -msgstr "" - #: shared-bindings/is31fl3741/FrameBuffer.c -#: shared-bindings/rgbmatrix/RGBMatrix.c msgid "width must be greater than zero" msgstr "" #: ports/espressif/common-hal/wifi/Radio.c +#: ports/raspberrypi/common-hal/wifi/Radio.c msgid "wifi is not enabled" msgstr "" +#: ports/raspberrypi/common-hal/wifi/Monitor.c +msgid "wifi.Monitor not available" +msgstr "" + #: shared-bindings/_bleio/Adapter.c msgid "window must be <= interval" msgstr "" @@ -4600,7 +4285,17 @@ msgstr "" msgid "wrong axis specified" msgstr "" -#: extmod/ulab/code/numpy/compare.c extmod/ulab/code/numpy/vector.c +#: extmod/ulab/code/numpy/io/io.c +msgid "wrong dtype" +msgstr "" + +#: extmod/ulab/code/numpy/transform.c +msgid "wrong index type" +msgstr "" + +#: extmod/ulab/code/numpy/compare.c extmod/ulab/code/numpy/create.c +#: extmod/ulab/code/numpy/io/io.c extmod/ulab/code/numpy/transform.c +#: extmod/ulab/code/numpy/vector.c msgid "wrong input type" msgstr "" @@ -4608,6 +4303,10 @@ msgstr "" msgid "wrong length of condition array" msgstr "" +#: extmod/ulab/code/numpy/transform.c +msgid "wrong length of index array" +msgstr "" + #: extmod/ulab/code/numpy/create.c py/objarray.c py/objstr.c msgid "wrong number of arguments" msgstr "" @@ -4628,10 +4327,6 @@ msgstr "" msgid "xTaskCreate failed" msgstr "" -#: shared-bindings/displayio/Shape.c -msgid "y should be an int" -msgstr "" - #: shared-module/displayio/Shape.c msgid "y value out of bounds" msgstr "" @@ -4652,6 +4347,46 @@ msgstr "" msgid "zi must be of shape (n_section, 2)" msgstr "" +#~ msgid "%q must be >= 1" +#~ msgstr "%q 는 >=1이어야합니다" + +#~ msgid "%q should be an int" +#~ msgstr "%q 는 정수(int) 여야합니다" + +#, c-format +#~ msgid "Buffer incorrect size. Should be %d bytes." +#~ msgstr "잘못된 크기의 버퍼. %d 바이트 여야합니다." + +#~ msgid "Buffer must be at least length 1" +#~ msgstr "잘못된 크기의 버퍼. >1 여야합니다" + +#~ msgid "Bytes must be between 0 and 255." +#~ msgstr "바이트는 0에서 255 사이 여야합니다." + +#~ msgid "Cannot read without MISO pin." +#~ msgstr "MISO핀이 없으면 읽을 수 없습니다" + +#~ msgid "Command must be an int between 0 and 255" +#~ msgstr "명령은 0에서 255 사이의 정수(int) 여야합니다" + +#~ msgid "Invalid file" +#~ msgstr "파일이 유효하지 않습니다" + +#~ msgid "Invalid number of bits" +#~ msgstr "비트 수가 유효하지 않습니다" + +#~ msgid "Invalid phase" +#~ msgstr "단계가 잘못되었습니다" + +#~ msgid "Invalid pin" +#~ msgstr "핀이 잘못되었습니다" + +#~ msgid "Invalid pin for left channel" +#~ msgstr "왼쪽 채널 핀이 유효하지 않습니다" + +#~ msgid "Invalid pin for right channel" +#~ msgstr "오른쪽 채널 핀이 잘못되었습니다" + #~ msgid "Brightness must be between 0 and 255" #~ msgstr "밝기는 0에서 255 사이 여야합니다" @@ -4670,12 +4405,6 @@ msgstr "" #~ msgid "invalid dupterm index" #~ msgstr "Dupterm index가 유효하지 않습니다" -#~ msgid "invalid cert" -#~ msgstr "cert가 유효하지 않습니다" - -#~ msgid "invalid key" -#~ msgstr "키가 유효하지 않습니다" - #~ msgid "bits must be 7, 8 or 9" #~ msgstr "비트(bits)는 7, 8 또는 9 여야합니다" diff --git a/locale/nl.po b/locale/nl.po index a2dc9ab51f..4baa1d28bc 100644 --- a/locale/nl.po +++ b/locale/nl.po @@ -63,16 +63,38 @@ msgstr " uitvoer:\n" msgid "%%c requires int or char" msgstr "%%c vereist een int of char" +#: main.c +#, c-format +msgid "%02X" +msgstr "" + #: shared-bindings/rgbmatrix/RGBMatrix.c #, c-format msgid "" "%d address pins, %d rgb pins and %d tiles indicate a height of %d, not %d" msgstr "" +#: ports/atmel-samd/common-hal/alarm/__init__.c +#: ports/cxd56/common-hal/analogio/AnalogOut.c ports/cxd56/common-hal/rtc/RTC.c +#: ports/espressif/common-hal/rtc/RTC.c +#: ports/mimxrt10xx/common-hal/analogio/AnalogOut.c +#: ports/mimxrt10xx/common-hal/rtc/RTC.c ports/nrf/common-hal/alarm/__init__.c +#: ports/nrf/common-hal/analogio/AnalogOut.c ports/nrf/common-hal/rtc/RTC.c +#: ports/raspberrypi/common-hal/alarm/__init__.c +#: ports/raspberrypi/common-hal/analogio/AnalogOut.c +#: ports/raspberrypi/common-hal/rtc/RTC.c ports/stm/common-hal/alarm/__init__.c +#: ports/stm/common-hal/rtc/RTC.c +msgid "%q" +msgstr "" + #: shared-bindings/microcontroller/Pin.c msgid "%q and %q contain duplicate pins" msgstr "" +#: ports/atmel-samd/common-hal/audioio/AudioOut.c +msgid "%q and %q must be different" +msgstr "" + #: shared-bindings/microcontroller/Pin.c msgid "%q contains duplicate pins" msgstr "" @@ -81,16 +103,12 @@ msgstr "" msgid "%q failure: %d" msgstr "%q fout: %d" +#: shared-bindings/digitalio/DigitalInOut.c #: shared-bindings/microcontroller/Pin.c msgid "%q in use" msgstr "%q in gebruik" -#: ports/atmel-samd/common-hal/pulseio/PulseIn.c -#: ports/cxd56/common-hal/pulseio/PulseIn.c -#: ports/nrf/common-hal/pulseio/PulseIn.c -#: ports/raspberrypi/common-hal/pulseio/PulseIn.c -#: ports/stm/common-hal/pulseio/PulseIn.c py/obj.c py/objstr.c -#: py/objstrunicode.c +#: py/obj.c py/objstr.c py/objstrunicode.c msgid "%q index out of range" msgstr "%q index buiten bereik" @@ -98,14 +116,34 @@ msgstr "%q index buiten bereik" msgid "%q indices must be integers, not %s" msgstr "%q indexen moeten integers zijn, niet %s" +#: shared-module/bitbangio/SPI.c +msgid "%q init failed" +msgstr "" + +#: py/argcheck.c +msgid "%q length must be %d" +msgstr "" + #: py/argcheck.c msgid "%q length must be %d-%d" msgstr "" -#: shared-bindings/busio/I2C.c shared-bindings/usb_hid/Device.c +#: py/argcheck.c +msgid "%q length must be <= %d" +msgstr "" + +#: py/argcheck.c +msgid "%q length must be >= %d" +msgstr "" + +#: shared-bindings/busio/I2C.c msgid "%q length must be >= 1" msgstr "" +#: py/argcheck.c +msgid "%q must be %d" +msgstr "" + #: py/argcheck.c msgid "%q must be %d-%d" msgstr "" @@ -122,29 +160,17 @@ msgstr "" msgid "%q must be >= %d" msgstr "" -#: py/argcheck.c shared-bindings/memorymonitor/AllocationAlarm.c -msgid "%q must be >= 0" -msgstr "%q moet >= 0 zijn" - -#: shared-bindings/_bleio/CharacteristicBuffer.c -#: shared-bindings/_bleio/PacketBuffer.c shared-bindings/displayio/Group.c -#: shared-bindings/displayio/Shape.c -#: shared-bindings/memorymonitor/AllocationAlarm.c -#: shared-bindings/vectorio/Circle.c shared-bindings/vectorio/Rectangle.c -msgid "%q must be >= 1" -msgstr "%q moet >= 1 zijn" +#: shared-bindings/analogbufio/BufferedIn.c +#: shared-bindings/audiocore/RawSample.c +msgid "%q must be a bytearray or array of type 'h', 'H', 'b', or 'B'" +msgstr "" #: py/argcheck.c msgid "%q must be a string" msgstr "" -#: shared-module/vectorio/Polygon.c -msgid "%q must be a tuple of length 2" -msgstr "%q moet een tuple van lengte 2 zijn" - -#: ports/espressif/common-hal/imagecapture/ParallelImageCapture.c -#: shared-module/vectorio/VectorShape.c -msgid "%q must be between %d and %d" +#: py/argcheck.c +msgid "%q must be an int" msgstr "" #: py/argcheck.c @@ -163,7 +189,11 @@ msgstr "" msgid "%q out of bounds" msgstr "" +#: ports/atmel-samd/common-hal/pulseio/PulseIn.c +#: ports/cxd56/common-hal/pulseio/PulseIn.c +#: ports/nrf/common-hal/pulseio/PulseIn.c #: ports/raspberrypi/common-hal/rp2pio/StateMachine.c +#: ports/stm/common-hal/pulseio/PulseIn.c py/argcheck.c #: shared-bindings/canio/Match.c msgid "%q out of range" msgstr "%q buiten bereik" @@ -172,10 +202,6 @@ msgstr "%q buiten bereik" msgid "%q pin invalid" msgstr "%q pin onjuist" -#: shared-bindings/fontio/BuiltinFont.c -msgid "%q should be an int" -msgstr "%q moet een int zijn" - #: shared-bindings/usb_hid/Device.c msgid "%q with a report ID of 0 must be of length 1" msgstr "" @@ -188,7 +214,11 @@ msgstr "%q() verwacht %d positionele argumenten maar kreeg %d" msgid "%q, %q, and %q must all be the same length" msgstr "" -#: ports/espressif/bindings/espidf/__init__.c ports/espressif/esp_error.c +#: py/objint.c +msgid "%q=%q" +msgstr "" + +#: ports/espressif/common-hal/espidf/__init__.c ports/espressif/esp_error.c #, c-format msgid "%s error 0x%x" msgstr "" @@ -273,7 +303,7 @@ msgstr "" msgid "'%s' object doesn't support item deletion" msgstr "" -#: py/runtime.c +#: ports/raspberrypi/common-hal/wifi/Radio.c py/runtime.c msgid "'%s' object has no attribute '%q'" msgstr "'%s' object heeft geen attribuut '%q'" @@ -338,10 +368,6 @@ msgstr "'yield from' binnen asynchrone functie" msgid "'yield' outside function" msgstr "'yield' buiten de functie" -#: shared-module/vectorio/VectorShape.c -msgid "(x,y) integers required" -msgstr "" - #: py/compile.c msgid "*x must be assignment target" msgstr "*x moet een assignment target zijn" @@ -377,16 +403,12 @@ msgstr "ADC2 wordt gebruikt door WiFi" msgid "Address must be %d bytes long" msgstr "Adres moet %d bytes lang zijn" -#: shared-bindings/_bleio/Address.c -msgid "Address type out of range" -msgstr "Adres type buiten bereik" - #: ports/espressif/common-hal/canio/CAN.c msgid "All CAN peripherals are in use" msgstr "Alle CAN-peripherals zijn in gebruik" #: ports/espressif/common-hal/busio/I2C.c -#: ports/espressif/common-hal/i2cperipheral/I2CPeripheral.c +#: ports/espressif/common-hal/i2ctarget/I2CTarget.c #: ports/nrf/common-hal/busio/I2C.c msgid "All I2C peripherals are in use" msgstr "Alle I2C peripherals zijn in gebruik" @@ -423,7 +445,6 @@ msgstr "" msgid "All event channels in use" msgstr "Alle event kanalen zijn in gebruik" -#: ports/raspberrypi/common-hal/pulseio/PulseIn.c #: ports/raspberrypi/common-hal/rp2pio/StateMachine.c msgid "All state machines in use" msgstr "" @@ -468,28 +489,10 @@ msgid "Already running" msgstr "Wordt al uitgevoerd" #: ports/espressif/common-hal/wifi/Radio.c +#: ports/raspberrypi/common-hal/wifi/Radio.c msgid "Already scanning for wifi networks" msgstr "Zoekt al naar WiFi netwerken" -#: ports/cxd56/common-hal/analogio/AnalogIn.c -msgid "AnalogIn not supported on given pin" -msgstr "AnalogIn niet ondersteund door gegeven pin" - -#: ports/cxd56/common-hal/analogio/AnalogOut.c -#: ports/mimxrt10xx/common-hal/analogio/AnalogOut.c -#: ports/nrf/common-hal/analogio/AnalogOut.c -#: ports/raspberrypi/common-hal/analogio/AnalogOut.c -msgid "AnalogOut functionality not supported" -msgstr "AnalogOut functionaliteit niet ondersteund" - -#: shared-bindings/analogio/AnalogOut.c -msgid "AnalogOut is only 16 bits. Value must be less than 65536." -msgstr "AnalogOut is slechts 16 bits. Waarde moet minder dan 65536 zijn." - -#: ports/atmel-samd/common-hal/analogio/AnalogOut.c -msgid "AnalogOut not supported on given pin" -msgstr "AnalogOut niet ondersteund door gegeven pin" - #: ports/stm/common-hal/audiopwmio/PWMAudioOut.c msgid "Another PWMAudioOut is already active" msgstr "" @@ -528,7 +531,7 @@ msgstr "" msgid "AuthMode.OPEN is not used with password" msgstr "" -#: shared-bindings/wifi/Radio.c +#: shared-bindings/wifi/Radio.c supervisor/shared/web_workflow/web_workflow.c msgid "Authentication failure" msgstr "Authenticatiefout" @@ -561,11 +564,6 @@ msgstr "" 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 "Bitdiepte moet tussen 1 en 6 liggen, niet %d" - #: shared-bindings/audiobusio/PDMIn.c msgid "Bit depth must be multiple of 8." msgstr "Bit diepte moet een meervoud van 8 zijn." @@ -607,11 +605,6 @@ msgstr "Buffer + offset te klein %d %d %d" msgid "Buffer elements must be 4 bytes long or less" msgstr "" -#: shared-module/usb_hid/Device.c -#, c-format -msgid "Buffer incorrect size. Should be %d bytes." -msgstr "Buffer heeft incorrect grootte. Moet %d bytes zijn." - #: shared-bindings/framebufferio/FramebufferDisplay.c msgid "Buffer is not a bytearray." msgstr "Buffer is geen bytearray." @@ -621,7 +614,6 @@ msgstr "Buffer is geen bytearray." msgid "Buffer is too small" msgstr "Buffer is te klein" -#: ports/nrf/common-hal/audiopwmio/PWMAudioOut.c #: ports/stm/common-hal/audiopwmio/PWMAudioOut.c #, c-format msgid "Buffer length %d too big. It must be less than %d" @@ -636,10 +628,6 @@ msgstr "Buffer lengte moet een veelvoud van 512 zijn" msgid "Buffer must be a multiple of 512 bytes" msgstr "Buffer moet een veelvoud van 512 bytes zijn" -#: shared-bindings/bitbangio/I2C.c -msgid "Buffer must be at least length 1" -msgstr "Buffer moet op zijn minst lengte 1 zijn" - #: shared-bindings/_bleio/PacketBuffer.c #, c-format msgid "Buffer too short by %d bytes" @@ -661,10 +649,6 @@ msgstr "Bus pin %d al in gebruik" msgid "Byte buffer must be 16 bytes." msgstr "Byte buffer moet 16 bytes zijn." -#: shared-bindings/alarm/SleepMemory.c shared-bindings/nvm/ByteArray.c -msgid "Bytes must be between 0 and 255." -msgstr "Bytes moeten tussen 0 en 255 liggen." - #: shared-bindings/aesio/aes.c msgid "CBC blocks must be multiples of 16 bytes" msgstr "CBC blocks moeten meervouden van 16 bytes zijn" @@ -673,7 +657,7 @@ msgstr "CBC blocks moeten meervouden van 16 bytes zijn" msgid "CIRCUITPY drive could not be found or created." msgstr "" -#: ports/espressif/bindings/espidf/__init__.c ports/espressif/esp_error.c +#: ports/espressif/common-hal/espidf/__init__.c ports/espressif/esp_error.c msgid "CRC or checksum was invalid" msgstr "" @@ -681,6 +665,10 @@ msgstr "" msgid "Call super().__init__() before accessing native object." msgstr "Roep super().__init__() aan voor toegang native object." +#: ports/cxd56/common-hal/camera/Camera.c +msgid "Camera init" +msgstr "" + #: ports/espressif/common-hal/alarm/pin/PinAlarm.c msgid "Can only alarm on RTC IO from deep sleep." msgstr "" @@ -729,18 +717,10 @@ msgid "Cannot have scan responses for extended, connectable advertisements." msgstr "" "Kan geen scan responses voor extended, connectable advertisements hebben." -#: ports/atmel-samd/common-hal/audioio/AudioOut.c -msgid "Cannot output both channels on the same pin" -msgstr "Output van beide kanalen kan niet op dezelfde pin" - #: ports/espressif/common-hal/alarm/pin/PinAlarm.c msgid "Cannot pull on input-only pin." msgstr "" -#: shared-module/bitbangio/SPI.c -msgid "Cannot read without MISO pin." -msgstr "Kan niet lezen zonder MISO pin." - #: shared-bindings/audiobusio/PDMIn.c msgid "Cannot record to a file" msgstr "Kan niet opnemen naar een bestand" @@ -752,9 +732,8 @@ msgstr "" #: ports/atmel-samd/common-hal/microcontroller/__init__.c #: ports/cxd56/common-hal/microcontroller/__init__.c #: ports/mimxrt10xx/common-hal/microcontroller/__init__.c -msgid "Cannot reset into bootloader because no bootloader is present." +msgid "Cannot reset into bootloader because no bootloader is present" msgstr "" -"Kan niet resetten naar bootloader omdat er geen bootloader aanwezig is." #: ports/espressif/common-hal/socketpool/Socket.c msgid "Cannot set socket options" @@ -774,21 +753,20 @@ msgid "Cannot subclass slice" msgstr "Kan slice niet subclasseren" #: shared-module/bitbangio/SPI.c -msgid "Cannot transfer without MOSI and MISO pins." -msgstr "Kan niet overdragen zonder MOSI en MISO pinnen." +msgid "Cannot transfer without MOSI and MISO pins" +msgstr "" #: shared-bindings/pwmio/PWMOut.c msgid "Cannot vary frequency on a timer that is already in use" msgstr "Kan de frequentie van een timer die al in gebruik is niet variëren" -#: ports/espressif/common-hal/alarm/pin/PinAlarm.c #: ports/nrf/common-hal/alarm/pin/PinAlarm.c -msgid "Cannot wake on pin edge. Only level." +msgid "Cannot wake on pin edge, only level" msgstr "" -#: shared-module/bitbangio/SPI.c -msgid "Cannot write without MOSI pin." -msgstr "Kan niet schrijven zonder MOSI pin." +#: ports/espressif/common-hal/alarm/pin/PinAlarm.c +msgid "Cannot wake on pin edge. Only level." +msgstr "" #: shared-bindings/_bleio/CharacteristicBuffer.c msgid "CharacteristicBuffer writing not provided" @@ -802,10 +780,6 @@ msgstr "CircuitPython core code is hard gecrashed. Ojee!\n" msgid "CircuitPython was unable to allocate the heap." msgstr "CircuitPython kon het heap geheugen niet toewijzen." -#: shared-module/bitbangio/SPI.c -msgid "Clock pin init failed." -msgstr "Clock pin init mislukt." - #: shared-module/bitbangio/I2C.c msgid "Clock stretch too long" msgstr "Clock stretch is te lang" @@ -814,11 +788,6 @@ msgstr "Clock stretch is te lang" msgid "Clock unit in use" msgstr "Clock unit in gebruik" -#: shared-bindings/displayio/FourWire.c shared-bindings/displayio/I2CDisplay.c -#: shared-bindings/paralleldisplay/ParallelBus.c -msgid "Command must be an int between 0 and 255" -msgstr "Command moet een int tussen 0 en 255 zijn" - #: shared-bindings/_bleio/Connection.c msgid "" "Connection has been disconnected and can no longer be used. Create a new " @@ -831,35 +800,6 @@ msgstr "" msgid "Corrupt .mpy file" msgstr "Corrupt .mpy bestand" -#: ports/cxd56/common-hal/camera/Camera.c -msgid "Could not initialize Camera" -msgstr "Kon camera niet initialiseren" - -#: ports/cxd56/common-hal/gnss/GNSS.c -msgid "Could not initialize GNSS" -msgstr "Kan GNSS niet initialiseren" - -#: ports/cxd56/common-hal/sdioio/SDCard.c -msgid "Could not initialize SDCard" -msgstr "Kan SDCard niet initialiseren" - -#: ports/atmel-samd/common-hal/busio/UART.c ports/cxd56/common-hal/busio/UART.c -#: ports/espressif/common-hal/busio/UART.c -msgid "Could not initialize UART" -msgstr "Kan UART niet initialiseren" - -#: ports/stm/common-hal/pwmio/PWMOut.c -msgid "Could not re-init channel" -msgstr "Kan kanaal niet her-initialiseren" - -#: ports/stm/common-hal/pwmio/PWMOut.c -msgid "Could not re-init timer" -msgstr "Kan timer niet her-initialiseren" - -#: ports/stm/common-hal/pwmio/PWMOut.c -msgid "Could not restart PWM" -msgstr "Kan PWM niet herstarten" - #: ports/espressif/common-hal/neopixel_write/__init__.c msgid "Could not retrieve clock" msgstr "Kon klok niet ophalen" @@ -880,20 +820,6 @@ msgstr "Kan interrupt niet starten, RX is bezig" msgid "Couldn't allocate decoder" msgstr "Kan decoder niet alloceren" -#: shared-module/audiocore/WaveFile.c shared-module/audiomixer/Mixer.c -#: shared-module/audiomp3/MP3Decoder.c -msgid "Couldn't allocate first buffer" -msgstr "Kan eerste buffer niet alloceren" - -#: shared-module/audiomp3/MP3Decoder.c -msgid "Couldn't allocate input buffer" -msgstr "Kan input buffer niet alloceren" - -#: shared-module/audiocore/WaveFile.c shared-module/audiomixer/Mixer.c -#: shared-module/audiomp3/MP3Decoder.c -msgid "Couldn't allocate second buffer" -msgstr "Kan tweede buffer niet alloceren" - #: supervisor/shared/safe_mode.c msgid "Crash into the HardFault_Handler." msgstr "Crash naar de HardFault_Handler." @@ -941,10 +867,6 @@ msgstr "Bestemming grootte is kleiner dan destination_length." msgid "Device in use" msgstr "Apparaat al in gebruik" -#: ports/cxd56/common-hal/digitalio/DigitalInOut.c -msgid "DigitalInOut not supported on given pin" -msgstr "DigitalInOut niet ondersteund door gegeven pin" - #: shared-bindings/displayio/Display.c #: shared-bindings/framebufferio/FramebufferDisplay.c msgid "Display must have a 16 bit colorspace." @@ -956,6 +878,10 @@ msgstr "Beeldscherm moet een 16bit kleurruimte hebben." msgid "Display rotation must be in 90 degree increments" msgstr "Beeldscherm rotatie moet in stappen van 90 graden" +#: main.c +msgid "Done" +msgstr "" + #: shared-bindings/digitalio/DigitalInOut.c msgid "Drive mode not used when direction is input." msgstr "Drive modus niet gebruikt als de richting input is." @@ -989,21 +915,20 @@ msgstr "Fout in regex" msgid "Error: Failure to bind" msgstr "" -#: ports/raspberrypi/bindings/rp2pio/StateMachine.c py/enum.c -#: shared-bindings/_bleio/__init__.c shared-bindings/aesio/aes.c -#: shared-bindings/busio/SPI.c shared-bindings/microcontroller/Pin.c +#: py/enum.c shared-bindings/_bleio/__init__.c shared-bindings/aesio/aes.c +#: shared-bindings/alarm/__init__.c shared-bindings/busio/SPI.c +#: shared-bindings/microcontroller/Pin.c #: shared-bindings/neopixel_write/__init__.c msgid "Expected a %q" msgstr "Verwacht een %q" -#: shared-bindings/alarm/__init__.c -msgid "Expected an alarm" -msgstr "Verwachtte een alarm" +#: ports/raspberrypi/bindings/cyw43/__init__.c +msgid "Expected a %q or %q" +msgstr "" -#: shared-module/adafruit_pixelbuf/PixelBuf.c -#, c-format -msgid "Expected tuple of length %d, got %d" -msgstr "Verwachtte een tuple met lengte %d, maar kreeg %d" +#: shared-bindings/alarm/__init__.c +msgid "Expected an %q" +msgstr "" #: ports/espressif/common-hal/_bleio/Adapter.c #: ports/nrf/common-hal/_bleio/Adapter.c @@ -1031,21 +956,9 @@ msgstr "Commando verzenden mislukt." msgid "Failed to acquire mutex, err 0x%04x" msgstr "Fout tijdens verkrijgen mutex, err 0x%04x" -#: ports/mimxrt10xx/common-hal/busio/UART.c ports/nrf/common-hal/busio/UART.c -#: ports/raspberrypi/common-hal/busio/UART.c -msgid "Failed to allocate RX buffer" -msgstr "RX buffer alloceren mislukt" - -#: ports/atmel-samd/common-hal/busio/UART.c -#: ports/atmel-samd/common-hal/pulseio/PulseIn.c -#: ports/cxd56/common-hal/pulseio/PulseIn.c -#: ports/espressif/common-hal/pulseio/PulseIn.c -#: ports/nrf/common-hal/pulseio/PulseIn.c -#: ports/raspberrypi/common-hal/pulseio/PulseIn.c -#: ports/stm/common-hal/pulseio/PulseIn.c -#, c-format -msgid "Failed to allocate RX buffer of %d bytes" -msgstr "Mislukt een RX buffer van %d bytes te alloceren" +#: shared-module/rgbmatrix/RGBMatrix.c +msgid "Failed to allocate %q buffer" +msgstr "" #: ports/espressif/common-hal/wifi/__init__.c msgid "Failed to allocate Wifi memory" @@ -1068,10 +981,6 @@ msgstr "Verbinding mislukt: interne fout" msgid "Failed to connect: timeout" msgstr "Verbinding mislukt: timeout" -#: ports/espressif/common-hal/wifi/__init__.c -msgid "Failed to init wifi" -msgstr "Kon WiFi niet initialiseren" - #: shared-module/audiomp3/MP3Decoder.c msgid "Failed to parse MP3 file" msgstr "Mislukt om MP3 bestand te ontleden" @@ -1115,11 +1024,6 @@ msgstr "" msgid "Format not supported" msgstr "Formaat wordt niet ondersteund" -#: shared-module/framebufferio/FramebufferDisplay.c -#, c-format -msgid "Framebuffer requires %d bytes" -msgstr "Framebuffer benodigd %d bytes" - #: ports/mimxrt10xx/common-hal/microcontroller/Processor.c msgid "" "Frequency must be 24, 150, 396, 450, 528, 600, 720, 816, 912, 960 or 1008 Mhz" @@ -1135,7 +1039,11 @@ msgstr "" msgid "Function requires lock" msgstr "Functie vereist lock" -#: ports/espressif/bindings/espidf/__init__.c ports/espressif/esp_error.c +#: ports/cxd56/common-hal/gnss/GNSS.c +msgid "GNSS init" +msgstr "" + +#: ports/espressif/common-hal/espidf/__init__.c ports/espressif/esp_error.c msgid "Generic Failure" msgstr "" @@ -1162,19 +1070,16 @@ msgstr "Hardware bezig, probeer alternatieve pinnen" msgid "Hardware in use, try alternative pins" msgstr "Hardware in gebruik, probeer alternatieve pinnen" -#: shared-bindings/wifi/Radio.c -msgid "Hostname must be between 1 and 253 characters" -msgstr "Hostnaam moet tussen 1 en 253 karakters zijn" - #: extmod/vfs_posix_file.c py/objstringio.c msgid "I/O operation on closed file" msgstr "I/O actie op gesloten bestand" #: ports/stm/common-hal/busio/I2C.c -msgid "I2C Init Error" -msgstr "I2C Init Fout" +msgid "I2C init error" +msgstr "" #: ports/raspberrypi/common-hal/busio/I2C.c +#: ports/raspberrypi/common-hal/i2ctarget/I2CTarget.c msgid "I2C peripheral in use" msgstr "" @@ -1281,75 +1186,37 @@ msgstr "" msgid "Internal error #%d" msgstr "Interne fout #%d" -#: shared-bindings/sdioio/SDCard.c shared-module/usb_hid/Device.c +#: supervisor/shared/safe_mode.c +msgid "Internal watchdog timer expired." +msgstr "" + +#: py/argcheck.c shared-bindings/digitalio/DigitalInOut.c msgid "Invalid %q" msgstr "Ongeldige %q" -#: ports/atmel-samd/common-hal/audiobusio/I2SOut.c -#: ports/atmel-samd/common-hal/audiobusio/PDMIn.c -#: ports/atmel-samd/common-hal/imagecapture/ParallelImageCapture.c -#: ports/mimxrt10xx/common-hal/busio/UART.c +#: shared-bindings/microcontroller/Pin.c msgid "Invalid %q pin" msgstr "Ongeldige %q pin" -#: ports/stm/common-hal/busio/I2C.c ports/stm/common-hal/busio/SPI.c -#: ports/stm/common-hal/busio/UART.c ports/stm/common-hal/canio/CAN.c -#: ports/stm/common-hal/sdioio/SDCard.c -msgid "Invalid %q pin selection" -msgstr "Ongeldige %q pin selectie" - #: ports/stm/common-hal/analogio/AnalogIn.c msgid "Invalid ADC Unit value" msgstr "Ongeldige ADC Unit waarde" -#: ports/espressif/common-hal/wifi/Radio.c -msgid "Invalid AuthMode" -msgstr "" - #: ports/espressif/common-hal/_bleio/__init__.c #: ports/nrf/common-hal/_bleio/__init__.c msgid "Invalid BLE parameter" msgstr "" -#: shared-module/displayio/OnDiskBitmap.c -msgid "Invalid BMP file" -msgstr "Ongeldig BMP bestand" - #: shared-bindings/wifi/Radio.c msgid "Invalid BSSID" msgstr "Ongeldig BSSID" -#: ports/espressif/common-hal/analogio/AnalogOut.c -#: ports/stm/common-hal/analogio/AnalogOut.c -msgid "Invalid DAC pin supplied" -msgstr "Ongeldige DAC pin opgegeven" - #: shared-bindings/wifi/Radio.c msgid "Invalid MAC address" msgstr "" -#: shared-bindings/synthio/__init__.c -msgid "Invalid MIDI file" -msgstr "" - -#: ports/atmel-samd/common-hal/pwmio/PWMOut.c -#: ports/cxd56/common-hal/pwmio/PWMOut.c -#: ports/espressif/common-hal/pwmio/PWMOut.c -#: ports/mimxrt10xx/common-hal/pwmio/PWMOut.c -#: ports/nrf/common-hal/pwmio/PWMOut.c -#: ports/raspberrypi/common-hal/pwmio/PWMOut.c shared-bindings/pwmio/PWMOut.c -msgid "Invalid PWM frequency" -msgstr "Ongeldige PWM frequentie" - -#: ports/espressif/common-hal/analogio/AnalogIn.c -msgid "Invalid Pin" -msgstr "Ongeldige Pin" - -#: ports/espressif/bindings/espidf/__init__.c -#: ports/espressif/common-hal/busio/I2C.c -#: ports/espressif/common-hal/i2cperipheral/I2CPeripheral.c -#: ports/espressif/esp_error.c py/moduerrno.c -#: shared-module/rgbmatrix/RGBMatrix.c +#: ports/espressif/common-hal/espidf/__init__.c ports/espressif/esp_error.c +#: py/moduerrno.c msgid "Invalid argument" msgstr "Ongeldig argument" @@ -1357,42 +1224,11 @@ msgstr "Ongeldig argument" msgid "Invalid bits per value" msgstr "Ongeldige bits per waarde" -#: ports/nrf/common-hal/busio/UART.c ports/raspberrypi/common-hal/busio/UART.c -#: ports/stm/common-hal/busio/UART.c -msgid "Invalid buffer size" -msgstr "Ongeldige buffer grootte" - -#: shared-bindings/adafruit_pixelbuf/PixelBuf.c -msgid "Invalid byteorder string" -msgstr "Ongeldige byteorder string" - -#: ports/atmel-samd/common-hal/frequencyio/FrequencyIn.c -#: ports/espressif/common-hal/frequencyio/FrequencyIn.c -msgid "Invalid capture period. Valid range: 1 - 500" -msgstr "Ongeldige vastlegging periode. Geldig bereik: 1 - 500" - -#: shared-bindings/audiomixer/Mixer.c -msgid "Invalid channel count" -msgstr "Ongeldige kanaal aantallen" - -#: ports/atmel-samd/common-hal/imagecapture/ParallelImageCapture.c -#, c-format -msgid "Invalid data_count %d" -msgstr "" - #: ports/atmel-samd/common-hal/imagecapture/ParallelImageCapture.c #, c-format msgid "Invalid data_pins[%d]" msgstr "" -#: shared-bindings/digitalio/DigitalInOut.c -msgid "Invalid direction." -msgstr "Ongeldige richting." - -#: shared-module/audiocore/WaveFile.c -msgid "Invalid file" -msgstr "Ongeldig bestand" - #: shared-module/audiocore/WaveFile.c msgid "Invalid format chunk size" msgstr "Ongeldig formaat stuk grootte" @@ -1401,107 +1237,27 @@ msgstr "Ongeldig formaat stuk grootte" msgid "Invalid memory access." msgstr "Ongeldig geheugen adres." -#: extmod/vfs_fat_file.c -msgid "Invalid mode" -msgstr "" - #: ports/espressif/common-hal/wifi/Radio.c msgid "Invalid multicast MAC address" msgstr "" -#: shared-bindings/bitbangio/SPI.c shared-bindings/busio/SPI.c -msgid "Invalid number of bits" -msgstr "Ongeldig aantal bits" - -#: shared-bindings/bitbangio/SPI.c shared-bindings/busio/SPI.c -#: shared-bindings/displayio/FourWire.c -msgid "Invalid phase" -msgstr "Ongeldige fase" - -#: ports/atmel-samd/common-hal/audioio/AudioOut.c -#: ports/atmel-samd/common-hal/touchio/TouchIn.c -#: ports/espressif/common-hal/alarm/touch/TouchAlarm.c -#: ports/espressif/common-hal/touchio/TouchIn.c -#: ports/nrf/common-hal/alarm/pin/PinAlarm.c shared-bindings/pwmio/PWMOut.c -#: shared-module/rgbmatrix/RGBMatrix.c -msgid "Invalid pin" -msgstr "Ongeldige pin" - -#: ports/atmel-samd/common-hal/audioio/AudioOut.c -msgid "Invalid pin for left channel" -msgstr "Ongeldige pin voor linker kanaal" - -#: ports/atmel-samd/common-hal/audioio/AudioOut.c -msgid "Invalid pin for right channel" -msgstr "Ongeldige pin voor rechter kanaal" - -#: ports/atmel-samd/common-hal/busio/I2C.c -#: ports/atmel-samd/common-hal/busio/SPI.c -#: ports/atmel-samd/common-hal/busio/UART.c -#: ports/atmel-samd/common-hal/i2cperipheral/I2CPeripheral.c -#: ports/cxd56/common-hal/busio/I2C.c ports/cxd56/common-hal/busio/SPI.c -#: ports/cxd56/common-hal/busio/UART.c ports/cxd56/common-hal/sdioio/SDCard.c -#: ports/espressif/common-hal/busio/I2C.c -#: ports/espressif/common-hal/busio/SPI.c -#: ports/espressif/common-hal/busio/UART.c -#: ports/espressif/common-hal/canio/CAN.c -#: ports/espressif/common-hal/i2cperipheral/I2CPeripheral.c -#: ports/mimxrt10xx/common-hal/busio/I2C.c -#: ports/mimxrt10xx/common-hal/busio/SPI.c -#: ports/mimxrt10xx/common-hal/usb_host/Port.c ports/nrf/common-hal/busio/I2C.c -#: ports/raspberrypi/common-hal/busio/I2C.c -#: ports/raspberrypi/common-hal/busio/SPI.c -#: ports/raspberrypi/common-hal/busio/UART.c shared-bindings/busio/SPI.c #: shared-bindings/busio/UART.c msgid "Invalid pins" msgstr "Ongeldige pinnen" -#: shared-bindings/bitbangio/SPI.c shared-bindings/busio/SPI.c -#: shared-bindings/displayio/FourWire.c -msgid "Invalid polarity" -msgstr "Ongeldige polariteit" - -#: shared-bindings/_bleio/Characteristic.c -msgid "Invalid properties" -msgstr "Ongeldige eigenschappen" - -#: shared-bindings/microcontroller/__init__.c -msgid "Invalid run mode." -msgstr "Ongeldige run modus." - -#: shared-module/_bleio/Attribute.c -msgid "Invalid security_mode" -msgstr "Ongeldige security_mode" - -#: ports/espressif/bindings/espidf/__init__.c ports/espressif/esp_error.c +#: ports/espressif/common-hal/espidf/__init__.c ports/espressif/esp_error.c msgid "Invalid size" msgstr "" #: ports/espressif/common-hal/ssl/SSLContext.c +#: ports/raspberrypi/common-hal/ssl/SSLSocket.c msgid "Invalid socket for TLS" msgstr "" -#: ports/espressif/bindings/espidf/__init__.c ports/espressif/esp_error.c +#: ports/espressif/common-hal/espidf/__init__.c ports/espressif/esp_error.c msgid "Invalid state" msgstr "" -#: shared-bindings/audiomixer/Mixer.c -msgid "Invalid voice" -msgstr "Ongeldige stem" - -#: shared-bindings/audiomixer/Mixer.c -msgid "Invalid voice count" -msgstr "Ongeldig stem aantal" - -#: shared-module/audiocore/WaveFile.c -msgid "Invalid wave file" -msgstr "Ongeldig wave bestand" - -#: ports/mimxrt10xx/common-hal/busio/UART.c ports/nrf/common-hal/busio/UART.c -#: ports/raspberrypi/common-hal/busio/UART.c ports/stm/common-hal/busio/UART.c -msgid "Invalid word/bit length" -msgstr "Ongeldig woord/bit lengte" - #: shared-bindings/aesio/aes.c msgid "Key must be 16, 24, or 32 bytes long" msgstr "Sleutel moet 16, 24, of 32 bytes lang zijn" @@ -1515,24 +1271,16 @@ msgid "LHS of keyword arg must be an id" msgstr "LHS van sleutelwoord arg moet een id zijn" #: shared-module/displayio/Group.c -msgid "Layer already in a group." -msgstr "Laag al in groep." - -#: shared-module/displayio/Group.c -msgid "Layer must be a Group or TileGrid subclass." -msgstr "Laag moet een Groep of TileGrid subklasse zijn." - -#: ports/espressif/bindings/espidf/__init__.c ports/espressif/esp_error.c -msgid "MAC address was invalid" +msgid "Layer already in a group" msgstr "" -#: shared-module/bitbangio/SPI.c -msgid "MISO pin init failed." -msgstr "MISO pin init mislukt." +#: shared-module/displayio/Group.c +msgid "Layer must be a Group or TileGrid subclass" +msgstr "" -#: shared-module/bitbangio/SPI.c -msgid "MOSI pin init failed." -msgstr "MOSI pin init mislukt." +#: ports/espressif/common-hal/espidf/__init__.c ports/espressif/esp_error.c +msgid "MAC address was invalid" +msgstr "" #: shared-bindings/is31fl3741/IS31FL3741.c msgid "Mapping must be a tuple" @@ -1543,10 +1291,6 @@ msgstr "" msgid "Maximum x value when mirrored is %d" msgstr "Maximale x waarde indien gespiegeld is %d" -#: shared-bindings/canio/Message.c -msgid "Messages limited to 8 bytes" -msgstr "Berichten zijn beperkt tot 8 bytes" - #: shared-bindings/audiobusio/PDMIn.c msgid "Microphone startup delay must be in range 0.0 to 1.0" msgstr "Microfoon opstart vertraging moet in bereik van 0.0 tot 1.0 zijn" @@ -1560,10 +1304,14 @@ msgstr "" msgid "Mismatched swap flag" msgstr "" -#: ports/mimxrt10xx/common-hal/busio/SPI.c ports/stm/common-hal/busio/SPI.c +#: ports/mimxrt10xx/common-hal/busio/SPI.c msgid "Missing MISO or MOSI Pin" msgstr "Ontbrekende MISO of MOSI Pin" +#: ports/stm/common-hal/busio/SPI.c +msgid "Missing MISO or MOSI pin" +msgstr "" + #: ports/raspberrypi/common-hal/rp2pio/StateMachine.c #, c-format msgid "Missing first_in_pin. Instruction %d reads pin(s)" @@ -1599,11 +1347,6 @@ msgstr "" msgid "Missing jmp_pin. Instruction %d jumps on pin" msgstr "" -#: shared-module/usb_hid/Device.c -#, c-format -msgid "More than %d report ids not supported" -msgstr "" - #: shared-bindings/busio/UART.c shared-bindings/displayio/Group.c msgid "Must be a %q subclass." msgstr "%q moet een subklasse zijn." @@ -1663,16 +1406,28 @@ msgstr "" msgid "No I2C device at address: 0x%x" msgstr "" +#: supervisor/shared/web_workflow/web_workflow.c +msgid "No IP" +msgstr "" + #: ports/espressif/common-hal/busio/SPI.c -#: ports/mimxrt10xx/common-hal/busio/SPI.c ports/stm/common-hal/busio/SPI.c +#: ports/mimxrt10xx/common-hal/busio/SPI.c msgid "No MISO Pin" msgstr "Geen MISO pin" +#: ports/stm/common-hal/busio/SPI.c shared-module/bitbangio/SPI.c +msgid "No MISO pin" +msgstr "" + #: ports/espressif/common-hal/busio/SPI.c -#: ports/mimxrt10xx/common-hal/busio/SPI.c ports/stm/common-hal/busio/SPI.c +#: ports/mimxrt10xx/common-hal/busio/SPI.c msgid "No MOSI Pin" msgstr "Geen MOSI pin" +#: ports/stm/common-hal/busio/SPI.c shared-module/bitbangio/SPI.c +msgid "No MOSI pin" +msgstr "" + #: ports/atmel-samd/common-hal/busio/UART.c #: ports/espressif/common-hal/busio/UART.c #: ports/mimxrt10xx/common-hal/busio/UART.c ports/nrf/common-hal/busio/UART.c @@ -1711,16 +1466,6 @@ msgstr "Geen vrije GCLKs" msgid "No hardware random available" msgstr "Geen hardware random beschikbaar" -#: ports/atmel-samd/common-hal/ps2io/Ps2.c -msgid "No hardware support on clk pin" -msgstr "Geen hardware ondersteuning beschikbaar op clk pin" - -#: ports/atmel-samd/common-hal/alarm/pin/PinAlarm.c -#: ports/atmel-samd/common-hal/frequencyio/FrequencyIn.c -#: ports/atmel-samd/common-hal/pulseio/PulseIn.c -msgid "No hardware support on pin" -msgstr "Geen hardware ondersteuning op pin" - #: ports/raspberrypi/common-hal/rp2pio/StateMachine.c msgid "No in in program" msgstr "" @@ -1820,16 +1565,26 @@ msgstr "" msgid "Odd parity is not supported" msgstr "Oneven pariteit is niet ondersteund" +#: supervisor/shared/bluetooth/bluetooth.c +msgid "Off" +msgstr "" + +#: supervisor/shared/bluetooth/bluetooth.c +msgid "Ok" +msgstr "" + #: ports/atmel-samd/common-hal/audiobusio/PDMIn.c #: ports/raspberrypi/common-hal/audiobusio/PDMIn.c msgid "Only 8 or 16 bit mono with " msgstr "Alleen 8 of 16 bit mono met " #: ports/espressif/common-hal/wifi/__init__.c +#: ports/raspberrypi/common-hal/wifi/__init__.c msgid "Only IPv4 addresses supported" msgstr "Alleen IPv4 adressen worden ondersteund" -#: ports/espressif/common-hal/socketpool/SocketPool.c +#: ports/espressif/common-hal/socketpool/Socket.c +#: ports/raspberrypi/common-hal/socketpool/Socket.c msgid "Only IPv4 sockets supported" msgstr "Alleen IPv4-sockets ondersteund" @@ -1866,15 +1621,19 @@ msgstr "" msgid "Only one TouchAlarm can be set in deep sleep." msgstr "" -#: ports/espressif/common-hal/i2cperipheral/I2CPeripheral.c +#: ports/espressif/common-hal/i2ctarget/I2CTarget.c +#: ports/raspberrypi/common-hal/i2ctarget/I2CTarget.c msgid "Only one address is allowed" msgstr "" #: ports/atmel-samd/common-hal/alarm/time/TimeAlarm.c -#: ports/espressif/common-hal/alarm/time/TimeAlarm.c #: ports/nrf/common-hal/alarm/time/TimeAlarm.c -#: ports/raspberrypi/common-hal/alarm/time/TimeAlarm.c #: ports/stm/common-hal/alarm/time/TimeAlarm.c +msgid "Only one alarm.time alarm can be set" +msgstr "" + +#: ports/espressif/common-hal/alarm/time/TimeAlarm.c +#: ports/raspberrypi/common-hal/alarm/time/TimeAlarm.c msgid "Only one alarm.time alarm can be set." msgstr "Slechts één alarm.time alarm kan worden ingesteld." @@ -1886,19 +1645,20 @@ msgstr "Er kan maar één kleur per keer transparant zijn" msgid "Operation not permitted" msgstr "" -#: ports/espressif/bindings/espidf/__init__.c ports/espressif/esp_error.c +#: ports/espressif/common-hal/espidf/__init__.c ports/espressif/esp_error.c msgid "Operation or feature not supported" msgstr "" -#: ports/espressif/bindings/espidf/__init__.c ports/espressif/esp_error.c +#: ports/espressif/common-hal/espidf/__init__.c ports/espressif/esp_error.c msgid "Operation timed out" msgstr "" -#: ports/espressif/bindings/espidf/__init__.c ports/espressif/esp_error.c +#: ports/espressif/common-hal/espidf/__init__.c ports/espressif/esp_error.c msgid "Out of memory" msgstr "" -#: ports/espressif/common-hal/socketpool/SocketPool.c +#: ports/espressif/common-hal/socketpool/Socket.c +#: ports/raspberrypi/common-hal/socketpool/Socket.c msgid "Out of sockets" msgstr "Geen sockets meer beschikbaar" @@ -1906,11 +1666,6 @@ msgstr "Geen sockets meer beschikbaar" msgid "Out-buffer elements must be <= 4 bytes long" msgstr "" -#: shared-bindings/bitops/__init__.c -#, c-format -msgid "Output buffer must be at least %d bytes" -msgstr "" - #: shared-bindings/audiobusio/PDMIn.c msgid "Oversample must be multiple of 8." msgstr "Oversample moet een meervoud van 8 zijn." @@ -1919,12 +1674,6 @@ msgstr "Oversample moet een meervoud van 8 zijn." msgid "PDMIn not available" msgstr "" -#: shared-bindings/pwmio/PWMOut.c -msgid "" -"PWM duty_cycle must be between 0 and 65535 inclusive (16 bit resolution)" -msgstr "" -"PWM duty_cycle moet tussen 0 en 65535 inclusief zijn (16 bit resolutie)" - #: shared-bindings/pwmio/PWMOut.c msgid "" "PWM frequency not writable when variable_frequency is False on construction." @@ -1932,6 +1681,10 @@ msgstr "" "PWM frequentie is niet schrijfbaar wanneer de variable_frequency False is " "tijdens constructie." +#: ports/stm/common-hal/pwmio/PWMOut.c +msgid "PWM restart" +msgstr "" + #: ports/raspberrypi/common-hal/countio/Counter.c msgid "PWM slice already in use" msgstr "" @@ -1948,36 +1701,20 @@ msgstr "" msgid "Permission denied" msgstr "Toegang geweigerd" -#: ports/atmel-samd/common-hal/alarm/pin/PinAlarm.c #: ports/stm/common-hal/alarm/pin/PinAlarm.c msgid "Pin cannot wake from Deep Sleep" msgstr "" -#: ports/raspberrypi/bindings/rp2pio/StateMachine.c -msgid "Pin count must be at least 1" -msgstr "" - #: ports/raspberrypi/common-hal/rp2pio/StateMachine.c msgid "Pin count too large" msgstr "" -#: ports/atmel-samd/common-hal/analogio/AnalogIn.c -#: ports/cxd56/common-hal/analogio/AnalogIn.c -#: ports/espressif/common-hal/analogio/AnalogIn.c -#: ports/mimxrt10xx/common-hal/analogio/AnalogIn.c -#: ports/nrf/common-hal/analogio/AnalogIn.c -#: ports/raspberrypi/common-hal/analogio/AnalogIn.c -#: ports/stm/common-hal/analogio/AnalogIn.c -msgid "Pin does not have ADC capabilities" -msgstr "Pin heeft geen ADC mogelijkheden" - #: ports/stm/common-hal/alarm/pin/PinAlarm.c #: ports/stm/common-hal/pulseio/PulseIn.c msgid "Pin interrupt already in use" msgstr "" #: shared-bindings/adafruit_bus_device/spi_device/SPIDevice.c -#: shared-bindings/digitalio/DigitalInOut.c msgid "Pin is input only" msgstr "Pin kan alleen voor invoer gebruikt worden" @@ -2042,18 +1779,10 @@ msgstr "" msgid "Program does OUT without loading OSR" msgstr "" -#: ports/raspberrypi/bindings/rp2pio/StateMachine.c -msgid "Program must contain at least one 16-bit instruction." -msgstr "" - #: ports/raspberrypi/bindings/rp2pio/StateMachine.c msgid "Program size invalid" msgstr "" -#: ports/raspberrypi/bindings/rp2pio/StateMachine.c -msgid "Program too large" -msgstr "" - #: shared-bindings/digitalio/DigitalInOut.c msgid "Pull not used when direction is output." msgstr "Pull niet gebruikt wanneer de richting output is." @@ -2075,8 +1804,9 @@ msgstr "RNG DeInit Fout" msgid "RNG Init Error" msgstr "RNG Init Fout" -#: ports/nrf/common-hal/busio/UART.c -msgid "RS485 Not yet supported on this device" +#: ports/atmel-samd/common-hal/busio/UART.c ports/cxd56/common-hal/busio/UART.c +#: ports/nrf/common-hal/busio/UART.c ports/stm/common-hal/busio/UART.c +msgid "RS485" msgstr "" #: ports/espressif/common-hal/busio/UART.c @@ -2084,21 +1814,10 @@ msgstr "" msgid "RS485 inversion specified when not in RS485 mode" msgstr "RS485 inversie gespecificeerd terwijl niet in RS485 modus" -#: ports/cxd56/common-hal/rtc/RTC.c ports/espressif/common-hal/rtc/RTC.c -#: ports/mimxrt10xx/common-hal/rtc/RTC.c ports/nrf/common-hal/rtc/RTC.c -#: ports/raspberrypi/common-hal/rtc/RTC.c -msgid "RTC calibration is not supported on this board" -msgstr "RTC calibratie niet ondersteund door dit board" - #: shared-bindings/alarm/time/TimeAlarm.c shared-bindings/time/__init__.c msgid "RTC is not supported on this board" msgstr "RTC is niet ondersteund door dit board" -#: ports/atmel-samd/common-hal/busio/UART.c ports/cxd56/common-hal/busio/UART.c -#: ports/stm/common-hal/busio/UART.c -msgid "RTS/CTS/RS485 Not yet supported on this device" -msgstr "RTS/CTS/RS485 Nog niet ondersteund door dit apparaat" - #: ports/stm/common-hal/os/__init__.c msgid "Random number generation error" msgstr "Random number generatie fout" @@ -2116,10 +1835,14 @@ msgstr "Alleen-lezen bestandssysteem" msgid "Read-only object" msgstr "Alleen-lezen object" -#: ports/espressif/bindings/espidf/__init__.c ports/espressif/esp_error.c +#: ports/espressif/common-hal/espidf/__init__.c ports/espressif/esp_error.c msgid "Received response was invalid" msgstr "" +#: supervisor/shared/bluetooth/bluetooth.c +msgid "Reconnecting" +msgstr "" + #: shared-bindings/displayio/EPaperDisplay.c msgid "Refresh too soon" msgstr "Verversing te snel" @@ -2132,7 +1855,7 @@ msgstr "RemoteTransmissionRequests is beperkt tot 8 bytes" msgid "Requested AES mode is unsupported" msgstr "Gevraagde AES modus is niet ondersteund" -#: ports/espressif/bindings/espidf/__init__.c ports/espressif/esp_error.c +#: ports/espressif/common-hal/espidf/__init__.c ports/espressif/esp_error.c msgid "Requested resource not found" msgstr "" @@ -2148,6 +1871,10 @@ msgstr "Draaiende in veilige modus! Opgeslagen code wordt niet uitgevoerd.\n" msgid "SD card CSD format not supported" msgstr "SD kaart CSD formaat niet ondersteund" +#: ports/cxd56/common-hal/sdioio/SDCard.c +msgid "SDCard init" +msgstr "" + #: ports/stm/common-hal/sdioio/SDCard.c #, c-format msgid "SDIO GetCardInfo Error %d" @@ -2158,30 +1885,21 @@ msgstr "SDIO GetCardInfo Fout %d" msgid "SDIO Init Error %d" msgstr "SDIO Init Fout %d" -#: ports/stm/common-hal/busio/SPI.c -msgid "SPI Init Error" -msgstr "SPI Init Fout" - -#: ports/stm/common-hal/busio/SPI.c -msgid "SPI Re-initialization error" -msgstr "SPI Herinitialisatie Fout" - #: ports/espressif/common-hal/busio/SPI.c msgid "SPI configuration failed" msgstr "" +#: ports/stm/common-hal/busio/SPI.c +msgid "SPI init error" +msgstr "" + #: ports/raspberrypi/common-hal/busio/SPI.c msgid "SPI peripheral in use" msgstr "" -#: shared-bindings/audiomixer/Mixer.c -msgid "Sample rate must be positive" -msgstr "Sample rate moet positief zijn" - -#: ports/atmel-samd/common-hal/audioio/AudioOut.c -#, c-format -msgid "Sample rate too high. It must be less than %d" -msgstr "Sample rate is te hoog. Moet minder dan %d zijn" +#: ports/stm/common-hal/busio/SPI.c +msgid "SPI re-init" +msgstr "" #: shared-bindings/is31fl3741/FrameBuffer.c msgid "Scale dimensions must divide by 3" @@ -2201,14 +1919,6 @@ msgstr "Serializer in gebruik" msgid "Server side context cannot have hostname" msgstr "Context aan de serverkant kan geen hostnaam hebben" -#: ports/raspberrypi/bindings/rp2pio/StateMachine.c -msgid "Set pin count must be between 1 and 5" -msgstr "" - -#: ports/raspberrypi/bindings/rp2pio/StateMachine.c -msgid "Side set pin count must be between 1 and 5" -msgstr "" - #: ports/cxd56/common-hal/camera/Camera.c msgid "Size not supported" msgstr "Afmeting niet ondersteund" @@ -2229,6 +1939,7 @@ msgid "Slices not supported" msgstr "Slices niet ondersteund" #: ports/espressif/common-hal/socketpool/SocketPool.c +#: ports/raspberrypi/common-hal/socketpool/SocketPool.c msgid "SocketPool can only be used with wifi.radio" msgstr "SocketPool kan alleen met wifi.radio gebruikt worden" @@ -2244,10 +1955,6 @@ msgstr "" msgid "Splitting with sub-captures" msgstr "Splitting met sub-captures" -#: shared-bindings/supervisor/__init__.c -msgid "Stack size must be at least 256" -msgstr "Stack grootte moet op zijn minst 256 zijn" - #: ports/raspberrypi/common-hal/audiopwmio/PWMAudioOut.c msgid "Stereo left must be on PWM channel A" msgstr "" @@ -2256,10 +1963,6 @@ msgstr "" msgid "Stereo right must be on PWM channel B" msgstr "" -#: shared-bindings/multiterminal/__init__.c -msgid "Stream missing readinto() or write() method." -msgstr "Stream mist readinto() of write() methode." - #: ports/mimxrt10xx/common-hal/busio/UART.c ports/stm/common-hal/busio/UART.c msgid "Supply at least one UART pin" msgstr "Geef op zijn minst 1 UART pin op" @@ -2333,10 +2036,6 @@ msgstr "Tile hoogte moet exact de bitmap hoogte verdelen" msgid "Tile index out of bounds" msgstr "Tile index buiten bereik" -#: shared-bindings/displayio/TileGrid.c -msgid "Tile value out of bounds" -msgstr "Tile waarde buiten bereik" - #: shared-bindings/displayio/TileGrid.c msgid "Tile width must exactly divide bitmap width" msgstr "Tile breedte moet exact de bitmap breedte verdelen" @@ -2356,6 +2055,9 @@ msgid "To exit, please reset the board without " msgstr "Om te beëindigen, reset het bord zonder " #: ports/atmel-samd/common-hal/audiobusio/I2SOut.c +msgid "Too many channels in sample" +msgstr "" + #: ports/raspberrypi/common-hal/audiobusio/I2SOut.c msgid "Too many channels in sample." msgstr "Teveel kanalen in sample." @@ -2388,24 +2090,25 @@ msgid "Tuple or struct_time argument required" msgstr "Tuple of struct_time argument vereist" #: ports/stm/common-hal/busio/UART.c -msgid "UART Buffer allocation error" -msgstr "UART Buffer allocatie fout" +msgid "UART de-init" +msgstr "" + +#: ports/atmel-samd/common-hal/busio/UART.c ports/cxd56/common-hal/busio/UART.c +#: ports/espressif/common-hal/busio/UART.c ports/stm/common-hal/busio/UART.c +msgid "UART init" +msgstr "" #: ports/stm/common-hal/busio/UART.c -msgid "UART De-init error" -msgstr "UART De-init fout" +msgid "UART re-init" +msgstr "" #: ports/stm/common-hal/busio/UART.c -msgid "UART Init Error" -msgstr "UART Init Fout" +msgid "UART write" +msgstr "" -#: ports/stm/common-hal/busio/UART.c -msgid "UART Re-init error" -msgstr "UART Re-init Fout" - -#: ports/stm/common-hal/busio/UART.c -msgid "UART write error" -msgstr "UART schrijf fout" +#: main.c +msgid "UID:" +msgstr "" #: shared-module/usb_hid/Device.c msgid "USB busy" @@ -2530,6 +2233,11 @@ msgstr "" msgid "Unknown system firmware error: %d" msgstr "" +#: ports/raspberrypi/common-hal/wifi/__init__.c +#, c-format +msgid "Unkown error code %d" +msgstr "" + #: shared-bindings/adafruit_pixelbuf/PixelBuf.c #, c-format msgid "Unmatched number of items on RHS (expected %d, got %d)." @@ -2543,12 +2251,6 @@ msgstr "" "Ongespecificeerd probleem. Kan zijn dat de pariteit prompt op het andere " "apparaat geweigerd of genegeerd werd." -#: ports/atmel-samd/common-hal/busio/I2C.c ports/cxd56/common-hal/busio/I2C.c -#: ports/espressif/common-hal/busio/UART.c -#: ports/raspberrypi/common-hal/busio/I2C.c ports/stm/common-hal/busio/I2C.c -msgid "Unsupported baudrate" -msgstr "Niet-ondersteunde baudsnelheid" - #: shared-bindings/bitmaptools/__init__.c msgid "Unsupported colorspace" msgstr "" @@ -2561,6 +2263,10 @@ msgstr "Niet-ondersteund beeldscherm bus type" msgid "Unsupported format" msgstr "Niet-ondersteunde format" +#: shared-bindings/hashlib/__init__.c +msgid "Unsupported hash algorithm" +msgstr "" + #: ports/espressif/common-hal/dualbank/__init__.c msgid "Update Failed" msgstr "Update Mislukt" @@ -2579,7 +2285,7 @@ msgstr "Waarde lengte != vereist vaste lengte" msgid "Value length > max_length" msgstr "Waarde length > max_length" -#: ports/espressif/bindings/espidf/__init__.c ports/espressif/esp_error.c +#: ports/espressif/common-hal/espidf/__init__.c ports/espressif/esp_error.c msgid "Version was invalid" msgstr "" @@ -2613,10 +2319,6 @@ msgstr "" msgid "WatchDogTimer.timeout must be greater than 0" msgstr "WatchDogTimer.timeout moet groter dan 0 zijn" -#: supervisor/shared/safe_mode.c -msgid "Watchdog timer expired." -msgstr "Watchdog-timer verstreken." - #: py/builtinhelp.c #, c-format msgid "" @@ -2627,9 +2329,9 @@ msgid "" "To list built-in modules type `help(\"modules\")`.\n" msgstr "" -#: shared-bindings/wifi/Radio.c -msgid "WiFi password must be between 8 and 63 characters" -msgstr "WiFi wachtwoord moet tussen 8 en 63 karakters bevatten" +#: supervisor/shared/web_workflow/web_workflow.c +msgid "Wi-Fi: " +msgstr "" #: main.c msgid "Woken up by alarm.\n" @@ -2669,11 +2371,7 @@ msgstr "__new__ arg moet een user-type zijn" msgid "a bytes-like object is required" msgstr "een bytes-achtig object is vereist" -#: shared-bindings/i2cperipheral/I2CPeripheral.c -msgid "address out of bounds" -msgstr "adres buiten bereik" - -#: shared-bindings/i2cperipheral/I2CPeripheral.c +#: shared-bindings/i2ctarget/I2CTarget.c msgid "addresses is empty" msgstr "adressen zijn leeg" @@ -2722,6 +2420,10 @@ msgstr "argumenten moeten ndarrays zijn" msgid "array and index length must be equal" msgstr "array en indexlengte moeten gelijk zijn" +#: extmod/ulab/code/numpy/io/io.c +msgid "array has too many dimensions" +msgstr "" + #: py/objarray.c shared-bindings/alarm/SleepMemory.c #: shared-bindings/nvm/ByteArray.c msgid "array/bytes required on right side" @@ -2783,10 +2485,6 @@ msgstr "" msgid "bits must be 32 or less" msgstr "" -#: shared-bindings/busio/UART.c -msgid "bits must be in range 5 to 9" -msgstr "" - #: shared-bindings/audiomixer/Mixer.c msgid "bits_per_sample must be 8 or 16" msgstr "bits_per_sample moet 8 of 16 zijn" @@ -2824,11 +2522,6 @@ msgstr "buffer te klein voor gevraagde bytes" msgid "byteorder is not a string" msgstr "byteorder is geen string" -#: ports/atmel-samd/common-hal/busio/UART.c -#: ports/espressif/common-hal/busio/UART.c -msgid "bytes > 8 bits not supported" -msgstr "butes > 8 niet ondersteund" - #: py/objarray.c msgid "bytes length not a multiple of item size" msgstr "bytes lengte is geen veelvoud van itemgrootte" @@ -2837,7 +2530,7 @@ msgstr "bytes lengte is geen veelvoud van itemgrootte" msgid "bytes value out of range" msgstr "bytes waarde buiten bereik" -#: ports/atmel-samd/bindings/samd/Clock.c ports/atmel-samd/common-hal/rtc/RTC.c +#: ports/atmel-samd/bindings/samd/Clock.c msgid "calibration is out of range" msgstr "calibration is buiten bereik" @@ -2845,12 +2538,9 @@ msgstr "calibration is buiten bereik" msgid "calibration is read only" msgstr "calibration is alleen-lezen" -#: ports/atmel-samd/common-hal/rtc/RTC.c -msgid "calibration value out of range +/-127" -msgstr "calibration waarde buiten bereik +/-127" - +#: shared-module/vectorio/Circle.c shared-module/vectorio/Polygon.c #: shared-module/vectorio/Rectangle.c -msgid "can only be registered in one parent" +msgid "can only have one parent" msgstr "" #: py/emitinlinethumb.c @@ -2874,8 +2564,7 @@ msgstr "kan niet toewijzen aan expressie" msgid "can't cancel self" msgstr "" -#: py/obj.c py/objint.c shared-bindings/i2cperipheral/I2CPeripheral.c -#: shared-module/adafruit_pixelbuf/PixelBuf.c +#: py/obj.c py/objint.c shared-module/adafruit_pixelbuf/PixelBuf.c msgid "can't convert %q to %q" msgstr "kan %q niet naar %q converteren" @@ -3022,6 +2711,10 @@ msgstr "" msgid "casting" msgstr "casting" +#: ports/stm/common-hal/pwmio/PWMOut.c +msgid "channel re-init" +msgstr "" + #: shared-bindings/_stage/Text.c msgid "chars buffer too small" msgstr "chars buffer te klein" @@ -3034,11 +2727,6 @@ msgstr "chr() arg niet binnen bereik (0x110000)" msgid "chr() arg not in range(256)" msgstr "chr() arg niet binnen bereik (256)" -#: shared-module/vectorio/Circle.c -msgid "circle can only be registered in one parent" -msgstr "" -"cirkel kan slechts bij één object van een hoger niveau worden geregistreerd" - #: shared-bindings/bitmaptools/__init__.c msgid "clip point must be (x,y) tuple" msgstr "" @@ -3063,10 +2751,6 @@ msgstr "kleurbuffer moet een bytearray of array van type 'b' of 'B' zijn" msgid "color must be between 0x000000 and 0xffffff" msgstr "kleur moet tussen 0x000000 en 0xffffff liggen" -#: shared-bindings/displayio/ColorConverter.c -msgid "color should be an int" -msgstr "kleur moet een int zijn" - #: py/emitnative.c msgid "comparison of int and uint" msgstr "" @@ -3103,6 +2787,10 @@ msgstr "convolutie argumenten moeten ndarrays zijn" msgid "convolve arguments must not be empty" msgstr "convolutie argumenten mogen niet leeg zijn" +#: extmod/ulab/code/numpy/io/io.c +msgid "corrupted file" +msgstr "" + #: extmod/ulab/code/numpy/poly.c msgid "could not invert Vandermonde matrix" msgstr "kon de Vandermonde matrix niet omkeren" @@ -3155,10 +2843,6 @@ msgstr "" msgid "destination buffer must be an array of type 'H' for bit_depth = 16" msgstr "bestemming buffer moet een array van het type 'H' voor bit_depth = 16" -#: shared-bindings/audiobusio/PDMIn.c -msgid "destination_length must be an int >= 0" -msgstr "destination_lengte moest een int groter dan of gelijk zijn aan 0 zijn" - #: py/objdict.c msgid "dict update sequence has wrong length" msgstr "dict update sequence heeft de verkeerde lengte" @@ -3196,6 +2880,10 @@ msgstr "" msgid "empty" msgstr "leeg" +#: extmod/ulab/code/numpy/io/io.c +msgid "empty file" +msgstr "" + #: extmod/moduasyncio.c extmod/moduheapq.c extmod/modutimeq.c msgid "empty heap" msgstr "lege heap" @@ -3212,10 +2900,6 @@ msgstr "lege sequentie" msgid "end of format while looking for conversion specifier" msgstr "einde van format terwijl zoekend naar conversie-specifier" -#: shared-bindings/displayio/Shape.c -msgid "end_x should be an int" -msgstr "end_x moet een int zijn" - #: shared-bindings/alarm/time/TimeAlarm.c msgid "epoch_time not supported on this board" msgstr "epoch_time niet ondersteund op dit bord" @@ -3225,6 +2909,12 @@ msgstr "epoch_time niet ondersteund op dit bord" msgid "error = 0x%08lX" msgstr "fout = 0x%08lX" +#: ports/espressif/common-hal/esp32_camera/Camera.c +msgid "" +"esp32_camera.Camera requires reserved PSRAM to be configured. See the " +"documentation for instructions." +msgstr "" + #: py/runtime.c msgid "exceptions must derive from BaseException" msgstr "uitzonderingen moeten afleiden van BaseException" @@ -3299,7 +2989,7 @@ msgstr "eerste argument moet een functie zijn" msgid "first argument must be a tuple of ndarrays" msgstr "eerste argument moet een tupel van ndarrays zijn" -#: extmod/ulab/code/numpy/vector.c +#: extmod/ulab/code/numpy/transform.c extmod/ulab/code/numpy/vector.c msgid "first argument must be an ndarray" msgstr "eerst argument moet een ndarray zijn" @@ -3448,7 +3138,7 @@ msgstr "incomplete formaatsleutel" msgid "incorrect padding" msgstr "vulling (padding) is onjuist" -#: extmod/ulab/code/ndarray.c +#: extmod/ulab/code/ndarray.c extmod/ulab/code/numpy/transform.c msgid "index is out of bounds" msgstr "index is buiten bereik" @@ -3466,6 +3156,10 @@ msgstr "indices moeten integers zijn" msgid "indices must be integers, slices, or Boolean lists" msgstr "indices moeten integers, segmenten (slices) of Boolean lijsten zijn" +#: ports/espressif/common-hal/busio/I2C.c +msgid "init I2C" +msgstr "" + #: extmod/ulab/code/scipy/optimize/optimize.c msgid "initial values must be iterable" msgstr "oorspronkelijke waarden moeten itereerbaar zijn" @@ -3511,6 +3205,10 @@ msgstr "invoermatrix is asymmetrisch" msgid "input matrix is singular" msgstr "invoermatrix is singulier" +#: extmod/ulab/code/numpy/create.c +msgid "input must be 1- or 2-d" +msgstr "" + #: extmod/ulab/code/numpy/carray/carray.c msgid "input must be a 1D ndarray" msgstr "" @@ -3519,11 +3217,7 @@ msgstr "" msgid "input must be a dense ndarray" msgstr "invoer moet een gesloten ndarray zijn" -#: extmod/ulab/code/numpy/create.c -msgid "input must be a tensor of rank 2" -msgstr "invoer moet een tensor van rang 2 zijn" - -#: extmod/ulab/code/numpy/create.c extmod/ulab/code/user/user.c +#: extmod/ulab/code/user/user.c msgid "input must be an ndarray" msgstr "invoer moet een ndarray zijn" @@ -3573,6 +3267,10 @@ msgstr "" msgid "invalid bits_per_pixel %d, must be, 1, 2, 4, 8, 16, 24, or 32" msgstr "" +#: ports/raspberrypi/common-hal/ssl/SSLSocket.c +msgid "invalid cert" +msgstr "ongeldig certificaat" + #: shared-bindings/bitmaptools/__init__.c #, c-format msgid "invalid element size %d for bits_per_pixel %d\n" @@ -3599,10 +3297,18 @@ msgstr "ongeldige formaatspecificatie" msgid "invalid hostname" msgstr "onjuiste hostnaam" +#: ports/raspberrypi/common-hal/ssl/SSLSocket.c +msgid "invalid key" +msgstr "ongeldige sleutel" + #: py/compile.c msgid "invalid micropython decorator" msgstr "ongeldige micropython decorator" +#: ports/espressif/common-hal/esp32_camera/Camera.c +msgid "invalid setting" +msgstr "" + #: shared-bindings/random/__init__.c msgid "invalid step" msgstr "ongeldige stap" @@ -3719,10 +3425,6 @@ msgstr "fout in het wiskundig domein (math domain error)" msgid "matrix is not positive definite" msgstr "matrix is niet positief-definiet" -#: ports/espressif/common-hal/wifi/Radio.c -msgid "max_connections must be between 0 and 10" -msgstr "" - #: ports/espressif/common-hal/_bleio/Descriptor.c #: ports/nrf/common-hal/_bleio/Characteristic.c #: ports/nrf/common-hal/_bleio/Descriptor.c @@ -3730,13 +3432,9 @@ msgstr "" msgid "max_length must be 0-%d when fixed_length is %s" msgstr "max_length moet 0-%d zijn als fixed_length %s is" -#: shared-bindings/_bleio/Characteristic.c shared-bindings/_bleio/Descriptor.c -msgid "max_length must be >= 0" -msgstr "" - #: extmod/ulab/code/ndarray.c -msgid "maximum number of dimensions is 4" -msgstr "maximaal aantal dimensies is 4" +msgid "maximum number of dimensions is " +msgstr "" #: py/runtime.c msgid "maximum recursion depth exceeded" @@ -3869,7 +3567,7 @@ msgstr "geen reset pin beschikbaar" msgid "no response from SD card" msgstr "geen antwoord van SD kaart" -#: py/objobject.c py/runtime.c +#: ports/espressif/common-hal/esp32_camera/Camera.c py/objobject.c py/runtime.c msgid "no such attribute" msgstr "niet zo'n attribuut" @@ -3980,7 +3678,11 @@ msgstr "object met buffer protocol vereist" msgid "odd-length string" msgstr "string met oneven lengte" -#: extmod/ulab/code/numpy/create.c extmod/ulab/code/utils/utils.c +#: supervisor/shared/web_workflow/web_workflow.c +msgid "off" +msgstr "" + +#: extmod/ulab/code/utils/utils.c msgid "offset is too large" msgstr "compensatie is te groot" @@ -4076,10 +3778,6 @@ msgstr "pack verwachtte %d elementen (ontving %d)" msgid "palette must be 32 bytes long" msgstr "palette moet 32 bytes lang zijn" -#: shared-bindings/displayio/Palette.c -msgid "palette_index should be an int" -msgstr "palette_index moet een int zijn" - #: py/emitinlinextensa.c msgid "parameters must be registers in sequence a2 to a5" msgstr "parameters moeten registers zijn in de volgorde a2 tot a5" @@ -4104,11 +3802,6 @@ msgstr "pixel_shader moet displayio.Palette of displayio.ColorConverter zijn" msgid "poll on file not available on win32" msgstr "" -#: shared-module/vectorio/Polygon.c -msgid "polygon can only be registered in one parent" -msgstr "" -"polygoon kan slechts bij één object van een hoger niveau worden geregistreerd" - #: ports/espressif/common-hal/pulseio/PulseIn.c msgid "pop from an empty PulseIn" msgstr "pop van een lege PulseIn" @@ -4134,7 +3827,23 @@ msgstr "derde argument van pow() mag geen 0 zijn" msgid "pow() with 3 arguments requires integers" msgstr "pow() met 3 argumenten vereist integers" +#: ports/espressif/boards/adafruit_qtpy_esp32_pico/mpconfigboard.h +msgid "pressing BOOT button at start up.\n" +msgstr "" + +#: ports/espressif/boards/adafruit_feather_esp32_v2/mpconfigboard.h +msgid "pressing SW38 button at start up.\n" +msgstr "" + +#: ports/espressif/boards/hardkernel_odroid_go/mpconfigboard.h +msgid "pressing VOLUME button at start up.\n" +msgstr "" + #: ports/espressif/boards/adafruit_qtpy_esp32c3/mpconfigboard.h +#: ports/espressif/boards/beetle-esp32-c3/mpconfigboard.h +#: ports/espressif/boards/espressif_esp32s2_devkitc_1_n8r2/mpconfigboard.h +#: ports/espressif/boards/lolin_c3_mini/mpconfigboard.h +#: ports/espressif/boards/microdev_micro_c3/mpconfigboard.h #: supervisor/shared/safe_mode.c msgid "pressing boot button at start up.\n" msgstr "druk bootknop in bij opstarten.\n" @@ -4155,14 +3864,6 @@ msgstr "" msgid "pull masks conflict with direction masks" msgstr "" -#: ports/raspberrypi/bindings/rp2pio/StateMachine.c -msgid "pull_threshold must be between 1 and 32" -msgstr "" - -#: ports/raspberrypi/bindings/rp2pio/StateMachine.c -msgid "push_threshold must be between 1 and 32" -msgstr "" - #: extmod/modutimeq.c msgid "queue overflow" msgstr "wachtrij overloop" @@ -4214,14 +3915,6 @@ msgstr "roll argument moet een ndarray zijn" msgid "rsplit(None,n)" msgstr "rsplit(None,n)" -#: shared-bindings/audiocore/RawSample.c -msgid "" -"sample_source buffer must be a bytearray or array of type 'h', 'H', 'b' or " -"'B'" -msgstr "" -"sample_source buffer moet een bytearray of array van type 'h', 'H', 'b' of " -"'B' zijn" - #: ports/atmel-samd/common-hal/audiobusio/PDMIn.c #: ports/raspberrypi/common-hal/audiobusio/PDMIn.c msgid "sampling rate out of range" @@ -4319,26 +4012,14 @@ msgstr "" msgid "source_bitmap must have value_count of 8" msgstr "" -#: shared-bindings/wifi/Radio.c -msgid "ssid can't be more than 32 bytes" -msgstr "" - #: py/objstr.c msgid "start/end indices" msgstr "start/stop indices" -#: shared-bindings/displayio/Shape.c -msgid "start_x should be an int" -msgstr "start_x moet een int zijn" - #: shared-bindings/random/__init__.c msgid "step must be non-zero" msgstr "step mag geen nul zijn" -#: shared-bindings/busio/UART.c -msgid "stop must be 1 or 2" -msgstr "stop moet 1 of 2 zijn" - #: shared-bindings/random/__init__.c msgid "stop not reachable from start" msgstr "stop is niet bereikbaar vanaf start" @@ -4387,10 +4068,6 @@ msgstr "syntaxisfout in uctypes aanduiding" msgid "threshold must be in the range 0-65536" msgstr "drempelwaarde moet in het bereik 0-65536 liggen" -#: shared-bindings/rgbmatrix/RGBMatrix.c -msgid "tile must be greater than zero" -msgstr "" - #: shared-bindings/time/__init__.c msgid "time.struct_time() takes a 9-sequence" msgstr "time.struct_time() accepteert een 9-rij" @@ -4410,10 +4087,6 @@ msgstr "timeout moet tussen 0.0 en 100.0 seconden zijn" msgid "timeout must be < 655.35 secs" msgstr "" -#: shared-bindings/_bleio/CharacteristicBuffer.c -msgid "timeout must be >= 0.0" -msgstr "timeout moet groter dan 0.0 zijn" - #: shared-module/sdcardio/SDCard.c msgid "timeout waiting for v1 card" msgstr "timeout bij wachten op v1 kaart" @@ -4422,6 +4095,10 @@ msgstr "timeout bij wachten op v1 kaart" msgid "timeout waiting for v2 card" msgstr "timeout bij wachten op v2 kaart" +#: ports/stm/common-hal/pwmio/PWMOut.c +msgid "timer re-init" +msgstr "" + #: shared-bindings/time/__init__.c msgid "timestamp out of range for platform time_t" msgstr "timestamp buiten bereik voor platform time_t" @@ -4487,14 +4164,10 @@ msgstr "type '%q' is geen aanvaardbaar basistype" msgid "type is not an acceptable base type" msgstr "type is geen aanvaardbaar basistype" -#: py/runtime.c +#: py/objgenerator.c py/runtime.c msgid "type object '%q' has no attribute '%q'" msgstr "objecttype '%q' heeft geen attribuut '%q'" -#: py/objgenerator.c -msgid "type object 'generator' has no attribute '__await__'" -msgstr "het type object 'generator' heeft geen attribuut '__await__'" - #: py/objtype.c msgid "type takes 1 or 3 arguments" msgstr "type accepteert 1 of 3 argumenten" @@ -4553,7 +4226,6 @@ msgid "unreadable attribute" msgstr "onleesbaar attribuut" #: shared-bindings/displayio/TileGrid.c shared-bindings/vectorio/VectorShape.c -#: shared-module/vectorio/Polygon.c shared-module/vectorio/VectorShape.c msgid "unsupported %q type" msgstr "niet ondersteund %q type" @@ -4592,6 +4264,14 @@ msgstr "niet ondersteund type voor operator" msgid "unsupported types for %q: '%q', '%q'" msgstr "niet ondersteunde types voor %q: '%q', '%q'" +#: extmod/ulab/code/numpy/io/io.c +msgid "usecols is too high" +msgstr "" + +#: extmod/ulab/code/numpy/io/io.c +msgid "usecols keyword must be specified" +msgstr "" + #: py/objint.c #, c-format msgid "value must fit in %d byte(s)" @@ -4613,20 +4293,19 @@ msgstr "watchdog niet geïnitialiseerd" msgid "watchdog timeout must be greater than 0" msgstr "watchdog time-out moet groter zijn dan 0" -#: shared-bindings/bitops/__init__.c -#, c-format -msgid "width must be from 2 to 8 (inclusive), not %d" -msgstr "" - #: shared-bindings/is31fl3741/FrameBuffer.c -#: shared-bindings/rgbmatrix/RGBMatrix.c msgid "width must be greater than zero" msgstr "breedte moet groter dan nul zijn" #: ports/espressif/common-hal/wifi/Radio.c +#: ports/raspberrypi/common-hal/wifi/Radio.c msgid "wifi is not enabled" msgstr "" +#: ports/raspberrypi/common-hal/wifi/Monitor.c +msgid "wifi.Monitor not available" +msgstr "" + #: shared-bindings/_bleio/Adapter.c msgid "window must be <= interval" msgstr "window moet <= interval zijn" @@ -4639,7 +4318,17 @@ msgstr "foute index voor as" msgid "wrong axis specified" msgstr "onjuiste as gespecificeerd" -#: extmod/ulab/code/numpy/compare.c extmod/ulab/code/numpy/vector.c +#: extmod/ulab/code/numpy/io/io.c +msgid "wrong dtype" +msgstr "" + +#: extmod/ulab/code/numpy/transform.c +msgid "wrong index type" +msgstr "onjuist indextype" + +#: extmod/ulab/code/numpy/compare.c extmod/ulab/code/numpy/create.c +#: extmod/ulab/code/numpy/io/io.c extmod/ulab/code/numpy/transform.c +#: extmod/ulab/code/numpy/vector.c msgid "wrong input type" msgstr "onjuist invoertype" @@ -4647,6 +4336,10 @@ msgstr "onjuist invoertype" msgid "wrong length of condition array" msgstr "" +#: extmod/ulab/code/numpy/transform.c +msgid "wrong length of index array" +msgstr "" + #: extmod/ulab/code/numpy/create.c py/objarray.c py/objstr.c msgid "wrong number of arguments" msgstr "onjuist aantal argumenten" @@ -4667,10 +4360,6 @@ msgstr "x-waarde buiten bereik" msgid "xTaskCreate failed" msgstr "" -#: shared-bindings/displayio/Shape.c -msgid "y should be an int" -msgstr "y moet een int zijn" - #: shared-module/displayio/Shape.c msgid "y value out of bounds" msgstr "y-waarde buiten bereik" @@ -4691,6 +4380,342 @@ msgstr "zi moet van type float zijn" msgid "zi must be of shape (n_section, 2)" msgstr "zi moet vorm (n_section, 2) hebben" +#~ msgid "Stream missing readinto() or write() method." +#~ msgstr "Stream mist readinto() of write() methode." + +#~ msgid "%q must be >= 0" +#~ msgstr "%q moet >= 0 zijn" + +#~ msgid "%q must be >= 1" +#~ msgstr "%q moet >= 1 zijn" + +#~ msgid "address out of bounds" +#~ msgstr "adres buiten bereik" + +#~ msgid "destination_length must be an int >= 0" +#~ msgstr "" +#~ "destination_lengte moest een int groter dan of gelijk zijn aan 0 zijn" + +#~ msgid "type object 'generator' has no attribute '__await__'" +#~ msgstr "het type object 'generator' heeft geen attribuut '__await__'" + +#~ msgid "color should be an int" +#~ msgstr "kleur moet een int zijn" + +#~ msgid "end_x should be an int" +#~ msgstr "end_x moet een int zijn" + +#~ msgid "palette_index should be an int" +#~ msgstr "palette_index moet een int zijn" + +#~ msgid "start_x should be an int" +#~ msgstr "start_x moet een int zijn" + +#~ msgid "y should be an int" +#~ msgstr "y moet een int zijn" + +#~ msgid "" +#~ "sample_source buffer must be a bytearray or array of type 'h', 'H', 'b' " +#~ "or 'B'" +#~ msgstr "" +#~ "sample_source buffer moet een bytearray of array van type 'h', 'H', 'b' " +#~ "of 'B' zijn" + +#~ msgid "Expected an alarm" +#~ msgstr "Verwachtte een alarm" + +#~ msgid "Failed to init wifi" +#~ msgstr "Kon WiFi niet initialiseren" + +#~ msgid "input must be a tensor of rank 2" +#~ msgstr "invoer moet een tensor van rang 2 zijn" + +#~ msgid "maximum number of dimensions is 4" +#~ msgstr "maximaal aantal dimensies is 4" + +#~ msgid "Watchdog timer expired." +#~ msgstr "Watchdog-timer verstreken." + +#~ msgid "%q must be a tuple of length 2" +#~ msgstr "%q moet een tuple van lengte 2 zijn" + +#~ msgid "%q should be an int" +#~ msgstr "%q moet een int zijn" + +#~ msgid "Address type out of range" +#~ msgstr "Adres type buiten bereik" + +#~ msgid "AnalogIn not supported on given pin" +#~ msgstr "AnalogIn niet ondersteund door gegeven pin" + +#~ msgid "AnalogOut functionality not supported" +#~ msgstr "AnalogOut functionaliteit niet ondersteund" + +#~ msgid "AnalogOut is only 16 bits. Value must be less than 65536." +#~ msgstr "AnalogOut is slechts 16 bits. Waarde moet minder dan 65536 zijn." + +#~ msgid "AnalogOut not supported on given pin" +#~ msgstr "AnalogOut niet ondersteund door gegeven pin" + +#, c-format +#~ msgid "Bit depth must be from 1 to 6 inclusive, not %d" +#~ msgstr "Bitdiepte moet tussen 1 en 6 liggen, niet %d" + +#, c-format +#~ msgid "Buffer incorrect size. Should be %d bytes." +#~ msgstr "Buffer heeft incorrect grootte. Moet %d bytes zijn." + +#~ msgid "Buffer must be at least length 1" +#~ msgstr "Buffer moet op zijn minst lengte 1 zijn" + +#~ msgid "Bytes must be between 0 and 255." +#~ msgstr "Bytes moeten tussen 0 en 255 liggen." + +#~ msgid "Cannot output both channels on the same pin" +#~ msgstr "Output van beide kanalen kan niet op dezelfde pin" + +#~ msgid "Cannot read without MISO pin." +#~ msgstr "Kan niet lezen zonder MISO pin." + +#~ msgid "Cannot reset into bootloader because no bootloader is present." +#~ msgstr "" +#~ "Kan niet resetten naar bootloader omdat er geen bootloader aanwezig is." + +#~ msgid "Cannot transfer without MOSI and MISO pins." +#~ msgstr "Kan niet overdragen zonder MOSI en MISO pinnen." + +#~ msgid "Cannot write without MOSI pin." +#~ msgstr "Kan niet schrijven zonder MOSI pin." + +#~ msgid "Clock pin init failed." +#~ msgstr "Clock pin init mislukt." + +#~ msgid "Command must be an int between 0 and 255" +#~ msgstr "Command moet een int tussen 0 en 255 zijn" + +#~ msgid "Could not initialize Camera" +#~ msgstr "Kon camera niet initialiseren" + +#~ msgid "Could not initialize GNSS" +#~ msgstr "Kan GNSS niet initialiseren" + +#~ msgid "Could not initialize SDCard" +#~ msgstr "Kan SDCard niet initialiseren" + +#~ msgid "Could not initialize UART" +#~ msgstr "Kan UART niet initialiseren" + +#~ msgid "Could not re-init channel" +#~ msgstr "Kan kanaal niet her-initialiseren" + +#~ msgid "Could not re-init timer" +#~ msgstr "Kan timer niet her-initialiseren" + +#~ msgid "Could not restart PWM" +#~ msgstr "Kan PWM niet herstarten" + +#~ msgid "Couldn't allocate first buffer" +#~ msgstr "Kan eerste buffer niet alloceren" + +#~ msgid "Couldn't allocate input buffer" +#~ msgstr "Kan input buffer niet alloceren" + +#~ msgid "Couldn't allocate second buffer" +#~ msgstr "Kan tweede buffer niet alloceren" + +#~ msgid "DigitalInOut not supported on given pin" +#~ msgstr "DigitalInOut niet ondersteund door gegeven pin" + +#, c-format +#~ msgid "Expected tuple of length %d, got %d" +#~ msgstr "Verwachtte een tuple met lengte %d, maar kreeg %d" + +#~ msgid "Failed to allocate RX buffer" +#~ msgstr "RX buffer alloceren mislukt" + +#, c-format +#~ msgid "Failed to allocate RX buffer of %d bytes" +#~ msgstr "Mislukt een RX buffer van %d bytes te alloceren" + +#, c-format +#~ msgid "Framebuffer requires %d bytes" +#~ msgstr "Framebuffer benodigd %d bytes" + +#~ msgid "Hostname must be between 1 and 253 characters" +#~ msgstr "Hostnaam moet tussen 1 en 253 karakters zijn" + +#~ msgid "I2C Init Error" +#~ msgstr "I2C Init Fout" + +#~ msgid "Invalid %q pin selection" +#~ msgstr "Ongeldige %q pin selectie" + +#~ msgid "Invalid BMP file" +#~ msgstr "Ongeldig BMP bestand" + +#~ msgid "Invalid DAC pin supplied" +#~ msgstr "Ongeldige DAC pin opgegeven" + +#~ msgid "Invalid PWM frequency" +#~ msgstr "Ongeldige PWM frequentie" + +#~ msgid "Invalid Pin" +#~ msgstr "Ongeldige Pin" + +#~ msgid "Invalid buffer size" +#~ msgstr "Ongeldige buffer grootte" + +#~ msgid "Invalid byteorder string" +#~ msgstr "Ongeldige byteorder string" + +#~ msgid "Invalid capture period. Valid range: 1 - 500" +#~ msgstr "Ongeldige vastlegging periode. Geldig bereik: 1 - 500" + +#~ msgid "Invalid channel count" +#~ msgstr "Ongeldige kanaal aantallen" + +#~ msgid "Invalid direction." +#~ msgstr "Ongeldige richting." + +#~ msgid "Invalid file" +#~ msgstr "Ongeldig bestand" + +#~ msgid "Invalid number of bits" +#~ msgstr "Ongeldig aantal bits" + +#~ msgid "Invalid phase" +#~ msgstr "Ongeldige fase" + +#~ msgid "Invalid pin" +#~ msgstr "Ongeldige pin" + +#~ msgid "Invalid pin for left channel" +#~ msgstr "Ongeldige pin voor linker kanaal" + +#~ msgid "Invalid pin for right channel" +#~ msgstr "Ongeldige pin voor rechter kanaal" + +#~ msgid "Invalid polarity" +#~ msgstr "Ongeldige polariteit" + +#~ msgid "Invalid properties" +#~ msgstr "Ongeldige eigenschappen" + +#~ msgid "Invalid run mode." +#~ msgstr "Ongeldige run modus." + +#~ msgid "Invalid security_mode" +#~ msgstr "Ongeldige security_mode" + +#~ msgid "Invalid voice" +#~ msgstr "Ongeldige stem" + +#~ msgid "Invalid voice count" +#~ msgstr "Ongeldig stem aantal" + +#~ msgid "Invalid wave file" +#~ msgstr "Ongeldig wave bestand" + +#~ msgid "Invalid word/bit length" +#~ msgstr "Ongeldig woord/bit lengte" + +#~ msgid "Layer already in a group." +#~ msgstr "Laag al in groep." + +#~ msgid "Layer must be a Group or TileGrid subclass." +#~ msgstr "Laag moet een Groep of TileGrid subklasse zijn." + +#~ msgid "MISO pin init failed." +#~ msgstr "MISO pin init mislukt." + +#~ msgid "MOSI pin init failed." +#~ msgstr "MOSI pin init mislukt." + +#~ msgid "Messages limited to 8 bytes" +#~ msgstr "Berichten zijn beperkt tot 8 bytes" + +#~ msgid "No hardware support on clk pin" +#~ msgstr "Geen hardware ondersteuning beschikbaar op clk pin" + +#~ msgid "No hardware support on pin" +#~ msgstr "Geen hardware ondersteuning op pin" + +#~ msgid "" +#~ "PWM duty_cycle must be between 0 and 65535 inclusive (16 bit resolution)" +#~ msgstr "" +#~ "PWM duty_cycle moet tussen 0 en 65535 inclusief zijn (16 bit resolutie)" + +#~ msgid "Pin does not have ADC capabilities" +#~ msgstr "Pin heeft geen ADC mogelijkheden" + +#~ msgid "RTC calibration is not supported on this board" +#~ msgstr "RTC calibratie niet ondersteund door dit board" + +#~ msgid "RTS/CTS/RS485 Not yet supported on this device" +#~ msgstr "RTS/CTS/RS485 Nog niet ondersteund door dit apparaat" + +#~ msgid "SPI Init Error" +#~ msgstr "SPI Init Fout" + +#~ msgid "SPI Re-initialization error" +#~ msgstr "SPI Herinitialisatie Fout" + +#~ msgid "Sample rate must be positive" +#~ msgstr "Sample rate moet positief zijn" + +#, c-format +#~ msgid "Sample rate too high. It must be less than %d" +#~ msgstr "Sample rate is te hoog. Moet minder dan %d zijn" + +#~ msgid "Stack size must be at least 256" +#~ msgstr "Stack grootte moet op zijn minst 256 zijn" + +#~ msgid "Tile value out of bounds" +#~ msgstr "Tile waarde buiten bereik" + +#~ msgid "UART Buffer allocation error" +#~ msgstr "UART Buffer allocatie fout" + +#~ msgid "UART De-init error" +#~ msgstr "UART De-init fout" + +#~ msgid "UART Init Error" +#~ msgstr "UART Init Fout" + +#~ msgid "UART Re-init error" +#~ msgstr "UART Re-init Fout" + +#~ msgid "UART write error" +#~ msgstr "UART schrijf fout" + +#~ msgid "Unsupported baudrate" +#~ msgstr "Niet-ondersteunde baudsnelheid" + +#~ msgid "WiFi password must be between 8 and 63 characters" +#~ msgstr "WiFi wachtwoord moet tussen 8 en 63 karakters bevatten" + +#~ msgid "bytes > 8 bits not supported" +#~ msgstr "butes > 8 niet ondersteund" + +#~ msgid "calibration value out of range +/-127" +#~ msgstr "calibration waarde buiten bereik +/-127" + +#~ msgid "circle can only be registered in one parent" +#~ msgstr "" +#~ "cirkel kan slechts bij één object van een hoger niveau worden " +#~ "geregistreerd" + +#~ msgid "polygon can only be registered in one parent" +#~ msgstr "" +#~ "polygoon kan slechts bij één object van een hoger niveau worden " +#~ "geregistreerd" + +#~ msgid "stop must be 1 or 2" +#~ msgstr "stop moet 1 of 2 zijn" + +#~ msgid "timeout must be >= 0.0" +#~ msgstr "timeout moet groter dan 0.0 zijn" + #~ msgid "Unsupported operation" #~ msgstr "Niet-ondersteunde operatie" @@ -4942,12 +4967,6 @@ msgstr "zi moet vorm (n_section, 2) hebben" #~ msgid "can only save bytecode" #~ msgstr "kan alleen byte-code opslaan" -#~ msgid "invalid cert" -#~ msgstr "ongeldig certificaat" - -#~ msgid "invalid key" -#~ msgstr "ongeldige sleutel" - #~ msgid "Viper functions don't currently support more than 4 arguments" #~ msgstr "Viper-functies ondersteunen momenteel niet meer dan 4 argumenten" @@ -5138,9 +5157,6 @@ msgstr "zi moet vorm (n_section, 2) hebben" #~ msgid "wrong argument type" #~ msgstr "onjuist argumenttype" -#~ msgid "wrong index type" -#~ msgstr "onjuist indextype" - #~ msgid "Must provide SCK pin" #~ msgstr "SCK pin moet opgegeven worden" diff --git a/locale/pl.po b/locale/pl.po index 2b1d6ea123..23c42ffe92 100644 --- a/locale/pl.po +++ b/locale/pl.po @@ -65,16 +65,38 @@ msgstr " wyjście:\n" msgid "%%c requires int or char" msgstr "%%c wymaga int lub char" +#: main.c +#, c-format +msgid "%02X" +msgstr "" + #: shared-bindings/rgbmatrix/RGBMatrix.c #, c-format msgid "" "%d address pins, %d rgb pins and %d tiles indicate a height of %d, not %d" msgstr "" +#: ports/atmel-samd/common-hal/alarm/__init__.c +#: ports/cxd56/common-hal/analogio/AnalogOut.c ports/cxd56/common-hal/rtc/RTC.c +#: ports/espressif/common-hal/rtc/RTC.c +#: ports/mimxrt10xx/common-hal/analogio/AnalogOut.c +#: ports/mimxrt10xx/common-hal/rtc/RTC.c ports/nrf/common-hal/alarm/__init__.c +#: ports/nrf/common-hal/analogio/AnalogOut.c ports/nrf/common-hal/rtc/RTC.c +#: ports/raspberrypi/common-hal/alarm/__init__.c +#: ports/raspberrypi/common-hal/analogio/AnalogOut.c +#: ports/raspberrypi/common-hal/rtc/RTC.c ports/stm/common-hal/alarm/__init__.c +#: ports/stm/common-hal/rtc/RTC.c +msgid "%q" +msgstr "" + #: shared-bindings/microcontroller/Pin.c msgid "%q and %q contain duplicate pins" msgstr "" +#: ports/atmel-samd/common-hal/audioio/AudioOut.c +msgid "%q and %q must be different" +msgstr "" + #: shared-bindings/microcontroller/Pin.c msgid "%q contains duplicate pins" msgstr "" @@ -83,16 +105,12 @@ msgstr "" msgid "%q failure: %d" msgstr "%q niepowodzenie: %d" +#: shared-bindings/digitalio/DigitalInOut.c #: shared-bindings/microcontroller/Pin.c msgid "%q in use" msgstr "%q w użyciu" -#: ports/atmel-samd/common-hal/pulseio/PulseIn.c -#: ports/cxd56/common-hal/pulseio/PulseIn.c -#: ports/nrf/common-hal/pulseio/PulseIn.c -#: ports/raspberrypi/common-hal/pulseio/PulseIn.c -#: ports/stm/common-hal/pulseio/PulseIn.c py/obj.c py/objstr.c -#: py/objstrunicode.c +#: py/obj.c py/objstr.c py/objstrunicode.c msgid "%q index out of range" msgstr "%q poza zakresem" @@ -100,14 +118,34 @@ msgstr "%q poza zakresem" msgid "%q indices must be integers, not %s" msgstr "%q indeks musi być liczbą całkowitą, a nie %s" +#: shared-module/bitbangio/SPI.c +msgid "%q init failed" +msgstr "" + +#: py/argcheck.c +msgid "%q length must be %d" +msgstr "" + #: py/argcheck.c msgid "%q length must be %d-%d" msgstr "" -#: shared-bindings/busio/I2C.c shared-bindings/usb_hid/Device.c +#: py/argcheck.c +msgid "%q length must be <= %d" +msgstr "" + +#: py/argcheck.c +msgid "%q length must be >= %d" +msgstr "" + +#: shared-bindings/busio/I2C.c msgid "%q length must be >= 1" msgstr "" +#: py/argcheck.c +msgid "%q must be %d" +msgstr "" + #: py/argcheck.c msgid "%q must be %d-%d" msgstr "" @@ -124,29 +162,17 @@ msgstr "" msgid "%q must be >= %d" msgstr "" -#: py/argcheck.c shared-bindings/memorymonitor/AllocationAlarm.c -msgid "%q must be >= 0" -msgstr "%q musi być >= 0" - -#: shared-bindings/_bleio/CharacteristicBuffer.c -#: shared-bindings/_bleio/PacketBuffer.c shared-bindings/displayio/Group.c -#: shared-bindings/displayio/Shape.c -#: shared-bindings/memorymonitor/AllocationAlarm.c -#: shared-bindings/vectorio/Circle.c shared-bindings/vectorio/Rectangle.c -msgid "%q must be >= 1" -msgstr "%q musi być >= 1" +#: shared-bindings/analogbufio/BufferedIn.c +#: shared-bindings/audiocore/RawSample.c +msgid "%q must be a bytearray or array of type 'h', 'H', 'b', or 'B'" +msgstr "" #: py/argcheck.c msgid "%q must be a string" msgstr "" -#: shared-module/vectorio/Polygon.c -msgid "%q must be a tuple of length 2" -msgstr "%q musi być krotką o długości 2" - -#: ports/espressif/common-hal/imagecapture/ParallelImageCapture.c -#: shared-module/vectorio/VectorShape.c -msgid "%q must be between %d and %d" +#: py/argcheck.c +msgid "%q must be an int" msgstr "" #: py/argcheck.c @@ -165,7 +191,11 @@ msgstr "" msgid "%q out of bounds" msgstr "" +#: ports/atmel-samd/common-hal/pulseio/PulseIn.c +#: ports/cxd56/common-hal/pulseio/PulseIn.c +#: ports/nrf/common-hal/pulseio/PulseIn.c #: ports/raspberrypi/common-hal/rp2pio/StateMachine.c +#: ports/stm/common-hal/pulseio/PulseIn.c py/argcheck.c #: shared-bindings/canio/Match.c msgid "%q out of range" msgstr "%q poza zakresem" @@ -174,10 +204,6 @@ msgstr "%q poza zakresem" msgid "%q pin invalid" msgstr "nieprawidłowy pin %q" -#: shared-bindings/fontio/BuiltinFont.c -msgid "%q should be an int" -msgstr "%q powinno być typu int" - #: shared-bindings/usb_hid/Device.c msgid "%q with a report ID of 0 must be of length 1" msgstr "" @@ -190,7 +216,11 @@ msgstr "%q() bierze %d argumentów pozycyjnych, lecz podano %d" msgid "%q, %q, and %q must all be the same length" msgstr "" -#: ports/espressif/bindings/espidf/__init__.c ports/espressif/esp_error.c +#: py/objint.c +msgid "%q=%q" +msgstr "" + +#: ports/espressif/common-hal/espidf/__init__.c ports/espressif/esp_error.c #, c-format msgid "%s error 0x%x" msgstr "" @@ -275,7 +305,7 @@ msgstr "" msgid "'%s' object doesn't support item deletion" msgstr "" -#: py/runtime.c +#: ports/raspberrypi/common-hal/wifi/Radio.c py/runtime.c msgid "'%s' object has no attribute '%q'" msgstr "'%s' obiekt nie ma atrybutu '%q'" @@ -340,10 +370,6 @@ msgstr "'yield from' wewnątrz funkcji asynchronicznej" msgid "'yield' outside function" msgstr "'yield' poza funkcją" -#: shared-module/vectorio/VectorShape.c -msgid "(x,y) integers required" -msgstr "" - #: py/compile.c msgid "*x must be assignment target" msgstr "*x musi być obiektem przypisania" @@ -379,16 +405,12 @@ msgstr "ADC2 jest używany przez WiFi" msgid "Address must be %d bytes long" msgstr "Adres musi mieć %d bajtów" -#: shared-bindings/_bleio/Address.c -msgid "Address type out of range" -msgstr "Typ adresu poza zakresem" - #: ports/espressif/common-hal/canio/CAN.c msgid "All CAN peripherals are in use" msgstr "" #: ports/espressif/common-hal/busio/I2C.c -#: ports/espressif/common-hal/i2cperipheral/I2CPeripheral.c +#: ports/espressif/common-hal/i2ctarget/I2CTarget.c #: ports/nrf/common-hal/busio/I2C.c msgid "All I2C peripherals are in use" msgstr "Wszystkie peryferia I2C w użyciu" @@ -425,7 +447,6 @@ msgstr "" msgid "All event channels in use" msgstr "Wszystkie kanały zdarzeń w użyciu" -#: ports/raspberrypi/common-hal/pulseio/PulseIn.c #: ports/raspberrypi/common-hal/rp2pio/StateMachine.c msgid "All state machines in use" msgstr "" @@ -470,28 +491,10 @@ msgid "Already running" msgstr "" #: ports/espressif/common-hal/wifi/Radio.c +#: ports/raspberrypi/common-hal/wifi/Radio.c msgid "Already scanning for wifi networks" msgstr "" -#: ports/cxd56/common-hal/analogio/AnalogIn.c -msgid "AnalogIn not supported on given pin" -msgstr "AnalogIn nie jest obsługiwany na danym pinie" - -#: ports/cxd56/common-hal/analogio/AnalogOut.c -#: ports/mimxrt10xx/common-hal/analogio/AnalogOut.c -#: ports/nrf/common-hal/analogio/AnalogOut.c -#: ports/raspberrypi/common-hal/analogio/AnalogOut.c -msgid "AnalogOut functionality not supported" -msgstr "AnalogOut jest niewspierane" - -#: shared-bindings/analogio/AnalogOut.c -msgid "AnalogOut is only 16 bits. Value must be less than 65536." -msgstr "AnalogOut ma 16 bitów. Wartość musi być mniejsza od 65536." - -#: ports/atmel-samd/common-hal/analogio/AnalogOut.c -msgid "AnalogOut not supported on given pin" -msgstr "AnalogOut niewspierany na tej nóżce" - #: ports/stm/common-hal/audiopwmio/PWMAudioOut.c msgid "Another PWMAudioOut is already active" msgstr "" @@ -530,7 +533,7 @@ msgstr "" msgid "AuthMode.OPEN is not used with password" msgstr "" -#: shared-bindings/wifi/Radio.c +#: shared-bindings/wifi/Radio.c supervisor/shared/web_workflow/web_workflow.c msgid "Authentication failure" msgstr "Błąd autoryzacji" @@ -563,11 +566,6 @@ 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." @@ -609,11 +607,6 @@ msgstr "Bufor + przesunięcie za małe %d %d %d" msgid "Buffer elements must be 4 bytes long or less" msgstr "" -#: shared-module/usb_hid/Device.c -#, c-format -msgid "Buffer incorrect size. Should be %d bytes." -msgstr "Zła wielkość bufora. Powinno być %d bajtów." - #: shared-bindings/framebufferio/FramebufferDisplay.c msgid "Buffer is not a bytearray." msgstr "" @@ -623,7 +616,6 @@ msgstr "" msgid "Buffer is too small" msgstr "Bufor jest za mały" -#: ports/nrf/common-hal/audiopwmio/PWMAudioOut.c #: ports/stm/common-hal/audiopwmio/PWMAudioOut.c #, c-format msgid "Buffer length %d too big. It must be less than %d" @@ -638,10 +630,6 @@ msgstr "Długość bufora musi być wielokrotnością 512" msgid "Buffer must be a multiple of 512 bytes" msgstr "Bufor musi być wielokrotnością 512 bajtów" -#: shared-bindings/bitbangio/I2C.c -msgid "Buffer must be at least length 1" -msgstr "Bufor musi mieć długość 1 lub więcej" - #: shared-bindings/_bleio/PacketBuffer.c #, c-format msgid "Buffer too short by %d bytes" @@ -663,10 +651,6 @@ msgstr "Nóżka magistrali %d jest w użyciu" msgid "Byte buffer must be 16 bytes." msgstr "Bufor musi mieć 16 bajtów." -#: shared-bindings/alarm/SleepMemory.c shared-bindings/nvm/ByteArray.c -msgid "Bytes must be between 0 and 255." -msgstr "Bytes musi być między 0 a 255." - #: shared-bindings/aesio/aes.c msgid "CBC blocks must be multiples of 16 bytes" msgstr "Bloki CBC muszą być wielokrotnościami 16 bajtów" @@ -675,7 +659,7 @@ msgstr "Bloki CBC muszą być wielokrotnościami 16 bajtów" msgid "CIRCUITPY drive could not be found or created." msgstr "" -#: ports/espressif/bindings/espidf/__init__.c ports/espressif/esp_error.c +#: ports/espressif/common-hal/espidf/__init__.c ports/espressif/esp_error.c msgid "CRC or checksum was invalid" msgstr "" @@ -683,6 +667,10 @@ msgstr "" msgid "Call super().__init__() before accessing native object." msgstr "" +#: ports/cxd56/common-hal/camera/Camera.c +msgid "Camera init" +msgstr "" + #: ports/espressif/common-hal/alarm/pin/PinAlarm.c msgid "Can only alarm on RTC IO from deep sleep." msgstr "" @@ -730,18 +718,10 @@ msgstr "Nie można odczytać temperatury" msgid "Cannot have scan responses for extended, connectable advertisements." msgstr "" -#: ports/atmel-samd/common-hal/audioio/AudioOut.c -msgid "Cannot output both channels on the same pin" -msgstr "Nie można mieć obu kanałów na tej samej nóżce" - #: ports/espressif/common-hal/alarm/pin/PinAlarm.c msgid "Cannot pull on input-only pin." msgstr "" -#: shared-module/bitbangio/SPI.c -msgid "Cannot read without MISO pin." -msgstr "Nie można czytać bez nóżki MISO." - #: shared-bindings/audiobusio/PDMIn.c msgid "Cannot record to a file" msgstr "Nie można nagrać do pliku" @@ -753,8 +733,8 @@ msgstr "" #: ports/atmel-samd/common-hal/microcontroller/__init__.c #: ports/cxd56/common-hal/microcontroller/__init__.c #: ports/mimxrt10xx/common-hal/microcontroller/__init__.c -msgid "Cannot reset into bootloader because no bootloader is present." -msgstr "Nie można zrestartować -- nie ma bootloadera." +msgid "Cannot reset into bootloader because no bootloader is present" +msgstr "" #: ports/espressif/common-hal/socketpool/Socket.c msgid "Cannot set socket options" @@ -774,21 +754,20 @@ msgid "Cannot subclass slice" msgstr "Nie można dziedziczyć ze slice" #: shared-module/bitbangio/SPI.c -msgid "Cannot transfer without MOSI and MISO pins." -msgstr "Nie można przesyłać bez nóżek MOSI i MISO." +msgid "Cannot transfer without MOSI and MISO pins" +msgstr "" #: shared-bindings/pwmio/PWMOut.c msgid "Cannot vary frequency on a timer that is already in use" msgstr "Nie można zmieniać częstotliwości timera, który jest już używany" -#: ports/espressif/common-hal/alarm/pin/PinAlarm.c #: ports/nrf/common-hal/alarm/pin/PinAlarm.c -msgid "Cannot wake on pin edge. Only level." +msgid "Cannot wake on pin edge, only level" msgstr "" -#: shared-module/bitbangio/SPI.c -msgid "Cannot write without MOSI pin." -msgstr "Nie można pisać bez nóżki MOSI." +#: ports/espressif/common-hal/alarm/pin/PinAlarm.c +msgid "Cannot wake on pin edge. Only level." +msgstr "" #: shared-bindings/_bleio/CharacteristicBuffer.c msgid "CharacteristicBuffer writing not provided" @@ -802,10 +781,6 @@ msgstr "" msgid "CircuitPython was unable to allocate the heap." msgstr "CircuitPython nie mógł przydzielić sterty." -#: shared-module/bitbangio/SPI.c -msgid "Clock pin init failed." -msgstr "Inicjalizacja nóżki zegara nie powiodła się." - #: shared-module/bitbangio/I2C.c msgid "Clock stretch too long" msgstr "Rozciągnięcie zegara zbyt duże" @@ -814,11 +789,6 @@ msgstr "Rozciągnięcie zegara zbyt duże" msgid "Clock unit in use" msgstr "Jednostka zegara w użyciu" -#: shared-bindings/displayio/FourWire.c shared-bindings/displayio/I2CDisplay.c -#: shared-bindings/paralleldisplay/ParallelBus.c -msgid "Command must be an int between 0 and 255" -msgstr "Komenda musi być int pomiędzy 0 a 255" - #: shared-bindings/_bleio/Connection.c msgid "" "Connection has been disconnected and can no longer be used. Create a new " @@ -831,35 +801,6 @@ msgstr "" msgid "Corrupt .mpy file" msgstr "Uszkodzony plik .mpy" -#: ports/cxd56/common-hal/camera/Camera.c -msgid "Could not initialize Camera" -msgstr "" - -#: ports/cxd56/common-hal/gnss/GNSS.c -msgid "Could not initialize GNSS" -msgstr "Nie można zainicjować GNSS" - -#: ports/cxd56/common-hal/sdioio/SDCard.c -msgid "Could not initialize SDCard" -msgstr "Nie można zainicjować SDCard" - -#: ports/atmel-samd/common-hal/busio/UART.c ports/cxd56/common-hal/busio/UART.c -#: ports/espressif/common-hal/busio/UART.c -msgid "Could not initialize UART" -msgstr "Ustawienie UART nie powiodło się" - -#: ports/stm/common-hal/pwmio/PWMOut.c -msgid "Could not re-init channel" -msgstr "Nie można ponownie zainicjować kanału" - -#: ports/stm/common-hal/pwmio/PWMOut.c -msgid "Could not re-init timer" -msgstr "Nie można ponownie zainicjować timera" - -#: ports/stm/common-hal/pwmio/PWMOut.c -msgid "Could not restart PWM" -msgstr "Nie można ponownie uruchomić PWM" - #: ports/espressif/common-hal/neopixel_write/__init__.c msgid "Could not retrieve clock" msgstr "" @@ -880,20 +821,6 @@ msgstr "Nie można rozpocząć przerwania, RX jest zajęty" msgid "Couldn't allocate decoder" msgstr "Nie udało się przydzielić dekodera" -#: shared-module/audiocore/WaveFile.c shared-module/audiomixer/Mixer.c -#: shared-module/audiomp3/MP3Decoder.c -msgid "Couldn't allocate first buffer" -msgstr "Nie udała się alokacja pierwszego bufora" - -#: shared-module/audiomp3/MP3Decoder.c -msgid "Couldn't allocate input buffer" -msgstr "Nie można przydzielić bufora wejściowego" - -#: shared-module/audiocore/WaveFile.c shared-module/audiomixer/Mixer.c -#: shared-module/audiomp3/MP3Decoder.c -msgid "Couldn't allocate second buffer" -msgstr "Nie udała się alokacja drugiego bufora" - #: supervisor/shared/safe_mode.c msgid "Crash into the HardFault_Handler." msgstr "" @@ -941,10 +868,6 @@ msgstr "Pojemność celu mniejsza od destination_length." msgid "Device in use" msgstr "Urządzenie w użyciu" -#: ports/cxd56/common-hal/digitalio/DigitalInOut.c -msgid "DigitalInOut not supported on given pin" -msgstr "DigitalInOut nie jest obsługiwany na podanym pinie" - #: shared-bindings/displayio/Display.c #: shared-bindings/framebufferio/FramebufferDisplay.c msgid "Display must have a 16 bit colorspace." @@ -956,6 +879,10 @@ msgstr "Wyświetlacz musi mieć 16-bitową przestrzeń kolorów." msgid "Display rotation must be in 90 degree increments" msgstr "Wyświetlacz można obracać co 90 stopni" +#: main.c +msgid "Done" +msgstr "" + #: shared-bindings/digitalio/DigitalInOut.c msgid "Drive mode not used when direction is input." msgstr "Tryb sterowania nieużywany w trybie wejścia." @@ -989,21 +916,20 @@ msgstr "Błąd w regex" msgid "Error: Failure to bind" msgstr "" -#: ports/raspberrypi/bindings/rp2pio/StateMachine.c py/enum.c -#: shared-bindings/_bleio/__init__.c shared-bindings/aesio/aes.c -#: shared-bindings/busio/SPI.c shared-bindings/microcontroller/Pin.c +#: py/enum.c shared-bindings/_bleio/__init__.c shared-bindings/aesio/aes.c +#: shared-bindings/alarm/__init__.c shared-bindings/busio/SPI.c +#: shared-bindings/microcontroller/Pin.c #: shared-bindings/neopixel_write/__init__.c msgid "Expected a %q" msgstr "Oczekiwano %q" -#: shared-bindings/alarm/__init__.c -msgid "Expected an alarm" +#: ports/raspberrypi/bindings/cyw43/__init__.c +msgid "Expected a %q or %q" msgstr "" -#: shared-module/adafruit_pixelbuf/PixelBuf.c -#, c-format -msgid "Expected tuple of length %d, got %d" -msgstr "Oczekiwano krotkę długości %d, otrzymano %d" +#: shared-bindings/alarm/__init__.c +msgid "Expected an %q" +msgstr "" #: ports/espressif/common-hal/_bleio/Adapter.c #: ports/nrf/common-hal/_bleio/Adapter.c @@ -1031,21 +957,9 @@ msgstr "Nie udało się wysłać polecenia." msgid "Failed to acquire mutex, err 0x%04x" msgstr "Nie udało się uzyskać blokady, błąd 0x%04x" -#: ports/mimxrt10xx/common-hal/busio/UART.c ports/nrf/common-hal/busio/UART.c -#: ports/raspberrypi/common-hal/busio/UART.c -msgid "Failed to allocate RX buffer" -msgstr "Nie udała się alokacja bufora RX" - -#: ports/atmel-samd/common-hal/busio/UART.c -#: ports/atmel-samd/common-hal/pulseio/PulseIn.c -#: ports/cxd56/common-hal/pulseio/PulseIn.c -#: ports/espressif/common-hal/pulseio/PulseIn.c -#: ports/nrf/common-hal/pulseio/PulseIn.c -#: ports/raspberrypi/common-hal/pulseio/PulseIn.c -#: ports/stm/common-hal/pulseio/PulseIn.c -#, c-format -msgid "Failed to allocate RX buffer of %d bytes" -msgstr "Nie udała się alokacja %d bajtów na bufor RX" +#: shared-module/rgbmatrix/RGBMatrix.c +msgid "Failed to allocate %q buffer" +msgstr "" #: ports/espressif/common-hal/wifi/__init__.c msgid "Failed to allocate Wifi memory" @@ -1068,10 +982,6 @@ msgstr "Nie udało się połączyć: błąd wewnętrzny" msgid "Failed to connect: timeout" msgstr "Nie udało się połączyć: upłynął limit czasu" -#: ports/espressif/common-hal/wifi/__init__.c -msgid "Failed to init wifi" -msgstr "" - #: shared-module/audiomp3/MP3Decoder.c msgid "Failed to parse MP3 file" msgstr "Nie można przeanalizować pliku MP3" @@ -1115,11 +1025,6 @@ msgstr "" msgid "Format not supported" msgstr "Nie wspierany format" -#: shared-module/framebufferio/FramebufferDisplay.c -#, c-format -msgid "Framebuffer requires %d bytes" -msgstr "Bufor ramki wymaga %d bajtów" - #: ports/mimxrt10xx/common-hal/microcontroller/Processor.c msgid "" "Frequency must be 24, 150, 396, 450, 528, 600, 720, 816, 912, 960 or 1008 Mhz" @@ -1134,7 +1039,11 @@ msgstr "" msgid "Function requires lock" msgstr "Funkcja wymaga blokady" -#: ports/espressif/bindings/espidf/__init__.c ports/espressif/esp_error.c +#: ports/cxd56/common-hal/gnss/GNSS.c +msgid "GNSS init" +msgstr "" + +#: ports/espressif/common-hal/espidf/__init__.c ports/espressif/esp_error.c msgid "Generic Failure" msgstr "" @@ -1161,19 +1070,16 @@ msgstr "Sprzęt zajęty, wypróbuj alternatywne piny" msgid "Hardware in use, try alternative pins" msgstr "Sprzęt w użyciu, wypróbuj alternatywne piny" -#: shared-bindings/wifi/Radio.c -msgid "Hostname must be between 1 and 253 characters" -msgstr "" - #: extmod/vfs_posix_file.c py/objstringio.c msgid "I/O operation on closed file" msgstr "Operacja I/O na zamkniętym pliku" #: ports/stm/common-hal/busio/I2C.c -msgid "I2C Init Error" -msgstr "Błąd inicjalizacji I2C" +msgid "I2C init error" +msgstr "" #: ports/raspberrypi/common-hal/busio/I2C.c +#: ports/raspberrypi/common-hal/i2ctarget/I2CTarget.c msgid "I2C peripheral in use" msgstr "" @@ -1280,75 +1186,37 @@ msgstr "" msgid "Internal error #%d" msgstr "Błąd wewnętrzny #%d" -#: shared-bindings/sdioio/SDCard.c shared-module/usb_hid/Device.c +#: supervisor/shared/safe_mode.c +msgid "Internal watchdog timer expired." +msgstr "" + +#: py/argcheck.c shared-bindings/digitalio/DigitalInOut.c msgid "Invalid %q" msgstr "Nieprawidłowe %q" -#: ports/atmel-samd/common-hal/audiobusio/I2SOut.c -#: ports/atmel-samd/common-hal/audiobusio/PDMIn.c -#: ports/atmel-samd/common-hal/imagecapture/ParallelImageCapture.c -#: ports/mimxrt10xx/common-hal/busio/UART.c +#: shared-bindings/microcontroller/Pin.c msgid "Invalid %q pin" msgstr "Zła nóżka %q" -#: ports/stm/common-hal/busio/I2C.c ports/stm/common-hal/busio/SPI.c -#: ports/stm/common-hal/busio/UART.c ports/stm/common-hal/canio/CAN.c -#: ports/stm/common-hal/sdioio/SDCard.c -msgid "Invalid %q pin selection" -msgstr "" - #: ports/stm/common-hal/analogio/AnalogIn.c msgid "Invalid ADC Unit value" msgstr "" -#: ports/espressif/common-hal/wifi/Radio.c -msgid "Invalid AuthMode" -msgstr "" - #: ports/espressif/common-hal/_bleio/__init__.c #: ports/nrf/common-hal/_bleio/__init__.c msgid "Invalid BLE parameter" msgstr "" -#: shared-module/displayio/OnDiskBitmap.c -msgid "Invalid BMP file" -msgstr "Zły BMP" - #: shared-bindings/wifi/Radio.c msgid "Invalid BSSID" msgstr "" -#: ports/espressif/common-hal/analogio/AnalogOut.c -#: ports/stm/common-hal/analogio/AnalogOut.c -msgid "Invalid DAC pin supplied" -msgstr "" - #: shared-bindings/wifi/Radio.c msgid "Invalid MAC address" msgstr "" -#: shared-bindings/synthio/__init__.c -msgid "Invalid MIDI file" -msgstr "" - -#: ports/atmel-samd/common-hal/pwmio/PWMOut.c -#: ports/cxd56/common-hal/pwmio/PWMOut.c -#: ports/espressif/common-hal/pwmio/PWMOut.c -#: ports/mimxrt10xx/common-hal/pwmio/PWMOut.c -#: ports/nrf/common-hal/pwmio/PWMOut.c -#: ports/raspberrypi/common-hal/pwmio/PWMOut.c shared-bindings/pwmio/PWMOut.c -msgid "Invalid PWM frequency" -msgstr "Zła częstotliwość PWM" - -#: ports/espressif/common-hal/analogio/AnalogIn.c -msgid "Invalid Pin" -msgstr "" - -#: ports/espressif/bindings/espidf/__init__.c -#: ports/espressif/common-hal/busio/I2C.c -#: ports/espressif/common-hal/i2cperipheral/I2CPeripheral.c -#: ports/espressif/esp_error.c py/moduerrno.c -#: shared-module/rgbmatrix/RGBMatrix.c +#: ports/espressif/common-hal/espidf/__init__.c ports/espressif/esp_error.c +#: py/moduerrno.c msgid "Invalid argument" msgstr "Zły argument" @@ -1356,42 +1224,11 @@ msgstr "Zły argument" msgid "Invalid bits per value" msgstr "Zła liczba bitów wartości" -#: ports/nrf/common-hal/busio/UART.c ports/raspberrypi/common-hal/busio/UART.c -#: ports/stm/common-hal/busio/UART.c -msgid "Invalid buffer size" -msgstr "Zła wielkość bufora" - -#: shared-bindings/adafruit_pixelbuf/PixelBuf.c -msgid "Invalid byteorder string" -msgstr "" - -#: ports/atmel-samd/common-hal/frequencyio/FrequencyIn.c -#: ports/espressif/common-hal/frequencyio/FrequencyIn.c -msgid "Invalid capture period. Valid range: 1 - 500" -msgstr "Zły okres. Poprawny zakres to: 1 - 500" - -#: shared-bindings/audiomixer/Mixer.c -msgid "Invalid channel count" -msgstr "Zła liczba kanałów" - -#: ports/atmel-samd/common-hal/imagecapture/ParallelImageCapture.c -#, c-format -msgid "Invalid data_count %d" -msgstr "" - #: ports/atmel-samd/common-hal/imagecapture/ParallelImageCapture.c #, c-format msgid "Invalid data_pins[%d]" msgstr "" -#: shared-bindings/digitalio/DigitalInOut.c -msgid "Invalid direction." -msgstr "Nieprawidłowy kierunek." - -#: shared-module/audiocore/WaveFile.c -msgid "Invalid file" -msgstr "Zły plik" - #: shared-module/audiocore/WaveFile.c msgid "Invalid format chunk size" msgstr "Zła wielkość fragmentu formatu" @@ -1400,107 +1237,27 @@ msgstr "Zła wielkość fragmentu formatu" msgid "Invalid memory access." msgstr "Nieprawidłowy dostęp do pamięci." -#: extmod/vfs_fat_file.c -msgid "Invalid mode" -msgstr "" - #: ports/espressif/common-hal/wifi/Radio.c msgid "Invalid multicast MAC address" msgstr "" -#: shared-bindings/bitbangio/SPI.c shared-bindings/busio/SPI.c -msgid "Invalid number of bits" -msgstr "Zła liczba bitów" - -#: shared-bindings/bitbangio/SPI.c shared-bindings/busio/SPI.c -#: shared-bindings/displayio/FourWire.c -msgid "Invalid phase" -msgstr "Zła faza" - -#: ports/atmel-samd/common-hal/audioio/AudioOut.c -#: ports/atmel-samd/common-hal/touchio/TouchIn.c -#: ports/espressif/common-hal/alarm/touch/TouchAlarm.c -#: ports/espressif/common-hal/touchio/TouchIn.c -#: ports/nrf/common-hal/alarm/pin/PinAlarm.c shared-bindings/pwmio/PWMOut.c -#: shared-module/rgbmatrix/RGBMatrix.c -msgid "Invalid pin" -msgstr "Zła nóżka" - -#: ports/atmel-samd/common-hal/audioio/AudioOut.c -msgid "Invalid pin for left channel" -msgstr "Zła nóżka dla lewego kanału" - -#: ports/atmel-samd/common-hal/audioio/AudioOut.c -msgid "Invalid pin for right channel" -msgstr "Zła nóżka dla prawego kanału" - -#: ports/atmel-samd/common-hal/busio/I2C.c -#: ports/atmel-samd/common-hal/busio/SPI.c -#: ports/atmel-samd/common-hal/busio/UART.c -#: ports/atmel-samd/common-hal/i2cperipheral/I2CPeripheral.c -#: ports/cxd56/common-hal/busio/I2C.c ports/cxd56/common-hal/busio/SPI.c -#: ports/cxd56/common-hal/busio/UART.c ports/cxd56/common-hal/sdioio/SDCard.c -#: ports/espressif/common-hal/busio/I2C.c -#: ports/espressif/common-hal/busio/SPI.c -#: ports/espressif/common-hal/busio/UART.c -#: ports/espressif/common-hal/canio/CAN.c -#: ports/espressif/common-hal/i2cperipheral/I2CPeripheral.c -#: ports/mimxrt10xx/common-hal/busio/I2C.c -#: ports/mimxrt10xx/common-hal/busio/SPI.c -#: ports/mimxrt10xx/common-hal/usb_host/Port.c ports/nrf/common-hal/busio/I2C.c -#: ports/raspberrypi/common-hal/busio/I2C.c -#: ports/raspberrypi/common-hal/busio/SPI.c -#: ports/raspberrypi/common-hal/busio/UART.c shared-bindings/busio/SPI.c #: shared-bindings/busio/UART.c msgid "Invalid pins" msgstr "Złe nóżki" -#: shared-bindings/bitbangio/SPI.c shared-bindings/busio/SPI.c -#: shared-bindings/displayio/FourWire.c -msgid "Invalid polarity" -msgstr "Zła polaryzacja" - -#: shared-bindings/_bleio/Characteristic.c -msgid "Invalid properties" -msgstr "Nieprawidłowe właściwości" - -#: shared-bindings/microcontroller/__init__.c -msgid "Invalid run mode." -msgstr "Zły tryb uruchomienia." - -#: shared-module/_bleio/Attribute.c -msgid "Invalid security_mode" -msgstr "Nieprawidłowy security_mode" - -#: ports/espressif/bindings/espidf/__init__.c ports/espressif/esp_error.c +#: ports/espressif/common-hal/espidf/__init__.c ports/espressif/esp_error.c msgid "Invalid size" msgstr "Nieprawidłowy rozmiar" #: ports/espressif/common-hal/ssl/SSLContext.c +#: ports/raspberrypi/common-hal/ssl/SSLSocket.c msgid "Invalid socket for TLS" msgstr "" -#: ports/espressif/bindings/espidf/__init__.c ports/espressif/esp_error.c +#: ports/espressif/common-hal/espidf/__init__.c ports/espressif/esp_error.c msgid "Invalid state" msgstr "Nieprawidłowy stan" -#: shared-bindings/audiomixer/Mixer.c -msgid "Invalid voice" -msgstr "" - -#: shared-bindings/audiomixer/Mixer.c -msgid "Invalid voice count" -msgstr "Zła liczba głosów" - -#: shared-module/audiocore/WaveFile.c -msgid "Invalid wave file" -msgstr "Zły plik wave" - -#: ports/mimxrt10xx/common-hal/busio/UART.c ports/nrf/common-hal/busio/UART.c -#: ports/raspberrypi/common-hal/busio/UART.c ports/stm/common-hal/busio/UART.c -msgid "Invalid word/bit length" -msgstr "Niepoprawna długość słowa/bitu" - #: shared-bindings/aesio/aes.c msgid "Key must be 16, 24, or 32 bytes long" msgstr "Klucz musi mieć długość 16, 24 lub 32 bajtów" @@ -1514,24 +1271,16 @@ msgid "LHS of keyword arg must be an id" msgstr "Lewa strona argumentu nazwanego musi być nazwą" #: shared-module/displayio/Group.c -msgid "Layer already in a group." +msgid "Layer already in a group" msgstr "" #: shared-module/displayio/Group.c -msgid "Layer must be a Group or TileGrid subclass." -msgstr "Layer musi dziedziczyć z Group albo TileGrid." - -#: ports/espressif/bindings/espidf/__init__.c ports/espressif/esp_error.c -msgid "MAC address was invalid" +msgid "Layer must be a Group or TileGrid subclass" msgstr "" -#: shared-module/bitbangio/SPI.c -msgid "MISO pin init failed." -msgstr "Nie powiodło się ustawienie pinu MISO." - -#: shared-module/bitbangio/SPI.c -msgid "MOSI pin init failed." -msgstr "Nie powiodło się ustawienie pinu MOSI." +#: ports/espressif/common-hal/espidf/__init__.c ports/espressif/esp_error.c +msgid "MAC address was invalid" +msgstr "" #: shared-bindings/is31fl3741/IS31FL3741.c msgid "Mapping must be a tuple" @@ -1542,10 +1291,6 @@ msgstr "" msgid "Maximum x value when mirrored is %d" msgstr "Największa wartość x przy odwróceniu to %d" -#: shared-bindings/canio/Message.c -msgid "Messages limited to 8 bytes" -msgstr "Wiadomości ograniczone do 8 bajtów" - #: shared-bindings/audiobusio/PDMIn.c msgid "Microphone startup delay must be in range 0.0 to 1.0" msgstr "Opóźnienie włączenia mikrofonu musi być w zakresie od 0.0 do 1.0" @@ -1559,10 +1304,14 @@ msgstr "" msgid "Mismatched swap flag" msgstr "" -#: ports/mimxrt10xx/common-hal/busio/SPI.c ports/stm/common-hal/busio/SPI.c +#: ports/mimxrt10xx/common-hal/busio/SPI.c msgid "Missing MISO or MOSI Pin" msgstr "Brak pinu MISO lub MOSI" +#: ports/stm/common-hal/busio/SPI.c +msgid "Missing MISO or MOSI pin" +msgstr "" + #: ports/raspberrypi/common-hal/rp2pio/StateMachine.c #, c-format msgid "Missing first_in_pin. Instruction %d reads pin(s)" @@ -1598,11 +1347,6 @@ msgstr "" msgid "Missing jmp_pin. Instruction %d jumps on pin" msgstr "" -#: shared-module/usb_hid/Device.c -#, c-format -msgid "More than %d report ids not supported" -msgstr "" - #: shared-bindings/busio/UART.c shared-bindings/displayio/Group.c msgid "Must be a %q subclass." msgstr "" @@ -1662,16 +1406,28 @@ msgstr "" msgid "No I2C device at address: 0x%x" msgstr "" +#: supervisor/shared/web_workflow/web_workflow.c +msgid "No IP" +msgstr "" + #: ports/espressif/common-hal/busio/SPI.c -#: ports/mimxrt10xx/common-hal/busio/SPI.c ports/stm/common-hal/busio/SPI.c +#: ports/mimxrt10xx/common-hal/busio/SPI.c msgid "No MISO Pin" msgstr "Brak pinu MISO" +#: ports/stm/common-hal/busio/SPI.c shared-module/bitbangio/SPI.c +msgid "No MISO pin" +msgstr "" + #: ports/espressif/common-hal/busio/SPI.c -#: ports/mimxrt10xx/common-hal/busio/SPI.c ports/stm/common-hal/busio/SPI.c +#: ports/mimxrt10xx/common-hal/busio/SPI.c msgid "No MOSI Pin" msgstr "Brak pinu MOSI" +#: ports/stm/common-hal/busio/SPI.c shared-module/bitbangio/SPI.c +msgid "No MOSI pin" +msgstr "" + #: ports/atmel-samd/common-hal/busio/UART.c #: ports/espressif/common-hal/busio/UART.c #: ports/mimxrt10xx/common-hal/busio/UART.c ports/nrf/common-hal/busio/UART.c @@ -1710,16 +1466,6 @@ msgstr "Brak wolnych GLCK" msgid "No hardware random available" msgstr "Brak generatora liczb losowych" -#: ports/atmel-samd/common-hal/ps2io/Ps2.c -msgid "No hardware support on clk pin" -msgstr "" - -#: ports/atmel-samd/common-hal/alarm/pin/PinAlarm.c -#: ports/atmel-samd/common-hal/frequencyio/FrequencyIn.c -#: ports/atmel-samd/common-hal/pulseio/PulseIn.c -msgid "No hardware support on pin" -msgstr "Brak sprzętowej obsługi na nóżce" - #: ports/raspberrypi/common-hal/rp2pio/StateMachine.c msgid "No in in program" msgstr "" @@ -1817,16 +1563,26 @@ msgstr "Obiekt został zwolniony i nie można go już używać. Utwórz nowy obi msgid "Odd parity is not supported" msgstr "Nieparzysta parzystość nie jest wspierana" +#: supervisor/shared/bluetooth/bluetooth.c +msgid "Off" +msgstr "" + +#: supervisor/shared/bluetooth/bluetooth.c +msgid "Ok" +msgstr "" + #: ports/atmel-samd/common-hal/audiobusio/PDMIn.c #: ports/raspberrypi/common-hal/audiobusio/PDMIn.c msgid "Only 8 or 16 bit mono with " msgstr "Tylko 8 lub 16 bitów mono z " #: ports/espressif/common-hal/wifi/__init__.c +#: ports/raspberrypi/common-hal/wifi/__init__.c msgid "Only IPv4 addresses supported" msgstr "" -#: ports/espressif/common-hal/socketpool/SocketPool.c +#: ports/espressif/common-hal/socketpool/Socket.c +#: ports/raspberrypi/common-hal/socketpool/Socket.c msgid "Only IPv4 sockets supported" msgstr "" @@ -1859,15 +1615,19 @@ msgstr "" msgid "Only one TouchAlarm can be set in deep sleep." msgstr "" -#: ports/espressif/common-hal/i2cperipheral/I2CPeripheral.c +#: ports/espressif/common-hal/i2ctarget/I2CTarget.c +#: ports/raspberrypi/common-hal/i2ctarget/I2CTarget.c msgid "Only one address is allowed" msgstr "" #: ports/atmel-samd/common-hal/alarm/time/TimeAlarm.c -#: ports/espressif/common-hal/alarm/time/TimeAlarm.c #: ports/nrf/common-hal/alarm/time/TimeAlarm.c -#: ports/raspberrypi/common-hal/alarm/time/TimeAlarm.c #: ports/stm/common-hal/alarm/time/TimeAlarm.c +msgid "Only one alarm.time alarm can be set" +msgstr "" + +#: ports/espressif/common-hal/alarm/time/TimeAlarm.c +#: ports/raspberrypi/common-hal/alarm/time/TimeAlarm.c msgid "Only one alarm.time alarm can be set." msgstr "" @@ -1879,19 +1639,20 @@ msgstr "W danym momencie przezroczysty może być tylko jeden kolor" msgid "Operation not permitted" msgstr "" -#: ports/espressif/bindings/espidf/__init__.c ports/espressif/esp_error.c +#: ports/espressif/common-hal/espidf/__init__.c ports/espressif/esp_error.c msgid "Operation or feature not supported" msgstr "" -#: ports/espressif/bindings/espidf/__init__.c ports/espressif/esp_error.c +#: ports/espressif/common-hal/espidf/__init__.c ports/espressif/esp_error.c msgid "Operation timed out" msgstr "" -#: ports/espressif/bindings/espidf/__init__.c ports/espressif/esp_error.c +#: ports/espressif/common-hal/espidf/__init__.c ports/espressif/esp_error.c msgid "Out of memory" msgstr "Brak pamięci" -#: ports/espressif/common-hal/socketpool/SocketPool.c +#: ports/espressif/common-hal/socketpool/Socket.c +#: ports/raspberrypi/common-hal/socketpool/Socket.c msgid "Out of sockets" msgstr "" @@ -1899,11 +1660,6 @@ msgstr "" msgid "Out-buffer elements must be <= 4 bytes long" msgstr "" -#: shared-bindings/bitops/__init__.c -#, c-format -msgid "Output buffer must be at least %d bytes" -msgstr "" - #: shared-bindings/audiobusio/PDMIn.c msgid "Oversample must be multiple of 8." msgstr "Nadpróbkowanie musi być wielokrotnością 8." @@ -1912,16 +1668,15 @@ msgstr "Nadpróbkowanie musi być wielokrotnością 8." msgid "PDMIn not available" msgstr "" -#: shared-bindings/pwmio/PWMOut.c -msgid "" -"PWM duty_cycle must be between 0 and 65535 inclusive (16 bit resolution)" -msgstr "duty_cycle musi być pomiędzy 0 a 65535 włącznie (rozdzielczość 16 bit)" - #: shared-bindings/pwmio/PWMOut.c msgid "" "PWM frequency not writable when variable_frequency is False on construction." msgstr "Nie można zmienić częstotliwości PWM gdy variable_frequency=False." +#: ports/stm/common-hal/pwmio/PWMOut.c +msgid "PWM restart" +msgstr "" + #: ports/raspberrypi/common-hal/countio/Counter.c msgid "PWM slice already in use" msgstr "" @@ -1938,36 +1693,20 @@ msgstr "" msgid "Permission denied" msgstr "Odmowa dostępu" -#: ports/atmel-samd/common-hal/alarm/pin/PinAlarm.c #: ports/stm/common-hal/alarm/pin/PinAlarm.c msgid "Pin cannot wake from Deep Sleep" msgstr "" -#: ports/raspberrypi/bindings/rp2pio/StateMachine.c -msgid "Pin count must be at least 1" -msgstr "" - #: ports/raspberrypi/common-hal/rp2pio/StateMachine.c msgid "Pin count too large" msgstr "" -#: ports/atmel-samd/common-hal/analogio/AnalogIn.c -#: ports/cxd56/common-hal/analogio/AnalogIn.c -#: ports/espressif/common-hal/analogio/AnalogIn.c -#: ports/mimxrt10xx/common-hal/analogio/AnalogIn.c -#: ports/nrf/common-hal/analogio/AnalogIn.c -#: ports/raspberrypi/common-hal/analogio/AnalogIn.c -#: ports/stm/common-hal/analogio/AnalogIn.c -msgid "Pin does not have ADC capabilities" -msgstr "Nóżka nie obsługuje ADC" - #: ports/stm/common-hal/alarm/pin/PinAlarm.c #: ports/stm/common-hal/pulseio/PulseIn.c msgid "Pin interrupt already in use" msgstr "" #: shared-bindings/adafruit_bus_device/spi_device/SPIDevice.c -#: shared-bindings/digitalio/DigitalInOut.c msgid "Pin is input only" msgstr "" @@ -2027,18 +1766,10 @@ msgstr "" msgid "Program does OUT without loading OSR" msgstr "" -#: ports/raspberrypi/bindings/rp2pio/StateMachine.c -msgid "Program must contain at least one 16-bit instruction." -msgstr "" - #: ports/raspberrypi/bindings/rp2pio/StateMachine.c msgid "Program size invalid" msgstr "" -#: ports/raspberrypi/bindings/rp2pio/StateMachine.c -msgid "Program too large" -msgstr "" - #: shared-bindings/digitalio/DigitalInOut.c msgid "Pull not used when direction is output." msgstr "Podciągnięcie nieużywane w trybie wyjścia." @@ -2060,8 +1791,9 @@ msgstr "" msgid "RNG Init Error" msgstr "" -#: ports/nrf/common-hal/busio/UART.c -msgid "RS485 Not yet supported on this device" +#: ports/atmel-samd/common-hal/busio/UART.c ports/cxd56/common-hal/busio/UART.c +#: ports/nrf/common-hal/busio/UART.c ports/stm/common-hal/busio/UART.c +msgid "RS485" msgstr "" #: ports/espressif/common-hal/busio/UART.c @@ -2069,21 +1801,10 @@ msgstr "" msgid "RS485 inversion specified when not in RS485 mode" msgstr "" -#: ports/cxd56/common-hal/rtc/RTC.c ports/espressif/common-hal/rtc/RTC.c -#: ports/mimxrt10xx/common-hal/rtc/RTC.c ports/nrf/common-hal/rtc/RTC.c -#: ports/raspberrypi/common-hal/rtc/RTC.c -msgid "RTC calibration is not supported on this board" -msgstr "Brak obsługi kalibracji RTC" - #: shared-bindings/alarm/time/TimeAlarm.c shared-bindings/time/__init__.c msgid "RTC is not supported on this board" msgstr "Brak obsługi RTC" -#: ports/atmel-samd/common-hal/busio/UART.c ports/cxd56/common-hal/busio/UART.c -#: ports/stm/common-hal/busio/UART.c -msgid "RTS/CTS/RS485 Not yet supported on this device" -msgstr "" - #: ports/stm/common-hal/os/__init__.c msgid "Random number generation error" msgstr "Błąd generowania liczb losowych" @@ -2101,10 +1822,14 @@ msgstr "System plików tylko do odczytu" msgid "Read-only object" msgstr "Obiekt tylko do odczytu" -#: ports/espressif/bindings/espidf/__init__.c ports/espressif/esp_error.c +#: ports/espressif/common-hal/espidf/__init__.c ports/espressif/esp_error.c msgid "Received response was invalid" msgstr "Otrzymana odpowiedź była nieprawidłowa" +#: supervisor/shared/bluetooth/bluetooth.c +msgid "Reconnecting" +msgstr "" + #: shared-bindings/displayio/EPaperDisplay.c msgid "Refresh too soon" msgstr "Zbyt wczesne odświeżenie" @@ -2117,7 +1842,7 @@ msgstr "" msgid "Requested AES mode is unsupported" msgstr "Żądany tryb AES nie jest obsługiwany" -#: ports/espressif/bindings/espidf/__init__.c ports/espressif/esp_error.c +#: ports/espressif/common-hal/espidf/__init__.c ports/espressif/esp_error.c msgid "Requested resource not found" msgstr "Nie znaleziono żądanego zasobu" @@ -2133,6 +1858,10 @@ msgstr "Uruchomiony tryb bezpieczeństwa! Zapisany kod nie jest uruchamiany.\n" msgid "SD card CSD format not supported" msgstr "" +#: ports/cxd56/common-hal/sdioio/SDCard.c +msgid "SDCard init" +msgstr "" + #: ports/stm/common-hal/sdioio/SDCard.c #, c-format msgid "SDIO GetCardInfo Error %d" @@ -2143,30 +1872,21 @@ msgstr "" msgid "SDIO Init Error %d" msgstr "" -#: ports/stm/common-hal/busio/SPI.c -msgid "SPI Init Error" -msgstr "Błąd inicjowania SPI" - -#: ports/stm/common-hal/busio/SPI.c -msgid "SPI Re-initialization error" -msgstr "Błąd ponownej inicjalizacji SPI" - #: ports/espressif/common-hal/busio/SPI.c msgid "SPI configuration failed" msgstr "" +#: ports/stm/common-hal/busio/SPI.c +msgid "SPI init error" +msgstr "" + #: ports/raspberrypi/common-hal/busio/SPI.c msgid "SPI peripheral in use" msgstr "" -#: shared-bindings/audiomixer/Mixer.c -msgid "Sample rate must be positive" -msgstr "Częstotliwość próbkowania musi być dodatnia" - -#: ports/atmel-samd/common-hal/audioio/AudioOut.c -#, c-format -msgid "Sample rate too high. It must be less than %d" -msgstr "Zbyt wysoka częstotliwość próbkowania. Musi być mniejsza niż %d" +#: ports/stm/common-hal/busio/SPI.c +msgid "SPI re-init" +msgstr "" #: shared-bindings/is31fl3741/FrameBuffer.c msgid "Scale dimensions must divide by 3" @@ -2186,14 +1906,6 @@ msgstr "Serializator w użyciu" msgid "Server side context cannot have hostname" msgstr "" -#: ports/raspberrypi/bindings/rp2pio/StateMachine.c -msgid "Set pin count must be between 1 and 5" -msgstr "" - -#: ports/raspberrypi/bindings/rp2pio/StateMachine.c -msgid "Side set pin count must be between 1 and 5" -msgstr "" - #: ports/cxd56/common-hal/camera/Camera.c msgid "Size not supported" msgstr "" @@ -2214,6 +1926,7 @@ msgid "Slices not supported" msgstr "Fragmenty nieobsługiwane" #: ports/espressif/common-hal/socketpool/SocketPool.c +#: ports/raspberrypi/common-hal/socketpool/SocketPool.c msgid "SocketPool can only be used with wifi.radio" msgstr "" @@ -2229,10 +1942,6 @@ msgstr "" msgid "Splitting with sub-captures" msgstr "Podział z podgrupami" -#: shared-bindings/supervisor/__init__.c -msgid "Stack size must be at least 256" -msgstr "Stos musi mieć co najmniej 256 bajtów" - #: ports/raspberrypi/common-hal/audiopwmio/PWMAudioOut.c msgid "Stereo left must be on PWM channel A" msgstr "" @@ -2241,10 +1950,6 @@ msgstr "" msgid "Stereo right must be on PWM channel B" msgstr "" -#: shared-bindings/multiterminal/__init__.c -msgid "Stream missing readinto() or write() method." -msgstr "Strumień nie ma metod readinto() lub write()." - #: ports/mimxrt10xx/common-hal/busio/UART.c ports/stm/common-hal/busio/UART.c msgid "Supply at least one UART pin" msgstr "Podaj co najmniej jeden pin UART" @@ -2318,10 +2023,6 @@ msgstr "Wysokość bitmapy musi być wielokrotnością wysokości kafelka" msgid "Tile index out of bounds" msgstr "" -#: shared-bindings/displayio/TileGrid.c -msgid "Tile value out of bounds" -msgstr "" - #: shared-bindings/displayio/TileGrid.c msgid "Tile width must exactly divide bitmap width" msgstr "Szerokość bitmapy musi być wielokrotnością szerokości kafelka" @@ -2341,6 +2042,9 @@ msgid "To exit, please reset the board without " msgstr "By wyjść, proszę zresetować płytkę bez " #: ports/atmel-samd/common-hal/audiobusio/I2SOut.c +msgid "Too many channels in sample" +msgstr "" + #: ports/raspberrypi/common-hal/audiobusio/I2SOut.c msgid "Too many channels in sample." msgstr "Zbyt wiele kanałów." @@ -2373,24 +2077,25 @@ msgid "Tuple or struct_time argument required" msgstr "Wymagana krotka lub struct_time" #: ports/stm/common-hal/busio/UART.c -msgid "UART Buffer allocation error" -msgstr "Błąd alokacji bufora UART" +msgid "UART de-init" +msgstr "" -#: ports/stm/common-hal/busio/UART.c -msgid "UART De-init error" +#: ports/atmel-samd/common-hal/busio/UART.c ports/cxd56/common-hal/busio/UART.c +#: ports/espressif/common-hal/busio/UART.c ports/stm/common-hal/busio/UART.c +msgid "UART init" msgstr "" #: ports/stm/common-hal/busio/UART.c -msgid "UART Init Error" +msgid "UART re-init" msgstr "" #: ports/stm/common-hal/busio/UART.c -msgid "UART Re-init error" +msgid "UART write" msgstr "" -#: ports/stm/common-hal/busio/UART.c -msgid "UART write error" -msgstr "Błąd zapisu UART" +#: main.c +msgid "UID:" +msgstr "" #: shared-module/usb_hid/Device.c msgid "USB busy" @@ -2515,6 +2220,11 @@ msgstr "" msgid "Unknown system firmware error: %d" msgstr "" +#: ports/raspberrypi/common-hal/wifi/__init__.c +#, c-format +msgid "Unkown error code %d" +msgstr "" + #: shared-bindings/adafruit_pixelbuf/PixelBuf.c #, c-format msgid "Unmatched number of items on RHS (expected %d, got %d)." @@ -2526,12 +2236,6 @@ msgid "" "declined or ignored." msgstr "" -#: ports/atmel-samd/common-hal/busio/I2C.c ports/cxd56/common-hal/busio/I2C.c -#: ports/espressif/common-hal/busio/UART.c -#: ports/raspberrypi/common-hal/busio/I2C.c ports/stm/common-hal/busio/I2C.c -msgid "Unsupported baudrate" -msgstr "Zła szybkość transmisji" - #: shared-bindings/bitmaptools/__init__.c msgid "Unsupported colorspace" msgstr "" @@ -2544,6 +2248,10 @@ msgstr "Zły typ magistrali wyświetlaczy" msgid "Unsupported format" msgstr "Zły format" +#: shared-bindings/hashlib/__init__.c +msgid "Unsupported hash algorithm" +msgstr "" + #: ports/espressif/common-hal/dualbank/__init__.c msgid "Update Failed" msgstr "" @@ -2562,7 +2270,7 @@ msgstr "" msgid "Value length > max_length" msgstr "" -#: ports/espressif/bindings/espidf/__init__.c ports/espressif/esp_error.c +#: ports/espressif/common-hal/espidf/__init__.c ports/espressif/esp_error.c msgid "Version was invalid" msgstr "" @@ -2592,10 +2300,6 @@ msgstr "" msgid "WatchDogTimer.timeout must be greater than 0" msgstr "WatchDogTimer.timeout musi być większe od 0" -#: supervisor/shared/safe_mode.c -msgid "Watchdog timer expired." -msgstr "" - #: py/builtinhelp.c #, c-format msgid "" @@ -2606,8 +2310,8 @@ msgid "" "To list built-in modules type `help(\"modules\")`.\n" msgstr "" -#: shared-bindings/wifi/Radio.c -msgid "WiFi password must be between 8 and 63 characters" +#: supervisor/shared/web_workflow/web_workflow.c +msgid "Wi-Fi: " msgstr "" #: main.c @@ -2648,11 +2352,7 @@ msgstr "Argument __new__ musi być typu użytkownika" msgid "a bytes-like object is required" msgstr "wymagany obiekt typu bytes" -#: shared-bindings/i2cperipheral/I2CPeripheral.c -msgid "address out of bounds" -msgstr "adres poza zakresem" - -#: shared-bindings/i2cperipheral/I2CPeripheral.c +#: shared-bindings/i2ctarget/I2CTarget.c msgid "addresses is empty" msgstr "adres jest pusty" @@ -2701,6 +2401,10 @@ msgstr "" msgid "array and index length must be equal" msgstr "" +#: extmod/ulab/code/numpy/io/io.c +msgid "array has too many dimensions" +msgstr "" + #: py/objarray.c shared-bindings/alarm/SleepMemory.c #: shared-bindings/nvm/ByteArray.c msgid "array/bytes required on right side" @@ -2762,10 +2466,6 @@ msgstr "" msgid "bits must be 32 or less" msgstr "" -#: shared-bindings/busio/UART.c -msgid "bits must be in range 5 to 9" -msgstr "" - #: shared-bindings/audiomixer/Mixer.c msgid "bits_per_sample must be 8 or 16" msgstr "bits_per_sample musi być 8 lub 16" @@ -2803,11 +2503,6 @@ msgstr "" msgid "byteorder is not a string" msgstr "" -#: ports/atmel-samd/common-hal/busio/UART.c -#: ports/espressif/common-hal/busio/UART.c -msgid "bytes > 8 bits not supported" -msgstr "bajty większe od 8 bitów są niewspierane" - #: py/objarray.c msgid "bytes length not a multiple of item size" msgstr "" @@ -2816,7 +2511,7 @@ msgstr "" msgid "bytes value out of range" msgstr "wartość bytes poza zakresem" -#: ports/atmel-samd/bindings/samd/Clock.c ports/atmel-samd/common-hal/rtc/RTC.c +#: ports/atmel-samd/bindings/samd/Clock.c msgid "calibration is out of range" msgstr "kalibracja poza zakresem" @@ -2824,12 +2519,9 @@ msgstr "kalibracja poza zakresem" msgid "calibration is read only" msgstr "kalibracja tylko do odczytu" -#: ports/atmel-samd/common-hal/rtc/RTC.c -msgid "calibration value out of range +/-127" -msgstr "wartość kalibracji poza zakresem +/-127" - +#: shared-module/vectorio/Circle.c shared-module/vectorio/Polygon.c #: shared-module/vectorio/Rectangle.c -msgid "can only be registered in one parent" +msgid "can only have one parent" msgstr "" #: py/emitinlinethumb.c @@ -2852,8 +2544,7 @@ msgstr "przypisanie do wyrażenia" msgid "can't cancel self" msgstr "" -#: py/obj.c py/objint.c shared-bindings/i2cperipheral/I2CPeripheral.c -#: shared-module/adafruit_pixelbuf/PixelBuf.c +#: py/obj.c py/objint.c shared-module/adafruit_pixelbuf/PixelBuf.c msgid "can't convert %q to %q" msgstr "nie można dokonać konwersji %q na %q" @@ -3000,6 +2691,10 @@ msgstr "" msgid "casting" msgstr "rzutowanie" +#: ports/stm/common-hal/pwmio/PWMOut.c +msgid "channel re-init" +msgstr "" + #: shared-bindings/_stage/Text.c msgid "chars buffer too small" msgstr "bufor chars zbyt mały" @@ -3012,10 +2707,6 @@ msgstr "argument chr() poza zakresem range(0x110000)" msgid "chr() arg not in range(256)" msgstr "argument chr() poza zakresem range(256)" -#: shared-module/vectorio/Circle.c -msgid "circle can only be registered in one parent" -msgstr "" - #: shared-bindings/bitmaptools/__init__.c msgid "clip point must be (x,y) tuple" msgstr "" @@ -3040,10 +2731,6 @@ msgstr "bufor kolorów musi być bytearray lub tablicą typu 'b' lub 'B'" msgid "color must be between 0x000000 and 0xffffff" msgstr "kolor musi być pomiędzy 0x000000 a 0xffffff" -#: shared-bindings/displayio/ColorConverter.c -msgid "color should be an int" -msgstr "kolor powinien być liczbą całkowitą" - #: py/emitnative.c msgid "comparison of int and uint" msgstr "" @@ -3080,6 +2767,10 @@ msgstr "" msgid "convolve arguments must not be empty" msgstr "" +#: extmod/ulab/code/numpy/io/io.c +msgid "corrupted file" +msgstr "" + #: extmod/ulab/code/numpy/poly.c msgid "could not invert Vandermonde matrix" msgstr "" @@ -3131,10 +2822,6 @@ msgstr "" msgid "destination buffer must be an array of type 'H' for bit_depth = 16" msgstr "bufor docelowy musi być tablicą typu 'H' dla bit_depth = 16" -#: shared-bindings/audiobusio/PDMIn.c -msgid "destination_length must be an int >= 0" -msgstr "destination_length musi być nieujemną liczbą całkowitą" - #: py/objdict.c msgid "dict update sequence has wrong length" msgstr "sekwencja ma złą długość" @@ -3172,6 +2859,10 @@ msgstr "" msgid "empty" msgstr "puste" +#: extmod/ulab/code/numpy/io/io.c +msgid "empty file" +msgstr "" + #: extmod/moduasyncio.c extmod/moduheapq.c extmod/modutimeq.c msgid "empty heap" msgstr "pusta sterta" @@ -3188,10 +2879,6 @@ msgstr "pusta sekwencja" msgid "end of format while looking for conversion specifier" msgstr "koniec formatu przy szukaniu specyfikacji konwersji" -#: shared-bindings/displayio/Shape.c -msgid "end_x should be an int" -msgstr "end_x powinien być całkowity" - #: shared-bindings/alarm/time/TimeAlarm.c msgid "epoch_time not supported on this board" msgstr "" @@ -3201,6 +2888,12 @@ msgstr "" msgid "error = 0x%08lX" msgstr "błąd = 0x%08lX" +#: ports/espressif/common-hal/esp32_camera/Camera.c +msgid "" +"esp32_camera.Camera requires reserved PSRAM to be configured. See the " +"documentation for instructions." +msgstr "" + #: py/runtime.c msgid "exceptions must derive from BaseException" msgstr "wyjątki muszą dziedziczyć po BaseException" @@ -3275,7 +2968,7 @@ msgstr "pierwszy argument musi być funkcją" msgid "first argument must be a tuple of ndarrays" msgstr "" -#: extmod/ulab/code/numpy/vector.c +#: extmod/ulab/code/numpy/transform.c extmod/ulab/code/numpy/vector.c msgid "first argument must be an ndarray" msgstr "" @@ -3423,7 +3116,7 @@ msgstr "niepełny klucz formatu" msgid "incorrect padding" msgstr "złe wypełnienie" -#: extmod/ulab/code/ndarray.c +#: extmod/ulab/code/ndarray.c extmod/ulab/code/numpy/transform.c msgid "index is out of bounds" msgstr "indeks jest poza zakresem" @@ -3441,6 +3134,10 @@ msgstr "indeksy muszą być całkowite" msgid "indices must be integers, slices, or Boolean lists" msgstr "" +#: ports/espressif/common-hal/busio/I2C.c +msgid "init I2C" +msgstr "" + #: extmod/ulab/code/scipy/optimize/optimize.c msgid "initial values must be iterable" msgstr "wartości początkowe muszą być iterowalne" @@ -3486,6 +3183,10 @@ msgstr "" msgid "input matrix is singular" msgstr "" +#: extmod/ulab/code/numpy/create.c +msgid "input must be 1- or 2-d" +msgstr "" + #: extmod/ulab/code/numpy/carray/carray.c msgid "input must be a 1D ndarray" msgstr "" @@ -3494,11 +3195,7 @@ msgstr "" msgid "input must be a dense ndarray" msgstr "" -#: extmod/ulab/code/numpy/create.c -msgid "input must be a tensor of rank 2" -msgstr "" - -#: extmod/ulab/code/numpy/create.c extmod/ulab/code/user/user.c +#: extmod/ulab/code/user/user.c msgid "input must be an ndarray" msgstr "" @@ -3548,6 +3245,10 @@ msgstr "" msgid "invalid bits_per_pixel %d, must be, 1, 2, 4, 8, 16, 24, or 32" msgstr "" +#: ports/raspberrypi/common-hal/ssl/SSLSocket.c +msgid "invalid cert" +msgstr "zły ceryfikat" + #: shared-bindings/bitmaptools/__init__.c #, c-format msgid "invalid element size %d for bits_per_pixel %d\n" @@ -3574,10 +3275,18 @@ msgstr "zła specyfikacja formatu" msgid "invalid hostname" msgstr "" +#: ports/raspberrypi/common-hal/ssl/SSLSocket.c +msgid "invalid key" +msgstr "zły klucz" + #: py/compile.c msgid "invalid micropython decorator" msgstr "zły dekorator micropythona" +#: ports/espressif/common-hal/esp32_camera/Camera.c +msgid "invalid setting" +msgstr "" + #: shared-bindings/random/__init__.c msgid "invalid step" msgstr "zły krok" @@ -3691,10 +3400,6 @@ msgstr "błąd domeny" msgid "matrix is not positive definite" msgstr "" -#: ports/espressif/common-hal/wifi/Radio.c -msgid "max_connections must be between 0 and 10" -msgstr "" - #: ports/espressif/common-hal/_bleio/Descriptor.c #: ports/nrf/common-hal/_bleio/Characteristic.c #: ports/nrf/common-hal/_bleio/Descriptor.c @@ -3702,12 +3407,8 @@ msgstr "" msgid "max_length must be 0-%d when fixed_length is %s" msgstr "" -#: shared-bindings/_bleio/Characteristic.c shared-bindings/_bleio/Descriptor.c -msgid "max_length must be >= 0" -msgstr "" - #: extmod/ulab/code/ndarray.c -msgid "maximum number of dimensions is 4" +msgid "maximum number of dimensions is " msgstr "" #: py/runtime.c @@ -3841,7 +3542,7 @@ msgstr "" msgid "no response from SD card" msgstr "" -#: py/objobject.c py/runtime.c +#: ports/espressif/common-hal/esp32_camera/Camera.c py/objobject.c py/runtime.c msgid "no such attribute" msgstr "nie ma takiego atrybutu" @@ -3952,7 +3653,11 @@ msgstr "wymagany obiekt z protokołem buforu" msgid "odd-length string" msgstr "łańcuch o nieparzystej długości" -#: extmod/ulab/code/numpy/create.c extmod/ulab/code/utils/utils.c +#: supervisor/shared/web_workflow/web_workflow.c +msgid "off" +msgstr "" + +#: extmod/ulab/code/utils/utils.c msgid "offset is too large" msgstr "" @@ -4048,10 +3753,6 @@ msgstr "" msgid "palette must be 32 bytes long" msgstr "paleta musi mieć 32 bajty długości" -#: shared-bindings/displayio/Palette.c -msgid "palette_index should be an int" -msgstr "palette_index powinien być całkowity" - #: py/emitinlinextensa.c msgid "parameters must be registers in sequence a2 to a5" msgstr "parametry muszą być rejestrami w kolejności a2 do a5" @@ -4077,10 +3778,6 @@ msgstr "" msgid "poll on file not available on win32" msgstr "" -#: shared-module/vectorio/Polygon.c -msgid "polygon can only be registered in one parent" -msgstr "" - #: ports/espressif/common-hal/pulseio/PulseIn.c msgid "pop from an empty PulseIn" msgstr "pop z pustego PulseIn" @@ -4106,7 +3803,23 @@ msgstr "trzeci argument pow() nie może być 0" msgid "pow() with 3 arguments requires integers" msgstr "trzyargumentowe pow() wymaga liczb całkowitych" +#: ports/espressif/boards/adafruit_qtpy_esp32_pico/mpconfigboard.h +msgid "pressing BOOT button at start up.\n" +msgstr "" + +#: ports/espressif/boards/adafruit_feather_esp32_v2/mpconfigboard.h +msgid "pressing SW38 button at start up.\n" +msgstr "" + +#: ports/espressif/boards/hardkernel_odroid_go/mpconfigboard.h +msgid "pressing VOLUME button at start up.\n" +msgstr "" + #: ports/espressif/boards/adafruit_qtpy_esp32c3/mpconfigboard.h +#: ports/espressif/boards/beetle-esp32-c3/mpconfigboard.h +#: ports/espressif/boards/espressif_esp32s2_devkitc_1_n8r2/mpconfigboard.h +#: ports/espressif/boards/lolin_c3_mini/mpconfigboard.h +#: ports/espressif/boards/microdev_micro_c3/mpconfigboard.h #: supervisor/shared/safe_mode.c msgid "pressing boot button at start up.\n" msgstr "" @@ -4127,14 +3840,6 @@ msgstr "" msgid "pull masks conflict with direction masks" msgstr "" -#: ports/raspberrypi/bindings/rp2pio/StateMachine.c -msgid "pull_threshold must be between 1 and 32" -msgstr "" - -#: ports/raspberrypi/bindings/rp2pio/StateMachine.c -msgid "push_threshold must be between 1 and 32" -msgstr "" - #: extmod/modutimeq.c msgid "queue overflow" msgstr "przepełnienie kolejki" @@ -4186,13 +3891,6 @@ msgstr "" msgid "rsplit(None,n)" msgstr "rsplit(None,n)" -#: shared-bindings/audiocore/RawSample.c -msgid "" -"sample_source buffer must be a bytearray or array of type 'h', 'H', 'b' or " -"'B'" -msgstr "" -"bufor sample_source musi być bytearray lub tablicą typu 'h', 'H', 'b' lub 'B'" - #: ports/atmel-samd/common-hal/audiobusio/PDMIn.c #: ports/raspberrypi/common-hal/audiobusio/PDMIn.c msgid "sampling rate out of range" @@ -4290,26 +3988,14 @@ msgstr "" msgid "source_bitmap must have value_count of 8" msgstr "" -#: shared-bindings/wifi/Radio.c -msgid "ssid can't be more than 32 bytes" -msgstr "" - #: py/objstr.c msgid "start/end indices" msgstr "początkowe/końcowe indeksy" -#: shared-bindings/displayio/Shape.c -msgid "start_x should be an int" -msgstr "start_x powinien być całkowity" - #: shared-bindings/random/__init__.c msgid "step must be non-zero" msgstr "step nie może być zerowe" -#: shared-bindings/busio/UART.c -msgid "stop must be 1 or 2" -msgstr "stop musi być 1 lub 2" - #: shared-bindings/random/__init__.c msgid "stop not reachable from start" msgstr "stop nie jest osiągalne ze start" @@ -4358,10 +4044,6 @@ msgstr "błąd składni w deskryptorze uctypes" msgid "threshold must be in the range 0-65536" msgstr "threshold musi być w zakresie 0-65536" -#: shared-bindings/rgbmatrix/RGBMatrix.c -msgid "tile must be greater than zero" -msgstr "" - #: shared-bindings/time/__init__.c msgid "time.struct_time() takes a 9-sequence" msgstr "time.struct_time() wymaga 9-elementowej sekwencji" @@ -4381,10 +4063,6 @@ msgstr "" msgid "timeout must be < 655.35 secs" msgstr "" -#: shared-bindings/_bleio/CharacteristicBuffer.c -msgid "timeout must be >= 0.0" -msgstr "timeout musi być >= 0.0" - #: shared-module/sdcardio/SDCard.c msgid "timeout waiting for v1 card" msgstr "" @@ -4393,6 +4071,10 @@ msgstr "" msgid "timeout waiting for v2 card" msgstr "" +#: ports/stm/common-hal/pwmio/PWMOut.c +msgid "timer re-init" +msgstr "" + #: shared-bindings/time/__init__.c msgid "timestamp out of range for platform time_t" msgstr "timestamp poza zakresem dla time_t na tej platformie" @@ -4458,14 +4140,10 @@ msgstr "typ '%q' nie może być bazowy" msgid "type is not an acceptable base type" msgstr "typ nie może być bazowy" -#: py/runtime.c +#: py/objgenerator.c py/runtime.c msgid "type object '%q' has no attribute '%q'" msgstr "typ '%q' nie ma atrybutu '%q'" -#: py/objgenerator.c -msgid "type object 'generator' has no attribute '__await__'" -msgstr "" - #: py/objtype.c msgid "type takes 1 or 3 arguments" msgstr "type wymaga 1 lub 3 argumentów" @@ -4524,7 +4202,6 @@ msgid "unreadable attribute" msgstr "nieczytelny atrybut" #: shared-bindings/displayio/TileGrid.c shared-bindings/vectorio/VectorShape.c -#: shared-module/vectorio/Polygon.c shared-module/vectorio/VectorShape.c msgid "unsupported %q type" msgstr "zły typ %q" @@ -4563,6 +4240,14 @@ msgstr "zły typ dla operatora" msgid "unsupported types for %q: '%q', '%q'" msgstr "" +#: extmod/ulab/code/numpy/io/io.c +msgid "usecols is too high" +msgstr "" + +#: extmod/ulab/code/numpy/io/io.c +msgid "usecols keyword must be specified" +msgstr "" + #: py/objint.c #, c-format msgid "value must fit in %d byte(s)" @@ -4584,20 +4269,19 @@ msgstr "" msgid "watchdog timeout must be greater than 0" msgstr "" -#: shared-bindings/bitops/__init__.c -#, c-format -msgid "width must be from 2 to 8 (inclusive), not %d" -msgstr "" - #: shared-bindings/is31fl3741/FrameBuffer.c -#: shared-bindings/rgbmatrix/RGBMatrix.c msgid "width must be greater than zero" msgstr "szerokość musi być większa niż zero" #: ports/espressif/common-hal/wifi/Radio.c +#: ports/raspberrypi/common-hal/wifi/Radio.c msgid "wifi is not enabled" msgstr "" +#: ports/raspberrypi/common-hal/wifi/Monitor.c +msgid "wifi.Monitor not available" +msgstr "" + #: shared-bindings/_bleio/Adapter.c msgid "window must be <= interval" msgstr "" @@ -4610,7 +4294,17 @@ msgstr "" msgid "wrong axis specified" msgstr "" -#: extmod/ulab/code/numpy/compare.c extmod/ulab/code/numpy/vector.c +#: extmod/ulab/code/numpy/io/io.c +msgid "wrong dtype" +msgstr "" + +#: extmod/ulab/code/numpy/transform.c +msgid "wrong index type" +msgstr "zły typ indeksu" + +#: extmod/ulab/code/numpy/compare.c extmod/ulab/code/numpy/create.c +#: extmod/ulab/code/numpy/io/io.c extmod/ulab/code/numpy/transform.c +#: extmod/ulab/code/numpy/vector.c msgid "wrong input type" msgstr "nieprawidłowy typ wejścia" @@ -4618,6 +4312,10 @@ msgstr "nieprawidłowy typ wejścia" msgid "wrong length of condition array" msgstr "" +#: extmod/ulab/code/numpy/transform.c +msgid "wrong length of index array" +msgstr "" + #: extmod/ulab/code/numpy/create.c py/objarray.c py/objstr.c msgid "wrong number of arguments" msgstr "zła liczba argumentów" @@ -4638,10 +4336,6 @@ msgstr "x poza zakresem" msgid "xTaskCreate failed" msgstr "" -#: shared-bindings/displayio/Shape.c -msgid "y should be an int" -msgstr "y powinno być całkowite" - #: shared-module/displayio/Shape.c msgid "y value out of bounds" msgstr "y poza zakresem" @@ -4662,6 +4356,263 @@ msgstr "" msgid "zi must be of shape (n_section, 2)" msgstr "" +#~ msgid "Stream missing readinto() or write() method." +#~ msgstr "Strumień nie ma metod readinto() lub write()." + +#~ msgid "%q must be >= 0" +#~ msgstr "%q musi być >= 0" + +#~ msgid "%q must be >= 1" +#~ msgstr "%q musi być >= 1" + +#~ msgid "address out of bounds" +#~ msgstr "adres poza zakresem" + +#~ msgid "destination_length must be an int >= 0" +#~ msgstr "destination_length musi być nieujemną liczbą całkowitą" + +#~ msgid "color should be an int" +#~ msgstr "kolor powinien być liczbą całkowitą" + +#~ msgid "end_x should be an int" +#~ msgstr "end_x powinien być całkowity" + +#~ msgid "palette_index should be an int" +#~ msgstr "palette_index powinien być całkowity" + +#~ msgid "start_x should be an int" +#~ msgstr "start_x powinien być całkowity" + +#~ msgid "y should be an int" +#~ msgstr "y powinno być całkowite" + +#~ msgid "" +#~ "sample_source buffer must be a bytearray or array of type 'h', 'H', 'b' " +#~ "or 'B'" +#~ msgstr "" +#~ "bufor sample_source musi być bytearray lub tablicą typu 'h', 'H', 'b' lub " +#~ "'B'" + +#~ msgid "%q must be a tuple of length 2" +#~ msgstr "%q musi być krotką o długości 2" + +#~ msgid "%q should be an int" +#~ msgstr "%q powinno być typu int" + +#~ msgid "Address type out of range" +#~ msgstr "Typ adresu poza zakresem" + +#~ msgid "AnalogIn not supported on given pin" +#~ msgstr "AnalogIn nie jest obsługiwany na danym pinie" + +#~ msgid "AnalogOut functionality not supported" +#~ msgstr "AnalogOut jest niewspierane" + +#~ msgid "AnalogOut is only 16 bits. Value must be less than 65536." +#~ msgstr "AnalogOut ma 16 bitów. Wartość musi być mniejsza od 65536." + +#~ msgid "AnalogOut not supported on given pin" +#~ msgstr "AnalogOut niewspierany na tej nóżce" + +#, c-format +#~ msgid "Buffer incorrect size. Should be %d bytes." +#~ msgstr "Zła wielkość bufora. Powinno być %d bajtów." + +#~ msgid "Buffer must be at least length 1" +#~ msgstr "Bufor musi mieć długość 1 lub więcej" + +#~ msgid "Bytes must be between 0 and 255." +#~ msgstr "Bytes musi być między 0 a 255." + +#~ msgid "Cannot output both channels on the same pin" +#~ msgstr "Nie można mieć obu kanałów na tej samej nóżce" + +#~ msgid "Cannot read without MISO pin." +#~ msgstr "Nie można czytać bez nóżki MISO." + +#~ msgid "Cannot reset into bootloader because no bootloader is present." +#~ msgstr "Nie można zrestartować -- nie ma bootloadera." + +#~ msgid "Cannot transfer without MOSI and MISO pins." +#~ msgstr "Nie można przesyłać bez nóżek MOSI i MISO." + +#~ msgid "Cannot write without MOSI pin." +#~ msgstr "Nie można pisać bez nóżki MOSI." + +#~ msgid "Clock pin init failed." +#~ msgstr "Inicjalizacja nóżki zegara nie powiodła się." + +#~ msgid "Command must be an int between 0 and 255" +#~ msgstr "Komenda musi być int pomiędzy 0 a 255" + +#~ msgid "Could not initialize GNSS" +#~ msgstr "Nie można zainicjować GNSS" + +#~ msgid "Could not initialize SDCard" +#~ msgstr "Nie można zainicjować SDCard" + +#~ msgid "Could not initialize UART" +#~ msgstr "Ustawienie UART nie powiodło się" + +#~ msgid "Could not re-init channel" +#~ msgstr "Nie można ponownie zainicjować kanału" + +#~ msgid "Could not re-init timer" +#~ msgstr "Nie można ponownie zainicjować timera" + +#~ msgid "Could not restart PWM" +#~ msgstr "Nie można ponownie uruchomić PWM" + +#~ msgid "Couldn't allocate first buffer" +#~ msgstr "Nie udała się alokacja pierwszego bufora" + +#~ msgid "Couldn't allocate input buffer" +#~ msgstr "Nie można przydzielić bufora wejściowego" + +#~ msgid "Couldn't allocate second buffer" +#~ msgstr "Nie udała się alokacja drugiego bufora" + +#~ msgid "DigitalInOut not supported on given pin" +#~ msgstr "DigitalInOut nie jest obsługiwany na podanym pinie" + +#, c-format +#~ msgid "Expected tuple of length %d, got %d" +#~ msgstr "Oczekiwano krotkę długości %d, otrzymano %d" + +#~ msgid "Failed to allocate RX buffer" +#~ msgstr "Nie udała się alokacja bufora RX" + +#, c-format +#~ msgid "Failed to allocate RX buffer of %d bytes" +#~ msgstr "Nie udała się alokacja %d bajtów na bufor RX" + +#, c-format +#~ msgid "Framebuffer requires %d bytes" +#~ msgstr "Bufor ramki wymaga %d bajtów" + +#~ msgid "I2C Init Error" +#~ msgstr "Błąd inicjalizacji I2C" + +#~ msgid "Invalid BMP file" +#~ msgstr "Zły BMP" + +#~ msgid "Invalid PWM frequency" +#~ msgstr "Zła częstotliwość PWM" + +#~ msgid "Invalid buffer size" +#~ msgstr "Zła wielkość bufora" + +#~ msgid "Invalid capture period. Valid range: 1 - 500" +#~ msgstr "Zły okres. Poprawny zakres to: 1 - 500" + +#~ msgid "Invalid channel count" +#~ msgstr "Zła liczba kanałów" + +#~ msgid "Invalid direction." +#~ msgstr "Nieprawidłowy kierunek." + +#~ msgid "Invalid file" +#~ msgstr "Zły plik" + +#~ msgid "Invalid number of bits" +#~ msgstr "Zła liczba bitów" + +#~ msgid "Invalid phase" +#~ msgstr "Zła faza" + +#~ msgid "Invalid pin" +#~ msgstr "Zła nóżka" + +#~ msgid "Invalid pin for left channel" +#~ msgstr "Zła nóżka dla lewego kanału" + +#~ msgid "Invalid pin for right channel" +#~ msgstr "Zła nóżka dla prawego kanału" + +#~ msgid "Invalid polarity" +#~ msgstr "Zła polaryzacja" + +#~ msgid "Invalid properties" +#~ msgstr "Nieprawidłowe właściwości" + +#~ msgid "Invalid run mode." +#~ msgstr "Zły tryb uruchomienia." + +#~ msgid "Invalid security_mode" +#~ msgstr "Nieprawidłowy security_mode" + +#~ msgid "Invalid voice count" +#~ msgstr "Zła liczba głosów" + +#~ msgid "Invalid wave file" +#~ msgstr "Zły plik wave" + +#~ msgid "Invalid word/bit length" +#~ msgstr "Niepoprawna długość słowa/bitu" + +#~ msgid "Layer must be a Group or TileGrid subclass." +#~ msgstr "Layer musi dziedziczyć z Group albo TileGrid." + +#~ msgid "MISO pin init failed." +#~ msgstr "Nie powiodło się ustawienie pinu MISO." + +#~ msgid "MOSI pin init failed." +#~ msgstr "Nie powiodło się ustawienie pinu MOSI." + +#~ msgid "Messages limited to 8 bytes" +#~ msgstr "Wiadomości ograniczone do 8 bajtów" + +#~ msgid "No hardware support on pin" +#~ msgstr "Brak sprzętowej obsługi na nóżce" + +#~ msgid "" +#~ "PWM duty_cycle must be between 0 and 65535 inclusive (16 bit resolution)" +#~ msgstr "" +#~ "duty_cycle musi być pomiędzy 0 a 65535 włącznie (rozdzielczość 16 bit)" + +#~ msgid "Pin does not have ADC capabilities" +#~ msgstr "Nóżka nie obsługuje ADC" + +#~ msgid "RTC calibration is not supported on this board" +#~ msgstr "Brak obsługi kalibracji RTC" + +#~ msgid "SPI Init Error" +#~ msgstr "Błąd inicjowania SPI" + +#~ msgid "SPI Re-initialization error" +#~ msgstr "Błąd ponownej inicjalizacji SPI" + +#~ msgid "Sample rate must be positive" +#~ msgstr "Częstotliwość próbkowania musi być dodatnia" + +#, c-format +#~ msgid "Sample rate too high. It must be less than %d" +#~ msgstr "Zbyt wysoka częstotliwość próbkowania. Musi być mniejsza niż %d" + +#~ msgid "Stack size must be at least 256" +#~ msgstr "Stos musi mieć co najmniej 256 bajtów" + +#~ msgid "UART Buffer allocation error" +#~ msgstr "Błąd alokacji bufora UART" + +#~ msgid "UART write error" +#~ msgstr "Błąd zapisu UART" + +#~ msgid "Unsupported baudrate" +#~ msgstr "Zła szybkość transmisji" + +#~ msgid "bytes > 8 bits not supported" +#~ msgstr "bajty większe od 8 bitów są niewspierane" + +#~ msgid "calibration value out of range +/-127" +#~ msgstr "wartość kalibracji poza zakresem +/-127" + +#~ msgid "stop must be 1 or 2" +#~ msgstr "stop musi być 1 lub 2" + +#~ msgid "timeout must be >= 0.0" +#~ msgstr "timeout musi być >= 0.0" + #~ msgid "Unsupported operation" #~ msgstr "Zła operacja" @@ -4815,12 +4766,6 @@ msgstr "" #~ msgid "can only save bytecode" #~ msgstr "można zapisać tylko bytecode" -#~ msgid "invalid cert" -#~ msgstr "zły ceryfikat" - -#~ msgid "invalid key" -#~ msgstr "zły klucz" - #~ msgid "Viper functions don't currently support more than 4 arguments" #~ msgstr "Funkcje Viper nie obsługują obecnie więcej niż 4 argumentów" @@ -4907,9 +4852,6 @@ msgstr "" #~ msgid "wrong argument type" #~ msgstr "zły typ argumentu" -#~ msgid "wrong index type" -#~ msgstr "zły typ indeksu" - #~ msgid "Must provide SCK pin" #~ msgstr "Należy podać pin SCK" diff --git a/locale/pt_BR.po b/locale/pt_BR.po index e9cf974632..0db7637c32 100644 --- a/locale/pt_BR.po +++ b/locale/pt_BR.po @@ -6,7 +6,7 @@ msgstr "" "Project-Id-Version: PACKAGE VERSION\n" "Report-Msgid-Bugs-To: \n" "POT-Creation-Date: 2021-01-04 12:55-0600\n" -"PO-Revision-Date: 2022-05-14 12:35+0000\n" +"PO-Revision-Date: 2022-09-30 08:18+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.13-dev\n" +"X-Generator: Weblate 4.14.1\n" #: main.c msgid "" @@ -67,6 +67,11 @@ msgstr " saída:\n" msgid "%%c requires int or char" msgstr "%%c requer int ou char" +#: main.c +#, c-format +msgid "%02X" +msgstr "" + #: shared-bindings/rgbmatrix/RGBMatrix.c #, c-format msgid "" @@ -75,10 +80,27 @@ msgstr "" "%d pinos de endereço, %d pinos rgb e %d blocos indicam uma altura com %d, " "não %d" +#: ports/atmel-samd/common-hal/alarm/__init__.c +#: ports/cxd56/common-hal/analogio/AnalogOut.c ports/cxd56/common-hal/rtc/RTC.c +#: ports/espressif/common-hal/rtc/RTC.c +#: ports/mimxrt10xx/common-hal/analogio/AnalogOut.c +#: ports/mimxrt10xx/common-hal/rtc/RTC.c ports/nrf/common-hal/alarm/__init__.c +#: ports/nrf/common-hal/analogio/AnalogOut.c ports/nrf/common-hal/rtc/RTC.c +#: ports/raspberrypi/common-hal/alarm/__init__.c +#: ports/raspberrypi/common-hal/analogio/AnalogOut.c +#: ports/raspberrypi/common-hal/rtc/RTC.c ports/stm/common-hal/alarm/__init__.c +#: ports/stm/common-hal/rtc/RTC.c +msgid "%q" +msgstr "%q" + #: shared-bindings/microcontroller/Pin.c msgid "%q and %q contain duplicate pins" msgstr "%q e %q contêm pinos duplicados" +#: ports/atmel-samd/common-hal/audioio/AudioOut.c +msgid "%q and %q must be different" +msgstr "%q e %q devem ser diferentes" + #: shared-bindings/microcontroller/Pin.c msgid "%q contains duplicate pins" msgstr "%q contém pinos duplicados" @@ -87,16 +109,12 @@ msgstr "%q contém pinos duplicados" msgid "%q failure: %d" msgstr "%q falha: %d" +#: shared-bindings/digitalio/DigitalInOut.c #: shared-bindings/microcontroller/Pin.c msgid "%q in use" msgstr "%q em uso" -#: ports/atmel-samd/common-hal/pulseio/PulseIn.c -#: ports/cxd56/common-hal/pulseio/PulseIn.c -#: ports/nrf/common-hal/pulseio/PulseIn.c -#: ports/raspberrypi/common-hal/pulseio/PulseIn.c -#: ports/stm/common-hal/pulseio/PulseIn.c py/obj.c py/objstr.c -#: py/objstrunicode.c +#: py/obj.c py/objstr.c py/objstrunicode.c msgid "%q index out of range" msgstr "O índice %q está fora do intervalo" @@ -104,14 +122,34 @@ msgstr "O índice %q está fora do intervalo" msgid "%q indices must be integers, not %s" msgstr "Os índices %q devem ser inteiros, e não %s" +#: shared-module/bitbangio/SPI.c +msgid "%q init failed" +msgstr "a inicialização do %q falhou" + +#: py/argcheck.c +msgid "%q length must be %d" +msgstr "O comprimento de %q deve ser %d" + #: py/argcheck.c msgid "%q length must be %d-%d" msgstr "o comprimento %q deve ser %d-%d" -#: shared-bindings/busio/I2C.c shared-bindings/usb_hid/Device.c +#: py/argcheck.c +msgid "%q length must be <= %d" +msgstr "o comprimento de %q deve ser <= %d" + +#: py/argcheck.c +msgid "%q length must be >= %d" +msgstr "o comprimento de %q deve ser >= %d" + +#: shared-bindings/busio/I2C.c msgid "%q length must be >= 1" msgstr "o comprimento %q deve ser >=1" +#: py/argcheck.c +msgid "%q must be %d" +msgstr "%q deve ser %d" + #: py/argcheck.c msgid "%q must be %d-%d" msgstr "o %q deve ser %d-%d" @@ -128,30 +166,18 @@ msgstr "%q deve ser <= %d" msgid "%q must be >= %d" msgstr "o %q deve ser >= %d" -#: py/argcheck.c shared-bindings/memorymonitor/AllocationAlarm.c -msgid "%q must be >= 0" -msgstr "%q deve ser >= 0" - -#: shared-bindings/_bleio/CharacteristicBuffer.c -#: shared-bindings/_bleio/PacketBuffer.c shared-bindings/displayio/Group.c -#: shared-bindings/displayio/Shape.c -#: shared-bindings/memorymonitor/AllocationAlarm.c -#: shared-bindings/vectorio/Circle.c shared-bindings/vectorio/Rectangle.c -msgid "%q must be >= 1" -msgstr "%q deve ser >= 1" +#: shared-bindings/analogbufio/BufferedIn.c +#: shared-bindings/audiocore/RawSample.c +msgid "%q must be a bytearray or array of type 'h', 'H', 'b', or 'B'" +msgstr "%q deve ser um bytearray ou uma matriz do tipo 'h', 'H', 'b', ou 'B'" #: py/argcheck.c msgid "%q must be a string" msgstr "%q deve ser uma string" -#: shared-module/vectorio/Polygon.c -msgid "%q must be a tuple of length 2" -msgstr "%q deve ser uma tupla de comprimento 2" - -#: ports/espressif/common-hal/imagecapture/ParallelImageCapture.c -#: shared-module/vectorio/VectorShape.c -msgid "%q must be between %d and %d" -msgstr "%q deve estar entre %d e %d" +#: py/argcheck.c +msgid "%q must be an int" +msgstr "%q deve ser um inteiro" #: py/argcheck.c msgid "%q must be of type %q" @@ -169,7 +195,11 @@ msgstr "%q deve ser a potência de 2" msgid "%q out of bounds" msgstr "%q fora dos limites" +#: ports/atmel-samd/common-hal/pulseio/PulseIn.c +#: ports/cxd56/common-hal/pulseio/PulseIn.c +#: ports/nrf/common-hal/pulseio/PulseIn.c #: ports/raspberrypi/common-hal/rp2pio/StateMachine.c +#: ports/stm/common-hal/pulseio/PulseIn.c py/argcheck.c #: shared-bindings/canio/Match.c msgid "%q out of range" msgstr "%q fora do alcance" @@ -178,10 +208,6 @@ msgstr "%q fora do alcance" msgid "%q pin invalid" msgstr "%q pino inválido" -#: shared-bindings/fontio/BuiltinFont.c -msgid "%q should be an int" -msgstr "%q deve ser um int" - #: shared-bindings/usb_hid/Device.c msgid "%q with a report ID of 0 must be of length 1" msgstr "%q com um relatório com ID de 0 deve ter comprimento 1" @@ -194,7 +220,11 @@ msgstr "%q() recebe %d argumentos posicionais, porém %d foram informados" msgid "%q, %q, and %q must all be the same length" msgstr "todos os %q, %q, e %q devem ter mesmo comprimento" -#: ports/espressif/bindings/espidf/__init__.c ports/espressif/esp_error.c +#: py/objint.c +msgid "%q=%q" +msgstr "%q=%q" + +#: ports/espressif/common-hal/espidf/__init__.c ports/espressif/esp_error.c #, c-format msgid "%s error 0x%x" msgstr "%s erro 0x%x" @@ -279,7 +309,7 @@ msgstr "O objeto '%s' não suporta a atribuição dos itens" msgid "'%s' object doesn't support item deletion" msgstr "O objeto '%s' não é compatível com exclusão do item" -#: py/runtime.c +#: ports/raspberrypi/common-hal/wifi/Radio.c py/runtime.c msgid "'%s' object has no attribute '%q'" msgstr "O objeto '%s' não possui o atributo '%q'" @@ -348,10 +378,6 @@ msgstr "'yield a partir' de dentro da função async" msgid "'yield' outside function" msgstr "função externa 'yield'" -#: shared-module/vectorio/VectorShape.c -msgid "(x,y) integers required" -msgstr "(x,y) é obrigatório o uso de números inteiros" - #: py/compile.c msgid "*x must be assignment target" msgstr "*x deve ser o destino da atribuição" @@ -387,16 +413,12 @@ msgstr "O ADC2 está sendo usado pelo WiFi" msgid "Address must be %d bytes long" msgstr "O endereço deve ter %d bytes de comprimento" -#: shared-bindings/_bleio/Address.c -msgid "Address type out of range" -msgstr "O tipo do endereço está fora do alcance" - #: ports/espressif/common-hal/canio/CAN.c msgid "All CAN peripherals are in use" msgstr "Todos os periféricos CAN estão em uso" #: ports/espressif/common-hal/busio/I2C.c -#: ports/espressif/common-hal/i2cperipheral/I2CPeripheral.c +#: ports/espressif/common-hal/i2ctarget/I2CTarget.c #: ports/nrf/common-hal/busio/I2C.c msgid "All I2C peripherals are in use" msgstr "Todos os periféricos I2C estão em uso" @@ -433,7 +455,6 @@ msgstr "Todos os canais estão em uso" msgid "All event channels in use" msgstr "Todos os canais de eventos em uso" -#: ports/raspberrypi/common-hal/pulseio/PulseIn.c #: ports/raspberrypi/common-hal/rp2pio/StateMachine.c msgid "All state machines in use" msgstr "O estado de todas as máquinas em uso" @@ -478,28 +499,10 @@ msgid "Already running" msgstr "Já está em execução" #: ports/espressif/common-hal/wifi/Radio.c +#: ports/raspberrypi/common-hal/wifi/Radio.c msgid "Already scanning for wifi networks" msgstr "Já está em busca das redes de wifi" -#: ports/cxd56/common-hal/analogio/AnalogIn.c -msgid "AnalogIn not supported on given pin" -msgstr "O AnalogIn não é compatível no pino informado" - -#: ports/cxd56/common-hal/analogio/AnalogOut.c -#: ports/mimxrt10xx/common-hal/analogio/AnalogOut.c -#: ports/nrf/common-hal/analogio/AnalogOut.c -#: ports/raspberrypi/common-hal/analogio/AnalogOut.c -msgid "AnalogOut functionality not supported" -msgstr "Funcionalidade AnalogOut não suportada" - -#: shared-bindings/analogio/AnalogOut.c -msgid "AnalogOut is only 16 bits. Value must be less than 65536." -msgstr "O AnalogOut é de apenas 16 bits. O valor deve ser menor que 65536." - -#: ports/atmel-samd/common-hal/analogio/AnalogOut.c -msgid "AnalogOut not supported on given pin" -msgstr "Saída analógica não suportada no pino fornecido" - #: ports/stm/common-hal/audiopwmio/PWMAudioOut.c msgid "Another PWMAudioOut is already active" msgstr "Um outro PWMAudioOut já está ativo" @@ -539,7 +542,7 @@ msgstr "A conversão de áudio ainda não foi implementada" msgid "AuthMode.OPEN is not used with password" msgstr "O AuthMode.OPEN não é usado com senha" -#: shared-bindings/wifi/Radio.c +#: shared-bindings/wifi/Radio.c supervisor/shared/web_workflow/web_workflow.c msgid "Authentication failure" msgstr "Houve um falha na autenticação" @@ -574,11 +577,6 @@ 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 "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." msgstr "A profundidade de bits deve ser o múltiplo de 8." @@ -622,11 +620,6 @@ msgstr "O buffer + desvio é muito pequeno %d %d %d" msgid "Buffer elements must be 4 bytes long or less" msgstr "Os elementos do buffer devem ter 4 bytes de comprimento ou menos" -#: shared-module/usb_hid/Device.c -#, c-format -msgid "Buffer incorrect size. Should be %d bytes." -msgstr "Buffer de tamanho incorreto. Deve ser %d bytes." - #: shared-bindings/framebufferio/FramebufferDisplay.c msgid "Buffer is not a bytearray." msgstr "O buffer não é um bytearray." @@ -636,7 +629,6 @@ msgstr "O buffer não é um bytearray." msgid "Buffer is too small" msgstr "O buffer é muito pequeno" -#: ports/nrf/common-hal/audiopwmio/PWMAudioOut.c #: ports/stm/common-hal/audiopwmio/PWMAudioOut.c #, c-format msgid "Buffer length %d too big. It must be less than %d" @@ -651,10 +643,6 @@ msgstr "O comprimento do Buffer deve ser um múltiplo de 512" msgid "Buffer must be a multiple of 512 bytes" msgstr "O buffer deve ser um múltiplo de 512 bytes" -#: shared-bindings/bitbangio/I2C.c -msgid "Buffer must be at least length 1" -msgstr "O comprimento do buffer deve ter pelo menos 1" - #: shared-bindings/_bleio/PacketBuffer.c #, c-format msgid "Buffer too short by %d bytes" @@ -676,10 +664,6 @@ msgstr "O pino bus %d já está em uso" msgid "Byte buffer must be 16 bytes." msgstr "O buffer deve ter 16 bytes." -#: shared-bindings/alarm/SleepMemory.c shared-bindings/nvm/ByteArray.c -msgid "Bytes must be between 0 and 255." -msgstr "Os bytes devem estar entre 0 e 255." - #: shared-bindings/aesio/aes.c msgid "CBC blocks must be multiples of 16 bytes" msgstr "Os blocos CBC devem ter múltiplos de 16 bytes" @@ -688,7 +672,7 @@ msgstr "Os blocos CBC devem ter múltiplos de 16 bytes" msgid "CIRCUITPY drive could not be found or created." msgstr "A unidade CIRCUITPY não pôde ser encontrada nem criada." -#: ports/espressif/bindings/espidf/__init__.c ports/espressif/esp_error.c +#: ports/espressif/common-hal/espidf/__init__.c ports/espressif/esp_error.c msgid "CRC or checksum was invalid" msgstr "CRC ou checksum inválido" @@ -696,6 +680,10 @@ msgstr "CRC ou checksum inválido" msgid "Call super().__init__() before accessing native object." msgstr "Chame super().__init__() antes de acessar o objeto nativo." +#: ports/cxd56/common-hal/camera/Camera.c +msgid "Camera init" +msgstr "Inicialização da câmera" + #: ports/espressif/common-hal/alarm/pin/PinAlarm.c msgid "Can only alarm on RTC IO from deep sleep." msgstr "O alarme só pode acontecer no RTC IO a partir do deep sleep." @@ -748,18 +736,10 @@ msgstr "" "Não é possível ter respostas da verificação para os anúncios estendidos e " "conectáveis." -#: ports/atmel-samd/common-hal/audioio/AudioOut.c -msgid "Cannot output both channels on the same pin" -msgstr "Não é possível emitir os dois canais no mesmo pino" - #: ports/espressif/common-hal/alarm/pin/PinAlarm.c msgid "Cannot pull on input-only pin." msgstr "Não é possível obter (pull) nos pinos somente de entrada." -#: shared-module/bitbangio/SPI.c -msgid "Cannot read without MISO pin." -msgstr "Não é possível ler sem o pino MISO." - #: shared-bindings/audiobusio/PDMIn.c msgid "Cannot record to a file" msgstr "Não é possível gravar em um arquivo" @@ -771,9 +751,9 @@ msgstr "Não é possível montar '/' quando estiver visível pelo USB." #: ports/atmel-samd/common-hal/microcontroller/__init__.c #: ports/cxd56/common-hal/microcontroller/__init__.c #: ports/mimxrt10xx/common-hal/microcontroller/__init__.c -msgid "Cannot reset into bootloader because no bootloader is present." +msgid "Cannot reset into bootloader because no bootloader is present" msgstr "" -"Não é possível redefinir para o bootloader porque o mesmo não está presente." +"Não é possível redefinir no bootloader pois nenhum bootloader está presente" #: ports/espressif/common-hal/socketpool/Socket.c msgid "Cannot set socket options" @@ -793,22 +773,21 @@ msgid "Cannot subclass slice" msgstr "Não é possível subclassificar a fatia" #: shared-module/bitbangio/SPI.c -msgid "Cannot transfer without MOSI and MISO pins." -msgstr "Não é possível transferir sem os pinos MOSI e MISO." +msgid "Cannot transfer without MOSI and MISO pins" +msgstr "Não é possível transferir sem os pinos MOSI e MISO" #: shared-bindings/pwmio/PWMOut.c msgid "Cannot vary frequency on a timer that is already in use" msgstr "Não é possível variar a frequência em um timer que já esteja em uso" -#: ports/espressif/common-hal/alarm/pin/PinAlarm.c #: ports/nrf/common-hal/alarm/pin/PinAlarm.c +msgid "Cannot wake on pin edge, only level" +msgstr "Não é possível acordar na borda do pino, nível apenas" + +#: ports/espressif/common-hal/alarm/pin/PinAlarm.c msgid "Cannot wake on pin edge. Only level." msgstr "Não é possível acordar (wake) no pino edge. Nível apenas." -#: shared-module/bitbangio/SPI.c -msgid "Cannot write without MOSI pin." -msgstr "Não é possível fazer a escrita sem um pino MOSI." - #: shared-bindings/_bleio/CharacteristicBuffer.c msgid "CharacteristicBuffer writing not provided" msgstr "Escrita CharacteristicBuffer não informada" @@ -821,10 +800,6 @@ msgstr "O núcleo principal do CircuitPython falhou feio. Ops!\n" msgid "CircuitPython was unable to allocate the heap." msgstr "O CircuitPython não conseguiu alocar o heap." -#: shared-module/bitbangio/SPI.c -msgid "Clock pin init failed." -msgstr "Inicialização do pino de Clock falhou." - #: shared-module/bitbangio/I2C.c msgid "Clock stretch too long" msgstr "Clock se estendeu por tempo demais" @@ -833,11 +808,6 @@ msgstr "Clock se estendeu por tempo demais" msgid "Clock unit in use" msgstr "Unidade de Clock em uso" -#: shared-bindings/displayio/FourWire.c shared-bindings/displayio/I2CDisplay.c -#: shared-bindings/paralleldisplay/ParallelBus.c -msgid "Command must be an int between 0 and 255" -msgstr "O comando deve ser um int entre 0 e 255" - #: shared-bindings/_bleio/Connection.c msgid "" "Connection has been disconnected and can no longer be used. Create a new " @@ -849,35 +819,6 @@ msgstr "" msgid "Corrupt .mpy file" msgstr "Arquivo .mpy corrompido" -#: ports/cxd56/common-hal/camera/Camera.c -msgid "Could not initialize Camera" -msgstr "Não foi possível inicializar a Câmera" - -#: ports/cxd56/common-hal/gnss/GNSS.c -msgid "Could not initialize GNSS" -msgstr "Não foi possível inicializar o GNSS" - -#: ports/cxd56/common-hal/sdioio/SDCard.c -msgid "Could not initialize SDCard" -msgstr "Não foi possível inicializar o SDCard" - -#: ports/atmel-samd/common-hal/busio/UART.c ports/cxd56/common-hal/busio/UART.c -#: ports/espressif/common-hal/busio/UART.c -msgid "Could not initialize UART" -msgstr "Não foi possível inicializar o UART" - -#: ports/stm/common-hal/pwmio/PWMOut.c -msgid "Could not re-init channel" -msgstr "Não foi possível reiniciar o canal" - -#: ports/stm/common-hal/pwmio/PWMOut.c -msgid "Could not re-init timer" -msgstr "Não foi possível reiniciar o temporizador" - -#: ports/stm/common-hal/pwmio/PWMOut.c -msgid "Could not restart PWM" -msgstr "Não foi possível reiniciar o PWM" - #: ports/espressif/common-hal/neopixel_write/__init__.c msgid "Could not retrieve clock" msgstr "Não foi possível recuperar o clock" @@ -898,20 +839,6 @@ msgstr "Não foi possível iniciar a interrupção, RX ocupado" msgid "Couldn't allocate decoder" msgstr "Não foi possível alocar o decodificador" -#: shared-module/audiocore/WaveFile.c shared-module/audiomixer/Mixer.c -#: shared-module/audiomp3/MP3Decoder.c -msgid "Couldn't allocate first buffer" -msgstr "Não pôde alocar primeiro buffer" - -#: shared-module/audiomp3/MP3Decoder.c -msgid "Couldn't allocate input buffer" -msgstr "Não foi possível alocar o buffer de entrada" - -#: shared-module/audiocore/WaveFile.c shared-module/audiomixer/Mixer.c -#: shared-module/audiomp3/MP3Decoder.c -msgid "Couldn't allocate second buffer" -msgstr "Não pôde alocar segundo buffer" - #: supervisor/shared/safe_mode.c msgid "Crash into the HardFault_Handler." msgstr "Falha no HardFault_Handler." @@ -959,10 +886,6 @@ msgstr "A capacidade do destino é menor que destination_length." msgid "Device in use" msgstr "Dispositivo em uso" -#: ports/cxd56/common-hal/digitalio/DigitalInOut.c -msgid "DigitalInOut not supported on given pin" -msgstr "O DigitalInOut não é compatível em um determinado pino" - #: shared-bindings/displayio/Display.c #: shared-bindings/framebufferio/FramebufferDisplay.c msgid "Display must have a 16 bit colorspace." @@ -974,6 +897,10 @@ msgstr "O monitor deve ter um espaço de cores com 16 bits." msgid "Display rotation must be in 90 degree increments" msgstr "A rotação da tela deve estar em incrementos de 90 graus" +#: main.c +msgid "Done" +msgstr "Feito" + #: shared-bindings/digitalio/DigitalInOut.c msgid "Drive mode not used when direction is input." msgstr "O modo do controlador não é usado quando a direção for inserida." @@ -1007,21 +934,20 @@ msgstr "Erro no regex" msgid "Error: Failure to bind" msgstr "Erro: Falha na vinculação" -#: ports/raspberrypi/bindings/rp2pio/StateMachine.c py/enum.c -#: shared-bindings/_bleio/__init__.c shared-bindings/aesio/aes.c -#: shared-bindings/busio/SPI.c shared-bindings/microcontroller/Pin.c +#: py/enum.c shared-bindings/_bleio/__init__.c shared-bindings/aesio/aes.c +#: shared-bindings/alarm/__init__.c shared-bindings/busio/SPI.c +#: shared-bindings/microcontroller/Pin.c #: shared-bindings/neopixel_write/__init__.c msgid "Expected a %q" msgstr "Esperado um" -#: shared-bindings/alarm/__init__.c -msgid "Expected an alarm" -msgstr "Um alarme era esperado" +#: ports/raspberrypi/bindings/cyw43/__init__.c +msgid "Expected a %q or %q" +msgstr "Era esperado um %q ou %q" -#: shared-module/adafruit_pixelbuf/PixelBuf.c -#, c-format -msgid "Expected tuple of length %d, got %d" -msgstr "Tupla esperada com comprimento %d, obteve %d" +#: shared-bindings/alarm/__init__.c +msgid "Expected an %q" +msgstr "Esperava-se um(a) %q" #: ports/espressif/common-hal/_bleio/Adapter.c #: ports/nrf/common-hal/_bleio/Adapter.c @@ -1049,21 +975,9 @@ msgstr "Falha ao enviar comando." msgid "Failed to acquire mutex, err 0x%04x" msgstr "Houve uma falha na aquisição do mutex, err 0x%04x" -#: ports/mimxrt10xx/common-hal/busio/UART.c ports/nrf/common-hal/busio/UART.c -#: ports/raspberrypi/common-hal/busio/UART.c -msgid "Failed to allocate RX buffer" -msgstr "Falha ao alocar buffer RX" - -#: ports/atmel-samd/common-hal/busio/UART.c -#: ports/atmel-samd/common-hal/pulseio/PulseIn.c -#: ports/cxd56/common-hal/pulseio/PulseIn.c -#: ports/espressif/common-hal/pulseio/PulseIn.c -#: ports/nrf/common-hal/pulseio/PulseIn.c -#: ports/raspberrypi/common-hal/pulseio/PulseIn.c -#: ports/stm/common-hal/pulseio/PulseIn.c -#, c-format -msgid "Failed to allocate RX buffer of %d bytes" -msgstr "Falha ao alocar buffer RX de %d bytes" +#: shared-module/rgbmatrix/RGBMatrix.c +msgid "Failed to allocate %q buffer" +msgstr "Houve uma falha ao alocar o buffer %q" #: ports/espressif/common-hal/wifi/__init__.c msgid "Failed to allocate Wifi memory" @@ -1086,10 +1000,6 @@ msgstr "Falha ao conectar: erro interno" msgid "Failed to connect: timeout" msgstr "Falha ao conectar: tempo limite" -#: ports/espressif/common-hal/wifi/__init__.c -msgid "Failed to init wifi" -msgstr "Houve uma falha ao iniciar o wifi" - #: shared-module/audiomp3/MP3Decoder.c msgid "Failed to parse MP3 file" msgstr "Falha ao analisar o arquivo MP3" @@ -1134,11 +1044,6 @@ msgstr "" msgid "Format not supported" msgstr "O formato não é suportado" -#: shared-module/framebufferio/FramebufferDisplay.c -#, c-format -msgid "Framebuffer requires %d bytes" -msgstr "O Framebuffer requer %d bytes" - #: ports/mimxrt10xx/common-hal/microcontroller/Processor.c msgid "" "Frequency must be 24, 150, 396, 450, 528, 600, 720, 816, 912, 960 or 1008 Mhz" @@ -1156,7 +1061,11 @@ msgstr "" msgid "Function requires lock" msgstr "A função requer bloqueio" -#: ports/espressif/bindings/espidf/__init__.c ports/espressif/esp_error.c +#: ports/cxd56/common-hal/gnss/GNSS.c +msgid "GNSS init" +msgstr "Inicialização do GNSS" + +#: ports/espressif/common-hal/espidf/__init__.c ports/espressif/esp_error.c msgid "Generic Failure" msgstr "Falha Genérica" @@ -1183,19 +1092,16 @@ msgstr "O hardware está ocupado, tente os pinos alternativos" msgid "Hardware in use, try alternative pins" msgstr "O hardware está em uso, tente os pinos alternativos" -#: shared-bindings/wifi/Radio.c -msgid "Hostname must be between 1 and 253 characters" -msgstr "O nome do host deve ter entre 1 e 253 caracteres" - #: extmod/vfs_posix_file.c py/objstringio.c msgid "I/O operation on closed file" msgstr "Operação I/O no arquivo fechado" #: ports/stm/common-hal/busio/I2C.c -msgid "I2C Init Error" +msgid "I2C init error" msgstr "Erro de inicialização do I2C" #: ports/raspberrypi/common-hal/busio/I2C.c +#: ports/raspberrypi/common-hal/i2ctarget/I2CTarget.c msgid "I2C peripheral in use" msgstr "Periférico I2C em uso" @@ -1308,75 +1214,37 @@ msgstr "Erro interno" msgid "Internal error #%d" msgstr "Erro interno #%d" -#: shared-bindings/sdioio/SDCard.c shared-module/usb_hid/Device.c +#: supervisor/shared/safe_mode.c +msgid "Internal watchdog timer expired." +msgstr "O temporizador do watchdog interno expirou." + +#: py/argcheck.c shared-bindings/digitalio/DigitalInOut.c msgid "Invalid %q" msgstr "%q Inválido" -#: ports/atmel-samd/common-hal/audiobusio/I2SOut.c -#: ports/atmel-samd/common-hal/audiobusio/PDMIn.c -#: ports/atmel-samd/common-hal/imagecapture/ParallelImageCapture.c -#: ports/mimxrt10xx/common-hal/busio/UART.c +#: shared-bindings/microcontroller/Pin.c msgid "Invalid %q pin" msgstr "Pino do %q inválido" -#: ports/stm/common-hal/busio/I2C.c ports/stm/common-hal/busio/SPI.c -#: ports/stm/common-hal/busio/UART.c ports/stm/common-hal/canio/CAN.c -#: ports/stm/common-hal/sdioio/SDCard.c -msgid "Invalid %q pin selection" -msgstr "Seleção inválida dos pinos %q" - #: ports/stm/common-hal/analogio/AnalogIn.c msgid "Invalid ADC Unit value" msgstr "Valor inválido da unidade ADC" -#: ports/espressif/common-hal/wifi/Radio.c -msgid "Invalid AuthMode" -msgstr "AuthMode inválido" - #: ports/espressif/common-hal/_bleio/__init__.c #: ports/nrf/common-hal/_bleio/__init__.c msgid "Invalid BLE parameter" msgstr "Parâmetro BLE inválido" -#: shared-module/displayio/OnDiskBitmap.c -msgid "Invalid BMP file" -msgstr "Arquivo BMP inválido" - #: shared-bindings/wifi/Radio.c msgid "Invalid BSSID" msgstr "BSSID Inválido" -#: ports/espressif/common-hal/analogio/AnalogOut.c -#: ports/stm/common-hal/analogio/AnalogOut.c -msgid "Invalid DAC pin supplied" -msgstr "O pino DAC informado é inválido" - #: shared-bindings/wifi/Radio.c msgid "Invalid MAC address" msgstr "Endereço MAC inválido" -#: shared-bindings/synthio/__init__.c -msgid "Invalid MIDI file" -msgstr "O arquivo MIDI é inválido" - -#: ports/atmel-samd/common-hal/pwmio/PWMOut.c -#: ports/cxd56/common-hal/pwmio/PWMOut.c -#: ports/espressif/common-hal/pwmio/PWMOut.c -#: ports/mimxrt10xx/common-hal/pwmio/PWMOut.c -#: ports/nrf/common-hal/pwmio/PWMOut.c -#: ports/raspberrypi/common-hal/pwmio/PWMOut.c shared-bindings/pwmio/PWMOut.c -msgid "Invalid PWM frequency" -msgstr "Frequência PWM inválida" - -#: ports/espressif/common-hal/analogio/AnalogIn.c -msgid "Invalid Pin" -msgstr "Pino inválido" - -#: ports/espressif/bindings/espidf/__init__.c -#: ports/espressif/common-hal/busio/I2C.c -#: ports/espressif/common-hal/i2cperipheral/I2CPeripheral.c -#: ports/espressif/esp_error.c py/moduerrno.c -#: shared-module/rgbmatrix/RGBMatrix.c +#: ports/espressif/common-hal/espidf/__init__.c ports/espressif/esp_error.c +#: py/moduerrno.c msgid "Invalid argument" msgstr "Argumento inválido" @@ -1384,42 +1252,11 @@ msgstr "Argumento inválido" msgid "Invalid bits per value" msgstr "Os valores por bits são inválidos" -#: ports/nrf/common-hal/busio/UART.c ports/raspberrypi/common-hal/busio/UART.c -#: ports/stm/common-hal/busio/UART.c -msgid "Invalid buffer size" -msgstr "O tamanho do buffer é inválido" - -#: shared-bindings/adafruit_pixelbuf/PixelBuf.c -msgid "Invalid byteorder string" -msgstr "A cadeia de bytes é inválida" - -#: ports/atmel-samd/common-hal/frequencyio/FrequencyIn.c -#: ports/espressif/common-hal/frequencyio/FrequencyIn.c -msgid "Invalid capture period. Valid range: 1 - 500" -msgstr "O período de captura é inválido. O intervalo válido é: 1 - 500" - -#: shared-bindings/audiomixer/Mixer.c -msgid "Invalid channel count" -msgstr "A contagem do canal é inválido" - -#: ports/atmel-samd/common-hal/imagecapture/ParallelImageCapture.c -#, c-format -msgid "Invalid data_count %d" -msgstr "data_count %d inválido" - #: ports/atmel-samd/common-hal/imagecapture/ParallelImageCapture.c #, c-format msgid "Invalid data_pins[%d]" msgstr "data_pins[%d] inválido" -#: shared-bindings/digitalio/DigitalInOut.c -msgid "Invalid direction." -msgstr "Direção inválida." - -#: shared-module/audiocore/WaveFile.c -msgid "Invalid file" -msgstr "Arquivo inválido" - #: shared-module/audiocore/WaveFile.c msgid "Invalid format chunk size" msgstr "Tamanho do pedaço de formato inválido" @@ -1428,107 +1265,27 @@ msgstr "Tamanho do pedaço de formato inválido" msgid "Invalid memory access." msgstr "O acesso da memória é inválido." -#: extmod/vfs_fat_file.c -msgid "Invalid mode" -msgstr "Modo inválido" - #: ports/espressif/common-hal/wifi/Radio.c msgid "Invalid multicast MAC address" msgstr "Endereço MAC multicast inválido" -#: shared-bindings/bitbangio/SPI.c shared-bindings/busio/SPI.c -msgid "Invalid number of bits" -msgstr "Número inválido de bits" - -#: shared-bindings/bitbangio/SPI.c shared-bindings/busio/SPI.c -#: shared-bindings/displayio/FourWire.c -msgid "Invalid phase" -msgstr "Fase Inválida" - -#: ports/atmel-samd/common-hal/audioio/AudioOut.c -#: ports/atmel-samd/common-hal/touchio/TouchIn.c -#: ports/espressif/common-hal/alarm/touch/TouchAlarm.c -#: ports/espressif/common-hal/touchio/TouchIn.c -#: ports/nrf/common-hal/alarm/pin/PinAlarm.c shared-bindings/pwmio/PWMOut.c -#: shared-module/rgbmatrix/RGBMatrix.c -msgid "Invalid pin" -msgstr "Pino inválido" - -#: ports/atmel-samd/common-hal/audioio/AudioOut.c -msgid "Invalid pin for left channel" -msgstr "Pino inválido para canal esquerdo" - -#: ports/atmel-samd/common-hal/audioio/AudioOut.c -msgid "Invalid pin for right channel" -msgstr "Pino inválido para canal direito" - -#: ports/atmel-samd/common-hal/busio/I2C.c -#: ports/atmel-samd/common-hal/busio/SPI.c -#: ports/atmel-samd/common-hal/busio/UART.c -#: ports/atmel-samd/common-hal/i2cperipheral/I2CPeripheral.c -#: ports/cxd56/common-hal/busio/I2C.c ports/cxd56/common-hal/busio/SPI.c -#: ports/cxd56/common-hal/busio/UART.c ports/cxd56/common-hal/sdioio/SDCard.c -#: ports/espressif/common-hal/busio/I2C.c -#: ports/espressif/common-hal/busio/SPI.c -#: ports/espressif/common-hal/busio/UART.c -#: ports/espressif/common-hal/canio/CAN.c -#: ports/espressif/common-hal/i2cperipheral/I2CPeripheral.c -#: ports/mimxrt10xx/common-hal/busio/I2C.c -#: ports/mimxrt10xx/common-hal/busio/SPI.c -#: ports/mimxrt10xx/common-hal/usb_host/Port.c ports/nrf/common-hal/busio/I2C.c -#: ports/raspberrypi/common-hal/busio/I2C.c -#: ports/raspberrypi/common-hal/busio/SPI.c -#: ports/raspberrypi/common-hal/busio/UART.c shared-bindings/busio/SPI.c #: shared-bindings/busio/UART.c msgid "Invalid pins" msgstr "Pinos inválidos" -#: shared-bindings/bitbangio/SPI.c shared-bindings/busio/SPI.c -#: shared-bindings/displayio/FourWire.c -msgid "Invalid polarity" -msgstr "Polaridade inválida" - -#: shared-bindings/_bleio/Characteristic.c -msgid "Invalid properties" -msgstr "Propriedades inválidas" - -#: shared-bindings/microcontroller/__init__.c -msgid "Invalid run mode." -msgstr "O modo de execução é inválido." - -#: shared-module/_bleio/Attribute.c -msgid "Invalid security_mode" -msgstr "O Security_mode é inválido" - -#: ports/espressif/bindings/espidf/__init__.c ports/espressif/esp_error.c +#: ports/espressif/common-hal/espidf/__init__.c ports/espressif/esp_error.c msgid "Invalid size" msgstr "Tamanho inválido" #: ports/espressif/common-hal/ssl/SSLContext.c +#: ports/raspberrypi/common-hal/ssl/SSLSocket.c msgid "Invalid socket for TLS" msgstr "Soquete inválido para o TLS" -#: ports/espressif/bindings/espidf/__init__.c ports/espressif/esp_error.c +#: ports/espressif/common-hal/espidf/__init__.c ports/espressif/esp_error.c msgid "Invalid state" msgstr "Estado inválido" -#: shared-bindings/audiomixer/Mixer.c -msgid "Invalid voice" -msgstr "A voz é inválida" - -#: shared-bindings/audiomixer/Mixer.c -msgid "Invalid voice count" -msgstr "A contagem da voz é inválida" - -#: shared-module/audiocore/WaveFile.c -msgid "Invalid wave file" -msgstr "Aqruivo de ondas inválido" - -#: ports/mimxrt10xx/common-hal/busio/UART.c ports/nrf/common-hal/busio/UART.c -#: ports/raspberrypi/common-hal/busio/UART.c ports/stm/common-hal/busio/UART.c -msgid "Invalid word/bit length" -msgstr "O comprimento do bit/palavra são inválidos" - #: shared-bindings/aesio/aes.c msgid "Key must be 16, 24, or 32 bytes long" msgstr "A chave deve ter 16, 24 ou 32 bytes de comprimento" @@ -1542,25 +1299,17 @@ msgid "LHS of keyword arg must be an id" msgstr "O LHS da palavra-chave arg deve ser um ID" #: shared-module/displayio/Group.c -msgid "Layer already in a group." -msgstr "A camada já existe em um grupo." +msgid "Layer already in a group" +msgstr "Camada já está num grupo" #: shared-module/displayio/Group.c -msgid "Layer must be a Group or TileGrid subclass." -msgstr "A camada deve ser uma subclasse Group ou TileGrid." +msgid "Layer must be a Group or TileGrid subclass" +msgstr "A camada deve ser uma subclasse Group ou TileGrid" -#: ports/espressif/bindings/espidf/__init__.c ports/espressif/esp_error.c +#: ports/espressif/common-hal/espidf/__init__.c ports/espressif/esp_error.c msgid "MAC address was invalid" msgstr "Endereço MAC inválido" -#: shared-module/bitbangio/SPI.c -msgid "MISO pin init failed." -msgstr "A inicialização do pino MISO falhou." - -#: shared-module/bitbangio/SPI.c -msgid "MOSI pin init failed." -msgstr "Inicialização do pino MOSI falhou." - #: shared-bindings/is31fl3741/IS31FL3741.c msgid "Mapping must be a tuple" msgstr "O mapeamento deve ser uma tupla" @@ -1570,10 +1319,6 @@ msgstr "O mapeamento deve ser uma tupla" msgid "Maximum x value when mirrored is %d" msgstr "O valor máximo de x quando espelhado é %d" -#: shared-bindings/canio/Message.c -msgid "Messages limited to 8 bytes" -msgstr "As mensagens estão limitadas a 8 bytes" - #: shared-bindings/audiobusio/PDMIn.c msgid "Microphone startup delay must be in range 0.0 to 1.0" msgstr "O atraso na inicialização do microfone deve estar entre 0,0 e 1,0" @@ -1587,10 +1332,14 @@ msgstr "O tamanho dos dados é incompatível" msgid "Mismatched swap flag" msgstr "Sinalizador de troca incompatível" -#: ports/mimxrt10xx/common-hal/busio/SPI.c ports/stm/common-hal/busio/SPI.c +#: ports/mimxrt10xx/common-hal/busio/SPI.c msgid "Missing MISO or MOSI Pin" msgstr "O pino MISO ou MOSI está ausente" +#: ports/stm/common-hal/busio/SPI.c +msgid "Missing MISO or MOSI pin" +msgstr "Falta o pino MISO ou o MOSI" + #: ports/raspberrypi/common-hal/rp2pio/StateMachine.c #, c-format msgid "Missing first_in_pin. Instruction %d reads pin(s)" @@ -1626,11 +1375,6 @@ msgstr "Faltando first_set_pin. A instrução %d define os pinos(s)" msgid "Missing jmp_pin. Instruction %d jumps on pin" msgstr "Falta o jmp_pin. A instrução %d salta no pino" -#: shared-module/usb_hid/Device.c -#, c-format -msgid "More than %d report ids not supported" -msgstr "Mais de %d reportam ids não compatíveis" - #: shared-bindings/busio/UART.c shared-bindings/displayio/Group.c msgid "Must be a %q subclass." msgstr "Deve ser uma subclasse %q." @@ -1690,16 +1434,28 @@ msgstr "Nenhum temporizador DMA foi encontrado" msgid "No I2C device at address: 0x%x" msgstr "Não há nenhum dispositivo I2C no endereço: 0x%x" +#: supervisor/shared/web_workflow/web_workflow.c +msgid "No IP" +msgstr "Sem IP" + #: ports/espressif/common-hal/busio/SPI.c -#: ports/mimxrt10xx/common-hal/busio/SPI.c ports/stm/common-hal/busio/SPI.c +#: ports/mimxrt10xx/common-hal/busio/SPI.c msgid "No MISO Pin" msgstr "Nenhum pino MISO" +#: ports/stm/common-hal/busio/SPI.c shared-module/bitbangio/SPI.c +msgid "No MISO pin" +msgstr "Nenhum pino MISO" + #: ports/espressif/common-hal/busio/SPI.c -#: ports/mimxrt10xx/common-hal/busio/SPI.c ports/stm/common-hal/busio/SPI.c +#: ports/mimxrt10xx/common-hal/busio/SPI.c msgid "No MOSI Pin" msgstr "Nenhum pino MOSI" +#: ports/stm/common-hal/busio/SPI.c shared-module/bitbangio/SPI.c +msgid "No MOSI pin" +msgstr "Nenhum pino MOSI" + #: ports/atmel-samd/common-hal/busio/UART.c #: ports/espressif/common-hal/busio/UART.c #: ports/mimxrt10xx/common-hal/busio/UART.c ports/nrf/common-hal/busio/UART.c @@ -1738,16 +1494,6 @@ msgstr "Não há GCLKs livre" msgid "No hardware random available" msgstr "Nenhum hardware aleatório está disponível" -#: ports/atmel-samd/common-hal/ps2io/Ps2.c -msgid "No hardware support on clk pin" -msgstr "Sem suporte de hardware no pino de clock" - -#: ports/atmel-samd/common-hal/alarm/pin/PinAlarm.c -#: ports/atmel-samd/common-hal/frequencyio/FrequencyIn.c -#: ports/atmel-samd/common-hal/pulseio/PulseIn.c -msgid "No hardware support on pin" -msgstr "Nenhum suporte de hardware no pino" - #: ports/raspberrypi/common-hal/rp2pio/StateMachine.c msgid "No in in program" msgstr "Sem entrada no programa" @@ -1848,16 +1594,26 @@ msgstr "" msgid "Odd parity is not supported" msgstr "A paridade ímpar não é compatível" +#: supervisor/shared/bluetooth/bluetooth.c +msgid "Off" +msgstr "Desligado" + +#: supervisor/shared/bluetooth/bluetooth.c +msgid "Ok" +msgstr "Ok" + #: ports/atmel-samd/common-hal/audiobusio/PDMIn.c #: ports/raspberrypi/common-hal/audiobusio/PDMIn.c msgid "Only 8 or 16 bit mono with " msgstr "Apenas mono com 8 ou 16 bits com " #: ports/espressif/common-hal/wifi/__init__.c +#: ports/raspberrypi/common-hal/wifi/__init__.c msgid "Only IPv4 addresses supported" msgstr "Somente os endereços IPv4 são suportados" -#: ports/espressif/common-hal/socketpool/SocketPool.c +#: ports/espressif/common-hal/socketpool/Socket.c +#: ports/raspberrypi/common-hal/socketpool/Socket.c msgid "Only IPv4 sockets supported" msgstr "Apenas soquetes IPv4 são suportados" @@ -1894,15 +1650,19 @@ msgstr "" msgid "Only one TouchAlarm can be set in deep sleep." msgstr "Apenas um TouchAlarm pode ser colocado em deep sleep." -#: ports/espressif/common-hal/i2cperipheral/I2CPeripheral.c +#: ports/espressif/common-hal/i2ctarget/I2CTarget.c +#: ports/raspberrypi/common-hal/i2ctarget/I2CTarget.c msgid "Only one address is allowed" msgstr "Apenas um endereço é permitido" #: ports/atmel-samd/common-hal/alarm/time/TimeAlarm.c -#: ports/espressif/common-hal/alarm/time/TimeAlarm.c #: ports/nrf/common-hal/alarm/time/TimeAlarm.c -#: ports/raspberrypi/common-hal/alarm/time/TimeAlarm.c #: ports/stm/common-hal/alarm/time/TimeAlarm.c +msgid "Only one alarm.time alarm can be set" +msgstr "Apenas um alarme alarm.time pode ser definido" + +#: ports/espressif/common-hal/alarm/time/TimeAlarm.c +#: ports/raspberrypi/common-hal/alarm/time/TimeAlarm.c msgid "Only one alarm.time alarm can be set." msgstr "Apenas um alarme alarm.time pode ser definido." @@ -1914,19 +1674,20 @@ msgstr "Apenas uma cor pode ser transparente de cada vez" msgid "Operation not permitted" msgstr "A operação não é permitida" -#: ports/espressif/bindings/espidf/__init__.c ports/espressif/esp_error.c +#: ports/espressif/common-hal/espidf/__init__.c ports/espressif/esp_error.c msgid "Operation or feature not supported" msgstr "A operação ou o recurso não é suportado" -#: ports/espressif/bindings/espidf/__init__.c ports/espressif/esp_error.c +#: ports/espressif/common-hal/espidf/__init__.c ports/espressif/esp_error.c msgid "Operation timed out" msgstr "A operação expirou" -#: ports/espressif/bindings/espidf/__init__.c ports/espressif/esp_error.c +#: ports/espressif/common-hal/espidf/__init__.c ports/espressif/esp_error.c msgid "Out of memory" msgstr "Sem memória" -#: ports/espressif/common-hal/socketpool/SocketPool.c +#: ports/espressif/common-hal/socketpool/Socket.c +#: ports/raspberrypi/common-hal/socketpool/Socket.c msgid "Out of sockets" msgstr "Sem soquetes" @@ -1934,11 +1695,6 @@ msgstr "Sem soquetes" msgid "Out-buffer elements must be <= 4 bytes long" msgstr "Os elementos Out-buffer devem ter um comprimento de <= 4 bytes" -#: shared-bindings/bitops/__init__.c -#, c-format -msgid "Output buffer must be at least %d bytes" -msgstr "O buffer de saída deve ter ao menos %d bytes" - #: shared-bindings/audiobusio/PDMIn.c msgid "Oversample must be multiple of 8." msgstr "A superamostragem deve ser um múltiplo de 8." @@ -1947,13 +1703,6 @@ msgstr "A superamostragem deve ser um múltiplo de 8." msgid "PDMIn not available" msgstr "O PDMIn não está disponível" -#: shared-bindings/pwmio/PWMOut.c -msgid "" -"PWM duty_cycle must be between 0 and 65535 inclusive (16 bit resolution)" -msgstr "" -"O duty_cycle do PWM deve estar entre 0 e inclusive 65535 (com resolução de " -"16 bits)" - #: shared-bindings/pwmio/PWMOut.c msgid "" "PWM frequency not writable when variable_frequency is False on construction." @@ -1961,6 +1710,10 @@ msgstr "" "A frequência do PWM não pode ser gravada quando variable_frequency for False " "na construção." +#: ports/stm/common-hal/pwmio/PWMOut.c +msgid "PWM restart" +msgstr "Reinício do PWM" + #: ports/raspberrypi/common-hal/countio/Counter.c msgid "PWM slice already in use" msgstr "A fatia do PWM já está em uso" @@ -1977,36 +1730,20 @@ msgstr "O periférico está em uso" msgid "Permission denied" msgstr "Permissão negada" -#: ports/atmel-samd/common-hal/alarm/pin/PinAlarm.c #: ports/stm/common-hal/alarm/pin/PinAlarm.c msgid "Pin cannot wake from Deep Sleep" msgstr "O pinto não pode acordar do deep sleep" -#: ports/raspberrypi/bindings/rp2pio/StateMachine.c -msgid "Pin count must be at least 1" -msgstr "A contagem dos pinos deve ser com pelo menos 1" - #: ports/raspberrypi/common-hal/rp2pio/StateMachine.c msgid "Pin count too large" msgstr "A contagem dos pinos é muito grande" -#: ports/atmel-samd/common-hal/analogio/AnalogIn.c -#: ports/cxd56/common-hal/analogio/AnalogIn.c -#: ports/espressif/common-hal/analogio/AnalogIn.c -#: ports/mimxrt10xx/common-hal/analogio/AnalogIn.c -#: ports/nrf/common-hal/analogio/AnalogIn.c -#: ports/raspberrypi/common-hal/analogio/AnalogIn.c -#: ports/stm/common-hal/analogio/AnalogIn.c -msgid "Pin does not have ADC capabilities" -msgstr "O pino não tem recursos de ADC" - #: ports/stm/common-hal/alarm/pin/PinAlarm.c #: ports/stm/common-hal/pulseio/PulseIn.c msgid "Pin interrupt already in use" msgstr "A interrupção do pino já está em uso" #: shared-bindings/adafruit_bus_device/spi_device/SPIDevice.c -#: shared-bindings/digitalio/DigitalInOut.c msgid "Pin is input only" msgstr "Apenas o pino de entrada" @@ -2074,18 +1811,10 @@ msgstr "O programa faz IN sem carregar o ISR" msgid "Program does OUT without loading OSR" msgstr "O programa faz OUT sem carregar o OSR" -#: ports/raspberrypi/bindings/rp2pio/StateMachine.c -msgid "Program must contain at least one 16-bit instruction." -msgstr "O programa deve conter pelo menos uma instrução com 16 bits." - #: ports/raspberrypi/bindings/rp2pio/StateMachine.c msgid "Program size invalid" msgstr "O tamanho do programa é inválido" -#: ports/raspberrypi/bindings/rp2pio/StateMachine.c -msgid "Program too large" -msgstr "O programa é muito grande" - #: shared-bindings/digitalio/DigitalInOut.c msgid "Pull not used when direction is output." msgstr "O Pull não foi usado quando a direção for gerada." @@ -2107,30 +1836,20 @@ msgstr "Erro DeInit RNG" msgid "RNG Init Error" msgstr "Houve um erro na inicialização do RNG" -#: ports/nrf/common-hal/busio/UART.c -msgid "RS485 Not yet supported on this device" -msgstr "Ainda não há suporte para o RS485 neste dispositivo" +#: ports/atmel-samd/common-hal/busio/UART.c ports/cxd56/common-hal/busio/UART.c +#: ports/nrf/common-hal/busio/UART.c ports/stm/common-hal/busio/UART.c +msgid "RS485" +msgstr "RS485" #: ports/espressif/common-hal/busio/UART.c #: ports/mimxrt10xx/common-hal/busio/UART.c msgid "RS485 inversion specified when not in RS485 mode" msgstr "A definição da inversão do RS485 quando não está no modo RS485" -#: ports/cxd56/common-hal/rtc/RTC.c ports/espressif/common-hal/rtc/RTC.c -#: ports/mimxrt10xx/common-hal/rtc/RTC.c ports/nrf/common-hal/rtc/RTC.c -#: ports/raspberrypi/common-hal/rtc/RTC.c -msgid "RTC calibration is not supported on this board" -msgstr "A calibração RTC não é suportada nesta placa" - #: shared-bindings/alarm/time/TimeAlarm.c shared-bindings/time/__init__.c msgid "RTC is not supported on this board" msgstr "O RTC não é suportado nesta placa" -#: ports/atmel-samd/common-hal/busio/UART.c ports/cxd56/common-hal/busio/UART.c -#: ports/stm/common-hal/busio/UART.c -msgid "RTS/CTS/RS485 Not yet supported on this device" -msgstr "RTS/CTS/RS485 Ainda não é compatível neste dispositivo" - #: ports/stm/common-hal/os/__init__.c msgid "Random number generation error" msgstr "Houve um erro na geração do número aleatório" @@ -2148,10 +1867,14 @@ msgstr "Sistema de arquivos somente leitura" msgid "Read-only object" msgstr "Objeto de leitura apenas" -#: ports/espressif/bindings/espidf/__init__.c ports/espressif/esp_error.c +#: ports/espressif/common-hal/espidf/__init__.c ports/espressif/esp_error.c msgid "Received response was invalid" msgstr "A resposta recebida foi inválida" +#: supervisor/shared/bluetooth/bluetooth.c +msgid "Reconnecting" +msgstr "Reconectando" + #: shared-bindings/displayio/EPaperDisplay.c msgid "Refresh too soon" msgstr "A recarga foi cedo demais" @@ -2164,7 +1887,7 @@ msgstr "As requisições de transmissões remotas é limitada a 8 bytes" msgid "Requested AES mode is unsupported" msgstr "O modo AES solicitado não é compatível" -#: ports/espressif/bindings/espidf/__init__.c ports/espressif/esp_error.c +#: ports/espressif/common-hal/espidf/__init__.c ports/espressif/esp_error.c msgid "Requested resource not found" msgstr "O recurso solicitado não foi encontrado" @@ -2180,6 +1903,10 @@ msgstr "Rodando em modo seguro! O código salvo não está em execução.\n" msgid "SD card CSD format not supported" msgstr "O formato CSD do Cartão SD não é compatível" +#: ports/cxd56/common-hal/sdioio/SDCard.c +msgid "SDCard init" +msgstr "Inicialização do cartão SD" + #: ports/stm/common-hal/sdioio/SDCard.c #, c-format msgid "SDIO GetCardInfo Error %d" @@ -2190,30 +1917,21 @@ msgstr "Erro SDIO GetCardInfo %d" msgid "SDIO Init Error %d" msgstr "Erro SDIO Init %d" -#: ports/stm/common-hal/busio/SPI.c -msgid "SPI Init Error" -msgstr "Houve um erro na inicialização SPI" - -#: ports/stm/common-hal/busio/SPI.c -msgid "SPI Re-initialization error" -msgstr "Houve um erro na reinicialização SPI" - #: ports/espressif/common-hal/busio/SPI.c msgid "SPI configuration failed" msgstr "A configuração SPI falhou" +#: ports/stm/common-hal/busio/SPI.c +msgid "SPI init error" +msgstr "Erro de inicialização do SPI" + #: ports/raspberrypi/common-hal/busio/SPI.c msgid "SPI peripheral in use" msgstr "O periférico SPI está em uso" -#: shared-bindings/audiomixer/Mixer.c -msgid "Sample rate must be positive" -msgstr "A taxa de amostragem deve ser positiva" - -#: ports/atmel-samd/common-hal/audioio/AudioOut.c -#, c-format -msgid "Sample rate too high. It must be less than %d" -msgstr "Taxa de amostragem muito alta. Deve ser menor que %d" +#: ports/stm/common-hal/busio/SPI.c +msgid "SPI re-init" +msgstr "Reinicialização do SPI" #: shared-bindings/is31fl3741/FrameBuffer.c msgid "Scale dimensions must divide by 3" @@ -2233,15 +1951,6 @@ msgstr "Serializer em uso" msgid "Server side context cannot have hostname" msgstr "O contexto do lado do servidor não pode ter nome de host" -#: ports/raspberrypi/bindings/rp2pio/StateMachine.c -msgid "Set pin count must be between 1 and 5" -msgstr "A definição da contagem dos pinos deve estar entre 1 e 5" - -#: ports/raspberrypi/bindings/rp2pio/StateMachine.c -msgid "Side set pin count must be between 1 and 5" -msgstr "" -"A definição da contagem dos pinos do conjunto lateral deve estar entre 1 e 5" - #: ports/cxd56/common-hal/camera/Camera.c msgid "Size not supported" msgstr "O tamanho não é suportado" @@ -2262,6 +1971,7 @@ msgid "Slices not supported" msgstr "Fatiamento não compatível" #: ports/espressif/common-hal/socketpool/SocketPool.c +#: ports/raspberrypi/common-hal/socketpool/SocketPool.c msgid "SocketPool can only be used with wifi.radio" msgstr "O SocketPool só pode ser usado com rádio wifi.radio" @@ -2277,10 +1987,6 @@ msgstr "Especifique exatamente um do data0 ou do data_pins" msgid "Splitting with sub-captures" msgstr "Divisão com sub-capturas" -#: shared-bindings/supervisor/__init__.c -msgid "Stack size must be at least 256" -msgstr "O tamanho da pilha deve ser pelo menos 256" - #: ports/raspberrypi/common-hal/audiopwmio/PWMAudioOut.c msgid "Stereo left must be on PWM channel A" msgstr "O estéreo à esquerda deve estar no canal PWM A" @@ -2289,10 +1995,6 @@ msgstr "O estéreo à esquerda deve estar no canal PWM A" msgid "Stereo right must be on PWM channel B" msgstr "O estéreo à direita deve estar no canal PWM B" -#: shared-bindings/multiterminal/__init__.c -msgid "Stream missing readinto() or write() method." -msgstr "Transmita o método ausente readinto() ou write()." - #: ports/mimxrt10xx/common-hal/busio/UART.c ports/stm/common-hal/busio/UART.c msgid "Supply at least one UART pin" msgstr "Forneça pelo menos um pino UART" @@ -2377,10 +2079,6 @@ msgstr "A altura do bloco deve dividir exatamente com a altura do bitmap" msgid "Tile index out of bounds" msgstr "O índice do bloco está fora dos limites" -#: shared-bindings/displayio/TileGrid.c -msgid "Tile value out of bounds" -msgstr "O valor do bloco está fora dos limites" - #: shared-bindings/displayio/TileGrid.c msgid "Tile width must exactly divide bitmap width" msgstr "A largura do bloco deve dividir exatamente com a largura do bitmap" @@ -2402,6 +2100,9 @@ msgid "To exit, please reset the board without " msgstr "Para sair, por favor, reinicie a placa sem " #: ports/atmel-samd/common-hal/audiobusio/I2SOut.c +msgid "Too many channels in sample" +msgstr "Muitos canais na amostra" + #: ports/raspberrypi/common-hal/audiobusio/I2SOut.c msgid "Too many channels in sample." msgstr "Muitos canais na amostra." @@ -2434,24 +2135,25 @@ msgid "Tuple or struct_time argument required" msgstr "O argumento de tupla ou struct_time é necessário" #: ports/stm/common-hal/busio/UART.c -msgid "UART Buffer allocation error" -msgstr "Houve um erro na alocação do Buffer UART" +msgid "UART de-init" +msgstr "descontinuar o início UART" + +#: ports/atmel-samd/common-hal/busio/UART.c ports/cxd56/common-hal/busio/UART.c +#: ports/espressif/common-hal/busio/UART.c ports/stm/common-hal/busio/UART.c +msgid "UART init" +msgstr "inicialização do UART" #: ports/stm/common-hal/busio/UART.c -msgid "UART De-init error" -msgstr "Houve um erro da não inicialização do UART" +msgid "UART re-init" +msgstr "Reinicialização do UART" #: ports/stm/common-hal/busio/UART.c -msgid "UART Init Error" -msgstr "Houve um erro na inicialização do UART" +msgid "UART write" +msgstr "Escrita UART" -#: ports/stm/common-hal/busio/UART.c -msgid "UART Re-init error" -msgstr "Houve um erro na reinicialização do UART" - -#: ports/stm/common-hal/busio/UART.c -msgid "UART write error" -msgstr "Houve um erro na gravação UART" +#: main.c +msgid "UID:" +msgstr "" #: shared-module/usb_hid/Device.c msgid "USB busy" @@ -2577,6 +2279,11 @@ msgstr "Erro desconhecido do firmware: %04x" msgid "Unknown system firmware error: %d" msgstr "Ocorreu um erro desconhecido no firmware do sistema: %d" +#: ports/raspberrypi/common-hal/wifi/__init__.c +#, c-format +msgid "Unkown error code %d" +msgstr "Código de erro desconhecido %d" + #: shared-bindings/adafruit_pixelbuf/PixelBuf.c #, c-format msgid "Unmatched number of items on RHS (expected %d, got %d)." @@ -2590,12 +2297,6 @@ msgstr "" "Problema desconhecido. Pode ser que o prompt de emparelhamento no outro " "dispositivo tenha sido recusado ou ignorado." -#: ports/atmel-samd/common-hal/busio/I2C.c ports/cxd56/common-hal/busio/I2C.c -#: ports/espressif/common-hal/busio/UART.c -#: ports/raspberrypi/common-hal/busio/I2C.c ports/stm/common-hal/busio/I2C.c -msgid "Unsupported baudrate" -msgstr "Taxa de transmissão não suportada" - #: shared-bindings/bitmaptools/__init__.c msgid "Unsupported colorspace" msgstr "Espaço de cor não compatível" @@ -2608,6 +2309,10 @@ msgstr "Não há suporte para o tipo do display bus" msgid "Unsupported format" msgstr "Formato não suportado" +#: shared-bindings/hashlib/__init__.c +msgid "Unsupported hash algorithm" +msgstr "Sem compatibilidade com o algoritmo de hash" + #: ports/espressif/common-hal/dualbank/__init__.c msgid "Update Failed" msgstr "A atualização falou" @@ -2626,7 +2331,7 @@ msgstr "Comprimento do valor != comprimento fixo necessário" msgid "Value length > max_length" msgstr "O comprimento do valor é > max_length" -#: ports/espressif/bindings/espidf/__init__.c ports/espressif/esp_error.c +#: ports/espressif/common-hal/espidf/__init__.c ports/espressif/esp_error.c msgid "Version was invalid" msgstr "A versão era inválida" @@ -2660,10 +2365,6 @@ msgstr "" msgid "WatchDogTimer.timeout must be greater than 0" msgstr "O WatchDogTimer.timeout deve ser maior que 0" -#: supervisor/shared/safe_mode.c -msgid "Watchdog timer expired." -msgstr "O temporizador Watchdog expirou." - #: py/builtinhelp.c #, c-format msgid "" @@ -2679,9 +2380,9 @@ msgstr "" "\n" "Para listar os módulos existente digite `help(\"modules\")`.\n" -#: shared-bindings/wifi/Radio.c -msgid "WiFi password must be between 8 and 63 characters" -msgstr "A senha do Wi-Fi deve ter entre 8 e 63 caracteres" +#: supervisor/shared/web_workflow/web_workflow.c +msgid "Wi-Fi: " +msgstr "Wi-Fi: " #: main.c msgid "Woken up by alarm.\n" @@ -2723,11 +2424,7 @@ msgstr "O argumento __new__ deve ser um tipo usuário" msgid "a bytes-like object is required" msgstr "é necessário objetos tipo bytes" -#: shared-bindings/i2cperipheral/I2CPeripheral.c -msgid "address out of bounds" -msgstr "endereço fora dos limites" - -#: shared-bindings/i2cperipheral/I2CPeripheral.c +#: shared-bindings/i2ctarget/I2CTarget.c msgid "addresses is empty" msgstr "os endereços estão vazios" @@ -2776,6 +2473,10 @@ msgstr "os argumentos devem ser ndarrays" msgid "array and index length must be equal" msgstr "a matriz e comprimento do índice devem ser iguais" +#: extmod/ulab/code/numpy/io/io.c +msgid "array has too many dimensions" +msgstr "a matriz possui muitas dimensões" + #: py/objarray.c shared-bindings/alarm/SleepMemory.c #: shared-bindings/nvm/ByteArray.c msgid "array/bytes required on right side" @@ -2837,10 +2538,6 @@ msgstr "os tamanhos do bitmap devem coincidir" msgid "bits must be 32 or less" msgstr "bits deve ser 32 ou menos" -#: shared-bindings/busio/UART.c -msgid "bits must be in range 5 to 9" -msgstr "os bits devem estar na faixa entre 5 a 9" - #: shared-bindings/audiomixer/Mixer.c msgid "bits_per_sample must be 8 or 16" msgstr "bits_per_sample deve ser 8 ou 16" @@ -2878,11 +2575,6 @@ msgstr "o buffer é pequeno demais para os bytes requisitados" msgid "byteorder is not a string" msgstr "a ordem dos bytes não é uma cadeia de caracteres" -#: ports/atmel-samd/common-hal/busio/UART.c -#: ports/espressif/common-hal/busio/UART.c -msgid "bytes > 8 bits not supported" -msgstr "bytes > 8 bits não suportado" - #: py/objarray.c msgid "bytes length not a multiple of item size" msgstr "o comprimento dos bytes não é um múltiplo do tamanho do item" @@ -2891,7 +2583,7 @@ msgstr "o comprimento dos bytes não é um múltiplo do tamanho do item" msgid "bytes value out of range" msgstr "o valor dos bytes estão fora do alcance" -#: ports/atmel-samd/bindings/samd/Clock.c ports/atmel-samd/common-hal/rtc/RTC.c +#: ports/atmel-samd/bindings/samd/Clock.c msgid "calibration is out of range" msgstr "Calibração está fora do intervalo" @@ -2899,13 +2591,10 @@ msgstr "Calibração está fora do intervalo" msgid "calibration is read only" msgstr "Calibração é somente leitura" -#: ports/atmel-samd/common-hal/rtc/RTC.c -msgid "calibration value out of range +/-127" -msgstr "Valor de calibração fora do intervalo +/- 127" - +#: shared-module/vectorio/Circle.c shared-module/vectorio/Polygon.c #: shared-module/vectorio/Rectangle.c -msgid "can only be registered in one parent" -msgstr "pode ser registrado apenas numa principal" +msgid "can only have one parent" +msgstr "pode ter apenas um principal" #: py/emitinlinethumb.c msgid "can only have up to 4 parameters to Thumb assembly" @@ -2927,8 +2616,7 @@ msgstr "a expressão não pode ser atribuída" msgid "can't cancel self" msgstr "não é possível cancelar a si mesmo" -#: py/obj.c py/objint.c shared-bindings/i2cperipheral/I2CPeripheral.c -#: shared-module/adafruit_pixelbuf/PixelBuf.c +#: py/obj.c py/objint.c shared-module/adafruit_pixelbuf/PixelBuf.c msgid "can't convert %q to %q" msgstr "não é possível converter %q para %q" @@ -3079,6 +2767,10 @@ msgstr "Não é possível obter de forma inequívoca a escala do sizeof" msgid "casting" msgstr "fundição" +#: ports/stm/common-hal/pwmio/PWMOut.c +msgid "channel re-init" +msgstr "reinício do canal" + #: shared-bindings/_stage/Text.c msgid "chars buffer too small" msgstr "o buffer dos caracteres é muito pequeno" @@ -3091,10 +2783,6 @@ msgstr "o arg chr() está fora do intervalo(0x110000)" msgid "chr() arg not in range(256)" msgstr "o arg chr() está fora do intervalo(256)" -#: shared-module/vectorio/Circle.c -msgid "circle can only be registered in one parent" -msgstr "o círculo só pode ser registrado em um pai" - #: shared-bindings/bitmaptools/__init__.c msgid "clip point must be (x,y) tuple" msgstr "O ponto do clipe deve ser uma tupla (x, y)" @@ -3121,10 +2809,6 @@ msgstr "" msgid "color must be between 0x000000 and 0xffffff" msgstr "cor deve estar entre 0x000000 e 0xffffff" -#: shared-bindings/displayio/ColorConverter.c -msgid "color should be an int" -msgstr "cor deve ser um int" - #: py/emitnative.c msgid "comparison of int and uint" msgstr "comparação de int e uint" @@ -3161,6 +2845,10 @@ msgstr "os argumentos convolutivos devem ser ndarrays" msgid "convolve arguments must not be empty" msgstr "os argumentos convolutivos não devem estar vazios" +#: extmod/ulab/code/numpy/io/io.c +msgid "corrupted file" +msgstr "arquivo corrompido" + #: extmod/ulab/code/numpy/poly.c msgid "could not invert Vandermonde matrix" msgstr "não foi possível inverter a matriz Vandermonde" @@ -3214,10 +2902,6 @@ msgid "destination buffer must be an array of type 'H' for bit_depth = 16" msgstr "" "o buffer do destino deve ser uma matriz do tipo 'H' para bit_depth = 16" -#: shared-bindings/audiobusio/PDMIn.c -msgid "destination_length must be an int >= 0" -msgstr "destination_length deve ser um int >= 0" - #: py/objdict.c msgid "dict update sequence has wrong length" msgstr "sequência da atualização dict tem o comprimento errado" @@ -3255,6 +2939,10 @@ msgstr "dtype deve ser flutuante ou complexo" msgid "empty" msgstr "vazio" +#: extmod/ulab/code/numpy/io/io.c +msgid "empty file" +msgstr "arquivo vazio" + #: extmod/moduasyncio.c extmod/moduheapq.c extmod/modutimeq.c msgid "empty heap" msgstr "a área de alocação dinâmica de variáveis (heap) está vazia" @@ -3271,10 +2959,6 @@ msgstr "seqüência vazia" msgid "end of format while looking for conversion specifier" msgstr "final de formato enquanto procura pelo especificador de conversão" -#: shared-bindings/displayio/Shape.c -msgid "end_x should be an int" -msgstr "end_x deve ser um int" - #: shared-bindings/alarm/time/TimeAlarm.c msgid "epoch_time not supported on this board" msgstr "O epoch_time não é compatível com esta placa" @@ -3284,6 +2968,14 @@ msgstr "O epoch_time não é compatível com esta placa" msgid "error = 0x%08lX" msgstr "erro = 0x%08lX" +#: ports/espressif/common-hal/esp32_camera/Camera.c +msgid "" +"esp32_camera.Camera requires reserved PSRAM to be configured. See the " +"documentation for instructions." +msgstr "" +"esp32_camera.Camera requer que uma reserva PSRAM seja configurada. Consulte " +"a documentação para obter mais informações." + #: py/runtime.c msgid "exceptions must derive from BaseException" msgstr "as exceções devem derivar a partir do BaseException" @@ -3358,7 +3050,7 @@ msgstr "o primeiro argumento deve ser uma função" msgid "first argument must be a tuple of ndarrays" msgstr "o primeiro argumento deve ser um tuple de ndarrays" -#: extmod/ulab/code/numpy/vector.c +#: extmod/ulab/code/numpy/transform.c extmod/ulab/code/numpy/vector.c msgid "first argument must be an ndarray" msgstr "o primeiro argumento deve ser um ndarray" @@ -3506,7 +3198,7 @@ msgstr "a chave do formato está incompleto" msgid "incorrect padding" msgstr "preenchimento incorreto" -#: extmod/ulab/code/ndarray.c +#: extmod/ulab/code/ndarray.c extmod/ulab/code/numpy/transform.c msgid "index is out of bounds" msgstr "o índice está fora dos limites" @@ -3524,6 +3216,10 @@ msgstr "os índices devem ser inteiros" msgid "indices must be integers, slices, or Boolean lists" msgstr "os índices devem ser números inteiros, fatias ou listas booleanas" +#: ports/espressif/common-hal/busio/I2C.c +msgid "init I2C" +msgstr "inicialização do I2C" + #: extmod/ulab/code/scipy/optimize/optimize.c msgid "initial values must be iterable" msgstr "os valores iniciais devem ser iteráveis" @@ -3570,6 +3266,10 @@ msgstr "a matriz da entrada é assimétrica" msgid "input matrix is singular" msgstr "a matriz da entrada é singular" +#: extmod/ulab/code/numpy/create.c +msgid "input must be 1- or 2-d" +msgstr "a entrada deve ser 1- ou 2-d" + #: extmod/ulab/code/numpy/carray/carray.c msgid "input must be a 1D ndarray" msgstr "a entrada deve ser um 1D ndarray" @@ -3578,11 +3278,7 @@ msgstr "a entrada deve ser um 1D ndarray" msgid "input must be a dense ndarray" msgstr "a entrada deve ser um ndarray denso" -#: extmod/ulab/code/numpy/create.c -msgid "input must be a tensor of rank 2" -msgstr "a entrada dos dados deve ser um tensor de nível 2" - -#: extmod/ulab/code/numpy/create.c extmod/ulab/code/user/user.c +#: extmod/ulab/code/user/user.c msgid "input must be an ndarray" msgstr "a entrada deve ser um ndarray" @@ -3632,6 +3328,10 @@ msgstr "arquitetura inválida" msgid "invalid bits_per_pixel %d, must be, 1, 2, 4, 8, 16, 24, or 32" msgstr "bits_per_pixel %d inválido, deve ser, 1, 2, 4, 8, 16, 24, ou 32" +#: ports/raspberrypi/common-hal/ssl/SSLSocket.c +msgid "invalid cert" +msgstr "certificado inválido" + #: shared-bindings/bitmaptools/__init__.c #, c-format msgid "invalid element size %d for bits_per_pixel %d\n" @@ -3658,10 +3358,18 @@ msgstr "o especificador do formato é inválido" msgid "invalid hostname" msgstr "o nome do host é inválido" +#: ports/raspberrypi/common-hal/ssl/SSLSocket.c +msgid "invalid key" +msgstr "chave inválida" + #: py/compile.c msgid "invalid micropython decorator" msgstr "o decorador micropython é inválido" +#: ports/espressif/common-hal/esp32_camera/Camera.c +msgid "invalid setting" +msgstr "configuração inválida" + #: shared-bindings/random/__init__.c msgid "invalid step" msgstr "passo inválido" @@ -3778,10 +3486,6 @@ msgstr "erro de domínio matemático" msgid "matrix is not positive definite" msgstr "a matriz não é definitiva positiva" -#: ports/espressif/common-hal/wifi/Radio.c -msgid "max_connections must be between 0 and 10" -msgstr "max_connections deve estar entre 0 e 10" - #: ports/espressif/common-hal/_bleio/Descriptor.c #: ports/nrf/common-hal/_bleio/Characteristic.c #: ports/nrf/common-hal/_bleio/Descriptor.c @@ -3789,13 +3493,9 @@ msgstr "max_connections deve estar entre 0 e 10" msgid "max_length must be 0-%d when fixed_length is %s" msgstr "o max_length deve ser 0-%d quando Fixed_length for %s" -#: shared-bindings/_bleio/Characteristic.c shared-bindings/_bleio/Descriptor.c -msgid "max_length must be >= 0" -msgstr "max_length deve ser >= 0" - #: extmod/ulab/code/ndarray.c -msgid "maximum number of dimensions is 4" -msgstr "O número máximo de dimensões são 4" +msgid "maximum number of dimensions is " +msgstr "a quantidade máxima de dimensões é " #: py/runtime.c msgid "maximum recursion depth exceeded" @@ -3930,7 +3630,7 @@ msgstr "nenhum pino de redefinição está disponível" msgid "no response from SD card" msgstr "não houve resposta do cartão SD" -#: py/objobject.c py/runtime.c +#: ports/espressif/common-hal/esp32_camera/Camera.c py/objobject.c py/runtime.c msgid "no such attribute" msgstr "não há tal atributo" @@ -4041,7 +3741,11 @@ msgstr "é necessário objeto com protocolo do buffer" msgid "odd-length string" msgstr "sequência com comprimento ímpar" -#: extmod/ulab/code/numpy/create.c extmod/ulab/code/utils/utils.c +#: supervisor/shared/web_workflow/web_workflow.c +msgid "off" +msgstr "desligado" + +#: extmod/ulab/code/utils/utils.c msgid "offset is too large" msgstr "o offset é muito grande" @@ -4142,10 +3846,6 @@ msgstr "o pacote previa %d itens para a empacotamento (obteve %d)" msgid "palette must be 32 bytes long" msgstr "a paleta deve ter 32 bytes de comprimento" -#: shared-bindings/displayio/Palette.c -msgid "palette_index should be an int" -msgstr "palette_index deve ser um int" - #: py/emitinlinextensa.c msgid "parameters must be registers in sequence a2 to a5" msgstr "os parâmetros devem ser registradores na sequência a2 até a5" @@ -4170,10 +3870,6 @@ msgstr "o pixel_shader deve ser displayio.Palette ou displayio.ColorConverter" msgid "poll on file not available on win32" msgstr "a sondagem no arquivo não está disponível no win32" -#: shared-module/vectorio/Polygon.c -msgid "polygon can only be registered in one parent" -msgstr "o polígono só pode ser registrado em um pai" - #: ports/espressif/common-hal/pulseio/PulseIn.c msgid "pop from an empty PulseIn" msgstr "pop a partir de um PulseIn vazio" @@ -4199,7 +3895,23 @@ 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/espressif/boards/adafruit_qtpy_esp32_pico/mpconfigboard.h +msgid "pressing BOOT button at start up.\n" +msgstr "pressionando o botão BOOT na inicialização.\n" + +#: ports/espressif/boards/adafruit_feather_esp32_v2/mpconfigboard.h +msgid "pressing SW38 button at start up.\n" +msgstr "pressionando o botão SW38 na inicialização.\n" + +#: ports/espressif/boards/hardkernel_odroid_go/mpconfigboard.h +msgid "pressing VOLUME button at start up.\n" +msgstr "pressionando o botão VOLUME na inicialização.\n" + #: ports/espressif/boards/adafruit_qtpy_esp32c3/mpconfigboard.h +#: ports/espressif/boards/beetle-esp32-c3/mpconfigboard.h +#: ports/espressif/boards/espressif_esp32s2_devkitc_1_n8r2/mpconfigboard.h +#: ports/espressif/boards/lolin_c3_mini/mpconfigboard.h +#: ports/espressif/boards/microdev_micro_c3/mpconfigboard.h #: supervisor/shared/safe_mode.c msgid "pressing boot button at start up.\n" msgstr "pressionando o botão de boot na inicialização.\n" @@ -4220,14 +3932,6 @@ msgstr "pressionando o botão esquerdo durante a inicialização\n" msgid "pull masks conflict with direction masks" msgstr "puxe as máscaras em conflito com as máscaras de direção" -#: ports/raspberrypi/bindings/rp2pio/StateMachine.c -msgid "pull_threshold must be between 1 and 32" -msgstr "O pull_threshold deve ser entre 1 e 32" - -#: ports/raspberrypi/bindings/rp2pio/StateMachine.c -msgid "push_threshold must be between 1 and 32" -msgstr "O pull_threshold deve ser entre 1 e 32" - #: extmod/modutimeq.c msgid "queue overflow" msgstr "estouro de fila" @@ -4279,14 +3983,6 @@ msgstr "argumento de enrolar deve ser um ndarray" msgid "rsplit(None,n)" msgstr "rsplit(Nenhum,n)" -#: shared-bindings/audiocore/RawSample.c -msgid "" -"sample_source buffer must be a bytearray or array of type 'h', 'H', 'b' or " -"'B'" -msgstr "" -"O buffer sample_source deve ser um bytearray ou matriz do tipo 'h', 'H', 'b' " -"ou 'B'" - #: ports/atmel-samd/common-hal/audiobusio/PDMIn.c #: ports/raspberrypi/common-hal/audiobusio/PDMIn.c msgid "sampling rate out of range" @@ -4384,26 +4080,14 @@ msgstr "o source_bitmap deve ter o value_count de 65536" msgid "source_bitmap must have value_count of 8" msgstr "o source_bitmap deve ter o value_count de 8" -#: shared-bindings/wifi/Radio.c -msgid "ssid can't be more than 32 bytes" -msgstr "O ssid não pode ter mais do que 32 bytes" - #: py/objstr.c msgid "start/end indices" msgstr "os índices de início/fim" -#: shared-bindings/displayio/Shape.c -msgid "start_x should be an int" -msgstr "start_x deve ser um int" - #: shared-bindings/random/__init__.c msgid "step must be non-zero" msgstr "o passo deve ser diferente de zero" -#: shared-bindings/busio/UART.c -msgid "stop must be 1 or 2" -msgstr "o stop deve ser 1 ou 2" - #: shared-bindings/random/__init__.c msgid "stop not reachable from start" msgstr "stop não está acessível a partir do início" @@ -4452,10 +4136,6 @@ msgstr "houve um erro de sintaxe no descritor uctypes" msgid "threshold must be in the range 0-65536" msgstr "Limite deve estar no alcance de 0-65536" -#: shared-bindings/rgbmatrix/RGBMatrix.c -msgid "tile must be greater than zero" -msgstr "o bloco deve ser maior que zero" - #: shared-bindings/time/__init__.c msgid "time.struct_time() takes a 9-sequence" msgstr "time.struct_time() leva uma sequência com 9" @@ -4475,10 +4155,6 @@ msgstr "o tempo limite deve ser entre 0.0 a 100.0 segundos" msgid "timeout must be < 655.35 secs" msgstr "o tempo limite deve ser < 655.35 seg" -#: shared-bindings/_bleio/CharacteristicBuffer.c -msgid "timeout must be >= 0.0" -msgstr "o tempo limite deve ser >= 0,0" - #: shared-module/sdcardio/SDCard.c msgid "timeout waiting for v1 card" msgstr "o tempo limite na espera pelo cartão v1" @@ -4487,6 +4163,10 @@ msgstr "o tempo limite na espera pelo cartão v1" msgid "timeout waiting for v2 card" msgstr "o tempo limite na espera pelo cartão v2" +#: ports/stm/common-hal/pwmio/PWMOut.c +msgid "timer re-init" +msgstr "reinicialização do temporizador" + #: shared-bindings/time/__init__.c msgid "timestamp out of range for platform time_t" msgstr "timestamp fora do intervalo para a plataforma time_t" @@ -4552,14 +4232,10 @@ msgstr "o tipo '%q' não é um tipo base aceitável" msgid "type is not an acceptable base type" msgstr "tipo não é um tipo base aceitável" -#: py/runtime.c +#: py/objgenerator.c py/runtime.c msgid "type object '%q' has no attribute '%q'" msgstr "o objeto tipo '%q' não possuí atributo '%q'" -#: py/objgenerator.c -msgid "type object 'generator' has no attribute '__await__'" -msgstr "o tipo do objeto 'generator' não possui qualquer atributo '__await__'" - #: py/objtype.c msgid "type takes 1 or 3 arguments" msgstr "o tipo usa 1 ou 3 argumentos" @@ -4618,7 +4294,6 @@ msgid "unreadable attribute" msgstr "atributo ilegível" #: shared-bindings/displayio/TileGrid.c shared-bindings/vectorio/VectorShape.c -#: shared-module/vectorio/Polygon.c shared-module/vectorio/VectorShape.c msgid "unsupported %q type" msgstr "tipo %q não suportado" @@ -4657,6 +4332,14 @@ msgstr "tipo não compatível para o operador" msgid "unsupported types for %q: '%q', '%q'" msgstr "tipo sem suporte para %q: '%q', '%q'" +#: extmod/ulab/code/numpy/io/io.c +msgid "usecols is too high" +msgstr "usecols é muito alto" + +#: extmod/ulab/code/numpy/io/io.c +msgid "usecols keyword must be specified" +msgstr "palavra-chave para o usecols deve ser definida" + #: py/objint.c #, c-format msgid "value must fit in %d byte(s)" @@ -4678,20 +4361,19 @@ msgstr "o watchdog não foi inicializado" msgid "watchdog timeout must be greater than 0" msgstr "o tempo limite do watchdog deve ser maior que 0" -#: shared-bindings/bitops/__init__.c -#, c-format -msgid "width must be from 2 to 8 (inclusive), not %d" -msgstr "a largura deve ser entre 2 a 8 (inclusive), não %d" - #: shared-bindings/is31fl3741/FrameBuffer.c -#: shared-bindings/rgbmatrix/RGBMatrix.c msgid "width must be greater than zero" msgstr "a largura deve ser maior que zero" #: ports/espressif/common-hal/wifi/Radio.c +#: ports/raspberrypi/common-hal/wifi/Radio.c msgid "wifi is not enabled" msgstr "o wifi não está ativo" +#: ports/raspberrypi/common-hal/wifi/Monitor.c +msgid "wifi.Monitor not available" +msgstr "O wifi.Monitor não está disponível" + #: shared-bindings/_bleio/Adapter.c msgid "window must be <= interval" msgstr "a janela deve ser <= intervalo" @@ -4704,7 +4386,17 @@ msgstr "índice do eixo errado" msgid "wrong axis specified" msgstr "um eixo errado foi definido" -#: extmod/ulab/code/numpy/compare.c extmod/ulab/code/numpy/vector.c +#: extmod/ulab/code/numpy/io/io.c +msgid "wrong dtype" +msgstr "dtype errado" + +#: extmod/ulab/code/numpy/transform.c +msgid "wrong index type" +msgstr "tipo do índice errado" + +#: extmod/ulab/code/numpy/compare.c extmod/ulab/code/numpy/create.c +#: extmod/ulab/code/numpy/io/io.c extmod/ulab/code/numpy/transform.c +#: extmod/ulab/code/numpy/vector.c msgid "wrong input type" msgstr "tipo da entrada incorreta" @@ -4712,6 +4404,10 @@ msgstr "tipo da entrada incorreta" msgid "wrong length of condition array" msgstr "comprimento errado na condição da matriz" +#: extmod/ulab/code/numpy/transform.c +msgid "wrong length of index array" +msgstr "comprimento errado do índice da matriz" + #: extmod/ulab/code/numpy/create.c py/objarray.c py/objstr.c msgid "wrong number of arguments" msgstr "quantidade errada dos argumentos" @@ -4732,10 +4428,6 @@ msgstr "o valor x está fora dos limites" msgid "xTaskCreate failed" msgstr "o xTaskCreate falhou" -#: shared-bindings/displayio/Shape.c -msgid "y should be an int" -msgstr "y deve ser um int" - #: shared-module/displayio/Shape.c msgid "y value out of bounds" msgstr "o valor y está fora dos limites" @@ -4756,6 +4448,418 @@ msgstr "zi deve ser de um tipo float" msgid "zi must be of shape (n_section, 2)" msgstr "zi deve estar na forma (n_section, 2)" +#~ msgid "Stream missing readinto() or write() method." +#~ msgstr "Transmita o método ausente readinto() ou write()." + +#~ msgid "%q must be >= 0" +#~ msgstr "%q deve ser >= 0" + +#~ msgid "%q must be >= 1" +#~ msgstr "%q deve ser >= 1" + +#~ msgid "address out of bounds" +#~ msgstr "endereço fora dos limites" + +#~ msgid "destination_length must be an int >= 0" +#~ msgstr "destination_length deve ser um int >= 0" + +#~ msgid "type object 'generator' has no attribute '__await__'" +#~ msgstr "" +#~ "o tipo do objeto 'generator' não possui qualquer atributo '__await__'" + +#~ msgid "color should be an int" +#~ msgstr "cor deve ser um int" + +#~ msgid "end_x should be an int" +#~ msgstr "end_x deve ser um int" + +#~ msgid "palette_index should be an int" +#~ msgstr "palette_index deve ser um int" + +#~ msgid "start_x should be an int" +#~ msgstr "start_x deve ser um int" + +#~ msgid "y should be an int" +#~ msgstr "y deve ser um int" + +#~ msgid "" +#~ "sample_source buffer must be a bytearray or array of type 'h', 'H', 'b' " +#~ "or 'B'" +#~ msgstr "" +#~ "O buffer sample_source deve ser um bytearray ou matriz do tipo 'h', 'H', " +#~ "'b' ou 'B'" + +#~ msgid "Expected an alarm" +#~ msgstr "Um alarme era esperado" + +#~ msgid "All I2C targets are in use" +#~ msgstr "Todos os alvos I2C já estão em uso" + +#~ msgid "Failed to init wifi" +#~ msgstr "Houve uma falha ao iniciar o wifi" + +#~ msgid "input must be a tensor of rank 2" +#~ msgstr "a entrada dos dados deve ser um tensor de nível 2" + +#~ msgid "maximum number of dimensions is 4" +#~ msgstr "O número máximo de dimensões são 4" + +#~ msgid "Watchdog timer expired." +#~ msgstr "O temporizador Watchdog expirou." + +#~ msgid "ssid can't be more than 32 bytes" +#~ msgstr "O ssid não pode ter mais do que 32 bytes" + +#~ msgid "%q must be a tuple of length 2" +#~ msgstr "%q deve ser uma tupla de comprimento 2" + +#~ msgid "%q must be between %d and %d" +#~ msgstr "%q deve estar entre %d e %d" + +#~ msgid "%q should be an int" +#~ msgstr "%q deve ser um int" + +#~ msgid "(x,y) integers required" +#~ msgstr "(x,y) é obrigatório o uso de números inteiros" + +#~ msgid "Address type out of range" +#~ msgstr "O tipo do endereço está fora do alcance" + +#~ msgid "AnalogIn not supported on given pin" +#~ msgstr "O AnalogIn não é compatível no pino informado" + +#~ msgid "AnalogOut functionality not supported" +#~ msgstr "Funcionalidade AnalogOut não suportada" + +#~ msgid "AnalogOut is only 16 bits. Value must be less than 65536." +#~ msgstr "O AnalogOut é de apenas 16 bits. O valor deve ser menor que 65536." + +#~ msgid "AnalogOut not supported on given pin" +#~ msgstr "Saída analógica não suportada no pino fornecido" + +#, c-format +#~ msgid "Bit depth must be from 1 to 6 inclusive, not %d" +#~ msgstr "A profundidade dos bits deve ser de 1 até 6 inclusive, porém não %d" + +#, c-format +#~ msgid "Buffer incorrect size. Should be %d bytes." +#~ msgstr "Buffer de tamanho incorreto. Deve ser %d bytes." + +#~ msgid "Buffer must be at least length 1" +#~ msgstr "O comprimento do buffer deve ter pelo menos 1" + +#~ msgid "Bytes must be between 0 and 255." +#~ msgstr "Os bytes devem estar entre 0 e 255." + +#~ msgid "Cannot output both channels on the same pin" +#~ msgstr "Não é possível emitir os dois canais no mesmo pino" + +#~ msgid "Cannot read without MISO pin." +#~ msgstr "Não é possível ler sem o pino MISO." + +#~ msgid "Cannot reset into bootloader because no bootloader is present." +#~ msgstr "" +#~ "Não é possível redefinir para o bootloader porque o mesmo não está " +#~ "presente." + +#~ msgid "Cannot transfer without MOSI and MISO pins." +#~ msgstr "Não é possível transferir sem os pinos MOSI e MISO." + +#~ msgid "Cannot write without MOSI pin." +#~ msgstr "Não é possível fazer a escrita sem um pino MOSI." + +#~ msgid "Clock pin init failed." +#~ msgstr "Inicialização do pino de Clock falhou." + +#~ msgid "Command must be an int between 0 and 255" +#~ msgstr "O comando deve ser um int entre 0 e 255" + +#~ msgid "Could not initialize Camera" +#~ msgstr "Não foi possível inicializar a Câmera" + +#~ msgid "Could not initialize GNSS" +#~ msgstr "Não foi possível inicializar o GNSS" + +#~ msgid "Could not initialize SDCard" +#~ msgstr "Não foi possível inicializar o SDCard" + +#~ msgid "Could not initialize UART" +#~ msgstr "Não foi possível inicializar o UART" + +#~ msgid "Could not re-init channel" +#~ msgstr "Não foi possível reiniciar o canal" + +#~ msgid "Could not re-init timer" +#~ msgstr "Não foi possível reiniciar o temporizador" + +#~ msgid "Could not restart PWM" +#~ msgstr "Não foi possível reiniciar o PWM" + +#~ msgid "Couldn't allocate first buffer" +#~ msgstr "Não pôde alocar primeiro buffer" + +#~ msgid "Couldn't allocate input buffer" +#~ msgstr "Não foi possível alocar o buffer de entrada" + +#~ msgid "Couldn't allocate second buffer" +#~ msgstr "Não pôde alocar segundo buffer" + +#~ msgid "DigitalInOut not supported on given pin" +#~ msgstr "O DigitalInOut não é compatível em um determinado pino" + +#, c-format +#~ msgid "Expected tuple of length %d, got %d" +#~ msgstr "Tupla esperada com comprimento %d, obteve %d" + +#~ msgid "Failed to allocate RX buffer" +#~ msgstr "Falha ao alocar buffer RX" + +#, c-format +#~ msgid "Failed to allocate RX buffer of %d bytes" +#~ msgstr "Falha ao alocar buffer RX de %d bytes" + +#, c-format +#~ msgid "Framebuffer requires %d bytes" +#~ msgstr "O Framebuffer requer %d bytes" + +#~ msgid "Hostname must be between 1 and 253 characters" +#~ msgstr "O nome do host deve ter entre 1 e 253 caracteres" + +#~ msgid "I2C Init Error" +#~ msgstr "Erro de inicialização do I2C" + +#~ msgid "Invalid %q pin selection" +#~ msgstr "Seleção inválida dos pinos %q" + +#~ msgid "Invalid AuthMode" +#~ msgstr "AuthMode inválido" + +#~ msgid "Invalid BMP file" +#~ msgstr "Arquivo BMP inválido" + +#~ msgid "Invalid DAC pin supplied" +#~ msgstr "O pino DAC informado é inválido" + +#~ msgid "Invalid MIDI file" +#~ msgstr "O arquivo MIDI é inválido" + +#~ msgid "Invalid PWM frequency" +#~ msgstr "Frequência PWM inválida" + +#~ msgid "Invalid Pin" +#~ msgstr "Pino inválido" + +#~ msgid "Invalid buffer size" +#~ msgstr "O tamanho do buffer é inválido" + +#~ msgid "Invalid byteorder string" +#~ msgstr "A cadeia de bytes é inválida" + +#~ msgid "Invalid capture period. Valid range: 1 - 500" +#~ msgstr "O período de captura é inválido. O intervalo válido é: 1 - 500" + +#~ msgid "Invalid channel count" +#~ msgstr "A contagem do canal é inválido" + +#, c-format +#~ msgid "Invalid data_count %d" +#~ msgstr "data_count %d inválido" + +#~ msgid "Invalid direction." +#~ msgstr "Direção inválida." + +#~ msgid "Invalid file" +#~ msgstr "Arquivo inválido" + +#~ msgid "Invalid mode" +#~ msgstr "Modo inválido" + +#~ msgid "Invalid number of bits" +#~ msgstr "Número inválido de bits" + +#~ msgid "Invalid phase" +#~ msgstr "Fase Inválida" + +#~ msgid "Invalid pin" +#~ msgstr "Pino inválido" + +#~ msgid "Invalid pin for left channel" +#~ msgstr "Pino inválido para canal esquerdo" + +#~ msgid "Invalid pin for right channel" +#~ msgstr "Pino inválido para canal direito" + +#~ msgid "Invalid polarity" +#~ msgstr "Polaridade inválida" + +#~ msgid "Invalid properties" +#~ msgstr "Propriedades inválidas" + +#~ msgid "Invalid run mode." +#~ msgstr "O modo de execução é inválido." + +#~ msgid "Invalid security_mode" +#~ msgstr "O Security_mode é inválido" + +#~ msgid "Invalid voice" +#~ msgstr "A voz é inválida" + +#~ msgid "Invalid voice count" +#~ msgstr "A contagem da voz é inválida" + +#~ msgid "Invalid wave file" +#~ msgstr "Aqruivo de ondas inválido" + +#~ msgid "Invalid word/bit length" +#~ msgstr "O comprimento do bit/palavra são inválidos" + +#~ msgid "Layer already in a group." +#~ msgstr "A camada já existe em um grupo." + +#~ msgid "Layer must be a Group or TileGrid subclass." +#~ msgstr "A camada deve ser uma subclasse Group ou TileGrid." + +#~ msgid "MISO pin init failed." +#~ msgstr "A inicialização do pino MISO falhou." + +#~ msgid "MOSI pin init failed." +#~ msgstr "Inicialização do pino MOSI falhou." + +#~ msgid "Messages limited to 8 bytes" +#~ msgstr "As mensagens estão limitadas a 8 bytes" + +#, c-format +#~ msgid "More than %d report ids not supported" +#~ msgstr "Mais de %d reportam ids não compatíveis" + +#~ msgid "No hardware support on clk pin" +#~ msgstr "Sem suporte de hardware no pino de clock" + +#~ msgid "No hardware support on pin" +#~ msgstr "Nenhum suporte de hardware no pino" + +#, c-format +#~ msgid "Output buffer must be at least %d bytes" +#~ msgstr "O buffer de saída deve ter ao menos %d bytes" + +#~ msgid "" +#~ "PWM duty_cycle must be between 0 and 65535 inclusive (16 bit resolution)" +#~ msgstr "" +#~ "O duty_cycle do PWM deve estar entre 0 e inclusive 65535 (com resolução " +#~ "de 16 bits)" + +#~ msgid "Pin count must be at least 1" +#~ msgstr "A contagem dos pinos deve ser com pelo menos 1" + +#~ msgid "Pin does not have ADC capabilities" +#~ msgstr "O pino não tem recursos de ADC" + +#~ msgid "Program must contain at least one 16-bit instruction." +#~ msgstr "O programa deve conter pelo menos uma instrução com 16 bits." + +#~ msgid "Program too large" +#~ msgstr "O programa é muito grande" + +#~ msgid "RS485 Not yet supported on this device" +#~ msgstr "Ainda não há suporte para o RS485 neste dispositivo" + +#~ msgid "RTC calibration is not supported on this board" +#~ msgstr "A calibração RTC não é suportada nesta placa" + +#~ msgid "RTS/CTS/RS485 Not yet supported on this device" +#~ msgstr "RTS/CTS/RS485 Ainda não é compatível neste dispositivo" + +#~ msgid "SPI Init Error" +#~ msgstr "Houve um erro na inicialização SPI" + +#~ msgid "SPI Re-initialization error" +#~ msgstr "Houve um erro na reinicialização SPI" + +#~ msgid "Sample rate must be positive" +#~ msgstr "A taxa de amostragem deve ser positiva" + +#, c-format +#~ msgid "Sample rate too high. It must be less than %d" +#~ msgstr "Taxa de amostragem muito alta. Deve ser menor que %d" + +#~ msgid "Set pin count must be between 1 and 5" +#~ msgstr "A definição da contagem dos pinos deve estar entre 1 e 5" + +#~ msgid "Side set pin count must be between 1 and 5" +#~ msgstr "" +#~ "A definição da contagem dos pinos do conjunto lateral deve estar entre 1 " +#~ "e 5" + +#~ msgid "Stack size must be at least 256" +#~ msgstr "O tamanho da pilha deve ser pelo menos 256" + +#~ msgid "Tile value out of bounds" +#~ msgstr "O valor do bloco está fora dos limites" + +#~ msgid "UART Buffer allocation error" +#~ msgstr "Houve um erro na alocação do Buffer UART" + +#~ msgid "UART De-init error" +#~ msgstr "Houve um erro da não inicialização do UART" + +#~ msgid "UART Init Error" +#~ msgstr "Houve um erro na inicialização do UART" + +#~ msgid "UART Re-init error" +#~ msgstr "Houve um erro na reinicialização do UART" + +#~ msgid "UART write error" +#~ msgstr "Houve um erro na gravação UART" + +#~ msgid "Unsupported baudrate" +#~ msgstr "Taxa de transmissão não suportada" + +#~ msgid "WiFi password must be between 8 and 63 characters" +#~ msgstr "A senha do Wi-Fi deve ter entre 8 e 63 caracteres" + +#~ msgid "bits must be in range 5 to 9" +#~ msgstr "os bits devem estar na faixa entre 5 a 9" + +#~ msgid "bytes > 8 bits not supported" +#~ msgstr "bytes > 8 bits não suportado" + +#~ msgid "calibration value out of range +/-127" +#~ msgstr "Valor de calibração fora do intervalo +/- 127" + +#~ msgid "can only be registered in one parent" +#~ msgstr "pode ser registrado apenas numa principal" + +#~ msgid "circle can only be registered in one parent" +#~ msgstr "o círculo só pode ser registrado em um pai" + +#~ msgid "max_connections must be between 0 and 10" +#~ msgstr "max_connections deve estar entre 0 e 10" + +#~ msgid "max_length must be >= 0" +#~ msgstr "max_length deve ser >= 0" + +#~ msgid "polygon can only be registered in one parent" +#~ msgstr "o polígono só pode ser registrado em um pai" + +#~ msgid "pull_threshold must be between 1 and 32" +#~ msgstr "O pull_threshold deve ser entre 1 e 32" + +#~ msgid "push_threshold must be between 1 and 32" +#~ msgstr "O pull_threshold deve ser entre 1 e 32" + +#~ msgid "stop must be 1 or 2" +#~ msgstr "o stop deve ser 1 ou 2" + +#~ msgid "tile must be greater than zero" +#~ msgstr "o bloco deve ser maior que zero" + +#~ msgid "timeout must be >= 0.0" +#~ msgstr "o tempo limite deve ser >= 0,0" + +#, c-format +#~ msgid "width must be from 2 to 8 (inclusive), not %d" +#~ msgstr "a largura deve ser entre 2 a 8 (inclusive), não %d" + #~ msgid "Unsupported operation" #~ msgstr "Operação não suportada" @@ -5088,12 +5192,6 @@ msgstr "zi deve estar na forma (n_section, 2)" #~ msgid "can only save bytecode" #~ msgstr "apenas o bytecode pode ser salvo" -#~ msgid "invalid cert" -#~ msgstr "certificado inválido" - -#~ msgid "invalid key" -#~ msgstr "chave inválida" - #~ msgid "Viper functions don't currently support more than 4 arguments" #~ msgstr "Atualmente, as funções do Viper não suportam mais de 4 argumentos" @@ -5322,9 +5420,6 @@ msgstr "zi deve estar na forma (n_section, 2)" #~ msgid "wrong argument type" #~ msgstr "tipo do argumento errado" -#~ msgid "wrong index type" -#~ msgstr "tipo do índice errado" - #~ msgid "specify size or data, but not both" #~ msgstr "defina o tamanho ou os dados, porém não ambos" diff --git a/locale/ru.po b/locale/ru.po index 9b8778f71b..93fcc2ba0b 100644 --- a/locale/ru.po +++ b/locale/ru.po @@ -68,16 +68,38 @@ msgstr " вывод:\n" msgid "%%c requires int or char" msgstr "%%c требует int или char" +#: main.c +#, c-format +msgid "%02X" +msgstr "" + #: shared-bindings/rgbmatrix/RGBMatrix.c #, c-format msgid "" "%d address pins, %d rgb pins and %d tiles indicate a height of %d, not %d" msgstr "%d адресные пины, %d rgb пины и %d плитки указывают высоту %d а не %d" +#: ports/atmel-samd/common-hal/alarm/__init__.c +#: ports/cxd56/common-hal/analogio/AnalogOut.c ports/cxd56/common-hal/rtc/RTC.c +#: ports/espressif/common-hal/rtc/RTC.c +#: ports/mimxrt10xx/common-hal/analogio/AnalogOut.c +#: ports/mimxrt10xx/common-hal/rtc/RTC.c ports/nrf/common-hal/alarm/__init__.c +#: ports/nrf/common-hal/analogio/AnalogOut.c ports/nrf/common-hal/rtc/RTC.c +#: ports/raspberrypi/common-hal/alarm/__init__.c +#: ports/raspberrypi/common-hal/analogio/AnalogOut.c +#: ports/raspberrypi/common-hal/rtc/RTC.c ports/stm/common-hal/alarm/__init__.c +#: ports/stm/common-hal/rtc/RTC.c +msgid "%q" +msgstr "" + #: shared-bindings/microcontroller/Pin.c msgid "%q and %q contain duplicate pins" msgstr "%q и %q содержат пины-дупликаты" +#: ports/atmel-samd/common-hal/audioio/AudioOut.c +msgid "%q and %q must be different" +msgstr "" + #: shared-bindings/microcontroller/Pin.c msgid "%q contains duplicate pins" msgstr "%q содержит пины-дупликаты" @@ -86,16 +108,12 @@ msgstr "%q содержит пины-дупликаты" msgid "%q failure: %d" msgstr "%q сбой: %d" +#: shared-bindings/digitalio/DigitalInOut.c #: shared-bindings/microcontroller/Pin.c msgid "%q in use" msgstr "%q используется" -#: ports/atmel-samd/common-hal/pulseio/PulseIn.c -#: ports/cxd56/common-hal/pulseio/PulseIn.c -#: ports/nrf/common-hal/pulseio/PulseIn.c -#: ports/raspberrypi/common-hal/pulseio/PulseIn.c -#: ports/stm/common-hal/pulseio/PulseIn.c py/obj.c py/objstr.c -#: py/objstrunicode.c +#: py/obj.c py/objstr.c py/objstrunicode.c msgid "%q index out of range" msgstr "Индекс %q вне диапазона" @@ -103,14 +121,34 @@ msgstr "Индекс %q вне диапазона" msgid "%q indices must be integers, not %s" msgstr "Индексы %q должны быть целыми числами, а не %s" +#: shared-module/bitbangio/SPI.c +msgid "%q init failed" +msgstr "" + +#: py/argcheck.c +msgid "%q length must be %d" +msgstr "" + #: py/argcheck.c msgid "%q length must be %d-%d" msgstr "Длинна %q должна быть %d-%d" -#: shared-bindings/busio/I2C.c shared-bindings/usb_hid/Device.c +#: py/argcheck.c +msgid "%q length must be <= %d" +msgstr "" + +#: py/argcheck.c +msgid "%q length must be >= %d" +msgstr "" + +#: shared-bindings/busio/I2C.c msgid "%q length must be >= 1" msgstr "Длинна %q должна быть >= 1" +#: py/argcheck.c +msgid "%q must be %d" +msgstr "" + #: py/argcheck.c msgid "%q must be %d-%d" msgstr "%q должен быть %d-%d" @@ -127,30 +165,18 @@ msgstr "%q должен быть <= %d" msgid "%q must be >= %d" msgstr "%q должен быть >= %d" -#: py/argcheck.c shared-bindings/memorymonitor/AllocationAlarm.c -msgid "%q must be >= 0" -msgstr "%q должен быть >= 0" - -#: shared-bindings/_bleio/CharacteristicBuffer.c -#: shared-bindings/_bleio/PacketBuffer.c shared-bindings/displayio/Group.c -#: shared-bindings/displayio/Shape.c -#: shared-bindings/memorymonitor/AllocationAlarm.c -#: shared-bindings/vectorio/Circle.c shared-bindings/vectorio/Rectangle.c -msgid "%q must be >= 1" -msgstr "%q должен быть >= 1" +#: shared-bindings/analogbufio/BufferedIn.c +#: shared-bindings/audiocore/RawSample.c +msgid "%q must be a bytearray or array of type 'h', 'H', 'b', or 'B'" +msgstr "" #: py/argcheck.c msgid "%q must be a string" msgstr "%q должен быть строкой" -#: shared-module/vectorio/Polygon.c -msgid "%q must be a tuple of length 2" -msgstr "%q должен быть кортежем длинной 2" - -#: ports/espressif/common-hal/imagecapture/ParallelImageCapture.c -#: shared-module/vectorio/VectorShape.c -msgid "%q must be between %d and %d" -msgstr "%q должен быть между %d и %d" +#: py/argcheck.c +msgid "%q must be an int" +msgstr "" #: py/argcheck.c msgid "%q must be of type %q" @@ -168,7 +194,11 @@ msgstr "%q должен быть во 2-й степени" msgid "%q out of bounds" msgstr "%q за пределом" +#: ports/atmel-samd/common-hal/pulseio/PulseIn.c +#: ports/cxd56/common-hal/pulseio/PulseIn.c +#: ports/nrf/common-hal/pulseio/PulseIn.c #: ports/raspberrypi/common-hal/rp2pio/StateMachine.c +#: ports/stm/common-hal/pulseio/PulseIn.c py/argcheck.c #: shared-bindings/canio/Match.c msgid "%q out of range" msgstr "%q вне диапазона" @@ -177,10 +207,6 @@ msgstr "%q вне диапазона" msgid "%q pin invalid" msgstr "Пин %q не допустим" -#: shared-bindings/fontio/BuiltinFont.c -msgid "%q should be an int" -msgstr "%q должен быть int" - #: shared-bindings/usb_hid/Device.c msgid "%q with a report ID of 0 must be of length 1" msgstr "%q с идентификатором отчёта 0 должен иметь длину 1" @@ -193,7 +219,11 @@ msgstr "%q() принимает %d позиционных аргументов, msgid "%q, %q, and %q must all be the same length" msgstr "%q, %q, и %q должны быть одной длинны" -#: ports/espressif/bindings/espidf/__init__.c ports/espressif/esp_error.c +#: py/objint.c +msgid "%q=%q" +msgstr "" + +#: ports/espressif/common-hal/espidf/__init__.c ports/espressif/esp_error.c #, c-format msgid "%s error 0x%x" msgstr "%s ошибка 0x%x" @@ -278,7 +308,7 @@ msgstr "Объект '%s' не поддерживает присвоение э msgid "'%s' object doesn't support item deletion" msgstr "Объект '%s' не поддерживает удаление элементов" -#: py/runtime.c +#: ports/raspberrypi/common-hal/wifi/Radio.c py/runtime.c msgid "'%s' object has no attribute '%q'" msgstr "Объект '%s' не имеет атрибута '%q'" @@ -343,10 +373,6 @@ msgstr "'yield from' внутри асинхронной функции" msgid "'yield' outside function" msgstr "'yield' вне функции" -#: shared-module/vectorio/VectorShape.c -msgid "(x,y) integers required" -msgstr "Требуются целые числа (x,y)" - #: py/compile.c msgid "*x must be assignment target" msgstr "*x должно быть целью назначения" @@ -382,16 +408,12 @@ msgstr "ADC2 используется WiFi" msgid "Address must be %d bytes long" msgstr "Адрес должен быть длиной %d байт" -#: shared-bindings/_bleio/Address.c -msgid "Address type out of range" -msgstr "Тип адреса вне диапазона" - #: ports/espressif/common-hal/canio/CAN.c msgid "All CAN peripherals are in use" msgstr "Все периферийные устройства CAN уже используются" #: ports/espressif/common-hal/busio/I2C.c -#: ports/espressif/common-hal/i2cperipheral/I2CPeripheral.c +#: ports/espressif/common-hal/i2ctarget/I2CTarget.c #: ports/nrf/common-hal/busio/I2C.c msgid "All I2C peripherals are in use" msgstr "Все периферийные устройства I2C уже используются" @@ -428,7 +450,6 @@ msgstr "Все каналы уже используются" msgid "All event channels in use" msgstr "Все каналы событий уже используются" -#: ports/raspberrypi/common-hal/pulseio/PulseIn.c #: ports/raspberrypi/common-hal/rp2pio/StateMachine.c msgid "All state machines in use" msgstr "Все машины состояний уже используются" @@ -473,28 +494,10 @@ msgid "Already running" msgstr "Уже запущен" #: ports/espressif/common-hal/wifi/Radio.c +#: ports/raspberrypi/common-hal/wifi/Radio.c msgid "Already scanning for wifi networks" msgstr "Поиск сетей wifi уже происходит" -#: ports/cxd56/common-hal/analogio/AnalogIn.c -msgid "AnalogIn not supported on given pin" -msgstr "AnalogIn не поддерживается на данном пине" - -#: ports/cxd56/common-hal/analogio/AnalogOut.c -#: ports/mimxrt10xx/common-hal/analogio/AnalogOut.c -#: ports/nrf/common-hal/analogio/AnalogOut.c -#: ports/raspberrypi/common-hal/analogio/AnalogOut.c -msgid "AnalogOut functionality not supported" -msgstr "Функциональность AnalogOut не поддерживается" - -#: shared-bindings/analogio/AnalogOut.c -msgid "AnalogOut is only 16 bits. Value must be less than 65536." -msgstr "AnalogOut имеет только 16 бит. Значение должно быть меньше 65536." - -#: ports/atmel-samd/common-hal/analogio/AnalogOut.c -msgid "AnalogOut not supported on given pin" -msgstr "AnalogOut не поддерживается на данном пине" - #: ports/stm/common-hal/audiopwmio/PWMAudioOut.c msgid "Another PWMAudioOut is already active" msgstr "Другой PWMAudioOut уже активен" @@ -533,7 +536,7 @@ msgstr "Преобразование звука не реализовано" msgid "AuthMode.OPEN is not used with password" msgstr "AuthMode.OPEN не используется с паролем" -#: shared-bindings/wifi/Radio.c +#: shared-bindings/wifi/Radio.c supervisor/shared/web_workflow/web_workflow.c msgid "Authentication failure" msgstr "Ошибка аутентификации" @@ -570,11 +573,6 @@ msgstr "" "Битовый тактовый генератор и выбор слова должны использовать один источник " "тактирования" -#: shared-bindings/rgbmatrix/RGBMatrix.c -#, c-format -msgid "Bit depth must be from 1 to 6 inclusive, not %d" -msgstr "Битовая глубина должна быть от 1 до 6 включительно, а не %d" - #: shared-bindings/audiobusio/PDMIn.c msgid "Bit depth must be multiple of 8." msgstr "Битовая глубина должна быть кратна 8." @@ -616,11 +614,6 @@ msgstr "Буфер + сдвиг слишком малы %d %d %d" msgid "Buffer elements must be 4 bytes long or less" msgstr "Элементы буфера должны иметь длину не более 4 байт" -#: shared-module/usb_hid/Device.c -#, c-format -msgid "Buffer incorrect size. Should be %d bytes." -msgstr "Неправильный размер буфера. Должен быть %d байт." - #: shared-bindings/framebufferio/FramebufferDisplay.c msgid "Buffer is not a bytearray." msgstr "Буфер не является байтовым массивом (bytearray)." @@ -630,7 +623,6 @@ msgstr "Буфер не является байтовым массивом (byte msgid "Buffer is too small" msgstr "Буфер слишком мал" -#: ports/nrf/common-hal/audiopwmio/PWMAudioOut.c #: ports/stm/common-hal/audiopwmio/PWMAudioOut.c #, c-format msgid "Buffer length %d too big. It must be less than %d" @@ -645,10 +637,6 @@ msgstr "Размер буфера должен быть кратен 512" msgid "Buffer must be a multiple of 512 bytes" msgstr "Буфер должен быть кратен 512" -#: shared-bindings/bitbangio/I2C.c -msgid "Buffer must be at least length 1" -msgstr "Буфер должен быть размером не менее 1" - #: shared-bindings/_bleio/PacketBuffer.c #, c-format msgid "Buffer too short by %d bytes" @@ -670,10 +658,6 @@ msgstr "Пин шины %d уже используется" msgid "Byte buffer must be 16 bytes." msgstr "Буфер байтов должен быть размером 16 байтам." -#: shared-bindings/alarm/SleepMemory.c shared-bindings/nvm/ByteArray.c -msgid "Bytes must be between 0 and 255." -msgstr "Bytes должен быть в диапазоне от 0 до 255." - #: shared-bindings/aesio/aes.c msgid "CBC blocks must be multiples of 16 bytes" msgstr "Блоки CBC должны быть кратны 16 байтам" @@ -682,7 +666,7 @@ msgstr "Блоки CBC должны быть кратны 16 байтам" msgid "CIRCUITPY drive could not be found or created." msgstr "" -#: ports/espressif/bindings/espidf/__init__.c ports/espressif/esp_error.c +#: ports/espressif/common-hal/espidf/__init__.c ports/espressif/esp_error.c msgid "CRC or checksum was invalid" msgstr "CRC или контрольная сумма неправильная" @@ -690,6 +674,10 @@ msgstr "CRC или контрольная сумма неправильная" msgid "Call super().__init__() before accessing native object." msgstr "Вызовите super().__init__() перед обращением к родному объекту." +#: ports/cxd56/common-hal/camera/Camera.c +msgid "Camera init" +msgstr "" + #: ports/espressif/common-hal/alarm/pin/PinAlarm.c msgid "Can only alarm on RTC IO from deep sleep." msgstr "Сигнал из глубокого сна может подаваться только на пине RTC IO." @@ -743,19 +731,11 @@ msgstr "" "Невозможно иметь ответы сканирования для расширенных, подключаемых " "объявлений (advertisements)." -#: ports/atmel-samd/common-hal/audioio/AudioOut.c -msgid "Cannot output both channels on the same pin" -msgstr "Невозможно вывести оба канала на один пин" - #: ports/espressif/common-hal/alarm/pin/PinAlarm.c msgid "Cannot pull on input-only pin." msgstr "" "Невозможно установить подтяжку на пине, предназначенном только для ввода." -#: shared-module/bitbangio/SPI.c -msgid "Cannot read without MISO pin." -msgstr "Считывание невозможно без пина MISO." - #: shared-bindings/audiobusio/PDMIn.c msgid "Cannot record to a file" msgstr "Невозможно записать в файл" @@ -767,8 +747,8 @@ msgstr "Невозможно перемонтировать '/' пока он в #: ports/atmel-samd/common-hal/microcontroller/__init__.c #: ports/cxd56/common-hal/microcontroller/__init__.c #: ports/mimxrt10xx/common-hal/microcontroller/__init__.c -msgid "Cannot reset into bootloader because no bootloader is present." -msgstr "Невозможно перезагрузится в загрузчик так как он отсутствует." +msgid "Cannot reset into bootloader because no bootloader is present" +msgstr "" #: ports/espressif/common-hal/socketpool/Socket.c msgid "Cannot set socket options" @@ -788,22 +768,21 @@ msgid "Cannot subclass slice" msgstr "Срез субкласса невозможен" #: shared-module/bitbangio/SPI.c -msgid "Cannot transfer without MOSI and MISO pins." -msgstr "Передача данных невозможна без пинов MOSI и MISO." +msgid "Cannot transfer without MOSI and MISO pins" +msgstr "" #: shared-bindings/pwmio/PWMOut.c msgid "Cannot vary frequency on a timer that is already in use" msgstr "Невозможно изменить частоту на таймере, который уже используется" -#: ports/espressif/common-hal/alarm/pin/PinAlarm.c #: ports/nrf/common-hal/alarm/pin/PinAlarm.c +msgid "Cannot wake on pin edge, only level" +msgstr "" + +#: ports/espressif/common-hal/alarm/pin/PinAlarm.c msgid "Cannot wake on pin edge. Only level." msgstr "Невозможно проснуться по спаду/росту на пине. Только по уровню." -#: shared-module/bitbangio/SPI.c -msgid "Cannot write without MOSI pin." -msgstr "Запись невозможна без пина MOSI." - #: shared-bindings/_bleio/CharacteristicBuffer.c msgid "CharacteristicBuffer writing not provided" msgstr "Запись в CharacteristicBuffer не предусмотрена" @@ -816,10 +795,6 @@ msgstr "Код ядра CircuitPython сильно крашнулся. Упс!\n msgid "CircuitPython was unable to allocate the heap." msgstr "CircuitPython не смог выделить heap." -#: shared-module/bitbangio/SPI.c -msgid "Clock pin init failed." -msgstr "Не удалось инициализировать пин Clock." - #: shared-module/bitbangio/I2C.c msgid "Clock stretch too long" msgstr "Длинна такта слишком велика" @@ -828,11 +803,6 @@ msgstr "Длинна такта слишком велика" msgid "Clock unit in use" msgstr "Источник тактирования уже используется" -#: shared-bindings/displayio/FourWire.c shared-bindings/displayio/I2CDisplay.c -#: shared-bindings/paralleldisplay/ParallelBus.c -msgid "Command must be an int between 0 and 255" -msgstr "Команда должна быть целым числом (int) от 0 до 255" - #: shared-bindings/_bleio/Connection.c msgid "" "Connection has been disconnected and can no longer be used. Create a new " @@ -845,35 +815,6 @@ msgstr "" msgid "Corrupt .mpy file" msgstr "Файл .mpy поврежден" -#: ports/cxd56/common-hal/camera/Camera.c -msgid "Could not initialize Camera" -msgstr "Не удалось инициализировать камеру" - -#: ports/cxd56/common-hal/gnss/GNSS.c -msgid "Could not initialize GNSS" -msgstr "Не удалось инициализировать GNSS" - -#: ports/cxd56/common-hal/sdioio/SDCard.c -msgid "Could not initialize SDCard" -msgstr "Не удалось инициализировать SD карту" - -#: ports/atmel-samd/common-hal/busio/UART.c ports/cxd56/common-hal/busio/UART.c -#: ports/espressif/common-hal/busio/UART.c -msgid "Could not initialize UART" -msgstr "Не удалось инициализировать UART" - -#: ports/stm/common-hal/pwmio/PWMOut.c -msgid "Could not re-init channel" -msgstr "Не удалось повторно инициализировать канал" - -#: ports/stm/common-hal/pwmio/PWMOut.c -msgid "Could not re-init timer" -msgstr "Не удалось повторно инициализировать таймер" - -#: ports/stm/common-hal/pwmio/PWMOut.c -msgid "Could not restart PWM" -msgstr "Не удалось перезапустить ШИМ" - #: ports/espressif/common-hal/neopixel_write/__init__.c msgid "Could not retrieve clock" msgstr "Не удалось извлечь тактирование" @@ -894,20 +835,6 @@ msgstr "Не удалось запустить прерывание, RX заня msgid "Couldn't allocate decoder" msgstr "Не удалось выделить место для декодера" -#: shared-module/audiocore/WaveFile.c shared-module/audiomixer/Mixer.c -#: shared-module/audiomp3/MP3Decoder.c -msgid "Couldn't allocate first buffer" -msgstr "Не удалось выделить первый буфер" - -#: shared-module/audiomp3/MP3Decoder.c -msgid "Couldn't allocate input buffer" -msgstr "Не удалось выделить входной буфер" - -#: shared-module/audiocore/WaveFile.c shared-module/audiomixer/Mixer.c -#: shared-module/audiomp3/MP3Decoder.c -msgid "Couldn't allocate second buffer" -msgstr "Не удалось выделить второй буфер" - #: supervisor/shared/safe_mode.c msgid "Crash into the HardFault_Handler." msgstr "Крашнулся в HardFault_Handler." @@ -957,10 +884,6 @@ msgstr "Емкость destination меньше, чем destination_length." msgid "Device in use" msgstr "Устройство используется" -#: ports/cxd56/common-hal/digitalio/DigitalInOut.c -msgid "DigitalInOut not supported on given pin" -msgstr "DigitalInOut не поддерживается на данном пине" - #: shared-bindings/displayio/Display.c #: shared-bindings/framebufferio/FramebufferDisplay.c msgid "Display must have a 16 bit colorspace." @@ -972,6 +895,10 @@ msgstr "Дисплей должен иметь 16-битное цветовое msgid "Display rotation must be in 90 degree increments" msgstr "Поворот дисплея должен осуществляться с шагом 90 градусов" +#: main.c +msgid "Done" +msgstr "" + #: shared-bindings/digitalio/DigitalInOut.c msgid "Drive mode not used when direction is input." msgstr "Drive mode не используется, когда направление является входным." @@ -1005,21 +932,20 @@ msgstr "Ошибка в регулярном выражении(regex)" msgid "Error: Failure to bind" msgstr "Ошибка: Сбой привязки" -#: ports/raspberrypi/bindings/rp2pio/StateMachine.c py/enum.c -#: shared-bindings/_bleio/__init__.c shared-bindings/aesio/aes.c -#: shared-bindings/busio/SPI.c shared-bindings/microcontroller/Pin.c +#: py/enum.c shared-bindings/_bleio/__init__.c shared-bindings/aesio/aes.c +#: shared-bindings/alarm/__init__.c shared-bindings/busio/SPI.c +#: shared-bindings/microcontroller/Pin.c #: shared-bindings/neopixel_write/__init__.c msgid "Expected a %q" msgstr "Ожидалось(ся) %q" -#: shared-bindings/alarm/__init__.c -msgid "Expected an alarm" -msgstr "Ожидался сигнал" +#: ports/raspberrypi/bindings/cyw43/__init__.c +msgid "Expected a %q or %q" +msgstr "" -#: shared-module/adafruit_pixelbuf/PixelBuf.c -#, c-format -msgid "Expected tuple of length %d, got %d" -msgstr "Ожидался кортеж длины %d, получен %d" +#: shared-bindings/alarm/__init__.c +msgid "Expected an %q" +msgstr "" #: ports/espressif/common-hal/_bleio/Adapter.c #: ports/nrf/common-hal/_bleio/Adapter.c @@ -1047,21 +973,9 @@ msgstr "Не удалось отправить команду." msgid "Failed to acquire mutex, err 0x%04x" msgstr "Не удалось получить mutex, ошибка 0x%04x" -#: ports/mimxrt10xx/common-hal/busio/UART.c ports/nrf/common-hal/busio/UART.c -#: ports/raspberrypi/common-hal/busio/UART.c -msgid "Failed to allocate RX buffer" -msgstr "Не удалось выделить буфер RX" - -#: ports/atmel-samd/common-hal/busio/UART.c -#: ports/atmel-samd/common-hal/pulseio/PulseIn.c -#: ports/cxd56/common-hal/pulseio/PulseIn.c -#: ports/espressif/common-hal/pulseio/PulseIn.c -#: ports/nrf/common-hal/pulseio/PulseIn.c -#: ports/raspberrypi/common-hal/pulseio/PulseIn.c -#: ports/stm/common-hal/pulseio/PulseIn.c -#, c-format -msgid "Failed to allocate RX buffer of %d bytes" -msgstr "Не удалось выделить буфер RX размером %d байт" +#: shared-module/rgbmatrix/RGBMatrix.c +msgid "Failed to allocate %q buffer" +msgstr "" #: ports/espressif/common-hal/wifi/__init__.c msgid "Failed to allocate Wifi memory" @@ -1084,10 +998,6 @@ msgstr "Не удалось подключиться: внутренняя ош msgid "Failed to connect: timeout" msgstr "Не удалось подключиться: тайм-аут" -#: ports/espressif/common-hal/wifi/__init__.c -msgid "Failed to init wifi" -msgstr "Не удалось инициировать wifi" - #: shared-module/audiomp3/MP3Decoder.c msgid "Failed to parse MP3 file" msgstr "Не удалось распарсить файл MP3" @@ -1133,11 +1043,6 @@ msgstr "" msgid "Format not supported" msgstr "Формат не поддерживается" -#: shared-module/framebufferio/FramebufferDisplay.c -#, c-format -msgid "Framebuffer requires %d bytes" -msgstr "Фреймбуфер требует %d байт" - #: ports/mimxrt10xx/common-hal/microcontroller/Processor.c msgid "" "Frequency must be 24, 150, 396, 450, 528, 600, 720, 816, 912, 960 or 1008 Mhz" @@ -1154,7 +1059,11 @@ msgstr "" msgid "Function requires lock" msgstr "Функция требует блокировки" -#: ports/espressif/bindings/espidf/__init__.c ports/espressif/esp_error.c +#: ports/cxd56/common-hal/gnss/GNSS.c +msgid "GNSS init" +msgstr "" + +#: ports/espressif/common-hal/espidf/__init__.c ports/espressif/esp_error.c msgid "Generic Failure" msgstr "Общий сбой" @@ -1181,19 +1090,16 @@ msgstr "Оборудование занято, попробуйте исполь msgid "Hardware in use, try alternative pins" msgstr "Оборудование используется, попробуйте использовать другие пины" -#: shared-bindings/wifi/Radio.c -msgid "Hostname must be between 1 and 253 characters" -msgstr "Имя хоста должно содержать от 1 до 253 символов" - #: extmod/vfs_posix_file.c py/objstringio.c msgid "I/O operation on closed file" msgstr "Операция ввода-вывода на закрытом файле" #: ports/stm/common-hal/busio/I2C.c -msgid "I2C Init Error" -msgstr "Ошибка инициализации I2C" +msgid "I2C init error" +msgstr "" #: ports/raspberrypi/common-hal/busio/I2C.c +#: ports/raspberrypi/common-hal/i2ctarget/I2CTarget.c msgid "I2C peripheral in use" msgstr "Периферийное устройство I2C уже используется" @@ -1305,75 +1211,37 @@ msgstr "Внутренняя ошибка" msgid "Internal error #%d" msgstr "Внутренняя ошибка #%d" -#: shared-bindings/sdioio/SDCard.c shared-module/usb_hid/Device.c +#: supervisor/shared/safe_mode.c +msgid "Internal watchdog timer expired." +msgstr "" + +#: py/argcheck.c shared-bindings/digitalio/DigitalInOut.c msgid "Invalid %q" msgstr "Недопустимый %q" -#: ports/atmel-samd/common-hal/audiobusio/I2SOut.c -#: ports/atmel-samd/common-hal/audiobusio/PDMIn.c -#: ports/atmel-samd/common-hal/imagecapture/ParallelImageCapture.c -#: ports/mimxrt10xx/common-hal/busio/UART.c +#: shared-bindings/microcontroller/Pin.c msgid "Invalid %q pin" msgstr "Недопустимый пин %q" -#: ports/stm/common-hal/busio/I2C.c ports/stm/common-hal/busio/SPI.c -#: ports/stm/common-hal/busio/UART.c ports/stm/common-hal/canio/CAN.c -#: ports/stm/common-hal/sdioio/SDCard.c -msgid "Invalid %q pin selection" -msgstr "Неверный выбор пина %q" - #: ports/stm/common-hal/analogio/AnalogIn.c msgid "Invalid ADC Unit value" msgstr "Недопустимое значение единицы АЦП" -#: ports/espressif/common-hal/wifi/Radio.c -msgid "Invalid AuthMode" -msgstr "Недопустимый AuthMode" - #: ports/espressif/common-hal/_bleio/__init__.c #: ports/nrf/common-hal/_bleio/__init__.c msgid "Invalid BLE parameter" msgstr "Недопустимый параметр BLE" -#: shared-module/displayio/OnDiskBitmap.c -msgid "Invalid BMP file" -msgstr "Неправилный файл BMP" - #: shared-bindings/wifi/Radio.c msgid "Invalid BSSID" msgstr "Неверный BSSID" -#: ports/espressif/common-hal/analogio/AnalogOut.c -#: ports/stm/common-hal/analogio/AnalogOut.c -msgid "Invalid DAC pin supplied" -msgstr "Передан неверный пин ЦАП" - #: shared-bindings/wifi/Radio.c msgid "Invalid MAC address" msgstr "Неверный MAC-адрес" -#: shared-bindings/synthio/__init__.c -msgid "Invalid MIDI file" -msgstr "Неверный MIDI-файл" - -#: ports/atmel-samd/common-hal/pwmio/PWMOut.c -#: ports/cxd56/common-hal/pwmio/PWMOut.c -#: ports/espressif/common-hal/pwmio/PWMOut.c -#: ports/mimxrt10xx/common-hal/pwmio/PWMOut.c -#: ports/nrf/common-hal/pwmio/PWMOut.c -#: ports/raspberrypi/common-hal/pwmio/PWMOut.c shared-bindings/pwmio/PWMOut.c -msgid "Invalid PWM frequency" -msgstr "Недопустимая частота ШИМ" - -#: ports/espressif/common-hal/analogio/AnalogIn.c -msgid "Invalid Pin" -msgstr "Неверный пин" - -#: ports/espressif/bindings/espidf/__init__.c -#: ports/espressif/common-hal/busio/I2C.c -#: ports/espressif/common-hal/i2cperipheral/I2CPeripheral.c -#: ports/espressif/esp_error.c py/moduerrno.c -#: shared-module/rgbmatrix/RGBMatrix.c +#: ports/espressif/common-hal/espidf/__init__.c ports/espressif/esp_error.c +#: py/moduerrno.c msgid "Invalid argument" msgstr "Недопустимый аргумент" @@ -1381,42 +1249,11 @@ msgstr "Недопустимый аргумент" msgid "Invalid bits per value" msgstr "Недопустимое бит-на-значение" -#: ports/nrf/common-hal/busio/UART.c ports/raspberrypi/common-hal/busio/UART.c -#: ports/stm/common-hal/busio/UART.c -msgid "Invalid buffer size" -msgstr "Неверный размер буфера" - -#: shared-bindings/adafruit_pixelbuf/PixelBuf.c -msgid "Invalid byteorder string" -msgstr "Недействительная строка byteorder" - -#: ports/atmel-samd/common-hal/frequencyio/FrequencyIn.c -#: ports/espressif/common-hal/frequencyio/FrequencyIn.c -msgid "Invalid capture period. Valid range: 1 - 500" -msgstr "Неверный период захвата. Допустимый диапазон: 1 - 500" - -#: shared-bindings/audiomixer/Mixer.c -msgid "Invalid channel count" -msgstr "Недействительное количество каналов" - -#: ports/atmel-samd/common-hal/imagecapture/ParallelImageCapture.c -#, c-format -msgid "Invalid data_count %d" -msgstr "Недействительный data_count %d" - #: ports/atmel-samd/common-hal/imagecapture/ParallelImageCapture.c #, c-format msgid "Invalid data_pins[%d]" msgstr "Неверный data_pins[%d]" -#: shared-bindings/digitalio/DigitalInOut.c -msgid "Invalid direction." -msgstr "Неверное направление." - -#: shared-module/audiocore/WaveFile.c -msgid "Invalid file" -msgstr "Неверный файл" - #: shared-module/audiocore/WaveFile.c msgid "Invalid format chunk size" msgstr "Неверный размер блока формата" @@ -1425,107 +1262,27 @@ msgstr "Неверный размер блока формата" msgid "Invalid memory access." msgstr "Неправильный доступ к памяти." -#: extmod/vfs_fat_file.c -msgid "Invalid mode" -msgstr "" - #: ports/espressif/common-hal/wifi/Radio.c msgid "Invalid multicast MAC address" msgstr "Неверный MAC-адрес multicast" -#: shared-bindings/bitbangio/SPI.c shared-bindings/busio/SPI.c -msgid "Invalid number of bits" -msgstr "Неверное количество бит" - -#: shared-bindings/bitbangio/SPI.c shared-bindings/busio/SPI.c -#: shared-bindings/displayio/FourWire.c -msgid "Invalid phase" -msgstr "Неверная фаза" - -#: ports/atmel-samd/common-hal/audioio/AudioOut.c -#: ports/atmel-samd/common-hal/touchio/TouchIn.c -#: ports/espressif/common-hal/alarm/touch/TouchAlarm.c -#: ports/espressif/common-hal/touchio/TouchIn.c -#: ports/nrf/common-hal/alarm/pin/PinAlarm.c shared-bindings/pwmio/PWMOut.c -#: shared-module/rgbmatrix/RGBMatrix.c -msgid "Invalid pin" -msgstr "Недопустимый пин" - -#: ports/atmel-samd/common-hal/audioio/AudioOut.c -msgid "Invalid pin for left channel" -msgstr "Недопустимый пин для левого канала" - -#: ports/atmel-samd/common-hal/audioio/AudioOut.c -msgid "Invalid pin for right channel" -msgstr "Недопустимый пин для правого канала" - -#: ports/atmel-samd/common-hal/busio/I2C.c -#: ports/atmel-samd/common-hal/busio/SPI.c -#: ports/atmel-samd/common-hal/busio/UART.c -#: ports/atmel-samd/common-hal/i2cperipheral/I2CPeripheral.c -#: ports/cxd56/common-hal/busio/I2C.c ports/cxd56/common-hal/busio/SPI.c -#: ports/cxd56/common-hal/busio/UART.c ports/cxd56/common-hal/sdioio/SDCard.c -#: ports/espressif/common-hal/busio/I2C.c -#: ports/espressif/common-hal/busio/SPI.c -#: ports/espressif/common-hal/busio/UART.c -#: ports/espressif/common-hal/canio/CAN.c -#: ports/espressif/common-hal/i2cperipheral/I2CPeripheral.c -#: ports/mimxrt10xx/common-hal/busio/I2C.c -#: ports/mimxrt10xx/common-hal/busio/SPI.c -#: ports/mimxrt10xx/common-hal/usb_host/Port.c ports/nrf/common-hal/busio/I2C.c -#: ports/raspberrypi/common-hal/busio/I2C.c -#: ports/raspberrypi/common-hal/busio/SPI.c -#: ports/raspberrypi/common-hal/busio/UART.c shared-bindings/busio/SPI.c #: shared-bindings/busio/UART.c msgid "Invalid pins" msgstr "Недопустимые пины" -#: shared-bindings/bitbangio/SPI.c shared-bindings/busio/SPI.c -#: shared-bindings/displayio/FourWire.c -msgid "Invalid polarity" -msgstr "Неправильная полярность" - -#: shared-bindings/_bleio/Characteristic.c -msgid "Invalid properties" -msgstr "Недопустимые свойства" - -#: shared-bindings/microcontroller/__init__.c -msgid "Invalid run mode." -msgstr "Неверный режим работы." - -#: shared-module/_bleio/Attribute.c -msgid "Invalid security_mode" -msgstr "Неверный security_mode" - -#: ports/espressif/bindings/espidf/__init__.c ports/espressif/esp_error.c +#: ports/espressif/common-hal/espidf/__init__.c ports/espressif/esp_error.c msgid "Invalid size" msgstr "Неверный размер" #: ports/espressif/common-hal/ssl/SSLContext.c +#: ports/raspberrypi/common-hal/ssl/SSLSocket.c msgid "Invalid socket for TLS" msgstr "Неверный сокет для TLS" -#: ports/espressif/bindings/espidf/__init__.c ports/espressif/esp_error.c +#: ports/espressif/common-hal/espidf/__init__.c ports/espressif/esp_error.c msgid "Invalid state" msgstr "Неверное состояние" -#: shared-bindings/audiomixer/Mixer.c -msgid "Invalid voice" -msgstr "Неверный voice" - -#: shared-bindings/audiomixer/Mixer.c -msgid "Invalid voice count" -msgstr "Неверный счетчик voice" - -#: shared-module/audiocore/WaveFile.c -msgid "Invalid wave file" -msgstr "Неверный wave-файл" - -#: ports/mimxrt10xx/common-hal/busio/UART.c ports/nrf/common-hal/busio/UART.c -#: ports/raspberrypi/common-hal/busio/UART.c ports/stm/common-hal/busio/UART.c -msgid "Invalid word/bit length" -msgstr "Недопустимая длина слова/бита" - #: shared-bindings/aesio/aes.c msgid "Key must be 16, 24, or 32 bytes long" msgstr "Ключ должен быть длинной 16, 24 или 32 байта" @@ -1539,25 +1296,17 @@ msgid "LHS of keyword arg must be an id" msgstr "LHS ключевого слова arg должен быть идентификатором(id)" #: shared-module/displayio/Group.c -msgid "Layer already in a group." -msgstr "Слой уже в группе." +msgid "Layer already in a group" +msgstr "" #: shared-module/displayio/Group.c -msgid "Layer must be a Group or TileGrid subclass." -msgstr "Слой должен быть группой (Group) или субклассом TileGrid." +msgid "Layer must be a Group or TileGrid subclass" +msgstr "" -#: ports/espressif/bindings/espidf/__init__.c ports/espressif/esp_error.c +#: ports/espressif/common-hal/espidf/__init__.c ports/espressif/esp_error.c msgid "MAC address was invalid" msgstr "MAC адрес был недействительным" -#: shared-module/bitbangio/SPI.c -msgid "MISO pin init failed." -msgstr "Не удалось инициализировать пин MISO." - -#: shared-module/bitbangio/SPI.c -msgid "MOSI pin init failed." -msgstr "Не удалось инициализировать пин MOSI." - #: shared-bindings/is31fl3741/IS31FL3741.c msgid "Mapping must be a tuple" msgstr "" @@ -1567,10 +1316,6 @@ msgstr "" msgid "Maximum x value when mirrored is %d" msgstr "Максимальное значение x при зеркальном отображении - %d" -#: shared-bindings/canio/Message.c -msgid "Messages limited to 8 bytes" -msgstr "Сообщения ограничены 8 байтами" - #: shared-bindings/audiobusio/PDMIn.c msgid "Microphone startup delay must be in range 0.0 to 1.0" msgstr "Задержка включения микрофона должна быть в диапазоне от 0.0 до 1.0" @@ -1584,10 +1329,14 @@ msgstr "" msgid "Mismatched swap flag" msgstr "" -#: ports/mimxrt10xx/common-hal/busio/SPI.c ports/stm/common-hal/busio/SPI.c +#: ports/mimxrt10xx/common-hal/busio/SPI.c msgid "Missing MISO or MOSI Pin" msgstr "Отсутствует пин MISO или MOSI" +#: ports/stm/common-hal/busio/SPI.c +msgid "Missing MISO or MOSI pin" +msgstr "" + #: ports/raspberrypi/common-hal/rp2pio/StateMachine.c #, c-format msgid "Missing first_in_pin. Instruction %d reads pin(s)" @@ -1624,11 +1373,6 @@ msgstr "Отсутствует first_set_pin. Инструкция %d устан msgid "Missing jmp_pin. Instruction %d jumps on pin" msgstr "Отсутствует jmp_pin. Инструкция %d перепрыгивает на пин" -#: shared-module/usb_hid/Device.c -#, c-format -msgid "More than %d report ids not supported" -msgstr "Не поддерживается более %d идентификаторов отчетов (report ids)" - #: shared-bindings/busio/UART.c shared-bindings/displayio/Group.c msgid "Must be a %q subclass." msgstr "Должен быть субклассом %q." @@ -1688,16 +1432,28 @@ msgstr "" msgid "No I2C device at address: 0x%x" msgstr "" +#: supervisor/shared/web_workflow/web_workflow.c +msgid "No IP" +msgstr "" + #: ports/espressif/common-hal/busio/SPI.c -#: ports/mimxrt10xx/common-hal/busio/SPI.c ports/stm/common-hal/busio/SPI.c +#: ports/mimxrt10xx/common-hal/busio/SPI.c msgid "No MISO Pin" msgstr "Нет пина MISO" +#: ports/stm/common-hal/busio/SPI.c shared-module/bitbangio/SPI.c +msgid "No MISO pin" +msgstr "" + #: ports/espressif/common-hal/busio/SPI.c -#: ports/mimxrt10xx/common-hal/busio/SPI.c ports/stm/common-hal/busio/SPI.c +#: ports/mimxrt10xx/common-hal/busio/SPI.c msgid "No MOSI Pin" msgstr "Нет пина MOSI" +#: ports/stm/common-hal/busio/SPI.c shared-module/bitbangio/SPI.c +msgid "No MOSI pin" +msgstr "" + #: ports/atmel-samd/common-hal/busio/UART.c #: ports/espressif/common-hal/busio/UART.c #: ports/mimxrt10xx/common-hal/busio/UART.c ports/nrf/common-hal/busio/UART.c @@ -1736,16 +1492,6 @@ msgstr "Свободные GCLK отсутствуют" msgid "No hardware random available" msgstr "Отсутствует аппаратный генератор случайных чисел" -#: ports/atmel-samd/common-hal/ps2io/Ps2.c -msgid "No hardware support on clk pin" -msgstr "Отсутствует аппаратная поддержка пина clk" - -#: ports/atmel-samd/common-hal/alarm/pin/PinAlarm.c -#: ports/atmel-samd/common-hal/frequencyio/FrequencyIn.c -#: ports/atmel-samd/common-hal/pulseio/PulseIn.c -msgid "No hardware support on pin" -msgstr "Отсутствует аппаратная поддержка на пине" - #: ports/raspberrypi/common-hal/rp2pio/StateMachine.c msgid "No in in program" msgstr "Нет in в программе" @@ -1846,16 +1592,26 @@ msgstr "" msgid "Odd parity is not supported" msgstr "" +#: supervisor/shared/bluetooth/bluetooth.c +msgid "Off" +msgstr "" + +#: supervisor/shared/bluetooth/bluetooth.c +msgid "Ok" +msgstr "" + #: ports/atmel-samd/common-hal/audiobusio/PDMIn.c #: ports/raspberrypi/common-hal/audiobusio/PDMIn.c msgid "Only 8 or 16 bit mono with " msgstr "Только 8- или 16-битное моно с " #: ports/espressif/common-hal/wifi/__init__.c +#: ports/raspberrypi/common-hal/wifi/__init__.c msgid "Only IPv4 addresses supported" msgstr "Поддерживаются только адреса IPv4" -#: ports/espressif/common-hal/socketpool/SocketPool.c +#: ports/espressif/common-hal/socketpool/Socket.c +#: ports/raspberrypi/common-hal/socketpool/Socket.c msgid "Only IPv4 sockets supported" msgstr "Поддерживаются только сокеты IPv4" @@ -1890,15 +1646,19 @@ msgstr "" msgid "Only one TouchAlarm can be set in deep sleep." msgstr "" -#: ports/espressif/common-hal/i2cperipheral/I2CPeripheral.c +#: ports/espressif/common-hal/i2ctarget/I2CTarget.c +#: ports/raspberrypi/common-hal/i2ctarget/I2CTarget.c msgid "Only one address is allowed" msgstr "" #: ports/atmel-samd/common-hal/alarm/time/TimeAlarm.c -#: ports/espressif/common-hal/alarm/time/TimeAlarm.c #: ports/nrf/common-hal/alarm/time/TimeAlarm.c -#: ports/raspberrypi/common-hal/alarm/time/TimeAlarm.c #: ports/stm/common-hal/alarm/time/TimeAlarm.c +msgid "Only one alarm.time alarm can be set" +msgstr "" + +#: ports/espressif/common-hal/alarm/time/TimeAlarm.c +#: ports/raspberrypi/common-hal/alarm/time/TimeAlarm.c msgid "Only one alarm.time alarm can be set." msgstr "" @@ -1910,19 +1670,20 @@ msgstr "" msgid "Operation not permitted" msgstr "" -#: ports/espressif/bindings/espidf/__init__.c ports/espressif/esp_error.c +#: ports/espressif/common-hal/espidf/__init__.c ports/espressif/esp_error.c msgid "Operation or feature not supported" msgstr "" -#: ports/espressif/bindings/espidf/__init__.c ports/espressif/esp_error.c +#: ports/espressif/common-hal/espidf/__init__.c ports/espressif/esp_error.c msgid "Operation timed out" msgstr "" -#: ports/espressif/bindings/espidf/__init__.c ports/espressif/esp_error.c +#: ports/espressif/common-hal/espidf/__init__.c ports/espressif/esp_error.c msgid "Out of memory" msgstr "" -#: ports/espressif/common-hal/socketpool/SocketPool.c +#: ports/espressif/common-hal/socketpool/Socket.c +#: ports/raspberrypi/common-hal/socketpool/Socket.c msgid "Out of sockets" msgstr "" @@ -1930,11 +1691,6 @@ msgstr "" msgid "Out-buffer elements must be <= 4 bytes long" msgstr "" -#: shared-bindings/bitops/__init__.c -#, c-format -msgid "Output buffer must be at least %d bytes" -msgstr "" - #: shared-bindings/audiobusio/PDMIn.c msgid "Oversample must be multiple of 8." msgstr "" @@ -1945,12 +1701,11 @@ msgstr "" #: shared-bindings/pwmio/PWMOut.c msgid "" -"PWM duty_cycle must be between 0 and 65535 inclusive (16 bit resolution)" +"PWM frequency not writable when variable_frequency is False on construction." msgstr "" -#: shared-bindings/pwmio/PWMOut.c -msgid "" -"PWM frequency not writable when variable_frequency is False on construction." +#: ports/stm/common-hal/pwmio/PWMOut.c +msgid "PWM restart" msgstr "" #: ports/raspberrypi/common-hal/countio/Counter.c @@ -1969,36 +1724,20 @@ msgstr "" msgid "Permission denied" msgstr "" -#: ports/atmel-samd/common-hal/alarm/pin/PinAlarm.c #: ports/stm/common-hal/alarm/pin/PinAlarm.c msgid "Pin cannot wake from Deep Sleep" msgstr "Пин не может вывести из глубокого сна" -#: ports/raspberrypi/bindings/rp2pio/StateMachine.c -msgid "Pin count must be at least 1" -msgstr "Количество пинов должно быть не менее 1" - #: ports/raspberrypi/common-hal/rp2pio/StateMachine.c msgid "Pin count too large" msgstr "Слишком большое количество пинов" -#: ports/atmel-samd/common-hal/analogio/AnalogIn.c -#: ports/cxd56/common-hal/analogio/AnalogIn.c -#: ports/espressif/common-hal/analogio/AnalogIn.c -#: ports/mimxrt10xx/common-hal/analogio/AnalogIn.c -#: ports/nrf/common-hal/analogio/AnalogIn.c -#: ports/raspberrypi/common-hal/analogio/AnalogIn.c -#: ports/stm/common-hal/analogio/AnalogIn.c -msgid "Pin does not have ADC capabilities" -msgstr "Пин не имеет возможности АЦП" - #: ports/stm/common-hal/alarm/pin/PinAlarm.c #: ports/stm/common-hal/pulseio/PulseIn.c msgid "Pin interrupt already in use" msgstr "Прерывание пина уже используется" #: shared-bindings/adafruit_bus_device/spi_device/SPIDevice.c -#: shared-bindings/digitalio/DigitalInOut.c msgid "Pin is input only" msgstr "Пин является только входом" @@ -2063,18 +1802,10 @@ msgstr "" msgid "Program does OUT without loading OSR" msgstr "" -#: ports/raspberrypi/bindings/rp2pio/StateMachine.c -msgid "Program must contain at least one 16-bit instruction." -msgstr "" - #: ports/raspberrypi/bindings/rp2pio/StateMachine.c msgid "Program size invalid" msgstr "" -#: ports/raspberrypi/bindings/rp2pio/StateMachine.c -msgid "Program too large" -msgstr "" - #: shared-bindings/digitalio/DigitalInOut.c msgid "Pull not used when direction is output." msgstr "" @@ -2096,8 +1827,9 @@ msgstr "" msgid "RNG Init Error" msgstr "" -#: ports/nrf/common-hal/busio/UART.c -msgid "RS485 Not yet supported on this device" +#: ports/atmel-samd/common-hal/busio/UART.c ports/cxd56/common-hal/busio/UART.c +#: ports/nrf/common-hal/busio/UART.c ports/stm/common-hal/busio/UART.c +msgid "RS485" msgstr "" #: ports/espressif/common-hal/busio/UART.c @@ -2105,21 +1837,10 @@ msgstr "" msgid "RS485 inversion specified when not in RS485 mode" msgstr "" -#: ports/cxd56/common-hal/rtc/RTC.c ports/espressif/common-hal/rtc/RTC.c -#: ports/mimxrt10xx/common-hal/rtc/RTC.c ports/nrf/common-hal/rtc/RTC.c -#: ports/raspberrypi/common-hal/rtc/RTC.c -msgid "RTC calibration is not supported on this board" -msgstr "" - #: shared-bindings/alarm/time/TimeAlarm.c shared-bindings/time/__init__.c msgid "RTC is not supported on this board" msgstr "" -#: ports/atmel-samd/common-hal/busio/UART.c ports/cxd56/common-hal/busio/UART.c -#: ports/stm/common-hal/busio/UART.c -msgid "RTS/CTS/RS485 Not yet supported on this device" -msgstr "" - #: ports/stm/common-hal/os/__init__.c msgid "Random number generation error" msgstr "" @@ -2137,10 +1858,14 @@ msgstr "" msgid "Read-only object" msgstr "" -#: ports/espressif/bindings/espidf/__init__.c ports/espressif/esp_error.c +#: ports/espressif/common-hal/espidf/__init__.c ports/espressif/esp_error.c msgid "Received response was invalid" msgstr "" +#: supervisor/shared/bluetooth/bluetooth.c +msgid "Reconnecting" +msgstr "" + #: shared-bindings/displayio/EPaperDisplay.c msgid "Refresh too soon" msgstr "" @@ -2153,7 +1878,7 @@ msgstr "" msgid "Requested AES mode is unsupported" msgstr "" -#: ports/espressif/bindings/espidf/__init__.c ports/espressif/esp_error.c +#: ports/espressif/common-hal/espidf/__init__.c ports/espressif/esp_error.c msgid "Requested resource not found" msgstr "" @@ -2169,6 +1894,10 @@ msgstr "" msgid "SD card CSD format not supported" msgstr "" +#: ports/cxd56/common-hal/sdioio/SDCard.c +msgid "SDCard init" +msgstr "" + #: ports/stm/common-hal/sdioio/SDCard.c #, c-format msgid "SDIO GetCardInfo Error %d" @@ -2179,29 +1908,20 @@ msgstr "" msgid "SDIO Init Error %d" msgstr "" -#: ports/stm/common-hal/busio/SPI.c -msgid "SPI Init Error" -msgstr "" - -#: ports/stm/common-hal/busio/SPI.c -msgid "SPI Re-initialization error" -msgstr "" - #: ports/espressif/common-hal/busio/SPI.c msgid "SPI configuration failed" msgstr "" +#: ports/stm/common-hal/busio/SPI.c +msgid "SPI init error" +msgstr "" + #: ports/raspberrypi/common-hal/busio/SPI.c msgid "SPI peripheral in use" msgstr "" -#: shared-bindings/audiomixer/Mixer.c -msgid "Sample rate must be positive" -msgstr "" - -#: ports/atmel-samd/common-hal/audioio/AudioOut.c -#, c-format -msgid "Sample rate too high. It must be less than %d" +#: ports/stm/common-hal/busio/SPI.c +msgid "SPI re-init" msgstr "" #: shared-bindings/is31fl3741/FrameBuffer.c @@ -2222,14 +1942,6 @@ msgstr "" msgid "Server side context cannot have hostname" msgstr "" -#: ports/raspberrypi/bindings/rp2pio/StateMachine.c -msgid "Set pin count must be between 1 and 5" -msgstr "Число Set пинов должно быть от 1 до 5" - -#: ports/raspberrypi/bindings/rp2pio/StateMachine.c -msgid "Side set pin count must be between 1 and 5" -msgstr "" - #: ports/cxd56/common-hal/camera/Camera.c msgid "Size not supported" msgstr "" @@ -2250,6 +1962,7 @@ msgid "Slices not supported" msgstr "" #: ports/espressif/common-hal/socketpool/SocketPool.c +#: ports/raspberrypi/common-hal/socketpool/SocketPool.c msgid "SocketPool can only be used with wifi.radio" msgstr "" @@ -2265,10 +1978,6 @@ msgstr "Укажите точно один из data0 или data_pins" msgid "Splitting with sub-captures" msgstr "" -#: shared-bindings/supervisor/__init__.c -msgid "Stack size must be at least 256" -msgstr "" - #: ports/raspberrypi/common-hal/audiopwmio/PWMAudioOut.c msgid "Stereo left must be on PWM channel A" msgstr "" @@ -2277,10 +1986,6 @@ msgstr "" msgid "Stereo right must be on PWM channel B" msgstr "" -#: shared-bindings/multiterminal/__init__.c -msgid "Stream missing readinto() or write() method." -msgstr "" - #: ports/mimxrt10xx/common-hal/busio/UART.c ports/stm/common-hal/busio/UART.c msgid "Supply at least one UART pin" msgstr "Предоставьте хотяб один пин UART" @@ -2356,10 +2061,6 @@ msgstr "" msgid "Tile index out of bounds" msgstr "" -#: shared-bindings/displayio/TileGrid.c -msgid "Tile value out of bounds" -msgstr "" - #: shared-bindings/displayio/TileGrid.c msgid "Tile width must exactly divide bitmap width" msgstr "" @@ -2379,6 +2080,9 @@ msgid "To exit, please reset the board without " msgstr "" #: ports/atmel-samd/common-hal/audiobusio/I2SOut.c +msgid "Too many channels in sample" +msgstr "" + #: ports/raspberrypi/common-hal/audiobusio/I2SOut.c msgid "Too many channels in sample." msgstr "" @@ -2411,23 +2115,24 @@ msgid "Tuple or struct_time argument required" msgstr "" #: ports/stm/common-hal/busio/UART.c -msgid "UART Buffer allocation error" +msgid "UART de-init" +msgstr "" + +#: ports/atmel-samd/common-hal/busio/UART.c ports/cxd56/common-hal/busio/UART.c +#: ports/espressif/common-hal/busio/UART.c ports/stm/common-hal/busio/UART.c +msgid "UART init" msgstr "" #: ports/stm/common-hal/busio/UART.c -msgid "UART De-init error" +msgid "UART re-init" msgstr "" #: ports/stm/common-hal/busio/UART.c -msgid "UART Init Error" +msgid "UART write" msgstr "" -#: ports/stm/common-hal/busio/UART.c -msgid "UART Re-init error" -msgstr "" - -#: ports/stm/common-hal/busio/UART.c -msgid "UART write error" +#: main.c +msgid "UID:" msgstr "" #: shared-module/usb_hid/Device.c @@ -2553,6 +2258,11 @@ msgstr "" msgid "Unknown system firmware error: %d" msgstr "" +#: ports/raspberrypi/common-hal/wifi/__init__.c +#, c-format +msgid "Unkown error code %d" +msgstr "" + #: shared-bindings/adafruit_pixelbuf/PixelBuf.c #, c-format msgid "Unmatched number of items on RHS (expected %d, got %d)." @@ -2564,12 +2274,6 @@ msgid "" "declined or ignored." msgstr "" -#: ports/atmel-samd/common-hal/busio/I2C.c ports/cxd56/common-hal/busio/I2C.c -#: ports/espressif/common-hal/busio/UART.c -#: ports/raspberrypi/common-hal/busio/I2C.c ports/stm/common-hal/busio/I2C.c -msgid "Unsupported baudrate" -msgstr "" - #: shared-bindings/bitmaptools/__init__.c msgid "Unsupported colorspace" msgstr "" @@ -2582,6 +2286,10 @@ msgstr "" msgid "Unsupported format" msgstr "" +#: shared-bindings/hashlib/__init__.c +msgid "Unsupported hash algorithm" +msgstr "" + #: ports/espressif/common-hal/dualbank/__init__.c msgid "Update Failed" msgstr "" @@ -2600,7 +2308,7 @@ msgstr "" msgid "Value length > max_length" msgstr "" -#: ports/espressif/bindings/espidf/__init__.c ports/espressif/esp_error.c +#: ports/espressif/common-hal/espidf/__init__.c ports/espressif/esp_error.c msgid "Version was invalid" msgstr "" @@ -2630,10 +2338,6 @@ msgstr "" msgid "WatchDogTimer.timeout must be greater than 0" msgstr "" -#: supervisor/shared/safe_mode.c -msgid "Watchdog timer expired." -msgstr "" - #: py/builtinhelp.c #, c-format msgid "" @@ -2644,8 +2348,8 @@ msgid "" "To list built-in modules type `help(\"modules\")`.\n" msgstr "" -#: shared-bindings/wifi/Radio.c -msgid "WiFi password must be between 8 and 63 characters" +#: supervisor/shared/web_workflow/web_workflow.c +msgid "Wi-Fi: " msgstr "" #: main.c @@ -2686,11 +2390,7 @@ msgstr "" msgid "a bytes-like object is required" msgstr "" -#: shared-bindings/i2cperipheral/I2CPeripheral.c -msgid "address out of bounds" -msgstr "" - -#: shared-bindings/i2cperipheral/I2CPeripheral.c +#: shared-bindings/i2ctarget/I2CTarget.c msgid "addresses is empty" msgstr "" @@ -2739,6 +2439,10 @@ msgstr "" msgid "array and index length must be equal" msgstr "" +#: extmod/ulab/code/numpy/io/io.c +msgid "array has too many dimensions" +msgstr "" + #: py/objarray.c shared-bindings/alarm/SleepMemory.c #: shared-bindings/nvm/ByteArray.c msgid "array/bytes required on right side" @@ -2800,10 +2504,6 @@ msgstr "" msgid "bits must be 32 or less" msgstr "" -#: shared-bindings/busio/UART.c -msgid "bits must be in range 5 to 9" -msgstr "" - #: shared-bindings/audiomixer/Mixer.c msgid "bits_per_sample must be 8 or 16" msgstr "" @@ -2841,11 +2541,6 @@ msgstr "" msgid "byteorder is not a string" msgstr "" -#: ports/atmel-samd/common-hal/busio/UART.c -#: ports/espressif/common-hal/busio/UART.c -msgid "bytes > 8 bits not supported" -msgstr "" - #: py/objarray.c msgid "bytes length not a multiple of item size" msgstr "" @@ -2854,7 +2549,7 @@ msgstr "" msgid "bytes value out of range" msgstr "" -#: ports/atmel-samd/bindings/samd/Clock.c ports/atmel-samd/common-hal/rtc/RTC.c +#: ports/atmel-samd/bindings/samd/Clock.c msgid "calibration is out of range" msgstr "" @@ -2862,12 +2557,9 @@ msgstr "" msgid "calibration is read only" msgstr "" -#: ports/atmel-samd/common-hal/rtc/RTC.c -msgid "calibration value out of range +/-127" -msgstr "" - +#: shared-module/vectorio/Circle.c shared-module/vectorio/Polygon.c #: shared-module/vectorio/Rectangle.c -msgid "can only be registered in one parent" +msgid "can only have one parent" msgstr "" #: py/emitinlinethumb.c @@ -2890,8 +2582,7 @@ msgstr "" msgid "can't cancel self" msgstr "" -#: py/obj.c py/objint.c shared-bindings/i2cperipheral/I2CPeripheral.c -#: shared-module/adafruit_pixelbuf/PixelBuf.c +#: py/obj.c py/objint.c shared-module/adafruit_pixelbuf/PixelBuf.c msgid "can't convert %q to %q" msgstr "" @@ -3038,6 +2729,10 @@ msgstr "" msgid "casting" msgstr "" +#: ports/stm/common-hal/pwmio/PWMOut.c +msgid "channel re-init" +msgstr "" + #: shared-bindings/_stage/Text.c msgid "chars buffer too small" msgstr "" @@ -3050,10 +2745,6 @@ msgstr "" msgid "chr() arg not in range(256)" msgstr "" -#: shared-module/vectorio/Circle.c -msgid "circle can only be registered in one parent" -msgstr "" - #: shared-bindings/bitmaptools/__init__.c msgid "clip point must be (x,y) tuple" msgstr "" @@ -3078,10 +2769,6 @@ msgstr "" msgid "color must be between 0x000000 and 0xffffff" msgstr "" -#: shared-bindings/displayio/ColorConverter.c -msgid "color should be an int" -msgstr "" - #: py/emitnative.c msgid "comparison of int and uint" msgstr "" @@ -3118,6 +2805,10 @@ msgstr "" msgid "convolve arguments must not be empty" msgstr "" +#: extmod/ulab/code/numpy/io/io.c +msgid "corrupted file" +msgstr "" + #: extmod/ulab/code/numpy/poly.c msgid "could not invert Vandermonde matrix" msgstr "" @@ -3168,10 +2859,6 @@ msgstr "" msgid "destination buffer must be an array of type 'H' for bit_depth = 16" msgstr "" -#: shared-bindings/audiobusio/PDMIn.c -msgid "destination_length must be an int >= 0" -msgstr "" - #: py/objdict.c msgid "dict update sequence has wrong length" msgstr "" @@ -3209,6 +2896,10 @@ msgstr "" msgid "empty" msgstr "" +#: extmod/ulab/code/numpy/io/io.c +msgid "empty file" +msgstr "" + #: extmod/moduasyncio.c extmod/moduheapq.c extmod/modutimeq.c msgid "empty heap" msgstr "" @@ -3225,10 +2916,6 @@ msgstr "" msgid "end of format while looking for conversion specifier" msgstr "" -#: shared-bindings/displayio/Shape.c -msgid "end_x should be an int" -msgstr "" - #: shared-bindings/alarm/time/TimeAlarm.c msgid "epoch_time not supported on this board" msgstr "" @@ -3238,6 +2925,12 @@ msgstr "" msgid "error = 0x%08lX" msgstr "" +#: ports/espressif/common-hal/esp32_camera/Camera.c +msgid "" +"esp32_camera.Camera requires reserved PSRAM to be configured. See the " +"documentation for instructions." +msgstr "" + #: py/runtime.c msgid "exceptions must derive from BaseException" msgstr "" @@ -3312,7 +3005,7 @@ msgstr "" msgid "first argument must be a tuple of ndarrays" msgstr "" -#: extmod/ulab/code/numpy/vector.c +#: extmod/ulab/code/numpy/transform.c extmod/ulab/code/numpy/vector.c msgid "first argument must be an ndarray" msgstr "" @@ -3460,7 +3153,7 @@ msgstr "" msgid "incorrect padding" msgstr "" -#: extmod/ulab/code/ndarray.c +#: extmod/ulab/code/ndarray.c extmod/ulab/code/numpy/transform.c msgid "index is out of bounds" msgstr "" @@ -3478,6 +3171,10 @@ msgstr "" msgid "indices must be integers, slices, or Boolean lists" msgstr "" +#: ports/espressif/common-hal/busio/I2C.c +msgid "init I2C" +msgstr "" + #: extmod/ulab/code/scipy/optimize/optimize.c msgid "initial values must be iterable" msgstr "" @@ -3523,6 +3220,10 @@ msgstr "" msgid "input matrix is singular" msgstr "" +#: extmod/ulab/code/numpy/create.c +msgid "input must be 1- or 2-d" +msgstr "" + #: extmod/ulab/code/numpy/carray/carray.c msgid "input must be a 1D ndarray" msgstr "" @@ -3531,11 +3232,7 @@ msgstr "" msgid "input must be a dense ndarray" msgstr "" -#: extmod/ulab/code/numpy/create.c -msgid "input must be a tensor of rank 2" -msgstr "" - -#: extmod/ulab/code/numpy/create.c extmod/ulab/code/user/user.c +#: extmod/ulab/code/user/user.c msgid "input must be an ndarray" msgstr "" @@ -3585,6 +3282,10 @@ msgstr "" msgid "invalid bits_per_pixel %d, must be, 1, 2, 4, 8, 16, 24, or 32" msgstr "" +#: ports/raspberrypi/common-hal/ssl/SSLSocket.c +msgid "invalid cert" +msgstr "" + #: shared-bindings/bitmaptools/__init__.c #, c-format msgid "invalid element size %d for bits_per_pixel %d\n" @@ -3611,10 +3312,18 @@ msgstr "" msgid "invalid hostname" msgstr "" +#: ports/raspberrypi/common-hal/ssl/SSLSocket.c +msgid "invalid key" +msgstr "" + #: py/compile.c msgid "invalid micropython decorator" msgstr "" +#: ports/espressif/common-hal/esp32_camera/Camera.c +msgid "invalid setting" +msgstr "" + #: shared-bindings/random/__init__.c msgid "invalid step" msgstr "" @@ -3728,10 +3437,6 @@ msgstr "" msgid "matrix is not positive definite" msgstr "" -#: ports/espressif/common-hal/wifi/Radio.c -msgid "max_connections must be between 0 and 10" -msgstr "" - #: ports/espressif/common-hal/_bleio/Descriptor.c #: ports/nrf/common-hal/_bleio/Characteristic.c #: ports/nrf/common-hal/_bleio/Descriptor.c @@ -3739,12 +3444,8 @@ msgstr "" msgid "max_length must be 0-%d when fixed_length is %s" msgstr "" -#: shared-bindings/_bleio/Characteristic.c shared-bindings/_bleio/Descriptor.c -msgid "max_length must be >= 0" -msgstr "" - #: extmod/ulab/code/ndarray.c -msgid "maximum number of dimensions is 4" +msgid "maximum number of dimensions is " msgstr "" #: py/runtime.c @@ -3878,7 +3579,7 @@ msgstr "нет доступного контакта сброса" msgid "no response from SD card" msgstr "" -#: py/objobject.c py/runtime.c +#: ports/espressif/common-hal/esp32_camera/Camera.c py/objobject.c py/runtime.c msgid "no such attribute" msgstr "" @@ -3989,7 +3690,11 @@ msgstr "" msgid "odd-length string" msgstr "" -#: extmod/ulab/code/numpy/create.c extmod/ulab/code/utils/utils.c +#: supervisor/shared/web_workflow/web_workflow.c +msgid "off" +msgstr "" + +#: extmod/ulab/code/utils/utils.c msgid "offset is too large" msgstr "" @@ -4085,10 +3790,6 @@ msgstr "" msgid "palette must be 32 bytes long" msgstr "" -#: shared-bindings/displayio/Palette.c -msgid "palette_index should be an int" -msgstr "" - #: py/emitinlinextensa.c msgid "parameters must be registers in sequence a2 to a5" msgstr "" @@ -4113,10 +3814,6 @@ msgstr "" msgid "poll on file not available on win32" msgstr "" -#: shared-module/vectorio/Polygon.c -msgid "polygon can only be registered in one parent" -msgstr "" - #: ports/espressif/common-hal/pulseio/PulseIn.c msgid "pop from an empty PulseIn" msgstr "" @@ -4142,7 +3839,23 @@ msgstr "" msgid "pow() with 3 arguments requires integers" msgstr "" +#: ports/espressif/boards/adafruit_qtpy_esp32_pico/mpconfigboard.h +msgid "pressing BOOT button at start up.\n" +msgstr "" + +#: ports/espressif/boards/adafruit_feather_esp32_v2/mpconfigboard.h +msgid "pressing SW38 button at start up.\n" +msgstr "" + +#: ports/espressif/boards/hardkernel_odroid_go/mpconfigboard.h +msgid "pressing VOLUME button at start up.\n" +msgstr "" + #: ports/espressif/boards/adafruit_qtpy_esp32c3/mpconfigboard.h +#: ports/espressif/boards/beetle-esp32-c3/mpconfigboard.h +#: ports/espressif/boards/espressif_esp32s2_devkitc_1_n8r2/mpconfigboard.h +#: ports/espressif/boards/lolin_c3_mini/mpconfigboard.h +#: ports/espressif/boards/microdev_micro_c3/mpconfigboard.h #: supervisor/shared/safe_mode.c msgid "pressing boot button at start up.\n" msgstr "" @@ -4163,14 +3876,6 @@ msgstr "" msgid "pull masks conflict with direction masks" msgstr "" -#: ports/raspberrypi/bindings/rp2pio/StateMachine.c -msgid "pull_threshold must be between 1 and 32" -msgstr "" - -#: ports/raspberrypi/bindings/rp2pio/StateMachine.c -msgid "push_threshold must be between 1 and 32" -msgstr "" - #: extmod/modutimeq.c msgid "queue overflow" msgstr "" @@ -4222,12 +3927,6 @@ msgstr "" msgid "rsplit(None,n)" msgstr "" -#: shared-bindings/audiocore/RawSample.c -msgid "" -"sample_source buffer must be a bytearray or array of type 'h', 'H', 'b' or " -"'B'" -msgstr "" - #: ports/atmel-samd/common-hal/audiobusio/PDMIn.c #: ports/raspberrypi/common-hal/audiobusio/PDMIn.c msgid "sampling rate out of range" @@ -4325,26 +4024,14 @@ msgstr "" msgid "source_bitmap must have value_count of 8" msgstr "" -#: shared-bindings/wifi/Radio.c -msgid "ssid can't be more than 32 bytes" -msgstr "" - #: py/objstr.c msgid "start/end indices" msgstr "" -#: shared-bindings/displayio/Shape.c -msgid "start_x should be an int" -msgstr "" - #: shared-bindings/random/__init__.c msgid "step must be non-zero" msgstr "" -#: shared-bindings/busio/UART.c -msgid "stop must be 1 or 2" -msgstr "" - #: shared-bindings/random/__init__.c msgid "stop not reachable from start" msgstr "" @@ -4393,10 +4080,6 @@ msgstr "" msgid "threshold must be in the range 0-65536" msgstr "" -#: shared-bindings/rgbmatrix/RGBMatrix.c -msgid "tile must be greater than zero" -msgstr "" - #: shared-bindings/time/__init__.c msgid "time.struct_time() takes a 9-sequence" msgstr "" @@ -4416,10 +4099,6 @@ msgstr "" msgid "timeout must be < 655.35 secs" msgstr "" -#: shared-bindings/_bleio/CharacteristicBuffer.c -msgid "timeout must be >= 0.0" -msgstr "" - #: shared-module/sdcardio/SDCard.c msgid "timeout waiting for v1 card" msgstr "" @@ -4428,6 +4107,10 @@ msgstr "" msgid "timeout waiting for v2 card" msgstr "" +#: ports/stm/common-hal/pwmio/PWMOut.c +msgid "timer re-init" +msgstr "" + #: shared-bindings/time/__init__.c msgid "timestamp out of range for platform time_t" msgstr "" @@ -4493,14 +4176,10 @@ msgstr "" msgid "type is not an acceptable base type" msgstr "" -#: py/runtime.c +#: py/objgenerator.c py/runtime.c msgid "type object '%q' has no attribute '%q'" msgstr "" -#: py/objgenerator.c -msgid "type object 'generator' has no attribute '__await__'" -msgstr "" - #: py/objtype.c msgid "type takes 1 or 3 arguments" msgstr "" @@ -4559,7 +4238,6 @@ msgid "unreadable attribute" msgstr "" #: shared-bindings/displayio/TileGrid.c shared-bindings/vectorio/VectorShape.c -#: shared-module/vectorio/Polygon.c shared-module/vectorio/VectorShape.c msgid "unsupported %q type" msgstr "" @@ -4598,6 +4276,14 @@ msgstr "" msgid "unsupported types for %q: '%q', '%q'" msgstr "" +#: extmod/ulab/code/numpy/io/io.c +msgid "usecols is too high" +msgstr "" + +#: extmod/ulab/code/numpy/io/io.c +msgid "usecols keyword must be specified" +msgstr "" + #: py/objint.c #, c-format msgid "value must fit in %d byte(s)" @@ -4619,20 +4305,19 @@ msgstr "" msgid "watchdog timeout must be greater than 0" msgstr "" -#: shared-bindings/bitops/__init__.c -#, c-format -msgid "width must be from 2 to 8 (inclusive), not %d" -msgstr "" - #: shared-bindings/is31fl3741/FrameBuffer.c -#: shared-bindings/rgbmatrix/RGBMatrix.c msgid "width must be greater than zero" msgstr "" #: ports/espressif/common-hal/wifi/Radio.c +#: ports/raspberrypi/common-hal/wifi/Radio.c msgid "wifi is not enabled" msgstr "" +#: ports/raspberrypi/common-hal/wifi/Monitor.c +msgid "wifi.Monitor not available" +msgstr "" + #: shared-bindings/_bleio/Adapter.c msgid "window must be <= interval" msgstr "" @@ -4645,7 +4330,17 @@ msgstr "" msgid "wrong axis specified" msgstr "" -#: extmod/ulab/code/numpy/compare.c extmod/ulab/code/numpy/vector.c +#: extmod/ulab/code/numpy/io/io.c +msgid "wrong dtype" +msgstr "" + +#: extmod/ulab/code/numpy/transform.c +msgid "wrong index type" +msgstr "" + +#: extmod/ulab/code/numpy/compare.c extmod/ulab/code/numpy/create.c +#: extmod/ulab/code/numpy/io/io.c extmod/ulab/code/numpy/transform.c +#: extmod/ulab/code/numpy/vector.c msgid "wrong input type" msgstr "" @@ -4653,6 +4348,10 @@ msgstr "" msgid "wrong length of condition array" msgstr "" +#: extmod/ulab/code/numpy/transform.c +msgid "wrong length of index array" +msgstr "" + #: extmod/ulab/code/numpy/create.c py/objarray.c py/objstr.c msgid "wrong number of arguments" msgstr "" @@ -4673,10 +4372,6 @@ msgstr "" msgid "xTaskCreate failed" msgstr "" -#: shared-bindings/displayio/Shape.c -msgid "y should be an int" -msgstr "" - #: shared-module/displayio/Shape.c msgid "y value out of bounds" msgstr "" @@ -4697,6 +4392,250 @@ msgstr "zi должно быть типа float" msgid "zi must be of shape (n_section, 2)" msgstr "zi должен иметь форму (n_section, 2)" +#~ msgid "%q must be >= 0" +#~ msgstr "%q должен быть >= 0" + +#~ msgid "%q must be >= 1" +#~ msgstr "%q должен быть >= 1" + +#~ msgid "Expected an alarm" +#~ msgstr "Ожидался сигнал" + +#~ msgid "Failed to init wifi" +#~ msgstr "Не удалось инициировать wifi" + +#~ msgid "%q must be a tuple of length 2" +#~ msgstr "%q должен быть кортежем длинной 2" + +#~ msgid "%q must be between %d and %d" +#~ msgstr "%q должен быть между %d и %d" + +#~ msgid "%q should be an int" +#~ msgstr "%q должен быть int" + +#~ msgid "(x,y) integers required" +#~ msgstr "Требуются целые числа (x,y)" + +#~ msgid "Address type out of range" +#~ msgstr "Тип адреса вне диапазона" + +#~ msgid "AnalogIn not supported on given pin" +#~ msgstr "AnalogIn не поддерживается на данном пине" + +#~ msgid "AnalogOut functionality not supported" +#~ msgstr "Функциональность AnalogOut не поддерживается" + +#~ msgid "AnalogOut is only 16 bits. Value must be less than 65536." +#~ msgstr "AnalogOut имеет только 16 бит. Значение должно быть меньше 65536." + +#~ msgid "AnalogOut not supported on given pin" +#~ msgstr "AnalogOut не поддерживается на данном пине" + +#, c-format +#~ msgid "Bit depth must be from 1 to 6 inclusive, not %d" +#~ msgstr "Битовая глубина должна быть от 1 до 6 включительно, а не %d" + +#, c-format +#~ msgid "Buffer incorrect size. Should be %d bytes." +#~ msgstr "Неправильный размер буфера. Должен быть %d байт." + +#~ msgid "Buffer must be at least length 1" +#~ msgstr "Буфер должен быть размером не менее 1" + +#~ msgid "Bytes must be between 0 and 255." +#~ msgstr "Bytes должен быть в диапазоне от 0 до 255." + +#~ msgid "Cannot output both channels on the same pin" +#~ msgstr "Невозможно вывести оба канала на один пин" + +#~ msgid "Cannot read without MISO pin." +#~ msgstr "Считывание невозможно без пина MISO." + +#~ msgid "Cannot reset into bootloader because no bootloader is present." +#~ msgstr "Невозможно перезагрузится в загрузчик так как он отсутствует." + +#~ msgid "Cannot transfer without MOSI and MISO pins." +#~ msgstr "Передача данных невозможна без пинов MOSI и MISO." + +#~ msgid "Cannot write without MOSI pin." +#~ msgstr "Запись невозможна без пина MOSI." + +#~ msgid "Clock pin init failed." +#~ msgstr "Не удалось инициализировать пин Clock." + +#~ msgid "Command must be an int between 0 and 255" +#~ msgstr "Команда должна быть целым числом (int) от 0 до 255" + +#~ msgid "Could not initialize Camera" +#~ msgstr "Не удалось инициализировать камеру" + +#~ msgid "Could not initialize GNSS" +#~ msgstr "Не удалось инициализировать GNSS" + +#~ msgid "Could not initialize SDCard" +#~ msgstr "Не удалось инициализировать SD карту" + +#~ msgid "Could not initialize UART" +#~ msgstr "Не удалось инициализировать UART" + +#~ msgid "Could not re-init channel" +#~ msgstr "Не удалось повторно инициализировать канал" + +#~ msgid "Could not re-init timer" +#~ msgstr "Не удалось повторно инициализировать таймер" + +#~ msgid "Could not restart PWM" +#~ msgstr "Не удалось перезапустить ШИМ" + +#~ msgid "Couldn't allocate first buffer" +#~ msgstr "Не удалось выделить первый буфер" + +#~ msgid "Couldn't allocate input buffer" +#~ msgstr "Не удалось выделить входной буфер" + +#~ msgid "Couldn't allocate second buffer" +#~ msgstr "Не удалось выделить второй буфер" + +#~ msgid "DigitalInOut not supported on given pin" +#~ msgstr "DigitalInOut не поддерживается на данном пине" + +#, c-format +#~ msgid "Expected tuple of length %d, got %d" +#~ msgstr "Ожидался кортеж длины %d, получен %d" + +#~ msgid "Failed to allocate RX buffer" +#~ msgstr "Не удалось выделить буфер RX" + +#, c-format +#~ msgid "Failed to allocate RX buffer of %d bytes" +#~ msgstr "Не удалось выделить буфер RX размером %d байт" + +#, c-format +#~ msgid "Framebuffer requires %d bytes" +#~ msgstr "Фреймбуфер требует %d байт" + +#~ msgid "Hostname must be between 1 and 253 characters" +#~ msgstr "Имя хоста должно содержать от 1 до 253 символов" + +#~ msgid "I2C Init Error" +#~ msgstr "Ошибка инициализации I2C" + +#~ msgid "Invalid %q pin selection" +#~ msgstr "Неверный выбор пина %q" + +#~ msgid "Invalid AuthMode" +#~ msgstr "Недопустимый AuthMode" + +#~ msgid "Invalid BMP file" +#~ msgstr "Неправилный файл BMP" + +#~ msgid "Invalid DAC pin supplied" +#~ msgstr "Передан неверный пин ЦАП" + +#~ msgid "Invalid MIDI file" +#~ msgstr "Неверный MIDI-файл" + +#~ msgid "Invalid PWM frequency" +#~ msgstr "Недопустимая частота ШИМ" + +#~ msgid "Invalid Pin" +#~ msgstr "Неверный пин" + +#~ msgid "Invalid buffer size" +#~ msgstr "Неверный размер буфера" + +#~ msgid "Invalid byteorder string" +#~ msgstr "Недействительная строка byteorder" + +#~ msgid "Invalid capture period. Valid range: 1 - 500" +#~ msgstr "Неверный период захвата. Допустимый диапазон: 1 - 500" + +#~ msgid "Invalid channel count" +#~ msgstr "Недействительное количество каналов" + +#, c-format +#~ msgid "Invalid data_count %d" +#~ msgstr "Недействительный data_count %d" + +#~ msgid "Invalid direction." +#~ msgstr "Неверное направление." + +#~ msgid "Invalid file" +#~ msgstr "Неверный файл" + +#~ msgid "Invalid number of bits" +#~ msgstr "Неверное количество бит" + +#~ msgid "Invalid phase" +#~ msgstr "Неверная фаза" + +#~ msgid "Invalid pin" +#~ msgstr "Недопустимый пин" + +#~ msgid "Invalid pin for left channel" +#~ msgstr "Недопустимый пин для левого канала" + +#~ msgid "Invalid pin for right channel" +#~ msgstr "Недопустимый пин для правого канала" + +#~ msgid "Invalid polarity" +#~ msgstr "Неправильная полярность" + +#~ msgid "Invalid properties" +#~ msgstr "Недопустимые свойства" + +#~ msgid "Invalid run mode." +#~ msgstr "Неверный режим работы." + +#~ msgid "Invalid security_mode" +#~ msgstr "Неверный security_mode" + +#~ msgid "Invalid voice" +#~ msgstr "Неверный voice" + +#~ msgid "Invalid voice count" +#~ msgstr "Неверный счетчик voice" + +#~ msgid "Invalid wave file" +#~ msgstr "Неверный wave-файл" + +#~ msgid "Invalid word/bit length" +#~ msgstr "Недопустимая длина слова/бита" + +#~ msgid "Layer already in a group." +#~ msgstr "Слой уже в группе." + +#~ msgid "Layer must be a Group or TileGrid subclass." +#~ msgstr "Слой должен быть группой (Group) или субклассом TileGrid." + +#~ msgid "MISO pin init failed." +#~ msgstr "Не удалось инициализировать пин MISO." + +#~ msgid "MOSI pin init failed." +#~ msgstr "Не удалось инициализировать пин MOSI." + +#~ msgid "Messages limited to 8 bytes" +#~ msgstr "Сообщения ограничены 8 байтами" + +#, c-format +#~ msgid "More than %d report ids not supported" +#~ msgstr "Не поддерживается более %d идентификаторов отчетов (report ids)" + +#~ msgid "No hardware support on clk pin" +#~ msgstr "Отсутствует аппаратная поддержка пина clk" + +#~ msgid "No hardware support on pin" +#~ msgstr "Отсутствует аппаратная поддержка на пине" + +#~ msgid "Pin count must be at least 1" +#~ msgstr "Количество пинов должно быть не менее 1" + +#~ msgid "Pin does not have ADC capabilities" +#~ msgstr "Пин не имеет возможности АЦП" + +#~ msgid "Set pin count must be between 1 and 5" +#~ msgstr "Число Set пинов должно быть от 1 до 5" + #~ msgid "" #~ "\n" #~ "Code stopped by auto-reload.\n" diff --git a/locale/sv.po b/locale/sv.po index 80a5d6cb27..a2feec3e7a 100644 --- a/locale/sv.po +++ b/locale/sv.po @@ -6,7 +6,7 @@ msgstr "" "Project-Id-Version: PACKAGE VERSION\n" "Report-Msgid-Bugs-To: \n" "POT-Creation-Date: 2021-01-04 12:55-0600\n" -"PO-Revision-Date: 2022-05-14 12:35+0000\n" +"PO-Revision-Date: 2022-09-30 08:18+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.13-dev\n" +"X-Generator: Weblate 4.14.1\n" #: main.c msgid "" @@ -67,6 +67,11 @@ msgstr " utdata:\n" msgid "%%c requires int or char" msgstr "%%c kräver int eller char" +#: main.c +#, c-format +msgid "%02X" +msgstr "" + #: shared-bindings/rgbmatrix/RGBMatrix.c #, c-format msgid "" @@ -74,10 +79,27 @@ msgid "" msgstr "" "%d adresspinnar, %d rgb-pinnar och %d brickor anger en höjd på %d, inte %d" +#: ports/atmel-samd/common-hal/alarm/__init__.c +#: ports/cxd56/common-hal/analogio/AnalogOut.c ports/cxd56/common-hal/rtc/RTC.c +#: ports/espressif/common-hal/rtc/RTC.c +#: ports/mimxrt10xx/common-hal/analogio/AnalogOut.c +#: ports/mimxrt10xx/common-hal/rtc/RTC.c ports/nrf/common-hal/alarm/__init__.c +#: ports/nrf/common-hal/analogio/AnalogOut.c ports/nrf/common-hal/rtc/RTC.c +#: ports/raspberrypi/common-hal/alarm/__init__.c +#: ports/raspberrypi/common-hal/analogio/AnalogOut.c +#: ports/raspberrypi/common-hal/rtc/RTC.c ports/stm/common-hal/alarm/__init__.c +#: ports/stm/common-hal/rtc/RTC.c +msgid "%q" +msgstr "%q" + #: shared-bindings/microcontroller/Pin.c msgid "%q and %q contain duplicate pins" msgstr "%q och %q innehåller duplicerade pinnar" +#: ports/atmel-samd/common-hal/audioio/AudioOut.c +msgid "%q and %q must be different" +msgstr "%q och %q måste vara olika" + #: shared-bindings/microcontroller/Pin.c msgid "%q contains duplicate pins" msgstr "%q innehåller dubblettstift" @@ -86,16 +108,12 @@ msgstr "%q innehåller dubblettstift" msgid "%q failure: %d" msgstr "%q-fel: %d" +#: shared-bindings/digitalio/DigitalInOut.c #: shared-bindings/microcontroller/Pin.c msgid "%q in use" msgstr "%q används redan" -#: ports/atmel-samd/common-hal/pulseio/PulseIn.c -#: ports/cxd56/common-hal/pulseio/PulseIn.c -#: ports/nrf/common-hal/pulseio/PulseIn.c -#: ports/raspberrypi/common-hal/pulseio/PulseIn.c -#: ports/stm/common-hal/pulseio/PulseIn.c py/obj.c py/objstr.c -#: py/objstrunicode.c +#: py/obj.c py/objstr.c py/objstrunicode.c msgid "%q index out of range" msgstr "Index %q ligger utanför intervallet" @@ -103,14 +121,34 @@ msgstr "Index %q ligger utanför intervallet" msgid "%q indices must be integers, not %s" msgstr "Indexet %q måste vara ett heltal, inte %s" +#: shared-module/bitbangio/SPI.c +msgid "%q init failed" +msgstr "%q init misslyckades" + +#: py/argcheck.c +msgid "%q length must be %d" +msgstr "längden på %q måste vara %d" + #: py/argcheck.c msgid "%q length must be %d-%d" msgstr "längden på %q måste vara %d-%d" -#: shared-bindings/busio/I2C.c shared-bindings/usb_hid/Device.c +#: py/argcheck.c +msgid "%q length must be <= %d" +msgstr "längden på %q måste vara <= %d" + +#: py/argcheck.c +msgid "%q length must be >= %d" +msgstr "längden på %q måste vara >= %d" + +#: shared-bindings/busio/I2C.c msgid "%q length must be >= 1" msgstr "längden på %q måste vara >= 1" +#: py/argcheck.c +msgid "%q must be %d" +msgstr "%q måste vara %d" + #: py/argcheck.c msgid "%q must be %d-%d" msgstr "%q måste vara %d-%d" @@ -127,30 +165,20 @@ msgstr "%q måste vara <= %d" msgid "%q must be >= %d" msgstr "%q måste vara >= %d" -#: py/argcheck.c shared-bindings/memorymonitor/AllocationAlarm.c -msgid "%q must be >= 0" -msgstr "%q måste vara >= 0" - -#: shared-bindings/_bleio/CharacteristicBuffer.c -#: shared-bindings/_bleio/PacketBuffer.c shared-bindings/displayio/Group.c -#: shared-bindings/displayio/Shape.c -#: shared-bindings/memorymonitor/AllocationAlarm.c -#: shared-bindings/vectorio/Circle.c shared-bindings/vectorio/Rectangle.c -msgid "%q must be >= 1" -msgstr "%q måste vara >= 1" +#: shared-bindings/analogbufio/BufferedIn.c +#: shared-bindings/audiocore/RawSample.c +msgid "%q must be a bytearray or array of type 'h', 'H', 'b', or 'B'" +msgstr "" +"%q måste vara en bytearray eller en array av typen \"h\", \"H\", \"b\" eller " +"\"B\"" #: py/argcheck.c msgid "%q must be a string" msgstr "%q måste vara en sträng" -#: shared-module/vectorio/Polygon.c -msgid "%q must be a tuple of length 2" -msgstr "%q måste vara en tuple av längd 2" - -#: ports/espressif/common-hal/imagecapture/ParallelImageCapture.c -#: shared-module/vectorio/VectorShape.c -msgid "%q must be between %d and %d" -msgstr "%q måste vara mellan %d och %d" +#: py/argcheck.c +msgid "%q must be an int" +msgstr "%q måste vara en int" #: py/argcheck.c msgid "%q must be of type %q" @@ -168,7 +196,11 @@ msgstr "%q måste vara en potens av 2" msgid "%q out of bounds" msgstr "%q är utanför gränserna" +#: ports/atmel-samd/common-hal/pulseio/PulseIn.c +#: ports/cxd56/common-hal/pulseio/PulseIn.c +#: ports/nrf/common-hal/pulseio/PulseIn.c #: ports/raspberrypi/common-hal/rp2pio/StateMachine.c +#: ports/stm/common-hal/pulseio/PulseIn.c py/argcheck.c #: shared-bindings/canio/Match.c msgid "%q out of range" msgstr "%q utanför intervallet" @@ -177,10 +209,6 @@ msgstr "%q utanför intervallet" msgid "%q pin invalid" msgstr "Pinne %q ogiltig" -#: shared-bindings/fontio/BuiltinFont.c -msgid "%q should be an int" -msgstr "%q ska vara en int" - #: shared-bindings/usb_hid/Device.c msgid "%q with a report ID of 0 must be of length 1" msgstr "%q med report-ID 0 måste ha längd 1" @@ -193,7 +221,11 @@ msgstr "% q() tar %d positionsargument men %d gavs" msgid "%q, %q, and %q must all be the same length" msgstr "%q, %q och %q måste vara lika långa" -#: ports/espressif/bindings/espidf/__init__.c ports/espressif/esp_error.c +#: py/objint.c +msgid "%q=%q" +msgstr "%q=%q" + +#: ports/espressif/common-hal/espidf/__init__.c ports/espressif/esp_error.c #, c-format msgid "%s error 0x%x" msgstr "%s fel 0x%x" @@ -278,7 +310,7 @@ msgstr "Objektet '%s' stöder inte tilldelning" msgid "'%s' object doesn't support item deletion" msgstr "Objektet '%s' stöder inte borttagning" -#: py/runtime.c +#: ports/raspberrypi/common-hal/wifi/Radio.c py/runtime.c msgid "'%s' object has no attribute '%q'" msgstr "Objektet '%s' har inget attribut '%q'" @@ -343,10 +375,6 @@ msgstr "'yield from' i async-funktion" msgid "'yield' outside function" msgstr "'yield' utanför funktion" -#: shared-module/vectorio/VectorShape.c -msgid "(x,y) integers required" -msgstr "(x,y) heltal krävs" - #: py/compile.c msgid "*x must be assignment target" msgstr "*x måste vara mål för tilldelning" @@ -382,16 +410,12 @@ msgstr "ADC2 används av WiFi" msgid "Address must be %d bytes long" msgstr "Adressen måste vara %d byte lång" -#: shared-bindings/_bleio/Address.c -msgid "Address type out of range" -msgstr "Adresstyp utanför intervallet" - #: ports/espressif/common-hal/canio/CAN.c msgid "All CAN peripherals are in use" msgstr "All I2C-kringutrustning används" #: ports/espressif/common-hal/busio/I2C.c -#: ports/espressif/common-hal/i2cperipheral/I2CPeripheral.c +#: ports/espressif/common-hal/i2ctarget/I2CTarget.c #: ports/nrf/common-hal/busio/I2C.c msgid "All I2C peripherals are in use" msgstr "All I2C-kringutrustning används" @@ -428,7 +452,6 @@ msgstr "Alla kanaler används" msgid "All event channels in use" msgstr "Alla händelsekanaler används" -#: ports/raspberrypi/common-hal/pulseio/PulseIn.c #: ports/raspberrypi/common-hal/rp2pio/StateMachine.c msgid "All state machines in use" msgstr "Alla tillståndsmaskiner används" @@ -473,28 +496,10 @@ msgid "Already running" msgstr "Kör redan" #: ports/espressif/common-hal/wifi/Radio.c +#: ports/raspberrypi/common-hal/wifi/Radio.c msgid "Already scanning for wifi networks" msgstr "Skannar redan efter wifi-nätverk" -#: ports/cxd56/common-hal/analogio/AnalogIn.c -msgid "AnalogIn not supported on given pin" -msgstr "AnalogIn stöds inte på angiven pinne" - -#: ports/cxd56/common-hal/analogio/AnalogOut.c -#: ports/mimxrt10xx/common-hal/analogio/AnalogOut.c -#: ports/nrf/common-hal/analogio/AnalogOut.c -#: ports/raspberrypi/common-hal/analogio/AnalogOut.c -msgid "AnalogOut functionality not supported" -msgstr "AnalogOut-funktionalitet stöds inte" - -#: shared-bindings/analogio/AnalogOut.c -msgid "AnalogOut is only 16 bits. Value must be less than 65536." -msgstr "AnalogOut hanterar bara 16 bitar. Värdet måste vara mindre än 65536." - -#: ports/atmel-samd/common-hal/analogio/AnalogOut.c -msgid "AnalogOut not supported on given pin" -msgstr "AnalogOut stöds inte på angiven pinne" - #: ports/stm/common-hal/audiopwmio/PWMAudioOut.c msgid "Another PWMAudioOut is already active" msgstr "En annan PWMAudioOut är redan aktiv" @@ -533,7 +538,7 @@ msgstr "Ljudkonvertering inte implementerad" msgid "AuthMode.OPEN is not used with password" msgstr "AuthMode.OPEN används inte med lösenord" -#: shared-bindings/wifi/Radio.c +#: shared-bindings/wifi/Radio.c supervisor/shared/web_workflow/web_workflow.c msgid "Authentication failure" msgstr "Autentiseringsfel" @@ -566,11 +571,6 @@ msgstr "Bitklocka och word select måste vara sekventiella pinnar" 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 "Bitdjup måste vara inom 1 till 6, inte %d" - #: shared-bindings/audiobusio/PDMIn.c msgid "Bit depth must be multiple of 8." msgstr "Bitdjup måste vara multipel av 8." @@ -612,11 +612,6 @@ msgstr "Buffert + offset för liten %d %d %d" msgid "Buffer elements must be 4 bytes long or less" msgstr "Buffertelement måste vara fyra byte långa eller mindre" -#: shared-module/usb_hid/Device.c -#, c-format -msgid "Buffer incorrect size. Should be %d bytes." -msgstr "Buffert har felaktig storlek. Ska vara %d byte." - #: shared-bindings/framebufferio/FramebufferDisplay.c msgid "Buffer is not a bytearray." msgstr "Buffert är inte en bytearray." @@ -626,7 +621,6 @@ msgstr "Buffert är inte en bytearray." msgid "Buffer is too small" msgstr "Bufferten är för liten" -#: ports/nrf/common-hal/audiopwmio/PWMAudioOut.c #: ports/stm/common-hal/audiopwmio/PWMAudioOut.c #, c-format msgid "Buffer length %d too big. It must be less than %d" @@ -641,10 +635,6 @@ msgstr "Buffertlängd måste vara en multipel av 512" msgid "Buffer must be a multiple of 512 bytes" msgstr "Bufferten måste vara en multipel av 512 byte" -#: shared-bindings/bitbangio/I2C.c -msgid "Buffer must be at least length 1" -msgstr "Bufferten måste ha minst längd 1" - #: shared-bindings/_bleio/PacketBuffer.c #, c-format msgid "Buffer too short by %d bytes" @@ -666,10 +656,6 @@ msgstr "Busspinne %d används redan" msgid "Byte buffer must be 16 bytes." msgstr "Byte-buffert måste vara 16 byte." -#: shared-bindings/alarm/SleepMemory.c shared-bindings/nvm/ByteArray.c -msgid "Bytes must be between 0 and 255." -msgstr "Bytes måste vara mellan 0 och 255." - #: shared-bindings/aesio/aes.c msgid "CBC blocks must be multiples of 16 bytes" msgstr "CBC-block måste vara multiplar om 16 byte" @@ -678,7 +664,7 @@ msgstr "CBC-block måste vara multiplar om 16 byte" msgid "CIRCUITPY drive could not be found or created." msgstr "CIRCUITPY-enheten kunde inte hittas eller skapas." -#: ports/espressif/bindings/espidf/__init__.c ports/espressif/esp_error.c +#: ports/espressif/common-hal/espidf/__init__.c ports/espressif/esp_error.c msgid "CRC or checksum was invalid" msgstr "CRC eller checksumma var ogiltig" @@ -686,6 +672,10 @@ msgstr "CRC eller checksumma var ogiltig" msgid "Call super().__init__() before accessing native object." msgstr "Anropa super().__init__() innan du använder det ursprungliga objektet." +#: ports/cxd56/common-hal/camera/Camera.c +msgid "Camera init" +msgstr "Kamera init" + #: ports/espressif/common-hal/alarm/pin/PinAlarm.c msgid "Can only alarm on RTC IO from deep sleep." msgstr "Kan bara larma på RTC-IO från djupsömn." @@ -735,18 +725,10 @@ msgid "Cannot have scan responses for extended, connectable advertisements." msgstr "" "Det går inte att ha skanningssvar för utökade, anslutningsbara aviseringar." -#: ports/atmel-samd/common-hal/audioio/AudioOut.c -msgid "Cannot output both channels on the same pin" -msgstr "Det går inte att mata ut båda kanalerna på samma pinne" - #: ports/espressif/common-hal/alarm/pin/PinAlarm.c msgid "Cannot pull on input-only pin." msgstr "Kan bara använda pull på pinne för input." -#: shared-module/bitbangio/SPI.c -msgid "Cannot read without MISO pin." -msgstr "Kan inte läsa utan MISO-pinne." - #: shared-bindings/audiobusio/PDMIn.c msgid "Cannot record to a file" msgstr "Det går inte att spela in till en fil" @@ -758,9 +740,8 @@ msgstr "Det går inte att montera om '/' när den är synlig via USB." #: ports/atmel-samd/common-hal/microcontroller/__init__.c #: ports/cxd56/common-hal/microcontroller/__init__.c #: ports/mimxrt10xx/common-hal/microcontroller/__init__.c -msgid "Cannot reset into bootloader because no bootloader is present." -msgstr "" -"Det går inte att återställa till bootloader eftersom bootloader saknas." +msgid "Cannot reset into bootloader because no bootloader is present" +msgstr "Kan inte återställa till bootloader eftersom ingen bootloader finns" #: ports/espressif/common-hal/socketpool/Socket.c msgid "Cannot set socket options" @@ -780,22 +761,21 @@ msgid "Cannot subclass slice" msgstr "Det går inte att subklassa slice" #: shared-module/bitbangio/SPI.c -msgid "Cannot transfer without MOSI and MISO pins." -msgstr "Kan inte överföra utan MOSI- och MISO-pinnar." +msgid "Cannot transfer without MOSI and MISO pins" +msgstr "Det går inte att överföra utan MOSI- och MISO-pinnar" #: shared-bindings/pwmio/PWMOut.c msgid "Cannot vary frequency on a timer that is already in use" msgstr "Det går inte att ändra frekvensen på en timer som redan används" -#: ports/espressif/common-hal/alarm/pin/PinAlarm.c #: ports/nrf/common-hal/alarm/pin/PinAlarm.c +msgid "Cannot wake on pin edge, only level" +msgstr "Kan inte vakna på pin edge, bara nivå" + +#: ports/espressif/common-hal/alarm/pin/PinAlarm.c msgid "Cannot wake on pin edge. Only level." msgstr "Kan inte vakna på nivåskift, enbart nivå." -#: shared-module/bitbangio/SPI.c -msgid "Cannot write without MOSI pin." -msgstr "Kan inte skriva utan MOSI-pinne." - #: shared-bindings/_bleio/CharacteristicBuffer.c msgid "CharacteristicBuffer writing not provided" msgstr "Skrivning för CharacteristicBuffer är inte tillhandahållen" @@ -808,10 +788,6 @@ msgstr "CircuitPython kärnkod kraschade hårt. Hoppsan!\n" msgid "CircuitPython was unable to allocate the heap." msgstr "CircuitPython kunde inte allokera heap." -#: shared-module/bitbangio/SPI.c -msgid "Clock pin init failed." -msgstr "Initiering av klockpinne misslyckades." - #: shared-module/bitbangio/I2C.c msgid "Clock stretch too long" msgstr "Klockförlängning för lång" @@ -820,11 +796,6 @@ msgstr "Klockförlängning för lång" msgid "Clock unit in use" msgstr "Klockenhet används" -#: shared-bindings/displayio/FourWire.c shared-bindings/displayio/I2CDisplay.c -#: shared-bindings/paralleldisplay/ParallelBus.c -msgid "Command must be an int between 0 and 255" -msgstr "Kommandot måste vara en int mellan 0 och 255" - #: shared-bindings/_bleio/Connection.c msgid "" "Connection has been disconnected and can no longer be used. Create a new " @@ -837,35 +808,6 @@ msgstr "" msgid "Corrupt .mpy file" msgstr "Skadad .mpy-fil" -#: ports/cxd56/common-hal/camera/Camera.c -msgid "Could not initialize Camera" -msgstr "Kunde inte initiera Camera" - -#: ports/cxd56/common-hal/gnss/GNSS.c -msgid "Could not initialize GNSS" -msgstr "Kan inte initiera GNSS" - -#: ports/cxd56/common-hal/sdioio/SDCard.c -msgid "Could not initialize SDCard" -msgstr "Kan inte initiera SD-kort" - -#: ports/atmel-samd/common-hal/busio/UART.c ports/cxd56/common-hal/busio/UART.c -#: ports/espressif/common-hal/busio/UART.c -msgid "Could not initialize UART" -msgstr "Det gick inte att initiera UART" - -#: ports/stm/common-hal/pwmio/PWMOut.c -msgid "Could not re-init channel" -msgstr "Det gick inte att återinitiera kanalen" - -#: ports/stm/common-hal/pwmio/PWMOut.c -msgid "Could not re-init timer" -msgstr "Det gick inte att återinitiera timern" - -#: ports/stm/common-hal/pwmio/PWMOut.c -msgid "Could not restart PWM" -msgstr "Det gick inte att starta om PWM" - #: ports/espressif/common-hal/neopixel_write/__init__.c msgid "Could not retrieve clock" msgstr "Kunde inte hämta klocka" @@ -886,20 +828,6 @@ msgstr "Det gick inte att starta avbrott, RX upptagen" msgid "Couldn't allocate decoder" msgstr "Det gick inte att allokera avkodaren" -#: shared-module/audiocore/WaveFile.c shared-module/audiomixer/Mixer.c -#: shared-module/audiomp3/MP3Decoder.c -msgid "Couldn't allocate first buffer" -msgstr "Det gick inte att allokera den första bufferten" - -#: shared-module/audiomp3/MP3Decoder.c -msgid "Couldn't allocate input buffer" -msgstr "Det gick inte att allokera indatabufferten" - -#: shared-module/audiocore/WaveFile.c shared-module/audiomixer/Mixer.c -#: shared-module/audiomp3/MP3Decoder.c -msgid "Couldn't allocate second buffer" -msgstr "Det gick inte att allokera den andra bufferten" - #: supervisor/shared/safe_mode.c msgid "Crash into the HardFault_Handler." msgstr "Krasch in i HardFault_Handler." @@ -947,10 +875,6 @@ msgstr "Målkapaciteten är mindre än destination_length." msgid "Device in use" msgstr "Enheten används redan" -#: ports/cxd56/common-hal/digitalio/DigitalInOut.c -msgid "DigitalInOut not supported on given pin" -msgstr "DigitalInOut stöds inte på given pinne" - #: shared-bindings/displayio/Display.c #: shared-bindings/framebufferio/FramebufferDisplay.c msgid "Display must have a 16 bit colorspace." @@ -962,6 +886,10 @@ msgstr "Displayen måste ha en 16-bitars färgrymd." msgid "Display rotation must be in 90 degree increments" msgstr "Displayens rotation måste vara i steg om 90 grader" +#: main.c +msgid "Done" +msgstr "Klar" + #: shared-bindings/digitalio/DigitalInOut.c msgid "Drive mode not used when direction is input." msgstr "Drivläge används inte när riktning är input." @@ -995,21 +923,20 @@ msgstr "Fel i regex" msgid "Error: Failure to bind" msgstr "Fel: Bind misslyckades" -#: ports/raspberrypi/bindings/rp2pio/StateMachine.c py/enum.c -#: shared-bindings/_bleio/__init__.c shared-bindings/aesio/aes.c -#: shared-bindings/busio/SPI.c shared-bindings/microcontroller/Pin.c +#: py/enum.c shared-bindings/_bleio/__init__.c shared-bindings/aesio/aes.c +#: shared-bindings/alarm/__init__.c shared-bindings/busio/SPI.c +#: shared-bindings/microcontroller/Pin.c #: shared-bindings/neopixel_write/__init__.c msgid "Expected a %q" msgstr "Förväntade %q" -#: shared-bindings/alarm/__init__.c -msgid "Expected an alarm" -msgstr "Förväntade ett larm" +#: ports/raspberrypi/bindings/cyw43/__init__.c +msgid "Expected a %q or %q" +msgstr "Förväntade %q eller %q" -#: shared-module/adafruit_pixelbuf/PixelBuf.c -#, c-format -msgid "Expected tuple of length %d, got %d" -msgstr "Förväntad tupel med längd %d, fick %d" +#: shared-bindings/alarm/__init__.c +msgid "Expected an %q" +msgstr "Förväntade en %q" #: ports/espressif/common-hal/_bleio/Adapter.c #: ports/nrf/common-hal/_bleio/Adapter.c @@ -1037,21 +964,9 @@ msgstr "Det gick inte att skicka kommandot." msgid "Failed to acquire mutex, err 0x%04x" msgstr "Det gick inte att förvärva mutex, fel 0x%04x" -#: ports/mimxrt10xx/common-hal/busio/UART.c ports/nrf/common-hal/busio/UART.c -#: ports/raspberrypi/common-hal/busio/UART.c -msgid "Failed to allocate RX buffer" -msgstr "Det gick inte att tilldela RX-buffert" - -#: ports/atmel-samd/common-hal/busio/UART.c -#: ports/atmel-samd/common-hal/pulseio/PulseIn.c -#: ports/cxd56/common-hal/pulseio/PulseIn.c -#: ports/espressif/common-hal/pulseio/PulseIn.c -#: ports/nrf/common-hal/pulseio/PulseIn.c -#: ports/raspberrypi/common-hal/pulseio/PulseIn.c -#: ports/stm/common-hal/pulseio/PulseIn.c -#, c-format -msgid "Failed to allocate RX buffer of %d bytes" -msgstr "Det gick inte att allokera RX-bufferten på %d byte" +#: shared-module/rgbmatrix/RGBMatrix.c +msgid "Failed to allocate %q buffer" +msgstr "Det gick inte att allokera buffert för %q" #: ports/espressif/common-hal/wifi/__init__.c msgid "Failed to allocate Wifi memory" @@ -1074,10 +989,6 @@ msgstr "Det gick inte att ansluta: internt fel" msgid "Failed to connect: timeout" msgstr "Det gick inte att ansluta: timeout" -#: ports/espressif/common-hal/wifi/__init__.c -msgid "Failed to init wifi" -msgstr "Kunde inte initiera WiFi" - #: shared-module/audiomp3/MP3Decoder.c msgid "Failed to parse MP3 file" msgstr "Det gick inte att tolka MP3-filen" @@ -1121,11 +1032,6 @@ msgstr "För RGB-färgrymder måste indatabitmappen ha 16 bitar per pixel" msgid "Format not supported" msgstr "Formatet stöds inte" -#: shared-module/framebufferio/FramebufferDisplay.c -#, c-format -msgid "Framebuffer requires %d bytes" -msgstr "Framebuffer kräver %d byte" - #: ports/mimxrt10xx/common-hal/microcontroller/Processor.c msgid "" "Frequency must be 24, 150, 396, 450, 528, 600, 720, 816, 912, 960 or 1008 Mhz" @@ -1142,7 +1048,11 @@ msgstr "Frekvensen måste matcha befintlig PWMOut med den här timern" msgid "Function requires lock" msgstr "Funktionen kräver lås" -#: ports/espressif/bindings/espidf/__init__.c ports/espressif/esp_error.c +#: ports/cxd56/common-hal/gnss/GNSS.c +msgid "GNSS init" +msgstr "GNSS start" + +#: ports/espressif/common-hal/espidf/__init__.c ports/espressif/esp_error.c msgid "Generic Failure" msgstr "Allmänt fel" @@ -1169,19 +1079,16 @@ msgstr "Hårdvaran är upptagen, prova alternativa pinnar" msgid "Hardware in use, try alternative pins" msgstr "Hårdvaran används redan, prova alternativa pinnar" -#: shared-bindings/wifi/Radio.c -msgid "Hostname must be between 1 and 253 characters" -msgstr "Hostname måste vara mellan 1 och 253 tecken" - #: extmod/vfs_posix_file.c py/objstringio.c msgid "I/O operation on closed file" msgstr "I/O-operation på stängd fil" #: ports/stm/common-hal/busio/I2C.c -msgid "I2C Init Error" -msgstr "I2C init-fel" +msgid "I2C init error" +msgstr "I2C-initieringsfel" #: ports/raspberrypi/common-hal/busio/I2C.c +#: ports/raspberrypi/common-hal/i2ctarget/I2CTarget.c msgid "I2C peripheral in use" msgstr "I2C-enhet används redan" @@ -1290,75 +1197,37 @@ msgstr "Internt fel" msgid "Internal error #%d" msgstr "Internt fel #%d" -#: shared-bindings/sdioio/SDCard.c shared-module/usb_hid/Device.c +#: supervisor/shared/safe_mode.c +msgid "Internal watchdog timer expired." +msgstr "Intern watchdog-timer har löpt ut." + +#: py/argcheck.c shared-bindings/digitalio/DigitalInOut.c msgid "Invalid %q" msgstr "Ogiltig %q" -#: ports/atmel-samd/common-hal/audiobusio/I2SOut.c -#: ports/atmel-samd/common-hal/audiobusio/PDMIn.c -#: ports/atmel-samd/common-hal/imagecapture/ParallelImageCapture.c -#: ports/mimxrt10xx/common-hal/busio/UART.c +#: shared-bindings/microcontroller/Pin.c msgid "Invalid %q pin" msgstr "Ogiltig %q-pinne" -#: ports/stm/common-hal/busio/I2C.c ports/stm/common-hal/busio/SPI.c -#: ports/stm/common-hal/busio/UART.c ports/stm/common-hal/canio/CAN.c -#: ports/stm/common-hal/sdioio/SDCard.c -msgid "Invalid %q pin selection" -msgstr "Ogiltigt val av %q pinne" - #: ports/stm/common-hal/analogio/AnalogIn.c msgid "Invalid ADC Unit value" msgstr "Ogiltigt ADC-enhetsvärde" -#: ports/espressif/common-hal/wifi/Radio.c -msgid "Invalid AuthMode" -msgstr "Ogiltig AuthMode" - #: ports/espressif/common-hal/_bleio/__init__.c #: ports/nrf/common-hal/_bleio/__init__.c msgid "Invalid BLE parameter" msgstr "Ogiltig BLE-parameter" -#: shared-module/displayio/OnDiskBitmap.c -msgid "Invalid BMP file" -msgstr "Ogiltig BMP-fil" - #: shared-bindings/wifi/Radio.c msgid "Invalid BSSID" msgstr "Ogiltig BSSID" -#: ports/espressif/common-hal/analogio/AnalogOut.c -#: ports/stm/common-hal/analogio/AnalogOut.c -msgid "Invalid DAC pin supplied" -msgstr "Ogiltig DAC-pinne angiven" - #: shared-bindings/wifi/Radio.c msgid "Invalid MAC address" msgstr "Ogiltig MAC-adress" -#: shared-bindings/synthio/__init__.c -msgid "Invalid MIDI file" -msgstr "Ogiltig MIDI-fil" - -#: ports/atmel-samd/common-hal/pwmio/PWMOut.c -#: ports/cxd56/common-hal/pwmio/PWMOut.c -#: ports/espressif/common-hal/pwmio/PWMOut.c -#: ports/mimxrt10xx/common-hal/pwmio/PWMOut.c -#: ports/nrf/common-hal/pwmio/PWMOut.c -#: ports/raspberrypi/common-hal/pwmio/PWMOut.c shared-bindings/pwmio/PWMOut.c -msgid "Invalid PWM frequency" -msgstr "Ogiltig PWM-frekvens" - -#: ports/espressif/common-hal/analogio/AnalogIn.c -msgid "Invalid Pin" -msgstr "Ogiltig pinne" - -#: ports/espressif/bindings/espidf/__init__.c -#: ports/espressif/common-hal/busio/I2C.c -#: ports/espressif/common-hal/i2cperipheral/I2CPeripheral.c -#: ports/espressif/esp_error.c py/moduerrno.c -#: shared-module/rgbmatrix/RGBMatrix.c +#: ports/espressif/common-hal/espidf/__init__.c ports/espressif/esp_error.c +#: py/moduerrno.c msgid "Invalid argument" msgstr "Ogiltigt argument" @@ -1366,42 +1235,11 @@ msgstr "Ogiltigt argument" msgid "Invalid bits per value" msgstr "Ogiltigt värde för bitar per värde" -#: ports/nrf/common-hal/busio/UART.c ports/raspberrypi/common-hal/busio/UART.c -#: ports/stm/common-hal/busio/UART.c -msgid "Invalid buffer size" -msgstr "Ogiltig buffertstorlek" - -#: shared-bindings/adafruit_pixelbuf/PixelBuf.c -msgid "Invalid byteorder string" -msgstr "Ogiltig byteorder-sträng" - -#: ports/atmel-samd/common-hal/frequencyio/FrequencyIn.c -#: ports/espressif/common-hal/frequencyio/FrequencyIn.c -msgid "Invalid capture period. Valid range: 1 - 500" -msgstr "Ogiltig inspelningsperiod. Giltigt intervall: 1 - 500" - -#: shared-bindings/audiomixer/Mixer.c -msgid "Invalid channel count" -msgstr "Ogiltigt kanalantal" - -#: ports/atmel-samd/common-hal/imagecapture/ParallelImageCapture.c -#, c-format -msgid "Invalid data_count %d" -msgstr "Ogiltig data_count %d" - #: ports/atmel-samd/common-hal/imagecapture/ParallelImageCapture.c #, c-format msgid "Invalid data_pins[%d]" msgstr "Ogiltig data_pins[%d]" -#: shared-bindings/digitalio/DigitalInOut.c -msgid "Invalid direction." -msgstr "Ogiltig riktning." - -#: shared-module/audiocore/WaveFile.c -msgid "Invalid file" -msgstr "Felaktig fil" - #: shared-module/audiocore/WaveFile.c msgid "Invalid format chunk size" msgstr "Ogiltig formatsegmentstorlek" @@ -1410,107 +1248,27 @@ msgstr "Ogiltig formatsegmentstorlek" msgid "Invalid memory access." msgstr "Ogiltig minnesåtkomst." -#: extmod/vfs_fat_file.c -msgid "Invalid mode" -msgstr "Ogiltigt läge" - #: ports/espressif/common-hal/wifi/Radio.c msgid "Invalid multicast MAC address" msgstr "Ogiltig MAC-adress för multicast" -#: shared-bindings/bitbangio/SPI.c shared-bindings/busio/SPI.c -msgid "Invalid number of bits" -msgstr "Ogiltigt antal bitar" - -#: shared-bindings/bitbangio/SPI.c shared-bindings/busio/SPI.c -#: shared-bindings/displayio/FourWire.c -msgid "Invalid phase" -msgstr "Ogiltig fas" - -#: ports/atmel-samd/common-hal/audioio/AudioOut.c -#: ports/atmel-samd/common-hal/touchio/TouchIn.c -#: ports/espressif/common-hal/alarm/touch/TouchAlarm.c -#: ports/espressif/common-hal/touchio/TouchIn.c -#: ports/nrf/common-hal/alarm/pin/PinAlarm.c shared-bindings/pwmio/PWMOut.c -#: shared-module/rgbmatrix/RGBMatrix.c -msgid "Invalid pin" -msgstr "Ogiltig pinne" - -#: ports/atmel-samd/common-hal/audioio/AudioOut.c -msgid "Invalid pin for left channel" -msgstr "Ogiltig pinne för vänster kanal" - -#: ports/atmel-samd/common-hal/audioio/AudioOut.c -msgid "Invalid pin for right channel" -msgstr "Ogiltig pinne för höger kanal" - -#: ports/atmel-samd/common-hal/busio/I2C.c -#: ports/atmel-samd/common-hal/busio/SPI.c -#: ports/atmel-samd/common-hal/busio/UART.c -#: ports/atmel-samd/common-hal/i2cperipheral/I2CPeripheral.c -#: ports/cxd56/common-hal/busio/I2C.c ports/cxd56/common-hal/busio/SPI.c -#: ports/cxd56/common-hal/busio/UART.c ports/cxd56/common-hal/sdioio/SDCard.c -#: ports/espressif/common-hal/busio/I2C.c -#: ports/espressif/common-hal/busio/SPI.c -#: ports/espressif/common-hal/busio/UART.c -#: ports/espressif/common-hal/canio/CAN.c -#: ports/espressif/common-hal/i2cperipheral/I2CPeripheral.c -#: ports/mimxrt10xx/common-hal/busio/I2C.c -#: ports/mimxrt10xx/common-hal/busio/SPI.c -#: ports/mimxrt10xx/common-hal/usb_host/Port.c ports/nrf/common-hal/busio/I2C.c -#: ports/raspberrypi/common-hal/busio/I2C.c -#: ports/raspberrypi/common-hal/busio/SPI.c -#: ports/raspberrypi/common-hal/busio/UART.c shared-bindings/busio/SPI.c #: shared-bindings/busio/UART.c msgid "Invalid pins" msgstr "Ogiltiga pinnar" -#: shared-bindings/bitbangio/SPI.c shared-bindings/busio/SPI.c -#: shared-bindings/displayio/FourWire.c -msgid "Invalid polarity" -msgstr "Ogiltig polaritet" - -#: shared-bindings/_bleio/Characteristic.c -msgid "Invalid properties" -msgstr "Ogiltiga egenskaper" - -#: shared-bindings/microcontroller/__init__.c -msgid "Invalid run mode." -msgstr "Ogiltigt körläge." - -#: shared-module/_bleio/Attribute.c -msgid "Invalid security_mode" -msgstr "Ogiltigt säkerhetsläge" - -#: ports/espressif/bindings/espidf/__init__.c ports/espressif/esp_error.c +#: ports/espressif/common-hal/espidf/__init__.c ports/espressif/esp_error.c msgid "Invalid size" msgstr "Ogiltig storlek" #: ports/espressif/common-hal/ssl/SSLContext.c +#: ports/raspberrypi/common-hal/ssl/SSLSocket.c msgid "Invalid socket for TLS" msgstr "Ogiltig socket för TLS" -#: ports/espressif/bindings/espidf/__init__.c ports/espressif/esp_error.c +#: ports/espressif/common-hal/espidf/__init__.c ports/espressif/esp_error.c msgid "Invalid state" msgstr "Ogiltigt tillstånd" -#: shared-bindings/audiomixer/Mixer.c -msgid "Invalid voice" -msgstr "Ogiltig kanal" - -#: shared-bindings/audiomixer/Mixer.c -msgid "Invalid voice count" -msgstr "Ogiltigt kanalantal" - -#: shared-module/audiocore/WaveFile.c -msgid "Invalid wave file" -msgstr "Ogiltig wave-fil" - -#: ports/mimxrt10xx/common-hal/busio/UART.c ports/nrf/common-hal/busio/UART.c -#: ports/raspberrypi/common-hal/busio/UART.c ports/stm/common-hal/busio/UART.c -msgid "Invalid word/bit length" -msgstr "Ogiltig word-/bitlängd" - #: shared-bindings/aesio/aes.c msgid "Key must be 16, 24, or 32 bytes long" msgstr "Nyckeln måste vara 16, 24 eller 32 byte lång" @@ -1524,25 +1282,17 @@ msgid "LHS of keyword arg must be an id" msgstr "LHS av keword arg måste vara ett id" #: shared-module/displayio/Group.c -msgid "Layer already in a group." -msgstr "Lagret finns redan i en grupp." +msgid "Layer already in a group" +msgstr "Layer är redan med i en grupp" #: shared-module/displayio/Group.c -msgid "Layer must be a Group or TileGrid subclass." -msgstr "Layer måste vara en subklass av Group eller TileGrid." +msgid "Layer must be a Group or TileGrid subclass" +msgstr "Layer måste vara en underklass av Group eller TileGrid" -#: ports/espressif/bindings/espidf/__init__.c ports/espressif/esp_error.c +#: ports/espressif/common-hal/espidf/__init__.c ports/espressif/esp_error.c msgid "MAC address was invalid" msgstr "MAC-adressen var ogiltig" -#: shared-module/bitbangio/SPI.c -msgid "MISO pin init failed." -msgstr "init för MISO-pinne misslyckades." - -#: shared-module/bitbangio/SPI.c -msgid "MOSI pin init failed." -msgstr "init för MOSI-pinne misslyckades." - #: shared-bindings/is31fl3741/IS31FL3741.c msgid "Mapping must be a tuple" msgstr "Mappning måste vara en tuple" @@ -1552,10 +1302,6 @@ msgstr "Mappning måste vara en tuple" msgid "Maximum x value when mirrored is %d" msgstr "Maximum x-värde vid spegling är %d" -#: shared-bindings/canio/Message.c -msgid "Messages limited to 8 bytes" -msgstr "Meddelanden begränsad till 8 byte" - #: shared-bindings/audiobusio/PDMIn.c msgid "Microphone startup delay must be in range 0.0 to 1.0" msgstr "" @@ -1570,10 +1316,14 @@ msgstr "Datastorlek matchar inte" msgid "Mismatched swap flag" msgstr "Felaktig swapflagga" -#: ports/mimxrt10xx/common-hal/busio/SPI.c ports/stm/common-hal/busio/SPI.c +#: ports/mimxrt10xx/common-hal/busio/SPI.c msgid "Missing MISO or MOSI Pin" msgstr "MISO- eller MOSI-pinne saknas" +#: ports/stm/common-hal/busio/SPI.c +msgid "Missing MISO or MOSI pin" +msgstr "Saknad MISO- eller MOSI-pinne" + #: ports/raspberrypi/common-hal/rp2pio/StateMachine.c #, c-format msgid "Missing first_in_pin. Instruction %d reads pin(s)" @@ -1609,11 +1359,6 @@ msgstr "Saknad first_set_pin. Instruktion %d sätter pinnar" msgid "Missing jmp_pin. Instruction %d jumps on pin" msgstr "Saknar jmp_pin. Instruktion %d hoppar på pin" -#: shared-module/usb_hid/Device.c -#, c-format -msgid "More than %d report ids not supported" -msgstr "Fler än %d rapport-id stöds inte" - #: shared-bindings/busio/UART.c shared-bindings/displayio/Group.c msgid "Must be a %q subclass." msgstr "Måste vara en %q-subklass." @@ -1673,16 +1418,28 @@ msgstr "Ingen DMA pacing timer hittades" msgid "No I2C device at address: 0x%x" msgstr "Ingen I2C-enhet på adress: 0x%x" +#: supervisor/shared/web_workflow/web_workflow.c +msgid "No IP" +msgstr "Ingen IP" + #: ports/espressif/common-hal/busio/SPI.c -#: ports/mimxrt10xx/common-hal/busio/SPI.c ports/stm/common-hal/busio/SPI.c +#: ports/mimxrt10xx/common-hal/busio/SPI.c msgid "No MISO Pin" msgstr "Ingen MISO-pinne" +#: ports/stm/common-hal/busio/SPI.c shared-module/bitbangio/SPI.c +msgid "No MISO pin" +msgstr "Ingen MISO-pinne" + #: ports/espressif/common-hal/busio/SPI.c -#: ports/mimxrt10xx/common-hal/busio/SPI.c ports/stm/common-hal/busio/SPI.c +#: ports/mimxrt10xx/common-hal/busio/SPI.c msgid "No MOSI Pin" msgstr "Ingen MOSI-pinne" +#: ports/stm/common-hal/busio/SPI.c shared-module/bitbangio/SPI.c +msgid "No MOSI pin" +msgstr "Ingen MOSI-pinne" + #: ports/atmel-samd/common-hal/busio/UART.c #: ports/espressif/common-hal/busio/UART.c #: ports/mimxrt10xx/common-hal/busio/UART.c ports/nrf/common-hal/busio/UART.c @@ -1721,16 +1478,6 @@ msgstr "Inga fria GCLK: er" msgid "No hardware random available" msgstr "Ingen hårdvaru-random tillgänglig" -#: ports/atmel-samd/common-hal/ps2io/Ps2.c -msgid "No hardware support on clk pin" -msgstr "Inget hårdvarustöd på clk-pinne" - -#: ports/atmel-samd/common-hal/alarm/pin/PinAlarm.c -#: ports/atmel-samd/common-hal/frequencyio/FrequencyIn.c -#: ports/atmel-samd/common-hal/pulseio/PulseIn.c -msgid "No hardware support on pin" -msgstr "Inget hårdvarustöd på pinne" - #: ports/raspberrypi/common-hal/rp2pio/StateMachine.c msgid "No in in program" msgstr "Inget in i programmet" @@ -1830,16 +1577,26 @@ msgstr "" msgid "Odd parity is not supported" msgstr "Udda paritet stöds inte" +#: supervisor/shared/bluetooth/bluetooth.c +msgid "Off" +msgstr "Av" + +#: supervisor/shared/bluetooth/bluetooth.c +msgid "Ok" +msgstr "OK" + #: ports/atmel-samd/common-hal/audiobusio/PDMIn.c #: ports/raspberrypi/common-hal/audiobusio/PDMIn.c msgid "Only 8 or 16 bit mono with " msgstr "Endast 8 eller 16 bitars mono med " #: ports/espressif/common-hal/wifi/__init__.c +#: ports/raspberrypi/common-hal/wifi/__init__.c msgid "Only IPv4 addresses supported" msgstr "Endast IPv4-adresser stöds" -#: ports/espressif/common-hal/socketpool/SocketPool.c +#: ports/espressif/common-hal/socketpool/Socket.c +#: ports/raspberrypi/common-hal/socketpool/Socket.c msgid "Only IPv4 sockets supported" msgstr "Endast IPv4-socket stöds" @@ -1875,15 +1632,19 @@ msgstr "" msgid "Only one TouchAlarm can be set in deep sleep." msgstr "Endast ett TouchAlarm kan ställas in för djupsömn." -#: ports/espressif/common-hal/i2cperipheral/I2CPeripheral.c +#: ports/espressif/common-hal/i2ctarget/I2CTarget.c +#: ports/raspberrypi/common-hal/i2ctarget/I2CTarget.c msgid "Only one address is allowed" msgstr "Endast en adress är tillåten" #: ports/atmel-samd/common-hal/alarm/time/TimeAlarm.c -#: ports/espressif/common-hal/alarm/time/TimeAlarm.c #: ports/nrf/common-hal/alarm/time/TimeAlarm.c -#: ports/raspberrypi/common-hal/alarm/time/TimeAlarm.c #: ports/stm/common-hal/alarm/time/TimeAlarm.c +msgid "Only one alarm.time alarm can be set" +msgstr "Endast ett alarm.time-larm kan ställas in" + +#: ports/espressif/common-hal/alarm/time/TimeAlarm.c +#: ports/raspberrypi/common-hal/alarm/time/TimeAlarm.c msgid "Only one alarm.time alarm can be set." msgstr "Endast ett alarm.time kan ställas in." @@ -1895,19 +1656,20 @@ msgstr "Bara en färg kan vara genomskinlig i taget" msgid "Operation not permitted" msgstr "Åtgärden inte tillåten" -#: ports/espressif/bindings/espidf/__init__.c ports/espressif/esp_error.c +#: ports/espressif/common-hal/espidf/__init__.c ports/espressif/esp_error.c msgid "Operation or feature not supported" msgstr "Operation eller funktion stöds inte" -#: ports/espressif/bindings/espidf/__init__.c ports/espressif/esp_error.c +#: ports/espressif/common-hal/espidf/__init__.c ports/espressif/esp_error.c msgid "Operation timed out" msgstr "Åtgärden orsakade timeout" -#: ports/espressif/bindings/espidf/__init__.c ports/espressif/esp_error.c +#: ports/espressif/common-hal/espidf/__init__.c ports/espressif/esp_error.c msgid "Out of memory" msgstr "Slut på minne" -#: ports/espressif/common-hal/socketpool/SocketPool.c +#: ports/espressif/common-hal/socketpool/Socket.c +#: ports/raspberrypi/common-hal/socketpool/Socket.c msgid "Out of sockets" msgstr "Slut på sockets" @@ -1915,11 +1677,6 @@ msgstr "Slut på sockets" msgid "Out-buffer elements must be <= 4 bytes long" msgstr "Element i utbuffer måste vara <= 4 byte långa" -#: shared-bindings/bitops/__init__.c -#, c-format -msgid "Output buffer must be at least %d bytes" -msgstr "Utdatabuffert måste vara minst %d byte" - #: shared-bindings/audiobusio/PDMIn.c msgid "Oversample must be multiple of 8." msgstr "Översampling måste vara multipel av 8." @@ -1928,11 +1685,6 @@ msgstr "Översampling måste vara multipel av 8." msgid "PDMIn not available" msgstr "PDMIn inte tillgänglig" -#: shared-bindings/pwmio/PWMOut.c -msgid "" -"PWM duty_cycle must be between 0 and 65535 inclusive (16 bit resolution)" -msgstr "PWM duty_cykel måste vara mellan 0 och 65535 (16 bitars upplösning)" - #: shared-bindings/pwmio/PWMOut.c msgid "" "PWM frequency not writable when variable_frequency is False on construction." @@ -1940,6 +1692,10 @@ msgstr "" "PWM-frekvensen är inte skrivbar när variable_frequency är falsk vid " "skapandet." +#: ports/stm/common-hal/pwmio/PWMOut.c +msgid "PWM restart" +msgstr "PWM omstart" + #: ports/raspberrypi/common-hal/countio/Counter.c msgid "PWM slice already in use" msgstr "PWM-segment används redan" @@ -1956,36 +1712,20 @@ msgstr "Periferi i bruk" msgid "Permission denied" msgstr "Åtkomst nekad" -#: ports/atmel-samd/common-hal/alarm/pin/PinAlarm.c #: ports/stm/common-hal/alarm/pin/PinAlarm.c msgid "Pin cannot wake from Deep Sleep" msgstr "Pinnen kan inte väcka från djup sömn" -#: ports/raspberrypi/bindings/rp2pio/StateMachine.c -msgid "Pin count must be at least 1" -msgstr "Antalet pinnar måste vara minst 1" - #: ports/raspberrypi/common-hal/rp2pio/StateMachine.c msgid "Pin count too large" msgstr "Antal pinnar för stort" -#: ports/atmel-samd/common-hal/analogio/AnalogIn.c -#: ports/cxd56/common-hal/analogio/AnalogIn.c -#: ports/espressif/common-hal/analogio/AnalogIn.c -#: ports/mimxrt10xx/common-hal/analogio/AnalogIn.c -#: ports/nrf/common-hal/analogio/AnalogIn.c -#: ports/raspberrypi/common-hal/analogio/AnalogIn.c -#: ports/stm/common-hal/analogio/AnalogIn.c -msgid "Pin does not have ADC capabilities" -msgstr "Pinnen har inte ADC-funktionalitet" - #: ports/stm/common-hal/alarm/pin/PinAlarm.c #: ports/stm/common-hal/pulseio/PulseIn.c msgid "Pin interrupt already in use" msgstr "Pinnavbrott används redan" #: shared-bindings/adafruit_bus_device/spi_device/SPIDevice.c -#: shared-bindings/digitalio/DigitalInOut.c msgid "Pin is input only" msgstr "Pinnen är enbart ingång" @@ -2050,18 +1790,10 @@ msgstr "Program gör IN utan att ladda ISR" msgid "Program does OUT without loading OSR" msgstr "Program gör OUT utan att läsa in OSR" -#: ports/raspberrypi/bindings/rp2pio/StateMachine.c -msgid "Program must contain at least one 16-bit instruction." -msgstr "Programmet måste innehålla minst en 16-bitars instruktion." - #: ports/raspberrypi/bindings/rp2pio/StateMachine.c msgid "Program size invalid" msgstr "Programstorlek ogiltig" -#: ports/raspberrypi/bindings/rp2pio/StateMachine.c -msgid "Program too large" -msgstr "Programmet är för stort" - #: shared-bindings/digitalio/DigitalInOut.c msgid "Pull not used when direction is output." msgstr "Pull används inte när riktningen är output." @@ -2083,30 +1815,20 @@ msgstr "RNG DeInit-fel" msgid "RNG Init Error" msgstr "RNG Init-fel" -#: ports/nrf/common-hal/busio/UART.c -msgid "RS485 Not yet supported on this device" -msgstr "RS485 stöds ännu inte på den här enheten" +#: ports/atmel-samd/common-hal/busio/UART.c ports/cxd56/common-hal/busio/UART.c +#: ports/nrf/common-hal/busio/UART.c ports/stm/common-hal/busio/UART.c +msgid "RS485" +msgstr "RS485" #: ports/espressif/common-hal/busio/UART.c #: ports/mimxrt10xx/common-hal/busio/UART.c msgid "RS485 inversion specified when not in RS485 mode" msgstr "RS485-inversion specificerad när den inte är i RS485-läge" -#: ports/cxd56/common-hal/rtc/RTC.c ports/espressif/common-hal/rtc/RTC.c -#: ports/mimxrt10xx/common-hal/rtc/RTC.c ports/nrf/common-hal/rtc/RTC.c -#: ports/raspberrypi/common-hal/rtc/RTC.c -msgid "RTC calibration is not supported on this board" -msgstr "RTC-kalibrering stöds inte av detta kort" - #: shared-bindings/alarm/time/TimeAlarm.c shared-bindings/time/__init__.c msgid "RTC is not supported on this board" msgstr "RTC stöds inte av detta kort" -#: ports/atmel-samd/common-hal/busio/UART.c ports/cxd56/common-hal/busio/UART.c -#: ports/stm/common-hal/busio/UART.c -msgid "RTS/CTS/RS485 Not yet supported on this device" -msgstr "RTS/CTS/RS485 Stöds ännu inte på den här enheten" - #: ports/stm/common-hal/os/__init__.c msgid "Random number generation error" msgstr "Fel vid generering av slumptal" @@ -2124,10 +1846,14 @@ msgstr "Skrivskyddat filsystem" msgid "Read-only object" msgstr "Skrivskyddat objekt" -#: ports/espressif/bindings/espidf/__init__.c ports/espressif/esp_error.c +#: ports/espressif/common-hal/espidf/__init__.c ports/espressif/esp_error.c msgid "Received response was invalid" msgstr "Mottaget svar var ogiltigt" +#: supervisor/shared/bluetooth/bluetooth.c +msgid "Reconnecting" +msgstr "Återansluter" + #: shared-bindings/displayio/EPaperDisplay.c msgid "Refresh too soon" msgstr "Uppdaterad för tidigt" @@ -2140,7 +1866,7 @@ msgstr "RemoteTransmissionRequests begränsad till 8 byte" msgid "Requested AES mode is unsupported" msgstr "Det begärda AES-läget stöds inte" -#: ports/espressif/bindings/espidf/__init__.c ports/espressif/esp_error.c +#: ports/espressif/common-hal/espidf/__init__.c ports/espressif/esp_error.c msgid "Requested resource not found" msgstr "Begärd resurs hittades inte" @@ -2156,6 +1882,10 @@ msgstr "Kör i säkert läge! Sparad kod körs inte.\n" msgid "SD card CSD format not supported" msgstr "SD-kort CSD-format stöds inte" +#: ports/cxd56/common-hal/sdioio/SDCard.c +msgid "SDCard init" +msgstr "SDCard start" + #: ports/stm/common-hal/sdioio/SDCard.c #, c-format msgid "SDIO GetCardInfo Error %d" @@ -2166,30 +1896,21 @@ msgstr "SDIO GetCardInfo-fel %d" msgid "SDIO Init Error %d" msgstr "SDIO Init-fel %d" -#: ports/stm/common-hal/busio/SPI.c -msgid "SPI Init Error" -msgstr "SPI Init-fel" - -#: ports/stm/common-hal/busio/SPI.c -msgid "SPI Re-initialization error" -msgstr "SPI reinitialiseringsfel" - #: ports/espressif/common-hal/busio/SPI.c msgid "SPI configuration failed" msgstr "SPI-konfigurationen misslyckades" +#: ports/stm/common-hal/busio/SPI.c +msgid "SPI init error" +msgstr "SPI-initieringsfel" + #: ports/raspberrypi/common-hal/busio/SPI.c msgid "SPI peripheral in use" msgstr "SPI-enhet används redan" -#: shared-bindings/audiomixer/Mixer.c -msgid "Sample rate must be positive" -msgstr "Samplingsfrekvensen måste vara positiv" - -#: ports/atmel-samd/common-hal/audioio/AudioOut.c -#, c-format -msgid "Sample rate too high. It must be less than %d" -msgstr "Samplingsfrekvensen är för hög. Den måste vara mindre än %d" +#: ports/stm/common-hal/busio/SPI.c +msgid "SPI re-init" +msgstr "SPI omstart" #: shared-bindings/is31fl3741/FrameBuffer.c msgid "Scale dimensions must divide by 3" @@ -2209,14 +1930,6 @@ msgstr "Serializern används redan" msgid "Server side context cannot have hostname" msgstr "Serversidans kontext kan inte ha värdnamn" -#: ports/raspberrypi/bindings/rp2pio/StateMachine.c -msgid "Set pin count must be between 1 and 5" -msgstr "Inställt antal pinnar måste vara mellan 1 och 5" - -#: ports/raspberrypi/bindings/rp2pio/StateMachine.c -msgid "Side set pin count must be between 1 and 5" -msgstr "Sido-setets antal pinnar måste vara mellan 1 och 5" - #: ports/cxd56/common-hal/camera/Camera.c msgid "Size not supported" msgstr "Storleken stöds inte" @@ -2237,6 +1950,7 @@ msgid "Slices not supported" msgstr "Slice stöds inte" #: ports/espressif/common-hal/socketpool/SocketPool.c +#: ports/raspberrypi/common-hal/socketpool/SocketPool.c msgid "SocketPool can only be used with wifi.radio" msgstr "SocketPool kan endast användas med wifi.radio" @@ -2252,10 +1966,6 @@ msgstr "Ange en av data0 eller data_pins" msgid "Splitting with sub-captures" msgstr "Splitting med sub-captures" -#: shared-bindings/supervisor/__init__.c -msgid "Stack size must be at least 256" -msgstr "Stackstorleken måste vara minst 256" - #: ports/raspberrypi/common-hal/audiopwmio/PWMAudioOut.c msgid "Stereo left must be on PWM channel A" msgstr "Vänster stereokanal måste använda PWM kanal A" @@ -2264,10 +1974,6 @@ msgstr "Vänster stereokanal måste använda PWM kanal A" msgid "Stereo right must be on PWM channel B" msgstr "Höger stereokanal måste använda PWM kanal B" -#: shared-bindings/multiterminal/__init__.c -msgid "Stream missing readinto() or write() method." -msgstr "Stream saknar readinto() eller write() metod." - #: ports/mimxrt10xx/common-hal/busio/UART.c ports/stm/common-hal/busio/UART.c msgid "Supply at least one UART pin" msgstr "Ange minst en UART-pinne" @@ -2351,10 +2057,6 @@ msgstr "Tile-höjden måste vara jämnt delbar med höjd på bitmap" msgid "Tile index out of bounds" msgstr "Tile-index utanför gräns" -#: shared-bindings/displayio/TileGrid.c -msgid "Tile value out of bounds" -msgstr "Tile-värde utanför intervall" - #: shared-bindings/displayio/TileGrid.c msgid "Tile width must exactly divide bitmap width" msgstr "Tile-bredd måste vara jämnt delbar med bredd på bitmap" @@ -2374,6 +2076,9 @@ msgid "To exit, please reset the board without " msgstr "För att avsluta, gör reset på kortet utan " #: ports/atmel-samd/common-hal/audiobusio/I2SOut.c +msgid "Too many channels in sample" +msgstr "För många kanaler i urvalet" + #: ports/raspberrypi/common-hal/audiobusio/I2SOut.c msgid "Too many channels in sample." msgstr "För många kanaler i sampling." @@ -2406,24 +2111,25 @@ msgid "Tuple or struct_time argument required" msgstr "Tuple- eller struct_time-argument krävs" #: ports/stm/common-hal/busio/UART.c -msgid "UART Buffer allocation error" -msgstr "UART-buffertallokeringsfel" +msgid "UART de-init" +msgstr "UART omstart" + +#: ports/atmel-samd/common-hal/busio/UART.c ports/cxd56/common-hal/busio/UART.c +#: ports/espressif/common-hal/busio/UART.c ports/stm/common-hal/busio/UART.c +msgid "UART init" +msgstr "UART start" #: ports/stm/common-hal/busio/UART.c -msgid "UART De-init error" -msgstr "UART deinit-fel" +msgid "UART re-init" +msgstr "UART omstart" #: ports/stm/common-hal/busio/UART.c -msgid "UART Init Error" -msgstr "UART Init-fel" +msgid "UART write" +msgstr "UART-skrivning" -#: ports/stm/common-hal/busio/UART.c -msgid "UART Re-init error" -msgstr "UART reinit-fel" - -#: ports/stm/common-hal/busio/UART.c -msgid "UART write error" -msgstr "UART skrivfel" +#: main.c +msgid "UID:" +msgstr "" #: shared-module/usb_hid/Device.c msgid "USB busy" @@ -2548,6 +2254,11 @@ msgstr "Okänt systemfirmwarefel: %04x" msgid "Unknown system firmware error: %d" msgstr "Okänt fel i systemets firmware: %d" +#: ports/raspberrypi/common-hal/wifi/__init__.c +#, c-format +msgid "Unkown error code %d" +msgstr "Okänd felkod %d" + #: shared-bindings/adafruit_pixelbuf/PixelBuf.c #, c-format msgid "Unmatched number of items on RHS (expected %d, got %d)." @@ -2561,12 +2272,6 @@ msgstr "" "Ospecificerat problem. Kan vara att parningen på den andra enheten avvisades " "eller ignorerades." -#: ports/atmel-samd/common-hal/busio/I2C.c ports/cxd56/common-hal/busio/I2C.c -#: ports/espressif/common-hal/busio/UART.c -#: ports/raspberrypi/common-hal/busio/I2C.c ports/stm/common-hal/busio/I2C.c -msgid "Unsupported baudrate" -msgstr "Baudrate stöd inte" - #: shared-bindings/bitmaptools/__init__.c msgid "Unsupported colorspace" msgstr "Färgrymd stöds inte" @@ -2579,6 +2284,10 @@ msgstr "Busstyp för display stöds inte" msgid "Unsupported format" msgstr "Formatet stöds inte" +#: shared-bindings/hashlib/__init__.c +msgid "Unsupported hash algorithm" +msgstr "Hash-algoritmen stöds inte" + #: ports/espressif/common-hal/dualbank/__init__.c msgid "Update Failed" msgstr "Uppdateringen misslyckades" @@ -2597,7 +2306,7 @@ msgstr "Värdets längde ! = krävd fast längd" msgid "Value length > max_length" msgstr "Värdets längd > max_length" -#: ports/espressif/bindings/espidf/__init__.c ports/espressif/esp_error.c +#: ports/espressif/common-hal/espidf/__init__.c ports/espressif/esp_error.c msgid "Version was invalid" msgstr "Versionen var ogiltig" @@ -2628,10 +2337,6 @@ msgstr "" msgid "WatchDogTimer.timeout must be greater than 0" msgstr "WatchDogTimer.timeout måste vara större än 0" -#: supervisor/shared/safe_mode.c -msgid "Watchdog timer expired." -msgstr "Watchdog-timern har löpt ut." - #: py/builtinhelp.c #, c-format msgid "" @@ -2647,9 +2352,9 @@ msgstr "" "\n" "För att lista inbyggda moduler skriver du `help(\"modules\")`.\n" -#: shared-bindings/wifi/Radio.c -msgid "WiFi password must be between 8 and 63 characters" -msgstr "WiFi-lösenord måste vara mellan 8 och 63 tecken" +#: supervisor/shared/web_workflow/web_workflow.c +msgid "Wi-Fi: " +msgstr "Wi-Fi: " #: main.c msgid "Woken up by alarm.\n" @@ -2691,11 +2396,7 @@ msgstr "__new__ arg måste vara en användartyp" msgid "a bytes-like object is required" msgstr "ett bytesliknande objekt krävs" -#: shared-bindings/i2cperipheral/I2CPeripheral.c -msgid "address out of bounds" -msgstr "adress utanför gränsen" - -#: shared-bindings/i2cperipheral/I2CPeripheral.c +#: shared-bindings/i2ctarget/I2CTarget.c msgid "addresses is empty" msgstr "adresserna är tomma" @@ -2744,6 +2445,10 @@ msgstr "argumenten måste vara ndarray" msgid "array and index length must be equal" msgstr "array och indexlängd måste vara lika" +#: extmod/ulab/code/numpy/io/io.c +msgid "array has too many dimensions" +msgstr "array har för många dimensioner" + #: py/objarray.c shared-bindings/alarm/SleepMemory.c #: shared-bindings/nvm/ByteArray.c msgid "array/bytes required on right side" @@ -2805,10 +2510,6 @@ msgstr "bitmappsstorlekar måste matcha" msgid "bits must be 32 or less" msgstr "bits måste vara 32 eller färre" -#: shared-bindings/busio/UART.c -msgid "bits must be in range 5 to 9" -msgstr "bits måste mellan 5 och 9" - #: shared-bindings/audiomixer/Mixer.c msgid "bits_per_sample must be 8 or 16" msgstr "bits_per_sample måste vara 8 eller 16" @@ -2846,11 +2547,6 @@ msgstr "buffert för liten för begärd längd" msgid "byteorder is not a string" msgstr "byteorder är inte en sträng" -#: ports/atmel-samd/common-hal/busio/UART.c -#: ports/espressif/common-hal/busio/UART.c -msgid "bytes > 8 bits not supported" -msgstr "bytes> 8 bitar stöds inte" - #: py/objarray.c msgid "bytes length not a multiple of item size" msgstr "bytelängd inte en multipel av storlek" @@ -2859,7 +2555,7 @@ msgstr "bytelängd inte en multipel av storlek" msgid "bytes value out of range" msgstr "bytevärde utanför intervallet" -#: ports/atmel-samd/bindings/samd/Clock.c ports/atmel-samd/common-hal/rtc/RTC.c +#: ports/atmel-samd/bindings/samd/Clock.c msgid "calibration is out of range" msgstr "kalibrering är utanför intervallet" @@ -2867,13 +2563,10 @@ msgstr "kalibrering är utanför intervallet" msgid "calibration is read only" msgstr "kalibrering är skrivskyddad" -#: ports/atmel-samd/common-hal/rtc/RTC.c -msgid "calibration value out of range +/-127" -msgstr "kalibreringsvärde utanför intervallet +/- 127" - +#: shared-module/vectorio/Circle.c shared-module/vectorio/Polygon.c #: shared-module/vectorio/Rectangle.c -msgid "can only be registered in one parent" -msgstr "kan endast registreras med en förälder" +msgid "can only have one parent" +msgstr "kan bara ha en förälder" #: py/emitinlinethumb.c msgid "can only have up to 4 parameters to Thumb assembly" @@ -2895,8 +2588,7 @@ msgstr "kan inte tilldela uttryck" msgid "can't cancel self" msgstr "kan inte avbryta sig själv" -#: py/obj.c py/objint.c shared-bindings/i2cperipheral/I2CPeripheral.c -#: shared-module/adafruit_pixelbuf/PixelBuf.c +#: py/obj.c py/objint.c shared-module/adafruit_pixelbuf/PixelBuf.c msgid "can't convert %q to %q" msgstr "kan inte konvertera %q till %q" @@ -3045,6 +2737,10 @@ msgstr "Kan inte entydigt få sizeof scalar" msgid "casting" msgstr "casting inte implementerad" +#: ports/stm/common-hal/pwmio/PWMOut.c +msgid "channel re-init" +msgstr "kanal återstart" + #: shared-bindings/_stage/Text.c msgid "chars buffer too small" msgstr "teckenbuffert för liten" @@ -3057,10 +2753,6 @@ msgstr "chr() arg är inte i intervallet(0x110000)" msgid "chr() arg not in range(256)" msgstr "chr() arg är inte i intervallet(256)" -#: shared-module/vectorio/Circle.c -msgid "circle can only be registered in one parent" -msgstr "circle kan endast registreras i en förälder" - #: shared-bindings/bitmaptools/__init__.c msgid "clip point must be (x,y) tuple" msgstr "klipppunkten måste vara en tuple (x,y)" @@ -3085,10 +2777,6 @@ msgstr "färgbuffert måste vara en bytearray eller matris av typ 'b' eller 'B'" msgid "color must be between 0x000000 and 0xffffff" msgstr "färg måste vara mellan 0x000000 och 0xffffff" -#: shared-bindings/displayio/ColorConverter.c -msgid "color should be an int" -msgstr "color ska vara en int" - #: py/emitnative.c msgid "comparison of int and uint" msgstr "jämförelse av int och uint" @@ -3125,6 +2813,10 @@ msgstr "Argumenten convolve måste vara ndarray:er" msgid "convolve arguments must not be empty" msgstr "Argumenten convolve kan inte vara tomma" +#: extmod/ulab/code/numpy/io/io.c +msgid "corrupted file" +msgstr "korrupt fil" + #: extmod/ulab/code/numpy/poly.c msgid "could not invert Vandermonde matrix" msgstr "kan inte invertera Vandermonde-matris" @@ -3178,10 +2870,6 @@ msgid "destination buffer must be an array of type 'H' for bit_depth = 16" msgstr "" "destinationsbufferten måste vara en matris av typen 'H' för bit_depth = 16" -#: shared-bindings/audiobusio/PDMIn.c -msgid "destination_length must be an int >= 0" -msgstr "destination_length måste vara ett heltal >= 0" - #: py/objdict.c msgid "dict update sequence has wrong length" msgstr "uppdateringssekvensen för dict har fel längd" @@ -3219,6 +2907,10 @@ msgstr "dtype måste vara float eller complex" msgid "empty" msgstr "tom" +#: extmod/ulab/code/numpy/io/io.c +msgid "empty file" +msgstr "tom fil" + #: extmod/moduasyncio.c extmod/moduheapq.c extmod/modutimeq.c msgid "empty heap" msgstr "tom heap" @@ -3235,10 +2927,6 @@ msgstr "tom sekvens" msgid "end of format while looking for conversion specifier" msgstr "slut på format vid sökning efter konverteringsspecificerare" -#: shared-bindings/displayio/Shape.c -msgid "end_x should be an int" -msgstr "color ska vara en int" - #: shared-bindings/alarm/time/TimeAlarm.c msgid "epoch_time not supported on this board" msgstr "epoch_time stöds inte av detta kort" @@ -3248,6 +2936,14 @@ msgstr "epoch_time stöds inte av detta kort" msgid "error = 0x%08lX" msgstr "fel = 0x%08lX" +#: ports/espressif/common-hal/esp32_camera/Camera.c +msgid "" +"esp32_camera.Camera requires reserved PSRAM to be configured. See the " +"documentation for instructions." +msgstr "" +"esp32_camera.Camera kräver reserverad PSRAM att konfigureras. Se " +"dokumentationen för instruktioner." + #: py/runtime.c msgid "exceptions must derive from BaseException" msgstr "exceptions måste ärvas från BaseException" @@ -3322,7 +3018,7 @@ msgstr "första argumentet måste vara en funktion" msgid "first argument must be a tuple of ndarrays" msgstr "första argumentet måste vara en tupel av ndarray" -#: extmod/ulab/code/numpy/vector.c +#: extmod/ulab/code/numpy/transform.c extmod/ulab/code/numpy/vector.c msgid "first argument must be an ndarray" msgstr "första argumentet måste vara en ndarray" @@ -3470,7 +3166,7 @@ msgstr "ofullständig formatnyckel" msgid "incorrect padding" msgstr "felaktig utfyllnad" -#: extmod/ulab/code/ndarray.c +#: extmod/ulab/code/ndarray.c extmod/ulab/code/numpy/transform.c msgid "index is out of bounds" msgstr "index är utanför gränserna" @@ -3488,6 +3184,10 @@ msgstr "index måste vara heltal" msgid "indices must be integers, slices, or Boolean lists" msgstr "index måste vara heltal, slices, eller Boolean-listor" +#: ports/espressif/common-hal/busio/I2C.c +msgid "init I2C" +msgstr "I2C start" + #: extmod/ulab/code/scipy/optimize/optimize.c msgid "initial values must be iterable" msgstr "initialvärden måste vara iterable" @@ -3533,6 +3233,10 @@ msgstr "indatamatrisen är asymmetrisk" msgid "input matrix is singular" msgstr "indatamatrisen är singulär" +#: extmod/ulab/code/numpy/create.c +msgid "input must be 1- or 2-d" +msgstr "input måste vara 1- eller 2-d" + #: extmod/ulab/code/numpy/carray/carray.c msgid "input must be a 1D ndarray" msgstr "indata måste vara en 1D ndarray" @@ -3541,11 +3245,7 @@ msgstr "indata måste vara en 1D ndarray" msgid "input must be a dense ndarray" msgstr "indata måste vara en dense ndarray" -#: extmod/ulab/code/numpy/create.c -msgid "input must be a tensor of rank 2" -msgstr "indata måste vara en tensor av rank 2" - -#: extmod/ulab/code/numpy/create.c extmod/ulab/code/user/user.c +#: extmod/ulab/code/user/user.c msgid "input must be an ndarray" msgstr "indata måste vara en ndarray" @@ -3595,6 +3295,10 @@ msgstr "ogiltig arkitektur" msgid "invalid bits_per_pixel %d, must be, 1, 2, 4, 8, 16, 24, or 32" msgstr "ogiltig bits_per_pixel %d, måste vara, 1, 2, 4, 8, 16, 24 eller 32" +#: ports/raspberrypi/common-hal/ssl/SSLSocket.c +msgid "invalid cert" +msgstr "ogiltigt certifikat" + #: shared-bindings/bitmaptools/__init__.c #, c-format msgid "invalid element size %d for bits_per_pixel %d\n" @@ -3621,10 +3325,18 @@ msgstr "ogiltig formatspecificerare" msgid "invalid hostname" msgstr "Ogiltigt värdnamn" +#: ports/raspberrypi/common-hal/ssl/SSLSocket.c +msgid "invalid key" +msgstr "ogiltig nyckel" + #: py/compile.c msgid "invalid micropython decorator" msgstr "ogiltig mikropython-dekorator" +#: ports/espressif/common-hal/esp32_camera/Camera.c +msgid "invalid setting" +msgstr "ogiltig inställning" + #: shared-bindings/random/__init__.c msgid "invalid step" msgstr "ogiltigt steg" @@ -3741,10 +3453,6 @@ msgstr "matematikdomänfel" msgid "matrix is not positive definite" msgstr "matrisen är inte positiv bestämd" -#: ports/espressif/common-hal/wifi/Radio.c -msgid "max_connections must be between 0 and 10" -msgstr "max_connections måste vara mellan 0 och 10" - #: ports/espressif/common-hal/_bleio/Descriptor.c #: ports/nrf/common-hal/_bleio/Characteristic.c #: ports/nrf/common-hal/_bleio/Descriptor.c @@ -3752,13 +3460,9 @@ msgstr "max_connections måste vara mellan 0 och 10" msgid "max_length must be 0-%d when fixed_length is %s" msgstr "max_length måste vara 0-%d när fixed_length är %s" -#: shared-bindings/_bleio/Characteristic.c shared-bindings/_bleio/Descriptor.c -msgid "max_length must be >= 0" -msgstr "max_length måste vara >= 0" - #: extmod/ulab/code/ndarray.c -msgid "maximum number of dimensions is 4" -msgstr "maximalt antal dimensioner är 4" +msgid "maximum number of dimensions is " +msgstr "maximalt antal dimensioner är " #: py/runtime.c msgid "maximum recursion depth exceeded" @@ -3891,7 +3595,7 @@ msgstr "ingen reset-pinne tillgänglig" msgid "no response from SD card" msgstr "inget svar från SD-kort" -#: py/objobject.c py/runtime.c +#: ports/espressif/common-hal/esp32_camera/Camera.c py/objobject.c py/runtime.c msgid "no such attribute" msgstr "inget sådant attribut" @@ -4002,7 +3706,11 @@ msgstr "objekt med buffertprotokoll krävs" msgid "odd-length string" msgstr "sträng har udda längd" -#: extmod/ulab/code/numpy/create.c extmod/ulab/code/utils/utils.c +#: supervisor/shared/web_workflow/web_workflow.c +msgid "off" +msgstr "av" + +#: extmod/ulab/code/utils/utils.c msgid "offset is too large" msgstr "offset är för stor" @@ -4098,10 +3806,6 @@ msgstr "pack förväntade %d stycken för packning (fick %d)" msgid "palette must be 32 bytes long" msgstr "palette måste vara 32 bytes lång" -#: shared-bindings/displayio/Palette.c -msgid "palette_index should be an int" -msgstr "palette_index ska vara en int" - #: py/emitinlinextensa.c msgid "parameters must be registers in sequence a2 to a5" msgstr "parametrarna måste registreras i följd a2-a5" @@ -4127,10 +3831,6 @@ msgstr "" msgid "poll on file not available on win32" msgstr "filbevakning är inte tillgänglig på win32" -#: shared-module/vectorio/Polygon.c -msgid "polygon can only be registered in one parent" -msgstr "polygon kan endast registreras i en förälder" - #: ports/espressif/common-hal/pulseio/PulseIn.c msgid "pop from an empty PulseIn" msgstr "pop från en tom PulseIn" @@ -4156,7 +3856,23 @@ 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/espressif/boards/adafruit_qtpy_esp32_pico/mpconfigboard.h +msgid "pressing BOOT button at start up.\n" +msgstr "genom att trycka på BOOT-knappen vid start.\n" + +#: ports/espressif/boards/adafruit_feather_esp32_v2/mpconfigboard.h +msgid "pressing SW38 button at start up.\n" +msgstr "genom att trycka på SW38-knappen vid start.\n" + +#: ports/espressif/boards/hardkernel_odroid_go/mpconfigboard.h +msgid "pressing VOLUME button at start up.\n" +msgstr "genom att trycka på VOLUME-knappen vid start.\n" + #: ports/espressif/boards/adafruit_qtpy_esp32c3/mpconfigboard.h +#: ports/espressif/boards/beetle-esp32-c3/mpconfigboard.h +#: ports/espressif/boards/espressif_esp32s2_devkitc_1_n8r2/mpconfigboard.h +#: ports/espressif/boards/lolin_c3_mini/mpconfigboard.h +#: ports/espressif/boards/microdev_micro_c3/mpconfigboard.h #: supervisor/shared/safe_mode.c msgid "pressing boot button at start up.\n" msgstr "trycka på startknappen vid start.\n" @@ -4177,14 +3893,6 @@ msgstr "håll ner vänster knapp vid start\n" msgid "pull masks conflict with direction masks" msgstr "pull-mask är i konflikt med riktnings-mask" -#: ports/raspberrypi/bindings/rp2pio/StateMachine.c -msgid "pull_threshold must be between 1 and 32" -msgstr "pull_threshold måste vara mellan 1 och 32" - -#: ports/raspberrypi/bindings/rp2pio/StateMachine.c -msgid "push_threshold must be between 1 and 32" -msgstr "push_threshold måste vara mellan 1 och 32" - #: extmod/modutimeq.c msgid "queue overflow" msgstr "köstorlek överskreds" @@ -4236,14 +3944,6 @@ msgstr "argumentet roll måste vara en ndarray" msgid "rsplit(None,n)" msgstr "rsplit(None,n)" -#: shared-bindings/audiocore/RawSample.c -msgid "" -"sample_source buffer must be a bytearray or array of type 'h', 'H', 'b' or " -"'B'" -msgstr "" -"sample_source buffert måste vara en bytearray eller matris av typ 'h', 'H', " -"'b' eller 'B'" - #: ports/atmel-samd/common-hal/audiobusio/PDMIn.c #: ports/raspberrypi/common-hal/audiobusio/PDMIn.c msgid "sampling rate out of range" @@ -4341,26 +4041,14 @@ msgstr "source_bitmap måste ha value_count av 65536" msgid "source_bitmap must have value_count of 8" msgstr "source_bitmap måste ha value_count av 8" -#: shared-bindings/wifi/Radio.c -msgid "ssid can't be more than 32 bytes" -msgstr "ssid kan vara max 32 bytes" - #: py/objstr.c msgid "start/end indices" msgstr "start-/slutindex" -#: shared-bindings/displayio/Shape.c -msgid "start_x should be an int" -msgstr "start_x ska vara en int" - #: shared-bindings/random/__init__.c msgid "step must be non-zero" msgstr "step måste vara icke-noll" -#: shared-bindings/busio/UART.c -msgid "stop must be 1 or 2" -msgstr "stop måste vara 1 eller 2" - #: shared-bindings/random/__init__.c msgid "stop not reachable from start" msgstr "stop kan inte nås från start" @@ -4409,10 +4097,6 @@ msgstr "syntaxfel i uctypes deskriptor" msgid "threshold must be in the range 0-65536" msgstr "tröskelvärdet måste ligga i intervallet 0-65536" -#: shared-bindings/rgbmatrix/RGBMatrix.c -msgid "tile must be greater than zero" -msgstr "tile måste vara större än noll" - #: shared-bindings/time/__init__.c msgid "time.struct_time() takes a 9-sequence" msgstr "time.struct_time() kräver en 9-sekvens" @@ -4432,10 +4116,6 @@ msgstr "timeout måste vara 0.0-100.0 sekunder" msgid "timeout must be < 655.35 secs" msgstr "timeout måste vara < 655,35 sekunder" -#: shared-bindings/_bleio/CharacteristicBuffer.c -msgid "timeout must be >= 0.0" -msgstr "timeout måste vara >= 0.0" - #: shared-module/sdcardio/SDCard.c msgid "timeout waiting for v1 card" msgstr "timeout för v1-kort" @@ -4444,6 +4124,10 @@ msgstr "timeout för v1-kort" msgid "timeout waiting for v2 card" msgstr "timeout för v2-kort" +#: ports/stm/common-hal/pwmio/PWMOut.c +msgid "timer re-init" +msgstr "timer omstart" + #: shared-bindings/time/__init__.c msgid "timestamp out of range for platform time_t" msgstr "timestamp utom räckvidd för plattformens \"time_t\"" @@ -4509,14 +4193,10 @@ msgstr "typ '%q' är inte en acceptabel bastyp" msgid "type is not an acceptable base type" msgstr "typ är inte en acceptabel bastyp" -#: py/runtime.c +#: py/objgenerator.c py/runtime.c msgid "type object '%q' has no attribute '%q'" msgstr "typobjektet '%q' har inget attribut '%q'" -#: py/objgenerator.c -msgid "type object 'generator' has no attribute '__await__'" -msgstr "typobjekt 'generator' har inget attribut '__await__'" - #: py/objtype.c msgid "type takes 1 or 3 arguments" msgstr "typen tar 1 eller 3 argument" @@ -4575,7 +4255,6 @@ msgid "unreadable attribute" msgstr "attribut kan inte läsas" #: shared-bindings/displayio/TileGrid.c shared-bindings/vectorio/VectorShape.c -#: shared-module/vectorio/Polygon.c shared-module/vectorio/VectorShape.c msgid "unsupported %q type" msgstr "typ %q stöds inte" @@ -4614,6 +4293,14 @@ msgstr "typ stöds inte för operatören" msgid "unsupported types for %q: '%q', '%q'" msgstr "typen %q stöder inte '%q', '%q'" +#: extmod/ulab/code/numpy/io/io.c +msgid "usecols is too high" +msgstr "usecols är för hög" + +#: extmod/ulab/code/numpy/io/io.c +msgid "usecols keyword must be specified" +msgstr "nyckelordet usecols måste anges" + #: py/objint.c #, c-format msgid "value must fit in %d byte(s)" @@ -4635,20 +4322,19 @@ msgstr "watchdog är inte initierad" msgid "watchdog timeout must be greater than 0" msgstr "watchdog timeout måste vara större än 0" -#: shared-bindings/bitops/__init__.c -#, c-format -msgid "width must be from 2 to 8 (inclusive), not %d" -msgstr "width måste vara mellan 2 och 8, inte %d" - #: shared-bindings/is31fl3741/FrameBuffer.c -#: shared-bindings/rgbmatrix/RGBMatrix.c msgid "width must be greater than zero" msgstr "width måste vara större än noll" #: ports/espressif/common-hal/wifi/Radio.c +#: ports/raspberrypi/common-hal/wifi/Radio.c msgid "wifi is not enabled" msgstr "wifi är inte aktiverat" +#: ports/raspberrypi/common-hal/wifi/Monitor.c +msgid "wifi.Monitor not available" +msgstr "wifi.Monitor är inte tillgänglig" + #: shared-bindings/_bleio/Adapter.c msgid "window must be <= interval" msgstr "window måste vara <= interval" @@ -4661,7 +4347,17 @@ msgstr "fel axelindex" msgid "wrong axis specified" msgstr "fel axel angiven" -#: extmod/ulab/code/numpy/compare.c extmod/ulab/code/numpy/vector.c +#: extmod/ulab/code/numpy/io/io.c +msgid "wrong dtype" +msgstr "fel dtype" + +#: extmod/ulab/code/numpy/transform.c +msgid "wrong index type" +msgstr "fel indextyp" + +#: extmod/ulab/code/numpy/compare.c extmod/ulab/code/numpy/create.c +#: extmod/ulab/code/numpy/io/io.c extmod/ulab/code/numpy/transform.c +#: extmod/ulab/code/numpy/vector.c msgid "wrong input type" msgstr "fel indatatyp" @@ -4669,6 +4365,10 @@ msgstr "fel indatatyp" msgid "wrong length of condition array" msgstr "fel längd på villkorsmatrisen" +#: extmod/ulab/code/numpy/transform.c +msgid "wrong length of index array" +msgstr "fel längd av index array" + #: extmod/ulab/code/numpy/create.c py/objarray.c py/objstr.c msgid "wrong number of arguments" msgstr "fel antal argument" @@ -4689,10 +4389,6 @@ msgstr "x-värde utanför intervall" msgid "xTaskCreate failed" msgstr "xTaskCreate misslyckades" -#: shared-bindings/displayio/Shape.c -msgid "y should be an int" -msgstr "y ska vara en int" - #: shared-module/displayio/Shape.c msgid "y value out of bounds" msgstr "y-värde utanför intervall" @@ -4713,6 +4409,418 @@ msgstr "zi måste vara av typ float" msgid "zi must be of shape (n_section, 2)" msgstr "zi måste vara i formen (n_section, 2)" +#~ msgid "Stream missing readinto() or write() method." +#~ msgstr "Stream saknar readinto() eller write() metod." + +#~ msgid "%q must be >= 0" +#~ msgstr "%q måste vara >= 0" + +#~ msgid "%q must be >= 1" +#~ msgstr "%q måste vara >= 1" + +#~ msgid "address out of bounds" +#~ msgstr "adress utanför gränsen" + +#~ msgid "destination_length must be an int >= 0" +#~ msgstr "destination_length måste vara ett heltal >= 0" + +#~ msgid "type object 'generator' has no attribute '__await__'" +#~ msgstr "typobjekt 'generator' har inget attribut '__await__'" + +#~ msgid "color should be an int" +#~ msgstr "color ska vara en int" + +#~ msgid "end_x should be an int" +#~ msgstr "color ska vara en int" + +#~ msgid "palette_index should be an int" +#~ msgstr "palette_index ska vara en int" + +#~ msgid "start_x should be an int" +#~ msgstr "start_x ska vara en int" + +#~ msgid "y should be an int" +#~ msgstr "y ska vara en int" + +#~ msgid "%q ``must`` be a bytearray or array of type 'h', 'H', 'b' or 'B'" +#~ msgstr "" +#~ "%q ``måste`` vara en bytearray eller matris av typen 'h', 'H', 'b' eller " +#~ "'B'" + +#~ msgid "" +#~ "sample_source buffer must be a bytearray or array of type 'h', 'H', 'b' " +#~ "or 'B'" +#~ msgstr "" +#~ "sample_source buffert måste vara en bytearray eller matris av typ 'h', " +#~ "'H', 'b' eller 'B'" + +#~ msgid "Expected an alarm" +#~ msgstr "Förväntade ett larm" + +#~ msgid "All I2C targets are in use" +#~ msgstr "Alla I2C-mål används" + +#~ msgid "Failed to init wifi" +#~ msgstr "Kunde inte initiera WiFi" + +#~ msgid "input must be a tensor of rank 2" +#~ msgstr "indata måste vara en tensor av rank 2" + +#~ msgid "maximum number of dimensions is 4" +#~ msgstr "maximalt antal dimensioner är 4" + +#~ msgid "Watchdog timer expired." +#~ msgstr "Watchdog-timern har löpt ut." + +#~ msgid "ssid can't be more than 32 bytes" +#~ msgstr "ssid kan vara max 32 bytes" + +#~ msgid "%q must be a tuple of length 2" +#~ msgstr "%q måste vara en tuple av längd 2" + +#~ msgid "%q must be between %d and %d" +#~ msgstr "%q måste vara mellan %d och %d" + +#~ msgid "%q should be an int" +#~ msgstr "%q ska vara en int" + +#~ msgid "(x,y) integers required" +#~ msgstr "(x,y) heltal krävs" + +#~ msgid "Address type out of range" +#~ msgstr "Adresstyp utanför intervallet" + +#~ msgid "AnalogIn not supported on given pin" +#~ msgstr "AnalogIn stöds inte på angiven pinne" + +#~ msgid "AnalogOut functionality not supported" +#~ msgstr "AnalogOut-funktionalitet stöds inte" + +#~ msgid "AnalogOut is only 16 bits. Value must be less than 65536." +#~ msgstr "" +#~ "AnalogOut hanterar bara 16 bitar. Värdet måste vara mindre än 65536." + +#~ msgid "AnalogOut not supported on given pin" +#~ msgstr "AnalogOut stöds inte på angiven pinne" + +#, c-format +#~ msgid "Bit depth must be from 1 to 6 inclusive, not %d" +#~ msgstr "Bitdjup måste vara inom 1 till 6, inte %d" + +#, c-format +#~ msgid "Buffer incorrect size. Should be %d bytes." +#~ msgstr "Buffert har felaktig storlek. Ska vara %d byte." + +#~ msgid "Buffer must be at least length 1" +#~ msgstr "Bufferten måste ha minst längd 1" + +#~ msgid "Bytes must be between 0 and 255." +#~ msgstr "Bytes måste vara mellan 0 och 255." + +#~ msgid "Cannot output both channels on the same pin" +#~ msgstr "Det går inte att mata ut båda kanalerna på samma pinne" + +#~ msgid "Cannot read without MISO pin." +#~ msgstr "Kan inte läsa utan MISO-pinne." + +#~ msgid "Cannot reset into bootloader because no bootloader is present." +#~ msgstr "" +#~ "Det går inte att återställa till bootloader eftersom bootloader saknas." + +#~ msgid "Cannot transfer without MOSI and MISO pins." +#~ msgstr "Kan inte överföra utan MOSI- och MISO-pinnar." + +#~ msgid "Cannot write without MOSI pin." +#~ msgstr "Kan inte skriva utan MOSI-pinne." + +#~ msgid "Clock pin init failed." +#~ msgstr "Initiering av klockpinne misslyckades." + +#~ msgid "Command must be an int between 0 and 255" +#~ msgstr "Kommandot måste vara en int mellan 0 och 255" + +#~ msgid "Could not initialize Camera" +#~ msgstr "Kunde inte initiera Camera" + +#~ msgid "Could not initialize GNSS" +#~ msgstr "Kan inte initiera GNSS" + +#~ msgid "Could not initialize SDCard" +#~ msgstr "Kan inte initiera SD-kort" + +#~ msgid "Could not initialize UART" +#~ msgstr "Det gick inte att initiera UART" + +#~ msgid "Could not re-init channel" +#~ msgstr "Det gick inte att återinitiera kanalen" + +#~ msgid "Could not re-init timer" +#~ msgstr "Det gick inte att återinitiera timern" + +#~ msgid "Could not restart PWM" +#~ msgstr "Det gick inte att starta om PWM" + +#~ msgid "Couldn't allocate first buffer" +#~ msgstr "Det gick inte att allokera den första bufferten" + +#~ msgid "Couldn't allocate input buffer" +#~ msgstr "Det gick inte att allokera indatabufferten" + +#~ msgid "Couldn't allocate second buffer" +#~ msgstr "Det gick inte att allokera den andra bufferten" + +#~ msgid "DigitalInOut not supported on given pin" +#~ msgstr "DigitalInOut stöds inte på given pinne" + +#, c-format +#~ msgid "Expected tuple of length %d, got %d" +#~ msgstr "Förväntad tupel med längd %d, fick %d" + +#~ msgid "Failed to allocate RX buffer" +#~ msgstr "Det gick inte att tilldela RX-buffert" + +#, c-format +#~ msgid "Failed to allocate RX buffer of %d bytes" +#~ msgstr "Det gick inte att allokera RX-bufferten på %d byte" + +#, c-format +#~ msgid "Framebuffer requires %d bytes" +#~ msgstr "Framebuffer kräver %d byte" + +#~ msgid "Hostname must be between 1 and 253 characters" +#~ msgstr "Hostname måste vara mellan 1 och 253 tecken" + +#~ msgid "I2C Init Error" +#~ msgstr "I2C init-fel" + +#~ msgid "Invalid %q pin selection" +#~ msgstr "Ogiltigt val av %q pinne" + +#~ msgid "Invalid AuthMode" +#~ msgstr "Ogiltig AuthMode" + +#~ msgid "Invalid BMP file" +#~ msgstr "Ogiltig BMP-fil" + +#~ msgid "Invalid DAC pin supplied" +#~ msgstr "Ogiltig DAC-pinne angiven" + +#~ msgid "Invalid MIDI file" +#~ msgstr "Ogiltig MIDI-fil" + +#~ msgid "Invalid PWM frequency" +#~ msgstr "Ogiltig PWM-frekvens" + +#~ msgid "Invalid Pin" +#~ msgstr "Ogiltig pinne" + +#~ msgid "Invalid buffer size" +#~ msgstr "Ogiltig buffertstorlek" + +#~ msgid "Invalid byteorder string" +#~ msgstr "Ogiltig byteorder-sträng" + +#~ msgid "Invalid capture period. Valid range: 1 - 500" +#~ msgstr "Ogiltig inspelningsperiod. Giltigt intervall: 1 - 500" + +#~ msgid "Invalid channel count" +#~ msgstr "Ogiltigt kanalantal" + +#, c-format +#~ msgid "Invalid data_count %d" +#~ msgstr "Ogiltig data_count %d" + +#~ msgid "Invalid direction." +#~ msgstr "Ogiltig riktning." + +#~ msgid "Invalid file" +#~ msgstr "Felaktig fil" + +#~ msgid "Invalid mode" +#~ msgstr "Ogiltigt läge" + +#~ msgid "Invalid number of bits" +#~ msgstr "Ogiltigt antal bitar" + +#~ msgid "Invalid phase" +#~ msgstr "Ogiltig fas" + +#~ msgid "Invalid pin" +#~ msgstr "Ogiltig pinne" + +#~ msgid "Invalid pin for left channel" +#~ msgstr "Ogiltig pinne för vänster kanal" + +#~ msgid "Invalid pin for right channel" +#~ msgstr "Ogiltig pinne för höger kanal" + +#~ msgid "Invalid polarity" +#~ msgstr "Ogiltig polaritet" + +#~ msgid "Invalid properties" +#~ msgstr "Ogiltiga egenskaper" + +#~ msgid "Invalid run mode." +#~ msgstr "Ogiltigt körläge." + +#~ msgid "Invalid security_mode" +#~ msgstr "Ogiltigt säkerhetsläge" + +#~ msgid "Invalid voice" +#~ msgstr "Ogiltig kanal" + +#~ msgid "Invalid voice count" +#~ msgstr "Ogiltigt kanalantal" + +#~ msgid "Invalid wave file" +#~ msgstr "Ogiltig wave-fil" + +#~ msgid "Invalid word/bit length" +#~ msgstr "Ogiltig word-/bitlängd" + +#~ msgid "Layer already in a group." +#~ msgstr "Lagret finns redan i en grupp." + +#~ msgid "Layer must be a Group or TileGrid subclass." +#~ msgstr "Layer måste vara en subklass av Group eller TileGrid." + +#~ msgid "MISO pin init failed." +#~ msgstr "init för MISO-pinne misslyckades." + +#~ msgid "MOSI pin init failed." +#~ msgstr "init för MOSI-pinne misslyckades." + +#~ msgid "Messages limited to 8 bytes" +#~ msgstr "Meddelanden begränsad till 8 byte" + +#, c-format +#~ msgid "More than %d report ids not supported" +#~ msgstr "Fler än %d rapport-id stöds inte" + +#~ msgid "No hardware support on clk pin" +#~ msgstr "Inget hårdvarustöd på clk-pinne" + +#~ msgid "No hardware support on pin" +#~ msgstr "Inget hårdvarustöd på pinne" + +#, c-format +#~ msgid "Output buffer must be at least %d bytes" +#~ msgstr "Utdatabuffert måste vara minst %d byte" + +#~ msgid "" +#~ "PWM duty_cycle must be between 0 and 65535 inclusive (16 bit resolution)" +#~ msgstr "PWM duty_cykel måste vara mellan 0 och 65535 (16 bitars upplösning)" + +#~ msgid "Pin count must be at least 1" +#~ msgstr "Antalet pinnar måste vara minst 1" + +#~ msgid "Pin does not have ADC capabilities" +#~ msgstr "Pinnen har inte ADC-funktionalitet" + +#~ msgid "Program must contain at least one 16-bit instruction." +#~ msgstr "Programmet måste innehålla minst en 16-bitars instruktion." + +#~ msgid "Program too large" +#~ msgstr "Programmet är för stort" + +#~ msgid "RS485 Not yet supported on this device" +#~ msgstr "RS485 stöds ännu inte på den här enheten" + +#~ msgid "RTC calibration is not supported on this board" +#~ msgstr "RTC-kalibrering stöds inte av detta kort" + +#~ msgid "RTS/CTS/RS485 Not yet supported on this device" +#~ msgstr "RTS/CTS/RS485 Stöds ännu inte på den här enheten" + +#~ msgid "SPI Init Error" +#~ msgstr "SPI Init-fel" + +#~ msgid "SPI Re-initialization error" +#~ msgstr "SPI reinitialiseringsfel" + +#~ msgid "Sample rate must be positive" +#~ msgstr "Samplingsfrekvensen måste vara positiv" + +#, c-format +#~ msgid "Sample rate too high. It must be less than %d" +#~ msgstr "Samplingsfrekvensen är för hög. Den måste vara mindre än %d" + +#~ msgid "Set pin count must be between 1 and 5" +#~ msgstr "Inställt antal pinnar måste vara mellan 1 och 5" + +#~ msgid "Side set pin count must be between 1 and 5" +#~ msgstr "Sido-setets antal pinnar måste vara mellan 1 och 5" + +#~ msgid "Stack size must be at least 256" +#~ msgstr "Stackstorleken måste vara minst 256" + +#~ msgid "Tile value out of bounds" +#~ msgstr "Tile-värde utanför intervall" + +#~ msgid "UART Buffer allocation error" +#~ msgstr "UART-buffertallokeringsfel" + +#~ msgid "UART De-init error" +#~ msgstr "UART deinit-fel" + +#~ msgid "UART Init Error" +#~ msgstr "UART Init-fel" + +#~ msgid "UART Re-init error" +#~ msgstr "UART reinit-fel" + +#~ msgid "UART write error" +#~ msgstr "UART skrivfel" + +#~ msgid "Unsupported baudrate" +#~ msgstr "Baudrate stöd inte" + +#~ msgid "WiFi password must be between 8 and 63 characters" +#~ msgstr "WiFi-lösenord måste vara mellan 8 och 63 tecken" + +#~ msgid "bits must be in range 5 to 9" +#~ msgstr "bits måste mellan 5 och 9" + +#~ msgid "bytes > 8 bits not supported" +#~ msgstr "bytes> 8 bitar stöds inte" + +#~ msgid "calibration value out of range +/-127" +#~ msgstr "kalibreringsvärde utanför intervallet +/- 127" + +#~ msgid "can only be registered in one parent" +#~ msgstr "kan endast registreras med en förälder" + +#~ msgid "circle can only be registered in one parent" +#~ msgstr "circle kan endast registreras i en förälder" + +#~ msgid "max_connections must be between 0 and 10" +#~ msgstr "max_connections måste vara mellan 0 och 10" + +#~ msgid "max_length must be >= 0" +#~ msgstr "max_length måste vara >= 0" + +#~ msgid "polygon can only be registered in one parent" +#~ msgstr "polygon kan endast registreras i en förälder" + +#~ msgid "pull_threshold must be between 1 and 32" +#~ msgstr "pull_threshold måste vara mellan 1 och 32" + +#~ msgid "push_threshold must be between 1 and 32" +#~ msgstr "push_threshold måste vara mellan 1 och 32" + +#~ msgid "stop must be 1 or 2" +#~ msgstr "stop måste vara 1 eller 2" + +#~ msgid "tile must be greater than zero" +#~ msgstr "tile måste vara större än noll" + +#~ msgid "timeout must be >= 0.0" +#~ msgstr "timeout måste vara >= 0.0" + +#, c-format +#~ msgid "width must be from 2 to 8 (inclusive), not %d" +#~ msgstr "width måste vara mellan 2 och 8, inte %d" + #~ msgid "Unsupported operation" #~ msgstr "Åtgärd som inte stöds" @@ -5042,12 +5150,6 @@ msgstr "zi måste vara i formen (n_section, 2)" #~ msgid "can only save bytecode" #~ msgstr "kan bara spara bytecode" -#~ msgid "invalid cert" -#~ msgstr "ogiltigt certifikat" - -#~ msgid "invalid key" -#~ msgstr "ogiltig nyckel" - #~ msgid "Viper functions don't currently support more than 4 arguments" #~ msgstr "Viper-funktioner stöder för närvarande inte mer än fyra argument" @@ -5265,9 +5367,6 @@ msgstr "zi måste vara i formen (n_section, 2)" #~ msgid "wrong argument type" #~ msgstr "fel typ av argument" -#~ msgid "wrong index type" -#~ msgstr "fel indextyp" - #~ msgid "specify size or data, but not both" #~ msgstr "ange storlek eller data, men inte båda" diff --git a/locale/tr.po b/locale/tr.po index c64c90b204..6380448b11 100644 --- a/locale/tr.po +++ b/locale/tr.po @@ -7,15 +7,15 @@ msgid "" msgstr "" "Project-Id-Version: PACKAGE VERSION\n" "Report-Msgid-Bugs-To: \n" -"PO-Revision-Date: 2022-04-19 17:07+0000\n" -"Last-Translator: Siyabend Ürün \n" +"PO-Revision-Date: 2022-10-10 18:23+0000\n" +"Last-Translator: Boran Roni \n" "Language-Team: none\n" "Language: tr\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.12-dev\n" +"X-Generator: Weblate 4.14.1\n" #: main.c msgid "" @@ -70,6 +70,11 @@ msgstr " çıktı:\n" msgid "%%c requires int or char" msgstr "%%c int veya char tipine ihtiyaç duyar" +#: main.c +#, c-format +msgid "%02X" +msgstr "" + #: shared-bindings/rgbmatrix/RGBMatrix.c #, c-format msgid "" @@ -78,10 +83,27 @@ msgstr "" "%d adres pinleri, %d RGB pinleri ve %d döşemeleri %d'nin yüksekliği " "gösterir, %d'nin değil" +#: ports/atmel-samd/common-hal/alarm/__init__.c +#: ports/cxd56/common-hal/analogio/AnalogOut.c ports/cxd56/common-hal/rtc/RTC.c +#: ports/espressif/common-hal/rtc/RTC.c +#: ports/mimxrt10xx/common-hal/analogio/AnalogOut.c +#: ports/mimxrt10xx/common-hal/rtc/RTC.c ports/nrf/common-hal/alarm/__init__.c +#: ports/nrf/common-hal/analogio/AnalogOut.c ports/nrf/common-hal/rtc/RTC.c +#: ports/raspberrypi/common-hal/alarm/__init__.c +#: ports/raspberrypi/common-hal/analogio/AnalogOut.c +#: ports/raspberrypi/common-hal/rtc/RTC.c ports/stm/common-hal/alarm/__init__.c +#: ports/stm/common-hal/rtc/RTC.c +msgid "%q" +msgstr "%q" + #: shared-bindings/microcontroller/Pin.c msgid "%q and %q contain duplicate pins" msgstr "%q ve %q yinelenen pinler içeriyor" +#: ports/atmel-samd/common-hal/audioio/AudioOut.c +msgid "%q and %q must be different" +msgstr "%q ve %q farklı olmalılar" + #: shared-bindings/microcontroller/Pin.c msgid "%q contains duplicate pins" msgstr "%q yinelenen pinler içeriyor" @@ -90,16 +112,12 @@ msgstr "%q yinelenen pinler içeriyor" msgid "%q failure: %d" msgstr "%q hata: %d" +#: shared-bindings/digitalio/DigitalInOut.c #: shared-bindings/microcontroller/Pin.c msgid "%q in use" msgstr "%q kullanımda" -#: ports/atmel-samd/common-hal/pulseio/PulseIn.c -#: ports/cxd56/common-hal/pulseio/PulseIn.c -#: ports/nrf/common-hal/pulseio/PulseIn.c -#: ports/raspberrypi/common-hal/pulseio/PulseIn.c -#: ports/stm/common-hal/pulseio/PulseIn.c py/obj.c py/objstr.c -#: py/objstrunicode.c +#: py/obj.c py/objstr.c py/objstrunicode.c msgid "%q index out of range" msgstr "%q indeksi aralık dışında" @@ -107,21 +125,41 @@ msgstr "%q indeksi aralık dışında" msgid "%q indices must be integers, not %s" msgstr "%q indeksleri integer olmalı, %s değil" +#: shared-module/bitbangio/SPI.c +msgid "%q init failed" +msgstr "%q init başarısız oldu" + +#: py/argcheck.c +msgid "%q length must be %d" +msgstr "%q boyutu %d olmalıdır" + #: py/argcheck.c msgid "%q length must be %d-%d" msgstr "%q boyutları %d-%d olmalıdır" -#: shared-bindings/busio/I2C.c shared-bindings/usb_hid/Device.c +#: py/argcheck.c +msgid "%q length must be <= %d" +msgstr "%q boyutu <= %d olmalıdır" + +#: py/argcheck.c +msgid "%q length must be >= %d" +msgstr "%q boyutu >= %d olmalıdır" + +#: shared-bindings/busio/I2C.c msgid "%q length must be >= 1" msgstr "%q boyutu >=1 olmalıdır" +#: py/argcheck.c +msgid "%q must be %d" +msgstr "%q, %d olmalıdır" + #: py/argcheck.c msgid "%q must be %d-%d" msgstr "%q, %d-%d olmalıdır" #: shared-bindings/displayio/Display.c msgid "%q must be 1 when %q is True" -msgstr "" +msgstr "%q 1 olmalı, %q True olduğu zaman" #: py/argcheck.c shared-bindings/gifio/GifWriter.c msgid "%q must be <= %d" @@ -131,30 +169,18 @@ msgstr "%q <= %d olmalıdır" msgid "%q must be >= %d" msgstr "%q >= %d olmalıdır" -#: py/argcheck.c shared-bindings/memorymonitor/AllocationAlarm.c -msgid "%q must be >= 0" -msgstr "%q >= 0 olmalıdır" - -#: shared-bindings/_bleio/CharacteristicBuffer.c -#: shared-bindings/_bleio/PacketBuffer.c shared-bindings/displayio/Group.c -#: shared-bindings/displayio/Shape.c -#: shared-bindings/memorymonitor/AllocationAlarm.c -#: shared-bindings/vectorio/Circle.c shared-bindings/vectorio/Rectangle.c -msgid "%q must be >= 1" -msgstr "%q >= 1 olmalıdır" +#: shared-bindings/analogbufio/BufferedIn.c +#: shared-bindings/audiocore/RawSample.c +msgid "%q must be a bytearray or array of type 'h', 'H', 'b', or 'B'" +msgstr "%q 'h', 'H', 'b' yada 'B' tipi bir bytearray /array olmalı" #: py/argcheck.c msgid "%q must be a string" msgstr "%q bir string olmalıdır" -#: shared-module/vectorio/Polygon.c -msgid "%q must be a tuple of length 2" -msgstr "%q, boyutu 2 olan bir tuple olmalıdır" - -#: ports/espressif/common-hal/imagecapture/ParallelImageCapture.c -#: shared-module/vectorio/VectorShape.c -msgid "%q must be between %d and %d" -msgstr "%q, %d ile %d arasında olmalıdır" +#: py/argcheck.c +msgid "%q must be an int" +msgstr "%q bir tam sayı olmalıdır" #: py/argcheck.c msgid "%q must be of type %q" @@ -172,7 +198,11 @@ msgstr "%q, 2'nin kuvveti olmalıdır" msgid "%q out of bounds" msgstr "%q sınırların dışında" +#: ports/atmel-samd/common-hal/pulseio/PulseIn.c +#: ports/cxd56/common-hal/pulseio/PulseIn.c +#: ports/nrf/common-hal/pulseio/PulseIn.c #: ports/raspberrypi/common-hal/rp2pio/StateMachine.c +#: ports/stm/common-hal/pulseio/PulseIn.c py/argcheck.c #: shared-bindings/canio/Match.c msgid "%q out of range" msgstr "%q aralık dışında" @@ -181,10 +211,6 @@ msgstr "%q aralık dışında" msgid "%q pin invalid" msgstr "%q pini geçersiz" -#: shared-bindings/fontio/BuiltinFont.c -msgid "%q should be an int" -msgstr "%q bir int olmalıdır" - #: shared-bindings/usb_hid/Device.c msgid "%q with a report ID of 0 must be of length 1" msgstr "Rapor kimliği 0 olan %q, 1 uzunluğunda olmalıdır" @@ -197,7 +223,11 @@ msgstr "%q(), %d konumsal argümanını alır ancak %d verildi" msgid "%q, %q, and %q must all be the same length" msgstr "%q, %q ve %q aynı uzunlukta olmalıdır" -#: ports/espressif/bindings/espidf/__init__.c ports/espressif/esp_error.c +#: py/objint.c +msgid "%q=%q" +msgstr "%q=%q" + +#: ports/espressif/common-hal/espidf/__init__.c ports/espressif/esp_error.c #, c-format msgid "%s error 0x%x" msgstr "%s hatası 0x%x" @@ -282,7 +312,7 @@ msgstr "'%s' nesnesi, öğe atamasını desteklemiyor" msgid "'%s' object doesn't support item deletion" msgstr "'%s' nesnesi, öğe silmeyi desteklemiyor" -#: py/runtime.c +#: ports/raspberrypi/common-hal/wifi/Radio.c py/runtime.c msgid "'%s' object has no attribute '%q'" msgstr "'%s' nesnesinin '%q' özelliği yok" @@ -292,7 +322,6 @@ msgid "'%s' object isn't subscriptable" msgstr "'%s' nesnesi subscriptable özelliğe sahip değil" #: py/objstr.c -#, fuzzy msgid "'=' alignment not allowed in string format specifier" msgstr "'=' hizalamasına string biçiminde izin verilmez" @@ -349,13 +378,9 @@ msgstr "asenkron fonksiyon içinde 'yield from'" msgid "'yield' outside function" msgstr "fonksiyon dışında 'yield'" -#: shared-module/vectorio/VectorShape.c -msgid "(x,y) integers required" -msgstr "(x, y) integerları gereklidir" - #: py/compile.c msgid "*x must be assignment target" -msgstr "" +msgstr "*x atama hedefi olmalıdır" #: py/obj.c msgid ", in %q\n" @@ -388,16 +413,12 @@ msgstr "ADC2, WiFi tarafından kullanılmaktadır" msgid "Address must be %d bytes long" msgstr "Adres %d byte uzunluğunda olmalıdır" -#: shared-bindings/_bleio/Address.c -msgid "Address type out of range" -msgstr "Adres tipi beklenen aralığın dışında" - #: ports/espressif/common-hal/canio/CAN.c msgid "All CAN peripherals are in use" msgstr "Tüm CAN çevre birimleri kullanımda" #: ports/espressif/common-hal/busio/I2C.c -#: ports/espressif/common-hal/i2cperipheral/I2CPeripheral.c +#: ports/espressif/common-hal/i2ctarget/I2CTarget.c #: ports/nrf/common-hal/busio/I2C.c msgid "All I2C peripherals are in use" msgstr "Tüm I2C çevre birimleri kullanımda" @@ -434,7 +455,6 @@ msgstr "Tüm kanallar kullanımda" msgid "All event channels in use" msgstr "Tüm olay kanalları kullanımda" -#: ports/raspberrypi/common-hal/pulseio/PulseIn.c #: ports/raspberrypi/common-hal/rp2pio/StateMachine.c msgid "All state machines in use" msgstr "Tüm durum makineleri kullanımda" @@ -471,7 +491,7 @@ msgstr "Halihazırda duyuruluyor." #: ports/atmel-samd/common-hal/canio/Listener.c msgid "Already have all-matches listener" -msgstr "" +msgstr "Tüm eşleşmelerle eşleşen dinleyiciniz var" #: shared-module/memorymonitor/AllocationAlarm.c #: shared-module/memorymonitor/AllocationSize.c @@ -479,28 +499,10 @@ msgid "Already running" msgstr "Halihazırda çalışıyor" #: ports/espressif/common-hal/wifi/Radio.c +#: ports/raspberrypi/common-hal/wifi/Radio.c msgid "Already scanning for wifi networks" msgstr "Halihazırda wifi ağları için tarama yapılıyor" -#: ports/cxd56/common-hal/analogio/AnalogIn.c -msgid "AnalogIn not supported on given pin" -msgstr "Verilen pin için AnalogIn desteklenmemektedir" - -#: ports/cxd56/common-hal/analogio/AnalogOut.c -#: ports/mimxrt10xx/common-hal/analogio/AnalogOut.c -#: ports/nrf/common-hal/analogio/AnalogOut.c -#: ports/raspberrypi/common-hal/analogio/AnalogOut.c -msgid "AnalogOut functionality not supported" -msgstr "AnalogOut işlevi desteklenmemektedir" - -#: shared-bindings/analogio/AnalogOut.c -msgid "AnalogOut is only 16 bits. Value must be less than 65536." -msgstr "AnalogOut yalnızca 16 bitlik. Değer 65536'dan küçük olmalıdır." - -#: ports/atmel-samd/common-hal/analogio/AnalogOut.c -msgid "AnalogOut not supported on given pin" -msgstr "Verilen pin için AnalogOut desteklenmemektedir" - #: ports/stm/common-hal/audiopwmio/PWMAudioOut.c msgid "Another PWMAudioOut is already active" msgstr "Başka bir PWMAudioOut zaten aktif durumda" @@ -539,7 +541,7 @@ msgstr "Ses dönüşümü implemente edilmedi" msgid "AuthMode.OPEN is not used with password" msgstr "AuthMode.OPEN bir şifre ile kullanılmadı" -#: shared-bindings/wifi/Radio.c +#: shared-bindings/wifi/Radio.c supervisor/shared/web_workflow/web_workflow.c msgid "Authentication failure" msgstr "Kimlik doğrulama hatası" @@ -572,11 +574,6 @@ 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 "Bit derinliği 1-6 aralığında olmalı, %d değil" - #: shared-bindings/audiobusio/PDMIn.c msgid "Bit depth must be multiple of 8." msgstr "Bit derinliği 8'in katı olacak şekilde olmalı." @@ -613,27 +610,21 @@ msgstr "Parlaklık ayarlanabilir değil" #: shared-bindings/_bleio/UUID.c #, c-format msgid "Buffer + offset too small %d %d %d" -msgstr "" +msgstr "Buffer + offset çok küçük %d %d %d" #: ports/raspberrypi/bindings/rp2pio/StateMachine.c msgid "Buffer elements must be 4 bytes long or less" -msgstr "" - -#: shared-module/usb_hid/Device.c -#, c-format -msgid "Buffer incorrect size. Should be %d bytes." -msgstr "Geçersiz arabellek boyutu. %d kadar olmalı" +msgstr "Buffer elementleri 4 bit olmak zorunda" #: shared-bindings/framebufferio/FramebufferDisplay.c msgid "Buffer is not a bytearray." -msgstr "Arabellek bayt dizisi değil" +msgstr "Buffer bir bytearray değil." #: ports/cxd56/common-hal/camera/Camera.c shared-bindings/displayio/Display.c #: shared-bindings/framebufferio/FramebufferDisplay.c msgid "Buffer is too small" msgstr "Arabellek çok küçük" -#: ports/nrf/common-hal/audiopwmio/PWMAudioOut.c #: ports/stm/common-hal/audiopwmio/PWMAudioOut.c #, c-format msgid "Buffer length %d too big. It must be less than %d" @@ -646,16 +637,12 @@ msgstr "Arabellek boyutu 512'nin katı olmalı" #: ports/stm/common-hal/sdioio/SDCard.c shared-bindings/floppyio/__init__.c msgid "Buffer must be a multiple of 512 bytes" -msgstr "" - -#: shared-bindings/bitbangio/I2C.c -msgid "Buffer must be at least length 1" -msgstr "Arabellek boyutu en az 1 olmalı" +msgstr "Buffer 512 bitin katı olmalı" #: shared-bindings/_bleio/PacketBuffer.c #, c-format msgid "Buffer too short by %d bytes" -msgstr "" +msgstr "Buffer bitten %d daha az" #: ports/espressif/common-hal/imagecapture/ParallelImageCapture.c msgid "Buffers must be same size" @@ -671,11 +658,7 @@ msgstr "Veriyolu pini %d kullanımda" #: shared-bindings/_bleio/UUID.c msgid "Byte buffer must be 16 bytes." -msgstr "" - -#: shared-bindings/alarm/SleepMemory.c shared-bindings/nvm/ByteArray.c -msgid "Bytes must be between 0 and 255." -msgstr "Baytlar 0-255 aralığında olmalı" +msgstr "Bit buffer'ı 16bit olmalı." #: shared-bindings/aesio/aes.c msgid "CBC blocks must be multiples of 16 bytes" @@ -683,16 +666,20 @@ msgstr "CBC blokları 16 baytın katları şeklinde olmalı" #: supervisor/shared/safe_mode.c msgid "CIRCUITPY drive could not be found or created." -msgstr "CIRCUITPY sürücüsü bulunamadı veya oluşturulamadı" +msgstr "CIRCUITPY sürücüsü bulunamadı veya oluşturulamadı." -#: ports/espressif/bindings/espidf/__init__.c ports/espressif/esp_error.c +#: ports/espressif/common-hal/espidf/__init__.c ports/espressif/esp_error.c msgid "CRC or checksum was invalid" -msgstr "" +msgstr "CRC yada checksum geçersiz" #: py/objtype.c msgid "Call super().__init__() before accessing native object." msgstr "" +#: ports/cxd56/common-hal/camera/Camera.c +msgid "Camera init" +msgstr "" + #: ports/espressif/common-hal/alarm/pin/PinAlarm.c msgid "Can only alarm on RTC IO from deep sleep." msgstr "" @@ -730,28 +717,21 @@ msgstr "Değerler silinemez" #: ports/nrf/common-hal/digitalio/DigitalInOut.c #: ports/raspberrypi/common-hal/digitalio/DigitalInOut.c msgid "Cannot get pull while in output mode" -msgstr "" +msgstr "Çıkış modundayken çekme alınamıyor" #: ports/nrf/common-hal/microcontroller/Processor.c msgid "Cannot get temperature" -msgstr "" +msgstr "Isı okunamadı" #: shared-bindings/_bleio/Adapter.c +#, fuzzy msgid "Cannot have scan responses for extended, connectable advertisements." -msgstr "" - -#: ports/atmel-samd/common-hal/audioio/AudioOut.c -msgid "Cannot output both channels on the same pin" -msgstr "" +msgstr "Genişletilmiş, bağlanabilir reklamlar için tarama yanıtları yapılamaz." #: ports/espressif/common-hal/alarm/pin/PinAlarm.c msgid "Cannot pull on input-only pin." msgstr "" -#: shared-module/bitbangio/SPI.c -msgid "Cannot read without MISO pin." -msgstr "" - #: shared-bindings/audiobusio/PDMIn.c msgid "Cannot record to a file" msgstr "" @@ -763,7 +743,7 @@ msgstr "" #: ports/atmel-samd/common-hal/microcontroller/__init__.c #: ports/cxd56/common-hal/microcontroller/__init__.c #: ports/mimxrt10xx/common-hal/microcontroller/__init__.c -msgid "Cannot reset into bootloader because no bootloader is present." +msgid "Cannot reset into bootloader because no bootloader is present" msgstr "" #: ports/espressif/common-hal/socketpool/Socket.c @@ -784,20 +764,19 @@ msgid "Cannot subclass slice" msgstr "" #: shared-module/bitbangio/SPI.c -msgid "Cannot transfer without MOSI and MISO pins." +msgid "Cannot transfer without MOSI and MISO pins" msgstr "" #: shared-bindings/pwmio/PWMOut.c msgid "Cannot vary frequency on a timer that is already in use" msgstr "" -#: ports/espressif/common-hal/alarm/pin/PinAlarm.c #: ports/nrf/common-hal/alarm/pin/PinAlarm.c -msgid "Cannot wake on pin edge. Only level." +msgid "Cannot wake on pin edge, only level" msgstr "" -#: shared-module/bitbangio/SPI.c -msgid "Cannot write without MOSI pin." +#: ports/espressif/common-hal/alarm/pin/PinAlarm.c +msgid "Cannot wake on pin edge. Only level." msgstr "" #: shared-bindings/_bleio/CharacteristicBuffer.c @@ -806,67 +785,29 @@ msgstr "" #: supervisor/shared/safe_mode.c msgid "CircuitPython core code crashed hard. Whoops!\n" -msgstr "" +msgstr "CircuitPython kor kodu patladı. Haydaaa!\n" #: supervisor/shared/safe_mode.c msgid "CircuitPython was unable to allocate the heap." msgstr "" -#: shared-module/bitbangio/SPI.c -msgid "Clock pin init failed." -msgstr "" - #: shared-module/bitbangio/I2C.c msgid "Clock stretch too long" msgstr "" #: ports/atmel-samd/common-hal/audiobusio/I2SOut.c msgid "Clock unit in use" -msgstr "" - -#: shared-bindings/displayio/FourWire.c shared-bindings/displayio/I2CDisplay.c -#: shared-bindings/paralleldisplay/ParallelBus.c -msgid "Command must be an int between 0 and 255" -msgstr "" +msgstr "Saat ünitesi kullanımda" #: shared-bindings/_bleio/Connection.c msgid "" "Connection has been disconnected and can no longer be used. Create a new " "connection." -msgstr "" +msgstr "Bağlantı koparıldı ve tekrar kullanılamaz. Yeni bir bağlantı kurun." #: py/persistentcode.c msgid "Corrupt .mpy file" -msgstr "" - -#: ports/cxd56/common-hal/camera/Camera.c -msgid "Could not initialize Camera" -msgstr "" - -#: ports/cxd56/common-hal/gnss/GNSS.c -msgid "Could not initialize GNSS" -msgstr "" - -#: ports/cxd56/common-hal/sdioio/SDCard.c -msgid "Could not initialize SDCard" -msgstr "" - -#: ports/atmel-samd/common-hal/busio/UART.c ports/cxd56/common-hal/busio/UART.c -#: ports/espressif/common-hal/busio/UART.c -msgid "Could not initialize UART" -msgstr "" - -#: ports/stm/common-hal/pwmio/PWMOut.c -msgid "Could not re-init channel" -msgstr "" - -#: ports/stm/common-hal/pwmio/PWMOut.c -msgid "Could not re-init timer" -msgstr "" - -#: ports/stm/common-hal/pwmio/PWMOut.c -msgid "Could not restart PWM" -msgstr "" +msgstr "Bozuk .mpy dosyası" #: ports/espressif/common-hal/neopixel_write/__init__.c msgid "Could not retrieve clock" @@ -878,7 +819,7 @@ msgstr "" #: shared-bindings/pwmio/PWMOut.c msgid "Could not start PWM" -msgstr "" +msgstr "PWM başlatılamadı" #: ports/stm/common-hal/busio/UART.c msgid "Could not start interrupt, RX busy" @@ -888,20 +829,6 @@ msgstr "" msgid "Couldn't allocate decoder" msgstr "" -#: shared-module/audiocore/WaveFile.c shared-module/audiomixer/Mixer.c -#: shared-module/audiomp3/MP3Decoder.c -msgid "Couldn't allocate first buffer" -msgstr "" - -#: shared-module/audiomp3/MP3Decoder.c -msgid "Couldn't allocate input buffer" -msgstr "" - -#: shared-module/audiocore/WaveFile.c shared-module/audiomixer/Mixer.c -#: shared-module/audiomp3/MP3Decoder.c -msgid "Couldn't allocate second buffer" -msgstr "" - #: supervisor/shared/safe_mode.c msgid "Crash into the HardFault_Handler." msgstr "" @@ -949,10 +876,6 @@ msgstr "" msgid "Device in use" msgstr "" -#: ports/cxd56/common-hal/digitalio/DigitalInOut.c -msgid "DigitalInOut not supported on given pin" -msgstr "" - #: shared-bindings/displayio/Display.c #: shared-bindings/framebufferio/FramebufferDisplay.c msgid "Display must have a 16 bit colorspace." @@ -964,6 +887,10 @@ msgstr "" msgid "Display rotation must be in 90 degree increments" msgstr "" +#: main.c +msgid "Done" +msgstr "" + #: shared-bindings/digitalio/DigitalInOut.c msgid "Drive mode not used when direction is input." msgstr "" @@ -997,20 +924,19 @@ msgstr "" msgid "Error: Failure to bind" msgstr "" -#: ports/raspberrypi/bindings/rp2pio/StateMachine.c py/enum.c -#: shared-bindings/_bleio/__init__.c shared-bindings/aesio/aes.c -#: shared-bindings/busio/SPI.c shared-bindings/microcontroller/Pin.c +#: py/enum.c shared-bindings/_bleio/__init__.c shared-bindings/aesio/aes.c +#: shared-bindings/alarm/__init__.c shared-bindings/busio/SPI.c +#: shared-bindings/microcontroller/Pin.c #: shared-bindings/neopixel_write/__init__.c msgid "Expected a %q" msgstr "" -#: shared-bindings/alarm/__init__.c -msgid "Expected an alarm" +#: ports/raspberrypi/bindings/cyw43/__init__.c +msgid "Expected a %q or %q" msgstr "" -#: shared-module/adafruit_pixelbuf/PixelBuf.c -#, c-format -msgid "Expected tuple of length %d, got %d" +#: shared-bindings/alarm/__init__.c +msgid "Expected an %q" msgstr "" #: ports/espressif/common-hal/_bleio/Adapter.c @@ -1039,20 +965,8 @@ msgstr "" msgid "Failed to acquire mutex, err 0x%04x" msgstr "" -#: ports/mimxrt10xx/common-hal/busio/UART.c ports/nrf/common-hal/busio/UART.c -#: ports/raspberrypi/common-hal/busio/UART.c -msgid "Failed to allocate RX buffer" -msgstr "" - -#: ports/atmel-samd/common-hal/busio/UART.c -#: ports/atmel-samd/common-hal/pulseio/PulseIn.c -#: ports/cxd56/common-hal/pulseio/PulseIn.c -#: ports/espressif/common-hal/pulseio/PulseIn.c -#: ports/nrf/common-hal/pulseio/PulseIn.c -#: ports/raspberrypi/common-hal/pulseio/PulseIn.c -#: ports/stm/common-hal/pulseio/PulseIn.c -#, c-format -msgid "Failed to allocate RX buffer of %d bytes" +#: shared-module/rgbmatrix/RGBMatrix.c +msgid "Failed to allocate %q buffer" msgstr "" #: ports/espressif/common-hal/wifi/__init__.c @@ -1076,10 +990,6 @@ msgstr "" msgid "Failed to connect: timeout" msgstr "" -#: ports/espressif/common-hal/wifi/__init__.c -msgid "Failed to init wifi" -msgstr "" - #: shared-module/audiomp3/MP3Decoder.c msgid "Failed to parse MP3 file" msgstr "" @@ -1123,11 +1033,6 @@ msgstr "" msgid "Format not supported" msgstr "" -#: shared-module/framebufferio/FramebufferDisplay.c -#, c-format -msgid "Framebuffer requires %d bytes" -msgstr "" - #: ports/mimxrt10xx/common-hal/microcontroller/Processor.c msgid "" "Frequency must be 24, 150, 396, 450, 528, 600, 720, 816, 912, 960 or 1008 Mhz" @@ -1142,7 +1047,11 @@ msgstr "" msgid "Function requires lock" msgstr "" -#: ports/espressif/bindings/espidf/__init__.c ports/espressif/esp_error.c +#: ports/cxd56/common-hal/gnss/GNSS.c +msgid "GNSS init" +msgstr "" + +#: ports/espressif/common-hal/espidf/__init__.c ports/espressif/esp_error.c msgid "Generic Failure" msgstr "" @@ -1169,19 +1078,16 @@ msgstr "" msgid "Hardware in use, try alternative pins" msgstr "" -#: shared-bindings/wifi/Radio.c -msgid "Hostname must be between 1 and 253 characters" -msgstr "" - #: extmod/vfs_posix_file.c py/objstringio.c msgid "I/O operation on closed file" msgstr "" #: ports/stm/common-hal/busio/I2C.c -msgid "I2C Init Error" +msgid "I2C init error" msgstr "" #: ports/raspberrypi/common-hal/busio/I2C.c +#: ports/raspberrypi/common-hal/i2ctarget/I2CTarget.c msgid "I2C peripheral in use" msgstr "" @@ -1286,75 +1192,37 @@ msgstr "" msgid "Internal error #%d" msgstr "" -#: shared-bindings/sdioio/SDCard.c shared-module/usb_hid/Device.c +#: supervisor/shared/safe_mode.c +msgid "Internal watchdog timer expired." +msgstr "" + +#: py/argcheck.c shared-bindings/digitalio/DigitalInOut.c msgid "Invalid %q" msgstr "" -#: ports/atmel-samd/common-hal/audiobusio/I2SOut.c -#: ports/atmel-samd/common-hal/audiobusio/PDMIn.c -#: ports/atmel-samd/common-hal/imagecapture/ParallelImageCapture.c -#: ports/mimxrt10xx/common-hal/busio/UART.c +#: shared-bindings/microcontroller/Pin.c msgid "Invalid %q pin" msgstr "" -#: ports/stm/common-hal/busio/I2C.c ports/stm/common-hal/busio/SPI.c -#: ports/stm/common-hal/busio/UART.c ports/stm/common-hal/canio/CAN.c -#: ports/stm/common-hal/sdioio/SDCard.c -msgid "Invalid %q pin selection" -msgstr "" - #: ports/stm/common-hal/analogio/AnalogIn.c msgid "Invalid ADC Unit value" msgstr "" -#: ports/espressif/common-hal/wifi/Radio.c -msgid "Invalid AuthMode" -msgstr "" - #: ports/espressif/common-hal/_bleio/__init__.c #: ports/nrf/common-hal/_bleio/__init__.c msgid "Invalid BLE parameter" msgstr "" -#: shared-module/displayio/OnDiskBitmap.c -msgid "Invalid BMP file" -msgstr "" - #: shared-bindings/wifi/Radio.c msgid "Invalid BSSID" msgstr "" -#: ports/espressif/common-hal/analogio/AnalogOut.c -#: ports/stm/common-hal/analogio/AnalogOut.c -msgid "Invalid DAC pin supplied" -msgstr "" - #: shared-bindings/wifi/Radio.c msgid "Invalid MAC address" msgstr "" -#: shared-bindings/synthio/__init__.c -msgid "Invalid MIDI file" -msgstr "" - -#: ports/atmel-samd/common-hal/pwmio/PWMOut.c -#: ports/cxd56/common-hal/pwmio/PWMOut.c -#: ports/espressif/common-hal/pwmio/PWMOut.c -#: ports/mimxrt10xx/common-hal/pwmio/PWMOut.c -#: ports/nrf/common-hal/pwmio/PWMOut.c -#: ports/raspberrypi/common-hal/pwmio/PWMOut.c shared-bindings/pwmio/PWMOut.c -msgid "Invalid PWM frequency" -msgstr "" - -#: ports/espressif/common-hal/analogio/AnalogIn.c -msgid "Invalid Pin" -msgstr "" - -#: ports/espressif/bindings/espidf/__init__.c -#: ports/espressif/common-hal/busio/I2C.c -#: ports/espressif/common-hal/i2cperipheral/I2CPeripheral.c -#: ports/espressif/esp_error.c py/moduerrno.c -#: shared-module/rgbmatrix/RGBMatrix.c +#: ports/espressif/common-hal/espidf/__init__.c ports/espressif/esp_error.c +#: py/moduerrno.c msgid "Invalid argument" msgstr "" @@ -1362,42 +1230,11 @@ msgstr "" msgid "Invalid bits per value" msgstr "" -#: ports/nrf/common-hal/busio/UART.c ports/raspberrypi/common-hal/busio/UART.c -#: ports/stm/common-hal/busio/UART.c -msgid "Invalid buffer size" -msgstr "" - -#: shared-bindings/adafruit_pixelbuf/PixelBuf.c -msgid "Invalid byteorder string" -msgstr "" - -#: ports/atmel-samd/common-hal/frequencyio/FrequencyIn.c -#: ports/espressif/common-hal/frequencyio/FrequencyIn.c -msgid "Invalid capture period. Valid range: 1 - 500" -msgstr "" - -#: shared-bindings/audiomixer/Mixer.c -msgid "Invalid channel count" -msgstr "" - -#: ports/atmel-samd/common-hal/imagecapture/ParallelImageCapture.c -#, c-format -msgid "Invalid data_count %d" -msgstr "" - #: ports/atmel-samd/common-hal/imagecapture/ParallelImageCapture.c #, c-format msgid "Invalid data_pins[%d]" msgstr "" -#: shared-bindings/digitalio/DigitalInOut.c -msgid "Invalid direction." -msgstr "" - -#: shared-module/audiocore/WaveFile.c -msgid "Invalid file" -msgstr "" - #: shared-module/audiocore/WaveFile.c msgid "Invalid format chunk size" msgstr "" @@ -1406,107 +1243,27 @@ msgstr "" msgid "Invalid memory access." msgstr "" -#: extmod/vfs_fat_file.c -msgid "Invalid mode" -msgstr "" - #: ports/espressif/common-hal/wifi/Radio.c msgid "Invalid multicast MAC address" msgstr "" -#: shared-bindings/bitbangio/SPI.c shared-bindings/busio/SPI.c -msgid "Invalid number of bits" -msgstr "" - -#: shared-bindings/bitbangio/SPI.c shared-bindings/busio/SPI.c -#: shared-bindings/displayio/FourWire.c -msgid "Invalid phase" -msgstr "" - -#: ports/atmel-samd/common-hal/audioio/AudioOut.c -#: ports/atmel-samd/common-hal/touchio/TouchIn.c -#: ports/espressif/common-hal/alarm/touch/TouchAlarm.c -#: ports/espressif/common-hal/touchio/TouchIn.c -#: ports/nrf/common-hal/alarm/pin/PinAlarm.c shared-bindings/pwmio/PWMOut.c -#: shared-module/rgbmatrix/RGBMatrix.c -msgid "Invalid pin" -msgstr "" - -#: ports/atmel-samd/common-hal/audioio/AudioOut.c -msgid "Invalid pin for left channel" -msgstr "" - -#: ports/atmel-samd/common-hal/audioio/AudioOut.c -msgid "Invalid pin for right channel" -msgstr "" - -#: ports/atmel-samd/common-hal/busio/I2C.c -#: ports/atmel-samd/common-hal/busio/SPI.c -#: ports/atmel-samd/common-hal/busio/UART.c -#: ports/atmel-samd/common-hal/i2cperipheral/I2CPeripheral.c -#: ports/cxd56/common-hal/busio/I2C.c ports/cxd56/common-hal/busio/SPI.c -#: ports/cxd56/common-hal/busio/UART.c ports/cxd56/common-hal/sdioio/SDCard.c -#: ports/espressif/common-hal/busio/I2C.c -#: ports/espressif/common-hal/busio/SPI.c -#: ports/espressif/common-hal/busio/UART.c -#: ports/espressif/common-hal/canio/CAN.c -#: ports/espressif/common-hal/i2cperipheral/I2CPeripheral.c -#: ports/mimxrt10xx/common-hal/busio/I2C.c -#: ports/mimxrt10xx/common-hal/busio/SPI.c -#: ports/mimxrt10xx/common-hal/usb_host/Port.c ports/nrf/common-hal/busio/I2C.c -#: ports/raspberrypi/common-hal/busio/I2C.c -#: ports/raspberrypi/common-hal/busio/SPI.c -#: ports/raspberrypi/common-hal/busio/UART.c shared-bindings/busio/SPI.c #: shared-bindings/busio/UART.c msgid "Invalid pins" msgstr "" -#: shared-bindings/bitbangio/SPI.c shared-bindings/busio/SPI.c -#: shared-bindings/displayio/FourWire.c -msgid "Invalid polarity" -msgstr "" - -#: shared-bindings/_bleio/Characteristic.c -msgid "Invalid properties" -msgstr "" - -#: shared-bindings/microcontroller/__init__.c -msgid "Invalid run mode." -msgstr "" - -#: shared-module/_bleio/Attribute.c -msgid "Invalid security_mode" -msgstr "" - -#: ports/espressif/bindings/espidf/__init__.c ports/espressif/esp_error.c +#: ports/espressif/common-hal/espidf/__init__.c ports/espressif/esp_error.c msgid "Invalid size" msgstr "" #: ports/espressif/common-hal/ssl/SSLContext.c +#: ports/raspberrypi/common-hal/ssl/SSLSocket.c msgid "Invalid socket for TLS" msgstr "" -#: ports/espressif/bindings/espidf/__init__.c ports/espressif/esp_error.c +#: ports/espressif/common-hal/espidf/__init__.c ports/espressif/esp_error.c msgid "Invalid state" msgstr "" -#: shared-bindings/audiomixer/Mixer.c -msgid "Invalid voice" -msgstr "" - -#: shared-bindings/audiomixer/Mixer.c -msgid "Invalid voice count" -msgstr "" - -#: shared-module/audiocore/WaveFile.c -msgid "Invalid wave file" -msgstr "" - -#: ports/mimxrt10xx/common-hal/busio/UART.c ports/nrf/common-hal/busio/UART.c -#: ports/raspberrypi/common-hal/busio/UART.c ports/stm/common-hal/busio/UART.c -msgid "Invalid word/bit length" -msgstr "" - #: shared-bindings/aesio/aes.c msgid "Key must be 16, 24, or 32 bytes long" msgstr "" @@ -1520,25 +1277,17 @@ msgid "LHS of keyword arg must be an id" msgstr "" #: shared-module/displayio/Group.c -msgid "Layer already in a group." +msgid "Layer already in a group" msgstr "" #: shared-module/displayio/Group.c -msgid "Layer must be a Group or TileGrid subclass." +msgid "Layer must be a Group or TileGrid subclass" msgstr "" -#: ports/espressif/bindings/espidf/__init__.c ports/espressif/esp_error.c +#: ports/espressif/common-hal/espidf/__init__.c ports/espressif/esp_error.c msgid "MAC address was invalid" msgstr "" -#: shared-module/bitbangio/SPI.c -msgid "MISO pin init failed." -msgstr "" - -#: shared-module/bitbangio/SPI.c -msgid "MOSI pin init failed." -msgstr "" - #: shared-bindings/is31fl3741/IS31FL3741.c msgid "Mapping must be a tuple" msgstr "" @@ -1548,10 +1297,6 @@ msgstr "" msgid "Maximum x value when mirrored is %d" msgstr "" -#: shared-bindings/canio/Message.c -msgid "Messages limited to 8 bytes" -msgstr "" - #: shared-bindings/audiobusio/PDMIn.c msgid "Microphone startup delay must be in range 0.0 to 1.0" msgstr "" @@ -1565,10 +1310,14 @@ msgstr "" msgid "Mismatched swap flag" msgstr "" -#: ports/mimxrt10xx/common-hal/busio/SPI.c ports/stm/common-hal/busio/SPI.c +#: ports/mimxrt10xx/common-hal/busio/SPI.c msgid "Missing MISO or MOSI Pin" msgstr "" +#: ports/stm/common-hal/busio/SPI.c +msgid "Missing MISO or MOSI pin" +msgstr "" + #: ports/raspberrypi/common-hal/rp2pio/StateMachine.c #, c-format msgid "Missing first_in_pin. Instruction %d reads pin(s)" @@ -1604,11 +1353,6 @@ msgstr "" msgid "Missing jmp_pin. Instruction %d jumps on pin" msgstr "" -#: shared-module/usb_hid/Device.c -#, c-format -msgid "More than %d report ids not supported" -msgstr "" - #: shared-bindings/busio/UART.c shared-bindings/displayio/Group.c msgid "Must be a %q subclass." msgstr "" @@ -1668,16 +1412,28 @@ msgstr "" msgid "No I2C device at address: 0x%x" msgstr "" -#: ports/espressif/common-hal/busio/SPI.c -#: ports/mimxrt10xx/common-hal/busio/SPI.c ports/stm/common-hal/busio/SPI.c -msgid "No MISO Pin" +#: supervisor/shared/web_workflow/web_workflow.c +msgid "No IP" msgstr "" #: ports/espressif/common-hal/busio/SPI.c -#: ports/mimxrt10xx/common-hal/busio/SPI.c ports/stm/common-hal/busio/SPI.c +#: ports/mimxrt10xx/common-hal/busio/SPI.c +msgid "No MISO Pin" +msgstr "" + +#: ports/stm/common-hal/busio/SPI.c shared-module/bitbangio/SPI.c +msgid "No MISO pin" +msgstr "" + +#: ports/espressif/common-hal/busio/SPI.c +#: ports/mimxrt10xx/common-hal/busio/SPI.c msgid "No MOSI Pin" msgstr "" +#: ports/stm/common-hal/busio/SPI.c shared-module/bitbangio/SPI.c +msgid "No MOSI pin" +msgstr "" + #: ports/atmel-samd/common-hal/busio/UART.c #: ports/espressif/common-hal/busio/UART.c #: ports/mimxrt10xx/common-hal/busio/UART.c ports/nrf/common-hal/busio/UART.c @@ -1716,16 +1472,6 @@ msgstr "" msgid "No hardware random available" msgstr "" -#: ports/atmel-samd/common-hal/ps2io/Ps2.c -msgid "No hardware support on clk pin" -msgstr "" - -#: ports/atmel-samd/common-hal/alarm/pin/PinAlarm.c -#: ports/atmel-samd/common-hal/frequencyio/FrequencyIn.c -#: ports/atmel-samd/common-hal/pulseio/PulseIn.c -msgid "No hardware support on pin" -msgstr "" - #: ports/raspberrypi/common-hal/rp2pio/StateMachine.c msgid "No in in program" msgstr "" @@ -1823,16 +1569,26 @@ msgstr "" msgid "Odd parity is not supported" msgstr "" +#: supervisor/shared/bluetooth/bluetooth.c +msgid "Off" +msgstr "" + +#: supervisor/shared/bluetooth/bluetooth.c +msgid "Ok" +msgstr "" + #: ports/atmel-samd/common-hal/audiobusio/PDMIn.c #: ports/raspberrypi/common-hal/audiobusio/PDMIn.c msgid "Only 8 or 16 bit mono with " msgstr "" #: ports/espressif/common-hal/wifi/__init__.c +#: ports/raspberrypi/common-hal/wifi/__init__.c msgid "Only IPv4 addresses supported" msgstr "" -#: ports/espressif/common-hal/socketpool/SocketPool.c +#: ports/espressif/common-hal/socketpool/Socket.c +#: ports/raspberrypi/common-hal/socketpool/Socket.c msgid "Only IPv4 sockets supported" msgstr "" @@ -1865,15 +1621,19 @@ msgstr "" msgid "Only one TouchAlarm can be set in deep sleep." msgstr "" -#: ports/espressif/common-hal/i2cperipheral/I2CPeripheral.c +#: ports/espressif/common-hal/i2ctarget/I2CTarget.c +#: ports/raspberrypi/common-hal/i2ctarget/I2CTarget.c msgid "Only one address is allowed" msgstr "" #: ports/atmel-samd/common-hal/alarm/time/TimeAlarm.c -#: ports/espressif/common-hal/alarm/time/TimeAlarm.c #: ports/nrf/common-hal/alarm/time/TimeAlarm.c -#: ports/raspberrypi/common-hal/alarm/time/TimeAlarm.c #: ports/stm/common-hal/alarm/time/TimeAlarm.c +msgid "Only one alarm.time alarm can be set" +msgstr "" + +#: ports/espressif/common-hal/alarm/time/TimeAlarm.c +#: ports/raspberrypi/common-hal/alarm/time/TimeAlarm.c msgid "Only one alarm.time alarm can be set." msgstr "" @@ -1885,19 +1645,20 @@ msgstr "" msgid "Operation not permitted" msgstr "" -#: ports/espressif/bindings/espidf/__init__.c ports/espressif/esp_error.c +#: ports/espressif/common-hal/espidf/__init__.c ports/espressif/esp_error.c msgid "Operation or feature not supported" msgstr "" -#: ports/espressif/bindings/espidf/__init__.c ports/espressif/esp_error.c +#: ports/espressif/common-hal/espidf/__init__.c ports/espressif/esp_error.c msgid "Operation timed out" msgstr "" -#: ports/espressif/bindings/espidf/__init__.c ports/espressif/esp_error.c +#: ports/espressif/common-hal/espidf/__init__.c ports/espressif/esp_error.c msgid "Out of memory" msgstr "" -#: ports/espressif/common-hal/socketpool/SocketPool.c +#: ports/espressif/common-hal/socketpool/Socket.c +#: ports/raspberrypi/common-hal/socketpool/Socket.c msgid "Out of sockets" msgstr "" @@ -1905,11 +1666,6 @@ msgstr "" msgid "Out-buffer elements must be <= 4 bytes long" msgstr "" -#: shared-bindings/bitops/__init__.c -#, c-format -msgid "Output buffer must be at least %d bytes" -msgstr "" - #: shared-bindings/audiobusio/PDMIn.c msgid "Oversample must be multiple of 8." msgstr "" @@ -1920,12 +1676,11 @@ msgstr "" #: shared-bindings/pwmio/PWMOut.c msgid "" -"PWM duty_cycle must be between 0 and 65535 inclusive (16 bit resolution)" +"PWM frequency not writable when variable_frequency is False on construction." msgstr "" -#: shared-bindings/pwmio/PWMOut.c -msgid "" -"PWM frequency not writable when variable_frequency is False on construction." +#: ports/stm/common-hal/pwmio/PWMOut.c +msgid "PWM restart" msgstr "" #: ports/raspberrypi/common-hal/countio/Counter.c @@ -1944,36 +1699,20 @@ msgstr "" msgid "Permission denied" msgstr "" -#: ports/atmel-samd/common-hal/alarm/pin/PinAlarm.c #: ports/stm/common-hal/alarm/pin/PinAlarm.c msgid "Pin cannot wake from Deep Sleep" msgstr "" -#: ports/raspberrypi/bindings/rp2pio/StateMachine.c -msgid "Pin count must be at least 1" -msgstr "" - #: ports/raspberrypi/common-hal/rp2pio/StateMachine.c msgid "Pin count too large" msgstr "" -#: ports/atmel-samd/common-hal/analogio/AnalogIn.c -#: ports/cxd56/common-hal/analogio/AnalogIn.c -#: ports/espressif/common-hal/analogio/AnalogIn.c -#: ports/mimxrt10xx/common-hal/analogio/AnalogIn.c -#: ports/nrf/common-hal/analogio/AnalogIn.c -#: ports/raspberrypi/common-hal/analogio/AnalogIn.c -#: ports/stm/common-hal/analogio/AnalogIn.c -msgid "Pin does not have ADC capabilities" -msgstr "" - #: ports/stm/common-hal/alarm/pin/PinAlarm.c #: ports/stm/common-hal/pulseio/PulseIn.c msgid "Pin interrupt already in use" msgstr "" #: shared-bindings/adafruit_bus_device/spi_device/SPIDevice.c -#: shared-bindings/digitalio/DigitalInOut.c msgid "Pin is input only" msgstr "" @@ -2036,18 +1775,10 @@ msgstr "" msgid "Program does OUT without loading OSR" msgstr "" -#: ports/raspberrypi/bindings/rp2pio/StateMachine.c -msgid "Program must contain at least one 16-bit instruction." -msgstr "" - #: ports/raspberrypi/bindings/rp2pio/StateMachine.c msgid "Program size invalid" msgstr "" -#: ports/raspberrypi/bindings/rp2pio/StateMachine.c -msgid "Program too large" -msgstr "" - #: shared-bindings/digitalio/DigitalInOut.c msgid "Pull not used when direction is output." msgstr "" @@ -2069,8 +1800,9 @@ msgstr "" msgid "RNG Init Error" msgstr "" -#: ports/nrf/common-hal/busio/UART.c -msgid "RS485 Not yet supported on this device" +#: ports/atmel-samd/common-hal/busio/UART.c ports/cxd56/common-hal/busio/UART.c +#: ports/nrf/common-hal/busio/UART.c ports/stm/common-hal/busio/UART.c +msgid "RS485" msgstr "" #: ports/espressif/common-hal/busio/UART.c @@ -2078,21 +1810,10 @@ msgstr "" msgid "RS485 inversion specified when not in RS485 mode" msgstr "" -#: ports/cxd56/common-hal/rtc/RTC.c ports/espressif/common-hal/rtc/RTC.c -#: ports/mimxrt10xx/common-hal/rtc/RTC.c ports/nrf/common-hal/rtc/RTC.c -#: ports/raspberrypi/common-hal/rtc/RTC.c -msgid "RTC calibration is not supported on this board" -msgstr "" - #: shared-bindings/alarm/time/TimeAlarm.c shared-bindings/time/__init__.c msgid "RTC is not supported on this board" msgstr "" -#: ports/atmel-samd/common-hal/busio/UART.c ports/cxd56/common-hal/busio/UART.c -#: ports/stm/common-hal/busio/UART.c -msgid "RTS/CTS/RS485 Not yet supported on this device" -msgstr "" - #: ports/stm/common-hal/os/__init__.c msgid "Random number generation error" msgstr "" @@ -2110,10 +1831,14 @@ msgstr "" msgid "Read-only object" msgstr "" -#: ports/espressif/bindings/espidf/__init__.c ports/espressif/esp_error.c +#: ports/espressif/common-hal/espidf/__init__.c ports/espressif/esp_error.c msgid "Received response was invalid" msgstr "" +#: supervisor/shared/bluetooth/bluetooth.c +msgid "Reconnecting" +msgstr "" + #: shared-bindings/displayio/EPaperDisplay.c msgid "Refresh too soon" msgstr "" @@ -2126,7 +1851,7 @@ msgstr "" msgid "Requested AES mode is unsupported" msgstr "" -#: ports/espressif/bindings/espidf/__init__.c ports/espressif/esp_error.c +#: ports/espressif/common-hal/espidf/__init__.c ports/espressif/esp_error.c msgid "Requested resource not found" msgstr "" @@ -2142,6 +1867,10 @@ msgstr "" msgid "SD card CSD format not supported" msgstr "" +#: ports/cxd56/common-hal/sdioio/SDCard.c +msgid "SDCard init" +msgstr "" + #: ports/stm/common-hal/sdioio/SDCard.c #, c-format msgid "SDIO GetCardInfo Error %d" @@ -2152,29 +1881,20 @@ msgstr "" msgid "SDIO Init Error %d" msgstr "" -#: ports/stm/common-hal/busio/SPI.c -msgid "SPI Init Error" -msgstr "" - -#: ports/stm/common-hal/busio/SPI.c -msgid "SPI Re-initialization error" -msgstr "" - #: ports/espressif/common-hal/busio/SPI.c msgid "SPI configuration failed" msgstr "" +#: ports/stm/common-hal/busio/SPI.c +msgid "SPI init error" +msgstr "" + #: ports/raspberrypi/common-hal/busio/SPI.c msgid "SPI peripheral in use" msgstr "" -#: shared-bindings/audiomixer/Mixer.c -msgid "Sample rate must be positive" -msgstr "" - -#: ports/atmel-samd/common-hal/audioio/AudioOut.c -#, c-format -msgid "Sample rate too high. It must be less than %d" +#: ports/stm/common-hal/busio/SPI.c +msgid "SPI re-init" msgstr "" #: shared-bindings/is31fl3741/FrameBuffer.c @@ -2195,14 +1915,6 @@ msgstr "" msgid "Server side context cannot have hostname" msgstr "" -#: ports/raspberrypi/bindings/rp2pio/StateMachine.c -msgid "Set pin count must be between 1 and 5" -msgstr "" - -#: ports/raspberrypi/bindings/rp2pio/StateMachine.c -msgid "Side set pin count must be between 1 and 5" -msgstr "" - #: ports/cxd56/common-hal/camera/Camera.c msgid "Size not supported" msgstr "" @@ -2223,6 +1935,7 @@ msgid "Slices not supported" msgstr "" #: ports/espressif/common-hal/socketpool/SocketPool.c +#: ports/raspberrypi/common-hal/socketpool/SocketPool.c msgid "SocketPool can only be used with wifi.radio" msgstr "" @@ -2238,10 +1951,6 @@ msgstr "" msgid "Splitting with sub-captures" msgstr "" -#: shared-bindings/supervisor/__init__.c -msgid "Stack size must be at least 256" -msgstr "" - #: ports/raspberrypi/common-hal/audiopwmio/PWMAudioOut.c msgid "Stereo left must be on PWM channel A" msgstr "" @@ -2250,10 +1959,6 @@ msgstr "" msgid "Stereo right must be on PWM channel B" msgstr "" -#: shared-bindings/multiterminal/__init__.c -msgid "Stream missing readinto() or write() method." -msgstr "" - #: ports/mimxrt10xx/common-hal/busio/UART.c ports/stm/common-hal/busio/UART.c msgid "Supply at least one UART pin" msgstr "" @@ -2327,10 +2032,6 @@ msgstr "" msgid "Tile index out of bounds" msgstr "" -#: shared-bindings/displayio/TileGrid.c -msgid "Tile value out of bounds" -msgstr "" - #: shared-bindings/displayio/TileGrid.c msgid "Tile width must exactly divide bitmap width" msgstr "" @@ -2350,6 +2051,9 @@ msgid "To exit, please reset the board without " msgstr "" #: ports/atmel-samd/common-hal/audiobusio/I2SOut.c +msgid "Too many channels in sample" +msgstr "" + #: ports/raspberrypi/common-hal/audiobusio/I2SOut.c msgid "Too many channels in sample." msgstr "" @@ -2382,23 +2086,24 @@ msgid "Tuple or struct_time argument required" msgstr "" #: ports/stm/common-hal/busio/UART.c -msgid "UART Buffer allocation error" +msgid "UART de-init" +msgstr "" + +#: ports/atmel-samd/common-hal/busio/UART.c ports/cxd56/common-hal/busio/UART.c +#: ports/espressif/common-hal/busio/UART.c ports/stm/common-hal/busio/UART.c +msgid "UART init" msgstr "" #: ports/stm/common-hal/busio/UART.c -msgid "UART De-init error" +msgid "UART re-init" msgstr "" #: ports/stm/common-hal/busio/UART.c -msgid "UART Init Error" +msgid "UART write" msgstr "" -#: ports/stm/common-hal/busio/UART.c -msgid "UART Re-init error" -msgstr "" - -#: ports/stm/common-hal/busio/UART.c -msgid "UART write error" +#: main.c +msgid "UID:" msgstr "" #: shared-module/usb_hid/Device.c @@ -2524,6 +2229,11 @@ msgstr "" msgid "Unknown system firmware error: %d" msgstr "" +#: ports/raspberrypi/common-hal/wifi/__init__.c +#, c-format +msgid "Unkown error code %d" +msgstr "" + #: shared-bindings/adafruit_pixelbuf/PixelBuf.c #, c-format msgid "Unmatched number of items on RHS (expected %d, got %d)." @@ -2535,12 +2245,6 @@ msgid "" "declined or ignored." msgstr "" -#: ports/atmel-samd/common-hal/busio/I2C.c ports/cxd56/common-hal/busio/I2C.c -#: ports/espressif/common-hal/busio/UART.c -#: ports/raspberrypi/common-hal/busio/I2C.c ports/stm/common-hal/busio/I2C.c -msgid "Unsupported baudrate" -msgstr "" - #: shared-bindings/bitmaptools/__init__.c msgid "Unsupported colorspace" msgstr "" @@ -2553,6 +2257,10 @@ msgstr "" msgid "Unsupported format" msgstr "" +#: shared-bindings/hashlib/__init__.c +msgid "Unsupported hash algorithm" +msgstr "" + #: ports/espressif/common-hal/dualbank/__init__.c msgid "Update Failed" msgstr "" @@ -2571,7 +2279,7 @@ msgstr "" msgid "Value length > max_length" msgstr "" -#: ports/espressif/bindings/espidf/__init__.c ports/espressif/esp_error.c +#: ports/espressif/common-hal/espidf/__init__.c ports/espressif/esp_error.c msgid "Version was invalid" msgstr "" @@ -2601,10 +2309,6 @@ msgstr "" msgid "WatchDogTimer.timeout must be greater than 0" msgstr "" -#: supervisor/shared/safe_mode.c -msgid "Watchdog timer expired." -msgstr "" - #: py/builtinhelp.c #, c-format msgid "" @@ -2615,8 +2319,8 @@ msgid "" "To list built-in modules type `help(\"modules\")`.\n" msgstr "" -#: shared-bindings/wifi/Radio.c -msgid "WiFi password must be between 8 and 63 characters" +#: supervisor/shared/web_workflow/web_workflow.c +msgid "Wi-Fi: " msgstr "" #: main.c @@ -2657,11 +2361,7 @@ msgstr "" msgid "a bytes-like object is required" msgstr "" -#: shared-bindings/i2cperipheral/I2CPeripheral.c -msgid "address out of bounds" -msgstr "" - -#: shared-bindings/i2cperipheral/I2CPeripheral.c +#: shared-bindings/i2ctarget/I2CTarget.c msgid "addresses is empty" msgstr "" @@ -2710,6 +2410,10 @@ msgstr "" msgid "array and index length must be equal" msgstr "" +#: extmod/ulab/code/numpy/io/io.c +msgid "array has too many dimensions" +msgstr "" + #: py/objarray.c shared-bindings/alarm/SleepMemory.c #: shared-bindings/nvm/ByteArray.c msgid "array/bytes required on right side" @@ -2771,10 +2475,6 @@ msgstr "" msgid "bits must be 32 or less" msgstr "" -#: shared-bindings/busio/UART.c -msgid "bits must be in range 5 to 9" -msgstr "" - #: shared-bindings/audiomixer/Mixer.c msgid "bits_per_sample must be 8 or 16" msgstr "" @@ -2812,11 +2512,6 @@ msgstr "" msgid "byteorder is not a string" msgstr "" -#: ports/atmel-samd/common-hal/busio/UART.c -#: ports/espressif/common-hal/busio/UART.c -msgid "bytes > 8 bits not supported" -msgstr "" - #: py/objarray.c msgid "bytes length not a multiple of item size" msgstr "" @@ -2825,7 +2520,7 @@ msgstr "" msgid "bytes value out of range" msgstr "" -#: ports/atmel-samd/bindings/samd/Clock.c ports/atmel-samd/common-hal/rtc/RTC.c +#: ports/atmel-samd/bindings/samd/Clock.c msgid "calibration is out of range" msgstr "" @@ -2833,12 +2528,9 @@ msgstr "" msgid "calibration is read only" msgstr "" -#: ports/atmel-samd/common-hal/rtc/RTC.c -msgid "calibration value out of range +/-127" -msgstr "" - +#: shared-module/vectorio/Circle.c shared-module/vectorio/Polygon.c #: shared-module/vectorio/Rectangle.c -msgid "can only be registered in one parent" +msgid "can only have one parent" msgstr "" #: py/emitinlinethumb.c @@ -2861,8 +2553,7 @@ msgstr "" msgid "can't cancel self" msgstr "" -#: py/obj.c py/objint.c shared-bindings/i2cperipheral/I2CPeripheral.c -#: shared-module/adafruit_pixelbuf/PixelBuf.c +#: py/obj.c py/objint.c shared-module/adafruit_pixelbuf/PixelBuf.c msgid "can't convert %q to %q" msgstr "" @@ -3009,6 +2700,10 @@ msgstr "" msgid "casting" msgstr "" +#: ports/stm/common-hal/pwmio/PWMOut.c +msgid "channel re-init" +msgstr "" + #: shared-bindings/_stage/Text.c msgid "chars buffer too small" msgstr "" @@ -3021,10 +2716,6 @@ msgstr "" msgid "chr() arg not in range(256)" msgstr "" -#: shared-module/vectorio/Circle.c -msgid "circle can only be registered in one parent" -msgstr "" - #: shared-bindings/bitmaptools/__init__.c msgid "clip point must be (x,y) tuple" msgstr "" @@ -3049,10 +2740,6 @@ msgstr "" msgid "color must be between 0x000000 and 0xffffff" msgstr "" -#: shared-bindings/displayio/ColorConverter.c -msgid "color should be an int" -msgstr "" - #: py/emitnative.c msgid "comparison of int and uint" msgstr "" @@ -3089,6 +2776,10 @@ msgstr "" msgid "convolve arguments must not be empty" msgstr "" +#: extmod/ulab/code/numpy/io/io.c +msgid "corrupted file" +msgstr "" + #: extmod/ulab/code/numpy/poly.c msgid "could not invert Vandermonde matrix" msgstr "" @@ -3139,10 +2830,6 @@ msgstr "" msgid "destination buffer must be an array of type 'H' for bit_depth = 16" msgstr "" -#: shared-bindings/audiobusio/PDMIn.c -msgid "destination_length must be an int >= 0" -msgstr "" - #: py/objdict.c msgid "dict update sequence has wrong length" msgstr "" @@ -3180,6 +2867,10 @@ msgstr "" msgid "empty" msgstr "" +#: extmod/ulab/code/numpy/io/io.c +msgid "empty file" +msgstr "" + #: extmod/moduasyncio.c extmod/moduheapq.c extmod/modutimeq.c msgid "empty heap" msgstr "" @@ -3196,10 +2887,6 @@ msgstr "" msgid "end of format while looking for conversion specifier" msgstr "" -#: shared-bindings/displayio/Shape.c -msgid "end_x should be an int" -msgstr "" - #: shared-bindings/alarm/time/TimeAlarm.c msgid "epoch_time not supported on this board" msgstr "" @@ -3209,6 +2896,12 @@ msgstr "" msgid "error = 0x%08lX" msgstr "" +#: ports/espressif/common-hal/esp32_camera/Camera.c +msgid "" +"esp32_camera.Camera requires reserved PSRAM to be configured. See the " +"documentation for instructions." +msgstr "" + #: py/runtime.c msgid "exceptions must derive from BaseException" msgstr "" @@ -3283,7 +2976,7 @@ msgstr "" msgid "first argument must be a tuple of ndarrays" msgstr "" -#: extmod/ulab/code/numpy/vector.c +#: extmod/ulab/code/numpy/transform.c extmod/ulab/code/numpy/vector.c msgid "first argument must be an ndarray" msgstr "" @@ -3431,7 +3124,7 @@ msgstr "" msgid "incorrect padding" msgstr "" -#: extmod/ulab/code/ndarray.c +#: extmod/ulab/code/ndarray.c extmod/ulab/code/numpy/transform.c msgid "index is out of bounds" msgstr "" @@ -3449,6 +3142,10 @@ msgstr "" msgid "indices must be integers, slices, or Boolean lists" msgstr "" +#: ports/espressif/common-hal/busio/I2C.c +msgid "init I2C" +msgstr "" + #: extmod/ulab/code/scipy/optimize/optimize.c msgid "initial values must be iterable" msgstr "" @@ -3494,6 +3191,10 @@ msgstr "" msgid "input matrix is singular" msgstr "" +#: extmod/ulab/code/numpy/create.c +msgid "input must be 1- or 2-d" +msgstr "" + #: extmod/ulab/code/numpy/carray/carray.c msgid "input must be a 1D ndarray" msgstr "" @@ -3502,11 +3203,7 @@ msgstr "" msgid "input must be a dense ndarray" msgstr "" -#: extmod/ulab/code/numpy/create.c -msgid "input must be a tensor of rank 2" -msgstr "" - -#: extmod/ulab/code/numpy/create.c extmod/ulab/code/user/user.c +#: extmod/ulab/code/user/user.c msgid "input must be an ndarray" msgstr "" @@ -3556,6 +3253,10 @@ msgstr "" msgid "invalid bits_per_pixel %d, must be, 1, 2, 4, 8, 16, 24, or 32" msgstr "" +#: ports/raspberrypi/common-hal/ssl/SSLSocket.c +msgid "invalid cert" +msgstr "" + #: shared-bindings/bitmaptools/__init__.c #, c-format msgid "invalid element size %d for bits_per_pixel %d\n" @@ -3582,10 +3283,18 @@ msgstr "" msgid "invalid hostname" msgstr "" +#: ports/raspberrypi/common-hal/ssl/SSLSocket.c +msgid "invalid key" +msgstr "" + #: py/compile.c msgid "invalid micropython decorator" msgstr "" +#: ports/espressif/common-hal/esp32_camera/Camera.c +msgid "invalid setting" +msgstr "" + #: shared-bindings/random/__init__.c msgid "invalid step" msgstr "" @@ -3699,10 +3408,6 @@ msgstr "" msgid "matrix is not positive definite" msgstr "" -#: ports/espressif/common-hal/wifi/Radio.c -msgid "max_connections must be between 0 and 10" -msgstr "" - #: ports/espressif/common-hal/_bleio/Descriptor.c #: ports/nrf/common-hal/_bleio/Characteristic.c #: ports/nrf/common-hal/_bleio/Descriptor.c @@ -3710,12 +3415,8 @@ msgstr "" msgid "max_length must be 0-%d when fixed_length is %s" msgstr "" -#: shared-bindings/_bleio/Characteristic.c shared-bindings/_bleio/Descriptor.c -msgid "max_length must be >= 0" -msgstr "" - #: extmod/ulab/code/ndarray.c -msgid "maximum number of dimensions is 4" +msgid "maximum number of dimensions is " msgstr "" #: py/runtime.c @@ -3849,7 +3550,7 @@ msgstr "" msgid "no response from SD card" msgstr "" -#: py/objobject.c py/runtime.c +#: ports/espressif/common-hal/esp32_camera/Camera.c py/objobject.c py/runtime.c msgid "no such attribute" msgstr "" @@ -3960,7 +3661,11 @@ msgstr "" msgid "odd-length string" msgstr "" -#: extmod/ulab/code/numpy/create.c extmod/ulab/code/utils/utils.c +#: supervisor/shared/web_workflow/web_workflow.c +msgid "off" +msgstr "" + +#: extmod/ulab/code/utils/utils.c msgid "offset is too large" msgstr "" @@ -4056,10 +3761,6 @@ msgstr "" msgid "palette must be 32 bytes long" msgstr "" -#: shared-bindings/displayio/Palette.c -msgid "palette_index should be an int" -msgstr "" - #: py/emitinlinextensa.c msgid "parameters must be registers in sequence a2 to a5" msgstr "" @@ -4084,10 +3785,6 @@ msgstr "" msgid "poll on file not available on win32" msgstr "" -#: shared-module/vectorio/Polygon.c -msgid "polygon can only be registered in one parent" -msgstr "" - #: ports/espressif/common-hal/pulseio/PulseIn.c msgid "pop from an empty PulseIn" msgstr "" @@ -4113,7 +3810,23 @@ msgstr "" msgid "pow() with 3 arguments requires integers" msgstr "" +#: ports/espressif/boards/adafruit_qtpy_esp32_pico/mpconfigboard.h +msgid "pressing BOOT button at start up.\n" +msgstr "" + +#: ports/espressif/boards/adafruit_feather_esp32_v2/mpconfigboard.h +msgid "pressing SW38 button at start up.\n" +msgstr "" + +#: ports/espressif/boards/hardkernel_odroid_go/mpconfigboard.h +msgid "pressing VOLUME button at start up.\n" +msgstr "" + #: ports/espressif/boards/adafruit_qtpy_esp32c3/mpconfigboard.h +#: ports/espressif/boards/beetle-esp32-c3/mpconfigboard.h +#: ports/espressif/boards/espressif_esp32s2_devkitc_1_n8r2/mpconfigboard.h +#: ports/espressif/boards/lolin_c3_mini/mpconfigboard.h +#: ports/espressif/boards/microdev_micro_c3/mpconfigboard.h #: supervisor/shared/safe_mode.c msgid "pressing boot button at start up.\n" msgstr "" @@ -4134,14 +3847,6 @@ msgstr "" msgid "pull masks conflict with direction masks" msgstr "" -#: ports/raspberrypi/bindings/rp2pio/StateMachine.c -msgid "pull_threshold must be between 1 and 32" -msgstr "" - -#: ports/raspberrypi/bindings/rp2pio/StateMachine.c -msgid "push_threshold must be between 1 and 32" -msgstr "" - #: extmod/modutimeq.c msgid "queue overflow" msgstr "" @@ -4193,12 +3898,6 @@ msgstr "" msgid "rsplit(None,n)" msgstr "" -#: shared-bindings/audiocore/RawSample.c -msgid "" -"sample_source buffer must be a bytearray or array of type 'h', 'H', 'b' or " -"'B'" -msgstr "" - #: ports/atmel-samd/common-hal/audiobusio/PDMIn.c #: ports/raspberrypi/common-hal/audiobusio/PDMIn.c msgid "sampling rate out of range" @@ -4296,26 +3995,14 @@ msgstr "" msgid "source_bitmap must have value_count of 8" msgstr "" -#: shared-bindings/wifi/Radio.c -msgid "ssid can't be more than 32 bytes" -msgstr "" - #: py/objstr.c msgid "start/end indices" msgstr "" -#: shared-bindings/displayio/Shape.c -msgid "start_x should be an int" -msgstr "" - #: shared-bindings/random/__init__.c msgid "step must be non-zero" msgstr "" -#: shared-bindings/busio/UART.c -msgid "stop must be 1 or 2" -msgstr "" - #: shared-bindings/random/__init__.c msgid "stop not reachable from start" msgstr "" @@ -4364,10 +4051,6 @@ msgstr "" msgid "threshold must be in the range 0-65536" msgstr "" -#: shared-bindings/rgbmatrix/RGBMatrix.c -msgid "tile must be greater than zero" -msgstr "" - #: shared-bindings/time/__init__.c msgid "time.struct_time() takes a 9-sequence" msgstr "" @@ -4387,10 +4070,6 @@ msgstr "" msgid "timeout must be < 655.35 secs" msgstr "" -#: shared-bindings/_bleio/CharacteristicBuffer.c -msgid "timeout must be >= 0.0" -msgstr "" - #: shared-module/sdcardio/SDCard.c msgid "timeout waiting for v1 card" msgstr "" @@ -4399,6 +4078,10 @@ msgstr "" msgid "timeout waiting for v2 card" msgstr "" +#: ports/stm/common-hal/pwmio/PWMOut.c +msgid "timer re-init" +msgstr "" + #: shared-bindings/time/__init__.c msgid "timestamp out of range for platform time_t" msgstr "" @@ -4464,14 +4147,10 @@ msgstr "" msgid "type is not an acceptable base type" msgstr "" -#: py/runtime.c +#: py/objgenerator.c py/runtime.c msgid "type object '%q' has no attribute '%q'" msgstr "" -#: py/objgenerator.c -msgid "type object 'generator' has no attribute '__await__'" -msgstr "" - #: py/objtype.c msgid "type takes 1 or 3 arguments" msgstr "" @@ -4530,7 +4209,6 @@ msgid "unreadable attribute" msgstr "" #: shared-bindings/displayio/TileGrid.c shared-bindings/vectorio/VectorShape.c -#: shared-module/vectorio/Polygon.c shared-module/vectorio/VectorShape.c msgid "unsupported %q type" msgstr "" @@ -4569,6 +4247,14 @@ msgstr "" msgid "unsupported types for %q: '%q', '%q'" msgstr "" +#: extmod/ulab/code/numpy/io/io.c +msgid "usecols is too high" +msgstr "" + +#: extmod/ulab/code/numpy/io/io.c +msgid "usecols keyword must be specified" +msgstr "" + #: py/objint.c #, c-format msgid "value must fit in %d byte(s)" @@ -4590,20 +4276,19 @@ msgstr "" msgid "watchdog timeout must be greater than 0" msgstr "" -#: shared-bindings/bitops/__init__.c -#, c-format -msgid "width must be from 2 to 8 (inclusive), not %d" -msgstr "" - #: shared-bindings/is31fl3741/FrameBuffer.c -#: shared-bindings/rgbmatrix/RGBMatrix.c msgid "width must be greater than zero" msgstr "" #: ports/espressif/common-hal/wifi/Radio.c +#: ports/raspberrypi/common-hal/wifi/Radio.c msgid "wifi is not enabled" msgstr "" +#: ports/raspberrypi/common-hal/wifi/Monitor.c +msgid "wifi.Monitor not available" +msgstr "" + #: shared-bindings/_bleio/Adapter.c msgid "window must be <= interval" msgstr "" @@ -4616,7 +4301,17 @@ msgstr "" msgid "wrong axis specified" msgstr "" -#: extmod/ulab/code/numpy/compare.c extmod/ulab/code/numpy/vector.c +#: extmod/ulab/code/numpy/io/io.c +msgid "wrong dtype" +msgstr "" + +#: extmod/ulab/code/numpy/transform.c +msgid "wrong index type" +msgstr "" + +#: extmod/ulab/code/numpy/compare.c extmod/ulab/code/numpy/create.c +#: extmod/ulab/code/numpy/io/io.c extmod/ulab/code/numpy/transform.c +#: extmod/ulab/code/numpy/vector.c msgid "wrong input type" msgstr "" @@ -4624,6 +4319,10 @@ msgstr "" msgid "wrong length of condition array" msgstr "" +#: extmod/ulab/code/numpy/transform.c +msgid "wrong length of index array" +msgstr "" + #: extmod/ulab/code/numpy/create.c py/objarray.c py/objstr.c msgid "wrong number of arguments" msgstr "" @@ -4644,10 +4343,6 @@ msgstr "" msgid "xTaskCreate failed" msgstr "" -#: shared-bindings/displayio/Shape.c -msgid "y should be an int" -msgstr "" - #: shared-module/displayio/Shape.c msgid "y value out of bounds" msgstr "" @@ -4668,6 +4363,56 @@ msgstr "" msgid "zi must be of shape (n_section, 2)" msgstr "" +#~ msgid "%q must be >= 0" +#~ msgstr "%q >= 0 olmalıdır" + +#~ msgid "%q must be >= 1" +#~ msgstr "%q >= 1 olmalıdır" + +#~ msgid "All I2C targets are in use" +#~ msgstr "Tüm I2C hedefleri kullanımda" + +#~ msgid "%q must be a tuple of length 2" +#~ msgstr "%q, boyutu 2 olan bir tuple olmalıdır" + +#~ msgid "%q must be between %d and %d" +#~ msgstr "%q, %d ile %d arasında olmalıdır" + +#~ msgid "%q should be an int" +#~ msgstr "%q bir int olmalıdır" + +#~ msgid "(x,y) integers required" +#~ msgstr "(x, y) integerları gereklidir" + +#~ msgid "Address type out of range" +#~ msgstr "Adres tipi beklenen aralığın dışında" + +#~ msgid "AnalogIn not supported on given pin" +#~ msgstr "Verilen pin için AnalogIn desteklenmemektedir" + +#~ msgid "AnalogOut functionality not supported" +#~ msgstr "AnalogOut işlevi desteklenmemektedir" + +#~ msgid "AnalogOut is only 16 bits. Value must be less than 65536." +#~ msgstr "AnalogOut yalnızca 16 bitlik. Değer 65536'dan küçük olmalıdır." + +#~ msgid "AnalogOut not supported on given pin" +#~ msgstr "Verilen pin için AnalogOut desteklenmemektedir" + +#, c-format +#~ msgid "Bit depth must be from 1 to 6 inclusive, not %d" +#~ msgstr "Bit derinliği 1-6 aralığında olmalı, %d değil" + +#, c-format +#~ msgid "Buffer incorrect size. Should be %d bytes." +#~ msgstr "Geçersiz arabellek boyutu. %d kadar olmalı" + +#~ msgid "Buffer must be at least length 1" +#~ msgstr "Arabellek boyutu en az 1 olmalı" + +#~ msgid "Bytes must be between 0 and 255." +#~ msgstr "Baytlar 0-255 aralığında olmalı" + #~ msgid "" #~ "\n" #~ "Code stopped by auto-reload.\n" diff --git a/locale/zh_Latn_pinyin.po b/locale/zh_Latn_pinyin.po index 5e1b146532..c99d3a9625 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: 2021-01-04 12:55-0600\n" -"PO-Revision-Date: 2022-04-23 21:13+0000\n" +"PO-Revision-Date: 2022-08-20 14:09+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.12.1-dev\n" +"X-Generator: Weblate 4.14-dev\n" #: main.c msgid "" @@ -69,6 +69,11 @@ msgstr " shūchū:\n" msgid "%%c requires int or char" msgstr "%%c xūyào zhěngshù huòzhě zìfú" +#: main.c +#, c-format +msgid "%02X" +msgstr "" + #: shared-bindings/rgbmatrix/RGBMatrix.c #, c-format msgid "" @@ -77,10 +82,27 @@ msgstr "" "%d de zhǐ yǐn jiǎo, %d rgb yǐn jiǎo hé %d qiē piàn biǎo shì %d de gāo dù, ér " "bù shì %d" +#: ports/atmel-samd/common-hal/alarm/__init__.c +#: ports/cxd56/common-hal/analogio/AnalogOut.c ports/cxd56/common-hal/rtc/RTC.c +#: ports/espressif/common-hal/rtc/RTC.c +#: ports/mimxrt10xx/common-hal/analogio/AnalogOut.c +#: ports/mimxrt10xx/common-hal/rtc/RTC.c ports/nrf/common-hal/alarm/__init__.c +#: ports/nrf/common-hal/analogio/AnalogOut.c ports/nrf/common-hal/rtc/RTC.c +#: ports/raspberrypi/common-hal/alarm/__init__.c +#: ports/raspberrypi/common-hal/analogio/AnalogOut.c +#: ports/raspberrypi/common-hal/rtc/RTC.c ports/stm/common-hal/alarm/__init__.c +#: ports/stm/common-hal/rtc/RTC.c +msgid "%q" +msgstr "%q" + #: shared-bindings/microcontroller/Pin.c msgid "%q and %q contain duplicate pins" msgstr "%q hé %q bāo hán chóng fù yǐn jiǎo" +#: ports/atmel-samd/common-hal/audioio/AudioOut.c +msgid "%q and %q must be different" +msgstr "%q hé %q bìxū bùtóng" + #: shared-bindings/microcontroller/Pin.c msgid "%q contains duplicate pins" msgstr "%q bāo hán chóng fù de yǐn jiǎo" @@ -89,16 +111,12 @@ msgstr "%q bāo hán chóng fù de yǐn jiǎo" msgid "%q failure: %d" msgstr "%q Shībài: %d" +#: shared-bindings/digitalio/DigitalInOut.c #: shared-bindings/microcontroller/Pin.c msgid "%q in use" msgstr "%q zhèngzài bèi shǐyòng" -#: ports/atmel-samd/common-hal/pulseio/PulseIn.c -#: ports/cxd56/common-hal/pulseio/PulseIn.c -#: ports/nrf/common-hal/pulseio/PulseIn.c -#: ports/raspberrypi/common-hal/pulseio/PulseIn.c -#: ports/stm/common-hal/pulseio/PulseIn.c py/obj.c py/objstr.c -#: py/objstrunicode.c +#: py/obj.c py/objstr.c py/objstrunicode.c msgid "%q index out of range" msgstr "%q suǒyǐn chāochū fànwéi" @@ -106,13 +124,33 @@ msgstr "%q suǒyǐn chāochū fànwéi" msgid "%q indices must be integers, not %s" msgstr "%q suǒyǐn bìxū shì zhěngshù, ér bùshì %s" +#: shared-module/bitbangio/SPI.c +msgid "%q init failed" +msgstr "%q chūshǐhuà shībài" + +#: py/argcheck.c +msgid "%q length must be %d" +msgstr "%q de chángdù bìxū shì %d" + #: py/argcheck.c msgid "%q length must be %d-%d" msgstr "%q cháng dù bì xū wéi %d-%d" -#: shared-bindings/busio/I2C.c shared-bindings/usb_hid/Device.c +#: py/argcheck.c +msgid "%q length must be <= %d" +msgstr "%q chángdù bìxū <= %d" + +#: py/argcheck.c +msgid "%q length must be >= %d" +msgstr "%q chángdù bìxū >= %d" + +#: shared-bindings/busio/I2C.c msgid "%q length must be >= 1" -msgstr "%q cháng dù bì xū >= 1" +msgstr "%q cháng dù bìxū >= 1" + +#: py/argcheck.c +msgid "%q must be %d" +msgstr "%q bìxū %d" #: py/argcheck.c msgid "%q must be %d-%d" @@ -120,40 +158,28 @@ msgstr "%q bì xū wéi %d-%d" #: shared-bindings/displayio/Display.c msgid "%q must be 1 when %q is True" -msgstr "" +msgstr "sāng %q wèi True shí, %q bìxū wèi 1" #: py/argcheck.c shared-bindings/gifio/GifWriter.c msgid "%q must be <= %d" -msgstr "%q bì xū <= %d" +msgstr "%q bìxū <= %d" #: py/argcheck.c msgid "%q must be >= %d" -msgstr "%q bì xū >= %d" +msgstr "%q bìxū >= %d" -#: py/argcheck.c shared-bindings/memorymonitor/AllocationAlarm.c -msgid "%q must be >= 0" -msgstr "%q Bìxū > = 0" - -#: shared-bindings/_bleio/CharacteristicBuffer.c -#: shared-bindings/_bleio/PacketBuffer.c shared-bindings/displayio/Group.c -#: shared-bindings/displayio/Shape.c -#: shared-bindings/memorymonitor/AllocationAlarm.c -#: shared-bindings/vectorio/Circle.c shared-bindings/vectorio/Rectangle.c -msgid "%q must be >= 1" -msgstr "%q bìxū >= 1" +#: shared-bindings/analogbufio/BufferedIn.c +#: shared-bindings/audiocore/RawSample.c +msgid "%q must be a bytearray or array of type 'h', 'H', 'b', or 'B'" +msgstr "" #: py/argcheck.c msgid "%q must be a string" -msgstr "%q bì xū shì yí gè zì fú chuàn" +msgstr "%q bìxū shì yí gè zì fú chuàn" -#: shared-module/vectorio/Polygon.c -msgid "%q must be a tuple of length 2" -msgstr "%q bìxū shì chángdù wèi 2 de yuánzǔ" - -#: ports/espressif/common-hal/imagecapture/ParallelImageCapture.c -#: shared-module/vectorio/VectorShape.c -msgid "%q must be between %d and %d" -msgstr "%q bì xū zài %d hé %d zhī jiān" +#: py/argcheck.c +msgid "%q must be an int" +msgstr "%q bìxū shì zhěng xíng" #: py/argcheck.c msgid "%q must be of type %q" @@ -171,7 +197,11 @@ msgstr "%q bì xū shì 2 de zhěng shù cì fāng" msgid "%q out of bounds" msgstr "%q chāo chū jiè xiàn" +#: ports/atmel-samd/common-hal/pulseio/PulseIn.c +#: ports/cxd56/common-hal/pulseio/PulseIn.c +#: ports/nrf/common-hal/pulseio/PulseIn.c #: ports/raspberrypi/common-hal/rp2pio/StateMachine.c +#: ports/stm/common-hal/pulseio/PulseIn.c py/argcheck.c #: shared-bindings/canio/Match.c msgid "%q out of range" msgstr "%q chāochū fànwéi" @@ -180,10 +210,6 @@ msgstr "%q chāochū fànwéi" msgid "%q pin invalid" msgstr "%q yǐn jiǎo wúxiào" -#: shared-bindings/fontio/BuiltinFont.c -msgid "%q should be an int" -msgstr "%q yīnggāi shì yīgè zhěngshù (int)" - #: shared-bindings/usb_hid/Device.c msgid "%q with a report ID of 0 must be of length 1" msgstr "bào gào ID shì 0 de %q bì xū cháng dù wéi 1" @@ -196,7 +222,11 @@ msgstr "%q() yāoqiú shūrù %d gè wèizhì cānshù, dàn mùqián shūrù le msgid "%q, %q, and %q must all be the same length" msgstr "%q, %q, hé %q bì xū cháng dù xiāng tóng" -#: ports/espressif/bindings/espidf/__init__.c ports/espressif/esp_error.c +#: py/objint.c +msgid "%q=%q" +msgstr "%q=%q" + +#: ports/espressif/common-hal/espidf/__init__.c ports/espressif/esp_error.c #, c-format msgid "%s error 0x%x" msgstr "%s cuò wù 0x%x" @@ -281,7 +311,7 @@ msgstr "'%s' duìxiàng bù zhīchí yuánsù fùzhí" msgid "'%s' object doesn't support item deletion" msgstr "'%s' duìxiàng bù zhīchí yuánsù shānchú" -#: py/runtime.c +#: ports/raspberrypi/common-hal/wifi/Radio.c py/runtime.c msgid "'%s' object has no attribute '%q'" msgstr "'%s' duìxiàng méiyǒu shǔxìng '%q'" @@ -346,10 +376,6 @@ msgstr "Yìbù hánshù zhōng cúnzài 'yield from'" msgid "'yield' outside function" msgstr "'yield' wèiyú hánshù zhīwài" -#: shared-module/vectorio/VectorShape.c -msgid "(x,y) integers required" -msgstr "xūyào zhěngshù (x,y)" - #: py/compile.c msgid "*x must be assignment target" msgstr "*x bìxū shì bèi fùzhí de duìxiàng" @@ -385,16 +411,12 @@ msgstr "ADC2 zhèngzài bèi WiFi shǐ yòng" msgid "Address must be %d bytes long" msgstr "dìzhǐ chángdù bìxū shì %d zìjié" -#: shared-bindings/_bleio/Address.c -msgid "Address type out of range" -msgstr "Dìzhǐ lèixíng chāochū fànwéi" - #: ports/espressif/common-hal/canio/CAN.c msgid "All CAN peripherals are in use" msgstr "suǒyǒu CAN wàishè dōu zài shǐyòng zhōng" #: ports/espressif/common-hal/busio/I2C.c -#: ports/espressif/common-hal/i2cperipheral/I2CPeripheral.c +#: ports/espressif/common-hal/i2ctarget/I2CTarget.c #: ports/nrf/common-hal/busio/I2C.c msgid "All I2C peripherals are in use" msgstr "suǒyǒu I2C wàishè dōu zài shǐyòng zhōng" @@ -431,7 +453,6 @@ msgstr "suǒyǒu píndào dōu zài shǐyòng zhōng" msgid "All event channels in use" msgstr "suǒyǒu shìjiàn píndào dōu zài shǐyòng zhōng" -#: ports/raspberrypi/common-hal/pulseio/PulseIn.c #: ports/raspberrypi/common-hal/rp2pio/StateMachine.c msgid "All state machines in use" msgstr "suǒyǒu zhuàngtàijī dōu zài shǐyòng zhōng" @@ -467,9 +488,8 @@ msgid "Already advertising." msgstr "Mùqián zhèngzài guǎngbō." #: ports/atmel-samd/common-hal/canio/Listener.c -#, fuzzy msgid "Already have all-matches listener" -msgstr "yǐjīng yǒu all-matches jiāntīngqì" +msgstr "yǐjīng yǒu all-matches jiāntīng qì" #: shared-module/memorymonitor/AllocationAlarm.c #: shared-module/memorymonitor/AllocationSize.c @@ -477,28 +497,10 @@ msgid "Already running" msgstr "yǐjīng zài yùnxíng" #: ports/espressif/common-hal/wifi/Radio.c +#: ports/raspberrypi/common-hal/wifi/Radio.c msgid "Already scanning for wifi networks" msgstr "yǐjīng zài sǎomiáo WIFI wǎngluò" -#: ports/cxd56/common-hal/analogio/AnalogIn.c -msgid "AnalogIn not supported on given pin" -msgstr "gěidìng de yǐnjiǎo bù zhīchí AnalogIn" - -#: ports/cxd56/common-hal/analogio/AnalogOut.c -#: ports/mimxrt10xx/common-hal/analogio/AnalogOut.c -#: ports/nrf/common-hal/analogio/AnalogOut.c -#: ports/raspberrypi/common-hal/analogio/AnalogOut.c -msgid "AnalogOut functionality not supported" -msgstr "Bù zhīchí AnalogOut gōngnéng" - -#: shared-bindings/analogio/AnalogOut.c -msgid "AnalogOut is only 16 bits. Value must be less than 65536." -msgstr "AnalogOut jǐn wèi 16 wèi. Zhí bìxū xiǎoyú 65536." - -#: ports/atmel-samd/common-hal/analogio/AnalogOut.c -msgid "AnalogOut not supported on given pin" -msgstr "zhǐdìng de yǐn jiǎo bù zhīchí AnalogOut" - #: ports/stm/common-hal/audiopwmio/PWMAudioOut.c msgid "Another PWMAudioOut is already active" msgstr "lìng yí gè PWMAudioOut yǐ jīng zài gōngzuò" @@ -537,7 +539,7 @@ msgstr "yīnpín zhuǎnhuàn wèi bèi shíxiàn" msgid "AuthMode.OPEN is not used with password" msgstr "AuthMode.OPEN wèi shǐyòng mìmǎ" -#: shared-bindings/wifi/Radio.c +#: shared-bindings/wifi/Radio.c supervisor/shared/web_workflow/web_workflow.c msgid "Authentication failure" msgstr "shēnfèn ren4zheng4 shībài" @@ -563,28 +565,20 @@ msgid "Below minimum frame rate" msgstr "dīyú zuìdī zhēnlǜ" #: ports/raspberrypi/common-hal/audiobusio/I2SOut.c -#, fuzzy msgid "Bit clock and word select must be sequential pins" -msgstr "wèi shí zhōng hé dān cí xuǎn zé bì xū shì shùn xù yǐn jiǎo" +msgstr "wèi shízhōng hé zì xuǎnzé bìxū shì liánxù de yǐn jiǎo" #: ports/atmel-samd/common-hal/audiobusio/I2SOut.c -#, fuzzy 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 "wèi shēndù bìxū shì 1 dào 6, ér búshì %d" +msgstr "wèi shízhōng hé zì xuǎnzé bìxū gòngxiǎng yīgè shízhōng dānyuán" #: shared-bindings/audiobusio/PDMIn.c msgid "Bit depth must be multiple of 8." msgstr "wèi shēndù bìxū shì 8 de zhěngshùbèi." #: shared-bindings/bitmaptools/__init__.c -#, fuzzy msgid "Bitmap size and bits per value must match" -msgstr "wèitú dàxiǎo hé měigè zhí de wèi bìxū pǐpèi" +msgstr "wèi tú dàxiǎo hé měi gè zhí de wèi shù bìxū pǐpèi" #: supervisor/shared/safe_mode.c msgid "Boot device must be first device (interface #0)." @@ -619,11 +613,6 @@ msgstr "huǎnchōngqū yǔ piānyíliàng de hé tài xiǎo %d %d %d" msgid "Buffer elements must be 4 bytes long or less" msgstr "huǎnchōngqū de yuánsù bìxū wéi 4 zìjié cháng huò gèngshǎo" -#: shared-module/usb_hid/Device.c -#, c-format -msgid "Buffer incorrect size. Should be %d bytes." -msgstr "Huǎnchōng qū dàxiǎo bù zhèngquè. Yīnggāi shì %d zì jié." - #: shared-bindings/framebufferio/FramebufferDisplay.c msgid "Buffer is not a bytearray." msgstr "Huǎnchōng qū bùshì bytearray." @@ -633,7 +622,6 @@ msgstr "Huǎnchōng qū bùshì bytearray." msgid "Buffer is too small" msgstr "Huǎnchōng qū tài xiǎo" -#: ports/nrf/common-hal/audiopwmio/PWMAudioOut.c #: ports/stm/common-hal/audiopwmio/PWMAudioOut.c #, c-format msgid "Buffer length %d too big. It must be less than %d" @@ -648,14 +636,10 @@ msgstr "Huǎnchōngqū chángdù bìxū wéi 512 de bèishù" msgid "Buffer must be a multiple of 512 bytes" msgstr "Huǎnchōngqū bìxū shì 512 zìjié de bèishù" -#: shared-bindings/bitbangio/I2C.c -msgid "Buffer must be at least length 1" -msgstr "Huǎnchōng qū bìxū zhìshǎo chángdù wéi 1" - #: shared-bindings/_bleio/PacketBuffer.c -#, fuzzy, c-format +#, c-format msgid "Buffer too short by %d bytes" -msgstr "Huǎn chōng qū tài duǎn , àn %d zì jié" +msgstr "Huǎnchōngqū tàiduǎn , mùqián zhǐyǒu %d zìjié" #: ports/espressif/common-hal/imagecapture/ParallelImageCapture.c msgid "Buffers must be same size" @@ -673,10 +657,6 @@ msgstr "Zǒngxiàn yǐnjiǎo %d yǐjīng zài shǐyòng zhōng" msgid "Byte buffer must be 16 bytes." msgstr "Zìjié huǎnchōng qū bìxū shì 16 zìjié." -#: shared-bindings/alarm/SleepMemory.c shared-bindings/nvm/ByteArray.c -msgid "Bytes must be between 0 and 255." -msgstr "Zìjié bìxū jiè yú 0 dào 255 zhījiān." - #: shared-bindings/aesio/aes.c msgid "CBC blocks must be multiples of 16 bytes" msgstr "CBC kuài bìxū shì 16 zìjié de bèishù" @@ -685,7 +665,7 @@ msgstr "CBC kuài bìxū shì 16 zìjié de bèishù" msgid "CIRCUITPY drive could not be found or created." msgstr "zhǎo bú dào huò chuàng jiàn CIRCUITPY qū dòng qì." -#: ports/espressif/bindings/espidf/__init__.c ports/espressif/esp_error.c +#: ports/espressif/common-hal/espidf/__init__.c ports/espressif/esp_error.c msgid "CRC or checksum was invalid" msgstr "CRC huò jiàoyàn hé wúxiào" @@ -693,22 +673,24 @@ msgstr "CRC huò jiàoyàn hé wúxiào" msgid "Call super().__init__() before accessing native object." msgstr "Zài fǎngwèn yuánshēn dùixiàng zhīqián diàoyòng super().__init__()." -#: ports/espressif/common-hal/alarm/pin/PinAlarm.c -#, fuzzy -msgid "Can only alarm on RTC IO from deep sleep." -msgstr "zhǐ néng zài RTC IO shàng cóng shēndù shuìmián zhōng bào jǐng." +#: ports/cxd56/common-hal/camera/Camera.c +msgid "Camera init" +msgstr "xiàngjī chūshǐhuà" + +#: ports/espressif/common-hal/alarm/pin/PinAlarm.c +msgid "Can only alarm on RTC IO from deep sleep." +msgstr "Zhǐ néng cóng shēndù shuìmián zhōng duì RTC IO jìnxíng bàojǐng." #: ports/espressif/common-hal/alarm/pin/PinAlarm.c -#, fuzzy msgid "Can only alarm on one low pin while others alarm high from deep sleep." msgstr "" -"Zhǐ néng zài yīgè dī diàn píng yǐn jiǎo shàng fāchū jǐngbào, ér qítā yǐn " -"jiǎo cóng shēndù shuìmián zhōng fāchū gāo diàn píng jǐngbào." +"Zhǐ néng zài yīgè dī yǐn jiǎo shàng bàojǐng, ér qítā yǐn jiǎo cóng shēndù " +"shuìmián zhōng fāchū gāo diàn píng bàojǐng." #: ports/espressif/common-hal/alarm/pin/PinAlarm.c -#, fuzzy msgid "Can only alarm on two low pins from deep sleep." -msgstr "zhǐ néng cóng shēn dù shuì mián zhōng bào jǐng liǎng gè dī yǐn jiǎo." +msgstr "" +"Zhǐ néng cóng shēndù shuìmián zhōng de liǎng gè dī yǐn jiǎo shàng bàojǐng." #: ports/espressif/common-hal/_bleio/Characteristic.c #: ports/nrf/common-hal/_bleio/Characteristic.c @@ -745,18 +727,10 @@ msgstr "Wúfǎ huòqǔ wēndù" msgid "Cannot have scan responses for extended, connectable advertisements." msgstr "Nín wúfǎ sǎomiáo kuòzhǎn de, kě liánjiē de guǎnggào." -#: ports/atmel-samd/common-hal/audioio/AudioOut.c -msgid "Cannot output both channels on the same pin" -msgstr "Wúfǎ shūchū tóng yīgè yǐn jiǎo shàng de liǎng gè píndào" - #: ports/espressif/common-hal/alarm/pin/PinAlarm.c msgid "Cannot pull on input-only pin." msgstr "wú fǎ lā dòng jǐn shū rù yǐn jiǎo." -#: shared-module/bitbangio/SPI.c -msgid "Cannot read without MISO pin." -msgstr "Wúfǎ dòu qǔ méiyǒu MISO de yǐn jiǎo." - #: shared-bindings/audiobusio/PDMIn.c msgid "Cannot record to a file" msgstr "Wúfǎ jìlù dào wénjiàn" @@ -768,16 +742,16 @@ msgstr "tōng guò USB kě jiàn shí wú fǎ chóng xīn ān zhuāng '/'." #: ports/atmel-samd/common-hal/microcontroller/__init__.c #: ports/cxd56/common-hal/microcontroller/__init__.c #: ports/mimxrt10xx/common-hal/microcontroller/__init__.c -msgid "Cannot reset into bootloader because no bootloader is present." -msgstr "Wúfǎ chóng zhì wèi bootloader, yīnwèi méiyǒu bootloader cúnzài." +msgid "Cannot reset into bootloader because no bootloader is present" +msgstr "wúfǎ chóngxīn qǐdòng dào yǐdǎo chéngxù, yīnwéi yǐdǎo chéngxù bù cúnzài" #: ports/espressif/common-hal/socketpool/Socket.c msgid "Cannot set socket options" -msgstr "wú fǎ shè zhì tào jiē zì xuǎn xiàng" +msgstr "wúfǎ shèzhì tàojiēzì xuǎnxiàng" #: shared-bindings/digitalio/DigitalInOut.c msgid "Cannot set value when direction is input." -msgstr "Dāng fāngxiàng xiàng nèi shí, bùnéng shèzhì gāi zhí." +msgstr "Dāng fāngxiàng wéi shūrù shí, bùnéng shèzhì zhí." #: ports/espressif/common-hal/busio/UART.c #: ports/mimxrt10xx/common-hal/busio/UART.c @@ -786,25 +760,24 @@ msgstr "wú fǎ zài RS485 mó shì xià zhǐ dìng RTS huò CTS" #: py/objslice.c msgid "Cannot subclass slice" -msgstr "Wúfǎ zi fēnlèi" +msgstr "bùnéng zi lèi huà qiēpiàn" #: shared-module/bitbangio/SPI.c -msgid "Cannot transfer without MOSI and MISO pins." -msgstr "Méiyǒu MOSI/MISO jiù wúfǎ zhuǎnyí." +msgid "Cannot transfer without MOSI and MISO pins" +msgstr "méiyǒu MOSI hé MISO yǐn jiǎo wúfǎ chuánshū" #: shared-bindings/pwmio/PWMOut.c msgid "Cannot vary frequency on a timer that is already in use" msgstr "Wúfǎ gēnggǎi yǐ zài shǐyòng de jìshí qì shàng de pínlǜ" -#: ports/espressif/common-hal/alarm/pin/PinAlarm.c #: ports/nrf/common-hal/alarm/pin/PinAlarm.c +msgid "Cannot wake on pin edge, only level" +msgstr "wúfǎ zài yǐn jiǎo biānyuán huànxǐng, zhǐ néng diàn píng" + +#: ports/espressif/common-hal/alarm/pin/PinAlarm.c msgid "Cannot wake on pin edge. Only level." msgstr "wú fǎ zài yǐn jiǎo biān yuán huàn xǐng. jǐn jí bié." -#: shared-module/bitbangio/SPI.c -msgid "Cannot write without MOSI pin." -msgstr "Wúfǎ xiě rù MOSI de yǐn jiǎo." - #: shared-bindings/_bleio/CharacteristicBuffer.c msgid "CharacteristicBuffer writing not provided" msgstr "Wèi tígōng zìfú huǎncún xiě rù" @@ -817,10 +790,6 @@ msgstr "CircuitPython de héxīn chūxiàn gùzhàng. Āiyā!\n" msgid "CircuitPython was unable to allocate the heap." msgstr "CircuitPython wúfǎ fēnpèi duī." -#: shared-module/bitbangio/SPI.c -msgid "Clock pin init failed." -msgstr "Shízhōng de yǐn jiǎo chūshǐhuà shībài." - #: shared-module/bitbangio/I2C.c msgid "Clock stretch too long" msgstr "Shízhōng shēnzhǎn tài zhǎng" @@ -829,11 +798,6 @@ msgstr "Shízhōng shēnzhǎn tài zhǎng" msgid "Clock unit in use" msgstr "Shǐyòng shízhōng dānwèi" -#: shared-bindings/displayio/FourWire.c shared-bindings/displayio/I2CDisplay.c -#: shared-bindings/paralleldisplay/ParallelBus.c -msgid "Command must be an int between 0 and 255" -msgstr "Mìnglìng bìxū shì 0 dào 255 zhī jiān de int" - #: shared-bindings/_bleio/Connection.c msgid "" "Connection has been disconnected and can no longer be used. Create a new " @@ -842,40 +806,11 @@ msgstr "Liánjiē yǐ duàn kāi, wúfǎ zài shǐyòng. Chuàngjiàn yīgè xī #: py/persistentcode.c msgid "Corrupt .mpy file" -msgstr "Fǔbài de .mpy wénjiàn" - -#: ports/cxd56/common-hal/camera/Camera.c -msgid "Could not initialize Camera" -msgstr "Wúfǎ chūshǐhuà xiàngjī" - -#: ports/cxd56/common-hal/gnss/GNSS.c -msgid "Could not initialize GNSS" -msgstr "wú fǎ chū shǐ huà GNSS" - -#: ports/cxd56/common-hal/sdioio/SDCard.c -msgid "Could not initialize SDCard" -msgstr "wú fǎ chū shǐ huà SDCard" - -#: ports/atmel-samd/common-hal/busio/UART.c ports/cxd56/common-hal/busio/UART.c -#: ports/espressif/common-hal/busio/UART.c -msgid "Could not initialize UART" -msgstr "Wúfǎ chūshǐhuà UART" - -#: ports/stm/common-hal/pwmio/PWMOut.c -msgid "Could not re-init channel" -msgstr "Wúfǎ chóngxīn chūshǐhuà píndào" - -#: ports/stm/common-hal/pwmio/PWMOut.c -msgid "Could not re-init timer" -msgstr "Wúfǎ chóngxīn qǐdòng jìshí qì" - -#: ports/stm/common-hal/pwmio/PWMOut.c -msgid "Could not restart PWM" -msgstr "Wúfǎ chóngqǐ PWM" +msgstr "sǔnhuài de .mpy wénjiàn" #: ports/espressif/common-hal/neopixel_write/__init__.c msgid "Could not retrieve clock" -msgstr "Wúfǎ huòqǔ shízhōng" +msgstr "wúfǎ jiǎnsuǒ shízhōng" #: shared-bindings/_bleio/Adapter.c msgid "Could not set address" @@ -893,20 +828,6 @@ msgstr "Wúfǎ qǐdòng zhōngduàn,RX máng" msgid "Couldn't allocate decoder" msgstr "Zhǎo bù dào jiěmǎ qì" -#: shared-module/audiocore/WaveFile.c shared-module/audiomixer/Mixer.c -#: shared-module/audiomp3/MP3Decoder.c -msgid "Couldn't allocate first buffer" -msgstr "Wúfǎ fēnpèi dì yī gè huǎnchōng qū" - -#: shared-module/audiomp3/MP3Decoder.c -msgid "Couldn't allocate input buffer" -msgstr "Wúfǎ fēnpèi shūrù huǎnchōng qū" - -#: shared-module/audiocore/WaveFile.c shared-module/audiomixer/Mixer.c -#: shared-module/audiomp3/MP3Decoder.c -msgid "Couldn't allocate second buffer" -msgstr "Wúfǎ fēnpèi dì èr gè huǎnchōng qū" - #: supervisor/shared/safe_mode.c msgid "Crash into the HardFault_Handler." msgstr "Zhuìhuǐ. Shūrù HardFault_Handler." @@ -955,10 +876,6 @@ msgstr "Mùbiāo róngliàng xiǎoyú mùdì de_chángdù." msgid "Device in use" msgstr "Zhèngzài shǐyòng de shèbèi" -#: ports/cxd56/common-hal/digitalio/DigitalInOut.c -msgid "DigitalInOut not supported on given pin" -msgstr "Gěi dìng de yǐn jiǎo bù zhīchí DigitalInOut" - #: shared-bindings/displayio/Display.c #: shared-bindings/framebufferio/FramebufferDisplay.c msgid "Display must have a 16 bit colorspace." @@ -970,6 +887,10 @@ msgstr "Xiǎnshì bìxū jùyǒu 16 wèi yánsè kōngjiān." msgid "Display rotation must be in 90 degree increments" msgstr "Xiǎnshì xuánzhuǎn bìxū 90 dù jiā xīn" +#: main.c +msgid "Done" +msgstr "zuò" + #: shared-bindings/digitalio/DigitalInOut.c msgid "Drive mode not used when direction is input." msgstr "Fāngxiàng shūrù shí qūdòng móshì méiyǒu shǐyòng." @@ -1003,21 +924,20 @@ msgstr "Zhèngzé biǎodá shì cuòwù" msgid "Error: Failure to bind" msgstr "cuò wù: bǎng dìng shī bài" -#: ports/raspberrypi/bindings/rp2pio/StateMachine.c py/enum.c -#: shared-bindings/_bleio/__init__.c shared-bindings/aesio/aes.c -#: shared-bindings/busio/SPI.c shared-bindings/microcontroller/Pin.c +#: py/enum.c shared-bindings/_bleio/__init__.c shared-bindings/aesio/aes.c +#: shared-bindings/alarm/__init__.c shared-bindings/busio/SPI.c +#: shared-bindings/microcontroller/Pin.c #: shared-bindings/neopixel_write/__init__.c msgid "Expected a %q" msgstr "Yùqí %q" -#: shared-bindings/alarm/__init__.c -msgid "Expected an alarm" -msgstr "yù qī yǒu jǐng bào" +#: ports/raspberrypi/bindings/cyw43/__init__.c +msgid "Expected a %q or %q" +msgstr "" -#: shared-module/adafruit_pixelbuf/PixelBuf.c -#, c-format -msgid "Expected tuple of length %d, got %d" -msgstr "Qīwàng de chángdù wèi %d de yuán zǔ, dédào %d" +#: shared-bindings/alarm/__init__.c +msgid "Expected an %q" +msgstr "" #: ports/espressif/common-hal/_bleio/Adapter.c #: ports/nrf/common-hal/_bleio/Adapter.c @@ -1045,21 +965,9 @@ msgstr "Fāsòng mìnglìng shībài." msgid "Failed to acquire mutex, err 0x%04x" msgstr "Wúfǎ huòdé mutex, err 0x%04x" -#: ports/mimxrt10xx/common-hal/busio/UART.c ports/nrf/common-hal/busio/UART.c -#: ports/raspberrypi/common-hal/busio/UART.c -msgid "Failed to allocate RX buffer" -msgstr "Fēnpèi RX huǎnchōng shībài" - -#: ports/atmel-samd/common-hal/busio/UART.c -#: ports/atmel-samd/common-hal/pulseio/PulseIn.c -#: ports/cxd56/common-hal/pulseio/PulseIn.c -#: ports/espressif/common-hal/pulseio/PulseIn.c -#: ports/nrf/common-hal/pulseio/PulseIn.c -#: ports/raspberrypi/common-hal/pulseio/PulseIn.c -#: ports/stm/common-hal/pulseio/PulseIn.c -#, c-format -msgid "Failed to allocate RX buffer of %d bytes" -msgstr "Fēnpèi RX huǎnchōng qū%d zì jié shībài" +#: shared-module/rgbmatrix/RGBMatrix.c +msgid "Failed to allocate %q buffer" +msgstr "wèi néng fēnpèi %q huǎnchōng qū" #: ports/espressif/common-hal/wifi/__init__.c msgid "Failed to allocate Wifi memory" @@ -1082,10 +990,6 @@ msgstr "Liánjiē shībài: Nèibù cuòwù" msgid "Failed to connect: timeout" msgstr "Liánjiē shībài: Chāoshí" -#: ports/espressif/common-hal/wifi/__init__.c -msgid "Failed to init wifi" -msgstr "Wúfǎ chūshǐhuà wifi" - #: shared-module/audiomp3/MP3Decoder.c msgid "Failed to parse MP3 file" msgstr "Wúfǎ jiěxī MP3 wénjiàn" @@ -1132,11 +1036,6 @@ msgstr "" msgid "Format not supported" msgstr "Bù zhīyuán géshì" -#: shared-module/framebufferio/FramebufferDisplay.c -#, c-format -msgid "Framebuffer requires %d bytes" -msgstr "zhēn huǎn chōng qū xū yào %d zì jié" - #: ports/mimxrt10xx/common-hal/microcontroller/Processor.c msgid "" "Frequency must be 24, 150, 396, 450, 528, 600, 720, 816, 912, 960 or 1008 Mhz" @@ -1152,7 +1051,11 @@ msgstr "Pínlǜ bìxū yǔ shǐyòng cǐ jìshí qì de xiàn yǒu PWMOut xiāng msgid "Function requires lock" msgstr "Hánshù xūyào suǒdìng" -#: ports/espressif/bindings/espidf/__init__.c ports/espressif/esp_error.c +#: ports/cxd56/common-hal/gnss/GNSS.c +msgid "GNSS init" +msgstr "GNSS chūshǐhuà" + +#: ports/espressif/common-hal/espidf/__init__.c ports/espressif/esp_error.c msgid "Generic Failure" msgstr "tōng yòng gù zhàng" @@ -1179,19 +1082,16 @@ msgstr "Yìngjiàn máng, qǐng chángshì qítā zhēnjiǎo" msgid "Hardware in use, try alternative pins" msgstr "Shǐyòng de yìngjiàn, qǐng chángshì qítā yǐn jiǎo" -#: shared-bindings/wifi/Radio.c -msgid "Hostname must be between 1 and 253 characters" -msgstr "zhǔ jī míng bì xū jiè yú 1 hé 253 gè zì fú zhī jiān" - #: extmod/vfs_posix_file.c py/objstringio.c msgid "I/O operation on closed file" msgstr "Wénjiàn shàng de I/ O cāozuò" #: ports/stm/common-hal/busio/I2C.c -msgid "I2C Init Error" -msgstr "I2C chūshǐhuà cuòwù" +msgid "I2C init error" +msgstr "I2C qǐdòng cuòwù" #: ports/raspberrypi/common-hal/busio/I2C.c +#: ports/raspberrypi/common-hal/i2ctarget/I2CTarget.c msgid "I2C peripheral in use" msgstr "I2C wài shè zhèng zài shǐ yòng zhōng" @@ -1303,75 +1203,37 @@ msgstr "nèi bù cuò wù" msgid "Internal error #%d" msgstr "nèi bù cuò wù #%d" -#: shared-bindings/sdioio/SDCard.c shared-module/usb_hid/Device.c +#: supervisor/shared/safe_mode.c +msgid "Internal watchdog timer expired." +msgstr "Nèibù kān mén gǒu dìngshí qì chāoshí." + +#: py/argcheck.c shared-bindings/digitalio/DigitalInOut.c msgid "Invalid %q" msgstr "wú xiào %q" -#: ports/atmel-samd/common-hal/audiobusio/I2SOut.c -#: ports/atmel-samd/common-hal/audiobusio/PDMIn.c -#: ports/atmel-samd/common-hal/imagecapture/ParallelImageCapture.c -#: ports/mimxrt10xx/common-hal/busio/UART.c +#: shared-bindings/microcontroller/Pin.c msgid "Invalid %q pin" msgstr "Wúxiào de %q yǐn jiǎo" -#: ports/stm/common-hal/busio/I2C.c ports/stm/common-hal/busio/SPI.c -#: ports/stm/common-hal/busio/UART.c ports/stm/common-hal/canio/CAN.c -#: ports/stm/common-hal/sdioio/SDCard.c -msgid "Invalid %q pin selection" -msgstr "wú xiào %q yǐn jiǎo xuǎn zé" - #: ports/stm/common-hal/analogio/AnalogIn.c msgid "Invalid ADC Unit value" msgstr "Wúxiào de ADC dānwèi zhí" -#: ports/espressif/common-hal/wifi/Radio.c -msgid "Invalid AuthMode" -msgstr "wú xiào AuthMode" - #: ports/espressif/common-hal/_bleio/__init__.c #: ports/nrf/common-hal/_bleio/__init__.c msgid "Invalid BLE parameter" msgstr "wú xiào BLE cān shù" -#: shared-module/displayio/OnDiskBitmap.c -msgid "Invalid BMP file" -msgstr "Wúxiào de BMP wénjiàn" - #: shared-bindings/wifi/Radio.c msgid "Invalid BSSID" msgstr "Wúxiào de BSSID" -#: ports/espressif/common-hal/analogio/AnalogOut.c -#: ports/stm/common-hal/analogio/AnalogOut.c -msgid "Invalid DAC pin supplied" -msgstr "Tí gōng liǎo wúxiào de DAC yǐn jiǎo" - #: shared-bindings/wifi/Radio.c msgid "Invalid MAC address" msgstr "wú xiào de MAC dì zhǐ" -#: shared-bindings/synthio/__init__.c -msgid "Invalid MIDI file" -msgstr "wú xiào de MIDI wén jiàn" - -#: ports/atmel-samd/common-hal/pwmio/PWMOut.c -#: ports/cxd56/common-hal/pwmio/PWMOut.c -#: ports/espressif/common-hal/pwmio/PWMOut.c -#: ports/mimxrt10xx/common-hal/pwmio/PWMOut.c -#: ports/nrf/common-hal/pwmio/PWMOut.c -#: ports/raspberrypi/common-hal/pwmio/PWMOut.c shared-bindings/pwmio/PWMOut.c -msgid "Invalid PWM frequency" -msgstr "Wúxiào de PWM pínlǜ" - -#: ports/espressif/common-hal/analogio/AnalogIn.c -msgid "Invalid Pin" -msgstr "wú xiào yǐn jiǎo" - -#: ports/espressif/bindings/espidf/__init__.c -#: ports/espressif/common-hal/busio/I2C.c -#: ports/espressif/common-hal/i2cperipheral/I2CPeripheral.c -#: ports/espressif/esp_error.c py/moduerrno.c -#: shared-module/rgbmatrix/RGBMatrix.c +#: ports/espressif/common-hal/espidf/__init__.c ports/espressif/esp_error.c +#: py/moduerrno.c msgid "Invalid argument" msgstr "Wúxiào de cānshù" @@ -1379,42 +1241,11 @@ msgstr "Wúxiào de cānshù" msgid "Invalid bits per value" msgstr "Měi gè zhí de wèi wúxiào" -#: ports/nrf/common-hal/busio/UART.c ports/raspberrypi/common-hal/busio/UART.c -#: ports/stm/common-hal/busio/UART.c -msgid "Invalid buffer size" -msgstr "Wúxiào de huǎnchōng qū dàxiǎo" - -#: shared-bindings/adafruit_pixelbuf/PixelBuf.c -msgid "Invalid byteorder string" -msgstr "Wúxiào de zì jié shùnxù zìfú chuàn" - -#: ports/atmel-samd/common-hal/frequencyio/FrequencyIn.c -#: ports/espressif/common-hal/frequencyio/FrequencyIn.c -msgid "Invalid capture period. Valid range: 1 - 500" -msgstr "Wúxiào de bǔhuò zhōuqí. Yǒuxiào fànwéi: 1-500" - -#: shared-bindings/audiomixer/Mixer.c -msgid "Invalid channel count" -msgstr "Wúxiào de tōngdào jìshù" - -#: ports/atmel-samd/common-hal/imagecapture/ParallelImageCapture.c -#, c-format -msgid "Invalid data_count %d" -msgstr "wú xiào data_count %d" - #: ports/atmel-samd/common-hal/imagecapture/ParallelImageCapture.c #, c-format msgid "Invalid data_pins[%d]" msgstr "wú xiào data_pins[%d]" -#: shared-bindings/digitalio/DigitalInOut.c -msgid "Invalid direction." -msgstr "Wúxiào de fāngxiàng." - -#: shared-module/audiocore/WaveFile.c -msgid "Invalid file" -msgstr "Wúxiào de wénjiàn" - #: shared-module/audiocore/WaveFile.c msgid "Invalid format chunk size" msgstr "Géshì kuài dàxiǎo wúxiào" @@ -1423,107 +1254,27 @@ msgstr "Géshì kuài dàxiǎo wúxiào" msgid "Invalid memory access." msgstr "Wúxiào de nèicún fǎngwèn." -#: extmod/vfs_fat_file.c -msgid "Invalid mode" -msgstr "wú xiào mó shì" - #: ports/espressif/common-hal/wifi/Radio.c msgid "Invalid multicast MAC address" msgstr "wú xiào de duō bō MAC dì zhǐ" -#: shared-bindings/bitbangio/SPI.c shared-bindings/busio/SPI.c -msgid "Invalid number of bits" -msgstr "Wèi shù wúxiào" - -#: shared-bindings/bitbangio/SPI.c shared-bindings/busio/SPI.c -#: shared-bindings/displayio/FourWire.c -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 -#: ports/espressif/common-hal/alarm/touch/TouchAlarm.c -#: ports/espressif/common-hal/touchio/TouchIn.c -#: ports/nrf/common-hal/alarm/pin/PinAlarm.c shared-bindings/pwmio/PWMOut.c -#: shared-module/rgbmatrix/RGBMatrix.c -msgid "Invalid pin" -msgstr "Wúxiào de yǐn jiǎo" - -#: ports/atmel-samd/common-hal/audioio/AudioOut.c -msgid "Invalid pin for left channel" -msgstr "Zuǒ tōngdào de yǐn jiǎo wúxiào" - -#: ports/atmel-samd/common-hal/audioio/AudioOut.c -msgid "Invalid pin for right channel" -msgstr "Yòuxián tōngdào yǐn jiǎo wúxiào" - -#: ports/atmel-samd/common-hal/busio/I2C.c -#: ports/atmel-samd/common-hal/busio/SPI.c -#: ports/atmel-samd/common-hal/busio/UART.c -#: ports/atmel-samd/common-hal/i2cperipheral/I2CPeripheral.c -#: ports/cxd56/common-hal/busio/I2C.c ports/cxd56/common-hal/busio/SPI.c -#: ports/cxd56/common-hal/busio/UART.c ports/cxd56/common-hal/sdioio/SDCard.c -#: ports/espressif/common-hal/busio/I2C.c -#: ports/espressif/common-hal/busio/SPI.c -#: ports/espressif/common-hal/busio/UART.c -#: ports/espressif/common-hal/canio/CAN.c -#: ports/espressif/common-hal/i2cperipheral/I2CPeripheral.c -#: ports/mimxrt10xx/common-hal/busio/I2C.c -#: ports/mimxrt10xx/common-hal/busio/SPI.c -#: ports/mimxrt10xx/common-hal/usb_host/Port.c ports/nrf/common-hal/busio/I2C.c -#: ports/raspberrypi/common-hal/busio/I2C.c -#: ports/raspberrypi/common-hal/busio/SPI.c -#: ports/raspberrypi/common-hal/busio/UART.c shared-bindings/busio/SPI.c #: shared-bindings/busio/UART.c msgid "Invalid pins" msgstr "Wúxiào de yǐn jiǎo" -#: shared-bindings/bitbangio/SPI.c shared-bindings/busio/SPI.c -#: shared-bindings/displayio/FourWire.c -msgid "Invalid polarity" -msgstr "Wúxiào liǎng jí zhí" - -#: shared-bindings/_bleio/Characteristic.c -msgid "Invalid properties" -msgstr "Wúxiào de shǔxìng" - -#: shared-bindings/microcontroller/__init__.c -msgid "Invalid run mode." -msgstr "Wúxiào de yùnxíng móshì." - -#: shared-module/_bleio/Attribute.c -msgid "Invalid security_mode" -msgstr "Ānquán móshì wúxiào" - -#: ports/espressif/bindings/espidf/__init__.c ports/espressif/esp_error.c +#: ports/espressif/common-hal/espidf/__init__.c ports/espressif/esp_error.c msgid "Invalid size" msgstr "dà xiǎo wú xiào" #: ports/espressif/common-hal/ssl/SSLContext.c +#: ports/raspberrypi/common-hal/ssl/SSLSocket.c msgid "Invalid socket for TLS" msgstr "TLS de chā zuò wú xiào" -#: ports/espressif/bindings/espidf/__init__.c ports/espressif/esp_error.c +#: ports/espressif/common-hal/espidf/__init__.c ports/espressif/esp_error.c msgid "Invalid state" msgstr "wú xiào zhuàng tài" -#: shared-bindings/audiomixer/Mixer.c -msgid "Invalid voice" -msgstr "Yǔyīn wúxiào" - -#: shared-bindings/audiomixer/Mixer.c -msgid "Invalid voice count" -msgstr "Wúxiào de yǔyīn jìshù" - -#: shared-module/audiocore/WaveFile.c -msgid "Invalid wave file" -msgstr "Wúxiào de làng làngcháo wénjiàn" - -#: ports/mimxrt10xx/common-hal/busio/UART.c ports/nrf/common-hal/busio/UART.c -#: ports/raspberrypi/common-hal/busio/UART.c ports/stm/common-hal/busio/UART.c -msgid "Invalid word/bit length" -msgstr "Wúxiào de zì/wèi chángdù" - #: shared-bindings/aesio/aes.c msgid "Key must be 16, 24, or 32 bytes long" msgstr "mì yào bì xū wéi 16, 24 huò 32 zì jié cháng" @@ -1537,25 +1288,17 @@ msgid "LHS of keyword arg must be an id" msgstr "Guānjiàn zì arg de LHS bìxū shì id" #: shared-module/displayio/Group.c -msgid "Layer already in a group." -msgstr "Tú céng yǐjīng zài yīgè zǔ zhōng." +msgid "Layer already in a group" +msgstr "tú céng yǐ zài zǔ zhōng" #: shared-module/displayio/Group.c -msgid "Layer must be a Group or TileGrid subclass." -msgstr "Layer bìxū shì Group huò TileGrid zi lèi." +msgid "Layer must be a Group or TileGrid subclass" +msgstr "tú céng bìxū shì zǔ huò píng pū wǎng gé zi lèi" -#: ports/espressif/bindings/espidf/__init__.c ports/espressif/esp_error.c +#: ports/espressif/common-hal/espidf/__init__.c ports/espressif/esp_error.c msgid "MAC address was invalid" msgstr "MAC dì zhǐ wú xiào" -#: shared-module/bitbangio/SPI.c -msgid "MISO pin init failed." -msgstr "MISO yǐn jiǎo chūshǐhuà shībài." - -#: shared-module/bitbangio/SPI.c -msgid "MOSI pin init failed." -msgstr "MOSI yǐn jiǎo shūrù shībài." - #: shared-bindings/is31fl3741/IS31FL3741.c msgid "Mapping must be a tuple" msgstr "yìng shè bì xū shì yuán zǔ" @@ -1565,10 +1308,6 @@ msgstr "yìng shè bì xū shì yuán zǔ" msgid "Maximum x value when mirrored is %d" msgstr "Jìngxiàng shí de zuìdà X zhí wèi%d" -#: shared-bindings/canio/Message.c -msgid "Messages limited to 8 bytes" -msgstr "Yóujiàn xiànzhì wèi 8 gè zì jié" - #: shared-bindings/audiobusio/PDMIn.c msgid "Microphone startup delay must be in range 0.0 to 1.0" msgstr "Màikèfēng qǐdòng yánchí bìxū zài 0.0 Dào 1.0 De fànwéi nèi" @@ -1576,16 +1315,20 @@ msgstr "Màikèfēng qǐdòng yánchí bìxū zài 0.0 Dào 1.0 De fànwéi nèi #: ports/raspberrypi/bindings/rp2pio/StateMachine.c #: ports/raspberrypi/common-hal/rp2pio/StateMachine.c msgid "Mismatched data size" -msgstr "" +msgstr "shùjù dàxiǎo bù pǐpèi" #: ports/raspberrypi/common-hal/rp2pio/StateMachine.c msgid "Mismatched swap flag" -msgstr "" +msgstr "jiāohuàn biāozhì bù pǐpèi" -#: ports/mimxrt10xx/common-hal/busio/SPI.c ports/stm/common-hal/busio/SPI.c +#: ports/mimxrt10xx/common-hal/busio/SPI.c msgid "Missing MISO or MOSI Pin" msgstr "Quēshǎo MISO huò MOSI yǐn jiǎo" +#: ports/stm/common-hal/busio/SPI.c +msgid "Missing MISO or MOSI pin" +msgstr "quēshǎo MISO huò MOSI yǐn jiǎo" + #: ports/raspberrypi/common-hal/rp2pio/StateMachine.c #, c-format msgid "Missing first_in_pin. Instruction %d reads pin(s)" @@ -1622,11 +1365,6 @@ msgstr "quē shǎo dì yī zǔ yǐn jiǎo. zhǐ lìng %d shè zhì yǐn jiǎo" msgid "Missing jmp_pin. Instruction %d jumps on pin" msgstr "shī zōng de jmp_pin. zhǐ lìng %d zài yǐn jiǎo shàng tiào yuè" -#: shared-module/usb_hid/Device.c -#, c-format -msgid "More than %d report ids not supported" -msgstr "chāo guò %d bào gào bù zhī chí de ID" - #: shared-bindings/busio/UART.c shared-bindings/displayio/Group.c msgid "Must be a %q subclass." msgstr "Bìxū shì %q zi lèi." @@ -1654,7 +1392,7 @@ msgstr "Míngchēng tài zhǎng" #: shared-bindings/displayio/TileGrid.c msgid "New bitmap must be same size as old bitmap" -msgstr "" +msgstr "xīn wèi tú de dàxiǎo bìxū yǔ jiù wèi tú xiāngtóng" #: ports/espressif/common-hal/_bleio/__init__.c msgid "Nimble out of memory" @@ -1686,16 +1424,28 @@ msgstr "wèi zhǎo dào DMA qǐ bó qì" msgid "No I2C device at address: 0x%x" msgstr "dì zhǐ: 0x%x shí méi yǒu I2C qì jiàn" +#: supervisor/shared/web_workflow/web_workflow.c +msgid "No IP" +msgstr "wú IP" + #: ports/espressif/common-hal/busio/SPI.c -#: ports/mimxrt10xx/common-hal/busio/SPI.c ports/stm/common-hal/busio/SPI.c +#: ports/mimxrt10xx/common-hal/busio/SPI.c msgid "No MISO Pin" msgstr "Méiyǒu MISO yǐn jiǎo" +#: ports/stm/common-hal/busio/SPI.c shared-module/bitbangio/SPI.c +msgid "No MISO pin" +msgstr "wú MISO pin" + #: ports/espressif/common-hal/busio/SPI.c -#: ports/mimxrt10xx/common-hal/busio/SPI.c ports/stm/common-hal/busio/SPI.c +#: ports/mimxrt10xx/common-hal/busio/SPI.c msgid "No MOSI Pin" msgstr "Méiyǒu MOSI yǐn jiǎo" +#: ports/stm/common-hal/busio/SPI.c shared-module/bitbangio/SPI.c +msgid "No MOSI pin" +msgstr "wú MOSI pin" + #: ports/atmel-samd/common-hal/busio/UART.c #: ports/espressif/common-hal/busio/UART.c #: ports/mimxrt10xx/common-hal/busio/UART.c ports/nrf/common-hal/busio/UART.c @@ -1734,16 +1484,6 @@ msgstr "Méiyǒu miǎnfèi de GCLKs" msgid "No hardware random available" msgstr "Méiyǒu kěyòng de yìngjiàn suíjī" -#: ports/atmel-samd/common-hal/ps2io/Ps2.c -msgid "No hardware support on clk pin" -msgstr "Shízhōng yǐn jiǎo wú yìngjiàn zhīchí" - -#: ports/atmel-samd/common-hal/alarm/pin/PinAlarm.c -#: ports/atmel-samd/common-hal/frequencyio/FrequencyIn.c -#: ports/atmel-samd/common-hal/pulseio/PulseIn.c -msgid "No hardware support on pin" -msgstr "Méiyǒu zài yǐn jiǎo shàng de yìngjiàn zhīchí" - #: ports/raspberrypi/common-hal/rp2pio/StateMachine.c msgid "No in in program" msgstr "chéng xù zhōng méi yǒu" @@ -1790,7 +1530,7 @@ msgstr "Shèbèi shàng méiyǒu kònggé" #: py/moduerrno.c msgid "No such device" -msgstr "" +msgstr "wú cǐ shèbèi" #: py/moduerrno.c msgid "No such file/directory" @@ -1842,16 +1582,26 @@ msgstr "" msgid "Odd parity is not supported" msgstr "Bù zhīchí jīshù" +#: supervisor/shared/bluetooth/bluetooth.c +msgid "Off" +msgstr "guānbì" + +#: supervisor/shared/bluetooth/bluetooth.c +msgid "Ok" +msgstr "hái hǎo" + #: ports/atmel-samd/common-hal/audiobusio/PDMIn.c #: ports/raspberrypi/common-hal/audiobusio/PDMIn.c msgid "Only 8 or 16 bit mono with " msgstr "Zhǐyǒu 8 huò 16 wèi dānwèi " #: ports/espressif/common-hal/wifi/__init__.c +#: ports/raspberrypi/common-hal/wifi/__init__.c msgid "Only IPv4 addresses supported" msgstr "Jǐn zhīchí IPv4 dìzhǐ" -#: ports/espressif/common-hal/socketpool/SocketPool.c +#: ports/espressif/common-hal/socketpool/Socket.c +#: ports/raspberrypi/common-hal/socketpool/Socket.c msgid "Only IPv4 sockets supported" msgstr "jǐn zhī chí IPv4 tào jiē zì" @@ -1888,15 +1638,19 @@ msgstr "" msgid "Only one TouchAlarm can be set in deep sleep." msgstr "zhǐ yǒu yí gè chù mō bì kě yǐ shè zhì zài shēn dù shuì mián." -#: ports/espressif/common-hal/i2cperipheral/I2CPeripheral.c +#: ports/espressif/common-hal/i2ctarget/I2CTarget.c +#: ports/raspberrypi/common-hal/i2ctarget/I2CTarget.c msgid "Only one address is allowed" msgstr "zhǐ yǔn xǔ yí gè dì zhǐ" #: ports/atmel-samd/common-hal/alarm/time/TimeAlarm.c -#: ports/espressif/common-hal/alarm/time/TimeAlarm.c #: ports/nrf/common-hal/alarm/time/TimeAlarm.c -#: ports/raspberrypi/common-hal/alarm/time/TimeAlarm.c #: ports/stm/common-hal/alarm/time/TimeAlarm.c +msgid "Only one alarm.time alarm can be set" +msgstr "zhǐ néng shèzhì yīgè nào líng shíjiān nào líng" + +#: ports/espressif/common-hal/alarm/time/TimeAlarm.c +#: ports/raspberrypi/common-hal/alarm/time/TimeAlarm.c msgid "Only one alarm.time alarm can be set." msgstr "zhǐ néng shè zhì yí gè bào jǐng." @@ -1906,21 +1660,22 @@ msgstr "Yīcì zhǐ néng yǒuyī zhǒng yánsè shì tòumíng de" #: py/moduerrno.c msgid "Operation not permitted" -msgstr "" +msgstr "bù yǔnxǔ cāozuò" -#: ports/espressif/bindings/espidf/__init__.c ports/espressif/esp_error.c +#: ports/espressif/common-hal/espidf/__init__.c ports/espressif/esp_error.c msgid "Operation or feature not supported" msgstr "bù zhī chí cāo zuò huò gōng néng" -#: ports/espressif/bindings/espidf/__init__.c ports/espressif/esp_error.c +#: ports/espressif/common-hal/espidf/__init__.c ports/espressif/esp_error.c msgid "Operation timed out" msgstr "cāo zuò yǐ fēn shí" -#: ports/espressif/bindings/espidf/__init__.c ports/espressif/esp_error.c +#: ports/espressif/common-hal/espidf/__init__.c ports/espressif/esp_error.c msgid "Out of memory" msgstr "nèi cún bù zú" -#: ports/espressif/common-hal/socketpool/SocketPool.c +#: ports/espressif/common-hal/socketpool/Socket.c +#: ports/raspberrypi/common-hal/socketpool/Socket.c msgid "Out of sockets" msgstr "tào jiē zì wài" @@ -1928,11 +1683,6 @@ msgstr "tào jiē zì wài" msgid "Out-buffer elements must be <= 4 bytes long" msgstr "huǎn chōng wài yuán sù bì xū <= 4 zì jié cháng" -#: shared-bindings/bitops/__init__.c -#, c-format -msgid "Output buffer must be at least %d bytes" -msgstr "shū chū huǎn chōng qū bì xū zhì shǎo wéi %d zì jié" - #: shared-bindings/audiobusio/PDMIn.c msgid "Oversample must be multiple of 8." msgstr "Guò cǎiyàng bìxū shì 8 de bèishù." @@ -1941,17 +1691,15 @@ msgstr "Guò cǎiyàng bìxū shì 8 de bèishù." msgid "PDMIn not available" msgstr "PDMIn bù kě yòng" -#: shared-bindings/pwmio/PWMOut.c -msgid "" -"PWM duty_cycle must be between 0 and 65535 inclusive (16 bit resolution)" -msgstr "" -"PWM yìwù zhōuqí bìxū jiè yú 0 zhì 65535 de bāoróng xìng (16 wèi fēnbiàn lǜ)" - #: shared-bindings/pwmio/PWMOut.c msgid "" "PWM frequency not writable when variable_frequency is False on construction." msgstr "Dāng biànliàng_pínlǜ shì False zài jiànzhú shí PWM pínlǜ bùkě xiě." +#: ports/stm/common-hal/pwmio/PWMOut.c +msgid "PWM restart" +msgstr "PWM chóngqǐ" + #: ports/raspberrypi/common-hal/countio/Counter.c msgid "PWM slice already in use" msgstr "yǐ jīng zài shǐ yòng de PWM qiē piàn" @@ -1968,36 +1716,20 @@ msgstr "shǐ yòng zhōng de wài shè" msgid "Permission denied" msgstr "Quánxiàn bèi jùjué" -#: ports/atmel-samd/common-hal/alarm/pin/PinAlarm.c #: ports/stm/common-hal/alarm/pin/PinAlarm.c msgid "Pin cannot wake from Deep Sleep" msgstr "yǐn jiǎo wú fǎ cóng shēn dù shuì mián zhōng huàn xǐng" -#: ports/raspberrypi/bindings/rp2pio/StateMachine.c -msgid "Pin count must be at least 1" -msgstr "yǐn jiǎo jì shù bì xū zhì shǎo wéi 1" - #: ports/raspberrypi/common-hal/rp2pio/StateMachine.c msgid "Pin count too large" msgstr "yǐn jiǎo jì shù tài dà" -#: ports/atmel-samd/common-hal/analogio/AnalogIn.c -#: ports/cxd56/common-hal/analogio/AnalogIn.c -#: ports/espressif/common-hal/analogio/AnalogIn.c -#: ports/mimxrt10xx/common-hal/analogio/AnalogIn.c -#: ports/nrf/common-hal/analogio/AnalogIn.c -#: ports/raspberrypi/common-hal/analogio/AnalogIn.c -#: ports/stm/common-hal/analogio/AnalogIn.c -msgid "Pin does not have ADC capabilities" -msgstr "Pin méiyǒu ADC nénglì" - #: ports/stm/common-hal/alarm/pin/PinAlarm.c #: ports/stm/common-hal/pulseio/PulseIn.c msgid "Pin interrupt already in use" msgstr "yǐn jiǎo zhōng duàn yǐ zài shǐ yòng zhōng" #: shared-bindings/adafruit_bus_device/spi_device/SPIDevice.c -#: shared-bindings/digitalio/DigitalInOut.c msgid "Pin is input only" msgstr "Yǐn jiǎo jǐn shūrù" @@ -2062,18 +1794,10 @@ msgstr "chéng xù zài bù jiā zǎi ISR de qíng kuàng xià wán chéng" msgid "Program does OUT without loading OSR" msgstr "chéng xù zài bù jiā zǎi Osr de qíng kuàng xià zhí xíng OUT" -#: ports/raspberrypi/bindings/rp2pio/StateMachine.c -msgid "Program must contain at least one 16-bit instruction." -msgstr "chéng xù bì xū zhì shǎo bāo hán yí gè 16 wèi zhǐ lìng ." - #: ports/raspberrypi/bindings/rp2pio/StateMachine.c msgid "Program size invalid" msgstr "chéng xù dà xiǎo wú xiào" -#: ports/raspberrypi/bindings/rp2pio/StateMachine.c -msgid "Program too large" -msgstr "chéng xù tài dà" - #: shared-bindings/digitalio/DigitalInOut.c msgid "Pull not used when direction is output." msgstr "Fāngxiàng shūchū shí Pull méiyǒu shǐyòng." @@ -2095,30 +1819,20 @@ msgstr "RNG qǔxiāo chūshǐhuà cuòwù" msgid "RNG Init Error" msgstr "RNG chūshǐhuà cuòwù" -#: ports/nrf/common-hal/busio/UART.c -msgid "RS485 Not yet supported on this device" -msgstr "RS485 cǐ shè bèi shàng bù zhī chí" +#: ports/atmel-samd/common-hal/busio/UART.c ports/cxd56/common-hal/busio/UART.c +#: ports/nrf/common-hal/busio/UART.c ports/stm/common-hal/busio/UART.c +msgid "RS485" +msgstr "RS485" #: ports/espressif/common-hal/busio/UART.c #: ports/mimxrt10xx/common-hal/busio/UART.c msgid "RS485 inversion specified when not in RS485 mode" msgstr "Wèi chǔyú RS485 móshì shí zhǐdìngle RS485 fǎn zhuǎn" -#: ports/cxd56/common-hal/rtc/RTC.c ports/espressif/common-hal/rtc/RTC.c -#: ports/mimxrt10xx/common-hal/rtc/RTC.c ports/nrf/common-hal/rtc/RTC.c -#: ports/raspberrypi/common-hal/rtc/RTC.c -msgid "RTC calibration is not supported on this board" -msgstr "Cǐ bǎn bù zhīchí RTC jiàozhǔn" - #: shared-bindings/alarm/time/TimeAlarm.c shared-bindings/time/__init__.c msgid "RTC is not supported on this board" msgstr "Cǐ bǎn bù zhīchí RTC" -#: ports/atmel-samd/common-hal/busio/UART.c ports/cxd56/common-hal/busio/UART.c -#: ports/stm/common-hal/busio/UART.c -msgid "RTS/CTS/RS485 Not yet supported on this device" -msgstr "RTS/CTS/RS485 gāi shèbèi shàng bù zhīchí" - #: ports/stm/common-hal/os/__init__.c msgid "Random number generation error" msgstr "Suíjī shù shēngchéng cuòwù" @@ -2136,10 +1850,14 @@ msgstr "Zhǐ dú wénjiàn xìtǒng" msgid "Read-only object" msgstr "Zhǐ dú duìxiàng" -#: ports/espressif/bindings/espidf/__init__.c ports/espressif/esp_error.c +#: ports/espressif/common-hal/espidf/__init__.c ports/espressif/esp_error.c msgid "Received response was invalid" msgstr "shōu dào de xiǎng yìng wú xiào" +#: supervisor/shared/bluetooth/bluetooth.c +msgid "Reconnecting" +msgstr "chóngxīn liánjiē" + #: shared-bindings/displayio/EPaperDisplay.c msgid "Refresh too soon" msgstr "Shuāxīn tài kuàile" @@ -2152,7 +1870,7 @@ msgstr "RemoteTransmissionRequests xiànzhì wèi 8 gè zì jié" msgid "Requested AES mode is unsupported" msgstr "Qǐngqiú de AES móshì bù shòu zhīchí" -#: ports/espressif/bindings/espidf/__init__.c ports/espressif/esp_error.c +#: ports/espressif/common-hal/espidf/__init__.c ports/espressif/esp_error.c msgid "Requested resource not found" msgstr "wèi zhǎo dào qǐng qiú de zī yuán" @@ -2168,6 +1886,10 @@ msgstr "Zài ānquán móshì xià yùnxíng! Bù yùnxíng yǐ bǎocún de dài msgid "SD card CSD format not supported" msgstr "Bù zhīchí SD kǎ CSD géshì" +#: ports/cxd56/common-hal/sdioio/SDCard.c +msgid "SDCard init" +msgstr "SDCard chūshǐhuà" + #: ports/stm/common-hal/sdioio/SDCard.c #, c-format msgid "SDIO GetCardInfo Error %d" @@ -2178,30 +1900,21 @@ msgstr "SDIO GetCardInfo Cuòwù %d" msgid "SDIO Init Error %d" msgstr "SDIO Init Cuòwù %d" -#: ports/stm/common-hal/busio/SPI.c -msgid "SPI Init Error" -msgstr "SPI chūshǐhuà cuòwù" - -#: ports/stm/common-hal/busio/SPI.c -msgid "SPI Re-initialization error" -msgstr "SPI chóngxīn chūshǐhuà cuòwù" - #: ports/espressif/common-hal/busio/SPI.c msgid "SPI configuration failed" msgstr "SPI pèi zhì shī bài" +#: ports/stm/common-hal/busio/SPI.c +msgid "SPI init error" +msgstr "SPI chūshǐhuà cuòwù" + #: ports/raspberrypi/common-hal/busio/SPI.c msgid "SPI peripheral in use" msgstr "SPI wài shè zhèng zài shǐ yòng zhōng" -#: shared-bindings/audiomixer/Mixer.c -msgid "Sample rate must be positive" -msgstr "Cǎiyàng lǜ bìxū wèi zhèng shù" - -#: ports/atmel-samd/common-hal/audioio/AudioOut.c -#, c-format -msgid "Sample rate too high. It must be less than %d" -msgstr "Cǎiyàng lǜ tài gāo. Tā bìxū xiǎoyú %d" +#: ports/stm/common-hal/busio/SPI.c +msgid "SPI re-init" +msgstr "SPI chóngxīn qǐdòng" #: shared-bindings/is31fl3741/FrameBuffer.c msgid "Scale dimensions must divide by 3" @@ -2221,14 +1934,6 @@ msgstr "Xùliè huà yǐjīng shǐyòngguò" msgid "Server side context cannot have hostname" msgstr "Fúwùqì duān shàngxiàwén bùnéng jùyǒu zhǔjī míng" -#: ports/raspberrypi/bindings/rp2pio/StateMachine.c -msgid "Set pin count must be between 1 and 5" -msgstr "shè zhì yǐn jiǎo shù bì xū jiè yú 1 hé 5 zhī jiān" - -#: ports/raspberrypi/bindings/rp2pio/StateMachine.c -msgid "Side set pin count must be between 1 and 5" -msgstr "cè miàn shè zhì yǐn jiǎo shù bì xū jiè yú 1 hé 5 zhī jiān" - #: ports/cxd56/common-hal/camera/Camera.c msgid "Size not supported" msgstr "bù zhī chí dà xiǎo" @@ -2249,6 +1954,7 @@ msgid "Slices not supported" msgstr "Qiēpiàn bù shòu zhīchí" #: ports/espressif/common-hal/socketpool/SocketPool.c +#: ports/raspberrypi/common-hal/socketpool/SocketPool.c msgid "SocketPool can only be used with wifi.radio" msgstr "SocketPool zhǐ néng yǔ wifi.Radio yīqǐ shǐyòng" @@ -2264,10 +1970,6 @@ msgstr "zhǐ dìng data0 huò data_pins zhōng de yí gè" msgid "Splitting with sub-captures" msgstr "Yǔ zi bǔhuò fēnliè" -#: shared-bindings/supervisor/__init__.c -msgid "Stack size must be at least 256" -msgstr "Duīzhàn dàxiǎo bìxū zhìshǎo 256" - #: ports/raspberrypi/common-hal/audiopwmio/PWMAudioOut.c msgid "Stereo left must be on PWM channel A" msgstr "lì tǐ shēng zuǒ bì xū shì zài PWM tōng dào A" @@ -2276,10 +1978,6 @@ msgstr "lì tǐ shēng zuǒ bì xū shì zài PWM tōng dào A" msgid "Stereo right must be on PWM channel B" msgstr "lì tǐ shēng yòu cè bì xū zài PWM tōng dào B shàng" -#: shared-bindings/multiterminal/__init__.c -msgid "Stream missing readinto() or write() method." -msgstr "Liú quēshǎo readinto() huò write() fāngfǎ." - #: ports/mimxrt10xx/common-hal/busio/UART.c ports/stm/common-hal/busio/UART.c msgid "Supply at least one UART pin" msgstr "Dìngyì zhìshǎo yīgè UART yǐn jiǎo" @@ -2362,10 +2060,6 @@ msgstr "Píng pū gāodù bìxū huàfēn wèi tú gāodù" msgid "Tile index out of bounds" msgstr "Píng pū zhǐshù chāochū fànwéi" -#: shared-bindings/displayio/TileGrid.c -msgid "Tile value out of bounds" -msgstr "Píng pū zhí chāochū fànwéi" - #: shared-bindings/displayio/TileGrid.c msgid "Tile width must exactly divide bitmap width" msgstr "Píng pū kuāndù bìxū huàfēn wèi tú kuāndù" @@ -2385,6 +2079,9 @@ msgid "To exit, please reset the board without " msgstr "Yào tuìchū, qǐng chóng zhì bǎnkuài ér bùyòng " #: ports/atmel-samd/common-hal/audiobusio/I2SOut.c +msgid "Too many channels in sample" +msgstr "yàngběn zhōng de tōngdào tài duō" + #: ports/raspberrypi/common-hal/audiobusio/I2SOut.c msgid "Too many channels in sample." msgstr "Chōuyàng zhōng de píndào tài duō." @@ -2417,24 +2114,25 @@ msgid "Tuple or struct_time argument required" msgstr "Xūyào Tuple huò struct_time cānshù" #: ports/stm/common-hal/busio/UART.c -msgid "UART Buffer allocation error" -msgstr "UART huǎnchōng qū fēnpèi cuòwù" +msgid "UART de-init" +msgstr "UART qù chūshǐhuà" + +#: ports/atmel-samd/common-hal/busio/UART.c ports/cxd56/common-hal/busio/UART.c +#: ports/espressif/common-hal/busio/UART.c ports/stm/common-hal/busio/UART.c +msgid "UART init" +msgstr "UART chūshǐhuà" #: ports/stm/common-hal/busio/UART.c -msgid "UART De-init error" -msgstr "UART qǔxiāo chūshǐhuà cuòwù" +msgid "UART re-init" +msgstr "UART chóngxīn qǐdòng" #: ports/stm/common-hal/busio/UART.c -msgid "UART Init Error" -msgstr "UART chūshǐhuà cuòwù" +msgid "UART write" +msgstr "UART xiě rù" -#: ports/stm/common-hal/busio/UART.c -msgid "UART Re-init error" -msgstr "UART chóngxīn chūshǐhuà cuòwù" - -#: ports/stm/common-hal/busio/UART.c -msgid "UART write error" -msgstr "UART xiě cuòwù" +#: main.c +msgid "UID:" +msgstr "" #: shared-module/usb_hid/Device.c msgid "USB busy" @@ -2559,6 +2257,11 @@ msgstr "wèi zhī xì tǒng gù jiàn cuò wù: %04x" msgid "Unknown system firmware error: %d" msgstr "wèi zhī de xì tǒng gù jiàn cuò wù: %d" +#: ports/raspberrypi/common-hal/wifi/__init__.c +#, c-format +msgid "Unkown error code %d" +msgstr "" + #: shared-bindings/adafruit_pixelbuf/PixelBuf.c #, c-format msgid "Unmatched number of items on RHS (expected %d, got %d)." @@ -2572,12 +2275,6 @@ msgstr "" "Wèi zhǐdìng de wèntí. Kěnéng shì qítā shèbèi shàng de pèiduì tíshì bèi jùjué " "huò hūlüè." -#: ports/atmel-samd/common-hal/busio/I2C.c ports/cxd56/common-hal/busio/I2C.c -#: ports/espressif/common-hal/busio/UART.c -#: ports/raspberrypi/common-hal/busio/I2C.c ports/stm/common-hal/busio/I2C.c -msgid "Unsupported baudrate" -msgstr "Bù zhīchí de baudrate" - #: shared-bindings/bitmaptools/__init__.c msgid "Unsupported colorspace" msgstr "bú zhī chí de sè cǎi kōng jiān" @@ -2590,6 +2287,10 @@ msgstr "Bù zhīchí de gōnggòng qìchē lèixíng" msgid "Unsupported format" msgstr "Bù zhīchí de géshì" +#: shared-bindings/hashlib/__init__.c +msgid "Unsupported hash algorithm" +msgstr "bù zhīchí de hā xī suànfǎ" + #: ports/espressif/common-hal/dualbank/__init__.c msgid "Update Failed" msgstr "gēng xīn shī bài" @@ -2608,7 +2309,7 @@ msgstr "Zhí chángdù != Suǒ xū de gùdìng chángdù" msgid "Value length > max_length" msgstr "Zhí chángdù > zuìdà chángdù" -#: ports/espressif/bindings/espidf/__init__.c ports/espressif/esp_error.c +#: ports/espressif/common-hal/espidf/__init__.c ports/espressif/esp_error.c msgid "Version was invalid" msgstr "bǎn běn wú xiào" @@ -2639,10 +2340,6 @@ msgstr "" msgid "WatchDogTimer.timeout must be greater than 0" msgstr "WatchDogTimer.Timeout bìxū dàyú 0" -#: supervisor/shared/safe_mode.c -msgid "Watchdog timer expired." -msgstr "Kān mén gǒu dìngshí qì yǐ guòqí." - #: py/builtinhelp.c #, c-format msgid "" @@ -2658,9 +2355,9 @@ msgstr "" "\n" "liè chū nèi zhì mó kuài jiàn rù `help(\"modules\")`.\n" -#: shared-bindings/wifi/Radio.c -msgid "WiFi password must be between 8 and 63 characters" -msgstr "WiFi mìmǎ bìxū jiè yú 8 dào 63 gè zìfú zhī jiān" +#: supervisor/shared/web_workflow/web_workflow.c +msgid "Wi-Fi: " +msgstr "Wi-Fi: " #: main.c msgid "Woken up by alarm.\n" @@ -2702,11 +2399,7 @@ msgstr "__new__ cānshù bìxū shì yònghù lèixíng" msgid "a bytes-like object is required" msgstr "xūyào yīgè zì jié lèi duìxiàng" -#: shared-bindings/i2cperipheral/I2CPeripheral.c -msgid "address out of bounds" -msgstr "dìzhǐ chāochū biānjiè" - -#: shared-bindings/i2cperipheral/I2CPeripheral.c +#: shared-bindings/i2ctarget/I2CTarget.c msgid "addresses is empty" msgstr "dìzhǐ wèi kōng" @@ -2755,6 +2448,10 @@ msgstr "cānshù bìxū shì ndarrays" msgid "array and index length must be equal" msgstr "shù zǔ hé suǒ yǐn cháng dù bì xū xiāng děng" +#: extmod/ulab/code/numpy/io/io.c +msgid "array has too many dimensions" +msgstr "shùzǔ yǒu tài duō wéidù" + #: py/objarray.c shared-bindings/alarm/SleepMemory.c #: shared-bindings/nvm/ByteArray.c msgid "array/bytes required on right side" @@ -2816,10 +2513,6 @@ msgstr "wèi tú dà xiǎo bì xū pǐ pèi" msgid "bits must be 32 or less" msgstr "wèi bì xū shì 32 huò gèng shǎo" -#: shared-bindings/busio/UART.c -msgid "bits must be in range 5 to 9" -msgstr "wèi bì xū zài fàn wéi nèi 5 zhì 9" - #: shared-bindings/audiomixer/Mixer.c msgid "bits_per_sample must be 8 or 16" msgstr "měi jiàn yàngběn bìxū wèi 8 huò 16" @@ -2857,11 +2550,6 @@ msgstr "huǎn chōng qū tài xiǎo, duì yú qǐng qiú de zì jié" msgid "byteorder is not a string" msgstr "byteorder bùshì zìfú chuàn" -#: ports/atmel-samd/common-hal/busio/UART.c -#: ports/espressif/common-hal/busio/UART.c -msgid "bytes > 8 bits not supported" -msgstr "zì jié > 8 wèi" - #: py/objarray.c msgid "bytes length not a multiple of item size" msgstr "zì jié chángdù, bùshì xiàngmù dàxiǎo de bèishù" @@ -2870,7 +2558,7 @@ msgstr "zì jié chángdù, bùshì xiàngmù dàxiǎo de bèishù" msgid "bytes value out of range" msgstr "zì jié zhí chāochū fànwéi" -#: ports/atmel-samd/bindings/samd/Clock.c ports/atmel-samd/common-hal/rtc/RTC.c +#: ports/atmel-samd/bindings/samd/Clock.c msgid "calibration is out of range" msgstr "jiàozhǔn fànwéi chāochū fànwéi" @@ -2878,13 +2566,10 @@ msgstr "jiàozhǔn fànwéi chāochū fànwéi" msgid "calibration is read only" msgstr "jiàozhǔn zhǐ dú dào" -#: ports/atmel-samd/common-hal/rtc/RTC.c -msgid "calibration value out of range +/-127" -msgstr "jiàozhǔn zhí chāochū fànwéi +/-127" - +#: shared-module/vectorio/Circle.c shared-module/vectorio/Polygon.c #: shared-module/vectorio/Rectangle.c -msgid "can only be registered in one parent" -msgstr "zhǐ néng zài yí gè jiā zhǎng zhōng zhù cè" +msgid "can only have one parent" +msgstr "zhǐ néng yǒu yīgè fù xiàng" #: py/emitinlinethumb.c msgid "can only have up to 4 parameters to Thumb assembly" @@ -2906,8 +2591,7 @@ msgstr "bùnéng fēnpèi dào biǎodá shì" msgid "can't cancel self" msgstr "bù néng qǔ xiāo zì wǒ" -#: py/obj.c py/objint.c shared-bindings/i2cperipheral/I2CPeripheral.c -#: shared-module/adafruit_pixelbuf/PixelBuf.c +#: py/obj.c py/objint.c shared-module/adafruit_pixelbuf/PixelBuf.c msgid "can't convert %q to %q" msgstr "Wúfǎ jiāng %q zhuǎnhuàn wèi %q" @@ -3055,6 +2739,10 @@ msgstr "bù néng háo bù hán hu de dé dào dà xiǎo de lín" msgid "casting" msgstr "tóuyǐng" +#: ports/stm/common-hal/pwmio/PWMOut.c +msgid "channel re-init" +msgstr "tōngdào chóngxīn chūshǐhuà" + #: shared-bindings/_stage/Text.c msgid "chars buffer too small" msgstr "zìfú huǎnchōng qū tài xiǎo" @@ -3067,10 +2755,6 @@ msgstr "chr() cān shǔ bùzài fànwéi (0x110000)" msgid "chr() arg not in range(256)" msgstr "chr() cān shǔ bùzài fànwéi (256)" -#: shared-module/vectorio/Circle.c -msgid "circle can only be registered in one parent" -msgstr "quānzi zhǐ néng zài yī wèi jiāzhǎng zhōng zhùcè" - #: shared-bindings/bitmaptools/__init__.c msgid "clip point must be (x,y) tuple" msgstr "jiá dian bì xū shì (x,y) kuài" @@ -3098,10 +2782,6 @@ msgstr "" msgid "color must be between 0x000000 and 0xffffff" msgstr "yánsè bìxū jiè yú 0x000000 hé 0xffffff zhī jiān" -#: shared-bindings/displayio/ColorConverter.c -msgid "color should be an int" -msgstr "yánsè yīng wèi zhěngshù" - #: py/emitnative.c msgid "comparison of int and uint" msgstr "yīn tè hé wū yīn tè de bǐ jiào" @@ -3138,6 +2818,10 @@ msgstr "juàn jī cānshù bìxū shì ndarrays" msgid "convolve arguments must not be empty" msgstr "juàn jī cān shǔ bùnéng wéi kōng" +#: extmod/ulab/code/numpy/io/io.c +msgid "corrupted file" +msgstr "wénjiàn sǔnhuài" + #: extmod/ulab/code/numpy/poly.c msgid "could not invert Vandermonde matrix" msgstr "wúfǎ fǎn zhuǎn fàndéméng dé jǔzhèn" @@ -3190,10 +2874,6 @@ msgstr "" msgid "destination buffer must be an array of type 'H' for bit_depth = 16" msgstr "mùbiāo huǎnchōng qū bìxū shì wèi shēndù'H' lèixíng de shùzǔ = 16" -#: shared-bindings/audiobusio/PDMIn.c -msgid "destination_length must be an int >= 0" -msgstr "mùbiāo chángdù bìxū shì > = 0 de zhěngshù" - #: py/objdict.c msgid "dict update sequence has wrong length" msgstr "yǔfǎ gēngxīn xùliè de chángdù cuòwù" @@ -3231,6 +2911,10 @@ msgstr "dtype bì xū shì fú diǎn xíng huò fù shù" msgid "empty" msgstr "kòngxián" +#: extmod/ulab/code/numpy/io/io.c +msgid "empty file" +msgstr "kōng de wénjiàn" + #: extmod/moduasyncio.c extmod/moduheapq.c extmod/modutimeq.c msgid "empty heap" msgstr "kōng yīn yīnxiào" @@ -3247,10 +2931,6 @@ msgstr "kōng xùliè" msgid "end of format while looking for conversion specifier" msgstr "xúnzhǎo zhuǎnhuàn biāozhù géshì de jiéshù" -#: shared-bindings/displayio/Shape.c -msgid "end_x should be an int" -msgstr "jiéwěi_x yīnggāi shì yīgè zhěngshù" - #: shared-bindings/alarm/time/TimeAlarm.c msgid "epoch_time not supported on this board" msgstr "epoch_time bǎn bù zhī chí cǐ bǎn běn" @@ -3260,6 +2940,12 @@ msgstr "epoch_time bǎn bù zhī chí cǐ bǎn běn" msgid "error = 0x%08lX" msgstr "cuòwù = 0x%08lX" +#: ports/espressif/common-hal/esp32_camera/Camera.c +msgid "" +"esp32_camera.Camera requires reserved PSRAM to be configured. See the " +"documentation for instructions." +msgstr "" + #: py/runtime.c msgid "exceptions must derive from BaseException" msgstr "lìwài bìxū láizì BaseException" @@ -3334,7 +3020,7 @@ msgstr "dì yīgè cānshù bìxū shì yī gè hánshù" msgid "first argument must be a tuple of ndarrays" msgstr "dì yī gè cān shù bì xū shì yí gè yuán zǔ ndarrays" -#: extmod/ulab/code/numpy/vector.c +#: extmod/ulab/code/numpy/transform.c extmod/ulab/code/numpy/vector.c msgid "first argument must be an ndarray" msgstr "dì yī gè cānshù bìxū shì ndarray" @@ -3482,7 +3168,7 @@ msgstr "géshì bù wánzhěng de mì yào" msgid "incorrect padding" msgstr "bù zhèngquè de tiánchōng" -#: extmod/ulab/code/ndarray.c +#: extmod/ulab/code/ndarray.c extmod/ulab/code/numpy/transform.c msgid "index is out of bounds" msgstr "suǒyǐn chāochū fànwéi" @@ -3500,6 +3186,10 @@ msgstr "suǒyǐn bìxū shì zhěngshù" msgid "indices must be integers, slices, or Boolean lists" msgstr "suǒyǐn bìxū shì zhěngshù, qiēpiàn huò bù'ěr zhí lièbiǎo" +#: ports/espressif/common-hal/busio/I2C.c +msgid "init I2C" +msgstr "chūshǐhuà I2C" + #: extmod/ulab/code/scipy/optimize/optimize.c msgid "initial values must be iterable" msgstr "chūshǐ zhí bìxū shì kě diédài de" @@ -3545,6 +3235,10 @@ msgstr "shūrù jǔzhèn bù duìchèn" msgid "input matrix is singular" msgstr "shūrù jǔzhèn shì qíyì de" +#: extmod/ulab/code/numpy/create.c +msgid "input must be 1- or 2-d" +msgstr "shūrù bìxū shì 1- huò 2-d" + #: extmod/ulab/code/numpy/carray/carray.c msgid "input must be a 1D ndarray" msgstr "shū rù bì xū shì 1D ndarray" @@ -3553,11 +3247,7 @@ msgstr "shū rù bì xū shì 1D ndarray" msgid "input must be a dense ndarray" msgstr "shū rù bì xū shì mì jí de ndarray" -#: extmod/ulab/code/numpy/create.c -msgid "input must be a tensor of rank 2" -msgstr "shū rù bì xū shì děng jí 2 de zhāng liàng" - -#: extmod/ulab/code/numpy/create.c extmod/ulab/code/user/user.c +#: extmod/ulab/code/user/user.c msgid "input must be an ndarray" msgstr "shū rù bì xū shì ndarray" @@ -3607,6 +3297,10 @@ msgstr "wú xiào de jià gòu" msgid "invalid bits_per_pixel %d, must be, 1, 2, 4, 8, 16, 24, or 32" msgstr "wú xiào bits_per_pixel %d, bì xū shì, 1, 2, 4, 8, 16, 24, huò 32" +#: ports/raspberrypi/common-hal/ssl/SSLSocket.c +msgid "invalid cert" +msgstr "zhèngshū wúxiào" + #: shared-bindings/bitmaptools/__init__.c #, c-format msgid "invalid element size %d for bits_per_pixel %d\n" @@ -3633,10 +3327,18 @@ msgstr "wúxiào de géshì biāozhù" msgid "invalid hostname" msgstr "wú xiào zhǔ jī míng" +#: ports/raspberrypi/common-hal/ssl/SSLSocket.c +msgid "invalid key" +msgstr "wúxiào de mì yào" + #: py/compile.c msgid "invalid micropython decorator" msgstr "wúxiào de MicroPython zhuāngshì qì" +#: ports/espressif/common-hal/esp32_camera/Camera.c +msgid "invalid setting" +msgstr "shèzhì wúxiào" + #: shared-bindings/random/__init__.c msgid "invalid step" msgstr "wúxiào bùzhòu" @@ -3751,24 +3453,16 @@ msgstr "shùxué yù cuòwù" msgid "matrix is not positive definite" msgstr "jǔzhèn bùshì zhèngdìng de" -#: ports/espressif/common-hal/wifi/Radio.c -msgid "max_connections must be between 0 and 10" -msgstr "max_connections bì xū jiè yú 0 hé 10 zhī jiān" - #: ports/espressif/common-hal/_bleio/Descriptor.c #: ports/nrf/common-hal/_bleio/Characteristic.c #: ports/nrf/common-hal/_bleio/Descriptor.c #, c-format msgid "max_length must be 0-%d when fixed_length is %s" -msgstr "dāng fixed_length de zhí wéi %s shí, max_length bì xū wéi 0-%d" - -#: shared-bindings/_bleio/Characteristic.c shared-bindings/_bleio/Descriptor.c -msgid "max_length must be >= 0" -msgstr "zuì dà cháng dù bì xū >= 0" +msgstr "max_length bìxū shì 0-%d, dāng fixed_length shì %s" #: extmod/ulab/code/ndarray.c -msgid "maximum number of dimensions is 4" -msgstr "zuì dà chǐ cùn shù wéi 4" +msgid "maximum number of dimensions is " +msgstr "zuìdà wéi shù shì " #: py/runtime.c msgid "maximum recursion depth exceeded" @@ -3901,7 +3595,7 @@ msgstr "Méiyǒu kěyòng de fùwèi yǐn jiǎo" msgid "no response from SD card" msgstr "SD kǎ wú huíyīng" -#: py/objobject.c py/runtime.c +#: ports/espressif/common-hal/esp32_camera/Camera.c py/objobject.c py/runtime.c msgid "no such attribute" msgstr "méiyǒu cǐ shǔxìng" @@ -4012,7 +3706,11 @@ msgstr "xūyào huǎnchōng qū xiéyì de duìxiàng" msgid "odd-length string" msgstr "jīshù zìfú chuàn" -#: extmod/ulab/code/numpy/create.c extmod/ulab/code/utils/utils.c +#: supervisor/shared/web_workflow/web_workflow.c +msgid "off" +msgstr "guānbì" + +#: extmod/ulab/code/utils/utils.c msgid "offset is too large" msgstr "piān yí tài dà" @@ -4108,10 +3806,6 @@ msgstr "bāo zhuāng yù qī de %d bāo zhuāng xiàng mù (dé dào %d)" msgid "palette must be 32 bytes long" msgstr "yánsè bìxū shì 32 gè zì jié" -#: shared-bindings/displayio/Palette.c -msgid "palette_index should be an int" -msgstr "yánsè suǒyǐn yīnggāi shì yīgè zhěngshù" - #: py/emitinlinextensa.c msgid "parameters must be registers in sequence a2 to a5" msgstr "cānshù bìxū shì xùliè a2 zhì a5 de dēngjì shù" @@ -4136,10 +3830,6 @@ msgstr "pixel_shader bìxū shì displayio.Palette huò displayio.ColorConverter msgid "poll on file not available on win32" msgstr "zài win32 shàng bù tí gōng wén jiàn tóu piào" -#: shared-module/vectorio/Polygon.c -msgid "polygon can only be registered in one parent" -msgstr "duōbiānxíng zhī néng zài yīgè fù jí zhōng zhùcè" - #: ports/espressif/common-hal/pulseio/PulseIn.c msgid "pop from an empty PulseIn" msgstr "cóng kōng mài chōng tán chū" @@ -4165,7 +3855,23 @@ 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/espressif/boards/adafruit_qtpy_esp32_pico/mpconfigboard.h +msgid "pressing BOOT button at start up.\n" +msgstr "zài qǐdòng shí àn BOOT ànniǔ.\n" + +#: ports/espressif/boards/adafruit_feather_esp32_v2/mpconfigboard.h +msgid "pressing SW38 button at start up.\n" +msgstr "zài qǐdòng shí àn SW38 ànniǔ.\n" + +#: ports/espressif/boards/hardkernel_odroid_go/mpconfigboard.h +msgid "pressing VOLUME button at start up.\n" +msgstr "zài qǐdòng shí àn SW38 ànniǔ.\n" + #: ports/espressif/boards/adafruit_qtpy_esp32c3/mpconfigboard.h +#: ports/espressif/boards/beetle-esp32-c3/mpconfigboard.h +#: ports/espressif/boards/espressif_esp32s2_devkitc_1_n8r2/mpconfigboard.h +#: ports/espressif/boards/lolin_c3_mini/mpconfigboard.h +#: ports/espressif/boards/microdev_micro_c3/mpconfigboard.h #: supervisor/shared/safe_mode.c msgid "pressing boot button at start up.\n" msgstr "Zài qǐdòng shí àn qǐdòng ànniǔ.\n" @@ -4186,14 +3892,6 @@ msgstr "qǐ dòng shí àn xià zuǒ àn niǔ\n" msgid "pull masks conflict with direction masks" msgstr "lā kǒu zhào yǔ fāng xiàng miàn mó chōng tū" -#: ports/raspberrypi/bindings/rp2pio/StateMachine.c -msgid "pull_threshold must be between 1 and 32" -msgstr "lā lì yù zhí bì xū jiè yú 1 hé 32 zhī jiān" - -#: ports/raspberrypi/bindings/rp2pio/StateMachine.c -msgid "push_threshold must be between 1 and 32" -msgstr "tuī sòng yù zhí bì xū jiè yú 1 hé 32 zhī jiān" - #: extmod/modutimeq.c msgid "queue overflow" msgstr "duìliè yìchū" @@ -4245,14 +3943,6 @@ msgstr "gǔn dòng cān shù bì xū shì ndarray" msgid "rsplit(None,n)" msgstr "Rchāifēn(wú,N)" -#: shared-bindings/audiocore/RawSample.c -msgid "" -"sample_source buffer must be a bytearray or array of type 'h', 'H', 'b' or " -"'B'" -msgstr "" -"yàngběn yuán_yuán huǎnchōng qū bìxū shì zì yǎnlèi huò lèixíng 'h', 'H', 'b' " -"huò 'B' de shùzǔ" - #: ports/atmel-samd/common-hal/audiobusio/PDMIn.c #: ports/raspberrypi/common-hal/audiobusio/PDMIn.c msgid "sampling rate out of range" @@ -4353,26 +4043,14 @@ msgstr "" msgid "source_bitmap must have value_count of 8" msgstr "yuán wèi tú (source_bitmap) de zhí de shù mù (value_count) bì xū shì 8" -#: shared-bindings/wifi/Radio.c -msgid "ssid can't be more than 32 bytes" -msgstr "ssid bù néng chāo guò 32 gè zì jié" - #: py/objstr.c msgid "start/end indices" msgstr "kāishǐ/jiéshù zhǐshù" -#: shared-bindings/displayio/Shape.c -msgid "start_x should be an int" -msgstr "kāishǐ_x yīnggāi shì yīgè zhěngshù" - #: shared-bindings/random/__init__.c msgid "step must be non-zero" msgstr "bùzhòu bìxū shìfēi líng" -#: shared-bindings/busio/UART.c -msgid "stop must be 1 or 2" -msgstr "tíngzhǐ bìxū wèi 1 huò 2" - #: shared-bindings/random/__init__.c msgid "stop not reachable from start" msgstr "tíngzhǐ wúfǎ cóng kāishǐ zhōng zhǎodào" @@ -4421,10 +4099,6 @@ msgstr "uctypes miáoshù fú zhōng de yǔfǎ cuòwù" msgid "threshold must be in the range 0-65536" msgstr "yùzhí bìxū zài fànwéi 0-65536" -#: shared-bindings/rgbmatrix/RGBMatrix.c -msgid "tile must be greater than zero" -msgstr "cí tiē bì xū dà yú líng" - #: shared-bindings/time/__init__.c msgid "time.struct_time() takes a 9-sequence" msgstr "time.struct_time() xūyào 9 xùliè" @@ -4444,10 +4118,6 @@ msgstr "Chāo shí shíjiān bìxū wèi 0.0 Dào 100.0 Miǎo" msgid "timeout must be < 655.35 secs" msgstr "chāo shí bì xū < 655.35 miǎo" -#: shared-bindings/_bleio/CharacteristicBuffer.c -msgid "timeout must be >= 0.0" -msgstr "chāoshí bìxū shì >= 0.0" - #: shared-module/sdcardio/SDCard.c msgid "timeout waiting for v1 card" msgstr "děngdài v1 kǎ chāoshí" @@ -4456,6 +4126,10 @@ msgstr "děngdài v1 kǎ chāoshí" msgid "timeout waiting for v2 card" msgstr "děngdài v2 kǎ chāoshí" +#: ports/stm/common-hal/pwmio/PWMOut.c +msgid "timer re-init" +msgstr "dìngshí qì chóngxīn chūshǐhuà" + #: shared-bindings/time/__init__.c msgid "timestamp out of range for platform time_t" msgstr "time_t shíjiān chuō chāochū píngtái fànwéi" @@ -4521,14 +4195,10 @@ msgstr "lèixíng '%q' bùshì kě jiēshòu de jīchǔ lèixíng" msgid "type is not an acceptable base type" msgstr "lèixíng bùshì kě jiēshòu de jīchǔ lèixíng" -#: py/runtime.c +#: py/objgenerator.c py/runtime.c msgid "type object '%q' has no attribute '%q'" msgstr "lèixíng duìxiàng '%q' méiyǒu shǔxìng '%q'" -#: py/objgenerator.c -msgid "type object 'generator' has no attribute '__await__'" -msgstr "lèi xíng duì xiàng 'generator' méi yǒu shǔ xìng '__await__'" - #: py/objtype.c msgid "type takes 1 or 3 arguments" msgstr "lèixíng wèi 1 huò 3 gè cānshù" @@ -4587,7 +4257,6 @@ msgid "unreadable attribute" msgstr "bùkě dú shǔxìng" #: shared-bindings/displayio/TileGrid.c shared-bindings/vectorio/VectorShape.c -#: shared-module/vectorio/Polygon.c shared-module/vectorio/VectorShape.c msgid "unsupported %q type" msgstr "bù zhīchí %q lèixíng" @@ -4626,6 +4295,14 @@ msgstr "bù zhīchí de cāozuò zhě lèixíng" msgid "unsupported types for %q: '%q', '%q'" msgstr "%q bù zhīchí de lèixíng: '%q', '%q'" +#: extmod/ulab/code/numpy/io/io.c +msgid "usecols is too high" +msgstr "Usecols tài gāo" + +#: extmod/ulab/code/numpy/io/io.c +msgid "usecols keyword must be specified" +msgstr "bìxū zhǐdìng usecols guānjiàn zì" + #: py/objint.c #, c-format msgid "value must fit in %d byte(s)" @@ -4647,20 +4324,19 @@ msgstr "wèi chū shǐ huà jiān shì qì" msgid "watchdog timeout must be greater than 0" msgstr "kān mén gǒu chāoshí bìxū dàyú 0" -#: shared-bindings/bitops/__init__.c -#, c-format -msgid "width must be from 2 to 8 (inclusive), not %d" -msgstr "kuān dù bì xū cóng 2 dào 8 ( hán ), ér bù shì %d" - #: shared-bindings/is31fl3741/FrameBuffer.c -#: shared-bindings/rgbmatrix/RGBMatrix.c msgid "width must be greater than zero" msgstr "kuāndù bìxū dàyú líng" #: ports/espressif/common-hal/wifi/Radio.c +#: ports/raspberrypi/common-hal/wifi/Radio.c msgid "wifi is not enabled" msgstr "wèi qǐ yòng WIFI" +#: ports/raspberrypi/common-hal/wifi/Monitor.c +msgid "wifi.Monitor not available" +msgstr "" + #: shared-bindings/_bleio/Adapter.c msgid "window must be <= interval" msgstr "Chuāngkǒu bìxū shì <= jiàngé" @@ -4673,7 +4349,17 @@ msgstr "cuò wù de zhóu suǒ yǐn" msgid "wrong axis specified" msgstr "zhǐ dìng de zhóu cuò wù" -#: extmod/ulab/code/numpy/compare.c extmod/ulab/code/numpy/vector.c +#: extmod/ulab/code/numpy/io/io.c +msgid "wrong dtype" +msgstr "cuòwù de shùjù lèixíng" + +#: extmod/ulab/code/numpy/transform.c +msgid "wrong index type" +msgstr "cuòwù de suǒyǐn lèixíng" + +#: extmod/ulab/code/numpy/compare.c extmod/ulab/code/numpy/create.c +#: extmod/ulab/code/numpy/io/io.c extmod/ulab/code/numpy/transform.c +#: extmod/ulab/code/numpy/vector.c msgid "wrong input type" msgstr "shūrù lèixíng cuòwù" @@ -4681,6 +4367,10 @@ msgstr "shūrù lèixíng cuòwù" msgid "wrong length of condition array" msgstr "tiáo jiàn shù zǔ de cháng dù cuò wù" +#: extmod/ulab/code/numpy/transform.c +msgid "wrong length of index array" +msgstr "suǒyǐn shùzǔ de chángdù cuòwù" + #: extmod/ulab/code/numpy/create.c py/objarray.c py/objstr.c msgid "wrong number of arguments" msgstr "cānshù shù cuòwù" @@ -4701,10 +4391,6 @@ msgstr "x zhí chāochū biānjiè" msgid "xTaskCreate failed" msgstr "xTaskCreate shī bài" -#: shared-bindings/displayio/Shape.c -msgid "y should be an int" -msgstr "y yīnggāi shì yīgè zhěngshù" - #: shared-module/displayio/Shape.c msgid "y value out of bounds" msgstr "y zhí chāochū biānjiè" @@ -4725,6 +4411,413 @@ msgstr "zi bìxū wèi fú diǎn xíng" msgid "zi must be of shape (n_section, 2)" msgstr "zi bìxū jùyǒu xíngzhuàng (n_section,2)" +#~ msgid "Stream missing readinto() or write() method." +#~ msgstr "Liú quēshǎo readinto() huò write() fāngfǎ." + +#~ msgid "%q must be >= 0" +#~ msgstr "%q bìxū > = 0" + +#~ msgid "%q must be >= 1" +#~ msgstr "%q bìxū >= 1" + +#~ msgid "address out of bounds" +#~ msgstr "dìzhǐ chāochū biānjiè" + +#~ msgid "destination_length must be an int >= 0" +#~ msgstr "mùbiāo chángdù bìxū shì > = 0 de zhěngshù" + +#~ msgid "type object 'generator' has no attribute '__await__'" +#~ msgstr "lèi xíng duì xiàng 'generator' méi yǒu shǔ xìng '__await__'" + +#~ msgid "color should be an int" +#~ msgstr "yánsè yīng wèi zhěngshù" + +#~ msgid "end_x should be an int" +#~ msgstr "jiéwěi_x yīnggāi shì yīgè zhěngshù" + +#~ msgid "palette_index should be an int" +#~ msgstr "yánsè suǒyǐn yīnggāi shì yīgè zhěngshù" + +#~ msgid "start_x should be an int" +#~ msgstr "kāishǐ_x yīnggāi shì yīgè zhěngshù" + +#~ msgid "y should be an int" +#~ msgstr "y yīnggāi shì yīgè zhěngshù" + +#~ msgid "" +#~ "sample_source buffer must be a bytearray or array of type 'h', 'H', 'b' " +#~ "or 'B'" +#~ msgstr "" +#~ "yàngběn yuán_yuán huǎnchōng qū bìxū shì zì yǎnlèi huò lèixíng 'h', 'H', " +#~ "'b' huò 'B' de shùzǔ" + +#~ msgid "Expected an alarm" +#~ msgstr "yù qī yǒu jǐng bào" + +#~ msgid "All I2C targets are in use" +#~ msgstr "suǒyǒu I2C mùbiāo dōu zài shǐyòng zhōng" + +#~ msgid "Failed to init wifi" +#~ msgstr "Wúfǎ chūshǐhuà wifi" + +#~ msgid "input must be a tensor of rank 2" +#~ msgstr "shū rù bì xū shì děng jí 2 de zhāng liàng" + +#~ msgid "maximum number of dimensions is 4" +#~ msgstr "zuì dà chǐ cùn shù wéi 4" + +#~ msgid "Watchdog timer expired." +#~ msgstr "Kān mén gǒu dìngshí qì yǐ guòqí." + +#~ msgid "ssid can't be more than 32 bytes" +#~ msgstr "ssid bù néng chāo guò 32 gè zì jié" + +#~ msgid "%q must be a tuple of length 2" +#~ msgstr "%q bìxū shì chángdù wèi 2 de yuánzǔ" + +#~ msgid "%q must be between %d and %d" +#~ msgstr "%q bì xū zài %d hé %d zhī jiān" + +#~ msgid "%q should be an int" +#~ msgstr "%q yīnggāi shì yīgè zhěngshù (int)" + +#~ msgid "(x,y) integers required" +#~ msgstr "xūyào zhěngshù (x,y)" + +#~ msgid "Address type out of range" +#~ msgstr "Dìzhǐ lèixíng chāochū fànwéi" + +#~ msgid "AnalogIn not supported on given pin" +#~ msgstr "gěidìng de yǐnjiǎo bù zhīchí AnalogIn" + +#~ msgid "AnalogOut functionality not supported" +#~ msgstr "Bù zhīchí AnalogOut gōngnéng" + +#~ msgid "AnalogOut is only 16 bits. Value must be less than 65536." +#~ msgstr "AnalogOut jǐn wèi 16 wèi. Zhí bìxū xiǎoyú 65536." + +#~ msgid "AnalogOut not supported on given pin" +#~ msgstr "zhǐdìng de yǐn jiǎo bù zhīchí AnalogOut" + +#, c-format +#~ msgid "Bit depth must be from 1 to 6 inclusive, not %d" +#~ msgstr "wèi shēndù bìxū shì 1 dào 6, ér búshì %d" + +#, c-format +#~ msgid "Buffer incorrect size. Should be %d bytes." +#~ msgstr "Huǎnchōng qū dàxiǎo bù zhèngquè. Yīnggāi shì %d zì jié." + +#~ msgid "Buffer must be at least length 1" +#~ msgstr "Huǎnchōng qū bìxū zhìshǎo chángdù wéi 1" + +#~ msgid "Bytes must be between 0 and 255." +#~ msgstr "Zìjié bìxū jiè yú 0 dào 255 zhījiān." + +#~ msgid "Cannot output both channels on the same pin" +#~ msgstr "Wúfǎ shūchū tóng yīgè yǐn jiǎo shàng de liǎng gè píndào" + +#~ msgid "Cannot read without MISO pin." +#~ msgstr "Wúfǎ dòu qǔ méiyǒu MISO de yǐn jiǎo." + +#~ msgid "Cannot reset into bootloader because no bootloader is present." +#~ msgstr "Wúfǎ chóng zhì wèi bootloader, yīnwèi méiyǒu bootloader cúnzài." + +#~ msgid "Cannot transfer without MOSI and MISO pins." +#~ msgstr "Méiyǒu MOSI/MISO jiù wúfǎ zhuǎnyí." + +#~ msgid "Cannot write without MOSI pin." +#~ msgstr "Wúfǎ xiě rù MOSI de yǐn jiǎo." + +#~ msgid "Clock pin init failed." +#~ msgstr "Shízhōng de yǐn jiǎo chūshǐhuà shībài." + +#~ msgid "Command must be an int between 0 and 255" +#~ msgstr "Mìnglìng bìxū shì 0 dào 255 zhī jiān de int" + +#~ msgid "Could not initialize Camera" +#~ msgstr "Wúfǎ chūshǐhuà xiàngjī" + +#~ msgid "Could not initialize GNSS" +#~ msgstr "wú fǎ chū shǐ huà GNSS" + +#~ msgid "Could not initialize SDCard" +#~ msgstr "wú fǎ chū shǐ huà SDCard" + +#~ msgid "Could not initialize UART" +#~ msgstr "Wúfǎ chūshǐhuà UART" + +#~ msgid "Could not re-init channel" +#~ msgstr "Wúfǎ chóngxīn chūshǐhuà píndào" + +#~ msgid "Could not re-init timer" +#~ msgstr "Wúfǎ chóngxīn qǐdòng jìshí qì" + +#~ msgid "Could not restart PWM" +#~ msgstr "Wúfǎ chóngqǐ PWM" + +#~ msgid "Couldn't allocate first buffer" +#~ msgstr "Wúfǎ fēnpèi dì yī gè huǎnchōng qū" + +#~ msgid "Couldn't allocate input buffer" +#~ msgstr "Wúfǎ fēnpèi shūrù huǎnchōng qū" + +#~ msgid "Couldn't allocate second buffer" +#~ msgstr "Wúfǎ fēnpèi dì èr gè huǎnchōng qū" + +#~ msgid "DigitalInOut not supported on given pin" +#~ msgstr "Gěi dìng de yǐn jiǎo bù zhīchí DigitalInOut" + +#, c-format +#~ msgid "Expected tuple of length %d, got %d" +#~ msgstr "Qīwàng de chángdù wèi %d de yuán zǔ, dédào %d" + +#~ msgid "Failed to allocate RX buffer" +#~ msgstr "Fēnpèi RX huǎnchōng shībài" + +#, c-format +#~ msgid "Failed to allocate RX buffer of %d bytes" +#~ msgstr "Fēnpèi RX huǎnchōng qū%d zì jié shībài" + +#, c-format +#~ msgid "Framebuffer requires %d bytes" +#~ msgstr "zhēn huǎn chōng qū xū yào %d zì jié" + +#~ msgid "Hostname must be between 1 and 253 characters" +#~ msgstr "zhǔ jī míng bì xū jiè yú 1 hé 253 gè zì fú zhī jiān" + +#~ msgid "I2C Init Error" +#~ msgstr "I2C chūshǐhuà cuòwù" + +#~ msgid "Invalid %q pin selection" +#~ msgstr "wú xiào %q yǐn jiǎo xuǎn zé" + +#~ msgid "Invalid AuthMode" +#~ msgstr "wú xiào AuthMode" + +#~ msgid "Invalid BMP file" +#~ msgstr "Wúxiào de BMP wénjiàn" + +#~ msgid "Invalid DAC pin supplied" +#~ msgstr "Tí gōng liǎo wúxiào de DAC yǐn jiǎo" + +#~ msgid "Invalid MIDI file" +#~ msgstr "wú xiào de MIDI wén jiàn" + +#~ msgid "Invalid PWM frequency" +#~ msgstr "Wúxiào de PWM pínlǜ" + +#~ msgid "Invalid Pin" +#~ msgstr "wú xiào yǐn jiǎo" + +#~ msgid "Invalid buffer size" +#~ msgstr "Wúxiào de huǎnchōng qū dàxiǎo" + +#~ msgid "Invalid byteorder string" +#~ msgstr "Wúxiào de zì jié shùnxù zìfú chuàn" + +#~ msgid "Invalid capture period. Valid range: 1 - 500" +#~ msgstr "Wúxiào de bǔhuò zhōuqí. Yǒuxiào fànwéi: 1-500" + +#~ msgid "Invalid channel count" +#~ msgstr "Wúxiào de tōngdào jìshù" + +#, c-format +#~ msgid "Invalid data_count %d" +#~ msgstr "wú xiào data_count %d" + +#~ msgid "Invalid direction." +#~ msgstr "Wúxiào de fāngxiàng." + +#~ msgid "Invalid file" +#~ msgstr "Wúxiào de wénjiàn" + +#~ msgid "Invalid mode" +#~ msgstr "wú xiào mó shì" + +#~ msgid "Invalid number of bits" +#~ msgstr "Wèi shù wúxiào" + +#~ msgid "Invalid phase" +#~ msgstr "Jiēduàn wúxiào" + +#~ msgid "Invalid pin" +#~ msgstr "Wúxiào de yǐn jiǎo" + +#~ msgid "Invalid pin for left channel" +#~ msgstr "Zuǒ tōngdào de yǐn jiǎo wúxiào" + +#~ msgid "Invalid pin for right channel" +#~ msgstr "Yòuxián tōngdào yǐn jiǎo wúxiào" + +#~ msgid "Invalid polarity" +#~ msgstr "Wúxiào liǎng jí zhí" + +#~ msgid "Invalid properties" +#~ msgstr "Wúxiào de shǔxìng" + +#~ msgid "Invalid run mode." +#~ msgstr "Wúxiào de yùnxíng móshì." + +#~ msgid "Invalid security_mode" +#~ msgstr "Ānquán móshì wúxiào" + +#~ msgid "Invalid voice" +#~ msgstr "Yǔyīn wúxiào" + +#~ msgid "Invalid voice count" +#~ msgstr "Wúxiào de yǔyīn jìshù" + +#~ msgid "Invalid wave file" +#~ msgstr "Wúxiào de làng làngcháo wénjiàn" + +#~ msgid "Invalid word/bit length" +#~ msgstr "Wúxiào de zì/wèi chángdù" + +#~ msgid "Layer already in a group." +#~ msgstr "Tú céng yǐjīng zài yīgè zǔ zhōng." + +#~ msgid "Layer must be a Group or TileGrid subclass." +#~ msgstr "Layer bìxū shì Group huò TileGrid zi lèi." + +#~ msgid "MISO pin init failed." +#~ msgstr "MISO yǐn jiǎo chūshǐhuà shībài." + +#~ msgid "MOSI pin init failed." +#~ msgstr "MOSI yǐn jiǎo shūrù shībài." + +#~ msgid "Messages limited to 8 bytes" +#~ msgstr "Yóujiàn xiànzhì wèi 8 gè zì jié" + +#, c-format +#~ msgid "More than %d report ids not supported" +#~ msgstr "chāo guò %d bào gào bù zhī chí de ID" + +#~ msgid "No hardware support on clk pin" +#~ msgstr "Shízhōng yǐn jiǎo wú yìngjiàn zhīchí" + +#~ msgid "No hardware support on pin" +#~ msgstr "Méiyǒu zài yǐn jiǎo shàng de yìngjiàn zhīchí" + +#, c-format +#~ msgid "Output buffer must be at least %d bytes" +#~ msgstr "shū chū huǎn chōng qū bì xū zhì shǎo wéi %d zì jié" + +#~ msgid "" +#~ "PWM duty_cycle must be between 0 and 65535 inclusive (16 bit resolution)" +#~ msgstr "" +#~ "PWM yìwù zhōuqí bìxū jiè yú 0 zhì 65535 de bāoróng xìng (16 wèi fēnbiàn " +#~ "lǜ)" + +#~ msgid "Pin count must be at least 1" +#~ msgstr "yǐn jiǎo jì shù bì xū zhì shǎo wéi 1" + +#~ msgid "Pin does not have ADC capabilities" +#~ msgstr "Pin méiyǒu ADC nénglì" + +#~ msgid "Program must contain at least one 16-bit instruction." +#~ msgstr "chéng xù bì xū zhì shǎo bāo hán yí gè 16 wèi zhǐ lìng ." + +#~ msgid "Program too large" +#~ msgstr "chéng xù tài dà" + +#~ msgid "RS485 Not yet supported on this device" +#~ msgstr "RS485 cǐ shè bèi shàng bù zhī chí" + +#~ msgid "RTC calibration is not supported on this board" +#~ msgstr "Cǐ bǎn bù zhīchí RTC jiàozhǔn" + +#~ msgid "RTS/CTS/RS485 Not yet supported on this device" +#~ msgstr "RTS/CTS/RS485 gāi shèbèi shàng bù zhīchí" + +#~ msgid "SPI Init Error" +#~ msgstr "SPI chūshǐhuà cuòwù" + +#~ msgid "SPI Re-initialization error" +#~ msgstr "SPI chóngxīn chūshǐhuà cuòwù" + +#~ msgid "Sample rate must be positive" +#~ msgstr "Cǎiyàng lǜ bìxū wèi zhèng shù" + +#, c-format +#~ msgid "Sample rate too high. It must be less than %d" +#~ msgstr "Cǎiyàng lǜ tài gāo. Tā bìxū xiǎoyú %d" + +#~ msgid "Set pin count must be between 1 and 5" +#~ msgstr "shè zhì yǐn jiǎo shù bì xū jiè yú 1 hé 5 zhī jiān" + +#~ msgid "Side set pin count must be between 1 and 5" +#~ msgstr "cè miàn shè zhì yǐn jiǎo shù bì xū jiè yú 1 hé 5 zhī jiān" + +#~ msgid "Stack size must be at least 256" +#~ msgstr "Duīzhàn dàxiǎo bìxū zhìshǎo 256" + +#~ msgid "Tile value out of bounds" +#~ msgstr "Píng pū zhí chāochū fànwéi" + +#~ msgid "UART Buffer allocation error" +#~ msgstr "UART huǎnchōng qū fēnpèi cuòwù" + +#~ msgid "UART De-init error" +#~ msgstr "UART qǔxiāo chūshǐhuà cuòwù" + +#~ msgid "UART Init Error" +#~ msgstr "UART chūshǐhuà cuòwù" + +#~ msgid "UART Re-init error" +#~ msgstr "UART chóngxīn chūshǐhuà cuòwù" + +#~ msgid "UART write error" +#~ msgstr "UART xiě cuòwù" + +#~ msgid "Unsupported baudrate" +#~ msgstr "Bù zhīchí de baudrate" + +#~ msgid "WiFi password must be between 8 and 63 characters" +#~ msgstr "WiFi mìmǎ bìxū jiè yú 8 dào 63 gè zìfú zhī jiān" + +#~ msgid "bits must be in range 5 to 9" +#~ msgstr "wèi bì xū zài fàn wéi nèi 5 zhì 9" + +#~ msgid "bytes > 8 bits not supported" +#~ msgstr "zì jié > 8 wèi" + +#~ msgid "calibration value out of range +/-127" +#~ msgstr "jiàozhǔn zhí chāochū fànwéi +/-127" + +#~ msgid "can only be registered in one parent" +#~ msgstr "zhǐ néng zài yí gè jiā zhǎng zhōng zhù cè" + +#~ msgid "circle can only be registered in one parent" +#~ msgstr "quānzi zhǐ néng zài yī wèi jiāzhǎng zhōng zhùcè" + +#~ msgid "max_connections must be between 0 and 10" +#~ msgstr "max_connections bì xū jiè yú 0 hé 10 zhī jiān" + +#~ msgid "max_length must be >= 0" +#~ msgstr "zuì dà cháng dù bì xū >= 0" + +#~ msgid "polygon can only be registered in one parent" +#~ msgstr "duōbiānxíng zhī néng zài yīgè fù jí zhōng zhùcè" + +#~ msgid "pull_threshold must be between 1 and 32" +#~ msgstr "lā lì yù zhí bì xū jiè yú 1 hé 32 zhī jiān" + +#~ msgid "push_threshold must be between 1 and 32" +#~ msgstr "tuī sòng yù zhí bì xū jiè yú 1 hé 32 zhī jiān" + +#~ msgid "stop must be 1 or 2" +#~ msgstr "tíngzhǐ bìxū wèi 1 huò 2" + +#~ msgid "tile must be greater than zero" +#~ msgstr "cí tiē bì xū dà yú líng" + +#~ msgid "timeout must be >= 0.0" +#~ msgstr "chāoshí bìxū shì >= 0.0" + +#, c-format +#~ msgid "width must be from 2 to 8 (inclusive), not %d" +#~ msgstr "kuān dù bì xū cóng 2 dào 8 ( hán ), ér bù shì %d" + #~ msgid "Unsupported operation" #~ msgstr "Bù zhīchí de cāozuò" @@ -5037,12 +5130,6 @@ msgstr "zi bìxū jùyǒu xíngzhuàng (n_section,2)" #~ msgid "can only save bytecode" #~ msgstr "zhǐ néng bǎocún zì jié mǎ jìlù" -#~ msgid "invalid cert" -#~ msgstr "zhèngshū wúxiào" - -#~ msgid "invalid key" -#~ msgstr "wúxiào de mì yào" - #~ msgid "Viper functions don't currently support more than 4 arguments" #~ msgstr "Viper hánshù mùqián bù zhīchí chāoguò 4 gè cānshù" @@ -5243,9 +5330,6 @@ msgstr "zi bìxū jùyǒu xíngzhuàng (n_section,2)" #~ msgid "wrong argument type" #~ msgstr "cuòwù de cānshù lèixíng" -#~ msgid "wrong index type" -#~ msgstr "cuòwù de suǒyǐn lèixíng" - #~ msgid "Must provide SCK pin" #~ msgstr "bì xū tí gòng SCK yǐn jiǎo" diff --git a/main.c b/main.c index 17fe8167f2..06ca1ba93b 100644 --- a/main.c +++ b/main.c @@ -58,7 +58,7 @@ #include "supervisor/shared/status_leds.h" #include "supervisor/shared/tick.h" #include "supervisor/shared/traceback.h" -#include "supervisor/shared/translate.h" +#include "supervisor/shared/translate/translate.h" #include "supervisor/shared/workflow.h" #include "supervisor/usb.h" #include "supervisor/workflow.h" @@ -101,6 +101,14 @@ #include "shared-module/memorymonitor/__init__.h" #endif +#if CIRCUITPY_SOCKETPOOL +#include "shared-bindings/socketpool/__init__.h" +#endif + +#if CIRCUITPY_STATUS_BAR +#include "supervisor/shared/status_bar.h" +#endif + #if CIRCUITPY_USB_HID #include "shared-module/usb_hid/__init__.h" #endif @@ -199,6 +207,25 @@ STATIC void stop_mp(void) { gc_deinit(); } +STATIC const char *_current_executing_filename = NULL; + +STATIC pyexec_result_t _exec_result = {0, MP_OBJ_NULL, 0}; + +#if CIRCUITPY_STATUS_BAR +void supervisor_execution_status(void) { + mp_obj_exception_t *exception = MP_OBJ_TO_PTR(_exec_result.exception); + if (_current_executing_filename != NULL) { + serial_write(_current_executing_filename); + } else if ((_exec_result.return_code & PYEXEC_EXCEPTION) != 0 && + _exec_result.exception_line > 0 && + exception != NULL) { + mp_printf(&mp_plat_print, "%d@%s %q", _exec_result.exception_line, _exec_result.exception_filename, exception->base.type->name); + } else { + serial_write_compressed(translate("Done")); + } +} +#endif + #define STRING_LIST(...) {__VA_ARGS__, ""} // Look for the first file that exists in the list of filenames, using mp_import_stat(). @@ -213,17 +240,33 @@ STATIC const char *first_existing_file_in_list(const char *const *filenames) { return NULL; } -STATIC bool maybe_run_list(const char *const *filenames, pyexec_result_t *exec_result) { - const char *filename = first_existing_file_in_list(filenames); - if (filename == NULL) { +STATIC bool maybe_run_list(const char *const *filenames) { + _exec_result.return_code = 0; + _exec_result.exception = MP_OBJ_NULL; + _exec_result.exception_line = 0; + _current_executing_filename = first_existing_file_in_list(filenames); + if (_current_executing_filename == NULL) { return false; } - mp_hal_stdout_tx_str(filename); + mp_hal_stdout_tx_str(_current_executing_filename); serial_write_compressed(translate(" output:\n")); - pyexec_file(filename, exec_result); - #if CIRCUITPY_ATEXIT - shared_module_atexit_execute(exec_result); + + #if CIRCUITPY_STATUS_BAR + supervisor_status_bar_update(); #endif + + pyexec_file(_current_executing_filename, &_exec_result); + + #if CIRCUITPY_ATEXIT + shared_module_atexit_execute(&_exec_result); + #endif + + _current_executing_filename = NULL; + + #if CIRCUITPY_STATUS_BAR + supervisor_status_bar_update(); + #endif + return true; } @@ -290,6 +333,16 @@ STATIC void cleanup_after_vm(supervisor_allocation *heap, mp_obj_t exception) { keypad_reset(); #endif + // Close user-initiated sockets. + #if CIRCUITPY_SOCKETPOOL + socketpool_user_reset(); + #endif + + // Turn off user initiated WiFi connections. + #if CIRCUITPY_WIFI + wifi_user_reset(); + #endif + // reset_board_buses() first because it may release pins from the never_reset state, so that // reset_port() can reset them. #if CIRCUITPY_BOARD @@ -303,6 +356,9 @@ STATIC void cleanup_after_vm(supervisor_allocation *heap, mp_obj_t exception) { stop_mp(); free_memory(heap); supervisor_move_memory(); + + // Let the workflows know we've reset in case they want to restart. + supervisor_workflow_reset(); } STATIC void print_code_py_status_message(safe_mode_t safe_mode) { @@ -329,12 +385,6 @@ STATIC bool run_code_py(safe_mode_t safe_mode, bool first_run, bool *simulate_re } #endif - pyexec_result_t result; - - result.return_code = 0; - result.exception = MP_OBJ_NULL; - result.exception_line = 0; - bool skip_repl = false; bool skip_wait = false; bool found_main = false; @@ -373,7 +423,7 @@ STATIC bool run_code_py(safe_mode_t safe_mode, bool first_run, bool *simulate_re if (((next_code_info_t *)next_code_allocation->ptr)->filename[0] != '\0') { const char *next_list[] = {((next_code_info_t *)next_code_allocation->ptr)->filename, ""}; // This is where the user's python code is actually executed: - found_main = maybe_run_list(next_list, &result); + found_main = maybe_run_list(next_list); if (!found_main) { serial_write(((next_code_info_t *)next_code_allocation->ptr)->filename); serial_write_compressed(translate(" not found.\n")); @@ -383,11 +433,11 @@ STATIC bool run_code_py(safe_mode_t safe_mode, bool first_run, bool *simulate_re // Otherwise, default to the standard list of filenames if (!found_main) { // This is where the user's python code is actually executed: - found_main = maybe_run_list(supported_filenames, &result); + found_main = maybe_run_list(supported_filenames); // If that didn't work, double check the extensions #if CIRCUITPY_FULL_BUILD if (!found_main) { - found_main = maybe_run_list(double_extension_filenames, &result); + found_main = maybe_run_list(double_extension_filenames); if (found_main) { serial_write_compressed(translate("WARNING: Your code filename has two extensions\n")); } @@ -399,7 +449,7 @@ STATIC bool run_code_py(safe_mode_t safe_mode, bool first_run, bool *simulate_re // Print done before resetting everything so that we get the message over // BLE before it is reset and we have a delay before reconnect. - if ((result.return_code & PYEXEC_RELOAD) && supervisor_get_run_reason() == RUN_REASON_AUTO_RELOAD) { + if ((_exec_result.return_code & PYEXEC_RELOAD) && supervisor_get_run_reason() == RUN_REASON_AUTO_RELOAD) { serial_write_compressed(translate("\nCode stopped by auto-reload. Reloading soon.\n")); } else { serial_write_compressed(translate("\nCode done running.\n")); @@ -407,7 +457,8 @@ STATIC bool run_code_py(safe_mode_t safe_mode, bool first_run, bool *simulate_re // Finished executing python code. Cleanup includes filesystem flush and a board reset. - cleanup_after_vm(heap, result.exception); + cleanup_after_vm(heap, _exec_result.exception); + _exec_result.exception = NULL; // If a new next code file was set, that is a reason to keep it (obviously). Stuff this into // the options because it can be treated like any other reason-for-stickiness bit. The @@ -418,7 +469,7 @@ STATIC bool run_code_py(safe_mode_t safe_mode, bool first_run, bool *simulate_re next_code_options |= SUPERVISOR_NEXT_CODE_OPT_NEWLY_SET; } - if (result.return_code & PYEXEC_RELOAD) { + if (_exec_result.return_code & PYEXEC_RELOAD) { next_code_stickiness_situation |= SUPERVISOR_NEXT_CODE_OPT_STICKY_ON_RELOAD; // Reload immediately unless the reload is due to autoreload. In that // case, we wait below to see if any other writes occur. @@ -426,7 +477,7 @@ STATIC bool run_code_py(safe_mode_t safe_mode, bool first_run, bool *simulate_re skip_repl = true; skip_wait = true; } - } else if (result.return_code == 0) { + } else if (_exec_result.return_code == 0) { next_code_stickiness_situation |= SUPERVISOR_NEXT_CODE_OPT_STICKY_ON_SUCCESS; if (next_code_options & SUPERVISOR_NEXT_CODE_OPT_RELOAD_ON_SUCCESS) { skip_repl = true; @@ -437,12 +488,12 @@ STATIC bool run_code_py(safe_mode_t safe_mode, bool first_run, bool *simulate_re // Deep sleep cannot be skipped // TODO: settings in deep sleep should persist, using a new sleep memory API if (next_code_options & SUPERVISOR_NEXT_CODE_OPT_RELOAD_ON_ERROR - && !(result.return_code & PYEXEC_DEEP_SLEEP)) { + && !(_exec_result.return_code & PYEXEC_DEEP_SLEEP)) { skip_repl = true; skip_wait = true; } } - if (result.return_code & PYEXEC_FORCED_EXIT) { + if (_exec_result.return_code & PYEXEC_FORCED_EXIT) { skip_repl = false; skip_wait = true; } @@ -460,12 +511,12 @@ STATIC bool run_code_py(safe_mode_t safe_mode, bool first_run, bool *simulate_re uint8_t blink_count; bool led_active = false; #if CIRCUITPY_ALARM - if (result.return_code & PYEXEC_DEEP_SLEEP) { + if (_exec_result.return_code & PYEXEC_DEEP_SLEEP) { color = BLACK; blink_count = 0; } else #endif - if (result.return_code != PYEXEC_EXCEPTION) { + if (_exec_result.return_code != PYEXEC_EXCEPTION) { if (safe_mode == NO_SAFE_MODE) { color = ALL_DONE; blink_count = ALL_DONE_BLINKS; @@ -508,7 +559,7 @@ STATIC bool run_code_py(safe_mode_t safe_mode, bool first_run, bool *simulate_re } // If interrupted by keyboard, return - if (serial_connected() && serial_bytes_available()) { + if (serial_connected() && serial_bytes_available() && !autoreload_pending()) { // Skip REPL if reload was requested. skip_repl = serial_read() == CHAR_CTRL_D; if (skip_repl) { @@ -550,7 +601,7 @@ STATIC bool run_code_py(safe_mode_t safe_mode, bool first_run, bool *simulate_re // Sleep until our next interrupt. #if CIRCUITPY_ALARM - if (result.return_code & PYEXEC_DEEP_SLEEP) { + if (_exec_result.return_code & PYEXEC_DEEP_SLEEP) { const bool awoke_from_true_deep_sleep = common_hal_mcu_processor_get_reset_reason() == RESET_REASON_DEEP_SLEEP_ALARM; @@ -570,6 +621,9 @@ STATIC bool run_code_py(safe_mode_t safe_mode, bool first_run, bool *simulate_re else if (awoke_from_true_deep_sleep || port_get_raw_ticks(NULL) > CIRCUITPY_WORKFLOW_CONNECTION_SLEEP_DELAY * 1024) { // OK to start sleeping, real or fake. + #if CIRCUITPY_DISPLAYIO + common_hal_displayio_release_displays(); + #endif status_led_deinit(); deinit_rxtx_leds(); board_deinit(); @@ -684,6 +738,10 @@ STATIC bool run_code_py(safe_mode_t safe_mode, bool first_run, bool *simulate_re vstr_t *boot_output; STATIC void __attribute__ ((noinline)) run_boot_py(safe_mode_t safe_mode) { + if (safe_mode == NO_HEAP) { + return; + } + // If not in safe mode, run boot before initing USB and capture output in a file. // There is USB setup to do even if boot.py is not actually run. @@ -705,10 +763,12 @@ STATIC void __attribute__ ((noinline)) run_boot_py(safe_mode_t safe_mode) { usb_set_defaults(); #endif - pyexec_result_t result = {0, MP_OBJ_NULL, 0}; - if (ok_to_run) { #ifdef CIRCUITPY_BOOT_OUTPUT_FILE + #if CIRCUITPY_STATUS_BAR + // Turn off status bar updates when writing out to boot_out.txt. + supervisor_status_bar_suspend(); + #endif vstr_t boot_text; vstr_init(&boot_text, 512); boot_output = &boot_text; @@ -716,8 +776,18 @@ STATIC void __attribute__ ((noinline)) run_boot_py(safe_mode_t safe_mode) { // Write version info mp_printf(&mp_plat_print, "%s\nBoard ID:%s\n", MICROPY_FULL_VERSION_INFO, CIRCUITPY_BOARD_ID); + #if CIRCUITPY_MICROCONTROLLER && COMMON_HAL_MCU_PROCESSOR_UID_LENGTH > 0 + uint8_t raw_id[COMMON_HAL_MCU_PROCESSOR_UID_LENGTH]; + common_hal_mcu_processor_get_uid(raw_id); + mp_cprintf(&mp_plat_print, translate("UID:")); + for (size_t i = 0; i < COMMON_HAL_MCU_PROCESSOR_UID_LENGTH; i++) { + mp_cprintf(&mp_plat_print, translate("%02X"), raw_id[i]); + } + mp_printf(&mp_plat_print, "\n"); + port_boot_info(); + #endif - bool found_boot = maybe_run_list(boot_py_filenames, &result); + bool found_boot = maybe_run_list(boot_py_filenames); (void)found_boot; @@ -727,6 +797,9 @@ STATIC void __attribute__ ((noinline)) run_boot_py(safe_mode_t safe_mode) { FATFS *fs = &vfs->fatfs; boot_output = NULL; + #if CIRCUITPY_STATUS_BAR + supervisor_status_bar_resume(); + #endif bool write_boot_output = true; FIL boot_output_file; if (f_open(fs, &boot_output_file, CIRCUITPY_BOOT_OUTPUT_FILE, FA_READ) == FR_OK) { @@ -767,7 +840,12 @@ STATIC void __attribute__ ((noinline)) run_boot_py(safe_mode_t safe_mode) { usb_get_boot_py_data(usb_boot_py_data, size); #endif - cleanup_after_vm(heap, result.exception); + port_post_boot_py(true); + + cleanup_after_vm(heap, _exec_result.exception); + _exec_result.exception = NULL; + + port_post_boot_py(false); #if CIRCUITPY_USB // Now give back the data we saved from the heap going away. @@ -798,9 +876,23 @@ STATIC int run_repl(bool first_run) { status_led_deinit(); #endif if (pyexec_mode_kind == PYEXEC_MODE_RAW_REPL) { + #if CIRCUITPY_STATUS_BAR + supervisor_status_bar_suspend(); + #endif exit_code = pyexec_raw_repl(); + #if CIRCUITPY_STATUS_BAR + supervisor_status_bar_resume(); + #endif } else { + _current_executing_filename = "REPL"; + #if CIRCUITPY_STATUS_BAR + supervisor_status_bar_update(); + #endif exit_code = pyexec_friendly_repl(); + _current_executing_filename = NULL; + #if CIRCUITPY_STATUS_BAR + supervisor_status_bar_update(); + #endif } #if CIRCUITPY_ATEXIT pyexec_result_t result; @@ -810,6 +902,13 @@ STATIC int run_repl(bool first_run) { } #endif cleanup_after_vm(heap, MP_OBJ_SENTINEL); + + // Also reset bleio. The above call omits it in case workflows should continue. In this case, + // we're switching straight to another VM so we want to reset. + #if CIRCUITPY_BLEIO + bleio_reset(); + #endif + #if CIRCUITPY_STATUS_LED status_led_init(); new_status_color(BLACK); @@ -841,6 +940,10 @@ int __attribute__((used)) main(void) { stack_init(); + #if CIRCUITPY_STATUS_BAR + supervisor_status_bar_init(); + #endif + #if CIRCUITPY_BLEIO // Early init so that a reset press can cause BLE public advertising. supervisor_bluetooth_init(); @@ -865,15 +968,15 @@ int __attribute__((used)) main(void) { safe_mode = NO_CIRCUITPY; } - // displays init after filesystem, since they could share the flash SPI - board_init(); - // Reset everything and prep MicroPython to run boot.py. reset_port(); // Port-independent devices, like CIRCUITPY_BLEIO_HCI. reset_devices(); reset_board(); + // displays init after filesystem, since they could share the flash SPI + board_init(); + // This is first time we are running CircuitPython after a reset or power-up. supervisor_set_run_reason(RUN_REASON_STARTUP); @@ -889,20 +992,10 @@ int __attribute__((used)) main(void) { run_boot_py(safe_mode); - // Start USB after giving boot.py a chance to tweak behavior. - #if CIRCUITPY_USB - // Setup USB connection after heap is available. - // It needs the heap to build descriptors. - usb_init(); - #endif + supervisor_workflow_start(); - // Set up any other serial connection. - serial_init(); - - #if CIRCUITPY_BLEIO - bleio_reset(); - supervisor_bluetooth_enable_workflow(); - supervisor_start_bluetooth(); + #if CIRCUITPY_STATUS_BAR + supervisor_status_bar_request_update(true); #endif // Boot script is finished, so now go into REPL or run code.py. diff --git a/mpy-cross/Makefile b/mpy-cross/Makefile index 6e4d7ef316..4858cb25c7 100644 --- a/mpy-cross/Makefile +++ b/mpy-cross/Makefile @@ -20,3 +20,5 @@ override undefine PROG endif include mpy-cross.mk +CFLAGS += -g +STRIP = : diff --git a/mpy-cross/Makefile.m1 b/mpy-cross/Makefile.m1 index 34e9841540..13431f708b 100644 --- a/mpy-cross/Makefile.m1 +++ b/mpy-cross/Makefile.m1 @@ -7,4 +7,4 @@ BUILD=build-arm64 include mpy-cross.mk # Because mpy-cross.mk unconditionally overwrites CC for Darwin, we must set it BELOW the inclusion -CC := $(shell xcrun --sdk macosx11.1 --find clang) -isysroot $(shell xcrun --sdk macosx11.1 --show-sdk-path) -target arm64-apple-macos11 +CC := $(shell xcrun --find clang) -isysroot $(shell xcrun --show-sdk-path) -target arm64-apple-macos11 diff --git a/mpy-cross/mpy-cross.mk b/mpy-cross/mpy-cross.mk index 825566efec..452e2f3c1f 100644 --- a/mpy-cross/mpy-cross.mk +++ b/mpy-cross/mpy-cross.mk @@ -67,7 +67,7 @@ SRC_C += \ shared/runtime/gchelper_generic.c \ supervisor/stub/safe_mode.c \ supervisor/stub/stack.c \ - supervisor/shared/translate.c + supervisor/shared/translate/translate.c # Add fmode when compiling with mingw gcc COMPILER_TARGET := $(shell $(CC) -dumpmachine) @@ -78,6 +78,6 @@ endif OBJ = $(PY_CORE_O) OBJ += $(addprefix $(BUILD)/, $(SRC_C:.c=.o)) -$(BUILD)/supervisor/shared/translate.o: $(HEADER_BUILD)/qstrdefs.generated.h +$(BUILD)/supervisor/shared/translate/translate.o: $(HEADER_BUILD)/qstrdefs.generated.h $(HEADER_BUILD)/compression.generated.h include $(TOP)/py/mkrules.mk diff --git a/ports/atmel-samd/.gitignore b/ports/atmel-samd/.gitignore deleted file mode 100644 index 414487d53e..0000000000 --- a/ports/atmel-samd/.gitignore +++ /dev/null @@ -1 +0,0 @@ -build-*/ diff --git a/ports/atmel-samd/Makefile b/ports/atmel-samd/Makefile index 53ba302376..4405766d00 100644 --- a/ports/atmel-samd/Makefile +++ b/ports/atmel-samd/Makefile @@ -123,8 +123,6 @@ $(echo PERIPHERALS_CHIP_FAMILY=$(PERIPHERALS_CHIP_FAMILY)) #Debugging/Optimization ifeq ($(DEBUG), 1) CFLAGS += -ggdb3 -Og -Os - # You may want to disable -flto if it interferes with debugging. - CFLAGS += -flto -flto-partition=none # You may want to enable these flags to make setting breakpoints easier. # CFLAGS += -fno-inline -fno-ipa-sra ifeq ($(CHIP_FAMILY), samd21) @@ -147,8 +145,6 @@ else CFLAGS += -finline-limit=$(CFLAGS_INLINE_LIMIT) endif - CFLAGS += -flto -flto-partition=none - ifeq ($(CIRCUITPY_FULL_BUILD),0) CFLAGS += --param inline-unit-growth=15 --param max-inline-insns-auto=20 endif @@ -168,6 +164,9 @@ CFLAGS += \ -msoft-float \ -mfloat-abi=soft \ -DSAMD21 +LIBS := libs/libgcc-12.1.0-Os-v6-m-nofp.a -lc +else +LIBS := -lgcc -lc endif ifeq ($(CHIP_FAMILY), samd51) CFLAGS += \ @@ -204,8 +203,6 @@ endif CFLAGS += -Wno-stringop-overread -Wno-stringop-overflow LDFLAGS = $(CFLAGS) -nostartfiles -Wl,-nostdlib -Wl,-T,$(GENERATED_LD_FILE) -Wl,-Map=$@.map -Wl,-cref -Wl,-gc-sections -specs=nano.specs -LDFLAGS += -flto=$(shell $(NPROC)) -LIBS := -lgcc -lc # Use toolchain libm if we're not using our own. ifndef INTERNAL_LIBM @@ -275,6 +272,9 @@ SRC_ASF += \ hpl/oscctrl/hpl_oscctrl.c \ hpl/trng/hpl_trng.c \ +# Ignore these errors +$(BUILD)/asf4/same54/hpl/sercom/hpl_sercom.o: CFLAGS += -Wno-maybe-uninitialized + else ifeq ($(CHIP_FAMILY), same51) SRC_ASF += \ hal/src/hal_rand_sync.c \ diff --git a/ports/atmel-samd/bindings/samd/Clock.c b/ports/atmel-samd/bindings/samd/Clock.c index 7c405d464d..00c1959ccf 100644 --- a/ports/atmel-samd/bindings/samd/Clock.c +++ b/ports/atmel-samd/bindings/samd/Clock.c @@ -33,8 +33,8 @@ //| class Clock: //| """Identifies a clock on the microcontroller. //| -//| They are fixed by the hardware so they cannot be constructed on demand. Instead, use -//| ``samd.clock`` to reference the desired clock.""" +//| They are fixed by the hardware so they cannot be constructed on demand. Instead, use +//| ``samd.clock`` to reference the desired clock.""" //| STATIC void samd_clock_print(const mp_print_t *print, mp_obj_t self_in, mp_print_kind_t kind) { @@ -45,7 +45,6 @@ STATIC void samd_clock_print(const mp_print_t *print, mp_obj_t self_in, mp_print //| enabled: bool //| """Is the clock enabled? (read-only)""" -//| STATIC mp_obj_t samd_clock_get_enabled(mp_obj_t self_in) { samd_clock_obj_t *self = MP_OBJ_TO_PTR(self_in); return mp_obj_new_bool(clock_get_enabled(self->type, self->index)); @@ -58,7 +57,6 @@ MP_PROPERTY_GETTER(samd_clock_enabled_obj, //| parent: Union[Clock, None] //| """Clock parent. (read-only)""" -//| STATIC mp_obj_t samd_clock_get_parent(mp_obj_t self_in) { samd_clock_obj_t *self = MP_OBJ_TO_PTR(self_in); uint8_t p_type, p_index; @@ -83,7 +81,6 @@ MP_PROPERTY_GETTER(samd_clock_parent_obj, //| frequency: int //| """Clock frequency in Herz. (read-only)""" -//| STATIC mp_obj_t samd_clock_get_frequency(mp_obj_t self_in) { samd_clock_obj_t *self = MP_OBJ_TO_PTR(self_in); return mp_obj_new_int_from_uint(clock_get_frequency(self->type, self->index)); diff --git a/ports/atmel-samd/bindings/samd/__init__.c b/ports/atmel-samd/bindings/samd/__init__.c index b5c618108d..29d12357d1 100644 --- a/ports/atmel-samd/bindings/samd/__init__.c +++ b/ports/atmel-samd/bindings/samd/__init__.c @@ -40,7 +40,6 @@ //| :platform: SAMD21 //| //| References to clocks as named by the microcontroller""" -//| const mp_obj_module_t samd_clock_module = { .base = { &mp_type_module }, .globals = (mp_obj_dict_t *)&samd_clock_globals, diff --git a/ports/atmel-samd/boards/8086_commander/board.c b/ports/atmel-samd/boards/8086_commander/board.c index 9f91617a17..fb1ce4fb83 100644 --- a/ports/atmel-samd/boards/8086_commander/board.c +++ b/ports/atmel-samd/boards/8086_commander/board.c @@ -26,15 +26,4 @@ #include "supervisor/board.h" -void board_init(void) { -} - -bool board_requests_safe_mode(void) { - return false; -} - -void reset_board(void) { -} - -void board_deinit(void) { -} +// Use the MP_WEAK supervisor/shared/board.c versions of routines not defined here. diff --git a/ports/atmel-samd/boards/adafruit_neokey_trinkey_m0/board.c b/ports/atmel-samd/boards/adafruit_neokey_trinkey_m0/board.c index ba0cf06ebc..fb1ce4fb83 100644 --- a/ports/atmel-samd/boards/adafruit_neokey_trinkey_m0/board.c +++ b/ports/atmel-samd/boards/adafruit_neokey_trinkey_m0/board.c @@ -25,19 +25,5 @@ */ #include "supervisor/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) { -} - -void board_deinit(void) { -} +// Use the MP_WEAK supervisor/shared/board.c versions of routines not defined here. diff --git a/ports/atmel-samd/boards/adafruit_proxlight_trinkey_m0/board.c b/ports/atmel-samd/boards/adafruit_proxlight_trinkey_m0/board.c index 8804c3c324..e0f8bda171 100644 --- a/ports/atmel-samd/boards/adafruit_proxlight_trinkey_m0/board.c +++ b/ports/atmel-samd/boards/adafruit_proxlight_trinkey_m0/board.c @@ -27,18 +27,9 @@ #include "supervisor/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) { board_reset_user_neopixels(&pin_PA15, 2); } -void board_deinit(void) { -} +// Use the MP_WEAK supervisor/shared/board.c versions of routines not defined here. diff --git a/ports/atmel-samd/boards/adafruit_rotary_trinkey_m0/board.c b/ports/atmel-samd/boards/adafruit_rotary_trinkey_m0/board.c index ba0cf06ebc..fb1ce4fb83 100644 --- a/ports/atmel-samd/boards/adafruit_rotary_trinkey_m0/board.c +++ b/ports/atmel-samd/boards/adafruit_rotary_trinkey_m0/board.c @@ -25,19 +25,5 @@ */ #include "supervisor/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) { -} - -void board_deinit(void) { -} +// Use the MP_WEAK supervisor/shared/board.c versions of routines not defined here. diff --git a/ports/atmel-samd/boards/adafruit_slide_trinkey_m0/board.c b/ports/atmel-samd/boards/adafruit_slide_trinkey_m0/board.c index 0c829a4a55..0d885160e9 100644 --- a/ports/atmel-samd/boards/adafruit_slide_trinkey_m0/board.c +++ b/ports/atmel-samd/boards/adafruit_slide_trinkey_m0/board.c @@ -29,16 +29,8 @@ #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) { board_reset_user_neopixels(&pin_PA04, 2); } -void board_deinit(void) { -} +// Use the MP_WEAK supervisor/shared/board.c versions of routines not defined here. diff --git a/ports/atmel-samd/boards/aloriumtech_evo_m51/board.c b/ports/atmel-samd/boards/aloriumtech_evo_m51/board.c index 1c79675305..80e8b909a7 100644 --- a/ports/atmel-samd/boards/aloriumtech_evo_m51/board.c +++ b/ports/atmel-samd/boards/aloriumtech_evo_m51/board.c @@ -50,12 +50,4 @@ void board_init(void) { } } -bool board_requests_safe_mode(void) { - return false; -} - -void reset_board(void) { -} - -void board_deinit(void) { -} +// Use the MP_WEAK supervisor/shared/board.c versions of routines not defined here. diff --git a/ports/atmel-samd/boards/arduino_mkr1300/board.c b/ports/atmel-samd/boards/arduino_mkr1300/board.c index e0a7487bd2..fb1ce4fb83 100644 --- a/ports/atmel-samd/boards/arduino_mkr1300/board.c +++ b/ports/atmel-samd/boards/arduino_mkr1300/board.c @@ -25,18 +25,5 @@ */ #include "supervisor/board.h" -#include "mpconfigboard.h" -#include "hal/include/hal_gpio.h" -void board_init(void) { -} - -bool board_requests_safe_mode(void) { - return false; -} - -void reset_board(void) { -} - -void board_deinit(void) { -} +// Use the MP_WEAK supervisor/shared/board.c versions of routines not defined here. diff --git a/ports/atmel-samd/boards/arduino_mkr1300/mpconfigboard.mk b/ports/atmel-samd/boards/arduino_mkr1300/mpconfigboard.mk index c3d75202bf..261e30d7e5 100644 --- a/ports/atmel-samd/boards/arduino_mkr1300/mpconfigboard.mk +++ b/ports/atmel-samd/boards/arduino_mkr1300/mpconfigboard.mk @@ -6,6 +6,8 @@ USB_MANUFACTURER = "Arduino" CHIP_VARIANT = SAMD21G18A CHIP_FAMILY = samd21 +CIRCUITPY_BUILD_EXTENSIONS = bin,uf2 + INTERNAL_FLASH_FILESYSTEM = 1 LONGINT_IMPL = NONE CIRCUITPY_FULL_BUILD = 0 diff --git a/ports/atmel-samd/boards/arduino_mkrzero/board.c b/ports/atmel-samd/boards/arduino_mkrzero/board.c index e0a7487bd2..fb1ce4fb83 100644 --- a/ports/atmel-samd/boards/arduino_mkrzero/board.c +++ b/ports/atmel-samd/boards/arduino_mkrzero/board.c @@ -25,18 +25,5 @@ */ #include "supervisor/board.h" -#include "mpconfigboard.h" -#include "hal/include/hal_gpio.h" -void board_init(void) { -} - -bool board_requests_safe_mode(void) { - return false; -} - -void reset_board(void) { -} - -void board_deinit(void) { -} +// Use the MP_WEAK supervisor/shared/board.c versions of routines not defined here. diff --git a/ports/atmel-samd/boards/arduino_mkrzero/mpconfigboard.mk b/ports/atmel-samd/boards/arduino_mkrzero/mpconfigboard.mk index eea3a27f13..4f058e4f2a 100644 --- a/ports/atmel-samd/boards/arduino_mkrzero/mpconfigboard.mk +++ b/ports/atmel-samd/boards/arduino_mkrzero/mpconfigboard.mk @@ -6,6 +6,8 @@ USB_MANUFACTURER = "Arduino" CHIP_VARIANT = SAMD21G18A CHIP_FAMILY = samd21 +CIRCUITPY_BUILD_EXTENSIONS = bin,uf2 + INTERNAL_FLASH_FILESYSTEM = 1 LONGINT_IMPL = NONE CIRCUITPY_FULL_BUILD = 0 diff --git a/ports/atmel-samd/boards/arduino_nano_33_iot/board.c b/ports/atmel-samd/boards/arduino_nano_33_iot/board.c index e0a7487bd2..fb1ce4fb83 100644 --- a/ports/atmel-samd/boards/arduino_nano_33_iot/board.c +++ b/ports/atmel-samd/boards/arduino_nano_33_iot/board.c @@ -25,18 +25,5 @@ */ #include "supervisor/board.h" -#include "mpconfigboard.h" -#include "hal/include/hal_gpio.h" -void board_init(void) { -} - -bool board_requests_safe_mode(void) { - return false; -} - -void reset_board(void) { -} - -void board_deinit(void) { -} +// Use the MP_WEAK supervisor/shared/board.c versions of routines not defined here. diff --git a/ports/atmel-samd/boards/arduino_nano_33_iot/mpconfigboard.mk b/ports/atmel-samd/boards/arduino_nano_33_iot/mpconfigboard.mk index 38b1e96d6b..de9819a895 100644 --- a/ports/atmel-samd/boards/arduino_nano_33_iot/mpconfigboard.mk +++ b/ports/atmel-samd/boards/arduino_nano_33_iot/mpconfigboard.mk @@ -6,9 +6,9 @@ USB_MANUFACTURER = "Arduino" CHIP_VARIANT = SAMD21G18A CHIP_FAMILY = samd21 +CIRCUITPY_BUILD_EXTENSIONS = bin,uf2 + INTERNAL_FLASH_FILESYSTEM = 1 LONGINT_IMPL = NONE CIRCUITPY_FULL_BUILD = 0 - -# This board has many pins, and we have to remove something else to make room. CIRCUITPY_RAINBOWIO = 0 diff --git a/ports/atmel-samd/boards/arduino_zero/board.c b/ports/atmel-samd/boards/arduino_zero/board.c index e0a7487bd2..fb1ce4fb83 100644 --- a/ports/atmel-samd/boards/arduino_zero/board.c +++ b/ports/atmel-samd/boards/arduino_zero/board.c @@ -25,18 +25,5 @@ */ #include "supervisor/board.h" -#include "mpconfigboard.h" -#include "hal/include/hal_gpio.h" -void board_init(void) { -} - -bool board_requests_safe_mode(void) { - return false; -} - -void reset_board(void) { -} - -void board_deinit(void) { -} +// Use the MP_WEAK supervisor/shared/board.c versions of routines not defined here. diff --git a/ports/atmel-samd/boards/arduino_zero/mpconfigboard.mk b/ports/atmel-samd/boards/arduino_zero/mpconfigboard.mk index 5d0734f69d..0c2df96c5d 100644 --- a/ports/atmel-samd/boards/arduino_zero/mpconfigboard.mk +++ b/ports/atmel-samd/boards/arduino_zero/mpconfigboard.mk @@ -6,9 +6,10 @@ USB_MANUFACTURER = "Arduino" CHIP_VARIANT = SAMD21G18A CHIP_FAMILY = samd21 +CIRCUITPY_BUILD_EXTENSIONS = bin,uf2 + INTERNAL_FLASH_FILESYSTEM = 1 LONGINT_IMPL = NONE CIRCUITPY_FULL_BUILD = 0 -CIRCUITPY_ONEWIREIO = 0 CIRCUITPY_RAINBOWIO = 0 diff --git a/ports/atmel-samd/boards/bast_pro_mini_m0/board.c b/ports/atmel-samd/boards/bast_pro_mini_m0/board.c index 9f91617a17..fb1ce4fb83 100644 --- a/ports/atmel-samd/boards/bast_pro_mini_m0/board.c +++ b/ports/atmel-samd/boards/bast_pro_mini_m0/board.c @@ -26,15 +26,4 @@ #include "supervisor/board.h" -void board_init(void) { -} - -bool board_requests_safe_mode(void) { - return false; -} - -void reset_board(void) { -} - -void board_deinit(void) { -} +// Use the MP_WEAK supervisor/shared/board.c versions of routines not defined here. diff --git a/ports/atmel-samd/boards/bdmicro_vina_d21/board.c b/ports/atmel-samd/boards/bdmicro_vina_d21/board.c index 5725a67dcc..f56275c016 100644 --- a/ports/atmel-samd/boards/bdmicro_vina_d21/board.c +++ b/ports/atmel-samd/boards/bdmicro_vina_d21/board.c @@ -39,12 +39,4 @@ void board_init(void) { // port_pin_set_output_level(MICROPY_HW_LED_RX, true); } -bool board_requests_safe_mode(void) { - return false; -} - -void reset_board(void) { -} - -void board_deinit(void) { -} +// Use the MP_WEAK supervisor/shared/board.c versions of routines not defined here. diff --git a/ports/atmel-samd/boards/bdmicro_vina_d21/mpconfigboard.mk b/ports/atmel-samd/boards/bdmicro_vina_d21/mpconfigboard.mk index f0857ce6d2..1a8cddfda7 100644 --- a/ports/atmel-samd/boards/bdmicro_vina_d21/mpconfigboard.mk +++ b/ports/atmel-samd/boards/bdmicro_vina_d21/mpconfigboard.mk @@ -9,5 +9,3 @@ CHIP_FAMILY = samd21 SPI_FLASH_FILESYSTEM = 1 EXTERNAL_FLASH_DEVICES = "MX25L51245G","GD25S512MD" LONGINT_IMPL = MPZ - -CIRCUITPY_ONEWIREIO = 0 diff --git a/ports/atmel-samd/boards/bdmicro_vina_d51/board.c b/ports/atmel-samd/boards/bdmicro_vina_d51/board.c index e0a7487bd2..1bba99ac06 100644 --- a/ports/atmel-samd/boards/bdmicro_vina_d51/board.c +++ b/ports/atmel-samd/boards/bdmicro_vina_d51/board.c @@ -28,15 +28,4 @@ #include "mpconfigboard.h" #include "hal/include/hal_gpio.h" -void board_init(void) { -} - -bool board_requests_safe_mode(void) { - return false; -} - -void reset_board(void) { -} - -void board_deinit(void) { -} +// Use the MP_WEAK supervisor/shared/board.c versions of routines not defined here. diff --git a/ports/atmel-samd/boards/bdmicro_vina_d51_pcb7/board.c b/ports/atmel-samd/boards/bdmicro_vina_d51_pcb7/board.c index 5725a67dcc..f56275c016 100644 --- a/ports/atmel-samd/boards/bdmicro_vina_d51_pcb7/board.c +++ b/ports/atmel-samd/boards/bdmicro_vina_d51_pcb7/board.c @@ -39,12 +39,4 @@ void board_init(void) { // port_pin_set_output_level(MICROPY_HW_LED_RX, true); } -bool board_requests_safe_mode(void) { - return false; -} - -void reset_board(void) { -} - -void board_deinit(void) { -} +// Use the MP_WEAK supervisor/shared/board.c versions of routines not defined here. diff --git a/ports/atmel-samd/boards/blm_badge/board.c b/ports/atmel-samd/boards/blm_badge/board.c index 40e66b947e..fb1ce4fb83 100644 --- a/ports/atmel-samd/boards/blm_badge/board.c +++ b/ports/atmel-samd/boards/blm_badge/board.c @@ -25,18 +25,5 @@ */ #include "supervisor/board.h" -#include "supervisor/shared/board.h" -void board_init(void) { -} - -bool board_requests_safe_mode(void) { - return false; -} - -void reset_board(void) { - board_reset_user_neopixels(&pin_PA05, 10); -} - -void board_deinit(void) { -} +// Use the MP_WEAK supervisor/shared/board.c versions of routines not defined here. diff --git a/ports/atmel-samd/boards/capablerobot_usbhub/board.c b/ports/atmel-samd/boards/capablerobot_usbhub/board.c index d421db8b25..711b2cf766 100644 --- a/ports/atmel-samd/boards/capablerobot_usbhub/board.c +++ b/ports/atmel-samd/boards/capablerobot_usbhub/board.c @@ -29,15 +29,4 @@ #include "hal/include/hal_gpio.h" #include "common-hal/microcontroller/Pin.h" -void board_init(void) { -} - -bool board_requests_safe_mode(void) { - return false; -} - -void reset_board(void) { -} - -void board_deinit(void) { -} +// Use the MP_WEAK supervisor/shared/board.c versions of routines not defined here. diff --git a/ports/atmel-samd/boards/catwan_usbstick/board.c b/ports/atmel-samd/boards/catwan_usbstick/board.c index 9f91617a17..fb1ce4fb83 100644 --- a/ports/atmel-samd/boards/catwan_usbstick/board.c +++ b/ports/atmel-samd/boards/catwan_usbstick/board.c @@ -26,15 +26,4 @@ #include "supervisor/board.h" -void board_init(void) { -} - -bool board_requests_safe_mode(void) { - return false; -} - -void reset_board(void) { -} - -void board_deinit(void) { -} +// Use the MP_WEAK supervisor/shared/board.c versions of routines not defined here. diff --git a/ports/atmel-samd/boards/circuitbrains_basic_m0/board.c b/ports/atmel-samd/boards/circuitbrains_basic_m0/board.c index 1e5a53751a..a28d51be4f 100755 --- a/ports/atmel-samd/boards/circuitbrains_basic_m0/board.c +++ b/ports/atmel-samd/boards/circuitbrains_basic_m0/board.c @@ -26,18 +26,5 @@ */ #include "supervisor/board.h" -#include "mpconfigboard.h" -#include "hal/include/hal_gpio.h" -void board_init(void) { -} - -bool board_requests_safe_mode(void) { - return false; -} - -void reset_board(void) { -} - -void board_deinit(void) { -} +// Use the MP_WEAK supervisor/shared/board.c versions of routines not defined here. diff --git a/ports/atmel-samd/boards/circuitbrains_deluxe_m4/board.c b/ports/atmel-samd/boards/circuitbrains_deluxe_m4/board.c index 1e5a53751a..a28d51be4f 100755 --- a/ports/atmel-samd/boards/circuitbrains_deluxe_m4/board.c +++ b/ports/atmel-samd/boards/circuitbrains_deluxe_m4/board.c @@ -26,18 +26,5 @@ */ #include "supervisor/board.h" -#include "mpconfigboard.h" -#include "hal/include/hal_gpio.h" -void board_init(void) { -} - -bool board_requests_safe_mode(void) { - return false; -} - -void reset_board(void) { -} - -void board_deinit(void) { -} +// Use the MP_WEAK supervisor/shared/board.c versions of routines not defined here. diff --git a/ports/atmel-samd/boards/circuitplayground_express/board.c b/ports/atmel-samd/boards/circuitplayground_express/board.c index 113db13085..bda4f7520b 100644 --- a/ports/atmel-samd/boards/circuitplayground_express/board.c +++ b/ports/atmel-samd/boards/circuitplayground_express/board.c @@ -31,9 +31,6 @@ #include "supervisor/shared/board.h" #include "hal/include/hal_gpio.h" -void board_init(void) { -} - // Check the status of the two buttons on CircuitPlayground Express. If both are // pressed, then boot into user safe mode. bool board_requests_safe_mode(void) { @@ -55,5 +52,4 @@ void reset_board(void) { board_reset_user_neopixels(&pin_PB23, 10); } -void board_deinit(void) { -} +// Use the MP_WEAK supervisor/shared/board.c versions of routines not defined here. diff --git a/ports/atmel-samd/boards/circuitplayground_express/mpconfigboard.mk b/ports/atmel-samd/boards/circuitplayground_express/mpconfigboard.mk index 5311cdc1d4..b64fd2033d 100644 --- a/ports/atmel-samd/boards/circuitplayground_express/mpconfigboard.mk +++ b/ports/atmel-samd/boards/circuitplayground_express/mpconfigboard.mk @@ -19,7 +19,7 @@ CIRCUITPY_COUNTIO = 1 CIRCUITPY_BUSDEVICE = 1 # Include these Python libraries in firmware. -FROZEN_MPY_DIRS += $(TOP)/frozen/Adafruit_CircuitPython_CircuitPlayground +FROZEN_MPY_DIRS += $(TOP)/frozen/Adafruit_CircuitPython_CircuitPlayground/frozen_cpx FROZEN_MPY_DIRS += $(TOP)/frozen/Adafruit_CircuitPython_HID FROZEN_MPY_DIRS += $(TOP)/frozen/Adafruit_CircuitPython_LIS3DH FROZEN_MPY_DIRS += $(TOP)/frozen/Adafruit_CircuitPython_NeoPixel diff --git a/ports/atmel-samd/boards/circuitplayground_express_crickit/board.c b/ports/atmel-samd/boards/circuitplayground_express_crickit/board.c index d419813df3..bd9eba93cc 100644 --- a/ports/atmel-samd/boards/circuitplayground_express_crickit/board.c +++ b/ports/atmel-samd/boards/circuitplayground_express_crickit/board.c @@ -31,9 +31,6 @@ #include "hal/include/hal_gpio.h" #include "supervisor/shared/board.h" -void board_init(void) { -} - // Check the status of the two buttons on CircuitPlayground Express. If both are // pressed, then boot into user safe mode. bool board_requests_safe_mode(void) { @@ -55,5 +52,4 @@ void reset_board(void) { board_reset_user_neopixels(&pin_PB23, 10); } -void board_deinit(void) { -} +// Use the MP_WEAK supervisor/shared/board.c versions of routines not defined here. diff --git a/ports/atmel-samd/boards/circuitplayground_express_crickit/mpconfigboard.mk b/ports/atmel-samd/boards/circuitplayground_express_crickit/mpconfigboard.mk index 4d749d2134..c108a90250 100644 --- a/ports/atmel-samd/boards/circuitplayground_express_crickit/mpconfigboard.mk +++ b/ports/atmel-samd/boards/circuitplayground_express_crickit/mpconfigboard.mk @@ -15,10 +15,9 @@ LONGINT_IMPL = NONE CIRCUITPY_BUSDEVICE = 1 CIRCUITPY_DISPLAYIO = 0 CIRCUITPY_KEYPAD = 0 -CIRCUITPY_ONEWIREIO = 0 # Include these Python libraries in firmware. -FROZEN_MPY_DIRS += $(TOP)/frozen/Adafruit_CircuitPython_CircuitPlayground +FROZEN_MPY_DIRS += $(TOP)/frozen/Adafruit_CircuitPython_CircuitPlayground/frozen_cpx FROZEN_MPY_DIRS += $(TOP)/frozen/Adafruit_CircuitPython_Crickit FROZEN_MPY_DIRS += $(TOP)/frozen/Adafruit_CircuitPython_LIS3DH FROZEN_MPY_DIRS += $(TOP)/frozen/Adafruit_CircuitPython_Motor diff --git a/ports/atmel-samd/boards/circuitplayground_express_displayio/board.c b/ports/atmel-samd/boards/circuitplayground_express_displayio/board.c index d419813df3..bd9eba93cc 100644 --- a/ports/atmel-samd/boards/circuitplayground_express_displayio/board.c +++ b/ports/atmel-samd/boards/circuitplayground_express_displayio/board.c @@ -31,9 +31,6 @@ #include "hal/include/hal_gpio.h" #include "supervisor/shared/board.h" -void board_init(void) { -} - // Check the status of the two buttons on CircuitPlayground Express. If both are // pressed, then boot into user safe mode. bool board_requests_safe_mode(void) { @@ -55,5 +52,4 @@ void reset_board(void) { board_reset_user_neopixels(&pin_PB23, 10); } -void board_deinit(void) { -} +// Use the MP_WEAK supervisor/shared/board.c versions of routines not defined here. diff --git a/ports/atmel-samd/boards/circuitplayground_express_displayio/mpconfigboard.mk b/ports/atmel-samd/boards/circuitplayground_express_displayio/mpconfigboard.mk index 0ae0c58b42..cc125e1ffb 100644 --- a/ports/atmel-samd/boards/circuitplayground_express_displayio/mpconfigboard.mk +++ b/ports/atmel-samd/boards/circuitplayground_express_displayio/mpconfigboard.mk @@ -12,7 +12,6 @@ EXTERNAL_FLASH_DEVICES = "S25FL216K, GD25Q16C" # Turn off features and optimizations for displayio build to make room for additional frozen libs. LONGINT_IMPL = NONE CIRCUITPY_KEYPAD = 0 -CIRCUITPY_ONEWIREIO = 0 CIRCUITPY_PIXELBUF = 0 CIRCUITPY_ROTARYIO = 0 CIRCUITPY_RTC = 0 @@ -24,7 +23,7 @@ CIRCUITPY_BITMAPTOOLS = 0 CIRCUITPY_PARALLELDISPLAY = 0 # Include these Python libraries in firmware. -FROZEN_MPY_DIRS += $(TOP)/frozen/Adafruit_CircuitPython_CircuitPlayground +FROZEN_MPY_DIRS += $(TOP)/frozen/Adafruit_CircuitPython_CircuitPlayground/frozen_cpx FROZEN_MPY_DIRS += $(TOP)/frozen/Adafruit_CircuitPython_LIS3DH FROZEN_MPY_DIRS += $(TOP)/frozen/Adafruit_CircuitPython_NeoPixel FROZEN_MPY_DIRS += $(TOP)/frozen/Adafruit_CircuitPython_Thermistor diff --git a/ports/atmel-samd/boards/cp32-m4/board.c b/ports/atmel-samd/boards/cp32-m4/board.c index e0a7487bd2..fb1ce4fb83 100644 --- a/ports/atmel-samd/boards/cp32-m4/board.c +++ b/ports/atmel-samd/boards/cp32-m4/board.c @@ -25,18 +25,5 @@ */ #include "supervisor/board.h" -#include "mpconfigboard.h" -#include "hal/include/hal_gpio.h" -void board_init(void) { -} - -bool board_requests_safe_mode(void) { - return false; -} - -void reset_board(void) { -} - -void board_deinit(void) { -} +// Use the MP_WEAK supervisor/shared/board.c versions of routines not defined here. diff --git a/ports/atmel-samd/boards/cp_sapling_m0/board.c b/ports/atmel-samd/boards/cp_sapling_m0/board.c index ba0cf06ebc..fb1ce4fb83 100644 --- a/ports/atmel-samd/boards/cp_sapling_m0/board.c +++ b/ports/atmel-samd/boards/cp_sapling_m0/board.c @@ -25,19 +25,5 @@ */ #include "supervisor/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) { -} - -void board_deinit(void) { -} +// Use the MP_WEAK supervisor/shared/board.c versions of routines not defined here. diff --git a/ports/atmel-samd/boards/cp_sapling_m0_revb/board.c b/ports/atmel-samd/boards/cp_sapling_m0_revb/board.c index ba0cf06ebc..fb1ce4fb83 100644 --- a/ports/atmel-samd/boards/cp_sapling_m0_revb/board.c +++ b/ports/atmel-samd/boards/cp_sapling_m0_revb/board.c @@ -25,19 +25,5 @@ */ #include "supervisor/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) { -} - -void board_deinit(void) { -} +// Use the MP_WEAK supervisor/shared/board.c versions of routines not defined here. diff --git a/ports/atmel-samd/boards/cp_sapling_m0_spiflash/board.c b/ports/atmel-samd/boards/cp_sapling_m0_spiflash/board.c index ba0cf06ebc..fb1ce4fb83 100644 --- a/ports/atmel-samd/boards/cp_sapling_m0_spiflash/board.c +++ b/ports/atmel-samd/boards/cp_sapling_m0_spiflash/board.c @@ -25,19 +25,5 @@ */ #include "supervisor/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) { -} - -void board_deinit(void) { -} +// Use the MP_WEAK supervisor/shared/board.c versions of routines not defined here. diff --git a/ports/atmel-samd/boards/cytron_maker_zero_samd21/board.c b/ports/atmel-samd/boards/cytron_maker_zero_samd21/board.c new file mode 100644 index 0000000000..fb1ce4fb83 --- /dev/null +++ b/ports/atmel-samd/boards/cytron_maker_zero_samd21/board.c @@ -0,0 +1,29 @@ +/* + * 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 "supervisor/board.h" + +// Use the MP_WEAK supervisor/shared/board.c versions of routines not defined here. diff --git a/ports/atmel-samd/boards/cytron_maker_zero_samd21/mpconfigboard.h b/ports/atmel-samd/boards/cytron_maker_zero_samd21/mpconfigboard.h new file mode 100644 index 0000000000..7e0d96f0fe --- /dev/null +++ b/ports/atmel-samd/boards/cytron_maker_zero_samd21/mpconfigboard.h @@ -0,0 +1,27 @@ +#define MICROPY_HW_BOARD_NAME "Cytron Maker Zero SAMD21" +#define MICROPY_HW_MCU_NAME "samd21g18" + +#define MICROPY_HW_LED_TX &pin_PA27 +#define MICROPY_HW_LED_RX &pin_PB03 + +#define DEFAULT_I2C_BUS_SCL (&pin_PA23) +#define DEFAULT_I2C_BUS_SDA (&pin_PA22) + +#define DEFAULT_SPI_BUS_SCK (&pin_PB11) +#define DEFAULT_SPI_BUS_MOSI (&pin_PB10) +#define DEFAULT_SPI_BUS_MISO (&pin_PA12) + +#define DEFAULT_UART_BUS_RX (&pin_PA11) +#define DEFAULT_UART_BUS_TX (&pin_PA10) + +// USB is always used internally so skip the pin objects for it. +#define IGNORE_PIN_PA24 1 +#define IGNORE_PIN_PA25 1 + +// Connected to a crystal +#define IGNORE_PIN_PA00 1 +#define IGNORE_PIN_PA01 1 + +// SWD-only +#define IGNORE_PIN_PA30 1 +#define IGNORE_PIN_PA31 1 diff --git a/ports/atmel-samd/boards/cytron_maker_zero_samd21/mpconfigboard.mk b/ports/atmel-samd/boards/cytron_maker_zero_samd21/mpconfigboard.mk new file mode 100644 index 0000000000..9466ce571a --- /dev/null +++ b/ports/atmel-samd/boards/cytron_maker_zero_samd21/mpconfigboard.mk @@ -0,0 +1,11 @@ +USB_VID = 0x04D8 +USB_PID = 0xE799 +USB_PRODUCT = "Maker Zero SAMD21" +USB_MANUFACTURER = "Cytron" + +CHIP_VARIANT = SAMD21G18A +CHIP_FAMILY = samd21 + +INTERNAL_FLASH_FILESYSTEM = 1 +LONGINT_IMPL = NONE +CIRCUITPY_FULL_BUILD = 0 diff --git a/ports/atmel-samd/boards/cytron_maker_zero_samd21/pins.c b/ports/atmel-samd/boards/cytron_maker_zero_samd21/pins.c new file mode 100644 index 0000000000..4bb0f48467 --- /dev/null +++ b/ports/atmel-samd/boards/cytron_maker_zero_samd21/pins.c @@ -0,0 +1,49 @@ +#include "shared-bindings/board/__init__.h" + +STATIC const mp_rom_map_elem_t board_module_globals_table[] = { + CIRCUITPYTHON_BOARD_DICT_STANDARD_ITEMS + + { MP_ROM_QSTR(MP_QSTR_A0), MP_ROM_PTR(&pin_PA02) }, + { MP_ROM_QSTR(MP_QSTR_A1), MP_ROM_PTR(&pin_PB08) }, + { MP_ROM_QSTR(MP_QSTR_A2), MP_ROM_PTR(&pin_PB09) }, + { MP_ROM_QSTR(MP_QSTR_A3), MP_ROM_PTR(&pin_PA04) }, + { MP_ROM_QSTR(MP_QSTR_A4), MP_ROM_PTR(&pin_PA05) }, + { MP_ROM_QSTR(MP_QSTR_A5), MP_ROM_PTR(&pin_PB02) }, + + { MP_ROM_QSTR(MP_QSTR_D0), MP_ROM_PTR(&pin_PA11) }, + { MP_ROM_QSTR(MP_QSTR_RX), MP_ROM_PTR(&pin_PA11) }, + + { MP_ROM_QSTR(MP_QSTR_D1), MP_ROM_PTR(&pin_PA10) }, + { MP_ROM_QSTR(MP_QSTR_TX), MP_ROM_PTR(&pin_PA10) }, + + { MP_ROM_QSTR(MP_QSTR_D2), MP_ROM_PTR(&pin_PA14) }, + { MP_ROM_QSTR(MP_QSTR_D3), MP_ROM_PTR(&pin_PA09) }, + { MP_ROM_QSTR(MP_QSTR_D4), MP_ROM_PTR(&pin_PA08) }, + { MP_ROM_QSTR(MP_QSTR_D5), MP_ROM_PTR(&pin_PA15) }, + { MP_ROM_QSTR(MP_QSTR_D6), MP_ROM_PTR(&pin_PA20) }, + { MP_ROM_QSTR(MP_QSTR_D7), MP_ROM_PTR(&pin_PA21) }, + { MP_ROM_QSTR(MP_QSTR_D8), MP_ROM_PTR(&pin_PA06) }, + { MP_ROM_QSTR(MP_QSTR_D9), MP_ROM_PTR(&pin_PA07) }, + { MP_ROM_QSTR(MP_QSTR_D10), MP_ROM_PTR(&pin_PA18) }, + { MP_ROM_QSTR(MP_QSTR_D11), MP_ROM_PTR(&pin_PA16) }, + { MP_ROM_QSTR(MP_QSTR_D12), MP_ROM_PTR(&pin_PA19) }, + + { MP_ROM_QSTR(MP_QSTR_D13), MP_ROM_PTR(&pin_PA17) }, + { MP_ROM_QSTR(MP_QSTR_LED), MP_ROM_PTR(&pin_PA17) }, + + { MP_ROM_QSTR(MP_QSTR_D38), MP_ROM_PTR(&pin_PA13) }, + { MP_ROM_QSTR(MP_QSTR_ATN), MP_ROM_PTR(&pin_PA13) }, + + { MP_ROM_QSTR(MP_QSTR_D20), MP_ROM_PTR(&pin_PA22) }, + { MP_ROM_QSTR(MP_QSTR_SDA), MP_ROM_PTR(&pin_PA22) }, + { MP_ROM_QSTR(MP_QSTR_D21), MP_ROM_PTR(&pin_PA23) }, + { MP_ROM_QSTR(MP_QSTR_SCL), MP_ROM_PTR(&pin_PA23) }, + { MP_ROM_QSTR(MP_QSTR_SCK), MP_ROM_PTR(&pin_PB11) }, + { MP_ROM_QSTR(MP_QSTR_MOSI), MP_ROM_PTR(&pin_PB10) }, + { MP_ROM_QSTR(MP_QSTR_MISO), MP_ROM_PTR(&pin_PA12) }, + + { 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) }, +}; +MP_DEFINE_CONST_DICT(board_module_globals, board_module_globals_table); diff --git a/ports/atmel-samd/boards/datalore_ip_m4/board.c b/ports/atmel-samd/boards/datalore_ip_m4/board.c index e0a7487bd2..fb1ce4fb83 100644 --- a/ports/atmel-samd/boards/datalore_ip_m4/board.c +++ b/ports/atmel-samd/boards/datalore_ip_m4/board.c @@ -25,18 +25,5 @@ */ #include "supervisor/board.h" -#include "mpconfigboard.h" -#include "hal/include/hal_gpio.h" -void board_init(void) { -} - -bool board_requests_safe_mode(void) { - return false; -} - -void reset_board(void) { -} - -void board_deinit(void) { -} +// Use the MP_WEAK supervisor/shared/board.c versions of routines not defined here. diff --git a/ports/atmel-samd/boards/datum_distance/board.c b/ports/atmel-samd/boards/datum_distance/board.c index 9f91617a17..fb1ce4fb83 100644 --- a/ports/atmel-samd/boards/datum_distance/board.c +++ b/ports/atmel-samd/boards/datum_distance/board.c @@ -26,15 +26,4 @@ #include "supervisor/board.h" -void board_init(void) { -} - -bool board_requests_safe_mode(void) { - return false; -} - -void reset_board(void) { -} - -void board_deinit(void) { -} +// Use the MP_WEAK supervisor/shared/board.c versions of routines not defined here. diff --git a/ports/atmel-samd/boards/datum_imu/board.c b/ports/atmel-samd/boards/datum_imu/board.c index 9f91617a17..fb1ce4fb83 100644 --- a/ports/atmel-samd/boards/datum_imu/board.c +++ b/ports/atmel-samd/boards/datum_imu/board.c @@ -26,15 +26,4 @@ #include "supervisor/board.h" -void board_init(void) { -} - -bool board_requests_safe_mode(void) { - return false; -} - -void reset_board(void) { -} - -void board_deinit(void) { -} +// Use the MP_WEAK supervisor/shared/board.c versions of routines not defined here. diff --git a/ports/atmel-samd/boards/datum_light/board.c b/ports/atmel-samd/boards/datum_light/board.c index 9f91617a17..fb1ce4fb83 100644 --- a/ports/atmel-samd/boards/datum_light/board.c +++ b/ports/atmel-samd/boards/datum_light/board.c @@ -26,15 +26,4 @@ #include "supervisor/board.h" -void board_init(void) { -} - -bool board_requests_safe_mode(void) { - return false; -} - -void reset_board(void) { -} - -void board_deinit(void) { -} +// Use the MP_WEAK supervisor/shared/board.c versions of routines not defined here. diff --git a/ports/atmel-samd/boards/datum_weather/board.c b/ports/atmel-samd/boards/datum_weather/board.c index 9f91617a17..fb1ce4fb83 100644 --- a/ports/atmel-samd/boards/datum_weather/board.c +++ b/ports/atmel-samd/boards/datum_weather/board.c @@ -26,15 +26,4 @@ #include "supervisor/board.h" -void board_init(void) { -} - -bool board_requests_safe_mode(void) { - return false; -} - -void reset_board(void) { -} - -void board_deinit(void) { -} +// Use the MP_WEAK supervisor/shared/board.c versions of routines not defined here. diff --git a/ports/atmel-samd/boards/dynalora_usb/board.c b/ports/atmel-samd/boards/dynalora_usb/board.c index 9f91617a17..fb1ce4fb83 100644 --- a/ports/atmel-samd/boards/dynalora_usb/board.c +++ b/ports/atmel-samd/boards/dynalora_usb/board.c @@ -26,15 +26,4 @@ #include "supervisor/board.h" -void board_init(void) { -} - -bool board_requests_safe_mode(void) { - return false; -} - -void reset_board(void) { -} - -void board_deinit(void) { -} +// Use the MP_WEAK supervisor/shared/board.c versions of routines not defined here. diff --git a/ports/atmel-samd/boards/dynossat_edu_eps/board.c b/ports/atmel-samd/boards/dynossat_edu_eps/board.c index 9f91617a17..fb1ce4fb83 100644 --- a/ports/atmel-samd/boards/dynossat_edu_eps/board.c +++ b/ports/atmel-samd/boards/dynossat_edu_eps/board.c @@ -26,15 +26,4 @@ #include "supervisor/board.h" -void board_init(void) { -} - -bool board_requests_safe_mode(void) { - return false; -} - -void reset_board(void) { -} - -void board_deinit(void) { -} +// Use the MP_WEAK supervisor/shared/board.c versions of routines not defined here. diff --git a/ports/atmel-samd/boards/dynossat_edu_obc/board.c b/ports/atmel-samd/boards/dynossat_edu_obc/board.c index 9f91617a17..fb1ce4fb83 100644 --- a/ports/atmel-samd/boards/dynossat_edu_obc/board.c +++ b/ports/atmel-samd/boards/dynossat_edu_obc/board.c @@ -26,15 +26,4 @@ #include "supervisor/board.h" -void board_init(void) { -} - -bool board_requests_safe_mode(void) { - return false; -} - -void reset_board(void) { -} - -void board_deinit(void) { -} +// Use the MP_WEAK supervisor/shared/board.c versions of routines not defined here. diff --git a/ports/atmel-samd/boards/escornabot_makech/board.c b/ports/atmel-samd/boards/escornabot_makech/board.c index bfc3bade9d..a3c19899e8 100644 --- a/ports/atmel-samd/boards/escornabot_makech/board.c +++ b/ports/atmel-samd/boards/escornabot_makech/board.c @@ -26,15 +26,4 @@ #include "supervisor/board.h" -void board_init(void) { -} - -bool board_requests_safe_mode(void) { - return false; -} - -void reset_board(void) { -} - -void board_deinit(void) { -} +// Use the MP_WEAK supervisor/shared/board.c versions of routines not defined here. diff --git a/ports/atmel-samd/boards/feather_m0_adalogger/board.c b/ports/atmel-samd/boards/feather_m0_adalogger/board.c index 9f91617a17..fb1ce4fb83 100644 --- a/ports/atmel-samd/boards/feather_m0_adalogger/board.c +++ b/ports/atmel-samd/boards/feather_m0_adalogger/board.c @@ -26,15 +26,4 @@ #include "supervisor/board.h" -void board_init(void) { -} - -bool board_requests_safe_mode(void) { - return false; -} - -void reset_board(void) { -} - -void board_deinit(void) { -} +// Use the MP_WEAK supervisor/shared/board.c versions of routines not defined here. diff --git a/ports/atmel-samd/boards/feather_m0_adalogger/mpconfigboard.mk b/ports/atmel-samd/boards/feather_m0_adalogger/mpconfigboard.mk index 62336ecf50..b0e01e43a5 100644 --- a/ports/atmel-samd/boards/feather_m0_adalogger/mpconfigboard.mk +++ b/ports/atmel-samd/boards/feather_m0_adalogger/mpconfigboard.mk @@ -6,6 +6,8 @@ USB_MANUFACTURER = "Adafruit Industries LLC" CHIP_VARIANT = SAMD21G18A CHIP_FAMILY = samd21 +CIRCUITPY_BUILD_EXTENSIONS = bin,uf2 + INTERNAL_FLASH_FILESYSTEM = 1 LONGINT_IMPL = NONE CIRCUITPY_FULL_BUILD = 0 diff --git a/ports/atmel-samd/boards/feather_m0_basic/board.c b/ports/atmel-samd/boards/feather_m0_basic/board.c index 9f91617a17..fb1ce4fb83 100644 --- a/ports/atmel-samd/boards/feather_m0_basic/board.c +++ b/ports/atmel-samd/boards/feather_m0_basic/board.c @@ -26,15 +26,4 @@ #include "supervisor/board.h" -void board_init(void) { -} - -bool board_requests_safe_mode(void) { - return false; -} - -void reset_board(void) { -} - -void board_deinit(void) { -} +// Use the MP_WEAK supervisor/shared/board.c versions of routines not defined here. diff --git a/ports/atmel-samd/boards/feather_m0_basic/mpconfigboard.mk b/ports/atmel-samd/boards/feather_m0_basic/mpconfigboard.mk index cfd1f63cb3..f54da83f11 100644 --- a/ports/atmel-samd/boards/feather_m0_basic/mpconfigboard.mk +++ b/ports/atmel-samd/boards/feather_m0_basic/mpconfigboard.mk @@ -6,6 +6,8 @@ USB_MANUFACTURER = "Adafruit Industries LLC" CHIP_VARIANT = SAMD21G18A CHIP_FAMILY = samd21 +CIRCUITPY_BUILD_EXTENSIONS = bin,uf2 + INTERNAL_FLASH_FILESYSTEM = 1 LONGINT_IMPL = NONE CIRCUITPY_FULL_BUILD = 0 diff --git a/ports/atmel-samd/boards/feather_m0_express/board.c b/ports/atmel-samd/boards/feather_m0_express/board.c index 9f91617a17..fb1ce4fb83 100644 --- a/ports/atmel-samd/boards/feather_m0_express/board.c +++ b/ports/atmel-samd/boards/feather_m0_express/board.c @@ -26,15 +26,4 @@ #include "supervisor/board.h" -void board_init(void) { -} - -bool board_requests_safe_mode(void) { - return false; -} - -void reset_board(void) { -} - -void board_deinit(void) { -} +// Use the MP_WEAK supervisor/shared/board.c versions of routines not defined here. diff --git a/ports/atmel-samd/boards/feather_m0_express_crickit/board.c b/ports/atmel-samd/boards/feather_m0_express_crickit/board.c index 9f91617a17..fb1ce4fb83 100644 --- a/ports/atmel-samd/boards/feather_m0_express_crickit/board.c +++ b/ports/atmel-samd/boards/feather_m0_express_crickit/board.c @@ -26,15 +26,4 @@ #include "supervisor/board.h" -void board_init(void) { -} - -bool board_requests_safe_mode(void) { - return false; -} - -void reset_board(void) { -} - -void board_deinit(void) { -} +// Use the MP_WEAK supervisor/shared/board.c versions of routines not defined here. diff --git a/ports/atmel-samd/boards/feather_m0_rfm69/board.c b/ports/atmel-samd/boards/feather_m0_rfm69/board.c index 9f91617a17..fb1ce4fb83 100644 --- a/ports/atmel-samd/boards/feather_m0_rfm69/board.c +++ b/ports/atmel-samd/boards/feather_m0_rfm69/board.c @@ -26,15 +26,4 @@ #include "supervisor/board.h" -void board_init(void) { -} - -bool board_requests_safe_mode(void) { - return false; -} - -void reset_board(void) { -} - -void board_deinit(void) { -} +// Use the MP_WEAK supervisor/shared/board.c versions of routines not defined here. diff --git a/ports/atmel-samd/boards/feather_m0_rfm69/mpconfigboard.mk b/ports/atmel-samd/boards/feather_m0_rfm69/mpconfigboard.mk index 48c0f47064..a1891f972e 100644 --- a/ports/atmel-samd/boards/feather_m0_rfm69/mpconfigboard.mk +++ b/ports/atmel-samd/boards/feather_m0_rfm69/mpconfigboard.mk @@ -6,6 +6,8 @@ USB_MANUFACTURER = "Adafruit Industries LLC" CHIP_VARIANT = SAMD21G18A CHIP_FAMILY = samd21 +CIRCUITPY_BUILD_EXTENSIONS = bin,uf2 + INTERNAL_FLASH_FILESYSTEM = 1 LONGINT_IMPL = NONE CIRCUITPY_FULL_BUILD = 0 diff --git a/ports/atmel-samd/boards/feather_m0_rfm9x/board.c b/ports/atmel-samd/boards/feather_m0_rfm9x/board.c index 9f91617a17..fb1ce4fb83 100644 --- a/ports/atmel-samd/boards/feather_m0_rfm9x/board.c +++ b/ports/atmel-samd/boards/feather_m0_rfm9x/board.c @@ -26,15 +26,4 @@ #include "supervisor/board.h" -void board_init(void) { -} - -bool board_requests_safe_mode(void) { - return false; -} - -void reset_board(void) { -} - -void board_deinit(void) { -} +// Use the MP_WEAK supervisor/shared/board.c versions of routines not defined here. diff --git a/ports/atmel-samd/boards/feather_m0_rfm9x/mpconfigboard.mk b/ports/atmel-samd/boards/feather_m0_rfm9x/mpconfigboard.mk index 4003dd67f0..3bc3fa3ed0 100644 --- a/ports/atmel-samd/boards/feather_m0_rfm9x/mpconfigboard.mk +++ b/ports/atmel-samd/boards/feather_m0_rfm9x/mpconfigboard.mk @@ -6,6 +6,8 @@ USB_MANUFACTURER = "Adafruit Industries LLC" CHIP_VARIANT = SAMD21G18A CHIP_FAMILY = samd21 +CIRCUITPY_BUILD_EXTENSIONS = bin,uf2 + INTERNAL_FLASH_FILESYSTEM = 1 LONGINT_IMPL = NONE CIRCUITPY_FULL_BUILD = 0 diff --git a/ports/atmel-samd/boards/feather_m0_supersized/board.c b/ports/atmel-samd/boards/feather_m0_supersized/board.c index 9f91617a17..fb1ce4fb83 100644 --- a/ports/atmel-samd/boards/feather_m0_supersized/board.c +++ b/ports/atmel-samd/boards/feather_m0_supersized/board.c @@ -26,15 +26,4 @@ #include "supervisor/board.h" -void board_init(void) { -} - -bool board_requests_safe_mode(void) { - return false; -} - -void reset_board(void) { -} - -void board_deinit(void) { -} +// Use the MP_WEAK supervisor/shared/board.c versions of routines not defined here. diff --git a/ports/atmel-samd/boards/feather_m0_supersized/mpconfigboard.mk b/ports/atmel-samd/boards/feather_m0_supersized/mpconfigboard.mk index 9636c195dc..811336885b 100644 --- a/ports/atmel-samd/boards/feather_m0_supersized/mpconfigboard.mk +++ b/ports/atmel-samd/boards/feather_m0_supersized/mpconfigboard.mk @@ -9,5 +9,3 @@ CHIP_FAMILY = samd21 SPI_FLASH_FILESYSTEM = 1 EXTERNAL_FLASH_DEVICES = "S25FL064L" LONGINT_IMPL = MPZ - -CIRCUITPY_ONEWIREIO = 0 diff --git a/ports/atmel-samd/boards/feather_m4_can/board.c b/ports/atmel-samd/boards/feather_m4_can/board.c index 289d68af29..fb1ce4fb83 100644 --- a/ports/atmel-samd/boards/feather_m4_can/board.c +++ b/ports/atmel-samd/boards/feather_m4_can/board.c @@ -25,17 +25,5 @@ */ #include "supervisor/board.h" -#include "mpconfigboard.h" -void board_init(void) { -} - -bool board_requests_safe_mode(void) { - return false; -} - -void reset_board(void) { -} - -void board_deinit(void) { -} +// Use the MP_WEAK supervisor/shared/board.c versions of routines not defined here. diff --git a/ports/atmel-samd/boards/feather_m4_can/mpconfigboard.mk b/ports/atmel-samd/boards/feather_m4_can/mpconfigboard.mk index 088748a0cc..1c337d6256 100644 --- a/ports/atmel-samd/boards/feather_m4_can/mpconfigboard.mk +++ b/ports/atmel-samd/boards/feather_m4_can/mpconfigboard.mk @@ -12,3 +12,5 @@ LONGINT_IMPL = MPZ CIRCUITPY__EVE = 1 CIRCUITPY_CANIO = 1 + +CIRCUITPY_LTO_PARTITION = one diff --git a/ports/atmel-samd/boards/feather_m4_express/board.c b/ports/atmel-samd/boards/feather_m4_express/board.c index 289d68af29..fb1ce4fb83 100644 --- a/ports/atmel-samd/boards/feather_m4_express/board.c +++ b/ports/atmel-samd/boards/feather_m4_express/board.c @@ -25,17 +25,5 @@ */ #include "supervisor/board.h" -#include "mpconfigboard.h" -void board_init(void) { -} - -bool board_requests_safe_mode(void) { - return false; -} - -void reset_board(void) { -} - -void board_deinit(void) { -} +// Use the MP_WEAK supervisor/shared/board.c versions of routines not defined here. diff --git a/ports/atmel-samd/boards/fluff_m0/board.c b/ports/atmel-samd/boards/fluff_m0/board.c index 9f91617a17..fb1ce4fb83 100644 --- a/ports/atmel-samd/boards/fluff_m0/board.c +++ b/ports/atmel-samd/boards/fluff_m0/board.c @@ -26,15 +26,4 @@ #include "supervisor/board.h" -void board_init(void) { -} - -bool board_requests_safe_mode(void) { - return false; -} - -void reset_board(void) { -} - -void board_deinit(void) { -} +// Use the MP_WEAK supervisor/shared/board.c versions of routines not defined here. diff --git a/ports/atmel-samd/boards/gemma_m0/board.c b/ports/atmel-samd/boards/gemma_m0/board.c index 9f91617a17..fb1ce4fb83 100644 --- a/ports/atmel-samd/boards/gemma_m0/board.c +++ b/ports/atmel-samd/boards/gemma_m0/board.c @@ -26,15 +26,4 @@ #include "supervisor/board.h" -void board_init(void) { -} - -bool board_requests_safe_mode(void) { - return false; -} - -void reset_board(void) { -} - -void board_deinit(void) { -} +// Use the MP_WEAK supervisor/shared/board.c versions of routines not defined here. diff --git a/ports/atmel-samd/boards/grandcentral_m4_express/board.c b/ports/atmel-samd/boards/grandcentral_m4_express/board.c index f72884ffe8..7180deb278 100644 --- a/ports/atmel-samd/boards/grandcentral_m4_express/board.c +++ b/ports/atmel-samd/boards/grandcentral_m4_express/board.c @@ -25,18 +25,5 @@ */ #include "supervisor/board.h" -#include "mpconfigboard.h" -#include "hal/include/hal_gpio.h" -void board_init(void) { -} - -bool board_requests_safe_mode(void) { - return false; -} - -void reset_board(void) { -} - -void board_deinit(void) { -} +// Use the MP_WEAK supervisor/shared/board.c versions of routines not defined here. diff --git a/ports/atmel-samd/boards/grandcentral_m4_express/pins.c b/ports/atmel-samd/boards/grandcentral_m4_express/pins.c index b6ce037649..7641a9b630 100644 --- a/ports/atmel-samd/boards/grandcentral_m4_express/pins.c +++ b/ports/atmel-samd/boards/grandcentral_m4_express/pins.c @@ -58,77 +58,109 @@ STATIC const mp_rom_map_elem_t board_module_globals_table[] = { { MP_OBJ_NEW_QSTR(MP_QSTR_LED), MP_ROM_PTR(&pin_PB01) }, { MP_OBJ_NEW_QSTR(MP_QSTR_D13), MP_ROM_PTR(&pin_PB01) }, - { MP_OBJ_NEW_QSTR(MP_QSTR_TX3), MP_ROM_PTR(&pin_PB16) }, { MP_OBJ_NEW_QSTR(MP_QSTR_D14), MP_ROM_PTR(&pin_PB16) }, - { MP_OBJ_NEW_QSTR(MP_QSTR_RX3), MP_ROM_PTR(&pin_PB17) }, + { MP_OBJ_NEW_QSTR(MP_QSTR_TX3), MP_ROM_PTR(&pin_PB16) }, + { MP_OBJ_NEW_QSTR(MP_QSTR_D15), MP_ROM_PTR(&pin_PB17) }, - { MP_OBJ_NEW_QSTR(MP_QSTR_TX2), MP_ROM_PTR(&pin_PC22) }, + { MP_OBJ_NEW_QSTR(MP_QSTR_RX3), MP_ROM_PTR(&pin_PB17) }, + { MP_OBJ_NEW_QSTR(MP_QSTR_D16), MP_ROM_PTR(&pin_PC22) }, - { MP_OBJ_NEW_QSTR(MP_QSTR_RX2), MP_ROM_PTR(&pin_PC23) }, + { MP_OBJ_NEW_QSTR(MP_QSTR_TX2), MP_ROM_PTR(&pin_PC22) }, + { MP_OBJ_NEW_QSTR(MP_QSTR_D17), MP_ROM_PTR(&pin_PC23) }, - { MP_OBJ_NEW_QSTR(MP_QSTR_TX1), MP_ROM_PTR(&pin_PB12) }, + { MP_OBJ_NEW_QSTR(MP_QSTR_RX2), MP_ROM_PTR(&pin_PC23) }, + { MP_OBJ_NEW_QSTR(MP_QSTR_D18), MP_ROM_PTR(&pin_PB12) }, - { MP_OBJ_NEW_QSTR(MP_QSTR_RX1), MP_ROM_PTR(&pin_PB13) }, + { MP_OBJ_NEW_QSTR(MP_QSTR_TX1), MP_ROM_PTR(&pin_PB12) }, + { MP_OBJ_NEW_QSTR(MP_QSTR_D19), MP_ROM_PTR(&pin_PB13) }, + { MP_OBJ_NEW_QSTR(MP_QSTR_RX1), MP_ROM_PTR(&pin_PB13) }, + { MP_OBJ_NEW_QSTR(MP_QSTR_D20), MP_ROM_PTR(&pin_PB20) }, { MP_OBJ_NEW_QSTR(MP_QSTR_SDA), MP_ROM_PTR(&pin_PB20) }, + { MP_OBJ_NEW_QSTR(MP_QSTR_D21), MP_ROM_PTR(&pin_PB21) }, { MP_OBJ_NEW_QSTR(MP_QSTR_SCL), MP_ROM_PTR(&pin_PB21) }, { MP_OBJ_NEW_QSTR(MP_QSTR_D22), MP_ROM_PTR(&pin_PD12) }, { MP_OBJ_NEW_QSTR(MP_QSTR_D23), MP_ROM_PTR(&pin_PA15) }, + { MP_OBJ_NEW_QSTR(MP_QSTR_D24), MP_ROM_PTR(&pin_PC17) }, { MP_OBJ_NEW_QSTR(MP_QSTR_SCL1), MP_ROM_PTR(&pin_PC17) }, + { MP_OBJ_NEW_QSTR(MP_QSTR_D25), MP_ROM_PTR(&pin_PC16) }, { MP_OBJ_NEW_QSTR(MP_QSTR_SDA1), MP_ROM_PTR(&pin_PC16) }, + { MP_OBJ_NEW_QSTR(MP_QSTR_D26), MP_ROM_PTR(&pin_PA12) }, { MP_OBJ_NEW_QSTR(MP_QSTR_PCC_DEN1), MP_ROM_PTR(&pin_PA12) }, + { MP_OBJ_NEW_QSTR(MP_QSTR_D27), MP_ROM_PTR(&pin_PA13) }, { MP_OBJ_NEW_QSTR(MP_QSTR_PCC_DEN2), MP_ROM_PTR(&pin_PA13) }, + { MP_OBJ_NEW_QSTR(MP_QSTR_D28), MP_ROM_PTR(&pin_PA14) }, { MP_OBJ_NEW_QSTR(MP_QSTR_PCC_CLK), MP_ROM_PTR(&pin_PA14) }, + { MP_OBJ_NEW_QSTR(MP_QSTR_D29), MP_ROM_PTR(&pin_PB19) }, { MP_OBJ_NEW_QSTR(MP_QSTR_PCC_XCLK), MP_ROM_PTR(&pin_PB19) }, + { MP_OBJ_NEW_QSTR(MP_QSTR_D30), MP_ROM_PTR(&pin_PA23) }, { MP_OBJ_NEW_QSTR(MP_QSTR_PCC_D7), MP_ROM_PTR(&pin_PA23) }, + { MP_OBJ_NEW_QSTR(MP_QSTR_D31), MP_ROM_PTR(&pin_PA22) }, { MP_OBJ_NEW_QSTR(MP_QSTR_PCC_D6), MP_ROM_PTR(&pin_PA22) }, + { MP_OBJ_NEW_QSTR(MP_QSTR_D32), MP_ROM_PTR(&pin_PA21) }, { MP_OBJ_NEW_QSTR(MP_QSTR_PCC_D5), MP_ROM_PTR(&pin_PA21) }, + { MP_OBJ_NEW_QSTR(MP_QSTR_D33), MP_ROM_PTR(&pin_PA20) }, { MP_OBJ_NEW_QSTR(MP_QSTR_PCC_D4), MP_ROM_PTR(&pin_PA20) }, + { MP_OBJ_NEW_QSTR(MP_QSTR_D34), MP_ROM_PTR(&pin_PA19) }, { MP_OBJ_NEW_QSTR(MP_QSTR_PCC_D3), MP_ROM_PTR(&pin_PA19) }, + { MP_OBJ_NEW_QSTR(MP_QSTR_D35), MP_ROM_PTR(&pin_PA18) }, { MP_OBJ_NEW_QSTR(MP_QSTR_PCC_D2), MP_ROM_PTR(&pin_PA18) }, + { MP_OBJ_NEW_QSTR(MP_QSTR_D36), MP_ROM_PTR(&pin_PA17) }, { MP_OBJ_NEW_QSTR(MP_QSTR_PCC_D1), MP_ROM_PTR(&pin_PA17) }, + { MP_OBJ_NEW_QSTR(MP_QSTR_D37), MP_ROM_PTR(&pin_PA16) }, { MP_OBJ_NEW_QSTR(MP_QSTR_PCC_D0), MP_ROM_PTR(&pin_PA16) }, + { MP_OBJ_NEW_QSTR(MP_QSTR_D38), MP_ROM_PTR(&pin_PB15) }, { MP_OBJ_NEW_QSTR(MP_QSTR_PCC_D9), MP_ROM_PTR(&pin_PB15) }, + { MP_OBJ_NEW_QSTR(MP_QSTR_D39), MP_ROM_PTR(&pin_PB14) }, { MP_OBJ_NEW_QSTR(MP_QSTR_PCC_D8), MP_ROM_PTR(&pin_PB14) }, + { MP_OBJ_NEW_QSTR(MP_QSTR_D40), MP_ROM_PTR(&pin_PC13) }, { MP_OBJ_NEW_QSTR(MP_QSTR_PCC_D11), MP_ROM_PTR(&pin_PC13) }, + { MP_OBJ_NEW_QSTR(MP_QSTR_D41), MP_ROM_PTR(&pin_PC12) }, { MP_OBJ_NEW_QSTR(MP_QSTR_PCC_D10), MP_ROM_PTR(&pin_PC12) }, + { MP_OBJ_NEW_QSTR(MP_QSTR_D42), MP_ROM_PTR(&pin_PC15) }, { MP_OBJ_NEW_QSTR(MP_QSTR_PCC_D13), MP_ROM_PTR(&pin_PC15) }, + { MP_OBJ_NEW_QSTR(MP_QSTR_D43), MP_ROM_PTR(&pin_PC14) }, { MP_OBJ_NEW_QSTR(MP_QSTR_PCC_D12), MP_ROM_PTR(&pin_PC14) }, + { MP_OBJ_NEW_QSTR(MP_QSTR_D44), MP_ROM_PTR(&pin_PC11) }, { MP_OBJ_NEW_QSTR(MP_QSTR_D45), MP_ROM_PTR(&pin_PC10) }, { MP_OBJ_NEW_QSTR(MP_QSTR_D46), MP_ROM_PTR(&pin_PC06) }, { MP_OBJ_NEW_QSTR(MP_QSTR_D47), MP_ROM_PTR(&pin_PC07) }, { MP_OBJ_NEW_QSTR(MP_QSTR_D48), MP_ROM_PTR(&pin_PC04) }, { MP_OBJ_NEW_QSTR(MP_QSTR_D49), MP_ROM_PTR(&pin_PC05) }, + { MP_OBJ_NEW_QSTR(MP_QSTR_D50), MP_ROM_PTR(&pin_PD11) }, { MP_OBJ_NEW_QSTR(MP_QSTR_MISO), MP_ROM_PTR(&pin_PD11) }, + { MP_OBJ_NEW_QSTR(MP_QSTR_D51), MP_ROM_PTR(&pin_PD08) }, { MP_OBJ_NEW_QSTR(MP_QSTR_MOSI), MP_ROM_PTR(&pin_PD08) }, + { MP_OBJ_NEW_QSTR(MP_QSTR_D52), MP_ROM_PTR(&pin_PD09) }, { MP_OBJ_NEW_QSTR(MP_QSTR_SCK), MP_ROM_PTR(&pin_PD09) }, + { MP_OBJ_NEW_QSTR(MP_QSTR_D53), MP_ROM_PTR(&pin_PD10) }, { MP_OBJ_NEW_QSTR(MP_QSTR_SS), MP_ROM_PTR(&pin_PD10) }, diff --git a/ports/atmel-samd/boards/hallowing_m0_express/board.c b/ports/atmel-samd/boards/hallowing_m0_express/board.c index aace060b01..701dc4a8ec 100644 --- a/ports/atmel-samd/boards/hallowing_m0_express/board.c +++ b/ports/atmel-samd/boards/hallowing_m0_express/board.c @@ -104,22 +104,14 @@ void board_init(void) { sizeof(display_init_sequence), &pin_PA00, NO_BRIGHTNESS_COMMAND, - 1.0f, // brightness (ignored) - true, // auto_brightness + 1.0f, // brightness false, // single_byte_bounds false, // data_as_commands true, // auto_refresh 60, // native_frames_per_second true, // backlight_on_high - false); // not SH1107 + false, // not SH1107 + 50000); // backlight pwm frequency } -bool board_requests_safe_mode(void) { - return false; -} - -void reset_board(void) { -} - -void board_deinit(void) { -} +// Use the MP_WEAK supervisor/shared/board.c versions of routines not defined here. diff --git a/ports/atmel-samd/boards/hallowing_m4_express/board.c b/ports/atmel-samd/boards/hallowing_m4_express/board.c index 358c326b62..5003c904bc 100644 --- a/ports/atmel-samd/boards/hallowing_m4_express/board.c +++ b/ports/atmel-samd/boards/hallowing_m4_express/board.c @@ -84,22 +84,14 @@ void board_init(void) { sizeof(display_init_sequence), &pin_PB14, // backlight pin NO_BRIGHTNESS_COMMAND, - 1.0f, // brightness (ignored) - true, // auto_brightness + 1.0f, // brightness false, // single_byte_bounds false, // data_as_commands true, // auto_refresh 60, // native_frames_per_second true, // backlight_on_high - false); // not SH1107 + false, // not SH1107 + 50000); // backlight pwm frequency } -bool board_requests_safe_mode(void) { - return false; -} - -void reset_board(void) { -} - -void board_deinit(void) { -} +// Use the MP_WEAK supervisor/shared/board.c versions of routines not defined here. diff --git a/ports/atmel-samd/boards/hallowing_m4_express/mpconfigboard.mk b/ports/atmel-samd/boards/hallowing_m4_express/mpconfigboard.mk index 1154d0bb1f..51fccc56e5 100644 --- a/ports/atmel-samd/boards/hallowing_m4_express/mpconfigboard.mk +++ b/ports/atmel-samd/boards/hallowing_m4_express/mpconfigboard.mk @@ -7,5 +7,5 @@ CHIP_VARIANT = SAMD51J19A CHIP_FAMILY = samd51 QSPI_FLASH_FILESYSTEM = 1 -EXTERNAL_FLASH_DEVICES = GD25Q64C +EXTERNAL_FLASH_DEVICES = "GD25Q64C,W25Q64JVxQ" LONGINT_IMPL = MPZ diff --git a/ports/atmel-samd/boards/huntercat_nfc/board.c b/ports/atmel-samd/boards/huntercat_nfc/board.c index 9f91617a17..fb1ce4fb83 100644 --- a/ports/atmel-samd/boards/huntercat_nfc/board.c +++ b/ports/atmel-samd/boards/huntercat_nfc/board.c @@ -26,15 +26,4 @@ #include "supervisor/board.h" -void board_init(void) { -} - -bool board_requests_safe_mode(void) { - return false; -} - -void reset_board(void) { -} - -void board_deinit(void) { -} +// Use the MP_WEAK supervisor/shared/board.c versions of routines not defined here. diff --git a/ports/atmel-samd/boards/itsybitsy_m0_express/board.c b/ports/atmel-samd/boards/itsybitsy_m0_express/board.c index 9f91617a17..fb1ce4fb83 100644 --- a/ports/atmel-samd/boards/itsybitsy_m0_express/board.c +++ b/ports/atmel-samd/boards/itsybitsy_m0_express/board.c @@ -26,15 +26,4 @@ #include "supervisor/board.h" -void board_init(void) { -} - -bool board_requests_safe_mode(void) { - return false; -} - -void reset_board(void) { -} - -void board_deinit(void) { -} +// Use the MP_WEAK supervisor/shared/board.c versions of routines not defined here. diff --git a/ports/atmel-samd/boards/itsybitsy_m4_express/board.c b/ports/atmel-samd/boards/itsybitsy_m4_express/board.c index e0a7487bd2..fb1ce4fb83 100644 --- a/ports/atmel-samd/boards/itsybitsy_m4_express/board.c +++ b/ports/atmel-samd/boards/itsybitsy_m4_express/board.c @@ -25,18 +25,5 @@ */ #include "supervisor/board.h" -#include "mpconfigboard.h" -#include "hal/include/hal_gpio.h" -void board_init(void) { -} - -bool board_requests_safe_mode(void) { - return false; -} - -void reset_board(void) { -} - -void board_deinit(void) { -} +// Use the MP_WEAK supervisor/shared/board.c versions of routines not defined here. diff --git a/ports/atmel-samd/boards/kicksat-sprite/board.c b/ports/atmel-samd/boards/kicksat-sprite/board.c index df7bd70dad..b22d8ae366 100644 --- a/ports/atmel-samd/boards/kicksat-sprite/board.c +++ b/ports/atmel-samd/boards/kicksat-sprite/board.c @@ -25,20 +25,6 @@ */ -#include - #include "supervisor/board.h" -#include "py/mpconfig.h" -void board_init(void) { -} - -bool board_requests_safe_mode(void) { - return false; -} - -void reset_board(void) { -} - -void board_deinit(void) { -} +// Use the MP_WEAK supervisor/shared/board.c versions of routines not defined here. diff --git a/ports/atmel-samd/boards/kicksat-sprite/mpconfigboard.mk b/ports/atmel-samd/boards/kicksat-sprite/mpconfigboard.mk index 11abb8a727..9bc50ab429 100644 --- a/ports/atmel-samd/boards/kicksat-sprite/mpconfigboard.mk +++ b/ports/atmel-samd/boards/kicksat-sprite/mpconfigboard.mk @@ -27,6 +27,8 @@ CIRCUITPY_PS2IO = 0 CIRCUITPY_RGBMATRIX = 0 CIRCUITPY_ROTARYIO = 0 CIRCUITPY_TOUCHIO = 0 +CIRCUITPY_USB_HID = 0 +CIRCUITPY_USB_MIDI = 0 CIRCUITPY_ULAB = 0 diff --git a/ports/atmel-samd/boards/loc_ber_m4_base_board/board.c b/ports/atmel-samd/boards/loc_ber_m4_base_board/board.c index e0a7487bd2..fb1ce4fb83 100644 --- a/ports/atmel-samd/boards/loc_ber_m4_base_board/board.c +++ b/ports/atmel-samd/boards/loc_ber_m4_base_board/board.c @@ -25,18 +25,5 @@ */ #include "supervisor/board.h" -#include "mpconfigboard.h" -#include "hal/include/hal_gpio.h" -void board_init(void) { -} - -bool board_requests_safe_mode(void) { - return false; -} - -void reset_board(void) { -} - -void board_deinit(void) { -} +// Use the MP_WEAK supervisor/shared/board.c versions of routines not defined here. diff --git a/ports/atmel-samd/boards/matrixportal_m4/board.c b/ports/atmel-samd/boards/matrixportal_m4/board.c index 1d9b33a40c..65d7297ed9 100644 --- a/ports/atmel-samd/boards/matrixportal_m4/board.c +++ b/ports/atmel-samd/boards/matrixportal_m4/board.c @@ -25,18 +25,5 @@ */ #include "supervisor/board.h" -#include "mpconfigboard.h" -#include "hal/include/hal_gpio.h" -void board_init(void) { -} - -bool board_requests_safe_mode(void) { - return false; -} - -void reset_board(void) { -} - -void board_deinit(void) { -} +// Use the MP_WEAK supervisor/shared/board.c versions of routines not defined here. diff --git a/ports/atmel-samd/boards/matrixportal_m4/mpconfigboard.mk b/ports/atmel-samd/boards/matrixportal_m4/mpconfigboard.mk index fdedf9bc9b..1f77c11931 100644 --- a/ports/atmel-samd/boards/matrixportal_m4/mpconfigboard.mk +++ b/ports/atmel-samd/boards/matrixportal_m4/mpconfigboard.mk @@ -10,15 +10,16 @@ QSPI_FLASH_FILESYSTEM = 1 EXTERNAL_FLASH_DEVICES = "S25FL116K, S25FL216K, GD25Q16C" LONGINT_IMPL = MPZ +CIRCUITPY_LTO_PARTITION = one + CIRCUITPY_AESIO = 0 -CIRCUITPY_ONEWIREIO = 0 +CIRCUITPY_FLOPPYIO = 0 CIRCUITPY_PARALLELDISPLAY = 0 -CIRCUITPY_SDCARDIO = 0 CIRCUITPY_SHARPDISPLAY = 0 -CIRCUITPY_TRACEBACK = 0 -CIRCUITPY_ZLIB=0 +CIRCUITPY_ULAB = 0 # Include these Python libraries in firmware. FROZEN_MPY_DIRS += $(TOP)/frozen/Adafruit_CircuitPython_Requests +FROZEN_MPY_DIRS += $(TOP)/frozen/Adafruit_CircuitPython_PortalBase FROZEN_MPY_DIRS += $(TOP)/frozen/Adafruit_CircuitPython_ESP32SPI FROZEN_MPY_DIRS += $(TOP)/frozen/Adafruit_CircuitPython_NeoPixel diff --git a/ports/atmel-samd/boards/meowmeow/board.c b/ports/atmel-samd/boards/meowmeow/board.c index bfc3bade9d..a3c19899e8 100644 --- a/ports/atmel-samd/boards/meowmeow/board.c +++ b/ports/atmel-samd/boards/meowmeow/board.c @@ -26,15 +26,4 @@ #include "supervisor/board.h" -void board_init(void) { -} - -bool board_requests_safe_mode(void) { - return false; -} - -void reset_board(void) { -} - -void board_deinit(void) { -} +// Use the MP_WEAK supervisor/shared/board.c versions of routines not defined here. diff --git a/ports/atmel-samd/boards/metro_m0_express/board.c b/ports/atmel-samd/boards/metro_m0_express/board.c index 5725a67dcc..f56275c016 100644 --- a/ports/atmel-samd/boards/metro_m0_express/board.c +++ b/ports/atmel-samd/boards/metro_m0_express/board.c @@ -39,12 +39,4 @@ void board_init(void) { // port_pin_set_output_level(MICROPY_HW_LED_RX, true); } -bool board_requests_safe_mode(void) { - return false; -} - -void reset_board(void) { -} - -void board_deinit(void) { -} +// Use the MP_WEAK supervisor/shared/board.c versions of routines not defined here. diff --git a/ports/atmel-samd/boards/metro_m0_express/mpconfigboard.mk b/ports/atmel-samd/boards/metro_m0_express/mpconfigboard.mk index 1914c85990..4e7d799985 100644 --- a/ports/atmel-samd/boards/metro_m0_express/mpconfigboard.mk +++ b/ports/atmel-samd/boards/metro_m0_express/mpconfigboard.mk @@ -9,5 +9,3 @@ CHIP_FAMILY = samd21 SPI_FLASH_FILESYSTEM = 1 EXTERNAL_FLASH_DEVICES = "S25FL216K, GD25Q16C" LONGINT_IMPL = MPZ - -CIRCUITPY_ONEWIREIO = 0 diff --git a/ports/atmel-samd/boards/metro_m4_airlift_lite/board.c b/ports/atmel-samd/boards/metro_m4_airlift_lite/board.c index e0a7487bd2..1bba99ac06 100644 --- a/ports/atmel-samd/boards/metro_m4_airlift_lite/board.c +++ b/ports/atmel-samd/boards/metro_m4_airlift_lite/board.c @@ -28,15 +28,4 @@ #include "mpconfigboard.h" #include "hal/include/hal_gpio.h" -void board_init(void) { -} - -bool board_requests_safe_mode(void) { - return false; -} - -void reset_board(void) { -} - -void board_deinit(void) { -} +// Use the MP_WEAK supervisor/shared/board.c versions of routines not defined here. diff --git a/ports/atmel-samd/boards/metro_m4_express/board.c b/ports/atmel-samd/boards/metro_m4_express/board.c index e0a7487bd2..fb1ce4fb83 100644 --- a/ports/atmel-samd/boards/metro_m4_express/board.c +++ b/ports/atmel-samd/boards/metro_m4_express/board.c @@ -25,18 +25,5 @@ */ #include "supervisor/board.h" -#include "mpconfigboard.h" -#include "hal/include/hal_gpio.h" -void board_init(void) { -} - -bool board_requests_safe_mode(void) { - return false; -} - -void reset_board(void) { -} - -void board_deinit(void) { -} +// Use the MP_WEAK supervisor/shared/board.c versions of routines not defined here. diff --git a/ports/atmel-samd/boards/mini_sam_m4/board.c b/ports/atmel-samd/boards/mini_sam_m4/board.c index e0a7487bd2..1bba99ac06 100644 --- a/ports/atmel-samd/boards/mini_sam_m4/board.c +++ b/ports/atmel-samd/boards/mini_sam_m4/board.c @@ -28,15 +28,4 @@ #include "mpconfigboard.h" #include "hal/include/hal_gpio.h" -void board_init(void) { -} - -bool board_requests_safe_mode(void) { - return false; -} - -void reset_board(void) { -} - -void board_deinit(void) { -} +// Use the MP_WEAK supervisor/shared/board.c versions of routines not defined here. diff --git a/ports/atmel-samd/boards/monster_m4sk/board.c b/ports/atmel-samd/boards/monster_m4sk/board.c index e4e5da3ea5..76c96bba82 100644 --- a/ports/atmel-samd/boards/monster_m4sk/board.c +++ b/ports/atmel-samd/boards/monster_m4sk/board.c @@ -85,22 +85,14 @@ void board_init(void) { sizeof(display_init_sequence), &pin_PA23, // backlight pin NO_BRIGHTNESS_COMMAND, - 1.0f, // brightness (ignored) - true, // auto_brightness + 1.0f, // brightness false, // single_byte_bounds false, // data_as_commands true, // auto_refresh 60, // native_frames_per_second true, // backlight_on_high - false); // SH1107_addressing + false, // SH1107_addressing + 50000); // backlight pwm frequency } -bool board_requests_safe_mode(void) { - return false; -} - -void reset_board(void) { -} - -void board_deinit(void) { -} +// Use the MP_WEAK supervisor/shared/board.c versions of routines not defined here. diff --git a/ports/atmel-samd/boards/monster_m4sk/mpconfigboard.mk b/ports/atmel-samd/boards/monster_m4sk/mpconfigboard.mk index 86a04be87f..56dab1d788 100644 --- a/ports/atmel-samd/boards/monster_m4sk/mpconfigboard.mk +++ b/ports/atmel-samd/boards/monster_m4sk/mpconfigboard.mk @@ -7,5 +7,5 @@ CHIP_VARIANT = SAMD51J19A CHIP_FAMILY = samd51 QSPI_FLASH_FILESYSTEM = 1 -EXTERNAL_FLASH_DEVICES = GD25Q64C +EXTERNAL_FLASH_DEVICES = "GD25Q64C,W25Q64JVxQ" LONGINT_IMPL = MPZ diff --git a/ports/atmel-samd/boards/ndgarage_ndbit6/board.c b/ports/atmel-samd/boards/ndgarage_ndbit6/board.c index e0a7487bd2..fb1ce4fb83 100644 --- a/ports/atmel-samd/boards/ndgarage_ndbit6/board.c +++ b/ports/atmel-samd/boards/ndgarage_ndbit6/board.c @@ -25,18 +25,5 @@ */ #include "supervisor/board.h" -#include "mpconfigboard.h" -#include "hal/include/hal_gpio.h" -void board_init(void) { -} - -bool board_requests_safe_mode(void) { - return false; -} - -void reset_board(void) { -} - -void board_deinit(void) { -} +// Use the MP_WEAK supervisor/shared/board.c versions of routines not defined here. diff --git a/ports/atmel-samd/boards/ndgarage_ndbit6_v2/board.c b/ports/atmel-samd/boards/ndgarage_ndbit6_v2/board.c index e0a7487bd2..fb1ce4fb83 100644 --- a/ports/atmel-samd/boards/ndgarage_ndbit6_v2/board.c +++ b/ports/atmel-samd/boards/ndgarage_ndbit6_v2/board.c @@ -25,18 +25,5 @@ */ #include "supervisor/board.h" -#include "mpconfigboard.h" -#include "hal/include/hal_gpio.h" -void board_init(void) { -} - -bool board_requests_safe_mode(void) { - return false; -} - -void reset_board(void) { -} - -void board_deinit(void) { -} +// Use the MP_WEAK supervisor/shared/board.c versions of routines not defined here. diff --git a/ports/atmel-samd/boards/neopixel_trinkey_m0/board.c b/ports/atmel-samd/boards/neopixel_trinkey_m0/board.c index f97d38a1a7..ed54817129 100644 --- a/ports/atmel-samd/boards/neopixel_trinkey_m0/board.c +++ b/ports/atmel-samd/boards/neopixel_trinkey_m0/board.c @@ -29,16 +29,8 @@ #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) { board_reset_user_neopixels(&pin_PA05, 4); } -void board_deinit(void) { -} +// Use the MP_WEAK supervisor/shared/board.c versions of routines not defined here. diff --git a/ports/atmel-samd/boards/nfc_copy_cat/board.c b/ports/atmel-samd/boards/nfc_copy_cat/board.c index 9f91617a17..fb1ce4fb83 100644 --- a/ports/atmel-samd/boards/nfc_copy_cat/board.c +++ b/ports/atmel-samd/boards/nfc_copy_cat/board.c @@ -26,15 +26,4 @@ #include "supervisor/board.h" -void board_init(void) { -} - -bool board_requests_safe_mode(void) { - return false; -} - -void reset_board(void) { -} - -void board_deinit(void) { -} +// Use the MP_WEAK supervisor/shared/board.c versions of routines not defined here. diff --git a/ports/atmel-samd/boards/openbook_m4/board.c b/ports/atmel-samd/boards/openbook_m4/board.c index 40512b9416..30537dd3f4 100644 --- a/ports/atmel-samd/boards/openbook_m4/board.c +++ b/ports/atmel-samd/boards/openbook_m4/board.c @@ -102,12 +102,4 @@ void board_init(void) { false); // two_byte_sequence_length } -bool board_requests_safe_mode(void) { - return false; -} - -void reset_board(void) { -} - -void board_deinit(void) { -} +// Use the MP_WEAK supervisor/shared/board.c versions of routines not defined here. diff --git a/ports/atmel-samd/boards/openbook_m4/mpconfigboard.mk b/ports/atmel-samd/boards/openbook_m4/mpconfigboard.mk index 85b2dd4205..c46ed6a9fd 100644 --- a/ports/atmel-samd/boards/openbook_m4/mpconfigboard.mk +++ b/ports/atmel-samd/boards/openbook_m4/mpconfigboard.mk @@ -10,4 +10,4 @@ QSPI_FLASH_FILESYSTEM = 1 EXTERNAL_FLASH_DEVICES = GD25Q16C LONGINT_IMPL = MPZ -CIRCUITPY_GAMEPADSHIFT = 1 +CIRCUITPY_KEYPAD = 1 diff --git a/ports/atmel-samd/boards/pewpew10/board.c b/ports/atmel-samd/boards/pewpew10/board.c index 9f91617a17..fb1ce4fb83 100644 --- a/ports/atmel-samd/boards/pewpew10/board.c +++ b/ports/atmel-samd/boards/pewpew10/board.c @@ -26,15 +26,4 @@ #include "supervisor/board.h" -void board_init(void) { -} - -bool board_requests_safe_mode(void) { - return false; -} - -void reset_board(void) { -} - -void board_deinit(void) { -} +// Use the MP_WEAK supervisor/shared/board.c versions of routines not defined here. diff --git a/ports/atmel-samd/boards/pewpew_lcd/board.c b/ports/atmel-samd/boards/pewpew_lcd/board.c index 8198a3c83d..f4060571bf 100644 --- a/ports/atmel-samd/boards/pewpew_lcd/board.c +++ b/ports/atmel-samd/boards/pewpew_lcd/board.c @@ -84,21 +84,13 @@ void board_init(void) { NULL, // &pin_PA17, // brightness pin NO_BRIGHTNESS_COMMAND, 0.0f, // brightness - false, // auto_brightness false, // single_byte_bounds true, // data as commands true, // auto_refresh 2, // native_frames_per_second true, // backlight_on_high - true); // SH1107_addressing + true, // SH1107_addressing + 50000); // backlight pwm frequency } -bool board_requests_safe_mode(void) { - return false; -} - -void reset_board(void) { -} - -void board_deinit(void) { -} +// Use the MP_WEAK supervisor/shared/board.c versions of routines not defined here. diff --git a/ports/atmel-samd/boards/pewpew_lcd/mpconfigboard.mk b/ports/atmel-samd/boards/pewpew_lcd/mpconfigboard.mk index 2bf4992e25..94d0530ce2 100644 --- a/ports/atmel-samd/boards/pewpew_lcd/mpconfigboard.mk +++ b/ports/atmel-samd/boards/pewpew_lcd/mpconfigboard.mk @@ -33,7 +33,7 @@ CIRCUITPY_BLEIO = 0 CIRCUITPY_BUSDEVICE = 0 CIRCUITPY_FRAMEBUFFERIO = 0 CIRCUITPY_FREQUENCYIO = 0 -CIRCUITPY_I2CPERIPHERAL = 0 +CIRCUITPY_I2CTARGET = 0 CIRCUITPY_MSGPACK = 0 CIRCUITPY_NEOPIXEL_WRITE = 0 CIRCUITPY_NVM = 0 diff --git a/ports/atmel-samd/boards/pewpew_m4/board.c b/ports/atmel-samd/boards/pewpew_m4/board.c index 50f829fa88..c36388f933 100644 --- a/ports/atmel-samd/boards/pewpew_m4/board.c +++ b/ports/atmel-samd/boards/pewpew_m4/board.c @@ -137,22 +137,14 @@ void board_init(void) { sizeof(display_init_sequence), NULL, // backlight pin NO_BRIGHTNESS_COMMAND, - 1.0f, // brightness (ignored) - true, // auto_brightness + 1.0f, // brightness false, // single_byte_bounds false, // data_as_commands false, // auto_refresh 20, // native_frames_per_second true, // backlight_on_high - false); // SH1107_addressing + false, // SH1107_addressing + 50000); // backlight pwm frequency } -bool board_requests_safe_mode(void) { - return false; -} - -void reset_board(void) { -} - -void board_deinit(void) { -} +// Use the MP_WEAK supervisor/shared/board.c versions of routines not defined here. diff --git a/ports/atmel-samd/boards/pewpew_m4/mpconfigboard.mk b/ports/atmel-samd/boards/pewpew_m4/mpconfigboard.mk index cffbaf619a..bcf3e132d3 100644 --- a/ports/atmel-samd/boards/pewpew_m4/mpconfigboard.mk +++ b/ports/atmel-samd/boards/pewpew_m4/mpconfigboard.mk @@ -18,7 +18,7 @@ CIRCUITPY_AUDIOPWMIO = 0 CIRCUITPY_BITBANGIO = 0 CIRCUITPY_BITBANG_APA102 = 0 CIRCUITPY_FREQUENCYIO = 0 -CIRCUITPY_I2CPERIPHERAL = 0 +CIRCUITPY_I2CTARGET = 0 CIRCUITPY_NEOPIXEL_WRITE = 0 CIRCUITPY_PARALLELDISPLAY = 0 CIRCUITPY_PIXELBUF = 0 @@ -33,6 +33,8 @@ CIRCUITPY_USB_CDC = 0 CIRCUITPY_USB_HID = 0 CIRCUITPY_USB_MIDI = 0 CIRCUITPY_VECTORIO = 0 +CIRCUITPY_BUSDEVICE = 0 +CIRCUITPY_BITMAPTOOLS = 0 CIRCUITPY_ANALOGIO = 1 CIRCUITPY_AUDIOIO = 1 @@ -42,6 +44,7 @@ CIRCUITPY_KEYPAD = 1 CIRCUITPY_MATH = 1 CIRCUITPY_STAGE = 1 CIRCUITPY_SYNTHIO = 1 +CIRCUITPY_ZLIB = 1 FROZEN_MPY_DIRS += $(TOP)/frozen/circuitpython-stage/pewpew_m4 CIRCUITPY_DISPLAY_FONT = $(TOP)/ports/atmel-samd/boards/ugame10/brutalist-6.bdf diff --git a/ports/atmel-samd/boards/picoplanet/board.c b/ports/atmel-samd/boards/picoplanet/board.c index 9f91617a17..fb1ce4fb83 100644 --- a/ports/atmel-samd/boards/picoplanet/board.c +++ b/ports/atmel-samd/boards/picoplanet/board.c @@ -26,15 +26,4 @@ #include "supervisor/board.h" -void board_init(void) { -} - -bool board_requests_safe_mode(void) { - return false; -} - -void reset_board(void) { -} - -void board_deinit(void) { -} +// Use the MP_WEAK supervisor/shared/board.c versions of routines not defined here. diff --git a/ports/atmel-samd/boards/pybadge/board.c b/ports/atmel-samd/boards/pybadge/board.c index ce5beb6bc3..a1cb3a0714 100644 --- a/ports/atmel-samd/boards/pybadge/board.c +++ b/ports/atmel-samd/boards/pybadge/board.c @@ -33,8 +33,6 @@ #include "shared-module/displayio/mipi_constants.h" #include "supervisor/shared/board.h" -displayio_fourwire_obj_t board_display_obj; - #define DELAY 0x80 uint8_t display_init_sequence[] = { @@ -107,23 +105,18 @@ void board_init(void) { sizeof(display_init_sequence), &pin_PA01, // backlight pin NO_BRIGHTNESS_COMMAND, - 1.0f, // brightness (ignored) - true, // auto_brightness + 1.0f, // brightness false, // single_byte_bounds false, // data_as_commands true, // auto_refresh 60, // native_frames_per_second true, // backlight_on_high - false); // SH1107_addressing -} - -bool board_requests_safe_mode(void) { - return false; + false, // SH1107_addressing + 50000); // backlight pwm frequency } void reset_board(void) { board_reset_user_neopixels(&pin_PA15, 5); } -void board_deinit(void) { -} +// Use the MP_WEAK supervisor/shared/board.c versions of routines not defined here. diff --git a/ports/atmel-samd/boards/pybadge/mpconfigboard.mk b/ports/atmel-samd/boards/pybadge/mpconfigboard.mk index bbee2ee9a1..fd002609b1 100644 --- a/ports/atmel-samd/boards/pybadge/mpconfigboard.mk +++ b/ports/atmel-samd/boards/pybadge/mpconfigboard.mk @@ -12,8 +12,8 @@ LONGINT_IMPL = MPZ CIRCUITPY_AESIO = 0 CIRCUITPY_FRAMEBUFFERIO = 0 -CIRCUITPY_GAMEPADSHIFT = 1 CIRCUITPY_GIFIO = 0 +CIRCUITPY_KEYPAD = 1 CIRCUITPY_STAGE = 1 FROZEN_MPY_DIRS += $(TOP)/frozen/circuitpython-stage/pybadge diff --git a/ports/atmel-samd/boards/pycubed/board.c b/ports/atmel-samd/boards/pycubed/board.c index 41e4655102..f0e84103e2 100644 --- a/ports/atmel-samd/boards/pycubed/board.c +++ b/ports/atmel-samd/boards/pycubed/board.c @@ -36,12 +36,4 @@ void board_init(void) { common_hal_pwmio_pwmout_never_reset(&pwm); } -bool board_requests_safe_mode(void) { - return false; -} - -void reset_board(void) { -} - -void board_deinit(void) { -} +// Use the MP_WEAK supervisor/shared/board.c versions of routines not defined here. diff --git a/ports/atmel-samd/boards/pycubed_mram/board.c b/ports/atmel-samd/boards/pycubed_mram/board.c index 41e4655102..f0e84103e2 100644 --- a/ports/atmel-samd/boards/pycubed_mram/board.c +++ b/ports/atmel-samd/boards/pycubed_mram/board.c @@ -36,12 +36,4 @@ void board_init(void) { common_hal_pwmio_pwmout_never_reset(&pwm); } -bool board_requests_safe_mode(void) { - return false; -} - -void reset_board(void) { -} - -void board_deinit(void) { -} +// Use the MP_WEAK supervisor/shared/board.c versions of routines not defined here. diff --git a/ports/atmel-samd/boards/pycubed_mram_v05/board.c b/ports/atmel-samd/boards/pycubed_mram_v05/board.c index 41e4655102..f0e84103e2 100644 --- a/ports/atmel-samd/boards/pycubed_mram_v05/board.c +++ b/ports/atmel-samd/boards/pycubed_mram_v05/board.c @@ -36,12 +36,4 @@ void board_init(void) { common_hal_pwmio_pwmout_never_reset(&pwm); } -bool board_requests_safe_mode(void) { - return false; -} - -void reset_board(void) { -} - -void board_deinit(void) { -} +// Use the MP_WEAK supervisor/shared/board.c versions of routines not defined here. diff --git a/ports/atmel-samd/boards/pycubed_v05/board.c b/ports/atmel-samd/boards/pycubed_v05/board.c index 41e4655102..f0e84103e2 100644 --- a/ports/atmel-samd/boards/pycubed_v05/board.c +++ b/ports/atmel-samd/boards/pycubed_v05/board.c @@ -36,12 +36,4 @@ void board_init(void) { common_hal_pwmio_pwmout_never_reset(&pwm); } -bool board_requests_safe_mode(void) { - return false; -} - -void reset_board(void) { -} - -void board_deinit(void) { -} +// Use the MP_WEAK supervisor/shared/board.c versions of routines not defined here. diff --git a/ports/atmel-samd/boards/pygamer/board.c b/ports/atmel-samd/boards/pygamer/board.c index 9a85e166c4..8ff34f24c5 100644 --- a/ports/atmel-samd/boards/pygamer/board.c +++ b/ports/atmel-samd/boards/pygamer/board.c @@ -107,23 +107,18 @@ void board_init(void) { sizeof(display_init_sequence), &pin_PA01, // backlight pin NO_BRIGHTNESS_COMMAND, - 1.0f, // brightness (ignored) - true, // auto_brightness + 1.0f, // brightness false, // single_byte_bounds false, // data_as_commands true, // auto_refresh 60, // native_frames_per_second true, // backlight_on_high - false); // SH1107_addressing -} - -bool board_requests_safe_mode(void) { - return false; + false, // SH1107_addressing + 50000); // backlight pwm frequency } void reset_board(void) { board_reset_user_neopixels(&pin_PA15, 5); } -void board_deinit(void) { -} +// Use the MP_WEAK supervisor/shared/board.c versions of routines not defined here. diff --git a/ports/atmel-samd/boards/pygamer/mpconfigboard.mk b/ports/atmel-samd/boards/pygamer/mpconfigboard.mk index 26c3fe9d9b..f6112b4110 100644 --- a/ports/atmel-samd/boards/pygamer/mpconfigboard.mk +++ b/ports/atmel-samd/boards/pygamer/mpconfigboard.mk @@ -7,13 +7,13 @@ CHIP_VARIANT = SAMD51J19A CHIP_FAMILY = samd51 QSPI_FLASH_FILESYSTEM = 1 -EXTERNAL_FLASH_DEVICES = GD25Q64C +EXTERNAL_FLASH_DEVICES = "GD25Q64C,W25Q64JVxQ" LONGINT_IMPL = MPZ CIRCUITPY_AESIO = 0 CIRCUITPY_FRAMEBUFFERIO = 0 -CIRCUITPY_GAMEPADSHIFT = 1 CIRCUITPY_GIFIO = 0 +CIRCUITPY_KEYPAD = 1 CIRCUITPY_STAGE = 1 FROZEN_MPY_DIRS += $(TOP)/frozen/circuitpython-stage/pygamer diff --git a/ports/atmel-samd/boards/pyportal/board.c b/ports/atmel-samd/boards/pyportal/board.c index 262850cbf2..e304f6f24b 100644 --- a/ports/atmel-samd/boards/pyportal/board.c +++ b/ports/atmel-samd/boards/pyportal/board.c @@ -94,22 +94,14 @@ void board_init(void) { sizeof(display_init_sequence), &pin_PB31, // Backlight pin NO_BRIGHTNESS_COMMAND, - 1.0f, // brightness (ignored) - true, // auto_brightness + 1.0f, // brightness false, // single_byte_bounds false, // data_as_commands true, // auto_refresh 60, // native_frames_per_second true, // backlight_on_high - false); // SH1107_addressing + false, // SH1107_addressing + 50000); // backlight pwm frequency } -bool board_requests_safe_mode(void) { - return false; -} - -void reset_board(void) { -} - -void board_deinit(void) { -} +// Use the MP_WEAK supervisor/shared/board.c versions of routines not defined here. diff --git a/ports/atmel-samd/boards/pyportal_titano/board.c b/ports/atmel-samd/boards/pyportal_titano/board.c index 9fa7887a11..939a2dcc70 100644 --- a/ports/atmel-samd/boards/pyportal_titano/board.c +++ b/ports/atmel-samd/boards/pyportal_titano/board.c @@ -111,22 +111,14 @@ void board_init(void) { sizeof(display_init_sequence), &pin_PB31, // Backlight pin NO_BRIGHTNESS_COMMAND, - 1.0f, // brightness (ignored) - true, // auto_brightness + 1.0f, // brightness false, // single_byte_bounds false, // data_as_commands true, // auto_refresh 60, // native_frames_per_second true, // backlight_on_high - false); // SH1107_addressing + false, // SH1107_addressing + 500); // backlight_pwm_frequency } -bool board_requests_safe_mode(void) { - return false; -} - -void reset_board(void) { -} - -void board_deinit(void) { -} +// Use the MP_WEAK supervisor/shared/board.c versions of routines not defined here. diff --git a/ports/atmel-samd/boards/pyruler/board.c b/ports/atmel-samd/boards/pyruler/board.c index 9f91617a17..fb1ce4fb83 100644 --- a/ports/atmel-samd/boards/pyruler/board.c +++ b/ports/atmel-samd/boards/pyruler/board.c @@ -26,15 +26,4 @@ #include "supervisor/board.h" -void board_init(void) { -} - -bool board_requests_safe_mode(void) { - return false; -} - -void reset_board(void) { -} - -void board_deinit(void) { -} +// Use the MP_WEAK supervisor/shared/board.c versions of routines not defined here. diff --git a/ports/atmel-samd/boards/qtpy_m0/board.c b/ports/atmel-samd/boards/qtpy_m0/board.c index 9f91617a17..fb1ce4fb83 100644 --- a/ports/atmel-samd/boards/qtpy_m0/board.c +++ b/ports/atmel-samd/boards/qtpy_m0/board.c @@ -26,15 +26,4 @@ #include "supervisor/board.h" -void board_init(void) { -} - -bool board_requests_safe_mode(void) { - return false; -} - -void reset_board(void) { -} - -void board_deinit(void) { -} +// Use the MP_WEAK supervisor/shared/board.c versions of routines not defined here. diff --git a/ports/atmel-samd/boards/qtpy_m0_haxpress/board.c b/ports/atmel-samd/boards/qtpy_m0_haxpress/board.c index 9f91617a17..fb1ce4fb83 100644 --- a/ports/atmel-samd/boards/qtpy_m0_haxpress/board.c +++ b/ports/atmel-samd/boards/qtpy_m0_haxpress/board.c @@ -26,15 +26,4 @@ #include "supervisor/board.h" -void board_init(void) { -} - -bool board_requests_safe_mode(void) { - return false; -} - -void reset_board(void) { -} - -void board_deinit(void) { -} +// Use the MP_WEAK supervisor/shared/board.c versions of routines not defined here. diff --git a/ports/atmel-samd/boards/robohatmm1_m4/board.c b/ports/atmel-samd/boards/robohatmm1_m4/board.c index e0a7487bd2..fb1ce4fb83 100644 --- a/ports/atmel-samd/boards/robohatmm1_m4/board.c +++ b/ports/atmel-samd/boards/robohatmm1_m4/board.c @@ -25,18 +25,5 @@ */ #include "supervisor/board.h" -#include "mpconfigboard.h" -#include "hal/include/hal_gpio.h" -void board_init(void) { -} - -bool board_requests_safe_mode(void) { - return false; -} - -void reset_board(void) { -} - -void board_deinit(void) { -} +// Use the MP_WEAK supervisor/shared/board.c versions of routines not defined here. diff --git a/ports/atmel-samd/boards/sam32/board.c b/ports/atmel-samd/boards/sam32/board.c index c6d8c45b1f..106159ae4d 100644 --- a/ports/atmel-samd/boards/sam32/board.c +++ b/ports/atmel-samd/boards/sam32/board.c @@ -34,13 +34,6 @@ #include "shared-bindings/digitalio/DigitalInOut.h" #include "shared-bindings/neopixel_write/__init__.h" -void board_init(void) { -} - -bool board_requests_safe_mode(void) { - return false; -} - void reset_board(void) { uint8_t zeroes[96]; memset(zeroes, 0, 96); @@ -51,5 +44,4 @@ void reset_board(void) { common_hal_digitalio_digitalinout_deinit(&neopixel); } -void board_deinit(void) { -} +// Use the MP_WEAK supervisor/shared/board.c versions of routines not defined here. diff --git a/ports/atmel-samd/boards/same54_xplained/board.c b/ports/atmel-samd/boards/same54_xplained/board.c index f72884ffe8..7180deb278 100644 --- a/ports/atmel-samd/boards/same54_xplained/board.c +++ b/ports/atmel-samd/boards/same54_xplained/board.c @@ -25,18 +25,5 @@ */ #include "supervisor/board.h" -#include "mpconfigboard.h" -#include "hal/include/hal_gpio.h" -void board_init(void) { -} - -bool board_requests_safe_mode(void) { - return false; -} - -void reset_board(void) { -} - -void board_deinit(void) { -} +// Use the MP_WEAK supervisor/shared/board.c versions of routines not defined here. diff --git a/ports/atmel-samd/boards/seeeduino_wio_terminal/board.c b/ports/atmel-samd/boards/seeeduino_wio_terminal/board.c index 62b2299f56..2eddb41fd6 100644 --- a/ports/atmel-samd/boards/seeeduino_wio_terminal/board.c +++ b/ports/atmel-samd/boards/seeeduino_wio_terminal/board.c @@ -102,14 +102,14 @@ void board_init(void) { sizeof(display_init_sequence), &pin_PC05, // backlight pin NO_BRIGHTNESS_COMMAND, - 1.0f, // brightness (ignored) - true, // auto_brightness + 1.0f, // brightness false, // single_byte_bounds false, // data_as_commands true, // auto_refresh 60, // native_frames_per_second true, // backlight_on_high - false); // SH1107_addressing + false, // SH1107_addressing + 50000); // backlight pwm frequency // Enabling the Power of the 40-pin at the back CTR_5V.base.type = &digitalio_digitalinout_type; @@ -133,13 +133,6 @@ void board_init(void) { reset_pin_number(pin_PA18.number); } -bool board_requests_safe_mode(void) { - return false; -} - -void reset_board(void) { -} - void board_deinit(void) { common_hal_displayio_release_displays(); common_hal_digitalio_digitalinout_deinit(&CTR_5V); @@ -150,3 +143,5 @@ void board_deinit(void) { // Pin state is kept during BACKUP sleep. gpio_set_pin_direction(pin_PA18.number, GPIO_DIRECTION_OUT); } + +// Use the MP_WEAK supervisor/shared/board.c versions of routines not defined here. diff --git a/ports/atmel-samd/boards/seeeduino_xiao/board.c b/ports/atmel-samd/boards/seeeduino_xiao/board.c index e0a7487bd2..fb1ce4fb83 100644 --- a/ports/atmel-samd/boards/seeeduino_xiao/board.c +++ b/ports/atmel-samd/boards/seeeduino_xiao/board.c @@ -25,18 +25,5 @@ */ #include "supervisor/board.h" -#include "mpconfigboard.h" -#include "hal/include/hal_gpio.h" -void board_init(void) { -} - -bool board_requests_safe_mode(void) { - return false; -} - -void reset_board(void) { -} - -void board_deinit(void) { -} +// Use the MP_WEAK supervisor/shared/board.c versions of routines not defined here. diff --git a/ports/atmel-samd/boards/seeeduino_xiao_kb/board.c b/ports/atmel-samd/boards/seeeduino_xiao_kb/board.c index e0a7487bd2..fb1ce4fb83 100644 --- a/ports/atmel-samd/boards/seeeduino_xiao_kb/board.c +++ b/ports/atmel-samd/boards/seeeduino_xiao_kb/board.c @@ -25,18 +25,5 @@ */ #include "supervisor/board.h" -#include "mpconfigboard.h" -#include "hal/include/hal_gpio.h" -void board_init(void) { -} - -bool board_requests_safe_mode(void) { - return false; -} - -void reset_board(void) { -} - -void board_deinit(void) { -} +// Use the MP_WEAK supervisor/shared/board.c versions of routines not defined here. diff --git a/ports/atmel-samd/boards/seeeduino_xiao_kb/mpconfigboard.mk b/ports/atmel-samd/boards/seeeduino_xiao_kb/mpconfigboard.mk index 7a67048e0b..d0ff1fa05c 100644 --- a/ports/atmel-samd/boards/seeeduino_xiao_kb/mpconfigboard.mk +++ b/ports/atmel-samd/boards/seeeduino_xiao_kb/mpconfigboard.mk @@ -22,8 +22,8 @@ CIRCUITPY_RTC = 0 CIRCUITPY_MATH = 0 #CIRCUITPY_RANDOM = 0 CIRCUITPY_ONEWIREIO = 0 -#CIRCUITPY_NEOPIXEL_WRITE = 1 # Needed fo RGB LEDs -#CIRCUITPY_RAINBOWIO = 1 # Needed fo RGB LEDs +CIRCUITPY_NEOPIXEL_WRITE = 1 # Needed for RGB LEDs +CIRCUITPY_RAINBOWIO = 1 # Needed for RGB LEDs # These are used in a keyboard or computer input device. CIRCUITPY_ROTARYIO = 1 CIRCUITPY_KEYPAD = 1 diff --git a/ports/atmel-samd/boards/sensebox_mcu/board.c b/ports/atmel-samd/boards/sensebox_mcu/board.c index e0a7487bd2..fb1ce4fb83 100644 --- a/ports/atmel-samd/boards/sensebox_mcu/board.c +++ b/ports/atmel-samd/boards/sensebox_mcu/board.c @@ -25,18 +25,5 @@ */ #include "supervisor/board.h" -#include "mpconfigboard.h" -#include "hal/include/hal_gpio.h" -void board_init(void) { -} - -bool board_requests_safe_mode(void) { - return false; -} - -void reset_board(void) { -} - -void board_deinit(void) { -} +// Use the MP_WEAK supervisor/shared/board.c versions of routines not defined here. diff --git a/ports/atmel-samd/boards/sensebox_mcu/mpconfigboard.mk b/ports/atmel-samd/boards/sensebox_mcu/mpconfigboard.mk index ea14f63ad9..37c869e972 100644 --- a/ports/atmel-samd/boards/sensebox_mcu/mpconfigboard.mk +++ b/ports/atmel-samd/boards/sensebox_mcu/mpconfigboard.mk @@ -11,6 +11,4 @@ LONGINT_IMPL = NONE CIRCUITPY_FULL_BUILD = 0 # There are many pin definitions on this board; it doesn't quite fit on very large translations. -CIRCUITPY_ONEWIREIO = 0 -CIRCUITPY_RAINBOWIO = 0 CIRCUITPY_USB_MIDI = 0 diff --git a/ports/atmel-samd/boards/serpente/board.c b/ports/atmel-samd/boards/serpente/board.c index 9f91617a17..fb1ce4fb83 100644 --- a/ports/atmel-samd/boards/serpente/board.c +++ b/ports/atmel-samd/boards/serpente/board.c @@ -26,15 +26,4 @@ #include "supervisor/board.h" -void board_init(void) { -} - -bool board_requests_safe_mode(void) { - return false; -} - -void reset_board(void) { -} - -void board_deinit(void) { -} +// Use the MP_WEAK supervisor/shared/board.c versions of routines not defined here. diff --git a/ports/atmel-samd/boards/shirtty/board.c b/ports/atmel-samd/boards/shirtty/board.c index 9f91617a17..fb1ce4fb83 100644 --- a/ports/atmel-samd/boards/shirtty/board.c +++ b/ports/atmel-samd/boards/shirtty/board.c @@ -26,15 +26,4 @@ #include "supervisor/board.h" -void board_init(void) { -} - -bool board_requests_safe_mode(void) { - return false; -} - -void reset_board(void) { -} - -void board_deinit(void) { -} +// Use the MP_WEAK supervisor/shared/board.c versions of routines not defined here. diff --git a/ports/atmel-samd/boards/silicognition-m4-shim/board.c b/ports/atmel-samd/boards/silicognition-m4-shim/board.c index 289d68af29..f888faa2af 100644 --- a/ports/atmel-samd/boards/silicognition-m4-shim/board.c +++ b/ports/atmel-samd/boards/silicognition-m4-shim/board.c @@ -25,17 +25,7 @@ */ #include "supervisor/board.h" + +// Use the MP_WEAK supervisor/shared/board.c versions of routines not defined here. + #include "mpconfigboard.h" - -void board_init(void) { -} - -bool board_requests_safe_mode(void) { - return false; -} - -void reset_board(void) { -} - -void board_deinit(void) { -} diff --git a/ports/atmel-samd/boards/snekboard/board.c b/ports/atmel-samd/boards/snekboard/board.c index 9f91617a17..fb1ce4fb83 100644 --- a/ports/atmel-samd/boards/snekboard/board.c +++ b/ports/atmel-samd/boards/snekboard/board.c @@ -26,15 +26,4 @@ #include "supervisor/board.h" -void board_init(void) { -} - -bool board_requests_safe_mode(void) { - return false; -} - -void reset_board(void) { -} - -void board_deinit(void) { -} +// Use the MP_WEAK supervisor/shared/board.c versions of routines not defined here. diff --git a/ports/atmel-samd/boards/sparkfun_lumidrive/board.c b/ports/atmel-samd/boards/sparkfun_lumidrive/board.c index 9f91617a17..fb1ce4fb83 100644 --- a/ports/atmel-samd/boards/sparkfun_lumidrive/board.c +++ b/ports/atmel-samd/boards/sparkfun_lumidrive/board.c @@ -26,15 +26,4 @@ #include "supervisor/board.h" -void board_init(void) { -} - -bool board_requests_safe_mode(void) { - return false; -} - -void reset_board(void) { -} - -void board_deinit(void) { -} +// Use the MP_WEAK supervisor/shared/board.c versions of routines not defined here. diff --git a/ports/atmel-samd/boards/sparkfun_qwiic_micro_no_flash/board.c b/ports/atmel-samd/boards/sparkfun_qwiic_micro_no_flash/board.c index 9f91617a17..fb1ce4fb83 100644 --- a/ports/atmel-samd/boards/sparkfun_qwiic_micro_no_flash/board.c +++ b/ports/atmel-samd/boards/sparkfun_qwiic_micro_no_flash/board.c @@ -26,15 +26,4 @@ #include "supervisor/board.h" -void board_init(void) { -} - -bool board_requests_safe_mode(void) { - return false; -} - -void reset_board(void) { -} - -void board_deinit(void) { -} +// Use the MP_WEAK supervisor/shared/board.c versions of routines not defined here. diff --git a/ports/atmel-samd/boards/sparkfun_qwiic_micro_with_flash/board.c b/ports/atmel-samd/boards/sparkfun_qwiic_micro_with_flash/board.c index 9f91617a17..fb1ce4fb83 100644 --- a/ports/atmel-samd/boards/sparkfun_qwiic_micro_with_flash/board.c +++ b/ports/atmel-samd/boards/sparkfun_qwiic_micro_with_flash/board.c @@ -26,15 +26,4 @@ #include "supervisor/board.h" -void board_init(void) { -} - -bool board_requests_safe_mode(void) { - return false; -} - -void reset_board(void) { -} - -void board_deinit(void) { -} +// Use the MP_WEAK supervisor/shared/board.c versions of routines not defined here. diff --git a/ports/atmel-samd/boards/sparkfun_redboard_turbo/board.c b/ports/atmel-samd/boards/sparkfun_redboard_turbo/board.c index 9f91617a17..fb1ce4fb83 100644 --- a/ports/atmel-samd/boards/sparkfun_redboard_turbo/board.c +++ b/ports/atmel-samd/boards/sparkfun_redboard_turbo/board.c @@ -26,15 +26,4 @@ #include "supervisor/board.h" -void board_init(void) { -} - -bool board_requests_safe_mode(void) { - return false; -} - -void reset_board(void) { -} - -void board_deinit(void) { -} +// Use the MP_WEAK supervisor/shared/board.c versions of routines not defined here. diff --git a/ports/atmel-samd/boards/sparkfun_redboard_turbo/mpconfigboard.mk b/ports/atmel-samd/boards/sparkfun_redboard_turbo/mpconfigboard.mk index 7b97822bda..70ece9b9fc 100755 --- a/ports/atmel-samd/boards/sparkfun_redboard_turbo/mpconfigboard.mk +++ b/ports/atmel-samd/boards/sparkfun_redboard_turbo/mpconfigboard.mk @@ -9,5 +9,3 @@ CHIP_FAMILY = samd21 SPI_FLASH_FILESYSTEM = 1 EXTERNAL_FLASH_DEVICES = "W25Q32FV" LONGINT_IMPL = MPZ - -CIRCUITPY_ONEWIREIO = 0 diff --git a/ports/atmel-samd/boards/sparkfun_samd21_dev/board.c b/ports/atmel-samd/boards/sparkfun_samd21_dev/board.c index e0a7487bd2..1bba99ac06 100644 --- a/ports/atmel-samd/boards/sparkfun_samd21_dev/board.c +++ b/ports/atmel-samd/boards/sparkfun_samd21_dev/board.c @@ -28,15 +28,4 @@ #include "mpconfigboard.h" #include "hal/include/hal_gpio.h" -void board_init(void) { -} - -bool board_requests_safe_mode(void) { - return false; -} - -void reset_board(void) { -} - -void board_deinit(void) { -} +// Use the MP_WEAK supervisor/shared/board.c versions of routines not defined here. diff --git a/ports/atmel-samd/boards/sparkfun_samd21_mini/board.c b/ports/atmel-samd/boards/sparkfun_samd21_mini/board.c index e0a7487bd2..fb1ce4fb83 100644 --- a/ports/atmel-samd/boards/sparkfun_samd21_mini/board.c +++ b/ports/atmel-samd/boards/sparkfun_samd21_mini/board.c @@ -25,18 +25,5 @@ */ #include "supervisor/board.h" -#include "mpconfigboard.h" -#include "hal/include/hal_gpio.h" -void board_init(void) { -} - -bool board_requests_safe_mode(void) { - return false; -} - -void reset_board(void) { -} - -void board_deinit(void) { -} +// Use the MP_WEAK supervisor/shared/board.c versions of routines not defined here. diff --git a/ports/atmel-samd/boards/sparkfun_samd51_micromod/board.c b/ports/atmel-samd/boards/sparkfun_samd51_micromod/board.c index 9e862b3c01..b079679d33 100644 --- a/ports/atmel-samd/boards/sparkfun_samd51_micromod/board.c +++ b/ports/atmel-samd/boards/sparkfun_samd51_micromod/board.c @@ -30,19 +30,6 @@ #include "hal/include/hal_gpio.h" #include "supervisor/shared/external_flash/external_flash.h" -void board_init(void) { -} - -bool board_requests_safe_mode(void) { - return false; -} - -void reset_board(void) { -} - -void board_deinit(void) { -} - void external_flash_setup(void) { // Do not reset the external flash write-protect and hold pins high never_reset_pin_number(PIN_PB22); @@ -59,3 +46,5 @@ void external_flash_setup(void) { gpio_set_pin_direction(PIN_PB23, GPIO_DIRECTION_OUT); gpio_set_pin_level(PIN_PB23, true); } + +// Use the MP_WEAK supervisor/shared/board.c versions of routines not defined here. diff --git a/ports/atmel-samd/boards/sparkfun_samd51_thing_plus/board.c b/ports/atmel-samd/boards/sparkfun_samd51_thing_plus/board.c index 289d68af29..fb1ce4fb83 100644 --- a/ports/atmel-samd/boards/sparkfun_samd51_thing_plus/board.c +++ b/ports/atmel-samd/boards/sparkfun_samd51_thing_plus/board.c @@ -25,17 +25,5 @@ */ #include "supervisor/board.h" -#include "mpconfigboard.h" -void board_init(void) { -} - -bool board_requests_safe_mode(void) { - return false; -} - -void reset_board(void) { -} - -void board_deinit(void) { -} +// Use the MP_WEAK supervisor/shared/board.c versions of routines not defined here. diff --git a/ports/atmel-samd/boards/stackrduino_m0_pro/board.c b/ports/atmel-samd/boards/stackrduino_m0_pro/board.c index 9f91617a17..fb1ce4fb83 100644 --- a/ports/atmel-samd/boards/stackrduino_m0_pro/board.c +++ b/ports/atmel-samd/boards/stackrduino_m0_pro/board.c @@ -26,15 +26,4 @@ #include "supervisor/board.h" -void board_init(void) { -} - -bool board_requests_safe_mode(void) { - return false; -} - -void reset_board(void) { -} - -void board_deinit(void) { -} +// Use the MP_WEAK supervisor/shared/board.c versions of routines not defined here. diff --git a/ports/atmel-samd/boards/stackrduino_m0_pro/mpconfigboard.mk b/ports/atmel-samd/boards/stackrduino_m0_pro/mpconfigboard.mk index d65be3f800..1088ca1e8d 100644 --- a/ports/atmel-samd/boards/stackrduino_m0_pro/mpconfigboard.mk +++ b/ports/atmel-samd/boards/stackrduino_m0_pro/mpconfigboard.mk @@ -9,5 +9,3 @@ CHIP_FAMILY = samd21 SPI_FLASH_FILESYSTEM = 1 EXTERNAL_FLASH_DEVICES = "W25Q64JVxQ" LONGINT_IMPL = MPZ - -CIRCUITPY_ONEWIREIO = 0 diff --git a/ports/atmel-samd/boards/stringcar_m0_express/board.c b/ports/atmel-samd/boards/stringcar_m0_express/board.c index 9f91617a17..fb1ce4fb83 100644 --- a/ports/atmel-samd/boards/stringcar_m0_express/board.c +++ b/ports/atmel-samd/boards/stringcar_m0_express/board.c @@ -26,15 +26,4 @@ #include "supervisor/board.h" -void board_init(void) { -} - -bool board_requests_safe_mode(void) { - return false; -} - -void reset_board(void) { -} - -void board_deinit(void) { -} +// Use the MP_WEAK supervisor/shared/board.c versions of routines not defined here. diff --git a/ports/atmel-samd/boards/trellis_m4_express/board.c b/ports/atmel-samd/boards/trellis_m4_express/board.c index 3f735e4550..e0455e9344 100644 --- a/ports/atmel-samd/boards/trellis_m4_express/board.c +++ b/ports/atmel-samd/boards/trellis_m4_express/board.c @@ -33,13 +33,6 @@ #include "shared-bindings/digitalio/DigitalInOut.h" #include "shared-bindings/neopixel_write/__init__.h" -void board_init(void) { -} - -bool board_requests_safe_mode(void) { - return false; -} - void reset_board(void) { uint8_t zeroes[96]; memset(zeroes, 0, 96); @@ -50,5 +43,4 @@ void reset_board(void) { common_hal_digitalio_digitalinout_deinit(&neopixel); } -void board_deinit(void) { -} +// Use the MP_WEAK supervisor/shared/board.c versions of routines not defined here. diff --git a/ports/atmel-samd/boards/trinket_m0/board.c b/ports/atmel-samd/boards/trinket_m0/board.c index 9f91617a17..fb1ce4fb83 100644 --- a/ports/atmel-samd/boards/trinket_m0/board.c +++ b/ports/atmel-samd/boards/trinket_m0/board.c @@ -26,15 +26,4 @@ #include "supervisor/board.h" -void board_init(void) { -} - -bool board_requests_safe_mode(void) { - return false; -} - -void reset_board(void) { -} - -void board_deinit(void) { -} +// Use the MP_WEAK supervisor/shared/board.c versions of routines not defined here. diff --git a/ports/atmel-samd/boards/trinket_m0_haxpress/board.c b/ports/atmel-samd/boards/trinket_m0_haxpress/board.c index 9f91617a17..fb1ce4fb83 100644 --- a/ports/atmel-samd/boards/trinket_m0_haxpress/board.c +++ b/ports/atmel-samd/boards/trinket_m0_haxpress/board.c @@ -26,15 +26,4 @@ #include "supervisor/board.h" -void board_init(void) { -} - -bool board_requests_safe_mode(void) { - return false; -} - -void reset_board(void) { -} - -void board_deinit(void) { -} +// Use the MP_WEAK supervisor/shared/board.c versions of routines not defined here. diff --git a/ports/atmel-samd/boards/uartlogger2/board.c b/ports/atmel-samd/boards/uartlogger2/board.c index e0a7487bd2..fb1ce4fb83 100644 --- a/ports/atmel-samd/boards/uartlogger2/board.c +++ b/ports/atmel-samd/boards/uartlogger2/board.c @@ -25,18 +25,5 @@ */ #include "supervisor/board.h" -#include "mpconfigboard.h" -#include "hal/include/hal_gpio.h" -void board_init(void) { -} - -bool board_requests_safe_mode(void) { - return false; -} - -void reset_board(void) { -} - -void board_deinit(void) { -} +// Use the MP_WEAK supervisor/shared/board.c versions of routines not defined here. diff --git a/ports/atmel-samd/boards/uchip/board.c b/ports/atmel-samd/boards/uchip/board.c index e739776ed1..66469e12ce 100644 --- a/ports/atmel-samd/boards/uchip/board.c +++ b/ports/atmel-samd/boards/uchip/board.c @@ -42,12 +42,4 @@ void board_init(void) { never_reset_pin_number(PIN_PA27); } -bool board_requests_safe_mode(void) { - return false; -} - -void reset_board(void) { -} - -void board_deinit(void) { -} +// Use the MP_WEAK supervisor/shared/board.c versions of routines not defined here. diff --git a/ports/atmel-samd/boards/uchip/mpconfigboard.mk b/ports/atmel-samd/boards/uchip/mpconfigboard.mk index 90b5600dcb..543007ce11 100644 --- a/ports/atmel-samd/boards/uchip/mpconfigboard.mk +++ b/ports/atmel-samd/boards/uchip/mpconfigboard.mk @@ -6,6 +6,8 @@ USB_MANUFACTURER = "Itaca Innovation" CHIP_VARIANT = SAMD21E18A CHIP_FAMILY = samd21 +CIRCUITPY_BUILD_EXTENSIONS = bin,uf2 + INTERNAL_FLASH_FILESYSTEM = 1 LONGINT_IMPL = NONE CIRCUITPY_FULL_BUILD = 0 diff --git a/ports/atmel-samd/boards/ugame10/board.c b/ports/atmel-samd/boards/ugame10/board.c index d75841be54..90cf9dff20 100644 --- a/ports/atmel-samd/boards/ugame10/board.c +++ b/ports/atmel-samd/boards/ugame10/board.c @@ -105,21 +105,13 @@ void board_init(void) { NULL, NO_BRIGHTNESS_COMMAND, 1.0f, // brightness - false, // auto_brightness false, // single_byte_bounds false, // data as commands true, // auto_refresh 60, // native_frames_per_second true, // backlight_on_high - false); // SH1107_addressing + false, // SH1107_addressing + 50000); // backlight pwm frequency } -bool board_requests_safe_mode(void) { - return false; -} - -void reset_board(void) { -} - -void board_deinit(void) { -} +// Use the MP_WEAK supervisor/shared/board.c versions of routines not defined here. diff --git a/ports/atmel-samd/boards/ugame10/mpconfigboard.mk b/ports/atmel-samd/boards/ugame10/mpconfigboard.mk index f942490f29..d129429ad6 100644 --- a/ports/atmel-samd/boards/ugame10/mpconfigboard.mk +++ b/ports/atmel-samd/boards/ugame10/mpconfigboard.mk @@ -15,14 +15,14 @@ CIRCUITPY_MATH = 1 CIRCUITPY_AUDIOIO = 1 CIRCUITPY_ANALOGIO = 1 CIRCUITPY_DISPLAYIO = 1 -CIRCUITPY_KEYPPAD = 1 +CIRCUITPY_KEYPAD = 1 CIRCUITPY_PULSEIO = 0 CIRCUITPY_AUDIOBUSIO = 0 CIRCUITPY_BITBANGIO = 0 CIRCUITPY_BITMAPTOOLS = 0 CIRCUITPY_FREQUENCYIO = 0 -CIRCUITPY_I2CPERIPHERAL = 0 +CIRCUITPY_I2CTARGET = 0 CIRCUITPY_NEOPIXEL_WRITE = 0 CIRCUITPY_PARALLELDISPLAY = 0 CIRCUITPY_PIXELBUF = 0 diff --git a/ports/atmel-samd/boards/winterbloom_big_honking_button/board.c b/ports/atmel-samd/boards/winterbloom_big_honking_button/board.c index 9f91617a17..fb1ce4fb83 100644 --- a/ports/atmel-samd/boards/winterbloom_big_honking_button/board.c +++ b/ports/atmel-samd/boards/winterbloom_big_honking_button/board.c @@ -26,15 +26,4 @@ #include "supervisor/board.h" -void board_init(void) { -} - -bool board_requests_safe_mode(void) { - return false; -} - -void reset_board(void) { -} - -void board_deinit(void) { -} +// Use the MP_WEAK supervisor/shared/board.c versions of routines not defined here. diff --git a/ports/atmel-samd/boards/winterbloom_big_honking_button/mpconfigboard.mk b/ports/atmel-samd/boards/winterbloom_big_honking_button/mpconfigboard.mk index 5bf70a9668..00b9b64a33 100644 --- a/ports/atmel-samd/boards/winterbloom_big_honking_button/mpconfigboard.mk +++ b/ports/atmel-samd/boards/winterbloom_big_honking_button/mpconfigboard.mk @@ -23,7 +23,7 @@ CIRCUITPY_AUDIOBUSIO = 0 CIRCUITPY_BLEIO = 0 CIRCUITPY_DISPLAYIO = 0 CIRCUITPY_KEYPAD = 0 -CIRCUITPY_I2CPERIPHERAL = 0 +CIRCUITPY_I2CTARGET = 0 CIRCUITPY_TOUCHIO = 0 CIRCUITPY_RGBMATRIX = 0 CIRCUITPY_PS2IO = 0 diff --git a/ports/atmel-samd/boards/winterbloom_sol/board.c b/ports/atmel-samd/boards/winterbloom_sol/board.c index 289d68af29..fb1ce4fb83 100644 --- a/ports/atmel-samd/boards/winterbloom_sol/board.c +++ b/ports/atmel-samd/boards/winterbloom_sol/board.c @@ -25,17 +25,5 @@ */ #include "supervisor/board.h" -#include "mpconfigboard.h" -void board_init(void) { -} - -bool board_requests_safe_mode(void) { - return false; -} - -void reset_board(void) { -} - -void board_deinit(void) { -} +// Use the MP_WEAK supervisor/shared/board.c versions of routines not defined here. diff --git a/ports/atmel-samd/boards/winterbloom_sol/mpconfigboard.mk b/ports/atmel-samd/boards/winterbloom_sol/mpconfigboard.mk index 653d2e6ed5..17638a0ebd 100644 --- a/ports/atmel-samd/boards/winterbloom_sol/mpconfigboard.mk +++ b/ports/atmel-samd/boards/winterbloom_sol/mpconfigboard.mk @@ -22,7 +22,7 @@ CIRCUITPY_BLEIO_HCI = 0 CIRCUITPY_DISPLAYIO = 0 CIRCUITPY_FRAMEBUFFERIO = 0 CIRCUITPY_KEYPAD = 0 -CIRCUITPY_I2CPERIPHERAL = 0 +CIRCUITPY_I2CTARGET = 0 CIRCUITPY_TOUCHIO = 0 CIRCUITPY_RGBMATRIX = 0 CIRCUITPY_PS2IO = 0 diff --git a/ports/atmel-samd/boards/xinabox_cc03/board.c b/ports/atmel-samd/boards/xinabox_cc03/board.c index e0a7487bd2..fb1ce4fb83 100644 --- a/ports/atmel-samd/boards/xinabox_cc03/board.c +++ b/ports/atmel-samd/boards/xinabox_cc03/board.c @@ -25,18 +25,5 @@ */ #include "supervisor/board.h" -#include "mpconfigboard.h" -#include "hal/include/hal_gpio.h" -void board_init(void) { -} - -bool board_requests_safe_mode(void) { - return false; -} - -void reset_board(void) { -} - -void board_deinit(void) { -} +// Use the MP_WEAK supervisor/shared/board.c versions of routines not defined here. diff --git a/ports/atmel-samd/boards/xinabox_cs11/board.c b/ports/atmel-samd/boards/xinabox_cs11/board.c index e0a7487bd2..1bba99ac06 100644 --- a/ports/atmel-samd/boards/xinabox_cs11/board.c +++ b/ports/atmel-samd/boards/xinabox_cs11/board.c @@ -28,15 +28,4 @@ #include "mpconfigboard.h" #include "hal/include/hal_gpio.h" -void board_init(void) { -} - -bool board_requests_safe_mode(void) { - return false; -} - -void reset_board(void) { -} - -void board_deinit(void) { -} +// Use the MP_WEAK supervisor/shared/board.c versions of routines not defined here. diff --git a/ports/atmel-samd/common-hal/_pew/PewPew.c b/ports/atmel-samd/common-hal/_pew/PewPew.c index 40cd52134a..c4d94e3dbd 100644 --- a/ports/atmel-samd/common-hal/_pew/PewPew.c +++ b/ports/atmel-samd/common-hal/_pew/PewPew.c @@ -35,7 +35,7 @@ #include "shared-bindings/digitalio/DigitalInOut.h" #include "shared-bindings/util.h" #include "samd/timers.h" -#include "supervisor/shared/translate.h" +#include "supervisor/shared/translate/translate.h" #include "timer_handler.h" diff --git a/ports/atmel-samd/common-hal/alarm/__init__.c b/ports/atmel-samd/common-hal/alarm/__init__.c index 405bf9d573..8f66b3a90c 100644 --- a/ports/atmel-samd/common-hal/alarm/__init__.c +++ b/ports/atmel-samd/common-hal/alarm/__init__.c @@ -142,7 +142,10 @@ mp_obj_t common_hal_alarm_light_sleep_until_alarms(size_t n_alarms, const mp_obj return wake_alarm; } -void common_hal_alarm_set_deep_sleep_alarms(size_t n_alarms, const mp_obj_t *alarms) { +void common_hal_alarm_set_deep_sleep_alarms(size_t n_alarms, const mp_obj_t *alarms, size_t n_dios, digitalio_digitalinout_obj_t **preserve_dios) { + if (n_dios > 0) { + mp_raise_NotImplementedError_varg(translate("%q"), MP_QSTR_preserve_dios); + } _setup_sleep_alarms(true, n_alarms, alarms); } diff --git a/ports/atmel-samd/common-hal/alarm/pin/PinAlarm.c b/ports/atmel-samd/common-hal/alarm/pin/PinAlarm.c index eda111639b..9289a66a87 100644 --- a/ports/atmel-samd/common-hal/alarm/pin/PinAlarm.c +++ b/ports/atmel-samd/common-hal/alarm/pin/PinAlarm.c @@ -234,7 +234,7 @@ static void pinalarm_set_alarms_light(size_t n_alarms, const mp_obj_t *alarms) { // raise ValueError here MP_FALLTHROUGH case PINALARM_ERR_NOEXTINT: - mp_raise_RuntimeError(translate("No hardware support on pin")); + raise_ValueError_invalid_pin(); case PINALARM_ERR_NOCHANNEL: mp_raise_RuntimeError(translate("A hardware interrupt channel is already in use")); default: @@ -261,7 +261,7 @@ static void pinalarm_set_alarms_deep(size_t n_alarms, const mp_obj_t *alarms) { } } if (t->n < 0) { - mp_raise_ValueError(translate("Pin cannot wake from Deep Sleep")); + raise_ValueError_invalid_pin(); } // It is strange, but to my experiment, interrupt during sleep diff --git a/ports/atmel-samd/common-hal/alarm/time/TimeAlarm.c b/ports/atmel-samd/common-hal/alarm/time/TimeAlarm.c index 14a7346c17..3f116f07e3 100644 --- a/ports/atmel-samd/common-hal/alarm/time/TimeAlarm.c +++ b/ports/atmel-samd/common-hal/alarm/time/TimeAlarm.c @@ -100,7 +100,7 @@ void alarm_time_timealarm_set_alarms(bool deep_sleep, size_t n_alarms, const mp_ continue; } if (timealarm_set) { - mp_raise_ValueError(translate("Only one alarm.time alarm can be set.")); + mp_raise_ValueError(translate("Only one alarm.time alarm can be set")); } timealarm = MP_OBJ_TO_PTR(alarms[i]); timealarm_set = true; diff --git a/ports/atmel-samd/common-hal/analogio/AnalogIn.c b/ports/atmel-samd/common-hal/analogio/AnalogIn.c index 262e44350c..d15be8308a 100644 --- a/ports/atmel-samd/common-hal/analogio/AnalogIn.c +++ b/ports/atmel-samd/common-hal/analogio/AnalogIn.c @@ -36,7 +36,8 @@ #include "samd/adc.h" #include "shared-bindings/analogio/AnalogIn.h" -#include "supervisor/shared/translate.h" +#include "shared-bindings/microcontroller/Pin.h" +#include "supervisor/shared/translate/translate.h" #include "atmel_start_pins.h" #include "hal/include/hal_adc_sync.h" @@ -60,7 +61,7 @@ void common_hal_analogio_analogin_construct(analogio_analogin_obj_t *self, } if (adc_channel == 0xff) { // No ADC function on that pin - mp_raise_ValueError(translate("Pin does not have ADC capabilities")); + raise_ValueError_invalid_pin(); } claim_pin(pin); @@ -122,8 +123,8 @@ uint16_t common_hal_analogio_analogin_get_value(analogio_analogin_obj_t *self) { adc_sync_read_channel(&adc, self->channel, ((uint8_t *)&value), 2); adc_sync_deinit(&adc); - // Shift the value to be 16 bit. - return value << 4; + // Stretch 12-bit ADC reading to 16-bit range + return (value << 4) | (value >> 8); } float common_hal_analogio_analogin_get_reference_voltage(analogio_analogin_obj_t *self) { diff --git a/ports/atmel-samd/common-hal/analogio/AnalogOut.c b/ports/atmel-samd/common-hal/analogio/AnalogOut.c index 91782387b8..ec690e8ddb 100644 --- a/ports/atmel-samd/common-hal/analogio/AnalogOut.c +++ b/ports/atmel-samd/common-hal/analogio/AnalogOut.c @@ -33,7 +33,7 @@ #include "shared-bindings/analogio/AnalogOut.h" #include "shared-bindings/audioio/AudioOut.h" #include "shared-bindings/microcontroller/Pin.h" -#include "supervisor/shared/translate.h" +#include "supervisor/shared/translate/translate.h" #include "atmel_start_pins.h" #include "hal/include/hal_dac_sync.h" @@ -45,8 +45,8 @@ #endif #define HAVE_ANALOGOUT ( \ - (defined(PIN_PA02) && !defined(IGNORE_PA02)) || \ - (defined(SAM_D5X_E5X) && defined(PIN_PA05) && !defined(IGNORE_PA05)) \ + (defined(PIN_PA02) && !defined(IGNORE_PIN_PA02)) || \ + (defined(SAM_D5X_E5X) && defined(PIN_PA05) && !defined(IGNORE_PIN_PA05)) \ ) void common_hal_analogio_analogout_construct(analogio_analogout_obj_t *self, @@ -70,7 +70,7 @@ void common_hal_analogio_analogout_construct(analogio_analogout_obj_t *self, #endif default: - mp_raise_ValueError(translate("AnalogOut not supported on given pin")); + raise_ValueError_invalid_pin(); return; } diff --git a/ports/atmel-samd/common-hal/audiobusio/I2SOut.c b/ports/atmel-samd/common-hal/audiobusio/I2SOut.c index a434e2541b..447252aace 100644 --- a/ports/atmel-samd/common-hal/audiobusio/I2SOut.c +++ b/ports/atmel-samd/common-hal/audiobusio/I2SOut.c @@ -40,7 +40,7 @@ #include "shared-bindings/audiobusio/I2SOut.h" #include "shared-bindings/audiocore/RawSample.h" #include "shared-bindings/microcontroller/Pin.h" -#include "supervisor/shared/translate.h" +#include "supervisor/shared/translate/translate.h" #include "atmel_start_pins.h" #include "hal/include/hal_gpio.h" @@ -151,16 +151,16 @@ void common_hal_audiobusio_i2sout_construct(audiobusio_i2sout_obj_t *self, } #endif if (bc_clock_unit == 0xff) { - mp_raise_ValueError_varg(translate("Invalid %q pin"), MP_QSTR_bit_clock); + raise_ValueError_invalid_pin_name(MP_QSTR_clock); } if (ws_clock_unit == 0xff) { - mp_raise_ValueError_varg(translate("Invalid %q pin"), MP_QSTR_word_select); + raise_ValueError_invalid_pin_name(MP_QSTR_word_select); } if (bc_clock_unit != ws_clock_unit) { mp_raise_ValueError(translate("Bit clock and word select must share a clock unit")); } if (serializer == 0xff) { - mp_raise_ValueError_varg(translate("Invalid %q pin"), MP_QSTR_data); + raise_ValueError_invalid_pin_name(MP_QSTR_data); } self->clock_unit = ws_clock_unit; self->serializer = serializer; @@ -255,7 +255,7 @@ void common_hal_audiobusio_i2sout_play(audiobusio_i2sout_obj_t *self, } uint8_t channel_count = audiosample_channel_count(sample); if (channel_count > 2) { - mp_raise_ValueError(translate("Too many channels in sample.")); + mp_raise_ValueError(translate("Too many channels in sample")); } #ifdef SAMD21 uint32_t serctrl = (self->clock_unit << I2S_SERCTRL_CLKSEL_Pos) | SERCTRL(SERMODE_TX) | I2S_SERCTRL_TXSAME_SAME | I2S_SERCTRL_EXTEND_MSBIT | I2S_SERCTRL_TXDEFAULT_ONE | I2S_SERCTRL_SLOTADJ_LEFT; diff --git a/ports/atmel-samd/common-hal/audiobusio/PDMIn.c b/ports/atmel-samd/common-hal/audiobusio/PDMIn.c index e7c00901bf..6796fe03f8 100644 --- a/ports/atmel-samd/common-hal/audiobusio/PDMIn.c +++ b/ports/atmel-samd/common-hal/audiobusio/PDMIn.c @@ -37,7 +37,7 @@ #include "shared-bindings/audiobusio/PDMIn.h" #include "shared-bindings/microcontroller/__init__.h" #include "shared-bindings/microcontroller/Pin.h" -#include "supervisor/shared/translate.h" +#include "supervisor/shared/translate/translate.h" #include "atmel_start_pins.h" #include "hal/include/hal_gpio.h" @@ -58,11 +58,11 @@ #define MIN_MIC_CLOCK 1000000 #ifdef SAMD21 -#define SERCTRL(name) I2S_SERCTRL_ ## name +#define SERCTRL(name) I2S_SERCTRL_##name #endif #ifdef SAM_D5X_E5X -#define SERCTRL(name) I2S_RXCTRL_ ## name +#define SERCTRL(name) I2S_RXCTRL_##name #endif // Set by interrupt handler when DMA block has finished transferring. @@ -80,48 +80,50 @@ void pdmin_reset(void) { pdmin_dma_block_done = false; pdmin_event_channel = EVSYS_SYNCH_NUM; - while (I2S->SYNCBUSY.reg & I2S_SYNCBUSY_ENABLE) {} + while (I2S->SYNCBUSY.reg & I2S_SYNCBUSY_ENABLE) { + } I2S->INTENCLR.reg = I2S_INTENCLR_MASK; I2S->INTFLAG.reg = I2S_INTFLAG_MASK; I2S->CTRLA.reg &= ~I2S_SYNCBUSY_ENABLE; - while (I2S->SYNCBUSY.reg & I2S_SYNCBUSY_ENABLE) {} + while (I2S->SYNCBUSY.reg & I2S_SYNCBUSY_ENABLE) { + } I2S->CTRLA.reg = I2S_CTRLA_SWRST; } // Caller validates that pins are free. -void common_hal_audiobusio_pdmin_construct(audiobusio_pdmin_obj_t* self, - const mcu_pin_obj_t* clock_pin, - const mcu_pin_obj_t* data_pin, - uint32_t sample_rate, - uint8_t bit_depth, - bool mono, - uint8_t oversample) { +void common_hal_audiobusio_pdmin_construct(audiobusio_pdmin_obj_t *self, + const mcu_pin_obj_t *clock_pin, + const mcu_pin_obj_t *data_pin, + uint32_t sample_rate, + uint8_t bit_depth, + bool mono, + uint8_t oversample) { self->clock_pin = clock_pin; // PA10, PA20 -> SCK0, PB11 -> SCK1 #ifdef SAMD21 - if (clock_pin == &pin_PA10 + if (clock_pin == &pin_PA10 #if defined(PIN_PA20) && !defined(IGNORE_PIN_PA20) - || clock_pin == &pin_PA20 + || clock_pin == &pin_PA20 #endif - ) { - self->clock_unit = 0; - #if defined(PIN_PB11) && !defined(IGNORE_PIN_PB11) - } else if (clock_pin == &pin_PB11) { - self->clock_unit = 1; - #endif - #endif - #ifdef SAM_D5X_E5X - if (clock_pin == &pin_PA10 || clock_pin == &pin_PB16) { - self->clock_unit = 0; - } else if (clock_pin == &pin_PB12 - #if defined(PIN_PB28) && !defined(IGNORE_PIN_PB28) - || data_pin == &pin_PB28) { - #else ) { - #endif - self->clock_unit = 1; + self->clock_unit = 0; + #if defined(PIN_PB11) && !defined(IGNORE_PIN_PB11) + } else if (clock_pin == &pin_PB11) { + self->clock_unit = 1; #endif + #else + #ifdef SAM_D5X_E5X + if (clock_pin == &pin_PA10 || clock_pin == &pin_PB16) { + self->clock_unit = 0; + } else if (clock_pin == &pin_PB12 + #if defined(PIN_PB28) && !defined(IGNORE_PIN_PB28) + || data_pin == &pin_PB28 + #endif + ) { + self->clock_unit = 1; + #endif + #endif } else { - mp_raise_ValueError_varg(translate("Invalid %q pin"), MP_QSTR_clock); + raise_ValueError_invalid_pin_name(MP_QSTR_clock); } self->data_pin = data_pin; // PA07, PA19 -> SD0, PA08, PB16 -> SD1 @@ -136,23 +138,23 @@ void common_hal_audiobusio_pdmin_construct(audiobusio_pdmin_obj_t* self, #endif ) { self->serializer = 0; - } - else if (false - #if defined(PIN_PA08) && !defined(IGNORE_PIN_PA08) - || data_pin == &pin_PA08 - #endif - #if defined (PIN_PB16) && !defined(IGNORE_PIN_PB16) - || data_pin == &pin_PB16 - #endif - ) { + } else if (false + #if defined(PIN_PA08) && !defined(IGNORE_PIN_PA08) + || data_pin == &pin_PA08 + #endif + #if defined(PIN_PB16) && !defined(IGNORE_PIN_PB16) + || data_pin == &pin_PB16 + #endif + ) { self->serializer = 1; - #endif + #else #ifdef SAM_D5X_E5X if (data_pin == &pin_PB10 || data_pin == &pin_PA22) { self->serializer = 1; #endif + #endif } else { - mp_raise_ValueError_varg(translate("Invalid %q pin"), MP_QSTR_data); + raise_ValueError_invalid_pin_name(MP_QSTR_data); } if (!(bit_depth == 16 || bit_depth == 8) || !mono || oversample != OVERSAMPLING) { @@ -163,7 +165,8 @@ void common_hal_audiobusio_pdmin_construct(audiobusio_pdmin_obj_t* self, if (I2S->CTRLA.bit.ENABLE == 0) { I2S->CTRLA.bit.SWRST = 1; - while (I2S->CTRLA.bit.SWRST == 1) {} + while (I2S->CTRLA.bit.SWRST == 1) { + } } else { #ifdef SAMD21 if ((I2S->CTRLA.vec.SEREN & (1 << self->serializer)) != 0) { @@ -183,10 +186,10 @@ void common_hal_audiobusio_pdmin_construct(audiobusio_pdmin_obj_t* self, #define GPIO_I2S_FUNCTION GPIO_PIN_FUNCTION_G #endif - uint32_t clock_divisor = (uint32_t) roundf( 48000000.0f / sample_rate / oversample); + uint32_t clock_divisor = (uint32_t)roundf(48000000.0f / sample_rate / oversample); float mic_clock_freq = 48000000.0f / clock_divisor; - self->sample_rate = mic_clock_freq / oversample; - if (mic_clock_freq < MIN_MIC_CLOCK || clock_divisor == 0) { + self->sample_rate = mic_clock_freq / oversample; + if (mic_clock_freq < MIN_MIC_CLOCK || clock_divisor == 0) { mp_raise_ValueError(translate("sampling rate out of range")); } // Find a free GCLK to generate the MCLK signal. @@ -202,9 +205,9 @@ void common_hal_audiobusio_pdmin_construct(audiobusio_pdmin_obj_t* self, // Clock unit configuration uint32_t clkctrl = I2S_CLKCTRL_MCKSEL_GCLK | - I2S_CLKCTRL_NBSLOTS(2) | - I2S_CLKCTRL_FSWIDTH_SLOT | - I2S_CLKCTRL_SLOTSIZE_16; + I2S_CLKCTRL_NBSLOTS(2) | + I2S_CLKCTRL_FSWIDTH_SLOT | + I2S_CLKCTRL_SLOTSIZE_16; // Serializer configuration #ifdef SAMD21 @@ -241,11 +244,11 @@ void common_hal_audiobusio_pdmin_construct(audiobusio_pdmin_obj_t* self, self->bit_depth = bit_depth; } -bool common_hal_audiobusio_pdmin_deinited(audiobusio_pdmin_obj_t* self) { +bool common_hal_audiobusio_pdmin_deinited(audiobusio_pdmin_obj_t *self) { return self->clock_pin == NULL; } -void common_hal_audiobusio_pdmin_deinit(audiobusio_pdmin_obj_t* self) { +void common_hal_audiobusio_pdmin_deinit(audiobusio_pdmin_obj_t *self) { if (common_hal_audiobusio_pdmin_deinited(self)) { return; } @@ -264,24 +267,24 @@ void common_hal_audiobusio_pdmin_deinit(audiobusio_pdmin_obj_t* self) { self->data_pin = NULL; } -uint8_t common_hal_audiobusio_pdmin_get_bit_depth(audiobusio_pdmin_obj_t* self) { +uint8_t common_hal_audiobusio_pdmin_get_bit_depth(audiobusio_pdmin_obj_t *self) { return self->bit_depth; } -uint32_t common_hal_audiobusio_pdmin_get_sample_rate(audiobusio_pdmin_obj_t* self) { +uint32_t common_hal_audiobusio_pdmin_get_sample_rate(audiobusio_pdmin_obj_t *self) { return self->sample_rate; } -static void setup_dma(audiobusio_pdmin_obj_t* self, uint32_t length, - DmacDescriptor* descriptor, - DmacDescriptor* second_descriptor, - uint32_t words_per_buffer, uint8_t words_per_sample, - uint32_t* first_buffer, uint32_t* second_buffer) { +static void setup_dma(audiobusio_pdmin_obj_t *self, uint32_t length, + DmacDescriptor *descriptor, + DmacDescriptor *second_descriptor, + uint32_t words_per_buffer, uint8_t words_per_sample, + uint32_t *first_buffer, uint32_t *second_buffer) { descriptor->BTCTRL.reg = DMAC_BTCTRL_VALID | - DMAC_BTCTRL_BLOCKACT_NOACT | - DMAC_BTCTRL_EVOSEL_BLOCK | - DMAC_BTCTRL_DSTINC | - DMAC_BTCTRL_BEATSIZE_WORD; + DMAC_BTCTRL_BLOCKACT_NOACT | + DMAC_BTCTRL_EVOSEL_BLOCK | + DMAC_BTCTRL_DSTINC | + DMAC_BTCTRL_BEATSIZE_WORD; // Block transfer count is the number of beats per block (aka descriptor). // In this case there are two bytes per beat so divide the length by two. @@ -291,7 +294,7 @@ static void setup_dma(audiobusio_pdmin_obj_t* self, uint32_t length, } descriptor->BTCNT.reg = block_transfer_count; - descriptor->DSTADDR.reg = ((uint32_t) first_buffer + sizeof(uint32_t) * block_transfer_count); + descriptor->DSTADDR.reg = ((uint32_t)first_buffer + sizeof(uint32_t) * block_transfer_count); descriptor->DESCADDR.reg = 0; if (length * words_per_sample > words_per_buffer) { descriptor->DESCADDR.reg = ((uint32_t)second_descriptor); @@ -314,7 +317,7 @@ static void setup_dma(audiobusio_pdmin_obj_t* self, uint32_t length, block_transfer_count = length * words_per_sample - words_per_buffer; second_descriptor->DESCADDR.reg = 0; } - second_descriptor->DSTADDR.reg = ((uint32_t) second_buffer + sizeof(uint32_t) * block_transfer_count); + second_descriptor->DSTADDR.reg = ((uint32_t)second_buffer + sizeof(uint32_t) * block_transfer_count); second_descriptor->BTCNT.reg = block_transfer_count; #ifdef SAMD21 @@ -324,10 +327,10 @@ static void setup_dma(audiobusio_pdmin_obj_t* self, uint32_t length, second_descriptor->SRCADDR.reg = (uint32_t)&I2S->RXDATA; #endif second_descriptor->BTCTRL.reg = DMAC_BTCTRL_VALID | - DMAC_BTCTRL_BLOCKACT_NOACT | - DMAC_BTCTRL_EVOSEL_BLOCK | - DMAC_BTCTRL_DSTINC | - DMAC_BTCTRL_BEATSIZE_WORD; + DMAC_BTCTRL_BLOCKACT_NOACT | + DMAC_BTCTRL_EVOSEL_BLOCK | + DMAC_BTCTRL_DSTINC | + DMAC_BTCTRL_BEATSIZE_WORD; } } @@ -341,7 +344,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. -const 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, @@ -353,26 +356,26 @@ const uint16_t sinc_filter [OVERSAMPLING] = { }; #ifdef SAMD21 -#define REPEAT_16_TIMES(X) do { for(uint8_t j=0; j<4; j++) { X X X X } } while (0) +#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) +#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; const uint16_t *filter_ptr = sinc_filter; - for (uint8_t i = 0; i < OVERSAMPLING/16; i++) { + for (uint8_t i = 0; i < OVERSAMPLING / 16; i++) { // The sample is 16-bits right channel in the upper two bytes and 16-bits left channel // in the lower two bytes. // We just ignore the upper bits uint32_t pdm_sample = pdm_samples[i]; - REPEAT_16_TIMES( { - if (pdm_sample & 0x8000) { - running_sum += *filter_ptr; - } - filter_ptr++; - pdm_sample <<= 1; + REPEAT_16_TIMES({ + if (pdm_sample & 0x8000) { + running_sum += *filter_ptr; } + filter_ptr++; + pdm_sample <<= 1; + } ); } return running_sum; @@ -380,8 +383,8 @@ static uint16_t filter_sample(uint32_t pdm_samples[4]) { // output_buffer may be a byte buffer or a halfword buffer. // output_buffer_length is the number of slots, not the number of bytes. -uint32_t common_hal_audiobusio_pdmin_record_to_buffer(audiobusio_pdmin_obj_t* self, - uint16_t* output_buffer, uint32_t output_buffer_length) { +uint32_t common_hal_audiobusio_pdmin_record_to_buffer(audiobusio_pdmin_obj_t *self, + uint16_t *output_buffer, uint32_t output_buffer_length) { uint8_t dma_channel = dma_allocate_channel(); pdmin_event_channel = find_sync_event_channel_raise(); pdmin_dma_block_done = false; @@ -399,7 +402,7 @@ uint32_t common_hal_audiobusio_pdmin_record_to_buffer(audiobusio_pdmin_obj_t* se COMPILER_ALIGNED(16) DmacDescriptor second_descriptor; setup_dma(self, output_buffer_length, dma_descriptor(dma_channel), &second_descriptor, - words_per_buffer, words_per_sample, first_buffer, second_buffer); + words_per_buffer, words_per_sample, first_buffer, second_buffer); uint8_t trigger_source = I2S_DMAC_ID_RX_0; #ifdef SAMD21 @@ -444,7 +447,7 @@ uint32_t common_hal_audiobusio_pdmin_record_to_buffer(audiobusio_pdmin_obj_t* se // Flip back and forth between processing the first and second buffers. uint32_t *buffer = first_buffer; - DmacDescriptor* descriptor = dma_descriptor(dma_channel); + DmacDescriptor *descriptor = dma_descriptor(dma_channel); if (buffers_processed % 2 == 1) { buffer = second_buffer; descriptor = &second_descriptor; @@ -459,7 +462,7 @@ uint32_t common_hal_audiobusio_pdmin_record_to_buffer(audiobusio_pdmin_obj_t* se uint16_t value = filter_sample(buffer + i * words_per_sample); if (self->bit_depth == 8) { // Truncate to 8 bits. - ((uint8_t*) output_buffer)[values_output] = value >> 8; + ((uint8_t *)output_buffer)[values_output] = value >> 8; } else { output_buffer[values_output] = value; } @@ -471,7 +474,7 @@ uint32_t common_hal_audiobusio_pdmin_record_to_buffer(audiobusio_pdmin_obj_t* se // Compute how many more samples we need, and if the last buffer is the last // set of samples needed, adjust the DMA count to only fetch as necessary. remaining_samples_needed = output_buffer_length - values_output; - if (remaining_samples_needed <= samples_per_buffer*2 && + if (remaining_samples_needed <= samples_per_buffer * 2 && remaining_samples_needed > samples_per_buffer) { // Adjust the DMA settings for the current buffer, which will be processed // after the other buffer, which is now receiving samples via DMA. @@ -484,7 +487,7 @@ uint32_t common_hal_audiobusio_pdmin_record_to_buffer(audiobusio_pdmin_obj_t* se // Set up to receive the last set of samples (don't include the alternate buffer, now in use). uint32_t samples_needed_for_last_buffer = remaining_samples_needed - samples_per_buffer; descriptor->BTCNT.reg = samples_needed_for_last_buffer * words_per_sample; - descriptor->DSTADDR.reg = ((uint32_t) buffer) + descriptor->DSTADDR.reg = ((uint32_t)buffer) + samples_needed_for_last_buffer * words_per_sample * sizeof(buffer[0]); // Break chain to alternate buffer. diff --git a/ports/atmel-samd/common-hal/audioio/AudioOut.c b/ports/atmel-samd/common-hal/audioio/AudioOut.c index 7be7cf7c4c..a565a77042 100644 --- a/ports/atmel-samd/common-hal/audioio/AudioOut.c +++ b/ports/atmel-samd/common-hal/audioio/AudioOut.c @@ -35,7 +35,7 @@ #include "shared-bindings/audioio/AudioOut.h" #include "shared-bindings/microcontroller/__init__.h" #include "shared-bindings/microcontroller/Pin.h" -#include "supervisor/shared/translate.h" +#include "supervisor/shared/translate/translate.h" #include "atmel_start_pins.h" #include "hal/include/hal_gpio.h" @@ -136,20 +136,21 @@ void common_hal_audioio_audioout_construct(audioio_audioout_obj_t *self, mp_raise_ValueError(translate("Right channel unsupported")); } if (left_channel != &pin_PA02) { - mp_raise_ValueError(translate("Invalid pin")); + raise_ValueError_invalid_pin(); } claim_pin(left_channel); #endif #ifdef SAM_D5X_E5X self->right_channel = NULL; if (left_channel != &pin_PA02 && left_channel != &pin_PA05) { - mp_raise_ValueError(translate("Invalid pin for left channel")); + raise_ValueError_invalid_pin_name(MP_QSTR_left_channel); } if (right_channel != NULL && right_channel != &pin_PA02 && right_channel != &pin_PA05) { - mp_raise_ValueError(translate("Invalid pin for right channel")); + raise_ValueError_invalid_pin_name(MP_QSTR_right_channel); } if (right_channel == left_channel) { - mp_raise_ValueError(translate("Cannot output both channels on the same pin")); + mp_raise_ValueError_varg(translate("%q and %q must be different"), + MP_QSTR_left_channel, MP_QSTR_right_channel); } claim_pin(left_channel); if (right_channel != NULL) { @@ -376,14 +377,13 @@ void common_hal_audioio_audioout_play(audioio_audioout_obj_t *self, audio_dma_result result = AUDIO_DMA_OK; uint32_t sample_rate = audiosample_sample_rate(sample); #ifdef SAMD21 - uint32_t max_sample_rate = 350000; + const uint32_t max_sample_rate = 350000; #endif #ifdef SAM_D5X_E5X - uint32_t max_sample_rate = 1000000; + const uint32_t max_sample_rate = 1000000; #endif - if (sample_rate > max_sample_rate) { - mp_raise_ValueError_varg(translate("Sample rate too high. It must be less than %d"), max_sample_rate); - } + mp_arg_validate_int_max(sample_rate, max_sample_rate, MP_QSTR_sample_rate); + #ifdef SAMD21 result = audio_dma_setup_playback(&self->left_dma, sample, loop, true, 0, false /* output unsigned */, diff --git a/ports/atmel-samd/common-hal/busio/I2C.c b/ports/atmel-samd/common-hal/busio/I2C.c index 48ee26a9b6..902e696408 100644 --- a/ports/atmel-samd/common-hal/busio/I2C.c +++ b/ports/atmel-samd/common-hal/busio/I2C.c @@ -34,7 +34,8 @@ #include "samd/sercom.h" #include "shared-bindings/microcontroller/__init__.h" -#include "supervisor/shared/translate.h" +#include "shared-bindings/microcontroller/Pin.h" +#include "supervisor/shared/translate/translate.h" #include "common-hal/busio/__init__.h" @@ -76,7 +77,7 @@ void common_hal_busio_i2c_construct(busio_i2c_obj_t *self, self->sda_pin = NO_PIN; Sercom *sercom = samd_i2c_get_sercom(scl, sda, &sercom_index, &sda_pinmux, &scl_pinmux); if (sercom == NULL) { - mp_raise_ValueError(translate("Invalid pins")); + raise_ValueError_invalid_pins(); } #if CIRCUITPY_REQUIRE_I2C_PULLUPS @@ -122,15 +123,10 @@ void common_hal_busio_i2c_construct(busio_i2c_obj_t *self, // The maximum frequency divisor gives a clock rate of around 48MHz/2/255 // but set_baudrate does not diagnose this problem. (This is not the // exact cutoff, but no frequency well under 100kHz is available) - if (frequency < 95000) { - mp_raise_ValueError(translate("Unsupported baudrate")); - } - - if (i2c_m_sync_set_baudrate(&self->i2c_desc, 0, frequency / 1000) != ERR_NONE) { - reset_pin_number(sda->number); - reset_pin_number(scl->number); + if ((frequency < 95000) || + (i2c_m_sync_set_baudrate(&self->i2c_desc, 0, frequency / 1000) != ERR_NONE)) { common_hal_busio_i2c_deinit(self); - mp_raise_ValueError(translate("Unsupported baudrate")); + mp_arg_error_invalid(MP_QSTR_frequency); } self->sda_pin = sda->number; diff --git a/ports/atmel-samd/common-hal/busio/SPI.c b/ports/atmel-samd/common-hal/busio/SPI.c index 0f6f38461c..3bb0cabf9e 100644 --- a/ports/atmel-samd/common-hal/busio/SPI.c +++ b/ports/atmel-samd/common-hal/busio/SPI.c @@ -25,6 +25,7 @@ */ #include "shared-bindings/busio/SPI.h" +#include "shared-bindings/microcontroller/Pin.h" #include "py/mperrno.h" #include "py/runtime.h" @@ -32,8 +33,8 @@ #include "peripheral_clk_config.h" #include "supervisor/board.h" +#include "supervisor/shared/translate/translate.h" #include "common-hal/busio/__init__.h" -#include "common-hal/microcontroller/Pin.h" #include "hal/include/hal_gpio.h" #include "hal/include/hal_spi_m_sync.h" @@ -133,7 +134,7 @@ void common_hal_busio_spi_construct(busio_spi_obj_t *self, } } if (sercom == NULL) { - mp_raise_ValueError(translate("Invalid pins")); + raise_ValueError_invalid_pins(); } // Set up SPI clocks on SERCOM. diff --git a/ports/atmel-samd/common-hal/busio/UART.c b/ports/atmel-samd/common-hal/busio/UART.c index 194f1c0217..3a9b628e0b 100644 --- a/ports/atmel-samd/common-hal/busio/UART.c +++ b/ports/atmel-samd/common-hal/busio/UART.c @@ -25,6 +25,7 @@ */ #include "shared-bindings/microcontroller/__init__.h" +#include "shared-bindings/microcontroller/Pin.h" #include "shared-bindings/busio/UART.h" #include "mpconfigport.h" @@ -33,7 +34,7 @@ #include "py/mperrno.h" #include "py/runtime.h" #include "py/stream.h" -#include "supervisor/shared/translate.h" +#include "supervisor/shared/translate/translate.h" #include "supervisor/shared/tick.h" #include "hpl_sercom_config.h" @@ -70,21 +71,26 @@ void common_hal_busio_uart_construct(busio_uart_obj_t *self, uint8_t rx_pad = 255; // Unset pad uint32_t tx_pinmux = 0; uint8_t tx_pad = 255; // Unset pad + uint32_t rts_pinmux = 0; + uint32_t cts_pinmux = 0; // Set state so the object is deinited to start. self->rx_pin = NO_PIN; self->tx_pin = NO_PIN; + self->rts_pin = NO_PIN; + self->cts_pin = NO_PIN; - if ((rts != NULL) || (cts != NULL) || (rs485_dir != NULL) || (rs485_invert)) { - mp_raise_ValueError(translate("RTS/CTS/RS485 Not yet supported on this device")); + if ((rs485_dir != NULL) || (rs485_invert)) { + mp_raise_NotImplementedError(translate("RS485")); } - if (bits > 8) { - mp_raise_NotImplementedError(translate("bytes > 8 bits not supported")); - } + mp_arg_validate_int_max(bits, 8, MP_QSTR_bits); bool have_tx = tx != NULL; bool have_rx = rx != NULL; + bool have_rts = rts != NULL; + bool have_cts = cts != NULL; + if (!have_tx && !have_rx) { mp_raise_ValueError(translate("tx and rx cannot both be None")); } @@ -123,6 +129,9 @@ void common_hal_busio_uart_construct(busio_uart_obj_t *self, #endif tx_pinmux = PINMUX(tx->number, (i == 0) ? MUX_C : MUX_D); tx_pad = tx->sercom[i].pad; + if (have_rts) { + rts_pinmux = PINMUX(rts->number, (i == 0) ? MUX_C : MUX_D); + } if (rx == NULL) { sercom = potential_sercom; break; @@ -135,6 +144,9 @@ void common_hal_busio_uart_construct(busio_uart_obj_t *self, rx->sercom[j].pad != tx_pad) { rx_pinmux = PINMUX(rx->number, (j == 0) ? MUX_C : MUX_D); rx_pad = rx->sercom[j].pad; + if (have_cts) { + cts_pinmux = PINMUX(cts->number, (j == 0) ? MUX_C : MUX_D); + } sercom = sercom_insts[rx->sercom[j].index]; sercom_index = rx->sercom[j].index; break; @@ -145,7 +157,7 @@ void common_hal_busio_uart_construct(busio_uart_obj_t *self, } } if (sercom == NULL) { - mp_raise_ValueError(translate("Invalid pins")); + raise_ValueError_invalid_pins(); } if (!have_tx) { tx_pad = 0; @@ -175,7 +187,7 @@ void common_hal_busio_uart_construct(busio_uart_obj_t *self, self->buffer = (uint8_t *)gc_alloc(self->buffer_length * sizeof(uint8_t), false, true); if (self->buffer == NULL) { common_hal_busio_uart_deinit(self); - mp_raise_msg_varg(&mp_type_MemoryError, translate("Failed to allocate RX buffer of %d bytes"), self->buffer_length * sizeof(uint8_t)); + m_malloc_fail(self->buffer_length * sizeof(uint8_t)); } } } else { @@ -184,31 +196,42 @@ void common_hal_busio_uart_construct(busio_uart_obj_t *self, } if (usart_async_init(usart_desc_p, sercom, self->buffer, self->buffer_length, NULL) != ERR_NONE) { - mp_raise_ValueError(translate("Could not initialize UART")); + mp_raise_RuntimeError(translate("UART init")); } // usart_async_init() sets a number of defaults based on a prototypical SERCOM // which don't necessarily match what we need. After calling it, set the values // specific to this instantiation of UART. - // Set pads computed for this SERCOM. + // Set pads computed for this SERCOM. Refer to the datasheet for details on pads. // TXPO: // 0x0: TX pad 0; no RTS/CTS - // 0x1: TX pad 2; no RTS/CTS - // 0x2: TX pad 0; RTS: pad 2, CTS: pad 3 (not used by us right now) - // So divide by 2 to map pad to value. + // 0x1: reserved + // 0x2: TX pad 0; RTS: pad 2, CTS: pad 3 + // 0x3: TX pad 0; RTS: pad 2; no CTS // RXPO: // 0x0: RX pad 0 // 0x1: RX pad 1 // 0x2: RX pad 2 // 0x3: RX pad 3 + // Default to TXPO with no RTS/CTS + uint8_t computed_txpo = 0; + // If we have both CTS (with or without RTS), use second pinout + if (have_cts) { + computed_txpo = 2; + } + // If we have RTS only, use the third pinout + if (have_rts && !have_cts) { + computed_txpo = 3; + } + // Doing a group mask and set of the registers saves 60 bytes over setting the bitfields individually. sercom->USART.CTRLA.reg &= ~(SERCOM_USART_CTRLA_TXPO_Msk | SERCOM_USART_CTRLA_RXPO_Msk | SERCOM_USART_CTRLA_FORM_Msk); - sercom->USART.CTRLA.reg |= SERCOM_USART_CTRLA_TXPO(tx_pad / 2) | + sercom->USART.CTRLA.reg |= SERCOM_USART_CTRLA_TXPO(computed_txpo) | SERCOM_USART_CTRLA_RXPO(rx_pad) | (parity == BUSIO_UART_PARITY_NONE ? 0 : SERCOM_USART_CTRLA_FORM(1)); @@ -258,6 +281,26 @@ void common_hal_busio_uart_construct(busio_uart_obj_t *self, self->rx_pin = NO_PIN; } + if (have_rts) { + gpio_set_pin_direction(rts->number, GPIO_DIRECTION_OUT); + gpio_set_pin_pull_mode(rts->number, GPIO_PULL_OFF); + gpio_set_pin_function(rts->number, rts_pinmux); + self->rts_pin = rts->number; + claim_pin(rts); + } else { + self->rts_pin = NO_PIN; + } + + if (have_cts) { + gpio_set_pin_direction(cts->number, GPIO_DIRECTION_IN); + gpio_set_pin_pull_mode(cts->number, GPIO_PULL_OFF); + gpio_set_pin_function(cts->number, cts_pinmux); + self->cts_pin = cts->number; + claim_pin(cts); + } else { + self->cts_pin = NO_PIN; + } + usart_async_enable(usart_desc_p); } @@ -271,6 +314,8 @@ void common_hal_busio_uart_never_reset(busio_uart_obj_t *self) { never_reset_sercom(hw); never_reset_pin_number(self->rx_pin); never_reset_pin_number(self->tx_pin); + never_reset_pin_number(self->rts_pin); + never_reset_pin_number(self->cts_pin); } } return; @@ -290,8 +335,12 @@ void common_hal_busio_uart_deinit(busio_uart_obj_t *self) { usart_async_deinit(usart_desc_p); reset_pin_number(self->rx_pin); reset_pin_number(self->tx_pin); + reset_pin_number(self->rts_pin); + reset_pin_number(self->cts_pin); self->rx_pin = NO_PIN; self->tx_pin = NO_PIN; + self->rts_pin = NO_PIN; + self->cts_pin = NO_PIN; } // Read characters. diff --git a/ports/atmel-samd/common-hal/busio/UART.h b/ports/atmel-samd/common-hal/busio/UART.h index c95fbf1556..b99a16d7db 100644 --- a/ports/atmel-samd/common-hal/busio/UART.h +++ b/ports/atmel-samd/common-hal/busio/UART.h @@ -38,6 +38,8 @@ typedef struct { struct usart_async_descriptor usart_desc; uint8_t rx_pin; uint8_t tx_pin; + int8_t rts_pin; + int8_t cts_pin; uint8_t character_bits; bool rx_error; uint32_t baudrate; diff --git a/ports/atmel-samd/common-hal/countio/Counter.c b/ports/atmel-samd/common-hal/countio/Counter.c index c68b9e18ef..e3694615ab 100644 --- a/ports/atmel-samd/common-hal/countio/Counter.c +++ b/ports/atmel-samd/common-hal/countio/Counter.c @@ -7,7 +7,7 @@ #include "eic_handler.h" #include "samd/external_interrupts.h" #include "py/runtime.h" -#include "supervisor/shared/translate.h" +#include "supervisor/shared/translate/translate.h" void common_hal_countio_counter_construct(countio_counter_obj_t *self, const mcu_pin_obj_t *pin, countio_edge_t edge, digitalio_pull_t pull) { diff --git a/ports/atmel-samd/common-hal/digitalio/DigitalInOut.c b/ports/atmel-samd/common-hal/digitalio/DigitalInOut.c index dee927ce88..dc770a2de3 100644 --- a/ports/atmel-samd/common-hal/digitalio/DigitalInOut.c +++ b/ports/atmel-samd/common-hal/digitalio/DigitalInOut.c @@ -34,7 +34,7 @@ #include "common-hal/microcontroller/Pin.h" #include "shared-bindings/digitalio/DigitalInOut.h" -#include "supervisor/shared/translate.h" +#include "supervisor/shared/translate/translate.h" digitalinout_result_t common_hal_digitalio_digitalinout_construct( digitalio_digitalinout_obj_t *self, const mcu_pin_obj_t *pin) { @@ -66,11 +66,12 @@ void common_hal_digitalio_digitalinout_deinit(digitalio_digitalinout_obj_t *self self->pin = NULL; } -void common_hal_digitalio_digitalinout_switch_to_input( +digitalinout_result_t common_hal_digitalio_digitalinout_switch_to_input( digitalio_digitalinout_obj_t *self, digitalio_pull_t pull) { self->output = false; // This also sets direction to input. common_hal_digitalio_digitalinout_set_pull(self, pull); + return DIGITALINOUT_OK; } digitalinout_result_t common_hal_digitalio_digitalinout_switch_to_output( @@ -151,7 +152,7 @@ digitalio_drive_mode_t common_hal_digitalio_digitalinout_get_drive_mode( } } -void common_hal_digitalio_digitalinout_set_pull( +digitalinout_result_t common_hal_digitalio_digitalinout_set_pull( digitalio_digitalinout_obj_t *self, digitalio_pull_t pull) { enum gpio_pull_mode asf_pull = GPIO_PULL_OFF; switch (pull) { @@ -168,6 +169,7 @@ void common_hal_digitalio_digitalinout_set_pull( // Must set pull after setting direction. gpio_set_pin_direction(self->pin->number, GPIO_DIRECTION_IN); gpio_set_pin_pull_mode(self->pin->number, asf_pull); + return DIGITALINOUT_OK; } digitalio_pull_t common_hal_digitalio_digitalinout_get_pull( diff --git a/ports/atmel-samd/common-hal/frequencyio/FrequencyIn.c b/ports/atmel-samd/common-hal/frequencyio/FrequencyIn.c index 4e06b77b56..22200c5d1c 100644 --- a/ports/atmel-samd/common-hal/frequencyio/FrequencyIn.c +++ b/ports/atmel-samd/common-hal/frequencyio/FrequencyIn.c @@ -45,9 +45,10 @@ #include "peripheral_clk_config.h" #include "hpl_gclk_config.h" +#include "shared-bindings/microcontroller/Pin.h" #include "shared-bindings/time/__init__.h" #include "supervisor/shared/tick.h" -#include "supervisor/shared/translate.h" +#include "supervisor/shared/translate/translate.h" #ifdef SAMD21 #include "hpl/gclk/hpl_gclk_base.h" @@ -282,11 +283,11 @@ static void frequencyin_samd51_stop_dpll(void) { void common_hal_frequencyio_frequencyin_construct(frequencyio_frequencyin_obj_t* self, const mcu_pin_obj_t* pin, const uint16_t capture_period) { if (!pin->has_extint) { - mp_raise_RuntimeError(translate("No hardware support on pin")); - } - if ((capture_period == 0) || (capture_period > 500)) { - mp_raise_ValueError(translate("Invalid capture period. Valid range: 1 - 500")); + raise_ValueError_invalid_pin(); } + + mp_arg_validate_int_range(capture_period, 0, 500, MP_QSTR_capture_period); + uint32_t mask = 1 << pin->extint_channel; if (eic_get_enable() == 1 && #ifdef SAMD21 @@ -569,9 +570,7 @@ uint16_t common_hal_frequencyio_frequencyin_get_capture_period(frequencyio_frequ } 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")); - } + mp_arg_validate_int_range(capture_period, 1, 500, MP_QSTR_capture_period); self->capture_period = capture_period; diff --git a/ports/atmel-samd/common-hal/i2cperipheral/__init__.c b/ports/atmel-samd/common-hal/i2cperipheral/__init__.c deleted file mode 100644 index c67511c536..0000000000 --- a/ports/atmel-samd/common-hal/i2cperipheral/__init__.c +++ /dev/null @@ -1 +0,0 @@ -// No i2cperipheral module functions. diff --git a/ports/atmel-samd/common-hal/i2cperipheral/I2CPeripheral.c b/ports/atmel-samd/common-hal/i2ctarget/I2CTarget.c similarity index 82% rename from ports/atmel-samd/common-hal/i2cperipheral/I2CPeripheral.c rename to ports/atmel-samd/common-hal/i2ctarget/I2CTarget.c index e1849a6b15..a687143281 100644 --- a/ports/atmel-samd/common-hal/i2cperipheral/I2CPeripheral.c +++ b/ports/atmel-samd/common-hal/i2ctarget/I2CTarget.c @@ -24,7 +24,8 @@ * THE SOFTWARE. */ -#include "shared-bindings/i2cperipheral/I2CPeripheral.h" +#include "shared-bindings/i2ctarget/I2CTarget.h" +#include "shared-bindings/microcontroller/Pin.h" #include "common-hal/busio/I2C.h" #include "shared/runtime/interrupt_char.h" @@ -35,14 +36,14 @@ #include "hal/include/hal_gpio.h" #include "peripherals/samd/sercom.h" -void common_hal_i2cperipheral_i2c_peripheral_construct(i2cperipheral_i2c_peripheral_obj_t *self, +void common_hal_i2ctarget_i2c_target_construct(i2ctarget_i2c_target_obj_t *self, const mcu_pin_obj_t *scl, const mcu_pin_obj_t *sda, uint8_t *addresses, unsigned int num_addresses, bool smbus) { uint8_t sercom_index; uint32_t sda_pinmux, scl_pinmux; Sercom *sercom = samd_i2c_get_sercom(scl, sda, &sercom_index, &sda_pinmux, &scl_pinmux); if (sercom == NULL) { - mp_raise_ValueError(translate("Invalid pins")); + raise_ValueError_invalid_pins(); } self->sercom = sercom; @@ -99,12 +100,12 @@ void common_hal_i2cperipheral_i2c_peripheral_construct(i2cperipheral_i2c_periphe sercom->I2CS.CTRLA.bit.ENABLE = 1; } -bool common_hal_i2cperipheral_i2c_peripheral_deinited(i2cperipheral_i2c_peripheral_obj_t *self) { +bool common_hal_i2ctarget_i2c_target_deinited(i2ctarget_i2c_target_obj_t *self) { return self->sda_pin == NO_PIN; } -void common_hal_i2cperipheral_i2c_peripheral_deinit(i2cperipheral_i2c_peripheral_obj_t *self) { - if (common_hal_i2cperipheral_i2c_peripheral_deinited(self)) { +void common_hal_i2ctarget_i2c_target_deinit(i2ctarget_i2c_target_obj_t *self) { + if (common_hal_i2ctarget_i2c_target_deinited(self)) { return; } @@ -116,7 +117,7 @@ void common_hal_i2cperipheral_i2c_peripheral_deinit(i2cperipheral_i2c_peripheral self->scl_pin = NO_PIN; } -static int i2c_peripheral_check_error(i2cperipheral_i2c_peripheral_obj_t *self, bool raise) { +static int i2c_target_check_error(i2ctarget_i2c_target_obj_t *self, bool raise) { if (!self->sercom->I2CS.INTFLAG.bit.ERROR) { return 0; } @@ -135,8 +136,8 @@ static int i2c_peripheral_check_error(i2cperipheral_i2c_peripheral_obj_t *self, return -err; } -int common_hal_i2cperipheral_i2c_peripheral_is_addressed(i2cperipheral_i2c_peripheral_obj_t *self, uint8_t *address, bool *is_read, bool *is_restart) { - int err = i2c_peripheral_check_error(self, false); +int common_hal_i2ctarget_i2c_target_is_addressed(i2ctarget_i2c_target_obj_t *self, uint8_t *address, bool *is_read, bool *is_restart) { + int err = i2c_target_check_error(self, false); if (err) { return err; } @@ -153,22 +154,22 @@ int common_hal_i2cperipheral_i2c_peripheral_is_addressed(i2cperipheral_i2c_perip for (unsigned int i = 0; i < self->num_addresses; i++) { if (*address == self->addresses[i]) { - common_hal_i2cperipheral_i2c_peripheral_ack(self, true); + common_hal_i2ctarget_i2c_target_ack(self, true); return 1; } } // This should clear AMATCH, but it doesn't... - common_hal_i2cperipheral_i2c_peripheral_ack(self, false); + common_hal_i2ctarget_i2c_target_ack(self, false); return 0; } -int common_hal_i2cperipheral_i2c_peripheral_read_byte(i2cperipheral_i2c_peripheral_obj_t *self, uint8_t *data) { +int common_hal_i2ctarget_i2c_target_read_byte(i2ctarget_i2c_target_obj_t *self, uint8_t *data) { for (int t = 0; t < 100 && !self->sercom->I2CS.INTFLAG.reg; t++) { mp_hal_delay_us(10); } - i2c_peripheral_check_error(self, true); + i2c_target_check_error(self, true); if (!self->sercom->I2CS.INTFLAG.bit.DRDY || self->sercom->I2CS.INTFLAG.bit.PREC || @@ -180,12 +181,12 @@ int common_hal_i2cperipheral_i2c_peripheral_read_byte(i2cperipheral_i2c_peripher return 1; } -int common_hal_i2cperipheral_i2c_peripheral_write_byte(i2cperipheral_i2c_peripheral_obj_t *self, uint8_t data) { +int common_hal_i2ctarget_i2c_target_write_byte(i2ctarget_i2c_target_obj_t *self, uint8_t data) { for (int t = 0; !self->sercom->I2CS.INTFLAG.reg && t < 100; t++) { mp_hal_delay_us(10); } - i2c_peripheral_check_error(self, true); + i2c_target_check_error(self, true); if (self->sercom->I2CS.INTFLAG.bit.PREC) { return 0; @@ -207,12 +208,12 @@ int common_hal_i2cperipheral_i2c_peripheral_write_byte(i2cperipheral_i2c_periphe return 1; } -void common_hal_i2cperipheral_i2c_peripheral_ack(i2cperipheral_i2c_peripheral_obj_t *self, bool ack) { +void common_hal_i2ctarget_i2c_target_ack(i2ctarget_i2c_target_obj_t *self, bool ack) { self->sercom->I2CS.CTRLB.bit.ACKACT = !ack; self->sercom->I2CS.CTRLB.bit.CMD = 0x03; } -void common_hal_i2cperipheral_i2c_peripheral_close(i2cperipheral_i2c_peripheral_obj_t *self) { +void common_hal_i2ctarget_i2c_target_close(i2ctarget_i2c_target_obj_t *self) { for (int t = 0; !self->sercom->I2CS.INTFLAG.reg && t < 100; t++) { mp_hal_delay_us(10); } @@ -222,7 +223,7 @@ void common_hal_i2cperipheral_i2c_peripheral_close(i2cperipheral_i2c_peripheral_ } if (!self->sercom->I2CS.STATUS.bit.DIR) { - common_hal_i2cperipheral_i2c_peripheral_ack(self, false); + common_hal_i2ctarget_i2c_target_ack(self, false); } else { int i = 0; while (self->sercom->I2CS.INTFLAG.reg == SERCOM_I2CS_INTFLAG_DRDY) { diff --git a/ports/atmel-samd/common-hal/i2cperipheral/I2CPeripheral.h b/ports/atmel-samd/common-hal/i2ctarget/I2CTarget.h similarity index 85% rename from ports/atmel-samd/common-hal/i2cperipheral/I2CPeripheral.h rename to ports/atmel-samd/common-hal/i2ctarget/I2CTarget.h index 03ae3a2885..894961ab7b 100644 --- a/ports/atmel-samd/common-hal/i2cperipheral/I2CPeripheral.h +++ b/ports/atmel-samd/common-hal/i2ctarget/I2CTarget.h @@ -24,8 +24,8 @@ * THE SOFTWARE. */ -#ifndef MICROPY_INCLUDED_ATMEL_SAMD_COMMON_HAL_BUSIO_I2C_PERIPHERAL_H -#define MICROPY_INCLUDED_ATMEL_SAMD_COMMON_HAL_BUSIO_I2C_PERIPHERAL_H +#ifndef MICROPY_INCLUDED_ATMEL_SAMD_COMMON_HAL_BUSIO_I2C_TARGET_H +#define MICROPY_INCLUDED_ATMEL_SAMD_COMMON_HAL_BUSIO_I2C_TARGET_H #include "common-hal/microcontroller/Pin.h" #include "py/obj.h" @@ -40,6 +40,6 @@ typedef struct { uint8_t scl_pin; uint8_t sda_pin; bool writing; -} i2cperipheral_i2c_peripheral_obj_t; +} i2ctarget_i2c_target_obj_t; -#endif // MICROPY_INCLUDED_ATMEL_SAMD_COMMON_HAL_BUSIO_I2C_PERIPHERAL_H +#endif // MICROPY_INCLUDED_ATMEL_SAMD_COMMON_HAL_BUSIO_I2C_TARGET_H diff --git a/ports/atmel-samd/common-hal/i2ctarget/__init__.c b/ports/atmel-samd/common-hal/i2ctarget/__init__.c new file mode 100644 index 0000000000..4ec26465ad --- /dev/null +++ b/ports/atmel-samd/common-hal/i2ctarget/__init__.c @@ -0,0 +1 @@ +// No i2ctarget module functions. diff --git a/ports/atmel-samd/common-hal/imagecapture/ParallelImageCapture.c b/ports/atmel-samd/common-hal/imagecapture/ParallelImageCapture.c index 8e41f50d8d..c86ffb8d65 100644 --- a/ports/atmel-samd/common-hal/imagecapture/ParallelImageCapture.c +++ b/ports/atmel-samd/common-hal/imagecapture/ParallelImageCapture.c @@ -63,16 +63,16 @@ void common_hal_imagecapture_parallelimagecapture_construct(imagecapture_paralle } // The peripheral supports 8, 10, 12, or 14 data bits, but the code only supports 8 at present if (data_count != 8) { - mp_raise_ValueError_varg(translate("Invalid data_count %d"), data_count); + mp_arg_error_invalid(MP_QSTR_datacount); } if (vertical_sync && vertical_sync->number != PIN_PCC_DEN1) { - mp_raise_ValueError_varg(translate("Invalid %q pin"), MP_QSTR_vsync); + raise_ValueError_invalid_pin_name(MP_QSTR_vsync); } if (horizontal_reference && horizontal_reference->number != PIN_PCC_DEN2) { - mp_raise_ValueError_varg(translate("Invalid %q pin"), MP_QSTR_href); + raise_ValueError_invalid_pin_name(MP_QSTR_href); } if (data_clock->number != PIN_PCC_CLK) { - mp_raise_ValueError_varg(translate("Invalid %q pin"), MP_QSTR_data_clock); + raise_ValueError_invalid_pin_name(MP_QSTR_data_clock); } // technically, 0 was validated as free already but check again for (int i = 0; i < data_count; i++) { diff --git a/ports/atmel-samd/common-hal/microcontroller/Pin.c b/ports/atmel-samd/common-hal/microcontroller/Pin.c index 1460ece59e..b36286e5f2 100644 --- a/ports/atmel-samd/common-hal/microcontroller/Pin.c +++ b/ports/atmel-samd/common-hal/microcontroller/Pin.c @@ -27,6 +27,7 @@ #include "py/runtime.h" #include "shared-bindings/microcontroller/Pin.h" +#include "supervisor/shared/translate/translate.h" #include "atmel_start_pins.h" #include "hal/include/hal_gpio.h" diff --git a/ports/atmel-samd/common-hal/microcontroller/__init__.c b/ports/atmel-samd/common-hal/microcontroller/__init__.c index 983af7a647..60b35a2c5c 100644 --- a/ports/atmel-samd/common-hal/microcontroller/__init__.c +++ b/ports/atmel-samd/common-hal/microcontroller/__init__.c @@ -36,7 +36,7 @@ #include "shared-bindings/microcontroller/Pin.h" #include "shared-bindings/microcontroller/Processor.h" #include "supervisor/shared/safe_mode.h" -#include "supervisor/shared/translate.h" +#include "supervisor/shared/translate/translate.h" void common_hal_mcu_delay_us(uint32_t delay) { mp_hal_delay_us(delay); @@ -66,7 +66,7 @@ void common_hal_mcu_enable_interrupts(void) { void common_hal_mcu_on_next_reset(mcu_runmode_t runmode) { if (runmode == RUNMODE_BOOTLOADER) { if (!bootloader_available()) { - mp_raise_ValueError(translate("Cannot reset into bootloader because no bootloader is present.")); + mp_raise_ValueError(translate("Cannot reset into bootloader because no bootloader is present")); } // Pretend to be the first of the two reset presses needed to enter the // bootloader. That way one reset will end in the bootloader. diff --git a/ports/atmel-samd/common-hal/ps2io/Ps2.c b/ports/atmel-samd/common-hal/ps2io/Ps2.c index 6e2fb58e51..43f40aa48e 100644 --- a/ports/atmel-samd/common-hal/ps2io/Ps2.c +++ b/ports/atmel-samd/common-hal/ps2io/Ps2.c @@ -43,7 +43,7 @@ #include "shared-bindings/microcontroller/__init__.h" #include "shared-bindings/ps2io/Ps2.h" #include "supervisor/port.h" -#include "supervisor/shared/translate.h" +#include "supervisor/shared/translate/translate.h" #define STATE_IDLE 0 #define STATE_RECV 1 @@ -79,7 +79,7 @@ static void resume_interrupt(ps2io_ps2_obj_t *self) { disable_interrupt(self); self->state = STATE_IDLE; - gpio_set_pin_function(self->clk_pin, GPIO_PIN_FUNCTION_A); + gpio_set_pin_function(self->clock_pin, GPIO_PIN_FUNCTION_A); uint32_t mask = 1 << self->channel; EIC->INTFLAG.reg = mask << EIC_INTFLAG_EXTINT_Pos; EIC->INTENSET.reg = mask << EIC_INTENSET_EXTINT_Pos; @@ -90,14 +90,14 @@ static void resume_interrupt(ps2io_ps2_obj_t *self) { static void clk_hi(ps2io_ps2_obj_t *self) { // External pull-up // Must set pull after setting direction. - gpio_set_pin_direction(self->clk_pin, GPIO_DIRECTION_IN); - gpio_set_pin_pull_mode(self->clk_pin, GPIO_PULL_OFF); + gpio_set_pin_direction(self->clock_pin, GPIO_DIRECTION_IN); + gpio_set_pin_pull_mode(self->clock_pin, GPIO_PULL_OFF); } static bool wait_clk_lo(ps2io_ps2_obj_t *self, uint32_t us) { clk_hi(self); common_hal_mcu_delay_us(1); - while (gpio_get_pin_level(self->clk_pin) && us) { + while (gpio_get_pin_level(self->clock_pin) && us) { --us; common_hal_mcu_delay_us(1); } @@ -107,7 +107,7 @@ static bool wait_clk_lo(ps2io_ps2_obj_t *self, uint32_t us) { static bool wait_clk_hi(ps2io_ps2_obj_t *self, uint32_t us) { clk_hi(self); common_hal_mcu_delay_us(1); - while (!gpio_get_pin_level(self->clk_pin) && us) { + while (!gpio_get_pin_level(self->clock_pin) && us) { --us; common_hal_mcu_delay_us(1); } @@ -115,9 +115,9 @@ static bool wait_clk_hi(ps2io_ps2_obj_t *self, uint32_t us) { } static void clk_lo(ps2io_ps2_obj_t *self) { - gpio_set_pin_pull_mode(self->clk_pin, GPIO_PULL_OFF); - gpio_set_pin_direction(self->clk_pin, GPIO_DIRECTION_OUT); - gpio_set_pin_level(self->clk_pin, 0); + gpio_set_pin_pull_mode(self->clock_pin, GPIO_PULL_OFF); + gpio_set_pin_direction(self->clock_pin, GPIO_DIRECTION_OUT); + gpio_set_pin_level(self->clock_pin, 0); } static void data_hi(ps2io_ps2_obj_t *self) { @@ -244,19 +244,19 @@ void ps2_interrupt_handler(uint8_t channel) { } void common_hal_ps2io_ps2_construct(ps2io_ps2_obj_t *self, - const mcu_pin_obj_t *data_pin, const mcu_pin_obj_t *clk_pin) { - if (!clk_pin->has_extint) { - mp_raise_RuntimeError(translate("No hardware support on clk pin")); + const mcu_pin_obj_t *data_pin, const mcu_pin_obj_t *clock_pin) { + if (!clock_pin->has_extint) { + mp_arg_error_invalid(MP_QSTR_clock_pin); } - if (eic_get_enable() && !eic_channel_free(clk_pin->extint_channel)) { + if (eic_get_enable() && !eic_channel_free(clock_pin->extint_channel)) { mp_raise_RuntimeError(translate("EXTINT channel already in use")); } clk_hi(self); data_hi(self); - self->channel = clk_pin->extint_channel; - self->clk_pin = clk_pin->number; + self->channel = clock_pin->extint_channel; + self->clock_pin = clock_pin->number; self->data_pin = data_pin->number; self->state = STATE_IDLE; self->bufcount = 0; @@ -264,19 +264,19 @@ void common_hal_ps2io_ps2_construct(ps2io_ps2_obj_t *self, self->bufposw = 0; self->waiting_cmd_response = false; - set_eic_channel_data(clk_pin->extint_channel, (void *)self); + set_eic_channel_data(clock_pin->extint_channel, (void *)self); // Check to see if the EIC is enabled and start it up if its not.' if (eic_get_enable() == 0) { turn_on_external_interrupt_controller(); } - gpio_set_pin_function(clk_pin->number, GPIO_PIN_FUNCTION_A); + gpio_set_pin_function(clock_pin->number, GPIO_PIN_FUNCTION_A); gpio_set_pin_function(data_pin->number, GPIO_PIN_FUNCTION_A); turn_on_cpu_interrupt(self->channel); - claim_pin(clk_pin); + claim_pin(clock_pin); claim_pin(data_pin); // Set config will enable the EIC. @@ -284,7 +284,7 @@ void common_hal_ps2io_ps2_construct(ps2io_ps2_obj_t *self, } bool common_hal_ps2io_ps2_deinited(ps2io_ps2_obj_t *self) { - return self->clk_pin == NO_PIN; + return self->clock_pin == NO_PIN; } void common_hal_ps2io_ps2_deinit(ps2io_ps2_obj_t *self) { @@ -293,9 +293,9 @@ void common_hal_ps2io_ps2_deinit(ps2io_ps2_obj_t *self) { } set_eic_handler(self->channel, EIC_HANDLER_NO_INTERRUPT); turn_off_eic_channel(self->channel); - reset_pin_number(self->clk_pin); + reset_pin_number(self->clock_pin); reset_pin_number(self->data_pin); - self->clk_pin = NO_PIN; + self->clock_pin = NO_PIN; self->data_pin = NO_PIN; } diff --git a/ports/atmel-samd/common-hal/ps2io/Ps2.h b/ports/atmel-samd/common-hal/ps2io/Ps2.h index 588dfdd8be..fa8defdbeb 100644 --- a/ports/atmel-samd/common-hal/ps2io/Ps2.h +++ b/ports/atmel-samd/common-hal/ps2io/Ps2.h @@ -35,7 +35,7 @@ typedef struct { mp_obj_base_t base; uint8_t channel; - uint8_t clk_pin; + uint8_t clock_pin; uint8_t data_pin; uint8_t state; diff --git a/ports/atmel-samd/common-hal/pulseio/PulseIn.c b/ports/atmel-samd/common-hal/pulseio/PulseIn.c index 0927faa00a..8bf889bed3 100644 --- a/ports/atmel-samd/common-hal/pulseio/PulseIn.c +++ b/ports/atmel-samd/common-hal/pulseio/PulseIn.c @@ -41,9 +41,10 @@ #include "samd/pins.h" #include "samd/timers.h" #include "shared-bindings/microcontroller/__init__.h" +#include "shared-bindings/microcontroller/Pin.h" #include "shared-bindings/pulseio/PulseIn.h" #include "supervisor/shared/tick.h" -#include "supervisor/shared/translate.h" +#include "supervisor/shared/translate/translate.h" #include "supervisor/port.h" // This timer is shared amongst all PulseIn objects as a higher resolution clock. @@ -152,7 +153,7 @@ void pulsein_reset() { void common_hal_pulseio_pulsein_construct(pulseio_pulsein_obj_t *self, const mcu_pin_obj_t *pin, uint16_t maxlen, bool idle_state) { if (!pin->has_extint) { - mp_raise_RuntimeError(translate("No hardware support on pin")); + raise_ValueError_invalid_pin(); } if (eic_get_enable() && !eic_channel_free(pin->extint_channel)) { mp_raise_RuntimeError(translate("EXTINT channel already in use")); @@ -160,7 +161,7 @@ void common_hal_pulseio_pulsein_construct(pulseio_pulsein_obj_t *self, self->buffer = (uint16_t *)m_malloc(maxlen * sizeof(uint16_t), false); if (self->buffer == NULL) { - mp_raise_msg_varg(&mp_type_MemoryError, translate("Failed to allocate RX buffer of %d bytes"), maxlen * sizeof(uint16_t)); + m_malloc_fail(maxlen * sizeof(uint16_t)); } self->channel = pin->extint_channel; self->pin = pin->number; @@ -344,15 +345,15 @@ bool common_hal_pulseio_pulsein_get_paused(pulseio_pulsein_obj_t *self) { return (EIC->INTENSET.reg & (mask << EIC_INTENSET_EXTINT_Pos)) == 0; } -uint16_t common_hal_pulseio_pulsein_get_item(pulseio_pulsein_obj_t *self, - int16_t index) { +uint16_t common_hal_pulseio_pulsein_get_item(pulseio_pulsein_obj_t *self, int16_t index) { common_hal_mcu_disable_interrupts(); if (index < 0) { index += self->len; } if (index < 0 || index >= self->len) { common_hal_mcu_enable_interrupts(); - mp_raise_IndexError_varg(translate("%q index out of range"), MP_QSTR_PulseIn); + // Can't use mp_arg_validate_index_range() here due to the critical section. + mp_raise_IndexError_varg(translate("%q out of range"), MP_QSTR_index); } uint16_t value = self->buffer[(self->start + index) % self->maxlen]; common_hal_mcu_enable_interrupts(); diff --git a/ports/atmel-samd/common-hal/pulseio/PulseOut.c b/ports/atmel-samd/common-hal/pulseio/PulseOut.c index b0407a1136..dc98e4bd18 100644 --- a/ports/atmel-samd/common-hal/pulseio/PulseOut.c +++ b/ports/atmel-samd/common-hal/pulseio/PulseOut.c @@ -36,7 +36,7 @@ #include "py/gc.h" #include "py/runtime.h" #include "shared-bindings/pulseio/PulseOut.h" -#include "supervisor/shared/translate.h" +#include "supervisor/shared/translate/translate.h" #include "timer_handler.h" // This timer is shared amongst all PulseOut objects under the assumption that diff --git a/ports/atmel-samd/common-hal/pwmio/PWMOut.c b/ports/atmel-samd/common-hal/pwmio/PWMOut.c index eaec10463d..c6e9e07304 100644 --- a/ports/atmel-samd/common-hal/pwmio/PWMOut.c +++ b/ports/atmel-samd/common-hal/pwmio/PWMOut.c @@ -38,7 +38,7 @@ #include "hal/utils/include/utils_repeat_macro.h" #include "samd/pins.h" #include "samd/timers.h" -#include "supervisor/shared/translate.h" +#include "supervisor/shared/translate/translate.h" #undef ENABLE @@ -377,7 +377,7 @@ void common_hal_pwmio_pwmout_set_frequency(pwmio_pwmout_obj_t *self, uint32_t frequency) { uint32_t system_clock = common_hal_mcu_processor_get_frequency(); if (frequency == 0 || frequency > system_clock / 2) { - mp_raise_ValueError(translate("Invalid PWM frequency")); + mp_arg_error_invalid(MP_QSTR_frequency); } const pin_timer_t *t = self->timer; uint8_t resolution; diff --git a/ports/atmel-samd/common-hal/rotaryio/IncrementalEncoder.c b/ports/atmel-samd/common-hal/rotaryio/IncrementalEncoder.c index 856fe04dbc..d253e0967e 100644 --- a/ports/atmel-samd/common-hal/rotaryio/IncrementalEncoder.c +++ b/ports/atmel-samd/common-hal/rotaryio/IncrementalEncoder.c @@ -33,7 +33,7 @@ #include "eic_handler.h" #include "samd/external_interrupts.h" #include "py/runtime.h" -#include "supervisor/shared/translate.h" +#include "supervisor/shared/translate/translate.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) { diff --git a/ports/atmel-samd/common-hal/rtc/RTC.c b/ports/atmel-samd/common-hal/rtc/RTC.c index e2a67bd174..0ebb61e11b 100644 --- a/ports/atmel-samd/common-hal/rtc/RTC.c +++ b/ports/atmel-samd/common-hal/rtc/RTC.c @@ -37,7 +37,7 @@ #include "shared-bindings/rtc/__init__.h" #include "shared-bindings/rtc/RTC.h" #include "supervisor/port.h" -#include "supervisor/shared/translate.h" +#include "supervisor/shared/translate/translate.h" // This is the time in seconds since 2000 that the RTC was started. // TODO: Change the offset to ticks so that it can be a subsecond adjustment. @@ -68,13 +68,7 @@ int common_hal_rtc_get_calibration(void) { } void common_hal_rtc_set_calibration(int calibration) { - if (calibration > 127 || calibration < -127) { - #if CIRCUITPY_FULL_BUILD - mp_raise_ValueError(translate("calibration value out of range +/-127")); - #else - mp_raise_ValueError(translate("calibration is out of range")); - #endif - } + mp_arg_validate_int_range(calibration, -127, 127, MP_QSTR_calibration); hri_rtcmode0_write_FREQCORR_SIGN_bit(RTC, calibration < 0 ? 0 : 1); hri_rtcmode0_write_FREQCORR_VALUE_bf(RTC, abs(calibration)); diff --git a/ports/atmel-samd/common-hal/sdioio/SDCard.c b/ports/atmel-samd/common-hal/sdioio/SDCard.c index 10ccb63a55..7ce8a1e1b1 100644 --- a/ports/atmel-samd/common-hal/sdioio/SDCard.c +++ b/ports/atmel-samd/common-hal/sdioio/SDCard.c @@ -32,7 +32,7 @@ #include "shared-bindings/sdioio/SDCard.h" #include "shared-bindings/microcontroller/Pin.h" #include "shared-bindings/microcontroller/__init__.h" -#include "supervisor/shared/translate.h" +#include "supervisor/shared/translate/translate.h" #include "genhdr/sdiodata.h" diff --git a/ports/atmel-samd/common-hal/touchio/TouchIn.c b/ports/atmel-samd/common-hal/touchio/TouchIn.c index 89979b620f..c3fae041fb 100644 --- a/ports/atmel-samd/common-hal/touchio/TouchIn.c +++ b/ports/atmel-samd/common-hal/touchio/TouchIn.c @@ -31,8 +31,9 @@ #include "py/runtime.h" #include "py/binary.h" #include "py/mphal.h" +#include "shared-bindings/microcontroller/Pin.h" #include "shared-bindings/touchio/TouchIn.h" -#include "supervisor/shared/translate.h" +#include "supervisor/shared/translate/translate.h" // Native touchio only exists for SAMD21 #ifdef SAMD21 @@ -60,7 +61,7 @@ static uint16_t get_raw_reading(touchio_touchin_obj_t *self) { void common_hal_touchio_touchin_construct(touchio_touchin_obj_t *self, const mcu_pin_obj_t *pin) { if (!pin->has_touch) { - mp_raise_ValueError(translate("Invalid pin")); + raise_ValueError_invalid_pin(); } claim_pin(pin); diff --git a/ports/atmel-samd/libs/libgcc-12.1.0-Os-v6-m-nofp.a b/ports/atmel-samd/libs/libgcc-12.1.0-Os-v6-m-nofp.a new file mode 100644 index 0000000000..56692d5d05 Binary files /dev/null and b/ports/atmel-samd/libs/libgcc-12.1.0-Os-v6-m-nofp.a differ diff --git a/ports/atmel-samd/mpconfigport.h b/ports/atmel-samd/mpconfigport.h index e200ce67db..9d4ddd7134 100644 --- a/ports/atmel-samd/mpconfigport.h +++ b/ports/atmel-samd/mpconfigport.h @@ -46,6 +46,7 @@ #define MICROPY_PY_BUILTINS_NOTIMPLEMENTED (0) #define MICROPY_PY_FUNCTION_ATTRS (0) #define MICROPY_PY_REVERSE_SPECIAL_METHODS (0) +#define MICROPY_PY_COLLECTIONS_DEQUE (0) #define MICROPY_PY_COLLECTIONS_ORDEREDDICT (0) #define MICROPY_PY_UERRNO_LIST \ X(EPERM) \ diff --git a/ports/atmel-samd/mpconfigport.mk b/ports/atmel-samd/mpconfigport.mk index f031386a73..e6f5759f1c 100644 --- a/ports/atmel-samd/mpconfigport.mk +++ b/ports/atmel-samd/mpconfigport.mk @@ -9,6 +9,7 @@ USB_NUM_ENDPOINT_PAIRS = 8 CIRCUITPY_ROTARYIO_SOFTENCODER = 1 CIRCUITPY_OPTIMIZE_PROPERTY_FLASH_SIZE ?= 1 +CIRCUITPY_LTO = 1 ###################################################################### # Put samd21-only choices here. @@ -37,7 +38,7 @@ CIRCUITPY_FRAMEBUFFERIO ?= 0 CIRCUITPY_FREQUENCYIO ?= 0 CIRCUITPY_GETPASS ?= 0 CIRCUITPY_GIFIO ?= 0 -CIRCUITPY_I2CPERIPHERAL ?= 0 +CIRCUITPY_I2CTARGET ?= 0 CIRCUITPY_JSON ?= 0 CIRCUITPY_KEYPAD ?= 0 CIRCUITPY_MSGPACK ?= 0 @@ -45,31 +46,26 @@ CIRCUITPY_RE ?= 0 CIRCUITPY_SDCARDIO ?= 0 CIRCUITPY_SYNTHIO ?= 0 CIRCUITPY_TOUCHIO_USE_NATIVE ?= 1 +CIRCUITPY_TRACEBACK = 0 CIRCUITPY_ULAB = 0 CIRCUITPY_VECTORIO = 0 CIRCUITPY_ZLIB = 0 -# TODO: In CircuitPython 8.0, turn this back on, after `busio.OneWire` is removed. -# We'd like a smoother transition, but we can't afford the space to have both -# `busio.OneWire` and `onewireio.OneWire` present on these tiny builds. +# Turn off a few more things that don't fit in 192kB ifeq ($(INTERNAL_FLASH_FILESYSTEM),1) CIRCUITPY_ONEWIREIO ?= 0 +CIRCUITPY_USB_IDENTIFICATION ?= 0 endif MICROPY_PY_ASYNC_AWAIT = 0 -# We don't have room for the fonts for terminalio for ja and ko +# We don't have room for the fonts for terminalio for certain languages, # so turn off terminalio, and if it's off and displayio is on, # force a clean build. # Note that we cannot test $(CIRCUITPY_DISPLAYIO) directly with an # ifeq, because it's not set yet. -ifeq ($(TRANSLATION), ja) -CIRCUITPY_TERMINALIO = 0 -RELEASE_NEEDS_CLEAN_BUILD = $(CIRCUITPY_DISPLAYIO) -endif - -ifeq ($(TRANSLATION), ko) +ifneq (,$(filter $(TRANSLATION),ja ko ru)) CIRCUITPY_TERMINALIO = 0 RELEASE_NEEDS_CLEAN_BUILD = $(CIRCUITPY_DISPLAYIO) endif @@ -77,6 +73,8 @@ endif SUPEROPT_GC = 0 SUPEROPT_VM = 0 +CIRCUITPY_LTO_PARTITION = one + ifeq ($(CIRCUITPY_FULL_BUILD),0) # On the smallest boards, this saves about 180 bytes. On other boards, it may -increase- space used. CFLAGS_BOARD = -fweb -frename-registers @@ -93,6 +91,10 @@ ifeq ($(CHIP_FAMILY),samd51) # No native touchio on SAMD51. CIRCUITPY_TOUCHIO_USE_NATIVE = 0 +ifeq ($(CIRCUITPY_FULL_BUILD),0) +CIRCUITPY_LTO_PARTITION ?= one +endif + # The ?='s allow overriding in mpconfigboard.mk. @@ -115,6 +117,10 @@ ifeq ($(CHIP_FAMILY),same51) # No native touchio on SAME51. CIRCUITPY_TOUCHIO_USE_NATIVE = 0 +ifeq ($(CIRCUITPY_FULL_BUILD),0) +CIRCUITPY_LTO_PARTITION ?= one +endif + # The ?='s allow overriding in mpconfigboard.mk. CIRCUITPY_ALARM ?= 1 @@ -126,3 +132,5 @@ CIRCUITPY_RGBMATRIX ?= $(CIRCUITPY_FRAMEBUFFERIO) endif # same51 ###################################################################### + +CIRCUITPY_BUILD_EXTENSIONS ?= uf2 diff --git a/ports/atmel-samd/peripherals b/ports/atmel-samd/peripherals index d3b20192cf..57133eefeb 160000 --- a/ports/atmel-samd/peripherals +++ b/ports/atmel-samd/peripherals @@ -1 +1 @@ -Subproject commit d3b20192cf94fdea68a412596e082108ba5ebbf0 +Subproject commit 57133eefeb077f73b5ac17ee044d9feaf566da8e diff --git a/ports/atmel-samd/supervisor/port.c b/ports/atmel-samd/supervisor/port.c index 885d23c726..424acece78 100644 --- a/ports/atmel-samd/supervisor/port.c +++ b/ports/atmel-samd/supervisor/port.c @@ -122,9 +122,6 @@ #include "tusb.h" -#if CIRCUITPY_GAMEPADSHIFT -#include "shared-module/gamepadshift/__init__.h" -#endif #if CIRCUITPY_PEW #include "common-hal/_pew/PewPew.h" #endif @@ -428,9 +425,6 @@ void reset_port(void) { reset_gclks(); - #if CIRCUITPY_GAMEPADSHIFT - gamepadshift_reset(); - #endif #if CIRCUITPY_PEW pew_reset(); #endif diff --git a/ports/atmel-samd/tools/gen_pin_name_table.py b/ports/atmel-samd/tools/gen_pin_name_table.py index a78144d400..3eb0fbdbb3 100644 --- a/ports/atmel-samd/tools/gen_pin_name_table.py +++ b/ports/atmel-samd/tools/gen_pin_name_table.py @@ -164,11 +164,10 @@ capabilities = { "AnalogOut": ["PA02"], }, "audioio": {"AudioOut": ["PA02"]}, - "bitbangio": {"I2C": ALL_BUT_USB, "OneWire": ALL_BUT_USB, "SPI": ALL_BUT_USB}, + "bitbangio": {"I2C": ALL_BUT_USB, "SPI": ALL_BUT_USB}, "busio": { "I2C - SDA": ["PA00", "PB08", "PA08", "PA12", "PA16", "PA22", "PB02"], # SERCOM pad 0 "I2C - SCL": ["PA01", "PB09", "PA09", "PA13", "PA17", "PA23", "PB03"], # SERCOM pad 1 - "OneWire": ALL_BUT_USB, "SPI - MISO": [ "PA00", "PA01", @@ -299,6 +298,7 @@ capabilities = { ], # pad 0 or 2 }, "digitalio": {"DigitalInOut": ALL_BUT_USB}, + "onewireio": {"OneWire": ALL_BUT_USB}, "pulseio": { "PulseIn": ALL_BUT_USB, "PWMOut": [ diff --git a/ports/broadcom/Makefile b/ports/broadcom/Makefile index 921d26958a..757e7f3450 100644 --- a/ports/broadcom/Makefile +++ b/ports/broadcom/Makefile @@ -1,12 +1,12 @@ # Select the board to build for. -BOARD=raspberrypi_pi4 +BOARD?=raspberrypi_pi4b ifeq ($(BOARD),) - $(error You must provide a BOARD parameter) + $(error You must provide a BOARD parameter) else - ifeq ($(wildcard boards/$(BOARD)/.),) - $(error Invalid BOARD specified) - endif + ifeq ($(wildcard boards/$(BOARD)/.),) + $(error Invalid BOARD "$(BOARD)" specified) + endif endif # If the build directory is not given, make it reflect the board name. @@ -107,7 +107,7 @@ OBJ += $(addprefix $(BUILD)/, $(SRC_S:.s=.o)) OBJ += $(addprefix $(BUILD)/, $(SRC_MOD:.c=.o)) # BCM CLFAGS -CFLAGS += -ffreestanding -nostartfiles -DMICROPY_HW_MCU_NAME="\"$(CHIP_VARIANT)\"" +CFLAGS += -nostartfiles -DMICROPY_HW_MCU_NAME="\"$(CHIP_VARIANT)\"" OPTIMIZATION_FLAGS ?= -O3 diff --git a/ports/broadcom/bindings/videocore/Framebuffer.c b/ports/broadcom/bindings/videocore/Framebuffer.c index 4be55ee291..39c5e71467 100644 --- a/ports/broadcom/bindings/videocore/Framebuffer.c +++ b/ports/broadcom/bindings/videocore/Framebuffer.c @@ -46,7 +46,6 @@ //| //| A Framebuffer is often used in conjunction with a //| `framebufferio.FramebufferDisplay`.""" -//| STATIC mp_obj_t videocore_framebuffer_make_new(const mp_obj_type_t *type, size_t n_args, size_t n_kw, const mp_obj_t *all_args) { enum { ARG_width, ARG_height, }; @@ -72,7 +71,6 @@ STATIC mp_obj_t videocore_framebuffer_make_new(const mp_obj_type_t *type, size_t //| rgbmatrix instance. After deinitialization, no further operations //| may be performed.""" //| ... -//| STATIC mp_obj_t videocore_framebuffer_deinit(mp_obj_t self_in) { videocore_framebuffer_obj_t *self = (videocore_framebuffer_obj_t *)self_in; common_hal_videocore_framebuffer_deinit(self); @@ -89,7 +87,6 @@ static void check_for_deinit(videocore_framebuffer_obj_t *self) { //| width: int //| """The width of the display, in pixels""" -//| STATIC mp_obj_t videocore_framebuffer_get_width(mp_obj_t self_in) { videocore_framebuffer_obj_t *self = (videocore_framebuffer_obj_t *)self_in; check_for_deinit(self); diff --git a/ports/broadcom/bindings/videocore/__init__.c b/ports/broadcom/bindings/videocore/__init__.c index 94a483adb5..9ec345dae7 100644 --- a/ports/broadcom/bindings/videocore/__init__.c +++ b/ports/broadcom/bindings/videocore/__init__.c @@ -32,7 +32,6 @@ #include "bindings/videocore/Framebuffer.h" //| """Low-level routines for interacting with the Broadcom VideoCore GPU""" -//| STATIC const mp_rom_map_elem_t videocore_module_globals_table[] = { { MP_ROM_QSTR(MP_QSTR___name__), MP_ROM_QSTR(MP_QSTR_videocore) }, diff --git a/ports/broadcom/boards/diodes_delight_piunora/board.c b/ports/broadcom/boards/diodes_delight_piunora/board.c index 80bea7f8b6..e272a8cc3d 100644 --- a/ports/broadcom/boards/diodes_delight_piunora/board.c +++ b/ports/broadcom/boards/diodes_delight_piunora/board.c @@ -45,12 +45,4 @@ void board_init(void) { true); } -bool board_requests_safe_mode(void) { - return false; -} - -void reset_board(void) { -} - -void board_deinit(void) { -} +// Use the MP_WEAK supervisor/shared/board.c versions of routines not defined here. diff --git a/ports/broadcom/boards/diodes_delight_piunora/mpconfigboard.h b/ports/broadcom/boards/diodes_delight_piunora/mpconfigboard.h index a3e318bb13..12a68201fa 100644 --- a/ports/broadcom/boards/diodes_delight_piunora/mpconfigboard.h +++ b/ports/broadcom/boards/diodes_delight_piunora/mpconfigboard.h @@ -4,3 +4,6 @@ #define DEFAULT_I2C_BUS_SDA (&pin_GPIO2) #define MICROPY_HW_NEOPIXEL (&pin_GPIO12) + +#define CIRCUITPY_CONSOLE_UART_TX (&pin_GPIO4) +#define CIRCUITPY_CONSOLE_UART_RX (&pin_GPIO5) diff --git a/ports/broadcom/boards/raspberrypi_cm4/board.c b/ports/broadcom/boards/raspberrypi_cm4/board.c index 80bea7f8b6..e272a8cc3d 100644 --- a/ports/broadcom/boards/raspberrypi_cm4/board.c +++ b/ports/broadcom/boards/raspberrypi_cm4/board.c @@ -45,12 +45,4 @@ void board_init(void) { true); } -bool board_requests_safe_mode(void) { - return false; -} - -void reset_board(void) { -} - -void board_deinit(void) { -} +// Use the MP_WEAK supervisor/shared/board.c versions of routines not defined here. diff --git a/ports/broadcom/boards/raspberrypi_cm4io/board.c b/ports/broadcom/boards/raspberrypi_cm4io/board.c index 80bea7f8b6..e272a8cc3d 100644 --- a/ports/broadcom/boards/raspberrypi_cm4io/board.c +++ b/ports/broadcom/boards/raspberrypi_cm4io/board.c @@ -45,12 +45,4 @@ void board_init(void) { true); } -bool board_requests_safe_mode(void) { - return false; -} - -void reset_board(void) { -} - -void board_deinit(void) { -} +// Use the MP_WEAK supervisor/shared/board.c versions of routines not defined here. diff --git a/ports/broadcom/boards/raspberrypi_cm4io/mpconfigboard.h b/ports/broadcom/boards/raspberrypi_cm4io/mpconfigboard.h index 9acfb32626..832a0b887b 100644 --- a/ports/broadcom/boards/raspberrypi_cm4io/mpconfigboard.h +++ b/ports/broadcom/boards/raspberrypi_cm4io/mpconfigboard.h @@ -4,3 +4,6 @@ #define DEFAULT_I2C_BUS_SDA (&pin_GPIO2) #define MICROPY_HW_LED_STATUS (&pin_GPIO42) + +#define CIRCUITPY_CONSOLE_UART_TX (&pin_GPIO14) +#define CIRCUITPY_CONSOLE_UART_RX (&pin_GPIO15) diff --git a/ports/broadcom/boards/raspberrypi_pi4b/board.c b/ports/broadcom/boards/raspberrypi_pi4b/board.c index 80bea7f8b6..e272a8cc3d 100644 --- a/ports/broadcom/boards/raspberrypi_pi4b/board.c +++ b/ports/broadcom/boards/raspberrypi_pi4b/board.c @@ -45,12 +45,4 @@ void board_init(void) { true); } -bool board_requests_safe_mode(void) { - return false; -} - -void reset_board(void) { -} - -void board_deinit(void) { -} +// Use the MP_WEAK supervisor/shared/board.c versions of routines not defined here. diff --git a/ports/broadcom/boards/raspberrypi_pi4b/mpconfigboard.h b/ports/broadcom/boards/raspberrypi_pi4b/mpconfigboard.h index 2980b0f9a5..521c8fda25 100644 --- a/ports/broadcom/boards/raspberrypi_pi4b/mpconfigboard.h +++ b/ports/broadcom/boards/raspberrypi_pi4b/mpconfigboard.h @@ -4,3 +4,6 @@ #define DEFAULT_I2C_BUS_SDA (&pin_GPIO2) #define MICROPY_HW_LED_STATUS (&pin_GPIO42) + +#define CIRCUITPY_CONSOLE_UART_TX (&pin_GPIO14) +#define CIRCUITPY_CONSOLE_UART_RX (&pin_GPIO15) diff --git a/ports/broadcom/boards/raspberrypi_zero/board.c b/ports/broadcom/boards/raspberrypi_zero/board.c index 80bea7f8b6..e272a8cc3d 100644 --- a/ports/broadcom/boards/raspberrypi_zero/board.c +++ b/ports/broadcom/boards/raspberrypi_zero/board.c @@ -45,12 +45,4 @@ void board_init(void) { true); } -bool board_requests_safe_mode(void) { - return false; -} - -void reset_board(void) { -} - -void board_deinit(void) { -} +// Use the MP_WEAK supervisor/shared/board.c versions of routines not defined here. diff --git a/ports/broadcom/boards/raspberrypi_zero/mpconfigboard.h b/ports/broadcom/boards/raspberrypi_zero/mpconfigboard.h index 1141520e06..c1566e8fc0 100644 --- a/ports/broadcom/boards/raspberrypi_zero/mpconfigboard.h +++ b/ports/broadcom/boards/raspberrypi_zero/mpconfigboard.h @@ -4,3 +4,6 @@ #define DEFAULT_I2C_BUS_SDA (&pin_GPIO2) #define MICROPY_HW_LED_STATUS (&pin_GPIO47) + +#define CIRCUITPY_CONSOLE_UART_TX (&pin_GPIO14) +#define CIRCUITPY_CONSOLE_UART_RX (&pin_GPIO15) diff --git a/ports/broadcom/boards/raspberrypi_zero/mpconfigboard.mk b/ports/broadcom/boards/raspberrypi_zero/mpconfigboard.mk index 74f8511c2d..b6adb5d6bb 100644 --- a/ports/broadcom/boards/raspberrypi_zero/mpconfigboard.mk +++ b/ports/broadcom/boards/raspberrypi_zero/mpconfigboard.mk @@ -4,3 +4,5 @@ USB_PRODUCT = "Zero" USB_MANUFACTURER = "Raspberry Pi" CHIP_VARIANT = "bcm2835" + +CIRCUITPY_BUILD_EXTENSIONS = disk.img.zip,kernel.img diff --git a/ports/broadcom/boards/raspberrypi_zero2w/board.c b/ports/broadcom/boards/raspberrypi_zero2w/board.c index 80bea7f8b6..e272a8cc3d 100644 --- a/ports/broadcom/boards/raspberrypi_zero2w/board.c +++ b/ports/broadcom/boards/raspberrypi_zero2w/board.c @@ -45,12 +45,4 @@ void board_init(void) { true); } -bool board_requests_safe_mode(void) { - return false; -} - -void reset_board(void) { -} - -void board_deinit(void) { -} +// Use the MP_WEAK supervisor/shared/board.c versions of routines not defined here. diff --git a/ports/broadcom/boards/raspberrypi_zero2w/mpconfigboard.h b/ports/broadcom/boards/raspberrypi_zero2w/mpconfigboard.h index 11011268ae..e65bf5c163 100644 --- a/ports/broadcom/boards/raspberrypi_zero2w/mpconfigboard.h +++ b/ports/broadcom/boards/raspberrypi_zero2w/mpconfigboard.h @@ -2,3 +2,8 @@ #define DEFAULT_I2C_BUS_SCL (&pin_GPIO3) #define DEFAULT_I2C_BUS_SDA (&pin_GPIO2) + +#define MICROPY_HW_LED_STATUS (&pin_GPIO29) + +#define CIRCUITPY_CONSOLE_UART_TX (&pin_GPIO14) +#define CIRCUITPY_CONSOLE_UART_RX (&pin_GPIO15) diff --git a/ports/broadcom/boards/raspberrypi_zero2w/pins.c b/ports/broadcom/boards/raspberrypi_zero2w/pins.c index bb6632b923..5e12613b3f 100644 --- a/ports/broadcom/boards/raspberrypi_zero2w/pins.c +++ b/ports/broadcom/boards/raspberrypi_zero2w/pins.c @@ -55,6 +55,7 @@ STATIC const mp_rom_map_elem_t board_global_dict_table[] = { { MP_ROM_QSTR(MP_QSTR_D25), MP_ROM_PTR(&pin_GPIO25) }, { MP_ROM_QSTR(MP_QSTR_D26), MP_ROM_PTR(&pin_GPIO26) }, { MP_ROM_QSTR(MP_QSTR_D27), MP_ROM_PTR(&pin_GPIO27) }, + { MP_ROM_QSTR(MP_QSTR_LED), MP_ROM_PTR(&pin_GPIO29) }, { MP_ROM_QSTR(MP_QSTR_I2C), MP_ROM_PTR(&board_i2c_obj) }, { MP_ROM_QSTR(MP_QSTR_DISPLAY), MP_ROM_PTR(&displays[0].display)}, diff --git a/ports/broadcom/boards/raspberrypi_zero_w/board.c b/ports/broadcom/boards/raspberrypi_zero_w/board.c index 80bea7f8b6..e272a8cc3d 100644 --- a/ports/broadcom/boards/raspberrypi_zero_w/board.c +++ b/ports/broadcom/boards/raspberrypi_zero_w/board.c @@ -45,12 +45,4 @@ void board_init(void) { true); } -bool board_requests_safe_mode(void) { - return false; -} - -void reset_board(void) { -} - -void board_deinit(void) { -} +// Use the MP_WEAK supervisor/shared/board.c versions of routines not defined here. diff --git a/ports/broadcom/boards/raspberrypi_zero_w/mpconfigboard.h b/ports/broadcom/boards/raspberrypi_zero_w/mpconfigboard.h index 389868f882..4dc1372ae5 100644 --- a/ports/broadcom/boards/raspberrypi_zero_w/mpconfigboard.h +++ b/ports/broadcom/boards/raspberrypi_zero_w/mpconfigboard.h @@ -4,3 +4,6 @@ #define DEFAULT_I2C_BUS_SDA (&pin_GPIO2) #define MICROPY_HW_LED_STATUS (&pin_GPIO47) + +#define CIRCUITPY_CONSOLE_UART_TX (&pin_GPIO14) +#define CIRCUITPY_CONSOLE_UART_RX (&pin_GPIO15) diff --git a/ports/broadcom/boards/raspberrypi_zero_w/mpconfigboard.mk b/ports/broadcom/boards/raspberrypi_zero_w/mpconfigboard.mk index 24d09e0530..cd55f73ee8 100644 --- a/ports/broadcom/boards/raspberrypi_zero_w/mpconfigboard.mk +++ b/ports/broadcom/boards/raspberrypi_zero_w/mpconfigboard.mk @@ -4,3 +4,5 @@ USB_PRODUCT = "Zero W" USB_MANUFACTURER = "Raspberry Pi" CHIP_VARIANT = "bcm2835" + +CIRCUITPY_BUILD_EXTENSIONS = disk.img.zip,kernel.img diff --git a/ports/broadcom/common-hal/busio/I2C.c b/ports/broadcom/common-hal/busio/I2C.c index e84810cffd..3142fda145 100644 --- a/ports/broadcom/common-hal/busio/I2C.c +++ b/ports/broadcom/common-hal/busio/I2C.c @@ -90,7 +90,7 @@ void common_hal_busio_i2c_construct(busio_i2c_obj_t *self, } } if (instance_index == NUM_I2C) { - mp_raise_ValueError(translate("Invalid pins")); + raise_ValueError_invalid_pins(); } i2c_in_use[instance_index] = true; self->index = instance_index; diff --git a/ports/broadcom/common-hal/busio/SPI.c b/ports/broadcom/common-hal/busio/SPI.c index feba34521d..017674dfc0 100644 --- a/ports/broadcom/common-hal/busio/SPI.c +++ b/ports/broadcom/common-hal/busio/SPI.c @@ -104,7 +104,7 @@ void common_hal_busio_spi_construct(busio_spi_obj_t *self, break; } if (instance_index == NUM_SPI) { - mp_raise_ValueError(translate("Invalid pins")); + raise_ValueError_invalid_pins(); } self->clock = clock; diff --git a/ports/broadcom/common-hal/busio/UART.c b/ports/broadcom/common-hal/busio/UART.c index ff17d5ff1d..9f51f15acb 100644 --- a/ports/broadcom/common-hal/busio/UART.c +++ b/ports/broadcom/common-hal/busio/UART.c @@ -162,13 +162,8 @@ void common_hal_busio_uart_construct(busio_uart_obj_t *self, mp_float_t timeout, uint16_t receiver_buffer_size, byte *receiver_buffer, bool sigint_enabled) { - if (bits > 8) { - mp_raise_ValueError(translate("Invalid word/bit length")); - } - - if (receiver_buffer_size == 0) { - mp_raise_ValueError(translate("Invalid buffer size")); - } + mp_arg_validate_int_max(bits, 8, MP_QSTR_bits); + mp_arg_validate_int_min(receiver_buffer_size, 1, MP_QSTR_receiver_buffer_size); if ((rs485_dir != NULL) || (rs485_invert)) { mp_raise_NotImplementedError(translate("RS485 Not yet supported on this device")); @@ -203,7 +198,7 @@ void common_hal_busio_uart_construct(busio_uart_obj_t *self, break; } if (instance_index == NUM_UART) { - mp_raise_ValueError(translate("Invalid pins")); + raise_ValueError_invalid_pins(); } self->rx_pin = rx; @@ -213,8 +208,9 @@ void common_hal_busio_uart_construct(busio_uart_obj_t *self, self->sigint_enabled = sigint_enabled; if (rx != NULL) { + // Use the provided buffer when given. if (receiver_buffer != NULL) { - self->ringbuf = (ringbuf_t) { receiver_buffer, receiver_buffer_size }; + ringbuf_init(&self->ringbuf, receiver_buffer, receiver_buffer_size); } else { // Initially allocate the UART's buffer in the long-lived part of the // heap. UARTs are generally long-lived objects, but the "make long- @@ -222,9 +218,8 @@ void common_hal_busio_uart_construct(busio_uart_obj_t *self, // self->buffer, so do it manually. (However, as long as internal // pointers like this are NOT moved, allocating the buffer // in the long-lived pool is not strictly necessary) - // (This is a macro.) if (!ringbuf_alloc(&self->ringbuf, receiver_buffer_size, true)) { - mp_raise_msg(&mp_type_MemoryError, translate("Failed to allocate RX buffer")); + m_malloc_fail(receiver_buffer_size); } } } @@ -342,7 +337,7 @@ void common_hal_busio_uart_deinit(busio_uart_obj_t *self) { pl011->CR = 0; } active_uart[self->uart_id] = NULL; - ringbuf_free(&self->ringbuf); + ringbuf_deinit(&self->ringbuf); uart_status[self->uart_id] = STATUS_FREE; common_hal_reset_pin(self->tx_pin); common_hal_reset_pin(self->rx_pin); diff --git a/ports/broadcom/common-hal/busio/UART.h b/ports/broadcom/common-hal/busio/UART.h index 0590bc28b6..57926ca58b 100644 --- a/ports/broadcom/common-hal/busio/UART.h +++ b/ports/broadcom/common-hal/busio/UART.h @@ -36,11 +36,11 @@ typedef struct { const mcu_pin_obj_t *rx_pin; const mcu_pin_obj_t *cts_pin; const mcu_pin_obj_t *rts_pin; - uint8_t uart_id; uint32_t baudrate; uint32_t timeout_ms; - bool sigint_enabled; ringbuf_t ringbuf; + bool sigint_enabled; + uint8_t uart_id; } busio_uart_obj_t; extern void reset_uart(void); diff --git a/ports/broadcom/common-hal/digitalio/DigitalInOut.c b/ports/broadcom/common-hal/digitalio/DigitalInOut.c index 38a7cbb2b8..0dd74a8412 100644 --- a/ports/broadcom/common-hal/digitalio/DigitalInOut.c +++ b/ports/broadcom/common-hal/digitalio/DigitalInOut.c @@ -32,7 +32,7 @@ #include "common-hal/microcontroller/Pin.h" #include "shared-bindings/digitalio/DigitalInOut.h" -#include "supervisor/shared/translate.h" +#include "supervisor/shared/translate/translate.h" #include "peripherals/broadcom/gpio.h" @@ -63,11 +63,12 @@ void common_hal_digitalio_digitalinout_deinit(digitalio_digitalinout_obj_t *self self->pin = NULL; } -void common_hal_digitalio_digitalinout_switch_to_input( +digitalinout_result_t common_hal_digitalio_digitalinout_switch_to_input( digitalio_digitalinout_obj_t *self, digitalio_pull_t pull) { self->output = false; // This also sets direction to input. common_hal_digitalio_digitalinout_set_pull(self, pull); + return DIGITALINOUT_OK; } digitalinout_result_t common_hal_digitalio_digitalinout_switch_to_output( @@ -134,7 +135,7 @@ digitalio_drive_mode_t common_hal_digitalio_digitalinout_get_drive_mode( } } -void common_hal_digitalio_digitalinout_set_pull( +digitalinout_result_t common_hal_digitalio_digitalinout_set_pull( digitalio_digitalinout_obj_t *self, digitalio_pull_t pull) { const uint8_t pin = self->pin->number; BP_PULL_Enum bp_pull = BP_PULL_NONE; @@ -144,6 +145,7 @@ void common_hal_digitalio_digitalinout_set_pull( bp_pull = BP_PULL_DOWN; } gpio_set_pull(pin, bp_pull); + return DIGITALINOUT_OK; } digitalio_pull_t common_hal_digitalio_digitalinout_get_pull( diff --git a/ports/broadcom/common-hal/sdioio/SDCard.c b/ports/broadcom/common-hal/sdioio/SDCard.c index 85a84ac213..27b36041de 100644 --- a/ports/broadcom/common-hal/sdioio/SDCard.c +++ b/ports/broadcom/common-hal/sdioio/SDCard.c @@ -35,7 +35,7 @@ #include "shared-bindings/microcontroller/Pin.h" #include "shared-bindings/microcontroller/__init__.h" #include "supervisor/port.h" -#include "supervisor/shared/translate.h" +#include "supervisor/shared/translate/translate.h" #include "peripherals/broadcom/cpu.h" #include "peripherals/broadcom/defines.h" diff --git a/ports/broadcom/mpconfigport.h b/ports/broadcom/mpconfigport.h index 4fce84c973..e77725cca3 100644 --- a/ports/broadcom/mpconfigport.h +++ b/ports/broadcom/mpconfigport.h @@ -60,7 +60,4 @@ #define MICROPY_PORT_ROOT_POINTERS \ CIRCUITPY_COMMON_ROOT_POINTERS -#define CIRCUITPY_DEBUG_UART_TX (&pin_GPIO14) -#define CIRCUITPY_DEBUG_UART_RX (&pin_GPIO15) - #endif // __INCLUDED_MPCONFIGPORT_H diff --git a/ports/broadcom/mpconfigport.mk b/ports/broadcom/mpconfigport.mk index 7296461d1f..839ef00514 100644 --- a/ports/broadcom/mpconfigport.mk +++ b/ports/broadcom/mpconfigport.mk @@ -9,7 +9,7 @@ CIRCUITPY_AUDIOBUSIO = 0 CIRCUITPY_AUDIOIO = 0 CIRCUITPY_COUNTIO = 0 CIRCUITPY_FREQUENCYIO = 0 -CIRCUITPY_I2CPERIPHERAL = 0 +CIRCUITPY_I2CTARGET = 0 CIRCUITPY_NVM = 0 CIRCUITPY_PARALLELDISPLAY = 0 CIRCUITPY_PULSEIO = 0 @@ -24,3 +24,5 @@ INTERNAL_FLASH_FILESYSTEM = 1 USB_NUM_ENDPOINT_PAIRS = 8 USB_HIGHSPEED = 1 + +CIRCUITPY_BUILD_EXTENSIONS ?= disk.img.zip,kernel8.img diff --git a/ports/cxd56/.gitignore b/ports/cxd56/.gitignore deleted file mode 100644 index 414487d53e..0000000000 --- a/ports/cxd56/.gitignore +++ /dev/null @@ -1 +0,0 @@ -build-*/ diff --git a/ports/cxd56/boards/spresense/board.c b/ports/cxd56/boards/spresense/board.c index fba263c569..b397789c3e 100644 --- a/ports/cxd56/boards/spresense/board.c +++ b/ports/cxd56/boards/spresense/board.c @@ -26,15 +26,4 @@ #include "supervisor/board.h" -void board_init(void) { -} - -bool board_requests_safe_mode(void) { - return false; -} - -void reset_board(void) { -} - -void board_deinit(void) { -} +// Use the MP_WEAK supervisor/shared/board.c versions of routines not defined here. diff --git a/ports/cxd56/common-hal/analogio/AnalogIn.c b/ports/cxd56/common-hal/analogio/AnalogIn.c index d1bd68cfbe..bb19d02c25 100644 --- a/ports/cxd56/common-hal/analogio/AnalogIn.c +++ b/ports/cxd56/common-hal/analogio/AnalogIn.c @@ -34,6 +34,7 @@ #include "py/runtime.h" #include "shared-bindings/analogio/AnalogIn.h" +#include "shared-bindings/microcontroller/Pin.h" typedef struct { const char *devpath; @@ -52,7 +53,7 @@ STATIC analogin_dev_t analogin_dev[] = { void common_hal_analogio_analogin_construct(analogio_analogin_obj_t *self, const mcu_pin_obj_t *pin) { if (!pin->analog) { - mp_raise_ValueError(translate("AnalogIn not supported on given pin")); + raise_ValueError_invalid_pin(); } self->number = -1; @@ -65,13 +66,13 @@ void common_hal_analogio_analogin_construct(analogio_analogin_obj_t *self, const } if (self->number < 0) { - mp_raise_ValueError(translate("Pin does not have ADC capabilities")); + raise_ValueError_invalid_pin(); } if (analogin_dev[self->number].fd < 0) { analogin_dev[self->number].fd = open(analogin_dev[self->number].devpath, O_RDONLY); if (analogin_dev[self->number].fd < 0) { - mp_raise_ValueError(translate("Pin does not have ADC capabilities")); + raise_ValueError_invalid_pin(); } } diff --git a/ports/cxd56/common-hal/analogio/AnalogOut.c b/ports/cxd56/common-hal/analogio/AnalogOut.c index 3f1abe80d1..b57dc8e323 100644 --- a/ports/cxd56/common-hal/analogio/AnalogOut.c +++ b/ports/cxd56/common-hal/analogio/AnalogOut.c @@ -29,7 +29,7 @@ #include "shared-bindings/analogio/AnalogOut.h" void common_hal_analogio_analogout_construct(analogio_analogout_obj_t *self, const mcu_pin_obj_t *pin) { - mp_raise_RuntimeError(translate("AnalogOut functionality not supported")); + mp_raise_NotImplementedError_varg(translate("%q"), MP_QSTR_AnalogOut); } void common_hal_analogio_analogout_deinit(analogio_analogout_obj_t *self) { diff --git a/ports/cxd56/common-hal/busio/I2C.c b/ports/cxd56/common-hal/busio/I2C.c index 82b52ca179..07d9024a51 100644 --- a/ports/cxd56/common-hal/busio/I2C.c +++ b/ports/cxd56/common-hal/busio/I2C.c @@ -32,15 +32,16 @@ #include "py/runtime.h" #include "shared-bindings/busio/I2C.h" +#include "shared-bindings/microcontroller/Pin.h" void common_hal_busio_i2c_construct(busio_i2c_obj_t *self, const mcu_pin_obj_t *scl, const mcu_pin_obj_t *sda, uint32_t frequency, uint32_t timeout) { if (frequency != I2C_SPEED_STANDARD && frequency != I2C_SPEED_FAST) { - mp_raise_ValueError(translate("Unsupported baudrate")); + mp_arg_error_invalid(MP_QSTR_frequency); } if (scl->number != PIN_I2C0_BCK || sda->number != PIN_I2C0_BDT) { - mp_raise_ValueError(translate("Invalid pins")); + raise_ValueError_invalid_pins(); } claim_pin(scl); diff --git a/ports/cxd56/common-hal/busio/SPI.c b/ports/cxd56/common-hal/busio/SPI.c index c248b5cc9a..75f530eda1 100644 --- a/ports/cxd56/common-hal/busio/SPI.c +++ b/ports/cxd56/common-hal/busio/SPI.c @@ -33,6 +33,7 @@ #include "py/runtime.h" #include "shared-bindings/busio/SPI.h" +#include "shared-bindings/microcontroller/Pin.h" void common_hal_busio_spi_construct(busio_spi_obj_t *self, const mcu_pin_obj_t *clock, const mcu_pin_obj_t *mosi, const mcu_pin_obj_t *miso, bool half_duplex) { @@ -55,7 +56,7 @@ void common_hal_busio_spi_construct(busio_spi_obj_t *self, const mcu_pin_obj_t * } if (port < 0) { - mp_raise_ValueError(translate("Invalid pins")); + raise_ValueError_invalid_pins(); } claim_pin(clock); diff --git a/ports/cxd56/common-hal/busio/UART.c b/ports/cxd56/common-hal/busio/UART.c index 91fbe52441..aafc0b790e 100644 --- a/ports/cxd56/common-hal/busio/UART.c +++ b/ports/cxd56/common-hal/busio/UART.c @@ -40,6 +40,7 @@ #include "py/runtime.h" #include "shared-bindings/busio/UART.h" +#include "shared-bindings/microcontroller/Pin.h" typedef struct { const char *devpath; @@ -65,20 +66,12 @@ void common_hal_busio_uart_construct(busio_uart_obj_t *self, struct termios tio; if ((rts != NULL) || (cts != NULL) || (rs485_dir != NULL) || (rs485_invert)) { - mp_raise_ValueError(translate("RTS/CTS/RS485 Not yet supported on this device")); + mp_raise_NotImplementedError(translate("RS485")); } - if (bits != 8) { - mp_raise_ValueError(translate("Could not initialize UART")); - } - - if (parity != BUSIO_UART_PARITY_NONE) { - mp_raise_ValueError(translate("Could not initialize UART")); - } - - if (stop != 1) { - mp_raise_ValueError(translate("Could not initialize UART")); - } + mp_arg_validate_int(bits, 8, MP_QSTR_bits); + mp_arg_validate_int(parity, BUSIO_UART_PARITY_NONE, MP_QSTR_parity); + mp_arg_validate_int(stop, 1, MP_QSTR_stop); self->number = -1; @@ -91,13 +84,13 @@ void common_hal_busio_uart_construct(busio_uart_obj_t *self, } if (self->number < 0) { - mp_raise_ValueError(translate("Invalid pins")); + raise_ValueError_invalid_pins(); } if (busio_uart_dev[self->number].fd < 0) { busio_uart_dev[self->number].fd = open(busio_uart_dev[self->number].devpath, O_RDWR); if (busio_uart_dev[self->number].fd < 0) { - mp_raise_ValueError(translate("Could not initialize UART")); + mp_raise_RuntimeError(translate("UART init")); } // Wait to make sure the UART is ready diff --git a/ports/cxd56/common-hal/camera/Camera.c b/ports/cxd56/common-hal/camera/Camera.c index 5e159d61dc..f304ed8f74 100644 --- a/ports/cxd56/common-hal/camera/Camera.c +++ b/ports/cxd56/common-hal/camera/Camera.c @@ -121,11 +121,11 @@ static void camera_start_preview() { void common_hal_camera_construct(camera_obj_t *self) { if (camera_dev.fd < 0) { if (video_initialize(camera_dev.devpath) < 0) { - mp_raise_ValueError(translate("Could not initialize Camera")); + mp_raise_RuntimeError(translate("Camera init")); } camera_dev.fd = open(camera_dev.devpath, 0); if (camera_dev.fd < 0) { - mp_raise_ValueError(translate("Could not initialize Camera")); + mp_raise_RuntimeError(translate("Camera init")); } } diff --git a/ports/cxd56/common-hal/digitalio/DigitalInOut.c b/ports/cxd56/common-hal/digitalio/DigitalInOut.c index 37b695567d..c1f247d0a9 100644 --- a/ports/cxd56/common-hal/digitalio/DigitalInOut.c +++ b/ports/cxd56/common-hal/digitalio/DigitalInOut.c @@ -29,10 +29,11 @@ #include "py/runtime.h" #include "shared-bindings/digitalio/DigitalInOut.h" +#include "shared-bindings/microcontroller/Pin.h" digitalinout_result_t common_hal_digitalio_digitalinout_construct(digitalio_digitalinout_obj_t *self, const mcu_pin_obj_t *pin) { if (pin->analog) { - mp_raise_ValueError(translate("DigitalInOut not supported on given pin")); + raise_ValueError_invalid_pin(); } claim_pin(pin); @@ -63,11 +64,12 @@ bool common_hal_digitalio_digitalinout_deinited(digitalio_digitalinout_obj_t *se return self->pin == NULL; } -void common_hal_digitalio_digitalinout_switch_to_input(digitalio_digitalinout_obj_t *self, digitalio_pull_t pull) { +digitalinout_result_t common_hal_digitalio_digitalinout_switch_to_input(digitalio_digitalinout_obj_t *self, digitalio_pull_t pull) { self->input = true; self->pull = pull; board_gpio_write(self->pin->number, -1); board_gpio_config(self->pin->number, 0, true, true, pull); + return DIGITALINOUT_OK; } digitalinout_result_t common_hal_digitalio_digitalinout_switch_to_output(digitalio_digitalinout_obj_t *self, bool value, digitalio_drive_mode_t drive_mode) { @@ -123,10 +125,11 @@ digitalio_drive_mode_t common_hal_digitalio_digitalinout_get_drive_mode(digitali return self->open_drain ? DRIVE_MODE_OPEN_DRAIN : DRIVE_MODE_PUSH_PULL; } -void common_hal_digitalio_digitalinout_set_pull(digitalio_digitalinout_obj_t *self, digitalio_pull_t pull) { +digitalinout_result_t common_hal_digitalio_digitalinout_set_pull(digitalio_digitalinout_obj_t *self, digitalio_pull_t pull) { self->pull = pull; board_gpio_write(self->pin->number, -1); board_gpio_config(self->pin->number, 0, true, true, pull); + return DIGITALINOUT_OK; } digitalio_pull_t common_hal_digitalio_digitalinout_get_pull(digitalio_digitalinout_obj_t *self) { diff --git a/ports/cxd56/common-hal/gnss/GNSS.c b/ports/cxd56/common-hal/gnss/GNSS.c index f345f5261d..977d2e9b4b 100644 --- a/ports/cxd56/common-hal/gnss/GNSS.c +++ b/ports/cxd56/common-hal/gnss/GNSS.c @@ -56,7 +56,7 @@ void common_hal_gnss_construct(gnss_obj_t *self, unsigned long selection) { if (gnss_dev.fd < 0) { gnss_dev.fd = open(gnss_dev.devpath, O_RDONLY); if (gnss_dev.fd < 0) { - mp_raise_ValueError(translate("Could not initialize GNSS")); + mp_raise_RuntimeError(translate("GNSS init")); } } diff --git a/ports/cxd56/common-hal/microcontroller/__init__.c b/ports/cxd56/common-hal/microcontroller/__init__.c index 499e0e5f04..dd9a54063f 100644 --- a/ports/cxd56/common-hal/microcontroller/__init__.c +++ b/ports/cxd56/common-hal/microcontroller/__init__.c @@ -72,7 +72,7 @@ void common_hal_mcu_enable_interrupts(void) { void common_hal_mcu_on_next_reset(mcu_runmode_t runmode) { if (runmode == RUNMODE_BOOTLOADER) { - mp_raise_ValueError(translate("Cannot reset into bootloader because no bootloader is present.")); + mp_raise_ValueError(translate("Cannot reset into bootloader because no bootloader is present")); } else if (runmode == RUNMODE_SAFE_MODE) { safe_mode_on_next_reset(PROGRAMMATIC_SAFE_MODE); } diff --git a/ports/cxd56/common-hal/pulseio/PulseIn.c b/ports/cxd56/common-hal/pulseio/PulseIn.c index 264f11a714..165e2a6ece 100644 --- a/ports/cxd56/common-hal/pulseio/PulseIn.c +++ b/ports/cxd56/common-hal/pulseio/PulseIn.c @@ -87,7 +87,7 @@ void common_hal_pulseio_pulsein_construct(pulseio_pulsein_obj_t *self, const mcu_pin_obj_t *pin, uint16_t maxlen, bool idle_state) { self->buffer = (uint16_t *)m_malloc(maxlen * sizeof(uint16_t), false); if (self->buffer == NULL) { - mp_raise_msg_varg(&mp_type_MemoryError, translate("Failed to allocate RX buffer of %d bytes"), maxlen * sizeof(uint16_t)); + m_malloc_fail(maxlen * sizeof(uint16_t)); } self->pin = pin; @@ -190,7 +190,7 @@ uint16_t common_hal_pulseio_pulsein_get_item(pulseio_pulsein_obj_t *self, int16_ } if (index < 0 || index >= self->len) { common_hal_mcu_enable_interrupts(); - mp_raise_IndexError_varg(translate("%q index out of range"), MP_QSTR_PulseIn); + mp_raise_IndexError_varg(translate("%q out of range"), MP_QSTR_index); } uint16_t value = self->buffer[(self->start + index) % self->maxlen]; common_hal_mcu_enable_interrupts(); diff --git a/ports/cxd56/common-hal/pwmio/PWMOut.c b/ports/cxd56/common-hal/pwmio/PWMOut.c index e9bffd21e9..7e27817aab 100644 --- a/ports/cxd56/common-hal/pwmio/PWMOut.c +++ b/ports/cxd56/common-hal/pwmio/PWMOut.c @@ -74,7 +74,7 @@ pwmout_result_t common_hal_pwmio_pwmout_construct(pwmio_pwmout_obj_t *self, self->variable_frequency = variable_frequency; if (ioctl(pwmout_dev[self->number].fd, PWMIOC_SETCHARACTERISTICS, (unsigned long)((uintptr_t)&self->info)) < 0) { - mp_raise_ValueError(translate("Invalid PWM frequency")); + mp_arg_error_invalid(MP_QSTR_frequency); } ioctl(pwmout_dev[self->number].fd, PWMIOC_START, 0); @@ -116,7 +116,7 @@ void common_hal_pwmio_pwmout_set_frequency(pwmio_pwmout_obj_t *self, uint32_t fr self->info.frequency = frequency; if (ioctl(pwmout_dev[self->number].fd, PWMIOC_SETCHARACTERISTICS, (unsigned long)((uintptr_t)&self->info)) < 0) { - mp_raise_ValueError(translate("Invalid PWM frequency")); + mp_arg_error_invalid(MP_QSTR_frequency); } } diff --git a/ports/cxd56/common-hal/rtc/RTC.c b/ports/cxd56/common-hal/rtc/RTC.c index ce65e6acde..0024e56cb2 100644 --- a/ports/cxd56/common-hal/rtc/RTC.c +++ b/ports/cxd56/common-hal/rtc/RTC.c @@ -50,5 +50,5 @@ int common_hal_rtc_get_calibration(void) { } void common_hal_rtc_set_calibration(int calibration) { - mp_raise_NotImplementedError(translate("RTC calibration is not supported on this board")); + mp_raise_NotImplementedError_varg(translate("%q"), MP_QSTR_calibration); } diff --git a/ports/cxd56/common-hal/sdioio/SDCard.c b/ports/cxd56/common-hal/sdioio/SDCard.c index 56fe5f7057..e8e5df4687 100644 --- a/ports/cxd56/common-hal/sdioio/SDCard.c +++ b/ports/cxd56/common-hal/sdioio/SDCard.c @@ -31,6 +31,7 @@ #include "py/mperrno.h" #include "py/runtime.h" +#include "shared-bindings/microcontroller/Pin.h" #include "shared-bindings/sdioio/SDCard.h" #include "shared-bindings/util.h" @@ -42,7 +43,7 @@ void common_hal_sdioio_sdcard_construct(sdioio_sdcard_obj_t *self, struct geometry geo; if (clock->number != PIN_SDIO_CLK || command->number != PIN_SDIO_CMD) { - mp_raise_ValueError(translate("Invalid pins")); + raise_ValueError_invalid_pins(); } uint8_t data_pins_num = 0; @@ -54,11 +55,11 @@ void common_hal_sdioio_sdcard_construct(sdioio_sdcard_obj_t *self, } if (data_pins_num != DATA_PINS_NUM) { - mp_raise_ValueError(translate("Invalid pins")); + raise_ValueError_invalid_pins(); } if (open_blockdriver("/dev/mmcsd0", 0, &self->inode) < 0) { - mp_raise_ValueError(translate("Could not initialize SDCard")); + mp_raise_RuntimeError(translate("SDCard init")); } self->inode->u.i_bops->geometry(self->inode, &geo); diff --git a/ports/cxd56/mpconfigport.mk b/ports/cxd56/mpconfigport.mk index 8787c55bcc..cb54233a07 100644 --- a/ports/cxd56/mpconfigport.mk +++ b/ports/cxd56/mpconfigport.mk @@ -3,6 +3,8 @@ USB_HIGHSPEED = 1 # Number of USB endpoint pairs. USB_NUM_ENDPOINT_PAIRS = 6 +CIRCUITPY_TRANSLATE_OBJECT = 1 + # Longints can be implemented as mpz, as longlong, or not LONGINT_IMPL = MPZ @@ -13,7 +15,7 @@ CIRCUITPY_COUNTIO = 0 CIRCUITPY_DISPLAYIO = 0 CIRCUITPY_FREQUENCYIO = 0 CIRCUITPY_GNSS = 1 -CIRCUITPY_I2CPERIPHERAL = 0 +CIRCUITPY_I2CTARGET = 0 CIRCUITPY_KEYPAD = 0 CIRCUITPY_NEOPIXEL_WRITE = 0 CIRCUITPY_NVM = 0 @@ -23,3 +25,5 @@ CIRCUITPY_TOUCHIO = 0 CIRCUITPY_USB_HID = 0 CIRCUITPY_USB_MIDI = 0 INTERNAL_LIBM = 1 + +CIRCUITPY_BUILD_EXTENSIONS ?= spk diff --git a/ports/espressif/.gitignore b/ports/espressif/.gitignore index 2e3080a40d..51c080bb7f 100644 --- a/ports/espressif/.gitignore +++ b/ports/espressif/.gitignore @@ -1,2 +1,5 @@ -build*/ -sdkconfig.old +# idf.py menuconfig +sdkconfig* + +# lock files for examples and components +dependencies.lock diff --git a/ports/espressif/CMakeLists.txt b/ports/espressif/CMakeLists.txt index 4c834397b9..d05af27539 100644 --- a/ports/espressif/CMakeLists.txt +++ b/ports/espressif/CMakeLists.txt @@ -6,7 +6,14 @@ set(ENV{IDF_PATH} ${CMAKE_SOURCE_DIR}/esp-idf) # The component list here determines what options we get in menuconfig and what the ninja file # can build. -set(COMPONENTS esptool_py soc driver log main esp-tls mbedtls mdns esp_event esp_adc_cal esp_netif esp_wifi lwip wpa_supplicant freertos bt) +set(COMPONENTS esptool_py soc driver log main esp-tls mbedtls mdns esp_event esp_adc_cal esp_netif esp_wifi lwip wpa_supplicant freertos bt usb) + +if("${CIRCUITPY_ESP32_CAMERA}") +message("Including esp32-camera") +set(EXTRA_COMPONENT_DIRS "esp32-camera") +list(APPEND COMPONENTS "esp32-camera") +message("COMPONENTS = ${COMPONENTS}") +endif() include($ENV{IDF_PATH}/tools/cmake/project.cmake) project(circuitpython) diff --git a/ports/espressif/Makefile b/ports/espressif/Makefile index 96360d06bd..57462642ba 100644 --- a/ports/espressif/Makefile +++ b/ports/espressif/Makefile @@ -98,6 +98,8 @@ INC += \ -isystem esp-idf/components/bt/host/nimble/port/include \ -isystem esp-idf/components/driver/include \ -isystem esp-idf/components/driver/$(IDF_TARGET)/include \ + -isystem esp-idf/components/efuse/include \ + -isystem esp-idf/components/efuse/$(IDF_TARGET)/include \ -isystem esp-idf/components/$(IDF_TARGET)/include \ -isystem esp-idf/components/esp_adc_cal/include \ -isystem esp-idf/components/esp_common/include \ @@ -165,8 +167,6 @@ else # RISC-V is larger than xtensa so do -Os for it OPTIMIZATION_FLAGS ?= -Os endif - # TODO: Test with -flto - ### CFLAGS += -flto endif # option to override compiler optimization level, set in boards/$(BOARD)/mpconfigboard.mk @@ -196,7 +196,12 @@ LDFLAGS += \ -Wl,--build-id=none \ -fno-rtti -ifeq ($(IDF_TARGET),esp32c3) +ifeq ($(IDF_TARGET),esp32) +LDFLAGS += \ + -T$(IDF_TARGET).rom.newlib-data.ld \ + -T$(IDF_TARGET).rom.newlib-funcs.ld \ + -T$(IDF_TARGET).rom.spiflash.ld +else ifeq ($(IDF_TARGET),esp32c3) LDFLAGS += \ -Tesp32c3.rom.newlib.ld \ -Tesp32c3.rom.version.ld \ @@ -221,8 +226,12 @@ endif # TinyUSB defines ifeq ($(CIRCUITPY_USB),1) +ifeq ($(IDF_TARGET),esp32s2) +CFLAGS += -DCFG_TUSB_MCU=OPT_MCU_ESP32S2 +else ifeq ($(IDF_TARGET),esp32s3) +CFLAGS += -DCFG_TUSB_MCU=OPT_MCU_ESP32S3 +endif CFLAGS += \ - -DCFG_TUSB_MCU=OPT_MCU_ESP32S2 \ -DCFG_TUSB_OS=OPT_OS_FREERTOS \ -DCFG_TUD_CDC_RX_BUFSIZE=1024 \ -DCFG_TUD_CDC_TX_BUFSIZE=1024 \ @@ -230,7 +239,8 @@ CFLAGS += \ -DCFG_TUD_MIDI_RX_BUFSIZE=128 \ -DCFG_TUD_MIDI_TX_BUFSIZE=128 \ -DCFG_TUD_VENDOR_RX_BUFSIZE=128 \ - -DCFG_TUD_VENDOR_TX_BUFSIZE=128 + -DCFG_TUD_VENDOR_TX_BUFSIZE=128 \ + -DCFG_TUD_TASK_QUEUE_SZ=32 endif ###################################### @@ -244,7 +254,6 @@ SRC_C += \ bindings/espidf/__init__.c \ boards/$(BOARD)/board.c \ boards/$(BOARD)/pins.c \ - modules/$(CIRCUITPY_MODULE).c \ shared/netutils/netutils.c \ peripherals/i2c.c \ peripherals/rmt.c \ @@ -257,7 +266,6 @@ SRC_C += \ peripherals/touch.c ifeq ($(IDF_TARGET),esp32s2) SRC_C += \ - cam.c \ i2s_lcd_esp32s2_driver.c endif endif @@ -277,6 +285,17 @@ ifneq ($(CIRCUITPY_BLEIO),0) SRC_C += common-hal/_bleio/ble_events.c endif +SRC_C += $(wildcard common-hal/espidf/*.c) + +ifneq ($(CIRCUITPY_ESP32_CAMERA),0) +SRC_CAMERA := \ + $(wildcard common-hal/esp32_camera/*.c) \ + $(wildcard bindings/esp32_camera/*.c) +SRC_C += $(SRC_CAMERA) +CFLAGS += -isystem esp32-camera/driver/include +CFLAGS += -isystem esp32-camera/conversions/include +endif + SRC_COMMON_HAL_EXPANDED = \ $(addprefix shared-bindings/, $(SRC_COMMON_HAL)) \ $(addprefix shared-bindings/, $(SRC_BINDINGS_ENUMS)) \ @@ -335,8 +354,10 @@ ifneq ($(CIRCUITPY_BLEIO),0) SDKCONFIGS := esp-idf-config/sdkconfig-ble.defaults;$(SDKCONFIGS) endif # create the config headers -$(BUILD)/esp-idf/config/sdkconfig.h: boards/$(BOARD)/sdkconfig | $(BUILD)/esp-idf - IDF_PATH=$(IDF_PATH) cmake -S . -B $(BUILD)/esp-idf -DSDKCONFIG=$(BUILD)/esp-idf/sdkconfig -DSDKCONFIG_DEFAULTS="$(SDKCONFIGS)" -DCMAKE_TOOLCHAIN_FILE=$(IDF_PATH)/tools/cmake/toolchain-$(IDF_TARGET).cmake -DIDF_TARGET=$(IDF_TARGET) -GNinja +.PHONY: do-sdkconfig +do-sdkconfig: $(BUILD)/esp-idf/config/sdkconfig.h +$(BUILD)/esp-idf/config/sdkconfig.h: boards/$(BOARD)/sdkconfig CMakeLists.txt | $(BUILD)/esp-idf + IDF_PATH=$(IDF_PATH) cmake -S . -B $(BUILD)/esp-idf -DSDKCONFIG=$(BUILD)/esp-idf/sdkconfig -DSDKCONFIG_DEFAULTS="$(SDKCONFIGS)" -DCMAKE_TOOLCHAIN_FILE=$(IDF_PATH)/tools/cmake/toolchain-$(IDF_TARGET).cmake -DIDF_TARGET=$(IDF_TARGET) -GNinja -DCIRCUITPY_ESP32_CAMERA=$(CIRCUITPY_ESP32_CAMERA) # build a lib # Adding -d explain -j 1 -v to the ninja line will output debug info @@ -364,6 +385,9 @@ $(HEADER_BUILD)/qstr.split: | $(BUILD)/esp-idf/config/sdkconfig.h BINARY_WIFI_BLOBS = libcoexist.a libcore.a libespnow.a libmesh.a libnet80211.a libpp.a libsmartconfig.a libwapi.a BINARY_BLOBS = esp-idf/components/esp_phy/lib/$(IDF_TARGET)/libphy.a $(addprefix esp-idf/components/esp_wifi/lib/$(IDF_TARGET)/, $(BINARY_WIFI_BLOBS)) +ifeq ($(IDF_TARGET),esp32) +BINARY_BLOBS += esp-idf/components/esp_phy/lib/$(IDF_TARGET)/librtc.a +endif ESP_IDF_COMPONENTS_LINK = $(IDF_TARGET_ARCH) app_update bootloader_support driver efuse esp_adc_cal esp_common esp_event esp_hw_support esp_ipc esp_netif esp_pm esp_phy esp_ringbuf esp_rom esp_system esp_timer esp-tls esp_wifi freertos hal heap log lwip mbedtls mdns newlib nvs_flash pthread soc spi_flash vfs wpa_supplicant ifneq ($(CIRCUITPY_BLEIO),0) @@ -382,12 +406,22 @@ BINARY_BLOBS += esp-idf/components/xtensa/$(IDF_TARGET)/libxt_hal.a ESP_IDF_COMPONENTS_EXPANDED += esp-idf/components/xtensa/$(IDF_TARGET)/libxt_hal.a endif -ifeq ($(IDF_TARGET),esp32c3) +ifneq ($(CIRCUITPY_ESP32_CAMERA),0) +ESP_IDF_COMPONENTS_EXPANDED += $(BUILD)/esp-idf/esp-idf/esp32-camera/libesp32-camera.a +#$(error $(ESP_IDF_COMPONENTS_EXPANDED)) +endif + +# BOOTLOADER_OFFSET is determined by chip type, based on the ROM bootloader, and is not changeable. +ifeq ($(IDF_TARGET),esp32) +BOOTLOADER_OFFSET = 0x1000 +else ifeq ($(IDF_TARGET),esp32c3) BOOTLOADER_OFFSET = 0x0 else ifeq ($(IDF_TARGET),esp32s3) BOOTLOADER_OFFSET = 0x0 -else +else ifeq ($(IDF_TARGET),esp32s2) BOOTLOADER_OFFSET = 0x1000 +else +$(error unknown IDF_TARGET $(IDF_TARGET)) endif IDF_CMAKE_TARGETS = \ @@ -402,7 +436,7 @@ ESP_AUTOGEN_LD = $(BUILD)/esp-idf/esp-idf/$(IDF_TARGET)/$(IDF_TARGET)_out.ld $(B FLASH_FLAGS = --flash_mode $(CIRCUITPY_ESP_FLASH_MODE) --flash_freq $(CIRCUITPY_ESP_FLASH_FREQ) --flash_size $(CIRCUITPY_ESP_FLASH_SIZE) -ESPTOOL_FLAGS ?= --before=default_reset --after=no_reset +ESPTOOL_FLAGS ?= --before=default_reset --after=no_reset --baud 921600 ifeq ($(UF2_BOOTLOADER),1) all: $(BUILD)/firmware.bin $(BUILD)/firmware.uf2 diff --git a/ports/espressif/README.rst b/ports/espressif/README.rst index cea95dea04..949f3533ae 100644 --- a/ports/espressif/README.rst +++ b/ports/espressif/README.rst @@ -9,6 +9,7 @@ Support Status: .. csv-table:: :header: SoC, Status + ESP, "beta" ESP32-C3, "beta" ESP32-S2, "stable" ESP32-S3, "beta" @@ -20,13 +21,17 @@ How this port is organized: - **boards/** contains the configuration files for each development board and breakout available on the port. - **common-hal/** contains the port-specific module implementations, used by shared-module and shared-bindings. - **esp-idf/** contains the Espressif IoT Development Framework installation, including all the drivers for the port. -- **modules/** contains information specific to certain Espressif SoC based hardware modules, such as the pins used for flash and RAM on the WROVER and WROOM. - **peripherals/** contains peripheral setup files and peripheral mapping information, sorted by family and sub-variant. Most files in this directory can be generated with the python scripts in **tools/**. - **supervisor/** contains port-specific implementations of internal flash, serial and USB, as well as the **port.c** file, which initializes the port at startup. - **tools/** includes useful Python scripts for debugging and other purposes. At the root level, refer to **mpconfigboard.h** and **mpconfigport.mk** for port specific settings and a list of enabled CircuitPython modules. +Connecting to the ESP32 +--------------------------------------- +The ESP32 chip itself has no USB support. On many boards there is a USB-serial adapter chip, such as a CP2102N, CP2104 or CH9102F, usually connected to the ESP32 TXD0 (GPIO1)and RXD0 (GPIO3) pins, for access to the bootloader. CircuitPython also uses this serial channel for the REPL. + + Connecting to the ESP32-C3 --------------------------------------- diff --git a/ports/espressif/background.c b/ports/espressif/background.c index 37fe3d5be0..0b5bb96a3b 100644 --- a/ports/espressif/background.c +++ b/ports/espressif/background.c @@ -40,7 +40,6 @@ #include "common-hal/pulseio/PulseIn.h" #endif - void port_background_task(void) { // Zero delay in case FreeRTOS wants to switch to something else. vTaskDelay(0); diff --git a/ports/espressif/bindings/esp32_camera/Camera.c b/ports/espressif/bindings/esp32_camera/Camera.c new file mode 100644 index 0000000000..a770ea8ff7 --- /dev/null +++ b/ports/espressif/bindings/esp32_camera/Camera.c @@ -0,0 +1,994 @@ +/* + * This file is part of the MicroPython project, http://micropython.org/ + * + * The MIT License (MIT) + * + * Copyright (c) 2022 Jeff Epler for Adafruit Industries + * + * Permission is hereby granted, free of charge, to any person obtaining a copy + * of this software and associated documentation files (the "Software"), to deal + * in the Software without restriction, including without limitation the rights + * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell + * copies of the Software, and to permit persons to whom the Software is + * furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice shall be included in + * all copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE + * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER + * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, + * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN + * THE SOFTWARE. + */ + +#include + +#include "py/mphal.h" +#include "py/obj.h" +#include "py/objproperty.h" +#include "py/runtime.h" + +#include "bindings/esp32_camera/__init__.h" +#include "bindings/esp32_camera/Camera.h" +#include "common-hal/esp32_camera/Camera.h" + +#include "shared-bindings/displayio/Bitmap.h" +#include "shared-bindings/microcontroller/Pin.h" +#include "shared-bindings/util.h" +#include "esp_camera.h" +#include "sensor.h" + +//| class Camera: +//| def __init__( +//| self, +//| *, +//| data_pins: List[microcontroller.Pin], +//| pixel_clock_pin: microcontroller.Pin, +//| vsync_pin: microcontroller.Pin, +//| href_pin: microcontroller.Pin, +//| i2c: busio.I2C, +//| external_clock_pin: microcontroller.Pin, +//| external_clock_frequency: int, +//| powerdown_pin: Optional[microcontroller.Pin] = None, +//| reset_pin: Optional[microcontroller.Pin] = None, +//| pixel_format: PixelFormat = PixelFormat.RGB565, +//| frame_size: FrameSize = FrameSize.QQVGA, +//| jpeg_quality: int = 15, +//| framebuffer_count: int = 1, +//| grab_mode: GrabMode = GrabMode.WHEN_EMPTY, +//| ) -> None: +//| """ +//| Configure and initialize a camera with the given properties +//| +//| This driver requires that the ``CIRCUITPY_RESERVED_PSRAM`` in ``/.env`` be large enough to hold the camera frambuffer(s). Generally, boards with built-in cameras will have a default setting that is large enough. If the constructor raises a MemoryError or an IDFError, this probably indicates the setting is too small and should be increased. +//| +//| +//| .. important:: +//| +//| Not all supported sensors have all +//| of the properties listed below. For instance, the +//| OV5640 supports `denoise`, but the +//| OV2640 does not. The underlying esp32-camera +//| library does not provide a reliable API to check +//| which settings are supported. CircuitPython makes +//| a best effort to determine when an unsupported +//| property is set and will raise an exception in +//| that case. +//| +//| :param data_pins: The 8 data data_pins used for image data transfer from the camera module, least significant bit first +//| :param pixel_clock_pin: The pixel clock output from the camera module +//| :param vsync_pin: The vertical sync pulse output from the camera module +//| :param href_pin: The horizontal reference output from the camera module +//| :param i2c: The I2C bus connected to the camera module +//| :param external_clock_pin: The pin on which to generate the external clock +//| :param external_clock_frequency: The frequency generated on the external clock pin +//| :param powerdown_pin: The powerdown input to the camera module +//| :param reset_pin: The reset input to the camera module +//| :param pixel_format: The pixel format of the captured image +//| :param frame_size: The size of captured image +//| :param jpeg_quality: For `PixelFormat.JPEG`, the quality. Higher numbers increase quality. If the quality is too high, the JPEG data will be larger than the availalble buffer size and the image will be unusable or truncated. The exact range of appropriate values depends on the sensor and must be determined empirically. +//| :param framebuffer_count: The number of framebuffers (1 for single-buffered and 2 for double-buffered) +//| :param grab_mode: When to grab a new frame +//| """ +STATIC mp_obj_t esp32_camera_camera_make_new(const mp_obj_type_t *type, size_t n_args, size_t n_kw, const mp_obj_t *all_args) { + enum { ARG_data_pins, ARG_pixel_clock_pin, ARG_vsync_pin, ARG_href_pin, ARG_i2c, ARG_external_clock_pin, ARG_external_clock_frequency, ARG_powerdown_pin, ARG_reset_pin, ARG_pixel_format, ARG_frame_size, ARG_jpeg_quality, ARG_framebuffer_count, ARG_grab_mode, NUM_ARGS }; + static const mp_arg_t allowed_args[] = { + { MP_QSTR_data_pins, MP_ARG_OBJ | MP_ARG_KW_ONLY | MP_ARG_REQUIRED }, + { MP_QSTR_pixel_clock_pin, MP_ARG_OBJ | MP_ARG_KW_ONLY | MP_ARG_REQUIRED }, + { MP_QSTR_vsync_pin, MP_ARG_OBJ | MP_ARG_KW_ONLY | MP_ARG_REQUIRED }, + { MP_QSTR_href_pin, MP_ARG_OBJ | MP_ARG_KW_ONLY | MP_ARG_REQUIRED }, + { MP_QSTR_i2c, MP_ARG_OBJ | MP_ARG_KW_ONLY | MP_ARG_REQUIRED }, + { MP_QSTR_external_clock_pin, MP_ARG_OBJ | MP_ARG_KW_ONLY }, + { MP_QSTR_external_clock_frequency, MP_ARG_INT | MP_ARG_REQUIRED }, + { MP_QSTR_powerdown_pin, MP_ARG_OBJ | MP_ARG_KW_ONLY, { .u_obj = MP_ROM_NONE } }, + { MP_QSTR_reset_pin, MP_ARG_OBJ | MP_ARG_KW_ONLY, { .u_obj = MP_ROM_NONE } }, + { MP_QSTR_pixel_format, MP_ARG_OBJ | MP_ARG_KW_ONLY, { .u_obj = MP_ROM_PTR((void *)&pixel_format_RGB565_obj) } }, + { MP_QSTR_frame_size, MP_ARG_OBJ | MP_ARG_KW_ONLY, { .u_obj = MP_ROM_PTR((void *)&frame_size_QQVGA_obj) } }, + { MP_QSTR_jpeg_quality, MP_ARG_INT | MP_ARG_KW_ONLY, { .u_int = 15 } }, + { MP_QSTR_framebuffer_count, MP_ARG_INT | MP_ARG_KW_ONLY, { .u_int = 1 } }, + { MP_QSTR_grab_mode, MP_ARG_OBJ | MP_ARG_KW_ONLY, { .u_obj = MP_ROM_PTR((void *)&grab_mode_WHEN_EMPTY_obj) } }, + }; + + mp_arg_val_t args[MP_ARRAY_SIZE(allowed_args)]; + MP_STATIC_ASSERT(MP_ARRAY_SIZE(allowed_args) == NUM_ARGS); + mp_arg_parse_all_kw_array(n_args, n_kw, all_args, MP_ARRAY_SIZE(allowed_args), allowed_args, args); + + uint8_t data_pins[8]; + uint8_t data_pin_count; + validate_pins(MP_QSTR_data_pins, data_pins, MP_ARRAY_SIZE(data_pins), args[ARG_data_pins].u_obj, &data_pin_count); + mp_arg_validate_length(data_pin_count, 8, MP_QSTR_data_pins); + + const mcu_pin_obj_t *pixel_clock_pin = validate_obj_is_free_pin(args[ARG_pixel_clock_pin].u_obj); + const mcu_pin_obj_t *vsync_pin = validate_obj_is_free_pin(args[ARG_vsync_pin].u_obj); + const mcu_pin_obj_t *href_pin = validate_obj_is_free_pin(args[ARG_href_pin].u_obj); + busio_i2c_obj_t *i2c = MP_OBJ_TO_PTR(mp_arg_validate_type(args[ARG_i2c].u_obj, &busio_i2c_type, MP_QSTR_i2c)); + const mcu_pin_obj_t *external_clock_pin = validate_obj_is_free_pin(args[ARG_external_clock_pin].u_obj); + const mcu_pin_obj_t *powerdown_pin = validate_obj_is_free_pin_or_none(args[ARG_powerdown_pin].u_obj); + const mcu_pin_obj_t *reset_pin = validate_obj_is_free_pin_or_none(args[ARG_reset_pin].u_obj); + const mp_int_t external_clock_frequency = mp_arg_validate_int_range(args[ARG_external_clock_frequency].u_int, 0, 40000000, MP_QSTR_clock_frequency); + + camera_grab_mode_t grab_mode = validate_grab_mode(args[ARG_grab_mode].u_obj, MP_QSTR_grab_mode); + framesize_t frame_size = validate_frame_size(args[ARG_frame_size].u_obj, MP_QSTR_frame_size); + pixformat_t pixel_format = validate_pixel_format(args[ARG_pixel_format].u_obj, MP_QSTR_pixel_format); + mp_int_t jpeg_quality = mp_arg_validate_int_range(args[ARG_jpeg_quality].u_int, 2, 55, MP_QSTR_jpeg_quality); + mp_int_t framebuffer_count = mp_arg_validate_int_range(args[ARG_framebuffer_count].u_int, 1, 2, MP_QSTR_framebuffer_count); + + esp32_camera_camera_obj_t *self = m_new_obj(esp32_camera_camera_obj_t); + self->base.type = &esp32_camera_camera_type; + common_hal_esp32_camera_camera_construct( + self, + data_pins, + external_clock_pin, + pixel_clock_pin, + vsync_pin, + href_pin, + powerdown_pin, + reset_pin, + i2c, + external_clock_frequency, + pixel_format, + frame_size, + jpeg_quality, + framebuffer_count, + grab_mode); + return MP_OBJ_FROM_PTR(self); +} + +//| def deinit(self) -> None: +//| """Deinitialises the camera and releases all memory resources for reuse.""" +//| ... +STATIC mp_obj_t esp32_camera_camera_deinit(mp_obj_t self_in) { + esp32_camera_camera_obj_t *self = MP_OBJ_TO_PTR(self_in); + common_hal_esp32_camera_camera_deinit(self); + return mp_const_none; +} +STATIC MP_DEFINE_CONST_FUN_OBJ_1(esp32_camera_camera_deinit_obj, esp32_camera_camera_deinit); + +STATIC void check_for_deinit(esp32_camera_camera_obj_t *self) { + if (common_hal_esp32_camera_camera_deinited(self)) { + raise_deinited_error(); + } +} + +//| def __enter__(self) -> Camera: +//| """No-op used by Context Managers.""" +//| ... +// Provided by context manager helper. + +//| def __exit__(self) -> None: +//| """Automatically deinitializes the hardware when exiting a context. See +//| :ref:`lifetime-and-contextmanagers` for more info.""" +//| ... +STATIC mp_obj_t esp32_camera_camera_obj___exit__(size_t n_args, const mp_obj_t *args) { + (void)n_args; + return esp32_camera_camera_deinit(args[0]); +} +STATIC MP_DEFINE_CONST_FUN_OBJ_VAR_BETWEEN(esp32_camera_camera___exit___obj, 4, 4, esp32_camera_camera_obj___exit__); + +//| frame_available: bool +//| """True if a frame is available, False otherwise""" + +STATIC mp_obj_t esp32_camera_camera_frame_available_get(const mp_obj_t self_in) { + esp32_camera_camera_obj_t *self = MP_OBJ_TO_PTR(self_in); + check_for_deinit(self); + return mp_obj_new_bool(esp_camera_fb_available()); +} +STATIC MP_DEFINE_CONST_FUN_OBJ_1(esp32_camera_camera_frame_available_get_obj, esp32_camera_camera_frame_available_get); + +MP_PROPERTY_GETTER(esp32_camera_camera_frame_available_obj, + (mp_obj_t)&esp32_camera_camera_frame_available_get_obj); + +//| def take( +//| self, timeout: Optional[float] = 0.25 +//| ) -> Optional[displayio.Bitmap | ReadableBuffer]: +//| """Record a frame. Wait up to 'timeout' seconds for a frame to be captured. +//| +//| In the case of timeout, `None` is returned. +//| If `pixel_format` is `PixelFormat.JPEG`, the returned value is a read-only `memoryview`. +//| Otherwise, the returned value is a read-only `displayio.Bitmap`. +//| """ +STATIC mp_obj_t esp32_camera_camera_take(size_t n_args, const mp_obj_t *args) { + esp32_camera_camera_obj_t *self = MP_OBJ_TO_PTR(args[0]); + mp_float_t timeout = n_args < 2 ? MICROPY_FLOAT_CONST(0.25) : mp_obj_get_float(args[1]); + check_for_deinit(self); + camera_fb_t *result = common_hal_esp32_camera_camera_take(self, (int)MICROPY_FLOAT_C_FUN(round)(timeout * 1000)); + if (!result) { + return mp_const_none; + } + pixformat_t format = common_hal_esp32_camera_camera_get_pixel_format(self); + if (format == PIXFORMAT_JPEG) { + return mp_obj_new_memoryview('b', result->len, result->buf); + } else { + int width = common_hal_esp32_camera_camera_get_width(self); + int height = common_hal_esp32_camera_camera_get_height(self); + displayio_bitmap_t *bitmap = m_new_obj(displayio_bitmap_t); + bitmap->base.type = &displayio_bitmap_type; + common_hal_displayio_bitmap_construct_from_buffer(bitmap, width, height, (format == PIXFORMAT_RGB565) ? 16 : 8, (uint32_t *)(void *)result->buf, true); + return bitmap; + } +} +STATIC MP_DEFINE_CONST_FUN_OBJ_VAR_BETWEEN(esp32_camera_camera_take_obj, 1, 2, esp32_camera_camera_take); + + +//| def reconfigure( +//| self, +//| frame_size: Optional[FrameSize] = None, +//| pixel_format: Optional[PixelFormat] = None, +//| grab_mode: Optional[GrabMode] = None, +//| framebuffer_count: Optional[int] = None, +//| ) -> None: +//| """Change multiple related camera settings simultaneously +//| +//| Because these settings interact in complex ways, and take longer than +//| the other properties to set, they are set together in a single function call. +//| +//| If an argument is unspecified or None, then the setting is unchanged.""" + +STATIC mp_obj_t esp32_camera_camera_reconfigure(mp_uint_t n_args, const mp_obj_t *pos_args, mp_map_t *kw_args) { + esp32_camera_camera_obj_t *self = MP_OBJ_TO_PTR(pos_args[0]); + check_for_deinit(self); + + enum { ARG_frame_size, ARG_pixel_format, ARG_grab_mode, ARG_framebuffer_count }; + static const mp_arg_t allowed_args[] = { + { MP_QSTR_frame_size, MP_ARG_OBJ, {.u_obj = MP_ROM_NONE} }, + { MP_QSTR_pixel_format, MP_ARG_OBJ, {.u_obj = MP_ROM_NONE} }, + { MP_QSTR_grab_mode, MP_ARG_OBJ, {.u_obj = MP_ROM_NONE} }, + { MP_QSTR_framebuffer_count, MP_ARG_OBJ, {.u_obj = MP_ROM_NONE} }, + }; + + mp_arg_val_t args[MP_ARRAY_SIZE(allowed_args)]; + mp_arg_parse_all(n_args - 1, pos_args + 1, kw_args, MP_ARRAY_SIZE(allowed_args), allowed_args, args); + + framesize_t frame_size = + args[ARG_frame_size].u_obj != MP_ROM_NONE + ? validate_frame_size(args[ARG_frame_size].u_obj, MP_QSTR_frame_size) + : common_hal_esp32_camera_camera_get_frame_size(self); + pixformat_t pixel_format = + args[ARG_pixel_format].u_obj != MP_ROM_NONE + ? validate_pixel_format(args[ARG_pixel_format].u_obj, MP_QSTR_pixel_format) + : common_hal_esp32_camera_camera_get_pixel_format(self); + camera_grab_mode_t grab_mode = + args[ARG_grab_mode].u_obj != MP_ROM_NONE + ? validate_grab_mode(args[ARG_grab_mode].u_obj, MP_QSTR_grab_mode) + : common_hal_esp32_camera_camera_get_grab_mode(self); + bool framebuffer_count = + args[ARG_framebuffer_count].u_obj != MP_ROM_NONE + ? mp_obj_get_int(args[ARG_framebuffer_count].u_obj) + : common_hal_esp32_camera_camera_get_framebuffer_count(self); + + common_hal_esp32_camera_camera_reconfigure(self, frame_size, pixel_format, grab_mode, framebuffer_count); + + return mp_const_none; +} +MP_DEFINE_CONST_FUN_OBJ_KW(esp32_camera_camera_reconfigure_obj, 1, esp32_camera_camera_reconfigure); + +//| pixel_format: PixelFormat +//| """The pixel format of captured frames""" + +STATIC mp_obj_t esp32_camera_camera_get_pixel_format(const mp_obj_t self_in) { + esp32_camera_camera_obj_t *self = MP_OBJ_TO_PTR(self_in); + check_for_deinit(self); + return cp_enum_find(&esp32_camera_pixel_format_type, common_hal_esp32_camera_camera_get_pixel_format(self)); +} +STATIC MP_DEFINE_CONST_FUN_OBJ_1(esp32_camera_camera_get_pixel_format_obj, esp32_camera_camera_get_pixel_format); + +MP_PROPERTY_GETTER(esp32_camera_camera_pixel_format_obj, + (mp_obj_t)&esp32_camera_camera_get_pixel_format_obj); + + +//| frame_size: FrameSize +//| """The size of captured frames""" + +STATIC mp_obj_t esp32_camera_camera_get_frame_size(const mp_obj_t self_in) { + esp32_camera_camera_obj_t *self = MP_OBJ_TO_PTR(self_in); + check_for_deinit(self); + return cp_enum_find(&esp32_camera_frame_size_type, common_hal_esp32_camera_camera_get_frame_size(self)); +} +STATIC MP_DEFINE_CONST_FUN_OBJ_1(esp32_camera_camera_get_frame_size_obj, esp32_camera_camera_get_frame_size); + +MP_PROPERTY_GETTER(esp32_camera_camera_frame_size_obj, + (mp_obj_t)&esp32_camera_camera_get_frame_size_obj); + +//| contrast: int +//| """The sensor contrast. Positive values increase contrast, negative values lower it. The total range is device-specific but is often from -2 to +2 inclusive.""" + +STATIC mp_obj_t esp32_camera_camera_get_contrast(const mp_obj_t self_in) { + esp32_camera_camera_obj_t *self = MP_OBJ_TO_PTR(self_in); + check_for_deinit(self); + return MP_OBJ_NEW_SMALL_INT(common_hal_esp32_camera_camera_get_contrast(self)); +} +STATIC MP_DEFINE_CONST_FUN_OBJ_1(esp32_camera_camera_get_contrast_obj, esp32_camera_camera_get_contrast); + +STATIC mp_obj_t esp32_camera_camera_set_contrast(const mp_obj_t self_in, const mp_obj_t arg) { + esp32_camera_camera_obj_t *self = MP_OBJ_TO_PTR(self_in); + check_for_deinit(self); + common_hal_esp32_camera_camera_set_contrast(self, mp_obj_get_int(arg)); + return mp_const_none; +} +STATIC MP_DEFINE_CONST_FUN_OBJ_2(esp32_camera_camera_set_contrast_obj, esp32_camera_camera_set_contrast); +MP_PROPERTY_GETSET(esp32_camera_camera_contrast_obj, + (mp_obj_t)&esp32_camera_camera_get_contrast_obj, + (mp_obj_t)&esp32_camera_camera_set_contrast_obj); + +//| brightness: int +//| """The sensor brightness. Positive values increase brightness, negative values lower it. The total range is device-specific but is often from -2 to +2 inclusive.""" + +STATIC mp_obj_t esp32_camera_camera_get_brightness(const mp_obj_t self_in) { + esp32_camera_camera_obj_t *self = MP_OBJ_TO_PTR(self_in); + check_for_deinit(self); + return MP_OBJ_NEW_SMALL_INT(common_hal_esp32_camera_camera_get_brightness(self)); +} +STATIC MP_DEFINE_CONST_FUN_OBJ_1(esp32_camera_camera_get_brightness_obj, esp32_camera_camera_get_brightness); + +STATIC mp_obj_t esp32_camera_camera_set_brightness(const mp_obj_t self_in, const mp_obj_t arg) { + esp32_camera_camera_obj_t *self = MP_OBJ_TO_PTR(self_in); + check_for_deinit(self); + common_hal_esp32_camera_camera_set_brightness(self, mp_obj_get_int(arg)); + return mp_const_none; +} +STATIC MP_DEFINE_CONST_FUN_OBJ_2(esp32_camera_camera_set_brightness_obj, esp32_camera_camera_set_brightness); +MP_PROPERTY_GETSET(esp32_camera_camera_brightness_obj, + (mp_obj_t)&esp32_camera_camera_get_brightness_obj, + (mp_obj_t)&esp32_camera_camera_set_brightness_obj); + +//| saturation: int +//| """The sensor saturation. Positive values increase saturation (more vibrant colors), negative values lower it (more muted colors). The total range is device-specific but the value is often from -2 to +2 inclusive.""" + +STATIC mp_obj_t esp32_camera_camera_get_saturation(const mp_obj_t self_in) { + esp32_camera_camera_obj_t *self = MP_OBJ_TO_PTR(self_in); + check_for_deinit(self); + return MP_OBJ_NEW_SMALL_INT(common_hal_esp32_camera_camera_get_saturation(self)); +} +STATIC MP_DEFINE_CONST_FUN_OBJ_1(esp32_camera_camera_get_saturation_obj, esp32_camera_camera_get_saturation); + +STATIC mp_obj_t esp32_camera_camera_set_saturation(const mp_obj_t self_in, const mp_obj_t arg) { + esp32_camera_camera_obj_t *self = MP_OBJ_TO_PTR(self_in); + check_for_deinit(self); + common_hal_esp32_camera_camera_set_saturation(self, mp_obj_get_int(arg)); + return mp_const_none; +} +STATIC MP_DEFINE_CONST_FUN_OBJ_2(esp32_camera_camera_set_saturation_obj, esp32_camera_camera_set_saturation); +MP_PROPERTY_GETSET(esp32_camera_camera_saturation_obj, + (mp_obj_t)&esp32_camera_camera_get_saturation_obj, + (mp_obj_t)&esp32_camera_camera_set_saturation_obj); + +//| sharpness: int +//| """The sensor sharpness. Positive values increase sharpness (more defined edges), negative values lower it (softer edges). The total range is device-specific but the value is often from -2 to +2 inclusive.""" + +STATIC mp_obj_t esp32_camera_camera_get_sharpness(const mp_obj_t self_in) { + esp32_camera_camera_obj_t *self = MP_OBJ_TO_PTR(self_in); + check_for_deinit(self); + return MP_OBJ_NEW_SMALL_INT(common_hal_esp32_camera_camera_get_sharpness(self)); +} +STATIC MP_DEFINE_CONST_FUN_OBJ_1(esp32_camera_camera_get_sharpness_obj, esp32_camera_camera_get_sharpness); + +STATIC mp_obj_t esp32_camera_camera_set_sharpness(const mp_obj_t self_in, const mp_obj_t arg) { + esp32_camera_camera_obj_t *self = MP_OBJ_TO_PTR(self_in); + check_for_deinit(self); + common_hal_esp32_camera_camera_set_sharpness(self, mp_obj_get_int(arg)); + return mp_const_none; +} +STATIC MP_DEFINE_CONST_FUN_OBJ_2(esp32_camera_camera_set_sharpness_obj, esp32_camera_camera_set_sharpness); +MP_PROPERTY_GETSET(esp32_camera_camera_sharpness_obj, + (mp_obj_t)&esp32_camera_camera_get_sharpness_obj, + (mp_obj_t)&esp32_camera_camera_set_sharpness_obj); + +//| denoise: int +//| """The sensor 'denoise' setting. Any camera sensor has inherent 'noise', especially in low brightness environments. Software algorithms can decrease noise at the expense of fine detail. A larger value increases the amount of software noise removal. The total range is device-specific but the value is often from 0 to 10.""" + +STATIC mp_obj_t esp32_camera_camera_get_denoise(const mp_obj_t self_in) { + esp32_camera_camera_obj_t *self = MP_OBJ_TO_PTR(self_in); + check_for_deinit(self); + return MP_OBJ_NEW_SMALL_INT(common_hal_esp32_camera_camera_get_denoise(self)); +} +STATIC MP_DEFINE_CONST_FUN_OBJ_1(esp32_camera_camera_get_denoise_obj, esp32_camera_camera_get_denoise); + +STATIC mp_obj_t esp32_camera_camera_set_denoise(const mp_obj_t self_in, const mp_obj_t arg) { + esp32_camera_camera_obj_t *self = MP_OBJ_TO_PTR(self_in); + check_for_deinit(self); + common_hal_esp32_camera_camera_set_denoise(self, mp_obj_get_int(arg)); + return mp_const_none; +} +STATIC MP_DEFINE_CONST_FUN_OBJ_2(esp32_camera_camera_set_denoise_obj, esp32_camera_camera_set_denoise); +MP_PROPERTY_GETSET(esp32_camera_camera_denoise_obj, + (mp_obj_t)&esp32_camera_camera_get_denoise_obj, + (mp_obj_t)&esp32_camera_camera_set_denoise_obj); + +//| gain_ceiling: GainCeiling +//| """The sensor 'gain ceiling' setting. "Gain" is an analog multiplier applied to the raw sensor data. The 'ceiling' is the maximum gain value that the sensor will use. A higher gain means that the sensor has a greater response to light, but also makes sensor noise more visible.""" + +STATIC mp_obj_t esp32_camera_camera_get_gain_ceiling(const mp_obj_t self_in) { + esp32_camera_camera_obj_t *self = MP_OBJ_TO_PTR(self_in); + check_for_deinit(self); + return cp_enum_find(&esp32_camera_gain_ceiling_type, common_hal_esp32_camera_camera_get_gainceiling(self)); +} +STATIC MP_DEFINE_CONST_FUN_OBJ_1(esp32_camera_camera_get_gain_ceiling_obj, esp32_camera_camera_get_gain_ceiling); + +STATIC mp_obj_t esp32_camera_camera_set_gain_ceiling(const mp_obj_t self_in, const mp_obj_t arg) { + esp32_camera_camera_obj_t *self = MP_OBJ_TO_PTR(self_in); + check_for_deinit(self); + common_hal_esp32_camera_camera_set_gainceiling(self, validate_gain_ceiling(arg, MP_QSTR_gain_ceiling)); + return mp_const_none; +} +STATIC MP_DEFINE_CONST_FUN_OBJ_2(esp32_camera_camera_set_gain_ceiling_obj, esp32_camera_camera_set_gain_ceiling); +MP_PROPERTY_GETSET(esp32_camera_camera_gain_ceiling_obj, + (mp_obj_t)&esp32_camera_camera_get_gain_ceiling_obj, + (mp_obj_t)&esp32_camera_camera_set_gain_ceiling_obj); + +//| quality: int +//| """The 'quality' setting when capturing JPEG images. This is similar to the quality setting when exporting a jpeg image from photo editing software. Typical values range from 5 to 40, with higher numbers leading to larger image sizes and better overall image quality. However, when the quality is set to a high number, the total size of the JPEG data can exceed the size of an internal buffer, causing image capture to fail.""" + +STATIC mp_obj_t esp32_camera_camera_get_quality(const mp_obj_t self_in) { + esp32_camera_camera_obj_t *self = MP_OBJ_TO_PTR(self_in); + check_for_deinit(self); + return MP_OBJ_NEW_SMALL_INT(common_hal_esp32_camera_camera_get_quality(self)); +} +STATIC MP_DEFINE_CONST_FUN_OBJ_1(esp32_camera_camera_get_quality_obj, esp32_camera_camera_get_quality); + +STATIC mp_obj_t esp32_camera_camera_set_quality(const mp_obj_t self_in, const mp_obj_t arg) { + esp32_camera_camera_obj_t *self = MP_OBJ_TO_PTR(self_in); + check_for_deinit(self); + common_hal_esp32_camera_camera_set_quality(self, mp_obj_get_int(arg)); + return mp_const_none; +} +STATIC MP_DEFINE_CONST_FUN_OBJ_2(esp32_camera_camera_set_quality_obj, esp32_camera_camera_set_quality); +MP_PROPERTY_GETSET(esp32_camera_camera_quality_obj, + (mp_obj_t)&esp32_camera_camera_get_quality_obj, + (mp_obj_t)&esp32_camera_camera_set_quality_obj); + +//| colorbar: bool +//| """When `True`, a test pattern image is captured and the real sensor data is not used.""" + +STATIC mp_obj_t esp32_camera_camera_get_colorbar(const mp_obj_t self_in) { + esp32_camera_camera_obj_t *self = MP_OBJ_TO_PTR(self_in); + check_for_deinit(self); + return mp_obj_new_bool(common_hal_esp32_camera_camera_get_colorbar(self)); +} +STATIC MP_DEFINE_CONST_FUN_OBJ_1(esp32_camera_camera_get_colorbar_obj, esp32_camera_camera_get_colorbar); + +STATIC mp_obj_t esp32_camera_camera_set_colorbar(const mp_obj_t self_in, const mp_obj_t arg) { + esp32_camera_camera_obj_t *self = MP_OBJ_TO_PTR(self_in); + check_for_deinit(self); + common_hal_esp32_camera_camera_set_colorbar(self, mp_obj_is_true(arg)); + return mp_const_none; +} +STATIC MP_DEFINE_CONST_FUN_OBJ_2(esp32_camera_camera_set_colorbar_obj, esp32_camera_camera_set_colorbar); +MP_PROPERTY_GETSET(esp32_camera_camera_colorbar_obj, + (mp_obj_t)&esp32_camera_camera_get_colorbar_obj, + (mp_obj_t)&esp32_camera_camera_set_colorbar_obj); + +//| whitebal: bool +//| """When `True`, the camera attempts to automatically control white balance. When `False`, the `wb_mode` setting is used instead.""" + +STATIC mp_obj_t esp32_camera_camera_get_whitebal(const mp_obj_t self_in) { + esp32_camera_camera_obj_t *self = MP_OBJ_TO_PTR(self_in); + check_for_deinit(self); + return mp_obj_new_bool(common_hal_esp32_camera_camera_get_whitebal(self)); +} +STATIC MP_DEFINE_CONST_FUN_OBJ_1(esp32_camera_camera_get_whitebal_obj, esp32_camera_camera_get_whitebal); + +STATIC mp_obj_t esp32_camera_camera_set_whitebal(const mp_obj_t self_in, const mp_obj_t arg) { + esp32_camera_camera_obj_t *self = MP_OBJ_TO_PTR(self_in); + check_for_deinit(self); + common_hal_esp32_camera_camera_set_whitebal(self, mp_obj_is_true(arg)); + return mp_const_none; +} +STATIC MP_DEFINE_CONST_FUN_OBJ_2(esp32_camera_camera_set_whitebal_obj, esp32_camera_camera_set_whitebal); +MP_PROPERTY_GETSET(esp32_camera_camera_whitebal_obj, + (mp_obj_t)&esp32_camera_camera_get_whitebal_obj, + (mp_obj_t)&esp32_camera_camera_set_whitebal_obj); + +//| gain_ctrl: bool +//| """When `True`, the camera attempts to automatically control the sensor gain, up to the value in the `gain_ceiling` property. When `False`, the `agc_gain` setting is used instead.""" + +STATIC mp_obj_t esp32_camera_camera_get_gain_ctrl(const mp_obj_t self_in) { + esp32_camera_camera_obj_t *self = MP_OBJ_TO_PTR(self_in); + check_for_deinit(self); + return mp_obj_new_bool(common_hal_esp32_camera_camera_get_gain_ctrl(self)); +} +STATIC MP_DEFINE_CONST_FUN_OBJ_1(esp32_camera_camera_get_gain_ctrl_obj, esp32_camera_camera_get_gain_ctrl); + +STATIC mp_obj_t esp32_camera_camera_set_gain_ctrl(const mp_obj_t self_in, const mp_obj_t arg) { + esp32_camera_camera_obj_t *self = MP_OBJ_TO_PTR(self_in); + check_for_deinit(self); + common_hal_esp32_camera_camera_set_gain_ctrl(self, mp_obj_is_true(arg)); + return mp_const_none; +} +STATIC MP_DEFINE_CONST_FUN_OBJ_2(esp32_camera_camera_set_gain_ctrl_obj, esp32_camera_camera_set_gain_ctrl); +MP_PROPERTY_GETSET(esp32_camera_camera_gain_ctrl_obj, + (mp_obj_t)&esp32_camera_camera_get_gain_ctrl_obj, + (mp_obj_t)&esp32_camera_camera_set_gain_ctrl_obj); + +//| exposure_ctrl: bool +//| """When `True` the camera attempts to automatically control the exposure. When `False`, the `aec_value` setting is used instead.""" + +STATIC mp_obj_t esp32_camera_camera_get_exposure_ctrl(const mp_obj_t self_in) { + esp32_camera_camera_obj_t *self = MP_OBJ_TO_PTR(self_in); + check_for_deinit(self); + return mp_obj_new_bool(common_hal_esp32_camera_camera_get_exposure_ctrl(self)); +} +STATIC MP_DEFINE_CONST_FUN_OBJ_1(esp32_camera_camera_get_exposure_ctrl_obj, esp32_camera_camera_get_exposure_ctrl); + +STATIC mp_obj_t esp32_camera_camera_set_exposure_ctrl(const mp_obj_t self_in, const mp_obj_t arg) { + esp32_camera_camera_obj_t *self = MP_OBJ_TO_PTR(self_in); + check_for_deinit(self); + common_hal_esp32_camera_camera_set_exposure_ctrl(self, mp_obj_is_true(arg)); + return mp_const_none; +} +STATIC MP_DEFINE_CONST_FUN_OBJ_2(esp32_camera_camera_set_exposure_ctrl_obj, esp32_camera_camera_set_exposure_ctrl); +MP_PROPERTY_GETSET(esp32_camera_camera_exposure_ctrl_obj, + (mp_obj_t)&esp32_camera_camera_get_exposure_ctrl_obj, + (mp_obj_t)&esp32_camera_camera_set_exposure_ctrl_obj); + +//| hmirror: bool +//| """When `True` the camera image is mirrored left-to-right""" + +STATIC mp_obj_t esp32_camera_camera_get_hmirror(const mp_obj_t self_in) { + esp32_camera_camera_obj_t *self = MP_OBJ_TO_PTR(self_in); + check_for_deinit(self); + return mp_obj_new_bool(common_hal_esp32_camera_camera_get_hmirror(self)); +} +STATIC MP_DEFINE_CONST_FUN_OBJ_1(esp32_camera_camera_get_hmirror_obj, esp32_camera_camera_get_hmirror); + +STATIC mp_obj_t esp32_camera_camera_set_hmirror(const mp_obj_t self_in, const mp_obj_t arg) { + esp32_camera_camera_obj_t *self = MP_OBJ_TO_PTR(self_in); + check_for_deinit(self); + common_hal_esp32_camera_camera_set_hmirror(self, mp_obj_is_true(arg)); + return mp_const_none; +} +STATIC MP_DEFINE_CONST_FUN_OBJ_2(esp32_camera_camera_set_hmirror_obj, esp32_camera_camera_set_hmirror); +MP_PROPERTY_GETSET(esp32_camera_camera_hmirror_obj, + (mp_obj_t)&esp32_camera_camera_get_hmirror_obj, + (mp_obj_t)&esp32_camera_camera_set_hmirror_obj); + +//| vflip: bool +//| """When `True` the camera image is flipped top-to-bottom""" + +STATIC mp_obj_t esp32_camera_camera_get_vflip(const mp_obj_t self_in) { + esp32_camera_camera_obj_t *self = MP_OBJ_TO_PTR(self_in); + check_for_deinit(self); + return mp_obj_new_bool(common_hal_esp32_camera_camera_get_vflip(self)); +} +STATIC MP_DEFINE_CONST_FUN_OBJ_1(esp32_camera_camera_get_vflip_obj, esp32_camera_camera_get_vflip); + +STATIC mp_obj_t esp32_camera_camera_set_vflip(const mp_obj_t self_in, const mp_obj_t arg) { + esp32_camera_camera_obj_t *self = MP_OBJ_TO_PTR(self_in); + check_for_deinit(self); + common_hal_esp32_camera_camera_set_vflip(self, mp_obj_is_true(arg)); + return mp_const_none; +} +STATIC MP_DEFINE_CONST_FUN_OBJ_2(esp32_camera_camera_set_vflip_obj, esp32_camera_camera_set_vflip); +MP_PROPERTY_GETSET(esp32_camera_camera_vflip_obj, + (mp_obj_t)&esp32_camera_camera_get_vflip_obj, + (mp_obj_t)&esp32_camera_camera_set_vflip_obj); + +//| aec2: bool +//| """When `True` the sensor's "night mode" is enabled, extending the range of automatic gain control.""" + +STATIC mp_obj_t esp32_camera_camera_get_aec2(const mp_obj_t self_in) { + esp32_camera_camera_obj_t *self = MP_OBJ_TO_PTR(self_in); + check_for_deinit(self); + return mp_obj_new_bool(common_hal_esp32_camera_camera_get_aec2(self)); +} +STATIC MP_DEFINE_CONST_FUN_OBJ_1(esp32_camera_camera_get_aec2_obj, esp32_camera_camera_get_aec2); + +STATIC mp_obj_t esp32_camera_camera_set_aec2(const mp_obj_t self_in, const mp_obj_t arg) { + esp32_camera_camera_obj_t *self = MP_OBJ_TO_PTR(self_in); + check_for_deinit(self); + common_hal_esp32_camera_camera_set_aec2(self, mp_obj_is_true(arg)); + return mp_const_none; +} +STATIC MP_DEFINE_CONST_FUN_OBJ_2(esp32_camera_camera_set_aec2_obj, esp32_camera_camera_set_aec2); +MP_PROPERTY_GETSET(esp32_camera_camera_aec2_obj, + (mp_obj_t)&esp32_camera_camera_get_aec2_obj, + (mp_obj_t)&esp32_camera_camera_set_aec2_obj); + +//| awb_gain: bool +//| """Access the awb_gain property of the camera sensor""" + +STATIC mp_obj_t esp32_camera_camera_get_awb_gain(const mp_obj_t self_in) { + esp32_camera_camera_obj_t *self = MP_OBJ_TO_PTR(self_in); + check_for_deinit(self); + return mp_obj_new_bool(common_hal_esp32_camera_camera_get_awb_gain(self)); +} +STATIC MP_DEFINE_CONST_FUN_OBJ_1(esp32_camera_camera_get_awb_gain_obj, esp32_camera_camera_get_awb_gain); + +STATIC mp_obj_t esp32_camera_camera_set_awb_gain(const mp_obj_t self_in, const mp_obj_t arg) { + esp32_camera_camera_obj_t *self = MP_OBJ_TO_PTR(self_in); + check_for_deinit(self); + common_hal_esp32_camera_camera_set_awb_gain(self, mp_obj_is_true(arg)); + return mp_const_none; +} +STATIC MP_DEFINE_CONST_FUN_OBJ_2(esp32_camera_camera_set_awb_gain_obj, esp32_camera_camera_set_awb_gain); +MP_PROPERTY_GETSET(esp32_camera_camera_awb_gain_obj, + (mp_obj_t)&esp32_camera_camera_get_awb_gain_obj, + (mp_obj_t)&esp32_camera_camera_set_awb_gain_obj); + +//| agc_gain: int +//| """Access the gain level of the sensor. Higher values produce brighter images. Typical settings range from 0 to 30. """ + +STATIC mp_obj_t esp32_camera_camera_get_agc_gain(const mp_obj_t self_in) { + esp32_camera_camera_obj_t *self = MP_OBJ_TO_PTR(self_in); + check_for_deinit(self); + return MP_OBJ_NEW_SMALL_INT(common_hal_esp32_camera_camera_get_agc_gain(self)); +} +STATIC MP_DEFINE_CONST_FUN_OBJ_1(esp32_camera_camera_get_agc_gain_obj, esp32_camera_camera_get_agc_gain); + +STATIC mp_obj_t esp32_camera_camera_set_agc_gain(const mp_obj_t self_in, const mp_obj_t arg) { + esp32_camera_camera_obj_t *self = MP_OBJ_TO_PTR(self_in); + check_for_deinit(self); + common_hal_esp32_camera_camera_set_agc_gain(self, mp_obj_get_int(arg)); + return mp_const_none; +} +STATIC MP_DEFINE_CONST_FUN_OBJ_2(esp32_camera_camera_set_agc_gain_obj, esp32_camera_camera_set_agc_gain); +MP_PROPERTY_GETSET(esp32_camera_camera_agc_gain_obj, + (mp_obj_t)&esp32_camera_camera_get_agc_gain_obj, + (mp_obj_t)&esp32_camera_camera_set_agc_gain_obj); + +//| aec_value: int +//| """Access the exposure value of the camera. Higher values produce brighter images. Typical settings range from 0 to 1200.""" + +STATIC mp_obj_t esp32_camera_camera_get_aec_value(const mp_obj_t self_in) { + esp32_camera_camera_obj_t *self = MP_OBJ_TO_PTR(self_in); + check_for_deinit(self); + return MP_OBJ_NEW_SMALL_INT(common_hal_esp32_camera_camera_get_aec_value(self)); +} +STATIC MP_DEFINE_CONST_FUN_OBJ_1(esp32_camera_camera_get_aec_value_obj, esp32_camera_camera_get_aec_value); + +STATIC mp_obj_t esp32_camera_camera_set_aec_value(const mp_obj_t self_in, const mp_obj_t arg) { + esp32_camera_camera_obj_t *self = MP_OBJ_TO_PTR(self_in); + check_for_deinit(self); + common_hal_esp32_camera_camera_set_aec_value(self, mp_obj_get_int(arg)); + return mp_const_none; +} +STATIC MP_DEFINE_CONST_FUN_OBJ_2(esp32_camera_camera_set_aec_value_obj, esp32_camera_camera_set_aec_value); +MP_PROPERTY_GETSET(esp32_camera_camera_aec_value_obj, + (mp_obj_t)&esp32_camera_camera_get_aec_value_obj, + (mp_obj_t)&esp32_camera_camera_set_aec_value_obj); + +//| special_effect: int +//| """Enable a "special effect". Zero is no special effect. On OV5640, special effects range from 0 to 6 inclusive and select various color modes.""" + +STATIC mp_obj_t esp32_camera_camera_get_special_effect(const mp_obj_t self_in) { + esp32_camera_camera_obj_t *self = MP_OBJ_TO_PTR(self_in); + check_for_deinit(self); + return MP_OBJ_NEW_SMALL_INT(common_hal_esp32_camera_camera_get_special_effect(self)); +} +STATIC MP_DEFINE_CONST_FUN_OBJ_1(esp32_camera_camera_get_special_effect_obj, esp32_camera_camera_get_special_effect); + +STATIC mp_obj_t esp32_camera_camera_set_special_effect(const mp_obj_t self_in, const mp_obj_t arg) { + esp32_camera_camera_obj_t *self = MP_OBJ_TO_PTR(self_in); + check_for_deinit(self); + common_hal_esp32_camera_camera_set_special_effect(self, mp_obj_get_int(arg)); + return mp_const_none; +} +STATIC MP_DEFINE_CONST_FUN_OBJ_2(esp32_camera_camera_set_special_effect_obj, esp32_camera_camera_set_special_effect); +MP_PROPERTY_GETSET(esp32_camera_camera_special_effect_obj, + (mp_obj_t)&esp32_camera_camera_get_special_effect_obj, + (mp_obj_t)&esp32_camera_camera_set_special_effect_obj); + +//| wb_mode: int +//| """The white balance mode. 0 is automatic white balance. Typical values range from 0 to 4 inclusive.""" + +STATIC mp_obj_t esp32_camera_camera_get_wb_mode(const mp_obj_t self_in) { + esp32_camera_camera_obj_t *self = MP_OBJ_TO_PTR(self_in); + check_for_deinit(self); + return MP_OBJ_NEW_SMALL_INT(common_hal_esp32_camera_camera_get_wb_mode(self)); +} +STATIC MP_DEFINE_CONST_FUN_OBJ_1(esp32_camera_camera_get_wb_mode_obj, esp32_camera_camera_get_wb_mode); + +STATIC mp_obj_t esp32_camera_camera_set_wb_mode(const mp_obj_t self_in, const mp_obj_t arg) { + esp32_camera_camera_obj_t *self = MP_OBJ_TO_PTR(self_in); + check_for_deinit(self); + common_hal_esp32_camera_camera_set_wb_mode(self, mp_obj_get_int(arg)); + return mp_const_none; +} +STATIC MP_DEFINE_CONST_FUN_OBJ_2(esp32_camera_camera_set_wb_mode_obj, esp32_camera_camera_set_wb_mode); +MP_PROPERTY_GETSET(esp32_camera_camera_wb_mode_obj, + (mp_obj_t)&esp32_camera_camera_get_wb_mode_obj, + (mp_obj_t)&esp32_camera_camera_set_wb_mode_obj); + +//| ae_level: int +//| """The exposure offset for automatic exposure. Typical values range from -2 to +2.""" + +STATIC mp_obj_t esp32_camera_camera_get_ae_level(const mp_obj_t self_in) { + esp32_camera_camera_obj_t *self = MP_OBJ_TO_PTR(self_in); + check_for_deinit(self); + return MP_OBJ_NEW_SMALL_INT(common_hal_esp32_camera_camera_get_ae_level(self)); +} +STATIC MP_DEFINE_CONST_FUN_OBJ_1(esp32_camera_camera_get_ae_level_obj, esp32_camera_camera_get_ae_level); + +STATIC mp_obj_t esp32_camera_camera_set_ae_level(const mp_obj_t self_in, const mp_obj_t arg) { + esp32_camera_camera_obj_t *self = MP_OBJ_TO_PTR(self_in); + check_for_deinit(self); + common_hal_esp32_camera_camera_set_ae_level(self, mp_obj_get_int(arg)); + return mp_const_none; +} +STATIC MP_DEFINE_CONST_FUN_OBJ_2(esp32_camera_camera_set_ae_level_obj, esp32_camera_camera_set_ae_level); +MP_PROPERTY_GETSET(esp32_camera_camera_ae_level_obj, + (mp_obj_t)&esp32_camera_camera_get_ae_level_obj, + (mp_obj_t)&esp32_camera_camera_set_ae_level_obj); + +//| dcw: bool +//| """When `True` an advanced white balance mode is selected.""" + +STATIC mp_obj_t esp32_camera_camera_get_dcw(const mp_obj_t self_in) { + esp32_camera_camera_obj_t *self = MP_OBJ_TO_PTR(self_in); + check_for_deinit(self); + return mp_obj_new_bool(common_hal_esp32_camera_camera_get_dcw(self)); +} +STATIC MP_DEFINE_CONST_FUN_OBJ_1(esp32_camera_camera_get_dcw_obj, esp32_camera_camera_get_dcw); + +STATIC mp_obj_t esp32_camera_camera_set_dcw(const mp_obj_t self_in, const mp_obj_t arg) { + esp32_camera_camera_obj_t *self = MP_OBJ_TO_PTR(self_in); + check_for_deinit(self); + common_hal_esp32_camera_camera_set_dcw(self, mp_obj_is_true(arg)); + return mp_const_none; +} +STATIC MP_DEFINE_CONST_FUN_OBJ_2(esp32_camera_camera_set_dcw_obj, esp32_camera_camera_set_dcw); +MP_PROPERTY_GETSET(esp32_camera_camera_dcw_obj, + (mp_obj_t)&esp32_camera_camera_get_dcw_obj, + (mp_obj_t)&esp32_camera_camera_set_dcw_obj); + +//| bpc: bool +//| """When `True`, "black point compensation" is enabled. This can make black parts of the image darker.""" + +STATIC mp_obj_t esp32_camera_camera_get_bpc(const mp_obj_t self_in) { + esp32_camera_camera_obj_t *self = MP_OBJ_TO_PTR(self_in); + check_for_deinit(self); + return mp_obj_new_bool(common_hal_esp32_camera_camera_get_bpc(self)); +} +STATIC MP_DEFINE_CONST_FUN_OBJ_1(esp32_camera_camera_get_bpc_obj, esp32_camera_camera_get_bpc); + +STATIC mp_obj_t esp32_camera_camera_set_bpc(const mp_obj_t self_in, const mp_obj_t arg) { + esp32_camera_camera_obj_t *self = MP_OBJ_TO_PTR(self_in); + check_for_deinit(self); + common_hal_esp32_camera_camera_set_bpc(self, mp_obj_is_true(arg)); + return mp_const_none; +} +STATIC MP_DEFINE_CONST_FUN_OBJ_2(esp32_camera_camera_set_bpc_obj, esp32_camera_camera_set_bpc); +MP_PROPERTY_GETSET(esp32_camera_camera_bpc_obj, + (mp_obj_t)&esp32_camera_camera_get_bpc_obj, + (mp_obj_t)&esp32_camera_camera_set_bpc_obj); + +//| wpc: bool +//| """When `True`, "white point compensation" is enabled. This can make white parts of the image whiter.""" + +STATIC mp_obj_t esp32_camera_camera_get_wpc(const mp_obj_t self_in) { + esp32_camera_camera_obj_t *self = MP_OBJ_TO_PTR(self_in); + check_for_deinit(self); + return mp_obj_new_bool(common_hal_esp32_camera_camera_get_wpc(self)); +} +STATIC MP_DEFINE_CONST_FUN_OBJ_1(esp32_camera_camera_get_wpc_obj, esp32_camera_camera_get_wpc); + +STATIC mp_obj_t esp32_camera_camera_set_wpc(const mp_obj_t self_in, const mp_obj_t arg) { + esp32_camera_camera_obj_t *self = MP_OBJ_TO_PTR(self_in); + check_for_deinit(self); + common_hal_esp32_camera_camera_set_wpc(self, mp_obj_is_true(arg)); + return mp_const_none; +} +STATIC MP_DEFINE_CONST_FUN_OBJ_2(esp32_camera_camera_set_wpc_obj, esp32_camera_camera_set_wpc); +MP_PROPERTY_GETSET(esp32_camera_camera_wpc_obj, + (mp_obj_t)&esp32_camera_camera_get_wpc_obj, + (mp_obj_t)&esp32_camera_camera_set_wpc_obj); + +//| raw_gma: bool +//| """When `True`, raw gamma mode is enabled.""" + +STATIC mp_obj_t esp32_camera_camera_get_raw_gma(const mp_obj_t self_in) { + esp32_camera_camera_obj_t *self = MP_OBJ_TO_PTR(self_in); + check_for_deinit(self); + return mp_obj_new_bool(common_hal_esp32_camera_camera_get_raw_gma(self)); +} +STATIC MP_DEFINE_CONST_FUN_OBJ_1(esp32_camera_camera_get_raw_gma_obj, esp32_camera_camera_get_raw_gma); + +STATIC mp_obj_t esp32_camera_camera_set_raw_gma(const mp_obj_t self_in, const mp_obj_t arg) { + esp32_camera_camera_obj_t *self = MP_OBJ_TO_PTR(self_in); + check_for_deinit(self); + common_hal_esp32_camera_camera_set_raw_gma(self, mp_obj_is_true(arg)); + return mp_const_none; +} +STATIC MP_DEFINE_CONST_FUN_OBJ_2(esp32_camera_camera_set_raw_gma_obj, esp32_camera_camera_set_raw_gma); +MP_PROPERTY_GETSET(esp32_camera_camera_raw_gma_obj, + (mp_obj_t)&esp32_camera_camera_get_raw_gma_obj, + (mp_obj_t)&esp32_camera_camera_set_raw_gma_obj); + +//| lenc: bool +//| """Enable "lens correction". This can help compensate for light fall-off at the edge of the sensor area.""" + +STATIC mp_obj_t esp32_camera_camera_get_lenc(const mp_obj_t self_in) { + esp32_camera_camera_obj_t *self = MP_OBJ_TO_PTR(self_in); + check_for_deinit(self); + return mp_obj_new_bool(common_hal_esp32_camera_camera_get_lenc(self)); +} +STATIC MP_DEFINE_CONST_FUN_OBJ_1(esp32_camera_camera_get_lenc_obj, esp32_camera_camera_get_lenc); + +STATIC mp_obj_t esp32_camera_camera_set_lenc(const mp_obj_t self_in, const mp_obj_t arg) { + esp32_camera_camera_obj_t *self = MP_OBJ_TO_PTR(self_in); + check_for_deinit(self); + common_hal_esp32_camera_camera_set_lenc(self, mp_obj_is_true(arg)); + return mp_const_none; +} +STATIC MP_DEFINE_CONST_FUN_OBJ_2(esp32_camera_camera_set_lenc_obj, esp32_camera_camera_set_lenc); +MP_PROPERTY_GETSET(esp32_camera_camera_lenc_obj, + (mp_obj_t)&esp32_camera_camera_get_lenc_obj, + (mp_obj_t)&esp32_camera_camera_set_lenc_obj); + +//| max_frame_size: FrameSize +//| """The maximum frame size that can be captured""" +STATIC mp_obj_t esp32_camera_camera_get_max_frame_size(const mp_obj_t self_in) { + esp32_camera_camera_obj_t *self = MP_OBJ_TO_PTR(self_in); + check_for_deinit(self); + return cp_enum_find(&esp32_camera_frame_size_type, common_hal_esp32_camera_camera_get_max_frame_size(self)); +} +STATIC MP_DEFINE_CONST_FUN_OBJ_1(esp32_camera_camera_get_max_frame_size_obj, esp32_camera_camera_get_max_frame_size); + +MP_PROPERTY_GETTER(esp32_camera_camera_max_frame_size_obj, + (mp_obj_t)&esp32_camera_camera_get_max_frame_size_obj); + + +//| address: int +//| """The I2C (SCCB) address of the sensor""" +STATIC mp_obj_t esp32_camera_camera_get_address(const mp_obj_t self_in) { + esp32_camera_camera_obj_t *self = MP_OBJ_TO_PTR(self_in); + check_for_deinit(self); + return MP_OBJ_NEW_SMALL_INT(common_hal_esp32_camera_camera_get_address(self)); +} +STATIC MP_DEFINE_CONST_FUN_OBJ_1(esp32_camera_camera_get_address_obj, esp32_camera_camera_get_address); + +MP_PROPERTY_GETTER(esp32_camera_camera_address_obj, + (mp_obj_t)&esp32_camera_camera_get_address_obj); + + +//| sensor_name: str +//| """The name of the sensor""" +STATIC mp_obj_t esp32_camera_camera_get_sensor_name(const mp_obj_t self_in) { + esp32_camera_camera_obj_t *self = MP_OBJ_TO_PTR(self_in); + check_for_deinit(self); + const char *sensor_name = common_hal_esp32_camera_camera_get_sensor_name(self); + return mp_obj_new_str(sensor_name, strlen(sensor_name)); +} +STATIC MP_DEFINE_CONST_FUN_OBJ_1(esp32_camera_camera_get_sensor_name_obj, esp32_camera_camera_get_sensor_name); + +MP_PROPERTY_GETTER(esp32_camera_camera_sensor_name_obj, + (mp_obj_t)&esp32_camera_camera_get_sensor_name_obj); + + +//| supports_jpeg: bool +//| """True if the sensor can capture images in JPEG format""" +STATIC mp_obj_t esp32_camera_camera_get_supports_jpeg(const mp_obj_t self_in) { + esp32_camera_camera_obj_t *self = MP_OBJ_TO_PTR(self_in); + check_for_deinit(self); + return mp_obj_new_bool(common_hal_esp32_camera_camera_get_supports_jpeg(self)); +} +STATIC MP_DEFINE_CONST_FUN_OBJ_1(esp32_camera_camera_get_supports_jpeg_obj, esp32_camera_camera_get_supports_jpeg); + +MP_PROPERTY_GETTER(esp32_camera_camera_supports_jpeg_obj, + (mp_obj_t)&esp32_camera_camera_get_supports_jpeg_obj); + +//| height: int +//| """The height of the image being captured""" +STATIC mp_obj_t esp32_camera_camera_get_height(const mp_obj_t self_in) { + esp32_camera_camera_obj_t *self = MP_OBJ_TO_PTR(self_in); + check_for_deinit(self); + return MP_OBJ_NEW_SMALL_INT(common_hal_esp32_camera_camera_get_height(self)); +} +STATIC MP_DEFINE_CONST_FUN_OBJ_1(esp32_camera_camera_get_height_obj, esp32_camera_camera_get_height); + +MP_PROPERTY_GETTER(esp32_camera_camera_height_obj, + (mp_obj_t)&esp32_camera_camera_get_height_obj); + +//| width: int +//| """The width of the image being captured""" +STATIC mp_obj_t esp32_camera_camera_get_width(const mp_obj_t self_in) { + esp32_camera_camera_obj_t *self = MP_OBJ_TO_PTR(self_in); + check_for_deinit(self); + return MP_OBJ_NEW_SMALL_INT(common_hal_esp32_camera_camera_get_width(self)); +} +STATIC MP_DEFINE_CONST_FUN_OBJ_1(esp32_camera_camera_get_width_obj, esp32_camera_camera_get_width); + +MP_PROPERTY_GETTER(esp32_camera_camera_width_obj, + (mp_obj_t)&esp32_camera_camera_get_width_obj); + +//| grab_mode: GrabMode +//| """The grab mode of the camera""" +STATIC mp_obj_t esp32_camera_camera_get_grab_mode(const mp_obj_t self_in) { + esp32_camera_camera_obj_t *self = MP_OBJ_TO_PTR(self_in); + check_for_deinit(self); + return cp_enum_find(&esp32_camera_grab_mode_type, common_hal_esp32_camera_camera_get_grab_mode(self)); +} +STATIC MP_DEFINE_CONST_FUN_OBJ_1(esp32_camera_camera_get_grab_mode_obj, esp32_camera_camera_get_grab_mode); + +MP_PROPERTY_GETTER(esp32_camera_camera_grab_mode_obj, + (mp_obj_t)&esp32_camera_camera_get_grab_mode_obj); + + +//| framebuffer_count: int +//| """True if double buffering is used""" +//| +STATIC mp_obj_t esp32_camera_camera_get_framebuffer_count(const mp_obj_t self_in) { + esp32_camera_camera_obj_t *self = MP_OBJ_TO_PTR(self_in); + check_for_deinit(self); + return MP_OBJ_NEW_SMALL_INT(common_hal_esp32_camera_camera_get_framebuffer_count(self)); +} +STATIC MP_DEFINE_CONST_FUN_OBJ_1(esp32_camera_camera_get_framebuffer_count_obj, esp32_camera_camera_get_framebuffer_count); + +MP_PROPERTY_GETTER(esp32_camera_camera_framebuffer_count_obj, + (mp_obj_t)&esp32_camera_camera_get_framebuffer_count_obj); + + +STATIC const mp_rom_map_elem_t esp32_camera_camera_locals_table[] = { + { MP_ROM_QSTR(MP_QSTR_address), MP_ROM_PTR(&esp32_camera_camera_address_obj) }, + { MP_ROM_QSTR(MP_QSTR_aec2), MP_ROM_PTR(&esp32_camera_camera_aec2_obj) }, + { MP_ROM_QSTR(MP_QSTR_aec_value), MP_ROM_PTR(&esp32_camera_camera_aec_value_obj) }, + { MP_ROM_QSTR(MP_QSTR_ae_level), MP_ROM_PTR(&esp32_camera_camera_ae_level_obj) }, + { MP_ROM_QSTR(MP_QSTR_agc_gain), MP_ROM_PTR(&esp32_camera_camera_agc_gain_obj) }, + { MP_ROM_QSTR(MP_QSTR_awb_gain), MP_ROM_PTR(&esp32_camera_camera_awb_gain_obj) }, + { MP_ROM_QSTR(MP_QSTR_bpc), MP_ROM_PTR(&esp32_camera_camera_bpc_obj) }, + { MP_ROM_QSTR(MP_QSTR_brightness), MP_ROM_PTR(&esp32_camera_camera_brightness_obj) }, + { MP_ROM_QSTR(MP_QSTR_colorbar), MP_ROM_PTR(&esp32_camera_camera_colorbar_obj) }, + { MP_ROM_QSTR(MP_QSTR_contrast), MP_ROM_PTR(&esp32_camera_camera_contrast_obj) }, + { MP_ROM_QSTR(MP_QSTR_dcw), MP_ROM_PTR(&esp32_camera_camera_dcw_obj) }, + { MP_ROM_QSTR(MP_QSTR_deinit), MP_ROM_PTR(&esp32_camera_camera_deinit_obj) }, + { MP_ROM_QSTR(MP_QSTR_denoise), MP_ROM_PTR(&esp32_camera_camera_denoise_obj) }, + { MP_ROM_QSTR(MP_QSTR_framebuffer_count), MP_ROM_PTR(&esp32_camera_camera_framebuffer_count_obj) }, + { MP_ROM_QSTR(MP_QSTR___enter__), MP_ROM_PTR(&mp_identity_obj) }, + { MP_ROM_QSTR(MP_QSTR___exit__), MP_ROM_PTR(&esp32_camera_camera___exit___obj) }, + { MP_ROM_QSTR(MP_QSTR_exposure_ctrl), MP_ROM_PTR(&esp32_camera_camera_exposure_ctrl_obj) }, + { MP_ROM_QSTR(MP_QSTR_frame_available), MP_ROM_PTR(&esp32_camera_camera_frame_available_obj) }, + { MP_ROM_QSTR(MP_QSTR_frame_size), MP_ROM_PTR(&esp32_camera_camera_frame_size_obj) }, + { MP_ROM_QSTR(MP_QSTR_gain_ceiling), MP_ROM_PTR(&esp32_camera_camera_gain_ceiling_obj) }, + { MP_ROM_QSTR(MP_QSTR_gain_ctrl), MP_ROM_PTR(&esp32_camera_camera_gain_ctrl_obj) }, + { MP_ROM_QSTR(MP_QSTR_grab_mode), MP_ROM_PTR(&esp32_camera_camera_grab_mode_obj) }, + { MP_ROM_QSTR(MP_QSTR_height), MP_ROM_PTR(&esp32_camera_camera_height_obj) }, + { MP_ROM_QSTR(MP_QSTR_hmirror), MP_ROM_PTR(&esp32_camera_camera_hmirror_obj) }, + { MP_ROM_QSTR(MP_QSTR_lenc), MP_ROM_PTR(&esp32_camera_camera_lenc_obj) }, + { MP_ROM_QSTR(MP_QSTR_max_frame_size), MP_ROM_PTR(&esp32_camera_camera_max_frame_size_obj) }, + { MP_ROM_QSTR(MP_QSTR_pixel_format), MP_ROM_PTR(&esp32_camera_camera_pixel_format_obj) }, + { MP_ROM_QSTR(MP_QSTR_quality), MP_ROM_PTR(&esp32_camera_camera_quality_obj) }, + { MP_ROM_QSTR(MP_QSTR_raw_gma), MP_ROM_PTR(&esp32_camera_camera_raw_gma_obj) }, + { MP_ROM_QSTR(MP_QSTR_reconfigure), MP_ROM_PTR(&esp32_camera_camera_reconfigure_obj) }, + { MP_ROM_QSTR(MP_QSTR_saturation), MP_ROM_PTR(&esp32_camera_camera_saturation_obj) }, + { MP_ROM_QSTR(MP_QSTR_sensor_name), MP_ROM_PTR(&esp32_camera_camera_sensor_name_obj) }, + { MP_ROM_QSTR(MP_QSTR_sharpness), MP_ROM_PTR(&esp32_camera_camera_sharpness_obj) }, + { MP_ROM_QSTR(MP_QSTR_special_effect), MP_ROM_PTR(&esp32_camera_camera_special_effect_obj) }, + { MP_ROM_QSTR(MP_QSTR_supports_jpeg), MP_ROM_PTR(&esp32_camera_camera_supports_jpeg_obj) }, + { MP_ROM_QSTR(MP_QSTR_take), MP_ROM_PTR(&esp32_camera_camera_take_obj) }, + { MP_ROM_QSTR(MP_QSTR_vflip), MP_ROM_PTR(&esp32_camera_camera_vflip_obj) }, + { MP_ROM_QSTR(MP_QSTR_wb_mode), MP_ROM_PTR(&esp32_camera_camera_wb_mode_obj) }, + { MP_ROM_QSTR(MP_QSTR_whitebal), MP_ROM_PTR(&esp32_camera_camera_whitebal_obj) }, + { MP_ROM_QSTR(MP_QSTR_width), MP_ROM_PTR(&esp32_camera_camera_width_obj) }, + { MP_ROM_QSTR(MP_QSTR_wpc), MP_ROM_PTR(&esp32_camera_camera_wpc_obj) }, +}; + +STATIC MP_DEFINE_CONST_DICT(esp32_camera_camera_locals_dict, esp32_camera_camera_locals_table); + +const mp_obj_type_t esp32_camera_camera_type = { + .base = { &mp_type_type }, + .name = MP_QSTR_Camera, + .make_new = esp32_camera_camera_make_new, + .locals_dict = (mp_obj_t)&esp32_camera_camera_locals_dict, +}; diff --git a/ports/espressif/bindings/esp32_camera/Camera.h b/ports/espressif/bindings/esp32_camera/Camera.h new file mode 100644 index 0000000000..f190808531 --- /dev/null +++ b/ports/espressif/bindings/esp32_camera/Camera.h @@ -0,0 +1,116 @@ +/* + * This file is part of the Micro Python project, http://micropython.org/ + * + * The MIT License (MIT) + * + * Copyright (c) 2022 Jeff Epler for Adafruit Industries + * + * Permission is hereby granted, free of charge, to any person obtaining a copy + * of this software and associated documentation files (the "Software"), to deal + * in the Software without restriction, including without limitation the rights + * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell + * copies of the Software, and to permit persons to whom the Software is + * furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice shall be included in + * all copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE + * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER + * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, + * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN + * THE SOFTWARE. + */ + +#pragma once + +#include "py/enum.h" +#include "py/obj.h" + +#include "esp_camera.h" + +#include "shared-bindings/busio/I2C.h" + +extern const mp_obj_type_t esp32_camera_camera_type; +typedef struct esp32_camera_camera_obj esp32_camera_camera_obj_t; + +extern void common_hal_esp32_camera_camera_construct( + esp32_camera_camera_obj_t *self, + uint8_t data_pins[8], + const mcu_pin_obj_t *external_clock_pin, + const mcu_pin_obj_t *pixel_clock_pin, + const mcu_pin_obj_t *vsync_pin, + const mcu_pin_obj_t *href_pin, + const mcu_pin_obj_t *powerdown_pin, + const mcu_pin_obj_t *reset_pin, + busio_i2c_obj_t *i2c, + mp_int_t external_clock_frequency, + pixformat_t pixel_format, + framesize_t frame_size, + mp_int_t jpeg_quality, + mp_int_t framebuffer_count, + camera_grab_mode_t grab_mode); + +extern void common_hal_esp32_camera_camera_deinit(esp32_camera_camera_obj_t *self); +extern bool common_hal_esp32_camera_camera_deinited(esp32_camera_camera_obj_t *self); +extern bool common_hal_esp32_camera_camera_available(esp32_camera_camera_obj_t *self); +extern camera_fb_t *common_hal_esp32_camera_camera_take(esp32_camera_camera_obj_t *self, int timeout_ms); +extern void common_hal_esp32_camera_camera_reconfigure(esp32_camera_camera_obj_t *self, framesize_t frame_size, pixformat_t pixel_format, camera_grab_mode_t grab_mode, mp_int_t framebuffer_count); + +#define DECLARE_SENSOR_GETSET(type, name, field_name, setter_function_name) \ + DECLARE_SENSOR_GET(type, name, field_name, setter_function_name) \ + DECLARE_SENSOR_SET(type, name, setter_function_name) + +#define DECLARE_SENSOR_STATUS_GETSET(type, name, status_field_name, setter_function_name) \ + DECLARE_SENSOR_GETSET(type, name, status.status_field_name, setter_function_name) + +#define DECLARE_SENSOR_STATUS_GET(type, name, status_field_name, setter_function_name) \ + DECLARE_SENSOR_GET(type, name, status.status_field_name, setter_function_name) + +#define DECLARE_SENSOR_GET(type, name, status_field_name, setter_function_name) \ + extern type common_hal_esp32_camera_camera_get_##name(esp32_camera_camera_obj_t * self); + +#define DECLARE_SENSOR_SET(type, name, setter_function_name) \ + extern void common_hal_esp32_camera_camera_set_##name(esp32_camera_camera_obj_t * self, type value); + +DECLARE_SENSOR_GET(pixformat_t, pixel_format, pixformat, set_pixformat) +DECLARE_SENSOR_STATUS_GET(framesize_t, frame_size, framesize, set_framesize) +DECLARE_SENSOR_STATUS_GETSET(int, contrast, contrast, set_contrast); +DECLARE_SENSOR_STATUS_GETSET(int, brightness, brightness, set_brightness); +DECLARE_SENSOR_STATUS_GETSET(int, saturation, saturation, set_saturation); +DECLARE_SENSOR_STATUS_GETSET(int, sharpness, sharpness, set_sharpness); +DECLARE_SENSOR_STATUS_GETSET(int, denoise, denoise, set_denoise); +DECLARE_SENSOR_STATUS_GETSET(gainceiling_t, gainceiling, gainceiling, set_gainceiling); +DECLARE_SENSOR_STATUS_GETSET(int, quality, quality, set_quality); +DECLARE_SENSOR_STATUS_GETSET(bool, colorbar, colorbar, set_colorbar); +DECLARE_SENSOR_STATUS_GETSET(bool, whitebal, whitebal, set_whitebal); +DECLARE_SENSOR_STATUS_GETSET(bool, gain_ctrl, gain_ctrl, set_gain_ctrl); +DECLARE_SENSOR_STATUS_GETSET(bool, exposure_ctrl, exposure_ctrl, set_exposure_ctrl); +DECLARE_SENSOR_STATUS_GETSET(bool, hmirror, hmirror, set_hmirror); +DECLARE_SENSOR_STATUS_GETSET(bool, vflip, vflip, set_vflip); +DECLARE_SENSOR_STATUS_GETSET(bool, aec2, aec2, set_aec2); +DECLARE_SENSOR_STATUS_GETSET(bool, awb_gain, awb_gain, set_awb_gain); +DECLARE_SENSOR_STATUS_GETSET(int, agc_gain, agc_gain, set_agc_gain); +DECLARE_SENSOR_STATUS_GETSET(int, aec_value, aec_value, set_aec_value); +DECLARE_SENSOR_STATUS_GETSET(int, special_effect, special_effect, set_special_effect); +DECLARE_SENSOR_STATUS_GETSET(int, wb_mode, wb_mode, set_wb_mode); +DECLARE_SENSOR_STATUS_GETSET(int, ae_level, ae_level, set_ae_level); +DECLARE_SENSOR_STATUS_GETSET(bool, dcw, dcw, set_dcw); +DECLARE_SENSOR_STATUS_GETSET(bool, bpc, bpc, set_bpc); +DECLARE_SENSOR_STATUS_GETSET(bool, wpc, wpc, set_wpc); +DECLARE_SENSOR_STATUS_GETSET(bool, raw_gma, raw_gma, set_raw_gma); +DECLARE_SENSOR_STATUS_GETSET(bool, lenc, lenc, set_lenc); + +// From settings +extern camera_grab_mode_t common_hal_esp32_camera_camera_get_grab_mode(esp32_camera_camera_obj_t *self); +extern int common_hal_esp32_camera_camera_get_framebuffer_count(esp32_camera_camera_obj_t *self); + +// From camera_sensor_info_t +extern int common_hal_esp32_camera_camera_get_address(esp32_camera_camera_obj_t *self); +extern const char *common_hal_esp32_camera_camera_get_sensor_name(esp32_camera_camera_obj_t *self); +extern const bool common_hal_esp32_camera_camera_get_supports_jpeg(esp32_camera_camera_obj_t *self); +extern framesize_t common_hal_esp32_camera_camera_get_max_frame_size(esp32_camera_camera_obj_t *self); +extern int common_hal_esp32_camera_camera_get_width(esp32_camera_camera_obj_t *self); +extern int common_hal_esp32_camera_camera_get_height(esp32_camera_camera_obj_t *self); diff --git a/ports/espressif/bindings/esp32_camera/__init__.c b/ports/espressif/bindings/esp32_camera/__init__.c new file mode 100644 index 0000000000..f1ee4b6891 --- /dev/null +++ b/ports/espressif/bindings/esp32_camera/__init__.c @@ -0,0 +1,287 @@ +/* + * This file is part of the MicroPython project, http://micropython.org/ + * + * The MIT License (MIT) + * + * Copyright (c) 2022 Jeff Epler for Adafruit Industries + * + * Permission is hereby granted, free of charge, to any person obtaining a copy + * of this software and associated documentation files (the "Software"), to deal + * in the Software without restriction, including without limitation the rights + * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell + * copies of the Software, and to permit persons to whom the Software is + * furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice shall be included in + * all copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE + * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER + * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, + * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN + * THE SOFTWARE. + */ + +#include "py/obj.h" +#include "py/runtime.h" +#include "py/mphal.h" + +#include "bindings/espidf/__init__.h" +#include "bindings/esp32_camera/__init__.h" +#include "bindings/esp32_camera/Camera.h" + +#include "esp_camera.h" +#include "sensor.h" + +//| """Wrapper for the esp32_camera library +//| +//| This library enables access to any camera sensor supported by the library, +//| including OV5640 and OV2640. +//| +//| .. seealso:: +//| +//| Non-Espressif microcontrollers use the `imagecapture` module together with wrapper libraries such as `adafruit_ov5640 `_. +//| +//| """ + +//| class GrabMode: +//| """Controls when a new frame is grabbed.""" +//| +//| WHEN_EMPTY: GrabMode +//| """Fills buffers when they are empty. Less resources but first ``fb_count`` frames might be old""" +//| +//| LATEST: GrabMode +//| """Except when 1 frame buffer is used, queue will always contain the last ``fb_count`` frames""" +//| + +MAKE_ENUM_VALUE(esp32_camera_grab_mode_type, grab_mode, WHEN_EMPTY, CAMERA_GRAB_WHEN_EMPTY); +MAKE_ENUM_VALUE(esp32_camera_grab_mode_type, grab_mode, LATEST, CAMERA_GRAB_LATEST); + +MAKE_ENUM_MAP(esp32_camera_grab_mode) { + MAKE_ENUM_MAP_ENTRY(grab_mode, WHEN_EMPTY), + MAKE_ENUM_MAP_ENTRY(grab_mode, LATEST), +}; + +STATIC MP_DEFINE_CONST_DICT(esp32_camera_grab_mode_locals_dict, esp32_camera_grab_mode_locals_table); +MAKE_PRINTER(esp32_camera, esp32_camera_grab_mode); +MAKE_ENUM_TYPE(esp32_camera, GrabMode, esp32_camera_grab_mode); + +camera_grab_mode_t validate_grab_mode(mp_obj_t obj, qstr arg_name) { + return cp_enum_value(&esp32_camera_grab_mode_type, mp_arg_validate_type(obj, &esp32_camera_grab_mode_type, arg_name)); +} + +//| class PixelFormat: +//| """Format of data in the captured frames""" +//| +//| RGB565: PixelFormat +//| """A 16-bit format with 5 bits of Red and Blue and 6 bits of Green""" +//| +//| GRAYSCALE: PixelFormat +//| """An 8-bit format with 8-bits of luminance""" +//| +//| JPEG: PixelFormat +//| """A compressed format""" +//| + +MAKE_ENUM_VALUE(esp32_camera_pixel_format_type, pixel_format, RGB565, PIXFORMAT_RGB565); +MAKE_ENUM_VALUE(esp32_camera_pixel_format_type, pixel_format, GRAYSCALE, PIXFORMAT_GRAYSCALE); +MAKE_ENUM_VALUE(esp32_camera_pixel_format_type, pixel_format, JPEG, PIXFORMAT_JPEG); + +MAKE_ENUM_MAP(esp32_camera_pixel_format) { + MAKE_ENUM_MAP_ENTRY(pixel_format, RGB565), + MAKE_ENUM_MAP_ENTRY(pixel_format, GRAYSCALE), + MAKE_ENUM_MAP_ENTRY(pixel_format, JPEG), +}; + +STATIC MP_DEFINE_CONST_DICT(esp32_camera_pixel_format_locals_dict, esp32_camera_pixel_format_locals_table); +MAKE_PRINTER(esp32_camera, esp32_camera_pixel_format); +MAKE_ENUM_TYPE(esp32_camera, PixelFormat, esp32_camera_pixel_format); + +pixformat_t validate_pixel_format(mp_obj_t obj, qstr arg_name) { + return cp_enum_value(&esp32_camera_pixel_format_type, mp_arg_validate_type(obj, &esp32_camera_pixel_format_type, arg_name)); +} + +//| class FrameSize: +//| """The pixel size of the captured frames""" +//| +//| R96X96: FrameSize +//| """96x96""" +//| +//| QQVGA: FrameSize +//| """160x120""" +//| +//| QCIF: FrameSize +//| """176x144""" +//| +//| HQVGA: FrameSize +//| """240x176""" +//| +//| R240X240: FrameSize +//| """240x240""" +//| +//| QVGA: FrameSize +//| """320x240 """ +//| +//| CIF: FrameSize +//| """400x296""" +//| +//| HVGA: FrameSize +//| """480x320""" +//| +//| VGA: FrameSize +//| """640x480""" +//| +//| SVGA: FrameSize +//| """800x600""" +//| +//| XGA: FrameSize +//| """1024x768""" +//| +//| HD: FrameSize +//| """1280x720""" +//| +//| SXGA: FrameSize +//| """1280x1024""" +//| +//| UXGA: FrameSize +//| """1600x1200""" +//| +//| FHD: FrameSize +//| """1920x1080""" +//| +//| P_HD: FrameSize +//| """ 720x1280""" +//| +//| P_3MP: FrameSize +//| """ 864x1536""" +//| +//| QXGA: FrameSize +//| """2048x1536""" +//| +//| QHD: FrameSize +//| """2560x1440""" +//| +//| WQXGA: FrameSize +//| """2560x1600""" +//| +//| P_FHD: FrameSize +//| """1080x1920""" +//| +//| QSXGA: FrameSize +//| """2560x1920""" +//| + +MAKE_ENUM_VALUE(esp32_camera_frame_size_type, frame_size, R96X96, FRAMESIZE_96X96); +MAKE_ENUM_VALUE(esp32_camera_frame_size_type, frame_size, R240X240, FRAMESIZE_240X240); +MAKE_ENUM_VALUE(esp32_camera_frame_size_type, frame_size, QQVGA, FRAMESIZE_QQVGA); +MAKE_ENUM_VALUE(esp32_camera_frame_size_type, frame_size, QCIF, FRAMESIZE_QCIF); +MAKE_ENUM_VALUE(esp32_camera_frame_size_type, frame_size, HQVGA, FRAMESIZE_HQVGA); +MAKE_ENUM_VALUE(esp32_camera_frame_size_type, frame_size, QVGA, FRAMESIZE_QVGA); +MAKE_ENUM_VALUE(esp32_camera_frame_size_type, frame_size, CIF, FRAMESIZE_CIF); +MAKE_ENUM_VALUE(esp32_camera_frame_size_type, frame_size, HVGA, FRAMESIZE_HVGA); +MAKE_ENUM_VALUE(esp32_camera_frame_size_type, frame_size, VGA, FRAMESIZE_VGA); +MAKE_ENUM_VALUE(esp32_camera_frame_size_type, frame_size, SVGA, FRAMESIZE_SVGA); +MAKE_ENUM_VALUE(esp32_camera_frame_size_type, frame_size, XGA, FRAMESIZE_XGA); +MAKE_ENUM_VALUE(esp32_camera_frame_size_type, frame_size, HD, FRAMESIZE_HD); +MAKE_ENUM_VALUE(esp32_camera_frame_size_type, frame_size, SXGA, FRAMESIZE_SXGA); +MAKE_ENUM_VALUE(esp32_camera_frame_size_type, frame_size, UXGA, FRAMESIZE_UXGA); +MAKE_ENUM_VALUE(esp32_camera_frame_size_type, frame_size, FHD, FRAMESIZE_FHD); +MAKE_ENUM_VALUE(esp32_camera_frame_size_type, frame_size, P_HD, FRAMESIZE_P_HD); +MAKE_ENUM_VALUE(esp32_camera_frame_size_type, frame_size, P_3MP, FRAMESIZE_P_3MP); +MAKE_ENUM_VALUE(esp32_camera_frame_size_type, frame_size, QXGA, FRAMESIZE_QXGA); +MAKE_ENUM_VALUE(esp32_camera_frame_size_type, frame_size, QHD, FRAMESIZE_QHD); +MAKE_ENUM_VALUE(esp32_camera_frame_size_type, frame_size, WQXGA, FRAMESIZE_WQXGA); +MAKE_ENUM_VALUE(esp32_camera_frame_size_type, frame_size, P_FHD, FRAMESIZE_P_FHD); +MAKE_ENUM_VALUE(esp32_camera_frame_size_type, frame_size, QSXGA, FRAMESIZE_QSXGA); +MAKE_ENUM_MAP(esp32_camera_frame_size) { + MAKE_ENUM_MAP_ENTRY(frame_size, R96X96), + MAKE_ENUM_MAP_ENTRY(frame_size, R240X240), + MAKE_ENUM_MAP_ENTRY(frame_size, QQVGA), + MAKE_ENUM_MAP_ENTRY(frame_size, QCIF), + MAKE_ENUM_MAP_ENTRY(frame_size, HQVGA), + MAKE_ENUM_MAP_ENTRY(frame_size, QVGA), + MAKE_ENUM_MAP_ENTRY(frame_size, CIF), + MAKE_ENUM_MAP_ENTRY(frame_size, HVGA), + MAKE_ENUM_MAP_ENTRY(frame_size, VGA), + MAKE_ENUM_MAP_ENTRY(frame_size, SVGA), + MAKE_ENUM_MAP_ENTRY(frame_size, XGA), + MAKE_ENUM_MAP_ENTRY(frame_size, HD), + MAKE_ENUM_MAP_ENTRY(frame_size, SXGA), + MAKE_ENUM_MAP_ENTRY(frame_size, UXGA), + MAKE_ENUM_MAP_ENTRY(frame_size, FHD), + MAKE_ENUM_MAP_ENTRY(frame_size, P_HD), + MAKE_ENUM_MAP_ENTRY(frame_size, P_3MP), + MAKE_ENUM_MAP_ENTRY(frame_size, QXGA), + MAKE_ENUM_MAP_ENTRY(frame_size, QHD), + MAKE_ENUM_MAP_ENTRY(frame_size, WQXGA), + MAKE_ENUM_MAP_ENTRY(frame_size, P_FHD), + MAKE_ENUM_MAP_ENTRY(frame_size, QSXGA), +}; + +STATIC MP_DEFINE_CONST_DICT(esp32_camera_frame_size_locals_dict, esp32_camera_frame_size_locals_table); +MAKE_PRINTER(esp32_camera, esp32_camera_frame_size); +MAKE_ENUM_TYPE(esp32_camera, FrameSize, esp32_camera_frame_size); + +framesize_t validate_frame_size(mp_obj_t obj, qstr arg_name) { + return cp_enum_value(&esp32_camera_frame_size_type, mp_arg_validate_type(obj, &esp32_camera_frame_size_type, arg_name)); +} + +//| class GainCeiling: +//| """The maximum amount of gain applied to raw sensor data. +//| +//| Higher values are useful in darker conditions, but increase image noise.""" +//| +//| GAIN_2X: GainCeiling +//| GAIN_4X: GainCeiling +//| GAIN_8X: GainCeiling +//| GAIN_16X: GainCeiling +//| GAIN_32X: GainCeiling +//| GAIN_64X: GainCeiling +//| GAIN_128X: GainCeiling +//| + +MAKE_ENUM_VALUE(esp32_camera_gain_ceiling_type, gain_ceiling, GAIN_2X, GAINCEILING_2X); +MAKE_ENUM_VALUE(esp32_camera_gain_ceiling_type, gain_ceiling, GAIN_4X, GAINCEILING_4X); +MAKE_ENUM_VALUE(esp32_camera_gain_ceiling_type, gain_ceiling, GAIN_8X, GAINCEILING_8X); +MAKE_ENUM_VALUE(esp32_camera_gain_ceiling_type, gain_ceiling, GAIN_16X, GAINCEILING_16X); +MAKE_ENUM_VALUE(esp32_camera_gain_ceiling_type, gain_ceiling, GAIN_32X, GAINCEILING_32X); +MAKE_ENUM_VALUE(esp32_camera_gain_ceiling_type, gain_ceiling, GAIN_64X, GAINCEILING_64X); +MAKE_ENUM_VALUE(esp32_camera_gain_ceiling_type, gain_ceiling, GAIN_128X, GAINCEILING_128X); + +MAKE_ENUM_MAP(esp32_camera_gain_ceiling) { + MAKE_ENUM_MAP_ENTRY(gain_ceiling, GAIN_2X), + MAKE_ENUM_MAP_ENTRY(gain_ceiling, GAIN_4X), + MAKE_ENUM_MAP_ENTRY(gain_ceiling, GAIN_8X), + MAKE_ENUM_MAP_ENTRY(gain_ceiling, GAIN_16X), + MAKE_ENUM_MAP_ENTRY(gain_ceiling, GAIN_32X), + MAKE_ENUM_MAP_ENTRY(gain_ceiling, GAIN_64X), + MAKE_ENUM_MAP_ENTRY(gain_ceiling, GAIN_128X) +}; + +STATIC MP_DEFINE_CONST_DICT(esp32_camera_gain_ceiling_locals_dict, esp32_camera_gain_ceiling_locals_table); +MAKE_PRINTER(esp32_camera, esp32_camera_gain_ceiling); +MAKE_ENUM_TYPE(esp32_camera, GainCeiling, esp32_camera_gain_ceiling); + +gainceiling_t validate_gain_ceiling(mp_obj_t obj, qstr arg_name) { + return cp_enum_value(&esp32_camera_gain_ceiling_type, mp_arg_validate_type(obj, &esp32_camera_gain_ceiling_type, arg_name)); +} + +STATIC const mp_rom_map_elem_t esp32_camera_module_globals_table[] = { + { MP_ROM_QSTR(MP_QSTR___name__), MP_ROM_QSTR(MP_QSTR_esp32_camera) }, + { MP_ROM_QSTR(MP_QSTR_Camera), MP_ROM_PTR(&esp32_camera_camera_type), }, + { MP_ROM_QSTR(MP_QSTR_FrameSize), &esp32_camera_frame_size_type }, + { MP_ROM_QSTR(MP_QSTR_GainCeiling), &esp32_camera_gain_ceiling_type }, + { MP_ROM_QSTR(MP_QSTR_GrabMode), &esp32_camera_grab_mode_type }, + { MP_ROM_QSTR(MP_QSTR_PixelFormat), &esp32_camera_pixel_format_type }, +}; + +STATIC MP_DEFINE_CONST_DICT(esp32_camera_module_globals, esp32_camera_module_globals_table); + +const mp_obj_module_t esp32_camera_module = { + .base = { &mp_type_module }, + .globals = (mp_obj_dict_t *)&esp32_camera_module_globals, +}; + +MP_REGISTER_MODULE(MP_QSTR_esp32_camera, esp32_camera_module, CIRCUITPY_ESP32_CAMERA); diff --git a/ports/espressif/modules/wrover.c b/ports/espressif/bindings/esp32_camera/__init__.h similarity index 59% rename from ports/espressif/modules/wrover.c rename to ports/espressif/bindings/esp32_camera/__init__.h index 23fa7ee5ca..a0e7290ff9 100644 --- a/ports/espressif/modules/wrover.c +++ b/ports/espressif/bindings/esp32_camera/__init__.h @@ -3,7 +3,7 @@ * * The MIT License (MIT) * - * Copyright (c) 2020 Scott Shawcroft for Adafruit Industries + * Copyright (c) 2022 Jeff Epler for Adafruit Industries * * Permission is hereby granted, free of charge, to any person obtaining a copy * of this software and associated documentation files (the "Software"), to deal @@ -24,15 +24,22 @@ * THE SOFTWARE. */ -#include "modules/module.h" +#pragma once -void never_reset_module_internal_pins(void) { - // SPI Flash and RAM - common_hal_never_reset_pin(&pin_GPIO26); - common_hal_never_reset_pin(&pin_GPIO27); - common_hal_never_reset_pin(&pin_GPIO28); - common_hal_never_reset_pin(&pin_GPIO29); - common_hal_never_reset_pin(&pin_GPIO30); - common_hal_never_reset_pin(&pin_GPIO31); - common_hal_never_reset_pin(&pin_GPIO32); -} +#include "py/enum.h" +#include "py/obj.h" + +#include "esp_camera.h" + +extern const mp_obj_type_t esp32_camera_grab_mode_type; +extern const cp_enum_obj_t grab_mode_WHEN_EMPTY_obj; +extern const mp_obj_type_t esp32_camera_pixel_format_type; +extern const cp_enum_obj_t pixel_format_RGB565_obj; +extern const mp_obj_type_t esp32_camera_frame_size_type; +extern const cp_enum_obj_t frame_size_QQVGA_obj; +extern const mp_obj_type_t esp32_camera_gain_ceiling_type; + +extern camera_grab_mode_t validate_grab_mode(mp_obj_t obj, qstr arg_name); +extern pixformat_t validate_pixel_format(mp_obj_t obj, qstr arg_name); +extern framesize_t validate_frame_size(mp_obj_t obj, qstr arg_name); +extern gainceiling_t validate_gain_ceiling(mp_obj_t obj, qstr arg_name); diff --git a/ports/espressif/bindings/espidf/__init__.c b/ports/espressif/bindings/espidf/__init__.c index 4f7da39540..c42a9e549d 100644 --- a/ports/espressif/bindings/espidf/__init__.c +++ b/ports/espressif/bindings/espidf/__init__.c @@ -73,6 +73,7 @@ MP_DEFINE_CONST_FUN_OBJ_0(espidf_heap_caps_get_largest_free_block_obj, espidf_he //| //| This is necessary when upgrading from CircuitPython 6.3.0 or earlier to CircuitPython 7.0.0, because the //| layout of data in nvs has changed. The old data will be lost when you perform this operation.""" +//| STATIC mp_obj_t espidf_erase_nvs(void) { ESP_ERROR_CHECK(nvs_flash_deinit()); ESP_ERROR_CHECK(nvs_flash_erase()); @@ -103,8 +104,10 @@ const mp_obj_type_t mp_type_espidf_IDFError = { //| import builtins +//| //| class MemoryError(builtins.MemoryError): //| """Raised when an ESP IDF memory allocation fails.""" +//| //| ... //| NORETURN void mp_raise_espidf_MemoryError(void) { @@ -120,6 +123,22 @@ const mp_obj_type_t mp_type_espidf_MemoryError = { .parent = &mp_type_MemoryError, }; +//| def get_total_psram() -> int: +//| """Returns the number of bytes of psram detected, or 0 if psram is not present or not configured""" +//| +STATIC mp_obj_t espidf_get_total_psram(void) { + return MP_OBJ_NEW_SMALL_INT(common_hal_espidf_get_total_psram()); +} +MP_DEFINE_CONST_FUN_OBJ_0(espidf_get_total_psram_obj, espidf_get_total_psram); + +//| def get_reserved_psram() -> int: +//| """Returns number of bytes of psram reserved for use by esp-idf, either a board-specific default value or the value defined in ``/.env``.""" +//| +STATIC mp_obj_t espidf_get_reserved_psram(void) { + return MP_OBJ_NEW_SMALL_INT(common_hal_espidf_get_reserved_psram()); +} +MP_DEFINE_CONST_FUN_OBJ_0(espidf_get_reserved_psram_obj, espidf_get_reserved_psram); + STATIC const mp_rom_map_elem_t espidf_module_globals_table[] = { { MP_ROM_QSTR(MP_QSTR___name__), MP_ROM_QSTR(MP_QSTR_espidf) }, @@ -129,6 +148,8 @@ STATIC const mp_rom_map_elem_t espidf_module_globals_table[] = { { MP_ROM_QSTR(MP_QSTR_erase_nvs), MP_ROM_PTR(&espidf_erase_nvs_obj)}, + { MP_ROM_QSTR(MP_QSTR_get_total_psram), MP_ROM_PTR(&espidf_get_total_psram_obj)}, + { MP_ROM_QSTR(MP_QSTR_get_reserved_psram), MP_ROM_PTR(&espidf_get_reserved_psram_obj)}, { MP_ROM_QSTR(MP_QSTR_IDFError), MP_ROM_PTR(&mp_type_espidf_IDFError) }, { MP_ROM_QSTR(MP_QSTR_MemoryError), MP_ROM_PTR(&mp_type_espidf_MemoryError) }, }; @@ -139,66 +160,3 @@ const mp_obj_module_t espidf_module = { .base = { &mp_type_module }, .globals = (mp_obj_dict_t *)&espidf_module_globals, }; - -void raise_esp_error(esp_err_t err) { - const compressed_string_t *msg = NULL; - const mp_obj_type_t *exception_type = &mp_type_espidf_IDFError; - switch (err) { - case ESP_FAIL: - msg = translate("Generic Failure"); - break; - case ESP_ERR_NO_MEM: - exception_type = &mp_type_espidf_MemoryError; - msg = translate("Out of memory"); - break; - case ESP_ERR_INVALID_ARG: - msg = translate("Invalid argument"); - break; - case ESP_ERR_INVALID_STATE: - msg = translate("Invalid state"); - break; - case ESP_ERR_INVALID_SIZE: - msg = translate("Invalid size"); - break; - case ESP_ERR_NOT_FOUND: - msg = translate("Requested resource not found"); - break; - case ESP_ERR_NOT_SUPPORTED: - msg = translate("Operation or feature not supported"); - break; - case ESP_ERR_TIMEOUT: - msg = translate("Operation timed out"); - break; - case ESP_ERR_INVALID_RESPONSE: - msg = translate("Received response was invalid"); - break; - case ESP_ERR_INVALID_CRC: - msg = translate("CRC or checksum was invalid"); - break; - case ESP_ERR_INVALID_VERSION: - msg = translate("Version was invalid"); - break; - case ESP_ERR_INVALID_MAC: - msg = translate("MAC address was invalid"); - break; - } - if (msg) { - mp_raise_msg(exception_type, msg); - } - - const char *group = "ESP-IDF"; - - // tests must be in descending order - MP_STATIC_ASSERT(ESP_ERR_FLASH_BASE > ESP_ERR_MESH_BASE); - MP_STATIC_ASSERT(ESP_ERR_MESH_BASE > ESP_ERR_WIFI_BASE); - if (err >= ESP_ERR_FLASH_BASE) { - group = "Flash"; - } else if (err >= ESP_ERR_MESH_BASE) { - group = "Mesh"; - } else if (err >= ESP_ERR_WIFI_BASE) { - group = "WiFi"; - } - mp_raise_msg_varg(exception_type, translate("%s error 0x%x"), group, err); -} - -MP_REGISTER_MODULE(MP_QSTR_espidf, espidf_module, CIRCUITPY_ESPIDF); diff --git a/ports/espressif/bindings/espidf/__init__.h b/ports/espressif/bindings/espidf/__init__.h index 5891d2c5c0..e091a5c477 100644 --- a/ports/espressif/bindings/espidf/__init__.h +++ b/ports/espressif/bindings/espidf/__init__.h @@ -39,4 +39,11 @@ NORETURN void mp_raise_espidf_MemoryError(void); void raise_esp_error(esp_err_t err) NORETURN; #define CHECK_ESP_RESULT(x) do { int res = (x); if (res != ESP_OK) raise_esp_error(res); } while (0) +void common_hal_espidf_reserve_psram(void); +bool common_hal_espidf_set_reserved_psram(size_t amount); +size_t common_hal_espidf_get_reserved_psram(void); +size_t common_hal_espidf_get_total_psram(void); +intptr_t common_hal_espidf_get_psram_start(void); +intptr_t common_hal_espidf_get_psram_end(void); + #endif // MICROPY_INCLUDED_ESPRESSIF_BINDINGS_ESPIDF___INIT___H diff --git a/ports/espressif/boards/adafruit_esp32s2_camera/board.c b/ports/espressif/boards/adafruit_esp32s2_camera/board.c index 109e9b4b9a..280f2b14b8 100644 --- a/ports/espressif/boards/adafruit_esp32s2_camera/board.c +++ b/ports/espressif/boards/adafruit_esp32s2_camera/board.c @@ -56,16 +56,13 @@ void board_init(void) { bus->base.type = &displayio_fourwire_type; common_hal_displayio_fourwire_construct(bus, spi, - &pin_GPIO39, // TFT_DC Command or data - &pin_GPIO40, // TFT_CS Chip select - &pin_GPIO41, // TFT_RESET Reset + &pin_GPIO40, // TFT_DC Command or data + &pin_GPIO39, // TFT_CS Chip select + &pin_GPIO38, // TFT_RESET Reset 40000000, // Baudrate 0, // Polarity 0); // Phase - // workaround as board_init() is called before reset_port() in main.c - pwmout_reset(); - displayio_display_obj_t *display = &displays[0].display; display->base.type = &displayio_display_type; common_hal_displayio_display_construct( @@ -87,25 +84,20 @@ void board_init(void) { MIPI_COMMAND_WRITE_MEMORY_START, // Write memory command display_init_sequence, sizeof(display_init_sequence), - &pin_GPIO38, // backlight pin + &pin_GPIO41, // backlight pin NO_BRIGHTNESS_COMMAND, - 1.0f, // brightness (ignored) - true, // auto_brightness + 1.0f, // brightness false, // single_byte_bounds false, // data_as_commands true, // auto_refresh 60, // native_frames_per_second true, // backlight_on_high - false); // not SH1107 -} - -bool board_requests_safe_mode(void) { - return false; -} - -void reset_board(void) { + false, // not SH1107 + 50000); // backlight pwm frequency } void board_deinit(void) { common_hal_displayio_release_displays(); } + +// Use the MP_WEAK supervisor/shared/board.c versions of routines not defined here. diff --git a/ports/espressif/boards/adafruit_esp32s2_camera/mpconfigboard.h b/ports/espressif/boards/adafruit_esp32s2_camera/mpconfigboard.h index 793b675784..64ab1b966d 100644 --- a/ports/espressif/boards/adafruit_esp32s2_camera/mpconfigboard.h +++ b/ports/espressif/boards/adafruit_esp32s2_camera/mpconfigboard.h @@ -30,7 +30,9 @@ #define MICROPY_HW_MCU_NAME "ESP32S2" #define MICROPY_HW_NEOPIXEL (&pin_GPIO21) -#define MICROPY_HW_NEOPIXEL_COUNT (6) +#define MICROPY_HW_NEOPIXEL_COUNT (1) + +#define MICROPY_HW_LED_STATUS (&pin_GPIO1) #define DEFAULT_I2C_BUS_SDA (&pin_GPIO33) #define DEFAULT_I2C_BUS_SCL (&pin_GPIO34) diff --git a/ports/espressif/boards/adafruit_esp32s2_camera/mpconfigboard.mk b/ports/espressif/boards/adafruit_esp32s2_camera/mpconfigboard.mk index d99a431599..1823c1dd88 100644 --- a/ports/espressif/boards/adafruit_esp32s2_camera/mpconfigboard.mk +++ b/ports/espressif/boards/adafruit_esp32s2_camera/mpconfigboard.mk @@ -5,15 +5,6 @@ USB_MANUFACTURER = "Adafruit" IDF_TARGET = esp32s2 -INTERNAL_FLASH_FILESYSTEM = 1 -LONGINT_IMPL = MPZ - -# The default queue depth of 16 overflows on release builds, -# so increase it to 32. -CFLAGS += -DCFG_TUD_TASK_QUEUE_SZ=32 - -CIRCUITPY_ESP_FLASH_MODE=dio -CIRCUITPY_ESP_FLASH_FREQ=40m -CIRCUITPY_ESP_FLASH_SIZE=4MB - -CIRCUITPY_MODULE=wrover +CIRCUITPY_ESP_FLASH_MODE = dio +CIRCUITPY_ESP_FLASH_FREQ = 40m +CIRCUITPY_ESP_FLASH_SIZE = 4MB diff --git a/ports/espressif/boards/adafruit_esp32s2_camera/pins.c b/ports/espressif/boards/adafruit_esp32s2_camera/pins.c index 688a555b02..5de2d800aa 100644 --- a/ports/espressif/boards/adafruit_esp32s2_camera/pins.c +++ b/ports/espressif/boards/adafruit_esp32s2_camera/pins.c @@ -24,13 +24,12 @@ STATIC const mp_rom_map_elem_t board_module_globals_table[] = { { MP_ROM_QSTR(MP_QSTR_MOSI), MP_ROM_PTR(&pin_GPIO35) }, { MP_ROM_QSTR(MP_QSTR_SCK), MP_ROM_PTR(&pin_GPIO36) }, { MP_ROM_QSTR(MP_QSTR_MISO), MP_ROM_PTR(&pin_GPIO37) }, - { MP_ROM_QSTR(MP_QSTR_TFT_BACKLIGHT), MP_ROM_PTR(&pin_GPIO38) }, - { MP_ROM_QSTR(MP_QSTR_TFT_DC), MP_ROM_PTR(&pin_GPIO39) }, - { MP_ROM_QSTR(MP_QSTR_TFT_CS), MP_ROM_PTR(&pin_GPIO40) }, - { MP_ROM_QSTR(MP_QSTR_TFT_RESET), MP_ROM_PTR(&pin_GPIO41) }, + { MP_ROM_QSTR(MP_QSTR_TFT_BACKLIGHT), MP_ROM_PTR(&pin_GPIO41) }, + { MP_ROM_QSTR(MP_QSTR_TFT_DC), MP_ROM_PTR(&pin_GPIO40) }, + { MP_ROM_QSTR(MP_QSTR_TFT_CS), MP_ROM_PTR(&pin_GPIO39) }, + { MP_ROM_QSTR(MP_QSTR_TFT_RESET), MP_ROM_PTR(&pin_GPIO38) }, - { MP_ROM_QSTR(MP_QSTR_CARD_CS), MP_ROM_PTR(&pin_GPIO4) }, - { MP_ROM_QSTR(MP_QSTR_CARD_POWER), MP_ROM_PTR(&pin_GPIO1) }, + { MP_ROM_QSTR(MP_QSTR_CARD_CS), MP_ROM_PTR(&pin_GPIO2) }, { MP_ROM_QSTR(MP_QSTR_IRQ), MP_ROM_PTR(&pin_GPIO3) }, @@ -39,7 +38,7 @@ STATIC const mp_rom_map_elem_t board_module_globals_table[] = { { MP_ROM_QSTR(MP_QSTR_SPEAKER), MP_ROM_PTR(&pin_GPIO45) }, { MP_ROM_QSTR(MP_QSTR_BUTTON), MP_ROM_PTR(&pin_GPIO0) }, - { MP_ROM_QSTR(MP_QSTR_LED), MP_ROM_PTR(&pin_GPIO2) }, + { MP_ROM_QSTR(MP_QSTR_LED), MP_ROM_PTR(&pin_GPIO1) }, { MP_ROM_QSTR(MP_QSTR_A0), MP_ROM_PTR(&pin_GPIO17) }, { MP_ROM_QSTR(MP_QSTR_A1), MP_ROM_PTR(&pin_GPIO18) }, diff --git a/ports/espressif/boards/adafruit_feather_esp32_v2/board.c b/ports/espressif/boards/adafruit_feather_esp32_v2/board.c new file mode 100644 index 0000000000..78341beb3b --- /dev/null +++ b/ports/espressif/boards/adafruit_feather_esp32_v2/board.c @@ -0,0 +1,45 @@ +/* + * This file is part of the MicroPython project, http://micropython.org/ + * + * The MIT License (MIT) + * + * Copyright (c) 2020 Scott Shawcroft for Adafruit Industries + * + * Permission is hereby granted, free of charge, to any person obtaining a copy + * of this software and associated documentation files (the "Software"), to deal + * in the Software without restriction, including without limitation the rights + * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell + * copies of the Software, and to permit persons to whom the Software is + * furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice shall be included in + * all copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE + * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER + * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, + * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN + * THE SOFTWARE. + */ + +#include "supervisor/board.h" +#include "mpconfigboard.h" +#include "shared-bindings/microcontroller/Pin.h" +#include "components/driver/include/driver/gpio.h" +#include "components/hal/include/hal/gpio_hal.h" +#include "common-hal/microcontroller/Pin.h" + +bool espressif_board_reset_pin_number(gpio_num_t pin_number) { + if (pin_number == 2) { + // Turn on NeoPixel and I2C power by default. + gpio_set_direction(pin_number, GPIO_MODE_DEF_OUTPUT); + gpio_set_level(pin_number, true); + return true; + } + + return false; +} + +// Use the MP_WEAK supervisor/shared/board.c versions of routines not defined here. diff --git a/ports/espressif/boards/adafruit_feather_esp32_v2/mpconfigboard.h b/ports/espressif/boards/adafruit_feather_esp32_v2/mpconfigboard.h new file mode 100644 index 0000000000..fc478ef005 --- /dev/null +++ b/ports/espressif/boards/adafruit_feather_esp32_v2/mpconfigboard.h @@ -0,0 +1,54 @@ +/* + * This file is part of the MicroPython project, http://micropython.org/ + * + * The MIT License (MIT) + * + * Copyright (c) 2022 Dan Halbert for Adafruit Industries + * + * Permission is hereby granted, free of charge, to any person obtaining a copy + * of this software and associated documentation files (the "Software"), to deal + * in the Software without restriction, including without limitation the rights + * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell + * copies of the Software, and to permit persons to whom the Software is + * furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice shall be included in + * all copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE + * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER + * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, + * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN + * THE SOFTWARE. + */ + +// Micropython setup + +#define MICROPY_HW_BOARD_NAME "Adafruit Feather ESP32 V2" +#define MICROPY_HW_MCU_NAME "ESP32" + +#define MICROPY_HW_NEOPIXEL (&pin_GPIO0) +#define CIRCUITPY_STATUS_LED_POWER (&pin_GPIO2) + +#define MICROPY_HW_LED_STATUS (&pin_GPIO13) + +#define CIRCUITPY_BOARD_I2C (1) +#define CIRCUITPY_BOARD_I2C_PIN {{.scl = &pin_GPIO20, .sda = &pin_GPIO22}} + +#define CIRCUITPY_BOARD_SPI (1) +#define CIRCUITPY_BOARD_SPI_PIN {{.clock = &pin_GPIO5, .mosi = &pin_GPIO19, .miso = &pin_GPIO21}} + +#define CIRCUITPY_BOARD_UART (1) +#define CIRCUITPY_BOARD_UART_PIN {{.tx = &pin_GPIO8, .rx = &pin_GPIO7}} + +// For entering safe mode, use SW38 button +#define CIRCUITPY_BOOT_BUTTON (&pin_GPIO38) + +// Explanation of how a user got into safe mode +#define BOARD_USER_SAFE_MODE_ACTION translate("pressing SW38 button at start up.\n") + +// UART pins attached to the USB-serial converter chip +#define CIRCUITPY_CONSOLE_UART_TX (&pin_GPIO1) +#define CIRCUITPY_CONSOLE_UART_RX (&pin_GPIO3) diff --git a/ports/espressif/boards/adafruit_feather_esp32_v2/mpconfigboard.mk b/ports/espressif/boards/adafruit_feather_esp32_v2/mpconfigboard.mk new file mode 100644 index 0000000000..38d689d08a --- /dev/null +++ b/ports/espressif/boards/adafruit_feather_esp32_v2/mpconfigboard.mk @@ -0,0 +1,8 @@ +CIRCUITPY_CREATOR_ID = 0x0000239A +CIRCUITPY_CREATION_ID = 0x00320001 + +IDF_TARGET = esp32 + +CIRCUITPY_ESP_FLASH_MODE = dio +CIRCUITPY_ESP_FLASH_FREQ = 40m +CIRCUITPY_ESP_FLASH_SIZE = 8MB diff --git a/ports/espressif/boards/adafruit_feather_esp32_v2/pins.c b/ports/espressif/boards/adafruit_feather_esp32_v2/pins.c new file mode 100644 index 0000000000..43cca6a7af --- /dev/null +++ b/ports/espressif/boards/adafruit_feather_esp32_v2/pins.c @@ -0,0 +1,86 @@ +#include "shared-bindings/board/__init__.h" + +STATIC const mp_rom_map_elem_t board_module_globals_table[] = { + CIRCUITPYTHON_BOARD_DICT_STANDARD_ITEMS + + // External pins are in silkscreen order, from top to bottom, left side, then right side + { MP_ROM_QSTR(MP_QSTR_A0), MP_ROM_PTR(&pin_GPIO26) }, + { MP_ROM_QSTR(MP_QSTR_D26), MP_ROM_PTR(&pin_GPIO26) }, + + { MP_ROM_QSTR(MP_QSTR_A1), MP_ROM_PTR(&pin_GPIO25) }, + { MP_ROM_QSTR(MP_QSTR_D25), MP_ROM_PTR(&pin_GPIO25) }, + + { MP_ROM_QSTR(MP_QSTR_A2), MP_ROM_PTR(&pin_GPIO34) }, + { MP_ROM_QSTR(MP_QSTR_D34), MP_ROM_PTR(&pin_GPIO34) }, + + { MP_ROM_QSTR(MP_QSTR_A3), MP_ROM_PTR(&pin_GPIO39) }, + { MP_ROM_QSTR(MP_QSTR_D39), MP_ROM_PTR(&pin_GPIO39) }, + + { MP_ROM_QSTR(MP_QSTR_A4), MP_ROM_PTR(&pin_GPIO36) }, + { MP_ROM_QSTR(MP_QSTR_D36), MP_ROM_PTR(&pin_GPIO36) }, + + { MP_ROM_QSTR(MP_QSTR_A5), MP_ROM_PTR(&pin_GPIO4) }, + { MP_ROM_QSTR(MP_QSTR_D4), MP_ROM_PTR(&pin_GPIO4) }, + + { MP_ROM_QSTR(MP_QSTR_SCK), MP_ROM_PTR(&pin_GPIO5) }, + { MP_ROM_QSTR(MP_QSTR_D5), MP_ROM_PTR(&pin_GPIO5) }, + + { MP_ROM_QSTR(MP_QSTR_MOSI), MP_ROM_PTR(&pin_GPIO19) }, + { MP_ROM_QSTR(MP_QSTR_D19), MP_ROM_PTR(&pin_GPIO19) }, + + { MP_ROM_QSTR(MP_QSTR_MISO), MP_ROM_PTR(&pin_GPIO21) }, + { MP_ROM_QSTR(MP_QSTR_D21), MP_ROM_PTR(&pin_GPIO21) }, + + { MP_ROM_QSTR(MP_QSTR_RX), MP_ROM_PTR(&pin_GPIO7) }, + { MP_ROM_QSTR(MP_QSTR_D7), MP_ROM_PTR(&pin_GPIO7) }, + + { MP_ROM_QSTR(MP_QSTR_TX), MP_ROM_PTR(&pin_GPIO8) }, + { MP_ROM_QSTR(MP_QSTR_D8), MP_ROM_PTR(&pin_GPIO8) }, + + { MP_ROM_QSTR(MP_QSTR_D37), MP_ROM_PTR(&pin_GPIO37) }, + + { MP_ROM_QSTR(MP_QSTR_LED), MP_ROM_PTR(&pin_GPIO13) }, + { MP_ROM_QSTR(MP_QSTR_L), MP_ROM_PTR(&pin_GPIO13) }, + { MP_ROM_QSTR(MP_QSTR_D13), MP_ROM_PTR(&pin_GPIO13) }, + { MP_ROM_QSTR(MP_QSTR_A12), MP_ROM_PTR(&pin_GPIO13) }, + + { MP_ROM_QSTR(MP_QSTR_D12), MP_ROM_PTR(&pin_GPIO12) }, + { MP_ROM_QSTR(MP_QSTR_A11), MP_ROM_PTR(&pin_GPIO12) }, + + { MP_ROM_QSTR(MP_QSTR_D27), MP_ROM_PTR(&pin_GPIO27) }, + { MP_ROM_QSTR(MP_QSTR_A10), MP_ROM_PTR(&pin_GPIO27) }, + + { MP_ROM_QSTR(MP_QSTR_D33), MP_ROM_PTR(&pin_GPIO33) }, + { MP_ROM_QSTR(MP_QSTR_A9), MP_ROM_PTR(&pin_GPIO33) }, + + { MP_ROM_QSTR(MP_QSTR_D15), MP_ROM_PTR(&pin_GPIO15) }, + { MP_ROM_QSTR(MP_QSTR_A8), MP_ROM_PTR(&pin_GPIO15) }, + + { MP_ROM_QSTR(MP_QSTR_D32), MP_ROM_PTR(&pin_GPIO32) }, + { MP_ROM_QSTR(MP_QSTR_A7), MP_ROM_PTR(&pin_GPIO32) }, + + { MP_ROM_QSTR(MP_QSTR_D14), MP_ROM_PTR(&pin_GPIO14) }, + { MP_ROM_QSTR(MP_QSTR_A6), MP_ROM_PTR(&pin_GPIO14) }, + + { MP_ROM_QSTR(MP_QSTR_SCL), MP_ROM_PTR(&pin_GPIO20) }, + { MP_ROM_QSTR(MP_QSTR_D20), MP_ROM_PTR(&pin_GPIO20) }, + + { MP_ROM_QSTR(MP_QSTR_SDA), MP_ROM_PTR(&pin_GPIO22) }, + { MP_ROM_QSTR(MP_QSTR_D22), MP_ROM_PTR(&pin_GPIO22) }, + + { MP_ROM_QSTR(MP_QSTR_D35), MP_ROM_PTR(&pin_GPIO35) }, + { MP_ROM_QSTR(MP_QSTR_VOLTAGE_MONITOR), MP_ROM_PTR(&pin_GPIO35) }, + + { MP_ROM_QSTR(MP_QSTR_BUTTON), MP_ROM_PTR(&pin_GPIO38) }, + { MP_ROM_QSTR(MP_QSTR_SW38), MP_ROM_PTR(&pin_GPIO38) }, + + { MP_ROM_QSTR(MP_QSTR_NEOPIXEL), MP_ROM_PTR(&pin_GPIO0) }, + + { MP_ROM_QSTR(MP_QSTR_NEOPIXEL_I2C_POWER), MP_ROM_PTR(&pin_GPIO2) }, + + { MP_ROM_QSTR(MP_QSTR_I2C), MP_ROM_PTR(&board_i2c_obj) }, + { MP_ROM_QSTR(MP_QSTR_STEMMA_I2C), MP_ROM_PTR(&board_i2c_obj) }, + { MP_ROM_QSTR(MP_QSTR_SPI), MP_ROM_PTR(&board_spi_obj) }, + { MP_ROM_QSTR(MP_QSTR_UART), MP_ROM_PTR(&board_uart_obj) } +}; +MP_DEFINE_CONST_DICT(board_module_globals, board_module_globals_table); diff --git a/ports/espressif/boards/adafruit_feather_esp32_v2/sdkconfig b/ports/espressif/boards/adafruit_feather_esp32_v2/sdkconfig new file mode 100644 index 0000000000..c09d8c409a --- /dev/null +++ b/ports/espressif/boards/adafruit_feather_esp32_v2/sdkconfig @@ -0,0 +1,37 @@ +CONFIG_ESP32_SPIRAM_SUPPORT=y +# SPI RAM config +# +# CONFIG_SPIRAM_TYPE_AUTO is not set +CONFIG_SPIRAM_TYPE_ESPPSRAM16=y +# CONFIG_SPIRAM_TYPE_ESPPSRAM32 is not set +# CONFIG_SPIRAM_TYPE_ESPPSRAM64 is not set +CONFIG_SPIRAM_SIZE=2097152 +CONFIG_SPIRAM_SPEED_40M=y +CONFIG_SPIRAM=y +CONFIG_SPIRAM_BOOT_INIT=y +CONFIG_SPIRAM_IGNORE_NOTFOUND=y +CONFIG_SPIRAM_USE_MEMMAP=y +# CONFIG_SPIRAM_USE_CAPS_ALLOC is not set +# CONFIG_SPIRAM_USE_MALLOC is not set +CONFIG_SPIRAM_MEMTEST=y +# CONFIG_SPIRAM_ALLOW_BSS_SEG_EXTERNAL_MEMORY is not set +# CONFIG_SPIRAM_ALLOW_NOINIT_SEG_EXTERNAL_MEMORY is not set +CONFIG_SPIRAM_CACHE_WORKAROUND=y + +# Uncomment (remove ###) to send ESP_LOG output to TX/RX pins +### # +### # ESP System Settings +### # +### CONFIG_ESP_SYSTEM_PANIC_PRINT_HALT=y +### # CONFIG_ESP_SYSTEM_PANIC_SILENT_REBOOT is not set +### CONFIG_ESP_CONSOLE_UART_CUSTOM=y +### # CONFIG_ESP_CONSOLE_NONE is not set +### CONFIG_ESP_CONSOLE_UART=y +### CONFIG_ESP_CONSOLE_UART_CUSTOM_NUM_0=y +### # CONFIG_ESP_CONSOLE_UART_CUSTOM_NUM_1 is not set +### CONFIG_ESP_CONSOLE_UART_NUM=0 +### CONFIG_ESP_CONSOLE_UART_TX_GPIO=8 +### CONFIG_ESP_CONSOLE_UART_RX_GPIO=7 +### CONFIG_ESP_CONSOLE_UART_BAUDRATE=115200 +### # CONFIG_ESP_SYSTEM_CHECK_INT_LEVEL_5 is not set +### # end of ESP System Settings diff --git a/ports/espressif/boards/adafruit_feather_esp32s2/board.c b/ports/espressif/boards/adafruit_feather_esp32s2/board.c index f9e88c097e..f701d18442 100644 --- a/ports/espressif/boards/adafruit_feather_esp32s2/board.c +++ b/ports/espressif/boards/adafruit_feather_esp32s2/board.c @@ -35,10 +35,6 @@ void board_init(void) { reset_board(); } -bool board_requests_safe_mode(void) { - return false; -} - void reset_board(void) { // Turn on I2C power by default. @@ -53,5 +49,4 @@ void reset_board(void) { gpio_set_level(7, !restlevel); } -void board_deinit(void) { -} +// Use the MP_WEAK supervisor/shared/board.c versions of routines not defined here. diff --git a/ports/espressif/boards/adafruit_feather_esp32s2/mpconfigboard.h b/ports/espressif/boards/adafruit_feather_esp32s2/mpconfigboard.h index 0be1357939..4e7da01b5a 100644 --- a/ports/espressif/boards/adafruit_feather_esp32s2/mpconfigboard.h +++ b/ports/espressif/boards/adafruit_feather_esp32s2/mpconfigboard.h @@ -32,6 +32,8 @@ #define MICROPY_HW_NEOPIXEL (&pin_GPIO33) #define CIRCUITPY_STATUS_LED_POWER (&pin_GPIO21) +#define MICROPY_HW_LED_STATUS (&pin_GPIO13) + #define DEFAULT_I2C_BUS_SCL (&pin_GPIO4) #define DEFAULT_I2C_BUS_SDA (&pin_GPIO3) diff --git a/ports/espressif/boards/adafruit_feather_esp32s2/mpconfigboard.mk b/ports/espressif/boards/adafruit_feather_esp32s2/mpconfigboard.mk index 3f2fee9cf4..3ba91e62fd 100644 --- a/ports/espressif/boards/adafruit_feather_esp32s2/mpconfigboard.mk +++ b/ports/espressif/boards/adafruit_feather_esp32s2/mpconfigboard.mk @@ -5,15 +5,6 @@ USB_MANUFACTURER = "Adafruit" IDF_TARGET = esp32s2 -INTERNAL_FLASH_FILESYSTEM = 1 -LONGINT_IMPL = MPZ - -# The default queue depth of 16 overflows on release builds, -# so increase it to 32. -CFLAGS += -DCFG_TUD_TASK_QUEUE_SZ=32 - -CIRCUITPY_ESP_FLASH_MODE=dio -CIRCUITPY_ESP_FLASH_FREQ=40m -CIRCUITPY_ESP_FLASH_SIZE=4MB - -CIRCUITPY_MODULE=wroom +CIRCUITPY_ESP_FLASH_MODE = dio +CIRCUITPY_ESP_FLASH_FREQ = 40m +CIRCUITPY_ESP_FLASH_SIZE = 4MB diff --git a/ports/espressif/boards/adafruit_feather_esp32s2/sdkconfig b/ports/espressif/boards/adafruit_feather_esp32s2/sdkconfig index f19afafa3d..37fd534249 100644 --- a/ports/espressif/boards/adafruit_feather_esp32s2/sdkconfig +++ b/ports/espressif/boards/adafruit_feather_esp32s2/sdkconfig @@ -1,3 +1,9 @@ +# +# Component config +# +# +# ESP32S2-specific +# CONFIG_ESP32S2_SPIRAM_SUPPORT=y # # SPI RAM config @@ -7,12 +13,10 @@ CONFIG_SPIRAM_TYPE_ESPPSRAM16=y # CONFIG_SPIRAM_TYPE_ESPPSRAM32 is not set # CONFIG_SPIRAM_TYPE_ESPPSRAM64 is not set CONFIG_SPIRAM_SIZE=2097152 -# end of SPI RAM config - -CONFIG_DEFAULT_PSRAM_CLK_IO=30 # # PSRAM clock and cs IO for ESP32S2 # +CONFIG_DEFAULT_PSRAM_CLK_IO=30 CONFIG_DEFAULT_PSRAM_CS_IO=26 # end of PSRAM clock and cs IO for ESP32S2 @@ -30,8 +34,14 @@ CONFIG_SPIRAM_USE_MEMMAP=y # CONFIG_SPIRAM_USE_MALLOC is not set CONFIG_SPIRAM_MEMTEST=y # CONFIG_SPIRAM_ALLOW_BSS_SEG_EXTERNAL_MEMORY is not set +# end of SPI RAM config + +# end of ESP32S2-specific + # # LWIP # CONFIG_LWIP_LOCAL_HOSTNAME="espressif" # end of LWIP + +# end of Component config diff --git a/ports/espressif/boards/adafruit_feather_esp32s2_tft/board.c b/ports/espressif/boards/adafruit_feather_esp32s2_tft/board.c index 46f1fbd31c..c5b47a2f95 100644 --- a/ports/espressif/boards/adafruit_feather_esp32s2_tft/board.c +++ b/ports/espressif/boards/adafruit_feather_esp32s2_tft/board.c @@ -71,12 +71,6 @@ uint8_t display_init_sequence[] = { void board_init(void) { - // THIS SHOULD BE HANDLED BY espressif_board_reset_pin_number(), but it is not working. - // TEMPORARY FIX UNTIL IT'S DIAGNOSED. - common_hal_never_reset_pin(&pin_GPIO21); - gpio_set_direction(21, GPIO_MODE_DEF_OUTPUT); - gpio_set_level(21, true); - busio_spi_obj_t *spi = common_hal_board_create_spi(0); displayio_fourwire_obj_t *bus = &displays[0].fourwire_bus; bus->base.type = &displayio_fourwire_type; @@ -94,9 +88,6 @@ void board_init(void) { displayio_display_obj_t *display = &displays[0].display; display->base.type = &displayio_display_type; - // workaround as board_init() is called before reset_port() in main.c - pwmout_reset(); - common_hal_displayio_display_construct( display, bus, @@ -118,37 +109,28 @@ void board_init(void) { sizeof(display_init_sequence), &pin_GPIO45, // backlight pin NO_BRIGHTNESS_COMMAND, - 1.0f, // brightness (ignored) - false, // auto_brightness + 1.0f, // brightness false, // single_byte_bounds false, // data_as_commands true, // auto_refresh 60, // native_frames_per_second true, // backlight_on_high - false // SH1107_addressing + false, // SH1107_addressing + 50000 // backlight pwm frequency ); - - common_hal_never_reset_pin(&pin_GPIO45); // backlight pin -} - -bool board_requests_safe_mode(void) { - return false; } bool espressif_board_reset_pin_number(gpio_num_t pin_number) { // Override the I2C/TFT power pin reset to prevent resetting the display. if (pin_number == 21) { // Turn on TFT and I2C - gpio_set_direction(21, GPIO_MODE_DEF_OUTPUT); - gpio_set_level(21, true); + gpio_set_direction(pin_number, GPIO_MODE_DEF_OUTPUT); + gpio_set_level(pin_number, true); return true; } return false; } -void reset_board(void) { -} +// Use the MP_WEAK supervisor/shared/board.c versions of routines not defined here. -void board_deinit(void) { - // TODO: Should we turn off the display when asleep? -} +// TODO: Should we turn off the display when asleep, in board_deinit()? diff --git a/ports/espressif/boards/adafruit_feather_esp32s2_tft/mpconfigboard.h b/ports/espressif/boards/adafruit_feather_esp32s2_tft/mpconfigboard.h index bafb280014..e9eb3326ea 100644 --- a/ports/espressif/boards/adafruit_feather_esp32s2_tft/mpconfigboard.h +++ b/ports/espressif/boards/adafruit_feather_esp32s2_tft/mpconfigboard.h @@ -32,6 +32,8 @@ #define MICROPY_HW_NEOPIXEL (&pin_GPIO33) #define CIRCUITPY_STATUS_LED_POWER (&pin_GPIO34) +#define MICROPY_HW_LED_STATUS (&pin_GPIO13) + #define DEFAULT_I2C_BUS_SCL (&pin_GPIO41) #define DEFAULT_I2C_BUS_SDA (&pin_GPIO42) diff --git a/ports/espressif/boards/adafruit_feather_esp32s2_tft/mpconfigboard.mk b/ports/espressif/boards/adafruit_feather_esp32s2_tft/mpconfigboard.mk index 0f099f8b22..4b559ff1ee 100644 --- a/ports/espressif/boards/adafruit_feather_esp32s2_tft/mpconfigboard.mk +++ b/ports/espressif/boards/adafruit_feather_esp32s2_tft/mpconfigboard.mk @@ -6,15 +6,6 @@ USB_MANUFACTURER = "Adafruit" IDF_TARGET = esp32s2 -INTERNAL_FLASH_FILESYSTEM = 1 -LONGINT_IMPL = MPZ - -# The default queue depth of 16 overflows on release builds, -# so increase it to 32. -CFLAGS += -DCFG_TUD_TASK_QUEUE_SZ=32 - -CIRCUITPY_ESP_FLASH_MODE=dio -CIRCUITPY_ESP_FLASH_FREQ=40m -CIRCUITPY_ESP_FLASH_SIZE=4MB - -CIRCUITPY_MODULE=wroom +CIRCUITPY_ESP_FLASH_MODE = dio +CIRCUITPY_ESP_FLASH_FREQ = 40m +CIRCUITPY_ESP_FLASH_SIZE = 4MB diff --git a/ports/espressif/boards/adafruit_feather_esp32s2_tftback_nopsram/board.c b/ports/espressif/boards/adafruit_feather_esp32s2_tftback_nopsram/board.c index 71b381616f..e0edec2fa2 100644 --- a/ports/espressif/boards/adafruit_feather_esp32s2_tftback_nopsram/board.c +++ b/ports/espressif/boards/adafruit_feather_esp32s2_tftback_nopsram/board.c @@ -94,24 +94,15 @@ void board_init(void) { sizeof(display_init_sequence), &pin_GPIO7, // backlight pin NO_BRIGHTNESS_COMMAND, - 1.0f, // brightness (ignored) - true, // auto_brightness + 1.0f, // brightness false, // single_byte_bounds false, // data_as_commands true, // auto_refresh 60, // native_frames_per_second true, // backlight_on_high - false); // not SH1107 + false, // not SH1107 + 50000); // backlight pwm frequency */ } -bool board_requests_safe_mode(void) { - return false; -} - -void reset_board(void) { - -} - -void board_deinit(void) { -} +// Use the MP_WEAK supervisor/shared/board.c versions of routines not defined here. diff --git a/ports/espressif/boards/adafruit_feather_esp32s2_tftback_nopsram/mpconfigboard.h b/ports/espressif/boards/adafruit_feather_esp32s2_tftback_nopsram/mpconfigboard.h index 6cbe314f42..b4034568c0 100644 --- a/ports/espressif/boards/adafruit_feather_esp32s2_tftback_nopsram/mpconfigboard.h +++ b/ports/espressif/boards/adafruit_feather_esp32s2_tftback_nopsram/mpconfigboard.h @@ -32,6 +32,8 @@ #define MICROPY_HW_NEOPIXEL (&pin_GPIO33) #define CIRCUITPY_STATUS_LED_POWER (&pin_GPIO21) +#define MICROPY_HW_LED_STATUS (&pin_GPIO13) + #define DEFAULT_I2C_BUS_SCL (&pin_GPIO4) #define DEFAULT_I2C_BUS_SDA (&pin_GPIO3) diff --git a/ports/espressif/boards/adafruit_feather_esp32s2_tftback_nopsram/mpconfigboard.mk b/ports/espressif/boards/adafruit_feather_esp32s2_tftback_nopsram/mpconfigboard.mk index e1a9793289..b07161cee3 100644 --- a/ports/espressif/boards/adafruit_feather_esp32s2_tftback_nopsram/mpconfigboard.mk +++ b/ports/espressif/boards/adafruit_feather_esp32s2_tftback_nopsram/mpconfigboard.mk @@ -5,19 +5,11 @@ USB_MANUFACTURER = "Adafruit" IDF_TARGET = esp32s2 -INTERNAL_FLASH_FILESYSTEM = 1 -LONGINT_IMPL = MPZ - -# The default queue depth of 16 overflows on release builds, -# so increase it to 32. -CFLAGS += -DCFG_TUD_TASK_QUEUE_SZ=32 - -CIRCUITPY_ESP_FLASH_MODE=dio -CIRCUITPY_ESP_FLASH_FREQ=40m -CIRCUITPY_ESP_FLASH_SIZE=4MB - -CIRCUITPY_MODULE=wroom +CIRCUITPY_ESP_FLASH_MODE = dio +CIRCUITPY_ESP_FLASH_FREQ = 40m +CIRCUITPY_ESP_FLASH_SIZE = 4MB FROZEN_MPY_DIRS += $(TOP)/frozen/Adafruit_CircuitPython_Requests FROZEN_MPY_DIRS += $(TOP)/frozen/Adafruit_CircuitPython_NeoPixel FROZEN_MPY_DIRS += $(TOP)/frozen/Adafruit_CircuitPython_Register +CIRCUITPY_ESP32_CAMERA = 0 diff --git a/ports/espressif/boards/adafruit_feather_esp32s3_4mbflash_2mbpsram/board.c b/ports/espressif/boards/adafruit_feather_esp32s3_4mbflash_2mbpsram/board.c new file mode 100644 index 0000000000..983d62a911 --- /dev/null +++ b/ports/espressif/boards/adafruit_feather_esp32s3_4mbflash_2mbpsram/board.c @@ -0,0 +1,45 @@ +/* + * This file is part of the MicroPython project, http://micropython.org/ + * + * The MIT License (MIT) + * + * Copyright (c) 2020 Scott Shawcroft for Adafruit Industries + * + * Permission is hereby granted, free of charge, to any person obtaining a copy + * of this software and associated documentation files (the "Software"), to deal + * in the Software without restriction, including without limitation the rights + * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell + * copies of the Software, and to permit persons to whom the Software is + * furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice shall be included in + * all copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE + * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER + * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, + * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN + * THE SOFTWARE. + */ + +#include "supervisor/board.h" +#include "mpconfigboard.h" +#include "shared-bindings/microcontroller/Pin.h" +#include "components/driver/include/driver/gpio.h" +#include "components/hal/include/hal/gpio_hal.h" +#include "common-hal/microcontroller/Pin.h" + +void board_init(void) { + reset_board(); +} + +void reset_board(void) { + // Turn on I2C power by default. + + gpio_set_direction(7, GPIO_MODE_DEF_OUTPUT); + gpio_set_level(7, true); +} + +// Use the MP_WEAK supervisor/shared/board.c versions of routines not defined here. diff --git a/shared-bindings/gamepadshift/GamePadShift.h b/ports/espressif/boards/adafruit_feather_esp32s3_4mbflash_2mbpsram/mpconfigboard.h similarity index 63% rename from shared-bindings/gamepadshift/GamePadShift.h rename to ports/espressif/boards/adafruit_feather_esp32s3_4mbflash_2mbpsram/mpconfigboard.h index 8856e133ac..ecaa13a344 100644 --- a/shared-bindings/gamepadshift/GamePadShift.h +++ b/ports/espressif/boards/adafruit_feather_esp32s3_4mbflash_2mbpsram/mpconfigboard.h @@ -3,7 +3,7 @@ * * The MIT License (MIT) * - * Copyright (c) 2016 Radomir Dopieralski for Adafruit Industries + * Copyright (c) 2019 Scott Shawcroft for Adafruit Industries * * Permission is hereby granted, free of charge, to any person obtaining a copy * of this software and associated documentation files (the "Software"), to deal @@ -24,19 +24,24 @@ * THE SOFTWARE. */ +// Micropython setup -#ifndef MICROPY_INCLUDED_SHARED_BINDINGS_GAMEPADSHIFT_GAMEPADSHIFT_H -#define MICROPY_INCLUDED_SHARED_BINDINGS_GAMEPADSHIFT_GAMEPADSHIFT_H +#define MICROPY_HW_BOARD_NAME "Adafruit Feather ESP32S3 4MB Flash 2MB PSRAM" +#define MICROPY_HW_MCU_NAME "ESP32S3" -#include "shared-module/gamepadshift/GamePadShift.h" +#define MICROPY_HW_NEOPIXEL (&pin_GPIO33) +#define CIRCUITPY_STATUS_LED_POWER (&pin_GPIO21) -extern const mp_obj_type_t gamepadshift_type; +#define MICROPY_HW_LED_STATUS (&pin_GPIO13) -void common_hal_gamepadshift_gamepadshift_init(gamepadshift_obj_t *gamepadshift, - digitalio_digitalinout_obj_t *clock_pin, - digitalio_digitalinout_obj_t *data_pin, - digitalio_digitalinout_obj_t *latch_pin); +#define DEFAULT_I2C_BUS_SCL (&pin_GPIO4) +#define DEFAULT_I2C_BUS_SDA (&pin_GPIO3) -void common_hal_gamepadshift_gamepadshift_deinit(gamepadshift_obj_t *gamepadshift); +#define DEFAULT_SPI_BUS_SCK (&pin_GPIO36) +#define DEFAULT_SPI_BUS_MOSI (&pin_GPIO35) +#define DEFAULT_SPI_BUS_MISO (&pin_GPIO37) -#endif // MICROPY_INCLUDED_SHARED_BINDINGS_GAMEPADSHIFT_GAMEPADSHIFT_H +#define DEFAULT_UART_BUS_RX (&pin_GPIO38) +#define DEFAULT_UART_BUS_TX (&pin_GPIO39) + +#define DOUBLE_TAP_PIN (&pin_GPIO34) diff --git a/ports/espressif/boards/adafruit_feather_esp32s3_4mbflash_2mbpsram/mpconfigboard.mk b/ports/espressif/boards/adafruit_feather_esp32s3_4mbflash_2mbpsram/mpconfigboard.mk new file mode 100644 index 0000000000..4ecf6aa969 --- /dev/null +++ b/ports/espressif/boards/adafruit_feather_esp32s3_4mbflash_2mbpsram/mpconfigboard.mk @@ -0,0 +1,13 @@ +USB_VID = 0x239A +USB_PID = 0x811C +USB_PRODUCT = "Adafruit Feather ESP32S3 4MB Flash 2MB PSRAM" +USB_MANUFACTURER = "Adafruit" + +IDF_TARGET = esp32s3 + +CIRCUITPY_ESP_FLASH_MODE = qio +CIRCUITPY_ESP_FLASH_FREQ = 40m +CIRCUITPY_ESP_FLASH_SIZE = 4MB + +OPTIMIZATION_FLAGS = -Os +CIRCUITPY_ESP32_CAMERA = 0 diff --git a/ports/espressif/boards/adafruit_feather_esp32s3_4mbflash_2mbpsram/pins.c b/ports/espressif/boards/adafruit_feather_esp32s3_4mbflash_2mbpsram/pins.c new file mode 100644 index 0000000000..cf4c915e7f --- /dev/null +++ b/ports/espressif/boards/adafruit_feather_esp32s3_4mbflash_2mbpsram/pins.c @@ -0,0 +1,73 @@ +#include "shared-bindings/board/__init__.h" + +STATIC const mp_rom_map_elem_t board_module_globals_table[] = { + CIRCUITPYTHON_BOARD_DICT_STANDARD_ITEMS + + { MP_ROM_QSTR(MP_QSTR_BUTTON), MP_ROM_PTR(&pin_GPIO0) }, + { MP_ROM_QSTR(MP_QSTR_BOOT0), MP_ROM_PTR(&pin_GPIO0) }, + { MP_ROM_QSTR(MP_QSTR_D0), MP_ROM_PTR(&pin_GPIO0) }, + + { MP_ROM_QSTR(MP_QSTR_SDA), MP_ROM_PTR(&pin_GPIO3) }, + { MP_ROM_QSTR(MP_QSTR_D3), MP_ROM_PTR(&pin_GPIO3) }, + + { MP_ROM_QSTR(MP_QSTR_SCL), MP_ROM_PTR(&pin_GPIO4) }, + { MP_ROM_QSTR(MP_QSTR_D4), MP_ROM_PTR(&pin_GPIO4) }, + + { MP_ROM_QSTR(MP_QSTR_D5), MP_ROM_PTR(&pin_GPIO5) }, + { MP_ROM_QSTR(MP_QSTR_D6), MP_ROM_PTR(&pin_GPIO6) }, + + { MP_ROM_QSTR(MP_QSTR_I2C_POWER), MP_ROM_PTR(&pin_GPIO7) }, + { MP_ROM_QSTR(MP_QSTR_D7), MP_ROM_PTR(&pin_GPIO7) }, + + { MP_ROM_QSTR(MP_QSTR_A5), MP_ROM_PTR(&pin_GPIO8) }, + { MP_ROM_QSTR(MP_QSTR_D8), MP_ROM_PTR(&pin_GPIO8) }, + + { MP_ROM_QSTR(MP_QSTR_D9), MP_ROM_PTR(&pin_GPIO9) }, + { MP_ROM_QSTR(MP_QSTR_D10), MP_ROM_PTR(&pin_GPIO10) }, + { MP_ROM_QSTR(MP_QSTR_D11), MP_ROM_PTR(&pin_GPIO11) }, + { MP_ROM_QSTR(MP_QSTR_D12), MP_ROM_PTR(&pin_GPIO12) }, + + { MP_ROM_QSTR(MP_QSTR_LED), MP_ROM_PTR(&pin_GPIO13) }, + { MP_ROM_QSTR(MP_QSTR_D13), MP_ROM_PTR(&pin_GPIO13) }, + { MP_ROM_QSTR(MP_QSTR_L), MP_ROM_PTR(&pin_GPIO13) }, + + { MP_ROM_QSTR(MP_QSTR_A4), MP_ROM_PTR(&pin_GPIO14) }, + { MP_ROM_QSTR(MP_QSTR_D14), MP_ROM_PTR(&pin_GPIO14) }, + + { MP_ROM_QSTR(MP_QSTR_A3), MP_ROM_PTR(&pin_GPIO15) }, + { MP_ROM_QSTR(MP_QSTR_D15), MP_ROM_PTR(&pin_GPIO15) }, + + { MP_ROM_QSTR(MP_QSTR_A2), MP_ROM_PTR(&pin_GPIO16) }, + { MP_ROM_QSTR(MP_QSTR_D16), MP_ROM_PTR(&pin_GPIO16) }, + + { MP_ROM_QSTR(MP_QSTR_A1), MP_ROM_PTR(&pin_GPIO17) }, + { MP_ROM_QSTR(MP_QSTR_D17), MP_ROM_PTR(&pin_GPIO17) }, + + { MP_ROM_QSTR(MP_QSTR_A0), MP_ROM_PTR(&pin_GPIO18) }, + { MP_ROM_QSTR(MP_QSTR_D18), MP_ROM_PTR(&pin_GPIO18) }, + + { MP_ROM_QSTR(MP_QSTR_NEOPIXEL_POWER), MP_ROM_PTR(&pin_GPIO21) }, + { MP_ROM_QSTR(MP_QSTR_NEOPIXEL), MP_ROM_PTR(&pin_GPIO33) }, + + { MP_ROM_QSTR(MP_QSTR_MOSI), MP_ROM_PTR(&pin_GPIO35) }, + { MP_ROM_QSTR(MP_QSTR_D35), MP_ROM_PTR(&pin_GPIO35) }, + + { MP_ROM_QSTR(MP_QSTR_SCK), MP_ROM_PTR(&pin_GPIO36) }, + { MP_ROM_QSTR(MP_QSTR_D36), MP_ROM_PTR(&pin_GPIO36) }, + + { MP_ROM_QSTR(MP_QSTR_MISO), MP_ROM_PTR(&pin_GPIO37) }, + { MP_ROM_QSTR(MP_QSTR_D37), MP_ROM_PTR(&pin_GPIO37) }, + + + { MP_ROM_QSTR(MP_QSTR_RX), MP_ROM_PTR(&pin_GPIO38) }, + { MP_ROM_QSTR(MP_QSTR_D38), MP_ROM_PTR(&pin_GPIO38) }, + + { MP_ROM_QSTR(MP_QSTR_TX), MP_ROM_PTR(&pin_GPIO39) }, + { MP_ROM_QSTR(MP_QSTR_D39), MP_ROM_PTR(&pin_GPIO39) }, + + { MP_ROM_QSTR(MP_QSTR_I2C), MP_ROM_PTR(&board_i2c_obj) }, + { MP_ROM_QSTR(MP_QSTR_STEMMA_I2C), MP_ROM_PTR(&board_i2c_obj) }, + { MP_ROM_QSTR(MP_QSTR_SPI), MP_ROM_PTR(&board_spi_obj) }, + { MP_ROM_QSTR(MP_QSTR_UART), MP_ROM_PTR(&board_uart_obj) } +}; +MP_DEFINE_CONST_DICT(board_module_globals, board_module_globals_table); diff --git a/ports/espressif/boards/adafruit_feather_esp32s3_4mbflash_2mbpsram/sdkconfig b/ports/espressif/boards/adafruit_feather_esp32s3_4mbflash_2mbpsram/sdkconfig new file mode 100644 index 0000000000..9a05ab0205 --- /dev/null +++ b/ports/espressif/boards/adafruit_feather_esp32s3_4mbflash_2mbpsram/sdkconfig @@ -0,0 +1,47 @@ +# +# Component config +# +# +# ESP32S3-Specific +# +CONFIG_ESP32S3_SPIRAM_SUPPORT=y +# +# SPI RAM config +# +CONFIG_SPIRAM_MODE_QUAD=y +# CONFIG_SPIRAM_MODE_OCT is not set +CONFIG_SPIRAM_TYPE_AUTO=y +# CONFIG_SPIRAM_TYPE_ESPPSRAM16 is not set +# CONFIG_SPIRAM_TYPE_ESPPSRAM32 is not set +# CONFIG_SPIRAM_TYPE_ESPPSRAM64 is not set +CONFIG_SPIRAM_SIZE=2097152 +# +# PSRAM Clock and CS IO for ESP32S3 +# +CONFIG_DEFAULT_PSRAM_CLK_IO=30 +CONFIG_DEFAULT_PSRAM_CS_IO=26 +# end of PSRAM Clock and CS IO for ESP32S3 + +# CONFIG_SPIRAM_FETCH_INSTRUCTIONS is not set +# CONFIG_SPIRAM_RODATA is not set +# CONFIG_SPIRAM_SPEED_120M is not set +CONFIG_SPIRAM_SPEED_80M=y +# CONFIG_SPIRAM_SPEED_40M is not set +CONFIG_SPIRAM=y +CONFIG_SPIRAM_BOOT_INIT=y +# CONFIG_SPIRAM_IGNORE_NOTFOUND is not set +CONFIG_SPIRAM_USE_MEMMAP=y +# CONFIG_SPIRAM_USE_CAPS_ALLOC is not set +# CONFIG_SPIRAM_USE_MALLOC is not set +CONFIG_SPIRAM_MEMTEST=y +# end of SPI RAM config + +# end of ESP32S3-Specific + +# +# LWIP +# +CONFIG_LWIP_LOCAL_HOSTNAME="espressif-esp32s3" +# end of LWIP + +# end of Component config diff --git a/ports/espressif/boards/adafruit_feather_esp32s3_nopsram/board.c b/ports/espressif/boards/adafruit_feather_esp32s3_nopsram/board.c index d4d55c2e23..983d62a911 100644 --- a/ports/espressif/boards/adafruit_feather_esp32s3_nopsram/board.c +++ b/ports/espressif/boards/adafruit_feather_esp32s3_nopsram/board.c @@ -35,10 +35,6 @@ void board_init(void) { reset_board(); } -bool board_requests_safe_mode(void) { - return false; -} - void reset_board(void) { // Turn on I2C power by default. @@ -46,5 +42,4 @@ void reset_board(void) { gpio_set_level(7, true); } -void board_deinit(void) { -} +// Use the MP_WEAK supervisor/shared/board.c versions of routines not defined here. diff --git a/ports/espressif/boards/adafruit_feather_esp32s3_nopsram/mpconfigboard.h b/ports/espressif/boards/adafruit_feather_esp32s3_nopsram/mpconfigboard.h index b6477c766b..e089c5c251 100644 --- a/ports/espressif/boards/adafruit_feather_esp32s3_nopsram/mpconfigboard.h +++ b/ports/espressif/boards/adafruit_feather_esp32s3_nopsram/mpconfigboard.h @@ -32,6 +32,8 @@ #define MICROPY_HW_NEOPIXEL (&pin_GPIO33) #define CIRCUITPY_STATUS_LED_POWER (&pin_GPIO21) +#define MICROPY_HW_LED_STATUS (&pin_GPIO13) + #define DEFAULT_I2C_BUS_SCL (&pin_GPIO4) #define DEFAULT_I2C_BUS_SDA (&pin_GPIO3) diff --git a/ports/espressif/boards/adafruit_feather_esp32s3_nopsram/mpconfigboard.mk b/ports/espressif/boards/adafruit_feather_esp32s3_nopsram/mpconfigboard.mk index 7c768eb51c..3c1cf0d609 100644 --- a/ports/espressif/boards/adafruit_feather_esp32s3_nopsram/mpconfigboard.mk +++ b/ports/espressif/boards/adafruit_feather_esp32s3_nopsram/mpconfigboard.mk @@ -5,13 +5,7 @@ USB_MANUFACTURER = "Adafruit" IDF_TARGET = esp32s3 -INTERNAL_FLASH_FILESYSTEM = 1 -LONGINT_IMPL = MPZ - -# The default queue depth of 16 overflows on release builds, -# so increase it to 32. -CFLAGS += -DCFG_TUD_TASK_QUEUE_SZ=32 - -CIRCUITPY_ESP_FLASH_MODE=qio -CIRCUITPY_ESP_FLASH_FREQ=80m -CIRCUITPY_ESP_FLASH_SIZE=8MB +CIRCUITPY_ESP_FLASH_MODE = qio +CIRCUITPY_ESP_FLASH_FREQ = 80m +CIRCUITPY_ESP_FLASH_SIZE = 8MB +CIRCUITPY_ESP32_CAMERA = 0 diff --git a/ports/espressif/boards/adafruit_feather_esp32s3_tft/board.c b/ports/espressif/boards/adafruit_feather_esp32s3_tft/board.c new file mode 100644 index 0000000000..7e28aafb8e --- /dev/null +++ b/ports/espressif/boards/adafruit_feather_esp32s3_tft/board.c @@ -0,0 +1,136 @@ +/* + * This file is part of the MicroPython project, http://micropython.org/ + * + * The MIT License (MIT) + * + * Copyright (c) 2020 Scott Shawcroft for Adafruit Industries + * + * Permission is hereby granted, free of charge, to any person obtaining a copy + * of this software and associated documentation files (the "Software"), to deal + * in the Software without restriction, including without limitation the rights + * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell + * copies of the Software, and to permit persons to whom the Software is + * furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice shall be included in + * all copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE + * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER + * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, + * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN + * THE SOFTWARE. + */ + +#include "supervisor/board.h" +#include "mpconfigboard.h" +#include "shared-bindings/busio/SPI.h" +#include "shared-bindings/displayio/FourWire.h" +#include "shared-bindings/microcontroller/Pin.h" +#include "shared-module/displayio/__init__.h" +#include "shared-module/displayio/mipi_constants.h" +#include "shared-bindings/board/__init__.h" + +displayio_fourwire_obj_t board_display_obj; + +#define DELAY 0x80 + +// display init sequence according to LilyGO example app +uint8_t display_init_sequence[] = { + // sw reset + 0x01, 0 | DELAY, 150, + // sleep out + 0x11, 0 | DELAY, 255, + // normal display mode on + 0x13, 0, + // display and color format settings + 0x36, 1, 0x68, + 0xB6, 2, 0x0A, 0x82, + 0x3A, 1 | DELAY, 0x55, 10, + // ST7789V frame rate setting + 0xB2, 5, 0x0C, 0x0C, 0x00, 0x33, 0x33, + // voltages: VGH / VGL + 0xB7, 1, 0x35, + // ST7789V power setting + 0xBB, 1, 0x28, + 0xC0, 1, 0x0C, + 0xC2, 2, 0x01, 0xFF, + 0xC3, 1, 0x10, + 0xC4, 1, 0x20, + 0xC6, 1, 0x0F, + 0xD0, 2, 0xA4, 0xA1, + // ST7789V gamma setting + 0xE0, 14, 0xD0, 0x00, 0x02, 0x07, 0x0A, 0x28, 0x32, 0x44, 0x42, 0x06, 0x0E, 0x12, 0x14, 0x17, + 0xE1, 14, 0xD0, 0x00, 0x02, 0x07, 0x0A, 0x28, 0x31, 0x54, 0x47, 0x0E, 0x1C, 0x17, 0x1B, 0x1E, + 0x21, 0, + // display on + 0x29, 0 | DELAY, 255, +}; + + +void board_init(void) { + busio_spi_obj_t *spi = common_hal_board_create_spi(0); + displayio_fourwire_obj_t *bus = &displays[0].fourwire_bus; + bus->base.type = &displayio_fourwire_type; + + common_hal_displayio_fourwire_construct( + bus, + spi, + &pin_GPIO39, // DC + &pin_GPIO7, // CS + &pin_GPIO40, // RST + 40000000, // baudrate + 0, // polarity + 0 // phase + ); + displayio_display_obj_t *display = &displays[0].display; + display->base.type = &displayio_display_type; + + common_hal_displayio_display_construct( + display, + bus, + 240, // width (after rotation) + 135, // height (after rotation) + 40, // column start + 53, // row start + 0, // rotation + 16, // color depth + false, // grayscale + false, // pixels in a byte share a row. Only valid for depths < 8 + 1, // bytes per cell. Only valid for depths < 8 + false, // reverse_pixels_in_byte. Only valid for depths < 8 + true, // reverse_pixels_in_word + MIPI_COMMAND_SET_COLUMN_ADDRESS, // set column command + MIPI_COMMAND_SET_PAGE_ADDRESS, // set row command + MIPI_COMMAND_WRITE_MEMORY_START, // write memory command + display_init_sequence, + sizeof(display_init_sequence), + &pin_GPIO45, // backlight pin + NO_BRIGHTNESS_COMMAND, + 1.0f, // brightness + false, // single_byte_bounds + false, // data_as_commands + true, // auto_refresh + 60, // native_frames_per_second + true, // backlight_on_high + false, // SH1107_addressing + 50000 // backlight pwm frequency + ); +} + +bool espressif_board_reset_pin_number(gpio_num_t pin_number) { + // Override the I2C/TFT power pin reset to prevent resetting the display. + if (pin_number == 21) { + // Turn on TFT and I2C + gpio_set_direction(21, GPIO_MODE_DEF_OUTPUT); + gpio_set_level(21, true); + return true; + } + return false; +} + +// Use the MP_WEAK supervisor/shared/board.c versions of routines not defined here. + +// TODO: Should we turn off the display when asleep, in board_deinit() ? diff --git a/ports/espressif/boards/adafruit_feather_esp32s3_tft/mpconfigboard.h b/ports/espressif/boards/adafruit_feather_esp32s3_tft/mpconfigboard.h new file mode 100644 index 0000000000..0bc80a884e --- /dev/null +++ b/ports/espressif/boards/adafruit_feather_esp32s3_tft/mpconfigboard.h @@ -0,0 +1,47 @@ +/* + * This file is part of the MicroPython project, http://micropython.org/ + * + * The MIT License (MIT) + * + * Copyright (c) 2019 Scott Shawcroft for Adafruit Industries + * + * Permission is hereby granted, free of charge, to any person obtaining a copy + * of this software and associated documentation files (the "Software"), to deal + * in the Software without restriction, including without limitation the rights + * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell + * copies of the Software, and to permit persons to whom the Software is + * furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice shall be included in + * all copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE + * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER + * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, + * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN + * THE SOFTWARE. + */ + +// Micropython setup + +#define MICROPY_HW_BOARD_NAME "Adafruit Feather ESP32-S3 TFT" +#define MICROPY_HW_MCU_NAME "ESP32S3" + +#define MICROPY_HW_NEOPIXEL (&pin_GPIO33) +#define CIRCUITPY_STATUS_LED_POWER (&pin_GPIO34) + +#define MICROPY_HW_LED_STATUS (&pin_GPIO13) + +#define DEFAULT_I2C_BUS_SCL (&pin_GPIO41) +#define DEFAULT_I2C_BUS_SDA (&pin_GPIO42) + +#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_GPIO2) +#define DEFAULT_UART_BUS_TX (&pin_GPIO1) + +#define DOUBLE_TAP_PIN (&pin_GPIO38) diff --git a/ports/espressif/boards/adafruit_feather_esp32s3_tft/mpconfigboard.mk b/ports/espressif/boards/adafruit_feather_esp32s3_tft/mpconfigboard.mk new file mode 100644 index 0000000000..baff69b1ac --- /dev/null +++ b/ports/espressif/boards/adafruit_feather_esp32s3_tft/mpconfigboard.mk @@ -0,0 +1,14 @@ +USB_VID = 0x239A +USB_PID = 0x811E + +USB_PRODUCT = "Feather ESP32-S3 TFT" +USB_MANUFACTURER = "Adafruit" + +IDF_TARGET = esp32s3 + +CIRCUITPY_ESP_FLASH_MODE = dio +CIRCUITPY_ESP_FLASH_FREQ = 40m +CIRCUITPY_ESP_FLASH_SIZE = 4MB + +OPTIMIZATION_FLAGS = -Os +CIRCUITPY_ESP32_CAMERA = 0 diff --git a/ports/espressif/boards/adafruit_feather_esp32s3_tft/pins.c b/ports/espressif/boards/adafruit_feather_esp32s3_tft/pins.c new file mode 100644 index 0000000000..fb2f898a18 --- /dev/null +++ b/ports/espressif/boards/adafruit_feather_esp32s3_tft/pins.c @@ -0,0 +1,78 @@ +#include "shared-bindings/board/__init__.h" + +#include "shared-module/displayio/__init__.h" + +STATIC const mp_rom_map_elem_t board_module_globals_table[] = { + CIRCUITPYTHON_BOARD_DICT_STANDARD_ITEMS + + { MP_ROM_QSTR(MP_QSTR_TX), MP_ROM_PTR(&pin_GPIO1) }, + { MP_ROM_QSTR(MP_QSTR_D1), MP_ROM_PTR(&pin_GPIO1) }, + + { MP_ROM_QSTR(MP_QSTR_RX), MP_ROM_PTR(&pin_GPIO2) }, + { MP_ROM_QSTR(MP_QSTR_D2), MP_ROM_PTR(&pin_GPIO2) }, + + { MP_ROM_QSTR(MP_QSTR_D5), MP_ROM_PTR(&pin_GPIO5) }, + { MP_ROM_QSTR(MP_QSTR_D6), MP_ROM_PTR(&pin_GPIO6) }, + { MP_ROM_QSTR(MP_QSTR_D9), MP_ROM_PTR(&pin_GPIO9) }, + { MP_ROM_QSTR(MP_QSTR_D10), MP_ROM_PTR(&pin_GPIO10) }, + { MP_ROM_QSTR(MP_QSTR_D11), MP_ROM_PTR(&pin_GPIO11) }, + { MP_ROM_QSTR(MP_QSTR_D12), MP_ROM_PTR(&pin_GPIO12) }, + + { MP_ROM_QSTR(MP_QSTR_LED), MP_ROM_PTR(&pin_GPIO13) }, + { MP_ROM_QSTR(MP_QSTR_D13), MP_ROM_PTR(&pin_GPIO13) }, + { MP_ROM_QSTR(MP_QSTR_L), MP_ROM_PTR(&pin_GPIO13) }, + + { MP_ROM_QSTR(MP_QSTR_A5), MP_ROM_PTR(&pin_GPIO8) }, + { MP_ROM_QSTR(MP_QSTR_D8), MP_ROM_PTR(&pin_GPIO8) }, + + { MP_ROM_QSTR(MP_QSTR_A4), MP_ROM_PTR(&pin_GPIO14) }, + { MP_ROM_QSTR(MP_QSTR_D14), MP_ROM_PTR(&pin_GPIO14) }, + + { MP_ROM_QSTR(MP_QSTR_A3), MP_ROM_PTR(&pin_GPIO15) }, + { MP_ROM_QSTR(MP_QSTR_D15), MP_ROM_PTR(&pin_GPIO15) }, + + { MP_ROM_QSTR(MP_QSTR_A2), MP_ROM_PTR(&pin_GPIO16) }, + { MP_ROM_QSTR(MP_QSTR_D16), MP_ROM_PTR(&pin_GPIO16) }, + + { MP_ROM_QSTR(MP_QSTR_A1), MP_ROM_PTR(&pin_GPIO17) }, + { MP_ROM_QSTR(MP_QSTR_D17), MP_ROM_PTR(&pin_GPIO17) }, + + { MP_ROM_QSTR(MP_QSTR_A0), MP_ROM_PTR(&pin_GPIO18) }, + { MP_ROM_QSTR(MP_QSTR_D18), MP_ROM_PTR(&pin_GPIO18) }, + + { MP_ROM_QSTR(MP_QSTR_NEOPIXEL), MP_ROM_PTR(&pin_GPIO33) }, + { MP_ROM_QSTR(MP_QSTR_NEOPIXEL_POWER), MP_ROM_PTR(&pin_GPIO34) }, + + { MP_ROM_QSTR(MP_QSTR_TFT_I2C_POWER), MP_ROM_PTR(&pin_GPIO21) }, + + { MP_ROM_QSTR(MP_QSTR_MOSI), MP_ROM_PTR(&pin_GPIO35) }, + { MP_ROM_QSTR(MP_QSTR_D35), MP_ROM_PTR(&pin_GPIO35) }, + + { MP_ROM_QSTR(MP_QSTR_SCK), MP_ROM_PTR(&pin_GPIO36) }, + { MP_ROM_QSTR(MP_QSTR_D36), MP_ROM_PTR(&pin_GPIO36) }, + + { MP_ROM_QSTR(MP_QSTR_MISO), MP_ROM_PTR(&pin_GPIO37) }, + { MP_ROM_QSTR(MP_QSTR_D37), MP_ROM_PTR(&pin_GPIO37) }, + + { MP_ROM_QSTR(MP_QSTR_SCL), MP_ROM_PTR(&pin_GPIO41) }, + { MP_ROM_QSTR(MP_QSTR_D41), MP_ROM_PTR(&pin_GPIO41) }, + + { MP_ROM_QSTR(MP_QSTR_SDA), MP_ROM_PTR(&pin_GPIO42) }, + { MP_ROM_QSTR(MP_QSTR_D42), MP_ROM_PTR(&pin_GPIO42) }, + + { MP_ROM_QSTR(MP_QSTR_TFT_CS), MP_ROM_PTR(&pin_GPIO7) }, + { MP_ROM_QSTR(MP_QSTR_TFT_DC), MP_ROM_PTR(&pin_GPIO39) }, + { MP_ROM_QSTR(MP_QSTR_TFT_RESET), MP_ROM_PTR(&pin_GPIO40) }, + { MP_ROM_QSTR(MP_QSTR_TFT_BACKLIGHT), MP_ROM_PTR(&pin_GPIO45) }, + + { MP_ROM_QSTR(MP_QSTR_BUTTON), MP_ROM_PTR(&pin_GPIO0) }, + { MP_ROM_QSTR(MP_QSTR_BOOT0), MP_ROM_PTR(&pin_GPIO0) }, + + { MP_ROM_QSTR(MP_QSTR_I2C), MP_ROM_PTR(&board_i2c_obj) }, + { MP_ROM_QSTR(MP_QSTR_STEMMA_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) }, + + { MP_ROM_QSTR(MP_QSTR_DISPLAY), MP_ROM_PTR(&displays[0].display)} +}; +MP_DEFINE_CONST_DICT(board_module_globals, board_module_globals_table); diff --git a/ports/espressif/boards/adafruit_feather_esp32s3_tft/sdkconfig b/ports/espressif/boards/adafruit_feather_esp32s3_tft/sdkconfig new file mode 100644 index 0000000000..9a05ab0205 --- /dev/null +++ b/ports/espressif/boards/adafruit_feather_esp32s3_tft/sdkconfig @@ -0,0 +1,47 @@ +# +# Component config +# +# +# ESP32S3-Specific +# +CONFIG_ESP32S3_SPIRAM_SUPPORT=y +# +# SPI RAM config +# +CONFIG_SPIRAM_MODE_QUAD=y +# CONFIG_SPIRAM_MODE_OCT is not set +CONFIG_SPIRAM_TYPE_AUTO=y +# CONFIG_SPIRAM_TYPE_ESPPSRAM16 is not set +# CONFIG_SPIRAM_TYPE_ESPPSRAM32 is not set +# CONFIG_SPIRAM_TYPE_ESPPSRAM64 is not set +CONFIG_SPIRAM_SIZE=2097152 +# +# PSRAM Clock and CS IO for ESP32S3 +# +CONFIG_DEFAULT_PSRAM_CLK_IO=30 +CONFIG_DEFAULT_PSRAM_CS_IO=26 +# end of PSRAM Clock and CS IO for ESP32S3 + +# CONFIG_SPIRAM_FETCH_INSTRUCTIONS is not set +# CONFIG_SPIRAM_RODATA is not set +# CONFIG_SPIRAM_SPEED_120M is not set +CONFIG_SPIRAM_SPEED_80M=y +# CONFIG_SPIRAM_SPEED_40M is not set +CONFIG_SPIRAM=y +CONFIG_SPIRAM_BOOT_INIT=y +# CONFIG_SPIRAM_IGNORE_NOTFOUND is not set +CONFIG_SPIRAM_USE_MEMMAP=y +# CONFIG_SPIRAM_USE_CAPS_ALLOC is not set +# CONFIG_SPIRAM_USE_MALLOC is not set +CONFIG_SPIRAM_MEMTEST=y +# end of SPI RAM config + +# end of ESP32S3-Specific + +# +# LWIP +# +CONFIG_LWIP_LOCAL_HOSTNAME="espressif-esp32s3" +# end of LWIP + +# end of Component config diff --git a/ports/espressif/boards/adafruit_feather_huzzah32/board.c b/ports/espressif/boards/adafruit_feather_huzzah32/board.c new file mode 100644 index 0000000000..164430c88c --- /dev/null +++ b/ports/espressif/boards/adafruit_feather_huzzah32/board.c @@ -0,0 +1,29 @@ +/* + * This file is part of the MicroPython project, http://micropython.org/ + * + * The MIT License (MIT) + * + * Copyright (c) 2020 Scott Shawcroft for Adafruit Industries + * + * Permission is hereby granted, free of charge, to any person obtaining a copy + * of this software and associated documentation files (the "Software"), to deal + * in the Software without restriction, including without limitation the rights + * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell + * copies of the Software, and to permit persons to whom the Software is + * furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice shall be included in + * all copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE + * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER + * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, + * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN + * THE SOFTWARE. + */ + +#include "supervisor/board.h" + +// Use the MP_WEAK supervisor/shared/board.c versions of routines not defined here. diff --git a/ports/espressif/boards/adafruit_feather_huzzah32/mpconfigboard.h b/ports/espressif/boards/adafruit_feather_huzzah32/mpconfigboard.h new file mode 100644 index 0000000000..0c481d6a4b --- /dev/null +++ b/ports/espressif/boards/adafruit_feather_huzzah32/mpconfigboard.h @@ -0,0 +1,45 @@ +/* + * This file is part of the MicroPython project, http://micropython.org/ + * + * The MIT License (MIT) + * + * Copyright (c) 2022 Dan Halbert for Adafruit Industries + * + * Permission is hereby granted, free of charge, to any person obtaining a copy + * of this software and associated documentation files (the "Software"), to deal + * in the Software without restriction, including without limitation the rights + * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell + * copies of the Software, and to permit persons to whom the Software is + * furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice shall be included in + * all copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE + * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER + * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, + * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN + * THE SOFTWARE. + */ + +// Micropython setup + +#define MICROPY_HW_BOARD_NAME "Adafruit Feather HUZZAH32" +#define MICROPY_HW_MCU_NAME "ESP32" + +#define MICROPY_HW_LED_STATUS (&pin_GPIO13) + +#define CIRCUITPY_BOARD_I2C (1) +#define CIRCUITPY_BOARD_I2C_PIN {{.scl = &pin_GPIO22, .sda = &pin_GPIO23}} + +#define CIRCUITPY_BOARD_SPI (1) +#define CIRCUITPY_BOARD_SPI_PIN {{.clock = &pin_GPIO5, .mosi = &pin_GPIO18, .miso = &pin_GPIO19}} + +#define CIRCUITPY_BOARD_UART (1) +#define CIRCUITPY_BOARD_UART_PIN {{.tx = &pin_GPIO17, .rx = &pin_GPIO16}} + +// UART pins attached to the USB-serial converter chip +#define CIRCUITPY_CONSOLE_UART_TX (&pin_GPIO1) +#define CIRCUITPY_CONSOLE_UART_RX (&pin_GPIO3) diff --git a/ports/espressif/boards/adafruit_feather_huzzah32/mpconfigboard.mk b/ports/espressif/boards/adafruit_feather_huzzah32/mpconfigboard.mk new file mode 100644 index 0000000000..221543547c --- /dev/null +++ b/ports/espressif/boards/adafruit_feather_huzzah32/mpconfigboard.mk @@ -0,0 +1,9 @@ +CIRCUITPY_CREATOR_ID = 0x0000239A +CIRCUITPY_CREATION_ID = 0x00320002 + +IDF_TARGET = esp32 + +CIRCUITPY_ESP_FLASH_MODE = dio +CIRCUITPY_ESP_FLASH_FREQ = 40m +CIRCUITPY_ESP_FLASH_SIZE = 4MB +CIRCUITPY_ESP32_CAMERA = 0 diff --git a/ports/espressif/boards/adafruit_feather_huzzah32/pins.c b/ports/espressif/boards/adafruit_feather_huzzah32/pins.c new file mode 100644 index 0000000000..2d96457aad --- /dev/null +++ b/ports/espressif/boards/adafruit_feather_huzzah32/pins.c @@ -0,0 +1,79 @@ +#include "shared-bindings/board/__init__.h" + +STATIC const mp_rom_map_elem_t board_module_globals_table[] = { + CIRCUITPYTHON_BOARD_DICT_STANDARD_ITEMS + + // External pins are in silkscreen order, from top to bottom, left side, then right side + { MP_ROM_QSTR(MP_QSTR_A0), MP_ROM_PTR(&pin_GPIO26) }, + { MP_ROM_QSTR(MP_QSTR_D26), MP_ROM_PTR(&pin_GPIO26) }, + + { MP_ROM_QSTR(MP_QSTR_A1), MP_ROM_PTR(&pin_GPIO25) }, + { MP_ROM_QSTR(MP_QSTR_D25), MP_ROM_PTR(&pin_GPIO25) }, + + { MP_ROM_QSTR(MP_QSTR_A2), MP_ROM_PTR(&pin_GPIO34) }, + { MP_ROM_QSTR(MP_QSTR_D34), MP_ROM_PTR(&pin_GPIO34) }, + + { MP_ROM_QSTR(MP_QSTR_A3), MP_ROM_PTR(&pin_GPIO39) }, + { MP_ROM_QSTR(MP_QSTR_D39), MP_ROM_PTR(&pin_GPIO39) }, + + { MP_ROM_QSTR(MP_QSTR_A4), MP_ROM_PTR(&pin_GPIO36) }, + { MP_ROM_QSTR(MP_QSTR_D36), MP_ROM_PTR(&pin_GPIO36) }, + + { MP_ROM_QSTR(MP_QSTR_A5), MP_ROM_PTR(&pin_GPIO4) }, + { MP_ROM_QSTR(MP_QSTR_D4), MP_ROM_PTR(&pin_GPIO4) }, + + { MP_ROM_QSTR(MP_QSTR_SCK), MP_ROM_PTR(&pin_GPIO5) }, + { MP_ROM_QSTR(MP_QSTR_D5), MP_ROM_PTR(&pin_GPIO5) }, + + { MP_ROM_QSTR(MP_QSTR_MOSI), MP_ROM_PTR(&pin_GPIO18) }, + { MP_ROM_QSTR(MP_QSTR_D18), MP_ROM_PTR(&pin_GPIO18) }, + + { MP_ROM_QSTR(MP_QSTR_MISO), MP_ROM_PTR(&pin_GPIO19) }, + { MP_ROM_QSTR(MP_QSTR_D19), MP_ROM_PTR(&pin_GPIO19) }, + + { MP_ROM_QSTR(MP_QSTR_RX), MP_ROM_PTR(&pin_GPIO16) }, + { MP_ROM_QSTR(MP_QSTR_D16), MP_ROM_PTR(&pin_GPIO16) }, + + { MP_ROM_QSTR(MP_QSTR_TX), MP_ROM_PTR(&pin_GPIO17) }, + { MP_ROM_QSTR(MP_QSTR_D17), MP_ROM_PTR(&pin_GPIO17) }, + + { MP_ROM_QSTR(MP_QSTR_D21), MP_ROM_PTR(&pin_GPIO21) }, + + { MP_ROM_QSTR(MP_QSTR_LED), MP_ROM_PTR(&pin_GPIO13) }, + { MP_ROM_QSTR(MP_QSTR_D13), MP_ROM_PTR(&pin_GPIO13) }, + { MP_ROM_QSTR(MP_QSTR_A12), MP_ROM_PTR(&pin_GPIO13) }, + + { MP_ROM_QSTR(MP_QSTR_D12), MP_ROM_PTR(&pin_GPIO12) }, + { MP_ROM_QSTR(MP_QSTR_A11), MP_ROM_PTR(&pin_GPIO12) }, + + { MP_ROM_QSTR(MP_QSTR_D27), MP_ROM_PTR(&pin_GPIO27) }, + { MP_ROM_QSTR(MP_QSTR_A10), MP_ROM_PTR(&pin_GPIO27) }, + + { MP_ROM_QSTR(MP_QSTR_D33), MP_ROM_PTR(&pin_GPIO33) }, + { MP_ROM_QSTR(MP_QSTR_A9), MP_ROM_PTR(&pin_GPIO33) }, + + { MP_ROM_QSTR(MP_QSTR_D15), MP_ROM_PTR(&pin_GPIO15) }, + { MP_ROM_QSTR(MP_QSTR_A8), MP_ROM_PTR(&pin_GPIO15) }, + + { MP_ROM_QSTR(MP_QSTR_D32), MP_ROM_PTR(&pin_GPIO32) }, + { MP_ROM_QSTR(MP_QSTR_A7), MP_ROM_PTR(&pin_GPIO32) }, + + { MP_ROM_QSTR(MP_QSTR_D14), MP_ROM_PTR(&pin_GPIO14) }, + { MP_ROM_QSTR(MP_QSTR_A6), MP_ROM_PTR(&pin_GPIO14) }, + + { MP_ROM_QSTR(MP_QSTR_SCL), MP_ROM_PTR(&pin_GPIO22) }, + { MP_ROM_QSTR(MP_QSTR_D22), MP_ROM_PTR(&pin_GPIO22) }, + + { MP_ROM_QSTR(MP_QSTR_SDA), MP_ROM_PTR(&pin_GPIO23) }, + { MP_ROM_QSTR(MP_QSTR_D23), MP_ROM_PTR(&pin_GPIO23) }, + + { MP_ROM_QSTR(MP_QSTR_D35), MP_ROM_PTR(&pin_GPIO35) }, + { MP_ROM_QSTR(MP_QSTR_VOLTAGE_MONITOR), MP_ROM_PTR(&pin_GPIO35) }, + + { MP_ROM_QSTR(MP_QSTR_NEOPIXEL), MP_ROM_PTR(&pin_GPIO0) }, + + { 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) } +}; +MP_DEFINE_CONST_DICT(board_module_globals, board_module_globals_table); diff --git a/ports/espressif/boards/adafruit_feather_huzzah32/sdkconfig b/ports/espressif/boards/adafruit_feather_huzzah32/sdkconfig new file mode 100644 index 0000000000..6c0168c829 --- /dev/null +++ b/ports/espressif/boards/adafruit_feather_huzzah32/sdkconfig @@ -0,0 +1,20 @@ +CONFIG_ESP32_ECO3_CACHE_LOCK_FIX=y +CONFIG_ESP32_SPIRAM_SUPPORT=n + +# Uncomment (remove ###) to send ESP_LOG output to TX/RX pins +### # +### # ESP System Settings +### # +### CONFIG_ESP_SYSTEM_PANIC_PRINT_HALT=y +### # CONFIG_ESP_SYSTEM_PANIC_SILENT_REBOOT is not set +### CONFIG_ESP_CONSOLE_UART_CUSTOM=y +### CONFIG_ESP_CONSOLE_NONE is not set +### CONFIG_ESP_CONSOLE_UART=y +### CONFIG_ESP_CONSOLE_UART_CUSTOM_NUM_0=y +### # CONFIG_ESP_CONSOLE_UART_CUSTOM_NUM_1 is not set +### CONFIG_ESP_CONSOLE_UART_NUM=0 +### CONFIG_ESP_CONSOLE_UART_TX_GPIO=17 +### CONFIG_ESP_CONSOLE_UART_RX_GPIO=16 +### CONFIG_ESP_CONSOLE_UART_BAUDRATE=115200 +### # CONFIG_ESP_SYSTEM_CHECK_INT_LEVEL_5 is not set +### # end of ESP System Settings diff --git a/ports/espressif/boards/adafruit_funhouse/board.c b/ports/espressif/boards/adafruit_funhouse/board.c index 03e967148c..d89a4db268 100644 --- a/ports/espressif/boards/adafruit_funhouse/board.c +++ b/ports/espressif/boards/adafruit_funhouse/board.c @@ -71,9 +71,6 @@ void board_init(void) { 0, // Polarity 0); // Phase - // workaround as board_init() is called before reset_port() in main.c - pwmout_reset(); - displayio_display_obj_t *display = &displays[0].display; display->base.type = &displayio_display_type; common_hal_displayio_display_construct( @@ -97,23 +94,18 @@ void board_init(void) { sizeof(display_init_sequence), &pin_GPIO21, // backlight pin NO_BRIGHTNESS_COMMAND, - 1.0f, // brightness (ignored) - true, // auto_brightness + 1.0f, // brightness false, // single_byte_bounds false, // data_as_commands true, // auto_refresh 60, // native_frames_per_second true, // backlight_on_high - false); // not SH1107 -} - -bool board_requests_safe_mode(void) { - return false; -} - -void reset_board(void) { + false, // not SH1107 + 50000); // backlight pwm frequency } void board_deinit(void) { common_hal_displayio_release_displays(); } + +// Use the MP_WEAK supervisor/shared/board.c versions of routines not defined here. diff --git a/ports/espressif/boards/adafruit_funhouse/mpconfigboard.h b/ports/espressif/boards/adafruit_funhouse/mpconfigboard.h index a6f46af978..2b2438432e 100644 --- a/ports/espressif/boards/adafruit_funhouse/mpconfigboard.h +++ b/ports/espressif/boards/adafruit_funhouse/mpconfigboard.h @@ -33,6 +33,8 @@ #define MICROPY_HW_APA102_SCK (&pin_GPIO15) #define MICROPY_HW_APA102_COUNT (5) +#define MICROPY_HW_LED_STATUS (&pin_GPIO37) + #define DEFAULT_I2C_BUS_SCL (&pin_GPIO33) #define DEFAULT_I2C_BUS_SDA (&pin_GPIO34) diff --git a/ports/espressif/boards/adafruit_funhouse/mpconfigboard.mk b/ports/espressif/boards/adafruit_funhouse/mpconfigboard.mk index fb7b969b80..8b08c94022 100644 --- a/ports/espressif/boards/adafruit_funhouse/mpconfigboard.mk +++ b/ports/espressif/boards/adafruit_funhouse/mpconfigboard.mk @@ -5,18 +5,11 @@ USB_MANUFACTURER = "Adafruit" IDF_TARGET = esp32s2 -INTERNAL_FLASH_FILESYSTEM = 1 -LONGINT_IMPL = MPZ +CIRCUITPY_ESP_FLASH_MODE = dio +CIRCUITPY_ESP_FLASH_FREQ = 40m +CIRCUITPY_ESP_FLASH_SIZE = 4MB -# The default queue depth of 16 overflows on release builds, -# so increase it to 32. -CFLAGS += -DCFG_TUD_TASK_QUEUE_SZ=32 - -CIRCUITPY_ESP_FLASH_MODE=dio -CIRCUITPY_ESP_FLASH_FREQ=40m -CIRCUITPY_ESP_FLASH_SIZE=4MB - -CIRCUITPY_MODULE=wrover +CIRCUITPY_ESP32_CAMERA = 0 # Include these Python libraries in firmware. FROZEN_MPY_DIRS += $(TOP)/frozen/Adafruit_CircuitPython_PortalBase diff --git a/ports/espressif/boards/adafruit_magtag_2.9_grayscale/board.c b/ports/espressif/boards/adafruit_magtag_2.9_grayscale/board.c index 3eee2f119b..0c85922524 100644 --- a/ports/espressif/boards/adafruit_magtag_2.9_grayscale/board.c +++ b/ports/espressif/boards/adafruit_magtag_2.9_grayscale/board.c @@ -164,14 +164,6 @@ void board_init(void) { false); // two_byte_sequence_length } -bool board_requests_safe_mode(void) { - return false; -} - -void reset_board(void) { - -} - bool espressif_board_reset_pin_number(gpio_num_t pin_number) { // Pin 16 is speaker enable and it's pulled down on the board. We don't want // to pull it high because then we'll compete with the external pull down. @@ -209,3 +201,5 @@ void board_deinit(void) { } common_hal_displayio_release_displays(); } + +// Use the MP_WEAK supervisor/shared/board.c versions of routines not defined here. diff --git a/ports/espressif/boards/adafruit_magtag_2.9_grayscale/mpconfigboard.h b/ports/espressif/boards/adafruit_magtag_2.9_grayscale/mpconfigboard.h index 9f08ca330c..2892110f6e 100644 --- a/ports/espressif/boards/adafruit_magtag_2.9_grayscale/mpconfigboard.h +++ b/ports/espressif/boards/adafruit_magtag_2.9_grayscale/mpconfigboard.h @@ -34,6 +34,8 @@ #define CIRCUITPY_STATUS_LED_POWER_INVERTED (1) #define MICROPY_HW_NEOPIXEL_COUNT (4) +#define MICROPY_HW_LED_STATUS (&pin_GPIO13) + #define DEFAULT_I2C_BUS_SCL (&pin_GPIO34) #define DEFAULT_I2C_BUS_SDA (&pin_GPIO33) diff --git a/ports/espressif/boards/adafruit_magtag_2.9_grayscale/mpconfigboard.mk b/ports/espressif/boards/adafruit_magtag_2.9_grayscale/mpconfigboard.mk index 3091d298e9..ee2bfdb069 100644 --- a/ports/espressif/boards/adafruit_magtag_2.9_grayscale/mpconfigboard.mk +++ b/ports/espressif/boards/adafruit_magtag_2.9_grayscale/mpconfigboard.mk @@ -5,18 +5,11 @@ USB_MANUFACTURER = "Adafruit" IDF_TARGET = esp32s2 -INTERNAL_FLASH_FILESYSTEM = 1 -LONGINT_IMPL = MPZ +CIRCUITPY_ESP_FLASH_MODE = dio +CIRCUITPY_ESP_FLASH_FREQ = 40m +CIRCUITPY_ESP_FLASH_SIZE = 4MB -# The default queue depth of 16 overflows on release builds, -# so increase it to 32. -CFLAGS += -DCFG_TUD_TASK_QUEUE_SZ=32 - -CIRCUITPY_ESP_FLASH_MODE=dio -CIRCUITPY_ESP_FLASH_FREQ=40m -CIRCUITPY_ESP_FLASH_SIZE=4MB - -CIRCUITPY_MODULE=wrover +CIRCUITPY_ESP32_CAMERA = 0 # Include these Python libraries in firmware. FROZEN_MPY_DIRS += $(TOP)/frozen/Adafruit_CircuitPython_PortalBase diff --git a/ports/espressif/boards/adafruit_magtag_2.9_grayscale/pins.c b/ports/espressif/boards/adafruit_magtag_2.9_grayscale/pins.c index 2aa2b11b06..1df28f8e05 100644 --- a/ports/espressif/boards/adafruit_magtag_2.9_grayscale/pins.c +++ b/ports/espressif/boards/adafruit_magtag_2.9_grayscale/pins.c @@ -37,6 +37,8 @@ STATIC const mp_rom_map_elem_t board_module_globals_table[] = { { MP_ROM_QSTR(MP_QSTR_BUTTON_D), MP_ROM_PTR(&pin_GPIO11) }, { MP_ROM_QSTR(MP_QSTR_D11), MP_ROM_PTR(&pin_GPIO11) }, + { MP_ROM_QSTR(MP_QSTR_BOOT0), MP_ROM_PTR(&pin_GPIO0) }, + { MP_ROM_QSTR(MP_QSTR_LIGHT), MP_ROM_PTR(&pin_GPIO3) }, { MP_ROM_QSTR(MP_QSTR_A3), MP_ROM_PTR(&pin_GPIO3) }, diff --git a/ports/espressif/boards/adafruit_metro_esp32s2/board.c b/ports/espressif/boards/adafruit_metro_esp32s2/board.c index 6772768da5..164430c88c 100644 --- a/ports/espressif/boards/adafruit_metro_esp32s2/board.c +++ b/ports/espressif/boards/adafruit_metro_esp32s2/board.c @@ -25,19 +25,5 @@ */ #include "supervisor/board.h" -#include "mpconfigboard.h" -#include "shared-bindings/microcontroller/Pin.h" -void board_init(void) { -} - -bool board_requests_safe_mode(void) { - return false; -} - -void reset_board(void) { - -} - -void board_deinit(void) { -} +// Use the MP_WEAK supervisor/shared/board.c versions of routines not defined here. diff --git a/ports/espressif/boards/adafruit_metro_esp32s2/mpconfigboard.h b/ports/espressif/boards/adafruit_metro_esp32s2/mpconfigboard.h index 3d9250bec1..698dc20764 100644 --- a/ports/espressif/boards/adafruit_metro_esp32s2/mpconfigboard.h +++ b/ports/espressif/boards/adafruit_metro_esp32s2/mpconfigboard.h @@ -31,6 +31,8 @@ #define MICROPY_HW_NEOPIXEL (&pin_GPIO45) +#define MICROPY_HW_LED_STATUS (&pin_GPIO42) + #define DEFAULT_I2C_BUS_SCL (&pin_GPIO34) #define DEFAULT_I2C_BUS_SDA (&pin_GPIO33) diff --git a/ports/espressif/boards/adafruit_metro_esp32s2/mpconfigboard.mk b/ports/espressif/boards/adafruit_metro_esp32s2/mpconfigboard.mk index a7204b957d..8f139315c8 100644 --- a/ports/espressif/boards/adafruit_metro_esp32s2/mpconfigboard.mk +++ b/ports/espressif/boards/adafruit_metro_esp32s2/mpconfigboard.mk @@ -5,15 +5,6 @@ USB_MANUFACTURER = "Adafruit" IDF_TARGET = esp32s2 -INTERNAL_FLASH_FILESYSTEM = 1 -LONGINT_IMPL = MPZ - -# The default queue depth of 16 overflows on release builds, -# so increase it to 32. -CFLAGS += -DCFG_TUD_TASK_QUEUE_SZ=32 - -CIRCUITPY_ESP_FLASH_MODE=dio -CIRCUITPY_ESP_FLASH_FREQ=40m -CIRCUITPY_ESP_FLASH_SIZE=4MB - -CIRCUITPY_MODULE=wrover +CIRCUITPY_ESP_FLASH_MODE = dio +CIRCUITPY_ESP_FLASH_FREQ = 40m +CIRCUITPY_ESP_FLASH_SIZE = 4MB diff --git a/ports/espressif/boards/adafruit_qtpy_esp32_pico/board.c b/ports/espressif/boards/adafruit_qtpy_esp32_pico/board.c new file mode 100644 index 0000000000..b714fd41f0 --- /dev/null +++ b/ports/espressif/boards/adafruit_qtpy_esp32_pico/board.c @@ -0,0 +1,50 @@ +/* + * This file is part of the MicroPython project, http://micropython.org/ + * + * The MIT License (MIT) + * + * Copyright (c) 2020 Scott Shawcroft for Adafruit Industries + * + * Permission is hereby granted, free of charge, to any person obtaining a copy + * of this software and associated documentation files (the "Software"), to deal + * in the Software without restriction, including without limitation the rights + * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell + * copies of the Software, and to permit persons to whom the Software is + * furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice shall be included in + * all copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE + * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER + * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, + * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN + * THE SOFTWARE. + */ + +#include "supervisor/board.h" +#include "mpconfigboard.h" +#include "shared-bindings/microcontroller/Pin.h" +#include "components/driver/include/driver/gpio.h" +#include "components/hal/include/hal/gpio_hal.h" +#include "common-hal/microcontroller/Pin.h" + +void board_init(void) { + reset_board(); +} + +void reset_board(void) { + // Turn on NeoPixel power by default. + gpio_set_direction(8, GPIO_MODE_DEF_OUTPUT); + gpio_set_level(8, true); +} + +void board_deinit(void) { + // Turn off NeoPixel + gpio_set_direction(8, GPIO_MODE_DEF_OUTPUT); + gpio_set_level(8, false); +} + +// Use the MP_WEAK supervisor/shared/board.c versions of routines not defined here. diff --git a/ports/espressif/boards/adafruit_qtpy_esp32_pico/mpconfigboard.h b/ports/espressif/boards/adafruit_qtpy_esp32_pico/mpconfigboard.h new file mode 100644 index 0000000000..42a575aa68 --- /dev/null +++ b/ports/espressif/boards/adafruit_qtpy_esp32_pico/mpconfigboard.h @@ -0,0 +1,49 @@ +/* + * This file is part of the MicroPython project, http://micropython.org/ + * + * The MIT License (MIT) + * + * Copyright (c) 2022 Dan Halbert 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. + */ + +#define MICROPY_HW_BOARD_NAME "Adafruit QT Py ESP32 PICO" +#define MICROPY_HW_MCU_NAME "ESP32" + +#define MICROPY_HW_NEOPIXEL (&pin_GPIO5) + +#define CIRCUITPY_BOARD_I2C (2) +#define CIRCUITPY_BOARD_I2C_PIN {{.scl = &pin_GPIO33, .sda = &pin_GPIO4}, \ + {.scl = &pin_GPIO19, .sda = &pin_GPIO22}} + +#define CIRCUITPY_BOARD_SPI (1) +#define CIRCUITPY_BOARD_SPI_PIN {{.clock = &pin_GPIO14, .mosi = &pin_GPIO13, .miso = &pin_GPIO12}} + +#define CIRCUITPY_BOARD_UART (1) +#define CIRCUITPY_BOARD_UART_PIN {{.tx = &pin_GPIO32, .rx = &pin_GPIO7}} + +#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") + +// UART pins attached to the USB-serial converter chip +#define CIRCUITPY_CONSOLE_UART_TX (&pin_GPIO1) +#define CIRCUITPY_CONSOLE_UART_RX (&pin_GPIO3) diff --git a/ports/espressif/boards/adafruit_qtpy_esp32_pico/mpconfigboard.mk b/ports/espressif/boards/adafruit_qtpy_esp32_pico/mpconfigboard.mk new file mode 100644 index 0000000000..de41053146 --- /dev/null +++ b/ports/espressif/boards/adafruit_qtpy_esp32_pico/mpconfigboard.mk @@ -0,0 +1,8 @@ +CIRCUITPY_CREATOR_ID = 0x0000239A +CIRCUITPY_CREATION_ID = 0x00320003 + +IDF_TARGET = esp32 + +CIRCUITPY_ESP_FLASH_MODE = dio +CIRCUITPY_ESP_FLASH_FREQ = 40m +CIRCUITPY_ESP_FLASH_SIZE = 8MB diff --git a/ports/espressif/boards/adafruit_qtpy_esp32_pico/pins.c b/ports/espressif/boards/adafruit_qtpy_esp32_pico/pins.c new file mode 100644 index 0000000000..5d760603c1 --- /dev/null +++ b/ports/espressif/boards/adafruit_qtpy_esp32_pico/pins.c @@ -0,0 +1,63 @@ +#include "shared-bindings/board/__init__.h" + +CIRCUITPY_BOARD_BUS_SINGLETON(stemma_i2c, i2c, 1) + +STATIC const mp_rom_map_elem_t board_module_globals_table[] = { + CIRCUITPYTHON_BOARD_DICT_STANDARD_ITEMS + + { MP_ROM_QSTR(MP_QSTR_BUTTON), MP_ROM_PTR(&pin_GPIO0) }, + { MP_ROM_QSTR(MP_QSTR_BOOT0), MP_ROM_PTR(&pin_GPIO0) }, + { MP_ROM_QSTR(MP_QSTR_D0), MP_ROM_PTR(&pin_GPIO0) }, + + { MP_ROM_QSTR(MP_QSTR_A0), MP_ROM_PTR(&pin_GPIO26) }, + { MP_ROM_QSTR(MP_QSTR_D18), MP_ROM_PTR(&pin_GPIO26) }, + + { MP_ROM_QSTR(MP_QSTR_A1), MP_ROM_PTR(&pin_GPIO25) }, + { MP_ROM_QSTR(MP_QSTR_D17), MP_ROM_PTR(&pin_GPIO25) }, + + { MP_ROM_QSTR(MP_QSTR_A2), MP_ROM_PTR(&pin_GPIO27) }, + { MP_ROM_QSTR(MP_QSTR_D9), MP_ROM_PTR(&pin_GPIO27) }, + + { MP_ROM_QSTR(MP_QSTR_A3), MP_ROM_PTR(&pin_GPIO15) }, + { MP_ROM_QSTR(MP_QSTR_D8), MP_ROM_PTR(&pin_GPIO15) }, + + { MP_ROM_QSTR(MP_QSTR_SDA), MP_ROM_PTR(&pin_GPIO4) }, + { MP_ROM_QSTR(MP_QSTR_D7), MP_ROM_PTR(&pin_GPIO4) }, + { MP_ROM_QSTR(MP_QSTR_A4), MP_ROM_PTR(&pin_GPIO4) }, + + { MP_ROM_QSTR(MP_QSTR_SCL), MP_ROM_PTR(&pin_GPIO33) }, + { MP_ROM_QSTR(MP_QSTR_D6), MP_ROM_PTR(&pin_GPIO33) }, + { MP_ROM_QSTR(MP_QSTR_A5), MP_ROM_PTR(&pin_GPIO33) }, + + { MP_ROM_QSTR(MP_QSTR_TX), MP_ROM_PTR(&pin_GPIO32) }, + { MP_ROM_QSTR(MP_QSTR_D5), MP_ROM_PTR(&pin_GPIO32) }, + { MP_ROM_QSTR(MP_QSTR_A6), MP_ROM_PTR(&pin_GPIO32) }, + + { MP_ROM_QSTR(MP_QSTR_RX), MP_ROM_PTR(&pin_GPIO7) }, + { MP_ROM_QSTR(MP_QSTR_D16), MP_ROM_PTR(&pin_GPIO7) }, + { MP_ROM_QSTR(MP_QSTR_A7), MP_ROM_PTR(&pin_GPIO7) }, + + { MP_ROM_QSTR(MP_QSTR_MOSI), MP_ROM_PTR(&pin_GPIO13) }, + { MP_ROM_QSTR(MP_QSTR_D35), MP_ROM_PTR(&pin_GPIO13) }, + + { MP_ROM_QSTR(MP_QSTR_SCK), MP_ROM_PTR(&pin_GPIO14) }, + { MP_ROM_QSTR(MP_QSTR_D36), MP_ROM_PTR(&pin_GPIO14) }, + + { MP_ROM_QSTR(MP_QSTR_MISO), MP_ROM_PTR(&pin_GPIO12) }, + { MP_ROM_QSTR(MP_QSTR_D37), MP_ROM_PTR(&pin_GPIO12) }, + + { MP_ROM_QSTR(MP_QSTR_NEOPIXEL_POWER), MP_ROM_PTR(&pin_GPIO8) }, + { MP_ROM_QSTR(MP_QSTR_NEOPIXEL), MP_ROM_PTR(&pin_GPIO5) }, + + { MP_ROM_QSTR(MP_QSTR_SCL1), MP_ROM_PTR(&pin_GPIO19) }, + { MP_ROM_QSTR(MP_QSTR_D40), MP_ROM_PTR(&pin_GPIO19) }, + + { MP_ROM_QSTR(MP_QSTR_SDA1), MP_ROM_PTR(&pin_GPIO22) }, + { MP_ROM_QSTR(MP_QSTR_D41), MP_ROM_PTR(&pin_GPIO22) }, + + { MP_ROM_QSTR(MP_QSTR_I2C), MP_ROM_PTR(&board_i2c_obj) }, + { MP_ROM_QSTR(MP_QSTR_STEMMA_I2C), MP_ROM_PTR(&board_stemma_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) }, +}; +MP_DEFINE_CONST_DICT(board_module_globals, board_module_globals_table); diff --git a/ports/espressif/boards/adafruit_qtpy_esp32_pico/sdkconfig b/ports/espressif/boards/adafruit_qtpy_esp32_pico/sdkconfig new file mode 100644 index 0000000000..bec9e436b7 --- /dev/null +++ b/ports/espressif/boards/adafruit_qtpy_esp32_pico/sdkconfig @@ -0,0 +1,45 @@ +# +# SPI RAM config +# +# CONFIG_SPIRAM_TYPE_AUTO is not set +CONFIG_SPIRAM_TYPE_ESPPSRAM16=y +# CONFIG_SPIRAM_TYPE_ESPPSRAM32 is not set +# CONFIG_SPIRAM_TYPE_ESPPSRAM64 is not set +CONFIG_SPIRAM_SIZE=2097152 +CONFIG_SPIRAM_SPEED_40M=y +CONFIG_SPIRAM=y +CONFIG_SPIRAM_BOOT_INIT=y +CONFIG_SPIRAM_IGNORE_NOTFOUND=y +CONFIG_SPIRAM_USE_MEMMAP=y +# CONFIG_SPIRAM_USE_CAPS_ALLOC is not set +# CONFIG_SPIRAM_USE_MALLOC is not set +CONFIG_SPIRAM_MEMTEST=y +# CONFIG_SPIRAM_ALLOW_BSS_SEG_EXTERNAL_MEMORY is not set +# CONFIG_SPIRAM_ALLOW_NOINIT_SEG_EXTERNAL_MEMORY is not set +CONFIG_SPIRAM_CACHE_WORKAROUND=y + +# +# SPI RAM config +# +CONFIG_ESP32_SPIRAM_SUPPORT=y +# CONFIG_SPIRAM_TYPE_AUTO is not set +# CONFIG_SPIRAM_TYPE_ESPPSRAM32 is not set +# CONFIG_SPIRAM_TYPE_ESPPSRAM64 is not set + +### # Uncomment (remove ###) to send ESP_LOG output to TX/RX pins +### # +### # ESP System Settings +### # +### CONFIG_ESP_SYSTEM_PANIC_PRINT_HALT=y +### # CONFIG_ESP_SYSTEM_PANIC_SILENT_REBOOT is not set +### CONFIG_ESP_CONSOLE_UART_CUSTOM=y +### # CONFIG_ESP_CONSOLE_NONE is not set +### CONFIG_ESP_CONSOLE_UART=y +### CONFIG_ESP_CONSOLE_UART_CUSTOM_NUM_0=y +### # CONFIG_ESP_CONSOLE_UART_CUSTOM_NUM_1 is not set +### CONFIG_ESP_CONSOLE_UART_NUM=0 +### CONFIG_ESP_CONSOLE_UART_TX_GPIO=32 +### CONFIG_ESP_CONSOLE_UART_RX_GPIO=7 +### CONFIG_ESP_CONSOLE_UART_BAUDRATE=115200 +### # CONFIG_ESP_SYSTEM_CHECK_INT_LEVEL_5 is not set +### # end of ESP System Settings diff --git a/ports/espressif/boards/adafruit_qtpy_esp32c3/board.c b/ports/espressif/boards/adafruit_qtpy_esp32c3/board.c index 7a9ff98fcb..e29b6b93e7 100644 --- a/ports/espressif/boards/adafruit_qtpy_esp32c3/board.c +++ b/ports/espressif/boards/adafruit_qtpy_esp32c3/board.c @@ -25,25 +25,6 @@ * THE SOFTWARE. */ -#include "shared-bindings/microcontroller/Pin.h" #include "supervisor/board.h" -#include "components/driver/include/driver/gpio.h" -#include "soc/usb_serial_jtag_struct.h" - -void board_init(void) { -} - -bool board_requests_safe_mode(void) { - return false; -} - -bool espressif_board_reset_pin_number(gpio_num_t pin_number) { - return false; -} - -void reset_board(void) { -} - -void board_deinit(void) { -} +// Use the MP_WEAK supervisor/shared/board.c versions of routines not defined here. diff --git a/ports/espressif/boards/adafruit_qtpy_esp32c3/mpconfigboard.mk b/ports/espressif/boards/adafruit_qtpy_esp32c3/mpconfigboard.mk index 36d9c3b5d6..e2ce1e438d 100644 --- a/ports/espressif/boards/adafruit_qtpy_esp32c3/mpconfigboard.mk +++ b/ports/espressif/boards/adafruit_qtpy_esp32c3/mpconfigboard.mk @@ -1,10 +1,8 @@ CIRCUITPY_CREATOR_ID = 0x0000239A -CIRCUITPY_CREATION_ID = 0x00010001 +CIRCUITPY_CREATION_ID = 0x00c30001 IDF_TARGET = esp32c3 -INTERNAL_FLASH_FILESYSTEM = 1 - -CIRCUITPY_ESP_FLASH_MODE=dio -CIRCUITPY_ESP_FLASH_FREQ=80m -CIRCUITPY_ESP_FLASH_SIZE=4MB +CIRCUITPY_ESP_FLASH_MODE = dio +CIRCUITPY_ESP_FLASH_FREQ = 80m +CIRCUITPY_ESP_FLASH_SIZE = 4MB diff --git a/ports/espressif/boards/adafruit_qtpy_esp32c3/sdkconfig b/ports/espressif/boards/adafruit_qtpy_esp32c3/sdkconfig index f9b0292400..5111900c7e 100644 --- a/ports/espressif/boards/adafruit_qtpy_esp32c3/sdkconfig +++ b/ports/espressif/boards/adafruit_qtpy_esp32c3/sdkconfig @@ -30,6 +30,14 @@ CONFIG_PARTITION_TABLE_FILENAME="esp-idf-config/partitions-4MB-no-uf2.csv" # # Component config # +# + +# +# PHY +# +CONFIG_ESP_PHY_ENABLE_USB=y +# end of PHY + # # ESP System Settings # diff --git a/ports/espressif/boards/adafruit_qtpy_esp32s2/board.c b/ports/espressif/boards/adafruit_qtpy_esp32s2/board.c index 6772768da5..164430c88c 100644 --- a/ports/espressif/boards/adafruit_qtpy_esp32s2/board.c +++ b/ports/espressif/boards/adafruit_qtpy_esp32s2/board.c @@ -25,19 +25,5 @@ */ #include "supervisor/board.h" -#include "mpconfigboard.h" -#include "shared-bindings/microcontroller/Pin.h" -void board_init(void) { -} - -bool board_requests_safe_mode(void) { - return false; -} - -void reset_board(void) { - -} - -void board_deinit(void) { -} +// Use the MP_WEAK supervisor/shared/board.c versions of routines not defined here. diff --git a/ports/espressif/boards/adafruit_qtpy_esp32s2/mpconfigboard.mk b/ports/espressif/boards/adafruit_qtpy_esp32s2/mpconfigboard.mk index d415e140cb..f1bd7652fe 100644 --- a/ports/espressif/boards/adafruit_qtpy_esp32s2/mpconfigboard.mk +++ b/ports/espressif/boards/adafruit_qtpy_esp32s2/mpconfigboard.mk @@ -6,15 +6,6 @@ USB_MANUFACTURER = "Adafruit" IDF_TARGET = esp32s2 -INTERNAL_FLASH_FILESYSTEM = 1 -LONGINT_IMPL = MPZ - -# The default queue depth of 16 overflows on release builds, -# so increase it to 32. -CFLAGS += -DCFG_TUD_TASK_QUEUE_SZ=32 - -CIRCUITPY_ESP_FLASH_MODE=dio -CIRCUITPY_ESP_FLASH_FREQ=40m -CIRCUITPY_ESP_FLASH_SIZE=4MB - -CIRCUITPY_MODULE=wroom +CIRCUITPY_ESP_FLASH_MODE = dio +CIRCUITPY_ESP_FLASH_FREQ = 40m +CIRCUITPY_ESP_FLASH_SIZE = 4MB diff --git a/ports/espressif/boards/adafruit_qtpy_esp32s3_nopsram/board.c b/ports/espressif/boards/adafruit_qtpy_esp32s3_nopsram/board.c index ff9418ec86..3b1f5efd87 100644 --- a/ports/espressif/boards/adafruit_qtpy_esp32s3_nopsram/board.c +++ b/ports/espressif/boards/adafruit_qtpy_esp32s3_nopsram/board.c @@ -36,13 +36,4 @@ void board_init(void) { #endif } -bool board_requests_safe_mode(void) { - return false; -} - -void reset_board(void) { - -} - -void board_deinit(void) { -} +// Use the MP_WEAK supervisor/shared/board.c versions of routines not defined here. diff --git a/ports/espressif/boards/adafruit_qtpy_esp32s3_nopsram/mpconfigboard.mk b/ports/espressif/boards/adafruit_qtpy_esp32s3_nopsram/mpconfigboard.mk index 657855cad8..15dd51e5ff 100644 --- a/ports/espressif/boards/adafruit_qtpy_esp32s3_nopsram/mpconfigboard.mk +++ b/ports/espressif/boards/adafruit_qtpy_esp32s3_nopsram/mpconfigboard.mk @@ -6,17 +6,11 @@ USB_MANUFACTURER = "Adafruit" IDF_TARGET = esp32s3 -INTERNAL_FLASH_FILESYSTEM = 1 -LONGINT_IMPL = MPZ - -# The default queue depth of 16 overflows on release builds, -# so increase it to 32. -CFLAGS += -DCFG_TUD_TASK_QUEUE_SZ=32 - -CIRCUITPY_ESP_FLASH_MODE=dio -CIRCUITPY_ESP_FLASH_FREQ=80m -CIRCUITPY_ESP_FLASH_SIZE=8MB +CIRCUITPY_ESP_FLASH_MODE = dio +CIRCUITPY_ESP_FLASH_FREQ = 80m +CIRCUITPY_ESP_FLASH_SIZE = 8MB FROZEN_MPY_DIRS += $(TOP)/frozen/Adafruit_CircuitPython_Requests FROZEN_MPY_DIRS += $(TOP)/frozen/Adafruit_CircuitPython_NeoPixel FROZEN_MPY_DIRS += $(TOP)/frozen/Adafruit_CircuitPython_Register +CIRCUITPY_ESP32_CAMERA = 0 diff --git a/ports/espressif/boards/ai_thinker_esp32-c3s-2m/board.c b/ports/espressif/boards/ai_thinker_esp32-c3s-2m/board.c index 7dd29fd6f6..2e09e7d9a4 100644 --- a/ports/espressif/boards/ai_thinker_esp32-c3s-2m/board.c +++ b/ports/espressif/boards/ai_thinker_esp32-c3s-2m/board.c @@ -43,10 +43,6 @@ void board_init(void) { USB_SERIAL_JTAG.conf0.dp_pullup = 0; } -bool board_requests_safe_mode(void) { - return false; -} - bool espressif_board_reset_pin_number(gpio_num_t pin_number) { // Pull LEDs down on reset rather than the default up if (pin_number == 3 || pin_number == 4 || pin_number == 5 || pin_number == 18 || pin_number == 19) { @@ -63,8 +59,4 @@ bool espressif_board_reset_pin_number(gpio_num_t pin_number) { return false; } -void reset_board(void) { -} - -void board_deinit(void) { -} +// Use the MP_WEAK supervisor/shared/board.c versions of routines not defined here. diff --git a/ports/espressif/boards/ai_thinker_esp32-c3s-2m/mpconfigboard.h b/ports/espressif/boards/ai_thinker_esp32-c3s-2m/mpconfigboard.h index d7a81502fa..a42f8b0436 100644 --- a/ports/espressif/boards/ai_thinker_esp32-c3s-2m/mpconfigboard.h +++ b/ports/espressif/boards/ai_thinker_esp32-c3s-2m/mpconfigboard.h @@ -37,5 +37,5 @@ #define DEFAULT_UART_BUS_TX (&pin_GPIO21) // Serial over UART -#define CIRCUITPY_DEBUG_UART_RX DEFAULT_UART_BUS_RX -#define CIRCUITPY_DEBUG_UART_TX DEFAULT_UART_BUS_TX +#define CIRCUITPY_CONSOLE_UART_RX DEFAULT_UART_BUS_RX +#define CIRCUITPY_CONSOLE_UART_TX DEFAULT_UART_BUS_TX diff --git a/ports/espressif/boards/ai_thinker_esp32-c3s-2m/mpconfigboard.mk b/ports/espressif/boards/ai_thinker_esp32-c3s-2m/mpconfigboard.mk index 6d7a58ea5c..3cec6831bc 100644 --- a/ports/espressif/boards/ai_thinker_esp32-c3s-2m/mpconfigboard.mk +++ b/ports/espressif/boards/ai_thinker_esp32-c3s-2m/mpconfigboard.mk @@ -1,10 +1,8 @@ -CIRCUITPY_CREATOR_ID = 0x70010001 -CIRCUITPY_CREATION_ID = 0x00100001 +CIRCUITPY_CREATOR_ID = 0x000C303B +CIRCUITPY_CREATION_ID = 0x00C30001 IDF_TARGET = esp32c3 -INTERNAL_FLASH_FILESYSTEM = 1 - -CIRCUITPY_ESP_FLASH_MODE=dio -CIRCUITPY_ESP_FLASH_FREQ=80m -CIRCUITPY_ESP_FLASH_SIZE=2MB +CIRCUITPY_ESP_FLASH_MODE = dio +CIRCUITPY_ESP_FLASH_FREQ = 80m +CIRCUITPY_ESP_FLASH_SIZE = 2MB diff --git a/ports/espressif/boards/ai_thinker_esp32-c3s/board.c b/ports/espressif/boards/ai_thinker_esp32-c3s/board.c index 7dd29fd6f6..2e09e7d9a4 100644 --- a/ports/espressif/boards/ai_thinker_esp32-c3s/board.c +++ b/ports/espressif/boards/ai_thinker_esp32-c3s/board.c @@ -43,10 +43,6 @@ void board_init(void) { USB_SERIAL_JTAG.conf0.dp_pullup = 0; } -bool board_requests_safe_mode(void) { - return false; -} - bool espressif_board_reset_pin_number(gpio_num_t pin_number) { // Pull LEDs down on reset rather than the default up if (pin_number == 3 || pin_number == 4 || pin_number == 5 || pin_number == 18 || pin_number == 19) { @@ -63,8 +59,4 @@ bool espressif_board_reset_pin_number(gpio_num_t pin_number) { return false; } -void reset_board(void) { -} - -void board_deinit(void) { -} +// Use the MP_WEAK supervisor/shared/board.c versions of routines not defined here. diff --git a/ports/espressif/boards/ai_thinker_esp32-c3s/mpconfigboard.h b/ports/espressif/boards/ai_thinker_esp32-c3s/mpconfigboard.h index 0b8a3b0ae8..20fb1ff022 100644 --- a/ports/espressif/boards/ai_thinker_esp32-c3s/mpconfigboard.h +++ b/ports/espressif/boards/ai_thinker_esp32-c3s/mpconfigboard.h @@ -37,5 +37,5 @@ #define DEFAULT_UART_BUS_TX (&pin_GPIO21) // Serial over UART -#define CIRCUITPY_DEBUG_UART_RX DEFAULT_UART_BUS_RX -#define CIRCUITPY_DEBUG_UART_TX DEFAULT_UART_BUS_TX +#define CIRCUITPY_CONSOLE_UART_RX DEFAULT_UART_BUS_RX +#define CIRCUITPY_CONSOLE_UART_TX DEFAULT_UART_BUS_TX diff --git a/ports/espressif/boards/ai_thinker_esp32-c3s/mpconfigboard.mk b/ports/espressif/boards/ai_thinker_esp32-c3s/mpconfigboard.mk index 3a83ab500b..3597166303 100644 --- a/ports/espressif/boards/ai_thinker_esp32-c3s/mpconfigboard.mk +++ b/ports/espressif/boards/ai_thinker_esp32-c3s/mpconfigboard.mk @@ -1,10 +1,8 @@ -CIRCUITPY_CREATOR_ID = 0x70010001 -CIRCUITPY_CREATION_ID = 0x00100001 +CIRCUITPY_CREATOR_ID = 0x000C303B +CIRCUITPY_CREATION_ID = 0x00C30002 IDF_TARGET = esp32c3 -INTERNAL_FLASH_FILESYSTEM = 1 - -CIRCUITPY_ESP_FLASH_MODE=qio -CIRCUITPY_ESP_FLASH_FREQ=80m -CIRCUITPY_ESP_FLASH_SIZE=4MB +CIRCUITPY_ESP_FLASH_MODE = qio +CIRCUITPY_ESP_FLASH_FREQ = 80m +CIRCUITPY_ESP_FLASH_SIZE = 4MB diff --git a/ports/espressif/boards/ai_thinker_esp_12k_nodemcu/board.c b/ports/espressif/boards/ai_thinker_esp_12k_nodemcu/board.c index 0432485111..b3c8cb4191 100644 --- a/ports/espressif/boards/ai_thinker_esp_12k_nodemcu/board.c +++ b/ports/espressif/boards/ai_thinker_esp_12k_nodemcu/board.c @@ -36,13 +36,4 @@ void board_init(void) { #endif /* DEBUG */ } -bool board_requests_safe_mode(void) { - return false; -} - -void reset_board(void) { - -} - -void board_deinit(void) { -} +// Use the MP_WEAK supervisor/shared/board.c versions of routines not defined here. diff --git a/ports/espressif/boards/ai_thinker_esp_12k_nodemcu/mpconfigboard.mk b/ports/espressif/boards/ai_thinker_esp_12k_nodemcu/mpconfigboard.mk index 1883b1fbfa..4ec2175eca 100644 --- a/ports/espressif/boards/ai_thinker_esp_12k_nodemcu/mpconfigboard.mk +++ b/ports/espressif/boards/ai_thinker_esp_12k_nodemcu/mpconfigboard.mk @@ -5,15 +5,6 @@ USB_MANUFACTURER = "Ai-Thinker" IDF_TARGET = esp32s2 -INTERNAL_FLASH_FILESYSTEM = 1 -LONGINT_IMPL = MPZ - -# The default queue depth of 16 overflows on release builds, -# so increase it to 32. -CFLAGS += -DCFG_TUD_TASK_QUEUE_SZ=32 - -CIRCUITPY_ESP_FLASH_MODE=dio -CIRCUITPY_ESP_FLASH_FREQ=40m -CIRCUITPY_ESP_FLASH_SIZE=4MB - -CIRCUITPY_MODULE=wrover +CIRCUITPY_ESP_FLASH_MODE = dio +CIRCUITPY_ESP_FLASH_FREQ = 40m +CIRCUITPY_ESP_FLASH_SIZE = 4MB diff --git a/ports/espressif/boards/artisense_rd00/board.c b/ports/espressif/boards/artisense_rd00/board.c index ea363f6b54..fb3f6befc9 100644 --- a/ports/espressif/boards/artisense_rd00/board.c +++ b/ports/espressif/boards/artisense_rd00/board.c @@ -39,14 +39,3 @@ void board_init(void) { common_hal_never_reset_pin(&pin_GPIO15); common_hal_never_reset_pin(&pin_GPIO16); } - -bool board_requests_safe_mode(void) { - return false; -} - -void reset_board(void) { - -} - -void board_deinit(void) { -} diff --git a/ports/espressif/boards/artisense_rd00/mpconfigboard.mk b/ports/espressif/boards/artisense_rd00/mpconfigboard.mk index 1f9d037ef2..1011143972 100644 --- a/ports/espressif/boards/artisense_rd00/mpconfigboard.mk +++ b/ports/espressif/boards/artisense_rd00/mpconfigboard.mk @@ -5,15 +5,6 @@ USB_MANUFACTURER = "Artisense" IDF_TARGET = esp32s2 -INTERNAL_FLASH_FILESYSTEM = 1 -LONGINT_IMPL = MPZ - -# The default queue depth of 16 overflows on release builds, -# so increase it to 32. -CFLAGS += -DCFG_TUD_TASK_QUEUE_SZ=32 - -CIRCUITPY_ESP_FLASH_MODE=dio -CIRCUITPY_ESP_FLASH_FREQ=40m -CIRCUITPY_ESP_FLASH_SIZE=4MB - -CIRCUITPY_MODULE=wrover +CIRCUITPY_ESP_FLASH_MODE = dio +CIRCUITPY_ESP_FLASH_FREQ = 40m +CIRCUITPY_ESP_FLASH_SIZE = 4MB diff --git a/ports/espressif/boards/atmegazero_esp32s2/board.c b/ports/espressif/boards/atmegazero_esp32s2/board.c index 0432485111..b3c8cb4191 100644 --- a/ports/espressif/boards/atmegazero_esp32s2/board.c +++ b/ports/espressif/boards/atmegazero_esp32s2/board.c @@ -36,13 +36,4 @@ void board_init(void) { #endif /* DEBUG */ } -bool board_requests_safe_mode(void) { - return false; -} - -void reset_board(void) { - -} - -void board_deinit(void) { -} +// Use the MP_WEAK supervisor/shared/board.c versions of routines not defined here. diff --git a/ports/espressif/boards/atmegazero_esp32s2/mpconfigboard.mk b/ports/espressif/boards/atmegazero_esp32s2/mpconfigboard.mk index 79246b1393..53593be38b 100644 --- a/ports/espressif/boards/atmegazero_esp32s2/mpconfigboard.mk +++ b/ports/espressif/boards/atmegazero_esp32s2/mpconfigboard.mk @@ -5,13 +5,6 @@ USB_MANUFACTURER = "ATMegaZero" IDF_TARGET = esp32s2 -INTERNAL_FLASH_FILESYSTEM = 1 -LONGINT_IMPL = MPZ - -# The default queue depth of 16 overflows on release builds, -# so increase it to 32. -CFLAGS += -DCFG_TUD_TASK_QUEUE_SZ=32 - -CIRCUITPY_ESP_FLASH_MODE=qio -CIRCUITPY_ESP_FLASH_FREQ=40m -CIRCUITPY_ESP_FLASH_SIZE=16MB +CIRCUITPY_ESP_FLASH_MODE = qio +CIRCUITPY_ESP_FLASH_FREQ = 40m +CIRCUITPY_ESP_FLASH_SIZE = 16MB diff --git a/ports/espressif/boards/beetle-esp32-c3/README.md b/ports/espressif/boards/beetle-esp32-c3/README.md new file mode 100644 index 0000000000..e69de29bb2 diff --git a/ports/espressif/boards/beetle-esp32-c3/board.c b/ports/espressif/boards/beetle-esp32-c3/board.c new file mode 100644 index 0000000000..164430c88c --- /dev/null +++ b/ports/espressif/boards/beetle-esp32-c3/board.c @@ -0,0 +1,29 @@ +/* + * This file is part of the MicroPython project, http://micropython.org/ + * + * The MIT License (MIT) + * + * Copyright (c) 2020 Scott Shawcroft for Adafruit Industries + * + * Permission is hereby granted, free of charge, to any person obtaining a copy + * of this software and associated documentation files (the "Software"), to deal + * in the Software without restriction, including without limitation the rights + * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell + * copies of the Software, and to permit persons to whom the Software is + * furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice shall be included in + * all copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE + * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER + * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, + * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN + * THE SOFTWARE. + */ + +#include "supervisor/board.h" + +// Use the MP_WEAK supervisor/shared/board.c versions of routines not defined here. diff --git a/ports/espressif/boards/beetle-esp32-c3/mpconfigboard.h b/ports/espressif/boards/beetle-esp32-c3/mpconfigboard.h new file mode 100644 index 0000000000..3b1caff2e9 --- /dev/null +++ b/ports/espressif/boards/beetle-esp32-c3/mpconfigboard.h @@ -0,0 +1,47 @@ +/* + * This file is part of the MicroPython project, http://micropython.org/ + * + * The MIT License (MIT) + * + * Copyright (c) 2019 Scott Shawcroft for Adafruit Industries + * + * Permission is hereby granted, free of charge, to any person obtaining a copy + * of this software and associated documentation files (the "Software"), to deal + * in the Software without restriction, including without limitation the rights + * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell + * copies of the Software, and to permit persons to whom the Software is + * furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice shall be included in + * all copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE + * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER + * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, + * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN + * THE SOFTWARE. + */ + +// Board setup + +#define MICROPY_HW_BOARD_NAME "DFRobot Beetle ESP32-C3" +#define MICROPY_HW_MCU_NAME "ESP32-C3FN4" + +// Status LED +#define MICROPY_HW_LED_STATUS (&pin_GPIO10) + +#define CIRCUITPY_BOARD_I2C (1) +#define CIRCUITPY_BOARD_I2C_PIN {{.scl = &pin_GPIO9, .sda = &pin_GPIO8}} + +#define CIRCUITPY_BOARD_SPI (1) +#define CIRCUITPY_BOARD_SPI_PIN {{.clock = &pin_GPIO4, .mosi = &pin_GPIO6, .miso = &pin_GPIO5}} + +#define CIRCUITPY_BOARD_UART (1) +#define CIRCUITPY_BOARD_UART_PIN {{.tx = &pin_GPIO21, .rx = &pin_GPIO20}} + +// Explanation of how a user got into safe mode +#define BOARD_USER_SAFE_MODE_ACTION translate("pressing boot button at start up.\n") + +#define CIRCUITPY_ESP_USB_SERIAL_JTAG (1) diff --git a/ports/espressif/boards/beetle-esp32-c3/mpconfigboard.mk b/ports/espressif/boards/beetle-esp32-c3/mpconfigboard.mk new file mode 100644 index 0000000000..b3fc9f5252 --- /dev/null +++ b/ports/espressif/boards/beetle-esp32-c3/mpconfigboard.mk @@ -0,0 +1,9 @@ +# TODO +CIRCUITPY_CREATOR_ID = 0x10101010 +CIRCUITPY_CREATION_ID = 0x00C30001 + +IDF_TARGET = esp32c3 + +CIRCUITPY_ESP_FLASH_MODE=qio +CIRCUITPY_ESP_FLASH_FREQ=80m +CIRCUITPY_ESP_FLASH_SIZE=4MB diff --git a/ports/espressif/boards/beetle-esp32-c3/pins.c b/ports/espressif/boards/beetle-esp32-c3/pins.c new file mode 100644 index 0000000000..f9060cc306 --- /dev/null +++ b/ports/espressif/boards/beetle-esp32-c3/pins.c @@ -0,0 +1,66 @@ +#include "shared-bindings/board/__init__.h" + +STATIC const mp_rom_map_elem_t board_module_globals_table[] = { + CIRCUITPYTHON_BOARD_DICT_STANDARD_ITEMS + + + { MP_ROM_QSTR(MP_QSTR_IO0), MP_ROM_PTR(&pin_GPIO0) }, + { MP_ROM_QSTR(MP_QSTR_A0), MP_ROM_PTR(&pin_GPIO0) }, // ADC1_0 + { MP_ROM_QSTR(MP_QSTR_D0), MP_ROM_PTR(&pin_GPIO0) }, + + { MP_ROM_QSTR(MP_QSTR_IO1), MP_ROM_PTR(&pin_GPIO1) }, + { MP_ROM_QSTR(MP_QSTR_A1), MP_ROM_PTR(&pin_GPIO1) }, // ADC1_1 + { MP_ROM_QSTR(MP_QSTR_D1), MP_ROM_PTR(&pin_GPIO1) }, + + { MP_ROM_QSTR(MP_QSTR_IO2), MP_ROM_PTR(&pin_GPIO2) }, + { MP_ROM_QSTR(MP_QSTR_A2), MP_ROM_PTR(&pin_GPIO2) }, // ADC1_2 + { MP_ROM_QSTR(MP_QSTR_D2), MP_ROM_PTR(&pin_GPIO2) }, + + // Pad on Board + { MP_ROM_QSTR(MP_QSTR_IO3), MP_ROM_PTR(&pin_GPIO3) }, + { MP_ROM_QSTR(MP_QSTR_A3), MP_ROM_PTR(&pin_GPIO3) }, // ADC1_3 + { MP_ROM_QSTR(MP_QSTR_D3), MP_ROM_PTR(&pin_GPIO3) }, + + { MP_ROM_QSTR(MP_QSTR_IO4), MP_ROM_PTR(&pin_GPIO4) }, + { MP_ROM_QSTR(MP_QSTR_A4), MP_ROM_PTR(&pin_GPIO4) }, // ADC1_4, JTAG MTMS + { MP_ROM_QSTR(MP_QSTR_SCK), MP_ROM_PTR(&pin_GPIO4) }, + { MP_ROM_QSTR(MP_QSTR_D4), MP_ROM_PTR(&pin_GPIO4) }, + + { MP_ROM_QSTR(MP_QSTR_IO5), MP_ROM_PTR(&pin_GPIO5) }, + { MP_ROM_QSTR(MP_QSTR_A5), MP_ROM_PTR(&pin_GPIO5) }, // JTAG MTDI + { MP_ROM_QSTR(MP_QSTR_MISO), MP_ROM_PTR(&pin_GPIO5) }, + { MP_ROM_QSTR(MP_QSTR_D5), MP_ROM_PTR(&pin_GPIO5) }, + + { MP_ROM_QSTR(MP_QSTR_IO6), MP_ROM_PTR(&pin_GPIO6) }, // JTAG MTCK + { MP_ROM_QSTR(MP_QSTR_MOSI), MP_ROM_PTR(&pin_GPIO6) }, + { MP_ROM_QSTR(MP_QSTR_D6), MP_ROM_PTR(&pin_GPIO6) }, + + { MP_ROM_QSTR(MP_QSTR_IO7), MP_ROM_PTR(&pin_GPIO7) }, // JTAG MTDO + { MP_ROM_QSTR(MP_QSTR_D7), MP_ROM_PTR(&pin_GPIO7) }, + + { MP_ROM_QSTR(MP_QSTR_IO8), MP_ROM_PTR(&pin_GPIO8) }, + { MP_ROM_QSTR(MP_QSTR_D8), MP_ROM_PTR(&pin_GPIO8) }, + { MP_ROM_QSTR(MP_QSTR_SDA), MP_ROM_PTR(&pin_GPIO8) }, + + + { MP_ROM_QSTR(MP_QSTR_IO9), MP_ROM_PTR(&pin_GPIO9) }, + { MP_ROM_QSTR(MP_QSTR_D9), MP_ROM_PTR(&pin_GPIO9) }, + { MP_ROM_QSTR(MP_QSTR_SCL), MP_ROM_PTR(&pin_GPIO9) }, + + { MP_ROM_QSTR(MP_QSTR_IO10), MP_ROM_PTR(&pin_GPIO10) }, + { MP_ROM_QSTR(MP_QSTR_LED), MP_ROM_PTR(&pin_GPIO10) }, + { MP_ROM_QSTR(MP_QSTR_D10), MP_ROM_PTR(&pin_GPIO10) }, + + { MP_ROM_QSTR(MP_QSTR_IO20), MP_ROM_PTR(&pin_GPIO20) }, + { MP_ROM_QSTR(MP_QSTR_A7), MP_ROM_PTR(&pin_GPIO20) }, + { MP_ROM_QSTR(MP_QSTR_RX), MP_ROM_PTR(&pin_GPIO20) }, + + { MP_ROM_QSTR(MP_QSTR_IO21), MP_ROM_PTR(&pin_GPIO21) }, + { MP_ROM_QSTR(MP_QSTR_A6), MP_ROM_PTR(&pin_GPIO21) }, + { MP_ROM_QSTR(MP_QSTR_TX), MP_ROM_PTR(&pin_GPIO21) }, + + { 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) }, +}; +MP_DEFINE_CONST_DICT(board_module_globals, board_module_globals_table); diff --git a/ports/espressif/boards/beetle-esp32-c3/sdkconfig b/ports/espressif/boards/beetle-esp32-c3/sdkconfig new file mode 100644 index 0000000000..331a5d14dc --- /dev/null +++ b/ports/espressif/boards/beetle-esp32-c3/sdkconfig @@ -0,0 +1,13 @@ +# +# PHY +# +CONFIG_ESP_PHY_ENABLE_USB=y +# end of PHY + +# +# LWIP +# +CONFIG_LWIP_LOCAL_HOSTNAME="beetle-esp32-c3 +# end of LWIP + + diff --git a/ports/espressif/boards/bpi_bit_s2/board.c b/ports/espressif/boards/bpi_bit_s2/board.c new file mode 100644 index 0000000000..22cdb31898 --- /dev/null +++ b/ports/espressif/boards/bpi_bit_s2/board.c @@ -0,0 +1,38 @@ +/* + * This file is part of the MicroPython project, http://micropython.org/ + * + * The MIT License (MIT) + * + * Copyright (c) 2020 Scott Shawcroft for Adafruit Industries + * + * Permission is hereby granted, free of charge, to any person obtaining a copy + * of this software and associated documentation files (the "Software"), to deal + * in the Software without restriction, including without limitation the rights + * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell + * copies of the Software, and to permit persons to whom the Software is + * furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice shall be included in + * all copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE + * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER + * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, + * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN + * THE SOFTWARE. + */ + +#include "supervisor/board.h" +#include "mpconfigboard.h" +#include "shared-bindings/microcontroller/Pin.h" + +void board_init(void) { + // Debug UART + #ifdef DEBUG + common_hal_never_reset_pin(&pin_GPIO43); + common_hal_never_reset_pin(&pin_GPIO44); + #endif /* DEBUG */ +} +// Use the MP_WEAK supervisor/shared/board.c versions of routines not defined here. diff --git a/shared-bindings/multiterminal/__init__.h b/ports/espressif/boards/bpi_bit_s2/mpconfigboard.h similarity index 69% rename from shared-bindings/multiterminal/__init__.h rename to ports/espressif/boards/bpi_bit_s2/mpconfigboard.h index 7c28842630..5225325454 100644 --- a/shared-bindings/multiterminal/__init__.h +++ b/ports/espressif/boards/bpi_bit_s2/mpconfigboard.h @@ -3,7 +3,7 @@ * * The MIT License (MIT) * - * Copyright (c) 2017 Scott Shawcroft for Adafruit Industries + * Copyright (c) 2019 Scott Shawcroft for Adafruit Industries * * Permission is hereby granted, free of charge, to any person obtaining a copy * of this software and associated documentation files (the "Software"), to deal @@ -24,14 +24,19 @@ * THE SOFTWARE. */ -#ifndef SHARED_BINDINGS_MULTITERMINAL___INIT___H -#define SHARED_BINDINGS_MULTITERMINAL___INIT___H +// Micropython setup -#include "py/obj.h" +#define MICROPY_HW_BOARD_NAME "BPI-Bit-S2" +#define MICROPY_HW_MCU_NAME "ESP32S2" -void common_hal_multiterminal_schedule_secondary_terminal_read(mp_obj_t socket); -mp_obj_t common_hal_multiterminal_get_secondary_terminal(); -void common_hal_multiterminal_set_secondary_terminal(mp_obj_t secondary_terminal); -void common_hal_multiterminal_clear_secondary_terminal(); +// #define MICROPY_HW_NEOPIXEL (&pin_GPIO18) -#endif // SHARED_BINDINGS_MULTITERMINAL___INIT___H +#define DEFAULT_I2C_BUS_SCL (&pin_GPIO16) +#define DEFAULT_I2C_BUS_SDA (&pin_GPIO15) + +#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) diff --git a/ports/espressif/boards/bpi_bit_s2/mpconfigboard.mk b/ports/espressif/boards/bpi_bit_s2/mpconfigboard.mk new file mode 100644 index 0000000000..2c793ba5fb --- /dev/null +++ b/ports/espressif/boards/bpi_bit_s2/mpconfigboard.mk @@ -0,0 +1,13 @@ +USB_VID = 0x303A +USB_PID = 0x80E6 +USB_PRODUCT = "BPI-Bit-S2" +USB_MANUFACTURER = "BananaPi" + +IDF_TARGET = esp32s2 + +CIRCUITPY_ESP_FLASH_MODE=dio +CIRCUITPY_ESP_FLASH_FREQ=40m +CIRCUITPY_ESP_FLASH_SIZE=4MB + +# Include these Python libraries in firmware. +FROZEN_MPY_DIRS += $(TOP)/frozen/Adafruit_CircuitPython_NeoPixel diff --git a/ports/espressif/boards/bpi_bit_s2/pins.c b/ports/espressif/boards/bpi_bit_s2/pins.c new file mode 100644 index 0000000000..4b14bbd79e --- /dev/null +++ b/ports/espressif/boards/bpi_bit_s2/pins.c @@ -0,0 +1,105 @@ +#include "shared-bindings/board/__init__.h" + +STATIC const mp_rom_map_elem_t board_module_globals_table[] = { + CIRCUITPYTHON_BOARD_DICT_STANDARD_ITEMS + + { MP_ROM_QSTR(MP_QSTR_IO0), MP_ROM_PTR(&pin_GPIO17) }, + { MP_ROM_QSTR(MP_QSTR_A0), MP_ROM_PTR(&pin_GPIO17) }, + { MP_ROM_QSTR(MP_QSTR_D0), MP_ROM_PTR(&pin_GPIO17) }, + { MP_ROM_QSTR(MP_QSTR_DAC1), MP_ROM_PTR(&pin_GPIO17) }, + { MP_ROM_QSTR(MP_QSTR_BUZZER), MP_ROM_PTR(&pin_GPIO17) }, + + { MP_ROM_QSTR(MP_QSTR_IO1), MP_ROM_PTR(&pin_GPIO1) }, + { MP_ROM_QSTR(MP_QSTR_A1), MP_ROM_PTR(&pin_GPIO1) }, + { MP_ROM_QSTR(MP_QSTR_D1), MP_ROM_PTR(&pin_GPIO1) }, + + { MP_ROM_QSTR(MP_QSTR_IO2), MP_ROM_PTR(&pin_GPIO2) }, + { MP_ROM_QSTR(MP_QSTR_A2), MP_ROM_PTR(&pin_GPIO2) }, + { MP_ROM_QSTR(MP_QSTR_D2), MP_ROM_PTR(&pin_GPIO2) }, + + { MP_ROM_QSTR(MP_QSTR_IO3), MP_ROM_PTR(&pin_GPIO3) }, + { MP_ROM_QSTR(MP_QSTR_A3), MP_ROM_PTR(&pin_GPIO3) }, + { MP_ROM_QSTR(MP_QSTR_D3), MP_ROM_PTR(&pin_GPIO3) }, + + { MP_ROM_QSTR(MP_QSTR_IO4), MP_ROM_PTR(&pin_GPIO4) }, + { MP_ROM_QSTR(MP_QSTR_A4), MP_ROM_PTR(&pin_GPIO4) }, + { MP_ROM_QSTR(MP_QSTR_D4), MP_ROM_PTR(&pin_GPIO4) }, + + { MP_ROM_QSTR(MP_QSTR_IO5), MP_ROM_PTR(&pin_GPIO5) }, + { MP_ROM_QSTR(MP_QSTR_A5), MP_ROM_PTR(&pin_GPIO5) }, + { MP_ROM_QSTR(MP_QSTR_D5), MP_ROM_PTR(&pin_GPIO5) }, + + { MP_ROM_QSTR(MP_QSTR_IO6), MP_ROM_PTR(&pin_GPIO6) }, + { MP_ROM_QSTR(MP_QSTR_A6), MP_ROM_PTR(&pin_GPIO6) }, + { MP_ROM_QSTR(MP_QSTR_D6), MP_ROM_PTR(&pin_GPIO6) }, + + { MP_ROM_QSTR(MP_QSTR_IO7), MP_ROM_PTR(&pin_GPIO7) }, + { MP_ROM_QSTR(MP_QSTR_A7), MP_ROM_PTR(&pin_GPIO7) }, + { MP_ROM_QSTR(MP_QSTR_D7), MP_ROM_PTR(&pin_GPIO7) }, + + { MP_ROM_QSTR(MP_QSTR_IO8), MP_ROM_PTR(&pin_GPIO8) }, + { MP_ROM_QSTR(MP_QSTR_A8), MP_ROM_PTR(&pin_GPIO8) }, + { MP_ROM_QSTR(MP_QSTR_D8), MP_ROM_PTR(&pin_GPIO8) }, + + { MP_ROM_QSTR(MP_QSTR_IO9), MP_ROM_PTR(&pin_GPIO9) }, + { MP_ROM_QSTR(MP_QSTR_A9), MP_ROM_PTR(&pin_GPIO9) }, + { MP_ROM_QSTR(MP_QSTR_D9), MP_ROM_PTR(&pin_GPIO9) }, + + { MP_ROM_QSTR(MP_QSTR_IO10), MP_ROM_PTR(&pin_GPIO10) }, + { MP_ROM_QSTR(MP_QSTR_A10), MP_ROM_PTR(&pin_GPIO10) }, + { MP_ROM_QSTR(MP_QSTR_D10), MP_ROM_PTR(&pin_GPIO10) }, + + { MP_ROM_QSTR(MP_QSTR_IO11), MP_ROM_PTR(&pin_GPIO11) }, + { MP_ROM_QSTR(MP_QSTR_A11), MP_ROM_PTR(&pin_GPIO11) }, + { MP_ROM_QSTR(MP_QSTR_D11), MP_ROM_PTR(&pin_GPIO11) }, + + { MP_ROM_QSTR(MP_QSTR_IO12), MP_ROM_PTR(&pin_GPIO21) }, + { MP_ROM_QSTR(MP_QSTR_D12), MP_ROM_PTR(&pin_GPIO21) }, + + { MP_ROM_QSTR(MP_QSTR_IO13), MP_ROM_PTR(&pin_GPIO36) }, + { MP_ROM_QSTR(MP_QSTR_SCK), MP_ROM_PTR(&pin_GPIO36) }, + { MP_ROM_QSTR(MP_QSTR_D13), MP_ROM_PTR(&pin_GPIO36) }, + + { MP_ROM_QSTR(MP_QSTR_IO14), MP_ROM_PTR(&pin_GPIO37) }, + { MP_ROM_QSTR(MP_QSTR_MISO), MP_ROM_PTR(&pin_GPIO37) }, + { MP_ROM_QSTR(MP_QSTR_D14), MP_ROM_PTR(&pin_GPIO37) }, + + { MP_ROM_QSTR(MP_QSTR_IO15), MP_ROM_PTR(&pin_GPIO35) }, + { MP_ROM_QSTR(MP_QSTR_MOSI), MP_ROM_PTR(&pin_GPIO35) }, + { MP_ROM_QSTR(MP_QSTR_D15), MP_ROM_PTR(&pin_GPIO35) }, + + { MP_ROM_QSTR(MP_QSTR_IO16), MP_ROM_PTR(&pin_GPIO34) }, + { MP_ROM_QSTR(MP_QSTR_CS), MP_ROM_PTR(&pin_GPIO34) }, + { MP_ROM_QSTR(MP_QSTR_D16), MP_ROM_PTR(&pin_GPIO34) }, + + { MP_ROM_QSTR(MP_QSTR_SCL), MP_ROM_PTR(&pin_GPIO16) }, + { MP_ROM_QSTR(MP_QSTR_IO19), MP_ROM_PTR(&pin_GPIO16) }, + + { MP_ROM_QSTR(MP_QSTR_SDA), MP_ROM_PTR(&pin_GPIO15) }, + { MP_ROM_QSTR(MP_QSTR_IO20), MP_ROM_PTR(&pin_GPIO15) }, + + { MP_ROM_QSTR(MP_QSTR_BOOT0), MP_ROM_PTR(&pin_GPIO0) }, + { MP_ROM_QSTR(MP_QSTR_LED), MP_ROM_PTR(&pin_GPIO0) }, + + { MP_ROM_QSTR(MP_QSTR_BUTTON_A), MP_ROM_PTR(&pin_GPIO38) }, + + { MP_ROM_QSTR(MP_QSTR_BUTTON_B), MP_ROM_PTR(&pin_GPIO33) }, + + { MP_ROM_QSTR(MP_QSTR_LUM1), MP_ROM_PTR(&pin_GPIO12) }, + + { MP_ROM_QSTR(MP_QSTR_LUM2), MP_ROM_PTR(&pin_GPIO13) }, + + { MP_ROM_QSTR(MP_QSTR_TEMPERATURE), MP_ROM_PTR(&pin_GPIO14) }, + + { MP_ROM_QSTR(MP_QSTR_NEOPIXEL), MP_ROM_PTR(&pin_GPIO18) }, + + { MP_ROM_QSTR(MP_QSTR_TX), MP_ROM_PTR(&pin_GPIO43) }, + + { MP_ROM_QSTR(MP_QSTR_RX), MP_ROM_PTR(&pin_GPIO44) }, + + { MP_ROM_QSTR(MP_QSTR_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) } + +}; +MP_DEFINE_CONST_DICT(board_module_globals, board_module_globals_table); diff --git a/ports/espressif/boards/bpi_bit_s2/sdkconfig b/ports/espressif/boards/bpi_bit_s2/sdkconfig new file mode 100644 index 0000000000..91758051d3 --- /dev/null +++ b/ports/espressif/boards/bpi_bit_s2/sdkconfig @@ -0,0 +1,37 @@ +CONFIG_ESP32S2_SPIRAM_SUPPORT=y +# +# SPI RAM config +# +CONFIG_SPIRAM_MODE_QUAD=y +# CONFIG_SPIRAM_MODE_OCT is not set +# CONFIG_SPIRAM_TYPE_AUTO is not set +CONFIG_SPIRAM_TYPE_ESPPSRAM16=y +# CONFIG_SPIRAM_TYPE_ESPPSRAM32 is not set +# CONFIG_SPIRAM_TYPE_ESPPSRAM64 is not set +CONFIG_SPIRAM_SIZE=2097152 +# end of SPI RAM config + +CONFIG_DEFAULT_PSRAM_CLK_IO=30 +# +# PSRAM Clock and CS IO for ESP32S3 +# +CONFIG_DEFAULT_PSRAM_CS_IO=26 +# end of PSRAM Clock and CS IO for ESP32S3 + +# CONFIG_SPIRAM_FETCH_INSTRUCTIONS is not set +# CONFIG_SPIRAM_RODATA is not set +# CONFIG_SPIRAM_SPEED_120M is not set +# CONFIG_SPIRAM_SPEED_80M is not set +CONFIG_SPIRAM_SPEED_40M=y +CONFIG_SPIRAM=y +CONFIG_SPIRAM_BOOT_INIT=y +# CONFIG_SPIRAM_IGNORE_NOTFOUND is not set +CONFIG_SPIRAM_USE_MEMMAP=y +# CONFIG_SPIRAM_USE_CAPS_ALLOC is not set +# CONFIG_SPIRAM_USE_MALLOC is not set +CONFIG_SPIRAM_MEMTEST=y +# +# LWIP +# +CONFIG_LWIP_LOCAL_HOSTNAME="BPI-BIT-S2" +# end of LWIP diff --git a/ports/espressif/modules/module.h b/ports/espressif/boards/bpi_leaf_s3/board.c similarity index 76% rename from ports/espressif/modules/module.h rename to ports/espressif/boards/bpi_leaf_s3/board.c index 643cdc854e..3b1f5efd87 100644 --- a/ports/espressif/modules/module.h +++ b/ports/espressif/boards/bpi_leaf_s3/board.c @@ -1,5 +1,5 @@ /* - * This file is part of the Micro Python project, http://micropython.org/ + * This file is part of the MicroPython project, http://micropython.org/ * * The MIT License (MIT) * @@ -24,12 +24,16 @@ * THE SOFTWARE. */ - -#ifndef MICROPY_INCLUDED_ESPRESSIF_MODULES_MODULE_H -#define MICROPY_INCLUDED_ESPRESSIF_MODULES_MODULE_H - +#include "supervisor/board.h" +#include "mpconfigboard.h" #include "shared-bindings/microcontroller/Pin.h" -void never_reset_module_internal_pins(void); +void board_init(void) { + // Debug UART + #ifdef DEBUG + common_hal_never_reset_pin(&pin_GPIO43); + common_hal_never_reset_pin(&pin_GPIO44); + #endif +} -#endif // MICROPY_INCLUDED_ESPRESSIF_MODULES_MODULE_H +// Use the MP_WEAK supervisor/shared/board.c versions of routines not defined here. diff --git a/ports/espressif/boards/bpi_leaf_s3/mpconfigboard.h b/ports/espressif/boards/bpi_leaf_s3/mpconfigboard.h new file mode 100644 index 0000000000..fd6aae04ea --- /dev/null +++ b/ports/espressif/boards/bpi_leaf_s3/mpconfigboard.h @@ -0,0 +1,42 @@ +/* + * This file is part of the MicroPython project, http://micropython.org/ + * + * The MIT License (MIT) + * + * Copyright (c) 2019 Scott Shawcroft for Adafruit Industries + * + * Permission is hereby granted, free of charge, to any person obtaining a copy + * of this software and associated documentation files (the "Software"), to deal + * in the Software without restriction, including without limitation the rights + * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell + * copies of the Software, and to permit persons to whom the Software is + * furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice shall be included in + * all copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE + * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER + * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, + * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN + * THE SOFTWARE. + */ + +// Micropython setup + +#define MICROPY_HW_BOARD_NAME "BPI-Leaf-S3" +#define MICROPY_HW_MCU_NAME "ESP32S3" + +#define MICROPY_HW_NEOPIXEL (&pin_GPIO48) + +#define DEFAULT_I2C_BUS_SCL (&pin_GPIO16) +#define DEFAULT_I2C_BUS_SDA (&pin_GPIO15) + +#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) diff --git a/ports/espressif/boards/bpi_leaf_s3/mpconfigboard.mk b/ports/espressif/boards/bpi_leaf_s3/mpconfigboard.mk new file mode 100644 index 0000000000..e2cd188059 --- /dev/null +++ b/ports/espressif/boards/bpi_leaf_s3/mpconfigboard.mk @@ -0,0 +1,13 @@ +USB_VID = 0x303A +USB_PID = 0x80E0 +USB_PRODUCT = "BPI-Leaf-S3" +USB_MANUFACTURER = "BananaPi" + +IDF_TARGET = esp32s3 + +CIRCUITPY_ESP_FLASH_MODE=dio +CIRCUITPY_ESP_FLASH_FREQ=80m +CIRCUITPY_ESP_FLASH_SIZE=8MB + +# Include these Python libraries in firmware. +FROZEN_MPY_DIRS += $(TOP)/frozen/Adafruit_CircuitPython_NeoPixel diff --git a/ports/espressif/boards/bpi_leaf_s3/pins.c b/ports/espressif/boards/bpi_leaf_s3/pins.c new file mode 100644 index 0000000000..bf193e88aa --- /dev/null +++ b/ports/espressif/boards/bpi_leaf_s3/pins.c @@ -0,0 +1,68 @@ +#include "shared-bindings/board/__init__.h" + +STATIC const mp_rom_map_elem_t board_module_globals_table[] = { + CIRCUITPYTHON_BOARD_DICT_STANDARD_ITEMS + + { MP_ROM_QSTR(MP_QSTR_IO0), MP_ROM_PTR(&pin_GPIO0) }, + { MP_ROM_QSTR(MP_QSTR_IO1), MP_ROM_PTR(&pin_GPIO1) }, + { MP_ROM_QSTR(MP_QSTR_IO2), MP_ROM_PTR(&pin_GPIO2) }, + { MP_ROM_QSTR(MP_QSTR_IO3), MP_ROM_PTR(&pin_GPIO3) }, + { MP_ROM_QSTR(MP_QSTR_IO4), MP_ROM_PTR(&pin_GPIO4) }, + { MP_ROM_QSTR(MP_QSTR_IO5), MP_ROM_PTR(&pin_GPIO5) }, + { MP_ROM_QSTR(MP_QSTR_IO6), MP_ROM_PTR(&pin_GPIO6) }, + { MP_ROM_QSTR(MP_QSTR_IO7), MP_ROM_PTR(&pin_GPIO7) }, + { MP_ROM_QSTR(MP_QSTR_IO8), MP_ROM_PTR(&pin_GPIO8) }, + { MP_ROM_QSTR(MP_QSTR_IO9), MP_ROM_PTR(&pin_GPIO9) }, + { MP_ROM_QSTR(MP_QSTR_IO10), MP_ROM_PTR(&pin_GPIO10) }, + { MP_ROM_QSTR(MP_QSTR_IO11), MP_ROM_PTR(&pin_GPIO11) }, + { MP_ROM_QSTR(MP_QSTR_IO12), MP_ROM_PTR(&pin_GPIO12) }, + { MP_ROM_QSTR(MP_QSTR_IO13), MP_ROM_PTR(&pin_GPIO13) }, + // { MP_ROM_QSTR(MP_QSTR_IO14), MP_ROM_PTR(&pin_GPIO14) }, + { MP_ROM_QSTR(MP_QSTR_IO15), MP_ROM_PTR(&pin_GPIO15) }, + { MP_ROM_QSTR(MP_QSTR_IO16), MP_ROM_PTR(&pin_GPIO16) }, + { MP_ROM_QSTR(MP_QSTR_IO17), MP_ROM_PTR(&pin_GPIO17) }, + { MP_ROM_QSTR(MP_QSTR_IO18), MP_ROM_PTR(&pin_GPIO18) }, + { MP_ROM_QSTR(MP_QSTR_IO19), MP_ROM_PTR(&pin_GPIO19) }, + { MP_ROM_QSTR(MP_QSTR_IO20), MP_ROM_PTR(&pin_GPIO20) }, + { MP_ROM_QSTR(MP_QSTR_IO21), MP_ROM_PTR(&pin_GPIO21) }, + { MP_ROM_QSTR(MP_QSTR_IO35), MP_ROM_PTR(&pin_GPIO35) }, + { MP_ROM_QSTR(MP_QSTR_IO36), MP_ROM_PTR(&pin_GPIO36) }, + { MP_ROM_QSTR(MP_QSTR_IO37), MP_ROM_PTR(&pin_GPIO37) }, + { MP_ROM_QSTR(MP_QSTR_IO38), MP_ROM_PTR(&pin_GPIO38) }, + { MP_ROM_QSTR(MP_QSTR_IO39), MP_ROM_PTR(&pin_GPIO39) }, + { MP_ROM_QSTR(MP_QSTR_IO40), MP_ROM_PTR(&pin_GPIO40) }, + { MP_ROM_QSTR(MP_QSTR_IO41), MP_ROM_PTR(&pin_GPIO41) }, + { MP_ROM_QSTR(MP_QSTR_IO42), MP_ROM_PTR(&pin_GPIO42) }, + { MP_ROM_QSTR(MP_QSTR_IO43), MP_ROM_PTR(&pin_GPIO43) }, + { MP_ROM_QSTR(MP_QSTR_IO44), MP_ROM_PTR(&pin_GPIO44) }, + { MP_ROM_QSTR(MP_QSTR_IO45), MP_ROM_PTR(&pin_GPIO45) }, + { MP_ROM_QSTR(MP_QSTR_IO46), MP_ROM_PTR(&pin_GPIO46) }, + { MP_ROM_QSTR(MP_QSTR_IO47), MP_ROM_PTR(&pin_GPIO47) }, + { MP_ROM_QSTR(MP_QSTR_IO48), MP_ROM_PTR(&pin_GPIO48) }, + + { MP_ROM_QSTR(MP_QSTR_NEOPIXEL), MP_ROM_PTR(&pin_GPIO48) }, + + { MP_ROM_QSTR(MP_QSTR_TX), MP_ROM_PTR(&pin_GPIO43) }, + { MP_ROM_QSTR(MP_QSTR_RX), MP_ROM_PTR(&pin_GPIO44) }, + + { MP_ROM_QSTR(MP_QSTR_BUTTON), MP_ROM_PTR(&pin_GPIO0) }, + { MP_ROM_QSTR(MP_QSTR_BOOT0), MP_ROM_PTR(&pin_GPIO0) }, + + { MP_ROM_QSTR(MP_QSTR_SDA), MP_ROM_PTR(&pin_GPIO15) }, + { MP_ROM_QSTR(MP_QSTR_SCL), MP_ROM_PTR(&pin_GPIO16) }, + + { MP_ROM_QSTR(MP_QSTR_MOSI), MP_ROM_PTR(&pin_GPIO35) }, + { MP_ROM_QSTR(MP_QSTR_SCK), MP_ROM_PTR(&pin_GPIO36) }, + { MP_ROM_QSTR(MP_QSTR_MISO), MP_ROM_PTR(&pin_GPIO37) }, + + { MP_ROM_QSTR(MP_QSTR_BATTERY), MP_ROM_PTR(&pin_GPIO14) }, + { MP_ROM_QSTR(MP_QSTR_VBAT), MP_ROM_PTR(&pin_GPIO14) }, + { MP_ROM_QSTR(MP_QSTR_VBAT_SENSE), MP_ROM_PTR(&pin_GPIO14) }, + { MP_ROM_QSTR(MP_QSTR_VOLTAGE_MONITOR), MP_ROM_PTR(&pin_GPIO14) }, + + { MP_ROM_QSTR(MP_QSTR_I2C), MP_ROM_PTR(&board_i2c_obj) }, + { MP_ROM_QSTR(MP_QSTR_STEMMA_I2C), MP_ROM_PTR(&board_i2c_obj) }, + { MP_ROM_QSTR(MP_QSTR_SPI), MP_ROM_PTR(&board_spi_obj) }, + { MP_ROM_QSTR(MP_QSTR_UART), MP_ROM_PTR(&board_uart_obj) } +}; +MP_DEFINE_CONST_DICT(board_module_globals, board_module_globals_table); diff --git a/ports/espressif/boards/bpi_leaf_s3/sdkconfig b/ports/espressif/boards/bpi_leaf_s3/sdkconfig new file mode 100644 index 0000000000..e9c767ea85 --- /dev/null +++ b/ports/espressif/boards/bpi_leaf_s3/sdkconfig @@ -0,0 +1,47 @@ +# +# Component config +# +# +# ESP32S3-Specific +# +CONFIG_ESP32S3_SPIRAM_SUPPORT=y +# +# SPI RAM config +# +CONFIG_SPIRAM_MODE_QUAD=y +# CONFIG_SPIRAM_MODE_OCT is not set +# CONFIG_SPIRAM_TYPE_AUTO is not set +CONFIG_SPIRAM_TYPE_ESPPSRAM16=y +# CONFIG_SPIRAM_TYPE_ESPPSRAM32 is not set +# CONFIG_SPIRAM_TYPE_ESPPSRAM64 is not set +CONFIG_SPIRAM_SIZE=2097152 +# +# PSRAM Clock and CS IO for ESP32S3 +# +CONFIG_DEFAULT_PSRAM_CLK_IO=30 +CONFIG_DEFAULT_PSRAM_CS_IO=26 +# end of PSRAM Clock and CS IO for ESP32S3 + +# CONFIG_SPIRAM_FETCH_INSTRUCTIONS is not set +# CONFIG_SPIRAM_RODATA is not set +# CONFIG_SPIRAM_SPEED_120M is not set +CONFIG_SPIRAM_SPEED_80M=y +# CONFIG_SPIRAM_SPEED_40M is not set +CONFIG_SPIRAM=y +CONFIG_SPIRAM_BOOT_INIT=y +# CONFIG_SPIRAM_IGNORE_NOTFOUND is not set +CONFIG_SPIRAM_USE_MEMMAP=y +# CONFIG_SPIRAM_USE_CAPS_ALLOC is not set +# CONFIG_SPIRAM_USE_MALLOC is not set +CONFIG_SPIRAM_MEMTEST=y +# end of SPI RAM config + +# end of ESP32S3-Specific + +# +# LWIP +# +CONFIG_LWIP_LOCAL_HOSTNAME="BPI-Leaf-S3" +# end of LWIP + +# end of Component config diff --git a/ports/espressif/boards/crumpspace_crumps2/board.c b/ports/espressif/boards/crumpspace_crumps2/board.c index 0432485111..b3c8cb4191 100644 --- a/ports/espressif/boards/crumpspace_crumps2/board.c +++ b/ports/espressif/boards/crumpspace_crumps2/board.c @@ -36,13 +36,4 @@ void board_init(void) { #endif /* DEBUG */ } -bool board_requests_safe_mode(void) { - return false; -} - -void reset_board(void) { - -} - -void board_deinit(void) { -} +// Use the MP_WEAK supervisor/shared/board.c versions of routines not defined here. diff --git a/ports/espressif/boards/crumpspace_crumps2/mpconfigboard.h b/ports/espressif/boards/crumpspace_crumps2/mpconfigboard.h index ca5d782036..ad0b899c1e 100644 --- a/ports/espressif/boards/crumpspace_crumps2/mpconfigboard.h +++ b/ports/espressif/boards/crumpspace_crumps2/mpconfigboard.h @@ -28,3 +28,7 @@ #define MICROPY_HW_BOARD_NAME "CrumpS2" #define MICROPY_HW_MCU_NAME "ESP32S2" + +#define MICROPY_HW_APA102_MOSI (&pin_GPIO40) +#define MICROPY_HW_APA102_SCK (&pin_GPIO45) +#define MICROPY_HW_APA102_COUNT (1) diff --git a/ports/espressif/boards/crumpspace_crumps2/mpconfigboard.mk b/ports/espressif/boards/crumpspace_crumps2/mpconfigboard.mk index e55ca0e4e8..aca5950f9d 100644 --- a/ports/espressif/boards/crumpspace_crumps2/mpconfigboard.mk +++ b/ports/espressif/boards/crumpspace_crumps2/mpconfigboard.mk @@ -5,20 +5,11 @@ USB_MANUFACTURER = "CrumpSpace" IDF_TARGET = esp32s2 -INTERNAL_FLASH_FILESYSTEM = 1 -LONGINT_IMPL = MPZ - -# The default queue depth of 16 overflows on release builds, -# so increase it to 32. -CFLAGS += -DCFG_TUD_TASK_QUEUE_SZ=32 - -CIRCUITPY_ESP_FLASH_MODE=dio -CIRCUITPY_ESP_FLASH_FREQ=40m -CIRCUITPY_ESP_FLASH_SIZE=4MB +CIRCUITPY_ESP_FLASH_MODE = dio +CIRCUITPY_ESP_FLASH_FREQ = 40m +CIRCUITPY_ESP_FLASH_SIZE = 4MB CIRCUITPY_BITBANG_APA102 = 1 -CIRCUITPY_MODULE=wrover - # Include these Python libraries in firmware. # FROZEN_MPY_DIRS += $(TOP)/frozen/Adafruit_CircuitPython_DotStar diff --git a/ports/espressif/boards/cytron_maker_feather_aiot_s3/board.c b/ports/espressif/boards/cytron_maker_feather_aiot_s3/board.c index 5c71b80fc0..1f9ef3c4e7 100644 --- a/ports/espressif/boards/cytron_maker_feather_aiot_s3/board.c +++ b/ports/espressif/boards/cytron_maker_feather_aiot_s3/board.c @@ -35,15 +35,51 @@ void board_init(void) { reset_board(); } -bool board_requests_safe_mode(void) { +bool espressif_board_reset_pin_number(gpio_num_t pin_number) { + // For GPIOs used in Maker Feather AIoT S3, set the default state to pull down + // as most of them are connected to active high LED. + switch ((int8_t)pin_number) { + case 4: + case 5: + case 6: + case 7: + case 8: + case 9: + case 10: + case 12: + case 14: + case 15: + case 16: + case 17: + case 18: + case 21: + case 38: + case 39: + case 40: + case 41: + case 42: + case 47: + case 48: + gpio_reset_pin(pin_number); + gpio_pullup_dis(pin_number); + gpio_pulldown_en(pin_number); + return true; + + // Do not pull up/down as this is the battery voltage monitoring pin. + case 13: + gpio_reset_pin(pin_number); + gpio_pullup_dis(pin_number); + gpio_pulldown_dis(pin_number); + return true; + } + return false; } void reset_board(void) { // Turn on VP by default. - gpio_set_direction(38, GPIO_MODE_DEF_OUTPUT); - gpio_set_level(38, true); + gpio_set_direction(11, GPIO_MODE_DEF_OUTPUT); + gpio_set_level(11, true); } -void board_deinit(void) { -} +// Use the MP_WEAK supervisor/shared/board.c versions of routines not defined here. diff --git a/ports/espressif/boards/cytron_maker_feather_aiot_s3/mpconfigboard.h b/ports/espressif/boards/cytron_maker_feather_aiot_s3/mpconfigboard.h index 478a06c70a..39c1edc5bd 100644 --- a/ports/espressif/boards/cytron_maker_feather_aiot_s3/mpconfigboard.h +++ b/ports/espressif/boards/cytron_maker_feather_aiot_s3/mpconfigboard.h @@ -3,7 +3,7 @@ * * The MIT License (MIT) * - * Copyright (c) 2019 Scott Shawcroft for Adafruit Industries + * Copyright (c) 2022 Wai Weng for Cytron Technologies * * Permission is hereby granted, free of charge, to any person obtaining a copy * of this software and associated documentation files (the "Software"), to deal @@ -30,16 +30,18 @@ #define MICROPY_HW_MCU_NAME "ESP32S3" #define MICROPY_HW_NEOPIXEL (&pin_GPIO46) -#define CIRCUITPY_STATUS_LED_POWER (&pin_GPIO13) +#define CIRCUITPY_STATUS_LED_POWER (&pin_GPIO11) + +#define MICROPY_HW_LED_STATUS (&pin_GPIO2) #define DEFAULT_I2C_BUS_SCL (&pin_GPIO41) #define DEFAULT_I2C_BUS_SDA (&pin_GPIO42) -#define DEFAULT_SPI_BUS_SCK (&pin_GPIO6) -#define DEFAULT_SPI_BUS_MOSI (&pin_GPIO10) -#define DEFAULT_SPI_BUS_MISO (&pin_GPIO5) +#define DEFAULT_SPI_BUS_SCK (&pin_GPIO17) +#define DEFAULT_SPI_BUS_MOSI (&pin_GPIO8) +#define DEFAULT_SPI_BUS_MISO (&pin_GPIO18) -#define DEFAULT_UART_BUS_RX (&pin_GPIO11) -#define DEFAULT_UART_BUS_TX (&pin_GPIO4) +#define DEFAULT_UART_BUS_RX (&pin_GPIO16) +#define DEFAULT_UART_BUS_TX (&pin_GPIO15) -#define DOUBLE_TAP_PIN (&pin_GPIO17) +#define DOUBLE_TAP_PIN (&pin_GPIO1) diff --git a/ports/espressif/boards/cytron_maker_feather_aiot_s3/mpconfigboard.mk b/ports/espressif/boards/cytron_maker_feather_aiot_s3/mpconfigboard.mk index 7a7a032e2c..53e9750463 100644 --- a/ports/espressif/boards/cytron_maker_feather_aiot_s3/mpconfigboard.mk +++ b/ports/espressif/boards/cytron_maker_feather_aiot_s3/mpconfigboard.mk @@ -5,16 +5,9 @@ USB_MANUFACTURER = "Cytron" IDF_TARGET = esp32s3 -INTERNAL_FLASH_FILESYSTEM = 1 -LONGINT_IMPL = MPZ - -# The default queue depth of 16 overflows on release builds, -# so increase it to 32. -CFLAGS += -DCFG_TUD_TASK_QUEUE_SZ=32 - -CIRCUITPY_ESP_FLASH_MODE=dio -CIRCUITPY_ESP_FLASH_FREQ=80m -CIRCUITPY_ESP_FLASH_SIZE=8MB +CIRCUITPY_ESP_FLASH_MODE = dio +CIRCUITPY_ESP_FLASH_FREQ = 80m +CIRCUITPY_ESP_FLASH_SIZE = 8MB # Include these Python libraries in firmware. FROZEN_MPY_DIRS += $(TOP)/frozen/Adafruit_CircuitPython_NeoPixel diff --git a/ports/espressif/boards/cytron_maker_feather_aiot_s3/pins.c b/ports/espressif/boards/cytron_maker_feather_aiot_s3/pins.c index 92e8e7cfc1..b8ed298596 100644 --- a/ports/espressif/boards/cytron_maker_feather_aiot_s3/pins.c +++ b/ports/espressif/boards/cytron_maker_feather_aiot_s3/pins.c @@ -6,82 +6,77 @@ STATIC const mp_rom_map_elem_t board_module_globals_table[] = { { MP_ROM_QSTR(MP_QSTR_BOOT0), MP_ROM_PTR(&pin_GPIO0) }, { MP_ROM_QSTR(MP_QSTR_D0), MP_ROM_PTR(&pin_GPIO0) }, - { MP_ROM_QSTR(MP_QSTR_A3), MP_ROM_PTR(&pin_GPIO2) }, + { MP_ROM_QSTR(MP_QSTR_LED), MP_ROM_PTR(&pin_GPIO2) }, + { MP_ROM_QSTR(MP_QSTR_L), MP_ROM_PTR(&pin_GPIO2) }, { MP_ROM_QSTR(MP_QSTR_D2), MP_ROM_PTR(&pin_GPIO2) }, { MP_ROM_QSTR(MP_QSTR_BUTTON), MP_ROM_PTR(&pin_GPIO3) }, { MP_ROM_QSTR(MP_QSTR_D3), MP_ROM_PTR(&pin_GPIO3) }, - { MP_ROM_QSTR(MP_QSTR_TX), MP_ROM_PTR(&pin_GPIO4) }, + { MP_ROM_QSTR(MP_QSTR_A4), MP_ROM_PTR(&pin_GPIO4) }, { MP_ROM_QSTR(MP_QSTR_D4), MP_ROM_PTR(&pin_GPIO4) }, - { MP_ROM_QSTR(MP_QSTR_MISO), MP_ROM_PTR(&pin_GPIO5) }, + { MP_ROM_QSTR(MP_QSTR_A3), MP_ROM_PTR(&pin_GPIO5) }, { MP_ROM_QSTR(MP_QSTR_D5), MP_ROM_PTR(&pin_GPIO5) }, - { MP_ROM_QSTR(MP_QSTR_SCK), MP_ROM_PTR(&pin_GPIO6) }, + { MP_ROM_QSTR(MP_QSTR_A2), MP_ROM_PTR(&pin_GPIO6) }, { MP_ROM_QSTR(MP_QSTR_D6), MP_ROM_PTR(&pin_GPIO6) }, - { MP_ROM_QSTR(MP_QSTR_A4), MP_ROM_PTR(&pin_GPIO7) }, + { MP_ROM_QSTR(MP_QSTR_A5), MP_ROM_PTR(&pin_GPIO7) }, { MP_ROM_QSTR(MP_QSTR_D7), MP_ROM_PTR(&pin_GPIO7) }, - { MP_ROM_QSTR(MP_QSTR_A2), MP_ROM_PTR(&pin_GPIO8) }, + { MP_ROM_QSTR(MP_QSTR_MOSI), MP_ROM_PTR(&pin_GPIO8) }, { MP_ROM_QSTR(MP_QSTR_D8), MP_ROM_PTR(&pin_GPIO8) }, - { MP_ROM_QSTR(MP_QSTR_A0), MP_ROM_PTR(&pin_GPIO9) }, + { MP_ROM_QSTR(MP_QSTR_A1), MP_ROM_PTR(&pin_GPIO9) }, { MP_ROM_QSTR(MP_QSTR_D9), MP_ROM_PTR(&pin_GPIO9) }, - { MP_ROM_QSTR(MP_QSTR_MOSI), MP_ROM_PTR(&pin_GPIO10) }, + { MP_ROM_QSTR(MP_QSTR_A0), MP_ROM_PTR(&pin_GPIO10) }, { MP_ROM_QSTR(MP_QSTR_D10), MP_ROM_PTR(&pin_GPIO10) }, - { MP_ROM_QSTR(MP_QSTR_RX), MP_ROM_PTR(&pin_GPIO11) }, + { MP_ROM_QSTR(MP_QSTR_VP_EN), MP_ROM_PTR(&pin_GPIO11) }, { MP_ROM_QSTR(MP_QSTR_D11), MP_ROM_PTR(&pin_GPIO11) }, - { MP_ROM_QSTR(MP_QSTR_A5), MP_ROM_PTR(&pin_GPIO12) }, + { MP_ROM_QSTR(MP_QSTR_BUZZER), MP_ROM_PTR(&pin_GPIO12) }, { MP_ROM_QSTR(MP_QSTR_D12), MP_ROM_PTR(&pin_GPIO12) }, - { MP_ROM_QSTR(MP_QSTR_LED), MP_ROM_PTR(&pin_GPIO13) }, + { MP_ROM_QSTR(MP_QSTR_VIN), MP_ROM_PTR(&pin_GPIO13) }, + { MP_ROM_QSTR(MP_QSTR_VBATT), MP_ROM_PTR(&pin_GPIO13) }, + { MP_ROM_QSTR(MP_QSTR_VOLTAGE_MONITOR), MP_ROM_PTR(&pin_GPIO13) }, { MP_ROM_QSTR(MP_QSTR_D13), MP_ROM_PTR(&pin_GPIO13) }, - { MP_ROM_QSTR(MP_QSTR_L), MP_ROM_PTR(&pin_GPIO13) }, - { MP_ROM_QSTR(MP_QSTR_A1), MP_ROM_PTR(&pin_GPIO14) }, { MP_ROM_QSTR(MP_QSTR_D14), MP_ROM_PTR(&pin_GPIO14) }, + { MP_ROM_QSTR(MP_QSTR_TX), MP_ROM_PTR(&pin_GPIO15) }, { MP_ROM_QSTR(MP_QSTR_D15), MP_ROM_PTR(&pin_GPIO15) }, + + { MP_ROM_QSTR(MP_QSTR_RX), MP_ROM_PTR(&pin_GPIO16) }, { MP_ROM_QSTR(MP_QSTR_D16), MP_ROM_PTR(&pin_GPIO16) }, + + { MP_ROM_QSTR(MP_QSTR_SCK), MP_ROM_PTR(&pin_GPIO17) }, { MP_ROM_QSTR(MP_QSTR_D17), MP_ROM_PTR(&pin_GPIO17) }, - { MP_ROM_QSTR(MP_QSTR_VIN), MP_ROM_PTR(&pin_GPIO18) }, - { MP_ROM_QSTR(MP_QSTR_VBATT), MP_ROM_PTR(&pin_GPIO18) }, - { MP_ROM_QSTR(MP_QSTR_VOLTAGE_MONITOR), MP_ROM_PTR(&pin_GPIO18) }, + { MP_ROM_QSTR(MP_QSTR_MISO), MP_ROM_PTR(&pin_GPIO18) }, { MP_ROM_QSTR(MP_QSTR_D18), MP_ROM_PTR(&pin_GPIO18) }, { MP_ROM_QSTR(MP_QSTR_D21), MP_ROM_PTR(&pin_GPIO21) }, - { MP_ROM_QSTR(MP_QSTR_D33), MP_ROM_PTR(&pin_GPIO33) }, - { MP_ROM_QSTR(MP_QSTR_D34), MP_ROM_PTR(&pin_GPIO34) }, - { MP_ROM_QSTR(MP_QSTR_D35), MP_ROM_PTR(&pin_GPIO35) }, - { MP_ROM_QSTR(MP_QSTR_D36), MP_ROM_PTR(&pin_GPIO36) }, - { MP_ROM_QSTR(MP_QSTR_D37), MP_ROM_PTR(&pin_GPIO37) }, - - { MP_ROM_QSTR(MP_QSTR_VP_EN), MP_ROM_PTR(&pin_GPIO38) }, { MP_ROM_QSTR(MP_QSTR_D38), MP_ROM_PTR(&pin_GPIO38) }, - - { MP_ROM_QSTR(MP_QSTR_BUZZER), MP_ROM_PTR(&pin_GPIO39) }, { MP_ROM_QSTR(MP_QSTR_D39), MP_ROM_PTR(&pin_GPIO39) }, - { MP_ROM_QSTR(MP_QSTR_D40), MP_ROM_PTR(&pin_GPIO40) }, - { MP_ROM_QSTR(MP_QSTR_D41), MP_ROM_PTR(&pin_GPIO41) }, { MP_ROM_QSTR(MP_QSTR_SCL), MP_ROM_PTR(&pin_GPIO41) }, + { MP_ROM_QSTR(MP_QSTR_D41), MP_ROM_PTR(&pin_GPIO41) }, - { MP_ROM_QSTR(MP_QSTR_D42), MP_ROM_PTR(&pin_GPIO42) }, { MP_ROM_QSTR(MP_QSTR_SDA), MP_ROM_PTR(&pin_GPIO42) }, - - { MP_ROM_QSTR(MP_QSTR_D45), MP_ROM_PTR(&pin_GPIO45) }, + { MP_ROM_QSTR(MP_QSTR_D42), MP_ROM_PTR(&pin_GPIO42) }, { MP_ROM_QSTR(MP_QSTR_RGB), MP_ROM_PTR(&pin_GPIO46) }, { MP_ROM_QSTR(MP_QSTR_NEOPIXEL), MP_ROM_PTR(&pin_GPIO46) }, { MP_ROM_QSTR(MP_QSTR_D46), MP_ROM_PTR(&pin_GPIO46) }, + { MP_ROM_QSTR(MP_QSTR_D47), MP_ROM_PTR(&pin_GPIO47) }, + { MP_ROM_QSTR(MP_QSTR_D48), MP_ROM_PTR(&pin_GPIO48) }, + { MP_ROM_QSTR(MP_QSTR_I2C), MP_ROM_PTR(&board_i2c_obj) }, { MP_ROM_QSTR(MP_QSTR_STEMMA_I2C), MP_ROM_PTR(&board_i2c_obj) }, { MP_ROM_QSTR(MP_QSTR_SPI), MP_ROM_PTR(&board_spi_obj) }, diff --git a/ports/espressif/boards/electroniccats_bastwifi/board.c b/ports/espressif/boards/electroniccats_bastwifi/board.c index 0432485111..b3c8cb4191 100644 --- a/ports/espressif/boards/electroniccats_bastwifi/board.c +++ b/ports/espressif/boards/electroniccats_bastwifi/board.c @@ -36,13 +36,4 @@ void board_init(void) { #endif /* DEBUG */ } -bool board_requests_safe_mode(void) { - return false; -} - -void reset_board(void) { - -} - -void board_deinit(void) { -} +// Use the MP_WEAK supervisor/shared/board.c versions of routines not defined here. diff --git a/ports/espressif/boards/electroniccats_bastwifi/mpconfigboard.h b/ports/espressif/boards/electroniccats_bastwifi/mpconfigboard.h index 229af1c865..bf8c1efa60 100644 --- a/ports/espressif/boards/electroniccats_bastwifi/mpconfigboard.h +++ b/ports/espressif/boards/electroniccats_bastwifi/mpconfigboard.h @@ -28,3 +28,5 @@ #define MICROPY_HW_BOARD_NAME "BastWiFi" #define MICROPY_HW_MCU_NAME "ESP32S2" + +#define MICROPY_HW_LED_STATUS (&pin_GPIO14) diff --git a/ports/espressif/boards/electroniccats_bastwifi/mpconfigboard.mk b/ports/espressif/boards/electroniccats_bastwifi/mpconfigboard.mk index 8e2517ba23..67e88a1639 100644 --- a/ports/espressif/boards/electroniccats_bastwifi/mpconfigboard.mk +++ b/ports/espressif/boards/electroniccats_bastwifi/mpconfigboard.mk @@ -5,17 +5,9 @@ USB_MANUFACTURER = "ElectronicCats" IDF_TARGET = esp32s2 -INTERNAL_FLASH_FILESYSTEM = 1 -LONGINT_IMPL = MPZ - -# The default queue depth of 16 overflows on release builds, -# so increase it to 32. -CFLAGS += -DCFG_TUD_TASK_QUEUE_SZ=32 - CIRCUITPY_NEOPIXEL_WRITE = 0 -CIRCUITPY_ESP_FLASH_MODE=dio -CIRCUITPY_ESP_FLASH_FREQ=40m -CIRCUITPY_ESP_FLASH_SIZE=4MB - -CIRCUITPY_MODULE=wrover +CIRCUITPY_ESP_FLASH_MODE = dio +CIRCUITPY_ESP_FLASH_FREQ = 40m +CIRCUITPY_ESP_FLASH_SIZE = 4MB +CIRCUITPY_ESP32_CAMERA = 0 diff --git a/shared-module/multiterminal/__init__.c b/ports/espressif/boards/espressif_esp32_eye/board.c similarity index 56% rename from shared-module/multiterminal/__init__.c rename to ports/espressif/boards/espressif_esp32_eye/board.c index 361a6dcc7a..1c09fb1316 100644 --- a/shared-module/multiterminal/__init__.c +++ b/ports/espressif/boards/espressif_esp32_eye/board.c @@ -3,8 +3,7 @@ * * The MIT License (MIT) * - * Copyright (c) 2016 Paul Sokolovsky - * Copyright (c) 2017 Scott Shawcroft for Adafruit Industries + * Copyright (c) 2020 Scott Shawcroft for Adafruit Industries * * Permission is hereby granted, free of charge, to any person obtaining a copy * of this software and associated documentation files (the "Software"), to deal @@ -25,26 +24,31 @@ * THE SOFTWARE. */ -#include "py/mpstate.h" +#include "supervisor/board.h" +#include "mpconfigboard.h" +#include "shared-bindings/microcontroller/Pin.h" +#include "components/driver/include/driver/gpio.h" +#include "components/hal/include/hal/gpio_hal.h" +#include "common-hal/microcontroller/Pin.h" -#include "shared-bindings/multiterminal/__init__.h" +void board_init(void) { + reset_board(); +} -mp_obj_t shared_module_multiterminal_get_secondary_terminal() { - if (MP_STATE_VM(dupterm_objs[0]) == MP_OBJ_NULL) { - return mp_const_none; - } else { - return MP_STATE_VM(dupterm_objs[0]); +bool espressif_board_reset_pin_number(gpio_num_t pin_number) { + // Pull LEDs down on reset rather than the default up + if (pin_number == 21 || pin_number == 22) { + gpio_config_t cfg = { + .pin_bit_mask = BIT64(pin_number), + .mode = GPIO_MODE_DISABLE, + .pull_up_en = false, + .pull_down_en = true, + .intr_type = GPIO_INTR_DISABLE, + }; + gpio_config(&cfg); + return true; } + return false; } -void shared_module_multiterminal_set_secondary_terminal(mp_obj_t secondary_terminal) { - MP_STATE_VM(dupterm_objs[0]) = secondary_terminal; - if (MP_STATE_PORT(dupterm_arr_obj) == MP_OBJ_NULL) { - MP_STATE_PORT(dupterm_arr_obj) = mp_obj_new_bytearray(1, ""); - } -} - -void shared_module_multiterminal_clear_secondary_terminal() { - MP_STATE_VM(dupterm_objs[0]) = MP_OBJ_NULL; - MP_STATE_PORT(dupterm_arr_obj) = MP_OBJ_NULL; -} +// Use the MP_WEAK supervisor/shared/board.c versions of routines not defined here. diff --git a/ports/espressif/boards/espressif_esp32_eye/mpconfigboard.h b/ports/espressif/boards/espressif_esp32_eye/mpconfigboard.h new file mode 100644 index 0000000000..accf539428 --- /dev/null +++ b/ports/espressif/boards/espressif_esp32_eye/mpconfigboard.h @@ -0,0 +1,41 @@ +/* + * This file is part of the MicroPython project, http://micropython.org/ + * + * The MIT License (MIT) + * + * Copyright (c) 2022 Dan Halbert for Adafruit Industries + * + * Permission is hereby granted, free of charge, to any person obtaining a copy + * of this software and associated documentation files (the "Software"), to deal + * in the Software without restriction, including without limitation the rights + * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell + * copies of the Software, and to permit persons to whom the Software is + * furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice shall be included in + * all copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE + * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER + * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, + * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN + * THE SOFTWARE. + */ + +// Micropython setup + +#define MICROPY_HW_BOARD_NAME "Espressif ESP32-EYE" +#define MICROPY_HW_MCU_NAME "ESP32" + +#define MICROPY_HW_LED_STATUS (&pin_GPIO21) + +#define CIRCUITPY_BOARD_I2C (1) +#define CIRCUITPY_BOARD_I2C_PIN {{.scl = &pin_GPIO23, .sda = &pin_GPIO18}} + +// UART pins attached to the USB-serial converter chip +#define CIRCUITPY_CONSOLE_UART_TX (&pin_GPIO1) +#define CIRCUITPY_CONSOLE_UART_RX (&pin_GPIO3) + +#define DEFAULT_RESERVED_PSRAM (1048576) diff --git a/ports/espressif/boards/espressif_esp32_eye/mpconfigboard.mk b/ports/espressif/boards/espressif_esp32_eye/mpconfigboard.mk new file mode 100644 index 0000000000..e29ca687c6 --- /dev/null +++ b/ports/espressif/boards/espressif_esp32_eye/mpconfigboard.mk @@ -0,0 +1,8 @@ +CIRCUITPY_CREATOR_ID = 0x000C303A +CIRCUITPY_CREATION_ID = 0x00320001 + +IDF_TARGET = esp32 + +CIRCUITPY_ESP_FLASH_MODE = dio +CIRCUITPY_ESP_FLASH_FREQ = 40m +CIRCUITPY_ESP_FLASH_SIZE = 4MB diff --git a/ports/espressif/boards/espressif_esp32_eye/pins.c b/ports/espressif/boards/espressif_esp32_eye/pins.c new file mode 100644 index 0000000000..1824ba1cc0 --- /dev/null +++ b/ports/espressif/boards/espressif_esp32_eye/pins.c @@ -0,0 +1,40 @@ +#include "py/objtuple.h" +#include "shared-bindings/board/__init__.h" + +STATIC const mp_rom_obj_tuple_t camera_data_tuple = { + {&mp_type_tuple}, + 8, + { + MP_ROM_PTR(&pin_GPIO34), + MP_ROM_PTR(&pin_GPIO13), + MP_ROM_PTR(&pin_GPIO14), + MP_ROM_PTR(&pin_GPIO35), + MP_ROM_PTR(&pin_GPIO39), // "S_VN" + MP_ROM_PTR(&pin_GPIO38), + MP_ROM_PTR(&pin_GPIO37), + MP_ROM_PTR(&pin_GPIO36), // "S_VP" + } +}; + +STATIC const mp_rom_map_elem_t board_module_globals_table[] = { + CIRCUITPYTHON_BOARD_DICT_STANDARD_ITEMS + + { MP_ROM_QSTR(MP_QSTR_I2S_SCK), MP_ROM_PTR(&pin_GPIO26) }, + { MP_ROM_QSTR(MP_QSTR_I2S_WS), MP_ROM_PTR(&pin_GPIO32) }, + { MP_ROM_QSTR(MP_QSTR_I2S_SDO), MP_ROM_PTR(&pin_GPIO32) }, + + { MP_ROM_QSTR(MP_QSTR_BOOT), MP_ROM_PTR(&pin_GPIO0) }, + { MP_ROM_QSTR(MP_QSTR_BUTTON), MP_ROM_PTR(&pin_GPIO15) }, + + { MP_ROM_QSTR(MP_QSTR_LED_RED), MP_ROM_PTR(&pin_GPIO21) }, + { MP_ROM_QSTR(MP_QSTR_LED_WHITE), MP_ROM_PTR(&pin_GPIO22) }, + + { MP_ROM_QSTR(MP_QSTR_I2C), MP_ROM_PTR(&board_i2c_obj) }, + + { MP_ROM_QSTR(MP_QSTR_CAMERA_DATA), MP_ROM_PTR(&camera_data_tuple) }, + { MP_ROM_QSTR(MP_QSTR_CAMERA_VSYNC), MP_ROM_PTR(&pin_GPIO5) }, + { MP_ROM_QSTR(MP_QSTR_CAMERA_HREF), MP_ROM_PTR(&pin_GPIO27) }, + { MP_ROM_QSTR(MP_QSTR_CAMERA_PCLK), MP_ROM_PTR(&pin_GPIO25) }, + { MP_ROM_QSTR(MP_QSTR_CAMERA_XCLK), MP_ROM_PTR(&pin_GPIO4) }, +}; +MP_DEFINE_CONST_DICT(board_module_globals, board_module_globals_table); diff --git a/ports/espressif/boards/espressif_esp32_eye/sdkconfig b/ports/espressif/boards/espressif_esp32_eye/sdkconfig new file mode 100644 index 0000000000..a73d92e0a2 --- /dev/null +++ b/ports/espressif/boards/espressif_esp32_eye/sdkconfig @@ -0,0 +1,72 @@ +# Automatically generated file. DO NOT EDIT. +# Espressif IoT Development Framework (ESP-IDF) Project Configuration +# +# +# Component config +# +# +# ESP32-specific +# +CONFIG_ESP32_SPIRAM_SUPPORT=y +# +# SPI RAM config +# +CONFIG_SPIRAM_TYPE_AUTO=y +# CONFIG_SPIRAM_TYPE_ESPPSRAM16 is not set +# CONFIG_SPIRAM_TYPE_ESPPSRAM32 is not set +# CONFIG_SPIRAM_TYPE_ESPPSRAM64 is not set +CONFIG_SPIRAM_SIZE=-1 +CONFIG_SPIRAM_SPEED_40M=y +CONFIG_SPIRAM=y +CONFIG_SPIRAM_BOOT_INIT=y +CONFIG_SPIRAM_IGNORE_NOTFOUND=y +CONFIG_SPIRAM_USE_MEMMAP=y +# CONFIG_SPIRAM_USE_CAPS_ALLOC is not set +# CONFIG_SPIRAM_USE_MALLOC is not set +CONFIG_SPIRAM_MEMTEST=y +# CONFIG_SPIRAM_ALLOW_BSS_SEG_EXTERNAL_MEMORY is not set +# CONFIG_SPIRAM_ALLOW_NOINIT_SEG_EXTERNAL_MEMORY is not set +CONFIG_SPIRAM_CACHE_WORKAROUND=y +# CONFIG_SPIRAM_BANKSWITCH_ENABLE is not set +# end of SPI RAM config + +# end of ESP32-specific + +# +# NVS +# +# CONFIG_NVS_ASSERT_ERROR_CHECK is not set +# end of NVS + +# +# Camera configuration +# +CONFIG_OV7670_SUPPORT=y +CONFIG_OV7725_SUPPORT=y +CONFIG_NT99141_SUPPORT=y +CONFIG_OV2640_SUPPORT=y +CONFIG_OV3660_SUPPORT=y +CONFIG_OV5640_SUPPORT=y +CONFIG_GC2145_SUPPORT=y +CONFIG_GC032A_SUPPORT=y +CONFIG_GC0308_SUPPORT=y +CONFIG_BF3005_SUPPORT=y +CONFIG_BF20A6_SUPPORT=y +# CONFIG_SC101IOT_SUPPORT is not set +CONFIG_SC030IOT_SUPPORT=y +# CONFIG_SCCB_HARDWARE_I2C_PORT0 is not set +CONFIG_SCCB_HARDWARE_I2C_PORT1=y +CONFIG_SCCB_CLK_FREQ=100000 +# CONFIG_GC_SENSOR_WINDOWING_MODE is not set +CONFIG_GC_SENSOR_SUBSAMPLE_MODE=y +CONFIG_CAMERA_CORE0=y +# CONFIG_CAMERA_CORE1 is not set +# CONFIG_CAMERA_NO_AFFINITY is not set +CONFIG_CAMERA_DMA_BUFFER_SIZE_MAX=32768 +# end of Camera configuration + +# end of Component config +# +CONFIG_ESP_CONSOLE_UART_TX_GPIO=1 +CONFIG_ESP_CONSOLE_UART_RX_GPIO=3 + diff --git a/ports/espressif/boards/espressif_esp32c3_devkitm_1_n4/board.c b/ports/espressif/boards/espressif_esp32c3_devkitm_1_n4/board.c index e3b71f4832..b155ed7a7b 100644 --- a/ports/espressif/boards/espressif_esp32c3_devkitm_1_n4/board.c +++ b/ports/espressif/boards/espressif_esp32c3_devkitm_1_n4/board.c @@ -35,14 +35,4 @@ void board_init(void) { #endif } -bool board_requests_safe_mode(void) { - return false; -} - -void reset_board(void) { -} - -#if CIRCUITPY_ALARM -void board_deinit(void) { -} -#endif +// Use the MP_WEAK supervisor/shared/board.c versions of routines not defined here. diff --git a/ports/espressif/boards/espressif_esp32c3_devkitm_1_n4/mpconfigboard.h b/ports/espressif/boards/espressif_esp32c3_devkitm_1_n4/mpconfigboard.h index 69c4580aba..2b8ab21ad6 100644 --- a/ports/espressif/boards/espressif_esp32c3_devkitm_1_n4/mpconfigboard.h +++ b/ports/espressif/boards/espressif_esp32c3_devkitm_1_n4/mpconfigboard.h @@ -37,5 +37,5 @@ #define DEFAULT_UART_BUS_TX (&pin_GPIO21) // Serial over UART -#define CIRCUITPY_DEBUG_UART_RX DEFAULT_UART_BUS_RX -#define CIRCUITPY_DEBUG_UART_TX DEFAULT_UART_BUS_TX +#define CIRCUITPY_CONSOLE_UART_RX DEFAULT_UART_BUS_RX +#define CIRCUITPY_CONSOLE_UART_TX DEFAULT_UART_BUS_TX diff --git a/ports/espressif/boards/espressif_esp32c3_devkitm_1_n4/mpconfigboard.mk b/ports/espressif/boards/espressif_esp32c3_devkitm_1_n4/mpconfigboard.mk index b952dacef7..cd517e75b4 100644 --- a/ports/espressif/boards/espressif_esp32c3_devkitm_1_n4/mpconfigboard.mk +++ b/ports/espressif/boards/espressif_esp32c3_devkitm_1_n4/mpconfigboard.mk @@ -3,8 +3,6 @@ CIRCUITPY_CREATION_ID = 0x00C30001 IDF_TARGET = esp32c3 -INTERNAL_FLASH_FILESYSTEM = 1 - -CIRCUITPY_ESP_FLASH_MODE=dio -CIRCUITPY_ESP_FLASH_FREQ=80m -CIRCUITPY_ESP_FLASH_SIZE=4MB +CIRCUITPY_ESP_FLASH_MODE = dio +CIRCUITPY_ESP_FLASH_FREQ = 80m +CIRCUITPY_ESP_FLASH_SIZE = 4MB diff --git a/ports/espressif/boards/espressif_esp32s2_devkitc_1_n4/board.c b/ports/espressif/boards/espressif_esp32s2_devkitc_1_n4/board.c index 0432485111..b3c8cb4191 100644 --- a/ports/espressif/boards/espressif_esp32s2_devkitc_1_n4/board.c +++ b/ports/espressif/boards/espressif_esp32s2_devkitc_1_n4/board.c @@ -36,13 +36,4 @@ void board_init(void) { #endif /* DEBUG */ } -bool board_requests_safe_mode(void) { - return false; -} - -void reset_board(void) { - -} - -void board_deinit(void) { -} +// Use the MP_WEAK supervisor/shared/board.c versions of routines not defined here. diff --git a/ports/espressif/boards/espressif_esp32s2_devkitc_1_n4/mpconfigboard.mk b/ports/espressif/boards/espressif_esp32s2_devkitc_1_n4/mpconfigboard.mk index e902c3975a..31e79b2425 100644 --- a/ports/espressif/boards/espressif_esp32s2_devkitc_1_n4/mpconfigboard.mk +++ b/ports/espressif/boards/espressif_esp32s2_devkitc_1_n4/mpconfigboard.mk @@ -5,13 +5,7 @@ USB_MANUFACTURER = "Espressif" IDF_TARGET = esp32s2 -INTERNAL_FLASH_FILESYSTEM = 1 -LONGINT_IMPL = MPZ - -# The default queue depth of 16 overflows on release builds, -# so increase it to 32. -CFLAGS += -DCFG_TUD_TASK_QUEUE_SZ=32 - -CIRCUITPY_ESP_FLASH_MODE=dio -CIRCUITPY_ESP_FLASH_FREQ=40m -CIRCUITPY_ESP_FLASH_SIZE=4MB +CIRCUITPY_ESP_FLASH_MODE = dio +CIRCUITPY_ESP_FLASH_FREQ = 40m +CIRCUITPY_ESP_FLASH_SIZE = 4MB +CIRCUITPY_ESP32_CAMERA = 0 diff --git a/ports/espressif/boards/espressif_esp32s2_devkitc_1_n4r2/board.c b/ports/espressif/boards/espressif_esp32s2_devkitc_1_n4r2/board.c index 0432485111..b3c8cb4191 100644 --- a/ports/espressif/boards/espressif_esp32s2_devkitc_1_n4r2/board.c +++ b/ports/espressif/boards/espressif_esp32s2_devkitc_1_n4r2/board.c @@ -36,13 +36,4 @@ void board_init(void) { #endif /* DEBUG */ } -bool board_requests_safe_mode(void) { - return false; -} - -void reset_board(void) { - -} - -void board_deinit(void) { -} +// Use the MP_WEAK supervisor/shared/board.c versions of routines not defined here. diff --git a/ports/espressif/boards/espressif_esp32s2_devkitc_1_n4r2/mpconfigboard.mk b/ports/espressif/boards/espressif_esp32s2_devkitc_1_n4r2/mpconfigboard.mk index d007558640..aef3ce0dc7 100644 --- a/ports/espressif/boards/espressif_esp32s2_devkitc_1_n4r2/mpconfigboard.mk +++ b/ports/espressif/boards/espressif_esp32s2_devkitc_1_n4r2/mpconfigboard.mk @@ -5,13 +5,6 @@ USB_MANUFACTURER = "Espressif" IDF_TARGET = esp32s2 -INTERNAL_FLASH_FILESYSTEM = 1 -LONGINT_IMPL = MPZ - -# The default queue depth of 16 overflows on release builds, -# so increase it to 32. -CFLAGS += -DCFG_TUD_TASK_QUEUE_SZ=32 - -CIRCUITPY_ESP_FLASH_MODE=dio -CIRCUITPY_ESP_FLASH_FREQ=40m -CIRCUITPY_ESP_FLASH_SIZE=4MB +CIRCUITPY_ESP_FLASH_MODE = dio +CIRCUITPY_ESP_FLASH_FREQ = 40m +CIRCUITPY_ESP_FLASH_SIZE = 4MB diff --git a/ports/espressif/boards/espressif_esp32s2_devkitc_1_n8r2/board.c b/ports/espressif/boards/espressif_esp32s2_devkitc_1_n8r2/board.c new file mode 100644 index 0000000000..b3c8cb4191 --- /dev/null +++ b/ports/espressif/boards/espressif_esp32s2_devkitc_1_n8r2/board.c @@ -0,0 +1,39 @@ +/* + * This file is part of the MicroPython project, http://micropython.org/ + * + * The MIT License (MIT) + * + * Copyright (c) 2020 Scott Shawcroft for Adafruit Industries + * + * Permission is hereby granted, free of charge, to any person obtaining a copy + * of this software and associated documentation files (the "Software"), to deal + * in the Software without restriction, including without limitation the rights + * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell + * copies of the Software, and to permit persons to whom the Software is + * furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice shall be included in + * all copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE + * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER + * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, + * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN + * THE SOFTWARE. + */ + +#include "supervisor/board.h" +#include "mpconfigboard.h" +#include "shared-bindings/microcontroller/Pin.h" + +void board_init(void) { + // Debug UART + #ifdef DEBUG + common_hal_never_reset_pin(&pin_GPIO43); + common_hal_never_reset_pin(&pin_GPIO44); + #endif /* DEBUG */ +} + +// Use the MP_WEAK supervisor/shared/board.c versions of routines not defined here. diff --git a/ports/espressif/boards/espressif_esp32s2_devkitc_1_n8r2/mpconfigboard.h b/ports/espressif/boards/espressif_esp32s2_devkitc_1_n8r2/mpconfigboard.h new file mode 100644 index 0000000000..51fb60fe1a --- /dev/null +++ b/ports/espressif/boards/espressif_esp32s2_devkitc_1_n8r2/mpconfigboard.h @@ -0,0 +1,39 @@ +/* + * This file is part of the MicroPython project, http://micropython.org/ + * + * The MIT License (MIT) + * + * Copyright (c) 2019 Scott Shawcroft for Adafruit Industries + * + * Permission is hereby granted, free of charge, to any person obtaining a copy + * of this software and associated documentation files (the "Software"), to deal + * in the Software without restriction, including without limitation the rights + * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell + * copies of the Software, and to permit persons to whom the Software is + * furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice shall be included in + * all copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE + * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER + * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, + * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN + * THE SOFTWARE. + */ + +// Micropython setup + +#define MICROPY_HW_BOARD_NAME "ESP32-S2-DevKitC-1-N8R2" +#define MICROPY_HW_MCU_NAME "ESP32S2" + +#define MICROPY_HW_NEOPIXEL (&pin_GPIO18) + +#define CIRCUITPY_BOOT_BUTTON (&pin_GPIO0) + +#define DEFAULT_UART_BUS_RX (&pin_GPIO44) +#define DEFAULT_UART_BUS_TX (&pin_GPIO43) + +#define BOARD_USER_SAFE_MODE_ACTION translate("pressing boot button at start up.\n") diff --git a/ports/espressif/boards/espressif_esp32s2_devkitc_1_n8r2/mpconfigboard.mk b/ports/espressif/boards/espressif_esp32s2_devkitc_1_n8r2/mpconfigboard.mk new file mode 100644 index 0000000000..883df304f4 --- /dev/null +++ b/ports/espressif/boards/espressif_esp32s2_devkitc_1_n8r2/mpconfigboard.mk @@ -0,0 +1,10 @@ +USB_VID = 0x303A +USB_PID = 0x7009 +USB_PRODUCT = "ESP32-S2-DevKitC-1-N8R2" +USB_MANUFACTURER = "Espressif" + +IDF_TARGET = esp32s2 + +CIRCUITPY_ESP_FLASH_MODE=dio +CIRCUITPY_ESP_FLASH_FREQ=40m +CIRCUITPY_ESP_FLASH_SIZE=8MB diff --git a/ports/espressif/boards/espressif_esp32s2_devkitc_1_n8r2/pins.c b/ports/espressif/boards/espressif_esp32s2_devkitc_1_n8r2/pins.c new file mode 100644 index 0000000000..435f251c80 --- /dev/null +++ b/ports/espressif/boards/espressif_esp32s2_devkitc_1_n8r2/pins.c @@ -0,0 +1,53 @@ +#include "shared-bindings/board/__init__.h" + +STATIC const mp_rom_map_elem_t board_module_globals_table[] = { + CIRCUITPYTHON_BOARD_DICT_STANDARD_ITEMS + + { MP_ROM_QSTR(MP_QSTR_IO0), MP_ROM_PTR(&pin_GPIO0) }, + { MP_ROM_QSTR(MP_QSTR_IO1), MP_ROM_PTR(&pin_GPIO1) }, + { MP_ROM_QSTR(MP_QSTR_IO2), MP_ROM_PTR(&pin_GPIO2) }, + { MP_ROM_QSTR(MP_QSTR_IO3), MP_ROM_PTR(&pin_GPIO3) }, + { MP_ROM_QSTR(MP_QSTR_IO4), MP_ROM_PTR(&pin_GPIO4) }, + { MP_ROM_QSTR(MP_QSTR_IO5), MP_ROM_PTR(&pin_GPIO5) }, + { MP_ROM_QSTR(MP_QSTR_IO6), MP_ROM_PTR(&pin_GPIO6) }, + { MP_ROM_QSTR(MP_QSTR_IO7), MP_ROM_PTR(&pin_GPIO7) }, + { MP_ROM_QSTR(MP_QSTR_IO8), MP_ROM_PTR(&pin_GPIO8) }, + { MP_ROM_QSTR(MP_QSTR_IO9), MP_ROM_PTR(&pin_GPIO9) }, + { MP_ROM_QSTR(MP_QSTR_IO10), MP_ROM_PTR(&pin_GPIO10) }, + { MP_ROM_QSTR(MP_QSTR_IO11), MP_ROM_PTR(&pin_GPIO11) }, + { MP_ROM_QSTR(MP_QSTR_IO12), MP_ROM_PTR(&pin_GPIO12) }, + { MP_ROM_QSTR(MP_QSTR_IO13), MP_ROM_PTR(&pin_GPIO13) }, + { MP_ROM_QSTR(MP_QSTR_IO14), MP_ROM_PTR(&pin_GPIO14) }, + { MP_ROM_QSTR(MP_QSTR_IO15), MP_ROM_PTR(&pin_GPIO15) }, + { MP_ROM_QSTR(MP_QSTR_IO16), MP_ROM_PTR(&pin_GPIO16) }, + { MP_ROM_QSTR(MP_QSTR_IO17), MP_ROM_PTR(&pin_GPIO17) }, + + { MP_ROM_QSTR(MP_QSTR_NEOPIXEL), MP_ROM_PTR(&pin_GPIO18) }, + { MP_ROM_QSTR(MP_QSTR_IO18), MP_ROM_PTR(&pin_GPIO18) }, + + { MP_ROM_QSTR(MP_QSTR_IO19), MP_ROM_PTR(&pin_GPIO19) }, + { MP_ROM_QSTR(MP_QSTR_IO20), MP_ROM_PTR(&pin_GPIO20) }, + { MP_ROM_QSTR(MP_QSTR_IO21), MP_ROM_PTR(&pin_GPIO21) }, + { MP_ROM_QSTR(MP_QSTR_IO26), MP_ROM_PTR(&pin_GPIO26) }, + { MP_ROM_QSTR(MP_QSTR_IO33), MP_ROM_PTR(&pin_GPIO33) }, + { MP_ROM_QSTR(MP_QSTR_IO34), MP_ROM_PTR(&pin_GPIO34) }, + { MP_ROM_QSTR(MP_QSTR_IO35), MP_ROM_PTR(&pin_GPIO35) }, + { MP_ROM_QSTR(MP_QSTR_IO36), MP_ROM_PTR(&pin_GPIO36) }, + { MP_ROM_QSTR(MP_QSTR_IO37), MP_ROM_PTR(&pin_GPIO37) }, + { MP_ROM_QSTR(MP_QSTR_IO38), MP_ROM_PTR(&pin_GPIO38) }, + { MP_ROM_QSTR(MP_QSTR_IO39), MP_ROM_PTR(&pin_GPIO39) }, + { MP_ROM_QSTR(MP_QSTR_IO40), MP_ROM_PTR(&pin_GPIO40) }, + { MP_ROM_QSTR(MP_QSTR_IO41), MP_ROM_PTR(&pin_GPIO41) }, + { MP_ROM_QSTR(MP_QSTR_IO42), MP_ROM_PTR(&pin_GPIO42) }, + + { MP_ROM_QSTR(MP_QSTR_TX), MP_ROM_PTR(&pin_GPIO43) }, + { MP_ROM_QSTR(MP_QSTR_IO43), MP_ROM_PTR(&pin_GPIO43) }, + + { MP_ROM_QSTR(MP_QSTR_RX), MP_ROM_PTR(&pin_GPIO44) }, + { MP_ROM_QSTR(MP_QSTR_IO44), MP_ROM_PTR(&pin_GPIO44) }, + + { MP_ROM_QSTR(MP_QSTR_IO45), MP_ROM_PTR(&pin_GPIO45) }, + { MP_ROM_QSTR(MP_QSTR_IO46), MP_ROM_PTR(&pin_GPIO46) }, + +}; +MP_DEFINE_CONST_DICT(board_module_globals, board_module_globals_table); diff --git a/ports/espressif/boards/espressif_esp32s2_devkitc_1_n8r2/sdkconfig b/ports/espressif/boards/espressif_esp32s2_devkitc_1_n8r2/sdkconfig new file mode 100644 index 0000000000..926a7813ba --- /dev/null +++ b/ports/espressif/boards/espressif_esp32s2_devkitc_1_n8r2/sdkconfig @@ -0,0 +1,37 @@ +CONFIG_ESP32S2_SPIRAM_SUPPORT=y +# +# SPI RAM config +# +CONFIG_SPIRAM_MODE_QUAD=y +# CONFIG_SPIRAM_MODE_OCT is not set +# CONFIG_SPIRAM_TYPE_AUTO is not set +CONFIG_SPIRAM_TYPE_ESPPSRAM16=y +# CONFIG_SPIRAM_TYPE_ESPPSRAM32 is not set +# CONFIG_SPIRAM_TYPE_ESPPSRAM64 is not set +CONFIG_SPIRAM_SIZE=2097152 +# end of SPI RAM config + +CONFIG_DEFAULT_PSRAM_CLK_IO=30 +# +# PSRAM Clock and CS IO for ESP32S3 +# +CONFIG_DEFAULT_PSRAM_CS_IO=26 +# end of PSRAM Clock and CS IO for ESP32S3 + +# CONFIG_SPIRAM_FETCH_INSTRUCTIONS is not set +# CONFIG_SPIRAM_RODATA is not set +# CONFIG_SPIRAM_SPEED_120M is not set +# CONFIG_SPIRAM_SPEED_80M is not set +CONFIG_SPIRAM_SPEED_40M=y +CONFIG_SPIRAM=y +CONFIG_SPIRAM_BOOT_INIT=y +# CONFIG_SPIRAM_IGNORE_NOTFOUND is not set +CONFIG_SPIRAM_USE_MEMMAP=y +# CONFIG_SPIRAM_USE_CAPS_ALLOC is not set +# CONFIG_SPIRAM_USE_MALLOC is not set +CONFIG_SPIRAM_MEMTEST=y +# +# LWIP +# +CONFIG_LWIP_LOCAL_HOSTNAME="espressif-esp32s2" +# end of LWIP diff --git a/ports/espressif/boards/espressif_esp32s3_box/board.c b/ports/espressif/boards/espressif_esp32s3_box/board.c index 8e93c31e07..75c0ede92d 100644 --- a/ports/espressif/boards/espressif_esp32s3_box/board.c +++ b/ports/espressif/boards/espressif_esp32s3_box/board.c @@ -80,14 +80,14 @@ void board_init(void) { sizeof(display_init_sequence), &pin_GPIO45, // backlight pin NO_BRIGHTNESS_COMMAND, - 1.0f, // brightness (ignored) - true, // auto_brightness + 1.0f, // brightness false, // single_byte_bounds false, // data_as_commands true, // auto_refresh 60, // native_frames_per_second true, // backlight_on_high - false); // SH1107_addressing + false, // SH1107_addressing + 50000); // backlight pwm frequency // Debug UART #ifdef DEBUG @@ -96,13 +96,4 @@ void board_init(void) { #endif } -bool board_requests_safe_mode(void) { - return false; -} - -void reset_board(void) { - -} - -void board_deinit(void) { -} +// Use the MP_WEAK supervisor/shared/board.c versions of routines not defined here. diff --git a/ports/espressif/boards/espressif_esp32s3_box/mpconfigboard.mk b/ports/espressif/boards/espressif_esp32s3_box/mpconfigboard.mk index 6664ba8c98..c635cdcb56 100644 --- a/ports/espressif/boards/espressif_esp32s3_box/mpconfigboard.mk +++ b/ports/espressif/boards/espressif_esp32s3_box/mpconfigboard.mk @@ -5,13 +5,6 @@ USB_MANUFACTURER = "Espressif" IDF_TARGET = esp32s3 -INTERNAL_FLASH_FILESYSTEM = 1 -LONGINT_IMPL = MPZ - -# The default queue depth of 16 overflows on release builds, -# so increase it to 32. -CFLAGS += -DCFG_TUD_TASK_QUEUE_SZ=32 - -CIRCUITPY_ESP_FLASH_MODE=dio -CIRCUITPY_ESP_FLASH_FREQ=80m -CIRCUITPY_ESP_FLASH_SIZE=16MB +CIRCUITPY_ESP_FLASH_MODE = dio +CIRCUITPY_ESP_FLASH_FREQ = 40m +CIRCUITPY_ESP_FLASH_SIZE = 16MB diff --git a/ports/espressif/boards/espressif_esp32s3_box_lite/board.c b/ports/espressif/boards/espressif_esp32s3_box_lite/board.c new file mode 100644 index 0000000000..23c67d06b6 --- /dev/null +++ b/ports/espressif/boards/espressif_esp32s3_box_lite/board.c @@ -0,0 +1,100 @@ +/* + * This file is part of the MicroPython project, http://micropython.org/ + * + * The MIT License (MIT) + * + * Copyright (c) 2020 Scott Shawcroft for Adafruit Industries + * + * Permission is hereby granted, free of charge, to any person obtaining a copy + * of this software and associated documentation files (the "Software"), to deal + * in the Software without restriction, including without limitation the rights + * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell + * copies of the Software, and to permit persons to whom the Software is + * furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice shall be included in + * all copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE + * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER + * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, + * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN + * THE SOFTWARE. + */ + +#include "supervisor/board.h" +#include "mpconfigboard.h" +#include "shared-bindings/microcontroller/Pin.h" + +#include "shared-bindings/busio/SPI.h" +#include "shared-bindings/displayio/FourWire.h" +#include "shared-module/displayio/__init__.h" +#include "shared-module/displayio/mipi_constants.h" + +uint8_t display_init_sequence[] = { + 0x01, 0x80, 0x96, // _SWRESET and Delay 150ms + 0x11, 0x80, 0xFF, // _SLPOUT and Delay 500ms + 0x3A, 0x81, 0x55, 0x0A, // _COLMOD and Delay 10ms + 0x21, 0x80, 0x0A, // _INVON + 0x13, 0x80, 0x0A, // _NORON and Delay 10ms + 0x36, 0x01, 0xA0, // _MADCTL + 0x29, 0x80, 0xFF, // _DISPON and Delay 500ms +}; + +void board_init(void) { + busio_spi_obj_t *spi = &displays[0].fourwire_bus.inline_bus; + common_hal_busio_spi_construct(spi, &pin_GPIO7, &pin_GPIO6, NULL, false); + common_hal_busio_spi_never_reset(spi); + + displayio_fourwire_obj_t *bus = &displays[0].fourwire_bus; + bus->base.type = &displayio_fourwire_type; + common_hal_displayio_fourwire_construct(bus, + spi, + &pin_GPIO4, // TFT_DC Command or data + &pin_GPIO5, // TFT_CS Chip select + &pin_GPIO48, // TFT_RST Reset + 60000000, // Baudrate + 0, // Polarity + 0); // Phase + + displayio_display_obj_t *display = &displays[0].display; + display->base.type = &displayio_display_type; + common_hal_displayio_display_construct(display, + bus, + 320, // Width + 240, // Height + 0, // column start + 0, // row start + 0, // rotation + 16, // Color depth + false, // Grayscale + false, // pixels in a byte share a row. Only valid for depths < 8 + 1, // bytes per cell. Only valid for depths < 8 + false, // reverse_pixels_in_byte. Only valid for depths < 8 + true, // reverse_pixels_in_word + MIPI_COMMAND_SET_COLUMN_ADDRESS, // Set column command + MIPI_COMMAND_SET_PAGE_ADDRESS, // Set row command + MIPI_COMMAND_WRITE_MEMORY_START, // Write memory command + display_init_sequence, + sizeof(display_init_sequence), + &pin_GPIO45, // backlight pin + NO_BRIGHTNESS_COMMAND, + 1.0f, // brightness + false, // single_byte_bounds + false, // data_as_commands + true, // auto_refresh + 60, // native_frames_per_second + false, // backlight_on_high + false, // SH1107_addressing + 50000); // backlight pwm frequency + + // Debug UART + #ifdef DEBUG + common_hal_never_reset_pin(&pin_GPIO43); + common_hal_never_reset_pin(&pin_GPIO44); + #endif +} + +// Use the MP_WEAK supervisor/shared/board.c versions of routines not defined here. diff --git a/ports/espressif/boards/espressif_esp32s3_box_lite/mpconfigboard.h b/ports/espressif/boards/espressif_esp32s3_box_lite/mpconfigboard.h new file mode 100644 index 0000000000..fddcddc7c3 --- /dev/null +++ b/ports/espressif/boards/espressif_esp32s3_box_lite/mpconfigboard.h @@ -0,0 +1,30 @@ +/* + * This file is part of the MicroPython project, http://micropython.org/ + * + * The MIT License (MIT) + * + * Copyright (c) 2019 Scott Shawcroft for Adafruit Industries + * + * Permission is hereby granted, free of charge, to any person obtaining a copy + * of this software and associated documentation files (the "Software"), to deal + * in the Software without restriction, including without limitation the rights + * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell + * copies of the Software, and to permit persons to whom the Software is + * furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice shall be included in + * all copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE + * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER + * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, + * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN + * THE SOFTWARE. + */ + +// Micropython setup + +#define MICROPY_HW_BOARD_NAME "ESP32-S3-Box-Lite" +#define MICROPY_HW_MCU_NAME "ESP32S3" diff --git a/ports/espressif/boards/espressif_esp32s3_box_lite/mpconfigboard.mk b/ports/espressif/boards/espressif_esp32s3_box_lite/mpconfigboard.mk new file mode 100644 index 0000000000..2e63089b9c --- /dev/null +++ b/ports/espressif/boards/espressif_esp32s3_box_lite/mpconfigboard.mk @@ -0,0 +1,10 @@ +USB_VID = 0x303A +USB_PID = 0x700D +USB_PRODUCT = "ESP32-S3-Box-Lite" +USB_MANUFACTURER = "Espressif" + +IDF_TARGET = esp32s3 + +CIRCUITPY_ESP_FLASH_MODE=dio +CIRCUITPY_ESP_FLASH_FREQ=40m +CIRCUITPY_ESP_FLASH_SIZE=16MB diff --git a/ports/espressif/boards/espressif_esp32s3_box_lite/pins.c b/ports/espressif/boards/espressif_esp32s3_box_lite/pins.c new file mode 100644 index 0000000000..73ef15697c --- /dev/null +++ b/ports/espressif/boards/espressif_esp32s3_box_lite/pins.c @@ -0,0 +1,67 @@ +#include "shared-bindings/board/__init__.h" +#include "shared-module/displayio/__init__.h" + +STATIC const mp_rom_map_elem_t board_module_globals_table[] = { + CIRCUITPYTHON_BOARD_DICT_STANDARD_ITEMS + + // First PMOD connector + { MP_ROM_QSTR(MP_QSTR_G9), MP_ROM_PTR(&pin_GPIO9) }, + + { MP_ROM_QSTR(MP_QSTR_U0TXD), MP_ROM_PTR(&pin_GPIO43) }, + { MP_ROM_QSTR(MP_QSTR_G43), MP_ROM_PTR(&pin_GPIO43) }, + + { MP_ROM_QSTR(MP_QSTR_U0RXD), MP_ROM_PTR(&pin_GPIO44) }, + { MP_ROM_QSTR(MP_QSTR_G44), MP_ROM_PTR(&pin_GPIO44) }, + + { MP_ROM_QSTR(MP_QSTR_CS), MP_ROM_PTR(&pin_GPIO10) }, + { MP_ROM_QSTR(MP_QSTR_G10), MP_ROM_PTR(&pin_GPIO10) }, + + { MP_ROM_QSTR(MP_QSTR_MOSI), MP_ROM_PTR(&pin_GPIO11) }, + { MP_ROM_QSTR(MP_QSTR_G11), MP_ROM_PTR(&pin_GPIO11) }, + + { MP_ROM_QSTR(MP_QSTR_MISO), MP_ROM_PTR(&pin_GPIO13) }, + { MP_ROM_QSTR(MP_QSTR_G13), MP_ROM_PTR(&pin_GPIO13) }, + + { MP_ROM_QSTR(MP_QSTR_CLK), MP_ROM_PTR(&pin_GPIO12) }, + { MP_ROM_QSTR(MP_QSTR_G12), MP_ROM_PTR(&pin_GPIO12) }, + + { MP_ROM_QSTR(MP_QSTR_G14), MP_ROM_PTR(&pin_GPIO14) }, + + // Second PMOD connector + { MP_ROM_QSTR(MP_QSTR_G38), MP_ROM_PTR(&pin_GPIO38) }, + { MP_ROM_QSTR(MP_QSTR_G39), MP_ROM_PTR(&pin_GPIO39) }, + { MP_ROM_QSTR(MP_QSTR_SCL2), MP_ROM_PTR(&pin_GPIO40) }, + { MP_ROM_QSTR(MP_QSTR_G40), MP_ROM_PTR(&pin_GPIO40) }, + { MP_ROM_QSTR(MP_QSTR_SDA2), MP_ROM_PTR(&pin_GPIO41) }, + { MP_ROM_QSTR(MP_QSTR_G41), MP_ROM_PTR(&pin_GPIO41) }, + { MP_ROM_QSTR(MP_QSTR_G42), MP_ROM_PTR(&pin_GPIO42) }, + { MP_ROM_QSTR(MP_QSTR_G21), MP_ROM_PTR(&pin_GPIO21) }, + + // LCD & touchscreen + { MP_ROM_QSTR(MP_QSTR_LCD_DC), MP_ROM_PTR(&pin_GPIO4) }, + { MP_ROM_QSTR(MP_QSTR_LCD_CS), MP_ROM_PTR(&pin_GPIO5) }, + { MP_ROM_QSTR(MP_QSTR_LCD_MOSI), MP_ROM_PTR(&pin_GPIO6) }, + { MP_ROM_QSTR(MP_QSTR_LCD_SCK), MP_ROM_PTR(&pin_GPIO7) }, + { MP_ROM_QSTR(MP_QSTR_LCD_RST), MP_ROM_PTR(&pin_GPIO48) }, + { MP_ROM_QSTR(MP_QSTR_LCD_CTRL), MP_ROM_PTR(&pin_GPIO45) }, + { MP_ROM_QSTR(MP_QSTR_CTP_INT), MP_ROM_PTR(&pin_GPIO3) }, + + // Audio + { MP_ROM_QSTR(MP_QSTR_I2S_ADC_SDOUT), MP_ROM_PTR(&pin_GPIO16) }, + { MP_ROM_QSTR(MP_QSTR_I2S_MCLK), MP_ROM_PTR(&pin_GPIO2) }, + { MP_ROM_QSTR(MP_QSTR_I2S_SCLK), MP_ROM_PTR(&pin_GPIO17) }, + { MP_ROM_QSTR(MP_QSTR_I2S_LRCK), MP_ROM_PTR(&pin_GPIO47) }, + { MP_ROM_QSTR(MP_QSTR_I2S_CODEC_DSDIN), MP_ROM_PTR(&pin_GPIO15) }, + { MP_ROM_QSTR(MP_QSTR_PA_CTRL), MP_ROM_PTR(&pin_GPIO46) }, + { MP_ROM_QSTR(MP_QSTR_MUTE_STATUS), MP_ROM_PTR(&pin_GPIO1) }, + + // Internal I2C bus + { MP_ROM_QSTR(MP_QSTR_SDA), MP_ROM_PTR(&pin_GPIO8) }, + { MP_ROM_QSTR(MP_QSTR_SCL), MP_ROM_PTR(&pin_GPIO18) }, + + // boot button, also usable as a software button + { MP_ROM_QSTR(MP_QSTR_BOOT), MP_ROM_PTR(&pin_GPIO0) }, + + { MP_ROM_QSTR(MP_QSTR_DISPLAY), MP_ROM_PTR(&displays[0].display)} +}; +MP_DEFINE_CONST_DICT(board_module_globals, board_module_globals_table); diff --git a/ports/espressif/boards/espressif_esp32s3_box_lite/sdkconfig b/ports/espressif/boards/espressif_esp32s3_box_lite/sdkconfig new file mode 100644 index 0000000000..7fcf8ef297 --- /dev/null +++ b/ports/espressif/boards/espressif_esp32s3_box_lite/sdkconfig @@ -0,0 +1,37 @@ +CONFIG_ESP32S3_SPIRAM_SUPPORT=y +# +# SPI RAM config +# +# CONFIG_SPIRAM_MODE_QUAD is not set +CONFIG_SPIRAM_MODE_OCT=y +CONFIG_SPIRAM_TYPE_AUTO=y +# CONFIG_SPIRAM_TYPE_ESPPSRAM64 is not set +CONFIG_SPIRAM_SIZE=-1 +# end of SPI RAM config + +CONFIG_DEFAULT_PSRAM_CLK_IO=30 +# +# PSRAM Clock and CS IO for ESP32S3 +# +CONFIG_DEFAULT_PSRAM_CS_IO=26 +# end of PSRAM Clock and CS IO for ESP32S3 + +# CONFIG_SPIRAM_FETCH_INSTRUCTIONS is not set +# CONFIG_SPIRAM_RODATA is not set +CONFIG_SPIRAM_SPEED_80M=y +# CONFIG_SPIRAM_SPEED_40M is not set +CONFIG_SPIRAM=y +CONFIG_SPIRAM_BOOT_INIT=y +# CONFIG_SPIRAM_IGNORE_NOTFOUND is not set +# CONFIG_SPIRAM_USE_MEMMAP is not set +# CONFIG_SPIRAM_USE_CAPS_ALLOC is not set +CONFIG_SPIRAM_USE_MALLOC=y +CONFIG_SPIRAM_MEMTEST=y +CONFIG_SPIRAM_MALLOC_ALWAYSINTERNAL=16384 +# CONFIG_SPIRAM_TRY_ALLOCATE_WIFI_LWIP is not set +CONFIG_SPIRAM_MALLOC_RESERVE_INTERNAL=32768 +# +# LWIP +# +CONFIG_LWIP_LOCAL_HOSTNAME="espressif-esp32s3" +# end of LWIP diff --git a/ports/espressif/boards/espressif_esp32s3_devkitc_1_n8/board.c b/ports/espressif/boards/espressif_esp32s3_devkitc_1_n8/board.c index ff9418ec86..3b1f5efd87 100644 --- a/ports/espressif/boards/espressif_esp32s3_devkitc_1_n8/board.c +++ b/ports/espressif/boards/espressif_esp32s3_devkitc_1_n8/board.c @@ -36,13 +36,4 @@ void board_init(void) { #endif } -bool board_requests_safe_mode(void) { - return false; -} - -void reset_board(void) { - -} - -void board_deinit(void) { -} +// Use the MP_WEAK supervisor/shared/board.c versions of routines not defined here. diff --git a/ports/espressif/boards/espressif_esp32s3_devkitc_1_n8/mpconfigboard.mk b/ports/espressif/boards/espressif_esp32s3_devkitc_1_n8/mpconfigboard.mk index b6ead37eee..7ae39254b4 100644 --- a/ports/espressif/boards/espressif_esp32s3_devkitc_1_n8/mpconfigboard.mk +++ b/ports/espressif/boards/espressif_esp32s3_devkitc_1_n8/mpconfigboard.mk @@ -5,13 +5,7 @@ USB_MANUFACTURER = "Espressif" IDF_TARGET = esp32s3 -INTERNAL_FLASH_FILESYSTEM = 1 -LONGINT_IMPL = MPZ - -# The default queue depth of 16 overflows on release builds, -# so increase it to 32. -CFLAGS += -DCFG_TUD_TASK_QUEUE_SZ=32 - -CIRCUITPY_ESP_FLASH_MODE=dio -CIRCUITPY_ESP_FLASH_FREQ=80m -CIRCUITPY_ESP_FLASH_SIZE=8MB +CIRCUITPY_ESP_FLASH_MODE = dio +CIRCUITPY_ESP_FLASH_FREQ = 80m +CIRCUITPY_ESP_FLASH_SIZE = 8MB +CIRCUITPY_ESP32_CAMERA = 0 diff --git a/ports/espressif/boards/espressif_esp32s3_devkitc_1_n8r2/board.c b/ports/espressif/boards/espressif_esp32s3_devkitc_1_n8r2/board.c index ff9418ec86..3b1f5efd87 100644 --- a/ports/espressif/boards/espressif_esp32s3_devkitc_1_n8r2/board.c +++ b/ports/espressif/boards/espressif_esp32s3_devkitc_1_n8r2/board.c @@ -36,13 +36,4 @@ void board_init(void) { #endif } -bool board_requests_safe_mode(void) { - return false; -} - -void reset_board(void) { - -} - -void board_deinit(void) { -} +// Use the MP_WEAK supervisor/shared/board.c versions of routines not defined here. diff --git a/ports/espressif/boards/espressif_esp32s3_devkitc_1_n8r2/mpconfigboard.mk b/ports/espressif/boards/espressif_esp32s3_devkitc_1_n8r2/mpconfigboard.mk index 7fff66f5d8..7d5afe9a9f 100644 --- a/ports/espressif/boards/espressif_esp32s3_devkitc_1_n8r2/mpconfigboard.mk +++ b/ports/espressif/boards/espressif_esp32s3_devkitc_1_n8r2/mpconfigboard.mk @@ -5,13 +5,6 @@ USB_MANUFACTURER = "Espressif" IDF_TARGET = esp32s3 -INTERNAL_FLASH_FILESYSTEM = 1 -LONGINT_IMPL = MPZ - -# The default queue depth of 16 overflows on release builds, -# so increase it to 32. -CFLAGS += -DCFG_TUD_TASK_QUEUE_SZ=32 - -CIRCUITPY_ESP_FLASH_MODE=dio -CIRCUITPY_ESP_FLASH_FREQ=80m -CIRCUITPY_ESP_FLASH_SIZE=8MB +CIRCUITPY_ESP_FLASH_MODE = dio +CIRCUITPY_ESP_FLASH_FREQ = 80m +CIRCUITPY_ESP_FLASH_SIZE = 8MB diff --git a/ports/espressif/boards/espressif_esp32s3_devkitc_1_n8r8/board.c b/ports/espressif/boards/espressif_esp32s3_devkitc_1_n8r8/board.c index ff9418ec86..3b1f5efd87 100644 --- a/ports/espressif/boards/espressif_esp32s3_devkitc_1_n8r8/board.c +++ b/ports/espressif/boards/espressif_esp32s3_devkitc_1_n8r8/board.c @@ -36,13 +36,4 @@ void board_init(void) { #endif } -bool board_requests_safe_mode(void) { - return false; -} - -void reset_board(void) { - -} - -void board_deinit(void) { -} +// Use the MP_WEAK supervisor/shared/board.c versions of routines not defined here. diff --git a/ports/espressif/boards/espressif_esp32s3_devkitc_1_n8r8/mpconfigboard.mk b/ports/espressif/boards/espressif_esp32s3_devkitc_1_n8r8/mpconfigboard.mk index 4e65fc940d..95fa2d0324 100644 --- a/ports/espressif/boards/espressif_esp32s3_devkitc_1_n8r8/mpconfigboard.mk +++ b/ports/espressif/boards/espressif_esp32s3_devkitc_1_n8r8/mpconfigboard.mk @@ -5,13 +5,6 @@ USB_MANUFACTURER = "Espressif" IDF_TARGET = esp32s3 -INTERNAL_FLASH_FILESYSTEM = 1 -LONGINT_IMPL = MPZ - -# The default queue depth of 16 overflows on release builds, -# so increase it to 32. -CFLAGS += -DCFG_TUD_TASK_QUEUE_SZ=32 - -CIRCUITPY_ESP_FLASH_MODE=dio -CIRCUITPY_ESP_FLASH_FREQ=80m -CIRCUITPY_ESP_FLASH_SIZE=8MB +CIRCUITPY_ESP_FLASH_MODE = dio +CIRCUITPY_ESP_FLASH_FREQ = 80m +CIRCUITPY_ESP_FLASH_SIZE = 8MB diff --git a/ports/espressif/boards/espressif_esp32s3_devkitm_1_n8/board.c b/ports/espressif/boards/espressif_esp32s3_devkitm_1_n8/board.c index ff9418ec86..3b1f5efd87 100644 --- a/ports/espressif/boards/espressif_esp32s3_devkitm_1_n8/board.c +++ b/ports/espressif/boards/espressif_esp32s3_devkitm_1_n8/board.c @@ -36,13 +36,4 @@ void board_init(void) { #endif } -bool board_requests_safe_mode(void) { - return false; -} - -void reset_board(void) { - -} - -void board_deinit(void) { -} +// Use the MP_WEAK supervisor/shared/board.c versions of routines not defined here. diff --git a/ports/espressif/boards/espressif_esp32s3_devkitm_1_n8/mpconfigboard.mk b/ports/espressif/boards/espressif_esp32s3_devkitm_1_n8/mpconfigboard.mk index 9558b05576..ac58db8aed 100644 --- a/ports/espressif/boards/espressif_esp32s3_devkitm_1_n8/mpconfigboard.mk +++ b/ports/espressif/boards/espressif_esp32s3_devkitm_1_n8/mpconfigboard.mk @@ -5,13 +5,7 @@ USB_MANUFACTURER = "Espressif" IDF_TARGET = esp32s3 -INTERNAL_FLASH_FILESYSTEM = 1 -LONGINT_IMPL = MPZ - -# The default queue depth of 16 overflows on release builds, -# so increase it to 32. -CFLAGS += -DCFG_TUD_TASK_QUEUE_SZ=32 - -CIRCUITPY_ESP_FLASH_MODE=dio -CIRCUITPY_ESP_FLASH_FREQ=80m -CIRCUITPY_ESP_FLASH_SIZE=8MB +CIRCUITPY_ESP_FLASH_MODE = dio +CIRCUITPY_ESP_FLASH_FREQ = 80m +CIRCUITPY_ESP_FLASH_SIZE = 8MB +CIRCUITPY_ESP32_CAMERA = 0 diff --git a/ports/espressif/boards/espressif_esp32s3_eye/board.c b/ports/espressif/boards/espressif_esp32s3_eye/board.c new file mode 100644 index 0000000000..be129c6a30 --- /dev/null +++ b/ports/espressif/boards/espressif_esp32s3_eye/board.c @@ -0,0 +1,122 @@ +/* + * This file is part of the MicroPython project, http://micropython.org/ + * + * The MIT License (MIT) + * + * Copyright (c) 2020 Scott Shawcroft for Adafruit Industries + * + * Permission is hereby granted, free of charge, to any person obtaining a copy + * of this software and associated documentation files (the "Software"), to deal + * in the Software without restriction, including without limitation the rights + * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell + * copies of the Software, and to permit persons to whom the Software is + * furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice shall be included in + * all copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE + * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER + * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, + * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN + * THE SOFTWARE. + */ + +#include "supervisor/board.h" +#include "mpconfigboard.h" +#include "shared-bindings/busio/SPI.h" +#include "shared-bindings/displayio/FourWire.h" +#include "shared-bindings/microcontroller/Pin.h" +#include "shared-module/displayio/__init__.h" +#include "shared-module/displayio/mipi_constants.h" +#include "shared-bindings/board/__init__.h" + +displayio_fourwire_obj_t board_display_obj; + +#define DELAY 0x80 + +// display init sequence according to LilyGO example app +uint8_t display_init_sequence[] = { + // sw reset + 0x01, 0 | DELAY, 150, + // sleep out + 0x11, 0 | DELAY, 255, + // normal display mode on + 0x13, 0, + // display and color format settings + 0x36, 1, 0x08, + 0xB6, 2, 0x0A, 0x82, + 0x3A, 1 | DELAY, 0x55, 10, + // ST7789V frame rate setting + 0xB2, 5, 0x0C, 0x0C, 0x00, 0x33, 0x33, + // voltages: VGH / VGL + 0xB7, 1, 0x35, + // ST7789V power setting + 0xBB, 1, 0x28, + 0xC0, 1, 0x0C, + 0xC2, 2, 0x01, 0xFF, + 0xC3, 1, 0x10, + 0xC4, 1, 0x20, + 0xC6, 1, 0x0F, + 0xD0, 2, 0xA4, 0xA1, + // ST7789V gamma setting + 0xE0, 14, 0xD0, 0x00, 0x02, 0x07, 0x0A, 0x28, 0x32, 0x44, 0x42, 0x06, 0x0E, 0x12, 0x14, 0x17, + 0xE1, 14, 0xD0, 0x00, 0x02, 0x07, 0x0A, 0x28, 0x31, 0x54, 0x47, 0x0E, 0x1C, 0x17, 0x1B, 0x1E, + 0x21, 0, + // display on + 0x29, 0 | DELAY, 255, +}; + +void board_init(void) { + busio_spi_obj_t *spi = common_hal_board_create_spi(0); + displayio_fourwire_obj_t *bus = &displays[0].fourwire_bus; + bus->base.type = &displayio_fourwire_type; + + common_hal_displayio_fourwire_construct( + bus, + spi, + &pin_GPIO43, // DC + &pin_GPIO44, // CS + NULL, // no reset pin + 40000000, // baudrate + 0, // polarity + 0 // phase + ); + displayio_display_obj_t *display = &displays[0].display; + display->base.type = &displayio_display_type; + + common_hal_displayio_display_construct( + display, + bus, + 240, // width (after rotation) + 240, // height (after rotation) + 0, // column start + 0, // row start + 0, // rotation + 16, // color depth + false, // grayscale + false, // pixels in a byte share a row. Only valid for depths < 8 + 1, // bytes per cell. Only valid for depths < 8 + false, // reverse_pixels_in_byte. Only valid for depths < 8 + true, // reverse_pixels_in_word + MIPI_COMMAND_SET_COLUMN_ADDRESS, // set column command + MIPI_COMMAND_SET_PAGE_ADDRESS, // set row command + MIPI_COMMAND_WRITE_MEMORY_START, // write memory command + display_init_sequence, + sizeof(display_init_sequence), + &pin_GPIO48, // backlight pin + NO_BRIGHTNESS_COMMAND, + 1.0f, // brightness + false, // single_byte_bounds + false, // data_as_commands + true, // auto_refresh + 60, // native_frames_per_second + false, // backlight_on_high + false, // SH1107_addressing + 50000 // backlight pwm frequency + ); +} + +// Use the MP_WEAK supervisor/shared/board.c versions of routines not defined here. diff --git a/ports/espressif/boards/espressif_esp32s3_eye/mpconfigboard.h b/ports/espressif/boards/espressif_esp32s3_eye/mpconfigboard.h new file mode 100644 index 0000000000..43ade4f6c8 --- /dev/null +++ b/ports/espressif/boards/espressif_esp32s3_eye/mpconfigboard.h @@ -0,0 +1,47 @@ +/* + * This file is part of the MicroPython project, http://micropython.org/ + * + * The MIT License (MIT) + * + * Copyright (c) 2019 Scott Shawcroft for Adafruit Industries + * + * Permission is hereby granted, free of charge, to any person obtaining a copy + * of this software and associated documentation files (the "Software"), to deal + * in the Software without restriction, including without limitation the rights + * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell + * copies of the Software, and to permit persons to whom the Software is + * furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice shall be included in + * all copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE + * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER + * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, + * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN + * THE SOFTWARE. + */ + +// Micropython setup + +#define MICROPY_HW_BOARD_NAME "ESP32-S3-EYE" +#define MICROPY_HW_MCU_NAME "ESP32S3" + +// Shared by the camera and accelerometer +#define DEFAULT_I2C_BUS_SDA (&pin_GPIO4) +#define DEFAULT_I2C_BUS_SCL (&pin_GPIO5) + +// This is the SD card connection, not the LCD +#define DEFAULT_SPI_BUS_SCK (&pin_GPIO39) +#define DEFAULT_SPI_BUS_MISO (&pin_GPIO40) +#define DEFAULT_SPI_BUS_MOSI (&pin_GPIO38) + +#define CIRCUITPY_BOARD_SPI (2) +#define CIRCUITPY_BOARD_SPI_PIN { \ + {.clock = &pin_GPIO21, .mosi = &pin_GPIO47, .miso = NULL}, \ + {.clock = &pin_GPIO39, .mosi = &pin_GPIO40, .miso = &pin_GPIO38}, \ +} + +#define DEFAULT_RESERVED_PSRAM (1048576) diff --git a/ports/espressif/boards/espressif_esp32s3_eye/mpconfigboard.mk b/ports/espressif/boards/espressif_esp32s3_eye/mpconfigboard.mk new file mode 100644 index 0000000000..4711f28aaf --- /dev/null +++ b/ports/espressif/boards/espressif_esp32s3_eye/mpconfigboard.mk @@ -0,0 +1,10 @@ +USB_VID = 0x303A +USB_PID = 0x700F +USB_PRODUCT = "ESP32-S3-EYE" +USB_MANUFACTURER = "Espressif" + +IDF_TARGET = esp32s3 + +CIRCUITPY_ESP_FLASH_MODE = dio +CIRCUITPY_ESP_FLASH_FREQ = 80m +CIRCUITPY_ESP_FLASH_SIZE = 8MB diff --git a/ports/espressif/boards/espressif_esp32s3_eye/pins.c b/ports/espressif/boards/espressif_esp32s3_eye/pins.c new file mode 100644 index 0000000000..4b4da0b199 --- /dev/null +++ b/ports/espressif/boards/espressif_esp32s3_eye/pins.c @@ -0,0 +1,55 @@ +#include "py/objtuple.h" +#include "shared-bindings/board/__init__.h" +#include "shared-module/displayio/__init__.h" + +STATIC const mp_rom_obj_tuple_t camera_data_tuple = { + {&mp_type_tuple}, + 8, + { + MP_ROM_PTR(&pin_GPIO11), + MP_ROM_PTR(&pin_GPIO9), + MP_ROM_PTR(&pin_GPIO8), + MP_ROM_PTR(&pin_GPIO10), + MP_ROM_PTR(&pin_GPIO12), + MP_ROM_PTR(&pin_GPIO18), + MP_ROM_PTR(&pin_GPIO17), + MP_ROM_PTR(&pin_GPIO16), + } +}; + + +STATIC const mp_rom_map_elem_t board_module_globals_table[] = { + CIRCUITPYTHON_BOARD_DICT_STANDARD_ITEMS + + { MP_ROM_QSTR(MP_QSTR_BOOT), MP_ROM_PTR(&pin_GPIO0) }, + { MP_ROM_QSTR(MP_QSTR_BUTTONS), MP_ROM_PTR(&pin_GPIO1) }, + { MP_ROM_QSTR(MP_QSTR_MIC_SDO), MP_ROM_PTR(&pin_GPIO2) }, + { MP_ROM_QSTR(MP_QSTR_IO3), MP_ROM_PTR(&pin_GPIO3) }, // LCD + { MP_ROM_QSTR(MP_QSTR_SDA), MP_ROM_PTR(&pin_GPIO4) }, + { MP_ROM_QSTR(MP_QSTR_SCL), MP_ROM_PTR(&pin_GPIO5) }, + { MP_ROM_QSTR(MP_QSTR_CAMERA_DATA), MP_ROM_PTR(&camera_data_tuple) }, + { MP_ROM_QSTR(MP_QSTR_CAMERA_VSYNC), MP_ROM_PTR(&pin_GPIO6) }, + { MP_ROM_QSTR(MP_QSTR_CAMERA_HREF), MP_ROM_PTR(&pin_GPIO7) }, + { MP_ROM_QSTR(MP_QSTR_CAMERA_PCLK), MP_ROM_PTR(&pin_GPIO13) }, + { MP_ROM_QSTR(MP_QSTR_BATTERY), MP_ROM_PTR(&pin_GPIO14) }, + { MP_ROM_QSTR(MP_QSTR_CAMERA_XCLK), MP_ROM_PTR(&pin_GPIO15) }, + + { MP_ROM_QSTR(MP_QSTR_MOSI), MP_ROM_PTR(&pin_GPIO47) }, + { MP_ROM_QSTR(MP_QSTR_SCK), MP_ROM_PTR(&pin_GPIO21) }, + + { MP_ROM_QSTR(MP_QSTR_MISO1), MP_ROM_PTR(&pin_GPIO40) }, + { MP_ROM_QSTR(MP_QSTR_MOSI1), MP_ROM_PTR(&pin_GPIO38) }, + { MP_ROM_QSTR(MP_QSTR_SCK1), MP_ROM_PTR(&pin_GPIO39) }, + + { MP_ROM_QSTR(MP_QSTR_MIC_SCK), MP_ROM_PTR(&pin_GPIO41) }, + { MP_ROM_QSTR(MP_QSTR_MIC_WS), MP_ROM_PTR(&pin_GPIO42) }, + { MP_ROM_QSTR(MP_QSTR_LCD_DC), MP_ROM_PTR(&pin_GPIO43) }, + { MP_ROM_QSTR(MP_QSTR_LCD_CS), MP_ROM_PTR(&pin_GPIO44) }, + { MP_ROM_QSTR(MP_QSTR_BACKLIGHT), MP_ROM_PTR(&pin_GPIO48) }, + + { MP_ROM_QSTR(MP_QSTR_I2C), MP_ROM_PTR(&board_i2c_obj) }, + { MP_ROM_QSTR(MP_QSTR_SPI), MP_ROM_PTR(&board_spi_obj) }, + + { MP_ROM_QSTR(MP_QSTR_DISPLAY), MP_ROM_PTR(&displays[0].display)}, +}; +MP_DEFINE_CONST_DICT(board_module_globals, board_module_globals_table); diff --git a/ports/espressif/boards/espressif_esp32s3_eye/sdkconfig b/ports/espressif/boards/espressif_esp32s3_eye/sdkconfig new file mode 100644 index 0000000000..1a24832767 --- /dev/null +++ b/ports/espressif/boards/espressif_esp32s3_eye/sdkconfig @@ -0,0 +1,34 @@ +CONFIG_ESP32S3_SPIRAM_SUPPORT=y +# +# SPI RAM config +# +# CONFIG_SPIRAM_MODE_QUAD is not set +CONFIG_SPIRAM_MODE_OCT=y +# CONFIG_SPIRAM_TYPE_AUTO is not set +CONFIG_SPIRAM_TYPE_ESPPSRAM64=y +CONFIG_SPIRAM_SIZE=8388608 +# end of SPI RAM config + +CONFIG_DEFAULT_PSRAM_CLK_IO=30 +# +# PSRAM Clock and CS IO for ESP32S3 +# +CONFIG_DEFAULT_PSRAM_CS_IO=26 +# end of PSRAM Clock and CS IO for ESP32S3 + +# CONFIG_SPIRAM_FETCH_INSTRUCTIONS is not set +# CONFIG_SPIRAM_RODATA is not set +CONFIG_SPIRAM_SPEED_80M=y +# CONFIG_SPIRAM_SPEED_40M is not set +CONFIG_SPIRAM=y +CONFIG_SPIRAM_BOOT_INIT=y +# CONFIG_SPIRAM_IGNORE_NOTFOUND is not set +CONFIG_SPIRAM_USE_MEMMAP=y +# CONFIG_SPIRAM_USE_CAPS_ALLOC is not set +# CONFIG_SPIRAM_USE_MALLOC is not set +CONFIG_SPIRAM_MEMTEST=y +# +# LWIP +# +CONFIG_LWIP_LOCAL_HOSTNAME="espressif-esp32s3-eye" +# end of LWIP diff --git a/ports/espressif/boards/espressif_esp32s3_usb_otg_n8/board.c b/ports/espressif/boards/espressif_esp32s3_usb_otg_n8/board.c index edb8e6a994..685e7cf156 100644 --- a/ports/espressif/boards/espressif_esp32s3_usb_otg_n8/board.c +++ b/ports/espressif/boards/espressif_esp32s3_usb_otg_n8/board.c @@ -108,14 +108,18 @@ void board_init(void) { sizeof(display_init_sequence), &pin_GPIO9, // backlight pin NO_BRIGHTNESS_COMMAND, - 1.0f, // brightness (ignored) - true, // auto_brightness + 1.0f, // brightness false, // single_byte_bounds false, // data_as_commands true, // auto_refresh 60, // native_frames_per_second true, // backlight_on_high - false); // SH1107_addressing + false, // SH1107_addressing + 50000); // backlight pwm frequency + + #if CIRCUITPY_DEBUG + common_hal_never_reset_pin(DEFAULT_UART_BUS_TX); + #endif } bool espressif_board_reset_pin_number(gpio_num_t pin_number) { @@ -129,13 +133,4 @@ bool espressif_board_reset_pin_number(gpio_num_t pin_number) { return false; } -bool board_requests_safe_mode(void) { - return false; -} - -void reset_board(void) { - -} - -void board_deinit(void) { -} +// Use the MP_WEAK supervisor/shared/board.c versions of routines not defined here. diff --git a/ports/espressif/boards/espressif_esp32s3_usb_otg_n8/mpconfigboard.mk b/ports/espressif/boards/espressif_esp32s3_usb_otg_n8/mpconfigboard.mk index e9eab16f91..dd8403f779 100644 --- a/ports/espressif/boards/espressif_esp32s3_usb_otg_n8/mpconfigboard.mk +++ b/ports/espressif/boards/espressif_esp32s3_usb_otg_n8/mpconfigboard.mk @@ -5,13 +5,7 @@ USB_MANUFACTURER = "Espressif" IDF_TARGET = esp32s3 -INTERNAL_FLASH_FILESYSTEM = 1 -LONGINT_IMPL = MPZ - -# The default queue depth of 16 overflows on release builds, -# so increase it to 32. -CFLAGS += -DCFG_TUD_TASK_QUEUE_SZ=32 - -CIRCUITPY_ESP_FLASH_MODE=dio -CIRCUITPY_ESP_FLASH_FREQ=80m -CIRCUITPY_ESP_FLASH_SIZE=8MB +CIRCUITPY_ESP_FLASH_MODE = dio +CIRCUITPY_ESP_FLASH_FREQ = 80m +CIRCUITPY_ESP_FLASH_SIZE = 8MB +CIRCUITPY_ESP32_CAMERA = 0 diff --git a/ports/espressif/boards/espressif_hmi_devkit_1/board.c b/ports/espressif/boards/espressif_hmi_devkit_1/board.c index 93aa1c0436..b44ba7fad2 100644 --- a/ports/espressif/boards/espressif_hmi_devkit_1/board.c +++ b/ports/espressif/boards/espressif_hmi_devkit_1/board.c @@ -34,13 +34,4 @@ void board_init(void) { common_hal_never_reset_pin(&pin_GPIO44); } -bool board_requests_safe_mode(void) { - return false; -} - -void reset_board(void) { - -} - -void board_deinit(void) { -} +// Use the MP_WEAK supervisor/shared/board.c versions of routines not defined here. diff --git a/ports/espressif/boards/espressif_hmi_devkit_1/mpconfigboard.mk b/ports/espressif/boards/espressif_hmi_devkit_1/mpconfigboard.mk index 1b11f4fbee..60ff9fd5a1 100644 --- a/ports/espressif/boards/espressif_hmi_devkit_1/mpconfigboard.mk +++ b/ports/espressif/boards/espressif_hmi_devkit_1/mpconfigboard.mk @@ -5,15 +5,6 @@ USB_MANUFACTURER = "Espressif" IDF_TARGET = esp32s2 -INTERNAL_FLASH_FILESYSTEM = 1 -LONGINT_IMPL = MPZ - -# The default queue depth of 16 overflows on release builds, -# so increase it to 32. -CFLAGS += -DCFG_TUD_TASK_QUEUE_SZ=32 - -CIRCUITPY_ESP_FLASH_MODE=dio -CIRCUITPY_ESP_FLASH_FREQ=80m -CIRCUITPY_ESP_FLASH_SIZE=4MB - -CIRCUITPY_MODULE=wrover +CIRCUITPY_ESP_FLASH_MODE = dio +CIRCUITPY_ESP_FLASH_FREQ = 80m +CIRCUITPY_ESP_FLASH_SIZE = 4MB diff --git a/ports/espressif/boards/espressif_kaluga_1.3/board.c b/ports/espressif/boards/espressif_kaluga_1.3/board.c index 0432485111..b3c8cb4191 100644 --- a/ports/espressif/boards/espressif_kaluga_1.3/board.c +++ b/ports/espressif/boards/espressif_kaluga_1.3/board.c @@ -36,13 +36,4 @@ void board_init(void) { #endif /* DEBUG */ } -bool board_requests_safe_mode(void) { - return false; -} - -void reset_board(void) { - -} - -void board_deinit(void) { -} +// Use the MP_WEAK supervisor/shared/board.c versions of routines not defined here. diff --git a/ports/espressif/boards/espressif_kaluga_1.3/mpconfigboard.h b/ports/espressif/boards/espressif_kaluga_1.3/mpconfigboard.h index 8f89bfcbc4..459a5b3289 100644 --- a/ports/espressif/boards/espressif_kaluga_1.3/mpconfigboard.h +++ b/ports/espressif/boards/espressif_kaluga_1.3/mpconfigboard.h @@ -30,3 +30,6 @@ #define MICROPY_HW_MCU_NAME "ESP32S2" #define MICROPY_HW_NEOPIXEL (&pin_GPIO45) + +#define DEFAULT_I2C_BUS_SCL (&pin_GPIO7) +#define DEFAULT_I2C_BUS_SDA (&pin_GPIO8) diff --git a/ports/espressif/boards/espressif_kaluga_1.3/mpconfigboard.mk b/ports/espressif/boards/espressif_kaluga_1.3/mpconfigboard.mk index 7823674329..23578067ac 100644 --- a/ports/espressif/boards/espressif_kaluga_1.3/mpconfigboard.mk +++ b/ports/espressif/boards/espressif_kaluga_1.3/mpconfigboard.mk @@ -5,15 +5,6 @@ USB_MANUFACTURER = "Espressif" IDF_TARGET = esp32s2 -INTERNAL_FLASH_FILESYSTEM = 1 -LONGINT_IMPL = MPZ - -# The default queue depth of 16 overflows on release builds, -# so increase it to 32. -CFLAGS += -DCFG_TUD_TASK_QUEUE_SZ=32 - -CIRCUITPY_ESP_FLASH_MODE=dio -CIRCUITPY_ESP_FLASH_FREQ=80m -CIRCUITPY_ESP_FLASH_SIZE=4MB - -CIRCUITPY_MODULE=wrover +CIRCUITPY_ESP_FLASH_MODE = dio +CIRCUITPY_ESP_FLASH_FREQ = 80m +CIRCUITPY_ESP_FLASH_SIZE = 4MB diff --git a/ports/espressif/boards/espressif_kaluga_1.3/pins.c b/ports/espressif/boards/espressif_kaluga_1.3/pins.c index dff98ceeb9..caa7ecd064 100644 --- a/ports/espressif/boards/espressif_kaluga_1.3/pins.c +++ b/ports/espressif/boards/espressif_kaluga_1.3/pins.c @@ -140,5 +140,7 @@ STATIC const mp_rom_map_elem_t board_module_globals_table[] = { { MP_ROM_QSTR(MP_QSTR_AUDIO_I2S1_LRCK_DAC1), MP_ROM_PTR(&pin_GPIO17) }, { MP_ROM_QSTR(MP_QSTR_AUDIO_I2S1_BCLK_DAC2), MP_ROM_PTR(&pin_GPIO18) }, + { MP_ROM_QSTR(MP_QSTR_I2C), MP_ROM_PTR(&board_i2c_obj) }, + }; MP_DEFINE_CONST_DICT(board_module_globals, board_module_globals_table); diff --git a/ports/espressif/boards/espressif_kaluga_1/board.c b/ports/espressif/boards/espressif_kaluga_1/board.c index 0432485111..b3c8cb4191 100644 --- a/ports/espressif/boards/espressif_kaluga_1/board.c +++ b/ports/espressif/boards/espressif_kaluga_1/board.c @@ -36,13 +36,4 @@ void board_init(void) { #endif /* DEBUG */ } -bool board_requests_safe_mode(void) { - return false; -} - -void reset_board(void) { - -} - -void board_deinit(void) { -} +// Use the MP_WEAK supervisor/shared/board.c versions of routines not defined here. diff --git a/ports/espressif/boards/espressif_kaluga_1/mpconfigboard.mk b/ports/espressif/boards/espressif_kaluga_1/mpconfigboard.mk index 7823674329..23578067ac 100644 --- a/ports/espressif/boards/espressif_kaluga_1/mpconfigboard.mk +++ b/ports/espressif/boards/espressif_kaluga_1/mpconfigboard.mk @@ -5,15 +5,6 @@ USB_MANUFACTURER = "Espressif" IDF_TARGET = esp32s2 -INTERNAL_FLASH_FILESYSTEM = 1 -LONGINT_IMPL = MPZ - -# The default queue depth of 16 overflows on release builds, -# so increase it to 32. -CFLAGS += -DCFG_TUD_TASK_QUEUE_SZ=32 - -CIRCUITPY_ESP_FLASH_MODE=dio -CIRCUITPY_ESP_FLASH_FREQ=80m -CIRCUITPY_ESP_FLASH_SIZE=4MB - -CIRCUITPY_MODULE=wrover +CIRCUITPY_ESP_FLASH_MODE = dio +CIRCUITPY_ESP_FLASH_FREQ = 80m +CIRCUITPY_ESP_FLASH_SIZE = 4MB diff --git a/ports/espressif/boards/espressif_saola_1_wroom/board.c b/ports/espressif/boards/espressif_saola_1_wroom/board.c index 0432485111..b3c8cb4191 100644 --- a/ports/espressif/boards/espressif_saola_1_wroom/board.c +++ b/ports/espressif/boards/espressif_saola_1_wroom/board.c @@ -36,13 +36,4 @@ void board_init(void) { #endif /* DEBUG */ } -bool board_requests_safe_mode(void) { - return false; -} - -void reset_board(void) { - -} - -void board_deinit(void) { -} +// Use the MP_WEAK supervisor/shared/board.c versions of routines not defined here. diff --git a/ports/espressif/boards/espressif_saola_1_wroom/mpconfigboard.mk b/ports/espressif/boards/espressif_saola_1_wroom/mpconfigboard.mk index f25cdc4a63..4748b1c306 100644 --- a/ports/espressif/boards/espressif_saola_1_wroom/mpconfigboard.mk +++ b/ports/espressif/boards/espressif_saola_1_wroom/mpconfigboard.mk @@ -5,15 +5,7 @@ USB_MANUFACTURER = "Espressif" IDF_TARGET = esp32s2 -INTERNAL_FLASH_FILESYSTEM = 1 -LONGINT_IMPL = MPZ - -# The default queue depth of 16 overflows on release builds, -# so increase it to 32. -CFLAGS += -DCFG_TUD_TASK_QUEUE_SZ=32 - -CIRCUITPY_ESP_FLASH_MODE=dio -CIRCUITPY_ESP_FLASH_FREQ=40m -CIRCUITPY_ESP_FLASH_SIZE=4MB - -CIRCUITPY_MODULE=wroom +CIRCUITPY_ESP_FLASH_MODE = dio +CIRCUITPY_ESP_FLASH_FREQ = 40m +CIRCUITPY_ESP_FLASH_SIZE = 4MB +CIRCUITPY_ESP32_CAMERA = 0 diff --git a/ports/espressif/boards/espressif_saola_1_wrover/board.c b/ports/espressif/boards/espressif_saola_1_wrover/board.c index 0432485111..b3c8cb4191 100644 --- a/ports/espressif/boards/espressif_saola_1_wrover/board.c +++ b/ports/espressif/boards/espressif_saola_1_wrover/board.c @@ -36,13 +36,4 @@ void board_init(void) { #endif /* DEBUG */ } -bool board_requests_safe_mode(void) { - return false; -} - -void reset_board(void) { - -} - -void board_deinit(void) { -} +// Use the MP_WEAK supervisor/shared/board.c versions of routines not defined here. diff --git a/ports/espressif/boards/espressif_saola_1_wrover/mpconfigboard.mk b/ports/espressif/boards/espressif_saola_1_wrover/mpconfigboard.mk index b4154bf3a4..5156a5b6ce 100644 --- a/ports/espressif/boards/espressif_saola_1_wrover/mpconfigboard.mk +++ b/ports/espressif/boards/espressif_saola_1_wrover/mpconfigboard.mk @@ -5,15 +5,6 @@ USB_MANUFACTURER = "Espressif" IDF_TARGET = esp32s2 -INTERNAL_FLASH_FILESYSTEM = 1 -LONGINT_IMPL = MPZ - -# The default queue depth of 16 overflows on release builds, -# so increase it to 32. -CFLAGS += -DCFG_TUD_TASK_QUEUE_SZ=32 - -CIRCUITPY_ESP_FLASH_MODE=dio -CIRCUITPY_ESP_FLASH_FREQ=40m -CIRCUITPY_ESP_FLASH_SIZE=4MB - -CIRCUITPY_MODULE=wrover +CIRCUITPY_ESP_FLASH_MODE = dio +CIRCUITPY_ESP_FLASH_FREQ = 40m +CIRCUITPY_ESP_FLASH_SIZE = 4MB diff --git a/ports/espressif/boards/franzininho_wifi_wroom/board.c b/ports/espressif/boards/franzininho_wifi_wroom/board.c index 0432485111..b3c8cb4191 100644 --- a/ports/espressif/boards/franzininho_wifi_wroom/board.c +++ b/ports/espressif/boards/franzininho_wifi_wroom/board.c @@ -36,13 +36,4 @@ void board_init(void) { #endif /* DEBUG */ } -bool board_requests_safe_mode(void) { - return false; -} - -void reset_board(void) { - -} - -void board_deinit(void) { -} +// Use the MP_WEAK supervisor/shared/board.c versions of routines not defined here. diff --git a/ports/espressif/boards/franzininho_wifi_wroom/mpconfigboard.mk b/ports/espressif/boards/franzininho_wifi_wroom/mpconfigboard.mk index f1ed49a32a..193a867fb2 100644 --- a/ports/espressif/boards/franzininho_wifi_wroom/mpconfigboard.mk +++ b/ports/espressif/boards/franzininho_wifi_wroom/mpconfigboard.mk @@ -5,15 +5,7 @@ USB_MANUFACTURER = "Espressif" IDF_TARGET = esp32s2 -INTERNAL_FLASH_FILESYSTEM = 1 -LONGINT_IMPL = MPZ - -# The default queue depth of 16 overflows on release builds, -# so increase it to 32. -CFLAGS += -DCFG_TUD_TASK_QUEUE_SZ=32 - -CIRCUITPY_ESP_FLASH_MODE=dio -CIRCUITPY_ESP_FLASH_FREQ=40m -CIRCUITPY_ESP_FLASH_SIZE=4MB - -CIRCUITPY_MODULE=wroom +CIRCUITPY_ESP_FLASH_MODE = dio +CIRCUITPY_ESP_FLASH_FREQ = 40m +CIRCUITPY_ESP_FLASH_SIZE = 4MB +CIRCUITPY_ESP32_CAMERA = 0 diff --git a/ports/espressif/boards/franzininho_wifi_wrover/board.c b/ports/espressif/boards/franzininho_wifi_wrover/board.c index 0432485111..b3c8cb4191 100644 --- a/ports/espressif/boards/franzininho_wifi_wrover/board.c +++ b/ports/espressif/boards/franzininho_wifi_wrover/board.c @@ -36,13 +36,4 @@ void board_init(void) { #endif /* DEBUG */ } -bool board_requests_safe_mode(void) { - return false; -} - -void reset_board(void) { - -} - -void board_deinit(void) { -} +// Use the MP_WEAK supervisor/shared/board.c versions of routines not defined here. diff --git a/ports/espressif/boards/franzininho_wifi_wrover/mpconfigboard.mk b/ports/espressif/boards/franzininho_wifi_wrover/mpconfigboard.mk index 1478332fac..2a09bc99eb 100644 --- a/ports/espressif/boards/franzininho_wifi_wrover/mpconfigboard.mk +++ b/ports/espressif/boards/franzininho_wifi_wrover/mpconfigboard.mk @@ -5,15 +5,6 @@ USB_MANUFACTURER = "Espressif" IDF_TARGET = esp32s2 -INTERNAL_FLASH_FILESYSTEM = 1 -LONGINT_IMPL = MPZ - -# The default queue depth of 16 overflows on release builds, -# so increase it to 32. -CFLAGS += -DCFG_TUD_TASK_QUEUE_SZ=32 - -CIRCUITPY_ESP_FLASH_MODE=dio -CIRCUITPY_ESP_FLASH_FREQ=40m -CIRCUITPY_ESP_FLASH_SIZE=4MB - -CIRCUITPY_MODULE=wrover +CIRCUITPY_ESP_FLASH_MODE = dio +CIRCUITPY_ESP_FLASH_FREQ = 40m +CIRCUITPY_ESP_FLASH_SIZE = 4MB diff --git a/ports/espressif/boards/gravitech_cucumber_m/board.c b/ports/espressif/boards/gravitech_cucumber_m/board.c index 16a6af0742..b3c8cb4191 100644 --- a/ports/espressif/boards/gravitech_cucumber_m/board.c +++ b/ports/espressif/boards/gravitech_cucumber_m/board.c @@ -36,12 +36,4 @@ void board_init(void) { #endif /* DEBUG */ } -bool board_requests_safe_mode(void) { - return false; -} - -void reset_board(void) { -} - -void board_deinit(void) { -} +// Use the MP_WEAK supervisor/shared/board.c versions of routines not defined here. diff --git a/ports/espressif/boards/gravitech_cucumber_m/mpconfigboard.h b/ports/espressif/boards/gravitech_cucumber_m/mpconfigboard.h index a20ea362f2..fba644553f 100644 --- a/ports/espressif/boards/gravitech_cucumber_m/mpconfigboard.h +++ b/ports/espressif/boards/gravitech_cucumber_m/mpconfigboard.h @@ -31,5 +31,8 @@ #define MICROPY_HW_NEOPIXEL (&pin_GPIO18) +#define MICROPY_HW_LED_STATUS (&pin_GPIO2) +#define MICROPY_HW_LED_STATUS_INVERTED (1) + #define DEFAULT_UART_BUS_TX (&pin_GPIO43) #define DEFAULT_UART_BUS_RX (&pin_GPIO44) diff --git a/ports/espressif/boards/gravitech_cucumber_m/mpconfigboard.mk b/ports/espressif/boards/gravitech_cucumber_m/mpconfigboard.mk index ad9bce8cc0..a7d4d9fb7c 100644 --- a/ports/espressif/boards/gravitech_cucumber_m/mpconfigboard.mk +++ b/ports/espressif/boards/gravitech_cucumber_m/mpconfigboard.mk @@ -5,15 +5,7 @@ USB_MANUFACTURER = "Gravitech" IDF_TARGET = esp32s2 -INTERNAL_FLASH_FILESYSTEM = 1 -LONGINT_IMPL = MPZ - -# The default queue depth of 16 overflows on release builds, -# so increase it to 32. -CFLAGS += -DCFG_TUD_TASK_QUEUE_SZ=32 - -CIRCUITPY_ESP_FLASH_MODE=dio -CIRCUITPY_ESP_FLASH_FREQ=40m -CIRCUITPY_ESP_FLASH_SIZE=4MB - -CIRCUITPY_MODULE=wroom +CIRCUITPY_ESP_FLASH_MODE = dio +CIRCUITPY_ESP_FLASH_FREQ = 40m +CIRCUITPY_ESP_FLASH_SIZE = 4MB +CIRCUITPY_ESP32_CAMERA = 0 diff --git a/ports/espressif/boards/gravitech_cucumber_ms/board.c b/ports/espressif/boards/gravitech_cucumber_ms/board.c index 16a6af0742..b3c8cb4191 100644 --- a/ports/espressif/boards/gravitech_cucumber_ms/board.c +++ b/ports/espressif/boards/gravitech_cucumber_ms/board.c @@ -36,12 +36,4 @@ void board_init(void) { #endif /* DEBUG */ } -bool board_requests_safe_mode(void) { - return false; -} - -void reset_board(void) { -} - -void board_deinit(void) { -} +// Use the MP_WEAK supervisor/shared/board.c versions of routines not defined here. diff --git a/ports/espressif/boards/gravitech_cucumber_ms/mpconfigboard.h b/ports/espressif/boards/gravitech_cucumber_ms/mpconfigboard.h index 17719c6f40..1fa96a84a6 100644 --- a/ports/espressif/boards/gravitech_cucumber_ms/mpconfigboard.h +++ b/ports/espressif/boards/gravitech_cucumber_ms/mpconfigboard.h @@ -31,6 +31,9 @@ #define MICROPY_HW_NEOPIXEL (&pin_GPIO18) +#define MICROPY_HW_LED_STATUS (&pin_GPIO2) +#define MICROPY_HW_LED_STATUS_INVERTED (1) + #define DEFAULT_I2C_BUS_SCL (&pin_GPIO40) #define DEFAULT_I2C_BUS_SDA (&pin_GPIO41) diff --git a/ports/espressif/boards/gravitech_cucumber_ms/mpconfigboard.mk b/ports/espressif/boards/gravitech_cucumber_ms/mpconfigboard.mk index c96ac0dc09..bbcbfde29a 100644 --- a/ports/espressif/boards/gravitech_cucumber_ms/mpconfigboard.mk +++ b/ports/espressif/boards/gravitech_cucumber_ms/mpconfigboard.mk @@ -5,15 +5,7 @@ USB_MANUFACTURER = "Gravitech" IDF_TARGET = esp32s2 -INTERNAL_FLASH_FILESYSTEM = 1 -LONGINT_IMPL = MPZ - -# The default queue depth of 16 overflows on release builds, -# so increase it to 32. -CFLAGS += -DCFG_TUD_TASK_QUEUE_SZ=32 - -CIRCUITPY_ESP_FLASH_MODE=dio -CIRCUITPY_ESP_FLASH_FREQ=40m -CIRCUITPY_ESP_FLASH_SIZE=4MB - -CIRCUITPY_MODULE=wroom +CIRCUITPY_ESP_FLASH_MODE = dio +CIRCUITPY_ESP_FLASH_FREQ = 40m +CIRCUITPY_ESP_FLASH_SIZE = 4MB +CIRCUITPY_ESP32_CAMERA = 0 diff --git a/ports/espressif/boards/gravitech_cucumber_r/board.c b/ports/espressif/boards/gravitech_cucumber_r/board.c index 16a6af0742..b3c8cb4191 100644 --- a/ports/espressif/boards/gravitech_cucumber_r/board.c +++ b/ports/espressif/boards/gravitech_cucumber_r/board.c @@ -36,12 +36,4 @@ void board_init(void) { #endif /* DEBUG */ } -bool board_requests_safe_mode(void) { - return false; -} - -void reset_board(void) { -} - -void board_deinit(void) { -} +// Use the MP_WEAK supervisor/shared/board.c versions of routines not defined here. diff --git a/ports/espressif/boards/gravitech_cucumber_r/mpconfigboard.h b/ports/espressif/boards/gravitech_cucumber_r/mpconfigboard.h index 53409cf263..07d65735a6 100644 --- a/ports/espressif/boards/gravitech_cucumber_r/mpconfigboard.h +++ b/ports/espressif/boards/gravitech_cucumber_r/mpconfigboard.h @@ -31,5 +31,8 @@ #define MICROPY_HW_NEOPIXEL (&pin_GPIO18) +#define MICROPY_HW_LED_STATUS (&pin_GPIO2) +#define MICROPY_HW_LED_STATUS_INVERTED (1) + #define DEFAULT_UART_BUS_TX (&pin_GPIO43) #define DEFAULT_UART_BUS_RX (&pin_GPIO44) diff --git a/ports/espressif/boards/gravitech_cucumber_r/mpconfigboard.mk b/ports/espressif/boards/gravitech_cucumber_r/mpconfigboard.mk index 51f5fe468f..d3e40f2df6 100644 --- a/ports/espressif/boards/gravitech_cucumber_r/mpconfigboard.mk +++ b/ports/espressif/boards/gravitech_cucumber_r/mpconfigboard.mk @@ -5,15 +5,6 @@ USB_MANUFACTURER = "Gravitech" IDF_TARGET = esp32s2 -INTERNAL_FLASH_FILESYSTEM = 1 -LONGINT_IMPL = MPZ - -# The default queue depth of 16 overflows on release builds, -# so increase it to 32. -CFLAGS += -DCFG_TUD_TASK_QUEUE_SZ=32 - -CIRCUITPY_ESP_FLASH_MODE=dio -CIRCUITPY_ESP_FLASH_FREQ=40m -CIRCUITPY_ESP_FLASH_SIZE=4MB - -CIRCUITPY_MODULE=wrover +CIRCUITPY_ESP_FLASH_MODE = dio +CIRCUITPY_ESP_FLASH_FREQ = 40m +CIRCUITPY_ESP_FLASH_SIZE = 4MB diff --git a/ports/espressif/boards/gravitech_cucumber_rs/board.c b/ports/espressif/boards/gravitech_cucumber_rs/board.c index 16a6af0742..b3c8cb4191 100644 --- a/ports/espressif/boards/gravitech_cucumber_rs/board.c +++ b/ports/espressif/boards/gravitech_cucumber_rs/board.c @@ -36,12 +36,4 @@ void board_init(void) { #endif /* DEBUG */ } -bool board_requests_safe_mode(void) { - return false; -} - -void reset_board(void) { -} - -void board_deinit(void) { -} +// Use the MP_WEAK supervisor/shared/board.c versions of routines not defined here. diff --git a/ports/espressif/boards/gravitech_cucumber_rs/mpconfigboard.h b/ports/espressif/boards/gravitech_cucumber_rs/mpconfigboard.h index ee19f54ca5..1e91421574 100644 --- a/ports/espressif/boards/gravitech_cucumber_rs/mpconfigboard.h +++ b/ports/espressif/boards/gravitech_cucumber_rs/mpconfigboard.h @@ -31,6 +31,9 @@ #define MICROPY_HW_NEOPIXEL (&pin_GPIO18) +#define MICROPY_HW_LED_STATUS (&pin_GPIO2) +#define MICROPY_HW_LED_STATUS_INVERTED (1) + #define DEFAULT_I2C_BUS_SCL (&pin_GPIO40) #define DEFAULT_I2C_BUS_SDA (&pin_GPIO41) diff --git a/ports/espressif/boards/gravitech_cucumber_rs/mpconfigboard.mk b/ports/espressif/boards/gravitech_cucumber_rs/mpconfigboard.mk index 6cb8d13d8e..e0b3f35d44 100644 --- a/ports/espressif/boards/gravitech_cucumber_rs/mpconfigboard.mk +++ b/ports/espressif/boards/gravitech_cucumber_rs/mpconfigboard.mk @@ -5,15 +5,6 @@ USB_MANUFACTURER = "Gravitech" IDF_TARGET = esp32s2 -INTERNAL_FLASH_FILESYSTEM = 1 -LONGINT_IMPL = MPZ - -# The default queue depth of 16 overflows on release builds, -# so increase it to 32. -CFLAGS += -DCFG_TUD_TASK_QUEUE_SZ=32 - -CIRCUITPY_ESP_FLASH_MODE=dio -CIRCUITPY_ESP_FLASH_FREQ=40m -CIRCUITPY_ESP_FLASH_SIZE=4MB - -CIRCUITPY_MODULE=wrover +CIRCUITPY_ESP_FLASH_MODE = dio +CIRCUITPY_ESP_FLASH_FREQ = 40m +CIRCUITPY_ESP_FLASH_SIZE = 4MB diff --git a/ports/espressif/boards/hardkernel_odroid_go/board.c b/ports/espressif/boards/hardkernel_odroid_go/board.c new file mode 100644 index 0000000000..609572977e --- /dev/null +++ b/ports/espressif/boards/hardkernel_odroid_go/board.c @@ -0,0 +1,129 @@ +/* + * This file is part of the MicroPython project, http://micropython.org/ + * + * The MIT License (MIT) + * + * Copyright (c) 2020 Scott Shawcroft for Adafruit Industries + * + * Permission is hereby granted, free of charge, to any person obtaining a copy + * of this software and associated documentation files (the "Software"), to deal + * in the Software without restriction, including without limitation the rights + * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell + * copies of the Software, and to permit persons to whom the Software is + * furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice shall be included in + * all copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE + * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER + * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, + * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN + * THE SOFTWARE. + */ + +#include "supervisor/board.h" +#include "mpconfigboard.h" +#include "shared-bindings/busio/SPI.h" +#include "shared-bindings/displayio/FourWire.h" +#include "shared-module/displayio/__init__.h" +#include "shared-module/displayio/mipi_constants.h" + +#include "common-hal/microcontroller/Pin.h" + +#define DELAY 0x80 + +// ILI9341 init sequence from: +// https://github.com/hardkernel/ODROID-GO-MicroPython/blob/loboris/odroid_go/utils/lcd/lcd.py#L55 +uint8_t display_init_sequence[] = { + 0x0f, 3, 0x03, 0x80, 0x02, // RDDSDR + 0xcf, 3, 0x00, 0xcf, 0x30, // PWCRTLB + 0xed, 4, 0x64, 0x03, 0x12, 0x81, // PWRONCTRL + 0xe8, 3, 0x85, 0x00, 0x78, // DTCTRLA + 0xcb, 5, 0x39, 0x2c, 0x00, 0x34, 0x02, // PWCTRLA + 0xf7, 1, 0x20, // PRCTRL + 0xea, 2, 0x00, 0x00, // DTCTRLB + 0xc0, 1, 0x1b, // PWCTRL1 + 0xc1, 1, 0x12, // PWCTRL2 + 0xc5, 2, 0x3e, 0x3c, // VMCTRL1 + 0xc7, 1, 0x91, // VMCTRL2 + 0x36, 1, 0xa8, // MADCTL + 0x3a, 1, 0x55, // PIXSET + 0xb1, 2, 0x00, 0x1b, // FRMCTR1 + 0xb6, 3, 0x0a, 0xa2, 0x27, // DISCTRL + 0xf6, 2, 0x01, 0x30, // INTFACE + 0xf2, 1, 0x00, // ENA3G + 0x26, 1, 0x01, // GAMSET + 0xe0, 15, 0x0f, 0x31, 0x2b, 0x0c, 0x0e, 0x08, 0x4e, 0xf1, 0x37, 0x07, 0x10, 0x03, 0x0e, 0x09, 0x00, // PGAMCTRL + 0xe1, 15, 0x00, 0x0e, 0x14, 0x03, 0x11, 0x07, 0x31, 0xc1, 0x48, 0x08, 0x0f, 0x0c, 0x31, 0x36, 0x0f, // NGAMCTRL + 0x11, 0 | DELAY, 10, // SLPOUT + 0x29, 0 | DELAY, 100, // DISPON +}; + +void board_init(void) { + busio_spi_obj_t *spi = &displays[0].fourwire_bus.inline_bus; + common_hal_busio_spi_construct(spi, &pin_GPIO18, &pin_GPIO23, NULL, false); + common_hal_busio_spi_never_reset(spi); + + displayio_fourwire_obj_t *bus = &displays[0].fourwire_bus; + bus->base.type = &displayio_fourwire_type; + common_hal_displayio_fourwire_construct(bus, + spi, + &pin_GPIO21, // TFT_DC Command or data + &pin_GPIO5, // TFT_CS Chip select + NULL, // TFT_RST Reset + 40000000, // Baudrate + 0, // Polarity + 0); // Phase + + displayio_display_obj_t *display = &displays[0].display; + display->base.type = &displayio_display_type; + common_hal_displayio_display_construct(display, + bus, + 320, // Width (after rotation) + 240, // Height (after rotation) + 0, // column start + 0, // row start + 0, // rotation + 16, // Color depth + false, // grayscale + false, // pixels in byte share row. only used for depth < 8 + 1, // bytes per cell. Only valid for depths < 8 + false, // reverse_pixels_in_byte. Only valid for depths < 8 + true, // reverse_pixels_in_word + MIPI_COMMAND_SET_COLUMN_ADDRESS, // Set column command + MIPI_COMMAND_SET_PAGE_ADDRESS, // Set row command + MIPI_COMMAND_WRITE_MEMORY_START, // Write memory command + display_init_sequence, + sizeof(display_init_sequence), + &pin_GPIO14, // backlight pin + NO_BRIGHTNESS_COMMAND, + 1.0f, // brightness + false, // single_byte_bounds + false, // data_as_commands + true, // auto_refresh + 60, // native_frames_per_second + true, // backlight_on_high + false, // SH1107_addressing + 50000); // backlight pwm frequency +} + +bool espressif_board_reset_pin_number(gpio_num_t pin_number) { + // Pull LED down on reset rather than the default up + if (pin_number == 2) { + gpio_config_t cfg = { + .pin_bit_mask = BIT64(pin_number), + .mode = GPIO_MODE_DISABLE, + .pull_up_en = false, + .pull_down_en = true, + .intr_type = GPIO_INTR_DISABLE, + }; + gpio_config(&cfg); + return true; + } + return false; +} + +// Use the MP_WEAK supervisor/shared/board.c versions of routines not defined here. diff --git a/ports/espressif/boards/hardkernel_odroid_go/mpconfigboard.h b/ports/espressif/boards/hardkernel_odroid_go/mpconfigboard.h new file mode 100644 index 0000000000..423890f2e1 --- /dev/null +++ b/ports/espressif/boards/hardkernel_odroid_go/mpconfigboard.h @@ -0,0 +1,42 @@ +/* + * This file is part of the MicroPython project, http://micropython.org/ + * + * The MIT License (MIT) + * + * Copyright (c) 2022 Dan Halbert 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. + */ + +#define MICROPY_HW_BOARD_NAME "Hardkernel Odroid Go" +#define MICROPY_HW_MCU_NAME "ESP32" + +#define MICROPY_HW_LED_STATUS (&pin_GPIO2) + +#define CIRCUITPY_BOARD_SPI (1) +#define CIRCUITPY_BOARD_SPI_PIN {{.clock = &pin_GPIO18, .mosi = &pin_GPIO23, .miso = &pin_GPIO19}} + +#define CIRCUITPY_BOOT_BUTTON (&pin_GPIO0) + +// Explanation of how a user got into safe mode +#define BOARD_USER_SAFE_MODE_ACTION translate("pressing VOLUME button at start up.\n") + +// UART pins attached to the USB-serial converter chip +#define CIRCUITPY_CONSOLE_UART_TX (&pin_GPIO1) +#define CIRCUITPY_CONSOLE_UART_RX (&pin_GPIO3) diff --git a/ports/espressif/boards/hardkernel_odroid_go/mpconfigboard.mk b/ports/espressif/boards/hardkernel_odroid_go/mpconfigboard.mk new file mode 100644 index 0000000000..ead48189fa --- /dev/null +++ b/ports/espressif/boards/hardkernel_odroid_go/mpconfigboard.mk @@ -0,0 +1,8 @@ +CIRCUITPY_CREATOR_ID = 0x0D10D000 +CIRCUITPY_CREATION_ID = 0x00320060 + +IDF_TARGET = esp32 + +CIRCUITPY_ESP_FLASH_MODE = dio +CIRCUITPY_ESP_FLASH_FREQ = 40m +CIRCUITPY_ESP_FLASH_SIZE = 16MB diff --git a/ports/espressif/boards/hardkernel_odroid_go/pins.c b/ports/espressif/boards/hardkernel_odroid_go/pins.c new file mode 100644 index 0000000000..40f4fcdc34 --- /dev/null +++ b/ports/espressif/boards/hardkernel_odroid_go/pins.c @@ -0,0 +1,60 @@ +#include "py/objtuple.h" +#include "shared-bindings/board/__init__.h" +#include "shared-module/displayio/__init__.h" + +// Pin names from: https://wiki.odroid.com/odroid_go/odroid_go + +STATIC const mp_rom_map_elem_t board_module_globals_table[] = { + CIRCUITPYTHON_BOARD_DICT_STANDARD_ITEMS + + // Left side + { MP_ROM_QSTR(MP_QSTR_BATTERY), MP_ROM_PTR(&pin_GPIO36) }, + + { MP_ROM_QSTR(MP_QSTR_BTN_START), MP_ROM_PTR(&pin_GPIO39) }, + + { MP_ROM_QSTR(MP_QSTR_BTN_AXIS_X), MP_ROM_PTR(&pin_GPIO34) }, + + { MP_ROM_QSTR(MP_QSTR_BTN_AXIS_Y), MP_ROM_PTR(&pin_GPIO35) }, + + { MP_ROM_QSTR(MP_QSTR_BTN_A), MP_ROM_PTR(&pin_GPIO32) }, + + { MP_ROM_QSTR(MP_QSTR_BTN_B), MP_ROM_PTR(&pin_GPIO33) }, + + { MP_ROM_QSTR(MP_QSTR_SPEAKER_IN_M), MP_ROM_PTR(&pin_GPIO25) }, + + { MP_ROM_QSTR(MP_QSTR_SPEAKER_IN_P), MP_ROM_PTR(&pin_GPIO26) }, + + { MP_ROM_QSTR(MP_QSTR_BTN_SELECT), MP_ROM_PTR(&pin_GPIO27) }, + + { MP_ROM_QSTR(MP_QSTR_BACKLIGHT_PWM), MP_ROM_PTR(&pin_GPIO14) }, + + { MP_ROM_QSTR(MP_QSTR_EXT3), MP_ROM_PTR(&pin_GPIO12) }, + + { MP_ROM_QSTR(MP_QSTR_BTN_MENU), MP_ROM_PTR(&pin_GPIO13) }, + + // Right side. + { MP_ROM_QSTR(MP_QSTR_MOSI), MP_ROM_PTR(&pin_GPIO23) }, + { MP_ROM_QSTR(MP_QSTR_EXT8), MP_ROM_PTR(&pin_GPIO23) }, + + { MP_ROM_QSTR(MP_QSTR_SD_CS), MP_ROM_PTR(&pin_GPIO22) }, + + { MP_ROM_QSTR(MP_QSTR_MISO), MP_ROM_PTR(&pin_GPIO19) }, + { MP_ROM_QSTR(MP_QSTR_EXT7), MP_ROM_PTR(&pin_GPIO19) }, + + { MP_ROM_QSTR(MP_QSTR_SCK), MP_ROM_PTR(&pin_GPIO18) }, + { MP_ROM_QSTR(MP_QSTR_EXT2), MP_ROM_PTR(&pin_GPIO18) }, + + { MP_ROM_QSTR(MP_QSTR_LCD_CS), MP_ROM_PTR(&pin_GPIO5) }, + + { MP_ROM_QSTR(MP_QSTR_EXT5), MP_ROM_PTR(&pin_GPIO4) }, + + { MP_ROM_QSTR(MP_QSTR_BTN_VOLUME), MP_ROM_PTR(&pin_GPIO0) }, + + { MP_ROM_QSTR(MP_QSTR_LED), MP_ROM_PTR(&pin_GPIO2) }, + + { MP_ROM_QSTR(MP_QSTR_EXT4), MP_ROM_PTR(&pin_GPIO15) }, + + { MP_ROM_QSTR(MP_QSTR_SPI), MP_ROM_PTR(&board_spi_obj) }, + { MP_ROM_QSTR(MP_QSTR_DISPLAY), MP_ROM_PTR(&displays[0].display)}, +}; +MP_DEFINE_CONST_DICT(board_module_globals, board_module_globals_table); diff --git a/ports/espressif/boards/hardkernel_odroid_go/sdkconfig b/ports/espressif/boards/hardkernel_odroid_go/sdkconfig new file mode 100644 index 0000000000..f4fea0c732 --- /dev/null +++ b/ports/espressif/boards/hardkernel_odroid_go/sdkconfig @@ -0,0 +1,37 @@ +CONFIG_ESP32_SPIRAM_SUPPORT=y +# SPI RAM config +# +# CONFIG_SPIRAM_TYPE_AUTO is not set +# CONFIG_SPIRAM_TYPE_ESPPSRAM16 is not set +CONFIG_SPIRAM_TYPE_ESPPSRAM32=y +# CONFIG_SPIRAM_TYPE_ESPPSRAM64 is not set +CONFIG_SPIRAM_SIZE=4194304 +CONFIG_SPIRAM_SPEED_40M=y +CONFIG_SPIRAM=y +CONFIG_SPIRAM_BOOT_INIT=y +CONFIG_SPIRAM_IGNORE_NOTFOUND=y +CONFIG_SPIRAM_USE_MEMMAP=y +# CONFIG_SPIRAM_USE_CAPS_ALLOC is not set +# CONFIG_SPIRAM_USE_MALLOC is not set +CONFIG_SPIRAM_MEMTEST=y +# CONFIG_SPIRAM_ALLOW_BSS_SEG_EXTERNAL_MEMORY is not set +# CONFIG_SPIRAM_ALLOW_NOINIT_SEG_EXTERNAL_MEMORY is not set +CONFIG_SPIRAM_CACHE_WORKAROUND=y + +# Uncomment (remove ###) to send ESP_LOG output to TX/RX pins +### # +### # ESP System Settings +### # +### CONFIG_ESP_SYSTEM_PANIC_PRINT_HALT=y +### # CONFIG_ESP_SYSTEM_PANIC_SILENT_REBOOT is not set +### CONFIG_ESP_CONSOLE_UART_CUSTOM=y +### # CONFIG_ESP_CONSOLE_NONE is not set +### CONFIG_ESP_CONSOLE_UART=y +### nCONFIG_ESP_CONSOLE_UART_CUSTOM_NUM_0=y +### # CONFIG_ESP_CONSOLE_UART_CUSTOM_NUM_1 is not set +### CONFIG_ESP_CONSOLE_UART_NUM=0 +### CONFIG_ESP_CONSOLE_UART_TX_GPIO=12 +### CONFIG_ESP_CONSOLE_UART_RX_GPIO=15 +### CONFIG_ESP_CONSOLE_UART_BAUDRATE=115200 +### # CONFIG_ESP_SYSTEM_CHECK_INT_LEVEL_5 is not set +### # end of ESP System Settings diff --git a/ports/espressif/boards/hexky_s2/board.c b/ports/espressif/boards/hexky_s2/board.c index 88ac4fc661..e4f8f48855 100644 --- a/ports/espressif/boards/hexky_s2/board.c +++ b/ports/espressif/boards/hexky_s2/board.c @@ -88,9 +88,6 @@ void board_init(void) { displayio_display_obj_t *display = &displays[0].display; display->base.type = &displayio_display_type; - // workaround as board_init() is called before reset_port() in main.c - pwmout_reset(); - common_hal_displayio_display_construct( display, bus, @@ -112,21 +109,15 @@ void board_init(void) { sizeof(display_init_sequence), &pin_GPIO45, // backlight pin NO_BRIGHTNESS_COMMAND, - 1.0f, // brightness (ignored) - false, // auto_brightness + 1.0f, // brightness false, // single_byte_bounds false, // data_as_commands true, // auto_refresh 60, // native_frames_per_second true, // backlight_on_high - false // SH1107_addressing + false, // SH1107_addressing + 50000 // backlight pwm frequency ); - - common_hal_never_reset_pin(&pin_GPIO45); // backlight pin -} - -bool board_requests_safe_mode(void) { - return false; } bool espressif_board_reset_pin_number(gpio_num_t pin_number) { @@ -140,9 +131,6 @@ bool espressif_board_reset_pin_number(gpio_num_t pin_number) { return false; } -void reset_board(void) { -} +// Use the MP_WEAK supervisor/shared/board.c versions of routines not defined here. -void board_deinit(void) { - // TODO: Should we turn off the display when asleep? -} +// TODO: Should we turn off the display when asleep, in board_deinit()? diff --git a/ports/espressif/boards/hexky_s2/mpconfigboard.h b/ports/espressif/boards/hexky_s2/mpconfigboard.h index 31dd096beb..f49901332f 100644 --- a/ports/espressif/boards/hexky_s2/mpconfigboard.h +++ b/ports/espressif/boards/hexky_s2/mpconfigboard.h @@ -30,7 +30,7 @@ #define MICROPY_HW_MCU_NAME "ESP32S2" #define MICROPY_HW_NEOPIXEL (&pin_GPIO40) -#define CIRCUITPY_STATUS_LED_POWER (&pin_GPIO39) +#define MICROPY_HW_LED_STATUS (&pin_GPIO39) #define DEFAULT_I2C_BUS_SCL (&pin_GPIO9) #define DEFAULT_I2C_BUS_SDA (&pin_GPIO8) diff --git a/ports/espressif/boards/hexky_s2/mpconfigboard.mk b/ports/espressif/boards/hexky_s2/mpconfigboard.mk index 726bd3bb51..043dec5824 100644 --- a/ports/espressif/boards/hexky_s2/mpconfigboard.mk +++ b/ports/espressif/boards/hexky_s2/mpconfigboard.mk @@ -6,15 +6,8 @@ USB_MANUFACTURER = "FutureKeys" IDF_TARGET = esp32s2 -INTERNAL_FLASH_FILESYSTEM = 1 -LONGINT_IMPL = MPZ - -# The default queue depth of 16 overflows on release builds, -# so increase it to 32. -CFLAGS += -DCFG_TUD_TASK_QUEUE_SZ=32 - -CIRCUITPY_ESP_FLASH_MODE=qio -CIRCUITPY_ESP_FLASH_FREQ=40m -CIRCUITPY_ESP_FLASH_SIZE=4MB +CIRCUITPY_ESP_FLASH_MODE = qio +CIRCUITPY_ESP_FLASH_FREQ = 40m +CIRCUITPY_ESP_FLASH_SIZE = 4MB FROZEN_MPY_DIRS += $(TOP)/frozen/Adafruit_CircuitPython_NeoPixel diff --git a/ports/espressif/boards/hiibot_iots2/board.c b/ports/espressif/boards/hiibot_iots2/board.c index 23ba71ed7e..c9cf7afb92 100644 --- a/ports/espressif/boards/hiibot_iots2/board.c +++ b/ports/espressif/boards/hiibot_iots2/board.c @@ -93,9 +93,6 @@ static void display_init(void) { displayio_display_obj_t *display = &displays[0].display; display->base.type = &displayio_display_type; - // workaround as board_init() is called before reset_port() in main.c - pwmout_reset(); - common_hal_displayio_display_construct( display, bus, @@ -117,17 +114,15 @@ static void display_init(void) { sizeof(display_init_sequence), &pin_GPIO38, // backlight pin NO_BRIGHTNESS_COMMAND, - 1.0f, // brightness (ignored) - false, // auto_brightness + 1.0f, // brightness false, // single_byte_bounds false, // data_as_commands true, // auto_refresh 60, // native_frames_per_second true, // backlight_on_high - false // SH1107_addressing + false, // SH1107_addressing + 50000 // backlight pwm frequency ); - - common_hal_never_reset_pin(&pin_GPIO38); // backlight pin } void board_init(void) { @@ -154,12 +149,4 @@ void board_init(void) { display_init(); } -bool board_requests_safe_mode(void) { - return false; -} - -void reset_board(void) { -} - -void board_deinit(void) { -} +// Use the MP_WEAK supervisor/shared/board.c versions of routines not defined here. diff --git a/ports/espressif/boards/hiibot_iots2/mpconfigboard.h b/ports/espressif/boards/hiibot_iots2/mpconfigboard.h index 61696716ee..269bea8566 100644 --- a/ports/espressif/boards/hiibot_iots2/mpconfigboard.h +++ b/ports/espressif/boards/hiibot_iots2/mpconfigboard.h @@ -34,3 +34,12 @@ #define MICROPY_HW_BUTTON (&pin_GPIO21) #define CIRCUITPY_BOOT_BUTTON (&pin_GPIO21) + +#define CIRCUITPY_BOARD_I2C (1) +#define CIRCUITPY_BOARD_I2C_PIN {{.scl = &pin_GPIO1, .sda = &pin_GPIO2}} + +#define CIRCUITPY_BOARD_SPI (1) +#define CIRCUITPY_BOARD_SPI_PIN {{.clock = &pin_GPIO40, .mosi = &pin_GPIO42, .miso = &pin_GPIO41}} + +#define CIRCUITPY_BOARD_UART (1) +#define CIRCUITPY_BOARD_UART_PIN {{.tx = &pin_GPIO43, .rx = &pin_GPIO44}} diff --git a/ports/espressif/boards/hiibot_iots2/mpconfigboard.mk b/ports/espressif/boards/hiibot_iots2/mpconfigboard.mk index 58a7176119..a60d894665 100644 --- a/ports/espressif/boards/hiibot_iots2/mpconfigboard.mk +++ b/ports/espressif/boards/hiibot_iots2/mpconfigboard.mk @@ -5,14 +5,7 @@ USB_MANUFACTURER = "HiiBot" IDF_TARGET = esp32s2 -INTERNAL_FLASH_FILESYSTEM = 1 -LONGINT_IMPL = MPZ - -# The default queue depth of 16 overflows on release builds, -# so increase it to 32. -CFLAGS += -DCFG_TUD_TASK_QUEUE_SZ=32 - -CIRCUITPY_ESP_FLASH_MODE=qio -CIRCUITPY_ESP_FLASH_FREQ=40m -CIRCUITPY_ESP_FLASH_SIZE=8MB -#CIRCUITPY_ESP_FLASH_SIZE=4MB +CIRCUITPY_ESP_FLASH_MODE = qio +CIRCUITPY_ESP_FLASH_FREQ = 40m +CIRCUITPY_ESP_FLASH_SIZE = 8MB +#CIRCUITPY_ESP_FLASH_SIZE = 4MB diff --git a/ports/espressif/boards/hiibot_iots2/pins.c b/ports/espressif/boards/hiibot_iots2/pins.c index 55e81ef3c5..a2277364f2 100644 --- a/ports/espressif/boards/hiibot_iots2/pins.c +++ b/ports/espressif/boards/hiibot_iots2/pins.c @@ -71,6 +71,7 @@ STATIC const mp_rom_map_elem_t board_global_dict_table[] = { { MP_ROM_QSTR(MP_QSTR_RX), MP_ROM_PTR(&pin_GPIO44) }, { MP_ROM_QSTR(MP_QSTR_I2C), MP_ROM_PTR(&board_i2c_obj) }, + { MP_ROM_QSTR(MP_QSTR_STEMMA_I2C), MP_ROM_PTR(&board_i2c_obj) }, { 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/espressif/boards/lilygo_ttgo_t-01c3/board.c b/ports/espressif/boards/lilygo_ttgo_t-01c3/board.c index deeb8041ea..67b05e5cd2 100644 --- a/ports/espressif/boards/lilygo_ttgo_t-01c3/board.c +++ b/ports/espressif/boards/lilygo_ttgo_t-01c3/board.c @@ -11,28 +11,4 @@ void board_init(void) { #endif } -bool board_requests_safe_mode(void) { - return false; -} - -bool espressif_board_reset_pin_number(gpio_num_t pin_number) { - // Pull LED down on reset rather than the default up - if (pin_number == MICROPY_HW_LED_STATUS->number) { - gpio_config_t cfg = { - .pin_bit_mask = BIT64(pin_number), - .mode = GPIO_MODE_DISABLE, - .pull_up_en = false, - .pull_down_en = true, - .intr_type = GPIO_INTR_DISABLE, - }; - gpio_config(&cfg); - return true; - } - return false; -} - -void reset_board(void) { -} - -void board_deinit(void) { -} +// Use the MP_WEAK supervisor/shared/board.c versions of routines not defined here. diff --git a/ports/espressif/boards/lilygo_ttgo_t-01c3/mpconfigboard.h b/ports/espressif/boards/lilygo_ttgo_t-01c3/mpconfigboard.h index e0eebc9754..bbb8cff195 100644 --- a/ports/espressif/boards/lilygo_ttgo_t-01c3/mpconfigboard.h +++ b/ports/espressif/boards/lilygo_ttgo_t-01c3/mpconfigboard.h @@ -6,5 +6,5 @@ #define DEFAULT_UART_BUS_RX (&pin_GPIO20) #define DEFAULT_UART_BUS_TX (&pin_GPIO21) -#define CIRCUITPY_DEBUG_UART_RX DEFAULT_UART_BUS_RX -#define CIRCUITPY_DEBUG_UART_TX DEFAULT_UART_BUS_TX +#define CIRCUITPY_CONSOLE_UART_RX DEFAULT_UART_BUS_RX +#define CIRCUITPY_CONSOLE_UART_TX DEFAULT_UART_BUS_TX diff --git a/ports/espressif/boards/lilygo_ttgo_t-01c3/mpconfigboard.mk b/ports/espressif/boards/lilygo_ttgo_t-01c3/mpconfigboard.mk index d40c9b6722..2ca19f332c 100644 --- a/ports/espressif/boards/lilygo_ttgo_t-01c3/mpconfigboard.mk +++ b/ports/espressif/boards/lilygo_ttgo_t-01c3/mpconfigboard.mk @@ -3,8 +3,6 @@ CIRCUITPY_CREATION_ID = 0x00C30001 IDF_TARGET = esp32c3 -INTERNAL_FLASH_FILESYSTEM = 1 - CIRCUITPY_ESP_FLASH_MODE = dio CIRCUITPY_ESP_FLASH_FREQ = 80m CIRCUITPY_ESP_FLASH_SIZE = 4MB diff --git a/ports/espressif/boards/lilygo_ttgo_t-oi-plus/board.c b/ports/espressif/boards/lilygo_ttgo_t-oi-plus/board.c index aa0cf7657a..7bcdcdba25 100644 --- a/ports/espressif/boards/lilygo_ttgo_t-oi-plus/board.c +++ b/ports/espressif/boards/lilygo_ttgo_t-oi-plus/board.c @@ -1,17 +1,40 @@ +/* + * This file is part of the MicroPython project, http://micropython.org/ + * + * The MIT License (MIT) + * + * Copyright (c) 2020 Scott Shawcroft for Adafruit Industries + * + * Permission is hereby granted, free of charge, to any person obtaining a copy + * of this software and associated documentation files (the "Software"), to deal + * in the Software without restriction, including without limitation the rights + * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell + * copies of the Software, and to permit persons to whom the Software is + * furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice shall be included in + * all copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE + * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER + * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, + * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN + * THE SOFTWARE. + */ + #include "shared-bindings/microcontroller/Pin.h" #include "supervisor/board.h" #include "components/driver/include/driver/gpio.h" void board_init(void) { + // Debug UART + #ifdef DEBUG + common_hal_never_reset_pin(&pin_GPIO20); + common_hal_never_reset_pin(&pin_GPIO21); + #endif } -bool board_requests_safe_mode(void) { - return false; -} - -void reset_board(void) { -} - -void board_deinit(void) { -} +// Use the MP_WEAK supervisor/shared/board.c versions of routines not defined here. diff --git a/ports/espressif/boards/lilygo_ttgo_t-oi-plus/mpconfigboard.h b/ports/espressif/boards/lilygo_ttgo_t-oi-plus/mpconfigboard.h index 71987994e7..26a30e07dd 100644 --- a/ports/espressif/boards/lilygo_ttgo_t-oi-plus/mpconfigboard.h +++ b/ports/espressif/boards/lilygo_ttgo_t-oi-plus/mpconfigboard.h @@ -1,13 +1,10 @@ -// Define board #define MICROPY_HW_BOARD_NAME "LILYGO TTGO T-OI PLUS" #define MICROPY_HW_MCU_NAME "ESP32-C3" #define MICROPY_HW_LED_STATUS (&pin_GPIO3) -// I2C -#define CIRCUITPY_BOARD_I2C (1) -#define CIRCUITPY_BOARD_I2C_PIN {{.scl = &pin_GPIO18, .sda = &pin_GPIO19}} +#define DEFAULT_UART_BUS_RX (&pin_GPIO20) +#define DEFAULT_UART_BUS_TX (&pin_GPIO21) -// UART -#define CIRCUITPY_BOARD_UART (1) -#define CIRCUITPY_BOARD_UART_PIN {{.tx = &pin_GPIO21, .rx = &pin_GPIO20}} +#define CIRCUITPY_CONSOLE_UART_RX DEFAULT_UART_BUS_RX +#define CIRCUITPY_CONSOLE_UART_TX DEFAULT_UART_BUS_TX diff --git a/ports/espressif/boards/lilygo_ttgo_t-oi-plus/mpconfigboard.mk b/ports/espressif/boards/lilygo_ttgo_t-oi-plus/mpconfigboard.mk index 2f66e69415..7a80145217 100644 --- a/ports/espressif/boards/lilygo_ttgo_t-oi-plus/mpconfigboard.mk +++ b/ports/espressif/boards/lilygo_ttgo_t-oi-plus/mpconfigboard.mk @@ -3,8 +3,6 @@ CIRCUITPY_CREATION_ID = 0x00C30002 IDF_TARGET = esp32c3 -INTERNAL_FLASH_FILESYSTEM = 1 - CIRCUITPY_ESP_FLASH_MODE = dio CIRCUITPY_ESP_FLASH_FREQ = 80m CIRCUITPY_ESP_FLASH_SIZE = 4MB diff --git a/ports/espressif/boards/lilygo_ttgo_t-oi-plus/pins.c b/ports/espressif/boards/lilygo_ttgo_t-oi-plus/pins.c index 963115bf1c..c906b7a555 100644 --- a/ports/espressif/boards/lilygo_ttgo_t-oi-plus/pins.c +++ b/ports/espressif/boards/lilygo_ttgo_t-oi-plus/pins.c @@ -2,28 +2,26 @@ STATIC const mp_rom_map_elem_t board_module_globals_table[] = { CIRCUITPYTHON_BOARD_DICT_STANDARD_ITEMS + { MP_ROM_QSTR(MP_QSTR_IO2), MP_ROM_PTR(&pin_GPIO2) }, { MP_ROM_QSTR(MP_QSTR_BATTERY), MP_ROM_PTR(&pin_GPIO2) }, { MP_ROM_QSTR(MP_QSTR_VOLTAGE_MONITOR), MP_ROM_PTR(&pin_GPIO2) }, - { MP_ROM_QSTR(MP_QSTR_IO2), MP_ROM_PTR(&pin_GPIO2) }, { MP_ROM_QSTR(MP_QSTR_IO8), MP_ROM_PTR(&pin_GPIO8) }, { MP_ROM_QSTR(MP_QSTR_IO9), MP_ROM_PTR(&pin_GPIO9) }, - { MP_ROM_QSTR(MP_QSTR_RX), MP_ROM_PTR(&pin_GPIO20) }, - { MP_ROM_QSTR(MP_QSTR_IO20), MP_ROM_PTR(&pin_GPIO20) }, - { MP_ROM_QSTR(MP_QSTR_TX), MP_ROM_PTR(&pin_GPIO21) }, - { MP_ROM_QSTR(MP_QSTR_IO21), MP_ROM_PTR(&pin_GPIO21) }, - { MP_ROM_QSTR(MP_QSTR_LED), MP_ROM_PTR(&pin_GPIO3) }, - { MP_ROM_QSTR(MP_QSTR_IO3), MP_ROM_PTR(&pin_GPIO3) }, - { MP_ROM_QSTR(MP_QSTR_SDA), MP_ROM_PTR(&pin_GPIO19) }, - { MP_ROM_QSTR(MP_QSTR_IO19), MP_ROM_PTR(&pin_GPIO19) }, - { MP_ROM_QSTR(MP_QSTR_SCL), MP_ROM_PTR(&pin_GPIO18) }, - { MP_ROM_QSTR(MP_QSTR_IO18), MP_ROM_PTR(&pin_GPIO18) }, { MP_ROM_QSTR(MP_QSTR_IO4), MP_ROM_PTR(&pin_GPIO4) }, { MP_ROM_QSTR(MP_QSTR_IO5), MP_ROM_PTR(&pin_GPIO5) }, { MP_ROM_QSTR(MP_QSTR_IO6), MP_ROM_PTR(&pin_GPIO6) }, { MP_ROM_QSTR(MP_QSTR_IO7), MP_ROM_PTR(&pin_GPIO7) }, { MP_ROM_QSTR(MP_QSTR_IO10), MP_ROM_PTR(&pin_GPIO10) }, + { MP_ROM_QSTR(MP_QSTR_RX), MP_ROM_PTR(&pin_GPIO20) }, + { MP_ROM_QSTR(MP_QSTR_IO20), MP_ROM_PTR(&pin_GPIO20) }, + { MP_ROM_QSTR(MP_QSTR_TX), MP_ROM_PTR(&pin_GPIO21) }, + { MP_ROM_QSTR(MP_QSTR_IO21), MP_ROM_PTR(&pin_GPIO21) }, + { MP_ROM_QSTR(MP_QSTR_SDA), MP_ROM_PTR(&pin_GPIO19) }, + { MP_ROM_QSTR(MP_QSTR_IO19), MP_ROM_PTR(&pin_GPIO19) }, + { MP_ROM_QSTR(MP_QSTR_SCL), MP_ROM_PTR(&pin_GPIO18) }, + { MP_ROM_QSTR(MP_QSTR_IO18), MP_ROM_PTR(&pin_GPIO18) }, + { MP_ROM_QSTR(MP_QSTR_LED), MP_ROM_PTR(&pin_GPIO3) }, + { MP_ROM_QSTR(MP_QSTR_IO3), MP_ROM_PTR(&pin_GPIO3) }, { MP_ROM_QSTR(MP_QSTR_UART), MP_ROM_PTR(&board_uart_obj) }, - { MP_ROM_QSTR(MP_QSTR_I2C), MP_ROM_PTR(&board_i2c_obj) }, - { MP_ROM_QSTR(MP_QSTR_STEMMA_I2C), MP_ROM_PTR(&board_i2c_obj) }, }; MP_DEFINE_CONST_DICT(board_module_globals, board_module_globals_table); diff --git a/ports/espressif/boards/lilygo_ttgo_t8_esp32_s2_wroom/board.c b/ports/espressif/boards/lilygo_ttgo_t8_esp32_s2_wroom/board.c index d522720629..6597b51c5f 100644 --- a/ports/espressif/boards/lilygo_ttgo_t8_esp32_s2_wroom/board.c +++ b/ports/espressif/boards/lilygo_ttgo_t8_esp32_s2_wroom/board.c @@ -36,12 +36,4 @@ void board_init(void) { #endif /* DEBUG */ } -bool board_requests_safe_mode(void) { - return false; -} - -void reset_board(void) { -} - -void board_deinit(void) { -} +// Use the MP_WEAK supervisor/shared/board.c versions of routines not defined here. diff --git a/ports/espressif/boards/lilygo_ttgo_t8_esp32_s2_wroom/mpconfigboard.mk b/ports/espressif/boards/lilygo_ttgo_t8_esp32_s2_wroom/mpconfigboard.mk index 528938f7ac..b5cc1bae7c 100644 --- a/ports/espressif/boards/lilygo_ttgo_t8_esp32_s2_wroom/mpconfigboard.mk +++ b/ports/espressif/boards/lilygo_ttgo_t8_esp32_s2_wroom/mpconfigboard.mk @@ -5,15 +5,7 @@ USB_MANUFACTURER = "LILYGO" IDF_TARGET = esp32s2 -INTERNAL_FLASH_FILESYSTEM = 1 -LONGINT_IMPL = MPZ - -# The default queue depth of 16 overflows on release builds, -# so increase it to 32. -CFLAGS += -DCFG_TUD_TASK_QUEUE_SZ=32 - -CIRCUITPY_ESP_FLASH_MODE=dio -CIRCUITPY_ESP_FLASH_FREQ=40m -CIRCUITPY_ESP_FLASH_SIZE=4MB - -CIRCUITPY_MODULE=wroom +CIRCUITPY_ESP_FLASH_MODE = dio +CIRCUITPY_ESP_FLASH_FREQ = 40m +CIRCUITPY_ESP_FLASH_SIZE = 4MB +CIRCUITPY_ESP32_CAMERA = 0 diff --git a/ports/espressif/boards/lilygo_ttgo_t8_s2/board.c b/ports/espressif/boards/lilygo_ttgo_t8_s2/board.c index d522720629..6597b51c5f 100644 --- a/ports/espressif/boards/lilygo_ttgo_t8_s2/board.c +++ b/ports/espressif/boards/lilygo_ttgo_t8_s2/board.c @@ -36,12 +36,4 @@ void board_init(void) { #endif /* DEBUG */ } -bool board_requests_safe_mode(void) { - return false; -} - -void reset_board(void) { -} - -void board_deinit(void) { -} +// Use the MP_WEAK supervisor/shared/board.c versions of routines not defined here. diff --git a/ports/espressif/boards/lilygo_ttgo_t8_s2/mpconfigboard.mk b/ports/espressif/boards/lilygo_ttgo_t8_s2/mpconfigboard.mk index f0c9eb5c0b..e7d70c671a 100644 --- a/ports/espressif/boards/lilygo_ttgo_t8_s2/mpconfigboard.mk +++ b/ports/espressif/boards/lilygo_ttgo_t8_s2/mpconfigboard.mk @@ -5,15 +5,6 @@ USB_MANUFACTURER = "LILYGO" IDF_TARGET = esp32s2 -INTERNAL_FLASH_FILESYSTEM = 1 -LONGINT_IMPL = MPZ - -# The default queue depth of 16 overflows on release builds, -# so increase it to 32. -CFLAGS += -DCFG_TUD_TASK_QUEUE_SZ=32 - CIRCUITPY_ESP_FLASH_MODE = dio CIRCUITPY_ESP_FLASH_FREQ = 40m CIRCUITPY_ESP_FLASH_SIZE = 4MB - -CIRCUITPY_MODULE = wroom diff --git a/ports/espressif/boards/lilygo_ttgo_t8_s2_st7789/board.c b/ports/espressif/boards/lilygo_ttgo_t8_s2_st7789/board.c index 492c3f8f4d..6c0a54c99c 100644 --- a/ports/espressif/boards/lilygo_ttgo_t8_s2_st7789/board.c +++ b/ports/espressif/boards/lilygo_ttgo_t8_s2_st7789/board.c @@ -93,9 +93,6 @@ static void display_init(void) { displayio_display_obj_t *display = &displays[0].display; display->base.type = &displayio_display_type; - // workaround as board_init() is called before reset_port() in main.c - pwmout_reset(); - common_hal_displayio_display_construct( display, bus, @@ -117,17 +114,15 @@ static void display_init(void) { sizeof(display_init_sequence), &pin_GPIO33, // backlight pin NO_BRIGHTNESS_COMMAND, - 1.0f, // brightness (ignored) - false, // auto_brightness + 1.0f, // brightness false, // single_byte_bounds false, // data_as_commands true, // auto_refresh 60, // native_frames_per_second true, // backlight_on_high - false // SH1107_addressing + false, // SH1107_addressing + 50000 // backlight pwm frequency ); - - common_hal_never_reset_pin(&pin_GPIO33); // backlight pin } void board_init(void) { @@ -141,13 +136,4 @@ void board_init(void) { display_init(); } -bool board_requests_safe_mode(void) { - return false; -} - -void reset_board(void) { - -} - -void board_deinit(void) { -} +// Use the MP_WEAK supervisor/shared/board.c versions of routines not defined here. diff --git a/ports/espressif/boards/lilygo_ttgo_t8_s2_st7789/mpconfigboard.mk b/ports/espressif/boards/lilygo_ttgo_t8_s2_st7789/mpconfigboard.mk index c7795bbdeb..865dbe2661 100644 --- a/ports/espressif/boards/lilygo_ttgo_t8_s2_st7789/mpconfigboard.mk +++ b/ports/espressif/boards/lilygo_ttgo_t8_s2_st7789/mpconfigboard.mk @@ -5,15 +5,6 @@ USB_MANUFACTURER = "LILYGO" IDF_TARGET = esp32s2 -INTERNAL_FLASH_FILESYSTEM = 1 -LONGINT_IMPL = MPZ - -# The default queue depth of 16 overflows on release builds, -# so increase it to 32. -CFLAGS += -DCFG_TUD_TASK_QUEUE_SZ=32 - CIRCUITPY_ESP_FLASH_MODE = dio CIRCUITPY_ESP_FLASH_FREQ = 40m CIRCUITPY_ESP_FLASH_SIZE = 4MB - -CIRCUITPY_MODULE = wroom diff --git a/ports/espressif/boards/lolin_c3_mini/board.c b/ports/espressif/boards/lolin_c3_mini/board.c new file mode 100644 index 0000000000..164430c88c --- /dev/null +++ b/ports/espressif/boards/lolin_c3_mini/board.c @@ -0,0 +1,29 @@ +/* + * This file is part of the MicroPython project, http://micropython.org/ + * + * The MIT License (MIT) + * + * Copyright (c) 2020 Scott Shawcroft for Adafruit Industries + * + * Permission is hereby granted, free of charge, to any person obtaining a copy + * of this software and associated documentation files (the "Software"), to deal + * in the Software without restriction, including without limitation the rights + * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell + * copies of the Software, and to permit persons to whom the Software is + * furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice shall be included in + * all copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE + * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER + * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, + * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN + * THE SOFTWARE. + */ + +#include "supervisor/board.h" + +// Use the MP_WEAK supervisor/shared/board.c versions of routines not defined here. diff --git a/ports/espressif/boards/lolin_c3_mini/mpconfigboard.h b/ports/espressif/boards/lolin_c3_mini/mpconfigboard.h new file mode 100644 index 0000000000..03e4d5d436 --- /dev/null +++ b/ports/espressif/boards/lolin_c3_mini/mpconfigboard.h @@ -0,0 +1,51 @@ +/* + * This file is part of the MicroPython project, http://micropython.org/ + * + * The MIT License (MIT) + * + * Copyright (c) 2019 Scott Shawcroft for Adafruit Industries + * + * Permission is hereby granted, free of charge, to any person obtaining a copy + * of this software and associated documentation files (the "Software"), to deal + * in the Software without restriction, including without limitation the rights + * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell + * copies of the Software, and to permit persons to whom the Software is + * furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice shall be included in + * all copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE + * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER + * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, + * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN + * THE SOFTWARE. + */ + +// Board setup + +#define MICROPY_HW_BOARD_NAME "Wemos Lolin C3 Mini" // from Wemos MP +#define MICROPY_HW_MCU_NAME "ESP32-C3FH4" // from Wemos MP + +// From Wemos C3 Mini Schematic +// https://www.wemos.cc/en/latest/_static/files/sch_c3_mini_v1.0.0.pdf +// And MP Config +// https://github.com/micropython/micropython/blob/master/ports/esp32/boards/LOLIN_C3_MINI +// Status LED +#define MICROPY_HW_NEOPIXEL (&pin_GPIO7) + +#define CIRCUITPY_BOARD_I2C (1) +#define CIRCUITPY_BOARD_I2C_PIN {{.scl = &pin_GPIO6, .sda = &pin_GPIO5}} + +#define CIRCUITPY_BOARD_SPI (1) +#define CIRCUITPY_BOARD_SPI_PIN {{.clock = &pin_GPIO10, .mosi = &pin_GPIO7, .miso = &pin_GPIO8}} + +#define CIRCUITPY_BOARD_UART (1) +#define CIRCUITPY_BOARD_UART_PIN {{.tx = &pin_GPIO21, .rx = &pin_GPIO20}} + +// Explanation of how a user got into safe mode +#define BOARD_USER_SAFE_MODE_ACTION translate("pressing boot button at start up.\n") + +#define CIRCUITPY_ESP_USB_SERIAL_JTAG (1) diff --git a/ports/espressif/boards/lolin_c3_mini/mpconfigboard.mk b/ports/espressif/boards/lolin_c3_mini/mpconfigboard.mk new file mode 100644 index 0000000000..d1cd0129fd --- /dev/null +++ b/ports/espressif/boards/lolin_c3_mini/mpconfigboard.mk @@ -0,0 +1,8 @@ +CIRCUITPY_CREATOR_ID = 0x19881988 +CIRCUITPY_CREATION_ID = 0x00C30001 + +IDF_TARGET = esp32c3 + +CIRCUITPY_ESP_FLASH_MODE=qio +CIRCUITPY_ESP_FLASH_FREQ=80m +CIRCUITPY_ESP_FLASH_SIZE=4MB diff --git a/ports/espressif/boards/lolin_c3_mini/pins.c b/ports/espressif/boards/lolin_c3_mini/pins.c new file mode 100644 index 0000000000..ccc70f6043 --- /dev/null +++ b/ports/espressif/boards/lolin_c3_mini/pins.c @@ -0,0 +1,74 @@ +#include "shared-bindings/board/__init__.h" + +STATIC const mp_rom_map_elem_t board_module_globals_table[] = { + CIRCUITPYTHON_BOARD_DICT_STANDARD_ITEMS + + // C3 Mini Board + // Wemos Lolin C3 Mini Schematic + // https://www.wemos.cc/en/latest/_static/files/sch_c3_mini_v1.0.0.pdf + // Starting on Left side going counterclockwise + // MP Config + // https://github.com/micropython/micropython/blob/master/ports/esp32/boards/LOLIN_C3_MINI + // C3 Data Sheet + // https://www.espressif.com/sites/default/files/documentation/esp32-c3_datasheet_en.pdf + + { MP_ROM_QSTR(MP_QSTR_IO0), MP_ROM_PTR(&pin_GPIO0) }, + { MP_ROM_QSTR(MP_QSTR_A0), MP_ROM_PTR(&pin_GPIO0) }, + { MP_ROM_QSTR(MP_QSTR_D0), MP_ROM_PTR(&pin_GPIO0) }, + + { MP_ROM_QSTR(MP_QSTR_IO1), MP_ROM_PTR(&pin_GPIO1) }, + { MP_ROM_QSTR(MP_QSTR_A1), MP_ROM_PTR(&pin_GPIO1) }, + { MP_ROM_QSTR(MP_QSTR_D1), MP_ROM_PTR(&pin_GPIO1) }, + + { MP_ROM_QSTR(MP_QSTR_IO2), MP_ROM_PTR(&pin_GPIO2) }, + { MP_ROM_QSTR(MP_QSTR_A2), MP_ROM_PTR(&pin_GPIO2) }, + { MP_ROM_QSTR(MP_QSTR_D2), MP_ROM_PTR(&pin_GPIO2) }, + + { MP_ROM_QSTR(MP_QSTR_IO3), MP_ROM_PTR(&pin_GPIO3) }, + { MP_ROM_QSTR(MP_QSTR_A3), MP_ROM_PTR(&pin_GPIO3) }, + { MP_ROM_QSTR(MP_QSTR_D3), MP_ROM_PTR(&pin_GPIO3) }, + { MP_ROM_QSTR(MP_QSTR_MISO), MP_ROM_PTR(&pin_GPIO3) }, + + { MP_ROM_QSTR(MP_QSTR_IO4), MP_ROM_PTR(&pin_GPIO4) }, + { MP_ROM_QSTR(MP_QSTR_A4), MP_ROM_PTR(&pin_GPIO4) }, + { MP_ROM_QSTR(MP_QSTR_D4), MP_ROM_PTR(&pin_GPIO4) }, + { MP_ROM_QSTR(MP_QSTR_MOSI), MP_ROM_PTR(&pin_GPIO4) }, + + { MP_ROM_QSTR(MP_QSTR_IO5), MP_ROM_PTR(&pin_GPIO5) }, + { MP_ROM_QSTR(MP_QSTR_A5), MP_ROM_PTR(&pin_GPIO5) }, + { MP_ROM_QSTR(MP_QSTR_D5), MP_ROM_PTR(&pin_GPIO5) }, + { MP_ROM_QSTR(MP_QSTR_SDA), MP_ROM_PTR(&pin_GPIO5) }, + + { MP_ROM_QSTR(MP_QSTR_IO6), MP_ROM_PTR(&pin_GPIO6) }, + { MP_ROM_QSTR(MP_QSTR_D6), MP_ROM_PTR(&pin_GPIO6) }, + { MP_ROM_QSTR(MP_QSTR_SCL), MP_ROM_PTR(&pin_GPIO6) }, + + { MP_ROM_QSTR(MP_QSTR_IO7), MP_ROM_PTR(&pin_GPIO7) }, + { MP_ROM_QSTR(MP_QSTR_D7), MP_ROM_PTR(&pin_GPIO7) }, + { MP_ROM_QSTR(MP_QSTR_LED), MP_ROM_PTR(&pin_GPIO7) }, + + { MP_ROM_QSTR(MP_QSTR_IO8), MP_ROM_PTR(&pin_GPIO8) }, + { MP_ROM_QSTR(MP_QSTR_D8), MP_ROM_PTR(&pin_GPIO8) }, + + { MP_ROM_QSTR(MP_QSTR_IO9), MP_ROM_PTR(&pin_GPIO9) }, + { MP_ROM_QSTR(MP_QSTR_BOOT0), MP_ROM_PTR(&pin_GPIO9) }, + { MP_ROM_QSTR(MP_QSTR_BUTTON), MP_ROM_PTR(&pin_GPIO9) }, + + + { MP_ROM_QSTR(MP_QSTR_IO10), MP_ROM_PTR(&pin_GPIO10) }, + { MP_ROM_QSTR(MP_QSTR_D10), MP_ROM_PTR(&pin_GPIO10) }, + { MP_ROM_QSTR(MP_QSTR_SCK), MP_ROM_PTR(&pin_GPIO10) }, + + { MP_ROM_QSTR(MP_QSTR_IO20), MP_ROM_PTR(&pin_GPIO20) }, + { MP_ROM_QSTR(MP_QSTR_A7), MP_ROM_PTR(&pin_GPIO20) }, + { MP_ROM_QSTR(MP_QSTR_RX), MP_ROM_PTR(&pin_GPIO20) }, + + { MP_ROM_QSTR(MP_QSTR_IO21), MP_ROM_PTR(&pin_GPIO21) }, + { MP_ROM_QSTR(MP_QSTR_A6), MP_ROM_PTR(&pin_GPIO21) }, + { MP_ROM_QSTR(MP_QSTR_TX), MP_ROM_PTR(&pin_GPIO21) }, + + { 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) }, +}; +MP_DEFINE_CONST_DICT(board_module_globals, board_module_globals_table); diff --git a/ports/espressif/boards/lolin_c3_mini/sdkconfig b/ports/espressif/boards/lolin_c3_mini/sdkconfig new file mode 100644 index 0000000000..c548ee3c69 --- /dev/null +++ b/ports/espressif/boards/lolin_c3_mini/sdkconfig @@ -0,0 +1,13 @@ +# +# PHY +# +CONFIG_ESP_PHY_ENABLE_USB=y +# end of PHY + +# +# LWIP +# +CONFIG_LWIP_LOCAL_HOSTNAME="lolin-c3-mini" +# end of LWIP + + diff --git a/ports/espressif/boards/lolin_s2_mini/board.c b/ports/espressif/boards/lolin_s2_mini/board.c index 0432485111..b3c8cb4191 100644 --- a/ports/espressif/boards/lolin_s2_mini/board.c +++ b/ports/espressif/boards/lolin_s2_mini/board.c @@ -36,13 +36,4 @@ void board_init(void) { #endif /* DEBUG */ } -bool board_requests_safe_mode(void) { - return false; -} - -void reset_board(void) { - -} - -void board_deinit(void) { -} +// Use the MP_WEAK supervisor/shared/board.c versions of routines not defined here. diff --git a/ports/espressif/boards/lolin_s2_mini/mpconfigboard.h b/ports/espressif/boards/lolin_s2_mini/mpconfigboard.h index c490cd8ceb..e943e70184 100644 --- a/ports/espressif/boards/lolin_s2_mini/mpconfigboard.h +++ b/ports/espressif/boards/lolin_s2_mini/mpconfigboard.h @@ -29,6 +29,8 @@ #define MICROPY_HW_BOARD_NAME "S2Mini" #define MICROPY_HW_MCU_NAME "ESP32S2-S2FN4R2" // from Wemos MP +#define MICROPY_HW_LED_STATUS (&pin_GPIO15) + #define DEFAULT_I2C_BUS_SCL (&pin_GPIO35) // no I2C labels on S2 Mini, def from Wemos MP #define DEFAULT_I2C_BUS_SDA (&pin_GPIO33) // no I2C labels on S2 Mini, def from Wemos MP diff --git a/ports/espressif/boards/lolin_s2_mini/mpconfigboard.mk b/ports/espressif/boards/lolin_s2_mini/mpconfigboard.mk index 5e40a1e13c..24f88d9abf 100644 --- a/ports/espressif/boards/lolin_s2_mini/mpconfigboard.mk +++ b/ports/espressif/boards/lolin_s2_mini/mpconfigboard.mk @@ -5,16 +5,9 @@ USB_MANUFACTURER = "Lolin" IDF_TARGET = esp32s2 -INTERNAL_FLASH_FILESYSTEM = 1 -LONGINT_IMPL = MPZ - -# The default queue depth of 16 overflows on release builds, -# so increase it to 32. -CFLAGS += -DCFG_TUD_TASK_QUEUE_SZ=32 - -CIRCUITPY_ESP_FLASH_MODE=qio -CIRCUITPY_ESP_FLASH_FREQ=80m -CIRCUITPY_ESP_FLASH_SIZE=4MB +CIRCUITPY_ESP_FLASH_MODE = qio +CIRCUITPY_ESP_FLASH_FREQ = 80m +CIRCUITPY_ESP_FLASH_SIZE = 4MB # Include these Python libraries in firmware. diff --git a/ports/espressif/boards/lolin_s2_pico/board.c b/ports/espressif/boards/lolin_s2_pico/board.c index 0432485111..b3c8cb4191 100644 --- a/ports/espressif/boards/lolin_s2_pico/board.c +++ b/ports/espressif/boards/lolin_s2_pico/board.c @@ -36,13 +36,4 @@ void board_init(void) { #endif /* DEBUG */ } -bool board_requests_safe_mode(void) { - return false; -} - -void reset_board(void) { - -} - -void board_deinit(void) { -} +// Use the MP_WEAK supervisor/shared/board.c versions of routines not defined here. diff --git a/ports/espressif/boards/lolin_s2_pico/mpconfigboard.h b/ports/espressif/boards/lolin_s2_pico/mpconfigboard.h index 19c41f84e4..a33e6ea4d0 100644 --- a/ports/espressif/boards/lolin_s2_pico/mpconfigboard.h +++ b/ports/espressif/boards/lolin_s2_pico/mpconfigboard.h @@ -29,6 +29,8 @@ #define MICROPY_HW_BOARD_NAME "S2Pico" #define MICROPY_HW_MCU_NAME "ESP32S2-S2FN4R2" // from Wemos MP +#define MICROPY_HW_LED_STATUS (&pin_GPIO10) + #define DEFAULT_I2C_BUS_SCL (&pin_GPIO9) // JST SH Connector Pin 3 NOT STEMMA QT / Feather pinout #define DEFAULT_I2C_BUS_SDA (&pin_GPIO8) // JST SH Connector Pin 2 NOT STEMMA QT / Feather pinout diff --git a/ports/espressif/boards/lolin_s2_pico/mpconfigboard.mk b/ports/espressif/boards/lolin_s2_pico/mpconfigboard.mk index b060be0261..bf946a483f 100644 --- a/ports/espressif/boards/lolin_s2_pico/mpconfigboard.mk +++ b/ports/espressif/boards/lolin_s2_pico/mpconfigboard.mk @@ -5,16 +5,9 @@ USB_MANUFACTURER = "Lolin" IDF_TARGET = esp32s2 -INTERNAL_FLASH_FILESYSTEM = 1 -LONGINT_IMPL = MPZ - -# The default queue depth of 16 overflows on release builds, -# so increase it to 32. -CFLAGS += -DCFG_TUD_TASK_QUEUE_SZ=32 - -CIRCUITPY_ESP_FLASH_MODE=qio -CIRCUITPY_ESP_FLASH_FREQ=80m -CIRCUITPY_ESP_FLASH_SIZE=4MB +CIRCUITPY_ESP_FLASH_MODE = qio +CIRCUITPY_ESP_FLASH_FREQ = 80m +CIRCUITPY_ESP_FLASH_SIZE = 4MB # Include these Python libraries in firmware. diff --git a/ports/espressif/boards/lolin_s3/board.c b/ports/espressif/boards/lolin_s3/board.c new file mode 100644 index 0000000000..164430c88c --- /dev/null +++ b/ports/espressif/boards/lolin_s3/board.c @@ -0,0 +1,29 @@ +/* + * This file is part of the MicroPython project, http://micropython.org/ + * + * The MIT License (MIT) + * + * Copyright (c) 2020 Scott Shawcroft for Adafruit Industries + * + * Permission is hereby granted, free of charge, to any person obtaining a copy + * of this software and associated documentation files (the "Software"), to deal + * in the Software without restriction, including without limitation the rights + * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell + * copies of the Software, and to permit persons to whom the Software is + * furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice shall be included in + * all copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE + * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER + * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, + * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN + * THE SOFTWARE. + */ + +#include "supervisor/board.h" + +// Use the MP_WEAK supervisor/shared/board.c versions of routines not defined here. diff --git a/ports/espressif/boards/lolin_s3/mpconfigboard.h b/ports/espressif/boards/lolin_s3/mpconfigboard.h new file mode 100644 index 0000000000..9dc1b8f6a9 --- /dev/null +++ b/ports/espressif/boards/lolin_s3/mpconfigboard.h @@ -0,0 +1,41 @@ +/* + * This file is part of the MicroPython project, http://micropython.org/ + * + * The MIT License (MIT) + * + * Copyright (c) 2019 Scott Shawcroft for Adafruit Industries + * + * Permission is hereby granted, free of charge, to any person obtaining a copy + * of this software and associated documentation files (the "Software"), to deal + * in the Software without restriction, including without limitation the rights + * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell + * copies of the Software, and to permit persons to whom the Software is + * furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice shall be included in + * all copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE + * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER + * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, + * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN + * THE SOFTWARE. + */ + +// Micropython setup + +#define MICROPY_HW_BOARD_NAME "LOLIN S3 16MB Flash 8MB PSRAM" +#define MICROPY_HW_MCU_NAME "ESP32S3" + +#define MICROPY_HW_NEOPIXEL (&pin_GPIO38) + +// #define MICROPY_HW_LED_STATUS (&pin_GPIO13) + +#define DEFAULT_I2C_BUS_SCL (&pin_GPIO41) +#define DEFAULT_I2C_BUS_SDA (&pin_GPIO42) + +#define DEFAULT_SPI_BUS_SCK (&pin_GPIO12) +#define DEFAULT_SPI_BUS_MOSI (&pin_GPIO11) +#define DEFAULT_SPI_BUS_MISO (&pin_GPIO13) diff --git a/ports/espressif/boards/lolin_s3/mpconfigboard.mk b/ports/espressif/boards/lolin_s3/mpconfigboard.mk new file mode 100644 index 0000000000..b0b146b03c --- /dev/null +++ b/ports/espressif/boards/lolin_s3/mpconfigboard.mk @@ -0,0 +1,13 @@ +USB_VID = 0x303a +USB_PID = 0x8117 +USB_PRODUCT = "LOLIN S3 16MB Flash 8MB PSRAM" +USB_MANUFACTURER = "WEMOS" + +IDF_TARGET = esp32s3 + +CIRCUITPY_ESP_FLASH_MODE = qio +CIRCUITPY_ESP_FLASH_FREQ = 80m +CIRCUITPY_ESP_FLASH_SIZE = 16MB + +OPTIMIZATION_FLAGS = -Os +CIRCUITPY_ESP32_CAMERA = 0 diff --git a/ports/espressif/boards/lolin_s3/pins.c b/ports/espressif/boards/lolin_s3/pins.c new file mode 100644 index 0000000000..cc88572b6e --- /dev/null +++ b/ports/espressif/boards/lolin_s3/pins.c @@ -0,0 +1,123 @@ +#include "shared-bindings/board/__init__.h" + +STATIC const mp_rom_map_elem_t board_module_globals_table[] = { + CIRCUITPYTHON_BOARD_DICT_STANDARD_ITEMS + + { MP_ROM_QSTR(MP_QSTR_BUTTON), MP_ROM_PTR(&pin_GPIO0) }, + { MP_ROM_QSTR(MP_QSTR_BOOT0), MP_ROM_PTR(&pin_GPIO0) }, + { MP_ROM_QSTR(MP_QSTR_IO0), MP_ROM_PTR(&pin_GPIO0) }, + { MP_ROM_QSTR(MP_QSTR_D0), MP_ROM_PTR(&pin_GPIO0) }, + + { MP_ROM_QSTR(MP_QSTR_IO1), MP_ROM_PTR(&pin_GPIO1) }, + { MP_ROM_QSTR(MP_QSTR_A0), MP_ROM_PTR(&pin_GPIO1) }, + { MP_ROM_QSTR(MP_QSTR_D1), MP_ROM_PTR(&pin_GPIO1) }, + + { MP_ROM_QSTR(MP_QSTR_IO2), MP_ROM_PTR(&pin_GPIO2) }, + { MP_ROM_QSTR(MP_QSTR_A1), MP_ROM_PTR(&pin_GPIO2) }, + { MP_ROM_QSTR(MP_QSTR_D2), MP_ROM_PTR(&pin_GPIO2) }, + + { MP_ROM_QSTR(MP_QSTR_IO3), MP_ROM_PTR(&pin_GPIO3) }, + { MP_ROM_QSTR(MP_QSTR_A2), MP_ROM_PTR(&pin_GPIO3) }, + { MP_ROM_QSTR(MP_QSTR_D3), MP_ROM_PTR(&pin_GPIO3) }, + + { MP_ROM_QSTR(MP_QSTR_IO4), MP_ROM_PTR(&pin_GPIO4) }, + { MP_ROM_QSTR(MP_QSTR_A3), MP_ROM_PTR(&pin_GPIO4) }, + { MP_ROM_QSTR(MP_QSTR_D4), MP_ROM_PTR(&pin_GPIO4) }, + + { MP_ROM_QSTR(MP_QSTR_IO5), MP_ROM_PTR(&pin_GPIO5) }, + { MP_ROM_QSTR(MP_QSTR_A4), MP_ROM_PTR(&pin_GPIO5) }, + { MP_ROM_QSTR(MP_QSTR_D5), MP_ROM_PTR(&pin_GPIO5) }, + + { MP_ROM_QSTR(MP_QSTR_IO6), MP_ROM_PTR(&pin_GPIO6) }, + { MP_ROM_QSTR(MP_QSTR_A5), MP_ROM_PTR(&pin_GPIO6) }, + { MP_ROM_QSTR(MP_QSTR_D6), MP_ROM_PTR(&pin_GPIO6) }, + + { MP_ROM_QSTR(MP_QSTR_IO7), MP_ROM_PTR(&pin_GPIO7) }, + { MP_ROM_QSTR(MP_QSTR_A6), MP_ROM_PTR(&pin_GPIO7) }, + { MP_ROM_QSTR(MP_QSTR_D7), MP_ROM_PTR(&pin_GPIO7) }, + + + { MP_ROM_QSTR(MP_QSTR_IO8), MP_ROM_PTR(&pin_GPIO8) }, + { MP_ROM_QSTR(MP_QSTR_A7), MP_ROM_PTR(&pin_GPIO8) }, + { MP_ROM_QSTR(MP_QSTR_D8), MP_ROM_PTR(&pin_GPIO8) }, + + { MP_ROM_QSTR(MP_QSTR_IO9), MP_ROM_PTR(&pin_GPIO9) }, + { MP_ROM_QSTR(MP_QSTR_A8), MP_ROM_PTR(&pin_GPIO9) }, + { MP_ROM_QSTR(MP_QSTR_D9), MP_ROM_PTR(&pin_GPIO9) }, + + { MP_ROM_QSTR(MP_QSTR_IO10), MP_ROM_PTR(&pin_GPIO10) }, + { MP_ROM_QSTR(MP_QSTR_A9), MP_ROM_PTR(&pin_GPIO10) }, + { MP_ROM_QSTR(MP_QSTR_D10), MP_ROM_PTR(&pin_GPIO10) }, + + { MP_ROM_QSTR(MP_QSTR_IO11), MP_ROM_PTR(&pin_GPIO11) }, + { MP_ROM_QSTR(MP_QSTR_MOSI), MP_ROM_PTR(&pin_GPIO11) }, + { MP_ROM_QSTR(MP_QSTR_A10), MP_ROM_PTR(&pin_GPIO11) }, + { MP_ROM_QSTR(MP_QSTR_D11), MP_ROM_PTR(&pin_GPIO11) }, + + + { MP_ROM_QSTR(MP_QSTR_IO12), MP_ROM_PTR(&pin_GPIO12) }, + { MP_ROM_QSTR(MP_QSTR_SCK), MP_ROM_PTR(&pin_GPIO12) }, + { MP_ROM_QSTR(MP_QSTR_A11), MP_ROM_PTR(&pin_GPIO12) }, + { MP_ROM_QSTR(MP_QSTR_D12), MP_ROM_PTR(&pin_GPIO12) }, + + { MP_ROM_QSTR(MP_QSTR_IO13), MP_ROM_PTR(&pin_GPIO13) }, + { MP_ROM_QSTR(MP_QSTR_MISO), MP_ROM_PTR(&pin_GPIO13) }, + { MP_ROM_QSTR(MP_QSTR_A12), MP_ROM_PTR(&pin_GPIO13) }, + { MP_ROM_QSTR(MP_QSTR_D13), MP_ROM_PTR(&pin_GPIO13) }, + + { MP_ROM_QSTR(MP_QSTR_IO14), MP_ROM_PTR(&pin_GPIO14) }, + { MP_ROM_QSTR(MP_QSTR_A13), MP_ROM_PTR(&pin_GPIO14) }, + { MP_ROM_QSTR(MP_QSTR_D14), MP_ROM_PTR(&pin_GPIO14) }, + + { MP_ROM_QSTR(MP_QSTR_IO15), MP_ROM_PTR(&pin_GPIO15) }, + { MP_ROM_QSTR(MP_QSTR_A14), MP_ROM_PTR(&pin_GPIO15) }, + { MP_ROM_QSTR(MP_QSTR_D15), MP_ROM_PTR(&pin_GPIO15) }, + + { MP_ROM_QSTR(MP_QSTR_IO16), MP_ROM_PTR(&pin_GPIO16) }, + { MP_ROM_QSTR(MP_QSTR_A15), MP_ROM_PTR(&pin_GPIO16) }, + { MP_ROM_QSTR(MP_QSTR_D16), MP_ROM_PTR(&pin_GPIO16) }, + + { MP_ROM_QSTR(MP_QSTR_IO17), MP_ROM_PTR(&pin_GPIO17) }, + { MP_ROM_QSTR(MP_QSTR_A16), MP_ROM_PTR(&pin_GPIO17) }, + { MP_ROM_QSTR(MP_QSTR_D17), MP_ROM_PTR(&pin_GPIO17) }, + + { MP_ROM_QSTR(MP_QSTR_IO18), MP_ROM_PTR(&pin_GPIO17) }, + { MP_ROM_QSTR(MP_QSTR_A17), MP_ROM_PTR(&pin_GPIO17) }, + { MP_ROM_QSTR(MP_QSTR_D18), MP_ROM_PTR(&pin_GPIO17) }, + + { MP_ROM_QSTR(MP_QSTR_IO21), MP_ROM_PTR(&pin_GPIO21) }, + { MP_ROM_QSTR(MP_QSTR_D21), MP_ROM_PTR(&pin_GPIO21) }, + + { MP_ROM_QSTR(MP_QSTR_IO38), MP_ROM_PTR(&pin_GPIO38) }, + { MP_ROM_QSTR(MP_QSTR_D38), MP_ROM_PTR(&pin_GPIO38) }, + { MP_ROM_QSTR(MP_QSTR_NEOPIXEL), MP_ROM_PTR(&pin_GPIO38) }, + + { MP_ROM_QSTR(MP_QSTR_IO39), MP_ROM_PTR(&pin_GPIO39) }, + { MP_ROM_QSTR(MP_QSTR_D39), MP_ROM_PTR(&pin_GPIO39) }, + + { MP_ROM_QSTR(MP_QSTR_IO40), MP_ROM_PTR(&pin_GPIO40) }, + { MP_ROM_QSTR(MP_QSTR_D40), MP_ROM_PTR(&pin_GPIO40) }, + + { MP_ROM_QSTR(MP_QSTR_IO41), MP_ROM_PTR(&pin_GPIO41) }, + { MP_ROM_QSTR(MP_QSTR_SCL), MP_ROM_PTR(&pin_GPIO41) }, + { MP_ROM_QSTR(MP_QSTR_D41), MP_ROM_PTR(&pin_GPIO41) }, + + { MP_ROM_QSTR(MP_QSTR_IO42), MP_ROM_PTR(&pin_GPIO42) }, + { MP_ROM_QSTR(MP_QSTR_SDA), MP_ROM_PTR(&pin_GPIO42) }, + { MP_ROM_QSTR(MP_QSTR_D42), MP_ROM_PTR(&pin_GPIO42) }, + + { MP_ROM_QSTR(MP_QSTR_IO43), MP_ROM_PTR(&pin_GPIO43) }, + { MP_ROM_QSTR(MP_QSTR_D43), MP_ROM_PTR(&pin_GPIO43) }, + { MP_ROM_QSTR(MP_QSTR_TX), MP_ROM_PTR(&pin_GPIO43) }, + + { MP_ROM_QSTR(MP_QSTR_IO44), MP_ROM_PTR(&pin_GPIO44) }, + { MP_ROM_QSTR(MP_QSTR_D44), MP_ROM_PTR(&pin_GPIO44) }, + { MP_ROM_QSTR(MP_QSTR_RX), MP_ROM_PTR(&pin_GPIO44) }, + + + { MP_ROM_QSTR(MP_QSTR_I2C), MP_ROM_PTR(&board_i2c_obj) }, + { MP_ROM_QSTR(MP_QSTR_STEMMA_I2C), MP_ROM_PTR(&board_i2c_obj) }, + { MP_ROM_QSTR(MP_QSTR_SPI), MP_ROM_PTR(&board_spi_obj) }, + { MP_ROM_QSTR(MP_QSTR_UART), MP_ROM_PTR(&board_uart_obj) } +}; +MP_DEFINE_CONST_DICT(board_module_globals, board_module_globals_table); diff --git a/ports/espressif/boards/lolin_s3/sdkconfig b/ports/espressif/boards/lolin_s3/sdkconfig new file mode 100644 index 0000000000..23d005edd9 --- /dev/null +++ b/ports/espressif/boards/lolin_s3/sdkconfig @@ -0,0 +1,48 @@ +# +# Component config +# +# +# ESP32S3-Specific +# +CONFIG_ESP32S3_SPIRAM_SUPPORT=y +# +# SPI RAM config +# +CONFIG_SPIRAM_MODE_QUAD=y +# CONFIG_SPIRAM_MODE_OCT is not set +CONFIG_SPIRAM_TYPE_AUTO=y +# CONFIG_SPIRAM_TYPE_ESPPSRAM16 is not set +# CONFIG_SPIRAM_TYPE_ESPPSRAM32 is not set +# CONFIG_SPIRAM_TYPE_ESPPSRAM64 is not set +CONFIG_SPIRAM_SIZE=8388608 +# +# PSRAM Clock and CS IO for ESP32S3 +# +# CONFIG_DEFAULT_PSRAM_CLK_IO=30 +# CONFIG_DEFAULT_PSRAM_CS_IO=26 +# end of PSRAM Clock and CS IO for ESP32S3 + +# CONFIG_SPIRAM_FETCH_INSTRUCTIONS is not set +# CONFIG_SPIRAM_RODATA is not set +# CONFIG_SPIRAM_SPEED_120M is not set +CONFIG_SPIRAM_SPEED_80M=y +# CONFIG_SPIRAM_SPEED_40M is not set +CONFIG_SPIRAM=y +CONFIG_SPIRAM_BOOT_INIT=y +# CONFIG_SPIRAM_IGNORE_NOTFOUND is not set +CONFIG_SPIRAM_USE_MEMMAP=y +# CONFIG_SPIRAM_USE_CAPS_ALLOC is not set +# CONFIG_SPIRAM_USE_MALLOC is not set +CONFIG_SPIRAM_MEMTEST=y +CONFIG_SPIRAM_MODE_OCT=y +# end of SPI RAM config + +# end of ESP32S3-Specific + +# +# LWIP +# +CONFIG_LWIP_LOCAL_HOSTNAME="LOLIN-S3" +# end of LWIP + +# end of Component config diff --git a/ports/espressif/boards/microdev_micro_c3/board.c b/ports/espressif/boards/microdev_micro_c3/board.c index e3b71f4832..b155ed7a7b 100644 --- a/ports/espressif/boards/microdev_micro_c3/board.c +++ b/ports/espressif/boards/microdev_micro_c3/board.c @@ -35,14 +35,4 @@ void board_init(void) { #endif } -bool board_requests_safe_mode(void) { - return false; -} - -void reset_board(void) { -} - -#if CIRCUITPY_ALARM -void board_deinit(void) { -} -#endif +// Use the MP_WEAK supervisor/shared/board.c versions of routines not defined here. diff --git a/ports/espressif/boards/microdev_micro_c3/mpconfigboard.h b/ports/espressif/boards/microdev_micro_c3/mpconfigboard.h index e94f14c80b..97a18f3235 100644 --- a/ports/espressif/boards/microdev_micro_c3/mpconfigboard.h +++ b/ports/espressif/boards/microdev_micro_c3/mpconfigboard.h @@ -25,24 +25,31 @@ */ // Board setup -#define MICROPY_HW_BOARD_NAME "MicroDev microC3" -#define MICROPY_HW_MCU_NAME "ESP32-C3FN4" +#define MICROPY_HW_BOARD_NAME "MicroDev microC3" +#define MICROPY_HW_MCU_NAME "ESP32-C3FN4" -// Status LED -#define MICROPY_HW_NEOPIXEL (&pin_GPIO7) -#define MICROPY_HW_NEOPIXEL_COUNT (2) +// Status LEDs +#define MICROPY_HW_NEOPIXEL (&pin_GPIO7) +#define MICROPY_HW_NEOPIXEL_COUNT (2) + +#define MICROPY_HW_LED_STATUS (&pin_GPIO8) // Default bus pins -#define DEFAULT_I2C_BUS_SCL (&pin_GPIO4) -#define DEFAULT_I2C_BUS_SDA (&pin_GPIO5) +#define DEFAULT_I2C_BUS_SCL (&pin_GPIO4) +#define DEFAULT_I2C_BUS_SDA (&pin_GPIO5) -#define DEFAULT_SPI_BUS_SCK (&pin_GPIO1) -#define DEFAULT_SPI_BUS_MOSI (&pin_GPIO2) -#define DEFAULT_SPI_BUS_MISO (&pin_GPIO3) +#define DEFAULT_SPI_BUS_SCK (&pin_GPIO1) +#define DEFAULT_SPI_BUS_MOSI (&pin_GPIO2) +#define DEFAULT_SPI_BUS_MISO (&pin_GPIO3) -#define DEFAULT_UART_BUS_RX (&pin_GPIO20) -#define DEFAULT_UART_BUS_TX (&pin_GPIO21) +#define DEFAULT_UART_BUS_RX (&pin_GPIO20) +#define DEFAULT_UART_BUS_TX (&pin_GPIO21) -// Serial over UART -#define CIRCUITPY_DEBUG_UART_RX DEFAULT_UART_BUS_RX -#define CIRCUITPY_DEBUG_UART_TX DEFAULT_UART_BUS_TX +// For REPL over built-in USB Serial +#define CIRCUITPY_ESP_USB_SERIAL_JTAG (1) + +// For entering safe mode +#define CIRCUITPY_BOOT_BUTTON (&pin_GPIO9) + +// Explanation of how a user got into safe mode +#define BOARD_USER_SAFE_MODE_ACTION translate("pressing boot button at start up.\n") diff --git a/ports/espressif/boards/microdev_micro_c3/mpconfigboard.mk b/ports/espressif/boards/microdev_micro_c3/mpconfigboard.mk index 12bd7358b8..94c64a8273 100644 --- a/ports/espressif/boards/microdev_micro_c3/mpconfigboard.mk +++ b/ports/espressif/boards/microdev_micro_c3/mpconfigboard.mk @@ -3,8 +3,6 @@ CIRCUITPY_CREATION_ID = 0x006d4333 IDF_TARGET = esp32c3 -INTERNAL_FLASH_FILESYSTEM = 1 - -CIRCUITPY_ESP_FLASH_MODE=qio -CIRCUITPY_ESP_FLASH_FREQ=80m -CIRCUITPY_ESP_FLASH_SIZE=4MB +CIRCUITPY_ESP_FLASH_MODE = dio +CIRCUITPY_ESP_FLASH_FREQ = 80m +CIRCUITPY_ESP_FLASH_SIZE = 4MB diff --git a/ports/espressif/boards/microdev_micro_c3/sdkconfig b/ports/espressif/boards/microdev_micro_c3/sdkconfig index f6f038a77c..6674dbfb90 100644 --- a/ports/espressif/boards/microdev_micro_c3/sdkconfig +++ b/ports/espressif/boards/microdev_micro_c3/sdkconfig @@ -1,5 +1,70 @@ +# Automatically generated file. DO NOT EDIT. +# Espressif IoT Development Framework (ESP-IDF) Project Configuration +# +# Bootloader config +# +CONFIG_BOOTLOADER_LOG_LEVEL_NONE=y +# CONFIG_BOOTLOADER_LOG_LEVEL_INFO is not set +CONFIG_BOOTLOADER_LOG_LEVEL=0 +# end of Bootloader config + +# +# Serial flasher config +# +# CONFIG_ESPTOOLPY_FLASHFREQ_26M is not set +# end of Serial flasher config + +# +# Partition Table +# +CONFIG_PARTITION_TABLE_CUSTOM_FILENAME="esp-idf-config/partitions-4MB-no-uf2.csv" +CONFIG_PARTITION_TABLE_FILENAME="esp-idf-config/partitions-4MB-no-uf2.csv" +# end of Partition Table + +# +# Compiler options +# +# CONFIG_COMPILER_SAVE_RESTORE_LIBCALLS is not set +# end of Compiler options + +# +# Component config +# +# + +# +# PHY +# +CONFIG_ESP_PHY_ENABLE_USB=y +# end of PHY + +# +# ESP System Settings +# +# CONFIG_ESP_SYSTEM_USE_EH_FRAME is not set +CONFIG_ESP_CONSOLE_SECONDARY_NONE=y +# CONFIG_ESP_CONSOLE_SECONDARY_USB_SERIAL_JTAG is not set +# CONFIG_ESP_DEBUG_STUBS_ENABLE is not set +# end of ESP System Settings + # # LWIP # CONFIG_LWIP_LOCAL_HOSTNAME="MicroDev-microC3" # end of LWIP + +# +# SPI Flash driver +# +# CONFIG_SPI_FLASH_AUTO_SUSPEND is not set +# end of SPI Flash driver + +# end of Component config + +# +# Deprecated options for backward compatibility +# +# CONFIG_LOG_BOOTLOADER_LEVEL_INFO is not set +CONFIG_LOG_BOOTLOADER_LEVEL=0 +# CONFIG_COMPILER_OPTIMIZATION_LEVEL_DEBUG is not set +# end of Deprecated options for backward compatibility diff --git a/ports/espressif/boards/microdev_micro_s2/board.c b/ports/espressif/boards/microdev_micro_s2/board.c index 0a2b17e001..65bb19aced 100644 --- a/ports/espressif/boards/microdev_micro_s2/board.c +++ b/ports/espressif/boards/microdev_micro_s2/board.c @@ -38,23 +38,4 @@ void board_init(void) { #endif } -bool board_requests_safe_mode(void) { - return false; -} - -bool espressif_board_reset_pin_number(gpio_num_t pin_number) { - // Pin 21 is a high side LED so pull it down to prevent lighting the LED. - if (pin_number == 21) { - gpio_reset_pin(21); - gpio_pullup_dis(21); - gpio_pulldown_en(21); - return true; - } - return false; -} - -void reset_board(void) { -} - -void board_deinit(void) { -} +// Use the MP_WEAK supervisor/shared/board.c versions of routines not defined here. diff --git a/ports/espressif/boards/microdev_micro_s2/mpconfigboard.h b/ports/espressif/boards/microdev_micro_s2/mpconfigboard.h index c9354cabcc..c692c5e664 100644 --- a/ports/espressif/boards/microdev_micro_s2/mpconfigboard.h +++ b/ports/espressif/boards/microdev_micro_s2/mpconfigboard.h @@ -28,9 +28,11 @@ #define MICROPY_HW_BOARD_NAME "MicroDev microS2" #define MICROPY_HW_MCU_NAME "ESP32-S2" -// Status LED +// Status LEDs #define MICROPY_HW_NEOPIXEL (&pin_GPIO33) +#define MICROPY_HW_LED_STATUS (&pin_GPIO21) + // Default bus pins #define DEFAULT_I2C_BUS_SCL (&pin_GPIO1) #define DEFAULT_I2C_BUS_SDA (&pin_GPIO2) diff --git a/ports/espressif/boards/microdev_micro_s2/mpconfigboard.mk b/ports/espressif/boards/microdev_micro_s2/mpconfigboard.mk index 887e6d8b9b..e5a7f05462 100644 --- a/ports/espressif/boards/microdev_micro_s2/mpconfigboard.mk +++ b/ports/espressif/boards/microdev_micro_s2/mpconfigboard.mk @@ -5,12 +5,6 @@ USB_MANUFACTURER = "MicroDev" IDF_TARGET = esp32s2 -INTERNAL_FLASH_FILESYSTEM = 1 - -# The default queue depth of 16 overflows on release builds, -# so increase it to 32. -CFLAGS += -DCFG_TUD_TASK_QUEUE_SZ=32 - -CIRCUITPY_ESP_FLASH_MODE=qio -CIRCUITPY_ESP_FLASH_FREQ=80m -CIRCUITPY_ESP_FLASH_SIZE=16MB +CIRCUITPY_ESP_FLASH_MODE = qio +CIRCUITPY_ESP_FLASH_FREQ = 80m +CIRCUITPY_ESP_FLASH_SIZE = 16MB diff --git a/ports/espressif/boards/mixgo_ce_serial/board.c b/ports/espressif/boards/mixgo_ce_serial/board.c new file mode 100644 index 0000000000..e6ffb553b1 --- /dev/null +++ b/ports/espressif/boards/mixgo_ce_serial/board.c @@ -0,0 +1,62 @@ +/* + * This file is part of the MicroPython project, http://micropython.org/ + * + * The MIT License (MIT) + * + * Copyright (c) 2020 Scott Shawcroft for Adafruit Industries + * + * Permission is hereby granted, free of charge, to any person obtaining a copy + * of this software and associated documentation files (the "Software"), to deal + * in the Software without restriction, including without limitation the rights + * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell + * copies of the Software, and to permit persons to whom the Software is + * furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice shall be included in + * all copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE + * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER + * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, + * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN + * THE SOFTWARE. + */ + +#include "supervisor/board.h" +#include "mpconfigboard.h" +#include "shared-bindings/microcontroller/Pin.h" + +#include "lib/oofatfs/ff.h" +#include "extmod/vfs_fat.h" +#include "py/mpstate.h" +#include "supervisor/filesystem.h" + +void board_init(void) { + // Debug UART + #ifdef DEBUG + common_hal_never_reset_pin(&pin_GPIO43); + common_hal_never_reset_pin(&pin_GPIO44); + #endif /* DEBUG */ + + mp_import_stat_t stat_b = mp_import_stat("boot.py"); + if (stat_b != MP_IMPORT_STAT_FILE) { + FATFS *fatfs = filesystem_circuitpy(); + FIL fs; + UINT char_written = 0; + const byte buffer[] = "#Serial port upload mode\nimport storage\nstorage.remount(\"/\", False)\nstorage.disable_usb_drive()\n"; + // Create or modify existing boot.py file + f_open(fatfs, &fs, "/boot.py", FA_WRITE | FA_CREATE_ALWAYS); + f_write(&fs, buffer, sizeof(buffer) - 1, &char_written); + f_close(&fs); + // Delete code.Py, use main.py + mp_import_stat_t stat_c = mp_import_stat("code.py"); + if (stat_c == MP_IMPORT_STAT_FILE) { + f_unlink(fatfs,"/code.py"); + } + } + +} + +// Use the MP_WEAK supervisor/shared/board.c versions of routines not defined here. diff --git a/shared-module/gamepadshift/__init__.h b/ports/espressif/boards/mixgo_ce_serial/mpconfigboard.h similarity index 81% rename from shared-module/gamepadshift/__init__.h rename to ports/espressif/boards/mixgo_ce_serial/mpconfigboard.h index 225db73361..187687c8f5 100644 --- a/shared-module/gamepadshift/__init__.h +++ b/ports/espressif/boards/mixgo_ce_serial/mpconfigboard.h @@ -3,7 +3,7 @@ * * The MIT License (MIT) * - * Copyright (c) 2016 Scott Shawcroft for Adafruit Industries + * Copyright (c) 2019 Scott Shawcroft for Adafruit Industries * * Permission is hereby granted, free of charge, to any person obtaining a copy * of this software and associated documentation files (the "Software"), to deal @@ -24,10 +24,9 @@ * THE SOFTWARE. */ -#ifndef MICROPY_INCLUDED_GAMEPADSHIFT___INIT___H -#define MICROPY_INCLUDED_GAMEPADSHIFT___INIT___H +// Micropython setup -void gamepadshift_tick(void); -void gamepadshift_reset(void); +#define MICROPY_HW_BOARD_NAME "MixGo CE" +#define MICROPY_HW_MCU_NAME "ESP32S2" -#endif // MICROPY_INCLUDED_GAMEPADSHIFT___INIT___H +#define MICROPY_HW_NEOPIXEL (&pin_GPIO45) diff --git a/ports/espressif/boards/mixgo_ce_serial/mpconfigboard.mk b/ports/espressif/boards/mixgo_ce_serial/mpconfigboard.mk new file mode 100644 index 0000000000..490675e467 --- /dev/null +++ b/ports/espressif/boards/mixgo_ce_serial/mpconfigboard.mk @@ -0,0 +1,17 @@ +USB_VID = 0x303A +USB_PID = 0x80FD +USB_PRODUCT = "MixGo CE" +USB_MANUFACTURER = "Espressif" + +IDF_TARGET = esp32s2 + +CIRCUITPY_ESP_FLASH_MODE = dio +CIRCUITPY_ESP_FLASH_FREQ = 40m +CIRCUITPY_ESP_FLASH_SIZE = 4MB + +CIRCUITPY_ESP32_CAMERA = 0 + +FROZEN_MPY_DIRS += $(TOP)/frozen/Adafruit_CircuitPython_Requests +FROZEN_MPY_DIRS += $(TOP)/frozen/Adafruit_CircuitPython_NeoPixel +FROZEN_MPY_DIRS += $(TOP)/frozen/mixgo_cp_lib/mixgoce_lib +CIRCUITPY_ESP32_CAMERA = 0 diff --git a/ports/espressif/boards/mixgo_ce_serial/pins.c b/ports/espressif/boards/mixgo_ce_serial/pins.c new file mode 100644 index 0000000000..ca4eb12bf7 --- /dev/null +++ b/ports/espressif/boards/mixgo_ce_serial/pins.c @@ -0,0 +1,50 @@ +#include "shared-bindings/board/__init__.h" + +STATIC const mp_rom_map_elem_t board_module_globals_table[] = { + CIRCUITPYTHON_BOARD_DICT_STANDARD_ITEMS + + { MP_ROM_QSTR(MP_QSTR_IO0), MP_ROM_PTR(&pin_GPIO0) }, + { MP_ROM_QSTR(MP_QSTR_IO1), MP_ROM_PTR(&pin_GPIO1) }, + { MP_ROM_QSTR(MP_QSTR_IO2), MP_ROM_PTR(&pin_GPIO2) }, + { MP_ROM_QSTR(MP_QSTR_IO3), MP_ROM_PTR(&pin_GPIO3) }, + { MP_ROM_QSTR(MP_QSTR_IO4), MP_ROM_PTR(&pin_GPIO4) }, + { MP_ROM_QSTR(MP_QSTR_IO5), MP_ROM_PTR(&pin_GPIO5) }, + { MP_ROM_QSTR(MP_QSTR_IO6), MP_ROM_PTR(&pin_GPIO6) }, + { MP_ROM_QSTR(MP_QSTR_IO7), MP_ROM_PTR(&pin_GPIO7) }, + { MP_ROM_QSTR(MP_QSTR_IO8), MP_ROM_PTR(&pin_GPIO8) }, + { MP_ROM_QSTR(MP_QSTR_IO9), MP_ROM_PTR(&pin_GPIO9) }, + { MP_ROM_QSTR(MP_QSTR_IO10), MP_ROM_PTR(&pin_GPIO10) }, + { MP_ROM_QSTR(MP_QSTR_IO11), MP_ROM_PTR(&pin_GPIO11) }, + { MP_ROM_QSTR(MP_QSTR_IO12), MP_ROM_PTR(&pin_GPIO12) }, + { MP_ROM_QSTR(MP_QSTR_IO13), MP_ROM_PTR(&pin_GPIO13) }, + { MP_ROM_QSTR(MP_QSTR_IO14), MP_ROM_PTR(&pin_GPIO14) }, + { MP_ROM_QSTR(MP_QSTR_IO15), MP_ROM_PTR(&pin_GPIO15) }, + { MP_ROM_QSTR(MP_QSTR_IO16), MP_ROM_PTR(&pin_GPIO16) }, + { MP_ROM_QSTR(MP_QSTR_IO17), MP_ROM_PTR(&pin_GPIO17) }, + + + { MP_ROM_QSTR(MP_QSTR_IO18), MP_ROM_PTR(&pin_GPIO18) }, + { MP_ROM_QSTR(MP_QSTR_IO19), MP_ROM_PTR(&pin_GPIO19) }, + { MP_ROM_QSTR(MP_QSTR_IO20), MP_ROM_PTR(&pin_GPIO20) }, + { MP_ROM_QSTR(MP_QSTR_IO21), MP_ROM_PTR(&pin_GPIO21) }, + { MP_ROM_QSTR(MP_QSTR_IO26), MP_ROM_PTR(&pin_GPIO26) }, + { MP_ROM_QSTR(MP_QSTR_IO33), MP_ROM_PTR(&pin_GPIO33) }, + { MP_ROM_QSTR(MP_QSTR_IO34), MP_ROM_PTR(&pin_GPIO34) }, + { MP_ROM_QSTR(MP_QSTR_IO35), MP_ROM_PTR(&pin_GPIO35) }, + { MP_ROM_QSTR(MP_QSTR_IO36), MP_ROM_PTR(&pin_GPIO36) }, + { MP_ROM_QSTR(MP_QSTR_IO37), MP_ROM_PTR(&pin_GPIO37) }, + { MP_ROM_QSTR(MP_QSTR_IO38), MP_ROM_PTR(&pin_GPIO38) }, + { MP_ROM_QSTR(MP_QSTR_IO39), MP_ROM_PTR(&pin_GPIO39) }, + { MP_ROM_QSTR(MP_QSTR_IO40), MP_ROM_PTR(&pin_GPIO40) }, + { MP_ROM_QSTR(MP_QSTR_IO41), MP_ROM_PTR(&pin_GPIO41) }, + { MP_ROM_QSTR(MP_QSTR_IO42), MP_ROM_PTR(&pin_GPIO42) }, + { MP_ROM_QSTR(MP_QSTR_TX), MP_ROM_PTR(&pin_GPIO43) }, + { MP_ROM_QSTR(MP_QSTR_IO43), MP_ROM_PTR(&pin_GPIO43) }, + { MP_ROM_QSTR(MP_QSTR_RX), MP_ROM_PTR(&pin_GPIO44) }, + { MP_ROM_QSTR(MP_QSTR_IO44), MP_ROM_PTR(&pin_GPIO44) }, + { MP_ROM_QSTR(MP_QSTR_IO45), MP_ROM_PTR(&pin_GPIO45) }, + { MP_ROM_QSTR(MP_QSTR_IO46), MP_ROM_PTR(&pin_GPIO46) }, + + { MP_ROM_QSTR(MP_QSTR_NEOPIXEL), MP_ROM_PTR(&pin_GPIO45) }, +}; +MP_DEFINE_CONST_DICT(board_module_globals, board_module_globals_table); diff --git a/ports/espressif/boards/mixgo_ce_serial/sdkconfig b/ports/espressif/boards/mixgo_ce_serial/sdkconfig new file mode 100644 index 0000000000..5b9c86dcc3 --- /dev/null +++ b/ports/espressif/boards/mixgo_ce_serial/sdkconfig @@ -0,0 +1,6 @@ +# CONFIG_ESP32S2_SPIRAM_SUPPORT is not set +# +# LWIP +# +CONFIG_LWIP_LOCAL_HOSTNAME="espressif" +# end of LWIP diff --git a/ports/espressif/boards/mixgo_ce_udisk/board.c b/ports/espressif/boards/mixgo_ce_udisk/board.c new file mode 100644 index 0000000000..b3c8cb4191 --- /dev/null +++ b/ports/espressif/boards/mixgo_ce_udisk/board.c @@ -0,0 +1,39 @@ +/* + * This file is part of the MicroPython project, http://micropython.org/ + * + * The MIT License (MIT) + * + * Copyright (c) 2020 Scott Shawcroft for Adafruit Industries + * + * Permission is hereby granted, free of charge, to any person obtaining a copy + * of this software and associated documentation files (the "Software"), to deal + * in the Software without restriction, including without limitation the rights + * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell + * copies of the Software, and to permit persons to whom the Software is + * furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice shall be included in + * all copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE + * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER + * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, + * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN + * THE SOFTWARE. + */ + +#include "supervisor/board.h" +#include "mpconfigboard.h" +#include "shared-bindings/microcontroller/Pin.h" + +void board_init(void) { + // Debug UART + #ifdef DEBUG + common_hal_never_reset_pin(&pin_GPIO43); + common_hal_never_reset_pin(&pin_GPIO44); + #endif /* DEBUG */ +} + +// Use the MP_WEAK supervisor/shared/board.c versions of routines not defined here. diff --git a/ports/espressif/boards/mixgo_ce_udisk/mpconfigboard.h b/ports/espressif/boards/mixgo_ce_udisk/mpconfigboard.h new file mode 100644 index 0000000000..187687c8f5 --- /dev/null +++ b/ports/espressif/boards/mixgo_ce_udisk/mpconfigboard.h @@ -0,0 +1,32 @@ +/* + * This file is part of the MicroPython project, http://micropython.org/ + * + * The MIT License (MIT) + * + * Copyright (c) 2019 Scott Shawcroft for Adafruit Industries + * + * Permission is hereby granted, free of charge, to any person obtaining a copy + * of this software and associated documentation files (the "Software"), to deal + * in the Software without restriction, including without limitation the rights + * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell + * copies of the Software, and to permit persons to whom the Software is + * furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice shall be included in + * all copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE + * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER + * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, + * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN + * THE SOFTWARE. + */ + +// Micropython setup + +#define MICROPY_HW_BOARD_NAME "MixGo CE" +#define MICROPY_HW_MCU_NAME "ESP32S2" + +#define MICROPY_HW_NEOPIXEL (&pin_GPIO45) diff --git a/ports/espressif/boards/mixgo_ce_udisk/mpconfigboard.mk b/ports/espressif/boards/mixgo_ce_udisk/mpconfigboard.mk new file mode 100644 index 0000000000..5c6649ce6e --- /dev/null +++ b/ports/espressif/boards/mixgo_ce_udisk/mpconfigboard.mk @@ -0,0 +1,17 @@ +USB_VID = 0x303A +USB_PID = 0x80FC +USB_PRODUCT = "MixGo CE" +USB_MANUFACTURER = "Espressif" + +IDF_TARGET = esp32s2 + +CIRCUITPY_ESP_FLASH_MODE = dio +CIRCUITPY_ESP_FLASH_FREQ = 40m +CIRCUITPY_ESP_FLASH_SIZE = 4MB + +CIRCUITPY_ESP32_CAMERA = 0 + +FROZEN_MPY_DIRS += $(TOP)/frozen/Adafruit_CircuitPython_Requests +FROZEN_MPY_DIRS += $(TOP)/frozen/Adafruit_CircuitPython_NeoPixel +FROZEN_MPY_DIRS += $(TOP)/frozen/mixgo_cp_lib/mixgoce_lib +CIRCUITPY_ESP32_CAMERA = 0 diff --git a/ports/espressif/boards/mixgo_ce_udisk/pins.c b/ports/espressif/boards/mixgo_ce_udisk/pins.c new file mode 100644 index 0000000000..ca4eb12bf7 --- /dev/null +++ b/ports/espressif/boards/mixgo_ce_udisk/pins.c @@ -0,0 +1,50 @@ +#include "shared-bindings/board/__init__.h" + +STATIC const mp_rom_map_elem_t board_module_globals_table[] = { + CIRCUITPYTHON_BOARD_DICT_STANDARD_ITEMS + + { MP_ROM_QSTR(MP_QSTR_IO0), MP_ROM_PTR(&pin_GPIO0) }, + { MP_ROM_QSTR(MP_QSTR_IO1), MP_ROM_PTR(&pin_GPIO1) }, + { MP_ROM_QSTR(MP_QSTR_IO2), MP_ROM_PTR(&pin_GPIO2) }, + { MP_ROM_QSTR(MP_QSTR_IO3), MP_ROM_PTR(&pin_GPIO3) }, + { MP_ROM_QSTR(MP_QSTR_IO4), MP_ROM_PTR(&pin_GPIO4) }, + { MP_ROM_QSTR(MP_QSTR_IO5), MP_ROM_PTR(&pin_GPIO5) }, + { MP_ROM_QSTR(MP_QSTR_IO6), MP_ROM_PTR(&pin_GPIO6) }, + { MP_ROM_QSTR(MP_QSTR_IO7), MP_ROM_PTR(&pin_GPIO7) }, + { MP_ROM_QSTR(MP_QSTR_IO8), MP_ROM_PTR(&pin_GPIO8) }, + { MP_ROM_QSTR(MP_QSTR_IO9), MP_ROM_PTR(&pin_GPIO9) }, + { MP_ROM_QSTR(MP_QSTR_IO10), MP_ROM_PTR(&pin_GPIO10) }, + { MP_ROM_QSTR(MP_QSTR_IO11), MP_ROM_PTR(&pin_GPIO11) }, + { MP_ROM_QSTR(MP_QSTR_IO12), MP_ROM_PTR(&pin_GPIO12) }, + { MP_ROM_QSTR(MP_QSTR_IO13), MP_ROM_PTR(&pin_GPIO13) }, + { MP_ROM_QSTR(MP_QSTR_IO14), MP_ROM_PTR(&pin_GPIO14) }, + { MP_ROM_QSTR(MP_QSTR_IO15), MP_ROM_PTR(&pin_GPIO15) }, + { MP_ROM_QSTR(MP_QSTR_IO16), MP_ROM_PTR(&pin_GPIO16) }, + { MP_ROM_QSTR(MP_QSTR_IO17), MP_ROM_PTR(&pin_GPIO17) }, + + + { MP_ROM_QSTR(MP_QSTR_IO18), MP_ROM_PTR(&pin_GPIO18) }, + { MP_ROM_QSTR(MP_QSTR_IO19), MP_ROM_PTR(&pin_GPIO19) }, + { MP_ROM_QSTR(MP_QSTR_IO20), MP_ROM_PTR(&pin_GPIO20) }, + { MP_ROM_QSTR(MP_QSTR_IO21), MP_ROM_PTR(&pin_GPIO21) }, + { MP_ROM_QSTR(MP_QSTR_IO26), MP_ROM_PTR(&pin_GPIO26) }, + { MP_ROM_QSTR(MP_QSTR_IO33), MP_ROM_PTR(&pin_GPIO33) }, + { MP_ROM_QSTR(MP_QSTR_IO34), MP_ROM_PTR(&pin_GPIO34) }, + { MP_ROM_QSTR(MP_QSTR_IO35), MP_ROM_PTR(&pin_GPIO35) }, + { MP_ROM_QSTR(MP_QSTR_IO36), MP_ROM_PTR(&pin_GPIO36) }, + { MP_ROM_QSTR(MP_QSTR_IO37), MP_ROM_PTR(&pin_GPIO37) }, + { MP_ROM_QSTR(MP_QSTR_IO38), MP_ROM_PTR(&pin_GPIO38) }, + { MP_ROM_QSTR(MP_QSTR_IO39), MP_ROM_PTR(&pin_GPIO39) }, + { MP_ROM_QSTR(MP_QSTR_IO40), MP_ROM_PTR(&pin_GPIO40) }, + { MP_ROM_QSTR(MP_QSTR_IO41), MP_ROM_PTR(&pin_GPIO41) }, + { MP_ROM_QSTR(MP_QSTR_IO42), MP_ROM_PTR(&pin_GPIO42) }, + { MP_ROM_QSTR(MP_QSTR_TX), MP_ROM_PTR(&pin_GPIO43) }, + { MP_ROM_QSTR(MP_QSTR_IO43), MP_ROM_PTR(&pin_GPIO43) }, + { MP_ROM_QSTR(MP_QSTR_RX), MP_ROM_PTR(&pin_GPIO44) }, + { MP_ROM_QSTR(MP_QSTR_IO44), MP_ROM_PTR(&pin_GPIO44) }, + { MP_ROM_QSTR(MP_QSTR_IO45), MP_ROM_PTR(&pin_GPIO45) }, + { MP_ROM_QSTR(MP_QSTR_IO46), MP_ROM_PTR(&pin_GPIO46) }, + + { MP_ROM_QSTR(MP_QSTR_NEOPIXEL), MP_ROM_PTR(&pin_GPIO45) }, +}; +MP_DEFINE_CONST_DICT(board_module_globals, board_module_globals_table); diff --git a/ports/espressif/boards/mixgo_ce_udisk/sdkconfig b/ports/espressif/boards/mixgo_ce_udisk/sdkconfig new file mode 100644 index 0000000000..5b9c86dcc3 --- /dev/null +++ b/ports/espressif/boards/mixgo_ce_udisk/sdkconfig @@ -0,0 +1,6 @@ +# CONFIG_ESP32S2_SPIRAM_SUPPORT is not set +# +# LWIP +# +CONFIG_LWIP_LOCAL_HOSTNAME="espressif" +# end of LWIP diff --git a/ports/espressif/boards/morpheans_morphesp-240/board.c b/ports/espressif/boards/morpheans_morphesp-240/board.c index b15562de38..30e0a04aad 100644 --- a/ports/espressif/boards/morpheans_morphesp-240/board.c +++ b/ports/espressif/boards/morpheans_morphesp-240/board.c @@ -172,9 +172,6 @@ void board_init(void) { 0 // phase ); - // workaround as board_init() is called before reset_port() in main.c - pwmout_reset(); - displayio_display_obj_t *display = &displays[0].display; display->base.type = &displayio_display_type; common_hal_displayio_display_construct( @@ -198,25 +195,19 @@ void board_init(void) { sizeof(display_init_sequence), NULL, // There is no backlight pin, defined for now. NO_BRIGHTNESS_COMMAND, - 1.0f, // brightness (ignored) - true, // auto_brightness + 1.0f, // brightness false, // single_byte_bounds false, // data_as_commands true, // auto_refresh 60, // native_frames_per_second false, // backlight_on_high - false // SH1107_addressing + false, // SH1107_addressing + 50000 // backlight pwm frequency ); } -bool board_requests_safe_mode(void) { - return false; -} - -void reset_board(void) { - -} - void board_deinit(void) { common_hal_displayio_release_displays(); } + +// Use the MP_WEAK supervisor/shared/board.c versions of routines not defined here. diff --git a/ports/espressif/boards/morpheans_morphesp-240/mpconfigboard.mk b/ports/espressif/boards/morpheans_morphesp-240/mpconfigboard.mk index 567f2ddea1..abd2fc12e9 100644 --- a/ports/espressif/boards/morpheans_morphesp-240/mpconfigboard.mk +++ b/ports/espressif/boards/morpheans_morphesp-240/mpconfigboard.mk @@ -5,15 +5,7 @@ USB_MANUFACTURER = "MORPHEANS" IDF_TARGET = esp32s2 -INTERNAL_FLASH_FILESYSTEM = 1 -LONGINT_IMPL = MPZ - -# The default queue depth of 16 overflows on release builds, -# so increase it to 32. -CFLAGS += -DCFG_TUD_TASK_QUEUE_SZ=32 - CIRCUITPY_ESP_FLASH_MODE = dio CIRCUITPY_ESP_FLASH_FREQ = 40m CIRCUITPY_ESP_FLASH_SIZE = 4MB - -CIRCUITPY_MODULE = wroom +CIRCUITPY_ESP32_CAMERA = 0 diff --git a/ports/espressif/boards/muselab_nanoesp32_s2_wroom/board.c b/ports/espressif/boards/muselab_nanoesp32_s2_wroom/board.c index 0432485111..b3c8cb4191 100644 --- a/ports/espressif/boards/muselab_nanoesp32_s2_wroom/board.c +++ b/ports/espressif/boards/muselab_nanoesp32_s2_wroom/board.c @@ -36,13 +36,4 @@ void board_init(void) { #endif /* DEBUG */ } -bool board_requests_safe_mode(void) { - return false; -} - -void reset_board(void) { - -} - -void board_deinit(void) { -} +// Use the MP_WEAK supervisor/shared/board.c versions of routines not defined here. diff --git a/ports/espressif/boards/muselab_nanoesp32_s2_wroom/mpconfigboard.mk b/ports/espressif/boards/muselab_nanoesp32_s2_wroom/mpconfigboard.mk index 7385906921..f2a622bc08 100644 --- a/ports/espressif/boards/muselab_nanoesp32_s2_wroom/mpconfigboard.mk +++ b/ports/espressif/boards/muselab_nanoesp32_s2_wroom/mpconfigboard.mk @@ -5,15 +5,7 @@ USB_MANUFACTURER = "Muselab" IDF_TARGET = esp32s2 -INTERNAL_FLASH_FILESYSTEM = 1 -LONGINT_IMPL = MPZ - -# The default queue depth of 16 overflows on release builds, -# so increase it to 32. -CFLAGS += -DCFG_TUD_TASK_QUEUE_SZ=32 - -CIRCUITPY_ESP_FLASH_MODE=dio -CIRCUITPY_ESP_FLASH_FREQ=40m -CIRCUITPY_ESP_FLASH_SIZE=4MB - -CIRCUITPY_MODULE=wroom +CIRCUITPY_ESP_FLASH_MODE = dio +CIRCUITPY_ESP_FLASH_FREQ = 40m +CIRCUITPY_ESP_FLASH_SIZE = 4MB +CIRCUITPY_ESP32_CAMERA = 0 diff --git a/ports/espressif/boards/muselab_nanoesp32_s2_wrover/board.c b/ports/espressif/boards/muselab_nanoesp32_s2_wrover/board.c index 0432485111..b3c8cb4191 100644 --- a/ports/espressif/boards/muselab_nanoesp32_s2_wrover/board.c +++ b/ports/espressif/boards/muselab_nanoesp32_s2_wrover/board.c @@ -36,13 +36,4 @@ void board_init(void) { #endif /* DEBUG */ } -bool board_requests_safe_mode(void) { - return false; -} - -void reset_board(void) { - -} - -void board_deinit(void) { -} +// Use the MP_WEAK supervisor/shared/board.c versions of routines not defined here. diff --git a/ports/espressif/boards/muselab_nanoesp32_s2_wrover/mpconfigboard.mk b/ports/espressif/boards/muselab_nanoesp32_s2_wrover/mpconfigboard.mk index 6060a5c581..f008241e19 100644 --- a/ports/espressif/boards/muselab_nanoesp32_s2_wrover/mpconfigboard.mk +++ b/ports/espressif/boards/muselab_nanoesp32_s2_wrover/mpconfigboard.mk @@ -5,15 +5,6 @@ USB_MANUFACTURER = "Muselab" IDF_TARGET = esp32s2 -INTERNAL_FLASH_FILESYSTEM = 1 -LONGINT_IMPL = MPZ - -# The default queue depth of 16 overflows on release builds, -# so increase it to 32. -CFLAGS += -DCFG_TUD_TASK_QUEUE_SZ=32 - -CIRCUITPY_ESP_FLASH_MODE=dio -CIRCUITPY_ESP_FLASH_FREQ=40m -CIRCUITPY_ESP_FLASH_SIZE=4MB - -CIRCUITPY_MODULE=wrover +CIRCUITPY_ESP_FLASH_MODE = dio +CIRCUITPY_ESP_FLASH_FREQ = 40m +CIRCUITPY_ESP_FLASH_SIZE = 4MB diff --git a/ports/espressif/boards/odt_pixelwing_esp32_s2/board.c b/ports/espressif/boards/odt_pixelwing_esp32_s2/board.c index 6772768da5..164430c88c 100644 --- a/ports/espressif/boards/odt_pixelwing_esp32_s2/board.c +++ b/ports/espressif/boards/odt_pixelwing_esp32_s2/board.c @@ -25,19 +25,5 @@ */ #include "supervisor/board.h" -#include "mpconfigboard.h" -#include "shared-bindings/microcontroller/Pin.h" -void board_init(void) { -} - -bool board_requests_safe_mode(void) { - return false; -} - -void reset_board(void) { - -} - -void board_deinit(void) { -} +// Use the MP_WEAK supervisor/shared/board.c versions of routines not defined here. diff --git a/ports/espressif/boards/odt_pixelwing_esp32_s2/mpconfigboard.h b/ports/espressif/boards/odt_pixelwing_esp32_s2/mpconfigboard.h index 9d7a480228..5d6ad95e1b 100644 --- a/ports/espressif/boards/odt_pixelwing_esp32_s2/mpconfigboard.h +++ b/ports/espressif/boards/odt_pixelwing_esp32_s2/mpconfigboard.h @@ -31,5 +31,7 @@ #define MICROPY_HW_NEOPIXEL (&pin_GPIO45) +#define MICROPY_HW_LED_STATUS (&pin_GPIO21) + #define DEFAULT_I2C_BUS_SCL (&pin_GPIO34) #define DEFAULT_I2C_BUS_SDA (&pin_GPIO33) diff --git a/ports/espressif/boards/odt_pixelwing_esp32_s2/mpconfigboard.mk b/ports/espressif/boards/odt_pixelwing_esp32_s2/mpconfigboard.mk index f4c0be83dc..44546fc09f 100644 --- a/ports/espressif/boards/odt_pixelwing_esp32_s2/mpconfigboard.mk +++ b/ports/espressif/boards/odt_pixelwing_esp32_s2/mpconfigboard.mk @@ -5,15 +5,6 @@ USB_MANUFACTURER = "Oak Dev Tech" IDF_TARGET = esp32s2 -INTERNAL_FLASH_FILESYSTEM = 1 -LONGINT_IMPL = MPZ - -# The default queue depth of 16 overflows on release builds, -# so increase it to 32. -CFLAGS += -DCFG_TUD_TASK_QUEUE_SZ=32 - -CIRCUITPY_ESP_FLASH_MODE=dio -CIRCUITPY_ESP_FLASH_FREQ=40m -CIRCUITPY_ESP_FLASH_SIZE=4MB - -CIRCUITPY_MODULE=wrover +CIRCUITPY_ESP_FLASH_MODE = dio +CIRCUITPY_ESP_FLASH_FREQ = 40m +CIRCUITPY_ESP_FLASH_SIZE = 4MB diff --git a/ports/espressif/boards/seeed_xiao_esp32c3/board.c b/ports/espressif/boards/seeed_xiao_esp32c3/board.c new file mode 100644 index 0000000000..7bcdcdba25 --- /dev/null +++ b/ports/espressif/boards/seeed_xiao_esp32c3/board.c @@ -0,0 +1,40 @@ +/* + * This file is part of the MicroPython project, http://micropython.org/ + * + * The MIT License (MIT) + * + * Copyright (c) 2020 Scott Shawcroft for Adafruit Industries + * + * Permission is hereby granted, free of charge, to any person obtaining a copy + * of this software and associated documentation files (the "Software"), to deal + * in the Software without restriction, including without limitation the rights + * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell + * copies of the Software, and to permit persons to whom the Software is + * furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice shall be included in + * all copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE + * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER + * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, + * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN + * THE SOFTWARE. + */ + +#include "shared-bindings/microcontroller/Pin.h" +#include "supervisor/board.h" + +#include "components/driver/include/driver/gpio.h" + +void board_init(void) { + // Debug UART + #ifdef DEBUG + common_hal_never_reset_pin(&pin_GPIO20); + common_hal_never_reset_pin(&pin_GPIO21); + #endif +} + +// Use the MP_WEAK supervisor/shared/board.c versions of routines not defined here. diff --git a/ports/espressif/boards/seeed_xiao_esp32c3/mpconfigboard.h b/ports/espressif/boards/seeed_xiao_esp32c3/mpconfigboard.h new file mode 100644 index 0000000000..638be9d197 --- /dev/null +++ b/ports/espressif/boards/seeed_xiao_esp32c3/mpconfigboard.h @@ -0,0 +1,14 @@ +#define MICROPY_HW_BOARD_NAME "Seeed Studio XIAO ESP32C3" +#define MICROPY_HW_MCU_NAME "ESP32-C3FN4" + +#define DEFAULT_I2C_BUS_SCL (&pin_GPIO7) +#define DEFAULT_I2C_BUS_SDA (&pin_GPIO6) + +#define DEFAULT_SPI_BUS_SCK (&pin_GPIO8) +#define DEFAULT_SPI_BUS_MOSI (&pin_GPIO10) +#define DEFAULT_SPI_BUS_MISO (&pin_GPIO9) + +#define DEFAULT_UART_BUS_RX (&pin_GPIO20) +#define DEFAULT_UART_BUS_TX (&pin_GPIO21) + +#define CIRCUITPY_ESP_USB_SERIAL_JTAG (1) diff --git a/ports/espressif/boards/seeed_xiao_esp32c3/mpconfigboard.mk b/ports/espressif/boards/seeed_xiao_esp32c3/mpconfigboard.mk new file mode 100644 index 0000000000..68722982ab --- /dev/null +++ b/ports/espressif/boards/seeed_xiao_esp32c3/mpconfigboard.mk @@ -0,0 +1,8 @@ +CIRCUITPY_CREATOR_ID = 0x000C2886 +CIRCUITPY_CREATION_ID = 0x00C30001 + +IDF_TARGET = esp32c3 + +CIRCUITPY_ESP_FLASH_MODE = qio +CIRCUITPY_ESP_FLASH_FREQ = 80m +CIRCUITPY_ESP_FLASH_SIZE = 4MB diff --git a/ports/espressif/boards/seeed_xiao_esp32c3/pins.c b/ports/espressif/boards/seeed_xiao_esp32c3/pins.c new file mode 100644 index 0000000000..5fc475d564 --- /dev/null +++ b/ports/espressif/boards/seeed_xiao_esp32c3/pins.c @@ -0,0 +1,43 @@ +#include "shared-bindings/board/__init__.h" + +STATIC const mp_rom_map_elem_t board_module_globals_table[] = { + CIRCUITPYTHON_BOARD_DICT_STANDARD_ITEMS + + { MP_ROM_QSTR(MP_QSTR_D0), MP_ROM_PTR(&pin_GPIO2) }, + { MP_ROM_QSTR(MP_QSTR_A0), MP_ROM_PTR(&pin_GPIO2) }, + + { MP_ROM_QSTR(MP_QSTR_D1), MP_ROM_PTR(&pin_GPIO3) }, + { MP_ROM_QSTR(MP_QSTR_A1), MP_ROM_PTR(&pin_GPIO3) }, + + { MP_ROM_QSTR(MP_QSTR_D2), MP_ROM_PTR(&pin_GPIO4) }, + { MP_ROM_QSTR(MP_QSTR_A2), MP_ROM_PTR(&pin_GPIO4) }, + + { MP_ROM_QSTR(MP_QSTR_D3), MP_ROM_PTR(&pin_GPIO5) }, + { MP_ROM_QSTR(MP_QSTR_A3), MP_ROM_PTR(&pin_GPIO5) }, + + { MP_ROM_QSTR(MP_QSTR_D4), MP_ROM_PTR(&pin_GPIO6) }, + { MP_ROM_QSTR(MP_QSTR_SDA), MP_ROM_PTR(&pin_GPIO6) }, + + { MP_ROM_QSTR(MP_QSTR_D5), MP_ROM_PTR(&pin_GPIO7) }, + { MP_ROM_QSTR(MP_QSTR_SCL), MP_ROM_PTR(&pin_GPIO7) }, + + { MP_ROM_QSTR(MP_QSTR_D6), MP_ROM_PTR(&pin_GPIO21) }, + { MP_ROM_QSTR(MP_QSTR_TX), MP_ROM_PTR(&pin_GPIO21) }, + + { MP_ROM_QSTR(MP_QSTR_D7), MP_ROM_PTR(&pin_GPIO20) }, + { MP_ROM_QSTR(MP_QSTR_RX), MP_ROM_PTR(&pin_GPIO20) }, + + { MP_ROM_QSTR(MP_QSTR_D8), MP_ROM_PTR(&pin_GPIO8) }, + { MP_ROM_QSTR(MP_QSTR_SCK), MP_ROM_PTR(&pin_GPIO8) }, + + { MP_ROM_QSTR(MP_QSTR_D9), MP_ROM_PTR(&pin_GPIO9) }, + { MP_ROM_QSTR(MP_QSTR_MISO), MP_ROM_PTR(&pin_GPIO9) }, + + { MP_ROM_QSTR(MP_QSTR_D10), MP_ROM_PTR(&pin_GPIO10) }, + { MP_ROM_QSTR(MP_QSTR_MOSI), MP_ROM_PTR(&pin_GPIO10) }, + + { 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) }, +}; +MP_DEFINE_CONST_DICT(board_module_globals, board_module_globals_table); diff --git a/ports/espressif/boards/seeed_xiao_esp32c3/sdkconfig b/ports/espressif/boards/seeed_xiao_esp32c3/sdkconfig new file mode 100644 index 0000000000..b2c9bc0fe6 --- /dev/null +++ b/ports/espressif/boards/seeed_xiao_esp32c3/sdkconfig @@ -0,0 +1,5 @@ +# +# LWIP +# +CONFIG_LWIP_LOCAL_HOSTNAME="seeed-xiao-esp32c3" +# end of LWIP diff --git a/ports/espressif/boards/smartbeedesigns_bee_motion_s3/board.c b/ports/espressif/boards/smartbeedesigns_bee_motion_s3/board.c new file mode 100644 index 0000000000..b3c8cb4191 --- /dev/null +++ b/ports/espressif/boards/smartbeedesigns_bee_motion_s3/board.c @@ -0,0 +1,39 @@ +/* + * This file is part of the MicroPython project, http://micropython.org/ + * + * The MIT License (MIT) + * + * Copyright (c) 2020 Scott Shawcroft for Adafruit Industries + * + * Permission is hereby granted, free of charge, to any person obtaining a copy + * of this software and associated documentation files (the "Software"), to deal + * in the Software without restriction, including without limitation the rights + * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell + * copies of the Software, and to permit persons to whom the Software is + * furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice shall be included in + * all copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE + * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER + * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, + * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN + * THE SOFTWARE. + */ + +#include "supervisor/board.h" +#include "mpconfigboard.h" +#include "shared-bindings/microcontroller/Pin.h" + +void board_init(void) { + // Debug UART + #ifdef DEBUG + common_hal_never_reset_pin(&pin_GPIO43); + common_hal_never_reset_pin(&pin_GPIO44); + #endif /* DEBUG */ +} + +// Use the MP_WEAK supervisor/shared/board.c versions of routines not defined here. diff --git a/ports/espressif/boards/smartbeedesigns_bee_motion_s3/mpconfigboard.h b/ports/espressif/boards/smartbeedesigns_bee_motion_s3/mpconfigboard.h new file mode 100644 index 0000000000..11e2449e9b --- /dev/null +++ b/ports/espressif/boards/smartbeedesigns_bee_motion_s3/mpconfigboard.h @@ -0,0 +1,41 @@ +/* + * This file is part of the MicroPython project, http://micropython.org/ + * + * The MIT License (MIT) + * + * Copyright (c) 2019 Scott Shawcroft for Adafruit Industries + * + * Permission is hereby granted, free of charge, to any person obtaining a copy + * of this software and associated documentation files (the "Software"), to deal + * in the Software without restriction, including without limitation the rights + * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell + * copies of the Software, and to permit persons to whom the Software is + * furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice shall be included in + * all copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE + * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER + * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, + * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN + * THE SOFTWARE. + */ + +// Micropython setup + +#define MICROPY_HW_BOARD_NAME "Bee-Motion-S3" +#define MICROPY_HW_MCU_NAME "ESP32S3" + +#define MICROPY_HW_NEOPIXEL (&pin_GPIO48) +#define DEFAULT_UART_BUS_RX (&pin_GPIO44) +#define DEFAULT_UART_BUS_TX (&pin_GPIO43) + +#define DEFAULT_I2C_BUS_SCL (&pin_GPIO36) +#define DEFAULT_I2C_BUS_SDA (&pin_GPIO37) + +#define DEFAULT_SPI_BUS_SCK (&pin_GPIO17) +#define DEFAULT_SPI_BUS_MOSI (&pin_GPIO15) +#define DEFAULT_SPI_BUS_MISO (&pin_GPIO16) diff --git a/ports/espressif/boards/smartbeedesigns_bee_motion_s3/mpconfigboard.mk b/ports/espressif/boards/smartbeedesigns_bee_motion_s3/mpconfigboard.mk new file mode 100644 index 0000000000..8a5fab0c1a --- /dev/null +++ b/ports/espressif/boards/smartbeedesigns_bee_motion_s3/mpconfigboard.mk @@ -0,0 +1,14 @@ +USB_VID = 0x303A +USB_PID = 0x8114 +USB_PRODUCT = "Bee-Motion-S3" +USB_MANUFACTURER = "Smart Bee Designs" + +IDF_TARGET = esp32s3 + +CIRCUITPY_ESP_FLASH_MODE = dio +CIRCUITPY_ESP_FLASH_FREQ = 80m +CIRCUITPY_ESP_FLASH_SIZE = 8MB + + +FROZEN_MPY_DIRS += $(TOP)/frozen/Adafruit_CircuitPython_NeoPixel +CIRCUITPY_ESP32_CAMERA = 0 diff --git a/ports/espressif/boards/smartbeedesigns_bee_motion_s3/pins.c b/ports/espressif/boards/smartbeedesigns_bee_motion_s3/pins.c new file mode 100644 index 0000000000..7696986472 --- /dev/null +++ b/ports/espressif/boards/smartbeedesigns_bee_motion_s3/pins.c @@ -0,0 +1,102 @@ +#include "shared-bindings/board/__init__.h" + +STATIC const mp_rom_map_elem_t board_module_globals_table[] = { + CIRCUITPYTHON_BOARD_DICT_STANDARD_ITEMS + + + { MP_ROM_QSTR(MP_QSTR_IO5), MP_ROM_PTR(&pin_GPIO5) }, + { MP_ROM_QSTR(MP_QSTR_A5), MP_ROM_PTR(&pin_GPIO5) }, + { MP_ROM_QSTR(MP_QSTR_D5), MP_ROM_PTR(&pin_GPIO5) }, + + { MP_ROM_QSTR(MP_QSTR_IO6), MP_ROM_PTR(&pin_GPIO6) }, + { MP_ROM_QSTR(MP_QSTR_A6), MP_ROM_PTR(&pin_GPIO6) }, + { MP_ROM_QSTR(MP_QSTR_D6), MP_ROM_PTR(&pin_GPIO6) }, + + { MP_ROM_QSTR(MP_QSTR_IO7), MP_ROM_PTR(&pin_GPIO7) }, + { MP_ROM_QSTR(MP_QSTR_A7), MP_ROM_PTR(&pin_GPIO7) }, + { MP_ROM_QSTR(MP_QSTR_D7), MP_ROM_PTR(&pin_GPIO7) }, + + { MP_ROM_QSTR(MP_QSTR_IO8), MP_ROM_PTR(&pin_GPIO8) }, + { MP_ROM_QSTR(MP_QSTR_A8), MP_ROM_PTR(&pin_GPIO8) }, + { MP_ROM_QSTR(MP_QSTR_D8), MP_ROM_PTR(&pin_GPIO8) }, + + { MP_ROM_QSTR(MP_QSTR_IO9), MP_ROM_PTR(&pin_GPIO9) }, + { MP_ROM_QSTR(MP_QSTR_A9), MP_ROM_PTR(&pin_GPIO9) }, + { MP_ROM_QSTR(MP_QSTR_D9), MP_ROM_PTR(&pin_GPIO9) }, + + { MP_ROM_QSTR(MP_QSTR_IO10), MP_ROM_PTR(&pin_GPIO10) }, + { MP_ROM_QSTR(MP_QSTR_A10), MP_ROM_PTR(&pin_GPIO10) }, + { MP_ROM_QSTR(MP_QSTR_D10), MP_ROM_PTR(&pin_GPIO10) }, + + { MP_ROM_QSTR(MP_QSTR_IO11), MP_ROM_PTR(&pin_GPIO11) }, + { MP_ROM_QSTR(MP_QSTR_A11), MP_ROM_PTR(&pin_GPIO11) }, + { MP_ROM_QSTR(MP_QSTR_D11), MP_ROM_PTR(&pin_GPIO11) }, + + { MP_ROM_QSTR(MP_QSTR_IO12), MP_ROM_PTR(&pin_GPIO12) }, + { MP_ROM_QSTR(MP_QSTR_A12), MP_ROM_PTR(&pin_GPIO12) }, + { MP_ROM_QSTR(MP_QSTR_D12), MP_ROM_PTR(&pin_GPIO12) }, + + { MP_ROM_QSTR(MP_QSTR_IO12), MP_ROM_PTR(&pin_GPIO12) }, + { MP_ROM_QSTR(MP_QSTR_A12), MP_ROM_PTR(&pin_GPIO12) }, + { MP_ROM_QSTR(MP_QSTR_D12), MP_ROM_PTR(&pin_GPIO12) }, + + { MP_ROM_QSTR(MP_QSTR_IO13), MP_ROM_PTR(&pin_GPIO13) }, + { MP_ROM_QSTR(MP_QSTR_A13), MP_ROM_PTR(&pin_GPIO13) }, + { MP_ROM_QSTR(MP_QSTR_D13), MP_ROM_PTR(&pin_GPIO13) }, + + { MP_ROM_QSTR(MP_QSTR_IO14), MP_ROM_PTR(&pin_GPIO14) }, + { MP_ROM_QSTR(MP_QSTR_A14), MP_ROM_PTR(&pin_GPIO14) }, + { MP_ROM_QSTR(MP_QSTR_D14), MP_ROM_PTR(&pin_GPIO14) }, + + { MP_ROM_QSTR(MP_QSTR_IO15), MP_ROM_PTR(&pin_GPIO15) }, + { MP_ROM_QSTR(MP_QSTR_A15), MP_ROM_PTR(&pin_GPIO15) }, + { MP_ROM_QSTR(MP_QSTR_D15), MP_ROM_PTR(&pin_GPIO15) }, + + { MP_ROM_QSTR(MP_QSTR_IO16), MP_ROM_PTR(&pin_GPIO16) }, + { MP_ROM_QSTR(MP_QSTR_D16), MP_ROM_PTR(&pin_GPIO16) }, + + { MP_ROM_QSTR(MP_QSTR_IO17), MP_ROM_PTR(&pin_GPIO17) }, + { MP_ROM_QSTR(MP_QSTR_D17), MP_ROM_PTR(&pin_GPIO17) }, + + + { MP_ROM_QSTR(MP_QSTR_IO35), MP_ROM_PTR(&pin_GPIO35) }, + { MP_ROM_QSTR(MP_QSTR_MOSI), MP_ROM_PTR(&pin_GPIO35) }, + { MP_ROM_QSTR(MP_QSTR_D35), MP_ROM_PTR(&pin_GPIO35) }, + + { MP_ROM_QSTR(MP_QSTR_IO36), MP_ROM_PTR(&pin_GPIO36) }, + { MP_ROM_QSTR(MP_QSTR_SCL), MP_ROM_PTR(&pin_GPIO36) }, + { MP_ROM_QSTR(MP_QSTR_D36), MP_ROM_PTR(&pin_GPIO36) }, + + { MP_ROM_QSTR(MP_QSTR_IO37), MP_ROM_PTR(&pin_GPIO37) }, + { MP_ROM_QSTR(MP_QSTR_SDA), MP_ROM_PTR(&pin_GPIO37) }, + { MP_ROM_QSTR(MP_QSTR_D37), MP_ROM_PTR(&pin_GPIO37) }, + + { MP_ROM_QSTR(MP_QSTR_IO48), MP_ROM_PTR(&pin_GPIO48) }, + { MP_ROM_QSTR(MP_QSTR_NEOPIXEL), MP_ROM_PTR(&pin_GPIO40) }, + { MP_ROM_QSTR(MP_QSTR_NEOPIXEL_POWER), MP_ROM_PTR(&pin_GPIO34) }, + + { MP_ROM_QSTR(MP_QSTR_TX), MP_ROM_PTR(&pin_GPIO43) }, + { MP_ROM_QSTR(MP_QSTR_D43), MP_ROM_PTR(&pin_GPIO43) }, + { MP_ROM_QSTR(MP_QSTR_IO43), MP_ROM_PTR(&pin_GPIO43) }, + + { MP_ROM_QSTR(MP_QSTR_RX), MP_ROM_PTR(&pin_GPIO44) }, + { MP_ROM_QSTR(MP_QSTR_IO44), MP_ROM_PTR(&pin_GPIO44)}, + { MP_ROM_QSTR(MP_QSTR_D44), MP_ROM_PTR(&pin_GPIO44) }, + + { MP_ROM_QSTR(MP_QSTR_BOOT_BTN), MP_ROM_PTR(&pin_GPIO0) }, + { MP_ROM_QSTR(MP_QSTR_BATTERY), MP_ROM_PTR(&pin_GPIO1) }, + { MP_ROM_QSTR(MP_QSTR_VBAT), MP_ROM_PTR(&pin_GPIO1) }, + { MP_ROM_QSTR(MP_QSTR_VBAT_SENSE), MP_ROM_PTR(&pin_GPIO1) }, + { MP_ROM_QSTR(MP_QSTR_VOLTAGE_MONITOR), MP_ROM_PTR(&pin_GPIO1) }, + { MP_ROM_QSTR(MP_QSTR_VBUS_SENSE), MP_ROM_PTR(&pin_GPIO2) }, + { MP_ROM_QSTR(MP_QSTR_LIGHT), MP_ROM_PTR(&pin_GPIO3) }, + { MP_ROM_QSTR(MP_QSTR_LIGHT_SENSOR), MP_ROM_PTR(&pin_GPIO3) }, + { MP_ROM_QSTR(MP_QSTR_PIR), MP_ROM_PTR(&pin_GPIO4) }, + { MP_ROM_QSTR(MP_QSTR_PIR_SENSOR), MP_ROM_PTR(&pin_GPIO4) }, + { MP_ROM_QSTR(MP_QSTR_LDO2), MP_ROM_PTR(&pin_GPIO34) }, + + + { MP_ROM_QSTR(MP_QSTR_I2C), MP_ROM_PTR(&board_i2c_obj) }, + { MP_ROM_QSTR(MP_QSTR_UART), MP_ROM_PTR(&board_uart_obj) }, +}; +MP_DEFINE_CONST_DICT(board_module_globals, board_module_globals_table); diff --git a/ports/espressif/boards/smartbeedesigns_bee_motion_s3/sdkconfig b/ports/espressif/boards/smartbeedesigns_bee_motion_s3/sdkconfig new file mode 100644 index 0000000000..84cf45aa83 --- /dev/null +++ b/ports/espressif/boards/smartbeedesigns_bee_motion_s3/sdkconfig @@ -0,0 +1,6 @@ +# CONFIG_ESP32S3_SPIRAM_SUPPORT is not set +# +# LWIP +# +CONFIG_LWIP_LOCAL_HOSTNAME="smartbeedesigns_bee_motion_s3" +# end of LWIP diff --git a/ports/espressif/boards/smartbeedesigns_bee_s3/board.c b/ports/espressif/boards/smartbeedesigns_bee_s3/board.c new file mode 100644 index 0000000000..b3c8cb4191 --- /dev/null +++ b/ports/espressif/boards/smartbeedesigns_bee_s3/board.c @@ -0,0 +1,39 @@ +/* + * This file is part of the MicroPython project, http://micropython.org/ + * + * The MIT License (MIT) + * + * Copyright (c) 2020 Scott Shawcroft for Adafruit Industries + * + * Permission is hereby granted, free of charge, to any person obtaining a copy + * of this software and associated documentation files (the "Software"), to deal + * in the Software without restriction, including without limitation the rights + * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell + * copies of the Software, and to permit persons to whom the Software is + * furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice shall be included in + * all copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE + * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER + * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, + * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN + * THE SOFTWARE. + */ + +#include "supervisor/board.h" +#include "mpconfigboard.h" +#include "shared-bindings/microcontroller/Pin.h" + +void board_init(void) { + // Debug UART + #ifdef DEBUG + common_hal_never_reset_pin(&pin_GPIO43); + common_hal_never_reset_pin(&pin_GPIO44); + #endif /* DEBUG */ +} + +// Use the MP_WEAK supervisor/shared/board.c versions of routines not defined here. diff --git a/ports/espressif/boards/smartbeedesigns_bee_s3/mpconfigboard.h b/ports/espressif/boards/smartbeedesigns_bee_s3/mpconfigboard.h new file mode 100644 index 0000000000..1a17770fb7 --- /dev/null +++ b/ports/espressif/boards/smartbeedesigns_bee_s3/mpconfigboard.h @@ -0,0 +1,41 @@ +/* + * This file is part of the MicroPython project, http://micropython.org/ + * + * The MIT License (MIT) + * + * Copyright (c) 2019 Scott Shawcroft for Adafruit Industries + * + * Permission is hereby granted, free of charge, to any person obtaining a copy + * of this software and associated documentation files (the "Software"), to deal + * in the Software without restriction, including without limitation the rights + * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell + * copies of the Software, and to permit persons to whom the Software is + * furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice shall be included in + * all copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE + * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER + * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, + * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN + * THE SOFTWARE. + */ + +// Micropython setup + +#define MICROPY_HW_BOARD_NAME "Bee-S3" +#define MICROPY_HW_MCU_NAME "ESP32S3" + +#define MICROPY_HW_NEOPIXEL (&pin_GPIO48) +#define DEFAULT_UART_BUS_RX (&pin_GPIO44) +#define DEFAULT_UART_BUS_TX (&pin_GPIO43) + +#define DEFAULT_I2C_BUS_SCL (&pin_GPIO36) +#define DEFAULT_I2C_BUS_SDA (&pin_GPIO37) + +#define DEFAULT_SPI_BUS_SCK (&pin_GPIO39) +#define DEFAULT_SPI_BUS_MOSI (&pin_GPIO35) +#define DEFAULT_SPI_BUS_MISO (&pin_GPIO38) diff --git a/ports/espressif/boards/smartbeedesigns_bee_s3/mpconfigboard.mk b/ports/espressif/boards/smartbeedesigns_bee_s3/mpconfigboard.mk new file mode 100644 index 0000000000..25a1db15ec --- /dev/null +++ b/ports/espressif/boards/smartbeedesigns_bee_s3/mpconfigboard.mk @@ -0,0 +1,14 @@ +USB_VID = 0x303A +USB_PID = 0x8111 +USB_PRODUCT = "Bee-S3" +USB_MANUFACTURER = "Smart Bee Designs" + +IDF_TARGET = esp32s3 + +CIRCUITPY_ESP_FLASH_MODE = dio +CIRCUITPY_ESP_FLASH_FREQ = 80m +CIRCUITPY_ESP_FLASH_SIZE = 8MB + + +FROZEN_MPY_DIRS += $(TOP)/frozen/Adafruit_CircuitPython_NeoPixel +CIRCUITPY_ESP32_CAMERA = 0 diff --git a/ports/espressif/boards/smartbeedesigns_bee_s3/pins.c b/ports/espressif/boards/smartbeedesigns_bee_s3/pins.c new file mode 100644 index 0000000000..189899fa49 --- /dev/null +++ b/ports/espressif/boards/smartbeedesigns_bee_s3/pins.c @@ -0,0 +1,79 @@ +#include "shared-bindings/board/__init__.h" + +STATIC const mp_rom_map_elem_t board_module_globals_table[] = { + CIRCUITPYTHON_BOARD_DICT_STANDARD_ITEMS + + { MP_ROM_QSTR(MP_QSTR_IO3), MP_ROM_PTR(&pin_GPIO3) }, + { MP_ROM_QSTR(MP_QSTR_A3), MP_ROM_PTR(&pin_GPIO3) }, + { MP_ROM_QSTR(MP_QSTR_D3), MP_ROM_PTR(&pin_GPIO3) }, + + { MP_ROM_QSTR(MP_QSTR_IO4), MP_ROM_PTR(&pin_GPIO4) }, + { MP_ROM_QSTR(MP_QSTR_A4), MP_ROM_PTR(&pin_GPIO4) }, + { MP_ROM_QSTR(MP_QSTR_D4), MP_ROM_PTR(&pin_GPIO4) }, + + { MP_ROM_QSTR(MP_QSTR_IO5), MP_ROM_PTR(&pin_GPIO5) }, + { MP_ROM_QSTR(MP_QSTR_A5), MP_ROM_PTR(&pin_GPIO5) }, + { MP_ROM_QSTR(MP_QSTR_D5), MP_ROM_PTR(&pin_GPIO5) }, + + { MP_ROM_QSTR(MP_QSTR_IO6), MP_ROM_PTR(&pin_GPIO6) }, + { MP_ROM_QSTR(MP_QSTR_A6), MP_ROM_PTR(&pin_GPIO6) }, + { MP_ROM_QSTR(MP_QSTR_D6), MP_ROM_PTR(&pin_GPIO6) }, + + { MP_ROM_QSTR(MP_QSTR_IO7), MP_ROM_PTR(&pin_GPIO7) }, + { MP_ROM_QSTR(MP_QSTR_A7), MP_ROM_PTR(&pin_GPIO7) }, + { MP_ROM_QSTR(MP_QSTR_D7), MP_ROM_PTR(&pin_GPIO7) }, + + { MP_ROM_QSTR(MP_QSTR_IO8), MP_ROM_PTR(&pin_GPIO8) }, + { MP_ROM_QSTR(MP_QSTR_A8), MP_ROM_PTR(&pin_GPIO8) }, + { MP_ROM_QSTR(MP_QSTR_D8), MP_ROM_PTR(&pin_GPIO8) }, + + { MP_ROM_QSTR(MP_QSTR_IO9), MP_ROM_PTR(&pin_GPIO9) }, + { MP_ROM_QSTR(MP_QSTR_A9), MP_ROM_PTR(&pin_GPIO9) }, + { MP_ROM_QSTR(MP_QSTR_D9), MP_ROM_PTR(&pin_GPIO9) }, + + { MP_ROM_QSTR(MP_QSTR_IO10), MP_ROM_PTR(&pin_GPIO10) }, + { MP_ROM_QSTR(MP_QSTR_A10), MP_ROM_PTR(&pin_GPIO10) }, + { MP_ROM_QSTR(MP_QSTR_D10), MP_ROM_PTR(&pin_GPIO10) }, + + { MP_ROM_QSTR(MP_QSTR_IO35), MP_ROM_PTR(&pin_GPIO35) }, + { MP_ROM_QSTR(MP_QSTR_MOSI), MP_ROM_PTR(&pin_GPIO35) }, + { MP_ROM_QSTR(MP_QSTR_D35), MP_ROM_PTR(&pin_GPIO35) }, + + { MP_ROM_QSTR(MP_QSTR_IO36), MP_ROM_PTR(&pin_GPIO36) }, + { MP_ROM_QSTR(MP_QSTR_SCL), MP_ROM_PTR(&pin_GPIO36) }, + { MP_ROM_QSTR(MP_QSTR_D36), MP_ROM_PTR(&pin_GPIO36) }, + + { MP_ROM_QSTR(MP_QSTR_IO37), MP_ROM_PTR(&pin_GPIO37) }, + { MP_ROM_QSTR(MP_QSTR_SDA), MP_ROM_PTR(&pin_GPIO37) }, + { MP_ROM_QSTR(MP_QSTR_D37), MP_ROM_PTR(&pin_GPIO37) }, + + { MP_ROM_QSTR(MP_QSTR_IO38), MP_ROM_PTR(&pin_GPIO38) }, + { MP_ROM_QSTR(MP_QSTR_D38), MP_ROM_PTR(&pin_GPIO38) }, + { MP_ROM_QSTR(MP_QSTR_MISO), MP_ROM_PTR(&pin_GPIO38) }, + + { MP_ROM_QSTR(MP_QSTR_IO39), MP_ROM_PTR(&pin_GPIO39) }, + { MP_ROM_QSTR(MP_QSTR_D39), MP_ROM_PTR(&pin_GPIO39) }, + { MP_ROM_QSTR(MP_QSTR_SCK), MP_ROM_PTR(&pin_GPIO39) }, + + { MP_ROM_QSTR(MP_QSTR_IO48), MP_ROM_PTR(&pin_GPIO48) }, + { MP_ROM_QSTR(MP_QSTR_NEOPIXEL), MP_ROM_PTR(&pin_GPIO48) }, + + { MP_ROM_QSTR(MP_QSTR_TX), MP_ROM_PTR(&pin_GPIO43) }, + { MP_ROM_QSTR(MP_QSTR_D43), MP_ROM_PTR(&pin_GPIO43) }, + { MP_ROM_QSTR(MP_QSTR_IO43), MP_ROM_PTR(&pin_GPIO43) }, + + { MP_ROM_QSTR(MP_QSTR_RX), MP_ROM_PTR(&pin_GPIO44) }, + { MP_ROM_QSTR(MP_QSTR_IO44), MP_ROM_PTR(&pin_GPIO44)}, + { MP_ROM_QSTR(MP_QSTR_D44), MP_ROM_PTR(&pin_GPIO44) }, + + { MP_ROM_QSTR(MP_QSTR_BATTERY), MP_ROM_PTR(&pin_GPIO1) }, + { MP_ROM_QSTR(MP_QSTR_VBAT), MP_ROM_PTR(&pin_GPIO1) }, + { MP_ROM_QSTR(MP_QSTR_VBAT_SENSE), MP_ROM_PTR(&pin_GPIO1) }, + { MP_ROM_QSTR(MP_QSTR_VOLTAGE_MONITOR), MP_ROM_PTR(&pin_GPIO1) }, + + { MP_ROM_QSTR(MP_QSTR_NEOPIXEL_POWER), MP_ROM_PTR(&pin_GPIO34) }, + + { MP_ROM_QSTR(MP_QSTR_I2C), MP_ROM_PTR(&board_i2c_obj) }, + { MP_ROM_QSTR(MP_QSTR_UART), MP_ROM_PTR(&board_uart_obj) }, +}; +MP_DEFINE_CONST_DICT(board_module_globals, board_module_globals_table); diff --git a/ports/espressif/boards/smartbeedesigns_bee_s3/sdkconfig b/ports/espressif/boards/smartbeedesigns_bee_s3/sdkconfig new file mode 100644 index 0000000000..b7bb11fdd5 --- /dev/null +++ b/ports/espressif/boards/smartbeedesigns_bee_s3/sdkconfig @@ -0,0 +1,6 @@ +# CONFIG_ESP32S3_SPIRAM_SUPPORT is not set +# +# LWIP +# +CONFIG_LWIP_LOCAL_HOSTNAME="smartbeedesigns_bee_s3" +# end of LWIP diff --git a/ports/espressif/boards/targett_module_clip_wroom/board.c b/ports/espressif/boards/targett_module_clip_wroom/board.c index 66aea4bdd5..ce5a770920 100644 --- a/ports/espressif/boards/targett_module_clip_wroom/board.c +++ b/ports/espressif/boards/targett_module_clip_wroom/board.c @@ -40,13 +40,4 @@ void board_init(void) { common_hal_never_reset_pin(&pin_GPIO16); } -bool board_requests_safe_mode(void) { - return false; -} - -void reset_board(void) { - -} - -void board_deinit(void) { -} +// Use the MP_WEAK supervisor/shared/board.c versions of routines not defined here. diff --git a/ports/espressif/boards/targett_module_clip_wroom/mpconfigboard.mk b/ports/espressif/boards/targett_module_clip_wroom/mpconfigboard.mk index a64f49c144..3163320208 100644 --- a/ports/espressif/boards/targett_module_clip_wroom/mpconfigboard.mk +++ b/ports/espressif/boards/targett_module_clip_wroom/mpconfigboard.mk @@ -5,15 +5,7 @@ USB_MANUFACTURER = "Targett" IDF_TARGET = esp32s2 -INTERNAL_FLASH_FILESYSTEM = 1 -LONGINT_IMPL = MPZ - -# The default queue depth of 16 overflows on release builds, -# so increase it to 32. -CFLAGS += -DCFG_TUD_TASK_QUEUE_SZ=32 - -CIRCUITPY_ESP_FLASH_MODE=dio -CIRCUITPY_ESP_FLASH_FREQ=40m -CIRCUITPY_ESP_FLASH_SIZE=4MB - -CIRCUITPY_MODULE=wroom +CIRCUITPY_ESP_FLASH_MODE = dio +CIRCUITPY_ESP_FLASH_FREQ = 40m +CIRCUITPY_ESP_FLASH_SIZE = 4MB +CIRCUITPY_ESP32_CAMERA = 0 diff --git a/ports/espressif/boards/targett_module_clip_wrover/board.c b/ports/espressif/boards/targett_module_clip_wrover/board.c index 66aea4bdd5..ce5a770920 100644 --- a/ports/espressif/boards/targett_module_clip_wrover/board.c +++ b/ports/espressif/boards/targett_module_clip_wrover/board.c @@ -40,13 +40,4 @@ void board_init(void) { common_hal_never_reset_pin(&pin_GPIO16); } -bool board_requests_safe_mode(void) { - return false; -} - -void reset_board(void) { - -} - -void board_deinit(void) { -} +// Use the MP_WEAK supervisor/shared/board.c versions of routines not defined here. diff --git a/ports/espressif/boards/targett_module_clip_wrover/mpconfigboard.mk b/ports/espressif/boards/targett_module_clip_wrover/mpconfigboard.mk index 6683acac15..6ef620ac50 100644 --- a/ports/espressif/boards/targett_module_clip_wrover/mpconfigboard.mk +++ b/ports/espressif/boards/targett_module_clip_wrover/mpconfigboard.mk @@ -5,15 +5,6 @@ USB_MANUFACTURER = "Targett" IDF_TARGET = esp32s2 -INTERNAL_FLASH_FILESYSTEM = 1 -LONGINT_IMPL = MPZ - -# The default queue depth of 16 overflows on release builds, -# so increase it to 32. -CFLAGS += -DCFG_TUD_TASK_QUEUE_SZ=32 - -CIRCUITPY_ESP_FLASH_MODE=dio -CIRCUITPY_ESP_FLASH_FREQ=40m -CIRCUITPY_ESP_FLASH_SIZE=4MB - -CIRCUITPY_MODULE=wrover +CIRCUITPY_ESP_FLASH_MODE = dio +CIRCUITPY_ESP_FLASH_FREQ = 40m +CIRCUITPY_ESP_FLASH_SIZE = 4MB diff --git a/ports/espressif/boards/unexpectedmaker_feathers2/board.c b/ports/espressif/boards/unexpectedmaker_feathers2/board.c index 0432485111..b3c8cb4191 100644 --- a/ports/espressif/boards/unexpectedmaker_feathers2/board.c +++ b/ports/espressif/boards/unexpectedmaker_feathers2/board.c @@ -36,13 +36,4 @@ void board_init(void) { #endif /* DEBUG */ } -bool board_requests_safe_mode(void) { - return false; -} - -void reset_board(void) { - -} - -void board_deinit(void) { -} +// Use the MP_WEAK supervisor/shared/board.c versions of routines not defined here. diff --git a/ports/espressif/boards/unexpectedmaker_feathers2/mpconfigboard.h b/ports/espressif/boards/unexpectedmaker_feathers2/mpconfigboard.h index d10ab94223..ebea0f447b 100644 --- a/ports/espressif/boards/unexpectedmaker_feathers2/mpconfigboard.h +++ b/ports/espressif/boards/unexpectedmaker_feathers2/mpconfigboard.h @@ -32,6 +32,8 @@ // #define MICROPY_HW_APA102_MOSI (&pin_GPIO40) // #define MICROPY_HW_APA102_SCK (&pin_GPIO45) +#define MICROPY_HW_LED_STATUS (&pin_GPIO13) + #define DEFAULT_I2C_BUS_SCL (&pin_GPIO9) #define DEFAULT_I2C_BUS_SDA (&pin_GPIO8) diff --git a/ports/espressif/boards/unexpectedmaker_feathers2/mpconfigboard.mk b/ports/espressif/boards/unexpectedmaker_feathers2/mpconfigboard.mk index 84c9787733..1d48ea1076 100644 --- a/ports/espressif/boards/unexpectedmaker_feathers2/mpconfigboard.mk +++ b/ports/espressif/boards/unexpectedmaker_feathers2/mpconfigboard.mk @@ -5,16 +5,9 @@ USB_MANUFACTURER = "UnexpectedMaker" IDF_TARGET = esp32s2 -INTERNAL_FLASH_FILESYSTEM = 1 -LONGINT_IMPL = MPZ - -# The default queue depth of 16 overflows on release builds, -# so increase it to 32. -CFLAGS += -DCFG_TUD_TASK_QUEUE_SZ=32 - -CIRCUITPY_ESP_FLASH_MODE=qio -CIRCUITPY_ESP_FLASH_FREQ=40m -CIRCUITPY_ESP_FLASH_SIZE=16MB +CIRCUITPY_ESP_FLASH_MODE = qio +CIRCUITPY_ESP_FLASH_FREQ = 40m +CIRCUITPY_ESP_FLASH_SIZE = 16MB CIRCUITPY_BITBANG_APA102 = 1 diff --git a/ports/espressif/boards/unexpectedmaker_feathers2_neo/board.c b/ports/espressif/boards/unexpectedmaker_feathers2_neo/board.c index 0432485111..b3c8cb4191 100644 --- a/ports/espressif/boards/unexpectedmaker_feathers2_neo/board.c +++ b/ports/espressif/boards/unexpectedmaker_feathers2_neo/board.c @@ -36,13 +36,4 @@ void board_init(void) { #endif /* DEBUG */ } -bool board_requests_safe_mode(void) { - return false; -} - -void reset_board(void) { - -} - -void board_deinit(void) { -} +// Use the MP_WEAK supervisor/shared/board.c versions of routines not defined here. diff --git a/ports/espressif/boards/unexpectedmaker_feathers2_neo/mpconfigboard.h b/ports/espressif/boards/unexpectedmaker_feathers2_neo/mpconfigboard.h index af61a67fbb..aeaf23d248 100644 --- a/ports/espressif/boards/unexpectedmaker_feathers2_neo/mpconfigboard.h +++ b/ports/espressif/boards/unexpectedmaker_feathers2_neo/mpconfigboard.h @@ -32,6 +32,8 @@ #define MICROPY_HW_NEOPIXEL (&pin_GPIO40) #define CIRCUITPY_STATUS_LED_POWER (&pin_GPIO39) +#define MICROPY_HW_LED_STATUS (&pin_GPIO13) + #define DEFAULT_I2C_BUS_SCL (&pin_GPIO9) #define DEFAULT_I2C_BUS_SDA (&pin_GPIO8) diff --git a/ports/espressif/boards/unexpectedmaker_feathers2_neo/mpconfigboard.mk b/ports/espressif/boards/unexpectedmaker_feathers2_neo/mpconfigboard.mk index cef7355051..2b78e51635 100644 --- a/ports/espressif/boards/unexpectedmaker_feathers2_neo/mpconfigboard.mk +++ b/ports/espressif/boards/unexpectedmaker_feathers2_neo/mpconfigboard.mk @@ -5,16 +5,9 @@ USB_MANUFACTURER = "UnexpectedMaker" IDF_TARGET = esp32s2 -INTERNAL_FLASH_FILESYSTEM = 1 -LONGINT_IMPL = MPZ - -# The default queue depth of 16 overflows on release builds, -# so increase it to 32. -CFLAGS += -DCFG_TUD_TASK_QUEUE_SZ=32 - -CIRCUITPY_ESP_FLASH_MODE=qio -CIRCUITPY_ESP_FLASH_FREQ=80m -CIRCUITPY_ESP_FLASH_SIZE=4MB +CIRCUITPY_ESP_FLASH_MODE = qio +CIRCUITPY_ESP_FLASH_FREQ = 80m +CIRCUITPY_ESP_FLASH_SIZE = 4MB CIRCUITPY_BITBANG_NEOPIXEL = 1 diff --git a/ports/espressif/boards/unexpectedmaker_feathers2_prerelease/board.c b/ports/espressif/boards/unexpectedmaker_feathers2_prerelease/board.c index 0432485111..b3c8cb4191 100644 --- a/ports/espressif/boards/unexpectedmaker_feathers2_prerelease/board.c +++ b/ports/espressif/boards/unexpectedmaker_feathers2_prerelease/board.c @@ -36,13 +36,4 @@ void board_init(void) { #endif /* DEBUG */ } -bool board_requests_safe_mode(void) { - return false; -} - -void reset_board(void) { - -} - -void board_deinit(void) { -} +// Use the MP_WEAK supervisor/shared/board.c versions of routines not defined here. diff --git a/ports/espressif/boards/unexpectedmaker_feathers2_prerelease/mpconfigboard.h b/ports/espressif/boards/unexpectedmaker_feathers2_prerelease/mpconfigboard.h index a2fadd85ea..1b11b37d66 100644 --- a/ports/espressif/boards/unexpectedmaker_feathers2_prerelease/mpconfigboard.h +++ b/ports/espressif/boards/unexpectedmaker_feathers2_prerelease/mpconfigboard.h @@ -32,6 +32,8 @@ // #define MICROPY_HW_APA102_MOSI (&pin_GPIO40) // #define MICROPY_HW_APA102_SCK (&pin_GPIO45) +#define MICROPY_HW_LED_STATUS (&pin_GPIO13) + #define DEFAULT_I2C_BUS_SCL (&pin_GPIO38) #define DEFAULT_I2C_BUS_SDA (&pin_GPIO33) diff --git a/ports/espressif/boards/unexpectedmaker_feathers2_prerelease/mpconfigboard.mk b/ports/espressif/boards/unexpectedmaker_feathers2_prerelease/mpconfigboard.mk index 84c9787733..1d48ea1076 100644 --- a/ports/espressif/boards/unexpectedmaker_feathers2_prerelease/mpconfigboard.mk +++ b/ports/espressif/boards/unexpectedmaker_feathers2_prerelease/mpconfigboard.mk @@ -5,16 +5,9 @@ USB_MANUFACTURER = "UnexpectedMaker" IDF_TARGET = esp32s2 -INTERNAL_FLASH_FILESYSTEM = 1 -LONGINT_IMPL = MPZ - -# The default queue depth of 16 overflows on release builds, -# so increase it to 32. -CFLAGS += -DCFG_TUD_TASK_QUEUE_SZ=32 - -CIRCUITPY_ESP_FLASH_MODE=qio -CIRCUITPY_ESP_FLASH_FREQ=40m -CIRCUITPY_ESP_FLASH_SIZE=16MB +CIRCUITPY_ESP_FLASH_MODE = qio +CIRCUITPY_ESP_FLASH_FREQ = 40m +CIRCUITPY_ESP_FLASH_SIZE = 16MB CIRCUITPY_BITBANG_APA102 = 1 diff --git a/ports/espressif/boards/unexpectedmaker_feathers3/board.c b/ports/espressif/boards/unexpectedmaker_feathers3/board.c index 0432485111..b3c8cb4191 100644 --- a/ports/espressif/boards/unexpectedmaker_feathers3/board.c +++ b/ports/espressif/boards/unexpectedmaker_feathers3/board.c @@ -36,13 +36,4 @@ void board_init(void) { #endif /* DEBUG */ } -bool board_requests_safe_mode(void) { - return false; -} - -void reset_board(void) { - -} - -void board_deinit(void) { -} +// Use the MP_WEAK supervisor/shared/board.c versions of routines not defined here. diff --git a/ports/espressif/boards/unexpectedmaker_feathers3/mpconfigboard.h b/ports/espressif/boards/unexpectedmaker_feathers3/mpconfigboard.h index a341cf0464..67054b8664 100644 --- a/ports/espressif/boards/unexpectedmaker_feathers3/mpconfigboard.h +++ b/ports/espressif/boards/unexpectedmaker_feathers3/mpconfigboard.h @@ -32,6 +32,8 @@ #define MICROPY_HW_NEOPIXEL (&pin_GPIO40) #define CIRCUITPY_STATUS_LED_POWER (&pin_GPIO39) +#define MICROPY_HW_LED_STATUS (&pin_GPIO13) + #define DEFAULT_I2C_BUS_SCL (&pin_GPIO9) #define DEFAULT_I2C_BUS_SDA (&pin_GPIO8) diff --git a/ports/espressif/boards/unexpectedmaker_feathers3/mpconfigboard.mk b/ports/espressif/boards/unexpectedmaker_feathers3/mpconfigboard.mk index 866bd15ffa..666185b6fd 100644 --- a/ports/espressif/boards/unexpectedmaker_feathers3/mpconfigboard.mk +++ b/ports/espressif/boards/unexpectedmaker_feathers3/mpconfigboard.mk @@ -5,16 +5,9 @@ USB_MANUFACTURER = "UnexpectedMaker" IDF_TARGET = esp32s3 -INTERNAL_FLASH_FILESYSTEM = 1 -LONGINT_IMPL = MPZ - -# The default queue depth of 16 overflows on release builds, -# so increase it to 32. -CFLAGS += -DCFG_TUD_TASK_QUEUE_SZ=32 - -CIRCUITPY_ESP_FLASH_MODE=dio -CIRCUITPY_ESP_FLASH_FREQ=80m -CIRCUITPY_ESP_FLASH_SIZE=16MB +CIRCUITPY_ESP_FLASH_MODE = dio +CIRCUITPY_ESP_FLASH_FREQ = 80m +CIRCUITPY_ESP_FLASH_SIZE = 16MB #CIRCUITPY_BITBANG_NEOPIXEL = 1 diff --git a/ports/espressif/boards/unexpectedmaker_feathers3/pins.c b/ports/espressif/boards/unexpectedmaker_feathers3/pins.c index 43fdc3c579..9a2fde5a0c 100644 --- a/ports/espressif/boards/unexpectedmaker_feathers3/pins.c +++ b/ports/espressif/boards/unexpectedmaker_feathers3/pins.c @@ -110,7 +110,7 @@ STATIC const mp_rom_map_elem_t board_module_globals_table[] = { { MP_ROM_QSTR(MP_QSTR_AMB), MP_ROM_PTR(&pin_GPIO4) }, // Ambient Light Sensor { MP_ROM_QSTR(MP_QSTR_LDO2), MP_ROM_PTR(&pin_GPIO39) }, // Second LDO Enable control - { MP_ROM_QSTR(MP_QSTR_I39), MP_ROM_PTR(&pin_GPIO39) }, // Second LDO Enable control + { MP_ROM_QSTR(MP_QSTR_IO39), MP_ROM_PTR(&pin_GPIO39) }, // Second LDO Enable control { MP_ROM_QSTR(MP_QSTR_I2C), MP_ROM_PTR(&board_i2c_obj) }, { MP_ROM_QSTR(MP_QSTR_STEMMA_I2C), MP_ROM_PTR(&board_i2c_obj) }, diff --git a/ports/espressif/boards/unexpectedmaker_pros3/board.c b/ports/espressif/boards/unexpectedmaker_pros3/board.c index 0432485111..8fd94f6c8b 100644 --- a/ports/espressif/boards/unexpectedmaker_pros3/board.c +++ b/ports/espressif/boards/unexpectedmaker_pros3/board.c @@ -35,14 +35,3 @@ void board_init(void) { common_hal_never_reset_pin(&pin_GPIO44); #endif /* DEBUG */ } - -bool board_requests_safe_mode(void) { - return false; -} - -void reset_board(void) { - -} - -void board_deinit(void) { -} diff --git a/ports/espressif/boards/unexpectedmaker_pros3/mpconfigboard.mk b/ports/espressif/boards/unexpectedmaker_pros3/mpconfigboard.mk index 3b50324d3c..bf6e7a5105 100644 --- a/ports/espressif/boards/unexpectedmaker_pros3/mpconfigboard.mk +++ b/ports/espressif/boards/unexpectedmaker_pros3/mpconfigboard.mk @@ -5,16 +5,9 @@ USB_MANUFACTURER = "UnexpectedMaker" IDF_TARGET = esp32s3 -INTERNAL_FLASH_FILESYSTEM = 1 -LONGINT_IMPL = MPZ - -# The default queue depth of 16 overflows on release builds, -# so increase it to 32. -CFLAGS += -DCFG_TUD_TASK_QUEUE_SZ=32 - -CIRCUITPY_ESP_FLASH_MODE=qio -CIRCUITPY_ESP_FLASH_FREQ=80m -CIRCUITPY_ESP_FLASH_SIZE=16MB +CIRCUITPY_ESP_FLASH_MODE = qio +CIRCUITPY_ESP_FLASH_FREQ = 80m +CIRCUITPY_ESP_FLASH_SIZE = 16MB # CIRCUITPY_BITBANG_NEOPIXEL = 1 diff --git a/ports/espressif/boards/unexpectedmaker_pros3/pins.c b/ports/espressif/boards/unexpectedmaker_pros3/pins.c index bc0ca026f3..8c7e050ded 100644 --- a/ports/espressif/boards/unexpectedmaker_pros3/pins.c +++ b/ports/espressif/boards/unexpectedmaker_pros3/pins.c @@ -130,7 +130,7 @@ STATIC const mp_rom_map_elem_t board_module_globals_table[] = { { MP_ROM_QSTR(MP_QSTR_NEOPIXEL), MP_ROM_PTR(&pin_GPIO18) }, { MP_ROM_QSTR(MP_QSTR_LDO2), MP_ROM_PTR(&pin_GPIO17) }, // Second LDO Enable control - { MP_ROM_QSTR(MP_QSTR_I17), MP_ROM_PTR(&pin_GPIO17) }, // Second LDO Enable control + { MP_ROM_QSTR(MP_QSTR_IO17), MP_ROM_PTR(&pin_GPIO17) }, // Second LDO Enable control { MP_ROM_QSTR(MP_QSTR_I2C), MP_ROM_PTR(&board_i2c_obj) }, { MP_ROM_QSTR(MP_QSTR_STEMMA_I2C), MP_ROM_PTR(&board_i2c_obj) }, diff --git a/ports/espressif/boards/unexpectedmaker_tinypico/board.c b/ports/espressif/boards/unexpectedmaker_tinypico/board.c new file mode 100644 index 0000000000..e59af9528d --- /dev/null +++ b/ports/espressif/boards/unexpectedmaker_tinypico/board.c @@ -0,0 +1,52 @@ +/* + * This file is part of the MicroPython project, http://micropython.org/ + * + * The MIT License (MIT) + * + * Copyright (c) 2020 Scott Shawcroft for Adafruit Industries + * + * Permission is hereby granted, free of charge, to any person obtaining a copy + * of this software and associated documentation files (the "Software"), to deal + * in the Software without restriction, including without limitation the rights + * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell + * copies of the Software, and to permit persons to whom the Software is + * furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice shall be included in + * all copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE + * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER + * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, + * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN + * THE SOFTWARE. + */ + +#include "supervisor/board.h" +#include "mpconfigboard.h" +#include "shared-bindings/microcontroller/Pin.h" +#include "components/driver/include/driver/gpio.h" +#include "components/hal/include/hal/gpio_hal.h" +#include "common-hal/microcontroller/Pin.h" + +void board_init(void) { + reset_board(); +} + +bool board_requests_safe_mode(void) { + return false; +} + +void reset_board(void) { + // Turn on APA102 power by default + gpio_set_direction(13, GPIO_MODE_DEF_OUTPUT); + gpio_set_level(13, true); +} + +void board_deinit(void) { + // Turn off APA102 power + gpio_set_direction(13, GPIO_MODE_DEF_OUTPUT); + gpio_set_level(13, false); +} diff --git a/ports/espressif/boards/unexpectedmaker_tinypico/mpconfigboard.h b/ports/espressif/boards/unexpectedmaker_tinypico/mpconfigboard.h new file mode 100644 index 0000000000..a12ccb0c18 --- /dev/null +++ b/ports/espressif/boards/unexpectedmaker_tinypico/mpconfigboard.h @@ -0,0 +1,43 @@ +/* + * This file is part of the MicroPython project, http://micropython.org/ + * + * The MIT License (MIT) + * + * Copyright (c) 2022 Dan Halbert 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. + */ + +#define MICROPY_HW_BOARD_NAME "TinyPICO" +#define MICROPY_HW_MCU_NAME "ESP32-PICO-D4" + +#define CIRCUITPY_BOARD_I2C (1) +#define CIRCUITPY_BOARD_I2C_PIN {{.scl = &pin_GPIO22, .sda = &pin_GPIO21}} + +#define CIRCUITPY_BOARD_SPI (1) +#define CIRCUITPY_BOARD_SPI_PIN {{.clock = &pin_GPIO18, .mosi = &pin_GPIO23, .miso = &pin_GPIO19}} + +// #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") + +// UART pins attached to the USB-serial converter chip +#define CIRCUITPY_CONSOLE_UART_TX (&pin_GPIO1) +#define CIRCUITPY_CONSOLE_UART_RX (&pin_GPIO3) diff --git a/ports/espressif/boards/unexpectedmaker_tinypico/mpconfigboard.mk b/ports/espressif/boards/unexpectedmaker_tinypico/mpconfigboard.mk new file mode 100644 index 0000000000..e26981465b --- /dev/null +++ b/ports/espressif/boards/unexpectedmaker_tinypico/mpconfigboard.mk @@ -0,0 +1,8 @@ +CIRCUITPY_CREATOR_ID = 0xB0B00000 +CIRCUITPY_CREATION_ID = 0x00000001 + +IDF_TARGET = esp32 + +CIRCUITPY_ESP_FLASH_MODE = dio +CIRCUITPY_ESP_FLASH_FREQ = 80m +CIRCUITPY_ESP_FLASH_SIZE = 4MB diff --git a/ports/espressif/boards/unexpectedmaker_tinypico/pins.c b/ports/espressif/boards/unexpectedmaker_tinypico/pins.c new file mode 100644 index 0000000000..b4843960ae --- /dev/null +++ b/ports/espressif/boards/unexpectedmaker_tinypico/pins.c @@ -0,0 +1,84 @@ +#include "shared-bindings/board/__init__.h" + +STATIC const mp_rom_map_elem_t board_module_globals_table[] = { + CIRCUITPYTHON_BOARD_DICT_STANDARD_ITEMS + + { MP_ROM_QSTR(MP_QSTR_IO4), MP_ROM_PTR(&pin_GPIO4) }, + { MP_ROM_QSTR(MP_QSTR_D4), MP_ROM_PTR(&pin_GPIO4) }, + { MP_ROM_QSTR(MP_QSTR_A4), MP_ROM_PTR(&pin_GPIO4) }, + + { MP_ROM_QSTR(MP_QSTR_IO14), MP_ROM_PTR(&pin_GPIO14) }, + { MP_ROM_QSTR(MP_QSTR_D14), MP_ROM_PTR(&pin_GPIO14) }, + { MP_ROM_QSTR(MP_QSTR_A14), MP_ROM_PTR(&pin_GPIO14) }, + + { MP_ROM_QSTR(MP_QSTR_IO15), MP_ROM_PTR(&pin_GPIO15) }, + { MP_ROM_QSTR(MP_QSTR_D15), MP_ROM_PTR(&pin_GPIO15) }, + { MP_ROM_QSTR(MP_QSTR_A15), MP_ROM_PTR(&pin_GPIO15) }, + + { MP_ROM_QSTR(MP_QSTR_IO27), MP_ROM_PTR(&pin_GPIO27) }, + { MP_ROM_QSTR(MP_QSTR_D27), MP_ROM_PTR(&pin_GPIO27) }, + { MP_ROM_QSTR(MP_QSTR_A27), MP_ROM_PTR(&pin_GPIO27) }, + + { MP_ROM_QSTR(MP_QSTR_IO26), MP_ROM_PTR(&pin_GPIO26) }, + { MP_ROM_QSTR(MP_QSTR_D26), MP_ROM_PTR(&pin_GPIO26) }, + { MP_ROM_QSTR(MP_QSTR_A26), MP_ROM_PTR(&pin_GPIO26) }, + { MP_ROM_QSTR(MP_QSTR_DAC2), MP_ROM_PTR(&pin_GPIO26) }, + + { MP_ROM_QSTR(MP_QSTR_IO25), MP_ROM_PTR(&pin_GPIO25) }, + { MP_ROM_QSTR(MP_QSTR_D25), MP_ROM_PTR(&pin_GPIO25) }, + { MP_ROM_QSTR(MP_QSTR_A25), MP_ROM_PTR(&pin_GPIO25) }, + { MP_ROM_QSTR(MP_QSTR_DAC1), MP_ROM_PTR(&pin_GPIO25) }, + + { MP_ROM_QSTR(MP_QSTR_IO23), MP_ROM_PTR(&pin_GPIO23) }, + { MP_ROM_QSTR(MP_QSTR_MOSI), MP_ROM_PTR(&pin_GPIO23) }, + { MP_ROM_QSTR(MP_QSTR_SDO), MP_ROM_PTR(&pin_GPIO23) }, + { MP_ROM_QSTR(MP_QSTR_D23), MP_ROM_PTR(&pin_GPIO23) }, + + { MP_ROM_QSTR(MP_QSTR_IO19), MP_ROM_PTR(&pin_GPIO19) }, + { MP_ROM_QSTR(MP_QSTR_MISO), MP_ROM_PTR(&pin_GPIO19) }, + { MP_ROM_QSTR(MP_QSTR_SDI), MP_ROM_PTR(&pin_GPIO19) }, + { MP_ROM_QSTR(MP_QSTR_D19), MP_ROM_PTR(&pin_GPIO19) }, + + { MP_ROM_QSTR(MP_QSTR_IO18), MP_ROM_PTR(&pin_GPIO18) }, + { MP_ROM_QSTR(MP_QSTR_SCK), MP_ROM_PTR(&pin_GPIO18) }, + { MP_ROM_QSTR(MP_QSTR_D18), MP_ROM_PTR(&pin_GPIO18) }, + + { MP_ROM_QSTR(MP_QSTR_IO5), MP_ROM_PTR(&pin_GPIO5) }, + { MP_ROM_QSTR(MP_QSTR_D5), MP_ROM_PTR(&pin_GPIO5) }, + { MP_ROM_QSTR(MP_QSTR_A5), MP_ROM_PTR(&pin_GPIO5) }, + + { MP_ROM_QSTR(MP_QSTR_SCL), MP_ROM_PTR(&pin_GPIO22) }, + { MP_ROM_QSTR(MP_QSTR_IO22), MP_ROM_PTR(&pin_GPIO22) }, + { MP_ROM_QSTR(MP_QSTR_D22), MP_ROM_PTR(&pin_GPIO22) }, + + { MP_ROM_QSTR(MP_QSTR_SDA), MP_ROM_PTR(&pin_GPIO21) }, + { MP_ROM_QSTR(MP_QSTR_IO21), MP_ROM_PTR(&pin_GPIO21) }, + { MP_ROM_QSTR(MP_QSTR_D21), MP_ROM_PTR(&pin_GPIO21) }, + + { MP_ROM_QSTR(MP_QSTR_IO32), MP_ROM_PTR(&pin_GPIO32) }, + { MP_ROM_QSTR(MP_QSTR_D32), MP_ROM_PTR(&pin_GPIO32) }, + { MP_ROM_QSTR(MP_QSTR_A32), MP_ROM_PTR(&pin_GPIO32) }, + + { MP_ROM_QSTR(MP_QSTR_IO33), MP_ROM_PTR(&pin_GPIO33) }, + { MP_ROM_QSTR(MP_QSTR_D33), MP_ROM_PTR(&pin_GPIO33) }, + { MP_ROM_QSTR(MP_QSTR_A33), MP_ROM_PTR(&pin_GPIO33) }, + + // Battery voltage sense pin + { MP_ROM_QSTR(MP_QSTR_BATTERY), MP_ROM_PTR(&pin_GPIO35) }, + { MP_ROM_QSTR(MP_QSTR_VBAT), MP_ROM_PTR(&pin_GPIO35) }, + { MP_ROM_QSTR(MP_QSTR_VBAT_SENSE), MP_ROM_PTR(&pin_GPIO35) }, + { MP_ROM_QSTR(MP_QSTR_VOLTAGE_MONITOR), MP_ROM_PTR(&pin_GPIO35) }, + + // 5V present sense pin + { MP_ROM_QSTR(MP_QSTR_VBUS), MP_ROM_PTR(&pin_GPIO9) }, + { MP_ROM_QSTR(MP_QSTR_VBUS_SENSE), MP_ROM_PTR(&pin_GPIO9) }, + + { MP_ROM_QSTR(MP_QSTR_APA102_MOSI), MP_ROM_PTR(&pin_GPIO2) }, // APA102 + { MP_ROM_QSTR(MP_QSTR_APA102_SCK), MP_ROM_PTR(&pin_GPIO12) }, // APA102 + { MP_ROM_QSTR(MP_QSTR_APA102_PWR), MP_ROM_PTR(&pin_GPIO13) }, // APA102 + + { 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) }, +}; +MP_DEFINE_CONST_DICT(board_module_globals, board_module_globals_table); diff --git a/ports/espressif/boards/unexpectedmaker_tinypico/sdkconfig b/ports/espressif/boards/unexpectedmaker_tinypico/sdkconfig new file mode 100644 index 0000000000..2d4d0d4ecc --- /dev/null +++ b/ports/espressif/boards/unexpectedmaker_tinypico/sdkconfig @@ -0,0 +1,20 @@ +# +# SPI RAM config +# +# CONFIG_SPIRAM_TYPE_AUTO is not set +# CONFIG_SPIRAM_TYPE_ESPPSRAM16=y +# CONFIG_SPIRAM_TYPE_ESPPSRAM32 is not set +CONFIG_SPIRAM_TYPE_ESPPSRAM64=y +# CONFIG_SPIRAM_SIZE is not set +CONFIG_ESP32_SPIRAM_SUPPORT=y +CONFIG_SPIRAM_SPEED_80M=y +CONFIG_SPIRAM=y +CONFIG_SPIRAM_BOOT_INIT=y +CONFIG_SPIRAM_IGNORE_NOTFOUND=y +CONFIG_SPIRAM_USE_MEMMAP=y +# CONFIG_SPIRAM_USE_CAPS_ALLOC is not set +# CONFIG_SPIRAM_USE_MALLOC is not set +CONFIG_SPIRAM_MEMTEST=y +# CONFIG_SPIRAM_ALLOW_BSS_SEG_EXTERNAL_MEMORY is not set +# CONFIG_SPIRAM_ALLOW_NOINIT_SEG_EXTERNAL_MEMORY is not set +CONFIG_SPIRAM_CACHE_WORKAROUND=y diff --git a/ports/espressif/boards/unexpectedmaker_tinypico_nano/board.c b/ports/espressif/boards/unexpectedmaker_tinypico_nano/board.c new file mode 100644 index 0000000000..d66ab9e5f1 --- /dev/null +++ b/ports/espressif/boards/unexpectedmaker_tinypico_nano/board.c @@ -0,0 +1,46 @@ +/* + * This file is part of the MicroPython project, http://micropython.org/ + * + * The MIT License (MIT) + * + * Copyright (c) 2020 Scott Shawcroft for Adafruit Industries + * + * Permission is hereby granted, free of charge, to any person obtaining a copy + * of this software and associated documentation files (the "Software"), to deal + * in the Software without restriction, including without limitation the rights + * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell + * copies of the Software, and to permit persons to whom the Software is + * furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice shall be included in + * all copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE + * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER + * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, + * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN + * THE SOFTWARE. + */ + +#include "supervisor/board.h" +#include "mpconfigboard.h" +#include "shared-bindings/microcontroller/Pin.h" +#include "components/driver/include/driver/gpio.h" +#include "components/hal/include/hal/gpio_hal.h" +#include "common-hal/microcontroller/Pin.h" + +void board_init(void) { + reset_board(); +} + +bool board_requests_safe_mode(void) { + return false; +} + +void reset_board(void) { +} + +void board_deinit(void) { +} diff --git a/ports/espressif/boards/unexpectedmaker_tinypico_nano/mpconfigboard.h b/ports/espressif/boards/unexpectedmaker_tinypico_nano/mpconfigboard.h new file mode 100644 index 0000000000..3cc64859ce --- /dev/null +++ b/ports/espressif/boards/unexpectedmaker_tinypico_nano/mpconfigboard.h @@ -0,0 +1,43 @@ +/* + * This file is part of the MicroPython project, http://micropython.org/ + * + * The MIT License (MIT) + * + * Copyright (c) 2022 Dan Halbert 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. + */ + +#define MICROPY_HW_BOARD_NAME "TinyPICO Nano" +#define MICROPY_HW_MCU_NAME "ESP32-PICO-D4" + +#define CIRCUITPY_BOARD_I2C (1) +#define CIRCUITPY_BOARD_I2C_PIN {{.scl = &pin_GPIO22, .sda = &pin_GPIO21}} + +#define CIRCUITPY_BOARD_SPI (1) +#define CIRCUITPY_BOARD_SPI_PIN {{.clock = &pin_GPIO18, .mosi = &pin_GPIO23, .miso = &pin_GPIO19}} + +// #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") + +// UART pins attached to the USB-serial converter chip +#define CIRCUITPY_CONSOLE_UART_TX (&pin_GPIO1) +#define CIRCUITPY_CONSOLE_UART_RX (&pin_GPIO3) diff --git a/ports/espressif/boards/unexpectedmaker_tinypico_nano/mpconfigboard.mk b/ports/espressif/boards/unexpectedmaker_tinypico_nano/mpconfigboard.mk new file mode 100644 index 0000000000..f3d9ea4c92 --- /dev/null +++ b/ports/espressif/boards/unexpectedmaker_tinypico_nano/mpconfigboard.mk @@ -0,0 +1,8 @@ +CIRCUITPY_CREATOR_ID = 0xB0B00000 +CIRCUITPY_CREATION_ID = 0x00000002 + +IDF_TARGET = esp32 + +CIRCUITPY_ESP_FLASH_MODE = dio +CIRCUITPY_ESP_FLASH_FREQ = 80m +CIRCUITPY_ESP_FLASH_SIZE = 4MB diff --git a/ports/espressif/boards/unexpectedmaker_tinypico_nano/pins.c b/ports/espressif/boards/unexpectedmaker_tinypico_nano/pins.c new file mode 100644 index 0000000000..61f65a089b --- /dev/null +++ b/ports/espressif/boards/unexpectedmaker_tinypico_nano/pins.c @@ -0,0 +1,117 @@ +#include "shared-bindings/board/__init__.h" + +STATIC const mp_rom_map_elem_t board_module_globals_table[] = { + CIRCUITPYTHON_BOARD_DICT_STANDARD_ITEMS + + { MP_ROM_QSTR(MP_QSTR_IO0), MP_ROM_PTR(&pin_GPIO0) }, + { MP_ROM_QSTR(MP_QSTR_D0), MP_ROM_PTR(&pin_GPIO0) }, + { MP_ROM_QSTR(MP_QSTR_A0), MP_ROM_PTR(&pin_GPIO0) }, + + { MP_ROM_QSTR(MP_QSTR_TX), MP_ROM_PTR(&pin_GPIO1) }, + + { MP_ROM_QSTR(MP_QSTR_IO2), MP_ROM_PTR(&pin_GPIO2) }, + { MP_ROM_QSTR(MP_QSTR_D2), MP_ROM_PTR(&pin_GPIO2) }, + { MP_ROM_QSTR(MP_QSTR_A2), MP_ROM_PTR(&pin_GPIO2) }, + + { MP_ROM_QSTR(MP_QSTR_RX), MP_ROM_PTR(&pin_GPIO3) }, + + { MP_ROM_QSTR(MP_QSTR_IO4), MP_ROM_PTR(&pin_GPIO4) }, + { MP_ROM_QSTR(MP_QSTR_D4), MP_ROM_PTR(&pin_GPIO4) }, + { MP_ROM_QSTR(MP_QSTR_A4), MP_ROM_PTR(&pin_GPIO4) }, + + { MP_ROM_QSTR(MP_QSTR_IO5), MP_ROM_PTR(&pin_GPIO5) }, + { MP_ROM_QSTR(MP_QSTR_D5), MP_ROM_PTR(&pin_GPIO5) }, + { MP_ROM_QSTR(MP_QSTR_A5), MP_ROM_PTR(&pin_GPIO5) }, + + { MP_ROM_QSTR(MP_QSTR_IO9), MP_ROM_PTR(&pin_GPIO9) }, + { MP_ROM_QSTR(MP_QSTR_D9), MP_ROM_PTR(&pin_GPIO9) }, + + { MP_ROM_QSTR(MP_QSTR_IO12), MP_ROM_PTR(&pin_GPIO12) }, + { MP_ROM_QSTR(MP_QSTR_D12), MP_ROM_PTR(&pin_GPIO12) }, + { MP_ROM_QSTR(MP_QSTR_A12), MP_ROM_PTR(&pin_GPIO12) }, + + { MP_ROM_QSTR(MP_QSTR_IO13), MP_ROM_PTR(&pin_GPIO13) }, + { MP_ROM_QSTR(MP_QSTR_D13), MP_ROM_PTR(&pin_GPIO13) }, + { MP_ROM_QSTR(MP_QSTR_A13), MP_ROM_PTR(&pin_GPIO13) }, + + { MP_ROM_QSTR(MP_QSTR_IO14), MP_ROM_PTR(&pin_GPIO14) }, + { MP_ROM_QSTR(MP_QSTR_D14), MP_ROM_PTR(&pin_GPIO14) }, + { MP_ROM_QSTR(MP_QSTR_A14), MP_ROM_PTR(&pin_GPIO14) }, + + { MP_ROM_QSTR(MP_QSTR_IO15), MP_ROM_PTR(&pin_GPIO15) }, + { MP_ROM_QSTR(MP_QSTR_D15), MP_ROM_PTR(&pin_GPIO15) }, + { MP_ROM_QSTR(MP_QSTR_A15), MP_ROM_PTR(&pin_GPIO15) }, + + { MP_ROM_QSTR(MP_QSTR_IO18), MP_ROM_PTR(&pin_GPIO18) }, + { MP_ROM_QSTR(MP_QSTR_SCK), MP_ROM_PTR(&pin_GPIO18) }, + { MP_ROM_QSTR(MP_QSTR_D18), MP_ROM_PTR(&pin_GPIO18) }, + + { MP_ROM_QSTR(MP_QSTR_IO19), MP_ROM_PTR(&pin_GPIO19) }, + { MP_ROM_QSTR(MP_QSTR_MISO), MP_ROM_PTR(&pin_GPIO19) }, + { MP_ROM_QSTR(MP_QSTR_SDI), MP_ROM_PTR(&pin_GPIO19) }, + { MP_ROM_QSTR(MP_QSTR_D19), MP_ROM_PTR(&pin_GPIO19) }, + + { MP_ROM_QSTR(MP_QSTR_SDA), MP_ROM_PTR(&pin_GPIO21) }, + { MP_ROM_QSTR(MP_QSTR_IO21), MP_ROM_PTR(&pin_GPIO21) }, + { MP_ROM_QSTR(MP_QSTR_D21), MP_ROM_PTR(&pin_GPIO21) }, + + { MP_ROM_QSTR(MP_QSTR_SCL), MP_ROM_PTR(&pin_GPIO22) }, + { MP_ROM_QSTR(MP_QSTR_IO22), MP_ROM_PTR(&pin_GPIO22) }, + { MP_ROM_QSTR(MP_QSTR_D22), MP_ROM_PTR(&pin_GPIO22) }, + + { MP_ROM_QSTR(MP_QSTR_IO23), MP_ROM_PTR(&pin_GPIO23) }, + { MP_ROM_QSTR(MP_QSTR_MOSI), MP_ROM_PTR(&pin_GPIO23) }, + { MP_ROM_QSTR(MP_QSTR_SDO), MP_ROM_PTR(&pin_GPIO23) }, + { MP_ROM_QSTR(MP_QSTR_D23), MP_ROM_PTR(&pin_GPIO23) }, + + { MP_ROM_QSTR(MP_QSTR_IO25), MP_ROM_PTR(&pin_GPIO25) }, + { MP_ROM_QSTR(MP_QSTR_D25), MP_ROM_PTR(&pin_GPIO25) }, + { MP_ROM_QSTR(MP_QSTR_A25), MP_ROM_PTR(&pin_GPIO25) }, + { MP_ROM_QSTR(MP_QSTR_DAC1), MP_ROM_PTR(&pin_GPIO25) }, + + { MP_ROM_QSTR(MP_QSTR_IO26), MP_ROM_PTR(&pin_GPIO26) }, + { MP_ROM_QSTR(MP_QSTR_D26), MP_ROM_PTR(&pin_GPIO26) }, + { MP_ROM_QSTR(MP_QSTR_A26), MP_ROM_PTR(&pin_GPIO26) }, + { MP_ROM_QSTR(MP_QSTR_DAC2), MP_ROM_PTR(&pin_GPIO26) }, + + { MP_ROM_QSTR(MP_QSTR_IO27), MP_ROM_PTR(&pin_GPIO27) }, + { MP_ROM_QSTR(MP_QSTR_D27), MP_ROM_PTR(&pin_GPIO27) }, + { MP_ROM_QSTR(MP_QSTR_A27), MP_ROM_PTR(&pin_GPIO27) }, + + { MP_ROM_QSTR(MP_QSTR_IO32), MP_ROM_PTR(&pin_GPIO32) }, + { MP_ROM_QSTR(MP_QSTR_D32), MP_ROM_PTR(&pin_GPIO32) }, + { MP_ROM_QSTR(MP_QSTR_A32), MP_ROM_PTR(&pin_GPIO32) }, + + { MP_ROM_QSTR(MP_QSTR_IO33), MP_ROM_PTR(&pin_GPIO33) }, + { MP_ROM_QSTR(MP_QSTR_D33), MP_ROM_PTR(&pin_GPIO33) }, + { MP_ROM_QSTR(MP_QSTR_A33), MP_ROM_PTR(&pin_GPIO33) }, + + { MP_ROM_QSTR(MP_QSTR_IO34), MP_ROM_PTR(&pin_GPIO34) }, + { MP_ROM_QSTR(MP_QSTR_D34), MP_ROM_PTR(&pin_GPIO34) }, + { MP_ROM_QSTR(MP_QSTR_A34), MP_ROM_PTR(&pin_GPIO34) }, + + { MP_ROM_QSTR(MP_QSTR_IO35), MP_ROM_PTR(&pin_GPIO35) }, + { MP_ROM_QSTR(MP_QSTR_D35), MP_ROM_PTR(&pin_GPIO35) }, + { MP_ROM_QSTR(MP_QSTR_A35), MP_ROM_PTR(&pin_GPIO35) }, + + { MP_ROM_QSTR(MP_QSTR_IO36), MP_ROM_PTR(&pin_GPIO36) }, + { MP_ROM_QSTR(MP_QSTR_D36), MP_ROM_PTR(&pin_GPIO36) }, + { MP_ROM_QSTR(MP_QSTR_A36), MP_ROM_PTR(&pin_GPIO36) }, + + { MP_ROM_QSTR(MP_QSTR_IO37), MP_ROM_PTR(&pin_GPIO37) }, + { MP_ROM_QSTR(MP_QSTR_D37), MP_ROM_PTR(&pin_GPIO37) }, + { MP_ROM_QSTR(MP_QSTR_A37), MP_ROM_PTR(&pin_GPIO37) }, + + { MP_ROM_QSTR(MP_QSTR_IO38), MP_ROM_PTR(&pin_GPIO38) }, + { MP_ROM_QSTR(MP_QSTR_D38), MP_ROM_PTR(&pin_GPIO38) }, + { MP_ROM_QSTR(MP_QSTR_A38), MP_ROM_PTR(&pin_GPIO38) }, + + { MP_ROM_QSTR(MP_QSTR_IO39), MP_ROM_PTR(&pin_GPIO39) }, + { MP_ROM_QSTR(MP_QSTR_D39), MP_ROM_PTR(&pin_GPIO39) }, + { MP_ROM_QSTR(MP_QSTR_A39), MP_ROM_PTR(&pin_GPIO39) }, + + { 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) }, +}; +MP_DEFINE_CONST_DICT(board_module_globals, board_module_globals_table); diff --git a/ports/espressif/boards/unexpectedmaker_tinypico_nano/sdkconfig b/ports/espressif/boards/unexpectedmaker_tinypico_nano/sdkconfig new file mode 100644 index 0000000000..2d4d0d4ecc --- /dev/null +++ b/ports/espressif/boards/unexpectedmaker_tinypico_nano/sdkconfig @@ -0,0 +1,20 @@ +# +# SPI RAM config +# +# CONFIG_SPIRAM_TYPE_AUTO is not set +# CONFIG_SPIRAM_TYPE_ESPPSRAM16=y +# CONFIG_SPIRAM_TYPE_ESPPSRAM32 is not set +CONFIG_SPIRAM_TYPE_ESPPSRAM64=y +# CONFIG_SPIRAM_SIZE is not set +CONFIG_ESP32_SPIRAM_SUPPORT=y +CONFIG_SPIRAM_SPEED_80M=y +CONFIG_SPIRAM=y +CONFIG_SPIRAM_BOOT_INIT=y +CONFIG_SPIRAM_IGNORE_NOTFOUND=y +CONFIG_SPIRAM_USE_MEMMAP=y +# CONFIG_SPIRAM_USE_CAPS_ALLOC is not set +# CONFIG_SPIRAM_USE_MALLOC is not set +CONFIG_SPIRAM_MEMTEST=y +# CONFIG_SPIRAM_ALLOW_BSS_SEG_EXTERNAL_MEMORY is not set +# CONFIG_SPIRAM_ALLOW_NOINIT_SEG_EXTERNAL_MEMORY is not set +CONFIG_SPIRAM_CACHE_WORKAROUND=y diff --git a/ports/espressif/boards/unexpectedmaker_tinys2/board.c b/ports/espressif/boards/unexpectedmaker_tinys2/board.c index 0432485111..b3c8cb4191 100644 --- a/ports/espressif/boards/unexpectedmaker_tinys2/board.c +++ b/ports/espressif/boards/unexpectedmaker_tinys2/board.c @@ -36,13 +36,4 @@ void board_init(void) { #endif /* DEBUG */ } -bool board_requests_safe_mode(void) { - return false; -} - -void reset_board(void) { - -} - -void board_deinit(void) { -} +// Use the MP_WEAK supervisor/shared/board.c versions of routines not defined here. diff --git a/ports/espressif/boards/unexpectedmaker_tinys2/mpconfigboard.mk b/ports/espressif/boards/unexpectedmaker_tinys2/mpconfigboard.mk index ead608e6b2..39a9c38b36 100644 --- a/ports/espressif/boards/unexpectedmaker_tinys2/mpconfigboard.mk +++ b/ports/espressif/boards/unexpectedmaker_tinys2/mpconfigboard.mk @@ -5,16 +5,9 @@ USB_MANUFACTURER = "UnexpectedMaker" IDF_TARGET = esp32s2 -INTERNAL_FLASH_FILESYSTEM = 1 -LONGINT_IMPL = MPZ - -# The default queue depth of 16 overflows on release builds, -# so increase it to 32. -CFLAGS += -DCFG_TUD_TASK_QUEUE_SZ=32 - -CIRCUITPY_ESP_FLASH_MODE=qio -CIRCUITPY_ESP_FLASH_FREQ=80m -CIRCUITPY_ESP_FLASH_SIZE=4MB +CIRCUITPY_ESP_FLASH_MODE = qio +CIRCUITPY_ESP_FLASH_FREQ = 80m +CIRCUITPY_ESP_FLASH_SIZE = 4MB CIRCUITPY_BITBANG_NEOPIXEL = 1 diff --git a/ports/espressif/boards/unexpectedmaker_tinys3/board.c b/ports/espressif/boards/unexpectedmaker_tinys3/board.c index 0432485111..b3c8cb4191 100644 --- a/ports/espressif/boards/unexpectedmaker_tinys3/board.c +++ b/ports/espressif/boards/unexpectedmaker_tinys3/board.c @@ -36,13 +36,4 @@ void board_init(void) { #endif /* DEBUG */ } -bool board_requests_safe_mode(void) { - return false; -} - -void reset_board(void) { - -} - -void board_deinit(void) { -} +// Use the MP_WEAK supervisor/shared/board.c versions of routines not defined here. diff --git a/ports/espressif/boards/unexpectedmaker_tinys3/mpconfigboard.mk b/ports/espressif/boards/unexpectedmaker_tinys3/mpconfigboard.mk index 32a711c257..716a45b5ca 100644 --- a/ports/espressif/boards/unexpectedmaker_tinys3/mpconfigboard.mk +++ b/ports/espressif/boards/unexpectedmaker_tinys3/mpconfigboard.mk @@ -5,16 +5,9 @@ USB_MANUFACTURER = "UnexpectedMaker" IDF_TARGET = esp32s3 -INTERNAL_FLASH_FILESYSTEM = 1 -LONGINT_IMPL = MPZ - -# The default queue depth of 16 overflows on release builds, -# so increase it to 32. -CFLAGS += -DCFG_TUD_TASK_QUEUE_SZ=32 - -CIRCUITPY_ESP_FLASH_MODE=dio -CIRCUITPY_ESP_FLASH_FREQ=80m -CIRCUITPY_ESP_FLASH_SIZE=8MB +CIRCUITPY_ESP_FLASH_MODE = dio +CIRCUITPY_ESP_FLASH_FREQ = 80m +CIRCUITPY_ESP_FLASH_SIZE = 8MB # CIRCUITPY_BITBANG_NEOPIXEL = 1 diff --git a/ports/espressif/boards/waveshare_esp32_s2_pico_lcd/board.c b/ports/espressif/boards/waveshare_esp32_s2_pico_lcd/board.c new file mode 100644 index 0000000000..070e3418da --- /dev/null +++ b/ports/espressif/boards/waveshare_esp32_s2_pico_lcd/board.c @@ -0,0 +1,139 @@ +/* + * This file is part of the MicroPython project, http://micropython.org/ + * + * The MIT License (MIT) + * + * Copyright (c) 2020 Scott Shawcroft for Adafruit Industries + * + * Permission is hereby granted, free of charge, to any person obtaining a copy + * of this software and associated documentation files (the "Software"), to deal + * in the Software without restriction, including without limitation the rights + * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell + * copies of the Software, and to permit persons to whom the Software is + * furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice shall be included in + * all copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE + * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER + * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, + * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN + * THE SOFTWARE. + */ + +#include "supervisor/board.h" +#include "mpconfigboard.h" +#include "shared-bindings/microcontroller/Pin.h" +#include "shared-module/displayio/__init__.h" +#include "shared-module/displayio/mipi_constants.h" + +#define DELAY 0x80 + + +// display init sequence according to Adafruit_CircuitPython_ST7735R +// https://github.com/adafruit/Adafruit_CircuitPython_ST7735R +uint8_t display_init_sequence[] = { + // sw reset + 0x01, 0 | DELAY, 0x96, + // SLPOUT and Delay + 0x11, 0 | DELAY, 0xFF, + 0xB1, 0x03, 0x01, 0x2C, 0x2D, // _FRMCTR1 + 0xB3, 0x06, 0x01, 0x2C, 0x2D, 0x01, 0x2C, 0x2D, // _FRMCTR3 + 0xB4, 0x01, 0x07, // _INVCTR line inversion + 0xC0, 0x03, 0xA2, 0x02, 0x84, // _PWCTR1 GVDD = 4.7V, 1.0uA + 0xC1, 0x01, 0xC5, // _PWCTR2 VGH=14.7V, VGL=-7.35V + 0xC2, 0x02, 0x0A, 0x00, // _PWCTR3 Opamp current small, Boost frequency + 0xC3, 0x02, 0x8A, 0x2A, + 0xC4, 0x02, 0x8A, 0xEE, + 0xC5, 0x01, 0x0E, // _VMCTR1 VCOMH = 4V, VOML = -1.1V + 0x20, 0x00, // _INVOFF + 0x36, 0x01, 0x18, // _MADCTL bottom to top refresh + // 1 clk cycle nonoverlap, 2 cycle gate rise, 3 sycle osc equalie, + // fix on VTL + 0x3A, 0x01, 0x05, // COLMOD - 16bit color + 0xE0, 0x10, 0x02, 0x1C, 0x07, 0x12, 0x37, 0x32, 0x29, 0x2D, 0x29, 0x25, 0x2B, 0x39, 0x00, 0x01, 0x03, 0x10, // _GMCTRP1 Gamma + 0xE1, 0x10, 0x03, 0x1D, 0x07, 0x06, 0x2E, 0x2C, 0x29, 0x2D, 0x2E, 0x2E, 0x37, 0x3F, 0x00, 0x00, 0x02, 0x10, // _GMCTRN1 + 0x13, 0 | DELAY, 0x0A, // _NORON + 0x29, 0 | DELAY, 0x64, // _DISPON + // 0x36, 0x01, 0xC0, // _MADCTL Default rotation plus BGR encoding + 0x36, 0x01, 0xC8, // _MADCTL Default rotation plus RGB encoding + 0x21, 0x00, // _INVON +}; + +static void display_init(void) { + busio_spi_obj_t *spi = &displays[0].fourwire_bus.inline_bus; + + common_hal_busio_spi_construct( + spi, + &pin_GPIO10, // CLK + &pin_GPIO11, // MOSI + NULL, // MISO not connected + false); // Not half-duplex + + 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_GPIO18, // DC + &pin_GPIO9, // CS + &pin_GPIO21, // RST + 40000000, // baudrate + 0, // polarity + 0 // phase + ); + + displayio_display_obj_t *display = &displays[0].display; + display->base.type = &displayio_display_type; + + common_hal_displayio_display_construct( + display, + bus, + 160, // width (after rotation) + 80, // height (after rotation) + 26, // column start + 1, // row start + 90, // rotation + 16, // color depth + false, // grayscale + false, // pixels in a byte share a row. Only valid for depths < 8 + 1, // bytes per cell. Only valid for depths < 8 + false, // reverse_pixels_in_byte. Only valid for depths < 8 + true, // reverse_pixels_in_word + MIPI_COMMAND_SET_COLUMN_ADDRESS, // set column command + MIPI_COMMAND_SET_PAGE_ADDRESS, // set row command + MIPI_COMMAND_WRITE_MEMORY_START, // write memory command + display_init_sequence, + sizeof(display_init_sequence), + &pin_GPIO45, // backlight pin + NO_BRIGHTNESS_COMMAND, + 1.0f, // brightness + false, // single_byte_bounds + false, // data_as_commands + true, // auto_refresh + 60, // native_frames_per_second + true, // backlight_on_high + false, // SH1107_addressing + 50000 // backlight pwm frequency + ); +} + + +void board_init(void) { + // Debug UART + #ifdef DEBUG + common_hal_never_reset_pin(&pin_GPIO43); + common_hal_never_reset_pin(&pin_GPIO44); + #endif /* DEBUG */ + + // Display + display_init(); +} + +// Use the MP_WEAK supervisor/shared/board.c versions of routines not defined here. diff --git a/ports/espressif/boards/waveshare_esp32_s2_pico_lcd/mpconfigboard.h b/ports/espressif/boards/waveshare_esp32_s2_pico_lcd/mpconfigboard.h new file mode 100644 index 0000000000..f9cf2aa384 --- /dev/null +++ b/ports/espressif/boards/waveshare_esp32_s2_pico_lcd/mpconfigboard.h @@ -0,0 +1,40 @@ +/* + * This file is part of the MicroPython project, http://micropython.org/ + * + * The MIT License (MIT) + * + * Copyright (c) 2019 Scott Shawcroft for Adafruit Industries + * + * Permission is hereby granted, free of charge, to any person obtaining a copy + * of this software and associated documentation files (the "Software"), to deal + * in the Software without restriction, including without limitation the rights + * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell + * copies of the Software, and to permit persons to whom the Software is + * furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice shall be included in + * all copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE + * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER + * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, + * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN + * THE SOFTWARE. + */ + +// Micropython setup + +#define MICROPY_HW_BOARD_NAME "Waveshare ESP32-S2-Pico-LCD" +#define MICROPY_HW_MCU_NAME "ESP32S2" + +#define DEFAULT_I2C_BUS_SCL (&pin_GPIO41) +#define DEFAULT_I2C_BUS_SDA (&pin_GPIO40) + +#define DEFAULT_SPI_BUS_SCK (&pin_GPIO10) +#define DEFAULT_SPI_BUS_MOSI (&pin_GPIO11) +#define DEFAULT_SPI_BUS_MISO (&pin_GPIO12) + +#define DEFAULT_UART_BUS_RX (&pin_GPIO44) +#define DEFAULT_UART_BUS_TX (&pin_GPIO43) diff --git a/ports/espressif/boards/waveshare_esp32_s2_pico_lcd/mpconfigboard.mk b/ports/espressif/boards/waveshare_esp32_s2_pico_lcd/mpconfigboard.mk new file mode 100644 index 0000000000..e65760ec68 --- /dev/null +++ b/ports/espressif/boards/waveshare_esp32_s2_pico_lcd/mpconfigboard.mk @@ -0,0 +1,11 @@ +USB_VID = 0x303a +USB_PID = 0x810c + +USB_PRODUCT = "ESP32-S2-Pico-LCD" +USB_MANUFACTURER = "Waveshare Electronics" + +IDF_TARGET = esp32s2 + +CIRCUITPY_ESP_FLASH_MODE=dio +CIRCUITPY_ESP_FLASH_FREQ=80m +CIRCUITPY_ESP_FLASH_SIZE=4MB diff --git a/ports/espressif/boards/waveshare_esp32_s2_pico_lcd/pins.c b/ports/espressif/boards/waveshare_esp32_s2_pico_lcd/pins.c new file mode 100644 index 0000000000..ac1e983202 --- /dev/null +++ b/ports/espressif/boards/waveshare_esp32_s2_pico_lcd/pins.c @@ -0,0 +1,79 @@ +#include "shared-bindings/board/__init__.h" +#include "shared-module/displayio/__init__.h" + + +STATIC const mp_rom_map_elem_t board_module_globals_table[] = { + CIRCUITPYTHON_BOARD_DICT_STANDARD_ITEMS + + { MP_ROM_QSTR(MP_QSTR_BUTTON), MP_ROM_PTR(&pin_GPIO0) }, + { MP_ROM_QSTR(MP_QSTR_BOOT0), MP_ROM_PTR(&pin_GPIO0) }, + { MP_ROM_QSTR(MP_QSTR_GP0), MP_ROM_PTR(&pin_GPIO0) }, + + { MP_ROM_QSTR(MP_QSTR_A3), MP_ROM_PTR(&pin_GPIO1) }, + { MP_ROM_QSTR(MP_QSTR_USB_IN), MP_ROM_PTR(&pin_GPIO1) }, + { MP_ROM_QSTR(MP_QSTR_GP2), MP_ROM_PTR(&pin_GPIO2) }, + { MP_ROM_QSTR(MP_QSTR_GP3), MP_ROM_PTR(&pin_GPIO3) }, + { MP_ROM_QSTR(MP_QSTR_GP4), MP_ROM_PTR(&pin_GPIO4) }, + { MP_ROM_QSTR(MP_QSTR_GP5), MP_ROM_PTR(&pin_GPIO5) }, + + { MP_ROM_QSTR(MP_QSTR_A0), MP_ROM_PTR(&pin_GPIO6) }, + { MP_ROM_QSTR(MP_QSTR_GP6), MP_ROM_PTR(&pin_GPIO6) }, + { MP_ROM_QSTR(MP_QSTR_A1), MP_ROM_PTR(&pin_GPIO7) }, + { MP_ROM_QSTR(MP_QSTR_GP7), MP_ROM_PTR(&pin_GPIO7) }, + { MP_ROM_QSTR(MP_QSTR_A2), MP_ROM_PTR(&pin_GPIO8) }, + { MP_ROM_QSTR(MP_QSTR_GP8), MP_ROM_PTR(&pin_GPIO8) }, + + { MP_ROM_QSTR(MP_QSTR_SCK), MP_ROM_PTR(&pin_GPIO10) }, + { MP_ROM_QSTR(MP_QSTR_GP10), MP_ROM_PTR(&pin_GPIO10) }, + + { MP_ROM_QSTR(MP_QSTR_MOSI), MP_ROM_PTR(&pin_GPIO11) }, + { MP_ROM_QSTR(MP_QSTR_GP11), MP_ROM_PTR(&pin_GPIO11) }, + + { MP_ROM_QSTR(MP_QSTR_MISO), MP_ROM_PTR(&pin_GPIO12) }, + { MP_ROM_QSTR(MP_QSTR_GP12), MP_ROM_PTR(&pin_GPIO12) }, + + { MP_ROM_QSTR(MP_QSTR_CS), MP_ROM_PTR(&pin_GPIO13) }, + { MP_ROM_QSTR(MP_QSTR_GP13), MP_ROM_PTR(&pin_GPIO13) }, + + { MP_ROM_QSTR(MP_QSTR_GP14), MP_ROM_PTR(&pin_GPIO14) }, + { MP_ROM_QSTR(MP_QSTR_GP15), MP_ROM_PTR(&pin_GPIO15) }, + { MP_ROM_QSTR(MP_QSTR_GP16), MP_ROM_PTR(&pin_GPIO16) }, + { MP_ROM_QSTR(MP_QSTR_GP17), MP_ROM_PTR(&pin_GPIO17) }, + + { MP_ROM_QSTR(MP_QSTR_GP34), MP_ROM_PTR(&pin_GPIO34) }, + { MP_ROM_QSTR(MP_QSTR_GP35), MP_ROM_PTR(&pin_GPIO35) }, + { MP_ROM_QSTR(MP_QSTR_GP36), MP_ROM_PTR(&pin_GPIO36) }, + { MP_ROM_QSTR(MP_QSTR_GP37), MP_ROM_PTR(&pin_GPIO37) }, + { MP_ROM_QSTR(MP_QSTR_GP38), MP_ROM_PTR(&pin_GPIO38) }, + { MP_ROM_QSTR(MP_QSTR_GP39), MP_ROM_PTR(&pin_GPIO39) }, + + { MP_ROM_QSTR(MP_QSTR_SDA), MP_ROM_PTR(&pin_GPIO40) }, + { MP_ROM_QSTR(MP_QSTR_GP40), MP_ROM_PTR(&pin_GPIO40) }, + + { MP_ROM_QSTR(MP_QSTR_SCL), MP_ROM_PTR(&pin_GPIO41) }, + { MP_ROM_QSTR(MP_QSTR_GP41), MP_ROM_PTR(&pin_GPIO41) }, + + { MP_ROM_QSTR(MP_QSTR_GP42), MP_ROM_PTR(&pin_GPIO42) }, + + { MP_ROM_QSTR(MP_QSTR_TX), MP_ROM_PTR(&pin_GPIO43) }, + { MP_ROM_QSTR(MP_QSTR_GP43), MP_ROM_PTR(&pin_GPIO43) }, + + { MP_ROM_QSTR(MP_QSTR_RX), MP_ROM_PTR(&pin_GPIO44) }, + { MP_ROM_QSTR(MP_QSTR_GP44), MP_ROM_PTR(&pin_GPIO44) }, + + // 0.96 inch LCD ST7735s + { MP_ROM_QSTR(MP_QSTR_LCD_MOSI), MP_ROM_PTR(&pin_GPIO11) }, + { MP_ROM_QSTR(MP_QSTR_LCD_CLK), MP_ROM_PTR(&pin_GPIO10) }, + { MP_ROM_QSTR(MP_QSTR_LCD_CS), MP_ROM_PTR(&pin_GPIO9) }, + { MP_ROM_QSTR(MP_QSTR_LCD_RST), MP_ROM_PTR(&pin_GPIO21) }, + { MP_ROM_QSTR(MP_QSTR_LCD_BACKLIGHT), MP_ROM_PTR(&pin_GPIO45) }, + { MP_ROM_QSTR(MP_QSTR_LCD_DC), MP_ROM_PTR(&pin_GPIO18) }, + + { 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) }, + + { MP_ROM_QSTR(MP_QSTR_DISPLAY), MP_ROM_PTR(&displays[0].display) }, + +}; +MP_DEFINE_CONST_DICT(board_module_globals, board_module_globals_table); diff --git a/ports/espressif/boards/waveshare_esp32_s2_pico_lcd/sdkconfig b/ports/espressif/boards/waveshare_esp32_s2_pico_lcd/sdkconfig new file mode 100644 index 0000000000..836fd46764 --- /dev/null +++ b/ports/espressif/boards/waveshare_esp32_s2_pico_lcd/sdkconfig @@ -0,0 +1,37 @@ +CONFIG_ESP32S2_SPIRAM_SUPPORT=y +# +# SPI RAM config +# +# CONFIG_SPIRAM_TYPE_AUTO is not set +# CONFIG_SPIRAM_TYPE_ESPPSRAM16 is not set +# CONFIG_SPIRAM_TYPE_ESPPSRAM32 is not set +CONFIG_SPIRAM_TYPE_ESPPSRAM64=y +CONFIG_SPIRAM_SIZE=8388608 +# end of SPI RAM config + +CONFIG_DEFAULT_PSRAM_CLK_IO=30 +# +# PSRAM clock and cs IO for ESP32S2 +# +CONFIG_DEFAULT_PSRAM_CS_IO=26 +# end of PSRAM clock and cs IO for ESP32S2 + +# CONFIG_SPIRAM_FETCH_INSTRUCTIONS is not set +# CONFIG_SPIRAM_RODATA is not set +CONFIG_SPIRAM_SPEED_80M=y +# CONFIG_SPIRAM_SPEED_40M is not set +# CONFIG_SPIRAM_SPEED_26M is not set +# CONFIG_SPIRAM_SPEED_20M is not set +CONFIG_SPIRAM=y +CONFIG_SPIRAM_BOOT_INIT=y +# CONFIG_SPIRAM_IGNORE_NOTFOUND is not set +CONFIG_SPIRAM_USE_MEMMAP=y +# CONFIG_SPIRAM_USE_CAPS_ALLOC is not set +# CONFIG_SPIRAM_USE_MALLOC is not set +CONFIG_SPIRAM_MEMTEST=y +# CONFIG_SPIRAM_ALLOW_BSS_SEG_EXTERNAL_MEMORY is not set +# +# LWIP +# +CONFIG_LWIP_LOCAL_HOSTNAME="waveshare" +# end of LWIP diff --git a/ports/espressif/boards/waveshare_esp32s2_pico/board.c b/ports/espressif/boards/waveshare_esp32s2_pico/board.c new file mode 100644 index 0000000000..b3c8cb4191 --- /dev/null +++ b/ports/espressif/boards/waveshare_esp32s2_pico/board.c @@ -0,0 +1,39 @@ +/* + * This file is part of the MicroPython project, http://micropython.org/ + * + * The MIT License (MIT) + * + * Copyright (c) 2020 Scott Shawcroft for Adafruit Industries + * + * Permission is hereby granted, free of charge, to any person obtaining a copy + * of this software and associated documentation files (the "Software"), to deal + * in the Software without restriction, including without limitation the rights + * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell + * copies of the Software, and to permit persons to whom the Software is + * furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice shall be included in + * all copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE + * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER + * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, + * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN + * THE SOFTWARE. + */ + +#include "supervisor/board.h" +#include "mpconfigboard.h" +#include "shared-bindings/microcontroller/Pin.h" + +void board_init(void) { + // Debug UART + #ifdef DEBUG + common_hal_never_reset_pin(&pin_GPIO43); + common_hal_never_reset_pin(&pin_GPIO44); + #endif /* DEBUG */ +} + +// Use the MP_WEAK supervisor/shared/board.c versions of routines not defined here. diff --git a/ports/espressif/boards/waveshare_esp32s2_pico/mpconfigboard.h b/ports/espressif/boards/waveshare_esp32s2_pico/mpconfigboard.h new file mode 100644 index 0000000000..6a10db6061 --- /dev/null +++ b/ports/espressif/boards/waveshare_esp32s2_pico/mpconfigboard.h @@ -0,0 +1,32 @@ +/* + * This file is part of the MicroPython project, http://micropython.org/ + * + * The MIT License (MIT) + * + * Copyright (c) 2019 Scott Shawcroft for Adafruit Industries + * + * Permission is hereby granted, free of charge, to any person obtaining a copy + * of this software and associated documentation files (the "Software"), to deal + * in the Software without restriction, including without limitation the rights + * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell + * copies of the Software, and to permit persons to whom the Software is + * furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice shall be included in + * all copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE + * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER + * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, + * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN + * THE SOFTWARE. + */ + +// Micropython setup + +#define MICROPY_HW_BOARD_NAME "Waveshare ESP32-S2-Pico" +#define MICROPY_HW_MCU_NAME "ESP32S2" + +#define MICROPY_HW_LED_STATUS (&pin_GPIO9) diff --git a/ports/espressif/boards/waveshare_esp32s2_pico/mpconfigboard.mk b/ports/espressif/boards/waveshare_esp32s2_pico/mpconfigboard.mk new file mode 100644 index 0000000000..70f4bf008f --- /dev/null +++ b/ports/espressif/boards/waveshare_esp32s2_pico/mpconfigboard.mk @@ -0,0 +1,10 @@ +USB_VID = 0x303a +USB_PID = 0x810a +USB_PRODUCT = "ESP32-S2-Pico" +USB_MANUFACTURER = "Waveshare Electronics" + +IDF_TARGET = esp32s2 + +CIRCUITPY_ESP_FLASH_MODE = dio +CIRCUITPY_ESP_FLASH_FREQ = 80m +CIRCUITPY_ESP_FLASH_SIZE = 4MB diff --git a/ports/espressif/boards/waveshare_esp32s2_pico/pins.c b/ports/espressif/boards/waveshare_esp32s2_pico/pins.c new file mode 100644 index 0000000000..04054344ae --- /dev/null +++ b/ports/espressif/boards/waveshare_esp32s2_pico/pins.c @@ -0,0 +1,44 @@ +#include "shared-bindings/board/__init__.h" + +STATIC const mp_rom_map_elem_t board_module_globals_table[] = { + CIRCUITPYTHON_BOARD_DICT_STANDARD_ITEMS + + { MP_ROM_QSTR(MP_QSTR_BUTTON), MP_ROM_PTR(&pin_GPIO0) }, + { MP_ROM_QSTR(MP_QSTR_BOOT0), MP_ROM_PTR(&pin_GPIO0) }, + { MP_ROM_QSTR(MP_QSTR_LED), MP_ROM_PTR(&pin_GPIO9) }, + + { MP_ROM_QSTR(MP_QSTR_GP0), MP_ROM_PTR(&pin_GPIO0) }, + { MP_ROM_QSTR(MP_QSTR_GP2), MP_ROM_PTR(&pin_GPIO2) }, + { MP_ROM_QSTR(MP_QSTR_GP3), MP_ROM_PTR(&pin_GPIO3) }, + { MP_ROM_QSTR(MP_QSTR_GP4), MP_ROM_PTR(&pin_GPIO4) }, + { MP_ROM_QSTR(MP_QSTR_GP5), MP_ROM_PTR(&pin_GPIO5) }, + + { MP_ROM_QSTR(MP_QSTR_GP6), MP_ROM_PTR(&pin_GPIO6) }, + { MP_ROM_QSTR(MP_QSTR_GP7), MP_ROM_PTR(&pin_GPIO7) }, + { MP_ROM_QSTR(MP_QSTR_GP8), MP_ROM_PTR(&pin_GPIO8) }, + + { MP_ROM_QSTR(MP_QSTR_GP10), MP_ROM_PTR(&pin_GPIO10) }, + { MP_ROM_QSTR(MP_QSTR_GP11), MP_ROM_PTR(&pin_GPIO11) }, + { MP_ROM_QSTR(MP_QSTR_GP12), MP_ROM_PTR(&pin_GPIO12) }, + { MP_ROM_QSTR(MP_QSTR_GP13), MP_ROM_PTR(&pin_GPIO13) }, + + { MP_ROM_QSTR(MP_QSTR_GP14), MP_ROM_PTR(&pin_GPIO14) }, + { MP_ROM_QSTR(MP_QSTR_GP15), MP_ROM_PTR(&pin_GPIO15) }, + { MP_ROM_QSTR(MP_QSTR_GP16), MP_ROM_PTR(&pin_GPIO16) }, + { MP_ROM_QSTR(MP_QSTR_GP17), MP_ROM_PTR(&pin_GPIO17) }, + + { MP_ROM_QSTR(MP_QSTR_GP34), MP_ROM_PTR(&pin_GPIO34) }, + { MP_ROM_QSTR(MP_QSTR_GP35), MP_ROM_PTR(&pin_GPIO35) }, + { MP_ROM_QSTR(MP_QSTR_GP36), MP_ROM_PTR(&pin_GPIO36) }, + { MP_ROM_QSTR(MP_QSTR_GP37), MP_ROM_PTR(&pin_GPIO37) }, + { MP_ROM_QSTR(MP_QSTR_GP38), MP_ROM_PTR(&pin_GPIO38) }, + + { MP_ROM_QSTR(MP_QSTR_GP39), MP_ROM_PTR(&pin_GPIO39) }, + { MP_ROM_QSTR(MP_QSTR_GP40), MP_ROM_PTR(&pin_GPIO40) }, + { MP_ROM_QSTR(MP_QSTR_GP41), MP_ROM_PTR(&pin_GPIO41) }, + + { MP_ROM_QSTR(MP_QSTR_GP42), MP_ROM_PTR(&pin_GPIO42) }, + { MP_ROM_QSTR(MP_QSTR_GP43), MP_ROM_PTR(&pin_GPIO43) }, + { MP_ROM_QSTR(MP_QSTR_GP44), MP_ROM_PTR(&pin_GPIO44) } +}; +MP_DEFINE_CONST_DICT(board_module_globals, board_module_globals_table); diff --git a/ports/espressif/boards/waveshare_esp32s2_pico/sdkconfig b/ports/espressif/boards/waveshare_esp32s2_pico/sdkconfig new file mode 100644 index 0000000000..e1635f6d17 --- /dev/null +++ b/ports/espressif/boards/waveshare_esp32s2_pico/sdkconfig @@ -0,0 +1,17 @@ +CONFIG_ESP32S2_SPIRAM_SUPPORT=y + +CONFIG_DEFAULT_PSRAM_CLK_IO=30 +CONFIG_DEFAULT_PSRAM_CS_IO=26 + +CONFIG_SPIRAM_TYPE_ESPPSRAM64=y +CONFIG_SPIRAM_SPEED_80M=y +CONFIG_SPIRAM=y +CONFIG_SPIRAM_BOOT_INIT=y +CONFIG_SPIRAM_USE_MEMMAP=y +CONFIG_SPIRAM_MEMTEST=y + +# +# LWIP +# +CONFIG_LWIP_LOCAL_HOSTNAME="waveshare" +# end of LWIP diff --git a/ports/espressif/common-hal/_bleio/Adapter.c b/ports/espressif/common-hal/_bleio/Adapter.c index 943e44e7cd..5eaf6e9cf4 100644 --- a/ports/espressif/common-hal/_bleio/Adapter.c +++ b/ports/espressif/common-hal/_bleio/Adapter.c @@ -59,6 +59,10 @@ #include "esp_bt.h" #include "esp_nimble_hci.h" +#if CIRCUITPY_DOTENV +#include "shared-module/dotenv/__init__.h" +#endif + bleio_connection_internal_t bleio_connections[BLEIO_TOTAL_CONNECTION_COUNT]; // static void bluetooth_adapter_background(void *data) { @@ -96,7 +100,23 @@ void common_hal_bleio_adapter_set_enabled(bleio_adapter_obj_t *self, bool enable // ble_hs_cfg.reset_cb = blecent_on_reset; ble_hs_cfg.sync_cb = _on_sync; // ble_hs_cfg.store_status_cb = ble_store_util_status_rr; + + #if CIRCUITPY_DOTENV + mp_int_t name_len = 0; + char ble_name[32]; + name_len = dotenv_get_key("/.env", "CIRCUITPY_BLE_NAME", ble_name, sizeof(ble_name) - 1); + if (name_len > 0) { + if (name_len > MYNEWT_VAL_BLE_SVC_GAP_DEVICE_NAME_MAX_LENGTH) { + name_len = MYNEWT_VAL_BLE_SVC_GAP_DEVICE_NAME_MAX_LENGTH; + } + ble_name[name_len] = '\0'; + ble_svc_gap_device_name_set(ble_name); + } else { + ble_svc_gap_device_name_set("CIRCUITPY"); + } + #else ble_svc_gap_device_name_set("CIRCUITPY"); + #endif // Clear all of the internal connection objects. for (size_t i = 0; i < BLEIO_TOTAL_CONNECTION_COUNT; i++) { diff --git a/ports/espressif/common-hal/_bleio/CharacteristicBuffer.c b/ports/espressif/common-hal/_bleio/CharacteristicBuffer.c index fc3d0bbf06..48be3abd67 100644 --- a/ports/espressif/common-hal/_bleio/CharacteristicBuffer.c +++ b/ports/espressif/common-hal/_bleio/CharacteristicBuffer.c @@ -72,11 +72,7 @@ void _common_hal_bleio_characteristic_buffer_construct(bleio_characteristic_buff void *static_handler_entry) { self->characteristic = characteristic; self->timeout_ms = timeout * 1000; - - self->ringbuf.buf = (uint8_t *)buffer; - self->ringbuf.size = buffer_size; - self->ringbuf.iget = 0; - self->ringbuf.iput = 0; + ringbuf_init(&self->ringbuf, buffer, buffer_size); if (static_handler_entry != NULL) { ble_event_add_handler_entry((ble_event_handler_entry_t *)static_handler_entry, characteristic_buffer_on_ble_evt, self); @@ -131,6 +127,7 @@ void common_hal_bleio_characteristic_buffer_deinit(bleio_characteristic_buffer_o if (!common_hal_bleio_characteristic_buffer_deinited(self)) { ble_event_remove_handler(characteristic_buffer_on_ble_evt, self); self->characteristic = NULL; + ringbuf_deinit(&self->ringbuf); } } diff --git a/ports/espressif/common-hal/_bleio/Connection.c b/ports/espressif/common-hal/_bleio/Connection.c index 7dbcbd6e5f..63c85099e6 100644 --- a/ports/espressif/common-hal/_bleio/Connection.c +++ b/ports/espressif/common-hal/_bleio/Connection.c @@ -394,6 +394,11 @@ STATIC void discover_remote_services(bleio_connection_internal_t *self, mp_obj_t ? service->end_handle : next_characteristic->def_handle - 1; + // Pre-check if characteristic is empty so descriptor discovery doesn't fail + if (end_handle <= characteristic->handle) { + continue; + } + _last_discovery_status = BLE_ERR_SUCCESS; CHECK_NIMBLE_ERROR(ble_gattc_disc_all_dscs(self->conn_handle, characteristic->handle, end_handle, diff --git a/ports/espressif/common-hal/_bleio/PacketBuffer.c b/ports/espressif/common-hal/_bleio/PacketBuffer.c index 4e65bf309c..3b3e51df61 100644 --- a/ports/espressif/common-hal/_bleio/PacketBuffer.c +++ b/ports/espressif/common-hal/_bleio/PacketBuffer.c @@ -42,13 +42,13 @@ STATIC void write_to_ringbuf(bleio_packet_buffer_obj_t *self, const struct os_mbuf *mbuf) { size_t len = OS_MBUF_PKTLEN(mbuf); - if (len + sizeof(uint16_t) > ringbuf_capacity(&self->ringbuf)) { + if (len + sizeof(uint16_t) > ringbuf_size(&self->ringbuf)) { // This shouldn't happen but can if our buffer size was much smaller than // the writes the client actually makes. return; } // Make room for the new value by dropping the oldest packets first. - while (ringbuf_capacity(&self->ringbuf) - ringbuf_num_filled(&self->ringbuf) < len + sizeof(uint16_t)) { + while (ringbuf_size(&self->ringbuf) - ringbuf_num_filled(&self->ringbuf) < len + sizeof(uint16_t)) { uint16_t packet_length; ringbuf_get_n(&self->ringbuf, (uint8_t *)&packet_length, sizeof(uint16_t)); for (uint16_t i = 0; i < packet_length; i++) { @@ -164,10 +164,7 @@ void _common_hal_bleio_packet_buffer_construct( } if (incoming) { - self->ringbuf.buf = (uint8_t *)incoming_buffer; - self->ringbuf.size = incoming_buffer_size; - self->ringbuf.iget = 0; - self->ringbuf.iput = 0; + ringbuf_init(&self->ringbuf, (uint8_t *)incoming_buffer, incoming_buffer_size); } self->packet_queued = false; @@ -219,8 +216,7 @@ void common_hal_bleio_packet_buffer_construct( size_t incoming_buffer_size = 0; uint32_t *incoming_buffer = NULL; if (incoming) { - incoming_buffer_size = buffer_size * (sizeof(uint16_t) + max_packet_size); - incoming_buffer = m_malloc(incoming_buffer_size, false); + ringbuf_init(&self->ringbuf, (uint8_t *)incoming_buffer, incoming_buffer_size); } uint32_t *outgoing1 = NULL; @@ -414,5 +410,6 @@ bool common_hal_bleio_packet_buffer_deinited(bleio_packet_buffer_obj_t *self) { void common_hal_bleio_packet_buffer_deinit(bleio_packet_buffer_obj_t *self) { if (!common_hal_bleio_packet_buffer_deinited(self)) { ble_event_remove_handler(packet_buffer_on_ble_client_evt, self); + ringbuf_deinit(&self->ringbuf); } } diff --git a/ports/espressif/common-hal/alarm/SleepMemory.c b/ports/espressif/common-hal/alarm/SleepMemory.c index 764125ddb2..d375fdc778 100644 --- a/ports/espressif/common-hal/alarm/SleepMemory.c +++ b/ports/espressif/common-hal/alarm/SleepMemory.c @@ -31,7 +31,6 @@ #include "common-hal/alarm/SleepMemory.h" #include "shared-bindings/alarm/SleepMemory.h" -#include "esp_log.h" #include "esp_sleep.h" // Data storage for singleton instance of SleepMemory. @@ -39,7 +38,7 @@ static RTC_DATA_ATTR uint8_t _sleep_mem[SLEEP_MEMORY_LENGTH]; void alarm_sleep_memory_reset(void) { - // ESP-IDF build system takes care of doing esp_sleep_pd_config() or the equivalentwith + // ESP-IDF build system takes care of doing esp_sleep_pd_config() or the equivalent with // the correct settings, depending on which RTC mem we are using. // https://docs.espressif.com/projects/esp-idf/en/latest/esp32s2/api-reference/system/sleep_modes.html#power-down-of-rtc-peripherals-and-memories } diff --git a/ports/espressif/common-hal/alarm/__init__.c b/ports/espressif/common-hal/alarm/__init__.c index d65ab0bbb2..11c740b717 100644 --- a/ports/espressif/common-hal/alarm/__init__.c +++ b/ports/espressif/common-hal/alarm/__init__.c @@ -39,12 +39,15 @@ #include "shared-bindings/wifi/__init__.h" #include "shared-bindings/microcontroller/__init__.h" +#include "common-hal/digitalio/DigitalInOut.h" + #include "supervisor/port.h" #include "supervisor/shared/workflow.h" #include "esp_sleep.h" #include "soc/rtc_cntl_reg.h" +#include "components/driver/include/driver/gpio.h" #include "components/driver/include/driver/uart.h" // Singleton instance of SleepMemory. @@ -158,7 +161,8 @@ mp_obj_t common_hal_alarm_light_sleep_until_alarms(size_t n_alarms, const mp_obj return wake_alarm; } -void common_hal_alarm_set_deep_sleep_alarms(size_t n_alarms, const mp_obj_t *alarms) { +void common_hal_alarm_set_deep_sleep_alarms(size_t n_alarms, const mp_obj_t *alarms, size_t n_dios, digitalio_digitalinout_obj_t *preserve_dios[]) { + digitalio_digitalinout_preserve_for_deep_sleep(n_dios, preserve_dios); _setup_sleep_alarms(true, n_alarms, alarms); } @@ -166,6 +170,9 @@ void NORETURN common_hal_alarm_enter_deep_sleep(void) { alarm_pin_pinalarm_prepare_for_deep_sleep(); alarm_touch_touchalarm_prepare_for_deep_sleep(); + // We no longer need to remember the pin preservations, since any pin resets are all done. + clear_pin_preservations(); + // The ESP-IDF caches the deep sleep settings and applies them before sleep. // We don't need to worry about resetting them in the interim. esp_deep_sleep_start(); diff --git a/ports/espressif/common-hal/alarm/pin/PinAlarm.c b/ports/espressif/common-hal/alarm/pin/PinAlarm.c index 6318cc2cca..62496ec4c6 100644 --- a/ports/espressif/common-hal/alarm/pin/PinAlarm.c +++ b/ports/espressif/common-hal/alarm/pin/PinAlarm.c @@ -27,7 +27,7 @@ #include "py/runtime.h" -#include "supervisor/esp_port.h" +#include "supervisor/port.h" #include "shared-bindings/alarm/pin/PinAlarm.h" #include "shared-bindings/microcontroller/Pin.h" #include "shared-bindings/microcontroller/__init__.h" @@ -90,11 +90,7 @@ STATIC void gpio_interrupt(void *arg) { gpio_ll_intr_disable(&GPIO, 32 + i); } } - BaseType_t high_task_wakeup; - vTaskNotifyGiveFromISR(circuitpython_task, &high_task_wakeup); - if (high_task_wakeup) { - portYIELD_FROM_ISR(); - } + port_wake_main_task_from_isr(); } bool alarm_pin_pinalarm_woke_this_cycle(void) { diff --git a/ports/espressif/common-hal/alarm/time/TimeAlarm.c b/ports/espressif/common-hal/alarm/time/TimeAlarm.c index 256d96a75f..973da33c67 100644 --- a/ports/espressif/common-hal/alarm/time/TimeAlarm.c +++ b/ports/espressif/common-hal/alarm/time/TimeAlarm.c @@ -27,7 +27,7 @@ #include "esp_sleep.h" #include "py/runtime.h" -#include "supervisor/esp_port.h" +#include "supervisor/port.h" #include "components/esp_timer/include/esp_timer.h" @@ -66,7 +66,7 @@ STATIC bool woke_up = false; STATIC void timer_callback(void *arg) { (void)arg; woke_up = true; - xTaskNotifyGive(circuitpython_task); + port_wake_main_task(); } bool alarm_time_timealarm_woke_this_cycle(void) { diff --git a/ports/espressif/common-hal/alarm/touch/TouchAlarm.c b/ports/espressif/common-hal/alarm/touch/TouchAlarm.c index 6ae2421e4c..fc44c1dcc0 100644 --- a/ports/espressif/common-hal/alarm/touch/TouchAlarm.c +++ b/ports/espressif/common-hal/alarm/touch/TouchAlarm.c @@ -26,17 +26,18 @@ #include "shared-bindings/alarm/touch/TouchAlarm.h" #include "shared-bindings/microcontroller/__init__.h" +#include "shared-bindings/microcontroller/Pin.h" #include "esp_sleep.h" #include "peripherals/touch.h" -#include "supervisor/esp_port.h" +#include "supervisor/port.h" static uint16_t touch_channel_mask; static volatile bool woke_up = false; void common_hal_alarm_touch_touchalarm_construct(alarm_touch_touchalarm_obj_t *self, const mcu_pin_obj_t *pin) { if (pin->touch_channel == TOUCH_PAD_MAX) { - mp_raise_ValueError(translate("Invalid pin")); + raise_ValueError_invalid_pin(); } claim_pin(pin); self->pin = pin; @@ -57,10 +58,17 @@ mp_obj_t alarm_touch_touchalarm_create_wakeup_alarm(void) { alarm->base.type = &alarm_touch_touchalarm_type; alarm->pin = NULL; + #if defined(CONFIG_IDF_TARGET_ESP32) + touch_pad_t wake_channel; + if (touch_pad_get_wakeup_status(&wake_channel) != ESP_OK) { + return alarm; + } + #else touch_pad_t wake_channel = touch_pad_get_current_meas_channel(); if (wake_channel == TOUCH_PAD_MAX) { return alarm; } + #endif // Map the pin number back to a pin object. for (size_t i = 0; i < mcu_pin_globals.map.used; i++) { @@ -78,11 +86,7 @@ mp_obj_t alarm_touch_touchalarm_create_wakeup_alarm(void) { STATIC void touch_interrupt(void *arg) { (void)arg; woke_up = true; - BaseType_t task_wakeup; - vTaskNotifyGiveFromISR(circuitpython_task, &task_wakeup); - if (task_wakeup) { - portYIELD_FROM_ISR(); - } + port_wake_main_task_from_isr(); } void alarm_touch_touchalarm_set_alarm(const bool deep_sleep, const size_t n_alarms, const mp_obj_t *alarms) { @@ -121,16 +125,27 @@ void alarm_touch_touchalarm_set_alarm(const bool deep_sleep, const size_t n_alar mp_hal_delay_ms(10); // configure trigger threshold + #if defined(CONFIG_IDF_TARGET_ESP32) + uint16_t touch_value; + touch_pad_read(touch_channel, &touch_value); + touch_pad_set_thresh(touch_channel, touch_value / 10); // 10% + #else uint32_t touch_value; touch_pad_read_benchmark(touch_channel, &touch_value); - touch_pad_set_thresh(touch_channel, touch_value * 0.1); // 10% + touch_pad_set_thresh(touch_channel, touch_value / 10); // 10% + #endif } } // configure touch interrupt + #if defined(CONFIG_IDF_TARGET_ESP32) + touch_pad_isr_register(touch_interrupt, NULL); + touch_pad_intr_enable(); + #else touch_pad_timeout_set(true, SOC_TOUCH_PAD_THRESHOLD_MAX); touch_pad_isr_register(touch_interrupt, NULL, TOUCH_PAD_INTR_MASK_ALL); touch_pad_intr_enable(TOUCH_PAD_INTR_MASK_ACTIVE | TOUCH_PAD_INTR_MASK_INACTIVE); + #endif } void alarm_touch_touchalarm_prepare_for_deep_sleep(void) { @@ -153,17 +168,25 @@ void alarm_touch_touchalarm_prepare_for_deep_sleep(void) { // intialize touchpad peripherals_touch_init(touch_channel); + #if !defined(CONFIG_IDF_TARGET_ESP32) // configure touchpad for sleep touch_pad_sleep_channel_enable(touch_channel, true); touch_pad_sleep_channel_enable_proximity(touch_channel, false); + #endif // wait for touch data to reset mp_hal_delay_ms(10); // configure trigger threshold + #if defined(CONFIG_IDF_TARGET_ESP32) + uint16_t touch_value; + touch_pad_read_filtered(touch_channel, &touch_value); + touch_pad_set_thresh(touch_channel, touch_value); + #else uint32_t touch_value; touch_pad_sleep_channel_read_smooth(touch_channel, &touch_value); - touch_pad_sleep_set_threshold(touch_channel, touch_value * 0.1); // 10% + touch_pad_sleep_set_threshold(touch_channel, touch_value / 10); // 10% + #endif // enable touchpad wakeup esp_sleep_enable_touchpad_wakeup(); diff --git a/ports/espressif/common-hal/analogio/AnalogIn.c b/ports/espressif/common-hal/analogio/AnalogIn.c index adb8b15065..fb2e098cb4 100644 --- a/ports/espressif/common-hal/analogio/AnalogIn.c +++ b/ports/espressif/common-hal/analogio/AnalogIn.c @@ -28,7 +28,7 @@ #include "shared-bindings/analogio/AnalogIn.h" #include "py/mperrno.h" #include "py/runtime.h" -#include "supervisor/shared/translate.h" +#include "supervisor/shared/translate/translate.h" #include "components/driver/include/driver/adc_common.h" #include "components/esp_adc_cal/include/esp_adc_cal.h" @@ -40,18 +40,22 @@ #define DEFAULT_VREF 1100 #define NO_OF_SAMPLES 2 #define ATTENUATION ADC_ATTEN_DB_11 -#ifdef CONFIG_IDF_TARGET_ESP32C3 +#if defined(CONFIG_IDF_TARGET_ESP32) +#define DATA_WIDTH ADC_WIDTH_BIT_12 +#elif defined(CONFIG_IDF_TARGET_ESP32C3) #define DATA_WIDTH ADC_WIDTH_BIT_12 #elif defined(CONFIG_IDF_TARGET_ESP32S2) #define DATA_WIDTH ADC_WIDTH_BIT_13 #elif defined(CONFIG_IDF_TARGET_ESP32S3) #define DATA_WIDTH ADC_WIDTH_BIT_12 +#else +#error No known CONFIG_IDF_TARGET_xxx found #endif void common_hal_analogio_analogin_construct(analogio_analogin_obj_t *self, const mcu_pin_obj_t *pin) { if (pin->adc_index == 0 || pin->adc_channel == ADC_CHANNEL_MAX) { - mp_raise_ValueError(translate("Pin does not have ADC capabilities")); + raise_ValueError_invalid_pin(); } common_hal_mcu_pin_claim(pin); self->pin = pin; @@ -80,7 +84,7 @@ uint16_t common_hal_analogio_analogin_get_value(analogio_analogin_obj_t *self) { } else if (self->pin->adc_index == ADC_UNIT_2) { adc2_config_channel_atten((adc2_channel_t)self->pin->adc_channel, ATTENUATION); } else { - mp_raise_ValueError(translate("Invalid Pin")); + raise_ValueError_invalid_pin(); } // Automatically select calibration process depending on status of efuse diff --git a/ports/espressif/common-hal/analogio/AnalogOut.c b/ports/espressif/common-hal/analogio/AnalogOut.c index 2b5f9d0b35..1a1e74391b 100644 --- a/ports/espressif/common-hal/analogio/AnalogOut.c +++ b/ports/espressif/common-hal/analogio/AnalogOut.c @@ -33,23 +33,31 @@ #include "shared-bindings/analogio/AnalogOut.h" #include "shared-bindings/microcontroller/Pin.h" -#include "supervisor/shared/translate.h" +#include "supervisor/shared/translate/translate.h" -#ifdef CONFIG_IDF_TARGET_ESP32S2 +#if defined(CONFIG_IDF_TARGET_ESP32) || defined(CONFIG_IDF_TARGET_ESP32S2) #include "components/driver/include/driver/dac_common.h" +#define HAS_DAC 1 +#if defined(CONFIG_IDF_TARGET_ESP32) +#define pin_CHANNEL_1 pin_GPIO25 +#define pin_CHANNEL_2 pin_GPIO26 +#elif defined(CONFIG_IDF_TARGET_ESP32S2) +#define pin_CHANNEL_1 pin_GPIO17 +#define pin_CHANNEL_2 pin_GPIO18 +#endif +#else +#define HAS_DAC 0 #endif - -#include "common-hal/microcontroller/Pin.h" void common_hal_analogio_analogout_construct(analogio_analogout_obj_t *self, const mcu_pin_obj_t *pin) { - #ifdef CONFIG_IDF_TARGET_ESP32S2 - if (pin == &pin_GPIO17) { + #if HAS_DAC + if (pin == &pin_CHANNEL_1) { self->channel = DAC_CHANNEL_1; - } else if (pin == &pin_GPIO18) { + } else if (pin == &pin_CHANNEL_2) { self->channel = DAC_CHANNEL_2; } else { - mp_raise_ValueError(translate("Invalid DAC pin supplied")); + raise_ValueError_invalid_pin(); } dac_output_enable(self->channel); #else @@ -58,7 +66,7 @@ void common_hal_analogio_analogout_construct(analogio_analogout_obj_t *self, } bool common_hal_analogio_analogout_deinited(analogio_analogout_obj_t *self) { - #ifdef CONFIG_IDF_TARGET_ESP32S2 + #if HAS_DAC return self->channel == DAC_CHANNEL_MAX; #else return false; @@ -66,7 +74,7 @@ bool common_hal_analogio_analogout_deinited(analogio_analogout_obj_t *self) { } void common_hal_analogio_analogout_deinit(analogio_analogout_obj_t *self) { - #ifdef CONFIG_IDF_TARGET_ESP32S2 + #if HAS_DAC dac_output_disable(self->channel); self->channel = DAC_CHANNEL_MAX; #endif @@ -74,7 +82,7 @@ void common_hal_analogio_analogout_deinit(analogio_analogout_obj_t *self) { void common_hal_analogio_analogout_set_value(analogio_analogout_obj_t *self, uint16_t value) { - #ifdef CONFIG_IDF_TARGET_ESP32S2 + #if HAS_DAC uint8_t dac_value = (value * 255) / 65535; dac_output_enable(self->channel); dac_output_voltage(self->channel, dac_value); @@ -82,7 +90,7 @@ void common_hal_analogio_analogout_set_value(analogio_analogout_obj_t *self, } void analogout_reset(void) { - #ifdef CONFIG_IDF_TARGET_ESP32S2 + #if HAS_DAC dac_output_disable(DAC_CHANNEL_1); dac_output_disable(DAC_CHANNEL_2); #endif diff --git a/ports/espressif/common-hal/audiobusio/I2SOut.c b/ports/espressif/common-hal/audiobusio/I2SOut.c index 6548f46071..440151e881 100644 --- a/ports/espressif/common-hal/audiobusio/I2SOut.c +++ b/ports/espressif/common-hal/audiobusio/I2SOut.c @@ -42,7 +42,7 @@ #include "shared-bindings/audiobusio/I2SOut.h" #include "shared-bindings/audiocore/RawSample.h" #include "shared-bindings/microcontroller/Pin.h" -#include "supervisor/shared/translate.h" +#include "supervisor/shared/translate/translate.h" #include "driver/i2s.h" diff --git a/ports/espressif/common-hal/busio/I2C.c b/ports/espressif/common-hal/busio/I2C.c index 0706de1df5..92bd4fb157 100644 --- a/ports/espressif/common-hal/busio/I2C.c +++ b/ports/espressif/common-hal/busio/I2C.c @@ -32,7 +32,7 @@ #include "shared-bindings/microcontroller/__init__.h" #include "shared-bindings/microcontroller/Pin.h" -#include "supervisor/shared/translate.h" +#include "supervisor/shared/translate/translate.h" void common_hal_busio_i2c_construct(busio_i2c_obj_t *self, const mcu_pin_obj_t *scl, const mcu_pin_obj_t *sda, uint32_t frequency, uint32_t timeout) { @@ -42,7 +42,7 @@ void common_hal_busio_i2c_construct(busio_i2c_obj_t *self, // // 46 is also input-only so it'll never work. if (scl->number == 45 || scl->number == 46 || sda->number == 45 || sda->number == 46) { - mp_raise_ValueError(translate("Invalid pins")); + raise_ValueError_invalid_pins(); } #if CIRCUITPY_REQUIRE_I2C_PULLUPS @@ -113,7 +113,7 @@ void common_hal_busio_i2c_construct(busio_i2c_obj_t *self, if (err == ESP_FAIL) { mp_raise_OSError(MP_EIO); } else { - mp_raise_ValueError(translate("Invalid argument")); + mp_raise_RuntimeError(translate("init I2C")); } } diff --git a/ports/espressif/common-hal/busio/SPI.c b/ports/espressif/common-hal/busio/SPI.c index 4eff1be54c..0b894fa215 100644 --- a/ports/espressif/common-hal/busio/SPI.c +++ b/ports/espressif/common-hal/busio/SPI.c @@ -28,6 +28,7 @@ #include "py/runtime.h" #include "shared-bindings/busio/SPI.h" +#include "shared-bindings/microcontroller/Pin.h" #include "driver/spi_common_internal.h" @@ -101,7 +102,7 @@ void common_hal_busio_spi_construct(busio_spi_obj_t *self, if (result == ESP_ERR_NO_MEM) { mp_raise_msg(&mp_type_MemoryError, translate("ESP-IDF memory allocation failed")); } else if (result == ESP_ERR_INVALID_ARG) { - mp_raise_ValueError(translate("Invalid pins")); + raise_ValueError_invalid_pins(); } set_spi_config(self, 250000, 0, 0, 8); diff --git a/ports/espressif/common-hal/busio/UART.c b/ports/espressif/common-hal/busio/UART.c index 0c44107e60..cdaf25250f 100644 --- a/ports/espressif/common-hal/busio/UART.c +++ b/ports/espressif/common-hal/busio/UART.c @@ -25,6 +25,7 @@ */ #include "shared-bindings/microcontroller/__init__.h" +#include "shared-bindings/microcontroller/Pin.h" #include "shared-bindings/busio/UART.h" #include "components/driver/include/driver/uart.h" @@ -37,10 +38,10 @@ #include "py/runtime.h" #include "py/stream.h" #include "supervisor/port.h" -#include "supervisor/shared/translate.h" +#include "supervisor/shared/translate/translate.h" #include "supervisor/shared/tick.h" -uint8_t never_reset_uart_mask = 0; +static uint8_t never_reset_uart_mask = 0; static void uart_event_task(void *param) { busio_uart_obj_t *self = param; @@ -49,8 +50,8 @@ static void uart_event_task(void *param) { if (xQueueReceive(self->event_queue, &event, portMAX_DELAY)) { switch (event.type) { case UART_PATTERN_DET: - // When the debug uart receives CTRL+C, wake the main task and schedule a keyboard interrupt - if (self->is_debug) { + // When the console uart receives CTRL+C, wake the main task and schedule a keyboard interrupt + if (self->is_console) { port_wake_main_task(); if (mp_interrupt_char == CHAR_CTRL_C) { uart_flush(self->uart_num); @@ -59,8 +60,8 @@ static void uart_event_task(void *param) { } break; case UART_DATA: - // When the debug uart receives any key, wake the main task - if (self->is_debug) { + // When the console uart receives any key, wake the main task + if (self->is_console) { port_wake_main_task(); } break; @@ -73,13 +74,13 @@ static void uart_event_task(void *param) { void uart_reset(void) { for (uart_port_t num = 0; num < UART_NUM_MAX; num++) { - // Ignore the UART used by the IDF. - #ifdef CONFIG_CONSOLE_UART_NUM - if (num == CONFIG_CONSOLE_UART_NUM) { + #ifdef CONFIG_ESP_CONSOLE_UART_NUM + // Do not reset the UART used by the IDF for logging. + if (num == CONFIG_ESP_CONSOLE_UART_NUM) { continue; } #endif - if (uart_is_driver_installed(num) && !(never_reset_uart_mask & 1 << num)) { + if (uart_is_driver_installed(num) && !(never_reset_uart_mask & (1 << num))) { uart_driver_delete(num); } } @@ -101,14 +102,14 @@ void common_hal_busio_uart_construct(busio_uart_obj_t *self, mp_float_t timeout, uint16_t receiver_buffer_size, byte *receiver_buffer, bool sigint_enabled) { - if (bits > 8) { - mp_raise_NotImplementedError(translate("bytes > 8 bits not supported")); - } + mp_arg_validate_int_max(bits, 8, MP_QSTR_bytes); bool have_tx = tx != NULL; bool have_rx = rx != NULL; bool have_rts = rts != NULL; bool have_cts = cts != NULL; + + uart_config_t uart_config = {0}; bool have_rs485_dir = rs485_dir != NULL; if (!have_tx && !have_rx) { mp_raise_ValueError(translate("tx and rx cannot both be None")); @@ -136,37 +137,40 @@ void common_hal_busio_uart_construct(busio_uart_obj_t *self, } uart_mode_t mode = UART_MODE_UART; - uart_hw_flowcontrol_t flow_control = UART_HW_FLOWCTRL_DISABLE; + uart_config.flow_ctrl = UART_HW_FLOWCTRL_DISABLE; if (have_rs485_dir) { mode = UART_MODE_RS485_HALF_DUPLEX; if (!rs485_invert) { + // This one is not in the set uart_set_line_inverse(self->uart_num, UART_SIGNAL_DTR_INV); } } else if (have_rts && have_cts) { - flow_control = UART_HW_FLOWCTRL_CTS_RTS; + uart_config.flow_ctrl = UART_HW_FLOWCTRL_CTS_RTS; } else if (have_rts) { - flow_control = UART_HW_FLOWCTRL_RTS; + uart_config.flow_ctrl = UART_HW_FLOWCTRL_RTS; } else if (have_rts) { - flow_control = UART_HW_FLOWCTRL_CTS; + uart_config.flow_ctrl = UART_HW_FLOWCTRL_CTS; } if (receiver_buffer_size <= UART_FIFO_LEN) { receiver_buffer_size = UART_FIFO_LEN + 8; } - uint8_t rx_threshold = UART_FIFO_LEN - 8; + uart_config.rx_flow_ctrl_thresh = UART_FIFO_LEN - 8; // Install the driver before we change the settings. if (uart_driver_install(self->uart_num, receiver_buffer_size, 0, 20, &self->event_queue, 0) != ESP_OK || uart_set_mode(self->uart_num, mode) != ESP_OK) { - mp_raise_ValueError(translate("Could not initialize UART")); + mp_raise_RuntimeError(translate("UART init")); } - // On the debug uart, enable pattern detection to look for CTRL+C - #ifdef CIRCUITPY_DEBUG_UART_RX - if (rx == CIRCUITPY_DEBUG_UART_RX) { - self->is_debug = true; + + // On the console uart, enable pattern detection to look for CTRL+C + #if CIRCUITPY_CONSOLE_UART + if (rx == CIRCUITPY_CONSOLE_UART_RX) { + self->is_console = true; uart_enable_pattern_det_baud_intr(self->uart_num, CHAR_CTRL_C, 1, 1, 0, 0); } #endif + // Start a task to listen for uart events xTaskCreatePinnedToCore( uart_event_task, @@ -176,55 +180,62 @@ void common_hal_busio_uart_construct(busio_uart_obj_t *self, CONFIG_PTHREAD_TASK_PRIO_DEFAULT, &self->event_task, xPortGetCoreID()); - uart_set_hw_flow_ctrl(self->uart_num, flow_control, rx_threshold); + // uart_set_hw_flow_ctrl(self->uart_num, uart_config.flow_control, uart_config.rx_flow_ctrl_thresh); // Set baud rate - common_hal_busio_uart_set_baudrate(self, baudrate); + // common_hal_busio_uart_set_baudrate(self, baudrate); + uart_config.baud_rate = baudrate; - uart_word_length_t word_length = UART_DATA_8_BITS; + uart_config.data_bits = UART_DATA_8_BITS; switch (bits) { // Shared bindings prevents data < 7 bits. // case 5: - // word_length = UART_DATA_5_BITS; + // uart_config.data_bits = UART_DATA_5_BITS; // break; // case 6: - // word_length = UART_DATA_6_BITS; + // uart_config.data_bits = UART_DATA_6_BITS; // break; case 7: - word_length = UART_DATA_7_BITS; + uart_config.data_bits = UART_DATA_7_BITS; break; case 8: - word_length = UART_DATA_8_BITS; + uart_config.data_bits = UART_DATA_8_BITS; break; default: // Won't hit this because shared-bindings limits to 7-9 bits. We error on 9 above. break; } - uart_set_word_length(self->uart_num, word_length); + // uart_set_word_length(self->uart_num, uart_config.data_bits); - uart_parity_t parity_mode = UART_PARITY_DISABLE; + uart_config.parity = UART_PARITY_DISABLE; switch (parity) { case BUSIO_UART_PARITY_NONE: - parity_mode = UART_PARITY_DISABLE; + uart_config.parity = UART_PARITY_DISABLE; break; case BUSIO_UART_PARITY_EVEN: - parity_mode = UART_PARITY_EVEN; + uart_config.parity = UART_PARITY_EVEN; break; case BUSIO_UART_PARITY_ODD: - parity_mode = UART_PARITY_ODD; + uart_config.parity = UART_PARITY_ODD; break; default: // Won't reach here because the input is an enum that is completely handled. break; } - uart_set_parity(self->uart_num, parity_mode); + // uart_set_parity(self->uart_num, uart_config.parity); // Stop is 1 or 2 always. - uart_stop_bits_t stop_bits = UART_STOP_BITS_1; + uart_config.stop_bits = UART_STOP_BITS_1; if (stop == 2) { - stop_bits = UART_STOP_BITS_2; + uart_config.stop_bits = UART_STOP_BITS_2; + } + // uart_set_stop_bits(self->uart_num, stop_bits); + uart_config.source_clk = UART_SCLK_APB; // guessing here... + + // config all in one? + if (uart_param_config(self->uart_num, &uart_config) != ESP_OK) { + mp_raise_RuntimeError(translate("UART init")); } - uart_set_stop_bits(self->uart_num, stop_bits); self->tx_pin = NULL; self->rx_pin = NULL; @@ -265,7 +276,7 @@ void common_hal_busio_uart_construct(busio_uart_obj_t *self, rts_num = rs485_dir->number; } if (uart_set_pin(self->uart_num, tx_num, rx_num, rts_num, cts_num) != ESP_OK) { - mp_raise_ValueError(translate("Invalid pins")); + raise_ValueError_invalid_pins(); } } @@ -376,7 +387,7 @@ uint32_t common_hal_busio_uart_get_baudrate(busio_uart_obj_t *self) { void common_hal_busio_uart_set_baudrate(busio_uart_obj_t *self, uint32_t baudrate) { if (baudrate > UART_BITRATE_MAX || uart_set_baudrate(self->uart_num, baudrate) != ESP_OK) { - mp_raise_ValueError(translate("Unsupported baudrate")); + mp_arg_error_invalid(MP_QSTR_baudrate); } } diff --git a/ports/espressif/common-hal/busio/UART.h b/ports/espressif/common-hal/busio/UART.h index cd2dcc4d57..4880346015 100644 --- a/ports/espressif/common-hal/busio/UART.h +++ b/ports/espressif/common-hal/busio/UART.h @@ -46,7 +46,7 @@ typedef struct { uint8_t character_bits; bool rx_error; uint32_t timeout_ms; - bool is_debug; + bool is_console; QueueHandle_t event_queue; TaskHandle_t event_task; } busio_uart_obj_t; diff --git a/ports/espressif/common-hal/canio/CAN.c b/ports/espressif/common-hal/canio/CAN.c index fb2e35f1b1..67cf7b9591 100644 --- a/ports/espressif/common-hal/canio/CAN.c +++ b/ports/espressif/common-hal/canio/CAN.c @@ -76,30 +76,42 @@ STATIC twai_timing_config_t get_t_config(int baudrate) { twai_timing_config_t t_config = TWAI_TIMING_CONFIG_25KBITS(); return t_config; } + #if defined(TWAI_TIMING_CONFIG_20KBITS) case 20000: { twai_timing_config_t t_config = TWAI_TIMING_CONFIG_20KBITS(); return t_config; } + #endif + #if defined(TWAI_TIMING_CONFIG_16KBITS) case 16000: { twai_timing_config_t t_config = TWAI_TIMING_CONFIG_16KBITS(); return t_config; } + #endif + #if defined(TWAI_TIMING_CONFIG_12_5KBITS) case 12500: { twai_timing_config_t t_config = TWAI_TIMING_CONFIG_12_5KBITS(); return t_config; } + #endif + #if defined(TWAI_TIMING_CONFIG_10KBITS) case 10000: { twai_timing_config_t t_config = TWAI_TIMING_CONFIG_10KBITS(); return t_config; } + #endif + #if defined(TWAI_TIMING_CONFIG_5KBITS) case 5000: { twai_timing_config_t t_config = TWAI_TIMING_CONFIG_5KBITS(); return t_config; } + #endif + #if defined(TWAI_TIMING_CONFIG_1KBITS) case 1000: { twai_timing_config_t t_config = TWAI_TIMING_CONFIG_1KBITS(); return t_config; } + #endif default: mp_raise_ValueError(translate("Baudrate not supported by peripheral")); } @@ -133,7 +145,7 @@ void common_hal_canio_can_construct(canio_can_obj_t *self, const mcu_pin_obj_t * if (result == ESP_ERR_NO_MEM) { mp_raise_msg(&mp_type_MemoryError, translate("ESP-IDF memory allocation failed")); } else if (result == ESP_ERR_INVALID_ARG) { - mp_raise_ValueError(translate("Invalid pins")); + raise_ValueError_invalid_pins(); } else if (result != ESP_OK) { mp_raise_OSError_msg_varg(translate("twai_driver_install returned esp-idf error #%d"), (int)result); } diff --git a/ports/espressif/common-hal/countio/Counter.c b/ports/espressif/common-hal/countio/Counter.c index d18196051f..cc4c067266 100644 --- a/ports/espressif/common-hal/countio/Counter.c +++ b/ports/espressif/common-hal/countio/Counter.c @@ -29,14 +29,14 @@ #include "common-hal/microcontroller/Pin.h" #include "py/runtime.h" -#include "supervisor/shared/translate.h" +#include "supervisor/shared/translate/translate.h" void common_hal_countio_counter_construct(countio_counter_obj_t *self, const mcu_pin_obj_t *pin, countio_edge_t edge, digitalio_pull_t pull) { claim_pin(pin); // Prepare configuration for the PCNT unit - const pcnt_config_t pcnt_config = { + pcnt_config_t pcnt_config = { // Set PCNT input signal and control GPIOs .pulse_gpio_num = pin->number, .ctrl_gpio_num = PCNT_PIN_NOT_USED, @@ -48,7 +48,7 @@ void common_hal_countio_counter_construct(countio_counter_obj_t *self, }; // Initialize PCNT unit - const int8_t 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")); } diff --git a/ports/espressif/common-hal/digitalio/DigitalInOut.c b/ports/espressif/common-hal/digitalio/DigitalInOut.c index 1ab232b29a..61671dadb9 100644 --- a/ports/espressif/common-hal/digitalio/DigitalInOut.c +++ b/ports/espressif/common-hal/digitalio/DigitalInOut.c @@ -26,12 +26,26 @@ #include "shared-bindings/digitalio/DigitalInOut.h" #include "py/runtime.h" -#include "supervisor/shared/translate.h" +#include "supervisor/shared/translate/translate.h" #include "components/driver/include/driver/gpio.h" #include "components/hal/include/hal/gpio_hal.h" +STATIC bool _pin_is_input(uint8_t pin_number) { + const uint32_t iomux = READ_PERI_REG(GPIO_PIN_MUX_REG[pin_number]); + return (iomux & FUN_IE) != 0; +} + +void digitalio_digitalinout_preserve_for_deep_sleep(size_t n_dios, digitalio_digitalinout_obj_t *preserve_dios[]) { + // Mark the pin states of the given DigitalInOuts for preservation during deep sleep + for (size_t i = 0; i < n_dios; i++) { + if (!common_hal_digitalio_digitalinout_deinited(preserve_dios[i])) { + preserve_pin_number(preserve_dios[i]->pin->number); + } + } +} + void common_hal_digitalio_digitalinout_never_reset( digitalio_digitalinout_obj_t *self) { never_reset_pin_number(self->pin->number); @@ -68,10 +82,11 @@ void common_hal_digitalio_digitalinout_deinit(digitalio_digitalinout_obj_t *self self->pin = NULL; } -void common_hal_digitalio_digitalinout_switch_to_input( +digitalinout_result_t common_hal_digitalio_digitalinout_switch_to_input( digitalio_digitalinout_obj_t *self, digitalio_pull_t pull) { common_hal_digitalio_digitalinout_set_pull(self, pull); gpio_set_direction(self->pin->number, GPIO_MODE_INPUT); + return DIGITALINOUT_OK; } digitalinout_result_t common_hal_digitalio_digitalinout_switch_to_output( @@ -83,8 +98,7 @@ digitalinout_result_t common_hal_digitalio_digitalinout_switch_to_output( digitalio_direction_t common_hal_digitalio_digitalinout_get_direction( digitalio_digitalinout_obj_t *self) { - uint32_t iomux = READ_PERI_REG(GPIO_PIN_MUX_REG[self->pin->number]); - if ((iomux & FUN_IE) != 0) { + if (_pin_is_input(self->pin->number)) { return DIRECTION_INPUT; } return DIRECTION_OUTPUT; @@ -127,7 +141,7 @@ digitalio_drive_mode_t common_hal_digitalio_digitalinout_get_drive_mode( return DRIVE_MODE_PUSH_PULL; } -void common_hal_digitalio_digitalinout_set_pull( +digitalinout_result_t common_hal_digitalio_digitalinout_set_pull( digitalio_digitalinout_obj_t *self, digitalio_pull_t pull) { gpio_num_t number = self->pin->number; gpio_pullup_dis(number); @@ -137,6 +151,7 @@ void common_hal_digitalio_digitalinout_set_pull( } else if (pull == PULL_DOWN) { gpio_pulldown_en(number); } + return DIGITALINOUT_OK; } digitalio_pull_t common_hal_digitalio_digitalinout_get_pull( diff --git a/ports/espressif/common-hal/digitalio/DigitalInOut.h b/ports/espressif/common-hal/digitalio/DigitalInOut.h index 2d42e79809..793d2a0986 100644 --- a/ports/espressif/common-hal/digitalio/DigitalInOut.h +++ b/ports/espressif/common-hal/digitalio/DigitalInOut.h @@ -36,4 +36,6 @@ typedef struct { bool output_value; } digitalio_digitalinout_obj_t; +extern void digitalio_digitalinout_preserve_for_deep_sleep(size_t n_dios, digitalio_digitalinout_obj_t *preserve_dios[]); + #endif // MICROPY_INCLUDED_ESPRESSIF_COMMON_HAL_DIGITALIO_DIGITALINOUT_H diff --git a/ports/espressif/common-hal/esp32_camera/Camera.c b/ports/espressif/common-hal/esp32_camera/Camera.c new file mode 100644 index 0000000000..65d2d0fbc6 --- /dev/null +++ b/ports/espressif/common-hal/esp32_camera/Camera.c @@ -0,0 +1,314 @@ +/* + * This file is part of the MicroPython project, http://micropython.org/ + * + * The MIT License (MIT) + * + * Copyright (c) 2022 Jeff Epler for Adafruit Industries + * + * Permission is hereby granted, free of charge, to any person obtaining a copy + * of this software and associated documentation files (the "Software"), to deal + * in the Software without restriction, including without limitation the rights + * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell + * copies of the Software, and to permit persons to whom the Software is + * furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice shall be included in + * all copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE + * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER + * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, + * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN + * THE SOFTWARE. + */ + +#include "py/mperrno.h" +#include "py/runtime.h" + +#include "bindings/esp32_camera/Camera.h" +#include "bindings/espidf/__init__.h" +#include "common-hal/esp32_camera/Camera.h" +#include "shared-bindings/busio/I2C.h" +#include "shared-bindings/microcontroller/Pin.h" +#include "shared-bindings/util.h" +#include "common-hal/microcontroller/Pin.h" + +#include "esp32-camera/driver/private_include/cam_hal.h" + +#if !CONFIG_SPIRAM +#error esp32_camera only works on boards configured with spiram, disable it in mpconfigboard.mk +#endif + +static void i2c_lock(esp32_camera_camera_obj_t *self) { + if (common_hal_busio_i2c_deinited(self->i2c)) { + raise_deinited_error(); + } + if (!common_hal_busio_i2c_try_lock(self->i2c)) { + mp_raise_OSError(MP_EWOULDBLOCK); + } +} + +static void i2c_unlock(esp32_camera_camera_obj_t *self) { + common_hal_busio_i2c_unlock(self->i2c); +} + +static void maybe_claim_pin(const mcu_pin_obj_t *pin) { + if (pin) { + claim_pin(pin); + } +} + +void common_hal_esp32_camera_camera_construct( + esp32_camera_camera_obj_t *self, + uint8_t data_pins[8], + const mcu_pin_obj_t *external_clock_pin, + const mcu_pin_obj_t *pixel_clock_pin, + const mcu_pin_obj_t *vsync_pin, + const mcu_pin_obj_t *href_pin, + const mcu_pin_obj_t *powerdown_pin, + const mcu_pin_obj_t *reset_pin, + busio_i2c_obj_t *i2c, + mp_int_t external_clock_frequency, + pixformat_t pixel_format, + framesize_t frame_size, + mp_int_t jpeg_quality, + mp_int_t framebuffer_count, + camera_grab_mode_t grab_mode) { + + if (common_hal_espidf_get_reserved_psram() == 0) { + mp_raise_msg(&mp_type_MemoryError, translate( + "esp32_camera.Camera requires reserved PSRAM to be configured. " + "See the documentation for instructions.")); + } + for (int i = 0; i < 8; i++) { + claim_pin_number(data_pins[i]); + } + claim_pin(external_clock_pin); + claim_pin(pixel_clock_pin); + claim_pin(vsync_pin); + claim_pin(href_pin); + maybe_claim_pin(powerdown_pin); + maybe_claim_pin(reset_pin); + + common_hal_pwmio_pwmout_construct(&self->pwm, external_clock_pin, 1, external_clock_frequency, true); + + self->i2c = i2c; + + self->camera_config.pin_pwdn = common_hal_mcu_pin_number(powerdown_pin); + self->camera_config.pin_reset = common_hal_mcu_pin_number(reset_pin); + self->camera_config.pin_xclk = common_hal_mcu_pin_number(external_clock_pin); + + self->camera_config.pin_sccb_sda = NO_PIN; + self->camera_config.pin_sccb_scl = NO_PIN; + /* sccb i2c port set below */ + + self->camera_config.pin_d7 = data_pins[7]; + self->camera_config.pin_d6 = data_pins[6]; + self->camera_config.pin_d5 = data_pins[5]; + self->camera_config.pin_d4 = data_pins[4]; + self->camera_config.pin_d3 = data_pins[3]; + self->camera_config.pin_d2 = data_pins[2]; + self->camera_config.pin_d1 = data_pins[1]; + self->camera_config.pin_d0 = data_pins[0]; + + self->camera_config.pin_vsync = common_hal_mcu_pin_number(vsync_pin); + self->camera_config.pin_href = common_hal_mcu_pin_number(href_pin); + self->camera_config.pin_pclk = common_hal_mcu_pin_number(pixel_clock_pin); + + self->camera_config.xclk_freq_hz = external_clock_frequency; + + self->camera_config.ledc_timer = self->pwm.tim_handle.timer_num; + self->camera_config.ledc_channel = self->pwm.chan_handle.channel; + + self->camera_config.pixel_format = pixel_format; + self->camera_config.frame_size = frame_size; + self->camera_config.jpeg_quality = jpeg_quality; + self->camera_config.fb_count = framebuffer_count; + self->camera_config.grab_mode = grab_mode; + + self->camera_config.sccb_i2c_port = i2c->i2c_num; + + i2c_lock(self); + esp_err_t result = esp_camera_init(&self->camera_config); + i2c_unlock(self); + + CHECK_ESP_RESULT(result); +} + +extern void common_hal_esp32_camera_camera_deinit(esp32_camera_camera_obj_t *self) { + if (common_hal_esp32_camera_camera_deinited(self)) { + return; + } + + common_hal_pwmio_pwmout_deinit(&self->pwm); + + reset_pin_number(self->camera_config.pin_pwdn); + reset_pin_number(self->camera_config.pin_reset); + reset_pin_number(self->camera_config.pin_xclk); + + reset_pin_number(self->camera_config.pin_d7); + reset_pin_number(self->camera_config.pin_d6); + reset_pin_number(self->camera_config.pin_d5); + reset_pin_number(self->camera_config.pin_d4); + reset_pin_number(self->camera_config.pin_d3); + reset_pin_number(self->camera_config.pin_d2); + reset_pin_number(self->camera_config.pin_d1); + reset_pin_number(self->camera_config.pin_d0); + + esp_camera_deinit(); + + self->camera_config.xclk_freq_hz = 0; +} + +bool common_hal_esp32_camera_camera_deinited(esp32_camera_camera_obj_t *self) { + return !self->camera_config.xclk_freq_hz; +} + +bool common_hal_esp32_camera_camera_available(esp32_camera_camera_obj_t *self) { + return esp_camera_fb_available(); +} + +camera_fb_t *common_hal_esp32_camera_camera_take(esp32_camera_camera_obj_t *self, int timeout_ms) { + if (self->buffer_to_return) { + esp_camera_fb_return(self->buffer_to_return); + self->buffer_to_return = NULL; + } + return self->buffer_to_return = esp_camera_fb_get_timeout(timeout_ms); +} + +#define SENSOR_GETSET(type, name, field_name, setter_function_name) \ + SENSOR_GET(type, name, field_name, setter_function_name) \ + SENSOR_SET(type, name, setter_function_name) + +#define SENSOR_STATUS_GETSET(type, name, status_field_name, setter_function_name) \ + SENSOR_GETSET(type, name, status.status_field_name, setter_function_name) + +#define SENSOR_GET(type, name, status_field_name, setter_function_name) \ + type common_hal_esp32_camera_camera_get_##name(esp32_camera_camera_obj_t * self) { \ + i2c_lock(self); \ + sensor_t *sensor = esp_camera_sensor_get(); \ + i2c_unlock(self); \ + if (!sensor->setter_function_name) { \ + mp_raise_AttributeError(translate("no such attribute")); \ + } \ + return sensor->status_field_name; \ + } + +#define SENSOR_SET(type, name, setter_function_name) \ + void common_hal_esp32_camera_camera_set_##name(esp32_camera_camera_obj_t * self, type value) { \ + i2c_lock(self); \ + sensor_t *sensor = esp_camera_sensor_get(); \ + i2c_unlock(self); \ + if (!sensor->setter_function_name) { \ + mp_raise_AttributeError(translate("no such attribute")); \ + } \ + if (sensor->setter_function_name(sensor, value) < 0) { \ + mp_raise_ValueError(translate("invalid setting")); \ + } \ + } + +pixformat_t common_hal_esp32_camera_camera_get_pixel_format(esp32_camera_camera_obj_t *self) { + return self->camera_config.pixel_format; +} + +framesize_t common_hal_esp32_camera_camera_get_frame_size(esp32_camera_camera_obj_t *self) { + return self->camera_config.frame_size; +} + +void common_hal_esp32_camera_camera_reconfigure(esp32_camera_camera_obj_t *self, framesize_t frame_size, pixformat_t pixel_format, camera_grab_mode_t grab_mode, mp_int_t framebuffer_count) { + sensor_t *sensor = esp_camera_sensor_get(); + camera_sensor_info_t *sensor_info = esp_camera_sensor_get_info(&sensor->id); + + if (PIXFORMAT_JPEG == pixel_format && (!sensor_info->support_jpeg)) { + raise_esp_error(ESP_ERR_NOT_SUPPORTED); + } + + if (frame_size > sensor_info->max_size) { + frame_size = sensor_info->max_size; + } + + i2c_lock(self); + cam_deinit(); + self->camera_config.pixel_format = pixel_format; + self->camera_config.frame_size = frame_size; + self->camera_config.grab_mode = grab_mode; + self->camera_config.fb_count = framebuffer_count; + sensor->set_pixformat(sensor, self->camera_config.pixel_format); + sensor->set_framesize(sensor, self->camera_config.frame_size); + cam_init(&self->camera_config); + cam_config(&self->camera_config, frame_size, sensor_info->pid); + i2c_unlock(self); + cam_start(); +} + +SENSOR_STATUS_GETSET(int, contrast, contrast, set_contrast); +SENSOR_STATUS_GETSET(int, brightness, brightness, set_brightness); +SENSOR_STATUS_GETSET(int, saturation, saturation, set_saturation); +SENSOR_STATUS_GETSET(int, sharpness, sharpness, set_sharpness); +SENSOR_STATUS_GETSET(int, denoise, denoise, set_denoise); +SENSOR_STATUS_GETSET(gainceiling_t, gainceiling, gainceiling, set_gainceiling); +SENSOR_STATUS_GETSET(int, quality, quality, set_quality); +SENSOR_STATUS_GETSET(bool, colorbar, colorbar, set_colorbar); +SENSOR_STATUS_GETSET(bool, whitebal, awb, set_whitebal); +SENSOR_STATUS_GETSET(bool, gain_ctrl, agc, set_gain_ctrl); +SENSOR_STATUS_GETSET(bool, exposure_ctrl, aec, set_exposure_ctrl); +SENSOR_STATUS_GETSET(bool, hmirror, hmirror, set_hmirror); +SENSOR_STATUS_GETSET(bool, vflip, vflip, set_vflip); +SENSOR_STATUS_GETSET(bool, aec2, aec2, set_aec2); +SENSOR_STATUS_GETSET(bool, awb_gain, awb_gain, set_awb_gain); +SENSOR_STATUS_GETSET(int, agc_gain, agc_gain, set_agc_gain); +SENSOR_STATUS_GETSET(int, aec_value, aec_value, set_aec_value); +SENSOR_STATUS_GETSET(int, special_effect, special_effect, set_special_effect); +SENSOR_STATUS_GETSET(int, wb_mode, wb_mode, set_wb_mode); +SENSOR_STATUS_GETSET(int, ae_level, ae_level, set_ae_level); +SENSOR_STATUS_GETSET(bool, dcw, dcw, set_dcw); +SENSOR_STATUS_GETSET(bool, bpc, bpc, set_bpc); +SENSOR_STATUS_GETSET(bool, wpc, wpc, set_wpc); +SENSOR_STATUS_GETSET(bool, raw_gma, raw_gma, set_raw_gma); +SENSOR_STATUS_GETSET(bool, lenc, lenc, set_lenc); + +const char *common_hal_esp32_camera_camera_get_sensor_name(esp32_camera_camera_obj_t *self) { + sensor_t *sensor = esp_camera_sensor_get(); + camera_sensor_info_t *sensor_info = esp_camera_sensor_get_info(&sensor->id); + return sensor_info->name; +} + +const bool common_hal_esp32_camera_camera_get_supports_jpeg(esp32_camera_camera_obj_t *self) { + sensor_t *sensor = esp_camera_sensor_get(); + camera_sensor_info_t *sensor_info = esp_camera_sensor_get_info(&sensor->id); + return sensor_info->support_jpeg; +} + +const framesize_t common_hal_esp32_camera_camera_get_max_frame_size(esp32_camera_camera_obj_t *self) { + sensor_t *sensor = esp_camera_sensor_get(); + camera_sensor_info_t *sensor_info = esp_camera_sensor_get_info(&sensor->id); + return sensor_info->max_size; +} + +const int common_hal_esp32_camera_camera_get_address(esp32_camera_camera_obj_t *self) { + sensor_t *sensor = esp_camera_sensor_get(); + camera_sensor_info_t *sensor_info = esp_camera_sensor_get_info(&sensor->id); + return sensor_info->sccb_addr; +} + +const int common_hal_esp32_camera_camera_get_width(esp32_camera_camera_obj_t *self) { + sensor_t *sensor = esp_camera_sensor_get(); + framesize_t framesize = sensor->status.framesize; + return resolution[framesize].width; +} + +const int common_hal_esp32_camera_camera_get_height(esp32_camera_camera_obj_t *self) { + sensor_t *sensor = esp_camera_sensor_get(); + framesize_t framesize = sensor->status.framesize; + return resolution[framesize].height; +} + +const camera_grab_mode_t common_hal_esp32_camera_camera_get_grab_mode(esp32_camera_camera_obj_t *self) { + return self->camera_config.grab_mode; +} + +const int common_hal_esp32_camera_camera_get_framebuffer_count(esp32_camera_camera_obj_t *self) { + return self->camera_config.fb_count; +} diff --git a/ports/espressif/common-hal/esp32_camera/Camera.h b/ports/espressif/common-hal/esp32_camera/Camera.h new file mode 100644 index 0000000000..4f34fa54cd --- /dev/null +++ b/ports/espressif/common-hal/esp32_camera/Camera.h @@ -0,0 +1,40 @@ +/* + * This file is part of the MicroPython project, http://micropython.org/ + * + * The MIT License (MIT) + * + * Copyright (c) 2022 Jeff Epler for Adafruit Industries + * + * Permission is hereby granted, free of charge, to any person obtaining a copy + * of this software and associated documentation files (the "Software"), to deal + * in the Software without restriction, including without limitation the rights + * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell + * copies of the Software, and to permit persons to whom the Software is + * furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice shall be included in + * all copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE + * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER + * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, + * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN + * THE SOFTWARE. + */ + +#pragma once + +#include "py/obj.h" +#include "esp_camera.h" +#include "shared-bindings/pwmio/PWMOut.h" +#include "common-hal/busio/I2C.h" + +typedef struct esp32_camera_camera_obj { + mp_obj_base_t base; + camera_config_t camera_config; + camera_fb_t *buffer_to_return; + pwmio_pwmout_obj_t pwm; + busio_i2c_obj_t *i2c; +} esp32_camera_obj_t; diff --git a/ports/espressif/common-hal/espidf/__init__.c b/ports/espressif/common-hal/espidf/__init__.c new file mode 100644 index 0000000000..183ebb3817 --- /dev/null +++ b/ports/espressif/common-hal/espidf/__init__.c @@ -0,0 +1,194 @@ +/* + * This file is part of the MicroPython project, http://micropython.org/ + * + * The MIT License (MIT) + * + * Copyright (c) 2022 Jeff Epler for Adafruit Industries + * + * Permission is hereby granted, free of charge, to any person obtaining a copy + * of this software and associated documentation files (the "Software"), to deal + * in the Software without restriction, including without limitation the rights + * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell + * copies of the Software, and to permit persons to whom the Software is + * furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice shall be included in + * all copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE + * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER + * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, + * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN + * THE SOFTWARE. + */ + +#include "bindings/espidf/__init__.h" +#include "supervisor/shared/translate/translate.h" +#include "supervisor/memory.h" +#include "py/runtime.h" + +#include "esp_log.h" +#define TAG "espidf" + +#ifdef CONFIG_SPIRAM +#include "esp32/spiram.h" +#include "esp_heap_caps.h" +#include "esp_heap_caps_init.h" +#include "soc/soc.h" +#ifdef CONFIG_IDF_TARGET_ESP32 +#include "esp32/himem.h" +#else +#define esp_himem_reserved_area_size() (0) +#endif +bool ok_to_reserve_psram = true; +size_t reserved_psram = DEFAULT_RESERVED_PSRAM; +#endif + +static size_t psram_size_usable(void) { + #ifdef CONFIG_SPIRAM + /* PSRAM chip may be larger than the size we can map into address space */ + size_t s = MIN(esp_spiram_get_size(), SOC_EXTRAM_DATA_SIZE); + return s - esp_himem_reserved_area_size(); + #else + return 0; + #endif +} + +bool common_hal_espidf_set_reserved_psram(size_t amount) { + #ifdef CONFIG_SPIRAM + if (!esp_spiram_is_initialized()) { + return false; + } + if (!ok_to_reserve_psram) { + return false; + } + if (amount > psram_size_usable()) { + return false; + } + reserved_psram = amount; + return true; + #else + return false; + #endif +} + +supervisor_allocation *psram_for_idf; + +void common_hal_espidf_reserve_psram(void) { + #ifdef CONFIG_SPIRAM + if (!psram_for_idf) { + ESP_LOGI(TAG, "Reserving %d bytes of psram", reserved_psram); + if (reserved_psram == 0) { + return; + } + psram_for_idf = allocate_memory(reserved_psram, true, false); + if (psram_for_idf) { + intptr_t psram_for_idf_start = (intptr_t)psram_for_idf->ptr; + intptr_t psram_for_idf_end = psram_for_idf_start + reserved_psram; + ESP_LOGI(TAG, "Reserved %x..%x", psram_for_idf_start, psram_for_idf_end); + heap_caps_add_region(psram_for_idf_start, psram_for_idf_end); + } else { + ESP_LOGE(TAG, "supervisor allocation failed"); + } + } + #endif +} + +size_t common_hal_espidf_get_reserved_psram(void) { + #ifdef CONFIG_SPIRAM + return reserved_psram; + #else + return 0; + #endif +} + +size_t common_hal_espidf_get_total_psram(void) { + return psram_size_usable(); +} + +intptr_t common_hal_espidf_get_psram_start(void) { + #ifdef CONFIG_SPIRAM + if (esp_spiram_is_initialized()) { + #ifdef CONFIG_IDF_TARGET_ESP32 + return SOC_EXTRAM_DATA_LOW; + #else + return SOC_EXTRAM_DATA_HIGH - psram_size_usable(); + #endif + } + #endif + return 0; +} + +intptr_t common_hal_espidf_get_psram_end(void) { + #ifdef CONFIG_SPIRAM + if (esp_spiram_is_initialized()) { + return common_hal_espidf_get_psram_start() + psram_size_usable(); + } + #endif + return 0; +} + +void raise_esp_error(esp_err_t err) { + const compressed_string_t *msg = NULL; + const mp_obj_type_t *exception_type = &mp_type_espidf_IDFError; + switch (err) { + case ESP_FAIL: + msg = translate("Generic Failure"); + break; + case ESP_ERR_NO_MEM: + exception_type = &mp_type_espidf_MemoryError; + msg = translate("Out of memory"); + break; + case ESP_ERR_INVALID_ARG: + msg = translate("Invalid argument"); + break; + case ESP_ERR_INVALID_STATE: + msg = translate("Invalid state"); + break; + case ESP_ERR_INVALID_SIZE: + msg = translate("Invalid size"); + break; + case ESP_ERR_NOT_FOUND: + msg = translate("Requested resource not found"); + break; + case ESP_ERR_NOT_SUPPORTED: + msg = translate("Operation or feature not supported"); + break; + case ESP_ERR_TIMEOUT: + msg = translate("Operation timed out"); + break; + case ESP_ERR_INVALID_RESPONSE: + msg = translate("Received response was invalid"); + break; + case ESP_ERR_INVALID_CRC: + msg = translate("CRC or checksum was invalid"); + break; + case ESP_ERR_INVALID_VERSION: + msg = translate("Version was invalid"); + break; + case ESP_ERR_INVALID_MAC: + msg = translate("MAC address was invalid"); + break; + } + if (msg) { + mp_raise_msg(exception_type, msg); + } + + const char *group = "ESP-IDF"; + + // tests must be in descending order + MP_STATIC_ASSERT(ESP_ERR_FLASH_BASE > ESP_ERR_MESH_BASE); + MP_STATIC_ASSERT(ESP_ERR_MESH_BASE > ESP_ERR_WIFI_BASE); + if (err >= ESP_ERR_FLASH_BASE) { + group = "Flash"; + } else if (err >= ESP_ERR_MESH_BASE) { + group = "Mesh"; + } else if (err >= ESP_ERR_WIFI_BASE) { + group = "WiFi"; + } + mp_raise_msg_varg(exception_type, translate("%s error 0x%x"), group, err); +} + +MP_REGISTER_MODULE(MP_QSTR_espidf, espidf_module, CIRCUITPY_ESPIDF); diff --git a/ports/espressif/common-hal/espidf/__init__.h b/ports/espressif/common-hal/espidf/__init__.h new file mode 100644 index 0000000000..0d168b105c --- /dev/null +++ b/ports/espressif/common-hal/espidf/__init__.h @@ -0,0 +1,29 @@ +/* + * This file is part of the MicroPython project, http://micropython.org/ + * + * The MIT License (MIT) + * + * Copyright (c) 2022 Jeff Epler for Adafruit Industries + * + * Permission is hereby granted, free of charge, to any person obtaining a copy + * of this software and associated documentation files (the "Software"), to deal + * in the Software without restriction, including without limitation the rights + * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell + * copies of the Software, and to permit persons to whom the Software is + * furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice shall be included in + * all copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE + * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER + * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, + * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN + * THE SOFTWARE. + */ + +#pragma once + +#include "bindings/espidf/__init__.h" diff --git a/ports/espressif/common-hal/frequencyio/FrequencyIn.c b/ports/espressif/common-hal/frequencyio/FrequencyIn.c index e4d65c95bd..d35614ea19 100644 --- a/ports/espressif/common-hal/frequencyio/FrequencyIn.c +++ b/ports/espressif/common-hal/frequencyio/FrequencyIn.c @@ -55,21 +55,35 @@ static void IRAM_ATTR timer_interrupt_handler(void *self_in) { // reset interrupt timg_dev_t *device = self->timer.group ? &(TIMERG1) : &(TIMERG0); + + #if defined(CONFIG_IDF_TARGET_ESP32) + if (self->timer.idx) { + device->int_clr_timers.t1 = 1; + } else { + device->int_clr_timers.t0 = 1; + } + #else if (self->timer.idx) { device->int_clr_timers.t1_int_clr = 1; } else { device->int_clr_timers.t0_int_clr = 1; } - #ifdef CONFIG_IDF_TARGET_ESP32S2 + #endif + + #if defined(CONFIG_IDF_TARGET_ESP32) + device->hw_timer[self->timer.idx].config.alarm_en = 1; + #elif defined(CONFIG_IDF_TARGET_ESP32S2) || defined(CONFIG_IDF_TARGET_ESP32C2) device->hw_timer[self->timer.idx].config.tx_alarm_en = 1; #elif defined(CONFIG_IDF_TARGET_ESP32S3) device->hw_timer[self->timer.idx].config.tn_alarm_en = 1; + #else + #error No known CONFIG_IDF_TARGET_xxx found #endif } static void init_pcnt(frequencyio_frequencyin_obj_t *self) { // Prepare configuration for the PCNT unit - const pcnt_config_t pcnt_config = { + pcnt_config_t pcnt_config = { // Set PCNT input signal and control GPIOs .pulse_gpio_num = self->pin, .ctrl_gpio_num = PCNT_PIN_NOT_USED, @@ -83,7 +97,7 @@ static void init_pcnt(frequencyio_frequencyin_obj_t *self) { }; // initialize PCNT - const int8_t 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")); } @@ -130,9 +144,7 @@ static void init_timer(frequencyio_frequencyin_obj_t *self) { 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")); - } + mp_arg_validate_int_range(capture_period, 1, 500, MP_QSTR_capture_period); self->pin = pin->number; self->handle = NULL; @@ -188,9 +200,8 @@ uint16_t common_hal_frequencyio_frequencyin_get_capture_period(frequencyio_frequ } 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")); - } + mp_arg_validate_int_range(capture_period, 1, 500, MP_QSTR_capture_period); + self->capture_period = capture_period; common_hal_frequencyio_frequencyin_clear(self); timer_set_alarm_value(self->timer.group, self->timer.idx, capture_period * 1000000); diff --git a/shared-module/gamepadshift/__init__.c b/ports/espressif/common-hal/hashlib/Hash.c similarity index 53% rename from shared-module/gamepadshift/__init__.c rename to ports/espressif/common-hal/hashlib/Hash.c index eadd3034f6..8090128acb 100644 --- a/shared-module/gamepadshift/__init__.c +++ b/ports/espressif/common-hal/hashlib/Hash.c @@ -3,7 +3,7 @@ * * The MIT License (MIT) * - * Copyright (c) 2019 Scott Shawcroft + * Copyright (c) 2022 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 @@ -24,34 +24,34 @@ * THE SOFTWARE. */ -#include "shared-module/gamepadshift/__init__.h" +#include "shared-bindings/hashlib/Hash.h" -#include "py/mpstate.h" -#include "shared-bindings/gamepadshift/GamePadShift.h" +#include "components/mbedtls/mbedtls/include/mbedtls/ssl.h" -void gamepadshift_tick(void) { - void *singleton = MP_STATE_VM(gamepad_singleton); - if (singleton == NULL || !mp_obj_is_type(MP_OBJ_FROM_PTR(singleton), &gamepadshift_type)) { +void common_hal_hashlib_hash_update(hashlib_hash_obj_t *self, const uint8_t *data, size_t datalen) { + if (self->hash_type == MBEDTLS_SSL_HASH_SHA1) { + mbedtls_sha1_update_ret(&self->sha1, data, datalen); return; } +} - gamepadshift_obj_t *self = MP_OBJ_TO_PTR(singleton); - uint8_t current = 0; - uint8_t bit = 1; - common_hal_digitalio_digitalinout_set_value(self->latch_pin, 1); - for (int i = 0; i < 8; ++i) { - common_hal_digitalio_digitalinout_set_value(self->clock_pin, 0); - if (common_hal_digitalio_digitalinout_get_value(self->data_pin)) { - current |= bit; - } - common_hal_digitalio_digitalinout_set_value(self->clock_pin, 1); - bit <<= 1; +void common_hal_hashlib_hash_digest(hashlib_hash_obj_t *self, uint8_t *data, size_t datalen) { + if (datalen < common_hal_hashlib_hash_get_digest_size(self)) { + return; + } + if (self->hash_type == MBEDTLS_SSL_HASH_SHA1) { + // We copy the sha1 state so we can continue to update if needed or get + // the digest a second time. + mbedtls_sha1_context copy; + mbedtls_sha1_clone(©, &self->sha1); + mbedtls_sha1_finish_ret(&self->sha1, data); + mbedtls_sha1_clone(&self->sha1, ©); } - common_hal_digitalio_digitalinout_set_value(self->latch_pin, 0); - self->pressed |= self->last & current; - self->last = current; } -void gamepadshift_reset(void) { - MP_STATE_VM(gamepad_singleton) = NULL; +size_t common_hal_hashlib_hash_get_digest_size(hashlib_hash_obj_t *self) { + if (self->hash_type == MBEDTLS_SSL_HASH_SHA1) { + return 20; + } + return 0; } diff --git a/ports/espressif/common-hal/hashlib/Hash.h b/ports/espressif/common-hal/hashlib/Hash.h new file mode 100644 index 0000000000..ece282833e --- /dev/null +++ b/ports/espressif/common-hal/hashlib/Hash.h @@ -0,0 +1,41 @@ +/* + * This file is part of the MicroPython project, http://micropython.org/ + * + * The MIT License (MIT) + * + * Copyright (c) 2022 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_ESPRESSIF_COMMON_HAL_HASHLIB_HASH_H +#define MICROPY_INCLUDED_ESPRESSIF_COMMON_HAL_HASHLIB_HASH_H + +#include "components/mbedtls/mbedtls/include/mbedtls/sha1.h" + +typedef struct { + mp_obj_base_t base; + union { + mbedtls_sha1_context sha1; + }; + // Of MBEDTLS_SSL_HASH_* + uint8_t hash_type; +} hashlib_hash_obj_t; + +#endif // MICROPY_INCLUDED_ESPRESSIF_COMMON_HAL_HASHLIB_HASH_H diff --git a/ports/espressif/common-hal/hashlib/__init__.c b/ports/espressif/common-hal/hashlib/__init__.c new file mode 100644 index 0000000000..1e6b2a4802 --- /dev/null +++ b/ports/espressif/common-hal/hashlib/__init__.c @@ -0,0 +1,40 @@ +/* + * This file is part of the MicroPython project, http://micropython.org/ + * + * The MIT License (MIT) + * + * Copyright (c) 2022 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 "shared-bindings/hashlib/__init__.h" + +#include "components/mbedtls/mbedtls/include/mbedtls/ssl.h" + + +bool common_hal_hashlib_new(hashlib_hash_obj_t *self, const char *algorithm) { + if (strcmp(algorithm, "sha1") == 0) { + self->hash_type = MBEDTLS_SSL_HASH_SHA1; + mbedtls_sha1_init(&self->sha1); + mbedtls_sha1_starts_ret(&self->sha1); + return true; + } + return false; +} diff --git a/ports/espressif/common-hal/i2cperipheral/__init__.c b/ports/espressif/common-hal/i2cperipheral/__init__.c deleted file mode 100644 index c67511c536..0000000000 --- a/ports/espressif/common-hal/i2cperipheral/__init__.c +++ /dev/null @@ -1 +0,0 @@ -// No i2cperipheral module functions. diff --git a/ports/espressif/common-hal/i2cperipheral/I2CPeripheral.c b/ports/espressif/common-hal/i2ctarget/I2CTarget.c similarity index 75% rename from ports/espressif/common-hal/i2cperipheral/I2CPeripheral.c rename to ports/espressif/common-hal/i2ctarget/I2CTarget.c index d073a8a362..ad0d09967a 100644 --- a/ports/espressif/common-hal/i2cperipheral/I2CPeripheral.c +++ b/ports/espressif/common-hal/i2ctarget/I2CTarget.c @@ -24,14 +24,15 @@ * THE SOFTWARE. */ -#include "shared-bindings/i2cperipheral/I2CPeripheral.h" +#include "shared-bindings/i2ctarget/I2CTarget.h" #include "py/mperrno.h" #include "py/runtime.h" -#include "common-hal/i2cperipheral/I2CPeripheral.h" +#include "common-hal/i2ctarget/I2CTarget.h" +#include "shared-bindings/microcontroller/Pin.h" -void common_hal_i2cperipheral_i2c_peripheral_construct(i2cperipheral_i2c_peripheral_obj_t *self, +void common_hal_i2ctarget_i2c_target_construct(i2ctarget_i2c_target_obj_t *self, const mcu_pin_obj_t *scl, const mcu_pin_obj_t *sda, uint8_t *addresses, unsigned int num_addresses, bool smbus) { // Pins 45 and 46 are "strapping" pins that impact start up behavior. They usually need to @@ -39,7 +40,7 @@ void common_hal_i2cperipheral_i2c_peripheral_construct(i2cperipheral_i2c_periphe // support I2C on these pins. // Also 46 is input-only so it'll never work. if (scl->number == 45 || scl->number == 46 || sda->number == 45 || sda->number == 46) { - mp_raise_ValueError(translate("Invalid pins")); + raise_ValueError_invalid_pins(); } if (num_addresses > 1) { @@ -72,7 +73,7 @@ void common_hal_i2cperipheral_i2c_peripheral_construct(i2cperipheral_i2c_periphe if (err == ESP_FAIL) { mp_raise_OSError(MP_EIO); } else { - mp_raise_ValueError(translate("Invalid argument")); + mp_arg_error_invalid(MP_QSTR_I2CTarget); } } @@ -80,12 +81,12 @@ void common_hal_i2cperipheral_i2c_peripheral_construct(i2cperipheral_i2c_periphe claim_pin(scl); } -bool common_hal_i2cperipheral_i2c_peripheral_deinited(i2cperipheral_i2c_peripheral_obj_t *self) { +bool common_hal_i2ctarget_i2c_target_deinited(i2ctarget_i2c_target_obj_t *self) { return self->sda_pin == NULL; } -void common_hal_i2cperipheral_i2c_peripheral_deinit(i2cperipheral_i2c_peripheral_obj_t *self) { - if (common_hal_i2cperipheral_i2c_peripheral_deinited(self)) { +void common_hal_i2ctarget_i2c_target_deinit(i2ctarget_i2c_target_obj_t *self) { + if (common_hal_i2ctarget_i2c_target_deinited(self)) { return; } @@ -97,7 +98,7 @@ void common_hal_i2cperipheral_i2c_peripheral_deinit(i2cperipheral_i2c_peripheral self->scl_pin = NULL; } -int common_hal_i2cperipheral_i2c_peripheral_is_addressed(i2cperipheral_i2c_peripheral_obj_t *self, +int common_hal_i2ctarget_i2c_target_is_addressed(i2ctarget_i2c_target_obj_t *self, uint8_t *address, bool *is_read, bool *is_restart) { *address = self->addresses[0]; *is_read = true; @@ -105,21 +106,21 @@ int common_hal_i2cperipheral_i2c_peripheral_is_addressed(i2cperipheral_i2c_perip return 1; } -int common_hal_i2cperipheral_i2c_peripheral_read_byte(i2cperipheral_i2c_peripheral_obj_t *self, uint8_t *data) { +int common_hal_i2ctarget_i2c_target_read_byte(i2ctarget_i2c_target_obj_t *self, uint8_t *data) { i2c_slave_read_buffer(self->i2c_num, data, 128, 0); return 1; } -int common_hal_i2cperipheral_i2c_peripheral_write_byte(i2cperipheral_i2c_peripheral_obj_t *self, uint8_t data) { +int common_hal_i2ctarget_i2c_target_write_byte(i2ctarget_i2c_target_obj_t *self, uint8_t data) { i2c_reset_tx_fifo(self->i2c_num); i2c_slave_write_buffer(self->i2c_num, &data, 128, 0); return 1; } -void common_hal_i2cperipheral_i2c_peripheral_ack(i2cperipheral_i2c_peripheral_obj_t *self, bool ack) { +void common_hal_i2ctarget_i2c_target_ack(i2ctarget_i2c_target_obj_t *self, bool ack) { } -void common_hal_i2cperipheral_i2c_peripheral_close(i2cperipheral_i2c_peripheral_obj_t *self) { +void common_hal_i2ctarget_i2c_target_close(i2ctarget_i2c_target_obj_t *self) { } diff --git a/ports/espressif/common-hal/i2cperipheral/I2CPeripheral.h b/ports/espressif/common-hal/i2ctarget/I2CTarget.h similarity index 85% rename from ports/espressif/common-hal/i2cperipheral/I2CPeripheral.h rename to ports/espressif/common-hal/i2ctarget/I2CTarget.h index d3b324b39a..422bd720eb 100644 --- a/ports/espressif/common-hal/i2cperipheral/I2CPeripheral.h +++ b/ports/espressif/common-hal/i2ctarget/I2CTarget.h @@ -24,8 +24,8 @@ * THE SOFTWARE. */ -#ifndef MICROPY_INCLUDED_ESPRESSIF_COMMON_HAL_BUSIO_I2C_PERIPHERAL_H -#define MICROPY_INCLUDED_ESPRESSIF_COMMON_HAL_BUSIO_I2C_PERIPHERAL_H +#ifndef MICROPY_INCLUDED_ESPRESSIF_COMMON_HAL_BUSIO_I2C_TARGET_H +#define MICROPY_INCLUDED_ESPRESSIF_COMMON_HAL_BUSIO_I2C_TARGET_H #include "py/obj.h" #include "peripherals/i2c.h" @@ -38,6 +38,6 @@ typedef struct { uint8_t num_addresses; const mcu_pin_obj_t *scl_pin; const mcu_pin_obj_t *sda_pin; -} i2cperipheral_i2c_peripheral_obj_t; +} i2ctarget_i2c_target_obj_t; -#endif // MICROPY_INCLUDED_ESPRESSIF_COMMON_HAL_BUSIO_I2C_PERIPHERAL_H +#endif // MICROPY_INCLUDED_ESPRESSIF_COMMON_HAL_BUSIO_I2C_TARGET_H diff --git a/ports/espressif/common-hal/i2ctarget/__init__.c b/ports/espressif/common-hal/i2ctarget/__init__.c new file mode 100644 index 0000000000..4ec26465ad --- /dev/null +++ b/ports/espressif/common-hal/i2ctarget/__init__.c @@ -0,0 +1 @@ +// No i2ctarget module functions. diff --git a/ports/espressif/common-hal/imagecapture/ParallelImageCapture.c b/ports/espressif/common-hal/imagecapture/ParallelImageCapture.c index b167b5c734..7456e474a9 100644 --- a/ports/espressif/common-hal/imagecapture/ParallelImageCapture.c +++ b/ports/espressif/common-hal/imagecapture/ParallelImageCapture.c @@ -41,9 +41,7 @@ void common_hal_imagecapture_parallelimagecapture_construct(imagecapture_paralle const mcu_pin_obj_t *horizontal_reference) { // only 8 bits is supported at present - if (data_count < 8 || data_count > 16) { - mp_raise_ValueError_varg(translate("%q must be between %d and %d"), MP_QSTR_data_count, 8, 16); - } + mp_arg_validate_int_range(data_count, 8, 16, MP_QSTR_data_count); // This will throw if unsuccessful. Everything following is guaranteed to succeed. port_i2s_allocate_i2s0(); diff --git a/ports/espressif/common-hal/mdns/RemoteService.c b/ports/espressif/common-hal/mdns/RemoteService.c index 1d80c738bd..5a84c4a79b 100644 --- a/ports/espressif/common-hal/mdns/RemoteService.c +++ b/ports/espressif/common-hal/mdns/RemoteService.c @@ -26,6 +26,8 @@ #include "shared-bindings/mdns/RemoteService.h" +#include "shared-bindings/ipaddress/IPv4Address.h" + const char *common_hal_mdns_remoteservice_get_service_type(mdns_remoteservice_obj_t *self) { if (self->result == NULL) { return ""; @@ -61,6 +63,32 @@ mp_int_t common_hal_mdns_remoteservice_get_port(mdns_remoteservice_obj_t *self) return self->result->port; } +uint32_t mdns_remoteservice_get_ipv4_address(mdns_remoteservice_obj_t *self) { + if (self->result == NULL || + self->result->ip_protocol != MDNS_IP_PROTOCOL_V4 || + self->result->addr == NULL) { + return 0; + } + mdns_ip_addr_t *cur = self->result->addr; + while (cur != NULL) { + if (cur->addr.type == ESP_IPADDR_TYPE_V4) { + return cur->addr.u_addr.ip4.addr; + } + + cur = cur->next; + } + + return 0; +} + +mp_obj_t common_hal_mdns_remoteservice_get_ipv4_address(mdns_remoteservice_obj_t *self) { + uint32_t addr = mdns_remoteservice_get_ipv4_address(self); + if (addr == 0) { + return mp_const_none; + } + return common_hal_ipaddress_new_ipv4address(addr); +} + void common_hal_mdns_remoteservice_deinit(mdns_remoteservice_obj_t *self) { mdns_query_results_free(self->result); self->result = NULL; diff --git a/ports/espressif/common-hal/mdns/Server.c b/ports/espressif/common-hal/mdns/Server.c index 9da67a9145..d657a84eb7 100644 --- a/ports/espressif/common-hal/mdns/Server.c +++ b/ports/espressif/common-hal/mdns/Server.c @@ -35,13 +35,9 @@ STATIC bool inited = false; -void common_hal_mdns_server_construct(mdns_server_obj_t *self, mp_obj_t network_interface) { - if (network_interface != MP_OBJ_FROM_PTR(&common_hal_wifi_radio_obj)) { - mp_raise_ValueError(translate("mDNS only works with built-in WiFi")); - return; - } +void mdns_server_construct(mdns_server_obj_t *self, bool workflow) { if (inited) { - mp_raise_RuntimeError(translate("mDNS already initialized")); + return; } mdns_init(); @@ -50,19 +46,31 @@ void common_hal_mdns_server_construct(mdns_server_obj_t *self, mp_obj_t network_ snprintf(self->default_hostname, sizeof(self->default_hostname), "cpy-%02x%02x%02x", mac[3], mac[4], mac[5]); common_hal_mdns_server_set_hostname(self, self->default_hostname); - // Set a delegated entry to ourselves. This allows us to respond to "circuitpython.local" - // queries as well. - // TODO: Allow for disabling this with `supervisor.disable_web_workflow()`. - mdns_ip_addr_t our_ip; - esp_netif_get_ip_info(common_hal_wifi_radio_obj.netif, &common_hal_wifi_radio_obj.ip_info); - our_ip.next = NULL; - our_ip.addr.type = ESP_IPADDR_TYPE_V4; - our_ip.addr.u_addr.ip4 = common_hal_wifi_radio_obj.ip_info.ip; - our_ip.addr.u_addr.ip6.addr[1] = 0; - our_ip.addr.u_addr.ip6.addr[2] = 0; - our_ip.addr.u_addr.ip6.addr[3] = 0; - our_ip.addr.u_addr.ip6.zone = 0; - mdns_delegate_hostname_add("circuitpython", &our_ip); + if (workflow) { + // Set a delegated entry to ourselves. This allows us to respond to "circuitpython.local" + // queries as well. + mdns_ip_addr_t our_ip; + esp_netif_get_ip_info(common_hal_wifi_radio_obj.netif, &common_hal_wifi_radio_obj.ip_info); + our_ip.next = NULL; + our_ip.addr.type = ESP_IPADDR_TYPE_V4; + our_ip.addr.u_addr.ip4 = common_hal_wifi_radio_obj.ip_info.ip; + our_ip.addr.u_addr.ip6.addr[1] = 0; + our_ip.addr.u_addr.ip6.addr[2] = 0; + our_ip.addr.u_addr.ip6.addr[3] = 0; + our_ip.addr.u_addr.ip6.zone = 0; + mdns_delegate_hostname_add("circuitpython", &our_ip); + } +} + +void common_hal_mdns_server_construct(mdns_server_obj_t *self, mp_obj_t network_interface) { + if (network_interface != MP_OBJ_FROM_PTR(&common_hal_wifi_radio_obj)) { + mp_raise_ValueError(translate("mDNS only works with built-in WiFi")); + return; + } + if (inited) { + mp_raise_RuntimeError(translate("mDNS already initialized")); + } + mdns_server_construct(self, false); } void common_hal_mdns_server_deinit(mdns_server_obj_t *self) { @@ -82,6 +90,10 @@ const char *common_hal_mdns_server_get_hostname(mdns_server_obj_t *self) { void common_hal_mdns_server_set_hostname(mdns_server_obj_t *self, const char *hostname) { mdns_hostname_set(hostname); + // Wait for the mdns task to set the new hostname. + while (!mdns_hostname_exists(hostname)) { + RUN_BACKGROUND_TASKS; + } self->hostname = hostname; } @@ -97,6 +109,48 @@ void common_hal_mdns_server_set_instance_name(mdns_server_obj_t *self, const cha self->instance_name = instance_name; } +size_t mdns_server_find(mdns_server_obj_t *self, const char *service_type, const char *protocol, + mp_float_t timeout, mdns_remoteservice_obj_t *out, size_t out_len) { + mdns_search_once_t *search = mdns_query_async_new(NULL, service_type, protocol, MDNS_TYPE_PTR, timeout * 1000, 255, NULL); + if (search == NULL) { + return 0; + } + mdns_result_t *results; + while (!mdns_query_async_get_results(search, 1, &results)) { + RUN_BACKGROUND_TASKS; + } + mdns_query_async_delete(search); + // Count how many results we got. + // TODO: Remove this loop when moving off 4.4. Newer APIs will give us num_results + // back directly. + mdns_result_t *next = results; + uint8_t num_results = 0; + while (next != NULL) { + num_results++; + next = next->next; + } + + next = results; + // Don't error if we're out of memory. Instead, truncate the tuple. + uint8_t added = 0; + while (next != NULL && added < out_len) { + mdns_remoteservice_obj_t *service = &out[added]; + + service->result = next; + service->base.type = &mdns_remoteservice_type; + next = next->next; + // Break the linked list so we free each result separately. + service->result->next = NULL; + added++; + } + if (added < out_len) { + // Free the remaining results from the IDF because we don't have + // enough space in Python. + mdns_query_results_free(next); + } + return num_results; +} + mp_obj_t common_hal_mdns_server_find(mdns_server_obj_t *self, const char *service_type, const char *protocol, mp_float_t timeout) { mdns_search_once_t *search = mdns_query_async_new(NULL, service_type, protocol, MDNS_TYPE_PTR, timeout * 1000, 255, NULL); if (search == NULL) { @@ -150,5 +204,9 @@ mp_obj_t common_hal_mdns_server_find(mdns_server_obj_t *self, const char *servic } void common_hal_mdns_server_advertise_service(mdns_server_obj_t *self, const char *service_type, const char *protocol, mp_int_t port) { - mdns_service_add(NULL, service_type, protocol, port, NULL, 0); + if (mdns_service_exists(service_type, protocol, NULL)) { + mdns_service_port_set(service_type, protocol, port); + } else { + mdns_service_add(NULL, service_type, protocol, port, NULL, 0); + } } diff --git a/ports/espressif/common-hal/microcontroller/Pin.c b/ports/espressif/common-hal/microcontroller/Pin.c index 1323c9ae5d..12081c7e40 100644 --- a/ports/espressif/common-hal/microcontroller/Pin.c +++ b/ports/espressif/common-hal/microcontroller/Pin.c @@ -33,14 +33,78 @@ #include "components/driver/include/driver/gpio.h" #include "components/hal/include/hal/gpio_hal.h" -STATIC uint32_t never_reset_pins[2]; -STATIC uint32_t in_use[2]; +STATIC uint64_t _never_reset_pin_mask; +STATIC uint64_t _preserved_pin_mask; +STATIC uint64_t _in_use_pin_mask; + +// Bit mask of all pins that should never EVER be reset. +// Typically these are SPI flash and PSRAM control pins, and communication pins. +// "Reset forbidden" is stronger than "never reset" below, which may only be temporary. +static const uint64_t pin_mask_reset_forbidden = + #if defined(CONFIG_IDF_TARGET_ESP32) + // Never ever reset serial pins for bootloader and possibly USB-serial converter. + GPIO_SEL_1 | // TXD0 + GPIO_SEL_3 | // RXD0 + // SPI flash and PSRAM pins are protected at runtime in supervisor/port.c. + #endif // ESP32 + + #if defined(CONFIG_IDF_TARGET_ESP32C3) + // Never ever reset pins used to communicate with SPI flash. + GPIO_SEL_11 | // VDD_SPI + GPIO_SEL_12 | // SPIHD + GPIO_SEL_13 | // SPIWP + GPIO_SEL_14 | // SPICS0 + GPIO_SEL_15 | // SPICLK + GPIO_SEL_16 | // SPID + GPIO_SEL_17 | // SPIQ + #if CIRCUITPY_ESP_USB_SERIAL_JTAG + // Never ever reset serial/JTAG communication pins. + GPIO_SEL_18 | // USB D- + GPIO_SEL_19 | // USB D+ + #endif + #endif // ESP32C3 + + #if defined(CONFIG_IDF_TARGET_ESP32S2) || defined(CONFIG_IDF_TARGET_ESP32S3) + // Never ever reset pins used to communicate with SPI flash and PSRAM. + GPIO_SEL_19 | // USB D- + GPIO_SEL_20 | // USB D+ + #if defined(CONFIG_ESP32_SPIRAM_SUPPORT) || defined(CONFIG_ESP32S2_SPIRAM_SUPPORT) || defined(CONFIG_ESP32S3_SPIRAM_SUPPORT) + // Note ESP32-C3 does not have SPIRAM support. + // Board uses PSRAM, and needs another chip select. + GPIO_SEL_26 | // SPICS1 + #endif + GPIO_SEL_27 | // SPIHD + GPIO_SEL_28 | // SPIWP + GPIO_SEL_29 | // SPICS0 + GPIO_SEL_30 | // SPICLK + GPIO_SEL_31 | // SPIHD + GPIO_SEL_32 | // SPIQ + #if defined(CONFIG_SPIRAM_MODE_OCT) + // Never reset octal SPI flash pins DQ4-DQ7 and DQS/DM. + GPIO_SEL_33 | // SPIIO4 + GPIO_SEL_34 | // SPIIO5 + GPIO_SEL_35 | // SPIIO6 + GPIO_SEL_36 | // SPIIO7 + GPIO_SEL_37 | // SPIDQS + #endif + #if CIRCUITPY_USB + // Never ever reset USB pins. + GPIO_SEL_19 | // USB D- + GPIO_SEL_20 | // USB D+ + #endif + #endif // ESP32S2, ESP32S3 + + 0; // Terminate last "|". + + void never_reset_pin_number(gpio_num_t pin_number) { - if (pin_number == NO_PIN) { + // Some CircuitPython APIs deal in uint8_t pin numbers, but NO_PIN is -1. + // Also allow pin 255 to be treated as NO_PIN to avoid crashes + if (pin_number == NO_PIN || pin_number == (uint8_t)NO_PIN) { return; } - never_reset_pins[pin_number / 32] |= 1 << pin_number % 32; + _never_reset_pin_mask |= PIN_BIT(pin_number); } void common_hal_never_reset_pin(const mcu_pin_obj_t *pin) { @@ -54,60 +118,83 @@ MP_WEAK bool espressif_board_reset_pin_number(gpio_num_t pin_number) { return false; } -STATIC void _reset_pin(gpio_num_t pin_number) { - #if defined(CONFIG_IDF_TARGET_ESP32S2) || defined(CONFIG_IDF_TARGET_ESP32S3) - // Never ever reset pins used for flash and RAM. - if (26 <= pin_number && pin_number <= 32) { - return; - } - #ifdef CONFIG_SPIRAM_MODE_OCT - // Octal DQ4-DQ7 and DQS/DM - if (33 <= pin_number && pin_number <= 37) { - return; - } - #endif +STATIC bool _reset_forbidden(gpio_num_t pin_number) { + return pin_mask_reset_forbidden & PIN_BIT(pin_number); +} - #if CIRCUITPY_USB - // Never reset USB pins. - if (pin_number == 19 || pin_number == 20) { +STATIC bool _never_reset(gpio_num_t pin_number) { + return _never_reset_pin_mask & PIN_BIT(pin_number); +} + +STATIC bool _preserved_pin(gpio_num_t pin_number) { + return _preserved_pin_mask & PIN_BIT(pin_number); +} + +STATIC void _reset_pin(gpio_num_t pin_number) { + // Never ever reset pins used for flash, RAM, and basic communication. + if (_reset_forbidden(pin_number)) { return; } - #endif - #elif defined(CONFIG_IDF_TARGET_ESP32C3) - // Never ever reset pins used for flash and RAM. - if (11 <= pin_number && pin_number <= 17) { - return; + + // Disable any existing hold on this pin, + if (GPIO_IS_VALID_OUTPUT_GPIO(pin_number)) { + gpio_hold_dis(pin_number); } - #if CIRCUITPY_ESP_USB_SERIAL_JTAG - if (pin_number == 18 || pin_number == 19) { - return; - } - #endif - #endif // Give the board a chance to reset the pin in a particular way. if (espressif_board_reset_pin_number(pin_number)) { return; } - gpio_reset_pin(pin_number); + bool pull_down = false; + + // Special case the status LED pin. + #if defined(MICROPY_HW_LED_STATUS) && (!defined(MICROPY_HW_LED_STATUS_INVERTED) || !MICROPY_HW_LED_STATUS_INVERTED) + pull_down = pull_down || pin_number == MICROPY_HW_LED_STATUS->number; + #endif #ifdef DOUBLE_TAP_PIN // Pull the double tap pin down so that resets come back to CircuitPython. - if (pin_number == DOUBLE_TAP_PIN->number) { + pull_down = pull_down || pin_number == DOUBLE_TAP_PIN->number; + #endif + + // This will pull the pin up. For pins needing pull down it shouldn't be a + // problem for a moment. + gpio_reset_pin(pin_number); + + if (pull_down) { gpio_pullup_dis(pin_number); gpio_pulldown_en(pin_number); } - #endif } +void preserve_pin_number(gpio_num_t pin_number) { + if (GPIO_IS_VALID_OUTPUT_GPIO(pin_number)) { + gpio_hold_en(pin_number); + _preserved_pin_mask |= PIN_BIT(pin_number); + } + if (_preserved_pin_mask) { + // Allow pin holds to work during deep sleep. This increases power consumption noticeably + // during deep sleep, so enable holds only if we actually are holding some pins. + // 270uA or so extra current is consumed even with no pins held. + gpio_deep_sleep_hold_en(); + } +} + +void clear_pin_preservations(void) { + _preserved_pin_mask = 0; +} + + // Mark pin as free and return it to a quiescent state. void reset_pin_number(gpio_num_t pin_number) { - if (pin_number == NO_PIN) { + // Some CircuitPython APIs deal in uint8_t pin numbers, but NO_PIN is -1. + // Also allow pin 255 to be treated as NO_PIN to avoid crashes + if (pin_number == NO_PIN || pin_number == (uint8_t)NO_PIN) { return; } - never_reset_pins[pin_number / 32] &= ~(1 << pin_number % 32); - in_use[pin_number / 32] &= ~(1 << pin_number % 32); + _never_reset_pin_mask &= ~PIN_BIT(pin_number); + _in_use_pin_mask &= ~PIN_BIT(pin_number); _reset_pin(pin_number); } @@ -124,27 +211,33 @@ void common_hal_reset_pin(const mcu_pin_obj_t *pin) { } void reset_all_pins(void) { + // Undo deep sleep holds in case we woke up from deep sleep. + // We still need to unhold individual pins, which is done by _reset_pin. + gpio_deep_sleep_hold_dis(); + for (uint8_t i = 0; i < GPIO_PIN_COUNT; i++) { uint32_t iomux_address = GPIO_PIN_MUX_REG[i]; if (iomux_address == 0 || - (never_reset_pins[i / 32] & (1 << i % 32)) != 0) { + _never_reset(i) || + _preserved_pin(i)) { continue; } _reset_pin(i); } - in_use[0] = never_reset_pins[0]; - in_use[1] = never_reset_pins[1]; + _in_use_pin_mask = _never_reset_pin_mask; } void claim_pin_number(gpio_num_t pin_number) { - if (pin_number == NO_PIN) { + // Some CircuitPython APIs deal in uint8_t pin numbers, but NO_PIN is -1. + // Also allow pin 255 to be treated as NO_PIN to avoid crashes + if (pin_number == NO_PIN || pin_number == (uint8_t)NO_PIN) { return; } - in_use[pin_number / 32] |= (1 << (pin_number % 32)); + _in_use_pin_mask |= PIN_BIT(pin_number); } void claim_pin(const mcu_pin_obj_t *pin) { - in_use[pin->number / 32] |= (1 << (pin->number % 32)); + claim_pin_number(pin->number); } void common_hal_mcu_pin_claim(const mcu_pin_obj_t *pin) { @@ -152,9 +245,7 @@ void common_hal_mcu_pin_claim(const mcu_pin_obj_t *pin) { } bool pin_number_is_free(gpio_num_t pin_number) { - uint8_t offset = pin_number / 32; - uint32_t mask = 1 << (pin_number % 32); - return (in_use[offset] & mask) == 0; + return !(_in_use_pin_mask & PIN_BIT(pin_number)); } bool common_hal_mcu_pin_is_free(const mcu_pin_obj_t *pin) { diff --git a/ports/espressif/common-hal/microcontroller/Pin.h b/ports/espressif/common-hal/microcontroller/Pin.h index e74346ef65..55927fe068 100644 --- a/ports/espressif/common-hal/microcontroller/Pin.h +++ b/ports/espressif/common-hal/microcontroller/Pin.h @@ -31,21 +31,28 @@ #include "peripherals/pins.h" -void reset_all_pins(void); +// 64-bit pin mask for a single bit +#define PIN_BIT(pin_number) (((uint64_t)1) << pin_number) + +extern void common_hal_reset_pin(const mcu_pin_obj_t *pin); +extern void common_hal_never_reset_pin(const mcu_pin_obj_t *pin); + +extern void reset_all_pins(void); // reset_pin_number takes the pin number instead of the pointer so that objects don't // need to store a full pointer. -void reset_pin_number(gpio_num_t pin_number); -void common_hal_reset_pin(const mcu_pin_obj_t *pin); -void common_hal_never_reset_pin(const mcu_pin_obj_t *pin); -void claim_pin(const mcu_pin_obj_t *pin); -void claim_pin_number(gpio_num_t pin_number); -bool pin_number_is_free(gpio_num_t pin_number); -void never_reset_pin_number(gpio_num_t pin_number); +extern void reset_pin_number(gpio_num_t pin_number); +extern void claim_pin(const mcu_pin_obj_t *pin); +extern void claim_pin_number(gpio_num_t pin_number); +extern bool pin_number_is_free(gpio_num_t pin_number); +extern void never_reset_pin_number(gpio_num_t pin_number); + +extern void preserve_pin_number(gpio_num_t pin_number); +extern void clear_pin_preservations(void); // Allow the board to reset a pin in a board-specific way. This can be used // for LEDs or enable pins to put them in a state beside the default pull-up. // Return true to indicate that the pin was reset. Returning false will lead to // the port-default reset behavior. -bool espressif_board_reset_pin_number(gpio_num_t pin_number); +extern bool espressif_board_reset_pin_number(gpio_num_t pin_number); #endif // MICROPY_INCLUDED_ESPRESSIF_COMMON_HAL_MICROCONTROLLER_PIN_H diff --git a/ports/espressif/common-hal/microcontroller/Processor.c b/ports/espressif/common-hal/microcontroller/Processor.c index e4782c30ab..9b97b98cbd 100644 --- a/ports/espressif/common-hal/microcontroller/Processor.c +++ b/ports/espressif/common-hal/microcontroller/Processor.c @@ -33,17 +33,20 @@ #include "common-hal/microcontroller/Processor.h" #include "shared-bindings/microcontroller/Processor.h" #include "shared-bindings/microcontroller/ResetReason.h" -#include "supervisor/shared/translate.h" +#include "supervisor/shared/translate/translate.h" #include "esp_sleep.h" #include "esp_system.h" #include "soc/efuse_reg.h" + +#if !defined(CONFIG_IDF_TARGET_ESP32) && !defined(CONFIG_IDF_TARGET_ESP32S3) #include "driver/temp_sensor.h" +#endif float common_hal_mcu_processor_get_temperature(void) { float tsens_out; - #ifdef CONFIG_IDF_TARGET_ESP32S3 + #if defined(CONFIG_IDF_TARGET_ESP32S3) || defined(CONFIG_IDF_TARGET_ESP32) mp_raise_NotImplementedError(NULL); #else temp_sensor_config_t temp_sensor = TSENS_CONFIG_DEFAULT(); // DEFAULT: range:-10℃ ~ 80℃, error < 1℃. @@ -60,12 +63,16 @@ float common_hal_mcu_processor_get_voltage(void) { } uint32_t common_hal_mcu_processor_get_frequency(void) { - #ifdef CONFIG_IDF_TARGET_ESP32C3 + #if defined(CONFIG_IDF_TARGET_ESP32) + return CONFIG_ESP32_DEFAULT_CPU_FREQ_MHZ * 100000; + #elif defined(CONFIG_IDF_TARGET_ESP32C3) return CONFIG_ESP32C3_DEFAULT_CPU_FREQ_MHZ * 1000000; #elif defined(CONFIG_IDF_TARGET_ESP32S2) return CONFIG_ESP32S2_DEFAULT_CPU_FREQ_MHZ * 1000000; #elif defined(CONFIG_IDF_TARGET_ESP32S3) return CONFIG_ESP32S3_DEFAULT_CPU_FREQ_MHZ * 1000000; + #else + #error No known CONFIG_IDF_TARGET_xxx found #endif } @@ -78,7 +85,13 @@ void common_hal_mcu_processor_get_uid(uint8_t raw_id[]) { uint8_t *ptr = &raw_id[COMMON_HAL_MCU_PROCESSOR_UID_LENGTH - 1]; // MAC address contains 48 bits (6 bytes), 32 in the low order word + + #if defined(CONFIG_IDF_TARGET_ESP32) + uint32_t mac_address_part = REG_READ(EFUSE_BLK0_RDATA1_REG); + #else uint32_t mac_address_part = REG_READ(EFUSE_RD_MAC_SPI_SYS_0_REG); + #endif + *ptr-- = swap_nibbles(mac_address_part & 0xff); mac_address_part >>= 8; *ptr-- = swap_nibbles(mac_address_part & 0xff); @@ -88,7 +101,12 @@ void common_hal_mcu_processor_get_uid(uint8_t raw_id[]) { *ptr-- = swap_nibbles(mac_address_part & 0xff); // and 16 in the high order word + #if defined(CONFIG_IDF_TARGET_ESP32) + mac_address_part = REG_READ(EFUSE_BLK0_RDATA2_REG); + #else mac_address_part = REG_READ(EFUSE_RD_MAC_SPI_SYS_1_REG); + #endif + *ptr-- = swap_nibbles(mac_address_part & 0xff); mac_address_part >>= 8; *ptr-- = swap_nibbles(mac_address_part & 0xff); diff --git a/ports/espressif/common-hal/microcontroller/__init__.c b/ports/espressif/common-hal/microcontroller/__init__.c index 3cf41ba7f0..68479dc46f 100644 --- a/ports/espressif/common-hal/microcontroller/__init__.c +++ b/ports/espressif/common-hal/microcontroller/__init__.c @@ -45,7 +45,9 @@ #include "soc/rtc_cntl_reg.h" #include "esp_private/system_internal.h" -#ifdef CONFIG_IDF_TARGET_ESP32C3 +#if defined(CONFIG_IDF_TARGET_ESP32) +#include "esp32/rom/rtc.h" +#elif defined(CONFIG_IDF_TARGET_ESP32C3) #include "esp32c3/rom/rtc.h" #elif defined(CONFIG_IDF_TARGET_ESP32S2) #include "esp32s2/rom/rtc.h" @@ -55,6 +57,8 @@ #include "esp32s3/rom/rtc.h" #include "esp32s3/rom/usb/usb_persist.h" #include "esp32s3/rom/usb/chip_usb_dw_wrapper.h" +#else +#error No known CONFIG_IDF_TARGET_xxx found #endif void common_hal_mcu_delay_us(uint32_t delay) { @@ -65,6 +69,7 @@ volatile uint32_t nesting_count = 0; static portMUX_TYPE cp_mutex = portMUX_INITIALIZER_UNLOCKED; void common_hal_mcu_disable_interrupts(void) { + assert(xPortGetCoreID() == CONFIG_ESP_MAIN_TASK_AFFINITY); if (nesting_count == 0) { portENTER_CRITICAL(&cp_mutex); } @@ -72,9 +77,8 @@ void common_hal_mcu_disable_interrupts(void) { } void common_hal_mcu_enable_interrupts(void) { - if (nesting_count == 0) { - // Maybe log here because it's very bad. - } + assert(xPortGetCoreID() == CONFIG_ESP_MAIN_TASK_AFFINITY); + assert(nesting_count > 0); nesting_count--; if (nesting_count > 0) { return; @@ -85,16 +89,22 @@ void common_hal_mcu_enable_interrupts(void) { void common_hal_mcu_on_next_reset(mcu_runmode_t runmode) { switch (runmode) { case RUNMODE_UF2: - #ifndef CONFIG_IDF_TARGET_ESP32C3 + #if defined(CONFIG_IDF_TARGET_ESP32) || defined(CONFIG_IDF_TARGET_ESP32C3) + mp_arg_error_invalid(MP_QSTR_run_mode); + #else // 0x11F2 is APP_REQUEST_UF2_RESET_HINT & is defined by TinyUF2 esp_reset_reason_set_hint(0x11F2); #endif break; case RUNMODE_NORMAL: // revert back to normal boot + #if defined(CONFIG_IDF_TARGET_ESP32S2) || defined(CONFIG_IDF_TARGET_ESP32S3) REG_WRITE(RTC_RESET_CAUSE_REG, 0); // reset uf2 + #endif REG_WRITE(RTC_CNTL_STORE0_REG, 0); // reset safe mode + #if !defined(CONFIG_IDF_TARGET_ESP32) REG_WRITE(RTC_CNTL_OPTION1_REG, 0); // reset bootloader + #endif break; case RUNMODE_SAFE_MODE: // enter safe mode on next boot @@ -102,10 +112,14 @@ void common_hal_mcu_on_next_reset(mcu_runmode_t runmode) { break; case RUNMODE_BOOTLOADER: // DFU download - #ifndef CONFIG_IDF_TARGET_ESP32C3 + #if defined(CONFIG_IDF_TARGET_ESP32) + mp_arg_error_invalid(MP_QSTR_run_mode); + #else + #if defined(CONFIG_IDF_TARGET_ESP32S2) || defined(CONFIG_IDF_TARGET_ESP32S3) chip_usb_set_persist_flags(USBDC_BOOT_DFU); #endif REG_WRITE(RTC_CNTL_OPTION1_REG, RTC_CNTL_FORCE_DOWNLOAD_BOOT); + #endif break; default: break; @@ -149,49 +163,145 @@ watchdog_watchdogtimer_obj_t common_hal_mcu_watchdogtimer_obj = { // This maps MCU pin names to pin objects. STATIC const mp_rom_map_elem_t mcu_pin_global_dict_table[] = { + #ifdef GPIO0_EXISTS { MP_ROM_QSTR(MP_QSTR_GPIO0), MP_ROM_PTR(&pin_GPIO0) }, + #endif + #ifdef GPIO1_EXISTS { MP_ROM_QSTR(MP_QSTR_GPIO1), MP_ROM_PTR(&pin_GPIO1) }, + #endif + #ifdef GPIO2_EXISTS { MP_ROM_QSTR(MP_QSTR_GPIO2), MP_ROM_PTR(&pin_GPIO2) }, + #endif + #ifdef GPIO3_EXISTS { MP_ROM_QSTR(MP_QSTR_GPIO3), MP_ROM_PTR(&pin_GPIO3) }, + #endif + #ifdef GPIO4_EXISTS { MP_ROM_QSTR(MP_QSTR_GPIO4), MP_ROM_PTR(&pin_GPIO4) }, + #endif + #ifdef GPIO5_EXISTS { MP_ROM_QSTR(MP_QSTR_GPIO5), MP_ROM_PTR(&pin_GPIO5) }, + #endif + #ifdef GPIO6_EXISTS { MP_ROM_QSTR(MP_QSTR_GPIO6), MP_ROM_PTR(&pin_GPIO6) }, + #endif + #ifdef GPIO7_EXISTS { MP_ROM_QSTR(MP_QSTR_GPIO7), MP_ROM_PTR(&pin_GPIO7) }, + #endif + #ifdef GPIO8_EXISTS { MP_ROM_QSTR(MP_QSTR_GPIO8), MP_ROM_PTR(&pin_GPIO8) }, + #endif + #ifdef GPIO9_EXISTS { MP_ROM_QSTR(MP_QSTR_GPIO9), MP_ROM_PTR(&pin_GPIO9) }, + #endif + #ifdef GPIO10_EXISTS { MP_ROM_QSTR(MP_QSTR_GPIO10), MP_ROM_PTR(&pin_GPIO10) }, + #endif + #ifdef GPIO11_EXISTS { MP_ROM_QSTR(MP_QSTR_GPIO11), MP_ROM_PTR(&pin_GPIO11) }, + #endif + #ifdef GPIO12_EXISTS { MP_ROM_QSTR(MP_QSTR_GPIO12), MP_ROM_PTR(&pin_GPIO12) }, + #endif + #ifdef GPIO13_EXISTS { MP_ROM_QSTR(MP_QSTR_GPIO13), MP_ROM_PTR(&pin_GPIO13) }, + #endif + #ifdef GPIO14_EXISTS { MP_ROM_QSTR(MP_QSTR_GPIO14), MP_ROM_PTR(&pin_GPIO14) }, + #endif + #ifdef GPIO15_EXISTS { MP_ROM_QSTR(MP_QSTR_GPIO15), MP_ROM_PTR(&pin_GPIO15) }, + #endif + #ifdef GPIO16_EXISTS { MP_ROM_QSTR(MP_QSTR_GPIO16), MP_ROM_PTR(&pin_GPIO16) }, + #endif + #ifdef GPIO17_EXISTS { MP_ROM_QSTR(MP_QSTR_GPIO17), MP_ROM_PTR(&pin_GPIO17) }, + #endif + #ifdef GPIO18_EXISTS { MP_ROM_QSTR(MP_QSTR_GPIO18), MP_ROM_PTR(&pin_GPIO18) }, + #endif + #ifdef GPIO19_EXISTS { MP_ROM_QSTR(MP_QSTR_GPIO19), MP_ROM_PTR(&pin_GPIO19) }, + #endif + #ifdef GPIO20_EXISTS { MP_ROM_QSTR(MP_QSTR_GPIO20), MP_ROM_PTR(&pin_GPIO20) }, + #endif + #ifdef GPIO21_EXISTS { MP_ROM_QSTR(MP_QSTR_GPIO21), MP_ROM_PTR(&pin_GPIO21) }, - #ifndef CONFIG_IDF_TARGET_ESP32C3 + #endif + #ifdef GPIO22_EXISTS + { MP_ROM_QSTR(MP_QSTR_GPIO22), MP_ROM_PTR(&pin_GPIO22) }, + #endif + #ifdef GPIO23_EXISTS + { MP_ROM_QSTR(MP_QSTR_GPIO23), MP_ROM_PTR(&pin_GPIO23) }, + #endif + #ifdef GPIO24_EXISTS + { MP_ROM_QSTR(MP_QSTR_GPIO24), MP_ROM_PTR(&pin_GPIO24) }, + #endif + #ifdef GPIO25_EXISTS + { MP_ROM_QSTR(MP_QSTR_GPIO25), MP_ROM_PTR(&pin_GPIO25) }, + #endif + #ifdef GPIO26_EXISTS { MP_ROM_QSTR(MP_QSTR_GPIO26), MP_ROM_PTR(&pin_GPIO26) }, + #endif + #ifdef GPIO27_EXISTS { MP_ROM_QSTR(MP_QSTR_GPIO27), MP_ROM_PTR(&pin_GPIO27) }, + #endif + #ifdef GPIO28_EXISTS { MP_ROM_QSTR(MP_QSTR_GPIO28), MP_ROM_PTR(&pin_GPIO28) }, + #endif + #ifdef GPIO29_EXISTS { MP_ROM_QSTR(MP_QSTR_GPIO29), MP_ROM_PTR(&pin_GPIO29) }, + #endif + #ifdef GPIO30_EXISTS { MP_ROM_QSTR(MP_QSTR_GPIO30), MP_ROM_PTR(&pin_GPIO30) }, + #endif + #ifdef GPIO31_EXISTS { MP_ROM_QSTR(MP_QSTR_GPIO31), MP_ROM_PTR(&pin_GPIO31) }, + #endif + #ifdef GPIO32_EXISTS { MP_ROM_QSTR(MP_QSTR_GPIO32), MP_ROM_PTR(&pin_GPIO32) }, + #endif + #ifdef GPIO33_EXISTS { MP_ROM_QSTR(MP_QSTR_GPIO33), MP_ROM_PTR(&pin_GPIO33) }, + #endif + #ifdef GPIO34_EXISTS { MP_ROM_QSTR(MP_QSTR_GPIO34), MP_ROM_PTR(&pin_GPIO34) }, + #endif + #ifdef GPIO35_EXISTS { MP_ROM_QSTR(MP_QSTR_GPIO35), MP_ROM_PTR(&pin_GPIO35) }, + #endif + #ifdef GPIO36_EXISTS { MP_ROM_QSTR(MP_QSTR_GPIO36), MP_ROM_PTR(&pin_GPIO36) }, + #endif + #ifdef GPIO37_EXISTS { MP_ROM_QSTR(MP_QSTR_GPIO37), MP_ROM_PTR(&pin_GPIO37) }, + #endif + #ifdef GPIO38_EXISTS { MP_ROM_QSTR(MP_QSTR_GPIO38), MP_ROM_PTR(&pin_GPIO38) }, + #endif + #ifdef GPIO39_EXISTS { MP_ROM_QSTR(MP_QSTR_GPIO39), MP_ROM_PTR(&pin_GPIO39) }, + #endif + #ifdef GPIO40_EXISTS { MP_ROM_QSTR(MP_QSTR_GPIO40), MP_ROM_PTR(&pin_GPIO40) }, + #endif + #ifdef GPIO41_EXISTS { MP_ROM_QSTR(MP_QSTR_GPIO41), MP_ROM_PTR(&pin_GPIO41) }, + #endif + #ifdef GPIO42_EXISTS { MP_ROM_QSTR(MP_QSTR_GPIO42), MP_ROM_PTR(&pin_GPIO42) }, + #endif + #ifdef GPIO43_EXISTS { MP_ROM_QSTR(MP_QSTR_GPIO43), MP_ROM_PTR(&pin_GPIO43) }, + #endif + #ifdef GPIO44_EXISTS { MP_ROM_QSTR(MP_QSTR_GPIO44), MP_ROM_PTR(&pin_GPIO44) }, + #endif + #ifdef GPIO45_EXISTS { MP_ROM_QSTR(MP_QSTR_GPIO45), MP_ROM_PTR(&pin_GPIO45) }, + #endif + #ifdef GPIO46_EXISTS { MP_ROM_QSTR(MP_QSTR_GPIO46), MP_ROM_PTR(&pin_GPIO46) }, #endif }; diff --git a/ports/espressif/common-hal/pulseio/PulseIn.c b/ports/espressif/common-hal/pulseio/PulseIn.c index 95d69b6a2f..41c1dcb189 100644 --- a/ports/espressif/common-hal/pulseio/PulseIn.c +++ b/ports/espressif/common-hal/pulseio/PulseIn.c @@ -88,7 +88,7 @@ void common_hal_pulseio_pulsein_construct(pulseio_pulsein_obj_t *self, const mcu uint16_t maxlen, bool idle_state) { self->buffer = (uint16_t *)m_malloc(maxlen * sizeof(uint16_t), false); if (self->buffer == NULL) { - mp_raise_msg_varg(&mp_type_MemoryError, translate("Failed to allocate RX buffer of %d bytes"), maxlen * sizeof(uint16_t)); + m_malloc_fail(maxlen * sizeof(uint16_t)); } self->pin = pin; self->maxlen = maxlen; diff --git a/ports/espressif/common-hal/pwmio/PWMOut.c b/ports/espressif/common-hal/pwmio/PWMOut.c index 9ca39c223b..d83ce6590a 100644 --- a/ports/espressif/common-hal/pwmio/PWMOut.c +++ b/ports/espressif/common-hal/pwmio/PWMOut.c @@ -55,18 +55,14 @@ STATIC uint32_t calculate_duty_cycle(uint32_t frequency) { void pwmout_reset(void) { for (size_t i = 0; i < LEDC_CHANNEL_MAX; i++) { - if (reserved_channels[i] != INDEX_EMPTY) { + if (reserved_channels[i] != INDEX_EMPTY && !never_reset_chan[i]) { ledc_stop(LEDC_LOW_SPEED_MODE, i, 0); - } - if (!never_reset_chan[i]) { reserved_channels[i] = INDEX_EMPTY; } } for (size_t i = 0; i < LEDC_TIMER_MAX; i++) { - if (reserved_timer_freq[i]) { + if (reserved_timer_freq[i] && !never_reset_tim[i]) { ledc_timer_rst(LEDC_LOW_SPEED_MODE, i); - } - if (!never_reset_tim[i]) { reserved_timer_freq[i] = 0; varfreq_timers[i] = false; } @@ -217,7 +213,7 @@ void common_hal_pwmio_pwmout_set_frequency(pwmio_pwmout_obj_t *self, uint32_t fr // Calculate duty cycle uint32_t duty_bits = calculate_duty_cycle(frequency); if (duty_bits == 0) { - mp_raise_ValueError(translate("Invalid PWM frequency")); + mp_arg_error_invalid(MP_QSTR_frequency); } self->duty_resolution = duty_bits; ledc_set_freq(LEDC_LOW_SPEED_MODE, self->tim_handle.timer_num, frequency); diff --git a/ports/espressif/common-hal/rotaryio/IncrementalEncoder.c b/ports/espressif/common-hal/rotaryio/IncrementalEncoder.c index 15e7fc4b8f..07b97cf9a3 100644 --- a/ports/espressif/common-hal/rotaryio/IncrementalEncoder.c +++ b/ports/espressif/common-hal/rotaryio/IncrementalEncoder.c @@ -36,45 +36,41 @@ void common_hal_rotaryio_incrementalencoder_construct(rotaryio_incrementalencode claim_pin(pin_b); // Prepare configuration for the PCNT unit - pcnt_config_t pcnt_config = { + pcnt_config_t pcnt_config_channel_0 = { // Set PCNT input signal and control GPIOs .pulse_gpio_num = pin_a->number, .ctrl_gpio_num = pin_b->number, .channel = PCNT_CHANNEL_0, // 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 + .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 - const int8_t unit = peripherals_pcnt_get_unit(pcnt_config); + // Allocate and initialize PCNT unit, CHANNEL_0. + const int8_t unit = peripherals_pcnt_init(&pcnt_config_channel_0); if (unit == -1) { mp_raise_RuntimeError(translate("All PCNT units in use")); } - pcnt_unit_config(&pcnt_config); + pcnt_config_t pcnt_config_channel_1 = { + // Set PCNT input signal and control GPIOs + .pulse_gpio_num = pin_b->number, // Pins are reversed from above + .ctrl_gpio_num = pin_a->number, + .channel = PCNT_CHANNEL_1, + // 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_KEEP, // Keep the primary counter mode if low + .hctrl_mode = PCNT_MODE_REVERSE, // Reverse counting direction if high + .unit = unit, + }; - pcnt_config.pulse_gpio_num = pin_b->number; // What was control is now signal - pcnt_config.ctrl_gpio_num = pin_a->number; // What was signal is now control - pcnt_config.channel = PCNT_CHANNEL_1; - // What to do on the positive / negative edge of pulse input? - pcnt_config.pos_mode = PCNT_COUNT_DEC; // Count up on the positive edge - pcnt_config.neg_mode = PCNT_COUNT_INC; // Keep the counter value on the negative edge - // What to do when control input is low or high? - pcnt_config.lctrl_mode = PCNT_MODE_KEEP; // Keep the primary counter mode if low - pcnt_config.hctrl_mode = PCNT_MODE_REVERSE; // Reverse counting direction if high - - pcnt_unit_config(&pcnt_config); - - // 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); + // Reinitalize same unit, CHANNEL_1 with different parameters. + peripherals_pcnt_reinit(&pcnt_config_channel_1); self->pin_a = pin_a->number; self->pin_b = pin_b->number; diff --git a/ports/espressif/common-hal/rtc/RTC.c b/ports/espressif/common-hal/rtc/RTC.c index a78c2fb613..866f9b65a0 100644 --- a/ports/espressif/common-hal/rtc/RTC.c +++ b/ports/espressif/common-hal/rtc/RTC.c @@ -48,5 +48,5 @@ int common_hal_rtc_get_calibration(void) { } void common_hal_rtc_set_calibration(int calibration) { - mp_raise_NotImplementedError(translate("RTC calibration is not supported on this board")); + mp_raise_NotImplementedError_varg(translate("%q"), MP_QSTR_calibration); } diff --git a/ports/espressif/common-hal/socketpool/Socket.c b/ports/espressif/common-hal/socketpool/Socket.c index c16be01998..f6025d329c 100644 --- a/ports/espressif/common-hal/socketpool/Socket.c +++ b/ports/espressif/common-hal/socketpool/Socket.c @@ -30,40 +30,217 @@ #include "shared/runtime/interrupt_char.h" #include "py/mperrno.h" #include "py/runtime.h" +#include "shared-bindings/socketpool/SocketPool.h" +#include "supervisor/port.h" #include "supervisor/shared/tick.h" +#include "supervisor/workflow.h" #include "components/lwip/lwip/src/include/lwip/err.h" #include "components/lwip/lwip/src/include/lwip/sockets.h" #include "components/lwip/lwip/src/include/lwip/sys.h" #include "components/lwip/lwip/src/include/lwip/netdb.h" +#include "components/vfs/include/esp_vfs_eventfd.h" -STATIC socketpool_socket_obj_t *open_socket_handles[CONFIG_LWIP_MAX_SOCKETS]; +StackType_t socket_select_stack[2 * configMINIMAL_STACK_SIZE]; -void socket_reset(void) { - for (size_t i = 0; i < MP_ARRAY_SIZE(open_socket_handles); i++) { - if (open_socket_handles[i]) { - if (open_socket_handles[i]->num > 0) { - // Close automatically clears socket handle - common_hal_socketpool_socket_close(open_socket_handles[i]); - } else { - open_socket_handles[i] = NULL; +STATIC int open_socket_fds[CONFIG_LWIP_MAX_SOCKETS]; +STATIC bool user_socket[CONFIG_LWIP_MAX_SOCKETS]; +StaticTask_t socket_select_task_handle; +STATIC int socket_change_fd = -1; + +STATIC void socket_select_task(void *arg) { + uint64_t signal; + + while (true) { + fd_set readfds; + fd_set errfds; + FD_ZERO(&readfds); + FD_ZERO(&errfds); + FD_SET(socket_change_fd, &readfds); + FD_SET(socket_change_fd, &errfds); + int max_fd = socket_change_fd; + for (size_t i = 0; i < MP_ARRAY_SIZE(open_socket_fds); i++) { + int sockfd = open_socket_fds[i]; + if (sockfd < 0) { + continue; } + max_fd = MAX(max_fd, sockfd); + FD_SET(sockfd, &readfds); + FD_SET(sockfd, &errfds); + } + + int num_triggered = select(max_fd + 1, &readfds, NULL, &errfds, NULL); + // Check for bad file descriptor and queue up the background task before + // circling around. + if (num_triggered == -1 && errno == EBADF) { + // One for the change fd and one for the closed socket. + num_triggered = 2; + } + // Try and find the bad file and remove it from monitoring. + for (size_t i = 0; i < MP_ARRAY_SIZE(open_socket_fds); i++) { + int sockfd = open_socket_fds[i]; + if (sockfd < 0) { + continue; + } + int err; + int optlen = sizeof(int); + int ret = getsockopt(sockfd, SOL_SOCKET, SO_ERROR, &err, (socklen_t *)&optlen); + if (ret < 0) { + open_socket_fds[i] = -1; + // Raise num_triggered so that we skip the assert and queue the background task. + num_triggered = 2; + } + } + assert(num_triggered >= 0); + + if (FD_ISSET(socket_change_fd, &readfds)) { + read(socket_change_fd, &signal, sizeof(signal)); + num_triggered -= 1; + } + if (num_triggered > 0) { + supervisor_workflow_request_background(); + + // Wake up CircuitPython. We know it is asleep because we are lower + // priority. + port_wake_main_task(); + } + + } + close(socket_change_fd); + vTaskDelete(NULL); +} + +void socket_user_reset(void) { + if (socket_change_fd < 0) { + esp_vfs_eventfd_config_t config = ESP_VFS_EVENTD_CONFIG_DEFAULT(); + ESP_ERROR_CHECK(esp_vfs_eventfd_register(&config)); + + for (size_t i = 0; i < MP_ARRAY_SIZE(open_socket_fds); i++) { + open_socket_fds[i] = -1; + user_socket[i] = false; + } + socket_change_fd = eventfd(0, 0); + // Run this at the same priority as CP so that the web workflow background task can be + // queued while CP is running. Both tasks can still sleep and, therefore, sleep overall. + (void)xTaskCreateStaticPinnedToCore(socket_select_task, + "socket_select", + 2 * configMINIMAL_STACK_SIZE, + NULL, + uxTaskPriorityGet(NULL), + socket_select_stack, + &socket_select_task_handle, + xPortGetCoreID()); + } + + for (size_t i = 0; i < MP_ARRAY_SIZE(open_socket_fds); i++) { + if (open_socket_fds[i] >= 0 && user_socket[i]) { + int num = open_socket_fds[i]; + // Close automatically clears socket handle + lwip_shutdown(num, SHUT_RDWR); + lwip_close(num); + open_socket_fds[i] = -1; + user_socket[i] = false; } } } -bool register_open_socket(socketpool_socket_obj_t *self) { - for (size_t i = 0; i < MP_ARRAY_SIZE(open_socket_handles); i++) { - if (open_socket_handles[i] == NULL) { - open_socket_handles[i] = self; +// The writes below send an event to the socket select task so that it redoes the +// select with the new open socket set. + +STATIC bool register_open_socket(int fd) { + for (size_t i = 0; i < MP_ARRAY_SIZE(open_socket_fds); i++) { + if (open_socket_fds[i] == -1) { + open_socket_fds[i] = fd; + user_socket[i] = false; + uint64_t signal = 1; + write(socket_change_fd, &signal, sizeof(signal)); return true; } } return false; } -socketpool_socket_obj_t *common_hal_socketpool_socket_accept(socketpool_socket_obj_t *self, - uint8_t *ip, uint32_t *port) { +STATIC void unregister_open_socket(int fd) { + for (size_t i = 0; i < MP_ARRAY_SIZE(open_socket_fds); i++) { + if (open_socket_fds[i] == fd) { + open_socket_fds[i] = -1; + user_socket[i] = false; + write(socket_change_fd, &fd, sizeof(fd)); + return; + } + } +} + +STATIC void mark_user_socket(int fd) { + for (size_t i = 0; i < MP_ARRAY_SIZE(open_socket_fds); i++) { + if (open_socket_fds[i] == fd) { + user_socket[i] = true; + return; + } + } +} + +bool socketpool_socket(socketpool_socketpool_obj_t *self, + socketpool_socketpool_addressfamily_t family, socketpool_socketpool_sock_t type, + socketpool_socket_obj_t *sock) { + int addr_family; + int ipproto; + if (family == SOCKETPOOL_AF_INET) { + addr_family = AF_INET; + ipproto = IPPROTO_IP; + } else { // INET6 + addr_family = AF_INET6; + ipproto = IPPROTO_IPV6; + } + + int socket_type; + if (type == SOCKETPOOL_SOCK_STREAM) { + socket_type = SOCK_STREAM; + } else if (type == SOCKETPOOL_SOCK_DGRAM) { + socket_type = SOCK_DGRAM; + } else { // SOCKETPOOL_SOCK_RAW + socket_type = SOCK_RAW; + } + sock->type = socket_type; + sock->family = addr_family; + sock->ipproto = ipproto; + sock->pool = self; + sock->timeout_ms = (uint)-1; + + // Create LWIP socket + int socknum = -1; + socknum = lwip_socket(sock->family, sock->type, sock->ipproto); + if (socknum < 0) { + return false; + } + // This shouldn't happen since we have room for the same number of sockets as LWIP. + if (!register_open_socket(socknum)) { + lwip_close(socknum); + return false; + } + sock->num = socknum; + // Sockets should be nonblocking in most cases + lwip_fcntl(socknum, F_SETFL, O_NONBLOCK); + return true; +} + +socketpool_socket_obj_t *common_hal_socketpool_socket(socketpool_socketpool_obj_t *self, + socketpool_socketpool_addressfamily_t family, socketpool_socketpool_sock_t type) { + if (family != SOCKETPOOL_AF_INET) { + mp_raise_NotImplementedError(translate("Only IPv4 sockets supported")); + } + + socketpool_socket_obj_t *sock = m_new_obj_with_finaliser(socketpool_socket_obj_t); + sock->base.type = &socketpool_socket_type; + + if (!socketpool_socket(self, family, type, sock)) { + mp_raise_RuntimeError(translate("Out of sockets")); + } + mark_user_socket(sock->num); + return sock; +} + +int socketpool_socket_accept(socketpool_socket_obj_t *self, uint8_t *ip, uint32_t *port) { struct sockaddr_in accept_addr; socklen_t socklen = sizeof(accept_addr); int newsoc = -1; @@ -71,17 +248,15 @@ socketpool_socket_obj_t *common_hal_socketpool_socket_accept(socketpool_socket_o uint64_t start_ticks = supervisor_ticks_ms64(); // Allow timeouts and interrupts - while (newsoc == -1 && - !timed_out && - !mp_hal_is_interrupted()) { + while (newsoc == -1 && !timed_out) { if (self->timeout_ms != (uint)-1 && self->timeout_ms != 0) { timed_out = supervisor_ticks_ms64() - start_ticks >= self->timeout_ms; } RUN_BACKGROUND_TASKS; newsoc = lwip_accept(self->num, (struct sockaddr *)&accept_addr, &socklen); // In non-blocking mode, fail instead of timing out - if (newsoc == -1 && self->timeout_ms == 0) { - mp_raise_OSError(MP_EAGAIN); + if (newsoc == -1 && (self->timeout_ms == 0 || mp_hal_is_interrupted())) { + return -MP_EAGAIN; } } @@ -90,10 +265,24 @@ socketpool_socket_obj_t *common_hal_socketpool_socket_accept(socketpool_socket_o memcpy((void *)ip, (void *)&accept_addr.sin_addr.s_addr, sizeof(accept_addr.sin_addr.s_addr)); *port = accept_addr.sin_port; } else { - mp_raise_OSError(ETIMEDOUT); + return -ETIMEDOUT; } + if (newsoc < 0) { + return -MP_EBADF; + } + if (!register_open_socket(newsoc)) { + lwip_close(newsoc); + return -MP_EBADF; + } + return newsoc; +} + +socketpool_socket_obj_t *common_hal_socketpool_socket_accept(socketpool_socket_obj_t *self, + uint8_t *ip, uint32_t *port) { + int newsoc = socketpool_socket_accept(self, ip, port); if (newsoc > 0) { + mark_user_socket(newsoc); // Create the socket socketpool_socket_obj_t *sock = m_new_obj_with_finaliser(socketpool_socket_obj_t); sock->base.type = &socketpool_socket_type; @@ -101,14 +290,10 @@ socketpool_socket_obj_t *common_hal_socketpool_socket_accept(socketpool_socket_o sock->pool = self->pool; sock->connected = true; - if (!register_open_socket(sock)) { - mp_raise_OSError(MP_EBADF); - } - lwip_fcntl(newsoc, F_SETFL, O_NONBLOCK); return sock; } else { - mp_raise_OSError(MP_EBADF); + mp_raise_OSError(-newsoc); return NULL; } } @@ -116,7 +301,17 @@ socketpool_socket_obj_t *common_hal_socketpool_socket_accept(socketpool_socket_o bool common_hal_socketpool_socket_bind(socketpool_socket_obj_t *self, const char *host, size_t hostlen, uint32_t port) { struct sockaddr_in bind_addr; - bind_addr.sin_addr.s_addr = inet_addr(host); + const char *broadcast = ""; + uint32_t ip; + if (hostlen == 0) { + ip = IPADDR_ANY; + } else if (hostlen == strlen(broadcast) && + memcmp(host, broadcast, strlen(broadcast)) == 0) { + ip = IPADDR_BROADCAST; + } else { + ip = inet_addr(host); + } + bind_addr.sin_addr.s_addr = ip; bind_addr.sin_family = AF_INET; bind_addr.sin_port = htons(port); @@ -125,23 +320,22 @@ bool common_hal_socketpool_socket_bind(socketpool_socket_obj_t *self, if (err != 0) { mp_raise_RuntimeError(translate("Cannot set socket options")); } - int result = lwip_bind(self->num, (struct sockaddr *)&bind_addr, sizeof(bind_addr)) == 0; - return result; + int result = lwip_bind(self->num, (struct sockaddr *)&bind_addr, sizeof(bind_addr)); + return result == 0; +} + +void socketpool_socket_close(socketpool_socket_obj_t *self) { + self->connected = false; + if (self->num >= 0) { + lwip_shutdown(self->num, SHUT_RDWR); + lwip_close(self->num); + unregister_open_socket(self->num); + self->num = -1; + } } void common_hal_socketpool_socket_close(socketpool_socket_obj_t *self) { - self->connected = false; - if (self->num >= 0) { - lwip_shutdown(self->num, 0); - lwip_close(self->num); - self->num = -1; - } - // Remove socket record - for (size_t i = 0; i < MP_ARRAY_SIZE(open_socket_handles); i++) { - if (open_socket_handles[i] == self) { - open_socket_handles[i] = NULL; - } - } + socketpool_socket_close(self); } void common_hal_socketpool_socket_connect(socketpool_socket_obj_t *self, @@ -199,7 +393,7 @@ bool common_hal_socketpool_socket_get_connected(socketpool_socket_obj_t *self) { } bool common_hal_socketpool_socket_listen(socketpool_socket_obj_t *self, int backlog) { - return lwip_listen(self->num, backlog) == 0; + return lwip_listen(self->num, backlog); } mp_uint_t common_hal_socketpool_socket_recvfrom_into(socketpool_socket_obj_t *self, @@ -242,7 +436,8 @@ mp_uint_t common_hal_socketpool_socket_recvfrom_into(socketpool_socket_obj_t *se return received; } -mp_uint_t common_hal_socketpool_socket_recv_into(socketpool_socket_obj_t *self, const uint8_t *buf, uint32_t len) { +int socketpool_socket_recv_into(socketpool_socket_obj_t *self, + const uint8_t *buf, uint32_t len) { int received = 0; bool timed_out = false; @@ -251,8 +446,7 @@ mp_uint_t common_hal_socketpool_socket_recv_into(socketpool_socket_obj_t *self, uint64_t start_ticks = supervisor_ticks_ms64(); received = -1; while (received == -1 && - !timed_out && - !mp_hal_is_interrupted()) { + !timed_out) { if (self->timeout_ms != (uint)-1 && self->timeout_ms != 0) { timed_out = supervisor_ticks_ms64() - start_ticks >= self->timeout_ms; } @@ -261,31 +455,64 @@ mp_uint_t common_hal_socketpool_socket_recv_into(socketpool_socket_obj_t *self, // In non-blocking mode, fail instead of looping if (received == -1 && self->timeout_ms == 0) { - mp_raise_OSError(MP_EAGAIN); + if (errno == ENOTCONN) { + self->connected = false; + return -MP_ENOTCONN; + } + return -MP_EAGAIN; + } + // Check this after going through the loop once so it can make + // progress while interrupted. + if (mp_hal_is_interrupted()) { + if (received == -1) { + return -MP_EAGAIN; + } + break; } } } else { - mp_raise_OSError(MP_EBADF); + return -MP_EBADF; } if (timed_out) { - mp_raise_OSError(ETIMEDOUT); + return -ETIMEDOUT; } return received; } -mp_uint_t common_hal_socketpool_socket_send(socketpool_socket_obj_t *self, const uint8_t *buf, uint32_t len) { +mp_uint_t common_hal_socketpool_socket_recv_into(socketpool_socket_obj_t *self, const uint8_t *buf, uint32_t len) { + int received = socketpool_socket_recv_into(self, buf, len); + if (received < 0) { + mp_raise_OSError(received); + } + return received; +} + +int socketpool_socket_send(socketpool_socket_obj_t *self, const uint8_t *buf, uint32_t len) { int sent = -1; if (self->num != -1) { // LWIP Socket // TODO: deal with potential failure/add timeout? sent = lwip_send(self->num, buf, len, 0); } else { - mp_raise_OSError(MP_EBADF); + sent = -MP_EBADF; } if (sent < 0) { - mp_raise_OSError(errno); + if (errno == ECONNRESET || errno == ENOTCONN) { + self->connected = false; + } + return -errno; + } + + return sent; +} + +mp_uint_t common_hal_socketpool_socket_send(socketpool_socket_obj_t *self, const uint8_t *buf, uint32_t len) { + int sent = socketpool_socket_send(self, buf, len); + + if (sent < 0) { + mp_raise_OSError(-sent); } return sent; } diff --git a/ports/espressif/common-hal/socketpool/Socket.h b/ports/espressif/common-hal/socketpool/Socket.h index 943b5d9fdd..b91419807c 100644 --- a/ports/espressif/common-hal/socketpool/Socket.h +++ b/ports/espressif/common-hal/socketpool/Socket.h @@ -45,7 +45,6 @@ typedef struct { mp_uint_t timeout_ms; } socketpool_socket_obj_t; -void socket_reset(void); -bool register_open_socket(socketpool_socket_obj_t *self); +void socket_user_reset(void); #endif // MICROPY_INCLUDED_ESPRESSIF_COMMON_HAL_SOCKETPOOL_SOCKET_H diff --git a/ports/espressif/common-hal/socketpool/SocketPool.c b/ports/espressif/common-hal/socketpool/SocketPool.c index 4cea95ec41..1d1aafa638 100644 --- a/ports/espressif/common-hal/socketpool/SocketPool.c +++ b/ports/espressif/common-hal/socketpool/SocketPool.c @@ -40,52 +40,7 @@ void common_hal_socketpool_socketpool_construct(socketpool_socketpool_obj_t *sel } } -socketpool_socket_obj_t *common_hal_socketpool_socket(socketpool_socketpool_obj_t *self, - socketpool_socketpool_addressfamily_t family, socketpool_socketpool_sock_t type) { - - int addr_family; - int ipproto; - if (family == SOCKETPOOL_AF_INET) { - addr_family = AF_INET; - ipproto = IPPROTO_IP; - } else { // INET6 - addr_family = AF_INET6; - ipproto = IPPROTO_IPV6; - } - - int socket_type; - if (type == SOCKETPOOL_SOCK_STREAM) { - socket_type = SOCK_STREAM; - } else if (type == SOCKETPOOL_SOCK_DGRAM) { - socket_type = SOCK_DGRAM; - } else { // SOCKETPOOL_SOCK_RAW - socket_type = SOCK_RAW; - } - - if (addr_family == AF_INET6 || ipproto == IPPROTO_IPV6) { - mp_raise_NotImplementedError(translate("Only IPv4 sockets supported")); - } - - socketpool_socket_obj_t *sock = m_new_obj_with_finaliser(socketpool_socket_obj_t); - sock->base.type = &socketpool_socket_type; - sock->type = socket_type; - sock->family = addr_family; - sock->ipproto = ipproto; - sock->pool = self; - sock->timeout_ms = (uint)-1; - - // Create LWIP socket - int socknum = -1; - socknum = lwip_socket(sock->family, sock->type, sock->ipproto); - if (socknum < 0 || !register_open_socket(sock)) { - mp_raise_RuntimeError(translate("Out of sockets")); - } - sock->num = socknum; - // Sockets should be nonblocking in most cases - lwip_fcntl(socknum, F_SETFL, O_NONBLOCK); - return sock; -} - +// common_hal_socketpool_socket is in socketpool/Socket.c to centralize open socket tracking. mp_obj_t common_hal_socketpool_socketpool_gethostbyname(socketpool_socketpool_obj_t *self, const char *host) { diff --git a/ports/espressif/common-hal/socketpool/__init__.c b/ports/espressif/common-hal/socketpool/__init__.c index fa0e7d5f3f..595977d24f 100644 --- a/ports/espressif/common-hal/socketpool/__init__.c +++ b/ports/espressif/common-hal/socketpool/__init__.c @@ -23,3 +23,11 @@ * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN * THE SOFTWARE. */ + +#include "shared-bindings/socketpool/__init__.h" + +#include "common-hal/socketpool/Socket.h" + +void socketpool_user_reset(void) { + socket_user_reset(); +} diff --git a/ports/espressif/common-hal/ssl/SSLContext.c b/ports/espressif/common-hal/ssl/SSLContext.c index 866024bf00..386986e6be 100644 --- a/ports/espressif/common-hal/ssl/SSLContext.c +++ b/ports/espressif/common-hal/ssl/SSLContext.c @@ -87,3 +87,10 @@ bool common_hal_ssl_sslcontext_get_check_hostname(ssl_sslcontext_obj_t *self) { void common_hal_ssl_sslcontext_set_check_hostname(ssl_sslcontext_obj_t *self, bool value) { self->ssl_config.skip_common_name = !value; } + +void common_hal_ssl_sslcontext_load_cert_chain(ssl_sslcontext_obj_t *self, mp_buffer_info_t *cert_buf, mp_buffer_info_t *key_buf) { + self->ssl_config.clientcert_buf = cert_buf->buf; + self->ssl_config.clientcert_bytes = cert_buf->len + 1; + self->ssl_config.clientkey_buf = key_buf->buf; + self->ssl_config.clientkey_bytes = key_buf->len + 1; +} diff --git a/ports/espressif/common-hal/ssl/SSLSocket.c b/ports/espressif/common-hal/ssl/SSLSocket.c index 281e356d77..2446ce3005 100644 --- a/ports/espressif/common-hal/ssl/SSLSocket.c +++ b/ports/espressif/common-hal/ssl/SSLSocket.c @@ -96,7 +96,7 @@ bool common_hal_ssl_sslsocket_listen(ssl_sslsocket_obj_t *self, int backlog) { return common_hal_socketpool_socket_listen(self->sock, backlog); } -mp_uint_t common_hal_ssl_sslsocket_recv_into(ssl_sslsocket_obj_t *self, const uint8_t *buf, uint32_t len) { +mp_uint_t common_hal_ssl_sslsocket_recv_into(ssl_sslsocket_obj_t *self, uint8_t *buf, uint32_t len) { int received = 0; bool timed_out = false; int status = 0; @@ -158,7 +158,7 @@ mp_uint_t common_hal_ssl_sslsocket_send(ssl_sslsocket_obj_t *self, const uint8_t if (err == ESP_ERR_MBEDTLS_SSL_SETUP_FAILED) { mp_raise_espidf_MemoryError(); - } else if (ESP_ERR_MBEDTLS_SSL_HANDSHAKE_FAILED) { + } else if (err == ESP_ERR_MBEDTLS_SSL_HANDSHAKE_FAILED) { mp_raise_OSError_msg_varg(translate("Failed SSL handshake")); } else { mp_raise_OSError_msg_varg(translate("Unhandled ESP TLS error %d %d %x %d"), esp_tls_code, flags, err, sent); diff --git a/ports/espressif/common-hal/touchio/TouchIn.c b/ports/espressif/common-hal/touchio/TouchIn.c index 53bc335d30..c2ef0d6e18 100644 --- a/ports/espressif/common-hal/touchio/TouchIn.c +++ b/ports/espressif/common-hal/touchio/TouchIn.c @@ -28,35 +28,24 @@ #include "py/runtime.h" #include "peripherals/touch.h" - -static uint16_t get_raw_reading(touchio_touchin_obj_t *self) { - uint32_t touch_value; - touch_pad_read_raw_data(self->pin->touch_channel, &touch_value); - if (touch_value > UINT16_MAX) { - return UINT16_MAX; - } - return touch_value; -} +#include "shared-bindings/microcontroller/Pin.h" void common_hal_touchio_touchin_construct(touchio_touchin_obj_t *self, const mcu_pin_obj_t *pin) { - if (pin->touch_channel == TOUCH_PAD_MAX) { - mp_raise_ValueError(translate("Invalid pin")); + if (pin->touch_channel == NO_TOUCH_CHANNEL) { + raise_ValueError_invalid_pin(); } claim_pin(pin); // initialize touchpad peripherals_touch_init(pin->touch_channel); - // wait for touch data to reset - mp_hal_delay_ms(10); - // Set a "touched" threshold not too far above the initial value. // For simple finger touch, the values may vary as much as a factor of two, // but for touches using fruit or other objects, the difference is much less. self->pin = pin; - self->threshold = get_raw_reading(self) + 100; + self->threshold = common_hal_touchio_touchin_get_raw_value(self) + 100; } bool common_hal_touchio_touchin_deinited(touchio_touchin_obj_t *self) { @@ -72,11 +61,11 @@ void common_hal_touchio_touchin_deinit(touchio_touchin_obj_t *self) { } bool common_hal_touchio_touchin_get_value(touchio_touchin_obj_t *self) { - return get_raw_reading(self) > self->threshold; + return common_hal_touchio_touchin_get_raw_value(self) > self->threshold; } uint16_t common_hal_touchio_touchin_get_raw_value(touchio_touchin_obj_t *self) { - return get_raw_reading(self); + return peripherals_touch_read(self->pin->touch_channel); } uint16_t common_hal_touchio_touchin_get_threshold(touchio_touchin_obj_t *self) { diff --git a/ports/espressif/common-hal/wifi/Radio.c b/ports/espressif/common-hal/wifi/Radio.c index 4f92425c87..27e2c8c610 100644 --- a/ports/espressif/common-hal/wifi/Radio.c +++ b/ports/espressif/common-hal/wifi/Radio.c @@ -139,6 +139,16 @@ void common_hal_wifi_radio_set_mac_address(wifi_radio_obj_t *self, const uint8_t esp_wifi_set_mac(ESP_IF_WIFI_STA, mac); } +mp_float_t common_hal_wifi_radio_get_tx_power(wifi_radio_obj_t *self) { + int8_t tx_power; + esp_wifi_get_max_tx_power(&tx_power); + return tx_power / 4.0f; +} + +void common_hal_wifi_radio_set_tx_power(wifi_radio_obj_t *self, const mp_float_t tx_power) { + esp_wifi_set_max_tx_power(tx_power * 4.0f); +} + mp_obj_t common_hal_wifi_radio_get_mac_address_ap(wifi_radio_obj_t *self) { uint8_t mac[MAC_ADDRESS_LENGTH]; esp_wifi_get_mac(ESP_IF_WIFI_AP, mac); @@ -155,7 +165,7 @@ void common_hal_wifi_radio_set_mac_address_ap(wifi_radio_obj_t *self, const uint esp_wifi_set_mac(ESP_IF_WIFI_AP, mac); } -mp_obj_t common_hal_wifi_radio_start_scanning_networks(wifi_radio_obj_t *self) { +mp_obj_t common_hal_wifi_radio_start_scanning_networks(wifi_radio_obj_t *self, uint8_t start_channel, uint8_t stop_channel) { if (self->current_scan != NULL) { mp_raise_RuntimeError(translate("Already scanning for wifi networks")); } @@ -167,9 +177,12 @@ mp_obj_t common_hal_wifi_radio_start_scanning_networks(wifi_radio_obj_t *self) { wifi_scannednetworks_obj_t *scan = m_new_obj(wifi_scannednetworks_obj_t); scan->base.type = &wifi_scannednetworks_type; self->current_scan = scan; - scan->start_channel = 1; - scan->end_channel = 11; + scan->current_channel_index = 0; + scan->start_channel = start_channel; + scan->end_channel = stop_channel; scan->radio_event_group = self->event_group_handle; + scan->done = false; + scan->channel_scan_in_progress = false; wifi_scannednetworks_scan_next_channel(scan); return scan; } @@ -209,7 +222,7 @@ void common_hal_wifi_radio_start_ap(wifi_radio_obj_t *self, uint8_t *ssid, size_ authmode = WIFI_AUTH_WPA_WPA2_PSK; break; default: - mp_raise_ValueError(translate("Invalid AuthMode")); + mp_arg_error_invalid(MP_QSTR_authmode); break; } @@ -221,9 +234,8 @@ void common_hal_wifi_radio_start_ap(wifi_radio_obj_t *self, uint8_t *ssid, size_ config->ap.channel = channel; config->ap.authmode = authmode; - if (max_connections < 0 || max_connections > 10) { - mp_raise_ValueError(translate("max_connections must be between 0 and 10")); - } + mp_arg_validate_int_range(max_connections, 0, 10, MP_QSTR_max_connections); + config->ap.max_connection = max_connections; esp_wifi_set_config(WIFI_IF_AP, config); @@ -237,6 +249,11 @@ wifi_radio_error_t common_hal_wifi_radio_connect(wifi_radio_obj_t *self, uint8_t if (!common_hal_wifi_radio_get_enabled(self)) { mp_raise_RuntimeError(translate("wifi is not enabled")); } + wifi_config_t *config = &self->sta_config; + + size_t timeout_ms = timeout * 1000; + uint32_t start_time = common_hal_time_monotonic_ms(); + uint32_t end_time = start_time + timeout_ms; EventBits_t bits; // can't block since both bits are false after wifi_init @@ -246,18 +263,37 @@ wifi_radio_error_t common_hal_wifi_radio_connect(wifi_radio_obj_t *self, uint8_t pdTRUE, pdTRUE, 0); - if (((bits & WIFI_CONNECTED_BIT) != 0) && - !((bits & WIFI_DISCONNECTED_BIT) != 0)) { - return WIFI_RADIO_ERROR_NONE; + bool connected = ((bits & WIFI_CONNECTED_BIT) != 0) && + !((bits & WIFI_DISCONNECTED_BIT) != 0); + if (connected) { + // SSIDs are up to 32 bytes. Assume it is null terminated if it is less. + if (memcmp(ssid, config->sta.ssid, ssid_len) == 0 && + (ssid_len == 32 || strlen((const char *)config->sta.ssid) == ssid_len)) { + // Already connected to the desired network. + return WIFI_RADIO_ERROR_NONE; + } else { + xEventGroupClearBits(self->event_group_handle, WIFI_DISCONNECTED_BIT); + // Trying to switch networks so disconnect first. + esp_wifi_disconnect(); + do { + RUN_BACKGROUND_TASKS; + bits = xEventGroupWaitBits(self->event_group_handle, + WIFI_DISCONNECTED_BIT, + pdTRUE, + pdTRUE, + 0); + } while ((bits & WIFI_DISCONNECTED_BIT) == 0 && !mp_hal_is_interrupted()); + } } // explicitly clear bits since xEventGroupWaitBits may have timed out xEventGroupClearBits(self->event_group_handle, WIFI_CONNECTED_BIT); xEventGroupClearBits(self->event_group_handle, WIFI_DISCONNECTED_BIT); set_mode_station(self, true); - wifi_config_t *config = &self->sta_config; memcpy(&config->sta.ssid, ssid, ssid_len); - config->sta.ssid[ssid_len] = 0; + if (ssid_len < 32) { + config->sta.ssid[ssid_len] = 0; + } memcpy(&config->sta.password, password, password_len); config->sta.password[password_len] = 0; config->sta.channel = channel; @@ -290,7 +326,12 @@ wifi_radio_error_t common_hal_wifi_radio_connect(wifi_radio_obj_t *self, uint8_t pdTRUE, pdTRUE, 0); + // Don't retry anymore if we're over our time budget. + if (self->retries_left > 0 && common_hal_time_monotonic_ms() > end_time) { + self->retries_left = 0; + } } while ((bits & (WIFI_CONNECTED_BIT | WIFI_DISCONNECTED_BIT)) == 0 && !mp_hal_is_interrupted()); + if ((bits & WIFI_DISCONNECTED_BIT) != 0) { if (self->last_disconnect_reason == WIFI_REASON_AUTH_FAIL) { return WIFI_RADIO_ERROR_AUTH_FAIL; @@ -298,6 +339,9 @@ wifi_radio_error_t common_hal_wifi_radio_connect(wifi_radio_obj_t *self, uint8_t return WIFI_RADIO_ERROR_NO_AP_FOUND; } return self->last_disconnect_reason; + } else { + // We're connected, allow us to retry if we get disconnected. + self->retries_left = self->starting_retries; } return WIFI_RADIO_ERROR_NONE; } @@ -369,6 +413,14 @@ mp_obj_t common_hal_wifi_radio_get_ipv4_subnet_ap(wifi_radio_obj_t *self) { return common_hal_ipaddress_new_ipv4address(self->ap_ip_info.netmask.addr); } +uint32_t wifi_radio_get_ipv4_address(wifi_radio_obj_t *self) { + if (!esp_netif_is_netif_up(self->netif)) { + return 0; + } + esp_netif_get_ip_info(self->netif, &self->ip_info); + return self->ip_info.ip.addr; +} + mp_obj_t common_hal_wifi_radio_get_ipv4_address(wifi_radio_obj_t *self) { if (!esp_netif_is_netif_up(self->netif)) { return mp_const_none; @@ -399,6 +451,35 @@ mp_obj_t common_hal_wifi_radio_get_ipv4_dns(wifi_radio_obj_t *self) { return common_hal_ipaddress_new_ipv4address(self->dns_info.ip.u_addr.ip4.addr); } +void common_hal_wifi_radio_set_ipv4_dns(wifi_radio_obj_t *self, mp_obj_t ipv4_dns_addr) { + esp_netif_dns_info_t dns_addr; + ipaddress_ipaddress_to_esp_idf_ip4(ipv4_dns_addr, &dns_addr.ip.u_addr.ip4); + esp_netif_set_dns_info(self->netif, ESP_NETIF_DNS_MAIN, &dns_addr); +} + +void common_hal_wifi_radio_start_dhcp_client(wifi_radio_obj_t *self) { + esp_netif_dhcpc_start(self->netif); +} + +void common_hal_wifi_radio_stop_dhcp_client(wifi_radio_obj_t *self) { + esp_netif_dhcpc_stop(self->netif); +} + +void common_hal_wifi_radio_set_ipv4_address(wifi_radio_obj_t *self, mp_obj_t ipv4, mp_obj_t netmask, mp_obj_t gateway, mp_obj_t ipv4_dns) { + common_hal_wifi_radio_stop_dhcp_client(self); // Must stop DHCP to set a manual address + + esp_netif_ip_info_t ip_info; + ipaddress_ipaddress_to_esp_idf_ip4(ipv4, &ip_info.ip); + ipaddress_ipaddress_to_esp_idf_ip4(netmask, &ip_info.netmask); + ipaddress_ipaddress_to_esp_idf_ip4(gateway, &ip_info.gw); + + esp_netif_set_ip_info(self->netif, &ip_info); + + if (ipv4_dns != MP_OBJ_NULL) { + common_hal_wifi_radio_set_ipv4_dns(self, ipv4_dns); + } +} + mp_int_t common_hal_wifi_radio_ping(wifi_radio_obj_t *self, mp_obj_t ip_address, mp_float_t timeout) { esp_ping_config_t ping_config = ESP_PING_DEFAULT_CONFIG(); ipaddress_ipaddress_to_esp_idf(ip_address, &ping_config.target_addr); diff --git a/ports/espressif/common-hal/wifi/ScannedNetworks.c b/ports/espressif/common-hal/wifi/ScannedNetworks.c index 25c2da0473..50df9f8c95 100644 --- a/ports/espressif/common-hal/wifi/ScannedNetworks.c +++ b/ports/espressif/common-hal/wifi/ScannedNetworks.c @@ -72,7 +72,7 @@ mp_obj_t common_hal_wifi_scannednetworks_next(wifi_scannednetworks_obj_t *self) return mp_const_none; } // If we are scanning, wait and then load them. - if (self->scanning) { + if (self->channel_scan_in_progress) { // We may have to scan more than one channel to get a result. while (!self->done) { if (!wifi_scannednetworks_wait_for_scan(self)) { @@ -81,7 +81,7 @@ mp_obj_t common_hal_wifi_scannednetworks_next(wifi_scannednetworks_obj_t *self) } esp_wifi_scan_get_ap_num(&self->total_results); - self->scanning = false; + self->channel_scan_in_progress = false; if (self->total_results > 0) { break; } @@ -112,7 +112,7 @@ mp_obj_t common_hal_wifi_scannednetworks_next(wifi_scannednetworks_obj_t *self) } } esp_wifi_scan_get_ap_records(&self->total_results, self->results); - self->scanning = false; + self->channel_scan_in_progress = false; } wifi_network_obj_t *entry = m_new_obj(wifi_network_obj_t); @@ -132,40 +132,49 @@ mp_obj_t common_hal_wifi_scannednetworks_next(wifi_scannednetworks_obj_t *self) } // We don't do a linear scan so that we look at a variety of spectrum up front. -static uint8_t scan_pattern[] = {6, 1, 11, 3, 9, 13, 2, 4, 8, 12, 5, 7, 10, 14}; +static uint8_t scan_pattern[] = {6, 1, 11, 3, 9, 13, 2, 4, 8, 12, 5, 7, 10, 14, 0}; void wifi_scannednetworks_scan_next_channel(wifi_scannednetworks_obj_t *self) { - uint8_t next_channel = sizeof(scan_pattern); + // There is no channel 0, so use that as a flag to indicate we've run out of channels to scan. + uint8_t next_channel = 0; while (self->current_channel_index < sizeof(scan_pattern)) { next_channel = scan_pattern[self->current_channel_index]; self->current_channel_index++; + // Scan only channels that are in the specified range. if (self->start_channel <= next_channel && next_channel <= self->end_channel) { break; } } wifi_scan_config_t config = { 0 }; config.channel = next_channel; - if (next_channel == sizeof(scan_pattern)) { + if (next_channel == 0) { wifi_scannednetworks_done(self); } else { esp_err_t result = esp_wifi_scan_start(&config, false); if (result != ESP_OK) { wifi_scannednetworks_done(self); } else { - self->scanning = true; + self->channel_scan_in_progress = true; } } } void wifi_scannednetworks_deinit(wifi_scannednetworks_obj_t *self) { // if a scan is active, make sure and clean up the idf's buffer of results. - if (self->scanning) { + if (self->channel_scan_in_progress) { esp_wifi_scan_stop(); if (wifi_scannednetworks_wait_for_scan(self)) { - // Ignore the number of records since we're throwing them away. - uint16_t number = 0; - esp_wifi_scan_get_ap_records(&number, NULL); - self->scanning = false; + // Discard the scanned records, one at a time, to avoid memory leaks. + uint16_t number; + do { + number = 1; + wifi_ap_record_t record; + esp_wifi_scan_get_ap_records(&number, &record); + } while (number > 0); + // TODO: available in ESP-IDF v5.0; do instead of the above. + // Discard scan results. + // esp_wifi_clear_ap_list(); + self->channel_scan_in_progress = false; } } wifi_scannednetworks_done(self); diff --git a/ports/espressif/common-hal/wifi/ScannedNetworks.h b/ports/espressif/common-hal/wifi/ScannedNetworks.h index f089f27e3f..0ad4b5e3dc 100644 --- a/ports/espressif/common-hal/wifi/ScannedNetworks.h +++ b/ports/espressif/common-hal/wifi/ScannedNetworks.h @@ -53,7 +53,7 @@ typedef struct { uint8_t end_channel; // Inclusive bool done; - bool scanning; + bool channel_scan_in_progress; } wifi_scannednetworks_obj_t; void wifi_scannednetworks_scan_next_channel(wifi_scannednetworks_obj_t *self); diff --git a/ports/espressif/common-hal/wifi/__init__.c b/ports/espressif/common-hal/wifi/__init__.c index cb9b028aba..cfcfaf024b 100644 --- a/ports/espressif/common-hal/wifi/__init__.c +++ b/ports/espressif/common-hal/wifi/__init__.c @@ -24,6 +24,7 @@ * THE SOFTWARE. */ +#include "bindings/espidf/__init__.h" #include "common-hal/wifi/__init__.h" #include "shared-bindings/wifi/__init__.h" @@ -42,10 +43,35 @@ wifi_radio_obj_t common_hal_wifi_radio_obj; #include "components/log/include/esp_log.h" -static const char *TAG = "wifi"; +#include "supervisor/port.h" +#include "supervisor/workflow.h" + +#if CIRCUITPY_STATUS_BAR +#include "supervisor/shared/status_bar.h" +#endif + +#include "esp_ipc.h" + +#ifdef CONFIG_IDF_TARGET_ESP32 +#include "nvs_flash.h" +#endif + +static const char *TAG = "CP wifi"; + +STATIC void schedule_background_on_cp_core(void *arg) { + #if CIRCUITPY_STATUS_BAR + supervisor_status_bar_request_update(false); + #endif + + // CircuitPython's VM is run in a separate FreeRTOS task from wifi callbacks. So, we have to + // notify the main task every time in case it's waiting for us. + port_wake_main_task(); +} static void event_handler(void *arg, esp_event_base_t event_base, int32_t event_id, void *event_data) { + // This runs on the PRO CORE! It cannot share CP interrupt enable/disable + // directly. wifi_radio_obj_t *radio = arg; if (event_base == WIFI_EVENT) { switch (event_id) { @@ -106,12 +132,31 @@ static void event_handler(void *arg, esp_event_base_t event_base, radio->retries_left = radio->starting_retries; xEventGroupSetBits(radio->event_group_handle, WIFI_CONNECTED_BIT); } + // Use IPC to ensure we run schedule background on the same core as CircuitPython. + #if defined(CONFIG_FREERTOS_UNICORE) && CONFIG_FREERTOS_UNICORE + schedule_background_on_cp_core(NULL); + #else + // This only blocks until the start of the function. That's ok since the PRO + // core shouldn't care what we do. + esp_ipc_call(CONFIG_ESP_MAIN_TASK_AFFINITY, schedule_background_on_cp_core, NULL); + #endif } -static bool wifi_inited, wifi_ever_inited; +static bool wifi_inited; +static bool wifi_ever_inited; +static bool wifi_user_initiated; -void common_hal_wifi_init(void) { +void common_hal_wifi_init(bool user_initiated) { + wifi_radio_obj_t *self = &common_hal_wifi_radio_obj; + + if (wifi_inited) { + if (user_initiated && !wifi_user_initiated) { + common_hal_wifi_radio_set_enabled(self, true); + } + return; + } wifi_inited = true; + wifi_user_initiated = user_initiated; common_hal_wifi_radio_obj.base.type = &wifi_radio_type; if (!wifi_ever_inited) { @@ -120,7 +165,6 @@ void common_hal_wifi_init(void) { } wifi_ever_inited = true; - wifi_radio_obj_t *self = &common_hal_wifi_radio_obj; self->netif = esp_netif_create_default_wifi_sta(); self->ap_netif = esp_netif_create_default_wifi_ap(); self->started = false; @@ -128,7 +172,7 @@ void common_hal_wifi_init(void) { // Even though we just called esp_netif_create_default_wifi_sta, // station mode isn't actually ready for use until esp_wifi_set_mode() // is called and the configuration is loaded via esp_wifi_set_config(). - // Set both convienence flags to false so it's not forgotten. + // Set both convenience flags to false so it's not forgotten. self->sta_mode = 0; self->ap_mode = 0; @@ -145,11 +189,21 @@ void common_hal_wifi_init(void) { &self->handler_instance_got_ip)); wifi_init_config_t config = WIFI_INIT_CONFIG_DEFAULT(); + #ifdef CONFIG_IDF_TARGET_ESP32 + esp_err_t err = nvs_flash_init(); + if (err == ESP_ERR_NVS_NO_FREE_PAGES || err == ESP_ERR_NVS_NEW_VERSION_FOUND) { + // NVS partition was truncated and needs to be erased + // Retry nvs_flash_init + ESP_ERROR_CHECK(nvs_flash_erase()); + err = nvs_flash_init(); + } + ESP_ERROR_CHECK(err); + #endif esp_err_t result = esp_wifi_init(&config); if (result == ESP_ERR_NO_MEM) { mp_raise_msg(&mp_type_MemoryError, translate("Failed to allocate Wifi memory")); } else if (result != ESP_OK) { - mp_raise_RuntimeError(translate("Failed to init wifi")); + raise_esp_error(result); } // set station mode to avoid the default SoftAP common_hal_wifi_radio_start_station(self); @@ -157,6 +211,13 @@ void common_hal_wifi_init(void) { common_hal_wifi_radio_set_enabled(self, true); } +void wifi_user_reset(void) { + if (wifi_user_initiated) { + wifi_reset(); + wifi_user_initiated = false; + } +} + void wifi_reset(void) { if (!wifi_inited) { return; @@ -164,6 +225,7 @@ void wifi_reset(void) { common_hal_wifi_monitor_deinit(MP_STATE_VM(wifi_monitor_singleton)); wifi_radio_obj_t *radio = &common_hal_wifi_radio_obj; common_hal_wifi_radio_set_enabled(radio, false); + #ifndef CONFIG_IDF_TARGET_ESP32 ESP_ERROR_CHECK(esp_event_handler_instance_unregister(WIFI_EVENT, ESP_EVENT_ANY_ID, radio->handler_instance_all_wifi)); @@ -176,6 +238,8 @@ void wifi_reset(void) { esp_netif_destroy(radio->ap_netif); radio->ap_netif = NULL; wifi_inited = false; + #endif + supervisor_workflow_request_background(); } void ipaddress_ipaddress_to_esp_idf(mp_obj_t ip_address, ip_addr_t *esp_ip_address) { @@ -189,6 +253,16 @@ void ipaddress_ipaddress_to_esp_idf(mp_obj_t ip_address, ip_addr_t *esp_ip_addre IP_ADDR4(esp_ip_address, bytes[0], bytes[1], bytes[2], bytes[3]); } +void ipaddress_ipaddress_to_esp_idf_ip4(mp_obj_t ip_address, esp_ip4_addr_t *esp_ip_address) { + if (!mp_obj_is_type(ip_address, &ipaddress_ipv4address_type)) { + mp_raise_ValueError(translate("Only IPv4 addresses supported")); + } + mp_obj_t packed = common_hal_ipaddress_ipv4address_get_packed(ip_address); + size_t len; + const char *bytes = mp_obj_str_get_data(packed, &len); + esp_netif_set_ip4_addr(esp_ip_address, bytes[0], bytes[1], bytes[2], bytes[3]); +} + void common_hal_wifi_gc_collect(void) { common_hal_wifi_radio_gc_collect(&common_hal_wifi_radio_obj); } diff --git a/ports/espressif/common-hal/wifi/__init__.h b/ports/espressif/common-hal/wifi/__init__.h index be91dca758..4258f1643f 100644 --- a/ports/espressif/common-hal/wifi/__init__.h +++ b/ports/espressif/common-hal/wifi/__init__.h @@ -30,9 +30,11 @@ #include "py/obj.h" #include "lwip/api.h" +#include "components/esp_wifi/include/esp_wifi.h" void wifi_reset(void); void ipaddress_ipaddress_to_esp_idf(mp_obj_t ip_address, ip_addr_t *esp_ip_address); +void ipaddress_ipaddress_to_esp_idf_ip4(mp_obj_t ip_address, esp_ip4_addr_t *esp_ip_address); #endif // MICROPY_INCLUDED_ESPRESSIF_COMMON_HAL_WIFI___INIT___H diff --git a/ports/espressif/esp-idf b/ports/espressif/esp-idf index 944c01eef4..716d8531d7 160000 --- a/ports/espressif/esp-idf +++ b/ports/espressif/esp-idf @@ -1 +1 @@ -Subproject commit 944c01eef4fbba693f991f9d033cda3f59ca82c9 +Subproject commit 716d8531d71b122975e2966a24ec7613b87eb7b0 diff --git a/ports/espressif/esp-idf-config/partitions-16MB-no-uf2.csv b/ports/espressif/esp-idf-config/partitions-16MB-no-uf2.csv new file mode 100644 index 0000000000..8e73e8d056 --- /dev/null +++ b/ports/espressif/esp-idf-config/partitions-16MB-no-uf2.csv @@ -0,0 +1,9 @@ +# ESP-IDF Partition Table +# Name, Type, SubType, Offset, Size, Flags +# bootloader.bin,, 0x1000, 32K +# partition table,, 0x8000, 4K +nvs, data, nvs, 0x9000, 20K, +otadata, data, ota, 0xe000, 8K, +ota_0, 0, ota_0, 0x10000, 2048K, +ota_1, 0, ota_1, 0x210000, 2048K, +user_fs, data, fat, 0x410000, 12224K, diff --git a/ports/espressif/esp-idf-config/partitions-8MB-no-uf2.csv b/ports/espressif/esp-idf-config/partitions-8MB-no-uf2.csv new file mode 100644 index 0000000000..ba92d9fc73 --- /dev/null +++ b/ports/espressif/esp-idf-config/partitions-8MB-no-uf2.csv @@ -0,0 +1,9 @@ +# ESP-IDF Partition Table +# Name, Type, SubType, Offset, Size, Flags +# bootloader.bin,, 0x1000, 32K +# partition table,, 0x8000, 4K +nvs, data, nvs, 0x9000, 20K, +otadata, data, ota, 0xe000, 8K, +ota_0, app, ota_0, 0x10000, 2048K, +ota_1, app, ota_1, 0x210000, 2048K, +user_fs, data, fat, 0x410000, 4032K, diff --git a/ports/espressif/esp-idf-config/sdkconfig-16MB-no-uf2.defaults b/ports/espressif/esp-idf-config/sdkconfig-16MB-no-uf2.defaults new file mode 100644 index 0000000000..6065abcd93 --- /dev/null +++ b/ports/espressif/esp-idf-config/sdkconfig-16MB-no-uf2.defaults @@ -0,0 +1,18 @@ +# +# Serial flasher config +# +# CONFIG_ESPTOOLPY_FLASHSIZE_1MB is not set +# CONFIG_ESPTOOLPY_FLASHSIZE_2MB is not set +# CONFIG_ESPTOOLPY_FLASHSIZE_4MB is not set +# CONFIG_ESPTOOLPY_FLASHSIZE_8MB is not set +CONFIG_ESPTOOLPY_FLASHSIZE_16MB=y +CONFIG_ESPTOOLPY_FLASHSIZE="16MB" +CONFIG_ESPTOOLPY_FLASHSIZE_DETECT=y +# end of Serial flasher config + +CONFIG_PARTITION_TABLE_CUSTOM_FILENAME="esp-idf-config/partitions-16MB-no-uf2.csv" +# +# Partition Table +# +CONFIG_PARTITION_TABLE_FILENAME="esp-idf-config/partitions-16MB-no-uf2.csv" +# end of Partition Table diff --git a/ports/espressif/esp-idf-config/sdkconfig-8MB-no-uf2.defaults b/ports/espressif/esp-idf-config/sdkconfig-8MB-no-uf2.defaults new file mode 100644 index 0000000000..2a2548ba04 --- /dev/null +++ b/ports/espressif/esp-idf-config/sdkconfig-8MB-no-uf2.defaults @@ -0,0 +1,18 @@ +# +# Serial flasher config +# +# CONFIG_ESPTOOLPY_FLASHSIZE_1MB is not set +# CONFIG_ESPTOOLPY_FLASHSIZE_2MB is not set +# CONFIG_ESPTOOLPY_FLASHSIZE_4MB is not set +CONFIG_ESPTOOLPY_FLASHSIZE_8MB=y +# CONFIG_ESPTOOLPY_FLASHSIZE_16MB is not set +CONFIG_ESPTOOLPY_FLASHSIZE="8MB" +CONFIG_ESPTOOLPY_FLASHSIZE_DETECT=y +# end of Serial flasher config + +CONFIG_PARTITION_TABLE_CUSTOM_FILENAME="esp-idf-config/partitions-8MB-no-uf2.csv" +# +# Partition Table +# +CONFIG_PARTITION_TABLE_FILENAME="esp-idf-config/partitions-8MB-no-uf2.csv" +# end of Partition Table diff --git a/ports/espressif/esp-idf-config/sdkconfig-esp32.defaults b/ports/espressif/esp-idf-config/sdkconfig-esp32.defaults new file mode 100644 index 0000000000..57700c65ca --- /dev/null +++ b/ports/espressif/esp-idf-config/sdkconfig-esp32.defaults @@ -0,0 +1,1162 @@ +# +# Espressif IoT Development Framework (ESP-IDF) Project Configuration +# +CONFIG_IDF_TARGET_ARCH_XTENSA=y +CONFIG_IDF_TARGET="esp32" +CONFIG_IDF_TARGET_ESP32=y +CONFIG_IDF_FIRMWARE_CHIP_ID=0x0000 + +# +# SDK tool configuration +# +CONFIG_SDK_TOOLPREFIX="xtensa-esp32-elf-" +# CONFIG_SDK_TOOLCHAIN_SUPPORTS_TIME_WIDE_64_BITS is not set +# end of SDK tool configuration + +# +# Build type +# +CONFIG_APP_BUILD_TYPE_APP_2NDBOOT=y +# CONFIG_APP_BUILD_TYPE_ELF_RAM is not set +CONFIG_APP_BUILD_GENERATE_BINARIES=y +CONFIG_APP_BUILD_BOOTLOADER=y +CONFIG_APP_BUILD_USE_FLASH_SECTIONS=y +# end of Build type + +# +# Application manager +# +CONFIG_APP_COMPILE_TIME_DATE=y +# CONFIG_APP_EXCLUDE_PROJECT_VER_VAR is not set +# CONFIG_APP_EXCLUDE_PROJECT_NAME_VAR is not set +# CONFIG_APP_PROJECT_VER_FROM_CONFIG is not set +CONFIG_APP_RETRIEVE_LEN_ELF_SHA=16 +# end of Application manager + +# +# Bootloader config +# +CONFIG_BOOTLOADER_OFFSET_IN_FLASH=0x1000 +CONFIG_BOOTLOADER_COMPILER_OPTIMIZATION_SIZE=y +# CONFIG_BOOTLOADER_COMPILER_OPTIMIZATION_DEBUG is not set +# CONFIG_BOOTLOADER_COMPILER_OPTIMIZATION_PERF is not set +# CONFIG_BOOTLOADER_COMPILER_OPTIMIZATION_NONE is not set +CONFIG_BOOTLOADER_LOG_LEVEL_NONE=y +# CONFIG_BOOTLOADER_LOG_LEVEL_ERROR is not set +# CONFIG_BOOTLOADER_LOG_LEVEL_WARN is not set +# CONFIG_BOOTLOADER_LOG_LEVEL_INFO is not set +# CONFIG_BOOTLOADER_LOG_LEVEL_DEBUG is not set +# CONFIG_BOOTLOADER_LOG_LEVEL_VERBOSE is not set +CONFIG_BOOTLOADER_LOG_LEVEL=0 +# CONFIG_BOOTLOADER_VDDSDIO_BOOST_1_8V is not set +CONFIG_BOOTLOADER_VDDSDIO_BOOST_1_9V=y +# CONFIG_BOOTLOADER_FACTORY_RESET is not set +# CONFIG_BOOTLOADER_APP_TEST is not set +CONFIG_BOOTLOADER_WDT_ENABLE=y +# CONFIG_BOOTLOADER_WDT_DISABLE_IN_USER_CODE is not set +CONFIG_BOOTLOADER_WDT_TIME_MS=9000 +# CONFIG_BOOTLOADER_APP_ROLLBACK_ENABLE is not set +# CONFIG_BOOTLOADER_SKIP_VALIDATE_IN_DEEP_SLEEP is not set +# CONFIG_BOOTLOADER_SKIP_VALIDATE_ON_POWER_ON is not set +# CONFIG_BOOTLOADER_SKIP_VALIDATE_ALWAYS is not set +CONFIG_BOOTLOADER_RESERVE_RTC_SIZE=0 +# CONFIG_BOOTLOADER_CUSTOM_RESERVE_RTC is not set +CONFIG_BOOTLOADER_FLASH_XMC_SUPPORT=y +# end of Bootloader config + +# +# Security features +# +# CONFIG_SECURE_SIGNED_APPS_NO_SECURE_BOOT is not set +# CONFIG_SECURE_BOOT is not set +# CONFIG_SECURE_FLASH_ENC_ENABLED is not set +# end of Security features + +# +# Serial flasher config +# +CONFIG_ESPTOOLPY_BAUD_OTHER_VAL=115200 +# CONFIG_ESPTOOLPY_NO_STUB is not set +# CONFIG_ESPTOOLPY_FLASHMODE_QIO is not set +# CONFIG_ESPTOOLPY_FLASHMODE_QOUT is not set +CONFIG_ESPTOOLPY_FLASHMODE_DIO=y +# CONFIG_ESPTOOLPY_FLASHMODE_DOUT is not set +CONFIG_ESPTOOLPY_FLASH_SAMPLE_MODE_STR=y +CONFIG_ESPTOOLPY_FLASHMODE="dio" +# CONFIG_ESPTOOLPY_FLASHFREQ_80M is not set +CONFIG_ESPTOOLPY_FLASHFREQ_40M=y +# CONFIG_ESPTOOLPY_FLASHFREQ_26M is not set +# CONFIG_ESPTOOLPY_FLASHFREQ_20M is not set +CONFIG_ESPTOOLPY_FLASHFREQ="40m" +# CONFIG_ESPTOOLPY_FLASHSIZE_1MB is not set +# CONFIG_ESPTOOLPY_FLASHSIZE_2MB is not set +# CONFIG_ESPTOOLPY_FLASHSIZE_4MB is not set +# CONFIG_ESPTOOLPY_FLASHSIZE_8MB is not set +# CONFIG_ESPTOOLPY_FLASHSIZE_16MB is not set +# CONFIG_ESPTOOLPY_FLASHSIZE_32MB is not set +# CONFIG_ESPTOOLPY_FLASHSIZE_64MB is not set +# CONFIG_ESPTOOLPY_FLASHSIZE_128MB is not set +CONFIG_ESPTOOLPY_FLASHSIZE_DETECT=y +CONFIG_ESPTOOLPY_BEFORE_RESET=y +# CONFIG_ESPTOOLPY_BEFORE_NORESET is not set +CONFIG_ESPTOOLPY_BEFORE="default_reset" +CONFIG_ESPTOOLPY_AFTER_RESET=y +# CONFIG_ESPTOOLPY_AFTER_NORESET is not set +CONFIG_ESPTOOLPY_AFTER="hard_reset" +# CONFIG_ESPTOOLPY_MONITOR_BAUD_CONSOLE is not set +# CONFIG_ESPTOOLPY_MONITOR_BAUD_9600B is not set +# CONFIG_ESPTOOLPY_MONITOR_BAUD_57600B is not set +CONFIG_ESPTOOLPY_MONITOR_BAUD_115200B=y +# CONFIG_ESPTOOLPY_MONITOR_BAUD_230400B is not set +# CONFIG_ESPTOOLPY_MONITOR_BAUD_921600B is not set +# CONFIG_ESPTOOLPY_MONITOR_BAUD_2MB is not set +# CONFIG_ESPTOOLPY_MONITOR_BAUD_OTHER is not set +CONFIG_ESPTOOLPY_MONITOR_BAUD_OTHER_VAL=115200 +CONFIG_ESPTOOLPY_MONITOR_BAUD=115200 +# end of Serial flasher config + +# +# Compiler options +# +# CONFIG_COMPILER_OPTIMIZATION_DEFAULT is not set +CONFIG_COMPILER_OPTIMIZATION_SIZE=y +# CONFIG_COMPILER_OPTIMIZATION_PERF is not set +# CONFIG_COMPILER_OPTIMIZATION_NONE is not set +CONFIG_COMPILER_OPTIMIZATION_ASSERTIONS_ENABLE=y +# CONFIG_COMPILER_OPTIMIZATION_ASSERTIONS_SILENT is not set +# CONFIG_COMPILER_OPTIMIZATION_ASSERTIONS_DISABLE is not set +CONFIG_COMPILER_OPTIMIZATION_ASSERTION_LEVEL=2 +# CONFIG_COMPILER_OPTIMIZATION_CHECKS_SILENT is not set +CONFIG_COMPILER_HIDE_PATHS_MACROS=y +# CONFIG_COMPILER_CXX_EXCEPTIONS is not set +# CONFIG_COMPILER_CXX_RTTI is not set +CONFIG_COMPILER_STACK_CHECK_MODE_NONE=y +# CONFIG_COMPILER_STACK_CHECK_MODE_NORM is not set +# CONFIG_COMPILER_STACK_CHECK_MODE_STRONG is not set +# 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 + +# +# Component config +# + +# +# Application Level Tracing +# +# CONFIG_APPTRACE_DEST_JTAG is not set +CONFIG_APPTRACE_DEST_NONE=y +CONFIG_APPTRACE_LOCK_ENABLE=y +# end of Application Level Tracing + +# +# Bluetooth +# +# CONFIG_BT_ENABLED is not set +# end of Bluetooth + +# +# Driver configurations +# + +# +# ADC configuration +# +# CONFIG_ADC_FORCE_XPD_FSM is not set +CONFIG_ADC_DISABLE_DAC=y +# end of ADC configuration + +# +# MCPWM configuration +# +# CONFIG_MCPWM_ISR_IN_IRAM is not set +# end of MCPWM configuration + +# +# SPI configuration +# +# CONFIG_SPI_MASTER_IN_IRAM is not set +CONFIG_SPI_MASTER_ISR_IN_IRAM=y +# CONFIG_SPI_SLAVE_IN_IRAM is not set +CONFIG_SPI_SLAVE_ISR_IN_IRAM=y +# end of SPI configuration + +# +# TWAI configuration +# +# CONFIG_TWAI_ISR_IN_IRAM is not set +# CONFIG_TWAI_ERRATA_FIX_BUS_OFF_REC is not set +# CONFIG_TWAI_ERRATA_FIX_TX_INTR_LOST is not set +# CONFIG_TWAI_ERRATA_FIX_RX_FRAME_INVALID is not set +# CONFIG_TWAI_ERRATA_FIX_RX_FIFO_CORRUPT is not set +# end of TWAI configuration + +# +# UART configuration +# +CONFIG_UART_ISR_IN_IRAM=y +# end of UART configuration + +# +# RTCIO configuration +# +# CONFIG_RTCIO_SUPPORT_RTC_GPIO_DESC is not set +# end of RTCIO configuration + +# +# GPIO Configuration +# +# CONFIG_GPIO_ESP32_SUPPORT_SWITCH_SLP_PULL is not set +# end of GPIO Configuration + +# +# GDMA Configuration +# +# CONFIG_GDMA_CTRL_FUNC_IN_IRAM is not set +# CONFIG_GDMA_ISR_IRAM_SAFE is not set +# end of GDMA Configuration +# end of Driver configurations + +# +# eFuse Bit Manager +# +# CONFIG_EFUSE_CUSTOM_TABLE is not set +# CONFIG_EFUSE_VIRTUAL is not set +# CONFIG_EFUSE_CODE_SCHEME_COMPAT_NONE is not set +CONFIG_EFUSE_CODE_SCHEME_COMPAT_3_4=y +# CONFIG_EFUSE_CODE_SCHEME_COMPAT_REPEAT is not set +CONFIG_EFUSE_MAX_BLK_LEN=192 +# end of eFuse Bit Manager + +# +# ESP-TLS +# +CONFIG_ESP_TLS_USING_MBEDTLS=y +# CONFIG_ESP_TLS_USE_SECURE_ELEMENT is not set +# CONFIG_ESP_TLS_CLIENT_SESSION_TICKETS is not set +CONFIG_ESP_TLS_SERVER=y +# CONFIG_ESP_TLS_SERVER_SESSION_TICKETS is not set +# CONFIG_ESP_TLS_SERVER_MIN_AUTH_MODE_OPTIONAL is not set +# CONFIG_ESP_TLS_PSK_VERIFICATION is not set +# CONFIG_ESP_TLS_INSECURE is not set +# end of ESP-TLS + +# +# ESP32-specific +# +CONFIG_ESP32_ECO3_CACHE_LOCK_FIX=y +CONFIG_ESP32_REV_MIN_0=y +# CONFIG_ESP32_REV_MIN_1 is not set +# CONFIG_ESP32_REV_MIN_2 is not set +# CONFIG_ESP32_REV_MIN_3 is not set +CONFIG_ESP32_REV_MIN=0 +CONFIG_ESP32_DPORT_WORKAROUND=y +# CONFIG_ESP32_DEFAULT_CPU_FREQ_80 is not set +# CONFIG_ESP32_DEFAULT_CPU_FREQ_160 is not set +CONFIG_ESP32_DEFAULT_CPU_FREQ_240=y +CONFIG_ESP32_DEFAULT_CPU_FREQ_MHZ=240 +# CONFIG_ESP32_SPIRAM_SUPPORT is not set + +# +# SPIRAM cache workaround debugging +# +CONFIG_SPIRAM_CACHE_WORKAROUND_STRATEGY_MEMW=y +# CONFIG_SPIRAM_CACHE_WORKAROUND_STRATEGY_DUPLDST is not set +# CONFIG_SPIRAM_CACHE_WORKAROUND_STRATEGY_NOPS is not set +# end of SPIRAM cache workaround debugging + +# +# SPIRAM workaround libraries placement +# +CONFIG_SPIRAM_CACHE_LIBJMP_IN_IRAM=y +CONFIG_SPIRAM_CACHE_LIBMATH_IN_IRAM=y +CONFIG_SPIRAM_CACHE_LIBNUMPARSER_IN_IRAM=y +CONFIG_SPIRAM_CACHE_LIBIO_IN_IRAM=y +CONFIG_SPIRAM_CACHE_LIBTIME_IN_IRAM=y +CONFIG_SPIRAM_CACHE_LIBCHAR_IN_IRAM=y +CONFIG_SPIRAM_CACHE_LIBMEM_IN_IRAM=y +CONFIG_SPIRAM_CACHE_LIBSTR_IN_IRAM=y +CONFIG_SPIRAM_CACHE_LIBRAND_IN_IRAM=y +CONFIG_SPIRAM_CACHE_LIBENV_IN_IRAM=y +CONFIG_SPIRAM_CACHE_LIBFILE_IN_IRAM=y +CONFIG_SPIRAM_CACHE_LIBMISC_IN_IRAM=y +# end of SPIRAM workaround libraries placement + +CONFIG_SPIRAM_BANKSWITCH_ENABLE=n + +# +# PSRAM clock and cs IO for ESP32-DOWD +# +CONFIG_D0WD_PSRAM_CLK_IO=17 +CONFIG_D0WD_PSRAM_CS_IO=16 +# end of PSRAM clock and cs IO for ESP32-DOWD + +# +# PSRAM clock and cs IO for ESP32-D2WD +# +CONFIG_D2WD_PSRAM_CLK_IO=9 +CONFIG_D2WD_PSRAM_CS_IO=10 +# end of PSRAM clock and cs IO for ESP32-D2WD + +# +# PSRAM clock and cs IO for ESP32-PICO +# +CONFIG_PICO_PSRAM_CS_IO=10 +# end of PSRAM clock and cs IO for ESP32-PICO + +# CONFIG_SPIRAM_CUSTOM_SPIWP_SD3_PIN is not set +CONFIG_SPIRAM_SPIWP_SD3_PIN=7 +# CONFIG_SPIRAM_2T_MODE is not set +# end of SPI RAM config + +# CONFIG_ESP32_TRAX is not set +CONFIG_ESP32_TRACEMEM_RESERVE_DRAM=0x0 +# CONFIG_ESP32_ULP_COPROC_ENABLED is not set +CONFIG_ESP32_ULP_COPROC_RESERVE_MEM=0 +CONFIG_ESP32_DEBUG_OCDAWARE=y +CONFIG_ESP32_BROWNOUT_DET=y +CONFIG_ESP32_BROWNOUT_DET_LVL_SEL_0=y +# CONFIG_ESP32_BROWNOUT_DET_LVL_SEL_1 is not set +# CONFIG_ESP32_BROWNOUT_DET_LVL_SEL_2 is not set +# CONFIG_ESP32_BROWNOUT_DET_LVL_SEL_3 is not set +# CONFIG_ESP32_BROWNOUT_DET_LVL_SEL_4 is not set +# CONFIG_ESP32_BROWNOUT_DET_LVL_SEL_5 is not set +# CONFIG_ESP32_BROWNOUT_DET_LVL_SEL_6 is not set +# CONFIG_ESP32_BROWNOUT_DET_LVL_SEL_7 is not set +CONFIG_ESP32_BROWNOUT_DET_LVL=0 +CONFIG_ESP32_TIME_SYSCALL_USE_RTC_FRC1=y +# CONFIG_ESP32_TIME_SYSCALL_USE_RTC is not set +# CONFIG_ESP32_TIME_SYSCALL_USE_FRC1 is not set +# CONFIG_ESP32_TIME_SYSCALL_USE_NONE is not set +CONFIG_ESP32_RTC_CLK_SRC_INT_RC=y +# CONFIG_ESP32_RTC_CLK_SRC_EXT_CRYS is not set +# CONFIG_ESP32_RTC_CLK_SRC_EXT_OSC is not set +# CONFIG_ESP32_RTC_CLK_SRC_INT_8MD256 is not set +CONFIG_ESP32_RTC_CLK_CAL_CYCLES=1024 +CONFIG_ESP32_DEEP_SLEEP_WAKEUP_DELAY=2000 +CONFIG_ESP32_XTAL_FREQ_40=y +# CONFIG_ESP32_XTAL_FREQ_26 is not set +# CONFIG_ESP32_XTAL_FREQ_AUTO is not set +CONFIG_ESP32_XTAL_FREQ=40 +# CONFIG_ESP32_DISABLE_BASIC_ROM_CONSOLE is not set +# CONFIG_ESP32_NO_BLOBS is not set +# CONFIG_ESP32_COMPATIBLE_PRE_V2_1_BOOTLOADERS is not set +# CONFIG_ESP32_COMPATIBLE_PRE_V3_1_BOOTLOADERS is not set +# CONFIG_ESP32_USE_FIXED_STATIC_RAM_SIZE is not set +CONFIG_ESP32_DPORT_DIS_INTERRUPT_LVL=5 +# end of ESP32-specific + +# +# ADC-Calibration +# +CONFIG_ADC_CAL_EFUSE_TP_ENABLE=y +CONFIG_ADC_CAL_EFUSE_VREF_ENABLE=y +CONFIG_ADC_CAL_LUT_ENABLE=y +# end of ADC-Calibration + +# +# Common ESP-related +# +CONFIG_ESP_ERR_TO_NAME_LOOKUP=y +# end of Common ESP-related + +# +# Ethernet +# +# CONFIG_ETH_USE_ESP32_EMAC is not set +# CONFIG_ETH_USE_SPI_ETHERNET is not set +# CONFIG_ETH_USE_OPENETH is not set +# end of Ethernet + +# +# Event Loop Library +# +# CONFIG_ESP_EVENT_LOOP_PROFILING is not set +CONFIG_ESP_EVENT_POST_FROM_ISR=y +CONFIG_ESP_EVENT_POST_FROM_IRAM_ISR=y +# end of Event Loop Library + +# +# GDB Stub +# +# end of GDB Stub + +# +# Hardware Settings +# + +# +# MAC Config +# +CONFIG_ESP_MAC_ADDR_UNIVERSE_WIFI_STA=y +CONFIG_ESP_MAC_ADDR_UNIVERSE_WIFI_AP=y +CONFIG_ESP_MAC_ADDR_UNIVERSE_BT=y +CONFIG_ESP_MAC_ADDR_UNIVERSE_ETH=y +# CONFIG_ESP32_UNIVERSAL_MAC_ADDRESSES_TWO is not set +CONFIG_ESP32_UNIVERSAL_MAC_ADDRESSES_FOUR=y +CONFIG_ESP32_UNIVERSAL_MAC_ADDRESSES=4 +# end of MAC Config + +# +# Sleep Config +# +CONFIG_ESP_SLEEP_RTC_BUS_ISO_WORKAROUND=y +# CONFIG_ESP_SLEEP_GPIO_RESET_WORKAROUND is not set +# CONFIG_ESP_SLEEP_PSRAM_LEAKAGE_WORKAROUND is not set +# CONFIG_ESP_SLEEP_FLASH_LEAKAGE_WORKAROUND is not set +# end of Sleep Config + +# +# RTC Clock Config +# +# end of RTC Clock Config +# end of Hardware Settings + +# +# IPC (Inter-Processor Call) +# +CONFIG_ESP_IPC_TASK_STACK_SIZE=1536 +CONFIG_ESP_IPC_USES_CALLERS_PRIORITY=y +CONFIG_ESP_IPC_ISR_ENABLE=y +# end of IPC (Inter-Processor Call) + +# +# ESP NETIF Adapter +# +CONFIG_ESP_NETIF_IP_LOST_TIMER_INTERVAL=120 +CONFIG_ESP_NETIF_TCPIP_LWIP=y +# CONFIG_ESP_NETIF_LOOPBACK is not set +# CONFIG_ESP_NETIF_TCPIP_ADAPTER_COMPATIBLE_LAYER is not set +# end of ESP NETIF Adapter + +# +# PHY +# +CONFIG_ESP_PHY_CALIBRATION_AND_DATA_STORAGE=y +# CONFIG_ESP_PHY_INIT_DATA_IN_PARTITION is not set +CONFIG_ESP_PHY_MAX_WIFI_TX_POWER=20 +CONFIG_ESP_PHY_MAX_TX_POWER=20 +CONFIG_ESP_PHY_REDUCE_TX_POWER=y +# end of PHY + +# +# Power Management +# +# CONFIG_PM_ENABLE is not set +# end of Power Management + +# +# ESP System Settings +# +CONFIG_ESP_SYSTEM_PANIC_PRINT_HALT=y +# CONFIG_ESP_SYSTEM_PANIC_PRINT_REBOOT is not set +# CONFIG_ESP_SYSTEM_PANIC_SILENT_REBOOT is not set +# CONFIG_ESP_SYSTEM_PANIC_GDBSTUB is not set +# CONFIG_ESP_SYSTEM_GDBSTUB_RUNTIME is not set + +# +# Memory protection +# +# end of Memory protection + +CONFIG_ESP_SYSTEM_EVENT_QUEUE_SIZE=32 +CONFIG_ESP_SYSTEM_EVENT_TASK_STACK_SIZE=2304 +CONFIG_ESP_MAIN_TASK_AFFINITY_CPU0=y +# CONFIG_ESP_MAIN_TASK_AFFINITY_CPU1 is not set +# CONFIG_ESP_MAIN_TASK_AFFINITY_NO_AFFINITY is not set +CONFIG_ESP_MAIN_TASK_AFFINITY=0x0 +CONFIG_ESP_MINIMAL_SHARED_STACK_SIZE=2048 +# CONFIG_ESP_CONSOLE_UART_DEFAULT is not set +# CONFIG_ESP_CONSOLE_UART_CUSTOM is not set +CONFIG_ESP_CONSOLE_NONE=y +CONFIG_ESP_CONSOLE_MULTIPLE_UART=y +CONFIG_ESP_CONSOLE_UART_NUM=-1 +CONFIG_ESP_INT_WDT=y +CONFIG_ESP_INT_WDT_TIMEOUT_MS=300 +CONFIG_ESP_INT_WDT_CHECK_CPU1=y +# CONFIG_ESP_TASK_WDT is not set +# CONFIG_ESP_PANIC_HANDLER_IRAM is not set +# CONFIG_ESP_DEBUG_STUBS_ENABLE is not set +# CONFIG_ESP_SYSTEM_CHECK_INT_LEVEL_5 is not set +CONFIG_ESP_SYSTEM_CHECK_INT_LEVEL_4=y +# end of ESP System Settings + +# +# High resolution timer (esp_timer) +# +# CONFIG_ESP_TIMER_PROFILING is not set +CONFIG_ESP_TIME_FUNCS_USE_RTC_TIMER=y +CONFIG_ESP_TIME_FUNCS_USE_ESP_TIMER=y +CONFIG_ESP_TIMER_TASK_STACK_SIZE=3584 +CONFIG_ESP_TIMER_INTERRUPT_LEVEL=1 +# CONFIG_ESP_TIMER_SUPPORTS_ISR_DISPATCH_METHOD is not set +# CONFIG_ESP_TIMER_IMPL_FRC2 is not set +CONFIG_ESP_TIMER_IMPL_TG0_LAC=y +# end of High resolution timer (esp_timer) + +# +# Wi-Fi +# +CONFIG_ESP32_WIFI_ENABLED=y +CONFIG_ESP32_WIFI_STATIC_RX_BUFFER_NUM=10 +CONFIG_ESP32_WIFI_DYNAMIC_RX_BUFFER_NUM=32 +CONFIG_ESP32_WIFI_STATIC_TX_BUFFER=y +# CONFIG_ESP32_WIFI_DYNAMIC_TX_BUFFER is not set +CONFIG_ESP32_WIFI_TX_BUFFER_TYPE=0 +CONFIG_ESP32_WIFI_STATIC_TX_BUFFER_NUM=16 +CONFIG_ESP32_WIFI_CACHE_TX_BUFFER_NUM=32 +# CONFIG_ESP32_WIFI_CSI_ENABLED is not set +CONFIG_ESP32_WIFI_AMPDU_TX_ENABLED=y +CONFIG_ESP32_WIFI_TX_BA_WIN=6 +CONFIG_ESP32_WIFI_AMPDU_RX_ENABLED=y +CONFIG_ESP32_WIFI_RX_BA_WIN=6 +# CONFIG_ESP32_WIFI_AMSDU_TX_ENABLED is not set +CONFIG_ESP32_WIFI_NVS_ENABLED=y +CONFIG_ESP32_WIFI_TASK_PINNED_TO_CORE_0=y +# CONFIG_ESP32_WIFI_TASK_PINNED_TO_CORE_1 is not set +CONFIG_ESP32_WIFI_SOFTAP_BEACON_MAX_LEN=752 +CONFIG_ESP32_WIFI_MGMT_SBUF_NUM=32 +CONFIG_ESP32_WIFI_IRAM_OPT=y +CONFIG_ESP32_WIFI_RX_IRAM_OPT=y +CONFIG_ESP32_WIFI_ENABLE_WPA3_SAE=y +# CONFIG_ESP_WIFI_SLP_IRAM_OPT is not set +# CONFIG_ESP_WIFI_STA_DISCONNECTED_PM_ENABLE is not set +# CONFIG_ESP_WIFI_GMAC_SUPPORT is not set +CONFIG_ESP_WIFI_SOFTAP_SUPPORT=y +# end of Wi-Fi + +# +# Core dump +# +# CONFIG_ESP_COREDUMP_ENABLE_TO_FLASH is not set +# CONFIG_ESP_COREDUMP_ENABLE_TO_UART is not set +CONFIG_ESP_COREDUMP_ENABLE_TO_NONE=y +# end of Core dump + +# +# FreeRTOS +# +# CONFIG_FREERTOS_UNICORE is not set +CONFIG_FREERTOS_NO_AFFINITY=0x7FFFFFFF +CONFIG_FREERTOS_TICK_SUPPORT_CORETIMER=y +CONFIG_FREERTOS_CORETIMER_0=y +# CONFIG_FREERTOS_CORETIMER_1 is not set +CONFIG_FREERTOS_SYSTICK_USES_CCOUNT=y +CONFIG_FREERTOS_HZ=100 +CONFIG_FREERTOS_ASSERT_ON_UNTESTED_FUNCTION=y +# CONFIG_FREERTOS_CHECK_STACKOVERFLOW_NONE is not set +# CONFIG_FREERTOS_CHECK_STACKOVERFLOW_PTRVAL is not set +CONFIG_FREERTOS_CHECK_STACKOVERFLOW_CANARY=y +# CONFIG_FREERTOS_WATCHPOINT_END_OF_STACK is not set +CONFIG_FREERTOS_INTERRUPT_BACKTRACE=y +CONFIG_FREERTOS_THREAD_LOCAL_STORAGE_POINTERS=1 +CONFIG_FREERTOS_ASSERT_FAIL_ABORT=y +# CONFIG_FREERTOS_ASSERT_FAIL_PRINT_CONTINUE is not set +# CONFIG_FREERTOS_ASSERT_DISABLE is not set +CONFIG_FREERTOS_IDLE_TASK_STACKSIZE=1536 +CONFIG_FREERTOS_ISR_STACKSIZE=1536 +# CONFIG_FREERTOS_LEGACY_HOOKS is not set +CONFIG_FREERTOS_MAX_TASK_NAME_LEN=16 +CONFIG_FREERTOS_SUPPORT_STATIC_ALLOCATION=y +# CONFIG_FREERTOS_ENABLE_STATIC_TASK_CLEAN_UP is not set +CONFIG_FREERTOS_TIMER_TASK_PRIORITY=1 +CONFIG_FREERTOS_TIMER_TASK_STACK_DEPTH=2048 +CONFIG_FREERTOS_TIMER_QUEUE_LENGTH=10 +CONFIG_FREERTOS_QUEUE_REGISTRY_SIZE=0 +# CONFIG_FREERTOS_USE_TRACE_FACILITY is not set +# 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 +# CONFIG_FREERTOS_FPU_IN_ISR is not set +CONFIG_FREERTOS_ENABLE_TASK_SNAPSHOT=y +# CONFIG_FREERTOS_PLACE_SNAPSHOT_FUNS_INTO_FLASH is not set +# end of FreeRTOS + +# +# Hardware Abstraction Layer (HAL) and Low Level (LL) +# +CONFIG_HAL_ASSERTION_EQUALS_SYSTEM=y +# CONFIG_HAL_ASSERTION_DISABLE is not set +# CONFIG_HAL_ASSERTION_SILIENT is not set +# CONFIG_HAL_ASSERTION_ENABLE is not set +CONFIG_HAL_DEFAULT_ASSERTION_LEVEL=2 +# end of Hardware Abstraction Layer (HAL) and Low Level (LL) + +# +# Heap memory debugging +# +CONFIG_HEAP_POISONING_DISABLED=y +# CONFIG_HEAP_POISONING_LIGHT is not set +# CONFIG_HEAP_POISONING_COMPREHENSIVE is not set +CONFIG_HEAP_TRACING_OFF=y +# CONFIG_HEAP_TRACING_STANDALONE is not set +# CONFIG_HEAP_TRACING_TOHOST is not set +# CONFIG_HEAP_ABORT_WHEN_ALLOCATION_FAILS is not set +# end of Heap memory debugging + +# +# Log output +# +# CONFIG_LOG_DEFAULT_LEVEL_NONE is not set +# CONFIG_LOG_DEFAULT_LEVEL_ERROR is not set +# CONFIG_LOG_DEFAULT_LEVEL_WARN is not set +CONFIG_LOG_DEFAULT_LEVEL_INFO=y +# CONFIG_LOG_DEFAULT_LEVEL_DEBUG is not set +# CONFIG_LOG_DEFAULT_LEVEL_VERBOSE is not set +CONFIG_LOG_DEFAULT_LEVEL=3 +CONFIG_LOG_MAXIMUM_EQUALS_DEFAULT=y +# CONFIG_LOG_MAXIMUM_LEVEL_DEBUG is not set +# CONFIG_LOG_MAXIMUM_LEVEL_VERBOSE is not set +CONFIG_LOG_MAXIMUM_LEVEL=3 +CONFIG_LOG_COLORS=y +CONFIG_LOG_TIMESTAMP_SOURCE_RTOS=y +# CONFIG_LOG_TIMESTAMP_SOURCE_SYSTEM is not set +# end of Log output + +# +# LWIP +# +CONFIG_LWIP_LOCAL_HOSTNAME="Adafruit-Feather-ESP32-V2" +# CONFIG_LWIP_NETIF_API is not set +# CONFIG_LWIP_TCPIP_CORE_LOCKING is not set +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=8 +# CONFIG_LWIP_USE_ONLY_LWIP_SELECT is not set +# CONFIG_LWIP_SO_LINGER is not set +CONFIG_LWIP_SO_REUSE=y +CONFIG_LWIP_SO_REUSE_RXTOALL=y +CONFIG_LWIP_SO_RCVBUF=y +# CONFIG_LWIP_NETBUF_RECVINFO is not set +CONFIG_LWIP_IP4_FRAG=y +CONFIG_LWIP_IP6_FRAG=y +# CONFIG_LWIP_IP4_REASSEMBLY is not set +# CONFIG_LWIP_IP6_REASSEMBLY is not set +# CONFIG_LWIP_IP_FORWARD is not set +# CONFIG_LWIP_STATS is not set +# CONFIG_LWIP_ETHARP_TRUST_IP_MAC is not set +CONFIG_LWIP_ESP_GRATUITOUS_ARP=y +CONFIG_LWIP_GARP_TMR_INTERVAL=60 +CONFIG_LWIP_TCPIP_RECVMBOX_SIZE=32 +CONFIG_LWIP_DHCP_DOES_ARP_CHECK=y +# CONFIG_LWIP_DHCP_DISABLE_CLIENT_ID is not set +CONFIG_LWIP_DHCP_DISABLE_VENDOR_CLASS_ID=y +# CONFIG_LWIP_DHCP_RESTORE_LAST_IP is not set +CONFIG_LWIP_DHCP_OPTIONS_LEN=68 + +# +# DHCP server +# +CONFIG_LWIP_DHCPS=y +CONFIG_LWIP_DHCPS_LEASE_UNIT=60 +CONFIG_LWIP_DHCPS_MAX_STATION_NUM=8 +# end of DHCP server + +# CONFIG_LWIP_AUTOIP is not set +CONFIG_LWIP_IPV6=y +# CONFIG_LWIP_IPV6_AUTOCONFIG is not set +CONFIG_LWIP_IPV6_NUM_ADDRESSES=3 +# CONFIG_LWIP_IPV6_FORWARD is not set +# CONFIG_LWIP_NETIF_STATUS_CALLBACK is not set +CONFIG_LWIP_NETIF_LOOPBACK=y +CONFIG_LWIP_LOOPBACK_MAX_PBUFS=8 + +# +# TCP +# +CONFIG_LWIP_MAX_ACTIVE_TCP=4 +CONFIG_LWIP_MAX_LISTENING_TCP=4 +CONFIG_LWIP_TCP_HIGH_SPEED_RETRANSMISSION=y +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=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 +# CONFIG_LWIP_TCP_KEEP_CONNECTION_WHEN_IP_CHANGES is not set +CONFIG_LWIP_TCP_OVERSIZE_MSS=y +# CONFIG_LWIP_TCP_OVERSIZE_QUARTER_MSS is not set +# CONFIG_LWIP_TCP_OVERSIZE_DISABLE is not set +CONFIG_LWIP_TCP_RTO_TIME=3000 +# end of TCP + +# +# UDP +# +CONFIG_LWIP_MAX_UDP_PCBS=16 +CONFIG_LWIP_UDP_RECVMBOX_SIZE=6 +# end of UDP + +# +# Checksums +# +# CONFIG_LWIP_CHECKSUM_CHECK_IP is not set +# CONFIG_LWIP_CHECKSUM_CHECK_UDP is not set +CONFIG_LWIP_CHECKSUM_CHECK_ICMP=y +# end of Checksums + +CONFIG_LWIP_TCPIP_TASK_STACK_SIZE=3072 +CONFIG_LWIP_TCPIP_TASK_AFFINITY_NO_AFFINITY=y +# CONFIG_LWIP_TCPIP_TASK_AFFINITY_CPU0 is not set +# CONFIG_LWIP_TCPIP_TASK_AFFINITY_CPU1 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 + +# +# ICMP +# +CONFIG_LWIP_ICMP=y +# CONFIG_LWIP_MULTICAST_PING is not set +# CONFIG_LWIP_BROADCAST_PING is not set +# end of ICMP + +# +# LWIP RAW API +# +CONFIG_LWIP_MAX_RAW_PCBS=16 +# end of LWIP RAW API + +# +# SNTP +# +CONFIG_LWIP_SNTP_MAX_SERVERS=1 +# CONFIG_LWIP_DHCP_GET_NTP_SRV is not set +CONFIG_LWIP_SNTP_UPDATE_DELAY=3600000 +# end of SNTP + +CONFIG_LWIP_ESP_LWIP_ASSERT=y + +# +# Hooks +# +# CONFIG_LWIP_HOOK_TCP_ISN_NONE is not set +CONFIG_LWIP_HOOK_TCP_ISN_DEFAULT=y +# CONFIG_LWIP_HOOK_TCP_ISN_CUSTOM is not set +CONFIG_LWIP_HOOK_IP6_ROUTE_NONE=y +# CONFIG_LWIP_HOOK_IP6_ROUTE_DEFAULT is not set +# CONFIG_LWIP_HOOK_IP6_ROUTE_CUSTOM is not set +CONFIG_LWIP_HOOK_ND6_GET_GW_NONE=y +# CONFIG_LWIP_HOOK_ND6_GET_GW_DEFAULT is not set +# CONFIG_LWIP_HOOK_ND6_GET_GW_CUSTOM is not set +CONFIG_LWIP_HOOK_NETCONN_EXT_RESOLVE_NONE=y +# CONFIG_LWIP_HOOK_NETCONN_EXT_RESOLVE_DEFAULT is not set +# CONFIG_LWIP_HOOK_NETCONN_EXT_RESOLVE_CUSTOM is not set +# end of Hooks + +# CONFIG_LWIP_DEBUG is not set +# end of LWIP + +# +# mbedTLS +# +CONFIG_MBEDTLS_INTERNAL_MEM_ALLOC=y +# CONFIG_MBEDTLS_DEFAULT_MEM_ALLOC is not set +# 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=2048 +# CONFIG_MBEDTLS_DEBUG is not set + +# +# mbedTLS v2.28.x related +# +# CONFIG_MBEDTLS_SSL_VARIABLE_BUFFER_LENGTH is not set +CONFIG_MBEDTLS_ECDH_LEGACY_CONTEXT=y +# CONFIG_MBEDTLS_X509_TRUSTED_CERT_CALLBACK is not set +# CONFIG_MBEDTLS_SSL_CONTEXT_SERIALIZATION is not set +CONFIG_MBEDTLS_SSL_KEEP_PEER_CERTIFICATE=y + +# +# DTLS-based configurations +# +# CONFIG_MBEDTLS_SSL_DTLS_CONNECTION_ID is not set +# CONFIG_MBEDTLS_SSL_DTLS_SRTP is not set +# end of DTLS-based configurations +# end of mbedTLS v2.28.x related + +# +# Certificate Bundle +# +CONFIG_MBEDTLS_CERTIFICATE_BUNDLE=y +# CONFIG_MBEDTLS_CERTIFICATE_BUNDLE_DEFAULT_FULL is not set +# CONFIG_MBEDTLS_CERTIFICATE_BUNDLE_DEFAULT_CMN is not set +CONFIG_MBEDTLS_CERTIFICATE_BUNDLE_DEFAULT_NONE=y +CONFIG_MBEDTLS_CUSTOM_CERTIFICATE_BUNDLE=y +CONFIG_MBEDTLS_CUSTOM_CERTIFICATE_BUNDLE_PATH="../../lib/certificates/nina-fw/data/roots.pem" +# end of Certificate Bundle + +CONFIG_MBEDTLS_ECP_RESTARTABLE=y +CONFIG_MBEDTLS_CMAC_C=y +CONFIG_MBEDTLS_HARDWARE_AES=y +CONFIG_MBEDTLS_HARDWARE_MPI=y +CONFIG_MBEDTLS_HARDWARE_SHA=y +CONFIG_MBEDTLS_ROM_MD5=y +# CONFIG_MBEDTLS_ATCA_HW_ECDSA_SIGN is not set +# CONFIG_MBEDTLS_ATCA_HW_ECDSA_VERIFY is not set +CONFIG_MBEDTLS_HAVE_TIME=y +# CONFIG_MBEDTLS_HAVE_TIME_DATE is not set +CONFIG_MBEDTLS_ECDSA_DETERMINISTIC=y +CONFIG_MBEDTLS_SHA512_C=y +CONFIG_MBEDTLS_TLS_SERVER_AND_CLIENT=y +# CONFIG_MBEDTLS_TLS_SERVER_ONLY is not set +# CONFIG_MBEDTLS_TLS_CLIENT_ONLY is not set +# CONFIG_MBEDTLS_TLS_DISABLED is not set +CONFIG_MBEDTLS_TLS_SERVER=y +CONFIG_MBEDTLS_TLS_CLIENT=y +CONFIG_MBEDTLS_TLS_ENABLED=y + +# +# TLS Key Exchange Methods +# +CONFIG_MBEDTLS_PSK_MODES=y +CONFIG_MBEDTLS_KEY_EXCHANGE_PSK=y +CONFIG_MBEDTLS_KEY_EXCHANGE_DHE_PSK=y +CONFIG_MBEDTLS_KEY_EXCHANGE_ECDHE_PSK=y +CONFIG_MBEDTLS_KEY_EXCHANGE_RSA_PSK=y +CONFIG_MBEDTLS_KEY_EXCHANGE_RSA=y +CONFIG_MBEDTLS_KEY_EXCHANGE_DHE_RSA=y +CONFIG_MBEDTLS_KEY_EXCHANGE_ELLIPTIC_CURVE=y +CONFIG_MBEDTLS_KEY_EXCHANGE_ECDHE_RSA=y +CONFIG_MBEDTLS_KEY_EXCHANGE_ECDHE_ECDSA=y +CONFIG_MBEDTLS_KEY_EXCHANGE_ECDH_ECDSA=y +CONFIG_MBEDTLS_KEY_EXCHANGE_ECDH_RSA=y +# end of TLS Key Exchange Methods + +CONFIG_MBEDTLS_SSL_RENEGOTIATION=y +# CONFIG_MBEDTLS_SSL_PROTO_SSL3 is not set +# CONFIG_MBEDTLS_SSL_PROTO_TLS1 is not set +# CONFIG_MBEDTLS_SSL_PROTO_TLS1_1 is not set +CONFIG_MBEDTLS_SSL_PROTO_TLS1_2=y +# CONFIG_MBEDTLS_SSL_PROTO_GMTSSL1_1 is not set +CONFIG_MBEDTLS_SSL_PROTO_DTLS=y +CONFIG_MBEDTLS_SSL_ALPN=y +CONFIG_MBEDTLS_CLIENT_SSL_SESSION_TICKETS=y +CONFIG_MBEDTLS_X509_CHECK_KEY_USAGE=y +CONFIG_MBEDTLS_X509_CHECK_EXTENDED_KEY_USAGE=y +CONFIG_MBEDTLS_SERVER_SSL_SESSION_TICKETS=y + +# +# Symmetric Ciphers +# +CONFIG_MBEDTLS_AES_C=y +# CONFIG_MBEDTLS_CAMELLIA_C is not set +# CONFIG_MBEDTLS_DES_C is not set +CONFIG_MBEDTLS_RC4_DISABLED=y +# CONFIG_MBEDTLS_RC4_ENABLED_NO_DEFAULT is not set +# CONFIG_MBEDTLS_RC4_ENABLED is not set +# CONFIG_MBEDTLS_BLOWFISH_C is not set +# CONFIG_MBEDTLS_XTEA_C is not set +CONFIG_MBEDTLS_CCM_C=y +CONFIG_MBEDTLS_GCM_C=y +# CONFIG_MBEDTLS_NIST_KW_C is not set +# end of Symmetric Ciphers + +# CONFIG_MBEDTLS_RIPEMD160_C is not set + +# +# Certificates +# +CONFIG_MBEDTLS_PEM_PARSE_C=y +CONFIG_MBEDTLS_PEM_WRITE_C=y +CONFIG_MBEDTLS_X509_CRL_PARSE_C=y +CONFIG_MBEDTLS_X509_CSR_PARSE_C=y +# end of Certificates + +CONFIG_MBEDTLS_ECP_C=y +CONFIG_MBEDTLS_ECDH_C=y +CONFIG_MBEDTLS_ECDSA_C=y +# CONFIG_MBEDTLS_ECJPAKE_C is not set +CONFIG_MBEDTLS_ECP_DP_SECP192R1_ENABLED=y +CONFIG_MBEDTLS_ECP_DP_SECP224R1_ENABLED=y +CONFIG_MBEDTLS_ECP_DP_SECP256R1_ENABLED=y +CONFIG_MBEDTLS_ECP_DP_SECP384R1_ENABLED=y +CONFIG_MBEDTLS_ECP_DP_SECP521R1_ENABLED=y +CONFIG_MBEDTLS_ECP_DP_SECP192K1_ENABLED=y +CONFIG_MBEDTLS_ECP_DP_SECP224K1_ENABLED=y +CONFIG_MBEDTLS_ECP_DP_SECP256K1_ENABLED=y +CONFIG_MBEDTLS_ECP_DP_BP256R1_ENABLED=y +CONFIG_MBEDTLS_ECP_DP_BP384R1_ENABLED=y +CONFIG_MBEDTLS_ECP_DP_BP512R1_ENABLED=y +CONFIG_MBEDTLS_ECP_DP_CURVE25519_ENABLED=y +CONFIG_MBEDTLS_ECP_NIST_OPTIM=y +# CONFIG_MBEDTLS_POLY1305_C is not set +# CONFIG_MBEDTLS_CHACHA20_C is not set +# CONFIG_MBEDTLS_HKDF_C is not set +# CONFIG_MBEDTLS_THREADING_C is not set +# CONFIG_MBEDTLS_LARGE_KEY_SOFTWARE_MPI is not set +# CONFIG_MBEDTLS_SECURITY_RISKS is not set +# end of mbedTLS + +# +# mDNS +# +CONFIG_MDNS_MAX_SERVICES=10 +CONFIG_MDNS_TASK_PRIORITY=1 +CONFIG_MDNS_TASK_STACK_SIZE=4096 +# CONFIG_MDNS_TASK_AFFINITY_NO_AFFINITY is not set +CONFIG_MDNS_TASK_AFFINITY_CPU0=y +# CONFIG_MDNS_TASK_AFFINITY_CPU1 is not set +CONFIG_MDNS_TASK_AFFINITY=0x0 +CONFIG_MDNS_SERVICE_ADD_TIMEOUT_MS=2000 +# CONFIG_MDNS_STRICT_MODE is not set +CONFIG_MDNS_TIMER_PERIOD_MS=100 +# CONFIG_MDNS_NETWORKING_SOCKET is not set +CONFIG_MDNS_MULTIPLE_INSTANCE=y +# end of mDNS + +# +# Newlib +# +CONFIG_NEWLIB_STDOUT_LINE_ENDING_CRLF=y +# CONFIG_NEWLIB_STDOUT_LINE_ENDING_LF is not set +# CONFIG_NEWLIB_STDOUT_LINE_ENDING_CR is not set +# CONFIG_NEWLIB_STDIN_LINE_ENDING_CRLF is not set +# CONFIG_NEWLIB_STDIN_LINE_ENDING_LF is not set +CONFIG_NEWLIB_STDIN_LINE_ENDING_CR=y +# CONFIG_NEWLIB_NANO_FORMAT is not set +# end of Newlib + +# +# NVS +# +# end of NVS + +# +# OpenThread +# +# CONFIG_OPENTHREAD_ENABLED is not set +# end of OpenThread + +# +# PThreads +# +CONFIG_PTHREAD_TASK_PRIO_DEFAULT=5 +CONFIG_PTHREAD_TASK_STACK_SIZE_DEFAULT=3072 +CONFIG_PTHREAD_STACK_MIN=768 +CONFIG_PTHREAD_DEFAULT_CORE_NO_AFFINITY=y +# CONFIG_PTHREAD_DEFAULT_CORE_0 is not set +# CONFIG_PTHREAD_DEFAULT_CORE_1 is not set +CONFIG_PTHREAD_TASK_CORE_DEFAULT=-1 +CONFIG_PTHREAD_TASK_NAME_DEFAULT="pthread" +# end of PThreads + +# +# SPI Flash driver +# +# CONFIG_SPI_FLASH_VERIFY_WRITE is not set +# CONFIG_SPI_FLASH_ENABLE_COUNTERS is not set +CONFIG_SPI_FLASH_ROM_DRIVER_PATCH=y +CONFIG_SPI_FLASH_DANGEROUS_WRITE_ABORTS=y +# CONFIG_SPI_FLASH_DANGEROUS_WRITE_FAILS is not set +# CONFIG_SPI_FLASH_DANGEROUS_WRITE_ALLOWED is not set +# CONFIG_SPI_FLASH_USE_LEGACY_IMPL is not set +# CONFIG_SPI_FLASH_SHARE_SPI1_BUS is not set +# CONFIG_SPI_FLASH_BYPASS_BLOCK_ERASE is not set +# CONFIG_SPI_FLASH_YIELD_DURING_ERASE is not set +CONFIG_SPI_FLASH_WRITE_CHUNK_SIZE=4096 +# CONFIG_SPI_FLASH_SIZE_OVERRIDE is not set +# CONFIG_SPI_FLASH_CHECK_ERASE_TIMEOUT_DISABLED is not set +# CONFIG_SPI_FLASH_OVERRIDE_CHIP_DRIVER_LIST is not set + +# +# Auto-detect flash chips +# +CONFIG_SPI_FLASH_SUPPORT_ISSI_CHIP=y +CONFIG_SPI_FLASH_SUPPORT_MXIC_CHIP=y +CONFIG_SPI_FLASH_SUPPORT_GD_CHIP=y +CONFIG_SPI_FLASH_SUPPORT_WINBOND_CHIP=y +CONFIG_SPI_FLASH_SUPPORT_BOYA_CHIP=y +CONFIG_SPI_FLASH_SUPPORT_TH_CHIP=y +# end of Auto-detect flash chips + +CONFIG_SPI_FLASH_ENABLE_ENCRYPTED_READ_WRITE=y +# end of SPI Flash driver + +# +# Virtual file system +# +CONFIG_VFS_SUPPORT_IO=y +CONFIG_VFS_SUPPORT_DIR=y +CONFIG_VFS_SUPPORT_SELECT=y +CONFIG_VFS_SUPPRESS_SELECT_DEBUG_OUTPUT=y +CONFIG_VFS_SUPPORT_TERMIOS=y + +# +# Host File System I/O (Semihosting) +# +CONFIG_VFS_SEMIHOSTFS_MAX_MOUNT_POINTS=1 +CONFIG_VFS_SEMIHOSTFS_HOST_PATH_MAX_LEN=128 +# end of Host File System I/O (Semihosting) +# end of Virtual file system + +# +# Supplicant +# +CONFIG_WPA_MBEDTLS_CRYPTO=y +# CONFIG_WPA_WAPI_PSK is not set +# CONFIG_WPA_SUITE_B_192 is not set +# CONFIG_WPA_DEBUG_PRINT is not set +# CONFIG_WPA_TESTING_OPTIONS is not set +# CONFIG_WPA_WPS_STRICT is not set +# CONFIG_WPA_11KV_SUPPORT is not set +# CONFIG_WPA_MBO_SUPPORT is not set +# CONFIG_WPA_DPP_SUPPORT is not set +# end of Supplicant +# end of Component config + +# +# Compatibility options +# +# CONFIG_LEGACY_INCLUDE_COMMON_HEADERS is not set +# end of Compatibility options + +# Deprecated options for backward compatibility +CONFIG_TOOLPREFIX="xtensa-esp32-elf-" +CONFIG_LOG_BOOTLOADER_LEVEL_NONE=y +# CONFIG_LOG_BOOTLOADER_LEVEL_ERROR is not set +# CONFIG_LOG_BOOTLOADER_LEVEL_WARN is not set +# CONFIG_LOG_BOOTLOADER_LEVEL_INFO is not set +# CONFIG_LOG_BOOTLOADER_LEVEL_DEBUG is not set +# CONFIG_LOG_BOOTLOADER_LEVEL_VERBOSE is not set +CONFIG_LOG_BOOTLOADER_LEVEL=0 +# CONFIG_APP_ROLLBACK_ENABLE is not set +# CONFIG_FLASH_ENCRYPTION_ENABLED is not set +# CONFIG_FLASHMODE_QIO is not set +# CONFIG_FLASHMODE_QOUT is not set +CONFIG_FLASHMODE_DIO=y +# CONFIG_FLASHMODE_DOUT is not set +# CONFIG_MONITOR_BAUD_9600B is not set +# CONFIG_MONITOR_BAUD_57600B is not set +CONFIG_MONITOR_BAUD_115200B=y +# CONFIG_MONITOR_BAUD_230400B is not set +# CONFIG_MONITOR_BAUD_921600B is not set +# CONFIG_MONITOR_BAUD_2MB is not set +# CONFIG_MONITOR_BAUD_OTHER is not set +CONFIG_MONITOR_BAUD_OTHER_VAL=115200 +CONFIG_MONITOR_BAUD=115200 +# CONFIG_COMPILER_OPTIMIZATION_LEVEL_DEBUG is not set +CONFIG_COMPILER_OPTIMIZATION_LEVEL_RELEASE=y +CONFIG_OPTIMIZATION_ASSERTIONS_ENABLED=y +# CONFIG_OPTIMIZATION_ASSERTIONS_SILENT is not set +# CONFIG_OPTIMIZATION_ASSERTIONS_DISABLED is not set +CONFIG_OPTIMIZATION_ASSERTION_LEVEL=2 +# CONFIG_CXX_EXCEPTIONS is not set +CONFIG_STACK_CHECK_NONE=y +# CONFIG_STACK_CHECK_NORM is not set +# CONFIG_STACK_CHECK_STRONG is not set +# CONFIG_STACK_CHECK_ALL is not set +# CONFIG_WARN_WRITE_STRINGS is not set +# CONFIG_DISABLE_GCC8_WARNINGS is not set +# CONFIG_ESP32_APPTRACE_DEST_TRAX is not set +CONFIG_ESP32_APPTRACE_DEST_NONE=y +CONFIG_ESP32_APPTRACE_LOCK_ENABLE=y +CONFIG_ADC2_DISABLE_DAC=y +CONFIG_TRACEMEM_RESERVE_DRAM=0x0 +# CONFIG_ULP_COPROC_ENABLED is not set +CONFIG_ULP_COPROC_RESERVE_MEM=0 +CONFIG_BROWNOUT_DET=y +CONFIG_BROWNOUT_DET_LVL_SEL_0=y +# CONFIG_BROWNOUT_DET_LVL_SEL_1 is not set +# CONFIG_BROWNOUT_DET_LVL_SEL_2 is not set +# CONFIG_BROWNOUT_DET_LVL_SEL_3 is not set +# CONFIG_BROWNOUT_DET_LVL_SEL_4 is not set +# CONFIG_BROWNOUT_DET_LVL_SEL_5 is not set +# CONFIG_BROWNOUT_DET_LVL_SEL_6 is not set +# CONFIG_BROWNOUT_DET_LVL_SEL_7 is not set +CONFIG_BROWNOUT_DET_LVL=0 +CONFIG_ESP32_RTC_CLOCK_SOURCE_INTERNAL_RC=y +# CONFIG_ESP32_RTC_CLOCK_SOURCE_EXTERNAL_CRYSTAL is not set +# CONFIG_ESP32_RTC_CLOCK_SOURCE_EXTERNAL_OSC is not set +# CONFIG_ESP32_RTC_CLOCK_SOURCE_INTERNAL_8MD256 is not set +# CONFIG_DISABLE_BASIC_ROM_CONSOLE is not set +# CONFIG_NO_BLOBS is not set +# CONFIG_COMPATIBLE_PRE_V2_1_BOOTLOADERS is not set +# CONFIG_EVENT_LOOP_PROFILING is not set +CONFIG_POST_EVENTS_FROM_ISR=y +CONFIG_POST_EVENTS_FROM_IRAM_ISR=y +# CONFIG_TWO_UNIVERSAL_MAC_ADDRESS is not set +CONFIG_FOUR_UNIVERSAL_MAC_ADDRESS=y +CONFIG_NUMBER_OF_UNIVERSAL_MAC_ADDRESS=4 +# CONFIG_ESP32C3_LIGHTSLEEP_GPIO_RESET_WORKAROUND is not set +CONFIG_IPC_TASK_STACK_SIZE=1536 +CONFIG_ESP32_PHY_CALIBRATION_AND_DATA_STORAGE=y +# CONFIG_ESP32_PHY_INIT_DATA_IN_PARTITION is not set +CONFIG_ESP32_PHY_MAX_WIFI_TX_POWER=20 +CONFIG_ESP32_PHY_MAX_TX_POWER=20 +CONFIG_ESP32_REDUCE_PHY_TX_POWER=y +CONFIG_ESP32S2_PANIC_PRINT_HALT=y +# CONFIG_ESP32S2_PANIC_PRINT_REBOOT is not set +# CONFIG_ESP32S2_PANIC_SILENT_REBOOT is not set +# CONFIG_ESP32S2_PANIC_GDBSTUB is not set +CONFIG_SYSTEM_EVENT_QUEUE_SIZE=32 +CONFIG_SYSTEM_EVENT_TASK_STACK_SIZE=2304 +# CONFIG_CONSOLE_UART_DEFAULT is not set +# CONFIG_CONSOLE_UART_CUSTOM is not set +CONFIG_ESP_CONSOLE_UART_NONE=y +CONFIG_CONSOLE_UART_NUM=-1 +CONFIG_INT_WDT=y +CONFIG_INT_WDT_TIMEOUT_MS=300 +CONFIG_INT_WDT_CHECK_CPU1=y +# CONFIG_TASK_WDT is not set +# CONFIG_ESP32_DEBUG_STUBS_ENABLE is not set +CONFIG_TIMER_TASK_STACK_SIZE=3584 +# CONFIG_ESP32_ENABLE_COREDUMP_TO_FLASH is not set +# CONFIG_ESP32_ENABLE_COREDUMP_TO_UART is not set +CONFIG_ESP32_ENABLE_COREDUMP_TO_NONE=y +# CONFIG_ENABLE_STATIC_TASK_CLEAN_UP_HOOK is not set +CONFIG_TIMER_TASK_PRIORITY=1 +CONFIG_TIMER_TASK_STACK_DEPTH=2048 +CONFIG_TIMER_QUEUE_LENGTH=10 +# CONFIG_L2_TO_L3_COPY is not set +# CONFIG_USE_ONLY_LWIP_SELECT is not set +CONFIG_ESP_GRATUITOUS_ARP=y +CONFIG_GARP_TMR_INTERVAL=60 +CONFIG_TCPIP_RECVMBOX_SIZE=32 +CONFIG_TCP_MAXRTX=12 +CONFIG_TCP_SYNMAXRTX=6 +CONFIG_TCP_MSS=1440 +CONFIG_TCP_MSL=60000 +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 +CONFIG_TCP_OVERSIZE_MSS=y +# CONFIG_TCP_OVERSIZE_QUARTER_MSS is not set +# CONFIG_TCP_OVERSIZE_DISABLE is not set +CONFIG_UDP_RECVMBOX_SIZE=6 +CONFIG_TCPIP_TASK_STACK_SIZE=3072 +CONFIG_TCPIP_TASK_AFFINITY_NO_AFFINITY=y +# CONFIG_TCPIP_TASK_AFFINITY_CPU0 is not set +# CONFIG_TCPIP_TASK_AFFINITY_CPU1 is not set +CONFIG_TCPIP_TASK_AFFINITY=0x7FFFFFFF +# CONFIG_PPP_SUPPORT is not set +CONFIG_ESP32_PTHREAD_TASK_PRIO_DEFAULT=5 +CONFIG_ESP32_PTHREAD_TASK_STACK_SIZE_DEFAULT=3072 +CONFIG_ESP32_PTHREAD_STACK_MIN=768 +CONFIG_ESP32_DEFAULT_PTHREAD_CORE_NO_AFFINITY=y +# CONFIG_ESP32_DEFAULT_PTHREAD_CORE_0 is not set +# CONFIG_ESP32_DEFAULT_PTHREAD_CORE_1 is not set +CONFIG_ESP32_PTHREAD_TASK_CORE_DEFAULT=-1 +CONFIG_ESP32_PTHREAD_TASK_NAME_DEFAULT="pthread" +CONFIG_SPI_FLASH_WRITING_DANGEROUS_REGIONS_ABORTS=y +# CONFIG_SPI_FLASH_WRITING_DANGEROUS_REGIONS_FAILS is not set +# CONFIG_SPI_FLASH_WRITING_DANGEROUS_REGIONS_ALLOWED is not set +CONFIG_SUPPRESS_SELECT_DEBUG_OUTPUT=y +CONFIG_SUPPORT_TERMIOS=y +CONFIG_SEMIHOSTFS_MAX_MOUNT_POINTS=1 +CONFIG_SEMIHOSTFS_HOST_PATH_MAX_LEN=128 +# End of deprecated options diff --git a/ports/espressif/esp-idf-config/sdkconfig-esp32s3.defaults b/ports/espressif/esp-idf-config/sdkconfig-esp32s3.defaults index bfb867d923..ce0d9f8d62 100644 --- a/ports/espressif/esp-idf-config/sdkconfig-esp32s3.defaults +++ b/ports/espressif/esp-idf-config/sdkconfig-esp32s3.defaults @@ -191,3 +191,31 @@ CONFIG_ESP32_DEFAULT_PTHREAD_CORE_NO_AFFINITY=y CONFIG_ESP32_PTHREAD_TASK_CORE_DEFAULT=-1 CONFIG_ESP32_PTHREAD_TASK_NAME_DEFAULT="pthread" # end of Deprecated options for backward compatibility + +# +# Camera configuration +# +CONFIG_OV7670_SUPPORT=y +# CONFIG_OV7725_SUPPORT is not set +# CONFIG_NT99141_SUPPORT is not set +CONFIG_OV2640_SUPPORT=y +CONFIG_OV3660_SUPPORT=y +CONFIG_OV5640_SUPPORT=y +# CONFIG_GC2145_SUPPORT is not set +# CONFIG_GC032A_SUPPORT is not set +# CONFIG_GC0308_SUPPORT is not set +# CONFIG_BF3005_SUPPORT is not set +# CONFIG_BF20A6_SUPPORT is not set +# CONFIG_SC101IOT_SUPPORT is not set +# CONFIG_SC030IOT_SUPPORT is not set +# CONFIG_SCCB_HARDWARE_I2C_PORT0 is not set +CONFIG_SCCB_HARDWARE_I2C_PORT1=y +CONFIG_SCCB_CLK_FREQ=100000 +CONFIG_CAMERA_CORE0=y +# CONFIG_CAMERA_CORE1 is not set +# CONFIG_CAMERA_NO_AFFINITY is not set +CONFIG_CAMERA_DMA_BUFFER_SIZE_MAX=32768 +# CONFIG_CAMERA_CONVERTER_ENABLED is not set +# end of Camera configuration +# end of Component config + diff --git a/ports/espressif/esp-idf-config/sdkconfig.defaults b/ports/espressif/esp-idf-config/sdkconfig.defaults index 5fb49faa82..b183cd630d 100644 --- a/ports/espressif/esp-idf-config/sdkconfig.defaults +++ b/ports/espressif/esp-idf-config/sdkconfig.defaults @@ -294,7 +294,7 @@ CONFIG_ESP_SYSTEM_RTC_FAST_MEM_AS_HEAP_DEPCHECK=y CONFIG_ESP_SYSTEM_ALLOW_RTC_FAST_MEM_AS_HEAP=y CONFIG_ESP_SYSTEM_EVENT_QUEUE_SIZE=32 CONFIG_ESP_SYSTEM_EVENT_TASK_STACK_SIZE=2304 -CONFIG_ESP_MAIN_TASK_STACK_SIZE=8192 +CONFIG_ESP_MAIN_TASK_STACK_SIZE=16384 CONFIG_ESP_MINIMAL_SHARED_STACK_SIZE=2048 CONFIG_ESP_INT_WDT=y CONFIG_ESP_INT_WDT_TIMEOUT_MS=300 @@ -572,7 +572,7 @@ CONFIG_MBEDTLS_CERTIFICATE_BUNDLE=y # CONFIG_MBEDTLS_CERTIFICATE_BUNDLE_DEFAULT_CMN is not set CONFIG_MBEDTLS_CERTIFICATE_BUNDLE_DEFAULT_NONE=y CONFIG_MBEDTLS_CUSTOM_CERTIFICATE_BUNDLE=y -CONFIG_MBEDTLS_CUSTOM_CERTIFICATE_BUNDLE_PATH="certificates/nina-fw/data/roots.pem" +CONFIG_MBEDTLS_CUSTOM_CERTIFICATE_BUNDLE_PATH="../../lib/certificates/nina-fw/data/roots.pem" # end of Certificate Bundle CONFIG_MBEDTLS_ECP_RESTARTABLE=y @@ -805,9 +805,9 @@ CONFIG_LOG_BOOTLOADER_LEVEL_INFO=y CONFIG_LOG_BOOTLOADER_LEVEL=3 # CONFIG_APP_ROLLBACK_ENABLE is not set # CONFIG_FLASH_ENCRYPTION_ENABLED is not set -# CONFIG_FLASHMODE_QIO is not set +CONFIG_FLASHMODE_QIO=y # CONFIG_FLASHMODE_QOUT is not set -CONFIG_FLASHMODE_DIO=y +# CONFIG_FLASHMODE_DIO is not set # CONFIG_FLASHMODE_DOUT is not set # CONFIG_MONITOR_BAUD_9600B is not set # CONFIG_MONITOR_BAUD_57600B is not set diff --git a/ports/espressif/esp32-camera b/ports/espressif/esp32-camera new file mode 160000 index 0000000000..54c3f61c86 --- /dev/null +++ b/ports/espressif/esp32-camera @@ -0,0 +1 @@ +Subproject commit 54c3f61c864c3d3ffd779042454554045b9dd9d2 diff --git a/ports/espressif/fatfs_port.c b/ports/espressif/fatfs_port.c index 631f7f0982..38c2d923b8 100644 --- a/ports/espressif/fatfs_port.c +++ b/ports/espressif/fatfs_port.c @@ -26,8 +26,26 @@ #include "py/runtime.h" #include "lib/oofatfs/ff.h" +#include "shared/timeutils/timeutils.h" +#include "shared-bindings/rtc/RTC.h" +#include "shared-bindings/time/__init__.h" +#include "supervisor/fatfs_port.h" +DWORD _time_override = 0; DWORD get_fattime(void) { - // TODO: Implement this function. For now, fake it. - return ((2016 - 1980) << 25) | ((12) << 21) | ((4) << 16) | ((00) << 11) | ((18) << 5) | (23 / 2); + if (_time_override > 0) { + return _time_override; + } + #if CIRCUITPY_RTC + timeutils_struct_time_t tm; + common_hal_rtc_get_time(&tm); + return ((tm.tm_year - 1980) << 25) | (tm.tm_mon << 21) | (tm.tm_mday << 16) | + (tm.tm_hour << 11) | (tm.tm_min << 5) | (tm.tm_sec >> 1); + #else + return ((2016 - 1980) << 25) | ((9) << 21) | ((1) << 16) | ((16) << 11) | ((43) << 5) | (35 / 2); + #endif +} + +void override_fattime(DWORD time) { + _time_override = time; } diff --git a/ports/espressif/mpconfigport.h b/ports/espressif/mpconfigport.h index f390112387..632a7a13cd 100644 --- a/ports/espressif/mpconfigport.h +++ b/ports/espressif/mpconfigport.h @@ -53,11 +53,13 @@ // Nearly all boards have this because it is used to enter the ROM bootloader. #ifndef CIRCUITPY_BOOT_BUTTON -#ifdef CONFIG_IDF_TARGET_ESP32C3 -#define CIRCUITPY_BOOT_BUTTON (&pin_GPIO9) -#else -#define CIRCUITPY_BOOT_BUTTON (&pin_GPIO0) -#endif + #ifdef CONFIG_IDF_TARGET_ESP32C3 + #define CIRCUITPY_BOOT_BUTTON (&pin_GPIO9) + #else + #ifndef CONFIG_IDF_TARGET_ESP32 + #define CIRCUITPY_BOOT_BUTTON (&pin_GPIO0) + #endif + #endif #endif #define CIRCUITPY_INTERNAL_NVM_START_ADDR (0x9000) @@ -88,4 +90,13 @@ #define CIRCUITPY_ESP_USB_SERIAL_JTAG (0) #endif +#ifndef DEFAULT_RESERVED_PSRAM +#define DEFAULT_RESERVED_PSRAM (0) +#endif + +#if defined(CONFIG_SPIRAM) +#undef CIRCUITPY_PORT_NUM_SUPERVISOR_ALLOCATIONS +#define CIRCUITPY_PORT_NUM_SUPERVISOR_ALLOCATIONS (1) +#endif + #endif // MICROPY_INCLUDED_ESPRESSIF_MPCONFIGPORT_H diff --git a/ports/espressif/mpconfigport.mk b/ports/espressif/mpconfigport.mk index 2eeb86e49d..9ac4408ef7 100644 --- a/ports/espressif/mpconfigport.mk +++ b/ports/espressif/mpconfigport.mk @@ -1,3 +1,6 @@ +# Use internal flash for CIRCUITPY drive +INTERNAL_FLASH_FILESYSTEM = 1 + # Internal math library is substantially smaller than toolchain one INTERNAL_LIBM = 1 @@ -19,8 +22,9 @@ CIRCUITPY_COUNTIO ?= 1 CIRCUITPY_DUALBANK ?= 1 CIRCUITPY_FRAMEBUFFERIO ?= 1 CIRCUITPY_FREQUENCYIO ?= 1 -CIRCUITPY_IMAGECAPTURE ?= 1 -CIRCUITPY_I2CPERIPHERAL ?= 1 +CIRCUITPY_HASHLIB ?= 1 +CIRCUITPY_IMAGECAPTURE ?= 0 +CIRCUITPY_I2CTARGET ?= 1 CIRCUITPY_RGBMATRIX ?= 1 CIRCUITPY_ROTARYIO ?= 1 CIRCUITPY_NVM ?= 1 @@ -31,9 +35,17 @@ CIRCUITPY_WATCHDOG ?= 1 CIRCUITPY_ESPIDF ?= 1 -CIRCUITPY_MODULE ?= none +ifeq ($(IDF_TARGET),esp32) +CIRCUITPY_BLEIO = 0 +CIRCUITPY_BLEIO_HCI = 0 +CIRCUITPY_PARALLELDISPLAY = 0 +# Protomatter needs to support ESP32. +CIRCUITPY_RGBMATRIX = 0 +CIRCUITPY_USB = 0 +CIRCUITPY_BUILD_EXTENSIONS ?= bin +CIRCUITPY_ESP32_CAMERA ?= 1 -ifeq ($(IDF_TARGET),esp32c3) +else ifeq ($(IDF_TARGET),esp32c3) CIRCUITPY_AESIO = 0 CIRCUITPY_ALARM = 0 CIRCUITPY_AUDIOBUSIO = 0 @@ -42,22 +54,27 @@ CIRCUITPY_BLEIO_HCI = 0 CIRCUITPY_COUNTIO = 0 CIRCUITPY_DUALBANK = 0 CIRCUITPY_FREQUENCYIO = 0 -CIRCUITPY_IMAGECAPTURE = 0 CIRCUITPY_PARALLELDISPLAY = 0 CIRCUITPY_PS2IO = 0 CIRCUITPY_ROTARYIO = 0 CIRCUITPY_TOUCHIO ?= 1 CIRCUITPY_TOUCHIO_USE_NATIVE = 0 CIRCUITPY_USB = 0 +CIRCUITPY_BUILD_EXTENSIONS ?= bin + else ifeq ($(IDF_TARGET),esp32s3) CIRCUITPY_BLEIO = 1 CIRCUITPY_BLEIO_HCI = 0 -CIRCUITPY_IMAGECAPTURE = 0 CIRCUITPY_PARALLELDISPLAY = 0 +CIRCUITPY_BUILD_EXTENSIONS ?= bin,uf2 +CIRCUITPY_ESP32_CAMERA ?= 1 + else ifeq ($(IDF_TARGET),esp32s2) # No BLE on S2 CIRCUITPY_BLEIO = 0 CIRCUITPY_BLEIO_HCI = 0 +CIRCUITPY_BUILD_EXTENSIONS ?= bin,uf2 +CIRCUITPY_ESP32_CAMERA ?= 1 endif # From ESP32-S2/S3 Technical Reference Manual: @@ -71,3 +88,7 @@ endif # only if something else is turned off, such as HID. USB_NUM_ENDPOINT_PAIRS = 7 USB_NUM_IN_ENDPOINTS = 5 + +CIRCUITPY_ESP32_CAMERA ?= 0 +CIRCUITPY_GIFIO ?= $(CIRCUITPY_ESP32_CAMERA) +CIRCUITPY_QRIO ?= $(CIRCUITPY_ESP32_CAMERA) diff --git a/ports/espressif/mphalport.c b/ports/espressif/mphalport.c index 39b080fba3..76d2c05cc3 100644 --- a/ports/espressif/mphalport.c +++ b/ports/espressif/mphalport.c @@ -28,7 +28,9 @@ #include "py/mphal.h" #include "supervisor/cpu.h" -#ifdef CONFIG_IDF_TARGET_ESP32C3 +#if defined(CONFIG_IDF_TARGET_ESP32) +#include "components/esp_rom/include/esp32/rom/ets_sys.h" +#elif defined(CONFIG_IDF_TARGET_ESP32C3) #include "components/esp_rom/include/esp32c3/rom/ets_sys.h" #elif defined(CONFIG_IDF_TARGET_ESP32S2) #include "components/esp_rom/include/esp32s2/rom/ets_sys.h" diff --git a/ports/espressif/peripherals/esp32/pins.c b/ports/espressif/peripherals/esp32/pins.c new file mode 100644 index 0000000000..9bf00a0e56 --- /dev/null +++ b/ports/espressif/peripherals/esp32/pins.c @@ -0,0 +1,69 @@ +/* + * This file is part of the Micro Python project, http://micropython.org/ + * + * The MIT License (MIT) + * + * Copyright (c) 2020 Scott Shawcroft for Adafruit Industries + * + * Permission is hereby granted, free of charge, to any person obtaining a copy + * of this software and associated documentation files (the "Software"), to deal + * in the Software without restriction, including without limitation the rights + * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell + * copies of the Software, and to permit persons to whom the Software is + * furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice shall be included in + * all copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE + * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER + * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, + * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN + * THE SOFTWARE. + */ + +#include "peripherals/pins.h" + +const mcu_pin_obj_t pin_GPIO0 = PIN(0, ADC_UNIT_2, ADC_CHANNEL_1, TOUCH_PAD_NUM1); +const mcu_pin_obj_t pin_GPIO1 = PIN(1, NO_ADC, NO_ADC_CHANNEL, NO_TOUCH_CHANNEL); +const mcu_pin_obj_t pin_GPIO2 = PIN(2, ADC_UNIT_2, ADC_CHANNEL_2, TOUCH_PAD_NUM2); +const mcu_pin_obj_t pin_GPIO3 = PIN(3, NO_ADC, NO_ADC_CHANNEL, NO_TOUCH_CHANNEL); +const mcu_pin_obj_t pin_GPIO4 = PIN(4, ADC_UNIT_2, ADC_CHANNEL_0, TOUCH_PAD_NUM0); +const mcu_pin_obj_t pin_GPIO5 = PIN(5, NO_ADC, NO_ADC_CHANNEL, NO_TOUCH_CHANNEL); +const mcu_pin_obj_t pin_GPIO6 = PIN(6, NO_ADC, NO_ADC_CHANNEL, NO_TOUCH_CHANNEL); +const mcu_pin_obj_t pin_GPIO7 = PIN(7, NO_ADC, NO_ADC_CHANNEL, NO_TOUCH_CHANNEL); +const mcu_pin_obj_t pin_GPIO8 = PIN(8, NO_ADC, NO_ADC_CHANNEL, NO_TOUCH_CHANNEL); +const mcu_pin_obj_t pin_GPIO9 = PIN(9, NO_ADC, NO_ADC_CHANNEL, NO_TOUCH_CHANNEL); +const mcu_pin_obj_t pin_GPIO10 = PIN(10, NO_ADC, NO_ADC_CHANNEL, NO_TOUCH_CHANNEL); +const mcu_pin_obj_t pin_GPIO11 = PIN(11, NO_ADC, NO_ADC_CHANNEL, NO_TOUCH_CHANNEL); +const mcu_pin_obj_t pin_GPIO12 = PIN(12, ADC_UNIT_2, ADC_CHANNEL_5, TOUCH_PAD_NUM5); +const mcu_pin_obj_t pin_GPIO13 = PIN(13, ADC_UNIT_2, ADC_CHANNEL_4, TOUCH_PAD_NUM4); +const mcu_pin_obj_t pin_GPIO14 = PIN(14, ADC_UNIT_2, ADC_CHANNEL_6, TOUCH_PAD_NUM6); +const mcu_pin_obj_t pin_GPIO15 = PIN(15, ADC_UNIT_2, ADC_CHANNEL_3, TOUCH_PAD_NUM3); +const mcu_pin_obj_t pin_GPIO16 = PIN(16, NO_ADC, NO_ADC_CHANNEL, NO_TOUCH_CHANNEL); +const mcu_pin_obj_t pin_GPIO17 = PIN(17, NO_ADC, NO_ADC_CHANNEL, NO_TOUCH_CHANNEL); +const mcu_pin_obj_t pin_GPIO18 = PIN(18, NO_ADC, NO_ADC_CHANNEL, NO_TOUCH_CHANNEL); +const mcu_pin_obj_t pin_GPIO19 = PIN(19, NO_ADC, NO_ADC_CHANNEL, NO_TOUCH_CHANNEL); +// GPIO20 not exposed on some packages, but available in some modules +const mcu_pin_obj_t pin_GPIO20 = PIN(20, NO_ADC, NO_ADC_CHANNEL, NO_TOUCH_CHANNEL); +const mcu_pin_obj_t pin_GPIO21 = PIN(21, NO_ADC, NO_ADC_CHANNEL, NO_TOUCH_CHANNEL); +const mcu_pin_obj_t pin_GPIO22 = PIN(22, NO_ADC, NO_ADC_CHANNEL, NO_TOUCH_CHANNEL); +const mcu_pin_obj_t pin_GPIO23 = PIN(23, NO_ADC, NO_ADC_CHANNEL, NO_TOUCH_CHANNEL); +// no GPIO24 +const mcu_pin_obj_t pin_GPIO25 = PIN(25, ADC_UNIT_2, ADC_CHANNEL_8, NO_TOUCH_CHANNEL); +const mcu_pin_obj_t pin_GPIO26 = PIN(26, ADC_UNIT_2, ADC_CHANNEL_9, NO_TOUCH_CHANNEL); +const mcu_pin_obj_t pin_GPIO27 = PIN(27, ADC_UNIT_2, ADC_CHANNEL_7, TOUCH_PAD_NUM7); +// no GPIO28 +// no GPIO29 +// no GPIO30 +// no GPIO31 +const mcu_pin_obj_t pin_GPIO32 = PIN(32, ADC_UNIT_1, ADC_CHANNEL_1, TOUCH_PAD_NUM9); +const mcu_pin_obj_t pin_GPIO33 = PIN(33, ADC_UNIT_1, ADC_CHANNEL_5, TOUCH_PAD_NUM8); +const mcu_pin_obj_t pin_GPIO34 = PIN(34, ADC_UNIT_1, ADC_CHANNEL_6, NO_TOUCH_CHANNEL); +const mcu_pin_obj_t pin_GPIO35 = PIN(35, ADC_UNIT_1, ADC_CHANNEL_7, NO_TOUCH_CHANNEL); +const mcu_pin_obj_t pin_GPIO36 = PIN(36, ADC_UNIT_1, ADC_CHANNEL_0, NO_TOUCH_CHANNEL); +const mcu_pin_obj_t pin_GPIO37 = PIN(37, ADC_UNIT_1, ADC_CHANNEL_1, NO_TOUCH_CHANNEL); +const mcu_pin_obj_t pin_GPIO38 = PIN(38, ADC_UNIT_1, ADC_CHANNEL_2, NO_TOUCH_CHANNEL); +const mcu_pin_obj_t pin_GPIO39 = PIN(39, ADC_UNIT_1, ADC_CHANNEL_3, NO_TOUCH_CHANNEL); diff --git a/ports/espressif/peripherals/esp32/pins.h b/ports/espressif/peripherals/esp32/pins.h new file mode 100644 index 0000000000..6ec7c624a0 --- /dev/null +++ b/ports/espressif/peripherals/esp32/pins.h @@ -0,0 +1,111 @@ +/* + * This file is part of the Micro Python project, http://micropython.org/ + * + * The MIT License (MIT) + * + * Copyright (c) 2020 Scott Shawcroft for Adafruit Industries + * + * Permission is hereby granted, free of charge, to any person obtaining a copy + * of this software and associated documentation files (the "Software"), to deal + * in the Software without restriction, including without limitation the rights + * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell + * copies of the Software, and to permit persons to whom the Software is + * furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice shall be included in + * all copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE + * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER + * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, + * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN + * THE SOFTWARE. + */ + +// DO NOT include this file directly. +// Use shared-bindings/microcontroller/Pin.h instead. +// This ensures that all necessary includes are already included. + +#ifndef MICROPY_INCLUDED_ESPRESSIF_PERIPHERALS_ESP32_PINS_H +#define MICROPY_INCLUDED_ESPRESSIF_PERIPHERALS_ESP32_PINS_H + +#define GPIO0_EXISTS 1 +extern const mcu_pin_obj_t pin_GPIO0; +#define GPIO1_EXISTS 1 +extern const mcu_pin_obj_t pin_GPIO1; +#define GPIO2_EXISTS 1 +extern const mcu_pin_obj_t pin_GPIO2; +#define GPIO3_EXISTS 1 +extern const mcu_pin_obj_t pin_GPIO3; +#define GPIO4_EXISTS 1 +extern const mcu_pin_obj_t pin_GPIO4; +#define GPIO5_EXISTS 1 +extern const mcu_pin_obj_t pin_GPIO5; +#define GPIO6_EXISTS 1 +extern const mcu_pin_obj_t pin_GPIO6; +#define GPIO7_EXISTS 1 +extern const mcu_pin_obj_t pin_GPIO7; +#define GPIO8_EXISTS 1 +extern const mcu_pin_obj_t pin_GPIO8; +#define GPIO9_EXISTS 1 +extern const mcu_pin_obj_t pin_GPIO9; +#define GPIO10_EXISTS 1 +extern const mcu_pin_obj_t pin_GPIO10; +#define GPIO11_EXISTS 1 +extern const mcu_pin_obj_t pin_GPIO11; +#define GPIO12_EXISTS 1 +extern const mcu_pin_obj_t pin_GPIO12; +#define GPIO13_EXISTS 1 +extern const mcu_pin_obj_t pin_GPIO13; +#define GPIO14_EXISTS 1 +extern const mcu_pin_obj_t pin_GPIO14; +#define GPIO15_EXISTS 1 +extern const mcu_pin_obj_t pin_GPIO15; +#define GPIO16_EXISTS 1 +extern const mcu_pin_obj_t pin_GPIO16; +#define GPIO17_EXISTS 1 +extern const mcu_pin_obj_t pin_GPIO17; +#define GPIO18_EXISTS 1 +extern const mcu_pin_obj_t pin_GPIO18; +#define GPIO19_EXISTS 1 +extern const mcu_pin_obj_t pin_GPIO19; +// GPIO20 not exposed on some packages, but available in some modules +#define GPIO20_EXISTS 1 +extern const mcu_pin_obj_t pin_GPIO20; +#define GPIO21_EXISTS 1 +extern const mcu_pin_obj_t pin_GPIO21; +#define GPIO22_EXISTS 1 +extern const mcu_pin_obj_t pin_GPIO22; +#define GPIO23_EXISTS 1 +extern const mcu_pin_obj_t pin_GPIO23; +// no GPIO24 +#define GPIO25_EXISTS 1 +extern const mcu_pin_obj_t pin_GPIO25; +#define GPIO26_EXISTS 1 +extern const mcu_pin_obj_t pin_GPIO26; +#define GPIO27_EXISTS 1 +extern const mcu_pin_obj_t pin_GPIO27; +// no GPIO28 +// no GPIO29 +// no GPIO30 +// no GPIO31 +#define GPIO32_EXISTS 1 +extern const mcu_pin_obj_t pin_GPIO32; +#define GPIO33_EXISTS 1 +extern const mcu_pin_obj_t pin_GPIO33; +#define GPIO34_EXISTS 1 +extern const mcu_pin_obj_t pin_GPIO34; +#define GPIO35_EXISTS 1 +extern const mcu_pin_obj_t pin_GPIO35; +#define GPIO36_EXISTS 1 +extern const mcu_pin_obj_t pin_GPIO36; +#define GPIO37_EXISTS 1 +extern const mcu_pin_obj_t pin_GPIO37; +#define GPIO38_EXISTS 1 +extern const mcu_pin_obj_t pin_GPIO38; +#define GPIO39_EXISTS 1 +extern const mcu_pin_obj_t pin_GPIO39; + +#endif // MICROPY_INCLUDED_ESPRESSIF_PERIPHERALS_ESP32_PINS_H diff --git a/ports/espressif/peripherals/esp32c3/pins.h b/ports/espressif/peripherals/esp32c3/pins.h index 3cce2763c6..9f55768825 100644 --- a/ports/espressif/peripherals/esp32c3/pins.h +++ b/ports/espressif/peripherals/esp32c3/pins.h @@ -31,27 +31,49 @@ #ifndef MICROPY_INCLUDED_ESPRESSIF_PERIPHERALS_ESP32C3_PINS_H #define MICROPY_INCLUDED_ESPRESSIF_PERIPHERALS_ESP32C3_PINS_H +#define GPIO0_EXISTS 1 extern const mcu_pin_obj_t pin_GPIO0; +#define GPIO1_EXISTS 1 extern const mcu_pin_obj_t pin_GPIO1; +#define GPIO2_EXISTS 1 extern const mcu_pin_obj_t pin_GPIO2; +#define GPIO3_EXISTS 1 extern const mcu_pin_obj_t pin_GPIO3; +#define GPIO4_EXISTS 1 extern const mcu_pin_obj_t pin_GPIO4; +#define GPIO5_EXISTS 1 extern const mcu_pin_obj_t pin_GPIO5; +#define GPIO6_EXISTS 1 extern const mcu_pin_obj_t pin_GPIO6; +#define GPIO7_EXISTS 1 extern const mcu_pin_obj_t pin_GPIO7; +#define GPIO8_EXISTS 1 extern const mcu_pin_obj_t pin_GPIO8; +#define GPIO9_EXISTS 1 extern const mcu_pin_obj_t pin_GPIO9; +#define GPIO10_EXISTS 1 extern const mcu_pin_obj_t pin_GPIO10; +#define GPIO11_EXISTS 1 extern const mcu_pin_obj_t pin_GPIO11; +#define GPIO12_EXISTS 1 extern const mcu_pin_obj_t pin_GPIO12; +#define GPIO13_EXISTS 1 extern const mcu_pin_obj_t pin_GPIO13; +#define GPIO14_EXISTS 1 extern const mcu_pin_obj_t pin_GPIO14; +#define GPIO15_EXISTS 1 extern const mcu_pin_obj_t pin_GPIO15; +#define GPIO16_EXISTS 1 extern const mcu_pin_obj_t pin_GPIO16; +#define GPIO17_EXISTS 1 extern const mcu_pin_obj_t pin_GPIO17; +#define GPIO18_EXISTS 1 extern const mcu_pin_obj_t pin_GPIO18; +#define GPIO19_EXISTS 1 extern const mcu_pin_obj_t pin_GPIO19; +#define GPIO20_EXISTS 1 extern const mcu_pin_obj_t pin_GPIO20; +#define GPIO21_EXISTS 1 extern const mcu_pin_obj_t pin_GPIO21; #endif // MICROPY_INCLUDED_ESPRESSIF_PERIPHERALS_ESP32C3_PINS_H diff --git a/ports/espressif/peripherals/esp32s2/pins.h b/ports/espressif/peripherals/esp32s2/pins.h index b66db79861..cff6fea7cb 100644 --- a/ports/espressif/peripherals/esp32s2/pins.h +++ b/ports/espressif/peripherals/esp32s2/pins.h @@ -31,48 +31,91 @@ #ifndef MICROPY_INCLUDED_ESPRESSIF_PERIPHERALS_ESP32S2_PINS_H #define MICROPY_INCLUDED_ESPRESSIF_PERIPHERALS_ESP32S2_PINS_H +#define GPIO0_EXISTS 1 extern const mcu_pin_obj_t pin_GPIO0; +#define GPIO1_EXISTS 1 extern const mcu_pin_obj_t pin_GPIO1; +#define GPIO2_EXISTS 1 extern const mcu_pin_obj_t pin_GPIO2; +#define GPIO3_EXISTS 1 extern const mcu_pin_obj_t pin_GPIO3; +#define GPIO4_EXISTS 1 extern const mcu_pin_obj_t pin_GPIO4; +#define GPIO5_EXISTS 1 extern const mcu_pin_obj_t pin_GPIO5; +#define GPIO6_EXISTS 1 extern const mcu_pin_obj_t pin_GPIO6; +#define GPIO7_EXISTS 1 extern const mcu_pin_obj_t pin_GPIO7; +#define GPIO8_EXISTS 1 extern const mcu_pin_obj_t pin_GPIO8; +#define GPIO9_EXISTS 1 extern const mcu_pin_obj_t pin_GPIO9; +#define GPIO10_EXISTS 1 extern const mcu_pin_obj_t pin_GPIO10; +#define GPIO11_EXISTS 1 extern const mcu_pin_obj_t pin_GPIO11; +#define GPIO12_EXISTS 1 extern const mcu_pin_obj_t pin_GPIO12; +#define GPIO13_EXISTS 1 extern const mcu_pin_obj_t pin_GPIO13; +#define GPIO14_EXISTS 1 extern const mcu_pin_obj_t pin_GPIO14; +#define GPIO15_EXISTS 1 extern const mcu_pin_obj_t pin_GPIO15; +#define GPIO16_EXISTS 1 extern const mcu_pin_obj_t pin_GPIO16; +#define GPIO17_EXISTS 1 extern const mcu_pin_obj_t pin_GPIO17; +#define GPIO18_EXISTS 1 extern const mcu_pin_obj_t pin_GPIO18; +#define GPIO19_EXISTS 1 extern const mcu_pin_obj_t pin_GPIO19; +#define GPIO20_EXISTS 1 extern const mcu_pin_obj_t pin_GPIO20; +#define GPIO21_EXISTS 1 extern const mcu_pin_obj_t pin_GPIO21; +#define GPIO26_EXISTS 1 extern const mcu_pin_obj_t pin_GPIO26; +#define GPIO27_EXISTS 1 extern const mcu_pin_obj_t pin_GPIO27; +#define GPIO28_EXISTS 1 extern const mcu_pin_obj_t pin_GPIO28; +#define GPIO29_EXISTS 1 extern const mcu_pin_obj_t pin_GPIO29; +#define GPIO30_EXISTS 1 extern const mcu_pin_obj_t pin_GPIO30; +#define GPIO31_EXISTS 1 extern const mcu_pin_obj_t pin_GPIO31; +#define GPIO32_EXISTS 1 extern const mcu_pin_obj_t pin_GPIO32; +#define GPIO33_EXISTS 1 extern const mcu_pin_obj_t pin_GPIO33; +#define GPIO34_EXISTS 1 extern const mcu_pin_obj_t pin_GPIO34; +#define GPIO35_EXISTS 1 extern const mcu_pin_obj_t pin_GPIO35; +#define GPIO36_EXISTS 1 extern const mcu_pin_obj_t pin_GPIO36; +#define GPIO37_EXISTS 1 extern const mcu_pin_obj_t pin_GPIO37; +#define GPIO38_EXISTS 1 extern const mcu_pin_obj_t pin_GPIO38; +#define GPIO39_EXISTS 1 extern const mcu_pin_obj_t pin_GPIO39; +#define GPIO40_EXISTS 1 extern const mcu_pin_obj_t pin_GPIO40; +#define GPIO41_EXISTS 1 extern const mcu_pin_obj_t pin_GPIO41; +#define GPIO42_EXISTS 1 extern const mcu_pin_obj_t pin_GPIO42; +#define GPIO43_EXISTS 1 extern const mcu_pin_obj_t pin_GPIO43; +#define GPIO44_EXISTS 1 extern const mcu_pin_obj_t pin_GPIO44; +#define GPIO45_EXISTS 1 extern const mcu_pin_obj_t pin_GPIO45; +#define GPIO46_EXISTS 1 extern const mcu_pin_obj_t pin_GPIO46; #endif // MICROPY_INCLUDED_ESPRESSIF_PERIPHERALS_ESP32S2_PINS_H diff --git a/ports/espressif/peripherals/esp32s3/pins.h b/ports/espressif/peripherals/esp32s3/pins.h index c2a932f572..7c0b8edd64 100644 --- a/ports/espressif/peripherals/esp32s3/pins.h +++ b/ports/espressif/peripherals/esp32s3/pins.h @@ -31,50 +31,95 @@ #ifndef MICROPY_INCLUDED_ESPRESSIF_PERIPHERALS_ESP32S3_PINS_H #define MICROPY_INCLUDED_ESPRESSIF_PERIPHERALS_ESP32S3_PINS_H +#define GPIO0_EXISTS 1 extern const mcu_pin_obj_t pin_GPIO0; +#define GPIO1_EXISTS 1 extern const mcu_pin_obj_t pin_GPIO1; +#define GPIO2_EXISTS 1 extern const mcu_pin_obj_t pin_GPIO2; +#define GPIO3_EXISTS 1 extern const mcu_pin_obj_t pin_GPIO3; +#define GPIO4_EXISTS 1 extern const mcu_pin_obj_t pin_GPIO4; +#define GPIO5_EXISTS 1 extern const mcu_pin_obj_t pin_GPIO5; +#define GPIO6_EXISTS 1 extern const mcu_pin_obj_t pin_GPIO6; +#define GPIO7_EXISTS 1 extern const mcu_pin_obj_t pin_GPIO7; +#define GPIO8_EXISTS 1 extern const mcu_pin_obj_t pin_GPIO8; +#define GPIO9_EXISTS 1 extern const mcu_pin_obj_t pin_GPIO9; +#define GPIO10_EXISTS 1 extern const mcu_pin_obj_t pin_GPIO10; +#define GPIO11_EXISTS 1 extern const mcu_pin_obj_t pin_GPIO11; +#define GPIO12_EXISTS 1 extern const mcu_pin_obj_t pin_GPIO12; +#define GPIO13_EXISTS 1 extern const mcu_pin_obj_t pin_GPIO13; +#define GPIO14_EXISTS 1 extern const mcu_pin_obj_t pin_GPIO14; +#define GPIO15_EXISTS 1 extern const mcu_pin_obj_t pin_GPIO15; +#define GPIO16_EXISTS 1 extern const mcu_pin_obj_t pin_GPIO16; +#define GPIO17_EXISTS 1 extern const mcu_pin_obj_t pin_GPIO17; +#define GPIO18_EXISTS 1 extern const mcu_pin_obj_t pin_GPIO18; +#define GPIO19_EXISTS 1 extern const mcu_pin_obj_t pin_GPIO19; +#define GPIO20_EXISTS 1 extern const mcu_pin_obj_t pin_GPIO20; +#define GPIO21_EXISTS 1 extern const mcu_pin_obj_t pin_GPIO21; +#define GPIO26_EXISTS 1 extern const mcu_pin_obj_t pin_GPIO26; +#define GPIO27_EXISTS 1 extern const mcu_pin_obj_t pin_GPIO27; +#define GPIO28_EXISTS 1 extern const mcu_pin_obj_t pin_GPIO28; +#define GPIO29_EXISTS 1 extern const mcu_pin_obj_t pin_GPIO29; +#define GPIO30_EXISTS 1 extern const mcu_pin_obj_t pin_GPIO30; +#define GPIO31_EXISTS 1 extern const mcu_pin_obj_t pin_GPIO31; +#define GPIO32_EXISTS 1 extern const mcu_pin_obj_t pin_GPIO32; +#define GPIO33_EXISTS 1 extern const mcu_pin_obj_t pin_GPIO33; +#define GPIO34_EXISTS 1 extern const mcu_pin_obj_t pin_GPIO34; +#define GPIO35_EXISTS 1 extern const mcu_pin_obj_t pin_GPIO35; +#define GPIO36_EXISTS 1 extern const mcu_pin_obj_t pin_GPIO36; +#define GPIO37_EXISTS 1 extern const mcu_pin_obj_t pin_GPIO37; +#define GPIO38_EXISTS 1 extern const mcu_pin_obj_t pin_GPIO38; +#define GPIO39_EXISTS 1 extern const mcu_pin_obj_t pin_GPIO39; +#define GPIO40_EXISTS 1 extern const mcu_pin_obj_t pin_GPIO40; +#define GPIO41_EXISTS 1 extern const mcu_pin_obj_t pin_GPIO41; +#define GPIO42_EXISTS 1 extern const mcu_pin_obj_t pin_GPIO42; +#define GPIO43_EXISTS 1 extern const mcu_pin_obj_t pin_GPIO43; +#define GPIO44_EXISTS 1 extern const mcu_pin_obj_t pin_GPIO44; +#define GPIO45_EXISTS 1 extern const mcu_pin_obj_t pin_GPIO45; +#define GPIO46_EXISTS 1 extern const mcu_pin_obj_t pin_GPIO46; +#define GPIO47_EXISTS 1 extern const mcu_pin_obj_t pin_GPIO47; +#define GPIO48_EXISTS 1 extern const mcu_pin_obj_t pin_GPIO48; #endif // MICROPY_INCLUDED_ESPRESSIF_PERIPHERALS_ESP32S3_PINS_H diff --git a/ports/espressif/peripherals/pcnt.c b/ports/espressif/peripherals/pcnt.c index d1b85fbb13..fa8a3e05d1 100644 --- a/ports/espressif/peripherals/pcnt.c +++ b/ports/espressif/peripherals/pcnt.c @@ -29,48 +29,50 @@ #define PCNT_UNIT_ACTIVE 1 #define PCNT_UNIT_INACTIVE 0 -static uint8_t pcnt_unit_state[4]; +static uint8_t pcnt_unit_state[PCNT_UNIT_MAX]; void peripherals_pcnt_reset(void) { - for (uint8_t i = 0; i <= 3; i++) { + for (uint8_t i = 0; i < PCNT_UNIT_MAX; i++) { pcnt_unit_state[i] = PCNT_UNIT_INACTIVE; } } -int peripherals_pcnt_get_unit(pcnt_config_t pcnt_config) { +static int peripherals_pcnt_get_unit(pcnt_config_t *pcnt_config) { // Look for available pcnt unit - for (uint8_t i = 0; i <= 3; i++) { + for (uint8_t i = 0; i < PCNT_UNIT_MAX; i++) { if (pcnt_unit_state[i] == PCNT_UNIT_INACTIVE) { - pcnt_config.unit = (pcnt_unit_t)i; + pcnt_config->unit = (pcnt_unit_t)i; pcnt_unit_state[i] = PCNT_UNIT_ACTIVE; - break; - } else if (i == 3) { - return -1; + return i; } } - return pcnt_config.unit; + return -1; } -int peripherals_pcnt_init(pcnt_config_t pcnt_config) { - // Look for available pcnt unit +void peripherals_pcnt_reinit(pcnt_config_t *pcnt_config) { + // Reinitialize a pcnt unit that has already been allocated. + // Initialize PCNT unit + pcnt_unit_config(pcnt_config); + + // 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); +} + +int peripherals_pcnt_init(pcnt_config_t *pcnt_config) { const int8_t unit = peripherals_pcnt_get_unit(pcnt_config); if (unit == -1) { return -1; } - // Initialize PCNT unit - pcnt_unit_config(&pcnt_config); + peripherals_pcnt_reinit(pcnt_config); - // 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); - - return pcnt_config.unit; + return pcnt_config->unit; } void peripherals_pcnt_deinit(pcnt_unit_t *unit) { diff --git a/ports/espressif/peripherals/pcnt.h b/ports/espressif/peripherals/pcnt.h index c73c41a232..d34d971601 100644 --- a/ports/espressif/peripherals/pcnt.h +++ b/ports/espressif/peripherals/pcnt.h @@ -30,8 +30,8 @@ #include "driver/pcnt.h" #include "soc/pcnt_struct.h" -extern int peripherals_pcnt_init(pcnt_config_t pcnt_config); -extern int peripherals_pcnt_get_unit(pcnt_config_t pcnt_config); +extern int peripherals_pcnt_init(pcnt_config_t *pcnt_config); +extern void peripherals_pcnt_reinit(pcnt_config_t *pcnt_config); extern void peripherals_pcnt_deinit(pcnt_unit_t *unit); extern void peripherals_pcnt_reset(void); diff --git a/ports/espressif/peripherals/pins.h b/ports/espressif/peripherals/pins.h index 4958c46410..9edad560c8 100644 --- a/ports/espressif/peripherals/pins.h +++ b/ports/espressif/peripherals/pins.h @@ -65,7 +65,9 @@ extern const mp_obj_type_t mcu_pin_type; } // Choose based on chip -#ifdef CONFIG_IDF_TARGET_ESP32C3 +#if defined(CONFIG_IDF_TARGET_ESP32) +#include "esp32/pins.h" +#elif defined(CONFIG_IDF_TARGET_ESP32C3) #include "esp32c3/pins.h" #elif defined(CONFIG_IDF_TARGET_ESP32S2) #include "esp32s2/pins.h" diff --git a/ports/espressif/peripherals/touch.c b/ports/espressif/peripherals/touch.c index eeba49c683..9cf718b501 100644 --- a/ports/espressif/peripherals/touch.c +++ b/ports/espressif/peripherals/touch.c @@ -43,14 +43,36 @@ void peripherals_touch_never_reset(const bool enable) { void peripherals_touch_init(const touch_pad_t touchpad) { if (!touch_inited) { touch_pad_init(); - touch_pad_set_fsm_mode(TOUCH_FSM_MODE_TIMER); + touch_pad_set_fsm_mode(TOUCH_FSM_MODE_SW); } // touch_pad_config() must be done before touch_pad_fsm_start() the first time. // Otherwise the calibration is wrong and we get maximum raw values if there is // a trace of any significant length on the pin. + #if defined(CONFIG_IDF_TARGET_ESP32) + touch_pad_config(touchpad, 0); + #else touch_pad_config(touchpad); - if (!touch_inited) { - touch_pad_fsm_start(); - touch_inited = true; - } + touch_pad_fsm_start(); + #endif + touch_inited = true; +} + +uint16_t peripherals_touch_read(touch_pad_t touchpad) { + #if defined(CONFIG_IDF_TARGET_ESP32) + uint16_t touch_value; + touch_pad_read(touchpad, &touch_value); + // ESP32 touch_pad_read() returns a lower value when a pin is touched instead of a higher value. + // Flip the values around to be consistent with TouchIn assumptions. + return UINT16_MAX - touch_value; + #else + uint32_t touch_value; + touch_pad_sw_start(); + while (!touch_pad_meas_is_done()) { + } + touch_pad_read_raw_data(touchpad, &touch_value); + if (touch_value > UINT16_MAX) { + return UINT16_MAX; + } + return (uint16_t)touch_value; + #endif } diff --git a/ports/espressif/peripherals/touch.h b/ports/espressif/peripherals/touch.h index c7cd1f6be1..5feba4410a 100644 --- a/ports/espressif/peripherals/touch.h +++ b/ports/espressif/peripherals/touch.h @@ -29,6 +29,7 @@ #include "driver/touch_pad.h" +extern uint16_t peripherals_touch_read(touch_pad_t touchpad); extern void peripherals_touch_reset(void); extern void peripherals_touch_never_reset(const bool enable); extern void peripherals_touch_init(const touch_pad_t touchpad); diff --git a/ports/espressif/supervisor/port.c b/ports/espressif/supervisor/port.c index bf606ad159..3106f4b991 100644 --- a/ports/espressif/supervisor/port.c +++ b/ports/espressif/supervisor/port.c @@ -29,13 +29,13 @@ #include #include "supervisor/board.h" #include "supervisor/port.h" -#include "modules/module.h" +#include "supervisor/filesystem.h" #include "py/runtime.h" -#include "supervisor/esp_port.h" #include "freertos/FreeRTOS.h" #include "freertos/task.h" +#include "bindings/espidf/__init__.h" #include "common-hal/microcontroller/Pin.h" #include "common-hal/analogio/AnalogOut.h" #include "common-hal/busio/I2C.h" @@ -54,6 +54,8 @@ #include "shared-bindings/microcontroller/__init__.h" #include "shared-bindings/microcontroller/RunMode.h" #include "shared-bindings/rtc/__init__.h" +#include "shared-bindings/socketpool/__init__.h" +#include "shared-module/dotenv/__init__.h" #include "peripherals/rmt.h" #include "peripherals/timer.h" @@ -74,32 +76,30 @@ #include "shared-bindings/_bleio/__init__.h" #endif -#if CIRCUITPY_IMAGECAPTURE -#include "cam.h" +#if CIRCUITPY_ESP32_CAMERA +#include "esp_camera.h" #endif +#ifndef CONFIG_IDF_TARGET_ESP32 #include "soc/cache_memory.h" +#endif + +#include "soc/efuse_reg.h" #include "soc/rtc_cntl_reg.h" #include "esp_debug_helpers.h" +#include "bootloader_flash_config.h" +#include "esp_efuse.h" #include "esp_ipc.h" +#include "esp_rom_efuse.h" -#ifdef CONFIG_SPIRAM -#include "esp32/spiram.h" +#ifdef CONFIG_IDF_TARGET_ESP32 +#include "esp32/rom/efuse.h" #endif -// Heap sizes for when there is no external RAM for CircuitPython to use -// exclusively. -#ifdef CONFIG_IDF_TARGET_ESP32S2 -#define HEAP_SIZE (48 * 1024) -#endif -#ifdef CONFIG_IDF_TARGET_ESP32S3 -#define HEAP_SIZE (176 * 1024) -#endif -#ifdef CONFIG_IDF_TARGET_ESP32C3 -#define HEAP_SIZE (88 * 1024) -#endif +#include "esp_log.h" +#define TAG "port" uint32_t *heap; uint32_t heap_size; @@ -133,6 +133,97 @@ STATIC void tick_timer_cb(void *arg) { void sleep_timer_cb(void *arg); +// The ESP-IDF determines these pins at runtime so we do too. This code is based on: +// https://github.com/espressif/esp-idf/blob/6d85d53ceec30c818a92c2fff8f5437d21c4720f/components/esp_hw_support/port/esp32/spiram_psram.c#L810 +// IO-pins for PSRAM. +// WARNING: PSRAM shares all but the CS and CLK pins with the flash, so these defines +// hardcode the flash pins as well, making this code incompatible with either a setup +// that has the flash on non-standard pins or ESP32s with built-in flash. +#define PSRAM_SPIQ_SD0_IO 7 +#define PSRAM_SPID_SD1_IO 8 +#define PSRAM_SPIWP_SD3_IO 10 +#define PSRAM_SPIHD_SD2_IO 9 + +#define FLASH_HSPI_CLK_IO 14 +#define FLASH_HSPI_CS_IO 15 +#define PSRAM_HSPI_SPIQ_SD0_IO 12 +#define PSRAM_HSPI_SPID_SD1_IO 13 +#define PSRAM_HSPI_SPIWP_SD3_IO 2 +#define PSRAM_HSPI_SPIHD_SD2_IO 4 + +#ifdef CONFIG_SPIRAM +// PSRAM clock and cs IO should be configured based on hardware design. +// For ESP32-WROVER or ESP32-WROVER-B module, the clock IO is IO17, the cs IO is IO16, +// they are the default value for these two configs. +#define D0WD_PSRAM_CLK_IO CONFIG_D0WD_PSRAM_CLK_IO // Default value is 17 +#define D0WD_PSRAM_CS_IO CONFIG_D0WD_PSRAM_CS_IO // Default value is 16 + +#define D2WD_PSRAM_CLK_IO CONFIG_D2WD_PSRAM_CLK_IO // Default value is 9 +#define D2WD_PSRAM_CS_IO CONFIG_D2WD_PSRAM_CS_IO // Default value is 10 + +// There is no reason to change the pin of an embedded psram. +// So define the number of pin directly, instead of configurable. +#define D0WDR2_V3_PSRAM_CLK_IO 6 +#define D0WDR2_V3_PSRAM_CS_IO 16 + +// For ESP32-PICO chip, the psram share clock with flash. The flash clock pin is fixed, which is IO6. +#define PICO_PSRAM_CLK_IO 6 +#define PICO_PSRAM_CS_IO CONFIG_PICO_PSRAM_CS_IO // Default value is 10 + +#define PICO_V3_02_PSRAM_CLK_IO 10 +#define PICO_V3_02_PSRAM_CS_IO 9 +#endif // CONFIG_SPIRAM + +static void _never_reset_spi_ram_flash(void) { + #if defined(CONFIG_IDF_TARGET_ESP32) + #if defined(CONFIG_SPIRAM) + uint32_t pkg_ver = esp_efuse_get_pkg_ver(); + if (pkg_ver == EFUSE_RD_CHIP_VER_PKG_ESP32D2WDQ5) { + never_reset_pin_number(D2WD_PSRAM_CLK_IO); + never_reset_pin_number(D2WD_PSRAM_CS_IO); + } else if (pkg_ver == EFUSE_RD_CHIP_VER_PKG_ESP32PICOD4 && esp_efuse_get_chip_ver() >= 3) { + // This chip is ESP32-PICO-V3 and doesn't have PSRAM. + } else if ((pkg_ver == EFUSE_RD_CHIP_VER_PKG_ESP32PICOD2) || (pkg_ver == EFUSE_RD_CHIP_VER_PKG_ESP32PICOD4)) { + never_reset_pin_number(PICO_PSRAM_CLK_IO); + never_reset_pin_number(PICO_PSRAM_CS_IO); + } else if (pkg_ver == EFUSE_RD_CHIP_VER_PKG_ESP32PICOV302) { + never_reset_pin_number(PICO_V3_02_PSRAM_CLK_IO); + never_reset_pin_number(PICO_V3_02_PSRAM_CS_IO); + } else if ((pkg_ver == EFUSE_RD_CHIP_VER_PKG_ESP32D0WDQ6) || (pkg_ver == EFUSE_RD_CHIP_VER_PKG_ESP32D0WDQ5)) { + never_reset_pin_number(D0WD_PSRAM_CLK_IO); + never_reset_pin_number(D0WD_PSRAM_CS_IO); + } else if (pkg_ver == EFUSE_RD_CHIP_VER_PKG_ESP32D0WDR2V3) { + never_reset_pin_number(D0WDR2_V3_PSRAM_CLK_IO); + never_reset_pin_number(D0WDR2_V3_PSRAM_CS_IO); + } + #endif // CONFIG_SPIRAM + + const uint32_t spiconfig = esp_rom_efuse_get_flash_gpio_info(); + if (spiconfig == ESP_ROM_EFUSE_FLASH_DEFAULT_SPI) { + never_reset_pin_number(SPI_IOMUX_PIN_NUM_CLK); + never_reset_pin_number(SPI_IOMUX_PIN_NUM_CS); + never_reset_pin_number(PSRAM_SPIQ_SD0_IO); + never_reset_pin_number(PSRAM_SPID_SD1_IO); + never_reset_pin_number(PSRAM_SPIWP_SD3_IO); + never_reset_pin_number(PSRAM_SPIHD_SD2_IO); + } else if (spiconfig == ESP_ROM_EFUSE_FLASH_DEFAULT_HSPI) { + never_reset_pin_number(FLASH_HSPI_CLK_IO); + never_reset_pin_number(FLASH_HSPI_CS_IO); + never_reset_pin_number(PSRAM_HSPI_SPIQ_SD0_IO); + never_reset_pin_number(PSRAM_HSPI_SPID_SD1_IO); + never_reset_pin_number(PSRAM_HSPI_SPIWP_SD3_IO); + never_reset_pin_number(PSRAM_HSPI_SPIHD_SD2_IO); + } else { + never_reset_pin_number(EFUSE_SPICONFIG_RET_SPICLK(spiconfig)); + never_reset_pin_number(EFUSE_SPICONFIG_RET_SPICS0(spiconfig)); + never_reset_pin_number(EFUSE_SPICONFIG_RET_SPIQ(spiconfig)); + never_reset_pin_number(EFUSE_SPICONFIG_RET_SPID(spiconfig)); + never_reset_pin_number(EFUSE_SPICONFIG_RET_SPIHD(spiconfig)); + never_reset_pin_number(bootloader_flash_get_wp_pin()); + } + #endif // CONFIG_IDF_TARGET_ESP32 +} + safe_mode_t port_init(void) { esp_timer_create_args_t args; args.callback = &tick_timer_cb; @@ -155,12 +246,22 @@ safe_mode_t port_init(void) { #endif heap = NULL; - never_reset_module_internal_pins(); #ifndef DEBUG #define DEBUG (0) #endif + #define pin_GPIOn(n) pin_GPIO##n + #define pin_GPIOn_EXPAND(x) pin_GPIOn(x) + + #ifdef CONFIG_CONSOLE_UART_TX_GPIO + common_hal_never_reset_pin(&pin_GPIOn_EXPAND(CONFIG_CONSOLE_UART_TX_GPIO)); + #endif + + #ifdef CONFIG_CONSOLE_UART_RX_GPIO + common_hal_never_reset_pin(&pin_GPIOn_EXPAND(CONFIG_CONSOLE_UART_RX_GPIO)); + #endif + #if DEBUG // debug UART #ifdef CONFIG_IDF_TARGET_ESP32C3 @@ -192,18 +293,29 @@ safe_mode_t port_init(void) { #endif #ifdef CONFIG_SPIRAM - if (esp_spiram_is_initialized()) { - size_t spiram_size = esp_spiram_get_size(); - heap = (uint32_t *)(SOC_EXTRAM_DATA_HIGH - spiram_size); - heap_size = spiram_size / sizeof(uint32_t); + { + intptr_t heap_start = common_hal_espidf_get_psram_start(); + intptr_t heap_end = common_hal_espidf_get_psram_end(); + size_t spiram_size = heap_end - heap_start; + if (spiram_size > 0) { + heap = (uint32_t *)heap_start; + heap_size = (heap_end - heap_start) / sizeof(uint32_t); + } else { + ESP_LOGE(TAG, "CONFIG_SPIRAM enabled but no spiram heap available"); + } } #endif + _never_reset_spi_ram_flash(); + if (heap == NULL) { - heap = malloc(HEAP_SIZE); - heap_size = HEAP_SIZE / sizeof(uint32_t); + size_t heap_total = heap_caps_get_total_size(MALLOC_CAP_8BIT); + heap_size = MIN(heap_caps_get_largest_free_block(MALLOC_CAP_8BIT), heap_total / 2); + heap = malloc(heap_size); + heap_size = heap_size / sizeof(uint32_t); } if (heap == NULL) { + heap_size = 0; return NO_HEAP; } @@ -214,6 +326,9 @@ safe_mode_t port_init(void) { case ESP_RST_PANIC: return HARD_CRASH; case ESP_RST_INT_WDT: + // The interrupt watchdog is used internally to make sure that latency sensitive + // interrupt code isn't blocked. User watchdog resets come through ESP_RST_WDT. + return WATCHDOG_RESET; case ESP_RST_WDT: default: break; @@ -223,15 +338,13 @@ safe_mode_t port_init(void) { } void reset_port(void) { - #if CIRCUITPY_IMAGECAPTURE - cam_deinit(); + // TODO deinit for esp32-camera + #if CIRCUITPY_ESP32_CAMERA + esp_camera_deinit(); #endif reset_all_pins(); - // A larger delay so the idle task can run and do any IDF cleanup needed. - vTaskDelay(4); - #if CIRCUITPY_ANALOGIO analogout_reset(); #endif @@ -275,6 +388,10 @@ void reset_port(void) { rtc_reset(); #endif + #if CIRCUITPY_SOCKETPOOL + socketpool_user_reset(); + #endif + #if CIRCUITPY_TOUCHIO_USE_NATIVE peripherals_touch_reset(); #endif @@ -283,13 +400,8 @@ void reset_port(void) { watchdog_reset(); #endif - #if CIRCUITPY_WIFI - wifi_reset(); - #endif - - #if CIRCUITPY_SOCKETPOOL - socket_reset(); - #endif + // Yield so the idle task can run and do any IDF cleanup needed. + port_yield(); } void reset_to_bootloader(void) { @@ -372,6 +484,18 @@ void port_wake_main_task() { xTaskNotifyGive(circuitpython_task); } +void port_wake_main_task_from_isr() { + BaseType_t xHigherPriorityTaskWoken = pdFALSE; + vTaskNotifyGiveFromISR(circuitpython_task, &xHigherPriorityTaskWoken); + if (xHigherPriorityTaskWoken == pdTRUE) { + portYIELD_FROM_ISR(); + } +} + +void port_yield() { + vTaskDelay(4); +} + void sleep_timer_cb(void *arg) { port_wake_main_task(); } @@ -392,6 +516,16 @@ void port_idle_until_interrupt(void) { } } +void port_post_boot_py(bool heap_valid) { + if (!heap_valid && filesystem_present()) { + mp_int_t reserved; + if (dotenv_get_key_int("/.env", "CIRCUITPY_RESERVED_PSRAM", &reserved)) { + common_hal_espidf_set_reserved_psram(reserved); + } + common_hal_espidf_reserve_psram(); + } +} + // Wrap main in app_main that the IDF expects. extern void main(void); extern void app_main(void); diff --git a/ports/espressif/supervisor/serial.c b/ports/espressif/supervisor/serial.c index 9a0ecee4df..7b0166f5b1 100644 --- a/ports/espressif/supervisor/serial.c +++ b/ports/espressif/supervisor/serial.c @@ -27,6 +27,10 @@ #include "py/mpconfig.h" #include "supervisor/serial.h" +#if CIRCUITPY_ESP_USB_SERIAL_JTAG && CIRCUITPY_CONSOLE_UART +#error CIRCUITPY_ESP_USB_SERIAL_JTAG and CIRCUITPY_CONSOLE_UART cannot both be enabled. +#endif + #if CIRCUITPY_ESP_USB_SERIAL_JTAG #include "supervisor/usb_serial_jtag.h" #endif @@ -37,14 +41,13 @@ void port_serial_init(void) { #endif } + bool port_serial_connected(void) { #if CIRCUITPY_ESP_USB_SERIAL_JTAG - if (usb_serial_jtag_connected()) { - return true; - } - #endif - + return usb_serial_jtag_connected(); + #else return false; + #endif } char port_serial_read(void) { @@ -58,12 +61,10 @@ char port_serial_read(void) { bool port_serial_bytes_available(void) { #if CIRCUITPY_ESP_USB_SERIAL_JTAG - if (usb_serial_jtag_bytes_available()) { - return true; - } - #endif - + return usb_serial_jtag_bytes_available(); + #else return false; + #endif } void port_serial_write_substring(const char *text, uint32_t length) { diff --git a/ports/espressif/supervisor/usb.c b/ports/espressif/supervisor/usb.c index a4f26b366c..61e6b5f09d 100644 --- a/ports/espressif/supervisor/usb.c +++ b/ports/espressif/supervisor/usb.c @@ -27,7 +27,6 @@ #include "py/runtime.h" #include "supervisor/usb.h" -#include "supervisor/esp_port.h" #include "supervisor/port.h" #include "shared/runtime/interrupt_char.h" #include "shared/readline/readline.h" diff --git a/ports/espressif/supervisor/usb_serial_jtag.c b/ports/espressif/supervisor/usb_serial_jtag.c index 064d7d668c..646d2c3a5e 100644 --- a/ports/espressif/supervisor/usb_serial_jtag.c +++ b/ports/espressif/supervisor/usb_serial_jtag.c @@ -28,19 +28,46 @@ #include "py/ringbuf.h" #include "py/runtime.h" #include "py/mphal.h" -#include "usb_serial_jtag.h" +#include "supervisor/port.h" +#include "supervisor/usb_serial_jtag.h" #include "hal/usb_serial_jtag_ll.h" #include "esp_intr_alloc.h" #include "soc/periph_defs.h" -#include "supervisor/esp_port.h" #define USB_SERIAL_JTAG_BUF_SIZE (64) STATIC ringbuf_t ringbuf; STATIC uint8_t buf[128]; -STATIC bool connected; +STATIC volatile bool connected; + +#if CIRCUITPY_ESP_USB_SERIAL_JTAG && !CONFIG_ESP_PHY_ENABLE_USB +#error "CONFIG_ESP_PHY_ENABLE_USB must be enabled in sdkconfig" +#endif + +// Make sure the recv interrupt is disabled during this. Otherwise, it could reorder data if it +// interrupts itself. +static void _copy_out_of_fifo(void) { + size_t req_len = ringbuf_num_empty(&ringbuf); + if (req_len == 0) { + // Disable the interrupt so that CircuitPython can run and process the ringbuf. It will + // re-enable the interrupt once the ringbuf is empty. + usb_serial_jtag_ll_disable_intr_mask(USB_SERIAL_JTAG_INTR_SERIAL_OUT_RECV_PKT); + } + if (req_len > USB_SERIAL_JTAG_BUF_SIZE) { + req_len = USB_SERIAL_JTAG_BUF_SIZE; + } + uint8_t rx_buf[USB_SERIAL_JTAG_BUF_SIZE]; + size_t len = usb_serial_jtag_ll_read_rxfifo(rx_buf, req_len); + for (size_t i = 0; i < len; ++i) { + if (rx_buf[i] == mp_interrupt_char) { + mp_sched_keyboard_interrupt(); + } else { + ringbuf_put(&ringbuf, rx_buf[i]); + } + } +} static void usb_serial_jtag_isr_handler(void *arg) { uint32_t flags = usb_serial_jtag_ll_get_intsts_mask(); @@ -49,40 +76,27 @@ static void usb_serial_jtag_isr_handler(void *arg) { usb_serial_jtag_ll_clr_intsts_mask(USB_SERIAL_JTAG_INTR_SOF); } + if (flags & USB_SERIAL_JTAG_INTR_TOKEN_REC_IN_EP1) { + usb_serial_jtag_ll_clr_intsts_mask(USB_SERIAL_JTAG_INTR_TOKEN_REC_IN_EP1); + connected = true; + } + if (flags & USB_SERIAL_JTAG_INTR_SERIAL_OUT_RECV_PKT) { usb_serial_jtag_ll_clr_intsts_mask(USB_SERIAL_JTAG_INTR_SERIAL_OUT_RECV_PKT); - size_t req_len = ringbuf_num_empty(&ringbuf); - if (req_len > USB_SERIAL_JTAG_BUF_SIZE) { - req_len = USB_SERIAL_JTAG_BUF_SIZE; - } - uint8_t rx_buf[USB_SERIAL_JTAG_BUF_SIZE]; - size_t len = usb_serial_jtag_ll_read_rxfifo(rx_buf, req_len); - for (size_t i = 0; i < len; ++i) { - if (rx_buf[i] == mp_interrupt_char) { - mp_sched_keyboard_interrupt(); - } else { - ringbuf_put(&ringbuf, rx_buf[i]); - } - } - vTaskNotifyGiveFromISR(circuitpython_task, NULL); + _copy_out_of_fifo(); + port_wake_main_task_from_isr(); } } void usb_serial_jtag_init(void) { - ringbuf_init(&ringbuf, buf, sizeof(buf)); - usb_serial_jtag_ll_clr_intsts_mask(USB_SERIAL_JTAG_INTR_SOF | USB_SERIAL_JTAG_INTR_SERIAL_OUT_RECV_PKT); - usb_serial_jtag_ll_ena_intr_mask(USB_SERIAL_JTAG_INTR_SOF | USB_SERIAL_JTAG_INTR_SERIAL_OUT_RECV_PKT); + ringbuf_init(&ringbuf, buf, sizeof(buf) - 1); + usb_serial_jtag_ll_clr_intsts_mask(USB_SERIAL_JTAG_INTR_SOF | USB_SERIAL_JTAG_INTR_SERIAL_OUT_RECV_PKT | USB_SERIAL_JTAG_INTR_TOKEN_REC_IN_EP1); + usb_serial_jtag_ll_ena_intr_mask(USB_SERIAL_JTAG_INTR_SOF | USB_SERIAL_JTAG_INTR_SERIAL_OUT_RECV_PKT | USB_SERIAL_JTAG_INTR_TOKEN_REC_IN_EP1); ESP_ERROR_CHECK(esp_intr_alloc(ETS_USB_SERIAL_JTAG_INTR_SOURCE, ESP_INTR_FLAG_LEVEL1, usb_serial_jtag_isr_handler, NULL, NULL)); } bool usb_serial_jtag_connected(void) { - // Make connected sticky. Otherwise we'll be disconnected every time the SOF - // index is 0. (It's only ~15 bits so it wraps around frequently.) - if (connected) { - return true; - } - connected = USB_SERIAL_JTAG.fram_num.sof_frame_index > 0; return connected; } @@ -90,22 +104,38 @@ char usb_serial_jtag_read_char(void) { if (ringbuf_num_filled(&ringbuf) == 0) { return -1; } - return ringbuf_get(&ringbuf); + char c = ringbuf_get(&ringbuf); + // Maybe re-enable the recv interrupt if we've emptied the ringbuf. + if (ringbuf_num_filled(&ringbuf) == 0) { + usb_serial_jtag_ll_disable_intr_mask(USB_SERIAL_JTAG_INTR_SERIAL_OUT_RECV_PKT); + _copy_out_of_fifo(); + usb_serial_jtag_ll_ena_intr_mask(USB_SERIAL_JTAG_INTR_SERIAL_OUT_RECV_PKT); + } + return c; } bool usb_serial_jtag_bytes_available(void) { - return ringbuf_num_filled(&ringbuf); + return ringbuf_num_filled(&ringbuf) > 0; } void usb_serial_jtag_write(const char *text, uint32_t length) { - if (USB_SERIAL_JTAG.fram_num.sof_frame_index > 0) { - size_t total_written = 0; - uint32_t start_time = supervisor_ticks_ms32(); - // Time out after 5 milliseconds in case usb isn't actually reading CDC. - while (total_written < length && start_time - supervisor_ticks_ms32() < 5) { - total_written += usb_serial_jtag_ll_write_txfifo((const uint8_t *)(text + total_written), length - total_written); - RUN_BACKGROUND_TASKS; - } - usb_serial_jtag_ll_txfifo_flush(); + if (!usb_serial_jtag_connected()) { + return; } + size_t total_written = 0; + while (total_written < length) { + uint32_t start_time = supervisor_ticks_ms32(); + // Wait until we can write to the FIFO again. If it takes too long, then + // assume we're disconnected. + while (!usb_serial_jtag_ll_txfifo_writable()) { + uint32_t now = supervisor_ticks_ms32(); + if (now - start_time > 200) { + connected = false; + return; + } + } + total_written += usb_serial_jtag_ll_write_txfifo((const uint8_t *)(text + total_written), length - total_written); + RUN_BACKGROUND_TASKS; + } + usb_serial_jtag_ll_txfifo_flush(); } diff --git a/ports/espressif/tools/build_memory_info.py b/ports/espressif/tools/build_memory_info.py index b26c007741..df9d6a801e 100644 --- a/ports/espressif/tools/build_memory_info.py +++ b/ports/espressif/tools/build_memory_info.py @@ -15,6 +15,15 @@ from elftools.elf.elffile import ELFFile print() internal_memory = { + "esp32": [ + # Name, Start, Length + ("RTC Fast Memory", (0x3FF8_0000, 0x400C_0000), 8 * 1024), + ("RTC Slow Memory", (0x5000_0000,), 8 * 1024), + # First 64kB of Internal SRAM 0 can be configured as cached, and starts at 0x4007_0000 + ("Internal SRAM 0", (0x4008_0000,), 128 * 1024), + ("Internal SRAM 1", (0x3FFE_0000, 0x400A_0000), 128 * 1024), + ("Internal SRAM 2", (0x3FFA_E000,), 200 * 1024), + ], "esp32s2": [ # Name, Start, Length ("RTC Fast Memory", (0x3FF9_E000, 0x4007_0000), 8 * 1024), @@ -73,9 +82,12 @@ with open(sys.argv[2], "r") as f: elif subtype == "ota_0": ota = partition[4].strip() size = app if ota is None else ota - if size[-1] not in ("k", "K"): - raise RuntimeError("Unhandled partition size suffix") - firmware_region = int(size[:-1]) * 1024 + if size[-1] in ("k", "K"): + firmware_region = int(size[:-1]) * 1024 + elif size[-1] in ("m", "M"): + firmware_region = int(size[:-1]) * 1024 * 1024 + else: + raise RuntimeError("Unhandled partition size suffix:", size[-1]) regions = dict((name, 0) for name, _, _ in internal_memory[target]) diff --git a/ports/espressif/tools/decode_backtrace.py b/ports/espressif/tools/decode_backtrace.py index 523677baea..38b2c12b66 100644 --- a/ports/espressif/tools/decode_backtrace.py +++ b/ports/espressif/tools/decode_backtrace.py @@ -18,7 +18,7 @@ while True: addresses = addresses[len("Backtrace:") :] addresses = addresses.strip().split() addresses = [address.split(":")[0] for address in addresses] - print("got", addresses) subprocess.run( - ["xtensa-esp32s2-elf-addr2line", "-e", "build-{}/firmware.elf".format(board)] + addresses + ["xtensa-esp32s2-elf-addr2line", "-aipfe", "build-{}/firmware.elf".format(board)] + + addresses ) diff --git a/ports/litex/.gitignore b/ports/litex/.gitignore deleted file mode 100644 index 414487d53e..0000000000 --- a/ports/litex/.gitignore +++ /dev/null @@ -1 +0,0 @@ -build-*/ diff --git a/ports/litex/Makefile b/ports/litex/Makefile index 6fe9e46bec..6b1e33c8d1 100644 --- a/ports/litex/Makefile +++ b/ports/litex/Makefile @@ -81,8 +81,6 @@ ifeq ($(DEBUG), 1) else CFLAGS += -DNDEBUG -ggdb3 OPTIMIZATION_FLAGS ?= -O2 -fno-inline-functions - # TODO: Test with -flto - ### CFLAGS += -flto endif # option to override compiler optimization level, set in boards/$(BOARD)/mpconfigboard.mk @@ -99,7 +97,7 @@ LDFLAGS = $(CFLAGS) -Wl,-nostdlib -Wl,-T,$(LD_FILE) -Wl,-Map=$@.map -Wl,-cref -W LIBS := -lgcc -lc -LDFLAGS += -flto -ffreestanding -nostartfiles -Wl,--gc-section -Wl,-Bstatic -Wl,-melf32lriscv -nostartfiles \ +LDFLAGS += -ffreestanding -nostartfiles -Wl,--gc-section -Wl,-Bstatic -Wl,-melf32lriscv -nostartfiles \ -Wl,--no-warn-mismatch \ -Wl,--build-id=none diff --git a/ports/litex/boards/fomu/board.c b/ports/litex/boards/fomu/board.c index e5bff42b1a..43fc74fd42 100644 --- a/ports/litex/boards/fomu/board.c +++ b/ports/litex/boards/fomu/board.c @@ -66,14 +66,3 @@ void board_init(void) { ledda_write(3, LEDDPWRG); // Green ledda_write(98, LEDDPWRB); // Blue } - -bool board_requests_safe_mode(void) { - return false; -} - -void reset_board(void) { - -} - -void board_deinit(void) { -} diff --git a/ports/litex/common-hal/digitalio/DigitalInOut.c b/ports/litex/common-hal/digitalio/DigitalInOut.c index 96cc95dfa6..7545722967 100644 --- a/ports/litex/common-hal/digitalio/DigitalInOut.c +++ b/ports/litex/common-hal/digitalio/DigitalInOut.c @@ -27,7 +27,7 @@ #include "shared-bindings/digitalio/DigitalInOut.h" #include "py/runtime.h" -#include "supervisor/shared/translate.h" +#include "supervisor/shared/translate/translate.h" #include "csr.h" @@ -58,10 +58,11 @@ void common_hal_digitalio_digitalinout_deinit(digitalio_digitalinout_obj_t *self self->pin = NULL; } -void common_hal_digitalio_digitalinout_switch_to_input( +digitalinout_result_t common_hal_digitalio_digitalinout_switch_to_input( digitalio_digitalinout_obj_t *self, digitalio_pull_t pull) { (void)pull; touch_oe_write(touch_oe_read() & ~(1 << self->pin->number)); + return DIGITALINOUT_OK; } digitalinout_result_t common_hal_digitalio_digitalinout_switch_to_output( @@ -111,10 +112,11 @@ digitalio_drive_mode_t common_hal_digitalio_digitalinout_get_drive_mode( } } -void common_hal_digitalio_digitalinout_set_pull( +digitalinout_result_t common_hal_digitalio_digitalinout_set_pull( digitalio_digitalinout_obj_t *self, digitalio_pull_t pull) { (void)self; (void)pull; + return DIGITALINOUT_OK; } digitalio_pull_t common_hal_digitalio_digitalinout_get_pull( diff --git a/ports/litex/common-hal/microcontroller/Processor.c b/ports/litex/common-hal/microcontroller/Processor.c index ff2f041876..12c3787c79 100644 --- a/ports/litex/common-hal/microcontroller/Processor.c +++ b/ports/litex/common-hal/microcontroller/Processor.c @@ -31,7 +31,7 @@ #include "common-hal/microcontroller/Processor.h" #include "shared-bindings/microcontroller/Processor.h" #include "shared-bindings/microcontroller/ResetReason.h" -#include "supervisor/shared/translate.h" +#include "supervisor/shared/translate/translate.h" #include "csr.h" #include "generated/soc.h" diff --git a/ports/litex/mpconfigport.mk b/ports/litex/mpconfigport.mk index 57f5113b69..d8dc4eef1e 100644 --- a/ports/litex/mpconfigport.mk +++ b/ports/litex/mpconfigport.mk @@ -18,7 +18,7 @@ CIRCUITPY_BUSIO = 0 CIRCUITPY_COUNTIO = 0 CIRCUITPY_DISPLAYIO = 0 CIRCUITPY_FREQUENCYIO = 0 -CIRCUITPY_I2CPERIPHERAL = 0 +CIRCUITPY_I2CTARGET = 0 CIRCUITPY_NVM = 0 CIRCUITPY_PWMIO = 0 CIRCUITPY_PULSEIO = 0 @@ -29,3 +29,5 @@ CIRCUITPY_SDCARDIO = 0 # Enable USB support CIRCUITPY_USB_HID = 1 CIRCUITPY_USB_MIDI = 1 + +CIRCUITPY_BUILD_EXTENSIONS ?= dfu diff --git a/ports/mimxrt10xx/.gitignore b/ports/mimxrt10xx/.gitignore deleted file mode 100644 index 414487d53e..0000000000 --- a/ports/mimxrt10xx/.gitignore +++ /dev/null @@ -1 +0,0 @@ -build-*/ diff --git a/ports/mimxrt10xx/Makefile b/ports/mimxrt10xx/Makefile index 4a74b8fce5..4b05c91714 100644 --- a/ports/mimxrt10xx/Makefile +++ b/ports/mimxrt10xx/Makefile @@ -75,7 +75,7 @@ INC += \ # NDEBUG disables assert() statements. This reduces code size pretty dramatically, per tannewt. -CFLAGS += -Os -ftree-vrp -DNDEBUG -ffreestanding +CFLAGS += -ftree-vrp -DNDEBUG # TinyUSB defines CFLAGS += -DCFG_TUSB_MCU=OPT_MCU_MIMXRT10XX -DCFG_TUD_MIDI_RX_BUFSIZE=512 -DCFG_TUD_CDC_RX_BUFSIZE=512 -DCFG_TUD_MIDI_TX_BUFSIZE=512 -DCFG_TUD_CDC_TX_BUFSIZE=512 -DCFG_TUD_MSC_BUFSIZE=1024 @@ -84,12 +84,8 @@ CFLAGS += -DCFG_TUSB_MCU=OPT_MCU_MIMXRT10XX -DCFG_TUD_MIDI_RX_BUFSIZE=512 -DCFG_ # Never set -fno-inline because we use inline to move small functions into routines that must be # in RAM. If inlining is disallowed, then we may end up calling a function in flash when we cannot. ifeq ($(DEBUG), 1) - # You may want to disable -flto if it interferes with debugging. - # CFLAGS += -flto -flto-partition=none # You may want to enable these flags to make setting breakpoints easier. CFLAGS += -fno-ipa-sra -else - #CFLAGS += -flto -flto-partition=none endif CFLAGS += $(INC) -ggdb -Wall -Werror -std=gnu11 -nostdlib -fshort-enums $(BASE_CFLAGS) $(CFLAGS_MOD) $(COPT) -Werror=missing-prototypes @@ -105,7 +101,6 @@ CFLAGS += \ -mfloat-abi=hard \ -mfpu=fpv5-sp-d16 \ -DCPU_$(CHIP_VARIANT) \ - -DDEBUG \ -DIMXRT10XX \ -g3 -Wno-unused-parameter \ -ffunction-sections -fdata-sections -fstack-usage diff --git a/ports/mimxrt10xx/boards/feather_m7_1011/board.c b/ports/mimxrt10xx/boards/feather_m7_1011/board.c index e6c41681ba..fa37b8ebfd 100644 --- a/ports/mimxrt10xx/boards/feather_m7_1011/board.c +++ b/ports/mimxrt10xx/boards/feather_m7_1011/board.c @@ -44,13 +44,3 @@ void board_init(void) { common_hal_never_reset_pin(&pin_GPIO_SD_07); common_hal_never_reset_pin(&pin_GPIO_SD_06); } - -bool board_requests_safe_mode(void) { - return false; -} - -void reset_board(void) { -} - -void board_deinit(void) { -} diff --git a/ports/mimxrt10xx/boards/feather_mimxrt1011/board.c b/ports/mimxrt10xx/boards/feather_mimxrt1011/board.c index e6c41681ba..1514503834 100644 --- a/ports/mimxrt10xx/boards/feather_mimxrt1011/board.c +++ b/ports/mimxrt10xx/boards/feather_mimxrt1011/board.c @@ -45,12 +45,4 @@ void board_init(void) { common_hal_never_reset_pin(&pin_GPIO_SD_06); } -bool board_requests_safe_mode(void) { - return false; -} - -void reset_board(void) { -} - -void board_deinit(void) { -} +// Use the MP_WEAK supervisor/shared/board.c versions of routines not defined here. diff --git a/ports/mimxrt10xx/boards/feather_mimxrt1062/board.c b/ports/mimxrt10xx/boards/feather_mimxrt1062/board.c index 8cefabc937..df3d502d80 100644 --- a/ports/mimxrt10xx/boards/feather_mimxrt1062/board.c +++ b/ports/mimxrt10xx/boards/feather_mimxrt1062/board.c @@ -44,12 +44,4 @@ void board_init(void) { common_hal_never_reset_pin(&pin_GPIO_SD_B1_11); } -bool board_requests_safe_mode(void) { - return false; -} - -void reset_board(void) { -} - -void board_deinit(void) { -} +// Use the MP_WEAK supervisor/shared/board.c versions of routines not defined here. diff --git a/ports/mimxrt10xx/boards/imxrt1010_evk/board.c b/ports/mimxrt10xx/boards/imxrt1010_evk/board.c index eefbcc6deb..5a4cbcfc66 100644 --- a/ports/mimxrt10xx/boards/imxrt1010_evk/board.c +++ b/ports/mimxrt10xx/boards/imxrt1010_evk/board.c @@ -47,12 +47,4 @@ void board_init(void) { common_hal_never_reset_pin(&pin_GPIO_13); } -bool board_requests_safe_mode(void) { - return false; -} - -void reset_board(void) { -} - -void board_deinit(void) { -} +// Use the MP_WEAK supervisor/shared/board.c versions of routines not defined here. diff --git a/ports/mimxrt10xx/boards/imxrt1020_evk/board.c b/ports/mimxrt10xx/boards/imxrt1020_evk/board.c index 42ab6bbd8c..a9eea2d14e 100644 --- a/ports/mimxrt10xx/boards/imxrt1020_evk/board.c +++ b/ports/mimxrt10xx/boards/imxrt1020_evk/board.c @@ -48,12 +48,4 @@ void board_init(void) { common_hal_never_reset_pin(&pin_GPIO_AD_B1_12); } -bool board_requests_safe_mode(void) { - return false; -} - -void reset_board(void) { -} - -void board_deinit(void) { -} +// Use the MP_WEAK supervisor/shared/board.c versions of routines not defined here. diff --git a/ports/mimxrt10xx/boards/imxrt1060_evk/board.c b/ports/mimxrt10xx/boards/imxrt1060_evk/board.c index d85b615f0f..12e75738f8 100644 --- a/ports/mimxrt10xx/boards/imxrt1060_evk/board.c +++ b/ports/mimxrt10xx/boards/imxrt1060_evk/board.c @@ -53,13 +53,3 @@ void board_init(void) { common_hal_never_reset_pin(&pin_GPIO_AD_B0_01); common_hal_never_reset_pin(&pin_GPIO_AD_B0_03); } - -bool board_requests_safe_mode(void) { - return false; -} - -void reset_board(void) { -} - -void board_deinit(void) { -} diff --git a/ports/mimxrt10xx/boards/imxrt1060_evk/mpconfigboard.h b/ports/mimxrt10xx/boards/imxrt1060_evk/mpconfigboard.h index 8e026fa7ce..3b63172328 100644 --- a/ports/mimxrt10xx/boards/imxrt1060_evk/mpconfigboard.h +++ b/ports/mimxrt10xx/boards/imxrt1060_evk/mpconfigboard.h @@ -16,9 +16,8 @@ #define DEFAULT_UART_BUS_RX (&pin_GPIO_AD_B1_07) #define DEFAULT_UART_BUS_TX (&pin_GPIO_AD_B1_06) -#define CIRCUITPY_DEBUG_UART_TX (&pin_GPIO_AD_B0_12) -#define CIRCUITPY_DEBUG_UART_RX (&pin_GPIO_AD_B0_13) - +#define CIRCUITPY_CONSOLE_UART_TX (&pin_GPIO_AD_B0_12) +#define CIRCUITPY_CONSOLE_UART_RX (&pin_GPIO_AD_B0_13) // Put host on the first USB so that right angle OTG adapters can fit. This is // the right port when looking at the board. diff --git a/ports/mimxrt10xx/boards/metro_m7_1011/board.c b/ports/mimxrt10xx/boards/metro_m7_1011/board.c index e6c41681ba..1514503834 100644 --- a/ports/mimxrt10xx/boards/metro_m7_1011/board.c +++ b/ports/mimxrt10xx/boards/metro_m7_1011/board.c @@ -45,12 +45,4 @@ void board_init(void) { common_hal_never_reset_pin(&pin_GPIO_SD_06); } -bool board_requests_safe_mode(void) { - return false; -} - -void reset_board(void) { -} - -void board_deinit(void) { -} +// Use the MP_WEAK supervisor/shared/board.c versions of routines not defined here. diff --git a/ports/mimxrt10xx/boards/sparkfun_teensy_micromod/board.c b/ports/mimxrt10xx/boards/sparkfun_teensy_micromod/board.c index 1a1dc7e5ec..55cd826de2 100644 --- a/ports/mimxrt10xx/boards/sparkfun_teensy_micromod/board.c +++ b/ports/mimxrt10xx/boards/sparkfun_teensy_micromod/board.c @@ -53,12 +53,4 @@ void board_init(void) { common_hal_never_reset_pin(&pin_GPIO_SD_B1_05); } -bool board_requests_safe_mode(void) { - return false; -} - -void reset_board(void) { -} - -void board_deinit(void) { -} +// Use the MP_WEAK supervisor/shared/board.c versions of routines not defined here. diff --git a/ports/mimxrt10xx/boards/sparkfun_teensy_micromod/flash_config.c b/ports/mimxrt10xx/boards/sparkfun_teensy_micromod/flash_config.c index 09886dece6..e0f5a5bd7d 100644 --- a/ports/mimxrt10xx/boards/sparkfun_teensy_micromod/flash_config.c +++ b/ports/mimxrt10xx/boards/sparkfun_teensy_micromod/flash_config.c @@ -15,7 +15,7 @@ __attribute__((section(".boot_hdr.ivt"))) * IVT Data *************************************/ const ivt image_vector_table = { - IVT_HEADER, /* IVT Header */ + 0x432000D1, /* Teensy bootloader looks for this value*/ IMAGE_ENTRY_ADDRESS, /* Image Entry Function */ IVT_RSVD, /* Reserved = 0 */ (uint32_t)DCD_ADDRESS, /* Address where DCD information is stored */ @@ -25,13 +25,15 @@ const ivt image_vector_table = { IVT_RSVD /* Reserved = 0 */ }; +extern unsigned long _flashimagelen; + __attribute__((section(".boot_hdr.boot_data"))) /************************************* * Boot Data *************************************/ const BOOT_DATA_T boot_data = { FLASH_BASE, /* boot start location */ - FLASH_SIZE, /* size */ + (uint32_t)&_flashimagelen, /* actual size of image */ PLUGIN_FLAG, /* Plugin flag*/ 0xFFFFFFFF /* empty - extra data word */ }; diff --git a/ports/mimxrt10xx/boards/teensy40/board.c b/ports/mimxrt10xx/boards/teensy40/board.c index 1a1dc7e5ec..55cd826de2 100644 --- a/ports/mimxrt10xx/boards/teensy40/board.c +++ b/ports/mimxrt10xx/boards/teensy40/board.c @@ -53,12 +53,4 @@ void board_init(void) { common_hal_never_reset_pin(&pin_GPIO_SD_B1_05); } -bool board_requests_safe_mode(void) { - return false; -} - -void reset_board(void) { -} - -void board_deinit(void) { -} +// Use the MP_WEAK supervisor/shared/board.c versions of routines not defined here. diff --git a/ports/mimxrt10xx/boards/teensy40/flash_config.c b/ports/mimxrt10xx/boards/teensy40/flash_config.c index 3f4ab0271d..d878124b40 100644 --- a/ports/mimxrt10xx/boards/teensy40/flash_config.c +++ b/ports/mimxrt10xx/boards/teensy40/flash_config.c @@ -15,7 +15,7 @@ __attribute__((section(".boot_hdr.ivt"))) * IVT Data *************************************/ const ivt image_vector_table = { - IVT_HEADER, /* IVT Header */ + 0x432000D1, /* Teensy bootloader looks for this value*/ IMAGE_ENTRY_ADDRESS, /* Image Entry Function */ IVT_RSVD, /* Reserved = 0 */ (uint32_t)DCD_ADDRESS, /* Address where DCD information is stored */ @@ -25,13 +25,15 @@ const ivt image_vector_table = { IVT_RSVD /* Reserved = 0 */ }; +extern unsigned long _flashimagelen; + __attribute__((section(".boot_hdr.boot_data"))) /************************************* * Boot Data *************************************/ const BOOT_DATA_T boot_data = { FLASH_BASE, /* boot start location */ - FLASH_SIZE, /* size */ + (uint32_t)&_flashimagelen, /* actual size of image */ PLUGIN_FLAG, /* Plugin flag*/ 0xFFFFFFFF /* empty - extra data word */ }; diff --git a/ports/mimxrt10xx/boards/teensy41/board.c b/ports/mimxrt10xx/boards/teensy41/board.c index 1a1dc7e5ec..628befd02b 100644 --- a/ports/mimxrt10xx/boards/teensy41/board.c +++ b/ports/mimxrt10xx/boards/teensy41/board.c @@ -52,13 +52,3 @@ void board_init(void) { // Data strobe needs protection despite being grounded common_hal_never_reset_pin(&pin_GPIO_SD_B1_05); } - -bool board_requests_safe_mode(void) { - return false; -} - -void reset_board(void) { -} - -void board_deinit(void) { -} diff --git a/ports/mimxrt10xx/boards/teensy41/flash_config.c b/ports/mimxrt10xx/boards/teensy41/flash_config.c index 09886dece6..e0f5a5bd7d 100644 --- a/ports/mimxrt10xx/boards/teensy41/flash_config.c +++ b/ports/mimxrt10xx/boards/teensy41/flash_config.c @@ -15,7 +15,7 @@ __attribute__((section(".boot_hdr.ivt"))) * IVT Data *************************************/ const ivt image_vector_table = { - IVT_HEADER, /* IVT Header */ + 0x432000D1, /* Teensy bootloader looks for this value*/ IMAGE_ENTRY_ADDRESS, /* Image Entry Function */ IVT_RSVD, /* Reserved = 0 */ (uint32_t)DCD_ADDRESS, /* Address where DCD information is stored */ @@ -25,13 +25,15 @@ const ivt image_vector_table = { IVT_RSVD /* Reserved = 0 */ }; +extern unsigned long _flashimagelen; + __attribute__((section(".boot_hdr.boot_data"))) /************************************* * Boot Data *************************************/ const BOOT_DATA_T boot_data = { FLASH_BASE, /* boot start location */ - FLASH_SIZE, /* size */ + (uint32_t)&_flashimagelen, /* actual size of image */ PLUGIN_FLAG, /* Plugin flag*/ 0xFFFFFFFF /* empty - extra data word */ }; diff --git a/ports/mimxrt10xx/common-hal/analogio/AnalogIn.c b/ports/mimxrt10xx/common-hal/analogio/AnalogIn.c index 2d809c258c..f5d2e7f42e 100644 --- a/ports/mimxrt10xx/common-hal/analogio/AnalogIn.c +++ b/ports/mimxrt10xx/common-hal/analogio/AnalogIn.c @@ -42,7 +42,7 @@ void common_hal_analogio_analogin_construct(analogio_analogin_obj_t *self, adc_config_t config = {0}; if (pin->adc == NULL) { - mp_raise_ValueError(translate("Pin does not have ADC capabilities")); + raise_ValueError_invalid_pin(); } ADC_GetDefaultConfig(&config); @@ -81,8 +81,10 @@ uint16_t common_hal_analogio_analogin_get_value(analogio_analogin_obj_t *self) { } - // Shift the value to be 16 bit - return ADC_GetChannelConversionValue(self->pin->adc, ADC_CHANNEL_GROUP) << 4; + uint16_t value = ADC_GetChannelConversionValue(self->pin->adc, ADC_CHANNEL_GROUP); + + // Stretch 12-bit ADC reading to 16-bit range + return (value << 4) | (value >> 8); } float common_hal_analogio_analogin_get_reference_voltage(analogio_analogin_obj_t *self) { diff --git a/ports/mimxrt10xx/common-hal/analogio/AnalogOut.c b/ports/mimxrt10xx/common-hal/analogio/AnalogOut.c index bf21e30df3..14e1faab09 100644 --- a/ports/mimxrt10xx/common-hal/analogio/AnalogOut.c +++ b/ports/mimxrt10xx/common-hal/analogio/AnalogOut.c @@ -29,10 +29,10 @@ #include "shared-bindings/analogio/AnalogOut.h" #include "shared-bindings/microcontroller/Pin.h" -#include "supervisor/shared/translate.h" +#include "supervisor/shared/translate/translate.h" void common_hal_analogio_analogout_construct(analogio_analogout_obj_t *self, const mcu_pin_obj_t *pin) { - mp_raise_NotImplementedError(translate("AnalogOut functionality not supported")); + mp_raise_NotImplementedError_varg(translate("%q"), MP_QSTR_AnalogOut); } bool common_hal_analogio_analogout_deinited(analogio_analogout_obj_t *self) { diff --git a/ports/mimxrt10xx/common-hal/busio/I2C.c b/ports/mimxrt10xx/common-hal/busio/I2C.c index 77df979e4d..50aae54aba 100644 --- a/ports/mimxrt10xx/common-hal/busio/I2C.c +++ b/ports/mimxrt10xx/common-hal/busio/I2C.c @@ -138,7 +138,7 @@ void common_hal_busio_i2c_construct(busio_i2c_obj_t *self, } if (self->sda == NULL || self->scl == NULL) { - mp_raise_ValueError(translate("Invalid pins")); + raise_ValueError_invalid_pins(); } else { self->i2c = mcu_i2c_banks[self->sda->bank_idx - 1]; } diff --git a/ports/mimxrt10xx/common-hal/busio/SPI.c b/ports/mimxrt10xx/common-hal/busio/SPI.c index 608fae7fbe..0048c2aeb2 100644 --- a/ports/mimxrt10xx/common-hal/busio/SPI.c +++ b/ports/mimxrt10xx/common-hal/busio/SPI.c @@ -168,7 +168,7 @@ void common_hal_busio_spi_construct(busio_spi_obj_t *self, if (spi_taken) { mp_raise_ValueError(translate("Hardware busy, try alternative pins")); } else { - mp_raise_ValueError(translate("Invalid pins")); + raise_ValueError_invalid_pins(); } } diff --git a/ports/mimxrt10xx/common-hal/busio/UART.c b/ports/mimxrt10xx/common-hal/busio/UART.c index 57eaada7ef..20430c91c8 100644 --- a/ports/mimxrt10xx/common-hal/busio/UART.c +++ b/ports/mimxrt10xx/common-hal/busio/UART.c @@ -113,12 +113,9 @@ void common_hal_busio_uart_construct(busio_uart_obj_t *self, bool sigint_enabled) { self->baudrate = baudrate; - self->character_bits = bits; + self->character_bits = (uint8_t)mp_arg_validate_int_range(self->character_bits, 7, 8, MP_QSTR_bits); self->timeout_ms = timeout * 1000; - if (self->character_bits != 7 && self->character_bits != 8) { - mp_raise_ValueError(translate("Invalid word/bit length")); - } DBGPrintf(&mp_plat_print, "uart_construct: tx:%p rx:%p rts:%p cts:%p rs485:%p\n", tx, rx, rts, cts, rs485_dir); @@ -186,10 +183,10 @@ void common_hal_busio_uart_construct(busio_uart_obj_t *self, } if (rx && !rx_config) { - mp_raise_ValueError_varg(translate("Invalid %q pin"), MP_QSTR_RX); + raise_ValueError_invalid_pin_name(MP_QSTR_rx); } if (tx && !tx_config) { - mp_raise_ValueError_varg(translate("Invalid %q pin"), MP_QSTR_TX); + raise_ValueError_invalid_pin_name(MP_QSTR_tx); } if (uart_taken) { @@ -236,7 +233,7 @@ void common_hal_busio_uart_construct(busio_uart_obj_t *self, } } if ((rts != NULL) && (rts_config == NULL)) { - mp_raise_ValueError_varg(translate("Invalid %q pin"), MP_QSTR_RTS); + raise_ValueError_invalid_pin_name(MP_QSTR_rts); } } @@ -250,7 +247,7 @@ void common_hal_busio_uart_construct(busio_uart_obj_t *self, } } if (cts_config == NULL) { - mp_raise_ValueError_varg(translate("Invalid %q pin"), MP_QSTR_CTS); + raise_ValueError_invalid_pin_name(MP_QSTR_cts); } } @@ -350,7 +347,7 @@ void common_hal_busio_uart_construct(busio_uart_obj_t *self, if (!self->ringbuf) { LPUART_Deinit(self->uart); - mp_raise_msg(&mp_type_MemoryError, translate("Failed to allocate RX buffer")); + m_malloc_fail(receiver_buffer_size); } LPUART_TransferCreateHandle(self->uart, &self->handle, LPUART_UserCallback, self); diff --git a/ports/mimxrt10xx/common-hal/digitalio/DigitalInOut.c b/ports/mimxrt10xx/common-hal/digitalio/DigitalInOut.c index 27753f47dc..7639204bc6 100644 --- a/ports/mimxrt10xx/common-hal/digitalio/DigitalInOut.c +++ b/ports/mimxrt10xx/common-hal/digitalio/DigitalInOut.c @@ -36,7 +36,7 @@ #include "shared-bindings/microcontroller/Pin.h" #include "shared-bindings/digitalio/DigitalInOut.h" -#include "supervisor/shared/translate.h" +#include "supervisor/shared/translate/translate.h" #define IOMUXC_SW_MUX_CTL_PAD_MUX_MODE_ALT5 5U @@ -88,12 +88,13 @@ void common_hal_digitalio_digitalinout_deinit(digitalio_digitalinout_obj_t *self self->pin = NULL; } -void common_hal_digitalio_digitalinout_switch_to_input( +digitalinout_result_t common_hal_digitalio_digitalinout_switch_to_input( digitalio_digitalinout_obj_t *self, digitalio_pull_t pull) { self->output = false; // This also sets direction to input. common_hal_digitalio_digitalinout_set_pull(self, pull); + return DIGITALINOUT_OK; } digitalinout_result_t common_hal_digitalio_digitalinout_switch_to_output( @@ -150,7 +151,7 @@ digitalio_drive_mode_t common_hal_digitalio_digitalinout_get_drive_mode( } } -void common_hal_digitalio_digitalinout_set_pull( +digitalinout_result_t common_hal_digitalio_digitalinout_set_pull( digitalio_digitalinout_obj_t *self, digitalio_pull_t pull) { self->pull = pull; @@ -158,6 +159,7 @@ void common_hal_digitalio_digitalinout_set_pull( const gpio_pin_config_t config = { kGPIO_DigitalInput, 0, kGPIO_NoIntmode }; GPIO_PinInit(self->pin->gpio, self->pin->number, &config); + return DIGITALINOUT_OK; } digitalio_pull_t common_hal_digitalio_digitalinout_get_pull( diff --git a/ports/mimxrt10xx/common-hal/microcontroller/__init__.c b/ports/mimxrt10xx/common-hal/microcontroller/__init__.c index e6edd6dfc9..8de63061ad 100644 --- a/ports/mimxrt10xx/common-hal/microcontroller/__init__.c +++ b/ports/mimxrt10xx/common-hal/microcontroller/__init__.c @@ -37,7 +37,7 @@ #include "shared-bindings/microcontroller/Pin.h" #include "shared-bindings/microcontroller/Processor.h" #include "supervisor/shared/safe_mode.h" -#include "supervisor/shared/translate.h" +#include "supervisor/shared/translate/translate.h" #define DBL_TAP_REG SNVS->LPGPR[3] @@ -70,7 +70,7 @@ void common_hal_mcu_enable_interrupts(void) { void common_hal_mcu_on_next_reset(mcu_runmode_t runmode) { if (runmode == RUNMODE_BOOTLOADER) { if (!bootloader_available()) { - mp_raise_ValueError(translate("Cannot reset into bootloader because no bootloader is present.")); + mp_raise_ValueError(translate("Cannot reset into bootloader because no bootloader is present")); } // Pretend to be the first of the two reset presses needed to enter the // bootloader. That way one reset will end in the bootloader. diff --git a/ports/mimxrt10xx/common-hal/pwmio/PWMOut.c b/ports/mimxrt10xx/common-hal/pwmio/PWMOut.c index a42bbef7d7..97892b1095 100644 --- a/ports/mimxrt10xx/common-hal/pwmio/PWMOut.c +++ b/ports/mimxrt10xx/common-hal/pwmio/PWMOut.c @@ -35,7 +35,7 @@ #include "fsl_pwm.h" -#include "supervisor/shared/translate.h" +#include "supervisor/shared/translate/translate.h" #include "periph.h" // Debug print support set to zero to enable debug printing @@ -301,7 +301,7 @@ void common_hal_pwmio_pwmout_set_frequency(pwmio_pwmout_obj_t *self, int pulse_count = calculate_pulse_count(frequency, &self->prescaler); if (pulse_count == 0) { - mp_raise_ValueError(translate("Invalid PWM frequency")); + mp_arg_error_invalid(MP_QSTR_frequency); } self->pulse_count = pulse_count; diff --git a/ports/mimxrt10xx/common-hal/rtc/RTC.c b/ports/mimxrt10xx/common-hal/rtc/RTC.c index 04aa799ce5..7ed65a3499 100644 --- a/ports/mimxrt10xx/common-hal/rtc/RTC.c +++ b/ports/mimxrt10xx/common-hal/rtc/RTC.c @@ -33,7 +33,7 @@ #include "shared-bindings/rtc/__init__.h" #include "shared-bindings/rtc/RTC.h" #include "common-hal/rtc/RTC.h" -#include "supervisor/shared/translate.h" +#include "supervisor/shared/translate/translate.h" #include "fsl_snvs_hp.h" @@ -75,5 +75,5 @@ int common_hal_rtc_get_calibration(void) { void common_hal_rtc_set_calibration(int calibration) { // SNVS has HPCALB_VAL bits for calibration. - mp_raise_NotImplementedError(translate("RTC calibration is not supported on this board")); + mp_raise_NotImplementedError_varg(translate("%q"), MP_QSTR_calibration); } diff --git a/ports/mimxrt10xx/common-hal/usb_host/Port.c b/ports/mimxrt10xx/common-hal/usb_host/Port.c index 52ac12dc86..126160c69c 100644 --- a/ports/mimxrt10xx/common-hal/usb_host/Port.c +++ b/ports/mimxrt10xx/common-hal/usb_host/Port.c @@ -24,9 +24,8 @@ * THE SOFTWARE. */ -#include "shared-bindings/usb_host/Port.h" - #include "shared-bindings/microcontroller/Pin.h" +#include "shared-bindings/usb_host/Port.h" #include "py/runtime.h" @@ -43,7 +42,7 @@ void common_hal_usb_host_port_construct(usb_host_port_obj_t *self, const mcu_pin supported_dm = &pin_USB_OTG2_DN; } if (dp != supported_dp || dm != supported_dm) { - mp_raise_ValueError(translate("Invalid pins")); + raise_ValueError_invalid_pins(); } self->init = true; usb_host_init = true; diff --git a/ports/mimxrt10xx/linking/common.ld b/ports/mimxrt10xx/linking/common.ld index 44e8d537c4..b6f1acc8d0 100644 --- a/ports/mimxrt10xx/linking/common.ld +++ b/ports/mimxrt10xx/linking/common.ld @@ -74,7 +74,6 @@ SECTIONS _etext = .; /* define a global symbol at end of code */ __etext = .; /* define a global symbol at end of code */ } > FLASH_FIRMWARE - _ld_filesystem_start = ORIGIN(FLASH_FATFS); _ld_filesystem_end = _ld_filesystem_start + LENGTH(FLASH_FATFS); @@ -127,6 +126,8 @@ SECTIONS _ld_dtcm_data_flash_copy = LOADADDR(.dtcm_data); _ld_dtcm_data_size = SIZEOF(.dtcm_data); + _flashimagelen = _ld_dtcm_data_flash_copy + _ld_dtcm_data_size - flash_config_location; + .dtcm_bss : { . = ALIGN(4); diff --git a/ports/mimxrt10xx/mpconfigport.mk b/ports/mimxrt10xx/mpconfigport.mk index e7e7abe141..cee2d9a698 100644 --- a/ports/mimxrt10xx/mpconfigport.mk +++ b/ports/mimxrt10xx/mpconfigport.mk @@ -14,10 +14,12 @@ CIRCUITPY_AUDIOBUSIO = 0 CIRCUITPY_BUSDEVICE = 1 CIRCUITPY_COUNTIO = 0 CIRCUITPY_FREQUENCYIO = 0 -CIRCUITPY_I2CPERIPHERAL = 0 +CIRCUITPY_I2CTARGET = 0 CIRCUITPY_NVM = 0 CIRCUITPY_PARALLELDISPLAY = 0 CIRCUITPY_PULSEIO = 0 CIRCUITPY_ROTARYIO = 0 CIRCUITPY_USB_MIDI = 1 LONGINT_IMPL = MPZ + +CIRCUITPY_BUILD_EXTENSIONS ?= hex,uf2 diff --git a/ports/mimxrt10xx/supervisor/port.c b/ports/mimxrt10xx/supervisor/port.c index 38ecfd5c18..fbf0e8a9d8 100644 --- a/ports/mimxrt10xx/supervisor/port.c +++ b/ports/mimxrt10xx/supervisor/port.c @@ -46,9 +46,6 @@ #include "supervisor/background_callback.h" -#if CIRCUITPY_GAMEPADSHIFT -#include "shared-module/gamepadshift/__init__.h" -#endif #if CIRCUITPY_PEW #include "shared-module/_pew/PewPew.h" #endif @@ -294,9 +291,6 @@ void reset_port(void) { rtc_reset(); #endif - #if CIRCUITPY_GAMEPADSHIFT - gamepadshift_reset(); - #endif #if CIRCUITPY_PEW pew_reset(); #endif diff --git a/ports/mimxrt10xx/supervisor/serial.c b/ports/mimxrt10xx/supervisor/serial.c index 63f468beaf..cb557d36a8 100644 --- a/ports/mimxrt10xx/supervisor/serial.c +++ b/ports/mimxrt10xx/supervisor/serial.c @@ -33,9 +33,7 @@ #include "fsl_clock.h" #include "fsl_lpuart.h" -// TODO: Switch this to using DEBUG_UART. -// If the board defined a debug uart tx or rx pin then we enable this code -#if defined(CIRCUITPY_DEBUG_UART_TX) || defined(CIRCUITPY_DEBUG_UART_RX) +#if defined(CIRCUITPY_CONSOLE_UART) // static LPUART_Type *uart_instance = LPUART1; // evk static LPUART_Type *uart_instance = LPUART4; // feather 1011 // static LPUART_Type *uart_instance = LPUART2; // feather 1062 @@ -89,4 +87,4 @@ void port_serial_write_substring(const char *text, uint32_t len) { LPUART_WriteBlocking(uart_instance, (uint8_t *)text, len); } -#endif // USE_DEBUG_PORT_CODE +#endif // CIRCUITPY_CONSOLE_UART diff --git a/ports/nrf/.gitignore b/ports/nrf/.gitignore index cda23c7a90..91dce2841a 100644 --- a/ports/nrf/.gitignore +++ b/ports/nrf/.gitignore @@ -1,9 +1,2 @@ -# Old Nordic soft devices that don't allow redistribution -######################################################### -drivers/bluetooth/s132_nrf52_2.0.1/ - +# Softdevice .hex files that should be preserved !drivers/bluetooth/*/*.hex - -# Build files -##################### -build-*/ diff --git a/ports/nrf/Makefile b/ports/nrf/Makefile index 6db2b547c5..bbe102ffc8 100755 --- a/ports/nrf/Makefile +++ b/ports/nrf/Makefile @@ -91,7 +91,6 @@ ifeq ($(DEBUG), 1) else OPTIMIZATION_FLAGS ?= -O2 -fno-inline-functions CFLAGS += -DNDEBUG -ggdb3 - CFLAGS += -flto -flto-partition=none endif ifeq ($(NRF_DEBUG_PRINT), 1) diff --git a/ports/nrf/boards/ADM_B_NRF52840_1/board.c b/ports/nrf/boards/ADM_B_NRF52840_1/board.c index b4070e72dc..fb1ce4fb83 100644 --- a/ports/nrf/boards/ADM_B_NRF52840_1/board.c +++ b/ports/nrf/boards/ADM_B_NRF52840_1/board.c @@ -26,16 +26,4 @@ #include "supervisor/board.h" -void board_init(void) { -} - -bool board_requests_safe_mode(void) { - return false; -} - -void reset_board(void) { - -} - -void board_deinit(void) { -} +// Use the MP_WEAK supervisor/shared/board.c versions of routines not defined here. diff --git a/ports/nrf/boards/Seeed_XIAO_nRF52840_Sense/board.c b/ports/nrf/boards/Seeed_XIAO_nRF52840_Sense/board.c index b4070e72dc..fb1ce4fb83 100644 --- a/ports/nrf/boards/Seeed_XIAO_nRF52840_Sense/board.c +++ b/ports/nrf/boards/Seeed_XIAO_nRF52840_Sense/board.c @@ -26,16 +26,4 @@ #include "supervisor/board.h" -void board_init(void) { -} - -bool board_requests_safe_mode(void) { - return false; -} - -void reset_board(void) { - -} - -void board_deinit(void) { -} +// Use the MP_WEAK supervisor/shared/board.c versions of routines not defined here. diff --git a/ports/nrf/boards/TG-Watch/board.c b/ports/nrf/boards/TG-Watch/board.c index b4070e72dc..fb1ce4fb83 100644 --- a/ports/nrf/boards/TG-Watch/board.c +++ b/ports/nrf/boards/TG-Watch/board.c @@ -26,16 +26,4 @@ #include "supervisor/board.h" -void board_init(void) { -} - -bool board_requests_safe_mode(void) { - return false; -} - -void reset_board(void) { - -} - -void board_deinit(void) { -} +// Use the MP_WEAK supervisor/shared/board.c versions of routines not defined here. diff --git a/ports/nrf/boards/adafruit_led_glasses_nrf52840/board.c b/ports/nrf/boards/adafruit_led_glasses_nrf52840/board.c index b4070e72dc..fb1ce4fb83 100644 --- a/ports/nrf/boards/adafruit_led_glasses_nrf52840/board.c +++ b/ports/nrf/boards/adafruit_led_glasses_nrf52840/board.c @@ -26,16 +26,4 @@ #include "supervisor/board.h" -void board_init(void) { -} - -bool board_requests_safe_mode(void) { - return false; -} - -void reset_board(void) { - -} - -void board_deinit(void) { -} +// Use the MP_WEAK supervisor/shared/board.c versions of routines not defined here. diff --git a/ports/nrf/boards/aramcon2_badge/board.c b/ports/nrf/boards/aramcon2_badge/board.c index 6eb1789284..f8424734fb 100644 --- a/ports/nrf/boards/aramcon2_badge/board.c +++ b/ports/nrf/boards/aramcon2_badge/board.c @@ -26,18 +26,5 @@ */ #include "supervisor/board.h" -#include "common-hal/microcontroller/Pin.h" -void board_init(void) { -} - -bool board_requests_safe_mode(void) { - return false; -} - -void reset_board(void) { - -} - -void board_deinit(void) { -} +// Use the MP_WEAK supervisor/shared/board.c versions of routines not defined here. diff --git a/ports/nrf/boards/aramcon_badge_2019/board.c b/ports/nrf/boards/aramcon_badge_2019/board.c index 2ac061613a..32d1ca9483 100644 --- a/ports/nrf/boards/aramcon_badge_2019/board.c +++ b/ports/nrf/boards/aramcon_badge_2019/board.c @@ -26,18 +26,5 @@ */ #include "supervisor/board.h" -#include "common-hal/microcontroller/Pin.h" -void board_init(void) { -} - -bool board_requests_safe_mode(void) { - return false; -} - -void reset_board(void) { - -} - -void board_deinit(void) { -} +// Use the MP_WEAK supervisor/shared/board.c versions of routines not defined here. diff --git a/ports/nrf/boards/arduino_nano_33_ble/board.c b/ports/nrf/boards/arduino_nano_33_ble/board.c index 2f2c5e8388..0b6aa8f0db 100644 --- a/ports/nrf/boards/arduino_nano_33_ble/board.c +++ b/ports/nrf/boards/arduino_nano_33_ble/board.c @@ -53,14 +53,3 @@ void board_init(void) { // digitalWrite(PIN_ENABLE_SENSORS_3V3, HIGH); // digitalWrite(PIN_ENABLE_I2C_PULLUP, HIGH); } - -bool board_requests_safe_mode(void) { - return false; -} - -void reset_board(void) { - -} - -void board_deinit(void) { -} diff --git a/ports/nrf/boards/bastble/board.c b/ports/nrf/boards/bastble/board.c index bcf952c89f..fb1ce4fb83 100644 --- a/ports/nrf/boards/bastble/board.c +++ b/ports/nrf/boards/bastble/board.c @@ -25,20 +25,5 @@ */ #include "supervisor/board.h" -#include "nrf.h" -#include "nrf_rtc.h" -void board_init(void) { - -} - -bool board_requests_safe_mode(void) { - return false; -} - -void reset_board(void) { - -} - -void board_deinit(void) { -} +// Use the MP_WEAK supervisor/shared/board.c versions of routines not defined here. diff --git a/ports/nrf/boards/bless_dev_board_multi_sensor/board.c b/ports/nrf/boards/bless_dev_board_multi_sensor/board.c index 5b0bdf1e1c..fb1ce4fb83 100644 --- a/ports/nrf/boards/bless_dev_board_multi_sensor/board.c +++ b/ports/nrf/boards/bless_dev_board_multi_sensor/board.c @@ -1,15 +1,29 @@ +/* + * 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 "supervisor/board.h" -void board_init(void) { -} - -bool board_requests_safe_mode(void) { - return false; -} - -void reset_board(void) { - -} - -void board_deinit(void) { -} +// Use the MP_WEAK supervisor/shared/board.c versions of routines not defined here. diff --git a/ports/nrf/boards/bluemicro833/board.c b/ports/nrf/boards/bluemicro833/board.c index 104cea6274..c96bc6a996 100644 --- a/ports/nrf/boards/bluemicro833/board.c +++ b/ports/nrf/boards/bluemicro833/board.c @@ -56,10 +56,4 @@ void board_deinit(void) { nrf_gpio_pin_write(POWER_SWITCH_PIN->number, false); } -bool board_requests_safe_mode(void) { - return false; -} - -void reset_board(void) { - -} +// Use the MP_WEAK supervisor/shared/board.c versions of routines not defined here. diff --git a/ports/nrf/boards/bluemicro833/mpconfigboard.mk b/ports/nrf/boards/bluemicro833/mpconfigboard.mk index 6c8c7172c1..6108f23102 100644 --- a/ports/nrf/boards/bluemicro833/mpconfigboard.mk +++ b/ports/nrf/boards/bluemicro833/mpconfigboard.mk @@ -7,47 +7,10 @@ MCU_CHIP = nrf52833 INTERNAL_FLASH_FILESYSTEM = 1 -CIRCUITPY_AESIO = 0 -CIRCUITPY_ALARM = 0 CIRCUITPY_AUDIOBUSIO = 0 -#CIRCUITPY_AUDIOCORE = 0 -#CIRCUITPY_AUDIOIO = 0 CIRCUITPY_AUDIOMIXER = 0 -CIRCUITPY_AUDIOMP3 = 0 -CIRCUITPY_BINASCII = 0 -CIRCUITPY_BITBANGIO = 0 -CIRCUITPY_BITMAPTOOLS = 0 -CIRCUITPY_BUILTINS_POW3=0 -CIRCUITPY_BUSDEVICE = 0 -CIRCUITPY_COUNTIO = 0 -CIRCUITPY_DISPLAYIO = 0 -CIRCUITPY_FRAMEBUFFERIO = 0 -CIRCUITPY_FREQUENCYIO = 0 -CIRCUITPY_I2CPERIPHERAL = 0 -CIRCUITPY_JSON = 0 CIRCUITPY_KEYPAD = 1 -CIRCUITPY_MSGPACK = 0 -#CIRCUITPY_NEOPIXEL_WRITE = 1 -CIRCUITPY_ONEWIREIO = 0 CIRCUITPY_NVM = 0 +CIRCUITPY_ONEWIREIO = 0 CIRCUITPY_PIXELBUF = 1 -CIRCUITPY_PULSEIO = 1 -CIRCUITPY_RE = 0 -CIRCUITPY_RGBMATRIX = 0 -CIRCUITPY_SDCARDIO = 0 -CIRCUITPY_SYNTHIO = 0 -CIRCUITPY_TRACEBACK = 0 CIRCUITPY_TOUCHIO = 0 -CIRCUITPY_TRACEBACK = 0 -CIRCUITPY_ULAB = 0 -CIRCUITPY_USB_MIDI = 0 -CIRCUITPY_VECTORIO = 0 -CIRCUITPY_ZLIB = 0 - -MICROPY_PY_ASYNC_AWAIT = 0 - -SUPEROPT_GC = 0 -SUPEROPT_VM = 0 - -# Override optimization to keep binary small -OPTIMIZATION_FLAGS = -Os diff --git a/ports/nrf/boards/bluemicro840/board.c b/ports/nrf/boards/bluemicro840/board.c index b4070e72dc..fb1ce4fb83 100644 --- a/ports/nrf/boards/bluemicro840/board.c +++ b/ports/nrf/boards/bluemicro840/board.c @@ -26,16 +26,4 @@ #include "supervisor/board.h" -void board_init(void) { -} - -bool board_requests_safe_mode(void) { - return false; -} - -void reset_board(void) { - -} - -void board_deinit(void) { -} +// Use the MP_WEAK supervisor/shared/board.c versions of routines not defined here. diff --git a/ports/nrf/boards/challenger_840/board.c b/ports/nrf/boards/challenger_840/board.c index b4070e72dc..fb1ce4fb83 100644 --- a/ports/nrf/boards/challenger_840/board.c +++ b/ports/nrf/boards/challenger_840/board.c @@ -26,16 +26,4 @@ #include "supervisor/board.h" -void board_init(void) { -} - -bool board_requests_safe_mode(void) { - return false; -} - -void reset_board(void) { - -} - -void board_deinit(void) { -} +// Use the MP_WEAK supervisor/shared/board.c versions of routines not defined here. diff --git a/ports/nrf/boards/challenger_840/mpconfigboard.mk b/ports/nrf/boards/challenger_840/mpconfigboard.mk index 61af9ac029..ddb55ce705 100644 --- a/ports/nrf/boards/challenger_840/mpconfigboard.mk +++ b/ports/nrf/boards/challenger_840/mpconfigboard.mk @@ -6,4 +6,4 @@ USB_MANUFACTURER = "Invector Labs AB" MCU_CHIP = nrf52840 SPI_FLASH_FILESYSTEM = 1 -EXTERNAL_FLASH_DEVICES = "W25Q16JVxQ,W25Q32FV" +EXTERNAL_FLASH_DEVICES = "W25Q16JVxQ,W25Q32FV,W25Q64FV" diff --git a/ports/nrf/boards/circuitplayground_bluefruit/board.c b/ports/nrf/boards/circuitplayground_bluefruit/board.c index 938d92aff1..412b249844 100644 --- a/ports/nrf/boards/circuitplayground_bluefruit/board.c +++ b/ports/nrf/boards/circuitplayground_bluefruit/board.c @@ -54,10 +54,8 @@ void board_deinit(void) { nrf_gpio_pin_write(POWER_SWITCH_PIN->number, true); } -bool board_requests_safe_mode(void) { - return false; -} - void reset_board(void) { board_reset_user_neopixels(&pin_P0_13, 10); } + +// Use the MP_WEAK supervisor/shared/board.c versions of routines not defined here. diff --git a/ports/nrf/boards/clue_nrf52840_express/board.c b/ports/nrf/boards/clue_nrf52840_express/board.c index f2e648f473..92ea3fefeb 100644 --- a/ports/nrf/boards/clue_nrf52840_express/board.c +++ b/ports/nrf/boards/clue_nrf52840_express/board.c @@ -84,22 +84,12 @@ void board_init(void) { sizeof(display_init_sequence), &pin_P1_05, // backlight pin NO_BRIGHTNESS_COMMAND, - 1.0f, // brightness (ignored) - true, // auto_brightness + 1.0f, // brightness false, // single_byte_bounds false, // data_as_commands true, // auto_refresh 60, // native_frames_per_second true, // backlight_on_high - false); // not SH1107 -} - -bool board_requests_safe_mode(void) { - return false; -} - -void reset_board(void) { -} - -void board_deinit(void) { + false, // not SH1107 + 50000); // backlight pwm frequency } diff --git a/ports/nrf/boards/electronut_labs_blip/board.c b/ports/nrf/boards/electronut_labs_blip/board.c index b4070e72dc..fb1ce4fb83 100644 --- a/ports/nrf/boards/electronut_labs_blip/board.c +++ b/ports/nrf/boards/electronut_labs_blip/board.c @@ -26,16 +26,4 @@ #include "supervisor/board.h" -void board_init(void) { -} - -bool board_requests_safe_mode(void) { - return false; -} - -void reset_board(void) { - -} - -void board_deinit(void) { -} +// Use the MP_WEAK supervisor/shared/board.c versions of routines not defined here. diff --git a/ports/nrf/boards/electronut_labs_blip/mpconfigboard.mk b/ports/nrf/boards/electronut_labs_blip/mpconfigboard.mk index 2b46f4397a..0e3b1b9048 100644 --- a/ports/nrf/boards/electronut_labs_blip/mpconfigboard.mk +++ b/ports/nrf/boards/electronut_labs_blip/mpconfigboard.mk @@ -5,6 +5,8 @@ USB_MANUFACTURER = "Electronut Labs" MCU_CHIP = nrf52840 +CIRCUITPY_BUILD_EXTENSIONS = hex + INTERNAL_FLASH_FILESYSTEM = 1 CIRCUITPY_AUDIOIO = 0 CIRCUITPY_DISPLAYIO = 1 diff --git a/ports/nrf/boards/electronut_labs_papyr/board.c b/ports/nrf/boards/electronut_labs_papyr/board.c index b4070e72dc..fb1ce4fb83 100644 --- a/ports/nrf/boards/electronut_labs_papyr/board.c +++ b/ports/nrf/boards/electronut_labs_papyr/board.c @@ -26,16 +26,4 @@ #include "supervisor/board.h" -void board_init(void) { -} - -bool board_requests_safe_mode(void) { - return false; -} - -void reset_board(void) { - -} - -void board_deinit(void) { -} +// Use the MP_WEAK supervisor/shared/board.c versions of routines not defined here. diff --git a/ports/nrf/boards/feather_bluefruit_sense/board.c b/ports/nrf/boards/feather_bluefruit_sense/board.c index b4070e72dc..fb1ce4fb83 100644 --- a/ports/nrf/boards/feather_bluefruit_sense/board.c +++ b/ports/nrf/boards/feather_bluefruit_sense/board.c @@ -26,16 +26,4 @@ #include "supervisor/board.h" -void board_init(void) { -} - -bool board_requests_safe_mode(void) { - return false; -} - -void reset_board(void) { - -} - -void board_deinit(void) { -} +// Use the MP_WEAK supervisor/shared/board.c versions of routines not defined here. diff --git a/ports/nrf/boards/feather_nrf52840_express/board.c b/ports/nrf/boards/feather_nrf52840_express/board.c index b4070e72dc..fb1ce4fb83 100644 --- a/ports/nrf/boards/feather_nrf52840_express/board.c +++ b/ports/nrf/boards/feather_nrf52840_express/board.c @@ -26,16 +26,4 @@ #include "supervisor/board.h" -void board_init(void) { -} - -bool board_requests_safe_mode(void) { - return false; -} - -void reset_board(void) { - -} - -void board_deinit(void) { -} +// Use the MP_WEAK supervisor/shared/board.c versions of routines not defined here. diff --git a/ports/nrf/boards/hiibot_bluefi/board.c b/ports/nrf/boards/hiibot_bluefi/board.c index 9616596caa..e5fc4279f8 100644 --- a/ports/nrf/boards/hiibot_bluefi/board.c +++ b/ports/nrf/boards/hiibot_bluefi/board.c @@ -85,22 +85,12 @@ void board_init(void) { sizeof(display_init_sequence), &pin_P1_13, // backlight pin NO_BRIGHTNESS_COMMAND, - 1.0f, // brightness (ignored) - true, // auto_brightness + 1.0f, // brightness false, // single_byte_bounds false, // data_as_commands true, // auto_refresh 60, // native_frames_per_second true, // backlight_on_high - false); // SH1107_addressing -} - -bool board_requests_safe_mode(void) { - return false; -} - -void reset_board(void) { -} - -void board_deinit(void) { + false, // SH1107_addressing + 50000); // backlight pwm frequency } diff --git a/ports/nrf/boards/ikigaisense_vita/board.c b/ports/nrf/boards/ikigaisense_vita/board.c index b4070e72dc..fb1ce4fb83 100644 --- a/ports/nrf/boards/ikigaisense_vita/board.c +++ b/ports/nrf/boards/ikigaisense_vita/board.c @@ -26,16 +26,4 @@ #include "supervisor/board.h" -void board_init(void) { -} - -bool board_requests_safe_mode(void) { - return false; -} - -void reset_board(void) { - -} - -void board_deinit(void) { -} +// Use the MP_WEAK supervisor/shared/board.c versions of routines not defined here. diff --git a/ports/nrf/boards/itsybitsy_nrf52840_express/board.c b/ports/nrf/boards/itsybitsy_nrf52840_express/board.c index b4070e72dc..fb1ce4fb83 100644 --- a/ports/nrf/boards/itsybitsy_nrf52840_express/board.c +++ b/ports/nrf/boards/itsybitsy_nrf52840_express/board.c @@ -26,16 +26,4 @@ #include "supervisor/board.h" -void board_init(void) { -} - -bool board_requests_safe_mode(void) { - return false; -} - -void reset_board(void) { - -} - -void board_deinit(void) { -} +// Use the MP_WEAK supervisor/shared/board.c versions of routines not defined here. diff --git a/ports/nrf/boards/makerdiary_m60_keyboard/board.c b/ports/nrf/boards/makerdiary_m60_keyboard/board.c index b4070e72dc..8074c895dc 100644 --- a/ports/nrf/boards/makerdiary_m60_keyboard/board.c +++ b/ports/nrf/boards/makerdiary_m60_keyboard/board.c @@ -26,16 +26,5 @@ #include "supervisor/board.h" -void board_init(void) { -} -bool board_requests_safe_mode(void) { - return false; -} - -void reset_board(void) { - -} - -void board_deinit(void) { -} +// Use the MP_WEAK supervisor/shared/board.c versions of routines not defined here. diff --git a/ports/nrf/boards/makerdiary_nrf52840_m2_devkit/board.c b/ports/nrf/boards/makerdiary_nrf52840_m2_devkit/board.c index 87c9b2f226..ce4241c9da 100644 --- a/ports/nrf/boards/makerdiary_nrf52840_m2_devkit/board.c +++ b/ports/nrf/boards/makerdiary_nrf52840_m2_devkit/board.c @@ -85,22 +85,12 @@ void board_init(void) { sizeof(display_init_sequence), &pin_P0_20, // backlight pin NO_BRIGHTNESS_COMMAND, - 1.0f, // brightness (ignored) - true, // auto_brightness + 1.0f, // brightness false, // single_byte_bounds false, // data_as_commands true, // auto_refresh 60, // native_frames_per_second true, // backlight_on_high - false); // SH1107_addressing -} - -bool board_requests_safe_mode(void) { - return false; -} - -void reset_board(void) { -} - -void board_deinit(void) { + false, // SH1107_addressing + 50000); // backlight pwm frequency } diff --git a/ports/nrf/boards/makerdiary_nrf52840_mdk/board.c b/ports/nrf/boards/makerdiary_nrf52840_mdk/board.c index b4070e72dc..fb1ce4fb83 100644 --- a/ports/nrf/boards/makerdiary_nrf52840_mdk/board.c +++ b/ports/nrf/boards/makerdiary_nrf52840_mdk/board.c @@ -26,16 +26,4 @@ #include "supervisor/board.h" -void board_init(void) { -} - -bool board_requests_safe_mode(void) { - return false; -} - -void reset_board(void) { - -} - -void board_deinit(void) { -} +// Use the MP_WEAK supervisor/shared/board.c versions of routines not defined here. diff --git a/ports/nrf/boards/makerdiary_nrf52840_mdk/mpconfigboard.mk b/ports/nrf/boards/makerdiary_nrf52840_mdk/mpconfigboard.mk index 7da9ed1896..887bf0a7da 100644 --- a/ports/nrf/boards/makerdiary_nrf52840_mdk/mpconfigboard.mk +++ b/ports/nrf/boards/makerdiary_nrf52840_mdk/mpconfigboard.mk @@ -5,5 +5,7 @@ USB_MANUFACTURER = "makerdiary" MCU_CHIP = nrf52840 +CIRCUITPY_BUILD_EXTENSIONS = hex + QSPI_FLASH_FILESYSTEM = 1 EXTERNAL_FLASH_DEVICES = "MX25R6435F" diff --git a/ports/nrf/boards/makerdiary_nrf52840_mdk_usb_dongle/board.c b/ports/nrf/boards/makerdiary_nrf52840_mdk_usb_dongle/board.c index b4070e72dc..fb1ce4fb83 100644 --- a/ports/nrf/boards/makerdiary_nrf52840_mdk_usb_dongle/board.c +++ b/ports/nrf/boards/makerdiary_nrf52840_mdk_usb_dongle/board.c @@ -26,16 +26,4 @@ #include "supervisor/board.h" -void board_init(void) { -} - -bool board_requests_safe_mode(void) { - return false; -} - -void reset_board(void) { - -} - -void board_deinit(void) { -} +// Use the MP_WEAK supervisor/shared/board.c versions of routines not defined here. diff --git a/ports/nrf/boards/makerdiary_nrf52840_mdk_usb_dongle/mpconfigboard.mk b/ports/nrf/boards/makerdiary_nrf52840_mdk_usb_dongle/mpconfigboard.mk index c4fa121744..1a650d5d4d 100644 --- a/ports/nrf/boards/makerdiary_nrf52840_mdk_usb_dongle/mpconfigboard.mk +++ b/ports/nrf/boards/makerdiary_nrf52840_mdk_usb_dongle/mpconfigboard.mk @@ -5,4 +5,6 @@ USB_MANUFACTURER = "makerdiary" MCU_CHIP = nrf52840 +CIRCUITPY_BUILD_EXTENSIONS = hex,uf2 + INTERNAL_FLASH_FILESYSTEM = 1 diff --git a/ports/nrf/boards/metro_nrf52840_express/board.c b/ports/nrf/boards/metro_nrf52840_express/board.c index b4070e72dc..fb1ce4fb83 100644 --- a/ports/nrf/boards/metro_nrf52840_express/board.c +++ b/ports/nrf/boards/metro_nrf52840_express/board.c @@ -26,16 +26,4 @@ #include "supervisor/board.h" -void board_init(void) { -} - -bool board_requests_safe_mode(void) { - return false; -} - -void reset_board(void) { - -} - -void board_deinit(void) { -} +// Use the MP_WEAK supervisor/shared/board.c versions of routines not defined here. diff --git a/ports/nrf/boards/microbit_v2/board.c b/ports/nrf/boards/microbit_v2/board.c index b87b342823..331653173e 100644 --- a/ports/nrf/boards/microbit_v2/board.c +++ b/ports/nrf/boards/microbit_v2/board.c @@ -26,16 +26,4 @@ #include "supervisor/board.h" -void board_init(void) { -} - -bool board_requests_safe_mode(void) { - return false; -} - -void reset_board(void) { - -} - -void board_deinit(void) { -} +// Use the MP_WEAK supervisor/shared/board.c versions of routines not defined here. diff --git a/ports/nrf/boards/microbit_v2/mpconfigboard.h b/ports/nrf/boards/microbit_v2/mpconfigboard.h index bae49dfae2..eba5af6c22 100644 --- a/ports/nrf/boards/microbit_v2/mpconfigboard.h +++ b/ports/nrf/boards/microbit_v2/mpconfigboard.h @@ -52,5 +52,6 @@ #define BOOTLOADER_SETTING_SIZE (0) #define BOARD_HAS_32KHZ_XTAL (0) -#define CIRCUITPY_DEBUG_UART_TX (&pin_P0_06) -#define CIRCUITPY_DEBUG_UART_RX (&pin_P1_08) + +#define CIRCUITPY_CONSOLE_UART_TX (&pin_P0_06) +#define CIRCUITPY_CONSOLE_UART_RX (&pin_P1_08) diff --git a/ports/nrf/boards/microbit_v2/mpconfigboard.mk b/ports/nrf/boards/microbit_v2/mpconfigboard.mk index dc47f2be4e..d0430ea403 100644 --- a/ports/nrf/boards/microbit_v2/mpconfigboard.mk +++ b/ports/nrf/boards/microbit_v2/mpconfigboard.mk @@ -3,33 +3,9 @@ CIRCUITPY_CREATION_ID = 0x80D8 MCU_CHIP = nrf52833 +CIRCUITPY_BUILD_EXTENSIONS = combined.hex + INTERNAL_FLASH_FILESYSTEM = 1 -CIRCUITPY_ALARM = 0 -CIRCUITPY_AUDIOMP3 = 0 -CIRCUITPY_BITBANGIO = 0 -CIRCUITPY_BUILTINS_POW3=0 -CIRCUITPY_BUSDEVICE = 0 -CIRCUITPY_COUNTIO = 0 -CIRCUITPY_DISPLAYIO = 0 -CIRCUITPY_FRAMEBUFFERIO = 0 -CIRCUITPY_FREQUENCYIO = 0 -CIRCUITPY_I2CPERIPHERAL = 0 -CIRCUITPY_JSON = 0 -CIRCUITPY_KEYPAD = 0 -CIRCUITPY_MSGPACK = 0 -CIRCUITPY_NEOPIXEL_WRITE = 0 -CIRCUITPY_NVM = 0 -CIRCUITPY_PIXELBUF = 0 -CIRCUITPY_RE = 0 -CIRCUITPY_RGBMATRIX = 0 -CIRCUITPY_SDCARDIO = 0 -CIRCUITPY_ULAB = 0 +# USB pins aren't used. CIRCUITPY_USB = 0 - -MICROPY_PY_ASYNC_AWAIT = 0 - -# Override optimization to keep binary small -OPTIMIZATION_FLAGS = -Os -SUPEROPT_VM = 0 -SUPEROPT_GC = 0 diff --git a/ports/nrf/boards/nice_nano/board.c b/ports/nrf/boards/nice_nano/board.c index b4070e72dc..fb1ce4fb83 100644 --- a/ports/nrf/boards/nice_nano/board.c +++ b/ports/nrf/boards/nice_nano/board.c @@ -26,16 +26,4 @@ #include "supervisor/board.h" -void board_init(void) { -} - -bool board_requests_safe_mode(void) { - return false; -} - -void reset_board(void) { - -} - -void board_deinit(void) { -} +// Use the MP_WEAK supervisor/shared/board.c versions of routines not defined here. diff --git a/ports/nrf/boards/ohs2020_badge/board.c b/ports/nrf/boards/ohs2020_badge/board.c index dd0a9b2547..30c066d91e 100644 --- a/ports/nrf/boards/ohs2020_badge/board.c +++ b/ports/nrf/boards/ohs2020_badge/board.c @@ -84,22 +84,12 @@ void board_init(void) { sizeof(display_init_sequence), &pin_P0_02, // backlight pin NO_BRIGHTNESS_COMMAND, - 1.0f, // brightness (ignored) - true, // auto_brightness + 1.0f, // brightness false, // single_byte_bounds false, // data_as_commands true, // auto_refresh 60, // native_frames_per_second false, // backlight_on_high - false); // SH1107_addressing -} - -bool board_requests_safe_mode(void) { - return false; -} - -void reset_board(void) { -} - -void board_deinit(void) { + false, // SH1107_addressing + 50000); // backlight pwm frequency } diff --git a/ports/nrf/boards/particle_argon/board.c b/ports/nrf/boards/particle_argon/board.c index 0aee79f590..7180deb278 100644 --- a/ports/nrf/boards/particle_argon/board.c +++ b/ports/nrf/boards/particle_argon/board.c @@ -26,16 +26,4 @@ #include "supervisor/board.h" -void board_init(void) { -} - -bool board_requests_safe_mode(void) { - return false; -} - -void reset_board(void) { - -} - -void board_deinit(void) { -} +// Use the MP_WEAK supervisor/shared/board.c versions of routines not defined here. diff --git a/ports/nrf/boards/particle_boron/board.c b/ports/nrf/boards/particle_boron/board.c index 0aee79f590..7180deb278 100644 --- a/ports/nrf/boards/particle_boron/board.c +++ b/ports/nrf/boards/particle_boron/board.c @@ -26,16 +26,4 @@ #include "supervisor/board.h" -void board_init(void) { -} - -bool board_requests_safe_mode(void) { - return false; -} - -void reset_board(void) { - -} - -void board_deinit(void) { -} +// Use the MP_WEAK supervisor/shared/board.c versions of routines not defined here. diff --git a/ports/nrf/boards/particle_xenon/board.c b/ports/nrf/boards/particle_xenon/board.c index 0aee79f590..7180deb278 100644 --- a/ports/nrf/boards/particle_xenon/board.c +++ b/ports/nrf/boards/particle_xenon/board.c @@ -26,16 +26,4 @@ #include "supervisor/board.h" -void board_init(void) { -} - -bool board_requests_safe_mode(void) { - return false; -} - -void reset_board(void) { - -} - -void board_deinit(void) { -} +// Use the MP_WEAK supervisor/shared/board.c versions of routines not defined here. diff --git a/ports/nrf/boards/pca10056/board.c b/ports/nrf/boards/pca10056/board.c index b4070e72dc..fb1ce4fb83 100644 --- a/ports/nrf/boards/pca10056/board.c +++ b/ports/nrf/boards/pca10056/board.c @@ -26,16 +26,4 @@ #include "supervisor/board.h" -void board_init(void) { -} - -bool board_requests_safe_mode(void) { - return false; -} - -void reset_board(void) { - -} - -void board_deinit(void) { -} +// Use the MP_WEAK supervisor/shared/board.c versions of routines not defined here. diff --git a/ports/nrf/boards/pca10056/mpconfigboard.mk b/ports/nrf/boards/pca10056/mpconfigboard.mk index 48f68a30ae..b30e6ee7a2 100644 --- a/ports/nrf/boards/pca10056/mpconfigboard.mk +++ b/ports/nrf/boards/pca10056/mpconfigboard.mk @@ -5,5 +5,7 @@ USB_MANUFACTURER = "Nordic Semiconductor" MCU_CHIP = nrf52840 +CIRCUITPY_BUILD_EXTENSIONS = bin,uf2 + QSPI_FLASH_FILESYSTEM = 1 EXTERNAL_FLASH_DEVICES = "MX25R6435F" diff --git a/ports/nrf/boards/pca10059/board.c b/ports/nrf/boards/pca10059/board.c index b4070e72dc..fb1ce4fb83 100644 --- a/ports/nrf/boards/pca10059/board.c +++ b/ports/nrf/boards/pca10059/board.c @@ -26,16 +26,4 @@ #include "supervisor/board.h" -void board_init(void) { -} - -bool board_requests_safe_mode(void) { - return false; -} - -void reset_board(void) { - -} - -void board_deinit(void) { -} +// Use the MP_WEAK supervisor/shared/board.c versions of routines not defined here. diff --git a/ports/nrf/boards/pca10059/mpconfigboard.mk b/ports/nrf/boards/pca10059/mpconfigboard.mk index 9dc3cc71ed..fe702a50c9 100644 --- a/ports/nrf/boards/pca10059/mpconfigboard.mk +++ b/ports/nrf/boards/pca10059/mpconfigboard.mk @@ -5,4 +5,6 @@ USB_MANUFACTURER = "Nordic Semiconductor" MCU_CHIP = nrf52840 +CIRCUITPY_BUILD_EXTENSIONS = bin,uf2 + INTERNAL_FLASH_FILESYSTEM = 1 diff --git a/ports/nrf/boards/pca10100/board.c b/ports/nrf/boards/pca10100/board.c index 0aee79f590..7180deb278 100644 --- a/ports/nrf/boards/pca10100/board.c +++ b/ports/nrf/boards/pca10100/board.c @@ -26,16 +26,4 @@ #include "supervisor/board.h" -void board_init(void) { -} - -bool board_requests_safe_mode(void) { - return false; -} - -void reset_board(void) { - -} - -void board_deinit(void) { -} +// Use the MP_WEAK supervisor/shared/board.c versions of routines not defined here. diff --git a/ports/nrf/boards/pca10100/mpconfigboard.mk b/ports/nrf/boards/pca10100/mpconfigboard.mk index 95a2dd4d98..356eb16f11 100644 --- a/ports/nrf/boards/pca10100/mpconfigboard.mk +++ b/ports/nrf/boards/pca10100/mpconfigboard.mk @@ -6,38 +6,3 @@ USB_MANUFACTURER = "Nordic Semiconductor" MCU_CHIP = nrf52833 INTERNAL_FLASH_FILESYSTEM = 1 - -CIRCUITPY_AESIO = 0 -CIRCUITPY_ALARM = 0 -CIRCUITPY_AUDIOMP3 = 0 -CIRCUITPY_BINASCII = 0 -CIRCUITPY_BITBANGIO = 0 -CIRCUITPY_BITMAPTOOLS = 0 -CIRCUITPY_BUSDEVICE = 0 -CIRCUITPY_COUNTIO = 0 -CIRCUITPY_DISPLAYIO = 0 -CIRCUITPY_FRAMEBUFFERIO = 0 -CIRCUITPY_FREQUENCYIO = 0 -CIRCUITPY_I2CPERIPHERAL = 0 -CIRCUITPY_JSON = 0 -CIRCUITPY_KEYPAD = 0 -CIRCUITPY_MSGPACK = 0 -CIRCUITPY_NEOPIXEL_WRITE = 0 -CIRCUITPY_NVM = 0 -CIRCUITPY_PIXELBUF = 0 -CIRCUITPY_RE = 0 -CIRCUITPY_RGBMATRIX = 0 -CIRCUITPY_SDCARDIO = 0 -CIRCUITPY_SYNTHIO = 0 -CIRCUITPY_ULAB = 0 -CIRCUITPY_USB_MIDI = 0 -CIRCUITPY_VECTORIO = 0 -CIRCUITPY_ZLIB = 0 - -MICROPY_PY_ASYNC_AWAIT = 0 - -SUPEROPT_GC = 0 -SUPEROPT_VM = 0 - -# Override optimization to keep binary small -OPTIMIZATION_FLAGS = -Os diff --git a/ports/nrf/boards/pitaya_go/board.c b/ports/nrf/boards/pitaya_go/board.c index b4070e72dc..fb1ce4fb83 100644 --- a/ports/nrf/boards/pitaya_go/board.c +++ b/ports/nrf/boards/pitaya_go/board.c @@ -26,16 +26,4 @@ #include "supervisor/board.h" -void board_init(void) { -} - -bool board_requests_safe_mode(void) { - return false; -} - -void reset_board(void) { - -} - -void board_deinit(void) { -} +// Use the MP_WEAK supervisor/shared/board.c versions of routines not defined here. diff --git a/ports/nrf/boards/raytac_mdbt50q-db-40/board.c b/ports/nrf/boards/raytac_mdbt50q-db-40/board.c index b4070e72dc..fb1ce4fb83 100644 --- a/ports/nrf/boards/raytac_mdbt50q-db-40/board.c +++ b/ports/nrf/boards/raytac_mdbt50q-db-40/board.c @@ -26,16 +26,4 @@ #include "supervisor/board.h" -void board_init(void) { -} - -bool board_requests_safe_mode(void) { - return false; -} - -void reset_board(void) { - -} - -void board_deinit(void) { -} +// Use the MP_WEAK supervisor/shared/board.c versions of routines not defined here. diff --git a/ports/nrf/boards/raytac_mdbt50q-rx/board.c b/ports/nrf/boards/raytac_mdbt50q-rx/board.c index b4070e72dc..fb1ce4fb83 100644 --- a/ports/nrf/boards/raytac_mdbt50q-rx/board.c +++ b/ports/nrf/boards/raytac_mdbt50q-rx/board.c @@ -26,16 +26,4 @@ #include "supervisor/board.h" -void board_init(void) { -} - -bool board_requests_safe_mode(void) { - return false; -} - -void reset_board(void) { - -} - -void board_deinit(void) { -} +// Use the MP_WEAK supervisor/shared/board.c versions of routines not defined here. diff --git a/ports/nrf/boards/simmel/board.c b/ports/nrf/boards/simmel/board.c index 0aee79f590..7180deb278 100644 --- a/ports/nrf/boards/simmel/board.c +++ b/ports/nrf/boards/simmel/board.c @@ -26,16 +26,4 @@ #include "supervisor/board.h" -void board_init(void) { -} - -bool board_requests_safe_mode(void) { - return false; -} - -void reset_board(void) { - -} - -void board_deinit(void) { -} +// Use the MP_WEAK supervisor/shared/board.c versions of routines not defined here. diff --git a/ports/nrf/boards/simmel/mpconfigboard.mk b/ports/nrf/boards/simmel/mpconfigboard.mk index bdafadceb7..20a50ac700 100644 --- a/ports/nrf/boards/simmel/mpconfigboard.mk +++ b/ports/nrf/boards/simmel/mpconfigboard.mk @@ -13,41 +13,18 @@ INTERNAL_FLASH_FILESYSTEM = 1 CIRCUITPY_ALARM = 0 CIRCUITPY_AESIO = 1 CIRCUITPY_AUDIOMIXER = 0 -CIRCUITPY_AUDIOMP3 = 0 -CIRCUITPY_BITMAPTOOLS = 0 -CIRCUITPY_BUSDEVICE = 0 -CIRCUITPY_BUSIO = 1 -CIRCUITPY_COUNTIO = 0 -CIRCUITPY_DISPLAYIO = 0 -CIRCUITPY_ERRNO = 0 -CIRCUITPY_FRAMEBUFFERIO = 0 -CIRCUITPY_GETPASS = 0 -CIRCUITPY_KEYPAD = 0 -CIRCUITPY_MSGPACK = 0 CIRCUITPY_NEOPIXEL_WRITE = 0 CIRCUITPY_NVM = 0 CIRCUITPY_ONEWIREIO = 0 -CIRCUITPY_PIXELBUF = 0 CIRCUITPY_PULSEIO = 0 CIRCUITPY_PWMIO = 1 # Deliberately excluded for other reasons than code space, see #5534 CIRCUITPY_RAINBOWIO = 0 -CIRCUITPY_RGBMATRIX = 0 CIRCUITPY_ROTARYIO = 0 -CIRCUITPY_RTC = 1 -CIRCUITPY_SDCARDIO = 0 -CIRCUITPY_SYNTHIO = 0 CIRCUITPY_TOUCHIO = 0 -CIRCUITPY_ULAB = 0 CIRCUITPY_USB_CDC = 0 CIRCUITPY_USB_MIDI = 0 CIRCUITPY_WATCHDOG = 1 -CIRCUITPY_ZLIB = 0 # Enable micropython.native #CIRCUITPY_ENABLE_MPY_NATIVE = 1 - -# Override optimization to keep binary small -OPTIMIZATION_FLAGS = -Os -SUPEROPT_VM = 0 -SUPEROPT_GC = 0 diff --git a/ports/nrf/boards/sparkfun_nrf52840_micromod/board.c b/ports/nrf/boards/sparkfun_nrf52840_micromod/board.c index b4070e72dc..fb1ce4fb83 100644 --- a/ports/nrf/boards/sparkfun_nrf52840_micromod/board.c +++ b/ports/nrf/boards/sparkfun_nrf52840_micromod/board.c @@ -26,16 +26,4 @@ #include "supervisor/board.h" -void board_init(void) { -} - -bool board_requests_safe_mode(void) { - return false; -} - -void reset_board(void) { - -} - -void board_deinit(void) { -} +// Use the MP_WEAK supervisor/shared/board.c versions of routines not defined here. diff --git a/ports/nrf/boards/sparkfun_nrf52840_mini/board.c b/ports/nrf/boards/sparkfun_nrf52840_mini/board.c index b4070e72dc..fb1ce4fb83 100644 --- a/ports/nrf/boards/sparkfun_nrf52840_mini/board.c +++ b/ports/nrf/boards/sparkfun_nrf52840_mini/board.c @@ -26,16 +26,4 @@ #include "supervisor/board.h" -void board_init(void) { -} - -bool board_requests_safe_mode(void) { - return false; -} - -void reset_board(void) { - -} - -void board_deinit(void) { -} +// Use the MP_WEAK supervisor/shared/board.c versions of routines not defined here. diff --git a/ports/nrf/boards/ssci_isp1807_dev_board/board.c b/ports/nrf/boards/ssci_isp1807_dev_board/board.c index 8d8e531d47..c8bd7e0b35 100644 --- a/ports/nrf/boards/ssci_isp1807_dev_board/board.c +++ b/ports/nrf/boards/ssci_isp1807_dev_board/board.c @@ -28,16 +28,4 @@ #include "nrf.h" #include "nrf_rtc.h" -void board_init(void) { -} - -bool board_requests_safe_mode(void) { - return false; -} - -void reset_board(void) { - -} - -void board_deinit(void) { -} +// Use the MP_WEAK supervisor/shared/board.c versions of routines not defined here. diff --git a/ports/nrf/boards/ssci_isp1807_micro_board/board.c b/ports/nrf/boards/ssci_isp1807_micro_board/board.c index 8d8e531d47..c8bd7e0b35 100644 --- a/ports/nrf/boards/ssci_isp1807_micro_board/board.c +++ b/ports/nrf/boards/ssci_isp1807_micro_board/board.c @@ -28,16 +28,4 @@ #include "nrf.h" #include "nrf_rtc.h" -void board_init(void) { -} - -bool board_requests_safe_mode(void) { - return false; -} - -void reset_board(void) { - -} - -void board_deinit(void) { -} +// Use the MP_WEAK supervisor/shared/board.c versions of routines not defined here. diff --git a/ports/nrf/boards/teknikio_bluebird/board.c b/ports/nrf/boards/teknikio_bluebird/board.c index b4070e72dc..fb1ce4fb83 100644 --- a/ports/nrf/boards/teknikio_bluebird/board.c +++ b/ports/nrf/boards/teknikio_bluebird/board.c @@ -26,16 +26,4 @@ #include "supervisor/board.h" -void board_init(void) { -} - -bool board_requests_safe_mode(void) { - return false; -} - -void reset_board(void) { - -} - -void board_deinit(void) { -} +// Use the MP_WEAK supervisor/shared/board.c versions of routines not defined here. diff --git a/ports/nrf/boards/tinkeringtech_scoutmakes_azul/board.c b/ports/nrf/boards/tinkeringtech_scoutmakes_azul/board.c index b4070e72dc..fb1ce4fb83 100644 --- a/ports/nrf/boards/tinkeringtech_scoutmakes_azul/board.c +++ b/ports/nrf/boards/tinkeringtech_scoutmakes_azul/board.c @@ -26,16 +26,4 @@ #include "supervisor/board.h" -void board_init(void) { -} - -bool board_requests_safe_mode(void) { - return false; -} - -void reset_board(void) { - -} - -void board_deinit(void) { -} +// Use the MP_WEAK supervisor/shared/board.c versions of routines not defined here. diff --git a/ports/nrf/boards/warmbit_bluepixel/board.c b/ports/nrf/boards/warmbit_bluepixel/board.c index b4070e72dc..fb1ce4fb83 100644 --- a/ports/nrf/boards/warmbit_bluepixel/board.c +++ b/ports/nrf/boards/warmbit_bluepixel/board.c @@ -26,16 +26,4 @@ #include "supervisor/board.h" -void board_init(void) { -} - -bool board_requests_safe_mode(void) { - return false; -} - -void reset_board(void) { - -} - -void board_deinit(void) { -} +// Use the MP_WEAK supervisor/shared/board.c versions of routines not defined here. diff --git a/ports/nrf/common-hal/_bleio/Adapter.c b/ports/nrf/common-hal/_bleio/Adapter.c index 288cf2f217..49b5d638f3 100644 --- a/ports/nrf/common-hal/_bleio/Adapter.c +++ b/ports/nrf/common-hal/_bleio/Adapter.c @@ -52,6 +52,10 @@ #include "shared-bindings/_bleio/ScanEntry.h" #include "shared-bindings/time/__init__.h" +#if CIRCUITPY_DOTENV +#include "shared-module/dotenv/__init__.h" +#endif + #define BLE_MIN_CONN_INTERVAL MSEC_TO_UNITS(15, UNIT_0_625_MS) #define BLE_MAX_CONN_INTERVAL MSEC_TO_UNITS(15, UNIT_0_625_MS) #define BLE_SLAVE_LATENCY 0 @@ -329,18 +333,30 @@ STATIC void get_address(bleio_adapter_obj_t *self, ble_gap_addr_t *address) { char default_ble_name[] = { 'C', 'I', 'R', 'C', 'U', 'I', 'T', 'P', 'Y', 0, 0, 0, 0, 0}; STATIC void bleio_adapter_reset_name(bleio_adapter_obj_t *self) { - uint8_t len = sizeof(default_ble_name) - 1; - - ble_gap_addr_t local_address; - get_address(self, &local_address); - - default_ble_name[len - 4] = nibble_to_hex_lower[local_address.addr[1] >> 4 & 0xf]; - default_ble_name[len - 3] = nibble_to_hex_lower[local_address.addr[1] & 0xf]; - default_ble_name[len - 2] = nibble_to_hex_lower[local_address.addr[0] >> 4 & 0xf]; - default_ble_name[len - 1] = nibble_to_hex_lower[local_address.addr[0] & 0xf]; + // setup the default name + ble_gap_addr_t addr; // local_address + get_address(self, &addr); + mp_int_t len = sizeof(default_ble_name) - 1; + default_ble_name[len - 4] = nibble_to_hex_lower[addr.addr[1] >> 4 & 0xf]; + default_ble_name[len - 3] = nibble_to_hex_lower[addr.addr[1] & 0xf]; + default_ble_name[len - 2] = nibble_to_hex_lower[addr.addr[0] >> 4 & 0xf]; + default_ble_name[len - 1] = nibble_to_hex_lower[addr.addr[0] & 0xf]; default_ble_name[len] = '\0'; // for now we add null for compatibility with C ASCIIZ strings - common_hal_bleio_adapter_set_name(self, (char *)default_ble_name); + mp_int_t name_len = 0; + + #if CIRCUITPY_DOTENV + char ble_name[32]; + name_len = dotenv_get_key("/.env", "CIRCUITPY_BLE_NAME", ble_name, sizeof(ble_name) - 1); + if (name_len > 0) { + ble_name[name_len] = '\0'; + common_hal_bleio_adapter_set_name(self, (char *)ble_name); + } + #endif + + if (name_len <= 0) { + common_hal_bleio_adapter_set_name(self, (char *)default_ble_name); + } } static void bluetooth_adapter_background(void *data) { @@ -433,22 +449,34 @@ bool common_hal_bleio_adapter_set_address(bleio_adapter_obj_t *self, bleio_addre return sd_ble_gap_addr_set(&local_address) == NRF_SUCCESS; } +uint16_t bleio_adapter_get_name(char *buf, uint16_t len) { + uint16_t full_len = 0; + sd_ble_gap_device_name_get(NULL, &full_len); + + uint32_t err_code = sd_ble_gap_device_name_get((uint8_t *)buf, &len); + if (err_code != NRF_SUCCESS) { + return 0; + } + return full_len; +} + mp_obj_str_t *common_hal_bleio_adapter_get_name(bleio_adapter_obj_t *self) { uint16_t len = 0; sd_ble_gap_device_name_get(NULL, &len); - uint8_t buf[len]; - uint32_t err_code = sd_ble_gap_device_name_get(buf, &len); - if (err_code != NRF_SUCCESS) { - return NULL; - } - return mp_obj_new_str((char *)buf, len); + char buf[len]; + bleio_adapter_get_name(buf, len); + return mp_obj_new_str(buf, len); } void common_hal_bleio_adapter_set_name(bleio_adapter_obj_t *self, const char *name) { ble_gap_conn_sec_mode_t sec; sec.lv = 0; sec.sm = 0; - sd_ble_gap_device_name_set(&sec, (const uint8_t *)name, strlen(name)); + uint16_t len = strlen(name); + if (len > BLE_GAP_DEVNAME_MAX_LEN) { + len = BLE_GAP_DEVNAME_MAX_LEN; + } + sd_ble_gap_device_name_set(&sec, (const uint8_t *)name, len); } STATIC uint32_t _update_identities(bool is_central) { diff --git a/ports/nrf/common-hal/_bleio/CharacteristicBuffer.c b/ports/nrf/common-hal/_bleio/CharacteristicBuffer.c index 5772616ee5..d13ffa1a94 100644 --- a/ports/nrf/common-hal/_bleio/CharacteristicBuffer.c +++ b/ports/nrf/common-hal/_bleio/CharacteristicBuffer.c @@ -90,10 +90,7 @@ void _common_hal_bleio_characteristic_buffer_construct(bleio_characteristic_buff self->characteristic = characteristic; self->timeout_ms = timeout * 1000; - self->ringbuf.buf = (uint8_t *)buffer; - self->ringbuf.size = buffer_size; - self->ringbuf.iget = 0; - self->ringbuf.iput = 0; + ringbuf_init(&self->ringbuf, buffer, buffer_size); if (static_handler_entry != NULL) { ble_drv_add_event_handler_entry((ble_drv_evt_handler_entry_t *)static_handler_entry, characteristic_buffer_on_ble_evt, self); @@ -159,6 +156,7 @@ void common_hal_bleio_characteristic_buffer_deinit(bleio_characteristic_buffer_o if (!common_hal_bleio_characteristic_buffer_deinited(self)) { ble_drv_remove_event_handler(characteristic_buffer_on_ble_evt, self); self->characteristic = NULL; + ringbuf_deinit(&self->ringbuf); } } diff --git a/ports/nrf/common-hal/_bleio/PacketBuffer.c b/ports/nrf/common-hal/_bleio/PacketBuffer.c index 38dcdd9041..52402a93f1 100644 --- a/ports/nrf/common-hal/_bleio/PacketBuffer.c +++ b/ports/nrf/common-hal/_bleio/PacketBuffer.c @@ -43,7 +43,7 @@ #include "supervisor/shared/bluetooth/serial.h" STATIC void write_to_ringbuf(bleio_packet_buffer_obj_t *self, uint8_t *data, uint16_t len) { - if (len + sizeof(uint16_t) > ringbuf_capacity(&self->ringbuf)) { + if (len + sizeof(uint16_t) > ringbuf_size(&self->ringbuf)) { // This shouldn't happen but can if our buffer size was much smaller than // the writes the client actually makes. return; @@ -52,7 +52,7 @@ STATIC void write_to_ringbuf(bleio_packet_buffer_obj_t *self, uint8_t *data, uin uint8_t is_nested_critical_region; sd_nvic_critical_region_enter(&is_nested_critical_region); // Make room for the new value by dropping the oldest packets first. - while (ringbuf_capacity(&self->ringbuf) - ringbuf_num_filled(&self->ringbuf) < len + sizeof(uint16_t)) { + while (ringbuf_size(&self->ringbuf) - ringbuf_num_filled(&self->ringbuf) < len + sizeof(uint16_t)) { uint16_t packet_length; ringbuf_get_n(&self->ringbuf, (uint8_t *)&packet_length, sizeof(uint16_t)); for (uint16_t i = 0; i < packet_length; i++) { @@ -233,10 +233,7 @@ void _common_hal_bleio_packet_buffer_construct( } if (incoming) { - self->ringbuf.buf = (uint8_t *)incoming_buffer; - self->ringbuf.size = incoming_buffer_size; - self->ringbuf.iget = 0; - self->ringbuf.iput = 0; + ringbuf_init(&self->ringbuf, (uint8_t *)incoming_buffer, incoming_buffer_size); } self->packet_queued = false; @@ -502,7 +499,9 @@ bool common_hal_bleio_packet_buffer_deinited(bleio_packet_buffer_obj_t *self) { } void common_hal_bleio_packet_buffer_deinit(bleio_packet_buffer_obj_t *self) { + if (!common_hal_bleio_packet_buffer_deinited(self)) { ble_drv_remove_event_handler(packet_buffer_on_ble_client_evt, self); + ringbuf_deinit(&self->ringbuf); } } diff --git a/ports/nrf/common-hal/_bleio/__init__.c b/ports/nrf/common-hal/_bleio/__init__.c index 1d59983896..718b28c7fe 100644 --- a/ports/nrf/common-hal/_bleio/__init__.c +++ b/ports/nrf/common-hal/_bleio/__init__.c @@ -185,7 +185,12 @@ STATIC bool _on_gattc_read_rsp_evt(ble_evt_t *ble_evt, void *param) { } break; } - + case BLE_GAP_EVT_DISCONNECTED: { + read->conn_handle = BLE_CONN_HANDLE_INVALID; + read->done = true; + return false; + break; + } default: // For debugging. // mp_printf(&mp_plat_print, "Unhandled characteristic event: 0x%04x\n", ble_evt->header.evt_id); @@ -219,6 +224,8 @@ size_t common_hal_bleio_gattc_read(uint16_t handle, uint16_t conn_handle, uint8_ while (!read_info.done) { RUN_BACKGROUND_TASKS; } + // Test if we were disconnected while reading + common_hal_bleio_check_connected(read_info.conn_handle); ble_drv_remove_event_handler(_on_gattc_read_rsp_evt, &read_info); check_gatt_status(read_info.status); diff --git a/ports/nrf/common-hal/alarm/__init__.c b/ports/nrf/common-hal/alarm/__init__.c index 92dac1c789..75f616c805 100644 --- a/ports/nrf/common-hal/alarm/__init__.c +++ b/ports/nrf/common-hal/alarm/__init__.c @@ -96,7 +96,7 @@ static const char *cause_str[] = { "VBUS", "RESETPIN", }; -void print_wakeup_cause(nrf_sleep_source_t cause) { +static void print_wakeup_cause(nrf_sleep_source_t cause) { if (cause >= 0 && cause < NRF_SLEEP_WAKEUP_ZZZ) { mp_printf(&mp_plat_print, "wakeup cause = NRF_SLEEP_WAKEUP_%s\r\n", cause_str[(int)cause]); @@ -108,7 +108,7 @@ bool common_hal_alarm_woken_from_sleep(void) { nrf_sleep_source_t cause = _get_wakeup_cause(); #ifdef NRF_DEBUG_PRINT if (cause != NRF_SLEEP_WAKEUP_UNDEFINED) { - // print_wakeup_cause(cause); + print_wakeup_cause(cause); } #endif return cause == NRF_SLEEP_WAKEUP_GPIO || cause == NRF_SLEEP_WAKEUP_TIMER @@ -247,7 +247,10 @@ mp_obj_t common_hal_alarm_light_sleep_until_alarms(size_t n_alarms, const mp_obj return wake_alarm; } -void common_hal_alarm_set_deep_sleep_alarms(size_t n_alarms, const mp_obj_t *alarms) { +void common_hal_alarm_set_deep_sleep_alarms(size_t n_alarms, const mp_obj_t *alarms, size_t n_dios, digitalio_digitalinout_obj_t **preserve_dios) { + if (n_dios > 0) { + mp_raise_NotImplementedError_varg(translate("%q"), MP_QSTR_preserve_dios); + } _setup_sleep_alarms(true, n_alarms, alarms); } diff --git a/ports/nrf/common-hal/alarm/pin/PinAlarm.c b/ports/nrf/common-hal/alarm/pin/PinAlarm.c index 4bf412d85b..9d0f8f4b88 100644 --- a/ports/nrf/common-hal/alarm/pin/PinAlarm.c +++ b/ports/nrf/common-hal/alarm/pin/PinAlarm.c @@ -49,10 +49,10 @@ extern uint32_t reset_reason_saved; void common_hal_alarm_pin_pinalarm_construct(alarm_pin_pinalarm_obj_t *self, const mcu_pin_obj_t *pin, bool value, bool edge, bool pull) { if (edge) { - mp_raise_ValueError(translate("Cannot wake on pin edge. Only level.")); + mp_raise_ValueError(translate("Cannot wake on pin edge, only level")); } if (pin->number >= NUMBER_OF_PINS) { - mp_raise_ValueError(translate("Invalid pin")); + raise_ValueError_invalid_pin(); } self->pin = pin; self->value = value; diff --git a/ports/nrf/common-hal/alarm/time/TimeAlarm.c b/ports/nrf/common-hal/alarm/time/TimeAlarm.c index c5f3bfd705..03b91068f9 100644 --- a/ports/nrf/common-hal/alarm/time/TimeAlarm.c +++ b/ports/nrf/common-hal/alarm/time/TimeAlarm.c @@ -85,7 +85,7 @@ void alarm_time_timealarm_set_alarms(bool deep_sleep, size_t n_alarms, const mp_ continue; } if (timealarm_set) { - mp_raise_ValueError(translate("Only one alarm.time alarm can be set.")); + mp_raise_ValueError(translate("Only one alarm.time alarm can be set")); } timealarm = MP_OBJ_TO_PTR(alarms[i]); timealarm_set = true; diff --git a/ports/nrf/common-hal/analogio/AnalogIn.c b/ports/nrf/common-hal/analogio/AnalogIn.c index c64e51ec09..b9d4b6a199 100644 --- a/ports/nrf/common-hal/analogio/AnalogIn.c +++ b/ports/nrf/common-hal/analogio/AnalogIn.c @@ -27,8 +27,9 @@ #include "common-hal/analogio/AnalogIn.h" #include "shared-bindings/analogio/AnalogIn.h" +#include "shared-bindings/microcontroller/Pin.h" #include "py/runtime.h" -#include "supervisor/shared/translate.h" +#include "supervisor/shared/translate/translate.h" #include "nrf_saadc.h" #include "nrf_gpio.h" @@ -48,7 +49,7 @@ void analogin_init(void) { void common_hal_analogio_analogin_construct(analogio_analogin_obj_t *self, const mcu_pin_obj_t *pin) { if (pin->adc_channel == 0) { - mp_raise_ValueError(translate("Pin does not have ADC capabilities")); + raise_ValueError_invalid_pin(); } nrf_gpio_cfg_default(pin->number); @@ -76,7 +77,7 @@ uint16_t common_hal_analogio_analogin_get_value(analogio_analogin_obj_t *self) { // Something else might have used the ADC in a different way, // so we completely re-initialize it. - nrf_saadc_value_t value; + nrf_saadc_value_t value = -1; const nrf_saadc_channel_config_t config = { .resistor_p = NRF_SAADC_RESISTOR_DISABLED, @@ -124,8 +125,8 @@ uint16_t common_hal_analogio_analogin_get_value(analogio_analogin_obj_t *self) { value = 0; } - // Map value to from 14 to 16 bits - return value << 2; + // Stretch 14-bit ADC reading to 16-bit range + return (value << 2) | (value >> 12); } float common_hal_analogio_analogin_get_reference_voltage(analogio_analogin_obj_t *self) { diff --git a/ports/nrf/common-hal/analogio/AnalogOut.c b/ports/nrf/common-hal/analogio/AnalogOut.c index 7afa773d30..38ff935674 100644 --- a/ports/nrf/common-hal/analogio/AnalogOut.c +++ b/ports/nrf/common-hal/analogio/AnalogOut.c @@ -31,10 +31,10 @@ #include "py/mperrno.h" #include "py/runtime.h" -#include "supervisor/shared/translate.h" +#include "supervisor/shared/translate/translate.h" void common_hal_analogio_analogout_construct(analogio_analogout_obj_t *self, const mcu_pin_obj_t *pin) { - mp_raise_RuntimeError(translate("AnalogOut functionality not supported")); + mp_raise_NotImplementedError_varg(translate("%q"), MP_QSTR_AnalogOut); } bool common_hal_analogio_analogout_deinited(analogio_analogout_obj_t *self) { diff --git a/ports/nrf/common-hal/audiopwmio/PWMAudioOut.c b/ports/nrf/common-hal/audiopwmio/PWMAudioOut.c index c3da519454..bc6302cb42 100644 --- a/ports/nrf/common-hal/audiopwmio/PWMAudioOut.c +++ b/ports/nrf/common-hal/audiopwmio/PWMAudioOut.c @@ -37,7 +37,7 @@ #include "shared-bindings/microcontroller/__init__.h" #include "shared-bindings/microcontroller/Pin.h" #include "supervisor/shared/tick.h" -#include "supervisor/shared/translate.h" +#include "supervisor/shared/translate/translate.h" // TODO: This should be the same size as PWMOut.c:pwms[], but there's no trivial way to accomplish that STATIC audiopwmio_pwmaudioout_obj_t *active_audio[4]; @@ -263,9 +263,8 @@ void common_hal_audiopwmio_pwmaudioout_play(audiopwmio_pwmaudioout_obj_t *self, &spacing); self->sample_channel_count = audiosample_channel_count(sample); - if (max_buffer_length > UINT16_MAX) { - mp_raise_ValueError_varg(translate("Buffer length %d too big. It must be less than %d"), max_buffer_length, UINT16_MAX); - } + mp_arg_validate_length_max(max_buffer_length, UINT16_MAX, MP_QSTR_buffer); + uint16_t buffer_length = (uint16_t)max_buffer_length; self->buffers[0] = m_malloc(buffer_length * 2 * sizeof(uint16_t), false); if (!self->single_buffer) { diff --git a/ports/nrf/common-hal/busio/I2C.c b/ports/nrf/common-hal/busio/I2C.c index 322b5f2faa..2bd1416f5a 100644 --- a/ports/nrf/common-hal/busio/I2C.c +++ b/ports/nrf/common-hal/busio/I2C.c @@ -29,9 +29,10 @@ #include "shared-bindings/busio/I2C.h" #include "shared-bindings/microcontroller/__init__.h" +#include "shared-bindings/microcontroller/Pin.h" #include "py/mperrno.h" #include "py/runtime.h" -#include "supervisor/shared/translate.h" +#include "supervisor/shared/translate/translate.h" #include "nrfx_twim.h" #include "nrfx_spim.h" @@ -96,7 +97,7 @@ static uint8_t twi_error_to_mp(const nrfx_err_t err) { void common_hal_busio_i2c_construct(busio_i2c_obj_t *self, const mcu_pin_obj_t *scl, const mcu_pin_obj_t *sda, uint32_t frequency, uint32_t timeout) { if (scl->number == sda->number) { - mp_raise_ValueError(translate("Invalid pins")); + raise_ValueError_invalid_pins(); } // Find a free instance. diff --git a/ports/nrf/common-hal/busio/UART.c b/ports/nrf/common-hal/busio/UART.c index 132f5d9272..df4a485999 100644 --- a/ports/nrf/common-hal/busio/UART.c +++ b/ports/nrf/common-hal/busio/UART.c @@ -33,7 +33,7 @@ #include "py/mperrno.h" #include "py/runtime.h" #include "py/stream.h" -#include "supervisor/shared/translate.h" +#include "supervisor/shared/translate/translate.h" #include "nrfx_uarte.h" #include "nrf_gpio.h" @@ -164,12 +164,10 @@ void common_hal_busio_uart_construct(busio_uart_obj_t *self, mp_float_t timeout, uint16_t receiver_buffer_size, byte *receiver_buffer, bool sigint_enabled) { - if (bits != 8) { - mp_raise_ValueError(translate("Invalid word/bit length")); - } + mp_arg_validate_int(bits, 8, MP_QSTR_bits); if ((rs485_dir != NULL) || (rs485_invert)) { - mp_raise_ValueError(translate("RS485 Not yet supported on this device")); + mp_raise_NotImplementedError(translate("RS485")); } // Find a free UART peripheral. @@ -189,9 +187,7 @@ void common_hal_busio_uart_construct(busio_uart_obj_t *self, mp_raise_ValueError(translate("tx and rx cannot both be None")); } - if (receiver_buffer_size == 0) { - mp_raise_ValueError(translate("Invalid buffer size")); - } + mp_arg_validate_int_min(receiver_buffer_size, 1, MP_QSTR_receiver_buffer_size); if (parity == BUSIO_UART_PARITY_ODD) { mp_raise_ValueError(translate("Odd parity is not supported")); @@ -217,24 +213,20 @@ void common_hal_busio_uart_construct(busio_uart_obj_t *self, // Init buffer for rx if (rx != NULL) { - self->allocated_ringbuf = true; // Use the provided buffer when given. if (receiver_buffer != NULL) { - self->ringbuf.buf = receiver_buffer; - self->ringbuf.size = receiver_buffer_size - 1; - self->ringbuf.iput = 0; - self->ringbuf.iget = 0; - self->allocated_ringbuf = false; + ringbuf_init(&self->ringbuf, receiver_buffer, receiver_buffer_size); + } else { // Initially allocate the UART's buffer in the long-lived part of the // heap. UARTs are generally long-lived objects, but the "make long- // lived" machinery is incapable of moving internal pointers like // self->buffer, so do it manually. (However, as long as internal // pointers like this are NOT moved, allocating the buffer // in the long-lived pool is not strictly necessary) - // (This is a macro.) - } else if (!ringbuf_alloc(&self->ringbuf, receiver_buffer_size, true)) { - nrfx_uarte_uninit(self->uarte); - mp_raise_msg(&mp_type_MemoryError, translate("Failed to allocate RX buffer")); + if (!ringbuf_alloc(&self->ringbuf, receiver_buffer_size, true)) { + nrfx_uarte_uninit(self->uarte); + m_malloc_fail(receiver_buffer_size); + } } self->rx_pin_number = rx->number; @@ -286,9 +278,7 @@ void common_hal_busio_uart_deinit(busio_uart_obj_t *self) { self->rx_pin_number = NO_PIN; self->rts_pin_number = NO_PIN; self->cts_pin_number = NO_PIN; - if (self->allocated_ringbuf) { - ringbuf_free(&self->ringbuf); - } + ringbuf_deinit(&self->ringbuf); for (size_t i = 0; i < MP_ARRAY_SIZE(nrfx_uartes); i++) { if (self->uarte == &nrfx_uartes[i]) { @@ -309,7 +299,7 @@ size_t common_hal_busio_uart_read(busio_uart_obj_t *self, uint8_t *data, size_t // check removed to reduce code size /* - if (len > ringbuf_capacity(&self->ringbuf)) { + if (len > ringbuf_size(&self->ringbuf)) { mp_raise_ValueError(translate("Reading >receiver_buffer_size bytes is not supported")); } */ @@ -341,6 +331,11 @@ size_t common_hal_busio_uart_read(busio_uart_obj_t *self, uint8_t *data, size_t NVIC_EnableIRQ(nrfx_get_irq_number(self->uarte->p_reg)); + if (rx_bytes == 0) { + *errcode = EAGAIN; + return MP_STREAM_ERROR; + } + return rx_bytes; } diff --git a/ports/nrf/common-hal/busio/UART.h b/ports/nrf/common-hal/busio/UART.h index 140f8d0c0a..2eaf584403 100644 --- a/ports/nrf/common-hal/busio/UART.h +++ b/ports/nrf/common-hal/busio/UART.h @@ -44,7 +44,6 @@ typedef struct { ringbuf_t ringbuf; uint8_t rx_char; // EasyDMA buf bool rx_paused; // set by irq if no space in rbuf - bool allocated_ringbuf; uint8_t tx_pin_number; uint8_t rx_pin_number; diff --git a/ports/nrf/common-hal/digitalio/DigitalInOut.c b/ports/nrf/common-hal/digitalio/DigitalInOut.c index b42d7dc704..a6440228f1 100644 --- a/ports/nrf/common-hal/digitalio/DigitalInOut.c +++ b/ports/nrf/common-hal/digitalio/DigitalInOut.c @@ -26,7 +26,7 @@ #include "shared-bindings/digitalio/DigitalInOut.h" #include "py/runtime.h" -#include "supervisor/shared/translate.h" +#include "supervisor/shared/translate/translate.h" #include "nrf_gpio.h" @@ -59,10 +59,11 @@ void common_hal_digitalio_digitalinout_deinit(digitalio_digitalinout_obj_t *self self->pin = NULL; } -void common_hal_digitalio_digitalinout_switch_to_input( +digitalinout_result_t common_hal_digitalio_digitalinout_switch_to_input( digitalio_digitalinout_obj_t *self, digitalio_pull_t pull) { nrf_gpio_cfg_input(self->pin->number, NRF_GPIO_PIN_NOPULL); common_hal_digitalio_digitalinout_set_pull(self, pull); + return DIGITALINOUT_OK; } digitalinout_result_t common_hal_digitalio_digitalinout_switch_to_output( @@ -120,7 +121,7 @@ digitalio_drive_mode_t common_hal_digitalio_digitalinout_get_drive_mode( } } -void common_hal_digitalio_digitalinout_set_pull( +digitalinout_result_t common_hal_digitalio_digitalinout_set_pull( digitalio_digitalinout_obj_t *self, digitalio_pull_t pull) { nrf_gpio_pin_pull_t hal_pull = NRF_GPIO_PIN_NOPULL; @@ -137,6 +138,7 @@ void common_hal_digitalio_digitalinout_set_pull( } nrf_gpio_cfg_input(self->pin->number, hal_pull); + return DIGITALINOUT_OK; } digitalio_pull_t common_hal_digitalio_digitalinout_get_pull( diff --git a/ports/nrf/common-hal/microcontroller/Processor.c b/ports/nrf/common-hal/microcontroller/Processor.c index fa2dfad6a4..2fca3a3c0a 100644 --- a/ports/nrf/common-hal/microcontroller/Processor.c +++ b/ports/nrf/common-hal/microcontroller/Processor.c @@ -31,7 +31,6 @@ #include "common-hal/alarm/__init__.h" #include "shared-bindings/microcontroller/ResetReason.h" -#include "supervisor/shared/translate.h" #include "nrfx_saadc.h" #ifdef BLUETOOTH_SD @@ -72,7 +71,7 @@ uint32_t common_hal_mcu_processor_get_frequency(void) { } float common_hal_mcu_processor_get_voltage(void) { - nrf_saadc_value_t value; + nrf_saadc_value_t value = -1; const nrf_saadc_channel_config_t config = { .resistor_p = NRF_SAADC_RESISTOR_DISABLED, diff --git a/ports/nrf/common-hal/pulseio/PulseIn.c b/ports/nrf/common-hal/pulseio/PulseIn.c index 4ab5d609f2..757c56a4ac 100644 --- a/ports/nrf/common-hal/pulseio/PulseIn.c +++ b/ports/nrf/common-hal/pulseio/PulseIn.c @@ -129,7 +129,7 @@ void common_hal_pulseio_pulsein_construct(pulseio_pulsein_obj_t *self, const mcu self->buffer = (uint16_t *)m_malloc(maxlen * sizeof(uint16_t), false); if (self->buffer == NULL) { - mp_raise_msg_varg(&mp_type_MemoryError, translate("Failed to allocate RX buffer of %d bytes"), maxlen * sizeof(uint16_t)); + m_malloc_fail(maxlen * sizeof(uint16_t)); } if (refcount == 0) { @@ -271,7 +271,7 @@ uint16_t common_hal_pulseio_pulsein_get_item(pulseio_pulsein_obj_t *self, int16_ if (!self->paused) { nrfx_gpiote_in_event_enable(self->pin, true); } - mp_raise_IndexError_varg(translate("%q index out of range"), MP_QSTR_PulseIn); + mp_raise_IndexError_varg(translate("%q out of range"), MP_QSTR_index); } uint16_t value = self->buffer[(self->start + index) % self->maxlen]; diff --git a/ports/nrf/common-hal/pulseio/PulseOut.c b/ports/nrf/common-hal/pulseio/PulseOut.c index 1c3c317a05..c2d59ffdba 100644 --- a/ports/nrf/common-hal/pulseio/PulseOut.c +++ b/ports/nrf/common-hal/pulseio/PulseOut.c @@ -35,7 +35,7 @@ #include "py/runtime.h" #include "shared-bindings/pulseio/PulseOut.h" #include "shared-bindings/pwmio/PWMOut.h" -#include "supervisor/shared/translate.h" +#include "supervisor/shared/translate/translate.h" // A single timer is shared amongst all PulseOut objects under the assumption that // the code is single threaded. @@ -74,6 +74,11 @@ static void pulseout_event_handler(nrf_timer_event_t event_type, void *p_context nrfx_timer_pause(timer); pulse_array_index++; + // Ignore a zero-length pulse + while (pulse_array_index < pulse_array_length && + pulse_array[pulse_array_index] == 0) { + pulse_array_index++; + } // No more pulses. Turn off output and don't restart. if (pulse_array_index >= pulse_array_length) { diff --git a/ports/nrf/common-hal/pwmio/PWMOut.c b/ports/nrf/common-hal/pwmio/PWMOut.c index 27c0b79b5a..1bd38e7a6e 100644 --- a/ports/nrf/common-hal/pwmio/PWMOut.c +++ b/ports/nrf/common-hal/pwmio/PWMOut.c @@ -30,7 +30,7 @@ #include "py/runtime.h" #include "common-hal/pwmio/PWMOut.h" #include "shared-bindings/pwmio/PWMOut.h" -#include "supervisor/shared/translate.h" +#include "supervisor/shared/translate/translate.h" #include "nrf_gpio.h" @@ -297,7 +297,7 @@ void common_hal_pwmio_pwmout_set_frequency(pwmio_pwmout_obj_t *self, uint32_t fr uint16_t countertop; nrf_pwm_clk_t base_clock; if (frequency == 0 || !convert_frequency(frequency, &countertop, &base_clock)) { - mp_raise_ValueError(translate("Invalid PWM frequency")); + mp_arg_error_invalid(MP_QSTR_frequency); } self->frequency = frequency; diff --git a/ports/nrf/common-hal/rtc/RTC.c b/ports/nrf/common-hal/rtc/RTC.c index 0b7115a14f..29d308eccc 100644 --- a/ports/nrf/common-hal/rtc/RTC.c +++ b/ports/nrf/common-hal/rtc/RTC.c @@ -33,7 +33,7 @@ #include "common-hal/rtc/RTC.h" #include "shared-bindings/rtc/RTC.h" #include "supervisor/port.h" -#include "supervisor/shared/translate.h" +#include "supervisor/shared/translate/translate.h" // This is the time in seconds since 2000 that the RTC was started. __attribute__((section(".uninitialized"))) static uint32_t rtc_offset[3]; @@ -80,5 +80,5 @@ int common_hal_rtc_get_calibration(void) { } void common_hal_rtc_set_calibration(int calibration) { - mp_raise_NotImplementedError(translate("RTC calibration is not supported on this board")); + mp_raise_NotImplementedError_varg(translate("%q"), MP_QSTR_calibration); } diff --git a/ports/nrf/common-hal/watchdog/WatchDogTimer.c b/ports/nrf/common-hal/watchdog/WatchDogTimer.c index cd7aa449bf..99c360c46d 100644 --- a/ports/nrf/common-hal/watchdog/WatchDogTimer.c +++ b/ports/nrf/common-hal/watchdog/WatchDogTimer.c @@ -96,7 +96,7 @@ 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) { if (gc_alloc_possible()) { - mp_raise_NotImplementedError(translate("WatchDogTimer cannot be deinitialized once mode is set to RESET")); + mp_raise_RuntimeError(translate("WatchDogTimer cannot be deinitialized once mode is set to RESET")); } // Don't change anything because RESET cannot be undone. return; diff --git a/ports/nrf/mpconfigport.mk b/ports/nrf/mpconfigport.mk index 1a12c20f2d..04c4f3bce6 100644 --- a/ports/nrf/mpconfigport.mk +++ b/ports/nrf/mpconfigport.mk @@ -4,6 +4,8 @@ LD_TEMPLATE_FILE = boards/common.template.ld INTERNAL_LIBM = 1 +CIRCUITPY_BUILD_EXTENSIONS ?= uf2 + # Number of USB endpoint pairs. USB_NUM_ENDPOINT_PAIRS = 8 @@ -25,19 +27,14 @@ CIRCUITPY_BLEIO_HCI = 0 CIRCUITPY_BLEIO ?= 1 # No I2CPeripheral implementation -CIRCUITPY_I2CPERIPHERAL = 0 +CIRCUITPY_I2CTARGET = 0 CIRCUITPY_RTC ?= 1 # frequencyio not yet implemented CIRCUITPY_FREQUENCYIO = 0 -CIRCUITPY_RGBMATRIX ?= 1 CIRCUITPY_ROTARYIO_SOFTENCODER = 1 -CIRCUITPY_FRAMEBUFFERIO ?= 1 - -CIRCUITPY_COUNTIO ?= 1 -CIRCUITPY_WATCHDOG ?= 1 # Sleep and Wakeup CIRCUITPY_ALARM ?= 1 @@ -60,6 +57,12 @@ MCU_SUB_VARIANT = nrf52840 # Fits on nrf52840 but space is tight on nrf52833. CIRCUITPY_AESIO ?= 1 +CIRCUITPY_RGBMATRIX ?= 1 +CIRCUITPY_FRAMEBUFFERIO ?= 1 + +CIRCUITPY_COUNTIO ?= 1 +CIRCUITPY_WATCHDOG ?= 1 + SD ?= s140 SOFTDEV_VERSION ?= 6.1.0 @@ -71,17 +74,37 @@ NRF_DEFINES += -DNRF52840_XXAA -DNRF52840 # Defined here because system_nrf52840.c doesn't #include any of our own include files. CFLAGS += -DCONFIG_NFCT_PINS_AS_GPIOS +ifeq ($(INTERNAL_FLASH_FILESYSTEM),1) + OPTIMIZATION_FLAGS ?= -Os + CIRCUITPY_LTO = 1 + CIRCUITPY_LTO_PARTITION = balanced +endif + else ifeq ($(MCU_CHIP),nrf52833) MCU_SERIES = m4 MCU_VARIANT = nrf52 MCU_SUB_VARIANT = nrf52833 +# Need the space +SUPEROPT_GC ?= 0 +SUPEROPT_VM ?= 0 + +CIRCUITPY_SYNTHIO ?= 0 + SD ?= s140 SOFTDEV_VERSION ?= 7.0.1 BOOT_SETTING_ADDR = 0x7F000 NRF_DEFINES += -DNRF52833_XXAA -DNRF52833 +OPTIMIZATION_FLAGS ?= -Os + +CIRCUITPY_LTO = 1 +CIRCUITPY_LTO_PARTITION = one +ifeq ($(INTERNAL_FLASH_FILESYSTEM),1) + CIRCUITPY_FULL_BUILD ?= 0 + CIRCUITPY_PULSEIO ?= 1 +endif endif endif diff --git a/ports/nrf/supervisor/port.c b/ports/nrf/supervisor/port.c index 0d1f71e886..0ed1ecd547 100644 --- a/ports/nrf/supervisor/port.c +++ b/ports/nrf/supervisor/port.c @@ -404,9 +404,3 @@ void HardFault_Handler(void) { asm ("nop;"); } } - -#if CIRCUITPY_ALARM -// in case boards/xxx/board.c does not provide board_deinit() -MP_WEAK void board_deinit(void) { -} -#endif diff --git a/ports/raspberrypi/.gitignore b/ports/raspberrypi/.gitignore deleted file mode 100644 index 414487d53e..0000000000 --- a/ports/raspberrypi/.gitignore +++ /dev/null @@ -1 +0,0 @@ -build-*/ diff --git a/ports/raspberrypi/Makefile b/ports/raspberrypi/Makefile index 67de654255..5095c4c1f8 100644 --- a/ports/raspberrypi/Makefile +++ b/ports/raspberrypi/Makefile @@ -57,54 +57,119 @@ CROSS_COMPILE = arm-none-eabi- HAL_DIR=hal/$(MCU_SERIES) -INC += -I. \ - -I../.. \ - -I../lib/mp-readline \ - -I../shared/timeutils \ - -Iboards/$(BOARD) \ - -Iboards/ \ - -isystem sdk/ \ - -isystem sdk/src/common/pico_base/include/ \ - -isystem sdk/src/common/pico_binary_info/include/ \ - -isystem sdk/src/common/pico_stdlib/include/ \ - -isystem sdk/src/common/pico_sync/include/ \ - -isystem sdk/src/common/pico_time/include/ \ - -isystem sdk/src/common/pico_util/include/ \ - -isystem sdk/src/rp2040/hardware_regs/include/ \ - -isystem sdk/src/rp2040/hardware_structs/include/ \ - -isystem sdk/src/rp2_common/hardware_adc/include/ \ - -isystem sdk/src/rp2_common/hardware_base/include/ \ - -isystem sdk/src/rp2_common/hardware_claim/include/ \ - -isystem sdk/src/rp2_common/hardware_clocks/include/ \ - -isystem sdk/src/rp2_common/hardware_divider/include/ \ - -isystem sdk/src/rp2_common/hardware_dma/include/ \ - -isystem sdk/src/rp2_common/hardware_flash/include/ \ - -isystem sdk/src/rp2_common/hardware_gpio/include/ \ - -isystem sdk/src/rp2_common/hardware_irq/include/ \ - -isystem sdk/src/rp2_common/hardware_i2c/include/ \ - -isystem sdk/src/rp2_common/hardware_pio/include/ \ - -isystem sdk/src/rp2_common/hardware_pll/include/ \ - -isystem sdk/src/rp2_common/hardware_resets/include/ \ - -isystem sdk/src/rp2_common/hardware_rtc/include/ \ - -isystem sdk/src/rp2_common/hardware_spi/include/ \ - -isystem sdk/src/rp2_common/hardware_sync/include/ \ - -isystem sdk/src/rp2_common/hardware_timer/include/ \ - -isystem sdk/src/rp2_common/hardware_uart/include/ \ - -isystem sdk/src/rp2_common/hardware_watchdog/include/ \ - -isystem sdk/src/rp2_common/hardware_xosc/include/ \ - -isystem sdk/src/rp2_common/pico_multicore/include/ \ - -isystem sdk/src/rp2_common/pico_fix/rp2040_usb_device_enumeration/include/ \ - -isystem sdk/src/rp2_common/pico_stdio/include/ \ - -isystem sdk/src/rp2_common/pico_printf/include/ \ - -isystem sdk/src/rp2_common/pico_float/include/ \ - -isystem sdk/src/rp2_common/pico_platform/include/ \ - -isystem sdk/src/rp2_common/pico_runtime/printf/include/ \ - -isystem sdk/src/rp2_common/pico_bootrom/include/ \ - -isystem sdk/src/rp2_common/pico_unique_id/include/ \ - -Isdk_config \ - -I../../lib/tinyusb/src \ - -I../../supervisor/shared/usb \ - -I$(BUILD) +ifeq ($(CIRCUITPY_CYW43),1) +INC_CYW43 := \ + -isystem lib/cyw43-driver/firmware \ + -isystem lib/cyw43-driver/src \ + -isystem lib/lwip/src/include \ + -isystem sdk/src/rp2_common/pico_cyw43_arch/include/ \ + -isystem sdk/src/rp2_common/pico_lwip/include/ \ + +CFLAGS_CYW43 := -DCYW43_LWIP=1 -DPICO_CYW43_ARCH_THREADSAFE_BACKGROUND=1 -DCYW43_USE_SPI -DIGNORE_GPIO25 -DIGNORE_GPIO23 -DIGNORE_GPIO24 -DCYW43_LOGIC_DEBUG=0 +SRC_SDK_CYW43 := \ + src/common/pico_sync/sem.c \ + src/rp2_common/cyw43_driver/cyw43_bus_pio_spi.c \ + src/rp2_common/pico_cyw43_arch/cyw43_arch.c \ + src/rp2_common/pico_cyw43_arch/cyw43_arch_threadsafe_background.c \ + src/rp2_common/pico_lwip/nosys.c \ + src/rp2_common/pico_lwip/random.c \ + +SRC_LWIP := \ + shared/netutils/netutils.c \ + $(wildcard lib/lwip/src/core/*.c) \ + $(wildcard lib/lwip/src/core/ipv4/*.c) \ + lib/lwip/src/netif/ethernet.c \ + $(wildcard lwip_src/*.c) \ + +SRC_CYW43 := \ + $(wildcard bindings/cyw43/*.c) \ + lib/cyw43-driver/src/cyw43_stats.c \ + lib/cyw43-driver/src/cyw43_ctrl.c \ + lib/cyw43-driver/src/cyw43_ll.c \ + lib/cyw43-driver/src/cyw43_lwip.c \ + +PIOASM = $(BUILD)/pioasm/pioasm/pioasm +.PHONY: PioasmBuild +PioasmBuild: $(PIOASM) +$(PIOASM): + $(Q)cmake -S pioasm -B $(BUILD)/pioasm + $(Q)$(MAKE) -C $(BUILD)/pioasm PioasmBuild + +$(BUILD)/cyw43_bus_pio_spi.pio.h: sdk/src/rp2_common/cyw43_driver/cyw43_bus_pio_spi.pio $(PIOASM) + $(Q)$(PIOASM) -o c-sdk $< $@ +$(BUILD)/sdk/src/rp2_common/cyw43_driver/cyw43_bus_pio_spi.o: $(BUILD)/cyw43_bus_pio_spi.pio.h + +CYW43_FIRMWARE_BIN = 43439A0-7.95.49.00.combined + +$(BUILD)/cyw43_resource.o: lib/cyw43-driver/firmware/$(CYW43_FIRMWARE_BIN) + $(Q)$(OBJCOPY) -I binary -O elf32-littlearm -B arm \ + --readonly-text \ + --rename-section .data=.big_const,contents,alloc,load,readonly,data \ + --redefine-sym _binary_lib_cyw43_driver_firmware_43439A0_7_95_49_00_combined_start=fw_43439A0_7_95_49_00_start \ + --redefine-sym _binary_lib_cyw43_driver_firmware_43439A0_7_95_49_00_combined_size=fw_43439A0_7_95_49_00_size \ + --redefine-sym _binary_lib_cyw43_driver_firmware_43439A0_7_95_49_00_combined_end=fw_43439A0_7_95_49_00_end \ + $< $@ +OBJ_CYW43 := $(BUILD)/cyw43_resource.o +else +INC_CYW43 := +CFLAGS_CYW43 := +SRC_SDK_CYW43 := +SRC_CYW43 := +OBJ_CYW43 := +SRC_LWIP := +endif + +INC += \ + -I. \ + -Ilwip_inc \ + -I../.. \ + -I../lib/mp-readline \ + -I../shared/timeutils \ + -Iboards/$(BOARD) \ + -Iboards/ \ + -isystem sdk/ \ + -isystem sdk/src/common/pico_base/include/ \ + -isystem sdk/src/common/pico_binary_info/include/ \ + -isystem sdk/src/common/pico_stdlib/include/ \ + -isystem sdk/src/common/pico_sync/include/ \ + -isystem sdk/src/common/pico_time/include/ \ + -isystem sdk/src/common/pico_util/include/ \ + -isystem sdk/src/rp2040/hardware_regs/include/ \ + -isystem sdk/src/rp2040/hardware_structs/include/ \ + -isystem sdk/src/rp2_common/hardware_adc/include/ \ + -isystem sdk/src/rp2_common/hardware_base/include/ \ + -isystem sdk/src/rp2_common/hardware_claim/include/ \ + -isystem sdk/src/rp2_common/hardware_clocks/include/ \ + -isystem sdk/src/rp2_common/hardware_divider/include/ \ + -isystem sdk/src/rp2_common/hardware_dma/include/ \ + -isystem sdk/src/rp2_common/hardware_flash/include/ \ + -isystem sdk/src/rp2_common/hardware_gpio/include/ \ + -isystem sdk/src/rp2_common/hardware_irq/include/ \ + -isystem sdk/src/rp2_common/hardware_i2c/include/ \ + -isystem sdk/src/rp2_common/hardware_pio/include/ \ + -isystem sdk/src/rp2_common/hardware_pll/include/ \ + -isystem sdk/src/rp2_common/hardware_resets/include/ \ + -isystem sdk/src/rp2_common/hardware_rtc/include/ \ + -isystem sdk/src/rp2_common/hardware_spi/include/ \ + -isystem sdk/src/rp2_common/hardware_sync/include/ \ + -isystem sdk/src/rp2_common/hardware_timer/include/ \ + -isystem sdk/src/rp2_common/hardware_uart/include/ \ + -isystem sdk/src/rp2_common/hardware_watchdog/include/ \ + -isystem sdk/src/rp2_common/hardware_xosc/include/ \ + -isystem sdk/src/rp2_common/pico_multicore/include/ \ + -isystem sdk/src/rp2_common/pico_fix/rp2040_usb_device_enumeration/include/ \ + -isystem sdk/src/rp2_common/pico_stdio/include/ \ + -isystem sdk/src/rp2_common/pico_printf/include/ \ + -isystem sdk/src/rp2_common/pico_float/include/ \ + -isystem sdk/src/rp2_common/pico_platform/include/ \ + -isystem sdk/src/rp2_common/pico_runtime/printf/include/ \ + -isystem sdk/src/rp2_common/pico_bootrom/include/ \ + -isystem sdk/src/rp2_common/pico_unique_id/include/ \ + $(INC_CYW43) \ + -Isdk_config \ + -I../../lib/tinyusb/src \ + -I../../supervisor/shared/usb \ + -I$(BUILD) # Pico specific configuration CFLAGS += -DRASPBERRYPI -DPICO_ON_DEVICE=1 -DPICO_NO_BINARY_INFO=0 -DPICO_TIME_DEFAULT_ALARM_POOL_DISABLED=0 -DPICO_DIVIDER_CALL_IDIV0=0 -DPICO_DIVIDER_CALL_LDIV0=0 -DPICO_DIVIDER_HARDWARE=1 -DPICO_DOUBLE_ROM=1 -DPICO_FLOAT_ROM=1 -DPICO_MULTICORE=1 -DPICO_BITS_IN_RAM=0 -DPICO_DIVIDER_IN_RAM=0 -DPICO_DOUBLE_PROPAGATE_NANS=0 -DPICO_DOUBLE_IN_RAM=0 -DPICO_MEM_IN_RAM=0 -DPICO_FLOAT_IN_RAM=0 -DPICO_FLOAT_PROPAGATE_NANS=1 -DPICO_NO_FLASH=0 -DPICO_COPY_TO_RAM=0 -DPICO_DISABLE_SHARED_IRQ_HANDLERS=0 -DPICO_NO_BI_BOOTSEL_VIA_DOUBLE_RESET=0 @@ -115,6 +180,9 @@ CFLAGS += -DTUD_OPT_RP2040_USB_DEVICE_ENUMERATION_FIX=1 -DCFG_TUSB_MCU=OPT_MCU_R # option to override default optimization level, set in boards/$(BOARD)/mpconfigboard.mk CFLAGS += $(OPTIMIZATION_FLAGS) +# flags specific to wifi / cyw43 + +CFLAGS += $(CFLAGS_CYW43) #Debugging/Optimization ifeq ($(DEBUG), 1) CFLAGS += -ggdb3 -O3 @@ -130,7 +198,7 @@ else endif # Remove -Wno-stringop-overflow after we can test with CI's GCC 10. Mac's looks weird. -DISABLE_WARNINGS = -Wno-stringop-overflow -Wno-unused-function -Wno-unused-variable -Wno-strict-overflow -Wno-cast-align -Wno-strict-prototypes -Wno-nested-externs -Wno-double-promotion -Wno-sign-compare +DISABLE_WARNINGS = -Wno-stringop-overflow -Wno-cast-align CFLAGS += $(INC) -Wall -Werror -std=gnu11 -nostdlib -fshort-enums $(BASE_CFLAGS) $(CFLAGS_MOD) $(COPT) $(DISABLE_WARNINGS) -Werror=missing-prototypes @@ -185,9 +253,10 @@ SRC_SDK := \ src/rp2_common/pico_runtime/runtime.c \ src/rp2_common/pico_stdio/stdio.c \ src/rp2_common/pico_unique_id/unique_id.c \ + $(SRC_SDK_CYW43) \ SRC_SDK := $(addprefix sdk/, $(SRC_SDK)) -$(patsubst %.c,$(BUILD)/%.o,$(SRC_SDK)): CFLAGS += -Wno-missing-prototypes -Wno-undef +$(patsubst %.c,$(BUILD)/%.o,$(SRC_SDK) $(SRC_CYW43)): CFLAGS += -Wno-missing-prototypes -Wno-undef -Wno-unused-function -Wno-nested-externs -Wno-strict-prototypes -Wno-double-promotion -Wno-sign-compare -Wno-unused-variable -Wno-strict-overflow SRC_C += \ boards/$(BOARD)/board.c \ @@ -204,6 +273,95 @@ SRC_C += \ lib/tinyusb/src/portable/raspberrypi/rp2040/dcd_rp2040.c \ lib/tinyusb/src/portable/raspberrypi/rp2040/rp2040_usb.c \ mphalport.c \ + $(SRC_CYW43) \ + $(SRC_LWIP) \ + +ifeq ($(CIRCUITPY_SSL),1) +CFLAGS += -isystem $(TOP)/mbedtls/include +SRC_MBEDTLS := $(addprefix lib/mbedtls/library/, \ + aes.c \ + aesni.c \ + arc4.c \ + asn1parse.c \ + asn1write.c \ + base64.c \ + bignum.c \ + blowfish.c \ + camellia.c \ + ccm.c \ + certs.c \ + chacha20.c \ + chachapoly.c \ + cipher.c \ + cipher_wrap.c \ + cmac.c \ + ctr_drbg.c \ + debug.c \ + des.c \ + dhm.c \ + ecdh.c \ + ecdsa.c \ + ecjpake.c \ + ecp.c \ + ecp_curves.c \ + entropy.c \ + entropy_poll.c \ + gcm.c \ + havege.c \ + hmac_drbg.c \ + md2.c \ + md4.c \ + md5.c \ + md.c \ + md_wrap.c \ + oid.c \ + padlock.c \ + pem.c \ + pk.c \ + pkcs11.c \ + pkcs12.c \ + pkcs5.c \ + pkparse.c \ + pk_wrap.c \ + pkwrite.c \ + platform.c \ + platform_util.c \ + poly1305.c \ + ripemd160.c \ + rsa.c \ + rsa_internal.c \ + sha1.c \ + sha256.c \ + sha512.c \ + ssl_cache.c \ + ssl_ciphersuites.c \ + ssl_cli.c \ + ssl_cookie.c \ + ssl_srv.c \ + ssl_ticket.c \ + ssl_tls.c \ + timing.c \ + x509.c \ + x509_create.c \ + x509_crl.c \ + x509_crt.c \ + x509_csr.c \ + x509write_crt.c \ + x509write_csr.c \ + xtea.c \ + ) +SRC_C += $(SRC_MBEDTLS) mbedtls/mbedtls_port.c mbedtls/crt_bundle.c +CFLAGS += \ + -isystem $(TOP)/lib/mbedtls/include \ + -DMBEDTLS_CONFIG_FILE='"mbedtls/mbedtls_config.h"' \ + +$(BUILD)/x509_crt_bundle.S: $(TOP)/lib/certificates/nina-fw/data/roots.pem $(TOP)/tools/gen_crt_bundle.py + $(Q)$(PYTHON) $(TOP)/tools/gen_crt_bundle.py -i $< -o $@ --asm +OBJ_MBEDTLS := $(BUILD)/x509_crt_bundle.o +$(patsubst %.c,$(BUILD)/%.o,$(SRC_MBEDTLS))): CFLAGS += -Wno-suggest-attribute=format +else +OBJ_MBEDTLS := +endif SRC_COMMON_HAL_EXPANDED = $(addprefix shared-bindings/, $(SRC_COMMON_HAL)) \ $(addprefix shared-bindings/, $(SRC_BINDINGS_ENUMS)) \ @@ -243,8 +401,9 @@ OBJ += $(addprefix $(BUILD)/, $(SRC_S:.s=.o)) OBJ += $(addprefix $(BUILD)/, $(SRC_S_UPPER:.S=.o)) OBJ += $(addprefix $(BUILD)/, $(SRC_MOD:.c=.o)) OBJ += $(BUILD)/boot2_padded_checksummed.o +OBJ += $(OBJ_CYW43) $(OBJ_MBEDTLS) -$(BUILD)/boot2_padded_checksummed.o: $(BUILD)/boot2_padded_checksummed.S +$(BUILD)/%.o: $(BUILD)/%.S $(STEPECHO) "CC $<" $(Q)$(CC) $(CFLAGS) -c -o $@ $< @@ -276,12 +435,13 @@ SRC_QSTR += $(SRC_C) $(SRC_SUPERVISOR) $(SRC_COMMON_HAL_EXPANDED) $(SRC_SHARED_M all: $(BUILD)/firmware.uf2 -$(BUILD)/firmware.elf: $(OBJ) link.ld +LINK_LD := $(firstword $(wildcard boards/$(BOARD)/link.ld link.ld)) +$(BUILD)/firmware.elf: $(OBJ) $(LINK_LD) $(STEPECHO) "LINK $@" $(Q)echo $(OBJ) > $(BUILD)/firmware.objs $(Q)echo $(PICO_LDFLAGS) > $(BUILD)/firmware.ldflags - $(Q)$(CC) -o $@ $(CFLAGS) @$(BUILD)/firmware.ldflags -Wl,-T,link.ld -Wl,-Map=$@.map -Wl,-cref -Wl,--gc-sections @$(BUILD)/firmware.objs - $(Q)$(SIZE) $@ | $(PYTHON) $(TOP)/tools/build_memory_info.py link.ld + $(Q)$(CC) -o $@ $(CFLAGS) @$(BUILD)/firmware.ldflags -Wl,-T,$(LINK_LD) -Wl,-Map=$@.map -Wl,-cref -Wl,--gc-sections @$(BUILD)/firmware.objs + $(Q)$(SIZE) $@ | $(PYTHON) $(TOP)/tools/build_memory_info.py $(LINK_LD) $(BUILD)/firmware.bin: $(BUILD)/firmware.elf $(STEPECHO) "Create $@" diff --git a/ports/raspberrypi/bindings/cyw43/__init__.c b/ports/raspberrypi/bindings/cyw43/__init__.c new file mode 100644 index 0000000000..66cc5fa1c4 --- /dev/null +++ b/ports/raspberrypi/bindings/cyw43/__init__.c @@ -0,0 +1,144 @@ +/* + * This file is part of the MicroPython project, http://micropython.org/ + * + * The MIT License (MIT) + * + * Copyright (c) 2022 Jeff Epler for Adafruit Industries + * Copyright (c) 2016 Scott Shawcroft + * + * 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 "shared-bindings/board/__init__.h" +#include "shared-bindings/microcontroller/__init__.h" +#include "shared-bindings/microcontroller/Pin.h" +#include "bindings/cyw43/__init__.h" + + +static int power_management_value = PM_DISABLED; + +void bindings_cyw43_wifi_enforce_pm() { + cyw43_wifi_pm(&cyw43_state, power_management_value); +} + +//| class CywPin: +//| """A class that represents a GPIO pin attached to the wifi chip. +//| +//| Cannot be constructed at runtime, but may be the type of a pin object +//| in :py:mod:`board`. A `CywPin` can be used as a DigitalInOut, but not with other +//| peripherals such as `PWMOut`.""" +//| +const mp_obj_type_t cyw43_pin_type = { + { &mp_type_type }, + .flags = MP_TYPE_FLAG_EXTENDED, + .name = MP_QSTR_CywPin, + .print = shared_bindings_microcontroller_pin_print, + MP_TYPE_EXTENDED_FIELDS( + .unary_op = mp_generic_unary_op, + ) +}; + +//| PM_STANDARD: int +//| """The standard power management mode""" +//| PM_AGGRESSIVE: int +//| """Aggressive power management mode for optimal power usage at the cost of performance""" +//| PM_PERFORMANCE: int +//| """Performance power management mode where more power is used to increase performance""" +//| PM_DISABLED: int +//| """Disable power management and always use highest power mode. CircuitPython sets this value at reset time, because it provides the best connectivity reliability.""" +//| +//| def set_power_management(value: int) -> None: +//| """Set the power management register +//| +//| For transmitter power, see ``wifi.Radio.txpower``. +//| This controls software power saving features inside the cyw43 chip. +//| it does not control transmitter power. +//| +//| The value is interpreted as a 24-bit hexadecimal number of the form +//| ``0x00adbrrm``. +//| +//| The low 4 bits, ``m``, are the power management mode: +//| * 0: disabled +//| * 1: aggressive power saving which reduces wifi throughput +//| * 2: Power saving with high througput +//| +//| The next 8 bits, ``r``, specify "the maximum time to wait before going back to sleep" for power management mode 2. The units of ``r`` are 10ms. +//| +//| The next 4 bits, ``b``, are the "wake period is measured in beacon periods". +//| +//| The next 4 bits, ``d``, specify the "wake interval measured in DTIMs. If this is set to 0, the wake interval is measured in beacon periods". +//| +//| The top 4 bits, ``a``, specifies the "wake interval sent to the access point" +//| +//| Several ``PM_`` constants gathered from various sources are included +//| in this module. According to Raspberry Pi documentation, the value 0xa11140 +//| (called `cyw43.PM_DISABLED` here) increases responsiveness at the cost of higher power +//| usage. +//| """ +//| +STATIC mp_obj_t cyw43_set_power_management(const mp_obj_t value_in) { + mp_int_t value = mp_obj_get_int(value_in); + power_management_value = value; + bindings_cyw43_wifi_enforce_pm(); + return mp_const_none; +} +STATIC MP_DEFINE_CONST_FUN_OBJ_1(cyw43_set_power_management_obj, cyw43_set_power_management); + +//| def get_power_management() -> int: +//| """Retrieve the power management register""" +//| +STATIC mp_obj_t cyw43_get_power_management() { + return mp_obj_new_int(power_management_value); +} +STATIC MP_DEFINE_CONST_FUN_OBJ_0(cyw43_get_power_management_obj, cyw43_get_power_management); + +const mcu_pin_obj_t *validate_obj_is_pin_including_cyw43(mp_obj_t obj) { + if (!mp_obj_is_type(obj, &mcu_pin_type) && !mp_obj_is_type(obj, &cyw43_pin_type)) { + mp_raise_TypeError_varg(translate("Expected a %q or %q"), mcu_pin_type.name, cyw43_pin_type.name); + } + return MP_OBJ_TO_PTR(obj); +} + +const mcu_pin_obj_t *validate_obj_is_free_pin_including_cyw43(mp_obj_t obj) { + const mcu_pin_obj_t *pin = validate_obj_is_pin_including_cyw43(obj); + assert_pin_free(pin); + return pin; +} + +STATIC const mp_rom_map_elem_t cyw43_module_globals_table[] = { + { MP_ROM_QSTR(MP_QSTR___name__), MP_ROM_QSTR(MP_QSTR_cyw43) }, + { MP_ROM_QSTR(MP_QSTR_CywPin), MP_ROM_PTR(&cyw43_pin_type) }, + { MP_ROM_QSTR(MP_QSTR_set_power_management), &cyw43_set_power_management_obj }, + { MP_ROM_QSTR(MP_QSTR_get_power_management), &cyw43_get_power_management_obj }, + { MP_ROM_QSTR(MP_QSTR_PM_STANDARD), MP_ROM_INT(PM_STANDARD) }, + { MP_ROM_QSTR(MP_QSTR_PM_AGGRESSIVE), MP_ROM_INT(PM_AGGRESSIVE) }, + { MP_ROM_QSTR(MP_QSTR_PM_PERFORMANCE), MP_ROM_INT(PM_PERFORMANCE) }, + { MP_ROM_QSTR(MP_QSTR_PM_DISABLED), MP_ROM_INT(PM_DISABLED) }, +}; + +STATIC MP_DEFINE_CONST_DICT(cyw43_module_globals, cyw43_module_globals_table); + +const mp_obj_module_t cyw43_module = { + .base = { &mp_type_module }, + .globals = (mp_obj_dict_t *)&cyw43_module_globals, +}; + +MP_REGISTER_MODULE(MP_QSTR_cyw43, cyw43_module, CIRCUITPY_CYW43); diff --git a/ports/raspberrypi/bindings/cyw43/__init__.h b/ports/raspberrypi/bindings/cyw43/__init__.h new file mode 100644 index 0000000000..c543f7b9e1 --- /dev/null +++ b/ports/raspberrypi/bindings/cyw43/__init__.h @@ -0,0 +1,53 @@ +/* + * This file is part of the MicroPython project, http://micropython.org/ + * + * The MIT License (MIT) + * + * Copyright (c) 2022 Jeff Epler for Adafruit Industries + * Copyright (c) 2016 Scott Shawcroft + * + * 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. + */ + +#pragma once + +#include "py/obj.h" +#include "common-hal/microcontroller/Pin.h" + +extern const mp_obj_type_t cyw43_pin_type; +const mcu_pin_obj_t *validate_obj_is_free_pin_including_cyw43(mp_obj_t obj); +const mcu_pin_obj_t *validate_obj_is_pin_including_cyw43(mp_obj_t obj); + +#define CONSTANT_CYW43_PM_VALUE(pm_mode, pm2_sleep_ret_ms, li_beacon_period, li_dtim_period, li_assoc) \ + (li_assoc << 20 | /* listen interval sent to ap */ \ + li_dtim_period << 16 | \ + li_beacon_period << 12 | \ + (pm2_sleep_ret_ms / 10) << 4 | /* cyw43_ll_wifi_pm multiplies this by 10 */ \ + pm_mode /* CYW43_PM2_POWERSAVE_MODE etc */) + +// CYW43_DEFAULT_PM (except a compile-time constant) +#define PM_STANDARD CONSTANT_CYW43_PM_VALUE(CYW43_PM2_POWERSAVE_MODE, 200, 1, 1, 10) +// CYW43_AGGRESSIVE_PM (except a compile-time constant) +#define PM_AGGRESSIVE CONSTANT_CYW43_PM_VALUE(CYW43_PM2_POWERSAVE_MODE, 2000, 1, 1, 10) +// CYW43_PERFORMANCE_PM (except a compile-time constant) +#define PM_PERFORMANCE CONSTANT_CYW43_PM_VALUE(CYW43_PM2_POWERSAVE_MODE, 20, 1, 1, 1) +// The 0xa11140 magic value +#define PM_DISABLED CONSTANT_CYW43_PM_VALUE(CYW43_NO_POWERSAVE_MODE, 200, 1, 1, 10) + +extern void bindings_cyw43_wifi_enforce_pm(void); diff --git a/ports/raspberrypi/bindings/rp2pio/StateMachine.c b/ports/raspberrypi/bindings/rp2pio/StateMachine.c index a69089696e..f45dc07357 100644 --- a/ports/raspberrypi/bindings/rp2pio/StateMachine.c +++ b/ports/raspberrypi/bindings/rp2pio/StateMachine.c @@ -40,7 +40,7 @@ #include "py/mperrno.h" #include "py/objproperty.h" #include "py/runtime.h" -#include "supervisor/shared/translate.h" +#include "supervisor/shared/translate/translate.h" //| class StateMachine: @@ -57,47 +57,48 @@ //| in either PIO. State machines with the same program will be placed in the //| same PIO if possible.""" //| -//| def __init__(self, -//| program: ReadableBuffer, -//| frequency: int, -//| *, -//| init: Optional[ReadableBuffer] = None, -//| first_out_pin: Optional[microcontroller.Pin] = None, -//| out_pin_count: int = 1, -//| initial_out_pin_state: int = 0, -//| initial_out_pin_direction: int = 0xffffffff, -//| first_in_pin: Optional[microcontroller.Pin] = None, -//| in_pin_count: int = 1, -//| pull_in_pin_up: int = 0, -//| pull_in_pin_down: int = 0, -//| first_set_pin: Optional[microcontroller.Pin] = None, -//| set_pin_count: int = 1, -//| initial_set_pin_state: int = 0, -//| initial_set_pin_direction: int = 0x1f, -//| first_sideset_pin: Optional[microcontroller.Pin] = None, -//| sideset_pin_count: int = 1, -//| initial_sideset_pin_state: int = 0, -//| initial_sideset_pin_direction: int = 0x1f, -//| sideset_enable: bool = False, -//| jmp_pin: Optional[microcontroller.Pin] = None, -//| jmp_pin_pull: Optional[digitalio.Pull] = None, -//| exclusive_pin_use: bool = True, -//| auto_pull: bool = False, -//| pull_threshold: int = 32, -//| out_shift_right: bool = True, -//| wait_for_txstall: bool = True, -//| auto_push: bool = False, -//| push_threshold: int = 32, -//| in_shift_right: bool = True, -//| user_interruptible: bool = True, -//| wrap_target: int = 0, -//| wrap: int = -1, -//| ) -> None: +//| def __init__( +//| self, +//| program: ReadableBuffer, +//| frequency: int, +//| *, +//| init: Optional[ReadableBuffer] = None, +//| first_out_pin: Optional[microcontroller.Pin] = None, +//| out_pin_count: int = 1, +//| initial_out_pin_state: int = 0, +//| initial_out_pin_direction: int = 0xFFFFFFFF, +//| first_in_pin: Optional[microcontroller.Pin] = None, +//| in_pin_count: int = 1, +//| pull_in_pin_up: int = 0, +//| pull_in_pin_down: int = 0, +//| first_set_pin: Optional[microcontroller.Pin] = None, +//| set_pin_count: int = 1, +//| initial_set_pin_state: int = 0, +//| initial_set_pin_direction: int = 0x1F, +//| first_sideset_pin: Optional[microcontroller.Pin] = None, +//| sideset_pin_count: int = 1, +//| initial_sideset_pin_state: int = 0, +//| initial_sideset_pin_direction: int = 0x1F, +//| sideset_enable: bool = False, +//| jmp_pin: Optional[microcontroller.Pin] = None, +//| jmp_pin_pull: Optional[digitalio.Pull] = None, +//| exclusive_pin_use: bool = True, +//| auto_pull: bool = False, +//| pull_threshold: int = 32, +//| out_shift_right: bool = True, +//| wait_for_txstall: bool = True, +//| auto_push: bool = False, +//| push_threshold: int = 32, +//| in_shift_right: bool = True, +//| user_interruptible: bool = True, +//| wrap_target: int = 0, +//| wrap: int = -1, +//| ) -> None: //| //| """Construct a StateMachine object on the given pins with the given program. //| //| :param ReadableBuffer program: the program to run with the state machine -//| :param int frequency: the target clock frequency of the state machine. Actual may be less. +//| :param int frequency: the target clock frequency of the state machine. Actual may be less. Use 0 for system clock speed. //| :param ReadableBuffer init: a program to run once at start up. This is run after program //| is started so instructions may be intermingled //| :param ~microcontroller.Pin first_out_pin: the first pin to use with the OUT instruction @@ -148,7 +149,6 @@ //| last instruction of the program. //| """ //| ... -//| STATIC mp_obj_t rp2pio_statemachine_make_new(const mp_obj_type_t *type, size_t n_args, size_t n_kw, const mp_obj_t *all_args) { rp2pio_statemachine_obj_t *self = m_new_obj(rp2pio_statemachine_obj_t); @@ -223,50 +223,31 @@ STATIC mp_obj_t rp2pio_statemachine_make_new(const mp_obj_type_t *type, size_t n // We don't validate pin in use here because we may be ok sharing them within a PIO. const mcu_pin_obj_t *first_out_pin = validate_obj_is_pin_or_none(args[ARG_first_out_pin].u_obj); - if (args[ARG_out_pin_count].u_int < 1) { - mp_raise_ValueError(translate("Pin count must be at least 1")); - } + mp_int_t out_pin_count = mp_arg_validate_int_min(args[ARG_out_pin_count].u_int, 1, MP_QSTR_out_pin_count); + const mcu_pin_obj_t *first_in_pin = validate_obj_is_pin_or_none(args[ARG_first_in_pin].u_obj); - if (args[ARG_in_pin_count].u_int < 1) { - mp_raise_ValueError(translate("Pin count must be at least 1")); - } + mp_int_t in_pin_count = mp_arg_validate_int_min(args[ARG_in_pin_count].u_int, 1, MP_QSTR_in_pin_count); + const mcu_pin_obj_t *first_set_pin = validate_obj_is_pin_or_none(args[ARG_first_set_pin].u_obj); - if (args[ARG_set_pin_count].u_int < 1) { - mp_raise_ValueError(translate("Pin count must be at least 1")); - } - if (args[ARG_set_pin_count].u_int > 5) { - mp_raise_ValueError(translate("Set pin count must be between 1 and 5")); - } + mp_int_t set_pin_count = mp_arg_validate_int_range(args[ARG_set_pin_count].u_int, 1, 5, MP_QSTR_set_pin_count); + const mcu_pin_obj_t *first_sideset_pin = validate_obj_is_pin_or_none(args[ARG_first_sideset_pin].u_obj); - if (args[ARG_sideset_pin_count].u_int < 1) { - mp_raise_ValueError(translate("Pin count must be at least 1")); - } - if (args[ARG_sideset_pin_count].u_int > 5) { - mp_raise_ValueError(translate("Side set pin count must be between 1 and 5")); - } + mp_int_t sideset_pin_count = mp_arg_validate_int_range(args[ARG_sideset_pin_count].u_int, 1, 5, MP_QSTR_set_pin_count); const mcu_pin_obj_t *jmp_pin = validate_obj_is_pin_or_none(args[ARG_jmp_pin].u_obj); digitalio_pull_t jmp_pin_pull = validate_pull(args[ARG_jmp_pin_pull].u_rom_obj, MP_QSTR_jmp_pull); - mp_int_t pull_threshold = args[ARG_pull_threshold].u_int; - mp_int_t push_threshold = args[ARG_push_threshold].u_int; - if (pull_threshold < 1 || pull_threshold > 32) { - mp_raise_ValueError(translate("pull_threshold must be between 1 and 32")); - } - if (push_threshold < 1 || push_threshold > 32) { - mp_raise_ValueError(translate("push_threshold must be between 1 and 32")); - } + mp_int_t pull_threshold = + mp_arg_validate_int_range(args[ARG_pull_threshold].u_int, 1, 32, MP_QSTR_pull_threshold); + mp_int_t push_threshold = + mp_arg_validate_int_range(args[ARG_push_threshold].u_int, 1, 32, MP_QSTR_push_threshold); - if (bufinfo.len < 2) { - mp_raise_ValueError(translate("Program must contain at least one 16-bit instruction.")); - } + mp_arg_validate_length_range(bufinfo.len, 2, 64, MP_QSTR_program); if (bufinfo.len % 2 != 0) { mp_raise_ValueError(translate("Program size invalid")); } - if (bufinfo.len > 64) { - mp_raise_ValueError(translate("Program too large")); - } + mp_arg_validate_length_range(init_bufinfo.len, 0, 64, MP_QSTR_init); if (init_bufinfo.len % 2 != 0) { mp_raise_ValueError(translate("Init program size invalid")); } @@ -278,10 +259,10 @@ STATIC mp_obj_t rp2pio_statemachine_make_new(const mp_obj_type_t *type, size_t n bufinfo.buf, bufinfo.len / 2, args[ARG_frequency].u_int, init_bufinfo.buf, init_bufinfo.len / 2, - first_out_pin, args[ARG_out_pin_count].u_int, args[ARG_initial_out_pin_state].u_int, args[ARG_initial_out_pin_direction].u_int, - first_in_pin, args[ARG_in_pin_count].u_int, args[ARG_pull_in_pin_up].u_int, args[ARG_pull_in_pin_down].u_int, - first_set_pin, args[ARG_set_pin_count].u_int, args[ARG_initial_set_pin_state].u_int, args[ARG_initial_set_pin_direction].u_int, - first_sideset_pin, args[ARG_sideset_pin_count].u_int, args[ARG_initial_sideset_pin_state].u_int, args[ARG_initial_sideset_pin_direction].u_int, + first_out_pin, out_pin_count, args[ARG_initial_out_pin_state].u_int, args[ARG_initial_out_pin_direction].u_int, + first_in_pin, in_pin_count, args[ARG_pull_in_pin_up].u_int, args[ARG_pull_in_pin_down].u_int, + first_set_pin, set_pin_count, args[ARG_initial_set_pin_state].u_int, args[ARG_initial_set_pin_direction].u_int, + first_sideset_pin, sideset_pin_count, args[ARG_initial_sideset_pin_state].u_int, args[ARG_initial_sideset_pin_direction].u_int, args[ARG_sideset_enable].u_bool, jmp_pin, jmp_pin_pull, 0, @@ -297,7 +278,6 @@ STATIC mp_obj_t rp2pio_statemachine_make_new(const mp_obj_type_t *type, size_t n //| def deinit(self) -> None: //| """Turn off the state machine and release its resources.""" //| ... -//| STATIC mp_obj_t rp2pio_statemachine_obj_deinit(mp_obj_t self_in) { rp2pio_statemachine_obj_t *self = MP_OBJ_TO_PTR(self_in); common_hal_rp2pio_statemachine_deinit(self); @@ -309,13 +289,11 @@ MP_DEFINE_CONST_FUN_OBJ_1(rp2pio_statemachine_deinit_obj, rp2pio_statemachine_ob //| """No-op used by Context Managers. //| Provided by context manager helper.""" //| ... -//| //| def __exit__(self) -> None: //| """Automatically deinitializes the hardware when exiting a context. See //| :ref:`lifetime-and-contextmanagers` for more info.""" //| ... -//| STATIC mp_obj_t rp2pio_statemachine_obj___exit__(size_t n_args, const mp_obj_t *args) { (void)n_args; common_hal_rp2pio_statemachine_deinit(args[0]); @@ -332,9 +310,8 @@ STATIC void check_for_deinit(rp2pio_statemachine_obj_t *self) { //| def restart(self) -> None: //| """Resets this state machine, runs any init and enables the clock.""" -// TODO: "and any others given. They must share an underlying PIO. An exception will be raised otherwise."" //| ... -//| +// TODO: "and any others given. They must share an underlying PIO. An exception will be raised otherwise."" STATIC mp_obj_t rp2pio_statemachine_restart(mp_obj_t self_obj) { rp2pio_statemachine_obj_t *self = MP_OBJ_TO_PTR(self_obj); check_for_deinit(self); @@ -347,12 +324,11 @@ MP_DEFINE_CONST_FUN_OBJ_1(rp2pio_statemachine_restart_obj, rp2pio_statemachine_r //| def run(self, instructions: ReadableBuffer) -> None: //| """Runs all given instructions. They will likely be interleaved with -//| in-memory instructions. Make sure this doesn't wait for input! +//| in-memory instructions. Make sure this doesn't wait for input! //| -//| This can be used to output internal state to the RX FIFO and then -//| read with `readinto`.""" +//| This can be used to output internal state to the RX FIFO and then +//| read with `readinto`.""" //| ... -//| STATIC mp_obj_t rp2pio_statemachine_run(mp_obj_t self_obj, mp_obj_t instruction_obj) { rp2pio_statemachine_obj_t *self = MP_OBJ_TO_PTR(self_obj); check_for_deinit(self); @@ -368,7 +344,6 @@ MP_DEFINE_CONST_FUN_OBJ_2(rp2pio_statemachine_run_obj, rp2pio_statemachine_run); //| def stop(self) -> None: //| """Stops the state machine clock. Use `restart` to enable it.""" //| ... -//| STATIC mp_obj_t rp2pio_statemachine_stop(mp_obj_t self_obj) { rp2pio_statemachine_obj_t *self = MP_OBJ_TO_PTR(self_obj); check_for_deinit(self); @@ -378,7 +353,14 @@ STATIC mp_obj_t rp2pio_statemachine_stop(mp_obj_t self_obj) { } MP_DEFINE_CONST_FUN_OBJ_1(rp2pio_statemachine_stop_obj, rp2pio_statemachine_stop); -//| def write(self, buffer: ReadableBuffer, *, start: int = 0, end: Optional[int] = None, swap: bool = False) -> None: +//| def write( +//| self, +//| buffer: ReadableBuffer, +//| *, +//| start: int = 0, +//| end: Optional[int] = None, +//| swap: bool = False, +//| ) -> None: //| """Write the data contained in ``buffer`` to the state machine. If the buffer is empty, nothing happens. //| //| Writes to the FIFO will match the input buffer's element size. For example, bytearray elements @@ -393,7 +375,6 @@ MP_DEFINE_CONST_FUN_OBJ_1(rp2pio_statemachine_stop_obj, rp2pio_statemachine_stop //| :param int end: End of the slice; this index is not included. Defaults to ``len(buffer)`` //| :param bool swap: For 2- and 4-byte elements, swap (reverse) the byte order""" //| ... -//| STATIC mp_obj_t rp2pio_statemachine_write(size_t n_args, const mp_obj_t *pos_args, mp_map_t *kw_args) { enum { ARG_buffer, ARG_start, ARG_end, ARG_swap }; static const mp_arg_t allowed_args[] = { @@ -416,7 +397,6 @@ STATIC mp_obj_t rp2pio_statemachine_write(size_t n_args, const mp_obj_t *pos_arg return mp_const_none; } - uint8_t *original_pointer = bufinfo.buf; int stride_in_bytes = mp_binary_get_size('@', bufinfo.typecode, NULL); if (stride_in_bytes > 4) { mp_raise_ValueError(translate("Buffer elements must be 4 bytes long or less")); @@ -433,7 +413,13 @@ STATIC mp_obj_t rp2pio_statemachine_write(size_t n_args, const mp_obj_t *pos_arg } MP_DEFINE_CONST_FUN_OBJ_KW(rp2pio_statemachine_write_obj, 2, rp2pio_statemachine_write); -//| def background_write(self, once: Optional[ReadableBuffer]=None, *, loop: Optional[ReadableBuffer]=None, swap: bool=False) -> None: +//| def background_write( +//| self, +//| once: Optional[ReadableBuffer] = None, +//| *, +//| loop: Optional[ReadableBuffer] = None, +//| swap: bool = False, +//| ) -> None: //| """Write data to the TX fifo in the background, with optional looping. //| //| First, if any previous ``once`` or ``loop`` buffer has not been started, this function blocks until they have. @@ -470,7 +456,6 @@ MP_DEFINE_CONST_FUN_OBJ_KW(rp2pio_statemachine_write_obj, 2, rp2pio_statemachine //| :param bool swap: For 2- and 4-byte elements, swap (reverse) the byte order //| """ //| ... -//| STATIC void fill_buf_info(sm_buf_info *info, mp_obj_t obj, size_t *stride_in_bytes) { if (obj != mp_const_none) { @@ -526,7 +511,6 @@ MP_DEFINE_CONST_FUN_OBJ_KW(rp2pio_statemachine_background_write_obj, 1, rp2pio_s //| """Immediately stop a background write, if one is in progress. Any //| DMA in progress is halted, but items already in the TX FIFO are not //| affected.""" -//| STATIC mp_obj_t rp2pio_statemachine_obj_stop_background_write(mp_obj_t self_in) { rp2pio_statemachine_obj_t *self = MP_OBJ_TO_PTR(self_in); bool ok = common_hal_rp2pio_statemachine_stop_background_write(self); @@ -540,10 +524,8 @@ STATIC mp_obj_t rp2pio_statemachine_obj_stop_background_write(mp_obj_t self_in) } MP_DEFINE_CONST_FUN_OBJ_1(rp2pio_statemachine_stop_background_write_obj, rp2pio_statemachine_obj_stop_background_write); -//| @property -//| def writing(self) -> bool: -//| """Returns True if a background write is in progress""" -//| +//| writing: bool +//| """Returns True if a background write is in progress""" STATIC mp_obj_t rp2pio_statemachine_obj_get_writing(mp_obj_t self_in) { rp2pio_statemachine_obj_t *self = MP_OBJ_TO_PTR(self_in); return mp_obj_new_bool(common_hal_rp2pio_statemachine_get_writing(self)); @@ -558,12 +540,10 @@ const mp_obj_property_t rp2pio_statemachine_writing_obj = { }; -//| @property -//| def pending(self) -> int: -//| """Returns the number of pending buffers for background writing. -//| -//| If the number is 0, then a `StateMachine.background_write` call will not block.""" +//| pending: int +//| """Returns the number of pending buffers for background writing. //| +//| If the number is 0, then a `StateMachine.background_write` call will not block.""" STATIC mp_obj_t rp2pio_statemachine_obj_get_pending(mp_obj_t self_in) { rp2pio_statemachine_obj_t *self = MP_OBJ_TO_PTR(self_in); return mp_obj_new_int(common_hal_rp2pio_statemachine_get_pending(self)); @@ -577,7 +557,14 @@ const mp_obj_property_t rp2pio_statemachine_pending_obj = { MP_ROM_NONE}, }; -//| def readinto(self, buffer: WriteableBuffer, *, start: int = 0, end: Optional[int] = None, swap: bool=False) -> None: +//| def readinto( +//| self, +//| buffer: WriteableBuffer, +//| *, +//| start: int = 0, +//| end: Optional[int] = None, +//| swap: bool = False, +//| ) -> None: //| """Read into ``buffer``. If the number of bytes to read is 0, nothing happens. The buffer //| includes any data added to the fifo even if it was added before this was called. //| @@ -594,7 +581,6 @@ const mp_obj_property_t rp2pio_statemachine_pending_obj = { //| :param int end: End of the slice; this index is not included. Defaults to ``len(buffer)`` //| :param bool swap: For 2- and 4-byte elements, swap (reverse) the byte order""" //| ... -//| STATIC mp_obj_t rp2pio_statemachine_readinto(size_t n_args, const mp_obj_t *pos_args, mp_map_t *kw_args) { enum { ARG_buffer, ARG_start, ARG_end, ARG_swap }; @@ -619,7 +605,6 @@ STATIC mp_obj_t rp2pio_statemachine_readinto(size_t n_args, const mp_obj_t *pos_ return mp_const_none; } - uint8_t *original_pointer = bufinfo.buf; int stride_in_bytes = mp_binary_get_size('@', bufinfo.typecode, NULL); if (stride_in_bytes > 4) { mp_raise_ValueError(translate("Buffer elements must be 4 bytes long or less")); @@ -633,7 +618,16 @@ STATIC mp_obj_t rp2pio_statemachine_readinto(size_t n_args, const mp_obj_t *pos_ } MP_DEFINE_CONST_FUN_OBJ_KW(rp2pio_statemachine_readinto_obj, 2, rp2pio_statemachine_readinto); -//| def write_readinto(self, buffer_out: ReadableBuffer, buffer_in: WriteableBuffer, *, out_start: int = 0, out_end: Optional[int] = None, in_start: int = 0, in_end: Optional[int] = None) -> None: +//| def write_readinto( +//| self, +//| buffer_out: ReadableBuffer, +//| buffer_in: WriteableBuffer, +//| *, +//| out_start: int = 0, +//| out_end: Optional[int] = None, +//| in_start: int = 0, +//| in_end: Optional[int] = None, +//| ) -> None: //| """Write out the data in ``buffer_out`` while simultaneously reading data into ``buffer_in``. //| The lengths of the slices defined by ``buffer_out[out_start:out_end]`` and ``buffer_in[in_start:in_end]`` //| may be different. The function will return once both are filled. @@ -654,7 +648,6 @@ MP_DEFINE_CONST_FUN_OBJ_KW(rp2pio_statemachine_readinto_obj, 2, rp2pio_statemach //| :param bool swap_out: For 2- and 4-byte elements, swap (reverse) the byte order for the buffer being transmitted (written) //| :param bool swap_in: For 2- and 4-rx elements, swap (reverse) the byte order for the buffer being received (read)""" //| ... -//| STATIC mp_obj_t rp2pio_statemachine_write_readinto(size_t n_args, const mp_obj_t *pos_args, mp_map_t *kw_args) { enum { ARG_buffer_out, ARG_buffer_in, ARG_out_start, ARG_out_end, ARG_in_start, ARG_in_end, ARG_swap_out, ARG_swap_in }; @@ -716,7 +709,6 @@ MP_DEFINE_CONST_FUN_OBJ_KW(rp2pio_statemachine_write_readinto_obj, 2, rp2pio_sta //| def clear_rxfifo(self) -> None: //| """Clears any unread bytes in the rxfifo.""" //| ... -//| STATIC mp_obj_t rp2pio_statemachine_obj_clear_rxfifo(mp_obj_t self_in) { rp2pio_statemachine_obj_t *self = MP_OBJ_TO_PTR(self_in); common_hal_rp2pio_statemachine_clear_rxfifo(self); @@ -727,7 +719,6 @@ MP_DEFINE_CONST_FUN_OBJ_1(rp2pio_statemachine_clear_rxfifo_obj, rp2pio_statemach //| def clear_txstall(self) -> None: //| """Clears the txstall flag.""" //| ... -//| STATIC mp_obj_t rp2pio_statemachine_obj_clear_txstall(mp_obj_t self_in) { rp2pio_statemachine_obj_t *self = MP_OBJ_TO_PTR(self_in); common_hal_rp2pio_statemachine_clear_txstall(self); @@ -739,7 +730,6 @@ MP_DEFINE_CONST_FUN_OBJ_1(rp2pio_statemachine_clear_txstall_obj, rp2pio_statemac //| frequency: int //| """The actual state machine frequency. This may not match the frequency requested //| due to internal limitations.""" -//| STATIC mp_obj_t rp2pio_statemachine_obj_get_frequency(mp_obj_t self_in) { rp2pio_statemachine_obj_t *self = MP_OBJ_TO_PTR(self_in); @@ -764,7 +754,6 @@ MP_PROPERTY_GETSET(rp2pio_statemachine_frequency_obj, //| txstall: bool //| """True when the state machine has stalled due to a full TX FIFO since the last //| `clear_txstall` call.""" -//| STATIC mp_obj_t rp2pio_statemachine_obj_get_txstall(mp_obj_t self_in) { rp2pio_statemachine_obj_t *self = MP_OBJ_TO_PTR(self_in); @@ -784,7 +773,6 @@ const mp_obj_property_t rp2pio_statemachine_txstall_obj = { //| rxstall: bool //| """True when the state machine has stalled due to a full RX FIFO since the last //| `clear_rxfifo` call.""" -//| STATIC mp_obj_t rp2pio_statemachine_obj_get_rxstall(mp_obj_t self_in) { rp2pio_statemachine_obj_t *self = MP_OBJ_TO_PTR(self_in); @@ -842,10 +830,3 @@ const mp_obj_type_t rp2pio_statemachine_type = { .make_new = rp2pio_statemachine_make_new, .locals_dict = (mp_obj_dict_t *)&rp2pio_statemachine_locals_dict, }; - -static rp2pio_statemachine_obj_t *validate_obj_is_statemachine(mp_obj_t obj) { - if (!mp_obj_is_type(obj, &rp2pio_statemachine_type)) { - mp_raise_TypeError_varg(translate("Expected a %q"), rp2pio_statemachine_type.name); - } - return MP_OBJ_TO_PTR(obj); -} diff --git a/ports/raspberrypi/bindings/rp2pio/__init__.c b/ports/raspberrypi/bindings/rp2pio/__init__.c index 941ede2e12..6256d4d898 100644 --- a/ports/raspberrypi/bindings/rp2pio/__init__.c +++ b/ports/raspberrypi/bindings/rp2pio/__init__.c @@ -38,7 +38,6 @@ //| Learn guide `_. //| //| """ -//| //| def pins_are_sequential(pins: List[microcontroller.Pin]) -> bool: //| """Return True if the pins have sequential GPIO numbers, False otherwise""" diff --git a/ports/raspberrypi/boards/adafruit_feather_rp2040/board.c b/ports/raspberrypi/boards/adafruit_feather_rp2040/board.c index eac54ce460..331653173e 100644 --- a/ports/raspberrypi/boards/adafruit_feather_rp2040/board.c +++ b/ports/raspberrypi/boards/adafruit_feather_rp2040/board.c @@ -26,18 +26,4 @@ #include "supervisor/board.h" -#include "shared-bindings/microcontroller/Pin.h" -#include "src/rp2_common/hardware_gpio/include/hardware/gpio.h" - -void board_init(void) { -} - -bool board_requests_safe_mode(void) { - return false; -} - -void reset_board(void) { -} - -void board_deinit(void) { -} +// Use the MP_WEAK supervisor/shared/board.c versions of routines not defined here. diff --git a/ports/raspberrypi/boards/adafruit_itsybitsy_rp2040/board.c b/ports/raspberrypi/boards/adafruit_itsybitsy_rp2040/board.c index de6e424ed9..331653173e 100644 --- a/ports/raspberrypi/boards/adafruit_itsybitsy_rp2040/board.c +++ b/ports/raspberrypi/boards/adafruit_itsybitsy_rp2040/board.c @@ -26,15 +26,4 @@ #include "supervisor/board.h" -void board_init(void) { -} - -bool board_requests_safe_mode(void) { - return false; -} - -void reset_board(void) { -} - -void board_deinit(void) { -} +// Use the MP_WEAK supervisor/shared/board.c versions of routines not defined here. diff --git a/ports/raspberrypi/boards/adafruit_kb2040/board.c b/ports/raspberrypi/boards/adafruit_kb2040/board.c index eac54ce460..331653173e 100644 --- a/ports/raspberrypi/boards/adafruit_kb2040/board.c +++ b/ports/raspberrypi/boards/adafruit_kb2040/board.c @@ -26,18 +26,4 @@ #include "supervisor/board.h" -#include "shared-bindings/microcontroller/Pin.h" -#include "src/rp2_common/hardware_gpio/include/hardware/gpio.h" - -void board_init(void) { -} - -bool board_requests_safe_mode(void) { - return false; -} - -void reset_board(void) { -} - -void board_deinit(void) { -} +// Use the MP_WEAK supervisor/shared/board.c versions of routines not defined here. diff --git a/ports/raspberrypi/boards/adafruit_macropad_rp2040/board.c b/ports/raspberrypi/boards/adafruit_macropad_rp2040/board.c index 7b00ff7ecc..b5cef1639d 100644 --- a/ports/raspberrypi/boards/adafruit_macropad_rp2040/board.c +++ b/ports/raspberrypi/boards/adafruit_macropad_rp2040/board.c @@ -97,17 +97,13 @@ void board_init(void) { NULL, 0x81, 1.0f, // brightness - false, // auto_brightness true, // single_byte_bounds true, // data as commands true, // auto_refresh 60, // native_frames_per_second true, // backlight_on_high - true); // SH1107_addressing -} - -bool board_requests_safe_mode(void) { - return false; + true, // SH1107_addressing + 50000); // backlight pwm frequency } void reset_board(void) { @@ -115,5 +111,4 @@ void reset_board(void) { board_reset_user_neopixels(&pin_GPIO19, 12); } -void board_deinit(void) { -} +// Use the MP_WEAK supervisor/shared/board.c versions of routines not defined here. diff --git a/ports/raspberrypi/boards/adafruit_qt2040_trinkey/board.c b/ports/raspberrypi/boards/adafruit_qt2040_trinkey/board.c index eac54ce460..c94078ae60 100644 --- a/ports/raspberrypi/boards/adafruit_qt2040_trinkey/board.c +++ b/ports/raspberrypi/boards/adafruit_qt2040_trinkey/board.c @@ -29,15 +29,4 @@ #include "shared-bindings/microcontroller/Pin.h" #include "src/rp2_common/hardware_gpio/include/hardware/gpio.h" -void board_init(void) { -} - -bool board_requests_safe_mode(void) { - return false; -} - -void reset_board(void) { -} - -void board_deinit(void) { -} +// Use the MP_WEAK supervisor/shared/board.c versions of routines not defined here. diff --git a/ports/raspberrypi/boards/adafruit_qtpy_rp2040/board.c b/ports/raspberrypi/boards/adafruit_qtpy_rp2040/board.c index de6e424ed9..331653173e 100644 --- a/ports/raspberrypi/boards/adafruit_qtpy_rp2040/board.c +++ b/ports/raspberrypi/boards/adafruit_qtpy_rp2040/board.c @@ -26,15 +26,4 @@ #include "supervisor/board.h" -void board_init(void) { -} - -bool board_requests_safe_mode(void) { - return false; -} - -void reset_board(void) { -} - -void board_deinit(void) { -} +// Use the MP_WEAK supervisor/shared/board.c versions of routines not defined here. diff --git a/ports/raspberrypi/boards/arduino_nano_rp2040_connect/board.c b/ports/raspberrypi/boards/arduino_nano_rp2040_connect/board.c index de6e424ed9..331653173e 100644 --- a/ports/raspberrypi/boards/arduino_nano_rp2040_connect/board.c +++ b/ports/raspberrypi/boards/arduino_nano_rp2040_connect/board.c @@ -26,15 +26,4 @@ #include "supervisor/board.h" -void board_init(void) { -} - -bool board_requests_safe_mode(void) { - return false; -} - -void reset_board(void) { -} - -void board_deinit(void) { -} +// Use the MP_WEAK supervisor/shared/board.c versions of routines not defined here. diff --git a/ports/raspberrypi/boards/bwshockley_figpi/board.c b/ports/raspberrypi/boards/bwshockley_figpi/board.c new file mode 100644 index 0000000000..331653173e --- /dev/null +++ b/ports/raspberrypi/boards/bwshockley_figpi/board.c @@ -0,0 +1,29 @@ +/* + * This file is part of the MicroPython project, http://micropython.org/ + * + * The MIT License (MIT) + * + * Copyright (c) 2021 Scott Shawcroft for Adafruit Industries + * + * Permission is hereby granted, free of charge, to any person obtaining a copy + * of this software and associated documentation files (the "Software"), to deal + * in the Software without restriction, including without limitation the rights + * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell + * copies of the Software, and to permit persons to whom the Software is + * furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice shall be included in + * all copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE + * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER + * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, + * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN + * THE SOFTWARE. + */ + +#include "supervisor/board.h" + +// Use the MP_WEAK supervisor/shared/board.c versions of routines not defined here. diff --git a/ports/raspberrypi/boards/bwshockley_figpi/mpconfigboard.h b/ports/raspberrypi/boards/bwshockley_figpi/mpconfigboard.h new file mode 100644 index 0000000000..fbd03379dd --- /dev/null +++ b/ports/raspberrypi/boards/bwshockley_figpi/mpconfigboard.h @@ -0,0 +1,15 @@ +#define MICROPY_HW_BOARD_NAME "Fig Pi" +#define MICROPY_HW_MCU_NAME "rp2040" + +#define MICROPY_HW_NEOPIXEL (&pin_GPIO13) +#define CIRCUITPY_STATUS_LED_POWER (&pin_GPIO1) + +#define CIRCUITPY_BOARD_I2C (2) +#define CIRCUITPY_BOARD_I2C_PIN {{.scl = &pin_GPIO17, .sda = &pin_GPIO16}, \ + {.scl = &pin_GPIO19, .sda = &pin_GPIO18}} + +#define CIRCUITPY_BOARD_SPI (1) +#define CIRCUITPY_BOARD_SPI_PIN {{.clock = &pin_GPIO6, .mosi = &pin_GPIO7, .miso = &pin_GPIO4}} + +#define CIRCUITPY_BOARD_UART (1) +#define CIRCUITPY_BOARD_UART_PIN {{.tx = &pin_GPIO24, .rx = &pin_GPIO25}} diff --git a/ports/raspberrypi/boards/bwshockley_figpi/mpconfigboard.mk b/ports/raspberrypi/boards/bwshockley_figpi/mpconfigboard.mk new file mode 100644 index 0000000000..95bd9715d6 --- /dev/null +++ b/ports/raspberrypi/boards/bwshockley_figpi/mpconfigboard.mk @@ -0,0 +1,9 @@ +USB_VID = 0x2019 +USB_PID = 0x7103 +USB_PRODUCT = "Fig Pi" +USB_MANUFACTURER = "Benjamin Shockley" + +CHIP_VARIANT = RP2040 +CHIP_FAMILY = rp2 + +EXTERNAL_FLASH_DEVICES = "W25Q16JVxQ" diff --git a/ports/raspberrypi/boards/bwshockley_figpi/pico-sdk-configboard.h b/ports/raspberrypi/boards/bwshockley_figpi/pico-sdk-configboard.h new file mode 100644 index 0000000000..a41131dd22 --- /dev/null +++ b/ports/raspberrypi/boards/bwshockley_figpi/pico-sdk-configboard.h @@ -0,0 +1,4 @@ +// Put board-specific pico-sdk definitions here. This file must exist. + +// Allow extra time for xosc to start. +#define PICO_XOSC_STARTUP_DELAY_MULTIPLIER 64 diff --git a/ports/raspberrypi/boards/bwshockley_figpi/pins.c b/ports/raspberrypi/boards/bwshockley_figpi/pins.c new file mode 100644 index 0000000000..1bec6fd91b --- /dev/null +++ b/ports/raspberrypi/boards/bwshockley_figpi/pins.c @@ -0,0 +1,62 @@ +#include "shared-bindings/board/__init__.h" + +CIRCUITPY_BOARD_BUS_SINGLETON(stemma_i2c, i2c, 1) + +STATIC const mp_rom_map_elem_t board_module_globals_table[] = { + CIRCUITPYTHON_BOARD_DICT_STANDARD_ITEMS + + { MP_ROM_QSTR(MP_QSTR_A0), MP_ROM_PTR(&pin_GPIO29) }, + { MP_ROM_QSTR(MP_QSTR_D0), MP_ROM_PTR(&pin_GPIO29) }, + + { MP_ROM_QSTR(MP_QSTR_A1), MP_ROM_PTR(&pin_GPIO28) }, + { MP_ROM_QSTR(MP_QSTR_D1), MP_ROM_PTR(&pin_GPIO28) }, + + { MP_ROM_QSTR(MP_QSTR_A2), MP_ROM_PTR(&pin_GPIO27) }, + { MP_ROM_QSTR(MP_QSTR_D2), MP_ROM_PTR(&pin_GPIO27) }, + + { MP_ROM_QSTR(MP_QSTR_A3), MP_ROM_PTR(&pin_GPIO26) }, + { MP_ROM_QSTR(MP_QSTR_D3), MP_ROM_PTR(&pin_GPIO26) }, + + { MP_ROM_QSTR(MP_QSTR_SDA), MP_ROM_PTR(&pin_GPIO16) }, + { MP_ROM_QSTR(MP_QSTR_D4), MP_ROM_PTR(&pin_GPIO16) }, + + { MP_ROM_QSTR(MP_QSTR_SCL), MP_ROM_PTR(&pin_GPIO17) }, + { MP_ROM_QSTR(MP_QSTR_D5), MP_ROM_PTR(&pin_GPIO17) }, + + { MP_ROM_QSTR(MP_QSTR_TX), MP_ROM_PTR(&pin_GPIO24) }, + { MP_ROM_QSTR(MP_QSTR_D6), MP_ROM_PTR(&pin_GPIO24) }, + + { MP_ROM_QSTR(MP_QSTR_RX), MP_ROM_PTR(&pin_GPIO25) }, + { MP_ROM_QSTR(MP_QSTR_D7), MP_ROM_PTR(&pin_GPIO25) }, + + { MP_ROM_QSTR(MP_QSTR_SCK), MP_ROM_PTR(&pin_GPIO6) }, + { MP_ROM_QSTR(MP_QSTR_D8), MP_ROM_PTR(&pin_GPIO6) }, + + { MP_ROM_QSTR(MP_QSTR_MISO), MP_ROM_PTR(&pin_GPIO4) }, + { MP_ROM_QSTR(MP_QSTR_D9), MP_ROM_PTR(&pin_GPIO4) }, + + { MP_ROM_QSTR(MP_QSTR_MOSI), MP_ROM_PTR(&pin_GPIO7) }, + { MP_ROM_QSTR(MP_QSTR_D10), MP_ROM_PTR(&pin_GPIO7) }, + + { MP_ROM_QSTR(MP_QSTR_D11), MP_ROM_PTR(&pin_GPIO23) }, + { MP_ROM_QSTR(MP_QSTR_D12), MP_ROM_PTR(&pin_GPIO22) }, + { MP_ROM_QSTR(MP_QSTR_D14), MP_ROM_PTR(&pin_GPIO5) }, + { MP_ROM_QSTR(MP_QSTR_D15), MP_ROM_PTR(&pin_GPIO3) }, + { MP_ROM_QSTR(MP_QSTR_D16), MP_ROM_PTR(&pin_GPIO2) }, + { MP_ROM_QSTR(MP_QSTR_D17), MP_ROM_PTR(&pin_GPIO1) }, + + { MP_ROM_QSTR(MP_QSTR_NEOPIXEL), MP_ROM_PTR(&pin_GPIO13) }, + { MP_ROM_QSTR(MP_QSTR_NEOPIXEL_POWER), MP_ROM_PTR(&pin_GPIO1) }, + + { MP_ROM_QSTR(MP_QSTR_BUTTON), MP_ROM_PTR(&pin_GPIO20) }, + + { MP_ROM_QSTR(MP_QSTR_SDA1), MP_ROM_PTR(&pin_GPIO18) }, + { MP_ROM_QSTR(MP_QSTR_SCL1), MP_ROM_PTR(&pin_GPIO19) }, + + { 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) }, + + { MP_ROM_QSTR(MP_QSTR_STEMMA_I2C), MP_ROM_PTR(&board_stemma_i2c_obj) }, +}; +MP_DEFINE_CONST_DICT(board_module_globals, board_module_globals_table); diff --git a/ports/raspberrypi/boards/challenger_nb_rp2040_wifi/board.c b/ports/raspberrypi/boards/challenger_nb_rp2040_wifi/board.c index de6e424ed9..331653173e 100644 --- a/ports/raspberrypi/boards/challenger_nb_rp2040_wifi/board.c +++ b/ports/raspberrypi/boards/challenger_nb_rp2040_wifi/board.c @@ -26,15 +26,4 @@ #include "supervisor/board.h" -void board_init(void) { -} - -bool board_requests_safe_mode(void) { - return false; -} - -void reset_board(void) { -} - -void board_deinit(void) { -} +// Use the MP_WEAK supervisor/shared/board.c versions of routines not defined here. diff --git a/ports/raspberrypi/boards/challenger_nb_rp2040_wifi/mpconfigboard.h b/ports/raspberrypi/boards/challenger_nb_rp2040_wifi/mpconfigboard.h index 013b8e9276..a3f79af481 100644 --- a/ports/raspberrypi/boards/challenger_nb_rp2040_wifi/mpconfigboard.h +++ b/ports/raspberrypi/boards/challenger_nb_rp2040_wifi/mpconfigboard.h @@ -5,6 +5,3 @@ #define DEFAULT_UART_BUS_RX (&pin_GPIO17) #define DEFAULT_I2C_BUS_SDA (&pin_GPIO0) #define DEFAULT_I2C_BUS_SCL (&pin_GPIO1) -#define DEFAULT_SPI_BUS_SCK (&pin_GPIO22) -#define DEFAULT_SPI_BUS_MOSI (&pin_GPIO23) -#define DEFAULT_SPI_BUS_MISO (&pin_GPIO24) diff --git a/ports/raspberrypi/boards/challenger_rp2040_lora/board.c b/ports/raspberrypi/boards/challenger_rp2040_lora/board.c new file mode 100644 index 0000000000..b66ea0e27f --- /dev/null +++ b/ports/raspberrypi/boards/challenger_rp2040_lora/board.c @@ -0,0 +1,29 @@ +/* + * This file is part of the MicroPython project, http://micropython.org/ + * + * The MIT License (MIT) + * + * Copyright (c) 2022 Pontus Oldberg, Invector Labs + * + * Permission is hereby granted, free of charge, to any person obtaining a copy + * of this software and associated documentation files (the "Software"), to deal + * in the Software without restriction, including without limitation the rights + * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell + * copies of the Software, and to permit persons to whom the Software is + * furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice shall be included in + * all copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE + * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER + * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, + * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN + * THE SOFTWARE. + */ + +#include "supervisor/board.h" + +// Use the MP_WEAK supervisor/shared/board.c versions of routines not defined here. diff --git a/ports/raspberrypi/boards/challenger_rp2040_lora/mpconfigboard.h b/ports/raspberrypi/boards/challenger_rp2040_lora/mpconfigboard.h new file mode 100644 index 0000000000..a5245b98fe --- /dev/null +++ b/ports/raspberrypi/boards/challenger_rp2040_lora/mpconfigboard.h @@ -0,0 +1,10 @@ +#define MICROPY_HW_BOARD_NAME "Challenger RP2040 LoRa" +#define MICROPY_HW_MCU_NAME "rp2040" + +#define DEFAULT_UART_BUS_TX (&pin_GPIO16) +#define DEFAULT_UART_BUS_RX (&pin_GPIO17) +#define DEFAULT_I2C_BUS_SDA (&pin_GPIO0) +#define DEFAULT_I2C_BUS_SCL (&pin_GPIO1) +#define DEFAULT_SPI_BUS_SCK (&pin_GPIO22) +#define DEFAULT_SPI_BUS_MOSI (&pin_GPIO23) +#define DEFAULT_SPI_BUS_MISO (&pin_GPIO20) diff --git a/ports/raspberrypi/boards/challenger_rp2040_lora/mpconfigboard.mk b/ports/raspberrypi/boards/challenger_rp2040_lora/mpconfigboard.mk new file mode 100644 index 0000000000..1150bfb331 --- /dev/null +++ b/ports/raspberrypi/boards/challenger_rp2040_lora/mpconfigboard.mk @@ -0,0 +1,13 @@ +USB_VID = 0x2e8a +USB_PID = 0x1023 +USB_PRODUCT = "Challenger RP2040 LoRa" +USB_MANUFACTURER = "Invector Labs" + +CHIP_VARIANT = RP2040 +CHIP_FAMILY = rp2 + +EXTERNAL_FLASH_DEVICES = "W25Q64JVxQ" + +CIRCUITPY__EVE = 1 + +FROZEN_MPY_DIRS += $(TOP)/frozen/Adafruit_CircuitPython_RFM9x diff --git a/ports/raspberrypi/boards/challenger_rp2040_lora/pico-sdk-configboard.h b/ports/raspberrypi/boards/challenger_rp2040_lora/pico-sdk-configboard.h new file mode 100644 index 0000000000..36da55d457 --- /dev/null +++ b/ports/raspberrypi/boards/challenger_rp2040_lora/pico-sdk-configboard.h @@ -0,0 +1 @@ +// Put board-specific pico-sdk definitions here. This file must exist. diff --git a/ports/raspberrypi/boards/challenger_rp2040_lora/pins.c b/ports/raspberrypi/boards/challenger_rp2040_lora/pins.c new file mode 100644 index 0000000000..0eff192f9f --- /dev/null +++ b/ports/raspberrypi/boards/challenger_rp2040_lora/pins.c @@ -0,0 +1,85 @@ +#include "shared-bindings/board/__init__.h" + +STATIC const mp_rom_map_elem_t board_module_globals_table[] = { + CIRCUITPYTHON_BOARD_DICT_STANDARD_ITEMS + + { MP_ROM_QSTR(MP_QSTR_SDA), MP_ROM_PTR(&pin_GPIO0) }, + { MP_ROM_QSTR(MP_QSTR_GP0), MP_ROM_PTR(&pin_GPIO0) }, + { MP_ROM_QSTR(MP_QSTR_SCL), MP_ROM_PTR(&pin_GPIO1) }, + { MP_ROM_QSTR(MP_QSTR_GP1), MP_ROM_PTR(&pin_GPIO1) }, + + { MP_ROM_QSTR(MP_QSTR_D5), MP_ROM_PTR(&pin_GPIO2) }, + { MP_ROM_QSTR(MP_QSTR_GP2), MP_ROM_PTR(&pin_GPIO2) }, + { MP_ROM_QSTR(MP_QSTR_D6), MP_ROM_PTR(&pin_GPIO3) }, + { MP_ROM_QSTR(MP_QSTR_GP3), MP_ROM_PTR(&pin_GPIO3) }, + + { MP_ROM_QSTR(MP_QSTR_D9), MP_ROM_PTR(&pin_GPIO4) }, + { MP_ROM_QSTR(MP_QSTR_GP4), MP_ROM_PTR(&pin_GPIO4) }, + { MP_ROM_QSTR(MP_QSTR_D10), MP_ROM_PTR(&pin_GPIO5) }, + { MP_ROM_QSTR(MP_QSTR_GP5), MP_ROM_PTR(&pin_GPIO5) }, + { MP_ROM_QSTR(MP_QSTR_D11), MP_ROM_PTR(&pin_GPIO6) }, + { MP_ROM_QSTR(MP_QSTR_GP6), MP_ROM_PTR(&pin_GPIO6) }, + { MP_ROM_QSTR(MP_QSTR_D12), MP_ROM_PTR(&pin_GPIO7) }, + { MP_ROM_QSTR(MP_QSTR_GP7), MP_ROM_PTR(&pin_GPIO7) }, + { MP_ROM_QSTR(MP_QSTR_D13), MP_ROM_PTR(&pin_GPIO8) }, + { MP_ROM_QSTR(MP_QSTR_GP8), MP_ROM_PTR(&pin_GPIO8) }, + + // RFM95W connections + { MP_ROM_QSTR(MP_QSTR_RFM95W_CS), MP_ROM_PTR(&pin_GPIO9) }, + { MP_ROM_QSTR(MP_QSTR_GP9), MP_ROM_PTR(&pin_GPIO9) }, + { MP_ROM_QSTR(MP_QSTR_RFM95W_SCK), MP_ROM_PTR(&pin_GPIO10) }, + { MP_ROM_QSTR(MP_QSTR_GP10), MP_ROM_PTR(&pin_GPIO10) }, + { MP_ROM_QSTR(MP_QSTR_RFM95W_SDO), MP_ROM_PTR(&pin_GPIO11) }, + { MP_ROM_QSTR(MP_QSTR_GP11), MP_ROM_PTR(&pin_GPIO11) }, + { MP_ROM_QSTR(MP_QSTR_RFM95W_SDI), MP_ROM_PTR(&pin_GPIO12) }, + { MP_ROM_QSTR(MP_QSTR_GP12), MP_ROM_PTR(&pin_GPIO12) }, + { MP_ROM_QSTR(MP_QSTR_RFM95W_RST), MP_ROM_PTR(&pin_GPIO13) }, + { MP_ROM_QSTR(MP_QSTR_GP13), MP_ROM_PTR(&pin_GPIO13) }, + { MP_ROM_QSTR(MP_QSTR_D14), MP_ROM_PTR(&pin_GPIO13) }, + { MP_ROM_QSTR(MP_QSTR_RFM95W_DIO0), MP_ROM_PTR(&pin_GPIO14) }, + { MP_ROM_QSTR(MP_QSTR_GP14), MP_ROM_PTR(&pin_GPIO14) }, + { MP_ROM_QSTR(MP_QSTR_D15), MP_ROM_PTR(&pin_GPIO14) }, + { MP_ROM_QSTR(MP_QSTR_RFM95W_DIO1), MP_ROM_PTR(&pin_GPIO15) }, + { MP_ROM_QSTR(MP_QSTR_GP15), MP_ROM_PTR(&pin_GPIO15) }, + { MP_ROM_QSTR(MP_QSTR_D16), MP_ROM_PTR(&pin_GPIO15) }, + { MP_ROM_QSTR(MP_QSTR_RFM95W_DIO2), MP_ROM_PTR(&pin_GPIO18) }, + { MP_ROM_QSTR(MP_QSTR_GP18), MP_ROM_PTR(&pin_GPIO18) }, + { MP_ROM_QSTR(MP_QSTR_D17), MP_ROM_PTR(&pin_GPIO18) }, + + { MP_ROM_QSTR(MP_QSTR_LED), MP_ROM_PTR(&pin_GPIO24) }, + { MP_ROM_QSTR(MP_QSTR_GP24), MP_ROM_PTR(&pin_GPIO24) }, + { MP_ROM_QSTR(MP_QSTR_D18), MP_ROM_PTR(&pin_GPIO24) }, + + { MP_ROM_QSTR(MP_QSTR_D0), MP_ROM_PTR(&pin_GPIO16) }, + { MP_ROM_QSTR(MP_QSTR_TX), MP_ROM_PTR(&pin_GPIO16) }, + { MP_ROM_QSTR(MP_QSTR_GP16), MP_ROM_PTR(&pin_GPIO16) }, + + { MP_ROM_QSTR(MP_QSTR_D1), MP_ROM_PTR(&pin_GPIO17) }, + { MP_ROM_QSTR(MP_QSTR_RX), MP_ROM_PTR(&pin_GPIO17) }, + { MP_ROM_QSTR(MP_QSTR_GP17), MP_ROM_PTR(&pin_GPIO17) }, + + { MP_ROM_QSTR(MP_QSTR_SCK), MP_ROM_PTR(&pin_GPIO22) }, + { MP_ROM_QSTR(MP_QSTR_GP22), MP_ROM_PTR(&pin_GPIO22) }, + { MP_ROM_QSTR(MP_QSTR_MOSI), MP_ROM_PTR(&pin_GPIO23) }, + { MP_ROM_QSTR(MP_QSTR_GP23), MP_ROM_PTR(&pin_GPIO23) }, + { MP_ROM_QSTR(MP_QSTR_MISO), MP_ROM_PTR(&pin_GPIO20) }, + { MP_ROM_QSTR(MP_QSTR_GP20), MP_ROM_PTR(&pin_GPIO20) }, + + { MP_ROM_QSTR(MP_QSTR_A0), MP_ROM_PTR(&pin_GPIO26) }, + { MP_ROM_QSTR(MP_QSTR_GP26), MP_ROM_PTR(&pin_GPIO26) }, + { MP_ROM_QSTR(MP_QSTR_A1), MP_ROM_PTR(&pin_GPIO27) }, + { MP_ROM_QSTR(MP_QSTR_GP27), MP_ROM_PTR(&pin_GPIO27) }, + { MP_ROM_QSTR(MP_QSTR_A2), MP_ROM_PTR(&pin_GPIO28) }, + { MP_ROM_QSTR(MP_QSTR_GP28), MP_ROM_PTR(&pin_GPIO28) }, + { MP_ROM_QSTR(MP_QSTR_A3), MP_ROM_PTR(&pin_GPIO29) }, + { MP_ROM_QSTR(MP_QSTR_GP29), MP_ROM_PTR(&pin_GPIO29) }, + { MP_ROM_QSTR(MP_QSTR_A4), MP_ROM_PTR(&pin_GPIO19) }, + { MP_ROM_QSTR(MP_QSTR_GP19), MP_ROM_PTR(&pin_GPIO19) }, + { MP_ROM_QSTR(MP_QSTR_A5), MP_ROM_PTR(&pin_GPIO21) }, + { MP_ROM_QSTR(MP_QSTR_GP21), MP_ROM_PTR(&pin_GPIO21) }, + + { 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) }, +}; +MP_DEFINE_CONST_DICT(board_module_globals, board_module_globals_table); diff --git a/ports/raspberrypi/boards/challenger_rp2040_lte/board.c b/ports/raspberrypi/boards/challenger_rp2040_lte/board.c index de6e424ed9..331653173e 100644 --- a/ports/raspberrypi/boards/challenger_rp2040_lte/board.c +++ b/ports/raspberrypi/boards/challenger_rp2040_lte/board.c @@ -26,15 +26,4 @@ #include "supervisor/board.h" -void board_init(void) { -} - -bool board_requests_safe_mode(void) { - return false; -} - -void reset_board(void) { -} - -void board_deinit(void) { -} +// Use the MP_WEAK supervisor/shared/board.c versions of routines not defined here. diff --git a/ports/raspberrypi/boards/challenger_rp2040_subghz/board.c b/ports/raspberrypi/boards/challenger_rp2040_subghz/board.c new file mode 100644 index 0000000000..b66ea0e27f --- /dev/null +++ b/ports/raspberrypi/boards/challenger_rp2040_subghz/board.c @@ -0,0 +1,29 @@ +/* + * This file is part of the MicroPython project, http://micropython.org/ + * + * The MIT License (MIT) + * + * Copyright (c) 2022 Pontus Oldberg, Invector Labs + * + * Permission is hereby granted, free of charge, to any person obtaining a copy + * of this software and associated documentation files (the "Software"), to deal + * in the Software without restriction, including without limitation the rights + * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell + * copies of the Software, and to permit persons to whom the Software is + * furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice shall be included in + * all copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE + * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER + * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, + * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN + * THE SOFTWARE. + */ + +#include "supervisor/board.h" + +// Use the MP_WEAK supervisor/shared/board.c versions of routines not defined here. diff --git a/ports/raspberrypi/boards/challenger_rp2040_subghz/mpconfigboard.h b/ports/raspberrypi/boards/challenger_rp2040_subghz/mpconfigboard.h new file mode 100644 index 0000000000..0e41e9f3a5 --- /dev/null +++ b/ports/raspberrypi/boards/challenger_rp2040_subghz/mpconfigboard.h @@ -0,0 +1,10 @@ +#define MICROPY_HW_BOARD_NAME "Challenger RP2040 SubGHz" +#define MICROPY_HW_MCU_NAME "rp2040" + +#define DEFAULT_UART_BUS_TX (&pin_GPIO16) +#define DEFAULT_UART_BUS_RX (&pin_GPIO17) +#define DEFAULT_I2C_BUS_SDA (&pin_GPIO0) +#define DEFAULT_I2C_BUS_SCL (&pin_GPIO1) +#define DEFAULT_SPI_BUS_SCK (&pin_GPIO22) +#define DEFAULT_SPI_BUS_MOSI (&pin_GPIO23) +#define DEFAULT_SPI_BUS_MISO (&pin_GPIO20) diff --git a/ports/raspberrypi/boards/challenger_rp2040_subghz/mpconfigboard.mk b/ports/raspberrypi/boards/challenger_rp2040_subghz/mpconfigboard.mk new file mode 100644 index 0000000000..8bd9ac2318 --- /dev/null +++ b/ports/raspberrypi/boards/challenger_rp2040_subghz/mpconfigboard.mk @@ -0,0 +1,13 @@ +USB_VID = 0x2e8a +USB_PID = 0x1032 +USB_PRODUCT = "Challenger RP2040 SubGHz" +USB_MANUFACTURER = "Invector Labs" + +CHIP_VARIANT = RP2040 +CHIP_FAMILY = rp2 + +EXTERNAL_FLASH_DEVICES = "W25Q64JVxQ" + +CIRCUITPY__EVE = 1 + +FROZEN_MPY_DIRS += $(TOP)/frozen/Adafruit_CircuitPython_RFM69 diff --git a/ports/raspberrypi/boards/challenger_rp2040_subghz/pico-sdk-configboard.h b/ports/raspberrypi/boards/challenger_rp2040_subghz/pico-sdk-configboard.h new file mode 100644 index 0000000000..36da55d457 --- /dev/null +++ b/ports/raspberrypi/boards/challenger_rp2040_subghz/pico-sdk-configboard.h @@ -0,0 +1 @@ +// Put board-specific pico-sdk definitions here. This file must exist. diff --git a/ports/raspberrypi/boards/challenger_rp2040_subghz/pins.c b/ports/raspberrypi/boards/challenger_rp2040_subghz/pins.c new file mode 100644 index 0000000000..f5275e84dc --- /dev/null +++ b/ports/raspberrypi/boards/challenger_rp2040_subghz/pins.c @@ -0,0 +1,85 @@ +#include "shared-bindings/board/__init__.h" + +STATIC const mp_rom_map_elem_t board_module_globals_table[] = { + CIRCUITPYTHON_BOARD_DICT_STANDARD_ITEMS + + { MP_ROM_QSTR(MP_QSTR_SDA), MP_ROM_PTR(&pin_GPIO0) }, + { MP_ROM_QSTR(MP_QSTR_GP0), MP_ROM_PTR(&pin_GPIO0) }, + { MP_ROM_QSTR(MP_QSTR_SCL), MP_ROM_PTR(&pin_GPIO1) }, + { MP_ROM_QSTR(MP_QSTR_GP1), MP_ROM_PTR(&pin_GPIO1) }, + + { MP_ROM_QSTR(MP_QSTR_D5), MP_ROM_PTR(&pin_GPIO2) }, + { MP_ROM_QSTR(MP_QSTR_GP2), MP_ROM_PTR(&pin_GPIO2) }, + { MP_ROM_QSTR(MP_QSTR_D6), MP_ROM_PTR(&pin_GPIO3) }, + { MP_ROM_QSTR(MP_QSTR_GP3), MP_ROM_PTR(&pin_GPIO3) }, + + { MP_ROM_QSTR(MP_QSTR_D9), MP_ROM_PTR(&pin_GPIO4) }, + { MP_ROM_QSTR(MP_QSTR_GP4), MP_ROM_PTR(&pin_GPIO4) }, + { MP_ROM_QSTR(MP_QSTR_D10), MP_ROM_PTR(&pin_GPIO5) }, + { MP_ROM_QSTR(MP_QSTR_GP5), MP_ROM_PTR(&pin_GPIO5) }, + { MP_ROM_QSTR(MP_QSTR_D11), MP_ROM_PTR(&pin_GPIO6) }, + { MP_ROM_QSTR(MP_QSTR_GP6), MP_ROM_PTR(&pin_GPIO6) }, + { MP_ROM_QSTR(MP_QSTR_D12), MP_ROM_PTR(&pin_GPIO7) }, + { MP_ROM_QSTR(MP_QSTR_GP7), MP_ROM_PTR(&pin_GPIO7) }, + { MP_ROM_QSTR(MP_QSTR_D13), MP_ROM_PTR(&pin_GPIO8) }, + { MP_ROM_QSTR(MP_QSTR_GP8), MP_ROM_PTR(&pin_GPIO8) }, + + // RFM69HCW connections + { MP_ROM_QSTR(MP_QSTR_RFM69HCW_CS), MP_ROM_PTR(&pin_GPIO9) }, + { MP_ROM_QSTR(MP_QSTR_GP9), MP_ROM_PTR(&pin_GPIO9) }, + { MP_ROM_QSTR(MP_QSTR_RFM69HCW_SCK), MP_ROM_PTR(&pin_GPIO10) }, + { MP_ROM_QSTR(MP_QSTR_GP10), MP_ROM_PTR(&pin_GPIO10) }, + { MP_ROM_QSTR(MP_QSTR_RFM69HCW_SDO), MP_ROM_PTR(&pin_GPIO11) }, + { MP_ROM_QSTR(MP_QSTR_GP11), MP_ROM_PTR(&pin_GPIO11) }, + { MP_ROM_QSTR(MP_QSTR_RFM69HCW_SDI), MP_ROM_PTR(&pin_GPIO12) }, + { MP_ROM_QSTR(MP_QSTR_GP12), MP_ROM_PTR(&pin_GPIO12) }, + { MP_ROM_QSTR(MP_QSTR_RFM69HCW_RST), MP_ROM_PTR(&pin_GPIO13) }, + { MP_ROM_QSTR(MP_QSTR_GP13), MP_ROM_PTR(&pin_GPIO13) }, + { MP_ROM_QSTR(MP_QSTR_D14), MP_ROM_PTR(&pin_GPIO13) }, + { MP_ROM_QSTR(MP_QSTR_RFM69HCW_DIO0), MP_ROM_PTR(&pin_GPIO14) }, + { MP_ROM_QSTR(MP_QSTR_GP14), MP_ROM_PTR(&pin_GPIO14) }, + { MP_ROM_QSTR(MP_QSTR_D15), MP_ROM_PTR(&pin_GPIO14) }, + { MP_ROM_QSTR(MP_QSTR_RFM69HCW_DIO1), MP_ROM_PTR(&pin_GPIO15) }, + { MP_ROM_QSTR(MP_QSTR_GP15), MP_ROM_PTR(&pin_GPIO15) }, + { MP_ROM_QSTR(MP_QSTR_D16), MP_ROM_PTR(&pin_GPIO15) }, + { MP_ROM_QSTR(MP_QSTR_RFM69HCW_DIO2), MP_ROM_PTR(&pin_GPIO18) }, + { MP_ROM_QSTR(MP_QSTR_GP18), MP_ROM_PTR(&pin_GPIO18) }, + { MP_ROM_QSTR(MP_QSTR_D17), MP_ROM_PTR(&pin_GPIO18) }, + + { MP_ROM_QSTR(MP_QSTR_LED), MP_ROM_PTR(&pin_GPIO24) }, + { MP_ROM_QSTR(MP_QSTR_GP24), MP_ROM_PTR(&pin_GPIO24) }, + { MP_ROM_QSTR(MP_QSTR_D18), MP_ROM_PTR(&pin_GPIO24) }, + + { MP_ROM_QSTR(MP_QSTR_D0), MP_ROM_PTR(&pin_GPIO16) }, + { MP_ROM_QSTR(MP_QSTR_TX), MP_ROM_PTR(&pin_GPIO16) }, + { MP_ROM_QSTR(MP_QSTR_GP16), MP_ROM_PTR(&pin_GPIO16) }, + + { MP_ROM_QSTR(MP_QSTR_D1), MP_ROM_PTR(&pin_GPIO17) }, + { MP_ROM_QSTR(MP_QSTR_RX), MP_ROM_PTR(&pin_GPIO17) }, + { MP_ROM_QSTR(MP_QSTR_GP17), MP_ROM_PTR(&pin_GPIO17) }, + + { MP_ROM_QSTR(MP_QSTR_SCK), MP_ROM_PTR(&pin_GPIO22) }, + { MP_ROM_QSTR(MP_QSTR_GP22), MP_ROM_PTR(&pin_GPIO22) }, + { MP_ROM_QSTR(MP_QSTR_MOSI), MP_ROM_PTR(&pin_GPIO23) }, + { MP_ROM_QSTR(MP_QSTR_GP23), MP_ROM_PTR(&pin_GPIO23) }, + { MP_ROM_QSTR(MP_QSTR_MISO), MP_ROM_PTR(&pin_GPIO20) }, + { MP_ROM_QSTR(MP_QSTR_GP20), MP_ROM_PTR(&pin_GPIO20) }, + + { MP_ROM_QSTR(MP_QSTR_A0), MP_ROM_PTR(&pin_GPIO26) }, + { MP_ROM_QSTR(MP_QSTR_GP26), MP_ROM_PTR(&pin_GPIO26) }, + { MP_ROM_QSTR(MP_QSTR_A1), MP_ROM_PTR(&pin_GPIO27) }, + { MP_ROM_QSTR(MP_QSTR_GP27), MP_ROM_PTR(&pin_GPIO27) }, + { MP_ROM_QSTR(MP_QSTR_A2), MP_ROM_PTR(&pin_GPIO28) }, + { MP_ROM_QSTR(MP_QSTR_GP28), MP_ROM_PTR(&pin_GPIO28) }, + { MP_ROM_QSTR(MP_QSTR_A3), MP_ROM_PTR(&pin_GPIO29) }, + { MP_ROM_QSTR(MP_QSTR_GP29), MP_ROM_PTR(&pin_GPIO29) }, + { MP_ROM_QSTR(MP_QSTR_A4), MP_ROM_PTR(&pin_GPIO19) }, + { MP_ROM_QSTR(MP_QSTR_GP19), MP_ROM_PTR(&pin_GPIO19) }, + { MP_ROM_QSTR(MP_QSTR_A5), MP_ROM_PTR(&pin_GPIO21) }, + { MP_ROM_QSTR(MP_QSTR_GP21), MP_ROM_PTR(&pin_GPIO21) }, + + { 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) }, +}; +MP_DEFINE_CONST_DICT(board_module_globals, board_module_globals_table); diff --git a/ports/raspberrypi/boards/challenger_rp2040_wifi/board.c b/ports/raspberrypi/boards/challenger_rp2040_wifi/board.c index de6e424ed9..331653173e 100644 --- a/ports/raspberrypi/boards/challenger_rp2040_wifi/board.c +++ b/ports/raspberrypi/boards/challenger_rp2040_wifi/board.c @@ -26,15 +26,4 @@ #include "supervisor/board.h" -void board_init(void) { -} - -bool board_requests_safe_mode(void) { - return false; -} - -void reset_board(void) { -} - -void board_deinit(void) { -} +// Use the MP_WEAK supervisor/shared/board.c versions of routines not defined here. diff --git a/shared-bindings/gamepadshift/__init__.h b/ports/raspberrypi/boards/challenger_rp2040_wifi_ble/board.c similarity index 82% rename from shared-bindings/gamepadshift/__init__.h rename to ports/raspberrypi/boards/challenger_rp2040_wifi_ble/board.c index 4b4be756a6..de6e424ed9 100644 --- a/shared-bindings/gamepadshift/__init__.h +++ b/ports/raspberrypi/boards/challenger_rp2040_wifi_ble/board.c @@ -3,7 +3,7 @@ * * The MIT License (MIT) * - * Copyright (c) 2016 Radomir Dopieralski for Adafruit Industries + * Copyright (c) 2021 Scott Shawcroft for Adafruit Industries * * Permission is hereby granted, free of charge, to any person obtaining a copy * of this software and associated documentation files (the "Software"), to deal @@ -24,8 +24,17 @@ * THE SOFTWARE. */ +#include "supervisor/board.h" -#ifndef MICROPY_INCLUDED_SHARED_BINDINGS_GAMEPADSHIFT___INIT___H -#define MICROPY_INCLUDED_SHARED_BINDINGS_GAMEPADSHIFT___INIT___H +void board_init(void) { +} -#endif // MICROPY_INCLUDED_SHARED_BINDINGS_GAMEPADSHIFT___INIT___H +bool board_requests_safe_mode(void) { + return false; +} + +void reset_board(void) { +} + +void board_deinit(void) { +} diff --git a/ports/raspberrypi/boards/challenger_rp2040_wifi_ble/mpconfigboard.h b/ports/raspberrypi/boards/challenger_rp2040_wifi_ble/mpconfigboard.h new file mode 100644 index 0000000000..76c0748079 --- /dev/null +++ b/ports/raspberrypi/boards/challenger_rp2040_wifi_ble/mpconfigboard.h @@ -0,0 +1,10 @@ +#define MICROPY_HW_BOARD_NAME "Challenger RP2040 WiFi/BLE" +#define MICROPY_HW_MCU_NAME "rp2040" + +#define DEFAULT_UART_BUS_TX (&pin_GPIO16) +#define DEFAULT_UART_BUS_RX (&pin_GPIO17) +#define DEFAULT_I2C_BUS_SDA (&pin_GPIO0) +#define DEFAULT_I2C_BUS_SCL (&pin_GPIO1) +#define DEFAULT_SPI_BUS_SCK (&pin_GPIO22) +#define DEFAULT_SPI_BUS_MOSI (&pin_GPIO23) +#define DEFAULT_SPI_BUS_MISO (&pin_GPIO20) diff --git a/ports/raspberrypi/boards/challenger_rp2040_wifi_ble/mpconfigboard.mk b/ports/raspberrypi/boards/challenger_rp2040_wifi_ble/mpconfigboard.mk new file mode 100644 index 0000000000..5b1502fdd0 --- /dev/null +++ b/ports/raspberrypi/boards/challenger_rp2040_wifi_ble/mpconfigboard.mk @@ -0,0 +1,11 @@ +USB_VID = 0x2e8a +USB_PID = 0x102c +USB_PRODUCT = "Challenger RP2040 WiFi/BLE" +USB_MANUFACTURER = "Invector Labs" + +CHIP_VARIANT = RP2040 +CHIP_FAMILY = rp2 + +EXTERNAL_FLASH_DEVICES = "W25Q64JVxQ" + +CIRCUITPY__EVE = 1 diff --git a/ports/raspberrypi/boards/challenger_rp2040_wifi_ble/pico-sdk-configboard.h b/ports/raspberrypi/boards/challenger_rp2040_wifi_ble/pico-sdk-configboard.h new file mode 100644 index 0000000000..36da55d457 --- /dev/null +++ b/ports/raspberrypi/boards/challenger_rp2040_wifi_ble/pico-sdk-configboard.h @@ -0,0 +1 @@ +// Put board-specific pico-sdk definitions here. This file must exist. diff --git a/ports/raspberrypi/boards/challenger_rp2040_wifi_ble/pins.c b/ports/raspberrypi/boards/challenger_rp2040_wifi_ble/pins.c new file mode 100644 index 0000000000..57d7ecc698 --- /dev/null +++ b/ports/raspberrypi/boards/challenger_rp2040_wifi_ble/pins.c @@ -0,0 +1,78 @@ +#include "shared-bindings/board/__init__.h" + +STATIC const mp_rom_map_elem_t board_module_globals_table[] = { + CIRCUITPYTHON_BOARD_DICT_STANDARD_ITEMS + + { MP_ROM_QSTR(MP_QSTR_SDA), MP_ROM_PTR(&pin_GPIO0) }, + { MP_ROM_QSTR(MP_QSTR_GP0), MP_ROM_PTR(&pin_GPIO0) }, + + { MP_ROM_QSTR(MP_QSTR_SCL), MP_ROM_PTR(&pin_GPIO1) }, + { MP_ROM_QSTR(MP_QSTR_GP1), MP_ROM_PTR(&pin_GPIO1) }, + + { MP_ROM_QSTR(MP_QSTR_D5), MP_ROM_PTR(&pin_GPIO2) }, + { MP_ROM_QSTR(MP_QSTR_GP2), MP_ROM_PTR(&pin_GPIO2) }, + + { MP_ROM_QSTR(MP_QSTR_D6), MP_ROM_PTR(&pin_GPIO3) }, + { MP_ROM_QSTR(MP_QSTR_GP3), MP_ROM_PTR(&pin_GPIO3) }, + + { MP_ROM_QSTR(MP_QSTR_ESP_TX), MP_ROM_PTR(&pin_GPIO4) }, + { MP_ROM_QSTR(MP_QSTR_GP4), MP_ROM_PTR(&pin_GPIO4) }, + + { MP_ROM_QSTR(MP_QSTR_ESP_RX), MP_ROM_PTR(&pin_GPIO5) }, + { MP_ROM_QSTR(MP_QSTR_GP5), MP_ROM_PTR(&pin_GPIO5) }, + + { MP_ROM_QSTR(MP_QSTR_D9), MP_ROM_PTR(&pin_GPIO6) }, + { MP_ROM_QSTR(MP_QSTR_GP6), MP_ROM_PTR(&pin_GPIO6) }, + + { MP_ROM_QSTR(MP_QSTR_D10), MP_ROM_PTR(&pin_GPIO7) }, + { MP_ROM_QSTR(MP_QSTR_GP7), MP_ROM_PTR(&pin_GPIO7) }, + + { MP_ROM_QSTR(MP_QSTR_D11), MP_ROM_PTR(&pin_GPIO8) }, + { MP_ROM_QSTR(MP_QSTR_GP8), MP_ROM_PTR(&pin_GPIO8) }, + + { MP_ROM_QSTR(MP_QSTR_D12), MP_ROM_PTR(&pin_GPIO9) }, + { MP_ROM_QSTR(MP_QSTR_GP9), MP_ROM_PTR(&pin_GPIO9) }, + + { MP_ROM_QSTR(MP_QSTR_D13), MP_ROM_PTR(&pin_GPIO10) }, + { MP_ROM_QSTR(MP_QSTR_LED), MP_ROM_PTR(&pin_GPIO10) }, + { MP_ROM_QSTR(MP_QSTR_GP10), MP_ROM_PTR(&pin_GPIO10) }, + + { MP_ROM_QSTR(MP_QSTR_NEOPIXEL), MP_ROM_PTR(&pin_GPIO11) }, + { MP_ROM_QSTR(MP_QSTR_GP11), MP_ROM_PTR(&pin_GPIO11) }, + + { MP_ROM_QSTR(MP_QSTR_WIFI_MODE), MP_ROM_PTR(&pin_GPIO24) }, + { MP_ROM_QSTR(MP_QSTR_WIFI_RESET), MP_ROM_PTR(&pin_GPIO19) }, + + { MP_ROM_QSTR(MP_QSTR_D0), MP_ROM_PTR(&pin_GPIO16) }, + { MP_ROM_QSTR(MP_QSTR_TX), MP_ROM_PTR(&pin_GPIO16) }, + { MP_ROM_QSTR(MP_QSTR_GP16), MP_ROM_PTR(&pin_GPIO16) }, + + { MP_ROM_QSTR(MP_QSTR_D1), MP_ROM_PTR(&pin_GPIO17) }, + { MP_ROM_QSTR(MP_QSTR_RX), MP_ROM_PTR(&pin_GPIO17) }, + { MP_ROM_QSTR(MP_QSTR_GP17), MP_ROM_PTR(&pin_GPIO17) }, + + { MP_ROM_QSTR(MP_QSTR_SCK), MP_ROM_PTR(&pin_GPIO22) }, + { MP_ROM_QSTR(MP_QSTR_GP22), MP_ROM_PTR(&pin_GPIO22) }, + { MP_ROM_QSTR(MP_QSTR_MOSI), MP_ROM_PTR(&pin_GPIO23) }, + { MP_ROM_QSTR(MP_QSTR_GP23), MP_ROM_PTR(&pin_GPIO23) }, + { MP_ROM_QSTR(MP_QSTR_MISO), MP_ROM_PTR(&pin_GPIO20) }, + { MP_ROM_QSTR(MP_QSTR_GP20), MP_ROM_PTR(&pin_GPIO20) }, + + { MP_ROM_QSTR(MP_QSTR_A0), MP_ROM_PTR(&pin_GPIO26) }, + { MP_ROM_QSTR(MP_QSTR_GP26), MP_ROM_PTR(&pin_GPIO26) }, + { MP_ROM_QSTR(MP_QSTR_A1), MP_ROM_PTR(&pin_GPIO27) }, + { MP_ROM_QSTR(MP_QSTR_GP27), MP_ROM_PTR(&pin_GPIO27) }, + { MP_ROM_QSTR(MP_QSTR_A2), MP_ROM_PTR(&pin_GPIO28) }, + { MP_ROM_QSTR(MP_QSTR_GP28), MP_ROM_PTR(&pin_GPIO28) }, + { MP_ROM_QSTR(MP_QSTR_A3), MP_ROM_PTR(&pin_GPIO29) }, + { MP_ROM_QSTR(MP_QSTR_GP29), MP_ROM_PTR(&pin_GPIO29) }, + { MP_ROM_QSTR(MP_QSTR_A4), MP_ROM_PTR(&pin_GPIO25) }, + { MP_ROM_QSTR(MP_QSTR_GP25), MP_ROM_PTR(&pin_GPIO25) }, + { MP_ROM_QSTR(MP_QSTR_A5), MP_ROM_PTR(&pin_GPIO21) }, + { MP_ROM_QSTR(MP_QSTR_GP21), MP_ROM_PTR(&pin_GPIO21) }, + + { 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) }, +}; +MP_DEFINE_CONST_DICT(board_module_globals, board_module_globals_table); diff --git a/ports/raspberrypi/boards/cytron_maker_nano_rp2040/board.c b/ports/raspberrypi/boards/cytron_maker_nano_rp2040/board.c index b583e7bf11..22f2970c9e 100644 --- a/ports/raspberrypi/boards/cytron_maker_nano_rp2040/board.c +++ b/ports/raspberrypi/boards/cytron_maker_nano_rp2040/board.c @@ -26,15 +26,4 @@ #include "supervisor/board.h" -void board_init(void) { -} - -bool board_requests_safe_mode(void) { - return false; -} - -void reset_board(void) { -} - -void board_deinit(void) { -} +// Use the MP_WEAK supervisor/shared/board.c versions of routines not defined here. diff --git a/ports/raspberrypi/boards/cytron_maker_pi_rp2040/board.c b/ports/raspberrypi/boards/cytron_maker_pi_rp2040/board.c index b583e7bf11..22f2970c9e 100644 --- a/ports/raspberrypi/boards/cytron_maker_pi_rp2040/board.c +++ b/ports/raspberrypi/boards/cytron_maker_pi_rp2040/board.c @@ -26,15 +26,4 @@ #include "supervisor/board.h" -void board_init(void) { -} - -bool board_requests_safe_mode(void) { - return false; -} - -void reset_board(void) { -} - -void board_deinit(void) { -} +// Use the MP_WEAK supervisor/shared/board.c versions of routines not defined here. diff --git a/ports/raspberrypi/boards/elecfreaks_picoed/board.c b/ports/raspberrypi/boards/elecfreaks_picoed/board.c index de6e424ed9..331653173e 100644 --- a/ports/raspberrypi/boards/elecfreaks_picoed/board.c +++ b/ports/raspberrypi/boards/elecfreaks_picoed/board.c @@ -26,15 +26,4 @@ #include "supervisor/board.h" -void board_init(void) { -} - -bool board_requests_safe_mode(void) { - return false; -} - -void reset_board(void) { -} - -void board_deinit(void) { -} +// Use the MP_WEAK supervisor/shared/board.c versions of routines not defined here. diff --git a/ports/raspberrypi/boards/elecfreaks_picoed/mpconfigboard.h b/ports/raspberrypi/boards/elecfreaks_picoed/mpconfigboard.h index 0a73b3d73b..03d892091e 100644 --- a/ports/raspberrypi/boards/elecfreaks_picoed/mpconfigboard.h +++ b/ports/raspberrypi/boards/elecfreaks_picoed/mpconfigboard.h @@ -1,2 +1,4 @@ #define MICROPY_HW_BOARD_NAME "ELECFREAKS PICO:ED" #define MICROPY_HW_MCU_NAME "rp2040" + +#define MICROPY_HW_LED_STATUS (&pin_GPIO25) diff --git a/ports/raspberrypi/boards/elecfreaks_picoed/mpconfigboard.mk b/ports/raspberrypi/boards/elecfreaks_picoed/mpconfigboard.mk index 42200ac8c7..ea72feef00 100644 --- a/ports/raspberrypi/boards/elecfreaks_picoed/mpconfigboard.mk +++ b/ports/raspberrypi/boards/elecfreaks_picoed/mpconfigboard.mk @@ -9,3 +9,11 @@ CHIP_FAMILY = rp2 EXTERNAL_FLASH_DEVICES = "W25Q16JVxQ" CIRCUITPY__EVE = 1 + +FROZEN_MPY_DIRS += $(TOP)/frozen/Adafruit_CircuitPython_asyncio +FROZEN_MPY_DIRS += $(TOP)/frozen/Adafruit_CircuitPython_IS31FL3731 +FROZEN_MPY_DIRS += $(TOP)/frozen/Adafruit_CircuitPython_Motor +FROZEN_MPY_DIRS += $(TOP)/frozen/Adafruit_CircuitPython_NeoPixel +FROZEN_MPY_DIRS += $(TOP)/frozen/Adafruit_CircuitPython_Ticks +FROZEN_MPY_DIRS += $(TOP)/frozen/circuitpython_ef_music +FROZEN_MPY_DIRS += $(TOP)/frozen/circuitpython_picoed diff --git a/ports/raspberrypi/boards/electrolama_minik/board.c b/ports/raspberrypi/boards/electrolama_minik/board.c new file mode 100644 index 0000000000..331653173e --- /dev/null +++ b/ports/raspberrypi/boards/electrolama_minik/board.c @@ -0,0 +1,29 @@ +/* + * This file is part of the MicroPython project, http://micropython.org/ + * + * The MIT License (MIT) + * + * Copyright (c) 2021 Scott Shawcroft for Adafruit Industries + * + * Permission is hereby granted, free of charge, to any person obtaining a copy + * of this software and associated documentation files (the "Software"), to deal + * in the Software without restriction, including without limitation the rights + * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell + * copies of the Software, and to permit persons to whom the Software is + * furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice shall be included in + * all copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE + * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER + * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, + * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN + * THE SOFTWARE. + */ + +#include "supervisor/board.h" + +// Use the MP_WEAK supervisor/shared/board.c versions of routines not defined here. diff --git a/ports/raspberrypi/boards/electrolama_minik/mpconfigboard.h b/ports/raspberrypi/boards/electrolama_minik/mpconfigboard.h new file mode 100644 index 0000000000..f2261ac8b7 --- /dev/null +++ b/ports/raspberrypi/boards/electrolama_minik/mpconfigboard.h @@ -0,0 +1,8 @@ +#define MICROPY_HW_BOARD_NAME "Electrolama minik" +#define MICROPY_HW_MCU_NAME "rp2040" + +// GPIO25 is the WS2812 LED on the module +#define MICROPY_HW_NEOPIXEL (&pin_GPIO25) + +// GPIO15 is not routed out +#define IGNORE_PIN_GPIO15 1 diff --git a/ports/raspberrypi/boards/electrolama_minik/mpconfigboard.mk b/ports/raspberrypi/boards/electrolama_minik/mpconfigboard.mk new file mode 100644 index 0000000000..8bd2394127 --- /dev/null +++ b/ports/raspberrypi/boards/electrolama_minik/mpconfigboard.mk @@ -0,0 +1,11 @@ +USB_VID = 0x1209 +USB_PID = 0xF123 +USB_PRODUCT = "minik" +USB_MANUFACTURER = "Electrolama" + +CHIP_VARIANT = RP2040 +CHIP_FAMILY = rp2 + +EXTERNAL_FLASH_DEVICES = "W25Q16JVxQ" + +CIRCUITPY__EVE = 1 diff --git a/ports/raspberrypi/boards/electrolama_minik/pico-sdk-configboard.h b/ports/raspberrypi/boards/electrolama_minik/pico-sdk-configboard.h new file mode 100644 index 0000000000..36da55d457 --- /dev/null +++ b/ports/raspberrypi/boards/electrolama_minik/pico-sdk-configboard.h @@ -0,0 +1 @@ +// Put board-specific pico-sdk definitions here. This file must exist. diff --git a/ports/raspberrypi/boards/electrolama_minik/pins.c b/ports/raspberrypi/boards/electrolama_minik/pins.c new file mode 100644 index 0000000000..21331ffda5 --- /dev/null +++ b/ports/raspberrypi/boards/electrolama_minik/pins.c @@ -0,0 +1,52 @@ +#include "shared-bindings/board/__init__.h" + +STATIC const mp_rom_map_elem_t board_module_globals_table[] = { + CIRCUITPYTHON_BOARD_DICT_STANDARD_ITEMS + + { MP_ROM_QSTR(MP_QSTR_GP0), MP_ROM_PTR(&pin_GPIO0) }, + { MP_ROM_QSTR(MP_QSTR_GP1), MP_ROM_PTR(&pin_GPIO1) }, + { MP_ROM_QSTR(MP_QSTR_GP2), MP_ROM_PTR(&pin_GPIO2) }, + { MP_ROM_QSTR(MP_QSTR_GP3), MP_ROM_PTR(&pin_GPIO3) }, + { MP_ROM_QSTR(MP_QSTR_GP4), MP_ROM_PTR(&pin_GPIO4) }, + { MP_ROM_QSTR(MP_QSTR_GP5), MP_ROM_PTR(&pin_GPIO5) }, + { MP_ROM_QSTR(MP_QSTR_GP6), MP_ROM_PTR(&pin_GPIO6) }, + { MP_ROM_QSTR(MP_QSTR_GP7), MP_ROM_PTR(&pin_GPIO7) }, + { MP_ROM_QSTR(MP_QSTR_GP8), MP_ROM_PTR(&pin_GPIO8) }, + { MP_ROM_QSTR(MP_QSTR_GP9), MP_ROM_PTR(&pin_GPIO9) }, + { MP_ROM_QSTR(MP_QSTR_GP10), MP_ROM_PTR(&pin_GPIO10) }, + { MP_ROM_QSTR(MP_QSTR_GP11), MP_ROM_PTR(&pin_GPIO11) }, + { MP_ROM_QSTR(MP_QSTR_GP12), MP_ROM_PTR(&pin_GPIO12) }, + { MP_ROM_QSTR(MP_QSTR_GP13), MP_ROM_PTR(&pin_GPIO13) }, + { MP_ROM_QSTR(MP_QSTR_GP14), MP_ROM_PTR(&pin_GPIO14) }, + // GPIO15 is not routed out. + { MP_ROM_QSTR(MP_QSTR_GP16), MP_ROM_PTR(&pin_GPIO16) }, + { MP_ROM_QSTR(MP_QSTR_GP17), MP_ROM_PTR(&pin_GPIO17) }, + { MP_ROM_QSTR(MP_QSTR_GP18), MP_ROM_PTR(&pin_GPIO18) }, + { MP_ROM_QSTR(MP_QSTR_GP19), MP_ROM_PTR(&pin_GPIO19) }, + { MP_ROM_QSTR(MP_QSTR_GP20), MP_ROM_PTR(&pin_GPIO20) }, + { MP_ROM_QSTR(MP_QSTR_GP21), MP_ROM_PTR(&pin_GPIO21) }, + { MP_ROM_QSTR(MP_QSTR_GP22), MP_ROM_PTR(&pin_GPIO22) }, + { MP_ROM_QSTR(MP_QSTR_GP23), MP_ROM_PTR(&pin_GPIO23) }, + { MP_ROM_QSTR(MP_QSTR_GP24), MP_ROM_PTR(&pin_GPIO24) }, + + { MP_ROM_QSTR(MP_QSTR_LED), MP_ROM_PTR(&pin_GPIO25) }, + { MP_ROM_QSTR(MP_QSTR_NEOPIXEL), MP_ROM_PTR(&pin_GPIO25) }, + { MP_ROM_QSTR(MP_QSTR_GP25), MP_ROM_PTR(&pin_GPIO25) }, + + { MP_ROM_QSTR(MP_QSTR_GP26), MP_ROM_PTR(&pin_GPIO26) }, + { MP_ROM_QSTR(MP_QSTR_GP26_A0), MP_ROM_PTR(&pin_GPIO26) }, + { MP_ROM_QSTR(MP_QSTR_A0), MP_ROM_PTR(&pin_GPIO26) }, + + { MP_ROM_QSTR(MP_QSTR_GP27), MP_ROM_PTR(&pin_GPIO27) }, + { MP_ROM_QSTR(MP_QSTR_GP27_A1), MP_ROM_PTR(&pin_GPIO27) }, + { MP_ROM_QSTR(MP_QSTR_A1), MP_ROM_PTR(&pin_GPIO27) }, + + { MP_ROM_QSTR(MP_QSTR_GP28), MP_ROM_PTR(&pin_GPIO28) }, + { MP_ROM_QSTR(MP_QSTR_GP28_A2), MP_ROM_PTR(&pin_GPIO28) }, + { MP_ROM_QSTR(MP_QSTR_A2), MP_ROM_PTR(&pin_GPIO28) }, + + { MP_ROM_QSTR(MP_QSTR_GP29), MP_ROM_PTR(&pin_GPIO29) }, + { MP_ROM_QSTR(MP_QSTR_GP29_A3), MP_ROM_PTR(&pin_GPIO29) }, + { MP_ROM_QSTR(MP_QSTR_A3), MP_ROM_PTR(&pin_GPIO29) }, +}; +MP_DEFINE_CONST_DICT(board_module_globals, board_module_globals_table); diff --git a/ports/raspberrypi/boards/jpconstantineau_encoderpad_rp2040/board.c b/ports/raspberrypi/boards/jpconstantineau_encoderpad_rp2040/board.c index 831bf96cdf..1c16e2fc4f 100644 --- a/ports/raspberrypi/boards/jpconstantineau_encoderpad_rp2040/board.c +++ b/ports/raspberrypi/boards/jpconstantineau_encoderpad_rp2040/board.c @@ -30,17 +30,9 @@ #include "supervisor/shared/board.h" #include "supervisor/board.h" -void board_init(void) { -} - -bool board_requests_safe_mode(void) { - return false; -} - void reset_board(void) { // turn off any left over LED board_reset_user_neopixels(&pin_GPIO15, 9); } -void board_deinit(void) { -} +// Use the MP_WEAK supervisor/shared/board.c versions of routines not defined here. diff --git a/ports/raspberrypi/boards/jpconstantineau_pykey18/board.c b/ports/raspberrypi/boards/jpconstantineau_pykey18/board.c index e4e5a8bc57..4785f742ec 100644 --- a/ports/raspberrypi/boards/jpconstantineau_pykey18/board.c +++ b/ports/raspberrypi/boards/jpconstantineau_pykey18/board.c @@ -29,17 +29,9 @@ #include "src/rp2_common/hardware_gpio/include/hardware/gpio.h" #include "supervisor/shared/board.h" -void board_init(void) { -} - -bool board_requests_safe_mode(void) { - return false; -} - void reset_board(void) { // turn off any left over LED board_reset_user_neopixels(&pin_GPIO29, 62); } -void board_deinit(void) { -} +// Use the MP_WEAK supervisor/shared/board.c versions of routines not defined here. diff --git a/ports/raspberrypi/boards/jpconstantineau_pykey44/board.c b/ports/raspberrypi/boards/jpconstantineau_pykey44/board.c index e4e5a8bc57..4785f742ec 100644 --- a/ports/raspberrypi/boards/jpconstantineau_pykey44/board.c +++ b/ports/raspberrypi/boards/jpconstantineau_pykey44/board.c @@ -29,17 +29,9 @@ #include "src/rp2_common/hardware_gpio/include/hardware/gpio.h" #include "supervisor/shared/board.h" -void board_init(void) { -} - -bool board_requests_safe_mode(void) { - return false; -} - void reset_board(void) { // turn off any left over LED board_reset_user_neopixels(&pin_GPIO29, 62); } -void board_deinit(void) { -} +// Use the MP_WEAK supervisor/shared/board.c versions of routines not defined here. diff --git a/ports/raspberrypi/boards/jpconstantineau_pykey60/board.c b/ports/raspberrypi/boards/jpconstantineau_pykey60/board.c index e4e5a8bc57..4785f742ec 100644 --- a/ports/raspberrypi/boards/jpconstantineau_pykey60/board.c +++ b/ports/raspberrypi/boards/jpconstantineau_pykey60/board.c @@ -29,17 +29,9 @@ #include "src/rp2_common/hardware_gpio/include/hardware/gpio.h" #include "supervisor/shared/board.h" -void board_init(void) { -} - -bool board_requests_safe_mode(void) { - return false; -} - void reset_board(void) { // turn off any left over LED board_reset_user_neopixels(&pin_GPIO29, 62); } -void board_deinit(void) { -} +// Use the MP_WEAK supervisor/shared/board.c versions of routines not defined here. diff --git a/ports/raspberrypi/boards/jpconstantineau_pykey87/board.c b/ports/raspberrypi/boards/jpconstantineau_pykey87/board.c index e4e5a8bc57..4785f742ec 100644 --- a/ports/raspberrypi/boards/jpconstantineau_pykey87/board.c +++ b/ports/raspberrypi/boards/jpconstantineau_pykey87/board.c @@ -29,17 +29,9 @@ #include "src/rp2_common/hardware_gpio/include/hardware/gpio.h" #include "supervisor/shared/board.h" -void board_init(void) { -} - -bool board_requests_safe_mode(void) { - return false; -} - void reset_board(void) { // turn off any left over LED board_reset_user_neopixels(&pin_GPIO29, 62); } -void board_deinit(void) { -} +// Use the MP_WEAK supervisor/shared/board.c versions of routines not defined here. diff --git a/ports/raspberrypi/boards/melopero_shake_rp2040/board.c b/ports/raspberrypi/boards/melopero_shake_rp2040/board.c index de6e424ed9..331653173e 100644 --- a/ports/raspberrypi/boards/melopero_shake_rp2040/board.c +++ b/ports/raspberrypi/boards/melopero_shake_rp2040/board.c @@ -26,15 +26,4 @@ #include "supervisor/board.h" -void board_init(void) { -} - -bool board_requests_safe_mode(void) { - return false; -} - -void reset_board(void) { -} - -void board_deinit(void) { -} +// Use the MP_WEAK supervisor/shared/board.c versions of routines not defined here. diff --git a/ports/raspberrypi/boards/odt_bread_2040/board.c b/ports/raspberrypi/boards/odt_bread_2040/board.c index de6e424ed9..331653173e 100644 --- a/ports/raspberrypi/boards/odt_bread_2040/board.c +++ b/ports/raspberrypi/boards/odt_bread_2040/board.c @@ -26,15 +26,4 @@ #include "supervisor/board.h" -void board_init(void) { -} - -bool board_requests_safe_mode(void) { - return false; -} - -void reset_board(void) { -} - -void board_deinit(void) { -} +// Use the MP_WEAK supervisor/shared/board.c versions of routines not defined here. diff --git a/ports/raspberrypi/boards/odt_cast_away_rp2040/board.c b/ports/raspberrypi/boards/odt_cast_away_rp2040/board.c index de6e424ed9..331653173e 100644 --- a/ports/raspberrypi/boards/odt_cast_away_rp2040/board.c +++ b/ports/raspberrypi/boards/odt_cast_away_rp2040/board.c @@ -26,15 +26,4 @@ #include "supervisor/board.h" -void board_init(void) { -} - -bool board_requests_safe_mode(void) { - return false; -} - -void reset_board(void) { -} - -void board_deinit(void) { -} +// Use the MP_WEAK supervisor/shared/board.c versions of routines not defined here. diff --git a/ports/raspberrypi/boards/pimoroni_badger2040/board.c b/ports/raspberrypi/boards/pimoroni_badger2040/board.c index 666bb5f62f..48ae66e7cb 100644 --- a/ports/raspberrypi/boards/pimoroni_badger2040/board.c +++ b/ports/raspberrypi/boards/pimoroni_badger2040/board.c @@ -320,13 +320,6 @@ void board_init(void) { false); // two_byte_sequence_length } -bool board_requests_safe_mode(void) { - return false; -} - -void reset_board(void) { -} - void board_deinit(void) { displayio_epaperdisplay_obj_t *display = &displays[0].epaper_display; if (display->base.type == &displayio_epaperdisplay_type) { @@ -338,3 +331,5 @@ void board_deinit(void) { } common_hal_displayio_release_displays(); } + +// Use the MP_WEAK supervisor/shared/board.c versions of routines not defined here. diff --git a/ports/raspberrypi/boards/pimoroni_interstate75/board.c b/ports/raspberrypi/boards/pimoroni_interstate75/board.c index de6e424ed9..331653173e 100644 --- a/ports/raspberrypi/boards/pimoroni_interstate75/board.c +++ b/ports/raspberrypi/boards/pimoroni_interstate75/board.c @@ -26,15 +26,4 @@ #include "supervisor/board.h" -void board_init(void) { -} - -bool board_requests_safe_mode(void) { - return false; -} - -void reset_board(void) { -} - -void board_deinit(void) { -} +// Use the MP_WEAK supervisor/shared/board.c versions of routines not defined here. diff --git a/ports/raspberrypi/boards/pimoroni_interstate75/pins.c b/ports/raspberrypi/boards/pimoroni_interstate75/pins.c index 2460ebc76a..801a418015 100644 --- a/ports/raspberrypi/boards/pimoroni_interstate75/pins.c +++ b/ports/raspberrypi/boards/pimoroni_interstate75/pins.c @@ -22,6 +22,7 @@ STATIC const mp_rom_map_elem_t board_module_globals_table[] = { { MP_ROM_QSTR(MP_QSTR_SW_A), MP_ROM_PTR(&pin_GPIO14) }, + { MP_ROM_QSTR(MP_QSTR_LED), MP_ROM_PTR(&pin_GPIO16) }, { MP_ROM_QSTR(MP_QSTR_LED_R), MP_ROM_PTR(&pin_GPIO16) }, { MP_ROM_QSTR(MP_QSTR_LED_G), MP_ROM_PTR(&pin_GPIO17) }, { MP_ROM_QSTR(MP_QSTR_LED_B), MP_ROM_PTR(&pin_GPIO18) }, diff --git a/ports/raspberrypi/boards/pimoroni_keybow2040/board.c b/ports/raspberrypi/boards/pimoroni_keybow2040/board.c index de6e424ed9..331653173e 100644 --- a/ports/raspberrypi/boards/pimoroni_keybow2040/board.c +++ b/ports/raspberrypi/boards/pimoroni_keybow2040/board.c @@ -26,15 +26,4 @@ #include "supervisor/board.h" -void board_init(void) { -} - -bool board_requests_safe_mode(void) { - return false; -} - -void reset_board(void) { -} - -void board_deinit(void) { -} +// Use the MP_WEAK supervisor/shared/board.c versions of routines not defined here. diff --git a/ports/raspberrypi/boards/pimoroni_motor2040/board.c b/ports/raspberrypi/boards/pimoroni_motor2040/board.c index de6e424ed9..331653173e 100644 --- a/ports/raspberrypi/boards/pimoroni_motor2040/board.c +++ b/ports/raspberrypi/boards/pimoroni_motor2040/board.c @@ -26,15 +26,4 @@ #include "supervisor/board.h" -void board_init(void) { -} - -bool board_requests_safe_mode(void) { - return false; -} - -void reset_board(void) { -} - -void board_deinit(void) { -} +// Use the MP_WEAK supervisor/shared/board.c versions of routines not defined here. diff --git a/ports/raspberrypi/boards/pimoroni_pga2040/board.c b/ports/raspberrypi/boards/pimoroni_pga2040/board.c index de6e424ed9..331653173e 100644 --- a/ports/raspberrypi/boards/pimoroni_pga2040/board.c +++ b/ports/raspberrypi/boards/pimoroni_pga2040/board.c @@ -26,15 +26,4 @@ #include "supervisor/board.h" -void board_init(void) { -} - -bool board_requests_safe_mode(void) { - return false; -} - -void reset_board(void) { -} - -void board_deinit(void) { -} +// Use the MP_WEAK supervisor/shared/board.c versions of routines not defined here. diff --git a/ports/raspberrypi/boards/pimoroni_picolipo_16mb/board.c b/ports/raspberrypi/boards/pimoroni_picolipo_16mb/board.c index de6e424ed9..331653173e 100644 --- a/ports/raspberrypi/boards/pimoroni_picolipo_16mb/board.c +++ b/ports/raspberrypi/boards/pimoroni_picolipo_16mb/board.c @@ -26,15 +26,4 @@ #include "supervisor/board.h" -void board_init(void) { -} - -bool board_requests_safe_mode(void) { - return false; -} - -void reset_board(void) { -} - -void board_deinit(void) { -} +// Use the MP_WEAK supervisor/shared/board.c versions of routines not defined here. diff --git a/ports/raspberrypi/boards/pimoroni_picolipo_4mb/board.c b/ports/raspberrypi/boards/pimoroni_picolipo_4mb/board.c index de6e424ed9..331653173e 100644 --- a/ports/raspberrypi/boards/pimoroni_picolipo_4mb/board.c +++ b/ports/raspberrypi/boards/pimoroni_picolipo_4mb/board.c @@ -26,15 +26,4 @@ #include "supervisor/board.h" -void board_init(void) { -} - -bool board_requests_safe_mode(void) { - return false; -} - -void reset_board(void) { -} - -void board_deinit(void) { -} +// Use the MP_WEAK supervisor/shared/board.c versions of routines not defined here. diff --git a/ports/raspberrypi/boards/pimoroni_picosystem/board.c b/ports/raspberrypi/boards/pimoroni_picosystem/board.c index e8458e90d9..600089f129 100644 --- a/ports/raspberrypi/boards/pimoroni_picosystem/board.c +++ b/ports/raspberrypi/boards/pimoroni_picosystem/board.c @@ -101,22 +101,14 @@ void board_init(void) { sizeof(display_init_sequence), &pin_GPIO12, // backlight pin NO_BRIGHTNESS_COMMAND, - 1.0f, // brightness (ignored) - true, // auto_brightness + 1.0f, // brightness false, // single_byte_bounds false, // data_as_commands true, // auto_refresh 60, // native_frames_per_second true, // backlight_on_high - false); // SH1107_addressing + false, // SH1107_addressing + 50000); // backlight pwm frequency } -void board_deinit(void) { -} - -bool board_requests_safe_mode(void) { - return false; -} - -void reset_board(void) { -} +// Use the MP_WEAK supervisor/shared/board.c versions of routines not defined here. diff --git a/ports/raspberrypi/boards/pimoroni_plasma2040/board.c b/ports/raspberrypi/boards/pimoroni_plasma2040/board.c index de6e424ed9..331653173e 100644 --- a/ports/raspberrypi/boards/pimoroni_plasma2040/board.c +++ b/ports/raspberrypi/boards/pimoroni_plasma2040/board.c @@ -26,15 +26,4 @@ #include "supervisor/board.h" -void board_init(void) { -} - -bool board_requests_safe_mode(void) { - return false; -} - -void reset_board(void) { -} - -void board_deinit(void) { -} +// Use the MP_WEAK supervisor/shared/board.c versions of routines not defined here. diff --git a/ports/raspberrypi/boards/pimoroni_servo2040/board.c b/ports/raspberrypi/boards/pimoroni_servo2040/board.c index de6e424ed9..331653173e 100644 --- a/ports/raspberrypi/boards/pimoroni_servo2040/board.c +++ b/ports/raspberrypi/boards/pimoroni_servo2040/board.c @@ -26,15 +26,4 @@ #include "supervisor/board.h" -void board_init(void) { -} - -bool board_requests_safe_mode(void) { - return false; -} - -void reset_board(void) { -} - -void board_deinit(void) { -} +// Use the MP_WEAK supervisor/shared/board.c versions of routines not defined here. diff --git a/ports/raspberrypi/boards/pimoroni_tiny2040/board.c b/ports/raspberrypi/boards/pimoroni_tiny2040/board.c index de6e424ed9..331653173e 100644 --- a/ports/raspberrypi/boards/pimoroni_tiny2040/board.c +++ b/ports/raspberrypi/boards/pimoroni_tiny2040/board.c @@ -26,15 +26,4 @@ #include "supervisor/board.h" -void board_init(void) { -} - -bool board_requests_safe_mode(void) { - return false; -} - -void reset_board(void) { -} - -void board_deinit(void) { -} +// Use the MP_WEAK supervisor/shared/board.c versions of routines not defined here. diff --git a/ports/raspberrypi/boards/pimoroni_tiny2040_2mb/board.c b/ports/raspberrypi/boards/pimoroni_tiny2040_2mb/board.c index de6e424ed9..331653173e 100644 --- a/ports/raspberrypi/boards/pimoroni_tiny2040_2mb/board.c +++ b/ports/raspberrypi/boards/pimoroni_tiny2040_2mb/board.c @@ -26,15 +26,4 @@ #include "supervisor/board.h" -void board_init(void) { -} - -bool board_requests_safe_mode(void) { - return false; -} - -void reset_board(void) { -} - -void board_deinit(void) { -} +// Use the MP_WEAK supervisor/shared/board.c versions of routines not defined here. diff --git a/ports/raspberrypi/boards/raspberry_pi_pico/board.c b/ports/raspberrypi/boards/raspberry_pi_pico/board.c index de6e424ed9..331653173e 100644 --- a/ports/raspberrypi/boards/raspberry_pi_pico/board.c +++ b/ports/raspberrypi/boards/raspberry_pi_pico/board.c @@ -26,15 +26,4 @@ #include "supervisor/board.h" -void board_init(void) { -} - -bool board_requests_safe_mode(void) { - return false; -} - -void reset_board(void) { -} - -void board_deinit(void) { -} +// Use the MP_WEAK supervisor/shared/board.c versions of routines not defined here. diff --git a/ports/raspberrypi/boards/raspberry_pi_pico_w/board.c b/ports/raspberrypi/boards/raspberry_pi_pico_w/board.c new file mode 100644 index 0000000000..331653173e --- /dev/null +++ b/ports/raspberrypi/boards/raspberry_pi_pico_w/board.c @@ -0,0 +1,29 @@ +/* + * This file is part of the MicroPython project, http://micropython.org/ + * + * The MIT License (MIT) + * + * Copyright (c) 2021 Scott Shawcroft for Adafruit Industries + * + * Permission is hereby granted, free of charge, to any person obtaining a copy + * of this software and associated documentation files (the "Software"), to deal + * in the Software without restriction, including without limitation the rights + * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell + * copies of the Software, and to permit persons to whom the Software is + * furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice shall be included in + * all copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE + * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER + * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, + * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN + * THE SOFTWARE. + */ + +#include "supervisor/board.h" + +// Use the MP_WEAK supervisor/shared/board.c versions of routines not defined here. diff --git a/ports/raspberrypi/boards/raspberry_pi_pico_w/link.ld b/ports/raspberrypi/boards/raspberry_pi_pico_w/link.ld new file mode 100644 index 0000000000..2777b41720 --- /dev/null +++ b/ports/raspberrypi/boards/raspberry_pi_pico_w/link.ld @@ -0,0 +1,294 @@ +/* Based on GCC ARM embedded samples. + Defines the following symbols for use by code: + __exidx_start + __exidx_end + __etext + __data_start__ + __preinit_array_start + __preinit_array_end + __init_array_start + __init_array_end + __fini_array_start + __fini_array_end + __data_end__ + __bss_start__ + __bss_end__ + __end__ + end + __HeapLimit + __StackLimit + __StackTop + __stack (== StackTop) +*/ + +MEMORY +{ + FLASH_FIRMWARE (rx) : ORIGIN = 0x10000000, LENGTH = 1532k + /* Followed by: 4kB of NVRAM and at least 512kB of CIRCUITPY */ + RAM (rwx) : ORIGIN = 0x20000000, LENGTH = 256k + SCRATCH_X (rwx) : ORIGIN = 0x20040000, LENGTH = 4k + SCRATCH_Y (rwx) : ORIGIN = 0x20041000, LENGTH = 4k +} + +ENTRY(_entry_point) + +SECTIONS +{ + /* Second stage bootloader is prepended to the image. It must be 256 bytes big + and checksummed. It is usually built by the boot_stage2 target + in the Pico SDK + */ + + .flash_begin : { + __flash_binary_start = .; + } > FLASH_FIRMWARE + + .boot2 : { + __boot2_start__ = .; + KEEP (*(.boot2)) + __boot2_end__ = .; + } > FLASH_FIRMWARE + + ASSERT(__boot2_end__ - __boot2_start__ == 256, + "ERROR: Pico second stage bootloader must be 256 bytes in size") + + /* The second stage will always enter the image at the start of .text. + The debugger will use the ELF entry point, which is the _entry_point + symbol if present, otherwise defaults to start of .text. + This can be used to transfer control back to the bootrom on debugger + launches only, to perform proper flash setup. + */ + + .text : { + __logical_binary_start = .; + KEEP (*(.vectors)) + KEEP (*(.binary_info_header)) + __binary_info_header_end = .; + KEEP (*(.reset)) + /* TODO revisit this now memset/memcpy/float in ROM */ + /* bit of a hack right now to exclude all floating point and time critical (e.g. memset, memcpy) code from + * FLASH ... we will include any thing excluded here in .data below by default */ + *(.init) + + __property_getter_start = .; + *(.property_getter) + __property_getter_end = .; + __property_getset_start = .; + *(.property_getset) + __property_getset_end = .; + + *(EXCLUDE_FILE(*libgcc.a: *libc.a:*lib_a-mem*.o *libm.a:) .text*) + *(.fini) + /* Pull all c'tors into .text */ + *crtbegin.o(.ctors) + *crtbegin?.o(.ctors) + *(EXCLUDE_FILE(*crtend?.o *crtend.o) .ctors) + *(SORT(.ctors.*)) + *(.ctors) + /* Followed by destructors */ + *crtbegin.o(.dtors) + *crtbegin?.o(.dtors) + *(EXCLUDE_FILE(*crtend?.o *crtend.o) .dtors) + *(SORT(.dtors.*)) + *(.dtors) + + *(.eh_frame*) + . = ALIGN(4); + } > FLASH_FIRMWARE + + .rodata : { + *(EXCLUDE_FILE(*libgcc.a: *libc.a:*lib_a-mem*.o *libm.a:) .rodata*) + . = ALIGN(4); + *(SORT_BY_ALIGNMENT(SORT_BY_NAME(.flashdata*))) + . = ALIGN(4); + } > FLASH_FIRMWARE + + .ARM.extab : + { + *(.ARM.extab* .gnu.linkonce.armextab.*) + } > FLASH_FIRMWARE + + __exidx_start = .; + .ARM.exidx : + { + *(.ARM.exidx* .gnu.linkonce.armexidx.*) + } > FLASH_FIRMWARE + __exidx_end = .; + + /* Machine inspectable binary information */ + . = ALIGN(4); + __binary_info_start = .; + .binary_info : + { + KEEP(*(.binary_info.keep.*)) + *(.binary_info.*) + } > FLASH_FIRMWARE + __binary_info_end = .; + . = ALIGN(4); + + /* End of .text-like segments */ + __etext = .; + + .ram_vector_table (COPY): { + *(.ram_vector_table) + } > RAM + + .data : { + __data_start__ = .; + *(vtable) + + *(.time_critical*) + + /* remaining .text and .rodata; i.e. stuff we exclude above because we want it in RAM */ + *(.text*) + . = ALIGN(4); + *(.rodata*) + . = ALIGN(4); + + *(.data*) + + . = ALIGN(4); + *(.after_data.*) + . = ALIGN(4); + /* preinit data */ + PROVIDE_HIDDEN (__mutex_array_start = .); + KEEP(*(SORT(.mutex_array.*))) + KEEP(*(.mutex_array)) + PROVIDE_HIDDEN (__mutex_array_end = .); + + . = ALIGN(4); + /* preinit data */ + PROVIDE_HIDDEN (__preinit_array_start = .); + KEEP(*(SORT(.preinit_array.*))) + KEEP(*(.preinit_array)) + PROVIDE_HIDDEN (__preinit_array_end = .); + + . = ALIGN(4); + /* init data */ + PROVIDE_HIDDEN (__init_array_start = .); + KEEP(*(SORT(.init_array.*))) + KEEP(*(.init_array)) + PROVIDE_HIDDEN (__init_array_end = .); + + . = ALIGN(4); + /* finit data */ + PROVIDE_HIDDEN (__fini_array_start = .); + *(SORT(.fini_array.*)) + *(.fini_array) + PROVIDE_HIDDEN (__fini_array_end = .); + + *(.jcr) + . = ALIGN(4); + /* All data end */ + __data_end__ = .; + } > RAM AT> FLASH_FIRMWARE + + .itcm : + { + . = ALIGN(4); + *(.itcm.*) + + . = ALIGN(4); + } > RAM AT> FLASH_FIRMWARE + _ld_itcm_destination = ADDR(.itcm); + _ld_itcm_flash_copy = LOADADDR(.itcm); + _ld_itcm_size = SIZEOF(.itcm); + + .dtcm_data : + { + . = ALIGN(4); + + *(.dtcm_data.*) + + . = ALIGN(4); + } > RAM AT> FLASH_FIRMWARE + _ld_dtcm_data_destination = ADDR(.dtcm_data); + _ld_dtcm_data_flash_copy = LOADADDR(.dtcm_data); + _ld_dtcm_data_size = SIZEOF(.dtcm_data); + + .dtcm_bss : + { + . = ALIGN(4); + + *(.dtcm_bss.*) + + . = ALIGN(4); + } > RAM AT> RAM + _ld_dtcm_bss_start = ADDR(.dtcm_bss); + _ld_dtcm_bss_size = SIZEOF(.dtcm_bss); + + .uninitialized_data (COPY): { + . = ALIGN(4); + *(.uninitialized_data*) + } > RAM + + /* Start and end symbols must be word-aligned */ + .scratch_x : { + __scratch_x_start__ = .; + *(.scratch_x.*) + . = ALIGN(4); + __scratch_x_end__ = .; + } > SCRATCH_X AT > FLASH_FIRMWARE + __scratch_x_source__ = LOADADDR(.scratch_x); + + .scratch_y : { + __scratch_y_start__ = .; + *(.scratch_y.*) + . = ALIGN(4); + __scratch_y_end__ = .; + } > SCRATCH_Y AT > FLASH_FIRMWARE + __scratch_y_source__ = LOADADDR(.scratch_y); + + .bss : { + . = ALIGN(4); + __bss_start__ = .; + *(SORT_BY_ALIGNMENT(SORT_BY_NAME(.bss*))) + *(COMMON) + . = ALIGN(4); + __bss_end__ = .; + } > RAM + + .heap (COPY): + { + __end__ = .; + end = __end__; + *(.heap*) + __HeapLimit = .; + } > RAM + + /* .stack*_dummy section doesn't contains any symbols. It is only + * used for linker to calculate size of stack sections, and assign + * values to stack symbols later + * + * stack1 section may be empty/missing if platform_launch_core1 is not used */ + + /* by default we put core 0 stack at the end of scratch Y, so that if core 1 + * stack is not used then all of SCRATCH_X is free. + */ + .stack1_dummy (COPY): + { + *(.stack1*) + } > SCRATCH_X + .stack_dummy (COPY): + { + *(.stack*) + } > SCRATCH_Y + + .flash_end : { + __flash_binary_end = .; + } > FLASH_FIRMWARE + + /* stack limit is poorly named, but historically is maximum heap ptr */ + __StackLimit = ORIGIN(RAM) + LENGTH(RAM); + __StackOneTop = ORIGIN(SCRATCH_X) + LENGTH(SCRATCH_X); + __StackTop = ORIGIN(SCRATCH_Y) + LENGTH(SCRATCH_Y); + __StackOneBottom = __StackOneTop - SIZEOF(.stack1_dummy); + __StackBottom = __StackTop - SIZEOF(.stack_dummy); + PROVIDE(__stack = __StackTop); + + /* Check if data + heap + stack exceeds RAM limit */ + ASSERT(__StackLimit >= __HeapLimit, "region RAM overflowed") + + ASSERT( __binary_info_header_end - __logical_binary_start <= 256, "Binary info must be in first 256 bytes of the binary") + /* todo assert on extra code */ +} diff --git a/ports/raspberrypi/boards/raspberry_pi_pico_w/mpconfigboard.h b/ports/raspberrypi/boards/raspberry_pi_pico_w/mpconfigboard.h new file mode 100644 index 0000000000..58a291b18b --- /dev/null +++ b/ports/raspberrypi/boards/raspberry_pi_pico_w/mpconfigboard.h @@ -0,0 +1,5 @@ +#define MICROPY_HW_BOARD_NAME "Raspberry Pi Pico W" +#define MICROPY_HW_MCU_NAME "rp2040" + +#define CIRCUITPY_DIGITALIO_HAVE_INVALID_PULL (1) +#define CIRCUITPY_DIGITALIO_HAVE_INVALID_DRIVE_MODE (1) diff --git a/ports/raspberrypi/boards/raspberry_pi_pico_w/mpconfigboard.mk b/ports/raspberrypi/boards/raspberry_pi_pico_w/mpconfigboard.mk new file mode 100644 index 0000000000..f075b03693 --- /dev/null +++ b/ports/raspberrypi/boards/raspberry_pi_pico_w/mpconfigboard.mk @@ -0,0 +1,24 @@ +USB_VID = 0x239A +USB_PID = 0x8120 +USB_PRODUCT = "Pico W" +USB_MANUFACTURER = "Raspberry Pi" + +CHIP_VARIANT = RP2040 +CHIP_FAMILY = rp2 + +EXTERNAL_FLASH_DEVICES = "W25Q16JVxQ" + +CIRCUITPY__EVE = 1 + +CIRCUITPY_CYW43 = 1 +CIRCUITPY_SSL = 1 +CIRCUITPY_SSL_MBEDTLS = 1 +CIRCUITPY_HASHLIB = 0 +CIRCUITPY_WEB_WORKFLOW = 0 +CIRCUITPY_MDNS = 0 +CIRCUITPY_SOCKETPOOL = 1 +CIRCUITPY_WIFI = 1 + +CFLAGS += -DCYW43_PIN_WL_HOST_WAKE=24 -DCYW43_PIN_WL_REG_ON=23 -DCYW43_WL_GPIO_COUNT=3 -DCYW43_WL_GPIO_LED_PIN=0 +# Must be accompanied by a linker script change +CFLAGS += -DCIRCUITPY_FIRMWARE_SIZE='(1536 * 1024)' diff --git a/ports/raspberrypi/boards/raspberry_pi_pico_w/pico-sdk-configboard.h b/ports/raspberrypi/boards/raspberry_pi_pico_w/pico-sdk-configboard.h new file mode 100644 index 0000000000..36da55d457 --- /dev/null +++ b/ports/raspberrypi/boards/raspberry_pi_pico_w/pico-sdk-configboard.h @@ -0,0 +1 @@ +// Put board-specific pico-sdk definitions here. This file must exist. diff --git a/ports/raspberrypi/boards/raspberry_pi_pico_w/pins.c b/ports/raspberrypi/boards/raspberry_pi_pico_w/pins.c new file mode 100644 index 0000000000..b3c3c93d57 --- /dev/null +++ b/ports/raspberrypi/boards/raspberry_pi_pico_w/pins.c @@ -0,0 +1,48 @@ +#include "shared-bindings/board/__init__.h" + +STATIC const mp_rom_map_elem_t board_module_globals_table[] = { + CIRCUITPYTHON_BOARD_DICT_STANDARD_ITEMS + + { MP_ROM_QSTR(MP_QSTR_GP0), MP_ROM_PTR(&pin_GPIO0) }, + { MP_ROM_QSTR(MP_QSTR_GP1), MP_ROM_PTR(&pin_GPIO1) }, + { MP_ROM_QSTR(MP_QSTR_GP2), MP_ROM_PTR(&pin_GPIO2) }, + { MP_ROM_QSTR(MP_QSTR_GP3), MP_ROM_PTR(&pin_GPIO3) }, + { MP_ROM_QSTR(MP_QSTR_GP4), MP_ROM_PTR(&pin_GPIO4) }, + { MP_ROM_QSTR(MP_QSTR_GP5), MP_ROM_PTR(&pin_GPIO5) }, + { MP_ROM_QSTR(MP_QSTR_GP6), MP_ROM_PTR(&pin_GPIO6) }, + { MP_ROM_QSTR(MP_QSTR_GP7), MP_ROM_PTR(&pin_GPIO7) }, + { MP_ROM_QSTR(MP_QSTR_GP8), MP_ROM_PTR(&pin_GPIO8) }, + { MP_ROM_QSTR(MP_QSTR_GP9), MP_ROM_PTR(&pin_GPIO9) }, + { MP_ROM_QSTR(MP_QSTR_GP10), MP_ROM_PTR(&pin_GPIO10) }, + { MP_ROM_QSTR(MP_QSTR_GP11), MP_ROM_PTR(&pin_GPIO11) }, + { MP_ROM_QSTR(MP_QSTR_GP12), MP_ROM_PTR(&pin_GPIO12) }, + { MP_ROM_QSTR(MP_QSTR_GP13), MP_ROM_PTR(&pin_GPIO13) }, + { MP_ROM_QSTR(MP_QSTR_GP14), MP_ROM_PTR(&pin_GPIO14) }, + { MP_ROM_QSTR(MP_QSTR_GP15), MP_ROM_PTR(&pin_GPIO15) }, + { MP_ROM_QSTR(MP_QSTR_GP16), MP_ROM_PTR(&pin_GPIO16) }, + { MP_ROM_QSTR(MP_QSTR_GP17), MP_ROM_PTR(&pin_GPIO17) }, + { MP_ROM_QSTR(MP_QSTR_GP18), MP_ROM_PTR(&pin_GPIO18) }, + { MP_ROM_QSTR(MP_QSTR_GP19), MP_ROM_PTR(&pin_GPIO19) }, + { MP_ROM_QSTR(MP_QSTR_GP20), MP_ROM_PTR(&pin_GPIO20) }, + { MP_ROM_QSTR(MP_QSTR_GP21), MP_ROM_PTR(&pin_GPIO21) }, + { MP_ROM_QSTR(MP_QSTR_GP22), MP_ROM_PTR(&pin_GPIO22) }, + + { MP_ROM_QSTR(MP_QSTR_SMPS_MODE), MP_ROM_PTR(&pin_CYW1) }, + + { MP_ROM_QSTR(MP_QSTR_LED), MP_ROM_PTR(&pin_CYW0) }, + + { MP_ROM_QSTR(MP_QSTR_VBUS_SENSE), MP_ROM_PTR(&pin_CYW2) }, + + { MP_ROM_QSTR(MP_QSTR_GP26_A0), MP_ROM_PTR(&pin_GPIO26) }, + { MP_ROM_QSTR(MP_QSTR_GP26), MP_ROM_PTR(&pin_GPIO26) }, + { MP_ROM_QSTR(MP_QSTR_A0), MP_ROM_PTR(&pin_GPIO26) }, + + { MP_ROM_QSTR(MP_QSTR_GP27_A1), MP_ROM_PTR(&pin_GPIO27) }, + { MP_ROM_QSTR(MP_QSTR_GP27), MP_ROM_PTR(&pin_GPIO27) }, + { MP_ROM_QSTR(MP_QSTR_A1), MP_ROM_PTR(&pin_GPIO27) }, + + { MP_ROM_QSTR(MP_QSTR_GP28_A2), MP_ROM_PTR(&pin_GPIO28) }, + { MP_ROM_QSTR(MP_QSTR_GP28), MP_ROM_PTR(&pin_GPIO28) }, + { MP_ROM_QSTR(MP_QSTR_A2), MP_ROM_PTR(&pin_GPIO28) }, +}; +MP_DEFINE_CONST_DICT(board_module_globals, board_module_globals_table); diff --git a/ports/raspberrypi/boards/seeeduino_xiao_rp2040/board.c b/ports/raspberrypi/boards/seeeduino_xiao_rp2040/board.c index de6e424ed9..331653173e 100644 --- a/ports/raspberrypi/boards/seeeduino_xiao_rp2040/board.c +++ b/ports/raspberrypi/boards/seeeduino_xiao_rp2040/board.c @@ -26,15 +26,4 @@ #include "supervisor/board.h" -void board_init(void) { -} - -bool board_requests_safe_mode(void) { - return false; -} - -void reset_board(void) { -} - -void board_deinit(void) { -} +// Use the MP_WEAK supervisor/shared/board.c versions of routines not defined here. diff --git a/ports/raspberrypi/boards/silicognition_rp2040_shim/board.c b/ports/raspberrypi/boards/silicognition_rp2040_shim/board.c new file mode 100644 index 0000000000..331653173e --- /dev/null +++ b/ports/raspberrypi/boards/silicognition_rp2040_shim/board.c @@ -0,0 +1,29 @@ +/* + * This file is part of the MicroPython project, http://micropython.org/ + * + * The MIT License (MIT) + * + * Copyright (c) 2021 Scott Shawcroft for Adafruit Industries + * + * Permission is hereby granted, free of charge, to any person obtaining a copy + * of this software and associated documentation files (the "Software"), to deal + * in the Software without restriction, including without limitation the rights + * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell + * copies of the Software, and to permit persons to whom the Software is + * furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice shall be included in + * all copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE + * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER + * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, + * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN + * THE SOFTWARE. + */ + +#include "supervisor/board.h" + +// Use the MP_WEAK supervisor/shared/board.c versions of routines not defined here. diff --git a/ports/raspberrypi/boards/silicognition_rp2040_shim/mpconfigboard.h b/ports/raspberrypi/boards/silicognition_rp2040_shim/mpconfigboard.h new file mode 100644 index 0000000000..ebfdf8bd9e --- /dev/null +++ b/ports/raspberrypi/boards/silicognition_rp2040_shim/mpconfigboard.h @@ -0,0 +1,14 @@ +#define MICROPY_HW_BOARD_NAME "Silicognition LLC RP2040-Shim" +#define MICROPY_HW_MCU_NAME "rp2040" + +#define MICROPY_HW_NEOPIXEL (&pin_GPIO23) + +#define DEFAULT_I2C_BUS_SCL (&pin_GPIO17) +#define DEFAULT_I2C_BUS_SDA (&pin_GPIO16) + +#define DEFAULT_SPI_BUS_SCK (&pin_GPIO10) +#define DEFAULT_SPI_BUS_MOSI (&pin_GPIO11) +#define DEFAULT_SPI_BUS_MISO (&pin_GPIO12) + +#define DEFAULT_UART_BUS_RX (&pin_GPIO1) +#define DEFAULT_UART_BUS_TX (&pin_GPIO0) diff --git a/ports/raspberrypi/boards/silicognition_rp2040_shim/mpconfigboard.mk b/ports/raspberrypi/boards/silicognition_rp2040_shim/mpconfigboard.mk new file mode 100644 index 0000000000..df18e3ffe8 --- /dev/null +++ b/ports/raspberrypi/boards/silicognition_rp2040_shim/mpconfigboard.mk @@ -0,0 +1,9 @@ +USB_VID = 0x1209 +USB_PID = 0xF502 +USB_PRODUCT = "RP2040-Shim" +USB_MANUFACTURER = "Silicognition LLC" + +CHIP_VARIANT = RP2040 +CHIP_FAMILY = rp2 + +EXTERNAL_FLASH_DEVICES = "P25Q32H" diff --git a/ports/raspberrypi/boards/silicognition_rp2040_shim/pico-sdk-configboard.h b/ports/raspberrypi/boards/silicognition_rp2040_shim/pico-sdk-configboard.h new file mode 100644 index 0000000000..a41131dd22 --- /dev/null +++ b/ports/raspberrypi/boards/silicognition_rp2040_shim/pico-sdk-configboard.h @@ -0,0 +1,4 @@ +// Put board-specific pico-sdk definitions here. This file must exist. + +// Allow extra time for xosc to start. +#define PICO_XOSC_STARTUP_DELAY_MULTIPLIER 64 diff --git a/ports/raspberrypi/boards/silicognition_rp2040_shim/pins.c b/ports/raspberrypi/boards/silicognition_rp2040_shim/pins.c new file mode 100644 index 0000000000..fcde354c2d --- /dev/null +++ b/ports/raspberrypi/boards/silicognition_rp2040_shim/pins.c @@ -0,0 +1,38 @@ +#include "shared-bindings/board/__init__.h" + +STATIC const mp_rom_map_elem_t board_module_globals_table[] = { + CIRCUITPYTHON_BOARD_DICT_STANDARD_ITEMS + + { MP_ROM_QSTR(MP_QSTR_A0), MP_ROM_PTR(&pin_GPIO29) }, + { MP_ROM_QSTR(MP_QSTR_A1), MP_ROM_PTR(&pin_GPIO28) }, + { MP_ROM_QSTR(MP_QSTR_A2), MP_ROM_PTR(&pin_GPIO27) }, + { MP_ROM_QSTR(MP_QSTR_A3), MP_ROM_PTR(&pin_GPIO26) }, + { MP_ROM_QSTR(MP_QSTR_D24), MP_ROM_PTR(&pin_GPIO24) }, + { MP_ROM_QSTR(MP_QSTR_D25), MP_ROM_PTR(&pin_GPIO25) }, + { MP_ROM_QSTR(MP_QSTR_SCK), MP_ROM_PTR(&pin_GPIO10) }, + { MP_ROM_QSTR(MP_QSTR_MOSI), MP_ROM_PTR(&pin_GPIO11) }, + { MP_ROM_QSTR(MP_QSTR_MISO), MP_ROM_PTR(&pin_GPIO12) }, + { MP_ROM_QSTR(MP_QSTR_D0), MP_ROM_PTR(&pin_GPIO1) }, + { MP_ROM_QSTR(MP_QSTR_RX), MP_ROM_PTR(&pin_GPIO1) }, + { MP_ROM_QSTR(MP_QSTR_D1), MP_ROM_PTR(&pin_GPIO0) }, + { MP_ROM_QSTR(MP_QSTR_TX), MP_ROM_PTR(&pin_GPIO0) }, + { MP_ROM_QSTR(MP_QSTR_D4), MP_ROM_PTR(&pin_GPIO6) }, + + { MP_ROM_QSTR(MP_QSTR_SDA), MP_ROM_PTR(&pin_GPIO16) }, + { MP_ROM_QSTR(MP_QSTR_SCL), MP_ROM_PTR(&pin_GPIO17) }, + { MP_ROM_QSTR(MP_QSTR_D5), MP_ROM_PTR(&pin_GPIO18) }, + { MP_ROM_QSTR(MP_QSTR_D6), MP_ROM_PTR(&pin_GPIO19) }, + { MP_ROM_QSTR(MP_QSTR_D9), MP_ROM_PTR(&pin_GPIO20) }, + { MP_ROM_QSTR(MP_QSTR_D10), MP_ROM_PTR(&pin_GPIO21) }, + { MP_ROM_QSTR(MP_QSTR_D11), MP_ROM_PTR(&pin_GPIO15) }, + { MP_ROM_QSTR(MP_QSTR_D12), MP_ROM_PTR(&pin_GPIO14) }, + { MP_ROM_QSTR(MP_QSTR_D13), MP_ROM_PTR(&pin_GPIO22) }, + { MP_ROM_QSTR(MP_QSTR_LED), MP_ROM_PTR(&pin_GPIO22) }, + + { MP_ROM_QSTR(MP_QSTR_NEOPIXEL), MP_ROM_PTR(&pin_GPIO23) }, + + { 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) }, +}; +MP_DEFINE_CONST_DICT(board_module_globals, board_module_globals_table); diff --git a/ports/raspberrypi/boards/solderparty_bbq20kbd/board.c b/ports/raspberrypi/boards/solderparty_bbq20kbd/board.c new file mode 100644 index 0000000000..331653173e --- /dev/null +++ b/ports/raspberrypi/boards/solderparty_bbq20kbd/board.c @@ -0,0 +1,29 @@ +/* + * This file is part of the MicroPython project, http://micropython.org/ + * + * The MIT License (MIT) + * + * Copyright (c) 2021 Scott Shawcroft for Adafruit Industries + * + * Permission is hereby granted, free of charge, to any person obtaining a copy + * of this software and associated documentation files (the "Software"), to deal + * in the Software without restriction, including without limitation the rights + * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell + * copies of the Software, and to permit persons to whom the Software is + * furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice shall be included in + * all copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE + * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER + * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, + * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN + * THE SOFTWARE. + */ + +#include "supervisor/board.h" + +// Use the MP_WEAK supervisor/shared/board.c versions of routines not defined here. diff --git a/ports/raspberrypi/boards/solderparty_bbq20kbd/mpconfigboard.h b/ports/raspberrypi/boards/solderparty_bbq20kbd/mpconfigboard.h new file mode 100644 index 0000000000..4f5f2c1106 --- /dev/null +++ b/ports/raspberrypi/boards/solderparty_bbq20kbd/mpconfigboard.h @@ -0,0 +1,7 @@ +#define MICROPY_HW_BOARD_NAME "BBQ20KBD" +#define MICROPY_HW_MCU_NAME "rp2040" + +#define DEFAULT_I2C_BUS_SCL (&pin_GPIO23) +#define DEFAULT_I2C_BUS_SDA (&pin_GPIO18) + +#define DEFAULT_UART_BUS_TX (&pin_GPIO20) diff --git a/ports/raspberrypi/boards/solderparty_bbq20kbd/mpconfigboard.mk b/ports/raspberrypi/boards/solderparty_bbq20kbd/mpconfigboard.mk new file mode 100644 index 0000000000..3f3acc46be --- /dev/null +++ b/ports/raspberrypi/boards/solderparty_bbq20kbd/mpconfigboard.mk @@ -0,0 +1,13 @@ +USB_VID = 0x1209 +USB_PID = 0xB182 +USB_PRODUCT = "BBQ20 Keyboard" +USB_MANUFACTURER = "Solder Party" + +CHIP_VARIANT = RP2040 +CHIP_FAMILY = rp2 + +EXTERNAL_FLASH_DEVICES = "GD25Q16C" + +CIRCUITPY__EVE = 1 + +FROZEN_MPY_DIRS += $(TOP)/frozen/Adafruit_CircuitPython_HID diff --git a/ports/raspberrypi/boards/solderparty_bbq20kbd/pico-sdk-configboard.h b/ports/raspberrypi/boards/solderparty_bbq20kbd/pico-sdk-configboard.h new file mode 100644 index 0000000000..36da55d457 --- /dev/null +++ b/ports/raspberrypi/boards/solderparty_bbq20kbd/pico-sdk-configboard.h @@ -0,0 +1 @@ +// Put board-specific pico-sdk definitions here. This file must exist. diff --git a/ports/raspberrypi/boards/solderparty_bbq20kbd/pins.c b/ports/raspberrypi/boards/solderparty_bbq20kbd/pins.c new file mode 100644 index 0000000000..c5eab180a0 --- /dev/null +++ b/ports/raspberrypi/boards/solderparty_bbq20kbd/pins.c @@ -0,0 +1,41 @@ +#include "shared-bindings/board/__init__.h" + +STATIC const mp_rom_map_elem_t board_module_globals_table[] = { + CIRCUITPYTHON_BOARD_DICT_STANDARD_ITEMS + + { MP_ROM_QSTR(MP_QSTR_INT), MP_ROM_PTR(&pin_GPIO0) }, + { MP_ROM_QSTR(MP_QSTR_PERIPHERAL_SDA), MP_ROM_PTR(&pin_GPIO28) }, + { MP_ROM_QSTR(MP_QSTR_PERIPHERAL_SCL), MP_ROM_PTR(&pin_GPIO29) }, + + { MP_ROM_QSTR(MP_QSTR_ROW1), MP_ROM_PTR(&pin_GPIO1) }, + { MP_ROM_QSTR(MP_QSTR_ROW2), MP_ROM_PTR(&pin_GPIO2) }, + { MP_ROM_QSTR(MP_QSTR_ROW3), MP_ROM_PTR(&pin_GPIO3) }, + { MP_ROM_QSTR(MP_QSTR_ROW4), MP_ROM_PTR(&pin_GPIO4) }, + { MP_ROM_QSTR(MP_QSTR_ROW5), MP_ROM_PTR(&pin_GPIO5) }, + { MP_ROM_QSTR(MP_QSTR_ROW6), MP_ROM_PTR(&pin_GPIO6) }, + { MP_ROM_QSTR(MP_QSTR_ROW7), MP_ROM_PTR(&pin_GPIO7) }, + + { MP_ROM_QSTR(MP_QSTR_COL1), MP_ROM_PTR(&pin_GPIO8) }, + { MP_ROM_QSTR(MP_QSTR_COL2), MP_ROM_PTR(&pin_GPIO9) }, + { MP_ROM_QSTR(MP_QSTR_COL3), MP_ROM_PTR(&pin_GPIO14) }, + { MP_ROM_QSTR(MP_QSTR_COL4), MP_ROM_PTR(&pin_GPIO13) }, + { MP_ROM_QSTR(MP_QSTR_COL5), MP_ROM_PTR(&pin_GPIO12) }, + { MP_ROM_QSTR(MP_QSTR_COL6), MP_ROM_PTR(&pin_GPIO11) }, + + { MP_ROM_QSTR(MP_QSTR_BTN1), MP_ROM_PTR(&pin_GPIO10) }, + + { MP_ROM_QSTR(MP_QSTR_BACKLIGHT), MP_ROM_PTR(&pin_GPIO25) }, + + { MP_ROM_QSTR(MP_QSTR_TP_RESET), MP_ROM_PTR(&pin_GPIO16) }, + { MP_ROM_QSTR(MP_QSTR_TP_MOTION), MP_ROM_PTR(&pin_GPIO22) }, + { MP_ROM_QSTR(MP_QSTR_TP_SHUTDOWN), MP_ROM_PTR(&pin_GPIO24) }, + + { MP_ROM_QSTR(MP_QSTR_SCL), MP_ROM_PTR(&pin_GPIO23) }, + { MP_ROM_QSTR(MP_QSTR_SDA), MP_ROM_PTR(&pin_GPIO18) }, + + { MP_ROM_QSTR(MP_QSTR_TX), MP_ROM_PTR(&pin_GPIO20) }, + + { MP_ROM_QSTR(MP_QSTR_I2C), MP_ROM_PTR(&board_i2c_obj) }, + { MP_ROM_QSTR(MP_QSTR_UART), MP_ROM_PTR(&board_uart_obj) }, +}; +MP_DEFINE_CONST_DICT(board_module_globals, board_module_globals_table); diff --git a/ports/raspberrypi/boards/solderparty_rp2040_stamp/board.c b/ports/raspberrypi/boards/solderparty_rp2040_stamp/board.c index de6e424ed9..331653173e 100644 --- a/ports/raspberrypi/boards/solderparty_rp2040_stamp/board.c +++ b/ports/raspberrypi/boards/solderparty_rp2040_stamp/board.c @@ -26,15 +26,4 @@ #include "supervisor/board.h" -void board_init(void) { -} - -bool board_requests_safe_mode(void) { - return false; -} - -void reset_board(void) { -} - -void board_deinit(void) { -} +// Use the MP_WEAK supervisor/shared/board.c versions of routines not defined here. diff --git a/ports/raspberrypi/boards/solderparty_rp2040_stamp/stamp_round_carrier_board.py b/ports/raspberrypi/boards/solderparty_rp2040_stamp/stamp_round_carrier_board.py new file mode 100644 index 0000000000..43ce598460 --- /dev/null +++ b/ports/raspberrypi/boards/solderparty_rp2040_stamp/stamp_round_carrier_board.py @@ -0,0 +1,68 @@ +from board import * +import busio + + +_SPI = None +_UART = None +_I2C = None + + +D0 = GP0 +SDA = D0 +D1 = GP1 +SCL = D1 +D8 = GP8 +CIPO = D8 +MISO = D8 +D9 = GP9 +CS = D9 +D10 = GP10 +SCK = D10 +D11 = GP11 +COPI = D11 +MOSI = D11 +D14 = GP14 +D15 = GP15 +D16 = GP16 +TX = D16 +D17 = GP17 +RX = D17 +D26 = GP26 +A0 = D26 +D27 = GP27 +A1 = D27 +D28 = GP28 +A2 = D28 +D29 = GP29 +A3 = D29 +D24 = GP24 +NEOPIXEL = D24 +D25 = GP25 +LED = D25 + + +def SPI(): + global _SPI + + if not _SPI: + _SPI = busio.SPI(SCK, COPI, CIPO) + + return _SPI + + +def UART(): + global _UART + + if not _UART: + _UART = busio.UART(TX, RX) + + return _UART + + +def I2C(): + global _I2C + + if not _I2C: + _I2C = busio.I2C(SCL, SDA) + + return _I2C diff --git a/ports/raspberrypi/boards/sparkfun_micromod_rp2040/board.c b/ports/raspberrypi/boards/sparkfun_micromod_rp2040/board.c index eac54ce460..331653173e 100644 --- a/ports/raspberrypi/boards/sparkfun_micromod_rp2040/board.c +++ b/ports/raspberrypi/boards/sparkfun_micromod_rp2040/board.c @@ -26,18 +26,4 @@ #include "supervisor/board.h" -#include "shared-bindings/microcontroller/Pin.h" -#include "src/rp2_common/hardware_gpio/include/hardware/gpio.h" - -void board_init(void) { -} - -bool board_requests_safe_mode(void) { - return false; -} - -void reset_board(void) { -} - -void board_deinit(void) { -} +// Use the MP_WEAK supervisor/shared/board.c versions of routines not defined here. diff --git a/ports/raspberrypi/boards/sparkfun_pro_micro_rp2040/board.c b/ports/raspberrypi/boards/sparkfun_pro_micro_rp2040/board.c index eac54ce460..331653173e 100644 --- a/ports/raspberrypi/boards/sparkfun_pro_micro_rp2040/board.c +++ b/ports/raspberrypi/boards/sparkfun_pro_micro_rp2040/board.c @@ -26,18 +26,4 @@ #include "supervisor/board.h" -#include "shared-bindings/microcontroller/Pin.h" -#include "src/rp2_common/hardware_gpio/include/hardware/gpio.h" - -void board_init(void) { -} - -bool board_requests_safe_mode(void) { - return false; -} - -void reset_board(void) { -} - -void board_deinit(void) { -} +// Use the MP_WEAK supervisor/shared/board.c versions of routines not defined here. diff --git a/ports/raspberrypi/boards/sparkfun_thing_plus_rp2040/board.c b/ports/raspberrypi/boards/sparkfun_thing_plus_rp2040/board.c index eac54ce460..331653173e 100644 --- a/ports/raspberrypi/boards/sparkfun_thing_plus_rp2040/board.c +++ b/ports/raspberrypi/boards/sparkfun_thing_plus_rp2040/board.c @@ -26,18 +26,4 @@ #include "supervisor/board.h" -#include "shared-bindings/microcontroller/Pin.h" -#include "src/rp2_common/hardware_gpio/include/hardware/gpio.h" - -void board_init(void) { -} - -bool board_requests_safe_mode(void) { - return false; -} - -void reset_board(void) { -} - -void board_deinit(void) { -} +// Use the MP_WEAK supervisor/shared/board.c versions of routines not defined here. diff --git a/ports/raspberrypi/boards/takayoshiotake_octave_rp2040/board.c b/ports/raspberrypi/boards/takayoshiotake_octave_rp2040/board.c new file mode 100644 index 0000000000..331653173e --- /dev/null +++ b/ports/raspberrypi/boards/takayoshiotake_octave_rp2040/board.c @@ -0,0 +1,29 @@ +/* + * This file is part of the MicroPython project, http://micropython.org/ + * + * The MIT License (MIT) + * + * Copyright (c) 2021 Scott Shawcroft for Adafruit Industries + * + * Permission is hereby granted, free of charge, to any person obtaining a copy + * of this software and associated documentation files (the "Software"), to deal + * in the Software without restriction, including without limitation the rights + * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell + * copies of the Software, and to permit persons to whom the Software is + * furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice shall be included in + * all copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE + * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER + * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, + * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN + * THE SOFTWARE. + */ + +#include "supervisor/board.h" + +// Use the MP_WEAK supervisor/shared/board.c versions of routines not defined here. diff --git a/ports/raspberrypi/boards/takayoshiotake_octave_rp2040/mpconfigboard.h b/ports/raspberrypi/boards/takayoshiotake_octave_rp2040/mpconfigboard.h new file mode 100644 index 0000000000..901ae068dd --- /dev/null +++ b/ports/raspberrypi/boards/takayoshiotake_octave_rp2040/mpconfigboard.h @@ -0,0 +1,5 @@ +#define MICROPY_HW_BOARD_NAME "takayoshiotake Octave RP2040" +#define MICROPY_HW_MCU_NAME "rp2040" + +#define MICROPY_HW_NEOPIXEL (&pin_GPIO12) +#define CIRCUITPY_STATUS_LED_POWER (&pin_GPIO11) diff --git a/ports/raspberrypi/boards/takayoshiotake_octave_rp2040/mpconfigboard.mk b/ports/raspberrypi/boards/takayoshiotake_octave_rp2040/mpconfigboard.mk new file mode 100644 index 0000000000..6a7234809c --- /dev/null +++ b/ports/raspberrypi/boards/takayoshiotake_octave_rp2040/mpconfigboard.mk @@ -0,0 +1,9 @@ +USB_VID = 0x1209 +USB_PID = 0x8CAE +USB_PRODUCT = "Octave RP2040" +USB_MANUFACTURER = "takayoshiotake" + +CHIP_VARIANT = RP2040 +CHIP_FAMILY = rp2 + +EXTERNAL_FLASH_DEVICES = "W25Q64JVxQ" diff --git a/ports/raspberrypi/boards/takayoshiotake_octave_rp2040/pico-sdk-configboard.h b/ports/raspberrypi/boards/takayoshiotake_octave_rp2040/pico-sdk-configboard.h new file mode 100644 index 0000000000..a41131dd22 --- /dev/null +++ b/ports/raspberrypi/boards/takayoshiotake_octave_rp2040/pico-sdk-configboard.h @@ -0,0 +1,4 @@ +// Put board-specific pico-sdk definitions here. This file must exist. + +// Allow extra time for xosc to start. +#define PICO_XOSC_STARTUP_DELAY_MULTIPLIER 64 diff --git a/ports/raspberrypi/boards/takayoshiotake_octave_rp2040/pins.c b/ports/raspberrypi/boards/takayoshiotake_octave_rp2040/pins.c new file mode 100644 index 0000000000..4218f9cdea --- /dev/null +++ b/ports/raspberrypi/boards/takayoshiotake_octave_rp2040/pins.c @@ -0,0 +1,45 @@ +#include "shared-bindings/board/__init__.h" + +STATIC const mp_rom_map_elem_t board_module_globals_table[] = { + CIRCUITPYTHON_BOARD_DICT_STANDARD_ITEMS + + { MP_ROM_QSTR(MP_QSTR_GPIO0), MP_ROM_PTR(&pin_GPIO0) }, + { MP_ROM_QSTR(MP_QSTR_GPIO1), MP_ROM_PTR(&pin_GPIO1) }, + { MP_ROM_QSTR(MP_QSTR_GPIO2), MP_ROM_PTR(&pin_GPIO2) }, + { MP_ROM_QSTR(MP_QSTR_GPIO3), MP_ROM_PTR(&pin_GPIO3) }, + { MP_ROM_QSTR(MP_QSTR_GPIO4), MP_ROM_PTR(&pin_GPIO4) }, + { MP_ROM_QSTR(MP_QSTR_GPIO5), MP_ROM_PTR(&pin_GPIO5) }, + { MP_ROM_QSTR(MP_QSTR_GPIO6), MP_ROM_PTR(&pin_GPIO6) }, + { MP_ROM_QSTR(MP_QSTR_GPIO7), MP_ROM_PTR(&pin_GPIO7) }, + { MP_ROM_QSTR(MP_QSTR_GPIO8), MP_ROM_PTR(&pin_GPIO8) }, + { MP_ROM_QSTR(MP_QSTR_GPIO9), MP_ROM_PTR(&pin_GPIO9) }, + { MP_ROM_QSTR(MP_QSTR_GPIO10), MP_ROM_PTR(&pin_GPIO10) }, + { MP_ROM_QSTR(MP_QSTR_GPIO11), MP_ROM_PTR(&pin_GPIO11) }, + { MP_ROM_QSTR(MP_QSTR_GPIO12), MP_ROM_PTR(&pin_GPIO12) }, + { MP_ROM_QSTR(MP_QSTR_GPIO13), MP_ROM_PTR(&pin_GPIO13) }, + { MP_ROM_QSTR(MP_QSTR_GPIO14), MP_ROM_PTR(&pin_GPIO14) }, + { MP_ROM_QSTR(MP_QSTR_GPIO15), MP_ROM_PTR(&pin_GPIO15) }, + { MP_ROM_QSTR(MP_QSTR_GPIO16), MP_ROM_PTR(&pin_GPIO16) }, + { MP_ROM_QSTR(MP_QSTR_GPIO17), MP_ROM_PTR(&pin_GPIO17) }, + { MP_ROM_QSTR(MP_QSTR_GPIO18), MP_ROM_PTR(&pin_GPIO18) }, + { MP_ROM_QSTR(MP_QSTR_GPIO19), MP_ROM_PTR(&pin_GPIO19) }, + { MP_ROM_QSTR(MP_QSTR_GPIO20), MP_ROM_PTR(&pin_GPIO20) }, + { MP_ROM_QSTR(MP_QSTR_GPIO21), MP_ROM_PTR(&pin_GPIO21) }, + { MP_ROM_QSTR(MP_QSTR_GPIO22), MP_ROM_PTR(&pin_GPIO22) }, + { MP_ROM_QSTR(MP_QSTR_GPIO23), MP_ROM_PTR(&pin_GPIO23) }, + { MP_ROM_QSTR(MP_QSTR_GPIO24), MP_ROM_PTR(&pin_GPIO24) }, + { MP_ROM_QSTR(MP_QSTR_GPIO25), MP_ROM_PTR(&pin_GPIO25) }, + { MP_ROM_QSTR(MP_QSTR_GPIO26), MP_ROM_PTR(&pin_GPIO26) }, + { MP_ROM_QSTR(MP_QSTR_GPIO27), MP_ROM_PTR(&pin_GPIO27) }, + { MP_ROM_QSTR(MP_QSTR_GPIO28), MP_ROM_PTR(&pin_GPIO28) }, + { MP_ROM_QSTR(MP_QSTR_GPIO29), MP_ROM_PTR(&pin_GPIO29) }, + + { MP_ROM_QSTR(MP_QSTR_ADC0), MP_ROM_PTR(&pin_GPIO26) }, + { MP_ROM_QSTR(MP_QSTR_ADC1), MP_ROM_PTR(&pin_GPIO27) }, + { MP_ROM_QSTR(MP_QSTR_ADC2), MP_ROM_PTR(&pin_GPIO28) }, + { MP_ROM_QSTR(MP_QSTR_ADC3), MP_ROM_PTR(&pin_GPIO29) }, + + { MP_ROM_QSTR(MP_QSTR_NEOPIX), MP_ROM_PTR(&pin_GPIO12) }, + { MP_ROM_QSTR(MP_QSTR_NEOPIX_POWER), MP_ROM_PTR(&pin_GPIO11) }, +}; +MP_DEFINE_CONST_DICT(board_module_globals, board_module_globals_table); diff --git a/ports/raspberrypi/boards/waveshare_rp2040_zero/board.c b/ports/raspberrypi/boards/waveshare_rp2040_zero/board.c index de6e424ed9..331653173e 100644 --- a/ports/raspberrypi/boards/waveshare_rp2040_zero/board.c +++ b/ports/raspberrypi/boards/waveshare_rp2040_zero/board.c @@ -26,15 +26,4 @@ #include "supervisor/board.h" -void board_init(void) { -} - -bool board_requests_safe_mode(void) { - return false; -} - -void reset_board(void) { -} - -void board_deinit(void) { -} +// Use the MP_WEAK supervisor/shared/board.c versions of routines not defined here. diff --git a/ports/raspberrypi/boards/weact_studio_pico/board.c b/ports/raspberrypi/boards/weact_studio_pico/board.c new file mode 100644 index 0000000000..76973aee30 --- /dev/null +++ b/ports/raspberrypi/boards/weact_studio_pico/board.c @@ -0,0 +1,29 @@ +/* + * This file is part of the MicroPython project, http://micropython.org/ + * + * The MIT License (MIT) + * + * Copyright (c) 2022 Fabian Affolter + * + * Permission is hereby granted, free of charge, to any person obtaining a copy + * of this software and associated documentation files (the "Software"), to deal + * in the Software without restriction, including without limitation the rights + * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell + * copies of the Software, and to permit persons to whom the Software is + * furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice shall be included in + * all copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE + * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER + * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, + * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN + * THE SOFTWARE. + */ + +#include "supervisor/board.h" + +// Use the MP_WEAK supervisor/shared/board.c versions of routines not defined here. diff --git a/ports/raspberrypi/boards/weact_studio_pico/mpconfigboard.h b/ports/raspberrypi/boards/weact_studio_pico/mpconfigboard.h new file mode 100644 index 0000000000..e3276bbd74 --- /dev/null +++ b/ports/raspberrypi/boards/weact_studio_pico/mpconfigboard.h @@ -0,0 +1,2 @@ +#define MICROPY_HW_BOARD_NAME "WeAct Studio Pico" +#define MICROPY_HW_MCU_NAME "rp2040" diff --git a/ports/raspberrypi/boards/weact_studio_pico/mpconfigboard.mk b/ports/raspberrypi/boards/weact_studio_pico/mpconfigboard.mk new file mode 100644 index 0000000000..73f3676825 --- /dev/null +++ b/ports/raspberrypi/boards/weact_studio_pico/mpconfigboard.mk @@ -0,0 +1,11 @@ +USB_VID = 0x239A +USB_PID = 0x102E +USB_PRODUCT = "Pico" +USB_MANUFACTURER = "WeAct Studio" + +CHIP_VARIANT = RP2040 +CHIP_FAMILY = rp2 + +EXTERNAL_FLASH_DEVICES = "W25Q16JVxQ" + +CIRCUITPY__EVE = 1 diff --git a/ports/raspberrypi/boards/weact_studio_pico/pico-sdk-configboard.h b/ports/raspberrypi/boards/weact_studio_pico/pico-sdk-configboard.h new file mode 100644 index 0000000000..36da55d457 --- /dev/null +++ b/ports/raspberrypi/boards/weact_studio_pico/pico-sdk-configboard.h @@ -0,0 +1 @@ +// Put board-specific pico-sdk definitions here. This file must exist. diff --git a/ports/raspberrypi/boards/weact_studio_pico/pins.c b/ports/raspberrypi/boards/weact_studio_pico/pins.c new file mode 100644 index 0000000000..8632d9c322 --- /dev/null +++ b/ports/raspberrypi/boards/weact_studio_pico/pins.c @@ -0,0 +1,53 @@ +#include "shared-bindings/board/__init__.h" + +STATIC const mp_rom_map_elem_t board_module_globals_table[] = { + CIRCUITPYTHON_BOARD_DICT_STANDARD_ITEMS + + { MP_ROM_QSTR(MP_QSTR_GP0), MP_ROM_PTR(&pin_GPIO0) }, + { MP_ROM_QSTR(MP_QSTR_GP1), MP_ROM_PTR(&pin_GPIO1) }, + { MP_ROM_QSTR(MP_QSTR_GP2), MP_ROM_PTR(&pin_GPIO2) }, + { MP_ROM_QSTR(MP_QSTR_GP3), MP_ROM_PTR(&pin_GPIO3) }, + { MP_ROM_QSTR(MP_QSTR_GP4), MP_ROM_PTR(&pin_GPIO4) }, + { MP_ROM_QSTR(MP_QSTR_GP5), MP_ROM_PTR(&pin_GPIO5) }, + { MP_ROM_QSTR(MP_QSTR_GP6), MP_ROM_PTR(&pin_GPIO6) }, + { MP_ROM_QSTR(MP_QSTR_GP7), MP_ROM_PTR(&pin_GPIO7) }, + { MP_ROM_QSTR(MP_QSTR_GP8), MP_ROM_PTR(&pin_GPIO8) }, + { MP_ROM_QSTR(MP_QSTR_GP9), MP_ROM_PTR(&pin_GPIO9) }, + { MP_ROM_QSTR(MP_QSTR_GP10), MP_ROM_PTR(&pin_GPIO10) }, + { MP_ROM_QSTR(MP_QSTR_GP11), MP_ROM_PTR(&pin_GPIO11) }, + { MP_ROM_QSTR(MP_QSTR_GP12), MP_ROM_PTR(&pin_GPIO12) }, + { MP_ROM_QSTR(MP_QSTR_GP13), MP_ROM_PTR(&pin_GPIO13) }, + { MP_ROM_QSTR(MP_QSTR_GP14), MP_ROM_PTR(&pin_GPIO14) }, + { MP_ROM_QSTR(MP_QSTR_GP15), MP_ROM_PTR(&pin_GPIO15) }, + { MP_ROM_QSTR(MP_QSTR_GP16), MP_ROM_PTR(&pin_GPIO16) }, + { MP_ROM_QSTR(MP_QSTR_GP17), MP_ROM_PTR(&pin_GPIO17) }, + { MP_ROM_QSTR(MP_QSTR_GP18), MP_ROM_PTR(&pin_GPIO18) }, + { MP_ROM_QSTR(MP_QSTR_GP19), MP_ROM_PTR(&pin_GPIO19) }, + { MP_ROM_QSTR(MP_QSTR_GP20), MP_ROM_PTR(&pin_GPIO20) }, + { MP_ROM_QSTR(MP_QSTR_GP21), MP_ROM_PTR(&pin_GPIO21) }, + { MP_ROM_QSTR(MP_QSTR_GP22), MP_ROM_PTR(&pin_GPIO22) }, + + { MP_ROM_QSTR(MP_QSTR_BUTTON), MP_ROM_PTR(&pin_GPIO23) }, + { MP_ROM_QSTR(MP_QSTR_GP23), MP_ROM_PTR(&pin_GPIO23) }, + + { MP_ROM_QSTR(MP_QSTR_GP24), MP_ROM_PTR(&pin_GPIO24) }, + + { MP_ROM_QSTR(MP_QSTR_LED), MP_ROM_PTR(&pin_GPIO25) }, + { MP_ROM_QSTR(MP_QSTR_GP25), MP_ROM_PTR(&pin_GPIO25) }, + + { MP_ROM_QSTR(MP_QSTR_GP26_A0), MP_ROM_PTR(&pin_GPIO26) }, + { MP_ROM_QSTR(MP_QSTR_GP26), MP_ROM_PTR(&pin_GPIO26) }, + { MP_ROM_QSTR(MP_QSTR_A0), MP_ROM_PTR(&pin_GPIO26) }, + + { MP_ROM_QSTR(MP_QSTR_GP27_A1), MP_ROM_PTR(&pin_GPIO27) }, + { MP_ROM_QSTR(MP_QSTR_GP27), MP_ROM_PTR(&pin_GPIO27) }, + { MP_ROM_QSTR(MP_QSTR_A1), MP_ROM_PTR(&pin_GPIO27) }, + + { MP_ROM_QSTR(MP_QSTR_GP28_A2), MP_ROM_PTR(&pin_GPIO28) }, + { MP_ROM_QSTR(MP_QSTR_GP28), MP_ROM_PTR(&pin_GPIO28) }, + { MP_ROM_QSTR(MP_QSTR_A2), MP_ROM_PTR(&pin_GPIO28) }, + + { MP_ROM_QSTR(MP_QSTR_A3), MP_ROM_PTR(&pin_GPIO29) }, + { MP_ROM_QSTR(MP_QSTR_VOLTAGE_MONITOR), MP_ROM_PTR(&pin_GPIO29) }, +}; +MP_DEFINE_CONST_DICT(board_module_globals, board_module_globals_table); diff --git a/ports/raspberrypi/boards/wiznet_w5100s_evb_pico/board.c b/ports/raspberrypi/boards/wiznet_w5100s_evb_pico/board.c index de6e424ed9..331653173e 100644 --- a/ports/raspberrypi/boards/wiznet_w5100s_evb_pico/board.c +++ b/ports/raspberrypi/boards/wiznet_w5100s_evb_pico/board.c @@ -26,15 +26,4 @@ #include "supervisor/board.h" -void board_init(void) { -} - -bool board_requests_safe_mode(void) { - return false; -} - -void reset_board(void) { -} - -void board_deinit(void) { -} +// Use the MP_WEAK supervisor/shared/board.c versions of routines not defined here. diff --git a/ports/raspberrypi/boards/wiznet_w5500_evb_pico/board.c b/ports/raspberrypi/boards/wiznet_w5500_evb_pico/board.c new file mode 100644 index 0000000000..331653173e --- /dev/null +++ b/ports/raspberrypi/boards/wiznet_w5500_evb_pico/board.c @@ -0,0 +1,29 @@ +/* + * This file is part of the MicroPython project, http://micropython.org/ + * + * The MIT License (MIT) + * + * Copyright (c) 2021 Scott Shawcroft for Adafruit Industries + * + * Permission is hereby granted, free of charge, to any person obtaining a copy + * of this software and associated documentation files (the "Software"), to deal + * in the Software without restriction, including without limitation the rights + * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell + * copies of the Software, and to permit persons to whom the Software is + * furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice shall be included in + * all copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE + * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER + * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, + * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN + * THE SOFTWARE. + */ + +#include "supervisor/board.h" + +// Use the MP_WEAK supervisor/shared/board.c versions of routines not defined here. diff --git a/ports/raspberrypi/boards/wiznet_w5500_evb_pico/mpconfigboard.h b/ports/raspberrypi/boards/wiznet_w5500_evb_pico/mpconfigboard.h new file mode 100644 index 0000000000..00faa83742 --- /dev/null +++ b/ports/raspberrypi/boards/wiznet_w5500_evb_pico/mpconfigboard.h @@ -0,0 +1,9 @@ +#define MICROPY_HW_BOARD_NAME "W5500-EVB-Pico" +#define MICROPY_HW_MCU_NAME "rp2040" + +#define DEFAULT_SPI_BUS_SCK (&pin_GPIO18) +#define DEFAULT_SPI_BUS_MOSI (&pin_GPIO19) +#define DEFAULT_SPI_BUS_MISO (&pin_GPIO16) + +#define DEFAULT_UART_BUS_RX (&pin_GPIO1) +#define DEFAULT_UART_BUS_TX (&pin_GPIO0) diff --git a/ports/raspberrypi/boards/wiznet_w5500_evb_pico/mpconfigboard.mk b/ports/raspberrypi/boards/wiznet_w5500_evb_pico/mpconfigboard.mk new file mode 100644 index 0000000000..3789a76e0b --- /dev/null +++ b/ports/raspberrypi/boards/wiznet_w5500_evb_pico/mpconfigboard.mk @@ -0,0 +1,11 @@ +USB_VID = 0x2E8A +USB_PID = 0x1029 +USB_PRODUCT = "W5500-EVB-Pico" +USB_MANUFACTURER = "WIZnet" + +CHIP_VARIANT = RP2040 +CHIP_FAMILY = rp2 + +EXTERNAL_FLASH_DEVICES = "W25Q16JVxQ" + +CIRCUITPY__EVE = 1 diff --git a/ports/raspberrypi/boards/wiznet_w5500_evb_pico/pico-sdk-configboard.h b/ports/raspberrypi/boards/wiznet_w5500_evb_pico/pico-sdk-configboard.h new file mode 100644 index 0000000000..36da55d457 --- /dev/null +++ b/ports/raspberrypi/boards/wiznet_w5500_evb_pico/pico-sdk-configboard.h @@ -0,0 +1 @@ +// Put board-specific pico-sdk definitions here. This file must exist. diff --git a/ports/raspberrypi/boards/wiznet_w5500_evb_pico/pins.c b/ports/raspberrypi/boards/wiznet_w5500_evb_pico/pins.c new file mode 100644 index 0000000000..87ff27fa46 --- /dev/null +++ b/ports/raspberrypi/boards/wiznet_w5500_evb_pico/pins.c @@ -0,0 +1,54 @@ +#include "shared-bindings/board/__init__.h" + +STATIC const mp_rom_map_elem_t board_module_globals_table[] = { + CIRCUITPYTHON_BOARD_DICT_STANDARD_ITEMS + + { MP_ROM_QSTR(MP_QSTR_GP0), MP_ROM_PTR(&pin_GPIO0) }, + { MP_ROM_QSTR(MP_QSTR_GP1), MP_ROM_PTR(&pin_GPIO1) }, + { MP_ROM_QSTR(MP_QSTR_GP2), MP_ROM_PTR(&pin_GPIO2) }, + { MP_ROM_QSTR(MP_QSTR_GP3), MP_ROM_PTR(&pin_GPIO3) }, + { MP_ROM_QSTR(MP_QSTR_GP4), MP_ROM_PTR(&pin_GPIO4) }, + { MP_ROM_QSTR(MP_QSTR_GP5), MP_ROM_PTR(&pin_GPIO5) }, + { MP_ROM_QSTR(MP_QSTR_GP6), MP_ROM_PTR(&pin_GPIO6) }, + { MP_ROM_QSTR(MP_QSTR_GP7), MP_ROM_PTR(&pin_GPIO7) }, + { MP_ROM_QSTR(MP_QSTR_GP8), MP_ROM_PTR(&pin_GPIO8) }, + { MP_ROM_QSTR(MP_QSTR_GP9), MP_ROM_PTR(&pin_GPIO9) }, + { MP_ROM_QSTR(MP_QSTR_GP10), MP_ROM_PTR(&pin_GPIO10) }, + { MP_ROM_QSTR(MP_QSTR_GP11), MP_ROM_PTR(&pin_GPIO11) }, + { MP_ROM_QSTR(MP_QSTR_GP12), MP_ROM_PTR(&pin_GPIO12) }, + { MP_ROM_QSTR(MP_QSTR_GP13), MP_ROM_PTR(&pin_GPIO13) }, + { MP_ROM_QSTR(MP_QSTR_GP14), MP_ROM_PTR(&pin_GPIO14) }, + { MP_ROM_QSTR(MP_QSTR_GP15), MP_ROM_PTR(&pin_GPIO15) }, + { MP_ROM_QSTR(MP_QSTR_GP16), MP_ROM_PTR(&pin_GPIO16) }, + { MP_ROM_QSTR(MP_QSTR_GP17), MP_ROM_PTR(&pin_GPIO17) }, + { MP_ROM_QSTR(MP_QSTR_GP18), MP_ROM_PTR(&pin_GPIO18) }, + { MP_ROM_QSTR(MP_QSTR_GP19), MP_ROM_PTR(&pin_GPIO19) }, + { MP_ROM_QSTR(MP_QSTR_GP20), MP_ROM_PTR(&pin_GPIO20) }, + { MP_ROM_QSTR(MP_QSTR_GP21), MP_ROM_PTR(&pin_GPIO21) }, + { MP_ROM_QSTR(MP_QSTR_GP22), MP_ROM_PTR(&pin_GPIO22) }, + + { MP_ROM_QSTR(MP_QSTR_SMPS_MODE), MP_ROM_PTR(&pin_GPIO23) }, + { MP_ROM_QSTR(MP_QSTR_GP23), MP_ROM_PTR(&pin_GPIO23) }, + + { MP_ROM_QSTR(MP_QSTR_VBUS_SENSE), MP_ROM_PTR(&pin_GPIO24) }, + { MP_ROM_QSTR(MP_QSTR_GP24), MP_ROM_PTR(&pin_GPIO24) }, + + { MP_ROM_QSTR(MP_QSTR_LED), MP_ROM_PTR(&pin_GPIO25) }, + { MP_ROM_QSTR(MP_QSTR_GP25), MP_ROM_PTR(&pin_GPIO25) }, + + { MP_ROM_QSTR(MP_QSTR_GP26_A0), MP_ROM_PTR(&pin_GPIO26) }, + { MP_ROM_QSTR(MP_QSTR_GP26), MP_ROM_PTR(&pin_GPIO26) }, + { MP_ROM_QSTR(MP_QSTR_A0), MP_ROM_PTR(&pin_GPIO26) }, + + { MP_ROM_QSTR(MP_QSTR_GP27_A1), MP_ROM_PTR(&pin_GPIO27) }, + { MP_ROM_QSTR(MP_QSTR_GP27), MP_ROM_PTR(&pin_GPIO27) }, + { MP_ROM_QSTR(MP_QSTR_A1), MP_ROM_PTR(&pin_GPIO27) }, + + { MP_ROM_QSTR(MP_QSTR_GP28_A2), MP_ROM_PTR(&pin_GPIO28) }, + { MP_ROM_QSTR(MP_QSTR_GP28), MP_ROM_PTR(&pin_GPIO28) }, + { MP_ROM_QSTR(MP_QSTR_A2), MP_ROM_PTR(&pin_GPIO28) }, + + { MP_ROM_QSTR(MP_QSTR_A3), MP_ROM_PTR(&pin_GPIO29) }, + { MP_ROM_QSTR(MP_QSTR_VOLTAGE_MONITOR), MP_ROM_PTR(&pin_GPIO29) }, +}; +MP_DEFINE_CONST_DICT(board_module_globals, board_module_globals_table); diff --git a/ports/raspberrypi/boards/zrichard_rp2.65-f/board.c b/ports/raspberrypi/boards/zrichard_rp2.65-f/board.c index 635e767a8f..aa189002ba 100644 --- a/ports/raspberrypi/boards/zrichard_rp2.65-f/board.c +++ b/ports/raspberrypi/boards/zrichard_rp2.65-f/board.c @@ -29,17 +29,9 @@ #include "src/rp2_common/hardware_gpio/include/hardware/gpio.h" #include "supervisor/shared/board.h" -void board_init(void) { -} - -bool board_requests_safe_mode(void) { - return false; -} - void reset_board(void) { // turn off any left over LED board_reset_user_neopixels(&pin_GPIO25, 62); } -void board_deinit(void) { -} +// Use the MP_WEAK supervisor/shared/board.c versions of routines not defined here. diff --git a/ports/raspberrypi/common-hal/alarm/__init__.c b/ports/raspberrypi/common-hal/alarm/__init__.c index 0d6734568b..31fa58aab3 100644 --- a/ports/raspberrypi/common-hal/alarm/__init__.c +++ b/ports/raspberrypi/common-hal/alarm/__init__.c @@ -194,7 +194,10 @@ mp_obj_t common_hal_alarm_light_sleep_until_alarms(size_t n_alarms, const mp_obj return wake_alarm; } -void common_hal_alarm_set_deep_sleep_alarms(size_t n_alarms, const mp_obj_t *alarms) { +void common_hal_alarm_set_deep_sleep_alarms(size_t n_alarms, const mp_obj_t *alarms, size_t n_dios, digitalio_digitalinout_obj_t **preserve_dios) { + if (n_dios > 0) { + mp_raise_NotImplementedError_varg(translate("%q"), MP_QSTR_preserve_dios); + } _setup_sleep_alarms(true, n_alarms, alarms); } diff --git a/ports/raspberrypi/common-hal/analogbufio/BufferedIn.c b/ports/raspberrypi/common-hal/analogbufio/BufferedIn.c new file mode 100644 index 0000000000..951c07af03 --- /dev/null +++ b/ports/raspberrypi/common-hal/analogbufio/BufferedIn.c @@ -0,0 +1,167 @@ +/* + * This file is part of the MicroPython project, http://micropython.org/ + * + * The MIT License (MIT) + * + * SPDX-FileCopyrightText: Copyright (c) 2022 Lee Atkinson, MeanStride Technology, Inc. + * + * SPDX-License-Identifier: BSD-3-Clause + * + * Copyright (c) 2021 Raspberry Pi (Trading) Ltd. + * https://github.com/raspberrypi/pico-examples/blob/master/adc/dma_capture/dma_capture.c + * + * Permission is hereby granted, free of charge, to any person obtaining a copy + * of this software and associated documentation files (the "Software"), to deal + * in the Software without restriction, including without limitation the rights + * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell + * copies of the Software, and to permit persons to whom the Software is + * furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice shall be included in + * all copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE + * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER + * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, + * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN + * THE SOFTWARE. + */ + +#include +#include "common-hal/analogbufio/BufferedIn.h" +#include "shared-bindings/analogbufio/BufferedIn.h" +#include "shared-bindings/microcontroller/Pin.h" +#include "py/runtime.h" +#include "supervisor/shared/translate/translate.h" +#include "src/rp2_common/hardware_adc/include/hardware/adc.h" +#include "src/rp2_common/hardware_dma/include/hardware/dma.h" +#include "src/common/pico_stdlib/include/pico/stdlib.h" + +#define ADC_FIRST_PIN_NUMBER 26 +#define ADC_PIN_COUNT 4 + +void common_hal_analogbufio_bufferedin_construct(analogbufio_bufferedin_obj_t *self, const mcu_pin_obj_t *pin, uint8_t *buffer, uint32_t len, uint8_t bytes_per_sample, bool samples_signed, uint32_t sample_rate) { + + // Make sure pin number is in range for ADC + if (pin->number < ADC_FIRST_PIN_NUMBER || pin->number >= (ADC_FIRST_PIN_NUMBER + ADC_PIN_COUNT)) { + raise_ValueError_invalid_pins(); + } + + // Set pin and channel + self->pin = pin; + claim_pin(pin); + + // TODO: find a way to accept ADC4 for temperature + self->chan = pin->number - ADC_FIRST_PIN_NUMBER; + + // Set buffer and length + self->buffer = buffer; + self->len = len; + + // Set sample rate - used in read + self->bytes_per_sample = bytes_per_sample; + self->sample_rate = sample_rate; + + // Init GPIO for analogue use: hi-Z, no pulls, disable digital input buffer. + adc_init(); + adc_gpio_init(pin->number); + adc_select_input(self->chan); // chan = pin - 26 ?? + + // RP2040 Implementation Detail + // Fills the supplied buffer with ADC values using DMA transfer. + // If the buffer is 8-bit, then values are 8-bit shifted and error bit is off. + // If buffer is 16-bit, then values are not shifted and error bit is present. + // Number of transfers is always the number of samples which is the array + // byte length divided by the bytes_per_sample. + + // self->bytes_per_sample == 1 + uint dma_size = DMA_SIZE_8; + bool show_error_bit = false; + bool shift_sample_8_bits = true; + if (self->bytes_per_sample == 2) { + dma_size = DMA_SIZE_16; + show_error_bit = true; + shift_sample_8_bits = false; + } + + // adc_select_input(self->pin->number - ADC_FIRST_PIN_NUMBER); + adc_fifo_setup( + true, // Write each completed conversion to the sample FIFO + true, // Enable DMA data request (DREQ) + 1, // DREQ (and IRQ) asserted when at least 1 sample present + show_error_bit, // See the ERR bit + shift_sample_8_bits // Shift each sample to 8 bits when pushing to FIFO + ); + + // Divisor of 0 -> full speed. Free-running capture with the divider is + // equivalent to pressing the ADC_CS_START_ONCE button once per `div + 1` + // cycles (div not necessarily an integer). Each conversion takes 96 + // cycles, so in general you want a divider of 0 (hold down the button + // continuously) or > 95 (take samples less frequently than 96 cycle + // intervals). This is all timed by the 48 MHz ADC clock. + // sample rate determines divisor, not zero. + + // sample_rate is forced to be >= 1 in shared-bindings + adc_set_clkdiv((float)48000000.0 / (float)self->sample_rate); + + // Set up the DMA to start transferring data as soon as it appears in FIFO + uint dma_chan = dma_claim_unused_channel(true); + self->dma_chan = dma_chan; + + // Set Config + self->cfg = dma_channel_get_default_config(dma_chan); + + // Reading from constant address, writing to incrementing byte addresses + channel_config_set_transfer_data_size(&(self->cfg), dma_size); + channel_config_set_read_increment(&(self->cfg), false); + channel_config_set_write_increment(&(self->cfg), true); + + // Pace transfers based on availability of ADC samples + channel_config_set_dreq(&(self->cfg), DREQ_ADC); + + // clear any previous activity + adc_fifo_drain(); + adc_run(false); +} + +bool common_hal_analogbufio_bufferedin_deinited(analogbufio_bufferedin_obj_t *self) { + return self->pin == NULL; +} + +void common_hal_analogbufio_bufferedin_deinit(analogbufio_bufferedin_obj_t *self) { + if (common_hal_analogbufio_bufferedin_deinited(self)) { + return; + } + + // Release ADC Pin + reset_pin_number(self->pin->number); + self->pin = NULL; + + // Release DMA Channel + dma_channel_unclaim(self->dma_chan); +} + +void common_hal_analogbufio_bufferedin_read(analogbufio_bufferedin_obj_t *self) { + + uint32_t cdl = self->len / self->bytes_per_sample; + + dma_channel_configure(self->dma_chan, &(self->cfg), + self->buffer, // dst + &adc_hw->fifo, // src + cdl, // transfer count + true // start immediately + ); + + // Start the ADC + adc_run(true); + + // Once DMA finishes, stop any new conversions from starting, and clean up + // the FIFO in case the ADC was still mid-conversion. + dma_channel_wait_for_finish_blocking(self->dma_chan); + + // Clean up + adc_run(false); + adc_fifo_drain(); +} diff --git a/ports/raspberrypi/common-hal/analogbufio/BufferedIn.h b/ports/raspberrypi/common-hal/analogbufio/BufferedIn.h new file mode 100644 index 0000000000..8b183a1d70 --- /dev/null +++ b/ports/raspberrypi/common-hal/analogbufio/BufferedIn.h @@ -0,0 +1,56 @@ +/* + * This file is part of the MicroPython project, http://micropython.org/ + * + * The MIT License (MIT) + * + * SPDX-FileCopyrightText: Copyright (c) 2022 Lee Atkinson, MeanStride Technology, Inc. + * + * SPDX-License-Identifier: BSD-3-Clause + * + * Copyright (c) 2021 Raspberry Pi (Trading) Ltd. + * https://github.com/raspberrypi/pico-examples/blob/master/adc/dma_capture/dma_capture.c + * + * 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_RASPBERRYPI_COMMON_HAL_ANALOGBUFIO_BUFFEREDIN_H +#define MICROPY_INCLUDED_RASPBERRYPI_COMMON_HAL_ANALOGBUFIO_BUFFEREDIN_H + +#include "common-hal/microcontroller/Pin.h" +#include "src/rp2_common/hardware_dma/include/hardware/dma.h" + +#include "py/obj.h" + +// This is the analogbufio object +typedef struct { + mp_obj_base_t base; + const mcu_pin_obj_t *pin; + uint8_t *buffer; + uint32_t len; + uint8_t bytes_per_sample; + bool samples_signed; + uint32_t sample_rate; + uint8_t chan; + uint dma_chan; + dma_channel_config cfg; +} analogbufio_bufferedin_obj_t; + +void bufferedin_init(void); + +#endif // MICROPY_INCLUDED_RASPBERRYPI_COMMON_HAL_ANALOGBUFIO_BUFFEREDIN_H diff --git a/ports/raspberrypi/common-hal/analogbufio/__init__.c b/ports/raspberrypi/common-hal/analogbufio/__init__.c new file mode 100644 index 0000000000..b6c74b985b --- /dev/null +++ b/ports/raspberrypi/common-hal/analogbufio/__init__.c @@ -0,0 +1 @@ +// No analogbufio module functions. diff --git a/ports/raspberrypi/common-hal/analogio/AnalogIn.c b/ports/raspberrypi/common-hal/analogio/AnalogIn.c index 1d77630063..b827068e1a 100644 --- a/ports/raspberrypi/common-hal/analogio/AnalogIn.c +++ b/ports/raspberrypi/common-hal/analogio/AnalogIn.c @@ -26,8 +26,9 @@ #include "common-hal/analogio/AnalogIn.h" #include "shared-bindings/analogio/AnalogIn.h" +#include "shared-bindings/microcontroller/Pin.h" #include "py/runtime.h" -#include "supervisor/shared/translate.h" +#include "supervisor/shared/translate/translate.h" #include "src/rp2_common/hardware_adc/include/hardware/adc.h" @@ -36,7 +37,7 @@ void common_hal_analogio_analogin_construct(analogio_analogin_obj_t *self, const mcu_pin_obj_t *pin) { if (pin->number < ADC_FIRST_PIN_NUMBER || pin->number > ADC_FIRST_PIN_NUMBER + ADC_PIN_COUNT) { - mp_raise_ValueError(translate("Pin does not have ADC capabilities")); + raise_ValueError_invalid_pin(); } adc_init(); @@ -64,8 +65,8 @@ uint16_t common_hal_analogio_analogin_get_value(analogio_analogin_obj_t *self) { adc_select_input(self->pin->number - ADC_FIRST_PIN_NUMBER); uint16_t value = adc_read(); - // Map value to from 12 to 16 bits - return value << 4; + // Stretch 12-bit ADC reading to 16-bit range + return (value << 4) | (value >> 8); } float common_hal_analogio_analogin_get_reference_voltage(analogio_analogin_obj_t *self) { diff --git a/ports/raspberrypi/common-hal/analogio/AnalogOut.c b/ports/raspberrypi/common-hal/analogio/AnalogOut.c index 7afa773d30..38ff935674 100644 --- a/ports/raspberrypi/common-hal/analogio/AnalogOut.c +++ b/ports/raspberrypi/common-hal/analogio/AnalogOut.c @@ -31,10 +31,10 @@ #include "py/mperrno.h" #include "py/runtime.h" -#include "supervisor/shared/translate.h" +#include "supervisor/shared/translate/translate.h" void common_hal_analogio_analogout_construct(analogio_analogout_obj_t *self, const mcu_pin_obj_t *pin) { - mp_raise_RuntimeError(translate("AnalogOut functionality not supported")); + mp_raise_NotImplementedError_varg(translate("%q"), MP_QSTR_AnalogOut); } bool common_hal_analogio_analogout_deinited(analogio_analogout_obj_t *self) { diff --git a/ports/raspberrypi/common-hal/audiobusio/I2SOut.c b/ports/raspberrypi/common-hal/audiobusio/I2SOut.c index 037163472d..7db053a39d 100644 --- a/ports/raspberrypi/common-hal/audiobusio/I2SOut.c +++ b/ports/raspberrypi/common-hal/audiobusio/I2SOut.c @@ -37,7 +37,7 @@ #include "shared-bindings/microcontroller/Pin.h" #include "shared-module/audiocore/__init__.h" #include "bindings/rp2pio/StateMachine.h" -#include "supervisor/shared/translate.h" +#include "supervisor/shared/translate/translate.h" const uint16_t i2s_program[] = { // ; Load the next set of samples diff --git a/ports/raspberrypi/common-hal/audiobusio/PDMIn.c b/ports/raspberrypi/common-hal/audiobusio/PDMIn.c index 8301f9fde4..c3aadd2bbe 100644 --- a/ports/raspberrypi/common-hal/audiobusio/PDMIn.c +++ b/ports/raspberrypi/common-hal/audiobusio/PDMIn.c @@ -32,7 +32,7 @@ #include "py/runtime.h" #include "shared-bindings/audiobusio/PDMIn.h" #include "shared-bindings/microcontroller/Pin.h" -#include "supervisor/shared/translate.h" +#include "supervisor/shared/translate/translate.h" #include "audio_dma.h" diff --git a/ports/raspberrypi/common-hal/audiopwmio/PWMAudioOut.c b/ports/raspberrypi/common-hal/audiopwmio/PWMAudioOut.c index 2f09124f4b..8b5c3accec 100644 --- a/ports/raspberrypi/common-hal/audiopwmio/PWMAudioOut.c +++ b/ports/raspberrypi/common-hal/audiopwmio/PWMAudioOut.c @@ -39,7 +39,7 @@ #include "shared-bindings/microcontroller/__init__.h" #include "shared-bindings/microcontroller/Pin.h" #include "shared-bindings/microcontroller/Processor.h" -#include "supervisor/shared/translate.h" +#include "supervisor/shared/translate/translate.h" #include "src/rp2040/hardware_structs/include/hardware/structs/dma.h" #include "src/rp2_common/hardware_pwm/include/hardware/pwm.h" diff --git a/ports/raspberrypi/common-hal/busio/I2C.c b/ports/raspberrypi/common-hal/busio/I2C.c index 516cee2227..c68499591c 100644 --- a/ports/raspberrypi/common-hal/busio/I2C.c +++ b/ports/raspberrypi/common-hal/busio/I2C.c @@ -30,6 +30,7 @@ #include "py/runtime.h" #include "shared-bindings/microcontroller/__init__.h" +#include "shared-bindings/microcontroller/Pin.h" #include "shared-bindings/bitbangio/I2C.h" #include "src/rp2_common/hardware_gpio/include/hardware/gpio.h" @@ -65,14 +66,14 @@ void common_hal_busio_i2c_construct(busio_i2c_obj_t *self, self->peripheral = i2c[sda_instance]; } if (self->peripheral == NULL) { - mp_raise_ValueError(translate("Invalid pins")); + raise_ValueError_invalid_pins(); } if ((i2c_get_hw(self->peripheral)->enable & I2C_IC_ENABLE_ENABLE_BITS) != 0) { mp_raise_ValueError(translate("I2C peripheral in use")); } - if (frequency > 1000000) { - mp_raise_ValueError(translate("Unsupported baudrate")); - } + + mp_arg_validate_int_max(frequency, 1000000, MP_QSTR_frequency); + #if CIRCUITPY_REQUIRE_I2C_PULLUPS // Test that the pins are in a high state. (Hopefully indicating they are pulled up.) @@ -189,7 +190,7 @@ STATIC uint8_t _common_hal_busio_i2c_write(busio_i2c_obj_t *self, uint16_t addr, return status; } - int result = i2c_write_timeout_us(self->peripheral, addr, data, len, !transmit_stop_bit, BUS_TIMEOUT_US); + size_t result = i2c_write_timeout_us(self->peripheral, addr, data, len, !transmit_stop_bit, BUS_TIMEOUT_US); if (result == len) { return 0; } @@ -210,7 +211,7 @@ uint8_t common_hal_busio_i2c_write(busio_i2c_obj_t *self, uint16_t addr, uint8_t common_hal_busio_i2c_read(busio_i2c_obj_t *self, uint16_t addr, uint8_t *data, size_t len) { - int result = i2c_read_timeout_us(self->peripheral, addr, data, len, false, BUS_TIMEOUT_US); + size_t result = i2c_read_timeout_us(self->peripheral, addr, data, len, false, BUS_TIMEOUT_US); if (result == len) { return 0; } diff --git a/ports/raspberrypi/common-hal/busio/SPI.c b/ports/raspberrypi/common-hal/busio/SPI.c index 4a18d62584..a7b97823f9 100644 --- a/ports/raspberrypi/common-hal/busio/SPI.c +++ b/ports/raspberrypi/common-hal/busio/SPI.c @@ -82,7 +82,7 @@ void common_hal_busio_spi_construct(busio_spi_obj_t *self, // TODO: Check to see if we're sharing the SPI with a native APA102. if (instance_index > 1) { - mp_raise_ValueError(translate("Invalid pins")); + raise_ValueError_invalid_pins(); } if (instance_index == 0) { diff --git a/ports/raspberrypi/common-hal/busio/UART.c b/ports/raspberrypi/common-hal/busio/UART.c index 97af41d495..4212249ec9 100644 --- a/ports/raspberrypi/common-hal/busio/UART.c +++ b/ports/raspberrypi/common-hal/busio/UART.c @@ -32,6 +32,7 @@ #include "supervisor/shared/tick.h" #include "shared/runtime/interrupt_char.h" #include "common-hal/microcontroller/Pin.h" +#include "shared-bindings/microcontroller/Pin.h" #include "src/rp2_common/hardware_irq/include/hardware/irq.h" #include "src/rp2_common/hardware_gpio/include/hardware/gpio.h" @@ -66,7 +67,7 @@ static uint8_t pin_init(const uint8_t uart, const mcu_pin_obj_t *pin, const uint return NO_PIN; } if (!(((pin->number % 4) == pin_type) && ((((pin->number + 4) / 8) % NUM_UARTS) == uart))) { - mp_raise_ValueError(translate("Invalid pins")); + raise_ValueError_invalid_pins(); } claim_pin(pin); gpio_set_function(pin->number, GPIO_FUNC_UART); @@ -104,13 +105,8 @@ void common_hal_busio_uart_construct(busio_uart_obj_t *self, mp_float_t timeout, uint16_t receiver_buffer_size, byte *receiver_buffer, bool sigint_enabled) { - if (bits > 8) { - mp_raise_ValueError(translate("Invalid word/bit length")); - } - - if (receiver_buffer_size == 0) { - mp_raise_ValueError(translate("Invalid buffer size")); - } + mp_arg_validate_int_max(bits, 8, MP_QSTR_bits); + mp_arg_validate_int_min(receiver_buffer_size, 1, MP_QSTR_receiver_buffer_size); uint8_t uart_id = ((((tx != NULL) ? tx->number : rx->number) + 4) / 8) % NUM_UARTS; @@ -159,27 +155,33 @@ void common_hal_busio_uart_construct(busio_uart_obj_t *self, uart_set_hw_flow(self->uart, (cts != NULL), (rts != NULL)); if (rx != NULL) { - // Initially allocate the UART's buffer in the long-lived part of the - // heap. UARTs are generally long-lived objects, but the "make long- - // lived" machinery is incapable of moving internal pointers like - // self->buffer, so do it manually. (However, as long as internal - // pointers like this are NOT moved, allocating the buffer - // in the long-lived pool is not strictly necessary) - // (This is a macro.) - if (!ringbuf_alloc(&self->ringbuf, receiver_buffer_size, true)) { - mp_raise_msg(&mp_type_MemoryError, translate("Failed to allocate RX buffer")); - } - active_uarts[uart_id] = self; - if (uart_id == 1) { - self->uart_irq_id = UART1_IRQ; - irq_set_exclusive_handler(self->uart_irq_id, uart1_callback); + // Use the provided buffer when given. + if (receiver_buffer != NULL) { + ringbuf_init(&self->ringbuf, receiver_buffer, receiver_buffer_size); } else { - self->uart_irq_id = UART0_IRQ; - irq_set_exclusive_handler(self->uart_irq_id, uart0_callback); + // Initially allocate the UART's buffer in the long-lived part of the + // heap. UARTs are generally long-lived objects, but the "make long- + // lived" machinery is incapable of moving internal pointers like + // self->buffer, so do it manually. (However, as long as internal + // pointers like this are NOT moved, allocating the buffer + // in the long-lived pool is not strictly necessary) + if (!ringbuf_alloc(&self->ringbuf, receiver_buffer_size, true)) { + uart_deinit(self->uart); + m_malloc_fail(receiver_buffer_size); + } } - irq_set_enabled(self->uart_irq_id, true); - uart_set_irq_enables(self->uart, true /* rx has data */, false /* tx needs data */); } + + active_uarts[uart_id] = self; + if (uart_id == 1) { + self->uart_irq_id = UART1_IRQ; + irq_set_exclusive_handler(self->uart_irq_id, uart1_callback); + } else { + self->uart_irq_id = UART0_IRQ; + irq_set_exclusive_handler(self->uart_irq_id, uart0_callback); + } + irq_set_enabled(self->uart_irq_id, true); + uart_set_irq_enables(self->uart, true /* rx has data */, false /* tx needs data */); } bool common_hal_busio_uart_deinited(busio_uart_obj_t *self) { @@ -191,7 +193,7 @@ void common_hal_busio_uart_deinit(busio_uart_obj_t *self) { return; } uart_deinit(self->uart); - ringbuf_free(&self->ringbuf); + ringbuf_deinit(&self->ringbuf); active_uarts[self->uart_id] = NULL; uart_status[self->uart_id] = STATUS_FREE; reset_pin_number(self->tx_pin); @@ -315,7 +317,7 @@ uint32_t common_hal_busio_uart_rx_characters_available(busio_uart_obj_t *self) { // The UART only interrupts after a threshold so make sure to copy anything // out of its FIFO before measuring how many bytes we've received. _copy_into_ringbuf(&self->ringbuf, self->uart); - irq_set_enabled(self->uart_irq_id, false); + irq_set_enabled(self->uart_irq_id, true); return ringbuf_num_filled(&self->ringbuf); } diff --git a/ports/raspberrypi/common-hal/countio/Counter.c b/ports/raspberrypi/common-hal/countio/Counter.c index 0ae773bdf3..b51d182c3a 100644 --- a/ports/raspberrypi/common-hal/countio/Counter.c +++ b/ports/raspberrypi/common-hal/countio/Counter.c @@ -2,7 +2,7 @@ #include "py/runtime.h" #include "py/mpstate.h" -#include "supervisor/shared/translate.h" +#include "supervisor/shared/translate/translate.h" #include "shared-bindings/countio/Edge.h" #include "shared-bindings/digitalio/Pull.h" @@ -31,7 +31,6 @@ void common_hal_countio_counter_construct(countio_counter_obj_t *self, mp_raise_RuntimeError(translate("PWM slice already in use")); } - uint8_t ab_channel = pwm_gpio_to_channel(self->pin); if (!pwmio_claim_slice_ab_channels(self->slice_num)) { mp_raise_RuntimeError(translate("PWM slice channel A already in use")); } diff --git a/ports/raspberrypi/common-hal/digitalio/DigitalInOut.c b/ports/raspberrypi/common-hal/digitalio/DigitalInOut.c index a8a5a6b4d9..bbb521ffc5 100644 --- a/ports/raspberrypi/common-hal/digitalio/DigitalInOut.c +++ b/ports/raspberrypi/common-hal/digitalio/DigitalInOut.c @@ -31,11 +31,18 @@ #include "py/mphal.h" #include "common-hal/microcontroller/Pin.h" +#include "shared-bindings/microcontroller/Pin.h" #include "shared-bindings/digitalio/DigitalInOut.h" -#include "supervisor/shared/translate.h" +#include "supervisor/shared/translate/translate.h" #include "src/rp2_common/hardware_gpio/include/hardware/gpio.h" +#if CIRCUITPY_CYW43 +#include "pico/cyw43_arch.h" +#include "bindings/cyw43/__init__.h" +#define IS_CYW(self) ((self)->pin->base.type == &cyw43_pin_type) +#endif + digitalinout_result_t common_hal_digitalio_digitalinout_construct( digitalio_digitalinout_obj_t *self, const mcu_pin_obj_t *pin) { claim_pin(pin); @@ -61,20 +68,31 @@ void common_hal_digitalio_digitalinout_deinit(digitalio_digitalinout_obj_t *self if (common_hal_digitalio_digitalinout_deinited(self)) { return; } - reset_pin_number(self->pin->number); + common_hal_reset_pin(self->pin); self->pin = NULL; } -void common_hal_digitalio_digitalinout_switch_to_input( +digitalinout_result_t common_hal_digitalio_digitalinout_switch_to_input( digitalio_digitalinout_obj_t *self, digitalio_pull_t pull) { - self->output = false; // This also sets direction to input. - common_hal_digitalio_digitalinout_set_pull(self, pull); + return common_hal_digitalio_digitalinout_set_pull(self, pull); } digitalinout_result_t common_hal_digitalio_digitalinout_switch_to_output( digitalio_digitalinout_obj_t *self, bool value, digitalio_drive_mode_t drive_mode) { + + #if CIRCUITPY_CYW43 + if (IS_CYW(self)) { + if (drive_mode != DRIVE_MODE_PUSH_PULL) { + return DIGITALINOUT_INVALID_DRIVE_MODE; + } + cyw43_arch_gpio_put(self->pin->number, value); + self->output = true; + self->open_drain = false; + return DIGITALINOUT_OK; + } + #endif const uint8_t pin = self->pin->number; gpio_disable_pulls(pin); @@ -99,6 +117,12 @@ digitalio_direction_t common_hal_digitalio_digitalinout_get_direction( void common_hal_digitalio_digitalinout_set_value( digitalio_digitalinout_obj_t *self, bool value) { const uint8_t pin = self->pin->number; + #if CIRCUITPY_CYW43 + if (IS_CYW(self)) { + cyw43_arch_gpio_put(pin, value); + return; + } + #endif if (self->open_drain && value) { // If true and open-drain, set the direction -before- setting // the pin value, to to avoid a high glitch on the pin before @@ -116,13 +140,24 @@ void common_hal_digitalio_digitalinout_set_value( bool common_hal_digitalio_digitalinout_get_value( digitalio_digitalinout_obj_t *self) { + #if CIRCUITPY_CYW43 + if (IS_CYW(self)) { + return cyw43_arch_gpio_get(self->pin->number); + } + #endif return gpio_get(self->pin->number); } digitalinout_result_t common_hal_digitalio_digitalinout_set_drive_mode( digitalio_digitalinout_obj_t *self, digitalio_drive_mode_t drive_mode) { - const uint8_t pin = self->pin->number; + #if CIRCUITPY_CYW43 + if (IS_CYW(self)) { + if (drive_mode != DRIVE_MODE_PUSH_PULL) { + return DIGITALINOUT_INVALID_DRIVE_MODE; + } + } + #endif bool value = common_hal_digitalio_digitalinout_get_value(self); self->open_drain = drive_mode == DRIVE_MODE_OPEN_DRAIN; // True is implemented differently between modes so reset the value to make @@ -142,11 +177,23 @@ digitalio_drive_mode_t common_hal_digitalio_digitalinout_get_drive_mode( } } -void common_hal_digitalio_digitalinout_set_pull( +digitalinout_result_t common_hal_digitalio_digitalinout_set_pull( digitalio_digitalinout_obj_t *self, digitalio_pull_t pull) { + #if CIRCUITPY_CYW43 + if (IS_CYW(self)) { + if (pull != PULL_NONE) { + return DIGITALINOUT_INVALID_PULL; + } + cyw43_arch_gpio_get(self->pin->number); + self->output = false; + return DIGITALINOUT_OK; + } + #endif const uint8_t pin = self->pin->number; gpio_set_pulls(pin, pull == PULL_UP, pull == PULL_DOWN); gpio_set_dir(pin, GPIO_IN); + self->output = false; + return DIGITALINOUT_OK; } digitalio_pull_t common_hal_digitalio_digitalinout_get_pull( @@ -170,6 +217,11 @@ bool common_hal_digitalio_has_reg_op(digitalinout_reg_op_t op) { } volatile uint32_t *common_hal_digitalio_digitalinout_get_reg(digitalio_digitalinout_obj_t *self, digitalinout_reg_op_t op, uint32_t *mask) { + #if CIRCUITPY_CYW43 + if (IS_CYW(self)) { + return NULL; + } + #endif const uint8_t pin = self->pin->number; *mask = 1u << pin; diff --git a/ports/raspberrypi/common-hal/i2ctarget/I2CTarget.c b/ports/raspberrypi/common-hal/i2ctarget/I2CTarget.c new file mode 100644 index 0000000000..fc9bf55327 --- /dev/null +++ b/ports/raspberrypi/common-hal/i2ctarget/I2CTarget.c @@ -0,0 +1,152 @@ +/* + * This file is part of the MicroPython project, http://micropython.org/ + * + * The MIT License (MIT) + * + * Copyright (c) 2022 Mark Komus, Ken Stillson, im-redactd + * + * 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/i2ctarget/I2CTarget.h" + +#include "common-hal/busio/I2C.h" + +#include "py/mperrno.h" +#include "py/mphal.h" +#include "shared-bindings/busio/I2C.h" +#include "shared-bindings/microcontroller/Pin.h" +#include "py/runtime.h" + +#include "src/rp2_common/hardware_gpio/include/hardware/gpio.h" + +STATIC i2c_inst_t *i2c[2] = {i2c0, i2c1}; + +#define NO_PIN 0xff + +void common_hal_i2ctarget_i2c_target_construct(i2ctarget_i2c_target_obj_t *self, const mcu_pin_obj_t *scl, const mcu_pin_obj_t *sda, + uint8_t *addresses, unsigned int num_addresses, bool smbus) { + self->peripheral = NULL; + + // I2C pins have a regular pattern. SCL is always odd and SDA is even. They match up in pairs + // so we can divide by two to get the instance. This pattern repeats. + size_t scl_instance = (scl->number / 2) % 2; + size_t sda_instance = (sda->number / 2) % 2; + if (scl->number % 2 == 1 && sda->number % 2 == 0 && scl_instance == sda_instance) { + self->peripheral = i2c[sda_instance]; + } + + if (self->peripheral == NULL) { + raise_ValueError_invalid_pins(); + } + + if ((i2c_get_hw(self->peripheral)->enable & I2C_IC_ENABLE_ENABLE_BITS) != 0) { + mp_raise_ValueError(translate("I2C peripheral in use")); + } + + if (num_addresses > 1) { + mp_raise_ValueError(translate("Only one address is allowed")); + } + + self->addresses = addresses; + self->num_addresses = num_addresses; + self->scl_pin = scl->number; + self->sda_pin = sda->number; + + // Have to specify a baudrate even if the i2c target does not use it + const uint32_t frequency = 400000; + i2c_init(self->peripheral, frequency); + + gpio_set_function(sda->number, GPIO_FUNC_I2C); + gpio_set_function(scl->number, GPIO_FUNC_I2C); + + gpio_set_pulls(sda->number, true, false); + gpio_set_pulls(scl->number, true, false); + + self->peripheral->hw->intr_mask |= I2C_IC_INTR_MASK_M_RESTART_DET_BITS; + i2c_set_slave_mode(self->peripheral, true, self->addresses[0]); + + return; +} + +bool common_hal_i2ctarget_i2c_target_deinited(i2ctarget_i2c_target_obj_t *self) { + return self->sda_pin == NO_PIN; +} + +void common_hal_i2ctarget_i2c_target_deinit(i2ctarget_i2c_target_obj_t *self) { + if (common_hal_i2ctarget_i2c_target_deinited(self)) { + return; + } + + i2c_deinit(self->peripheral); + + reset_pin_number(self->sda_pin); + reset_pin_number(self->scl_pin); + self->sda_pin = NO_PIN; + self->scl_pin = NO_PIN; + + return; +} + +int common_hal_i2ctarget_i2c_target_is_addressed(i2ctarget_i2c_target_obj_t *self, uint8_t *address, bool *is_read, bool *is_restart) { + if (!((self->peripheral->hw->raw_intr_stat & I2C_IC_INTR_STAT_R_RX_FULL_BITS) || (self->peripheral->hw->raw_intr_stat & I2C_IC_INTR_STAT_R_RD_REQ_BITS))) { + return 0; + } + + *address = self->peripheral->hw->sar; + *is_read = !(self->peripheral->hw->raw_intr_stat & I2C_IC_INTR_STAT_R_RX_FULL_BITS); + *is_restart = ((self->peripheral->hw->raw_intr_stat & I2C_IC_RAW_INTR_STAT_RD_REQ_RESET) != 0); + + common_hal_i2ctarget_i2c_target_ack(self, true); + return 1; +} + +int common_hal_i2ctarget_i2c_target_read_byte(i2ctarget_i2c_target_obj_t *self, uint8_t *data) { + if (self->peripheral->hw->status & I2C_IC_STATUS_RFNE_BITS) { + *data = (uint8_t)self->peripheral->hw->data_cmd; + return 1; + } else { + return 0; + } +} + +int common_hal_i2ctarget_i2c_target_write_byte(i2ctarget_i2c_target_obj_t *self, uint8_t data) { + if (self->peripheral->hw->raw_intr_stat & I2C_IC_INTR_STAT_R_TX_ABRT_BITS) { + self->peripheral->hw->clr_tx_abrt; + } + + const size_t IC_TX_BUFFER_DEPTH = 16; + size_t space = IC_TX_BUFFER_DEPTH - self->peripheral->hw->txflr; + + if (space > 0) { + self->peripheral->hw->data_cmd = data; + self->peripheral->hw->clr_rd_req; + return 1; + } else { + return 0; + } +} + +void common_hal_i2ctarget_i2c_target_ack(i2ctarget_i2c_target_obj_t *self, bool ack) { + return; +} + +void common_hal_i2ctarget_i2c_target_close(i2ctarget_i2c_target_obj_t *self) { + return; +} diff --git a/shared-module/gamepadshift/GamePadShift.h b/ports/raspberrypi/common-hal/i2ctarget/I2CTarget.h similarity index 70% rename from shared-module/gamepadshift/GamePadShift.h rename to ports/raspberrypi/common-hal/i2ctarget/I2CTarget.h index 53aef50986..b47c51fbbb 100644 --- a/shared-module/gamepadshift/GamePadShift.h +++ b/ports/raspberrypi/common-hal/i2ctarget/I2CTarget.h @@ -3,7 +3,7 @@ * * The MIT License (MIT) * - * Copyright (c) 2016 Radomir Dopieralski for Adafruit Industries + * Copyright (c) 2022 Mark Komus, Ken Stillson, im-redactd * * Permission is hereby granted, free of charge, to any person obtaining a copy * of this software and associated documentation files (the "Software"), to deal @@ -24,20 +24,23 @@ * THE SOFTWARE. */ -#ifndef MICROPY_INCLUDED_GAMEPADSHIFT_GAMEPADSHIFT_H -#define MICROPY_INCLUDED_GAMEPADSHIFT_GAMEPADSHIFT_H +#ifndef MICROPY_INCLUDED_RPI_COMMON_HAL_I2C_TARGET_H +#define MICROPY_INCLUDED_RPI_COMMON_HAL_I2C_TARGET_H -#include - -#include "shared-bindings/digitalio/DigitalInOut.h" +#include "py/obj.h" +#include "common-hal/microcontroller/Pin.h" +#include "src/rp2_common/hardware_i2c/include/hardware/i2c.h" typedef struct { mp_obj_base_t base; - digitalio_digitalinout_obj_t *data_pin; - digitalio_digitalinout_obj_t *clock_pin; - digitalio_digitalinout_obj_t *latch_pin; - volatile uint8_t pressed; - volatile uint8_t last; -} gamepadshift_obj_t; -#endif // MICROPY_INCLUDED_GAMEPADSHIFT_GAMEPADSHIFT_H + uint8_t *addresses; + unsigned int num_addresses; + + i2c_inst_t *peripheral; + + uint8_t scl_pin; + uint8_t sda_pin; +} i2ctarget_i2c_target_obj_t; + +#endif MICROPY_INCLUDED_RPI_COMMON_HAL_BUSIO_I2C_TARGET_H diff --git a/ports/raspberrypi/common-hal/i2ctarget/__init__.c b/ports/raspberrypi/common-hal/i2ctarget/__init__.c new file mode 100644 index 0000000000..4ec26465ad --- /dev/null +++ b/ports/raspberrypi/common-hal/i2ctarget/__init__.c @@ -0,0 +1 @@ +// No i2ctarget module functions. diff --git a/ports/raspberrypi/common-hal/imagecapture/ParallelImageCapture.c b/ports/raspberrypi/common-hal/imagecapture/ParallelImageCapture.c index 3c5c57eea5..7ad6acbaff 100644 --- a/ports/raspberrypi/common-hal/imagecapture/ParallelImageCapture.c +++ b/ports/raspberrypi/common-hal/imagecapture/ParallelImageCapture.c @@ -120,11 +120,6 @@ void common_hal_imagecapture_parallelimagecapture_construct(imagecapture_paralle true, 32, true, // in settings false, // Not user-interruptible. 2, 5); // wrap settings - - - PIO pio = self->state_machine.pio; - uint8_t pio_index = pio_get_index(pio); - uint sm = self->state_machine.state_machine; } void common_hal_imagecapture_parallelimagecapture_deinit(imagecapture_parallelimagecapture_obj_t *self) { diff --git a/ports/raspberrypi/common-hal/microcontroller/Pin.c b/ports/raspberrypi/common-hal/microcontroller/Pin.c index d40c1f43b5..d1cfcfe2b1 100644 --- a/ports/raspberrypi/common-hal/microcontroller/Pin.c +++ b/ports/raspberrypi/common-hal/microcontroller/Pin.c @@ -31,6 +31,18 @@ #include "src/rp2_common/hardware_gpio/include/hardware/gpio.h" +#if CIRCUITPY_CYW43 +#include "bindings/cyw43/__init__.h" +#include "pico/cyw43_arch.h" + +bool cyw_ever_init; +static uint32_t cyw_pin_claimed; + +void reset_pin_number_cyw(uint8_t pin_no) { + cyw_pin_claimed &= ~(1 << pin_no); +} +#endif + STATIC uint32_t never_reset_pins; void reset_all_pins(void) { @@ -40,6 +52,14 @@ void reset_all_pins(void) { } reset_pin_number(i); } + #if CIRCUITPY_CYW43 + if (cyw_ever_init) { + for (size_t i = 0; i < 1; i++) { + cyw43_arch_gpio_put(i, 0); + } + } + cyw_pin_claimed = 0; + #endif } void never_reset_pin_number(uint8_t pin_number) { @@ -71,10 +91,21 @@ void common_hal_never_reset_pin(const mcu_pin_obj_t *pin) { } void common_hal_reset_pin(const mcu_pin_obj_t *pin) { + #if CIRCUITPY_CYW43 + if (pin->base.type == &cyw43_pin_type) { + reset_pin_number_cyw(pin->number); + return; + } + #endif reset_pin_number(pin->number); } void claim_pin(const mcu_pin_obj_t *pin) { + #if CIRCUITPY_CYW43 + if (pin->base.type == &cyw43_pin_type) { + cyw_pin_claimed |= (1 << pin->number); + } + #endif // Nothing to do because all changes will set the GPIO settings. } @@ -89,6 +120,11 @@ bool pin_number_is_free(uint8_t pin_number) { } bool common_hal_mcu_pin_is_free(const mcu_pin_obj_t *pin) { + #if CIRCUITPY_CYW43 + if (pin->base.type == &cyw43_pin_type) { + return !(cyw_pin_claimed & (1 << pin->number)); + } + #endif return pin_number_is_free(pin->number); } diff --git a/ports/raspberrypi/common-hal/microcontroller/Pin.h b/ports/raspberrypi/common-hal/microcontroller/Pin.h index 3e2287dc5d..1c400fe48e 100644 --- a/ports/raspberrypi/common-hal/microcontroller/Pin.h +++ b/ports/raspberrypi/common-hal/microcontroller/Pin.h @@ -42,4 +42,9 @@ void never_reset_pin_number(uint8_t pin_number); void claim_pin(const mcu_pin_obj_t *pin); bool pin_number_is_free(uint8_t pin_number); +#if CIRCUITPY_CYW43 +extern bool cyw_ever_init; +void reset_pin_number_cyw(uint8_t pin_number); +#endif + #endif // MICROPY_INCLUDED_RASPBERRYPI_COMMON_HAL_MICROCONTROLLER_PIN_H diff --git a/ports/raspberrypi/common-hal/microcontroller/__init__.c b/ports/raspberrypi/common-hal/microcontroller/__init__.c index ed68835e71..1ccd14df1d 100644 --- a/ports/raspberrypi/common-hal/microcontroller/__init__.c +++ b/ports/raspberrypi/common-hal/microcontroller/__init__.c @@ -38,7 +38,7 @@ #include "supervisor/filesystem.h" #include "supervisor/port.h" #include "supervisor/shared/safe_mode.h" -#include "supervisor/shared/translate.h" +#include "supervisor/shared/translate/translate.h" #include "src/rp2040/hardware_structs/include/hardware/structs/sio.h" #include "src/rp2_common/hardware_sync/include/hardware/sync.h" @@ -173,12 +173,23 @@ const mp_rom_map_elem_t mcu_pin_global_dict_table[TOTAL_GPIO_COUNT] = { { MP_ROM_QSTR(MP_QSTR_GPIO20), MP_ROM_PTR(&pin_GPIO20) }, { MP_ROM_QSTR(MP_QSTR_GPIO21), MP_ROM_PTR(&pin_GPIO21) }, { MP_ROM_QSTR(MP_QSTR_GPIO22), MP_ROM_PTR(&pin_GPIO22) }, + #if !defined(IGNORE_GPIO23) { MP_ROM_QSTR(MP_QSTR_GPIO23), MP_ROM_PTR(&pin_GPIO23) }, + #endif + #if !defined(IGNORE_GPIO24) { MP_ROM_QSTR(MP_QSTR_GPIO24), MP_ROM_PTR(&pin_GPIO24) }, + #endif + #if !defined(IGNORE_GPIO25) { MP_ROM_QSTR(MP_QSTR_GPIO25), MP_ROM_PTR(&pin_GPIO25) }, + #endif { MP_ROM_QSTR(MP_QSTR_GPIO26), MP_ROM_PTR(&pin_GPIO26) }, { MP_ROM_QSTR(MP_QSTR_GPIO27), MP_ROM_PTR(&pin_GPIO27) }, { MP_ROM_QSTR(MP_QSTR_GPIO28), MP_ROM_PTR(&pin_GPIO28) }, { MP_ROM_QSTR(MP_QSTR_GPIO29), MP_ROM_PTR(&pin_GPIO29) }, + #if CIRCUITPY_CYW43 + { MP_ROM_QSTR(MP_QSTR_CYW0), MP_ROM_PTR(&pin_CYW0) }, + { MP_ROM_QSTR(MP_QSTR_CYW1), MP_ROM_PTR(&pin_CYW1) }, + { MP_ROM_QSTR(MP_QSTR_CYW2), MP_ROM_PTR(&pin_CYW2) }, + #endif }; MP_DEFINE_CONST_DICT(mcu_pin_globals, mcu_pin_global_dict_table); diff --git a/ports/raspberrypi/common-hal/pulseio/PulseIn.c b/ports/raspberrypi/common-hal/pulseio/PulseIn.c index 45d31626ec..346c0951ed 100644 --- a/ports/raspberrypi/common-hal/pulseio/PulseIn.c +++ b/ports/raspberrypi/common-hal/pulseio/PulseIn.c @@ -32,15 +32,15 @@ #include "shared-bindings/microcontroller/__init__.h" #include "shared-bindings/pulseio/PulseIn.h" #include "shared-bindings/microcontroller/Pin.h" -#include "supervisor/shared/translate.h" +#include "supervisor/shared/translate/translate.h" #include "bindings/rp2pio/StateMachine.h" #include "common-hal/pulseio/PulseIn.h" #define NO_PIN 0xff #define MAX_PULSE 65535 -#define MIN_PULSE 10 +#define MIN_PULSE 0 -uint16_t pulsein_program[] = { +static const uint16_t pulsein_program[] = { 0x4001, // 1: in pins, 1 }; @@ -49,7 +49,7 @@ void common_hal_pulseio_pulsein_construct(pulseio_pulsein_obj_t *self, self->buffer = (uint16_t *)m_malloc(maxlen * sizeof(uint16_t), false); if (self->buffer == NULL) { - mp_raise_msg_varg(&mp_type_MemoryError, translate("Failed to allocate RX buffer of %d bytes"), maxlen * sizeof(uint16_t)); + m_malloc_fail(maxlen * sizeof(uint16_t)); } self->pin = pin->number; self->maxlen = maxlen; @@ -57,48 +57,29 @@ void common_hal_pulseio_pulsein_construct(pulseio_pulsein_obj_t *self, self->start = 0; self->len = 0; - bool ok = rp2pio_statemachine_construct(&self->state_machine, - pulsein_program, sizeof(pulsein_program) / sizeof(pulsein_program[0]), - 1000000, - NULL, 0, - NULL, 0, - pin, 1, - 0,0, - NULL, 0, - NULL, 0, - 1, 0, - NULL, // jump pin - 1 << self->pin, false, true, - false, 8, false, // TX, unused - false, - true, 32, true, // RX auto-push every 32 bits - false, // claim pins - false, // Not user-interruptible. - false, // No sideset enable - 0, -1); // wrap settings + common_hal_rp2pio_statemachine_construct(&self->state_machine, + pulsein_program, MP_ARRAY_SIZE(pulsein_program), + 1000000, // frequency + NULL, 0, // init, init_len + NULL, 0, 0, 0, // first out pin, # out pins, initial_out_pin_state + pin, 1, 0, 0, // first in pin, # in pins + NULL, 0, 0, 0, // first set pin + NULL, 0, 0, 0, // first sideset pin + false, // No sideset enable + NULL, PULL_NONE, // jump pin, jmp_pull + 0, // wait gpio pins + true, // exclusive pin usage + false, 8, false, // TX, setting we don't use + false, // wait for TX stall + true, 32, true, // RX auto pull every 32 bits. shift left to output msb first + false, // Not user-interruptible. + 0, -1); // wrap settings - if (!ok) { - mp_raise_RuntimeError(translate("All state machines in use")); - } + common_hal_pulseio_pulsein_pause(self); - pio_sm_set_enabled(self->state_machine.pio,self->state_machine.state_machine, false); - pio_sm_clear_fifos(self->state_machine.pio,self->state_machine.state_machine); - self->last_level = self->idle_state; - self->level_count = 0; - self->buf_index = 0; - - pio_sm_set_in_pins(self->state_machine.pio,self->state_machine.state_machine,pin->number); common_hal_rp2pio_statemachine_set_interrupt_handler(&(self->state_machine),&common_hal_pulseio_pulsein_interrupt,self,PIO_IRQ0_INTE_SM0_RXNEMPTY_BITS); - // exec a set pindirs to 0 for input - pio_sm_exec(self->state_machine.pio,self->state_machine.state_machine,0xe080); - // exec the appropriate wait for pin - if (self->idle_state == true) { - pio_sm_exec(self->state_machine.pio,self->state_machine.state_machine,0x2020); - } else { - pio_sm_exec(self->state_machine.pio,self->state_machine.state_machine,0x20a0); - } - pio_sm_set_enabled(self->state_machine.pio, self->state_machine.state_machine, true); + common_hal_pulseio_pulsein_resume(self, 0); } bool common_hal_pulseio_pulsein_deinited(pulseio_pulsein_obj_t *self) { @@ -119,9 +100,10 @@ void common_hal_pulseio_pulsein_deinit(pulseio_pulsein_obj_t *self) { void common_hal_pulseio_pulsein_pause(pulseio_pulsein_obj_t *self) { pio_sm_restart(self->state_machine.pio, self->state_machine.state_machine); pio_sm_set_enabled(self->state_machine.pio, self->state_machine.state_machine, false); + pio_sm_clear_fifos(self->state_machine.pio,self->state_machine.state_machine); self->last_level = self->idle_state; self->level_count = 0; - self->buf_index = 0; + self->paused = true; } void common_hal_pulseio_pulsein_interrupt(void *self_in) { pulseio_pulsein_obj_t *self = self_in; @@ -140,7 +122,7 @@ void common_hal_pulseio_pulsein_interrupt(void *self_in) { } else { uint32_t result = self->level_count; self->last_level = level; - self->level_count = 0; + self->level_count = 1; // Pulses that are longer than MAX_PULSE will return MAX_PULSE if (result > MAX_PULSE) { result = MAX_PULSE; @@ -154,28 +136,15 @@ void common_hal_pulseio_pulsein_interrupt(void *self_in) { } else { self->start = (self->start + 1) % self->maxlen; } - if (self->buf_index < self->maxlen) { - self->buf_index++; - } else { - self->start = 0; - self->buf_index = 0; - } } } } } - -// check for a pulse thats too long (MAX_PULSE us) or maxlen reached, and reset - if ((self->level_count > MAX_PULSE) || (self->buf_index >= self->maxlen)) { - pio_sm_set_enabled(self->state_machine.pio, self->state_machine.state_machine, false); - pio_sm_init(self->state_machine.pio, self->state_machine.state_machine, self->state_machine.offset, &self->state_machine.sm_config); - pio_sm_restart(self->state_machine.pio,self->state_machine.state_machine); - pio_sm_set_enabled(self->state_machine.pio, self->state_machine.state_machine, true); - self->buf_index = 0; - } } void common_hal_pulseio_pulsein_resume(pulseio_pulsein_obj_t *self, uint16_t trigger_duration) { + + common_hal_pulseio_pulsein_pause(self); // Send the trigger pulse. if (trigger_duration > 0) { gpio_set_function(self->pin,GPIO_FUNC_SIO); @@ -183,11 +152,8 @@ void common_hal_pulseio_pulsein_resume(pulseio_pulsein_obj_t *self, gpio_put(self->pin, !self->idle_state); common_hal_mcu_delay_us((uint32_t)trigger_duration); gpio_set_function(self->pin,GPIO_FUNC_PIO0); - common_hal_mcu_delay_us(125); } - // Reconfigure the pin for PIO - gpio_set_function(self->pin, GPIO_FUNC_PIO0); // exec a wait for the selected pin to change state if (self->idle_state == true) { pio_sm_exec(self->state_machine.pio,self->state_machine.state_machine,0x2020); @@ -195,12 +161,11 @@ void common_hal_pulseio_pulsein_resume(pulseio_pulsein_obj_t *self, pio_sm_exec(self->state_machine.pio,self->state_machine.state_machine,0x20a0); } pio_sm_set_enabled(self->state_machine.pio, self->state_machine.state_machine, true); + self->paused = false; } void common_hal_pulseio_pulsein_clear(pulseio_pulsein_obj_t *self) { - self->start = 0; self->len = 0; - self->buf_index = 0; } uint16_t common_hal_pulseio_pulsein_popleft(pulseio_pulsein_obj_t *self) { @@ -210,12 +175,6 @@ uint16_t common_hal_pulseio_pulsein_popleft(pulseio_pulsein_obj_t *self) { uint16_t value = self->buffer[self->start]; self->start = (self->start + 1) % self->maxlen; self->len--; - // if we are empty reset buffer pointer and counters - if (self->len == 0) { - self->start = 0; - self->buf_index = 0; - self->level_count = 0; - } return value; } @@ -228,7 +187,7 @@ uint16_t common_hal_pulseio_pulsein_get_len(pulseio_pulsein_obj_t *self) { } bool common_hal_pulseio_pulsein_get_paused(pulseio_pulsein_obj_t *self) { - return true; + return self->paused; } uint16_t common_hal_pulseio_pulsein_get_item(pulseio_pulsein_obj_t *self, @@ -237,7 +196,7 @@ uint16_t common_hal_pulseio_pulsein_get_item(pulseio_pulsein_obj_t *self, index += self->len; } if (index < 0 || index >= self->len) { - mp_raise_IndexError_varg(translate("%q index out of range"), MP_QSTR_PulseIn); + mp_arg_validate_index_range(index, 0, self->len, MP_QSTR_index); } uint16_t value = self->buffer[(self->start + index) % self->maxlen]; return value; diff --git a/ports/raspberrypi/common-hal/pulseio/PulseIn.h b/ports/raspberrypi/common-hal/pulseio/PulseIn.h index f2c4fc0d06..8694f75e62 100644 --- a/ports/raspberrypi/common-hal/pulseio/PulseIn.h +++ b/ports/raspberrypi/common-hal/pulseio/PulseIn.h @@ -37,13 +37,13 @@ typedef struct { mp_obj_base_t base; uint8_t pin; bool idle_state; + bool paused; uint16_t maxlen; uint16_t *buffer; volatile bool last_level; volatile uint32_t level_count; volatile uint16_t len; volatile uint16_t start; - volatile uint16_t buf_index; rp2pio_statemachine_obj_t state_machine; } pulseio_pulsein_obj_t; diff --git a/ports/raspberrypi/common-hal/pulseio/PulseOut.c b/ports/raspberrypi/common-hal/pulseio/PulseOut.c index 7704fdff6f..881e003579 100644 --- a/ports/raspberrypi/common-hal/pulseio/PulseOut.c +++ b/ports/raspberrypi/common-hal/pulseio/PulseOut.c @@ -33,7 +33,7 @@ #include "shared-bindings/pwmio/PWMOut.h" #include "shared-bindings/microcontroller/__init__.h" #include "common-hal/pwmio/PWMOut.h" -#include "supervisor/shared/translate.h" +#include "supervisor/shared/translate/translate.h" #include "src/rp2040/hardware_structs/include/hardware/structs/pwm.h" #include "src/rp2_common/hardware_gpio/include/hardware/gpio.h" #include "src/rp2_common/hardware_pwm/include/hardware/pwm.h" diff --git a/ports/raspberrypi/common-hal/pwmio/PWMOut.c b/ports/raspberrypi/common-hal/pwmio/PWMOut.c index 3ef4fb57f3..e6f88f8894 100644 --- a/ports/raspberrypi/common-hal/pwmio/PWMOut.c +++ b/ports/raspberrypi/common-hal/pwmio/PWMOut.c @@ -32,7 +32,7 @@ #include "shared-bindings/pwmio/PWMOut.h" #include "shared-bindings/microcontroller/Processor.h" -#include "supervisor/shared/translate.h" +#include "supervisor/shared/translate/translate.h" #include "src/rp2040/hardware_regs/include/hardware/platform_defs.h" #include "src/rp2_common/hardware_clocks/include/hardware/clocks.h" @@ -259,7 +259,7 @@ void pwmio_pwmout_set_top(pwmio_pwmout_obj_t *self, uint16_t top) { void common_hal_pwmio_pwmout_set_frequency(pwmio_pwmout_obj_t *self, uint32_t frequency) { if (frequency == 0 || frequency > (common_hal_mcu_processor_get_frequency() / 2)) { - mp_raise_ValueError(translate("Invalid PWM frequency")); + mp_arg_error_invalid(MP_QSTR_frequency); } target_slice_frequencies[self->slice] = frequency; diff --git a/ports/raspberrypi/common-hal/rp2pio/StateMachine.c b/ports/raspberrypi/common-hal/rp2pio/StateMachine.c index bee77238b5..d58e9779e6 100644 --- a/ports/raspberrypi/common-hal/rp2pio/StateMachine.c +++ b/ports/raspberrypi/common-hal/rp2pio/StateMachine.c @@ -71,7 +71,7 @@ STATIC void *_interrupt_arg[NUM_PIOS][NUM_PIO_STATE_MACHINES]; STATIC void rp2pio_statemachine_interrupt_handler(void); static void rp2pio_statemachine_set_pull(uint32_t pull_pin_up, uint32_t pull_pin_down, uint32_t pins_we_use) { - for (int i = 0; i < TOTAL_GPIO_COUNT; i++) { + for (size_t i = 0; i < TOTAL_GPIO_COUNT; i++) { bool used = pins_we_use & (1 << i); if (used) { bool pull_up = pull_pin_up & (1 << i); @@ -231,7 +231,7 @@ bool rp2pio_statemachine_construct(rp2pio_statemachine_obj_t *self, program_offset = 32; } - int state_machine = -1; + size_t state_machine = NUM_PIO_STATE_MACHINES; if (pio_index < NUM_PIOS) { PIO pio = pio_instances[pio_index]; for (size_t i = 0; i < NUM_PIOS; i++) { @@ -369,6 +369,9 @@ bool rp2pio_statemachine_construct(rp2pio_statemachine_obj_t *self, } static uint32_t mask_and_rotate(const mcu_pin_obj_t *first_pin, uint32_t bit_count, uint32_t value) { + if (!first_pin) { + return 0; + } value = value & ((1 << bit_count) - 1); uint32_t shift = first_pin->number; return value << shift | value >> (32 - shift); @@ -436,7 +439,7 @@ void common_hal_rp2pio_statemachine_construct(rp2pio_statemachine_obj_t *self, if (first_in_pin == NULL) { mp_raise_ValueError_varg(translate("Missing first_in_pin. Instruction %d waits based on pin"), i); } - if (wait_index > in_pin_count) { + if (wait_index >= in_pin_count) { mp_raise_ValueError_varg(translate("Instruction %d waits on input outside of count"), i); } } @@ -868,7 +871,7 @@ bool common_hal_rp2pio_statemachine_get_txstall(rp2pio_statemachine_obj_t *self) } void common_hal_rp2pio_statemachine_clear_txstall(rp2pio_statemachine_obj_t *self) { - uint8_t level = pio_sm_get_rx_fifo_level(self->pio, self->state_machine); + (void)pio_sm_get_rx_fifo_level(self->pio, self->state_machine); uint32_t stall_mask = 1 << (PIO_FDEBUG_TXSTALL_LSB + self->state_machine); self->pio->fdebug = stall_mask; } diff --git a/ports/raspberrypi/common-hal/rp2pio/__init__.c b/ports/raspberrypi/common-hal/rp2pio/__init__.c index 8b8101fbe5..61a77e021c 100644 --- a/ports/raspberrypi/common-hal/rp2pio/__init__.c +++ b/ports/raspberrypi/common-hal/rp2pio/__init__.c @@ -33,7 +33,7 @@ bool common_hal_rp2pio_pins_are_sequential(size_t len, mp_obj_t *items) { return true; } const mcu_pin_obj_t *last_pin = validate_obj_is_pin(items[0]); - for (int i = 1; i < len; i++) { + for (size_t i = 1; i < len; i++) { const mcu_pin_obj_t *pin = validate_obj_is_pin(items[i]); if (pin->number != last_pin->number + 1) { return false; diff --git a/ports/raspberrypi/common-hal/rtc/RTC.c b/ports/raspberrypi/common-hal/rtc/RTC.c index 9bd10abf70..9bfda0af31 100644 --- a/ports/raspberrypi/common-hal/rtc/RTC.c +++ b/ports/raspberrypi/common-hal/rtc/RTC.c @@ -92,5 +92,5 @@ int common_hal_rtc_get_calibration(void) { } void common_hal_rtc_set_calibration(int calibration) { - mp_raise_NotImplementedError(translate("RTC calibration is not supported on this board")); + mp_raise_NotImplementedError_varg(translate("%q"), MP_QSTR_calibration); } diff --git a/ports/raspberrypi/common-hal/socketpool/Socket.c b/ports/raspberrypi/common-hal/socketpool/Socket.c new file mode 100644 index 0000000000..99b19ad694 --- /dev/null +++ b/ports/raspberrypi/common-hal/socketpool/Socket.c @@ -0,0 +1,1145 @@ +/* + * This file is part of the MicroPython project, http://micropython.org/ + * + * The MIT License (MIT) + * + * Copyright (c) 2013-2019 Damien P. George + * Copyright (c) 2015 Galen Hazelwood + * Copyright (c) 2015-2017 Paul Sokolovsky + * Copyright (c) 2020 Lucian Copeland for Adafruit Industries + * Copyright (c) 2022 Jeff Epler for Adafruit Industries + * + * Permission is hereby granted, free of charge, to any person obtaining a copy + * of this software and associated documentation files (the "Software"), to deal + * in the Software without restriction, including without limitation the rights + * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell + * copies of the Software, and to permit persons to whom the Software is + * furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice shall be included in + * all copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE + * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER + * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, + * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN + * THE SOFTWARE. + */ + +#include "shared-bindings/socketpool/Socket.h" + +#include "py/gc.h" +#include "py/mperrno.h" +#include "py/mphal.h" +#include "py/runtime.h" +#include "py/stream.h" +#include "shared-bindings/socketpool/SocketPool.h" +#include "shared/runtime/interrupt_char.h" +#include "shared/netutils/netutils.h" +#include "supervisor/port.h" +#include "supervisor/shared/tick.h" +#include "supervisor/workflow.h" + +#include "lwip/dns.h" +#include "lwip/err.h" +#include "lwip/igmp.h" +#include "lwip/init.h" +#include "lwip/netdb.h" +#include "lwip/priv/tcp_priv.h" +#include "lwip/raw.h" +#include "lwip/sys.h" +#include "lwip/tcp.h" +#include "lwip/timeouts.h" +#include "lwip/udp.h" + +#define MICROPY_PY_LWIP_SOCK_RAW (1) + +#if 0 // print debugging info +#define DEBUG_printf DEBUG_printf +#else // don't print debugging info +#define DEBUG_printf(...) (void)0 +#endif + +// Timeout between closing a TCP socket and doing a tcp_abort on that +// socket, if the connection isn't closed cleanly in that time. +#define MICROPY_PY_LWIP_TCP_CLOSE_TIMEOUT_MS (10000) + +// All socket options should be globally distinct, +// because we ignore option levels for efficiency. +#define IP_ADD_MEMBERSHIP 0x400 +#define IP_DROP_MEMBERSHIP 0x401 + +/******************************************************************************/ +// Table to convert lwIP err_t codes to socket errno codes, from the lwIP +// socket API. + +// Extension to lwIP error codes +// Matches lwIP 2.0.3 +#undef _ERR_BADF +#define _ERR_BADF -17 +static const int error_lookup_table[] = { + 0, /* ERR_OK 0 No error, everything OK */ + MP_ENOMEM, /* ERR_MEM -1 Out of memory error */ + MP_ENOBUFS, /* ERR_BUF -2 Buffer error */ + MP_EWOULDBLOCK, /* ERR_TIMEOUT -3 Timeout */ + MP_EHOSTUNREACH, /* ERR_RTE -4 Routing problem */ + MP_EINPROGRESS, /* ERR_INPROGRESS -5 Operation in progress */ + MP_EINVAL, /* ERR_VAL -6 Illegal value */ + MP_EWOULDBLOCK, /* ERR_WOULDBLOCK -7 Operation would block */ + MP_EADDRINUSE, /* ERR_USE -8 Address in use */ + MP_EALREADY, /* ERR_ALREADY -9 Already connecting */ + MP_EALREADY, /* ERR_ISCONN -10 Conn already established */ + MP_ENOTCONN, /* ERR_CONN -11 Not connected */ + -1, /* ERR_IF -12 Low-level netif error */ + MP_ECONNABORTED, /* ERR_ABRT -13 Connection aborted */ + MP_ECONNRESET, /* ERR_RST -14 Connection reset */ + MP_ENOTCONN, /* ERR_CLSD -15 Connection closed */ + MP_EIO, /* ERR_ARG -16 Illegal argument. */ + MP_EBADF, /* _ERR_BADF -17 Closed socket (null pcb) */ +}; + +/*******************************************************************************/ +// The socket object provided by lwip.socket. + +#define MOD_NETWORK_AF_INET (SOCKETPOOL_AF_INET) +#define MOD_NETWORK_AF_INET6 (SOCKETPOOL_AF_INET6) + +#define MOD_NETWORK_SOCK_STREAM (SOCKETPOOL_SOCK_STREAM) +#define MOD_NETWORK_SOCK_DGRAM (SOCKETPOOL_SOCK_DGRAM) +#define MOD_NETWORK_SOCK_RAW (SOCKETPOOL_SOCK_RAW) + +#define MAX_SOCKETS (8) + +static inline void poll_sockets(void) { + #ifdef MICROPY_EVENT_POLL_HOOK + MICROPY_EVENT_POLL_HOOK; + #else + RUN_BACKGROUND_TASKS; + if (MP_STATE_THREAD(mp_pending_exception) != MP_OBJ_NULL) { + mp_handle_pending(true); + } + mp_hal_delay_ms(1); + #endif +} + +STATIC struct tcp_pcb *volatile *lwip_socket_incoming_array(socketpool_socket_obj_t *socket) { + if (socket->incoming.connection.alloc == 0) { + return &socket->incoming.connection.tcp.item; + } else { + return &socket->incoming.connection.tcp.array[0]; + } +} + +STATIC void lwip_socket_free_incoming(socketpool_socket_obj_t *socket) { + bool socket_is_listener = + socket->type == MOD_NETWORK_SOCK_STREAM + && socket->pcb.tcp->state == LISTEN; + + if (!socket_is_listener) { + if (socket->incoming.pbuf != NULL) { + pbuf_free(socket->incoming.pbuf); + socket->incoming.pbuf = NULL; + } + } else { + uint8_t alloc = socket->incoming.connection.alloc; + struct tcp_pcb *volatile *tcp_array = lwip_socket_incoming_array(socket); + for (uint8_t i = 0; i < alloc; ++i) { + // Deregister callback and abort + if (tcp_array[i] != NULL) { + tcp_poll(tcp_array[i], NULL, 0); + tcp_abort(tcp_array[i]); + tcp_array[i] = NULL; + } + } + } +} + +/*******************************************************************************/ +// Callback functions for the lwIP raw API. + +static inline void exec_user_callback(socketpool_socket_obj_t *socket) { + #if 0 + if (socket->callback != MP_OBJ_NULL) { + // Schedule the user callback to execute outside the lwIP context + mp_sched_schedule(socket->callback, MP_OBJ_FROM_PTR(socket)); + } + #endif +} + +#if MICROPY_PY_LWIP_SOCK_RAW +// Callback for incoming raw packets. +#if LWIP_VERSION_MAJOR < 2 +STATIC u8_t _lwip_raw_incoming(void *arg, struct raw_pcb *pcb, struct pbuf *p, ip_addr_t *addr) +#else +STATIC u8_t _lwip_raw_incoming(void *arg, struct raw_pcb *pcb, struct pbuf *p, const ip_addr_t *addr) +#endif +{ + socketpool_socket_obj_t *socket = (socketpool_socket_obj_t *)arg; + + if (socket->incoming.pbuf != NULL) { + pbuf_free(p); + } else { + socket->incoming.pbuf = p; + memcpy(&socket->peer, addr, sizeof(socket->peer)); + } + return 1; // we ate the packet +} +#endif + +// Callback for incoming UDP packets. We simply stash the packet and the source address, +// in case we need it for recvfrom. +#if LWIP_VERSION_MAJOR < 2 +STATIC void _lwip_udp_incoming(void *arg, struct udp_pcb *upcb, struct pbuf *p, ip_addr_t *addr, u16_t port) +#else +STATIC void _lwip_udp_incoming(void *arg, struct udp_pcb *upcb, struct pbuf *p, const ip_addr_t *addr, u16_t port) +#endif +{ + socketpool_socket_obj_t *socket = (socketpool_socket_obj_t *)arg; + + if (socket->incoming.pbuf != NULL) { + // That's why they call it "unreliable". No room in the inn, drop the packet. + pbuf_free(p); + } else { + socket->incoming.pbuf = p; + socket->peer_port = (mp_uint_t)port; + memcpy(&socket->peer, addr, sizeof(socket->peer)); + } +} + +// Callback for general tcp errors. +STATIC void _lwip_tcp_error(void *arg, err_t err) { + socketpool_socket_obj_t *socket = (socketpool_socket_obj_t *)arg; + + // Free any incoming buffers or connections that are stored + lwip_socket_free_incoming(socket); + // Pass the error code back via the connection variable. + socket->state = err; + // If we got here, the lwIP stack either has deallocated or will deallocate the pcb. + socket->pcb.tcp = NULL; +} + +// Callback for tcp connection requests. Error code err is unused. (See tcp.h) +STATIC err_t _lwip_tcp_connected(void *arg, struct tcp_pcb *tpcb, err_t err) { + socketpool_socket_obj_t *socket = (socketpool_socket_obj_t *)arg; + + socket->state = STATE_CONNECTED; + return ERR_OK; +} + +// Handle errors (eg connection aborted) on TCP PCBs that have been put on the +// accept queue but are not yet actually accepted. +STATIC void _lwip_tcp_err_unaccepted(void *arg, err_t err) { + struct tcp_pcb *pcb = (struct tcp_pcb *)arg; + + // The ->connected entry is repurposed to store the parent socket; this is safe + // because it's only ever used by lwIP if tcp_connect is called on the TCP PCB. + socketpool_socket_obj_t *socket = (socketpool_socket_obj_t *)pcb->connected; + + // Array is not volatile because thiss callback is executed within the lwIP context + uint8_t alloc = socket->incoming.connection.alloc; + struct tcp_pcb **tcp_array = (struct tcp_pcb **)lwip_socket_incoming_array(socket); + + // Search for PCB on the accept queue of the parent socket + struct tcp_pcb **shift_down = NULL; + uint8_t i = socket->incoming.connection.iget; + do { + if (shift_down == NULL) { + if (tcp_array[i] == pcb) { + shift_down = &tcp_array[i]; + } + } else { + *shift_down = tcp_array[i]; + shift_down = &tcp_array[i]; + } + if (++i >= alloc) { + i = 0; + } + } while (i != socket->incoming.connection.iput); + + // PCB found in queue, remove it + if (shift_down != NULL) { + *shift_down = NULL; + socket->incoming.connection.iput = shift_down - tcp_array; + } +} + +// By default, a child socket of listen socket is created with recv +// handler which discards incoming pbuf's. We don't want to do that, +// so set this handler which requests lwIP to keep pbuf's and deliver +// them later. We cannot cache pbufs in child socket on Python side, +// until it is created in accept(). +STATIC err_t _lwip_tcp_recv_unaccepted(void *arg, struct tcp_pcb *pcb, struct pbuf *p, err_t err) { + return ERR_BUF; +} + +// Callback for incoming tcp connections. +STATIC err_t _lwip_tcp_accept(void *arg, struct tcp_pcb *newpcb, err_t err) { + // err can be ERR_MEM to notify us that there was no memory for an incoming connection + if (err != ERR_OK) { + return ERR_OK; + } + + socketpool_socket_obj_t *socket = (socketpool_socket_obj_t *)arg; + tcp_recv(newpcb, _lwip_tcp_recv_unaccepted); + + // Search for an empty slot to store the new connection + struct tcp_pcb *volatile *slot = &lwip_socket_incoming_array(socket)[socket->incoming.connection.iput]; + if (*slot == NULL) { + // Have an empty slot to store waiting connection + *slot = newpcb; + if (++socket->incoming.connection.iput >= socket->incoming.connection.alloc) { + socket->incoming.connection.iput = 0; + } + + // Schedule user accept callback + exec_user_callback(socket); + + // Set the error callback to handle the case of a dropped connection before we + // have a chance to take it off the accept queue. + // The ->connected entry is repurposed to store the parent socket; this is safe + // because it's only ever used by lwIP if tcp_connect is called on the TCP PCB. + newpcb->connected = (void *)socket; + tcp_arg(newpcb, newpcb); + tcp_err(newpcb, _lwip_tcp_err_unaccepted); + + return ERR_OK; + } + + DEBUG_printf("_lwip_tcp_accept: No room to queue pcb waiting for accept\n"); + return ERR_BUF; +} + +// Callback for inbound tcp packets. +STATIC err_t _lwip_tcp_recv(void *arg, struct tcp_pcb *tcpb, struct pbuf *p, err_t err) { + socketpool_socket_obj_t *socket = (socketpool_socket_obj_t *)arg; + + if (p == NULL) { + // Other side has closed connection. + DEBUG_printf("_lwip_tcp_recv[%p]: other side closed connection\n", socket); + socket->state = STATE_PEER_CLOSED; + exec_user_callback(socket); + return ERR_OK; + } + + if (socket->incoming.pbuf == NULL) { + socket->incoming.pbuf = p; + } else { + #ifdef SOCKET_SINGLE_PBUF + return ERR_BUF; + #else + pbuf_cat(socket->incoming.pbuf, p); + #endif + } + + exec_user_callback(socket); + + return ERR_OK; +} + +/*******************************************************************************/ +// Functions for socket send/receive operations. Socket send/recv and friends call +// these to do the work. + +// Helper function for send/sendto to handle raw/UDP packets. +STATIC mp_uint_t lwip_raw_udp_send(socketpool_socket_obj_t *socket, const byte *buf, mp_uint_t len, ip_addr_t *dest, uint32_t port, int *_errno) { + if (len > 0xffff) { + // Any packet that big is probably going to fail the pbuf_alloc anyway, but may as well try + len = 0xffff; + } + + MICROPY_PY_LWIP_ENTER + + struct pbuf *p = pbuf_alloc(PBUF_TRANSPORT, len, PBUF_RAM); + if (p == NULL) { + MICROPY_PY_LWIP_EXIT + *_errno = MP_ENOMEM; + return -1; + } + + memcpy(p->payload, buf, len); + + err_t err; + if (dest == NULL) { + #if MICROPY_PY_LWIP_SOCK_RAW + if (socket->type == MOD_NETWORK_SOCK_RAW) { + err = raw_send(socket->pcb.raw, p); + } else + #endif + { + err = udp_send(socket->pcb.udp, p); + } + } else { + #if MICROPY_PY_LWIP_SOCK_RAW + if (socket->type == MOD_NETWORK_SOCK_RAW) { + err = raw_sendto(socket->pcb.raw, p, dest); + } else + #endif + { + err = udp_sendto(socket->pcb.udp, p, dest, port); + } + } + + pbuf_free(p); + + MICROPY_PY_LWIP_EXIT + + // udp_sendto can return 1 on occasion for ESP8266 port. It's not known why + // but it seems that the send actually goes through without error in this case. + // So we treat such cases as a success until further investigation. + if (err != ERR_OK && err != 1) { + *_errno = error_lookup_table[-err]; + return -1; + } + + return len; +} + +// Helper function for recv/recvfrom to handle raw/UDP packets +STATIC mp_uint_t lwip_raw_udp_receive(socketpool_socket_obj_t *socket, byte *buf, mp_uint_t len, byte *ip, uint32_t *port, int *_errno) { + + if (socket->incoming.pbuf == NULL) { + if (socket->timeout == 0) { + // Non-blocking socket. + *_errno = MP_EAGAIN; + return -1; + } + + // Wait for data to arrive on UDP socket. + mp_uint_t start = mp_hal_ticks_ms(); + while (socket->incoming.pbuf == NULL) { + if (socket->timeout != (unsigned)-1 && mp_hal_ticks_ms() - start > socket->timeout) { + *_errno = MP_ETIMEDOUT; + return -1; + } + poll_sockets(); + } + } + + if (ip != NULL) { + memcpy(ip, &socket->peer, sizeof(socket->peer)); + *port = socket->peer_port; + } + + struct pbuf *p = socket->incoming.pbuf; + + MICROPY_PY_LWIP_ENTER + + u16_t result = pbuf_copy_partial(p, buf, ((p->tot_len > len) ? len : p->tot_len), 0); + pbuf_free(p); + socket->incoming.pbuf = NULL; + + MICROPY_PY_LWIP_EXIT + + return (mp_uint_t)result; +} + +// For use in stream virtual methods +#define STREAM_ERROR_CHECK(socket) \ + if (socket->state < 0) { \ + *_errno = error_lookup_table[-socket->state]; \ + return MP_STREAM_ERROR; \ + } \ + assert(socket->pcb.tcp); + +// Version of above for use when lock is held +#define STREAM_ERROR_CHECK_WITH_LOCK(socket) \ + if (socket->state < 0) { \ + *_errno = error_lookup_table[-socket->state]; \ + MICROPY_PY_LWIP_EXIT \ + return MP_STREAM_ERROR; \ + } \ + assert(socket->pcb.tcp); + + +// Helper function for send/sendto to handle TCP packets +STATIC mp_uint_t lwip_tcp_send(socketpool_socket_obj_t *socket, const byte *buf, mp_uint_t len, int *_errno) { + // Check for any pending errors + STREAM_ERROR_CHECK(socket); + + MICROPY_PY_LWIP_ENTER + + u16_t available = tcp_sndbuf(socket->pcb.tcp); + + if (available == 0) { + // Non-blocking socket + if (socket->timeout == 0) { + MICROPY_PY_LWIP_EXIT + *_errno = MP_EAGAIN; + return MP_STREAM_ERROR; + } + + mp_uint_t start = mp_hal_ticks_ms(); + // Assume that STATE_PEER_CLOSED may mean half-closed connection, where peer closed it + // sending direction, but not receiving. Consequently, check for both STATE_CONNECTED + // and STATE_PEER_CLOSED as normal conditions and still waiting for buffers to be sent. + // If peer fully closed socket, we would have socket->state set to ERR_RST (connection + // reset) by error callback. + // Avoid sending too small packets, so wait until at least 16 bytes available + while (socket->state >= STATE_CONNECTED && (available = tcp_sndbuf(socket->pcb.tcp)) < 16) { + MICROPY_PY_LWIP_EXIT + if (socket->timeout != (unsigned)-1 && mp_hal_ticks_ms() - start > socket->timeout) { + *_errno = MP_ETIMEDOUT; + return MP_STREAM_ERROR; + } + poll_sockets(); + MICROPY_PY_LWIP_REENTER + } + + // While we waited, something could happen + STREAM_ERROR_CHECK_WITH_LOCK(socket); + } + + u16_t write_len = MIN(available, len); + + // If tcp_write returns ERR_MEM then there's currently not enough memory to + // queue the write, so wait and keep trying until it succeeds (with 10s limit). + // Note: if the socket is non-blocking then this code will actually block until + // there's enough memory to do the write, but by this stage we have already + // committed to being able to write the data. + err_t err; + for (int i = 0; i < 200; ++i) { + err = tcp_write(socket->pcb.tcp, buf, write_len, TCP_WRITE_FLAG_COPY); + if (err != ERR_MEM) { + break; + } + err = tcp_output(socket->pcb.tcp); + if (err != ERR_OK) { + break; + } + MICROPY_PY_LWIP_EXIT + mp_hal_delay_ms(50); + MICROPY_PY_LWIP_REENTER + } + + // If the output buffer is getting full then send the data to the lower layers + if (err == ERR_OK && tcp_sndbuf(socket->pcb.tcp) < TCP_SND_BUF / 4) { + err = tcp_output(socket->pcb.tcp); + } + + MICROPY_PY_LWIP_EXIT + + if (err != ERR_OK) { + *_errno = error_lookup_table[-err]; + return MP_STREAM_ERROR; + } + + return write_len; +} + +// Helper function for recv/recvfrom to handle TCP packets +STATIC mp_uint_t lwip_tcp_receive(socketpool_socket_obj_t *socket, byte *buf, mp_uint_t len, int *_errno) { + // Check for any pending errors + STREAM_ERROR_CHECK(socket); + + if (socket->incoming.pbuf == NULL) { + + // Non-blocking socket + if (socket->timeout == 0) { + if (socket->state == STATE_PEER_CLOSED) { + return 0; + } + *_errno = MP_EAGAIN; + return -1; + } + + mp_uint_t start = mp_hal_ticks_ms(); + while (socket->state == STATE_CONNECTED && socket->incoming.pbuf == NULL) { + if (socket->timeout != (unsigned)-1 && mp_hal_ticks_ms() - start > socket->timeout) { + *_errno = MP_ETIMEDOUT; + return -1; + } + poll_sockets(); + } + + if (socket->state == STATE_PEER_CLOSED) { + if (socket->incoming.pbuf == NULL) { + // socket closed and no data left in buffer + return 0; + } + } else if (socket->state != STATE_CONNECTED) { + if (socket->state >= STATE_NEW) { + *_errno = MP_ENOTCONN; + } else { + *_errno = error_lookup_table[-socket->state]; + } + return -1; + } + } + + MICROPY_PY_LWIP_ENTER + + assert(socket->pcb.tcp != NULL); + + struct pbuf *p = socket->incoming.pbuf; + + mp_uint_t remaining = p->len - socket->recv_offset; + if (len > remaining) { + len = remaining; + } + + memcpy(buf, (byte *)p->payload + socket->recv_offset, len); + + remaining -= len; + if (remaining == 0) { + socket->incoming.pbuf = p->next; + // If we don't ref here, free() will free the entire chain, + // if we ref, it does what we need: frees 1st buf, and decrements + // next buf's refcount back to 1. + pbuf_ref(p->next); + pbuf_free(p); + socket->recv_offset = 0; + } else { + socket->recv_offset += len; + } + tcp_recved(socket->pcb.tcp, len); + + MICROPY_PY_LWIP_EXIT + + return len; +} + + +STATIC socketpool_socket_obj_t *open_socket_objs[MAX_SOCKETS]; +STATIC bool user_socket[MAX_SOCKETS]; + +void socket_user_reset(void) { + for (size_t i = 0; i < MP_ARRAY_SIZE(open_socket_objs); i++) { + if (open_socket_objs[i] && user_socket[i]) { + socketpool_socket_close(open_socket_objs[i]); + open_socket_objs[i] = NULL; + user_socket[i] = false; + } + } +} + +// The writes below send an event to the socket select task so that it redoes the +// select with the new open socket set. + +STATIC bool register_open_socket(socketpool_socket_obj_t *obj) { + for (size_t i = 0; i < MP_ARRAY_SIZE(open_socket_objs); i++) { + if (!open_socket_objs[i]) { + open_socket_objs[i] = obj; + DEBUG_printf("register_open_socket(%p) -> %d\n", obj, i); + user_socket[i] = false; + return true; + } + } + DEBUG_printf("register_open_socket(%p) fails due to full table\n", obj); + return false; +} + +STATIC void unregister_open_socket(socketpool_socket_obj_t *obj) { + for (size_t i = 0; i < MP_ARRAY_SIZE(open_socket_objs); i++) { + if (open_socket_objs[i] == obj) { + DEBUG_printf("unregister_open_socket(%p) clears %d\n", obj, i); + open_socket_objs[i] = NULL; + user_socket[i] = false; + return; + } + } + DEBUG_printf("unregister_open_socket(%p) fails due to missing entry\n", obj); +} + +STATIC void mark_user_socket(socketpool_socket_obj_t *obj) { + for (size_t i = 0; i < MP_ARRAY_SIZE(open_socket_objs); i++) { + if (open_socket_objs[i] == obj) { + DEBUG_printf("mark_user_socket(%p) -> %d\n", obj, i); + user_socket[i] = true; + return; + } + } + DEBUG_printf("mark_user_socket(%p) fails due to missing entry\n", obj); +} + +bool socketpool_socket(socketpool_socketpool_obj_t *self, + socketpool_socketpool_addressfamily_t family, socketpool_socketpool_sock_t type, + socketpool_socket_obj_t *socket) { + + if (!register_open_socket(socket)) { + DEBUG_printf("collecting garbage to open socket\n"); + gc_collect(); + if (!register_open_socket(socket)) { + return false; + } + } + + socket->timeout = -1; + socket->recv_offset = 0; + socket->domain = SOCKETPOOL_AF_INET; + socket->type = type; + socket->callback = MP_OBJ_NULL; + socket->state = STATE_NEW; + + switch (socket->type) { + case SOCKETPOOL_SOCK_STREAM: + socket->pcb.tcp = tcp_new(); + socket->incoming.connection.alloc = 0; + socket->incoming.connection.tcp.item = NULL; + break; + case SOCKETPOOL_SOCK_DGRAM: + socket->pcb.udp = udp_new(); + socket->incoming.pbuf = NULL; + break; + #if MICROPY_PY_LWIP_SOCK_RAW + case SOCKETPOOL_SOCK_RAW: { + socket->pcb.raw = raw_new(0); + break; + } + #endif + default: + return false; + } + + if (socket->pcb.tcp == NULL) { + return false; + } + + switch (socket->type) { + case MOD_NETWORK_SOCK_STREAM: { + // Register the socket object as our callback argument. + tcp_arg(socket->pcb.tcp, (void *)socket); + // Register our error callback. + tcp_err(socket->pcb.tcp, _lwip_tcp_error); + break; + } + case MOD_NETWORK_SOCK_DGRAM: { + socket->state = STATE_ACTIVE_UDP; + // Register our receive callback now. Since UDP sockets don't require binding or connection + // before use, there's no other good time to do it. + udp_recv(socket->pcb.udp, _lwip_udp_incoming, (void *)socket); + break; + } + #if MICROPY_PY_LWIP_SOCK_RAW + case MOD_NETWORK_SOCK_RAW: { + // Register our receive callback now. Since raw sockets don't require binding or connection + // before use, there's no other good time to do it. + raw_recv(socket->pcb.raw, _lwip_raw_incoming, (void *)socket); + break; + } + #endif + } + return true; +} + +socketpool_socket_obj_t *common_hal_socketpool_socket(socketpool_socketpool_obj_t *self, + socketpool_socketpool_addressfamily_t family, socketpool_socketpool_sock_t type) { + if (family != SOCKETPOOL_AF_INET) { + mp_raise_NotImplementedError(translate("Only IPv4 sockets supported")); + } + + // we must allocate sockets long-lived because we depend on their object-identity + socketpool_socket_obj_t *socket = m_new_ll_obj_with_finaliser(socketpool_socket_obj_t); + socket->base.type = &socketpool_socket_type; + + if (!socketpool_socket(self, family, type, socket)) { + mp_raise_RuntimeError(translate("Out of sockets")); + } + mark_user_socket(socket); + return socket; +} + +int socketpool_socket_accept(socketpool_socket_obj_t *self, uint8_t *ip, uint32_t *port) { + return -MP_EBADF; +} + +socketpool_socket_obj_t *common_hal_socketpool_socket_accept(socketpool_socket_obj_t *socket, + uint8_t *ip, uint32_t *port) { + if (socket->type != MOD_NETWORK_SOCK_STREAM) { + mp_raise_OSError(MP_EOPNOTSUPP); + } + + // Create new socket object, do it here because we must not raise an out-of-memory + // exception when the LWIP concurrency lock is held + socketpool_socket_obj_t *socket2 = m_new_ll_obj_with_finaliser(socketpool_socket_obj_t); + socket2->base.type = &socketpool_socket_type; + + MICROPY_PY_LWIP_ENTER + + if (socket->pcb.tcp == NULL) { + MICROPY_PY_LWIP_EXIT + m_del_obj(socketpool_socket_obj_t, socket2); + mp_raise_OSError(MP_EBADF); + } + + // I need to do this because "tcp_accepted", later, is a macro. + struct tcp_pcb *listener = socket->pcb.tcp; + if (listener->state != LISTEN) { + MICROPY_PY_LWIP_EXIT + m_del_obj(socketpool_socket_obj_t, socket2); + mp_raise_OSError(MP_EINVAL); + } + + // accept incoming connection + struct tcp_pcb *volatile *incoming_connection = &lwip_socket_incoming_array(socket)[socket->incoming.connection.iget]; + if (*incoming_connection == NULL) { + if (socket->timeout == 0) { + MICROPY_PY_LWIP_EXIT + m_del_obj(socketpool_socket_obj_t, socket2); + mp_raise_OSError(MP_EAGAIN); + } else if (socket->timeout != (unsigned)-1) { + mp_uint_t retries = socket->timeout / 100; + while (*incoming_connection == NULL) { + MICROPY_PY_LWIP_EXIT + if (retries-- == 0) { + m_del_obj(socketpool_socket_obj_t, socket2); + mp_raise_OSError(MP_ETIMEDOUT); + } + mp_hal_delay_ms(100); + MICROPY_PY_LWIP_REENTER + } + } else { + while (*incoming_connection == NULL) { + MICROPY_PY_LWIP_EXIT + poll_sockets(); + MICROPY_PY_LWIP_REENTER + } + } + } + + // We get a new pcb handle... + socket2->pcb.tcp = *incoming_connection; + if (++socket->incoming.connection.iget >= socket->incoming.connection.alloc) { + socket->incoming.connection.iget = 0; + } + *incoming_connection = NULL; + + // ...and set up the new socket for it. + socket2->domain = MOD_NETWORK_AF_INET; + socket2->type = MOD_NETWORK_SOCK_STREAM; + socket2->incoming.pbuf = NULL; + socket2->timeout = socket->timeout; + socket2->state = STATE_CONNECTED; + socket2->recv_offset = 0; + socket2->callback = MP_OBJ_NULL; + tcp_arg(socket2->pcb.tcp, (void *)socket2); + tcp_err(socket2->pcb.tcp, _lwip_tcp_error); + tcp_recv(socket2->pcb.tcp, _lwip_tcp_recv); + + tcp_accepted(listener); + + MICROPY_PY_LWIP_EXIT + + // output values + memcpy(ip, &(socket2->pcb.tcp->remote_ip), NETUTILS_IPV4ADDR_BUFSIZE); + *port = (mp_uint_t)socket2->pcb.tcp->remote_port; + return MP_OBJ_FROM_PTR(socket2); +} + +bool common_hal_socketpool_socket_bind(socketpool_socket_obj_t *socket, + const char *host, size_t hostlen, uint32_t port) { + + // get address + ip_addr_t bind_addr; + int error = socketpool_resolve_host(socket->pool, host, &bind_addr); + if (error != 0) { + mp_raise_OSError(EHOSTUNREACH); + } + + err_t err = ERR_ARG; + switch (socket->type) { + case MOD_NETWORK_SOCK_STREAM: { + err = tcp_bind(socket->pcb.tcp, &bind_addr, port); + break; + } + case MOD_NETWORK_SOCK_DGRAM: { + err = udp_bind(socket->pcb.udp, &bind_addr, port); + break; + } + } + + if (err != ERR_OK) { + mp_raise_OSError(error_lookup_table[-err]); + } + + return mp_const_none; +} + +STATIC err_t _lwip_tcp_close_poll(void *arg, struct tcp_pcb *pcb) { + // Connection has not been cleanly closed so just abort it to free up memory + tcp_poll(pcb, NULL, 0); + tcp_abort(pcb); + return ERR_OK; +} + +void socketpool_socket_close(socketpool_socket_obj_t *socket) { + unregister_open_socket(socket); + MICROPY_PY_LWIP_ENTER + if (socket->pcb.tcp == NULL) { // already closed + MICROPY_PY_LWIP_EXIT + return; + } + lwip_socket_free_incoming(socket); + switch (socket->type) { + case SOCKETPOOL_SOCK_STREAM: { + // Deregister callback (pcb.tcp is set to NULL below so must deregister now) + tcp_arg(socket->pcb.tcp, NULL); + tcp_err(socket->pcb.tcp, NULL); + tcp_recv(socket->pcb.tcp, NULL); + + if (socket->pcb.tcp->state != LISTEN) { + // Schedule a callback to abort the connection if it's not cleanly closed after + // the given timeout. The callback must be set before calling tcp_close since + // the latter may free the pcb; if it doesn't then the callback will be active. + tcp_poll(socket->pcb.tcp, _lwip_tcp_close_poll, MICROPY_PY_LWIP_TCP_CLOSE_TIMEOUT_MS / 500); + } + if (tcp_close(socket->pcb.tcp) != ERR_OK) { + DEBUG_printf("lwip_close: had to call tcp_abort()\n"); + tcp_abort(socket->pcb.tcp); + } + break; + } + case SOCKETPOOL_SOCK_DGRAM: + udp_recv(socket->pcb.udp, NULL, NULL); + udp_remove(socket->pcb.udp); + break; + #if MICROPY_PY_LWIP_SOCK_RAW + case SOCKETPOOL_SOCK_RAW: + raw_recv(socket->pcb.raw, NULL, NULL); + raw_remove(socket->pcb.raw); + break; + #endif + } + + socket->pcb.tcp = NULL; + socket->state = _ERR_BADF; + MICROPY_PY_LWIP_EXIT +} + +void common_hal_socketpool_socket_close(socketpool_socket_obj_t *socket) { + socketpool_socket_close(socket); +} + +void common_hal_socketpool_socket_connect(socketpool_socket_obj_t *socket, + const char *host, size_t hostlen, uint32_t port) { + + if (socket->pcb.tcp == NULL) { + mp_raise_OSError(MP_EBADF); + } + + // get address + ip_addr_t dest; + int error = socketpool_resolve_host(socket->pool, host, &dest); + if (error != 0) { + mp_raise_OSError(EHOSTUNREACH); + } + + err_t err = ERR_ARG; + switch (socket->type) { + case MOD_NETWORK_SOCK_STREAM: { + if (socket->state != STATE_NEW) { + if (socket->state == STATE_CONNECTED) { + mp_raise_OSError(MP_EISCONN); + } else { + mp_raise_OSError(MP_EALREADY); + } + } + + // Register our receive callback. + MICROPY_PY_LWIP_ENTER + tcp_recv(socket->pcb.tcp, _lwip_tcp_recv); + socket->state = STATE_CONNECTING; + err = tcp_connect(socket->pcb.tcp, &dest, port, _lwip_tcp_connected); + if (err != ERR_OK) { + MICROPY_PY_LWIP_EXIT + socket->state = STATE_NEW; + mp_raise_OSError(error_lookup_table[-err]); + } + socket->peer_port = (mp_uint_t)port; + memcpy(socket->peer, &dest, sizeof(socket->peer)); + MICROPY_PY_LWIP_EXIT + + // And now we wait... + if (socket->timeout != (unsigned)-1) { + for (mp_uint_t retries = socket->timeout / 100; retries--;) { + mp_hal_delay_ms(100); + if (socket->state != STATE_CONNECTING) { + break; + } + } + if (socket->state == STATE_CONNECTING) { + mp_raise_OSError(MP_EINPROGRESS); + } + } else { + while (socket->state == STATE_CONNECTING) { + poll_sockets(); + } + } + if (socket->state == STATE_CONNECTED) { + err = ERR_OK; + } else { + err = socket->state; + } + break; + } + case MOD_NETWORK_SOCK_DGRAM: { + err = udp_connect(socket->pcb.udp, &dest, port); + break; + } + #if MICROPY_PY_LWIP_SOCK_RAW + case MOD_NETWORK_SOCK_RAW: { + err = raw_connect(socket->pcb.raw, &dest); + break; + } + #endif + } + + if (err != ERR_OK) { + mp_raise_OSError(error_lookup_table[-err]); + } +} + +bool common_hal_socketpool_socket_get_closed(socketpool_socket_obj_t *socket) { + return !socket->pcb.tcp; +} + +bool common_hal_socketpool_socket_get_connected(socketpool_socket_obj_t *socket) { + return socket->state == STATE_CONNECTED; +} + +bool common_hal_socketpool_socket_listen(socketpool_socket_obj_t *socket, int backlog) { + if (socket->type != MOD_NETWORK_SOCK_STREAM) { + mp_raise_OSError(MP_EOPNOTSUPP); + } + + struct tcp_pcb *new_pcb = tcp_listen_with_backlog(socket->pcb.tcp, (u8_t)backlog); + if (new_pcb == NULL) { + mp_raise_OSError(MP_ENOMEM); + } + socket->pcb.tcp = new_pcb; + + // Allocate memory for the backlog of connections + if (backlog <= 1) { + socket->incoming.connection.alloc = 0; + socket->incoming.connection.tcp.item = NULL; + } else { + socket->incoming.connection.alloc = backlog; + socket->incoming.connection.tcp.array = m_new0(struct tcp_pcb *, backlog); + } + socket->incoming.connection.iget = 0; + socket->incoming.connection.iput = 0; + + tcp_accept(new_pcb, _lwip_tcp_accept); + + // Socket is no longer considered "new" for purposes of polling + socket->state = STATE_LISTENING; + + return mp_const_none; +} + +mp_uint_t common_hal_socketpool_socket_recvfrom_into(socketpool_socket_obj_t *socket, + uint8_t *buf, uint32_t len, uint8_t *ip, uint32_t *port) { + int _errno; + + mp_uint_t ret = 0; + switch (socket->type) { + case SOCKETPOOL_SOCK_STREAM: { + memcpy(ip, &socket->peer, sizeof(socket->peer)); + *port = (mp_uint_t)socket->peer_port; + ret = lwip_tcp_receive(socket, (byte *)buf, len, &_errno); + break; + } + case SOCKETPOOL_SOCK_DGRAM: + #if MICROPY_PY_LWIP_SOCK_RAW + case SOCKETPOOL_SOCK_RAW: + #endif + ret = lwip_raw_udp_receive(socket, (byte *)buf, len, ip, port, &_errno); + break; + } + if (ret == (unsigned)-1) { + mp_raise_OSError(_errno); + } + + return ret; +} + +int socketpool_socket_recv_into(socketpool_socket_obj_t *socket, + const uint8_t *buf, uint32_t len) { + mp_uint_t ret = 0; + int _errno = 0; + switch (socket->type) { + case SOCKETPOOL_SOCK_STREAM: { + ret = lwip_tcp_receive(socket, (byte *)buf, len, &_errno); + break; + } + case SOCKETPOOL_SOCK_DGRAM: + #if MICROPY_PY_LWIP_SOCK_RAW + case SOCKETPOOL_SOCK_RAW: + #endif + ret = lwip_raw_udp_receive(socket, (byte *)buf, len, NULL, NULL, &_errno); + break; + } + return ret; +} + +mp_uint_t common_hal_socketpool_socket_recv_into(socketpool_socket_obj_t *self, const uint8_t *buf, uint32_t len) { + int received = socketpool_socket_recv_into(self, buf, len); + if (received < 0) { + mp_raise_OSError(received); + } + return received; +} + +int socketpool_socket_send(socketpool_socket_obj_t *socket, const uint8_t *buf, uint32_t len) { + mp_uint_t ret = 0; + int _errno = 0; + switch (socket->type) { + case SOCKETPOOL_SOCK_STREAM: { + ret = lwip_tcp_send(socket, buf, len, &_errno); + break; + } + case SOCKETPOOL_SOCK_DGRAM: + #if MICROPY_PY_LWIP_SOCK_RAW + case SOCKETPOOL_SOCK_RAW: + #endif + ret = lwip_raw_udp_send(socket, buf, len, NULL, 0, &_errno); + break; + } + if (ret == (unsigned)-1) { + return -_errno; + } + return ret; +} + +mp_uint_t common_hal_socketpool_socket_send(socketpool_socket_obj_t *self, const uint8_t *buf, uint32_t len) { + int sent = socketpool_socket_send(self, buf, len); + + if (sent < 0) { + mp_raise_OSError(-sent); + } + return sent; +} + +mp_uint_t common_hal_socketpool_socket_sendto(socketpool_socket_obj_t *socket, + const char *host, size_t hostlen, uint32_t port, const uint8_t *buf, uint32_t len) { + int _errno; + ip_addr_t ip; + int error = socketpool_resolve_host(socket->pool, host, &ip); + if (error != 0) { + mp_raise_OSError(EHOSTUNREACH); + } + + mp_uint_t ret = 0; + switch (socket->type) { + case SOCKETPOOL_SOCK_STREAM: { + ret = lwip_tcp_send(socket, buf, len, &_errno); + break; + } + case SOCKETPOOL_SOCK_DGRAM: + #if MICROPY_PY_LWIP_SOCK_RAW + case SOCKETPOOL_SOCK_RAW: + #endif + ret = lwip_raw_udp_send(socket, buf, len, &ip, port, &_errno); + break; + } + if (ret == (unsigned)-1) { + mp_raise_OSError(_errno); + } + + return ret; +} + +void common_hal_socketpool_socket_settimeout(socketpool_socket_obj_t *self, uint32_t timeout_ms) { + self->timeout = timeout_ms; +} diff --git a/ports/raspberrypi/common-hal/socketpool/Socket.h b/ports/raspberrypi/common-hal/socketpool/Socket.h new file mode 100644 index 0000000000..f582b77a9b --- /dev/null +++ b/ports/raspberrypi/common-hal/socketpool/Socket.h @@ -0,0 +1,77 @@ +/* + * This file is part of the MicroPython project, http://micropython.org/ + * + * The MIT License (MIT) + * + * Copyright (c) 2013-2019 Damien P. George + * Copyright (c) 2015 Galen Hazelwood + * Copyright (c) 2015-2017 Paul Sokolovsky + * Copyright (c) 2022 Jeff Epler for Adafruit Industries + * + * Permission is hereby granted, free of charge, to any person obtaining a copy + * of this software and associated documentation files (the "Software"), to deal + * in the Software without restriction, including without limitation the rights + * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell + * copies of the Software, and to permit persons to whom the Software is + * furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice shall be included in + * all copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE + * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER + * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, + * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN + * THE SOFTWARE. + */ + +#pragma once + +#include "py/obj.h" + +#include "common-hal/socketpool/SocketPool.h" + +typedef struct _lwip_socket_obj_t { + mp_obj_base_t base; + + volatile union { + struct tcp_pcb *tcp; + struct udp_pcb *udp; + struct raw_pcb *raw; + } pcb; + volatile union { + struct pbuf *pbuf; + struct { + uint8_t alloc; + uint8_t iget; + uint8_t iput; + union { + struct tcp_pcb *item; // if alloc == 0 + struct tcp_pcb **array; // if alloc != 0 + } tcp; + } connection; + } incoming; + mp_obj_t callback; + byte peer[4]; + mp_uint_t peer_port; + mp_uint_t timeout; + uint16_t recv_offset; + + uint8_t domain; + uint8_t type; + + #define STATE_NEW 0 + #define STATE_LISTENING 1 + #define STATE_CONNECTING 2 + #define STATE_CONNECTED 3 + #define STATE_PEER_CLOSED 4 + #define STATE_ACTIVE_UDP 5 + // Negative value is lwIP error + int8_t state; + + socketpool_socketpool_obj_t *pool; +} socketpool_socket_obj_t; + +void socket_user_reset(void); diff --git a/ports/raspberrypi/common-hal/socketpool/SocketPool.c b/ports/raspberrypi/common-hal/socketpool/SocketPool.c new file mode 100644 index 0000000000..d2f403c852 --- /dev/null +++ b/ports/raspberrypi/common-hal/socketpool/SocketPool.c @@ -0,0 +1,110 @@ +/* + * This file is part of the MicroPython project, http://micropython.org/ + * + * The MIT License (MIT) + * + * Copyright (c) 2020 Scott Shawcroft for Adafruit Industries + * + * Permission is hereby granted, free of charge, to any person obtaining a copy + * of this software and associated documentation files (the "Software"), to deal + * in the Software without restriction, including without limitation the rights + * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell + * copies of the Software, and to permit persons to whom the Software is + * furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice shall be included in + * all copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE + * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER + * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, + * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN + * THE SOFTWARE. + */ + +#include "shared-bindings/socketpool/SocketPool.h" +#include "common-hal/socketpool/Socket.h" +#include "shared/runtime/interrupt_char.h" +#include "py/runtime.h" +#include "shared-bindings/wifi/__init__.h" + +#include "lwip/dns.h" +#include "lwip/inet.h" + +void common_hal_socketpool_socketpool_construct(socketpool_socketpool_obj_t *self, mp_obj_t radio) { + if (radio != MP_OBJ_FROM_PTR(&common_hal_wifi_radio_obj)) { + mp_raise_ValueError(translate("SocketPool can only be used with wifi.radio")); + } +} + +// common_hal_socketpool_socket is in socketpool/Socket.c to centralize open socket tracking. + +typedef struct _getaddrinfo_state_t { + volatile int status; + volatile ip_addr_t ipaddr; +} getaddrinfo_state_t; + +STATIC void lwip_getaddrinfo_cb(const char *name, const ip_addr_t *ipaddr, void *arg) { + getaddrinfo_state_t *state = arg; + if (ipaddr != NULL) { + state->status = 1; + state->ipaddr = *ipaddr; + } else { + // error + state->status = -2; + } +} + +int socketpool_resolve_host(socketpool_socketpool_obj_t *self, const char *host, ip_addr_t *addr) { + + getaddrinfo_state_t state; + state.status = 0; + + MICROPY_PY_LWIP_ENTER + err_t ret = dns_gethostbyname(host, (ip_addr_t *)&state.ipaddr, lwip_getaddrinfo_cb, &state); + MICROPY_PY_LWIP_EXIT + + switch (ret) { + case ERR_OK: + // cached + state.status = 1; + break; + case ERR_INPROGRESS: + while (state.status == 0) { + RUN_BACKGROUND_TASKS; + if (mp_hal_is_interrupted()) { + break; + } + } + break; + default: + state.status = ret; + } + + if (state.status < 0) { + return state.status; + // TODO: CPython raises gaierror, we raise with native lwIP negative error + // values, to differentiate from normal errno's at least in such way. + mp_raise_OSError(state.status); + } + + *addr = state.ipaddr; + return 0; +} + +mp_obj_t common_hal_socketpool_socketpool_gethostbyname(socketpool_socketpool_obj_t *self, + const char *host) { + + ip_addr_t addr; + int result = socketpool_resolve_host(self, host, &addr); + if (result < 0) { + mp_raise_OSError(-result); + } + + char ip_str[IP4ADDR_STRLEN_MAX]; + inet_ntoa_r(addr, ip_str, IP4ADDR_STRLEN_MAX); + mp_obj_t ip_obj = mp_obj_new_str(ip_str, strlen(ip_str)); + return ip_obj; +} diff --git a/ports/espressif/supervisor/esp_port.h b/ports/raspberrypi/common-hal/socketpool/SocketPool.h similarity index 78% rename from ports/espressif/supervisor/esp_port.h rename to ports/raspberrypi/common-hal/socketpool/SocketPool.h index 90ba3f65f1..3d498d9a49 100644 --- a/ports/espressif/supervisor/esp_port.h +++ b/ports/raspberrypi/common-hal/socketpool/SocketPool.h @@ -3,7 +3,7 @@ * * The MIT License (MIT) * - * Copyright (c) 2019 Lucian Copeland for Adafruit Industries + * Copyright (c) 2020 Scott Shawcroft for Adafruit Industries * * Permission is hereby granted, free of charge, to any person obtaining a copy * of this software and associated documentation files (the "Software"), to deal @@ -24,12 +24,12 @@ * THE SOFTWARE. */ -#ifndef MICROPY_INCLUDED_ESPRESSIF_SUPERVISOR_PORT_H -#define MICROPY_INCLUDED_ESPRESSIF_SUPERVISOR_PORT_H +#pragma once -#include "freertos/FreeRTOS.h" -#include "freertos/task.h" +#include "py/obj.h" -extern TaskHandle_t circuitpython_task; +typedef struct { + mp_obj_base_t base; +} socketpool_socketpool_obj_t; -#endif // MICROPY_INCLUDED_ESPRESSIF_SUPERVISOR_PORT_H +int socketpool_resolve_host(socketpool_socketpool_obj_t *self, const char *host, ip_addr_t *addr); diff --git a/ports/raspberrypi/common-hal/socketpool/__init__.c b/ports/raspberrypi/common-hal/socketpool/__init__.c new file mode 100644 index 0000000000..595977d24f --- /dev/null +++ b/ports/raspberrypi/common-hal/socketpool/__init__.c @@ -0,0 +1,33 @@ +/* + * This file is part of the MicroPython project, http://micropython.org/ + * + * The MIT License (MIT) + * + * Copyright (c) 2020 Scott Shawcroft for Adafruit Industries + * + * Permission is hereby granted, free of charge, to any person obtaining a copy + * of this software and associated documentation files (the "Software"), to deal + * in the Software without restriction, including without limitation the rights + * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell + * copies of the Software, and to permit persons to whom the Software is + * furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice shall be included in + * all copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE + * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER + * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, + * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN + * THE SOFTWARE. + */ + +#include "shared-bindings/socketpool/__init__.h" + +#include "common-hal/socketpool/Socket.h" + +void socketpool_user_reset(void) { + socket_user_reset(); +} diff --git a/ports/espressif/modules/none.c b/ports/raspberrypi/common-hal/socketpool/__init__.h similarity index 88% rename from ports/espressif/modules/none.c rename to ports/raspberrypi/common-hal/socketpool/__init__.h index aa751bf3f4..32f1fe1dcb 100644 --- a/ports/espressif/modules/none.c +++ b/ports/raspberrypi/common-hal/socketpool/__init__.h @@ -1,5 +1,5 @@ /* - * This file is part of the Micro Python project, http://micropython.org/ + * This file is part of the MicroPython project, http://micropython.org/ * * The MIT License (MIT) * @@ -24,7 +24,4 @@ * THE SOFTWARE. */ -#include "modules/module.h" - -void never_reset_module_internal_pins(void) { -} +#pragma once diff --git a/ports/raspberrypi/common-hal/ssl/SSLContext.c b/ports/raspberrypi/common-hal/ssl/SSLContext.c new file mode 100644 index 0000000000..da3bed5005 --- /dev/null +++ b/ports/raspberrypi/common-hal/ssl/SSLContext.c @@ -0,0 +1,66 @@ +/* + * This file is part of the MicroPython project, http://micropython.org/ + * + * The MIT License (MIT) + * + * Copyright (c) 2020 Scott Shawcroft for Adafruit Industries + * + * Permission is hereby granted, free of charge, to any person obtaining a copy + * of this software and associated documentation files (the "Software"), to deal + * in the Software without restriction, including without limitation the rights + * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell + * copies of the Software, and to permit persons to whom the Software is + * furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice shall be included in + * all copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE + * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER + * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, + * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN + * THE SOFTWARE. + */ + +#include "shared-bindings/ssl/SSLContext.h" +#include "shared-bindings/ssl/SSLSocket.h" +#include "shared-bindings/socketpool/SocketPool.h" + +#include "py/runtime.h" +#include "py/stream.h" + +#include "mbedtls/crt_bundle.h" + +void common_hal_ssl_sslcontext_construct(ssl_sslcontext_obj_t *self) { + common_hal_ssl_sslcontext_set_default_verify_paths(self); +} + +void common_hal_ssl_sslcontext_load_verify_locations(ssl_sslcontext_obj_t *self, + const char *cadata) { + self->crt_bundle_attach = NULL; + self->use_global_ca_store = false; + self->cacert_buf = (const unsigned char *)cadata; + self->cacert_bytes = strlen(cadata) + 1; +} + +void common_hal_ssl_sslcontext_set_default_verify_paths(ssl_sslcontext_obj_t *self) { + self->crt_bundle_attach = crt_bundle_attach; + self->use_global_ca_store = true; + self->cacert_buf = NULL; + self->cacert_bytes = 0; +} + +bool common_hal_ssl_sslcontext_get_check_hostname(ssl_sslcontext_obj_t *self) { + return self->check_name; +} + +void common_hal_ssl_sslcontext_set_check_hostname(ssl_sslcontext_obj_t *self, bool value) { + self->check_name = value; +} + +void common_hal_ssl_sslcontext_load_cert_chain(ssl_sslcontext_obj_t *self, mp_buffer_info_t *cert_buf, mp_buffer_info_t *key_buf) { + self->cert_buf = *cert_buf; + self->key_buf = *key_buf; +} diff --git a/ports/raspberrypi/common-hal/ssl/SSLContext.h b/ports/raspberrypi/common-hal/ssl/SSLContext.h new file mode 100644 index 0000000000..40840deeec --- /dev/null +++ b/ports/raspberrypi/common-hal/ssl/SSLContext.h @@ -0,0 +1,40 @@ +/* + * This file is part of the MicroPython project, http://micropython.org/ + * + * The MIT License (MIT) + * + * Copyright (c) 2020 Scott Shawcroft for Adafruit Industries + * Copyright (c) 2022 Jeff Epler for Adafruit Industries + * + * Permission is hereby granted, free of charge, to any person obtaining a copy + * of this software and associated documentation files (the "Software"), to deal + * in the Software without restriction, including without limitation the rights + * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell + * copies of the Software, and to permit persons to whom the Software is + * furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice shall be included in + * all copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE + * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER + * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, + * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN + * THE SOFTWARE. + */ + +#pragma once + +#include "py/obj.h" +#include "mbedtls/ssl.h" + +typedef struct { + mp_obj_base_t base; + bool check_name, use_global_ca_store; + const unsigned char *cacert_buf; + size_t cacert_bytes; + int (*crt_bundle_attach)(mbedtls_ssl_config *conf); + mp_buffer_info_t cert_buf, key_buf; +} ssl_sslcontext_obj_t; diff --git a/ports/raspberrypi/common-hal/ssl/SSLSocket.c b/ports/raspberrypi/common-hal/ssl/SSLSocket.c new file mode 100644 index 0000000000..dd1f50d29a --- /dev/null +++ b/ports/raspberrypi/common-hal/ssl/SSLSocket.c @@ -0,0 +1,357 @@ +/* + * This file is part of the MicroPython project, http://micropython.org/ + * + * The MIT License (MIT) + * + * Copyright (c) 2016 Linaro Ltd. + * Copyright (c) 2019 Paul Sokolovsky + * Copyright (c) 2022 Jeff Epler for Adafruit Industries + * + * Permission is hereby granted, free of charge, to any person obtaining a copy + * of this software and associated documentation files (the "Software"), to deal + * in the Software without restriction, including without limitation the rights + * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell + * copies of the Software, and to permit persons to whom the Software is + * furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice shall be included in + * all copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE + * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER + * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, + * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN + * THE SOFTWARE. + */ + +#include "shared-bindings/ssl/SSLSocket.h" +#include "shared-bindings/socketpool/Socket.h" +#include "shared-bindings/ssl/SSLContext.h" +#include "shared-bindings/socketpool/SocketPool.h" +#include "shared-bindings/socketpool/Socket.h" + +#include "shared/runtime/interrupt_char.h" +#include "py/mperrno.h" +#include "py/mphal.h" +#include "py/objstr.h" +#include "py/runtime.h" +#include "py/stream.h" +#include "supervisor/shared/tick.h" + +#if defined(MBEDTLS_ERROR_C) +#include "../../lib/mbedtls_errors/mp_mbedtls_errors.c" +#endif + +#ifdef MBEDTLS_DEBUG_C +#include "mbedtls/debug.h" +STATIC void mbedtls_debug(void *ctx, int level, const char *file, int line, const char *str) { + (void)ctx; + (void)level; + mp_printf(&mp_plat_print, "DBG:%s:%04d: %s\n", file, line, str); +} +#define DEBUG(fmt, ...) mp_printf(&mp_plat_print, "DBG:%s:%04d: " fmt "\n", __FILE__, __LINE__,##__VA_ARGS__) +#else +#define DEBUG(...) do {} while (0) +#endif + +STATIC NORETURN void mbedtls_raise_error(int err) { + // _mbedtls_ssl_send and _mbedtls_ssl_recv (below) turn positive error codes from the + // underlying socket into negative codes to pass them through mbedtls. Here we turn them + // positive again so they get interpreted as the OSError they really are. The + // cut-off of -256 is a bit hacky, sigh. + if (err < 0 && err > -256) { + mp_raise_OSError(-err); + } + + #if defined(MBEDTLS_ERROR_C) + // Including mbedtls_strerror takes about 1.5KB due to the error strings. + // MBEDTLS_ERROR_C is the define used by mbedtls to conditionally include mbedtls_strerror. + // It is set/unset in the MBEDTLS_CONFIG_FILE which is defined in the Makefile. + + // Try to allocate memory for the message + #define ERR_STR_MAX 80 // mbedtls_strerror truncates if it doesn't fit + mp_obj_str_t *o_str = m_new_obj_maybe(mp_obj_str_t); + byte *o_str_buf = m_new_maybe(byte, ERR_STR_MAX); + if (o_str == NULL || o_str_buf == NULL) { + mp_raise_OSError(err); + } + + // print the error message into the allocated buffer + mbedtls_strerror(err, (char *)o_str_buf, ERR_STR_MAX); + size_t len = strlen((char *)o_str_buf); + + // Put the exception object together + o_str->base.type = &mp_type_str; + o_str->data = o_str_buf; + o_str->len = len; + o_str->hash = qstr_compute_hash(o_str->data, o_str->len); + // raise + mp_obj_t args[2] = { MP_OBJ_NEW_SMALL_INT(err), MP_OBJ_FROM_PTR(o_str)}; + nlr_raise(mp_obj_exception_make_new(&mp_type_OSError, 2, 0, args)); + #else + // mbedtls is compiled without error strings so we simply return the err number + mp_raise_OSError(err); // err is typically a large negative number + #endif +} + +STATIC int _mbedtls_ssl_send(void *ctx, const byte *buf, size_t len) { + mp_obj_t sock = *(mp_obj_t *)ctx; + + // mp_uint_t out_sz = sock_stream->write(sock, buf, len, &err); + mp_int_t out_sz = common_hal_socketpool_socket_send(sock, buf, len); + DEBUG("socket_send() -> %d", out_sz); + if (out_sz < 0) { + int err = -out_sz; + DEBUG("sock_stream->write() -> %d nonblocking? %d", out_sz, mp_is_nonblocking_error(err)); + if (mp_is_nonblocking_error(err)) { + return MBEDTLS_ERR_SSL_WANT_WRITE; + } + return -err; // convert an MP_ERRNO to something mbedtls passes through as error + } else { + return out_sz; + } +} + +// _mbedtls_ssl_recv is called by mbedtls to receive bytes from the underlying socket +STATIC int _mbedtls_ssl_recv(void *ctx, byte *buf, size_t len) { + mp_obj_t sock = *(mp_obj_t *)ctx; + + mp_int_t out_sz = common_hal_socketpool_socket_recv_into(sock, buf, len); + DEBUG("socket_recv() -> %d", out_sz); + if (out_sz < 0) { + int err = -out_sz; + if (mp_is_nonblocking_error(err)) { + return MBEDTLS_ERR_SSL_WANT_READ; + } + return -err; + } else { + return out_sz; + } +} + + + +ssl_sslsocket_obj_t *common_hal_ssl_sslcontext_wrap_socket(ssl_sslcontext_obj_t *self, + socketpool_socket_obj_t *socket, bool server_side, const char *server_hostname) { + + if (socket->type != SOCKETPOOL_SOCK_STREAM) { + mp_raise_RuntimeError(translate("Invalid socket for TLS")); + } + + ssl_sslsocket_obj_t *o = m_new_obj_with_finaliser(ssl_sslsocket_obj_t); + o->base.type = &ssl_sslsocket_type; + o->ssl_context = self; + o->sock = socket; + + mbedtls_ssl_init(&o->ssl); + mbedtls_ssl_config_init(&o->conf); + mbedtls_x509_crt_init(&o->cacert); + mbedtls_x509_crt_init(&o->cert); + mbedtls_pk_init(&o->pkey); + mbedtls_ctr_drbg_init(&o->ctr_drbg); + #ifdef MBEDTLS_DEBUG_C + // Debug level (0-4) 1=warning, 2=info, 3=debug, 4=verbose + mbedtls_debug_set_threshold(4); + #endif + + mbedtls_entropy_init(&o->entropy); + const byte seed[] = "upy"; + int ret = mbedtls_ctr_drbg_seed(&o->ctr_drbg, mbedtls_entropy_func, &o->entropy, seed, sizeof(seed)); + if (ret != 0) { + goto cleanup; + } + + ret = mbedtls_ssl_config_defaults(&o->conf, + server_side ? MBEDTLS_SSL_IS_SERVER : MBEDTLS_SSL_IS_CLIENT, + MBEDTLS_SSL_TRANSPORT_STREAM, + MBEDTLS_SSL_PRESET_DEFAULT); + if (ret != 0) { + goto cleanup; + } + + if (self->crt_bundle_attach != NULL) { + mbedtls_ssl_conf_authmode(&o->conf, MBEDTLS_SSL_VERIFY_REQUIRED); + self->crt_bundle_attach(&o->conf); + } else if (self->cacert_buf && self->cacert_bytes) { + ret = mbedtls_x509_crt_parse(&o->cacert, self->cacert_buf, self->cacert_bytes); + if (ret != 0) { + goto cleanup; + } + mbedtls_ssl_conf_authmode(&o->conf, MBEDTLS_SSL_VERIFY_REQUIRED); + mbedtls_ssl_conf_ca_chain(&o->conf, &o->cacert, NULL); + + } else { + mbedtls_ssl_conf_authmode(&o->conf, MBEDTLS_SSL_VERIFY_NONE); + } + mbedtls_ssl_conf_rng(&o->conf, mbedtls_ctr_drbg_random, &o->ctr_drbg); + #ifdef MBEDTLS_DEBUG_C + mbedtls_ssl_conf_dbg(&o->conf, mbedtls_debug, NULL); + #endif + + ret = mbedtls_ssl_setup(&o->ssl, &o->conf); + if (ret != 0) { + goto cleanup; + } + + if (server_hostname != NULL) { + ret = mbedtls_ssl_set_hostname(&o->ssl, server_hostname); + if (ret != 0) { + goto cleanup; + } + } + + mbedtls_ssl_set_bio(&o->ssl, &o->sock, _mbedtls_ssl_send, _mbedtls_ssl_recv, NULL); + + if (self->cert_buf.buf != NULL) { + ret = mbedtls_pk_parse_key(&o->pkey, self->key_buf.buf, self->key_buf.len + 1, NULL, 0); + if (ret != 0) { + goto cleanup; + } + ret = mbedtls_x509_crt_parse(&o->cert, self->cert_buf.buf, self->cert_buf.len + 1); + if (ret != 0) { + goto cleanup; + } + + ret = mbedtls_ssl_conf_own_cert(&o->conf, &o->cert, &o->pkey); + if (ret != 0) { + goto cleanup; + } + } + return o; +cleanup: + mbedtls_pk_free(&o->pkey); + mbedtls_x509_crt_free(&o->cert); + mbedtls_x509_crt_free(&o->cacert); + mbedtls_ssl_free(&o->ssl); + mbedtls_ssl_config_free(&o->conf); + mbedtls_ctr_drbg_free(&o->ctr_drbg); + mbedtls_entropy_free(&o->entropy); + + if (ret == MBEDTLS_ERR_SSL_ALLOC_FAILED) { + mp_raise_OSError(MP_ENOMEM); + } else if (ret == MBEDTLS_ERR_PK_BAD_INPUT_DATA) { + mp_raise_ValueError(MP_ERROR_TEXT("invalid key")); + } else if (ret == MBEDTLS_ERR_X509_BAD_INPUT_DATA) { + mp_raise_ValueError(MP_ERROR_TEXT("invalid cert")); + } else { + mbedtls_raise_error(ret); + } +} + +mp_uint_t common_hal_ssl_sslsocket_recv_into(ssl_sslsocket_obj_t *self, uint8_t *buf, uint32_t len) { + int ret = mbedtls_ssl_read(&self->ssl, buf, len); + DEBUG("recv_into mbedtls_ssl_read() -> %d\n", ret); + if (ret == MBEDTLS_ERR_SSL_PEER_CLOSE_NOTIFY) { + DEBUG("returning %d\n", 0); + // end of stream + return 0; + } + if (ret >= 0) { + DEBUG("returning %d\n", ret); + return ret; + } + if (ret == MBEDTLS_ERR_SSL_WANT_READ) { + ret = MP_EWOULDBLOCK; + } else if (ret == MBEDTLS_ERR_SSL_WANT_WRITE) { + // If handshake is not finished, read attempt may end up in protocol + // wanting to write next handshake message. The same may happen with + // renegotation. + ret = MP_EWOULDBLOCK; + } + DEBUG("returning [error case] %d\n", -ret); + return -ret; +} + +mp_uint_t common_hal_ssl_sslsocket_send(ssl_sslsocket_obj_t *self, const uint8_t *buf, uint32_t len) { + int ret = mbedtls_ssl_write(&self->ssl, buf, len); + DEBUG("send mbedtls_ssl_write() -> %d\n", ret); + if (ret >= 0) { + DEBUG("returning %d\n", ret); + return ret; + } + if (ret == MBEDTLS_ERR_SSL_WANT_WRITE) { + ret = MP_EWOULDBLOCK; + } else if (ret == MBEDTLS_ERR_SSL_WANT_READ) { + // If handshake is not finished, write attempt may end up in protocol + // wanting to read next handshake message. The same may happen with + // renegotation. + ret = MP_EWOULDBLOCK; + } + DEBUG("returning [error case] %d\n", -ret); + return -ret; +} + +bool common_hal_ssl_sslsocket_bind(ssl_sslsocket_obj_t *self, const char *host, size_t hostlen, uint32_t port) { + mp_raise_NotImplementedError(NULL); +} + +void common_hal_ssl_sslsocket_close(ssl_sslsocket_obj_t *self) { + self->closed = true; + common_hal_socketpool_socket_close(self->sock); + mbedtls_pk_free(&self->pkey); + mbedtls_x509_crt_free(&self->cert); + mbedtls_x509_crt_free(&self->cacert); + mbedtls_ssl_free(&self->ssl); + mbedtls_ssl_config_free(&self->conf); + mbedtls_ctr_drbg_free(&self->ctr_drbg); + mbedtls_entropy_free(&self->entropy); +} + +void common_hal_ssl_sslsocket_connect(ssl_sslsocket_obj_t *self, const char *host, size_t hostlen, uint32_t port) { + common_hal_socketpool_socket_connect(self->sock, host, hostlen, port); + int ret; + while ((ret = mbedtls_ssl_handshake(&self->ssl)) != 0) { + if (ret != MBEDTLS_ERR_SSL_WANT_READ && ret != MBEDTLS_ERR_SSL_WANT_WRITE) { + goto cleanup; + } + RUN_BACKGROUND_TASKS; + if (MP_STATE_THREAD(mp_pending_exception) != MP_OBJ_NULL) { + mp_handle_pending(true); + } + mp_hal_delay_ms(1); + } + + return; + +cleanup: + self->closed = true; + mbedtls_pk_free(&self->pkey); + mbedtls_x509_crt_free(&self->cert); + mbedtls_x509_crt_free(&self->cacert); + mbedtls_ssl_free(&self->ssl); + mbedtls_ssl_config_free(&self->conf); + mbedtls_ctr_drbg_free(&self->ctr_drbg); + mbedtls_entropy_free(&self->entropy); + + if (ret == MBEDTLS_ERR_SSL_ALLOC_FAILED) { + mp_raise_OSError(MP_ENOMEM); + } else if (ret == MBEDTLS_ERR_PK_BAD_INPUT_DATA) { + mp_raise_ValueError(MP_ERROR_TEXT("invalid key")); + } else if (ret == MBEDTLS_ERR_X509_BAD_INPUT_DATA) { + mp_raise_ValueError(MP_ERROR_TEXT("invalid cert")); + } else { + mbedtls_raise_error(ret); + } +} + +bool common_hal_ssl_sslsocket_get_closed(ssl_sslsocket_obj_t *self) { + return self->closed; +} + +bool common_hal_ssl_sslsocket_get_connected(ssl_sslsocket_obj_t *self) { + return !self->closed; +} + +bool common_hal_ssl_sslsocket_listen(ssl_sslsocket_obj_t *self, int backlog) { + mp_raise_NotImplementedError(NULL); +} + +ssl_sslsocket_obj_t *common_hal_ssl_sslsocket_accept(ssl_sslsocket_obj_t *self, uint8_t *ip, uint32_t *port) { + mp_raise_NotImplementedError(NULL); +} + +void common_hal_ssl_sslsocket_settimeout(ssl_sslsocket_obj_t *self, uint32_t timeout_ms) { + self->sock->timeout = timeout_ms; +} diff --git a/ports/raspberrypi/common-hal/ssl/SSLSocket.h b/ports/raspberrypi/common-hal/ssl/SSLSocket.h new file mode 100644 index 0000000000..ad4f0f7092 --- /dev/null +++ b/ports/raspberrypi/common-hal/ssl/SSLSocket.h @@ -0,0 +1,54 @@ +/* + * This file is part of the MicroPython project, http://micropython.org/ + * + * The MIT License (MIT) + * + * Copyright (c) 2021 Lucian Copeland for Adafruit Industries + * Copyright (c) 2022 Jeff Epler for Adafruit Industries + * + * Permission is hereby granted, free of charge, to any person obtaining a copy + * of this software and associated documentation files (the "Software"), to deal + * in the Software without restriction, including without limitation the rights + * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell + * copies of the Software, and to permit persons to whom the Software is + * furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice shall be included in + * all copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE + * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER + * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, + * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN + * THE SOFTWARE. + */ + +#pragma once + +#include "py/obj.h" + +#include "common-hal/ssl/SSLContext.h" +#include "common-hal/socketpool/Socket.h" + +#include "mbedtls/platform.h" +#include "mbedtls/ssl.h" +#include "mbedtls/x509_crt.h" +#include "mbedtls/pk.h" +#include "mbedtls/entropy.h" +#include "mbedtls/ctr_drbg.h" + +typedef struct { + mp_obj_base_t base; + socketpool_socket_obj_t *sock; + ssl_sslcontext_obj_t *ssl_context; + mbedtls_entropy_context entropy; + mbedtls_ctr_drbg_context ctr_drbg; + mbedtls_ssl_context ssl; + mbedtls_ssl_config conf; + mbedtls_x509_crt cacert; + mbedtls_x509_crt cert; + mbedtls_pk_context pkey; + bool closed; +} ssl_sslsocket_obj_t; diff --git a/ports/raspberrypi/common-hal/ssl/__init__.c b/ports/raspberrypi/common-hal/ssl/__init__.c new file mode 100644 index 0000000000..a59898b957 --- /dev/null +++ b/ports/raspberrypi/common-hal/ssl/__init__.c @@ -0,0 +1,39 @@ +/* + * This file is part of the MicroPython project, http://micropython.org/ + * + * The MIT License (MIT) + * + * Copyright (c) 2020 Scott Shawcroft for Adafruit Industries + * Copyright (c) 2022 Jeff Epler for Adafruit Industries + * + * Permission is hereby granted, free of charge, to any person obtaining a copy + * of this software and associated documentation files (the "Software"), to deal + * in the Software without restriction, including without limitation the rights + * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell + * copies of the Software, and to permit persons to whom the Software is + * furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice shall be included in + * all copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE + * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER + * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, + * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN + * THE SOFTWARE. + */ + +#include "common-hal/ssl/__init__.h" +#include "shared-bindings/ssl/__init__.h" +#include "shared-bindings/ssl/SSLContext.h" +#include "mbedtls/crt_bundle.h" + +void common_hal_ssl_create_default_context(ssl_sslcontext_obj_t *self) { + common_hal_ssl_sslcontext_construct(self); +} + +void ssl_reset(void) { + crt_bundle_detach(NULL); +} diff --git a/ports/raspberrypi/common-hal/ssl/__init__.h b/ports/raspberrypi/common-hal/ssl/__init__.h new file mode 100644 index 0000000000..6f1757ee47 --- /dev/null +++ b/ports/raspberrypi/common-hal/ssl/__init__.h @@ -0,0 +1,29 @@ +/* + * This file is part of the MicroPython project, http://micropython.org/ + * + * The MIT License (MIT) + * + * Copyright (c) 2022 Jeff Epler for Adafruit Industries + * + * Permission is hereby granted, free of charge, to any person obtaining a copy + * of this software and associated documentation files (the "Software"), to deal + * in the Software without restriction, including without limitation the rights + * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell + * copies of the Software, and to permit persons to whom the Software is + * furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice shall be included in + * all copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE + * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER + * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, + * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN + * THE SOFTWARE. + */ + +#pragma once + +void ssl_reset(void); diff --git a/ports/raspberrypi/common-hal/wifi/Monitor.c b/ports/raspberrypi/common-hal/wifi/Monitor.c new file mode 100644 index 0000000000..f288cd1ea1 --- /dev/null +++ b/ports/raspberrypi/common-hal/wifi/Monitor.c @@ -0,0 +1,74 @@ +/* + * This file is part of the MicroPython project, http://micropython.org/ + * + * The MIT License (MIT) + * + * Copyright (c) 2021 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 + +#include "py/mpstate.h" +#include "py/runtime.h" + +#include "shared-bindings/wifi/Monitor.h" +#include "shared-bindings/wifi/Packet.h" + + +#define MONITOR_PAYLOAD_FCS_LEN (4) +#define MONITOR_QUEUE_TIMEOUT_TICK (0) + +typedef struct { +} monitor_packet_t; + +void common_hal_wifi_monitor_construct(wifi_monitor_obj_t *self, uint8_t channel, size_t queue) { + mp_raise_NotImplementedError(translate("wifi.Monitor not available")); +} + +bool common_hal_wifi_monitor_deinited(void) { + return true; +} + +void common_hal_wifi_monitor_deinit(wifi_monitor_obj_t *self) { +} + +void common_hal_wifi_monitor_set_channel(wifi_monitor_obj_t *self, uint8_t channel) { +} + +mp_obj_t common_hal_wifi_monitor_get_channel(wifi_monitor_obj_t *self) { + return MP_OBJ_NEW_SMALL_INT(0); +} + +mp_obj_t common_hal_wifi_monitor_get_queue(wifi_monitor_obj_t *self) { + return mp_obj_new_int_from_uint(0); +} + +mp_obj_t common_hal_wifi_monitor_get_lost(wifi_monitor_obj_t *self) { + return mp_obj_new_int_from_uint(0); +} + +mp_obj_t common_hal_wifi_monitor_get_queued(wifi_monitor_obj_t *self) { + return mp_obj_new_int_from_uint(0); +} + +mp_obj_t common_hal_wifi_monitor_get_packet(wifi_monitor_obj_t *self) { + return mp_const_none; +} diff --git a/ports/raspberrypi/common-hal/wifi/Monitor.h b/ports/raspberrypi/common-hal/wifi/Monitor.h new file mode 100644 index 0000000000..14ee685bbd --- /dev/null +++ b/ports/raspberrypi/common-hal/wifi/Monitor.h @@ -0,0 +1,40 @@ +/* + * This file is part of the MicroPython project, http://micropython.org/ + * + * The MIT License (MIT) + * + * Copyright (c) 2021 microDev + * Copyright (c) 2022 Jeff Epler for Adafruit Industries + * + * Permission is hereby granted, free of charge, to any person obtaining a copy + * of this software and associated documentation files (the "Software"), to deal + * in the Software without restriction, including without limitation the rights + * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell + * copies of the Software, and to permit persons to whom the Software is + * furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice shall be included in + * all copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE + * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER + * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, + * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN + * THE SOFTWARE. + */ + +#ifndef MICROPY_INCLUDED_ESPRESSIF_COMMON_HAL_WIFI_MONITOR_H +#define MICROPY_INCLUDED_ESPRESSIF_COMMON_HAL_WIFI_MONITOR_H + +#include "py/obj.h" + +typedef struct { + mp_obj_base_t base; + uint8_t channel; + size_t lost; + size_t queue_length; +} wifi_monitor_obj_t; + +#endif // MICROPY_INCLUDED_ESPRESSIF_COMMON_HAL_WIFI_MONITOR_H diff --git a/ports/raspberrypi/common-hal/wifi/Network.c b/ports/raspberrypi/common-hal/wifi/Network.c new file mode 100644 index 0000000000..8db42e962c --- /dev/null +++ b/ports/raspberrypi/common-hal/wifi/Network.c @@ -0,0 +1,81 @@ +/* + * This file is part of the MicroPython project, http://micropython.org/ + * + * The MIT License (MIT) + * + * Copyright (c) 2020 Scott Shawcroft for Adafruit Industries + * + * Permission is hereby granted, free of charge, to any person obtaining a copy + * of this software and associated documentation files (the "Software"), to deal + * in the Software without restriction, including without limitation the rights + * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell + * copies of the Software, and to permit persons to whom the Software is + * furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice shall be included in + * all copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE + * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER + * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, + * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN + * THE SOFTWARE. + */ + +#include + +#include "shared-bindings/wifi/Network.h" +#include "shared-bindings/wifi/AuthMode.h" + +mp_obj_t common_hal_wifi_network_get_ssid(wifi_network_obj_t *self) { + const char *cstr = (const char *)self->record.ssid; + return mp_obj_new_str(cstr, self->record.ssid_len); +} + +#define MAC_ADDRESS_LENGTH 6 + +mp_obj_t common_hal_wifi_network_get_bssid(wifi_network_obj_t *self) { + return mp_obj_new_bytes(self->record.bssid, MAC_ADDRESS_LENGTH); +} + +mp_obj_t common_hal_wifi_network_get_rssi(wifi_network_obj_t *self) { + return mp_obj_new_int(self->record.rssi); +} + +mp_obj_t common_hal_wifi_network_get_channel(wifi_network_obj_t *self) { + return mp_obj_new_int(self->record.channel); +} + +mp_obj_t common_hal_wifi_network_get_country(wifi_network_obj_t *self) { + return (mp_obj_t)MP_QSTR_; +} + +mp_obj_t common_hal_wifi_network_get_authmode(wifi_network_obj_t *self) { + uint8_t authmode_mask = 0; + if (self->record.auth_mode == 0) { + authmode_mask = (1 << AUTHMODE_OPEN); + } + if (self->record.auth_mode & 1) { + authmode_mask |= (1 << AUTHMODE_PSK); + } + ; + if (self->record.auth_mode & 2) { + authmode_mask |= (1 << AUTHMODE_WPA); + } + ; + if (self->record.auth_mode & 4) { + authmode_mask |= (1 << AUTHMODE_WPA2); + } + ; + mp_obj_t authmode_list = mp_obj_new_list(0, NULL); + if (authmode_mask != 0) { + for (uint8_t i = 0; i < 8; i++) { + if ((authmode_mask >> i) & 1) { + mp_obj_list_append(authmode_list, cp_enum_find(&wifi_authmode_type, i)); + } + } + } + return authmode_list; +} diff --git a/ports/raspberrypi/common-hal/wifi/Network.h b/ports/raspberrypi/common-hal/wifi/Network.h new file mode 100644 index 0000000000..8e4e7bd310 --- /dev/null +++ b/ports/raspberrypi/common-hal/wifi/Network.h @@ -0,0 +1,36 @@ +/* + * This file is part of the MicroPython project, http://micropython.org/ + * + * The MIT License (MIT) + * + * Copyright (c) 2020 Scott Shawcroft for Adafruit Industries + * + * Permission is hereby granted, free of charge, to any person obtaining a copy + * of this software and associated documentation files (the "Software"), to deal + * in the Software without restriction, including without limitation the rights + * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell + * copies of the Software, and to permit persons to whom the Software is + * furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice shall be included in + * all copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE + * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER + * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, + * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN + * THE SOFTWARE. + */ + +#pragma once + +#include "py/obj.h" + +#include "pico/cyw43_arch.h" + +typedef struct { + mp_obj_base_t base; + cyw43_ev_scan_result_t record; +} wifi_network_obj_t; diff --git a/ports/raspberrypi/common-hal/wifi/Radio.c b/ports/raspberrypi/common-hal/wifi/Radio.c new file mode 100644 index 0000000000..a0654414de --- /dev/null +++ b/ports/raspberrypi/common-hal/wifi/Radio.c @@ -0,0 +1,339 @@ +/* + * This file is part of the MicroPython project, http://micropython.org/ + * + * The MIT License (MIT) + * + * Copyright (c) 2020 Scott Shawcroft for Adafruit Industries + * + * Permission is hereby granted, free of charge, to any person obtaining a copy + * of this software and associated documentation files (the "Software"), to deal + * in the Software without restriction, including without limitation the rights + * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell + * copies of the Software, and to permit persons to whom the Software is + * furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice shall be included in + * all copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE + * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER + * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, + * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN + * THE SOFTWARE. + */ + +#include "supervisor/port.h" +#include "shared-bindings/wifi/Radio.h" +#include "shared-bindings/wifi/Network.h" + +#include +#include + +#include "common-hal/wifi/__init__.h" +#include "shared/runtime/interrupt_char.h" +#include "py/gc.h" +#include "py/runtime.h" +#include "bindings/cyw43/__init__.h" +#include "shared-bindings/ipaddress/IPv4Address.h" +#include "shared-bindings/wifi/ScannedNetworks.h" +#include "shared-bindings/wifi/AuthMode.h" +#include "shared-bindings/time/__init__.h" +#include "shared-module/ipaddress/__init__.h" + +#if CIRCUITPY_MDNS +#include "components/mdns/include/mdns.h" +#endif + +#include "lwip/dns.h" +#include "lwip/icmp.h" +#include "lwip/raw.h" +#include "lwip_src/ping.h" + +#ifndef PING_ID +#define PING_ID 0xAFAF +#endif + +#define MAC_ADDRESS_LENGTH 6 + +#define NETIF_STA (&cyw43_state.netif[CYW43_ITF_STA]) +#define NETIF_AP (&cyw43_state.netif[CYW43_ITF_AP]) + +static inline uint32_t nw_get_le32(const uint8_t *buf) { + return buf[0] | buf[1] << 8 | buf[2] << 16 | buf[3] << 24; +} + +static inline void nw_put_le32(uint8_t *buf, uint32_t x) { + buf[0] = x; + buf[1] = x >> 8; + buf[2] = x >> 16; + buf[3] = x >> 24; +} + +NORETURN static void ro_attribute(int attr) { + mp_raise_msg_varg(&mp_type_AttributeError, MP_ERROR_TEXT("'%s' object has no attribute '%q'"), "Radio", attr); +} + +bool common_hal_wifi_radio_get_enabled(wifi_radio_obj_t *self) { + return true; +} + +void common_hal_wifi_radio_set_enabled(wifi_radio_obj_t *self, bool enabled) { + if (!enabled) { + ro_attribute(MP_QSTR_enabled); + } +} + +mp_obj_t common_hal_wifi_radio_get_hostname(wifi_radio_obj_t *self) { + if (!NETIF_STA->hostname) { + return mp_const_none; + } + return mp_obj_new_str(NETIF_STA->hostname, strlen(NETIF_STA->hostname)); +} + +void common_hal_wifi_radio_set_hostname(wifi_radio_obj_t *self, const char *hostname) { + assert(strlen(hostname) < MP_ARRAY_SIZE(self->hostname)); + memcpy(self->hostname, hostname, strlen(hostname)); + netif_set_hostname(NETIF_STA, self->hostname); + netif_set_hostname(NETIF_AP, self->hostname); +} + +mp_obj_t common_hal_wifi_radio_get_mac_address(wifi_radio_obj_t *self) { + return mp_obj_new_bytes(cyw43_state.mac, MAC_ADDRESS_LENGTH); +} + +void common_hal_wifi_radio_set_mac_address(wifi_radio_obj_t *self, const uint8_t *mac) { + ro_attribute(MP_QSTR_mac_address); +} + +mp_float_t common_hal_wifi_radio_get_tx_power(wifi_radio_obj_t *self) { + uint8_t buf[13]; + memcpy(buf, "qtxpower\x00\x00\x00\x00\x00", 13); + cyw43_ioctl(&cyw43_state, CYW43_IOCTL_GET_VAR, 13, buf, CYW43_ITF_STA); + return nw_get_le32(buf) * MICROPY_FLOAT_CONST(0.25); +} + +void common_hal_wifi_radio_set_tx_power(wifi_radio_obj_t *self, const mp_float_t tx_power) { + mp_int_t dbm_times_four = (int)(4 * tx_power); + uint8_t buf[9 + 4]; + memcpy(buf, "qtxpower\x00", 9); + nw_put_le32(buf + 9, dbm_times_four); + cyw43_ioctl(&cyw43_state, CYW43_IOCTL_SET_VAR, 9 + 4, buf, CYW43_ITF_STA); + cyw43_ioctl(&cyw43_state, CYW43_IOCTL_SET_VAR, 9 + 4, buf, CYW43_ITF_AP); +} + +mp_obj_t common_hal_wifi_radio_get_mac_address_ap(wifi_radio_obj_t *self) { + return common_hal_wifi_radio_get_mac_address(self); +} + +void common_hal_wifi_radio_set_mac_address_ap(wifi_radio_obj_t *self, const uint8_t *mac) { + ro_attribute(MP_QSTR_mac_address_ap); +} + +mp_obj_t common_hal_wifi_radio_start_scanning_networks(wifi_radio_obj_t *self, uint8_t start_channel, uint8_t stop_channel) { + // channel bounds are ignored; not implemented in driver + if (self->current_scan) { + mp_raise_RuntimeError(translate("Already scanning for wifi networks")); + } + if (!common_hal_wifi_radio_get_enabled(self)) { + mp_raise_RuntimeError(translate("wifi is not enabled")); + } + wifi_scannednetworks_obj_t *scan = m_new_obj(wifi_scannednetworks_obj_t); + scan->base.type = &wifi_scannednetworks_type; + mp_obj_t args[] = { mp_const_empty_tuple, MP_OBJ_NEW_SMALL_INT(16) }; + scan->results = mp_type_deque.make_new(&mp_type_deque, 2, 0, args); + self->current_scan = scan; + wifi_scannednetworks_start_scan(scan); + return scan; +} + +void common_hal_wifi_radio_stop_scanning_networks(wifi_radio_obj_t *self) { + self->current_scan = NULL; +} + +void common_hal_wifi_radio_start_station(wifi_radio_obj_t *self) { + cyw43_arch_enable_sta_mode(); + bindings_cyw43_wifi_enforce_pm(); +} + +void common_hal_wifi_radio_stop_station(wifi_radio_obj_t *self) { +} + +void common_hal_wifi_radio_start_ap(wifi_radio_obj_t *self, uint8_t *ssid, size_t ssid_len, uint8_t *password, size_t password_len, uint8_t channel, uint8_t authmode, uint8_t max_connections) { + mp_raise_NotImplementedError(NULL); + bindings_cyw43_wifi_enforce_pm(); +} + +void common_hal_wifi_radio_stop_ap(wifi_radio_obj_t *self) { + mp_raise_NotImplementedError(NULL); +} + +wifi_radio_error_t common_hal_wifi_radio_connect(wifi_radio_obj_t *self, uint8_t *ssid, size_t ssid_len, uint8_t *password, size_t password_len, uint8_t channel, mp_float_t timeout, uint8_t *bssid, size_t bssid_len) { + if (!common_hal_wifi_radio_get_enabled(self)) { + mp_raise_RuntimeError(translate("wifi is not enabled")); + } + unsigned timeout_ms = timeout <= 0 ? 8000 : (unsigned)MAX(0, MICROPY_FLOAT_C_FUN(ceil)(timeout * 1000)); + // TODO use connect_async so we can service bg tasks & check for ctrl-c during + // connect + int result = cyw43_arch_wifi_connect_timeout_ms((const char *)ssid, (const char *)password, CYW43_AUTH_WPA2_AES_PSK, timeout_ms); + bindings_cyw43_wifi_enforce_pm(); + switch (result) { + case 0: + return WIFI_RADIO_ERROR_NONE; + // case CYW43_LINK_DOWN: + // case CYW43_LINK_JOIN: + // case CYW43_LINK_NOIP: + // case CYW43_LINK_UP: + case CYW43_LINK_FAIL: + return WIFI_RADIO_ERROR_CONNECTION_FAIL; + case CYW43_LINK_NONET: + return WIFI_RADIO_ERROR_NO_AP_FOUND; + case CYW43_LINK_BADAUTH: + return WIFI_RADIO_ERROR_AUTH_FAIL; + + default: + return WIFI_RADIO_ERROR_UNSPECIFIED; + } +} + +mp_obj_t common_hal_wifi_radio_get_ap_info(wifi_radio_obj_t *self) { + mp_raise_NotImplementedError(NULL); +} + +mp_obj_t common_hal_wifi_radio_get_ipv4_gateway(wifi_radio_obj_t *self) { + if (!netif_is_up(NETIF_STA)) { + return mp_const_none; + } + return common_hal_ipaddress_new_ipv4address(NETIF_STA->gw.addr); +} + +mp_obj_t common_hal_wifi_radio_get_ipv4_gateway_ap(wifi_radio_obj_t *self) { + if (!netif_is_up(NETIF_AP)) { + return mp_const_none; + } + return common_hal_ipaddress_new_ipv4address(NETIF_AP->gw.addr); +} + +mp_obj_t common_hal_wifi_radio_get_ipv4_subnet(wifi_radio_obj_t *self) { + if (!netif_is_up(NETIF_STA)) { + return mp_const_none; + } + return common_hal_ipaddress_new_ipv4address(NETIF_STA->netmask.addr); +} + +mp_obj_t common_hal_wifi_radio_get_ipv4_subnet_ap(wifi_radio_obj_t *self) { + if (!netif_is_up(NETIF_AP)) { + return mp_const_none; + } + return common_hal_ipaddress_new_ipv4address(NETIF_AP->netmask.addr); +} + +mp_obj_t common_hal_wifi_radio_get_ipv4_address(wifi_radio_obj_t *self) { + if (!netif_is_up(NETIF_STA)) { + return mp_const_none; + } + return common_hal_ipaddress_new_ipv4address(NETIF_STA->ip_addr.addr); +} + +mp_obj_t common_hal_wifi_radio_get_ipv4_address_ap(wifi_radio_obj_t *self) { + if (!netif_is_up(NETIF_AP)) { + return mp_const_none; + } + return common_hal_ipaddress_new_ipv4address(NETIF_AP->ip_addr.addr); +} + +mp_obj_t common_hal_wifi_radio_get_ipv4_dns(wifi_radio_obj_t *self) { + uint32_t addr = dns_getserver(0)->addr; + if (!netif_is_up(NETIF_STA) || addr == 0) { + return mp_const_none; + } + return common_hal_ipaddress_new_ipv4address(addr); +} + +void common_hal_wifi_radio_set_ipv4_dns(wifi_radio_obj_t *self, mp_obj_t ipv4_dns_addr) { + mp_raise_NotImplementedError(NULL); +} + +void common_hal_wifi_radio_start_dhcp_client(wifi_radio_obj_t *self) { + mp_raise_NotImplementedError(NULL); +} + +void common_hal_wifi_radio_stop_dhcp_client(wifi_radio_obj_t *self) { + mp_raise_NotImplementedError(NULL); +} + +void common_hal_wifi_radio_set_ipv4_address(wifi_radio_obj_t *self, mp_obj_t ipv4, mp_obj_t netmask, mp_obj_t gateway, mp_obj_t ipv4_dns) { + mp_raise_NotImplementedError(NULL); +} + +volatile bool ping_received; + +static u8_t +ping_recv(void *arg, struct raw_pcb *pcb, struct pbuf *p, const ip_addr_t *addr) { + struct icmp_echo_hdr *iecho; + LWIP_ASSERT("p != NULL", p != NULL); + + if ((p->tot_len >= (PBUF_IP_HLEN + sizeof(struct icmp_echo_hdr))) && + pbuf_remove_header(p, PBUF_IP_HLEN) == 0) { + iecho = (struct icmp_echo_hdr *)p->payload; + + if ((iecho->id == PING_ID) && (iecho->seqno == lwip_htons(ping_seq_num))) { + LWIP_DEBUGF(PING_DEBUG, ("ping: recv ")); + ip_addr_debug_print(PING_DEBUG, addr); + LWIP_DEBUGF(PING_DEBUG, (" %"U32_F " ms\n", (sys_now() - ping_time))); + + /* do some ping result processing */ + ping_received = true; + pbuf_free(p); + return 1; /* eat the packet */ + } + /* not eaten, restore original packet */ + pbuf_add_header(p, PBUF_IP_HLEN); + } + return 0; /* don't eat the packet */ +} + +mp_int_t common_hal_wifi_radio_ping(wifi_radio_obj_t *self, mp_obj_t ip_address, mp_float_t timeout) { + ip_addr_t ping_addr; + ipaddress_ipaddress_to_lwip(ip_address, &ping_addr); + + struct raw_pcb *ping_pcb; + MICROPY_PY_LWIP_ENTER + ping_pcb = raw_new(IP_PROTO_ICMP); + if (!ping_pcb) { + MICROPY_PY_LWIP_EXIT + return -1; + } + raw_recv(ping_pcb, ping_recv, NULL); + raw_bind(ping_pcb, IP_ADDR_ANY); + MICROPY_PY_LWIP_EXIT + + ping_received = false; + ping_send(ping_pcb, &ping_addr); + size_t timeout_ms = (size_t)MICROPY_FLOAT_C_FUN(ceil)(timeout * 1000); + uint64_t start = port_get_raw_ticks(NULL); + uint64_t deadline = start + timeout_ms; + while (port_get_raw_ticks(NULL) < deadline && !ping_received) { + RUN_BACKGROUND_TASKS; + if (mp_hal_is_interrupted()) { + break; + } + } + mp_int_t result = -1; + if (ping_received) { + uint64_t now = port_get_raw_ticks(NULL); + result = now - start; + } + + MICROPY_PY_LWIP_ENTER; + raw_remove(ping_pcb); + MICROPY_PY_LWIP_EXIT; + + return result; +} + +void common_hal_wifi_radio_gc_collect(wifi_radio_obj_t *self) { + // Only bother to scan the actual object references. + gc_collect_ptr(self->current_scan); +} diff --git a/ports/raspberrypi/common-hal/wifi/Radio.h b/ports/raspberrypi/common-hal/wifi/Radio.h new file mode 100644 index 0000000000..0dc18c8957 --- /dev/null +++ b/ports/raspberrypi/common-hal/wifi/Radio.h @@ -0,0 +1,40 @@ +/* + * This file is part of the MicroPython project, http://micropython.org/ + * + * The MIT License (MIT) + * + * Copyright (c) 2022 Jeff Epler for Adafruit Industries + * + * Permission is hereby granted, free of charge, to any person obtaining a copy + * of this software and associated documentation files (the "Software"), to deal + * in the Software without restriction, including without limitation the rights + * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell + * copies of the Software, and to permit persons to whom the Software is + * furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice shall be included in + * all copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE + * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER + * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, + * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN + * THE SOFTWARE. + */ + +#pragma once + +#include "py/obj.h" + +#include "shared-bindings/wifi/ScannedNetworks.h" +#include "shared-bindings/wifi/Network.h" + +typedef struct { + mp_obj_base_t base; + char hostname[254]; // hostname max is 253 chars, + 1 for trailing NUL + wifi_scannednetworks_obj_t *current_scan; +} wifi_radio_obj_t; + +extern void common_hal_wifi_radio_gc_collect(wifi_radio_obj_t *self); diff --git a/ports/raspberrypi/common-hal/wifi/ScannedNetworks.c b/ports/raspberrypi/common-hal/wifi/ScannedNetworks.c new file mode 100644 index 0000000000..97299e2f74 --- /dev/null +++ b/ports/raspberrypi/common-hal/wifi/ScannedNetworks.c @@ -0,0 +1,115 @@ +/* + * This file is part of the MicroPython project, http://micropython.org/ + * + * The MIT License (MIT) + * + * Copyright (c) 2019 Dan Halbert for Adafruit Industries + * Copyright (c) 2018 Artur Pacholec + * Copyright (c) 2017 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 + +#include "shared/runtime/interrupt_char.h" +#include "py/gc.h" +#include "py/objstr.h" +#include "py/runtime.h" +#include "common-hal/wifi/__init__.h" +#include "shared-bindings/wifi/__init__.h" +#include "shared-bindings/wifi/Network.h" +#include "shared-bindings/wifi/Radio.h" +#include "shared-bindings/wifi/ScannedNetworks.h" + +#define NUM_SCAN (16) +static cyw43_ev_scan_result_t scan_results[NUM_SCAN]; +static uint8_t scan_put, scan_get; +static bool scan_full; + + +static void scan_result_put(const cyw43_ev_scan_result_t *result) { + if (!scan_full) { + scan_results[scan_put] = *result; + scan_put = (scan_put + 1) % NUM_SCAN; + scan_full = (scan_put == scan_get); + } +} + +static bool scan_result_available(void) { + return scan_full || (scan_get != scan_put); +} + +static cyw43_ev_scan_result_t *scan_result_get(cyw43_ev_scan_result_t *result) { + if (!scan_result_available()) { + return NULL; + } + + *result = scan_results[scan_get]; + scan_get = (scan_get + 1) % NUM_SCAN; + scan_full = false; + return result; +} + +// Note: It's not OK to allocate memory in here, we can be called at a bad time +// which messes up the gc allocator +static int scan_result(void *env, const cyw43_ev_scan_result_t *result) { + wifi_scannednetworks_obj_t *self = common_hal_wifi_radio_obj.current_scan; + // scan ended or something + if (!self) { + return 0; + } + + scan_result_put(result); + + return 0; +} + +mp_obj_t common_hal_wifi_scannednetworks_next(wifi_scannednetworks_obj_t *self) { + // no results available, wait for some + while (!scan_result_available() && cyw43_wifi_scan_active(&cyw43_state)) { + RUN_BACKGROUND_TASKS; + if (mp_hal_is_interrupted()) { + return mp_const_none; + } + cyw43_arch_poll(); + } + + if (!scan_result_available()) { + common_hal_wifi_radio_obj.current_scan = NULL; + return mp_const_none; + } + + + wifi_network_obj_t *entry = m_new_obj(wifi_network_obj_t); + entry->base.type = &wifi_network_type; + scan_result_get(&entry->record); + + return MP_OBJ_FROM_PTR(entry); +} + +void wifi_scannednetworks_deinit(wifi_scannednetworks_obj_t *self) { + // there's actually no way to stop an ongoing scan in cyw43! + common_hal_wifi_radio_obj.current_scan = NULL; +} + +void wifi_scannednetworks_start_scan(wifi_scannednetworks_obj_t *self) { + cyw43_wifi_scan_options_t scan_options = {0}; + CHECK_CYW_RESULT(cyw43_wifi_scan(&cyw43_state, &scan_options, NULL, scan_result)); +} diff --git a/ports/raspberrypi/common-hal/wifi/ScannedNetworks.h b/ports/raspberrypi/common-hal/wifi/ScannedNetworks.h new file mode 100644 index 0000000000..eae783ca4e --- /dev/null +++ b/ports/raspberrypi/common-hal/wifi/ScannedNetworks.h @@ -0,0 +1,42 @@ +/* + * This file is part of the MicroPython project, http://micropython.org/ + * + * The MIT License (MIT) + * + * Copyright (c) 2019 Dan Halbert for Adafruit Industries + * Copyright (c) 2018 Artur Pacholec + * + * 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. + */ + +#pragma once + +#include + +#include "py/obj.h" +#include "cyw43.h" + +typedef struct { + mp_obj_base_t base; + mp_obj_t results; + bool done; +} wifi_scannednetworks_obj_t; + +void wifi_scannednetworks_deinit(wifi_scannednetworks_obj_t *self); +void wifi_scannednetworks_start_scan(wifi_scannednetworks_obj_t *self); diff --git a/ports/raspberrypi/common-hal/wifi/__init__.c b/ports/raspberrypi/common-hal/wifi/__init__.c new file mode 100644 index 0000000000..e5a646f88f --- /dev/null +++ b/ports/raspberrypi/common-hal/wifi/__init__.c @@ -0,0 +1,124 @@ +/* + * This file is part of the MicroPython project, http://micropython.org/ + * + * The MIT License (MIT) + * + * Copyright (c) 2020 Scott Shawcroft for Adafruit Industries + * + * Permission is hereby granted, free of charge, to any person obtaining a copy + * of this software and associated documentation files (the "Software"), to deal + * in the Software without restriction, including without limitation the rights + * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell + * copies of the Software, and to permit persons to whom the Software is + * furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice shall be included in + * all copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE + * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER + * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, + * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN + * THE SOFTWARE. + */ + +#include "common-hal/wifi/__init__.h" +#include "shared-bindings/wifi/__init__.h" + +#include "shared-bindings/ipaddress/IPv4Address.h" +#include "shared-bindings/wifi/Monitor.h" +#include "shared-bindings/wifi/Radio.h" + +#include "py/mperrno.h" +#include "py/mpstate.h" +#include "py/runtime.h" + +wifi_radio_obj_t common_hal_wifi_radio_obj; + +#include "supervisor/port.h" +#include "supervisor/shared/status_bar.h" +#include "supervisor/workflow.h" + +static bool wifi_inited; +static bool wifi_ever_inited; +static bool wifi_user_initiated; + +void common_hal_wifi_init(bool user_initiated) { + wifi_radio_obj_t *self = &common_hal_wifi_radio_obj; + + if (wifi_inited) { + if (user_initiated && !wifi_user_initiated) { + common_hal_wifi_radio_set_enabled(self, true); + } + return; + } + wifi_inited = true; + wifi_user_initiated = user_initiated; + common_hal_wifi_radio_obj.base.type = &wifi_radio_type; + common_hal_wifi_radio_obj.current_scan = NULL; + + if (!wifi_ever_inited) { + } + wifi_ever_inited = true; + + // set station mode to avoid the default SoftAP + common_hal_wifi_radio_start_station(self); + // start wifi + common_hal_wifi_radio_set_enabled(self, true); +} + +void wifi_user_reset(void) { + if (wifi_user_initiated) { + // wifi_reset(); + wifi_user_initiated = false; + } +} + +void wifi_reset(void) { + if (!wifi_inited) { + return; + } + // the cyw43 wifi chip is not reset due to https://github.com/raspberrypi/pico-sdk/issues/980 + common_hal_wifi_monitor_deinit(MP_STATE_VM(wifi_monitor_singleton)); + common_hal_wifi_radio_obj.current_scan = NULL; + // common_hal_wifi_radio_set_enabled(radio, false); + supervisor_workflow_request_background(); +} + +void common_hal_wifi_gc_collect(void) { + common_hal_wifi_radio_gc_collect(&common_hal_wifi_radio_obj); +} + +void raise_cyw_error(int err) { + int mp_errno; + switch (err) { + case -CYW43_EIO: + mp_errno = MP_EIO; + break; + case -CYW43_EPERM: + mp_errno = MP_EPERM; + break; + case -CYW43_EINVAL: + mp_errno = MP_EINVAL; + break; + case -CYW43_ETIMEDOUT: + mp_errno = MP_ETIMEDOUT; + break; + default: + mp_raise_OSError_msg_varg(translate("Unkown error code %d"), err); + } + mp_raise_OSError(mp_errno); +} + +void ipaddress_ipaddress_to_lwip(mp_obj_t ip_address, ip_addr_t *lwip_ip_address) { + if (!mp_obj_is_type(ip_address, &ipaddress_ipv4address_type)) { + mp_raise_ValueError(translate("Only IPv4 addresses supported")); + } + mp_obj_t packed = common_hal_ipaddress_ipv4address_get_packed(ip_address); + size_t len; + const char *bytes = mp_obj_str_get_data(packed, &len); + + IP_ADDR4(lwip_ip_address, bytes[0], bytes[1], bytes[2], bytes[3]); +} diff --git a/shared-module/multiterminal/__init__.h b/ports/raspberrypi/common-hal/wifi/__init__.h similarity index 74% rename from shared-module/multiterminal/__init__.h rename to ports/raspberrypi/common-hal/wifi/__init__.h index 30044da065..d34d631089 100644 --- a/shared-module/multiterminal/__init__.h +++ b/ports/raspberrypi/common-hal/wifi/__init__.h @@ -3,7 +3,7 @@ * * The MIT License (MIT) * - * Copyright (c) 2017 Scott Shawcroft for Adafruit Industries + * Copyright (c) 2022 Jeff Epler for Adafruit Industries * * Permission is hereby granted, free of charge, to any person obtaining a copy * of this software and associated documentation files (the "Software"), to deal @@ -24,11 +24,14 @@ * THE SOFTWARE. */ -#ifndef SHARED_MODULE_MULTITERMINAL___INIT___H -#define SHARED_MODULE_MULTITERMINAL___INIT___H +#pragma once -mp_obj_t shared_module_multiterminal_get_secondary_terminal(); -void shared_module_multiterminal_set_secondary_terminal(mp_obj_t secondary_terminal); -void shared_module_multiterminal_clear_secondary_terminal(); +#include "py/obj.h" +#include "py/mpconfig.h" +#include "lwip/ip_addr.h" -#endif // SHARED_MODULE_MULTITERMINAL___INIT___H +void wifi_reset(void); +NORETURN void raise_cyw_error(int err); +#define CHECK_CYW_RESULT(x) do { int res = (x); if (res != 0) raise_cyw_error(res); } while (0) + +void ipaddress_ipaddress_to_lwip(mp_obj_t ip_address, ip_addr_t *lwip_ip_address); diff --git a/ports/raspberrypi/lib/cyw43-driver b/ports/raspberrypi/lib/cyw43-driver new file mode 160000 index 0000000000..195dfcc10b --- /dev/null +++ b/ports/raspberrypi/lib/cyw43-driver @@ -0,0 +1 @@ +Subproject commit 195dfcc10bb6f379e3dea45147590db2203d3c7b diff --git a/ports/raspberrypi/lib/lwip b/ports/raspberrypi/lib/lwip new file mode 160000 index 0000000000..239918ccc1 --- /dev/null +++ b/ports/raspberrypi/lib/lwip @@ -0,0 +1 @@ +Subproject commit 239918ccc173cb2c2a62f41a40fd893f57faf1d6 diff --git a/ports/raspberrypi/link.ld b/ports/raspberrypi/link.ld index c9480f84db..982c5e3a0c 100644 --- a/ports/raspberrypi/link.ld +++ b/ports/raspberrypi/link.ld @@ -24,6 +24,7 @@ MEMORY { FLASH_FIRMWARE (rx) : ORIGIN = 0x10000000, LENGTH = 1020k + /* Followed by: 4kB of NVRAM and at least 1024kB of CIRCUITPY */ RAM (rwx) : ORIGIN = 0x20000000, LENGTH = 256k SCRATCH_X (rwx) : ORIGIN = 0x20040000, LENGTH = 4k SCRATCH_Y (rwx) : ORIGIN = 0x20041000, LENGTH = 4k diff --git a/ports/raspberrypi/lwip_inc/arch/sys_arch.h b/ports/raspberrypi/lwip_inc/arch/sys_arch.h new file mode 100644 index 0000000000..8b1a393741 --- /dev/null +++ b/ports/raspberrypi/lwip_inc/arch/sys_arch.h @@ -0,0 +1 @@ +// empty diff --git a/ports/raspberrypi/lwip_inc/lwipopts.h b/ports/raspberrypi/lwip_inc/lwipopts.h new file mode 100644 index 0000000000..ac4dd1564b --- /dev/null +++ b/ports/raspberrypi/lwip_inc/lwipopts.h @@ -0,0 +1,94 @@ +#ifndef _LWIPOPTS_EXAMPLE_COMMONH_H +#define _LWIPOPTS_EXAMPLE_COMMONH_H + + +// Common settings used in most of the pico_w examples +// (see https://www.nongnu.org/lwip/2_1_x/group__lwip__opts.html for details) + +// allow override in some examples +#ifndef NO_SYS +#define NO_SYS 1 +#endif +// allow override in some examples +#ifndef LWIP_SOCKET +#define LWIP_SOCKET 0 +#endif +#if PICO_CYW43_ARCH_POLL +#define MEM_LIBC_MALLOC 1 +#else +// MEM_LIBC_MALLOC is incompatible with non polling versions +#define MEM_LIBC_MALLOC 0 +#endif +#define MEM_ALIGNMENT 4 +#define MEM_SIZE 4000 +#define MEMP_NUM_TCP_SEG 32 +#define MEMP_NUM_ARP_QUEUE 10 +#define PBUF_POOL_SIZE 24 +#define LWIP_ARP 1 +#define LWIP_ETHERNET 1 +#define LWIP_ICMP 1 +#define LWIP_RAW 1 +#define TCP_WND (8 * TCP_MSS) +#define TCP_MSS 1460 +#define TCP_SND_BUF (8 * TCP_MSS) +#define TCP_SND_QUEUELEN ((4 * (TCP_SND_BUF) + (TCP_MSS - 1)) / (TCP_MSS)) +#define LWIP_NETIF_STATUS_CALLBACK 1 +#define LWIP_NETIF_LINK_CALLBACK 1 +#define LWIP_NETIF_HOSTNAME 1 +#define LWIP_NETCONN 0 +#define MEM_STATS 0 +#define SYS_STATS 0 +#define MEMP_STATS 0 +#define LINK_STATS 0 +// #define ETH_PAD_SIZE 2 +#define LWIP_CHKSUM_ALGORITHM 3 +#define LWIP_DHCP 1 +#define LWIP_IPV4 1 +#define LWIP_TCP 1 +#define LWIP_UDP 1 +#define LWIP_DNS 1 +#define LWIP_TCP_KEEPALIVE 1 +#define LWIP_NETIF_TX_SINGLE_PBUF 1 +#define DHCP_DOES_ARP_CHECK 0 +#define LWIP_DHCP_DOES_ACD_CHECK 0 + +#ifndef NDEBUG +#define LWIP_DEBUG 1 +#define LWIP_STATS 1 +#define LWIP_STATS_DISPLAY 1 +#endif + +#define ETHARP_DEBUG LWIP_DBG_OFF +#define NETIF_DEBUG LWIP_DBG_OFF +#define PBUF_DEBUG LWIP_DBG_OFF +#define API_LIB_DEBUG LWIP_DBG_OFF +#define API_MSG_DEBUG LWIP_DBG_OFF +#define SOCKETS_DEBUG LWIP_DBG_OFF +#define ICMP_DEBUG LWIP_DBG_OFF +#define INET_DEBUG LWIP_DBG_OFF +#define IP_DEBUG LWIP_DBG_OFF +#define IP_REASS_DEBUG LWIP_DBG_OFF +#define RAW_DEBUG LWIP_DBG_OFF +#define MEM_DEBUG LWIP_DBG_OFF +#define MEMP_DEBUG LWIP_DBG_OFF +#define SYS_DEBUG LWIP_DBG_OFF +#define TCP_DEBUG LWIP_DBG_OFF +#define TCP_INPUT_DEBUG LWIP_DBG_OFF +#define TCP_OUTPUT_DEBUG LWIP_DBG_OFF +#define TCP_RTO_DEBUG LWIP_DBG_OFF +#define TCP_CWND_DEBUG LWIP_DBG_OFF +#define TCP_WND_DEBUG LWIP_DBG_OFF +#define TCP_FR_DEBUG LWIP_DBG_OFF +#define TCP_QLEN_DEBUG LWIP_DBG_OFF +#define TCP_RST_DEBUG LWIP_DBG_OFF +#define UDP_DEBUG LWIP_DBG_OFF +#define TCPIP_DEBUG LWIP_DBG_OFF +#define PPP_DEBUG LWIP_DBG_OFF +#define SLIP_DEBUG LWIP_DBG_OFF +#define DHCP_DEBUG LWIP_DBG_OFF + +#define LWIP_TIMEVAL_PRIVATE 0 + +#define LWIP_NO_CTYPE_H 1 + +#endif /* __LWIPOPTS_H__ */ diff --git a/ports/raspberrypi/lwip_src/ping.c b/ports/raspberrypi/lwip_src/ping.c new file mode 100644 index 0000000000..e59b4d6662 --- /dev/null +++ b/ports/raspberrypi/lwip_src/ping.c @@ -0,0 +1,384 @@ +/** + * @file + * Ping sender module + * + */ + +/* + * Redistribution and use in source and binary forms, with or without modification, + * are permitted provided that the following conditions are met: + * + * 1. Redistributions of source code must retain the above copyright notice, + * this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright notice, + * this list of conditions and the following disclaimer in the documentation + * and/or other materials provided with the distribution. + * 3. The name of the author may not be used to endorse or promote products + * derived from this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR IMPLIED + * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF + * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT + * SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, + * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT + * OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS + * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN + * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING + * IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY + * OF SUCH DAMAGE. + * + * This file is part of the lwIP TCP/IP stack. + * + */ + +/** + * This is an example of a "ping" sender (with raw API and socket API). + * It can be used as a start point to maintain opened a network connection, or + * like a network "watchdog" for your device. + * + */ + +#include "lwip/opt.h" + +#if LWIP_RAW /* don't build if not configured for use in lwipopts.h */ + +#include "ping.h" + +#include "lwip/mem.h" +#include "lwip/raw.h" +#include "lwip/icmp.h" +#include "lwip/netif.h" +#include "lwip/sys.h" +#include "lwip/timeouts.h" +#include "lwip/inet_chksum.h" +#include "lwip/prot/ip4.h" + +#if PING_USE_SOCKETS +#include "lwip/sockets.h" +#include "lwip/inet.h" +#include +#endif /* PING_USE_SOCKETS */ + + +/** + * PING_DEBUG: Enable debugging for PING. + */ +#ifndef PING_DEBUG +#define PING_DEBUG LWIP_DBG_ON +#endif + +/** ping receive timeout - in milliseconds */ +#ifndef PING_RCV_TIMEO +#define PING_RCV_TIMEO 1000 +#endif + +/** ping delay - in milliseconds */ +#ifndef PING_DELAY +#define PING_DELAY 1000 +#endif + +/** ping identifier - must fit on a u16_t */ +#ifndef PING_ID +#define PING_ID 0xAFAF +#endif + +/** ping additional data size to include in the packet */ +#ifndef PING_DATA_SIZE +#define PING_DATA_SIZE 32 +#endif + +/** ping result action - no default action */ +#ifndef PING_RESULT +#define PING_RESULT(ping_ok) +#endif + +/* ping variables */ +static const ip_addr_t *ping_target; +u16_t ping_seq_num; +#ifdef LWIP_DEBUG +static u32_t ping_time; +#endif /* LWIP_DEBUG */ +#if !PING_USE_SOCKETS +static struct raw_pcb *ping_pcb; +#endif /* PING_USE_SOCKETS */ + +/** Prepare a echo ICMP request */ +void +ping_prepare_echo(struct icmp_echo_hdr *iecho, u16_t len) { + size_t i; + size_t data_len = len - sizeof(struct icmp_echo_hdr); + + ICMPH_TYPE_SET(iecho, ICMP_ECHO); + ICMPH_CODE_SET(iecho, 0); + iecho->chksum = 0; + iecho->id = PING_ID; + iecho->seqno = lwip_htons(++ping_seq_num); + + /* fill the additional data buffer with some data */ + for (i = 0; i < data_len; i++) { + ((char *)iecho)[sizeof(struct icmp_echo_hdr) + i] = (char)i; + } + + iecho->chksum = inet_chksum(iecho, len); +} + +#if PING_USE_SOCKETS + +/* Ping using the socket ip */ +err_t +ping_send(int s, const ip_addr_t *addr) { + int err; + struct icmp_echo_hdr *iecho; + struct sockaddr_storage to; + size_t ping_size = sizeof(struct icmp_echo_hdr) + PING_DATA_SIZE; + LWIP_ASSERT("ping_size is too big", ping_size <= 0xffff); + + #if LWIP_IPV6 + if (IP_IS_V6(addr) && !ip6_addr_isipv4mappedipv6(ip_2_ip6(addr))) { + /* todo: support ICMP6 echo */ + return ERR_VAL; + } + #endif /* LWIP_IPV6 */ + + iecho = (struct icmp_echo_hdr *)mem_malloc((mem_size_t)ping_size); + if (!iecho) { + return ERR_MEM; + } + + ping_prepare_echo(iecho, (u16_t)ping_size); + + #if LWIP_IPV4 + if (IP_IS_V4(addr)) { + struct sockaddr_in *to4 = (struct sockaddr_in *)&to; + to4->sin_len = sizeof(*to4); + to4->sin_family = AF_INET; + inet_addr_from_ip4addr(&to4->sin_addr, ip_2_ip4(addr)); + } + #endif /* LWIP_IPV4 */ + + #if LWIP_IPV6 + if (IP_IS_V6(addr)) { + struct sockaddr_in6 *to6 = (struct sockaddr_in6 *)&to; + to6->sin6_len = sizeof(*to6); + to6->sin6_family = AF_INET6; + inet6_addr_from_ip6addr(&to6->sin6_addr, ip_2_ip6(addr)); + } + #endif /* LWIP_IPV6 */ + + err = lwip_sendto(s, iecho, ping_size, 0, (struct sockaddr *)&to, sizeof(to)); + + mem_free(iecho); + + return err ? ERR_OK : ERR_VAL; +} + +static void +ping_recv(int s) { + char buf[64]; + int len; + struct sockaddr_storage from; + int fromlen = sizeof(from); + + while ((len = lwip_recvfrom(s, buf, sizeof(buf), 0, (struct sockaddr *)&from, (socklen_t *)&fromlen)) > 0) { + if (len >= (int)(sizeof(struct ip_hdr) + sizeof(struct icmp_echo_hdr))) { + ip_addr_t fromaddr; + memset(&fromaddr, 0, sizeof(fromaddr)); + + #if LWIP_IPV4 + if (from.ss_family == AF_INET) { + struct sockaddr_in *from4 = (struct sockaddr_in *)&from; + inet_addr_to_ip4addr(ip_2_ip4(&fromaddr), &from4->sin_addr); + IP_SET_TYPE_VAL(fromaddr, IPADDR_TYPE_V4); + } + #endif /* LWIP_IPV4 */ + + #if LWIP_IPV6 + if (from.ss_family == AF_INET6) { + struct sockaddr_in6 *from6 = (struct sockaddr_in6 *)&from; + inet6_addr_to_ip6addr(ip_2_ip6(&fromaddr), &from6->sin6_addr); + IP_SET_TYPE_VAL(fromaddr, IPADDR_TYPE_V6); + } + #endif /* LWIP_IPV6 */ + + LWIP_DEBUGF(PING_DEBUG, ("ping: recv ")); + ip_addr_debug_print_val(PING_DEBUG, fromaddr); + LWIP_DEBUGF(PING_DEBUG, (" %"U32_F " ms\n", (sys_now() - ping_time))); + + /* todo: support ICMP6 echo */ + #if LWIP_IPV4 + if (IP_IS_V4_VAL(fromaddr)) { + struct ip_hdr *iphdr; + struct icmp_echo_hdr *iecho; + + iphdr = (struct ip_hdr *)buf; + iecho = (struct icmp_echo_hdr *)(buf + (IPH_HL(iphdr) * 4)); + if ((iecho->id == PING_ID) && (iecho->seqno == lwip_htons(ping_seq_num))) { + /* do some ping result processing */ + PING_RESULT((ICMPH_TYPE(iecho) == ICMP_ER)); + return; + } else { + LWIP_DEBUGF(PING_DEBUG, ("ping: drop\n")); + } + } + #endif /* LWIP_IPV4 */ + } + fromlen = sizeof(from); + } + + if (len == 0) { + LWIP_DEBUGF(PING_DEBUG, ("ping: recv - %"U32_F " ms - timeout\n", (sys_now() - ping_time))); + } + + /* do some ping result processing */ + PING_RESULT(0); +} + +static void +ping_thread(void *arg) { + int s; + int ret; + + #if LWIP_SO_SNDRCVTIMEO_NONSTANDARD + int timeout = PING_RCV_TIMEO; + #else + struct timeval timeout; + timeout.tv_sec = PING_RCV_TIMEO / 1000; + timeout.tv_usec = (PING_RCV_TIMEO % 1000) * 1000; + #endif + LWIP_UNUSED_ARG(arg); + + #if LWIP_IPV6 + if (IP_IS_V4(ping_target) || ip6_addr_isipv4mappedipv6(ip_2_ip6(ping_target))) { + s = lwip_socket(AF_INET6, SOCK_RAW, IP_PROTO_ICMP); + } else { + s = lwip_socket(AF_INET6, SOCK_RAW, IP6_NEXTH_ICMP6); + } + #else + s = lwip_socket(AF_INET, SOCK_RAW, IP_PROTO_ICMP); + #endif + if (s < 0) { + return; + } + + ret = lwip_setsockopt(s, SOL_SOCKET, SO_RCVTIMEO, &timeout, sizeof(timeout)); + LWIP_ASSERT("setting receive timeout failed", ret == 0); + LWIP_UNUSED_ARG(ret); + + while (1) { + if (ping_send(s, ping_target) == ERR_OK) { + LWIP_DEBUGF(PING_DEBUG, ("ping: send ")); + ip_addr_debug_print(PING_DEBUG, ping_target); + LWIP_DEBUGF(PING_DEBUG, ("\n")); + + #ifdef LWIP_DEBUG + ping_time = sys_now(); + #endif /* LWIP_DEBUG */ + ping_recv(s); + } else { + LWIP_DEBUGF(PING_DEBUG, ("ping: send ")); + ip_addr_debug_print(PING_DEBUG, ping_target); + LWIP_DEBUGF(PING_DEBUG, (" - error\n")); + } + sys_msleep(PING_DELAY); + } +} + +#else /* PING_USE_SOCKETS */ + +/* Ping using the raw ip */ +static u8_t +ping_recv(void *arg, struct raw_pcb *pcb, struct pbuf *p, const ip_addr_t *addr) { + struct icmp_echo_hdr *iecho; + LWIP_UNUSED_ARG(arg); + LWIP_UNUSED_ARG(pcb); + LWIP_UNUSED_ARG(addr); + LWIP_ASSERT("p != NULL", p != NULL); + + if ((p->tot_len >= (PBUF_IP_HLEN + sizeof(struct icmp_echo_hdr))) && + pbuf_remove_header(p, PBUF_IP_HLEN) == 0) { + iecho = (struct icmp_echo_hdr *)p->payload; + + if ((iecho->id == PING_ID) && (iecho->seqno == lwip_htons(ping_seq_num))) { + LWIP_DEBUGF(PING_DEBUG, ("ping: recv ")); + ip_addr_debug_print(PING_DEBUG, addr); + LWIP_DEBUGF(PING_DEBUG, (" %"U32_F " ms\n", (sys_now() - ping_time))); + + /* do some ping result processing */ + PING_RESULT(1); + pbuf_free(p); + return 1; /* eat the packet */ + } + /* not eaten, restore original packet */ + pbuf_add_header(p, PBUF_IP_HLEN); + } + + return 0; /* don't eat the packet */ +} + +int +ping_send(struct raw_pcb *raw, const ip_addr_t *addr) { + struct pbuf *p; + struct icmp_echo_hdr *iecho; + size_t ping_size = sizeof(struct icmp_echo_hdr) + PING_DATA_SIZE; + + LWIP_DEBUGF(PING_DEBUG, ("ping: send ")); + ip_addr_debug_print(PING_DEBUG, addr); + LWIP_DEBUGF(PING_DEBUG, ("\n")); + LWIP_ASSERT("ping_size <= 0xffff", ping_size <= 0xffff); + + p = pbuf_alloc(PBUF_IP, (u16_t)ping_size, PBUF_RAM); + if (!p) { + return 0; + } + if ((p->len == p->tot_len) && (p->next == NULL)) { + iecho = (struct icmp_echo_hdr *)p->payload; + + ping_prepare_echo(iecho, (u16_t)ping_size); + + raw_sendto(raw, p, addr); + #ifdef LWIP_DEBUG + ping_time = sys_now(); + #endif /* LWIP_DEBUG */ + } + pbuf_free(p); + return 1; +} + +static void +ping_timeout(void *arg) { + struct raw_pcb *pcb = (struct raw_pcb *)arg; + + LWIP_ASSERT("ping_timeout: no pcb given!", pcb != NULL); + + ping_send(pcb, ping_target); + + sys_timeout(PING_DELAY, ping_timeout, pcb); +} + +static void +ping_raw_init(void) { + if (ping_pcb) { + return; + } + ping_pcb = raw_new(IP_PROTO_ICMP); + LWIP_ASSERT("ping_pcb != NULL", ping_pcb != NULL); + + raw_recv(ping_pcb, ping_recv, NULL); + raw_bind(ping_pcb, IP_ADDR_ANY); + sys_timeout(PING_DELAY, ping_timeout, ping_pcb); +} + +#endif /* PING_USE_SOCKETS */ + +void +ping_init(const ip_addr_t *ping_addr) { + ping_target = ping_addr; + + #if PING_USE_SOCKETS + sys_thread_new("ping_thread", ping_thread, NULL, DEFAULT_THREAD_STACKSIZE, DEFAULT_THREAD_PRIO); + #else /* PING_USE_SOCKETS */ + ping_raw_init(); + #endif /* PING_USE_SOCKETS */ +} + +#endif /* LWIP_RAW */ diff --git a/ports/raspberrypi/lwip_src/ping.h b/ports/raspberrypi/lwip_src/ping.h new file mode 100644 index 0000000000..abbae9d086 --- /dev/null +++ b/ports/raspberrypi/lwip_src/ping.h @@ -0,0 +1,25 @@ +#ifndef LWIP_PING_H +#define LWIP_PING_H + +#include "lwip/raw.h" +#include "lwip/ip_addr.h" +#include "lwip/prot/icmp.h" + +/** + * PING_USE_SOCKETS: Set to 1 to use sockets, otherwise the raw api is used + */ +#ifndef PING_USE_SOCKETS +#define PING_USE_SOCKETS LWIP_SOCKET +#endif + +void ping_init(const ip_addr_t *ping_addr); +void ping_prepare_echo(struct icmp_echo_hdr *iecho, u16_t len); + +extern u16_t ping_seq_num; +#if !PING_USE_SOCKETS +void ping_set_target(const ip_addr_t *ping_addr); +int ping_send(struct raw_pcb *raw, const ip_addr_t *addr); +// u8_t ping_recv(void *arg, struct raw_pcb *pcb, struct pbuf *p, const ip_addr_t *addr); +#endif /* !PING_USE_SOCKETS */ + +#endif /* LWIP_PING_H */ diff --git a/ports/raspberrypi/mbedtls/crt_bundle.c b/ports/raspberrypi/mbedtls/crt_bundle.c new file mode 100644 index 0000000000..7fce35872b --- /dev/null +++ b/ports/raspberrypi/mbedtls/crt_bundle.c @@ -0,0 +1,255 @@ +// Copyright 2018-2019 Espressif Systems (Shanghai) PTE LTD +// Copyright 2022 Jeff Epler for Adafruit Industries +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at + +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +#define BUNDLE_MAX_CERTS (200) + +#include + +#include "py/runtime.h" +#include "py/mperrno.h" +#include "mbedtls/x509_crt.h" +#include "mbedtls/crt_bundle.h" + +#define BUNDLE_HEADER_OFFSET 2 +#define CRT_HEADER_OFFSET 4 + +/* a dummy certificate so that + * cacert_ptr passes non-NULL check during handshake */ +static mbedtls_x509_crt s_dummy_crt; + +#define TAG "x509-crt-bundle" + +#define LOGE(tag, fmt, ...) mp_printf(&mp_plat_print, tag ":" fmt "\n",##__VA_ARGS__) +#if 0 +#define LOGI(tag, fmt, ...) mp_printf(&mp_plat_print, tag ":" fmt "\n",##__VA_ARGS__) +#define LOGD(tag, fmt, ...) mp_printf(&mp_plat_print, tag ":" fmt "\n",##__VA_ARGS__) +#else +#define LOGI(tag, fmt, ...) do {} while (0) +#define LOGD(tag, fmt, ...) do {} while (0) +#endif + +extern const uint8_t x509_crt_imported_bundle_bin_start[] asm ("_binary_x509_crt_bundle_start"); +extern const uint8_t x509_crt_imported_bundle_bin_end[] asm ("_binary_x509_crt_bundle_end"); + + +typedef struct crt_bundle_t { + const uint8_t **crts; + uint16_t num_certs; + size_t x509_crt_bundle_len; +} crt_bundle_t; + +static crt_bundle_t s_crt_bundle; + +static int crt_check_signature(mbedtls_x509_crt *child, const uint8_t *pub_key_buf, size_t pub_key_len); + + +static int crt_check_signature(mbedtls_x509_crt *child, const uint8_t *pub_key_buf, size_t pub_key_len) { + int ret = 0; + mbedtls_x509_crt parent; + const mbedtls_md_info_t *md_info; + unsigned char hash[MBEDTLS_MD_MAX_SIZE]; + + mbedtls_x509_crt_init(&parent); + + if ((ret = mbedtls_pk_parse_public_key(&parent.pk, pub_key_buf, pub_key_len)) != 0) { + LOGE(TAG, "PK parse failed with error %X", ret); + goto cleanup; + } + + + // Fast check to avoid expensive computations when not necessary + if (!mbedtls_pk_can_do(&parent.pk, child->sig_pk)) { + LOGE(TAG, "Simple compare failed"); + ret = -1; + goto cleanup; + } + + md_info = mbedtls_md_info_from_type(child->sig_md); + if ((ret = mbedtls_md(md_info, child->tbs.p, child->tbs.len, hash)) != 0) { + LOGE(TAG, "Internal mbedTLS error %X", ret); + goto cleanup; + } + + if ((ret = mbedtls_pk_verify_ext(child->sig_pk, child->sig_opts, &parent.pk, + child->sig_md, hash, mbedtls_md_get_size(md_info), + child->sig.p, child->sig.len)) != 0) { + + LOGE(TAG, "PK verify failed with error %X", ret); + goto cleanup; + } +cleanup: + mbedtls_x509_crt_free(&parent); + + return ret; +} + + +/* This callback is called for every certificate in the chain. If the chain + * is proper each intermediate certificate is validated through its parent + * in the x509_crt_verify_chain() function. So this callback should + * only verify the first untrusted link in the chain is signed by the + * root certificate in the trusted bundle +*/ +static int crt_verify_callback(void *buf, mbedtls_x509_crt *crt, int depth, uint32_t *flags) { + mbedtls_x509_crt *child = crt; + + /* It's OK for a trusted cert to have a weak signature hash alg. + as we already trust this certificate */ + uint32_t flags_filtered = *flags & ~(MBEDTLS_X509_BADCERT_BAD_MD); + + if (flags_filtered != MBEDTLS_X509_BADCERT_NOT_TRUSTED) { + return 0; + } + + + if (s_crt_bundle.crts == NULL) { + LOGE(TAG, "No certificates in bundle"); + return MBEDTLS_ERR_X509_FATAL_ERROR; + } + + LOGD(TAG, "%d certificates in bundle", s_crt_bundle.num_certs); + + size_t name_len = 0; + const uint8_t *crt_name; + + bool crt_found = false; + int start = 0; + int end = s_crt_bundle.num_certs - 1; + int middle = (end - start) / 2; + + /* Look for the certificate using binary search on subject name */ + while (start <= end) { + name_len = s_crt_bundle.crts[middle][0] << 8 | s_crt_bundle.crts[middle][1]; + crt_name = s_crt_bundle.crts[middle] + CRT_HEADER_OFFSET; + + int cmp_res = memcmp(child->issuer_raw.p, crt_name, name_len); + if (cmp_res == 0) { + crt_found = true; + break; + } else if (cmp_res < 0) { + end = middle - 1; + } else { + start = middle + 1; + } + middle = (start + end) / 2; + } + + int ret = MBEDTLS_ERR_X509_FATAL_ERROR; + if (crt_found) { + size_t key_len = s_crt_bundle.crts[middle][2] << 8 | s_crt_bundle.crts[middle][3]; + ret = crt_check_signature(child, s_crt_bundle.crts[middle] + CRT_HEADER_OFFSET + name_len, key_len); + } + + if (ret == 0) { + LOGI(TAG, "Certificate validated"); + *flags = 0; + return 0; + } + + LOGE(TAG, "Failed to verify certificate"); + return MBEDTLS_ERR_X509_FATAL_ERROR; +} + + +/* Initialize the bundle into an array so we can do binary search for certs, + the bundle generated by the python utility is already presorted by subject name + */ +static err_t crt_bundle_init(const uint8_t *x509_bundle, size_t bundle_size) { + if (bundle_size < BUNDLE_HEADER_OFFSET + CRT_HEADER_OFFSET) { + LOGE(TAG, "Invalid certificate bundle"); + return -MP_EINVAL; + } + + uint16_t num_certs = (x509_bundle[0] << 8) | x509_bundle[1]; + if (num_certs > BUNDLE_MAX_CERTS) { + // No. of certs in the certificate bundle = %d exceeds\n" + // Max allowed certificates in the certificate bundle = %d\n" + // Please update the menuconfig option with appropriate value", num_certs, BUNDLE_MAX_CERTS + return -MP_E2BIG; + } + + const uint8_t **crts = m_tracked_calloc(num_certs, sizeof(x509_bundle)); + if (crts == NULL) { + LOGE(TAG, "Unable to allocate memory for bundle"); + return -MP_ENOMEM; + } + + const uint8_t *cur_crt; + /* This is the maximum region that is allowed to access */ + const uint8_t *bundle_end = x509_bundle + bundle_size; + cur_crt = x509_bundle + BUNDLE_HEADER_OFFSET; + + for (int i = 0; i < num_certs; i++) { + crts[i] = cur_crt; + if (cur_crt + CRT_HEADER_OFFSET > bundle_end) { + LOGE(TAG, "Invalid certificate bundle"); + m_tracked_free(crts); + return -MP_EINVAL; + } + size_t name_len = cur_crt[0] << 8 | cur_crt[1]; + size_t key_len = cur_crt[2] << 8 | cur_crt[3]; + cur_crt = cur_crt + CRT_HEADER_OFFSET + name_len + key_len; + } + + if (cur_crt > bundle_end) { + LOGE(TAG, "Invalid certificate bundle"); + m_tracked_free(crts); + return -MP_EINVAL; + } + + /* The previous crt bundle is only updated when initialization of the + * current crt_bundle is successful */ + /* Free previous crt_bundle */ + m_tracked_free(s_crt_bundle.crts); + s_crt_bundle.num_certs = num_certs; + s_crt_bundle.crts = crts; + return 0; +} + +int crt_bundle_attach(mbedtls_ssl_config *ssl_conf) { + int ret = 0; + // If no bundle has been set by the user then use the bundle embedded in the binary + if (s_crt_bundle.crts == NULL) { + ret = crt_bundle_init(x509_crt_imported_bundle_bin_start, x509_crt_imported_bundle_bin_end - x509_crt_imported_bundle_bin_start); + } + + if (ret != 0) { + return ret; + } + + if (ssl_conf) { + /* point to a dummy certificate + * This is only required so that the + * cacert_ptr passes non-NULL check during handshake + */ + mbedtls_x509_crt_init(&s_dummy_crt); + mbedtls_ssl_conf_ca_chain(ssl_conf, &s_dummy_crt, NULL); + mbedtls_ssl_conf_verify(ssl_conf, crt_verify_callback, NULL); + } + + return ret; +} + +void crt_bundle_detach(mbedtls_ssl_config *conf) { + m_tracked_free(s_crt_bundle.crts); + s_crt_bundle.crts = NULL; + if (conf) { + mbedtls_ssl_conf_verify(conf, NULL, NULL); + } +} + +int crt_bundle_set(const uint8_t *x509_bundle, size_t bundle_size) { + return crt_bundle_init(x509_bundle, bundle_size); +} diff --git a/ports/raspberrypi/mbedtls/crt_bundle.h b/ports/raspberrypi/mbedtls/crt_bundle.h new file mode 100644 index 0000000000..b265ae4abe --- /dev/null +++ b/ports/raspberrypi/mbedtls/crt_bundle.h @@ -0,0 +1,21 @@ +// Copyright 2018-2019 Espressif Systems (Shanghai) PTE LTD +// Copyright 2022 Jeff Epler for Adafruit Industries +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at + +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +#pragma once +#include "mbedtls/ssl.h" + +int crt_bundle_attach(mbedtls_ssl_config *conf); +void crt_bundle_detach(mbedtls_ssl_config *conf); +int crt_bundle_set(const uint8_t *x509_bundle, size_t bundle_size); diff --git a/ports/raspberrypi/mbedtls/mbedtls_config.h b/ports/raspberrypi/mbedtls/mbedtls_config.h new file mode 100644 index 0000000000..3791924a13 --- /dev/null +++ b/ports/raspberrypi/mbedtls/mbedtls_config.h @@ -0,0 +1,128 @@ +/* + * This file is part of the MicroPython project, http://micropython.org/ + * + * The MIT License (MIT) + * + * Copyright (c) 2018-2019 Damien P. George + * + * 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_MBEDTLS_CONFIG_H +#define MICROPY_INCLUDED_MBEDTLS_CONFIG_H + +// If you want to debug MBEDTLS uncomment the following and +// Pass 3 to mbedtls_debug_set_threshold in socket_new +// #define MBEDTLS_DEBUG_C + +// Set mbedtls configuration +#define MBEDTLS_PLATFORM_MEMORY +#define MBEDTLS_PLATFORM_NO_STD_FUNCTIONS +#define MBEDTLS_DEPRECATED_REMOVED +#define MBEDTLS_ENTROPY_HARDWARE_ALT +#define MBEDTLS_AES_ROM_TABLES +#define MBEDTLS_CIPHER_MODE_CBC +#define MBEDTLS_ECP_DP_SECP192R1_ENABLED +#define MBEDTLS_ECP_DP_SECP224R1_ENABLED +#define MBEDTLS_ECP_DP_SECP256R1_ENABLED +#define MBEDTLS_ECP_DP_SECP384R1_ENABLED +#define MBEDTLS_ECP_DP_SECP521R1_ENABLED +#define MBEDTLS_ECP_DP_SECP192K1_ENABLED +#define MBEDTLS_ECP_DP_SECP224K1_ENABLED +#define MBEDTLS_ECP_DP_SECP256K1_ENABLED +#define MBEDTLS_ECP_DP_BP256R1_ENABLED +#define MBEDTLS_ECP_DP_BP384R1_ENABLED +#define MBEDTLS_ECP_DP_BP512R1_ENABLED +#define MBEDTLS_ECP_DP_CURVE25519_ENABLED +#define MBEDTLS_ECP_NIST_OPTIM +#define MBEDTLS_KEY_EXCHANGE_DHE_PSK_ENABLED +#define MBEDTLS_KEY_EXCHANGE_DHE_RSA_ENABLED +#define MBEDTLS_KEY_EXCHANGE_ECDH_ECDSA_ENABLED +#define MBEDTLS_KEY_EXCHANGE_ECDHE_ECDSA_ENABLED +#define MBEDTLS_KEY_EXCHANGE_ECDHE_PSK_ENABLED +#define MBEDTLS_KEY_EXCHANGE_ECDHE_RSA_ENABLED +#define MBEDTLS_KEY_EXCHANGE_ECDH_RSA_ENABLED +#define MBEDTLS_KEY_EXCHANGE_PSK_ENABLED +#define MBEDTLS_KEY_EXCHANGE_RSA_ENABLED +#define MBEDTLS_KEY_EXCHANGE_RSA_PSK_ENABLED +#define MBEDTLS_NO_PLATFORM_ENTROPY +#define MBEDTLS_PKCS1_V15 +#define MBEDTLS_SHA256_SMALLER +#define MBEDTLS_SSL_PROTO_TLS1 +#define MBEDTLS_SSL_PROTO_TLS1_1 +#define MBEDTLS_SSL_PROTO_TLS1_2 +#define MBEDTLS_SSL_SERVER_NAME_INDICATION + +// Use a smaller output buffer to reduce size of SSL context +#define MBEDTLS_SSL_MAX_CONTENT_LEN (16384) +#define MBEDTLS_SSL_IN_CONTENT_LEN (MBEDTLS_SSL_MAX_CONTENT_LEN) +#define MBEDTLS_SSL_OUT_CONTENT_LEN (4096) + +// Enable mbedtls modules +#define MBEDTLS_AES_C +#define MBEDTLS_ASN1_PARSE_C +#define MBEDTLS_ASN1_WRITE_C +#define MBEDTLS_BASE64_C +#define MBEDTLS_BIGNUM_C +#define MBEDTLS_CIPHER_C +#define MBEDTLS_CTR_DRBG_C +#define MBEDTLS_ECDH_C +#define MBEDTLS_ECDSA_C +#define MBEDTLS_ECP_C +#define MBEDTLS_ENTROPY_C +#define MBEDTLS_ERROR_C +#define MBEDTLS_GCM_C +#define MBEDTLS_MD_C +#define MBEDTLS_MD5_C +#define MBEDTLS_OID_C +#define MBEDTLS_PKCS5_C +#define MBEDTLS_PEM_PARSE_C +#define MBEDTLS_PK_C +#define MBEDTLS_PK_PARSE_C +#define MBEDTLS_PLATFORM_C +#define MBEDTLS_RSA_C +#define MBEDTLS_SHA1_C +#define MBEDTLS_SHA256_C +#define MBEDTLS_SHA512_C +#define MBEDTLS_SSL_CLI_C +#define MBEDTLS_SSL_SRV_C +#define MBEDTLS_SSL_TLS_C +#define MBEDTLS_TLS_DEFAULT_ALLOW_SHA1_IN_KEY_EXCHANGE +#define MBEDTLS_X509_CRT_PARSE_C +#define MBEDTLS_X509_USE_C +#define MBEDTLS_HAVE_TIME +#define MBEDTLS_DHM_C // needed by DHE_PSK +#undef MBEDTLS_HAVE_TIME_DATE + +// Memory allocation hooks +#include +#include +void *m_tracked_calloc(size_t nmemb, size_t size); +void m_tracked_free(void *ptr); +#define MBEDTLS_PLATFORM_STD_CALLOC m_tracked_calloc +#define MBEDTLS_PLATFORM_STD_FREE m_tracked_free +#define MBEDTLS_PLATFORM_SNPRINTF_MACRO snprintf + +// Time hook +#include +time_t rp2_rtctime_seconds(time_t *timer); +#define MBEDTLS_PLATFORM_TIME_MACRO rp2_rtctime_seconds + +#include "mbedtls/check_config.h" + +#endif /* MICROPY_INCLUDED_MBEDTLS_CONFIG_H */ diff --git a/ports/raspberrypi/mbedtls/mbedtls_port.c b/ports/raspberrypi/mbedtls/mbedtls_port.c new file mode 100644 index 0000000000..596d08ccd9 --- /dev/null +++ b/ports/raspberrypi/mbedtls/mbedtls_port.c @@ -0,0 +1,51 @@ +/* + * This file is part of the MicroPython project, http://micropython.org/ + * + * The MIT License (MIT) + * + * Copyright (c) 2019 Damien P. George + * + * 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 + +#if CIRCUITPY_SSL_MBEDTLS + +#include "mbedtls_config.h" +#include "mbedtls/entropy_poll.h" + +#include "hardware/rtc.h" +#include "shared/timeutils/timeutils.h" +#include "shared-bindings/os/__init__.h" + +extern uint8_t rosc_random_u8(size_t cycles); + +int mbedtls_hardware_poll(void *data, unsigned char *output, size_t len, size_t *olen) { + *olen = len; + common_hal_os_urandom(data, len); + return 0; +} + +time_t rp2_rtctime_seconds(time_t *timer) { + datetime_t t; + rtc_get_datetime(&t); + return timeutils_seconds_since_epoch(t.year, t.month, t.day, t.hour, t.min, t.sec); +} + +#endif diff --git a/ports/raspberrypi/mpconfigport.h b/ports/raspberrypi/mpconfigport.h index fd09d8a9ac..a2eb9a15ef 100644 --- a/ports/raspberrypi/mpconfigport.h +++ b/ports/raspberrypi/mpconfigport.h @@ -31,9 +31,17 @@ #define MICROPY_PY_SYS_PLATFORM "RP2040" -#define CIRCUITPY_INTERNAL_NVM_SIZE (4 * 1024) -#define CIRCUITPY_INTERNAL_NVM_START_ADDR (0x100FF000) +// Setting a non-default value also requires a non-default link.ld +#ifndef CIRCUITPY_FIRMWARE_SIZE +#define CIRCUITPY_FIRMWARE_SIZE (1020 * 1024) +#endif +#define CIRCUITPY_INTERNAL_NVM_SIZE (4 * 1024) +// This is the XIP address +#define CIRCUITPY_INTERNAL_NVM_START_ADDR (0x10000000 + CIRCUITPY_FIRMWARE_SIZE) + +// This is the flash linear address +#define CIRCUITPY_CIRCUITPY_DRIVE_START_ADDR (CIRCUITPY_FIRMWARE_SIZE + CIRCUITPY_INTERNAL_NVM_SIZE) #define CIRCUITPY_DEFAULT_STACK_SIZE (24 * 1024) #define MICROPY_USE_INTERNAL_PRINTF (1) @@ -49,4 +57,11 @@ mp_obj_t background_pio[NUM_DMA_CHANNELS]; \ CIRCUITPY_COMMON_ROOT_POINTERS; +#if CIRCUITPY_CYW43 +#include "pico/cyw43_arch.h" +#define MICROPY_PY_LWIP_ENTER cyw43_arch_lwip_begin(); +#define MICROPY_PY_LWIP_REENTER MICROPY_PY_LWIP_ENTER +#define MICROPY_PY_LWIP_EXIT cyw43_arch_lwip_end(); +#endif + #endif // __INCLUDED_MPCONFIGPORT_H diff --git a/ports/raspberrypi/mpconfigport.mk b/ports/raspberrypi/mpconfigport.mk index 32666ed9ea..fa1f0c153d 100644 --- a/ports/raspberrypi/mpconfigport.mk +++ b/ports/raspberrypi/mpconfigport.mk @@ -20,12 +20,15 @@ CIRCUITPY_ROTARYIO_SOFTENCODER = 1 # Things that need to be implemented. # Use PWM interally CIRCUITPY_FREQUENCYIO = 0 -CIRCUITPY_I2CPERIPHERAL = 0 +CIRCUITPY_I2CTARGET = 1 CIRCUITPY_NVM = 1 # Use PIO interally CIRCUITPY_PULSEIO ?= 1 CIRCUITPY_WATCHDOG ?= 1 +# Use of analogbufio +CIRCUITPY_ANALOGBUFIO = 1 + # Audio via PWM CIRCUITPY_AUDIOIO = 0 CIRCUITPY_AUDIOBUSIO ?= 1 @@ -36,6 +39,8 @@ CIRCUITPY_AUDIOMIXER = 1 INTERNAL_LIBM = 1 +CIRCUITPY_BUILD_EXTENSIONS ?= uf2 + # Number of USB endpoint pairs. USB_NUM_ENDPOINT_PAIRS = 8 diff --git a/ports/raspberrypi/peripherals/pins.c b/ports/raspberrypi/peripherals/pins.c index 1b5fe91cac..3b21d3f08c 100644 --- a/ports/raspberrypi/peripherals/pins.c +++ b/ports/raspberrypi/peripherals/pins.c @@ -27,6 +27,7 @@ #include "pins.h" #include "shared-bindings/microcontroller/Pin.h" +#include "bindings/cyw43/__init__.h" // This macro is used to simplify pin definition in boards//pins.c #define PIN(p_number) \ @@ -34,6 +35,11 @@ { &mcu_pin_type }, \ .number = p_number \ } +#define CYW_PIN(p_number) \ + const mcu_pin_obj_t pin_CYW##p_number = { \ + { &cyw43_pin_type }, \ + .number = p_number \ + } PIN(0); PIN(1); @@ -58,10 +64,21 @@ PIN(19); PIN(20); PIN(21); PIN(22); +#if !defined(IGNORE_GPIO23) PIN(23); +#endif +#if !defined(IGNORE_GPIO24) PIN(24); +#endif +#if !defined(IGNORE_GPIO25) PIN(25); +#endif PIN(26); PIN(27); PIN(28); PIN(29); +#if CIRCUITPY_CYW43 +CYW_PIN(0); +CYW_PIN(1); +CYW_PIN(2); +#endif diff --git a/ports/raspberrypi/peripherals/pins.h b/ports/raspberrypi/peripherals/pins.h index 99ab9cfe48..9ec74ed262 100644 --- a/ports/raspberrypi/peripherals/pins.h +++ b/ports/raspberrypi/peripherals/pins.h @@ -62,10 +62,18 @@ extern const mcu_pin_obj_t pin_GPIO21; extern const mcu_pin_obj_t pin_GPIO22; extern const mcu_pin_obj_t pin_GPIO23; extern const mcu_pin_obj_t pin_GPIO24; +#if !defined(IGNORE_GPIO25) extern const mcu_pin_obj_t pin_GPIO25; +#endif extern const mcu_pin_obj_t pin_GPIO26; extern const mcu_pin_obj_t pin_GPIO27; extern const mcu_pin_obj_t pin_GPIO28; extern const mcu_pin_obj_t pin_GPIO29; +#if CIRCUITPY_CYW43 +extern const mcu_pin_obj_t pin_CYW0; +extern const mcu_pin_obj_t pin_CYW1; +extern const mcu_pin_obj_t pin_CYW2; +#endif + #endif // MICROPY_INCLUDED_RASPBERRYPI_PERIPHERALS_PINS_H diff --git a/ports/raspberrypi/pioasm/CMakeLists.txt b/ports/raspberrypi/pioasm/CMakeLists.txt new file mode 100644 index 0000000000..1923068bae --- /dev/null +++ b/ports/raspberrypi/pioasm/CMakeLists.txt @@ -0,0 +1,8 @@ +cmake_minimum_required(VERSION 3.12) +project(pioasm) +set(PICO_TINYUSB_PATH ${CMAKE_CURRENT_SOURCE_DIR}/../../../lib/tinyusb) +include(../sdk/pico_sdk_init.cmake) +pico_sdk_init() + +set(CMAKE_MODULE_PATH ${CMAKE_MODULE_PATH} ${PICO_SDK_PATH}/tools) +find_package(Pioasm REQUIRED) diff --git a/ports/raspberrypi/sdk b/ports/raspberrypi/sdk index 2062372d20..2e6142b15b 160000 --- a/ports/raspberrypi/sdk +++ b/ports/raspberrypi/sdk @@ -1 +1 @@ -Subproject commit 2062372d203b372849d573f252cf7c6dc2800c0a +Subproject commit 2e6142b15b8a75c1227dd3edbe839193b2bf9041 diff --git a/ports/raspberrypi/supervisor/internal_flash.c b/ports/raspberrypi/supervisor/internal_flash.c index c128cb74b2..010528559d 100644 --- a/ports/raspberrypi/supervisor/internal_flash.c +++ b/ports/raspberrypi/supervisor/internal_flash.c @@ -46,7 +46,9 @@ #include "src/rp2_common/hardware_flash/include/hardware/flash.h" #include "src/common/pico_binary_info/include/pico/binary_info.h" -#define RESERVED_FLASH (1 * 1024 * 1024) +#if !defined(TOTAL_FLASH_MINIMUM) +#define TOTAL_FLASH_MINIMUM (2 * 1024 * 1024) +#endif // TODO: Split the caching out of supervisor/shared/external_flash so we can use it. #define SECTOR_SIZE 4096 @@ -59,8 +61,8 @@ void supervisor_flash_init(void) { bi_decl_if_func_used(bi_block_device( BINARY_INFO_MAKE_TAG('C', 'P'), "CircuitPython", - RESERVED_FLASH, - (1 * 1024 * 1024), // This is a minimum. We can't set it dynamically. + CIRCUITPY_CIRCUITPY_DRIVE_START_ADDR, + TOTAL_FLASH_MINIMUM - CIRCUITPY_CIRCUITPY_DRIVE_START_ADDR, // This is a minimum. We can't set it dynamically. NULL, BINARY_INFO_BLOCK_DEV_FLAG_READ | BINARY_INFO_BLOCK_DEV_FLAG_WRITE | @@ -86,7 +88,7 @@ uint32_t supervisor_flash_get_block_size(void) { } uint32_t supervisor_flash_get_block_count(void) { - return (_flash_size - RESERVED_FLASH) / FILESYSTEM_BLOCK_SIZE; + return (_flash_size - CIRCUITPY_CIRCUITPY_DRIVE_START_ADDR) / FILESYSTEM_BLOCK_SIZE; } void port_internal_flash_flush(void) { @@ -94,15 +96,15 @@ void port_internal_flash_flush(void) { return; } common_hal_mcu_disable_interrupts(); - flash_range_erase(RESERVED_FLASH + _cache_lba, SECTOR_SIZE); - flash_range_program(RESERVED_FLASH + _cache_lba, _cache, SECTOR_SIZE); + flash_range_erase(CIRCUITPY_CIRCUITPY_DRIVE_START_ADDR + _cache_lba, SECTOR_SIZE); + flash_range_program(CIRCUITPY_CIRCUITPY_DRIVE_START_ADDR + _cache_lba, _cache, SECTOR_SIZE); common_hal_mcu_enable_interrupts(); _cache_lba = NO_CACHE; } mp_uint_t supervisor_flash_read_blocks(uint8_t *dest, uint32_t block, uint32_t num_blocks) { memcpy(dest, - (void *)(XIP_BASE + RESERVED_FLASH + block * FILESYSTEM_BLOCK_SIZE), + (void *)(XIP_BASE + CIRCUITPY_CIRCUITPY_DRIVE_START_ADDR + block * FILESYSTEM_BLOCK_SIZE), num_blocks * FILESYSTEM_BLOCK_SIZE); return 0; } @@ -117,7 +119,7 @@ mp_uint_t supervisor_flash_write_blocks(const uint8_t *src, uint32_t lba, uint32 if (_cache_lba != block_address) { memcpy(_cache, - (void *)(XIP_BASE + RESERVED_FLASH + sector_offset), + (void *)(XIP_BASE + CIRCUITPY_CIRCUITPY_DRIVE_START_ADDR + sector_offset), SECTOR_SIZE); _cache_lba = sector_offset; } @@ -133,8 +135,8 @@ mp_uint_t supervisor_flash_write_blocks(const uint8_t *src, uint32_t lba, uint32 } // Make sure we don't have an interrupt while we do flash operations. common_hal_mcu_disable_interrupts(); - flash_range_erase(RESERVED_FLASH + sector_offset, SECTOR_SIZE); - flash_range_program(RESERVED_FLASH + sector_offset, _cache, SECTOR_SIZE); + flash_range_erase(CIRCUITPY_CIRCUITPY_DRIVE_START_ADDR + sector_offset, SECTOR_SIZE); + flash_range_program(CIRCUITPY_CIRCUITPY_DRIVE_START_ADDR + sector_offset, _cache, SECTOR_SIZE); common_hal_mcu_enable_interrupts(); } diff --git a/ports/raspberrypi/supervisor/port.c b/ports/raspberrypi/supervisor/port.c index 5041250c0a..781d2b11d2 100644 --- a/ports/raspberrypi/supervisor/port.c +++ b/ports/raspberrypi/supervisor/port.c @@ -41,6 +41,14 @@ #include "shared-bindings/rtc/__init__.h" #include "shared-bindings/pwmio/PWMOut.h" +#if CIRCUITPY_SSL +#include "common-hal/ssl/__init__.h" +#endif + +#if CIRCUITPY_WIFI +#include "common-hal/wifi/__init__.h" +#endif + #include "common-hal/rtc/RTC.h" #include "common-hal/busio/UART.h" @@ -53,12 +61,17 @@ #include "src/rp2_common/hardware_uart/include/hardware/uart.h" #include "src/rp2_common/hardware_sync/include/hardware/sync.h" #include "src/rp2_common/hardware_timer/include/hardware/timer.h" +#if CIRCUITPY_CYW43 +#include "pico/cyw43_arch.h" +#endif #include "src/common/pico_time/include/pico/time.h" #include "src/common/pico_binary_info/include/pico/binary_info.h" #include "pico/bootrom.h" #include "hardware/watchdog.h" +#include "supervisor/serial.h" + extern volatile bool mp_msc_enabled; STATIC void _tick_callback(uint alarm_num); @@ -122,6 +135,17 @@ safe_mode_t port_init(void) { // Check brownout. + #if CIRCUITPY_CYW43 + never_reset_pin_number(23); + never_reset_pin_number(24); + never_reset_pin_number(25); + never_reset_pin_number(29); + if (cyw43_arch_init()) { + serial_write("WiFi init failed\n"); + } else { + cyw_ever_init = true; + } + #endif if (board_requests_safe_mode()) { return USER_SAFE_MODE; } @@ -159,6 +183,14 @@ void reset_port(void) { audio_dma_reset(); #endif + #if CIRCUITPY_SSL + ssl_reset(); + #endif + + #if CIRCUITPY_WIFI + wifi_reset(); + #endif + reset_all_pins(); } @@ -261,3 +293,19 @@ __attribute__((used)) void HardFault_Handler(void) { asm ("nop;"); } } + +void port_yield() { + #if CIRCUITPY_CYW43 + cyw43_arch_poll(); + #endif +} + +void port_boot_info(void) { + #if CIRCUITPY_CYW43 + mp_printf(&mp_plat_print, "MAC"); + for (int i = 0; i < 6; i++) { + mp_printf(&mp_plat_print, ":%02X", cyw43_state.mac[i]); + } + mp_printf(&mp_plat_print, "\n"); + #endif +} diff --git a/ports/stm/.gitignore b/ports/stm/.gitignore index 5d645392ca..ade7a0d09d 100644 --- a/ports/stm/.gitignore +++ b/ports/stm/.gitignore @@ -1,9 +1,3 @@ -# Build files -##################### -build-*/ - # Reference files ##################### ref/ - -.gdb_history diff --git a/ports/stm/Makefile b/ports/stm/Makefile index 48b0000a65..afde51bdc0 100755 --- a/ports/stm/Makefile +++ b/ports/stm/Makefile @@ -88,8 +88,6 @@ else CFLAGS += -DNDEBUG OPTIMIZATION_FLAGS ?= -O2 -fno-inline-functions CFLAGS += -ggdb3 - # TODO: Test with -flto - # CFLAGS += -flto endif # to override compiler optimization level, set in boards/$(BOARD)/mpconfigboard.mk @@ -302,11 +300,11 @@ $(BUILD)/firmware.hex: $(BUILD)/firmware.elf $(BUILD)/firmware.uf2: $(BUILD)/firmware.hex $(ECHO) "Create $@" - $(PYTHON) $(TOP)/tools/uf2/utils/uf2conv.py -f 0x57755a57 -b $(BOOTLOADER_OFFSET) -c -o "$(BUILD)/firmware.uf2" $^ + $(PYTHON) $(TOP)/tools/uf2/utils/uf2conv.py -f $(UF2_FAMILY_ID) -b $(BOOTLOADER_OFFSET) -c -o "$(BUILD)/firmware.uf2" $^ flash: $(BUILD)/firmware.bin $(ECHO) "Writing $< to the board" - dfu-util -a 0 --dfuse-address 0x08000000 -D $(BUILD)/firmware.bin + dfu-util -a 0 --dfuse-address $(BOOTLOADER_OFFSET) -D $(BUILD)/firmware.bin include $(TOP)/py/mkrules.mk diff --git a/ports/stm/boards/STM32F446_fs.ld b/ports/stm/boards/STM32F446_fs.ld new file mode 100644 index 0000000000..76735cbdc2 --- /dev/null +++ b/ports/stm/boards/STM32F446_fs.ld @@ -0,0 +1,26 @@ +/* + GNU linker script for STM32F446 with filesystem +*/ + +/* Specify the memory areas */ +MEMORY +{ + FLASH (rx) : ORIGIN = 0x08000000, LENGTH = 512K /* entire flash */ + FLASH_ISR (rx) : ORIGIN = 0x08000000, LENGTH = 16K /* sector 0 */ + FLASH_FS (rx) : ORIGIN = 0x08004000, LENGTH = 48K /* sectors 1,2,3 are 16K */ + FLASH_FIRMWARE (rx) : ORIGIN = 0x08010000, LENGTH = 448K /* sector 4 is 64K, sectors 5,6,7 are 128K */ + RAM (xrw) : ORIGIN = 0x20000000, LENGTH = 128K +} + +/* produce a link error if there is not this amount of RAM for these sections */ +_minimum_stack_size = 24K; +_minimum_heap_size = 16K; + +/* Define tho top end of the stack. The stack is full descending so begins just + above last byte of RAM. Note that EABI requires the stack to be 8-byte + aligned for a call. */ +_estack = ORIGIN(RAM) + LENGTH(RAM); + +/* RAM extents for the garbage collector */ +_ram_start = ORIGIN(RAM); +_ram_end = ORIGIN(RAM) + LENGTH(RAM); diff --git a/ports/stm/boards/STM32L4R5_boot.ld b/ports/stm/boards/STM32L4R5_boot.ld index 16204205e6..ab34b281a8 100644 --- a/ports/stm/boards/STM32L4R5_boot.ld +++ b/ports/stm/boards/STM32L4R5_boot.ld @@ -8,7 +8,7 @@ MEMORY FLASH (rx) : ORIGIN = 0x08000000, LENGTH = 2048K /* entire flash */ FLASH_ISR (rx) : ORIGIN = 0x08010000, LENGTH = 4K /* ISR vector. Kind of wasteful. */ FLASH_FIRMWARE (rx) : ORIGIN = 0x08011000, LENGTH = 1024K-128K-64K-4K /* For now, limit to 1MB so that bank switching is still possible. */ - FLASH_FS (rw) : ORIGIN = 0x080e0000, LENGTH = 128K + FLASH_FS (rw) : ORIGIN = 0x08100000, LENGTH = 1024K RAM (xrw) : ORIGIN = 0x20000000, LENGTH = 640K } diff --git a/ports/stm/boards/STM32L4R5_default.ld b/ports/stm/boards/STM32L4R5_default.ld index 1f6e04f6be..1bffcee04e 100644 --- a/ports/stm/boards/STM32L4R5_default.ld +++ b/ports/stm/boards/STM32L4R5_default.ld @@ -8,7 +8,7 @@ MEMORY FLASH (rx) : ORIGIN = 0x08000000, LENGTH = 2048K /* entire flash */ FLASH_ISR (rx) : ORIGIN = 0x08000000, LENGTH = 4K /* ISR vector. Kind of wasteful. */ FLASH_FIRMWARE (rx) : ORIGIN = 0x08001000, LENGTH = 1024K-128K-4K /* For now, limit to 1MB so that bank switching is still possible. */ - FLASH_FS (rw) : ORIGIN = 0x080e0000, LENGTH = 128K + FLASH_FS (rw) : ORIGIN = 0x08100000, LENGTH = 1024K RAM (xrw) : ORIGIN = 0x20000000, LENGTH = 640K } diff --git a/ports/stm/boards/espruino_pico/board.c b/ports/stm/boards/espruino_pico/board.c index 4286717446..fb1ce4fb83 100644 --- a/ports/stm/boards/espruino_pico/board.c +++ b/ports/stm/boards/espruino_pico/board.c @@ -25,18 +25,5 @@ */ #include "supervisor/board.h" -#include "mpconfigboard.h" -void board_init(void) { -} - -bool board_requests_safe_mode(void) { - return false; -} - -void reset_board(void) { - -} - -void board_deinit(void) { -} +// Use the MP_WEAK supervisor/shared/board.c versions of routines not defined here. diff --git a/ports/stm/boards/espruino_wifi/board.c b/ports/stm/boards/espruino_wifi/board.c index b4070e72dc..fb1ce4fb83 100644 --- a/ports/stm/boards/espruino_wifi/board.c +++ b/ports/stm/boards/espruino_wifi/board.c @@ -26,16 +26,4 @@ #include "supervisor/board.h" -void board_init(void) { -} - -bool board_requests_safe_mode(void) { - return false; -} - -void reset_board(void) { - -} - -void board_deinit(void) { -} +// Use the MP_WEAK supervisor/shared/board.c versions of routines not defined here. diff --git a/ports/stm/boards/feather_stm32f405_express/board.c b/ports/stm/boards/feather_stm32f405_express/board.c index 4286717446..fb1ce4fb83 100644 --- a/ports/stm/boards/feather_stm32f405_express/board.c +++ b/ports/stm/boards/feather_stm32f405_express/board.c @@ -25,18 +25,5 @@ */ #include "supervisor/board.h" -#include "mpconfigboard.h" -void board_init(void) { -} - -bool board_requests_safe_mode(void) { - return false; -} - -void reset_board(void) { - -} - -void board_deinit(void) { -} +// Use the MP_WEAK supervisor/shared/board.c versions of routines not defined here. diff --git a/ports/stm/boards/meowbit_v121/board.c b/ports/stm/boards/meowbit_v121/board.c index 59ba948237..e4d362bbfa 100644 --- a/ports/stm/boards/meowbit_v121/board.c +++ b/ports/stm/boards/meowbit_v121/board.c @@ -104,14 +104,14 @@ void board_init(void) { sizeof(display_init_sequence), &pin_PB03, NO_BRIGHTNESS_COMMAND, - 1.0f, // brightness (ignored) - false, // auto_brightness + 1.0f, // brightness false, // single_byte_bounds false, // data_as_commands true, // auto_refresh 60, // native_frames_per_second true, // backlight_on_high - false); // SH1107_addressing + false, // SH1107_addressing + 50000); // backlight pwm frequency board_buzz_obj.base.type = &audiopwmio_pwmaudioout_type; common_hal_audiopwmio_pwmaudioout_construct(&board_buzz_obj, @@ -119,13 +119,4 @@ void board_init(void) { never_reset_pin_number(pin_PB08.port, pin_PB08.number); } -bool board_requests_safe_mode(void) { - return false; -} - -void reset_board(void) { - -} - -void board_deinit(void) { -} +// Use the MP_WEAK supervisor/shared/board.c versions of routines not defined here. diff --git a/ports/stm/boards/meowbit_v121/mpconfigboard.mk b/ports/stm/boards/meowbit_v121/mpconfigboard.mk index 77b046ada7..3bbfb7eec8 100644 --- a/ports/stm/boards/meowbit_v121/mpconfigboard.mk +++ b/ports/stm/boards/meowbit_v121/mpconfigboard.mk @@ -13,6 +13,8 @@ MCU_SERIES = F4 MCU_VARIANT = STM32F401xE MCU_PACKAGE = LQFP64 +CIRCUITPY_BUILD_EXTENSIONS = uf2 + OPTIMIZATION_FLAGS = -Os LD_COMMON = boards/common_default.ld diff --git a/ports/stm/boards/nucleo_f446re/board.c b/ports/stm/boards/nucleo_f446re/board.c new file mode 100644 index 0000000000..b75dda3061 --- /dev/null +++ b/ports/stm/boards/nucleo_f446re/board.c @@ -0,0 +1,29 @@ +/* + * This file is part of the MicroPython project, http://micropython.org/ + * + * The MIT License (MIT) + * + * Copyright (c) 2022 flom84 + * + * Permission is hereby granted, free of charge, to any person obtaining a copy + * of this software and associated documentation files (the "Software"), to deal + * in the Software without restriction, including without limitation the rights + * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell + * copies of the Software, and to permit persons to whom the Software is + * furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice shall be included in + * all copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE + * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER + * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, + * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN + * THE SOFTWARE. + */ + +#include "supervisor/board.h" + +// Use the MP_WEAK supervisor/shared/board.c versions of routines not defined here. diff --git a/ports/stm/boards/nucleo_f446re/mpconfigboard.h b/ports/stm/boards/nucleo_f446re/mpconfigboard.h new file mode 100644 index 0000000000..f0155f4624 --- /dev/null +++ b/ports/stm/boards/nucleo_f446re/mpconfigboard.h @@ -0,0 +1,55 @@ +/* + * This file is part of the MicroPython project, http://micropython.org/ + * + * The MIT License (MIT) + * + * Copyright (c) 2022 flom84 + * + * Permission is hereby granted, free of charge, to any person obtaining a copy + * of this software and associated documentation files (the "Software"), to deal + * in the Software without restriction, including without limitation the rights + * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell + * copies of the Software, and to permit persons to whom the Software is + * furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice shall be included in + * all copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE + * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER + * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, + * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN + * THE SOFTWARE. + */ + +// Micropython setup + +#define MICROPY_HW_BOARD_NAME "NUCLEO F446RE" +#define MICROPY_HW_MCU_NAME "STM32F446xx" + +#define FLASH_SIZE (0x80000u) // 512K +#define FLASH_PAGE_SIZE (0x4000u) // 16K + +#define HSE_VALUE ((uint32_t)8000000u) +#define BOARD_HSE_SOURCE (RCC_HSE_ON) +// The schematic has a 32k crystal that isn't fitted. Uncommented the line below if you add it. +// #define BOARD_HAS_LOW_SPEED_CRYSTAL (1) +// #define LSE_VALUE ((uint32_t)32000U) +#define BOARD_HAS_LOW_SPEED_CRYSTAL (0) + +// USART3 + USB FTDI +// #define CIRCUITPY_CONSOLE_UART_TX (&pin_PC10) +// #define CIRCUITPY_CONSOLE_UART_RX (&pin_PC11) + +// USART2 + ST link +// #define CIRCUITPY_CONSOLE_UART_TX (&pin_PA02) +// #define CIRCUITPY_CONSOLE_UART_RX (&pin_PA03) + +// Status LEDs +#define MICROPY_HW_LED_STATUS (&pin_PA05) + +#define MICROPY_FATFS_EXFAT 0 + +#define BOARD_NO_VBUS_SENSE (1) diff --git a/ports/stm/boards/nucleo_f446re/mpconfigboard.mk b/ports/stm/boards/nucleo_f446re/mpconfigboard.mk new file mode 100644 index 0000000000..0887578166 --- /dev/null +++ b/ports/stm/boards/nucleo_f446re/mpconfigboard.mk @@ -0,0 +1,35 @@ +USB_VID = 0x0483 +USB_PID = 0x572A +USB_PRODUCT = "NUCLEO-F446RE - CPy" +USB_MANUFACTURER = "STMicroelectronics" + +INTERNAL_FLASH_FILESYSTEM = 1 + +MCU_SERIES = F4 +MCU_VARIANT = STM32F446xx +MCU_PACKAGE = LQFP64 + +LD_COMMON = boards/common_default.ld +LD_FILE = boards/STM32F446_fs.ld + +# Too big for the flash +CIRCUITPY_AUDIOCORE = 0 +CIRCUITPY_AUDIOPWMIO = 0 +CIRCUITPY_BITMAPTOOLS = 0 +CIRCUITPY_BLEIO_HCI = 0 +CIRCUITPY_VECTORIO = 0 +CIRCUITPY_TOUCHIO = 0 +CIRCUITPY_RAINBOWIO = 0 +CIRCUITPY_USB_HID = 0 +CIRCUITPY_USB_MIDI = 0 +CIRCUITPY_JSON = 0 +# Requires neopixel_write or SPI (dotstar) +CIRCUITPY_PIXELBUF = 0 +# No requirements, but takes extra flash +CIRCUITPY_ULAB = 0 +CIRCUITPY_GAMEPADSHIFT = 0 +CIRCUITPY_BITBANGIO = 0 +CIRCUITPY_NEOPIXEL_WRITE = 0 +CIRCUITPY_SDCARDIO = 0 +CIRCUITPY_DISPLAYIO = 0 +CIRCUITPY_KEYPAD = 0 diff --git a/ports/stm/boards/nucleo_f446re/pins.c b/ports/stm/boards/nucleo_f446re/pins.c new file mode 100644 index 0000000000..ac5a457d07 --- /dev/null +++ b/ports/stm/boards/nucleo_f446re/pins.c @@ -0,0 +1,78 @@ +#include "shared-bindings/board/__init__.h" + +STATIC const mp_rom_map_elem_t board_module_globals_table[] = { + {MP_ROM_QSTR(MP_QSTR_ID), MP_ROM_PTR(&board_module_id_obj)}, + {MP_ROM_QSTR(MP_QSTR_D0), MP_ROM_PTR(&pin_PA03)}, + {MP_ROM_QSTR(MP_QSTR_D1), MP_ROM_PTR(&pin_PA02)}, + {MP_ROM_QSTR(MP_QSTR_D2), MP_ROM_PTR(&pin_PA10)}, + {MP_ROM_QSTR(MP_QSTR_D3), MP_ROM_PTR(&pin_PB03)}, + {MP_ROM_QSTR(MP_QSTR_D4), MP_ROM_PTR(&pin_PB05)}, + {MP_ROM_QSTR(MP_QSTR_D5), MP_ROM_PTR(&pin_PB04)}, + {MP_ROM_QSTR(MP_QSTR_D6), MP_ROM_PTR(&pin_PB10)}, + {MP_ROM_QSTR(MP_QSTR_D7), MP_ROM_PTR(&pin_PA08)}, + {MP_ROM_QSTR(MP_QSTR_D8), MP_ROM_PTR(&pin_PA09)}, + {MP_ROM_QSTR(MP_QSTR_D9), MP_ROM_PTR(&pin_PC07)}, + {MP_ROM_QSTR(MP_QSTR_D10), MP_ROM_PTR(&pin_PB06)}, + {MP_ROM_QSTR(MP_QSTR_D11), MP_ROM_PTR(&pin_PA07)}, + {MP_ROM_QSTR(MP_QSTR_D12), MP_ROM_PTR(&pin_PA06)}, + {MP_ROM_QSTR(MP_QSTR_D13), MP_ROM_PTR(&pin_PA05)}, + {MP_ROM_QSTR(MP_QSTR_D14), MP_ROM_PTR(&pin_PB09)}, + {MP_ROM_QSTR(MP_QSTR_D15), MP_ROM_PTR(&pin_PB08)}, + {MP_ROM_QSTR(MP_QSTR_A0), MP_ROM_PTR(&pin_PA00)}, + {MP_ROM_QSTR(MP_QSTR_A1), MP_ROM_PTR(&pin_PA01)}, + {MP_ROM_QSTR(MP_QSTR_A2), MP_ROM_PTR(&pin_PA04)}, + {MP_ROM_QSTR(MP_QSTR_A3), MP_ROM_PTR(&pin_PB00)}, + {MP_ROM_QSTR(MP_QSTR_A4), MP_ROM_PTR(&pin_PC01)}, + {MP_ROM_QSTR(MP_QSTR_A5), MP_ROM_PTR(&pin_PC00)}, + {MP_ROM_QSTR(MP_QSTR_PA0), MP_ROM_PTR(&pin_PA00)}, + {MP_ROM_QSTR(MP_QSTR_PA1), MP_ROM_PTR(&pin_PA01)}, + {MP_ROM_QSTR(MP_QSTR_PA2), MP_ROM_PTR(&pin_PA02)}, + {MP_ROM_QSTR(MP_QSTR_PA3), MP_ROM_PTR(&pin_PA03)}, + {MP_ROM_QSTR(MP_QSTR_PA4), MP_ROM_PTR(&pin_PA04)}, + {MP_ROM_QSTR(MP_QSTR_PA5), MP_ROM_PTR(&pin_PA05)}, + {MP_ROM_QSTR(MP_QSTR_PA6), MP_ROM_PTR(&pin_PA06)}, + {MP_ROM_QSTR(MP_QSTR_PA7), MP_ROM_PTR(&pin_PA07)}, + {MP_ROM_QSTR(MP_QSTR_PA8), MP_ROM_PTR(&pin_PA08)}, + {MP_ROM_QSTR(MP_QSTR_PA9), MP_ROM_PTR(&pin_PA09)}, + {MP_ROM_QSTR(MP_QSTR_PA10), MP_ROM_PTR(&pin_PA10)}, + {MP_ROM_QSTR(MP_QSTR_PA11), MP_ROM_PTR(&pin_PA11)}, + {MP_ROM_QSTR(MP_QSTR_PA12), MP_ROM_PTR(&pin_PA12)}, + {MP_ROM_QSTR(MP_QSTR_PA15), MP_ROM_PTR(&pin_PA15)}, + {MP_ROM_QSTR(MP_QSTR_PB0), MP_ROM_PTR(&pin_PB00)}, + {MP_ROM_QSTR(MP_QSTR_PB1), MP_ROM_PTR(&pin_PB01)}, + {MP_ROM_QSTR(MP_QSTR_PB2), MP_ROM_PTR(&pin_PB02)}, + {MP_ROM_QSTR(MP_QSTR_PB3), MP_ROM_PTR(&pin_PB03)}, + {MP_ROM_QSTR(MP_QSTR_PB4), MP_ROM_PTR(&pin_PB04)}, + {MP_ROM_QSTR(MP_QSTR_PB5), MP_ROM_PTR(&pin_PB05)}, + {MP_ROM_QSTR(MP_QSTR_PB6), MP_ROM_PTR(&pin_PB06)}, + {MP_ROM_QSTR(MP_QSTR_PB7), MP_ROM_PTR(&pin_PB07)}, + {MP_ROM_QSTR(MP_QSTR_PB8), MP_ROM_PTR(&pin_PB08)}, + {MP_ROM_QSTR(MP_QSTR_PB9), MP_ROM_PTR(&pin_PB09)}, + {MP_ROM_QSTR(MP_QSTR_PB10), MP_ROM_PTR(&pin_PB10)}, + {MP_ROM_QSTR(MP_QSTR_PB12), MP_ROM_PTR(&pin_PB12)}, + {MP_ROM_QSTR(MP_QSTR_PB13), MP_ROM_PTR(&pin_PB13)}, + {MP_ROM_QSTR(MP_QSTR_PB14), MP_ROM_PTR(&pin_PB14)}, + {MP_ROM_QSTR(MP_QSTR_PB15), MP_ROM_PTR(&pin_PB15)}, + {MP_ROM_QSTR(MP_QSTR_PC0), MP_ROM_PTR(&pin_PC00)}, + {MP_ROM_QSTR(MP_QSTR_PC1), MP_ROM_PTR(&pin_PC01)}, + {MP_ROM_QSTR(MP_QSTR_PC2), MP_ROM_PTR(&pin_PC02)}, + {MP_ROM_QSTR(MP_QSTR_PC3), MP_ROM_PTR(&pin_PC03)}, + {MP_ROM_QSTR(MP_QSTR_PC4), MP_ROM_PTR(&pin_PC04)}, + {MP_ROM_QSTR(MP_QSTR_PC5), MP_ROM_PTR(&pin_PC05)}, + {MP_ROM_QSTR(MP_QSTR_PC6), MP_ROM_PTR(&pin_PC06)}, + {MP_ROM_QSTR(MP_QSTR_PC7), MP_ROM_PTR(&pin_PC07)}, + {MP_ROM_QSTR(MP_QSTR_PC8), MP_ROM_PTR(&pin_PC08)}, + {MP_ROM_QSTR(MP_QSTR_PC9), MP_ROM_PTR(&pin_PC09)}, + {MP_ROM_QSTR(MP_QSTR_PC10), MP_ROM_PTR(&pin_PC10)}, + {MP_ROM_QSTR(MP_QSTR_PC11), MP_ROM_PTR(&pin_PC11)}, + {MP_ROM_QSTR(MP_QSTR_PC12), MP_ROM_PTR(&pin_PC12)}, + {MP_ROM_QSTR(MP_QSTR_PC13), MP_ROM_PTR(&pin_PC13)}, + {MP_ROM_QSTR(MP_QSTR_PC14), MP_ROM_PTR(&pin_PC14)}, + {MP_ROM_QSTR(MP_QSTR_PC15), MP_ROM_PTR(&pin_PC15)}, + {MP_ROM_QSTR(MP_QSTR_PD2), MP_ROM_PTR(&pin_PD02)}, + {MP_ROM_QSTR(MP_QSTR_PH0), MP_ROM_PTR(&pin_PH00)}, + {MP_ROM_QSTR(MP_QSTR_PH1), MP_ROM_PTR(&pin_PH01)}, + {MP_ROM_QSTR(MP_QSTR_LED), MP_ROM_PTR(&pin_PA05)}, + {MP_ROM_QSTR(MP_QSTR_SW), MP_ROM_PTR(&pin_PC13)}, +}; +MP_DEFINE_CONST_DICT(board_module_globals, board_module_globals_table); diff --git a/ports/stm/boards/nucleo_f746zg/board.c b/ports/stm/boards/nucleo_f746zg/board.c index b4070e72dc..fb1ce4fb83 100644 --- a/ports/stm/boards/nucleo_f746zg/board.c +++ b/ports/stm/boards/nucleo_f746zg/board.c @@ -26,16 +26,4 @@ #include "supervisor/board.h" -void board_init(void) { -} - -bool board_requests_safe_mode(void) { - return false; -} - -void reset_board(void) { - -} - -void board_deinit(void) { -} +// Use the MP_WEAK supervisor/shared/board.c versions of routines not defined here. diff --git a/ports/stm/boards/nucleo_f746zg/mpconfigboard.h b/ports/stm/boards/nucleo_f746zg/mpconfigboard.h index c4399f5a3d..bde2c3ec73 100644 --- a/ports/stm/boards/nucleo_f746zg/mpconfigboard.h +++ b/ports/stm/boards/nucleo_f746zg/mpconfigboard.h @@ -46,5 +46,5 @@ #define BOARD_HSE_SOURCE (RCC_HSE_BYPASS) // ST boards use the STLink clock signal #define BOARD_HAS_LOW_SPEED_CRYSTAL (1) -#define CIRCUITPY_DEBUG_UART_TX (&pin_PD08) -#define CIRCUITPY_DEBUG_UART_RX (&pin_PD09) +#define CIRCUITPY_CONSOLE_UART_TX (&pin_PD08) +#define CIRCUITPY_CONSOLE_UART_RX (&pin_PD09) diff --git a/ports/stm/boards/nucleo_f767zi/board.c b/ports/stm/boards/nucleo_f767zi/board.c index b4070e72dc..fb1ce4fb83 100644 --- a/ports/stm/boards/nucleo_f767zi/board.c +++ b/ports/stm/boards/nucleo_f767zi/board.c @@ -26,16 +26,4 @@ #include "supervisor/board.h" -void board_init(void) { -} - -bool board_requests_safe_mode(void) { - return false; -} - -void reset_board(void) { - -} - -void board_deinit(void) { -} +// Use the MP_WEAK supervisor/shared/board.c versions of routines not defined here. diff --git a/ports/stm/boards/nucleo_h743zi_2/board.c b/ports/stm/boards/nucleo_h743zi_2/board.c index b4070e72dc..fb1ce4fb83 100644 --- a/ports/stm/boards/nucleo_h743zi_2/board.c +++ b/ports/stm/boards/nucleo_h743zi_2/board.c @@ -26,16 +26,4 @@ #include "supervisor/board.h" -void board_init(void) { -} - -bool board_requests_safe_mode(void) { - return false; -} - -void reset_board(void) { - -} - -void board_deinit(void) { -} +// Use the MP_WEAK supervisor/shared/board.c versions of routines not defined here. diff --git a/ports/stm/boards/openmv_h7/board.c b/ports/stm/boards/openmv_h7/board.c index b4070e72dc..fb1ce4fb83 100644 --- a/ports/stm/boards/openmv_h7/board.c +++ b/ports/stm/boards/openmv_h7/board.c @@ -26,16 +26,4 @@ #include "supervisor/board.h" -void board_init(void) { -} - -bool board_requests_safe_mode(void) { - return false; -} - -void reset_board(void) { - -} - -void board_deinit(void) { -} +// Use the MP_WEAK supervisor/shared/board.c versions of routines not defined here. diff --git a/ports/stm/boards/pyb_nano_v2/board.c b/ports/stm/boards/pyb_nano_v2/board.c index 4286717446..fb1ce4fb83 100644 --- a/ports/stm/boards/pyb_nano_v2/board.c +++ b/ports/stm/boards/pyb_nano_v2/board.c @@ -25,18 +25,5 @@ */ #include "supervisor/board.h" -#include "mpconfigboard.h" -void board_init(void) { -} - -bool board_requests_safe_mode(void) { - return false; -} - -void reset_board(void) { - -} - -void board_deinit(void) { -} +// Use the MP_WEAK supervisor/shared/board.c versions of routines not defined here. diff --git a/ports/stm/boards/pyb_nano_v2/mpconfigboard.mk b/ports/stm/boards/pyb_nano_v2/mpconfigboard.mk index 3ba45e0c5b..c8b548c50f 100644 --- a/ports/stm/boards/pyb_nano_v2/mpconfigboard.mk +++ b/ports/stm/boards/pyb_nano_v2/mpconfigboard.mk @@ -16,10 +16,4 @@ LD_FILE = boards/STM32F411_fs.ld # Too big for the flash CIRCUITPY_AUDIOCORE = 0 CIRCUITPY_AUDIOPWMIO = 0 -CIRCUITPY_BITMAPTOOLS = 0 CIRCUITPY_BLEIO_HCI = 0 -CIRCUITPY_BUSDEVICE = 0 -CIRCUITPY_GIFIO = 0 -CIRCUITPY_KEYPAD = 0 -CIRCUITPY_MSGPACK = 0 -CIRCUITPY_ONEWIREIO = 0 diff --git a/ports/stm/boards/pyboard_v11/board.c b/ports/stm/boards/pyboard_v11/board.c index b4070e72dc..fb1ce4fb83 100644 --- a/ports/stm/boards/pyboard_v11/board.c +++ b/ports/stm/boards/pyboard_v11/board.c @@ -26,16 +26,4 @@ #include "supervisor/board.h" -void board_init(void) { -} - -bool board_requests_safe_mode(void) { - return false; -} - -void reset_board(void) { - -} - -void board_deinit(void) { -} +// Use the MP_WEAK supervisor/shared/board.c versions of routines not defined here. diff --git a/ports/stm/boards/sparkfun_stm32_thing_plus/mpconfigboard.mk b/ports/stm/boards/sparkfun_stm32_thing_plus/mpconfigboard.mk index 62d0136be5..24505eb23d 100644 --- a/ports/stm/boards/sparkfun_stm32_thing_plus/mpconfigboard.mk +++ b/ports/stm/boards/sparkfun_stm32_thing_plus/mpconfigboard.mk @@ -19,3 +19,5 @@ LD_BOOT = boards/STM32F405_boot.ld UF2_OFFSET = 0x8010000 CIRCUITPY_RGBMATRIX ?= 1 + +CIRCUITPY_BUILD_EXTENSIONS = bin,uf2 diff --git a/ports/stm/boards/sparkfun_stm32f405_micromod/board.c b/ports/stm/boards/sparkfun_stm32f405_micromod/board.c index 4286717446..f081e7fa90 100644 --- a/ports/stm/boards/sparkfun_stm32f405_micromod/board.c +++ b/ports/stm/boards/sparkfun_stm32f405_micromod/board.c @@ -27,16 +27,4 @@ #include "supervisor/board.h" #include "mpconfigboard.h" -void board_init(void) { -} - -bool board_requests_safe_mode(void) { - return false; -} - -void reset_board(void) { - -} - -void board_deinit(void) { -} +// Use the MP_WEAK supervisor/shared/board.c versions of routines not defined here. diff --git a/ports/stm/boards/stm32f411ce_blackpill/board.c b/ports/stm/boards/stm32f411ce_blackpill/board.c index 4286717446..fb1ce4fb83 100644 --- a/ports/stm/boards/stm32f411ce_blackpill/board.c +++ b/ports/stm/boards/stm32f411ce_blackpill/board.c @@ -25,18 +25,5 @@ */ #include "supervisor/board.h" -#include "mpconfigboard.h" -void board_init(void) { -} - -bool board_requests_safe_mode(void) { - return false; -} - -void reset_board(void) { - -} - -void board_deinit(void) { -} +// Use the MP_WEAK supervisor/shared/board.c versions of routines not defined here. diff --git a/ports/stm/boards/stm32f411ce_blackpill_with_flash/board.c b/ports/stm/boards/stm32f411ce_blackpill_with_flash/board.c index 4286717446..fb1ce4fb83 100644 --- a/ports/stm/boards/stm32f411ce_blackpill_with_flash/board.c +++ b/ports/stm/boards/stm32f411ce_blackpill_with_flash/board.c @@ -25,18 +25,5 @@ */ #include "supervisor/board.h" -#include "mpconfigboard.h" -void board_init(void) { -} - -bool board_requests_safe_mode(void) { - return false; -} - -void reset_board(void) { - -} - -void board_deinit(void) { -} +// Use the MP_WEAK supervisor/shared/board.c versions of routines not defined here. diff --git a/ports/stm/boards/stm32f411ve_discovery/board.c b/ports/stm/boards/stm32f411ve_discovery/board.c index b4070e72dc..fb1ce4fb83 100644 --- a/ports/stm/boards/stm32f411ve_discovery/board.c +++ b/ports/stm/boards/stm32f411ve_discovery/board.c @@ -26,16 +26,4 @@ #include "supervisor/board.h" -void board_init(void) { -} - -bool board_requests_safe_mode(void) { - return false; -} - -void reset_board(void) { - -} - -void board_deinit(void) { -} +// Use the MP_WEAK supervisor/shared/board.c versions of routines not defined here. diff --git a/ports/stm/boards/stm32f412zg_discovery/board.c b/ports/stm/boards/stm32f412zg_discovery/board.c index b4070e72dc..fb1ce4fb83 100644 --- a/ports/stm/boards/stm32f412zg_discovery/board.c +++ b/ports/stm/boards/stm32f412zg_discovery/board.c @@ -26,16 +26,4 @@ #include "supervisor/board.h" -void board_init(void) { -} - -bool board_requests_safe_mode(void) { - return false; -} - -void reset_board(void) { - -} - -void board_deinit(void) { -} +// Use the MP_WEAK supervisor/shared/board.c versions of routines not defined here. diff --git a/ports/stm/boards/stm32f4_discovery/board.c b/ports/stm/boards/stm32f4_discovery/board.c index b4070e72dc..fb1ce4fb83 100644 --- a/ports/stm/boards/stm32f4_discovery/board.c +++ b/ports/stm/boards/stm32f4_discovery/board.c @@ -26,16 +26,4 @@ #include "supervisor/board.h" -void board_init(void) { -} - -bool board_requests_safe_mode(void) { - return false; -} - -void reset_board(void) { - -} - -void board_deinit(void) { -} +// Use the MP_WEAK supervisor/shared/board.c versions of routines not defined here. diff --git a/ports/stm/boards/stm32f746g_discovery/board.c b/ports/stm/boards/stm32f746g_discovery/board.c index 8f35532627..56c90bd8c6 100644 --- a/ports/stm/boards/stm32f746g_discovery/board.c +++ b/ports/stm/boards/stm32f746g_discovery/board.c @@ -48,13 +48,4 @@ void board_init(void) { never_reset_pin_number(10, 3); } -bool board_requests_safe_mode(void) { - return false; -} - -void reset_board(void) { - -} - -void board_deinit(void) { -} +// Use the MP_WEAK supervisor/shared/board.c versions of routines not defined here. diff --git a/ports/stm/boards/swan_r5/board.c b/ports/stm/boards/swan_r5/board.c index 5ad6d464bf..602fd87537 100644 --- a/ports/stm/boards/swan_r5/board.c +++ b/ports/stm/boards/swan_r5/board.c @@ -30,20 +30,42 @@ #include "stm32l4xx.h" #include "stm32l4r5xx.h" +#include "shared-bindings/microcontroller/Pin.h" +#include "shared-bindings/digitalio/DigitalInOut.h" +#include "shared-bindings/digitalio/Direction.h" +#include "shared-bindings/digitalio/DriveMode.h" +#include "board.h" + +digitalio_digitalinout_obj_t power_pin = { .base.type = &digitalio_digitalinout_type }; +digitalio_digitalinout_obj_t discharge_pin = { .base.type = &digitalio_digitalinout_type }; + void initialize_discharge_pin(void) { + /* Initialize the 3V3 discharge to be OFF and the output power to be ON */ __HAL_RCC_GPIOE_CLK_ENABLE(); + __HAL_RCC_GPIOC_CLK_ENABLE(); + + + common_hal_digitalio_digitalinout_construct(&power_pin, &pin_PE04); + common_hal_digitalio_digitalinout_construct(&discharge_pin, &pin_PE06); + common_hal_digitalio_digitalinout_never_reset(&power_pin); + common_hal_digitalio_digitalinout_never_reset(&discharge_pin); + GPIO_InitTypeDef GPIO_InitStruct; - GPIO_InitStruct.Mode = GPIO_MODE_OUTPUT_OD; + /* Set the DISCHARGE pin and the USB_DETECT pin to FLOAT */ + GPIO_InitStruct.Mode = GPIO_MODE_ANALOG; GPIO_InitStruct.Pull = GPIO_NOPULL; - GPIO_InitStruct.Speed = GPIO_SPEED_LOW; GPIO_InitStruct.Pin = GPIO_PIN_6; - HAL_GPIO_Init(GPIOE, &GPIO_InitStruct); - HAL_GPIO_WritePin(GPIOE, GPIO_PIN_6, GPIO_PIN_SET); + HAL_GPIO_Init(GPIOE, &GPIO_InitStruct); /* PE6 DISCHRG */ + HAL_GPIO_Init(GPIOC, &GPIO_InitStruct); /* PC6 is USB_DETECT */ + + /* Turn on the 3V3 regulator */ GPIO_InitStruct.Mode = GPIO_MODE_OUTPUT_PP; + GPIO_InitStruct.Speed = GPIO_SPEED_LOW; GPIO_InitStruct.Pin = GPIO_PIN_4; HAL_GPIO_Init(GPIOE, &GPIO_InitStruct); HAL_GPIO_WritePin(GPIOE, GPIO_PIN_4, GPIO_PIN_SET); + } void board_init(void) { @@ -53,15 +75,21 @@ void board_init(void) { // Set tick interrupt priority, default HAL value is intentionally invalid // Without this, USB does not function. HAL_InitTick((1UL << __NVIC_PRIO_BITS) - 1UL); -} -bool board_requests_safe_mode(void) { - return false; + __HAL_RCC_GPIOE_CLK_ENABLE(); + GPIO_InitTypeDef GPIO_InitStruct; + GPIO_InitStruct.Mode = GPIO_MODE_OUTPUT_PP; + GPIO_InitStruct.Pull = GPIO_NOPULL; + GPIO_InitStruct.Speed = GPIO_SPEED_LOW; + GPIO_InitStruct.Pin = GPIO_PIN_2; + HAL_GPIO_Init(GPIOE, &GPIO_InitStruct); + HAL_GPIO_WritePin(GPIOE, GPIO_PIN_2, GPIO_PIN_SET); + HAL_Delay(50); + HAL_GPIO_WritePin(GPIOE, GPIO_PIN_2, GPIO_PIN_RESET); } void reset_board(void) { initialize_discharge_pin(); } -void board_deinit(void) { -} +// Use the MP_WEAK supervisor/shared/board.c versions of routines not defined here. diff --git a/ports/stm/boards/swan_r5/board.h b/ports/stm/boards/swan_r5/board.h new file mode 100644 index 0000000000..56c62c34a0 --- /dev/null +++ b/ports/stm/boards/swan_r5/board.h @@ -0,0 +1,10 @@ +#ifndef _BOARDS_SWAN_R5_BOARD_H_ +#define _BOARDS_SWAN_R5_BOARD_H_ + +#include "common-hal/digitalio/DigitalInOut.h" + +extern digitalio_digitalinout_obj_t power_pin; +extern digitalio_digitalinout_obj_t discharge_pin; + + +#endif // _BOARDS_SWAN_R5_BOARD_H_ diff --git a/ports/stm/boards/swan_r5/mpconfigboard.h b/ports/stm/boards/swan_r5/mpconfigboard.h index da07d6530b..94cc58ff9d 100644 --- a/ports/stm/boards/swan_r5/mpconfigboard.h +++ b/ports/stm/boards/swan_r5/mpconfigboard.h @@ -64,3 +64,6 @@ #define DEFAULT_UART_BUS_RX (&pin_PA10) #define DEFAULT_UART_BUS_TX (&pin_PA09) + +#define SWAN_R5_DISCHARGE_3V3 (&pin_PE06) +#define SWAN_R5_ENABLE_3V3 (&pin_PE04) diff --git a/ports/stm/boards/swan_r5/mpconfigboard.mk b/ports/stm/boards/swan_r5/mpconfigboard.mk index 24b73e332d..2ebaa9c23f 100644 --- a/ports/stm/boards/swan_r5/mpconfigboard.mk +++ b/ports/stm/boards/swan_r5/mpconfigboard.mk @@ -14,6 +14,7 @@ LD_DEFAULT = boards/STM32L4R5_default.ld # UF2 boot option LD_BOOT = boards/STM32L4R5_boot.ld UF2_OFFSET = 0x8010000 +UF2_BOOTLOADER ?= 1 # Turn all of the below off while trying to get the thing to run # These modules are implemented in ports//common-hal: @@ -41,7 +42,7 @@ CIRCUITPY_PWMIO = 1 CIRCUITPY_AUDIOPWMIO = 1 CIRCUITPY_CANIO = 0 CIRCUITPY_AUDIOBUSIO = 0 -CIRCUITPY_I2CPERIPHERAL = 0 +CIRCUITPY_I2CTARGET = 0 # Requires SPI, PulseIO (stub ok): CIRCUITPY_DISPLAYIO = 0 @@ -49,8 +50,6 @@ CIRCUITPY_DISPLAYIO = 0 # any port once their prerequisites in common-hal are complete. # Requires DigitalIO: CIRCUITPY_BITBANGIO = 1 -# Requires DigitalIO -CIRCUITPY_GAMEPADSHIFT = 1 # Requires neopixel_write or SPI (dotstar) CIRCUITPY_PIXELBUF = 0 # Requires OS @@ -71,3 +70,6 @@ CIRCUITPY_BLEIO = 0 CIRCUITPY_BUSDEVICE = 0 CIRCUITPY_KEYPAD = 1 CIRCUITPY_RGBMATRIX = 0 +CIRCUITPY_RTC = 1 + +CIRCUITPY_BUILD_EXTENSIONS = bin,uf2 diff --git a/ports/stm/boards/swan_r5/pins.c b/ports/stm/boards/swan_r5/pins.c index f630d05997..cf97c3587a 100644 --- a/ports/stm/boards/swan_r5/pins.c +++ b/ports/stm/boards/swan_r5/pins.c @@ -1,14 +1,24 @@ #include "py/objtuple.h" #include "shared-bindings/board/__init__.h" +#include "board.h" -// Core Feather Pins -STATIC const mp_rom_map_elem_t board_module_globals_table[] = { - CIRCUITPYTHON_BOARD_DICT_STANDARD_ITEMS +// extended pins +STATIC const mp_rom_map_elem_t board_module_carrier_table[] = { + { MP_ROM_QSTR(MP_QSTR_D0), MP_ROM_PTR(&pin_PD09) }, + { MP_ROM_QSTR(MP_QSTR_D1), MP_ROM_PTR(&pin_PD08) }, + { MP_ROM_QSTR(MP_QSTR_D2), MP_ROM_PTR(&pin_PF15) }, + { MP_ROM_QSTR(MP_QSTR_D3), MP_ROM_PTR(&pin_PE13) }, + { MP_ROM_QSTR(MP_QSTR_D4), MP_ROM_PTR(&pin_PE03) }, - { MP_ROM_QSTR(MP_QSTR_ENABLE_3V3), MP_ROM_PTR(&pin_PE04) }, - { MP_ROM_QSTR(MP_QSTR_DISCHARGE_3V3), MP_ROM_PTR(&pin_PE06) }, - { MP_ROM_QSTR(MP_QSTR_DISABLE_DISCHARGING), MP_ROM_TRUE }, - { MP_ROM_QSTR(MP_QSTR_ENABLE_DISCHARGING), MP_ROM_FALSE }, + { MP_ROM_QSTR(MP_QSTR_SCK), MP_ROM_PTR(&pin_PD01) }, + { MP_ROM_QSTR(MP_QSTR_MOSI), MP_ROM_PTR(&pin_PB15) }, + { MP_ROM_QSTR(MP_QSTR_MISO), MP_ROM_PTR(&pin_PB14) }, + { MP_ROM_QSTR(MP_QSTR_CS), MP_ROM_PTR(&pin_PD00) }, + + { MP_ROM_QSTR(MP_QSTR_RTS), MP_ROM_PTR(&pin_PG12) }, + { MP_ROM_QSTR(MP_QSTR_CTS), MP_ROM_PTR(&pin_PB04) }, + { MP_ROM_QSTR(MP_QSTR_RX0), MP_ROM_PTR(&pin_PG08) }, + { MP_ROM_QSTR(MP_QSTR_TX0), MP_ROM_PTR(&pin_PG07) }, { MP_ROM_QSTR(MP_QSTR_A0), MP_ROM_PTR(&pin_PA03) }, { MP_ROM_QSTR(MP_QSTR_A1), MP_ROM_PTR(&pin_PA01) }, @@ -16,34 +26,105 @@ STATIC const mp_rom_map_elem_t board_module_globals_table[] = { { MP_ROM_QSTR(MP_QSTR_A3), MP_ROM_PTR(&pin_PC01) }, { MP_ROM_QSTR(MP_QSTR_A4), MP_ROM_PTR(&pin_PC04) }, { MP_ROM_QSTR(MP_QSTR_A5), MP_ROM_PTR(&pin_PC05) }, + { MP_ROM_QSTR(MP_QSTR_A6), MP_ROM_PTR(&pin_PB01) }, + { MP_ROM_QSTR(MP_QSTR_A7), MP_ROM_PTR(&pin_PC02) }, + { MP_ROM_QSTR(MP_QSTR_D14), MP_ROM_PTR(&pin_PB09) }, + { MP_ROM_QSTR(MP_QSTR_D15), MP_ROM_PTR(&pin_PE01) }, + + { MP_ROM_QSTR(MP_QSTR_RX), MP_ROM_PTR(&pin_PA10) }, + { MP_ROM_QSTR(MP_QSTR_TX), MP_ROM_PTR(&pin_PA09) }, + { MP_ROM_QSTR(MP_QSTR_SCL3), MP_ROM_PTR(&pin_PC00) }, + { MP_ROM_QSTR(MP_QSTR_SDA3), MP_ROM_PTR(&pin_PC09) }, + + { MP_ROM_QSTR(MP_QSTR_RX2), MP_ROM_PTR(&pin_PD06) }, + { MP_ROM_QSTR(MP_QSTR_RTS2), MP_ROM_PTR(&pin_PD04) }, + { MP_ROM_QSTR(MP_QSTR_CTS2), MP_ROM_PTR(&pin_PD03) }, + { MP_ROM_QSTR(MP_QSTR_TX3), MP_ROM_PTR(&pin_PB10) }, + { MP_ROM_QSTR(MP_QSTR_RX3), MP_ROM_PTR(&pin_PB11) }, + { MP_ROM_QSTR(MP_QSTR_RTS3), MP_ROM_PTR(&pin_PD02) }, + { MP_ROM_QSTR(MP_QSTR_CTS3), MP_ROM_PTR(&pin_PB13) }, + + { MP_ROM_QSTR(MP_QSTR_D6), MP_ROM_PTR(&pin_PE09) }, + { MP_ROM_QSTR(MP_QSTR_D5), MP_ROM_PTR(&pin_PE11) }, + { MP_ROM_QSTR(MP_QSTR_SCL2), MP_ROM_PTR(&pin_PF01) }, + { MP_ROM_QSTR(MP_QSTR_SDA2), MP_ROM_PTR(&pin_PF00) }, + + { MP_ROM_QSTR(MP_QSTR_QEN), MP_ROM_PTR(&pin_PD05) }, + { MP_ROM_QSTR(MP_QSTR_QCS), MP_ROM_PTR(&pin_PC11) }, + { MP_ROM_QSTR(MP_QSTR_QCLK), MP_ROM_PTR(&pin_PE10) }, + + { MP_ROM_QSTR(MP_QSTR_EN), MP_ROM_PTR(&pin_PE04) }, + { MP_ROM_QSTR(MP_QSTR_TX2), MP_ROM_PTR(&pin_PA02) }, + { MP_ROM_QSTR(MP_QSTR_D13), MP_ROM_PTR(&pin_PA05) }, + { MP_ROM_QSTR(MP_QSTR_D12), MP_ROM_PTR(&pin_PA06) }, + { MP_ROM_QSTR(MP_QSTR_D11), MP_ROM_PTR(&pin_PA07) }, + { MP_ROM_QSTR(MP_QSTR_D10), MP_ROM_PTR(&pin_PA04) }, + { MP_ROM_QSTR(MP_QSTR_D9), MP_ROM_PTR(&pin_PD15) }, + { MP_ROM_QSTR(MP_QSTR_D8), MP_ROM_PTR(&pin_PF12) }, + { MP_ROM_QSTR(MP_QSTR_D7), MP_ROM_PTR(&pin_PF13) }, + + { MP_ROM_QSTR(MP_QSTR_SCL), MP_ROM_PTR(&pin_PB06) }, + { MP_ROM_QSTR(MP_QSTR_SDA), MP_ROM_PTR(&pin_PB07) }, + { MP_ROM_QSTR(MP_QSTR_QIO3), MP_ROM_PTR(&pin_PE15) }, + { MP_ROM_QSTR(MP_QSTR_QIO2), MP_ROM_PTR(&pin_PE14) }, + { MP_ROM_QSTR(MP_QSTR_QIO1), MP_ROM_PTR(&pin_PB00) }, + { MP_ROM_QSTR(MP_QSTR_QIO0), MP_ROM_PTR(&pin_PE12) }, + +}; + +MP_DEFINE_CONST_DICT(board_module_carrier, board_module_carrier_table); + +const mp_obj_type_t carrier_type = { + { &mp_type_type }, + .name = MP_QSTR_Ext, + .locals_dict = (mp_obj_dict_t *)&board_module_carrier, +}; + + +// Core Feather Pins +STATIC const mp_rom_map_elem_t board_module_globals_table[] = { + CIRCUITPYTHON_BOARD_DICT_STANDARD_ITEMS + + { MP_ROM_QSTR(MP_QSTR_ext), MP_ROM_PTR(&carrier_type) }, + + { MP_ROM_QSTR(MP_QSTR_ENABLE_3V3), &power_pin }, + { MP_ROM_QSTR(MP_QSTR_DISCHARGE_3V3), &discharge_pin }, + + { MP_ROM_QSTR(MP_QSTR_A0), MP_ROM_PTR(&pin_PA03) }, // PWM, ADC + { MP_ROM_QSTR(MP_QSTR_A1), MP_ROM_PTR(&pin_PA01) }, // PWM, ADC + { MP_ROM_QSTR(MP_QSTR_A2), MP_ROM_PTR(&pin_PC03) }, // ADC + { MP_ROM_QSTR(MP_QSTR_A3), MP_ROM_PTR(&pin_PC01) }, // ADC + { MP_ROM_QSTR(MP_QSTR_A4), MP_ROM_PTR(&pin_PC04) }, // ADC + { MP_ROM_QSTR(MP_QSTR_A5), MP_ROM_PTR(&pin_PC05) }, // ADC + { MP_ROM_QSTR(MP_QSTR_VOLTAGE_MONITOR), MP_ROM_PTR(&pin_PA00) }, { MP_ROM_QSTR(MP_QSTR_BUTTON_USR), MP_ROM_PTR(&pin_PC13) }, { MP_ROM_QSTR(MP_QSTR_SWITCH), MP_ROM_PTR(&pin_PE04) }, - { MP_ROM_QSTR(MP_QSTR_BUTTON), MP_ROM_PTR(&pin_PB02) }, // boot button, but looks like it's wired to GND on the schematic + { MP_ROM_QSTR(MP_QSTR_BUTTON), MP_ROM_PTR(&pin_PB02) }, - { MP_ROM_QSTR(MP_QSTR_D5), MP_ROM_PTR(&pin_PE11) }, - { MP_ROM_QSTR(MP_QSTR_D6), MP_ROM_PTR(&pin_PE09) }, - { MP_ROM_QSTR(MP_QSTR_D9), MP_ROM_PTR(&pin_PD15) }, - { MP_ROM_QSTR(MP_QSTR_D10), MP_ROM_PTR(&pin_PA04) }, // DAC1 output also - { MP_ROM_QSTR(MP_QSTR_D11), MP_ROM_PTR(&pin_PA07) }, - { MP_ROM_QSTR(MP_QSTR_D12), MP_ROM_PTR(&pin_PA06) }, + { MP_ROM_QSTR(MP_QSTR_D5), MP_ROM_PTR(&pin_PE11) }, // PWM + { MP_ROM_QSTR(MP_QSTR_D6), MP_ROM_PTR(&pin_PE09) }, // PWM + { MP_ROM_QSTR(MP_QSTR_D9), MP_ROM_PTR(&pin_PD15) }, // PWM + { MP_ROM_QSTR(MP_QSTR_D10), MP_ROM_PTR(&pin_PA04) }, // ADC, DAC1 output also + { MP_ROM_QSTR(MP_QSTR_D11), MP_ROM_PTR(&pin_PA07) }, // ADC, PWM + { MP_ROM_QSTR(MP_QSTR_D12), MP_ROM_PTR(&pin_PA06) }, // ADC, PWM { MP_ROM_QSTR(MP_QSTR_LED), MP_ROM_PTR(&pin_PE02) }, - { MP_ROM_QSTR(MP_QSTR_D13), MP_ROM_PTR(&pin_PA05) }, // DAC1 output also + { MP_ROM_QSTR(MP_QSTR_D13), MP_ROM_PTR(&pin_PA05) }, // ADC, PWM, DAC2 output also - { MP_ROM_QSTR(MP_QSTR_SDA), MP_ROM_PTR(&pin_PB07) }, - { MP_ROM_QSTR(MP_QSTR_SCL), MP_ROM_PTR(&pin_PB06) }, + { MP_ROM_QSTR(MP_QSTR_SDA), MP_ROM_PTR(&pin_PB07) }, // PWM + { MP_ROM_QSTR(MP_QSTR_SCL), MP_ROM_PTR(&pin_PB06) }, // PWM { MP_ROM_QSTR(MP_QSTR_DAC1), MP_ROM_PTR(&pin_PA04) }, // D10 { MP_ROM_QSTR(MP_QSTR_DAC2), MP_ROM_PTR(&pin_PA05) }, // D13 { MP_ROM_QSTR(MP_QSTR_SS), MP_ROM_PTR(&pin_PD00) }, { MP_ROM_QSTR(MP_QSTR_SCK), MP_ROM_PTR(&pin_PD01) }, - { MP_ROM_QSTR(MP_QSTR_MISO), MP_ROM_PTR(&pin_PB14) }, - { MP_ROM_QSTR(MP_QSTR_MOSI), MP_ROM_PTR(&pin_PB15) }, + { MP_ROM_QSTR(MP_QSTR_MISO), MP_ROM_PTR(&pin_PB14) }, // PWM? + { MP_ROM_QSTR(MP_QSTR_MOSI), MP_ROM_PTR(&pin_PB15) }, // PWM? - { MP_ROM_QSTR(MP_QSTR_TX), MP_ROM_PTR(&pin_PA09) }, - { MP_ROM_QSTR(MP_QSTR_RX), MP_ROM_PTR(&pin_PA10) }, + { MP_ROM_QSTR(MP_QSTR_TX), MP_ROM_PTR(&pin_PA09) }, // ADC, PWM + { MP_ROM_QSTR(MP_QSTR_RX), MP_ROM_PTR(&pin_PA10) }, // PWM { MP_ROM_QSTR(MP_QSTR_I2C), MP_ROM_PTR(&board_i2c_obj) }, { MP_ROM_QSTR(MP_QSTR_SPI), MP_ROM_PTR(&board_spi_obj) }, diff --git a/ports/stm/boards/thunderpack_v11/board.c b/ports/stm/boards/thunderpack_v11/board.c index b4070e72dc..fb1ce4fb83 100644 --- a/ports/stm/boards/thunderpack_v11/board.c +++ b/ports/stm/boards/thunderpack_v11/board.c @@ -26,16 +26,4 @@ #include "supervisor/board.h" -void board_init(void) { -} - -bool board_requests_safe_mode(void) { - return false; -} - -void reset_board(void) { - -} - -void board_deinit(void) { -} +// Use the MP_WEAK supervisor/shared/board.c versions of routines not defined here. diff --git a/ports/stm/boards/thunderpack_v12/board.c b/ports/stm/boards/thunderpack_v12/board.c index b4070e72dc..fb1ce4fb83 100644 --- a/ports/stm/boards/thunderpack_v12/board.c +++ b/ports/stm/boards/thunderpack_v12/board.c @@ -26,16 +26,4 @@ #include "supervisor/board.h" -void board_init(void) { -} - -bool board_requests_safe_mode(void) { - return false; -} - -void reset_board(void) { - -} - -void board_deinit(void) { -} +// Use the MP_WEAK supervisor/shared/board.c versions of routines not defined here. diff --git a/ports/stm/boards/thunderpack_v12/mpconfigboard.mk b/ports/stm/boards/thunderpack_v12/mpconfigboard.mk index f7905f6945..526415ca30 100644 --- a/ports/stm/boards/thunderpack_v12/mpconfigboard.mk +++ b/ports/stm/boards/thunderpack_v12/mpconfigboard.mk @@ -14,7 +14,6 @@ EXTERNAL_FLASH_DEVICES = GD25Q16C CIRCUITPY_NVM = 1 CIRCUITPY_BITMAPTOOLS = 0 CIRCUITPY_BLEIO_HCI = 0 -CIRCUITPY_ONEWIREIO = 0 CIRCUITPY_ZLIB = 0 MCU_SERIES = F4 diff --git a/ports/stm/common-hal/alarm/__init__.c b/ports/stm/common-hal/alarm/__init__.c index 466c2d5199..26099b0503 100644 --- a/ports/stm/common-hal/alarm/__init__.c +++ b/ports/stm/common-hal/alarm/__init__.c @@ -144,7 +144,10 @@ mp_obj_t common_hal_alarm_light_sleep_until_alarms(size_t n_alarms, const mp_obj return wake_alarm; } -void common_hal_alarm_set_deep_sleep_alarms(size_t n_alarms, const mp_obj_t *alarms) { +void common_hal_alarm_set_deep_sleep_alarms(size_t n_alarms, const mp_obj_t *alarms, size_t n_dios, digitalio_digitalinout_obj_t **preserve_dios) { + if (n_dios > 0) { + mp_raise_NotImplementedError_varg(translate("%q"), MP_QSTR_preserve_dios); + } _setup_sleep_alarms(true, n_alarms, alarms); } diff --git a/ports/stm/common-hal/alarm/time/TimeAlarm.c b/ports/stm/common-hal/alarm/time/TimeAlarm.c index 6fb1fc629d..2eb8ee4a81 100644 --- a/ports/stm/common-hal/alarm/time/TimeAlarm.c +++ b/ports/stm/common-hal/alarm/time/TimeAlarm.c @@ -84,7 +84,7 @@ void alarm_time_timealarm_set_alarms(bool deep_sleep, size_t n_alarms, const mp_ continue; } if (timealarm_set) { - mp_raise_ValueError(translate("Only one alarm.time alarm can be set.")); + mp_raise_ValueError(translate("Only one alarm.time alarm can be set")); } timealarm = MP_OBJ_TO_PTR(alarms[i]); timealarm_set = true; diff --git a/ports/stm/common-hal/analogio/AnalogIn.c b/ports/stm/common-hal/analogio/AnalogIn.c index ed2575493e..7bed932c71 100644 --- a/ports/stm/common-hal/analogio/AnalogIn.c +++ b/ports/stm/common-hal/analogio/AnalogIn.c @@ -27,7 +27,7 @@ #include "common-hal/analogio/AnalogIn.h" #include "py/runtime.h" -#include "supervisor/shared/translate.h" +#include "supervisor/shared/translate/translate.h" #include "shared-bindings/microcontroller/Pin.h" @@ -51,7 +51,7 @@ void common_hal_analogio_analogin_construct(analogio_analogin_obj_t *self, // No ADC function on pin if (pin->adc_unit == 0x00) { - mp_raise_ValueError(translate("Pin does not have ADC capabilities")); + raise_ValueError_invalid_pin(); } // TODO: add ADC traits to structure? @@ -65,7 +65,7 @@ void common_hal_analogio_analogin_construct(analogio_analogin_obj_t *self, LL_APB2_GRP1_EnableClock(LL_APB2_GRP1_PERIPH_ADC3); #endif } else { - mp_raise_ValueError(translate("Invalid ADC Unit value")); + mp_raise_RuntimeError(translate("Invalid ADC Unit value")); } common_hal_mcu_pin_claim(pin); self->pin = pin; @@ -147,7 +147,7 @@ uint16_t common_hal_analogio_analogin_get_value(analogio_analogin_obj_t *self) { ADCx = ADC3; #endif } else { - mp_raise_ValueError(translate("Invalid ADC Unit value")); + mp_raise_RuntimeError(translate("Invalid ADC Unit value")); } LL_GPIO_SetPinMode(pin_port(self->pin->port), (uint32_t)pin_mask(self->pin->number), LL_GPIO_MODE_ANALOG); @@ -204,8 +204,8 @@ uint16_t common_hal_analogio_analogin_get_value(analogio_analogin_obj_t *self) { uint16_t value = (uint16_t)HAL_ADC_GetValue(&AdcHandle); HAL_ADC_Stop(&AdcHandle); - // // Shift the value to be 16 bit. - return value << 4; + // Stretch 12-bit ADC reading to 16-bit range + return (value << 4) | (value >> 8); } float common_hal_analogio_analogin_get_reference_voltage(analogio_analogin_obj_t *self) { diff --git a/ports/stm/common-hal/analogio/AnalogOut.c b/ports/stm/common-hal/analogio/AnalogOut.c index 0320b1f99b..3c2860c9ad 100644 --- a/ports/stm/common-hal/analogio/AnalogOut.c +++ b/ports/stm/common-hal/analogio/AnalogOut.c @@ -33,7 +33,7 @@ #include "shared-bindings/analogio/AnalogOut.h" #include "shared-bindings/microcontroller/Pin.h" -#include "supervisor/shared/translate.h" +#include "supervisor/shared/translate/translate.h" #include "common-hal/microcontroller/Pin.h" @@ -65,7 +65,7 @@ void common_hal_analogio_analogout_construct(analogio_analogout_obj_t *self, self->channel = DAC_CHANNEL_2; self->dac_index = 1; } else { - mp_raise_ValueError(translate("Invalid DAC pin supplied")); + raise_ValueError_invalid_pin(); } // Only init if the shared DAC is empty or reset diff --git a/ports/stm/common-hal/busio/I2C.c b/ports/stm/common-hal/busio/I2C.c index 5ede538b12..4faa5ca2ef 100644 --- a/ports/stm/common-hal/busio/I2C.c +++ b/ports/stm/common-hal/busio/I2C.c @@ -31,7 +31,7 @@ #include "py/runtime.h" #include "shared-bindings/microcontroller/__init__.h" -#include "supervisor/shared/translate.h" +#include "supervisor/shared/translate/translate.h" #include "shared-bindings/microcontroller/Pin.h" // I2C timing specs for the H7 and F7 @@ -120,7 +120,7 @@ void common_hal_busio_i2c_construct(busio_i2c_obj_t *self, if (i2c_taken) { mp_raise_ValueError(translate("Hardware busy, try alternative pins")); } else { - mp_raise_ValueError_varg(translate("Invalid %q pin selection"), MP_QSTR_I2C); + raise_ValueError_invalid_pins(); } } @@ -155,7 +155,7 @@ void common_hal_busio_i2c_construct(busio_i2c_obj_t *self, } else if (frequency == 100000) { self->handle.Init.Timing = CPY_I2CSTANDARD_TIMINGR; } else { - mp_raise_ValueError(translate("Unsupported baudrate")); + mp_arg_error_invalid(MP_QSTR_frequency); } #else self->handle.Init.ClockSpeed = frequency; @@ -171,7 +171,7 @@ void common_hal_busio_i2c_construct(busio_i2c_obj_t *self, self->handle.Init.NoStretchMode = I2C_NOSTRETCH_DISABLE; self->handle.State = HAL_I2C_STATE_RESET; if (HAL_I2C_Init(&(self->handle)) != HAL_OK) { - mp_raise_RuntimeError(translate("I2C Init Error")); + mp_raise_RuntimeError(translate("I2C init error")); } common_hal_mcu_pin_claim(sda); common_hal_mcu_pin_claim(scl); diff --git a/ports/stm/common-hal/busio/SPI.c b/ports/stm/common-hal/busio/SPI.c index f7961f8cef..7886e18a0c 100644 --- a/ports/stm/common-hal/busio/SPI.c +++ b/ports/stm/common-hal/busio/SPI.c @@ -33,7 +33,7 @@ #include "shared-bindings/microcontroller/__init__.h" #include "supervisor/board.h" -#include "supervisor/shared/translate.h" +#include "supervisor/shared/translate/translate.h" #include "shared-bindings/microcontroller/Pin.h" // Note that any bugs introduced in this file can cause crashes at startup @@ -165,7 +165,7 @@ STATIC int check_pins(busio_spi_obj_t *self, if (spi_taken) { mp_raise_ValueError(translate("Hardware busy, try alternative pins")); } else { - mp_raise_ValueError_varg(translate("Invalid %q pin selection"), MP_QSTR_SPI); + raise_ValueError_invalid_pin(); } } @@ -206,6 +206,10 @@ void common_hal_busio_spi_construct(busio_spi_obj_t *self, spi_clock_enable(1 << (self->sck->periph_index - 1)); reserved_spi[self->sck->periph_index - 1] = true; + // Always start at 250khz which is what SD cards need. They are sensitive to + // SPI bus noise before they are put into SPI mode. + const uint32_t default_baudrate = 250000UL; + self->handle.Instance = SPIx; self->handle.Init.Mode = SPI_MODE_MASTER; // Direction change only required for RX-only, see RefMan RM0090:884 @@ -218,16 +222,16 @@ void common_hal_busio_spi_construct(busio_spi_obj_t *self, self->handle.Init.CLKPolarity = SPI_POLARITY_LOW; self->handle.Init.CLKPhase = SPI_PHASE_1EDGE; self->handle.Init.NSS = SPI_NSS_SOFT; - self->handle.Init.BaudRatePrescaler = SPI_BAUDRATEPRESCALER_256; + self->handle.Init.BaudRatePrescaler = stm32_baud_to_spi_div(default_baudrate, &self->prescaler, get_busclock(self->handle.Instance)); self->handle.Init.FirstBit = SPI_FIRSTBIT_MSB; self->handle.Init.TIMode = SPI_TIMODE_DISABLE; self->handle.Init.CRCCalculation = SPI_CRCCALCULATION_DISABLE; self->handle.Init.CRCPolynomial = 10; if (HAL_SPI_Init(&self->handle) != HAL_OK) { - mp_raise_ValueError(translate("SPI Init Error")); + mp_raise_ValueError(translate("SPI init error")); } - self->baudrate = (get_busclock(SPIx) / 16); - self->prescaler = 16; + self->baudrate = default_baudrate; + // self->prescaler = 16; // Initialised above by stm32_baud_to_spi_div self->half_duplex = half_duplex; self->polarity = 0; self->phase = 0; @@ -306,7 +310,7 @@ bool common_hal_busio_spi_configure(busio_spi_obj_t *self, get_busclock(self->handle.Instance)); if (HAL_SPI_Init(&self->handle) != HAL_OK) { - mp_raise_ValueError(translate("SPI Re-initialization error")); + mp_raise_RuntimeError(translate("SPI re-init")); } self->baudrate = baudrate; @@ -346,7 +350,7 @@ void common_hal_busio_spi_unlock(busio_spi_obj_t *self) { bool common_hal_busio_spi_write(busio_spi_obj_t *self, const uint8_t *data, size_t len) { if (self->mosi == NULL) { - mp_raise_ValueError(translate("No MOSI Pin")); + mp_raise_ValueError(translate("No MOSI pin")); } HAL_StatusTypeDef result = HAL_SPI_Transmit(&self->handle, (uint8_t *)data, (uint16_t)len, HAL_MAX_DELAY); return result == HAL_OK; @@ -355,9 +359,9 @@ bool common_hal_busio_spi_write(busio_spi_obj_t *self, bool common_hal_busio_spi_read(busio_spi_obj_t *self, uint8_t *data, size_t len, uint8_t write_value) { if (self->miso == NULL && !self->half_duplex) { - mp_raise_ValueError(translate("No MISO Pin")); + mp_raise_ValueError(translate("No MISO pin")); } else if (self->half_duplex && self->mosi == NULL) { - mp_raise_ValueError(translate("No MOSI Pin")); + mp_raise_ValueError(translate("No MOSI pin")); } HAL_StatusTypeDef result = HAL_OK; if ((!self->half_duplex && self->mosi == NULL) || (self->half_duplex && self->mosi != NULL && self->miso == NULL)) { @@ -372,7 +376,7 @@ bool common_hal_busio_spi_read(busio_spi_obj_t *self, bool common_hal_busio_spi_transfer(busio_spi_obj_t *self, const uint8_t *data_out, uint8_t *data_in, size_t len) { if (self->miso == NULL || self->mosi == NULL) { - mp_raise_ValueError(translate("Missing MISO or MOSI Pin")); + mp_raise_ValueError(translate("Missing MISO or MOSI pin")); } HAL_StatusTypeDef result = HAL_SPI_TransmitReceive(&self->handle, (uint8_t *)data_out, data_in, (uint16_t)len,HAL_MAX_DELAY); @@ -381,7 +385,7 @@ bool common_hal_busio_spi_transfer(busio_spi_obj_t *self, uint32_t common_hal_busio_spi_get_frequency(busio_spi_obj_t *self) { // returns actual frequency - uint32_t result = HAL_RCC_GetPCLK2Freq() / self->prescaler; + uint32_t result = get_busclock(self->handle.Instance) / self->prescaler; return result; } diff --git a/ports/stm/common-hal/busio/UART.c b/ports/stm/common-hal/busio/UART.c index 7e35ad86dd..48894db5f9 100644 --- a/ports/stm/common-hal/busio/UART.c +++ b/ports/stm/common-hal/busio/UART.c @@ -35,7 +35,7 @@ #include "py/mperrno.h" #include "py/runtime.h" #include "py/stream.h" -#include "supervisor/shared/translate.h" +#include "supervisor/shared/translate/translate.h" #define ALL_UARTS 0xFFFF @@ -58,7 +58,7 @@ STATIC USART_TypeDef *assign_uart_or_throw(busio_uart_obj_t *self, bool pin_eval if (uart_taken) { mp_raise_ValueError(translate("Hardware in use, try alternative pins")); } else { - mp_raise_ValueError_varg(translate("Invalid %q pin selection"), MP_QSTR_UART); + raise_ValueError_invalid_pin(); } } } @@ -93,7 +93,7 @@ void common_hal_busio_uart_construct(busio_uart_obj_t *self, uint8_t periph_index = 0; // origin 0 corrected if ((rts != NULL) || (cts != NULL) || (rs485_dir != NULL) || (rs485_invert == true)) { - mp_raise_ValueError(translate("RTS/CTS/RS485 Not yet supported on this device")); + mp_raise_NotImplementedError(translate("RS485")); } // Can have both pins, or either @@ -164,14 +164,11 @@ void common_hal_busio_uart_construct(busio_uart_obj_t *self, } // Other errors - if (receiver_buffer_size == 0) { - mp_raise_ValueError(translate("Invalid buffer size")); - } - if (bits != 8 && bits != 9) { - mp_raise_ValueError(translate("Invalid word/bit length")); - } + mp_arg_validate_length_min(receiver_buffer_size, 1, MP_QSTR_receiver_buffer_size); + mp_arg_validate_int_range(bits, 8, 9, MP_QSTR_bits); + if (USARTx == NULL) { // this can only be hit if the periph file is wrong - mp_raise_ValueError(translate("Internal define error")); + mp_raise_RuntimeError(translate("Internal define error")); } // GPIO Init @@ -211,17 +208,24 @@ void common_hal_busio_uart_construct(busio_uart_obj_t *self, self->handle.Init.HwFlowCtl = UART_HWCONTROL_NONE; self->handle.Init.OverSampling = UART_OVERSAMPLING_16; if (HAL_UART_Init(&self->handle) != HAL_OK) { - mp_raise_ValueError(translate("UART Init Error")); + mp_raise_RuntimeError(translate("UART init")); } // Init buffer for rx and claim pins if (self->rx != NULL) { + // Use the provided buffer when given. if (receiver_buffer != NULL) { - self->ringbuf = (ringbuf_t) { receiver_buffer, receiver_buffer_size }; + ringbuf_init(&self->ringbuf, receiver_buffer, receiver_buffer_size); } else { + // Initially allocate the UART's buffer in the long-lived part of the + // heap. UARTs are generally long-lived objects, but the "make long- + // lived" machinery is incapable of moving internal pointers like + // self->buffer, so do it manually. (However, as long as internal + // pointers like this are NOT moved, allocating the buffer + // in the long-lived pool is not strictly necessary) if (!ringbuf_alloc(&self->ringbuf, receiver_buffer_size, true)) { - mp_raise_ValueError(translate("UART Buffer allocation error")); + m_malloc_fail(receiver_buffer_size); } } common_hal_mcu_pin_claim(rx); @@ -235,7 +239,7 @@ void common_hal_busio_uart_construct(busio_uart_obj_t *self, // start the interrupt series if ((HAL_UART_GetState(&self->handle) & HAL_UART_STATE_BUSY_RX) == HAL_UART_STATE_BUSY_RX) { - mp_raise_ValueError(translate("Could not start interrupt, RX busy")); + mp_raise_RuntimeError(translate("Could not start interrupt, RX busy")); } // start the receive interrupt chain @@ -284,7 +288,7 @@ void common_hal_busio_uart_deinit(busio_uart_obj_t *self) { self->rx = NULL; } - ringbuf_free(&self->ringbuf); + ringbuf_deinit(&self->ringbuf); } size_t common_hal_busio_uart_read(busio_uart_obj_t *self, uint8_t *data, size_t len, int *errcode) { @@ -338,7 +342,7 @@ size_t common_hal_busio_uart_write(busio_uart_obj_t *self, const uint8_t *data, Status = HAL_UART_GetState(&self->handle); } } else { - mp_raise_ValueError(translate("UART write error")); + mp_raise_RuntimeError(translate("UART write")); } return len; @@ -408,11 +412,11 @@ void common_hal_busio_uart_set_baudrate(busio_uart_obj_t *self, uint32_t baudrat // Otherwise de-init and set new rate if (HAL_UART_DeInit(&self->handle) != HAL_OK) { - mp_raise_ValueError(translate("UART De-init error")); + mp_raise_RuntimeError(translate("UART de-init")); } self->handle.Init.BaudRate = baudrate; if (HAL_UART_Init(&self->handle) != HAL_OK) { - mp_raise_ValueError(translate("UART Re-init error")); + mp_raise_RuntimeError(translate("UART re-init")); } self->baudrate = baudrate; diff --git a/ports/stm/common-hal/canio/CAN.c b/ports/stm/common-hal/canio/CAN.c index 74ff7f964b..992745b80a 100644 --- a/ports/stm/common-hal/canio/CAN.c +++ b/ports/stm/common-hal/canio/CAN.c @@ -59,13 +59,13 @@ void common_hal_canio_can_construct(canio_can_obj_t *self, const mcu_pin_obj_t * const mcu_periph_obj_t *mcu_tx = find_pin_function(mcu_can_tx_list, can_tx_len, tx, -1); if (!mcu_tx) { - mp_raise_ValueError_varg(translate("Invalid %q pin selection"), MP_QSTR_tx); + raise_ValueError_invalid_pin_name(MP_QSTR_tx); } int periph_index = mcu_tx->periph_index; const mcu_periph_obj_t *mcu_rx = find_pin_function(mcu_can_rx_list, can_rx_len, rx, periph_index); if (!mcu_rx) { - mp_raise_ValueError_varg(translate("Invalid %q pin selection"), MP_QSTR_rx); + raise_ValueError_invalid_pin_name(MP_QSTR_rx); } if (reserved_can[periph_index]) { diff --git a/ports/stm/common-hal/digitalio/DigitalInOut.c b/ports/stm/common-hal/digitalio/DigitalInOut.c index 39c72b73c9..58f81b43b6 100644 --- a/ports/stm/common-hal/digitalio/DigitalInOut.c +++ b/ports/stm/common-hal/digitalio/DigitalInOut.c @@ -28,7 +28,7 @@ #include "shared-bindings/digitalio/DigitalInOut.h" #include "shared-bindings/microcontroller/Pin.h" #include "py/runtime.h" -#include "supervisor/shared/translate.h" +#include "supervisor/shared/translate/translate.h" // The HAL is sparse on obtaining register information, so we use the LLs here. #if (CPY_STM32H7) @@ -77,7 +77,7 @@ void common_hal_digitalio_digitalinout_deinit(digitalio_digitalinout_obj_t *self self->pin = NULL; } -void common_hal_digitalio_digitalinout_switch_to_input( +digitalinout_result_t common_hal_digitalio_digitalinout_switch_to_input( digitalio_digitalinout_obj_t *self, digitalio_pull_t pull) { GPIO_InitTypeDef GPIO_InitStruct = {0}; @@ -88,6 +88,7 @@ void common_hal_digitalio_digitalinout_switch_to_input( HAL_GPIO_Init(pin_port(self->pin->port), &GPIO_InitStruct); common_hal_digitalio_digitalinout_set_pull(self, pull); + return DIGITALINOUT_OK; } digitalinout_result_t common_hal_digitalio_digitalinout_switch_to_output( @@ -138,7 +139,7 @@ digitalio_drive_mode_t common_hal_digitalio_digitalinout_get_drive_mode( == LL_GPIO_OUTPUT_OPENDRAIN ? DRIVE_MODE_OPEN_DRAIN : DRIVE_MODE_PUSH_PULL; } -void common_hal_digitalio_digitalinout_set_pull( +digitalinout_result_t common_hal_digitalio_digitalinout_set_pull( digitalio_digitalinout_obj_t *self, digitalio_pull_t pull) { switch (pull) { @@ -154,6 +155,7 @@ void common_hal_digitalio_digitalinout_set_pull( default: break; } + return DIGITALINOUT_OK; } digitalio_pull_t common_hal_digitalio_digitalinout_get_pull( diff --git a/ports/stm/common-hal/microcontroller/Processor.c b/ports/stm/common-hal/microcontroller/Processor.c index 13c661a60a..67cf9a73e4 100644 --- a/ports/stm/common-hal/microcontroller/Processor.c +++ b/ports/stm/common-hal/microcontroller/Processor.c @@ -32,7 +32,7 @@ #endif #include "common-hal/microcontroller/Processor.h" #include "shared-bindings/microcontroller/ResetReason.h" -#include "supervisor/shared/translate.h" +#include "supervisor/shared/translate/translate.h" #include STM32_HAL_H diff --git a/ports/stm/common-hal/microcontroller/__init__.c b/ports/stm/common-hal/microcontroller/__init__.c index 3bb850f5d3..c399951f54 100644 --- a/ports/stm/common-hal/microcontroller/__init__.c +++ b/ports/stm/common-hal/microcontroller/__init__.c @@ -36,7 +36,7 @@ #include "shared-bindings/microcontroller/__init__.h" #include "shared-bindings/microcontroller/Pin.h" #include "shared-bindings/microcontroller/Processor.h" - +#include "supervisor/port.h" #include "supervisor/filesystem.h" #include "supervisor/shared/safe_mode.h" @@ -73,15 +73,25 @@ void common_hal_mcu_enable_interrupts(void) { __enable_irq(); } +static bool next_reset_to_bootloader = false; + void common_hal_mcu_on_next_reset(mcu_runmode_t runmode) { if (runmode == RUNMODE_SAFE_MODE) { safe_mode_on_next_reset(PROGRAMMATIC_SAFE_MODE); } + if (runmode == RUNMODE_BOOTLOADER) { + next_reset_to_bootloader = true; + } } void common_hal_mcu_reset(void) { filesystem_flush(); // TODO: implement as part of flash improvements - NVIC_SystemReset(); + + if (next_reset_to_bootloader) { + reset_to_bootloader(); + } else { + NVIC_SystemReset(); + } } // The singleton microcontroller.Processor object, bound to microcontroller.cpu diff --git a/ports/stm/common-hal/pulseio/PulseIn.c b/ports/stm/common-hal/pulseio/PulseIn.c index b8fbd9a36b..1c323ad711 100644 --- a/ports/stm/common-hal/pulseio/PulseIn.c +++ b/ports/stm/common-hal/pulseio/PulseIn.c @@ -123,8 +123,7 @@ void common_hal_pulseio_pulsein_construct(pulseio_pulsein_obj_t *self, const mcu self->buffer = (uint16_t *)m_malloc(maxlen * sizeof(uint16_t), false); if (self->buffer == NULL) { // TODO: free the EXTI here? - mp_raise_msg_varg(&mp_type_MemoryError, translate("Failed to allocate RX buffer of %d bytes"), - maxlen * sizeof(uint16_t)); + m_malloc_fail(maxlen * sizeof(uint16_t)); } // Set internal variables @@ -257,7 +256,7 @@ uint16_t common_hal_pulseio_pulsein_get_item(pulseio_pulsein_obj_t *self, int16_ } if (index < 0 || index >= self->len) { stm_peripherals_exti_enable(self->pin->number); - mp_raise_IndexError_varg(translate("%q index out of range"), MP_QSTR_PulseIn); + mp_raise_IndexError_varg(translate("%q out of range"), MP_QSTR_index); } uint16_t value = self->buffer[(self->start + index) % self->maxlen]; stm_peripherals_exti_enable(self->pin->number); diff --git a/ports/stm/common-hal/pulseio/PulseOut.c b/ports/stm/common-hal/pulseio/PulseOut.c index fe3caa08b2..7725d8cdde 100644 --- a/ports/stm/common-hal/pulseio/PulseOut.c +++ b/ports/stm/common-hal/pulseio/PulseOut.c @@ -33,7 +33,7 @@ #include "py/runtime.h" #include "shared-bindings/pulseio/PulseOut.h" #include "shared-bindings/pwmio/PWMOut.h" -#include "supervisor/shared/translate.h" +#include "supervisor/shared/translate/translate.h" #include STM32_HAL_H #include "shared-bindings/microcontroller/Pin.h" diff --git a/ports/stm/common-hal/pwmio/PWMOut.c b/ports/stm/common-hal/pwmio/PWMOut.c index e5dc18cd79..45f00b901b 100644 --- a/ports/stm/common-hal/pwmio/PWMOut.c +++ b/ports/stm/common-hal/pwmio/PWMOut.c @@ -29,7 +29,7 @@ #include "py/runtime.h" #include "common-hal/pwmio/PWMOut.h" #include "shared-bindings/pwmio/PWMOut.h" -#include "supervisor/shared/translate.h" +#include "supervisor/shared/translate/translate.h" #include "shared-bindings/microcontroller/__init__.h" #include STM32_HAL_H @@ -279,16 +279,16 @@ void common_hal_pwmio_pwmout_set_frequency(pwmio_pwmout_obj_t *self, uint32_t fr // restart everything, adjusting for new speed if (HAL_TIM_PWM_Init(&self->handle) != HAL_OK) { - mp_raise_ValueError(translate("Could not re-init timer")); + mp_raise_RuntimeError(translate("timer re-init")); } self->chan_handle.Pulse = timer_get_internal_duty(self->duty_cycle, period); if (HAL_TIM_PWM_ConfigChannel(&self->handle, &self->chan_handle, self->channel) != HAL_OK) { - mp_raise_ValueError(translate("Could not re-init channel")); + mp_raise_RuntimeError(translate("channel re-init")); } if (HAL_TIM_PWM_Start(&self->handle, self->channel) != HAL_OK) { - mp_raise_ValueError(translate("Could not restart PWM")); + mp_raise_RuntimeError(translate("PWM restart")); } tim_frequencies[self->tim->tim_index] = frequency; diff --git a/ports/stm/common-hal/rtc/RTC.c b/ports/stm/common-hal/rtc/RTC.c new file mode 100644 index 0000000000..48c47fda8c --- /dev/null +++ b/ports/stm/common-hal/rtc/RTC.c @@ -0,0 +1,54 @@ +/* + * This file is part of the MicroPython project, http://micropython.org/ + * + * The MIT License (MIT) + * + * Copyright (c) 20212 Matthew McGowan for Blues Wireless Inc + * + * Permission is hereby granted, free of charge, to any person obtaining a copy + * of this software and associated documentation files (the "Software"), to deal + * in the Software without restriction, including without limitation the rights + * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell + * copies of the Software, and to permit persons to whom the Software is + * furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice shall be included in + * all copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE + * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER + * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, + * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN + * THE SOFTWARE. + */ + +#include + +#include "py/obj.h" +#include "py/runtime.h" +#include "shared/timeutils/timeutils.h" +#include "shared-bindings/rtc/__init__.h" +#include "common-hal/rtc/RTC.h" +#include "shared-bindings/rtc/RTC.h" +#include "supervisor/port.h" +#include "supervisor/shared/translate/translate.h" +#include "peripherals/rtc.h" + + +void common_hal_rtc_set_time(timeutils_struct_time_t *tm) { + stm32_peripherals_rtc_set_time(tm); +} + +void common_hal_rtc_get_time(timeutils_struct_time_t *tm) { + stm32_peripherals_rtc_get_time(tm); +} + +int common_hal_rtc_get_calibration(void) { + return 0; +} + +void common_hal_rtc_set_calibration(int calibration) { + mp_raise_NotImplementedError_varg(translate("%q"), MP_QSTR_calibration); +} diff --git a/ports/stm/common-hal/rtc/RTC.h b/ports/stm/common-hal/rtc/RTC.h new file mode 100644 index 0000000000..d0ba720bfc --- /dev/null +++ b/ports/stm/common-hal/rtc/RTC.h @@ -0,0 +1,33 @@ +/* + * This file is part of the MicroPython project, http://micropython.org/ + * + * The MIT License (MIT) + * + * Copyright (c) 2022 Matthew McGowan for Blues Wireless Inc + * + * 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_STM_COMMON_HAL_RTC_RTC_H +#define MICROPY_INCLUDED_STM_COMMON_HAL_RTC_RTC_H + +extern void rtc_init(void); +extern void rtc_reset(void); + +#endif // MICROPY_INCLUDED_STM_COMMON_HAL_RTC_RTC_H diff --git a/ports/stm/common-hal/rtc/__init__.c b/ports/stm/common-hal/rtc/__init__.c new file mode 100644 index 0000000000..e69de29bb2 diff --git a/ports/stm/common-hal/rtc/__init__.h b/ports/stm/common-hal/rtc/__init__.h new file mode 100644 index 0000000000..e69de29bb2 diff --git a/ports/stm/common-hal/sdioio/SDCard.c b/ports/stm/common-hal/sdioio/SDCard.c index c7472a459f..8eeae2781d 100644 --- a/ports/stm/common-hal/sdioio/SDCard.c +++ b/ports/stm/common-hal/sdioio/SDCard.c @@ -32,7 +32,7 @@ #include "shared-bindings/microcontroller/__init__.h" #include "shared-bindings/util.h" #include "supervisor/board.h" -#include "supervisor/shared/translate.h" +#include "supervisor/shared/translate/translate.h" #include "common-hal/microcontroller/Pin.h" #include "shared-bindings/microcontroller/Pin.h" @@ -115,7 +115,7 @@ STATIC int check_pins(sdioio_sdcard_obj_t *self, if (sdio_taken) { mp_raise_ValueError(translate("Hardware busy, try alternative pins")); } else { - mp_raise_ValueError_varg(translate("Invalid %q pin selection"), MP_QSTR_SDIO); + raise_ValueError_invalid_pin(); } } diff --git a/ports/stm/mpconfigport.mk b/ports/stm/mpconfigport.mk index ba383d41d2..cb578e76e2 100644 --- a/ports/stm/mpconfigport.mk +++ b/ports/stm/mpconfigport.mk @@ -10,6 +10,10 @@ ifeq ($(MCU_VARIANT),$(filter $(MCU_VARIANT),STM32F405xx STM32F407xx)) USB_NUM_ENDPOINT_PAIRS = 4 endif +ifeq ($(MCU_VARIANT),STM32F407xx) + UF2_FAMILY_ID ?= 0x6d0922fa +endif + ifeq ($(MCU_SERIES),F4) # Audio via PWM CIRCUITPY_AUDIOIO = 0 @@ -20,11 +24,12 @@ ifeq ($(MCU_SERIES),F4) CIRCUITPY_AUDIOBUSIO ?= 0 CIRCUITPY_COUNTIO ?= 0 CIRCUITPY_FREQUENCYIO ?= 0 - CIRCUITPY_I2CPERIPHERAL ?= 0 + CIRCUITPY_I2CTARGET ?= 0 CIRCUITPY_NVM ?= 0 CIRCUITPY_ROTARYIO ?= 0 - CIRCUITPY_RTC ?= 0 + CIRCUITPY_RTC ?= 1 USB_NUM_ENDPOINT_PAIRS = 4 + UF2_FAMILY_ID ?= 0x57755a57 endif ifeq ($(MCU_SERIES),H7) @@ -34,15 +39,16 @@ ifeq ($(MCU_SERIES),H7) CIRCUITPY_AUDIOIO ?= 0 CIRCUITPY_COUNTIO ?= 0 CIRCUITPY_FREQUENCYIO ?= 0 - CIRCUITPY_I2CPERIPHERAL ?= 0 + CIRCUITPY_I2CTARGET ?= 0 CIRCUITPY_NEOPIXEL_WRITE ?= 0 CIRCUITPY_NVM ?= 0 CIRCUITPY_PULSEIO ?= 0 CIRCUITPY_PWMIO ?= 0 CIRCUITPY_ROTARYIO ?= 0 - CIRCUITPY_RTC ?= 0 + CIRCUITPY_RTC ?= 1 USB_NUM_ENDPOINT_PAIRS = 9 + UF2_FAMILY_ID ?= 0x6db66082 endif ifeq ($(MCU_SERIES),F7) @@ -52,13 +58,14 @@ ifeq ($(MCU_SERIES),F7) CIRCUITPY_AUDIOIO ?= 0 CIRCUITPY_COUNTIO ?= 0 CIRCUITPY_FREQUENCYIO ?= 0 - CIRCUITPY_I2CPERIPHERAL ?= 0 + CIRCUITPY_I2CTARGET ?= 0 CIRCUITPY_NEOPIXEL_WRITE ?= 0 CIRCUITPY_NVM ?= 0 CIRCUITPY_ROTARYIO ?= 0 - CIRCUITPY_RTC ?= 0 + CIRCUITPY_RTC ?= 1 USB_NUM_ENDPOINT_PAIRS = 6 + UF2_FAMILY_ID ?= 0x53b80f00 endif ifeq ($(MCU_SERIES),L4) @@ -68,15 +75,17 @@ ifeq ($(MCU_SERIES),L4) CIRCUITPY_AUDIOIO ?= 0 CIRCUITPY_COUNTIO ?= 0 CIRCUITPY_FREQUENCYIO ?= 0 - CIRCUITPY_I2CPERIPHERAL ?= 0 + CIRCUITPY_I2CTARGET ?= 0 CIRCUITPY_NEOPIXEL_WRITE ?= 0 CIRCUITPY_NVM ?= 0 CIRCUITPY_ROTARYIO ?= 0 - CIRCUITPY_RTC ?= 0 + CIRCUITPY_RTC ?= 1 # todo - this varies between devices in the series # This slide deck https://www.st.com/content/ccc/resource/training/technical/product_training/98/89/c8/6c/3e/e9/49/79/STM32L4_Peripheral_USB.pdf/files/STM32L4_Peripheral_USB.pdf/jcr:content/translations/en.STM32L4_Peripheral_USB.pdf # cites 16 endpoints, 8 endpoint pairs, while section 3.39 of the L4R5 datasheet states 6 endpoint pairs. USB_NUM_ENDPOINT_PAIRS = 6 + UF2_FAMILY_ID ?= 0x00ff6919 endif CIRCUITPY_PARALLELDISPLAY := 0 +CIRCUITPY_BUILD_EXTENSIONS ?= bin diff --git a/ports/stm/peripherals/periph.h b/ports/stm/peripherals/periph.h index caf4ca1324..1049aeb084 100644 --- a/ports/stm/peripherals/periph.h +++ b/ports/stm/peripherals/periph.h @@ -119,6 +119,13 @@ typedef struct { #include "stm32f4/stm32f407xx/periph.h" #endif +#ifdef STM32F446xx +#define HAS_DAC 0 +#define HAS_TRNG 0 +#define HAS_BASIC_TIM 0 +#include "stm32f4/stm32f446xx/periph.h" +#endif + // F7 Series #ifdef STM32F746xx diff --git a/ports/stm/peripherals/pins.h b/ports/stm/peripherals/pins.h index 37aa2d8feb..a53b05aa1d 100644 --- a/ports/stm/peripherals/pins.h +++ b/ports/stm/peripherals/pins.h @@ -97,6 +97,9 @@ extern const mp_obj_type_t mcu_pin_type; #ifdef STM32F407xx #include "stm32f4/stm32f407xx/pins.h" #endif +#ifdef STM32F446xx +#include "stm32f4/stm32f446xx/pins.h" +#endif // F7 Series #ifdef STM32F746xx diff --git a/ports/stm/peripherals/rtc.c b/ports/stm/peripherals/rtc.c index 9b0eb399c2..bd65ccbf17 100644 --- a/ports/stm/peripherals/rtc.c +++ b/ports/stm/peripherals/rtc.c @@ -4,6 +4,7 @@ * The MIT License (MIT) * * Copyright (c) 2021 Lucian Copeland for Adafruit Industries + * Copyright (c) 2022 Matthew McGowan for Blues Wireless Inc * * Permission is hereby granted, free of charge, to any person obtaining a copy * of this software and associated documentation files (the "Software"), to deal @@ -76,6 +77,46 @@ void stm32_peripherals_rtc_init(void) { HAL_NVIC_EnableIRQ(RTC_Alarm_IRQn); } +#if CIRCUITPY_RTC +void stm32_peripherals_rtc_get_time(timeutils_struct_time_t *tm) { + RTC_DateTypeDef date = {0}; + RTC_TimeTypeDef time = {0}; + + int code; + if ((code = HAL_RTC_GetTime(&hrtc, &time, RTC_FORMAT_BIN)) == HAL_OK && + (code = HAL_RTC_GetDate(&hrtc, &date, RTC_FORMAT_BIN)) == HAL_OK) { + tm->tm_hour = time.Hours; + tm->tm_min = time.Minutes; + tm->tm_sec = time.Seconds; + tm->tm_wday = date.WeekDay - 1; + tm->tm_mday = date.Date; + tm->tm_mon = date.Month; + tm->tm_year = date.Year + 2000; + tm->tm_yday = -1; + } +} + +void stm32_peripherals_rtc_set_time(timeutils_struct_time_t *tm) { + RTC_DateTypeDef date = {0}; + RTC_TimeTypeDef time = {0}; + + time.Hours = tm->tm_hour; + time.Minutes = tm->tm_min; + time.Seconds = tm->tm_sec; + date.WeekDay = tm->tm_wday + 1; + date.Date = tm->tm_mday; + date.Month = tm->tm_mon; + date.Year = tm->tm_year - 2000; + time.DayLightSaving = RTC_DAYLIGHTSAVING_NONE; + time.StoreOperation = RTC_STOREOPERATION_RESET; + + if (HAL_RTC_SetTime(&hrtc, &time, RTC_FORMAT_BIN) != HAL_OK || + HAL_RTC_SetDate(&hrtc, &date, RTC_FORMAT_BIN) != HAL_OK) { + // todo - throw an exception + } +} +#endif + // This function is called often for timing so we cache the seconds elapsed computation based on the // register value. The STM HAL always does shifts and conversion if we use it directly. uint64_t stm32_peripherals_rtc_raw_ticks(uint8_t *subticks) { diff --git a/ports/stm/peripherals/rtc.h b/ports/stm/peripherals/rtc.h index 65cae14d1c..474cba1881 100644 --- a/ports/stm/peripherals/rtc.h +++ b/ports/stm/peripherals/rtc.h @@ -4,6 +4,7 @@ * The MIT License (MIT) * * Copyright (c) 2021 Lucian Copeland for Adafruit Industries + * Copyright (c) 2022 Matthew McGowan for Blues Wireless Inc * * Permission is hereby granted, free of charge, to any person obtaining a copy * of this software and associated documentation files (the "Software"), to deal @@ -48,4 +49,10 @@ void stm32_peripherals_rtc_assign_alarm_callback(uint8_t alarm_idx, void (*callb void stm32_peripherals_rtc_set_alarm(uint8_t alarm_idx, uint32_t ticks); bool stm32_peripherals_rtc_alarm_triggered(uint8_t alarm_idx); +#if CIRCUITPY_RTC +typedef struct _timeutils_struct_time_t timeutils_struct_time_t; +void stm32_peripherals_rtc_get_time(timeutils_struct_time_t *tm); +void stm32_peripherals_rtc_set_time(timeutils_struct_time_t *tm); +#endif + #endif // __MICROPY_INCLUDED_STM32_PERIPHERALS_RTC_H__ diff --git a/ports/stm/peripherals/stm32f4/clocks.c b/ports/stm/peripherals/stm32f4/clocks.c index f3434a944b..a2f8344901 100644 --- a/ports/stm/peripherals/stm32f4/clocks.c +++ b/ports/stm/peripherals/stm32f4/clocks.c @@ -47,11 +47,14 @@ #ifdef STM32F407xx #include "stm32f4/stm32f407xx/clocks.h" #endif +#ifdef STM32F446xx +#include "stm32f4/stm32f446xx/clocks.h" +#endif void stm32_peripherals_clocks_init(void) { - RCC_ClkInitTypeDef RCC_ClkInitStruct; - RCC_OscInitTypeDef RCC_OscInitStruct; - RCC_PeriphCLKInitTypeDef PeriphClkInitStruct; + RCC_ClkInitTypeDef RCC_ClkInitStruct = {0}; + RCC_OscInitTypeDef RCC_OscInitStruct = {0}; + RCC_PeriphCLKInitTypeDef PeriphClkInitStruct = {0}; // Set voltage scaling in accordance with system clock speed __HAL_RCC_PWR_CLK_ENABLE(); diff --git a/ports/stm/peripherals/stm32f4/stm32f446xx/clocks.h b/ports/stm/peripherals/stm32f4/stm32f446xx/clocks.h new file mode 100644 index 0000000000..2cd4b59c75 --- /dev/null +++ b/ports/stm/peripherals/stm32f4/stm32f446xx/clocks.h @@ -0,0 +1,66 @@ +/* + * This file is part of the Micro Python project, http://micropython.org/ + * + * The MIT License (MIT) + * + * Copyright (c) 2022 flom84 + * + * 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 "stm32f4xx_hal.h" + +// Chip: STM32F446xC/xV +// Line Type: Access Line +// Speed: 168MHz (max 180MHz) + +// Defaults: +#ifndef CPY_CLK_VSCALE +#define CPY_CLK_VSCALE (PWR_REGULATOR_VOLTAGE_SCALE1) +#endif +#ifndef CPY_CLK_PLLM +#define CPY_CLK_PLLM (8) +#endif +#ifndef CPY_CLK_PLLN +#define CPY_CLK_PLLN (336) +#endif +#ifndef CPY_CLK_PLLP +#define CPY_CLK_PLLP (RCC_PLLP_DIV2) +#endif +#ifndef CPY_CLK_PLLQ +#define CPY_CLK_PLLQ (7) +#endif +#ifndef CPY_CLK_AHBDIV +#define CPY_CLK_AHBDIV (RCC_SYSCLK_DIV1) +#endif +#ifndef CPY_CLK_APB1DIV +#define CPY_CLK_APB1DIV (RCC_HCLK_DIV4) +#endif +#ifndef CPY_CLK_APB2DIV +#define CPY_CLK_APB2DIV (RCC_HCLK_DIV2) +#endif +#ifndef CPY_CLK_FLASH_LATENCY +#define CPY_CLK_FLASH_LATENCY (FLASH_LATENCY_5) +#endif +#ifndef CPY_CLK_USB_USES_AUDIOPLL +#define CPY_CLK_USB_USES_AUDIOPLL (0) +#endif +#ifndef BOARD_HSE_SOURCE +#define BOARD_HSE_SOURCE (RCC_HSE_ON) +#endif diff --git a/ports/espressif/modules/wroom.c b/ports/stm/peripherals/stm32f4/stm32f446xx/gpio.c similarity index 63% rename from ports/espressif/modules/wroom.c rename to ports/stm/peripherals/stm32f4/stm32f446xx/gpio.c index 5e530701bf..624eb319f4 100644 --- a/ports/espressif/modules/wroom.c +++ b/ports/stm/peripherals/stm32f4/stm32f446xx/gpio.c @@ -3,7 +3,7 @@ * * The MIT License (MIT) * - * Copyright (c) 2020 Scott Shawcroft for Adafruit Industries + * Copyright (c) 2022 flom84 * * Permission is hereby granted, free of charge, to any person obtaining a copy * of this software and associated documentation files (the "Software"), to deal @@ -24,14 +24,24 @@ * THE SOFTWARE. */ -#include "modules/module.h" +#include "peripherals/gpio.h" +#include "stm32f4xx_hal.h" +#include "common-hal/microcontroller/Pin.h" -void never_reset_module_internal_pins(void) { - // SPI Flash - common_hal_never_reset_pin(&pin_GPIO27); - common_hal_never_reset_pin(&pin_GPIO28); - common_hal_never_reset_pin(&pin_GPIO29); - common_hal_never_reset_pin(&pin_GPIO30); - common_hal_never_reset_pin(&pin_GPIO31); - common_hal_never_reset_pin(&pin_GPIO32); +void stm32_peripherals_gpio_init(void) { + // * GPIO Ports Clock Enable */ + __HAL_RCC_GPIOC_CLK_ENABLE(); + __HAL_RCC_GPIOH_CLK_ENABLE(); + __HAL_RCC_GPIOA_CLK_ENABLE(); + __HAL_RCC_GPIOB_CLK_ENABLE(); + + // Never reset pins + never_reset_pin_number(2, 13); // PC13 anti tamp + never_reset_pin_number(2, 14); // PC14 OSC32_IN + never_reset_pin_number(2, 15); // PC15 OSC32_OUT + never_reset_pin_number(0, 13); // PA13 SWDIO + never_reset_pin_number(0, 14); // PA14 SWCLK +} + +void stm32f4_peripherals_status_led(uint8_t led, uint8_t state) { } diff --git a/ports/stm/peripherals/stm32f4/stm32f446xx/periph.c b/ports/stm/peripherals/stm32f4/stm32f446xx/periph.c new file mode 100644 index 0000000000..5287a8bdf0 --- /dev/null +++ b/ports/stm/peripherals/stm32f4/stm32f446xx/periph.c @@ -0,0 +1,129 @@ +/* + * This file is part of the MicroPython project, http://micropython.org/ + * + * The MIT License (MIT) + * + * Copyright (c) 2022 flom84 + * + * 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/obj.h" +#include "py/mphal.h" +#include "peripherals/pins.h" +#include "peripherals/periph.h" + +// I2C +I2C_TypeDef *mcu_i2c_banks[3] = {I2C1, I2C2, I2C3}; + +const mcu_periph_obj_t mcu_i2c_sda_list[3] = { + PERIPH(1, 4, &pin_PB07), + PERIPH(2, 4, &pin_PB03), + PERIPH(3, 4, &pin_PB04), +}; + +const mcu_periph_obj_t mcu_i2c_scl_list[3] = { + PERIPH(1, 4, &pin_PB06), + PERIPH(2, 4, &pin_PB10), + PERIPH(3, 4, &pin_PA08), +}; + +// SPI +SPI_TypeDef *mcu_spi_banks[3] = {SPI1, SPI2, SPI3}; + +const mcu_periph_obj_t mcu_spi_sck_list[3] = { + PERIPH(1, 5, &pin_PA05), + PERIPH(2, 5, &pin_PB13), + PERIPH(3, 6, &pin_PB03), +}; + +const mcu_periph_obj_t mcu_spi_mosi_list[3] = { + PERIPH(1, 5, &pin_PA07), + PERIPH(2, 5, &pin_PB15), + PERIPH(3, 6, &pin_PB05), + +}; + +const mcu_periph_obj_t mcu_spi_miso_list[3] = { + PERIPH(1, 5, &pin_PA06), + PERIPH(2, 5, &pin_PB14), + PERIPH(3, 6, &pin_PB04), +}; + +const mcu_periph_obj_t mcu_spi_nss_list[3] = { + PERIPH(1, 5, &pin_PA04), + PERIPH(2, 5, &pin_PB12), + PERIPH(3, 6, &pin_PA15), +}; + +USART_TypeDef *mcu_uart_banks[MAX_UART] = {USART1, USART2, USART3, NULL, NULL, NULL}; +bool mcu_uart_has_usart[MAX_UART] = {false, false, false, true, true, false}; + +const mcu_periph_obj_t mcu_uart_tx_list[3] = { + PERIPH(1, 7, &pin_PB06), + PERIPH(2, 7, &pin_PA02), + PERIPH(3, 7, &pin_PC10), + +}; + +const mcu_periph_obj_t mcu_uart_rx_list[3] = { + PERIPH(1, 7, &pin_PB07), + PERIPH(2, 7, &pin_PA03), + PERIPH(3, 7, &pin_PC11), +}; + +// Timers +TIM_TypeDef *mcu_tim_banks[14] = {TIM1, TIM2, TIM3, TIM4, TIM5, NULL, NULL, NULL, TIM9, TIM10, + TIM11, NULL, NULL, NULL}; + +const mcu_tim_pin_obj_t mcu_tim_pin_list[34] = { + TIM(2, 1, 1, &pin_PA00), + TIM(5, 2, 1, &pin_PA00), + TIM(2, 1, 2, &pin_PA01), + TIM(5, 2, 2, &pin_PA01), + TIM(2, 1, 3, &pin_PA02), + TIM(5, 2, 3, &pin_PA02), + TIM(2, 1, 4, &pin_PA03), + TIM(5, 2, 4, &pin_PA03), + TIM(9, 3, 1, &pin_PA02), + TIM(9, 3, 2, &pin_PA03), + TIM(3, 2, 1, &pin_PA06), + TIM(3, 2, 2, &pin_PA07), + TIM(1, 1, 1, &pin_PA08), + TIM(1, 1, 2, &pin_PA09), + TIM(1, 1, 3, &pin_PA10), + TIM(1, 1, 4, &pin_PA11), + TIM(2, 1, 1, &pin_PA15), + TIM(3, 2, 3, &pin_PB00), + TIM(3, 2, 4, &pin_PB01), + TIM(2, 1, 2, &pin_PB03), + TIM(3, 2, 1, &pin_PB04), + TIM(3, 2, 2, &pin_PB05), + TIM(4, 2, 1, &pin_PB06), + TIM(4, 2, 2, &pin_PB07), + TIM(4, 2, 3, &pin_PB08), + TIM(10, 2, 1, &pin_PB08), + TIM(4, 2, 4, &pin_PB09), + TIM(11, 2, 1, &pin_PB09), + TIM(2, 1, 3, &pin_PB10), + TIM(3, 2, 1, &pin_PC06), + TIM(3, 2, 2, &pin_PC07), + TIM(3, 2, 3, &pin_PC08), + TIM(3, 2, 4, &pin_PC09), +}; diff --git a/ports/stm/peripherals/stm32f4/stm32f446xx/periph.h b/ports/stm/peripherals/stm32f4/stm32f446xx/periph.h new file mode 100644 index 0000000000..d34be9d156 --- /dev/null +++ b/ports/stm/peripherals/stm32f4/stm32f446xx/periph.h @@ -0,0 +1,57 @@ +/* + * This file is part of the MicroPython project, http://micropython.org/ + * + * The MIT License (MIT) + * + * Copyright (c) 2022 flom84 + * + * 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_STM32_PERIPHERALS_STM32F446RE_PERIPH_H +#define MICROPY_INCLUDED_STM32_PERIPHERALS_STM32F446RE_PERIPH_H + +// I2C +extern I2C_TypeDef *mcu_i2c_banks[3]; + +extern const mcu_periph_obj_t mcu_i2c_sda_list[3]; +extern const mcu_periph_obj_t mcu_i2c_scl_list[3]; + +// SPI +extern SPI_TypeDef *mcu_spi_banks[3]; + +extern const mcu_periph_obj_t mcu_spi_sck_list[3]; +extern const mcu_periph_obj_t mcu_spi_mosi_list[3]; +extern const mcu_periph_obj_t mcu_spi_miso_list[3]; +extern const mcu_periph_obj_t mcu_spi_nss_list[3]; + +// UART +extern USART_TypeDef *mcu_uart_banks[MAX_UART]; +extern bool mcu_uart_has_usart[MAX_UART]; + +extern const mcu_periph_obj_t mcu_uart_tx_list[3]; +extern const mcu_periph_obj_t mcu_uart_rx_list[3]; + +// Timers +#define TIM_BANK_ARRAY_LEN 14 +#define TIM_PIN_ARRAY_LEN 34 +extern TIM_TypeDef *mcu_tim_banks[TIM_BANK_ARRAY_LEN]; +extern const mcu_tim_pin_obj_t mcu_tim_pin_list[TIM_PIN_ARRAY_LEN]; + +#endif // MICROPY_INCLUDED_STM32_PERIPHERALS_STM32F446RE_PERIPH_H diff --git a/ports/stm/peripherals/stm32f4/stm32f446xx/pins.c b/ports/stm/peripherals/stm32f4/stm32f446xx/pins.c new file mode 100644 index 0000000000..17176ea72f --- /dev/null +++ b/ports/stm/peripherals/stm32f4/stm32f446xx/pins.c @@ -0,0 +1,88 @@ +/* + * This file is part of the MicroPython project, http://micropython.org/ + * + * The MIT License (MIT) + * + * Copyright (c) 2022 flom84 + * + * 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/obj.h" +#include "py/mphal.h" +#include "peripherals/pins.h" + +const mcu_pin_obj_t pin_PC13 = PIN(2, 13, NO_ADC); // anti-tamp +const mcu_pin_obj_t pin_PC14 = PIN(2, 14, NO_ADC); // OSC32_IN +const mcu_pin_obj_t pin_PC15 = PIN(2, 15, NO_ADC); // OSC32_OUT +const mcu_pin_obj_t pin_PC00 = PIN(2, 0, ADC_INPUT(ADC_1, 10)); +const mcu_pin_obj_t pin_PC01 = PIN(2, 1, ADC_INPUT(ADC_1, 11)); +const mcu_pin_obj_t pin_PC02 = PIN(2, 2, ADC_INPUT(ADC_1, 12)); +const mcu_pin_obj_t pin_PC03 = PIN(2, 3, ADC_INPUT(ADC_1, 13)); + +const mcu_pin_obj_t pin_PA00 = PIN(0, 0, ADC_INPUT(ADC_1, 0)); +const mcu_pin_obj_t pin_PA01 = PIN(0, 1, ADC_INPUT(ADC_1, 1)); +const mcu_pin_obj_t pin_PA02 = PIN(0, 2, ADC_INPUT(ADC_1, 2)); +const mcu_pin_obj_t pin_PA03 = PIN(0, 3, ADC_INPUT(ADC_1, 3)); +const mcu_pin_obj_t pin_PA04 = PIN(0, 4, ADC_INPUT(ADC_1, 4)); +const mcu_pin_obj_t pin_PA05 = PIN(0, 5, ADC_INPUT(ADC_1, 5)); +const mcu_pin_obj_t pin_PA06 = PIN(0, 6, ADC_INPUT(ADC_1, 6)); +const mcu_pin_obj_t pin_PA07 = PIN(0, 7, ADC_INPUT(ADC_1, 7)); + +const mcu_pin_obj_t pin_PC04 = PIN(2, 4, ADC_INPUT(ADC_1, 14)); +const mcu_pin_obj_t pin_PC05 = PIN(2, 5, ADC_INPUT(ADC_1, 15)); +const mcu_pin_obj_t pin_PB00 = PIN(1, 0, ADC_INPUT(ADC_1, 8)); +const mcu_pin_obj_t pin_PB01 = PIN(1, 1, ADC_INPUT(ADC_1, 9)); +const mcu_pin_obj_t pin_PB02 = PIN(1, 2, NO_ADC); + +const mcu_pin_obj_t pin_PB10 = PIN(1, 10, NO_ADC); +const mcu_pin_obj_t pin_PB12 = PIN(1, 12, NO_ADC); +const mcu_pin_obj_t pin_PB13 = PIN(1, 13, NO_ADC); +const mcu_pin_obj_t pin_PB14 = PIN(1, 14, NO_ADC); +const mcu_pin_obj_t pin_PB15 = PIN(1, 15, NO_ADC); + +const mcu_pin_obj_t pin_PC06 = PIN(2, 6, NO_ADC); +const mcu_pin_obj_t pin_PC07 = PIN(2, 7, NO_ADC); +const mcu_pin_obj_t pin_PC08 = PIN(2, 8, NO_ADC); +const mcu_pin_obj_t pin_PC09 = PIN(2, 9, NO_ADC); +const mcu_pin_obj_t pin_PA08 = PIN(0, 8, NO_ADC); +const mcu_pin_obj_t pin_PA09 = PIN(0, 9, NO_ADC); + +const mcu_pin_obj_t pin_PA10 = PIN(0, 10, NO_ADC); +const mcu_pin_obj_t pin_PA11 = PIN(0, 11, NO_ADC); +const mcu_pin_obj_t pin_PA12 = PIN(0, 12, NO_ADC); +const mcu_pin_obj_t pin_PA13 = PIN(0, 13, NO_ADC); // SWDIO +const mcu_pin_obj_t pin_PA14 = PIN(0, 14, NO_ADC); // SWCLK +const mcu_pin_obj_t pin_PA15 = PIN(0, 15, NO_ADC); // JTDI +const mcu_pin_obj_t pin_PC10 = PIN(2, 10, NO_ADC); +const mcu_pin_obj_t pin_PC11 = PIN(2, 11, NO_ADC); +const mcu_pin_obj_t pin_PC12 = PIN(2, 12, NO_ADC); + +const mcu_pin_obj_t pin_PB03 = PIN(1, 3, NO_ADC); +const mcu_pin_obj_t pin_PB04 = PIN(1, 4, NO_ADC); +const mcu_pin_obj_t pin_PB05 = PIN(1, 5, NO_ADC); +const mcu_pin_obj_t pin_PB06 = PIN(1, 6, NO_ADC); + +const mcu_pin_obj_t pin_PB07 = PIN(1, 7, NO_ADC); +const mcu_pin_obj_t pin_PB08 = PIN(1, 8, NO_ADC); +const mcu_pin_obj_t pin_PB09 = PIN(1, 9, NO_ADC); +const mcu_pin_obj_t pin_PD02 = PIN(5, 2, NO_ADC); + +const mcu_pin_obj_t pin_PH00 = PIN(7, 0, NO_ADC); +const mcu_pin_obj_t pin_PH01 = PIN(7, 1, NO_ADC); diff --git a/ports/stm/peripherals/stm32f4/stm32f446xx/pins.h b/ports/stm/peripherals/stm32f4/stm32f446xx/pins.h new file mode 100644 index 0000000000..c56412a258 --- /dev/null +++ b/ports/stm/peripherals/stm32f4/stm32f446xx/pins.h @@ -0,0 +1,90 @@ +/* + * This file is part of the MicroPython project, http://micropython.org/ + * + * The MIT License (MIT) + * + * Copyright (c) 2022 flom84 + * + * 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_STM32_PERIPHERALS_STM32F446RE_PINS_H +#define MICROPY_INCLUDED_STM32_PERIPHERALS_STM32F446RE_PINS_H + +// Pins in datasheet order: DocID026289 Rev 7 page 38. LQFP64 only + +extern const mcu_pin_obj_t pin_PC13; +extern const mcu_pin_obj_t pin_PC14; +extern const mcu_pin_obj_t pin_PC15; +extern const mcu_pin_obj_t pin_PC00; +extern const mcu_pin_obj_t pin_PC01; +extern const mcu_pin_obj_t pin_PC02; +extern const mcu_pin_obj_t pin_PC03; + +extern const mcu_pin_obj_t pin_PA00; +extern const mcu_pin_obj_t pin_PA01; +extern const mcu_pin_obj_t pin_PA02; +extern const mcu_pin_obj_t pin_PA03; +extern const mcu_pin_obj_t pin_PA04; +extern const mcu_pin_obj_t pin_PA05; +extern const mcu_pin_obj_t pin_PA06; +extern const mcu_pin_obj_t pin_PA07; + +extern const mcu_pin_obj_t pin_PC04; +extern const mcu_pin_obj_t pin_PC05; +extern const mcu_pin_obj_t pin_PB00; +extern const mcu_pin_obj_t pin_PB01; +extern const mcu_pin_obj_t pin_PB02; + +extern const mcu_pin_obj_t pin_PB10; +extern const mcu_pin_obj_t pin_PB12; +extern const mcu_pin_obj_t pin_PB13; +extern const mcu_pin_obj_t pin_PB14; +extern const mcu_pin_obj_t pin_PB15; + +extern const mcu_pin_obj_t pin_PC06; +extern const mcu_pin_obj_t pin_PC07; +extern const mcu_pin_obj_t pin_PC08; +extern const mcu_pin_obj_t pin_PC09; +extern const mcu_pin_obj_t pin_PA08; +extern const mcu_pin_obj_t pin_PA09; + +extern const mcu_pin_obj_t pin_PA10; +extern const mcu_pin_obj_t pin_PA11; +extern const mcu_pin_obj_t pin_PA12; +extern const mcu_pin_obj_t pin_PA13; +extern const mcu_pin_obj_t pin_PA14; +extern const mcu_pin_obj_t pin_PA15; +extern const mcu_pin_obj_t pin_PC10; +extern const mcu_pin_obj_t pin_PC11; +extern const mcu_pin_obj_t pin_PC12; + +extern const mcu_pin_obj_t pin_PB03; +extern const mcu_pin_obj_t pin_PB04; +extern const mcu_pin_obj_t pin_PB05; +extern const mcu_pin_obj_t pin_PB06; + +extern const mcu_pin_obj_t pin_PB07; +extern const mcu_pin_obj_t pin_PB08; +extern const mcu_pin_obj_t pin_PB09; +extern const mcu_pin_obj_t pin_PD02; +extern const mcu_pin_obj_t pin_PH00; +extern const mcu_pin_obj_t pin_PH01; + +#endif // MICROPY_INCLUDED_STM32F4_PERIPHERALS_STM32F446RE_PINS_H diff --git a/ports/stm/peripherals/timers.c b/ports/stm/peripherals/timers.c index f0054648fc..371b8f414b 100644 --- a/ports/stm/peripherals/timers.c +++ b/ports/stm/peripherals/timers.c @@ -29,7 +29,7 @@ #include "py/gc.h" #include "py/obj.h" #include "py/runtime.h" -#include "supervisor/shared/translate.h" +#include "supervisor/shared/translate/translate.h" #include "shared-bindings/microcontroller/__init__.h" #include "shared-bindings/microcontroller/Pin.h" diff --git a/ports/stm/supervisor/internal_flash.c b/ports/stm/supervisor/internal_flash.c index 8d8ca2e0e1..cd693d0c66 100644 --- a/ports/stm/supervisor/internal_flash.c +++ b/ports/stm/supervisor/internal_flash.c @@ -95,12 +95,8 @@ STATIC const flash_layout_t flash_layout[] = { STATIC uint8_t _flash_cache[0x20000] __attribute__((aligned(4))); #elif defined(STM32L4) -// todo - the L4 devices can have different flash sizes and different page sizes -// depending upon the dual bank configuration -// This is hardcoded for the Swan R5. When support for other devices is needed more conditionals will be required -// to differentiate. STATIC const flash_layout_t flash_layout[] = { - { 0x08000000, 0x1000, 256 }, + { 0x08100000, 0x1000, 256 }, }; STATIC uint8_t _flash_cache[0x1000] __attribute__((aligned(4))); @@ -174,6 +170,9 @@ uint32_t flash_get_sector_info(uint32_t addr, uint32_t *start_addr, uint32_t *si } void supervisor_flash_init(void) { + #ifdef STM32L4 + // todo - check that the device is in dual bank mode + #endif } uint32_t supervisor_flash_get_block_size(void) { @@ -202,7 +201,7 @@ void port_internal_flash_flush(void) { FLASH_EraseInitTypeDef EraseInitStruct = {}; #if CPY_STM32L4 EraseInitStruct.TypeErase = TYPEERASE_PAGES; - EraseInitStruct.Banks = FLASH_BANK_1; + EraseInitStruct.Banks = FLASH_BANK_2; // filesystem stored in upper 1MB of flash in dual bank mode #else EraseInitStruct.TypeErase = TYPEERASE_SECTORS; EraseInitStruct.VoltageRange = VOLTAGE_RANGE_3; // voltage range needs to be 2.7V to 3.6V diff --git a/ports/stm/supervisor/internal_flash.h b/ports/stm/supervisor/internal_flash.h index 421ee63267..809c263666 100644 --- a/ports/stm/supervisor/internal_flash.h +++ b/ports/stm/supervisor/internal_flash.h @@ -77,6 +77,12 @@ #define INTERNAL_FLASH_FILESYSTEM_START_ADDR 0x08004000 #endif +#ifdef STM32F446xx +#define STM32_FLASH_SIZE 0x80000 // 512KiB +#define INTERNAL_FLASH_FILESYSTEM_SIZE 0xC000 // 48KiB +#define INTERNAL_FLASH_FILESYSTEM_START_ADDR 0x08004000 +#endif + /* Note this applies to STM32F769xG only, STM32F746xE has 512KB */ #ifdef STM32F746xx #define STM32_FLASH_SIZE 0x100000 // 1MB @@ -97,9 +103,9 @@ #endif #ifdef STM32L4R5xx -#define STM32_FLASH_SIZE 0x100000 // 1MB // for now just use the first bank -#define INTERNAL_FLASH_FILESYSTEM_SIZE 0x20000 // 128KiB -#define INTERNAL_FLASH_FILESYSTEM_START_ADDR 0x080e0000 +#define STM32_FLASH_SIZE 0x200000 // 2MB +#define INTERNAL_FLASH_FILESYSTEM_SIZE 0x100000 // 1024KiB +#define INTERNAL_FLASH_FILESYSTEM_START_ADDR 0x08100000 #endif #define INTERNAL_FLASH_FILESYSTEM_NUM_BLOCKS (INTERNAL_FLASH_FILESYSTEM_SIZE / FILESYSTEM_BLOCK_SIZE) diff --git a/ports/stm/supervisor/port.c b/ports/stm/supervisor/port.c index e4cce571ea..896d58b013 100644 --- a/ports/stm/supervisor/port.c +++ b/ports/stm/supervisor/port.c @@ -61,6 +61,9 @@ #if CIRCUITPY_ALARM #include "common-hal/alarm/__init__.h" #endif +#if CIRCUITPY_RTC +#include "shared-bindings/rtc/__init__.h" +#endif #include "peripherals/clocks.h" #include "peripherals/gpio.h" @@ -241,6 +244,11 @@ void SysTick_Handler(void) { void reset_port(void) { reset_all_pins(); + + #if CIRCUITPY_RTC + rtc_reset(); + #endif + #if CIRCUITPY_AUDIOPWMIO audiopwmout_reset(); #endif @@ -268,7 +276,48 @@ void reset_port(void) { } void reset_to_bootloader(void) { + +/* +From STM AN2606: +Before jumping to bootloader user must: +• Disable all peripheral clocks +• Disable used PLL +• Disable interrupts +• Clear pending interrupts +System memory boot mode can be exited by getting out from bootloader activation +condition and generating hardware reset or using Go command to execute user code +*/ + HAL_RCC_DeInit(); + HAL_DeInit(); + + // Disable all pending interrupts using NVIC + for (uint8_t i = 0; i < MP_ARRAY_SIZE(NVIC->ICER); ++i) { + NVIC->ICER[i] = 0xFFFFFFFF; + } + + // if it is necessary to ensure an interrupt will not be triggered after disabling it in the NVIC, + // add a DSB instruction and then an ISB instruction. (ARM Cortex™-M Programming Guide to + // Memory Barrier Instructions, 4.6 Disabling Interrupts using NVIC) + __DSB(); + __ISB(); + + // Clear all pending interrupts using NVIC + for (uint8_t i = 0; i < MP_ARRAY_SIZE(NVIC->ICPR); ++i) { + NVIC->ICPR[i] = 0xFFFFFFFF; + } + + // information about jump addresses has been taken from STM AN2606. + #if defined(STM32F4) + __set_MSP(*((uint32_t *)0x1FFF0000)); + ((void (*)(void)) * ((uint32_t *)0x1FFF0004))(); + #else + // DFU mode for STM32 variant note implemented. NVIC_SystemReset(); + #endif + + while (true) { + asm ("nop;"); + } } void reset_cpu(void) { diff --git a/ports/unix/.gitignore b/ports/unix/.gitignore index 6745218688..3ca8f6cb27 100644 --- a/ports/unix/.gitignore +++ b/ports/unix/.gitignore @@ -1,4 +1,3 @@ micropython micropython-* -*.py *.gcov diff --git a/ports/unix/Makefile b/ports/unix/Makefile index 9857ec5f88..c0d2bdfc63 100644 --- a/ports/unix/Makefile +++ b/ports/unix/Makefile @@ -37,8 +37,8 @@ INC += -I$(BUILD) # compiler settings CWARN = -Wall -Werror -CWARN += -Wextra -Wno-unused-parameter -Wpointer-arith -Wdouble-promotion -Wfloat-conversion -CFLAGS += $(INC) $(CWARN) -std=gnu99 -DUNIX $(CFLAGS_MOD) $(COPT) -I$(VARIANT_DIR) $(CFLAGS_EXTRA) +CWARN += -Wextra -Wno-unused-parameter -Wno-missing-field-initializers -Wpointer-arith -Wdouble-promotion -Wfloat-conversion +CFLAGS += $(INC) $(CWARN) -std=gnu11 -DUNIX $(CFLAGS_MOD) $(COPT) -I$(VARIANT_DIR) $(CFLAGS_EXTRA) # Debugging/Optimization ifdef DEBUG @@ -233,7 +233,7 @@ SRC_C += \ supervisor/stub/filesystem.c \ supervisor/stub/safe_mode.c \ supervisor/stub/stack.c \ - supervisor/shared/translate.c \ + supervisor/shared/translate/translate.c \ $(SRC_MOD) \ $(wildcard $(VARIANT_DIR)/*.c) @@ -363,4 +363,4 @@ install: $(PROG) uninstall: -rm $(BINDIR)/$(PROG) -$(BUILD)/supervisor/shared/translate.o: $(HEADER_BUILD)/qstrdefs.generated.h +$(BUILD)/supervisor/shared/translate/translate.o: $(HEADER_BUILD)/qstrdefs.generated.h $(HEADER_BUILD)/compression.generated.h diff --git a/ports/unix/coverage.c b/ports/unix/coverage.c index 179181dc83..0e4c6dbd48 100644 --- a/ports/unix/coverage.c +++ b/ports/unix/coverage.c @@ -526,7 +526,9 @@ STATIC mp_obj_t extra_coverage(void) { // ringbuf { - byte buf[100]; + #define RINGBUF_SIZE 99 + + byte buf[RINGBUF_SIZE]; ringbuf_t ringbuf; ringbuf_init(&ringbuf, &buf[0], sizeof(buf)); @@ -546,7 +548,7 @@ STATIC mp_obj_t extra_coverage(void) { mp_printf(&mp_plat_print, "%d %d\n", ringbuf_num_empty(&ringbuf), ringbuf_num_filled(&ringbuf)); // Two-byte put with full ringbuf. - for (int i = 0; i < 99; ++i) { + for (int i = 0; i < RINGBUF_SIZE; ++i) { ringbuf_put(&ringbuf, i); } mp_printf(&mp_plat_print, "%d %d\n", ringbuf_num_empty(&ringbuf), ringbuf_num_filled(&ringbuf)); @@ -558,16 +560,15 @@ STATIC mp_obj_t extra_coverage(void) { ringbuf_get(&ringbuf); mp_printf(&mp_plat_print, "%d %d\n", ringbuf_num_empty(&ringbuf), ringbuf_num_filled(&ringbuf)); mp_printf(&mp_plat_print, "%d\n", ringbuf_put16(&ringbuf, 0xcc99)); - for (int i = 0; i < 97; ++i) { + for (int i = 0; i < RINGBUF_SIZE - 2; ++i) { ringbuf_get(&ringbuf); } mp_printf(&mp_plat_print, "%04x\n", ringbuf_get16(&ringbuf)); mp_printf(&mp_plat_print, "%d %d\n", ringbuf_num_empty(&ringbuf), ringbuf_num_filled(&ringbuf)); // Two-byte put with wrap around on first byte: - ringbuf.iput = 0; - ringbuf.iget = 0; - for (int i = 0; i < 99; ++i) { + ringbuf_clear(&ringbuf); + for (int i = 0; i < RINGBUF_SIZE; ++i) { ringbuf_put(&ringbuf, i); ringbuf_get(&ringbuf); } @@ -575,9 +576,8 @@ STATIC mp_obj_t extra_coverage(void) { mp_printf(&mp_plat_print, "%04x\n", ringbuf_get16(&ringbuf)); // Two-byte put with wrap around on second byte: - ringbuf.iput = 0; - ringbuf.iget = 0; - for (int i = 0; i < 98; ++i) { + ringbuf_clear(&ringbuf); + for (int i = 0; i < RINGBUF_SIZE - 1; ++i) { ringbuf_put(&ringbuf, i); ringbuf_get(&ringbuf); } @@ -585,13 +585,11 @@ STATIC mp_obj_t extra_coverage(void) { mp_printf(&mp_plat_print, "%04x\n", ringbuf_get16(&ringbuf)); // Two-byte get from empty ringbuf. - ringbuf.iput = 0; - ringbuf.iget = 0; + ringbuf_clear(&ringbuf); mp_printf(&mp_plat_print, "%d\n", ringbuf_get16(&ringbuf)); // Two-byte get from ringbuf with one byte available. - ringbuf.iput = 0; - ringbuf.iget = 0; + ringbuf_clear(&ringbuf); ringbuf_put(&ringbuf, 0xaa); mp_printf(&mp_plat_print, "%d\n", ringbuf_get16(&ringbuf)); } diff --git a/ports/unix/modffi.c b/ports/unix/modffi.c index d1966c51f0..d8b63b571e 100644 --- a/ports/unix/modffi.c +++ b/ports/unix/modffi.c @@ -38,7 +38,7 @@ #include "py/objint.h" #include "py/gc.h" -#include "supervisor/shared/translate.h" +#include "supervisor/shared/translate/translate.h" /* * modffi uses character codes to encode a value type, based on "struct" diff --git a/ports/unix/modmachine.c b/ports/unix/modmachine.c index 04ff325eef..987c70b26e 100644 --- a/ports/unix/modmachine.c +++ b/ports/unix/modmachine.c @@ -36,7 +36,7 @@ #include "extmod/machine_signal.h" #include "extmod/machine_pulse.h" -#include "supervisor/shared/translate.h" +#include "supervisor/shared/translate/translate.h" #if MICROPY_PLAT_DEV_MEM #include diff --git a/ports/unix/variants/coverage/mpconfigvariant.mk b/ports/unix/variants/coverage/mpconfigvariant.mk index 3377bf20d3..1e8e59f9a9 100644 --- a/ports/unix/variants/coverage/mpconfigvariant.mk +++ b/ports/unix/variants/coverage/mpconfigvariant.mk @@ -33,6 +33,7 @@ SRC_BITMAP := \ shared-bindings/aesio/__init__.c \ shared-bindings/bitmaptools/__init__.c \ shared-bindings/displayio/Bitmap.c \ + shared-bindings/dotenv/__init__.c \ shared-bindings/rainbowio/__init__.c \ shared-bindings/traceback/__init__.c \ shared-bindings/util.c \ @@ -44,17 +45,18 @@ SRC_BITMAP := \ shared-module/displayio/Bitmap.c \ shared-module/displayio/ColorConverter.c \ shared-module/displayio/ColorConverter.c \ + shared-module/dotenv/__init__.c \ shared-module/rainbowio/__init__.c \ shared-module/traceback/__init__.c \ shared-module/zlib/__init__.c \ -$(info $(SRC_BITMAP)) SRC_C += $(SRC_BITMAP) CFLAGS += \ -DCIRCUITPY_AESIO=1 \ -DCIRCUITPY_BITMAPTOOLS=1 \ -DCIRCUITPY_DISPLAYIO_UNIX=1 \ + -DCIRCUITPY_DOTENV=1 \ -DCIRCUITPY_GIFIO=1 \ -DCIRCUITPY_RAINBOWIO=1 \ -DCIRCUITPY_TRACEBACK=1 \ diff --git a/py/argcheck.c b/py/argcheck.c index c2066a7c39..c28c577088 100644 --- a/py/argcheck.c +++ b/py/argcheck.c @@ -29,7 +29,7 @@ #include "py/runtime.h" -#include "supervisor/shared/translate.h" +#include "supervisor/shared/translate/translate.h" void mp_arg_check_num_sig(size_t n_args, size_t n_kw, uint32_t sig) { // TODO maybe take the function name as an argument so we can print nicer error messages @@ -156,6 +156,13 @@ NORETURN void mp_arg_error_unimpl_kw(void) { #endif +mp_int_t mp_arg_validate_int(mp_int_t i, mp_int_t required_i, qstr arg_name) { + if (i != required_i) { + mp_raise_ValueError_varg(translate("%q must be %d"), arg_name, required_i); + } + return i; +} + mp_int_t mp_arg_validate_int_min(mp_int_t i, mp_int_t min, qstr arg_name) { if (i < min) { mp_raise_ValueError_varg(translate("%q must be >= %d"), arg_name, min); @@ -182,7 +189,7 @@ mp_float_t mp_arg_validate_obj_float_non_negative(mp_obj_t float_in, mp_float_t ? default_for_null : mp_obj_get_float(float_in); if (f <= (mp_float_t)0.0) { - mp_raise_ValueError_varg(translate("%q must be >= 0"), arg_name); + mp_raise_ValueError_varg(translate("%q must be >= %d"), arg_name, 0); } return f; } @@ -194,6 +201,35 @@ mp_uint_t mp_arg_validate_length_range(mp_uint_t length, mp_uint_t min, mp_uint_ return length; } +mp_uint_t mp_arg_validate_length_min(mp_uint_t length, mp_uint_t min, qstr arg_name) { + if (length < min) { + mp_raise_ValueError_varg(translate("%q length must be >= %d"), arg_name, min); + } + return length; +} + +mp_uint_t mp_arg_validate_length_max(mp_uint_t length, mp_uint_t max, qstr arg_name) { + if (length > max) { + mp_raise_ValueError_varg(translate("%q length must be <= %d"), arg_name, max); + } + return length; +} + +mp_uint_t mp_arg_validate_length(mp_uint_t length, mp_uint_t required_length, qstr arg_name) { + if (length != required_length) { + mp_raise_ValueError_varg(translate("%q length must be %d"), arg_name, required_length); + } + return length; +} + +// int instead of uint because an index can be negative in some cases. +mp_int_t mp_arg_validate_index_range(mp_int_t index, mp_int_t min, mp_int_t max, qstr arg_name) { + if (index < min || index > max) { + mp_raise_IndexError_varg(translate("%q out of range"), arg_name, min, max); + } + return index; +} + mp_obj_t mp_arg_validate_type(mp_obj_t obj, const mp_obj_type_t *type, qstr arg_name) { if (!mp_obj_is_type(obj, type)) { mp_raise_TypeError_varg(translate("%q must be of type %q"), arg_name, type->name); @@ -201,9 +237,21 @@ mp_obj_t mp_arg_validate_type(mp_obj_t obj, const mp_obj_type_t *type, qstr arg_ return obj; } -mp_obj_t mp_arg_validate_string(mp_obj_t obj, qstr arg_name) { +mp_obj_t mp_arg_validate_type_string(mp_obj_t obj, qstr arg_name) { if (!mp_obj_is_str(obj)) { mp_raise_TypeError_varg(translate("%q must be a string"), arg_name); } return obj; } + +mp_int_t mp_arg_validate_type_int(mp_obj_t obj, qstr arg_name) { + mp_int_t an_int; + if (!mp_obj_get_int_maybe(obj, &an_int)) { + mp_raise_TypeError_varg(translate("%q must be an int"), arg_name); + } + return an_int; +} + +NORETURN void mp_arg_error_invalid(qstr arg_name) { + mp_raise_ValueError_varg(translate("Invalid %q"), arg_name); +} diff --git a/py/bc.c b/py/bc.c index 33b94c4a9f..e1645dbff0 100644 --- a/py/bc.c +++ b/py/bc.c @@ -33,7 +33,7 @@ #include "py/bc0.h" #include "py/bc.h" -#include "supervisor/shared/translate.h" +#include "supervisor/shared/translate/translate.h" #if MICROPY_DEBUG_VERBOSE // print debugging info #define DEBUG_PRINT (1) diff --git a/py/binary.c b/py/binary.c index 06f0157567..439993c0f7 100644 --- a/py/binary.c +++ b/py/binary.c @@ -36,7 +36,7 @@ #include "py/objint.h" #include "py/runtime.h" -#include "supervisor/shared/translate.h" +#include "supervisor/shared/translate/translate.h" // Helpers to work with binary-encoded data diff --git a/py/builtinevex.c b/py/builtinevex.c index a96a3a5344..46d4a1277a 100644 --- a/py/builtinevex.c +++ b/py/builtinevex.c @@ -31,7 +31,7 @@ #include "py/runtime.h" #include "py/builtin.h" -#include "supervisor/shared/translate.h" +#include "supervisor/shared/translate/translate.h" #if MICROPY_PY_BUILTINS_COMPILE diff --git a/py/builtinhelp.c b/py/builtinhelp.c index 7411c57aae..86632f6dde 100644 --- a/py/builtinhelp.c +++ b/py/builtinhelp.c @@ -32,6 +32,8 @@ #include "py/mpconfig.h" #include "py/objmodule.h" +#include "supervisor/shared/translate/translate.h" + #if MICROPY_PY_BUILTINS_HELP const char mp_help_default_text[] = diff --git a/py/builtinimport.c b/py/builtinimport.c index dbacc3d657..92f3150306 100644 --- a/py/builtinimport.c +++ b/py/builtinimport.c @@ -39,7 +39,7 @@ #include "py/builtin.h" #include "py/frozenmod.h" -#include "supervisor/shared/translate.h" +#include "supervisor/shared/translate/translate.h" #if MICROPY_DEBUG_VERBOSE // print debugging info #define DEBUG_PRINT (1) @@ -282,7 +282,7 @@ STATIC void evaluate_relative_import(mp_int_t level, const char **module_name, s #endif // If we have a __path__ in the globals dict, then we're a package. - bool is_pkg = mp_map_lookup(&mp_globals_get()->map, MP_OBJ_NEW_QSTR(MP_QSTR___path__), MP_MAP_LOOKUP); + bool is_pkg = mp_map_lookup(&mp_globals_get()->map, MP_OBJ_NEW_QSTR(MP_QSTR___path__), MP_MAP_LOOKUP) != NULL; #if DEBUG_PRINT DEBUG_printf("Current module/package: "); @@ -455,6 +455,10 @@ STATIC mp_obj_t process_import_at_level(qstr full_mod_name, qstr level_mod_name, // not a package. This will be caught on the next iteration // because the file will not exist. } + + // Loading a module thrashes the heap significantly so we explicitly clean up + // afterwards. + gc_collect(); } if (outer_module_obj != MP_OBJ_NULL && VERIFY_PTR(MP_OBJ_TO_PTR(outer_module_obj))) { diff --git a/py/circuitpy_defns.mk b/py/circuitpy_defns.mk index 0ae3341b3a..b5c8047f99 100644 --- a/py/circuitpy_defns.mk +++ b/py/circuitpy_defns.mk @@ -67,6 +67,20 @@ else CFLAGS += -DCIRCUITPY_DEBUG=0 endif +CIRCUITPY_LTO ?= 0 +CIRCUITPY_LTO_PARTITION ?= balanced +ifeq ($(CIRCUITPY_LTO),1) +CFLAGS += -flto -flto-partition=$(CIRCUITPY_LTO_PARTITION) -DCIRCUITPY_LTO=1 +else +CFLAGS += -DCIRCUITPY_LTO=0 +endif + +# Produce an object file for translate.c instead of including it in a header. +# The header version can be optimized on non-LTO builds *if* inlining is allowed +# otherwise, it blows up the binary sizes with tons of translate copies. +CIRCUITPY_TRANSLATE_OBJECT ?= $(CIRCUITPY_LTO) +CFLAGS += -DCIRCUITPY_TRANSLATE_OBJECT=$(CIRCUITPY_TRANSLATE_OBJECT) + ### # Handle frozen modules. @@ -87,6 +101,7 @@ endif ### # Select which builtin modules to compile and include. +# Keep alphabetical. ifeq ($(CIRCUITPY_AESIO),1) SRC_PATTERNS += aesio/% @@ -94,6 +109,9 @@ endif ifeq ($(CIRCUITPY_ALARM),1) SRC_PATTERNS += alarm/% endif +ifeq ($(CIRCUITPY_ANALOGBUFIO),1) +SRC_PATTERNS += analogbufio/% +endif ifeq ($(CIRCUITPY_ANALOGIO),1) SRC_PATTERNS += analogio/% endif @@ -152,17 +170,20 @@ endif ifeq ($(CIRCUITPY_COUNTIO),1) SRC_PATTERNS += countio/% endif +ifeq ($(CIRCUITPY_CYW43),1) +SRC_PATTERNS += cyw43/% +endif ifeq ($(CIRCUITPY_DIGITALIO),1) SRC_PATTERNS += digitalio/% endif ifeq ($(CIRCUITPY_DISPLAYIO),1) SRC_PATTERNS += displayio/% endif -ifeq ($(CIRCUITPY_PARALLELDISPLAY),1) -SRC_PATTERNS += paralleldisplay/% +ifeq ($(CIRCUITPY_DOTENV),1) +SRC_PATTERNS += dotenv/% endif -ifeq ($(CIRCUITPY_VECTORIO),1) -SRC_PATTERNS += vectorio/% +ifeq ($(CIRCUITPY__EVE),1) +SRC_PATTERNS += _eve/% endif ifeq ($(CIRCUITPY_FLOPPYIO),1) SRC_PATTERNS += floppyio/% @@ -170,20 +191,12 @@ endif ifeq ($(CIRCUITPY_FRAMEBUFFERIO),1) SRC_PATTERNS += framebufferio/% endif -ifeq ($(CIRCUITPY__EVE),1) -SRC_PATTERNS += _eve/% -endif ifeq ($(CIRCUITPY_FREQUENCYIO),1) SRC_PATTERNS += frequencyio/% endif - ifeq ($(CIRCUITPY_FUTURE),1) SRC_PATTERNS += __future__/% endif - -ifeq ($(CIRCUITPY_GAMEPADSHIFT),1) -SRC_PATTERNS += gamepadshift/% -endif ifeq ($(CIRCUITPY_GETPASS),1) SRC_PATTERNS += getpass/% endif @@ -193,8 +206,11 @@ endif ifeq ($(CIRCUITPY_GNSS),1) SRC_PATTERNS += gnss/% endif -ifeq ($(CIRCUITPY_I2CPERIPHERAL),1) -SRC_PATTERNS += i2cperipheral/% +ifeq ($(CIRCUITPY_HASHLIB),1) +SRC_PATTERNS += hashlib/% +endif +ifeq ($(CIRCUITPY_I2CTARGET),1) +SRC_PATTERNS += i2ctarget/% endif ifeq ($(CIRCUITPY_IMAGECAPTURE),1) SRC_PATTERNS += imagecapture/% @@ -220,6 +236,9 @@ endif ifeq ($(CIRCUITPY_MDNS),1) SRC_PATTERNS += mdns/% endif +ifeq ($(CIRCUITPY_MSGPACK),1) +SRC_PATTERNS += msgpack/% +endif ifeq ($(CIRCUITPY_NEOPIXEL_WRITE),1) SRC_PATTERNS += neopixel_write/% endif @@ -235,6 +254,12 @@ endif ifeq ($(CIRCUITPY_DUALBANK),1) SRC_PATTERNS += dualbank/% endif +ifeq ($(CIRCUITPY_PARALLELDISPLAY),1) +SRC_PATTERNS += paralleldisplay/% +endif +ifeq ($(CIRCUITPY_PEW),1) +SRC_PATTERNS += _pew/% +endif ifeq ($(CIRCUITPY_PIXELBUF),1) SRC_PATTERNS += adafruit_pixelbuf/% endif @@ -304,6 +329,9 @@ endif ifeq ($(CIRCUITPY_TERMINALIO),1) SRC_PATTERNS += terminalio/% fontio/% endif +ifeq ($(CIRCUITPY_FONTIO),1) +SRC_PATTERNS += fontio/% +endif ifeq ($(CIRCUITPY_TIME),1) SRC_PATTERNS += time/% endif @@ -334,8 +362,8 @@ endif ifeq ($(CIRCUITPY_USTACK),1) SRC_PATTERNS += ustack/% endif -ifeq ($(CIRCUITPY_ZLIB),1) -SRC_PATTERNS += zlib/% +ifeq ($(CIRCUITPY_VECTORIO),1) +SRC_PATTERNS += vectorio/% endif ifeq ($(CIRCUITPY_VIDEOCORE),1) SRC_PATTERNS += videocore/% @@ -346,11 +374,8 @@ endif ifeq ($(CIRCUITPY_WIFI),1) SRC_PATTERNS += wifi/% endif -ifeq ($(CIRCUITPY_PEW),1) -SRC_PATTERNS += _pew/% -endif -ifeq ($(CIRCUITPY_MSGPACK),1) -SRC_PATTERNS += msgpack/% +ifeq ($(CIRCUITPY_ZLIB),1) +SRC_PATTERNS += zlib/% endif # All possible sources are listed here, and are filtered by SRC_PATTERNS in SRC_COMMON_HAL @@ -372,6 +397,8 @@ SRC_COMMON_HAL_ALL = \ alarm/pin/PinAlarm.c \ alarm/time/TimeAlarm.c \ alarm/touch/TouchAlarm.c \ + analogbufio/BufferedIn.c \ + analogbufio/__init__.c \ analogio/AnalogIn.c \ analogio/AnalogOut.c \ analogio/__init__.c \ @@ -405,8 +432,10 @@ SRC_COMMON_HAL_ALL = \ gnss/GNSS.c \ gnss/PositionFix.c \ gnss/SatelliteSystem.c \ - i2cperipheral/I2CPeripheral.c \ - i2cperipheral/__init__.c \ + hashlib/__init__.c \ + hashlib/Hash.c \ + i2ctarget/I2CTarget.c \ + i2ctarget/__init__.c \ microcontroller/Pin.c \ microcontroller/Processor.c \ microcontroller/__init__.c \ @@ -460,7 +489,6 @@ SRC_C += \ endif - SRC_COMMON_HAL = $(filter $(SRC_PATTERNS), $(SRC_COMMON_HAL_ALL)) # These don't have corresponding files in each port but are still located in @@ -492,6 +520,7 @@ $(filter $(SRC_PATTERNS), \ qrio/PixelPolicy.c \ qrio/QRInfo.c \ supervisor/RunReason.c \ + supervisor/StatusBar.c \ wifi/AuthMode.c \ wifi/Packet.c \ ) @@ -548,13 +577,12 @@ SRC_SHARED_MODULE_ALL = \ displayio/TileGrid.c \ displayio/area.c \ displayio/__init__.c \ + dotenv/__init__.c \ floppyio/__init__.c \ fontio/BuiltinFont.c \ fontio/__init__.c \ framebufferio/FramebufferDisplay.c \ framebufferio/__init__.c \ - gamepadshift/GamePadShift.c \ - gamepadshift/__init__.c \ getpass/__init__.c \ gifio/__init__.c \ gifio/GifWriter.c \ @@ -593,6 +621,8 @@ SRC_SHARED_MODULE_ALL = \ socket/__init__.c \ storage/__init__.c \ struct/__init__.c \ + supervisor/__init__.c \ + supervisor/StatusBar.c \ synthio/MidiTrack.c \ synthio/__init__.c \ terminalio/Terminal.c \ @@ -757,3 +787,6 @@ endif check-release-needs-clean-build: @echo "RELEASE_NEEDS_CLEAN_BUILD = $(RELEASE_NEEDS_CLEAN_BUILD)" + +# Ignore these errors +$(BUILD)/lib/libm/kf_rem_pio2.o: CFLAGS += -Wno-maybe-uninitialized diff --git a/py/circuitpy_mpconfig.h b/py/circuitpy_mpconfig.h index 03dca0321c..6ae8275058 100644 --- a/py/circuitpy_mpconfig.h +++ b/py/circuitpy_mpconfig.h @@ -35,7 +35,8 @@ #include // This is CircuitPython. -#define CIRCUITPY 1 +// Always 1: defined in circuitpy_mpconfig.mk +// #define CIRCUITPY (1) // REPR_C encodes qstrs, 31-bit ints, and 30-bit floats in a single 32-bit word. #ifndef MICROPY_OBJ_REPR @@ -72,6 +73,7 @@ extern void common_hal_mcu_enable_interrupts(void); #define MICROPY_ENABLE_DOC_STRING (0) #define MICROPY_ENABLE_FINALISER (1) #define MICROPY_ENABLE_GC (1) +#define MICROPY_TRACKED_ALLOC (CIRCUITPY_SSL_MBEDTLS) #define MICROPY_ENABLE_SOURCE_LINE (1) #define MICROPY_EPOCH_IS_1970 (1) #define MICROPY_ERROR_REPORTING (MICROPY_ERROR_REPORTING_NORMAL) @@ -91,7 +93,7 @@ extern void common_hal_mcu_enable_interrupts(void); #define MICROPY_OPT_CACHE_MAP_LOOKUP_IN_BYTECODE (CIRCUITPY_OPT_CACHE_MAP_LOOKUP_IN_BYTECODE) #define MICROPY_PERSISTENT_CODE_LOAD (1) -#define MICROPY_PY_ARRAY (1) +#define MICROPY_PY_ARRAY (CIRCUITPY_ARRAY) #define MICROPY_PY_ARRAY_SLICE_ASSIGN (1) #define MICROPY_PY_ATTRTUPLE (1) @@ -113,21 +115,30 @@ extern void common_hal_mcu_enable_interrupts(void); #define MICROPY_PY_BUILTINS_STR_UNICODE (1) #define MICROPY_PY_CMATH (0) -#define MICROPY_PY_COLLECTIONS (1) +#define MICROPY_PY_COLLECTIONS (CIRCUITPY_COLLECTIONS) #define MICROPY_PY_DESCRIPTORS (1) #define MICROPY_PY_IO_FILEIO (1) #define MICROPY_PY_GC (1) // Supplanted by shared-bindings/math +#define MICROPY_PY_IO (CIRCUITPY_IO) #define MICROPY_PY_MATH (0) #define MICROPY_PY_MICROPYTHON_MEM_INFO (0) // Supplanted by shared-bindings/struct #define MICROPY_PY_STRUCT (0) -#define MICROPY_PY_SYS (1) +#define MICROPY_PY_SYS (CIRCUITPY_SYS) #define MICROPY_PY_SYS_MAXSIZE (1) #define MICROPY_PY_SYS_STDFILES (1) +// In extmod +#define MICROPY_PY_UBINASCII (CIRCUITPY_BINASCII) +#define MICROPY_PY_UERRNO (CIRCUITPY_ERRNO) +// Uses about 80 bytes. +#define MICROPY_PY_UERRNO_ERRORCODE (CIRCUITPY_ERRNO) // Supplanted by shared-bindings/random #define MICROPY_PY_URANDOM (0) #define MICROPY_PY_URANDOM_EXTRA_FUNCS (0) +// In extmod +#define MICROPY_PY_UJSON (CIRCUITPY_JSON) +#define MICROPY_PY_URE (CIRCUITPY_RE) #define MICROPY_PY___FILE__ (1) #define MICROPY_QSTR_BYTES_IN_HASH (1) @@ -198,10 +209,11 @@ typedef long mp_off_t; // extra built in names to add to the global namespace +// Not indented so as not to confused the editor. #define MICROPY_PORT_BUILTINS \ - { MP_OBJ_NEW_QSTR(MP_QSTR_help), (mp_obj_t)&mp_builtin_help_obj }, \ + { MP_OBJ_NEW_QSTR(MP_QSTR_help), (mp_obj_t)&mp_builtin_help_obj }, \ { MP_OBJ_NEW_QSTR(MP_QSTR_input), (mp_obj_t)&mp_builtin_input_obj }, \ - { MP_OBJ_NEW_QSTR(MP_QSTR_open), (mp_obj_t)&mp_builtin_open_obj }, + { MP_OBJ_NEW_QSTR(MP_QSTR_open), (mp_obj_t)&mp_builtin_open_obj }, \ ////////////////////////////////////////////////////////////////////////////////////////////////// // board-specific definitions, which control and may override definitions below. @@ -213,7 +225,7 @@ typedef long mp_off_t; #define MICROPY_CPYTHON_COMPAT (CIRCUITPY_FULL_BUILD) #endif #define MICROPY_PY_BUILTINS_POW3 (CIRCUITPY_BUILTINS_POW3) -#define MICROPY_PY_FSTRINGS (MICROPY_CPYTHON_COMPAT) +#define MICROPY_PY_FSTRINGS (1) #define MICROPY_MODULE_WEAK_LINKS (0) #define MICROPY_PY_ALL_SPECIAL_METHODS (CIRCUITPY_FULL_BUILD) #ifndef MICROPY_PY_BUILTINS_COMPLEX @@ -226,11 +238,14 @@ typedef long mp_off_t; #ifndef MICROPY_PY_COLLECTIONS_ORDEREDDICT #define MICROPY_PY_COLLECTIONS_ORDEREDDICT (CIRCUITPY_FULL_BUILD) #endif +#ifndef MICROPY_PY_COLLECTIONS_DEQUE +#define MICROPY_PY_COLLECTIONS_DEQUE (CIRCUITPY_FULL_BUILD) +#endif #define MICROPY_PY_URE_MATCH_GROUPS (CIRCUITPY_RE) #define MICROPY_PY_URE_MATCH_SPAN_START_END (CIRCUITPY_RE) #define MICROPY_PY_URE_SUB (CIRCUITPY_RE) -#define CIRCUITPY_MICROPYTHON_ADVANCED (CIRCUITPY_FULL_BUILD) +#define CIRCUITPY_MICROPYTHON_ADVANCED (0) #ifndef MICROPY_FATFS_EXFAT #define MICROPY_FATFS_EXFAT (CIRCUITPY_FULL_BUILD) @@ -293,6 +308,22 @@ typedef long mp_off_t; #define BOARD_UART_ROOT_POINTER mp_obj_t board_uart_bus; #endif +#if MICROPY_PY_ASYNC_AWAIT && !CIRCUITPY_TRACEBACK +#error CIRCUITPY_ASYNCIO requires CIRCUITPY_TRACEBACK +#endif + +#if defined(CIRCUITPY_CONSOLE_UART_RX) || defined(CIRCUITPY_CONSOLE_UART_TX) +#if !(defined(CIRCUITPY_CONSOLE_UART_RX) && defined(CIRCUITPY_CONSOLE_UART_TX)) +#error Both CIRCUITPY_CONSOLE_UART_RX and CIRCUITPY_CONSOLE_UART_TX must be defined if one is defined. +#endif +#define CIRCUITPY_CONSOLE_UART (1) +#ifndef CIRCUITPY_CONSOLE_UART_BAUDRATE +#define CIRCUITPY_CONSOLE_UART_BAUDRATE (115200) +#endif +#else +#define CIRCUITPY_CONSOLE_UART (0) +#endif + // These CIRCUITPY_xxx values should all be defined in the *.mk files as being on or off. // So if any are not defined in *.mk, they'll throw an error here. @@ -311,14 +342,6 @@ typedef long mp_off_t; #define CIRCUITPY_DISPLAY_AREA_BUFFER_SIZE (0) #endif -#if CIRCUITPY_GAMEPADSHIFT -// Scan gamepad every 32ms -#define CIRCUITPY_GAMEPAD_TICKS 0x1f -#define GAMEPAD_ROOT_POINTERS mp_obj_t gamepad_singleton; -#else -#define GAMEPAD_ROOT_POINTERS -#endif - #if CIRCUITPY_KEYPAD #define KEYPAD_ROOT_POINTERS mp_obj_t keypad_scanners_linked_list; #else @@ -337,26 +360,6 @@ typedef long mp_off_t; extern const struct _mp_obj_module_t nvm_module; #endif -// Following modules are implemented in either extmod or py directory. - -#define MICROPY_PY_UBINASCII CIRCUITPY_BINASCII - -#define MICROPY_PY_UERRNO CIRCUITPY_ERRNO -// Uses about 80 bytes. -#define MICROPY_PY_UERRNO_ERRORCODE CIRCUITPY_ERRNO - -#define MICROPY_PY_URE CIRCUITPY_RE - -#if CIRCUITPY_JSON -#define MICROPY_PY_UJSON (1) -#define MICROPY_PY_IO (1) -#else -#ifndef MICROPY_PY_IO -// We don't need MICROPY_PY_IO unless someone else wants it. -#define MICROPY_PY_IO (0) -#endif -#endif - #ifndef ULAB_SUPPORTS_COMPLEX #define ULAB_SUPPORTS_COMPLEX (0) #endif @@ -419,7 +422,6 @@ struct _supervisor_allocation_node; #define CIRCUITPY_COMMON_ROOT_POINTERS \ FLASH_ROOT_POINTERS \ KEYPAD_ROOT_POINTERS \ - GAMEPAD_ROOT_POINTERS \ BOARD_UART_ROOT_POINTER \ WIFI_MONITOR_ROOT_POINTERS \ MEMORYMONITOR_ROOT_POINTERS \ @@ -553,6 +555,10 @@ void supervisor_run_background_tasks_if_tick(void); #error "CIRCUITPY_USB_HID_MAX_REPORT_IDS_PER_DESCRIPTOR must be at least 1" #endif +#ifndef CIRCUITPY_PORT_NUM_SUPERVISOR_ALLOCATIONS +#define CIRCUITPY_PORT_NUM_SUPERVISOR_ALLOCATIONS (0) +#endif + #ifndef USB_MIDI_EP_NUM_OUT #define USB_MIDI_EP_NUM_OUT (0) #endif @@ -573,6 +579,15 @@ void supervisor_run_background_tasks_if_tick(void); #define MICROPY_WRAP_MP_EXECUTE_BYTECODE PLACE_IN_ITCM #endif +#ifndef CIRCUITPY_DIGITALIO_HAVE_INVALID_PULL +#define CIRCUITPY_DIGITALIO_HAVE_INVALID_PULL (0) +#endif + +#ifndef CIRCUITPY_DIGITALIO_HAVE_INVALID_DRIVE_MODE +#define CIRCUITPY_DIGITALIO_HAVE_INVALID_DRIVE_MODE (0) +#endif + + #define MICROPY_PY_OPTIMIZE_PROPERTY_FLASH_SIZE (CIRCUITPY_OPTIMIZE_PROPERTY_FLASH_SIZE) #endif // __INCLUDED_MPCONFIG_CIRCUITPY_H diff --git a/py/circuitpy_mpconfig.mk b/py/circuitpy_mpconfig.mk index 1899541099..2e7ac2e1d8 100644 --- a/py/circuitpy_mpconfig.mk +++ b/py/circuitpy_mpconfig.mk @@ -26,6 +26,10 @@ # Boards default to all modules enabled (with exceptions) # Manually disable by overriding in #mpconfigboard.mk +# Always on. Present here to help generate documentation module support matrix for "builtins". +CIRCUITPY = 1 +CFLAGS += -DCIRCUITPY=$(CIRCUITPY) + # Smaller builds can be forced for resource constrained chips (typically SAMD21s # without external flash) by setting CIRCUITPY_FULL_BUILD=0. Avoid using this # for merely incomplete ports, as it changes settings in other files. @@ -57,15 +61,20 @@ CFLAGS += -DMICROPY_PY_USELECT_SELECT=$(MICROPY_PY_USELECT_SELECT) CIRCUITPY_AESIO ?= $(CIRCUITPY_FULL_BUILD) CFLAGS += -DCIRCUITPY_AESIO=$(CIRCUITPY_AESIO) -# TODO: CIRCUITPY_ALARM will gradually be added to -# as many ports as possible +# TODO: CIRCUITPY_ALARM will gradually be added to as many ports as possible # so make this 1 or CIRCUITPY_FULL_BUILD eventually CIRCUITPY_ALARM ?= 0 CFLAGS += -DCIRCUITPY_ALARM=$(CIRCUITPY_ALARM) +CIRCUITPY_ANALOGBUFIO ?= 0 +CFLAGS += -DCIRCUITPY_ANALOGBUFIO=$(CIRCUITPY_ANALOGBUFIO) + CIRCUITPY_ANALOGIO ?= 1 CFLAGS += -DCIRCUITPY_ANALOGIO=$(CIRCUITPY_ANALOGIO) +CIRCUITPY_ARRAY ?= 1 +CFLAGS += -DCIRCUITPY_ARRAY=$(CIRCUITPY_ARRAY) + CIRCUITPY_ATEXIT ?= $(CIRCUITPY_FULL_BUILD) CFLAGS += -DCIRCUITPY_ATEXIT=$(CIRCUITPY_ATEXIT) @@ -157,20 +166,17 @@ CFLAGS += -DCIRCUITPY_CAMERA=$(CIRCUITPY_CAMERA) CIRCUITPY_CANIO ?= 0 CFLAGS += -DCIRCUITPY_CANIO=$(CIRCUITPY_CANIO) -CIRCUITPY_DIGITALIO ?= 1 -CFLAGS += -DCIRCUITPY_DIGITALIO=$(CIRCUITPY_DIGITALIO) +CIRCUITPY_COLLECTIONS ?= 1 +CFLAGS += -DCIRCUITPY_COLLECTIONS=$(CIRCUITPY_COLLECTIONS) CIRCUITPY_COMPUTED_GOTO_SAVE_SPACE ?= 0 CFLAGS += -DCIRCUITPY_COMPUTED_GOTO_SAVE_SPACE=$(CIRCUITPY_COMPUTED_GOTO_SAVE_SPACE) -CIRCUITPY_OPT_LOAD_ATTR_FAST_PATH ?= 1 -CFLAGS += -DCIRCUITPY_OPT_LOAD_ATTR_FAST_PATH=$(CIRCUITPY_OPT_LOAD_ATTR_FAST_PATH) +CIRCUITPY_CYW43 ?= 0 +CFLAGS += -DCIRCUITPY_CYW43=$(CIRCUITPY_CYW43) -CIRCUITPY_OPT_MAP_LOOKUP_CACHE ?= $(CIRCUITPY_FULL_BUILD) -CFLAGS += -DCIRCUITPY_OPT_MAP_LOOKUP_CACHE=$(CIRCUITPY_OPT_MAP_LOOKUP_CACHE) - -CIRCUITPY_CONSOLE_UART ?= 0 -CFLAGS += -DCIRCUITPY_CONSOLE_UART=$(CIRCUITPY_CONSOLE_UART) +CIRCUITPY_DIGITALIO ?= 1 +CFLAGS += -DCIRCUITPY_DIGITALIO=$(CIRCUITPY_DIGITALIO) CIRCUITPY_COUNTIO ?= $(CIRCUITPY_FULL_BUILD) CFLAGS += -DCIRCUITPY_COUNTIO=$(CIRCUITPY_COUNTIO) @@ -199,6 +205,9 @@ CFLAGS += -DCIRCUITPY_BITMAPTOOLS=$(CIRCUITPY_BITMAPTOOLS) CFLAGS += -DCIRCUITPY_FRAMEBUFFERIO=$(CIRCUITPY_FRAMEBUFFERIO) CFLAGS += -DCIRCUITPY_VECTORIO=$(CIRCUITPY_VECTORIO) +CIRCUITPY_DOTENV ?= $(CIRCUITPY_FULL_BUILD) +CFLAGS += -DCIRCUITPY_DOTENV=$(CIRCUITPY_DOTENV) + CIRCUITPY_DUALBANK ?= 0 CFLAGS += -DCIRCUITPY_DUALBANK=$(CIRCUITPY_DUALBANK) @@ -215,6 +224,9 @@ CFLAGS += -DCIRCUITPY_ERRNO=$(CIRCUITPY_ERRNO) CIRCUITPY_ESPIDF ?= 0 CFLAGS += -DCIRCUITPY_ESPIDF=$(CIRCUITPY_ESPIDF) +CIRCUITPY_ESP32_CAMERA ?= 0 +CFLAGS += -DCIRCUITPY_ESP32_CAMERA=$(CIRCUITPY_ESP32_CAMERA) + CIRCUITPY__EVE ?= 0 CFLAGS += -DCIRCUITPY__EVE=$(CIRCUITPY__EVE) @@ -227,14 +239,11 @@ CFLAGS += -DCIRCUITPY_FREQUENCYIO=$(CIRCUITPY_FREQUENCYIO) CIRCUITPY_FUTURE ?= 1 CFLAGS += -DCIRCUITPY_FUTURE=$(CIRCUITPY_FUTURE) -CIRCUITPY_GAMEPADSHIFT ?= 0 -CFLAGS += -DCIRCUITPY_GAMEPADSHIFT=$(CIRCUITPY_GAMEPADSHIFT) - CIRCUITPY_GETPASS ?= $(CIRCUITPY_FULL_BUILD) CFLAGS += -DCIRCUITPY_GETPASS=$(CIRCUITPY_GETPASS) ifeq ($(CIRCUITPY_DISPLAYIO),1) -CIRCUITPY_GIFIO ?= $(CIRCUITPY_FULL_BUILD) +CIRCUITPY_GIFIO ?= $(CIRCUITPY_CAMERA) else CIRCUITPY_GIFIO ?= 0 endif @@ -243,12 +252,19 @@ CFLAGS += -DCIRCUITPY_GIFIO=$(CIRCUITPY_GIFIO) CIRCUITPY_GNSS ?= 0 CFLAGS += -DCIRCUITPY_GNSS=$(CIRCUITPY_GNSS) -CIRCUITPY_I2CPERIPHERAL ?= $(CIRCUITPY_FULL_BUILD) -CFLAGS += -DCIRCUITPY_I2CPERIPHERAL=$(CIRCUITPY_I2CPERIPHERAL) +CIRCUITPY_HASHLIB ?= $(CIRCUITPY_WEB_WORKFLOW) +CFLAGS += -DCIRCUITPY_HASHLIB=$(CIRCUITPY_HASHLIB) + +CIRCUITPY_I2CTARGET ?= $(CIRCUITPY_FULL_BUILD) +CFLAGS += -DCIRCUITPY_I2CTARGET=$(CIRCUITPY_I2CTARGET) CIRCUITPY_IMAGECAPTURE ?= 0 CFLAGS += -DCIRCUITPY_IMAGECAPTURE=$(CIRCUITPY_IMAGECAPTURE) +# io - needed by JSON support +CIRCUITPY_IO ?= $(CIRCUITPY_JSON) +CFLAGS += -DCIRCUITPY_IO=$(CIRCUITPY_IO) + CIRCUITPY_IPADDRESS ?= $(CIRCUITPY_WIFI) CFLAGS += -DCIRCUITPY_IPADDRESS=$(CIRCUITPY_IPADDRESS) @@ -285,6 +301,12 @@ CFLAGS += -DCIRCUITPY_NVM=$(CIRCUITPY_NVM) CIRCUITPY_ONEWIREIO ?= $(CIRCUITPY_BUSIO) CFLAGS += -DCIRCUITPY_ONEWIREIO=$(CIRCUITPY_ONEWIREIO) +CIRCUITPY_OPT_LOAD_ATTR_FAST_PATH ?= 1 +CFLAGS += -DCIRCUITPY_OPT_LOAD_ATTR_FAST_PATH=$(CIRCUITPY_OPT_LOAD_ATTR_FAST_PATH) + +CIRCUITPY_OPT_MAP_LOOKUP_CACHE ?= $(CIRCUITPY_FULL_BUILD) +CFLAGS += -DCIRCUITPY_OPT_MAP_LOOKUP_CACHE=$(CIRCUITPY_OPT_MAP_LOOKUP_CACHE) + CIRCUITPY_OS ?= 1 CFLAGS += -DCIRCUITPY_OS=$(CIRCUITPY_OS) @@ -366,10 +388,16 @@ CFLAGS += -DCIRCUITPY_SOCKETPOOL=$(CIRCUITPY_SOCKETPOOL) CIRCUITPY_SSL ?= $(CIRCUITPY_WIFI) CFLAGS += -DCIRCUITPY_SSL=$(CIRCUITPY_SSL) +CIRCUITPY_SSL_MBEDTLS ?= 0 +CFLAGS += -DCIRCUITPY_SSL_MBEDTLS=$(CIRCUITPY_SSL_MBEDTLS) + # Currently always off. CIRCUITPY_STAGE ?= 0 CFLAGS += -DCIRCUITPY_STAGE=$(CIRCUITPY_STAGE) +CIRCUITPY_STATUS_BAR ?= 1 +CFLAGS += -DCIRCUITPY_STATUS_BAR=$(CIRCUITPY_STATUS_BAR) + CIRCUITPY_STORAGE ?= 1 CFLAGS += -DCIRCUITPY_STORAGE=$(CIRCUITPY_STORAGE) @@ -382,9 +410,17 @@ CFLAGS += -DCIRCUITPY_SUPERVISOR=$(CIRCUITPY_SUPERVISOR) CIRCUITPY_SYNTHIO ?= $(CIRCUITPY_AUDIOCORE) CFLAGS += -DCIRCUITPY_SYNTHIO=$(CIRCUITPY_SYNTHIO) +CIRCUITPY_SYS ?= 1 +CFLAGS += -DCIRCUITPY_SYS=$(CIRCUITPY_SYS) + CIRCUITPY_TERMINALIO ?= $(CIRCUITPY_DISPLAYIO) CFLAGS += -DCIRCUITPY_TERMINALIO=$(CIRCUITPY_TERMINALIO) +ifeq ($(CIRCUITPY_DISPLAYIO),1) +CIRCUITPY_FONTIO ?= $(CIRCUITPY_TERMINALIO) +endif +CFLAGS += -DCIRCUITPY_FONTIO=$(CIRCUITPY_FONTIO) + CIRCUITPY_TIME ?= 1 CFLAGS += -DCIRCUITPY_TIME=$(CIRCUITPY_TIME) @@ -434,6 +470,9 @@ CFLAGS += -DCIRCUITPY_USB_HID_ENABLED_DEFAULT=$(CIRCUITPY_USB_HID_ENABLED_DEFAUL CIRCUITPY_USB_HOST ?= 0 CFLAGS += -DCIRCUITPY_USB_HOST=$(CIRCUITPY_USB_HOST) +CIRCUITPY_USB_IDENTIFICATION ?= $(CIRCUITPY_USB) +CFLAGS += -DCIRCUITPY_USB_IDENTIFICATION=$(CIRCUITPY_USB_IDENTIFICATION) + # MIDI is available by default, but is not turned on if there are fewer than 8 endpoints. CIRCUITPY_USB_MIDI ?= $(CIRCUITPY_USB) CFLAGS += -DCIRCUITPY_USB_MIDI=$(CIRCUITPY_USB_MIDI) @@ -461,7 +500,7 @@ CIRCUITPY_USTACK ?= 0 CFLAGS += -DCIRCUITPY_USTACK=$(CIRCUITPY_USTACK) # for decompressing utlities -CIRCUITPY_ZLIB ?= 1 +CIRCUITPY_ZLIB ?= $(CIRCUITPY_FULL_BUILD) CFLAGS += -DCIRCUITPY_ZLIB=$(CIRCUITPY_ZLIB) # ulab numerics library @@ -481,6 +520,9 @@ CFLAGS += -DCIRCUITPY_WATCHDOG=$(CIRCUITPY_WATCHDOG) CIRCUITPY_WIFI ?= 0 CFLAGS += -DCIRCUITPY_WIFI=$(CIRCUITPY_WIFI) +CIRCUITPY_WEB_WORKFLOW ?= $(CIRCUITPY_WIFI) +CFLAGS += -DCIRCUITPY_WEB_WORKFLOW=$(CIRCUITPY_WEB_WORKFLOW) + # tinyusb port tailored configuration CIRCUITPY_TUSB_MEM_ALIGN ?= 4 CFLAGS += -DCIRCUITPY_TUSB_MEM_ALIGN=$(CIRCUITPY_TUSB_MEM_ALIGN) diff --git a/py/compile.c b/py/compile.c index e5f341a656..432aeca561 100644 --- a/py/compile.c +++ b/py/compile.c @@ -37,7 +37,7 @@ #include "py/asmbase.h" #include "py/persistentcode.h" -#include "supervisor/shared/translate.h" +#include "supervisor/shared/translate/translate.h" #if MICROPY_ENABLE_COMPILER diff --git a/py/enum.c b/py/enum.c index 4728c7f11d..681c3b3103 100644 --- a/py/enum.c +++ b/py/enum.c @@ -27,6 +27,8 @@ #include "py/enum.h" #include "py/runtime.h" +#include "supervisor/shared/translate/translate.h" + mp_obj_t cp_enum_find(const mp_obj_type_t *type, int value) { const mp_obj_dict_t *dict = type->locals_dict; for (size_t i = 0; i < dict->map.used; i++) { diff --git a/py/formatfloat.c b/py/formatfloat.c index 06775167c0..d75cfc6658 100644 --- a/py/formatfloat.c +++ b/py/formatfloat.c @@ -25,6 +25,7 @@ */ #include "py/mpconfig.h" +#include "py/misc.h" #if MICROPY_FLOAT_IMPL != MICROPY_FLOAT_IMPL_NONE #include @@ -96,7 +97,16 @@ static inline int fp_isless1(float x) { #define fp_iszero(x) (x == 0) #define fp_isless1(x) (x < 1.0) -#endif +#endif // MICROPY_FLOAT_IMPL == MICROPY_FLOAT_IMPL_FLOAT/DOUBLE + +static inline int fp_ge_eps(FPTYPE x, FPTYPE y) { + mp_float_union_t fb_y = {y}; + // Back off 2 eps. + // This is valid for almost all values, but in practice + // it's only used when y = 1eX for X>=0. + fb_y.i -= 2; + return x >= fb_y.f; +} static const FPTYPE g_pos_pow[] = { #if FPDECEXP > 32 @@ -173,6 +183,7 @@ int mp_format_float(FPTYPE f, char *buf, size_t buf_size, char fmt, int prec, ch int num_digits = 0; const FPTYPE *pos_pow = g_pos_pow; const FPTYPE *neg_pow = g_neg_pow; + int signed_e = 0; if (fp_iszero(f)) { e = 0; @@ -192,31 +203,24 @@ int mp_format_float(FPTYPE f, char *buf, size_t buf_size, char fmt, int prec, ch } } } else if (fp_isless1(f)) { - // We need to figure out what an integer digit will be used - // in case 'f' is used (or we revert other format to it below). - // As we just tested number to be <1, this is obviously 0, - // but we can round it up to 1 below. - char first_dig = '0'; - if (f >= FPROUND_TO_ONE) { - first_dig = '1'; - } - + FPTYPE f_mod = f; // Build negative exponent for (e = 0, e1 = FPDECEXP; e1; e1 >>= 1, pos_pow++, neg_pow++) { - if (*neg_pow > f) { + if (*neg_pow > f_mod) { e += e1; - f *= *pos_pow; + f_mod *= *pos_pow; } } + char e_sign_char = '-'; - if (fp_isless1(f) && f >= FPROUND_TO_ONE) { - f = FPCONST(1.0); + if (fp_isless1(f_mod) && f_mod >= FPROUND_TO_ONE) { + f_mod = FPCONST(1.0); if (e == 0) { e_sign_char = '+'; } - } else if (fp_isless1(f)) { + } else if (fp_isless1(f_mod)) { e++; - f *= FPCONST(10.0); + f_mod *= FPCONST(10.0); } // If the user specified 'g' format, and e is <= 4, then we'll switch @@ -224,8 +228,7 @@ int mp_format_float(FPTYPE f, char *buf, size_t buf_size, char fmt, int prec, ch if (fmt == 'f' || (fmt == 'g' && e <= 4)) { fmt = 'f'; - dec = -1; - *s++ = first_dig; + dec = 0; if (org_fmt == 'g') { prec += (e - 1); @@ -237,13 +240,8 @@ int mp_format_float(FPTYPE f, char *buf, size_t buf_size, char fmt, int prec, ch } num_digits = prec; - if (num_digits) { - *s++ = '.'; - while (--e && num_digits) { - *s++ = '0'; - num_digits--; - } - } + signed_e = 0; + ++num_digits; } else { // For e & g formats, we'll be printing the exponent, so set the // sign. @@ -256,22 +254,29 @@ int mp_format_float(FPTYPE f, char *buf, size_t buf_size, char fmt, int prec, ch prec++; } } + signed_e = -e; } } else { - // Build positive exponent - for (e = 0, e1 = FPDECEXP; e1; e1 >>= 1, pos_pow++, neg_pow++) { - if (*pos_pow <= f) { + // Build positive exponent. + // We don't modify f at this point to avoid innaccuracies from + // scaling it. Instead, we find the product of powers of 10 + // that is not greater than it, and use that to start the + // mantissa. + FPTYPE u_base = FPCONST(1.0); + for (e = 0, e1 = FPDECEXP; e1; e1 >>= 1, pos_pow++) { + FPTYPE next_u = u_base * *pos_pow; + // fp_ge_eps performs "f >= (next_u - 2eps)" so that if, for + // numerical reasons, f is very close to a power of ten but + // not strictly equal, we still treat it as that power of 10. + // The comparison was failing for maybe 10% of 1eX values, but + // although rounding fixed many of them, there were still some + // rendering as 9.99999998e(X-1). + if (fp_ge_eps(f, next_u)) { + u_base = next_u; e += e1; - f *= *neg_pow; } } - // It can be that f was right on the edge of an entry in pos_pow needs to be reduced - if ((int)f >= 10) { - e += 1; - f *= FPCONST(0.1); - } - // If the user specified fixed format (fmt == 'f') and e makes the // number too big to fit into the available buffer, then we'll // switch to the 'e' format. @@ -310,15 +315,15 @@ int mp_format_float(FPTYPE f, char *buf, size_t buf_size, char fmt, int prec, ch } else { e_sign = '+'; } + signed_e = e; } if (prec < 0) { // This can happen when the prec is trimmed to prevent buffer overflow prec = 0; } - // We now have num.f as a floating point number between >= 1 and < 10 - // (or equal to zero), and e contains the absolute value of the power of - // 10 exponent. and (dec + 1) == the number of dgits before the decimal. + // At this point e contains the absolute value of the power of 10 exponent. + // (dec + 1) == the number of dgits before the decimal. // For e, prec is # digits after the decimal // For f, prec is # digits after the decimal @@ -336,25 +341,63 @@ int mp_format_float(FPTYPE f, char *buf, size_t buf_size, char fmt, int prec, ch num_digits = prec; } - // Print the digits of the mantissa - for (int i = 0; i < num_digits; ++i, --dec) { - int32_t d = (int32_t)f; - if (d < 0) { - *s++ = '0'; - } else { - *s++ = '0' + d; + if (signed_e < 0) { + // The algorithm below treats numbers smaller than 1 by scaling them + // repeatedly by 10 to bring the new digit to the top. Our input number + // was smaller than 1, so scale it up to be 1 <= f < 10. + FPTYPE u_base = FPCONST(1.0); + const FPTYPE *pow_u = g_pos_pow; + for (int m = FPDECEXP; m; m >>= 1, pow_u++) { + if (m & e) { + u_base *= *pow_u; + } } - if (dec == 0 && prec > 0) { - *s++ = '.'; - } - f -= (FPTYPE)d; - f *= FPCONST(10.0); + f *= u_base; } - // Round - // If we print non-exponential format (i.e. 'f'), but a digit we're going - // to round by (e) is too far away, then there's nothing to round. - if ((org_fmt != 'f' || e <= num_digits) && f >= FPCONST(5.0)) { + int d = 0; + int num_digits_left = num_digits; + for (int digit_index = signed_e; num_digits_left >= 0; --digit_index) { + FPTYPE u_base = FPCONST(1.0); + if (digit_index > 0) { + // Generate 10^digit_index for positive digit_index. + const FPTYPE *pow_u = g_pos_pow; + int target_index = digit_index; + for (int m = FPDECEXP; m; m >>= 1, pow_u++) { + if (m & target_index) { + u_base *= *pow_u; + } + } + } + for (d = 0; d < 9; ++d) { + // This is essentially "if (f < u_base)", but with 2eps margin + // so that if f is just a tiny bit smaller, we treat it as + // equal (and accept the additional digit value). + if (!fp_ge_eps(f, u_base)) { + break; + } + f -= u_base; + } + // We calculate one more digit than we display, to use in rounding + // below. So only emit the digit if it's one that we display. + if (num_digits_left > 0) { + // Emit this number (the leading digit). + *s++ = '0' + d; + if (dec == 0 && prec > 0) { + *s++ = '.'; + } + } + --dec; + --num_digits_left; + if (digit_index <= 0) { + // Once we get below 1.0, we scale up f instead of calculting + // negative powers of 10 in u_base. This provides better + // renditions of exact decimals like 1/16 etc. + f *= FPCONST(10.0); + } + } + // Rounding. If the next digit to print is >= 5, round up. + if (d >= 5) { char *rs = s; rs--; while (1) { @@ -394,7 +437,10 @@ int mp_format_float(FPTYPE f, char *buf, size_t buf_size, char fmt, int prec, ch } } else { // Need at extra digit at the end to make room for the leading '1' - s++; + // but if we're at the buffer size limit, just drop the final digit. + if ((size_t)(s + 1 - buf) < buf_size) { + s++; + } } char *ss = s; while (ss > rs) { diff --git a/py/lexer.c b/py/lexer.c index 196f9a2644..0d6de0d522 100644 --- a/py/lexer.c +++ b/py/lexer.c @@ -32,7 +32,7 @@ #include "py/lexer.h" #include "py/runtime.h" -#include "supervisor/shared/translate.h" +#include "supervisor/shared/translate/translate.h" #if MICROPY_ENABLE_COMPILER diff --git a/py/makeqstrdata.py b/py/makeqstrdata.py index 74ad78c47d..2abbdedefd 100644 --- a/py/makeqstrdata.py +++ b/py/makeqstrdata.py @@ -4,7 +4,7 @@ Process raw qstr file and output qstr data with length, hash and data bytes. This script works with Python 2.7, 3.3 and 3.4. For documentation about the format of compressed translated strings, see -supervisor/shared/translate.h +supervisor/shared/translate/translate.h """ from __future__ import print_function @@ -24,10 +24,6 @@ if hasattr(sys.stdout, "reconfigure"): py = os.path.dirname(sys.argv[0]) top = os.path.dirname(py) -sys.path.append(os.path.join(top, "tools/huffman")) - -import huffman - # Python 2/3 compatibility: # - iterating through bytes is different # - codepoint2name lives in a different module @@ -262,325 +258,6 @@ def compute_hash(qstr, bytes_hash): return (hash & ((1 << (8 * bytes_hash)) - 1)) or 1 -def translate(translation_file, i18ns): - with open(translation_file, "rb") as f: - table = gettext.GNUTranslations(f) - - translations = [] - for original in i18ns: - unescaped = original - for s in C_ESCAPES: - unescaped = unescaped.replace(C_ESCAPES[s], s) - translation = table.gettext(unescaped) - # Add in carriage returns to work in terminals - translation = translation.replace("\n", "\r\n") - translations.append((original, translation)) - return translations - - -class TextSplitter: - def __init__(self, words): - words = sorted(words, key=lambda x: len(x), reverse=True) - self.words = set(words) - if words: - pat = "|".join(re.escape(w) for w in words) + "|." - else: - pat = "." - self.pat = re.compile(pat, flags=re.DOTALL) - - def iter_words(self, text): - s = [] - words = self.words - for m in self.pat.finditer(text): - t = m.group(0) - if t in words: - if s: - yield (False, "".join(s)) - s = [] - yield (True, t) - else: - s.append(t) - if s: - yield (False, "".join(s)) - - def iter(self, text): - for m in self.pat.finditer(text): - yield m.group(0) - - -def iter_substrings(s, minlen, maxlen): - len_s = len(s) - maxlen = min(len_s, maxlen) - for n in range(minlen, maxlen + 1): - for begin in range(0, len_s - n + 1): - yield s[begin : begin + n] - - -def compute_huffman_coding(translations, compression_filename): - texts = [t[1] for t in translations] - words = [] - - start_unused = 0x80 - end_unused = 0xFF - max_ord = 0 - for text in texts: - for c in text: - ord_c = ord(c) - max_ord = max(ord_c, max_ord) - if 0x80 <= ord_c < 0xFF: - end_unused = min(ord_c, end_unused) - max_words = end_unused - 0x80 - - bits_per_codepoint = 16 if max_ord > 255 else 8 - values_type = "uint16_t" if max_ord > 255 else "uint8_t" - while len(words) < max_words: - # Until the dictionary is filled to capacity, use a heuristic to find - # the best "word" (2- to 11-gram) to add to it. - # - # The TextSplitter allows us to avoid considering parts of the text - # that are already covered by a previously chosen word, for example - # if "the" is in words then not only will "the" not be considered - # again, neither will "there" or "wither", since they have "the" - # as substrings. - extractor = TextSplitter(words) - counter = collections.Counter() - for t in texts: - for atom in extractor.iter(t): - counter[atom] += 1 - cb = huffman.codebook(counter.items()) - lengths = sorted(dict((v, len(cb[k])) for k, v in counter.items()).items()) - - def bit_length(s): - return sum(len(cb[c]) for c in s) - - def est_len(occ): - idx = bisect.bisect_left(lengths, (occ, 0)) - return lengths[idx][1] + 1 - - # The cost of adding a dictionary word is just its storage size - # while its savings is close to the difference between the original - # huffman bit-length of the string and the estimated bit-length - # of the dictionary word, times the number of times the word appears. - # - # The savings is not strictly accurate because including a word into - # the Huffman tree bumps up the encoding lengths of all words in the - # same subtree. In the extreme case when the new word is so frequent - # that it gets a one-bit encoding, all other words will cost an extra - # bit each. This is empirically modeled by the constant factor added to - # cost, but the specific value used isn't "proven" to be correct. - # - # Another source of inaccuracy is that compressed strings end up - # on byte boundaries, not bit boundaries, so saving 1 bit somewhere - # might not save a byte. - # - # In fact, when this change was first made, some translations (luckily, - # ones on boards not at all close to full) wasted up to 40 bytes, - # while the most constrained boards typically gained 100 bytes or - # more. - # - # The difference between the two is the estimated net savings, in bits. - def est_net_savings(s, occ): - savings = occ * (bit_length(s) - est_len(occ)) - cost = len(s) * bits_per_codepoint + 24 - return savings - cost - - counter = collections.Counter() - for t in texts: - for (found, word) in extractor.iter_words(t): - if not found: - for substr in iter_substrings(word, minlen=2, maxlen=11): - counter[substr] += 1 - - # Score the candidates we found. This is a semi-empirical formula that - # attempts to model the number of bits saved as closely as possible. - # - # It attempts to compute the codeword lengths of the original word - # to the codeword length the dictionary entry would get, times - # the number of occurrences, less the ovehead of the entries in the - # words[] array. - - scores = sorted( - ((s, -est_net_savings(s, occ)) for (s, occ) in counter.items()), key=lambda x: x[1] - ) - - # Pick the one with the highest score. The score must be negative. - if not scores or scores[0][-1] >= 0: - break - - word = scores[0][0] - words.append(word) - - words.sort(key=len) - extractor = TextSplitter(words) - counter = collections.Counter() - for t in texts: - for atom in extractor.iter(t): - counter[atom] += 1 - cb = huffman.codebook(counter.items()) - - word_start = start_unused - word_end = word_start + len(words) - 1 - print("// # words", len(words)) - print("// words", words) - - values = [] - length_count = {} - renumbered = 0 - last_length = None - canonical = {} - for atom, code in sorted(cb.items(), key=lambda x: (len(x[1]), x[0])): - values.append(atom) - length = len(code) - if length not in length_count: - length_count[length] = 0 - length_count[length] += 1 - if last_length: - renumbered <<= length - last_length - canonical[atom] = "{0:0{width}b}".format(renumbered, width=length) - # print(f"atom={repr(atom)} code={code}", file=sys.stderr) - if len(atom) > 1: - o = words.index(atom) + 0x80 - s = "".join(C_ESCAPES.get(ch1, ch1) for ch1 in atom) - else: - s = C_ESCAPES.get(atom, atom) - o = ord(atom) - print("//", o, s, counter[atom], canonical[atom], renumbered) - renumbered += 1 - last_length = length - lengths = bytearray() - print("// length count", length_count) - - for i in range(1, max(length_count) + 2): - lengths.append(length_count.get(i, 0)) - print("// values", values, "lengths", len(lengths), lengths) - - print("//", values, lengths) - values = [(atom if len(atom) == 1 else chr(0x80 + words.index(atom))) for atom in values] - max_translation_encoded_length = max( - len(translation.encode("utf-8")) for (original, translation) in translations - ) - - maxlen = len(words[-1]) - minlen = len(words[0]) - wlencount = [len([None for w in words if len(w) == l]) for l in range(minlen, maxlen + 1)] - - with open(compression_filename, "w") as f: - f.write("typedef {} mchar_t;".format(values_type)) - f.write("const uint8_t lengths[] = {{ {} }};\n".format(", ".join(map(str, lengths)))) - f.write( - "const mchar_t values[] = {{ {} }};\n".format(", ".join(str(ord(u)) for u in values)) - ) - f.write( - "#define compress_max_length_bits ({})\n".format( - max_translation_encoded_length.bit_length() - ) - ) - f.write( - "const mchar_t words[] = {{ {} }};\n".format( - ", ".join(str(ord(c)) for w in words for c in w) - ) - ) - f.write( - "const uint8_t wlencount[] = {{ {} }};\n".format(", ".join(str(p) for p in wlencount)) - ) - f.write("#define word_start {}\n".format(word_start)) - f.write("#define word_end {}\n".format(word_end)) - f.write("#define minlen {}\n".format(minlen)) - f.write("#define maxlen {}\n".format(maxlen)) - - return (values, lengths, words, canonical, extractor) - - -def decompress(encoding_table, encoded, encoded_length_bits): - (values, lengths, words, _, _) = encoding_table - dec = [] - this_byte = 0 - this_bit = 7 - b = encoded[this_byte] - bits = 0 - for i in range(encoded_length_bits): - bits <<= 1 - if 0x80 & b: - bits |= 1 - - b <<= 1 - if this_bit == 0: - this_bit = 7 - this_byte += 1 - if this_byte < len(encoded): - b = encoded[this_byte] - else: - this_bit -= 1 - length = bits - - i = 0 - while i < length: - bits = 0 - bit_length = 0 - max_code = lengths[0] - searched_length = lengths[0] - while True: - bits <<= 1 - if 0x80 & b: - bits |= 1 - - b <<= 1 - bit_length += 1 - if this_bit == 0: - this_bit = 7 - this_byte += 1 - if this_byte < len(encoded): - b = encoded[this_byte] - else: - this_bit -= 1 - if max_code > 0 and bits < max_code: - # print('{0:0{width}b}'.format(bits, width=bit_length)) - break - max_code = (max_code << 1) + lengths[bit_length] - searched_length += lengths[bit_length] - - v = values[searched_length + bits - max_code] - if v >= chr(0x80) and v < chr(0x80 + len(words)): - v = words[ord(v) - 0x80] - i += len(v.encode("utf-8")) - dec.append(v) - return "".join(dec) - - -def compress(encoding_table, decompressed, encoded_length_bits, len_translation_encoded): - if not isinstance(decompressed, str): - raise TypeError() - (_, _, _, canonical, extractor) = encoding_table - - enc = bytearray(len(decompressed) * 3) - current_bit = 7 - current_byte = 0 - - bits = encoded_length_bits + 1 - for i in range(bits - 1, 0, -1): - if len_translation_encoded & (1 << (i - 1)): - enc[current_byte] |= 1 << current_bit - if current_bit == 0: - current_bit = 7 - current_byte += 1 - else: - current_bit -= 1 - - for atom in extractor.iter(decompressed): - for b in canonical[atom]: - if b == "1": - enc[current_byte] |= 1 << current_bit - if current_bit == 0: - current_bit = 7 - current_byte += 1 - else: - current_bit -= 1 - - if current_bit != 7: - current_byte += 1 - return enc[:current_byte] - - def qstr_escape(qst): def esc_char(m): c = ord(m.group(0)) @@ -694,7 +371,7 @@ def make_bytes(cfg_bytes_len, cfg_bytes_hash, qstr): return '%d, %d, "%s"' % (qhash, qlen, qdata) -def print_qstr_data(encoding_table, qcfgs, qstrs, i18ns): +def print_qstr_data(qcfgs, qstrs, i18ns): # get config variables cfg_bytes_len = int(qcfgs["BYTES_IN_LEN"]) cfg_bytes_hash = int(qcfgs["BYTES_IN_HASH"]) @@ -707,7 +384,6 @@ def print_qstr_data(encoding_table, qcfgs, qstrs, i18ns): print('QDEF(MP_QSTRnull, 0, 0, "")') total_qstr_size = 0 - total_qstr_compressed_size = 0 # go through each qstr and print it out for order, ident, qstr in sorted(qstrs.values(), key=lambda x: x[0]): qbytes = make_bytes(cfg_bytes_len, cfg_bytes_hash, qstr) @@ -715,34 +391,14 @@ def print_qstr_data(encoding_table, qcfgs, qstrs, i18ns): total_qstr_size += len(qstr) - total_text_size = 0 - total_text_compressed_size = 0 - max_translation_encoded_length = max( - len(translation.encode("utf-8")) for original, translation in i18ns + print( + "// Enumerate translated texts but don't actually include translations. Instead, the linker will link them in." ) - encoded_length_bits = max_translation_encoded_length.bit_length() - for original, translation in i18ns: - translation_encoded = translation.encode("utf-8") - compressed = compress( - encoding_table, translation, encoded_length_bits, len(translation_encoded) - ) - total_text_compressed_size += len(compressed) - decompressed = decompress(encoding_table, compressed, encoded_length_bits) - assert decompressed == translation - for c in C_ESCAPES: - decompressed = decompressed.replace(c, C_ESCAPES[c]) - print( - 'TRANSLATION("{}", {}) // {}'.format( - original, ", ".join(["{:d}".format(x) for x in compressed]), decompressed - ) - ) - total_text_size += len(translation.encode("utf-8")) + for i, original in enumerate(i18ns): + print('TRANSLATION("{}", {})'.format(original, i)) print() print("// {} bytes worth of qstr".format(total_qstr_size)) - print("// {} bytes worth of translations".format(total_text_size)) - print("// {} bytes worth of translations compressed".format(total_text_compressed_size)) - print("// {} bytes saved".format(total_text_size - total_text_compressed_size)) def print_qstr_enums(qstrs): @@ -768,19 +424,18 @@ if __name__ == "__main__": "infiles", metavar="N", type=str, nargs="+", help="an integer for the accumulator" ) parser.add_argument( - "--translation", default=None, type=str, help="translations for i18n() items" - ) - parser.add_argument( - "--compression_filename", default=None, type=str, help="header for compression info" + "--output_type", + default="enums", + type=str, + help="output definitions", + choices=("enums", "data"), ) args = parser.parse_args() qcfgs, qstrs, i18ns = parse_input_headers(args.infiles) - if args.translation: + if args.output_type == "data": i18ns = sorted(i18ns) - translations = translate(args.translation, i18ns) - encoding_table = compute_huffman_coding(translations, args.compression_filename) - print_qstr_data(encoding_table, qcfgs, qstrs, translations) + print_qstr_data(qcfgs, qstrs, i18ns) else: print_qstr_enums(qstrs) diff --git a/py/maketranslationdata.py b/py/maketranslationdata.py new file mode 100644 index 0000000000..c0ae85f4e0 --- /dev/null +++ b/py/maketranslationdata.py @@ -0,0 +1,526 @@ +""" +Process raw qstr file and output qstr data with length, hash and data bytes. + +This script works with Python 2.7, 3.3 and 3.4. + +For documentation about the format of compressed translated strings, see +supervisor/shared/translate/translate.h +""" + +from __future__ import print_function + +import bisect +import re +import sys + +import collections +import gettext +import os.path + +if hasattr(sys.stdout, "reconfigure"): + sys.stdout.reconfigure(encoding="utf-8") + sys.stderr.reconfigure(errors="backslashreplace") + +py = os.path.dirname(sys.argv[0]) +top = os.path.dirname(py) + +sys.path.append(os.path.join(top, "tools/huffman")) + +import huffman + +# Python 2/3 compatibility: +# - iterating through bytes is different +# - codepoint2name lives in a different module +import platform + +if platform.python_version_tuple()[0] == "2": + bytes_cons = lambda val, enc=None: bytearray(val) + from htmlentitydefs import codepoint2name +elif platform.python_version_tuple()[0] == "3": + bytes_cons = bytes + from html.entities import codepoint2name +# end compatibility code + +codepoint2name[ord("-")] = "hyphen" + +# add some custom names to map characters that aren't in HTML +codepoint2name[ord(" ")] = "space" +codepoint2name[ord("'")] = "squot" +codepoint2name[ord(",")] = "comma" +codepoint2name[ord(".")] = "dot" +codepoint2name[ord(":")] = "colon" +codepoint2name[ord(";")] = "semicolon" +codepoint2name[ord("/")] = "slash" +codepoint2name[ord("%")] = "percent" +codepoint2name[ord("#")] = "hash" +codepoint2name[ord("(")] = "paren_open" +codepoint2name[ord(")")] = "paren_close" +codepoint2name[ord("[")] = "bracket_open" +codepoint2name[ord("]")] = "bracket_close" +codepoint2name[ord("{")] = "brace_open" +codepoint2name[ord("}")] = "brace_close" +codepoint2name[ord("*")] = "star" +codepoint2name[ord("!")] = "bang" +codepoint2name[ord("\\")] = "backslash" +codepoint2name[ord("+")] = "plus" +codepoint2name[ord("$")] = "dollar" +codepoint2name[ord("=")] = "equals" +codepoint2name[ord("?")] = "question" +codepoint2name[ord("@")] = "at_sign" +codepoint2name[ord("^")] = "caret" +codepoint2name[ord("|")] = "pipe" +codepoint2name[ord("~")] = "tilde" + +C_ESCAPES = { + "\a": "\\a", + "\b": "\\b", + "\f": "\\f", + "\n": "\\n", + "\r": "\\r", + "\t": "\\t", + "\v": "\\v", + "'": "\\'", + '"': '\\"', +} + +# this must match the equivalent function in qstr.c +def compute_hash(qstr, bytes_hash): + hash = 5381 + for b in qstr: + hash = (hash * 33) ^ b + # Make sure that valid hash is never zero, zero means "hash not computed" + return (hash & ((1 << (8 * bytes_hash)) - 1)) or 1 + + +def translate(translation_file, i18ns): + with open(translation_file, "rb") as f: + table = gettext.GNUTranslations(f) + + translations = [] + for original in i18ns: + unescaped = original + for s in C_ESCAPES: + unescaped = unescaped.replace(C_ESCAPES[s], s) + translation = table.gettext(unescaped) + # Add in carriage returns to work in terminals + translation = translation.replace("\n", "\r\n") + translations.append((original, translation)) + return translations + + +class TextSplitter: + def __init__(self, words): + words = sorted(words, key=lambda x: len(x), reverse=True) + self.words = set(words) + if words: + pat = "|".join(re.escape(w) for w in words) + "|." + else: + pat = "." + self.pat = re.compile(pat, flags=re.DOTALL) + + def iter_words(self, text): + s = [] + words = self.words + for m in self.pat.finditer(text): + t = m.group(0) + if t in words: + if s: + yield (False, "".join(s)) + s = [] + yield (True, t) + else: + s.append(t) + if s: + yield (False, "".join(s)) + + def iter(self, text): + for m in self.pat.finditer(text): + yield m.group(0) + + +def iter_substrings(s, minlen, maxlen): + len_s = len(s) + maxlen = min(len_s, maxlen) + for n in range(minlen, maxlen + 1): + for begin in range(0, len_s - n + 1): + yield s[begin : begin + n] + + +def compute_huffman_coding(translations, f): + texts = [t[1] for t in translations] + words = [] + + start_unused = 0x80 + end_unused = 0xFF + max_ord = 0 + for text in texts: + for c in text: + ord_c = ord(c) + max_ord = max(ord_c, max_ord) + if 0x80 <= ord_c < 0xFF: + end_unused = min(ord_c, end_unused) + max_words = end_unused - 0x80 + + bits_per_codepoint = 16 if max_ord > 255 else 8 + values_type = "uint16_t" if max_ord > 255 else "uint8_t" + while len(words) < max_words: + # Until the dictionary is filled to capacity, use a heuristic to find + # the best "word" (2- to 11-gram) to add to it. + # + # The TextSplitter allows us to avoid considering parts of the text + # that are already covered by a previously chosen word, for example + # if "the" is in words then not only will "the" not be considered + # again, neither will "there" or "wither", since they have "the" + # as substrings. + extractor = TextSplitter(words) + counter = collections.Counter() + for t in texts: + for atom in extractor.iter(t): + counter[atom] += 1 + cb = huffman.codebook(counter.items()) + lengths = sorted(dict((v, len(cb[k])) for k, v in counter.items()).items()) + + def bit_length(s): + return sum(len(cb[c]) for c in s) + + def est_len(occ): + idx = bisect.bisect_left(lengths, (occ, 0)) + return lengths[idx][1] + 1 + + # The cost of adding a dictionary word is just its storage size + # while its savings is close to the difference between the original + # huffman bit-length of the string and the estimated bit-length + # of the dictionary word, times the number of times the word appears. + # + # The savings is not strictly accurate because including a word into + # the Huffman tree bumps up the encoding lengths of all words in the + # same subtree. In the extreme case when the new word is so frequent + # that it gets a one-bit encoding, all other words will cost an extra + # bit each. This is empirically modeled by the constant factor added to + # cost, but the specific value used isn't "proven" to be correct. + # + # Another source of inaccuracy is that compressed strings end up + # on byte boundaries, not bit boundaries, so saving 1 bit somewhere + # might not save a byte. + # + # In fact, when this change was first made, some translations (luckily, + # ones on boards not at all close to full) wasted up to 40 bytes, + # while the most constrained boards typically gained 100 bytes or + # more. + # + # The difference between the two is the estimated net savings, in bits. + def est_net_savings(s, occ): + savings = occ * (bit_length(s) - est_len(occ)) + cost = len(s) * bits_per_codepoint + 24 + return savings - cost + + counter = collections.Counter() + for t in texts: + for (found, word) in extractor.iter_words(t): + if not found: + for substr in iter_substrings(word, minlen=2, maxlen=11): + counter[substr] += 1 + + # Score the candidates we found. This is a semi-empirical formula that + # attempts to model the number of bits saved as closely as possible. + # + # It attempts to compute the codeword lengths of the original word + # to the codeword length the dictionary entry would get, times + # the number of occurrences, less the ovehead of the entries in the + # words[] array. + + scores = sorted( + ((s, -est_net_savings(s, occ)) for (s, occ) in counter.items() if occ > 1), + key=lambda x: x[1], + ) + + # Pick the one with the highest score. The score must be negative. + if not scores or scores[0][-1] >= 0: + break + + word = scores[0][0] + words.append(word) + + words.sort(key=len) + extractor = TextSplitter(words) + counter = collections.Counter() + for t in texts: + for atom in extractor.iter(t): + counter[atom] += 1 + cb = huffman.codebook(counter.items()) + + word_start = start_unused + word_end = word_start + len(words) - 1 + f.write(f"// # words {len(words)}\n") + f.write(f"// words {words}\n") + + values = [] + length_count = {} + renumbered = 0 + last_length = None + canonical = {} + for atom, code in sorted(cb.items(), key=lambda x: (len(x[1]), x[0])): + values.append(atom) + length = len(code) + if length not in length_count: + length_count[length] = 0 + length_count[length] += 1 + if last_length: + renumbered <<= length - last_length + canonical[atom] = "{0:0{width}b}".format(renumbered, width=length) + # print(f"atom={repr(atom)} code={code}", file=sys.stderr) + if len(atom) > 1: + o = words.index(atom) + 0x80 + s = "".join(C_ESCAPES.get(ch1, ch1) for ch1 in atom) + else: + s = C_ESCAPES.get(atom, atom) + o = ord(atom) + f.write(f"// {o} {s} {counter[atom]} {canonical[atom]} {renumbered}\n") + renumbered += 1 + last_length = length + lengths = bytearray() + f.write(f"// length count {length_count}\n") + + for i in range(1, max(length_count) + 2): + lengths.append(length_count.get(i, 0)) + f.write(f"// values {values} lengths {len(lengths)} {lengths}\n") + + f.write(f"// {values} {lengths}\n") + values = [(atom if len(atom) == 1 else chr(0x80 + words.index(atom))) for atom in values] + max_translation_encoded_length = max( + len(translation.encode("utf-8")) for (original, translation) in translations + ) + + maxlen = len(words[-1]) + minlen = len(words[0]) + wlencount = [len([None for w in words if len(w) == l]) for l in range(minlen, maxlen + 1)] + + f.write("typedef {} mchar_t;\n".format(values_type)) + f.write("const uint8_t lengths[] = {{ {} }};\n".format(", ".join(map(str, lengths)))) + f.write("const mchar_t values[] = {{ {} }};\n".format(", ".join(str(ord(u)) for u in values))) + f.write( + "#define compress_max_length_bits ({})\n".format( + max_translation_encoded_length.bit_length() + ) + ) + f.write( + "const mchar_t words[] = {{ {} }};\n".format( + ", ".join(str(ord(c)) for w in words for c in w) + ) + ) + f.write("const uint8_t wlencount[] = {{ {} }};\n".format(", ".join(str(p) for p in wlencount))) + f.write("#define word_start {}\n".format(word_start)) + f.write("#define word_end {}\n".format(word_end)) + f.write("#define minlen {}\n".format(minlen)) + f.write("#define maxlen {}\n".format(maxlen)) + + return (values, lengths, words, canonical, extractor) + + +def decompress(encoding_table, encoded, encoded_length_bits): + (values, lengths, words, _, _) = encoding_table + dec = [] + this_byte = 0 + this_bit = 7 + b = encoded[this_byte] + bits = 0 + for i in range(encoded_length_bits): + bits <<= 1 + if 0x80 & b: + bits |= 1 + + b <<= 1 + if this_bit == 0: + this_bit = 7 + this_byte += 1 + if this_byte < len(encoded): + b = encoded[this_byte] + else: + this_bit -= 1 + length = bits + + i = 0 + while i < length: + bits = 0 + bit_length = 0 + max_code = lengths[0] + searched_length = lengths[0] + while True: + bits <<= 1 + if 0x80 & b: + bits |= 1 + + b <<= 1 + bit_length += 1 + if this_bit == 0: + this_bit = 7 + this_byte += 1 + if this_byte < len(encoded): + b = encoded[this_byte] + else: + this_bit -= 1 + if max_code > 0 and bits < max_code: + # print('{0:0{width}b}'.format(bits, width=bit_length)) + break + max_code = (max_code << 1) + lengths[bit_length] + searched_length += lengths[bit_length] + + v = values[searched_length + bits - max_code] + if v >= chr(0x80) and v < chr(0x80 + len(words)): + v = words[ord(v) - 0x80] + i += len(v.encode("utf-8")) + dec.append(v) + return "".join(dec) + + +def compress(encoding_table, decompressed, encoded_length_bits, len_translation_encoded): + if not isinstance(decompressed, str): + raise TypeError() + (_, _, _, canonical, extractor) = encoding_table + + enc = bytearray(len(decompressed) * 3) + current_bit = 7 + current_byte = 0 + + bits = encoded_length_bits + 1 + for i in range(bits - 1, 0, -1): + if len_translation_encoded & (1 << (i - 1)): + enc[current_byte] |= 1 << current_bit + if current_bit == 0: + current_bit = 7 + current_byte += 1 + else: + current_bit -= 1 + + for atom in extractor.iter(decompressed): + for b in canonical[atom]: + if b == "1": + enc[current_byte] |= 1 << current_bit + if current_bit == 0: + current_bit = 7 + current_byte += 1 + else: + current_bit -= 1 + + if current_bit != 7: + current_byte += 1 + return enc[:current_byte] + + +def qstr_escape(qst): + def esc_char(m): + c = ord(m.group(0)) + try: + name = codepoint2name[c] + except KeyError: + name = "0x%02x" % c + return "_" + name + "_" + + return re.sub(r"[^A-Za-z0-9_]", esc_char, qst) + + +def parse_input_headers(infiles): + i18ns = set() + + # read the qstrs in from the input files + for infile in infiles: + with open(infile, "rt") as f: + for line in f: + line = line.strip() + + match = re.match(r'^TRANSLATE\("(.*)"\)$', line) + if match: + i18ns.add(match.group(1)) + continue + + return i18ns + + +def escape_bytes(qstr): + if all(32 <= ord(c) <= 126 and c != "\\" and c != '"' for c in qstr): + # qstr is all printable ASCII so render it as-is (for easier debugging) + return qstr + else: + # qstr contains non-printable codes so render entire thing as hex pairs + qbytes = bytes_cons(qstr, "utf8") + return "".join(("\\x%02x" % b) for b in qbytes) + + +def make_bytes(cfg_bytes_len, cfg_bytes_hash, qstr): + qbytes = bytes_cons(qstr, "utf8") + qlen = len(qbytes) + qhash = compute_hash(qbytes, cfg_bytes_hash) + if qlen >= (1 << (8 * cfg_bytes_len)): + print("qstr is too long:", qstr) + assert False + qdata = escape_bytes(qstr) + return '%d, %d, "%s"' % (qhash, qlen, qdata) + + +def output_translation_data(encoding_table, i18ns, out): + # print out the starter of the generated C file + out.write("// This file was automatically generated by maketranslatedata.py\n") + out.write('#include "supervisor/shared/translate/compressed_string.h"\n') + out.write("\n") + + total_text_size = 0 + total_text_compressed_size = 0 + max_translation_encoded_length = max( + len(translation.encode("utf-8")) for original, translation in i18ns + ) + encoded_length_bits = max_translation_encoded_length.bit_length() + for i, translation in enumerate(i18ns): + original, translation = translation + translation_encoded = translation.encode("utf-8") + compressed = compress( + encoding_table, translation, encoded_length_bits, len(translation_encoded) + ) + total_text_compressed_size += len(compressed) + decompressed = decompress(encoding_table, compressed, encoded_length_bits) + assert decompressed == translation + for c in C_ESCAPES: + decompressed = decompressed.replace(c, C_ESCAPES[c]) + formatted = ["{:d}".format(x) for x in compressed] + out.write( + "const compressed_string_t translation{} = {{ .data = {}, .tail = {{ {} }} }}; // {}\n".format( + i, formatted[0], ", ".join(formatted[1:]), original, decompressed + ) + ) + total_text_size += len(translation.encode("utf-8")) + + out.write("\n") + out.write("// {} bytes worth of translations\n".format(total_text_size)) + out.write("// {} bytes worth of translations compressed\n".format(total_text_compressed_size)) + out.write("// {} bytes saved\n".format(total_text_size - total_text_compressed_size)) + + +if __name__ == "__main__": + import argparse + + parser = argparse.ArgumentParser( + description="Process QSTR definitions into headers for compilation" + ) + parser.add_argument( + "infiles", metavar="N", type=str, nargs="+", help="an integer for the accumulator" + ) + parser.add_argument( + "--translation", default=None, type=str, help="translations for i18n() items" + ) + parser.add_argument( + "--compression_filename", + type=argparse.FileType("w", encoding="UTF-8"), + help="header for compression info", + ) + parser.add_argument( + "--translation_filename", + type=argparse.FileType("w", encoding="UTF-8"), + help="c file for translation data", + ) + + args = parser.parse_args() + + i18ns = parse_input_headers(args.infiles) + i18ns = sorted(i18ns) + translations = translate(args.translation, i18ns) + encoding_table = compute_huffman_coding(translations, args.compression_filename) + output_translation_data(encoding_table, translations, args.translation_filename) diff --git a/py/makeversionhdr.py b/py/makeversionhdr.py index e4ddf9fa1e..6576c3abbb 100644 --- a/py/makeversionhdr.py +++ b/py/makeversionhdr.py @@ -59,29 +59,25 @@ def get_version_info_from_git(): return git_tag, git_hash, ver -def get_version_info_from_docs_conf(): - with open(os.path.join(os.path.dirname(sys.argv[0]), "..", "conf.py")) as f: - for line in f: - if line.startswith("version = release = '"): - ver = line.strip().split(" = ")[2].strip("'") - git_tag = "v" + ver - ver = ver.split(".") - if len(ver) == 2: - ver.append("0") - return git_tag, "", ver - return None +def cannot_determine_version(): + raise SystemExit( + """Cannot determine version. + +CircuitPython must be built from a git clone with tags. +If you cloned from a fork, fetch the tags from adafruit/circuitpython as follows: + + git fetch --tags --recurse-submodules=no --shallow-since="2021-07-01" https://github.com/adafruit/circuitpython HEAD""" + ) def make_version_header(filename): - # Get version info using git, with fallback to docs/conf.py + # Get version info using git (required) info = get_version_info_from_git() if info is None: - info = get_version_info_from_docs_conf() - + cannot_determine_version() git_tag, git_hash, ver = info if len(ver) < 3: - ver = ("0", "0", "0") - version_string = git_hash + cannot_determine_version() else: version_string = ".".join(ver) diff --git a/py/malloc.c b/py/malloc.c index 5c09a2d283..7200285687 100644 --- a/py/malloc.c +++ b/py/malloc.c @@ -207,6 +207,99 @@ void m_free(void *ptr) { #endif } +#if MICROPY_TRACKED_ALLOC + +#define MICROPY_TRACKED_ALLOC_STORE_SIZE (!MICROPY_ENABLE_GC) + +typedef struct _m_tracked_node_t { + struct _m_tracked_node_t *prev; + struct _m_tracked_node_t *next; + #if MICROPY_TRACKED_ALLOC_STORE_SIZE + uintptr_t size; + #endif + uint8_t data[]; +} m_tracked_node_t; + +#if MICROPY_DEBUG_VERBOSE +STATIC size_t m_tracked_count_links(size_t *nb) { + m_tracked_node_t *node = MP_STATE_VM(m_tracked_head); + size_t n = 0; + *nb = 0; + while (node != NULL) { + ++n; + #if MICROPY_TRACKED_ALLOC_STORE_SIZE + *nb += node->size; + #else + *nb += gc_nbytes(node); + #endif + node = node->next; + } + return n; +} +#endif + +void *m_tracked_calloc(size_t nmemb, size_t size) { + m_tracked_node_t *node = m_malloc_maybe(sizeof(m_tracked_node_t) + nmemb * size, false); + if (node == NULL) { + return NULL; + } + #if MICROPY_DEBUG_VERBOSE + size_t nb; + size_t n = m_tracked_count_links(&nb); + DEBUG_printf("m_tracked_calloc(%u, %u) -> (%u;%u) %p\n", (int)nmemb, (int)size, (int)n, (int)nb, node); + #endif + if (MP_STATE_VM(m_tracked_head) != NULL) { + MP_STATE_VM(m_tracked_head)->prev = node; + } + node->prev = NULL; + node->next = MP_STATE_VM(m_tracked_head); + MP_STATE_VM(m_tracked_head) = node; + #if MICROPY_TRACKED_ALLOC_STORE_SIZE + node->size = nmemb * size; + #endif + #if !MICROPY_GC_CONSERVATIVE_CLEAR + memset(&node->data[0], 0, nmemb * size); + #endif + return &node->data[0]; +} + +void m_tracked_free(void *ptr_in) { + if (ptr_in == NULL) { + return; + } + m_tracked_node_t *node = (m_tracked_node_t *)((uint8_t *)ptr_in - sizeof(m_tracked_node_t)); + #if MICROPY_DEBUG_VERBOSE + size_t data_bytes; + #if MICROPY_TRACKED_ALLOC_STORE_SIZE + data_bytes = node->size; + #else + data_bytes = gc_nbytes(node); + #endif + size_t nb; + size_t n = m_tracked_count_links(&nb); + DEBUG_printf("m_tracked_free(%p, [%p, %p], nbytes=%u, links=%u;%u)\n", node, node->prev, node->next, (int)data_bytes, (int)n, (int)nb); + #endif + if (node->next != NULL) { + node->next->prev = node->prev; + } + if (node->prev != NULL) { + node->prev->next = node->next; + } else { + MP_STATE_VM(m_tracked_head) = node->next; + } + m_free(node + #if MICROPY_MALLOC_USES_ALLOCATED_SIZE + #if MICROPY_TRACKED_ALLOC_STORE_SIZE + , node->size + #else + , gc_nbytes(node) + #endif + #endif + ); +} + +#endif + #if MICROPY_MEM_STATS size_t m_get_total_bytes_allocated(void) { return MP_STATE_MEM(total_bytes_allocated); diff --git a/py/misc.h b/py/misc.h index 8f2d3a187a..1ced7c622e 100644 --- a/py/misc.h +++ b/py/misc.h @@ -112,6 +112,13 @@ void m_free(void *ptr); #endif NORETURN void m_malloc_fail(size_t num_bytes); +#if MICROPY_TRACKED_ALLOC +// These alloc/free functions track the pointers in a linked list so the GC does not reclaim +// them. They can be used by code that requires traditional C malloc/free semantics. +void *m_tracked_calloc(size_t nmemb, size_t size); +void m_tracked_free(void *ptr_in); +#endif + #if MICROPY_MEM_STATS size_t m_get_total_bytes_allocated(void); size_t m_get_current_bytes_allocated(void); diff --git a/py/mkrules.mk b/py/mkrules.mk index 6bef64fd82..ef0f66117d 100644 --- a/py/mkrules.mk +++ b/py/mkrules.mk @@ -58,11 +58,11 @@ $(Q)$(CXX) $(CXXFLAGS) -c -MD -o $@ $< endef vpath %.c . $(TOP) $(USER_C_MODULES) $(DEVICES_MODULES) -$(BUILD)/%.o: %.c +$(BUILD)/%.o: %.c | $(HEADER_BUILD)/qstrdefs.generated.h $(HEADER_BUILD)/qstrdefs.enum.h $(call compile_c) vpath %.cpp . $(TOP) $(USER_C_MODULES) -$(BUILD)/%.o: %.cpp +$(BUILD)/%.o: %.cpp | $(HEADER_BUILD)/qstrdefs.generated.h $(HEADER_BUILD)/qstrdefs.enum.h $(call compile_cxx) QSTR_GEN_EXTRA_CFLAGS += -DNO_QSTR -x c @@ -89,7 +89,7 @@ $(BUILD)/%.pp: %.c # the right .o's to get recompiled if the generated.h file changes. Adding # an order-only dependency to all of the .o's will cause the generated .h # to get built before we try to compile any of them. -$(OBJ): | $(HEADER_BUILD)/qstrdefs.enum.h $(HEADER_BUILD)/mpversion.h +$(OBJ): | $(HEADER_BUILD)/mpversion.h # The logic for qstr regeneration (applied by makeqstrdefs.py) is: # - if anything in QSTR_GLOBAL_DEPENDENCIES is newer, then process all source files ($^) diff --git a/py/modbuiltins.c b/py/modbuiltins.c index ebdbd52dff..072ba8675f 100644 --- a/py/modbuiltins.c +++ b/py/modbuiltins.c @@ -35,7 +35,7 @@ #include "py/builtin.h" #include "py/stream.h" -#include "supervisor/shared/translate.h" +#include "supervisor/shared/translate/translate.h" #if MICROPY_PY_BUILTINS_FLOAT #include @@ -190,8 +190,8 @@ STATIC mp_obj_t mp_builtin_dir(size_t n_args, const mp_obj_t *args) { // Implemented by probing all possible qstrs with mp_load_method_maybe size_t nqstr = QSTR_TOTAL(); for (size_t i = MP_QSTR_ + 1; i < nqstr; ++i) { - mp_obj_t dest[2]; - mp_load_method_protected(args[0], i, dest, false); + mp_obj_t dest[2] = {}; + mp_load_method_protected(args[0], i, dest, true); if (dest[0] != MP_OBJ_NULL) { #if MICROPY_PY_ALL_SPECIAL_METHODS // Support for __dir__: see if we can dispatch to this special method @@ -759,7 +759,6 @@ STATIC const mp_rom_map_elem_t mp_module_builtins_globals_table[] = { { MP_ROM_QSTR(MP_QSTR_KeyError), MP_ROM_PTR(&mp_type_KeyError) }, { MP_ROM_QSTR(MP_QSTR_LookupError), MP_ROM_PTR(&mp_type_LookupError) }, { MP_ROM_QSTR(MP_QSTR_MemoryError), MP_ROM_PTR(&mp_type_MemoryError) }, - { MP_ROM_QSTR(MP_QSTR_MpyError), MP_ROM_PTR(&mp_type_MpyError) }, { MP_ROM_QSTR(MP_QSTR_NameError), MP_ROM_PTR(&mp_type_NameError) }, { MP_ROM_QSTR(MP_QSTR_NotImplementedError), MP_ROM_PTR(&mp_type_NotImplementedError) }, { MP_ROM_QSTR(MP_QSTR_OSError), MP_ROM_PTR(&mp_type_OSError) }, diff --git a/py/modmath.c b/py/modmath.c index 103310db5e..167d46d02b 100644 --- a/py/modmath.c +++ b/py/modmath.c @@ -27,7 +27,7 @@ #include "py/builtin.h" #include "py/runtime.h" -#include "supervisor/shared/translate.h" +#include "supervisor/shared/translate/translate.h" #if MICROPY_PY_BUILTINS_FLOAT && MICROPY_PY_MATH diff --git a/py/modmicropython.c b/py/modmicropython.c index 0465a4eef8..42c84e5292 100644 --- a/py/modmicropython.c +++ b/py/modmicropython.c @@ -32,7 +32,7 @@ #include "py/gc.h" #include "py/mphal.h" -#include "supervisor/shared/translate.h" +#include "supervisor/shared/translate/translate.h" // Various builtins specific to MicroPython runtime, // living in micropython module diff --git a/py/modstruct.c b/py/modstruct.c index c0b0fb7890..17dfc548ab 100644 --- a/py/modstruct.c +++ b/py/modstruct.c @@ -33,7 +33,7 @@ #include "py/objtuple.h" #include "py/binary.h" #include "py/parsenum.h" -#include "supervisor/shared/translate.h" +#include "supervisor/shared/translate/translate.h" #if MICROPY_PY_STRUCT diff --git a/py/modthread.c b/py/modthread.c index 333d750a36..a3960cddcb 100644 --- a/py/modthread.c +++ b/py/modthread.c @@ -30,7 +30,7 @@ #include "py/runtime.h" #include "py/stackctrl.h" -#include "supervisor/shared/translate.h" +#include "supervisor/shared/translate/translate.h" #if MICROPY_PY_THREAD diff --git a/py/moduerrno.c b/py/moduerrno.c index 743be0b85d..0ac0503ccc 100644 --- a/py/moduerrno.c +++ b/py/moduerrno.c @@ -30,7 +30,7 @@ #include "py/obj.h" #include "py/mperrno.h" -#include "supervisor/shared/translate.h" +#include "supervisor/shared/translate/translate.h" // This list can be defined per port in mpconfigport.h to tailor it to a // specific port's needs. If it's not defined then we provide a default. diff --git a/py/mpstate.h b/py/mpstate.h index bfbc29d55a..cf1711b8ad 100644 --- a/py/mpstate.h +++ b/py/mpstate.h @@ -119,6 +119,10 @@ typedef struct _mp_state_vm_t { qstr_pool_t *last_pool; + #if MICROPY_TRACKED_ALLOC + struct _m_tracked_node_t *m_tracked_head; + #endif + // non-heap memory for creating a traceback if we can't allocate RAM mp_obj_traceback_t mp_emergency_traceback_obj; diff --git a/py/obj.c b/py/obj.c index cc7f9006e8..da609aa8ce 100644 --- a/py/obj.c +++ b/py/obj.c @@ -41,7 +41,7 @@ #include "supervisor/linker.h" #include "supervisor/shared/stack.h" -#include "supervisor/shared/translate.h" +#include "supervisor/shared/translate/translate.h" const mp_obj_type_t *MICROPY_WRAP_MP_OBJ_GET_TYPE(mp_obj_get_type)(mp_const_obj_t o_in) { #if MICROPY_OBJ_IMMEDIATE_OBJS && MICROPY_OBJ_REPR == MICROPY_OBJ_REPR_A diff --git a/py/obj.h b/py/obj.h index 5f8f71ba0b..7fa21f5e38 100644 --- a/py/obj.h +++ b/py/obj.h @@ -34,7 +34,7 @@ #include "py/mpprint.h" #include "py/runtime0.h" -#include "supervisor/shared/translate.h" +#include "supervisor/shared/translate/compressed_string.h" // This is the definition of the opaque MicroPython object type. // All concrete objects have an encoding within this type and the @@ -742,7 +742,6 @@ extern const mp_obj_type_t mp_type_ReloadException; extern const mp_obj_type_t mp_type_KeyError; extern const mp_obj_type_t mp_type_LookupError; extern const mp_obj_type_t mp_type_MemoryError; -extern const mp_obj_type_t mp_type_MpyError; extern const mp_obj_type_t mp_type_NameError; extern const mp_obj_type_t mp_type_NotImplementedError; extern const mp_obj_type_t mp_type_OSError; diff --git a/py/objarray.c b/py/objarray.c index b71687fb35..a66a73a5ac 100644 --- a/py/objarray.c +++ b/py/objarray.c @@ -34,7 +34,7 @@ #include "py/objstr.h" #include "py/objarray.h" -#include "supervisor/shared/translate.h" +#include "supervisor/shared/translate/translate.h" #if MICROPY_PY_ARRAY || MICROPY_PY_BUILTINS_BYTEARRAY || MICROPY_PY_BUILTINS_MEMORYVIEW diff --git a/py/objcomplex.c b/py/objcomplex.c index b37b059d59..f205249bb4 100644 --- a/py/objcomplex.c +++ b/py/objcomplex.c @@ -31,7 +31,7 @@ #include "py/parsenum.h" #include "py/runtime.h" -#include "supervisor/shared/translate.h" +#include "supervisor/shared/translate/translate.h" #if MICROPY_PY_BUILTINS_COMPLEX diff --git a/py/objdeque.c b/py/objdeque.c index 2d29d71e3b..59c4c709fc 100644 --- a/py/objdeque.c +++ b/py/objdeque.c @@ -28,7 +28,7 @@ #include #include "py/mpconfig.h" -#include "supervisor/shared/translate.h" +#include "supervisor/shared/translate/translate.h" #if MICROPY_PY_COLLECTIONS_DEQUE diff --git a/py/objdict.c b/py/objdict.c index 5f233741fa..306205d12f 100644 --- a/py/objdict.c +++ b/py/objdict.c @@ -34,7 +34,7 @@ #include "py/objstr.h" #include "supervisor/linker.h" -#include "supervisor/shared/translate.h" +#include "supervisor/shared/translate/translate.h" const mp_obj_dict_t mp_const_empty_dict_obj = { .base = { .type = &mp_type_dict }, diff --git a/py/objexcept.c b/py/objexcept.c index fc0787631f..12408c0d1f 100644 --- a/py/objexcept.c +++ b/py/objexcept.c @@ -39,7 +39,7 @@ #include "py/gc.h" #include "py/mperrno.h" -#include "supervisor/shared/translate.h" +#include "supervisor/shared/translate/translate.h" // Number of items per traceback entry (file, line, block) #define TRACEBACK_ENTRY_LEN (3) @@ -347,7 +347,6 @@ MP_DEFINE_EXCEPTION(UnicodeError, ValueError) #if CIRCUITPY_ALARM MP_DEFINE_EXCEPTION(DeepSleepRequest, BaseException) #endif -MP_DEFINE_EXCEPTION(MpyError, ValueError) /* MP_DEFINE_EXCEPTION(Warning, Exception) MP_DEFINE_EXCEPTION(DeprecationWarning, Warning) diff --git a/py/objfloat.c b/py/objfloat.c index 6d1d10188c..f8261df933 100644 --- a/py/objfloat.c +++ b/py/objfloat.c @@ -32,7 +32,7 @@ #include "py/parsenum.h" #include "py/runtime.h" -#include "supervisor/shared/translate.h" +#include "supervisor/shared/translate/translate.h" #if MICROPY_PY_BUILTINS_FLOAT diff --git a/py/objgenerator.c b/py/objgenerator.c index c63ea6b816..c9af11fbb5 100644 --- a/py/objgenerator.c +++ b/py/objgenerator.c @@ -35,7 +35,7 @@ #include "py/objfun.h" #include "py/stackctrl.h" -#include "supervisor/shared/translate.h" +#include "supervisor/shared/translate/translate.h" // Instance of GeneratorExit exception - needed by generator.close() const mp_obj_exception_t mp_const_GeneratorExit_obj = {{&mp_type_GeneratorExit}, (mp_obj_tuple_t *)&mp_const_empty_tuple_obj, (mp_obj_traceback_t *)&mp_const_empty_traceback_obj}; @@ -330,7 +330,8 @@ STATIC mp_obj_t gen_instance_await(mp_obj_t self_in) { if (!self->coroutine_generator) { // Pretend like a generator does not have this coroutine behavior. // Pay no attention to the dir() behind the curtain - mp_raise_AttributeError(MP_ERROR_TEXT("type object 'generator' has no attribute '__await__'")); + mp_raise_msg_varg(&mp_type_AttributeError, MP_ERROR_TEXT("type object '%q' has no attribute '%q'"), + MP_QSTR_generator, MP_QSTR___await__); } // You can directly call send on a coroutine generator or you can __await__ then send on the return of that. return self; diff --git a/py/objint.c b/py/objint.c index 50bcbf56f8..b44a2e3b4a 100644 --- a/py/objint.c +++ b/py/objint.c @@ -35,7 +35,7 @@ #include "py/runtime.h" #include "py/binary.h" -#include "supervisor/shared/translate.h" +#include "supervisor/shared/translate/translate.h" #if MICROPY_PY_BUILTINS_FLOAT #include @@ -480,19 +480,33 @@ MP_DEFINE_CONST_FUN_OBJ_1(int_bit_length_obj, int_bit_length); #endif // this is a classmethod -STATIC mp_obj_t int_from_bytes(size_t n_args, const mp_obj_t *args) { +STATIC mp_obj_t int_from_bytes(size_t n_args, const mp_obj_t *pos_args, mp_map_t *kw_args) { // TODO: Support signed param (assumes signed=False at the moment) - (void)n_args; + + enum { ARG_bytes, ARG_byteorder, ARG_signed }; + static const mp_arg_t allowed_args[] = { + { MP_QSTR_bytes, MP_ARG_REQUIRED | MP_ARG_OBJ }, + { MP_QSTR_byteorder, MP_ARG_REQUIRED | MP_ARG_OBJ }, + { MP_QSTR_signed, MP_ARG_KW_ONLY | MP_ARG_BOOL, {.u_bool = false} }, + }; + mp_arg_val_t args[MP_ARRAY_SIZE(allowed_args)]; + mp_arg_parse_all(n_args - 1, pos_args + 1, kw_args, MP_ARRAY_SIZE(allowed_args), allowed_args, args); + + if (args[ARG_signed].u_bool) { + mp_raise_NotImplementedError_varg(MP_ERROR_TEXT("%q=%q"), MP_QSTR_signed, MP_QSTR_True); + } // get the buffer info mp_buffer_info_t bufinfo; - mp_get_buffer_raise(args[1], &bufinfo, MP_BUFFER_READ); + mp_get_buffer_raise(args[ARG_bytes].u_obj, &bufinfo, MP_BUFFER_READ); const byte *buf = (const byte *)bufinfo.buf; int delta = 1; - if (args[2] == MP_OBJ_NEW_QSTR(MP_QSTR_little)) { + if (args[ARG_byteorder].u_obj == MP_OBJ_NEW_QSTR(MP_QSTR_little)) { buf += bufinfo.len - 1; delta = -1; + } else if (args[ARG_byteorder].u_obj != MP_OBJ_NEW_QSTR(MP_QSTR_big)) { + mp_arg_error_invalid(MP_QSTR_byteorder); } mp_uint_t value = 0; @@ -501,7 +515,7 @@ STATIC mp_obj_t int_from_bytes(size_t n_args, const mp_obj_t *args) { #if MICROPY_LONGINT_IMPL != MICROPY_LONGINT_IMPL_NONE if (value > (MP_SMALL_INT_MAX >> 8)) { // Result will overflow a small-int so construct a big-int - return mp_obj_int_from_bytes_impl(args[2] != MP_OBJ_NEW_QSTR(MP_QSTR_little), bufinfo.len, bufinfo.buf); + return mp_obj_int_from_bytes_impl(args[ARG_byteorder].u_obj != MP_OBJ_NEW_QSTR(MP_QSTR_little), bufinfo.len, bufinfo.buf); } #endif value = (value << 8) | *buf; @@ -509,7 +523,7 @@ STATIC mp_obj_t int_from_bytes(size_t n_args, const mp_obj_t *args) { return mp_obj_new_int_from_uint(value); } -STATIC MP_DEFINE_CONST_FUN_OBJ_VAR_BETWEEN(int_from_bytes_fun_obj, 3, 4, int_from_bytes); +STATIC MP_DEFINE_CONST_FUN_OBJ_KW(int_from_bytes_fun_obj, 3, int_from_bytes); STATIC MP_DEFINE_CONST_CLASSMETHOD_OBJ(int_from_bytes_obj, MP_ROM_PTR(&int_from_bytes_fun_obj)); STATIC mp_obj_t int_to_bytes(size_t n_args, const mp_obj_t *pos_args, mp_map_t *kw_args) { diff --git a/py/objint_longlong.c b/py/objint_longlong.c index 368c74ec1d..67ec844f47 100644 --- a/py/objint_longlong.c +++ b/py/objint_longlong.c @@ -32,7 +32,7 @@ #include "py/objint.h" #include "py/runtime.h" -#include "supervisor/shared/translate.h" +#include "supervisor/shared/translate/translate.h" #if MICROPY_PY_BUILTINS_FLOAT #include diff --git a/py/objint_mpz.c b/py/objint_mpz.c index b804ce28af..fd74803fe7 100644 --- a/py/objint_mpz.c +++ b/py/objint_mpz.c @@ -33,7 +33,7 @@ #include "py/objint.h" #include "py/runtime.h" -#include "supervisor/shared/translate.h" +#include "supervisor/shared/translate/translate.h" #if MICROPY_PY_BUILTINS_FLOAT #include diff --git a/py/objlist.c b/py/objlist.c index 9d1949b7dc..434bca7d0a 100644 --- a/py/objlist.c +++ b/py/objlist.c @@ -31,7 +31,7 @@ #include "py/runtime.h" #include "py/stackctrl.h" -#include "supervisor/shared/translate.h" +#include "supervisor/shared/translate/translate.h" STATIC mp_obj_t mp_obj_new_list_iterator(mp_obj_t list, size_t cur, mp_obj_iter_buf_t *iter_buf); STATIC mp_obj_list_t *list_new(size_t n); diff --git a/py/objnamedtuple.c b/py/objnamedtuple.c index c970d1afba..60a0a31847 100644 --- a/py/objnamedtuple.c +++ b/py/objnamedtuple.c @@ -33,7 +33,7 @@ #include "py/objnamedtuple.h" #include "py/objtype.h" -#include "supervisor/shared/translate.h" +#include "supervisor/shared/translate/translate.h" #if MICROPY_PY_COLLECTIONS diff --git a/py/objobject.c b/py/objobject.c index d9c75faff9..b32e5fac0d 100644 --- a/py/objobject.c +++ b/py/objobject.c @@ -29,7 +29,7 @@ #include "py/objtype.h" #include "py/runtime.h" -#include "supervisor/shared/translate.h" +#include "supervisor/shared/translate/translate.h" typedef struct _mp_obj_object_t { mp_obj_base_t base; diff --git a/py/objrange.c b/py/objrange.c index b23ab23bd7..b0c74815dc 100644 --- a/py/objrange.c +++ b/py/objrange.c @@ -28,7 +28,7 @@ #include "py/runtime.h" -#include "supervisor/shared/translate.h" +#include "supervisor/shared/translate/translate.h" /******************************************************************************/ /* range iterator */ diff --git a/py/objset.c b/py/objset.c index d7dda6ba59..237e4c2471 100644 --- a/py/objset.c +++ b/py/objset.c @@ -31,7 +31,7 @@ #include "py/runtime.h" #include "py/builtin.h" -#include "supervisor/shared/translate.h" +#include "supervisor/shared/translate/translate.h" #if MICROPY_PY_BUILTINS_SET diff --git a/py/objslice.c b/py/objslice.c index 142f62fdac..3172f798c0 100644 --- a/py/objslice.c +++ b/py/objslice.c @@ -30,7 +30,7 @@ #include "py/obj.h" #include "py/runtime.h" -#include "supervisor/shared/translate.h" +#include "supervisor/shared/translate/translate.h" /******************************************************************************/ /* slice object */ diff --git a/py/objstr.c b/py/objstr.c index 3d45383bb3..df735a45cd 100644 --- a/py/objstr.c +++ b/py/objstr.c @@ -35,7 +35,7 @@ #include "py/runtime.h" #include "py/stackctrl.h" -#include "supervisor/shared/translate.h" +#include "supervisor/shared/translate/translate.h" #if MICROPY_PY_BUILTINS_STR_OP_MODULO STATIC mp_obj_t str_modulo_format(mp_obj_t pattern, size_t n_args, const mp_obj_t *args, mp_obj_t dict); diff --git a/py/objstringio.c b/py/objstringio.c index 336a041baf..c6d22d6c89 100644 --- a/py/objstringio.c +++ b/py/objstringio.c @@ -33,7 +33,7 @@ #include "py/runtime.h" #include "py/stream.h" -#include "supervisor/shared/translate.h" +#include "supervisor/shared/translate/translate.h" #if MICROPY_PY_IO diff --git a/py/objstrunicode.c b/py/objstrunicode.c index eb79d54991..0f26da62cf 100644 --- a/py/objstrunicode.c +++ b/py/objstrunicode.c @@ -32,7 +32,7 @@ #include "py/objlist.h" #include "py/runtime.h" -#include "supervisor/shared/translate.h" +#include "supervisor/shared/translate/translate.h" #if MICROPY_PY_BUILTINS_STR_UNICODE diff --git a/py/objtuple.c b/py/objtuple.c index 90b0773bb4..87d16905df 100644 --- a/py/objtuple.c +++ b/py/objtuple.c @@ -32,7 +32,7 @@ #include "py/runtime.h" #include "py/objtype.h" -#include "supervisor/shared/translate.h" +#include "supervisor/shared/translate/translate.h" /******************************************************************************/ diff --git a/py/objtype.c b/py/objtype.c index 62ea1ed602..071065041f 100644 --- a/py/objtype.c +++ b/py/objtype.c @@ -35,7 +35,7 @@ #include "py/runtime.h" #include "supervisor/shared/stack.h" -#include "supervisor/shared/translate.h" +#include "supervisor/shared/translate/translate.h" #if MICROPY_DEBUG_VERBOSE // print debugging info #define DEBUG_PRINT (1) diff --git a/py/parse.c b/py/parse.c index dee662b4ec..b3be279c5b 100644 --- a/py/parse.c +++ b/py/parse.c @@ -39,7 +39,7 @@ #include "py/objstr.h" #include "py/builtin.h" -#include "supervisor/shared/translate.h" +#include "supervisor/shared/translate/translate.h" #if MICROPY_ENABLE_COMPILER diff --git a/py/parsenum.c b/py/parsenum.c index bd41488204..adf2a4d84d 100644 --- a/py/parsenum.c +++ b/py/parsenum.c @@ -32,7 +32,7 @@ #include "py/parsenum.h" #include "py/smallint.h" -#include "supervisor/shared/translate.h" +#include "supervisor/shared/translate/translate.h" #if MICROPY_PY_BUILTINS_FLOAT #include diff --git a/py/persistentcode.c b/py/persistentcode.c index e604569fe2..0431b30a29 100644 --- a/py/persistentcode.c +++ b/py/persistentcode.c @@ -36,7 +36,7 @@ #include "py/objstr.h" #include "py/mpthread.h" -#include "supervisor/shared/translate.h" +#include "supervisor/shared/translate/translate.h" #if MICROPY_PERSISTENT_CODE_LOAD || MICROPY_PERSISTENT_CODE_SAVE @@ -582,7 +582,7 @@ mp_raw_code_t *mp_raw_code_load(mp_reader_t *reader) { || MPY_FEATURE_DECODE_FLAGS(header[2]) != MPY_FEATURE_FLAGS || header[3] > mp_small_int_bits() || read_uint(reader, NULL) > QSTR_WINDOW_SIZE) { - mp_raise_MpyError(MP_ERROR_TEXT("Incompatible .mpy file. Please update all .mpy files. See http://adafru.it/mpy-update for more info.")); + mp_raise_ValueError(MP_ERROR_TEXT("Incompatible .mpy file. Please update all .mpy files. See http://adafru.it/mpy-update for more info.")); } if (MPY_FEATURE_DECODE_ARCH(header[2]) != MP_NATIVE_ARCH_NONE) { byte arch = MPY_FEATURE_DECODE_ARCH(header[2]); diff --git a/py/proto.c b/py/proto.c index 9f110b9f9a..d70a9d2aac 100644 --- a/py/proto.c +++ b/py/proto.c @@ -28,6 +28,8 @@ #include "py/proto.h" #include "py/runtime.h" +#include "supervisor/shared/translate/translate.h" + #ifndef MICROPY_UNSAFE_PROTO const void *mp_proto_get(uint16_t name, mp_const_obj_t obj) { const mp_obj_type_t *type = mp_obj_get_type(obj); diff --git a/py/py.mk b/py/py.mk index f1864e58b3..6827fbe786 100644 --- a/py/py.mk +++ b/py/py.mk @@ -252,19 +252,24 @@ $(HEADER_BUILD)/qstrdefs.preprocessed.h: $(PY_QSTR_DEFS) $(QSTR_DEFS) $(QSTR_DEF # qstr data $(HEADER_BUILD)/qstrdefs.enum.h: $(PY_SRC)/makeqstrdata.py $(HEADER_BUILD)/qstrdefs.preprocessed.h $(STEPECHO) "GEN $@" - $(Q)$(PYTHON) $(PY_SRC)/makeqstrdata.py $(HEADER_BUILD)/qstrdefs.preprocessed.h > $@ + $(Q)$(PYTHON) $(PY_SRC)/makeqstrdata.py --output_type=enums $(HEADER_BUILD)/qstrdefs.preprocessed.h > $@ # Adding an order only dependency on $(HEADER_BUILD) causes $(HEADER_BUILD) to get # created before we run the script to generate the .h # Note: we need to protect the qstr names from the preprocessor, so we wrap # the lines in "" and then unwrap after the preprocessor is finished. -$(HEADER_BUILD)/qstrdefs.generated.h: $(PY_SRC)/makeqstrdata.py $(HEADER_BUILD)/$(TRANSLATION).mo $(HEADER_BUILD)/qstrdefs.preprocessed.h +$(HEADER_BUILD)/qstrdefs.generated.h: $(PY_SRC)/makeqstrdata.py $(HEADER_BUILD)/qstrdefs.preprocessed.h $(STEPECHO) "GEN $@" - $(Q)$(PYTHON) $(PY_SRC)/makeqstrdata.py --compression_filename $(HEADER_BUILD)/compression.generated.h --translation $(HEADER_BUILD)/$(TRANSLATION).mo $(HEADER_BUILD)/qstrdefs.preprocessed.h > $@ + $(Q)$(PYTHON) $(PY_SRC)/makeqstrdata.py --output_type=data $(HEADER_BUILD)/qstrdefs.preprocessed.h > $@ + +$(PY_BUILD)/translations-$(TRANSLATION).c $(HEADER_BUILD)/compression.generated.h: $(PY_SRC)/maketranslationdata.py $(HEADER_BUILD)/$(TRANSLATION).mo $(HEADER_BUILD)/qstrdefs.preprocessed.h + $(STEPECHO) "GEN $@" + $(Q)$(PYTHON) $(PY_SRC)/maketranslationdata.py --compression_filename $(HEADER_BUILD)/compression.generated.h --translation $(HEADER_BUILD)/$(TRANSLATION).mo --translation_filename $(PY_BUILD)/translations-$(TRANSLATION).c $(HEADER_BUILD)/qstrdefs.preprocessed.h + +PY_CORE_O += $(PY_BUILD)/translations-$(TRANSLATION).o $(PY_BUILD)/qstr.o: $(HEADER_BUILD)/qstrdefs.generated.h - # build a list of registered modules for py/objmodule.c. $(HEADER_BUILD)/moduledefs.h: $(SRC_QSTR) $(QSTR_GLOBAL_DEPENDENCIES) | $(HEADER_BUILD)/mpversion.h @$(ECHO) "GEN $@" diff --git a/py/qstr.c b/py/qstr.c index 41176ec5ab..083e12d6f0 100644 --- a/py/qstr.c +++ b/py/qstr.c @@ -35,6 +35,7 @@ #include "py/runtime.h" #include "supervisor/linker.h" +#include "supervisor/shared/translate/translate.h" // NOTE: we are using linear arrays to store and search for qstr's (unique strings, interned strings) // ultimately we will replace this with a static hash table of some kind diff --git a/py/ringbuf.c b/py/ringbuf.c index fe47b50068..8a4cb33cbc 100644 --- a/py/ringbuf.c +++ b/py/ringbuf.c @@ -27,86 +27,85 @@ #include "ringbuf.h" -bool ringbuf_init(ringbuf_t *r, uint8_t *buf, size_t capacity) { +bool ringbuf_init(ringbuf_t *r, uint8_t *buf, size_t size) { r->buf = buf; - r->size = capacity; - r->iget = r->iput = 0; + r->size = size; + r->used = 0; + r->next_read = 0; + r->next_write = 0; return r->buf != NULL; } -// Dynamic initialization. This should be accessible from a root pointer. -// capacity is the number of bytes the ring buffer can hold. The actual -// size of the buffer is one greater than that, due to how the buffer -// handles empty and full statuses. -bool ringbuf_alloc(ringbuf_t *r, size_t capacity, bool long_lived) { - r->buf = gc_alloc(capacity + 1, false, long_lived); - r->size = capacity + 1; - r->iget = r->iput = 0; - return r->buf != NULL; +// Dynamic initialization. This should be accessible from a root pointer.. +bool ringbuf_alloc(ringbuf_t *r, size_t size, bool long_lived) { + bool result = ringbuf_init(r, gc_alloc(size, false, long_lived), size); + return result; } -void ringbuf_free(ringbuf_t *r) { - // Free buf by letting gc take care of it. If the VM has finished already, +void ringbuf_deinit(ringbuf_t *r) { + // Free buf by doing nothing and letting gc take care of it. If the VM has finished already, // this will be safe. r->buf = (uint8_t *)NULL; r->size = 0; ringbuf_clear(r); } -size_t ringbuf_capacity(ringbuf_t *r) { - return r->size - 1; +size_t ringbuf_size(ringbuf_t *r) { + return r->size; } -// Returns -1 if buffer is empty, else returns byte fetched. +// Return -1 if buffer is empty, else return byte fetched. int ringbuf_get(ringbuf_t *r) { - if (r->iget == r->iput) { + if (r->used < 1) { return -1; } - uint8_t v = r->buf[r->iget++]; - if (r->iget >= r->size) { - r->iget = 0; + uint8_t v = r->buf[r->next_read]; + r->next_read++; + if (r->next_read >= r->size) { + r->next_read = 0; } + r->used--; return v; } int ringbuf_get16(ringbuf_t *r) { - int v = ringbuf_peek16(r); - if (v == -1) { - return v; - } - r->iget += 2; - if (r->iget >= r->size) { - r->iget -= r->size; - } - return v; -} - -// Returns -1 if no room in buffer, else returns 0. -int ringbuf_put(ringbuf_t *r, uint8_t v) { - uint32_t iput_new = r->iput + 1; - if (iput_new >= r->size) { - iput_new = 0; - } - if (iput_new == r->iget) { + if (r->used < 2) { return -1; } - r->buf[r->iput] = v; - r->iput = iput_new; + + int high_byte = ringbuf_get(r); + int low_byte = ringbuf_get(r); + return (high_byte << 8) | low_byte; +} + +// Return -1 if no room in buffer, else return 0. +int ringbuf_put(ringbuf_t *r, uint8_t v) { + if (r->used >= r->size) { + return -1; + } + r->buf[r->next_write] = v; + r->next_write++; + if (r->next_write >= r->size) { + r->next_write = 0; + } + r->used++; return 0; } void ringbuf_clear(ringbuf_t *r) { - r->iput = r->iget = 0; + r->next_write = 0; + r->next_read = 0; + r->used = 0; } // Number of free slots that can be written. size_t ringbuf_num_empty(ringbuf_t *r) { - return (r->size + r->iget - r->iput - 1) % r->size; + return r->size - r->used; } // Number of bytes available to read. size_t ringbuf_num_filled(ringbuf_t *r) { - return (r->size + r->iput - r->iget) % r->size; + return r->used; } // If the ring buffer fills up, not all bytes will be written. @@ -134,37 +133,12 @@ size_t ringbuf_get_n(ringbuf_t *r, uint8_t *buf, size_t bufsize) { return bufsize; } -int ringbuf_peek16(ringbuf_t *r) { - if (r->iget == r->iput) { - return -1; - } - uint32_t iget_a = r->iget + 1; - if (iget_a == r->size) { - iget_a = 0; - } - if (iget_a == r->iput) { - return -1; - } - return (r->buf[r->iget] << 8) | (r->buf[iget_a]); -} - int ringbuf_put16(ringbuf_t *r, uint16_t v) { - uint32_t iput_a = r->iput + 1; - if (iput_a == r->size) { - iput_a = 0; - } - if (iput_a == r->iget) { + if (r->size - r->used < 2) { return -1; } - uint32_t iput_b = iput_a + 1; - if (iput_b == r->size) { - iput_b = 0; - } - if (iput_b == r->iget) { - return -1; - } - r->buf[r->iput] = (v >> 8) & 0xff; - r->buf[iput_a] = v & 0xff; - r->iput = iput_b; + + ringbuf_put(r, (v >> 8) & 0xff); + ringbuf_put(r, v & 0xff); return 0; } diff --git a/py/ringbuf.h b/py/ringbuf.h index d868eff1e4..2725bedcca 100644 --- a/py/ringbuf.h +++ b/py/ringbuf.h @@ -33,19 +33,23 @@ typedef struct _ringbuf_t { uint8_t *buf; - // Allocated size; capacity is one less. Don't reference this directly. uint32_t size; - uint32_t iget; - uint32_t iput; + uint32_t used; + uint32_t next_read; + uint32_t next_write; } ringbuf_t; -// Note that the capacity of the buffer is N-1! - -// For static initialization use ringbuf_init() +// For static initialization with an existing buffer, use ringbuf_init(). bool ringbuf_init(ringbuf_t *r, uint8_t *buf, size_t capacity); + +// For allocation of a buffer on the heap, use ringbuf_alloc(). bool ringbuf_alloc(ringbuf_t *r, size_t capacity, bool long_lived); -void ringbuf_free(ringbuf_t *r); -size_t ringbuf_capacity(ringbuf_t *r); + +// Mark ringbuf as no longer in use, and allow any heap storage to be freed by gc. +void ringbuf_deinit(ringbuf_t *r); + +// Note: Ringbuf operations are not atomic. +size_t ringbuf_size(ringbuf_t *r); int ringbuf_get(ringbuf_t *r); int ringbuf_put(ringbuf_t *r, uint8_t v); void ringbuf_clear(ringbuf_t *r); @@ -54,9 +58,8 @@ size_t ringbuf_num_filled(ringbuf_t *r); size_t ringbuf_put_n(ringbuf_t *r, const uint8_t *buf, size_t bufsize); size_t ringbuf_get_n(ringbuf_t *r, uint8_t *buf, size_t bufsize); -// Note: big-endian. No-op if not enough room available for both bytes. +// Note: big-endian. Return -1 if can't read or write two bytes. int ringbuf_get16(ringbuf_t *r); -int ringbuf_peek16(ringbuf_t *r); int ringbuf_put16(ringbuf_t *r, uint16_t v); #endif // MICROPY_INCLUDED_PY_RINGBUF_H diff --git a/py/runtime.c b/py/runtime.c index f2ad8728a5..e5b411b0d3 100644 --- a/py/runtime.c +++ b/py/runtime.c @@ -45,7 +45,7 @@ #include "py/stackctrl.h" #include "py/gc.h" -#include "supervisor/shared/translate.h" +#include "supervisor/shared/translate/translate.h" #if MICROPY_DEBUG_VERBOSE // print debugging info #define DEBUG_PRINT (1) @@ -1742,10 +1742,6 @@ NORETURN void mp_raise_OverflowError_varg(const compressed_string_t *fmt, ...) { va_end(argptr); } -NORETURN void mp_raise_MpyError(const compressed_string_t *msg) { - mp_raise_msg(&mp_type_MpyError, msg); -} - NORETURN void mp_raise_type_arg(const mp_obj_type_t *exc_type, mp_obj_t arg) { nlr_raise(mp_obj_new_exception_arg1(exc_type, arg)); } diff --git a/py/runtime.h b/py/runtime.h index 4a309f3975..923071f7ca 100644 --- a/py/runtime.h +++ b/py/runtime.h @@ -33,6 +33,8 @@ #include "supervisor/linker.h" +#include "supervisor/shared/translate/translate.h" + typedef enum { MP_VM_RETURN_NORMAL, MP_VM_RETURN_YIELD, @@ -92,15 +94,22 @@ void mp_arg_parse_all_kw_array(size_t n_pos, size_t n_kw, const mp_obj_t *args, NORETURN void mp_arg_error_terse_mismatch(void); NORETURN void mp_arg_error_unimpl_kw(void); +NORETURN void mp_arg_error_invalid(qstr arg_name); +mp_int_t mp_arg_validate_int(mp_int_t i, mp_int_t required_i, qstr arg_name); mp_int_t mp_arg_validate_int_min(mp_int_t i, mp_int_t min, qstr arg_name); mp_int_t mp_arg_validate_int_max(mp_int_t i, mp_int_t j, qstr arg_name); mp_int_t mp_arg_validate_int_range(mp_int_t i, mp_int_t min, mp_int_t max, qstr arg_name); #if MICROPY_PY_BUILTINS_FLOAT mp_float_t mp_arg_validate_obj_float_non_negative(mp_obj_t float_in, mp_float_t default_for_null, qstr arg_name); #endif +mp_uint_t mp_arg_validate_length_min(mp_uint_t length, mp_uint_t min, qstr arg_name); +mp_uint_t mp_arg_validate_length_max(mp_uint_t length, mp_uint_t max, qstr arg_name); mp_uint_t mp_arg_validate_length_range(mp_uint_t length, mp_uint_t min, mp_uint_t max, qstr arg_name); +mp_uint_t mp_arg_validate_length(mp_uint_t length, mp_uint_t required_length, qstr arg_name); +mp_int_t mp_arg_validate_index_range(mp_int_t index, mp_int_t min, mp_int_t max, qstr arg_name); mp_obj_t mp_arg_validate_type(mp_obj_t obj, const mp_obj_type_t *type, qstr arg_name); -mp_obj_t mp_arg_validate_string(mp_obj_t obj, qstr arg_name); +mp_int_t mp_arg_validate_type_int(mp_obj_t obj, qstr arg_name); +mp_obj_t mp_arg_validate_type_string(mp_obj_t obj, qstr arg_name); static inline mp_obj_dict_t *PLACE_IN_ITCM(mp_locals_get)(void) { return MP_STATE_THREAD(dict_locals); @@ -216,7 +225,6 @@ NORETURN void mp_raise_BrokenPipeError(void); NORETURN void mp_raise_NotImplementedError(const compressed_string_t *msg); NORETURN void mp_raise_NotImplementedError_varg(const compressed_string_t *fmt, ...); NORETURN void mp_raise_OverflowError_varg(const compressed_string_t *fmt, ...); -NORETURN void mp_raise_MpyError(const compressed_string_t *msg); NORETURN void mp_raise_recursion_depth(void); #endif diff --git a/py/sequence.c b/py/sequence.c index ee400ccd8d..7befc85763 100644 --- a/py/sequence.c +++ b/py/sequence.c @@ -28,7 +28,7 @@ #include #include "py/runtime.h" -#include "supervisor/shared/translate.h" +#include "supervisor/shared/translate/translate.h" // Helpers for sequence types diff --git a/py/stream.c b/py/stream.c index b12d693c62..e7e77341bd 100644 --- a/py/stream.c +++ b/py/stream.c @@ -31,7 +31,8 @@ #include "py/objstr.h" #include "py/stream.h" #include "py/runtime.h" -#include "supervisor/shared/translate.h" +#include "py/unicode.h" +#include "supervisor/shared/translate/translate.h" // This file defines generic Python stream read/write methods which // dispatch to the underlying stream interface of an object. @@ -43,6 +44,13 @@ STATIC mp_obj_t stream_readall(mp_obj_t self_in); #define STREAM_CONTENT_TYPE(stream) (((stream)->is_text) ? &mp_type_str : &mp_type_bytes) +static mp_obj_t mp_obj_new_str_from_vstr_check(const mp_obj_type_t *type, vstr_t *vstr) { + if (type == &mp_type_str && !utf8_check((void *)vstr->buf, vstr->len)) { + mp_raise_msg(&mp_type_UnicodeError, NULL); + } + return mp_obj_new_str_from_vstr(type, vstr); +} + // Returns error condition in *errcode, if non-zero, return value is number of bytes written // before error condition occurred. If *errcode == 0, returns total bytes written (which will // be equal to input size). @@ -201,8 +209,7 @@ STATIC mp_obj_t stream_read_generic(size_t n_args, const mp_obj_t *args, byte fl } } } - - return mp_obj_new_str_from_vstr(&mp_type_str, &vstr); + return mp_obj_new_str_from_vstr_check(&mp_type_str, &vstr); } #endif @@ -223,7 +230,7 @@ STATIC mp_obj_t stream_read_generic(size_t n_args, const mp_obj_t *args, byte fl mp_raise_OSError(error); } else { vstr.len = out_sz; - return mp_obj_new_str_from_vstr(STREAM_CONTENT_TYPE(stream_p), &vstr); + return mp_obj_new_str_from_vstr_check(STREAM_CONTENT_TYPE(stream_p), &vstr); } } @@ -364,7 +371,7 @@ STATIC mp_obj_t stream_readall(mp_obj_t self_in) { } vstr.len = total_size; - return mp_obj_new_str_from_vstr(STREAM_CONTENT_TYPE(stream_p), &vstr); + return mp_obj_new_str_from_vstr_check(STREAM_CONTENT_TYPE(stream_p), &vstr); } // Unbuffered, inefficient implementation of readline() for raw I/O files. @@ -417,7 +424,7 @@ STATIC mp_obj_t stream_unbuffered_readline(size_t n_args, const mp_obj_t *args) } } - return mp_obj_new_str_from_vstr(STREAM_CONTENT_TYPE(stream_p), &vstr); + return mp_obj_new_str_from_vstr_check(STREAM_CONTENT_TYPE(stream_p), &vstr); } MP_DEFINE_CONST_FUN_OBJ_VAR_BETWEEN(mp_stream_unbuffered_readline_obj, 1, 2, stream_unbuffered_readline); diff --git a/py/vm.c b/py/vm.c index 8cb01d3552..12a0f2d445 100644 --- a/py/vm.c +++ b/py/vm.c @@ -37,6 +37,7 @@ #include "py/profile.h" #include "supervisor/linker.h" +#include "supervisor/shared/translate/translate.h" // *FORMAT-OFF* diff --git a/requirements-dev.txt b/requirements-dev.txt index 0b2e08163a..0dcfad3956 100644 --- a/requirements-dev.txt +++ b/requirements-dev.txt @@ -1,12 +1,10 @@ # For nvm.toml cascadetoml jinja2 -# Undo this pin when click and typer are again compatible. -typer==0.4.0 +typer sh -# Undo this pin when click and typer are again compatible. -click==8.0.4 +click cpp-coveralls requests requests-cache @@ -17,6 +15,7 @@ polib # For pre-commit pyyaml black +pre-commit # for combining the Nordic SoftDevice with CircuitPython intelhex @@ -26,3 +25,10 @@ pyelftools # for stubs and annotations adafruit-circuitpython-typing + +# for mbedtls certificate store +cryptography + +# for web workflow minify +minify_html +jsmin diff --git a/requirements-doc.txt b/requirements-doc.txt index 2eaf513d3d..43e99fa32f 100644 --- a/requirements-doc.txt +++ b/requirements-doc.txt @@ -5,11 +5,11 @@ isort twine wheel astroid -setuptools +setuptools>=45 setuptools_scm # For sphinx -sphinx>=4.0.0 +sphinx!=5.2.0.post0 sphinx-autoapi sphinx-rtd-theme sphinxcontrib-svg2pdfconverter diff --git a/runtime.py b/runtime.py new file mode 100644 index 0000000000..28bf98962e --- /dev/null +++ b/runtime.py @@ -0,0 +1,10 @@ +import pathlib +paths = pathlib.Path(".").glob("**/*.c") +translate_h = "#include \"supervisor/shared/translate/translate.h\"" +for p in paths: + if "esp-idf" in p: + continue + lines = p.read_text().split("\n") + if "#include \"py/runtime.h\"" in lines and translate_h in lines: + lines.remove(translate_h) + p.write_text("\n".join(lines)) diff --git a/shared-bindings/_bleio/Adapter.c b/shared-bindings/_bleio/Adapter.c index ce1080934e..a45f17ca2c 100644 --- a/shared-bindings/_bleio/Adapter.c +++ b/shared-bindings/_bleio/Adapter.c @@ -64,7 +64,9 @@ //| connections and also initiate connections.""" //| -//| def __init__(self, *, uart: busio.UART, rts: digitalio.DigitalInOut, cts: digitalio.DigitalInOut) -> None: +//| def __init__( +//| self, *, uart: busio.UART, rts: digitalio.DigitalInOut, cts: digitalio.DigitalInOut +//| ) -> None: //| """On boards that do not have native BLE, you can use an HCI co-processor. //| Pass the uart and pins used to communicate with the co-processor, such as an Adafruit AirLift. //| The co-processor must have been reset and put into BLE mode beforehand @@ -80,7 +82,6 @@ //| Use `_bleio.adapter` to access the sole instance already available. //| """ //| ... -//| STATIC mp_obj_t bleio_adapter_make_new(const mp_obj_type_t *type, size_t n_args, size_t n_kw, const mp_obj_t *all_args) { #if CIRCUITPY_BLEIO_HCI bleio_adapter_obj_t *self = common_hal_bleio_allocate_adapter_or_raise(); @@ -110,10 +111,8 @@ STATIC mp_obj_t bleio_adapter_make_new(const mp_obj_type_t *type, size_t n_args, #endif // CIRCUITPY_BLEIO_HCI } -//| //| enabled: bool //| """State of the BLE adapter.""" -//| STATIC mp_obj_t bleio_adapter_get_enabled(mp_obj_t self) { return mp_obj_new_bool(common_hal_bleio_adapter_get_enabled(self)); } @@ -134,7 +133,6 @@ MP_PROPERTY_GETSET(bleio_adapter_enabled_obj, //| address: Address //| """MAC address of the BLE adapter.""" -//| STATIC mp_obj_t bleio_adapter_get_address(mp_obj_t self) { return MP_OBJ_FROM_PTR(common_hal_bleio_adapter_get_address(self)); @@ -157,11 +155,10 @@ MP_PROPERTY_GETSET(bleio_adapter_address_obj, //| """name of the BLE adapter used once connected. //| The name is "CIRCUITPY" + the last four hex digits of ``adapter.address``, //| to make it easy to distinguish multiple CircuitPython boards.""" -//| -STATIC mp_obj_t bleio_adapter_get_name(mp_obj_t self) { +STATIC mp_obj_t _bleio_adapter_get_name(mp_obj_t self) { return MP_OBJ_FROM_PTR(common_hal_bleio_adapter_get_name(self)); } -MP_DEFINE_CONST_FUN_OBJ_1(bleio_adapter_get_name_obj, bleio_adapter_get_name); +MP_DEFINE_CONST_FUN_OBJ_1(bleio_adapter_get_name_obj, _bleio_adapter_get_name); STATIC mp_obj_t bleio_adapter_set_name(mp_obj_t self, mp_obj_t new_name) { @@ -174,10 +171,18 @@ MP_PROPERTY_GETSET(bleio_adapter_name_obj, (mp_obj_t)&bleio_adapter_get_name_obj, (mp_obj_t)&bleio_adapter_set_name_obj); -//| def start_advertising(self, data: ReadableBuffer, *, -//| scan_response: Optional[ReadableBuffer] = None, connectable: bool = True, -//| anonymous: bool = False, timeout: int = 0, interval: float = 0.1, -//| tx_power: int = 0, directed_to: Optional[Address] = None) -> None: +//| def start_advertising( +//| self, +//| data: ReadableBuffer, +//| *, +//| scan_response: Optional[ReadableBuffer] = None, +//| connectable: bool = True, +//| anonymous: bool = False, +//| timeout: int = 0, +//| interval: float = 0.1, +//| tx_power: int = 0, +//| directed_to: Optional[Address] = None +//| ) -> None: //| """Starts advertising until `stop_advertising` is called or if connectable, another device //| connects to us. //| @@ -196,7 +201,6 @@ MP_PROPERTY_GETSET(bleio_adapter_name_obj, //| :param tx_power int: transmitter power while advertising in dBm //| :param directed_to Address: peer to advertise directly to""" //| ... -//| STATIC mp_obj_t bleio_adapter_start_advertising(mp_uint_t n_args, const mp_obj_t *pos_args, mp_map_t *kw_args) { bleio_adapter_obj_t *self = MP_OBJ_TO_PTR(pos_args[0]); @@ -259,7 +263,6 @@ STATIC MP_DEFINE_CONST_FUN_OBJ_KW(bleio_adapter_start_advertising_obj, 1, bleio_ //| def stop_advertising(self) -> None: //| """Stop sending advertising packets.""" //| ... -//| STATIC mp_obj_t bleio_adapter_stop_advertising(mp_obj_t self_in) { bleio_adapter_obj_t *self = MP_OBJ_TO_PTR(self_in); @@ -269,7 +272,18 @@ STATIC mp_obj_t bleio_adapter_stop_advertising(mp_obj_t self_in) { } STATIC MP_DEFINE_CONST_FUN_OBJ_1(bleio_adapter_stop_advertising_obj, bleio_adapter_stop_advertising); -//| def start_scan(self, prefixes: ReadableBuffer = b"", *, buffer_size: int = 512, extended: bool = False, timeout: Optional[float] = None, interval: float = 0.1, window: float = 0.1, minimum_rssi: int = -80, active: bool = True) -> Iterable[ScanEntry]: +//| def start_scan( +//| self, +//| prefixes: ReadableBuffer = b"", +//| *, +//| buffer_size: int = 512, +//| extended: bool = False, +//| timeout: Optional[float] = None, +//| interval: float = 0.1, +//| window: float = 0.1, +//| minimum_rssi: int = -80, +//| active: bool = True +//| ) -> Iterable[ScanEntry]: //| """Starts a BLE scan and returns an iterator of results. Advertisements and scan responses are //| filtered and returned separately. //| @@ -288,7 +302,6 @@ STATIC MP_DEFINE_CONST_FUN_OBJ_1(bleio_adapter_stop_advertising_obj, bleio_adapt //| :returns: an iterable of `_bleio.ScanEntry` objects //| :rtype: iterable""" //| ... -//| STATIC mp_obj_t bleio_adapter_start_scan(size_t n_args, const mp_obj_t *pos_args, mp_map_t *kw_args) { enum { ARG_prefixes, ARG_buffer_size, ARG_extended, ARG_timeout, ARG_interval, ARG_window, ARG_minimum_rssi, ARG_active }; static const mp_arg_t allowed_args[] = { @@ -352,7 +365,6 @@ STATIC MP_DEFINE_CONST_FUN_OBJ_KW(bleio_adapter_start_scan_obj, 1, bleio_adapter //| def stop_scan(self) -> None: //| """Stop the current scan.""" //| ... -//| STATIC mp_obj_t bleio_adapter_stop_scan(mp_obj_t self_in) { bleio_adapter_obj_t *self = MP_OBJ_TO_PTR(self_in); @@ -364,7 +376,6 @@ STATIC MP_DEFINE_CONST_FUN_OBJ_1(bleio_adapter_stop_scan_obj, bleio_adapter_stop //| advertising: bool //| """True when the adapter is currently advertising. (read-only)""" -//| STATIC mp_obj_t bleio_adapter_get_advertising(mp_obj_t self) { return mp_obj_new_bool(common_hal_bleio_adapter_get_advertising(self)); @@ -377,7 +388,6 @@ MP_PROPERTY_GETTER(bleio_adapter_advertising_obj, //| connected: bool //| """True when the adapter is connected to another device regardless of who initiated the //| connection. (read-only)""" -//| STATIC mp_obj_t bleio_adapter_get_connected(mp_obj_t self) { return mp_obj_new_bool(common_hal_bleio_adapter_get_connected(self)); @@ -390,7 +400,6 @@ MP_PROPERTY_GETTER(bleio_adapter_connected_obj, //| connections: Tuple[Connection] //| """Tuple of active connections including those initiated through //| :py:meth:`_bleio.Adapter.connect`. (read-only)""" -//| STATIC mp_obj_t bleio_adapter_get_connections(mp_obj_t self) { return common_hal_bleio_adapter_get_connections(self); } @@ -405,7 +414,6 @@ MP_PROPERTY_GETTER(bleio_adapter_connections_obj, //| :param Address address: The address of the peripheral to connect to //| :param float/int timeout: Try to connect for timeout seconds.""" //| ... -//| STATIC mp_obj_t bleio_adapter_connect(mp_uint_t n_args, const mp_obj_t *pos_args, mp_map_t *kw_args) { bleio_adapter_obj_t *self = MP_OBJ_TO_PTR(pos_args[0]); diff --git a/shared-bindings/_bleio/Adapter.h b/shared-bindings/_bleio/Adapter.h index 1dce615a40..49bb4421e7 100644 --- a/shared-bindings/_bleio/Adapter.h +++ b/shared-bindings/_bleio/Adapter.h @@ -50,6 +50,9 @@ extern bool common_hal_bleio_adapter_get_connected(bleio_adapter_obj_t *self); extern bleio_address_obj_t *common_hal_bleio_adapter_get_address(bleio_adapter_obj_t *self); extern bool common_hal_bleio_adapter_set_address(bleio_adapter_obj_t *self, bleio_address_obj_t *address); +// Copies the adapter name into the given buffer up to len and returns the full length (may be more +// than len if the buffer was too short.) +uint16_t bleio_adapter_get_name(char *buf, uint16_t len); extern mp_obj_str_t *common_hal_bleio_adapter_get_name(bleio_adapter_obj_t *self); extern void common_hal_bleio_adapter_set_name(bleio_adapter_obj_t *self, const char *name); diff --git a/shared-bindings/_bleio/Address.c b/shared-bindings/_bleio/Address.c index 9673642a5b..236ca9e39e 100644 --- a/shared-bindings/_bleio/Address.c +++ b/shared-bindings/_bleio/Address.c @@ -46,7 +46,6 @@ //| :param int address_type: one of the integer values: `PUBLIC`, `RANDOM_STATIC`, //| `RANDOM_PRIVATE_RESOLVABLE`, or `RANDOM_PRIVATE_NON_RESOLVABLE`.""" //| ... -//| STATIC mp_obj_t bleio_address_make_new(const mp_obj_type_t *type, size_t n_args, size_t n_kw, const mp_obj_t *all_args) { enum { ARG_address, ARG_address_type }; static const mp_arg_t allowed_args[] = { @@ -69,7 +68,7 @@ STATIC mp_obj_t bleio_address_make_new(const mp_obj_type_t *type, size_t n_args, const mp_int_t address_type = args[ARG_address_type].u_int; if (address_type < BLEIO_ADDRESS_TYPE_MIN || address_type > BLEIO_ADDRESS_TYPE_MAX) { - mp_raise_ValueError(translate("Address type out of range")); + mp_arg_error_invalid(MP_QSTR_address_type); } common_hal_bleio_address_construct(self, buf_info.buf, address_type); @@ -93,7 +92,6 @@ STATIC mp_obj_t bleio_address_make_new(const mp_obj_type_t *type, size_t n_args, //|
//| >>> _bleio.adapter.address.address_bytes //| b'5\\xa8\\xed\\xf5\\x1d\\xc8'""" -//| STATIC mp_obj_t bleio_address_get_address_bytes(mp_obj_t self_in) { bleio_address_obj_t *self = MP_OBJ_TO_PTR(self_in); @@ -109,7 +107,6 @@ MP_PROPERTY_GETTER(bleio_address_address_bytes_obj, //| //| One of the integer values: `PUBLIC`, `RANDOM_STATIC`, `RANDOM_PRIVATE_RESOLVABLE`, //| or `RANDOM_PRIVATE_NON_RESOLVABLE`.""" -//| STATIC mp_obj_t bleio_address_get_type(mp_obj_t self_in) { bleio_address_obj_t *self = MP_OBJ_TO_PTR(self_in); @@ -123,7 +120,6 @@ MP_PROPERTY_GETTER(bleio_address_type_obj, //| def __eq__(self, other: object) -> bool: //| """Two Address objects are equal if their addresses and address types are equal.""" //| ... -//| STATIC mp_obj_t bleio_address_binary_op(mp_binary_op_t op, mp_obj_t lhs_in, mp_obj_t rhs_in) { switch (op) { // Two Addresses are equal if their address bytes and address_type are equal @@ -149,7 +145,6 @@ STATIC mp_obj_t bleio_address_binary_op(mp_binary_op_t op, mp_obj_t lhs_in, mp_o //| def __hash__(self) -> int: //| """Returns a hash for the Address data.""" //| ... -//| STATIC mp_obj_t bleio_address_unary_op(mp_unary_op_t op, mp_obj_t self_in) { switch (op) { // Two Addresses are equal if their address bytes and address_type are equal diff --git a/shared-bindings/_bleio/Attribute.c b/shared-bindings/_bleio/Attribute.c index d639f2a421..176198d450 100644 --- a/shared-bindings/_bleio/Attribute.c +++ b/shared-bindings/_bleio/Attribute.c @@ -39,7 +39,6 @@ //| def __init__(self) -> None: //| """You cannot create an instance of :py:class:`~_bleio.Attribute`.""" //| ... -//| STATIC const mp_rom_map_elem_t bleio_attribute_locals_dict_table[] = { diff --git a/shared-bindings/_bleio/Characteristic.c b/shared-bindings/_bleio/Characteristic.c index 4ff37f0623..8a93915a8f 100644 --- a/shared-bindings/_bleio/Characteristic.c +++ b/shared-bindings/_bleio/Characteristic.c @@ -35,7 +35,7 @@ //| class Characteristic: //| """Stores information about a BLE service characteristic and allows reading -//| and writing of the characteristic's value.""" +//| and writing of the characteristic's value.""" //| //| def __init__(self) -> None: //| """There is no regular constructor for a Characteristic. A new local Characteristic can be created @@ -43,13 +43,20 @@ //| Remote Characteristic objects are created by `Connection.discover_remote_services()` //| as part of remote Services.""" //| ... -//| -//| def add_to_service(self, service: Service, uuid: UUID, *, properties: int = 0, -//| read_perm: int = Attribute.OPEN, write_perm: int = Attribute.OPEN, -//| max_length: int = 20, fixed_length: bool = False, -//| initial_value: Optional[ReadableBuffer] = None, -//| user_description: Optional[str] = None) -> Characteristic: +//| def add_to_service( +//| self, +//| service: Service, +//| uuid: UUID, +//| *, +//| properties: int = 0, +//| read_perm: int = Attribute.OPEN, +//| write_perm: int = Attribute.OPEN, +//| max_length: int = 20, +//| fixed_length: bool = False, +//| initial_value: Optional[ReadableBuffer] = None, +//| user_description: Optional[str] = None +//| ) -> Characteristic: //| """Create a new Characteristic object, and add it to this Service. //| //| :param Service service: The service that will provide this characteristic @@ -73,7 +80,6 @@ //| //| :return: the new Characteristic.""" //| ... -//| STATIC mp_obj_t bleio_characteristic_add_to_service(size_t n_args, const mp_obj_t *pos_args, mp_map_t *kw_args) { // class is arg[0], which we can ignore. @@ -100,7 +106,7 @@ STATIC mp_obj_t bleio_characteristic_add_to_service(size_t n_args, const mp_obj_ const bleio_characteristic_properties_t properties = args[ARG_properties].u_int; if (properties & ~CHAR_PROP_ALL) { - mp_raise_ValueError(translate("Invalid properties")); + mp_arg_error_invalid(MP_QSTR_properties); } const bleio_attribute_security_mode_t read_perm = args[ARG_read_perm].u_int; @@ -109,10 +115,8 @@ STATIC mp_obj_t bleio_characteristic_add_to_service(size_t n_args, const mp_obj_ const bleio_attribute_security_mode_t write_perm = args[ARG_write_perm].u_int; common_hal_bleio_attribute_security_mode_check_valid(write_perm); - const mp_int_t max_length_int = args[ARG_max_length].u_int; - if (max_length_int < 0) { - mp_raise_ValueError(translate("max_length must be >= 0")); - } + const mp_int_t max_length_int = mp_arg_validate_int_min(args[ARG_max_length].u_int, 0, MP_QSTR_max_length); + const size_t max_length = (size_t)max_length_int; const bool fixed_length = args[ARG_fixed_length].u_bool; mp_obj_t initial_value = args[ARG_initial_value].u_obj; @@ -159,7 +163,6 @@ STATIC MP_DEFINE_CONST_CLASSMETHOD_OBJ(bleio_characteristic_add_to_service_obj, //| """An int bitmask representing which properties are set, specified as bitwise or'ing of //| of these possible values. //| `BROADCAST`, `INDICATE`, `NOTIFY`, `READ`, `WRITE`, `WRITE_NO_RESPONSE`.""" -//| STATIC mp_obj_t bleio_characteristic_get_properties(mp_obj_t self_in) { bleio_characteristic_obj_t *self = MP_OBJ_TO_PTR(self_in); @@ -174,7 +177,6 @@ MP_PROPERTY_GETTER(bleio_characteristic_properties_obj, //| """The UUID of this characteristic. (read-only) //| //| Will be ``None`` if the 128-bit UUID for this characteristic is not known.""" -//| STATIC mp_obj_t bleio_characteristic_get_uuid(mp_obj_t self_in) { bleio_characteristic_obj_t *self = MP_OBJ_TO_PTR(self_in); @@ -188,7 +190,6 @@ MP_PROPERTY_GETTER(bleio_characteristic_uuid_obj, //| value: bytearray //| """The value of this characteristic.""" -//| STATIC mp_obj_t bleio_characteristic_get_value(mp_obj_t self_in) { bleio_characteristic_obj_t *self = MP_OBJ_TO_PTR(self_in); @@ -216,7 +217,6 @@ MP_PROPERTY_GETSET(bleio_characteristic_value_obj, //| max_length: int //| """The max length of this characteristic.""" -//| STATIC mp_obj_t bleio_characteristic_get_max_length(mp_obj_t self_in) { bleio_characteristic_obj_t *self = MP_OBJ_TO_PTR(self_in); @@ -229,7 +229,6 @@ MP_PROPERTY_GETTER(bleio_characteristic_max_length_obj, //| descriptors: Descriptor //| """A tuple of :py:class:`Descriptor` objects related to this characteristic. (read-only)""" -//| STATIC mp_obj_t bleio_characteristic_get_descriptors(mp_obj_t self_in) { bleio_characteristic_obj_t *self = MP_OBJ_TO_PTR(self_in); // Return list as a tuple so user won't be able to change it. @@ -243,7 +242,6 @@ MP_PROPERTY_GETTER(bleio_characteristic_descriptors_obj, //| service: Service //| """The Service this Characteristic is a part of.""" -//| STATIC mp_obj_t bleio_characteristic_get_service(mp_obj_t self_in) { bleio_characteristic_obj_t *self = MP_OBJ_TO_PTR(self_in); @@ -260,7 +258,6 @@ MP_PROPERTY_GETTER(bleio_characteristic_service_obj, //| :param bool notify: True if Characteristic should receive notifications of remote writes //| :param float indicate: True if Characteristic should receive indications of remote writes""" //| ... -//| STATIC mp_obj_t bleio_characteristic_set_cccd(mp_uint_t n_args, const mp_obj_t *pos_args, mp_map_t *kw_args) { bleio_characteristic_obj_t *self = MP_OBJ_TO_PTR(pos_args[0]); diff --git a/shared-bindings/_bleio/CharacteristicBuffer.c b/shared-bindings/_bleio/CharacteristicBuffer.c index 78ff07fa77..9b44114a99 100644 --- a/shared-bindings/_bleio/CharacteristicBuffer.c +++ b/shared-bindings/_bleio/CharacteristicBuffer.c @@ -44,7 +44,9 @@ STATIC void raise_error_if_not_connected(bleio_characteristic_buffer_obj_t *self //| class CharacteristicBuffer: //| """Accumulates a Characteristic's incoming values in a FIFO buffer.""" //| -//| def __init__(self, characteristic: Characteristic, *, timeout: int = 1, buffer_size: int = 64) -> None: +//| def __init__( +//| self, characteristic: Characteristic, *, timeout: int = 1, buffer_size: int = 64 +//| ) -> None: //| //| """Monitor the given Characteristic. Each time a new value is written to the Characteristic //| add the newly-written bytes to a FIFO buffer. @@ -56,7 +58,6 @@ STATIC void raise_error_if_not_connected(bleio_characteristic_buffer_obj_t *self //| :param int buffer_size: Size of ring buffer that stores incoming data coming from client. //| Must be >= 1.""" //| ... -//| STATIC mp_obj_t bleio_characteristic_buffer_make_new(const mp_obj_type_t *type, size_t n_args, size_t n_kw, const mp_obj_t *all_args) { enum { ARG_characteristic, ARG_timeout, ARG_buffer_size, }; static const mp_arg_t allowed_args[] = { @@ -70,15 +71,9 @@ STATIC mp_obj_t bleio_characteristic_buffer_make_new(const mp_obj_type_t *type, bleio_characteristic_obj_t *characteristic = mp_arg_validate_type(args[ARG_characteristic].u_obj, &bleio_characteristic_type, MP_QSTR_characteristic); - mp_float_t timeout = mp_obj_get_float(args[ARG_timeout].u_obj); - if (timeout < 0.0f) { - mp_raise_ValueError(translate("timeout must be >= 0.0")); - } + mp_float_t timeout = mp_arg_validate_obj_float_non_negative(args[ARG_timeout].u_obj, 1.0f, MP_QSTR_timeout); - const int buffer_size = args[ARG_buffer_size].u_int; - if (buffer_size < 1) { - mp_raise_ValueError_varg(translate("%q must be >= 1"), MP_QSTR_buffer_size); - } + const mp_int_t buffer_size = mp_arg_validate_int_min(args[ARG_buffer_size].u_int, 1, MP_QSTR_buffer_size); bleio_characteristic_buffer_obj_t *self = m_new_obj(bleio_characteristic_buffer_obj_t); self->base.type = &bleio_characteristic_buffer_type; @@ -105,21 +100,18 @@ STATIC void check_for_deinit(bleio_characteristic_buffer_obj_t *self) { //| :return: Data read //| :rtype: bytes or None""" //| ... -//| //| def readinto(self, buf: WriteableBuffer) -> Optional[int]: //| """Read bytes into the ``buf``. Read at most ``len(buf)`` bytes. //| //| :return: number of bytes read and stored into ``buf`` //| :rtype: int or None (on a non-blocking error)""" //| ... -//| //| def readline(self) -> bytes: //| """Read a line, ending in a newline character. //| //| :return: the line read //| :rtype: int or None""" //| ... -//| // These three methods are used by the shared stream methods. STATIC mp_uint_t bleio_characteristic_buffer_read(mp_obj_t self_in, void *buf_in, mp_uint_t size, int *errcode) { @@ -165,7 +157,6 @@ STATIC mp_uint_t bleio_characteristic_buffer_ioctl(mp_obj_t self_in, mp_uint_t r //| in_waiting: int //| """The number of bytes in the input buffer, available to be read""" -//| STATIC mp_obj_t bleio_characteristic_buffer_obj_get_in_waiting(mp_obj_t self_in) { bleio_characteristic_buffer_obj_t *self = MP_OBJ_TO_PTR(self_in); check_for_deinit(self); @@ -179,7 +170,6 @@ MP_PROPERTY_GETTER(bleio_characteristic_buffer_in_waiting_obj, //| def reset_input_buffer(self) -> None: //| """Discard any unread characters in the input buffer.""" //| ... -//| STATIC mp_obj_t bleio_characteristic_buffer_obj_reset_input_buffer(mp_obj_t self_in) { bleio_characteristic_buffer_obj_t *self = MP_OBJ_TO_PTR(self_in); check_for_deinit(self); diff --git a/shared-bindings/_bleio/Connection.c b/shared-bindings/_bleio/Connection.c index 7a85ccddc2..f76ecc8167 100644 --- a/shared-bindings/_bleio/Connection.c +++ b/shared-bindings/_bleio/Connection.c @@ -72,11 +72,9 @@ void bleio_connection_ensure_connected(bleio_connection_obj_t *self) { //| Connections may also be made when another device initiates a connection. To use a Connection //| created by a peer, read the `Adapter.connections` property.""" //| ... -//| //| def disconnect(self) -> None: //| """Disconnects from the remote peripheral. Does nothing if already disconnected.""" //| ... -//| STATIC mp_obj_t bleio_connection_disconnect(mp_obj_t self_in) { bleio_connection_obj_t *self = MP_OBJ_TO_PTR(self_in); // common_hal_bleio_connection_disconnect() does nothing if already disconnected. @@ -89,7 +87,6 @@ STATIC MP_DEFINE_CONST_FUN_OBJ_1(bleio_connection_disconnect_obj, bleio_connecti //| def pair(self, *, bond: bool = True) -> None: //| """Pair to the peer to improve security.""" //| ... -//| STATIC mp_obj_t bleio_connection_pair(mp_uint_t n_args, const mp_obj_t *pos_args, mp_map_t *kw_args) { bleio_connection_obj_t *self = MP_OBJ_TO_PTR(pos_args[0]); @@ -108,7 +105,9 @@ STATIC mp_obj_t bleio_connection_pair(mp_uint_t n_args, const mp_obj_t *pos_args } STATIC MP_DEFINE_CONST_FUN_OBJ_KW(bleio_connection_pair_obj, 1, bleio_connection_pair); -//| def discover_remote_services(self, service_uuids_whitelist: Optional[Iterable[UUID]] = None) -> Tuple[Service, ...]: +//| def discover_remote_services( +//| self, service_uuids_whitelist: Optional[Iterable[UUID]] = None +//| ) -> Tuple[Service, ...]: //| """Do BLE discovery for all services or for the given service UUIDS, //| to find their handles and characteristics, and return the discovered services. //| `Connection.connected` must be True. @@ -131,7 +130,6 @@ STATIC MP_DEFINE_CONST_FUN_OBJ_KW(bleio_connection_pair_obj, 1, bleio_connection //| //| :return: A tuple of `_bleio.Service` objects provided by the remote peripheral.""" //| ... -//| STATIC mp_obj_t bleio_connection_discover_remote_services(mp_uint_t n_args, const mp_obj_t *pos_args, mp_map_t *kw_args) { bleio_connection_obj_t *self = MP_OBJ_TO_PTR(pos_args[0]); @@ -153,7 +151,6 @@ STATIC MP_DEFINE_CONST_FUN_OBJ_KW(bleio_connection_discover_remote_services_obj, //| connected: bool //| """True if connected to the remote peer.""" -//| STATIC mp_obj_t bleio_connection_get_connected(mp_obj_t self_in) { bleio_connection_obj_t *self = MP_OBJ_TO_PTR(self_in); @@ -167,7 +164,6 @@ MP_PROPERTY_GETTER(bleio_connection_connected_obj, //| paired: bool //| """True if paired to the remote peer.""" -//| STATIC mp_obj_t bleio_connection_get_paired(mp_obj_t self_in) { bleio_connection_obj_t *self = MP_OBJ_TO_PTR(self_in); @@ -188,7 +184,6 @@ MP_PROPERTY_GETTER(bleio_connection_paired_obj, //| //| Apple has additional guidelines that dictate should be a multiple of 15ms except if HID is //| available. When HID is available Apple devices may accept 11.25ms intervals.""" -//| STATIC mp_obj_t bleio_connection_get_connection_interval(mp_obj_t self_in) { bleio_connection_obj_t *self = MP_OBJ_TO_PTR(self_in); diff --git a/shared-bindings/_bleio/Descriptor.c b/shared-bindings/_bleio/Descriptor.c index f2ef6b433d..9ebe95432e 100644 --- a/shared-bindings/_bleio/Descriptor.c +++ b/shared-bindings/_bleio/Descriptor.c @@ -44,9 +44,18 @@ //| and attached to a Characteristic by calling `add_to_characteristic()`. //| Remote Descriptor objects are created by `Connection.discover_remote_services()` //| as part of remote Characteristics in the remote Services that are discovered.""" -//| //| @classmethod -//| def add_to_characteristic(cls, characteristic: Characteristic, uuid: UUID, *, read_perm: int = Attribute.OPEN, write_perm: int = Attribute.OPEN, max_length: int = 20, fixed_length: bool = False, initial_value: ReadableBuffer = b'') -> Descriptor: +//| def add_to_characteristic( +//| cls, +//| characteristic: Characteristic, +//| uuid: UUID, +//| *, +//| read_perm: int = Attribute.OPEN, +//| write_perm: int = Attribute.OPEN, +//| max_length: int = 20, +//| fixed_length: bool = False, +//| initial_value: ReadableBuffer = b"" +//| ) -> Descriptor: //| """Create a new Descriptor object, and add it to this Service. //| //| :param Characteristic characteristic: The characteristic that will hold this descriptor @@ -65,7 +74,6 @@ //| //| :return: the new Descriptor.""" //| ... -//| STATIC mp_obj_t bleio_descriptor_add_to_characteristic(size_t n_args, const mp_obj_t *pos_args, mp_map_t *kw_args) { // class is arg[0], which we can ignore. @@ -94,10 +102,8 @@ STATIC mp_obj_t bleio_descriptor_add_to_characteristic(size_t n_args, const mp_o const bleio_attribute_security_mode_t write_perm = args[ARG_write_perm].u_int; common_hal_bleio_attribute_security_mode_check_valid(write_perm); - const mp_int_t max_length_int = args[ARG_max_length].u_int; - if (max_length_int < 0) { - mp_raise_ValueError(translate("max_length must be >= 0")); - } + const mp_int_t max_length_int = mp_arg_validate_int_min(args[ARG_max_length].u_int, 0, MP_QSTR_max_length); + const size_t max_length = (size_t)max_length_int; const bool fixed_length = args[ARG_fixed_length].u_bool; mp_obj_t initial_value = args[ARG_initial_value].u_obj; @@ -135,7 +141,6 @@ STATIC MP_DEFINE_CONST_CLASSMETHOD_OBJ(bleio_descriptor_add_to_characteristic_ob //| uuid: UUID //| """The descriptor uuid. (read-only)""" -//| STATIC mp_obj_t bleio_descriptor_get_uuid(mp_obj_t self_in) { bleio_descriptor_obj_t *self = MP_OBJ_TO_PTR(self_in); @@ -149,7 +154,6 @@ MP_PROPERTY_GETTER(bleio_descriptor_uuid_obj, //| characteristic: Characteristic //| """The Characteristic this Descriptor is a part of.""" -//| STATIC mp_obj_t bleio_descriptor_get_characteristic(mp_obj_t self_in) { bleio_descriptor_obj_t *self = MP_OBJ_TO_PTR(self_in); diff --git a/shared-bindings/_bleio/PacketBuffer.c b/shared-bindings/_bleio/PacketBuffer.c index 9e64661fd3..8c6b017c9c 100644 --- a/shared-bindings/_bleio/PacketBuffer.c +++ b/shared-bindings/_bleio/PacketBuffer.c @@ -44,7 +44,13 @@ //| When we're the server, we ignore all connections besides the first to subscribe to //| notifications.""" //| -//| def __init__(self, characteristic: Characteristic, *, buffer_size: int, max_packet_size: Optional[int] = None) -> None: +//| def __init__( +//| self, +//| characteristic: Characteristic, +//| *, +//| buffer_size: int, +//| max_packet_size: Optional[int] = None +//| ) -> None: //| """Monitor the given Characteristic. Each time a new value is written to the Characteristic //| add the newly-written bytes to a FIFO buffer. //| @@ -59,7 +65,6 @@ //| :param int max_packet_size: Maximum size of packets. Overrides value from the characteristic. //| (Remote characteristics may not have the correct length.)""" //| ... -//| STATIC mp_obj_t bleio_packet_buffer_make_new(const mp_obj_type_t *type, size_t n_args, size_t n_kw, const mp_obj_t *all_args) { enum { ARG_characteristic, ARG_buffer_size, ARG_max_packet_size }; static const mp_arg_t allowed_args[] = { @@ -73,10 +78,7 @@ STATIC mp_obj_t bleio_packet_buffer_make_new(const mp_obj_type_t *type, size_t n bleio_characteristic_obj_t *characteristic = mp_arg_validate_type(args[ARG_characteristic].u_obj, &bleio_characteristic_type, MP_QSTR_characteristic); - const mp_int_t buffer_size = args[ARG_buffer_size].u_int; - if (buffer_size < 1) { - mp_raise_ValueError_varg(translate("%q must be >= 1"), MP_QSTR_buffer_size); - } + const mp_int_t buffer_size = mp_arg_validate_int_min(args[ARG_buffer_size].u_int, 1, MP_QSTR_buffer_size); size_t max_packet_size = common_hal_bleio_characteristic_get_max_length(characteristic); if (args[ARG_max_packet_size].u_obj != mp_const_none) { @@ -104,7 +106,6 @@ STATIC void check_for_deinit(bleio_packet_buffer_obj_t *self) { //| :return: number of bytes read and stored into ``buf`` //| :rtype: int""" //| ... -//| STATIC mp_obj_t bleio_packet_buffer_readinto(mp_obj_t self_in, mp_obj_t buffer_obj) { bleio_packet_buffer_obj_t *self = MP_OBJ_TO_PTR(self_in); check_for_deinit(self); @@ -130,7 +131,6 @@ STATIC MP_DEFINE_CONST_FUN_OBJ_2(bleio_packet_buffer_readinto_obj, bleio_packet_ //| :return: number of bytes written. May include header bytes when packet is empty. //| :rtype: int""" //| ... -//| // TODO: Add a kwarg `merge=False` to dictate whether subsequent writes are merged into a pending // one. STATIC mp_obj_t bleio_packet_buffer_write(mp_uint_t n_args, const mp_obj_t *pos_args, mp_map_t *kw_args) { @@ -185,7 +185,6 @@ STATIC MP_DEFINE_CONST_FUN_OBJ_1(bleio_packet_buffer_deinit_obj, bleio_packet_bu //| incoming_packet_length: int //| """Maximum length in bytes of a packet we are reading.""" -//| STATIC mp_obj_t bleio_packet_buffer_get_incoming_packet_length(mp_obj_t self_in) { bleio_packet_buffer_obj_t *self = MP_OBJ_TO_PTR(self_in); diff --git a/shared-bindings/_bleio/ScanEntry.c b/shared-bindings/_bleio/ScanEntry.c index d9434f39cf..83966d1719 100644 --- a/shared-bindings/_bleio/ScanEntry.c +++ b/shared-bindings/_bleio/ScanEntry.c @@ -44,29 +44,24 @@ //| def __init__(self) -> None: //| """Cannot be instantiated directly. Use `_bleio.Adapter.start_scan`.""" //| ... -//| //| def matches(self, prefixes: ScanEntry, *, match_all: bool = True) -> bool: //| """Returns True if the ScanEntry matches all prefixes when ``match_all`` is True. This is stricter //| than the scan filtering which accepts any advertisements that match any of the prefixes -//| where ``match_all`` is False. -//| -//| ``all`` also works for ``match_all`` but will be removed in CircuitPython 8.""" +//| where ``match_all`` is False.""" //| ... -//| STATIC mp_obj_t bleio_scanentry_matches(mp_uint_t n_args, const mp_obj_t *pos_args, mp_map_t *kw_args) { bleio_scanentry_obj_t *self = MP_OBJ_TO_PTR(pos_args[0]); - enum { ARG_prefixes, ARG_all, ARG_match_all }; + enum { ARG_prefixes, ARG_match_all }; static const mp_arg_t allowed_args[] = { { MP_QSTR_prefixes, MP_ARG_OBJ | MP_ARG_REQUIRED }, - { MP_QSTR_all, MP_ARG_BOOL | MP_ARG_KW_ONLY, {.u_bool = true} }, { MP_QSTR_match_all, MP_ARG_BOOL | MP_ARG_KW_ONLY, {.u_bool = true} }, }; mp_arg_val_t args[MP_ARRAY_SIZE(allowed_args)]; mp_arg_parse_all(n_args - 1, pos_args + 1, kw_args, MP_ARRAY_SIZE(allowed_args), allowed_args, args); - bool match_all = args[ARG_all].u_bool && args[ARG_match_all].u_bool; + bool match_all = args[ARG_match_all].u_bool; mp_buffer_info_t bufinfo; mp_get_buffer_raise(args[ARG_prefixes].u_obj, &bufinfo, MP_BUFFER_READ); @@ -76,7 +71,6 @@ STATIC MP_DEFINE_CONST_FUN_OBJ_KW(bleio_scanentry_matches_obj, 1, bleio_scanentr //| address: Address //| """The address of the device (read-only), of type `_bleio.Address`.""" -//| STATIC mp_obj_t bleio_scanentry_get_address(mp_obj_t self_in) { bleio_scanentry_obj_t *self = MP_OBJ_TO_PTR(self_in); return common_hal_bleio_scanentry_get_address(self); @@ -88,7 +82,6 @@ MP_PROPERTY_GETTER(bleio_scanentry_address_obj, //| advertisement_bytes: bytes //| """All the advertisement data present in the packet, returned as a ``bytes`` object. (read-only)""" -//| STATIC mp_obj_t scanentry_get_advertisement_bytes(mp_obj_t self_in) { bleio_scanentry_obj_t *self = MP_OBJ_TO_PTR(self_in); return common_hal_bleio_scanentry_get_advertisement_bytes(self); @@ -100,7 +93,6 @@ MP_PROPERTY_GETTER(bleio_scanentry_advertisement_bytes_obj, //| rssi: int //| """The signal strength of the device at the time of the scan, in integer dBm. (read-only)""" -//| STATIC mp_obj_t scanentry_get_rssi(mp_obj_t self_in) { bleio_scanentry_obj_t *self = MP_OBJ_TO_PTR(self_in); return mp_obj_new_int(common_hal_bleio_scanentry_get_rssi(self)); @@ -112,7 +104,6 @@ MP_PROPERTY_GETTER(bleio_scanentry_rssi_obj, //| connectable: bool //| """True if the device can be connected to. (read-only)""" -//| STATIC mp_obj_t scanentry_get_connectable(mp_obj_t self_in) { bleio_scanentry_obj_t *self = MP_OBJ_TO_PTR(self_in); return mp_obj_new_bool(common_hal_bleio_scanentry_get_connectable(self)); diff --git a/shared-bindings/_bleio/ScanResults.c b/shared-bindings/_bleio/ScanResults.c index bee6cfa89c..b0f37d9fe5 100644 --- a/shared-bindings/_bleio/ScanResults.c +++ b/shared-bindings/_bleio/ScanResults.c @@ -49,11 +49,9 @@ STATIC mp_obj_t scanresults_iternext(mp_obj_t self_in) { //| def __init__(self) -> None: //| """Cannot be instantiated directly. Use `_bleio.Adapter.start_scan`.""" //| ... -//| //| def __iter__(self) -> Iterator[ScanEntry]: //| """Returns itself since it is the iterator.""" //| ... -//| //| def __next__(self) -> ScanEntry: //| """Returns the next `_bleio.ScanEntry`. Blocks if none have been received and scanning is still //| active. Raises `StopIteration` if scanning is finished and no other results are available.""" diff --git a/shared-bindings/_bleio/Service.c b/shared-bindings/_bleio/Service.c index ddbdecdf79..7b357882f0 100644 --- a/shared-bindings/_bleio/Service.c +++ b/shared-bindings/_bleio/Service.c @@ -47,7 +47,6 @@ //| //| :return: the new Service""" //| ... -//| STATIC mp_obj_t bleio_service_make_new(const mp_obj_type_t *type, size_t n_args, size_t n_kw, const mp_obj_t *all_args) { enum { ARG_uuid, ARG_secondary }; static const mp_arg_t allowed_args[] = { @@ -73,7 +72,6 @@ STATIC mp_obj_t bleio_service_make_new(const mp_obj_type_t *type, size_t n_args, //| characteristics: Tuple[Characteristic, ...] //| """A tuple of :py:class:`Characteristic` designating the characteristics that are offered by //| this service. (read-only)""" -//| STATIC mp_obj_t bleio_service_get_characteristics(mp_obj_t self_in) { bleio_service_obj_t *self = MP_OBJ_TO_PTR(self_in); return MP_OBJ_FROM_PTR(common_hal_bleio_service_get_characteristics(self)); @@ -85,7 +83,6 @@ MP_PROPERTY_GETTER(bleio_service_characteristics_obj, //| remote: bool //| """True if this is a service provided by a remote device. (read-only)""" -//| STATIC mp_obj_t bleio_service_get_remote(mp_obj_t self_in) { bleio_service_obj_t *self = MP_OBJ_TO_PTR(self_in); @@ -98,7 +95,6 @@ MP_PROPERTY_GETTER(bleio_service_remote_obj, //| secondary: bool //| """True if this is a secondary service. (read-only)""" -//| STATIC mp_obj_t bleio_service_get_secondary(mp_obj_t self_in) { bleio_service_obj_t *self = MP_OBJ_TO_PTR(self_in); diff --git a/shared-bindings/_bleio/UUID.c b/shared-bindings/_bleio/UUID.c index 599a89a581..922b1ac5fb 100644 --- a/shared-bindings/_bleio/UUID.c +++ b/shared-bindings/_bleio/UUID.c @@ -50,7 +50,6 @@ //| :param value: The uuid value to encapsulate //| :type value: int, ~circuitpython_typing.ReadableBuffer or str""" //| ... -//| STATIC mp_obj_t bleio_uuid_make_new(const mp_obj_type_t *type, size_t n_args, size_t n_kw, const mp_obj_t *all_args) { mp_arg_check_num(n_args, n_kw, 1, 1, false); @@ -124,7 +123,6 @@ STATIC mp_obj_t bleio_uuid_make_new(const mp_obj_type_t *type, size_t n_args, si //| """The 16-bit part of the UUID. (read-only) //| //| :type: int""" -//| STATIC mp_obj_t bleio_uuid_get_uuid16(mp_obj_t self_in) { bleio_uuid_obj_t *self = MP_OBJ_TO_PTR(self_in); return MP_OBJ_NEW_SMALL_INT(common_hal_bleio_uuid_get_uuid16(self)); @@ -140,7 +138,6 @@ MP_PROPERTY_GETTER(bleio_uuid_uuid16_obj, //| Raises AttributeError if this is a 16-bit UUID. (read-only) //| //| :type: bytes""" -//| STATIC mp_obj_t bleio_uuid_get_uuid128(mp_obj_t self_in) { bleio_uuid_obj_t *self = MP_OBJ_TO_PTR(self_in); @@ -162,7 +159,6 @@ MP_PROPERTY_GETTER(bleio_uuid_uuid128_obj, //| 16-bit Bluetooth SIG assigned UUID. (read-only) 32-bit UUIDs are not currently supported. //| //| :type: int""" -//| STATIC mp_obj_t bleio_uuid_get_size(mp_obj_t self_in) { bleio_uuid_obj_t *self = MP_OBJ_TO_PTR(self_in); return MP_OBJ_NEW_SMALL_INT(common_hal_bleio_uuid_get_size(self)); @@ -177,7 +173,6 @@ MP_PROPERTY_GETTER(bleio_uuid_size_obj, //| def pack_into(self, buffer: WriteableBuffer, offset: int = 0) -> None: //| """Packs the UUID into the given buffer at the given offset.""" //| ... -//| STATIC mp_obj_t bleio_uuid_pack_into(mp_uint_t n_args, const mp_obj_t *pos_args, mp_map_t *kw_args) { bleio_uuid_obj_t *self = MP_OBJ_TO_PTR(pos_args[0]); diff --git a/shared-bindings/_bleio/__init__.c b/shared-bindings/_bleio/__init__.c index 72d96846aa..1ec2a2758a 100644 --- a/shared-bindings/_bleio/__init__.c +++ b/shared-bindings/_bleio/__init__.c @@ -54,16 +54,16 @@ //| CircuitPython library instead, which builds on `_bleio`, and //| provides higher-level convenience functionality, including predefined beacons, clients, //| servers.""" -//| //| adapter: Adapter //| """BLE Adapter used to manage device discovery and connections. //| This object is the sole instance of `_bleio.Adapter`.""" -//| //| class BluetoothError(Exception): //| """Catchall exception for Bluetooth related errors.""" +//| //| ... +//| MP_DEFINE_BLEIO_EXCEPTION(BluetoothError, Exception) NORETURN void mp_raise_bleio_BluetoothError(const compressed_string_t *fmt, ...) { va_list argptr; @@ -76,6 +76,7 @@ NORETURN void mp_raise_bleio_BluetoothError(const compressed_string_t *fmt, ...) //| class RoleError(BluetoothError): //| """Raised when a resource is used as the mismatched role. For example, if a local CCCD is //| attempted to be set but they can only be set when remote.""" +//| //| ... //| MP_DEFINE_BLEIO_EXCEPTION(RoleError, bleio_BluetoothError) @@ -85,6 +86,7 @@ NORETURN void mp_raise_bleio_RoleError(const compressed_string_t *msg) { //| class SecurityError(BluetoothError): //| """Raised when a security related error occurs.""" +//| //| ... //| MP_DEFINE_BLEIO_EXCEPTION(SecurityError, bleio_BluetoothError) diff --git a/shared-bindings/_eve/__init__.c b/shared-bindings/_eve/__init__.c index 13e51cb882..bd0cf9b4ea 100644 --- a/shared-bindings/_eve/__init__.c +++ b/shared-bindings/_eve/__init__.c @@ -40,10 +40,9 @@ //| contains methods for constructing EVE command //| buffers and appending basic graphics commands.""" //| - //| class _EVE: -//| - +//| def __init__(self) -> None: +//| """Create an _EVE object""" typedef struct _mp_obj__EVE_t { mp_obj_base_t base; common_hal__eve_t _eve; @@ -54,9 +53,7 @@ STATIC const mp_obj_type_t _EVE_type; #define EVEHAL(s) \ (&((mp_obj__EVE_t *)mp_obj_cast_to_native_base((s), &_EVE_type))->_eve) -//| def register(self, o: object) -> None: -//| ... -//| +//| def register(self, o: object) -> None: ... STATIC mp_obj_t _register(mp_obj_t self, mp_obj_t o) { common_hal__eve_t *eve = EVEHAL(self); mp_load_method(o, MP_QSTR_write, eve->dest); @@ -69,7 +66,6 @@ STATIC MP_DEFINE_CONST_FUN_OBJ_2(register_obj, _register); //| //| :param int width: The width of the grid in tiles, or 1 for sprites.""" //| ... -//| STATIC mp_obj_t _flush(mp_obj_t self) { common_hal__eve_flush(EVEHAL(self)); return mp_const_none; @@ -81,7 +77,6 @@ STATIC MP_DEFINE_CONST_FUN_OBJ_1(flush_obj, _flush); //| //| :param ~circuitpython_typing.ReadableBuffer b: The bytes to add""" //| ... -//| STATIC mp_obj_t _cc(mp_obj_t self, mp_obj_t b) { mp_buffer_info_t buffer_info; mp_get_buffer_raise(b, &buffer_info, MP_BUFFER_READ); @@ -100,7 +95,6 @@ STATIC MP_DEFINE_CONST_FUN_OBJ_2(cc_obj, _cc); //| //| These values are part of the graphics context and are saved and restored by :meth:`SaveContext` and :meth:`RestoreContext`.""" //| ... -//| STATIC mp_obj_t _alphafunc(mp_obj_t self, mp_obj_t a0, mp_obj_t a1) { uint32_t func = mp_obj_get_int_truncated(a0); @@ -117,7 +111,6 @@ STATIC MP_DEFINE_CONST_FUN_OBJ_3(alphafunc_obj, _alphafunc); //| //| Valid primitives are ``BITMAPS``, ``POINTS``, ``LINES``, ``LINE_STRIP``, ``EDGE_STRIP_R``, ``EDGE_STRIP_L``, ``EDGE_STRIP_A``, ``EDGE_STRIP_B`` and ``RECTS``.""" //| ... -//| STATIC mp_obj_t _begin(mp_obj_t self, mp_obj_t a0) { uint32_t prim = mp_obj_get_int_truncated(a0); @@ -131,7 +124,6 @@ STATIC MP_DEFINE_CONST_FUN_OBJ_2(begin_obj, _begin); //| //| :param int format: bitmap pixel format.""" //| ... -//| STATIC mp_obj_t _bitmapextformat(mp_obj_t self, mp_obj_t a0) { uint32_t fmt = mp_obj_get_int_truncated(a0); @@ -147,7 +139,6 @@ STATIC MP_DEFINE_CONST_FUN_OBJ_2(bitmapextformat_obj, _bitmapextformat); //| //| This value is part of the graphics context and is saved and restored by :meth:`SaveContext` and :meth:`RestoreContext`.""" //| ... -//| STATIC mp_obj_t _bitmaphandle(mp_obj_t self, mp_obj_t a0) { uint32_t handle = mp_obj_get_int_truncated(a0); @@ -162,7 +153,6 @@ STATIC MP_DEFINE_CONST_FUN_OBJ_2(bitmaphandle_obj, _bitmaphandle); //| :param int linestride: high part of bitmap line stride, in bytes. Range 0-7 //| :param int height: high part of bitmap height, in lines. Range 0-3""" //| ... -//| STATIC mp_obj_t _bitmaplayouth(mp_obj_t self, mp_obj_t a0, mp_obj_t a1) { uint32_t linestride = mp_obj_get_int_truncated(a0); @@ -179,7 +169,6 @@ STATIC MP_DEFINE_CONST_FUN_OBJ_3(bitmaplayouth_obj, _bitmaplayouth); //| :param int linestride: bitmap line stride, in bytes. Range 0-1023 //| :param int height: bitmap height, in lines. Range 0-511""" //| ... -//| STATIC mp_obj_t _bitmaplayout(size_t n_args, const mp_obj_t *args) { uint32_t format = mp_obj_get_int_truncated(args[1]); @@ -196,7 +185,6 @@ STATIC MP_DEFINE_CONST_FUN_OBJ_VAR_BETWEEN(bitmaplayout_obj, 4, 4, _bitmaplayout //| :param int width: high part of drawn bitmap width, in pixels. Range 0-3 //| :param int height: high part of drawn bitmap height, in pixels. Range 0-3""" //| ... -//| STATIC mp_obj_t _bitmapsizeh(mp_obj_t self, mp_obj_t a0, mp_obj_t a1) { uint32_t width = mp_obj_get_int_truncated(a0); @@ -215,7 +203,6 @@ STATIC MP_DEFINE_CONST_FUN_OBJ_3(bitmapsizeh_obj, _bitmapsizeh); //| :param int width: drawn bitmap width, in pixels. Range 0-511 //| :param int height: drawn bitmap height, in pixels. Range 0-511""" //| ... -//| STATIC mp_obj_t _bitmapsize(size_t n_args, const mp_obj_t *args) { uint32_t filter = mp_obj_get_int_truncated(args[1]); @@ -233,7 +220,6 @@ STATIC MP_DEFINE_CONST_FUN_OBJ_VAR_BETWEEN(bitmapsize_obj, 6, 6, _bitmapsize); //| //| :param int addr: Bitmap start address, pixel-aligned. May be in SRAM or flash. Range 0-16777215""" //| ... -//| STATIC mp_obj_t _bitmapsource(mp_obj_t self, mp_obj_t a0) { uint32_t addr = mp_obj_get_int_truncated(a0); @@ -250,7 +236,6 @@ STATIC MP_DEFINE_CONST_FUN_OBJ_2(bitmapsource_obj, _bitmapsource); //| :param int b: blue component source channel. Range 0-7 //| :param int a: alpha component source channel. Range 0-7""" //| ... -//| STATIC mp_obj_t _bitmapswizzle(size_t n_args, const mp_obj_t *args) { uint32_t r = mp_obj_get_int_truncated(args[1]); @@ -272,7 +257,6 @@ STATIC MP_DEFINE_CONST_FUN_OBJ_VAR_BETWEEN(bitmapswizzle_obj, 5, 5, _bitmapswizz //| //| These values are part of the graphics context and are saved and restored by :meth:`SaveContext` and :meth:`RestoreContext`.""" //| ... -//| STATIC mp_obj_t _bitmaptransforma(mp_obj_t self, mp_obj_t a0, mp_obj_t a1) { uint32_t p = mp_obj_get_int_truncated(a0); @@ -292,7 +276,6 @@ STATIC MP_DEFINE_CONST_FUN_OBJ_3(bitmaptransforma_obj, _bitmaptransforma); //| //| These values are part of the graphics context and are saved and restored by :meth:`SaveContext` and :meth:`RestoreContext`.""" //| ... -//| STATIC mp_obj_t _bitmaptransformb(mp_obj_t self, mp_obj_t a0, mp_obj_t a1) { uint32_t p = mp_obj_get_int_truncated(a0); @@ -309,7 +292,6 @@ STATIC MP_DEFINE_CONST_FUN_OBJ_3(bitmaptransformb_obj, _bitmaptransformb); //| //| This value is part of the graphics context and is saved and restored by :meth:`SaveContext` and :meth:`RestoreContext`.""" //| ... -//| STATIC mp_obj_t _bitmaptransformc(mp_obj_t self, mp_obj_t a0) { uint32_t v = mp_obj_get_int_truncated(a0); @@ -328,7 +310,6 @@ STATIC MP_DEFINE_CONST_FUN_OBJ_2(bitmaptransformc_obj, _bitmaptransformc); //| //| These values are part of the graphics context and are saved and restored by :meth:`SaveContext` and :meth:`RestoreContext`.""" //| ... -//| STATIC mp_obj_t _bitmaptransformd(mp_obj_t self, mp_obj_t a0, mp_obj_t a1) { uint32_t p = mp_obj_get_int_truncated(a0); @@ -348,7 +329,6 @@ STATIC MP_DEFINE_CONST_FUN_OBJ_3(bitmaptransformd_obj, _bitmaptransformd); //| //| These values are part of the graphics context and are saved and restored by :meth:`SaveContext` and :meth:`RestoreContext`.""" //| ... -//| STATIC mp_obj_t _bitmaptransforme(mp_obj_t self, mp_obj_t a0, mp_obj_t a1) { uint32_t p = mp_obj_get_int_truncated(a0); @@ -365,7 +345,6 @@ STATIC MP_DEFINE_CONST_FUN_OBJ_3(bitmaptransforme_obj, _bitmaptransforme); //| //| This value is part of the graphics context and is saved and restored by :meth:`SaveContext` and :meth:`RestoreContext`.""" //| ... -//| STATIC mp_obj_t _bitmaptransformf(mp_obj_t self, mp_obj_t a0) { uint32_t v = mp_obj_get_int_truncated(a0); @@ -382,7 +361,6 @@ STATIC MP_DEFINE_CONST_FUN_OBJ_2(bitmaptransformf_obj, _bitmaptransformf); //| //| These values are part of the graphics context and are saved and restored by :meth:`SaveContext` and :meth:`RestoreContext`.""" //| ... -//| STATIC mp_obj_t _blendfunc(mp_obj_t self, mp_obj_t a0, mp_obj_t a1) { uint32_t src = mp_obj_get_int_truncated(a0); @@ -397,7 +375,6 @@ STATIC MP_DEFINE_CONST_FUN_OBJ_3(blendfunc_obj, _blendfunc); //| //| :param int dest: display list address. Range 0-65535""" //| ... -//| STATIC mp_obj_t _call(mp_obj_t self, mp_obj_t a0) { uint32_t dest = mp_obj_get_int_truncated(a0); @@ -413,7 +390,6 @@ STATIC MP_DEFINE_CONST_FUN_OBJ_2(call_obj, _call); //| //| This value is part of the graphics context and is saved and restored by :meth:`SaveContext` and :meth:`RestoreContext`.""" //| ... -//| STATIC mp_obj_t _cell(mp_obj_t self, mp_obj_t a0) { uint32_t cell = mp_obj_get_int_truncated(a0); @@ -429,7 +405,6 @@ STATIC MP_DEFINE_CONST_FUN_OBJ_2(cell_obj, _cell); //| //| This value is part of the graphics context and is saved and restored by :meth:`SaveContext` and :meth:`RestoreContext`.""" //| ... -//| STATIC mp_obj_t _clearcolora(mp_obj_t self, mp_obj_t a0) { uint32_t alpha = mp_obj_get_int_truncated(a0); @@ -447,7 +422,6 @@ STATIC MP_DEFINE_CONST_FUN_OBJ_2(clearcolora_obj, _clearcolora); //| //| These values are part of the graphics context and are saved and restored by :meth:`SaveContext` and :meth:`RestoreContext`.""" //| ... -//| STATIC mp_obj_t _clearcolorrgb(size_t n_args, const mp_obj_t *args) { uint32_t red = mp_obj_get_int_truncated(args[1]); @@ -465,7 +439,6 @@ STATIC MP_DEFINE_CONST_FUN_OBJ_VAR_BETWEEN(clearcolorrgb_obj, 4, 4, _clearcolorr //| :param int s: clear stencil buffer. Range 0-1 //| :param int t: clear tag buffer. Range 0-1""" //| ... -//| STATIC mp_obj_t _clear(size_t n_args, const mp_obj_t *args) { uint32_t c = (n_args > 1) ? mp_obj_get_int_truncated(args[1]) : 1; @@ -483,7 +456,6 @@ STATIC MP_DEFINE_CONST_FUN_OBJ_VAR_BETWEEN(clear_obj, 1, 4, _clear); //| //| This value is part of the graphics context and is saved and restored by :meth:`SaveContext` and :meth:`RestoreContext`.""" //| ... -//| STATIC mp_obj_t _clearstencil(mp_obj_t self, mp_obj_t a0) { uint32_t s = mp_obj_get_int_truncated(a0); @@ -498,7 +470,6 @@ STATIC MP_DEFINE_CONST_FUN_OBJ_2(clearstencil_obj, _clearstencil); //| :param int s: value used when the tag buffer is cleared. Range 0-255. The initial value is 0 //| //| This value is part of the graphics context and is saved and restored by :meth:`SaveContext` and :meth:`RestoreContext`.""" -//| STATIC mp_obj_t _cleartag(mp_obj_t self, mp_obj_t a0) { uint32_t s = mp_obj_get_int_truncated(a0); @@ -514,7 +485,6 @@ STATIC MP_DEFINE_CONST_FUN_OBJ_2(cleartag_obj, _cleartag); //| //| This value is part of the graphics context and is saved and restored by :meth:`SaveContext` and :meth:`RestoreContext`.""" //| ... -//| STATIC mp_obj_t _colora(mp_obj_t self, mp_obj_t a0) { uint32_t alpha = mp_obj_get_int_truncated(a0); @@ -533,7 +503,6 @@ STATIC MP_DEFINE_CONST_FUN_OBJ_2(colora_obj, _colora); //| //| These values are part of the graphics context and are saved and restored by :meth:`SaveContext` and :meth:`RestoreContext`.""" //| ... -//| STATIC mp_obj_t _colormask(size_t n_args, const mp_obj_t *args) { uint32_t r = mp_obj_get_int_truncated(args[1]); @@ -554,7 +523,6 @@ STATIC MP_DEFINE_CONST_FUN_OBJ_VAR_BETWEEN(colormask_obj, 5, 5, _colormask); //| //| These values are part of the graphics context and are saved and restored by :meth:`SaveContext` and :meth:`RestoreContext`.""" //| ... -//| STATIC mp_obj_t _colorrgb(size_t n_args, const mp_obj_t *args) { uint32_t red = mp_obj_get_int_truncated(args[1]); @@ -581,7 +549,6 @@ STATIC MP_DEFINE_CONST_FUN_OBJ_1(display_obj, _display); //| //| :meth:`Vertex2ii` and :meth:`Vertex2f` calls are ignored until the next :meth:`Begin`.""" //| ... -//| STATIC mp_obj_t _end(mp_obj_t self) { @@ -595,7 +562,6 @@ STATIC MP_DEFINE_CONST_FUN_OBJ_1(end_obj, _end); //| //| :param int dest: display list address. Range 0-65535""" //| ... -//| STATIC mp_obj_t _jump(mp_obj_t self, mp_obj_t a0) { uint32_t dest = mp_obj_get_int_truncated(a0); @@ -609,7 +575,6 @@ STATIC MP_DEFINE_CONST_FUN_OBJ_2(jump_obj, _jump); //| //| :param int m: macro register to read. Range 0-1""" //| ... -//| STATIC mp_obj_t _macro(mp_obj_t self, mp_obj_t a0) { uint32_t m = mp_obj_get_int_truncated(a0); @@ -621,7 +586,6 @@ STATIC MP_DEFINE_CONST_FUN_OBJ_2(macro_obj, _macro); //| def Nop(self) -> None: //| """No operation""" //| ... -//| STATIC mp_obj_t _nop(mp_obj_t self) { @@ -637,7 +601,6 @@ STATIC MP_DEFINE_CONST_FUN_OBJ_1(nop_obj, _nop); //| //| This value is part of the graphics context and is saved and restored by :meth:`SaveContext` and :meth:`RestoreContext`.""" //| ... -//| STATIC mp_obj_t _palettesource(mp_obj_t self, mp_obj_t a0) { uint32_t addr = mp_obj_get_int_truncated(a0); @@ -649,7 +612,6 @@ STATIC MP_DEFINE_CONST_FUN_OBJ_2(palettesource_obj, _palettesource); //| def RestoreContext(self) -> None: //| """Restore the current graphics context from the context stack""" //| ... -//| STATIC mp_obj_t _restorecontext(mp_obj_t self) { @@ -661,7 +623,6 @@ STATIC MP_DEFINE_CONST_FUN_OBJ_1(restorecontext_obj, _restorecontext); //| def Return(self) -> None: //| """Return from a previous call command""" //| ... -//| STATIC mp_obj_t _return(mp_obj_t self) { @@ -673,7 +634,6 @@ STATIC MP_DEFINE_CONST_FUN_OBJ_1(return_obj, _return); //| def SaveContext(self) -> None: //| """Push the current graphics context on the context stack""" //| ... -//| STATIC mp_obj_t _savecontext(mp_obj_t self) { @@ -690,7 +650,6 @@ STATIC MP_DEFINE_CONST_FUN_OBJ_1(savecontext_obj, _savecontext); //| //| These values are part of the graphics context and are saved and restored by :meth:`SaveContext` and :meth:`RestoreContext`.""" //| ... -//| STATIC mp_obj_t _scissorsize(mp_obj_t self, mp_obj_t a0, mp_obj_t a1) { uint32_t width = mp_obj_get_int_truncated(a0); @@ -708,7 +667,6 @@ STATIC MP_DEFINE_CONST_FUN_OBJ_3(scissorsize_obj, _scissorsize); //| //| These values are part of the graphics context and are saved and restored by :meth:`SaveContext` and :meth:`RestoreContext`.""" //| ... -//| STATIC mp_obj_t _scissorxy(mp_obj_t self, mp_obj_t a0, mp_obj_t a1) { uint32_t x = mp_obj_get_int_truncated(a0); @@ -727,7 +685,6 @@ STATIC MP_DEFINE_CONST_FUN_OBJ_3(scissorxy_obj, _scissorxy); //| //| These values are part of the graphics context and are saved and restored by :meth:`SaveContext` and :meth:`RestoreContext`.""" //| ... -//| STATIC mp_obj_t _stencilfunc(size_t n_args, const mp_obj_t *args) { uint32_t func = mp_obj_get_int_truncated(args[1]); @@ -745,7 +702,6 @@ STATIC MP_DEFINE_CONST_FUN_OBJ_VAR_BETWEEN(stencilfunc_obj, 4, 4, _stencilfunc); //| //| This value is part of the graphics context and is saved and restored by :meth:`SaveContext` and :meth:`RestoreContext`.""" //| ... -//| STATIC mp_obj_t _stencilmask(mp_obj_t self, mp_obj_t a0) { uint32_t mask = mp_obj_get_int_truncated(a0); @@ -762,7 +718,6 @@ STATIC MP_DEFINE_CONST_FUN_OBJ_2(stencilmask_obj, _stencilmask); //| //| These values are part of the graphics context and are saved and restored by :meth:`SaveContext` and :meth:`RestoreContext`.""" //| ... -//| STATIC mp_obj_t _stencilop(mp_obj_t self, mp_obj_t a0, mp_obj_t a1) { uint32_t sfail = mp_obj_get_int_truncated(a0); @@ -779,7 +734,6 @@ STATIC MP_DEFINE_CONST_FUN_OBJ_3(stencilop_obj, _stencilop); //| //| This value is part of the graphics context and is saved and restored by :meth:`SaveContext` and :meth:`RestoreContext`.""" //| ... -//| STATIC mp_obj_t _tagmask(mp_obj_t self, mp_obj_t a0) { uint32_t mask = mp_obj_get_int_truncated(a0); @@ -795,7 +749,6 @@ STATIC MP_DEFINE_CONST_FUN_OBJ_2(tagmask_obj, _tagmask); //| //| This value is part of the graphics context and is saved and restored by :meth:`SaveContext` and :meth:`RestoreContext`.""" //| ... -//| STATIC mp_obj_t _tag(mp_obj_t self, mp_obj_t a0) { uint32_t s = mp_obj_get_int_truncated(a0); @@ -819,7 +772,6 @@ STATIC MP_DEFINE_CONST_FUN_OBJ_2(vertexformat_obj, _vertexformat); //| //| This method is an alternative to :meth:`Vertex2f`.""" //| ... -//| STATIC mp_obj_t _vertex2ii(size_t n_args, const mp_obj_t *args) { uint32_t x = mp_obj_get_int_truncated(args[1]); @@ -892,7 +844,6 @@ STATIC MP_DEFINE_CONST_FUN_OBJ_VAR_BETWEEN(vertex2ii_obj, 3, 5, _vertex2ii); //| :param float x: pixel x-coordinate //| :param float y: pixel y-coordinate""" //| ... -//| STATIC mp_obj_t _vertex2f(mp_obj_t self, mp_obj_t a0, mp_obj_t a1) { mp_float_t x = mp_obj_get_float(a0); mp_float_t y = mp_obj_get_float(a1); @@ -908,7 +859,6 @@ STATIC MP_DEFINE_CONST_FUN_OBJ_3(vertex2f_obj, _vertex2f); //| //| This value is part of the graphics context and is saved and restored by :meth:`SaveContext` and :meth:`RestoreContext`.""" //| ... -//| STATIC mp_obj_t _linewidth(mp_obj_t self, mp_obj_t a0) { mp_float_t width = mp_obj_get_float(a0); @@ -924,7 +874,6 @@ STATIC MP_DEFINE_CONST_FUN_OBJ_2(linewidth_obj, _linewidth); //| //| This value is part of the graphics context and is saved and restored by :meth:`SaveContext` and :meth:`RestoreContext`.""" //| ... -//| STATIC mp_obj_t _pointsize(mp_obj_t self, mp_obj_t a0) { mp_float_t size = mp_obj_get_float(a0); @@ -940,7 +889,6 @@ STATIC MP_DEFINE_CONST_FUN_OBJ_2(pointsize_obj, _pointsize); //| //| This value is part of the graphics context and is saved and restored by :meth:`SaveContext` and :meth:`RestoreContext`.""" //| ... -//| STATIC mp_obj_t _vertextranslatex(mp_obj_t self, mp_obj_t a0) { mp_float_t x = mp_obj_get_float(a0); @@ -956,7 +904,6 @@ STATIC MP_DEFINE_CONST_FUN_OBJ_2(vertextranslatex_obj, _vertextranslatex); //| //| This value is part of the graphics context and is saved and restored by :meth:`SaveContext` and :meth:`RestoreContext`.""" //| ... -//| STATIC mp_obj_t _vertextranslatey(mp_obj_t self, mp_obj_t a0) { @@ -973,7 +920,6 @@ STATIC MP_DEFINE_CONST_FUN_OBJ_2(vertextranslatey_obj, _vertextranslatey); //| //| This value is part of the graphics context and is saved and restored by :meth:`SaveContext` and :meth:`RestoreContext`.""" //| ... -//| // } @@ -989,7 +935,6 @@ STATIC MP_DEFINE_CONST_FUN_OBJ_2(vertextranslatey_obj, _vertextranslatey); //| This method is used by the ``eve`` module to efficiently add //| commands to the FIFO.""" //| ... -//| STATIC mp_obj_t _cmd0(mp_obj_t self, mp_obj_t n) { uint32_t code = 0xffffff00 | mp_obj_get_int_truncated(n); diff --git a/shared-bindings/_pew/PewPew.c b/shared-bindings/_pew/PewPew.c index 4015d31161..1a4356c719 100644 --- a/shared-bindings/_pew/PewPew.c +++ b/shared-bindings/_pew/PewPew.c @@ -32,7 +32,7 @@ #include "shared-bindings/util.h" #include "PewPew.h" #include "common-hal/_pew/PewPew.h" -#include "supervisor/shared/translate.h" +#include "supervisor/shared/translate/translate.h" //| class PewPew: //| """This is an internal module to be used by the ``pew.py`` library from diff --git a/shared-bindings/_pew/__init__.c b/shared-bindings/_pew/__init__.c index e338869d18..13b9715bbd 100644 --- a/shared-bindings/_pew/__init__.c +++ b/shared-bindings/_pew/__init__.c @@ -49,7 +49,6 @@ STATIC MP_DEFINE_CONST_FUN_OBJ_0(get_ticks_obj, get_ticks); //| """LED matrix driver""" -//| STATIC const mp_rom_map_elem_t pew_module_globals_table[] = { { MP_ROM_QSTR(MP_QSTR___name__), MP_ROM_QSTR(MP_QSTR__pew) }, { MP_OBJ_NEW_QSTR(MP_QSTR_PewPew), MP_ROM_PTR(&pewpew_type)}, diff --git a/shared-bindings/_stage/Layer.c b/shared-bindings/_stage/Layer.c index c3c0aa1801..81d76321f0 100644 --- a/shared-bindings/_stage/Layer.c +++ b/shared-bindings/_stage/Layer.c @@ -28,12 +28,19 @@ #include "__init__.h" #include "Layer.h" -#include "supervisor/shared/translate.h" +#include "supervisor/shared/translate/translate.h" //| class Layer: //| """Keep information about a single layer of graphics""" //| -//| def __init__(self, width: int, height: int, graphic: ReadableBuffer, palette: ReadableBuffer, grid: ReadableBuffer) -> None: +//| def __init__( +//| self, +//| width: int, +//| height: int, +//| graphic: ReadableBuffer, +//| palette: ReadableBuffer, +//| grid: ReadableBuffer, +//| ) -> None: //| """Keep internal information about a layer of graphics (either a //| ``Grid`` or a ``Sprite``) in a format suitable for fast rendering //| with the ``render()`` function. @@ -47,7 +54,6 @@ //| This class is intended for internal use in the ``stage`` library and //| it shouldn't be used on its own.""" //| ... -//| STATIC mp_obj_t layer_make_new(const mp_obj_type_t *type, size_t n_args, size_t n_kw, const mp_obj_t *args) { mp_arg_check_num(n_args, n_kw, 4, 5, false); @@ -91,7 +97,6 @@ STATIC mp_obj_t layer_make_new(const mp_obj_type_t *type, size_t n_args, //| def move(self, x: int, y: int) -> None: //| """Set the offset of the layer to the specified values.""" //| ... -//| STATIC mp_obj_t layer_move(mp_obj_t self_in, mp_obj_t x_in, mp_obj_t y_in) { layer_obj_t *self = MP_OBJ_TO_PTR(self_in); self->x = mp_obj_get_int(x_in); diff --git a/shared-bindings/_stage/Text.c b/shared-bindings/_stage/Text.c index d6b22171d6..c735669861 100644 --- a/shared-bindings/_stage/Text.c +++ b/shared-bindings/_stage/Text.c @@ -28,12 +28,19 @@ #include "__init__.h" #include "Text.h" -#include "supervisor/shared/translate.h" +#include "supervisor/shared/translate/translate.h" //| class Text: //| """Keep information about a single grid of text""" //| -//| def __init__(self, width: int, height: int, font: ReadableBuffer, palette: ReadableBuffer, chars: ReadableBuffer) -> None: +//| def __init__( +//| self, +//| width: int, +//| height: int, +//| font: ReadableBuffer, +//| palette: ReadableBuffer, +//| chars: ReadableBuffer, +//| ) -> None: //| """Keep internal information about a grid of text //| in a format suitable for fast rendering //| with the ``render()`` function. @@ -47,7 +54,6 @@ //| This class is intended for internal use in the ``stage`` library and //| it shouldn't be used on its own.""" //| ... -//| STATIC mp_obj_t text_make_new(const mp_obj_type_t *type, size_t n_args, size_t n_kw, const mp_obj_t *args) { mp_arg_check_num(n_args, n_kw, 5, 5, false); diff --git a/shared-bindings/_stage/__init__.c b/shared-bindings/_stage/__init__.c index ebaa06898e..b2542f9df4 100644 --- a/shared-bindings/_stage/__init__.c +++ b/shared-bindings/_stage/__init__.c @@ -39,7 +39,17 @@ //| The `_stage` module contains native code to speed-up the ```stage`` Library //| `_.""" //| -//| def render(x0: int, y0: int, x1: int, y1: int, layers: List[Layer], buffer: WriteableBuffer, display: displayio.Display, scale: int, background: int) -> None: +//| def render( +//| x0: int, +//| y0: int, +//| x1: int, +//| y1: int, +//| layers: List[Layer], +//| buffer: WriteableBuffer, +//| display: displayio.Display, +//| scale: int, +//| background: int, +//| ) -> None: //| """Render and send to the display a fragment of the screen. //| //| :param int x0: Left edge of the fragment. diff --git a/shared-bindings/adafruit_bus_device/__init__.c b/shared-bindings/adafruit_bus_device/__init__.c index be2378b154..410c6fb2f2 100644 --- a/shared-bindings/adafruit_bus_device/__init__.c +++ b/shared-bindings/adafruit_bus_device/__init__.c @@ -63,7 +63,6 @@ const mp_obj_module_t adafruit_bus_device_spi_device_module = { //| For example, they manage locking the bus to prevent other concurrent access. For SPI //| devices, it manages the chip select and protocol changes such as mode. For I2C, it //| manages the device address.""" -//| STATIC const mp_rom_map_elem_t adafruit_bus_device_module_globals_table[] = { { MP_ROM_QSTR(MP_QSTR___name__), MP_ROM_QSTR(MP_QSTR_adafruit_bus_device) }, { MP_ROM_QSTR(MP_QSTR_i2c_device), MP_ROM_PTR(&adafruit_bus_device_i2c_device_module) }, diff --git a/shared-bindings/adafruit_bus_device/i2c_device/I2CDevice.c b/shared-bindings/adafruit_bus_device/i2c_device/I2CDevice.c index 327e8e72b4..d2b7f0c6ce 100644 --- a/shared-bindings/adafruit_bus_device/i2c_device/I2CDevice.c +++ b/shared-bindings/adafruit_bus_device/i2c_device/I2CDevice.c @@ -36,7 +36,7 @@ #include "shared/runtime/context_manager_helpers.h" #include "py/runtime.h" #include "py/smallint.h" -#include "supervisor/shared/translate.h" +#include "supervisor/shared/translate/translate.h" //| class I2CDevice: @@ -64,9 +64,8 @@ //| # A second transaction //| with device: //| device.write(bytes_read) -//| """ +//| """ //| ... -//| STATIC mp_obj_t adafruit_bus_device_i2cdevice_make_new(const mp_obj_type_t *type, size_t n_args, size_t n_kw, const mp_obj_t *all_args) { adafruit_bus_device_i2cdevice_obj_t *self = m_new_obj(adafruit_bus_device_i2cdevice_obj_t); self->base.type = &adafruit_bus_device_i2cdevice_type; @@ -92,7 +91,6 @@ STATIC mp_obj_t adafruit_bus_device_i2cdevice_make_new(const mp_obj_type_t *type //| def __enter__(self) -> I2CDevice: //| """Context manager entry to lock bus.""" //| ... -//| STATIC mp_obj_t adafruit_bus_device_i2cdevice_obj___enter__(mp_obj_t self_in) { adafruit_bus_device_i2cdevice_obj_t *self = MP_OBJ_TO_PTR(self_in); common_hal_adafruit_bus_device_i2cdevice_lock(self); @@ -103,7 +101,6 @@ STATIC MP_DEFINE_CONST_FUN_OBJ_1(adafruit_bus_device_i2cdevice___enter___obj, ad //| def __exit__(self) -> None: //| """Automatically unlocks the bus on exit.""" //| ... -//| STATIC mp_obj_t adafruit_bus_device_i2cdevice_obj___exit__(size_t n_args, const mp_obj_t *args) { common_hal_adafruit_bus_device_i2cdevice_unlock(MP_OBJ_TO_PTR(args[0])); return mp_const_none; @@ -111,7 +108,9 @@ STATIC mp_obj_t adafruit_bus_device_i2cdevice_obj___exit__(size_t n_args, const STATIC MP_DEFINE_CONST_FUN_OBJ_VAR_BETWEEN(adafruit_bus_device_i2cdevice___exit___obj, 4, 4, adafruit_bus_device_i2cdevice_obj___exit__); //| import sys -//| def readinto(self, buffer: WriteableBuffer, *, start: int = 0, end: int = sys.maxsize) -> None: +//| def readinto( +//| self, buffer: WriteableBuffer, *, start: int = 0, end: int = sys.maxsize +//| ) -> None: //| """Read into ``buffer`` from the device. //| //| If ``start`` or ``end`` is provided, then the buffer will be sliced @@ -123,7 +122,6 @@ STATIC MP_DEFINE_CONST_FUN_OBJ_VAR_BETWEEN(adafruit_bus_device_i2cdevice___exit_ //| :param int end: end of buffer slice; if not specified, use ``len(buffer)`` //| """ //| ... -//| STATIC mp_obj_t adafruit_bus_device_i2cdevice_readinto(size_t n_args, const mp_obj_t *pos_args, mp_map_t *kw_args) { enum { ARG_buffer, ARG_start, ARG_end }; static const mp_arg_t allowed_args[] = { @@ -170,7 +168,6 @@ STATIC MP_DEFINE_CONST_FUN_OBJ_KW(adafruit_bus_device_i2cdevice_readinto_obj, 1, //| :param int end: end of buffer slice; if not specified, use ``len(buffer)`` //| """ //| ... -//| STATIC mp_obj_t adafruit_bus_device_i2cdevice_write(size_t n_args, const mp_obj_t *pos_args, mp_map_t *kw_args) { enum { ARG_buffer, ARG_start, ARG_end }; static const mp_arg_t allowed_args[] = { @@ -205,7 +202,16 @@ MP_DEFINE_CONST_FUN_OBJ_KW(adafruit_bus_device_i2cdevice_write_obj, 1, adafruit_ //| import sys -//| def write_then_readinto(self, out_buffer: ReadableBuffer, in_buffer: WriteableBuffer, *, out_start: int = 0, out_end: int = sys.maxsize, in_start: int = 0, in_end: int = sys.maxsize) -> None: +//| def write_then_readinto( +//| self, +//| out_buffer: ReadableBuffer, +//| in_buffer: WriteableBuffer, +//| *, +//| out_start: int = 0, +//| out_end: int = sys.maxsize, +//| in_start: int = 0, +//| in_end: int = sys.maxsize +//| ) -> None: //| """Write the bytes from ``out_buffer`` to the device, then immediately //| reads into ``in_buffer`` from the device. //| diff --git a/shared-bindings/adafruit_bus_device/spi_device/SPIDevice.c b/shared-bindings/adafruit_bus_device/spi_device/SPIDevice.c index 2c5708b831..afb11856e2 100644 --- a/shared-bindings/adafruit_bus_device/spi_device/SPIDevice.c +++ b/shared-bindings/adafruit_bus_device/spi_device/SPIDevice.c @@ -35,13 +35,22 @@ #include "shared/runtime/buffer_helper.h" #include "shared/runtime/context_manager_helpers.h" #include "py/runtime.h" -#include "supervisor/shared/translate.h" +#include "supervisor/shared/translate/translate.h" //| class SPIDevice: //| """SPI Device Manager""" //| -//| def __init__(self, spi: busio.SPI, chip_select: microcontroller.Pin, *, baudrate: int = 100000, polarity: int = 0, phase: int = 0, extra_clocks : int = 0) -> None: +//| def __init__( +//| self, +//| spi: busio.SPI, +//| chip_select: digitalio.DigitalInOut, +//| *, +//| baudrate: int = 100000, +//| polarity: int = 0, +//| phase: int = 0, +//| extra_clocks: int = 0 +//| ) -> None: //| //| """ //| Represents a single SPI device and manages locking the bus and the device address. @@ -70,7 +79,6 @@ //| with device as spi: //| spi.write(bytes_read)""" //| ... -//| STATIC mp_obj_t adafruit_bus_device_spidevice_make_new(const mp_obj_type_t *type, size_t n_args, size_t n_kw, const mp_obj_t *all_args) { adafruit_bus_device_spidevice_obj_t *self = m_new_obj(adafruit_bus_device_spidevice_obj_t); self->base.type = &adafruit_bus_device_spidevice_type; @@ -89,6 +97,8 @@ STATIC mp_obj_t adafruit_bus_device_spidevice_make_new(const mp_obj_type_t *type busio_spi_obj_t *spi = args[ARG_spi].u_obj; + mp_arg_validate_type(args[ARG_chip_select].u_obj, &digitalio_digitalinout_type, MP_QSTR_chip_select); + common_hal_adafruit_bus_device_spidevice_construct(MP_OBJ_TO_PTR(self), spi, args[ARG_chip_select].u_obj, args[ARG_cs_active_value].u_bool, args[ARG_baudrate].u_int, args[ARG_polarity].u_int, args[ARG_phase].u_int, args[ARG_extra_clocks].u_int); @@ -106,7 +116,6 @@ STATIC mp_obj_t adafruit_bus_device_spidevice_make_new(const mp_obj_type_t *type //| def __enter__(self) -> busio.SPI: //| """Starts a SPI transaction by configuring the SPI and asserting chip select.""" //| ... -//| STATIC mp_obj_t adafruit_bus_device_spidevice_obj___enter__(mp_obj_t self_in) { adafruit_bus_device_spidevice_obj_t *self = MP_OBJ_TO_PTR(self_in); return common_hal_adafruit_bus_device_spidevice_enter(self); diff --git a/shared-bindings/adafruit_pixelbuf/PixelBuf.c b/shared-bindings/adafruit_pixelbuf/PixelBuf.c index d9436ea45a..6203f672ad 100644 --- a/shared-bindings/adafruit_pixelbuf/PixelBuf.c +++ b/shared-bindings/adafruit_pixelbuf/PixelBuf.c @@ -44,12 +44,25 @@ #include "extmod/ulab/code/ndarray.h" #endif +static NORETURN void invalid_byteorder(void) { + mp_arg_error_invalid(MP_QSTR_byteorder); +} + static void parse_byteorder(mp_obj_t byteorder_obj, pixelbuf_byteorder_details_t *parsed); //| class PixelBuf: //| """A fast RGB[W] pixel buffer for LED and similar devices.""" //| -//| def __init__(self, size: int, *, byteorder: str = "BGR", brightness: float = 0, auto_write: bool = False, header: ReadableBuffer = b"", trailer: ReadableBuffer = b"") -> None: +//| def __init__( +//| self, +//| size: int, +//| *, +//| byteorder: str = "BGR", +//| brightness: float = 0, +//| auto_write: bool = False, +//| header: ReadableBuffer = b"", +//| trailer: ReadableBuffer = b"" +//| ) -> None: //| """Create a PixelBuf object of the specified size, byteorder, and bits per pixel. //| //| When brightness is less than 1.0, a second buffer will be used to store the color values @@ -67,7 +80,6 @@ static void parse_byteorder(mp_obj_t byteorder_obj, pixelbuf_byteorder_details_t //| :param ~circuitpython_typing.ReadableBuffer header: Sequence of bytes to always send before pixel values. //| :param ~circuitpython_typing.ReadableBuffer trailer: Sequence of bytes to always send after pixel values.""" //| ... -//| STATIC mp_obj_t pixelbuf_pixelbuf_make_new(const mp_obj_type_t *type, size_t n_args, size_t n_kw, const mp_obj_t *all_args) { enum { ARG_size, ARG_byteorder, ARG_brightness, ARG_auto_write, ARG_header, ARG_trailer }; static const mp_arg_t allowed_args[] = { @@ -124,7 +136,7 @@ static void parse_byteorder(mp_obj_t byteorder_obj, pixelbuf_byteorder_details_t size_t bo_len; const char *byteorder = mp_obj_str_get_data(byteorder_obj, &bo_len); if (bo_len < 3 || bo_len > 4) { - mp_raise_ValueError(translate("Invalid byteorder string")); + invalid_byteorder(); } parsed->order_string = byteorder_obj; @@ -136,7 +148,7 @@ static void parse_byteorder(mp_obj_t byteorder_obj, pixelbuf_byteorder_details_t char *w = strchr(byteorder, 'W'); int num_chars = (dotstar ? 1 : 0) + (w ? 1 : 0) + (r ? 1 : 0) + (g ? 1 : 0) + (b ? 1 : 0); if ((num_chars < parsed->bpp) || !(r && b && g)) { - mp_raise_ValueError(translate("Invalid byteorder string")); + invalid_byteorder(); } parsed->is_dotstar = dotstar ? true : false; parsed->has_white = w ? true : false; @@ -146,16 +158,15 @@ static void parse_byteorder(mp_obj_t byteorder_obj, pixelbuf_byteorder_details_t parsed->byteorder.w = w ? w - byteorder : 0; // The dotstar brightness byte is always first (as it goes with the pixel start bits) if (dotstar && byteorder[0] != 'P') { - mp_raise_ValueError(translate("Invalid byteorder string")); + invalid_byteorder(); } if (parsed->has_white && parsed->is_dotstar) { - mp_raise_ValueError(translate("Invalid byteorder string")); + invalid_byteorder(); } } //| bpp: int //| """The number of bytes per pixel in the buffer (read-only)""" -//| STATIC mp_obj_t pixelbuf_pixelbuf_obj_get_bpp(mp_obj_t self_in) { return MP_OBJ_NEW_SMALL_INT(common_hal_adafruit_pixelbuf_pixelbuf_get_bpp(self_in)); } @@ -170,7 +181,6 @@ MP_PROPERTY_GETTER(pixelbuf_pixelbuf_bpp_obj, //| //| When brightness is less than 1.0, a second buffer will be used to store the color values //| before they are adjusted for brightness.""" -//| STATIC mp_obj_t pixelbuf_pixelbuf_obj_get_brightness(mp_obj_t self_in) { return mp_obj_new_float(common_hal_adafruit_pixelbuf_pixelbuf_get_brightness(self_in)); } @@ -195,7 +205,6 @@ MP_PROPERTY_GETSET(pixelbuf_pixelbuf_brightness_obj, //| auto_write: bool //| """Whether to automatically write the pixels after each update.""" -//| STATIC mp_obj_t pixelbuf_pixelbuf_obj_get_auto_write(mp_obj_t self_in) { return mp_obj_new_bool(common_hal_adafruit_pixelbuf_pixelbuf_get_auto_write(self_in)); } @@ -214,7 +223,6 @@ MP_PROPERTY_GETSET(pixelbuf_pixelbuf_auto_write_obj, //| byteorder: str //| """byteorder string for the buffer (read-only)""" -//| STATIC mp_obj_t pixelbuf_pixelbuf_obj_get_byteorder(mp_obj_t self_in) { return common_hal_adafruit_pixelbuf_pixelbuf_get_byteorder_string(self_in); } @@ -238,7 +246,6 @@ STATIC mp_obj_t pixelbuf_pixelbuf_unary_op(mp_unary_op_t op, mp_obj_t self_in) { //| """Transmits the color data to the pixels so that they are shown. This is done automatically //| when `auto_write` is True.""" //| ... -//| STATIC mp_obj_t pixelbuf_pixelbuf_show(mp_obj_t self_in) { common_hal_adafruit_pixelbuf_pixelbuf_show(self_in); @@ -246,10 +253,11 @@ STATIC mp_obj_t pixelbuf_pixelbuf_show(mp_obj_t self_in) { } STATIC MP_DEFINE_CONST_FUN_OBJ_1(pixelbuf_pixelbuf_show_obj, pixelbuf_pixelbuf_show); -//| def fill(self, color: Union[int, Tuple[int, int, int], Tuple[int, int, int, float]]) -> None: +//| def fill( +//| self, color: Union[int, Tuple[int, int, int], Tuple[int, int, int, float]] +//| ) -> None: //| """Fills the given pixelbuf with the given color.""" //| ... -//| STATIC mp_obj_t pixelbuf_pixelbuf_fill(mp_obj_t self_in, mp_obj_t value) { common_hal_adafruit_pixelbuf_pixelbuf_fill(self_in, value); @@ -259,20 +267,29 @@ STATIC mp_obj_t pixelbuf_pixelbuf_fill(mp_obj_t self_in, mp_obj_t value) { STATIC MP_DEFINE_CONST_FUN_OBJ_2(pixelbuf_pixelbuf_fill_obj, pixelbuf_pixelbuf_fill); //| @overload -//| def __getitem__(self, index: slice) -> Union[Tuple[Tuple[int, int, int], ...], Tuple[Tuple[int, int, int, float], ...]]: ... +//| def __getitem__( +//| self, index: slice +//| ) -> Union[Tuple[Tuple[int, int, int], ...], Tuple[Tuple[int, int, int, float], ...]]: ... //| @overload -//| def __getitem__(self, index: int) -> Union[Tuple[int, int, int], Tuple[int, int, int, float]]: +//| def __getitem__( +//| self, index: int +//| ) -> Union[Tuple[int, int, int], Tuple[int, int, int, float]]: //| """Returns the pixel value at the given index as a tuple of (Red, Green, Blue[, White]) values //| between 0 and 255. When in PWM (DotStar) mode, the 4th tuple value is a float of the pixel //| intensity from 0-1.0.""" //| ... -//| //| @overload -//| def __setitem__(self, index: slice, value: Tuple[Union[int, Tuple[float, ...], List[float]], ...]) -> None: ... +//| def __setitem__( +//| self, index: slice, value: Tuple[Union[int, Tuple[float, ...], List[float]], ...] +//| ) -> None: ... //| @overload -//| def __setitem__(self, index: slice, value: List[Union[int, Tuple[float, ...], List[float]]]) -> None: ... +//| def __setitem__( +//| self, index: slice, value: List[Union[int, Tuple[float, ...], List[float]]] +//| ) -> None: ... //| @overload -//| def __setitem__(self, index: int, value: Union[int, Tuple[float, ...], List[float]]) -> None: +//| def __setitem__( +//| self, index: int, value: Union[int, Tuple[float, ...], List[float]] +//| ) -> None: //| """Sets the pixel value at the given index. Value can either be a tuple or integer. Tuples are //| The individual (Red, Green, Blue[, White]) values between 0 and 255. If given an integer, the //| red, green and blue values are packed into the lower three bytes (0xRRGGBB). diff --git a/shared-bindings/aesio/__init__.c b/shared-bindings/aesio/__init__.c index 716d20393e..f3e1d7dd17 100644 --- a/shared-bindings/aesio/__init__.c +++ b/shared-bindings/aesio/__init__.c @@ -34,7 +34,11 @@ //| """AES encryption routines //| //| The `AES` module contains classes used to implement encryption -//| and decryption. It aims to be low overhead in terms of memory.""" +//| and decryption. It aims to be low overhead in terms of memory. +//| +//| For more information on AES, refer to `the Wikipedia entry +//| `_. +//| """ STATIC const mp_obj_tuple_t mp_aes_key_size_obj = { diff --git a/shared-bindings/aesio/aes.c b/shared-bindings/aesio/aes.c index bb72b10e7e..9170b63799 100644 --- a/shared-bindings/aesio/aes.c +++ b/shared-bindings/aesio/aes.c @@ -16,29 +16,34 @@ //| class AES: //| """Encrypt and decrypt AES streams""" //| -//| def __init__(self, key: ReadableBuffer, mode: int = 0, iv: Optional[ReadableBuffer] = None, segment_size: int = 8) -> None: +//| def __init__( +//| self, +//| key: ReadableBuffer, +//| mode: int = 0, +//| iv: Optional[ReadableBuffer] = None, +//| segment_size: int = 8, +//| ) -> None: //| """Create a new AES state with the given key. //| -//| :param ~circuitpython_typing.ReadableBuffer key: A 16-, 24-, or 32-byte key -//| :param int mode: AES mode to use. One of: `MODE_ECB`, `MODE_CBC`, or -//| `MODE_CTR` -//| :param ~circuitpython_typing.ReadableBuffer iv: Initialization vector to use for CBC or CTR mode +//| :param ~circuitpython_typing.ReadableBuffer key: A 16-, 24-, or 32-byte key +//| :param int mode: AES mode to use. One of: `MODE_ECB`, `MODE_CBC`, or +//| `MODE_CTR` +//| :param ~circuitpython_typing.ReadableBuffer iv: Initialization vector to use for CBC or CTR mode //| -//| Additional arguments are supported for legacy reasons. +//| Additional arguments are supported for legacy reasons. //| -//| Encrypting a string:: +//| Encrypting a string:: //| -//| import aesio -//| from binascii import hexlify +//| import aesio +//| from binascii import hexlify //| -//| key = b'Sixteen byte key' -//| inp = b'CircuitPython!!!' # Note: 16-bytes long -//| outp = bytearray(len(inp)) -//| cipher = aesio.AES(key, aesio.MODE_ECB) -//| cipher.encrypt_into(inp, outp) -//| hexlify(outp)""" +//| key = b'Sixteen byte key' +//| inp = b'CircuitPython!!!' # Note: 16-bytes long +//| outp = bytearray(len(inp)) +//| cipher = aesio.AES(key, aesio.MODE_ECB) +//| cipher.encrypt_into(inp, outp) +//| hexlify(outp)""" //| ... -//| STATIC mp_obj_t aesio_aes_make_new(const mp_obj_type_t *type, size_t n_args, size_t n_kw, const mp_obj_t *all_args) { @@ -63,15 +68,12 @@ STATIC mp_obj_t aesio_aes_make_new(const mp_obj_type_t *type, size_t n_args, const uint8_t *key = NULL; uint32_t key_length = 0; - if (mp_get_buffer(args[ARG_key].u_obj, &bufinfo, MP_BUFFER_READ)) { - if ((bufinfo.len != 16) && (bufinfo.len != 24) && (bufinfo.len != 32)) { - mp_raise_TypeError(translate("Key must be 16, 24, or 32 bytes long")); - } - key = bufinfo.buf; - key_length = bufinfo.len; - } else { - mp_raise_TypeError(translate("No key was specified")); + mp_get_buffer_raise(args[ARG_key].u_obj, &bufinfo, MP_BUFFER_READ); + if ((bufinfo.len != 16) && (bufinfo.len != 24) && (bufinfo.len != 32)) { + mp_raise_TypeError(translate("Key must be 16, 24, or 32 bytes long")); } + key = bufinfo.buf; + key_length = bufinfo.len; int mode = args[ARG_mode].u_int; switch (args[ARG_mode].u_int) { @@ -158,11 +160,10 @@ STATIC void validate_length(aesio_aes_obj_t *self, size_t src_length, //| def encrypt_into(self, src: ReadableBuffer, dest: WriteableBuffer) -> None: //| """Encrypt the buffer from ``src`` into ``dest``. //| -//| For ECB mode, the buffers must be 16 bytes long. For CBC mode, the -//| buffers must be a multiple of 16 bytes, and must be equal length. For -//| CTX mode, there are no restrictions.""" +//| For ECB mode, the buffers must be 16 bytes long. For CBC mode, the +//| buffers must be a multiple of 16 bytes, and must be equal length. For +//| CTX mode, there are no restrictions.""" //| ... -//| STATIC mp_obj_t aesio_aes_encrypt_into(mp_obj_t aesio_obj, mp_obj_t src, mp_obj_t dest) { if (!mp_obj_is_type(aesio_obj, &aesio_aes_type)) { @@ -188,9 +189,9 @@ STATIC MP_DEFINE_CONST_FUN_OBJ_3(aesio_aes_encrypt_into_obj, //| def decrypt_into(self, src: ReadableBuffer, dest: WriteableBuffer) -> None: //| """Decrypt the buffer from ``src`` into ``dest``. -//| For ECB mode, the buffers must be 16 bytes long. For CBC mode, the -//| buffers must be a multiple of 16 bytes, and must be equal length. For -//| CTX mode, there are no restrictions.""" +//| For ECB mode, the buffers must be 16 bytes long. For CBC mode, the +//| buffers must be a multiple of 16 bytes, and must be equal length. For +//| CTX mode, there are no restrictions.""" //| ... //| STATIC mp_obj_t aesio_aes_decrypt_into(mp_obj_t aesio_obj, mp_obj_t src, diff --git a/shared-bindings/alarm/SleepMemory.c b/shared-bindings/alarm/SleepMemory.c index 7de36f0cec..318f2b772d 100644 --- a/shared-bindings/alarm/SleepMemory.c +++ b/shared-bindings/alarm/SleepMemory.c @@ -31,7 +31,7 @@ #include "py/runtime0.h" #include "shared-bindings/alarm/SleepMemory.h" -#include "supervisor/shared/translate.h" +#include "supervisor/shared/translate/translate.h" //| class SleepMemory: //| """Store raw bytes in RAM that persists during deep sleep. @@ -48,21 +48,19 @@ //| alarm.sleep_memory[0] = True //| alarm.sleep_memory[1] = 12 //| """ +//| //| def __init__(self) -> None: //| """Not used. Access the sole instance through `alarm.sleep_memory`.""" //| ... -//| //| def __bool__(self) -> bool: //| """``sleep_memory`` is ``True`` if its length is greater than zero. //| This is an easy way to check for its existence. //| """ //| ... -//| //| def __len__(self) -> int: //| """Return the length. This is used by (`len`)""" //| ... -//| STATIC mp_obj_t alarm_sleep_memory_unary_op(mp_unary_op_t op, mp_obj_t self_in) { alarm_sleep_memory_obj_t *self = MP_OBJ_TO_PTR(self_in); uint16_t len = common_hal_alarm_sleep_memory_get_length(self); @@ -87,7 +85,6 @@ STATIC MP_DEFINE_CONST_DICT(alarm_sleep_memory_locals_dict, alarm_sleep_memory_l //| def __getitem__(self, index: int) -> int: //| """Returns the value at the given index.""" //| ... -//| //| @overload //| def __setitem__(self, index: slice, value: ReadableBuffer) -> None: ... //| @overload @@ -159,9 +156,8 @@ STATIC mp_obj_t alarm_sleep_memory_subscr(mp_obj_t self_in, mp_obj_t index_in, m } else { // store mp_int_t byte_value = mp_obj_get_int(value); - if (byte_value > 0xff || byte_value < 0) { - mp_raise_ValueError(translate("Bytes must be between 0 and 255.")); - } + mp_arg_validate_int_range(byte_value, 0, 255, MP_QSTR_bytes); + uint8_t short_value = byte_value; if (!common_hal_alarm_sleep_memory_set_bytes(self, index, &short_value, 1)) { mp_raise_RuntimeError(translate("Unable to write to sleep_memory.")); diff --git a/shared-bindings/alarm/__init__.c b/shared-bindings/alarm/__init__.c index 7fd14b7641..2682d64e5b 100644 --- a/shared-bindings/alarm/__init__.c +++ b/shared-bindings/alarm/__init__.c @@ -32,6 +32,7 @@ #include "shared-bindings/alarm/pin/PinAlarm.h" #include "shared-bindings/alarm/time/TimeAlarm.h" #include "shared-bindings/alarm/touch/TouchAlarm.h" +#include "shared-bindings/digitalio/DigitalInOut.h" #include "shared-bindings/supervisor/Runtime.h" #include "shared-bindings/time/__init__.h" #include "supervisor/shared/workflow.h" @@ -63,13 +64,11 @@ //| sleep_memory: SleepMemory //| """Memory that persists during deep sleep. //| This object is the sole instance of `alarm.SleepMemory`.""" -//| //| wake_alarm: Optional[circuitpython_typing.Alarm] //| """The most recently triggered alarm. If CircuitPython was sleeping, the alarm that woke it from sleep. //| If no alarm occured since the last hard reset or soft restart, value is ``None``. //| """ -//| // wake_alarm is implemented as a dictionary entry, so there's no code here. @@ -80,11 +79,13 @@ STATIC void validate_objs_are_alarms(size_t n_args, const mp_obj_t *objs) { mp_obj_is_type(objs[i], &alarm_touch_touchalarm_type)) { continue; } - mp_raise_TypeError_varg(translate("Expected an alarm")); + mp_raise_TypeError_varg(translate("Expected an %q"), MP_QSTR_Alarm); } } -//| def light_sleep_until_alarms(*alarms: circuitpython_typing.Alarm) -> circuitpython_typing.Alarm: +//| def light_sleep_until_alarms( +//| *alarms: circuitpython_typing.Alarm, +//| ) -> circuitpython_typing.Alarm: //| """Go into a light sleep until awakened one of the alarms. The alarm causing the wake-up //| is returned, and is also available as `alarm.wake_alarm`. //| @@ -112,7 +113,9 @@ STATIC mp_obj_t alarm_light_sleep_until_alarms(size_t n_args, const mp_obj_t *ar } MP_DEFINE_CONST_FUN_OBJ_VAR_BETWEEN(alarm_light_sleep_until_alarms_obj, 1, MP_OBJ_FUN_ARGS_MAX, alarm_light_sleep_until_alarms); -//| def exit_and_deep_sleep_until_alarms(*alarms: circuitpython_typing.Alarm) -> None: +//| def exit_and_deep_sleep_until_alarms( +//| *alarms: circuitpython_typing.Alarm, preserve_dios: Sequence[digitalio.DigitalInOut] = () +//| ) -> None: //| """Exit the program and go into a deep sleep, until awakened by one of the alarms. //| This function does not return. //| @@ -126,6 +129,28 @@ MP_DEFINE_CONST_FUN_OBJ_VAR_BETWEEN(alarm_light_sleep_until_alarms_obj, 1, MP_OB //| //| If no alarms are specified, the microcontroller will deep sleep until reset. //| +//| :param circuitpython_typing.Alarm alarms: the alarms that can wake the microcontroller. +//| :param Sequence[digitalio.DigitalInOut] preserve_dios: A sequence of `DigitalInOut` objects +//| whose state should be preserved during deep sleep. +//| If a `DigitalInOut` in the sequence is set to be an output, +//| its current `DigitalInOut.value` (``True`` or ``False``) +//| will be preserved during the deep sleep. +//| If a `DigitalInOut` in the sequence is set to be an input, +//| its current `DigitalInOut.pull` value (``DOWN``, ``UP``, or ``None``) +//| will be preserved during deep sleep. +//| +//| Preserving `DigitalInOut` states during deep sleep can be used to ensure that +//| external or on-board devices are powered or unpowered during sleep, among other purposes. +//| +//| On some microcontrollers, some pins cannot remain in their original state for hardware reasons. +//| +//| .. note:: +//| On Espressif chips, preserving pin settings during deep sleep may consume extra current. +//| On ESP32, this was measured to be 250 uA or more. +//| Consider not preserving pins unless you need to. +//| Measure power consumption carefully both with no pins preserved and with the pins you might want to +//| preserve to achieve the lowest consumption. +//| //| **If CircuitPython is connected to a host computer via USB or BLE //| the first time a deep sleep is requested, //| the connection will be maintained and the system will not go into deep sleep.** @@ -136,28 +161,50 @@ MP_DEFINE_CONST_FUN_OBJ_VAR_BETWEEN(alarm_light_sleep_until_alarms_obj, 1, MP_OB //| the next deep sleep will still be a true deep sleep. You must do a hard reset //| or power-cycle to exit a true deep sleep loop. //| -//| Here is skeletal example that deep-sleeps and restarts every 60 seconds: +//| Here is a skeletal example: //| //| .. code-block:: python //| //| import alarm //| import time +//| import board //| //| print("Waking up") //| -//| # Set an alarm for 60 seconds from now. +//| # Create an alarm for 60 seconds from now, and also a pin alarm. //| time_alarm = alarm.time.TimeAlarm(monotonic_time=time.monotonic() + 60) +//| pin_alarm = alarm.pin.PinAlarm(board.D7, False) //| -//| # Deep sleep until the alarm goes off. Then restart the program. -//| alarm.exit_and_deep_sleep_until_alarms(time_alarm) +//| # Deep sleep until one of the alarm goes off. Then restart the program. +//| alarm.exit_and_deep_sleep_until_alarms(time_alarm, pin_alarm) //| """ //| ... //| -STATIC mp_obj_t alarm_exit_and_deep_sleep_until_alarms(size_t n_args, const mp_obj_t *args) { - validate_objs_are_alarms(n_args, args); +STATIC mp_obj_t alarm_exit_and_deep_sleep_until_alarms(size_t n_args, const mp_obj_t *pos_args, mp_map_t *kw_args) { + enum { ARG_preserve_dios }; + static const mp_arg_t allowed_args[] = { + { MP_QSTR_preserve_dios, MP_ARG_KW_ONLY | MP_ARG_OBJ, {.u_obj = mp_const_empty_tuple} }, + }; - // Validate the alarms and set them. - common_hal_alarm_set_deep_sleep_alarms(n_args, args); + // args will contain only the value for preserve_dios. The *alarms args are in pos_args. + mp_arg_val_t args[MP_ARRAY_SIZE(allowed_args)]; + mp_arg_parse_all(0, pos_args, kw_args, MP_ARRAY_SIZE(allowed_args), allowed_args, args); + + validate_objs_are_alarms(n_args, pos_args); + + mp_obj_t preserve_dios = args[ARG_preserve_dios].u_obj; + const size_t num_dios = (size_t)MP_OBJ_SMALL_INT_VALUE(mp_obj_len(preserve_dios)); + digitalio_digitalinout_obj_t *dios_array[num_dios]; + + for (mp_uint_t i = 0; i < num_dios; i++) { + mp_obj_t dio = mp_obj_subscr(preserve_dios, MP_OBJ_NEW_SMALL_INT(i), MP_OBJ_SENTINEL); + if (!mp_obj_is_type(dio, &digitalio_digitalinout_type)) { + mp_raise_TypeError_varg(translate("Expected a %q"), MP_QSTR_DigitalInOut); + } + dios_array[i] = MP_OBJ_TO_PTR(dio); + } + + common_hal_alarm_set_deep_sleep_alarms(n_args, pos_args, num_dios, dios_array); // Raise an exception, which will be processed in main.c. mp_raise_type_arg(&mp_type_DeepSleepRequest, NULL); @@ -165,7 +212,7 @@ STATIC mp_obj_t alarm_exit_and_deep_sleep_until_alarms(size_t n_args, const mp_o // Doesn't get here. return mp_const_none; } -MP_DEFINE_CONST_FUN_OBJ_VAR_BETWEEN(alarm_exit_and_deep_sleep_until_alarms_obj, 1, MP_OBJ_FUN_ARGS_MAX, alarm_exit_and_deep_sleep_until_alarms); +MP_DEFINE_CONST_FUN_OBJ_KW(alarm_exit_and_deep_sleep_until_alarms_obj, 0, alarm_exit_and_deep_sleep_until_alarms); STATIC const mp_map_elem_t alarm_pin_globals_table[] = { { MP_ROM_QSTR(MP_QSTR___name__), MP_ROM_QSTR(MP_QSTR_pin) }, diff --git a/shared-bindings/alarm/__init__.h b/shared-bindings/alarm/__init__.h index eb67917dce..ea86e44f2f 100644 --- a/shared-bindings/alarm/__init__.h +++ b/shared-bindings/alarm/__init__.h @@ -30,6 +30,7 @@ #include "py/obj.h" #include "common-hal/alarm/__init__.h" +#include "common-hal/digitalio/DigitalInOut.h" // Light sleep fully self-contained and does not exit user code. It will return // the same alarm object that was orignally passed in, unlike deep sleep, which @@ -42,7 +43,7 @@ extern mp_obj_t common_hal_alarm_light_sleep_until_alarms(size_t n_alarms, const // supervisor will idle using `port_wait_for_interrupt`. After each call, it will // call alarm_woken_from_sleep to see if we've been woken by an alarm and if so, // it will exit idle as if deep sleep was exited -extern void common_hal_alarm_set_deep_sleep_alarms(size_t n_alarms, const mp_obj_t *alarms); +extern void common_hal_alarm_set_deep_sleep_alarms(size_t n_alarms, const mp_obj_t *alarms, size_t n_dios, digitalio_digitalinout_obj_t **preserve_dios); extern NORETURN void common_hal_alarm_enter_deep_sleep(void); diff --git a/shared-bindings/alarm/pin/PinAlarm.c b/shared-bindings/alarm/pin/PinAlarm.c index ff34716786..6e8bc5341e 100644 --- a/shared-bindings/alarm/pin/PinAlarm.c +++ b/shared-bindings/alarm/pin/PinAlarm.c @@ -33,12 +33,14 @@ #include "py/obj.h" #include "py/objproperty.h" #include "py/runtime.h" -#include "supervisor/shared/translate.h" +#include "supervisor/shared/translate/translate.h" //| class PinAlarm: //| """Trigger an alarm when a pin changes state.""" //| -//| def __init__(self, pin: microcontroller.Pin, value: bool, edge: bool = False, pull: bool = False) -> None: +//| def __init__( +//| self, pin: microcontroller.Pin, value: bool, edge: bool = False, pull: bool = False +//| ) -> None: //| """Create an alarm triggered by a `microcontroller.Pin` level. The alarm is not active //| until it is passed to an `alarm`-enabling function, such as `alarm.light_sleep_until_alarms()` or //| `alarm.exit_and_deep_sleep_until_alarms()`. @@ -59,7 +61,6 @@ //| pulls it high. //| """ //| ... -//| STATIC mp_obj_t alarm_pin_pinalarm_make_new(const mp_obj_type_t *type, mp_uint_t n_args, size_t n_kw, const mp_obj_t *all_args) { alarm_pin_pinalarm_obj_t *self = m_new_obj(alarm_pin_pinalarm_obj_t); self->base.type = &alarm_pin_pinalarm_type; @@ -86,7 +87,6 @@ STATIC mp_obj_t alarm_pin_pinalarm_make_new(const mp_obj_type_t *type, mp_uint_t //| pin: microcontroller.Pin //| """The trigger pin.""" -//| STATIC mp_obj_t alarm_pin_pinalarm_obj_get_pin(mp_obj_t self_in) { alarm_pin_pinalarm_obj_t *self = MP_OBJ_TO_PTR(self_in); const mcu_pin_obj_t *pin = common_hal_alarm_pin_pinalarm_get_pin(self); diff --git a/shared-bindings/alarm/time/TimeAlarm.c b/shared-bindings/alarm/time/TimeAlarm.c index ab0274afa9..7bd0a309b9 100644 --- a/shared-bindings/alarm/time/TimeAlarm.c +++ b/shared-bindings/alarm/time/TimeAlarm.c @@ -33,7 +33,7 @@ #include "shared-bindings/rtc/__init__.h" #include "shared-bindings/time/__init__.h" -#include "supervisor/shared/translate.h" +#include "supervisor/shared/translate/translate.h" #if MICROPY_LONGINT_IMPL != MICROPY_LONGINT_IMPL_NONE mp_obj_t MP_WEAK rtc_get_time_source_time(void) { @@ -44,7 +44,9 @@ mp_obj_t MP_WEAK rtc_get_time_source_time(void) { //| class TimeAlarm: //| """Trigger an alarm when the specified time is reached.""" //| -//| def __init__(self, monotonic_time: Optional[float] = None, epoch_time: Optional[int] = None) -> None: +//| def __init__( +//| self, monotonic_time: Optional[float] = None, epoch_time: Optional[int] = None +//| ) -> None: //| """Create an alarm that will be triggered when `time.monotonic()` would equal //| ``monotonic_time``, or when `time.time()` would equal ``epoch_time``. //| Only one of the two arguments can be given. @@ -56,7 +58,6 @@ mp_obj_t MP_WEAK rtc_get_time_source_time(void) { //| immediately. //| """ //| ... -//| STATIC mp_obj_t alarm_time_timealarm_make_new(const mp_obj_type_t *type, size_t n_args, size_t n_kw, const mp_obj_t *all_args) { alarm_time_timealarm_obj_t *self = m_new_obj(alarm_time_timealarm_obj_t); diff --git a/shared-bindings/alarm/touch/TouchAlarm.c b/shared-bindings/alarm/touch/TouchAlarm.c index ce5074f7c0..03f9ea4757 100644 --- a/shared-bindings/alarm/touch/TouchAlarm.c +++ b/shared-bindings/alarm/touch/TouchAlarm.c @@ -41,7 +41,6 @@ //| may be limited due to hardware restrictions, particularly for deep-sleep alarms. //| """ //| ... -//| STATIC mp_obj_t alarm_touch_touchalarm_make_new(const mp_obj_type_t *type, size_t n_args, size_t n_kw, const mp_obj_t *all_args) { alarm_touch_touchalarm_obj_t *self = m_new_obj(alarm_touch_touchalarm_obj_t); diff --git a/shared-bindings/analogbufio/BufferedIn.c b/shared-bindings/analogbufio/BufferedIn.c new file mode 100644 index 0000000000..8bdc1b0ea8 --- /dev/null +++ b/shared-bindings/analogbufio/BufferedIn.c @@ -0,0 +1,183 @@ +/* + * This file is part of the Micro Python project, http://micropython.org/ + * + * The MIT License (MIT) + * + * SPDX-FileCopyrightText: Copyright (c) 2022 Lee Atkinson, MeanStride Technology, Inc. + * + * TODO: Based on analogio/AnalogIn.c from Scott Shaw + * + * Permission is hereby granted, free of charge, to any person obtaining a copy + * of this software and associated documentation files (the "Software"), to deal + * in the Software without restriction, including without limitation the rights + * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell + * copies of the Software, and to permit persons to whom the Software is + * furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice shall be included in + * all copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE + * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER + * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, + * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN + * THE SOFTWARE. + */ + +#include +#include "shared/runtime/context_manager_helpers.h" +#include "py/binary.h" +#include "py/mphal.h" +#include "py/nlr.h" +#include "py/objproperty.h" +#include "py/runtime.h" +#include "shared-bindings/microcontroller/Pin.h" +#include "shared-bindings/analogbufio/BufferedIn.h" +#include "shared-bindings/util.h" + +//| class BufferedIn: +//| """Capture multiple analog voltage levels to the supplied buffer +//| +//| Usage:: +//| +//| import board +//| import analogbufio +//| import array +//| +//| length = 1000 +//| mybuffer = array.array("H", 0x0000 for i in range(length)) +//| rate = 500000 +//| adcbuf = analogbufio.BufferedIn(board.GP26, mybuffer, rate) +//| adcbuf.read() +//| adcbuf.deinit() +//| for i in range(length): +//| print(i, mybuffer[i]) +//| +//| (TODO) The reference voltage varies by platform so use +//| ``reference_voltage`` to read the configured setting. +//| (TODO) Provide mechanism to read CPU Temperature.""" +//| + +//| def __init__( +//| self, pin: microcontroller.Pin, buffer: WriteableBuffer, *, sample_rate: int = 500000 +//| ) -> None: +//| """Create a `BufferedIn` on the given pin. ADC values will be read +//| into the given buffer at the supplied sample_rate. Depending on the +//| buffer typecode, 'b', 'B', 'h', 'H', samples are 8-bit byte-arrays or +//| 16-bit half-words and are signed or unsigned. +//| The ADC most significant bits of the ADC are kept. (See +//| https://docs.circuitpython.org/en/latest/docs/library/array.html) +//| +//| :param ~microcontroller.Pin pin: the pin to read from +//| :param ~circuitpython_typing.WriteableBuffer buffer: buffer: A buffer for samples +//| :param ~int sample_rate: rate: sampling frequency, in samples per second""" +//| ... +STATIC mp_obj_t analogbufio_bufferedin_make_new(const mp_obj_type_t *type, size_t n_args, size_t n_kw, const mp_obj_t *all_args) { + enum { ARG_pin, ARG_buffer, ARG_sample_rate }; + static const mp_arg_t allowed_args[] = { + { MP_QSTR_pin, MP_ARG_OBJ | MP_ARG_REQUIRED }, + { MP_QSTR_buffer, MP_ARG_OBJ | MP_ARG_REQUIRED }, + { MP_QSTR_sample_rate, MP_ARG_KW_ONLY | MP_ARG_INT, {.u_int = 500000} }, + }; + mp_arg_val_t args[MP_ARRAY_SIZE(allowed_args)]; + mp_arg_parse_all_kw_array(n_args, n_kw, all_args, MP_ARRAY_SIZE(allowed_args), allowed_args, args); + + // Validate Pin + const mcu_pin_obj_t *pin = validate_obj_is_free_pin(args[ARG_pin].u_obj); + + // Buffer defined and allocated by user + mp_buffer_info_t bufinfo; + mp_get_buffer_raise(args[ARG_buffer].u_obj, &bufinfo, MP_BUFFER_READ); + + // signed or unsigned, byte per sample + bool signed_samples = bufinfo.typecode == 'b' || bufinfo.typecode == 'h'; + uint8_t bytes_per_sample = 1; + + // Bytes Per Sample + if (bufinfo.typecode == 'h' || bufinfo.typecode == 'H') { + bytes_per_sample = 2; + } else if (bufinfo.typecode != 'b' && bufinfo.typecode != 'B' && bufinfo.typecode != BYTEARRAY_TYPECODE) { + mp_raise_ValueError_varg(translate("%q must be a bytearray or array of type 'h', 'H', 'b', or 'B'"), MP_QSTR_buffer); + } + + // Validate sample rate here + uint32_t sample_rate = (uint32_t)mp_arg_validate_int_range(args[ARG_sample_rate].u_int, 1, 500000, MP_QSTR_sample_rate); + + // Create local object + analogbufio_bufferedin_obj_t *self = m_new_obj(analogbufio_bufferedin_obj_t); + self->base.type = &analogbufio_bufferedin_type; + + // Call local intereface in ports/common-hal/analogbufio + common_hal_analogbufio_bufferedin_construct(self, + pin, + ((uint8_t *)bufinfo.buf), + bufinfo.len, + bytes_per_sample, + signed_samples, + sample_rate + ); + + return MP_OBJ_FROM_PTR(self); +} + +//| def deinit(self) -> None: +//| """Shut down the `BufferedIn` and release the pin for other use.""" +//| ... +STATIC mp_obj_t analogbufio_bufferedin_deinit(mp_obj_t self_in) { + analogbufio_bufferedin_obj_t *self = MP_OBJ_TO_PTR(self_in); + common_hal_analogbufio_bufferedin_deinit(self); + return mp_const_none; +} +MP_DEFINE_CONST_FUN_OBJ_1(analogbufio_bufferedin_deinit_obj, analogbufio_bufferedin_deinit); + +STATIC void check_for_deinit(analogbufio_bufferedin_obj_t *self) { + if (common_hal_analogbufio_bufferedin_deinited(self)) { + raise_deinited_error(); + } +} +//| def __enter__(self) -> BufferedIn: +//| """No-op used by Context Managers.""" +//| ... +// Provided by context manager helper. + +//| def __exit__(self) -> None: +//| """Automatically deinitializes the hardware when exiting a context. See +//| :ref:`lifetime-and-contextmanagers` for more info.""" +//| ... +STATIC mp_obj_t analogbufio_bufferedin___exit__(size_t n_args, const mp_obj_t *args) { + (void)n_args; + common_hal_analogbufio_bufferedin_deinit(args[0]); + return mp_const_none; +} +STATIC MP_DEFINE_CONST_FUN_OBJ_VAR_BETWEEN(analogbufio_bufferedin___exit___obj, 4, 4, analogbufio_bufferedin___exit__); + +//| def read(self) -> None: +//| """Fills the provided buffer with ADC voltage values.""" +//| ... +//| +STATIC mp_obj_t analogbufio_bufferedin_obj_read(mp_obj_t self_in) { + analogbufio_bufferedin_obj_t *self = MP_OBJ_TO_PTR(self_in); + check_for_deinit(self); + common_hal_analogbufio_bufferedin_read(self); + return mp_const_none; +} +MP_DEFINE_CONST_FUN_OBJ_1(analogbufio_bufferedin_read_obj, analogbufio_bufferedin_obj_read); + +STATIC const mp_rom_map_elem_t analogbufio_bufferedin_locals_dict_table[] = { + { MP_ROM_QSTR(MP_QSTR_deinit), MP_ROM_PTR(&analogbufio_bufferedin_deinit_obj) }, + { MP_ROM_QSTR(MP_QSTR___enter__), MP_ROM_PTR(&default___enter___obj) }, + { MP_ROM_QSTR(MP_QSTR___exit__), MP_ROM_PTR(&analogbufio_bufferedin___exit___obj) }, + { MP_ROM_QSTR(MP_QSTR_read), MP_ROM_PTR(&analogbufio_bufferedin_read_obj)}, + +}; + +STATIC MP_DEFINE_CONST_DICT(analogbufio_bufferedin_locals_dict, analogbufio_bufferedin_locals_dict_table); + +const mp_obj_type_t analogbufio_bufferedin_type = { + { &mp_type_type }, + .name = MP_QSTR_BufferedIn, + .make_new = analogbufio_bufferedin_make_new, + .locals_dict = (mp_obj_t)&analogbufio_bufferedin_locals_dict, +}; diff --git a/shared-bindings/analogbufio/BufferedIn.h b/shared-bindings/analogbufio/BufferedIn.h new file mode 100644 index 0000000000..7d59720cb4 --- /dev/null +++ b/shared-bindings/analogbufio/BufferedIn.h @@ -0,0 +1,40 @@ +/* + * This file is part of the Micro Python project, http://micropython.org/ + * + * The MIT License (MIT) + * + * SPDX-FileCopyrightText: Copyright (c) 2022 Lee Atkinson, MeanStride Technology, Inc. + * + * 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_SHARED_BINDINGS_ANALOGBUFIO_BUFFEREDIN_H +#define MICROPY_INCLUDED_SHARED_BINDINGS_ANALOGBUFIO_BUFFEREDIN_H + +#include "common-hal/microcontroller/Pin.h" +#include "common-hal/analogbufio/BufferedIn.h" + +extern const mp_obj_type_t analogbufio_bufferedin_type; + +void common_hal_analogbufio_bufferedin_construct(analogbufio_bufferedin_obj_t *self, const mcu_pin_obj_t *pin, uint8_t *buffer, uint32_t len, uint8_t bytes_per_sample, bool samples_signed, uint32_t sample_rate); +void common_hal_analogbufio_bufferedin_deinit(analogbufio_bufferedin_obj_t *self); +bool common_hal_analogbufio_bufferedin_deinited(analogbufio_bufferedin_obj_t *self); +void common_hal_analogbufio_bufferedin_read(analogbufio_bufferedin_obj_t *self); + +#endif // __MICROPY_INCLUDED_SHARED_BINDINGS_ANALOGBUFIO_BUFFEREDIN_H__ diff --git a/shared-bindings/analogbufio/__init__.c b/shared-bindings/analogbufio/__init__.c new file mode 100644 index 0000000000..49463d6334 --- /dev/null +++ b/shared-bindings/analogbufio/__init__.c @@ -0,0 +1,78 @@ +/* + * This file is part of the MicroPython project, http://micropython.org/ + * + * The MIT License (MIT) + * + * SPDX-FileCopyrightText: Copyright (c) 2022 Lee Atkinson, MeanStride Technology, Inc. + * + * Permission is hereby granted, free of charge, to any person obtaining a copy + * of this software and associated documentation files (the "Software"), to deal + * in the Software without restriction, including without limitation the rights + * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell + * copies of the Software, and to permit persons to whom the Software is + * furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice shall be included in + * all copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE + * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER + * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, + * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN + * THE SOFTWARE. + */ +#include +#include "py/obj.h" +#include "py/runtime.h" +#include "shared-bindings/microcontroller/Pin.h" +#include "shared-bindings/analogbufio/__init__.h" +#include "shared-bindings/analogbufio/BufferedIn.h" + +//| """Analog Buffered IO Hardware Support +//| +//| The `analogbufio` module contains classes to provide access to analog-to-digital +//| conversion and digital-to-analog (DAC) for multiple value transfer. +//| +//| All classes change hardware state and should be deinitialized when they +//| are no longer needed if the program continues after use. To do so, either +//| call :py:meth:`!deinit` or use a context manager. See +//| :ref:`lifetime-and-contextmanagers` for more info. +//| +//| For example:: +//| +//| import analogbufio +//| import array +//| from board import * +//| +//| length = 5000000 +//| mybuffer = array.array("H", 0x0000 for i in range(length)) +//| adc_in = analogbufio.BufferedIn(GP26, mybuffer, length) +//| analogbufio.read() +//| print(*mybuffer) +//| adc_in.deinit() +//| +//| This example will initialize the the device, read and fill +//| :py:data:`~analogbufio.BufferedIn` to mybuffer +//| +//| TODO: For the essentials of `analogbufio`, see the `CircuitPython Essentials +//| Learn guide `_ +//| +//| TODO: For more information on using `analogbufio`, see `this additional Learn guide +//| `_ +//| """ + +STATIC const mp_rom_map_elem_t analogbufio_module_globals_table[] = { + { MP_ROM_QSTR(MP_QSTR___name__), MP_ROM_QSTR(MP_QSTR_analogbufio) }, + { MP_ROM_QSTR(MP_QSTR_BufferedIn), MP_ROM_PTR(&analogbufio_bufferedin_type) }, +}; + +STATIC MP_DEFINE_CONST_DICT(analogbufio_module_globals, analogbufio_module_globals_table); + +const mp_obj_module_t analogbufio_module = { + .base = { &mp_type_module }, + .globals = (mp_obj_dict_t *)&analogbufio_module_globals, +}; + +MP_REGISTER_MODULE(MP_QSTR_analogbufio, analogbufio_module, CIRCUITPY_ANALOGBUFIO); diff --git a/shared-bindings/analogbufio/__init__.h b/shared-bindings/analogbufio/__init__.h new file mode 100644 index 0000000000..d66dd4e8d6 --- /dev/null +++ b/shared-bindings/analogbufio/__init__.h @@ -0,0 +1,34 @@ +/* + * This file is part of the MicroPython project, http://micropython.org/ + * + * The MIT License (MIT) + * + * SPDX-FileCopyrightText: Copyright (c) 2022 Lee Atkinson, MeanStride Technology, Inc. + * + * 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_SHARED_BINDINGS_ANALOGBUFIO___INIT___H +#define MICROPY_INCLUDED_SHARED_BINDINGS_ANALOGBUFIO___INIT___H + +#include "py/obj.h" + +// Nothing now. + +#endif // MICROPY_INCLUDED_SHARED_BINDINGS_ANALOGBUFIO___INIT___H diff --git a/shared-bindings/analogio/AnalogIn.c b/shared-bindings/analogio/AnalogIn.c index f2c888f727..0ca0e09023 100644 --- a/shared-bindings/analogio/AnalogIn.c +++ b/shared-bindings/analogio/AnalogIn.c @@ -54,7 +54,6 @@ //| //| :param ~microcontroller.Pin pin: the pin to read from""" //| ... -//| STATIC mp_obj_t analogio_analogin_make_new(const mp_obj_type_t *type, mp_uint_t n_args, size_t n_kw, const mp_obj_t *args) { // check number of arguments @@ -73,7 +72,6 @@ STATIC mp_obj_t analogio_analogin_make_new(const mp_obj_type_t *type, //| def deinit(self) -> None: //| """Turn off the AnalogIn and release the pin for other use.""" //| ... -//| STATIC mp_obj_t analogio_analogin_deinit(mp_obj_t self_in) { analogio_analogin_obj_t *self = MP_OBJ_TO_PTR(self_in); common_hal_analogio_analogin_deinit(self); @@ -89,14 +87,12 @@ STATIC void check_for_deinit(analogio_analogin_obj_t *self) { //| def __enter__(self) -> AnalogIn: //| """No-op used by Context Managers.""" //| ... -//| // Provided by context manager helper. //| def __exit__(self) -> None: //| """Automatically deinitializes the hardware when exiting a context. See //| :ref:`lifetime-and-contextmanagers` for more info.""" //| ... -//| STATIC mp_obj_t analogio_analogin___exit__(size_t n_args, const mp_obj_t *args) { (void)n_args; common_hal_analogio_analogin_deinit(args[0]); @@ -109,7 +105,6 @@ STATIC MP_DEFINE_CONST_FUN_OBJ_VAR_BETWEEN(analogio_analogin___exit___obj, 4, 4, //| //| Even if the underlying analog to digital converter (ADC) is lower //| resolution, the value is 16-bit.""" -//| STATIC mp_obj_t analogio_analogin_obj_get_value(mp_obj_t self_in) { analogio_analogin_obj_t *self = MP_OBJ_TO_PTR(self_in); check_for_deinit(self); @@ -122,7 +117,7 @@ MP_PROPERTY_GETTER(analogio_analogin_value_obj, //| reference_voltage: float //| """The maximum voltage measurable (also known as the reference voltage) as a -//| `float` in Volts. Note the ADC value may not scale to the actual voltage linearly +//| ``float`` in Volts. Note the ADC value may not scale to the actual voltage linearly //| at ends of the analog range.""" //| STATIC mp_obj_t analogio_analogin_obj_get_reference_voltage(mp_obj_t self_in) { diff --git a/shared-bindings/analogio/AnalogOut.c b/shared-bindings/analogio/AnalogOut.c index 31173f8890..fa33944164 100644 --- a/shared-bindings/analogio/AnalogOut.c +++ b/shared-bindings/analogio/AnalogOut.c @@ -34,7 +34,7 @@ #include "shared-bindings/microcontroller/Pin.h" #include "shared-bindings/analogio/AnalogOut.h" #include "shared-bindings/util.h" -#include "supervisor/shared/translate.h" +#include "supervisor/shared/translate/translate.h" //| class AnalogOut: //| """Output analog values (a specific voltage). @@ -52,7 +52,6 @@ //| //| :param ~microcontroller.Pin pin: the pin to output to""" //| ... -//| STATIC mp_obj_t analogio_analogout_make_new(const mp_obj_type_t *type, mp_uint_t n_args, size_t n_kw, const mp_obj_t *args) { // check arguments mp_arg_check_num(n_args, n_kw, 1, 1, false); @@ -69,7 +68,6 @@ STATIC mp_obj_t analogio_analogout_make_new(const mp_obj_type_t *type, mp_uint_t //| def deinit(self) -> None: //| """Turn off the AnalogOut and release the pin for other use.""" //| ... -//| STATIC mp_obj_t analogio_analogout_deinit(mp_obj_t self_in) { analogio_analogout_obj_t *self = self_in; @@ -82,14 +80,12 @@ STATIC MP_DEFINE_CONST_FUN_OBJ_1(analogio_analogout_deinit_obj, analogio_analogo //| def __enter__(self) -> AnalogOut: //| """No-op used by Context Managers.""" //| ... -//| // Provided by context manager helper. //| def __exit__(self) -> None: //| """Automatically deinitializes the hardware when exiting a context. See //| :ref:`lifetime-and-contextmanagers` for more info.""" //| ... -//| STATIC mp_obj_t analogio_analogout___exit__(size_t n_args, const mp_obj_t *args) { (void)n_args; common_hal_analogio_analogout_deinit(args[0]); @@ -108,10 +104,8 @@ STATIC mp_obj_t analogio_analogout_obj_set_value(mp_obj_t self_in, mp_obj_t valu if (common_hal_analogio_analogout_deinited(self)) { raise_deinited_error(); } - uint32_t v = mp_obj_get_int(value); - if (v >= (1 << 16)) { - mp_raise_ValueError(translate("AnalogOut is only 16 bits. Value must be less than 65536.")); - } + uint16_t v = mp_arg_validate_int_range(mp_obj_get_int(value), 0, 65535, MP_QSTR_value); + common_hal_analogio_analogout_set_value(self, v); return mp_const_none; } diff --git a/shared-bindings/analogio/__init__.c b/shared-bindings/analogio/__init__.c index eb956d0eb7..2e7ccf7115 100644 --- a/shared-bindings/analogio/__init__.c +++ b/shared-bindings/analogio/__init__.c @@ -65,7 +65,6 @@ //| For more information on using `analogio`, see `this additional Learn guide //| `_ //| """ -//| STATIC const mp_rom_map_elem_t analogio_module_globals_table[] = { { MP_ROM_QSTR(MP_QSTR___name__), MP_ROM_QSTR(MP_QSTR_analogio) }, diff --git a/shared-bindings/atexit/__init__.c b/shared-bindings/atexit/__init__.c index dd27adaa98..914cac582b 100644 --- a/shared-bindings/atexit/__init__.c +++ b/shared-bindings/atexit/__init__.c @@ -37,22 +37,23 @@ //| |see_cpython_module| :mod:`cpython:atexit`. //| """ //| ... -//| -//| def register(func: Callable[..., Any], *args: Optional[Any], **kwargs: Optional[Any]) -> Callable[..., Any]: +//| def register( +//| func: Callable[..., Any], *args: Optional[Any], **kwargs: Optional[Any] +//| ) -> Callable[..., Any]: //| //| """Register func as a function to be executed at termination. //| -//| Any optional arguments that are to be passed to func must be passed as arguments to `register()`. -//| It is possible to register the same function and arguments more than once. +//| Any optional arguments that are to be passed to func must be passed as arguments to `register()`. +//| It is possible to register the same function and arguments more than once. //| -//| At normal program termination (for instance, if `sys.exit()` is called or the vm execution completes), -//| all functions registered are called in last in, first out order. +//| At normal program termination (for instance, if `sys.exit()` is called or the vm execution completes), +//| all functions registered are called in last in, first out order. //| -//| If an exception is raised during execution of the exit handler, -//| a traceback is printed (unless `SystemExit` is raised) and the execution stops. +//| If an exception is raised during execution of the exit handler, +//| a traceback is printed (unless `SystemExit` is raised) and the execution stops. //| -//| This function returns func, which makes it possible to use it as a decorator. +//| This function returns func, which makes it possible to use it as a decorator. //| //| """ //| ... @@ -67,8 +68,8 @@ STATIC MP_DEFINE_CONST_FUN_OBJ_KW(atexit_register_obj, 1, atexit_register); //| //| """Remove func from the list of functions to be run at termination. //| -//| `unregister()` silently does nothing if func was not previously registered. If func has been registered more than once, -//| every occurrence of that function in the atexit call stack will be removed. +//| `unregister()` silently does nothing if func was not previously registered. If func has been registered more than once, +//| every occurrence of that function in the atexit call stack will be removed. //| //| """ //| ... diff --git a/shared-bindings/audiobusio/I2SOut.c b/shared-bindings/audiobusio/I2SOut.c index 93c316d374..b570191da9 100644 --- a/shared-bindings/audiobusio/I2SOut.c +++ b/shared-bindings/audiobusio/I2SOut.c @@ -33,12 +33,19 @@ #include "shared-bindings/microcontroller/Pin.h" #include "shared-bindings/audiobusio/I2SOut.h" #include "shared-bindings/util.h" -#include "supervisor/shared/translate.h" +#include "supervisor/shared/translate/translate.h" //| class I2SOut: //| """Output an I2S audio signal""" //| -//| def __init__(self, bit_clock: microcontroller.Pin, word_select: microcontroller.Pin, data: microcontroller.Pin, *, left_justified: bool) -> None: +//| def __init__( +//| self, +//| bit_clock: microcontroller.Pin, +//| word_select: microcontroller.Pin, +//| data: microcontroller.Pin, +//| *, +//| left_justified: bool +//| ) -> None: //| """Create a I2SOut object associated with the given pins. //| //| :param ~microcontroller.Pin bit_clock: The bit clock (or serial clock) pin @@ -88,7 +95,6 @@ //| pass //| print("stopped")""" //| ... -//| STATIC mp_obj_t audiobusio_i2sout_make_new(const mp_obj_type_t *type, size_t n_args, size_t n_kw, const mp_obj_t *all_args) { #if !CIRCUITPY_AUDIOBUSIO_I2SOUT mp_raise_NotImplementedError(translate("I2SOut not available")); @@ -121,7 +127,6 @@ STATIC mp_obj_t audiobusio_i2sout_make_new(const mp_obj_type_t *type, size_t n_a //| def deinit(self) -> None: //| """Deinitialises the I2SOut and releases any hardware resources for reuse.""" //| ... -//| STATIC mp_obj_t audiobusio_i2sout_deinit(mp_obj_t self_in) { audiobusio_i2sout_obj_t *self = MP_OBJ_TO_PTR(self_in); common_hal_audiobusio_i2sout_deinit(self); @@ -138,14 +143,12 @@ STATIC void check_for_deinit(audiobusio_i2sout_obj_t *self) { //| def __enter__(self) -> I2SOut: //| """No-op used by Context Managers.""" //| ... -//| // Provided by context manager helper. //| def __exit__(self) -> None: //| """Automatically deinitializes the hardware when exiting a context. See //| :ref:`lifetime-and-contextmanagers` for more info.""" //| ... -//| STATIC mp_obj_t audiobusio_i2sout_obj___exit__(size_t n_args, const mp_obj_t *args) { (void)n_args; common_hal_audiobusio_i2sout_deinit(args[0]); @@ -162,7 +165,6 @@ STATIC MP_DEFINE_CONST_FUN_OBJ_VAR_BETWEEN(audiobusio_i2sout___exit___obj, 4, 4, //| //| The sample itself should consist of 8 bit or 16 bit samples.""" //| ... -//| STATIC mp_obj_t audiobusio_i2sout_obj_play(size_t n_args, const mp_obj_t *pos_args, mp_map_t *kw_args) { enum { ARG_sample, ARG_loop }; static const mp_arg_t allowed_args[] = { @@ -184,7 +186,6 @@ MP_DEFINE_CONST_FUN_OBJ_KW(audiobusio_i2sout_play_obj, 1, audiobusio_i2sout_obj_ //| def stop(self) -> None: //| """Stops playback.""" //| ... -//| STATIC mp_obj_t audiobusio_i2sout_obj_stop(mp_obj_t self_in) { audiobusio_i2sout_obj_t *self = MP_OBJ_TO_PTR(self_in); check_for_deinit(self); @@ -195,7 +196,6 @@ MP_DEFINE_CONST_FUN_OBJ_1(audiobusio_i2sout_stop_obj, audiobusio_i2sout_obj_stop //| playing: bool //| """True when the audio sample is being output. (read-only)""" -//| STATIC mp_obj_t audiobusio_i2sout_obj_get_playing(mp_obj_t self_in) { audiobusio_i2sout_obj_t *self = MP_OBJ_TO_PTR(self_in); check_for_deinit(self); @@ -209,7 +209,6 @@ MP_PROPERTY_GETTER(audiobusio_i2sout_playing_obj, //| def pause(self) -> None: //| """Stops playback temporarily while remembering the position. Use `resume` to resume playback.""" //| ... -//| STATIC mp_obj_t audiobusio_i2sout_obj_pause(mp_obj_t self_in) { audiobusio_i2sout_obj_t *self = MP_OBJ_TO_PTR(self_in); check_for_deinit(self); @@ -225,7 +224,6 @@ MP_DEFINE_CONST_FUN_OBJ_1(audiobusio_i2sout_pause_obj, audiobusio_i2sout_obj_pau //| def resume(self) -> None: //| """Resumes sample playback after :py:func:`pause`.""" //| ... -//| STATIC mp_obj_t audiobusio_i2sout_obj_resume(mp_obj_t self_in) { audiobusio_i2sout_obj_t *self = MP_OBJ_TO_PTR(self_in); check_for_deinit(self); diff --git a/shared-bindings/audiobusio/PDMIn.c b/shared-bindings/audiobusio/PDMIn.c index aa810f2930..c44a640d6f 100644 --- a/shared-bindings/audiobusio/PDMIn.c +++ b/shared-bindings/audiobusio/PDMIn.c @@ -34,12 +34,22 @@ #include "shared-bindings/microcontroller/Pin.h" #include "shared-bindings/audiobusio/PDMIn.h" #include "shared-bindings/util.h" -#include "supervisor/shared/translate.h" +#include "supervisor/shared/translate/translate.h" //| class PDMIn: //| """Record an input PDM audio stream""" //| -//| def __init__(self, clock_pin: microcontroller.Pin, data_pin: microcontroller.Pin, *, sample_rate: int = 16000, bit_depth: int = 8, mono: bool = True, oversample: int = 64, startup_delay: float = 0.11) -> None: +//| def __init__( +//| self, +//| clock_pin: microcontroller.Pin, +//| data_pin: microcontroller.Pin, +//| *, +//| sample_rate: int = 16000, +//| bit_depth: int = 8, +//| mono: bool = True, +//| oversample: int = 64, +//| startup_delay: float = 0.11 +//| ) -> None: //| """Create a PDMIn object associated with the given pins. This allows you to //| record audio signals from the given pins. Individual ports may put further //| restrictions on the recording parameters. The overall sample rate is @@ -56,33 +66,31 @@ //| :param float startup_delay: seconds to wait after starting microphone clock //| to allow microphone to turn on. Most require only 0.01s; some require 0.1s. Longer is safer. //| Must be in range 0.0-1.0 seconds.""" -//| -//| """Record 8-bit unsigned samples to buffer:: +//| """Record 8-bit unsigned samples to buffer:: //| -//| import audiobusio -//| import board +//| import audiobusio +//| import board //| -//| # Prep a buffer to record into -//| b = bytearray(200) -//| with audiobusio.PDMIn(board.MICROPHONE_CLOCK, board.MICROPHONE_DATA, sample_rate=16000) as mic: -//| mic.record(b, len(b)) +//| # Prep a buffer to record into +//| b = bytearray(200) +//| with audiobusio.PDMIn(board.MICROPHONE_CLOCK, board.MICROPHONE_DATA, sample_rate=16000) as mic: +//| mic.record(b, len(b)) //| -//| Record 16-bit unsigned samples to buffer:: +//| Record 16-bit unsigned samples to buffer:: //| -//| import audiobusio -//| import board -//| -//| # Prep a buffer to record into. The array interface doesn't allow for -//| # constructing with a set size so we append to it until we have the size -//| # we want. -//| b = array.array("H") -//| for i in range(200): -//| b.append(0) -//| with audiobusio.PDMIn(board.MICROPHONE_CLOCK, board.MICROPHONE_DATA, sample_rate=16000, bit_depth=16) as mic: -//| mic.record(b, len(b))""" -//| ... +//| import audiobusio +//| import board //| +//| # Prep a buffer to record into. The array interface doesn't allow for +//| # constructing with a set size so we append to it until we have the size +//| # we want. +//| b = array.array("H") +//| for i in range(200): +//| b.append(0) +//| with audiobusio.PDMIn(board.MICROPHONE_CLOCK, board.MICROPHONE_DATA, sample_rate=16000, bit_depth=16) as mic: +//| mic.record(b, len(b))""" +//| ... STATIC mp_obj_t audiobusio_pdmin_make_new(const mp_obj_type_t *type, size_t n_args, size_t n_kw, const mp_obj_t *all_args) { #if !CIRCUITPY_AUDIOBUSIO_PDMIN mp_raise_NotImplementedError(translate("PDMIn not available")); @@ -142,7 +150,6 @@ STATIC mp_obj_t audiobusio_pdmin_make_new(const mp_obj_type_t *type, size_t n_ar //| def deinit(self) -> None: //| """Deinitialises the PDMIn and releases any hardware resources for reuse.""" //| ... -//| STATIC mp_obj_t audiobusio_pdmin_deinit(mp_obj_t self_in) { audiobusio_pdmin_obj_t *self = MP_OBJ_TO_PTR(self_in); common_hal_audiobusio_pdmin_deinit(self); @@ -158,13 +165,11 @@ STATIC void check_for_deinit(audiobusio_pdmin_obj_t *self) { //| def __enter__(self) -> PDMIn: //| """No-op used by Context Managers.""" //| ... -//| // Provided by context manager helper. //| def __exit__(self) -> None: //| """Automatically deinitializes the hardware when exiting a context.""" //| ... -//| STATIC mp_obj_t audiobusio_pdmin_obj___exit__(size_t n_args, const mp_obj_t *args) { (void)n_args; common_hal_audiobusio_pdmin_deinit(args[0]); @@ -184,14 +189,11 @@ STATIC MP_DEFINE_CONST_FUN_OBJ_VAR_BETWEEN(audiobusio_pdmin___exit___obj, 4, 4, //| :return: The number of samples recorded. If this is less than ``destination_length``, //| some samples were missed due to processing time.""" //| ... -//| STATIC mp_obj_t audiobusio_pdmin_obj_record(mp_obj_t self_obj, mp_obj_t destination, mp_obj_t destination_length) { audiobusio_pdmin_obj_t *self = MP_OBJ_TO_PTR(self_obj); check_for_deinit(self); - if (!mp_obj_is_small_int(destination_length) || MP_OBJ_SMALL_INT_VALUE(destination_length) < 0) { - mp_raise_TypeError(translate("destination_length must be an int >= 0")); - } - uint32_t length = MP_OBJ_SMALL_INT_VALUE(destination_length); + uint32_t length = mp_arg_validate_type_int(destination_length, MP_QSTR_length); + mp_arg_validate_length_min(length, 0, MP_QSTR_length); mp_buffer_info_t bufinfo; if (mp_obj_is_type(destination, &mp_type_fileio)) { diff --git a/shared-bindings/audiobusio/__init__.c b/shared-bindings/audiobusio/__init__.c index 34ce9ef696..937028ee1f 100644 --- a/shared-bindings/audiobusio/__init__.c +++ b/shared-bindings/audiobusio/__init__.c @@ -44,7 +44,6 @@ //| All classes change hardware state and should be deinitialized when they //| are no longer needed. To do so, either call :py:meth:`!deinit` or use a //| context manager.""" -//| STATIC const mp_rom_map_elem_t audiobusio_module_globals_table[] = { { MP_ROM_QSTR(MP_QSTR___name__), MP_ROM_QSTR(MP_QSTR_audiobusio) }, diff --git a/shared-bindings/audiocore/RawSample.c b/shared-bindings/audiocore/RawSample.c index 82c02450ba..d185476f03 100644 --- a/shared-bindings/audiocore/RawSample.c +++ b/shared-bindings/audiocore/RawSample.c @@ -32,12 +32,14 @@ #include "py/runtime.h" #include "shared-bindings/util.h" #include "shared-bindings/audiocore/RawSample.h" -#include "supervisor/shared/translate.h" +#include "supervisor/shared/translate/translate.h" //| class RawSample: //| """A raw audio sample buffer in memory""" //| -//| def __init__(self, buffer: ReadableBuffer, *, channel_count: int = 1, sample_rate: int = 8000) -> None: +//| def __init__( +//| self, buffer: ReadableBuffer, *, channel_count: int = 1, sample_rate: int = 8000 +//| ) -> None: //| """Create a RawSample based on the given buffer of signed values. If channel_count is more than //| 1 then each channel's samples should alternate. In other words, for a two channel buffer, the //| first sample will be for channel 1, the second sample will be for channel two, the third for @@ -68,7 +70,6 @@ //| time.sleep(1) //| dac.stop()""" //| ... -//| STATIC mp_obj_t audioio_rawsample_make_new(const mp_obj_type_t *type, size_t n_args, size_t n_kw, const mp_obj_t *all_args) { enum { ARG_buffer, ARG_channel_count, ARG_sample_rate }; static const mp_arg_t allowed_args[] = { @@ -88,7 +89,7 @@ STATIC mp_obj_t audioio_rawsample_make_new(const mp_obj_type_t *type, size_t n_a if (bufinfo.typecode == 'h' || bufinfo.typecode == 'H') { bytes_per_sample = 2; } else if (bufinfo.typecode != 'b' && bufinfo.typecode != 'B' && bufinfo.typecode != BYTEARRAY_TYPECODE) { - mp_raise_ValueError(translate("sample_source buffer must be a bytearray or array of type 'h', 'H', 'b' or 'B'")); + mp_raise_ValueError_varg(translate("%q must be a bytearray or array of type 'h', 'H', 'b', or 'B'"), MP_QSTR_buffer); } common_hal_audioio_rawsample_construct(self, ((uint8_t *)bufinfo.buf), bufinfo.len, bytes_per_sample, signed_samples, args[ARG_channel_count].u_int, @@ -100,7 +101,6 @@ STATIC mp_obj_t audioio_rawsample_make_new(const mp_obj_type_t *type, size_t n_a //| def deinit(self) -> None: //| """Deinitialises the RawSample and releases any hardware resources for reuse.""" //| ... -//| STATIC mp_obj_t audioio_rawsample_deinit(mp_obj_t self_in) { audioio_rawsample_obj_t *self = MP_OBJ_TO_PTR(self_in); common_hal_audioio_rawsample_deinit(self); @@ -117,14 +117,12 @@ STATIC void check_for_deinit(audioio_rawsample_obj_t *self) { //| def __enter__(self) -> RawSample: //| """No-op used by Context Managers.""" //| ... -//| // Provided by context manager helper. //| def __exit__(self) -> None: //| """Automatically deinitializes the hardware when exiting a context. See //| :ref:`lifetime-and-contextmanagers` for more info.""" //| ... -//| STATIC mp_obj_t audioio_rawsample_obj___exit__(size_t n_args, const mp_obj_t *args) { (void)n_args; common_hal_audioio_rawsample_deinit(args[0]); diff --git a/shared-bindings/audiocore/WaveFile.c b/shared-bindings/audiocore/WaveFile.c index 285bd7cbbe..36204fa2b2 100644 --- a/shared-bindings/audiocore/WaveFile.c +++ b/shared-bindings/audiocore/WaveFile.c @@ -31,7 +31,7 @@ #include "py/runtime.h" #include "shared-bindings/audiocore/WaveFile.h" #include "shared-bindings/util.h" -#include "supervisor/shared/translate.h" +#include "supervisor/shared/translate/translate.h" //| class WaveFile: //| """Load a wave file for audio playback @@ -40,16 +40,15 @@ //| be 8 bit unsigned or 16 bit signed. If a buffer is provided, it will be used instead of allocating //| an internal buffer, which can prevent memory fragmentation.""" //| -//| def __init__(self, file: typing.BinaryIO, buffer: WriteableBuffer) -> None: +//| def __init__(self, file: Union[str, typing.BinaryIO], buffer: WriteableBuffer) -> None: //| """Load a .wav file for playback with `audioio.AudioOut` or `audiobusio.I2SOut`. //| -//| :param typing.BinaryIO file: Already opened wave file +//| :param Union[str, typing.BinaryIO] file: The name of a wave file (preferred) or an already opened wave file //| :param ~circuitpython_typing.WriteableBuffer buffer: Optional pre-allocated buffer, //| that will be split in half and used for double-buffering of the data. //| The buffer must be 8 to 1024 bytes long. //| If not provided, two 256 byte buffers are initially allocated internally. //| -//| //| Playing a wave file from flash:: //| //| import board @@ -61,23 +60,27 @@ //| speaker_enable = digitalio.DigitalInOut(board.SPEAKER_ENABLE) //| speaker_enable.switch_to_output(value=True) //| -//| data = open("cplay-5.1-16bit-16khz.wav", "rb") -//| wav = audiocore.WaveFile(data) +//| wav = audiocore.WaveFile("cplay-5.1-16bit-16khz.wav") //| a = audioio.AudioOut(board.A0) //| //| print("playing") //| a.play(wav) //| while a.playing: //| pass -//| print("stopped")""" +//| print("stopped") +//| """ //| ... -//| STATIC mp_obj_t audioio_wavefile_make_new(const mp_obj_type_t *type, size_t n_args, size_t n_kw, const mp_obj_t *args) { mp_arg_check_num(n_args, n_kw, 1, 2, false); + mp_obj_t arg = args[0]; + + if (mp_obj_is_str(arg)) { + arg = mp_call_function_2(MP_OBJ_FROM_PTR(&mp_builtin_open_obj), arg, MP_ROM_QSTR(MP_QSTR_rb)); + } audioio_wavefile_obj_t *self = m_new_obj(audioio_wavefile_obj_t); self->base.type = &audioio_wavefile_type; - if (!mp_obj_is_type(args[0], &mp_type_fileio)) { + if (!mp_obj_is_type(arg, &mp_type_fileio)) { mp_raise_TypeError(translate("file must be a file opened in byte mode")); } uint8_t *buffer = NULL; @@ -88,7 +91,7 @@ STATIC mp_obj_t audioio_wavefile_make_new(const mp_obj_type_t *type, size_t n_ar buffer = bufinfo.buf; buffer_size = mp_arg_validate_length_range(bufinfo.len, 8, 1024, MP_QSTR_buffer); } - common_hal_audioio_wavefile_construct(self, MP_OBJ_TO_PTR(args[0]), + common_hal_audioio_wavefile_construct(self, MP_OBJ_TO_PTR(arg), buffer, buffer_size); return MP_OBJ_FROM_PTR(self); @@ -113,14 +116,12 @@ STATIC void check_for_deinit(audioio_wavefile_obj_t *self) { //| def __enter__(self) -> WaveFile: //| """No-op used by Context Managers.""" //| ... -//| // Provided by context manager helper. //| def __exit__(self) -> None: //| """Automatically deinitializes the hardware when exiting a context. See //| :ref:`lifetime-and-contextmanagers` for more info.""" //| ... -//| STATIC mp_obj_t audioio_wavefile_obj___exit__(size_t n_args, const mp_obj_t *args) { (void)n_args; common_hal_audioio_wavefile_deinit(args[0]); @@ -132,7 +133,6 @@ STATIC MP_DEFINE_CONST_FUN_OBJ_VAR_BETWEEN(audioio_wavefile___exit___obj, 4, 4, //| """32 bit value that dictates how quickly samples are loaded into the DAC //| in Hertz (cycles per second). When the sample is looped, this can change //| the pitch output without changing the underlying sample.""" -//| STATIC mp_obj_t audioio_wavefile_obj_get_sample_rate(mp_obj_t self_in) { audioio_wavefile_obj_t *self = MP_OBJ_TO_PTR(self_in); check_for_deinit(self); @@ -154,7 +154,6 @@ MP_PROPERTY_GETSET(audioio_wavefile_sample_rate_obj, //| bits_per_sample: int //| """Bits per sample. (read only)""" -//| STATIC mp_obj_t audioio_wavefile_obj_get_bits_per_sample(mp_obj_t self_in) { audioio_wavefile_obj_t *self = MP_OBJ_TO_PTR(self_in); check_for_deinit(self); diff --git a/shared-bindings/audiocore/__init__.c b/shared-bindings/audiocore/__init__.c index f03c64ccf8..2e3b479cf6 100644 --- a/shared-bindings/audiocore/__init__.c +++ b/shared-bindings/audiocore/__init__.c @@ -36,7 +36,6 @@ // #include "shared-bindings/audiomixer/Mixer.h" //| """Support for audio samples""" -//| STATIC const mp_rom_map_elem_t audiocore_module_globals_table[] = { { MP_ROM_QSTR(MP_QSTR___name__), MP_ROM_QSTR(MP_QSTR_audiocore) }, diff --git a/shared-bindings/audioio/AudioOut.c b/shared-bindings/audioio/AudioOut.c index 0b4ed7b975..a569097480 100644 --- a/shared-bindings/audioio/AudioOut.c +++ b/shared-bindings/audioio/AudioOut.c @@ -34,12 +34,18 @@ #include "shared-bindings/audioio/AudioOut.h" #include "shared-bindings/audiocore/RawSample.h" #include "shared-bindings/util.h" -#include "supervisor/shared/translate.h" +#include "supervisor/shared/translate/translate.h" //| class AudioOut: //| """Output an analog audio signal""" //| -//| def __init__(self, left_channel: microcontroller.Pin, *, right_channel: Optional[microcontroller.Pin] = None, quiescent_value: int = 0x8000) -> None: +//| def __init__( +//| self, +//| left_channel: microcontroller.Pin, +//| *, +//| right_channel: Optional[microcontroller.Pin] = None, +//| quiescent_value: int = 0x8000 +//| ) -> None: //| """Create a AudioOut object associated with the given pin(s). This allows you to //| play audio signals out on the given pin(s). //| @@ -89,7 +95,6 @@ //| pass //| print("stopped")""" //| ... -//| STATIC mp_obj_t audioio_audioout_make_new(const mp_obj_type_t *type, size_t n_args, size_t n_kw, const mp_obj_t *all_args) { enum { ARG_left_channel, ARG_right_channel, ARG_quiescent_value }; static const mp_arg_t allowed_args[] = { @@ -114,7 +119,6 @@ STATIC mp_obj_t audioio_audioout_make_new(const mp_obj_type_t *type, size_t n_ar //| def deinit(self) -> None: //| """Deinitialises the AudioOut and releases any hardware resources for reuse.""" //| ... -//| STATIC mp_obj_t audioio_audioout_deinit(mp_obj_t self_in) { audioio_audioout_obj_t *self = MP_OBJ_TO_PTR(self_in); common_hal_audioio_audioout_deinit(self); @@ -130,14 +134,12 @@ STATIC void check_for_deinit(audioio_audioout_obj_t *self) { //| def __enter__(self) -> AudioOut: //| """No-op used by Context Managers.""" //| ... -//| // Provided by context manager helper. //| def __exit__(self) -> None: //| """Automatically deinitializes the hardware when exiting a context. See //| :ref:`lifetime-and-contextmanagers` for more info.""" //| ... -//| STATIC mp_obj_t audioio_audioout_obj___exit__(size_t n_args, const mp_obj_t *args) { (void)n_args; common_hal_audioio_audioout_deinit(args[0]); @@ -156,7 +158,6 @@ STATIC MP_DEFINE_CONST_FUN_OBJ_VAR_BETWEEN(audioio_audioout___exit___obj, 4, 4, //| resolution will use the highest order bits to output. For example, the SAMD21 has a 10 bit //| DAC that ignores the lowest 6 bits when playing 16 bit samples.""" //| ... -//| STATIC mp_obj_t audioio_audioout_obj_play(size_t n_args, const mp_obj_t *pos_args, mp_map_t *kw_args) { enum { ARG_sample, ARG_loop }; static const mp_arg_t allowed_args[] = { @@ -178,7 +179,6 @@ MP_DEFINE_CONST_FUN_OBJ_KW(audioio_audioout_play_obj, 1, audioio_audioout_obj_pl //| def stop(self) -> None: //| """Stops playback and resets to the start of the sample.""" //| ... -//| STATIC mp_obj_t audioio_audioout_obj_stop(mp_obj_t self_in) { audioio_audioout_obj_t *self = MP_OBJ_TO_PTR(self_in); check_for_deinit(self); @@ -189,7 +189,6 @@ MP_DEFINE_CONST_FUN_OBJ_1(audioio_audioout_stop_obj, audioio_audioout_obj_stop); //| playing: bool //| """True when an audio sample is being output even if `paused`. (read-only)""" -//| STATIC mp_obj_t audioio_audioout_obj_get_playing(mp_obj_t self_in) { audioio_audioout_obj_t *self = MP_OBJ_TO_PTR(self_in); check_for_deinit(self); @@ -203,7 +202,6 @@ MP_PROPERTY_GETTER(audioio_audioout_playing_obj, //| def pause(self) -> None: //| """Stops playback temporarily while remembering the position. Use `resume` to resume playback.""" //| ... -//| STATIC mp_obj_t audioio_audioout_obj_pause(mp_obj_t self_in) { audioio_audioout_obj_t *self = MP_OBJ_TO_PTR(self_in); check_for_deinit(self); @@ -219,7 +217,6 @@ MP_DEFINE_CONST_FUN_OBJ_1(audioio_audioout_pause_obj, audioio_audioout_obj_pause //| def resume(self) -> None: //| """Resumes sample playback after :py:func:`pause`.""" //| ... -//| STATIC mp_obj_t audioio_audioout_obj_resume(mp_obj_t self_in) { audioio_audioout_obj_t *self = MP_OBJ_TO_PTR(self_in); check_for_deinit(self); diff --git a/shared-bindings/audioio/__init__.c b/shared-bindings/audioio/__init__.c index 9f8411f484..b76b534a7d 100644 --- a/shared-bindings/audioio/__init__.c +++ b/shared-bindings/audioio/__init__.c @@ -42,13 +42,16 @@ //| call :py:meth:`!deinit` or use a context manager. See //| :ref:`lifetime-and-contextmanagers` for more info. //| +//| For more information on working with this module, refer to the +//| `CircuitPython Essentials Learn Guide +//| `_. +//| //| Since CircuitPython 5, `RawSample` and `WaveFile` are moved //| to :mod:`audiocore`, and `Mixer` is moved to :mod:`audiomixer`. //| //| For compatibility with CircuitPython 4.x, some builds allow the items in //| `audiocore` to be imported from `audioio`. This will be removed for all //| boards in a future build of CircuitPython.""" -//| STATIC const mp_rom_map_elem_t audioio_module_globals_table[] = { { MP_ROM_QSTR(MP_QSTR___name__), MP_ROM_QSTR(MP_QSTR_audioio) }, diff --git a/shared-bindings/audiomixer/Mixer.c b/shared-bindings/audiomixer/Mixer.c index a165435ff0..58c618fc11 100644 --- a/shared-bindings/audiomixer/Mixer.c +++ b/shared-bindings/audiomixer/Mixer.c @@ -36,12 +36,20 @@ #include "shared-bindings/microcontroller/Pin.h" #include "shared-bindings/audiocore/RawSample.h" #include "shared-bindings/util.h" -#include "supervisor/shared/translate.h" +#include "supervisor/shared/translate/translate.h" //| class Mixer: //| """Mixes one or more audio samples together into one sample.""" //| -//| def __init__(self, voice_count: int = 2, buffer_size: int = 1024, channel_count: int = 2, bits_per_sample: int = 16, samples_signed: bool = True, sample_rate: int = 8000) -> None: +//| def __init__( +//| self, +//| voice_count: int = 2, +//| buffer_size: int = 1024, +//| channel_count: int = 2, +//| bits_per_sample: int = 16, +//| samples_signed: bool = True, +//| sample_rate: int = 8000, +//| ) -> None: //| """Create a Mixer object that can mix multiple channels with the same sample rate. //| Samples are accessed and controlled with the mixer's `audiomixer.MixerVoice` objects. //| @@ -77,7 +85,6 @@ //| time.sleep(1) //| print("stopped")""" //| ... -//| STATIC mp_obj_t audiomixer_mixer_make_new(const mp_obj_type_t *type, size_t n_args, size_t n_kw, const mp_obj_t *all_args) { enum { ARG_voice_count, ARG_buffer_size, ARG_channel_count, ARG_bits_per_sample, ARG_samples_signed, ARG_sample_rate }; static const mp_arg_t allowed_args[] = { @@ -91,19 +98,9 @@ STATIC mp_obj_t audiomixer_mixer_make_new(const mp_obj_type_t *type, size_t n_ar mp_arg_val_t args[MP_ARRAY_SIZE(allowed_args)]; mp_arg_parse_all_kw_array(n_args, n_kw, all_args, MP_ARRAY_SIZE(allowed_args), allowed_args, args); - mp_int_t voice_count = args[ARG_voice_count].u_int; - if (voice_count < 1 || voice_count > 255) { - mp_raise_ValueError(translate("Invalid voice count")); - } - - mp_int_t channel_count = args[ARG_channel_count].u_int; - if (channel_count < 1 || channel_count > 2) { - mp_raise_ValueError(translate("Invalid channel count")); - } - mp_int_t sample_rate = args[ARG_sample_rate].u_int; - if (sample_rate < 1) { - mp_raise_ValueError(translate("Sample rate must be positive")); - } + mp_int_t voice_count = mp_arg_validate_int_range(args[ARG_voice_count].u_int, 1, 255, MP_QSTR_voice_count); + mp_int_t channel_count = mp_arg_validate_int_range(args[ARG_channel_count].u_int, 1, 2, MP_QSTR_channel_count); + mp_int_t sample_rate = mp_arg_validate_int_min(args[ARG_sample_rate].u_int, 1, MP_QSTR_sample_rate); mp_int_t bits_per_sample = args[ARG_bits_per_sample].u_int; if (bits_per_sample != 8 && bits_per_sample != 16) { mp_raise_ValueError(translate("bits_per_sample must be 8 or 16")); @@ -124,7 +121,6 @@ STATIC mp_obj_t audiomixer_mixer_make_new(const mp_obj_type_t *type, size_t n_ar //| def deinit(self) -> None: //| """Deinitialises the Mixer and releases any hardware resources for reuse.""" //| ... -//| STATIC mp_obj_t audiomixer_mixer_deinit(mp_obj_t self_in) { audiomixer_mixer_obj_t *self = MP_OBJ_TO_PTR(self_in); common_hal_audiomixer_mixer_deinit(self); @@ -141,14 +137,12 @@ STATIC void check_for_deinit(audiomixer_mixer_obj_t *self) { //| def __enter__(self) -> Mixer: //| """No-op used by Context Managers.""" //| ... -//| // Provided by context manager helper. //| def __exit__(self) -> None: //| """Automatically deinitializes the hardware when exiting a context. See //| :ref:`lifetime-and-contextmanagers` for more info.""" //| ... -//| STATIC mp_obj_t audiomixer_mixer_obj___exit__(size_t n_args, const mp_obj_t *args) { (void)n_args; common_hal_audiomixer_mixer_deinit(args[0]); @@ -158,7 +152,6 @@ STATIC MP_DEFINE_CONST_FUN_OBJ_VAR_BETWEEN(audiomixer_mixer___exit___obj, 4, 4, //| playing: bool //| """True when any voice is being output. (read-only)""" -//| STATIC mp_obj_t audiomixer_mixer_obj_get_playing(mp_obj_t self_in) { audiomixer_mixer_obj_t *self = MP_OBJ_TO_PTR(self_in); check_for_deinit(self); @@ -171,7 +164,6 @@ MP_PROPERTY_GETTER(audiomixer_mixer_playing_obj, //| sample_rate: int //| """32 bit value that dictates how quickly samples are played in Hertz (cycles per second).""" -//| STATIC mp_obj_t audiomixer_mixer_obj_get_sample_rate(mp_obj_t self_in) { audiomixer_mixer_obj_t *self = MP_OBJ_TO_PTR(self_in); check_for_deinit(self); @@ -199,7 +191,9 @@ MP_DEFINE_CONST_FUN_OBJ_1(audiomixer_mixer_get_voice_obj, audiomixer_mixer_obj_g MP_PROPERTY_GETTER(audiomixer_mixer_voice_obj, (mp_obj_t)&audiomixer_mixer_get_voice_obj); -//| def play(self, sample: circuitpython_typing.AudioSample, *, voice: int = 0, loop: bool = False) -> None: +//| def play( +//| self, sample: circuitpython_typing.AudioSample, *, voice: int = 0, loop: bool = False +//| ) -> None: //| """Plays the sample once when loop=False and continuously when loop=True. //| Does not block. Use `playing` to block. //| @@ -207,7 +201,6 @@ MP_PROPERTY_GETTER(audiomixer_mixer_voice_obj, //| //| The sample must match the Mixer's encoding settings given in the constructor.""" //| ... -//| STATIC mp_obj_t audiomixer_mixer_obj_play(size_t n_args, const mp_obj_t *pos_args, mp_map_t *kw_args) { enum { ARG_sample, ARG_voice, ARG_loop }; static const mp_arg_t allowed_args[] = { @@ -222,7 +215,7 @@ STATIC mp_obj_t audiomixer_mixer_obj_play(size_t n_args, const mp_obj_t *pos_arg uint8_t v = args[ARG_voice].u_int; if (v > (self->voice_count - 1)) { - mp_raise_ValueError(translate("Invalid voice")); + mp_arg_error_invalid(MP_QSTR_voice); } audiomixer_mixervoice_obj_t *voice = MP_OBJ_TO_PTR(self->voice[v]); mp_obj_t sample = args[ARG_sample].u_obj; @@ -248,7 +241,7 @@ STATIC mp_obj_t audiomixer_mixer_obj_stop_voice(size_t n_args, const mp_obj_t *p uint8_t v = args[ARG_voice].u_int; if (v > (self->voice_count - 1)) { - mp_raise_ValueError(translate("Invalid voice")); + mp_arg_error_invalid(MP_QSTR_voice); } audiomixer_mixervoice_obj_t *voice = MP_OBJ_TO_PTR(self->voice[v]); common_hal_audiomixer_mixervoice_stop(voice); diff --git a/shared-bindings/audiomixer/MixerVoice.c b/shared-bindings/audiomixer/MixerVoice.c index f02b9521af..0bdef1f4cd 100644 --- a/shared-bindings/audiomixer/MixerVoice.c +++ b/shared-bindings/audiomixer/MixerVoice.c @@ -35,7 +35,7 @@ #include "shared-bindings/microcontroller/Pin.h" #include "shared-bindings/audiocore/RawSample.h" #include "shared-bindings/util.h" -#include "supervisor/shared/translate.h" +#include "supervisor/shared/translate/translate.h" //| class MixerVoice: //| """Voice objects used with Mixer @@ -45,7 +45,6 @@ //| def __init__(self) -> None: //| """MixerVoice instance object(s) created by `audiomixer.Mixer`.""" //| ... -//| // TODO: support mono or stereo voices STATIC mp_obj_t audiomixer_mixervoice_make_new(const mp_obj_type_t *type, size_t n_args, size_t n_kw, const mp_obj_t *all_args) { mp_arg_check_num(n_args, n_kw, 0, 0, false); @@ -65,7 +64,6 @@ STATIC mp_obj_t audiomixer_mixervoice_make_new(const mp_obj_type_t *type, size_t //| //| The sample must match the `audiomixer.Mixer`'s encoding settings given in the constructor.""" //| ... -//| STATIC mp_obj_t audiomixer_mixervoice_obj_play(size_t n_args, const mp_obj_t *pos_args, mp_map_t *kw_args) { enum { ARG_sample, ARG_loop }; static const mp_arg_t allowed_args[] = { @@ -85,7 +83,6 @@ MP_DEFINE_CONST_FUN_OBJ_KW(audiomixer_mixervoice_play_obj, 1, audiomixer_mixervo //| def stop(self) -> None: //| """Stops playback of the sample on this voice.""" //| ... -//| STATIC mp_obj_t audiomixer_mixervoice_obj_stop(size_t n_args, const mp_obj_t *pos_args, mp_map_t *kw_args) { enum { ARG_voice }; static const mp_arg_t allowed_args[] = { @@ -103,7 +100,6 @@ MP_DEFINE_CONST_FUN_OBJ_KW(audiomixer_mixervoice_stop_obj, 1, audiomixer_mixervo //| level: float //| """The volume level of a voice, as a floating point number between 0 and 1.""" -//| STATIC mp_obj_t audiomixer_mixervoice_obj_get_level(mp_obj_t self_in) { return mp_obj_new_float(common_hal_audiomixer_mixervoice_get_level(self_in)); } diff --git a/shared-bindings/audiomixer/__init__.c b/shared-bindings/audiomixer/__init__.c index a29d4f18ef..8292be9e95 100644 --- a/shared-bindings/audiomixer/__init__.c +++ b/shared-bindings/audiomixer/__init__.c @@ -33,7 +33,6 @@ #include "shared-bindings/audiomixer/Mixer.h" //| """Support for audio mixing""" -//| STATIC const mp_rom_map_elem_t audiomixer_module_globals_table[] = { { MP_ROM_QSTR(MP_QSTR___name__), MP_ROM_QSTR(MP_QSTR_audiomixer) }, diff --git a/shared-bindings/audiomp3/MP3Decoder.c b/shared-bindings/audiomp3/MP3Decoder.c index 16efa361b8..4a8805b294 100644 --- a/shared-bindings/audiomp3/MP3Decoder.c +++ b/shared-bindings/audiomp3/MP3Decoder.c @@ -32,7 +32,7 @@ #include "py/runtime.h" #include "shared-bindings/audiomp3/MP3Decoder.h" #include "shared-bindings/util.h" -#include "supervisor/shared/translate.h" +#include "supervisor/shared/translate/translate.h" //| class MP3Decoder: //| """Load a mp3 file for audio playback @@ -44,11 +44,11 @@ //| https://learn.adafruit.com/Memory-saving-tips-for-CircuitPython/reducing-memory-fragmentation //| """ //| -//| def __init__(self, file: typing.BinaryIO, buffer: WriteableBuffer) -> None: +//| def __init__(self, file: Union[str, typing.BinaryIO], buffer: WriteableBuffer) -> None: //| //| """Load a .mp3 file for playback with `audioio.AudioOut` or `audiobusio.I2SOut`. //| -//| :param typing.BinaryIO file: Already opened mp3 file +//| :param Union[str, typing.BinaryIO] file: The name of a mp3 file (preferred) or an already opened mp3 file //| :param ~circuitpython_typing.WriteableBuffer buffer: Optional pre-allocated buffer, that will be split in half and used for double-buffering of the data. If not provided, two buffers are allocated internally. The specific buffer size required depends on the mp3 file. //| //| Playback of mp3 audio is CPU intensive, and the @@ -77,23 +77,28 @@ //| speaker_enable = digitalio.DigitalInOut(board.SPEAKER_ENABLE) //| speaker_enable.switch_to_output(value=True) //| -//| data = open("cplay-16bit-16khz-64kbps.mp3", "rb") -//| mp3 = audiomp3.MP3Decoder(data) +//| mp3 = audiomp3.MP3Decoder("cplay-16bit-16khz-64kbps.mp3") //| a = audioio.AudioOut(board.A0) //| //| print("playing") //| a.play(mp3) //| while a.playing: //| pass -//| print("stopped")""" +//| print("stopped") +//| """ //| ... -//| + STATIC mp_obj_t audiomp3_mp3file_make_new(const mp_obj_type_t *type, size_t n_args, size_t n_kw, const mp_obj_t *args) { mp_arg_check_num(n_args, n_kw, 1, 2, false); + mp_obj_t arg = args[0]; + + if (mp_obj_is_str(arg)) { + arg = mp_call_function_2(MP_OBJ_FROM_PTR(&mp_builtin_open_obj), arg, MP_ROM_QSTR(MP_QSTR_rb)); + } audiomp3_mp3file_obj_t *self = m_new_obj(audiomp3_mp3file_obj_t); self->base.type = &audiomp3_mp3file_type; - if (!mp_obj_is_type(args[0], &mp_type_fileio)) { + if (!mp_obj_is_type(arg, &mp_type_fileio)) { mp_raise_TypeError(translate("file must be a file opened in byte mode")); } uint8_t *buffer = NULL; @@ -104,7 +109,7 @@ STATIC mp_obj_t audiomp3_mp3file_make_new(const mp_obj_type_t *type, size_t n_ar buffer = bufinfo.buf; buffer_size = bufinfo.len; } - common_hal_audiomp3_mp3file_construct(self, MP_OBJ_TO_PTR(args[0]), + common_hal_audiomp3_mp3file_construct(self, MP_OBJ_TO_PTR(arg), buffer, buffer_size); return MP_OBJ_FROM_PTR(self); @@ -113,7 +118,6 @@ STATIC mp_obj_t audiomp3_mp3file_make_new(const mp_obj_type_t *type, size_t n_ar //| def deinit(self) -> None: //| """Deinitialises the MP3 and releases all memory resources for reuse.""" //| ... -//| STATIC mp_obj_t audiomp3_mp3file_deinit(mp_obj_t self_in) { audiomp3_mp3file_obj_t *self = MP_OBJ_TO_PTR(self_in); common_hal_audiomp3_mp3file_deinit(self); @@ -130,14 +134,12 @@ STATIC void check_for_deinit(audiomp3_mp3file_obj_t *self) { //| def __enter__(self) -> MP3Decoder: //| """No-op used by Context Managers.""" //| ... -//| // Provided by context manager helper. //| def __exit__(self) -> None: //| """Automatically deinitializes the hardware when exiting a context. See //| :ref:`lifetime-and-contextmanagers` for more info.""" //| ... -//| STATIC mp_obj_t audiomp3_mp3file_obj___exit__(size_t n_args, const mp_obj_t *args) { (void)n_args; common_hal_audiomp3_mp3file_deinit(args[0]); @@ -147,7 +149,6 @@ STATIC MP_DEFINE_CONST_FUN_OBJ_VAR_BETWEEN(audiomp3_mp3file___exit___obj, 4, 4, //| file: typing.BinaryIO //| """File to play back.""" -//| STATIC mp_obj_t audiomp3_mp3file_obj_get_file(mp_obj_t self_in) { audiomp3_mp3file_obj_t *self = MP_OBJ_TO_PTR(self_in); check_for_deinit(self); @@ -166,6 +167,20 @@ STATIC mp_obj_t audiomp3_mp3file_obj_set_file(mp_obj_t self_in, mp_obj_t file) { } MP_DEFINE_CONST_FUN_OBJ_2(audiomp3_mp3file_set_file_obj, audiomp3_mp3file_obj_set_file); +//| def open(self, filepath: str) -> None: +//| """Takes in the name of a mp3 file, opens it, and replaces the old playback file.""" +//| ... +STATIC mp_obj_t audiomp3_mp3file_obj_open(mp_obj_t self_in, mp_obj_t path) { + audiomp3_mp3file_obj_t *self = MP_OBJ_TO_PTR(self_in); + check_for_deinit(self); + + mp_obj_t file = mp_call_function_2(MP_OBJ_FROM_PTR(&mp_builtin_open_obj), path, MP_ROM_QSTR(MP_QSTR_rb)); + + common_hal_audiomp3_mp3file_set_file(self, file); + return mp_const_none; +} +MP_DEFINE_CONST_FUN_OBJ_2(audiomp3_mp3file_open_obj, audiomp3_mp3file_obj_open); + MP_PROPERTY_GETSET(audiomp3_mp3file_file_obj, (mp_obj_t)&audiomp3_mp3file_get_file_obj, (mp_obj_t)&audiomp3_mp3file_set_file_obj); @@ -176,7 +191,6 @@ MP_PROPERTY_GETSET(audiomp3_mp3file_file_obj, //| """32 bit value that dictates how quickly samples are loaded into the DAC //| in Hertz (cycles per second). When the sample is looped, this can change //| the pitch output without changing the underlying sample.""" -//| STATIC mp_obj_t audiomp3_mp3file_obj_get_sample_rate(mp_obj_t self_in) { audiomp3_mp3file_obj_t *self = MP_OBJ_TO_PTR(self_in); check_for_deinit(self); @@ -198,7 +212,6 @@ MP_PROPERTY_GETSET(audiomp3_mp3file_sample_rate_obj, //| bits_per_sample: int //| """Bits per sample. (read only)""" -//| STATIC mp_obj_t audiomp3_mp3file_obj_get_bits_per_sample(mp_obj_t self_in) { audiomp3_mp3file_obj_t *self = MP_OBJ_TO_PTR(self_in); check_for_deinit(self); @@ -211,7 +224,6 @@ MP_PROPERTY_GETTER(audiomp3_mp3file_bits_per_sample_obj, //| channel_count: int //| """Number of audio channels. (read only)""" -//| STATIC mp_obj_t audiomp3_mp3file_obj_get_channel_count(mp_obj_t self_in) { audiomp3_mp3file_obj_t *self = MP_OBJ_TO_PTR(self_in); check_for_deinit(self); @@ -224,7 +236,6 @@ MP_PROPERTY_GETTER(audiomp3_mp3file_channel_count_obj, //| rms_level: float //| """The RMS audio level of a recently played moment of audio. (read only)""" -//| STATIC mp_obj_t audiomp3_mp3file_obj_get_rms_level(mp_obj_t self_in) { audiomp3_mp3file_obj_t *self = MP_OBJ_TO_PTR(self_in); check_for_deinit(self); @@ -250,6 +261,7 @@ MP_PROPERTY_GETTER(audiomp3_mp3file_samples_decoded_obj, STATIC const mp_rom_map_elem_t audiomp3_mp3file_locals_dict_table[] = { // Methods + { MP_ROM_QSTR(MP_QSTR_open), MP_ROM_PTR(&audiomp3_mp3file_open_obj) }, { MP_ROM_QSTR(MP_QSTR_deinit), MP_ROM_PTR(&audiomp3_mp3file_deinit_obj) }, { MP_ROM_QSTR(MP_QSTR___enter__), MP_ROM_PTR(&default___enter___obj) }, { MP_ROM_QSTR(MP_QSTR___exit__), MP_ROM_PTR(&audiomp3_mp3file___exit___obj) }, diff --git a/shared-bindings/audiomp3/__init__.c b/shared-bindings/audiomp3/__init__.c index 13f02b1ea9..948910c45e 100644 --- a/shared-bindings/audiomp3/__init__.c +++ b/shared-bindings/audiomp3/__init__.c @@ -37,7 +37,6 @@ //| see `this CircuitPython Essentials Learn guide page //| `_. //| """ -//| STATIC const mp_rom_map_elem_t audiomp3_module_globals_table[] = { { MP_ROM_QSTR(MP_QSTR___name__), MP_ROM_QSTR(MP_QSTR_audiomp3) }, diff --git a/shared-bindings/audiopwmio/PWMAudioOut.c b/shared-bindings/audiopwmio/PWMAudioOut.c index 8118eb47f2..2e17bbda8c 100644 --- a/shared-bindings/audiopwmio/PWMAudioOut.c +++ b/shared-bindings/audiopwmio/PWMAudioOut.c @@ -34,12 +34,18 @@ #include "shared-bindings/audiopwmio/PWMAudioOut.h" #include "shared-bindings/audiocore/RawSample.h" #include "shared-bindings/util.h" -#include "supervisor/shared/translate.h" +#include "supervisor/shared/translate/translate.h" //| class PWMAudioOut: //| """Output an analog audio signal by varying the PWM duty cycle.""" //| -//| def __init__(self, left_channel: microcontroller.Pin, *, right_channel: Optional[microcontroller.Pin] = None, quiescent_value: int = 0x8000) -> None: +//| def __init__( +//| self, +//| left_channel: microcontroller.Pin, +//| *, +//| right_channel: Optional[microcontroller.Pin] = None, +//| quiescent_value: int = 0x8000 +//| ) -> None: //| """Create a PWMAudioOut object associated with the given pin(s). This allows you to //| play audio signals out on the given pin(s). In contrast to mod:`audioio`, //| the pin(s) specified are digital pins, and are driven with a device-dependent PWM @@ -92,7 +98,6 @@ //| pass //| print("stopped")""" //| ... -//| STATIC mp_obj_t audiopwmio_pwmaudioout_make_new(const mp_obj_type_t *type, size_t n_args, size_t n_kw, const mp_obj_t *all_args) { enum { ARG_left_channel, ARG_right_channel, ARG_quiescent_value }; static const mp_arg_t allowed_args[] = { @@ -117,7 +122,6 @@ STATIC mp_obj_t audiopwmio_pwmaudioout_make_new(const mp_obj_type_t *type, size_ //| def deinit(self) -> None: //| """Deinitialises the PWMAudioOut and releases any hardware resources for reuse.""" //| ... -//| STATIC mp_obj_t audiopwmio_pwmaudioout_deinit(mp_obj_t self_in) { audiopwmio_pwmaudioout_obj_t *self = MP_OBJ_TO_PTR(self_in); common_hal_audiopwmio_pwmaudioout_deinit(self); @@ -133,7 +137,6 @@ STATIC void check_for_deinit(audiopwmio_pwmaudioout_obj_t *self) { //| def __enter__(self) -> PWMAudioOut: //| """No-op used by Context Managers.""" //| ... -//| // Provided by context manager helper. //| def __exit__(self) -> None: @@ -157,7 +160,6 @@ STATIC MP_DEFINE_CONST_FUN_OBJ_VAR_BETWEEN(audiopwmio_pwmaudioout___exit___obj, //| The sample itself should consist of 16 bit samples. Microcontrollers with a lower output //| resolution will use the highest order bits to output.""" //| ... -//| STATIC mp_obj_t audiopwmio_pwmaudioout_obj_play(size_t n_args, const mp_obj_t *pos_args, mp_map_t *kw_args) { enum { ARG_sample, ARG_loop }; static const mp_arg_t allowed_args[] = { @@ -179,7 +181,6 @@ MP_DEFINE_CONST_FUN_OBJ_KW(audiopwmio_pwmaudioout_play_obj, 1, audiopwmio_pwmaud //| def stop(self) -> None: //| """Stops playback and resets to the start of the sample.""" //| ... -//| STATIC mp_obj_t audiopwmio_pwmaudioout_obj_stop(mp_obj_t self_in) { audiopwmio_pwmaudioout_obj_t *self = MP_OBJ_TO_PTR(self_in); check_for_deinit(self); @@ -190,7 +191,6 @@ MP_DEFINE_CONST_FUN_OBJ_1(audiopwmio_pwmaudioout_stop_obj, audiopwmio_pwmaudioou //| playing: bool //| """True when an audio sample is being output even if `paused`. (read-only)""" -//| STATIC mp_obj_t audiopwmio_pwmaudioout_obj_get_playing(mp_obj_t self_in) { audiopwmio_pwmaudioout_obj_t *self = MP_OBJ_TO_PTR(self_in); check_for_deinit(self); @@ -204,7 +204,6 @@ MP_PROPERTY_GETTER(audiopwmio_pwmaudioout_playing_obj, //| def pause(self) -> None: //| """Stops playback temporarily while remembering the position. Use `resume` to resume playback.""" //| ... -//| STATIC mp_obj_t audiopwmio_pwmaudioout_obj_pause(mp_obj_t self_in) { audiopwmio_pwmaudioout_obj_t *self = MP_OBJ_TO_PTR(self_in); check_for_deinit(self); @@ -220,7 +219,6 @@ MP_DEFINE_CONST_FUN_OBJ_1(audiopwmio_pwmaudioout_pause_obj, audiopwmio_pwmaudioo //| def resume(self) -> None: //| """Resumes sample playback after :py:func:`pause`.""" //| ... -//| STATIC mp_obj_t audiopwmio_pwmaudioout_obj_resume(mp_obj_t self_in) { audiopwmio_pwmaudioout_obj_t *self = MP_OBJ_TO_PTR(self_in); check_for_deinit(self); diff --git a/shared-bindings/audiopwmio/__init__.c b/shared-bindings/audiopwmio/__init__.c index 41a756e8b6..441bca2132 100644 --- a/shared-bindings/audiopwmio/__init__.c +++ b/shared-bindings/audiopwmio/__init__.c @@ -44,7 +44,6 @@ //| //| Since CircuitPython 5, `Mixer`, `RawSample` and `WaveFile` are moved //| to :mod:`audiocore`.""" -//| STATIC const mp_rom_map_elem_t audiopwmio_module_globals_table[] = { { MP_ROM_QSTR(MP_QSTR___name__), MP_ROM_QSTR(MP_QSTR_audiopwmio) }, diff --git a/shared-bindings/bitbangio/I2C.c b/shared-bindings/bitbangio/I2C.c index c65b184ca0..19c27740e3 100644 --- a/shared-bindings/bitbangio/I2C.c +++ b/shared-bindings/bitbangio/I2C.c @@ -35,12 +35,19 @@ #include "shared/runtime/context_manager_helpers.h" #include "py/mperrno.h" #include "py/runtime.h" -#include "supervisor/shared/translate.h" +#include "supervisor/shared/translate/translate.h" //| class I2C: //| """Two wire serial protocol""" //| -//| def __init__(self, scl: microcontroller.Pin, sda: microcontroller.Pin, *, frequency: int = 400000, timeout: int = 255) -> None: +//| def __init__( +//| self, +//| scl: microcontroller.Pin, +//| sda: microcontroller.Pin, +//| *, +//| frequency: int = 400000, +//| timeout: int = 255 +//| ) -> None: //| """I2C is a two-wire protocol for communicating between devices. At the //| physical level it consists of 2 wires: SCL and SDA, the clock and data //| lines respectively. @@ -58,7 +65,6 @@ //| :param int frequency: The clock frequency of the bus //| :param int timeout: The maximum clock stretching timeout in microseconds""" //| ... -//| STATIC mp_obj_t bitbangio_i2c_make_new(const mp_obj_type_t *type, size_t n_args, size_t n_kw, const mp_obj_t *all_args) { enum { ARG_scl, ARG_sda, ARG_frequency, ARG_timeout }; static const mp_arg_t allowed_args[] = { @@ -82,7 +88,6 @@ STATIC mp_obj_t bitbangio_i2c_make_new(const mp_obj_type_t *type, size_t n_args, //| def deinit(self) -> None: //| """Releases control of the underlying hardware so other classes can use it.""" //| ... -//| STATIC mp_obj_t bitbangio_i2c_obj_deinit(mp_obj_t self_in) { bitbangio_i2c_obj_t *self = MP_OBJ_TO_PTR(self_in); shared_module_bitbangio_i2c_deinit(self); @@ -99,14 +104,12 @@ STATIC void check_for_deinit(bitbangio_i2c_obj_t *self) { //| def __enter__(self) -> I2C: //| """No-op used in Context Managers.""" //| ... -//| // Provided by context manager helper. //| def __exit__(self) -> None: //| """Automatically deinitializes the hardware on context exit. See //| :ref:`lifetime-and-contextmanagers` for more info.""" //| ... -//| STATIC mp_obj_t bitbangio_i2c_obj___exit__(size_t n_args, const mp_obj_t *args) { (void)n_args; shared_module_bitbangio_i2c_deinit(args[0]); @@ -125,7 +128,6 @@ static void check_lock(bitbangio_i2c_obj_t *self) { //| those that respond. A device responds if it pulls the SDA line low after //| its address (including a read bit) is sent on the bus.""" //| ... -//| STATIC mp_obj_t bitbangio_i2c_scan(mp_obj_t self_in) { bitbangio_i2c_obj_t *self = MP_OBJ_TO_PTR(self_in); check_for_deinit(self); @@ -145,7 +147,6 @@ MP_DEFINE_CONST_FUN_OBJ_1(bitbangio_i2c_scan_obj, bitbangio_i2c_scan); //| def try_lock(self) -> bool: //| """Attempts to grab the I2C lock. Returns True on success.""" //| ... -//| STATIC mp_obj_t bitbangio_i2c_obj_try_lock(mp_obj_t self_in) { bitbangio_i2c_obj_t *self = MP_OBJ_TO_PTR(self_in); check_for_deinit(self); @@ -156,7 +157,6 @@ MP_DEFINE_CONST_FUN_OBJ_1(bitbangio_i2c_try_lock_obj, bitbangio_i2c_obj_try_lock //| def unlock(self) -> None: //| """Releases the I2C lock.""" //| ... -//| STATIC mp_obj_t bitbangio_i2c_obj_unlock(mp_obj_t self_in) { bitbangio_i2c_obj_t *self = MP_OBJ_TO_PTR(self_in); check_for_deinit(self); @@ -166,7 +166,9 @@ STATIC mp_obj_t bitbangio_i2c_obj_unlock(mp_obj_t self_in) { MP_DEFINE_CONST_FUN_OBJ_1(bitbangio_i2c_unlock_obj, bitbangio_i2c_obj_unlock); //| import sys -//| def readfrom_into(self, address: int, buffer: WriteableBuffer, *, start: int = 0, end: int = sys.maxsize) -> None: +//| def readfrom_into( +//| self, address: int, buffer: WriteableBuffer, *, start: int = 0, end: int = sys.maxsize +//| ) -> None: //| """Read into ``buffer`` from the device selected by ``address``. //| The number of bytes read will be the length of ``buffer``. //| At least one byte must be read. @@ -180,7 +182,6 @@ MP_DEFINE_CONST_FUN_OBJ_1(bitbangio_i2c_unlock_obj, bitbangio_i2c_obj_unlock); //| :param int start: Index to start writing at //| :param int end: Index to write up to but not include""" //| ... -//| // Shared arg parsing for readfrom_into and writeto_then_readfrom. STATIC void readfrom(bitbangio_i2c_obj_t *self, mp_int_t address, mp_obj_t buffer, int32_t start, mp_int_t end) { mp_buffer_info_t bufinfo; @@ -188,9 +189,7 @@ STATIC void readfrom(bitbangio_i2c_obj_t *self, mp_int_t address, mp_obj_t buffe size_t length = bufinfo.len; normalize_buffer_bounds(&start, end, &length); - if (length == 0) { - mp_raise_ValueError(translate("Buffer must be at least length 1")); - } + mp_arg_validate_length_min(length, 1, MP_QSTR_buffer); uint8_t status = shared_module_bitbangio_i2c_read(self, address, ((uint8_t *)bufinfo.buf) + start, length); if (status != 0) { @@ -219,7 +218,9 @@ STATIC mp_obj_t bitbangio_i2c_readfrom_into(size_t n_args, const mp_obj_t *pos_a MP_DEFINE_CONST_FUN_OBJ_KW(bitbangio_i2c_readfrom_into_obj, 1, bitbangio_i2c_readfrom_into); //| import sys -//| def writeto(self, address: int, buffer: ReadableBuffer, *, start: int = 0, end: int = sys.maxsize) -> None: +//| def writeto( +//| self, address: int, buffer: ReadableBuffer, *, start: int = 0, end: int = sys.maxsize +//| ) -> None: //| """Write the bytes from ``buffer`` to the device selected by ``address`` and then transmits a //| stop bit. Use `writeto_then_readfrom` when needing a write, no stop and repeated start //| before a read. @@ -237,7 +238,6 @@ MP_DEFINE_CONST_FUN_OBJ_KW(bitbangio_i2c_readfrom_into_obj, 1, bitbangio_i2c_rea //| :param int end: end of buffer slice; if not specified, use ``len(buffer)`` //| """ //| ... -//| // Shared arg parsing for writeto and writeto_then_readfrom. STATIC void writeto(bitbangio_i2c_obj_t *self, mp_int_t address, mp_obj_t buffer, int32_t start, mp_int_t end, bool stop) { // get the buffer to write the data from @@ -278,7 +278,17 @@ STATIC MP_DEFINE_CONST_FUN_OBJ_KW(bitbangio_i2c_writeto_obj, 1, bitbangio_i2c_wr //| import sys -//| def writeto_then_readfrom(self, address: int, out_buffer: ReadableBuffer, in_buffer: ReadableBuffer, *, out_start: int = 0, out_end: int = sys.maxsize, in_start: int = 0, in_end: int = sys.maxsize) -> None: +//| def writeto_then_readfrom( +//| self, +//| address: int, +//| out_buffer: ReadableBuffer, +//| in_buffer: ReadableBuffer, +//| *, +//| out_start: int = 0, +//| out_end: int = sys.maxsize, +//| in_start: int = 0, +//| in_end: int = sys.maxsize +//| ) -> None: //| """Write the bytes from ``out_buffer`` to the device selected by ``address``, generate no stop //| bit, generate a repeated start and read into ``in_buffer``. ``out_buffer`` and //| ``in_buffer`` can be the same buffer because they are used sequentially. @@ -290,7 +300,7 @@ STATIC MP_DEFINE_CONST_FUN_OBJ_KW(bitbangio_i2c_writeto_obj, 1, bitbangio_i2c_wr //| If ``in_start`` or ``in_end`` is provided, then the input buffer will be sliced //| as if ``in_buffer[in_start:in_end]`` were passed, //| The number of bytes read will be the length of ``out_buffer[in_start:in_end]``. - +//| //| :param int address: 7-bit device address //| :param ~circuitpython_typing.ReadableBuffer out_buffer: buffer containing the bytes to write //| :param ~circuitpython_typing.WriteableBuffer in_buffer: buffer to write into diff --git a/shared-bindings/bitbangio/SPI.c b/shared-bindings/bitbangio/SPI.c index 2c29c09bf9..1b7c877bda 100644 --- a/shared-bindings/bitbangio/SPI.c +++ b/shared-bindings/bitbangio/SPI.c @@ -37,7 +37,7 @@ #include "shared/runtime/context_manager_helpers.h" #include "py/mperrno.h" #include "py/runtime.h" -#include "supervisor/shared/translate.h" +#include "supervisor/shared/translate/translate.h" //| class SPI: //| """A 3-4 wire serial protocol @@ -51,7 +51,12 @@ //| multiple secondaries can share the `!clock`, `!MOSI` and `!MISO` lines //| and therefore the hardware.)""" //| -//| def __init__(self, clock: microcontroller.Pin, MOSI: Optional[microcontroller.Pin] = None, MISO: Optional[microcontroller.Pin] = None) -> None: +//| def __init__( +//| self, +//| clock: microcontroller.Pin, +//| MOSI: Optional[microcontroller.Pin] = None, +//| MISO: Optional[microcontroller.Pin] = None, +//| ) -> None: //| """Construct an SPI object on the given pins. //| //| .. seealso:: Using this class directly requires careful lock management. @@ -67,7 +72,6 @@ //| :param ~microcontroller.Pin MOSI: the Main Out Selected In pin. //| :param ~microcontroller.Pin MISO: the Main In Selected Out pin.""" //| ... -//| // TODO(tannewt): Support LSB SPI. STATIC mp_obj_t bitbangio_spi_make_new(const mp_obj_type_t *type, size_t n_args, size_t n_kw, const mp_obj_t *all_args) { @@ -93,7 +97,6 @@ STATIC mp_obj_t bitbangio_spi_make_new(const mp_obj_type_t *type, size_t n_args, //| def deinit(self) -> None: //| """Turn off the SPI bus.""" //| ... -//| STATIC mp_obj_t bitbangio_spi_obj_deinit(mp_obj_t self_in) { bitbangio_spi_obj_t *self = MP_OBJ_TO_PTR(self_in); shared_module_bitbangio_spi_deinit(self); @@ -110,14 +113,12 @@ STATIC void check_for_deinit(bitbangio_spi_obj_t *self) { //| def __enter__(self) -> SPI: //| """No-op used by Context Managers.""" //| ... -//| // Provided by context manager helper. //| def __exit__(self) -> None: //| """Automatically deinitializes the hardware when exiting a context. See //| :ref:`lifetime-and-contextmanagers` for more info.""" //| ... -//| STATIC mp_obj_t bitbangio_spi_obj___exit__(size_t n_args, const mp_obj_t *args) { (void)n_args; shared_module_bitbangio_spi_deinit(args[0]); @@ -132,7 +133,9 @@ static void check_lock(bitbangio_spi_obj_t *self) { } } -//| def configure(self, *, baudrate: int = 100000, polarity: int = 0, phase: int = 0, bits: int = 8) -> None: +//| def configure( +//| self, *, baudrate: int = 100000, polarity: int = 0, phase: int = 0, bits: int = 8 +//| ) -> None: //| """Configures the SPI bus. Only valid when locked. //| //| :param int baudrate: the clock rate in Hertz @@ -141,7 +144,6 @@ static void check_lock(bitbangio_spi_obj_t *self) { //| or second (1). Rising or falling depends on clock polarity. //| :param int bits: the number of bits per word""" //| ... -//| STATIC mp_obj_t bitbangio_spi_configure(size_t n_args, const mp_obj_t *pos_args, mp_map_t *kw_args) { enum { ARG_baudrate, ARG_polarity, ARG_phase, ARG_bits }; static const mp_arg_t allowed_args[] = { @@ -156,18 +158,10 @@ STATIC mp_obj_t bitbangio_spi_configure(size_t n_args, const mp_obj_t *pos_args, mp_arg_val_t args[MP_ARRAY_SIZE(allowed_args)]; mp_arg_parse_all(n_args - 1, pos_args + 1, kw_args, MP_ARRAY_SIZE(allowed_args), allowed_args, args); - uint8_t polarity = args[ARG_polarity].u_int; - if (polarity != 0 && polarity != 1) { - mp_raise_ValueError(translate("Invalid polarity")); - } - uint8_t phase = args[ARG_phase].u_int; - if (phase != 0 && phase != 1) { - mp_raise_ValueError(translate("Invalid phase")); - } - uint8_t bits = args[ARG_bits].u_int; - if (bits != 8 && bits != 9) { - mp_raise_ValueError(translate("Invalid number of bits")); - } + uint8_t polarity = (uint8_t)mp_arg_validate_int_range(args[ARG_polarity].u_int, 0, 1, MP_QSTR_polarity); + uint8_t phase = (uint8_t)mp_arg_validate_int_range(args[ARG_phase].u_int, 0, 1, MP_QSTR_phase); + uint8_t bits = (uint8_t)mp_arg_validate_int_range(args[ARG_bits].u_int, 8, 9, MP_QSTR_bits); + shared_module_bitbangio_spi_configure(self, args[ARG_baudrate].u_int, polarity, phase, bits); return mp_const_none; @@ -180,7 +174,6 @@ MP_DEFINE_CONST_FUN_OBJ_KW(bitbangio_spi_configure_obj, 1, bitbangio_spi_configu //| :return: True when lock has been grabbed //| :rtype: bool""" //| ... -//| STATIC mp_obj_t bitbangio_spi_obj_try_lock(mp_obj_t self_in) { bitbangio_spi_obj_t *self = MP_OBJ_TO_PTR(self_in); check_for_deinit(self); @@ -191,7 +184,6 @@ MP_DEFINE_CONST_FUN_OBJ_1(bitbangio_spi_try_lock_obj, bitbangio_spi_obj_try_lock //| def unlock(self) -> None: //| """Releases the SPI lock.""" //| ... -//| STATIC mp_obj_t bitbangio_spi_obj_unlock(mp_obj_t self_in) { bitbangio_spi_obj_t *self = MP_OBJ_TO_PTR(self_in); check_for_deinit(self); @@ -204,7 +196,6 @@ MP_DEFINE_CONST_FUN_OBJ_1(bitbangio_spi_unlock_obj, bitbangio_spi_obj_unlock); //| """Write the data contained in ``buf``. Requires the SPI being locked. //| If the buffer is empty, nothing happens.""" //| ... -//| STATIC mp_obj_t bitbangio_spi_write(size_t n_args, const mp_obj_t *pos_args, mp_map_t *kw_args) { enum { ARG_buffer, ARG_start, ARG_end }; static const mp_arg_t allowed_args[] = { @@ -238,7 +229,14 @@ MP_DEFINE_CONST_FUN_OBJ_KW(bitbangio_spi_write_obj, 1, bitbangio_spi_write); //| import sys -//| def readinto(self, buffer: WriteableBuffer, *, start: int = 0, end: int = sys.maxsize, write_value: int = 0) -> None: +//| def readinto( +//| self, +//| buffer: WriteableBuffer, +//| *, +//| start: int = 0, +//| end: int = sys.maxsize, +//| write_value: int = 0 +//| ) -> None: //| """Read into ``buffer`` while writing ``write_value`` for each byte read. //| The SPI object must be locked. //| If the number of bytes to read is 0, nothing happens. @@ -253,7 +251,6 @@ MP_DEFINE_CONST_FUN_OBJ_KW(bitbangio_spi_write_obj, 1, bitbangio_spi_write); //| :param int write_value: value to write while reading //| """ //| ... -//| STATIC mp_obj_t bitbangio_spi_readinto(size_t n_args, const mp_obj_t *pos_args, mp_map_t *kw_args) { enum { ARG_buffer, ARG_start, ARG_end, ARG_write_value }; static const mp_arg_t allowed_args[] = { @@ -287,7 +284,16 @@ STATIC mp_obj_t bitbangio_spi_readinto(size_t n_args, const mp_obj_t *pos_args, MP_DEFINE_CONST_FUN_OBJ_KW(bitbangio_spi_readinto_obj, 1, bitbangio_spi_readinto); //| import sys -//| def write_readinto(self, out_buffer: ReadableBuffer, in_buffer: WriteableBuffer, *, out_start: int = 0, out_end: int = sys.maxsize, in_start: int = 0, in_end: int = sys.maxsize) -> None: +//| def write_readinto( +//| self, +//| out_buffer: ReadableBuffer, +//| in_buffer: WriteableBuffer, +//| *, +//| out_start: int = 0, +//| out_end: int = sys.maxsize, +//| in_start: int = 0, +//| in_end: int = sys.maxsize +//| ) -> None: //| """Write out the data in ``out_buffer`` while simultaneously reading data into ``in_buffer``. //| The SPI object must be locked. //| diff --git a/shared-bindings/bitbangio/__init__.c b/shared-bindings/bitbangio/__init__.c index 57348a3c1e..1b13003e89 100644 --- a/shared-bindings/bitbangio/__init__.c +++ b/shared-bindings/bitbangio/__init__.c @@ -34,7 +34,6 @@ #include "shared-bindings/bitbangio/__init__.h" #include "shared-bindings/bitbangio/I2C.h" -#include "shared-bindings/onewireio/OneWire.h" #include "shared-bindings/bitbangio/SPI.h" #include "py/runtime.h" @@ -67,14 +66,10 @@ //| :py:meth:`~bitbangio.I2C.scan` and then :py:meth:`~bitbangio.I2C.deinit` the //| hardware. The last step is optional because CircuitPython automatically //| resets hardware after a program finishes.""" -//| STATIC const mp_rom_map_elem_t bitbangio_module_globals_table[] = { { MP_ROM_QSTR(MP_QSTR___name__), MP_ROM_QSTR(MP_QSTR_bitbangio) }, { MP_ROM_QSTR(MP_QSTR_I2C), MP_ROM_PTR(&bitbangio_i2c_type) }, - #if CIRCUITPY_ONEWIREIO - { MP_ROM_QSTR(MP_QSTR_OneWire), MP_ROM_PTR(&onewireio_onewire_type) }, - #endif { MP_ROM_QSTR(MP_QSTR_SPI), MP_ROM_PTR(&bitbangio_spi_type) }, }; diff --git a/shared-bindings/bitmaptools/__init__.c b/shared-bindings/bitmaptools/__init__.c index 5122d039e8..dd62b515fe 100644 --- a/shared-bindings/bitmaptools/__init__.c +++ b/shared-bindings/bitmaptools/__init__.c @@ -50,7 +50,6 @@ //| `_ //| for information about using the :py:mod:`displayio` module. //| """ -//| STATIC int16_t validate_point(mp_obj_t point, int16_t default_value) { // Checks if point is None and returns default_value, otherwise decodes integer value @@ -126,39 +125,54 @@ STATIC void validate_clip_region(displayio_bitmap_t *bitmap, mp_obj_t clip0_tupl } -//| //| def rotozoom( -//| dest_bitmap: displayio.Bitmap, source_bitmap: displayio.Bitmap, -//| *, -//| ox: int, oy: int, dest_clip0: Tuple[int, int], dest_clip1: Tuple[int, int], -//| px: int, py: int, source_clip0: Tuple[int, int], source_clip1: Tuple[int, int], -//| angle: float, scale: float, skip_index: int) -> None: -//| """Inserts the source bitmap region into the destination bitmap with rotation -//| (angle), scale and clipping (both on source and destination bitmaps). +//| dest_bitmap: displayio.Bitmap, +//| source_bitmap: displayio.Bitmap, +//| *, +//| ox: int, +//| oy: int, +//| dest_clip0: Tuple[int, int], +//| dest_clip1: Tuple[int, int], +//| px: int, +//| py: int, +//| source_clip0: Tuple[int, int], +//| source_clip1: Tuple[int, int], +//| angle: float, +//| scale: float, +//| skip_index: int +//| ) -> None: +//| """Inserts the source bitmap region into the destination bitmap with rotation +//| (angle), scale and clipping (both on source and destination bitmaps). //| -//| :param bitmap dest_bitmap: Destination bitmap that will be copied into -//| :param bitmap source_bitmap: Source bitmap that contains the graphical region to be copied -//| :param int ox: Horizontal pixel location in destination bitmap where source bitmap -//| point (px,py) is placed -//| :param int oy: Vertical pixel location in destination bitmap where source bitmap -//| point (px,py) is placed -//| :param Tuple[int,int] dest_clip0: First corner of rectangular destination clipping -//| region that constrains region of writing into destination bitmap -//| :param Tuple[int,int] dest_clip1: Second corner of rectangular destination clipping -//| region that constrains region of writing into destination bitmap -//| :param int px: Horizontal pixel location in source bitmap that is placed into the -//| destination bitmap at (ox,oy) -//| :param int py: Vertical pixel location in source bitmap that is placed into the -//| destination bitmap at (ox,oy) -//| :param Tuple[int,int] source_clip0: First corner of rectangular source clipping -//| region that constrains region of reading from the source bitmap -//| :param Tuple[int,int] source_clip1: Second corner of rectangular source clipping -//| region that constrains region of reading from the source bitmap -//| :param float angle: Angle of rotation, in radians (positive is clockwise direction) -//| :param float scale: Scaling factor -//| :param int skip_index: Bitmap palette index in the source that will not be copied, -//| set to None to copy all pixels""" -//| ... +//| :param bitmap dest_bitmap: Destination bitmap that will be copied into +//| :param bitmap source_bitmap: Source bitmap that contains the graphical region to be copied +//| :param int ox: Horizontal pixel location in destination bitmap where source bitmap +//| point (px,py) is placed. Defaults to None which causes it to use the horizontal +//| midway point of the destination bitmap. +//| :param int oy: Vertical pixel location in destination bitmap where source bitmap +//| point (px,py) is placed. Defaults to None which causes it to use the vertical +//| midway point of the destination bitmap. +//| :param Tuple[int,int] dest_clip0: First corner of rectangular destination clipping +//| region that constrains region of writing into destination bitmap +//| :param Tuple[int,int] dest_clip1: Second corner of rectangular destination clipping +//| region that constrains region of writing into destination bitmap +//| :param int px: Horizontal pixel location in source bitmap that is placed into the +//| destination bitmap at (ox,oy). Defaults to None which causes it to use the +//| horizontal midway point in the source bitmap. +//| :param int py: Vertical pixel location in source bitmap that is placed into the +//| destination bitmap at (ox,oy). Defaults to None which causes it to use the +//| vertical midway point in the source bitmap. +//| :param Tuple[int,int] source_clip0: First corner of rectangular source clipping +//| region that constrains region of reading from the source bitmap +//| :param Tuple[int,int] source_clip1: Second corner of rectangular source clipping +//| region that constrains region of reading from the source bitmap +//| :param float angle: Angle of rotation, in radians (positive is clockwise direction). +//| Defaults to None which gets treated as 0.0 radians or no rotation. +//| :param float scale: Scaling factor. Defaults to None which gets treated as 1.0 or same +//| as original source size. +//| :param int skip_index: Bitmap palette index in the source that will not be copied, +//| set to None to copy all pixels""" +//| ... //| STATIC mp_obj_t bitmaptools_obj_rotozoom(size_t n_args, const mp_obj_t *pos_args, mp_map_t *kw_args) { enum {ARG_dest_bitmap, ARG_source_bitmap, @@ -260,8 +274,14 @@ STATIC mp_obj_t bitmaptools_obj_rotozoom(size_t n_args, const mp_obj_t *pos_args MP_DEFINE_CONST_FUN_OBJ_KW(bitmaptools_rotozoom_obj, 0, bitmaptools_obj_rotozoom); // requires at least 2 arguments (destination bitmap and source bitmap) -//| -//| def alphablend(dest_bitmap: displayio.Bitmap , source_bitmap_1: displayio.Bitmap, source_bitmap_2: displayio.Bitmap, colorspace: displayio.Colorspace, factor1: float=.5, factor2: float=None) -> None: +//| def alphablend( +//| dest_bitmap: displayio.Bitmap, +//| source_bitmap_1: displayio.Bitmap, +//| source_bitmap_2: displayio.Bitmap, +//| colorspace: displayio.Colorspace, +//| factor1: float = 0.5, +//| factor2: Optional[float] = None, +//| ) -> None: //| """Alpha blend the two source bitmaps into the destination. //| //| It is permitted for the destination bitmap to be one of the two @@ -337,23 +357,20 @@ STATIC mp_obj_t bitmaptools_alphablend(size_t n_args, const mp_obj_t *pos_args, } MP_DEFINE_CONST_FUN_OBJ_KW(bitmaptools_alphablend_obj, 0, bitmaptools_alphablend); -//| //| def fill_region( -//| dest_bitmap: displayio.Bitmap, -//| x1: int, y1: int, -//| x2: int, y2: int, -//| value: int) -> None: -//| """Draws the color value into the destination bitmap within the -//| rectangular region bounded by (x1,y1) and (x2,y2), exclusive. +//| dest_bitmap: displayio.Bitmap, x1: int, y1: int, x2: int, y2: int, value: int +//| ) -> None: +//| """Draws the color value into the destination bitmap within the +//| rectangular region bounded by (x1,y1) and (x2,y2), exclusive. //| -//| :param bitmap dest_bitmap: Destination bitmap that will be written into -//| :param int x1: x-pixel position of the first corner of the rectangular fill region -//| :param int y1: y-pixel position of the first corner of the rectangular fill region -//| :param int x2: x-pixel position of the second corner of the rectangular fill region (exclusive) -//| :param int y2: y-pixel position of the second corner of the rectangular fill region (exclusive) -//| :param int value: Bitmap palette index that will be written into the rectangular -//| fill region in the destination bitmap""" -//| ... +//| :param bitmap dest_bitmap: Destination bitmap that will be written into +//| :param int x1: x-pixel position of the first corner of the rectangular fill region +//| :param int y1: y-pixel position of the first corner of the rectangular fill region +//| :param int x2: x-pixel position of the second corner of the rectangular fill region (exclusive) +//| :param int y2: y-pixel position of the second corner of the rectangular fill region (exclusive) +//| :param int value: Bitmap palette index that will be written into the rectangular +//| fill region in the destination bitmap""" +//| ... //| STATIC mp_obj_t bitmaptools_obj_fill_region(size_t n_args, const mp_obj_t *pos_args, mp_map_t *kw_args) { enum {ARG_dest_bitmap, ARG_x1, ARG_y1, ARG_x2, ARG_y2, ARG_value}; @@ -389,23 +406,25 @@ STATIC mp_obj_t bitmaptools_obj_fill_region(size_t n_args, const mp_obj_t *pos_a } MP_DEFINE_CONST_FUN_OBJ_KW(bitmaptools_fill_region_obj, 0, bitmaptools_obj_fill_region); -//| //| def boundary_fill( -//| dest_bitmap: displayio.Bitmap, -//| x: int, y: int, -//| fill_color_value: int, replaced_color_value: int) -> None: -//| """Draws the color value into the destination bitmap enclosed -//| area of pixels of the background_value color. Like "Paint Bucket" -//| fill tool. +//| dest_bitmap: displayio.Bitmap, +//| x: int, +//| y: int, +//| fill_color_value: int, +//| replaced_color_value: int, +//| ) -> None: +//| """Draws the color value into the destination bitmap enclosed +//| area of pixels of the background_value color. Like "Paint Bucket" +//| fill tool. //| -//| :param bitmap dest_bitmap: Destination bitmap that will be written into -//| :param int x: x-pixel position of the first pixel to check and fill if needed -//| :param int y: y-pixel position of the first pixel to check and fill if needed -//| :param int fill_color_value: Bitmap palette index that will be written into the -//| enclosed area in the destination bitmap -//| :param int replaced_color_value: Bitmap palette index that will filled with the -//| value color in the enclosed area in the destination bitmap""" -//| ... +//| :param bitmap dest_bitmap: Destination bitmap that will be written into +//| :param int x: x-pixel position of the first pixel to check and fill if needed +//| :param int y: y-pixel position of the first pixel to check and fill if needed +//| :param int fill_color_value: Bitmap palette index that will be written into the +//| enclosed area in the destination bitmap +//| :param int replaced_color_value: Bitmap palette index that will filled with the +//| value color in the enclosed area in the destination bitmap""" +//| ... //| STATIC mp_obj_t bitmaptools_obj_boundary_fill(size_t n_args, const mp_obj_t *pos_args, mp_map_t *kw_args) { enum {ARG_dest_bitmap, ARG_x, ARG_y, ARG_fill_color_value, ARG_replaced_color_value}; @@ -453,22 +472,19 @@ STATIC mp_obj_t bitmaptools_obj_boundary_fill(size_t n_args, const mp_obj_t *pos MP_DEFINE_CONST_FUN_OBJ_KW(bitmaptools_boundary_fill_obj, 0, bitmaptools_obj_boundary_fill); // requires all 6 arguments -//| //| def draw_line( -//| dest_bitmap: displayio.Bitmap, -//| x1: int, y1: int, -//| x2: int, y2: int, -//| value: int) -> None: -//| """Draws a line into a bitmap specified two endpoints (x1,y1) and (x2,y2). +//| dest_bitmap: displayio.Bitmap, x1: int, y1: int, x2: int, y2: int, value: int +//| ) -> None: +//| """Draws a line into a bitmap specified two endpoints (x1,y1) and (x2,y2). //| -//| :param bitmap dest_bitmap: Destination bitmap that will be written into -//| :param int x1: x-pixel position of the line's first endpoint -//| :param int y1: y-pixel position of the line's first endpoint -//| :param int x2: x-pixel position of the line's second endpoint -//| :param int y2: y-pixel position of the line's second endpoint -//| :param int value: Bitmap palette index that will be written into the -//| line in the destination bitmap""" -//| ... +//| :param bitmap dest_bitmap: Destination bitmap that will be written into +//| :param int x1: x-pixel position of the line's first endpoint +//| :param int y1: y-pixel position of the line's first endpoint +//| :param int x2: x-pixel position of the line's second endpoint +//| :param int y2: y-pixel position of the line's second endpoint +//| :param int value: Bitmap palette index that will be written into the +//| line in the destination bitmap""" +//| ... //| STATIC mp_obj_t bitmaptools_obj_draw_line(size_t n_args, const mp_obj_t *pos_args, mp_map_t *kw_args) { enum {ARG_dest_bitmap, ARG_x1, ARG_y1, ARG_x2, ARG_y2, ARG_value}; @@ -513,7 +529,15 @@ STATIC mp_obj_t bitmaptools_obj_draw_line(size_t n_args, const mp_obj_t *pos_arg MP_DEFINE_CONST_FUN_OBJ_KW(bitmaptools_draw_line_obj, 0, bitmaptools_obj_draw_line); // requires all 6 arguments -//| def arrayblit(bitmap: displayio.Bitmap, data: ReadableBuffer, x1: int=0, y1: int=0, x2: Optional[int]=None, y2: Optional[int]=None, skip_index:Optional[int]=None) -> None: +//| def arrayblit( +//| bitmap: displayio.Bitmap, +//| data: ReadableBuffer, +//| x1: int = 0, +//| y1: int = 0, +//| x2: Optional[int] = None, +//| y2: Optional[int] = None, +//| skip_index: Optional[int] = None, +//| ) -> None: //| """Inserts pixels from ``data`` into the rectangle of width×height pixels with the upper left corner at ``(x,y)`` //| //| The values from ``data`` are taken modulo the number of color values @@ -587,7 +611,15 @@ STATIC mp_obj_t bitmaptools_arrayblit(size_t n_args, const mp_obj_t *pos_args, m MP_DEFINE_CONST_FUN_OBJ_KW(bitmaptools_arrayblit_obj, 0, bitmaptools_arrayblit); -//| def readinto(bitmap: displayio.Bitmap, file: typing.BinaryIO, bits_per_pixel: int, element_size: int = 1, reverse_pixels_in_element: bool = False, swap_bytes_in_element: bool = False, reverse_rows: bool = False) -> None: +//| def readinto( +//| bitmap: displayio.Bitmap, +//| file: typing.BinaryIO, +//| bits_per_pixel: int, +//| element_size: int = 1, +//| reverse_pixels_in_element: bool = False, +//| swap_bytes_in_element: bool = False, +//| reverse_rows: bool = False, +//| ) -> None: //| """Reads from a binary file into a bitmap. //| //| The file must be positioned so that it consists of ``bitmap.height`` rows of pixel data, where each row is the smallest multiple of ``element_size`` bytes that can hold ``bitmap.width`` pixels. @@ -682,7 +714,12 @@ MAKE_PRINTER(bitmaptools, bitmaptools_dither_algorithm); MAKE_ENUM_TYPE(bitmaptools, DitherAlgorithm, bitmaptools_dither_algorithm); -//| def dither(dest_bitmap: displayio.Bitmap, source_bitmapp: displayio.Bitmap, source_colorspace: displayio.Colorspace, algorithm: DitherAlgorithm=DitherAlgorithm.Atkinson) -> None: +//| def dither( +//| dest_bitmap: displayio.Bitmap, +//| source_bitmapp: displayio.Bitmap, +//| source_colorspace: displayio.Colorspace, +//| algorithm: DitherAlgorithm = DitherAlgorithm.Atkinson, +//| ) -> None: //| """Convert the input image into a 2-level output image using the given dither algorithm. //| //| :param bitmap dest_bitmap: Destination bitmap. It must have a value_count of 2 or 65536. The stored values are 0 and the maximum pixel value. diff --git a/shared-bindings/bitops/__init__.c b/shared-bindings/bitops/__init__.c index 5b455dcb0f..ea4e70ae3a 100644 --- a/shared-bindings/bitops/__init__.c +++ b/shared-bindings/bitops/__init__.c @@ -30,11 +30,11 @@ #include "shared-bindings/bitops/__init__.h" //| """Routines for low-level manipulation of binary data""" -//| -//| -//| def bit_transpose(input: ReadableBuffer, output: WriteableBuffer, width:int = 8) -> WriteableBuffer: -//| """"Transpose" a buffer by assembling each output byte with bits taken from each of ``width`` different input bytes. +//| def bit_transpose( +//| input: ReadableBuffer, output: WriteableBuffer, width: int = 8 +//| ) -> WriteableBuffer: +//| """ "Transpose" a buffer by assembling each output byte with bits taken from each of ``width`` different input bytes. //| //| This can be useful to convert a sequence of pixel values into a single //| stream of bytes suitable for sending via a parallel conversion method. @@ -53,6 +53,7 @@ //| //| Returns the output buffer.""" //| ... +//| STATIC mp_obj_t bit_transpose(size_t n_args, const mp_obj_t *pos_args, mp_map_t *kw_args) { enum { ARG_input, ARG_output, ARG_width }; @@ -64,10 +65,7 @@ STATIC mp_obj_t bit_transpose(size_t n_args, const mp_obj_t *pos_args, mp_map_t mp_arg_val_t args[MP_ARRAY_SIZE(allowed_args)]; mp_arg_parse_all(n_args, pos_args, kw_args, MP_ARRAY_SIZE(allowed_args), allowed_args, args); - int width = args[ARG_width].u_int; - if (width < 2 || width > 8) { - mp_raise_ValueError_varg(translate("width must be from 2 to 8 (inclusive), not %d"), width); - } + mp_int_t width = mp_arg_validate_int_range(args[ARG_width].u_int, 2, 8, MP_QSTR_width); mp_buffer_info_t input_bufinfo; mp_get_buffer_raise(args[ARG_input].u_obj, &input_bufinfo, MP_BUFFER_READ); @@ -80,9 +78,9 @@ STATIC mp_obj_t bit_transpose(size_t n_args, const mp_obj_t *pos_args, mp_map_t mp_get_buffer_raise(args[ARG_output].u_obj, &output_bufinfo, MP_BUFFER_WRITE); int avail = output_bufinfo.len; int outlen = 8 * (inlen / width); - if (avail < outlen) { - mp_raise_ValueError_varg(translate("Output buffer must be at least %d bytes"), outlen); - } + + mp_arg_validate_length_min(avail, outlen, MP_QSTR_output); + common_hal_bitops_bit_transpose(output_bufinfo.buf, input_bufinfo.buf, inlen, width); return args[ARG_output].u_obj; } diff --git a/shared-bindings/busio/I2C.c b/shared-bindings/busio/I2C.c index 2d67281df0..71ac0e3995 100644 --- a/shared-bindings/busio/I2C.c +++ b/shared-bindings/busio/I2C.c @@ -34,12 +34,19 @@ #include "shared/runtime/buffer_helper.h" #include "shared/runtime/context_manager_helpers.h" #include "py/runtime.h" -#include "supervisor/shared/translate.h" +#include "supervisor/shared/translate/translate.h" //| class I2C: //| """Two wire serial protocol""" //| -//| def __init__(self, scl: microcontroller.Pin, sda: microcontroller.Pin, *, frequency: int = 100000, timeout: int = 255) -> None: +//| def __init__( +//| self, +//| scl: microcontroller.Pin, +//| sda: microcontroller.Pin, +//| *, +//| frequency: int = 100000, +//| timeout: int = 255 +//| ) -> None: //| //| """I2C is a two-wire protocol for communicating between devices. At the //| physical level it consists of 2 wires: SCL and SDA, the clock and data @@ -60,7 +67,6 @@ //| :class:`bitbangio.I2C`; ignored for :class:`busio.I2C`) //| """ //| ... -//| STATIC mp_obj_t busio_i2c_make_new(const mp_obj_type_t *type, size_t n_args, size_t n_kw, const mp_obj_t *all_args) { busio_i2c_obj_t *self = m_new_obj(busio_i2c_obj_t); self->base.type = &busio_i2c_type; @@ -84,7 +90,6 @@ STATIC mp_obj_t busio_i2c_make_new(const mp_obj_type_t *type, size_t n_args, siz //| def deinit(self) -> None: //| """Releases control of the underlying hardware so other classes can use it.""" //| ... -//| STATIC mp_obj_t busio_i2c_obj_deinit(mp_obj_t self_in) { busio_i2c_obj_t *self = MP_OBJ_TO_PTR(self_in); common_hal_busio_i2c_deinit(self); @@ -101,14 +106,12 @@ STATIC void check_for_deinit(busio_i2c_obj_t *self) { //| def __enter__(self) -> I2C: //| """No-op used in Context Managers.""" //| ... -//| // Provided by context manager helper. //| def __exit__(self) -> None: //| """Automatically deinitializes the hardware on context exit. See //| :ref:`lifetime-and-contextmanagers` for more info.""" //| ... -//| STATIC mp_obj_t busio_i2c_obj___exit__(size_t n_args, const mp_obj_t *args) { (void)n_args; common_hal_busio_i2c_deinit(MP_OBJ_TO_PTR(args[0])); @@ -130,7 +133,6 @@ static void check_lock(busio_i2c_obj_t *self) { //| :return: List of device ids on the I2C bus //| :rtype: list""" //| ... -//| STATIC mp_obj_t busio_i2c_scan(mp_obj_t self_in) { busio_i2c_obj_t *self = MP_OBJ_TO_PTR(self_in); check_for_deinit(self); @@ -153,7 +155,6 @@ MP_DEFINE_CONST_FUN_OBJ_1(busio_i2c_scan_obj, busio_i2c_scan); //| :return: True when lock has been grabbed //| :rtype: bool""" //| ... -//| STATIC mp_obj_t busio_i2c_obj_try_lock(mp_obj_t self_in) { busio_i2c_obj_t *self = MP_OBJ_TO_PTR(self_in); check_for_deinit(self); @@ -164,7 +165,6 @@ MP_DEFINE_CONST_FUN_OBJ_1(busio_i2c_try_lock_obj, busio_i2c_obj_try_lock); //| def unlock(self) -> None: //| """Releases the I2C lock.""" //| ... -//| STATIC mp_obj_t busio_i2c_obj_unlock(mp_obj_t self_in) { busio_i2c_obj_t *self = MP_OBJ_TO_PTR(self_in); check_for_deinit(self); @@ -174,7 +174,9 @@ STATIC mp_obj_t busio_i2c_obj_unlock(mp_obj_t self_in) { MP_DEFINE_CONST_FUN_OBJ_1(busio_i2c_unlock_obj, busio_i2c_obj_unlock); //| import sys -//| def readfrom_into(self, address: int, buffer: WriteableBuffer, *, start: int = 0, end: int = sys.maxsize) -> None: +//| def readfrom_into( +//| self, address: int, buffer: WriteableBuffer, *, start: int = 0, end: int = sys.maxsize +//| ) -> None: //| """Read into ``buffer`` from the device selected by ``address``. //| At least one byte must be read. //| @@ -187,7 +189,6 @@ MP_DEFINE_CONST_FUN_OBJ_1(busio_i2c_unlock_obj, busio_i2c_obj_unlock); //| :param int start: beginning of buffer slice //| :param int end: end of buffer slice; if not specified, use ``len(buffer)``""" //| ... -//| STATIC mp_obj_t busio_i2c_readfrom_into(size_t n_args, const mp_obj_t *pos_args, mp_map_t *kw_args) { enum { ARG_address, ARG_buffer, ARG_start, ARG_end }; static const mp_arg_t allowed_args[] = { @@ -210,9 +211,7 @@ STATIC mp_obj_t busio_i2c_readfrom_into(size_t n_args, const mp_obj_t *pos_args, int32_t start = args[ARG_start].u_int; const int32_t end = args[ARG_end].u_int; normalize_buffer_bounds(&start, end, &length); - if (length == 0) { - mp_raise_ValueError_varg(translate("%q length must be >= 1"), MP_QSTR_buffer); - } + mp_arg_validate_length_min(length, 1, MP_QSTR_buffer); uint8_t status = common_hal_busio_i2c_read(self, args[ARG_address].u_int, ((uint8_t *)bufinfo.buf) + start, length); @@ -225,7 +224,9 @@ STATIC mp_obj_t busio_i2c_readfrom_into(size_t n_args, const mp_obj_t *pos_args, MP_DEFINE_CONST_FUN_OBJ_KW(busio_i2c_readfrom_into_obj, 1, busio_i2c_readfrom_into); //| import sys -//| def writeto(self, address: int, buffer: ReadableBuffer, *, start: int = 0, end: int = sys.maxsize) -> None: +//| def writeto( +//| self, address: int, buffer: ReadableBuffer, *, start: int = 0, end: int = sys.maxsize +//| ) -> None: //| """Write the bytes from ``buffer`` to the device selected by ``address`` and //| then transmit a stop bit. //| @@ -242,7 +243,6 @@ MP_DEFINE_CONST_FUN_OBJ_KW(busio_i2c_readfrom_into_obj, 1, busio_i2c_readfrom_in //| :param int end: end of buffer slice; if not specified, use ``len(buffer)`` //| """ //| ... -//| STATIC mp_obj_t busio_i2c_writeto(size_t n_args, const mp_obj_t *pos_args, mp_map_t *kw_args) { enum { ARG_address, ARG_buffer, ARG_start, ARG_end }; static const mp_arg_t allowed_args[] = { @@ -279,7 +279,17 @@ STATIC mp_obj_t busio_i2c_writeto(size_t n_args, const mp_obj_t *pos_args, mp_ma STATIC MP_DEFINE_CONST_FUN_OBJ_KW(busio_i2c_writeto_obj, 1, busio_i2c_writeto); //| import sys -//| def writeto_then_readfrom(self, address: int, out_buffer: ReadableBuffer, in_buffer: WriteableBuffer, *, out_start: int = 0, out_end: int = sys.maxsize, in_start: int = 0, in_end: int = sys.maxsize) -> None: +//| def writeto_then_readfrom( +//| self, +//| address: int, +//| out_buffer: ReadableBuffer, +//| in_buffer: WriteableBuffer, +//| *, +//| out_start: int = 0, +//| out_end: int = sys.maxsize, +//| in_start: int = 0, +//| in_end: int = sys.maxsize +//| ) -> None: //| """Write the bytes from ``out_buffer`` to the device selected by ``address``, generate no stop //| bit, generate a repeated start and read into ``in_buffer``. ``out_buffer`` and //| ``in_buffer`` can be the same buffer because they are used sequentially. @@ -291,7 +301,7 @@ STATIC MP_DEFINE_CONST_FUN_OBJ_KW(busio_i2c_writeto_obj, 1, busio_i2c_writeto); //| If ``in_start`` or ``in_end`` is provided, then the input buffer will be sliced //| as if ``in_buffer[in_start:in_end]`` were passed, //| The number of bytes read will be the length of ``out_buffer[in_start:in_end]``. - +//| //| :param int address: 7-bit device address //| :param ~circuitpython_typing.ReadableBuffer out_buffer: buffer containing the bytes to write //| :param ~circuitpython_typing.WriteableBuffer in_buffer: buffer to write into diff --git a/shared-bindings/busio/SPI.c b/shared-bindings/busio/SPI.c index 0a6c32f20b..4826797ee2 100644 --- a/shared-bindings/busio/SPI.c +++ b/shared-bindings/busio/SPI.c @@ -38,7 +38,7 @@ #include "py/mperrno.h" #include "py/objproperty.h" #include "py/runtime.h" -#include "supervisor/shared/translate.h" +#include "supervisor/shared/translate/translate.h" //| class SPI: @@ -53,7 +53,13 @@ //| multiple secondaries can share the `!clock`, `!MOSI` and `!MISO` lines //| and therefore the hardware.)""" //| -//| def __init__(self, clock: microcontroller.Pin, MOSI: Optional[microcontroller.Pin] = None, MISO: Optional[microcontroller.Pin] = None, half_duplex: bool = False) -> None: +//| def __init__( +//| self, +//| clock: microcontroller.Pin, +//| MOSI: Optional[microcontroller.Pin] = None, +//| MISO: Optional[microcontroller.Pin] = None, +//| half_duplex: bool = False, +//| ) -> None: //| //| """Construct an SPI object on the given pins. //| @@ -77,7 +83,6 @@ //| :param ~microcontroller.Pin MISO: the Main In Selected Out pin. //| :param bool half_duplex: True when MOSI is used for bidirectional data. False when SPI is full-duplex or simplex.""" //| ... -//| // TODO(tannewt): Support LSB SPI. @@ -106,7 +111,7 @@ STATIC mp_obj_t busio_spi_make_new(const mp_obj_type_t *type, size_t n_args, siz common_hal_busio_spi_construct(self, clock, mosi, miso, args[ARG_half_duplex].u_bool); return MP_OBJ_FROM_PTR(self); #else - mp_raise_ValueError(translate("Invalid pins")); + raise_ValueError_invalid_pins(); #endif // CIRCUITPY_BUSIO_SPI } @@ -114,7 +119,6 @@ STATIC mp_obj_t busio_spi_make_new(const mp_obj_type_t *type, size_t n_args, siz //| def deinit(self) -> None: //| """Turn off the SPI bus.""" //| ... -//| STATIC mp_obj_t busio_spi_obj_deinit(mp_obj_t self_in) { busio_spi_obj_t *self = MP_OBJ_TO_PTR(self_in); common_hal_busio_spi_deinit(self); @@ -126,13 +130,11 @@ MP_DEFINE_CONST_FUN_OBJ_1(busio_spi_deinit_obj, busio_spi_obj_deinit); //| """No-op used by Context Managers. //| Provided by context manager helper.""" //| ... -//| //| def __exit__(self) -> None: //| """Automatically deinitializes the hardware when exiting a context. See //| :ref:`lifetime-and-contextmanagers` for more info.""" //| ... -//| STATIC mp_obj_t busio_spi_obj___exit__(size_t n_args, const mp_obj_t *args) { (void)n_args; common_hal_busio_spi_deinit(MP_OBJ_TO_PTR(args[0])); @@ -153,7 +155,9 @@ STATIC void check_for_deinit(busio_spi_obj_t *self) { } } -//| def configure(self, *, baudrate: int = 100000, polarity: int = 0, phase: int = 0, bits: int = 8) -> None: +//| def configure( +//| self, *, baudrate: int = 100000, polarity: int = 0, phase: int = 0, bits: int = 8 +//| ) -> None: //| """Configures the SPI bus. The SPI object must be locked. //| //| :param int baudrate: the desired clock rate in Hertz. The actual clock rate may be higher or lower @@ -175,7 +179,6 @@ STATIC void check_for_deinit(busio_spi_obj_t *self) { //| Two SPI objects may be created, except on the Circuit Playground Bluefruit, //| which allows only one (to allow for an additional I2C object).""" //| ... -//| STATIC mp_obj_t busio_spi_configure(size_t n_args, const mp_obj_t *pos_args, mp_map_t *kw_args) { enum { ARG_baudrate, ARG_polarity, ARG_phase, ARG_bits }; @@ -191,18 +194,9 @@ STATIC mp_obj_t busio_spi_configure(size_t n_args, const mp_obj_t *pos_args, mp_ mp_arg_val_t args[MP_ARRAY_SIZE(allowed_args)]; mp_arg_parse_all(n_args - 1, pos_args + 1, kw_args, MP_ARRAY_SIZE(allowed_args), allowed_args, args); - uint8_t polarity = args[ARG_polarity].u_int; - if (polarity != 0 && polarity != 1) { - mp_raise_ValueError(translate("Invalid polarity")); - } - uint8_t phase = args[ARG_phase].u_int; - if (phase != 0 && phase != 1) { - mp_raise_ValueError(translate("Invalid phase")); - } - uint8_t bits = args[ARG_bits].u_int; - if (bits != 8 && bits != 9) { - mp_raise_ValueError(translate("Invalid number of bits")); - } + uint8_t polarity = (uint8_t)mp_arg_validate_int_range(args[ARG_polarity].u_int, 0, 1, MP_QSTR_polarity); + uint8_t phase = (uint8_t)mp_arg_validate_int_range(args[ARG_phase].u_int, 0, 1, MP_QSTR_phase); + uint8_t bits = (uint8_t)mp_arg_validate_int_range(args[ARG_bits].u_int, 8, 9, MP_QSTR_bits); if (!common_hal_busio_spi_configure(self, args[ARG_baudrate].u_int, polarity, phase, bits)) { @@ -218,7 +212,6 @@ MP_DEFINE_CONST_FUN_OBJ_KW(busio_spi_configure_obj, 1, busio_spi_configure); //| :return: True when lock has been grabbed //| :rtype: bool""" //| ... -//| STATIC mp_obj_t busio_spi_obj_try_lock(mp_obj_t self_in) { busio_spi_obj_t *self = MP_OBJ_TO_PTR(self_in); @@ -229,7 +222,6 @@ MP_DEFINE_CONST_FUN_OBJ_1(busio_spi_try_lock_obj, busio_spi_obj_try_lock); //| def unlock(self) -> None: //| """Releases the SPI lock.""" //| ... -//| STATIC mp_obj_t busio_spi_obj_unlock(mp_obj_t self_in) { busio_spi_obj_t *self = MP_OBJ_TO_PTR(self_in); @@ -253,7 +245,6 @@ MP_DEFINE_CONST_FUN_OBJ_1(busio_spi_unlock_obj, busio_spi_obj_unlock); //| :param int end: end of buffer slice; if not specified, use ``len(buffer)`` //| """ //| ... -//| STATIC mp_obj_t busio_spi_write(size_t n_args, const mp_obj_t *pos_args, mp_map_t *kw_args) { enum { ARG_buffer, ARG_start, ARG_end }; @@ -288,7 +279,14 @@ MP_DEFINE_CONST_FUN_OBJ_KW(busio_spi_write_obj, 1, busio_spi_write); //| import sys -//| def readinto(self, buffer: WriteableBuffer, *, start: int = 0, end: int = sys.maxsize, write_value: int = 0) -> None: +//| def readinto( +//| self, +//| buffer: WriteableBuffer, +//| *, +//| start: int = 0, +//| end: int = sys.maxsize, +//| write_value: int = 0 +//| ) -> None: //| """Read into ``buffer`` while writing ``write_value`` for each byte read. //| The SPI object must be locked. //| If the number of bytes to read is 0, nothing happens. @@ -305,7 +303,6 @@ MP_DEFINE_CONST_FUN_OBJ_KW(busio_spi_write_obj, 1, busio_spi_write); //| :param int write_value: value to write while reading //| """ //| ... -//| STATIC mp_obj_t busio_spi_readinto(size_t n_args, const mp_obj_t *pos_args, mp_map_t *kw_args) { enum { ARG_buffer, ARG_start, ARG_end, ARG_write_value }; @@ -340,7 +337,16 @@ STATIC mp_obj_t busio_spi_readinto(size_t n_args, const mp_obj_t *pos_args, mp_m MP_DEFINE_CONST_FUN_OBJ_KW(busio_spi_readinto_obj, 1, busio_spi_readinto); //| import sys -//| def write_readinto(self, out_buffer: ReadableBuffer, in_buffer: WriteableBuffer, *, out_start: int = 0, out_end: int = sys.maxsize, in_start: int = 0, in_end: int = sys.maxsize) -> None: +//| def write_readinto( +//| self, +//| out_buffer: ReadableBuffer, +//| in_buffer: WriteableBuffer, +//| *, +//| out_start: int = 0, +//| out_end: int = sys.maxsize, +//| in_start: int = 0, +//| in_end: int = sys.maxsize +//| ) -> None: //| """Write out the data in ``out_buffer`` while simultaneously reading data into ``in_buffer``. //| The SPI object must be locked. //| @@ -364,7 +370,6 @@ MP_DEFINE_CONST_FUN_OBJ_KW(busio_spi_readinto_obj, 1, busio_spi_readinto); //| :param int in_end: end of ``in_buffer slice``; if not specified, use ``len(in_buffer)`` //| """ //| ... -//| STATIC mp_obj_t busio_spi_write_readinto(size_t n_args, const mp_obj_t *pos_args, mp_map_t *kw_args) { enum { ARG_out_buffer, ARG_in_buffer, ARG_out_start, ARG_out_end, ARG_in_start, ARG_in_end }; diff --git a/shared-bindings/busio/UART.c b/shared-bindings/busio/UART.c index ae14e314af..a65984c3fb 100644 --- a/shared-bindings/busio/UART.c +++ b/shared-bindings/busio/UART.c @@ -38,14 +38,26 @@ #include "py/objtype.h" #include "py/runtime.h" #include "py/stream.h" -#include "supervisor/shared/translate.h" +#include "supervisor/shared/translate/translate.h" #define STREAM_DEBUG(...) (void)0 // #define STREAM_DEBUG(...) mp_printf(&mp_plat_print __VA_OPT__(,) __VA_ARGS__) //| class UART: //| """A bidirectional serial protocol""" -//| def __init__(self, tx: microcontroller.Pin, rx: microcontroller.Pin, *, baudrate: int = 9600, bits: int = 8, parity: Optional[Parity] = None, stop: int = 1, timeout: float = 1, receiver_buffer_size: int = 64) -> None: +//| +//| def __init__( +//| self, +//| tx: microcontroller.Pin, +//| rx: microcontroller.Pin, +//| *, +//| baudrate: int = 9600, +//| bits: int = 8, +//| parity: Optional[Parity] = None, +//| stop: int = 1, +//| timeout: float = 1, +//| receiver_buffer_size: int = 64 +//| ) -> None: //| """A common bidirectional serial protocol that uses an an agreed upon speed //| rather than a shared clock line. //| @@ -70,7 +82,6 @@ //| RS485 specifications intermittently. //| """ //| ... -//| typedef struct { mp_obj_base_t base; } busio_uart_parity_obj_t; @@ -113,10 +124,7 @@ STATIC mp_obj_t busio_uart_make_new(const mp_obj_type_t *type, size_t n_args, si mp_raise_ValueError(translate("tx and rx cannot both be None")); } - if (args[ARG_bits].u_int < 5 || args[ARG_bits].u_int > 9) { - mp_raise_ValueError(translate("bits must be in range 5 to 9")); - } - uint8_t bits = args[ARG_bits].u_int; + uint8_t bits = (uint8_t)mp_arg_validate_int_range(args[ARG_bits].u_int, 5, 9, MP_QSTR_bits); busio_uart_parity_t parity = BUSIO_UART_PARITY_NONE; if (args[ARG_parity].u_obj == MP_OBJ_FROM_PTR(&busio_uart_parity_even_obj)) { @@ -125,10 +133,7 @@ STATIC mp_obj_t busio_uart_make_new(const mp_obj_type_t *type, size_t n_args, si parity = BUSIO_UART_PARITY_ODD; } - uint8_t stop = args[ARG_stop].u_int; - if (stop != 1 && stop != 2) { - mp_raise_ValueError(translate("stop must be 1 or 2")); - } + uint8_t stop = (uint8_t)mp_arg_validate_int_range(args[ARG_stop].u_int, 1, 2, MP_QSTR_stop); mp_float_t timeout = mp_obj_get_float(args[ARG_timeout].u_obj); validate_timeout(timeout); @@ -171,7 +176,6 @@ STATIC busio_uart_obj_t *native_uart(mp_obj_t uart_obj) { //| def deinit(self) -> None: //| """Deinitialises the UART and releases any hardware resources for reuse.""" //| ... -//| STATIC mp_obj_t busio_uart_obj_deinit(mp_obj_t self_in) { busio_uart_obj_t *self = native_uart(self_in); common_hal_busio_uart_deinit(self); @@ -188,14 +192,12 @@ STATIC void check_for_deinit(busio_uart_obj_t *self) { //| def __enter__(self) -> UART: //| """No-op used by Context Managers.""" //| ... -//| // Provided by context manager helper. //| def __exit__(self) -> None: //| """Automatically deinitializes the hardware when exiting a context. See //| :ref:`lifetime-and-contextmanagers` for more info.""" //| ... -//| STATIC mp_obj_t busio_uart_obj___exit__(size_t n_args, const mp_obj_t *args) { (void)n_args; common_hal_busio_uart_deinit(MP_OBJ_TO_PTR(args[0])); @@ -206,15 +208,18 @@ STATIC MP_DEFINE_CONST_FUN_OBJ_VAR_BETWEEN(busio_uart___exit___obj, 4, 4, busio_ // These are standard stream methods. Code is in py/stream.c. // //| def read(self, nbytes: Optional[int] = None) -> Optional[bytes]: -//| """Read characters. If ``nbytes`` is specified then read at most that many +//| """Read bytes. If ``nbytes`` is specified then read at most that many //| bytes. Otherwise, read everything that arrives until the connection //| times out. Providing the number of bytes expected is highly recommended -//| because it will be faster. +//| because it will be faster. If no bytes are read, return ``None``. +//| +//| .. note:: When no bytes are read due to a timeout, this function returns ``None``. +//| This matches the behavior of `io.RawIOBase.read` in Python 3, but +//| differs from pyserial which returns ``b''`` in that situation. //| //| :return: Data read //| :rtype: bytes or None""" //| ... -//| //| def readinto(self, buf: WriteableBuffer) -> Optional[int]: //| """Read bytes into the ``buf``. Read at most ``len(buf)`` bytes. @@ -224,27 +229,25 @@ STATIC MP_DEFINE_CONST_FUN_OBJ_VAR_BETWEEN(busio_uart___exit___obj, 4, 4, busio_ //| //| *New in CircuitPython 4.0:* No length parameter is permitted.""" //| ... -//| //| def readline(self) -> bytes: //| """Read a line, ending in a newline character, or -//| return None if a timeout occurs sooner, or -//| return everything readable if no newline is found and timeout=0 +//| return ``None`` if a timeout occurs sooner, or +//| return everything readable if no newline is found and +//| ``timeout=0`` //| //| :return: the line read //| :rtype: bytes or None""" //| ... -//| -//| def write(self, buf: WriteableBuffer) -> Optional[int]: +//| def write(self, buf: ReadableBuffer) -> Optional[int]: //| """Write the buffer of bytes to the bus. //| -//| *New in CircuitPython 4.0:* ``buf`` must be bytes, not a string. +//| *New in CircuitPython 4.0:* ``buf`` must be bytes, not a string. //| -//| :return: the number of bytes written -//| :rtype: int or None""" +//| :return: the number of bytes written +//| :rtype: int or None""" //| ... -//| // These three methods are used by the shared stream methods. STATIC mp_uint_t busio_uart_read(mp_obj_t self_in, void *buf_in, mp_uint_t size, int *errcode) { @@ -291,7 +294,6 @@ STATIC mp_uint_t busio_uart_ioctl(mp_obj_t self_in, mp_uint_t request, mp_uint_t //| baudrate: int //| """The current baudrate.""" -//| STATIC mp_obj_t busio_uart_obj_get_baudrate(mp_obj_t self_in) { busio_uart_obj_t *self = native_uart(self_in); check_for_deinit(self); @@ -314,7 +316,6 @@ MP_PROPERTY_GETSET(busio_uart_baudrate_obj, //| in_waiting: int //| """The number of bytes in the input buffer, available to be read""" -//| STATIC mp_obj_t busio_uart_obj_get_in_waiting(mp_obj_t self_in) { busio_uart_obj_t *self = native_uart(self_in); check_for_deinit(self); @@ -327,7 +328,6 @@ MP_PROPERTY_GETTER(busio_uart_in_waiting_obj, //| timeout: float //| """The current timeout, in seconds (float).""" -//| STATIC mp_obj_t busio_uart_obj_get_timeout(mp_obj_t self_in) { busio_uart_obj_t *self = native_uart(self_in); check_for_deinit(self); diff --git a/shared-bindings/busio/__init__.c b/shared-bindings/busio/__init__.c index 38bbfaf6ef..4d62c8333e 100644 --- a/shared-bindings/busio/__init__.c +++ b/shared-bindings/busio/__init__.c @@ -34,9 +34,6 @@ #include "shared-bindings/busio/I2C.h" #include "shared-bindings/busio/SPI.h" #include "shared-bindings/busio/UART.h" -#if CIRCUITPY_ONEWIREIO -#include "shared-bindings/onewireio/OneWire.h" -#endif #include "py/runtime.h" @@ -81,15 +78,11 @@ //| Tutorial for UART: //| https://learn.adafruit.com/circuitpython-essentials/circuitpython-uart-serial //| """ -//| STATIC const mp_rom_map_elem_t busio_module_globals_table[] = { { MP_ROM_QSTR(MP_QSTR___name__), MP_ROM_QSTR(MP_QSTR_busio) }, { MP_ROM_QSTR(MP_QSTR_I2C), MP_ROM_PTR(&busio_i2c_type) }, { MP_ROM_QSTR(MP_QSTR_SPI), MP_ROM_PTR(&busio_spi_type) }, - #if CIRCUITPY_ONEWIREIO - { MP_ROM_QSTR(MP_QSTR_OneWire), MP_ROM_PTR(&onewireio_onewire_type) }, - #endif { MP_ROM_QSTR(MP_QSTR_UART), MP_ROM_PTR(&busio_uart_type) }, }; diff --git a/shared-bindings/camera/Camera.c b/shared-bindings/camera/Camera.c index f7bc9eec6a..4f6023c9fd 100644 --- a/shared-bindings/camera/Camera.c +++ b/shared-bindings/camera/Camera.c @@ -60,7 +60,6 @@ //| def __init__(self) -> None: //| """Initialize camera.""" //| ... -//| STATIC mp_obj_t camera_make_new(const mp_obj_type_t *type, size_t n_args, size_t n_kw, const mp_obj_t *all_args) { camera_obj_t *self = m_new_obj(camera_obj_t); self->base.type = &camera_type; @@ -74,7 +73,6 @@ STATIC mp_obj_t camera_make_new(const mp_obj_type_t *type, size_t n_args, size_t //| def deinit(self) -> None: //| """De-initialize camera.""" //| ... -//| STATIC mp_obj_t camera_obj_deinit(mp_obj_t self_in) { camera_obj_t *self = MP_OBJ_TO_PTR(self_in); common_hal_camera_deinit(self); diff --git a/shared-bindings/camera/ImageFormat.c b/shared-bindings/camera/ImageFormat.c index 3ff687b7bf..1a0c3c88d6 100644 --- a/shared-bindings/camera/ImageFormat.c +++ b/shared-bindings/camera/ImageFormat.c @@ -31,7 +31,6 @@ //| //| def __init__(self) -> None: //| """Enum-like class to define the image format.""" -//| //| JPG: ImageFormat //| """JPG format.""" //| diff --git a/shared-bindings/camera/__init__.c b/shared-bindings/camera/__init__.c index 12cebae7db..e4ee263f58 100644 --- a/shared-bindings/camera/__init__.c +++ b/shared-bindings/camera/__init__.c @@ -33,7 +33,6 @@ //| """Support for camera input //| //| The `camera` module contains classes to control the camera and take pictures.""" -//| STATIC const mp_rom_map_elem_t camera_module_globals_table[] = { { MP_ROM_QSTR(MP_QSTR___name__), MP_ROM_QSTR(MP_QSTR_camera) }, { MP_ROM_QSTR(MP_QSTR_Camera), MP_ROM_PTR(&camera_type) }, diff --git a/shared-bindings/canio/CAN.c b/shared-bindings/canio/CAN.c index e8aec7f0a1..b2e85c0244 100644 --- a/shared-bindings/canio/CAN.c +++ b/shared-bindings/canio/CAN.c @@ -37,19 +37,19 @@ #include "py/objproperty.h" #include "py/runtime.h" -//| //| class CAN: //| """CAN bus protocol""" //| -//| def __init__(self, -//| tx: microcontroller.Pin, -//| rx: microcontroller.Pin, -//| *, -//| baudrate: int = 250000, -//| loopback: bool = False, -//| silent: bool = False, -//| auto_restart: bool = False, -//| ) -> None: +//| def __init__( +//| self, +//| tx: microcontroller.Pin, +//| rx: microcontroller.Pin, +//| *, +//| baudrate: int = 250000, +//| 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. @@ -62,7 +62,6 @@ //| :param bool auto_restart: If True, will restart communications after entering bus-off state //| """ //| ... -//| STATIC mp_obj_t canio_can_make_new(const mp_obj_type_t *type, size_t n_args, size_t n_kw, const mp_obj_t *all_args) { enum { ARG_tx, ARG_rx, ARG_baudrate, ARG_loopback, ARG_silent, ARG_auto_restart, NUM_ARGS }; static const mp_arg_t allowed_args[] = { @@ -96,7 +95,6 @@ STATIC mp_obj_t canio_can_make_new(const mp_obj_type_t *type, size_t n_args, siz //| auto_restart: bool //| """If True, will restart communications after entering bus-off state""" -//| STATIC mp_obj_t canio_can_auto_restart_get(mp_obj_t self_in) { canio_can_obj_t *self = MP_OBJ_TO_PTR(self_in); common_hal_canio_can_check_for_deinit(self); @@ -119,7 +117,6 @@ MP_PROPERTY_GETSET(canio_can_auto_restart_obj, //| baudrate: int //| """The baud rate (read-only)""" -//| STATIC mp_obj_t canio_can_baudrate_get(mp_obj_t self_in) { canio_can_obj_t *self = MP_OBJ_TO_PTR(self_in); common_hal_canio_can_check_for_deinit(self); @@ -132,7 +129,6 @@ MP_PROPERTY_GETTER(canio_can_baudrate_obj, //| transmit_error_count: int //| """The number of transmit errors (read-only). Increased for a detected transmission error, decreased for successful transmission. Limited to the range from 0 to 255 inclusive. Also called TEC.""" -//| STATIC mp_obj_t canio_can_transmit_error_count_get(mp_obj_t self_in) { canio_can_obj_t *self = MP_OBJ_TO_PTR(self_in); common_hal_canio_can_check_for_deinit(self); @@ -145,7 +141,6 @@ MP_PROPERTY_GETTER(canio_can_transmit_error_count_obj, //| receive_error_count: int //| """The number of receive errors (read-only). Increased for a detected reception error, decreased for successful reception. Limited to the range from 0 to 255 inclusive. Also called REC.""" -//| STATIC mp_obj_t canio_can_receive_error_count_get(mp_obj_t self_in) { canio_can_obj_t *self = MP_OBJ_TO_PTR(self_in); common_hal_canio_can_check_for_deinit(self); @@ -173,7 +168,6 @@ MP_PROPERTY_GETTER(canio_can_state_obj, //| def restart(self) -> None: //| """If the device is in the bus off state, restart it.""" //| ... -//| STATIC mp_obj_t canio_can_restart(mp_obj_t self_in) { canio_can_obj_t *self = MP_OBJ_TO_PTR(self_in); common_hal_canio_can_check_for_deinit(self); @@ -182,7 +176,9 @@ STATIC mp_obj_t canio_can_restart(mp_obj_t self_in) { } STATIC MP_DEFINE_CONST_FUN_OBJ_1(canio_can_restart_obj, canio_can_restart); -//| def listen(self, matches: Optional[Sequence[Match]]=None, *, timeout: float=10) -> Listener: +//| def listen( +//| self, matches: Optional[Sequence[Match]] = None, *, timeout: float = 10 +//| ) -> Listener: //| """Start receiving messages that match any one of the filters. //| //| Creating a listener is an expensive operation and can interfere with reception of messages by other listeners. @@ -214,7 +210,6 @@ STATIC MP_DEFINE_CONST_FUN_OBJ_1(canio_can_restart_obj, canio_can_restart); //| standard address with mask or an extended address with mask. //| """ //| ... -//| STATIC mp_obj_t canio_can_listen(size_t n_args, const mp_obj_t *pos_args, mp_map_t *kw_args) { canio_can_obj_t *self = MP_OBJ_TO_PTR(pos_args[0]); common_hal_canio_can_check_for_deinit(self); @@ -256,7 +251,6 @@ MP_DEFINE_CONST_FUN_OBJ_KW(canio_can_listen_obj, 1, canio_can_listen); //| loopback: bool //| """True if the device was created in loopback mode, False //| otherwise (read-only)""" -//| STATIC mp_obj_t canio_can_loopback_get(mp_obj_t self_in) { canio_can_obj_t *self = MP_OBJ_TO_PTR(self_in); common_hal_canio_can_check_for_deinit(self); @@ -273,7 +267,6 @@ MP_PROPERTY_GETTER(canio_can_loopback_obj, //| If the message could not be sent due to a full fifo or a bus error condition, RuntimeError is raised. //| """ //| ... -//| STATIC mp_obj_t canio_can_send(mp_obj_t self_in, mp_obj_t message_in) { canio_can_obj_t *self = MP_OBJ_TO_PTR(self_in); common_hal_canio_can_check_for_deinit(self); @@ -291,7 +284,6 @@ MP_DEFINE_CONST_FUN_OBJ_2(canio_can_send_obj, canio_can_send); //| silent: bool //| """True if the device was created in silent mode, False //| otherwise (read-only)""" -//| STATIC mp_obj_t canio_can_silent_get(mp_obj_t self_in) { canio_can_obj_t *self = MP_OBJ_TO_PTR(self_in); common_hal_canio_can_check_for_deinit(self); @@ -306,7 +298,6 @@ MP_PROPERTY_GETTER(canio_can_silent_obj, //| def deinit(self) -> None: //| """Deinitialize this object, freeing its hardware resources""" //| ... -//| STATIC mp_obj_t canio_can_deinit(mp_obj_t self_in) { canio_can_obj_t *self = MP_OBJ_TO_PTR(self_in); common_hal_canio_can_deinit(self); @@ -317,7 +308,6 @@ STATIC MP_DEFINE_CONST_FUN_OBJ_1(canio_can_deinit_obj, canio_can_deinit); //| def __enter__(self) -> CAN: //| """Returns self, to allow the object to be used in a `with` statement for resource control""" //| ... -//| STATIC mp_obj_t canio_can_enter(mp_obj_t self_in) { canio_can_obj_t *self = MP_OBJ_TO_PTR(self_in); common_hal_canio_can_check_for_deinit(self); @@ -325,9 +315,15 @@ 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: Optional[Type[BaseException]], unused2: Optional[BaseException], unused3: Optional[TracebackType]) -> 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[]) { canio_can_obj_t *self = MP_OBJ_TO_PTR(args[0]); common_hal_canio_can_deinit(self); diff --git a/shared-bindings/canio/Listener.c b/shared-bindings/canio/Listener.c index e59801d4e4..e10f7fde6f 100644 --- a/shared-bindings/canio/Listener.c +++ b/shared-bindings/canio/Listener.c @@ -43,13 +43,12 @@ //| message arrives within ``self.timeout`` seconds.""" //| -//| def receive(self) -> Optional[Union[RemoteTransmissionRequest,Message]]: +//| def receive(self) -> Optional[Union[RemoteTransmissionRequest, Message]]: //| """Reads a message, after waiting up to ``self.timeout`` seconds //| //| If no message is received in time, `None` is returned. Otherwise, //| a `Message` or `RemoteTransmissionRequest` is returned.""" //| ... -//| STATIC mp_obj_t canio_listener_receive(mp_obj_t self_in) { canio_listener_obj_t *self = MP_OBJ_TO_PTR(self_in); common_hal_canio_listener_check_for_deinit(self); @@ -68,7 +67,6 @@ STATIC MP_DEFINE_CONST_FUN_OBJ_1(canio_listener_receive_obj, canio_listener_rece //| """Returns the number of messages (including remote //| transmission requests) waiting""" //| ... -//| STATIC mp_obj_t canio_listener_in_waiting(mp_obj_t self_in) { canio_listener_obj_t *self = MP_OBJ_TO_PTR(self_in); common_hal_canio_listener_check_for_deinit(self); @@ -82,8 +80,7 @@ STATIC MP_DEFINE_CONST_FUN_OBJ_1(canio_listener_in_waiting_obj, canio_listener_i //| This method exists so that `Listener` can be used as an //| iterable""" //| ... -//| -//| def __next__(self) -> Union[RemoteTransmissionRequest,Message]: +//| def __next__(self) -> Union[RemoteTransmissionRequest, Message]: //| """Reads a message, after waiting up to self.timeout seconds //| //| If no message is received in time, raises StopIteration. Otherwise, @@ -92,7 +89,6 @@ STATIC MP_DEFINE_CONST_FUN_OBJ_1(canio_listener_in_waiting_obj, canio_listener_i //| This method enables the `Listener` to be used as an //| iterable, for instance in a for-loop.""" //| ... -//| STATIC mp_obj_t canio_iternext(mp_obj_t self_in) { mp_obj_t result = canio_listener_receive(self_in); if (result == mp_const_none) { @@ -104,7 +100,6 @@ STATIC mp_obj_t canio_iternext(mp_obj_t self_in) { //| def deinit(self) -> None: //| """Deinitialize this object, freeing its hardware resources""" //| ... -//| STATIC mp_obj_t canio_listener_deinit(mp_obj_t self_in) { canio_listener_obj_t *self = MP_OBJ_TO_PTR(self_in); common_hal_canio_listener_deinit(self); @@ -115,7 +110,6 @@ STATIC MP_DEFINE_CONST_FUN_OBJ_1(canio_listener_deinit_obj, canio_listener_deini //| def __enter__(self) -> CAN: //| """Returns self, to allow the object to be used in a `with` statement for resource control""" //| ... -//| STATIC mp_obj_t canio_listener_enter(mp_obj_t self_in) { canio_listener_obj_t *self = MP_OBJ_TO_PTR(self_in); common_hal_canio_listener_check_for_deinit(self); @@ -123,7 +117,12 @@ 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: Optional[Type[BaseException]], unused2: Optional[BaseException], unused3: Optional[TracebackType]) -> 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[]) { @@ -134,7 +133,8 @@ STATIC mp_obj_t canio_listener_exit(size_t num_args, const mp_obj_t args[]) { STATIC MP_DEFINE_CONST_FUN_OBJ_VAR_BETWEEN(canio_listener_exit_obj, 4, 4, canio_listener_exit); -//| timeout : float +//| timeout: float +//| STATIC mp_obj_t canio_listener_timeout_get(mp_obj_t self_in) { canio_listener_obj_t *self = MP_OBJ_TO_PTR(self_in); common_hal_canio_listener_check_for_deinit(self); diff --git a/shared-bindings/canio/Match.c b/shared-bindings/canio/Match.c index 52262b0a6c..06729f9c54 100644 --- a/shared-bindings/canio/Match.c +++ b/shared-bindings/canio/Match.c @@ -32,7 +32,6 @@ //| class Match: //| """Describe CAN bus messages to match""" //| -//| //| def __init__(self, id: int, *, mask: Optional[int] = None, extended: bool = False) -> None: //| """Construct a Match with the given properties. //| @@ -40,7 +39,6 @@ //| the nonzero bits in mask. Otherwise, it matches exactly the given id. //| If extended is true then only extended ids are matched, otherwise //| only standard ids are matched.""" -//| STATIC mp_obj_t canio_match_make_new(const mp_obj_type_t *type, size_t n_args, size_t n_kw, const mp_obj_t *all_args) { enum { ARG_id, ARG_mask, ARG_extended, NUM_ARGS }; @@ -74,7 +72,6 @@ STATIC mp_obj_t canio_match_make_new(const mp_obj_type_t *type, size_t n_args, s //| id: int //| """The id to match""" -//| STATIC mp_obj_t canio_match_id_get(mp_obj_t self_in) { canio_match_obj_t *self = self_in; @@ -85,10 +82,8 @@ MP_DEFINE_CONST_FUN_OBJ_1(canio_match_id_get_obj, canio_match_id_get); MP_PROPERTY_GETTER(canio_match_id_obj, (mp_obj_t)&canio_match_id_get_obj); -//| //| mask: int //| """The optional mask of ids to match""" -//| STATIC mp_obj_t canio_match_mask_get(mp_obj_t self_in) { canio_match_obj_t *self = self_in; diff --git a/shared-bindings/canio/Message.c b/shared-bindings/canio/Message.c index 64d4094b3f..c3857256bd 100644 --- a/shared-bindings/canio/Message.c +++ b/shared-bindings/canio/Message.c @@ -41,7 +41,6 @@ //| In CAN, messages can have a length from 0 to 8 bytes. //| """ //| ... -//| STATIC mp_obj_t canio_message_make_new(const mp_obj_type_t *type, size_t n_args, size_t n_kw, const mp_obj_t *all_args) { enum { ARG_id, ARG_data, ARG_extended, NUM_ARGS }; static const mp_arg_t allowed_args[] = { @@ -57,9 +56,7 @@ STATIC mp_obj_t canio_message_make_new(const mp_obj_type_t *type, size_t n_args, mp_buffer_info_t data; mp_get_buffer_raise(args[ARG_data].u_obj, &data, MP_BUFFER_READ); - if (data.len > 8) { - mp_raise_ValueError(translate("Messages limited to 8 bytes")); - } + mp_arg_validate_length_range(data.len, 0, 8, MP_QSTR_data); canio_message_obj_t *self = m_new_obj(canio_message_obj_t); self->base.type = &canio_message_type; @@ -69,7 +66,6 @@ STATIC mp_obj_t canio_message_make_new(const mp_obj_type_t *type, size_t n_args, //| id: int //| """The numeric ID of the message""" -//| STATIC mp_obj_t canio_message_id_get(const mp_obj_t self_in) { canio_message_obj_t *self = self_in; return MP_OBJ_NEW_SMALL_INT(common_hal_canio_message_get_id(self)); @@ -89,7 +85,6 @@ MP_PROPERTY_GETSET(canio_message_id_obj, //| data: bytes //| """The content of the message""" -//| STATIC mp_obj_t canio_message_data_get(const mp_obj_t self_in) { canio_message_obj_t *self = self_in; return mp_obj_new_bytes((const byte *)common_hal_canio_message_get_data(self), common_hal_canio_message_get_length(self)); @@ -100,9 +95,9 @@ STATIC mp_obj_t canio_message_data_set(const mp_obj_t self_in, const mp_obj_t da canio_message_obj_t *self = self_in; mp_buffer_info_t data; mp_get_buffer_raise(data_in, &data, MP_BUFFER_READ); - if (data.len > 8) { - mp_raise_ValueError(translate("Messages limited to 8 bytes")); - } + + mp_arg_validate_length_range(data.len, 0, 8, MP_QSTR_data); + common_hal_canio_message_set_data(self, data.buf, data.len); return mp_const_none; } diff --git a/shared-bindings/canio/RemoteTransmissionRequest.c b/shared-bindings/canio/RemoteTransmissionRequest.c index 58ac3aa2de..1efc401909 100644 --- a/shared-bindings/canio/RemoteTransmissionRequest.c +++ b/shared-bindings/canio/RemoteTransmissionRequest.c @@ -41,7 +41,6 @@ //| In CAN, messages can have a length from 0 to 8 bytes. //| """ //| ... -//| STATIC mp_obj_t canio_remote_transmission_request_make_new(const mp_obj_type_t *type, size_t n_args, size_t n_kw, const mp_obj_t *all_args) { enum { ARG_id, ARG_length, ARG_extended, NUM_ARGS }; static const mp_arg_t allowed_args[] = { @@ -68,7 +67,6 @@ STATIC mp_obj_t canio_remote_transmission_request_make_new(const mp_obj_type_t * //| id: int //| """The numeric ID of the message""" -//| STATIC mp_obj_t canio_remote_transmission_request_id_get(const mp_obj_t self_in) { canio_remote_transmission_request_obj_t *self = self_in; return MP_OBJ_NEW_SMALL_INT(common_hal_canio_remote_transmission_request_get_id(self)); @@ -88,7 +86,6 @@ MP_PROPERTY_GETSET(canio_remote_transmission_request_id_obj, //| extended: bool //| """True if the message's id is an extended id""" -//| STATIC mp_obj_t canio_remote_transmission_request_extended_get(const mp_obj_t self_in) { canio_remote_transmission_request_obj_t *self = self_in; return mp_obj_new_bool(common_hal_canio_remote_transmission_request_get_extended(self)); diff --git a/shared-bindings/canio/__init__.c b/shared-bindings/canio/__init__.c index ef1b90df97..0416e5cb39 100644 --- a/shared-bindings/canio/__init__.c +++ b/shared-bindings/canio/__init__.c @@ -54,8 +54,10 @@ //| Other implementations of the CAN device may exist (for instance, attached //| via an SPI bus). If so their constructor arguments may differ, but //| otherwise we encourage implementors to follow the API that the core uses. -//| """ //| +//| For more information on working with this module, refer to +//| `this Learn Guide on using it `_. +//| """ #include "py/obj.h" #include "py/enum.h" diff --git a/shared-bindings/countio/Counter.c b/shared-bindings/countio/Counter.c index 19141245e1..eed676a17e 100644 --- a/shared-bindings/countio/Counter.c +++ b/shared-bindings/countio/Counter.c @@ -11,10 +11,15 @@ #include "shared-bindings/util.h" //| class Counter: -//| """Count the number of rising- and/or falling-edge transitions on a given pin. -//| """ +//| """Count the number of rising- and/or falling-edge transitions on a given pin.""" //| -//| def __init__(self, pin: microcontroller.Pin, *, edge: Edge = Edge.FALL, pull: Optional[digitalio.Pull] = None) -> None: +//| def __init__( +//| self, +//| pin: microcontroller.Pin, +//| *, +//| edge: Edge = Edge.FALL, +//| pull: Optional[digitalio.Pull] = None +//| ) -> None: //| """Create a Counter object associated with the given pin that counts //| rising- and/or falling-edge transitions. At least one of ``rise`` and ``fall`` must be True. //| The default is to count only falling edges, and is for historical backward compatibility. @@ -30,7 +35,7 @@ //| import countio //| //| # Count rising edges only. -//| pin_counter = countio.Counter(board.D1, edge=Edge.RISE) +//| pin_counter = countio.Counter(board.D1, edge=countio.Edge.RISE) //| # Reset the count after 100 counts. //| while True: //| if pin_counter.count >= 100: @@ -38,7 +43,6 @@ //| print(pin_counter.count) //| """ //| ... -//| STATIC mp_obj_t countio_counter_make_new(const mp_obj_type_t *type, size_t n_args, size_t n_kw, const mp_obj_t *all_args) { enum { ARG_pin, ARG_edge, ARG_pull }; static const mp_arg_t allowed_args[] = { @@ -63,7 +67,6 @@ STATIC mp_obj_t countio_counter_make_new(const mp_obj_type_t *type, size_t n_arg //| def deinit(self) -> None: //| """Deinitializes the Counter and releases any hardware resources for reuse.""" -//| STATIC mp_obj_t countio_counter_deinit(mp_obj_t self_in) { countio_counter_obj_t *self = MP_OBJ_TO_PTR(self_in); common_hal_countio_counter_deinit(self); @@ -79,13 +82,11 @@ STATIC void check_for_deinit(countio_counter_obj_t *self) { //| def __enter__(self) -> Counter: //| """No-op used by Context Managers.""" -//| // Provided by context manager helper. //| def __exit__(self) -> None: //| """Automatically deinitializes the hardware when exiting a context. See -//| :ref:`lifetime-and-contextmanagers` for more info.""" -//| +//| :ref:`lifetime-and-contextmanagers` for more info.""" STATIC mp_obj_t countio_counter_obj___exit__(size_t n_args, const mp_obj_t *args) { (void)n_args; common_hal_countio_counter_deinit(args[0]); @@ -96,7 +97,6 @@ STATIC MP_DEFINE_CONST_FUN_OBJ_VAR_BETWEEN(countio_counter___exit___obj, 4, 4, c //| count: int //| """The current count in terms of pulses.""" -//| STATIC mp_obj_t countio_counter_obj_get_count(mp_obj_t self_in) { countio_counter_obj_t *self = MP_OBJ_TO_PTR(self_in); check_for_deinit(self); diff --git a/shared-bindings/countio/Edge.c b/shared-bindings/countio/Edge.c index 980b3a3705..104b75a5be 100644 --- a/shared-bindings/countio/Edge.c +++ b/shared-bindings/countio/Edge.c @@ -40,7 +40,6 @@ MAKE_ENUM_VALUE(countio_edge_type, edge, RISE_AND_FALL, EDGE_RISE_AND_FALL); //| def __init__(self) -> None: //| """Enum-like class to define which signal transitions to count.""" //| ... -//| //| RISE: Edge //| """Count the rising edges.""" //| diff --git a/shared-bindings/countio/Edge.h b/shared-bindings/countio/Edge.h index ca4cddbef3..86112fb4a3 100644 --- a/shared-bindings/countio/Edge.h +++ b/shared-bindings/countio/Edge.h @@ -3,7 +3,7 @@ * * The MIT License (MIT) * - * Copyright (c) 2021 an Halbertfor Adafruit Industries + * Copyright (c) 2021 Dan Halbert 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 diff --git a/shared-bindings/countio/__init__.c b/shared-bindings/countio/__init__.c index d72ed9fd25..25e9c7d630 100644 --- a/shared-bindings/countio/__init__.c +++ b/shared-bindings/countio/__init__.c @@ -13,11 +13,14 @@ //| //| The `countio` module contains logic to read and count edge transistions //| +//| For more information on the applications of counting edges, see +//| `this Learn Guide on sequential circuits +//| `_. +//| //| All classes change hardware state and should be deinitialized when they //| are no longer needed if the program continues after use. To do so, either //| call :py:meth:`!deinit` or use a context manager. See //| :ref:`lifetime-and-contextmanagers` for more info.""" -//| STATIC const mp_rom_map_elem_t countio_module_globals_table[] = { { MP_ROM_QSTR(MP_QSTR___name__), MP_ROM_QSTR(MP_QSTR_countio) }, diff --git a/shared-bindings/digitalio/DigitalInOut.c b/shared-bindings/digitalio/DigitalInOut.c index 37093add8f..e42036bb1a 100644 --- a/shared-bindings/digitalio/DigitalInOut.c +++ b/shared-bindings/digitalio/DigitalInOut.c @@ -41,7 +41,30 @@ #include "shared-bindings/digitalio/DriveMode.h" #include "shared-bindings/digitalio/Pull.h" #include "shared-bindings/util.h" -#include "supervisor/shared/translate.h" +#include "supervisor/shared/translate/translate.h" + +#if CIRCUITPY_CYW43 +#include "bindings/cyw43/__init__.h" +#endif + +STATIC void check_result(digitalinout_result_t result) { + switch (result) { + case DIGITALINOUT_OK: + return; + case DIGITALINOUT_PIN_BUSY: + mp_raise_ValueError_varg(translate("%q in use"), MP_QSTR_Pin); + case DIGITALINOUT_INPUT_ONLY: + mp_raise_ValueError_varg(translate("Invalid %q"), MP_QSTR_direction); + #if CIRCUITPY_DIGITALIO_HAVE_INVALID_PULL + case DIGITALINOUT_INVALID_PULL: + mp_raise_ValueError_varg(translate("Invalid %q"), MP_QSTR_pull); + #endif + #if CIRCUITPY_DIGITALIO_HAVE_INVALID_DRIVE_MODE + case DIGITALINOUT_INVALID_DRIVE_MODE: + mp_raise_ValueError_varg(translate("Invalid %q"), MP_QSTR_drive_mode); + #endif + } +} //| class DigitalInOut: //| """Digital input and output @@ -57,7 +80,6 @@ //| //| :param ~microcontroller.Pin pin: The pin to control""" //| ... -//| STATIC mp_obj_t digitalio_digitalinout_make_new(const mp_obj_type_t *type, size_t n_args, size_t n_kw, const mp_obj_t *args) { mp_arg_check_num(n_args, n_kw, 1, 1, false); @@ -65,7 +87,14 @@ STATIC mp_obj_t digitalio_digitalinout_make_new(const mp_obj_type_t *type, digitalio_digitalinout_obj_t *self = m_new_obj(digitalio_digitalinout_obj_t); self->base.type = &digitalio_digitalinout_type; + #if CIRCUITPY_CYW43 + // The GPIO pin attached to the CYW43 co-processor can only be used for + // DigitalInOut, not for other purposes like PWM. That's why this check + // is here, and it's not rolled into validate_obj_is_free_pin. + const mcu_pin_obj_t *pin = validate_obj_is_free_pin_including_cyw43(args[0]); + #else const mcu_pin_obj_t *pin = validate_obj_is_free_pin(args[0]); + #endif common_hal_digitalio_digitalinout_construct(self, pin); return MP_OBJ_FROM_PTR(self); @@ -74,7 +103,6 @@ STATIC mp_obj_t digitalio_digitalinout_make_new(const mp_obj_type_t *type, //| def deinit(self) -> None: //| """Turn off the DigitalInOut and release the pin for other use.""" //| ... -//| STATIC mp_obj_t digitalio_digitalinout_obj_deinit(mp_obj_t self_in) { digitalio_digitalinout_obj_t *self = MP_OBJ_TO_PTR(self_in); common_hal_digitalio_digitalinout_deinit(self); @@ -85,14 +113,12 @@ MP_DEFINE_CONST_FUN_OBJ_1(digitalio_digitalinout_deinit_obj, digitalio_digitalin //| def __enter__(self) -> DigitalInOut: //| """No-op used by Context Managers.""" //| ... -//| // Provided by context manager helper. //| def __exit__(self) -> None: //| """Automatically deinitializes the hardware when exiting a context. See //| :ref:`lifetime-and-contextmanagers` for more info.""" //| ... -//| STATIC mp_obj_t digitalio_digitalinout_obj___exit__(size_t n_args, const mp_obj_t *args) { (void)n_args; common_hal_digitalio_digitalinout_deinit(MP_OBJ_TO_PTR(args[0])); @@ -106,7 +132,9 @@ STATIC void check_for_deinit(digitalio_digitalinout_obj_t *self) { } } -//| def switch_to_output(self, value: bool = False, drive_mode: DriveMode = DriveMode.PUSH_PULL) -> None: +//| def switch_to_output( +//| self, value: bool = False, drive_mode: DriveMode = DriveMode.PUSH_PULL +//| ) -> None: //| """Set the drive mode and value and then switch to writing out digital //| values. //| @@ -114,7 +142,6 @@ STATIC void check_for_deinit(digitalio_digitalinout_obj_t *self) { //| :param ~digitalio.DriveMode drive_mode: drive mode for the output //| """ //| ... -//| STATIC mp_obj_t digitalio_digitalinout_switch_to_output(size_t n_args, const mp_obj_t *pos_args, mp_map_t *kw_args) { enum { ARG_value, ARG_drive_mode }; static const mp_arg_t allowed_args[] = { @@ -131,10 +158,7 @@ STATIC mp_obj_t digitalio_digitalinout_switch_to_output(size_t n_args, const mp_ drive_mode = DRIVE_MODE_OPEN_DRAIN; } // do the transfer - digitalinout_result_t result = common_hal_digitalio_digitalinout_switch_to_output(self, args[ARG_value].u_bool, drive_mode); - if (result == DIGITALINOUT_INPUT_ONLY) { - mp_raise_NotImplementedError(translate("Pin is input only")); - } + check_result(common_hal_digitalio_digitalinout_switch_to_output(self, args[ARG_value].u_bool, drive_mode)); return mp_const_none; } MP_DEFINE_CONST_FUN_OBJ_KW(digitalio_digitalinout_switch_to_output_obj, 1, digitalio_digitalinout_switch_to_output); @@ -155,7 +179,6 @@ MP_DEFINE_CONST_FUN_OBJ_KW(digitalio_digitalinout_switch_to_output_obj, 1, digit //| switch.pull = digitalio.Pull.UP //| print(switch.value)""" //| ... -//| STATIC mp_obj_t digitalio_digitalinout_switch_to_input(size_t n_args, const mp_obj_t *pos_args, mp_map_t *kw_args) { enum { ARG_pull }; static const mp_arg_t allowed_args[] = { @@ -166,7 +189,7 @@ STATIC mp_obj_t digitalio_digitalinout_switch_to_input(size_t n_args, const mp_o mp_arg_val_t args[MP_ARRAY_SIZE(allowed_args)]; mp_arg_parse_all(n_args - 1, pos_args + 1, kw_args, MP_ARRAY_SIZE(allowed_args), allowed_args, args); - common_hal_digitalio_digitalinout_switch_to_input(self, validate_pull(args[ARG_pull].u_rom_obj, MP_QSTR_pull)); + check_result(common_hal_digitalio_digitalinout_switch_to_input(self, validate_pull(args[ARG_pull].u_rom_obj, MP_QSTR_pull))); return mp_const_none; } MP_DEFINE_CONST_FUN_OBJ_KW(digitalio_digitalinout_switch_to_input_obj, 1, digitalio_digitalinout_switch_to_input); @@ -178,7 +201,6 @@ MP_DEFINE_CONST_FUN_OBJ_KW(digitalio_digitalinout_switch_to_input_obj, 1, digita //| :py:meth:`switch_to_input` or :py:meth:`switch_to_output` method. If //| you want to set pull, value or drive mode prior to switching, then use //| those methods instead.""" -//| typedef struct { mp_obj_base_t base; } digitalio_digitalio_direction_obj_t; @@ -200,14 +222,11 @@ STATIC mp_obj_t digitalio_digitalinout_obj_set_direction(mp_obj_t self_in, mp_ob digitalio_digitalinout_obj_t *self = MP_OBJ_TO_PTR(self_in); check_for_deinit(self); if (value == MP_ROM_PTR(&digitalio_direction_input_obj)) { - common_hal_digitalio_digitalinout_switch_to_input(self, PULL_NONE); + check_result(common_hal_digitalio_digitalinout_switch_to_input(self, PULL_NONE)); } else if (value == MP_ROM_PTR(&digitalio_direction_output_obj)) { - digitalinout_result_t result = common_hal_digitalio_digitalinout_switch_to_output(self, false, DRIVE_MODE_PUSH_PULL); - if (result == DIGITALINOUT_INPUT_ONLY) { - mp_raise_NotImplementedError(translate("Pin is input only")); - } + check_result(common_hal_digitalio_digitalinout_switch_to_output(self, false, DRIVE_MODE_PUSH_PULL)); } else { - mp_raise_ValueError(translate("Invalid direction.")); + mp_arg_error_invalid(MP_QSTR_direction); } return mp_const_none; } @@ -219,7 +238,6 @@ MP_PROPERTY_GETSET(digitalio_digitalio_direction_obj, //| value: bool //| """The digital logic level of the pin.""" -//| STATIC mp_obj_t digitalio_digitalinout_obj_get_value(mp_obj_t self_in) { digitalio_digitalinout_obj_t *self = MP_OBJ_TO_PTR(self_in); check_for_deinit(self); @@ -249,7 +267,6 @@ MP_PROPERTY_GETSET(digitalio_digitalinout_value_obj, //| //| - `digitalio.DriveMode.PUSH_PULL` //| - `digitalio.DriveMode.OPEN_DRAIN`""" -//| STATIC mp_obj_t digitalio_digitalinout_obj_get_drive_mode(mp_obj_t self_in) { digitalio_digitalinout_obj_t *self = MP_OBJ_TO_PTR(self_in); check_for_deinit(self); @@ -276,7 +293,7 @@ STATIC mp_obj_t digitalio_digitalinout_obj_set_drive_mode(mp_obj_t self_in, mp_o if (drive_mode == MP_ROM_PTR(&digitalio_drive_mode_open_drain_obj)) { c_drive_mode = DRIVE_MODE_OPEN_DRAIN; } - common_hal_digitalio_digitalinout_set_drive_mode(self, c_drive_mode); + check_result(common_hal_digitalio_digitalinout_set_drive_mode(self, c_drive_mode)); return mp_const_none; } MP_DEFINE_CONST_FUN_OBJ_2(digitalio_digitalinout_set_drive_mode_obj, digitalio_digitalinout_obj_set_drive_mode); @@ -319,7 +336,7 @@ STATIC mp_obj_t digitalio_digitalinout_obj_set_pull(mp_obj_t self_in, mp_obj_t p return mp_const_none; } - common_hal_digitalio_digitalinout_set_pull(self, validate_pull(pull_obj, MP_QSTR_pull)); + check_result(common_hal_digitalio_digitalinout_set_pull(self, validate_pull(pull_obj, MP_QSTR_pull))); return mp_const_none; } MP_DEFINE_CONST_FUN_OBJ_2(digitalio_digitalinout_set_pull_obj, digitalio_digitalinout_obj_set_pull); diff --git a/shared-bindings/digitalio/DigitalInOut.h b/shared-bindings/digitalio/DigitalInOut.h index b6edbc63aa..9a751e93bb 100644 --- a/shared-bindings/digitalio/DigitalInOut.h +++ b/shared-bindings/digitalio/DigitalInOut.h @@ -38,7 +38,13 @@ extern const mp_obj_type_t digitalio_digitalinout_type; typedef enum { DIGITALINOUT_OK, DIGITALINOUT_PIN_BUSY, - DIGITALINOUT_INPUT_ONLY + DIGITALINOUT_INPUT_ONLY, + #if CIRCUITPY_DIGITALIO_HAVE_INVALID_PULL + DIGITALINOUT_INVALID_PULL, + #endif + #if CIRCUITPY_DIGITALIO_HAVE_INVALID_DRIVE_MODE + DIGITALINOUT_INVALID_DRIVE_MODE, + #endif } digitalinout_result_t; typedef enum { @@ -52,14 +58,14 @@ typedef enum { digitalinout_result_t common_hal_digitalio_digitalinout_construct(digitalio_digitalinout_obj_t *self, const mcu_pin_obj_t *pin); void common_hal_digitalio_digitalinout_deinit(digitalio_digitalinout_obj_t *self); bool common_hal_digitalio_digitalinout_deinited(digitalio_digitalinout_obj_t *self); -void common_hal_digitalio_digitalinout_switch_to_input(digitalio_digitalinout_obj_t *self, digitalio_pull_t pull); +digitalinout_result_t common_hal_digitalio_digitalinout_switch_to_input(digitalio_digitalinout_obj_t *self, digitalio_pull_t pull); digitalinout_result_t common_hal_digitalio_digitalinout_switch_to_output(digitalio_digitalinout_obj_t *self, bool value, digitalio_drive_mode_t drive_mode); digitalio_direction_t common_hal_digitalio_digitalinout_get_direction(digitalio_digitalinout_obj_t *self); void common_hal_digitalio_digitalinout_set_value(digitalio_digitalinout_obj_t *self, bool value); bool common_hal_digitalio_digitalinout_get_value(digitalio_digitalinout_obj_t *self); digitalinout_result_t common_hal_digitalio_digitalinout_set_drive_mode(digitalio_digitalinout_obj_t *self, digitalio_drive_mode_t drive_mode); digitalio_drive_mode_t common_hal_digitalio_digitalinout_get_drive_mode(digitalio_digitalinout_obj_t *self); -void common_hal_digitalio_digitalinout_set_pull(digitalio_digitalinout_obj_t *self, digitalio_pull_t pull); +digitalinout_result_t common_hal_digitalio_digitalinout_set_pull(digitalio_digitalinout_obj_t *self, digitalio_pull_t pull); digitalio_pull_t common_hal_digitalio_digitalinout_get_pull(digitalio_digitalinout_obj_t *self); void common_hal_digitalio_digitalinout_never_reset(digitalio_digitalinout_obj_t *self); digitalio_digitalinout_obj_t *assert_digitalinout(mp_obj_t obj); diff --git a/shared-bindings/digitalio/Direction.c b/shared-bindings/digitalio/Direction.c index 0ed18f8edc..78552e025c 100644 --- a/shared-bindings/digitalio/Direction.c +++ b/shared-bindings/digitalio/Direction.c @@ -45,7 +45,6 @@ //| """Enum-like class to define which direction the digital values are //| going.""" //| ... -//| //| INPUT: Direction //| """Read digital data in""" //| diff --git a/shared-bindings/digitalio/DriveMode.c b/shared-bindings/digitalio/DriveMode.c index c7c3400411..1ebf51daea 100644 --- a/shared-bindings/digitalio/DriveMode.c +++ b/shared-bindings/digitalio/DriveMode.c @@ -33,7 +33,6 @@ //| """Enum-like class to define the drive mode used when outputting //| digital values.""" //| ... -//| //| PUSH_PULL: DriveMode //| """Output both high and low digital values""" //| diff --git a/shared-bindings/digitalio/Pull.c b/shared-bindings/digitalio/Pull.c index 4db68dda10..5934ddb9c2 100644 --- a/shared-bindings/digitalio/Pull.c +++ b/shared-bindings/digitalio/Pull.c @@ -26,6 +26,7 @@ #include "py/runtime.h" #include "shared-bindings/digitalio/Pull.h" +#include "supervisor/shared/translate/translate.h" //| class Pull: //| """Defines the pull of a digital input pin""" @@ -34,7 +35,6 @@ //| """Enum-like class to define the pull value, if any, used while reading //| digital values in.""" //| ... -//| //| UP: Pull //| """When the input line isn't being driven the pull up can pull the state //| of the line high so it reads as true.""" diff --git a/shared-bindings/displayio/Bitmap.c b/shared-bindings/displayio/Bitmap.c index 3af152ffdc..65551f4e0d 100644 --- a/shared-bindings/displayio/Bitmap.c +++ b/shared-bindings/displayio/Bitmap.c @@ -34,23 +34,22 @@ #include "py/objproperty.h" #include "py/runtime.h" #include "shared-bindings/util.h" -#include "supervisor/shared/translate.h" +#include "supervisor/shared/translate/translate.h" //| class Bitmap: //| """Stores values of a certain size in a 2D array //| -//| Bitmaps can be treated as read-only buffers. If the number of bits in a pixel is 8, 16, or 32; and the number of bytes -//| per row is a multiple of 4, then the resulting memoryview will correspond directly with the bitmap's contents. Otherwise, -//| the bitmap data is packed into the memoryview with unspecified padding. +//| Bitmaps can be treated as read-only buffers. If the number of bits in a pixel is 8, 16, or 32; and the number of bytes +//| per row is a multiple of 4, then the resulting memoryview will correspond directly with the bitmap's contents. Otherwise, +//| the bitmap data is packed into the memoryview with unspecified padding. //| -//| A Bitmap can be treated as a buffer, allowing its content to be -//| viewed and modified using e.g., with ``ulab.numpy.frombuffer``, -//| but the `displayio.Bitmap.dirty` method must be used to inform -//| displayio when a bitmap was modified through the buffer interface. +//| A Bitmap can be treated as a buffer, allowing its content to be +//| viewed and modified using e.g., with ``ulab.numpy.frombuffer``, +//| but the `displayio.Bitmap.dirty` method must be used to inform +//| displayio when a bitmap was modified through the buffer interface. //| -//| `bitmaptools.arrayblit` can also be useful to move data efficiently -//| into a Bitmap. -//| """ +//| `bitmaptools.arrayblit` can also be useful to move data efficiently +//| into a Bitmap.""" //| //| def __init__(self, width: int, height: int, value_count: int) -> None: //| """Create a Bitmap object with the given fixed size. Each pixel stores a value that is used to @@ -61,7 +60,6 @@ //| :param int height: The number of values high //| :param int value_count: The number of possible pixel values.""" //| ... -//| STATIC mp_obj_t displayio_bitmap_make_new(const mp_obj_type_t *type, size_t n_args, size_t n_kw, const mp_obj_t *all_args) { mp_arg_check_num(n_args, n_kw, 3, 3, false); uint32_t width = mp_obj_get_int(all_args[0]); @@ -88,7 +86,6 @@ STATIC mp_obj_t displayio_bitmap_make_new(const mp_obj_type_t *type, size_t n_ar } //| width: int //| """Width of the bitmap. (read only)""" -//| STATIC mp_obj_t displayio_bitmap_obj_get_width(mp_obj_t self_in) { displayio_bitmap_t *self = MP_OBJ_TO_PTR(self_in); @@ -102,7 +99,6 @@ MP_PROPERTY_GETTER(displayio_bitmap_width_obj, //| height: int //| """Height of the bitmap. (read only)""" -//| STATIC mp_obj_t displayio_bitmap_obj_get_height(mp_obj_t self_in) { displayio_bitmap_t *self = MP_OBJ_TO_PTR(self_in); @@ -122,7 +118,6 @@ MP_PROPERTY_GETTER(displayio_bitmap_height_obj, //| //| print(bitmap[0,1])""" //| ... -//| //| def __setitem__(self, index: Union[Tuple[int, int], int], value: int) -> None: //| """Sets the value at the given index. The index can either be an x,y tuple or an int equal //| to ``y * width + x``. @@ -131,7 +126,6 @@ MP_PROPERTY_GETTER(displayio_bitmap_height_obj, //| //| bitmap[0,1] = 3""" //| ... -//| STATIC mp_obj_t bitmap_subscr(mp_obj_t self_in, mp_obj_t index_obj, mp_obj_t value_obj) { if (value_obj == mp_const_none) { // delete item @@ -177,7 +171,18 @@ 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. //| @@ -193,7 +198,6 @@ STATIC mp_obj_t bitmap_subscr(mp_obj_t self_in, mp_obj_t index_obj, mp_obj_t val //| :param int skip_index: bitmap palette index in the source that will not be copied, //| set to None to copy all pixels""" //| ... -//| STATIC mp_obj_t displayio_bitmap_obj_blit(size_t n_args, const mp_obj_t *pos_args, mp_map_t *kw_args) { enum {ARG_x, ARG_y, ARG_source, ARG_x1, ARG_y1, ARG_x2, ARG_y2, ARG_skip_index}; static const mp_arg_t allowed_args[] = { @@ -282,7 +286,6 @@ MP_DEFINE_CONST_FUN_OBJ_KW(displayio_bitmap_blit_obj, 1, displayio_bitmap_obj_bl //| def fill(self, value: int) -> None: //| """Fills the bitmap with the supplied palette index value.""" //| ... -//| STATIC mp_obj_t displayio_bitmap_obj_fill(mp_obj_t self_in, mp_obj_t value_obj) { displayio_bitmap_t *self = MP_OBJ_TO_PTR(self_in); @@ -296,7 +299,7 @@ STATIC mp_obj_t displayio_bitmap_obj_fill(mp_obj_t self_in, mp_obj_t value_obj) } MP_DEFINE_CONST_FUN_OBJ_2(displayio_bitmap_fill_obj, displayio_bitmap_obj_fill); -//| def dirty(self, x1: int=0, y1: int=0, x2: int=-1, y2:int = -1) -> None: +//| def dirty(self, x1: int = 0, y1: int = 0, x2: int = -1, y2: int = -1) -> None: //| """Inform displayio of bitmap updates done via the buffer //| protocol. //| diff --git a/shared-bindings/displayio/Bitmap.h b/shared-bindings/displayio/Bitmap.h index 458047510a..074f7dfa5c 100644 --- a/shared-bindings/displayio/Bitmap.h +++ b/shared-bindings/displayio/Bitmap.h @@ -33,6 +33,8 @@ extern const mp_obj_type_t displayio_bitmap_type; void common_hal_displayio_bitmap_construct(displayio_bitmap_t *self, uint32_t width, uint32_t height, uint32_t bits_per_value); +void common_hal_displayio_bitmap_construct_from_buffer(displayio_bitmap_t *self, uint32_t width, + uint32_t height, uint32_t bits_per_value, uint32_t *data, bool read_only); void common_hal_displayio_bitmap_load_row(displayio_bitmap_t *self, uint16_t y, uint8_t *data, uint16_t len); diff --git a/shared-bindings/displayio/ColorConverter.c b/shared-bindings/displayio/ColorConverter.c index 18b88664c0..997174f28b 100644 --- a/shared-bindings/displayio/ColorConverter.c +++ b/shared-bindings/displayio/ColorConverter.c @@ -34,18 +34,19 @@ #include "py/objproperty.h" #include "py/runtime.h" #include "shared-bindings/util.h" -#include "supervisor/shared/translate.h" +#include "supervisor/shared/translate/translate.h" //| class ColorConverter: //| """Converts one color format to another.""" //| -//| def __init__(self, *, input_colorspace: Colorspace=Colorspace.RGB888, dither: bool = False) -> None: +//| def __init__( +//| self, *, input_colorspace: Colorspace = Colorspace.RGB888, dither: bool = False +//| ) -> None: //| """Create a ColorConverter object to convert color formats. //| //| :param Colorspace colorspace: The source colorspace, one of the Colorspace constants //| :param bool dither: Adds random noise to dither the output image""" //| ... -//| STATIC mp_obj_t displayio_colorconverter_make_new(const mp_obj_type_t *type, size_t n_args, size_t n_kw, const mp_obj_t *all_args) { enum { ARG_dither, ARG_input_colorspace }; @@ -68,14 +69,10 @@ STATIC mp_obj_t displayio_colorconverter_make_new(const mp_obj_type_t *type, siz //| def convert(self, color: int) -> int: //| """Converts the given color to RGB565 according to the Colorspace""" //| ... -//| STATIC mp_obj_t displayio_colorconverter_obj_convert(mp_obj_t self_in, mp_obj_t color_obj) { displayio_colorconverter_t *self = MP_OBJ_TO_PTR(self_in); - mp_int_t color; - if (!mp_obj_get_int_maybe(color_obj, &color)) { - mp_raise_ValueError(translate("color should be an int")); - } + mp_int_t color = mp_arg_validate_type_int(color_obj, MP_QSTR_color); _displayio_colorspace_t colorspace; colorspace.depth = 16; uint32_t output_color; @@ -87,7 +84,6 @@ MP_DEFINE_CONST_FUN_OBJ_2(displayio_colorconverter_convert_obj, displayio_colorc //| dither: bool //| """When `True` the ColorConverter dithers the output by adding random noise when //| truncating to display bitdepth""" -//| STATIC mp_obj_t displayio_colorconverter_obj_get_dither(mp_obj_t self_in) { displayio_colorconverter_t *self = MP_OBJ_TO_PTR(self_in); return mp_obj_new_bool(common_hal_displayio_colorconverter_get_dither(self)); @@ -112,7 +108,6 @@ MP_PROPERTY_GETSET(displayio_colorconverter_dither_obj, //| raise an Exception if there is already a selected transparent index. //| //| :param int color: The color to be transparent""" -//| STATIC mp_obj_t displayio_colorconverter_make_transparent(mp_obj_t self_in, mp_obj_t transparent_color_obj) { displayio_colorconverter_t *self = MP_OBJ_TO_PTR(self_in); diff --git a/shared-bindings/displayio/Display.c b/shared-bindings/displayio/Display.c index b19c0bac53..512969eb20 100644 --- a/shared-bindings/displayio/Display.c +++ b/shared-bindings/displayio/Display.c @@ -37,13 +37,11 @@ #include "shared-bindings/microcontroller/Pin.h" #include "shared-bindings/util.h" #include "shared-module/displayio/__init__.h" -#include "supervisor/shared/translate.h" +#include "supervisor/shared/translate/translate.h" -//| _DisplayBus = Union['FourWire', 'paralleldisplay.ParallelBus', 'I2CDisplay'] +//| _DisplayBus = Union["FourWire", "paralleldisplay.ParallelBus", "I2CDisplay"] //| """:py:class:`FourWire`, :py:class:`paralleldisplay.ParallelBus` or :py:class:`I2CDisplay`""" -//| -//| //| class Display: //| """Manage updating a display over a display bus //| @@ -54,7 +52,34 @@ //| Most people should not use this class directly. Use a specific display driver instead that will //| contain the initialization sequence at minimum.""" //| -//| def __init__(self, display_bus: _DisplayBus, init_sequence: ReadableBuffer, *, width: int, height: int, colstart: int = 0, rowstart: int = 0, rotation: int = 0, color_depth: int = 16, grayscale: bool = False, pixels_in_byte_share_row: bool = True, bytes_per_cell: int = 1, reverse_pixels_in_byte: bool = False, set_column_command: int = 0x2a, set_row_command: int = 0x2b, write_ram_command: int = 0x2c, backlight_pin: Optional[microcontroller.Pin] = None, brightness_command: Optional[int] = None, brightness: float = 1.0, auto_brightness: bool = False, single_byte_bounds: bool = False, data_as_commands: bool = False, auto_refresh: bool = True, native_frames_per_second: int = 60, backlight_on_high: bool = True, SH1107_addressing: bool = False) -> None: +//| def __init__( +//| self, +//| display_bus: _DisplayBus, +//| init_sequence: ReadableBuffer, +//| *, +//| width: int, +//| height: int, +//| colstart: int = 0, +//| rowstart: int = 0, +//| rotation: int = 0, +//| color_depth: int = 16, +//| grayscale: bool = False, +//| pixels_in_byte_share_row: bool = True, +//| bytes_per_cell: int = 1, +//| reverse_pixels_in_byte: bool = False, +//| set_column_command: int = 0x2A, +//| set_row_command: int = 0x2B, +//| write_ram_command: int = 0x2C, +//| backlight_pin: Optional[microcontroller.Pin] = None, +//| brightness_command: Optional[int] = None, +//| brightness: float = 1.0, +//| single_byte_bounds: bool = False, +//| data_as_commands: bool = False, +//| auto_refresh: bool = True, +//| native_frames_per_second: int = 60, +//| backlight_on_high: bool = True, +//| SH1107_addressing: bool = False +//| ) -> None: //| r"""Create a Display object on the given display bus (`FourWire`, `ParallelBus` or `I2CDisplay`). //| //| The ``init_sequence`` is bitpacked to minimize the ram impact. Every command begins with a @@ -102,8 +127,7 @@ //| :param int write_ram_command: Command used to write pixels values into the update region. Ignored if data_as_commands is set. //| :param microcontroller.Pin backlight_pin: Pin connected to the display's backlight //| :param int brightness_command: Command to set display brightness. Usually available in OLED controllers. -//| :param float brightness: Initial display brightness. This value is ignored if auto_brightness is True. -//| :param bool auto_brightness: If True, brightness is controlled via an ambient light sensor or other mechanism. +//| :param float brightness: Initial display brightness. //| :param bool single_byte_bounds: Display column and row commands use single bytes //| :param bool data_as_commands: Treat all init and boundary data as SPI commands. Certain displays require this. //| :param bool auto_refresh: Automatically refresh the screen @@ -111,9 +135,9 @@ //| :param bool backlight_on_high: If True, pulling the backlight pin high turns the backlight on. //| :param bool SH1107_addressing: Special quirk for SH1107, use upper/lower column set and page set //| :param int set_vertical_scroll: This parameter is accepted but ignored for backwards compatibility. It will be removed in a future release. +//| :param int backlight_pwm_frequency: The frequency to use to drive the PWM for backlight brightness control. Default is 50000. //| """ //| ... -//| STATIC mp_obj_t displayio_display_make_new(const mp_obj_type_t *type, size_t n_args, size_t n_kw, const mp_obj_t *all_args) { enum { ARG_display_bus, ARG_init_sequence, ARG_width, ARG_height, ARG_colstart, ARG_rowstart, @@ -121,9 +145,9 @@ STATIC mp_obj_t displayio_display_make_new(const mp_obj_type_t *type, size_t n_a ARG_bytes_per_cell, ARG_reverse_pixels_in_byte, ARG_reverse_bytes_in_word, ARG_set_column_command, ARG_set_row_command, ARG_write_ram_command, ARG_set_vertical_scroll, ARG_backlight_pin, ARG_brightness_command, - ARG_brightness, ARG_auto_brightness, ARG_single_byte_bounds, ARG_data_as_commands, + ARG_brightness, ARG_single_byte_bounds, ARG_data_as_commands, ARG_auto_refresh, ARG_native_frames_per_second, ARG_backlight_on_high, - ARG_SH1107_addressing }; + ARG_SH1107_addressing, ARG_backlight_pwm_frequency }; static const mp_arg_t allowed_args[] = { { MP_QSTR_display_bus, MP_ARG_REQUIRED | MP_ARG_OBJ }, { MP_QSTR_init_sequence, MP_ARG_REQUIRED | MP_ARG_OBJ }, @@ -145,13 +169,13 @@ STATIC mp_obj_t displayio_display_make_new(const mp_obj_type_t *type, size_t n_a { MP_QSTR_backlight_pin, MP_ARG_OBJ | MP_ARG_KW_ONLY, {.u_obj = mp_const_none} }, { MP_QSTR_brightness_command, MP_ARG_INT | MP_ARG_KW_ONLY, {.u_int = NO_BRIGHTNESS_COMMAND} }, { MP_QSTR_brightness, MP_ARG_OBJ | MP_ARG_KW_ONLY, {.u_obj = MP_OBJ_NEW_SMALL_INT(1)} }, - { MP_QSTR_auto_brightness, MP_ARG_BOOL | MP_ARG_KW_ONLY, {.u_bool = false} }, { MP_QSTR_single_byte_bounds, MP_ARG_BOOL | MP_ARG_KW_ONLY, {.u_bool = false} }, { MP_QSTR_data_as_commands, MP_ARG_BOOL | MP_ARG_KW_ONLY, {.u_bool = false} }, { MP_QSTR_auto_refresh, MP_ARG_BOOL | MP_ARG_KW_ONLY, {.u_bool = true} }, { MP_QSTR_native_frames_per_second, MP_ARG_INT | MP_ARG_KW_ONLY, {.u_int = 60} }, { MP_QSTR_backlight_on_high, MP_ARG_BOOL | MP_ARG_KW_ONLY, {.u_bool = true} }, - { MP_QSTR_SH1107_addressing, MP_ARG_BOOL | MP_ARG_KW_ONLY, {.u_bool = false} } + { MP_QSTR_SH1107_addressing, MP_ARG_BOOL | MP_ARG_KW_ONLY, {.u_bool = false} }, + { MP_QSTR_backlight_pwm_frequency, MP_ARG_INT | MP_ARG_KW_ONLY, {.u_int = 50000} } }; mp_arg_val_t args[MP_ARRAY_SIZE(allowed_args)]; mp_arg_parse_all_kw_array(n_args, n_kw, all_args, MP_ARRAY_SIZE(allowed_args), allowed_args, args); @@ -194,13 +218,13 @@ STATIC mp_obj_t displayio_display_make_new(const mp_obj_type_t *type, size_t n_a MP_OBJ_TO_PTR(backlight_pin), args[ARG_brightness_command].u_int, brightness, - args[ARG_auto_brightness].u_bool, args[ARG_single_byte_bounds].u_bool, args[ARG_data_as_commands].u_bool, args[ARG_auto_refresh].u_bool, args[ARG_native_frames_per_second].u_int, args[ARG_backlight_on_high].u_bool, - sh1107_addressing + sh1107_addressing, + args[ARG_backlight_pwm_frequency].u_int ); return self; @@ -219,7 +243,6 @@ static displayio_display_obj_t *native_display(mp_obj_t display_obj) { //| //| :param Group group: The group to show.""" //| ... -//| STATIC mp_obj_t displayio_display_obj_show(mp_obj_t self_in, mp_obj_t group_in) { displayio_display_obj_t *self = native_display(self_in); displayio_group_t *group = NULL; @@ -235,7 +258,12 @@ STATIC mp_obj_t displayio_display_obj_show(mp_obj_t self_in, mp_obj_t group_in) } MP_DEFINE_CONST_FUN_OBJ_2(displayio_display_show_obj, displayio_display_obj_show); -//| def refresh(self, *, target_frames_per_second: Optional[int] = None, minimum_frames_per_second: int = 0) -> bool: +//| def refresh( +//| self, +//| *, +//| target_frames_per_second: Optional[int] = None, +//| minimum_frames_per_second: int = 0 +//| ) -> bool: //| """When auto_refresh is off, and :py:attr:`target_frames_per_second` is not `None` this waits //| for the target frame rate and then refreshes the display, //| returning `True`. If the call has taken too long since the last refresh call for the given @@ -255,7 +283,6 @@ MP_DEFINE_CONST_FUN_OBJ_2(displayio_display_show_obj, displayio_display_obj_show //| achieve. Set to `None` for immediate refresh. //| :param int minimum_frames_per_second: The minimum number of times the screen should be updated per second.""" //| ... -//| STATIC mp_obj_t displayio_display_obj_refresh(size_t n_args, const mp_obj_t *pos_args, mp_map_t *kw_args) { enum { ARG_target_frames_per_second, ARG_minimum_frames_per_second }; static const mp_arg_t allowed_args[] = { @@ -287,7 +314,6 @@ MP_DEFINE_CONST_FUN_OBJ_KW(displayio_display_refresh_obj, 1, displayio_display_o //| auto_refresh: bool //| """True when the display is refreshed automatically.""" -//| STATIC mp_obj_t displayio_display_obj_get_auto_refresh(mp_obj_t self_in) { displayio_display_obj_t *self = native_display(self_in); return mp_obj_new_bool(common_hal_displayio_display_get_auto_refresh(self)); @@ -308,10 +334,7 @@ MP_PROPERTY_GETSET(displayio_display_auto_refresh_obj, (mp_obj_t)&displayio_display_set_auto_refresh_obj); //| brightness: float -//| """The brightness of the display as a float. 0.0 is off and 1.0 is full brightness. When -//| `auto_brightness` is True, the value of `brightness` will change automatically. -//| If `brightness` is set, `auto_brightness` will be disabled and will be set to False.""" -//| +//| """The brightness of the display as a float. 0.0 is off and 1.0 is full brightness.""" STATIC mp_obj_t displayio_display_obj_get_brightness(mp_obj_t self_in) { displayio_display_obj_t *self = native_display(self_in); mp_float_t brightness = common_hal_displayio_display_get_brightness(self); @@ -324,7 +347,6 @@ MP_DEFINE_CONST_FUN_OBJ_1(displayio_display_get_brightness_obj, displayio_displa STATIC mp_obj_t displayio_display_obj_set_brightness(mp_obj_t self_in, mp_obj_t brightness_obj) { displayio_display_obj_t *self = native_display(self_in); - common_hal_displayio_display_set_auto_brightness(self, false); mp_float_t brightness = mp_obj_get_float(brightness_obj); if (brightness < 0 || brightness > 1.0) { mp_raise_ValueError(translate("Brightness must be 0-1.0")); @@ -341,37 +363,8 @@ MP_PROPERTY_GETSET(displayio_display_brightness_obj, (mp_obj_t)&displayio_display_get_brightness_obj, (mp_obj_t)&displayio_display_set_brightness_obj); -//| auto_brightness: bool -//| """True when the display brightness is adjusted automatically, based on an ambient -//| light sensor or other method. Note that some displays may have this set to True by default, -//| but not actually implement automatic brightness adjustment. `auto_brightness` is set to False -//| if `brightness` is set manually.""" -//| -STATIC mp_obj_t displayio_display_obj_get_auto_brightness(mp_obj_t self_in) { - displayio_display_obj_t *self = native_display(self_in); - return mp_obj_new_bool(common_hal_displayio_display_get_auto_brightness(self)); -} -MP_DEFINE_CONST_FUN_OBJ_1(displayio_display_get_auto_brightness_obj, displayio_display_obj_get_auto_brightness); - -STATIC mp_obj_t displayio_display_obj_set_auto_brightness(mp_obj_t self_in, mp_obj_t auto_brightness) { - displayio_display_obj_t *self = native_display(self_in); - - common_hal_displayio_display_set_auto_brightness(self, mp_obj_is_true(auto_brightness)); - - return mp_const_none; -} -MP_DEFINE_CONST_FUN_OBJ_2(displayio_display_set_auto_brightness_obj, displayio_display_obj_set_auto_brightness); - -MP_PROPERTY_GETSET(displayio_display_auto_brightness_obj, - (mp_obj_t)&displayio_display_get_auto_brightness_obj, - (mp_obj_t)&displayio_display_set_auto_brightness_obj); - - - - //| width: int //| """Gets the width of the board""" -//| STATIC mp_obj_t displayio_display_obj_get_width(mp_obj_t self_in) { displayio_display_obj_t *self = native_display(self_in); return MP_OBJ_NEW_SMALL_INT(common_hal_displayio_display_get_width(self)); @@ -383,7 +376,6 @@ MP_PROPERTY_GETTER(displayio_display_width_obj, //| height: int //| """Gets the height of the board""" -//| STATIC mp_obj_t displayio_display_obj_get_height(mp_obj_t self_in) { displayio_display_obj_t *self = native_display(self_in); return MP_OBJ_NEW_SMALL_INT(common_hal_displayio_display_get_height(self)); @@ -395,7 +387,6 @@ MP_PROPERTY_GETTER(displayio_display_height_obj, //| rotation: int //| """The rotation of the display as an int in degrees.""" -//| STATIC mp_obj_t displayio_display_obj_get_rotation(mp_obj_t self_in) { displayio_display_obj_t *self = native_display(self_in); return MP_OBJ_NEW_SMALL_INT(common_hal_displayio_display_get_rotation(self)); @@ -415,8 +406,6 @@ MP_PROPERTY_GETSET(displayio_display_rotation_obj, //| bus: _DisplayBus //| """The bus being used by the display""" -//| -//| STATIC mp_obj_t displayio_display_obj_get_bus(mp_obj_t self_in) { displayio_display_obj_t *self = native_display(self_in); return common_hal_displayio_display_get_bus(self); @@ -428,8 +417,6 @@ MP_PROPERTY_GETTER(displayio_display_bus_obj, //| root_group: Group //| """The root group on the display.""" -//| -//| STATIC mp_obj_t displayio_display_obj_get_root_group(mp_obj_t self_in) { displayio_display_obj_t *self = native_display(self_in); return common_hal_displayio_display_get_root_group(self); @@ -506,7 +493,6 @@ STATIC const mp_rom_map_elem_t displayio_display_locals_dict_table[] = { { MP_ROM_QSTR(MP_QSTR_auto_refresh), MP_ROM_PTR(&displayio_display_auto_refresh_obj) }, { MP_ROM_QSTR(MP_QSTR_brightness), MP_ROM_PTR(&displayio_display_brightness_obj) }, - { MP_ROM_QSTR(MP_QSTR_auto_brightness), MP_ROM_PTR(&displayio_display_auto_brightness_obj) }, { MP_ROM_QSTR(MP_QSTR_width), MP_ROM_PTR(&displayio_display_width_obj) }, { MP_ROM_QSTR(MP_QSTR_height), MP_ROM_PTR(&displayio_display_height_obj) }, diff --git a/shared-bindings/displayio/Display.h b/shared-bindings/displayio/Display.h index f193e61d2f..35ba0d479a 100644 --- a/shared-bindings/displayio/Display.h +++ b/shared-bindings/displayio/Display.h @@ -42,9 +42,9 @@ void common_hal_displayio_display_construct(displayio_display_obj_t *self, bool pixels_in_byte_share_row, uint8_t bytes_per_cell, bool reverse_pixels_in_byte, bool reverse_bytes_in_word, uint8_t set_column_command, uint8_t set_row_command, uint8_t write_ram_command, uint8_t *init_sequence, uint16_t init_sequence_len, const mcu_pin_obj_t *backlight_pin, uint16_t brightness_command, - mp_float_t brightness, bool auto_brightness, + mp_float_t brightness, bool single_byte_bounds, bool data_as_commands, bool auto_refresh, uint16_t native_frames_per_second, - bool backlight_on_high, bool SH1107_addressing); + bool backlight_on_high, bool SH1107_addressing, uint16_t backlight_pwm_frequency); bool common_hal_displayio_display_show(displayio_display_obj_t *self, displayio_group_t *root_group); @@ -59,9 +59,6 @@ uint16_t common_hal_displayio_display_get_height(displayio_display_obj_t *self); uint16_t common_hal_displayio_display_get_rotation(displayio_display_obj_t *self); void common_hal_displayio_display_set_rotation(displayio_display_obj_t *self, int rotation); -bool common_hal_displayio_display_get_auto_brightness(displayio_display_obj_t *self); -void common_hal_displayio_display_set_auto_brightness(displayio_display_obj_t *self, bool auto_brightness); - bool common_hal_displayio_display_get_dither(displayio_display_obj_t *self); void common_hal_displayio_display_set_dither(displayio_display_obj_t *self, bool dither); diff --git a/shared-bindings/displayio/EPaperDisplay.c b/shared-bindings/displayio/EPaperDisplay.c index 94d2978cef..7b77b42fa4 100644 --- a/shared-bindings/displayio/EPaperDisplay.c +++ b/shared-bindings/displayio/EPaperDisplay.c @@ -37,7 +37,7 @@ #include "shared-bindings/microcontroller/Pin.h" #include "shared-bindings/util.h" #include "shared-module/displayio/__init__.h" -#include "supervisor/shared/translate.h" +#include "supervisor/shared/translate/translate.h" //| class EPaperDisplay: //| """Manage updating an epaper display over a display bus @@ -49,21 +49,37 @@ //| Most people should not use this class directly. Use a specific display driver instead that will //| contain the startup and shutdown sequences at minimum.""" //| -//| def __init__(self, display_bus: _DisplayBus, -//| start_sequence: ReadableBuffer, stop_sequence: ReadableBuffer, *, -//| width: int, height: int, ram_width: int, ram_height: int, -//| colstart: int = 0, rowstart: int = 0, rotation: int = 0, -//| set_column_window_command: Optional[int] = None, -//| set_row_window_command: Optional[int] = None, -//| set_current_column_command: Optional[int] = None, -//| set_current_row_command: Optional[int] = None, -//| write_black_ram_command: int, black_bits_inverted: bool = False, -//| write_color_ram_command: Optional[int] = None, -//| color_bits_inverted: bool = False, highlight_color: int = 0x000000, -//| refresh_display_command: int, refresh_time: float = 40, -//| busy_pin: Optional[microcontroller.Pin] = None, busy_state: bool = True, -//| seconds_per_frame: float = 180, always_toggle_chip_select: bool = False, -//| grayscale: bool = False, two_byte_sequence_length: bool = False) -> None: +//| def __init__( +//| self, +//| display_bus: _DisplayBus, +//| start_sequence: ReadableBuffer, +//| stop_sequence: ReadableBuffer, +//| *, +//| width: int, +//| height: int, +//| ram_width: int, +//| ram_height: int, +//| colstart: int = 0, +//| rowstart: int = 0, +//| rotation: int = 0, +//| set_column_window_command: Optional[int] = None, +//| set_row_window_command: Optional[int] = None, +//| set_current_column_command: Optional[int] = None, +//| set_current_row_command: Optional[int] = None, +//| write_black_ram_command: int, +//| black_bits_inverted: bool = False, +//| write_color_ram_command: Optional[int] = None, +//| color_bits_inverted: bool = False, +//| highlight_color: int = 0x000000, +//| refresh_display_command: int, +//| refresh_time: float = 40, +//| busy_pin: Optional[microcontroller.Pin] = None, +//| busy_state: bool = True, +//| seconds_per_frame: float = 180, +//| always_toggle_chip_select: bool = False, +//| grayscale: bool = False, +//| two_byte_sequence_length: bool = False +//| ) -> None: //| """Create a EPaperDisplay object on the given display bus (`displayio.FourWire` or `paralleldisplay.ParallelBus`). //| //| The ``start_sequence`` and ``stop_sequence`` are bitpacked to minimize the ram impact. Every @@ -103,7 +119,6 @@ //| :param bool grayscale: When true, the color ram is the low bit of 2-bit grayscale //| :param bool two_byte_sequence_length: When true, use two bytes to define sequence length""" //| ... -//| STATIC mp_obj_t displayio_epaperdisplay_make_new(const mp_obj_type_t *type, size_t n_args, size_t n_kw, const mp_obj_t *all_args) { enum { ARG_display_bus, ARG_start_sequence, ARG_stop_sequence, ARG_width, ARG_height, ARG_ram_width, ARG_ram_height, ARG_colstart, ARG_rowstart, ARG_rotation, @@ -203,7 +218,6 @@ static displayio_epaperdisplay_obj_t *native_display(mp_obj_t display_obj) { //| //| :param Group group: The group to show.""" //| ... -//| STATIC mp_obj_t displayio_epaperdisplay_obj_show(mp_obj_t self_in, mp_obj_t group_in) { displayio_epaperdisplay_obj_t *self = native_display(self_in); displayio_group_t *group = NULL; @@ -219,10 +233,11 @@ STATIC mp_obj_t displayio_epaperdisplay_obj_show(mp_obj_t self_in, mp_obj_t grou } MP_DEFINE_CONST_FUN_OBJ_2(displayio_epaperdisplay_show_obj, displayio_epaperdisplay_obj_show); -//| def update_refresh_mode(self, start_sequence: ReadableBuffer, seconds_per_frame: float = 180) -> None: +//| def update_refresh_mode( +//| self, start_sequence: ReadableBuffer, seconds_per_frame: float = 180 +//| ) -> None: //| """Updates the ``start_sequence`` and ``seconds_per_frame`` parameters to enable //| varying the refresh mode of the display.""" -//| STATIC mp_obj_t displayio_epaperdisplay_update_refresh_mode(size_t n_args, const mp_obj_t *pos_args, mp_map_t *kw_args) { enum { ARG_start_sequence, ARG_seconds_per_frame }; static const mp_arg_t allowed_args[] = { @@ -248,7 +263,6 @@ MP_DEFINE_CONST_FUN_OBJ_KW(displayio_epaperdisplay_update_refresh_mode_obj, 1, d //| """Refreshes the display immediately or raises an exception if too soon. Use //| ``time.sleep(display.time_to_refresh)`` to sleep until a refresh can occur.""" //| ... -//| STATIC mp_obj_t displayio_epaperdisplay_obj_refresh(mp_obj_t self_in) { displayio_epaperdisplay_obj_t *self = native_display(self_in); bool ok = common_hal_displayio_epaperdisplay_refresh(self); @@ -261,7 +275,6 @@ MP_DEFINE_CONST_FUN_OBJ_1(displayio_epaperdisplay_refresh_obj, displayio_epaperd //| time_to_refresh: float //| """Time, in fractional seconds, until the ePaper display can be refreshed.""" -//| STATIC mp_obj_t displayio_epaperdisplay_obj_get_time_to_refresh(mp_obj_t self_in) { displayio_epaperdisplay_obj_t *self = native_display(self_in); return mp_obj_new_float(common_hal_displayio_epaperdisplay_get_time_to_refresh(self) / 1000.0); @@ -274,7 +287,6 @@ MP_PROPERTY_GETTER(displayio_epaperdisplay_time_to_refresh_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)); @@ -286,7 +298,6 @@ MP_PROPERTY_GETTER(displayio_epaperdisplay_busy_obj, //| width: int //| """Gets the width of the display in pixels""" -//| STATIC mp_obj_t displayio_epaperdisplay_obj_get_width(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_width(self)); @@ -298,7 +309,6 @@ MP_PROPERTY_GETTER(displayio_epaperdisplay_width_obj, //| height: int //| """Gets the height of the display in pixels""" -//| STATIC mp_obj_t displayio_epaperdisplay_obj_get_height(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_height(self)); @@ -310,7 +320,6 @@ MP_PROPERTY_GETTER(displayio_epaperdisplay_height_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)); diff --git a/shared-bindings/displayio/FourWire.c b/shared-bindings/displayio/FourWire.c index 90aa5c6c17..edcf2ade0e 100644 --- a/shared-bindings/displayio/FourWire.c +++ b/shared-bindings/displayio/FourWire.c @@ -37,13 +37,23 @@ #include "shared-bindings/microcontroller/Pin.h" #include "shared-bindings/util.h" #include "shared-module/displayio/__init__.h" -#include "supervisor/shared/translate.h" +#include "supervisor/shared/translate/translate.h" //| class FourWire: //| """Manage updating a display over SPI four wire protocol in the background while Python code runs. //| It doesn't handle display initialization.""" //| -//| def __init__(self, spi_bus: busio.SPI, *, command: Optional[microcontroller.Pin], chip_select: microcontroller.Pin, reset: Optional[microcontroller.Pin] = None, baudrate: int = 24000000, polarity: int = 0, phase: int = 0) -> None: +//| def __init__( +//| self, +//| spi_bus: busio.SPI, +//| *, +//| command: Optional[microcontroller.Pin], +//| chip_select: microcontroller.Pin, +//| reset: Optional[microcontroller.Pin] = None, +//| baudrate: int = 24000000, +//| polarity: int = 0, +//| phase: int = 0 +//| ) -> None: //| """Create a FourWire object associated with the given pins. //| //| The SPI bus and pins are then in use by the display until `displayio.release_displays()` is @@ -65,7 +75,6 @@ //| :param int phase: the edge of the clock that data is captured. First (0) //| or second (1). Rising or falling depends on clock polarity.""" //| ... -//| STATIC mp_obj_t displayio_fourwire_make_new(const mp_obj_type_t *type, size_t n_args, size_t n_kw, const mp_obj_t *all_args) { enum { ARG_spi_bus, ARG_command, ARG_chip_select, ARG_reset, ARG_baudrate, ARG_polarity, ARG_phase }; static const mp_arg_t allowed_args[] = { @@ -89,14 +98,8 @@ STATIC mp_obj_t displayio_fourwire_make_new(const mp_obj_type_t *type, size_t n_ displayio_fourwire_obj_t *self = &allocate_display_bus_or_raise()->fourwire_bus; self->base.type = &displayio_fourwire_type; - uint8_t polarity = args[ARG_polarity].u_int; - if (polarity != 0 && polarity != 1) { - mp_raise_ValueError(translate("Invalid polarity")); - } - uint8_t phase = args[ARG_phase].u_int; - if (phase != 0 && phase != 1) { - mp_raise_ValueError(translate("Invalid phase")); - } + uint8_t polarity = (uint8_t)mp_arg_validate_int_range(args[ARG_polarity].u_int, 0, 1, MP_QSTR_polarity); + uint8_t phase = (uint8_t)mp_arg_validate_int_range(args[ARG_phase].u_int, 0, 1, MP_QSTR_phase); common_hal_displayio_fourwire_construct(self, MP_OBJ_TO_PTR(spi), command, chip_select, reset, args[ARG_baudrate].u_int, polarity, phase); @@ -107,7 +110,6 @@ STATIC mp_obj_t displayio_fourwire_make_new(const mp_obj_type_t *type, size_t n_ //| """Performs a hardware reset via the reset pin. Raises an exception if called when no reset pin //| is available.""" //| ... -//| STATIC mp_obj_t displayio_fourwire_obj_reset(mp_obj_t self_in) { displayio_fourwire_obj_t *self = self_in; @@ -118,7 +120,9 @@ STATIC mp_obj_t displayio_fourwire_obj_reset(mp_obj_t self_in) { } MP_DEFINE_CONST_FUN_OBJ_1(displayio_fourwire_reset_obj, displayio_fourwire_obj_reset); -//| def send(self, command: int, data: ReadableBuffer, *, toggle_every_byte: bool = False) -> None: +//| def send( +//| self, command: int, data: ReadableBuffer, *, toggle_every_byte: bool = False +//| ) -> None: //| """Sends the given command value followed by the full set of data. Display state, such as //| vertical scroll, set via ``send`` may or may not be reset once the code is done.""" //| ... @@ -133,10 +137,8 @@ STATIC mp_obj_t displayio_fourwire_obj_send(size_t n_args, const mp_obj_t *pos_a mp_arg_val_t args[MP_ARRAY_SIZE(allowed_args)]; mp_arg_parse_all(n_args - 1, pos_args + 1, kw_args, MP_ARRAY_SIZE(allowed_args), allowed_args, args); - mp_int_t command_int = args[ARG_command].u_int; - if (command_int > 255 || command_int < 0) { - mp_raise_ValueError(translate("Command must be an int between 0 and 255")); - } + mp_int_t command_int = mp_arg_validate_int_range(args[ARG_command].u_int, 0, 255, MP_QSTR_command); + displayio_fourwire_obj_t *self = pos_args[0]; uint8_t command = command_int; mp_buffer_info_t bufinfo; diff --git a/shared-bindings/displayio/Group.c b/shared-bindings/displayio/Group.c index 188331f99d..3e4569b271 100644 --- a/shared-bindings/displayio/Group.c +++ b/shared-bindings/displayio/Group.c @@ -33,7 +33,7 @@ #include "py/objproperty.h" #include "py/objtype.h" #include "py/runtime.h" -#include "supervisor/shared/translate.h" +#include "supervisor/shared/translate/translate.h" //| class Group: //| """Manage a group of sprites and groups and how they are inter-related.""" @@ -46,7 +46,6 @@ //| :param int x: Initial x position within the parent. //| :param int y: Initial y position within the parent.""" //| ... -//| STATIC mp_obj_t displayio_group_make_new(const mp_obj_type_t *type, size_t n_args, size_t n_kw, const mp_obj_t *all_args) { enum { ARG_scale, ARG_x, ARG_y }; static const mp_arg_t allowed_args[] = { @@ -57,10 +56,7 @@ STATIC mp_obj_t displayio_group_make_new(const mp_obj_type_t *type, size_t n_arg mp_arg_val_t args[MP_ARRAY_SIZE(allowed_args)]; mp_arg_parse_all_kw_array(n_args, n_kw, all_args, MP_ARRAY_SIZE(allowed_args), allowed_args, args); - mp_int_t scale = args[ARG_scale].u_int; - if (scale < 1) { - mp_raise_ValueError_varg(translate("%q must be >= 1"), MP_QSTR_scale); - } + mp_int_t scale = mp_arg_validate_int_min(args[ARG_scale].u_int, 1, MP_QSTR_scale); displayio_group_t *self = m_new_obj(displayio_group_t); self->base.type = &displayio_group_type; @@ -82,7 +78,6 @@ displayio_group_t *native_group(mp_obj_t group_obj) { //| hidden: bool //| """True when the Group and all of it's layers are not visible. When False, the Group's layers //| are visible if they haven't been hidden.""" -//| STATIC mp_obj_t displayio_group_obj_get_hidden(mp_obj_t self_in) { displayio_group_t *self = native_group(self_in); return mp_obj_new_bool(common_hal_displayio_group_get_hidden(self)); @@ -104,7 +99,6 @@ MP_PROPERTY_GETSET(displayio_group_hidden_obj, //| scale: int //| """Scales each pixel within the Group in both directions. For example, when scale=2 each pixel //| will be represented by 2x2 pixels.""" -//| STATIC mp_obj_t displayio_group_obj_get_scale(mp_obj_t self_in) { displayio_group_t *self = native_group(self_in); return MP_OBJ_NEW_SMALL_INT(common_hal_displayio_group_get_scale(self)); @@ -114,10 +108,8 @@ MP_DEFINE_CONST_FUN_OBJ_1(displayio_group_get_scale_obj, displayio_group_obj_get STATIC mp_obj_t displayio_group_obj_set_scale(mp_obj_t self_in, mp_obj_t scale_obj) { displayio_group_t *self = native_group(self_in); - mp_int_t scale = mp_obj_get_int(scale_obj); - if (scale < 1) { - mp_raise_ValueError_varg(translate("%q must be >= 1"), MP_QSTR_scale); - } + mp_int_t scale = mp_arg_validate_int_min(mp_obj_get_int(scale_obj), 1, MP_QSTR_scale); + common_hal_displayio_group_set_scale(self, scale); return mp_const_none; } @@ -129,7 +121,6 @@ MP_PROPERTY_GETSET(displayio_group_scale_obj, //| x: int //| """X position of the Group in the parent.""" -//| STATIC mp_obj_t displayio_group_obj_get_x(mp_obj_t self_in) { displayio_group_t *self = native_group(self_in); return MP_OBJ_NEW_SMALL_INT(common_hal_displayio_group_get_x(self)); @@ -151,7 +142,6 @@ MP_PROPERTY_GETSET(displayio_group_x_obj, //| y: int //| """Y position of the Group in the parent.""" -//| STATIC mp_obj_t displayio_group_obj_get_y(mp_obj_t self_in) { displayio_group_t *self = native_group(self_in); return MP_OBJ_NEW_SMALL_INT(common_hal_displayio_group_get_y(self)); @@ -171,10 +161,12 @@ MP_PROPERTY_GETSET(displayio_group_y_obj, (mp_obj_t)&displayio_group_get_y_obj, (mp_obj_t)&displayio_group_set_y_obj); -//| def append(self, layer: Union[vectorio.Circle, vectorio.Rectangle, vectorio.Polygon, Group, TileGrid]) -> None: +//| def append( +//| self, +//| layer: Union[vectorio.Circle, vectorio.Rectangle, vectorio.Polygon, Group, TileGrid], +//| ) -> None: //| """Append a layer to the group. It will be drawn above other layers.""" //| ... -//| STATIC mp_obj_t displayio_group_obj_append(mp_obj_t self_in, mp_obj_t layer) { displayio_group_t *self = native_group(self_in); common_hal_displayio_group_insert(self, common_hal_displayio_group_get_len(self), layer); @@ -182,10 +174,13 @@ STATIC mp_obj_t displayio_group_obj_append(mp_obj_t self_in, mp_obj_t layer) { } MP_DEFINE_CONST_FUN_OBJ_2(displayio_group_append_obj, displayio_group_obj_append); -//| def insert(self, index: int, layer: Union[vectorio.Circle, vectorio.Rectangle, vectorio.Polygon, Group, TileGrid]) -> None: +//| def insert( +//| self, +//| index: int, +//| layer: Union[vectorio.Circle, vectorio.Rectangle, vectorio.Polygon, Group, TileGrid], +//| ) -> None: //| """Insert a layer into the group.""" //| ... -//| STATIC mp_obj_t displayio_group_obj_insert(mp_obj_t self_in, mp_obj_t index_obj, mp_obj_t layer) { displayio_group_t *self = native_group(self_in); if ((size_t)MP_OBJ_SMALL_INT_VALUE(index_obj) == common_hal_displayio_group_get_len(self)) { @@ -198,10 +193,12 @@ STATIC mp_obj_t displayio_group_obj_insert(mp_obj_t self_in, mp_obj_t index_obj, MP_DEFINE_CONST_FUN_OBJ_3(displayio_group_insert_obj, displayio_group_obj_insert); -//| def index(self, layer: Union[vectorio.Circle, vectorio.Rectangle, vectorio.Polygon, Group, TileGrid]) -> int: +//| def index( +//| self, +//| layer: Union[vectorio.Circle, vectorio.Rectangle, vectorio.Polygon, Group, TileGrid], +//| ) -> int: //| """Returns the index of the first copy of layer. Raises ValueError if not found.""" //| ... -//| STATIC mp_obj_t displayio_group_obj_index(mp_obj_t self_in, mp_obj_t layer) { displayio_group_t *self = native_group(self_in); mp_int_t index = common_hal_displayio_group_index(self, layer); @@ -212,10 +209,11 @@ STATIC mp_obj_t displayio_group_obj_index(mp_obj_t self_in, mp_obj_t layer) { } MP_DEFINE_CONST_FUN_OBJ_2(displayio_group_index_obj, displayio_group_obj_index); -//| def pop(self, i: int = -1) -> Union[vectorio.Circle, vectorio.Rectangle, vectorio.Polygon, Group, TileGrid]: +//| def pop( +//| self, i: int = -1 +//| ) -> Union[vectorio.Circle, vectorio.Rectangle, vectorio.Polygon, Group, TileGrid]: //| """Remove the ith item and return it.""" //| ... -//| STATIC mp_obj_t displayio_group_obj_pop(size_t n_args, const mp_obj_t *pos_args, mp_map_t *kw_args) { enum { ARG_i }; static const mp_arg_t allowed_args[] = { @@ -235,10 +233,12 @@ STATIC mp_obj_t displayio_group_obj_pop(size_t n_args, const mp_obj_t *pos_args, MP_DEFINE_CONST_FUN_OBJ_KW(displayio_group_pop_obj, 1, displayio_group_obj_pop); -//| def remove(self, layer: Union[vectorio.Circle, vectorio.Rectangle, vectorio.Polygon, Group, TileGrid]) -> None: +//| def remove( +//| self, +//| layer: Union[vectorio.Circle, vectorio.Rectangle, vectorio.Polygon, Group, TileGrid], +//| ) -> None: //| """Remove the first copy of layer. Raises ValueError if it is not present.""" //| ... -//| STATIC mp_obj_t displayio_group_obj_remove(mp_obj_t self_in, mp_obj_t layer) { mp_obj_t index = displayio_group_obj_index(self_in, layer); displayio_group_t *self = native_group(self_in); @@ -248,13 +248,10 @@ STATIC mp_obj_t displayio_group_obj_remove(mp_obj_t self_in, mp_obj_t layer) { } MP_DEFINE_CONST_FUN_OBJ_2(displayio_group_remove_obj, displayio_group_obj_remove); -//| def __bool__(self) -> bool: -//| ... -//| +//| def __bool__(self) -> bool: ... //| def __len__(self) -> int: //| """Returns the number of layers in a Group""" //| ... -//| STATIC mp_obj_t group_unary_op(mp_unary_op_t op, mp_obj_t self_in) { displayio_group_t *self = native_group(self_in); uint16_t len = common_hal_displayio_group_get_len(self); @@ -268,22 +265,26 @@ STATIC mp_obj_t group_unary_op(mp_unary_op_t op, mp_obj_t self_in) { } } -//| def __getitem__(self, index: int) -> Union[vectorio.Circle, vectorio.Rectangle, vectorio.Polygon, Group, TileGrid]: +//| def __getitem__( +//| self, index: int +//| ) -> Union[vectorio.Circle, vectorio.Rectangle, vectorio.Polygon, Group, TileGrid]: //| """Returns the value at the given index. //| //| This allows you to:: //| //| print(group[0])""" //| ... -//| -//| def __setitem__(self, index: int, value: Union[vectorio.Circle, vectorio.Rectangle, vectorio.Polygon, Group, TileGrid]) -> None: +//| def __setitem__( +//| self, +//| index: int, +//| value: Union[vectorio.Circle, vectorio.Rectangle, vectorio.Polygon, Group, TileGrid], +//| ) -> None: //| """Sets the value at the given index. //| //| This allows you to:: //| //| group[0] = sprite""" //| ... -//| //| def __delitem__(self, index: int) -> None: //| """Deletes the value at the given index. //| @@ -291,7 +292,6 @@ STATIC mp_obj_t group_unary_op(mp_unary_op_t op, mp_obj_t self_in) { //| //| del group[0]""" //| ... -//| STATIC mp_obj_t group_subscr(mp_obj_t self_in, mp_obj_t index_obj, mp_obj_t value) { displayio_group_t *self = native_group(self_in); diff --git a/shared-bindings/displayio/I2CDisplay.c b/shared-bindings/displayio/I2CDisplay.c index fbfbd04c64..2374e58e4a 100644 --- a/shared-bindings/displayio/I2CDisplay.c +++ b/shared-bindings/displayio/I2CDisplay.c @@ -37,13 +37,19 @@ #include "shared-bindings/busio/I2C.h" #include "shared-bindings/util.h" #include "shared-module/displayio/__init__.h" -#include "supervisor/shared/translate.h" +#include "supervisor/shared/translate/translate.h" //| class I2CDisplay: //| """Manage updating a display over I2C in the background while Python code runs. //| It doesn't handle display initialization.""" //| -//| def __init__(self, i2c_bus: busio.I2C, *, device_address: int, reset: Optional[microcontroller.Pin] = None) -> None: +//| def __init__( +//| self, +//| i2c_bus: busio.I2C, +//| *, +//| device_address: int, +//| reset: Optional[microcontroller.Pin] = None +//| ) -> None: //| """Create a I2CDisplay object associated with the given I2C bus and reset pin. //| //| The I2C bus and pins are then in use by the display until `displayio.release_displays()` is @@ -55,7 +61,6 @@ //| :param int device_address: The I2C address of the device //| :param microcontroller.Pin reset: Reset pin. When None only software reset can be used""" //| ... -//| STATIC mp_obj_t displayio_i2cdisplay_make_new(const mp_obj_type_t *type, size_t n_args, size_t n_kw, const mp_obj_t *all_args) { enum { ARG_i2c_bus, ARG_device_address, ARG_reset }; static const mp_arg_t allowed_args[] = { @@ -81,7 +86,6 @@ STATIC mp_obj_t displayio_i2cdisplay_make_new(const mp_obj_type_t *type, size_t //| """Performs a hardware reset via the reset pin. Raises an exception if called when no reset pin //| is available.""" //| ... -//| STATIC mp_obj_t displayio_i2cdisplay_obj_reset(mp_obj_t self_in) { displayio_i2cdisplay_obj_t *self = self_in; @@ -98,10 +102,9 @@ MP_DEFINE_CONST_FUN_OBJ_1(displayio_i2cdisplay_reset_obj, displayio_i2cdisplay_o //| ... //| STATIC mp_obj_t displayio_i2cdisplay_obj_send(mp_obj_t self, mp_obj_t command_obj, mp_obj_t data_obj) { - mp_int_t command_int = MP_OBJ_SMALL_INT_VALUE(command_obj); - if (!mp_obj_is_small_int(command_obj) || command_int > 255 || command_int < 0) { - mp_raise_ValueError(translate("Command must be an int between 0 and 255")); - } + mp_int_t command_int = mp_obj_get_int(command_obj); + mp_arg_validate_int_range(command_int, 0, 255, MP_QSTR_command); + uint8_t command = command_int; mp_buffer_info_t bufinfo; mp_get_buffer_raise(data_obj, &bufinfo, MP_BUFFER_READ); diff --git a/shared-bindings/displayio/OnDiskBitmap.c b/shared-bindings/displayio/OnDiskBitmap.c index aa749bf7f7..a53196ef05 100644 --- a/shared-bindings/displayio/OnDiskBitmap.c +++ b/shared-bindings/displayio/OnDiskBitmap.c @@ -30,7 +30,7 @@ #include "py/runtime.h" #include "py/objproperty.h" -#include "supervisor/shared/translate.h" +#include "supervisor/shared/translate/translate.h" #include "shared-bindings/displayio/OnDiskBitmap.h" //| class OnDiskBitmap: @@ -48,7 +48,6 @@ //| import time //| import pulseio //| -//| board.DISPLAY.auto_brightness = False //| board.DISPLAY.brightness = 0 //| splash = displayio.Group() //| board.DISPLAY.show(splash) @@ -68,7 +67,7 @@ //| while True: //| pass""" //| -//| def __init__(self, file: Union[str,typing.BinaryIO]) -> None: +//| def __init__(self, file: Union[str, typing.BinaryIO]) -> None: //| """Create an OnDiskBitmap object with the given file. //| //| :param file file: The name of the bitmap file. For backwards compatibility, a file opened in binary mode may also be passed. @@ -79,7 +78,6 @@ //| of CircuitPython will remove the ability to pass in an opened file. //| """ //| ... -//| STATIC mp_obj_t displayio_ondiskbitmap_make_new(const mp_obj_type_t *type, size_t n_args, size_t n_kw, const mp_obj_t *all_args) { mp_arg_check_num(n_args, n_kw, 1, 1, false); mp_obj_t arg = all_args[0]; @@ -100,7 +98,6 @@ STATIC mp_obj_t displayio_ondiskbitmap_make_new(const mp_obj_type_t *type, size_ //| width: int //| """Width of the bitmap. (read only)""" -//| STATIC mp_obj_t displayio_ondiskbitmap_obj_get_width(mp_obj_t self_in) { displayio_ondiskbitmap_t *self = MP_OBJ_TO_PTR(self_in); @@ -114,7 +111,6 @@ MP_PROPERTY_GETTER(displayio_ondiskbitmap_width_obj, //| height: int //| """Height of the bitmap. (read only)""" -//| STATIC mp_obj_t displayio_ondiskbitmap_obj_get_height(mp_obj_t self_in) { displayio_ondiskbitmap_t *self = MP_OBJ_TO_PTR(self_in); diff --git a/shared-bindings/displayio/Palette.c b/shared-bindings/displayio/Palette.c index ad6d7c319a..aa24dc262f 100644 --- a/shared-bindings/displayio/Palette.c +++ b/shared-bindings/displayio/Palette.c @@ -34,7 +34,7 @@ #include "py/runtime.h" #include "shared-bindings/microcontroller/Pin.h" #include "shared-bindings/util.h" -#include "supervisor/shared/translate.h" +#include "supervisor/shared/translate/translate.h" //| class Palette: //| """Map a pixel palette_index to a full color. Colors are transformed to the display's format internally to @@ -45,7 +45,6 @@ //| //| :param int color_count: The number of colors in the Palette""" //| ... -//| // TODO(tannewt): Add support for other color formats. // TODO(tannewt): Add support for 8-bit alpha blending. //| @@ -64,13 +63,10 @@ STATIC mp_obj_t displayio_palette_make_new(const mp_obj_type_t *type, size_t n_a return MP_OBJ_FROM_PTR(self); } -//| def __bool__(self) -> bool: -//| ... -//| +//| def __bool__(self) -> bool: ... //| def __len__(self) -> int: //| """Returns the number of colors in a Palette""" //| ... -//| STATIC mp_obj_t group_unary_op(mp_unary_op_t op, mp_obj_t self_in) { displayio_palette_t *self = MP_OBJ_TO_PTR(self_in); switch (op) { @@ -86,8 +82,9 @@ STATIC mp_obj_t group_unary_op(mp_unary_op_t op, mp_obj_t self_in) { //| def __getitem__(self, index: int) -> Optional[int]: //| r"""Return the pixel color at the given index as an integer.""" //| ... -//| -//| def __setitem__(self, index: int, value: Union[int, ReadableBuffer, Tuple[int, int, int]]) -> None: +//| def __setitem__( +//| self, index: int, value: Union[int, ReadableBuffer, Tuple[int, int, int]] +//| ) -> None: //| r"""Sets the pixel color at the given index. The index should be an integer in the range 0 to color_count-1. //| //| The value argument represents a color, and can be from 0x000000 to 0xFFFFFF (to represent an RGB value). @@ -102,7 +99,6 @@ STATIC mp_obj_t group_unary_op(mp_unary_op_t op, mp_obj_t self_in) { //| palette[3] = bytearray(b'\x00\x00\xFF') # set using a bytearay of 3 or 4 bytes //| palette[4] = (10, 20, 30) # set using a tuple of 3 integers""" //| ... -//| STATIC mp_obj_t palette_subscr(mp_obj_t self_in, mp_obj_t index_in, mp_obj_t value) { if (value == MP_OBJ_NULL) { // delete item @@ -150,31 +146,25 @@ STATIC mp_obj_t palette_subscr(mp_obj_t self_in, mp_obj_t index_in, mp_obj_t val return mp_const_none; } -//| def make_transparent(self, palette_index: int) -> None: -//| ... -//| +//| def make_transparent(self, palette_index: int) -> None: ... STATIC mp_obj_t displayio_palette_obj_make_transparent(mp_obj_t self_in, mp_obj_t palette_index_obj) { displayio_palette_t *self = MP_OBJ_TO_PTR(self_in); - mp_int_t palette_index; - if (!mp_obj_get_int_maybe(palette_index_obj, &palette_index)) { - mp_raise_ValueError(translate("palette_index should be an int")); - } + mp_int_t palette_index = mp_arg_validate_type_int(palette_index_obj, MP_QSTR_palette_index); + mp_arg_validate_int_range(palette_index, 0, common_hal_displayio_palette_get_len(self) - 1, MP_QSTR_palette_index); + common_hal_displayio_palette_make_transparent(self, palette_index); return mp_const_none; } MP_DEFINE_CONST_FUN_OBJ_2(displayio_palette_make_transparent_obj, displayio_palette_obj_make_transparent); -//| def make_opaque(self, palette_index: int) -> None: -//| ... -//| +//| def make_opaque(self, palette_index: int) -> None: ... STATIC mp_obj_t displayio_palette_obj_make_opaque(mp_obj_t self_in, mp_obj_t palette_index_obj) { displayio_palette_t *self = MP_OBJ_TO_PTR(self_in); - mp_int_t palette_index; - if (!mp_obj_get_int_maybe(palette_index_obj, &palette_index)) { - mp_raise_ValueError(translate("palette_index should be an int")); - } + mp_int_t palette_index = mp_arg_validate_type_int(palette_index_obj, MP_QSTR_palette_index); + palette_index = mp_arg_validate_int_range(palette_index, 0, common_hal_displayio_palette_get_len(self) - 1, MP_QSTR_palette_index); + common_hal_displayio_palette_make_opaque(self, palette_index); return mp_const_none; } @@ -187,10 +177,9 @@ MP_DEFINE_CONST_FUN_OBJ_2(displayio_palette_make_opaque_obj, displayio_palette_o STATIC mp_obj_t displayio_palette_obj_is_transparent(mp_obj_t self_in, mp_obj_t palette_index_obj) { displayio_palette_t *self = MP_OBJ_TO_PTR(self_in); - mp_int_t palette_index; - if (!mp_obj_get_int_maybe(palette_index_obj, &palette_index)) { - mp_raise_ValueError(translate("palette_index should be an int")); - } + mp_int_t palette_index = mp_arg_validate_type_int(palette_index_obj, MP_QSTR_palette_index); + palette_index = mp_arg_validate_int_range(palette_index, 0, common_hal_displayio_palette_get_len(self) - 1, MP_QSTR_palette_index); + return mp_obj_new_bool(common_hal_displayio_palette_is_transparent(self, palette_index)); } MP_DEFINE_CONST_FUN_OBJ_2(displayio_palette_is_transparent_obj, displayio_palette_obj_is_transparent); diff --git a/shared-bindings/displayio/Shape.c b/shared-bindings/displayio/Shape.c index f39e7820a9..c8b3959837 100644 --- a/shared-bindings/displayio/Shape.c +++ b/shared-bindings/displayio/Shape.c @@ -32,12 +32,14 @@ #include "py/objproperty.h" #include "py/runtime.h" #include "shared-bindings/util.h" -#include "supervisor/shared/translate.h" +#include "supervisor/shared/translate/translate.h" //| class Shape: //| """Represents a shape made by defining boundaries that may be mirrored.""" //| -//| def __init__(self, width: int, height: int, *, mirror_x: bool = False, mirror_y: bool = False) -> None: +//| def __init__( +//| self, width: int, height: int, *, mirror_x: bool = False, mirror_y: bool = False +//| ) -> None: //| """Create a Shape object with the given fixed size. Each pixel is one bit and is stored by the //| column boundaries of the shape on each row. Each row's boundary defaults to the full row. //| @@ -46,7 +48,6 @@ //| :param bool mirror_x: When true the left boundary is mirrored to the right. //| :param bool mirror_y: When true the top boundary is mirrored to the bottom.""" //| ... -//| STATIC mp_obj_t displayio_shape_make_new(const mp_obj_type_t *type, size_t n_args, size_t n_kw, const mp_obj_t *all_args) { enum { ARG_width, ARG_height, ARG_mirror_x, ARG_mirror_y }; static const mp_arg_t allowed_args[] = { @@ -58,14 +59,8 @@ STATIC mp_obj_t displayio_shape_make_new(const mp_obj_type_t *type, size_t n_arg mp_arg_val_t args[MP_ARRAY_SIZE(allowed_args)]; mp_arg_parse_all_kw_array(n_args, n_kw, all_args, MP_ARRAY_SIZE(allowed_args), allowed_args, args); - mp_int_t width = args[ARG_width].u_int; - if (width < 1) { - mp_raise_ValueError_varg(translate("%q must be >= 1"), MP_QSTR_width); - } - mp_int_t height = args[ARG_height].u_int; - if (height < 1) { - mp_raise_ValueError_varg(translate("%q must be >= 1"), MP_QSTR_height); - } + mp_int_t width = mp_arg_validate_int_min(args[ARG_width].u_int, 1, MP_QSTR_width); + mp_int_t height = mp_arg_validate_int_min(args[ARG_height].u_int, 1, MP_QSTR_height); displayio_shape_t *self = m_new_obj(displayio_shape_t); self->base.type = &displayio_shape_type; @@ -86,18 +81,9 @@ STATIC mp_obj_t displayio_shape_make_new(const mp_obj_type_t *type, size_t n_arg STATIC mp_obj_t displayio_shape_obj_set_boundary(size_t n_args, const mp_obj_t *args) { (void)n_args; displayio_shape_t *self = MP_OBJ_TO_PTR(args[0]); - mp_int_t y; - if (!mp_obj_get_int_maybe(args[1], &y)) { - mp_raise_ValueError(translate("y should be an int")); - } - mp_int_t start_x; - if (!mp_obj_get_int_maybe(args[2], &start_x)) { - mp_raise_ValueError(translate("start_x should be an int")); - } - mp_int_t end_x; - if (!mp_obj_get_int_maybe(args[3], &end_x)) { - mp_raise_ValueError(translate("end_x should be an int")); - } + mp_int_t y = mp_arg_validate_type_int(args[1], MP_QSTR_y); + mp_int_t start_x = mp_arg_validate_type_int(args[1], MP_QSTR_start_x); + mp_int_t end_x = mp_arg_validate_type_int(args[1], MP_QSTR_end_x); common_hal_displayio_shape_set_boundary(self, y, start_x, end_x); return mp_const_none; diff --git a/shared-bindings/displayio/TileGrid.c b/shared-bindings/displayio/TileGrid.c index 113721bcc6..f2e16985c3 100644 --- a/shared-bindings/displayio/TileGrid.c +++ b/shared-bindings/displayio/TileGrid.c @@ -38,7 +38,7 @@ #include "shared-bindings/displayio/OnDiskBitmap.h" #include "shared-bindings/displayio/Palette.h" #include "shared-bindings/displayio/Shape.h" -#include "supervisor/shared/translate.h" +#include "supervisor/shared/translate/translate.h" //| class TileGrid: //| """A grid of tiles sourced out of one bitmap @@ -48,7 +48,19 @@ //| //| A single tile grid is also known as a Sprite.""" //| -//| def __init__(self, bitmap: Union[Bitmap, OnDiskBitmap, Shape], *, pixel_shader: Union[ColorConverter, Palette], width: int = 1, height: int = 1, tile_width: Optional[int] = None, tile_height: Optional[int] = None, default_tile: int = 0, x: int = 0, y: int = 0) -> None: +//| def __init__( +//| self, +//| bitmap: Union[Bitmap, OnDiskBitmap, Shape], +//| *, +//| pixel_shader: Union[ColorConverter, Palette], +//| width: int = 1, +//| height: int = 1, +//| tile_width: Optional[int] = None, +//| tile_height: Optional[int] = None, +//| default_tile: int = 0, +//| x: int = 0, +//| y: int = 0 +//| ) -> None: //| """Create a TileGrid object. The bitmap is source for 2d pixels. The pixel_shader is used to //| convert the value and its location to a display native pixel color. This may be a simple color //| palette lookup, a gradient, a pattern or a color transformer. @@ -66,7 +78,6 @@ //| :param int default_tile: Default tile index to show. //| :param int x: Initial x position of the left edge within the parent. //| :param int y: Initial y position of the top edge within the parent.""" -//| STATIC mp_obj_t displayio_tilegrid_make_new(const mp_obj_type_t *type, size_t n_args, size_t n_kw, const mp_obj_t *all_args) { enum { ARG_bitmap, ARG_pixel_shader, ARG_width, ARG_height, ARG_tile_width, ARG_tile_height, ARG_default_tile, ARG_x, ARG_y }; static const mp_arg_t allowed_args[] = { @@ -146,7 +157,6 @@ static displayio_tilegrid_t *native_tilegrid(mp_obj_t tilegrid_obj) { //| hidden: bool //| """True when the TileGrid is hidden. This may be False even when a part of a hidden Group.""" -//| STATIC mp_obj_t displayio_tilegrid_obj_get_hidden(mp_obj_t self_in) { displayio_tilegrid_t *self = native_tilegrid(self_in); return mp_obj_new_bool(common_hal_displayio_tilegrid_get_hidden(self)); @@ -167,7 +177,6 @@ MP_PROPERTY_GETSET(displayio_tilegrid_hidden_obj, //| x: int //| """X position of the left edge in the parent.""" -//| STATIC mp_obj_t displayio_tilegrid_obj_get_x(mp_obj_t self_in) { displayio_tilegrid_t *self = native_tilegrid(self_in); return MP_OBJ_NEW_SMALL_INT(common_hal_displayio_tilegrid_get_x(self)); @@ -189,7 +198,6 @@ MP_PROPERTY_GETSET(displayio_tilegrid_x_obj, //| y: int //| """Y position of the top edge in the parent.""" -//| STATIC mp_obj_t displayio_tilegrid_obj_get_y(mp_obj_t self_in) { displayio_tilegrid_t *self = native_tilegrid(self_in); return MP_OBJ_NEW_SMALL_INT(common_hal_displayio_tilegrid_get_y(self)); @@ -211,7 +219,6 @@ MP_PROPERTY_GETSET(displayio_tilegrid_y_obj, //| width: int //| """Width of the tilegrid in tiles.""" -//| STATIC mp_obj_t displayio_tilegrid_obj_get_width(mp_obj_t self_in) { displayio_tilegrid_t *self = native_tilegrid(self_in); return MP_OBJ_NEW_SMALL_INT(common_hal_displayio_tilegrid_get_width(self)); @@ -223,7 +230,6 @@ MP_PROPERTY_GETTER(displayio_tilegrid_width_obj, //| height: int //| """Height of the tilegrid in tiles.""" -//| STATIC mp_obj_t displayio_tilegrid_obj_get_height(mp_obj_t self_in) { displayio_tilegrid_t *self = native_tilegrid(self_in); return MP_OBJ_NEW_SMALL_INT(common_hal_displayio_tilegrid_get_height(self)); @@ -235,7 +241,6 @@ MP_PROPERTY_GETTER(displayio_tilegrid_height_obj, //| tile_width: int //| """Width of a single tile in pixels.""" -//| STATIC mp_obj_t displayio_tilegrid_obj_get_tile_width(mp_obj_t self_in) { displayio_tilegrid_t *self = native_tilegrid(self_in); return MP_OBJ_NEW_SMALL_INT(common_hal_displayio_tilegrid_get_tile_width(self)); @@ -247,7 +252,6 @@ MP_PROPERTY_GETTER(displayio_tilegrid_tile_width_obj, //| tile_height: int //| """Height of a single tile in pixels.""" -//| STATIC mp_obj_t displayio_tilegrid_obj_get_tile_height(mp_obj_t self_in) { displayio_tilegrid_t *self = native_tilegrid(self_in); return MP_OBJ_NEW_SMALL_INT(common_hal_displayio_tilegrid_get_tile_height(self)); @@ -259,7 +263,6 @@ MP_PROPERTY_GETTER(displayio_tilegrid_tile_height_obj, //| flip_x: bool //| """If true, the left edge rendered will be the right edge of the right-most tile.""" -//| STATIC mp_obj_t displayio_tilegrid_obj_get_flip_x(mp_obj_t self_in) { displayio_tilegrid_t *self = native_tilegrid(self_in); return mp_obj_new_bool(common_hal_displayio_tilegrid_get_flip_x(self)); @@ -280,7 +283,6 @@ MP_PROPERTY_GETSET(displayio_tilegrid_flip_x_obj, //| flip_y: bool //| """If true, the top edge rendered will be the bottom edge of the bottom-most tile.""" -//| STATIC mp_obj_t displayio_tilegrid_obj_get_flip_y(mp_obj_t self_in) { displayio_tilegrid_t *self = native_tilegrid(self_in); return mp_obj_new_bool(common_hal_displayio_tilegrid_get_flip_y(self)); @@ -303,7 +305,6 @@ MP_PROPERTY_GETSET(displayio_tilegrid_flip_y_obj, //| transpose_xy: bool //| """If true, the TileGrid's axis will be swapped. When combined with mirroring, any 90 degree //| rotation can be achieved along with the corresponding mirrored version.""" -//| STATIC mp_obj_t displayio_tilegrid_obj_get_transpose_xy(mp_obj_t self_in) { displayio_tilegrid_t *self = native_tilegrid(self_in); return mp_obj_new_bool(common_hal_displayio_tilegrid_get_transpose_xy(self)); @@ -322,9 +323,25 @@ MP_PROPERTY_GETSET(displayio_tilegrid_transpose_xy_obj, (mp_obj_t)&displayio_tilegrid_get_transpose_xy_obj, (mp_obj_t)&displayio_tilegrid_set_transpose_xy_obj); +//| def contains(self, touch_tuple: tuple) -> bool: +//| """Returns True if the first two values in ``touch_tuple`` represent an x,y coordinate +//| inside the tilegrid rectangle bounds.""" +STATIC mp_obj_t displayio_tilegrid_obj_contains(mp_obj_t self_in, mp_obj_t touch_tuple) { + displayio_tilegrid_t *self = MP_OBJ_TO_PTR(self_in); + + mp_obj_t *touch_tuple_items; + mp_obj_get_array_fixed_n(touch_tuple, 3, &touch_tuple_items); + uint16_t x = 0; + uint16_t y = 0; + x = mp_obj_get_int(touch_tuple_items[0]); + y = mp_obj_get_int(touch_tuple_items[1]); + + return mp_obj_new_bool(common_hal_displayio_tilegrid_contains(self, x, y)); +} +MP_DEFINE_CONST_FUN_OBJ_2(displayio_tilegrid_contains_obj, displayio_tilegrid_obj_contains); + //| pixel_shader: Union[ColorConverter, Palette] //| """The pixel shader of the tilegrid.""" -//| STATIC mp_obj_t displayio_tilegrid_obj_get_pixel_shader(mp_obj_t self_in) { displayio_tilegrid_t *self = native_tilegrid(self_in); return common_hal_displayio_tilegrid_get_pixel_shader(self); @@ -347,9 +364,8 @@ MP_PROPERTY_GETSET(displayio_tilegrid_pixel_shader_obj, (mp_obj_t)&displayio_tilegrid_get_pixel_shader_obj, (mp_obj_t)&displayio_tilegrid_set_pixel_shader_obj); -//| bitmap: Union[Bitmap,OnDiskBitmap,Shape] +//| bitmap: Union[Bitmap, OnDiskBitmap, Shape] //| """The bitmap of the tilegrid.""" -//| STATIC mp_obj_t displayio_tilegrid_obj_get_bitmap(mp_obj_t self_in) { displayio_tilegrid_t *self = native_tilegrid(self_in); return common_hal_displayio_tilegrid_get_bitmap(self); @@ -418,7 +434,6 @@ MP_PROPERTY_GETSET(displayio_tilegrid_bitmap_obj, //| //| print(grid[0])""" //| ... -//| //| def __setitem__(self, index: Union[Tuple[int, int], int], value: int) -> None: //| """Sets the tile index at the given index. The index can either be an x,y tuple or an int equal //| to ``y * width + x``. @@ -464,9 +479,8 @@ STATIC mp_obj_t tilegrid_subscr(mp_obj_t self_in, mp_obj_t index_obj, mp_obj_t v return MP_OBJ_NULL; // op not supported } else { mp_int_t value = mp_obj_get_int(value_obj); - if (value < 0 || value > 255) { - mp_raise_ValueError(translate("Tile value out of bounds")); - } + mp_arg_validate_int_range(value, 0, 255, MP_QSTR_tile); + common_hal_displayio_tilegrid_set_tile(self, x, y, value); } } @@ -485,6 +499,7 @@ STATIC const mp_rom_map_elem_t displayio_tilegrid_locals_dict_table[] = { { MP_ROM_QSTR(MP_QSTR_flip_x), MP_ROM_PTR(&displayio_tilegrid_flip_x_obj) }, { MP_ROM_QSTR(MP_QSTR_flip_y), MP_ROM_PTR(&displayio_tilegrid_flip_y_obj) }, { MP_ROM_QSTR(MP_QSTR_transpose_xy), MP_ROM_PTR(&displayio_tilegrid_transpose_xy_obj) }, + { MP_ROM_QSTR(MP_QSTR_contains), MP_ROM_PTR(&displayio_tilegrid_contains_obj) }, { MP_ROM_QSTR(MP_QSTR_pixel_shader), MP_ROM_PTR(&displayio_tilegrid_pixel_shader_obj) }, { MP_ROM_QSTR(MP_QSTR_bitmap), MP_ROM_PTR(&displayio_tilegrid_bitmap_obj) }, }; diff --git a/shared-bindings/displayio/TileGrid.h b/shared-bindings/displayio/TileGrid.h index 2c7941222f..fb56ba6101 100644 --- a/shared-bindings/displayio/TileGrid.h +++ b/shared-bindings/displayio/TileGrid.h @@ -56,6 +56,8 @@ void common_hal_displayio_tilegrid_set_flip_y(displayio_tilegrid_t *self, bool f bool common_hal_displayio_tilegrid_get_transpose_xy(displayio_tilegrid_t *self); void common_hal_displayio_tilegrid_set_transpose_xy(displayio_tilegrid_t *self, bool transpose_xy); +bool common_hal_displayio_tilegrid_contains(displayio_tilegrid_t *self, uint16_t x, uint16_t y); + uint16_t common_hal_displayio_tilegrid_get_width(displayio_tilegrid_t *self); uint16_t common_hal_displayio_tilegrid_get_height(displayio_tilegrid_t *self); @@ -67,5 +69,6 @@ void common_hal_displayio_tilegrid_set_tile(displayio_tilegrid_t *self, uint16_t // Private API for scrolling the TileGrid. void common_hal_displayio_tilegrid_set_top_left(displayio_tilegrid_t *self, uint16_t x, uint16_t y); +void common_hal_displayio_tilegrid_set_all_tiles(displayio_tilegrid_t *self, uint8_t tile_index); #endif // MICROPY_INCLUDED_SHARED_BINDINGS_DISPLAYIO_TILEGRID_H diff --git a/shared-bindings/displayio/__init__.c b/shared-bindings/displayio/__init__.c index 2e52f12e84..80fcde6e49 100644 --- a/shared-bindings/displayio/__init__.c +++ b/shared-bindings/displayio/__init__.c @@ -55,9 +55,9 @@ //| refer to `this Learn guide //| `_. //| """ -//| //| import paralleldisplay +//| //| def release_displays() -> None: //| """Releases any actively used displays so their busses and pins can be used again. This will also diff --git a/shared-bindings/dotenv/__init__.c b/shared-bindings/dotenv/__init__.c new file mode 100644 index 0000000000..193338c7c2 --- /dev/null +++ b/shared-bindings/dotenv/__init__.c @@ -0,0 +1,113 @@ +/* + * This file is part of the Micro Python project, http://micropython.org/ + * + * The MIT License (MIT) + * + * SPDX-FileCopyrightText: Copyright (c) 2022 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 + +#include "extmod/vfs.h" +#include "lib/oofatfs/ff.h" +#include "lib/oofatfs/diskio.h" +#include "py/mpstate.h" +#include "py/obj.h" +#include "py/objstr.h" +#include "py/runtime.h" +#include "shared-bindings/dotenv/__init__.h" + +//| """Functions to manage environment variables from a .env file. +//| +//| A subset of the CPython `dotenv library `_. It does +//| not support variables or double quotes. +//| +//| Keys and values may be put in single quotes. +//| ``\`` and ``'`` are escaped by ``\`` in single quotes. Newlines can occur in quotes for multiline values. +//| Comments start with ``#`` and apply for the rest of the line. +//| A ``#`` immediately following an ``=`` is part of the value, not the start of a comment, +//| and a ``#`` embedded in a value without whitespace will be part of that value. +//| This corresponds to how assignments and comments work in most Unix shells. +//| +//| +//| File format example: +//| +//| .. code-block:: +//| +//| key=value +//| key2 = value2 +//| 'key3' = 'value with spaces' +//| # comment +//| key4 = value3 # comment 2 +//| 'key5'=value4 +//| key=value5 # overrides the first one +//| multiline = 'hello +//| world +//| how are you?' +//| # The #'s below will be included in the value. They do not start a comment. +//| key6=#value +//| key7=abc#def +//| +//| """ +//| +//| import typing +//| + +//| def get_key(dotenv_path: str, key_to_get: str) -> Optional[str]: +//| """Get the value for the given key from the given .env file. If the key occurs multiple +//| times in the file, then the last value will be returned. +//| +//| Returns None if the key isn't found or doesn't have a value.""" +//| ... +//| +STATIC mp_obj_t _dotenv_get_key(mp_obj_t path_in, mp_obj_t key_to_get_in) { + return common_hal_dotenv_get_key(mp_obj_str_get_str(path_in), + mp_obj_str_get_str(key_to_get_in)); +} +MP_DEFINE_CONST_FUN_OBJ_2(dotenv_get_key_obj, _dotenv_get_key); + +//| def load_dotenv() -> None: +//| """Does nothing in CircuitPython because os.getenv will automatically read .env when +//| available. +//| +//| Present in CircuitPython so CPython-compatible code can use it without error.""" +//| ... +//| +STATIC mp_obj_t dotenv_load_dotenv(void) { + return mp_const_none; +} +MP_DEFINE_CONST_FUN_OBJ_0(dotenv_load_dotenv_obj, dotenv_load_dotenv); + +STATIC const mp_rom_map_elem_t dotenv_module_globals_table[] = { + { MP_ROM_QSTR(MP_QSTR___name__), MP_ROM_QSTR(MP_QSTR_dotenv) }, + + { MP_ROM_QSTR(MP_QSTR_get_key), MP_ROM_PTR(&dotenv_get_key_obj) }, + { MP_ROM_QSTR(MP_QSTR_load_dotenv), MP_ROM_PTR(&dotenv_load_dotenv_obj) }, +}; + +STATIC MP_DEFINE_CONST_DICT(dotenv_module_globals, dotenv_module_globals_table); + +const mp_obj_module_t dotenv_module = { + .base = { &mp_type_module }, + .globals = (mp_obj_dict_t *)&dotenv_module_globals, +}; + +MP_REGISTER_MODULE(MP_QSTR_dotenv, dotenv_module, CIRCUITPY_DOTENV); diff --git a/shared-bindings/dotenv/__init__.h b/shared-bindings/dotenv/__init__.h new file mode 100644 index 0000000000..18a6c280dd --- /dev/null +++ b/shared-bindings/dotenv/__init__.h @@ -0,0 +1,39 @@ +/* + * This file is part of the MicroPython project, http://micropython.org/ + * + * The MIT License (MIT) + * + * Copyright (c) 2022 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_SHARED_BINDINGS_DOTENV___INIT___H +#define MICROPY_INCLUDED_SHARED_BINDINGS_DOTENV___INIT___H + +#include +#include + +#include "py/objtuple.h" + +#include "shared-module/dotenv/__init__.h" + +mp_obj_t common_hal_dotenv_get_key(const char *path, const char *key); + +#endif // MICROPY_INCLUDED_SHARED_BINDINGS_DOTENV___INIT___H diff --git a/shared-bindings/dualbank/__init__.c b/shared-bindings/dualbank/__init__.c index f907c91e0e..83933e889d 100644 --- a/shared-bindings/dualbank/__init__.c +++ b/shared-bindings/dualbank/__init__.c @@ -54,9 +54,8 @@ //| dualbank.switch() //| """ //| ... -//| -//| def flash(*buffer: ReadableBuffer, offset: int=0) -> None: +//| def flash(buffer: ReadableBuffer, offset: int = 0) -> None: //| """Writes one of two app partitions at the given offset. //| //| This can be called multiple times when flashing the firmware diff --git a/shared-bindings/floppyio/__init__.c b/shared-bindings/floppyio/__init__.c index 3ef58b2f66..b114ab46dc 100644 --- a/shared-bindings/floppyio/__init__.c +++ b/shared-bindings/floppyio/__init__.c @@ -31,11 +31,12 @@ #include #include "py/binary.h" -#include "py/enum.h" #include "py/obj.h" #include "py/runtime.h" -//| def flux_readinto(buffer: WriteableBuffer, data: digitalio.DigitalInOut, index: digitalio.DigitalInOut) -> int: +//| def flux_readinto( +//| buffer: WriteableBuffer, data: digitalio.DigitalInOut, index: digitalio.DigitalInOut +//| ) -> int: //| """Read flux transition information into the buffer. //| //| The function returns when the buffer has filled, or when the index input @@ -69,7 +70,9 @@ STATIC mp_obj_t floppyio_flux_readinto(size_t n_args, const mp_obj_t *pos_args, } MP_DEFINE_CONST_FUN_OBJ_KW(floppyio_flux_readinto_obj, 0, floppyio_flux_readinto); -//| def mfm_readinto(buffer: WriteableBuffer, data: digitalio.DigitalInOut, index: digitalio.DigitalInOut) -> int: +//| def mfm_readinto( +//| buffer: WriteableBuffer, data: digitalio.DigitalInOut, index: digitalio.DigitalInOut +//| ) -> int: //| """Read mfm blocks into the buffer. //| //| The track is assumed to consist of 512-byte sectors. @@ -110,7 +113,6 @@ MP_DEFINE_CONST_FUN_OBJ_KW(floppyio_mfm_readinto_obj, 0, floppyio_mfm_readinto); //| samplerate: int //| """The approximate sample rate in Hz used by flux_readinto.""" -//| STATIC const mp_rom_map_elem_t floppyio_module_globals_table[] = { { MP_ROM_QSTR(MP_QSTR___name__), MP_ROM_QSTR(MP_QSTR_floppyio) }, diff --git a/shared-bindings/fontio/BuiltinFont.c b/shared-bindings/fontio/BuiltinFont.c index 9c97d9a9a3..cf28b6f223 100644 --- a/shared-bindings/fontio/BuiltinFont.c +++ b/shared-bindings/fontio/BuiltinFont.c @@ -34,12 +34,13 @@ #include "py/runtime.h" #include "shared-bindings/microcontroller/Pin.h" #include "shared-bindings/util.h" -#include "supervisor/shared/translate.h" +#include "supervisor/shared/translate/translate.h" -//| from typing_extensions import Protocol # for compat with python < 3.8 +//| from typing_extensions import Protocol # for compat with python < 3.8 //| //| class FontProtocol(Protocol): //| """A protocol shared by `BuiltinFont` and classes in ``adafruit_bitmap_font``""" +//| //| def get_bounding_box(self) -> Union[Tuple[int, int], Tuple[int, int, int, int]]: //| """Retrieve the maximum bounding box of any glyph in the font. //| @@ -47,7 +48,6 @@ //| The two element version is ``(width, height)``, in which //| ``x_offset`` and ``y_offset`` are assumed to be zero.""" //| pass -//| //| def get_glyph(self, codepoint: int) -> Optional[Glyph]: //| """Retrieve the Glyph for a given code point //| @@ -63,13 +63,11 @@ //| `Adafruit_CircuitPython_Bitmap_Font `_ //| library for dynamically loaded fonts.""" //| ... -//| //| bitmap: displayio.Bitmap //| """Bitmap containing all font glyphs starting with ASCII and followed by unicode. Use //| `get_glyph` in most cases. This is useful for use with `displayio.TileGrid` and //| `terminalio.Terminal`.""" -//| STATIC mp_obj_t fontio_builtinfont_obj_get_bitmap(mp_obj_t self_in) { fontio_builtinfont_t *self = MP_OBJ_TO_PTR(self_in); return common_hal_fontio_builtinfont_get_bitmap(self); @@ -82,7 +80,6 @@ MP_PROPERTY_GETTER(fontio_builtinfont_bitmap_obj, //| def get_bounding_box(self) -> Tuple[int, int]: //| """Returns the maximum bounds of all glyphs in the font in a tuple of two values: width, height.""" //| ... -//| STATIC mp_obj_t fontio_builtinfont_obj_get_bounding_box(mp_obj_t self_in) { fontio_builtinfont_t *self = MP_OBJ_TO_PTR(self_in); @@ -98,10 +95,7 @@ MP_DEFINE_CONST_FUN_OBJ_1(fontio_builtinfont_get_bounding_box_obj, fontio_builti STATIC mp_obj_t fontio_builtinfont_obj_get_glyph(mp_obj_t self_in, mp_obj_t codepoint_obj) { fontio_builtinfont_t *self = MP_OBJ_TO_PTR(self_in); - mp_int_t codepoint; - if (!mp_obj_get_int_maybe(codepoint_obj, &codepoint)) { - mp_raise_ValueError_varg(translate("%q should be an int"), MP_QSTR_codepoint); - } + mp_int_t codepoint = mp_arg_validate_type_int(codepoint_obj, MP_QSTR_codepoint); return common_hal_fontio_builtinfont_get_glyph(self, codepoint); } MP_DEFINE_CONST_FUN_OBJ_2(fontio_builtinfont_get_glyph_obj, fontio_builtinfont_obj_get_glyph); diff --git a/shared-bindings/fontio/Glyph.c b/shared-bindings/fontio/Glyph.c index 92be6daeb0..9fd49cfb1a 100644 --- a/shared-bindings/fontio/Glyph.c +++ b/shared-bindings/fontio/Glyph.c @@ -31,15 +31,17 @@ //| class Glyph: //| """Storage of glyph info""" //| -//| def __init__(self, -//| bitmap: displayio.Bitmap, -//| tile_index: int, -//| width: int, -//| height: int, -//| dx: int, -//| dy: int, -//| shift_x: int, -//| shift_y: int) -> None: +//| def __init__( +//| self, +//| bitmap: displayio.Bitmap, +//| tile_index: int, +//| width: int, +//| height: int, +//| dx: int, +//| dy: int, +//| shift_x: int, +//| shift_y: int, +//| ) -> None: //| """Named tuple used to capture a single glyph and its attributes. //| //| :param bitmap: the bitmap including the glyph diff --git a/shared-bindings/fontio/__init__.c b/shared-bindings/fontio/__init__.c index ea1b8a628b..24e1eb1e3b 100644 --- a/shared-bindings/fontio/__init__.c +++ b/shared-bindings/fontio/__init__.c @@ -42,7 +42,6 @@ //| `this Learn guide `_ //| //| """ -//| STATIC const mp_rom_map_elem_t fontio_module_globals_table[] = { { MP_ROM_QSTR(MP_QSTR___name__), MP_ROM_QSTR(MP_QSTR_fontio) }, @@ -57,4 +56,4 @@ const mp_obj_module_t fontio_module = { .globals = (mp_obj_dict_t *)&fontio_module_globals, }; -MP_REGISTER_MODULE(MP_QSTR_fontio, fontio_module, CIRCUITPY_DISPLAYIO && CIRCUITPY_TERMINALIO); +MP_REGISTER_MODULE(MP_QSTR_fontio, fontio_module, CIRCUITPY_FONTIO); diff --git a/shared-bindings/framebufferio/FramebufferDisplay.c b/shared-bindings/framebufferio/FramebufferDisplay.c index daff2174fa..20e555eef9 100644 --- a/shared-bindings/framebufferio/FramebufferDisplay.c +++ b/shared-bindings/framebufferio/FramebufferDisplay.c @@ -38,7 +38,7 @@ #include "shared-bindings/microcontroller/Pin.h" #include "shared-bindings/util.h" #include "shared-module/displayio/__init__.h" -#include "supervisor/shared/translate.h" +#include "supervisor/shared/translate/translate.h" //| class FramebufferDisplay: //| """Manage updating a display with framebuffer in RAM @@ -47,14 +47,19 @@ //| objects in CircuitPython, Display objects live until `displayio.release_displays()` //| is called. This is done so that CircuitPython can use the display itself.""" //| -//| def __init__(self, framebuffer: circuitpython_typing.FrameBuffer, *, rotation: int = 0, auto_refresh: bool = True) -> None: +//| def __init__( +//| self, +//| framebuffer: circuitpython_typing.FrameBuffer, +//| *, +//| rotation: int = 0, +//| auto_refresh: bool = True +//| ) -> None: //| """Create a Display object with the given framebuffer (a buffer, array, ulab.array, etc) //| //| :param ~circuitpython_typing.FrameBuffer framebuffer: The framebuffer that the display is connected to //| :param bool auto_refresh: Automatically refresh the screen //| :param int rotation: The rotation of the display in degrees clockwise. Must be in 90 degree increments (0, 90, 180, 270)""" //| ... -//| STATIC mp_obj_t framebufferio_framebufferdisplay_make_new(const mp_obj_type_t *type, size_t n_args, size_t n_kw, const mp_obj_t *all_args) { enum { ARG_framebuffer, ARG_rotation, ARG_auto_refresh, NUM_ARGS }; static const mp_arg_t allowed_args[] = { @@ -99,7 +104,6 @@ static framebufferio_framebufferdisplay_obj_t *native_display(mp_obj_t display_o //| //| :param Group group: The group to show.""" //| ... -//| STATIC mp_obj_t framebufferio_framebufferdisplay_obj_show(mp_obj_t self_in, mp_obj_t group_in) { framebufferio_framebufferdisplay_obj_t *self = native_display(self_in); displayio_group_t *group = NULL; @@ -115,7 +119,9 @@ STATIC mp_obj_t framebufferio_framebufferdisplay_obj_show(mp_obj_t self_in, mp_o } MP_DEFINE_CONST_FUN_OBJ_2(framebufferio_framebufferdisplay_show_obj, framebufferio_framebufferdisplay_obj_show); -//| def refresh(self, *, target_frames_per_second: int = 60, minimum_frames_per_second: int = 1) -> bool: +//| def refresh( +//| self, *, target_frames_per_second: int = 60, minimum_frames_per_second: int = 1 +//| ) -> bool: //| """When auto refresh is off, waits for the target frame rate and then refreshes the display, //| returning True. If the call has taken too long since the last refresh call for the given //| target frame rate, then the refresh returns False immediately without updating the screen to @@ -130,7 +136,6 @@ MP_DEFINE_CONST_FUN_OBJ_2(framebufferio_framebufferdisplay_show_obj, framebuffer //| :param int target_frames_per_second: How many times a second `refresh` should be called and the screen updated. //| :param int minimum_frames_per_second: The minimum number of times the screen should be updated per second.""" //| ... -//| STATIC mp_obj_t framebufferio_framebufferdisplay_obj_refresh(size_t n_args, const mp_obj_t *pos_args, mp_map_t *kw_args) { enum { ARG_target_frames_per_second, ARG_minimum_frames_per_second }; static const mp_arg_t allowed_args[] = { @@ -152,7 +157,6 @@ MP_DEFINE_CONST_FUN_OBJ_KW(framebufferio_framebufferdisplay_refresh_obj, 1, fram //| auto_refresh: bool //| """True when the display is refreshed automatically.""" -//| STATIC mp_obj_t framebufferio_framebufferdisplay_obj_get_auto_refresh(mp_obj_t self_in) { framebufferio_framebufferdisplay_obj_t *self = native_display(self_in); return mp_obj_new_bool(common_hal_framebufferio_framebufferdisplay_get_auto_refresh(self)); @@ -173,10 +177,7 @@ MP_PROPERTY_GETSET(framebufferio_framebufferdisplay_auto_refresh_obj, (mp_obj_t)&framebufferio_framebufferdisplay_set_auto_refresh_obj); //| brightness: float -//| """The brightness of the display as a float. 0.0 is off and 1.0 is full brightness. When -//| `auto_brightness` is True, the value of `brightness` will change automatically. -//| If `brightness` is set, `auto_brightness` will be disabled and will be set to False.""" -//| +//| """The brightness of the display as a float. 0.0 is off and 1.0 is full brightness.""" STATIC mp_obj_t framebufferio_framebufferdisplay_obj_get_brightness(mp_obj_t self_in) { framebufferio_framebufferdisplay_obj_t *self = native_display(self_in); mp_float_t brightness = common_hal_framebufferio_framebufferdisplay_get_brightness(self); @@ -189,7 +190,6 @@ MP_DEFINE_CONST_FUN_OBJ_1(framebufferio_framebufferdisplay_get_brightness_obj, f STATIC mp_obj_t framebufferio_framebufferdisplay_obj_set_brightness(mp_obj_t self_in, mp_obj_t brightness_obj) { framebufferio_framebufferdisplay_obj_t *self = native_display(self_in); - common_hal_framebufferio_framebufferdisplay_set_auto_brightness(self, false); mp_float_t brightness = mp_obj_get_float(brightness_obj); if (brightness < 0.0f || brightness > 1.0f) { mp_raise_ValueError(translate("Brightness must be 0-1.0")); @@ -206,37 +206,8 @@ MP_PROPERTY_GETSET(framebufferio_framebufferdisplay_brightness_obj, (mp_obj_t)&framebufferio_framebufferdisplay_get_brightness_obj, (mp_obj_t)&framebufferio_framebufferdisplay_set_brightness_obj); -//| auto_brightness: bool -//| """True when the display brightness is adjusted automatically, based on an ambient -//| light sensor or other method. Note that some displays may have this set to True by default, -//| but not actually implement automatic brightness adjustment. `auto_brightness` is set to False -//| if `brightness` is set manually.""" -//| -STATIC mp_obj_t framebufferio_framebufferdisplay_obj_get_auto_brightness(mp_obj_t self_in) { - framebufferio_framebufferdisplay_obj_t *self = native_display(self_in); - return mp_obj_new_bool(common_hal_framebufferio_framebufferdisplay_get_auto_brightness(self)); -} -MP_DEFINE_CONST_FUN_OBJ_1(framebufferio_framebufferdisplay_get_auto_brightness_obj, framebufferio_framebufferdisplay_obj_get_auto_brightness); - -STATIC mp_obj_t framebufferio_framebufferdisplay_obj_set_auto_brightness(mp_obj_t self_in, mp_obj_t auto_brightness) { - framebufferio_framebufferdisplay_obj_t *self = native_display(self_in); - - bool ok = common_hal_framebufferio_framebufferdisplay_set_auto_brightness(self, mp_obj_is_true(auto_brightness)); - if (!ok) { - mp_raise_RuntimeError(translate("Brightness not adjustable")); - } - - return mp_const_none; -} -MP_DEFINE_CONST_FUN_OBJ_2(framebufferio_framebufferdisplay_set_auto_brightness_obj, framebufferio_framebufferdisplay_obj_set_auto_brightness); - -MP_PROPERTY_GETSET(framebufferio_framebufferdisplay_auto_brightness_obj, - (mp_obj_t)&framebufferio_framebufferdisplay_get_auto_brightness_obj, - (mp_obj_t)&framebufferio_framebufferdisplay_set_auto_brightness_obj); - //| width: int //| """Gets the width of the framebuffer""" -//| STATIC mp_obj_t framebufferio_framebufferdisplay_obj_get_width(mp_obj_t self_in) { framebufferio_framebufferdisplay_obj_t *self = native_display(self_in); return MP_OBJ_NEW_SMALL_INT(common_hal_framebufferio_framebufferdisplay_get_width(self)); @@ -248,7 +219,6 @@ MP_PROPERTY_GETTER(framebufferio_framebufferdisplay_width_obj, //| height: int //| """Gets the height of the framebuffer""" -//| STATIC mp_obj_t framebufferio_framebufferdisplay_obj_get_height(mp_obj_t self_in) { framebufferio_framebufferdisplay_obj_t *self = native_display(self_in); return MP_OBJ_NEW_SMALL_INT(common_hal_framebufferio_framebufferdisplay_get_height(self)); @@ -260,7 +230,6 @@ MP_PROPERTY_GETTER(framebufferio_framebufferdisplay_height_obj, //| rotation: int //| """The rotation of the display as an int in degrees.""" -//| STATIC mp_obj_t framebufferio_framebufferdisplay_obj_get_rotation(mp_obj_t self_in) { framebufferio_framebufferdisplay_obj_t *self = native_display(self_in); return MP_OBJ_NEW_SMALL_INT(common_hal_framebufferio_framebufferdisplay_get_rotation(self)); @@ -280,8 +249,6 @@ MP_PROPERTY_GETSET(framebufferio_framebufferdisplay_rotation_obj, //| framebuffer: circuitpython_typing.FrameBuffer //| """The framebuffer being used by the display""" -//| -//| STATIC mp_obj_t framebufferio_framebufferdisplay_obj_get_framebuffer(mp_obj_t self_in) { framebufferio_framebufferdisplay_obj_t *self = native_display(self_in); return common_hal_framebufferio_framebufferdisplay_get_framebuffer(self); @@ -298,7 +265,6 @@ MP_PROPERTY_GETTER(framebufferio_framebufferframebuffer_obj, //| :param int y: The top edge of the area //| :param ~circuitpython_typing.WriteableBuffer buffer: The buffer in which to place the pixel data""" //| ... -//| STATIC mp_obj_t framebufferio_framebufferdisplay_obj_fill_row(size_t n_args, const mp_obj_t *pos_args, mp_map_t *kw_args) { enum { ARG_y, ARG_buffer }; static const mp_arg_t allowed_args[] = { @@ -353,6 +319,18 @@ STATIC mp_obj_t framebufferio_framebufferdisplay_obj_fill_row(size_t n_args, con } MP_DEFINE_CONST_FUN_OBJ_KW(framebufferio_framebufferdisplay_fill_row_obj, 1, framebufferio_framebufferdisplay_obj_fill_row); +//| root_group: displayio.Group +//| """The root group on the display.""" +//| +STATIC mp_obj_t framebufferio_framebufferdisplay_obj_get_root_group(mp_obj_t self_in) { + framebufferio_framebufferdisplay_obj_t *self = native_display(self_in); + return common_hal_framebufferio_framebufferdisplay_get_root_group(self); +} +MP_DEFINE_CONST_FUN_OBJ_1(framebufferio_framebufferdisplay_get_root_group_obj, framebufferio_framebufferdisplay_obj_get_root_group); + +MP_PROPERTY_GETTER(framebufferio_framebufferdisplay_root_group_obj, + (mp_obj_t)&framebufferio_framebufferdisplay_get_root_group_obj); + STATIC const mp_rom_map_elem_t framebufferio_framebufferdisplay_locals_dict_table[] = { { MP_ROM_QSTR(MP_QSTR_show), MP_ROM_PTR(&framebufferio_framebufferdisplay_show_obj) }, { MP_ROM_QSTR(MP_QSTR_refresh), MP_ROM_PTR(&framebufferio_framebufferdisplay_refresh_obj) }, @@ -361,12 +339,12 @@ STATIC const mp_rom_map_elem_t framebufferio_framebufferdisplay_locals_dict_tabl { MP_ROM_QSTR(MP_QSTR_auto_refresh), MP_ROM_PTR(&framebufferio_framebufferdisplay_auto_refresh_obj) }, { MP_ROM_QSTR(MP_QSTR_brightness), MP_ROM_PTR(&framebufferio_framebufferdisplay_brightness_obj) }, - { MP_ROM_QSTR(MP_QSTR_auto_brightness), MP_ROM_PTR(&framebufferio_framebufferdisplay_auto_brightness_obj) }, { MP_ROM_QSTR(MP_QSTR_width), MP_ROM_PTR(&framebufferio_framebufferdisplay_width_obj) }, { MP_ROM_QSTR(MP_QSTR_height), MP_ROM_PTR(&framebufferio_framebufferdisplay_height_obj) }, { MP_ROM_QSTR(MP_QSTR_rotation), MP_ROM_PTR(&framebufferio_framebufferdisplay_rotation_obj) }, { MP_ROM_QSTR(MP_QSTR_framebuffer), MP_ROM_PTR(&framebufferio_framebufferframebuffer_obj) }, + { MP_ROM_QSTR(MP_QSTR_root_group), MP_ROM_PTR(&framebufferio_framebufferdisplay_root_group_obj) }, }; STATIC MP_DEFINE_CONST_DICT(framebufferio_framebufferdisplay_locals_dict, framebufferio_framebufferdisplay_locals_dict_table); diff --git a/shared-bindings/framebufferio/FramebufferDisplay.h b/shared-bindings/framebufferio/FramebufferDisplay.h index f96b47eb55..7c63587df7 100644 --- a/shared-bindings/framebufferio/FramebufferDisplay.h +++ b/shared-bindings/framebufferio/FramebufferDisplay.h @@ -55,13 +55,11 @@ uint16_t common_hal_framebufferio_framebufferdisplay_get_height(framebufferio_fr uint16_t common_hal_framebufferio_framebufferdisplay_get_rotation(framebufferio_framebufferdisplay_obj_t *self); void common_hal_framebufferio_framebufferdisplay_set_rotation(framebufferio_framebufferdisplay_obj_t *self, int rotation); -bool common_hal_framebufferio_framebufferdisplay_get_auto_brightness(framebufferio_framebufferdisplay_obj_t *self); -bool common_hal_framebufferio_framebufferdisplay_set_auto_brightness(framebufferio_framebufferdisplay_obj_t *self, bool auto_brightness); - mp_float_t common_hal_framebufferio_framebufferdisplay_get_brightness(framebufferio_framebufferdisplay_obj_t *self); bool common_hal_framebufferio_framebufferdisplay_set_brightness(framebufferio_framebufferdisplay_obj_t *self, mp_float_t brightness); mp_obj_t common_hal_framebufferio_framebufferdisplay_framebuffer(framebufferio_framebufferdisplay_obj_t *self); +mp_obj_t common_hal_framebufferio_framebufferdisplay_get_root_group(framebufferio_framebufferdisplay_obj_t *self); #endif // MICROPY_INCLUDED_SHARED_BINDINGS_DISPLAYIO_FRAMEBUFFERDISPLAY_H diff --git a/shared-bindings/framebufferio/__init__.c b/shared-bindings/framebufferio/__init__.c index 5d95ef41f5..324442268e 100644 --- a/shared-bindings/framebufferio/__init__.c +++ b/shared-bindings/framebufferio/__init__.c @@ -35,7 +35,6 @@ //| It is used in conjunction with classes from `displayio` to actually //| place items on the display; and classes like `RGBMatrix` to actually //| drive the display.""" -//| #if CIRCUITPY_FRAMEBUFFERIO static const mp_rom_map_elem_t framebufferio_module_globals_table[] = { diff --git a/shared-bindings/frequencyio/FrequencyIn.c b/shared-bindings/frequencyio/FrequencyIn.c index 2f6ebd06c2..3138f543e7 100644 --- a/shared-bindings/frequencyio/FrequencyIn.c +++ b/shared-bindings/frequencyio/FrequencyIn.c @@ -33,7 +33,7 @@ #include "shared-bindings/microcontroller/Pin.h" #include "shared-bindings/frequencyio/FrequencyIn.h" #include "shared-bindings/util.h" -#include "supervisor/shared/translate.h" +#include "supervisor/shared/translate/translate.h" //| class FrequencyIn: //| """Read a frequency signal @@ -70,7 +70,6 @@ //| # as the value. //| frequency.clear()""" //| ... -//| STATIC mp_obj_t frequencyio_frequencyin_make_new(const mp_obj_type_t *type, size_t n_args, size_t n_kw, const mp_obj_t *all_args) { mp_arg_check_num(n_args, n_kw, 1, 1, true); @@ -96,7 +95,6 @@ STATIC mp_obj_t frequencyio_frequencyin_make_new(const mp_obj_type_t *type, size //| def deinit(self) -> None: //| """Deinitialises the FrequencyIn and releases any hardware resources for reuse.""" //| ... -//| STATIC mp_obj_t frequencyio_frequencyin_deinit(mp_obj_t self_in) { frequencyio_frequencyin_obj_t *self = MP_OBJ_TO_PTR(self_in); common_hal_frequencyio_frequencyin_deinit(self); @@ -113,14 +111,12 @@ STATIC void check_for_deinit(frequencyio_frequencyin_obj_t *self) { //| def __enter__(self) -> FrequencyIn: //| """No-op used by Context Managers.""" //| ... -//| // Provided by context manager helper. //| def __exit__(self) -> None: //| """Automatically deinitializes the hardware when exiting a context. See //| :ref:`lifetime-and-contextmanagers` for more info.""" //| ... -//| STATIC mp_obj_t frequencyio_frequencyin_obj___exit__(size_t n_args, const mp_obj_t *args) { (void)n_args; common_hal_frequencyio_frequencyin_deinit(args[0]); @@ -131,7 +127,6 @@ STATIC MP_DEFINE_CONST_FUN_OBJ_VAR_BETWEEN(frequencyio_frequencyin___exit___obj, //| def pause(self) -> None: //| """Pause frequency capture.""" //| ... -//| STATIC mp_obj_t frequencyio_frequencyin_obj_pause(mp_obj_t self_in) { frequencyio_frequencyin_obj_t *self = MP_OBJ_TO_PTR(self_in); check_for_deinit(self); @@ -144,7 +139,6 @@ MP_DEFINE_CONST_FUN_OBJ_1(frequencyio_frequencyin_pause_obj, frequencyio_frequen //| def resume(self) -> None: //| """Resumes frequency capture.""" //| ... -//| STATIC mp_obj_t frequencyio_frequencyin_obj_resume(mp_obj_t self_in) { frequencyio_frequencyin_obj_t *self = MP_OBJ_TO_PTR(self_in); check_for_deinit(self); @@ -157,7 +151,6 @@ MP_DEFINE_CONST_FUN_OBJ_1(frequencyio_frequencyin_resume_obj, frequencyio_freque //| def clear(self) -> None: //| """Clears the last detected frequency capture value.""" //| ... -//| STATIC mp_obj_t frequencyio_frequencyin_obj_clear(mp_obj_t self_in) { frequencyio_frequencyin_obj_t *self = MP_OBJ_TO_PTR(self_in); @@ -175,7 +168,6 @@ MP_DEFINE_CONST_FUN_OBJ_1(frequencyio_frequencyin_clear_obj, frequencyio_frequen //| //| .. note:: When setting a new ``capture_period``, all previous capture information is //| cleared with a call to ``clear()``.""" -//| STATIC mp_obj_t frequencyio_frequencyin_obj_get_capture_period(mp_obj_t self_in) { frequencyio_frequencyin_obj_t *self = MP_OBJ_TO_PTR(self_in); check_for_deinit(self); diff --git a/shared-bindings/frequencyio/__init__.c b/shared-bindings/frequencyio/__init__.c index ffbb7af771..18022c7f6e 100644 --- a/shared-bindings/frequencyio/__init__.c +++ b/shared-bindings/frequencyio/__init__.c @@ -38,7 +38,6 @@ //| .. warning:: This module is not available in SAMD21 builds. See the //| :ref:`module-support-matrix` for more info. //| - //| All classes change hardware state and should be deinitialized when they //| are no longer needed if the program continues after use. To do so, either //| call :py:meth:`!deinit` or use a context manager. See @@ -59,7 +58,6 @@ //| CircuitPython will automatically turn off FrequencyIn capture when it resets all //| hardware after program completion. Use ``deinit()`` or a ``with`` statement //| to do it yourself.""" -//| STATIC const mp_rom_map_elem_t frequencyio_module_globals_table[] = { { MP_ROM_QSTR(MP_QSTR___name__), MP_ROM_QSTR(MP_QSTR_frequencyio) }, diff --git a/shared-bindings/gamepadshift/GamePadShift.c b/shared-bindings/gamepadshift/GamePadShift.c deleted file mode 100644 index 1c43eeac7b..0000000000 --- a/shared-bindings/gamepadshift/GamePadShift.c +++ /dev/null @@ -1,123 +0,0 @@ -/* - * This file is part of the MicroPython project, http://micropython.org/ - * - * The MIT License (MIT) - * - * Copyright (c) 2016 Radomir Dopieralski 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 "py/obj.h" -#include "py/runtime.h" -#include "py/mphal.h" -#include "py/gc.h" -#include "py/mpstate.h" -#include "shared-bindings/gamepadshift/GamePadShift.h" -#include "shared-bindings/gamepadshift/__init__.h" -#include "supervisor/shared/translate.h" -#include "supervisor/shared/tick.h" - -//| class GamePadShift: -//| """Scan buttons for presses through a shift register""" -//| -//| def __init__(self, clock: digitalio.DigitalInOut, data: digitalio.DigitalInOut, latch: digitalio.DigitalInOut) -> None: -//| """Initializes button scanning routines. -//| -//| The ``clock``, ``data`` and ``latch`` parameters are ``DigitalInOut`` -//| objects connected to the shift register controlling the buttons. -//| -//| The button presses are accumulated, until the ``get_pressed`` method -//| is called, at which point the button state is cleared, and the new -//| button presses start to be recorded. -//| -//| Only one `gamepadshift.GamePadShift` may be used at a time.""" -//| ... -//| -STATIC mp_obj_t gamepadshift_make_new(const mp_obj_type_t *type, size_t n_args, - size_t n_kw, const mp_obj_t *all_args) { - - enum { ARG_clock, ARG_data, ARG_latch }; - static const mp_arg_t allowed_args[] = { - { MP_QSTR_clock, MP_ARG_REQUIRED | MP_ARG_OBJ}, - { MP_QSTR_data, MP_ARG_REQUIRED | MP_ARG_OBJ }, - { MP_QSTR_latch, MP_ARG_REQUIRED | MP_ARG_OBJ}, - }; - mp_arg_val_t args[MP_ARRAY_SIZE(allowed_args)]; - mp_arg_parse_all_kw_array(n_args, n_kw, all_args, MP_ARRAY_SIZE(allowed_args), - allowed_args, args); - - digitalio_digitalinout_obj_t *clock_pin = assert_digitalinout(args[ARG_clock].u_obj); - digitalio_digitalinout_obj_t *data_pin = assert_digitalinout(args[ARG_data].u_obj); - digitalio_digitalinout_obj_t *latch_pin = assert_digitalinout(args[ARG_latch].u_obj); - - gamepadshift_obj_t *gamepad_singleton = MP_STATE_VM(gamepad_singleton); - if (!gamepad_singleton || - !mp_obj_is_type(MP_OBJ_FROM_PTR(gamepad_singleton), - &gamepadshift_type)) { - gamepad_singleton = m_new_ll_obj(gamepadshift_obj_t); - gamepad_singleton->base.type = &gamepadshift_type; - if (!MP_STATE_VM(gamepad_singleton)) { - supervisor_enable_tick(); - } - MP_STATE_VM(gamepad_singleton) = gamepad_singleton; - } - common_hal_gamepadshift_gamepadshift_init(gamepad_singleton, clock_pin, data_pin, latch_pin); - return MP_OBJ_FROM_PTR(gamepad_singleton); -} - -//| def get_pressed(self) -> int: -//| """Get the status of buttons pressed since the last call and clear it. -//| -//| Returns an 8-bit number, with bits that correspond to buttons, -//| which have been pressed (or held down) since the last call to this -//| function set to 1, and the remaining bits set to 0. Then it clears -//| the button state, so that new button presses (or buttons that are -//| held down) can be recorded for the next call.""" -//| ... -//| -STATIC mp_obj_t gamepadshift_get_pressed(mp_obj_t self_in) { - gamepadshift_obj_t *gamepad_singleton = MP_STATE_VM(gamepad_singleton); - mp_obj_t pressed = MP_OBJ_NEW_SMALL_INT(gamepad_singleton->pressed); - gamepad_singleton->pressed = gamepad_singleton->last; - return pressed; -} -MP_DEFINE_CONST_FUN_OBJ_1(gamepadshift_get_pressed_obj, gamepadshift_get_pressed); - -//| def deinit(self) -> None: -//| """Disable button scanning.""" -//| ... -//| -STATIC mp_obj_t gamepadshift_deinit(mp_obj_t self_in) { - common_hal_gamepadshift_gamepadshift_deinit(self_in); - return mp_const_none; -} -MP_DEFINE_CONST_FUN_OBJ_1(gamepadshift_deinit_obj, gamepadshift_deinit); - - -STATIC const mp_rom_map_elem_t gamepadshift_locals_dict_table[] = { - { MP_OBJ_NEW_QSTR(MP_QSTR_get_pressed), MP_ROM_PTR(&gamepadshift_get_pressed_obj)}, - { MP_OBJ_NEW_QSTR(MP_QSTR_deinit), MP_ROM_PTR(&gamepadshift_deinit_obj)}, -}; -STATIC MP_DEFINE_CONST_DICT(gamepadshift_locals_dict, gamepadshift_locals_dict_table); -const mp_obj_type_t gamepadshift_type = { - { &mp_type_type }, - .name = MP_QSTR_GamePadShift, - .make_new = gamepadshift_make_new, - .locals_dict = (mp_obj_dict_t *)&gamepadshift_locals_dict, -}; diff --git a/shared-bindings/gamepadshift/__init__.c b/shared-bindings/gamepadshift/__init__.c deleted file mode 100644 index 816fd8d7b0..0000000000 --- a/shared-bindings/gamepadshift/__init__.c +++ /dev/null @@ -1,51 +0,0 @@ -/* - * This file is part of the MicroPython project, http://micropython.org/ - * - * The MIT License (MIT) - * - * Copyright (c) 2016 Radomir Dopieralski 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 "py/obj.h" -#include "py/runtime.h" -#include "py/mphal.h" -#include "shared-bindings/gamepadshift/GamePadShift.h" -#include "shared-bindings/digitalio/DigitalInOut.h" -#include "shared-bindings/util.h" - -//| """Tracks button presses read through a shift register. -//| -//| .. note:: `gamepadshift` is deprecated in CircuitPython 7.0.0 and will be removed in 8.0.0. -//| Use `keypad` instead. -//| """ -//| -STATIC const mp_rom_map_elem_t gamepadshift_module_globals_table[] = { - { MP_ROM_QSTR(MP_QSTR___name__), MP_ROM_QSTR(MP_QSTR_gamepadshift) }, - { MP_OBJ_NEW_QSTR(MP_QSTR_GamePadShift), MP_ROM_PTR(&gamepadshift_type)}, -}; - -STATIC MP_DEFINE_CONST_DICT(gamepadshift_module_globals, gamepadshift_module_globals_table); - -const mp_obj_module_t gamepadshift_module = { - .base = { &mp_type_module }, - .globals = (mp_obj_dict_t *)&gamepadshift_module_globals, -}; - -MP_REGISTER_MODULE(MP_QSTR_gamepadshift, gamepadshift_module, CIRCUITPY_GAMEPADSHIFT); diff --git a/shared-bindings/getpass/__init__.c b/shared-bindings/getpass/__init__.c index 7c2de89b34..340b8fd7c6 100644 --- a/shared-bindings/getpass/__init__.c +++ b/shared-bindings/getpass/__init__.c @@ -33,9 +33,8 @@ //| //| """ //| ... -//| -//| def getpass(prompt: Optional[str] = 'Password: ', stream: Optional[io.FileIO] = None) -> str: +//| def getpass(prompt: Optional[str] = "Password: ", stream: Optional[io.FileIO] = None) -> str: //| //| """Prompt the user without echoing. //| diff --git a/shared-bindings/gifio/GifWriter.c b/shared-bindings/gifio/GifWriter.c index 11dd43becd..57c38b554e 100644 --- a/shared-bindings/gifio/GifWriter.c +++ b/shared-bindings/gifio/GifWriter.c @@ -34,7 +34,15 @@ #include "shared/runtime/context_manager_helpers.h" //| class GifWriter: -//| def __init__(self, file: Union[typing.BinaryIO, str], width:int, height:int, colorspace: displayio.Colorspace, loop:bool=True, dither:bool=False) -> None: +//| def __init__( +//| self, +//| file: Union[typing.BinaryIO, str], +//| width: int, +//| height: int, +//| colorspace: displayio.Colorspace, +//| loop: bool = True, +//| dither: bool = False, +//| ) -> None: //| """Construct a GifWriter object //| //| :param file: Either a file open in bytes mode, or the name of a file to open in bytes mode. @@ -45,7 +53,6 @@ //| :param dither: If True, and the image is in color, a simple ordered dither is applied. //| """ //| ... -//| static mp_obj_t gifio_gifwriter_make_new(const mp_obj_type_t *type, size_t n_args, size_t n_kw, const mp_obj_t *all_args) { enum { ARG_file, ARG_width, ARG_height, ARG_colorspace, ARG_loop, ARG_dither }; static const mp_arg_t allowed_args[] = { @@ -91,7 +98,6 @@ static mp_obj_t gifio_gifwriter_make_new(const mp_obj_type_t *type, size_t n_arg //| """Automatically deinitializes the hardware when exiting a context. See //| :ref:`lifetime-and-contextmanagers` for more info.""" //| ... -//| static mp_obj_t gifio_gifwriter___exit__(size_t n_args, const mp_obj_t *args) { gifio_gifwriter_t *self = MP_OBJ_TO_PTR(args[0]); shared_module_gifio_gifwriter_deinit(self); @@ -102,7 +108,6 @@ MP_DEFINE_CONST_FUN_OBJ_VAR_BETWEEN(gifio_gifwriter___exit___obj, 4, 4, gifio_gi //| def deinit(self) -> None: //| """Close the underlying file.""" //| ... -//| static mp_obj_t gifio_gifwriter_deinit(mp_obj_t self_in) { gifio_gifwriter_t *self = MP_OBJ_TO_PTR(self_in); shared_module_gifio_gifwriter_deinit(self); @@ -117,6 +122,7 @@ MP_DEFINE_CONST_FUN_OBJ_1(gifio_gifwriter_deinit_obj, gifio_gifwriter_deinit); //| :param delay: The frame delay in seconds. The GIF format rounds this to the nearest 1/100 second, and the largest permitted value is 655 seconds. //| """ //| ... +//| static mp_obj_t gifio_gifwriter_add_frame(size_t n_args, const mp_obj_t *pos_args, mp_map_t *kw_args) { enum { ARG_bitmap, ARG_delay }; static const mp_arg_t allowed_args[] = { diff --git a/shared-bindings/gifio/__init__.c b/shared-bindings/gifio/__init__.c index 317eebce9b..6bd5765966 100644 --- a/shared-bindings/gifio/__init__.c +++ b/shared-bindings/gifio/__init__.c @@ -31,7 +31,6 @@ //| """Access GIF-format images //| """ -//| STATIC const mp_rom_map_elem_t gifio_module_globals_table[] = { { MP_ROM_QSTR(MP_QSTR___name__), MP_ROM_QSTR(MP_QSTR_gifio) }, { MP_OBJ_NEW_QSTR(MP_QSTR_GifWriter), MP_ROM_PTR(&gifio_gifwriter_type)}, diff --git a/shared-bindings/gnss/GNSS.c b/shared-bindings/gnss/GNSS.c index 0bd800bdc6..d3c9547787 100644 --- a/shared-bindings/gnss/GNSS.c +++ b/shared-bindings/gnss/GNSS.c @@ -36,7 +36,6 @@ //| //| :param system: satellite system to use""" //| ... -//| STATIC mp_obj_t gnss_make_new(const mp_obj_type_t *type, size_t n_args, size_t n_kw, const mp_obj_t *all_args) { gnss_obj_t *self = m_new_obj(gnss_obj_t); self->base.type = &gnss_type; @@ -71,7 +70,6 @@ STATIC mp_obj_t gnss_make_new(const mp_obj_type_t *type, size_t n_args, size_t n //| def deinit(self) -> None: //| """Turn off the GNSS.""" //| ... -//| STATIC mp_obj_t gnss_obj_deinit(mp_obj_t self_in) { gnss_obj_t *self = MP_OBJ_TO_PTR(self_in); common_hal_gnss_deinit(self); @@ -88,7 +86,6 @@ STATIC void check_for_deinit(gnss_obj_t *self) { //| def update(self) -> None: //| """Update GNSS positioning information.""" //| ... -//| STATIC mp_obj_t gnss_obj_update(mp_obj_t self_in) { gnss_obj_t *self = MP_OBJ_TO_PTR(self_in); check_for_deinit(self); @@ -100,7 +97,6 @@ MP_DEFINE_CONST_FUN_OBJ_1(gnss_update_obj, gnss_obj_update); //| latitude: float //| """Latitude of current position in degrees (float).""" -//| STATIC mp_obj_t gnss_obj_get_latitude(mp_obj_t self_in) { gnss_obj_t *self = MP_OBJ_TO_PTR(self_in); check_for_deinit(self); @@ -113,7 +109,6 @@ MP_PROPERTY_GETTER(gnss_latitude_obj, //| longitude: float //| """Longitude of current position in degrees (float).""" -//| STATIC mp_obj_t gnss_obj_get_longitude(mp_obj_t self_in) { gnss_obj_t *self = MP_OBJ_TO_PTR(self_in); check_for_deinit(self); @@ -126,7 +121,6 @@ MP_PROPERTY_GETTER(gnss_longitude_obj, //| altitude: float //| """Altitude of current position in meters (float).""" -//| STATIC mp_obj_t gnss_obj_get_altitude(mp_obj_t self_in) { gnss_obj_t *self = MP_OBJ_TO_PTR(self_in); check_for_deinit(self); @@ -139,7 +133,6 @@ MP_PROPERTY_GETTER(gnss_altitude_obj, //| timestamp: time.struct_time //| """Time when the position data was updated.""" -//| STATIC mp_obj_t gnss_obj_get_timestamp(mp_obj_t self_in) { gnss_obj_t *self = MP_OBJ_TO_PTR(self_in); check_for_deinit(self); diff --git a/shared-bindings/gnss/PositionFix.c b/shared-bindings/gnss/PositionFix.c index e60611d705..35d4971b66 100644 --- a/shared-bindings/gnss/PositionFix.c +++ b/shared-bindings/gnss/PositionFix.c @@ -9,7 +9,6 @@ //| //| def __init__(self) -> None: //| """Enum-like class to define the position fix mode.""" -//| //| INVALID: PositionFix //| """No measurement.""" //| diff --git a/shared-bindings/gnss/SatelliteSystem.c b/shared-bindings/gnss/SatelliteSystem.c index edac03ddb6..4bf0d6cf4b 100644 --- a/shared-bindings/gnss/SatelliteSystem.c +++ b/shared-bindings/gnss/SatelliteSystem.c @@ -9,7 +9,6 @@ //| //| def __init__(self) -> None: //| """Enum-like class to define the satellite system type.""" -//| //| GPS: SatelliteSystem //| """Global Positioning System.""" //| diff --git a/shared-bindings/gnss/__init__.c b/shared-bindings/gnss/__init__.c index ab6cbf56cf..6029e1a54e 100644 --- a/shared-bindings/gnss/__init__.c +++ b/shared-bindings/gnss/__init__.c @@ -13,7 +13,6 @@ //| """Global Navigation Satellite System //| //| The `gnss` module contains classes to control the GNSS and acquire positioning information.""" -//| STATIC const mp_rom_map_elem_t gnss_module_globals_table[] = { { MP_ROM_QSTR(MP_QSTR___name__), MP_ROM_QSTR(MP_QSTR_gnss) }, { MP_ROM_QSTR(MP_QSTR_GNSS), MP_ROM_PTR(&gnss_type) }, diff --git a/shared-bindings/hashlib/Hash.c b/shared-bindings/hashlib/Hash.c new file mode 100644 index 0000000000..f385885b4d --- /dev/null +++ b/shared-bindings/hashlib/Hash.c @@ -0,0 +1,95 @@ +/* + * This file is part of the MicroPython project, http://micropython.org/ + * + * The MIT License (MIT) + * + * Copyright (c) 2022 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 "shared-bindings/hashlib/Hash.h" + +#include "py/obj.h" +#include "py/objproperty.h" +#include "py/objstr.h" +#include "py/runtime.h" + +//| class Hash: +//| """In progress hash algorithm. This object is always created by a `hashlib.new()`. It has no +//| user-visible constructor.""" +//| + +//| digest_size: int +//| """Digest size in bytes""" +STATIC mp_obj_t hashlib_hash_digest_size_get(mp_obj_t self_in) { + mp_check_self(mp_obj_is_type(self_in, &hashlib_hash_type)); + hashlib_hash_obj_t *self = MP_OBJ_TO_PTR(self_in); + return MP_OBJ_NEW_SMALL_INT(common_hal_hashlib_hash_get_digest_size(self)); +} +MP_DEFINE_CONST_FUN_OBJ_1(hashlib_hash_digest_size_get_obj, hashlib_hash_digest_size_get); +MP_PROPERTY_GETTER(hashlib_hash_digest_size_obj, (mp_obj_t)&hashlib_hash_digest_size_get_obj); + +//| def update(self, data: ReadableBuffer) -> None: +//| """Update the hash with the given bytes. +//| +//| :param ~circuitpython_typing.ReadableBuffer data: Update the hash from data in this buffer""" +//| ... +mp_obj_t hashlib_hash_update(mp_obj_t self_in, mp_obj_t buf_in) { + mp_check_self(mp_obj_is_type(self_in, &hashlib_hash_type)); + hashlib_hash_obj_t *self = MP_OBJ_TO_PTR(self_in); + + mp_buffer_info_t bufinfo; + mp_get_buffer_raise(buf_in, &bufinfo, MP_BUFFER_READ); + + common_hal_hashlib_hash_update(self, bufinfo.buf, bufinfo.len); + return mp_const_none; +} +STATIC MP_DEFINE_CONST_FUN_OBJ_2(hashlib_hash_update_obj, hashlib_hash_update); + +//| def digest(self) -> bytes: +//| """Returns the current digest as bytes() with a length of `hashlib.Hash.digest_size`.""" +//| ... +//| +STATIC mp_obj_t hashlib_hash_digest(mp_obj_t self_in) { + mp_check_self(mp_obj_is_type(self_in, &hashlib_hash_type)); + hashlib_hash_obj_t *self = MP_OBJ_TO_PTR(self_in); + + size_t size = common_hal_hashlib_hash_get_digest_size(self); + mp_obj_t obj = mp_obj_new_bytes_of_zeros(size); + mp_obj_str_t *o = MP_OBJ_TO_PTR(obj); + + common_hal_hashlib_hash_digest(self, (uint8_t *)o->data, size); + return obj; +} +STATIC MP_DEFINE_CONST_FUN_OBJ_1(hashlib_hash_digest_obj, hashlib_hash_digest); + +STATIC const mp_rom_map_elem_t hashlib_hash_locals_dict_table[] = { + { MP_ROM_QSTR(MP_QSTR_digest_size), MP_ROM_PTR(&hashlib_hash_digest_size_obj) }, + { MP_ROM_QSTR(MP_QSTR_update), MP_ROM_PTR(&hashlib_hash_update_obj) }, + { MP_ROM_QSTR(MP_QSTR_digest), MP_ROM_PTR(&hashlib_hash_digest_obj) }, +}; + +STATIC MP_DEFINE_CONST_DICT(hashlib_hash_locals_dict, hashlib_hash_locals_dict_table); + +const mp_obj_type_t hashlib_hash_type = { + { &mp_type_type }, + .name = MP_QSTR_Hash, + .locals_dict = (mp_obj_dict_t *)&hashlib_hash_locals_dict, +}; diff --git a/shared-bindings/hashlib/Hash.h b/shared-bindings/hashlib/Hash.h new file mode 100644 index 0000000000..f3845b02ff --- /dev/null +++ b/shared-bindings/hashlib/Hash.h @@ -0,0 +1,43 @@ +/* + * This file is part of the MicroPython project, http://micropython.org/ + * + * The MIT License (MIT) + * + * Copyright (c) 2022 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_SHARED_BINDINGS_HASHLIB_HASH_H +#define MICROPY_INCLUDED_SHARED_BINDINGS_HASHLIB_HASH_H + +#include "py/obj.h" + +#include "common-hal/hashlib/Hash.h" + +extern const mp_obj_type_t hashlib_hash_type; + +// So that new can call it when given data. +mp_obj_t hashlib_hash_update(mp_obj_t self_in, mp_obj_t buf_in); + +void common_hal_hashlib_hash_update(hashlib_hash_obj_t *self, const uint8_t *data, size_t datalen); +void common_hal_hashlib_hash_digest(hashlib_hash_obj_t *self, uint8_t *data, size_t datalen); +size_t common_hal_hashlib_hash_get_digest_size(hashlib_hash_obj_t *self); + +#endif // MICROPY_INCLUDED_SHARED_BINDINGS_HASHLIB_HASH_H diff --git a/shared-bindings/hashlib/__init__.c b/shared-bindings/hashlib/__init__.c new file mode 100644 index 0000000000..424159f84c --- /dev/null +++ b/shared-bindings/hashlib/__init__.c @@ -0,0 +1,90 @@ +/* + * This file is part of the Micro Python project, http://micropython.org/ + * + * The MIT License (MIT) + * + * Copyright (c) 2022 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 + +#include "py/obj.h" +#include "py/mpconfig.h" +#include "py/runtime.h" +#include "shared-bindings/hashlib/__init__.h" +#include "shared-bindings/hashlib/Hash.h" +#include "supervisor/shared/translate/translate.h" + +//| """Hashing related functions +//| +//| |see_cpython_module| :mod:`cpython:hashlib`. +//| """ +//| +//| def new(name: str, data: bytes = b"") -> hashlib.Hash: +//| """Returns a Hash object setup for the named algorithm. Raises ValueError when the named +//| algorithm is unsupported. +//| +//| :return: a hash object for the given algorithm +//| :rtype: hashlib.Hash""" +//| ... +//| +STATIC mp_obj_t hashlib_new(size_t n_args, const mp_obj_t *pos_args, mp_map_t *kw_args) { + enum { ARG_name, ARG_data }; + static const mp_arg_t allowed_args[] = { + { MP_QSTR_name, MP_ARG_REQUIRED | MP_ARG_OBJ }, + { MP_QSTR_data, MP_ARG_OBJ, {.u_obj = mp_const_none} }, + }; + mp_arg_val_t args[MP_ARRAY_SIZE(allowed_args)]; + mp_arg_parse_all(n_args, pos_args, kw_args, MP_ARRAY_SIZE(allowed_args), allowed_args, args); + + const char *algorithm = mp_obj_str_get_str(args[ARG_name].u_obj); + + hashlib_hash_obj_t *self = m_new_obj(hashlib_hash_obj_t); + self->base.type = &hashlib_hash_type; + + if (!common_hal_hashlib_new(self, algorithm)) { + mp_raise_ValueError(translate("Unsupported hash algorithm")); + } + + if (args[ARG_data].u_obj != mp_const_none) { + hashlib_hash_update(self, args[ARG_data].u_obj); + } + return self; +} +STATIC MP_DEFINE_CONST_FUN_OBJ_KW(hashlib_new_obj, 1, hashlib_new); + +STATIC const mp_rom_map_elem_t hashlib_module_globals_table[] = { + { MP_ROM_QSTR(MP_QSTR___name__), MP_ROM_QSTR(MP_QSTR_hashlib) }, + + { MP_ROM_QSTR(MP_QSTR_new), MP_ROM_PTR(&hashlib_new_obj) }, + + // Hash is deliberately omitted here because CPython doesn't expose the + // object on `hashlib` only the internal `_hashlib`. +}; + +STATIC MP_DEFINE_CONST_DICT(hashlib_module_globals, hashlib_module_globals_table); + +const mp_obj_module_t hashlib_module = { + .base = { &mp_type_module }, + .globals = (mp_obj_dict_t *)&hashlib_module_globals, +}; + +MP_REGISTER_MODULE(MP_QSTR_hashlib, hashlib_module, CIRCUITPY_HASHLIB); diff --git a/shared-bindings/hashlib/__init__.h b/shared-bindings/hashlib/__init__.h new file mode 100644 index 0000000000..ae47b546a4 --- /dev/null +++ b/shared-bindings/hashlib/__init__.h @@ -0,0 +1,36 @@ +/* + * This file is part of the MicroPython project, http://micropython.org/ + * + * The MIT License (MIT) + * + * Copyright (c) 2022 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_SHARED_BINDINGS_HASHLIB___INIT___H +#define MICROPY_INCLUDED_SHARED_BINDINGS_HASHLIB___INIT___H + +#include + +#include "shared-bindings/hashlib/Hash.h" + +bool common_hal_hashlib_new(hashlib_hash_obj_t *self, const char *algorithm); + +#endif // MICROPY_INCLUDED_SHARED_BINDINGS_HASHLIB___INIT___H diff --git a/shared-bindings/i2cperipheral/I2CPeripheral.c b/shared-bindings/i2cperipheral/I2CPeripheral.c deleted file mode 100644 index b63e8a891b..0000000000 --- a/shared-bindings/i2cperipheral/I2CPeripheral.c +++ /dev/null @@ -1,436 +0,0 @@ -/* - * This file is part of the MicroPython project, http://micropython.org/ - * - * The MIT License (MIT) - * - * Copyright (c) 2018 Noralf Trønnes - * - * 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/microcontroller/Pin.h" -#include "shared-bindings/i2cperipheral/I2CPeripheral.h" -#include "shared-bindings/time/__init__.h" -#include "shared-bindings/util.h" - -#include "shared/runtime/buffer_helper.h" -#include "shared/runtime/context_manager_helpers.h" -#include "shared/runtime/interrupt_char.h" - -#include "py/mperrno.h" -#include "py/mphal.h" -#include "py/obj.h" -#include "py/objproperty.h" -#include "py/runtime.h" - -STATIC mp_obj_t mp_obj_new_i2cperipheral_i2c_peripheral_request(i2cperipheral_i2c_peripheral_obj_t *peripheral, uint8_t address, bool is_read, bool is_restart) { - i2cperipheral_i2c_peripheral_request_obj_t *self = m_new_obj(i2cperipheral_i2c_peripheral_request_obj_t); - self->base.type = &i2cperipheral_i2c_peripheral_request_type; - self->peripheral = peripheral; - self->address = address; - self->is_read = is_read; - self->is_restart = is_restart; - return (mp_obj_t)self; -} - -//| class I2CPeripheral: -//| """Two wire serial protocol peripheral""" -//| -//| def __init__(self, scl: microcontroller.Pin, sda: microcontroller.Pin, addresses: Sequence[int], smbus: bool = False) -> None: -//| """I2C is a two-wire protocol for communicating between devices. -//| This implements the peripheral (sensor, secondary) side. -//| -//| :param ~microcontroller.Pin scl: The clock pin -//| :param ~microcontroller.Pin sda: The data pin -//| :param addresses: The I2C addresses to respond to (how many is hw dependent). -//| :type addresses: list[int] -//| :param bool smbus: Use SMBUS timings if the hardware supports it""" -//| ... -//| -STATIC mp_obj_t i2cperipheral_i2c_peripheral_make_new(const mp_obj_type_t *type, size_t n_args, size_t n_kw, const mp_obj_t *all_args) { - i2cperipheral_i2c_peripheral_obj_t *self = m_new_obj(i2cperipheral_i2c_peripheral_obj_t); - self->base.type = &i2cperipheral_i2c_peripheral_type; - enum { ARG_scl, ARG_sda, ARG_addresses, ARG_smbus }; - static const mp_arg_t allowed_args[] = { - { MP_QSTR_scl, MP_ARG_REQUIRED | MP_ARG_OBJ }, - { MP_QSTR_sda, MP_ARG_REQUIRED | MP_ARG_OBJ }, - { MP_QSTR_addresses, MP_ARG_REQUIRED | MP_ARG_OBJ }, - { MP_QSTR_smbus, MP_ARG_KW_ONLY | MP_ARG_BOOL, {.u_bool = false} }, - }; - mp_arg_val_t args[MP_ARRAY_SIZE(allowed_args)]; - mp_arg_parse_all_kw_array(n_args, n_kw, all_args, MP_ARRAY_SIZE(allowed_args), allowed_args, args); - - const mcu_pin_obj_t *scl = validate_obj_is_free_pin(args[ARG_scl].u_obj); - const mcu_pin_obj_t *sda = validate_obj_is_free_pin(args[ARG_sda].u_obj); - - mp_obj_iter_buf_t iter_buf; - mp_obj_t iterable = mp_getiter(args[ARG_addresses].u_obj, &iter_buf); - mp_obj_t item; - uint8_t *addresses = NULL; - unsigned int i = 0; - while ((item = mp_iternext(iterable)) != MP_OBJ_STOP_ITERATION) { - mp_int_t value; - if (!mp_obj_get_int_maybe(item, &value)) { - mp_raise_TypeError_varg(translate("can't convert %q to %q"), MP_QSTR_address, MP_QSTR_int); - } - if (value < 0x00 || value > 0x7f) { - mp_raise_ValueError(translate("address out of bounds")); - } - addresses = m_renew(uint8_t, addresses, i, i + 1); - addresses[i++] = value; - } - if (i == 0) { - mp_raise_ValueError(translate("addresses is empty")); - } - - common_hal_i2cperipheral_i2c_peripheral_construct(self, scl, sda, addresses, i, args[ARG_smbus].u_bool); - return (mp_obj_t)self; -} - -//| def deinit(self) -> None: -//| """Releases control of the underlying hardware so other classes can use it.""" -//| ... -//| -STATIC mp_obj_t i2cperipheral_i2c_peripheral_obj_deinit(mp_obj_t self_in) { - mp_check_self(mp_obj_is_type(self_in, &i2cperipheral_i2c_peripheral_type)); - i2cperipheral_i2c_peripheral_obj_t *self = MP_OBJ_TO_PTR(self_in); - common_hal_i2cperipheral_i2c_peripheral_deinit(self); - return mp_const_none; -} -MP_DEFINE_CONST_FUN_OBJ_1(i2cperipheral_i2c_peripheral_deinit_obj, i2cperipheral_i2c_peripheral_obj_deinit); - -//| def __enter__(self) -> I2CPeripheral: -//| """No-op used in Context Managers.""" -//| ... -//| -// Provided by context manager helper. - -//| def __exit__(self) -> None: -//| """Automatically deinitializes the hardware on context exit. See -//| :ref:`lifetime-and-contextmanagers` for more info.""" -//| ... -//| -STATIC mp_obj_t i2cperipheral_i2c_peripheral_obj___exit__(size_t n_args, const mp_obj_t *args) { - mp_check_self(mp_obj_is_type(args[0], &i2cperipheral_i2c_peripheral_type)); - i2cperipheral_i2c_peripheral_obj_t *self = MP_OBJ_TO_PTR(args[0]); - common_hal_i2cperipheral_i2c_peripheral_deinit(self); - return mp_const_none; -} -STATIC MP_DEFINE_CONST_FUN_OBJ_VAR_BETWEEN(i2cperipheral_i2c_peripheral___exit___obj, 4, 4, i2cperipheral_i2c_peripheral_obj___exit__); - -//| def request(self, timeout: float = -1) -> I2CPeripheralRequest: -//| """Wait for an I2C request. -//| -//| :param float timeout: Timeout in seconds. Zero means wait forever, a negative value means check once -//| :return: I2C Slave Request or None if timeout=-1 and there's no request -//| :rtype: ~i2cperipheral.I2CPeripheralRequest""" -//| -STATIC mp_obj_t i2cperipheral_i2c_peripheral_request(size_t n_args, const mp_obj_t *pos_args, mp_map_t *kw_args) { - mp_check_self(mp_obj_is_type(pos_args[0], &i2cperipheral_i2c_peripheral_type)); - i2cperipheral_i2c_peripheral_obj_t *self = MP_OBJ_TO_PTR(pos_args[0]); - if (common_hal_i2cperipheral_i2c_peripheral_deinited(self)) { - raise_deinited_error(); - } - enum { ARG_timeout }; - static const mp_arg_t allowed_args[] = { - { MP_QSTR_timeout, MP_ARG_KW_ONLY | MP_ARG_OBJ, {.u_obj = MP_OBJ_NEW_SMALL_INT(-1)} }, - }; - mp_arg_val_t args[MP_ARRAY_SIZE(allowed_args)]; - mp_arg_parse_all(n_args - 1, pos_args + 1, kw_args, MP_ARRAY_SIZE(allowed_args), allowed_args, args); - - #if MICROPY_PY_BUILTINS_FLOAT - float f = mp_obj_get_float(args[ARG_timeout].u_obj) * 1000; - int timeout_ms = (int)f; - #else - int timeout_ms = mp_obj_get_int(args[ARG_timeout].u_obj) * 1000; - #endif - - bool forever = false; - uint64_t timeout_end = 0; - if (timeout_ms == 0) { - forever = true; - } else if (timeout_ms > 0) { - timeout_end = common_hal_time_monotonic_ms() + timeout_ms; - } - - int last_error = 0; - - do { - uint8_t address; - bool is_read; - bool is_restart; - - RUN_BACKGROUND_TASKS; - if (mp_hal_is_interrupted()) { - return mp_const_none; - } - - int status = common_hal_i2cperipheral_i2c_peripheral_is_addressed(self, &address, &is_read, &is_restart); - if (status < 0) { - // On error try one more time before bailing out - if (last_error) { - mp_raise_OSError(last_error); - } - last_error = -status; - mp_hal_delay_ms(10); - continue; - } - - last_error = 0; - - if (status == 0) { - mp_hal_delay_us(10); - continue; - } - - return mp_obj_new_i2cperipheral_i2c_peripheral_request(self, address, is_read, is_restart); - } while (forever || common_hal_time_monotonic_ms() < timeout_end); - - if (timeout_ms > 0) { - mp_raise_OSError(MP_ETIMEDOUT); - } - return mp_const_none; -} -STATIC MP_DEFINE_CONST_FUN_OBJ_KW(i2cperipheral_i2c_peripheral_request_obj, 1, i2cperipheral_i2c_peripheral_request); - -STATIC const mp_rom_map_elem_t i2cperipheral_i2c_peripheral_locals_dict_table[] = { - { MP_ROM_QSTR(MP_QSTR_deinit), MP_ROM_PTR(&i2cperipheral_i2c_peripheral_deinit_obj) }, - { MP_ROM_QSTR(MP_QSTR___enter__), MP_ROM_PTR(&default___enter___obj) }, - { MP_ROM_QSTR(MP_QSTR___exit__), MP_ROM_PTR(&i2cperipheral_i2c_peripheral___exit___obj) }, - { MP_ROM_QSTR(MP_QSTR_request), MP_ROM_PTR(&i2cperipheral_i2c_peripheral_request_obj) }, - -}; - -STATIC MP_DEFINE_CONST_DICT(i2cperipheral_i2c_peripheral_locals_dict, i2cperipheral_i2c_peripheral_locals_dict_table); - -const mp_obj_type_t i2cperipheral_i2c_peripheral_type = { - { &mp_type_type }, - .name = MP_QSTR_I2CPeripheral, - .make_new = i2cperipheral_i2c_peripheral_make_new, - .locals_dict = (mp_obj_dict_t *)&i2cperipheral_i2c_peripheral_locals_dict, -}; - -//| class I2CPeripheralRequest: -//| -//| def __init__(self, peripheral: i2cperipheral.I2CPeripheral, address: int, is_read: bool, is_restart: bool) -> None: -//| """Information about an I2C transfer request -//| This cannot be instantiated directly, but is returned by :py:meth:`I2CPeripheral.request`. -//| -//| :param peripheral: The I2CPeripheral object receiving this request -//| :param address: I2C address -//| :param is_read: True if the main peripheral is requesting data -//| :param is_restart: Repeated Start Condition""" -//| -STATIC mp_obj_t i2cperipheral_i2c_peripheral_request_make_new(const mp_obj_type_t *type, size_t n_args, size_t n_kw, const mp_obj_t *args) { - mp_arg_check_num(n_args, n_kw, 4, 4, false); - return mp_obj_new_i2cperipheral_i2c_peripheral_request(args[0], mp_obj_get_int(args[1]), mp_obj_is_true(args[2]), mp_obj_is_true(args[3])); -} - -//| def __enter__(self) -> I2CPeripheralRequest: -//| """No-op used in Context Managers.""" -//| ... -//| -// Provided by context manager helper. - -//| def __exit__(self) -> None: -//| """Close the request.""" -//| ... -//| -STATIC mp_obj_t i2cperipheral_i2c_peripheral_request_obj___exit__(size_t n_args, const mp_obj_t *args) { - mp_check_self(mp_obj_is_type(args[0], &i2cperipheral_i2c_peripheral_request_type)); - i2cperipheral_i2c_peripheral_request_obj_t *self = MP_OBJ_TO_PTR(args[0]); - common_hal_i2cperipheral_i2c_peripheral_close(self->peripheral); - return mp_const_none; -} -STATIC MP_DEFINE_CONST_FUN_OBJ_VAR_BETWEEN(i2cperipheral_i2c_peripheral_request___exit___obj, 4, 4, i2cperipheral_i2c_peripheral_request_obj___exit__); - -//| address: int -//| """The I2C address of the request.""" -//| -STATIC mp_obj_t i2cperipheral_i2c_peripheral_request_get_address(mp_obj_t self_in) { - mp_check_self(mp_obj_is_type(self_in, &i2cperipheral_i2c_peripheral_request_type)); - i2cperipheral_i2c_peripheral_request_obj_t *self = MP_OBJ_TO_PTR(self_in); - return mp_obj_new_int(self->address); -} -MP_DEFINE_CONST_PROP_GET(i2cperipheral_i2c_peripheral_request_address_obj, i2cperipheral_i2c_peripheral_request_get_address); - -//| is_read: bool -//| """The I2C main controller is reading from this peripheral.""" -//| -STATIC mp_obj_t i2cperipheral_i2c_peripheral_request_get_is_read(mp_obj_t self_in) { - mp_check_self(mp_obj_is_type(self_in, &i2cperipheral_i2c_peripheral_request_type)); - i2cperipheral_i2c_peripheral_request_obj_t *self = MP_OBJ_TO_PTR(self_in); - return mp_obj_new_bool(self->is_read); -} -MP_DEFINE_CONST_PROP_GET(i2cperipheral_i2c_peripheral_request_is_read_obj, i2cperipheral_i2c_peripheral_request_get_is_read); - -//| is_restart: bool -//| """Is Repeated Start Condition.""" -//| -STATIC mp_obj_t i2cperipheral_i2c_peripheral_request_get_is_restart(mp_obj_t self_in) { - mp_check_self(mp_obj_is_type(self_in, &i2cperipheral_i2c_peripheral_request_type)); - i2cperipheral_i2c_peripheral_request_obj_t *self = MP_OBJ_TO_PTR(self_in); - return mp_obj_new_bool(self->is_restart); -} -MP_DEFINE_CONST_PROP_GET(i2cperipheral_i2c_peripheral_request_is_restart_obj, i2cperipheral_i2c_peripheral_request_get_is_restart); - -//| def read(self, n: int = -1, ack: bool = True) -> bytearray: -//| """Read data. -//| If ack=False, the caller is responsible for calling :py:meth:`I2CPeripheralRequest.ack`. -//| -//| :param n: Number of bytes to read (negative means all) -//| :param ack: Whether or not to send an ACK after the n'th byte -//| :return: Bytes read""" -//| ... -//| -STATIC mp_obj_t i2cperipheral_i2c_peripheral_request_read(size_t n_args, const mp_obj_t *pos_args, mp_map_t *kw_args) { - mp_check_self(mp_obj_is_type(pos_args[0], &i2cperipheral_i2c_peripheral_request_type)); - i2cperipheral_i2c_peripheral_request_obj_t *self = MP_OBJ_TO_PTR(pos_args[0]); - enum { ARG_n, ARG_ack }; - static const mp_arg_t allowed_args[] = { - { MP_QSTR_n, MP_ARG_INT, {.u_int = -1} }, - { MP_QSTR_ack, MP_ARG_KW_ONLY | MP_ARG_BOOL, {.u_bool = true} }, - }; - mp_arg_val_t args[MP_ARRAY_SIZE(allowed_args)]; - mp_arg_parse_all(n_args - 1, pos_args + 1, kw_args, MP_ARRAY_SIZE(allowed_args), allowed_args, args); - - if (self->is_read) { - mp_raise_OSError(MP_EACCES); - } - - int n = args[ARG_n].u_int; - if (n == 0) { - return mp_obj_new_bytearray(0, NULL); - } - bool ack = args[ARG_ack].u_bool; - - int i = 0; - uint8_t *buffer = NULL; - uint64_t timeout_end = common_hal_time_monotonic_ms() + 10 * 1000; - while (common_hal_time_monotonic_ms() < timeout_end) { - RUN_BACKGROUND_TASKS; - if (mp_hal_is_interrupted()) { - break; - } - - uint8_t data; - int num = common_hal_i2cperipheral_i2c_peripheral_read_byte(self->peripheral, &data); - if (num == 0) { - break; - } - - buffer = m_renew(uint8_t, buffer, i, i + 1); - buffer[i++] = data; - if (i == n) { - if (ack) { - common_hal_i2cperipheral_i2c_peripheral_ack(self->peripheral, true); - } - break; - } - common_hal_i2cperipheral_i2c_peripheral_ack(self->peripheral, true); - } - - return mp_obj_new_bytearray(i, buffer); -} -MP_DEFINE_CONST_FUN_OBJ_KW(i2cperipheral_i2c_peripheral_request_read_obj, 1, i2cperipheral_i2c_peripheral_request_read); - -//| def write(self, buffer: ReadableBuffer) -> int: -//| """Write the data contained in buffer. -//| -//| :param ~circuitpython_typing.ReadableBuffer buffer: Write out the data in this buffer -//| :return: Number of bytes written""" -//| ... -//| -STATIC mp_obj_t i2cperipheral_i2c_peripheral_request_write(mp_obj_t self_in, mp_obj_t buf_in) { - mp_check_self(mp_obj_is_type(self_in, &i2cperipheral_i2c_peripheral_request_type)); - i2cperipheral_i2c_peripheral_request_obj_t *self = MP_OBJ_TO_PTR(self_in); - - if (!self->is_read) { - mp_raise_OSError(MP_EACCES); - } - - mp_buffer_info_t bufinfo; - mp_get_buffer_raise(buf_in, &bufinfo, MP_BUFFER_READ); - - for (size_t i = 0; i < bufinfo.len; i++) { - RUN_BACKGROUND_TASKS; - if (mp_hal_is_interrupted()) { - break; - } - - int num = common_hal_i2cperipheral_i2c_peripheral_write_byte(self->peripheral, ((uint8_t *)(bufinfo.buf))[i]); - if (num == 0) { - return mp_obj_new_int(i); - } - } - - return mp_obj_new_int(bufinfo.len); -} -STATIC MP_DEFINE_CONST_FUN_OBJ_2(i2cperipheral_i2c_peripheral_request_write_obj, i2cperipheral_i2c_peripheral_request_write); - -//| def ack(self, ack: bool = True) -> None: -//| """Acknowledge or Not Acknowledge last byte received. -//| Use together with :py:meth:`I2CPeripheralRequest.read` ack=False. -//| -//| :param ack: Whether to send an ACK or NACK""" -//| ... -//| -STATIC mp_obj_t i2cperipheral_i2c_peripheral_request_ack(uint n_args, const mp_obj_t *args) { - mp_check_self(mp_obj_is_type(args[0], &i2cperipheral_i2c_peripheral_request_type)); - i2cperipheral_i2c_peripheral_request_obj_t *self = MP_OBJ_TO_PTR(args[0]); - bool ack = (n_args == 1) ? true : mp_obj_is_true(args[1]); - - if (self->is_read) { - mp_raise_OSError(MP_EACCES); - } - - common_hal_i2cperipheral_i2c_peripheral_ack(self->peripheral, ack); - return mp_const_none; -} -MP_DEFINE_CONST_FUN_OBJ_VAR_BETWEEN(i2cperipheral_i2c_peripheral_request_ack_obj, 1, 2, i2cperipheral_i2c_peripheral_request_ack); - -STATIC mp_obj_t i2cperipheral_i2c_peripheral_request_close(mp_obj_t self_in) { - mp_check_self(mp_obj_is_type(self_in, &i2cperipheral_i2c_peripheral_request_type)); - i2cperipheral_i2c_peripheral_request_obj_t *self = MP_OBJ_TO_PTR(self_in); - - common_hal_i2cperipheral_i2c_peripheral_close(self->peripheral); - return mp_const_none; -} -STATIC MP_DEFINE_CONST_FUN_OBJ_1(i2cperipheral_i2c_peripheral_request_close_obj, i2cperipheral_i2c_peripheral_request_close); - -STATIC const mp_rom_map_elem_t i2cperipheral_i2c_peripheral_request_locals_dict_table[] = { - { MP_ROM_QSTR(MP_QSTR___enter__), MP_ROM_PTR(&default___enter___obj) }, - { MP_ROM_QSTR(MP_QSTR___exit__), MP_ROM_PTR(&i2cperipheral_i2c_peripheral_request___exit___obj) }, - { MP_ROM_QSTR(MP_QSTR_address), MP_ROM_PTR(&i2cperipheral_i2c_peripheral_request_address_obj) }, - { MP_ROM_QSTR(MP_QSTR_is_read), MP_ROM_PTR(&i2cperipheral_i2c_peripheral_request_is_read_obj) }, - { MP_ROM_QSTR(MP_QSTR_is_restart), MP_ROM_PTR(&i2cperipheral_i2c_peripheral_request_is_restart_obj) }, - { MP_ROM_QSTR(MP_QSTR_read), MP_ROM_PTR(&i2cperipheral_i2c_peripheral_request_read_obj) }, - { MP_ROM_QSTR(MP_QSTR_write), MP_ROM_PTR(&i2cperipheral_i2c_peripheral_request_write_obj) }, - { MP_ROM_QSTR(MP_QSTR_ack), MP_ROM_PTR(&i2cperipheral_i2c_peripheral_request_ack_obj) }, - { MP_ROM_QSTR(MP_QSTR_close), MP_ROM_PTR(&i2cperipheral_i2c_peripheral_request_close_obj) }, -}; - -STATIC MP_DEFINE_CONST_DICT(i2cperipheral_i2c_peripheral_request_locals_dict, i2cperipheral_i2c_peripheral_request_locals_dict_table); - -const mp_obj_type_t i2cperipheral_i2c_peripheral_request_type = { - { &mp_type_type }, - .name = MP_QSTR_I2CPeripheralRequest, - .make_new = i2cperipheral_i2c_peripheral_request_make_new, - .locals_dict = (mp_obj_dict_t *)&i2cperipheral_i2c_peripheral_request_locals_dict, -}; diff --git a/shared-bindings/i2ctarget/I2CTarget.c b/shared-bindings/i2ctarget/I2CTarget.c new file mode 100644 index 0000000000..4dc5b775f4 --- /dev/null +++ b/shared-bindings/i2ctarget/I2CTarget.c @@ -0,0 +1,425 @@ +/* + * This file is part of the MicroPython project, http://micropython.org/ + * + * The MIT License (MIT) + * + * Copyright (c) 2018 Noralf Trønnes + * + * 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/microcontroller/Pin.h" +#include "shared-bindings/i2ctarget/I2CTarget.h" +#include "shared-bindings/time/__init__.h" +#include "shared-bindings/util.h" + +#include "shared/runtime/buffer_helper.h" +#include "shared/runtime/context_manager_helpers.h" +#include "shared/runtime/interrupt_char.h" + +#include "py/mperrno.h" +#include "py/mphal.h" +#include "py/obj.h" +#include "py/objproperty.h" +#include "py/runtime.h" + +STATIC mp_obj_t mp_obj_new_i2ctarget_i2c_target_request(i2ctarget_i2c_target_obj_t *target, uint8_t address, bool is_read, bool is_restart) { + i2ctarget_i2c_target_request_obj_t *self = m_new_obj(i2ctarget_i2c_target_request_obj_t); + self->base.type = &i2ctarget_i2c_target_request_type; + self->target = target; + self->address = address; + self->is_read = is_read; + self->is_restart = is_restart; + return (mp_obj_t)self; +} + +//| class I2CTarget: +//| """Two wire serial protocol target""" +//| +//| def __init__( +//| self, +//| scl: microcontroller.Pin, +//| sda: microcontroller.Pin, +//| addresses: Sequence[int], +//| smbus: bool = False, +//| ) -> None: +//| """I2C is a two-wire protocol for communicating between devices. +//| This implements the target (peripheral, sensor, secondary) side. +//| +//| :param ~microcontroller.Pin scl: The clock pin +//| :param ~microcontroller.Pin sda: The data pin +//| :param addresses: The I2C addresses to respond to (how many is hardware dependent). +//| :type addresses: list[int] +//| :param bool smbus: Use SMBUS timings if the hardware supports it""" +//| ... +STATIC mp_obj_t i2ctarget_i2c_target_make_new(const mp_obj_type_t *type, size_t n_args, size_t n_kw, const mp_obj_t *all_args) { + i2ctarget_i2c_target_obj_t *self = m_new_obj(i2ctarget_i2c_target_obj_t); + self->base.type = &i2ctarget_i2c_target_type; + enum { ARG_scl, ARG_sda, ARG_addresses, ARG_smbus }; + static const mp_arg_t allowed_args[] = { + { MP_QSTR_scl, MP_ARG_REQUIRED | MP_ARG_OBJ }, + { MP_QSTR_sda, MP_ARG_REQUIRED | MP_ARG_OBJ }, + { MP_QSTR_addresses, MP_ARG_REQUIRED | MP_ARG_OBJ }, + { MP_QSTR_smbus, MP_ARG_KW_ONLY | MP_ARG_BOOL, {.u_bool = false} }, + }; + mp_arg_val_t args[MP_ARRAY_SIZE(allowed_args)]; + mp_arg_parse_all_kw_array(n_args, n_kw, all_args, MP_ARRAY_SIZE(allowed_args), allowed_args, args); + + const mcu_pin_obj_t *scl = validate_obj_is_free_pin(args[ARG_scl].u_obj); + const mcu_pin_obj_t *sda = validate_obj_is_free_pin(args[ARG_sda].u_obj); + + mp_obj_iter_buf_t iter_buf; + mp_obj_t iterable = mp_getiter(args[ARG_addresses].u_obj, &iter_buf); + mp_obj_t item; + uint8_t *addresses = NULL; + unsigned int i = 0; + while ((item = mp_iternext(iterable)) != MP_OBJ_STOP_ITERATION) { + mp_uint_t value = mp_arg_validate_int_range(mp_obj_get_int(item), 0x00, 0x7f, MP_QSTR_address); + addresses = m_renew(uint8_t, addresses, i, i + 1); + addresses[i++] = value; + } + if (i == 0) { + mp_raise_ValueError(translate("addresses is empty")); + } + + common_hal_i2ctarget_i2c_target_construct(self, scl, sda, addresses, i, args[ARG_smbus].u_bool); + return (mp_obj_t)self; +} + +//| def deinit(self) -> None: +//| """Releases control of the underlying hardware so other classes can use it.""" +//| ... +STATIC mp_obj_t i2ctarget_i2c_target_obj_deinit(mp_obj_t self_in) { + mp_check_self(mp_obj_is_type(self_in, &i2ctarget_i2c_target_type)); + i2ctarget_i2c_target_obj_t *self = MP_OBJ_TO_PTR(self_in); + common_hal_i2ctarget_i2c_target_deinit(self); + return mp_const_none; +} +MP_DEFINE_CONST_FUN_OBJ_1(i2ctarget_i2c_target_deinit_obj, i2ctarget_i2c_target_obj_deinit); + +//| def __enter__(self) -> I2CTarget: +//| """No-op used in Context Managers.""" +//| ... +// Provided by context manager helper. + +//| def __exit__(self) -> None: +//| """Automatically deinitializes the hardware on context exit. See +//| :ref:`lifetime-and-contextmanagers` for more info.""" +//| ... +STATIC mp_obj_t i2ctarget_i2c_target_obj___exit__(size_t n_args, const mp_obj_t *args) { + mp_check_self(mp_obj_is_type(args[0], &i2ctarget_i2c_target_type)); + i2ctarget_i2c_target_obj_t *self = MP_OBJ_TO_PTR(args[0]); + common_hal_i2ctarget_i2c_target_deinit(self); + return mp_const_none; +} +STATIC MP_DEFINE_CONST_FUN_OBJ_VAR_BETWEEN(i2ctarget_i2c_target___exit___obj, 4, 4, i2ctarget_i2c_target_obj___exit__); + +//| def request(self, *, timeout: float = -1) -> I2CTargetRequest: +//| """Wait for an I2C request. +//| +//| :param float timeout: Timeout in seconds. Zero means wait forever, a negative value means check once +//| :return: I2CTargetRequest or None if timeout=-1 and there's no request +//| :rtype: ~i2ctarget.I2CTargetRequest""" +//| +STATIC mp_obj_t i2ctarget_i2c_target_request(size_t n_args, const mp_obj_t *pos_args, mp_map_t *kw_args) { + mp_check_self(mp_obj_is_type(pos_args[0], &i2ctarget_i2c_target_type)); + i2ctarget_i2c_target_obj_t *self = MP_OBJ_TO_PTR(pos_args[0]); + if (common_hal_i2ctarget_i2c_target_deinited(self)) { + raise_deinited_error(); + } + enum { ARG_timeout }; + static const mp_arg_t allowed_args[] = { + { MP_QSTR_timeout, MP_ARG_KW_ONLY | MP_ARG_OBJ, {.u_obj = MP_OBJ_NEW_SMALL_INT(-1)} }, + }; + mp_arg_val_t args[MP_ARRAY_SIZE(allowed_args)]; + mp_arg_parse_all(n_args - 1, pos_args + 1, kw_args, MP_ARRAY_SIZE(allowed_args), allowed_args, args); + + #if MICROPY_PY_BUILTINS_FLOAT + float f = mp_obj_get_float(args[ARG_timeout].u_obj) * 1000; + int timeout_ms = (int)f; + #else + int timeout_ms = mp_obj_get_int(args[ARG_timeout].u_obj) * 1000; + #endif + + bool forever = false; + uint64_t timeout_end = 0; + if (timeout_ms <= 0) { + forever = true; + } else if (timeout_ms > 0) { + timeout_end = common_hal_time_monotonic_ms() + timeout_ms; + } + + int last_error = 0; + + do { + uint8_t address; + bool is_read; + bool is_restart; + + RUN_BACKGROUND_TASKS; + if (mp_hal_is_interrupted()) { + return mp_const_none; + } + + int status = common_hal_i2ctarget_i2c_target_is_addressed(self, &address, &is_read, &is_restart); + if (status < 0) { + // On error try one more time before bailing out + if (last_error) { + mp_raise_OSError(last_error); + } + last_error = -status; + mp_hal_delay_ms(10); + continue; + } + + last_error = 0; + + if (status == 0) { + mp_hal_delay_us(10); + continue; + } + + return mp_obj_new_i2ctarget_i2c_target_request(self, address, is_read, is_restart); + } while (forever || common_hal_time_monotonic_ms() < timeout_end); + + if (timeout_ms > 0) { + mp_raise_OSError(MP_ETIMEDOUT); + } + return mp_const_none; +} +STATIC MP_DEFINE_CONST_FUN_OBJ_KW(i2ctarget_i2c_target_request_obj, 1, i2ctarget_i2c_target_request); + +STATIC const mp_rom_map_elem_t i2ctarget_i2c_target_locals_dict_table[] = { + { MP_ROM_QSTR(MP_QSTR_deinit), MP_ROM_PTR(&i2ctarget_i2c_target_deinit_obj) }, + { MP_ROM_QSTR(MP_QSTR___enter__), MP_ROM_PTR(&default___enter___obj) }, + { MP_ROM_QSTR(MP_QSTR___exit__), MP_ROM_PTR(&i2ctarget_i2c_target___exit___obj) }, + { MP_ROM_QSTR(MP_QSTR_request), MP_ROM_PTR(&i2ctarget_i2c_target_request_obj) }, + +}; + +STATIC MP_DEFINE_CONST_DICT(i2ctarget_i2c_target_locals_dict, i2ctarget_i2c_target_locals_dict_table); + +const mp_obj_type_t i2ctarget_i2c_target_type = { + { &mp_type_type }, + .name = MP_QSTR_I2CTarget, + .make_new = i2ctarget_i2c_target_make_new, + .locals_dict = (mp_obj_dict_t *)&i2ctarget_i2c_target_locals_dict, +}; + +//| class I2CTargetRequest: +//| def __init__( +//| self, target: i2ctarget.I2CTarget, address: int, is_read: bool, is_restart: bool +//| ) -> None: +//| """Information about an I2C transfer request +//| This cannot be instantiated directly, but is returned by :py:meth:`I2CTarget.request`. +//| +//| :param target: The I2CTarget object receiving this request +//| :param address: I2C address +//| :param is_read: True if the main target is requesting data +//| :param is_restart: Repeated Start Condition""" +STATIC mp_obj_t i2ctarget_i2c_target_request_make_new(const mp_obj_type_t *type, size_t n_args, size_t n_kw, const mp_obj_t *args) { + mp_arg_check_num(n_args, n_kw, 4, 4, false); + return mp_obj_new_i2ctarget_i2c_target_request(args[0], mp_obj_get_int(args[1]), mp_obj_is_true(args[2]), mp_obj_is_true(args[3])); +} + +//| def __enter__(self) -> I2CTargetRequest: +//| """No-op used in Context Managers.""" +//| ... +// Provided by context manager helper. + +//| def __exit__(self) -> None: +//| """Close the request.""" +//| ... +STATIC mp_obj_t i2ctarget_i2c_target_request_obj___exit__(size_t n_args, const mp_obj_t *args) { + mp_check_self(mp_obj_is_type(args[0], &i2ctarget_i2c_target_request_type)); + i2ctarget_i2c_target_request_obj_t *self = MP_OBJ_TO_PTR(args[0]); + common_hal_i2ctarget_i2c_target_close(self->target); + return mp_const_none; +} +STATIC MP_DEFINE_CONST_FUN_OBJ_VAR_BETWEEN(i2ctarget_i2c_target_request___exit___obj, 4, 4, i2ctarget_i2c_target_request_obj___exit__); + +//| address: int +//| """The I2C address of the request.""" +STATIC mp_obj_t i2ctarget_i2c_target_request_get_address(mp_obj_t self_in) { + mp_check_self(mp_obj_is_type(self_in, &i2ctarget_i2c_target_request_type)); + i2ctarget_i2c_target_request_obj_t *self = MP_OBJ_TO_PTR(self_in); + return mp_obj_new_int(self->address); +} +MP_DEFINE_CONST_PROP_GET(i2ctarget_i2c_target_request_address_obj, i2ctarget_i2c_target_request_get_address); + +//| is_read: bool +//| """The I2C main controller is reading from this target.""" +STATIC mp_obj_t i2ctarget_i2c_target_request_get_is_read(mp_obj_t self_in) { + mp_check_self(mp_obj_is_type(self_in, &i2ctarget_i2c_target_request_type)); + i2ctarget_i2c_target_request_obj_t *self = MP_OBJ_TO_PTR(self_in); + return mp_obj_new_bool(self->is_read); +} +MP_DEFINE_CONST_PROP_GET(i2ctarget_i2c_target_request_is_read_obj, i2ctarget_i2c_target_request_get_is_read); + +//| is_restart: bool +//| """Is Repeated Start Condition.""" +STATIC mp_obj_t i2ctarget_i2c_target_request_get_is_restart(mp_obj_t self_in) { + mp_check_self(mp_obj_is_type(self_in, &i2ctarget_i2c_target_request_type)); + i2ctarget_i2c_target_request_obj_t *self = MP_OBJ_TO_PTR(self_in); + return mp_obj_new_bool(self->is_restart); +} +MP_DEFINE_CONST_PROP_GET(i2ctarget_i2c_target_request_is_restart_obj, i2ctarget_i2c_target_request_get_is_restart); + +//| def read(self, n: int = -1, ack: bool = True) -> bytearray: +//| """Read data. +//| If ack=False, the caller is responsible for calling :py:meth:`I2CTargetRequest.ack`. +//| +//| :param n: Number of bytes to read (negative means all) +//| :param ack: Whether or not to send an ACK after the n'th byte +//| :return: Bytes read""" +//| ... +STATIC mp_obj_t i2ctarget_i2c_target_request_read(size_t n_args, const mp_obj_t *pos_args, mp_map_t *kw_args) { + mp_check_self(mp_obj_is_type(pos_args[0], &i2ctarget_i2c_target_request_type)); + i2ctarget_i2c_target_request_obj_t *self = MP_OBJ_TO_PTR(pos_args[0]); + enum { ARG_n, ARG_ack }; + static const mp_arg_t allowed_args[] = { + { MP_QSTR_n, MP_ARG_INT, {.u_int = -1} }, + { MP_QSTR_ack, MP_ARG_KW_ONLY | MP_ARG_BOOL, {.u_bool = true} }, + }; + mp_arg_val_t args[MP_ARRAY_SIZE(allowed_args)]; + mp_arg_parse_all(n_args - 1, pos_args + 1, kw_args, MP_ARRAY_SIZE(allowed_args), allowed_args, args); + + if (self->is_read) { + mp_raise_OSError(MP_EACCES); + } + + int n = args[ARG_n].u_int; + if (n == 0) { + return mp_obj_new_bytearray(0, NULL); + } + bool ack = args[ARG_ack].u_bool; + + int i = 0; + uint8_t *buffer = NULL; + uint64_t timeout_end = common_hal_time_monotonic_ms() + 10 * 1000; + while (common_hal_time_monotonic_ms() < timeout_end) { + RUN_BACKGROUND_TASKS; + if (mp_hal_is_interrupted()) { + break; + } + + uint8_t data; + int num = common_hal_i2ctarget_i2c_target_read_byte(self->target, &data); + if (num == 0) { + break; + } + + buffer = m_renew(uint8_t, buffer, i, i + 1); + buffer[i++] = data; + if (i == n) { + if (ack) { + common_hal_i2ctarget_i2c_target_ack(self->target, true); + } + break; + } + common_hal_i2ctarget_i2c_target_ack(self->target, true); + } + + return mp_obj_new_bytearray(i, buffer); +} +MP_DEFINE_CONST_FUN_OBJ_KW(i2ctarget_i2c_target_request_read_obj, 1, i2ctarget_i2c_target_request_read); + +//| def write(self, buffer: ReadableBuffer) -> int: +//| """Write the data contained in buffer. +//| +//| :param ~circuitpython_typing.ReadableBuffer buffer: Write out the data in this buffer +//| :return: Number of bytes written""" +//| ... +STATIC mp_obj_t i2ctarget_i2c_target_request_write(mp_obj_t self_in, mp_obj_t buf_in) { + mp_check_self(mp_obj_is_type(self_in, &i2ctarget_i2c_target_request_type)); + i2ctarget_i2c_target_request_obj_t *self = MP_OBJ_TO_PTR(self_in); + + if (!self->is_read) { + mp_raise_OSError(MP_EACCES); + } + + mp_buffer_info_t bufinfo; + mp_get_buffer_raise(buf_in, &bufinfo, MP_BUFFER_READ); + + for (size_t i = 0; i < bufinfo.len; i++) { + RUN_BACKGROUND_TASKS; + if (mp_hal_is_interrupted()) { + break; + } + + int num = common_hal_i2ctarget_i2c_target_write_byte(self->target, ((uint8_t *)(bufinfo.buf))[i]); + if (num == 0) { + return mp_obj_new_int(i); + } + } + + return mp_obj_new_int(bufinfo.len); +} +STATIC MP_DEFINE_CONST_FUN_OBJ_2(i2ctarget_i2c_target_request_write_obj, i2ctarget_i2c_target_request_write); + +//| def ack(self, ack: bool = True) -> None: +//| """Acknowledge or Not Acknowledge last byte received. +//| Use together with :py:meth:`I2CTargetRequest.read` ack=False. +//| +//| :param ack: Whether to send an ACK or NACK""" +//| ... +//| +STATIC mp_obj_t i2ctarget_i2c_target_request_ack(uint n_args, const mp_obj_t *args) { + mp_check_self(mp_obj_is_type(args[0], &i2ctarget_i2c_target_request_type)); + i2ctarget_i2c_target_request_obj_t *self = MP_OBJ_TO_PTR(args[0]); + bool ack = (n_args == 1) ? true : mp_obj_is_true(args[1]); + + if (self->is_read) { + mp_raise_OSError(MP_EACCES); + } + + common_hal_i2ctarget_i2c_target_ack(self->target, ack); + return mp_const_none; +} +MP_DEFINE_CONST_FUN_OBJ_VAR_BETWEEN(i2ctarget_i2c_target_request_ack_obj, 1, 2, i2ctarget_i2c_target_request_ack); + +STATIC mp_obj_t i2ctarget_i2c_target_request_close(mp_obj_t self_in) { + mp_check_self(mp_obj_is_type(self_in, &i2ctarget_i2c_target_request_type)); + i2ctarget_i2c_target_request_obj_t *self = MP_OBJ_TO_PTR(self_in); + + common_hal_i2ctarget_i2c_target_close(self->target); + return mp_const_none; +} +STATIC MP_DEFINE_CONST_FUN_OBJ_1(i2ctarget_i2c_target_request_close_obj, i2ctarget_i2c_target_request_close); + +STATIC const mp_rom_map_elem_t i2ctarget_i2c_target_request_locals_dict_table[] = { + { MP_ROM_QSTR(MP_QSTR___enter__), MP_ROM_PTR(&default___enter___obj) }, + { MP_ROM_QSTR(MP_QSTR___exit__), MP_ROM_PTR(&i2ctarget_i2c_target_request___exit___obj) }, + { MP_ROM_QSTR(MP_QSTR_address), MP_ROM_PTR(&i2ctarget_i2c_target_request_address_obj) }, + { MP_ROM_QSTR(MP_QSTR_is_read), MP_ROM_PTR(&i2ctarget_i2c_target_request_is_read_obj) }, + { MP_ROM_QSTR(MP_QSTR_is_restart), MP_ROM_PTR(&i2ctarget_i2c_target_request_is_restart_obj) }, + { MP_ROM_QSTR(MP_QSTR_read), MP_ROM_PTR(&i2ctarget_i2c_target_request_read_obj) }, + { MP_ROM_QSTR(MP_QSTR_write), MP_ROM_PTR(&i2ctarget_i2c_target_request_write_obj) }, + { MP_ROM_QSTR(MP_QSTR_ack), MP_ROM_PTR(&i2ctarget_i2c_target_request_ack_obj) }, + { MP_ROM_QSTR(MP_QSTR_close), MP_ROM_PTR(&i2ctarget_i2c_target_request_close_obj) }, +}; + +STATIC MP_DEFINE_CONST_DICT(i2ctarget_i2c_target_request_locals_dict, i2ctarget_i2c_target_request_locals_dict_table); + +const mp_obj_type_t i2ctarget_i2c_target_request_type = { + { &mp_type_type }, + .name = MP_QSTR_I2CTargetRequest, + .make_new = i2ctarget_i2c_target_request_make_new, + .locals_dict = (mp_obj_dict_t *)&i2ctarget_i2c_target_request_locals_dict, +}; diff --git a/shared-bindings/i2cperipheral/I2CPeripheral.h b/shared-bindings/i2ctarget/I2CTarget.h similarity index 54% rename from shared-bindings/i2cperipheral/I2CPeripheral.h rename to shared-bindings/i2ctarget/I2CTarget.h index d3db1b96c9..e9c9714dee 100644 --- a/shared-bindings/i2cperipheral/I2CPeripheral.h +++ b/shared-bindings/i2ctarget/I2CTarget.h @@ -24,37 +24,37 @@ * THE SOFTWARE. */ -#ifndef MICROPY_INCLUDED_SHARED_BINDINGS_BUSIO_I2C_SLAVE_H -#define MICROPY_INCLUDED_SHARED_BINDINGS_BUSIO_I2C_SLAVE_H +#ifndef MICROPY_INCLUDED_SHARED_BINDINGS_BUSIO_I2C_TARGET_H +#define MICROPY_INCLUDED_SHARED_BINDINGS_BUSIO_I2C_TARGET_H #include "py/obj.h" #include "common-hal/microcontroller/Pin.h" -#include "common-hal/i2cperipheral/I2CPeripheral.h" +#include "common-hal/i2ctarget/I2CTarget.h" typedef struct { mp_obj_base_t base; - i2cperipheral_i2c_peripheral_obj_t *peripheral; + i2ctarget_i2c_target_obj_t *target; uint16_t address; bool is_read; bool is_restart; -} i2cperipheral_i2c_peripheral_request_obj_t; +} i2ctarget_i2c_target_request_obj_t; -extern const mp_obj_type_t i2cperipheral_i2c_peripheral_request_type; +extern const mp_obj_type_t i2ctarget_i2c_target_request_type; -extern const mp_obj_type_t i2cperipheral_i2c_peripheral_type; +extern const mp_obj_type_t i2ctarget_i2c_target_type; -extern void common_hal_i2cperipheral_i2c_peripheral_construct(i2cperipheral_i2c_peripheral_obj_t *self, +extern void common_hal_i2ctarget_i2c_target_construct(i2ctarget_i2c_target_obj_t *self, const mcu_pin_obj_t *scl, const mcu_pin_obj_t *sda, uint8_t *addresses, unsigned int num_addresses, bool smbus); -extern void common_hal_i2cperipheral_i2c_peripheral_deinit(i2cperipheral_i2c_peripheral_obj_t *self); -extern bool common_hal_i2cperipheral_i2c_peripheral_deinited(i2cperipheral_i2c_peripheral_obj_t *self); +extern void common_hal_i2ctarget_i2c_target_deinit(i2ctarget_i2c_target_obj_t *self); +extern bool common_hal_i2ctarget_i2c_target_deinited(i2ctarget_i2c_target_obj_t *self); -extern int common_hal_i2cperipheral_i2c_peripheral_is_addressed(i2cperipheral_i2c_peripheral_obj_t *self, +extern int common_hal_i2ctarget_i2c_target_is_addressed(i2ctarget_i2c_target_obj_t *self, uint8_t *address, bool *is_read, bool *is_restart); -extern int common_hal_i2cperipheral_i2c_peripheral_read_byte(i2cperipheral_i2c_peripheral_obj_t *self, uint8_t *data); -extern int common_hal_i2cperipheral_i2c_peripheral_write_byte(i2cperipheral_i2c_peripheral_obj_t *self, uint8_t data); -extern void common_hal_i2cperipheral_i2c_peripheral_ack(i2cperipheral_i2c_peripheral_obj_t *self, bool ack); -extern void common_hal_i2cperipheral_i2c_peripheral_close(i2cperipheral_i2c_peripheral_obj_t *self); +extern int common_hal_i2ctarget_i2c_target_read_byte(i2ctarget_i2c_target_obj_t *self, uint8_t *data); +extern int common_hal_i2ctarget_i2c_target_write_byte(i2ctarget_i2c_target_obj_t *self, uint8_t data); +extern void common_hal_i2ctarget_i2c_target_ack(i2ctarget_i2c_target_obj_t *self, bool ack); +extern void common_hal_i2ctarget_i2c_target_close(i2ctarget_i2c_target_obj_t *self); -#endif // MICROPY_INCLUDED_SHARED_BINDINGS_BUSIO_I2C_SLAVE_H +#endif // MICROPY_INCLUDED_SHARED_BINDINGS_BUSIO_I2C_TARGET_H diff --git a/shared-bindings/i2cperipheral/__init__.c b/shared-bindings/i2ctarget/__init__.c similarity index 73% rename from shared-bindings/i2cperipheral/__init__.c rename to shared-bindings/i2ctarget/__init__.c index fde7002daf..0fa7e50dd6 100644 --- a/shared-bindings/i2cperipheral/__init__.c +++ b/shared-bindings/i2ctarget/__init__.c @@ -30,24 +30,24 @@ #include "py/runtime.h" #include "shared-bindings/microcontroller/Pin.h" -// #include "shared-bindings/i2cperipheral/__init__.h" -#include "shared-bindings/i2cperipheral/I2CPeripheral.h" +// #include "shared-bindings/i2ctarget/__init__.h" +#include "shared-bindings/i2ctarget/I2CTarget.h" #include "py/runtime.h" -//| """Two wire serial protocol peripheral +//| """Two wire serial protocol target //| -//| The `i2cperipheral` module contains classes to support an I2C peripheral. +//| The `i2ctarget` module contains classes to support an I2C target. //| -//| Example emulating a peripheral with 2 addresses (read and write):: +//| Example emulating a target with 2 addresses (read and write):: //| //| import board -//| from i2cperipheral import I2CPeripheral +//| from i2ctarget import I2CTarget //| //| regs = [0] * 16 //| index = 0 //| -//| with I2CPeripheral(board.SCL, board.SDA, (0x40, 0x41)) as device: +//| with I2CTarget(board.SCL, board.SDA, (0x40, 0x41)) as device: //| while True: //| r = device.request() //| if not r: @@ -84,25 +84,29 @@ //| 0xaa //| //| .. warning:: -//| I2CPeripheral makes use of clock stretching in order to slow down +//| I2CTarget makes use of clock stretching in order to slow down //| the host. //| Make sure the I2C host supports this. //| //| Raspberry Pi in particular does not support this with its I2C hw block. //| This can be worked around by using the ``i2c-gpio`` bit banging driver. //| Since the RPi firmware uses the hw i2c, it's not possible to emulate a HAT eeprom.""" -//| -STATIC const mp_rom_map_elem_t i2cperipheral_module_globals_table[] = { - { MP_ROM_QSTR(MP_QSTR___name__), MP_ROM_QSTR(MP_QSTR_i2cperipheral) }, - { MP_ROM_QSTR(MP_QSTR_I2CPeripheral), MP_ROM_PTR(&i2cperipheral_i2c_peripheral_type) }, +STATIC const mp_rom_map_elem_t i2ctarget_module_globals_table[] = { + { MP_ROM_QSTR(MP_QSTR___name__), MP_ROM_QSTR(MP_QSTR_i2ctarget) }, + { MP_ROM_QSTR(MP_QSTR_I2CTarget), MP_ROM_PTR(&i2ctarget_i2c_target_type) }, + // TODO: Remove for CircuitPython 9.0.0 + { MP_ROM_QSTR(MP_QSTR_I2CPeripheral), MP_ROM_PTR(&i2ctarget_i2c_target_type) }, }; -STATIC MP_DEFINE_CONST_DICT(i2cperipheral_module_globals, i2cperipheral_module_globals_table); +STATIC MP_DEFINE_CONST_DICT(i2ctarget_module_globals, i2ctarget_module_globals_table); -const mp_obj_module_t i2cperipheral_module = { +const mp_obj_module_t i2ctarget_module = { .base = { &mp_type_module }, - .globals = (mp_obj_dict_t *)&i2cperipheral_module_globals, + .globals = (mp_obj_dict_t *)&i2ctarget_module_globals, }; -MP_REGISTER_MODULE(MP_QSTR_i2cperipheral, i2cperipheral_module, CIRCUITPY_I2CPERIPHERAL); +MP_REGISTER_MODULE(MP_QSTR_i2ctarget, i2ctarget_module, CIRCUITPY_I2CTARGET); + +// TODO: Remove for CircuitPython 9.0.0 +MP_REGISTER_MODULE(MP_QSTR_i2cperipheral, i2ctarget_module, CIRCUITPY_I2CTARGET); diff --git a/shared-bindings/imagecapture/ParallelImageCapture.c b/shared-bindings/imagecapture/ParallelImageCapture.c index 7f90f0923b..b6352514bf 100644 --- a/shared-bindings/imagecapture/ParallelImageCapture.c +++ b/shared-bindings/imagecapture/ParallelImageCapture.c @@ -47,13 +47,14 @@ //| ) -> None: //| """Create a parallel image capture object //| +//| This object is usually used with a camera-specific wrapper library such as `adafruit_ov5640 `_. +//| //| :param List[microcontroller.Pin] data_pins: The data pins. //| :param microcontroller.Pin clock: The pixel clock input. //| :param microcontroller.Pin vsync: The vertical sync input, which has a negative-going pulse at the beginning of each frame. //| :param microcontroller.Pin href: The horizontal reference input, which is high whenever the camera is transmitting valid pixel information. //| """ //| ... -//| STATIC mp_obj_t imagecapture_parallelimagecapture_make_new(const mp_obj_type_t *type, size_t n_args, size_t n_kw, const mp_obj_t *all_args) { enum { ARG_data_pins, ARG_clock, ARG_vsync, ARG_href, NUM_ARGS }; @@ -88,7 +89,6 @@ STATIC mp_obj_t imagecapture_parallelimagecapture_make_new(const mp_obj_type_t * //| //| This will stop a continuous-mode capture, if one is in progress.""" //| ... -//| STATIC mp_obj_t imagecapture_parallelimagecapture_capture(mp_obj_t self_in, mp_obj_t buffer) { imagecapture_parallelimagecapture_obj_t *self = (imagecapture_parallelimagecapture_obj_t *)self_in; common_hal_imagecapture_parallelimagecapture_singleshot_capture(self, buffer); @@ -97,7 +97,9 @@ STATIC mp_obj_t imagecapture_parallelimagecapture_capture(mp_obj_t self_in, mp_o } STATIC MP_DEFINE_CONST_FUN_OBJ_2(imagecapture_parallelimagecapture_capture_obj, imagecapture_parallelimagecapture_capture); -//| def continuous_capture_start(self, buffer1: WriteableBuffer, buffer2: WriteableBuffer, /) -> None: +//| def continuous_capture_start( +//| self, buffer1: WriteableBuffer, buffer2: WriteableBuffer, / +//| ) -> None: //| """Begin capturing into the given buffers in the background. //| //| Call `continuous_capture_get_frame` to get the next available @@ -107,7 +109,6 @@ STATIC MP_DEFINE_CONST_FUN_OBJ_2(imagecapture_parallelimagecapture_capture_obj, //| `ParallelImageCapture` object keeps references to ``buffer1`` and //| ``buffer2``, so the objects will not be garbage collected.""" //| ... -//| STATIC mp_obj_t imagecapture_parallelimagecapture_continuous_capture_start(mp_obj_t self_in, mp_obj_t buffer1, mp_obj_t buffer2) { imagecapture_parallelimagecapture_obj_t *self = (imagecapture_parallelimagecapture_obj_t *)self_in; common_hal_imagecapture_parallelimagecapture_continuous_capture_start(self, buffer1, buffer2); @@ -119,7 +120,6 @@ STATIC MP_DEFINE_CONST_FUN_OBJ_3(imagecapture_parallelimagecapture_continuous_ca //| def continuous_capture_get_frame(self) -> WriteableBuffer: //| """Return the next available frame, one of the two buffers passed to `continuous_capture_start`""" //| ... -//| STATIC mp_obj_t imagecapture_parallelimagecapture_continuous_capture_get_frame(mp_obj_t self_in) { imagecapture_parallelimagecapture_obj_t *self = (imagecapture_parallelimagecapture_obj_t *)self_in; return common_hal_imagecapture_parallelimagecapture_continuous_capture_get_frame(self); @@ -135,7 +135,6 @@ STATIC MP_DEFINE_CONST_FUN_OBJ_1(imagecapture_parallelimagecapture_continuous_ca //| references to the buffers passed to `continuous_capture_start`, //| potentially allowing the objects to be garbage collected.""" //| ... -//| STATIC mp_obj_t imagecapture_parallelimagecapture_continuous_capture_stop(mp_obj_t self_in) { imagecapture_parallelimagecapture_obj_t *self = (imagecapture_parallelimagecapture_obj_t *)self_in; common_hal_imagecapture_parallelimagecapture_continuous_capture_stop(self); @@ -150,7 +149,6 @@ STATIC MP_DEFINE_CONST_FUN_OBJ_1(imagecapture_parallelimagecapture_continuous_ca //| def deinit(self) -> None: //| """Deinitialize this instance""" //| ... -//| STATIC mp_obj_t imagecapture_parallelimagecapture_deinit(mp_obj_t self_in) { imagecapture_parallelimagecapture_obj_t *self = (imagecapture_parallelimagecapture_obj_t *)self_in; common_hal_imagecapture_parallelimagecapture_deinit(self); @@ -162,7 +160,6 @@ STATIC MP_DEFINE_CONST_FUN_OBJ_1(imagecapture_parallelimagecapture_deinit_obj, i //| def __enter__(self) -> ParallelImageCapture: //| """No-op used in Context Managers.""" //| ... -//| // Provided by context manager helper. //| def __exit__(self) -> None: diff --git a/shared-bindings/imagecapture/__init__.c b/shared-bindings/imagecapture/__init__.c index 0e5092aee8..fdd4424114 100644 --- a/shared-bindings/imagecapture/__init__.c +++ b/shared-bindings/imagecapture/__init__.c @@ -31,9 +31,13 @@ #include "shared-bindings/imagecapture/ParallelImageCapture.h" -//| """Support for "Parallel capture" interfaces""" +//| """Support for "Parallel capture" interfaces //| - +//| .. seealso:: +//| +//| Espressif microcontrollers use the `esp32_camera` module together. +//| +//| """ STATIC const mp_rom_map_elem_t imagecapture_module_globals_table[] = { { MP_ROM_QSTR(MP_QSTR___name__), MP_ROM_QSTR(MP_QSTR_imagecapture) }, { MP_ROM_QSTR(MP_QSTR_ParallelImageCapture), MP_ROM_PTR(&imagecapture_parallelimagecapture_type) }, diff --git a/shared-bindings/ipaddress/IPv4Address.c b/shared-bindings/ipaddress/IPv4Address.c index 23204329d3..b9a2363e09 100644 --- a/shared-bindings/ipaddress/IPv4Address.c +++ b/shared-bindings/ipaddress/IPv4Address.c @@ -42,9 +42,8 @@ //| def __init__(self, address: Union[int, str, bytes]) -> None: //| """Create a new IPv4Address object encapsulating the address value. //| -//| The value itself can either be bytes or a string formatted address.""" +//| The value itself can either be bytes or a string formatted address.""" //| ... -//| STATIC mp_obj_t ipaddress_ipv4address_make_new(const mp_obj_type_t *type, size_t n_args, size_t n_kw, const mp_obj_t *all_args) { enum { ARG_address }; static const mp_arg_t allowed_args[] = { @@ -88,7 +87,6 @@ STATIC mp_obj_t ipaddress_ipv4address_make_new(const mp_obj_type_t *type, size_t //| packed: bytes //| """The bytes that make up the address (read-only).""" -//| STATIC mp_obj_t ipaddress_ipv4address_get_packed(mp_obj_t self_in) { ipaddress_ipv4address_obj_t *self = MP_OBJ_TO_PTR(self_in); @@ -101,7 +99,6 @@ MP_PROPERTY_GETTER(ipaddress_ipv4address_packed_obj, //| version: int //| """4 for IPv4, 6 for IPv6""" -//| STATIC mp_obj_t ipaddress_ipv4address_get_version(mp_obj_t self_in) { ipaddress_ipv4address_obj_t *self = MP_OBJ_TO_PTR(self_in); mp_buffer_info_t buf_info; @@ -122,7 +119,6 @@ MP_PROPERTY_GETTER(ipaddress_ipv4address_version_obj, //| def __eq__(self, other: object) -> bool: //| """Two Address objects are equal if their addresses and address types are equal.""" //| ... -//| STATIC mp_obj_t ipaddress_ipv4address_binary_op(mp_binary_op_t op, mp_obj_t lhs_in, mp_obj_t rhs_in) { switch (op) { // Two Addresses are equal if their address bytes and address_type are equal diff --git a/shared-bindings/ipaddress/__init__.c b/shared-bindings/ipaddress/__init__.c index 6da5a52299..fb4c8bf38d 100644 --- a/shared-bindings/ipaddress/__init__.c +++ b/shared-bindings/ipaddress/__init__.c @@ -35,7 +35,6 @@ //| The `ipaddress` module provides types for IP addresses. It is a subset of CPython's ipaddress //| module. //| """ -//| bool ipaddress_parse_ipv4address(const char *str_data, size_t str_len, uint32_t *ip_out) { diff --git a/shared-bindings/is31fl3741/FrameBuffer.c b/shared-bindings/is31fl3741/FrameBuffer.c index e1a87e8ee0..f907a1dcd3 100644 --- a/shared-bindings/is31fl3741/FrameBuffer.c +++ b/shared-bindings/is31fl3741/FrameBuffer.c @@ -40,8 +40,17 @@ //| class IS31FL3741_FrameBuffer: //| """Creates an in-memory framebuffer for a IS31FL3741 device.""" //| -//| def __init__(self, is31: is31fl3741.IS31FL3741, width: int, height: int, mapping: Tuple[int, ...], *, -//| framebuffer: Optional[WriteableBuffer] = None, scale: bool = False, gamma: bool = False) -> None: +//| def __init__( +//| self, +//| is31: is31fl3741.IS31FL3741, +//| width: int, +//| height: int, +//| mapping: Tuple[int, ...], +//| *, +//| framebuffer: Optional[WriteableBuffer] = None, +//| scale: bool = False, +//| gamma: bool = False +//| ) -> None: //| """Create a IS31FL3741_FrameBuffer object with the given attributes. //| //| The framebuffer is in "RGB888" format using 4 bytes per pixel. @@ -62,7 +71,6 @@ //| :param bool scale: if True display is scaled down by 3 when displayed //| :param bool gamma: if True apply gamma correction to all LEDs""" //| ... -//| STATIC mp_obj_t is31fl3741_FrameBuffer_make_new(const mp_obj_type_t *type, size_t n_args, size_t n_kw, const mp_obj_t *all_args) { enum { ARG_is31, ARG_width, ARG_height, ARG_mapping, ARG_framebuffer, ARG_scale, ARG_gamma }; static const mp_arg_t allowed_args[] = { @@ -123,7 +131,6 @@ STATIC mp_obj_t is31fl3741_FrameBuffer_make_new(const mp_obj_type_t *type, size_ //| IS31FL3741 instance. After deinitialization, no further operations //| may be performed.""" //| ... -//| STATIC mp_obj_t is31fl3741_FrameBuffer_deinit(mp_obj_t self_in) { is31fl3741_FrameBuffer_obj_t *self = (is31fl3741_FrameBuffer_obj_t *)self_in; common_hal_is31fl3741_FrameBuffer_deinit(self); @@ -140,7 +147,6 @@ static void check_for_deinit(is31fl3741_FrameBuffer_obj_t *self) { //| brightness: float //| """In the current implementation, 0.0 turns the display off entirely //| and any other value up to 1.0 turns the display on fully.""" -//| STATIC mp_obj_t is31fl3741_FrameBuffer_get_brightness(mp_obj_t self_in) { is31fl3741_FrameBuffer_obj_t *self = (is31fl3741_FrameBuffer_obj_t *)self_in; check_for_deinit(self); @@ -174,7 +180,6 @@ MP_PROPERTY_GETSET(is31fl3741_FrameBuffer_brightness_obj, //| """Transmits the color data in the buffer to the pixels so that //| they are shown.""" //| ... -//| STATIC mp_obj_t is31fl3741_FrameBuffer_refresh(mp_obj_t self_in) { is31fl3741_FrameBuffer_obj_t *self = (is31fl3741_FrameBuffer_obj_t *)self_in; check_for_deinit(self); @@ -185,7 +190,6 @@ MP_DEFINE_CONST_FUN_OBJ_1(is31fl3741_FrameBuffer_refresh_obj, is31fl3741_FrameBu //| width: int //| """The width of the display, in pixels""" -//| STATIC mp_obj_t is31fl3741_FrameBuffer_get_width(mp_obj_t self_in) { is31fl3741_FrameBuffer_obj_t *self = (is31fl3741_FrameBuffer_obj_t *)self_in; check_for_deinit(self); diff --git a/shared-bindings/is31fl3741/IS31FL3741.c b/shared-bindings/is31fl3741/IS31FL3741.c index 46a7f8ac86..706e3deb2b 100644 --- a/shared-bindings/is31fl3741/IS31FL3741.c +++ b/shared-bindings/is31fl3741/IS31FL3741.c @@ -46,7 +46,6 @@ //| :param ~busio.I2C i2c: I2C bus the IS31FL3741 is on //| :param int addr: device address""" //| ... -//| STATIC mp_obj_t is31fl3741_IS31FL3741_make_new(const mp_obj_type_t *type, size_t n_args, size_t n_kw, const mp_obj_t *all_args) { enum { ARG_i2c, ARG_addr }; static const mp_arg_t allowed_args[] = { @@ -144,6 +143,7 @@ MP_DEFINE_CONST_FUN_OBJ_VAR_BETWEEN(is31fl3741_IS31FL3741_set_led_obj, 4, 4, is3 //| :param ~Tuple[int, ...] mapping: map the pixels in the buffer to the order addressed by the driver chip //| :param ~_typing.ReadableBuffer buf: The bytes to clock out. No assumption is made about color order""" //| ... +//| STATIC mp_obj_t is31fl3741_IS31FL3741_write(mp_obj_t self_in, mp_obj_t mapping, mp_obj_t buffer) { is31fl3741_IS31FL3741_obj_t *self = MP_OBJ_TO_PTR(self_in); if (!mp_obj_is_tuple_compatible(mapping)) { diff --git a/shared-bindings/is31fl3741/IS31FL3741.h b/shared-bindings/is31fl3741/IS31FL3741.h index 2b81b01617..62302a3ac2 100644 --- a/shared-bindings/is31fl3741/IS31FL3741.h +++ b/shared-bindings/is31fl3741/IS31FL3741.h @@ -46,4 +46,4 @@ void common_hal_is31fl3741_send_reset(is31fl3741_IS31FL3741_obj_t *self); void common_hal_is31fl3741_set_current(is31fl3741_IS31FL3741_obj_t *self, uint8_t current); uint8_t common_hal_is31fl3741_get_current(is31fl3741_IS31FL3741_obj_t *self); void common_hal_is31fl3741_set_led(is31fl3741_IS31FL3741_obj_t *self, uint16_t led, uint8_t level, uint8_t page); -void common_hal_is31fl3741_draw_pixel(is31fl3741_IS31FL3741_obj_t *self, int16_t x, int16_t y, uint32_t color, uint16_t *mapping); +void common_hal_is31fl3741_draw_pixel(is31fl3741_IS31FL3741_obj_t *self, int16_t x, int16_t y, uint32_t color, uint16_t *mapping, uint8_t display_height); diff --git a/shared-bindings/keypad/Event.c b/shared-bindings/keypad/Event.c index 380b6b5b41..56a5815636 100644 --- a/shared-bindings/keypad/Event.c +++ b/shared-bindings/keypad/Event.c @@ -33,7 +33,10 @@ //| class Event: //| """A key transition event.""" -//| def __init__(self, key_number: int=0, pressed: bool=True, timestamp:Optional[int]=None) -> None: +//| +//| def __init__( +//| self, key_number: int = 0, pressed: bool = True, timestamp: Optional[int] = None +//| ) -> None: //| """Create a key transition event, which reports a key-pressed or key-released transition. //| //| :param int key_number: The key number. @@ -41,7 +44,6 @@ //| :param int timestamp: The time in milliseconds that the keypress occurred in the `supervisor.ticks_ms` time system. If specified as None, the current value of `supervisor.ticks_ms` is used. //| """ //| ... -//| STATIC mp_obj_t keypad_event_make_new(const mp_obj_type_t *type, size_t n_args, size_t n_kw, const mp_obj_t *all_args) { keypad_event_obj_t *self = m_new_obj(keypad_event_obj_t); self->base.type = &keypad_event_type; @@ -69,7 +71,6 @@ STATIC mp_obj_t keypad_event_make_new(const mp_obj_type_t *type, size_t n_args, //| key_number: int //| """The key number.""" -//| STATIC mp_obj_t keypad_event_get_key_number(mp_obj_t self_in) { keypad_event_obj_t *self = MP_OBJ_TO_PTR(self_in); return MP_OBJ_NEW_SMALL_INT(common_hal_keypad_event_get_key_number(self)); @@ -83,7 +84,6 @@ MP_PROPERTY_GETTER(keypad_event_key_number_obj, //| """``True`` if the event represents a key down (pressed) transition. //| The opposite of `released`. //| """ -//| STATIC mp_obj_t keypad_event_get_pressed(mp_obj_t self_in) { keypad_event_obj_t *self = MP_OBJ_TO_PTR(self_in); return mp_obj_new_bool(common_hal_keypad_event_get_pressed(self)); @@ -97,7 +97,6 @@ MP_PROPERTY_GETTER(keypad_event_pressed_obj, //| """``True`` if the event represents a key up (released) transition. //| The opposite of `pressed`. //| """ -//| STATIC mp_obj_t keypad_event_get_released(mp_obj_t self_in) { keypad_event_obj_t *self = MP_OBJ_TO_PTR(self_in); return mp_obj_new_bool(common_hal_keypad_event_get_released(self)); @@ -109,7 +108,6 @@ MP_PROPERTY_GETTER(keypad_event_released_obj, //| timestamp: int //| """The timestamp.""" -//| STATIC mp_obj_t keypad_event_get_timestamp(mp_obj_t self_in) { keypad_event_obj_t *self = MP_OBJ_TO_PTR(self_in); return common_hal_keypad_event_get_timestamp(self); @@ -126,7 +124,6 @@ MP_PROPERTY_GETTER(keypad_event_timestamp_obj, //| Note that this does not compare the event timestamps. //| """ //| ... -//| STATIC mp_obj_t keypad_event_binary_op(mp_binary_op_t op, mp_obj_t lhs_in, mp_obj_t rhs_in) { switch (op) { case MP_BINARY_OP_EQUAL: diff --git a/shared-bindings/keypad/EventQueue.c b/shared-bindings/keypad/EventQueue.c index 8e45f7ad1d..615c051188 100644 --- a/shared-bindings/keypad/EventQueue.c +++ b/shared-bindings/keypad/EventQueue.c @@ -24,8 +24,11 @@ * THE SOFTWARE. */ +#include "py/ioctl.h" +#include "py/mperrno.h" #include "py/objproperty.h" #include "py/runtime.h" +#include "py/stream.h" #include "shared-bindings/keypad/Event.h" #include "shared-bindings/keypad/EventQueue.h" @@ -35,6 +38,7 @@ //| You cannot create an instance of `EventQueue` directly. Each scanner creates an //| instance when it is created. //| """ +//| //| ... //| def get(self) -> Optional[Event]: @@ -49,7 +53,6 @@ //| :rtype: Optional[Event] //| """ //| ... -//| STATIC mp_obj_t keypad_eventqueue_get(mp_obj_t self_in) { keypad_eventqueue_obj_t *self = MP_OBJ_TO_PTR(self_in); @@ -72,7 +75,6 @@ MP_DEFINE_CONST_FUN_OBJ_1(keypad_eventqueue_get_obj, keypad_eventqueue_get); //| :rtype: bool //| """ //| ... -//| STATIC mp_obj_t keypad_eventqueue_get_into(mp_obj_t self_in, mp_obj_t event_in) { keypad_eventqueue_obj_t *self = MP_OBJ_TO_PTR(self_in); @@ -83,10 +85,8 @@ STATIC mp_obj_t keypad_eventqueue_get_into(mp_obj_t self_in, mp_obj_t event_in) MP_DEFINE_CONST_FUN_OBJ_2(keypad_eventqueue_get_into_obj, keypad_eventqueue_get_into); //| def clear(self) -> None: -//| """Clear any queued key transition events. Also sets `overflowed` to ``False``. -//| """ +//| """Clear any queued key transition events. Also sets `overflowed` to ``False``.""" //| ... -//| STATIC mp_obj_t keypad_eventqueue_clear(mp_obj_t self_in) { keypad_eventqueue_obj_t *self = MP_OBJ_TO_PTR(self_in); @@ -100,11 +100,9 @@ MP_DEFINE_CONST_FUN_OBJ_1(keypad_eventqueue_clear_obj, keypad_eventqueue_clear); //| This is an easy way to check if the queue is empty. //| """ //| ... -//| //| def __len__(self) -> int: //| """Return the number of events currently in the queue. Used to implement ``len()``.""" //| ... -//| STATIC mp_obj_t keypad_eventqueue_unary_op(mp_unary_op_t op, mp_obj_t self_in) { keypad_eventqueue_obj_t *self = MP_OBJ_TO_PTR(self_in); uint16_t len = common_hal_keypad_eventqueue_get_length(self); @@ -141,12 +139,41 @@ STATIC const mp_rom_map_elem_t keypad_eventqueue_locals_dict_table[] = { STATIC MP_DEFINE_CONST_DICT(keypad_eventqueue_locals_dict, keypad_eventqueue_locals_dict_table); +#if MICROPY_PY_USELECT +STATIC mp_uint_t eventqueue_ioctl(mp_obj_t self_in, mp_uint_t request, uintptr_t arg, int *errcode) { + (void)errcode; + keypad_eventqueue_obj_t *self = MP_OBJ_TO_PTR(self_in); + switch (request) { + case MP_STREAM_POLL: { + mp_uint_t flags = arg; + mp_uint_t ret = 0; + if ((flags & MP_IOCTL_POLL_RD) && common_hal_keypad_eventqueue_get_length(self)) { + ret |= MP_IOCTL_POLL_RD; + } + return ret; + } + default: + *errcode = MP_EINVAL; + return MP_STREAM_ERROR; + } +} + +STATIC const mp_stream_p_t eventqueue_p = { + MP_PROTO_IMPLEMENT(MP_QSTR_protocol_stream) + .ioctl = eventqueue_ioctl, +}; +#endif + + const mp_obj_type_t keypad_eventqueue_type = { { &mp_type_type }, .flags = MP_TYPE_FLAG_EXTENDED, .name = MP_QSTR_EventQueue, MP_TYPE_EXTENDED_FIELDS( .unary_op = keypad_eventqueue_unary_op, + #if MICROPY_PY_USELECT + .protocol = &eventqueue_p, + #endif ), .locals_dict = (mp_obj_t)&keypad_eventqueue_locals_dict, }; diff --git a/shared-bindings/keypad/KeyMatrix.c b/shared-bindings/keypad/KeyMatrix.c index 9e65471a2b..28a68602ab 100644 --- a/shared-bindings/keypad/KeyMatrix.c +++ b/shared-bindings/keypad/KeyMatrix.c @@ -37,7 +37,14 @@ //| class KeyMatrix: //| """Manage a 2D matrix of keys with row and column pins.""" //| -//| def __init__(self, row_pins: Sequence[microcontroller.Pin], column_pins: Sequence[microcontroller.Pin], columns_to_anodes: bool = True, interval: float = 0.020, max_events: int = 64) -> None: +//| def __init__( +//| self, +//| row_pins: Sequence[microcontroller.Pin], +//| column_pins: Sequence[microcontroller.Pin], +//| columns_to_anodes: bool = True, +//| interval: float = 0.020, +//| max_events: int = 64, +//| ) -> None: //| """ //| Create a `Keys` object that will scan the key matrix attached to the given row and column pins. //| There should not be any external pull-ups or pull-downs on the matrix: @@ -112,7 +119,6 @@ STATIC mp_obj_t keypad_keymatrix_make_new(const mp_obj_type_t *type, size_t n_ar //| def deinit(self) -> None: //| """Stop scanning and release the pins.""" //| ... -//| STATIC mp_obj_t keypad_keymatrix_deinit(mp_obj_t self_in) { keypad_keymatrix_obj_t *self = MP_OBJ_TO_PTR(self_in); common_hal_keypad_keymatrix_deinit(self); @@ -123,14 +129,12 @@ MP_DEFINE_CONST_FUN_OBJ_1(keypad_keymatrix_deinit_obj, keypad_keymatrix_deinit); //| def __enter__(self) -> KeyMatrix: //| """No-op used by Context Managers.""" //| ... -//| // Provided by context manager helper. //| def __exit__(self) -> None: //| """Automatically deinitializes when exiting a context. See //| :ref:`lifetime-and-contextmanagers` for more info.""" //| ... -//| STATIC mp_obj_t keypad_keymatrix___exit__(size_t n_args, const mp_obj_t *args) { (void)n_args; common_hal_keypad_keymatrix_deinit(args[0]); @@ -150,12 +154,10 @@ STATIC void check_for_deinit(keypad_keymatrix_obj_t *self) { //| a new key-pressed event to occur. //| """ //| ... -//| //| key_count: int //| """The number of keys that are being scanned. (read-only) //| """ -//| //| def key_number_to_row_column(self, key_number: int) -> Tuple[int]: //| """Return the row and column for the given key number. @@ -166,7 +168,6 @@ STATIC void check_for_deinit(keypad_keymatrix_obj_t *self) { //| :rtype: Tuple[int] //| """ //| ... -//| STATIC mp_obj_t keypad_keymatrix_key_number_to_row_column(mp_obj_t self_in, mp_obj_t key_number_in) { keypad_keymatrix_obj_t *self = MP_OBJ_TO_PTR(self_in); check_for_deinit(self); @@ -193,7 +194,6 @@ MP_DEFINE_CONST_FUN_OBJ_2(keypad_keymatrix_key_number_to_row_column_obj, keypad_ //| The key number is ``row * len(column_pins) + column``. //| """ //| ... -//| STATIC mp_obj_t keypad_keymatrix_row_column_to_key_number(mp_obj_t self_in, mp_obj_t row_in, mp_obj_t column_in) { keypad_keymatrix_obj_t *self = MP_OBJ_TO_PTR(self_in); check_for_deinit(self); diff --git a/shared-bindings/keypad/Keys.c b/shared-bindings/keypad/Keys.c index 6ac705eba6..3a9eb84cf3 100644 --- a/shared-bindings/keypad/Keys.c +++ b/shared-bindings/keypad/Keys.c @@ -37,7 +37,15 @@ //| class Keys: //| """Manage a set of independent keys.""" //| -//| def __init__(self, pins: Sequence[microcontroller.Pin], *, value_when_pressed: bool, pull: bool = True, interval: float = 0.020, max_events: int = 64) -> None: +//| def __init__( +//| self, +//| pins: Sequence[microcontroller.Pin], +//| *, +//| value_when_pressed: bool, +//| pull: bool = True, +//| interval: float = 0.020, +//| max_events: int = 64 +//| ) -> None: //| """ //| Create a `Keys` object that will scan keys attached to the given sequence of pins. //| Each key is independent and attached to its own pin. @@ -103,7 +111,6 @@ STATIC mp_obj_t keypad_keys_make_new(const mp_obj_type_t *type, size_t n_args, s //| def deinit(self) -> None: //| """Stop scanning and release the pins.""" //| ... -//| STATIC mp_obj_t keypad_keys_deinit(mp_obj_t self_in) { keypad_keys_obj_t *self = MP_OBJ_TO_PTR(self_in); @@ -115,14 +122,12 @@ MP_DEFINE_CONST_FUN_OBJ_1(keypad_keys_deinit_obj, keypad_keys_deinit); //| def __enter__(self) -> Keys: //| """No-op used by Context Managers.""" //| ... -//| // Provided by context manager helper. //| def __exit__(self) -> None: //| """Automatically deinitializes when exiting a context. See //| :ref:`lifetime-and-contextmanagers` for more info.""" //| ... -//| STATIC mp_obj_t keypad_keys___exit__(size_t n_args, const mp_obj_t *args) { (void)n_args; common_hal_keypad_keys_deinit(args[0]); @@ -137,12 +142,10 @@ STATIC MP_DEFINE_CONST_FUN_OBJ_VAR_BETWEEN(keypad_keys___exit___obj, 4, 4, keypa //| a new key-pressed event to occur. //| """ //| ... -//| //| key_count: int //| """The number of keys that are being scanned. (read-only) //| """ -//| //| events: EventQueue //| """The `EventQueue` associated with this `Keys` object. (read-only) diff --git a/shared-bindings/keypad/ShiftRegisterKeys.c b/shared-bindings/keypad/ShiftRegisterKeys.c index 14ab87436b..0703a78b66 100644 --- a/shared-bindings/keypad/ShiftRegisterKeys.c +++ b/shared-bindings/keypad/ShiftRegisterKeys.c @@ -37,7 +37,18 @@ //| class ShiftRegisterKeys: //| """Manage a set of keys attached to an incoming shift register.""" //| -//| def __init__(self, *, clock: microcontroller.Pin, data: microcontroller.Pin, latch: microcontroller.Pin, value_to_latch: bool = True, key_count: int, value_when_pressed: bool, interval: float = 0.020, max_events: int = 64) -> None: +//| def __init__( +//| self, +//| *, +//| clock: microcontroller.Pin, +//| data: microcontroller.Pin, +//| latch: microcontroller.Pin, +//| value_to_latch: bool = True, +//| key_count: int, +//| value_when_pressed: bool, +//| interval: float = 0.020, +//| max_events: int = 64 +//| ) -> None: //| """ //| Create a `Keys` object that will scan keys attached to a parallel-in serial-out shift register //| like the 74HC165 or CD4021. @@ -107,7 +118,6 @@ STATIC mp_obj_t keypad_shiftregisterkeys_make_new(const mp_obj_type_t *type, siz //| def deinit(self) -> None: //| """Stop scanning and release the pins.""" //| ... -//| STATIC mp_obj_t keypad_shiftregisterkeys_deinit(mp_obj_t self_in) { keypad_shiftregisterkeys_obj_t *self = MP_OBJ_TO_PTR(self_in); @@ -119,14 +129,12 @@ MP_DEFINE_CONST_FUN_OBJ_1(keypad_shiftregisterkeys_deinit_obj, keypad_shiftregis //| def __enter__(self) -> Keys: //| """No-op used by Context Managers.""" //| ... -//| // Provided by context manager helper. //| def __exit__(self) -> None: //| """Automatically deinitializes when exiting a context. See //| :ref:`lifetime-and-contextmanagers` for more info.""" //| ... -//| STATIC mp_obj_t keypad_shiftregisterkeys___exit__(size_t n_args, const mp_obj_t *args) { (void)n_args; common_hal_keypad_shiftregisterkeys_deinit(args[0]); @@ -140,12 +148,10 @@ STATIC MP_DEFINE_CONST_FUN_OBJ_VAR_BETWEEN(keypad_shiftregisterkeys___exit___obj //| a new key-pressed event to occur. //| """ //| ... -//| //| key_count: int //| """The number of keys that are being scanned. (read-only) //| """ -//| //| events: EventQueue //| """The `EventQueue` associated with this `Keys` object. (read-only) diff --git a/shared-bindings/keypad/__init__.c b/shared-bindings/keypad/__init__.c index 97db750af7..7dd76c1947 100644 --- a/shared-bindings/keypad/__init__.c +++ b/shared-bindings/keypad/__init__.c @@ -86,8 +86,10 @@ const mp_obj_property_t keypad_generic_events_obj = { //| connected independently to individual pins, //| connected to a shift register, //| or connected in a row-and-column matrix. -//| """ //| +//| For more information about working with the `keypad` module in CircuitPython, +//| see `this Learn guide `_. +//| """ STATIC mp_rom_map_elem_t keypad_module_globals_table[] = { { MP_ROM_QSTR(MP_QSTR___name__), MP_OBJ_NEW_QSTR(MP_QSTR_keypad) }, diff --git a/shared-bindings/math/__init__.c b/shared-bindings/math/__init__.c index 54dbf004ad..58405564db 100644 --- a/shared-bindings/math/__init__.c +++ b/shared-bindings/math/__init__.c @@ -27,7 +27,7 @@ #include "py/builtin.h" #include "py/runtime.h" -#include "supervisor/shared/translate.h" +#include "supervisor/shared/translate/translate.h" #if MICROPY_PY_BUILTINS_FLOAT @@ -45,7 +45,6 @@ //| //| |see_cpython_module| :mod:`cpython:math`. //| """ -//| STATIC NORETURN void math_error(void) { mp_raise_ValueError(translate("math domain error")); @@ -87,7 +86,6 @@ STATIC NORETURN void math_error(void) { //| //| pi: float //| """the ratio of a circle's circumference to its diameter""" -//| //| def acos(x: float) -> float: //| """Return the inverse cosine of ``x``.""" diff --git a/shared-bindings/mdns/RemoteService.c b/shared-bindings/mdns/RemoteService.c index 846207b69b..c1d7b25783 100644 --- a/shared-bindings/mdns/RemoteService.c +++ b/shared-bindings/mdns/RemoteService.c @@ -40,11 +40,9 @@ //| def __init__(self) -> None: //| """Cannot be instantiated directly. Use `mdns.Server.find`.""" //| ... -//| //| hostname: str //| """The hostname of the device (read-only),.""" -//| STATIC mp_obj_t mdns_remoteservice_get_hostname(mp_obj_t self_in) { mdns_remoteservice_obj_t *self = MP_OBJ_TO_PTR(self_in); const char *hostname = common_hal_mdns_remoteservice_get_hostname(self); @@ -57,7 +55,6 @@ MP_PROPERTY_GETTER(mdns_remoteservice_hostname_obj, //| instance_name: str //| """The human readable instance name for the service. (read-only)""" -//| STATIC mp_obj_t remoteservice_get_instance_name(mp_obj_t self_in) { mdns_remoteservice_obj_t *self = MP_OBJ_TO_PTR(self_in); const char *instance_name = common_hal_mdns_remoteservice_get_instance_name(self); @@ -70,7 +67,6 @@ MP_PROPERTY_GETTER(mdns_remoteservice_instance_name_obj, //| service_type: str //| """The service type string such as ``_http``. (read-only)""" -//| STATIC mp_obj_t remoteservice_get_service_type(mp_obj_t self_in) { mdns_remoteservice_obj_t *self = MP_OBJ_TO_PTR(self_in); const char *service_type = common_hal_mdns_remoteservice_get_service_type(self); @@ -83,7 +79,6 @@ MP_PROPERTY_GETTER(mdns_remoteservice_service_type_obj, //| protocol: str //| """The protocol string such as ``_tcp``. (read-only)""" -//| STATIC mp_obj_t remoteservice_get_protocol(mp_obj_t self_in) { mdns_remoteservice_obj_t *self = MP_OBJ_TO_PTR(self_in); const char *protocol = common_hal_mdns_remoteservice_get_protocol(self); @@ -96,7 +91,6 @@ MP_PROPERTY_GETTER(mdns_remoteservice_protocol_obj, //| port: int //| """Port number used for the service. (read-only)""" -//| STATIC mp_obj_t remoteservice_get_port(mp_obj_t self_in) { mdns_remoteservice_obj_t *self = MP_OBJ_TO_PTR(self_in); return MP_OBJ_NEW_SMALL_INT(common_hal_mdns_remoteservice_get_port(self)); @@ -106,6 +100,17 @@ STATIC MP_DEFINE_CONST_FUN_OBJ_1(mdns_remoteservice_get_port_obj, remoteservice_ MP_PROPERTY_GETTER(mdns_remoteservice_port_obj, (mp_obj_t)&mdns_remoteservice_get_port_obj); +//| ipv4_address: Optional[ipaddress.IPv4Address] +//| """IP v4 Address of the remote service. None if no A records are found.""" +STATIC mp_obj_t _mdns_remoteservice_get_ipv4_address(mp_obj_t self) { + return common_hal_mdns_remoteservice_get_ipv4_address(self); + +} +MP_DEFINE_CONST_FUN_OBJ_1(mdns_remoteservice_get_ipv4_address_obj, _mdns_remoteservice_get_ipv4_address); + +MP_PROPERTY_GETTER(mdns_remoteservice_ipv4_address_obj, + (mp_obj_t)&mdns_remoteservice_get_ipv4_address_obj); + //| def __del__(self) -> None: //| """Deletes the RemoteService object.""" //| ... @@ -123,6 +128,7 @@ STATIC const mp_rom_map_elem_t mdns_remoteservice_locals_dict_table[] = { { MP_ROM_QSTR(MP_QSTR_service_type), MP_ROM_PTR(&mdns_remoteservice_service_type_obj) }, { MP_ROM_QSTR(MP_QSTR_protocol), MP_ROM_PTR(&mdns_remoteservice_protocol_obj) }, { MP_ROM_QSTR(MP_QSTR_port), MP_ROM_PTR(&mdns_remoteservice_port_obj) }, + { MP_ROM_QSTR(MP_QSTR_ipv4_address), MP_ROM_PTR(&mdns_remoteservice_ipv4_address_obj) }, { MP_ROM_QSTR(MP_QSTR___del__), MP_ROM_PTR(&mdns_remoteservice_deinit_obj) }, }; diff --git a/shared-bindings/mdns/RemoteService.h b/shared-bindings/mdns/RemoteService.h index f751b683ed..4783170e88 100644 --- a/shared-bindings/mdns/RemoteService.h +++ b/shared-bindings/mdns/RemoteService.h @@ -38,4 +38,8 @@ const char *common_hal_mdns_remoteservice_get_protocol(mdns_remoteservice_obj_t const char *common_hal_mdns_remoteservice_get_instance_name(mdns_remoteservice_obj_t *self); const char *common_hal_mdns_remoteservice_get_hostname(mdns_remoteservice_obj_t *self); mp_int_t common_hal_mdns_remoteservice_get_port(mdns_remoteservice_obj_t *self); +mp_obj_t common_hal_mdns_remoteservice_get_ipv4_address(mdns_remoteservice_obj_t *self); void common_hal_mdns_remoteservice_deinit(mdns_remoteservice_obj_t *self); + +// For internal use. +uint32_t mdns_remoteservice_get_ipv4_address(mdns_remoteservice_obj_t *self); diff --git a/shared-bindings/mdns/Server.c b/shared-bindings/mdns/Server.c index b5e6c11216..aab7f7e350 100644 --- a/shared-bindings/mdns/Server.c +++ b/shared-bindings/mdns/Server.c @@ -35,7 +35,7 @@ //| class Server: //| """The MDNS Server responds to queries for this device's information and allows for querying -//| other devices.""" +//| other devices.""" //| //| def __init__(self, network_interface: wifi.Radio) -> None: @@ -44,7 +44,6 @@ //| may already be using it.) Only native interfaces are currently supported. //| """ //| ... -//| STATIC mp_obj_t mdns_server_make_new(const mp_obj_type_t *type, size_t n_args, size_t n_kw, const mp_obj_t *all_args) { enum { ARG_network_interface }; static const mp_arg_t allowed_args[] = { @@ -64,7 +63,6 @@ STATIC mp_obj_t mdns_server_make_new(const mp_obj_type_t *type, size_t n_args, s //| def deinit(self) -> None: //| """Stops the server""" //| ... -//| STATIC mp_obj_t mdns_server_obj_deinit(mp_obj_t self_in) { mdns_server_obj_t *self = (mdns_server_obj_t *)self_in; common_hal_mdns_server_deinit(self); @@ -78,12 +76,10 @@ STATIC void check_for_deinit(mdns_server_obj_t *self) { } } -//| //| hostname: str //| """Hostname resolvable as ``.local`` in addition to ``circuitpython.local``. Make //| sure this is unique across all devices on the network. It defaults to ``cpy-######`` //| where ``######`` is the hex digits of the last three bytes of the mac address.""" -//| STATIC mp_obj_t mdns_server_get_hostname(mp_obj_t self) { check_for_deinit(self); const char *hostname = common_hal_mdns_server_get_hostname(self); @@ -105,7 +101,6 @@ MP_PROPERTY_GETSET(mdns_server_hostname_obj, //| instance_name: str //| """Human readable name to describe the device.""" -//| STATIC mp_obj_t mdns_server_get_instance_name(mp_obj_t self) { check_for_deinit(self); const char *instance_name = common_hal_mdns_server_get_instance_name(self); @@ -125,7 +120,9 @@ MP_PROPERTY_GETSET(mdns_server_instance_name_obj, (mp_obj_t)&mdns_server_set_instance_name_obj); -//| def find(self, service_type: str, protocol: str, *, timeout: float = 1) -> Tuple[RemoteService]: +//| def find( +//| self, service_type: str, protocol: str, *, timeout: float = 1 +//| ) -> Tuple[RemoteService]: //| """Find all locally available remote services with the given service type and protocol. //| //| This doesn't allow for direct hostname lookup. To do that, use @@ -135,8 +132,7 @@ MP_PROPERTY_GETSET(mdns_server_instance_name_obj, //| :param str protocol: The service protocol such as "_tcp" //| :param float/int timeout: Time to wait for responses""" //| ... -//| -STATIC mp_obj_t mdns_server_find(mp_uint_t n_args, const mp_obj_t *pos_args, mp_map_t *kw_args) { +STATIC mp_obj_t _mdns_server_find(mp_uint_t n_args, const mp_obj_t *pos_args, mp_map_t *kw_args) { mdns_server_obj_t *self = MP_OBJ_TO_PTR(pos_args[0]); check_for_deinit(self); @@ -156,11 +152,14 @@ STATIC mp_obj_t mdns_server_find(mp_uint_t n_args, const mp_obj_t *pos_args, mp_ return common_hal_mdns_server_find(self, service_type, protocol, timeout); } -STATIC MP_DEFINE_CONST_FUN_OBJ_KW(mdns_server_find_obj, 1, mdns_server_find); +STATIC MP_DEFINE_CONST_FUN_OBJ_KW(mdns_server_find_obj, 1, _mdns_server_find); -//| def advertise_service(self, *, service_type: str, protocol: str, port: int) -> None: +//| def advertise_service(self, *, service_type: str, protocol: str, port: int) -> None: //| """Respond to queries for the given service with the given port. //| +//| ``service_type`` and ``protocol`` can only occur on one port. Any call after the first +//| will update the entry's port. +//| //| :param str service_type: The service type such as "_http" //| :param str protocol: The service protocol such as "_tcp" //| :param int port: The port used by the service""" diff --git a/shared-bindings/mdns/Server.h b/shared-bindings/mdns/Server.h index a178e9bd2d..351ab664b2 100644 --- a/shared-bindings/mdns/Server.h +++ b/shared-bindings/mdns/Server.h @@ -30,6 +30,8 @@ #include "common-hal/mdns/Server.h" +#include "shared-bindings/mdns/RemoteService.h" + extern const mp_obj_type_t mdns_server_type; void common_hal_mdns_server_construct(mdns_server_obj_t *self, mp_obj_t network_interface); @@ -41,3 +43,8 @@ const char *common_hal_mdns_server_get_instance_name(mdns_server_obj_t *self); void common_hal_mdns_server_set_instance_name(mdns_server_obj_t *self, const char *instance_name); mp_obj_t common_hal_mdns_server_find(mdns_server_obj_t *self, const char *service_type, const char *protocol, mp_float_t timeout); void common_hal_mdns_server_advertise_service(mdns_server_obj_t *self, const char *service_type, const char *protocol, mp_int_t port); + +// For internal use. +void mdns_server_construct(mdns_server_obj_t *self, bool workflow); +size_t mdns_server_find(mdns_server_obj_t *self, const char *service_type, const char *protocol, + mp_float_t timeout, mdns_remoteservice_obj_t *out, size_t out_len); diff --git a/shared-bindings/mdns/__init__.c b/shared-bindings/mdns/__init__.c index 9752a3b7ff..73bd71c65c 100644 --- a/shared-bindings/mdns/__init__.c +++ b/shared-bindings/mdns/__init__.c @@ -38,7 +38,6 @@ //| Basic use provides hostname resolution under the .local TLD. This module //| also supports DNS Service Discovery that allows for discovering other hosts //| that provide a desired service.""" -//| STATIC const mp_rom_map_elem_t mdns_module_globals_table[] = { { MP_ROM_QSTR(MP_QSTR___name__), MP_ROM_QSTR(MP_QSTR_mdns) }, diff --git a/shared-bindings/memorymonitor/AllocationAlarm.c b/shared-bindings/memorymonitor/AllocationAlarm.c index b54645225a..e279fa6854 100644 --- a/shared-bindings/memorymonitor/AllocationAlarm.c +++ b/shared-bindings/memorymonitor/AllocationAlarm.c @@ -31,10 +31,9 @@ #include "py/runtime0.h" #include "shared-bindings/memorymonitor/AllocationAlarm.h" #include "shared-bindings/util.h" -#include "supervisor/shared/translate.h" +#include "supervisor/shared/translate/translate.h" //| class AllocationAlarm: -//| //| def __init__(self, *, minimum_block_count: int = 1) -> None: //| """Throw an exception when an allocation of ``minimum_block_count`` or more blocks //| occurs while active. @@ -55,7 +54,6 @@ //| //| """ //| ... -//| STATIC mp_obj_t memorymonitor_allocationalarm_make_new(const mp_obj_type_t *type, size_t n_args, const mp_obj_t *all_args, mp_map_t *kw_args) { enum { ARG_minimum_block_count }; static const mp_arg_t allowed_args[] = { @@ -63,10 +61,10 @@ STATIC mp_obj_t memorymonitor_allocationalarm_make_new(const mp_obj_type_t *type }; mp_arg_val_t args[MP_ARRAY_SIZE(allowed_args)]; mp_arg_parse_all_kw_array(n_args, n_kw, all_args, MP_ARRAY_SIZE(allowed_args), allowed_args, args); - mp_int_t minimum_block_count = args[ARG_minimum_block_count].u_int; - if (minimum_block_count < 1) { - mp_raise_ValueError_varg(translate("%q must be >= 1"), MP_QSTR_minimum_block_count); - } + + mp_int_t minimum_block_count = + mp_arg_validate_int_min(args[ARG_minimum_block_count].u_int, 1, MP_QSTR_minimum_block_count); + memorymonitor_allocationalarm_obj_t *self = m_new_obj(memorymonitor_allocationalarm_obj_t); self->base.type = &memorymonitor_allocationalarm_type; @@ -78,21 +76,19 @@ STATIC mp_obj_t memorymonitor_allocationalarm_make_new(const mp_obj_type_t *type //| def ignore(self, count: int) -> AllocationAlarm: //| """Sets the number of applicable allocations to ignore before raising the exception. -//| Automatically set back to zero at context exit. +//| Automatically set back to zero at context exit. //| -//| Use it within a ``with`` block:: +//| Use it within a ``with`` block:: //| -//| # Will not alarm because the bytearray allocation will be ignored. -//| with aa.ignore(2): -//| x = bytearray(20) -//| """ +//| # Will not alarm because the bytearray allocation will be ignored. +//| with aa.ignore(2): +//| x = bytearray(20) +//| """ //| ... -//| STATIC mp_obj_t memorymonitor_allocationalarm_obj_ignore(mp_obj_t self_in, mp_obj_t count_obj) { mp_int_t count = mp_obj_get_int(count_obj); - if (count < 0) { - mp_raise_ValueError_varg(translate("%q must be >= 0"), MP_QSTR_count); - } + mp_arg_validate_int_min(count, 0, MP_QSTR_count); + common_hal_memorymonitor_allocationalarm_set_ignore(self_in, count); return self_in; } @@ -101,7 +97,6 @@ MP_DEFINE_CONST_FUN_OBJ_2(memorymonitor_allocationalarm_ignore_obj, memorymonito //| def __enter__(self) -> AllocationAlarm: //| """Enables the alarm.""" //| ... -//| STATIC mp_obj_t memorymonitor_allocationalarm_obj___enter__(mp_obj_t self_in) { common_hal_memorymonitor_allocationalarm_resume(self_in); return self_in; diff --git a/shared-bindings/memorymonitor/AllocationSize.c b/shared-bindings/memorymonitor/AllocationSize.c index 1c39fdcd92..dd3a1e03cf 100644 --- a/shared-bindings/memorymonitor/AllocationSize.c +++ b/shared-bindings/memorymonitor/AllocationSize.c @@ -31,10 +31,9 @@ #include "py/runtime0.h" #include "shared-bindings/memorymonitor/AllocationSize.h" #include "shared-bindings/util.h" -#include "supervisor/shared/translate.h" +#include "supervisor/shared/translate/translate.h" //| class AllocationSize: -//| //| def __init__(self) -> None: //| """Tracks the number of allocations in power of two buckets. //| @@ -62,7 +61,6 @@ //| //| """ //| ... -//| STATIC mp_obj_t memorymonitor_allocationsize_make_new(const mp_obj_type_t *type, size_t n_args, const mp_obj_t *all_args, mp_map_t *kw_args) { memorymonitor_allocationsize_obj_t *self = m_new_obj(memorymonitor_allocationsize_obj_t); self->base.type = &memorymonitor_allocationsize_type; @@ -75,7 +73,6 @@ STATIC mp_obj_t memorymonitor_allocationsize_make_new(const mp_obj_type_t *type, //| def __enter__(self) -> AllocationSize: //| """Clears counts and resumes tracking.""" //| ... -//| STATIC mp_obj_t memorymonitor_allocationsize_obj___enter__(mp_obj_t self_in) { common_hal_memorymonitor_allocationsize_clear(self_in); common_hal_memorymonitor_allocationsize_resume(self_in); @@ -87,7 +84,6 @@ MP_DEFINE_CONST_FUN_OBJ_1(memorymonitor_allocationsize___enter___obj, memorymoni //| """Automatically pauses allocation tracking when exiting a context. See //| :ref:`lifetime-and-contextmanagers` for more info.""" //| ... -//| STATIC mp_obj_t memorymonitor_allocationsize_obj___exit__(size_t n_args, const mp_obj_t *args) { (void)n_args; common_hal_memorymonitor_allocationsize_pause(args[0]); @@ -97,7 +93,6 @@ STATIC MP_DEFINE_CONST_FUN_OBJ_VAR_BETWEEN(memorymonitor_allocationsize___exit__ //| bytes_per_block: int //| """Number of bytes per block""" -//| STATIC mp_obj_t memorymonitor_allocationsize_obj_get_bytes_per_block(mp_obj_t self_in) { memorymonitor_allocationsize_obj_t *self = MP_OBJ_TO_PTR(self_in); @@ -116,7 +111,6 @@ MP_PROPERTY_GETTER(memorymonitor_allocationsize_bytes_per_block_obj, //| mm = memorymonitor.AllocationSize() //| print(len(mm))""" //| ... -//| STATIC mp_obj_t memorymonitor_allocationsize_unary_op(mp_unary_op_t op, mp_obj_t self_in) { memorymonitor_allocationsize_obj_t *self = MP_OBJ_TO_PTR(self_in); uint16_t len = common_hal_memorymonitor_allocationsize_get_len(self); diff --git a/shared-bindings/memorymonitor/__init__.c b/shared-bindings/memorymonitor/__init__.c index 64a3a6a77f..12c91cd150 100644 --- a/shared-bindings/memorymonitor/__init__.c +++ b/shared-bindings/memorymonitor/__init__.c @@ -34,11 +34,12 @@ #include "shared-bindings/memorymonitor/AllocationSize.h" //| """Memory monitoring helpers""" -//| //| class AllocationError(Exception): //| """Catchall exception for allocation related errors.""" +//| //| ... +//| MP_DEFINE_MEMORYMONITOR_EXCEPTION(AllocationError, Exception) NORETURN void mp_raise_memorymonitor_AllocationError(const compressed_string_t *fmt, ...) { diff --git a/shared-bindings/microcontroller/Pin.c b/shared-bindings/microcontroller/Pin.c index e6809d6b72..42076aa90e 100644 --- a/shared-bindings/microcontroller/Pin.c +++ b/shared-bindings/microcontroller/Pin.c @@ -31,7 +31,7 @@ #include "py/nlr.h" #include "py/obj.h" #include "py/runtime.h" -#include "supervisor/shared/translate.h" +#include "supervisor/shared/translate/translate.h" //| class Pin: //| """Identifies an IO pin on the microcontroller.""" @@ -41,7 +41,6 @@ //| hardware so they cannot be constructed on demand. Instead, use //| :mod:`board` or :mod:`microcontroller.pin` to reference the desired pin.""" //| ... -//| //| def __hash__(self) -> int: //| """Returns a hash for the Pin.""" @@ -70,7 +69,7 @@ static void get_pin_name(const mcu_pin_obj_t *self, qstr *package, qstr *module, } } -STATIC void mcu_pin_print(const mp_print_t *print, mp_obj_t self_in, mp_print_kind_t kind) { +void shared_bindings_microcontroller_pin_print(const mp_print_t *print, mp_obj_t self_in, mp_print_kind_t kind) { mcu_pin_obj_t *self = MP_OBJ_TO_PTR(self_in); qstr package = MP_QSTR_Pin; qstr module; @@ -88,7 +87,7 @@ const mp_obj_type_t mcu_pin_type = { { &mp_type_type }, .flags = MP_TYPE_FLAG_EXTENDED, .name = MP_QSTR_Pin, - .print = mcu_pin_print, + .print = shared_bindings_microcontroller_pin_print, MP_TYPE_EXTENDED_FIELDS( .unary_op = mp_generic_unary_op, ) @@ -194,3 +193,15 @@ void validate_pins(qstr what, uint8_t *pin_nos, mp_int_t max_pins, mp_obj_t seq, pin_nos[i] = common_hal_mcu_pin_number(pins[i]); } } + +NORETURN void raise_ValueError_invalid_pin(void) { + mp_arg_error_invalid(MP_QSTR_pin); +} + +NORETURN void raise_ValueError_invalid_pins(void) { + mp_arg_error_invalid(MP_QSTR_pins); +} + +NORETURN void raise_ValueError_invalid_pin_name(qstr pin_name) { + mp_raise_ValueError_varg(translate("Invalid %q pin"), pin_name); +} diff --git a/shared-bindings/microcontroller/Pin.h b/shared-bindings/microcontroller/Pin.h index a7378ea98e..b41b3c308a 100644 --- a/shared-bindings/microcontroller/Pin.h +++ b/shared-bindings/microcontroller/Pin.h @@ -41,6 +41,9 @@ void validate_no_duplicate_pins(mp_obj_t seq, qstr arg_name); void validate_no_duplicate_pins_2(mp_obj_t seq1, mp_obj_t seq2, qstr arg_name1, qstr arg_name2); void validate_list_is_free_pins(qstr what, const mcu_pin_obj_t **pins_out, mp_int_t max_pins, mp_obj_t seq, uint8_t *count_out); void validate_pins(qstr what, uint8_t *pin_nos, mp_int_t max_pins, mp_obj_t seq, uint8_t *count_out); +NORETURN void raise_ValueError_invalid_pin(void); +NORETURN void raise_ValueError_invalid_pins(void); +NORETURN void raise_ValueError_invalid_pin_name(qstr pin_name); void assert_pin_free(const mcu_pin_obj_t *pin); @@ -52,6 +55,8 @@ void common_hal_mcu_pin_claim(const mcu_pin_obj_t *pin); void common_hal_mcu_pin_claim_number(uint8_t pin_no); void common_hal_mcu_pin_reset_number(uint8_t pin_no); +void shared_bindings_microcontroller_pin_print(const mp_print_t *print, mp_obj_t self_in, mp_print_kind_t kind); + #define COMMON_HAL_MCU_NO_PIN ((uint8_t)0xff) #endif // MICROPY_INCLUDED_SHARED_BINDINGS_MICROCONTROLLER_PIN_H diff --git a/shared-bindings/microcontroller/Processor.c b/shared-bindings/microcontroller/Processor.c index ff1b52eecd..47c400aee3 100644 --- a/shared-bindings/microcontroller/Processor.c +++ b/shared-bindings/microcontroller/Processor.c @@ -38,7 +38,7 @@ #include "py/objtype.h" #include "py/objproperty.h" #include "py/runtime.h" -#include "supervisor/shared/translate.h" +#include "supervisor/shared/translate/translate.h" //| class Processor: @@ -63,11 +63,9 @@ //| """You cannot create an instance of `microcontroller.Processor`. //| Use `microcontroller.cpu` to access the sole instance available.""" //| ... -//| //| frequency: int //| """The CPU operating frequency in Hertz. (read-only)""" -//| STATIC mp_obj_t mcu_processor_set_frequency(mp_obj_t self, mp_obj_t freq) { #if CIRCUITPY_SETTABLE_PROCESSOR_FREQUENCY @@ -94,7 +92,6 @@ MP_PROPERTY_GETSET(mcu_processor_frequency_obj, //| reset_reason: microcontroller.ResetReason //| """The reason the microcontroller started up from reset state.""" -//| STATIC mp_obj_t mcu_processor_get_reset_reason(mp_obj_t self) { return cp_enum_find(&mcu_reset_reason_type, common_hal_mcu_processor_get_reset_reason()); } @@ -108,7 +105,6 @@ MP_PROPERTY_GETTER(mcu_processor_reset_reason_obj, //| """The on-chip temperature, in Celsius, as a float. (read-only) //| //| Is `None` if the temperature is not available.""" -//| STATIC mp_obj_t mcu_processor_get_temperature(mp_obj_t self) { float temperature = common_hal_mcu_processor_get_temperature(); return isnan(temperature) ? mp_const_none : mp_obj_new_float(temperature); @@ -121,7 +117,6 @@ MP_PROPERTY_GETTER(mcu_processor_temperature_obj, //| uid: bytearray //| """The unique id (aka serial number) of the chip as a `bytearray`. (read-only)""" -//| STATIC mp_obj_t mcu_processor_get_uid(mp_obj_t self) { uint8_t raw_id[COMMON_HAL_MCU_PROCESSOR_UID_LENGTH]; common_hal_mcu_processor_get_uid(raw_id); diff --git a/shared-bindings/microcontroller/RunMode.c b/shared-bindings/microcontroller/RunMode.c index 477168dda0..b29670576b 100644 --- a/shared-bindings/microcontroller/RunMode.c +++ b/shared-bindings/microcontroller/RunMode.c @@ -32,7 +32,6 @@ //| def __init__(self) -> None: //| """Enum-like class to define the run mode of the microcontroller and //| CircuitPython.""" -//| //| NORMAL: RunMode //| """Run CircuitPython as normal. //| diff --git a/shared-bindings/microcontroller/__init__.c b/shared-bindings/microcontroller/__init__.c index 707080cfbf..5716f7270e 100644 --- a/shared-bindings/microcontroller/__init__.c +++ b/shared-bindings/microcontroller/__init__.c @@ -39,7 +39,7 @@ #include "shared-bindings/microcontroller/Pin.h" #include "shared-bindings/microcontroller/Processor.h" -#include "supervisor/shared/translate.h" +#include "supervisor/shared/translate/translate.h" //| """Pin references and cpu functionality //| @@ -55,13 +55,11 @@ //| """CPU information and control, such as ``cpu.temperature`` and ``cpu.frequency`` //| (clock frequency). //| This object is an instance of `microcontroller.Processor`.""" -//| //| cpus: Processor //| """CPU information and control, such as ``cpus[0].temperature`` and ``cpus[1].frequency`` //| (clock frequency) on chips with more than 1 cpu. The index selects which cpu. //| This object is an instance of `microcontroller.Processor`.""" -//| //| def delay_us(delay: int) -> None: //| """Dedicated delay method used for very short delays. **Do not** do long delays @@ -119,7 +117,7 @@ STATIC mp_obj_t mcu_on_next_reset(mp_obj_t run_mode_obj) { } else if (run_mode_obj == MP_OBJ_FROM_PTR(&mcu_runmode_bootloader_obj)) { run_mode = RUNMODE_BOOTLOADER; } else { - mp_raise_ValueError(translate("Invalid run mode.")); + mp_arg_error_invalid(MP_QSTR_run_mode); } common_hal_mcu_on_next_reset(run_mode); return mp_const_none; @@ -147,12 +145,10 @@ STATIC MP_DEFINE_CONST_FUN_OBJ_0(mcu_reset_obj, mcu_reset); //| This object is the sole instance of `nvm.ByteArray` when available or ``None`` otherwise. //| //| :type: nvm.ByteArray or None""" -//| //| watchdog: Optional[WatchDogTimer] //| """Available watchdog timer. //| This object is the sole instance of `watchdog.WatchDogTimer` when available or ``None`` otherwise.""" -//| const mp_obj_module_t mcu_pin_module = { .base = { &mp_type_module }, diff --git a/shared-bindings/msgpack/ExtType.c b/shared-bindings/msgpack/ExtType.c index 1719e209b2..7bfe3bd8bd 100644 --- a/shared-bindings/msgpack/ExtType.c +++ b/shared-bindings/msgpack/ExtType.c @@ -31,11 +31,11 @@ //| class ExtType: //| """ExtType represents ext type in msgpack.""" +//| //| def __init__(self, code: int, data: bytes) -> None: //| """Constructor //| :param int code: type code in range 0~127. //| :param bytes data: representation.""" -//| STATIC mp_obj_t mod_msgpack_exttype_make_new(const mp_obj_type_t *type, size_t n_args, size_t n_kw, const mp_obj_t *all_args) { mod_msgpack_extype_obj_t *self = m_new_obj(mod_msgpack_extype_obj_t); self->base.type = &mod_msgpack_exttype_type; @@ -47,10 +47,8 @@ STATIC mp_obj_t mod_msgpack_exttype_make_new(const mp_obj_type_t *type, size_t n mp_arg_val_t args[MP_ARRAY_SIZE(allowed_args)]; mp_arg_parse_all_kw_array(n_args, n_kw, all_args, MP_ARRAY_SIZE(allowed_args), allowed_args, args); - int code = args[ARG_code].u_int; - if (code < 0 || code > 127) { - mp_raise_AttributeError(translate("code outside range 0~127")); - } + int code = mp_arg_validate_int_range(args[ARG_code].u_int, 0, 127, MP_QSTR_code); + self->code = code; mp_obj_t data = args[ARG_data].u_obj; @@ -62,7 +60,6 @@ STATIC mp_obj_t mod_msgpack_exttype_make_new(const mp_obj_type_t *type, size_t n //| code: int //| """The type code, in range 0~127.""" //| ... -//| STATIC mp_obj_t mod_msgpack_exttype_get_code(mp_obj_t self_in) { mod_msgpack_extype_obj_t *self = MP_OBJ_TO_PTR(self_in); return MP_OBJ_NEW_SMALL_INT(self->code); diff --git a/shared-bindings/msgpack/__init__.c b/shared-bindings/msgpack/__init__.c index 65374fb443..d505e3a6d8 100644 --- a/shared-bindings/msgpack/__init__.c +++ b/shared-bindings/msgpack/__init__.c @@ -41,6 +41,9 @@ //| //| Not implemented: 64-bit int, uint, float. //| +//| For more information about working with msgpack, +//| see `the CPython Library Documentation `_. +//| //| Example 1:: //| //| import msgpack @@ -81,9 +84,13 @@ //| print(f"{data} -> {buffer.getvalue()} -> {decoded}") //| //| """ -//| -//| def pack(obj: object, stream: circuitpython_typing.ByteStream, *, default: Union[Callable[[object], None], None] = None) -> None: +//| def pack( +//| obj: object, +//| stream: circuitpython_typing.ByteStream, +//| *, +//| default: Union[Callable[[object], None], None] = None +//| ) -> None: //| """Output object to stream in msgpack format. //| //| :param object obj: Object to convert to msgpack format. @@ -115,7 +122,12 @@ STATIC mp_obj_t mod_msgpack_pack(size_t n_args, const mp_obj_t *pos_args, mp_map MP_DEFINE_CONST_FUN_OBJ_KW(mod_msgpack_pack_obj, 0, mod_msgpack_pack); -//| def unpack(stream: circuitpython_typing.ByteStream, *, ext_hook: Union[Callable[[int, bytes], object], None] = None, use_list: bool=True) -> object: +//| def unpack( +//| stream: circuitpython_typing.ByteStream, +//| *, +//| ext_hook: Union[Callable[[int, bytes], object], None] = None, +//| use_list: bool = True +//| ) -> object: //| """Unpack and return one object from stream. //| //| :param ~circuitpython_typing.ByteStream stream: stream to read from diff --git a/shared-bindings/multiterminal/__init__.c b/shared-bindings/multiterminal/__init__.c deleted file mode 100644 index f3f8d1ab6c..0000000000 --- a/shared-bindings/multiterminal/__init__.c +++ /dev/null @@ -1,110 +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 "shared-bindings/multiterminal/__init__.h" - -#include "py/obj.h" -#include "py/mphal.h" -#include "py/runtime.h" -#include "supervisor/shared/translate.h" - -//| """Manage additional terminal sources -//| -//| The `multiterminal` module allows you to configure an additional serial -//| terminal source. Incoming characters are accepted from both the internal -//| serial connection and the optional secondary connection.""" -//| - -//| def get_secondary_terminal() -> Optional[typing.BinaryIO]: -//| """Returns the current secondary terminal.""" -//| ... -//| -STATIC mp_obj_t multiterminal_obj_get_secondary_terminal() { - return common_hal_multiterminal_get_secondary_terminal(); -} -MP_DEFINE_CONST_FUN_OBJ_0(multiterminal_get_secondary_terminal_obj, multiterminal_obj_get_secondary_terminal); - -//| def set_secondary_terminal(stream: typing.BinaryIO) -> None: -//| """Read additional input from the given stream and write out back to it. -//| This doesn't replace the core stream (usually UART or native USB) but is -//| mixed in instead. -//| -//| :param stream stream: secondary stream""" -//| ... -//| -STATIC mp_obj_t multiterminal_obj_set_secondary_terminal(mp_obj_t secondary_terminal) { - mp_obj_t write_m[3]; - mp_load_method_maybe(secondary_terminal, MP_QSTR_write, write_m); - mp_obj_t readinto_m[3]; - mp_load_method_maybe(secondary_terminal, MP_QSTR_readinto, readinto_m); - if (write_m[0] == MP_OBJ_NULL || readinto_m[0] == MP_OBJ_NULL) { - mp_raise_ValueError(translate("Stream missing readinto() or write() method.")); - return mp_const_none; - } - common_hal_multiterminal_set_secondary_terminal(secondary_terminal); - return mp_const_none; -} -MP_DEFINE_CONST_FUN_OBJ_1(multiterminal_set_secondary_terminal_obj, multiterminal_obj_set_secondary_terminal); - -//| def clear_secondary_terminal() -> None: -//| """Clears the secondary terminal.""" -//| ... -//| -STATIC mp_obj_t multiterminal_obj_clear_secondary_terminal() { - common_hal_multiterminal_clear_secondary_terminal(); - return mp_const_none; -} -MP_DEFINE_CONST_FUN_OBJ_0(multiterminal_clear_secondary_terminal_obj, multiterminal_obj_clear_secondary_terminal); - -//| def schedule_secondary_terminal_read(socket: socket.socket) -> None: -//| """In cases where the underlying OS is doing task scheduling, this notifies -//| the OS when more data is available on the socket to read. This is useful -//| as a callback for lwip sockets.""" -//| ... -//| -// TODO(tannewt): This is a funny API. Replace it with a direct call into the OS -// by the lwip object. -STATIC mp_obj_t multiterminal_obj_schedule_secondary_terminal_read(mp_obj_t socket) { - common_hal_multiterminal_schedule_secondary_terminal_read(socket); - return mp_const_none; -} -MP_DEFINE_CONST_FUN_OBJ_1(multiterminal_schedule_secondary_terminal_read_obj, multiterminal_obj_schedule_secondary_terminal_read); - -// TODO(tannewt): Expose the internal serial connection as `primary_terminal` - -STATIC const mp_rom_map_elem_t multiterminal_module_globals_table[] = { - { MP_ROM_QSTR(MP_QSTR___name__), MP_OBJ_NEW_QSTR(MP_QSTR_multiterminal) }, - { MP_ROM_QSTR(MP_QSTR_get_secondary_terminal), MP_ROM_PTR(&multiterminal_get_secondary_terminal_obj) }, - { MP_ROM_QSTR(MP_QSTR_set_secondary_terminal), MP_ROM_PTR(&multiterminal_set_secondary_terminal_obj) }, - { MP_ROM_QSTR(MP_QSTR_clear_secondary_terminal), MP_ROM_PTR(&multiterminal_clear_secondary_terminal_obj) }, - { MP_ROM_QSTR(MP_QSTR_schedule_secondary_terminal_read), MP_ROM_PTR(&multiterminal_schedule_secondary_terminal_read_obj) }, -}; - -STATIC MP_DEFINE_CONST_DICT(multiterminal_module_globals, multiterminal_module_globals_table); - -const mp_obj_module_t multiterminal_module = { - .base = { &mp_type_module }, - .globals = (mp_obj_dict_t *)&multiterminal_module_globals, -}; diff --git a/shared-bindings/neopixel_write/__init__.c b/shared-bindings/neopixel_write/__init__.c index d0234fe451..3a35fa8243 100644 --- a/shared-bindings/neopixel_write/__init__.c +++ b/shared-bindings/neopixel_write/__init__.c @@ -30,7 +30,7 @@ #include "py/runtime.h" #include "shared-bindings/digitalio/DigitalInOut.h" #include "shared-bindings/util.h" -#include "supervisor/shared/translate.h" +#include "supervisor/shared/translate/translate.h" // RGB LED timing information: @@ -111,6 +111,7 @@ STATIC void check_for_deinit(digitalio_digitalinout_obj_t *self) { //| :param ~digitalio.DigitalInOut digitalinout: the DigitalInOut to output with //| :param ~circuitpython_typing.ReadableBuffer buf: The bytes to clock out. No assumption is made about color order""" //| ... +//| STATIC mp_obj_t neopixel_write_neopixel_write_(mp_obj_t digitalinout_obj, mp_obj_t buf) { if (!mp_obj_is_type(digitalinout_obj, &digitalio_digitalinout_type)) { mp_raise_TypeError_varg(translate("Expected a %q"), digitalio_digitalinout_type.name); diff --git a/shared-bindings/nvm/ByteArray.c b/shared-bindings/nvm/ByteArray.c index 6e34b76bd9..e7c3fc37e8 100644 --- a/shared-bindings/nvm/ByteArray.c +++ b/shared-bindings/nvm/ByteArray.c @@ -29,7 +29,7 @@ #include "py/runtime.h" #include "py/runtime0.h" #include "shared-bindings/nvm/ByteArray.h" -#include "supervisor/shared/translate.h" +#include "supervisor/shared/translate/translate.h" //| class ByteArray: //| r"""Presents a stretch of non-volatile memory as a bytearray. @@ -43,20 +43,15 @@ //| import microcontroller //| microcontroller.nvm[0:3] = b"\xcc\x10\x00" //| """ -//| //| def __init__(self) -> None: //| """Not currently dynamically supported. Access the sole instance through `microcontroller.nvm`.""" //| ... -//| -//| def __bool__(self) -> bool: -//| ... -//| +//| def __bool__(self) -> bool: ... //| def __len__(self) -> int: //| """Return the length. This is used by (`len`)""" //| ... -//| STATIC mp_obj_t nvm_bytearray_unary_op(mp_unary_op_t op, mp_obj_t self_in) { nvm_bytearray_obj_t *self = MP_OBJ_TO_PTR(self_in); uint16_t len = common_hal_nvm_bytearray_get_length(self); @@ -81,7 +76,6 @@ STATIC MP_DEFINE_CONST_DICT(nvm_bytearray_locals_dict, nvm_bytearray_locals_dict //| def __getitem__(self, index: int) -> int: //| """Returns the value at the given index.""" //| ... -//| //| @overload //| def __setitem__(self, index: slice, value: ReadableBuffer) -> None: ... //| @overload @@ -153,9 +147,8 @@ STATIC mp_obj_t nvm_bytearray_subscr(mp_obj_t self_in, mp_obj_t index_in, mp_obj } else { // store mp_int_t byte_value = mp_obj_get_int(value); - if (byte_value > 0xff || byte_value < 0) { - mp_raise_ValueError(translate("Bytes must be between 0 and 255.")); - } + mp_arg_validate_int_range(byte_value, 0, 255, MP_QSTR_bytes); + uint8_t short_value = byte_value; if (!common_hal_nvm_bytearray_set_bytes(self, index, &short_value, 1)) { mp_raise_RuntimeError(translate("Unable to write to nvm.")); diff --git a/shared-bindings/nvm/__init__.c b/shared-bindings/nvm/__init__.c index dffc4cda89..0ecadd9880 100644 --- a/shared-bindings/nvm/__init__.c +++ b/shared-bindings/nvm/__init__.c @@ -39,7 +39,6 @@ //| Note that this module can't be imported and used directly. The sole //| instance of :class:`ByteArray` is available at //| :attr:`microcontroller.nvm`.""" -//| STATIC const mp_rom_map_elem_t nvm_module_globals_table[] = { { MP_ROM_QSTR(MP_QSTR___name__), MP_ROM_QSTR(MP_QSTR_nvm) }, { MP_ROM_QSTR(MP_QSTR_ByteArray), MP_ROM_PTR(&nvm_bytearray_type) }, @@ -51,3 +50,5 @@ const mp_obj_module_t nvm_module = { .base = { &mp_type_module }, .globals = (mp_obj_dict_t *)&nvm_module_globals, }; + +MP_REGISTER_MODULE(MP_QSTR_nvm, nvm_module, CIRCUITPY_NVM); diff --git a/shared-bindings/onewireio/OneWire.c b/shared-bindings/onewireio/OneWire.c index a167c86cc8..4a0140ac5d 100644 --- a/shared-bindings/onewireio/OneWire.c +++ b/shared-bindings/onewireio/OneWire.c @@ -38,25 +38,21 @@ //| def __init__(self, pin: microcontroller.Pin) -> None: //| """Create a OneWire object associated with the given pin. //| -//| The object implements the lowest level timing-sensitive bits of the protocol. +//| The object implements the lowest level timing-sensitive bits of the protocol. //| -//| :param ~microcontroller.Pin pin: Pin connected to the OneWire bus +//| :param ~microcontroller.Pin pin: Pin connected to the OneWire bus //| -//| .. note:: The OneWire class is available on `busio` and `bitbangio` in CircuitPython -//| 7.x for backwards compatibility but will be removed in CircuitPython 8.0.0. +//| Read a short series of pulses:: //| -//| Read a short series of pulses:: +//| import onewireio +//| import board //| -//| import onewireio -//| import board -//| -//| onewire = onewireio.OneWire(board.D7) -//| onewire.reset() -//| onewire.write_bit(True) -//| onewire.write_bit(False) -//| print(onewire.read_bit())""" +//| onewire = onewireio.OneWire(board.D7) +//| onewire.reset() +//| onewire.write_bit(True) +//| onewire.write_bit(False) +//| print(onewire.read_bit())""" //| ... -//| STATIC mp_obj_t onewireio_onewire_make_new(const mp_obj_type_t *type, size_t n_args, size_t n_kw, const mp_obj_t *all_args) { enum { ARG_pin }; static const mp_arg_t allowed_args[] = { @@ -76,7 +72,6 @@ STATIC mp_obj_t onewireio_onewire_make_new(const mp_obj_type_t *type, size_t n_a //| def deinit(self) -> None: //| """Deinitialize the OneWire bus and release any hardware resources for reuse.""" //| ... -//| STATIC mp_obj_t onewireio_onewire_deinit(mp_obj_t self_in) { onewireio_onewire_obj_t *self = MP_OBJ_TO_PTR(self_in); common_hal_onewireio_onewire_deinit(self); @@ -93,14 +88,12 @@ STATIC void check_for_deinit(onewireio_onewire_obj_t *self) { //| def __enter__(self) -> OneWire: //| """No-op used by Context Managers.""" //| ... -//| // Provided by context manager helper. //| def __exit__(self) -> None: //| """Automatically deinitializes the hardware when exiting a context. See //| :ref:`lifetime-and-contextmanagers` for more info.""" //| ... -//| STATIC mp_obj_t onewireio_onewire_obj___exit__(size_t n_args, const mp_obj_t *args) { (void)n_args; common_hal_onewireio_onewire_deinit(args[0]); @@ -114,7 +107,6 @@ STATIC MP_DEFINE_CONST_FUN_OBJ_VAR_BETWEEN(onewireio_onewire___exit___obj, 4, 4, //| :returns: False when at least one device is present //| :rtype: bool""" //| ... -//| STATIC mp_obj_t onewireio_onewire_obj_reset(mp_obj_t self_in) { onewireio_onewire_obj_t *self = MP_OBJ_TO_PTR(self_in); check_for_deinit(self); @@ -129,7 +121,6 @@ MP_DEFINE_CONST_FUN_OBJ_1(onewireio_onewire_reset_obj, onewireio_onewire_obj_res //| :returns: bit state read //| :rtype: bool""" //| ... -//| STATIC mp_obj_t onewireio_onewire_obj_read_bit(mp_obj_t self_in) { onewireio_onewire_obj_t *self = MP_OBJ_TO_PTR(self_in); check_for_deinit(self); diff --git a/shared-bindings/onewireio/__init__.c b/shared-bindings/onewireio/__init__.c index 45d78b250a..81b2d605d7 100644 --- a/shared-bindings/onewireio/__init__.c +++ b/shared-bindings/onewireio/__init__.c @@ -38,7 +38,6 @@ //| """Low-level bit primitives for Maxim (formerly Dallas Semi) one-wire protocol. //| //| Protocol definition is here: https://www.maximintegrated.com/en/app-notes/index.mvp/id/126""" -//| STATIC const mp_rom_map_elem_t onewireio_module_globals_table[] = { { MP_ROM_QSTR(MP_QSTR___name__), MP_ROM_QSTR(MP_QSTR_onewireio) }, diff --git a/shared-bindings/os/__init__.c b/shared-bindings/os/__init__.c index 2daca52b85..1ccefaf0b2 100644 --- a/shared-bindings/os/__init__.c +++ b/shared-bindings/os/__init__.c @@ -36,6 +36,7 @@ #include "py/objstr.h" #include "py/runtime.h" #include "shared-bindings/os/__init__.h" +#include "supervisor/shared/translate/translate.h" //| """functions that an OS normally provides //| @@ -43,6 +44,7 @@ //| """ //| //| import typing +//| //| def uname() -> _Uname: //| """Returns a named tuple of operating specific and CircuitPython port @@ -83,6 +85,25 @@ STATIC mp_obj_t os_getcwd(void) { } MP_DEFINE_CONST_FUN_OBJ_0(os_getcwd_obj, os_getcwd); +//| def getenv(key: str, default: Optional[str] = None) -> Optional[str]: +//| """Get the environment variable value for the given key or return ``default``. +//| +//| This may load values from disk so cache the result instead of calling this often.""" +//| ... +//| +STATIC mp_obj_t os_getenv(size_t n_args, const mp_obj_t *pos_args, mp_map_t *kw_args) { + enum { ARG_key, ARG_default }; + static const mp_arg_t allowed_args[] = { + { MP_QSTR_key, MP_ARG_REQUIRED | MP_ARG_OBJ }, + { MP_QSTR_default, MP_ARG_OBJ, {.u_obj = mp_const_none} }, + }; + mp_arg_val_t args[MP_ARRAY_SIZE(allowed_args)]; + mp_arg_parse_all(n_args, pos_args, kw_args, MP_ARRAY_SIZE(allowed_args), allowed_args, args); + + return common_hal_os_getenv(mp_obj_str_get_str(args[ARG_key].u_obj), args[ARG_default].u_obj); +} +STATIC MP_DEFINE_CONST_FUN_OBJ_KW(os_getenv_obj, 1, os_getenv); + //| def listdir(dir: str) -> str: //| """With no argument, list the current directory. Otherwise list the given directory.""" //| ... @@ -146,6 +167,20 @@ MP_DEFINE_CONST_FUN_OBJ_1(os_rmdir_obj, os_rmdir); //| def stat(path: str) -> Tuple[int, int, int, int, int, int, int, int, int, int]: //| """Get the status of a file or directory. //| +//| Returns a tuple with the status of a file or directory in the following order: +//| +//| +//| * ``st_mode`` -- File type, regular or directory +//| * ``st_ino`` -- Set to 0 +//| * ``st_dev`` -- Set to 0 +//| * ``st_nlink`` -- Set to 0 +//| * ``st_uid`` -- Set to 0 +//| * ``st_gid`` -- Set to 0 +//| * ``st_size`` -- Size of the file in bytes +//| * ``st_atime`` -- Time of most recent access expressed in seconds +//| * ``st_mtime`` -- Time of most recent content modification expressed in seconds. +//| * ``st_ctime`` -- Time of most recent content modification expressed in seconds. +//| //| .. note:: On builds without long integers, the number of seconds //| for contemporary dates will not fit in a small integer. //| So the time fields return 946684800, @@ -220,6 +255,7 @@ STATIC const mp_rom_map_elem_t os_module_globals_table[] = { { MP_ROM_QSTR(MP_QSTR_chdir), MP_ROM_PTR(&os_chdir_obj) }, { MP_ROM_QSTR(MP_QSTR_getcwd), MP_ROM_PTR(&os_getcwd_obj) }, + { MP_ROM_QSTR(MP_QSTR_getenv), MP_ROM_PTR(&os_getenv_obj) }, { MP_ROM_QSTR(MP_QSTR_listdir), MP_ROM_PTR(&os_listdir_obj) }, { MP_ROM_QSTR(MP_QSTR_mkdir), MP_ROM_PTR(&os_mkdir_obj) }, { MP_ROM_QSTR(MP_QSTR_remove), MP_ROM_PTR(&os_remove_obj) }, @@ -233,10 +269,8 @@ STATIC const mp_rom_map_elem_t os_module_globals_table[] = { { MP_ROM_QSTR(MP_QSTR_urandom), MP_ROM_PTR(&os_urandom_obj) }, -//| //| sep: str //| """Separator used to delineate path components such as folder and file names.""" -//| { MP_ROM_QSTR(MP_QSTR_sep), MP_ROM_QSTR(MP_QSTR__slash_) }, }; diff --git a/shared-bindings/os/__init__.h b/shared-bindings/os/__init__.h index f6f0a25c93..5a27f309b4 100644 --- a/shared-bindings/os/__init__.h +++ b/shared-bindings/os/__init__.h @@ -37,6 +37,7 @@ extern const mp_rom_obj_tuple_t common_hal_os_uname_info_obj; mp_obj_t common_hal_os_uname(void); void common_hal_os_chdir(const char *path); mp_obj_t common_hal_os_getcwd(void); +mp_obj_t common_hal_os_getenv(const char *key, mp_obj_t default_); mp_obj_t common_hal_os_listdir(const char *path); void common_hal_os_mkdir(const char *path); void common_hal_os_remove(const char *path); diff --git a/shared-bindings/paralleldisplay/ParallelBus.c b/shared-bindings/paralleldisplay/ParallelBus.c index 6e6e778259..2f18624f1a 100644 --- a/shared-bindings/paralleldisplay/ParallelBus.c +++ b/shared-bindings/paralleldisplay/ParallelBus.c @@ -35,14 +35,24 @@ #include "shared-bindings/microcontroller/Pin.h" #include "shared-bindings/util.h" #include "shared-module/displayio/__init__.h" -#include "supervisor/shared/translate.h" +#include "supervisor/shared/translate/translate.h" //| class ParallelBus: //| """Manage updating a display over 8-bit parallel bus in the background while Python code runs. This //| protocol may be refered to as 8080-I Series Parallel Interface in datasheets. It doesn't handle //| display initialization.""" //| -//| def __init__(self, *, data0: microcontroller.Pin, command: microcontroller.Pin, chip_select: microcontroller.Pin, write: microcontroller.Pin, read: Optional[microcontroller.Pin], reset: Optional[microcontroller.Pin] = None, frequency: int = 30_000_000) -> None: +//| def __init__( +//| self, +//| *, +//| data0: microcontroller.Pin, +//| command: microcontroller.Pin, +//| chip_select: microcontroller.Pin, +//| write: microcontroller.Pin, +//| read: Optional[microcontroller.Pin], +//| reset: Optional[microcontroller.Pin] = None, +//| frequency: int = 30_000_000, +//| ) -> None: //| """Create a ParallelBus object associated with the given pins. The bus is inferred from data0 //| by implying the next 7 additional pins on a given GPIO port. //| @@ -60,7 +70,6 @@ //| :param microcontroller.Pin reset: Reset pin, optional //| :param int frequency: The communication frequency in Hz for the display on the bus""" //| ... -//| STATIC mp_obj_t paralleldisplay_parallelbus_make_new(const mp_obj_type_t *type, size_t n_args, size_t n_kw, const mp_obj_t *all_args) { enum { ARG_data0, ARG_data_pins, ARG_command, ARG_chip_select, ARG_write, ARG_read, ARG_reset, ARG_frequency }; static const mp_arg_t allowed_args[] = { @@ -108,7 +117,6 @@ STATIC mp_obj_t paralleldisplay_parallelbus_make_new(const mp_obj_type_t *type, //| """Performs a hardware reset via the reset pin. Raises an exception if called when no reset pin //| is available.""" //| ... -//| STATIC mp_obj_t paralleldisplay_parallelbus_obj_reset(mp_obj_t self_in) { paralleldisplay_parallelbus_obj_t *self = self_in; @@ -126,10 +134,8 @@ MP_DEFINE_CONST_FUN_OBJ_1(paralleldisplay_parallelbus_reset_obj, paralleldisplay //| ... //| STATIC mp_obj_t paralleldisplay_parallelbus_obj_send(mp_obj_t self, mp_obj_t command_obj, mp_obj_t data_obj) { - mp_int_t command_int = MP_OBJ_SMALL_INT_VALUE(command_obj); - if (!mp_obj_is_small_int(command_obj) || command_int > 255 || command_int < 0) { - mp_raise_ValueError(translate("Command must be an int between 0 and 255")); - } + mp_int_t command_int = mp_arg_validate_int_range(mp_obj_get_int(command_obj), 0, 255, MP_QSTR_command); + uint8_t command = command_int; mp_buffer_info_t bufinfo; mp_get_buffer_raise(data_obj, &bufinfo, MP_BUFFER_READ); diff --git a/shared-bindings/ps2io/Ps2.c b/shared-bindings/ps2io/Ps2.c index a0fb6d607b..5aeb3af51e 100644 --- a/shared-bindings/ps2io/Ps2.c +++ b/shared-bindings/ps2io/Ps2.c @@ -34,7 +34,7 @@ #include "shared-bindings/microcontroller/Pin.h" #include "shared-bindings/ps2io/Ps2.h" #include "shared-bindings/util.h" -#include "supervisor/shared/translate.h" +#include "supervisor/shared/translate/translate.h" //| class Ps2: //| """Communicate with a PS/2 keyboard or mouse @@ -66,23 +66,22 @@ //| print(kbd.sendcmd(0xed)) //| print(kbd.sendcmd(0x01))""" //| ... -//| STATIC mp_obj_t ps2io_ps2_make_new(const mp_obj_type_t *type, size_t n_args, size_t n_kw, const mp_obj_t *all_args) { - enum { ARG_datapin, ARG_clkpin }; + enum { ARG_data_pin, ARG_clock_pin }; static const mp_arg_t allowed_args[] = { - { MP_QSTR_datapin, MP_ARG_REQUIRED | MP_ARG_OBJ }, - { MP_QSTR_clkpin, MP_ARG_REQUIRED | MP_ARG_OBJ }, + { MP_QSTR_data_pin, MP_ARG_REQUIRED | MP_ARG_OBJ }, + { MP_QSTR_clock_pin, MP_ARG_REQUIRED | MP_ARG_OBJ }, }; mp_arg_val_t args[MP_ARRAY_SIZE(allowed_args)]; mp_arg_parse_all_kw_array(n_args, n_kw, all_args, MP_ARRAY_SIZE(allowed_args), allowed_args, args); - const mcu_pin_obj_t *clkpin = validate_obj_is_free_pin(args[ARG_clkpin].u_obj); - const mcu_pin_obj_t *datapin = validate_obj_is_free_pin(args[ARG_datapin].u_obj); + const mcu_pin_obj_t *clock_pin = validate_obj_is_free_pin(args[ARG_clock_pin].u_obj); + const mcu_pin_obj_t *data_pin = validate_obj_is_free_pin(args[ARG_data_pin].u_obj); ps2io_ps2_obj_t *self = m_new_obj(ps2io_ps2_obj_t); self->base.type = &ps2io_ps2_type; - common_hal_ps2io_ps2_construct(self, datapin, clkpin); + common_hal_ps2io_ps2_construct(self, data_pin, clock_pin); return MP_OBJ_FROM_PTR(self); } @@ -90,7 +89,6 @@ STATIC mp_obj_t ps2io_ps2_make_new(const mp_obj_type_t *type, size_t n_args, siz //| def deinit(self) -> None: //| """Deinitialises the Ps2 and releases any hardware resources for reuse.""" //| ... -//| STATIC mp_obj_t ps2io_ps2_deinit(mp_obj_t self_in) { ps2io_ps2_obj_t *self = MP_OBJ_TO_PTR(self_in); common_hal_ps2io_ps2_deinit(self); @@ -107,14 +105,12 @@ STATIC void check_for_deinit(ps2io_ps2_obj_t *self) { //| def __enter__(self) -> Ps2: //| """No-op used by Context Managers.""" //| ... -//| // Provided by context manager helper. //| def __exit__(self) -> None: //| """Automatically deinitializes the hardware when exiting a context. See //| :ref:`lifetime-and-contextmanagers` for more info.""" //| ... -//| STATIC mp_obj_t ps2io_ps2_obj___exit__(size_t n_args, const mp_obj_t *args) { mp_check_self(mp_obj_is_type(args[0], &ps2io_ps2_type)); ps2io_ps2_obj_t *self = MP_OBJ_TO_PTR(args[0]); @@ -127,7 +123,6 @@ STATIC MP_DEFINE_CONST_FUN_OBJ_VAR_BETWEEN(ps2io_ps2___exit___obj, 4, 4, ps2io_p //| """Removes and returns the oldest received byte. When buffer //| is empty, raises an IndexError exception.""" //| ... -//| STATIC mp_obj_t ps2io_ps2_obj_popleft(mp_obj_t self_in) { ps2io_ps2_obj_t *self = MP_OBJ_TO_PTR(self_in); check_for_deinit(self); @@ -152,7 +147,6 @@ MP_DEFINE_CONST_FUN_OBJ_1(ps2io_ps2_popleft_obj, ps2io_ps2_obj_popleft); //| //| :param int byte: byte value of the command""" //| ... -//| STATIC mp_obj_t ps2io_ps2_obj_sendcmd(mp_obj_t self_in, mp_obj_t ob) { ps2io_ps2_obj_t *self = MP_OBJ_TO_PTR(self_in); check_for_deinit(self); @@ -194,7 +188,6 @@ MP_DEFINE_CONST_FUN_OBJ_2(ps2io_ps2_sendcmd_obj, ps2io_ps2_obj_sendcmd); //| //| 0x2000: device didn't send a response byte in time""" //| ... -//| STATIC mp_obj_t ps2io_ps2_obj_clear_errors(mp_obj_t self_in) { ps2io_ps2_obj_t *self = MP_OBJ_TO_PTR(self_in); check_for_deinit(self); @@ -204,7 +197,6 @@ STATIC mp_obj_t ps2io_ps2_obj_clear_errors(mp_obj_t self_in) { MP_DEFINE_CONST_FUN_OBJ_1(ps2io_ps2_clear_errors_obj, ps2io_ps2_obj_clear_errors); //| def __bool__(self) -> bool: ... -//| //| def __len__(self) -> int: //| """Returns the number of received bytes in buffer, available //| to :py:func:`popleft()`.""" diff --git a/shared-bindings/ps2io/Ps2.h b/shared-bindings/ps2io/Ps2.h index da4c6ba2fe..861fd40232 100644 --- a/shared-bindings/ps2io/Ps2.h +++ b/shared-bindings/ps2io/Ps2.h @@ -34,7 +34,7 @@ extern const mp_obj_type_t ps2io_ps2_type; extern void common_hal_ps2io_ps2_construct(ps2io_ps2_obj_t *self, - const mcu_pin_obj_t *data_pin, const mcu_pin_obj_t *clk_pin); + const mcu_pin_obj_t *data_pin, const mcu_pin_obj_t *clock_pin); extern void common_hal_ps2io_ps2_deinit(ps2io_ps2_obj_t *self); extern bool common_hal_ps2io_ps2_deinited(ps2io_ps2_obj_t *self); extern uint16_t common_hal_ps2io_ps2_get_len(ps2io_ps2_obj_t *self); diff --git a/shared-bindings/ps2io/__init__.c b/shared-bindings/ps2io/__init__.c index 517816dbcf..6857744036 100644 --- a/shared-bindings/ps2io/__init__.c +++ b/shared-bindings/ps2io/__init__.c @@ -37,16 +37,13 @@ //| //| The `ps2io` module contains classes to provide PS/2 communication. //| - //| .. warning:: This module is not available in some SAMD21 builds. See the //| :ref:`module-support-matrix` for more info. //| - //| All classes change hardware state and should be deinitialized when they //| are no longer needed if the program continues after use. To do so, either //| call :py:meth:`!deinit` or use a context manager. See //| :ref:`lifetime-and-contextmanagers` for more info.""" -//| STATIC const mp_rom_map_elem_t ps2io_module_globals_table[] = { { MP_ROM_QSTR(MP_QSTR___name__), MP_ROM_QSTR(MP_QSTR_ps2io) }, diff --git a/shared-bindings/pulseio/PulseIn.c b/shared-bindings/pulseio/PulseIn.c index 21dfdae42c..6d1830c4f2 100644 --- a/shared-bindings/pulseio/PulseIn.c +++ b/shared-bindings/pulseio/PulseIn.c @@ -33,14 +33,16 @@ #include "shared-bindings/microcontroller/Pin.h" #include "shared-bindings/pulseio/PulseIn.h" #include "shared-bindings/util.h" -#include "supervisor/shared/translate.h" +#include "supervisor/shared/translate/translate.h" //| class PulseIn: //| """Measure a series of active and idle pulses. This is commonly used in infrared receivers -//| and low cost temperature sensors (DHT). The pulsed signal consists of timed active and -//| idle periods. Unlike PWM, there is no set duration for active and idle pairs.""" +//| and low cost temperature sensors (DHT). The pulsed signal consists of timed active and +//| idle periods. Unlike PWM, there is no set duration for active and idle pairs.""" //| -//| def __init__(self, pin: microcontroller.Pin, maxlen: int = 2, *, idle_state: bool = False) -> None: +//| def __init__( +//| self, pin: microcontroller.Pin, maxlen: int = 2, *, idle_state: bool = False +//| ) -> None: //| """Create a PulseIn object associated with the given pin. The object acts as //| a read-only sequence of pulse lengths with a given max length. When it is //| active, new pulse lengths are added to the end of the list. When there is @@ -75,7 +77,6 @@ //| # Resume with an 80 microsecond active pulse //| pulses.resume(80)""" //| ... -//| STATIC mp_obj_t pulseio_pulsein_make_new(const mp_obj_type_t *type, size_t n_args, size_t n_kw, const mp_obj_t *all_args) { enum { ARG_pin, ARG_maxlen, ARG_idle_state }; static const mp_arg_t allowed_args[] = { @@ -87,7 +88,8 @@ STATIC mp_obj_t pulseio_pulsein_make_new(const mp_obj_type_t *type, size_t n_arg mp_arg_parse_all_kw_array(n_args, n_kw, all_args, MP_ARRAY_SIZE(allowed_args), allowed_args, args); const mcu_pin_obj_t *pin = validate_obj_is_free_pin(args[ARG_pin].u_obj); - pulseio_pulsein_obj_t *self = m_new_obj(pulseio_pulsein_obj_t); + // Make object long-lived to avoid moving between imports + pulseio_pulsein_obj_t *self = m_new_ll_obj(pulseio_pulsein_obj_t); self->base.type = &pulseio_pulsein_type; common_hal_pulseio_pulsein_construct(self, pin, args[ARG_maxlen].u_int, @@ -99,7 +101,6 @@ STATIC mp_obj_t pulseio_pulsein_make_new(const mp_obj_type_t *type, size_t n_arg //| def deinit(self) -> None: //| """Deinitialises the PulseIn and releases any hardware resources for reuse.""" //| ... -//| STATIC mp_obj_t pulseio_pulsein_deinit(mp_obj_t self_in) { pulseio_pulsein_obj_t *self = MP_OBJ_TO_PTR(self_in); common_hal_pulseio_pulsein_deinit(self); @@ -116,14 +117,12 @@ STATIC void check_for_deinit(pulseio_pulsein_obj_t *self) { //| def __enter__(self) -> PulseIn: //| """No-op used by Context Managers.""" //| ... -//| // Provided by context manager helper. //| def __exit__(self) -> None: //| """Automatically deinitializes the hardware when exiting a context. See //| :ref:`lifetime-and-contextmanagers` for more info.""" //| ... -//| STATIC mp_obj_t pulseio_pulsein_obj___exit__(size_t n_args, const mp_obj_t *args) { (void)n_args; common_hal_pulseio_pulsein_deinit(args[0]); @@ -134,7 +133,6 @@ STATIC MP_DEFINE_CONST_FUN_OBJ_VAR_BETWEEN(pulseio_pulsein___exit___obj, 4, 4, p //| def pause(self) -> None: //| """Pause pulse capture""" //| ... -//| STATIC mp_obj_t pulseio_pulsein_obj_pause(mp_obj_t self_in) { pulseio_pulsein_obj_t *self = MP_OBJ_TO_PTR(self_in); check_for_deinit(self); @@ -154,7 +152,6 @@ MP_DEFINE_CONST_FUN_OBJ_1(pulseio_pulsein_pause_obj, pulseio_pulsein_obj_pause); //| //| :param int trigger_duration: trigger pulse duration in microseconds""" //| ... -//| STATIC mp_obj_t pulseio_pulsein_obj_resume(size_t n_args, const mp_obj_t *pos_args, mp_map_t *kw_args) { enum { ARG_trigger_duration }; static const mp_arg_t allowed_args[] = { @@ -174,7 +171,6 @@ MP_DEFINE_CONST_FUN_OBJ_KW(pulseio_pulsein_resume_obj, 1, pulseio_pulsein_obj_re //| def clear(self) -> None: //| """Clears all captured pulses""" //| ... -//| STATIC mp_obj_t pulseio_pulsein_obj_clear(mp_obj_t self_in) { pulseio_pulsein_obj_t *self = MP_OBJ_TO_PTR(self_in); check_for_deinit(self); @@ -187,7 +183,6 @@ MP_DEFINE_CONST_FUN_OBJ_1(pulseio_pulsein_clear_obj, pulseio_pulsein_obj_clear); //| def popleft(self) -> int: //| """Removes and returns the oldest read pulse.""" //| ... -//| STATIC mp_obj_t pulseio_pulsein_obj_popleft(mp_obj_t self_in) { pulseio_pulsein_obj_t *self = MP_OBJ_TO_PTR(self_in); check_for_deinit(self); @@ -199,7 +194,6 @@ MP_DEFINE_CONST_FUN_OBJ_1(pulseio_pulsein_popleft_obj, pulseio_pulsein_obj_pople //| maxlen: int //| """The maximum length of the PulseIn. When len() is equal to maxlen, //| it is unclear which pulses are active and which are idle.""" -//| STATIC mp_obj_t pulseio_pulsein_obj_get_maxlen(mp_obj_t self_in) { pulseio_pulsein_obj_t *self = MP_OBJ_TO_PTR(self_in); check_for_deinit(self); @@ -214,7 +208,6 @@ MP_PROPERTY_GETTER(pulseio_pulsein_maxlen_obj, //| paused: bool //| """True when pulse capture is paused as a result of :py:func:`pause` or an error during capture //| such as a signal that is too fast.""" -//| STATIC mp_obj_t pulseio_pulsein_obj_get_paused(mp_obj_t self_in) { pulseio_pulsein_obj_t *self = MP_OBJ_TO_PTR(self_in); check_for_deinit(self); @@ -227,7 +220,6 @@ MP_PROPERTY_GETTER(pulseio_pulsein_paused_obj, (mp_obj_t)&pulseio_pulsein_get_paused_obj); //| def __bool__(self) -> bool: ... -//| //| def __len__(self) -> int: //| """Returns the number of pulse durations currently stored. //| @@ -236,7 +228,6 @@ MP_PROPERTY_GETTER(pulseio_pulsein_paused_obj, //| pulses = pulseio.PulseIn(pin) //| print(len(pulses))""" //| ... -//| STATIC mp_obj_t pulsein_unary_op(mp_unary_op_t op, mp_obj_t self_in) { pulseio_pulsein_obj_t *self = MP_OBJ_TO_PTR(self_in); check_for_deinit(self); diff --git a/shared-bindings/pulseio/PulseOut.c b/shared-bindings/pulseio/PulseOut.c index ac568231b9..758d3c2e77 100644 --- a/shared-bindings/pulseio/PulseOut.c +++ b/shared-bindings/pulseio/PulseOut.c @@ -34,23 +34,22 @@ #include "shared-bindings/pulseio/PulseOut.h" #include "shared-bindings/pwmio/PWMOut.h" #include "shared-bindings/util.h" -#include "supervisor/shared/translate.h" +#include "supervisor/shared/translate/translate.h" //| class PulseOut: //| """Pulse PWM "carrier" output on and off. This is commonly used in infrared remotes. The -//| pulsed signal consists of timed on and off periods. Unlike PWM, there is no set duration -//| for on and off pairs.""" +//| pulsed signal consists of timed on and off periods. Unlike PWM, there is no set duration +//| for on and off pairs.""" //| -//| def __init__(self, pin: microcontroller.Pin, *, frequency: int = 38000, duty_cycle: int = 1 << 15) -> None: +//| def __init__( +//| self, pin: microcontroller.Pin, *, frequency: int = 38000, duty_cycle: int = 1 << 15 +//| ) -> None: //| """Create a PulseOut object associated with the given pin. //| //| :param ~microcontroller.Pin pin: Signal output pin //| :param int frequency: Carrier signal frequency in Hertz //| :param int duty_cycle: 16-bit duty cycle of carrier frequency (0 - 65536) //| -//| For backwards compatibility, ``pin`` may be a PWMOut object used as the carrier. This -//| compatibility will be removed in CircuitPython 8.0.0. -//| //| Send a short series of pulses:: //| //| import array @@ -68,7 +67,6 @@ //| pulses[0] = 200 //| pulse.send(pulses)""" //| ... -//| STATIC mp_obj_t pulseio_pulseout_make_new(const mp_obj_type_t *type, size_t n_args, size_t n_kw, const mp_obj_t *all_args) { enum { ARG_pin, ARG_frequency, ARG_duty_cycle}; static const mp_arg_t allowed_args[] = { @@ -82,14 +80,6 @@ STATIC mp_obj_t pulseio_pulseout_make_new(const mp_obj_type_t *type, size_t n_ar const mcu_pin_obj_t *pin = args[ARG_pin].u_obj; mp_int_t frequency = args[ARG_frequency].u_int; mp_int_t duty_cycle = args[ARG_duty_cycle].u_int; - if (mp_obj_is_type(args[ARG_pin].u_obj, &pwmio_pwmout_type)) { - pwmio_pwmout_obj_t *pwmout = args[ARG_pin].u_obj; - duty_cycle = common_hal_pwmio_pwmout_get_duty_cycle(pwmout); - frequency = common_hal_pwmio_pwmout_get_frequency(pwmout); - pin = common_hal_pwmio_pwmout_get_pin(pwmout); - // Deinit the pin so we can use it. - common_hal_pwmio_pwmout_deinit(pwmout); - } validate_obj_is_free_pin(MP_OBJ_FROM_PTR(pin)); pulseio_pulseout_obj_t *self = m_new_obj(pulseio_pulseout_obj_t); self->base.type = &pulseio_pulseout_type; @@ -100,7 +90,6 @@ STATIC mp_obj_t pulseio_pulseout_make_new(const mp_obj_type_t *type, size_t n_ar //| def deinit(self) -> None: //| """Deinitialises the PulseOut and releases any hardware resources for reuse.""" //| ... -//| STATIC mp_obj_t pulseio_pulseout_deinit(mp_obj_t self_in) { pulseio_pulseout_obj_t *self = MP_OBJ_TO_PTR(self_in); common_hal_pulseio_pulseout_deinit(self); @@ -111,14 +100,12 @@ STATIC MP_DEFINE_CONST_FUN_OBJ_1(pulseio_pulseout_deinit_obj, pulseio_pulseout_d //| def __enter__(self) -> PulseOut: //| """No-op used by Context Managers.""" //| ... -//| // Provided by context manager helper. //| def __exit__(self) -> None: //| """Automatically deinitializes the hardware when exiting a context. See //| :ref:`lifetime-and-contextmanagers` for more info.""" //| ... -//| STATIC mp_obj_t pulseio_pulseout_obj___exit__(size_t n_args, const mp_obj_t *args) { (void)n_args; common_hal_pulseio_pulseout_deinit(args[0]); diff --git a/shared-bindings/pulseio/__init__.c b/shared-bindings/pulseio/__init__.c index 0dba6ffad6..c062cedd11 100644 --- a/shared-bindings/pulseio/__init__.c +++ b/shared-bindings/pulseio/__init__.c @@ -44,7 +44,6 @@ //| are no longer needed if the program continues after use. To do so, either //| call :py:meth:`!deinit` or use a context manager. See //| :ref:`lifetime-and-contextmanagers` for more info.""" -//| STATIC const mp_rom_map_elem_t pulseio_module_globals_table[] = { { MP_ROM_QSTR(MP_QSTR___name__), MP_ROM_QSTR(MP_QSTR_pulseio) }, diff --git a/shared-bindings/pwmio/PWMOut.c b/shared-bindings/pwmio/PWMOut.c index 60a9dfb8b9..92eea1d1e0 100644 --- a/shared-bindings/pwmio/PWMOut.c +++ b/shared-bindings/pwmio/PWMOut.c @@ -33,7 +33,7 @@ #include "shared-bindings/microcontroller/Pin.h" #include "shared-bindings/pwmio/PWMOut.h" #include "shared-bindings/util.h" -#include "supervisor/shared/translate.h" +#include "supervisor/shared/translate/translate.h" void common_hal_pwmio_pwmout_raise_error(pwmout_result_t result) { @@ -41,10 +41,10 @@ void common_hal_pwmio_pwmout_raise_error(pwmout_result_t result) { case PWMOUT_OK: break; case PWMOUT_INVALID_PIN: - mp_raise_ValueError(translate("Invalid pin")); + raise_ValueError_invalid_pin(); break; case PWMOUT_INVALID_FREQUENCY: - mp_raise_ValueError(translate("Invalid PWM frequency")); + mp_arg_error_invalid(MP_QSTR_frequency); break; case PWMOUT_INVALID_FREQUENCY_ON_PIN: mp_raise_ValueError(translate("Frequency must match existing PWMOut using this timer")); @@ -71,7 +71,14 @@ void common_hal_pwmio_pwmout_raise_error(pwmout_result_t result) { //| class PWMOut: //| """Output a Pulse Width Modulated signal on a given pin.""" //| -//| def __init__(self, pin: microcontroller.Pin, *, duty_cycle: int = 0, frequency: int = 500, variable_frequency: bool = False) -> None: +//| def __init__( +//| self, +//| pin: microcontroller.Pin, +//| *, +//| duty_cycle: int = 0, +//| frequency: int = 500, +//| variable_frequency: bool = False +//| ) -> None: //| """Create a PWM object associated with the given pin. This allows you to //| write PWM signals out on the given pin. Frequency is fixed after init //| unless ``variable_frequency`` is True. @@ -129,7 +136,6 @@ void common_hal_pwmio_pwmout_raise_error(pwmout_result_t result) { //| pwm.frequency = 880 //| time.sleep(0.1)""" //| ... -//| STATIC mp_obj_t pwmio_pwmout_make_new(const mp_obj_type_t *type, size_t n_args, size_t n_kw, const mp_obj_t *args) { enum { ARG_pin, ARG_duty_cycle, ARG_frequency, ARG_variable_frequency }; static const mp_arg_t allowed_args[] = { @@ -159,7 +165,6 @@ STATIC mp_obj_t pwmio_pwmout_make_new(const mp_obj_type_t *type, size_t n_args, //| def deinit(self) -> None: //| """Deinitialises the PWMOut and releases any hardware resources for reuse.""" //| ... -//| STATIC mp_obj_t pwmio_pwmout_deinit(mp_obj_t self_in) { pwmio_pwmout_obj_t *self = MP_OBJ_TO_PTR(self_in); common_hal_pwmio_pwmout_deinit(self); @@ -176,14 +181,12 @@ STATIC void check_for_deinit(pwmio_pwmout_obj_t *self) { //| def __enter__(self) -> PWMOut: //| """No-op used by Context Managers.""" //| ... -//| // Provided by context manager helper. //| def __exit__(self) -> None: //| """Automatically deinitializes the hardware when exiting a context. See //| :ref:`lifetime-and-contextmanagers` for more info.""" //| ... -//| STATIC mp_obj_t pwmio_pwmout_obj___exit__(size_t n_args, const mp_obj_t *args) { (void)n_args; common_hal_pwmio_pwmout_deinit(args[0]); @@ -200,7 +203,6 @@ STATIC MP_DEFINE_CONST_FUN_OBJ_VAR_BETWEEN(pwmio_pwmout___exit___obj, 4, 4, pwmi //| representation for duty cycle might have less than 16 bits of resolution. //| Reading this property will return the value from the internal representation, //| so it may differ from the value set.""" -//| STATIC mp_obj_t pwmio_pwmout_obj_get_duty_cycle(mp_obj_t self_in) { pwmio_pwmout_obj_t *self = MP_OBJ_TO_PTR(self_in); check_for_deinit(self); @@ -212,9 +214,9 @@ STATIC mp_obj_t pwmio_pwmout_obj_set_duty_cycle(mp_obj_t self_in, mp_obj_t duty_ pwmio_pwmout_obj_t *self = MP_OBJ_TO_PTR(self_in); check_for_deinit(self); mp_int_t duty = mp_obj_get_int(duty_cycle); - if (duty < 0 || duty > 0xffff) { - mp_raise_ValueError(translate("PWM duty_cycle must be between 0 and 65535 inclusive (16 bit resolution)")); - } + + mp_arg_validate_int_range(duty, 0, 0xffff, MP_QSTR_duty_cycle); + common_hal_pwmio_pwmout_set_duty_cycle(self, duty); return mp_const_none; } @@ -251,7 +253,7 @@ STATIC mp_obj_t pwmio_pwmout_obj_set_frequency(mp_obj_t self_in, mp_obj_t freque } mp_int_t freq = mp_obj_get_int(frequency); if (freq == 0) { - mp_raise_ValueError(translate("Invalid PWM frequency")); + mp_arg_error_invalid(MP_QSTR_frequency); } common_hal_pwmio_pwmout_set_frequency(self, freq); return mp_const_none; diff --git a/shared-bindings/pwmio/__init__.c b/shared-bindings/pwmio/__init__.c index 90aff45819..6aeaf9c3c8 100644 --- a/shared-bindings/pwmio/__init__.c +++ b/shared-bindings/pwmio/__init__.c @@ -37,7 +37,6 @@ //| //| The `pwmio` module contains classes to provide access to basic pulse IO. //| - //| All classes change hardware state and should be deinitialized when they //| are no longer needed if the program continues after use. To do so, either //| call :py:meth:`!deinit` or use a context manager. See @@ -62,7 +61,6 @@ //| For the essentials of `pwmio`, see the `CircuitPython Essentials //| Learn guide `_. //| """ -//| STATIC const mp_rom_map_elem_t pwmio_module_globals_table[] = { { MP_ROM_QSTR(MP_QSTR___name__), MP_ROM_QSTR(MP_QSTR_pwmio) }, diff --git a/shared-bindings/qrio/PixelPolicy.c b/shared-bindings/qrio/PixelPolicy.c index 6887081b24..deb164d02d 100644 --- a/shared-bindings/qrio/PixelPolicy.c +++ b/shared-bindings/qrio/PixelPolicy.c @@ -34,18 +34,28 @@ //| """The input buffer to `QRDecoder.decode` consists of greyscale values in every byte""" //| //| EVEN_BYTES: PixelPolicy -//| """The input buffer to `QRDecoder.decode` consists of greyscale values in positions 0, 2, …, and ignored bytes in positions 1, 3, …. This can decode directly from YUV images where the even bytes hold the Y (luminance) data.""" +//| """The input buffer to `QRDecoder.decode` consists of greyscale values in positions 0, 2, …, and ignored bytes in positions 1, 3, …. This can decode directly from YUV images where the even bytes hold the Y (luminance) data.""" //| //| ODD_BYTES: PixelPolicy -//| """The input buffer to `QRDecoder.decode` consists of greyscale values in positions 1, 3, …, and ignored bytes in positions 0, 2, …. This can decode directly from YUV images where the odd bytes hold the Y (luminance) data""" +//| """The input buffer to `QRDecoder.decode` consists of greyscale values in positions 1, 3, …, and ignored bytes in positions 0, 2, …. This can decode directly from YUV images where the odd bytes hold the Y (luminance) data""" +//| +//| RGB565_SWAPPED: PixelPolicy +//| """The input buffer to `QRDecoder.decode` consists of RGB565 values in byte-swapped order. Most cameras produce data in byte-swapped order. The green component is used.""" +//| +//| RGB565: PixelPolicy +//| """The input buffer to `QRDecoder.decode` consists of RGB565 values in native order. The green component is used.""" //| MAKE_ENUM_VALUE(qrio_pixel_policy_type, qrio_pixel_policy, EVERY_BYTE, QRIO_EVERY_BYTE); +MAKE_ENUM_VALUE(qrio_pixel_policy_type, qrio_pixel_policy, RGB565, QRIO_RGB565); +MAKE_ENUM_VALUE(qrio_pixel_policy_type, qrio_pixel_policy, RGB565_SWAPPED, QRIO_RGB565_SWAPPED); MAKE_ENUM_VALUE(qrio_pixel_policy_type, qrio_pixel_policy, EVEN_BYTES, QRIO_EVEN_BYTES); MAKE_ENUM_VALUE(qrio_pixel_policy_type, qrio_pixel_policy, ODD_BYTES, QRIO_EVEN_BYTES); MAKE_ENUM_MAP(qrio_pixel_policy) { MAKE_ENUM_MAP_ENTRY(qrio_pixel_policy, EVERY_BYTE), + MAKE_ENUM_MAP_ENTRY(qrio_pixel_policy, RGB565), + MAKE_ENUM_MAP_ENTRY(qrio_pixel_policy, RGB565_SWAPPED), MAKE_ENUM_MAP_ENTRY(qrio_pixel_policy, EVEN_BYTES), MAKE_ENUM_MAP_ENTRY(qrio_pixel_policy, ODD_BYTES), }; diff --git a/shared-bindings/qrio/PixelPolicy.h b/shared-bindings/qrio/PixelPolicy.h index 8be5dde1cc..36c1d271fd 100644 --- a/shared-bindings/qrio/PixelPolicy.h +++ b/shared-bindings/qrio/PixelPolicy.h @@ -33,7 +33,7 @@ extern const mp_obj_type_t qrio_pixel_policy_type; typedef enum { - QRIO_EVERY_BYTE, QRIO_EVEN_BYTES, QRIO_ODD_BYTES + QRIO_EVERY_BYTE, QRIO_EVEN_BYTES, QRIO_ODD_BYTES, QRIO_RGB565, QRIO_RGB565_SWAPPED } qrio_pixel_policy_t; extern const cp_enum_obj_t qrio_pixel_policy_EVERY_BYTE_obj; diff --git a/shared-bindings/qrio/QRDecoder.c b/shared-bindings/qrio/QRDecoder.c index d2d4785ed8..5ff65578e4 100644 --- a/shared-bindings/qrio/QRDecoder.c +++ b/shared-bindings/qrio/QRDecoder.c @@ -33,7 +33,6 @@ #include "py/enum.h" //| class QRDecoder: -//| //| def __init__(self, width: int, height: int) -> None: //| """Construct a QRDecoder object //| @@ -58,9 +57,10 @@ STATIC mp_obj_t qrio_qrdecoder_make_new(const mp_obj_type_t *type, size_t n_args return self; } -//| def decode(self, buffer: ReadableBuffer, pixel_policy: PixelPolicy = PixelPolicy.EVERY_BYTE) -> List[QRInfo]: +//| def decode( +//| self, buffer: ReadableBuffer, pixel_policy: PixelPolicy = PixelPolicy.EVERY_BYTE +//| ) -> List[QRInfo]: //| """Decode zero or more QR codes from the given image. The size of the buffer must be at least ``length``×``width`` bytes for `EVERY_BYTE`, and 2×``length``×``width`` bytes for `EVEN_BYTES` or `ODD_BYTES`.""" -//| STATIC mp_obj_t qrio_qrdecoder_decode(size_t n_args, const mp_obj_t *pos_args, mp_map_t *kw_args) { qrio_qrdecoder_obj_t *self = MP_OBJ_TO_PTR(pos_args[0]); @@ -92,7 +92,6 @@ MP_DEFINE_CONST_FUN_OBJ_KW(qrio_qrdecoder_decode_obj, 1, qrio_qrdecoder_decode); //| width: int //| """The width of image the decoder expects""" -//| STATIC mp_obj_t qrio_qrdecoder_get_width(mp_obj_t self_in) { qrio_qrdecoder_obj_t *self = MP_OBJ_TO_PTR(self_in); return mp_obj_new_int(shared_module_qrio_qrdecoder_get_width(self)); diff --git a/shared-bindings/qrio/QRInfo.c b/shared-bindings/qrio/QRInfo.c index 8eb03874ef..d53e638f81 100644 --- a/shared-bindings/qrio/QRInfo.c +++ b/shared-bindings/qrio/QRInfo.c @@ -37,6 +37,7 @@ //| //| data_type: Union[str, int] //| """The encoding of the payload as a string (if a standard encoding) or int (if not standard)""" +//| const mp_obj_namedtuple_type_t qrio_qrinfo_type_obj = { .base = { diff --git a/shared-bindings/qrio/__init__.c b/shared-bindings/qrio/__init__.c index 04c86fd1ee..18c74b9a88 100644 --- a/shared-bindings/qrio/__init__.c +++ b/shared-bindings/qrio/__init__.c @@ -40,7 +40,6 @@ //| .. note:: This module only handles decoding QR codes. If you are looking //| to generate a QR code, use the //| `adafruit_miniqr library `_""" -//| STATIC const mp_rom_map_elem_t qrio_module_globals_table[] = { { MP_ROM_QSTR(MP_QSTR___name__), MP_ROM_QSTR(MP_QSTR_qrio) }, diff --git a/shared-bindings/random/__init__.c b/shared-bindings/random/__init__.c index 63570fe7e7..29c6a0e74b 100644 --- a/shared-bindings/random/__init__.c +++ b/shared-bindings/random/__init__.c @@ -31,7 +31,7 @@ #include "py/obj.h" #include "py/runtime.h" #include "shared-bindings/random/__init__.h" -#include "supervisor/shared/translate.h" +#include "supervisor/shared/translate/translate.h" //| """pseudo-random numbers and choices //| @@ -45,8 +45,8 @@ //| bytes from `os.urandom` directly for true randomness.""" //| //| from typing import TypeVar -//| _T = TypeVar('_T') //| +//| _T = TypeVar("_T") //| def seed(seed: int) -> None: //| """Sets the starting seed of the random number generation. Further calls to diff --git a/shared-bindings/rgbmatrix/RGBMatrix.c b/shared-bindings/rgbmatrix/RGBMatrix.c index 4739807bd0..456f0cfbb1 100644 --- a/shared-bindings/rgbmatrix/RGBMatrix.c +++ b/shared-bindings/rgbmatrix/RGBMatrix.c @@ -132,15 +132,22 @@ STATIC void preflight_pins_or_throw(uint8_t clock_pin, uint8_t *rgb_pins, uint8_ } } -//| def __init__(self, *, width: int, bit_depth: int, -//| rgb_pins: Sequence[digitalio.DigitalInOut], -//| addr_pins: Sequence[digitalio.DigitalInOut], -//| clock_pin: digitalio.DigitalInOut, -//| latch_pin: digitalio.DigitalInOut, -//| output_enable_pin: digitalio.DigitalInOut, -//| doublebuffer: bool = True, -//| framebuffer: Optional[WriteableBuffer] = None, -//| height: int = 0, tile: int = 1, serpentine: bool = True) -> None: +//| def __init__( +//| self, +//| *, +//| width: int, +//| bit_depth: int, +//| rgb_pins: Sequence[digitalio.DigitalInOut], +//| addr_pins: Sequence[digitalio.DigitalInOut], +//| clock_pin: digitalio.DigitalInOut, +//| latch_pin: digitalio.DigitalInOut, +//| output_enable_pin: digitalio.DigitalInOut, +//| doublebuffer: bool = True, +//| framebuffer: Optional[WriteableBuffer] = None, +//| height: int = 0, +//| tile: int = 1, +//| serpentine: bool = True +//| ) -> None: //| """Create a RGBMatrix object with the given attributes. The height of //| the display is determined by the number of rgb and address pins and the number of tiles: //| ``len(rgb_pins) // 3 * 2 ** len(address_pins) * abs(tile)``. With 6 RGB pins, 4 @@ -176,7 +183,6 @@ STATIC void preflight_pins_or_throw(uint8_t clock_pin, uint8_t *rgb_pins, uint8_ //| //| A RGBMatrix is often used in conjunction with a //| `framebufferio.FramebufferDisplay`.""" -//| STATIC mp_obj_t rgbmatrix_rgbmatrix_make_new(const mp_obj_type_t *type, size_t n_args, size_t n_kw, const mp_obj_t *all_args) { enum { ARG_width, ARG_bit_depth, ARG_rgb_list, ARG_addr_list, @@ -207,11 +213,7 @@ 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); - } + mp_int_t bit_depth = mp_arg_validate_int_range(args[ARG_bit_depth].u_int, 1, 6, MP_QSTR_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); @@ -220,12 +222,7 @@ STATIC mp_obj_t rgbmatrix_rgbmatrix_make_new(const mp_obj_type_t *type, size_t n mp_raise_ValueError_varg(translate("Must use a multiple of 6 rgb pins, not %d"), rgb_count); } - int tile = args[ARG_tile].u_int; - - if (tile <= 0) { - mp_raise_ValueError_varg( - translate("tile must be greater than zero")); - } + int tile = mp_arg_validate_int_min(args[ARG_tile].u_int, 1, MP_QSTR_tile); int computed_height = (rgb_count / 3) * (1 << (addr_count)) * tile; if (args[ARG_height].u_int != 0) { @@ -235,21 +232,18 @@ STATIC mp_obj_t rgbmatrix_rgbmatrix_make_new(const mp_obj_type_t *type, size_t n } } - if (args[ARG_width].u_int <= 0) { - mp_raise_ValueError(translate("width must be greater than zero")); - } + mp_int_t width = mp_arg_validate_int_min(args[ARG_width].u_int, 1, MP_QSTR_width); preflight_pins_or_throw(clock_pin, rgb_pins, rgb_count, true); mp_obj_t framebuffer = args[ARG_framebuffer].u_obj; if (framebuffer == mp_const_none) { - int width = args[ARG_width].u_int; int bufsize = 2 * width * computed_height; framebuffer = mp_obj_new_bytearray_of_zeros(bufsize); } common_hal_rgbmatrix_rgbmatrix_construct(self, - args[ARG_width].u_int, + width, bit_depth, rgb_count, rgb_pins, addr_count, addr_pins, @@ -271,7 +265,6 @@ STATIC mp_obj_t rgbmatrix_rgbmatrix_make_new(const mp_obj_type_t *type, size_t n //| rgbmatrix instance. After deinitialization, no further operations //| may be performed.""" //| ... -//| STATIC mp_obj_t rgbmatrix_rgbmatrix_deinit(mp_obj_t self_in) { rgbmatrix_rgbmatrix_obj_t *self = (rgbmatrix_rgbmatrix_obj_t *)self_in; common_hal_rgbmatrix_rgbmatrix_deinit(self); @@ -289,7 +282,6 @@ static void check_for_deinit(rgbmatrix_rgbmatrix_obj_t *self) { //| brightness: float //| """In the current implementation, 0.0 turns the display off entirely //| and any other value up to 1.0 turns the display on fully.""" -//| STATIC mp_obj_t rgbmatrix_rgbmatrix_get_brightness(mp_obj_t self_in) { rgbmatrix_rgbmatrix_obj_t *self = (rgbmatrix_rgbmatrix_obj_t *)self_in; check_for_deinit(self); @@ -318,7 +310,6 @@ MP_PROPERTY_GETSET(rgbmatrix_rgbmatrix_brightness_obj, //| """Transmits the color data in the buffer to the pixels so that //| they are shown.""" //| ... -//| STATIC mp_obj_t rgbmatrix_rgbmatrix_refresh(mp_obj_t self_in) { rgbmatrix_rgbmatrix_obj_t *self = (rgbmatrix_rgbmatrix_obj_t *)self_in; check_for_deinit(self); @@ -329,7 +320,6 @@ MP_DEFINE_CONST_FUN_OBJ_1(rgbmatrix_rgbmatrix_refresh_obj, rgbmatrix_rgbmatrix_r //| width: int //| """The width of the display, in pixels""" -//| STATIC mp_obj_t rgbmatrix_rgbmatrix_get_width(mp_obj_t self_in) { rgbmatrix_rgbmatrix_obj_t *self = (rgbmatrix_rgbmatrix_obj_t *)self_in; check_for_deinit(self); diff --git a/shared-bindings/rgbmatrix/__init__.c b/shared-bindings/rgbmatrix/__init__.c index a7da7089f5..1e9099adb6 100644 --- a/shared-bindings/rgbmatrix/__init__.c +++ b/shared-bindings/rgbmatrix/__init__.c @@ -32,7 +32,6 @@ #include "shared-bindings/rgbmatrix/RGBMatrix.h" //| """Low-level routines for bitbanged LED matrices""" -//| STATIC const mp_rom_map_elem_t rgbmatrix_module_globals_table[] = { { MP_ROM_QSTR(MP_QSTR___name__), MP_ROM_QSTR(MP_QSTR_rgbmatrix) }, diff --git a/shared-bindings/rotaryio/IncrementalEncoder.c b/shared-bindings/rotaryio/IncrementalEncoder.c index 0fe22be262..e05ffb9e43 100644 --- a/shared-bindings/rotaryio/IncrementalEncoder.c +++ b/shared-bindings/rotaryio/IncrementalEncoder.c @@ -37,7 +37,9 @@ //| class IncrementalEncoder: //| """IncrementalEncoder determines the relative rotational position based on two series of pulses.""" //| -//| def __init__(self, pin_a: microcontroller.Pin, pin_b: microcontroller.Pin, divisor: int = 4) -> None: +//| def __init__( +//| self, pin_a: microcontroller.Pin, pin_b: microcontroller.Pin, divisor: int = 4 +//| ) -> None: //| """Create an IncrementalEncoder object associated with the given pins. It tracks the positional //| state of an incremental rotary encoder (also known as a quadrature encoder.) Position is //| relative to the position when the object is contructed. @@ -60,7 +62,6 @@ //| print(position) //| last_position = position""" //| ... -//| STATIC mp_obj_t rotaryio_incrementalencoder_make_new(const mp_obj_type_t *type, size_t n_args, size_t n_kw, const mp_obj_t *all_args) { enum { ARG_pin_a, ARG_pin_b, ARG_divisor }; static const mp_arg_t allowed_args[] = { @@ -74,7 +75,8 @@ STATIC mp_obj_t rotaryio_incrementalencoder_make_new(const mp_obj_type_t *type, const mcu_pin_obj_t *pin_a = validate_obj_is_free_pin(args[ARG_pin_a].u_obj); const mcu_pin_obj_t *pin_b = validate_obj_is_free_pin(args[ARG_pin_b].u_obj); - rotaryio_incrementalencoder_obj_t *self = m_new_obj(rotaryio_incrementalencoder_obj_t); + // Make long-lived because some implementations use a pointer to the object as interrupt-handler data. + rotaryio_incrementalencoder_obj_t *self = m_new_ll_obj(rotaryio_incrementalencoder_obj_t); self->base.type = &rotaryio_incrementalencoder_type; common_hal_rotaryio_incrementalencoder_construct(self, pin_a, pin_b); @@ -86,7 +88,6 @@ STATIC mp_obj_t rotaryio_incrementalencoder_make_new(const mp_obj_type_t *type, //| def deinit(self) -> None: //| """Deinitializes the IncrementalEncoder and releases any hardware resources for reuse.""" //| ... -//| STATIC mp_obj_t rotaryio_incrementalencoder_deinit(mp_obj_t self_in) { rotaryio_incrementalencoder_obj_t *self = MP_OBJ_TO_PTR(self_in); common_hal_rotaryio_incrementalencoder_deinit(self); @@ -103,14 +104,12 @@ STATIC void check_for_deinit(rotaryio_incrementalencoder_obj_t *self) { //| def __enter__(self) -> IncrementalEncoder: //| """No-op used by Context Managers.""" //| ... -//| // Provided by context manager helper. //| def __exit__(self) -> None: //| """Automatically deinitializes the hardware when exiting a context. See //| :ref:`lifetime-and-contextmanagers` for more info.""" //| ... -//| STATIC mp_obj_t rotaryio_incrementalencoder_obj___exit__(size_t n_args, const mp_obj_t *args) { (void)n_args; common_hal_rotaryio_incrementalencoder_deinit(args[0]); @@ -123,7 +122,6 @@ STATIC MP_DEFINE_CONST_FUN_OBJ_VAR_BETWEEN(rotaryio_incrementalencoder___exit___ //| """The divisor of the quadrature signal. Use 1 for encoders without //| detents, or encoders with 4 detents per cycle. Use 2 for encoders with 2 //| detents per cycle. Use 4 for encoders with 1 detent per cycle.""" -//| STATIC mp_obj_t rotaryio_incrementalencoder_obj_get_divisor(mp_obj_t self_in) { rotaryio_incrementalencoder_obj_t *self = MP_OBJ_TO_PTR(self_in); check_for_deinit(self); diff --git a/shared-bindings/rotaryio/__init__.c b/shared-bindings/rotaryio/__init__.c index 43a884e9a1..e549ecc75e 100644 --- a/shared-bindings/rotaryio/__init__.c +++ b/shared-bindings/rotaryio/__init__.c @@ -39,11 +39,13 @@ //| `Wikipedia's Rotary Encoder page `_ for more //| background. //| +//| For more information on working with rotary encoders using this library, see +//| `this Learn Guide `_. +//| //| All classes change hardware state and should be deinitialized when they //| are no longer needed if the program continues after use. To do so, either //| call :py:meth:`!deinit` or use a context manager. See //| :ref:`lifetime-and-contextmanagers` for more info.""" -//| STATIC const mp_rom_map_elem_t rotaryio_module_globals_table[] = { { MP_ROM_QSTR(MP_QSTR___name__), MP_ROM_QSTR(MP_QSTR_rotaryio) }, diff --git a/shared-bindings/rtc/RTC.c b/shared-bindings/rtc/RTC.c index b07f90bd01..8e2d9e5e09 100644 --- a/shared-bindings/rtc/RTC.c +++ b/shared-bindings/rtc/RTC.c @@ -34,7 +34,7 @@ #include "shared-bindings/rtc/__init__.h" #include "shared-bindings/rtc/RTC.h" #include "shared-bindings/time/__init__.h" -#include "supervisor/shared/translate.h" +#include "supervisor/shared/translate/translate.h" const rtc_rtc_obj_t rtc_rtc_obj = {{&rtc_rtc_type}}; @@ -44,7 +44,6 @@ const rtc_rtc_obj_t rtc_rtc_obj = {{&rtc_rtc_type}}; //| def __init__(self) -> None: //| """This class represents the onboard Real Time Clock. It is a singleton and will always return the same instance.""" //| ... -//| STATIC mp_obj_t rtc_rtc_make_new(const mp_obj_type_t *type, size_t n_args, size_t n_kw, const mp_obj_t *args) { // No arguments mp_arg_check_num(n_args, n_kw, 0, 0, false); @@ -71,7 +70,6 @@ STATIC mp_obj_t rtc_rtc_make_new(const mp_obj_type_t *type, size_t n_args, size_ //| current_time = r.datetime //| print(current_time) //| # struct_time(tm_year=2019, tm_month=5, ...)""" -//| STATIC mp_obj_t rtc_rtc_obj_get_datetime(mp_obj_t self_in) { timeutils_struct_time_t tm; common_hal_rtc_get_time(&tm); diff --git a/shared-bindings/rtc/__init__.c b/shared-bindings/rtc/__init__.c index 0220745c0f..64adfe7d9e 100644 --- a/shared-bindings/rtc/__init__.c +++ b/shared-bindings/rtc/__init__.c @@ -36,7 +36,6 @@ //| The `rtc` module provides support for a Real Time Clock. You can access and manage the //| RTC using :class:`rtc.RTC`. It also backs the :func:`time.time` and :func:`time.localtime` //| functions using the onboard RTC if present.""" -//| void rtc_reset(void) { MP_STATE_VM(rtc_time_source) = (mp_obj_t)&rtc_rtc_obj; diff --git a/shared-bindings/sdcardio/SDCard.c b/shared-bindings/sdcardio/SDCard.c index 5afca798f6..a71541c548 100644 --- a/shared-bindings/sdcardio/SDCard.c +++ b/shared-bindings/sdcardio/SDCard.c @@ -44,7 +44,9 @@ //| `busio.SPI`, not `bitbangio.SPI`. Usually an SDCard object is used //| with ``storage.VfsFat`` to allow file I/O to an SD card.""" //| -//| def __init__(self, bus: busio.SPI, cs: microcontroller.Pin, baudrate: int = 8000000) -> None: +//| def __init__( +//| self, bus: busio.SPI, cs: microcontroller.Pin, baudrate: int = 8000000 +//| ) -> None: //| """Construct an SPI SD Card object with the given properties //| //| :param busio.SPI spi: The SPI bus @@ -105,7 +107,6 @@ STATIC mp_obj_t sdcardio_sdcard_make_new(const mp_obj_type_t *type, size_t n_arg //| Due to technical limitations, this is a function and not a property. //| //| :return: The number of 512-byte blocks, as a number""" -//| STATIC mp_obj_t sdcardio_sdcard_count(mp_obj_t self_in) { sdcardio_sdcard_obj_t *self = (sdcardio_sdcard_obj_t *)self_in; return mp_obj_new_int_from_ull(common_hal_sdcardio_sdcard_get_blockcount(self)); @@ -116,7 +117,6 @@ MP_DEFINE_CONST_FUN_OBJ_1(sdcardio_sdcard_count_obj, sdcardio_sdcard_count); //| """Disable permanently. //| //| :return: None""" -//| STATIC mp_obj_t sdcardio_sdcard_deinit(mp_obj_t self_in) { sdcardio_sdcard_obj_t *self = (sdcardio_sdcard_obj_t *)self_in; common_hal_sdcardio_sdcard_deinit(self); @@ -133,7 +133,6 @@ MP_DEFINE_CONST_FUN_OBJ_1(sdcardio_sdcard_deinit_obj, sdcardio_sdcard_deinit); //| :param ~circuitpython_typing.WriteableBuffer buf: The buffer to write into. Length must be multiple of 512. //| //| :return: None""" -//| STATIC mp_obj_t sdcardio_sdcard_readblocks(mp_obj_t self_in, mp_obj_t start_block_in, mp_obj_t buf_in) { uint32_t start_block = mp_obj_get_int(start_block_in); diff --git a/shared-bindings/sdioio/SDCard.c b/shared-bindings/sdioio/SDCard.c index f6407ff2a8..7e57330fc4 100644 --- a/shared-bindings/sdioio/SDCard.c +++ b/shared-bindings/sdioio/SDCard.c @@ -38,7 +38,7 @@ #include "py/mperrno.h" #include "py/objproperty.h" #include "py/runtime.h" -#include "supervisor/shared/translate.h" +#include "supervisor/shared/translate/translate.h" //| class SDCard: //| """SD Card Block Interface with SDIO @@ -49,7 +49,13 @@ //| 25MHz. Usually an SDCard object is used with ``storage.VfsFat`` //| to allow file I/O to an SD card.""" //| -//| def __init__(self, clock: microcontroller.Pin, command: microcontroller.Pin, data: Sequence[microcontroller.Pin], frequency: int) -> None: +//| def __init__( +//| self, +//| clock: microcontroller.Pin, +//| command: microcontroller.Pin, +//| data: Sequence[microcontroller.Pin], +//| frequency: int, +//| ) -> None: //| """Construct an SDIO SD Card object with the given properties //| //| :param ~microcontroller.Pin clock: the pin to use for the clock. @@ -76,7 +82,6 @@ //| storage.mount(vfs, '/sd') //| os.listdir('/sd')""" //| ... -//| STATIC mp_obj_t sdioio_sdcard_make_new(const mp_obj_type_t *type, size_t n_args, size_t n_kw, const mp_obj_t *all_args) { sdioio_sdcard_obj_t *self = m_new_obj(sdioio_sdcard_obj_t); @@ -116,7 +121,6 @@ STATIC void check_for_deinit(sdioio_sdcard_obj_t *self) { //| :param int width: the number of data lines to use. Must be 1 or 4 and must also not exceed the number of data lines at construction //| //| .. note:: Leaving a value unspecified or 0 means the current setting is kept""" -//| STATIC mp_obj_t sdioio_sdcard_configure(size_t n_args, const mp_obj_t *pos_args, mp_map_t *kw_args) { enum { ARG_frequency, ARG_width, NUM_ARGS }; static const mp_arg_t allowed_args[] = { @@ -129,14 +133,10 @@ STATIC mp_obj_t sdioio_sdcard_configure(size_t n_args, const mp_obj_t *pos_args, MP_STATIC_ASSERT(MP_ARRAY_SIZE(allowed_args) == NUM_ARGS); mp_arg_parse_all(n_args - 1, pos_args + 1, kw_args, MP_ARRAY_SIZE(allowed_args), allowed_args, args); - mp_int_t frequency = args[ARG_frequency].u_int; - if (frequency < 0) { - mp_raise_ValueError_varg(translate("Invalid %q"), MP_QSTR_baudrate); - } - + mp_int_t frequency = mp_arg_validate_int_min(args[ARG_frequency].u_int, 1, MP_QSTR_frequency); uint8_t width = args[ARG_width].u_int; if (width != 0 && width != 1 && width != 4) { - mp_raise_ValueError_varg(translate("Invalid %q"), MP_QSTR_width); + mp_arg_error_invalid(MP_QSTR_width); } if (!common_hal_sdioio_sdcard_configure(self, frequency, width)) { @@ -152,7 +152,6 @@ MP_DEFINE_CONST_FUN_OBJ_KW(sdioio_sdcard_configure_obj, 1, sdioio_sdcard_configu //| Due to technical limitations, this is a function and not a property. //| //| :return: The number of 512-byte blocks, as a number""" -//| STATIC mp_obj_t sdioio_sdcard_count(mp_obj_t self_in) { sdioio_sdcard_obj_t *self = MP_OBJ_TO_PTR(self_in); check_for_deinit(self); @@ -190,7 +189,6 @@ MP_DEFINE_CONST_FUN_OBJ_3(sdioio_sdcard_readblocks_obj, sdioio_sdcard_readblocks //| :param ~circuitpython_typing.ReadableBuffer buf: The buffer to read from. Length must be multiple of 512. //| //| :return: None""" -//| STATIC mp_obj_t sdioio_sdcard_writeblocks(mp_obj_t self_in, mp_obj_t start_block_in, mp_obj_t buf_in) { uint32_t start_block = mp_obj_get_int(start_block_in); mp_buffer_info_t bufinfo; @@ -205,12 +203,9 @@ STATIC mp_obj_t sdioio_sdcard_writeblocks(mp_obj_t self_in, mp_obj_t start_block MP_DEFINE_CONST_FUN_OBJ_3(sdioio_sdcard_writeblocks_obj, sdioio_sdcard_writeblocks); -//| @property -//| def frequency(self) -> int: -//| """The actual SDIO bus frequency. This may not match the frequency -//| requested due to internal limitations.""" -//| ... -//| +//| frequency: int +//| """The actual SDIO bus frequency. This may not match the frequency +//| requested due to internal limitations.""" STATIC mp_obj_t sdioio_sdcard_obj_get_frequency(mp_obj_t self_in) { sdioio_sdcard_obj_t *self = MP_OBJ_TO_PTR(self_in); check_for_deinit(self); @@ -221,11 +216,8 @@ MP_DEFINE_CONST_FUN_OBJ_1(sdioio_sdcard_get_frequency_obj, sdioio_sdcard_obj_get MP_PROPERTY_GETTER(sdioio_sdcard_frequency_obj, (mp_obj_t)&sdioio_sdcard_get_frequency_obj); -//| @property -//| def width(self) -> int: -//| """The actual SDIO bus width, in bits""" -//| ... -//| +//| width: int +//| """The actual SDIO bus width, in bits""" STATIC mp_obj_t sdioio_sdcard_obj_get_width(mp_obj_t self_in) { sdioio_sdcard_obj_t *self = MP_OBJ_TO_PTR(self_in); check_for_deinit(self); @@ -251,7 +243,6 @@ MP_DEFINE_CONST_FUN_OBJ_1(sdioio_sdcard_deinit_obj, sdioio_sdcard_obj_deinit); //| """No-op used by Context Managers. //| Provided by context manager helper.""" //| ... -//| //| def __exit__(self) -> None: //| """Automatically deinitializes the hardware when exiting a context. See diff --git a/shared-bindings/sharpdisplay/__init__.c b/shared-bindings/sharpdisplay/__init__.c index 8c01c8c98c..4726e6ea1c 100644 --- a/shared-bindings/sharpdisplay/__init__.c +++ b/shared-bindings/sharpdisplay/__init__.c @@ -31,9 +31,11 @@ #include "shared-bindings/sharpdisplay/SharpMemoryFramebuffer.h" -//| """Support for Sharp Memory Display framebuffers""" +//| """Support for Sharp Memory Display framebuffers //| - +//| For more information about working with Sharp Memory Displays, +//| see `this Learn guide `_. +//| """ STATIC const mp_rom_map_elem_t sharpdisplay_module_globals_table[] = { { MP_ROM_QSTR(MP_QSTR___name__), MP_ROM_QSTR(MP_QSTR_sharpdisplay) }, { MP_ROM_QSTR(MP_QSTR_SharpMemoryFramebuffer), MP_ROM_PTR(&sharpdisplay_framebuffer_type) }, diff --git a/shared-bindings/socketpool/Socket.c b/shared-bindings/socketpool/Socket.c index bea3cd1624..7f0d870771 100644 --- a/shared-bindings/socketpool/Socket.c +++ b/shared-bindings/socketpool/Socket.c @@ -40,29 +40,26 @@ //| class Socket: //| """TCP, UDP and RAW socket. Cannot be created directly. Instead, call -//| `SocketPool.socket()`. +//| `SocketPool.socket()`. //| -//| Provides a subset of CPython's `socket.socket` API. It only implements the versions of -//| recv that do not allocate bytes objects.""" +//| Provides a subset of CPython's `socket.socket` API. It only implements the versions of +//| recv that do not allocate bytes objects.""" //| //| def __hash__(self) -> int: //| """Returns a hash for the Socket.""" //| ... -//| // Provided by mp_generic_unary_op(). //| def __enter__(self) -> Socket: //| """No-op used by Context Managers.""" //| ... -//| // Provided by context manager helper. //| def __exit__(self) -> None: //| """Automatically closes the Socket when exiting a context. See //| :ref:`lifetime-and-contextmanagers` for more info.""" //| ... -//| STATIC mp_obj_t socketpool_socket___exit__(size_t n_args, const mp_obj_t *args) { (void)n_args; common_hal_socketpool_socket_close(args[0]); @@ -74,8 +71,7 @@ STATIC MP_DEFINE_CONST_FUN_OBJ_VAR_BETWEEN(socketpool_socket___exit___obj, 4, 4, //| """Accept a connection on a listening socket of type SOCK_STREAM, //| creating a new socket of type SOCK_STREAM. //| Returns a tuple of (new_socket, remote_address)""" -//| -STATIC mp_obj_t socketpool_socket_accept(mp_obj_t self_in) { +STATIC mp_obj_t _socketpool_socket_accept(mp_obj_t self_in) { socketpool_socket_obj_t *self = MP_OBJ_TO_PTR(self_in); uint8_t ip[4]; uint32_t port; @@ -87,14 +83,13 @@ STATIC mp_obj_t socketpool_socket_accept(mp_obj_t self_in) { tuple_contents[1] = netutils_format_inet_addr(ip, port, NETUTILS_BIG); return mp_obj_new_tuple(2, tuple_contents); } -STATIC MP_DEFINE_CONST_FUN_OBJ_1(socketpool_socket_accept_obj, socketpool_socket_accept); +STATIC MP_DEFINE_CONST_FUN_OBJ_1(socketpool_socket_accept_obj, _socketpool_socket_accept); //| def bind(self, address: Tuple[str, int]) -> None: //| """Bind a socket to an address //| //| :param ~tuple address: tuple of (remote_address, remote_port)""" //| ... -//| STATIC mp_obj_t socketpool_socket_bind(mp_obj_t self_in, mp_obj_t addr_in) { socketpool_socket_obj_t *self = MP_OBJ_TO_PTR(self_in); @@ -119,20 +114,18 @@ STATIC MP_DEFINE_CONST_FUN_OBJ_2(socketpool_socket_bind_obj, socketpool_socket_b //| def close(self) -> None: //| """Closes this Socket and makes its resources available to its SocketPool.""" -//| -STATIC mp_obj_t socketpool_socket_close(mp_obj_t self_in) { +STATIC mp_obj_t _socketpool_socket_close(mp_obj_t self_in) { socketpool_socket_obj_t *self = MP_OBJ_TO_PTR(self_in); common_hal_socketpool_socket_close(self); return mp_const_none; } -STATIC MP_DEFINE_CONST_FUN_OBJ_1(socketpool_socket_close_obj, socketpool_socket_close); +STATIC MP_DEFINE_CONST_FUN_OBJ_1(socketpool_socket_close_obj, _socketpool_socket_close); //| def connect(self, address: Tuple[str, int]) -> None: //| """Connect a socket to a remote address //| //| :param ~tuple address: tuple of (remote_address, remote_port)""" //| ... -//| STATIC mp_obj_t socketpool_socket_connect(mp_obj_t self_in, mp_obj_t addr_in) { socketpool_socket_obj_t *self = MP_OBJ_TO_PTR(self_in); @@ -155,9 +148,8 @@ STATIC MP_DEFINE_CONST_FUN_OBJ_2(socketpool_socket_connect_obj, socketpool_socke //| def listen(self, backlog: int) -> None: //| """Set socket to listen for incoming connections //| -//| :param ~int backlog: length of backlog queue for waiting connetions""" +//| :param ~int backlog: length of backlog queue for waiting connections""" //| ... -//| STATIC mp_obj_t socketpool_socket_listen(mp_obj_t self_in, mp_obj_t backlog_in) { socketpool_socket_obj_t *self = MP_OBJ_TO_PTR(self_in); @@ -177,14 +169,13 @@ STATIC MP_DEFINE_CONST_FUN_OBJ_2(socketpool_socket_listen_obj, socketpool_socket //| //| :param object buffer: buffer to read into""" //| ... -//| STATIC mp_obj_t socketpool_socket_recvfrom_into(mp_obj_t self_in, mp_obj_t data_in) { socketpool_socket_obj_t *self = MP_OBJ_TO_PTR(self_in); mp_buffer_info_t bufinfo; mp_get_buffer_raise(data_in, &bufinfo, MP_BUFFER_WRITE); byte ip[4]; - mp_uint_t port; + uint32_t port; mp_int_t ret = common_hal_socketpool_socket_recvfrom_into(self, (byte *)bufinfo.buf, bufinfo.len, ip, &port); mp_obj_t tuple_contents[2]; @@ -207,8 +198,7 @@ STATIC MP_DEFINE_CONST_FUN_OBJ_2(socketpool_socket_recvfrom_into_obj, socketpool //| :param bytearray buffer: buffer to receive into //| :param int bufsize: optionally, a maximum number of bytes to read.""" //| ... -//| -STATIC mp_obj_t socketpool_socket_recv_into(size_t n_args, const mp_obj_t *args) { +STATIC mp_obj_t _socketpool_socket_recv_into(size_t n_args, const mp_obj_t *args) { socketpool_socket_obj_t *self = MP_OBJ_TO_PTR(args[0]); if (common_hal_socketpool_socket_get_closed(self)) { // Bad file number. @@ -238,7 +228,7 @@ STATIC mp_obj_t socketpool_socket_recv_into(size_t n_args, const mp_obj_t *args) mp_int_t ret = common_hal_socketpool_socket_recv_into(self, (byte *)bufinfo.buf, len); return mp_obj_new_int_from_uint(ret); } -STATIC MP_DEFINE_CONST_FUN_OBJ_VAR_BETWEEN(socketpool_socket_recv_into_obj, 2, 3, socketpool_socket_recv_into); +STATIC MP_DEFINE_CONST_FUN_OBJ_VAR_BETWEEN(socketpool_socket_recv_into_obj, 2, 3, _socketpool_socket_recv_into); //| def send(self, bytes: ReadableBuffer) -> int: //| """Send some bytes to the connected remote address. @@ -246,8 +236,7 @@ STATIC MP_DEFINE_CONST_FUN_OBJ_VAR_BETWEEN(socketpool_socket_recv_into_obj, 2, 3 //| //| :param ~bytes bytes: some bytes to send""" //| ... -//| -STATIC mp_obj_t socketpool_socket_send(mp_obj_t self_in, mp_obj_t buf_in) { +STATIC mp_obj_t _socketpool_socket_send(mp_obj_t self_in, mp_obj_t buf_in) { socketpool_socket_obj_t *self = MP_OBJ_TO_PTR(self_in); if (common_hal_socketpool_socket_get_closed(self)) { // Bad file number. @@ -264,7 +253,7 @@ STATIC mp_obj_t socketpool_socket_send(mp_obj_t self_in, mp_obj_t buf_in) { } return mp_obj_new_int_from_uint(ret); } -STATIC MP_DEFINE_CONST_FUN_OBJ_2(socketpool_socket_send_obj, socketpool_socket_send); +STATIC MP_DEFINE_CONST_FUN_OBJ_2(socketpool_socket_send_obj, _socketpool_socket_send); //| def sendto(self, bytes: ReadableBuffer, address: Tuple[str, int]) -> int: //| """Send some bytes to a specific address. @@ -273,7 +262,6 @@ STATIC MP_DEFINE_CONST_FUN_OBJ_2(socketpool_socket_send_obj, socketpool_socket_s //| :param ~bytes bytes: some bytes to send //| :param ~tuple address: tuple of (remote_address, remote_port)""" //| ... -//| STATIC mp_obj_t socketpool_socket_sendto(mp_obj_t self_in, mp_obj_t data_in, mp_obj_t addr_in) { socketpool_socket_obj_t *self = MP_OBJ_TO_PTR(self_in); @@ -302,7 +290,6 @@ STATIC MP_DEFINE_CONST_FUN_OBJ_3(socketpool_socket_sendto_obj, socketpool_socket //| //| :param ~bool flag: False means non-blocking, True means block indefinitely.""" //| ... -//| // method socket.setblocking(flag) STATIC mp_obj_t socketpool_socket_setblocking(mp_obj_t self_in, mp_obj_t blocking) { socketpool_socket_obj_t *self = MP_OBJ_TO_PTR(self_in); diff --git a/shared-bindings/socketpool/Socket.h b/shared-bindings/socketpool/Socket.h index 1f4ab6fc35..c6c2a66630 100644 --- a/shared-bindings/socketpool/Socket.h +++ b/shared-bindings/socketpool/Socket.h @@ -47,4 +47,11 @@ mp_uint_t common_hal_socketpool_socket_sendto(socketpool_socket_obj_t *self, const char *host, size_t hostlen, uint32_t port, const uint8_t *buf, uint32_t len); void common_hal_socketpool_socket_settimeout(socketpool_socket_obj_t *self, uint32_t timeout_ms); +// Non-allocating versions for internal use. +int socketpool_socket_accept(socketpool_socket_obj_t *self, uint8_t *ip, uint32_t *port); +void socketpool_socket_close(socketpool_socket_obj_t *self); +int socketpool_socket_send(socketpool_socket_obj_t *self, const uint8_t *buf, uint32_t len); +int socketpool_socket_recv_into(socketpool_socket_obj_t *self, + const uint8_t *buf, uint32_t len); + #endif // MICROPY_INCLUDED_SHARED_BINDINGS_SOCKETPOOL_SOCKET_H diff --git a/shared-bindings/socketpool/SocketPool.c b/shared-bindings/socketpool/SocketPool.c index 447d2d7d78..e500784f1f 100644 --- a/shared-bindings/socketpool/SocketPool.c +++ b/shared-bindings/socketpool/SocketPool.c @@ -38,11 +38,20 @@ //| class SocketPool: //| """A pool of socket resources available for the given radio. Only one -//| SocketPool can be created for each radio. +//| SocketPool can be created for each radio. //| -//| SocketPool should be used in place of CPython's socket which provides -//| a pool of sockets provided by the underlying OS.""" +//| SocketPool should be used in place of CPython's socket which provides +//| a pool of sockets provided by the underlying OS. +//| """ //| +//| def __init__(self, radio: wifi.Radio) -> None: +//| """Create a new SocketPool object for the provided radio +//| +//| :param wifi.Radio radio: The (connected) network hardware to associate +//| with this SocketPool; currently, this will always be the object +//| returned by :py:attr:`wifi.radio` +//| """ +//| ... STATIC mp_obj_t socketpool_socketpool_make_new(const mp_obj_type_t *type, size_t n_args, size_t n_kw, const mp_obj_t *args) { mp_arg_check_num(n_args, n_kw, 1, 1, false); @@ -72,7 +81,6 @@ STATIC mp_obj_t socketpool_socketpool_make_new(const mp_obj_type_t *type, size_t //| in CPython are not supported. //| """ //| ... -//| STATIC mp_obj_t socketpool_socketpool_socket(size_t n_args, const mp_obj_t *pos_args, mp_map_t *kw_args) { enum { ARG_family, ARG_type }; static const mp_arg_t allowed_args[] = { @@ -91,7 +99,15 @@ 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(self, host: str, port: int, family: int = 0, type: int = 0, proto: int = 0, flags: int = 0) -> Tuple[int, int, int, str, Tuple[str, int]]: +//| def getaddrinfo( +//| self, +//| 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/socketpool/SocketPool.h b/shared-bindings/socketpool/SocketPool.h index 10a943d38b..92382078e1 100644 --- a/shared-bindings/socketpool/SocketPool.h +++ b/shared-bindings/socketpool/SocketPool.h @@ -52,4 +52,10 @@ socketpool_socket_obj_t *common_hal_socketpool_socket(socketpool_socketpool_obj_ mp_obj_t common_hal_socketpool_socketpool_gethostbyname(socketpool_socketpool_obj_t *self, const char *host); +// Non-allocating version for internal use. These sockets are not registered and, therefore, not +// closed automatically. +bool socketpool_socket(socketpool_socketpool_obj_t *self, + socketpool_socketpool_addressfamily_t family, socketpool_socketpool_sock_t type, + socketpool_socket_obj_t *sock); + #endif // MICROPY_INCLUDED_SHARED_BINDINGS_SOCKETPOOL_SOCKETPOOL_H diff --git a/shared-bindings/socketpool/__init__.c b/shared-bindings/socketpool/__init__.c index fee81f2820..48cc00245f 100644 --- a/shared-bindings/socketpool/__init__.c +++ b/shared-bindings/socketpool/__init__.c @@ -39,7 +39,6 @@ //| For more information about the `socket` module, see the CPython documentation: //| https://docs.python.org/3/library/socket.html //| """ -//| STATIC const mp_rom_map_elem_t socketpool_globals_table[] = { { MP_ROM_QSTR(MP_QSTR___name__), MP_ROM_QSTR(MP_QSTR_socketpool) }, diff --git a/shared-bindings/socketpool/__init__.h b/shared-bindings/socketpool/__init__.h index a017e96c6d..46034f257d 100644 --- a/shared-bindings/socketpool/__init__.h +++ b/shared-bindings/socketpool/__init__.h @@ -27,4 +27,6 @@ #ifndef MICROPY_INCLUDED_SHARED_BINDINGS_SOCKETPOOL___INIT___H #define MICROPY_INCLUDED_SHARED_BINDINGS_SOCKETPOOL___INIT___H +void socketpool_user_reset(void); + #endif // MICROPY_INCLUDED_SHARED_BINDINGS_SOCKETPOOL___INIT___H diff --git a/shared-bindings/ssl/SSLContext.c b/shared-bindings/ssl/SSLContext.c index 5dfa5e599f..ac5f7ad42d 100644 --- a/shared-bindings/ssl/SSLContext.c +++ b/shared-bindings/ssl/SSLContext.c @@ -27,6 +27,7 @@ #include #include +#include "extmod/vfs.h" #include "py/objtuple.h" #include "py/objlist.h" #include "py/objproperty.h" @@ -37,8 +38,8 @@ //| class SSLContext: //| """Settings related to SSL that can be applied to a socket by wrapping it. -//| This is useful to provide SSL certificates to specific connections -//| rather than all of them.""" +//| This is useful to provide SSL certificates to specific connections +//| rather than all of them.""" //| STATIC mp_obj_t ssl_sslcontext_make_new(const mp_obj_type_t *type, size_t n_args, size_t n_kw, const mp_obj_t *args) { @@ -52,10 +53,50 @@ 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 load_cert_chain(self, certfile: str, keyfile: str) -> None: +//| """Load a private key and the corresponding certificate. +//| +//| The certfile string must be the path to a single file in PEM format +//| containing the certificate as well as any number of CA certificates +//| needed to establish the certificate's authenticity. The keyfile string +//| must point to a file containing the private key. +//| """ + +STATIC void get_file_contents(mp_obj_t name_obj, mp_buffer_info_t *bufinfo) { + mp_obj_t file = mp_call_function_2(MP_OBJ_FROM_PTR(&mp_builtin_open_obj), name_obj, MP_OBJ_NEW_QSTR(MP_QSTR_rb)); + mp_obj_t dest[2]; + mp_load_method(file, MP_QSTR_read, dest); + mp_obj_t result = mp_call_method_n_kw(0, 0, dest); + mp_get_buffer_raise(result, bufinfo, MP_BUFFER_READ); +} + +STATIC mp_obj_t ssl_sslcontext_load_cert_chain(size_t n_args, const mp_obj_t *pos_args, mp_map_t *kw_args) { + enum { ARG_certfile, ARG_keyfile }; + static const mp_arg_t allowed_args[] = { + { MP_QSTR_certfile, MP_ARG_REQUIRED | MP_ARG_OBJ, {.u_obj = mp_const_none} }, + { MP_QSTR_keyfile, MP_ARG_OBJ, {.u_obj = mp_const_none} }, + }; + ssl_sslcontext_obj_t *self = MP_OBJ_TO_PTR(pos_args[0]); + + mp_arg_val_t args[MP_ARRAY_SIZE(allowed_args)]; + mp_arg_parse_all(n_args - 1, pos_args + 1, kw_args, MP_ARRAY_SIZE(allowed_args), allowed_args, args); + + mp_buffer_info_t cert_buf, key_buf; + get_file_contents(args[ARG_certfile].u_obj, &cert_buf); + if (args[ARG_keyfile].u_obj != mp_const_none) { + get_file_contents(args[ARG_keyfile].u_obj, &key_buf); + } else { + key_buf = cert_buf; + } + + common_hal_ssl_sslcontext_load_cert_chain(self, &cert_buf, &key_buf); + return mp_const_none; +} +STATIC MP_DEFINE_CONST_FUN_OBJ_KW(ssl_sslcontext_load_cert_chain_obj, 1, ssl_sslcontext_load_cert_chain); + //| def load_verify_locations(self, cadata: Optional[str] = None) -> None: //| """Load a set of certification authority (CA) certificates used to validate -//| other peers' certificates.""" -//| +//| other peers' certificates.""" STATIC mp_obj_t ssl_sslcontext_load_verify_locations(size_t n_args, const mp_obj_t *pos_args, mp_map_t *kw_args) { enum { ARG_cadata }; @@ -76,7 +117,6 @@ STATIC MP_DEFINE_CONST_FUN_OBJ_KW(ssl_sslcontext_load_verify_locations_obj, 1, s //| def set_default_verify_paths(self) -> None: //| """Load a set of default certification authority (CA) certificates.""" -//| STATIC mp_obj_t ssl_sslcontext_set_default_verify_paths(size_t n_args, const mp_obj_t *pos_args, mp_map_t *kw_args) { ssl_sslcontext_obj_t *self = MP_OBJ_TO_PTR(pos_args[0]); @@ -88,7 +128,6 @@ STATIC MP_DEFINE_CONST_FUN_OBJ_KW(ssl_sslcontext_set_default_verify_paths_obj, 1 //| check_hostname: bool //| """Whether to match the peer certificate's hostname.""" -//| STATIC mp_obj_t ssl_sslcontext_get_check_hostname(mp_obj_t self_in) { ssl_sslcontext_obj_t *self = MP_OBJ_TO_PTR(self_in); @@ -109,9 +148,15 @@ MP_PROPERTY_GETSET(ssl_sslcontext_check_hostname_obj, (mp_obj_t)&ssl_sslcontext_get_check_hostname_obj, (mp_obj_t)&ssl_sslcontext_set_check_hostname_obj); -//| def wrap_socket(self, sock: socketpool.Socket, *, server_side: bool = False, server_hostname: Optional[str] = None) -> ssl.SSLSocket: +//| def wrap_socket( +//| self, +//| sock: socketpool.Socket, +//| *, +//| server_side: bool = False, +//| server_hostname: Optional[str] = None +//| ) -> ssl.SSLSocket: //| """Wraps the socket into a socket-compatible class that handles SSL negotiation. -//| The socket must be of type SOCK_STREAM.""" +//| The socket must be of type SOCK_STREAM.""" //| STATIC mp_obj_t ssl_sslcontext_wrap_socket(size_t n_args, const mp_obj_t *pos_args, mp_map_t *kw_args) { @@ -143,6 +188,7 @@ STATIC MP_DEFINE_CONST_FUN_OBJ_KW(ssl_sslcontext_wrap_socket_obj, 1, ssl_sslcont STATIC const mp_rom_map_elem_t ssl_sslcontext_locals_dict_table[] = { { MP_ROM_QSTR(MP_QSTR_wrap_socket), MP_ROM_PTR(&ssl_sslcontext_wrap_socket_obj) }, + { MP_ROM_QSTR(MP_QSTR_load_cert_chain), MP_ROM_PTR(&ssl_sslcontext_load_cert_chain_obj) }, { MP_ROM_QSTR(MP_QSTR_load_verify_locations), MP_ROM_PTR(&ssl_sslcontext_load_verify_locations_obj) }, { MP_ROM_QSTR(MP_QSTR_set_default_verify_paths), MP_ROM_PTR(&ssl_sslcontext_set_default_verify_paths_obj) }, { MP_ROM_QSTR(MP_QSTR_check_hostname), MP_ROM_PTR(&ssl_sslcontext_check_hostname_obj) }, diff --git a/shared-bindings/ssl/SSLContext.h b/shared-bindings/ssl/SSLContext.h index ef04f25d43..9f40badd85 100644 --- a/shared-bindings/ssl/SSLContext.h +++ b/shared-bindings/ssl/SSLContext.h @@ -46,5 +46,6 @@ void common_hal_ssl_sslcontext_set_default_verify_paths(ssl_sslcontext_obj_t *se bool common_hal_ssl_sslcontext_get_check_hostname(ssl_sslcontext_obj_t *self); void common_hal_ssl_sslcontext_set_check_hostname(ssl_sslcontext_obj_t *self, bool value); +void common_hal_ssl_sslcontext_load_cert_chain(ssl_sslcontext_obj_t *self, mp_buffer_info_t *cert_buf, mp_buffer_info_t *key_buf); #endif // MICROPY_INCLUDED_SHARED_BINDINGS_SSL_SSLCONTEXT_H diff --git a/shared-bindings/ssl/SSLSocket.c b/shared-bindings/ssl/SSLSocket.c index 630ab28c68..d6f4ad051c 100644 --- a/shared-bindings/ssl/SSLSocket.c +++ b/shared-bindings/ssl/SSLSocket.c @@ -39,29 +39,26 @@ //| class SSLSocket: //| """Implements TLS security on a subset of `socketpool.Socket` functions. Cannot be created -//| directly. Instead, call `wrap_socket` on an existing socket object. +//| directly. Instead, call `wrap_socket` on an existing socket object. //| -//| Provides a subset of CPython's `ssl.SSLSocket` API. It only implements the versions of -//| recv that do not allocate bytes objects.""" +//| Provides a subset of CPython's `ssl.SSLSocket` API. It only implements the versions of +//| recv that do not allocate bytes objects.""" //| //| def __hash__(self) -> int: //| """Returns a hash for the Socket.""" //| ... -//| // Provided by mp_generic_unary_op(). //| def __enter__(self) -> SSLSocket: //| """No-op used by Context Managers.""" //| ... -//| // Provided by context manager helper. //| def __exit__(self) -> None: //| """Automatically closes the Socket when exiting a context. See //| :ref:`lifetime-and-contextmanagers` for more info.""" //| ... -//| STATIC mp_obj_t ssl_sslsocket___exit__(size_t n_args, const mp_obj_t *args) { (void)n_args; common_hal_ssl_sslsocket_close(args[0]); @@ -73,7 +70,6 @@ STATIC MP_DEFINE_CONST_FUN_OBJ_VAR_BETWEEN(ssl_sslsocket___exit___obj, 4, 4, ssl //| """Accept a connection on a listening socket of type SOCK_STREAM, //| creating a new socket of type SOCK_STREAM. //| Returns a tuple of (new_socket, remote_address)""" -//| STATIC mp_obj_t ssl_sslsocket_accept(mp_obj_t self_in) { ssl_sslsocket_obj_t *self = MP_OBJ_TO_PTR(self_in); uint8_t ip[4]; @@ -93,7 +89,6 @@ STATIC MP_DEFINE_CONST_FUN_OBJ_1(ssl_sslsocket_accept_obj, ssl_sslsocket_accept) //| //| :param ~tuple address: tuple of (remote_address, remote_port)""" //| ... -//| STATIC mp_obj_t ssl_sslsocket_bind(mp_obj_t self_in, mp_obj_t addr_in) { ssl_sslsocket_obj_t *self = MP_OBJ_TO_PTR(self_in); @@ -118,7 +113,6 @@ STATIC MP_DEFINE_CONST_FUN_OBJ_2(ssl_sslsocket_bind_obj, ssl_sslsocket_bind); //| def close(self) -> None: //| """Closes this Socket""" -//| STATIC mp_obj_t ssl_sslsocket_close(mp_obj_t self_in) { ssl_sslsocket_obj_t *self = MP_OBJ_TO_PTR(self_in); common_hal_ssl_sslsocket_close(self); @@ -131,7 +125,6 @@ STATIC MP_DEFINE_CONST_FUN_OBJ_1(ssl_sslsocket_close_obj, ssl_sslsocket_close); //| //| :param ~tuple address: tuple of (remote_address, remote_port)""" //| ... -//| STATIC mp_obj_t ssl_sslsocket_connect(mp_obj_t self_in, mp_obj_t addr_in) { ssl_sslsocket_obj_t *self = MP_OBJ_TO_PTR(self_in); @@ -156,7 +149,6 @@ STATIC MP_DEFINE_CONST_FUN_OBJ_2(ssl_sslsocket_connect_obj, ssl_sslsocket_connec //| //| :param ~int backlog: length of backlog queue for waiting connetions""" //| ... -//| STATIC mp_obj_t ssl_sslsocket_listen(mp_obj_t self_in, mp_obj_t backlog_in) { ssl_sslsocket_obj_t *self = MP_OBJ_TO_PTR(self_in); @@ -180,7 +172,6 @@ STATIC MP_DEFINE_CONST_FUN_OBJ_2(ssl_sslsocket_listen_obj, ssl_sslsocket_listen) //| :param bytearray buffer: buffer to receive into //| :param int bufsize: optionally, a maximum number of bytes to read.""" //| ... -//| STATIC mp_obj_t ssl_sslsocket_recv_into(size_t n_args, const mp_obj_t *args) { ssl_sslsocket_obj_t *self = MP_OBJ_TO_PTR(args[0]); if (common_hal_ssl_sslsocket_get_closed(self)) { @@ -219,7 +210,6 @@ STATIC MP_DEFINE_CONST_FUN_OBJ_VAR_BETWEEN(ssl_sslsocket_recv_into_obj, 2, 3, ss //| //| :param ~bytes bytes: some bytes to send""" //| ... -//| STATIC mp_obj_t ssl_sslsocket_send(mp_obj_t self_in, mp_obj_t buf_in) { ssl_sslsocket_obj_t *self = MP_OBJ_TO_PTR(self_in); if (common_hal_ssl_sslsocket_get_closed(self)) { @@ -252,7 +242,6 @@ STATIC MP_DEFINE_CONST_FUN_OBJ_2(ssl_sslsocket_send_obj, ssl_sslsocket_send); //| //| :param ~int value: timeout in seconds. 0 means non-blocking. None means block indefinitely.""" //| ... -//| STATIC mp_obj_t ssl_sslsocket_settimeout(mp_obj_t self_in, mp_obj_t timeout_in) { ssl_sslsocket_obj_t *self = MP_OBJ_TO_PTR(self_in); mp_uint_t timeout_ms; diff --git a/shared-bindings/ssl/SSLSocket.h b/shared-bindings/ssl/SSLSocket.h index d6519340d9..0c303e44c7 100644 --- a/shared-bindings/ssl/SSLSocket.h +++ b/shared-bindings/ssl/SSLSocket.h @@ -38,7 +38,7 @@ void common_hal_ssl_sslsocket_connect(ssl_sslsocket_obj_t *self, const char *hos bool common_hal_ssl_sslsocket_get_closed(ssl_sslsocket_obj_t *self); bool common_hal_ssl_sslsocket_get_connected(ssl_sslsocket_obj_t *self); bool common_hal_ssl_sslsocket_listen(ssl_sslsocket_obj_t *self, int backlog); -mp_uint_t common_hal_ssl_sslsocket_recv_into(ssl_sslsocket_obj_t *self, const uint8_t *buf, uint32_t len); +mp_uint_t common_hal_ssl_sslsocket_recv_into(ssl_sslsocket_obj_t *self, uint8_t *buf, uint32_t len); mp_uint_t common_hal_ssl_sslsocket_send(ssl_sslsocket_obj_t *self, const uint8_t *buf, uint32_t len); void common_hal_ssl_sslsocket_settimeout(ssl_sslsocket_obj_t *self, uint32_t timeout_ms); diff --git a/shared-bindings/ssl/__init__.c b/shared-bindings/ssl/__init__.c index 6967860054..9204c92790 100644 --- a/shared-bindings/ssl/__init__.c +++ b/shared-bindings/ssl/__init__.c @@ -36,7 +36,6 @@ //| //| |see_cpython_module| :mod:`cpython:ssl`. //| """ -//| //| def create_default_context() -> ssl.SSLContext: //| """Return the default SSLContext.""" diff --git a/shared-bindings/storage/__init__.c b/shared-bindings/storage/__init__.c index 277c8343e0..3661b61973 100644 --- a/shared-bindings/storage/__init__.c +++ b/shared-bindings/storage/__init__.c @@ -33,7 +33,7 @@ #include "py/objnamedtuple.h" #include "py/runtime.h" #include "shared-bindings/storage/__init__.h" -#include "supervisor/shared/translate.h" +#include "supervisor/shared/translate/translate.h" //| """Storage management //| @@ -41,13 +41,12 @@ //| unmounting which is typically handled by the operating system hosting Python. //| CircuitPython does not have an OS, so this module provides this functionality //| directly. - +//| //| For more information regarding using the `storage` module, refer to the `CircuitPython //| Essentials Learn guide //| `_. //| """ //| - //| def mount(filesystem: VfsFat, mount_path: str, *, readonly: bool = False) -> None: //| """Mounts the given filesystem object at the given path. //| @@ -107,15 +106,20 @@ STATIC mp_obj_t storage_umount(mp_obj_t mnt_in) { } MP_DEFINE_CONST_FUN_OBJ_1(storage_umount_obj, storage_umount); -//| def remount(mount_path: str, readonly: bool = False, *, disable_concurrent_write_protection: bool = False) -> None: +//| def remount( +//| mount_path: str, +//| readonly: bool = False, +//| *, +//| disable_concurrent_write_protection: bool = False +//| ) -> None: //| """Remounts the given path with new parameters. //| -//| :param str mount_path: The path to remount. -//| :param bool readonly: True when the filesystem should be readonly to CircuitPython. -//| :param bool disable_concurrent_write_protection: When True, the check that makes sure the -//| underlying filesystem data is written by one computer is disabled. Disabling the protection -//| allows CircuitPython and a host to write to the same filesystem with the risk that the -//| filesystem will be corrupted.""" +//| :param str mount_path: The path to remount. +//| :param bool readonly: True when the filesystem should be readonly to CircuitPython. +//| :param bool disable_concurrent_write_protection: When True, the check that makes sure the +//| underlying filesystem data is written by one computer is disabled. Disabling the protection +//| allows CircuitPython and a host to write to the same filesystem with the risk that the +//| filesystem will be corrupted.""" //| ... //| STATIC mp_obj_t storage_remount(size_t n_args, const mp_obj_t *pos_args, mp_map_t *kw_args) { @@ -226,7 +230,6 @@ STATIC const mp_rom_map_elem_t storage_module_globals_table[] = { //| """Create a new VfsFat filesystem around the given block device. //| //| :param block_device: Block device the the filesystem lives on""" -//| //| label: str //| """The filesystem label, up to 11 case-insensitive bytes. Note that //| this property can only be set when the device is writable by the @@ -236,36 +239,30 @@ STATIC const mp_rom_map_elem_t storage_module_globals_table[] = { //| def mkfs(self) -> None: //| """Format the block device, deleting any data that may have been there""" //| ... -//| //| def open(self, path: str, mode: str) -> None: //| """Like builtin ``open()``""" //| ... -//| -//| def ilistdir(self, path: str) -> Iterator[Union[Tuple[AnyStr, int, int, int], Tuple[AnyStr, int, int]]]: +//| def ilistdir( +//| self, path: str +//| ) -> Iterator[Union[Tuple[AnyStr, int, int, int], Tuple[AnyStr, int, int]]]: //| """Return an iterator whose values describe files and folders within //| ``path``""" //| ... -//| //| def mkdir(self, path: str) -> None: //| """Like `os.mkdir`""" //| ... -//| //| def rmdir(self, path: str) -> None: //| """Like `os.rmdir`""" //| ... -//| //| def stat(self, path: str) -> Tuple[int, int, int, int, int, int, int, int, int, int]: //| """Like `os.stat`""" //| ... -//| //| def statvfs(self, path: int) -> Tuple[int, int, int, int, int, int, int, int, int, int]: //| """Like `os.statvfs`""" //| ... -//| //| def mount(self, readonly: bool, mkfs: VfsFat) -> None: //| """Don't call this directly, call `storage.mount`.""" //| ... -//| //| def umount(self) -> None: //| """Don't call this directly, call `storage.umount`.""" //| ... diff --git a/shared-bindings/struct/__init__.c b/shared-bindings/struct/__init__.c index c29c33c1c0..59bc78005d 100644 --- a/shared-bindings/struct/__init__.c +++ b/shared-bindings/struct/__init__.c @@ -36,7 +36,7 @@ #include "py/parsenum.h" #include "shared-bindings/struct/__init__.h" #include "shared-module/struct/__init__.h" -#include "supervisor/shared/translate.h" +#include "supervisor/shared/translate/translate.h" //| """Manipulation of c-style data //| @@ -46,7 +46,6 @@ //| //| Supported format codes: *b*, *B*, *x*, *h*, *H*, *i*, *I*, *l*, *L*, *q*, *Q*, //| *s*, *P*, *f*, *d* (the latter 2 depending on the floating-point support).""" -//| //| def calcsize(fmt: str) -> int: diff --git a/shared-bindings/supervisor/Runtime.c b/shared-bindings/supervisor/Runtime.c index 55217ec97a..4d8ddbacc7 100644 --- a/shared-bindings/supervisor/Runtime.c +++ b/shared-bindings/supervisor/Runtime.c @@ -33,6 +33,11 @@ #include "shared-bindings/supervisor/RunReason.h" #include "shared-bindings/supervisor/Runtime.h" +#include "supervisor/shared/reload.h" +#include "supervisor/shared/stack.h" +#include "supervisor/shared/status_leds.h" +#include "supervisor/shared/bluetooth/bluetooth.h" + #if (CIRCUITPY_USB) #include "tusb.h" #endif @@ -55,11 +60,9 @@ STATIC supervisor_run_reason_t _run_reason; //| """You cannot create an instance of `supervisor.Runtime`. //| Use `supervisor.runtime` to access the sole instance available.""" //| ... -//| //| usb_connected: bool //| """Returns the USB enumeration status (read-only).""" -//| STATIC mp_obj_t supervisor_runtime_get_usb_connected(mp_obj_t self) { #if CIRCUITPY_USB return mp_obj_new_bool(tud_ready()); @@ -74,7 +77,6 @@ MP_PROPERTY_GETTER(supervisor_runtime_usb_connected_obj, //| serial_connected: bool //| """Returns the USB serial communication status (read-only).""" -//| STATIC mp_obj_t supervisor_runtime_get_serial_connected(mp_obj_t self) { return mp_obj_new_bool(common_hal_supervisor_runtime_get_serial_connected()); } @@ -87,7 +89,6 @@ MP_PROPERTY_GETTER(supervisor_runtime_serial_connected_obj, //| """Returns the whether any bytes are available to read //| on the USB serial input. Allows for polling to see whether //| to call the built-in input() or wait. (read-only)""" -//| STATIC mp_obj_t supervisor_runtime_get_serial_bytes_available(mp_obj_t self) { return mp_obj_new_bool(common_hal_supervisor_runtime_get_serial_bytes_available()); } @@ -105,8 +106,7 @@ void supervisor_set_run_reason(supervisor_run_reason_t run_reason) { } //| run_reason: RunReason -//| """Returns why CircuitPython started running this particular time.""" -//| +//| """Why CircuitPython started running this particular time.""" STATIC mp_obj_t supervisor_runtime_get_run_reason(mp_obj_t self) { return cp_enum_find(&supervisor_run_reason_type, _run_reason); } @@ -115,11 +115,113 @@ MP_DEFINE_CONST_FUN_OBJ_1(supervisor_runtime_get_run_reason_obj, supervisor_runt MP_PROPERTY_GETTER(supervisor_runtime_run_reason_obj, (mp_obj_t)&supervisor_runtime_get_run_reason_obj); +//| autoreload: bool +//| """Whether CircuitPython may autoreload based on workflow writes to the filesystem.""" +//| +STATIC mp_obj_t supervisor_runtime_get_autoreload(mp_obj_t self) { + return mp_obj_new_bool(autoreload_is_enabled()); +} +MP_DEFINE_CONST_FUN_OBJ_1(supervisor_runtime_get_autoreload_obj, supervisor_runtime_get_autoreload); + +STATIC mp_obj_t supervisor_runtime_set_autoreload(mp_obj_t self, mp_obj_t state_in) { + if (mp_obj_is_true(state_in)) { + autoreload_enable(); + } else { + autoreload_disable(); + } + return mp_const_none; +} +MP_DEFINE_CONST_FUN_OBJ_2(supervisor_runtime_set_autoreload_obj, supervisor_runtime_set_autoreload); + +MP_PROPERTY_GETSET(supervisor_runtime_autoreload_obj, + (mp_obj_t)&supervisor_runtime_get_autoreload_obj, + (mp_obj_t)&supervisor_runtime_set_autoreload_obj); + +//| ble_workflow: bool +//| """Enable/Disable ble workflow until a reset. This prevents BLE advertising outside of the VM and +//| the services used for it.""" +//| +STATIC mp_obj_t supervisor_runtime_get_ble_workflow(mp_obj_t self) { + #if CIRCUITPY_BLE_FILE_SERVICE && CIRCUITPY_SERIAL_BLE + return mp_obj_new_bool(supervisor_bluetooth_workflow_is_enabled()); + #else + return mp_const_false; + #endif +} +MP_DEFINE_CONST_FUN_OBJ_1(supervisor_runtime_get_ble_workflow_obj, supervisor_runtime_get_ble_workflow); + +STATIC mp_obj_t supervisor_runtime_set_ble_workflow(mp_obj_t self, mp_obj_t state_in) { + #if CIRCUITPY_BLE_FILE_SERVICE && CIRCUITPY_SERIAL_BLE + if (mp_obj_is_true(state_in)) { + supervisor_bluetooth_enable_workflow(); + } else { + supervisor_bluetooth_disable_workflow(); + } + #else + mp_raise_NotImplementedError(NULL); + #endif + return mp_const_none; +} +MP_DEFINE_CONST_FUN_OBJ_2(supervisor_runtime_set_ble_workflow_obj, supervisor_runtime_set_ble_workflow); + +MP_PROPERTY_GETSET(supervisor_runtime_ble_workflow_obj, + (mp_obj_t)&supervisor_runtime_get_ble_workflow_obj, + (mp_obj_t)&supervisor_runtime_set_ble_workflow_obj); + +//| next_stack_limit: int +//| """The size of the stack for the next vm run. If its too large, the default will be used.""" +//| +STATIC mp_obj_t supervisor_runtime_get_next_stack_limit(mp_obj_t self) { + return mp_obj_new_int(get_next_stack_size()); +} +MP_DEFINE_CONST_FUN_OBJ_1(supervisor_runtime_get_next_stack_limit_obj, supervisor_runtime_get_next_stack_limit); + +STATIC mp_obj_t supervisor_runtime_set_next_stack_limit(mp_obj_t self, mp_obj_t size_obj) { + mp_int_t size = mp_obj_get_int(size_obj); + mp_arg_validate_int_min(size, 256, MP_QSTR_size); + set_next_stack_size(size); + return mp_const_none; +} +MP_DEFINE_CONST_FUN_OBJ_2(supervisor_runtime_set_next_stack_limit_obj, supervisor_runtime_set_next_stack_limit); + +MP_PROPERTY_GETSET(supervisor_runtime_next_stack_limit_obj, + (mp_obj_t)&supervisor_runtime_get_next_stack_limit_obj, + (mp_obj_t)&supervisor_runtime_set_next_stack_limit_obj); + +//| rgb_status_brightness: int +//| """Set brightness of status RGB LED from 0-255. This will take effect +//| after the current code finishes and the status LED is used to show +//| the finish state.""" +//| +STATIC mp_obj_t supervisor_runtime_get_rgb_status_brightness(mp_obj_t self) { + return MP_OBJ_NEW_SMALL_INT(get_status_brightness()); +} +MP_DEFINE_CONST_FUN_OBJ_1(supervisor_runtime_get_rgb_status_brightness_obj, supervisor_runtime_get_rgb_status_brightness); + +STATIC mp_obj_t supervisor_runtime_set_rgb_status_brightness(mp_obj_t self, mp_obj_t lvl) { + #if CIRCUITPY_STATUS_LED + // This must be int. If cast to uint8_t first, will never raise a ValueError. + set_status_brightness((uint8_t)mp_arg_validate_int_range(mp_obj_get_int(lvl), 0, 255, MP_QSTR_brightness)); + #else + mp_raise_NotImplementedError(NULL); + #endif + return mp_const_none; +} +MP_DEFINE_CONST_FUN_OBJ_2(supervisor_runtime_set_rgb_status_brightness_obj, supervisor_runtime_set_rgb_status_brightness); + +MP_PROPERTY_GETSET(supervisor_runtime_rgb_status_brightness_obj, + (mp_obj_t)&supervisor_runtime_get_rgb_status_brightness_obj, + (mp_obj_t)&supervisor_runtime_set_rgb_status_brightness_obj); + STATIC const mp_rom_map_elem_t supervisor_runtime_locals_dict_table[] = { { MP_ROM_QSTR(MP_QSTR_usb_connected), MP_ROM_PTR(&supervisor_runtime_usb_connected_obj) }, { MP_ROM_QSTR(MP_QSTR_serial_connected), MP_ROM_PTR(&supervisor_runtime_serial_connected_obj) }, { MP_ROM_QSTR(MP_QSTR_serial_bytes_available), MP_ROM_PTR(&supervisor_runtime_serial_bytes_available_obj) }, { MP_ROM_QSTR(MP_QSTR_run_reason), MP_ROM_PTR(&supervisor_runtime_run_reason_obj) }, + { MP_ROM_QSTR(MP_QSTR_autoreload), MP_ROM_PTR(&supervisor_runtime_autoreload_obj) }, + { MP_ROM_QSTR(MP_QSTR_ble_workflow), MP_ROM_PTR(&supervisor_runtime_ble_workflow_obj) }, + { MP_ROM_QSTR(MP_QSTR_next_stack_limit), MP_ROM_PTR(&supervisor_runtime_next_stack_limit_obj) }, + { MP_ROM_QSTR(MP_QSTR_rgb_status_brightness), MP_ROM_PTR(&supervisor_runtime_rgb_status_brightness_obj) }, }; STATIC MP_DEFINE_CONST_DICT(supervisor_runtime_locals_dict, supervisor_runtime_locals_dict_table); diff --git a/shared-bindings/supervisor/StatusBar.c b/shared-bindings/supervisor/StatusBar.c new file mode 100644 index 0000000000..8db1906f5e --- /dev/null +++ b/shared-bindings/supervisor/StatusBar.c @@ -0,0 +1,125 @@ +/* + * This file is part of the MicroPython project, http://micropython.org/ + * + * The MIT License (MIT) + * + * Copyright (c) 2022 by Dan Halbert for Adafruit Industries + * + * Permission is hereby granted, free of charge, to any person obtaining a copy + * of this software and associated documentation files (the "Software"), to deal + * in the Software without restriction, including without limitation the rights + * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell + * copies of the Software, and to permit persons to whom the Software is + * furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice shall be included in + * all copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE + * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER + * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, + * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN + * THE SOFTWARE. + */ + +#include +#include "py/obj.h" +#include "py/enum.h" +#include "py/runtime.h" +#include "py/objproperty.h" +#include "shared-bindings/supervisor/StatusBar.h" + +//| class StatusBar: +//| """Current status of runtime objects. +//| +//| Usage:: +//| +//| import supervisor +//| +//| supervisor.status_bar.console = False +//| """ +//| + +//| def __init__(self) -> None: +//| """You cannot create an instance of `supervisor.StatusBar`. +//| Use `supervisor.status_bar` to access the sole instance available.""" +//| ... + +//| console: bool +//| """Whether status bar information is sent over the console (REPL) serial connection, +//| using OSC terminal escape codes that change the terminal's title. Default is ``True``. +//| If set to ``False``, status bar will be cleared and then disabled. +//| May be set in ``boot.py`` or later. Persists across soft restarts. +//| """ +STATIC mp_obj_t supervisor_status_bar_get_console(mp_obj_t self_in) { + #if CIRCUITPY_STATUS_BAR + supervisor_status_bar_obj_t *self = MP_OBJ_TO_PTR(self_in); + return mp_obj_new_bool(shared_module_supervisor_status_bar_get_console(self)); + #else + mp_raise_NotImplementedError(NULL); + #endif +} +MP_DEFINE_CONST_FUN_OBJ_1(supervisor_status_bar_get_console_obj, supervisor_status_bar_get_console); + +STATIC mp_obj_t supervisor_status_bar_set_console(mp_obj_t self_in, mp_obj_t state_in) { + #if CIRCUITPY_STATUS_BAR + supervisor_status_bar_obj_t *self = MP_OBJ_TO_PTR(self_in); + shared_module_supervisor_status_bar_set_console(self, mp_obj_is_true(state_in)); + return mp_const_none; + #else + mp_raise_NotImplementedError(NULL); + #endif +} +MP_DEFINE_CONST_FUN_OBJ_2(supervisor_status_bar_set_console_obj, supervisor_status_bar_set_console); + +MP_PROPERTY_GETSET(supervisor_status_bar_console_obj, + (mp_obj_t)&supervisor_status_bar_get_console_obj, + (mp_obj_t)&supervisor_status_bar_set_console_obj); + +//| display: bool +//| """Whether status bar information is displayed on the top line of the display. +//| Default is ``True``. If set to ``False``, status bar will be cleared and then disabled. +//| May be set in ``boot.py`` or later. Persists across soft restarts. +//| Not available if `terminalio` is not available. +//| """ +//| +STATIC mp_obj_t supervisor_status_bar_get_display(mp_obj_t self_in) { + #if CIRCUITPY_STATUS_BAR && CIRCUITPY_TERMINALIO + supervisor_status_bar_obj_t *self = MP_OBJ_TO_PTR(self_in); + return mp_obj_new_bool(shared_module_supervisor_status_bar_get_display(self)); + #else + mp_raise_NotImplementedError(NULL); + #endif +} +MP_DEFINE_CONST_FUN_OBJ_1(supervisor_status_bar_get_display_obj, supervisor_status_bar_get_display); + +STATIC mp_obj_t supervisor_status_bar_set_display(mp_obj_t self_in, mp_obj_t state_in) { + #if CIRCUITPY_STATUS_BAR && CIRCUITPY_TERMINALIO + supervisor_status_bar_obj_t *self = MP_OBJ_TO_PTR(self_in); + shared_module_supervisor_status_bar_set_display(self, mp_obj_is_true(state_in)); + return mp_const_none; + #else + mp_raise_NotImplementedError(NULL); + #endif +} +MP_DEFINE_CONST_FUN_OBJ_2(supervisor_status_bar_set_display_obj, supervisor_status_bar_set_display); + +MP_PROPERTY_GETSET(supervisor_status_bar_display_obj, + (mp_obj_t)&supervisor_status_bar_get_display_obj, + (mp_obj_t)&supervisor_status_bar_set_display_obj); + + +STATIC const mp_rom_map_elem_t supervisor_status_bar_locals_dict_table[] = { + { MP_ROM_QSTR(MP_QSTR_console), MP_ROM_PTR(&supervisor_status_bar_console_obj) }, + { MP_ROM_QSTR(MP_QSTR_display), MP_ROM_PTR(&supervisor_status_bar_display_obj) }, +}; + +STATIC MP_DEFINE_CONST_DICT(supervisor_status_bar_locals_dict, supervisor_status_bar_locals_dict_table); + +const mp_obj_type_t supervisor_status_bar_type = { + .base = { &mp_type_type }, + .name = MP_QSTR_Status_Bar, + .locals_dict = (mp_obj_dict_t *)&supervisor_status_bar_locals_dict, +}; diff --git a/shared-bindings/supervisor/StatusBar.h b/shared-bindings/supervisor/StatusBar.h new file mode 100644 index 0000000000..12b337ea84 --- /dev/null +++ b/shared-bindings/supervisor/StatusBar.h @@ -0,0 +1,42 @@ +/* + * This file is part of the MicroPython project, http://micropython.org/ + * + * The MIT License (MIT) + * + * Copyright (c) 2022 by Dan Halbert 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_SHARED_BINDINGS_STATUS_BAR_STATUS_H +#define MICROPY_INCLUDED_SHARED_BINDINGS_STATUS_BAR_STATUS_H + +#include +#include "py/obj.h" +#include "shared-module/supervisor/StatusBar.h" + +extern const mp_obj_type_t supervisor_status_bar_type; + +bool shared_module_supervisor_status_bar_get_console(supervisor_status_bar_obj_t *self); +void shared_module_supervisor_status_bar_set_console(supervisor_status_bar_obj_t *self, bool enabled); + +bool shared_module_supervisor_status_bar_get_display(supervisor_status_bar_obj_t *self); +void shared_module_supervisor_status_bar_set_display(supervisor_status_bar_obj_t *self, bool enabled); + +#endif // MICROPY_INCLUDED_SHARED_BINDINGS_SUPERVISOR_STATUS_BAR_H diff --git a/shared-bindings/supervisor/__init__.c b/shared-bindings/supervisor/__init__.c index 0b86b7b2a6..b61d05d636 100644 --- a/shared-bindings/supervisor/__init__.c +++ b/shared-bindings/supervisor/__init__.c @@ -30,64 +30,35 @@ #include "py/objstr.h" #include "shared/runtime/interrupt_char.h" -#include "supervisor/shared/bluetooth/bluetooth.h" #include "supervisor/shared/display.h" -#include "supervisor/shared/status_leds.h" #include "supervisor/shared/reload.h" -#include "supervisor/shared/stack.h" #include "supervisor/shared/traceback.h" -#include "supervisor/shared/translate.h" +#include "supervisor/shared/translate/translate.h" #include "supervisor/shared/workflow.h" +#if CIRCUITPY_USB_IDENTIFICATION +#include "supervisor/usb.h" +#endif + #include "shared-bindings/microcontroller/__init__.h" #include "shared-bindings/supervisor/__init__.h" #include "shared-bindings/time/__init__.h" #include "shared-bindings/supervisor/Runtime.h" +#include "shared-bindings/supervisor/StatusBar.h" //| """Supervisor settings""" -//| //| runtime: Runtime //| """Runtime information, such as ``runtime.serial_connected`` //| (USB serial connection status). //| This object is the sole instance of `supervisor.Runtime`.""" -//| -//| def enable_autoreload() -> None: -//| """Enable autoreload based on USB file write activity.""" -//| ... -//| -STATIC mp_obj_t supervisor_enable_autoreload(void) { - autoreload_enable(); - return mp_const_none; -} -MP_DEFINE_CONST_FUN_OBJ_0(supervisor_enable_autoreload_obj, supervisor_enable_autoreload); - -//| def disable_autoreload() -> None: -//| """Disable autoreload based on USB file write activity until -//| `enable_autoreload` is called.""" -//| ... -//| -STATIC mp_obj_t supervisor_disable_autoreload(void) { - autoreload_disable(); - return mp_const_none; -} -MP_DEFINE_CONST_FUN_OBJ_0(supervisor_disable_autoreload_obj, supervisor_disable_autoreload); - -//| def set_rgb_status_brightness(brightness: int) -> None: -//| """Set brightness of status RGB LED from 0-255. This will take effect -//| after the current code finishes and the status LED is used to show -//| the finish state.""" -//| ... -//| -STATIC mp_obj_t supervisor_set_rgb_status_brightness(mp_obj_t lvl) { - // This must be int. If cast to uint8_t first, will never raise a ValueError. - int brightness_int = mp_obj_get_int(lvl); - mp_arg_validate_int_range(brightness_int, 0, 255, MP_QSTR_brightness); - set_status_brightness((uint8_t)brightness_int); - return mp_const_none; -} -MP_DEFINE_CONST_FUN_OBJ_1(supervisor_set_rgb_status_brightness_obj, supervisor_set_rgb_status_brightness); +//| status_bar: StatusBar +//| """The status bar, shown on an attached display, and also sent to +//| an attached terminal via OSC escape codes over the REPL serial connection. +//| The status bar reports the current IP or BLE connection, what file is running, +//| the last exception name and location, and firmware version information. +//| This object is the sole instance of `supervisor.StatusBar`.""" //| def reload() -> None: //| """Reload the main Python code and run it (equivalent to hitting Ctrl-D at the REPL).""" @@ -99,23 +70,15 @@ STATIC mp_obj_t supervisor_reload(void) { } MP_DEFINE_CONST_FUN_OBJ_0(supervisor_reload_obj, supervisor_reload); -//| def set_next_stack_limit(size: int) -> None: -//| """Set the size of the stack for the next vm run. If its too large, the default will be used.""" -//| ... -//| -STATIC mp_obj_t supervisor_set_next_stack_limit(mp_obj_t size_obj) { - mp_int_t size = mp_obj_get_int(size_obj); - - if (size < 256) { - mp_raise_ValueError(translate("Stack size must be at least 256")); - } - set_next_stack_size(size); - - return mp_const_none; -} -MP_DEFINE_CONST_FUN_OBJ_1(supervisor_set_next_stack_limit_obj, supervisor_set_next_stack_limit); - -//| def set_next_code_file(filename: Optional[str], *, reload_on_success : bool = False, reload_on_error: bool = False, sticky_on_success: bool = False, sticky_on_error: bool = False, sticky_on_reload: bool = False) -> None: +//| def set_next_code_file( +//| filename: Optional[str], +//| *, +//| reload_on_success: bool = False, +//| reload_on_error: bool = False, +//| sticky_on_success: bool = False, +//| sticky_on_error: bool = False, +//| sticky_on_reload: bool = False +//| ) -> None: //| """Set what file to run on the next vm run. //| //| When not ``None``, the given ``filename`` is inserted at the front of the usual ['code.py', @@ -248,6 +211,7 @@ MP_DEFINE_CONST_FUN_OBJ_KW(supervisor_set_next_code_file_obj, 0, supervisor_set_ //| //| """ //| ... +//| mp_obj_t supervisor_ticks_ms(void) { uint64_t ticks_ms = common_hal_time_monotonic_ms(); return mp_obj_new_int((ticks_ms + 0x1fff0000) % (1 << 29)); @@ -281,21 +245,6 @@ STATIC mp_obj_t supervisor_get_previous_traceback(void) { } MP_DEFINE_CONST_FUN_OBJ_0(supervisor_get_previous_traceback_obj, supervisor_get_previous_traceback); -//| def disable_ble_workflow() -> None: -//| """Disable ble workflow until a reset. This prevents BLE advertising outside of the VM and -//| the services used for it.""" -//| ... -//| -STATIC mp_obj_t supervisor_disable_ble_workflow(void) { - #if !CIRCUITPY_BLE_FILE_SERVICE && !CIRCUITPY_SERIAL_BLE - mp_raise_NotImplementedError(NULL); - #else - supervisor_bluetooth_disable_workflow(); - #endif - return mp_const_none; -} -MP_DEFINE_CONST_FUN_OBJ_0(supervisor_disable_ble_workflow_obj, supervisor_disable_ble_workflow); - //| def reset_terminal(x_pixels: int, y_pixels: int) -> None: //| """Reset the CircuitPython serial terminal with new dimensions.""" //| ... @@ -311,20 +260,87 @@ STATIC mp_obj_t supervisor_reset_terminal(mp_obj_t x_pixels, mp_obj_t y_pixels) } MP_DEFINE_CONST_FUN_OBJ_2(supervisor_reset_terminal_obj, supervisor_reset_terminal); +//| def set_usb_identification( +//| manufacturer: Optional[str] = None, +//| product: Optional[str] = None, +//| vid: int = -1, +//| pid: int = -1, +//| ) -> None: +//| """Override identification constants in the USB Device Descriptor. +//| +//| If passed, `manufacturer` and `product` must be ASCII strings (or buffers) of at most 126 +//| characters. Any omitted arguments will be left at their default values. +//| +//| This method must be called in boot.py to have any effect. +//| +//| Not available on boards without native USB support. +//| """ +//| ... +//| +STATIC mp_obj_t supervisor_set_usb_identification(size_t n_args, const mp_obj_t *pos_args, mp_map_t *kw_args) { + #if CIRCUITPY_USB_IDENTIFICATION + static const mp_arg_t allowed_args[] = { + { MP_QSTR_manufacturer, MP_ARG_OBJ, {.u_rom_obj = mp_const_none} }, + { MP_QSTR_product, MP_ARG_OBJ, {.u_rom_obj = mp_const_none} }, + { MP_QSTR_vid, MP_ARG_INT, {.u_int = -1} }, + { MP_QSTR_pid, MP_ARG_INT, {.u_int = -1} }, + }; + struct { + mp_arg_val_t manufacturer; + mp_arg_val_t product; + mp_arg_val_t vid; + mp_arg_val_t pid; + } args; + mp_arg_parse_all(n_args, pos_args, kw_args, MP_ARRAY_SIZE(allowed_args), allowed_args, (mp_arg_val_t *)&args); + + if (!usb_identification_allocation) { + usb_identification_allocation = allocate_memory(sizeof(usb_identification_t), false, true); + } + usb_identification_t *identification = (usb_identification_t *)usb_identification_allocation->ptr; + + mp_arg_validate_int_range(args.vid.u_int, -1, (1 << 16) - 1, MP_QSTR_vid); + mp_arg_validate_int_range(args.pid.u_int, -1, (1 << 16) - 1, MP_QSTR_pid); + + identification->vid = args.vid.u_int > -1 ? args.vid.u_int : USB_VID; + identification->pid = args.pid.u_int > -1 ? args.pid.u_int : USB_PID; + + mp_buffer_info_t info; + if (args.manufacturer.u_obj != mp_const_none) { + mp_get_buffer_raise(args.manufacturer.u_obj, &info, MP_BUFFER_READ); + mp_arg_validate_length_range(info.len, 0, 126, MP_QSTR_manufacturer); + memcpy(identification->manufacturer_name, info.buf, info.len); + identification->manufacturer_name[info.len] = 0; + } else { + strcpy(identification->manufacturer_name, USB_MANUFACTURER); + } + + if (args.product.u_obj != mp_const_none) { + mp_get_buffer_raise(args.product.u_obj, &info, MP_BUFFER_READ); + mp_arg_validate_length_range(info.len, 0, 126, MP_QSTR_product); + memcpy(identification->product_name, info.buf, info.len); + identification->product_name[info.len] = 0; + } else { + strcpy(identification->product_name, USB_PRODUCT); + } + + return mp_const_none; + #else + mp_raise_NotImplementedError(NULL); + #endif +} +MP_DEFINE_CONST_FUN_OBJ_KW(supervisor_set_usb_identification_obj, 0, supervisor_set_usb_identification); + STATIC const mp_rom_map_elem_t supervisor_module_globals_table[] = { { MP_ROM_QSTR(MP_QSTR___name__), MP_ROM_QSTR(MP_QSTR_supervisor) }, - { MP_ROM_QSTR(MP_QSTR_enable_autoreload), MP_ROM_PTR(&supervisor_enable_autoreload_obj) }, - { MP_ROM_QSTR(MP_QSTR_disable_autoreload), MP_ROM_PTR(&supervisor_disable_autoreload_obj) }, - { MP_ROM_QSTR(MP_QSTR_set_rgb_status_brightness), MP_ROM_PTR(&supervisor_set_rgb_status_brightness_obj) }, { MP_ROM_QSTR(MP_QSTR_runtime), MP_ROM_PTR(&common_hal_supervisor_runtime_obj) }, { MP_ROM_QSTR(MP_QSTR_reload), MP_ROM_PTR(&supervisor_reload_obj) }, { MP_ROM_QSTR(MP_QSTR_RunReason), MP_ROM_PTR(&supervisor_run_reason_type) }, - { MP_ROM_QSTR(MP_QSTR_set_next_stack_limit), MP_ROM_PTR(&supervisor_set_next_stack_limit_obj) }, { MP_ROM_QSTR(MP_QSTR_set_next_code_file), MP_ROM_PTR(&supervisor_set_next_code_file_obj) }, { MP_ROM_QSTR(MP_QSTR_ticks_ms), MP_ROM_PTR(&supervisor_ticks_ms_obj) }, { MP_ROM_QSTR(MP_QSTR_get_previous_traceback), MP_ROM_PTR(&supervisor_get_previous_traceback_obj) }, - { MP_ROM_QSTR(MP_QSTR_disable_ble_workflow), MP_ROM_PTR(&supervisor_disable_ble_workflow_obj) }, { MP_ROM_QSTR(MP_QSTR_reset_terminal), MP_ROM_PTR(&supervisor_reset_terminal_obj) }, + { MP_ROM_QSTR(MP_QSTR_set_usb_identification), MP_ROM_PTR(&supervisor_set_usb_identification_obj) }, + { MP_ROM_QSTR(MP_QSTR_status_bar), MP_ROM_PTR(&shared_module_supervisor_status_bar_obj) }, }; STATIC MP_DEFINE_CONST_DICT(supervisor_module_globals, supervisor_module_globals_table); diff --git a/shared-bindings/supervisor/__init__.h b/shared-bindings/supervisor/__init__.h index 40a1e73932..4b4dc4fc57 100644 --- a/shared-bindings/supervisor/__init__.h +++ b/shared-bindings/supervisor/__init__.h @@ -31,8 +31,10 @@ #include "py/obj.h" #include "common-hal/supervisor/Runtime.h" +#include "shared-module/supervisor/StatusBar.h" extern const super_runtime_obj_t common_hal_supervisor_runtime_obj; +extern supervisor_status_bar_obj_t shared_module_supervisor_status_bar_obj; extern mp_obj_t supervisor_ticks_ms(void); diff --git a/shared-bindings/support_matrix.rst b/shared-bindings/support_matrix.rst index e007e27b47..3d5e544ea0 100644 --- a/shared-bindings/support_matrix.rst +++ b/shared-bindings/support_matrix.rst @@ -6,6 +6,11 @@ Module Support Matrix - Which Modules Are Available on Which Boards The following table lists the available built-in modules for each CircuitPython capable board, as well as each :term:`frozen module` included on it. +You can filter this list by typing one or more module names or partial names into the search box. +Only those boards that provide those modules will be listed. +To exclude boards that provide a module, type a "-" in front of the module name. +You can also type a regular expression as a filter. + .. raw:: html

(all)

@@ -21,9 +26,9 @@ capable board, as well as each :term:`frozen module` included on it. {% for key, value in support_matrix|dictsort %} {{ '.. _' ~ key|replace(" ", "-") ~ ':' }} * - {{ key }} - - {{ ':py:mod:`' ~ value[0]|join("`, :py:mod:`") ~ '`' }} + - {{ ':py:mod:`' ~ value.modules|join("`, :py:mod:`") ~ '`' }} - {% for module in value[1] %}\ + {% for module in value.frozen_libraries %}\ {% if loop.index == 1 %}**Frozen Modules:** {% endif %}\ {% if loop.index > 1 %}, {% endif %}\ {% if module[1] %}{{ '`' ~ module[0] ~ ' <' ~ module[1] ~ '>`__' }}\ diff --git a/shared-bindings/synthio/MidiTrack.c b/shared-bindings/synthio/MidiTrack.c index 7805c1a6a0..b987337eaa 100644 --- a/shared-bindings/synthio/MidiTrack.c +++ b/shared-bindings/synthio/MidiTrack.c @@ -32,12 +32,14 @@ #include "py/runtime.h" #include "shared-bindings/util.h" #include "shared-bindings/synthio/MidiTrack.h" -#include "supervisor/shared/translate.h" +#include "supervisor/shared/translate/translate.h" //| class MidiTrack: //| """Simple square-wave MIDI synth""" //| -//| def __init__(self, buffer: ReadableBuffer, tempo: int, *, sample_rate: int = 11025) -> None: +//| def __init__( +//| self, buffer: ReadableBuffer, tempo: int, *, sample_rate: int = 11025 +//| ) -> None: //| """Create a MidiTrack from the given stream of MIDI events. Only "Note On" and "Note Off" events //| are supported; channel numbers and key velocities are ignored. Up to two notes may be on at the //| same time. @@ -62,7 +64,6 @@ //| pass //| print("stopped")""" //| ... -//| STATIC mp_obj_t synthio_miditrack_make_new(const mp_obj_type_t *type, size_t n_args, size_t n_kw, const mp_obj_t *all_args) { enum { ARG_buffer, ARG_tempo, ARG_sample_rate }; static const mp_arg_t allowed_args[] = { @@ -90,7 +91,6 @@ STATIC mp_obj_t synthio_miditrack_make_new(const mp_obj_type_t *type, size_t n_a //| def deinit(self) -> None: //| """Deinitialises the MidiTrack and releases any hardware resources for reuse.""" //| ... -//| STATIC mp_obj_t synthio_miditrack_deinit(mp_obj_t self_in) { synthio_miditrack_obj_t *self = MP_OBJ_TO_PTR(self_in); common_hal_synthio_miditrack_deinit(self); @@ -107,14 +107,12 @@ STATIC void check_for_deinit(synthio_miditrack_obj_t *self) { //| def __enter__(self) -> MidiTrack: //| """No-op used by Context Managers.""" //| ... -//| // Provided by context manager helper. //| def __exit__(self) -> None: //| """Automatically deinitializes the hardware when exiting a context. See //| :ref:`lifetime-and-contextmanagers` for more info.""" //| ... -//| STATIC mp_obj_t synthio_miditrack_obj___exit__(size_t n_args, const mp_obj_t *args) { (void)n_args; common_hal_synthio_miditrack_deinit(args[0]); diff --git a/shared-bindings/synthio/__init__.c b/shared-bindings/synthio/__init__.c index 72fe2eb31f..106a073535 100644 --- a/shared-bindings/synthio/__init__.c +++ b/shared-bindings/synthio/__init__.c @@ -82,7 +82,7 @@ STATIC mp_obj_t synthio_from_file(size_t n_args, const mp_obj_t *pos_args, mp_ma } if (bytes_read != sizeof(chunk_header) || memcmp(chunk_header, "MThd\0\0\0\6\0\0\0\1", 12)) { - mp_raise_ValueError(translate("Invalid MIDI file")); + mp_arg_error_invalid(MP_QSTR_file); // TODO: for a multi-track MIDI (type 1), return an AudioMixer } @@ -97,7 +97,7 @@ STATIC mp_obj_t synthio_from_file(size_t n_args, const mp_obj_t *pos_args, mp_ma mp_raise_OSError(MP_EIO); } if (bytes_read != 8 || memcmp(chunk_header, "MTrk", 4)) { - mp_raise_ValueError(translate("Invalid MIDI file")); + mp_arg_error_invalid(MP_QSTR_file); } uint32_t track_size = (chunk_header[4] << 24) | (chunk_header[5] << 16) | (chunk_header[6] << 8) | chunk_header[7]; @@ -106,7 +106,7 @@ STATIC mp_obj_t synthio_from_file(size_t n_args, const mp_obj_t *pos_args, mp_ma mp_raise_OSError(MP_EIO); } if (bytes_read != track_size) { - mp_raise_ValueError(translate("Invalid MIDI file")); + mp_arg_error_invalid(MP_QSTR_file); } synthio_miditrack_obj_t *result = m_new_obj(synthio_miditrack_obj_t); diff --git a/shared-bindings/terminalio/Terminal.c b/shared-bindings/terminalio/Terminal.c index cdeca59164..a666a79461 100644 --- a/shared-bindings/terminalio/Terminal.c +++ b/shared-bindings/terminalio/Terminal.c @@ -35,34 +35,60 @@ #include "py/runtime.h" #include "py/stream.h" #include "shared-bindings/fontio/BuiltinFont.h" -#include "supervisor/shared/translate.h" +#include "supervisor/shared/translate/translate.h" //| class Terminal: -//| """Display a character stream with a TileGrid""" +//| """Display a character stream with a TileGrid //| -//| def __init__(self, tilegrid: displayio.TileGrid, font: fontio.BuiltinFont) -> None: +//| ASCII control: +//| * ``\\r`` - Move cursor to column 1 +//| * ``\\n`` - Move cursor down a row +//| * ``\\b`` - Move cursor left one if possible +//| +//| OSC control sequences: +//| * ``ESC ] 0; ESC \\`` - Set title bar to +//| * ``ESC ] ####; ESC \\`` - Ignored +//| +//| VT100 control sequences: +//| * ``ESC [ K`` - Clear the remainder of the line +//| * ``ESC [ #### D`` - Move the cursor to the left by #### +//| * ``ESC [ 2 J`` - Erase the entire display +//| * ``ESC [ nnnn ; mmmm H`` - Move the cursor to mmmm, nnnn. +//| """ +//| +//| def __init__( +//| self, +//| scroll_area: displayio.TileGrid, +//| font: fontio.BuiltinFont, +//| *, +//| status_bar: displayio.TileGrid = None +//| ) -> None: //| """Terminal manages tile indices and cursor position based on VT100 commands. The font should be //| a `fontio.BuiltinFont` and the TileGrid's bitmap should match the font's bitmap.""" //| ... -//| STATIC mp_obj_t terminalio_terminal_make_new(const mp_obj_type_t *type, size_t n_args, size_t n_kw, const mp_obj_t *all_args) { - enum { ARG_tilegrid, ARG_font }; + enum { ARG_scroll_area, ARG_font, ARG_status_bar }; static const mp_arg_t allowed_args[] = { - { MP_QSTR_tilegrid, MP_ARG_REQUIRED | MP_ARG_OBJ }, + { MP_QSTR_scroll_area, MP_ARG_REQUIRED | MP_ARG_OBJ }, { MP_QSTR_font, MP_ARG_REQUIRED | MP_ARG_OBJ }, + { MP_QSTR_status_bar, MP_ARG_KW_ONLY | MP_ARG_OBJ, { .u_obj = mp_const_none } }, }; mp_arg_val_t args[MP_ARRAY_SIZE(allowed_args)]; mp_arg_parse_all_kw_array(n_args, n_kw, all_args, MP_ARRAY_SIZE(allowed_args), allowed_args, args); - displayio_tilegrid_t *tilegrid = mp_arg_validate_type(args[ARG_tilegrid].u_obj, &displayio_tilegrid_type, MP_QSTR_tilegrid); + displayio_tilegrid_t *scroll_area = mp_arg_validate_type(args[ARG_scroll_area].u_obj, &displayio_tilegrid_type, MP_QSTR_scroll_area); + displayio_tilegrid_t *status_bar = NULL; + if (args[ARG_status_bar].u_obj != mp_const_none) { + status_bar = mp_arg_validate_type(args[ARG_status_bar].u_obj, &displayio_tilegrid_type, MP_QSTR_status_bar); + } fontio_builtinfont_t *font = mp_arg_validate_type(args[ARG_font].u_obj, &fontio_builtinfont_type, MP_QSTR_font); terminalio_terminal_obj_t *self = m_new_obj(terminalio_terminal_obj_t); self->base.type = &terminalio_terminal_type; - common_hal_terminalio_terminal_construct(self, tilegrid, font); + common_hal_terminalio_terminal_construct(self, scroll_area, font, status_bar); return MP_OBJ_FROM_PTR(self); } diff --git a/shared-bindings/terminalio/Terminal.h b/shared-bindings/terminalio/Terminal.h index f884edd6d5..fda1c29bdd 100644 --- a/shared-bindings/terminalio/Terminal.h +++ b/shared-bindings/terminalio/Terminal.h @@ -34,7 +34,7 @@ extern const mp_obj_type_t terminalio_terminal_type; extern void common_hal_terminalio_terminal_construct(terminalio_terminal_obj_t *self, - displayio_tilegrid_t *tilegrid, const fontio_builtinfont_t *font); + displayio_tilegrid_t *scroll_area, const fontio_builtinfont_t *font, displayio_tilegrid_t *status_bar); // Write characters. len is in characters NOT bytes! extern size_t common_hal_terminalio_terminal_write(terminalio_terminal_obj_t *self, diff --git a/shared-bindings/terminalio/__init__.c b/shared-bindings/terminalio/__init__.c index 5fd1a2751a..a5980a8b9b 100644 --- a/shared-bindings/terminalio/__init__.c +++ b/shared-bindings/terminalio/__init__.c @@ -47,7 +47,6 @@ //| //| FONT: fontio.BuiltinFont //| """The built in font""" -//| STATIC const mp_rom_map_elem_t terminalio_module_globals_table[] = { { MP_ROM_QSTR(MP_QSTR___name__), MP_ROM_QSTR(MP_QSTR_terminalio) }, { MP_ROM_QSTR(MP_QSTR_Terminal), MP_OBJ_FROM_PTR(&terminalio_terminal_type) }, diff --git a/shared-bindings/time/__init__.c b/shared-bindings/time/__init__.c index 5b16ded0e4..096c80d382 100644 --- a/shared-bindings/time/__init__.c +++ b/shared-bindings/time/__init__.c @@ -34,7 +34,7 @@ #include "shared/timeutils/timeutils.h" #include "shared-bindings/rtc/__init__.h" #include "shared-bindings/time/__init__.h" -#include "supervisor/shared/translate.h" +#include "supervisor/shared/translate/translate.h" //| """time and timing related functions //| diff --git a/shared-bindings/touchio/TouchIn.c b/shared-bindings/touchio/TouchIn.c index 23b35253cb..63da84e885 100644 --- a/shared-bindings/touchio/TouchIn.c +++ b/shared-bindings/touchio/TouchIn.c @@ -36,7 +36,7 @@ #include "shared-bindings/microcontroller/Pin.h" #include "shared-bindings/touchio/TouchIn.h" #include "shared-bindings/util.h" -#include "supervisor/shared/translate.h" +#include "supervisor/shared/translate/translate.h" //| class TouchIn: //| """Read the state of a capacitive touch sensor @@ -57,7 +57,6 @@ //| //| :param ~microcontroller.Pin pin: the pin to read from""" //| ... -//| STATIC mp_obj_t touchio_touchin_make_new(const mp_obj_type_t *type, size_t n_args, size_t n_kw, const mp_obj_t *args) { // check number of arguments @@ -76,7 +75,6 @@ STATIC mp_obj_t touchio_touchin_make_new(const mp_obj_type_t *type, //| def deinit(self) -> None: //| """Deinitialises the TouchIn and releases any hardware resources for reuse.""" //| ... -//| STATIC mp_obj_t touchio_touchin_deinit(mp_obj_t self_in) { touchio_touchin_obj_t *self = MP_OBJ_TO_PTR(self_in); common_hal_touchio_touchin_deinit(self); @@ -93,14 +91,12 @@ STATIC void check_for_deinit(touchio_touchin_obj_t *self) { //| def __enter__(self) -> TouchIn: //| """No-op used by Context Managers.""" //| ... -//| // Provided by context manager helper. //| def __exit__(self) -> None: //| """Automatically deinitializes the hardware when exiting a context. See //| :ref:`lifetime-and-contextmanagers` for more info.""" //| ... -//| STATIC mp_obj_t touchio_touchin_obj___exit__(size_t n_args, const mp_obj_t *args) { (void)n_args; common_hal_touchio_touchin_deinit(args[0]); @@ -112,7 +108,6 @@ STATIC MP_DEFINE_CONST_FUN_OBJ_VAR_BETWEEN(touchio_touchin___exit___obj, 4, 4, t //| """Whether the touch pad is being touched or not. (read-only) //| //| True when `raw_value` > `threshold`.""" -//| STATIC mp_obj_t touchio_touchin_obj_get_value(mp_obj_t self_in) { touchio_touchin_obj_t *self = MP_OBJ_TO_PTR(self_in); check_for_deinit(self); @@ -126,7 +121,6 @@ MP_PROPERTY_GETTER(touchio_touchin_value_obj, //| raw_value: int //| """The raw touch measurement as an `int`. (read-only)""" -//| STATIC mp_obj_t touchio_touchin_obj_get_raw_value(mp_obj_t self_in) { touchio_touchin_obj_t *self = MP_OBJ_TO_PTR(self_in); check_for_deinit(self); diff --git a/shared-bindings/touchio/__init__.c b/shared-bindings/touchio/__init__.c index e2a6ad9317..8501315ca7 100644 --- a/shared-bindings/touchio/__init__.c +++ b/shared-bindings/touchio/__init__.c @@ -45,7 +45,10 @@ //| call :py:meth:`!deinit` or use a context manager. See //| :ref:`lifetime-and-contextmanagers` for more info. //| -//| For example:: +//| For more information about working with the `touchio` module in CircuitPython, +//| see `this Learn guide page `_. +//| +//| Example:: //| //| import touchio //| from board import * @@ -55,7 +58,6 @@ //| //| This example will initialize the the device, and print the //| :py:data:`~touchio.TouchIn.value`.""" -//| STATIC const mp_rom_map_elem_t touchio_module_globals_table[] = { { MP_ROM_QSTR(MP_QSTR___name__), MP_ROM_QSTR(MP_QSTR_touchio) }, diff --git a/shared-bindings/traceback/__init__.c b/shared-bindings/traceback/__init__.c index 880fe08e85..566ac57218 100644 --- a/shared-bindings/traceback/__init__.c +++ b/shared-bindings/traceback/__init__.c @@ -37,7 +37,6 @@ //| |see_cpython_module| :mod:`cpython:traceback`. //| """ //| ... -//| STATIC void traceback_exception_common(mp_print_t *print, mp_obj_t value, mp_obj_t tb_obj, mp_obj_t limit_obj) { if (!mp_obj_is_exception_instance(value)) { @@ -64,8 +63,13 @@ STATIC void traceback_exception_common(mp_print_t *print, mp_obj_t value, mp_obj exc->traceback = trace_backup; } -//| def format_exception(etype: Type[BaseException], value: BaseException, tb: TracebackType, -//| limit: Optional[int] = None, chain: Optional[bool] = True) -> None: +//| def format_exception( +//| etype: Type[BaseException], +//| value: BaseException, +//| tb: TracebackType, +//| limit: Optional[int] = None, +//| chain: Optional[bool] = True, +//| ) -> None: //| """Format a stack trace and the exception information. //| //| The arguments have the same meaning as the corresponding arguments @@ -108,8 +112,14 @@ STATIC mp_obj_t traceback_format_exception(size_t n_args, const mp_obj_t *pos_ar STATIC MP_DEFINE_CONST_FUN_OBJ_KW(traceback_format_exception_obj, 0, traceback_format_exception); -//| def print_exception(etype: Type[BaseException], value: BaseException, tb: TracebackType, -//| limit: Optional[int] = None, file: Optional[io.FileIO] = None, chain: Optional[bool] = True) -> None: +//| def print_exception( +//| etype: Type[BaseException], +//| value: BaseException, +//| tb: TracebackType, +//| limit: Optional[int] = None, +//| file: Optional[io.FileIO] = None, +//| chain: Optional[bool] = True, +//| ) -> None: //| //| """Prints exception information and stack trace entries. //| diff --git a/shared-bindings/uheap/__init__.c b/shared-bindings/uheap/__init__.c index 40aa869225..376be78ef1 100644 --- a/shared-bindings/uheap/__init__.c +++ b/shared-bindings/uheap/__init__.c @@ -32,7 +32,6 @@ #include "shared-bindings/uheap/__init__.h" //| """Heap size analysis""" -//| //| def info(object: object) -> int: //| """Prints memory debugging info for the given object and returns the diff --git a/shared-bindings/usb/__init__.c b/shared-bindings/usb/__init__.c index bae72da1f7..443d5cf788 100644 --- a/shared-bindings/usb/__init__.c +++ b/shared-bindings/usb/__init__.c @@ -35,7 +35,6 @@ //| //| The `usb` is a subset of PyUSB that allows you to communicate to USB devices. //| """ -//| STATIC mp_rom_map_elem_t usb_module_globals_table[] = { { MP_ROM_QSTR(MP_QSTR___name__), MP_OBJ_NEW_QSTR(MP_QSTR_usb) }, diff --git a/shared-bindings/usb/core/Device.c b/shared-bindings/usb/core/Device.c index 3a9e9bb421..40bb01dc08 100644 --- a/shared-bindings/usb/core/Device.c +++ b/shared-bindings/usb/core/Device.c @@ -62,17 +62,14 @@ #include "py/runtime.h" //| class Device: -//| //| def __init__(self) -> None: //| """User code cannot create Device objects. Instead, get them from -//| `usb.core.find`. +//| `usb.core.find`. //| """ //| ... -//| //| idVendor: int //| """The USB vendor ID of the device""" -//| STATIC mp_obj_t usb_core_device_obj_get_idVendor(mp_obj_t self_in) { usb_core_device_obj_t *self = MP_OBJ_TO_PTR(self_in); return MP_OBJ_NEW_SMALL_INT(common_hal_usb_core_device_get_idVendor(self)); @@ -84,7 +81,6 @@ MP_PROPERTY_GETTER(usb_core_device_idVendor_obj, //| idProduct: int //| """The USB product ID of the device""" -//| STATIC mp_obj_t usb_core_device_obj_get_idProduct(mp_obj_t self_in) { usb_core_device_obj_t *self = MP_OBJ_TO_PTR(self_in); return MP_OBJ_NEW_SMALL_INT(common_hal_usb_core_device_get_idProduct(self)); @@ -96,7 +92,6 @@ MP_PROPERTY_GETTER(usb_core_device_idProduct_obj, //| serial_number: str //| """The USB device's serial number string.""" -//| STATIC mp_obj_t usb_core_device_obj_get_serial_number(mp_obj_t self_in) { usb_core_device_obj_t *self = MP_OBJ_TO_PTR(self_in); return common_hal_usb_core_device_get_serial_number(self); @@ -108,7 +103,6 @@ MP_PROPERTY_GETTER(usb_core_device_serial_number_obj, //| product: str //| """The USB device's product string.""" -//| STATIC mp_obj_t usb_core_device_obj_get_product(mp_obj_t self_in) { usb_core_device_obj_t *self = MP_OBJ_TO_PTR(self_in); return common_hal_usb_core_device_get_product(self); @@ -120,7 +114,6 @@ MP_PROPERTY_GETTER(usb_core_device_product_obj, //| manufacturer: str //| """The USB device's manufacturer string.""" -//| STATIC mp_obj_t usb_core_device_obj_get_manufacturer(mp_obj_t self_in) { usb_core_device_obj_t *self = MP_OBJ_TO_PTR(self_in); return common_hal_usb_core_device_get_manufacturer(self); @@ -130,16 +123,15 @@ MP_DEFINE_CONST_FUN_OBJ_1(usb_core_device_get_manufacturer_obj, usb_core_device_ MP_PROPERTY_GETTER(usb_core_device_manufacturer_obj, (mp_obj_t)&usb_core_device_get_manufacturer_obj); -//| def write(self, endpoint: int, data: ReadableBuffer, timeout = None) -> int: +//| def write(self, endpoint: int, data: ReadableBuffer, timeout: Optional[int] = None) -> int: //| """Write data to a specific endpoint on the device. //| -//| :param int endpoint: the bEndpointAddress you want to communicate with. -//| :param ReadableBuffer data: the data to send -//| :param int timeout: Time to wait specified in milliseconds. (Different from most CircuitPython!) -//| :returns: the number of bytes written +//| :param int endpoint: the bEndpointAddress you want to communicate with. +//| :param ReadableBuffer data: the data to send +//| :param int timeout: Time to wait specified in milliseconds. (Different from most CircuitPython!) +//| :returns: the number of bytes written //| """ //| ... -//| STATIC mp_obj_t usb_core_device_write(size_t n_args, const mp_obj_t *pos_args, mp_map_t *kw_args) { enum { ARG_endpoint, ARG_data, ARG_timeout }; static const mp_arg_t allowed_args[] = { @@ -159,13 +151,15 @@ STATIC mp_obj_t usb_core_device_write(size_t n_args, const mp_obj_t *pos_args, m MP_DEFINE_CONST_FUN_OBJ_KW(usb_core_device_write_obj, 2, usb_core_device_write); -//| def read(self, endpoint: int, size_or_buffer: array.array, timeout = None) -> int: +//| def read( +//| self, endpoint: int, size_or_buffer: array.array, timeout: Optional[int] = None +//| ) -> int: //| """Read data from the endpoint. //| -//| :param int endpoint: the bEndpointAddress you want to communicate with. -//| :param array.array size_or_buffer: the array to read data into. PyUSB also allows size but CircuitPython only support array to force deliberate memory use. -//| :param int timeout: Time to wait specified in milliseconds. (Different from most CircuitPython!) -//| :returns: the number of bytes read +//| :param int endpoint: the bEndpointAddress you want to communicate with. +//| :param array.array size_or_buffer: the array to read data into. PyUSB also allows size but CircuitPython only support array to force deliberate memory use. +//| :param int timeout: Time to wait specified in milliseconds. (Different from most CircuitPython!) +//| :returns: the number of bytes read //| """ //| ... STATIC mp_obj_t usb_core_device_read(size_t n_args, const mp_obj_t *pos_args, mp_map_t *kw_args) { @@ -186,27 +180,33 @@ STATIC mp_obj_t usb_core_device_read(size_t n_args, const mp_obj_t *pos_args, mp } MP_DEFINE_CONST_FUN_OBJ_KW(usb_core_device_read_obj, 2, usb_core_device_read); -//| def ctrl_transfer(self, bmRequestType, bRequest, wValue=0, wIndex=0, -//| data_or_wLength: array.array = None, timeout = None) -> int: +//| def ctrl_transfer( +//| self, +//| bmRequestType: int, +//| bRequest: int, +//| wValue: int = 0, +//| wIndex: int = 0, +//| data_or_wLength: Optional[array.array] = None, +//| timeout: Optional[int] = None, +//| ) -> int: //| """Do a control transfer on the endpoint 0. The parameters bmRequestType, -//| bRequest, wValue and wIndex are the same of the USB Standard Control -//| Request format. +//| bRequest, wValue and wIndex are the same of the USB Standard Control +//| Request format. //| -//| Control requests may or may not have a data payload to write/read. -//| In cases which it has, the direction bit of the bmRequestType -//| field is used to infer the desired request direction. +//| Control requests may or may not have a data payload to write/read. +//| In cases which it has, the direction bit of the bmRequestType +//| field is used to infer the desired request direction. //| -//| For host to device requests (OUT), data_or_wLength parameter is -//| the data payload to send, and it must be a sequence type convertible -//| to an array object. In this case, the return value is the number -//| of bytes written in the data payload. +//| For host to device requests (OUT), data_or_wLength parameter is +//| the data payload to send, and it must be a sequence type convertible +//| to an array object. In this case, the return value is the number +//| of bytes written in the data payload. //| -//| For device to host requests (IN), data_or_wLength is an array -//| object which the data will be read to, and the return value is the -//| number of bytes read. -//| """ +//| For device to host requests (IN), data_or_wLength is an array +//| object which the data will be read to, and the return value is the +//| number of bytes read. +//| """ //| ... -//| STATIC mp_obj_t usb_core_device_ctrl_transfer(size_t n_args, const mp_obj_t *pos_args, mp_map_t *kw_args) { enum { ARG_bmRequestType, ARG_bRequest, ARG_wValue, ARG_wIndex, ARG_data_or_wLength, ARG_timeout }; static const mp_arg_t allowed_args[] = { @@ -240,12 +240,11 @@ MP_DEFINE_CONST_FUN_OBJ_KW(usb_core_device_ctrl_transfer_obj, 2, usb_core_device //| def is_kernel_driver_active(self, interface: int) -> bool: //| """Determine if CircuitPython is using the interface. If it is, the -//| object will be unable to perform I/O. +//| object will be unable to perform I/O. //| -//| :param int interface: the device interface number to check -//| """ +//| :param int interface: the device interface number to check +//| """ //| ... -//| STATIC mp_obj_t usb_core_device_is_kernel_driver_active(mp_obj_t self_in, mp_obj_t interface_in) { usb_core_device_obj_t *self = MP_OBJ_TO_PTR(self_in); mp_int_t interface = mp_obj_get_int(interface_in); @@ -254,15 +253,14 @@ STATIC mp_obj_t usb_core_device_is_kernel_driver_active(mp_obj_t self_in, mp_obj } MP_DEFINE_CONST_FUN_OBJ_2(usb_core_device_is_kernel_driver_active_obj, usb_core_device_is_kernel_driver_active); -//| def detach_kernel_driver(self, interface: int): +//| def detach_kernel_driver(self, interface: int) -> None: //| """Stop CircuitPython from using the interface. If successful, you -//| will then be able to perform I/O. CircuitPython will automatically -//| re-start using the interface on reload. +//| will then be able to perform I/O. CircuitPython will automatically +//| re-start using the interface on reload. //| -//| :param int interface: the device interface number to stop CircuitPython on +//| :param int interface: the device interface number to stop CircuitPython on //| """ //| ... -//| STATIC mp_obj_t usb_core_device_detach_kernel_driver(mp_obj_t self_in, mp_obj_t interface_in) { usb_core_device_obj_t *self = MP_OBJ_TO_PTR(self_in); mp_int_t interface = mp_obj_get_int(interface_in); @@ -271,10 +269,10 @@ STATIC mp_obj_t usb_core_device_detach_kernel_driver(mp_obj_t self_in, mp_obj_t } MP_DEFINE_CONST_FUN_OBJ_2(usb_core_device_detach_kernel_driver_obj, usb_core_device_detach_kernel_driver); -//| def attach_kernel_driver(self, interface: int): +//| def attach_kernel_driver(self, interface: int) -> None: //| """Allow CircuitPython to use the interface if it wants to. //| -//| :param int interface: the device interface number to allow CircuitPython to use +//| :param int interface: the device interface number to allow CircuitPython to use //| """ //| ... //| diff --git a/shared-bindings/usb/core/__init__.c b/shared-bindings/usb/core/__init__.c index 0e0d409ede..84d202945a 100644 --- a/shared-bindings/usb/core/__init__.c +++ b/shared-bindings/usb/core/__init__.c @@ -40,11 +40,12 @@ //| //| This is a subset of the PyUSB core module. //| """ -//| //| class USBError(OSError): //| """Catchall exception for USB related errors.""" +//| //| ... +//| MP_DEFINE_USB_CORE_EXCEPTION(USBError, OSError) NORETURN void mp_raise_usb_core_USBError(const compressed_string_t *fmt, ...) { va_list argptr; @@ -56,6 +57,7 @@ NORETURN void mp_raise_usb_core_USBError(const compressed_string_t *fmt, ...) { //| class USBTimeoutError(USBError): //| """Raised when a USB transfer times out.""" +//| //| ... //| MP_DEFINE_USB_CORE_EXCEPTION(USBTimeoutError, usb_core_USBError) @@ -64,12 +66,14 @@ NORETURN void mp_raise_usb_core_USBTimeoutError(void) { } -//| def find(find_all=False, *, idVendor=None, idProduct=None): -//| """Find the first device that matches the given requirements or, if -//| find_all is True, return a generator of all matching devices. +//| def find( +//| find_all: bool = False, *, idVendor: Optional[int] = None, idProduct: Optional[int] = None +//| ) -> Device: +//| """Find the first device that matches the given requirements or, if +//| find_all is True, return a generator of all matching devices. //| -//| Returns None if no device matches. -//| """ +//| Returns None if no device matches. +//| """ //| typedef struct { mp_obj_base_t base; diff --git a/shared-bindings/usb_cdc/Serial.c b/shared-bindings/usb_cdc/Serial.c index 760efb6278..df96debe7f 100644 --- a/shared-bindings/usb_cdc/Serial.c +++ b/shared-bindings/usb_cdc/Serial.c @@ -33,7 +33,7 @@ #include "py/objproperty.h" #include "py/runtime.h" #include "py/stream.h" -#include "supervisor/shared/translate.h" +#include "supervisor/shared/translate/translate.h" //| class Serial: //| """Receives cdc commands over USB""" @@ -42,7 +42,6 @@ //| """You cannot create an instance of `usb_cdc.Serial`. //| The available instances are in the ``usb_cdc.serials`` tuple.""" //| ... -//| //| def read(self, size: int = 1) -> bytes: //| """Read at most ``size`` bytes. If ``size`` exceeds the internal buffer size //| only the bytes in the buffer will be read. If `timeout` is > 0 or ``None``, @@ -52,15 +51,14 @@ //| :return: Data read //| :rtype: bytes""" //| ... -//| //| def readinto(self, buf: WriteableBuffer) -> int: -//| """Read bytes into the ``buf``. If ``nbytes`` is specified then read at most -//| that many bytes, subject to `timeout`. Otherwise, read at most ``len(buf)`` bytes. +//| """Read bytes into the ``buf``. Read at most ``len(buf)`` bytes. If `timeout` +//| is > 0 or ``None``, keep waiting until the timeout expires or ``len(buf)`` +//| bytes are available. //| //| :return: number of bytes read and stored into ``buf`` -//| :rtype: bytes""" +//| :rtype: int""" //| ... -//| //| def readline(self, size: int = -1) -> Optional[bytes]: //| r"""Read a line ending in a newline character ("\\n"), including the newline. //| Return everything readable if no newline is found and ``timeout`` is 0. @@ -73,7 +71,6 @@ //| :return: the line read //| :rtype: bytes or None""" //| ... -//| //| def readlines(self) -> List[Optional[bytes]]: //| """Read multiple lines as a list, using `readline()`. //| @@ -83,18 +80,15 @@ //| :return: a list of the line read //| :rtype: list""" //| ... -//| //| def write(self, buf: ReadableBuffer) -> int: //| """Write as many bytes as possible from the buffer of bytes. //| //| :return: the number of bytes written //| :rtype: int""" //| ... -//| //| def flush(self) -> None: //| """Force out any unwritten bytes, waiting until they are written.""" //| ... -//| // These three methods are used by the shared stream methods. STATIC mp_uint_t usb_cdc_serial_read_stream(mp_obj_t self_in, void *buf_in, mp_uint_t size, int *errcode) { @@ -150,7 +144,6 @@ STATIC mp_uint_t usb_cdc_serial_ioctl_stream(mp_obj_t self_in, mp_uint_t request //| Most terminal programs and ``pyserial`` assert DTR when opening a serial connection. //| However, the C# ``SerialPort`` API does not. You must set ``SerialPort.DtrEnable``. //| """ -//| STATIC mp_obj_t usb_cdc_serial_get_connected(mp_obj_t self_in) { usb_cdc_serial_obj_t *self = MP_OBJ_TO_PTR(self_in); return mp_obj_new_bool(common_hal_usb_cdc_serial_get_connected(self)); @@ -162,7 +155,6 @@ MP_PROPERTY_GETTER(usb_cdc_serial_connected_obj, //| in_waiting: int //| """Returns the number of bytes waiting to be read on the USB serial input. (read-only)""" -//| STATIC mp_obj_t usb_cdc_serial_get_in_waiting(mp_obj_t self_in) { usb_cdc_serial_obj_t *self = MP_OBJ_TO_PTR(self_in); return mp_obj_new_int(common_hal_usb_cdc_serial_get_in_waiting(self)); @@ -174,7 +166,6 @@ MP_PROPERTY_GETTER(usb_cdc_serial_in_waiting_obj, //| out_waiting: int //| """Returns the number of bytes waiting to be written on the USB serial output. (read-only)""" -//| STATIC mp_obj_t usb_cdc_serial_get_out_waiting(mp_obj_t self_in) { usb_cdc_serial_obj_t *self = MP_OBJ_TO_PTR(self_in); return mp_obj_new_int(common_hal_usb_cdc_serial_get_out_waiting(self)); @@ -187,7 +178,6 @@ MP_PROPERTY_GETTER(usb_cdc_serial_out_waiting_obj, //| def reset_input_buffer(self) -> None: //| """Clears any unread bytes.""" //| ... -//| STATIC mp_obj_t usb_cdc_serial_reset_input_buffer(mp_obj_t self_in) { usb_cdc_serial_obj_t *self = MP_OBJ_TO_PTR(self_in); common_hal_usb_cdc_serial_reset_input_buffer(self); @@ -198,7 +188,6 @@ MP_DEFINE_CONST_FUN_OBJ_1(usb_cdc_serial_reset_input_buffer_obj, usb_cdc_serial_ //| def reset_output_buffer(self) -> None: //| """Clears any unwritten bytes.""" //| ... -//| STATIC mp_obj_t usb_cdc_serial_reset_output_buffer(mp_obj_t self_in) { usb_cdc_serial_obj_t *self = MP_OBJ_TO_PTR(self_in); common_hal_usb_cdc_serial_reset_output_buffer(self); @@ -209,7 +198,6 @@ MP_DEFINE_CONST_FUN_OBJ_1(usb_cdc_serial_reset_output_buffer_obj, usb_cdc_serial //| timeout: Optional[float] //| """The initial value of `timeout` is ``None``. If ``None``, wait indefinitely to satisfy //| the conditions of a read operation. If 0, do not wait. If > 0, wait only ``timeout`` seconds.""" -//| STATIC mp_obj_t usb_cdc_serial_get_timeout(mp_obj_t self_in) { usb_cdc_serial_obj_t *self = MP_OBJ_TO_PTR(self_in); mp_float_t timeout = common_hal_usb_cdc_serial_get_timeout(self); diff --git a/shared-bindings/usb_cdc/__init__.c b/shared-bindings/usb_cdc/__init__.c index eabe26ad07..e23e289309 100644 --- a/shared-bindings/usb_cdc/__init__.c +++ b/shared-bindings/usb_cdc/__init__.c @@ -31,6 +31,7 @@ #include "shared-bindings/usb_cdc/__init__.h" #include "shared-bindings/usb_cdc/Serial.h" +#include "supervisor/shared/translate/translate.h" #include "py/runtime.h" diff --git a/shared-bindings/usb_hid/Device.c b/shared-bindings/usb_hid/Device.c index 2741013d03..97196144be 100644 --- a/shared-bindings/usb_hid/Device.c +++ b/shared-bindings/usb_hid/Device.c @@ -27,11 +27,21 @@ #include "py/objproperty.h" #include "shared-bindings/usb_hid/Device.h" #include "py/runtime.h" +#include "supervisor/shared/translate/translate.h" //| class Device: //| """HID Device specification""" //| -//| def __init__(self, *, report_descriptor: ReadableBuffer, usage_page: int, usage: int, report_ids: Sequence[int], in_report_lengths: Sequence[int], out_report_lengths: Sequence[int]) -> None: +//| def __init__( +//| self, +//| *, +//| report_descriptor: ReadableBuffer, +//| usage_page: int, +//| usage: int, +//| report_ids: Sequence[int], +//| in_report_lengths: Sequence[int], +//| out_report_lengths: Sequence[int] +//| ) -> None: //| """Create a description of a USB HID device. The actual device is created when you //| pass a `Device` to `usb_hid.enable()`. //| @@ -65,7 +75,6 @@ //| ) //| """ //| ... -//| //| KEYBOARD: Device //| """Standard keyboard device supporting keycodes 0x00-0xDD, modifiers 0xE-0xE7, and five LED indicators. //| Uses Report ID 1 for its IN and OUT reports. @@ -80,7 +89,6 @@ //| CONSUMER_CONTROL: Device //| """Consumer Control device supporting sent values from 1-652, with no rollover. //| Uses Report ID 3 for its IN report.""" -//| STATIC mp_obj_t usb_hid_device_make_new(const mp_obj_type_t *type, size_t n_args, size_t n_kw, const mp_obj_t *all_args) { usb_hid_device_obj_t *self = m_new_obj(usb_hid_device_obj_t); @@ -114,10 +122,8 @@ STATIC mp_obj_t usb_hid_device_make_new(const mp_obj_type_t *type, size_t n_args mp_obj_t in_report_lengths = args[ARG_in_report_lengths].u_obj; mp_obj_t out_report_lengths = args[ARG_out_report_lengths].u_obj; - size_t report_ids_count = (size_t)MP_OBJ_SMALL_INT_VALUE(mp_obj_len(report_ids)); - if (report_ids_count < 1) { - mp_raise_ValueError_varg(translate("%q length must be >= 1"), MP_QSTR_report_ids); - } + size_t report_ids_count = + mp_arg_validate_length_min((size_t)MP_OBJ_SMALL_INT_VALUE(mp_obj_len(report_ids)), 1, MP_QSTR_report_ids); if ((size_t)MP_OBJ_SMALL_INT_VALUE(mp_obj_len(in_report_lengths)) != report_ids_count || (size_t)MP_OBJ_SMALL_INT_VALUE(mp_obj_len(out_report_lengths)) != report_ids_count) { @@ -158,19 +164,18 @@ STATIC mp_obj_t usb_hid_device_make_new(const mp_obj_type_t *type, size_t n_args } -//| def send_report(self, buf: ReadableBuffer, report_id: Optional[int] = None) -> None: +//| def send_report(self, report: ReadableBuffer, report_id: Optional[int] = None) -> None: //| """Send an HID report. If the device descriptor specifies zero or one report id's, //| you can supply `None` (the default) as the value of ``report_id``. //| Otherwise you must specify which report id to use when sending the report. //| """ //| ... -//| STATIC mp_obj_t usb_hid_device_send_report(size_t n_args, const mp_obj_t *pos_args, mp_map_t *kw_args) { usb_hid_device_obj_t *self = MP_OBJ_TO_PTR(pos_args[0]); - enum { ARG_buf, ARG_report_id }; + enum { ARG_report, ARG_report_id }; static const mp_arg_t allowed_args[] = { - { MP_QSTR_buf, MP_ARG_REQUIRED | MP_ARG_OBJ }, + { MP_QSTR_report, MP_ARG_REQUIRED | MP_ARG_OBJ }, { MP_QSTR_report_id, MP_ARG_OBJ, {.u_obj = mp_const_none} }, }; @@ -178,7 +183,7 @@ STATIC mp_obj_t usb_hid_device_send_report(size_t n_args, const mp_obj_t *pos_ar mp_arg_parse_all(n_args - 1, pos_args + 1, kw_args, MP_ARRAY_SIZE(allowed_args), allowed_args, args); mp_buffer_info_t bufinfo; - mp_get_buffer_raise(args[ARG_buf].u_obj, &bufinfo, MP_BUFFER_READ); + mp_get_buffer_raise(args[ARG_report].u_obj, &bufinfo, MP_BUFFER_READ); // -1 asks common_hal to determine the report id if possible. mp_int_t report_id_arg = -1; @@ -192,13 +197,13 @@ STATIC mp_obj_t usb_hid_device_send_report(size_t n_args, const mp_obj_t *pos_ar } MP_DEFINE_CONST_FUN_OBJ_KW(usb_hid_device_send_report_obj, 1, usb_hid_device_send_report); -//| def get_last_received_report(self, report_id: Optional[int] = None) -> bytes: +//| def get_last_received_report(self, report_id: Optional[int] = None) -> Optional[bytes]: //| """Get the last received HID OUT or feature report for the given report ID. //| The report ID may be omitted if there is no report ID, or only one report ID. -//| Return `None` if nothing received. +//| Return `None` if nothing received. After returning a report, subsequent calls +//| will return `None` until next report is received. //| """ //| ... -//| STATIC mp_obj_t usb_hid_device_get_last_received_report(size_t n_args, const mp_obj_t *pos_args, mp_map_t *kw_args) { usb_hid_device_obj_t *self = MP_OBJ_TO_PTR(pos_args[0]); @@ -220,28 +225,8 @@ STATIC mp_obj_t usb_hid_device_get_last_received_report(size_t n_args, const mp_ } MP_DEFINE_CONST_FUN_OBJ_KW(usb_hid_device_get_last_received_report_obj, 1, usb_hid_device_get_last_received_report); -//| last_received_report: bytes -//| """The HID OUT report as a `bytes` (read-only). `None` if nothing received. -//| Same as `get_last_received_report()` with no argument. -//| -//| Deprecated: will be removed in CircutPython 8.0.0. Use `get_last_received_report()` instead. -//| """ -//| -STATIC mp_obj_t usb_hid_device_obj_get_last_received_report_property(mp_obj_t self_in) { - usb_hid_device_obj_t *self = MP_OBJ_TO_PTR(self_in); - - // Get the sole report_id, if there is one. - const uint8_t report_id = common_hal_usb_hid_device_validate_report_id(self, -1); - return common_hal_usb_hid_device_get_last_received_report(self, report_id); -} -MP_DEFINE_CONST_FUN_OBJ_1(usb_hid_device_get_last_received_report_property_obj, usb_hid_device_obj_get_last_received_report_property); - -MP_PROPERTY_GETTER(usb_hid_device_last_received_report_obj, - (mp_obj_t)&usb_hid_device_get_last_received_report_property_obj); - //| usage_page: int //| """The device usage page identifier, which designates a category of device. (read-only)""" -//| STATIC mp_obj_t usb_hid_device_obj_get_usage_page(mp_obj_t self_in) { usb_hid_device_obj_t *self = MP_OBJ_TO_PTR(self_in); return MP_OBJ_NEW_SMALL_INT(common_hal_usb_hid_device_get_usage_page(self)); @@ -270,7 +255,6 @@ MP_PROPERTY_GETTER(usb_hid_device_usage_obj, STATIC const mp_rom_map_elem_t usb_hid_device_locals_dict_table[] = { { MP_ROM_QSTR(MP_QSTR_send_report), MP_ROM_PTR(&usb_hid_device_send_report_obj) }, { MP_ROM_QSTR(MP_QSTR_get_last_received_report), MP_ROM_PTR(&usb_hid_device_get_last_received_report_obj) }, - { MP_ROM_QSTR(MP_QSTR_last_received_report), MP_ROM_PTR(&usb_hid_device_last_received_report_obj) }, { MP_ROM_QSTR(MP_QSTR_usage_page), MP_ROM_PTR(&usb_hid_device_usage_page_obj) }, { MP_ROM_QSTR(MP_QSTR_usage), MP_ROM_PTR(&usb_hid_device_usage_obj) }, diff --git a/shared-bindings/usb_hid/__init__.c b/shared-bindings/usb_hid/__init__.c index 3922ded03c..1c51502455 100644 --- a/shared-bindings/usb_hid/__init__.c +++ b/shared-bindings/usb_hid/__init__.c @@ -31,10 +31,11 @@ #include "shared-bindings/usb_hid/__init__.h" #include "shared-bindings/usb_hid/Device.h" +#include "supervisor/shared/translate/translate.h" + //| """USB Human Interface Device //| //| The `usb_hid` module allows you to output data as a HID device.""" -//| //| devices: Tuple[Device, ...] //| """Tuple of all active HID device interfaces. @@ -46,7 +47,6 @@ //| containing a `Device` that describes the boot device chosen (keyboard or mouse). //| The request for a boot device overrides any other HID devices. //| """ -//| //| def disable() -> None: //| """Do not present any USB HID devices to the host computer. diff --git a/shared-bindings/usb_host/Port.c b/shared-bindings/usb_host/Port.c index 8f54246584..7fb79e75a5 100644 --- a/shared-bindings/usb_host/Port.c +++ b/shared-bindings/usb_host/Port.c @@ -35,14 +35,13 @@ //| //| def __init__(self, dp: microcontroller.Pin, dm: microcontroller.Pin) -> None: //| """Create a USB host port on the given pins. Access attached devices -//| through the `usb` module. Keep this object referenced while -//| interacting with devices, otherwise they will be disconnected. +//| through the `usb` module. Keep this object referenced while +//| interacting with devices, otherwise they will be disconnected. //| -//| :param ~microcontroller.Pin dp: The data plus pin -//| :param ~microcontroller.Pin dm: The data minus pin +//| :param ~microcontroller.Pin dp: The data plus pin +//| :param ~microcontroller.Pin dm: The data minus pin //| """ //| ... -//| STATIC mp_obj_t usb_host_port_make_new(const mp_obj_type_t *type, size_t n_args, size_t n_kw, const mp_obj_t *args) { // check number of arguments @@ -61,7 +60,6 @@ STATIC mp_obj_t usb_host_port_make_new(const mp_obj_type_t *type, //| def deinit(self) -> None: //| """Turn off the USB host port and release the pins for other use.""" //| ... -//| STATIC mp_obj_t usb_host_port_obj_deinit(mp_obj_t self_in) { usb_host_port_obj_t *self = MP_OBJ_TO_PTR(self_in); common_hal_usb_host_port_deinit(self); @@ -72,7 +70,6 @@ MP_DEFINE_CONST_FUN_OBJ_1(usb_host_port_deinit_obj, usb_host_port_obj_deinit); //| def __enter__(self) -> Port: //| """No-op used by Context Managers.""" //| ... -//| // Provided by context manager helper. //| def __exit__(self) -> None: diff --git a/shared-bindings/usb_host/__init__.c b/shared-bindings/usb_host/__init__.c index c689a2521a..5c884b3ec2 100644 --- a/shared-bindings/usb_host/__init__.c +++ b/shared-bindings/usb_host/__init__.c @@ -36,7 +36,6 @@ //| The `usb_host` module allows you to manage USB host ports. To communicate //| with devices use the `usb` module that is a subset of PyUSB's API. //| """ -//| STATIC mp_map_elem_t usb_host_module_globals_table[] = { { MP_ROM_QSTR(MP_QSTR___name__), MP_OBJ_NEW_QSTR(MP_QSTR_usb_host) }, diff --git a/shared-bindings/usb_midi/PortIn.c b/shared-bindings/usb_midi/PortIn.c index 0056a0818a..b63843e8dd 100644 --- a/shared-bindings/usb_midi/PortIn.c +++ b/shared-bindings/usb_midi/PortIn.c @@ -33,7 +33,7 @@ #include "py/objproperty.h" #include "py/runtime.h" #include "py/stream.h" -#include "supervisor/shared/translate.h" +#include "supervisor/shared/translate/translate.h" //| class PortIn: //| """Receives midi commands over USB""" @@ -44,7 +44,6 @@ //| PortIn objects are constructed for every corresponding entry in the USB //| descriptor and added to the ``usb_midi.ports`` tuple.""" //| ... -//| // These are standard stream methods. Code is in py/stream.c. // @@ -57,7 +56,6 @@ //| :return: Data read //| :rtype: bytes or None""" //| ... -//| //| def readinto(self, buf: WriteableBuffer, nbytes: Optional[int] = None) -> Optional[bytes]: //| """Read bytes into the ``buf``. If ``nbytes`` is specified then read at most //| that many bytes. Otherwise, read at most ``len(buf)`` bytes. diff --git a/shared-bindings/usb_midi/PortOut.c b/shared-bindings/usb_midi/PortOut.c index c468401924..5888045b79 100644 --- a/shared-bindings/usb_midi/PortOut.c +++ b/shared-bindings/usb_midi/PortOut.c @@ -33,7 +33,7 @@ #include "py/objproperty.h" #include "py/runtime.h" #include "py/stream.h" -#include "supervisor/shared/translate.h" +#include "supervisor/shared/translate/translate.h" //| class PortOut: //| """Sends midi messages to a computer over USB""" @@ -43,7 +43,6 @@ //| //| PortOut objects are constructed for every corresponding entry in the USB //| descriptor and added to the ``usb_midi.ports`` tuple.""" -//| // These are standard stream methods. Code is in py/stream.c. // diff --git a/shared-bindings/usb_midi/__init__.c b/shared-bindings/usb_midi/__init__.c index ec065d1e18..982cd144da 100644 --- a/shared-bindings/usb_midi/__init__.c +++ b/shared-bindings/usb_midi/__init__.c @@ -32,6 +32,7 @@ #include "shared-bindings/usb_midi/__init__.h" #include "shared-bindings/usb_midi/PortIn.h" #include "shared-bindings/usb_midi/PortOut.h" +#include "supervisor/shared/translate/translate.h" #include "py/runtime.h" @@ -41,7 +42,6 @@ //| //| ports: Tuple[Union[PortIn, PortOut], ...] //| """Tuple of all MIDI ports. Each item is ether `PortIn` or `PortOut`.""" -//| //| def disable() -> None: //| """Disable presenting a USB MIDI device to the host. diff --git a/shared-bindings/ustack/__init__.c b/shared-bindings/ustack/__init__.c index 17bdcbb1c0..b42fb2a614 100644 --- a/shared-bindings/ustack/__init__.c +++ b/shared-bindings/ustack/__init__.c @@ -35,7 +35,6 @@ //| """Stack information and analysis""" -//| #if MICROPY_MAX_STACK_USAGE //| def max_stack_usage() -> int: diff --git a/shared-bindings/util.c b/shared-bindings/util.c index c1ca01e0ad..5c5eafad4a 100644 --- a/shared-bindings/util.c +++ b/shared-bindings/util.c @@ -30,7 +30,7 @@ #include "py/runtime.h" #include "shared-bindings/util.h" -#include "supervisor/shared/translate.h" +#include "supervisor/shared/translate/translate.h" // If so, deinit() has already been called on the object, so complain. void raise_deinited_error(void) { diff --git a/shared-bindings/vectorio/Circle.c b/shared-bindings/vectorio/Circle.c index ded1861896..91b0d3ae34 100644 --- a/shared-bindings/vectorio/Circle.c +++ b/shared-bindings/vectorio/Circle.c @@ -8,19 +8,23 @@ #include "py/objproperty.h" #include "py/objtype.h" #include "py/runtime.h" -#include "supervisor/shared/translate.h" +#include "supervisor/shared/translate/translate.h" //| class Circle: -//| -//| def __init__(self, pixel_shader: Union[displayio.ColorConverter, displayio.Palette], radius: int, x: int, y: int) -> None: +//| def __init__( +//| self, +//| pixel_shader: Union[displayio.ColorConverter, displayio.Palette], +//| radius: int, +//| x: int, +//| y: int, +//| ) -> None: //| """Circle is positioned on screen by its center point. //| -//| :param Union[~displayio.ColorConverter,~displayio.Palette] pixel_shader: The pixel shader that produces colors from values -//| :param int radius: The radius of the circle in pixels -//| :param int x: Initial x position of the axis. -//| :param int y: Initial y position of the axis. -//| :param int color_index: Initial color_index to use when selecting color from the palette.""" -//| +//| :param Union[~displayio.ColorConverter,~displayio.Palette] pixel_shader: The pixel shader that produces colors from values +//| :param int radius: The radius of the circle in pixels +//| :param int x: Initial x position of the axis. +//| :param int y: Initial y position of the axis. +//| :param int color_index: Initial color_index to use when selecting color from the palette.""" static mp_obj_t vectorio_circle_make_new(const mp_obj_type_t *type, size_t n_args, size_t n_kw, const mp_obj_t *all_args) { enum { ARG_pixel_shader, ARG_radius, ARG_x, ARG_y, ARG_color_index }; static const mp_arg_t allowed_args[] = { @@ -34,9 +38,7 @@ static mp_obj_t vectorio_circle_make_new(const mp_obj_type_t *type, size_t n_arg mp_arg_parse_all_kw_array(n_args, n_kw, all_args, MP_ARRAY_SIZE(allowed_args), allowed_args, args); mp_int_t radius = args[ARG_radius].u_int; - if (radius < 1) { - mp_raise_ValueError_varg(translate("%q must be >= 1"), MP_QSTR_radius); - } + mp_arg_validate_int_min(radius, 1, MP_QSTR_radius); vectorio_circle_t *self = m_new_obj(vectorio_circle_t); self->base.type = &vectorio_circle_type; @@ -60,9 +62,8 @@ STATIC const vectorio_draw_protocol_t circle_draw_protocol = { }; -//| radius : int +//| radius: int //| """The radius of the circle in pixels.""" -//| STATIC mp_obj_t vectorio_circle_obj_get_radius(mp_obj_t self_in) { vectorio_circle_t *self = MP_OBJ_TO_PTR(self_in); return mp_obj_new_int(common_hal_vectorio_circle_get_radius(self)); @@ -80,9 +81,8 @@ MP_PROPERTY_GETSET(vectorio_circle_radius_obj, (mp_obj_t)&vectorio_circle_get_radius_obj, (mp_obj_t)&vectorio_circle_set_radius_obj); -//| color_index : int +//| color_index: int //| """The color_index of the circle as 0 based index of the palette.""" -//| STATIC mp_obj_t vectorio_circle_obj_get_color_index(mp_obj_t self_in) { vectorio_circle_t *self = MP_OBJ_TO_PTR(self_in); return mp_obj_new_int(common_hal_vectorio_circle_get_color_index(self)); @@ -103,16 +103,16 @@ MP_PROPERTY_GETSET(vectorio_circle_color_index_obj, // Documentation for properties inherited from VectorShape. -//| x : int +//| x: int //| """X position of the center point of the circle in the parent.""" //| -//| y : int +//| y: int //| """Y position of the center point of the circle in the parent.""" //| -//| location : Tuple[int,int] +//| location: Tuple[int, int] //| """(X,Y) position of the center point of the circle in the parent.""" //| -//| pixel_shader : Union[displayio.ColorConverter,displayio.Palette] +//| pixel_shader: Union[displayio.ColorConverter, displayio.Palette] //| """The pixel shader of the circle.""" //| diff --git a/shared-bindings/vectorio/Polygon.c b/shared-bindings/vectorio/Polygon.c index ae9d7a01ca..f4f07c66a0 100644 --- a/shared-bindings/vectorio/Polygon.c +++ b/shared-bindings/vectorio/Polygon.c @@ -9,7 +9,7 @@ #include "py/objproperty.h" #include "py/objtype.h" #include "py/runtime.h" -#include "supervisor/shared/translate.h" +#include "supervisor/shared/translate/translate.h" #define VECTORIO_POLYGON_DEBUG(...) (void)0 @@ -17,7 +17,13 @@ //| class Polygon: -//| def __init__(self, pixel_shader: Union[displayio.ColorConverter, displayio.Palette], points: List[Tuple[int, int]], x: int, y: int) -> None: +//| def __init__( +//| self, +//| pixel_shader: Union[displayio.ColorConverter, displayio.Palette], +//| points: List[Tuple[int, int]], +//| x: int, +//| y: int, +//| ) -> None: //| """Represents a closed shape by ordered vertices. The path will be treated as //| 'closed', the last point will connect to the first point. //| @@ -27,7 +33,6 @@ //| :param int x: Initial screen x position of the 0,0 origin in the points list. //| :param int y: Initial screen y position of the 0,0 origin in the points list. //| :param int color_index: Initial color_index to use when selecting color from the palette.""" -//| static mp_obj_t vectorio_polygon_make_new(const mp_obj_type_t *type, size_t n_args, size_t n_kw, const mp_obj_t *all_args) { enum { ARG_pixel_shader, ARG_points_list, ARG_x, ARG_y, ARG_color_index }; static const mp_arg_t allowed_args[] = { @@ -67,7 +72,6 @@ STATIC const vectorio_draw_protocol_t polygon_draw_protocol = { //| points: List[Tuple[int, int]] //| """Vertices for the polygon.""" -//| STATIC mp_obj_t vectorio_polygon_obj_get_points(mp_obj_t self_in) { vectorio_polygon_t *self = MP_OBJ_TO_PTR(self_in); return common_hal_vectorio_polygon_get_points(self); @@ -86,9 +90,8 @@ MP_PROPERTY_GETSET(vectorio_polygon_points_obj, (mp_obj_t)&vectorio_polygon_get_points_obj, (mp_obj_t)&vectorio_polygon_set_points_obj); -//| color_index : int +//| color_index: int //| """The color_index of the polygon as 0 based index of the palette.""" -//| STATIC mp_obj_t vectorio_polygon_obj_get_color_index(mp_obj_t self_in) { vectorio_polygon_t *self = MP_OBJ_TO_PTR(self_in); return mp_obj_new_int(common_hal_vectorio_polygon_get_color_index(self)); @@ -109,16 +112,16 @@ MP_PROPERTY_GETSET(vectorio_polygon_color_index_obj, // Documentation for properties inherited from VectorShape. -//| x : int +//| x: int //| """X position of the 0,0 origin in the points list.""" //| -//| y : int +//| y: int //| """Y position of the 0,0 origin in the points list.""" //| -//| location : Tuple[int,int] +//| location: Tuple[int, int] //| """(X,Y) position of the 0,0 origin in the points list.""" //| -//| pixel_shader : Union[displayio.ColorConverter,displayio.Palette] +//| pixel_shader: Union[displayio.ColorConverter, displayio.Palette] //| """The pixel shader of the polygon.""" //| diff --git a/shared-bindings/vectorio/Rectangle.c b/shared-bindings/vectorio/Rectangle.c index 739a1ba9d1..5c163a7693 100644 --- a/shared-bindings/vectorio/Rectangle.c +++ b/shared-bindings/vectorio/Rectangle.c @@ -7,19 +7,25 @@ #include "py/objtype.h" #include "py/runtime.h" -#include "supervisor/shared/translate.h" +#include "supervisor/shared/translate/translate.h" //| class Rectangle: -//| def __init__(self, pixel_shader: Union[displayio.ColorConverter, displayio.Palette], width: int, height: int, x: int, y: int) -> None: +//| def __init__( +//| self, +//| pixel_shader: Union[displayio.ColorConverter, displayio.Palette], +//| width: int, +//| height: int, +//| x: int, +//| y: int, +//| ) -> None: //| """Represents a rectangle by defining its bounds //| -//| :param Union[~displayio.ColorConverter,~displayio.Palette] pixel_shader: The pixel shader that produces colors from values -//| :param int width: The number of pixels wide -//| :param int height: The number of pixels high -//| :param int x: Initial x position of the top left corner. -//| :param int y: Initial y position of the top left corner. -//| :param int color_index: Initial color_index to use when selecting color from the palette.""" -//| +//| :param Union[~displayio.ColorConverter,~displayio.Palette] pixel_shader: The pixel shader that produces colors from values +//| :param int width: The number of pixels wide +//| :param int height: The number of pixels high +//| :param int x: Initial x position of the top left corner. +//| :param int y: Initial y position of the top left corner. +//| :param int color_index: Initial color_index to use when selecting color from the palette.""" static mp_obj_t vectorio_rectangle_make_new(const mp_obj_type_t *type, size_t n_args, size_t n_kw, const mp_obj_t *all_args) { enum { ARG_pixel_shader, ARG_width, ARG_height, ARG_x, ARG_y, ARG_color_index }; static const mp_arg_t allowed_args[] = { @@ -34,13 +40,9 @@ static mp_obj_t vectorio_rectangle_make_new(const mp_obj_type_t *type, size_t n_ mp_arg_parse_all_kw_array(n_args, n_kw, all_args, MP_ARRAY_SIZE(allowed_args), allowed_args, args); mp_int_t width = args[ARG_width].u_int; - if (width < 1) { - mp_raise_ValueError_varg(translate("%q must be >= 1"), MP_QSTR_width); - } + mp_arg_validate_int_min(width, 1, MP_QSTR_width); mp_int_t height = args[ARG_height].u_int; - if (height < 1) { - mp_raise_ValueError_varg(translate("%q must be >= 1"), MP_QSTR_height); - } + mp_arg_validate_int_min(height, 1, MP_QSTR_height); vectorio_rectangle_t *self = m_new_obj(vectorio_rectangle_t); self->base.type = &vectorio_rectangle_type; @@ -63,9 +65,8 @@ STATIC const vectorio_draw_protocol_t rectangle_draw_protocol = { .draw_protocol_impl = &vectorio_vector_shape_draw_protocol_impl }; -//| width : int +//| width: int //| """The width of the rectangle in pixels.""" -//| STATIC mp_obj_t vectorio_rectangle_obj_get_width(mp_obj_t self_in) { vectorio_rectangle_t *self = MP_OBJ_TO_PTR(self_in); return mp_obj_new_int(common_hal_vectorio_rectangle_get_width(self)); @@ -86,9 +87,8 @@ const mp_obj_property_t vectorio_rectangle_width_obj = { MP_ROM_NONE}, }; -//| height : int +//| height: int //| """The height of the rectangle in pixels.""" -//| STATIC mp_obj_t vectorio_rectangle_obj_get_height(mp_obj_t self_in) { vectorio_rectangle_t *self = MP_OBJ_TO_PTR(self_in); return mp_obj_new_int(common_hal_vectorio_rectangle_get_height(self)); @@ -109,9 +109,8 @@ const mp_obj_property_t vectorio_rectangle_height_obj = { MP_ROM_NONE}, }; -//| color_index : int +//| color_index: int //| """The color_index of the rectangle in 1 based index of the palette.""" -//| STATIC mp_obj_t vectorio_rectangle_obj_get_color_index(mp_obj_t self_in) { vectorio_rectangle_t *self = MP_OBJ_TO_PTR(self_in); return mp_obj_new_int(common_hal_vectorio_rectangle_get_color_index(self)); @@ -134,16 +133,16 @@ const mp_obj_property_t vectorio_rectangle_color_index_obj = { // Documentation for properties inherited from VectorShape. -//| x : int +//| x: int //| """X position of the top left corner of the rectangle in the parent.""" //| -//| y : int +//| y: int //| """Y position of the top left corner of the rectangle in the parent.""" //| -//| location : Tuple[int,int] +//| location: Tuple[int, int] //| """(X,Y) position of the top left corner of the rectangle in the parent.""" //| -//| pixel_shader : Union[displayio.ColorConverter,displayio.Palette] +//| pixel_shader: Union[displayio.ColorConverter, displayio.Palette] //| """The pixel shader of the rectangle.""" //| diff --git a/shared-bindings/vectorio/VectorShape.c b/shared-bindings/vectorio/VectorShape.c index 6a3e192cb9..ba55cfb851 100644 --- a/shared-bindings/vectorio/VectorShape.c +++ b/shared-bindings/vectorio/VectorShape.c @@ -16,7 +16,7 @@ #include "py/objproperty.h" #include "py/objtype.h" #include "py/runtime.h" -#include "supervisor/shared/translate.h" +#include "supervisor/shared/translate/translate.h" // shape: The shape implementation to draw. diff --git a/shared-bindings/vectorio/__init__.c b/shared-bindings/vectorio/__init__.c index 6e39f26591..7ad77da681 100644 --- a/shared-bindings/vectorio/__init__.c +++ b/shared-bindings/vectorio/__init__.c @@ -30,7 +30,6 @@ //| group.append(polygon) //| //| """ -//| STATIC const mp_rom_map_elem_t vectorio_module_globals_table[] = { { MP_ROM_QSTR(MP_QSTR___name__), MP_ROM_QSTR(MP_QSTR_vectorio) }, diff --git a/shared-bindings/watchdog/WatchDogMode.c b/shared-bindings/watchdog/WatchDogMode.c index beea4d0512..b9ee82e186 100644 --- a/shared-bindings/watchdog/WatchDogMode.c +++ b/shared-bindings/watchdog/WatchDogMode.c @@ -31,7 +31,6 @@ //| //| def __init__(self) -> None: //| """Enum-like class to define the run mode of the watchdog timer.""" -//| //| RAISE: WatchDogMode //| """Raise an exception when the WatchDogTimer expires. //| diff --git a/shared-bindings/watchdog/WatchDogTimer.c b/shared-bindings/watchdog/WatchDogTimer.c index e00b288080..1d47e88b9f 100644 --- a/shared-bindings/watchdog/WatchDogTimer.c +++ b/shared-bindings/watchdog/WatchDogTimer.c @@ -42,23 +42,21 @@ //| class WatchDogTimer: //| """Timer that is used to detect code lock ups and automatically reset the microcontroller -//| when one is detected. +//| when one is detected. //| -//| A lock up is detected when the watchdog hasn't been fed after a given duration. So, make -//| sure to call `feed` within the timeout. +//| A lock up is detected when the watchdog hasn't been fed after a given duration. So, make +//| sure to call `feed` within the timeout. //| """ //| //| def __init__(self) -> None: //| """Not currently dynamically supported. Access the sole instance through `microcontroller.watchdog`.""" //| ... -//| //| def feed(self) -> None: //| """Feed the watchdog timer. This must be called regularly, otherwise //| the timer will expire.""" //| ... -//| STATIC mp_obj_t watchdog_watchdogtimer_feed(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); @@ -76,7 +74,6 @@ STATIC MP_DEFINE_CONST_FUN_OBJ_1(watchdog_watchdogtimer_feed_obj, watchdog_watch //| """Stop the watchdog timer. This may raise an error if the watchdog //| timer cannot be disabled on this platform.""" //| ... -//| STATIC mp_obj_t watchdog_watchdogtimer_deinit(mp_obj_t self_in) { watchdog_watchdogtimer_obj_t *self = MP_OBJ_TO_PTR(self_in); common_hal_watchdog_deinit(self); @@ -87,7 +84,6 @@ STATIC MP_DEFINE_CONST_FUN_OBJ_1(watchdog_watchdogtimer_deinit_obj, watchdog_wat //| timeout: float //| """The maximum number of seconds that can elapse between calls //| to feed()""" -//| STATIC mp_obj_t watchdog_watchdogtimer_obj_get_timeout(mp_obj_t self_in) { watchdog_watchdogtimer_obj_t *self = MP_OBJ_TO_PTR(self_in); return mp_obj_new_float(common_hal_watchdog_get_timeout(self)); diff --git a/shared-bindings/watchdog/__init__.c b/shared-bindings/watchdog/__init__.c index a0e357e2ac..df55ab7c16 100644 --- a/shared-bindings/watchdog/__init__.c +++ b/shared-bindings/watchdog/__init__.c @@ -76,6 +76,7 @@ //| //| print("Exited loop") //| """ +//| const mp_obj_type_t mp_type_WatchDogTimeout = { { &mp_type_type }, diff --git a/shared-bindings/wifi/Monitor.c b/shared-bindings/wifi/Monitor.c index a63c0a8023..bd688d357d 100644 --- a/shared-bindings/wifi/Monitor.c +++ b/shared-bindings/wifi/Monitor.c @@ -55,19 +55,14 @@ STATIC mp_obj_t wifi_monitor_make_new(const mp_obj_type_t *type, size_t n_args, mp_arg_val_t args[MP_ARRAY_SIZE(allowed_args)]; mp_arg_parse_all_kw_array(n_args, n_kw, all_args, MP_ARRAY_SIZE(allowed_args), allowed_args, args); - if (args[ARG_channel].u_int < 1 || args[ARG_channel].u_int > 13) { - mp_raise_ValueError_varg(translate("%q out of bounds"), MP_QSTR_channel); - } - - if (args[ARG_queue].u_int < 0) { - mp_raise_ValueError_varg(translate("%q out of bounds"), MP_QSTR_channel); - } + mp_int_t channel = mp_arg_validate_int_range(args[ARG_channel].u_int, 1, 13, MP_QSTR_channel); + mp_int_t queue = mp_arg_validate_int_min(args[ARG_queue].u_int, 0, MP_QSTR_queue); wifi_monitor_obj_t *self = MP_STATE_VM(wifi_monitor_singleton); if (common_hal_wifi_monitor_deinited()) { self = m_new_obj(wifi_monitor_obj_t); self->base.type = &wifi_monitor_type; - common_hal_wifi_monitor_construct(self, args[ARG_channel].u_int, args[ARG_queue].u_int); + common_hal_wifi_monitor_construct(self, channel, queue); MP_STATE_VM(wifi_monitor_singleton) = self; } @@ -76,7 +71,6 @@ STATIC mp_obj_t wifi_monitor_make_new(const mp_obj_type_t *type, size_t n_args, //| channel: int //| """The WiFi channel to scan.""" -//| STATIC mp_obj_t wifi_monitor_obj_get_channel(mp_obj_t self_in) { return common_hal_wifi_monitor_get_channel(self_in); } @@ -98,7 +92,6 @@ MP_PROPERTY_GETSET(wifi_monitor_channel_obj, //| queue: int //| """The queue size for buffering the packet.""" -//| STATIC mp_obj_t wifi_monitor_obj_get_queue(mp_obj_t self_in) { return common_hal_wifi_monitor_get_queue(self_in); } diff --git a/shared-bindings/wifi/Monitor.h b/shared-bindings/wifi/Monitor.h index 38c52a05e7..b828616ddb 100644 --- a/shared-bindings/wifi/Monitor.h +++ b/shared-bindings/wifi/Monitor.h @@ -29,7 +29,7 @@ #include "common-hal/wifi/Monitor.h" -const mp_obj_type_t wifi_monitor_type; +extern const mp_obj_type_t wifi_monitor_type; void common_hal_wifi_monitor_construct(wifi_monitor_obj_t *self, uint8_t channel, size_t queue); diff --git a/shared-bindings/wifi/Network.c b/shared-bindings/wifi/Network.c index 9a457b9499..387b1f587d 100644 --- a/shared-bindings/wifi/Network.c +++ b/shared-bindings/wifi/Network.c @@ -31,19 +31,15 @@ #include "shared-bindings/wifi/Network.h" //| class Network: -//| """A wifi network provided by a nearby access point. -//| -//| """ +//| """A wifi network provided by a nearby access point.""" //| //| def __init__(self) -> None: //| """You cannot create an instance of `wifi.Network`. They are returned by `wifi.Radio.start_scanning_networks`.""" //| ... -//| //| ssid: str //| """String id of the network""" -//| STATIC mp_obj_t wifi_network_get_ssid(mp_obj_t self) { return common_hal_wifi_network_get_ssid(self); @@ -56,7 +52,6 @@ MP_PROPERTY_GETTER(wifi_network_ssid_obj, //| bssid: bytes //| """BSSID of the network (usually the AP's MAC address)""" -//| STATIC mp_obj_t wifi_network_get_bssid(mp_obj_t self) { return common_hal_wifi_network_get_bssid(self); @@ -69,7 +64,6 @@ MP_PROPERTY_GETTER(wifi_network_bssid_obj, //| rssi: int //| """Signal strength of the network""" -//| STATIC mp_obj_t wifi_network_get_rssi(mp_obj_t self) { return common_hal_wifi_network_get_rssi(self); @@ -82,7 +76,6 @@ MP_PROPERTY_GETTER(wifi_network_rssi_obj, //| channel: int //| """Channel number the network is operating on""" -//| STATIC mp_obj_t wifi_network_get_channel(mp_obj_t self) { return common_hal_wifi_network_get_channel(self); @@ -94,7 +87,6 @@ MP_PROPERTY_GETTER(wifi_network_channel_obj, //| country: str //| """String id of the country code""" -//| STATIC mp_obj_t wifi_network_get_country(mp_obj_t self) { return common_hal_wifi_network_get_country(self); diff --git a/shared-bindings/wifi/Network.h b/shared-bindings/wifi/Network.h index 0f07e7b555..574d690f37 100644 --- a/shared-bindings/wifi/Network.h +++ b/shared-bindings/wifi/Network.h @@ -33,7 +33,7 @@ #include "py/objstr.h" -const mp_obj_type_t wifi_network_type; +extern const mp_obj_type_t wifi_network_type; extern mp_obj_t common_hal_wifi_network_get_ssid(wifi_network_obj_t *self); extern mp_obj_t common_hal_wifi_network_get_bssid(wifi_network_obj_t *self); diff --git a/shared-bindings/wifi/Radio.c b/shared-bindings/wifi/Radio.c index cf1e9dfc4e..57e953ec68 100644 --- a/shared-bindings/wifi/Radio.c +++ b/shared-bindings/wifi/Radio.c @@ -27,7 +27,6 @@ #include "shared-bindings/wifi/__init__.h" #include "shared-bindings/wifi/AuthMode.h" -#include #include #include "py/runtime.h" @@ -35,11 +34,48 @@ #define MAC_ADDRESS_LENGTH 6 +STATIC bool hostname_valid(const char *ptr, size_t len) { + #if 0 // validated by mp_arg_validate_length_range + if (len == 0 || len > 253) { + // at most 253 characters long + return false; + } + #endif + int partlen = 0; + while (len) { + char c = *ptr++; + len--; + if (c == '.') { + if (partlen == 0 || partlen > 63) { + return false; + } + partlen = 0; + continue; + } + partlen++; + if (c == '-') { + if (partlen == 1) { + return false; // part cannot begin with a dash + } + continue; + } else if ( + (c >= 'a' && c <= 'z') || + (c >= 'A' && c <= 'Z') || + (c >= '0' && c <= '9')) { + continue; + } + return false; + } + // check length of last part + return !(partlen > 63); +} + + //| class Radio: //| """Native wifi radio. //| -//| This class manages the station and access point functionality of the native -//| Wifi radio. +//| This class manages the station and access point functionality of the native +//| Wifi radio. //| //| """ //| @@ -48,13 +84,11 @@ //| """You cannot create an instance of `wifi.Radio`. //| Use `wifi.radio` to access the sole instance available.""" //| ... -//| //| enabled: bool //| """``True`` when the wifi radio is enabled. //| If you set the value to ``False``, any open sockets will be closed. //| """ -//| STATIC mp_obj_t wifi_radio_get_enabled(mp_obj_t self) { return mp_obj_new_bool(common_hal_wifi_radio_get_enabled(self)); } @@ -76,7 +110,6 @@ MP_PROPERTY_GETSET(wifi_radio_enabled_obj, //| hostname: Union[str | ReadableBuffer] //| """Hostname for wifi interface. When the hostname is altered after interface started/connected //| the changes would only be reflected once the interface restarts/reconnects.""" -//| STATIC mp_obj_t wifi_radio_get_hostname(mp_obj_t self_in) { wifi_radio_obj_t *self = MP_OBJ_TO_PTR(self_in); return common_hal_wifi_radio_get_hostname(self); @@ -87,18 +120,11 @@ STATIC mp_obj_t wifi_radio_set_hostname(mp_obj_t self_in, mp_obj_t hostname_in) mp_buffer_info_t hostname; mp_get_buffer_raise(hostname_in, &hostname, MP_BUFFER_READ); - if (hostname.len < 1 || hostname.len > 253) { - mp_raise_ValueError(translate("Hostname must be between 1 and 253 characters")); - } + mp_arg_validate_length_range(hostname.len, 1, 253, MP_QSTR_hostname); - #ifndef CONFIG_IDF_TARGET_ESP32C3 - regex_t regex; // validate hostname according to RFC 1123 - regcomp(®ex,"^(([a-z0-9]|[a-z0-9][a-z0-9\\-]{0,61}[a-z0-9])\\.)*([a-z0-9]|[a-z0-9][a-z0-9\\-]{0,61}[a-z0-9])$", REG_EXTENDED | REG_ICASE | REG_NOSUB); - if (regexec(®ex, hostname.buf, 0, NULL, 0)) { + if (!hostname_valid(hostname.buf, hostname.len)) { mp_raise_ValueError(translate("invalid hostname")); } - regfree(®ex); - #endif wifi_radio_obj_t *self = MP_OBJ_TO_PTR(self_in); common_hal_wifi_radio_set_hostname(self, hostname.buf); @@ -114,7 +140,6 @@ MP_PROPERTY_GETSET(wifi_radio_hostname_obj, //| mac_address: ReadableBuffer //| """MAC address for the station. When the address is altered after interface is connected //| the changes would only be reflected once the interface reconnects.""" -//| STATIC mp_obj_t wifi_radio_get_mac_address(mp_obj_t self_in) { wifi_radio_obj_t *self = MP_OBJ_TO_PTR(self_in); return MP_OBJ_FROM_PTR(common_hal_wifi_radio_get_mac_address(self)); @@ -140,10 +165,29 @@ MP_PROPERTY_GETSET(wifi_radio_mac_address_obj, (mp_obj_t)&wifi_radio_get_mac_address_obj, (mp_obj_t)&wifi_radio_set_mac_address_obj); +//| tx_power: float +//| """Wifi transmission power, in dBm.""" +STATIC mp_obj_t wifi_radio_get_tx_power(mp_obj_t self_in) { + wifi_radio_obj_t *self = MP_OBJ_TO_PTR(self_in); + return mp_obj_new_float(common_hal_wifi_radio_get_tx_power(self)); +} +MP_DEFINE_CONST_FUN_OBJ_1(wifi_radio_get_tx_power_obj, wifi_radio_get_tx_power); + +STATIC mp_obj_t wifi_radio_set_tx_power(mp_obj_t self_in, mp_obj_t tx_power_in) { + mp_float_t tx_power = mp_obj_get_float(tx_power_in); + wifi_radio_obj_t *self = MP_OBJ_TO_PTR(self_in); + common_hal_wifi_radio_set_tx_power(self, tx_power); + return mp_const_none; +} +MP_DEFINE_CONST_FUN_OBJ_2(wifi_radio_set_tx_power_obj, wifi_radio_set_tx_power); + +MP_PROPERTY_GETSET(wifi_radio_tx_power_obj, + (mp_obj_t)&wifi_radio_get_tx_power_obj, + (mp_obj_t)&wifi_radio_set_tx_power_obj); + //| mac_address_ap: ReadableBuffer //| """MAC address for the AP. When the address is altered after interface is started //| the changes would only be reflected once the interface restarts.""" -//| STATIC mp_obj_t wifi_radio_get_mac_address_ap(mp_obj_t self_in) { wifi_radio_obj_t *self = MP_OBJ_TO_PTR(self_in); return MP_OBJ_FROM_PTR(common_hal_wifi_radio_get_mac_address_ap(self)); @@ -169,21 +213,45 @@ MP_PROPERTY_GETSET(wifi_radio_mac_address_ap_obj, (mp_obj_t)&wifi_radio_get_mac_address_ap_obj, (mp_obj_t)&wifi_radio_set_mac_address_ap_obj); -//| 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.""" -//| ... +//| 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. //| -STATIC mp_obj_t wifi_radio_start_scanning_networks(mp_obj_t self_in) { - wifi_radio_obj_t *self = MP_OBJ_TO_PTR(self_in); +//| .. note:: +//| +//| In the raspberrypi port (RP2040 CYW43), ``start_channel`` and ``stop_channel`` are ignored. +//| """ +//| ... +STATIC mp_obj_t wifi_radio_start_scanning_networks(size_t n_args, const mp_obj_t *pos_args, mp_map_t *kw_args) { + enum { ARG_start_channel, ARG_stop_channel }; + static const mp_arg_t allowed_args[] = { + { MP_QSTR_start_channel, MP_ARG_KW_ONLY | MP_ARG_INT, {.u_int = 1} }, + { MP_QSTR_stop_channel, MP_ARG_KW_ONLY | MP_ARG_INT, {.u_int = 11} }, + }; - return common_hal_wifi_radio_start_scanning_networks(self); + wifi_radio_obj_t *self = MP_OBJ_TO_PTR(pos_args[0]); + mp_arg_val_t args[MP_ARRAY_SIZE(allowed_args)]; + mp_arg_parse_all(n_args - 1, pos_args + 1, kw_args, MP_ARRAY_SIZE(allowed_args), allowed_args, args); + + uint8_t start_channel = + (uint8_t)mp_arg_validate_int_range(args[ARG_start_channel].u_int, 1, 14, MP_QSTR_start_channel); + uint8_t stop_channel = + (uint8_t)mp_arg_validate_int_range(args[ARG_stop_channel].u_int, 1, 14, MP_QSTR_stop_channel); + // Swap if in reverse order, without complaining. + if (start_channel > stop_channel) { + uint8_t temp = stop_channel; + stop_channel = start_channel; + start_channel = temp; + } + + return common_hal_wifi_radio_start_scanning_networks(self, start_channel, stop_channel); } -STATIC MP_DEFINE_CONST_FUN_OBJ_1(wifi_radio_start_scanning_networks_obj, wifi_radio_start_scanning_networks); +STATIC MP_DEFINE_CONST_FUN_OBJ_KW(wifi_radio_start_scanning_networks_obj, 1, wifi_radio_start_scanning_networks); //| def stop_scanning_networks(self) -> None: //| """Stop scanning for Wifi networks and free any resources used to do it.""" //| ... -//| STATIC mp_obj_t wifi_radio_stop_scanning_networks(mp_obj_t self_in) { wifi_radio_obj_t *self = MP_OBJ_TO_PTR(self_in); @@ -196,7 +264,6 @@ STATIC MP_DEFINE_CONST_FUN_OBJ_1(wifi_radio_stop_scanning_networks_obj, wifi_rad //| def start_station(self) -> None: //| """Starts a Station.""" //| ... -//| STATIC mp_obj_t wifi_radio_start_station(mp_obj_t self) { common_hal_wifi_radio_start_station(self); return mp_const_none; @@ -206,34 +273,34 @@ MP_DEFINE_CONST_FUN_OBJ_1(wifi_radio_start_station_obj, wifi_radio_start_station //| def stop_station(self) -> None: //| """Stops the Station.""" //| ... -//| STATIC mp_obj_t wifi_radio_stop_station(mp_obj_t self) { common_hal_wifi_radio_stop_station(self); return mp_const_none; } MP_DEFINE_CONST_FUN_OBJ_1(wifi_radio_stop_station_obj, wifi_radio_stop_station); -//| def start_ap(self, -//| ssid: Union[str | ReadableBuffer], -//| password: Union[str | ReadableBuffer] = "", -//| *, -//| channel: Optional[int] = 1, -//| authmode: Optional[AuthMode], -//| max_connections: Optional[int] = 4) -> None: +//| def start_ap( +//| self, +//| ssid: Union[str | ReadableBuffer], +//| password: Union[str | ReadableBuffer] = "", +//| *, +//| channel: Optional[int] = 1, +//| authmode: Optional[AuthMode], +//| max_connections: Optional[int] = 4 +//| ) -> None: //| """Starts an Access Point with the specified ssid and password. //| -//| If ``channel`` is given, the access point will use that channel unless -//| a station is already operating on a different channel. +//| If ``channel`` is given, the access point will use that channel unless +//| a station is already operating on a different channel. //| -//| If ``authmode`` is given, the access point will use that Authentication -//| mode. If a password is given, ``authmode`` must not be ``OPEN``. -//| If ``authmode`` isn't given, ``OPEN`` will be used when password isn't provided, -//| otherwise ``WPA_WPA2_PSK``. +//| If ``authmode`` is given, the access point will use that Authentication +//| mode. If a password is given, ``authmode`` must not be ``OPEN``. +//| If ``authmode`` isn't given, ``OPEN`` will be used when password isn't provided, +//| otherwise ``WPA_WPA2_PSK``. //| -//| If ``max_connections`` is given, the access point will allow up to -//| that number of stations to connect.""" +//| If ``max_connections`` is given, the access point will allow up to +//| that number of stations to connect.""" //| ... -//| STATIC mp_obj_t wifi_radio_start_ap(size_t n_args, const mp_obj_t *pos_args, mp_map_t *kw_args) { enum { ARG_ssid, ARG_password, ARG_channel, ARG_authmode, ARG_max_connections }; static const mp_arg_t allowed_args[] = { @@ -259,6 +326,7 @@ STATIC mp_obj_t wifi_radio_start_ap(size_t n_args, const mp_obj_t *pos_args, mp_ mp_buffer_info_t ssid; mp_get_buffer_raise(args[ARG_ssid].u_obj, &ssid, MP_BUFFER_READ); + mp_arg_validate_length_range(ssid.len, 1, 32, MP_QSTR_ssid); mp_buffer_info_t password; password.len = 0; @@ -269,9 +337,7 @@ STATIC mp_obj_t wifi_radio_start_ap(size_t n_args, const mp_obj_t *pos_args, mp_ authmode = (1 << AUTHMODE_WPA) | (1 << AUTHMODE_WPA2) | (1 << AUTHMODE_PSK); } mp_get_buffer_raise(args[ARG_password].u_obj, &password, MP_BUFFER_READ); - if (password.len > 0 && (password.len < 8 || password.len > 63)) { - mp_raise_ValueError(translate("WiFi password must be between 8 and 63 characters")); - } + mp_arg_validate_length_range(password.len, 8, 63, MP_QSTR_password); } else { authmode = 1; } @@ -284,34 +350,34 @@ STATIC MP_DEFINE_CONST_FUN_OBJ_KW(wifi_radio_start_ap_obj, 1, wifi_radio_start_a //| def stop_ap(self) -> None: //| """Stops the Access Point.""" //| ... -//| STATIC mp_obj_t wifi_radio_stop_ap(mp_obj_t self) { common_hal_wifi_radio_stop_ap(self); return mp_const_none; } MP_DEFINE_CONST_FUN_OBJ_1(wifi_radio_stop_ap_obj, wifi_radio_stop_ap); -//| def connect(self, -//| ssid: Union[str | ReadableBuffer], -//| password: Union[str | ReadableBuffer] = "", -//| *, -//| channel: Optional[int] = 0, -//| bssid: Optional[Union[str | ReadableBuffer]] = "", -//| timeout: Optional[float] = None) -> None: +//| def connect( +//| self, +//| ssid: Union[str | ReadableBuffer], +//| password: Union[str | ReadableBuffer] = "", +//| *, +//| channel: Optional[int] = 0, +//| bssid: Optional[Union[str | ReadableBuffer]] = "", +//| timeout: Optional[float] = None +//| ) -> None: //| """Connects to the given ssid and waits for an ip address. Reconnections are handled -//| automatically once one connection succeeds. +//| automatically once one connection succeeds. //| -//| By default, this will scan all channels and connect to the access point (AP) with the -//| given ``ssid`` and greatest signal strength (rssi). +//| By default, this will scan all channels and connect to the access point (AP) with the +//| given ``ssid`` and greatest signal strength (rssi). //| -//| If ``channel`` is given, the scan will begin with the given channel and connect to -//| the first AP with the given ``ssid``. This can speed up the connection time -//| significantly because a full scan doesn't occur. +//| If ``channel`` is given, the scan will begin with the given channel and connect to +//| the first AP with the given ``ssid``. This can speed up the connection time +//| significantly because a full scan doesn't occur. //| -//| If ``bssid`` is given, the scan will start at the first channel or the one given and -//| connect to the AP with the given ``bssid`` and ``ssid``.""" +//| If ``bssid`` is given, the scan will start at the first channel or the one given and +//| connect to the AP with the given ``bssid`` and ``ssid``.""" //| ... -//| STATIC mp_obj_t wifi_radio_connect(size_t n_args, const mp_obj_t *pos_args, mp_map_t *kw_args) { enum { ARG_ssid, ARG_password, ARG_channel, ARG_bssid, ARG_timeout }; static const mp_arg_t allowed_args[] = { @@ -334,17 +400,13 @@ STATIC mp_obj_t wifi_radio_connect(size_t n_args, const mp_obj_t *pos_args, mp_m mp_buffer_info_t ssid; ssid.len = 0; mp_get_buffer_raise(args[ARG_ssid].u_obj, &ssid, MP_BUFFER_READ); - if (ssid.len > 32) { - mp_raise_ValueError(translate("ssid can't be more than 32 bytes")); - } + mp_arg_validate_length_range(ssid.len, 1, 32, MP_QSTR_ssid); mp_buffer_info_t password; password.len = 0; if (args[ARG_password].u_obj != MP_OBJ_NULL) { mp_get_buffer_raise(args[ARG_password].u_obj, &password, MP_BUFFER_READ); - if (password.len > 0 && (password.len < 8 || password.len > 63)) { - mp_raise_ValueError(translate("WiFi password must be between 8 and 63 characters")); - } + mp_arg_validate_length_range(password.len, 8, 63, MP_QSTR_password); } #define MAC_ADDRESS_LENGTH 6 @@ -374,7 +436,6 @@ STATIC MP_DEFINE_CONST_FUN_OBJ_KW(wifi_radio_connect_obj, 1, wifi_radio_connect) //| ipv4_gateway: Optional[ipaddress.IPv4Address] //| """IP v4 Address of the station gateway when connected to an access point. None otherwise.""" -//| STATIC mp_obj_t wifi_radio_get_ipv4_gateway(mp_obj_t self) { return common_hal_wifi_radio_get_ipv4_gateway(self); @@ -386,7 +447,6 @@ MP_PROPERTY_GETTER(wifi_radio_ipv4_gateway_obj, //| ipv4_gateway_ap: Optional[ipaddress.IPv4Address] //| """IP v4 Address of the access point gateway, when enabled. None otherwise.""" -//| STATIC mp_obj_t wifi_radio_get_ipv4_gateway_ap(mp_obj_t self) { return common_hal_wifi_radio_get_ipv4_gateway_ap(self); @@ -398,7 +458,6 @@ MP_PROPERTY_GETTER(wifi_radio_ipv4_gateway_ap_obj, //| ipv4_subnet: Optional[ipaddress.IPv4Address] //| """IP v4 Address of the station subnet when connected to an access point. None otherwise.""" -//| STATIC mp_obj_t wifi_radio_get_ipv4_subnet(mp_obj_t self) { return common_hal_wifi_radio_get_ipv4_subnet(self); @@ -410,7 +469,6 @@ MP_PROPERTY_GETTER(wifi_radio_ipv4_subnet_obj, //| ipv4_subnet_ap: Optional[ipaddress.IPv4Address] //| """IP v4 Address of the access point subnet, when enabled. None otherwise.""" -//| STATIC mp_obj_t wifi_radio_get_ipv4_subnet_ap(mp_obj_t self) { return common_hal_wifi_radio_get_ipv4_subnet_ap(self); @@ -420,21 +478,48 @@ MP_DEFINE_CONST_FUN_OBJ_1(wifi_radio_get_ipv4_subnet_ap_obj, wifi_radio_get_ipv4 MP_PROPERTY_GETTER(wifi_radio_ipv4_subnet_ap_obj, (mp_obj_t)&wifi_radio_get_ipv4_subnet_ap_obj); +//| def set_ipv4_address( +//| self, +//| *, +//| ipv4: ipaddress.IPv4Address, +//| netmask: ipaddress.IPv4Address, +//| gateway: ipaddress.IPv4Address, +//| ipv4_dns: Optional[ipaddress.IPv4Address] +//| ) -> None: +//| """Sets the IP v4 address of the station. Must include the netmask and gateway. DNS address is optional. +//| Setting the address manually will stop the DHCP client.""" +//| ... +STATIC mp_obj_t wifi_radio_set_ipv4_address(size_t n_args, const mp_obj_t *pos_args, mp_map_t *kw_args) { + enum { ARG_ipv4, ARG_netmask, ARG_gateway, ARG_ipv4_dns }; + static const mp_arg_t allowed_args[] = { + { MP_QSTR_ipv4, MP_ARG_REQUIRED | MP_ARG_KW_ONLY | MP_ARG_OBJ, }, + { MP_QSTR_netmask, MP_ARG_REQUIRED | MP_ARG_KW_ONLY | MP_ARG_OBJ, }, + { MP_QSTR_gateway, MP_ARG_REQUIRED | MP_ARG_KW_ONLY | MP_ARG_OBJ, }, + { MP_QSTR_ipv4_dns, MP_ARG_OBJ | MP_ARG_KW_ONLY, {.u_obj = MP_OBJ_NULL} }, + }; + + wifi_radio_obj_t *self = MP_OBJ_TO_PTR(pos_args[0]); + mp_arg_val_t args[MP_ARRAY_SIZE(allowed_args)]; + mp_arg_parse_all(n_args - 1, pos_args + 1, kw_args, MP_ARRAY_SIZE(allowed_args), allowed_args, args); + + common_hal_wifi_radio_set_ipv4_address(self, args[ARG_ipv4].u_obj, args[ARG_netmask].u_obj, args[ARG_gateway].u_obj, args[ARG_ipv4_dns].u_obj); + return mp_const_none; +} +STATIC MP_DEFINE_CONST_FUN_OBJ_KW(wifi_radio_set_ipv4_address_obj, 1, wifi_radio_set_ipv4_address); + //| ipv4_address: Optional[ipaddress.IPv4Address] //| """IP v4 Address of the station when connected to an access point. None otherwise.""" -//| -STATIC mp_obj_t wifi_radio_get_ipv4_address(mp_obj_t self) { +STATIC mp_obj_t _wifi_radio_get_ipv4_address(mp_obj_t self) { return common_hal_wifi_radio_get_ipv4_address(self); } -MP_DEFINE_CONST_FUN_OBJ_1(wifi_radio_get_ipv4_address_obj, wifi_radio_get_ipv4_address); +MP_DEFINE_CONST_FUN_OBJ_1(wifi_radio_get_ipv4_address_obj, _wifi_radio_get_ipv4_address); MP_PROPERTY_GETTER(wifi_radio_ipv4_address_obj, (mp_obj_t)&wifi_radio_get_ipv4_address_obj); //| ipv4_address_ap: Optional[ipaddress.IPv4Address] //| """IP v4 Address of the access point, when enabled. None otherwise.""" -//| STATIC mp_obj_t wifi_radio_get_ipv4_address_ap(mp_obj_t self) { return common_hal_wifi_radio_get_ipv4_address_ap(self); @@ -444,33 +529,59 @@ MP_DEFINE_CONST_FUN_OBJ_1(wifi_radio_get_ipv4_address_ap_obj, wifi_radio_get_ipv MP_PROPERTY_GETTER(wifi_radio_ipv4_address_ap_obj, (mp_obj_t)&wifi_radio_get_ipv4_address_ap_obj); -//| ipv4_dns: Optional[ipaddress.IPv4Address] -//| """IP v4 Address of the DNS server in use when connected to an access point. None otherwise.""" -//| +//| ipv4_dns: ipaddress.IPv4Address +//| """IP v4 Address of the DNS server to be used.""" STATIC mp_obj_t wifi_radio_get_ipv4_dns(mp_obj_t self) { return common_hal_wifi_radio_get_ipv4_dns(self); } MP_DEFINE_CONST_FUN_OBJ_1(wifi_radio_get_ipv4_dns_obj, wifi_radio_get_ipv4_dns); -MP_PROPERTY_GETTER(wifi_radio_ipv4_dns_obj, - (mp_obj_t)&wifi_radio_get_ipv4_dns_obj); +STATIC mp_obj_t wifi_radio_set_ipv4_dns(mp_obj_t self, mp_obj_t ipv4_dns_addr) { + common_hal_wifi_radio_set_ipv4_dns(self, ipv4_dns_addr); + + return mp_const_none; +} +MP_DEFINE_CONST_FUN_OBJ_2(wifi_radio_set_ipv4_dns_obj, wifi_radio_set_ipv4_dns); + +MP_PROPERTY_GETSET(wifi_radio_ipv4_dns_obj, + (mp_obj_t)&wifi_radio_get_ipv4_dns_obj, + (mp_obj_t)&wifi_radio_set_ipv4_dns_obj); //| ap_info: Optional[Network] //| """Network object containing BSSID, SSID, authmode, channel, country and RSSI when connected to an access point. None otherwise.""" -//| STATIC mp_obj_t wifi_radio_get_ap_info(mp_obj_t self) { return common_hal_wifi_radio_get_ap_info(self); } MP_DEFINE_CONST_FUN_OBJ_1(wifi_radio_get_ap_info_obj, wifi_radio_get_ap_info); +//| def start_dhcp(self) -> None: +//| """Starts the DHCP client.""" +//| ... +STATIC mp_obj_t wifi_radio_start_dhcp_client(mp_obj_t self) { + common_hal_wifi_radio_start_dhcp_client(self); + return mp_const_none; +} +MP_DEFINE_CONST_FUN_OBJ_1(wifi_radio_start_dhcp_client_obj, wifi_radio_start_dhcp_client); + +//| def stop_dhcp(self) -> None: +//| """Stops the DHCP client. Needed to assign a static IP address.""" +//| ... +STATIC mp_obj_t wifi_radio_stop_dhcp_client(mp_obj_t self) { + common_hal_wifi_radio_stop_dhcp_client(self); + return mp_const_none; +} +MP_DEFINE_CONST_FUN_OBJ_1(wifi_radio_stop_dhcp_client_obj, wifi_radio_stop_dhcp_client); + MP_PROPERTY_GETTER(wifi_radio_ap_info_obj, (mp_obj_t)&wifi_radio_get_ap_info_obj); -//| def ping(self, ip: ipaddress.IPv4Address, *, timeout: Optional[float] = 0.5) -> Optional[float]: +//| def ping( +//| self, ip: ipaddress.IPv4Address, *, timeout: Optional[float] = 0.5 +//| ) -> Optional[float]: //| """Ping an IP to test connectivity. Returns echo time in seconds. -//| Returns None when it times out.""" +//| Returns None when it times out.""" //| ... //| STATIC mp_obj_t wifi_radio_ping(size_t n_args, const mp_obj_t *pos_args, mp_map_t *kw_args) { @@ -506,6 +617,7 @@ STATIC const mp_rom_map_elem_t wifi_radio_locals_dict_table[] = { { MP_ROM_QSTR(MP_QSTR_mac_address), MP_ROM_PTR(&wifi_radio_mac_address_obj) }, { MP_ROM_QSTR(MP_QSTR_mac_address_ap), MP_ROM_PTR(&wifi_radio_mac_address_ap_obj) }, + { MP_ROM_QSTR(MP_QSTR_tx_power), MP_ROM_PTR(&wifi_radio_tx_power_obj) }, { MP_ROM_QSTR(MP_QSTR_start_scanning_networks), MP_ROM_PTR(&wifi_radio_start_scanning_networks_obj) }, { MP_ROM_QSTR(MP_QSTR_stop_scanning_networks), MP_ROM_PTR(&wifi_radio_stop_scanning_networks_obj) }, @@ -515,6 +627,9 @@ STATIC const mp_rom_map_elem_t wifi_radio_locals_dict_table[] = { { MP_ROM_QSTR(MP_QSTR_start_ap), MP_ROM_PTR(&wifi_radio_start_ap_obj) }, { MP_ROM_QSTR(MP_QSTR_stop_ap), MP_ROM_PTR(&wifi_radio_stop_ap_obj) }, + { MP_ROM_QSTR(MP_QSTR_start_dhcp), MP_ROM_PTR(&wifi_radio_start_dhcp_client_obj) }, + { MP_ROM_QSTR(MP_QSTR_stop_dhcp), MP_ROM_PTR(&wifi_radio_stop_dhcp_client_obj) }, + { MP_ROM_QSTR(MP_QSTR_connect), MP_ROM_PTR(&wifi_radio_connect_obj) }, // { MP_ROM_QSTR(MP_QSTR_connect_to_enterprise), MP_ROM_PTR(&wifi_radio_connect_to_enterprise_obj) }, @@ -527,6 +642,8 @@ STATIC const mp_rom_map_elem_t wifi_radio_locals_dict_table[] = { { MP_ROM_QSTR(MP_QSTR_ipv4_address), MP_ROM_PTR(&wifi_radio_ipv4_address_obj) }, { MP_ROM_QSTR(MP_QSTR_ipv4_address_ap), MP_ROM_PTR(&wifi_radio_ipv4_address_ap_obj) }, + { MP_ROM_QSTR(MP_QSTR_set_ipv4_address), MP_ROM_PTR(&wifi_radio_set_ipv4_address_obj) }, + // { MP_ROM_QSTR(MP_QSTR_access_point_active), MP_ROM_PTR(&wifi_radio_access_point_active_obj) }, // { MP_ROM_QSTR(MP_QSTR_start_access_point), MP_ROM_PTR(&wifi_radio_start_access_point_obj) }, diff --git a/shared-bindings/wifi/Radio.h b/shared-bindings/wifi/Radio.h index cee9f6ef15..370bdbd917 100644 --- a/shared-bindings/wifi/Radio.h +++ b/shared-bindings/wifi/Radio.h @@ -33,7 +33,7 @@ #include "py/objstr.h" -const mp_obj_type_t wifi_radio_type; +extern const mp_obj_type_t wifi_radio_type; typedef enum { // 0 is circuitpython-specific; 1-53 are IEEE; 200+ are Espressif @@ -82,7 +82,10 @@ extern void common_hal_wifi_radio_set_mac_address(wifi_radio_obj_t *self, const extern mp_obj_t common_hal_wifi_radio_get_mac_address_ap(wifi_radio_obj_t *self); extern void common_hal_wifi_radio_set_mac_address_ap(wifi_radio_obj_t *self, const uint8_t *mac); -extern mp_obj_t common_hal_wifi_radio_start_scanning_networks(wifi_radio_obj_t *self); +extern mp_float_t common_hal_wifi_radio_get_tx_power(wifi_radio_obj_t *self); +extern void common_hal_wifi_radio_set_tx_power(wifi_radio_obj_t *self, const mp_float_t power); + +extern mp_obj_t common_hal_wifi_radio_start_scanning_networks(wifi_radio_obj_t *self, uint8_t start_channel, uint8_t stop_channel); extern void common_hal_wifi_radio_stop_scanning_networks(wifi_radio_obj_t *self); extern void common_hal_wifi_radio_start_station(wifi_radio_obj_t *self); @@ -91,17 +94,24 @@ extern void common_hal_wifi_radio_stop_station(wifi_radio_obj_t *self); extern void common_hal_wifi_radio_start_ap(wifi_radio_obj_t *self, uint8_t *ssid, size_t ssid_len, uint8_t *password, size_t password_len, uint8_t channel, uint8_t authmode, uint8_t max_connections); extern void common_hal_wifi_radio_stop_ap(wifi_radio_obj_t *self); +extern void common_hal_wifi_radio_start_dhcp_client(wifi_radio_obj_t *self); +extern void common_hal_wifi_radio_stop_dhcp_client(wifi_radio_obj_t *self); + extern wifi_radio_error_t common_hal_wifi_radio_connect(wifi_radio_obj_t *self, uint8_t *ssid, size_t ssid_len, uint8_t *password, size_t password_len, uint8_t channel, mp_float_t timeout, uint8_t *bssid, size_t bssid_len); extern mp_obj_t common_hal_wifi_radio_get_ap_info(wifi_radio_obj_t *self); extern mp_obj_t common_hal_wifi_radio_get_ipv4_dns(wifi_radio_obj_t *self); +extern void common_hal_wifi_radio_set_ipv4_dns(wifi_radio_obj_t *self, mp_obj_t ipv4_dns_addr); extern mp_obj_t common_hal_wifi_radio_get_ipv4_gateway(wifi_radio_obj_t *self); extern mp_obj_t common_hal_wifi_radio_get_ipv4_gateway_ap(wifi_radio_obj_t *self); extern mp_obj_t common_hal_wifi_radio_get_ipv4_subnet(wifi_radio_obj_t *self); extern mp_obj_t common_hal_wifi_radio_get_ipv4_subnet_ap(wifi_radio_obj_t *self); +uint32_t wifi_radio_get_ipv4_address(wifi_radio_obj_t *self); extern mp_obj_t common_hal_wifi_radio_get_ipv4_address(wifi_radio_obj_t *self); extern mp_obj_t common_hal_wifi_radio_get_ipv4_address_ap(wifi_radio_obj_t *self); +extern void common_hal_wifi_radio_set_ipv4_address(wifi_radio_obj_t *self, mp_obj_t ipv4, mp_obj_t netmask, mp_obj_t gateway, mp_obj_t ipv4_dns_addr); + extern mp_int_t common_hal_wifi_radio_ping(wifi_radio_obj_t *self, mp_obj_t ip_address, mp_float_t timeout); #endif // MICROPY_INCLUDED_SHARED_BINDINGS_WIFI_RADIO_H diff --git a/shared-bindings/wifi/ScannedNetworks.c b/shared-bindings/wifi/ScannedNetworks.c index 0706d8f396..a893213719 100644 --- a/shared-bindings/wifi/ScannedNetworks.c +++ b/shared-bindings/wifi/ScannedNetworks.c @@ -50,14 +50,12 @@ STATIC mp_obj_t scannednetworks_iternext(mp_obj_t self_in) { //| def __init__(self) -> None: //| """Cannot be instantiated directly. Use `wifi.Radio.start_scanning_networks`.""" //| ... -//| //| def __iter__(self) -> Iterator[Network]: //| """Returns itself since it is the iterator.""" //| ... -//| //| def __next__(self) -> Network: //| """Returns the next `wifi.Network`. -//| Raises `StopIteration` if scanning is finished and no other results are available.""" +//| Raises `StopIteration` if scanning is finished and no other results are available.""" //| ... //| diff --git a/shared-bindings/wifi/__init__.c b/shared-bindings/wifi/__init__.c index 0f9dee8462..f7b66c68ca 100644 --- a/shared-bindings/wifi/__init__.c +++ b/shared-bindings/wifi/__init__.c @@ -38,11 +38,10 @@ //| radio: Radio //| """Wifi radio used to manage both station and AP modes. //| This object is the sole instance of `wifi.Radio`.""" -//| // Called when wifi is imported. STATIC mp_obj_t wifi___init__(void) { - common_hal_wifi_init(); + common_hal_wifi_init(true); return mp_const_none; } STATIC MP_DEFINE_CONST_FUN_OBJ_0(wifi___init___obj, wifi___init__); diff --git a/shared-bindings/wifi/__init__.h b/shared-bindings/wifi/__init__.h index e626727e77..9553e92ce1 100644 --- a/shared-bindings/wifi/__init__.h +++ b/shared-bindings/wifi/__init__.h @@ -31,7 +31,9 @@ extern wifi_radio_obj_t common_hal_wifi_radio_obj; -void common_hal_wifi_init(void); +void common_hal_wifi_init(bool user_initiated); void common_hal_wifi_gc_collect(void); +void wifi_user_reset(void); + #endif // MICROPY_INCLUDED_SHARED_BINDINGS_WIFI___INIT___H diff --git a/shared-bindings/zlib/__init__.c b/shared-bindings/zlib/__init__.c index 65bec244e3..d9c2a01810 100644 --- a/shared-bindings/zlib/__init__.c +++ b/shared-bindings/zlib/__init__.c @@ -39,16 +39,17 @@ #include "shared-bindings/zlib/__init__.h" -#include "supervisor/shared/translate.h" +#include "supervisor/shared/translate/translate.h" //| """zlib decompression functionality //| //| The `zlib` module allows limited functionality similar to the CPython zlib library. //| This module allows to decompress binary data compressed with DEFLATE algorithm //| (commonly used in zlib library and gzip archiver). Compression is not yet implemented.""" -//| -//| def zlib_decompress(data: bytes, wbits: Optional[int] = 0, bufsize: Optional[int] = 0) -> bytes: +//| def zlib_decompress( +//| data: bytes, wbits: Optional[int] = 0, bufsize: Optional[int] = 0 +//| ) -> bytes: //| """Return decompressed *data* as bytes. *wbits* is DEFLATE dictionary window //| size used during compression (8-15, the dictionary size is power of 2 of //| that value). Additionally, if value is positive, *data* is assumed to be diff --git a/shared-module/_bleio/Attribute.c b/shared-module/_bleio/Attribute.c index 3acfcf1f53..9c75a69fd1 100644 --- a/shared-module/_bleio/Attribute.c +++ b/shared-module/_bleio/Attribute.c @@ -40,7 +40,7 @@ void common_hal_bleio_attribute_security_mode_check_valid(bleio_attribute_securi case SECURITY_MODE_SIGNED_WITH_MITM: break; default: - mp_raise_ValueError(translate("Invalid security_mode")); + mp_arg_error_invalid(MP_QSTR_security_mode); break; } } diff --git a/shared-module/adafruit_pixelbuf/PixelBuf.c b/shared-module/adafruit_pixelbuf/PixelBuf.c index 99980c705e..cab97feace 100644 --- a/shared-module/adafruit_pixelbuf/PixelBuf.c +++ b/shared-module/adafruit_pixelbuf/PixelBuf.c @@ -171,9 +171,7 @@ STATIC void _pixelbuf_parse_color(pixelbuf_pixelbuf_obj_t *self, mp_obj_t color, mp_obj_t *items; size_t len; mp_obj_get_array(color, &len, &items); - if (len < 3 || len > 4) { - mp_raise_ValueError_varg(translate("Expected tuple of length %d, got %d"), byteorder->bpp, len); - } + mp_arg_validate_length_range(len, 3, 4, MP_QSTR_color); *r = _pixelbuf_get_as_uint8(items[PIXEL_R]); *g = _pixelbuf_get_as_uint8(items[PIXEL_G]); diff --git a/shared-module/audiocore/WaveFile.c b/shared-module/audiocore/WaveFile.c index 0cceb979a6..1b87532551 100644 --- a/shared-module/audiocore/WaveFile.c +++ b/shared-module/audiocore/WaveFile.c @@ -33,7 +33,7 @@ #include "py/runtime.h" #include "shared-module/audiocore/WaveFile.h" -#include "supervisor/shared/translate.h" +#include "supervisor/shared/translate/translate.h" struct wave_format_chunk { uint16_t audio_format; @@ -60,7 +60,7 @@ void common_hal_audioio_wavefile_construct(audioio_wavefile_obj_t *self, if (bytes_read != 16 || memcmp(chunk_header, "RIFF", 4) != 0 || memcmp(chunk_header + 8, "WAVEfmt ", 8) != 0) { - mp_raise_ValueError(translate("Invalid wave file")); + mp_arg_error_invalid(MP_QSTR_file); } uint32_t format_size; if (f_read(&self->file->fp, &format_size, 4, &bytes_read) != FR_OK) { @@ -105,7 +105,7 @@ void common_hal_audioio_wavefile_construct(audioio_wavefile_obj_t *self, mp_raise_OSError(MP_EIO); } if (bytes_read != 4) { - mp_raise_ValueError(translate("Invalid file")); + mp_arg_error_invalid(MP_QSTR_file); } self->file_length = data_length; self->data_start = self->file->fp.fptr; @@ -121,15 +121,13 @@ void common_hal_audioio_wavefile_construct(audioio_wavefile_obj_t *self, self->buffer = m_malloc(self->len, false); if (self->buffer == NULL) { common_hal_audioio_wavefile_deinit(self); - mp_raise_msg(&mp_type_MemoryError, - translate("Couldn't allocate first buffer")); + m_malloc_fail(self->len); } self->second_buffer = m_malloc(self->len, false); if (self->second_buffer == NULL) { common_hal_audioio_wavefile_deinit(self); - mp_raise_msg(&mp_type_MemoryError, - translate("Couldn't allocate second buffer")); + m_malloc_fail(self->len); } } } diff --git a/shared-module/audiomixer/Mixer.c b/shared-module/audiomixer/Mixer.c index d6569c66f0..1c5de4d934 100644 --- a/shared-module/audiomixer/Mixer.c +++ b/shared-module/audiomixer/Mixer.c @@ -47,13 +47,13 @@ void common_hal_audiomixer_mixer_construct(audiomixer_mixer_obj_t *self, self->first_buffer = m_malloc(self->len, false); if (self->first_buffer == NULL) { common_hal_audiomixer_mixer_deinit(self); - mp_raise_msg(&mp_type_MemoryError, translate("Couldn't allocate first buffer")); + m_malloc_fail(self->len); } self->second_buffer = m_malloc(self->len, false); if (self->second_buffer == NULL) { common_hal_audiomixer_mixer_deinit(self); - mp_raise_msg(&mp_type_MemoryError, translate("Couldn't allocate second buffer")); + m_malloc_fail(self->len); } self->bits_per_sample = bits_per_sample; diff --git a/shared-module/audiomp3/MP3Decoder.c b/shared-module/audiomp3/MP3Decoder.c index bbc7e1c79e..506ed5eff2 100644 --- a/shared-module/audiomp3/MP3Decoder.c +++ b/shared-module/audiomp3/MP3Decoder.c @@ -35,7 +35,7 @@ #include "py/runtime.h" #include "shared-module/audiomp3/MP3Decoder.h" -#include "supervisor/shared/translate.h" +#include "supervisor/shared/translate/translate.h" #include "supervisor/background_callback.h" #include "lib/mp3/src/mp3common.h" @@ -193,8 +193,7 @@ void common_hal_audiomp3_mp3file_construct(audiomp3_mp3file_obj_t *self, self->inbuf = m_malloc(self->inbuf_length, false); if (self->inbuf == NULL) { common_hal_audiomp3_mp3file_deinit(self); - mp_raise_msg(&mp_type_MemoryError, - translate("Couldn't allocate input buffer")); + m_malloc_fail(self->inbuf_length); } self->decoder = MP3InitDecoder(); if (self->decoder == NULL) { @@ -214,15 +213,13 @@ void common_hal_audiomp3_mp3file_construct(audiomp3_mp3file_obj_t *self, self->buffers[0] = m_malloc(MAX_BUFFER_LEN, false); if (self->buffers[0] == NULL) { common_hal_audiomp3_mp3file_deinit(self); - mp_raise_msg(&mp_type_MemoryError, - translate("Couldn't allocate first buffer")); + m_malloc_fail(MAX_BUFFER_LEN); } self->buffers[1] = m_malloc(MAX_BUFFER_LEN, false); if (self->buffers[1] == NULL) { common_hal_audiomp3_mp3file_deinit(self); - mp_raise_msg(&mp_type_MemoryError, - translate("Couldn't allocate second buffer")); + m_malloc_fail(MAX_BUFFER_LEN); } } diff --git a/shared-module/bitbangio/I2C.c b/shared-module/bitbangio/I2C.c index eb897e122f..65926b8c07 100644 --- a/shared-module/bitbangio/I2C.c +++ b/shared-module/bitbangio/I2C.c @@ -32,7 +32,7 @@ #include "common-hal/microcontroller/Pin.h" #include "shared-bindings/microcontroller/__init__.h" #include "shared-bindings/digitalio/DigitalInOut.h" -#include "supervisor/shared/translate.h" +#include "supervisor/shared/translate/translate.h" STATIC void delay(bitbangio_i2c_obj_t *self) { // We need to use an accurate delay to get acceptable I2C diff --git a/shared-module/bitbangio/SPI.c b/shared-module/bitbangio/SPI.c index 65511964a6..d740a214e7 100644 --- a/shared-module/bitbangio/SPI.c +++ b/shared-module/bitbangio/SPI.c @@ -32,7 +32,7 @@ #include "shared-bindings/bitbangio/SPI.h" #include "shared-bindings/digitalio/DigitalInOut.h" #include "shared-bindings/microcontroller/__init__.h" -#include "supervisor/shared/translate.h" +#include "supervisor/shared/translate/translate.h" #define MAX_BAUDRATE (common_hal_mcu_get_clock_frequency() / 48) @@ -41,7 +41,7 @@ void shared_module_bitbangio_spi_construct(bitbangio_spi_obj_t *self, const mcu_pin_obj_t *miso) { digitalinout_result_t result = common_hal_digitalio_digitalinout_construct(&self->clock, clock); if (result != DIGITALINOUT_OK) { - mp_raise_ValueError(translate("Clock pin init failed.")); + mp_raise_ValueError_varg(translate("%q init failed"), MP_QSTR_clock); } common_hal_digitalio_digitalinout_switch_to_output(&self->clock, self->polarity == 1, DRIVE_MODE_PUSH_PULL); @@ -49,7 +49,7 @@ void shared_module_bitbangio_spi_construct(bitbangio_spi_obj_t *self, result = common_hal_digitalio_digitalinout_construct(&self->mosi, mosi); if (result != DIGITALINOUT_OK) { common_hal_digitalio_digitalinout_deinit(&self->clock); - mp_raise_ValueError(translate("MOSI pin init failed.")); + mp_raise_ValueError_varg(translate("%q init failed"), MP_QSTR_mosi); } self->has_mosi = true; common_hal_digitalio_digitalinout_switch_to_output(&self->mosi, false, DRIVE_MODE_PUSH_PULL); @@ -63,7 +63,7 @@ void shared_module_bitbangio_spi_construct(bitbangio_spi_obj_t *self, if (mosi != NULL) { common_hal_digitalio_digitalinout_deinit(&self->mosi); } - mp_raise_ValueError(translate("MISO pin init failed.")); + mp_raise_ValueError_varg(translate("%q init failed"), MP_QSTR_miso); } self->has_miso = true; } @@ -123,7 +123,7 @@ void shared_module_bitbangio_spi_unlock(bitbangio_spi_obj_t *self) { // Writes out the given data. bool shared_module_bitbangio_spi_write(bitbangio_spi_obj_t *self, const uint8_t *data, size_t len) { if (len > 0 && !self->has_mosi) { - mp_raise_ValueError(translate("Cannot write without MOSI pin.")); + mp_raise_ValueError(translate("No MOSI pin")); } uint32_t delay_half = self->delay_half; @@ -178,7 +178,7 @@ bool shared_module_bitbangio_spi_write(bitbangio_spi_obj_t *self, const uint8_t // Reads in len bytes while outputting zeroes. bool shared_module_bitbangio_spi_read(bitbangio_spi_obj_t *self, uint8_t *data, size_t len, uint8_t write_data) { if (len > 0 && !self->has_miso) { - mp_raise_ValueError(translate("Cannot read without MISO pin.")); + mp_raise_ValueError(translate("No MISO pin")); } uint32_t delay_half = self->delay_half; @@ -246,7 +246,7 @@ bool shared_module_bitbangio_spi_read(bitbangio_spi_obj_t *self, uint8_t *data, // transfer bool shared_module_bitbangio_spi_transfer(bitbangio_spi_obj_t *self, const uint8_t *dout, uint8_t *din, size_t len) { if (len > 0 && (!self->has_mosi || !self->has_miso)) { - mp_raise_ValueError(translate("Cannot transfer without MOSI and MISO pins.")); + mp_raise_ValueError(translate("Cannot transfer without MOSI and MISO pins")); } uint32_t delay_half = self->delay_half; diff --git a/shared-module/board/__init__.c b/shared-module/board/__init__.c index 7bd0d42339..5d08c368b5 100644 --- a/shared-module/board/__init__.c +++ b/shared-module/board/__init__.c @@ -27,7 +27,7 @@ #include "shared-bindings/board/__init__.h" #include "shared-bindings/microcontroller/Pin.h" #include "shared-module/board/__init__.h" -#include "supervisor/shared/translate.h" +#include "supervisor/shared/translate/translate.h" #include "mpconfigboard.h" #include "py/runtime.h" diff --git a/shared-module/displayio/Bitmap.c b/shared-module/displayio/Bitmap.c index 933d3a8227..676aec2186 100644 --- a/shared-module/displayio/Bitmap.c +++ b/shared-module/displayio/Bitmap.c @@ -30,20 +30,29 @@ #include "py/runtime.h" -void common_hal_displayio_bitmap_construct(displayio_bitmap_t *self, uint32_t width, - uint32_t height, uint32_t bits_per_value) { +enum { align_bits = 8 * sizeof(uint32_t) }; + +static int stride(uint32_t width, uint32_t bits_per_value) { uint32_t row_width = width * bits_per_value; // align to uint32_t - uint8_t align_bits = 8 * sizeof(uint32_t); - if (row_width % align_bits != 0) { - self->stride = (row_width / align_bits + 1); - } else { - self->stride = row_width / align_bits; - } + return (row_width + align_bits - 1) / align_bits; +} + +void common_hal_displayio_bitmap_construct(displayio_bitmap_t *self, uint32_t width, + uint32_t height, uint32_t bits_per_value) { + common_hal_displayio_bitmap_construct_from_buffer(self, width, height, bits_per_value, NULL, false); +} + +void common_hal_displayio_bitmap_construct_from_buffer(displayio_bitmap_t *self, uint32_t width, + uint32_t height, uint32_t bits_per_value, uint32_t *data, bool read_only) { self->width = width; self->height = height; - self->data = m_malloc(self->stride * height * sizeof(uint32_t), false); - self->read_only = false; + self->stride = stride(width, bits_per_value); + if (!data) { + data = m_malloc(self->stride * height * sizeof(uint32_t), false); + } + self->data = data; + self->read_only = read_only; self->bits_per_value = bits_per_value; if (bits_per_value > 8 && bits_per_value != 16 && bits_per_value != 32) { @@ -70,6 +79,7 @@ void common_hal_displayio_bitmap_construct(displayio_bitmap_t *self, uint32_t wi self->dirty_area.y2 = height; } + uint16_t common_hal_displayio_bitmap_get_height(displayio_bitmap_t *self) { return self->height; } diff --git a/shared-module/displayio/Display.c b/shared-module/displayio/Display.c index 255cd49e06..9fd55fe19d 100644 --- a/shared-module/displayio/Display.c +++ b/shared-module/displayio/Display.c @@ -51,9 +51,9 @@ void common_hal_displayio_display_construct(displayio_display_obj_t *self, uint8_t bytes_per_cell, bool reverse_pixels_in_byte, bool reverse_bytes_in_word, uint8_t set_column_command, uint8_t set_row_command, uint8_t write_ram_command, uint8_t *init_sequence, uint16_t init_sequence_len, const mcu_pin_obj_t *backlight_pin, - uint16_t brightness_command, mp_float_t brightness, bool auto_brightness, + uint16_t brightness_command, mp_float_t brightness, bool single_byte_bounds, bool data_as_commands, bool auto_refresh, uint16_t native_frames_per_second, - bool backlight_on_high, bool SH1107_addressing) { + bool backlight_on_high, bool SH1107_addressing, uint16_t backlight_pwm_frequency) { // Turn off auto-refresh as we init. self->auto_refresh = false; @@ -70,7 +70,6 @@ void common_hal_displayio_display_construct(displayio_display_obj_t *self, self->set_row_command = set_row_command; self->write_ram_command = write_ram_command; self->brightness_command = brightness_command; - self->auto_brightness = auto_brightness; self->first_manual_refresh = !auto_refresh; self->data_as_commands = data_as_commands; self->backlight_on_high = backlight_on_high; @@ -116,7 +115,7 @@ void common_hal_displayio_display_construct(displayio_display_obj_t *self, if (backlight_pin != NULL && common_hal_mcu_pin_is_free(backlight_pin)) { // Avoid PWM types and functions when the module isn't enabled #if (CIRCUITPY_PWMIO) - pwmout_result_t result = common_hal_pwmio_pwmout_construct(&self->backlight_pwm, backlight_pin, 0, 50000, false); + pwmout_result_t result = common_hal_pwmio_pwmout_construct(&self->backlight_pwm, backlight_pin, 0, backlight_pwm_frequency, false); if (result != PWMOUT_OK) { self->backlight_inout.base.type = &digitalio_digitalinout_type; common_hal_digitalio_digitalinout_construct(&self->backlight_inout, backlight_pin); @@ -132,12 +131,8 @@ void common_hal_displayio_display_construct(displayio_display_obj_t *self, common_hal_never_reset_pin(backlight_pin); #endif } - if (!self->auto_brightness && (self->backlight_inout.base.type != &mp_type_NoneType || - brightness_command != NO_BRIGHTNESS_COMMAND)) { - common_hal_displayio_display_set_brightness(self, brightness); - } else { - self->current_brightness = -1.0; - } + + common_hal_displayio_display_set_brightness(self, brightness); // Set the group after initialization otherwise we may send pixels while we delay in // initialization. @@ -157,20 +152,11 @@ uint16_t common_hal_displayio_display_get_height(displayio_display_obj_t *self) return displayio_display_core_get_height(&self->core); } -bool common_hal_displayio_display_get_auto_brightness(displayio_display_obj_t *self) { - return self->auto_brightness; -} - -void common_hal_displayio_display_set_auto_brightness(displayio_display_obj_t *self, bool auto_brightness) { - self->auto_brightness = auto_brightness; -} - mp_float_t common_hal_displayio_display_get_brightness(displayio_display_obj_t *self) { return self->current_brightness; } bool common_hal_displayio_display_set_brightness(displayio_display_obj_t *self, mp_float_t brightness) { - self->updating_backlight = true; if (!self->backlight_on_high) { brightness = 1.0 - brightness; } @@ -209,7 +195,6 @@ bool common_hal_displayio_display_set_brightness(displayio_display_obj_t *self, } } - self->updating_backlight = false; if (ok) { self->current_brightness = brightness; } @@ -413,23 +398,7 @@ void common_hal_displayio_display_set_auto_refresh(displayio_display_obj_t *self self->auto_refresh = auto_refresh; } -STATIC void _update_backlight(displayio_display_obj_t *self) { - if (!self->auto_brightness || self->updating_backlight) { - return; - } - if (supervisor_ticks_ms64() - self->last_backlight_refresh < 100) { - return; - } - // TODO(tannewt): Fade the backlight based on its existing value and a target value. The target - // should account for ambient light when possible. - common_hal_displayio_display_set_brightness(self, 1.0); - - self->last_backlight_refresh = supervisor_ticks_ms64(); -} - void displayio_display_background(displayio_display_obj_t *self) { - _update_backlight(self); - if (self->auto_refresh && (supervisor_ticks_ms64() - self->core.last_refresh) > self->native_ms_per_frame) { _refresh_display(self); } @@ -452,7 +421,6 @@ void release_display(displayio_display_obj_t *self) { void reset_display(displayio_display_obj_t *self) { common_hal_displayio_display_set_auto_refresh(self, true); - self->auto_brightness = true; common_hal_displayio_display_show(self, NULL); } diff --git a/shared-module/displayio/Display.h b/shared-module/displayio/Display.h index a0049f00c0..f513a9d462 100644 --- a/shared-module/displayio/Display.h +++ b/shared-module/displayio/Display.h @@ -45,7 +45,6 @@ typedef struct { pwmio_pwmout_obj_t backlight_pwm; #endif }; - uint64_t last_backlight_refresh; uint64_t last_refresh_call; mp_float_t current_brightness; uint16_t brightness_command; @@ -57,8 +56,6 @@ typedef struct { bool auto_refresh; bool first_manual_refresh; bool data_as_commands; - bool auto_brightness; - bool updating_backlight; bool backlight_on_high; // new quirk for sh1107 bool SH1107_addressing; diff --git a/shared-module/displayio/EPaperDisplay.c b/shared-module/displayio/EPaperDisplay.c index b1e998048e..0010d88d12 100644 --- a/shared-module/displayio/EPaperDisplay.c +++ b/shared-module/displayio/EPaperDisplay.c @@ -275,7 +275,7 @@ STATIC bool displayio_epaperdisplay_refresh_area(displayio_epaperdisplay_obj_t * uint32_t mask[mask_length]; uint8_t passes = 1; - if (self->core.colorspace.tricolor || self->grayscale) { + if (self->write_color_ram_command != NO_COMMAND) { passes = 2; } for (uint8_t pass = 0; pass < passes; pass++) { @@ -318,11 +318,14 @@ STATIC bool displayio_epaperdisplay_refresh_area(displayio_epaperdisplay_obj_t * if (pass == 1) { if (self->grayscale) { // 4-color grayscale self->core.colorspace.grayscale_bit = 6; - } else { // Tri-color + displayio_display_core_fill_area(&self->core, &subrectangle, mask, buffer); + } else if (self->core.colorspace.tricolor) { self->core.colorspace.grayscale = false; + displayio_display_core_fill_area(&self->core, &subrectangle, mask, buffer); } + } else { + displayio_display_core_fill_area(&self->core, &subrectangle, mask, buffer); } - displayio_display_core_fill_area(&self->core, &subrectangle, mask, buffer); // Invert it all. if ((pass == 1 && self->color_bits_inverted) || diff --git a/shared-module/displayio/Group.c b/shared-module/displayio/Group.c index 1a4e4eafb5..ad45852379 100644 --- a/shared-module/displayio/Group.c +++ b/shared-module/displayio/Group.c @@ -268,7 +268,7 @@ static void _add_layer(displayio_group_t *self, mp_obj_t layer) { if (native_layer != MP_OBJ_NULL) { displayio_tilegrid_t *tilegrid = native_layer; if (tilegrid->in_group) { - mp_raise_ValueError(translate("Layer already in a group.")); + mp_raise_ValueError(translate("Layer already in a group")); } else { tilegrid->in_group = true; } @@ -281,7 +281,7 @@ static void _add_layer(displayio_group_t *self, mp_obj_t layer) { if (native_layer != MP_OBJ_NULL) { displayio_group_t *group = native_layer; if (group->in_group) { - mp_raise_ValueError(translate("Layer already in a group.")); + mp_raise_ValueError(translate("Layer already in a group")); } else { group->in_group = true; } @@ -290,7 +290,7 @@ static void _add_layer(displayio_group_t *self, mp_obj_t layer) { group, self->hidden || self->hidden_by_parent); return; } - mp_raise_ValueError(translate("Layer must be a Group or TileGrid subclass.")); + mp_raise_ValueError(translate("Layer must be a Group or TileGrid subclass")); } static void _remove_layer(displayio_group_t *self, size_t index) { diff --git a/shared-module/displayio/OnDiskBitmap.c b/shared-module/displayio/OnDiskBitmap.c index dd2731a814..2863dffb19 100644 --- a/shared-module/displayio/OnDiskBitmap.c +++ b/shared-module/displayio/OnDiskBitmap.c @@ -50,7 +50,7 @@ void common_hal_displayio_ondiskbitmap_construct(displayio_ondiskbitmap_t *self, } if (bytes_read != 138 || memcmp(bmp_header, "BM", 2) != 0) { - mp_raise_ValueError(translate("Invalid BMP file")); + mp_arg_error_invalid(MP_QSTR_file); } // We can't cast because we're not aligned. diff --git a/shared-module/displayio/TileGrid.c b/shared-module/displayio/TileGrid.c index 5c968c30e1..769c334ac6 100644 --- a/shared-module/displayio/TileGrid.c +++ b/shared-module/displayio/TileGrid.c @@ -296,6 +296,27 @@ void common_hal_displayio_tilegrid_set_tile(displayio_tilegrid_t *self, uint16_t self->partial_change = true; } +void common_hal_displayio_tilegrid_set_all_tiles(displayio_tilegrid_t *self, uint8_t tile_index) { + if (tile_index >= self->tiles_in_bitmap) { + mp_raise_ValueError(translate("Tile index out of bounds")); + } + uint8_t *tiles = self->tiles; + if (self->inline_tiles) { + tiles = (uint8_t *)&self->tiles; + } + if (tiles == NULL) { + return; + } + + for (uint16_t x = 0; x < self->width_in_tiles; x++) { + for (uint16_t y = 0; y < self->height_in_tiles; y++) { + tiles[y * self->width_in_tiles + x] = tile_index; + } + } + + self->full_change = true; +} + bool common_hal_displayio_tilegrid_get_flip_x(displayio_tilegrid_t *self) { return self->flip_x; } @@ -342,6 +363,13 @@ void common_hal_displayio_tilegrid_set_transpose_xy(displayio_tilegrid_t *self, self->moved = true; } +bool common_hal_displayio_tilegrid_contains(displayio_tilegrid_t *self, uint16_t x, uint16_t y) { + uint16_t right_edge = self->x + (self->width_in_tiles * self->tile_width); + uint16_t bottom_edge = self->y + (self->height_in_tiles * self->tile_height); + return x >= self->x && x < right_edge && + y >= self->y && y < bottom_edge; +} + void common_hal_displayio_tilegrid_set_top_left(displayio_tilegrid_t *self, uint16_t x, uint16_t y) { self->top_left_x = x; self->top_left_y = y; diff --git a/shared-module/dotenv/__init__.c b/shared-module/dotenv/__init__.c new file mode 100644 index 0000000000..be8f2353de --- /dev/null +++ b/shared-module/dotenv/__init__.c @@ -0,0 +1,304 @@ +/* + * This file is part of the Micro Python project, http://micropython.org/ + * + * The MIT License (MIT) + * + * SPDX-FileCopyrightText: Copyright (c) 2022 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 +#include + +#include "shared-bindings/dotenv/__init__.h" + +#include "py/mpstate.h" +#include "py/objstr.h" +#include "supervisor/filesystem.h" + +#if defined(UNIX) +typedef FILE *file_arg; +STATIC bool open_file(const char *name, file_arg *active_file) { + FILE *result = fopen(name, "r"); + if (result) { + *active_file = result; + } + return result != NULL; +} +STATIC void close_file(file_arg *active_file) { + fclose(*active_file); +} +STATIC uint8_t get_next_character(file_arg *active_file) { + int value = fgetc(*active_file); + if (value == EOF) { + return 0; + } + return value; +} +STATIC void seek_minus_one(file_arg *active_file) { + fseek(*active_file, -1, SEEK_CUR); +} +#else +#include "extmod/vfs.h" +#include "extmod/vfs_fat.h" +typedef FIL file_arg; +STATIC bool open_file(const char *name, file_arg *active_file) { + FATFS *fs = filesystem_circuitpy(); + FRESULT result = f_open(fs, active_file, name, FA_READ); + return result == FR_OK; +} +STATIC void close_file(file_arg *active_file) { + // nothing +} + +// Return 0 if there is no next character (EOF). +STATIC uint8_t get_next_character(FIL *active_file) { + uint8_t character = 0; + UINT quantity_read; + // If there's an error or quantity_read is 0, character will remain 0. + f_read(active_file, &character, 1, &quantity_read); + return character; +} +STATIC void seek_minus_one(file_arg *active_file) { + f_lseek(active_file, f_tell(active_file) - 1); +} +#endif + +// Discard whitespace, except for newlines, returning the next character after the whitespace. +// Return 0 if there is no next character (EOF). +STATIC uint8_t consume_whitespace(file_arg *active_file) { + uint8_t character; + do { + character = get_next_character(active_file); + } while (character != '\n' && character != 0 && unichar_isspace(character)); + return character; +} + +// Starting at the start of a new line, determines if the key matches the given +// key. File pointer is set to be just before the = after the key. +STATIC bool key_matches(file_arg *active_file, const char *key) { + uint8_t character; + character = consume_whitespace(active_file); + if (character == 0) { + return false; + } + bool quoted = false; + if (character == '\'') { + // Beginning of single-quoted string. + quoted = true; + character = get_next_character(active_file); + } + size_t key_pos = 0; + bool escaped = false; + bool matches = true; + size_t key_len = strlen(key); + while (character != 0) { + if (character == '\\' && !escaped && quoted) { + escaped = true; + } else if (!escaped && quoted && character == '\'') { + quoted = false; + // End of quoted key. Skip over the ending quote. + character = get_next_character(active_file); + break; + } else if (!quoted && (unichar_isspace(character) || character == '=' || character == '\n' || character == '#' || character == 0)) { + // End of unquoted key. + break; + } else { + // Still on tentative key; see if it matches the next supplied key character, + // but don't run off the end of the supplied key. + if (key_pos < key_len) { + matches = matches && (unsigned char)key[key_pos] == character; + escaped = false; + key_pos++; + } else { + // Key on line is too long. + matches = false; + } + } + character = get_next_character(active_file); + } + if (character == '=' || character == '\n' || character == '#' || character == 0) { + // Rewind one so the value, if any, can be found. + seek_minus_one(active_file); + } else if (!unichar_isspace(character)) { + // We're followed by something else that is invalid syntax. + matches = false; + } + + return matches && key_pos == key_len; +} + +STATIC bool next_line(file_arg *active_file) { + uint8_t character; + bool quoted = false; + bool escaped = false; + // Track comments because they last until the end of the line. + bool comment = false; + // Consume all characters while quoted or others up to \n. + do { + character = get_next_character(active_file); + + if ((!quoted || character == '#') || comment) { + // Comments consume any escaping. + comment = true; + } else if (!escaped) { + if (character == '\'') { + quoted = !quoted; + } else if (character == '\\') { + escaped = true; + } + } else { + escaped = false; + } + } while (character != 0 && (quoted || character != '\n')); + + return character != 0; +} + +STATIC mp_int_t read_value(file_arg *active_file, char *value, size_t value_len) { + uint8_t character; + // Consume spaces before "=", and get first character of interest. + character = consume_whitespace(active_file); + if (character != '=') { + if (character == '#' || character == '\n') { + // Keys without an = after them are valid with the value None. + return -1; + } + // All other characters are invalid. + return -1; + } + // Consume space after = + if (character != '#') { + // a # immediately after = is part of the value! + character = consume_whitespace(active_file); + } + bool quoted = false; + if (character == '\'') { + quoted = true; + character = get_next_character(active_file); + } + if (character == '"') { + // We don't support double quoted values. + return -1; + } + // Copy the value over. + size_t value_pos = 0; + bool escaped = false; + // Count trailing spaces so we can ignore them at the end of unquoted + // values. + size_t trailing_spaces = 0; + bool first_char = true; + while (character != 0) { + // Consume the first \ if the value is quoted. + if (quoted && character == '\\' && !escaped) { + escaped = true; + // Drop this backslash by short circuiting the rest of the loop. + character = get_next_character(active_file); + continue; + } + if (quoted && !escaped && character == '\'') { + // trailing ' means the value is done. + break; + } + // Unquoted values are ended by a newline or comment. + if (!quoted && (character == '\n' || (character == '#' && !first_char))) { + if (character == '\n') { + // Rewind one so the next_line can find the \n. + seek_minus_one(active_file); + } + break; + } + if (!quoted && unichar_isspace(character)) { + trailing_spaces += 1; + } else { + trailing_spaces = 0; + } + escaped = false; + // Only copy the value over if we have space. Otherwise, we'll just + // count the overall length. + if (value_pos < value_len) { + value[value_pos] = character; + } + value_pos++; + character = get_next_character(active_file); + first_char = false; + } + + return value_pos - trailing_spaces; +} + +mp_int_t dotenv_get_key(const char *path, const char *key, char *value, mp_int_t value_len) { + file_arg active_file; + if (!open_file(path, &active_file)) { + return -1; + } + + mp_int_t actual_value_len = -1; + bool read_ok = true; + while (read_ok) { + if (key_matches(&active_file, key)) { + actual_value_len = read_value(&active_file, value, value_len); + } + + read_ok = next_line(&active_file); + } + close_file(&active_file); + return actual_value_len; +} + +mp_obj_t common_hal_dotenv_get_key(const char *path, const char *key) { + // Use the stack for short values. Longer values will require a heap allocation after we know + // the length. + char value[64]; + mp_int_t actual_len = dotenv_get_key(path, key, value, sizeof(value)); + if (actual_len < 0) { + return mp_const_none; + } + if ((size_t)actual_len >= sizeof(value)) { + mp_obj_str_t *str = MP_OBJ_TO_PTR(mp_obj_new_str_copy(&mp_type_str, NULL, actual_len + 1)); + dotenv_get_key(path, key, (char *)str->data, actual_len + 1); + str->hash = qstr_compute_hash(str->data, actual_len); + return MP_OBJ_FROM_PTR(str); + } + return mp_obj_new_str(value, actual_len); +} + +bool dotenv_get_key_terminated(const char *path, const char *key, char *value, mp_int_t value_len) { + mp_int_t actual_len = dotenv_get_key(path, key, value, value_len - 1); + if (actual_len >= value_len) { + return false; + } + value[actual_len] = '\0'; // terminate string + return true; +} + +bool dotenv_get_key_int(const char *path, const char *key, mp_int_t *value) { + char buf[16]; + if (!dotenv_get_key_terminated(path, key, buf, (mp_int_t)sizeof(buf))) { + return false; + } + char *end; + long result = strtol(buf, &end, 0); + if (end == buf || *end) { // If the whole buffer was not consumed it's an error + return false; + } + *value = (mp_int_t)result; + return true; +} diff --git a/shared-module/dotenv/__init__.h b/shared-module/dotenv/__init__.h new file mode 100644 index 0000000000..fb27233692 --- /dev/null +++ b/shared-module/dotenv/__init__.h @@ -0,0 +1,36 @@ +/* + * This file is part of the MicroPython project, http://micropython.org/ + * + * The MIT License (MIT) + * + * Copyright (c) 2022 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. + */ + +// Allocation free version that returns the full length of the value. +mp_int_t dotenv_get_key(const char *path, const char *key, char *value, mp_int_t value_len); + +// Returns true and sets value to a '\0'-terminated string if key is present +// and the value (including the terminating '\0') fits strictly within +// value_len bytes. +bool dotenv_get_key_terminated(const char *path, const char *key, char *value, mp_int_t value_len); + +// Returns true and sets value to the read value. Returns false if the value was not numeric. +bool dotenv_get_key_int(const char *path, const char *key, mp_int_t *value); diff --git a/shared-module/framebufferio/FramebufferDisplay.c b/shared-module/framebufferio/FramebufferDisplay.c index 48353b7dba..e2e7d11106 100644 --- a/shared-module/framebufferio/FramebufferDisplay.c +++ b/shared-module/framebufferio/FramebufferDisplay.c @@ -83,9 +83,8 @@ void common_hal_framebufferio_framebufferdisplay_construct(framebufferio_framebu self->framebuffer_protocol->get_bufinfo(self->framebuffer, &self->bufinfo); size_t framebuffer_size = self->first_pixel_offset + self->row_stride * self->core.height; - if (self->bufinfo.len < framebuffer_size) { - mp_raise_IndexError_varg(translate("Framebuffer requires %d bytes"), framebuffer_size); - } + + mp_arg_validate_length_min(self->bufinfo.len, framebuffer_size, MP_QSTR_framebuffer); self->first_manual_refresh = !auto_refresh; @@ -114,20 +113,6 @@ uint16_t common_hal_framebufferio_framebufferdisplay_get_height(framebufferio_fr return displayio_display_core_get_height(&self->core); } -bool common_hal_framebufferio_framebufferdisplay_get_auto_brightness(framebufferio_framebufferdisplay_obj_t *self) { - if (self->framebuffer_protocol->get_auto_brightness) { - return self->framebuffer_protocol->get_auto_brightness(self->framebuffer); - } - return true; -} - -bool common_hal_framebufferio_framebufferdisplay_set_auto_brightness(framebufferio_framebufferdisplay_obj_t *self, bool auto_brightness) { - if (self->framebuffer_protocol->set_auto_brightness) { - return self->framebuffer_protocol->set_auto_brightness(self->framebuffer, auto_brightness); - } - return false; -} - mp_float_t common_hal_framebufferio_framebufferdisplay_get_brightness(framebufferio_framebufferdisplay_obj_t *self) { if (self->framebuffer_protocol->get_brightness) { return self->framebuffer_protocol->get_brightness(self->framebuffer); @@ -373,3 +358,7 @@ void framebufferio_framebufferdisplay_reset(framebufferio_framebufferdisplay_obj release_framebufferdisplay(self); } } + +mp_obj_t common_hal_framebufferio_framebufferdisplay_get_root_group(framebufferio_framebufferdisplay_obj_t *self) { + return self->core.current_group; +} diff --git a/shared-module/framebufferio/FramebufferDisplay.h b/shared-module/framebufferio/FramebufferDisplay.h index b6138e2202..b53461aad5 100644 --- a/shared-module/framebufferio/FramebufferDisplay.h +++ b/shared-module/framebufferio/FramebufferDisplay.h @@ -43,7 +43,6 @@ typedef struct { mp_obj_t framebuffer; const struct _framebuffer_p_t *framebuffer_protocol; mp_buffer_info_t bufinfo; - uint64_t last_backlight_refresh; uint64_t last_refresh_call; uint16_t native_frames_per_second; uint16_t native_ms_per_frame; @@ -61,10 +60,8 @@ void framebufferio_framebufferdisplay_collect_ptrs(framebufferio_framebufferdisp mp_obj_t common_hal_framebufferio_framebufferdisplay_get_framebuffer(framebufferio_framebufferdisplay_obj_t *self); -typedef bool (*framebuffer_get_auto_brightness_fun)(mp_obj_t); typedef bool (*framebuffer_get_reverse_pixels_in_byte_fun)(mp_obj_t); typedef bool (*framebuffer_get_reverse_pixels_in_word_fun)(mp_obj_t); -typedef bool (*framebuffer_set_auto_brightness_fun)(mp_obj_t, bool); typedef bool (*framebuffer_set_brightness_fun)(mp_obj_t, mp_float_t); typedef int (*framebuffer_get_bytes_per_cell_fun)(mp_obj_t); typedef int (*framebuffer_get_color_depth_fun)(mp_obj_t); @@ -105,9 +102,6 @@ typedef struct _framebuffer_p_t { framebuffer_get_brightness_fun get_brightness; framebuffer_set_brightness_fun set_brightness; - // Optional -- default is no automatic brightness control - framebuffer_get_auto_brightness_fun get_auto_brightness; - framebuffer_set_auto_brightness_fun set_auto_brightness; } framebuffer_p_t; #endif // MICROPY_INCLUDED_SHARED_MODULE_DISPLAYIO_FRAMEBUFFERDISPLAY_H diff --git a/shared-module/is31fl3741/FrameBuffer.c b/shared-module/is31fl3741/FrameBuffer.c index 400f6f843d..d795c0d5e7 100644 --- a/shared-module/is31fl3741/FrameBuffer.c +++ b/shared-module/is31fl3741/FrameBuffer.c @@ -141,8 +141,7 @@ void common_hal_is31fl3741_FrameBuffer_refresh(is31fl3741_FrameBuffer_obj_t *sel if (!self->paused) { common_hal_is31fl3741_begin_transaction(self->is31fl3741); - uint8_t dirty_row_flags = 0xFF; // only supports 8 rows gotta fix - + uint8_t dirty_row_flags = 0xFF; if (self->scale) { // Based on the Arduino IS31FL3741 driver code // dirtyrows flag current not implemented for scaled displays @@ -173,7 +172,7 @@ void common_hal_is31fl3741_FrameBuffer_refresh(is31fl3741_FrameBuffer_obj_t *sel } else { color = (rsum << 16) + (gsum << 8) + bsum; } - common_hal_is31fl3741_draw_pixel(self->is31fl3741, x, y, color, self->mapping); + common_hal_is31fl3741_draw_pixel(self->is31fl3741, x, y, color, self->mapping, self->height); } } } else { @@ -194,9 +193,11 @@ void common_hal_is31fl3741_FrameBuffer_refresh(is31fl3741_FrameBuffer_obj_t *sel color = *buffer; } - common_hal_is31fl3741_draw_pixel(self->is31fl3741, x, y, color, self->mapping); + common_hal_is31fl3741_draw_pixel(self->is31fl3741, x, y, color, self->mapping, self->height); buffer++; } + } else { + buffer += self->width; // row did not have to be redrawn, skip it in the buffer } } } diff --git a/shared-module/is31fl3741/IS31FL3741.c b/shared-module/is31fl3741/IS31FL3741.c index bb92b5b32c..08598743b7 100644 --- a/shared-module/is31fl3741/IS31FL3741.c +++ b/shared-module/is31fl3741/IS31FL3741.c @@ -148,16 +148,17 @@ void common_hal_is31fl3741_set_led(is31fl3741_IS31FL3741_obj_t *self, uint16_t l common_hal_busio_i2c_write(self->i2c, self->device_address, cmd, 2); } -void common_hal_is31fl3741_draw_pixel(is31fl3741_IS31FL3741_obj_t *self, int16_t x, int16_t y, uint32_t color, uint16_t *mapping) { +void common_hal_is31fl3741_draw_pixel(is31fl3741_IS31FL3741_obj_t *self, int16_t x, int16_t y, uint32_t color, uint16_t *mapping, uint8_t display_height) { uint8_t r = color >> 16 & 0xFF; uint8_t g = color >> 8 & 0xFF; uint8_t b = color & 0xFF; - int16_t x1 = (x * 5 + y) * 3; + int16_t x1 = (x * display_height + y) * 3; uint16_t ridx = mapping[x1 + 2]; if (ridx != 65535) { uint16_t gidx = mapping[x1 + 1]; uint16_t bidx = mapping[x1 + 0]; + common_hal_is31fl3741_set_led(self, ridx, r, 0); common_hal_is31fl3741_set_led(self, gidx, g, 0); common_hal_is31fl3741_set_led(self, bidx, b, 0); diff --git a/shared-module/msgpack/__init__.c b/shared-module/msgpack/__init__.c index e1b98a9f93..d32550722c 100644 --- a/shared-module/msgpack/__init__.c +++ b/shared-module/msgpack/__init__.c @@ -36,7 +36,7 @@ #include "py/runtime.h" #include "py/stream.h" -#include "supervisor/shared/translate.h" +#include "supervisor/shared/translate/translate.h" #include "shared-bindings/msgpack/ExtType.h" #include "shared-bindings/msgpack/__init__.h" #include "shared-module/msgpack/__init__.h" diff --git a/shared-module/os/__init__.c b/shared-module/os/__init__.c index 89c7952671..35933ebaf6 100644 --- a/shared-module/os/__init__.c +++ b/shared-module/os/__init__.c @@ -36,6 +36,10 @@ #include "py/runtime.h" #include "shared-bindings/os/__init__.h" +#if CIRCUITPY_DOTENV +#include "shared-bindings/dotenv/__init__.h" +#endif + // This provides all VFS related OS functions so that ports can share the code // as needed. It does not provide uname. @@ -107,6 +111,16 @@ mp_obj_t common_hal_os_getcwd(void) { return mp_vfs_getcwd(); } +mp_obj_t common_hal_os_getenv(const char *key, mp_obj_t default_) { + #if CIRCUITPY_DOTENV + mp_obj_t env_obj = common_hal_dotenv_get_key("/.env", key); + if (env_obj != mp_const_none) { + return env_obj; + } + #endif + return default_; +} + mp_obj_t common_hal_os_listdir(const char *path) { mp_obj_t path_out; mp_vfs_mount_t *vfs = lookup_dir_path(path, &path_out); diff --git a/shared-module/qrio/QRDecoder.c b/shared-module/qrio/QRDecoder.c index 26a609f215..f7b25362e4 100644 --- a/shared-module/qrio/QRDecoder.c +++ b/shared-module/qrio/QRDecoder.c @@ -104,6 +104,20 @@ mp_obj_t shared_module_qrio_qrdecoder_decode(qrdecoder_qrdecoder_obj_t *self, co uint8_t *src = bufinfo->buf; switch (policy) { + case QRIO_RGB565: { + uint16_t *src16 = bufinfo->buf; + for (int i = 0; i < width * height; i++) { + framebuffer[i] = (src16[i] >> 3) & 0xfc; + } + break; + } + case QRIO_RGB565_SWAPPED: { + uint16_t *src16 = bufinfo->buf; + for (int i = 0; i < width * height; i++) { + framebuffer[i] = (__builtin_bswap16(src16[i]) >> 3) & 0xfc; + } + break; + } case QRIO_EVERY_BYTE: memcpy(framebuffer, src, width * height); break; @@ -116,6 +130,7 @@ mp_obj_t shared_module_qrio_qrdecoder_decode(qrdecoder_qrdecoder_obj_t *self, co for (int i = 0; i < width * height; i++) { framebuffer[i] = src[2 * i]; } + break; } quirc_end(self->quirc); diff --git a/shared-module/rgbmatrix/RGBMatrix.c b/shared-module/rgbmatrix/RGBMatrix.c index 0bfed0aa6c..5e8f95b139 100644 --- a/shared-module/rgbmatrix/RGBMatrix.c +++ b/shared-module/rgbmatrix/RGBMatrix.c @@ -117,13 +117,13 @@ void common_hal_rgbmatrix_rgbmatrix_reconstruct(rgbmatrix_rgbmatrix_obj_t *self, common_hal_rgbmatrix_rgbmatrix_deinit(self); switch (stat) { case PROTOMATTER_ERR_PINS: - mp_raise_ValueError(translate("Invalid pin")); + raise_ValueError_invalid_pin(); break; case PROTOMATTER_ERR_ARG: - mp_raise_ValueError(translate("Invalid argument")); + mp_arg_error_invalid(MP_QSTR_args); break; case PROTOMATTER_ERR_MALLOC: - mp_raise_msg(&mp_type_MemoryError, NULL); + mp_raise_msg_varg(&mp_type_MemoryError, translate("Failed to allocate %q buffer"), MP_QSTR_RGBMatrix); break; default: mp_raise_msg_varg(&mp_type_RuntimeError, diff --git a/shared-module/storage/__init__.c b/shared-module/storage/__init__.c index e36d3ec21e..8806b7c8c6 100644 --- a/shared-module/storage/__init__.c +++ b/shared-module/storage/__init__.c @@ -38,6 +38,7 @@ #include "shared-bindings/storage/__init__.h" #include "supervisor/filesystem.h" #include "supervisor/flash.h" +#include "supervisor/shared/translate/translate.h" #include "supervisor/usb.h" #if CIRCUITPY_USB_MSC diff --git a/shared-module/struct/__init__.c b/shared-module/struct/__init__.c index a0abd16408..e87321ae79 100644 --- a/shared-module/struct/__init__.c +++ b/shared-module/struct/__init__.c @@ -31,7 +31,7 @@ #include "py/runtime.h" #include "py/binary.h" #include "py/parsenum.h" -#include "supervisor/shared/translate.h" +#include "supervisor/shared/translate/translate.h" #include "shared-bindings/struct/__init__.h" STATIC void struct_validate_format(char fmt) { diff --git a/shared-module/supervisor/StatusBar.c b/shared-module/supervisor/StatusBar.c new file mode 100644 index 0000000000..9b6fe9b849 --- /dev/null +++ b/shared-module/supervisor/StatusBar.c @@ -0,0 +1,90 @@ +/* + * This file is part of the MicroPython project, http://micropython.org/ + * + * The MIT License (MIT) + * + * Copyright (c) 2022 Dan Halbert for Adafruit Industries + * + * Permission is hereby granted, free of charge, to any person obtaining a copy + * of this software and associated documentation files (the "Software"), to deal + * in the Software without restriction, including without limitation the rights + * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell + * copies of the Software, and to permit persons to whom the Software is + * furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice shall be included in + * all copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE + * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER + * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, + * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN + * THE SOFTWARE. + */ + +#include +#include "py/obj.h" +#include "shared-bindings/supervisor/StatusBar.h" +#include "shared-bindings/supervisor/__init__.h" +#include "supervisor/shared/display.h" +#include "supervisor/shared/status_bar.h" + +#if CIRCUITPY_TERMINALIO +#include "shared-module/terminalio/Terminal.h" +#endif + +bool shared_module_supervisor_status_bar_get_console(supervisor_status_bar_obj_t *self) { + return self->console; +} + +void shared_module_supervisor_status_bar_set_console(supervisor_status_bar_obj_t *self, bool enabled) { + if (self->console == enabled) { + // Do nothing if not changing the state. + return; + } + + if (self->updated) { + // Clear before changing state. If disabling, will remain cleared. + supervisor_status_bar_clear(); + } + + self->console = enabled; + + // Update may be ignored. + supervisor_status_bar_update(); +} + +bool shared_module_supervisor_status_bar_get_display(supervisor_status_bar_obj_t *self) { + return self->display; +} + +#if CIRCUITPY_TERMINALIO +void shared_module_supervisor_status_bar_set_display(supervisor_status_bar_obj_t *self, bool enabled) { + if (self->display == enabled) { + // Do nothing if not changing the state. + return; + } + + if (self->updated) { + // Clear before changing state. If disabling, will remain cleared. + terminalio_terminal_clear_status_bar(&supervisor_terminal); + } + + self->display = enabled; + + // Update may be ignored. + supervisor_status_bar_update(); +} +#endif + +void shared_module_supervisor_status_bar_init(supervisor_status_bar_obj_t *self) { + self->console = true; + self->display = true; + self->updated = false; +} + +void shared_module_supervisor_status_bar_updated(supervisor_status_bar_obj_t *self) { + self->updated = true; +} diff --git a/shared-module/supervisor/StatusBar.h b/shared-module/supervisor/StatusBar.h new file mode 100644 index 0000000000..a1254addc4 --- /dev/null +++ b/shared-module/supervisor/StatusBar.h @@ -0,0 +1,42 @@ +/* + * This file is part of the MicroPython project, http://micropython.org/ + * + * The MIT License (MIT) + * + * Copyright (c) 2022 Dan Halbert 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_SHARED_MODULE_SUPERVISOR_STATUS_BAR_H +#define MICROPY_INCLUDED_SHARED_MODULE_SUPERVISOR_STATUS_BAR_H + +#include "py/obj.h" + +typedef struct { + mp_obj_base_t base; + bool console; + bool display; + bool updated; +} supervisor_status_bar_obj_t; + +extern void shared_module_supervisor_status_bar_init(supervisor_status_bar_obj_t *self); +extern void shared_module_supervisor_status_bar_updated(supervisor_status_bar_obj_t *self); + +#endif // MICROPY_INCLUDED_SHARED_MODULE_SUPERVISOR_STATUS_BAR_H diff --git a/shared-module/supervisor/__init__.c b/shared-module/supervisor/__init__.c new file mode 100644 index 0000000000..05e23e26e7 --- /dev/null +++ b/shared-module/supervisor/__init__.c @@ -0,0 +1,37 @@ +/* + * This file is part of the MicroPython project, http://micropython.org/ + * + * The MIT License (MIT) + * + * Copyright (c) 2022 Dan Halbert for Adafruit Industries + * + * Permission is hereby granted, free of charge, to any person obtaining a copy + * of this software and associated documentation files (the "Software"), to deal + * in the Software without restriction, including without limitation the rights + * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell + * copies of the Software, and to permit persons to whom the Software is + * furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice shall be included in + * all copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE + * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER + * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, + * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN + * THE SOFTWARE. + */ + +#include +#include "py/obj.h" +#include "shared-bindings/supervisor/StatusBar.h" +#include "shared-bindings/supervisor/__init__.h" + +// The singleton supervisor.StatusBar object, bound to supervisor.status_bar +supervisor_status_bar_obj_t shared_module_supervisor_status_bar_obj = { + .base = { + .type = &supervisor_status_bar_type, + }, +}; diff --git a/shared-module/synthio/MidiTrack.c b/shared-module/synthio/MidiTrack.c index b2693a0c59..f02747d734 100644 --- a/shared-module/synthio/MidiTrack.c +++ b/shared-module/synthio/MidiTrack.c @@ -32,13 +32,17 @@ #define BYTES_PER_SAMPLE (BITS_PER_SAMPLE / 8) #define SILENCE 0x80 +STATIC NORETURN void raise_midi_stream_error(uint32_t pos) { + mp_raise_ValueError_varg(translate("Error in MIDI stream at position %d"), pos); +} + STATIC uint8_t parse_note(const uint8_t *buffer, uint32_t len, uint32_t *pos) { if (*pos + 1 >= len) { - mp_raise_ValueError_varg(translate("Error in MIDI stream at position %d"), *pos); + raise_midi_stream_error(*pos); } uint8_t note = buffer[(*pos)++]; if (note > 127 || buffer[(*pos)++] > 127) { - mp_raise_ValueError_varg(translate("Error in MIDI stream at position %d"), *pos); + raise_midi_stream_error(*pos); } return note; } @@ -84,7 +88,7 @@ void common_hal_synthio_miditrack_construct(synthio_miditrack_obj_t *self, } while ((c & 0x80) && (pos < len)); if (c & 0x80) { - mp_raise_ValueError_varg(translate("Error in MIDI stream at position %d"), pos); + raise_midi_stream_error(pos); } dur += delta * sample_rate / tempo; @@ -128,14 +132,14 @@ void common_hal_synthio_miditrack_construct(synthio_miditrack_obj_t *self, case 12: case 13: // one data byte to ignore if (pos >= len || buffer[pos++] > 127) { - mp_raise_ValueError_varg(translate("Error in MIDI stream at position %d"), pos); + raise_midi_stream_error(pos); } break; case 15: // the full syntax is too complicated, just assume it's "End of Track" event pos = len; break; default: // invalid event - mp_raise_ValueError_varg(translate("Error in MIDI stream at position %d"), pos); + raise_midi_stream_error(pos); } } terminate_span(self, &dur, &max_dur); diff --git a/shared-module/terminalio/Terminal.c b/shared-module/terminalio/Terminal.c index fc33533b17..a19768a622 100644 --- a/shared-module/terminalio/Terminal.c +++ b/shared-module/terminalio/Terminal.c @@ -30,36 +30,78 @@ #include "shared-bindings/displayio/TileGrid.h" #include "shared-bindings/terminalio/Terminal.h" -void common_hal_terminalio_terminal_construct(terminalio_terminal_obj_t *self, displayio_tilegrid_t *tilegrid, const fontio_builtinfont_t *font) { +#if CIRCUITPY_STATUS_BAR +#include "shared-bindings/supervisor/__init__.h" +#include "shared-bindings/supervisor/StatusBar.h" +#endif + +void terminalio_terminal_clear_status_bar(terminalio_terminal_obj_t *self) { + if (self->status_bar) { + common_hal_displayio_tilegrid_set_all_tiles(self->status_bar, 0); + } +} + +void common_hal_terminalio_terminal_construct(terminalio_terminal_obj_t *self, + displayio_tilegrid_t *scroll_area, const fontio_builtinfont_t *font, + displayio_tilegrid_t *status_bar) { self->cursor_x = 0; self->cursor_y = 0; self->font = font; - self->tilegrid = tilegrid; + self->scroll_area = scroll_area; + self->status_bar = status_bar; + self->status_x = 0; + self->status_y = 0; self->first_row = 0; - for (uint16_t x = 0; x < self->tilegrid->width_in_tiles; x++) { - for (uint16_t y = 0; y < self->tilegrid->height_in_tiles; y++) { - common_hal_displayio_tilegrid_set_tile(self->tilegrid, x, y, 0); - } + common_hal_displayio_tilegrid_set_all_tiles(self->scroll_area, 0); + if (self->status_bar) { + common_hal_displayio_tilegrid_set_all_tiles(self->status_bar, 0); } - common_hal_displayio_tilegrid_set_top_left(self->tilegrid, 0, 1); + common_hal_displayio_tilegrid_set_top_left(self->scroll_area, 0, 1); } size_t common_hal_terminalio_terminal_write(terminalio_terminal_obj_t *self, const byte *data, size_t len, int *errcode) { // Make sure the terminal is initialized before we do anything with it. - if (self->tilegrid == NULL) { + if (self->scroll_area == NULL) { return len; } + const byte *i = data; uint16_t start_y = self->cursor_y; while (i < data + len) { unichar c = utf8_get_char(i); i = utf8_next_char(i); + if (self->in_osc_command) { + if (c == 0x1b && i[0] == '\\') { + self->in_osc_command = false; + self->status_x = 0; + self->status_y = 0; + i += 1; + } else if ( + self->osc_command == 0 && + self->status_bar != NULL && + self->status_y < self->status_bar->height_in_tiles) { + uint8_t tile_index = fontio_builtinfont_get_glyph_index(self->font, c); + if (tile_index != 0xff) { + // Clear the tile grid before we start putting new info. + if (self->status_x == 0 && self->status_y == 0) { + common_hal_displayio_tilegrid_set_all_tiles(self->status_bar, 0); + } + common_hal_displayio_tilegrid_set_tile(self->status_bar, self->status_x, self->status_y, tile_index); + self->status_x++; + if (self->status_x >= self->status_bar->width_in_tiles) { + self->status_y++; + self->status_x %= self->status_bar->width_in_tiles; + } + } + } + continue; + } // Always handle ASCII. if (c < 128) { if (c >= 0x20 && c <= 0x7e) { uint8_t tile_index = fontio_builtinfont_get_glyph_index(self->font, c); - common_hal_displayio_tilegrid_set_tile(self->tilegrid, self->cursor_x, self->cursor_y, tile_index); + common_hal_displayio_tilegrid_set_tile(self->scroll_area, self->cursor_x, self->cursor_y, tile_index); self->cursor_x++; } else if (c == '\r') { self->cursor_x = 0; @@ -71,25 +113,25 @@ size_t common_hal_terminalio_terminal_write(terminalio_terminal_obj_t *self, con self->cursor_x--; } } else if (c == 0x1b) { + // Handle commands of the form [ESC]. where . is not yet known. + uint16_t n = 0; + uint8_t j = 1; + for (; j < 6; j++) { + if ('0' <= i[j] && i[j] <= '9') { + n = n * 10 + (i[j] - '0'); + } else { + c = i[j]; + break; + } + } if (i[0] == '[') { if (i[1] == 'K') { // Clear the rest of the line. - for (uint16_t j = self->cursor_x; j < self->tilegrid->width_in_tiles; j++) { - common_hal_displayio_tilegrid_set_tile(self->tilegrid, j, self->cursor_y, 0); + for (uint16_t k = self->cursor_x; k < self->scroll_area->width_in_tiles; k++) { + common_hal_displayio_tilegrid_set_tile(self->scroll_area, k, self->cursor_y, 0); } i += 2; } else { - // Handle commands of the form \x1b[####D - uint16_t n = 0; - uint8_t j = 1; - for (; j < 6; j++) { - if ('0' <= i[j] && i[j] <= '9') { - n = n * 10 + (i[j] - '0'); - } else { - c = i[j]; - break; - } - } if (c == 'D') { if (n > self->cursor_x) { self->cursor_x = 0; @@ -99,14 +141,10 @@ size_t common_hal_terminalio_terminal_write(terminalio_terminal_obj_t *self, con } if (c == 'J') { if (n == 2) { - common_hal_displayio_tilegrid_set_top_left(self->tilegrid, 0, 0); + common_hal_displayio_tilegrid_set_top_left(self->scroll_area, 0, 0); self->cursor_x = self->cursor_y = start_y = 0; n = 0; - for (uint16_t x = 0; x < self->tilegrid->width_in_tiles; x++) { - for (uint16_t y = 0; y < self->tilegrid->height_in_tiles; y++) { - common_hal_displayio_tilegrid_set_tile(self->tilegrid, x, y, 0); - } - } + common_hal_displayio_tilegrid_set_all_tiles(self->scroll_area, 0); } } if (c == ';') { @@ -126,13 +164,13 @@ size_t common_hal_terminalio_terminal_write(terminalio_terminal_obj_t *self, con if (m > 0) { m--; } - if (n >= self->tilegrid->height_in_tiles) { - n = self->tilegrid->height_in_tiles - 1; + if (n >= self->scroll_area->height_in_tiles) { + n = self->scroll_area->height_in_tiles - 1; } - if (m >= self->tilegrid->width_in_tiles) { - m = self->tilegrid->width_in_tiles - 1; + if (m >= self->scroll_area->width_in_tiles) { + m = self->scroll_area->width_in_tiles - 1; } - n = (n + self->tilegrid->top_left_y) % self->tilegrid->height_in_tiles; + n = (n + self->scroll_area->top_left_y) % self->scroll_area->height_in_tiles; self->cursor_x = m; self->cursor_y = n; start_y = self->cursor_y; @@ -141,30 +179,34 @@ size_t common_hal_terminalio_terminal_write(terminalio_terminal_obj_t *self, con i += j + 1; continue; } + } else if (i[0] == ']' && c == ';') { + self->in_osc_command = true; + self->osc_command = n; + i += j + 1; } } } else { uint8_t tile_index = fontio_builtinfont_get_glyph_index(self->font, c); if (tile_index != 0xff) { - common_hal_displayio_tilegrid_set_tile(self->tilegrid, self->cursor_x, self->cursor_y, tile_index); + common_hal_displayio_tilegrid_set_tile(self->scroll_area, self->cursor_x, self->cursor_y, tile_index); self->cursor_x++; } } - if (self->cursor_x >= self->tilegrid->width_in_tiles) { + if (self->cursor_x >= self->scroll_area->width_in_tiles) { self->cursor_y++; - self->cursor_x %= self->tilegrid->width_in_tiles; + self->cursor_x %= self->scroll_area->width_in_tiles; } - if (self->cursor_y >= self->tilegrid->height_in_tiles) { - self->cursor_y %= self->tilegrid->height_in_tiles; + if (self->cursor_y >= self->scroll_area->height_in_tiles) { + self->cursor_y %= self->scroll_area->height_in_tiles; } if (self->cursor_y != start_y) { // clear the new row in case of scroll up - if (self->cursor_y == self->tilegrid->top_left_y) { - for (uint16_t j = 0; j < self->tilegrid->width_in_tiles; j++) { - common_hal_displayio_tilegrid_set_tile(self->tilegrid, j, self->cursor_y, 0); + if (self->cursor_y == self->scroll_area->top_left_y) { + for (uint16_t j = 0; j < self->scroll_area->width_in_tiles; j++) { + common_hal_displayio_tilegrid_set_tile(self->scroll_area, j, self->cursor_y, 0); } - common_hal_displayio_tilegrid_set_top_left(self->tilegrid, 0, (self->cursor_y + self->tilegrid->height_in_tiles + 1) % self->tilegrid->height_in_tiles); + common_hal_displayio_tilegrid_set_top_left(self->scroll_area, 0, (self->cursor_y + self->scroll_area->height_in_tiles + 1) % self->scroll_area->height_in_tiles); } start_y = self->cursor_y; } @@ -173,5 +215,5 @@ size_t common_hal_terminalio_terminal_write(terminalio_terminal_obj_t *self, con } bool common_hal_terminalio_terminal_ready_to_tx(terminalio_terminal_obj_t *self) { - return self->tilegrid != NULL; + return self->scroll_area != NULL; } diff --git a/shared-module/terminalio/Terminal.h b/shared-module/terminalio/Terminal.h index 2ba7e21f72..7f0545c6be 100644 --- a/shared-module/terminalio/Terminal.h +++ b/shared-module/terminalio/Terminal.h @@ -39,8 +39,15 @@ typedef struct { const fontio_builtinfont_t *font; uint16_t cursor_x; uint16_t cursor_y; - displayio_tilegrid_t *tilegrid; + displayio_tilegrid_t *scroll_area; + displayio_tilegrid_t *status_bar; + uint16_t status_x; + uint16_t status_y; uint16_t first_row; + uint16_t osc_command; + bool in_osc_command; } terminalio_terminal_obj_t; +extern void terminalio_terminal_clear_status_bar(terminalio_terminal_obj_t *self); + #endif /* SHARED_MODULE_TERMINALIO_TERMINAL_H */ diff --git a/shared-module/touchio/TouchIn.c b/shared-module/touchio/TouchIn.c index 840c14571d..35dd56a6e4 100644 --- a/shared-module/touchio/TouchIn.c +++ b/shared-module/touchio/TouchIn.c @@ -78,6 +78,7 @@ void common_hal_touchio_touchin_construct(touchio_touchin_obj_t *self, const mcu uint16_t raw_reading = get_raw_reading(self); if (raw_reading == TIMEOUT_TICKS) { + common_hal_touchio_touchin_deinit(self); mp_raise_ValueError(translate("No pulldown on pin; 1Mohm recommended")); } self->threshold = raw_reading * 1.05 + 100; diff --git a/shared-module/usb_hid/Device.c b/shared-module/usb_hid/Device.c index 8a0c429f84..680bb83893 100644 --- a/shared-module/usb_hid/Device.c +++ b/shared-module/usb_hid/Device.c @@ -24,6 +24,7 @@ * THE SOFTWARE. */ +#include #include #include "py/gc.h" @@ -31,7 +32,7 @@ #include "shared-bindings/usb_hid/Device.h" #include "shared-module/usb_hid/__init__.h" #include "shared-module/usb_hid/Device.h" -#include "supervisor/shared/translate.h" +#include "supervisor/shared/translate/translate.h" #include "supervisor/shared/tick.h" #include "tusb.h" @@ -181,16 +182,14 @@ uint8_t common_hal_usb_hid_device_validate_report_id(usb_hid_device_obj_t *self, } if (!(report_id_arg >= 0 && get_report_id_idx(self, (size_t)report_id_arg) < CIRCUITPY_USB_HID_MAX_REPORT_IDS_PER_DESCRIPTOR)) { - mp_raise_ValueError_varg(translate("Invalid %q"), MP_QSTR_report_id); + mp_arg_error_invalid(MP_QSTR_report_id); } return (uint8_t)report_id_arg; } void common_hal_usb_hid_device_construct(usb_hid_device_obj_t *self, mp_obj_t report_descriptor, uint16_t usage_page, uint16_t usage, size_t num_report_ids, uint8_t *report_ids, uint8_t *in_report_lengths, uint8_t *out_report_lengths) { - if (num_report_ids > CIRCUITPY_USB_HID_MAX_REPORT_IDS_PER_DESCRIPTOR) { - mp_raise_ValueError_varg(translate("More than %d report ids not supported"), - CIRCUITPY_USB_HID_MAX_REPORT_IDS_PER_DESCRIPTOR); - } + mp_arg_validate_length_max( + num_report_ids, CIRCUITPY_USB_HID_MAX_REPORT_IDS_PER_DESCRIPTOR, MP_QSTR_report_ids); // report buffer pointers are NULL at start, and are created when USB is initialized. mp_buffer_info_t bufinfo; @@ -223,10 +222,7 @@ void common_hal_usb_hid_device_send_report(usb_hid_device_obj_t *self, uint8_t * // report_id and len have already been validated for this device. size_t id_idx = get_report_id_idx(self, report_id); - if (len != self->in_report_lengths[id_idx]) { - mp_raise_ValueError_varg(translate("Buffer incorrect size. Should be %d bytes."), - self->in_report_lengths[id_idx]); - } + mp_arg_validate_length(len, self->in_report_lengths[id_idx], MP_QSTR_report); // Wait until interface is ready, timeout = 2 seconds uint64_t end_ticks = supervisor_ticks_ms64() + 2000; @@ -235,7 +231,7 @@ void common_hal_usb_hid_device_send_report(usb_hid_device_obj_t *self, uint8_t * } if (!tud_hid_ready()) { - mp_raise_msg(&mp_type_OSError, translate("USB busy")); + mp_raise_msg(&mp_type_OSError, translate("USB busy")); } if (!tud_hid_report(report_id, report, len)) { @@ -246,6 +242,10 @@ void common_hal_usb_hid_device_send_report(usb_hid_device_obj_t *self, uint8_t * mp_obj_t common_hal_usb_hid_device_get_last_received_report(usb_hid_device_obj_t *self, uint8_t report_id) { // report_id has already been validated for this device. size_t id_idx = get_report_id_idx(self, report_id); + if (!self->out_report_buffers_updated[id_idx]) { + return mp_const_none; + } + self->out_report_buffers_updated[id_idx] = false; return mp_obj_new_bytes(self->out_report_buffers[id_idx], self->out_report_lengths[id_idx]); } @@ -263,6 +263,7 @@ void usb_hid_device_create_report_buffers(usb_hid_device_obj_t *self) { ? gc_alloc(self->out_report_lengths[i], false, true /*long-lived*/) : NULL; } + memset(self->out_report_buffers_updated, 0, sizeof(self->out_report_buffers_updated)); } @@ -309,6 +310,7 @@ void tud_hid_set_report_cb(uint8_t itf, uint8_t report_id, hid_report_type_t rep hid_device->out_report_buffers[id_idx] && hid_device->out_report_lengths[id_idx] >= bufsize) { memcpy(hid_device->out_report_buffers[id_idx], buffer, bufsize); + hid_device->out_report_buffers_updated[id_idx] = true; } } } diff --git a/shared-module/usb_hid/Device.h b/shared-module/usb_hid/Device.h index f265712be4..06729f3c7d 100644 --- a/shared-module/usb_hid/Device.h +++ b/shared-module/usb_hid/Device.h @@ -38,6 +38,7 @@ typedef struct { const uint8_t *report_descriptor; uint8_t *in_report_buffers[CIRCUITPY_USB_HID_MAX_REPORT_IDS_PER_DESCRIPTOR]; uint8_t *out_report_buffers[CIRCUITPY_USB_HID_MAX_REPORT_IDS_PER_DESCRIPTOR]; + uint8_t out_report_buffers_updated[CIRCUITPY_USB_HID_MAX_REPORT_IDS_PER_DESCRIPTOR]; uint16_t report_descriptor_length; uint8_t report_ids[CIRCUITPY_USB_HID_MAX_REPORT_IDS_PER_DESCRIPTOR]; uint8_t in_report_lengths[CIRCUITPY_USB_HID_MAX_REPORT_IDS_PER_DESCRIPTOR]; diff --git a/shared-module/usb_hid/__init__.c b/shared-module/usb_hid/__init__.c index 89a05c77b3..99be84542f 100644 --- a/shared-module/usb_hid/__init__.c +++ b/shared-module/usb_hid/__init__.c @@ -33,6 +33,7 @@ #include "shared-bindings/usb_hid/__init__.h" #include "shared-bindings/usb_hid/Device.h" #include "supervisor/memory.h" +#include "supervisor/shared/translate/translate.h" #include "supervisor/usb.h" static const uint8_t usb_hid_descriptor_template[] = { diff --git a/shared-module/usb_midi/PortIn.c b/shared-module/usb_midi/PortIn.c index b16b77cf97..a5c73aa256 100644 --- a/shared-module/usb_midi/PortIn.c +++ b/shared-module/usb_midi/PortIn.c @@ -26,7 +26,7 @@ #include "shared-bindings/usb_midi/PortIn.h" #include "shared-module/usb_midi/PortIn.h" -#include "supervisor/shared/translate.h" +#include "supervisor/shared/translate/translate.h" #include "tusb.h" size_t common_hal_usb_midi_portin_read(usb_midi_portin_obj_t *self, uint8_t *data, size_t len, int *errcode) { diff --git a/shared-module/usb_midi/PortOut.c b/shared-module/usb_midi/PortOut.c index 4005d8b77d..c9d229635e 100644 --- a/shared-module/usb_midi/PortOut.c +++ b/shared-module/usb_midi/PortOut.c @@ -26,7 +26,7 @@ #include "shared-bindings/usb_midi/PortOut.h" #include "shared-module/usb_midi/PortOut.h" -#include "supervisor/shared/translate.h" +#include "supervisor/shared/translate/translate.h" #include "tusb.h" size_t common_hal_usb_midi_portout_write(usb_midi_portout_obj_t *self, const uint8_t *data, size_t len, int *errcode) { diff --git a/shared-module/usb_midi/__init__.c b/shared-module/usb_midi/__init__.c index 8cac2ba8af..ed1b8a0518 100644 --- a/shared-module/usb_midi/__init__.c +++ b/shared-module/usb_midi/__init__.c @@ -34,6 +34,7 @@ #include "shared-bindings/usb_midi/PortIn.h" #include "shared-bindings/usb_midi/PortOut.h" #include "supervisor/memory.h" +#include "supervisor/shared/translate/translate.h" #include "supervisor/usb.h" #include "tusb.h" diff --git a/shared-module/vectorio/Circle.c b/shared-module/vectorio/Circle.c index 2ec11fe1bb..ee83ad18b9 100644 --- a/shared-module/vectorio/Circle.c +++ b/shared-module/vectorio/Circle.c @@ -15,7 +15,7 @@ void common_hal_vectorio_circle_construct(vectorio_circle_t *self, uint16_t radi void common_hal_vectorio_circle_set_on_dirty(vectorio_circle_t *self, vectorio_event_t on_dirty) { if (self->on_dirty.obj != NULL) { - mp_raise_TypeError(translate("circle can only be registered in one parent")); + mp_raise_TypeError(translate("can only have one parent")); } self->on_dirty = on_dirty; } diff --git a/shared-module/vectorio/Polygon.c b/shared-module/vectorio/Polygon.c index 10ebdf1edd..5d1e0d3e58 100644 --- a/shared-module/vectorio/Polygon.c +++ b/shared-module/vectorio/Polygon.c @@ -14,7 +14,8 @@ // Converts a list of points tuples to a flat list of ints for speedier internal use. -// Also validates the points. +// Also validates the points. If this fails due to invalid types or values, the +// number of points is 0 and the points_list is NULL. static void _clobber_points_list(vectorio_polygon_t *self, mp_obj_t points_tuple_list) { size_t len = 0; mp_obj_t *items; @@ -25,38 +26,30 @@ static void _clobber_points_list(vectorio_polygon_t *self, mp_obj_t points_tuple mp_raise_TypeError(translate("Polygon needs at least 3 points")); } - if (self->len < 2 * len) { - if (self->points_list != NULL) { - VECTORIO_POLYGON_DEBUG("free(%d), ", sizeof(self->points_list)); - gc_free(self->points_list); - } - self->points_list = gc_alloc(2 * len * sizeof(uint16_t), false, false); - VECTORIO_POLYGON_DEBUG("alloc(%p, %d)", self->points_list, 2 * len * sizeof(uint16_t)); - } - self->len = 2 * len; + int16_t *points_list = gc_realloc(self->points_list, 2 * len * sizeof(uint16_t), true); + VECTORIO_POLYGON_DEBUG("realloc(%p, %d) -> %p", self->points_list, 2 * len * sizeof(uint16_t), points_list); + + // In case the validation calls below fail, set these values temporarily + self->points_list = NULL; + self->len = 0; for (uint16_t i = 0; i < len; ++i) { size_t tuple_len = 0; mp_obj_t *tuple_items; mp_obj_tuple_get(items[i], &tuple_len, &tuple_items); - if (tuple_len != 2) { - mp_raise_ValueError_varg(translate("%q must be a tuple of length 2"), MP_QSTR_point); - } - mp_int_t x; - mp_int_t y; - if (!mp_obj_get_int_maybe(tuple_items[ 0 ], &x) - || !mp_obj_get_int_maybe(tuple_items[ 1 ], &y) - || x < SHRT_MIN || x > SHRT_MAX || y < SHRT_MIN || y > SHRT_MAX - ) { - gc_free(self->points_list); - self->points_list = NULL; - mp_raise_ValueError_varg(translate("unsupported %q type"), MP_QSTR_point); - self->len = 0; - } - self->points_list[2 * i ] = (int16_t)x; - self->points_list[2 * i + 1] = (int16_t)y; + mp_arg_validate_length(tuple_len, 2, MP_QSTR_point); + + mp_int_t x = mp_arg_validate_type_int(tuple_items[0], MP_QSTR_x); + mp_arg_validate_int_range(x, SHRT_MIN, SHRT_MAX, MP_QSTR_x); + mp_int_t y = mp_arg_validate_type_int(tuple_items[1], MP_QSTR_y); + mp_arg_validate_int_range(y, SHRT_MIN, SHRT_MAX, MP_QSTR_y); + points_list[2 * i ] = (int16_t)x; + points_list[2 * i + 1] = (int16_t)y; } + + self->points_list = points_list; + self->len = 2 * len; } @@ -103,7 +96,7 @@ void common_hal_vectorio_polygon_set_points(vectorio_polygon_t *self, mp_obj_t p void common_hal_vectorio_polygon_set_on_dirty(vectorio_polygon_t *self, vectorio_event_t notification) { if (self->on_dirty.obj != NULL) { - mp_raise_TypeError(translate("polygon can only be registered in one parent")); + mp_raise_TypeError(translate("can only have one parent")); } self->on_dirty = notification; } diff --git a/shared-module/vectorio/Rectangle.c b/shared-module/vectorio/Rectangle.c index fbd3d6bdf5..4c2bdc66cb 100644 --- a/shared-module/vectorio/Rectangle.c +++ b/shared-module/vectorio/Rectangle.c @@ -14,7 +14,7 @@ void common_hal_vectorio_rectangle_construct(vectorio_rectangle_t *self, uint32_ void common_hal_vectorio_rectangle_set_on_dirty(vectorio_rectangle_t *self, vectorio_event_t on_dirty) { if (self->on_dirty.obj != NULL) { - mp_raise_TypeError(translate("can only be registered in one parent")); + mp_raise_TypeError(translate("can only have one parent")); } self->on_dirty = on_dirty; } diff --git a/shared-module/vectorio/VectorShape.c b/shared-module/vectorio/VectorShape.c index 04213d36e7..d9c13f54cc 100644 --- a/shared-module/vectorio/VectorShape.c +++ b/shared-module/vectorio/VectorShape.c @@ -63,9 +63,7 @@ (u32 & 0x1 ? '1' : '0') static void short_bound_check(mp_int_t i, qstr name) { - if (i < SHRT_MIN || i > SHRT_MAX) { - mp_raise_ValueError_varg(translate("%q must be between %d and %d"), name, SHRT_MIN, SHRT_MAX); - } + mp_arg_validate_int_range(i, SHRT_MIN, SHRT_MAX, name); } inline __attribute__((always_inline)) @@ -277,16 +275,10 @@ void common_hal_vectorio_vector_shape_set_location(vectorio_vector_shape_t *self size_t tuple_len = 0; mp_obj_t *tuple_items; mp_obj_tuple_get(xy, &tuple_len, &tuple_items); - if (tuple_len != 2) { - mp_raise_TypeError(translate("(x,y) integers required")); - } + mp_arg_validate_length(tuple_len, 2, MP_QSTR_location); - mp_int_t x; - mp_int_t y; - if (!mp_obj_get_int_maybe(tuple_items[ 0 ], &x) - || !mp_obj_get_int_maybe(tuple_items[ 1 ], &y)) { - mp_raise_ValueError_varg(translate("unsupported %q type"), MP_QSTR_point); - } + mp_int_t x = mp_arg_validate_type_int(tuple_items[0], MP_QSTR_x); + mp_int_t y = mp_arg_validate_type_int(tuple_items[0], MP_QSTR_y); bool dirty = false; if (self->x != x) { check_bounds_and_set_x(self, x); diff --git a/shared/libc/abort_.c b/shared/libc/abort_.c index 45a2e0dedd..0c1d860aef 100644 --- a/shared/libc/abort_.c +++ b/shared/libc/abort_.c @@ -1,6 +1,6 @@ #include -#include "supervisor/shared/translate.h" +#include "supervisor/shared/translate/translate.h" NORETURN void abort_(void); diff --git a/shared/netutils/netutils.c b/shared/netutils/netutils.c index fe92e8bafb..030b1535cd 100644 --- a/shared/netutils/netutils.c +++ b/shared/netutils/netutils.c @@ -31,7 +31,7 @@ #include "py/runtime.h" #include "shared/netutils/netutils.h" -#include "supervisor/shared/translate.h" +#include "supervisor/shared/translate/translate.h" // Takes an array with a raw IPv4 address and returns something like '192.168.0.1'. mp_obj_t netutils_format_ipv4_addr(uint8_t *ip, netutils_endian_t endian) { diff --git a/shared/readline/readline.c b/shared/readline/readline.c index 23183342a7..d8602a9e28 100644 --- a/shared/readline/readline.c +++ b/shared/readline/readline.c @@ -177,6 +177,17 @@ int readline_process_char(int c) { vstr_cut_tail_bytes(rl.line, rl.line->len - rl.cursor_pos); // set redraw parameters redraw_from_cursor = true; + #endif + } else if (c == CHAR_CTRL_L) { + // CTRL-L is clear screen / redraw. This specific sequence is used + // (instead of a slightly more minimal sequence) for compatibility + // with the built-in Terminal class + mp_hal_stdout_tx_str("\x1b[;H\x1b[2J"); + mp_hal_stdout_tx_str(rl.prompt); + mp_hal_stdout_tx_strn(rl.line->buf + rl.orig_line_len, rl.cursor_pos - rl.orig_line_len); + // set redraw parameters + redraw_from_cursor = true; + #if MICROPY_REPL_EMACS_KEYS } else if (c == CHAR_CTRL_N) { // CTRL-N is go to next line in history goto down_arrow_key; diff --git a/shared/readline/readline.h b/shared/readline/readline.h index 4658ee19e8..9af19b181e 100644 --- a/shared/readline/readline.h +++ b/shared/readline/readline.h @@ -35,6 +35,7 @@ #define CHAR_CTRL_E (5) #define CHAR_CTRL_F (6) #define CHAR_CTRL_K (11) +#define CHAR_CTRL_L (12) #define CHAR_CTRL_N (14) #define CHAR_CTRL_P (16) #define CHAR_CTRL_U (21) diff --git a/shared/runtime/pyexec.c b/shared/runtime/pyexec.c index b1f94db5e5..87219d18f5 100644 --- a/shared/runtime/pyexec.c +++ b/shared/runtime/pyexec.c @@ -168,17 +168,21 @@ STATIC int parse_compile_execute(const void *source, mp_parse_input_kind_t input } // check for SystemExit - if (mp_obj_is_subclass_fast(MP_OBJ_FROM_PTR(mp_obj_get_type((mp_obj_t)nlr.ret_val)), MP_OBJ_FROM_PTR(&mp_type_SystemExit))) { + + // nlr.ret_val is an exception object. + mp_obj_t exception_obj = (mp_obj_t)nlr.ret_val; + + if (mp_obj_is_subclass_fast(MP_OBJ_FROM_PTR(mp_obj_get_type(exception_obj)), MP_OBJ_FROM_PTR(&mp_type_SystemExit))) { // at the moment, the value of SystemExit is unused ret = pyexec_system_exit; #if CIRCUITPY_ALARM - } else if (mp_obj_is_subclass_fast(MP_OBJ_FROM_PTR(mp_obj_get_type((mp_obj_t)nlr.ret_val)), &mp_type_DeepSleepRequest)) { + } else if (mp_obj_is_subclass_fast(MP_OBJ_FROM_PTR(mp_obj_get_type(exception_obj)), MP_OBJ_FROM_PTR(&mp_type_DeepSleepRequest))) { ret = PYEXEC_DEEP_SLEEP; #endif - } else if ((mp_obj_t)nlr.ret_val == MP_OBJ_FROM_PTR(&MP_STATE_VM(mp_reload_exception))) { + } else if (exception_obj == MP_OBJ_FROM_PTR(&MP_STATE_VM(mp_reload_exception))) { ret = PYEXEC_RELOAD; } else { - mp_obj_print_exception(&mp_plat_print, MP_OBJ_FROM_PTR(nlr.ret_val)); + mp_obj_print_exception(&mp_plat_print, exception_obj); ret = PYEXEC_EXCEPTION; } @@ -199,7 +203,9 @@ STATIC int parse_compile_execute(const void *source, mp_parse_input_kind_t input size_t n, *values; mp_obj_exception_get_traceback(return_value, &n, &values); if (values != NULL) { - result->exception_line = values[n - 2]; + result->exception_line = values[1]; + result->exception_filename[sizeof(result->exception_filename) - 1] = '\0'; + strncpy(result->exception_filename, qstr_str(values[0]), sizeof(result->exception_filename) - 1); } } } diff --git a/shared/runtime/pyexec.h b/shared/runtime/pyexec.h index d31a7fe816..411426eaaa 100644 --- a/shared/runtime/pyexec.h +++ b/shared/runtime/pyexec.h @@ -37,6 +37,9 @@ typedef struct { int return_code; mp_obj_t exception; int exception_line; + // Only store the first 32 characters of the filename. It is very unlikely that they can all be + // seen. + char exception_filename[33]; } pyexec_result_t; extern pyexec_mode_kind_t pyexec_mode_kind; diff --git a/supervisor/filesystem.h b/supervisor/filesystem.h index 6f4faf0b82..3954291513 100644 --- a/supervisor/filesystem.h +++ b/supervisor/filesystem.h @@ -45,4 +45,6 @@ void filesystem_set_concurrent_write_protection(fs_user_mount_t *vfs, bool concu bool filesystem_is_writable_by_python(fs_user_mount_t *vfs); bool filesystem_is_writable_by_usb(fs_user_mount_t *vfs); +FATFS *filesystem_circuitpy(void); + #endif // MICROPY_INCLUDED_SUPERVISOR_FILESYSTEM_H diff --git a/supervisor/port.h b/supervisor/port.h index 0a8cdfd342..2fb24385c1 100644 --- a/supervisor/port.h +++ b/supervisor/port.h @@ -99,8 +99,29 @@ void port_background_task(void); void port_start_background_task(void); void port_finish_background_task(void); -// Some ports need special handling to wake the main task from an interrupt -// context or other task. The port must implement the necessary code in this -// function. A default weak implementation is provided that does nothing. +// Some ports need special handling to wake the main task from another task. The +// port must implement the necessary code in this function. A default weak +// implementation is provided that does nothing. void port_wake_main_task(void); + +// Some ports need special handling to wake the main task from an interrupt +// context. The port must implement the necessary code in this function. A +// default weak implementation is provided that does nothing. +void port_wake_main_task_from_isr(void); + +// Some ports may use real RTOS tasks besides the background task framework of +// CircuitPython. Calling this will yield to other tasks and then return to the +// CircuitPython task when others are done. +void port_yield(void); + +// Some ports need special handling just after completing boot.py execution. +// This function is called once while boot.py's VM is still valid, and +// then a second time after the VM is finalized. +// A default weak implementation is provided that does nothing. +void port_post_boot_py(bool heap_valid); + +// Some ports want to add information to boot_out.txt. +// A default weak implementation is provided that does nothing. +void port_boot_info(void); + #endif // MICROPY_INCLUDED_SUPERVISOR_PORT_H diff --git a/supervisor/serial.h b/supervisor/serial.h index a6646e9542..2e30998f3b 100644 --- a/supervisor/serial.h +++ b/supervisor/serial.h @@ -49,14 +49,19 @@ char serial_read(void); bool serial_bytes_available(void); bool serial_connected(void); +// Used for temporarily suppressing output to the console or display. +bool serial_console_write_disable(bool disabled); +bool serial_display_write_disable(bool disabled); + // These have no-op versions that are weak and the port can override. They work // in tandem with the cross-port mechanics like USB and BLE. +void port_serial_early_init(void); void port_serial_init(void); bool port_serial_connected(void); char port_serial_read(void); bool port_serial_bytes_available(void); void port_serial_write_substring(const char *text, uint32_t length); -int debug_uart_printf(const char *fmt, ...) __attribute__((format(printf, 1, 2))); +int console_uart_printf(const char *fmt, ...) __attribute__((format(printf, 1, 2))); #endif // MICROPY_INCLUDED_SUPERVISOR_SERIAL_H diff --git a/supervisor/shared/background_callback.c b/supervisor/shared/background_callback.c index e53edb506f..88ffc15911 100644 --- a/supervisor/shared/background_callback.c +++ b/supervisor/shared/background_callback.c @@ -111,16 +111,28 @@ void background_callback_end_critical_section() { CALLBACK_CRITICAL_END; } + +// Filter out queued callbacks if they are allocated on the heap. void background_callback_reset() { + background_callback_t *new_head = NULL; + background_callback_t **previous_next = &new_head; + background_callback_t *new_tail = NULL; CALLBACK_CRITICAL_BEGIN; background_callback_t *cb = (background_callback_t *)callback_head; while (cb) { background_callback_t *next = cb->next; - memset(cb, 0, sizeof(*cb)); + if (!HEAP_PTR((void *)cb)) { + *previous_next = cb; + previous_next = &cb->next; + cb->next = NULL; + new_tail = cb; + } else { + memset(cb, 0, sizeof(*cb)); + } cb = next; } - callback_head = NULL; - callback_tail = NULL; + callback_head = new_head; + callback_tail = new_tail; in_background_callback = false; CALLBACK_CRITICAL_END; } diff --git a/supervisor/shared/bluetooth/bluetooth.c b/supervisor/shared/bluetooth/bluetooth.c index 426aad9891..6fe5d570b8 100644 --- a/supervisor/shared/bluetooth/bluetooth.c +++ b/supervisor/shared/bluetooth/bluetooth.c @@ -39,8 +39,10 @@ #include "common-hal/_bleio/__init__.h" +#include "supervisor/serial.h" #include "supervisor/shared/status_leds.h" #include "supervisor/shared/tick.h" +#include "supervisor/shared/translate/translate.h" #include "py/mpstate.h" @@ -54,6 +56,10 @@ #include "bluetooth/ble_drv.h" #endif +#if CIRCUITPY_STATUS_BAR +#include "supervisor/shared/status_bar.h" +#endif + // This standard advertisement advertises the CircuitPython editing service and a CIRCUITPY short name. const uint8_t public_advertising_data[] = { 0x02, 0x01, 0x06, // 0-2 Flags 0x02, 0x0a, 0xec, // 3-5 TX power level -20 @@ -75,18 +81,13 @@ const uint8_t public_advertising_data[] = { 0x02, 0x01, 0x06, // 0-2 Flags const uint8_t private_advertising_data[] = { 0x02, 0x01, 0x06, // 0-2 Flags 0x02, 0x0a, 0x00 // 3-5 TX power level 0 }; -// This scan response advertises the full CIRCPYXXXX device name. -uint8_t circuitpython_scan_response_data[] = { - 0x0a, 0x09, 0x43, 0x49, 0x52, 0x50, 0x59, 0x00, 0x00, 0x00, 0x00, - #if CIRCUITPY_SERIAL_BLE - 0x11, 0x06, 0x6e, 0x68, 0x74, 0x79, 0x50, 0x74, 0x69, 0x75, 0x63, 0x72, 0x69, 0x43, 0x01, 0x00, 0xaf, 0xad - #endif -}; - +// This scan response advertises the full device name (if it fits.) +uint8_t circuitpython_scan_response_data[31]; #if CIRCUITPY_BLE_FILE_SERVICE || CIRCUITPY_SERIAL_BLE STATIC bool boot_in_discovery_mode = false; STATIC bool advertising = false; +STATIC bool _private_advertising = false; STATIC bool ble_started = false; #define WORKFLOW_UNSET 0 @@ -96,6 +97,42 @@ STATIC bool ble_started = false; STATIC uint8_t workflow_state = WORKFLOW_UNSET; STATIC bool was_connected = false; +#if CIRCUITPY_STATUS_BAR +// To detect when the title bar changes. +STATIC bool _last_connected = false; +STATIC bool _last_advertising = false; +#endif + +#if CIRCUITPY_STATUS_BAR +// Title bar status +bool supervisor_bluetooth_status_dirty(void) { + return _last_advertising != advertising || + _last_connected != was_connected; +} +#endif + +#if CIRCUITPY_STATUS_BAR +void supervisor_bluetooth_status(void) { + serial_write("BLE:"); + if (advertising) { + if (_private_advertising) { + serial_write_compressed(translate("Reconnecting")); + } else { + const char *name = (char *)circuitpython_scan_response_data + 2; + int len = MIN(strlen(name), sizeof(circuitpython_scan_response_data) - 2); + serial_write_substring(name, len); + } + } else if (was_connected) { + serial_write_compressed(translate("Ok")); + } else { + serial_write_compressed(translate("Off")); + } + + _last_connected = was_connected; + _last_advertising = advertising; +} +#endif + STATIC void supervisor_bluetooth_start_advertising(void) { if (workflow_state != WORKFLOW_ENABLED) { return; @@ -118,6 +155,7 @@ STATIC void supervisor_bluetooth_start_advertising(void) { size_t adv_len = sizeof(private_advertising_data); const uint8_t *scan_response = NULL; size_t scan_response_len = 0; + _private_advertising = true; // Advertise with less power when doing so publicly to reduce who can hear us. This will make it // harder for someone with bad intentions to pair from a distance. if (!bonded) { @@ -126,6 +164,18 @@ STATIC void supervisor_bluetooth_start_advertising(void) { adv_len = sizeof(public_advertising_data); scan_response = circuitpython_scan_response_data; scan_response_len = sizeof(circuitpython_scan_response_data); + uint16_t max_name_len = sizeof(circuitpython_scan_response_data) - 2; + uint16_t name_len = bleio_adapter_get_name((char *)circuitpython_scan_response_data + 2, + max_name_len); + if (name_len > max_name_len) { + circuitpython_scan_response_data[0] = max_name_len + 1; + circuitpython_scan_response_data[1] = 0x8; + } else { + circuitpython_scan_response_data[0] = name_len + 1; + circuitpython_scan_response_data[1] = 0x9; + } + scan_response_len = circuitpython_scan_response_data[0] + 1; + _private_advertising = false; } uint32_t status = _common_hal_bleio_adapter_start_advertising(&common_hal_bleio_adapter_obj, true, @@ -232,10 +282,19 @@ void supervisor_bluetooth_background(void) { supervisor_bluetooth_file_transfer_disconnected(); #endif } + + #if CIRCUITPY_STATUS_BAR + if (was_connected != is_connected) { + supervisor_status_bar_request_update(false); + } + #endif + was_connected = is_connected; if (!is_connected) { supervisor_bluetooth_start_advertising(); return; + } else { + advertising = false; } #if CIRCUITPY_BLE_FILE_SERVICE @@ -247,7 +306,7 @@ void supervisor_bluetooth_background(void) { void supervisor_start_bluetooth(void) { #if CIRCUITPY_BLE_FILE_SERVICE || CIRCUITPY_SERIAL_BLE - if (workflow_state != WORKFLOW_ENABLED) { + if (workflow_state != WORKFLOW_ENABLED || ble_started) { return; } @@ -267,6 +326,10 @@ void supervisor_start_bluetooth(void) { // Kick off advertisements supervisor_bluetooth_background(); + #if CIRCUITPY_STATUS_BAR + supervisor_status_bar_request_update(false); + #endif + #endif } @@ -277,6 +340,8 @@ void supervisor_stop_bluetooth(void) { return; } + ble_started = false; + #if CIRCUITPY_SERIAL_BLE supervisor_stop_bluetooth_serial(); #endif @@ -289,7 +354,6 @@ void supervisor_bluetooth_enable_workflow(void) { if (workflow_state == WORKFLOW_DISABLED) { return; } - workflow_state = WORKFLOW_ENABLED; #endif } @@ -299,3 +363,12 @@ void supervisor_bluetooth_disable_workflow(void) { workflow_state = WORKFLOW_DISABLED; #endif } + +bool supervisor_bluetooth_workflow_is_enabled(void) { + #if CIRCUITPY_BLE_FILE_SERVICE || CIRCUITPY_SERIAL_BLE + if (workflow_state == 1) { + return true; + } + #endif + return false; +} diff --git a/supervisor/shared/bluetooth/bluetooth.h b/supervisor/shared/bluetooth/bluetooth.h index 9de82719a5..0028c8da33 100644 --- a/supervisor/shared/bluetooth/bluetooth.h +++ b/supervisor/shared/bluetooth/bluetooth.h @@ -37,5 +37,10 @@ void supervisor_stop_bluetooth(void); // Enable only works if it hasn't been set yet. void supervisor_bluetooth_enable_workflow(void); void supervisor_bluetooth_disable_workflow(void); +bool supervisor_bluetooth_workflow_is_enabled(void); + +// Title bar status +bool supervisor_bluetooth_status_dirty(void); +void supervisor_bluetooth_status(void); #endif // MICROPY_INCLUDED_SUPERVISOR_SHARED_BLUETOOTH_H diff --git a/supervisor/shared/bluetooth/file_transfer.c b/supervisor/shared/bluetooth/file_transfer.c index a6a2f8062a..159c639e4d 100644 --- a/supervisor/shared/bluetooth/file_transfer.c +++ b/supervisor/shared/bluetooth/file_transfer.c @@ -43,14 +43,15 @@ #include "common-hal/_bleio/__init__.h" #include "supervisor/fatfs_port.h" +#include "supervisor/filesystem.h" #include "supervisor/shared/reload.h" #include "supervisor/shared/bluetooth/file_transfer.h" #include "supervisor/shared/bluetooth/file_transfer_protocol.h" +#include "supervisor/shared/workflow.h" #include "supervisor/shared/tick.h" #include "supervisor/usb.h" #include "py/mpstate.h" -#include "py/stackctrl.h" STATIC bleio_service_obj_t supervisor_ble_service; STATIC bleio_uuid_obj_t supervisor_ble_service_uuid; @@ -172,7 +173,7 @@ STATIC uint8_t _process_read(const uint8_t *raw_buf, size_t command_len) { char *path = (char *)((uint8_t *)command) + header_size; path[command->path_length] = '\0'; - FATFS *fs = &((fs_user_mount_t *)MP_STATE_VM(vfs_mount_table)->obj)->fatfs; + FATFS *fs = filesystem_circuitpy(); FRESULT result = f_open(fs, &active_file, path, FA_READ); if (result != FR_OK) { response.status = STATUS_ERROR; @@ -289,7 +290,7 @@ STATIC uint8_t _process_write(const uint8_t *raw_buf, size_t command_len) { return ANY_COMMAND; } - FATFS *fs = &((fs_user_mount_t *)MP_STATE_VM(vfs_mount_table)->obj)->fatfs; + FATFS *fs = filesystem_circuitpy(); DWORD fattime; _truncated_time = truncate_time(command->modification_time, &fattime); override_fattime(fattime); @@ -386,39 +387,6 @@ STATIC uint8_t _process_write_data(const uint8_t *raw_buf, size_t command_len) { return WRITE_DATA; } -STATIC FRESULT _delete_directory_contents(FATFS *fs, const TCHAR *path) { - FF_DIR dir; - FRESULT res = f_opendir(fs, &dir, path); - FILINFO file_info; - // Check the stack since we're putting paths on it. - if (mp_stack_usage() >= MP_STATE_THREAD(stack_limit)) { - return FR_INT_ERR; - } - while (res == FR_OK) { - res = f_readdir(&dir, &file_info); - if (res != FR_OK || file_info.fname[0] == '\0') { - break; - } - size_t pathlen = strlen(path); - size_t fnlen = strlen(file_info.fname); - TCHAR full_path[pathlen + 1 + fnlen]; - memcpy(full_path, path, pathlen); - full_path[pathlen] = '/'; - size_t full_pathlen = pathlen + 1 + fnlen; - memcpy(full_path + pathlen + 1, file_info.fname, fnlen); - full_path[full_pathlen] = '\0'; - if ((file_info.fattrib & AM_DIR) != 0) { - res = _delete_directory_contents(fs, full_path); - } - if (res != FR_OK) { - break; - } - res = f_unlink(fs, full_path); - } - f_closedir(&dir); - return res; -} - STATIC uint8_t _process_delete(const uint8_t *raw_buf, size_t command_len) { const struct delete_command *command = (struct delete_command *)raw_buf; size_t header_size = sizeof(struct delete_command); @@ -438,14 +406,14 @@ STATIC uint8_t _process_delete(const uint8_t *raw_buf, size_t command_len) { if (command_len < header_size + command->path_length) { return THIS_COMMAND; } - FATFS *fs = &((fs_user_mount_t *)MP_STATE_VM(vfs_mount_table)->obj)->fatfs; + FATFS *fs = filesystem_circuitpy(); char *path = (char *)((uint8_t *)command) + header_size; path[command->path_length] = '\0'; FILINFO file; FRESULT result = f_stat(fs, path, &file); if (result == FR_OK) { if ((file.fattrib & AM_DIR) != 0) { - result = _delete_directory_contents(fs, path); + result = supervisor_workflow_delete_directory_contents(fs, path); } if (result == FR_OK) { result = f_unlink(fs, path); @@ -495,14 +463,14 @@ STATIC uint8_t _process_mkdir(const uint8_t *raw_buf, size_t command_len) { if (command_len < header_size + command->path_length) { return THIS_COMMAND; } - FATFS *fs = &((fs_user_mount_t *)MP_STATE_VM(vfs_mount_table)->obj)->fatfs; + FATFS *fs = filesystem_circuitpy(); char *path = (char *)command->path; _terminate_path(path, command->path_length); DWORD fattime; response.truncated_time = truncate_time(command->modification_time, &fattime); override_fattime(fattime); - FRESULT result = f_mkdir(fs, path); + FRESULT result = supervisor_workflow_mkdir_parents(fs, path); override_fattime(0); #if CIRCUITPY_USB_MSC usb_msc_unlock(); @@ -552,7 +520,7 @@ STATIC uint8_t _process_listdir(uint8_t *raw_buf, size_t command_len) { return THIS_COMMAND; } - FATFS *fs = &((fs_user_mount_t *)MP_STATE_VM(vfs_mount_table)->obj)->fatfs; + FATFS *fs = filesystem_circuitpy(); char *path = (char *)&command->path; _terminate_path(path, command->path_length); // mp_printf(&mp_plat_print, "list %s\n", path); @@ -640,7 +608,7 @@ STATIC uint8_t _process_move(const uint8_t *raw_buf, size_t command_len) { if (command_len < header_size + total_path_length) { return THIS_COMMAND; } - FATFS *fs = &((fs_user_mount_t *)MP_STATE_VM(vfs_mount_table)->obj)->fatfs; + FATFS *fs = filesystem_circuitpy(); char *old_path = (char *)command->paths; old_path[command->old_path_length] = '\0'; diff --git a/supervisor/shared/board.c b/supervisor/shared/board.c index 427c179242..2317540c1a 100644 --- a/supervisor/shared/board.c +++ b/supervisor/shared/board.c @@ -24,6 +24,7 @@ * THE SOFTWARE. */ +#include "supervisor/board.h" #include "supervisor/shared/board.h" #if CIRCUITPY_DIGITALIO && CIRCUITPY_NEOPIXEL_WRITE @@ -46,3 +47,20 @@ void board_reset_user_neopixels(const mcu_pin_obj_t *pin, size_t count) { } #endif + +// Do-nothing so not all boards need to provide this function. +MP_WEAK bool board_requests_safe_mode(void) { + return false; +} + +// Do-nothing so not all boards need to provide this function. +MP_WEAK void board_init(void) { +} + +// Do-nothing so not all boards need to provide this function. +MP_WEAK void board_deinit(void) { +} + +// Do-nothing so not all boards need to provide this function. +MP_WEAK void reset_board(void) { +} diff --git a/supervisor/shared/display.c b/supervisor/shared/display.c index a8a9b056f2..8ed2f5c17e 100644 --- a/supervisor/shared/display.c +++ b/supervisor/shared/display.c @@ -45,6 +45,10 @@ #include "shared-module/sharpdisplay/SharpMemoryFramebuffer.h" #endif +#if CIRCUITPY_STATUS_BAR +#include "supervisor/shared/status_bar.h" +#endif + #if CIRCUITPY_REPL_LOGO extern uint32_t blinka_bitmap_data[]; extern displayio_bitmap_t blinka_bitmap; @@ -61,37 +65,26 @@ void supervisor_start_terminal(uint16_t width_px, uint16_t height_px) { uint8_t scale = 2; #if CIRCUITPY_TERMINALIO - displayio_tilegrid_t *grid = &supervisor_terminal_text_grid; - bool tall = height_px > width_px; + displayio_tilegrid_t *scroll_area = &supervisor_terminal_scroll_area_text_grid; + displayio_tilegrid_t *status_bar = &supervisor_terminal_status_bar_text_grid; bool reset_tiles = false; - #if CIRCUITPY_REPL_LOGO - 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; - #else - uint16_t terminal_width_px = width_px; - uint16_t terminal_height_px = height_px; - #endif - uint16_t width_in_tiles = terminal_width_px / grid->tile_width; - // determine scale based on h - if (width_in_tiles < 80) { + uint16_t width_in_tiles = width_px / scroll_area->tile_width; + // determine scale based on width + if (width_in_tiles <= 80) { scale = 1; } - width_in_tiles = terminal_width_px / (grid->tile_width * scale); + width_in_tiles = width_px / (scroll_area->tile_width * scale); if (width_in_tiles < 1) { width_in_tiles = 1; } - 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; - } + uint16_t height_in_tiles = height_px / (scroll_area->tile_height * scale); uint16_t total_tiles = width_in_tiles * height_in_tiles; // check if the terminal tile dimensions are the same - if ((grid->width_in_tiles != width_in_tiles) || - (grid->height_in_tiles != height_in_tiles)) { + if ((scroll_area->width_in_tiles != width_in_tiles) || + (scroll_area->height_in_tiles != height_in_tiles - 1)) { reset_tiles = true; } // Reuse the previous allocation if possible @@ -114,27 +107,45 @@ void supervisor_start_terminal(uint16_t width_px, uint16_t height_px) { uint8_t *tiles = (uint8_t *)tilegrid_tiles->ptr; #if CIRCUITPY_REPL_LOGO - grid->y = tall ? blinka_bitmap.height : 0; - grid->x = tall ? 0 : blinka_bitmap.width; + status_bar->x = supervisor_blinka_sprite.pixel_width + 1; + // Align the status bar to the bottom of the logo. + status_bar->y = supervisor_blinka_sprite.pixel_height - status_bar->tile_height; #else - grid->y = 0; - grid->x = 0; + status_bar->x = 0; + status_bar->y = 0; #endif - grid->top_left_y = 0; - if (remaining_pixels > 0) { - grid->y -= (grid->tile_height - remaining_pixels); - } - grid->width_in_tiles = width_in_tiles; - grid->height_in_tiles = height_in_tiles; + status_bar->top_left_y = 0; + status_bar->width_in_tiles = width_in_tiles; + status_bar->height_in_tiles = 1; assert(width_in_tiles > 0); - assert(height_in_tiles > 0); - grid->pixel_width = width_in_tiles * grid->tile_width; - grid->pixel_height = height_in_tiles * grid->tile_height; - grid->tiles = tiles; + status_bar->pixel_width = width_in_tiles * status_bar->tile_width; + status_bar->pixel_height = status_bar->tile_height; + status_bar->tiles = tiles; + status_bar->full_change = true; - grid->full_change = true; + scroll_area->x = 0; + scroll_area->top_left_y = 0; + scroll_area->width_in_tiles = width_in_tiles; + scroll_area->height_in_tiles = height_in_tiles - 1; + assert(width_in_tiles > 0); + assert(height_in_tiles > 1); + scroll_area->pixel_width = width_in_tiles * scroll_area->tile_width; + scroll_area->pixel_height = (height_in_tiles - 1) * scroll_area->tile_height; + #if CIRCUITPY_REPL_LOGO + scroll_area->y = blinka_bitmap.height; + #else + scroll_area->y = status_bar->tile_height; + #endif + int16_t extra_height = (scroll_area->pixel_height + scroll_area->y) - (height_px / scale); + // Subtract extra height so that the bottom line fully shows. The top line will be under the + // title bar and Blinka logo. + scroll_area->y -= extra_height; + scroll_area->tiles = tiles + width_in_tiles; + scroll_area->full_change = true; - common_hal_terminalio_terminal_construct(&supervisor_terminal, grid, &supervisor_terminal_font); + common_hal_terminalio_terminal_construct(&supervisor_terminal, scroll_area, &supervisor_terminal_font, status_bar); + + // Do not update status bar until after boot.py has run, in case it is disabled. } #endif @@ -146,18 +157,24 @@ void supervisor_stop_terminal(void) { if (tilegrid_tiles != NULL) { free_memory(tilegrid_tiles); tilegrid_tiles = NULL; - supervisor_terminal_text_grid.tiles = NULL; - supervisor_terminal.tilegrid = NULL; + supervisor_terminal_scroll_area_text_grid.tiles = NULL; + supervisor_terminal_status_bar_text_grid.tiles = NULL; + supervisor_terminal.scroll_area = NULL; + supervisor_terminal.status_bar = NULL; } #endif } void supervisor_display_move_memory(void) { #if CIRCUITPY_TERMINALIO + displayio_tilegrid_t *scroll_area = &supervisor_terminal_scroll_area_text_grid; + displayio_tilegrid_t *status_bar = &supervisor_terminal_status_bar_text_grid; if (tilegrid_tiles != NULL) { - supervisor_terminal_text_grid.tiles = (uint8_t *)tilegrid_tiles->ptr; + status_bar->tiles = (uint8_t *)tilegrid_tiles->ptr; + scroll_area->tiles = (uint8_t *)tilegrid_tiles->ptr + scroll_area->width_in_tiles; } else { - supervisor_terminal_text_grid.tiles = NULL; + scroll_area->tiles = NULL; + status_bar->tiles = NULL; } #endif @@ -179,144 +196,27 @@ void supervisor_display_move_memory(void) { #endif } -#if CIRCUITPY_REPL_LOGO -uint32_t blinka_bitmap_data[32] = { - 0x00000011, 0x11000000, - 0x00000111, 0x53100000, - 0x00000111, 0x56110000, - 0x00000111, 0x11140000, - 0x00000111, 0x20002000, - 0x00000011, 0x13000000, - 0x00000001, 0x11200000, - 0x00000000, 0x11330000, - 0x00000000, 0x01122000, - 0x00001111, 0x44133000, - 0x00032323, 0x24112200, - 0x00111114, 0x44113300, - 0x00323232, 0x34112200, - 0x11111144, 0x44443300, - 0x11111111, 0x11144401, - 0x23232323, 0x21111110 -}; - -displayio_bitmap_t blinka_bitmap = { - .base = {.type = &displayio_bitmap_type }, - .width = 16, - .height = 16, - .data = blinka_bitmap_data, - .stride = 2, - .bits_per_value = 4, - .x_shift = 3, - .x_mask = 0x7, - .bitmask = 0xf, - .read_only = true -}; - -_displayio_color_t blinka_colors[7] = { - { - .rgb888 = 0x000000, - .rgb565 = 0x0000, - .luma = 0x00, - .chroma = 0, - .transparent = true - }, - { - .rgb888 = 0x8428bc, - .rgb565 = 0x8978, - .luma = 0xff, // We cheat the luma here. It is actually 0x60 - .hue = 184, - .chroma = 148 - }, - { - .rgb888 = 0xff89bc, - .rgb565 = 0xFCB8, - .luma = 0xb5, - .hue = 222, - .chroma = 118 - }, - { - .rgb888 = 0x7beffe, - .rgb565 = 0x869F, - .luma = 0xe0, - .hue = 124, - .chroma = 131 - }, - { - .rgb888 = 0x51395f, - .rgb565 = 0x5A0D, - .luma = 0x47, - .hue = 185, - .chroma = 38 - }, - { - .rgb888 = 0xffffff, - .rgb565 = 0xffff, - .luma = 0xff, - .chroma = 0 - }, - { - .rgb888 = 0x0736a0, - .rgb565 = 0x01f5, - .luma = 0x44, - .hue = 147, - .chroma = 153 - }, -}; - -displayio_palette_t blinka_palette = { - .base = {.type = &displayio_palette_type }, - .colors = blinka_colors, - .color_count = 7, - .needs_refresh = false -}; - -displayio_tilegrid_t blinka_sprite = { - .base = {.type = &displayio_tilegrid_type }, - .bitmap = &blinka_bitmap, - .pixel_shader = &blinka_palette, - .x = 0, - .y = 0, - .pixel_width = 16, - .pixel_height = 16, - .bitmap_width_in_tiles = 1, - .width_in_tiles = 1, - .height_in_tiles = 1, - .tile_width = 16, - .tile_height = 16, - .top_left_x = 16, - .top_left_y = 16, - .tiles = 0, - .partial_change = false, - .full_change = false, - .hidden = false, - .hidden_by_parent = false, - .moved = false, - .inline_tiles = true, - .in_group = true -}; -#endif - #if CIRCUITPY_TERMINALIO #if CIRCUITPY_REPL_LOGO -mp_obj_t members[] = { &blinka_sprite, &supervisor_terminal_text_grid, }; +mp_obj_t members[] = { &supervisor_terminal_scroll_area_text_grid, &supervisor_blinka_sprite, &supervisor_terminal_status_bar_text_grid, }; +mp_obj_list_t splash_children = { + .base = {.type = &mp_type_list }, + .alloc = 3, + .len = 3, + .items = members, +}; +#else +mp_obj_t members[] = { &supervisor_terminal_scroll_area_text_grid, &supervisor_terminal_status_bar_text_grid,}; mp_obj_list_t splash_children = { .base = {.type = &mp_type_list }, .alloc = 2, .len = 2, .items = members, }; -#else -mp_obj_t members[] = { &supervisor_terminal_text_grid, }; -mp_obj_list_t splash_children = { - .base = {.type = &mp_type_list }, - .alloc = 1, - .len = 1, - .items = members, -}; #endif #else #if CIRCUITPY_REPL_LOGO -mp_obj_t members[] = { &blinka_sprite }; +mp_obj_t members[] = { &supervisor_blinka_sprite }; mp_obj_list_t splash_children = { .base = {.type = &mp_type_list }, .alloc = 1, diff --git a/supervisor/shared/display.h b/supervisor/shared/display.h index 4110cfe8e4..fcaab10818 100644 --- a/supervisor/shared/display.h +++ b/supervisor/shared/display.h @@ -29,10 +29,11 @@ #include +#include "shared-bindings/displayio/TileGrid.h" + #if CIRCUITPY_TERMINALIO #include "shared-bindings/displayio/Bitmap.h" -#include "shared-bindings/displayio/TileGrid.h" #include "shared-bindings/fontio/BuiltinFont.h" #include "shared-bindings/terminalio/Terminal.h" @@ -43,11 +44,14 @@ extern const fontio_builtinfont_t supervisor_terminal_font; // These will change so they must live in RAM. extern displayio_bitmap_t supervisor_terminal_font_bitmap; -extern displayio_tilegrid_t supervisor_terminal_text_grid; +extern displayio_tilegrid_t supervisor_terminal_scroll_area_text_grid; +extern displayio_tilegrid_t supervisor_terminal_status_bar_text_grid; extern terminalio_terminal_obj_t supervisor_terminal; - #endif +// Always shown. +extern displayio_tilegrid_t supervisor_blinka_sprite; + void supervisor_start_terminal(uint16_t width_px, uint16_t height_px); void supervisor_stop_terminal(void); diff --git a/supervisor/shared/filesystem.c b/supervisor/shared/filesystem.c index 820dbe9783..283849adc3 100644 --- a/supervisor/shared/filesystem.c +++ b/supervisor/shared/filesystem.c @@ -92,6 +92,9 @@ bool filesystem_init(bool create_allowed, bool force_create) { vfs_fat->blockdev.flags = 0; supervisor_flash_init_vfs(vfs_fat); + mp_vfs_mount_t *vfs = &_mp_vfs; + vfs->len = 0; + // try to mount the flash FRESULT res = f_mount(&vfs_fat->fatfs); if ((res == FR_NO_FILESYSTEM && create_allowed) || force_create) { @@ -140,7 +143,6 @@ bool filesystem_init(bool create_allowed, bool force_create) { } else if (res != FR_OK) { return false; } - mp_vfs_mount_t *vfs = &_mp_vfs; vfs->str = "/"; vfs->len = 1; vfs->obj = MP_OBJ_FROM_PTR(vfs_fat); @@ -199,5 +201,12 @@ void filesystem_set_concurrent_write_protection(fs_user_mount_t *vfs, bool concu } bool filesystem_present(void) { - return true; + return _mp_vfs.len > 0; +} + +FATFS *filesystem_circuitpy(void) { + if (!filesystem_present()) { + return NULL; + } + return &_internal_vfs.fatfs; } diff --git a/supervisor/shared/memory.c b/supervisor/shared/memory.c index ff0382fc17..06c568b42e 100644 --- a/supervisor/shared/memory.c +++ b/supervisor/shared/memory.c @@ -56,6 +56,8 @@ enum { #if CIRCUITPY_USB_VENDOR + 1 // usb_vendor_add_descriptor #endif + + + CIRCUITPY_PORT_NUM_SUPERVISOR_ALLOCATIONS , CIRCUITPY_SUPERVISOR_MOVABLE_ALLOC_COUNT = diff --git a/supervisor/shared/port.c b/supervisor/shared/port.c new file mode 100644 index 0000000000..4070cf254e --- /dev/null +++ b/supervisor/shared/port.c @@ -0,0 +1,39 @@ +/* + * This file is part of the MicroPython project, http://micropython.org/ + * + * The MIT License (MIT) + * + * Copyright (c) 2022 Scott Shawcroft for Adafruit Industries + * + * Permission is hereby granted, free of charge, to any person obtaining a copy + * of this software and associated documentation files (the "Software"), to deal + * in the Software without restriction, including without limitation the rights + * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell + * copies of the Software, and to permit persons to whom the Software is + * furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice shall be included in + * all copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE + * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER + * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, + * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN + * THE SOFTWARE. + */ + +#include "supervisor/port.h" + +MP_WEAK void port_wake_main_task(void) { +} + +MP_WEAK void port_wake_main_task_from_isr(void) { +} + +MP_WEAK void port_yield(void) { +} + +MP_WEAK void port_boot_info(void) { +} diff --git a/supervisor/shared/reload.h b/supervisor/shared/reload.h index cb3385e7ca..fb5e04961a 100644 --- a/supervisor/shared/reload.h +++ b/supervisor/shared/reload.h @@ -43,7 +43,8 @@ enum { enum { AUTORELOAD_SUSPEND_REPL = 0x1, AUTORELOAD_SUSPEND_BLE = 0x2, - AUTORELOAD_SUSPEND_USB = 0x4 + AUTORELOAD_SUSPEND_USB = 0x4, + AUTORELOAD_SUSPEND_WEB = 0x8 }; typedef struct { diff --git a/supervisor/shared/safe_mode.c b/supervisor/shared/safe_mode.c index 7922cffc2b..aefae1e48b 100644 --- a/supervisor/shared/safe_mode.c +++ b/supervisor/shared/safe_mode.c @@ -37,7 +37,7 @@ #include "supervisor/serial.h" #include "supervisor/shared/rgb_led_colors.h" #include "supervisor/shared/status_leds.h" -#include "supervisor/shared/translate.h" +#include "supervisor/shared/translate/translate.h" #include "supervisor/shared/tick.h" #define SAFE_MODE_DATA_GUARD 0xad0000af @@ -178,7 +178,7 @@ void print_safe_mode_message(safe_mode_t reason) { message = translate("Boot device must be first device (interface #0)."); break; case WATCHDOG_RESET: - message = translate("Watchdog timer expired."); + message = translate("Internal watchdog timer expired."); break; case NO_CIRCUITPY: message = translate("CIRCUITPY drive could not be found or created."); diff --git a/supervisor/shared/serial.c b/supervisor/shared/serial.c index af90fce4d7..0326f15437 100644 --- a/supervisor/shared/serial.c +++ b/supervisor/shared/serial.c @@ -45,42 +45,53 @@ #include "tusb.h" #endif -/* - * Note: DEBUG_UART currently only works on STM32 and nRF. - * Enabling on another platform will cause a crash. - */ +#if CIRCUITPY_WEB_WORKFLOW +#include "supervisor/shared/web_workflow/websocket.h" +#endif -#if defined(CIRCUITPY_DEBUG_UART_TX) || defined(CIRCUITPY_DEBUG_UART_RX) +#if CIRCUITPY_CONSOLE_UART #include "py/mpprint.h" #include "shared-bindings/busio/UART.h" -busio_uart_obj_t debug_uart; -byte buf_array[64]; + +busio_uart_obj_t console_uart; +// on Espressif, the receive buffer must be larger than the hardware FIFO length. See uart_driver_install(). +#if defined(SOC_UART_FIFO_LEN) +byte console_uart_rx_buf[SOC_UART_FIFO_LEN + 1]; +#else +byte console_uart_rx_buf[64]; +#endif #endif #if CIRCUITPY_USB_VENDOR bool tud_vendor_connected(void); #endif -#if defined(CIRCUITPY_DEBUG_UART_TX) -STATIC void debug_uart_print_strn(void *env, const char *str, size_t len) { +// Set to true to temporarily discard writes to the console only. +static bool _serial_console_write_disabled; + +// Set to true to temporarily discard writes to the display terminal only. +static bool _serial_display_write_disabled; + +#if CIRCUITPY_CONSOLE_UART +STATIC void console_uart_print_strn(void *env, const char *str, size_t len) { (void)env; int uart_errcode; - common_hal_busio_uart_write(&debug_uart, (const uint8_t *)str, len, &uart_errcode); + common_hal_busio_uart_write(&console_uart, (const uint8_t *)str, len, &uart_errcode); } -const mp_print_t debug_uart_print = {NULL, debug_uart_print_strn}; +const mp_print_t console_uart_print = {NULL, console_uart_print_strn}; #endif -int debug_uart_printf(const char *fmt, ...) { - #if defined(CIRCUITPY_DEBUG_UART_TX) - // Skip prints that occur before debug serial is started. It's better than +int console_uart_printf(const char *fmt, ...) { + #if CIRCUITPY_CONSOLE_UART + // Skip prints that occur before console serial is started. It's better than // crashing. - if (common_hal_busio_uart_deinited(&debug_uart)) { + if (common_hal_busio_uart_deinited(&console_uart)) { return 0; } va_list ap; va_start(ap, fmt); - int ret = mp_vprintf(&debug_uart_print, fmt, ap); + int ret = mp_vprintf(&console_uart_print, fmt, ap); va_end(ap); return ret; #else @@ -88,6 +99,9 @@ int debug_uart_printf(const char *fmt, ...) { #endif } +MP_WEAK void port_serial_early_init(void) { +} + MP_WEAK void port_serial_init(void) { } @@ -109,29 +123,24 @@ MP_WEAK void port_serial_write_substring(const char *text, uint32_t length) { } void serial_early_init(void) { - #if defined(CIRCUITPY_DEBUG_UART_TX) || defined(CIRCUITPY_DEBUG_UART_RX) - debug_uart.base.type = &busio_uart_type; + // Set up console UART, if enabled. - #if defined(CIRCUITPY_DEBUG_UART_RX) - const mcu_pin_obj_t *rx = MP_OBJ_TO_PTR(CIRCUITPY_DEBUG_UART_RX); - #else - const mcu_pin_obj_t *rx = NULL; - #endif + #if CIRCUITPY_CONSOLE_UART + console_uart.base.type = &busio_uart_type; - #if defined(CIRCUITPY_DEBUG_UART_TX) - const mcu_pin_obj_t *tx = MP_OBJ_TO_PTR(CIRCUITPY_DEBUG_UART_TX); - #else - const mcu_pin_obj_t *tx = NULL; - #endif + const mcu_pin_obj_t *console_rx = MP_OBJ_TO_PTR(CIRCUITPY_CONSOLE_UART_RX); + const mcu_pin_obj_t *console_tx = MP_OBJ_TO_PTR(CIRCUITPY_CONSOLE_UART_TX); - common_hal_busio_uart_construct(&debug_uart, tx, rx, NULL, NULL, NULL, - false, 115200, 8, BUSIO_UART_PARITY_NONE, 1, 1.0f, 64, - buf_array, true); - common_hal_busio_uart_never_reset(&debug_uart); + common_hal_busio_uart_construct(&console_uart, console_tx, console_rx, NULL, NULL, NULL, + false, 115200, 8, BUSIO_UART_PARITY_NONE, 1, 1.0f, sizeof(console_uart_rx_buf), + console_uart_rx_buf, true); + common_hal_busio_uart_never_reset(&console_uart); // Do an initial print so that we can confirm the serial output is working. - debug_uart_printf("Serial debug setup\r\n"); + console_uart_printf("Serial console setup\r\n"); #endif + + port_serial_early_init(); } void serial_init(void) { @@ -145,7 +154,7 @@ bool serial_connected(void) { } #endif - #if defined(CIRCUITPY_DEBUG_UART_TX) && defined(CIRCUITPY_DEBUG_UART_RX) + #if CIRCUITPY_CONSOLE_UART return true; #endif @@ -165,6 +174,13 @@ bool serial_connected(void) { } #endif + #if CIRCUITPY_WEB_WORKFLOW + if (websocket_connected()) { + return true; + } + #endif + + if (port_serial_connected()) { return true; } @@ -180,11 +196,11 @@ char serial_read(void) { } #endif - #if defined(CIRCUITPY_DEBUG_UART_RX) - if (common_hal_busio_uart_rx_characters_available(&debug_uart)) { + #if CIRCUITPY_CONSOLE_UART + if (common_hal_busio_uart_rx_characters_available(&console_uart)) { int uart_errcode; char text; - common_hal_busio_uart_read(&debug_uart, (uint8_t *)&text, 1, &uart_errcode); + common_hal_busio_uart_read(&console_uart, (uint8_t *)&text, 1, &uart_errcode); return text; } #endif @@ -195,6 +211,19 @@ char serial_read(void) { } #endif + #if CIRCUITPY_WEB_WORKFLOW + if (websocket_available()) { + char c = websocket_read_char(); + if (c != -1) { + return c; + } + } + #endif + + if (port_serial_bytes_available() > 0) { + return port_serial_read(); + } + #if CIRCUITPY_USB_CDC if (!usb_cdc_console_enabled()) { return -1; @@ -204,9 +233,6 @@ char serial_read(void) { return (char)tud_cdc_read_char(); #endif - if (port_serial_bytes_available() > 0) { - return port_serial_read(); - } return -1; } @@ -217,8 +243,8 @@ bool serial_bytes_available(void) { } #endif - #if defined(CIRCUITPY_DEBUG_UART_RX) - if (common_hal_busio_uart_rx_characters_available(&debug_uart)) { + #if CIRCUITPY_CONSOLE_UART + if (common_hal_busio_uart_rx_characters_available(&console_uart)) { return true; } #endif @@ -229,6 +255,12 @@ bool serial_bytes_available(void) { } #endif + #if CIRCUITPY_WEB_WORKFLOW + if (websocket_available()) { + return true; + } + #endif + #if CIRCUITPY_USB_CDC if (usb_cdc_console_enabled() && tud_cdc_available() > 0) { return true; @@ -250,27 +282,38 @@ void serial_write_substring(const char *text, uint32_t length) { if (length == 0) { return; } + #if CIRCUITPY_TERMINALIO int errcode; - common_hal_terminalio_terminal_write(&supervisor_terminal, (const uint8_t *)text, length, &errcode); + if (!_serial_display_write_disabled) { + common_hal_terminalio_terminal_write(&supervisor_terminal, (const uint8_t *)text, length, &errcode); + } #endif + if (_serial_console_write_disabled) { + return; + } + #if CIRCUITPY_USB_VENDOR if (tud_vendor_connected()) { tud_vendor_write(text, length); } #endif - #if defined(CIRCUITPY_DEBUG_UART_TX) + #if CIRCUITPY_CONSOLE_UART int uart_errcode; - common_hal_busio_uart_write(&debug_uart, (const uint8_t *)text, length, &uart_errcode); + common_hal_busio_uart_write(&console_uart, (const uint8_t *)text, length, &uart_errcode); #endif #if CIRCUITPY_SERIAL_BLE ble_serial_write(text, length); #endif + #if CIRCUITPY_WEB_WORKFLOW + websocket_write(text, length); + #endif + #if CIRCUITPY_USB_CDC if (!usb_cdc_console_enabled()) { return; @@ -279,13 +322,15 @@ void serial_write_substring(const char *text, uint32_t length) { #if CIRCUITPY_USB uint32_t count = 0; - while (count < length && tud_cdc_connected()) { - count += tud_cdc_write(text + count, length - count); - // If we're in an interrupt, then don't wait for more room. Queue up what we can. - if (cpu_interrupt_active()) { - break; + if (tud_cdc_connected()) { + while (count < length) { + count += tud_cdc_write(text + count, length - count); + // If we're in an interrupt, then don't wait for more room. Queue up what we can. + if (cpu_interrupt_active()) { + break; + } + usb_background(); } - usb_background(); } #endif @@ -295,3 +340,15 @@ void serial_write_substring(const char *text, uint32_t length) { void serial_write(const char *text) { serial_write_substring(text, strlen(text)); } + +bool serial_console_write_disable(bool disabled) { + bool now = _serial_console_write_disabled; + _serial_console_write_disabled = disabled; + return now; +} + +bool serial_display_write_disable(bool disabled) { + bool now = _serial_display_write_disabled; + _serial_display_write_disabled = disabled; + return now; +} diff --git a/supervisor/shared/stack.c b/supervisor/shared/stack.c index d2188e016d..fa8d019fea 100644 --- a/supervisor/shared/stack.c +++ b/supervisor/shared/stack.c @@ -107,6 +107,10 @@ void set_next_stack_size(uint32_t size) { next_stack_size = size; } +uint32_t get_next_stack_size(void) { + return next_stack_size; +} + uint32_t get_current_stack_size(void) { return current_stack_size; } diff --git a/supervisor/shared/stack.h b/supervisor/shared/stack.h index 98cc5a1685..4acda57354 100644 --- a/supervisor/shared/stack.h +++ b/supervisor/shared/stack.h @@ -38,6 +38,7 @@ uint32_t *stack_get_bottom(void); size_t stack_get_length(void); // Next/current requested stack size. void set_next_stack_size(uint32_t size); +uint32_t get_next_stack_size(void); uint32_t get_current_stack_size(void); bool stack_ok(void); diff --git a/supervisor/shared/status_bar.c b/supervisor/shared/status_bar.c new file mode 100644 index 0000000000..4f5fa06464 --- /dev/null +++ b/supervisor/shared/status_bar.c @@ -0,0 +1,168 @@ +/* + * This file is part of the MicroPython project, http://micropython.org/ + * + * The MIT License (MIT) + * + * Copyright (c) 2022 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 +#include "genhdr/mpversion.h" +#include "py/mpconfig.h" +#include "shared-bindings/supervisor/__init__.h" +#include "shared-bindings/supervisor/StatusBar.h" +#include "supervisor/background_callback.h" +#include "supervisor/serial.h" +#include "supervisor/shared/status_bar.h" + +#if CIRCUITPY_TERMINALIO +#include "shared-module/terminalio/Terminal.h" +#endif + +#if CIRCUITPY_WEB_WORKFLOW +#include "supervisor/shared/web_workflow/web_workflow.h" +#endif + +#if CIRCUITPY_BLE_FILE_SERVICE || CIRCUITPY_SERIAL_BLE +#include "supervisor/shared/bluetooth/bluetooth.h" +#endif + +static background_callback_t status_bar_background_cb; + +static bool _forced_dirty = false; +static bool _suspended = false; + +// Clear if possible, but give up if we can't do it now. +void supervisor_status_bar_clear(void) { + if (!_suspended) { + serial_write("\x1b" "]0;" "\x1b" "\\"); + } +} + +void supervisor_status_bar_update(void) { + if (_suspended) { + supervisor_status_bar_request_update(true); + return; + } + _forced_dirty = false; + + shared_module_supervisor_status_bar_updated(&shared_module_supervisor_status_bar_obj); + + // Disable status bar console writes if supervisor.status_bar.console is False. + // Also disable if there is no serial connection now. This avoids sending part + // of the status bar update if the serial connection comes up during the update. + bool disable_console_writes = + !shared_module_supervisor_status_bar_get_console(&shared_module_supervisor_status_bar_obj) || + !serial_connected(); + + // Disable status bar display writes if supervisor.status_bar.display is False. + bool disable_display_writes = + !shared_module_supervisor_status_bar_get_display(&shared_module_supervisor_status_bar_obj); + + // Suppress writes to console and/or display if status bar is not enabled for either or both. + bool prev_console_disable; + bool prev_display_disable; + + if (disable_console_writes) { + prev_console_disable = serial_console_write_disable(true); + } + if (disable_display_writes) { + prev_display_disable = serial_display_write_disable(true); + } + + // Neighboring "..." "..." are concatenated by the compiler. Without this separation, the hex code + // doesn't get terminated after two following characters and the value is invalid. + // This is the OSC command to set the title and the icon text. It can be up to 255 characters + // but some may be cut off. + serial_write("\x1b" "]0;"); + serial_write("🐍"); + + #if CIRCUITPY_WEB_WORKFLOW + supervisor_web_workflow_status(); + serial_write(" | "); + #endif + + #if CIRCUITPY_BLE_FILE_SERVICE || CIRCUITPY_SERIAL_BLE + supervisor_bluetooth_status(); + serial_write(" | "); + #endif + + supervisor_execution_status(); + serial_write(" | "); + serial_write(MICROPY_GIT_TAG); + // Send string terminator + serial_write("\x1b" "\\"); + + // Restore writes to console and/or display. + if (disable_console_writes) { + serial_console_write_disable(prev_console_disable); + } + if (disable_display_writes) { + serial_display_write_disable(prev_display_disable); + } + +} + +static void status_bar_background(void *data) { + if (_suspended) { + return; + } + bool dirty = _forced_dirty; + + #if CIRCUITPY_WEB_WORKFLOW + dirty = dirty || supervisor_web_workflow_status_dirty(); + #endif + + #if CIRCUITPY_BLE_FILE_SERVICE || CIRCUITPY_SERIAL_BLE + dirty = dirty || supervisor_bluetooth_status_dirty(); + #endif + + if (dirty) { + supervisor_status_bar_update(); + } +} + +void supervisor_status_bar_start(void) { + supervisor_status_bar_request_update(true); +} + +void supervisor_status_bar_request_update(bool force_dirty) { + if (force_dirty) { + _forced_dirty = true; + } + background_callback_add_core(&status_bar_background_cb); +} + +void supervisor_status_bar_suspend(void) { + _suspended = true; +} + +void supervisor_status_bar_resume(void) { + _suspended = false; + supervisor_status_bar_request_update(false); +} + +void supervisor_status_bar_init(void) { + status_bar_background_cb.fun = status_bar_background; + status_bar_background_cb.data = NULL; + + shared_module_supervisor_status_bar_init(&shared_module_supervisor_status_bar_obj); +} diff --git a/supervisor/shared/status_bar.h b/supervisor/shared/status_bar.h new file mode 100644 index 0000000000..062012b545 --- /dev/null +++ b/supervisor/shared/status_bar.h @@ -0,0 +1,48 @@ +/* + * This file is part of the MicroPython project, http://micropython.org/ + * + * The MIT License (MIT) + * + * Copyright (c) 2022 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. + */ + +#pragma once + +#include + +void supervisor_status_bar_init(void); + +void supervisor_status_bar_start(void); +void supervisor_status_bar_suspend(void); +void supervisor_status_bar_resume(void); + +void supervisor_status_bar_clear(void); + +// Update the title bar immediately. Useful from main.c where we know state has changed and the code +// will only be run once. +void supervisor_status_bar_update(void); + +// Use this if requesting from the background, as code is executing or if the status may not have +// changed. +void supervisor_status_bar_request_update(bool force_dirty); + +// Provided by main.c +void supervisor_execution_status(void); diff --git a/supervisor/shared/status_leds.c b/supervisor/shared/status_leds.c index 07ff9634e9..315e64a9a0 100644 --- a/supervisor/shared/status_leds.c +++ b/supervisor/shared/status_leds.c @@ -330,6 +330,14 @@ void set_status_brightness(uint8_t level) { #endif } +uint8_t get_status_brightness(void) { + #if CIRCUITPY_STATUS_LED + return rgb_status_brightness; + #else + return 0; + #endif +} + void init_rxtx_leds(void) { #if CIRCUITPY_DIGITALIO && defined(MICROPY_HW_LED_RX) common_hal_digitalio_digitalinout_construct(&rx_led, MICROPY_HW_LED_RX); diff --git a/supervisor/shared/status_leds.h b/supervisor/shared/status_leds.h index 99aa0277d6..d065b96d4a 100644 --- a/supervisor/shared/status_leds.h +++ b/supervisor/shared/status_leds.h @@ -53,6 +53,7 @@ void new_status_color(uint32_t rgb); uint32_t color_brightness(uint32_t color, uint8_t brightness); void set_status_brightness(uint8_t level); +uint8_t get_status_brightness(void); void init_rxtx_leds(void); void deinit_rxtx_leds(void); diff --git a/supervisor/shared/tick.c b/supervisor/shared/tick.c index 104083fb20..429ca35d60 100644 --- a/supervisor/shared/tick.c +++ b/supervisor/shared/tick.c @@ -44,10 +44,6 @@ #include "shared-module/displayio/__init__.h" #endif -#if CIRCUITPY_GAMEPADSHIFT -#include "shared-module/gamepadshift/__init__.h" -#endif - #if CIRCUITPY_KEYPAD #include "shared-module/keypad/__init__.h" #endif @@ -102,13 +98,6 @@ void supervisor_tick(void) { filesystem_tick(); #endif - #ifdef CIRCUITPY_GAMEPAD_TICKS - if (!(port_get_raw_ticks(NULL) & CIRCUITPY_GAMEPAD_TICKS)) { - #if CIRCUITPY_GAMEPADSHIFT - gamepadshift_tick(); - #endif - } - #endif #if CIRCUITPY_KEYPAD keypad_tick(); diff --git a/supervisor/shared/translate.h b/supervisor/shared/translate/compressed_string.h similarity index 90% rename from supervisor/shared/translate.h rename to supervisor/shared/translate/compressed_string.h index da58e1eb78..e331a5866f 100644 --- a/supervisor/shared/translate.h +++ b/supervisor/shared/translate/compressed_string.h @@ -24,10 +24,11 @@ * THE SOFTWARE. */ -#ifndef MICROPY_INCLUDED_SUPERVISOR_TRANSLATE_H -#define MICROPY_INCLUDED_SUPERVISOR_TRANSLATE_H +#pragma once +#include #include +#include // The format of the compressed data is: // - the size of the uncompressed string in UTF-8 bytes, encoded as a @@ -77,17 +78,7 @@ typedef struct compressed_string { // Return the compressed, translated version of a source string // Usually, due to LTO, this is optimized into a load of a constant // pointer. -const compressed_string_t *translate(const char *c); +// const compressed_string_t *translate(const char *c); void serial_write_compressed(const compressed_string_t *compressed); char *decompress(const compressed_string_t *compressed, char *decompressed); uint16_t decompress_length(const compressed_string_t *compressed); - - -// Map MicroPython's error messages to our translations. -#if defined(MICROPY_ENABLE_DYNRUNTIME) && MICROPY_ENABLE_DYNRUNTIME -#define MP_ERROR_TEXT(x) (x) -#else -#define MP_ERROR_TEXT(x) translate(x) -#endif - -#endif // MICROPY_INCLUDED_SUPERVISOR_TRANSLATE_H diff --git a/supervisor/shared/translate.c b/supervisor/shared/translate/translate.c similarity index 88% rename from supervisor/shared/translate.c rename to supervisor/shared/translate/translate.c index fefda46006..ae6c7524e5 100644 --- a/supervisor/shared/translate.c +++ b/supervisor/shared/translate/translate.c @@ -24,7 +24,7 @@ * THE SOFTWARE. */ -#include "supervisor/shared/translate.h" +#include "supervisor/shared/translate/translate.h" #include #include @@ -135,18 +135,6 @@ char *decompress(const compressed_string_t *compressed, char *decompressed) { return decompressed; } -inline -// gcc10 -flto has issues with this being always_inline for debug builds. -#if CIRCUITPY_DEBUG < 1 -__attribute__((always_inline)) +#if CIRCUITPY_TRANSLATE_OBJECT == 1 +#include "supervisor/shared/translate/translate_impl.h" #endif -const compressed_string_t *translate(const char *original) { - #ifndef NO_QSTR - #define QDEF(id, hash, len, str) - #define TRANSLATION(id, firstbyte, ...) if (strcmp(original, id) == 0) { static const compressed_string_t v = { .data = firstbyte, .tail = { __VA_ARGS__ } }; return &v; } else - #include "genhdr/qstrdefs.generated.h" -#undef TRANSLATION -#undef QDEF - #endif - return NULL; -} diff --git a/shared-module/gamepadshift/GamePadShift.c b/supervisor/shared/translate/translate.h similarity index 52% rename from shared-module/gamepadshift/GamePadShift.c rename to supervisor/shared/translate/translate.h index 0fb7d1e8d3..8bb343cabe 100644 --- a/shared-module/gamepadshift/GamePadShift.c +++ b/supervisor/shared/translate/translate.h @@ -3,7 +3,7 @@ * * The MIT License (MIT) * - * Copyright (c) 2016 Radomir Dopieralski for Adafruit Industries + * 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 @@ -24,29 +24,32 @@ * THE SOFTWARE. */ -#include "py/mpstate.h" -#include "shared-bindings/digitalio/DigitalInOut.h" -#include "shared-bindings/gamepadshift/GamePadShift.h" -#include "shared-module/gamepadshift/GamePadShift.h" -#include "supervisor/shared/tick.h" +#pragma once -void common_hal_gamepadshift_gamepadshift_init(gamepadshift_obj_t *gamepadshift, - digitalio_digitalinout_obj_t *clock_pin, - digitalio_digitalinout_obj_t *data_pin, - digitalio_digitalinout_obj_t *latch_pin) { - common_hal_digitalio_digitalinout_switch_to_input(data_pin, PULL_NONE); - gamepadshift->data_pin = data_pin; - common_hal_digitalio_digitalinout_switch_to_output(clock_pin, 0, - DRIVE_MODE_PUSH_PULL); - gamepadshift->clock_pin = clock_pin; - common_hal_digitalio_digitalinout_switch_to_output(latch_pin, 1, - DRIVE_MODE_PUSH_PULL); - gamepadshift->latch_pin = latch_pin; +#include +#include +#include - gamepadshift->last = 0; -} +#include "supervisor/shared/translate/compressed_string.h" -void common_hal_gamepadshift_gamepadshift_deinit(gamepadshift_obj_t *gamepadshift) { - MP_STATE_VM(gamepad_singleton) = NULL; - supervisor_disable_tick(); -} +// Map MicroPython's error messages to our translations. +#if defined(MICROPY_ENABLE_DYNRUNTIME) && MICROPY_ENABLE_DYNRUNTIME +#define MP_ERROR_TEXT(x) (x) +#else +#define MP_ERROR_TEXT(x) translate(x) +#endif + +// translate() is a giant function with many strcmp calls. The assumption is +// that the build process will optimize this away and replace it with the +// appropriate compressed data for each call site. + +#if CIRCUITPY_TRANSLATE_OBJECT == 0 +// Without LTO, we need to include a copy of this function in each compilation +// unit so that the compile stage can do the optimization. Otherwise the linker +// will leave this as a giant function and have each call site call into it. +#include "supervisor/shared/translate/translate_impl.h" +#else +// In link time optimized (LTO) builds, we can compile this once into a .o and +// at link time the calls will be optimized. +const compressed_string_t *translate(const char *c); +#endif diff --git a/supervisor/shared/translate/translate_impl.h b/supervisor/shared/translate/translate_impl.h new file mode 100644 index 0000000000..1c144197cb --- /dev/null +++ b/supervisor/shared/translate/translate_impl.h @@ -0,0 +1,60 @@ +/* + * 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. + */ + +#pragma once + +#include +#include +#include + +#include "supervisor/shared/translate/compressed_string.h" + +#ifndef NO_QSTR +#define QDEF(id, hash, len, str) +#define TRANSLATION(english_id, number) extern compressed_string_t translation##number; +#include "genhdr/qstrdefs.generated.h" +#undef TRANSLATION +#undef QDEF +#endif + +#if CIRCUITPY_TRANSLATE_OBJECT == 0 +static +#endif +inline +// gcc10 -flto has issues with this being always_inline for debug builds. +#if !CIRCUITPY_LTO || CIRCUITPY_DEBUG < 1 +__attribute__((always_inline)) +#endif +const compressed_string_t *translate(const char *original) { + #ifndef NO_QSTR + #define QDEF(id, hash, len, str) + #define TRANSLATION(english_id, number) if (strcmp(original, english_id) == 0) { return &translation##number; } else + #include "genhdr/qstrdefs.generated.h" +#undef TRANSLATION +#undef QDEF + #endif + return NULL; +} diff --git a/supervisor/shared/usb/tusb_config.h b/supervisor/shared/usb/tusb_config.h index 13b4367f47..c2ad1362a3 100644 --- a/supervisor/shared/usb/tusb_config.h +++ b/supervisor/shared/usb/tusb_config.h @@ -48,8 +48,8 @@ extern "C" { // COMMON CONFIGURATION // --------------------------------------------------------------------+ -// When debugging TinyUSB, only output to the UART debug link. -#if CIRCUITPY_DEBUG_TINYUSB > 0 && defined(CIRCUITPY_DEBUG_UART_TX) +// When debugging TinyUSB, only output to the console UART link. +#if CIRCUITPY_DEBUG_TINYUSB > 0 && defined(CIRCUITPY_CONSOLE_UART) #define CFG_TUSB_DEBUG CIRCUITPY_DEBUG_TINYUSB #define CFG_TUSB_DEBUG_PRINTF debug_uart_printf #endif diff --git a/supervisor/shared/usb/usb.c b/supervisor/shared/usb/usb.c index a1885448de..a51c6c2659 100644 --- a/supervisor/shared/usb/usb.c +++ b/supervisor/shared/usb/usb.c @@ -35,6 +35,10 @@ #include "shared/runtime/interrupt_char.h" #include "shared/readline/readline.h" +#if CIRCUITPY_STATUS_BAR +#include "supervisor/shared/status_bar.h" +#endif + #if CIRCUITPY_STORAGE #include "shared-module/storage/__init__.h" #endif @@ -118,9 +122,13 @@ void usb_set_defaults(void) { #endif }; +#if CIRCUITPY_USB_IDENTIFICATION +supervisor_allocation *usb_identification_allocation; +#endif + // Some dynamic USB data must be saved after boot.py. How much is needed? size_t usb_boot_py_data_size(void) { - size_t size = 0; + size_t size = sizeof(usb_identification_t); #if CIRCUITPY_USB_HID size += usb_hid_report_descriptor_length(); @@ -131,6 +139,28 @@ size_t usb_boot_py_data_size(void) { // Fill in the data to save. void usb_get_boot_py_data(uint8_t *temp_storage, size_t temp_storage_size) { + #if CIRCUITPY_USB_IDENTIFICATION + if (usb_identification_allocation) { + memcpy(temp_storage, usb_identification_allocation->ptr, sizeof(usb_identification_t)); + free_memory(usb_identification_allocation); + } + #else + if (false) { + } + #endif + else { + usb_identification_t defaults; + // This compiles to less code than using a struct initializer. + defaults.vid = USB_VID; + defaults.pid = USB_PID; + strcpy(defaults.manufacturer_name, USB_MANUFACTURER); + strcpy(defaults.product_name, USB_PRODUCT); + memcpy(temp_storage, &defaults, sizeof(defaults)); + } + + temp_storage += sizeof(usb_identification_t); + temp_storage_size -= sizeof(usb_identification_t); + #if CIRCUITPY_USB_HID usb_hid_build_report_descriptor(temp_storage, temp_storage_size); #endif @@ -138,12 +168,18 @@ void usb_get_boot_py_data(uint8_t *temp_storage, size_t temp_storage_size) { // After VM is gone, save data into non-heap storage (storage_allocations). void usb_return_boot_py_data(uint8_t *temp_storage, size_t temp_storage_size) { + usb_identification_t identification; + memcpy(&identification, temp_storage, sizeof(usb_identification_t)); + + temp_storage += sizeof(usb_identification_t); + temp_storage_size -= sizeof(usb_identification_t); + #if CIRCUITPY_USB_HID usb_hid_save_report_descriptor(temp_storage, temp_storage_size); #endif // Now we can also build the rest of the descriptors and place them in storage_allocations. - usb_build_descriptors(); + usb_build_descriptors(&identification); } // Call this when ready to run code.py or a REPL, and a VM has been started. @@ -242,6 +278,11 @@ void tud_cdc_line_state_cb(uint8_t itf, bool dtr, bool rts) { if (coding.bit_rate == 1200) { reset_to_bootloader(); } + } else { + #if CIRCUITPY_STATUS_BAR + // We are connected, let's request a title bar update. + supervisor_status_bar_request_update(true); + #endif } } diff --git a/supervisor/shared/usb/usb_desc.c b/supervisor/shared/usb/usb_desc.c index 9fe1eadd4e..fa4cf9607e 100644 --- a/supervisor/shared/usb/usb_desc.c +++ b/supervisor/shared/usb/usb_desc.c @@ -68,9 +68,6 @@ static supervisor_allocation *device_descriptor_allocation; static supervisor_allocation *configuration_descriptor_allocation; static supervisor_allocation *string_descriptors_allocation; -static const char manufacturer_name[] = USB_MANUFACTURER; -static const char product_name[] = USB_PRODUCT; - // Serial number string is UID length * 2 (2 nibbles per byte) + 1 byte for null termination. static char serial_number_hex_string[COMMON_HAL_MCU_PROCESSOR_UID_LENGTH * 2 + 1]; @@ -113,23 +110,23 @@ static const uint8_t configuration_descriptor_template[] = { 0x32, // 8 bMaxPower 100mA }; -static void usb_build_device_descriptor(uint16_t vid, uint16_t pid) { +static void usb_build_device_descriptor(const usb_identification_t *identification) { device_descriptor_allocation = allocate_memory(align32_size(sizeof(device_descriptor_template)), /*high_address*/ false, /*movable*/ false); uint8_t *device_descriptor = (uint8_t *)device_descriptor_allocation->ptr; memcpy(device_descriptor, device_descriptor_template, sizeof(device_descriptor_template)); - device_descriptor[DEVICE_VID_LO_INDEX] = vid & 0xFF; - device_descriptor[DEVICE_VID_HI_INDEX] = vid >> 8; - device_descriptor[DEVICE_PID_LO_INDEX] = pid & 0xFF; - device_descriptor[DEVICE_PID_HI_INDEX] = pid >> 8; + device_descriptor[DEVICE_VID_LO_INDEX] = identification->vid & 0xFF; + device_descriptor[DEVICE_VID_HI_INDEX] = identification->vid >> 8; + device_descriptor[DEVICE_PID_LO_INDEX] = identification->pid & 0xFF; + device_descriptor[DEVICE_PID_HI_INDEX] = identification->pid >> 8; - usb_add_interface_string(current_interface_string, manufacturer_name); + usb_add_interface_string(current_interface_string, identification->manufacturer_name); device_descriptor[DEVICE_MANUFACTURER_STRING_INDEX] = current_interface_string; current_interface_string++; - usb_add_interface_string(current_interface_string, product_name); + usb_add_interface_string(current_interface_string, identification->product_name); device_descriptor[DEVICE_PRODUCT_STRING_INDEX] = current_interface_string; current_interface_string++; @@ -319,7 +316,7 @@ static void usb_build_interface_string_table(void) { // After boot.py runs, the USB devices to be used have been chosen, and the descriptors can be set up. // This is called after the VM is finished, because it uses storage_allocations. -void usb_build_descriptors(void) { +void usb_build_descriptors(const usb_identification_t *identification) { uint8_t raw_id[COMMON_HAL_MCU_PROCESSOR_UID_LENGTH]; common_hal_mcu_processor_get_uid(raw_id); @@ -336,7 +333,7 @@ void usb_build_descriptors(void) { current_interface_string = 1; collected_interface_strings_length = 0; - usb_build_device_descriptor(USB_VID, USB_PID); + usb_build_device_descriptor(identification); usb_build_configuration_descriptor(); usb_build_interface_string_table(); } diff --git a/supervisor/shared/web_workflow/static/blinka_16x16.ico b/supervisor/shared/web_workflow/static/blinka_16x16.ico new file mode 100644 index 0000000000..ff2937dfee Binary files /dev/null and b/supervisor/shared/web_workflow/static/blinka_16x16.ico differ diff --git a/supervisor/shared/web_workflow/static/code.html b/supervisor/shared/web_workflow/static/code.html new file mode 100644 index 0000000000..afb707538a --- /dev/null +++ b/supervisor/shared/web_workflow/static/code.html @@ -0,0 +1,14 @@ + + + + + + + Online Code Editor + + + + +

Uh oh! It looks like you may be offline. You can go to the file browser if you'd like to work with files without connecting to the internet.

+ + diff --git a/supervisor/shared/web_workflow/static/directory.html b/supervisor/shared/web_workflow/static/directory.html new file mode 100644 index 0000000000..cf9ff507f9 --- /dev/null +++ b/supervisor/shared/web_workflow/static/directory.html @@ -0,0 +1,24 @@ + + + + + + + + + + +

 

+ + + + + +
TypeSizePathModified
+
+ + + +
+ +📁  + diff --git a/supervisor/shared/web_workflow/static/directory.js b/supervisor/shared/web_workflow/static/directory.js new file mode 100644 index 0000000000..c1d934c1a8 --- /dev/null +++ b/supervisor/shared/web_workflow/static/directory.js @@ -0,0 +1,269 @@ +let new_directory_name = document.getElementById("name"); +let files = document.getElementById("files"); +let dirs = document.getElementById("dirs"); + +var url_base = window.location; +var current_path; +var editable = undefined; + +function compareValues(a, b) { + if (a.directory == b.directory && a.name.toLowerCase() === b.name.toLowerCase()) { + return 0; + } else if (a.directory != b.directory) { + return a.directory < b.directory ? 1 : -1; + } else { + return a.name.toLowerCase() < b.name.toLowerCase() ? -1 : 1; + } +} + +function set_upload_enabled(enabled) { + files.disabled = !enabled; + dirs.disabled = !enabled; +} + +async function refresh_list() { + current_path = window.location.hash.substr(1); + if (current_path == "") { + current_path = "/"; + } + // Do the fetch first because the browser will prompt for credentials. + const response = await fetch(new URL("/fs" + current_path, url_base), + { + headers: { + "Accept": "application/json" + }, + credentials: "include" + } + ); + const data = await response.json(); + var new_children = []; + var title = document.querySelector("title"); + title.textContent = current_path; + var path = document.querySelector("#path"); + path.textContent = current_path; + var template = document.querySelector('#row'); + + if (editable === undefined) { + const status = await fetch(new URL("/fs/", url_base), + { + method: "OPTIONS", + credentials: "include" + } + ); + editable = status.headers.get("Access-Control-Allow-Methods").includes("DELETE"); + new_directory_name.disabled = !editable; + set_upload_enabled(editable); + if (!editable) { + let usbwarning = document.querySelector("#usbwarning"); + usbwarning.style.display = "block"; + } + } + + if (current_path != "/") { + var clone = template.content.cloneNode(true); + var td = clone.querySelectorAll("td"); + td[0].textContent = "📁"; + var path = clone.querySelector("a"); + let parent = new URL("..", "file://" + current_path); + path.href = "#" + parent.pathname; + path.textContent = ".."; + // Remove the delete button + td[4].replaceChildren(); + td[5].replaceChildren(); + td[6].replaceChildren(); + new_children.push(clone); + } + + data.sort(compareValues); + + for (const f of data) { + // Clone the new row and insert it into the table + var clone = template.content.cloneNode(true); + var td = clone.querySelectorAll("td"); + var icon = "⬇️"; + var file_path = current_path + f.name; + let api_url = new URL("/fs" + file_path, url_base); + let edit_url = "/edit/#" + file_path; + if (f.directory) { + file_path = "#" + file_path + "/"; + api_url += "/"; + } else { + file_path = api_url; + } + + var text_file = false; + if (f.directory) { + icon = "📁"; + } else if(f.name.endsWith(".txt") || + f.name.endsWith(".env") || + f.name.endsWith(".py") || + f.name.endsWith(".js") || + f.name.endsWith(".json")) { + icon = "📄"; + text_file = true; + } else if (f.name.endsWith(".html")) { + icon = "🌐"; + text_file = true; + } + td[0].textContent = icon; + td[1].textContent = f.file_size; + var path = clone.querySelector("a.path"); + path.href = file_path; + path.textContent = f.name; + let modtime = clone.querySelector("td.modtime"); + modtime.textContent = (new Date(f.modified_ns / 1000000)).toLocaleString(); + var delete_button = clone.querySelector("button.delete"); + delete_button.value = api_url; + delete_button.disabled = !editable; + delete_button.onclick = del; + + + var rename_button = clone.querySelector("button.rename"); + rename_button.value = api_url; + rename_button.disabled = !editable; + rename_button.onclick = rename; + + let edit_link = clone.querySelector(".edit_link"); + if (text_file && editable && !f.directory) { + edit_url = new URL(edit_url, url_base); + edit_link.href = edit_url + } else if (f.directory) { + edit_link.style = "display: none;"; + } else { + edit_link.querySelector("button").disabled = true; + } + + new_children.push(clone); + } + var tbody = document.querySelector("tbody"); + tbody.replaceChildren(...new_children); +} + +async function find_devices() { + const version_response = await fetch("/cp/version.json"); + if (version_response.ok) { + url_base = new URL("/", window.location).href; + } else { + // TODO: Remove this when we've settled things. It is only used when this file isn't hosted + // by a CP device. + const response = await fetch("http://circuitpython.local/cp/devices.json"); + let url = new URL("/", response.url); + url_base = url.href; + const data = await response.json(); + } + refresh_list(); +} + +async function mkdir(e) { + const response = await fetch( + new URL("/fs" + current_path + new_directory_name.value + "/", url_base), + { + method: "PUT", + headers: { + 'X-Timestamp': Date.now() + } + } + ); + if (response.ok) { + refresh_list(); + new_directory_name.value = ""; + mkdir_button.disabled = true; + } +} + +async function upload(e) { + set_upload_enabled(false); + let progress = document.querySelector("progress"); + let made_dirs = new Set(); + progress.max = files.files.length + dirs.files.length; + progress.value = 0; + for (const file of [...files.files, ...dirs.files]) { + let file_name = file.name; + if (file.webkitRelativePath) { + file_name = file.webkitRelativePath; + let components = file_name.split("/"); + components.pop(); + let parent_dir = components.join("/"); + if (!made_dirs.has(parent_dir)) { + new_directory_name.value = parent_dir; + await mkdir(null); + made_dirs.add(parent_dir); + } + } + let file_path = new URL("/fs" + current_path + file_name, url_base); + const response = await fetch(file_path, + { + method: "PUT", + headers: { + 'Content-Type': 'application/octet-stream', + 'X-Timestamp': file.lastModified + }, + body: file + } + ) + if (response.ok) { + refresh_list(); + } + progress.value += 1; + } + files.value = ""; + dirs.value = ""; + progress.value = 0; + set_upload_enabled(true); +} + +async function del(e) { + let fn = new URL(e.target.value); + var prompt = "Delete " + fn.pathname.substr(3); + if (e.target.value.endsWith("/")) { + prompt += " and all of its contents?"; + } else { + prompt += "?"; + } + if (confirm(prompt)) { + const response = await fetch(e.target.value, + { + method: "DELETE" + } + ) + if (response.ok) { + refresh_list(); + } + } +} + +async function rename(e) { + let fn = new URL(e.target.value); + var new_fn = prompt("Rename to ", fn.pathname.substr(3)); + if (new_fn === null) { + return; + } + let new_uri = new URL("/fs" + new_fn, fn); + const response = await fetch(e.target.value, + { + method: "MOVE", + headers: { + 'X-Destination': new_uri.pathname, + }, + } + ) + if (response.ok) { + refresh_list(); + } +} + +find_devices(); + +let mkdir_button = document.getElementById("mkdir"); +mkdir_button.onclick = mkdir; + +files.onchange = upload; +dirs.onchange = upload; + +mkdir_button.disabled = new_directory_name.value.length == 0; + +new_directory_name.oninput = () => { + mkdir_button.disabled = new_directory_name.value.length == 0; +} + +window.onhashchange = refresh_list; diff --git a/supervisor/shared/web_workflow/static/edit.html b/supervisor/shared/web_workflow/static/edit.html new file mode 100644 index 0000000000..85408ed2b5 --- /dev/null +++ b/supervisor/shared/web_workflow/static/edit.html @@ -0,0 +1,16 @@ + + + + + Offline Code Edit + + + + + +

Loading

+ + + + + diff --git a/supervisor/shared/web_workflow/static/edit.js b/supervisor/shared/web_workflow/static/edit.js new file mode 100644 index 0000000000..60dd8b1073 --- /dev/null +++ b/supervisor/shared/web_workflow/static/edit.js @@ -0,0 +1,47 @@ +let $editor = document.querySelector("#code_textarea"); +let filename = location.hash.substring(1); +let $output_text = document.querySelector("#output_text"); + +fetch(`/fs/${filename}`) + .then(function (response) { + $output_text.innerText = `Loading Status: ${response.status}`; + return response.status === 200 ? response.text() : ""; + }) + .then(function (data) { + $editor.value = data; + }); + +function save() { + $output_text.innerText = "Saving..." + const requestOptions = { + method: 'PUT', + body: $editor.value + }; + fetch(`/fs/${filename}`, requestOptions) + .then(function (response) { + $output_text.innerText = `Saving Status: ${response.status}`; + return response.text(); + }) + .then(function (data) { + console.log("after fetch: " + data); + }); +} + +document.querySelector("#save_btn").onclick = function () { + console.log("Click Save!"); + save(); +} + +let isCtrl = false; +document.onkeyup=function(e){ + if(e.keyCode === 17) isCtrl=false; +} + +document.onkeydown=function(e){ + if(e.keyCode === 17) isCtrl=true; + if(e.keyCode === 83 && isCtrl === true) { + //ctrl-s pressed + save(); + return false; + } +} diff --git a/supervisor/shared/web_workflow/static/serial.html b/supervisor/shared/web_workflow/static/serial.html new file mode 100644 index 0000000000..9193953443 --- /dev/null +++ b/supervisor/shared/web_workflow/static/serial.html @@ -0,0 +1,26 @@ + + + + Simple client + + + + + + + +
+

+    
+  
+
+
+ Ctrl + + +
+ + +
+ + diff --git a/supervisor/shared/web_workflow/static/serial.js b/supervisor/shared/web_workflow/static/serial.js new file mode 100644 index 0000000000..5c644795a0 --- /dev/null +++ b/supervisor/shared/web_workflow/static/serial.js @@ -0,0 +1,83 @@ + +var ws; +var input = document.getElementById("input"); +input.value = ""; +var title = document.querySelector("title"); +var log = document.getElementById("log"); + +function set_enabled(enabled) { + input.disabled = !enabled; + var buttons = document.querySelectorAll("button"); + for (button of buttons) { + button.disabled = !enabled; + } +} + +set_enabled(false); + +function onSubmit() { + ws.send("\r"); + input.value = ""; + input.focus(); +} + +ws = new WebSocket("ws://" + window.location.host + "/cp/serial/"); + +ws.onopen = function() { + set_enabled(true); +}; + +var setting_title = false; +var encoder = new TextEncoder(); +var left_count = 0; +ws.onmessage = function(e) { + if (e.data == "\x1b]0;") { + setting_title = true; + title.textContent = ""; + } else if (e.data == "\x1b\\") { + setting_title = false; + } else if (setting_title) { + title.textContent += e.data; + } else if (e.data == "\b") { + left_count += 1; + } else if (e.data == "\x1b[K") { // Clear line + log.textContent = log.textContent.slice(0, -left_count); + left_count = 0; + } else { + log.textContent += e.data; + } + document.querySelector("span").scrollIntoView(); +}; + +ws.onclose = function() { + set_enabled(false); +}; + +ws.onerror = function(e) { + set_enabled(false); +}; + +input.addEventListener("beforeinput", function(e) { + if (e.inputType == "insertLineBreak") { + ws.send("\r"); + input.value = ""; + input.focus(); + e.preventDefault(); + } else if (e.inputType == "insertText" || e.inputType == "insertFromPaste") { + ws.send(e.data); + } else if (e.inputType == "deleteContentBackward") { + ws.send("\b"); + } else { + console.log(e); + } +}); + +let ctrl_c = document.querySelector("#c"); +ctrl_c.onclick = function() { + ws.send("\x03"); +} + +let ctrl_d = document.querySelector("#d"); +ctrl_d.onclick = function() { + ws.send("\x04"); +} diff --git a/supervisor/shared/web_workflow/static/style.css b/supervisor/shared/web_workflow/static/style.css new file mode 100644 index 0000000000..ab9dde7fb8 --- /dev/null +++ b/supervisor/shared/web_workflow/static/style.css @@ -0,0 +1,23 @@ +body { + max-width: 960px; + margin: 20px auto; + font-size: 18px; + font-family: "Proxima Nova", Verdana, sans-serif; + line-height: 20.7px; +} + + +/* for edit.html */ +#code_textarea { + width: 90%; + height: 600px; +} + +#output_text { + margin: 0; + font-size: 0.7em; +} + +:disabled { + filter: saturate(0%); +} diff --git a/supervisor/shared/web_workflow/static/welcome.html b/supervisor/shared/web_workflow/static/welcome.html new file mode 100644 index 0000000000..e773bb6a2e --- /dev/null +++ b/supervisor/shared/web_workflow/static/welcome.html @@ -0,0 +1,34 @@ + + + + CircuitPython + + + + + + + + +

 Welcome!

+ +

Welcome to CircuitPython's Web API. Go to the file browser to work with files in the CIRCUITPY drive. Go to the full code editor for a more enriching experience which requires an active internet connection. Go to the serial terminal to see code output and interact with the REPL. Make sure you've set CIRCUITPY_WEB_API_PASSWORD='somepassword' in /.env. Provide the password when the browser prompts for it. Leave the username blank.

+ +

Device Info:

+ +
+
Board:
+
+
Version:
+
+
Hostname:
+
+
IP:
+
+
+ +

Here are other CircuitPython devices on your network:

+
    +
+ + diff --git a/supervisor/shared/web_workflow/static/welcome.js b/supervisor/shared/web_workflow/static/welcome.js new file mode 100644 index 0000000000..e32d6924b5 --- /dev/null +++ b/supervisor/shared/web_workflow/static/welcome.js @@ -0,0 +1,62 @@ +var url_base = window.location; +var current_path; + +var mdns_works = url_base.hostname.endsWith(".local"); + +async function find_devices() { + var version_response = await fetch("/cp/version.json"); + if (version_response.ok) { + url_base = new URL("/", window.location).href; + } else { + // TODO: Remove this when we've settled things. It is only used when this file isn't hosted + // by a CP device. + version_response = await fetch("http://circuitpython.local/cp/version.json", {mode: "cors"}); + mdns_works = mdns_works || version_response.redirected; + if (!version_response.ok && version_response.redirected) { + version_response = await fetch(version_response.url); + } + let url = new URL("/", version_response.url); + url_base = url.href; + } + const version_info = await version_response.json(); + let version_span = document.querySelector("#version"); + version_span.textContent = version_info.version; + let board_link = document.querySelector("#board"); + board_link.href = "https://circuitpython.org/board/" + version_info.board_id + "/"; + board_link.textContent = version_info.board_name; + let hostname = document.querySelector("#hostname"); + var port = ""; + if (version_info.port != 80) { + port = ":" + version_info.port; + } + hostname.href = "http://" + version_info.hostname + ".local" + port + "/"; + hostname.textContent = version_info.hostname; + let ip = document.querySelector("#ip"); + ip.href = "http://" + version_info.ip + port + "/"; + ip.textContent = version_info.ip; + const response = await fetch(new URL("/cp/devices.json", url_base)); + const data = await response.json(); + let device_list = document.querySelector("#devices"); + let new_devices = []; + for (device of data.devices) { + let li = document.createElement("li"); + let a = document.createElement("a"); + li.appendChild(a); + var port = ""; + if (device.port != 80) { + port = ":" + device.port; + } + var server; + if (mdns_works) { + server = device.hostname + ".local"; + } else { + server = device.ip; + } + a.href = "http://" + server + port + "/"; + a.textContent = device.instance_name + " (" + device.hostname + ")"; + new_devices.push(li); + } + device_list.replaceChildren(...new_devices); +} + +find_devices(); diff --git a/supervisor/shared/web_workflow/web_workflow.c b/supervisor/shared/web_workflow/web_workflow.c new file mode 100644 index 0000000000..3f0b9ad8f7 --- /dev/null +++ b/supervisor/shared/web_workflow/web_workflow.c @@ -0,0 +1,1431 @@ +/* + * This file is part of the MicroPython project, http://micropython.org/ + * + * The MIT License (MIT) + * + * Copyright (c) 2022 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 + +#include "extmod/vfs.h" +#include "extmod/vfs_fat.h" +#include "genhdr/mpversion.h" +#include "py/mpstate.h" +#include "py/stackctrl.h" + +#include "shared-bindings/wifi/Radio.h" +#include "shared-module/storage/__init__.h" +#include "shared/timeutils/timeutils.h" +#include "supervisor/fatfs_port.h" +#include "supervisor/filesystem.h" +#include "supervisor/port.h" +#include "supervisor/shared/reload.h" +#include "supervisor/shared/translate/translate.h" +#include "supervisor/shared/web_workflow/web_workflow.h" +#include "supervisor/shared/web_workflow/websocket.h" +#include "supervisor/shared/workflow.h" +#include "supervisor/usb.h" + +#include "shared-bindings/hashlib/__init__.h" +#include "shared-bindings/hashlib/Hash.h" +#include "shared-bindings/mdns/RemoteService.h" +#include "shared-bindings/mdns/Server.h" +#include "shared-bindings/microcontroller/Processor.h" +#include "shared-bindings/socketpool/__init__.h" +#include "shared-bindings/socketpool/Socket.h" +#include "shared-bindings/socketpool/SocketPool.h" + +#if CIRCUITPY_WIFI +#include "shared-bindings/wifi/__init__.h" +#endif + +#if CIRCUITPY_DOTENV +#include "shared-module/dotenv/__init__.h" +#endif + +// TODO: Remove ESP specific stuff. For now, it is useful as we refine the server. +#include "esp_log.h" + +static const char *TAG = "CP webserver"; + +enum request_state { + STATE_METHOD, + STATE_PATH, + STATE_VERSION, + STATE_HEADER_KEY, + STATE_HEADER_VALUE, + STATE_BODY +}; + +typedef struct { + enum request_state state; + char method[8]; + char path[256]; + char destination[256]; + char header_key[64]; + char header_value[256]; + // We store the origin so we can reply back with it. + char origin[64]; + size_t content_length; + size_t offset; + uint64_t timestamp_ms; + bool redirect; + bool done; + bool in_progress; + bool authenticated; + bool expect; + bool json; + bool websocket; + uint32_t websocket_version; + // RFC6455 for websockets says this header should be 24 base64 characters long. + char websocket_key[24 + 1]; +} _request; + +static wifi_radio_error_t _wifi_status = WIFI_RADIO_ERROR_NONE; + +#if CIRCUITPY_STATUS_BAR +// Store various last states to compute if status bar needs an update. +static bool _last_enabled = false; +static uint32_t _last_ip = 0; +static wifi_radio_error_t _last_wifi_status = WIFI_RADIO_ERROR_NONE; +#endif + +static mdns_server_obj_t mdns; +static uint32_t web_api_port = 80; + +static socketpool_socketpool_obj_t pool; +static socketpool_socket_obj_t listening; +static socketpool_socket_obj_t active; + +static _request active_request; + +static char _api_password[64]; + +// Store the encoded IP so we don't duplicate work. +static uint32_t _encoded_ip = 0; +static char _our_ip_encoded[4 * 4]; + +// in_len is the number of bytes to encode. out_len is the number of bytes we +// have to do it. +static bool _base64_in_place(char *buf, size_t in_len, size_t out_len) { + size_t triples = (((in_len - 1) / 3) + 1); + size_t encoded_len = triples * 4; + if (encoded_len + 1 > out_len) { + return false; + } + + // First pass, we convert input buffer to numeric base 64 values + char *in = buf + (triples - 1) * 3; + char *out = buf + (triples - 1) * 4; + int r = in_len % 3; + int partial = 0; + if (r != 0) { + out[3] = 64; + if (r == 2) { + out[2] = (in[1] & 0x0F) << 2; + out[1] = (in[0] & 0x03) << 4 | (in[1] & 0xF0) >> 4; + } else { + out[2] = 64; + out[1] = (in[0] & 0x03) << 4; + } + out[0] = (in[0] & 0xFC) >> 2; + in -= 3; + out -= 4; + partial = 1; + } + buf[encoded_len] = '\0'; + for (size_t i = 0; i < triples - partial; i++) { + out[3] = in[2] & 0x3F; + out[2] = (in[1] & 0x0F) << 2 | (in[2] & 0xC0) >> 6; + out[1] = (in[0] & 0x03) << 4 | (in[1] & 0xF0) >> 4; + out[0] = (in[0] & 0xFC) >> 2; + in -= 3; + out -= 4; + } + + // Second pass, we convert number base 64 values to actual base64 ascii encoding + out = buf; + for (mp_uint_t j = 0; j < encoded_len; j++) { + if (*out < 26) { + *out += 'A'; + } else if (*out < 52) { + *out += 'a' - 26; + } else if (*out < 62) { + *out += '0' - 52; + } else if (*out == 62) { + *out = '+'; + } else if (*out == 63) { + *out = '/'; + } else { + *out = '='; + } + out++; + } + return true; +} + +STATIC void _update_encoded_ip(void) { + uint32_t ipv4_address = 0; + if (common_hal_wifi_radio_get_enabled(&common_hal_wifi_radio_obj)) { + ipv4_address = wifi_radio_get_ipv4_address(&common_hal_wifi_radio_obj); + } + if (_encoded_ip != ipv4_address) { + uint8_t *octets = (uint8_t *)&ipv4_address; + snprintf(_our_ip_encoded, sizeof(_our_ip_encoded), "%d.%d.%d.%d", octets[0], octets[1], octets[2], octets[3]); + _encoded_ip = ipv4_address; + } +} + +#if CIRCUITPY_STATUS_BAR +bool supervisor_web_workflow_status_dirty(void) { + return common_hal_wifi_radio_get_enabled(&common_hal_wifi_radio_obj) != _last_enabled || + _encoded_ip != _last_ip || + _last_wifi_status != _wifi_status; +} +#endif + +#if CIRCUITPY_STATUS_BAR +void supervisor_web_workflow_status(void) { + _last_enabled = common_hal_wifi_radio_get_enabled(&common_hal_wifi_radio_obj); + if (_last_enabled) { + uint32_t ipv4_address = wifi_radio_get_ipv4_address(&common_hal_wifi_radio_obj); + if (ipv4_address != 0) { + _update_encoded_ip(); + _last_ip = _encoded_ip; + mp_printf(&mp_plat_print, "%s", _our_ip_encoded); + if (web_api_port != 80) { + mp_printf(&mp_plat_print, ":%d", web_api_port); + } + // TODO: Use these unicode to show signal strength: ▂▄▆█ + return; + } + serial_write_compressed(translate("Wi-Fi: ")); + _last_wifi_status = _wifi_status; + if (_wifi_status == WIFI_RADIO_ERROR_AUTH_EXPIRE || + _wifi_status == WIFI_RADIO_ERROR_AUTH_FAIL) { + serial_write_compressed(translate("Authentication failure")); + } else if (_wifi_status != WIFI_RADIO_ERROR_NONE) { + mp_printf(&mp_plat_print, "%d", _wifi_status); + } else if (ipv4_address == 0) { + _last_ip = 0; + serial_write_compressed(translate("No IP")); + } else { + } + } else { + // Keep Wi-Fi print separate so its data can be matched with the one above. + serial_write_compressed(translate("Wi-Fi: ")); + serial_write_compressed(translate("off")); + } +} +#endif + +void supervisor_start_web_workflow(void) { + #if CIRCUITPY_WEB_WORKFLOW && CIRCUITPY_WIFI + + + char ssid[33]; + char password[64]; + mp_int_t ssid_len = 0; + mp_int_t password_len = 0; + + #if CIRCUITPY_DOTENV + ssid_len = dotenv_get_key("/.env", "CIRCUITPY_WIFI_SSID", ssid, sizeof(ssid) - 1); + password_len = dotenv_get_key("/.env", "CIRCUITPY_WIFI_PASSWORD", password, sizeof(password) - 1); + #endif + if (ssid_len <= 0 || (size_t)ssid_len >= sizeof(ssid) || + password_len <= 0 || (size_t)password_len >= sizeof(password)) { + return; + } + if (!common_hal_wifi_radio_get_enabled(&common_hal_wifi_radio_obj)) { + common_hal_wifi_init(false); + common_hal_wifi_radio_set_enabled(&common_hal_wifi_radio_obj, true); + } + + // TODO: Do our own scan so that we can find the channel we want before calling connect. + // Otherwise, connect will do a full slow scan to pick the best AP. + + // NUL terminate the strings because dotenv doesn't. + ssid[ssid_len] = '\0'; + password[password_len] = '\0'; + // We can all connect again because it will return early if we're already connected to the + // network. If we are connected to a different network, then it will disconnect before + // attempting to connect to the given network. + _wifi_status = common_hal_wifi_radio_connect( + &common_hal_wifi_radio_obj, (uint8_t *)ssid, ssid_len, (uint8_t *)password, password_len, + 0, 0.1, NULL, 0); + + if (_wifi_status != WIFI_RADIO_ERROR_NONE) { + common_hal_wifi_radio_set_enabled(&common_hal_wifi_radio_obj, false); + return; + } + + char port_encoded[6]; + size_t port_len = 0; + size_t new_port = web_api_port; + #if CIRCUITPY_DOTENV + port_len = dotenv_get_key("/.env", "CIRCUITPY_WEB_API_PORT", port_encoded, sizeof(port_encoded) - 1); + #endif + if (0 < port_len && port_len < sizeof(port_encoded)) { + port_encoded[port_len] = '\0'; + new_port = strtoul(port_encoded, NULL, 10); + } + + bool first_start = mdns.base.type != &mdns_server_type; + bool port_changed = new_port != web_api_port; + + if (first_start) { + ESP_LOGI(TAG, "Starting web workflow"); + mdns_server_construct(&mdns, true); + mdns.base.type = &mdns_server_type; + common_hal_mdns_server_set_instance_name(&mdns, MICROPY_HW_BOARD_NAME); + pool.base.type = &socketpool_socketpool_type; + common_hal_socketpool_socketpool_construct(&pool, &common_hal_wifi_radio_obj); + + listening.base.type = &socketpool_socket_type; + active.base.type = &socketpool_socket_type; + active.num = -1; + active.connected = false; + + websocket_init(); + } + if (port_changed) { + common_hal_socketpool_socket_close(&listening); + } + if (first_start || port_changed) { + web_api_port = new_port; + common_hal_mdns_server_advertise_service(&mdns, "_circuitpython", "_tcp", web_api_port); + socketpool_socket(&pool, SOCKETPOOL_AF_INET, SOCKETPOOL_SOCK_STREAM, &listening); + common_hal_socketpool_socket_settimeout(&listening, 0); + // Bind to any ip. + common_hal_socketpool_socket_bind(&listening, "", 0, web_api_port); + common_hal_socketpool_socket_listen(&listening, 1); + } + + mp_int_t api_password_len = dotenv_get_key("/.env", "CIRCUITPY_WEB_API_PASSWORD", _api_password + 1, sizeof(_api_password) - 2); + if (api_password_len > 0) { + _api_password[0] = ':'; + _api_password[api_password_len + 1] = '\0'; + _base64_in_place(_api_password, api_password_len + 1, sizeof(_api_password)); + } + + // TODO: + // GET /edit/ + // - Super basic editor + #endif +} + +void web_workflow_send_raw(socketpool_socket_obj_t *socket, const uint8_t *buf, int len) { + int total_sent = 0; + int sent = -EAGAIN; + while ((sent == -EAGAIN || (sent > 0 && total_sent < len)) && + common_hal_socketpool_socket_get_connected(socket)) { + sent = socketpool_socket_send(socket, buf + total_sent, len - total_sent); + if (sent > 0) { + total_sent += sent; + if (total_sent < len) { + // Yield so that network code can run. + port_yield(); + } + } + } + if (total_sent < len) { + ESP_LOGE(TAG, "short send %d %d", sent, len); + } +} + +STATIC void _print_raw(void *env, const char *str, size_t len) { + web_workflow_send_raw((socketpool_socket_obj_t *)env, (const uint8_t *)str, (size_t)len); +} + +static void _send_str(socketpool_socket_obj_t *socket, const char *str) { + web_workflow_send_raw(socket, (const uint8_t *)str, strlen(str)); +} + +// The last argument must be NULL! Otherwise, it won't stop. +static void _send_strs(socketpool_socket_obj_t *socket, ...) { + va_list ap; + va_start(ap, socket); + + const char *str = va_arg(ap, const char *); + while (str != NULL) { + _send_str(socket, str); + str = va_arg(ap, const char *); + } + va_end(ap); +} + +static void _send_chunk(socketpool_socket_obj_t *socket, const char *chunk) { + mp_print_t _socket_print = {socket, _print_raw}; + mp_printf(&_socket_print, "%X\r\n", strlen(chunk)); + web_workflow_send_raw(socket, (const uint8_t *)chunk, strlen(chunk)); + web_workflow_send_raw(socket, (const uint8_t *)"\r\n", 2); +} + +STATIC void _print_chunk(void *env, const char *str, size_t len) { + mp_print_t _socket_print = {env, _print_raw}; + mp_printf(&_socket_print, "%X\r\n", len); + web_workflow_send_raw((socketpool_socket_obj_t *)env, (const uint8_t *)str, len); + web_workflow_send_raw((socketpool_socket_obj_t *)env, (const uint8_t *)"\r\n", 2); +} + +// A bit of a misnomer because it sends all arguments as one chunk. +// The last argument must be NULL! Otherwise, it won't stop. +static void _send_chunks(socketpool_socket_obj_t *socket, ...) { + va_list strs_to_count; + va_start(strs_to_count, socket); + + va_list strs_to_send; + va_copy(strs_to_send, strs_to_count); + + size_t chunk_len = 0; + const char *str = va_arg(strs_to_count, const char *); + while (str != NULL) { + chunk_len += strlen(str); + str = va_arg(strs_to_count, const char *); + } + va_end(strs_to_count); + + + mp_print_t _socket_print = {socket, _print_raw}; + mp_printf(&_socket_print, "%X\r\n", chunk_len); + + str = va_arg(strs_to_send, const char *); + while (str != NULL) { + _send_str(socket, str); + str = va_arg(strs_to_send, const char *); + } + va_end(strs_to_send); + + _send_str(socket, "\r\n"); +} + +static bool _endswith(const char *str, const char *suffix) { + if (str == NULL || suffix == NULL) { + return false; + } + if (strlen(suffix) > strlen(str)) { + return false; + } + return strcmp(str + (strlen(str) - strlen(suffix)), suffix) == 0; +} + +const char *ok_hosts[] = { + "code.circuitpython.org", + "127.0.0.1", + "localhost", +}; + +static bool _origin_ok(const char *origin) { + const char *http = "http://"; + const char *local = ".local"; + + // note: redirected requests send an Origin of "null" and will be caught by this + if (strncmp(origin, http, strlen(http)) != 0) { + return false; + } + // These are prefix checks up to : so that any port works. + const char *hostname = common_hal_mdns_server_get_hostname(&mdns); + const char *end = origin + strlen(http) + strlen(hostname) + strlen(local); + if (strncmp(origin + strlen(http), hostname, strlen(hostname)) == 0 && + strncmp(origin + strlen(http) + strlen(hostname), local, strlen(local)) == 0 && + (end[0] == '\0' || end[0] == ':')) { + return true; + } + + _update_encoded_ip(); + end = origin + strlen(http) + strlen(_our_ip_encoded); + if (strncmp(origin + strlen(http), _our_ip_encoded, strlen(_our_ip_encoded)) == 0 && + (end[0] == '\0' || end[0] == ':')) { + return true; + } + + for (size_t i = 0; i < MP_ARRAY_SIZE(ok_hosts); i++) { + // Allows any port + end = origin + strlen(http) + strlen(ok_hosts[i]); + if (strncmp(origin + strlen(http), ok_hosts[i], strlen(ok_hosts[i])) == 0 + && (end[0] == '\0' || end[0] == ':')) { + return true; + } + } + return false; +} + +STATIC bool _usb_active(void) { + // Check to see if USB has already been mounted. If not, then we "eject" from USB until we're done. + #if CIRCUITPY_USB && CIRCUITPY_USB_MSC + if (storage_usb_enabled() && !usb_msc_lock()) { + return true; + } + #endif + return false; +} + + +static const char *OK_JSON = "HTTP/1.1 200 OK\r\nTransfer-Encoding: chunked\r\nContent-Type: application/json\r\n"; + +static void _cors_header(socketpool_socket_obj_t *socket, _request *request) { + _send_strs(socket, + "Access-Control-Allow-Credentials: true\r\n", + "Vary: Origin, Accept, Upgrade\r\n", + "Access-Control-Allow-Origin: ", request->origin, "\r\n", + NULL); +} + +static void _reply_continue(socketpool_socket_obj_t *socket, _request *request) { + _send_str(socket, "HTTP/1.1 100 Continue\r\n"); + _cors_header(socket, request); + _send_str(socket, "\r\n"); +} + +static void _reply_created(socketpool_socket_obj_t *socket, _request *request) { + _send_strs(socket, + "HTTP/1.1 201 Created\r\n", + "Content-Length: 0\r\n", NULL); + _cors_header(socket, request); + _send_str(socket, "\r\n"); +} + +static void _reply_no_content(socketpool_socket_obj_t *socket, _request *request) { + _send_strs(socket, + "HTTP/1.1 204 No Content\r\n", + "Content-Length: 0\r\n", NULL); + _cors_header(socket, request); + _send_str(socket, "\r\n"); +} + +static void _reply_access_control(socketpool_socket_obj_t *socket, _request *request) { + _send_strs(socket, + "HTTP/1.1 204 No Content\r\n", + "Content-Length: 0\r\n", + "Access-Control-Expose-Headers: Access-Control-Allow-Methods\r\n", + "Access-Control-Allow-Headers: X-Timestamp, X-Destination, Content-Type, Authorization\r\n", + "Access-Control-Allow-Methods:GET, OPTIONS", NULL); + if (!_usb_active()) { + _send_str(socket, ", PUT, DELETE, MOVE"); + #if CIRCUITPY_USB_MSC + usb_msc_unlock(); + #endif + } + _send_str(socket, "\r\n"); + _cors_header(socket, request); + _send_str(socket, "\r\n"); +} + +static void _reply_missing(socketpool_socket_obj_t *socket, _request *request) { + _send_strs(socket, + "HTTP/1.1 404 Not Found\r\n", + "Content-Length: 0\r\n", NULL); + _cors_header(socket, request); + _send_str(socket, "\r\n"); +} + +static void _reply_method_not_allowed(socketpool_socket_obj_t *socket, _request *request) { + _send_strs(socket, + "HTTP/1.1 405 Method Not Allowed\r\n", + "Content-Length: 0\r\n", NULL); + _cors_header(socket, request); + _send_str(socket, "\r\n"); +} + +static void _reply_forbidden(socketpool_socket_obj_t *socket, _request *request) { + _send_strs(socket, + "HTTP/1.1 403 Forbidden\r\n", + "Content-Length: 0\r\n", NULL); + _cors_header(socket, request); + _send_str(socket, "\r\n"); +} + +static void _reply_conflict(socketpool_socket_obj_t *socket, _request *request) { + _send_strs(socket, + "HTTP/1.1 409 Conflict\r\n", + "Content-Length: 19\r\n", NULL); + _cors_header(socket, request); + _send_str(socket, "\r\nUSB storage active."); +} + + +static void _reply_precondition_failed(socketpool_socket_obj_t *socket, _request *request) { + _send_strs(socket, + "HTTP/1.1 412 Precondition Failed\r\n", + "Content-Length: 0\r\n", NULL); + _cors_header(socket, request); + _send_str(socket, "\r\n"); +} + +static void _reply_payload_too_large(socketpool_socket_obj_t *socket, _request *request) { + _send_strs(socket, + "HTTP/1.1 413 Payload Too Large\r\n", + "Content-Length: 0\r\n", NULL); + _cors_header(socket, request); + _send_str(socket, "\r\n"); +} + +static void _reply_expectation_failed(socketpool_socket_obj_t *socket, _request *request) { + _send_strs(socket, + "HTTP/1.1 417 Expectation Failed\r\n", + "Content-Length: 0\r\n", NULL); + _cors_header(socket, request); + _send_str(socket, "\r\n"); +} + +static void _reply_unauthorized(socketpool_socket_obj_t *socket, _request *request) { + _send_strs(socket, + "HTTP/1.1 401 Unauthorized\r\n", + "Content-Length: 0\r\n", + "WWW-Authenticate: Basic realm=\"CircuitPython\"\r\n", NULL); + _cors_header(socket, request); + _send_str(socket, "\r\n"); +} + +static void _reply_server_error(socketpool_socket_obj_t *socket, _request *request) { + _send_strs(socket, + "HTTP/1.1 500 Internal Server Error\r\n", + "Content-Length: 0\r\n", NULL); + _cors_header(socket, request); + _send_str(socket, "\r\n"); +} + +static void _reply_redirect(socketpool_socket_obj_t *socket, _request *request, const char *path) { + int nodelay = 1; + lwip_setsockopt(socket->num, IPPROTO_TCP, TCP_NODELAY, &nodelay, sizeof(nodelay)); + const char *hostname = common_hal_mdns_server_get_hostname(&mdns); + _send_strs(socket, + "HTTP/1.1 307 Temporary Redirect\r\n", + "Connection: close\r\n", + "Content-Length: 0\r\n", + "Location: ", NULL); + if (request->websocket) { + _send_str(socket, "ws"); + } else { + _send_str(socket, "http"); + } + + _send_strs(socket, "://", hostname, ".local", NULL); + if (web_api_port != 80) { + mp_print_t _socket_print = {socket, _print_raw}; + mp_printf(&_socket_print, ":%d", web_api_port); + } + _send_strs(socket, path, "\r\n", NULL); + _cors_header(socket, request); + _send_str(socket, "\r\n"); +} + +static void _reply_directory_json(socketpool_socket_obj_t *socket, _request *request, FF_DIR *dir, const char *request_path, const char *path) { + socketpool_socket_send(socket, (const uint8_t *)OK_JSON, strlen(OK_JSON)); + _cors_header(socket, request); + _send_str(socket, "\r\n"); + mp_print_t _socket_print = {socket, _print_chunk}; + _send_chunk(socket, "["); + bool first = true; + + FILINFO file_info; + char *fn = file_info.fname; + FRESULT res = f_readdir(dir, &file_info); + while (res == FR_OK && fn[0] != 0) { + if (!first) { + _send_chunk(socket, ","); + } + _send_chunks(socket, + "{\"name\": \"", file_info.fname, "\",", + "\"directory\": ", NULL); + if ((file_info.fattrib & AM_DIR) != 0) { + _send_chunk(socket, "true"); + } else { + _send_chunk(socket, "false"); + } + // We use nanoseconds past Jan 1, 1970 for consistency with BLE API and + // LittleFS. + _send_chunk(socket, ", "); + + uint32_t truncated_time = timeutils_mktime(1980 + (file_info.fdate >> 9), + (file_info.fdate >> 5) & 0xf, + file_info.fdate & 0x1f, + file_info.ftime >> 11, + (file_info.ftime >> 5) & 0x3f, + (file_info.ftime & 0x1f) * 2); + + // Manually append zeros to make the time nanoseconds. Support for printing 64 bit numbers + // varies across chipsets. + mp_printf(&_socket_print, "\"modified_ns\": %lu000000000, ", truncated_time); + size_t file_size = 0; + if ((file_info.fattrib & AM_DIR) == 0) { + file_size = file_info.fsize; + } + mp_printf(&_socket_print, "\"file_size\": %d }", file_size); + + first = false; + res = f_readdir(dir, &file_info); + } + _send_chunk(socket, "]"); + _send_chunk(socket, ""); +} + +static void _reply_with_file(socketpool_socket_obj_t *socket, _request *request, const char *filename, FIL *active_file) { + uint32_t total_length = f_size(active_file); + + _send_str(socket, "HTTP/1.1 200 OK\r\n"); + mp_print_t _socket_print = {socket, _print_raw}; + mp_printf(&_socket_print, "Content-Length: %d\r\n", total_length); + // TODO: Make this a table to save space. + if (_endswith(filename, ".txt") || _endswith(filename, ".py")) { + _send_strs(socket, "Content-Type: text/plain", ";charset=UTF-8\r\n", NULL); + } else if (_endswith(filename, ".js")) { + _send_strs(socket, "Content-Type: text/javascript", ";charset=UTF-8\r\n", NULL); + } else if (_endswith(filename, ".html")) { + _send_strs(socket, "Content-Type: text/html", ";charset=UTF-8\r\n", NULL); + } else if (_endswith(filename, ".json")) { + _send_strs(socket, "Content-Type: application/json", ";charset=UTF-8\r\n", NULL); + } else { + _send_str(socket, "Content-Type: application/octet-stream\r\n"); + } + _cors_header(socket, request); + _send_str(socket, "\r\n"); + + uint32_t total_read = 0; + while (total_read < total_length) { + uint8_t data_buffer[64]; + size_t quantity_read; + f_read(active_file, data_buffer, 64, &quantity_read); + total_read += quantity_read; + uint32_t send_offset = 0; + while (send_offset < quantity_read) { + int sent = socketpool_socket_send(socket, data_buffer + send_offset, quantity_read - send_offset); + if (sent < 0) { + if (sent == -EAGAIN) { + sent = 0; + } else { + ESP_LOGE(TAG, "file send error %d", sent); + break; + } + } + send_offset += sent; + } + } + if (total_read < total_length) { + socketpool_socket_close(socket); + } +} + +static void _reply_with_devices_json(socketpool_socket_obj_t *socket, _request *request) { + mdns_remoteservice_obj_t found_devices[32]; + size_t total_results = mdns_server_find(&mdns, "_circuitpython", "_tcp", 1, found_devices, MP_ARRAY_SIZE(found_devices)); + size_t count = MIN(total_results, MP_ARRAY_SIZE(found_devices)); + socketpool_socket_send(socket, (const uint8_t *)OK_JSON, strlen(OK_JSON)); + _cors_header(socket, request); + _send_str(socket, "\r\n"); + mp_print_t _socket_print = {socket, _print_chunk}; + + mp_printf(&_socket_print, "{\"total\": %d, \"devices\": [", total_results); + for (size_t i = 0; i < count; i++) { + if (i > 0) { + _send_chunk(socket, ","); + } + const char *hostname = common_hal_mdns_remoteservice_get_hostname(&found_devices[i]); + const char *instance_name = common_hal_mdns_remoteservice_get_instance_name(&found_devices[i]); + int port = common_hal_mdns_remoteservice_get_port(&found_devices[i]); + uint32_t ipv4_address = mdns_remoteservice_get_ipv4_address(&found_devices[i]); + uint8_t *octets = (uint8_t *)&ipv4_address; + mp_printf(&_socket_print, + "{\"hostname\": \"%s\", " + "\"instance_name\": \"%s\", " + "\"port\": %d, " + "\"ip\": \"%d.%d.%d.%d\"}", hostname, instance_name, port, octets[0], octets[1], octets[2], octets[3]); + common_hal_mdns_remoteservice_deinit(&found_devices[i]); + } + _send_chunk(socket, "]}"); + // Empty chunk signals the end of the response. + _send_chunk(socket, ""); +} + +static void _reply_with_version_json(socketpool_socket_obj_t *socket, _request *request) { + _send_str(socket, OK_JSON); + _cors_header(socket, request); + _send_str(socket, "\r\n"); + mp_print_t _socket_print = {socket, _print_chunk}; + + const char *hostname = common_hal_mdns_server_get_hostname(&mdns); + _update_encoded_ip(); + // Note: this leverages the fact that C concats consecutive string literals together. + mp_printf(&_socket_print, + "{\"web_api_version\": 1, " + "\"version\": \"" MICROPY_GIT_TAG "\", " + "\"build_date\": \"" MICROPY_BUILD_DATE "\", " + "\"board_name\": \"" MICROPY_HW_BOARD_NAME "\", " + "\"mcu_name\": \"" MICROPY_HW_MCU_NAME "\", " + "\"board_id\": \"" CIRCUITPY_BOARD_ID "\", " + "\"creator_id\": %u, " + "\"creation_id\": %u, " + "\"hostname\": \"%s\", " + "\"port\": %d, ", CIRCUITPY_CREATOR_ID, CIRCUITPY_CREATION_ID, hostname, web_api_port, _our_ip_encoded); + #if CIRCUITPY_MICROCONTROLLER && COMMON_HAL_MCU_PROCESSOR_UID_LENGTH > 0 + uint8_t raw_id[COMMON_HAL_MCU_PROCESSOR_UID_LENGTH]; + common_hal_mcu_processor_get_uid(raw_id); + mp_printf(&_socket_print, "\"UID\": \""); + for (uint8_t i = 0; i < COMMON_HAL_MCU_PROCESSOR_UID_LENGTH; i++) { + mp_printf(&_socket_print, "%02X", raw_id[i]); + } + mp_printf(&_socket_print, "\", "); + #endif + mp_printf(&_socket_print, "\"ip\": \"%s\"}", _our_ip_encoded); + // Empty chunk signals the end of the response. + _send_chunk(socket, ""); +} + +// FATFS has a two second timestamp resolution but the BLE API allows for nanosecond resolution. +// This function truncates the time the time to a resolution storable by FATFS and fills in the +// FATFS encoded version into fattime. +STATIC uint64_t truncate_time(uint64_t input_time, DWORD *fattime) { + timeutils_struct_time_t tm; + uint64_t seconds_since_epoch = timeutils_seconds_since_epoch_from_nanoseconds_since_1970(input_time); + timeutils_seconds_since_epoch_to_struct_time(seconds_since_epoch, &tm); + uint64_t truncated_time = timeutils_nanoseconds_since_epoch_to_nanoseconds_since_1970((seconds_since_epoch / 2) * 2 * 1000000000); + + *fattime = ((tm.tm_year - 1980) << 25) | (tm.tm_mon << 21) | (tm.tm_mday << 16) | + (tm.tm_hour << 11) | (tm.tm_min << 5) | (tm.tm_sec >> 1); + return truncated_time; +} + +STATIC void _discard_incoming(socketpool_socket_obj_t *socket, size_t amount) { + size_t discarded = 0; + while (discarded < amount) { + uint8_t bytes[64]; + size_t read_len = MIN(sizeof(bytes), amount - discarded); + int len = socketpool_socket_recv_into(socket, bytes, read_len); + if (len < 0) { + break; + } + discarded += read_len; + } +} + +static void _write_file_and_reply(socketpool_socket_obj_t *socket, _request *request, FATFS *fs, const TCHAR *path) { + FIL active_file; + + if (_usb_active()) { + _discard_incoming(socket, request->content_length); + _reply_conflict(socket, request); + return; + } + if (request->timestamp_ms > 0) { + DWORD fattime; + truncate_time(request->timestamp_ms * 1000000, &fattime); + override_fattime(fattime); + } + + FRESULT result = f_open(fs, &active_file, path, FA_WRITE); + bool new_file = false; + if (result == FR_NO_FILE) { + new_file = true; + result = f_open(fs, &active_file, path, FA_WRITE | FA_OPEN_ALWAYS); + } + + if (result == FR_NO_PATH) { + override_fattime(0); + #if CIRCUITPY_USB_MSC + usb_msc_unlock(); + #endif + _discard_incoming(socket, request->content_length); + _reply_missing(socket, request); + return; + } + if (result != FR_OK) { + ESP_LOGE(TAG, "file write error %d %s", result, path); + override_fattime(0); + #if CIRCUITPY_USB_MSC + usb_msc_unlock(); + #endif + _discard_incoming(socket, request->content_length); + _reply_server_error(socket, request); + return; + } else if (request->expect) { + _reply_continue(socket, request); + } + + // Change the file size to start. + f_lseek(&active_file, request->content_length); + if (f_tell(&active_file) < request->content_length) { + f_close(&active_file); + override_fattime(0); + #if CIRCUITPY_USB_MSC + usb_msc_unlock(); + #endif + _discard_incoming(socket, request->content_length); + // Too large. + if (request->expect) { + _reply_expectation_failed(socket, request); + } else { + _reply_payload_too_large(socket, request); + } + + return; + } + f_truncate(&active_file); + f_rewind(&active_file); + + size_t total_read = 0; + bool error = false; + while (total_read < request->content_length && !error) { + uint8_t bytes[64]; + size_t read_len = MIN(sizeof(bytes), request->content_length - total_read); + int len = socketpool_socket_recv_into(socket, bytes, read_len); + if (len < 0) { + if (len == -EAGAIN) { + continue; + } else { + ESP_LOGE(TAG, "other error %d", len); + } + error = true; + break; + } + UINT actual; + f_write(&active_file, bytes, len, &actual); + if (actual != (UINT)len) { + ESP_LOGE(TAG, "didn't write whole file"); + } + total_read += len; + } + + f_close(&active_file); + #if CIRCUITPY_USB_MSC + usb_msc_unlock(); + #endif + + override_fattime(0); + if (new_file) { + _reply_created(socket, request); + } else { + _reply_no_content(socket, request); + } +} + +#define STATIC_FILE(filename) extern uint32_t filename##_length; extern uint8_t filename[]; extern const char *filename##_content_type; + +STATIC_FILE(code_html); +STATIC_FILE(directory_html); +STATIC_FILE(directory_js); +STATIC_FILE(welcome_html); +STATIC_FILE(welcome_js); +STATIC_FILE(edit_html); +STATIC_FILE(edit_js); +STATIC_FILE(style_css); +STATIC_FILE(serial_html); +STATIC_FILE(serial_js); +STATIC_FILE(blinka_16x16_ico); + +static void _reply_static(socketpool_socket_obj_t *socket, _request *request, const uint8_t *response, size_t response_len, const char *content_type) { + uint32_t total_length = response_len; + char encoded_len[10]; + snprintf(encoded_len, sizeof(encoded_len), "%d", total_length); + + _send_strs(socket, + "HTTP/1.1 200 OK\r\n", + "Content-Encoding: gzip\r\n", + "Content-Length: ", encoded_len, "\r\n", + "Content-Type: ", content_type, "\r\n", + "\r\n", NULL); + web_workflow_send_raw(socket, response, response_len); +} + +#define _REPLY_STATIC(socket, request, filename) _reply_static(socket, request, filename, filename##_length, filename##_content_type) + +static void _reply_websocket_upgrade(socketpool_socket_obj_t *socket, _request *request) { + // Compute accept key + hashlib_hash_obj_t hash; + common_hal_hashlib_new(&hash, "sha1"); + common_hal_hashlib_hash_update(&hash, (const uint8_t *)request->websocket_key, strlen(request->websocket_key)); + const char *magic_string = "258EAFA5-E914-47DA-95CA-C5AB0DC85B11"; + common_hal_hashlib_hash_update(&hash, (const uint8_t *)magic_string, strlen(magic_string)); + size_t digest_size = common_hal_hashlib_hash_get_digest_size(&hash); + size_t encoded_size = (digest_size + 1) * 4 / 3 + 1; + uint8_t encoded_accept[encoded_size]; + common_hal_hashlib_hash_digest(&hash, encoded_accept, sizeof(encoded_accept)); + _base64_in_place((char *)encoded_accept, digest_size, encoded_size); + + // Reply with upgrade + _send_strs(socket, "HTTP/1.1 101 Switching Protocols\r\n", + "Upgrade: websocket\r\n", + "Connection: Upgrade\r\n", + "Sec-WebSocket-Accept: ", encoded_accept, "\r\n", + "\r\n", NULL); + websocket_handoff(socket); + // socket is now closed and "disconnected". +} + +static uint8_t _hex2nibble(char h) { + if ('0' <= h && h <= '9') { + return h - '0'; + } else if ('A' <= h && h <= 'F') { + return h - 'A' + 0xa; + } + // Shouldn't usually use lower case. + return h - 'a' + 0xa; +} + +// Decode percent encoding in place. Only do this once on a string! +static void _decode_percents(char *str) { + size_t o = 0; + size_t i = 0; + size_t startlen = strlen(str); + while (i < startlen) { + if (str[i] == '%') { + str[o] = _hex2nibble(str[i + 1]) << 4 | _hex2nibble(str[i + 2]); + i += 3; + } else { + if (i != o) { + str[o] = str[i]; + } + i += 1; + } + o += 1; + } + if (o < i) { + str[o] = '\0'; + } +} + +static bool _reply(socketpool_socket_obj_t *socket, _request *request) { + if (request->redirect) { + _reply_redirect(socket, request, request->path); + } else if (strlen(request->origin) > 0 && !_origin_ok(request->origin)) { + ESP_LOGE(TAG, "bad origin %s", request->origin); + _reply_forbidden(socket, request); + } else if (strncmp(request->path, "/fs/", 4) == 0) { + if (strcasecmp(request->method, "OPTIONS") == 0) { + // OPTIONS is sent for CORS preflight, unauthenticated + _reply_access_control(socket, request); + } else if (!request->authenticated) { + if (_api_password[0] != '\0') { + _reply_unauthorized(socket, request); + } else { + _reply_forbidden(socket, request); + } + } else { + // Decode any percent encoded bytes so that we're left with UTF-8. + // We only do this on /fs/ paths and after redirect so that any + // path echoing we do stays encoded. + _decode_percents(request->path); + + char *path = request->path + 3; + size_t pathlen = strlen(path); + FATFS *fs = filesystem_circuitpy(); + // Trailing / is a directory. + bool directory = false; + if (path[pathlen - 1] == '/') { + // FATFS lib doesn't like a trailing / for paths besides root. + if (pathlen > 1) { + path[pathlen - 1] = '\0'; + } + directory = true; + } + // Delete is almost identical for files and directories so share the + // implementation. + if (strcasecmp(request->method, "DELETE") == 0) { + if (_usb_active()) { + _reply_conflict(socket, request); + return false; + } + + FILINFO file; + FRESULT result = f_stat(fs, path, &file); + if (result == FR_OK) { + if ((file.fattrib & AM_DIR) != 0) { + result = supervisor_workflow_delete_directory_contents(fs, path); + } + if (result == FR_OK) { + result = f_unlink(fs, path); + } + } + + #if CIRCUITPY_USB_MSC + usb_msc_unlock(); + #endif + if (result == FR_NO_PATH || result == FR_NO_FILE) { + _reply_missing(socket, request); + } else if (result != FR_OK) { + ESP_LOGE(TAG, "rm error %d %s", result, path); + _reply_server_error(socket, request); + } else { + _reply_no_content(socket, request); + return true; + } + } else if (strcasecmp(request->method, "MOVE") == 0) { + if (_usb_active()) { + _reply_conflict(socket, request); + return false; + } + + _decode_percents(request->destination); + char *destination = request->destination + 3; + size_t destinationlen = strlen(destination); + if (destination[destinationlen - 1] == '/' && destinationlen > 1) { + destination[destinationlen - 1] = '\0'; + } + + FRESULT result = f_rename(fs, path, destination); + #if CIRCUITPY_USB_MSC + usb_msc_unlock(); + #endif + if (result == FR_EXIST) { // File exists and won't be overwritten. + _reply_precondition_failed(socket, request); + } else if (result == FR_NO_PATH || result == FR_NO_FILE) { // Missing higher directories or target file. + _reply_missing(socket, request); + } else if (result != FR_OK) { + ESP_LOGE(TAG, "move error %d %s", result, path); + _reply_server_error(socket, request); + } else { + _reply_created(socket, request); + return true; + } + } else if (directory) { + if (strcasecmp(request->method, "GET") == 0) { + FF_DIR dir; + FRESULT res = f_opendir(fs, &dir, path); + // Put the / back for replies. + if (pathlen > 1) { + path[pathlen - 1] = '/'; + } + if (res != FR_OK) { + _reply_missing(socket, request); + return false; + } + if (request->json) { + _reply_directory_json(socket, request, &dir, request->path, path); + } else if (pathlen == 1) { + _REPLY_STATIC(socket, request, directory_html); + } else { + _reply_missing(socket, request); + } + + f_closedir(&dir); + } else if (strcasecmp(request->method, "PUT") == 0) { + if (_usb_active()) { + _reply_conflict(socket, request); + return false; + } + + if (request->timestamp_ms > 0) { + DWORD fattime; + truncate_time(request->timestamp_ms * 1000000, &fattime); + override_fattime(fattime); + } + FRESULT result = supervisor_workflow_mkdir_parents(fs, path); + override_fattime(0); + #if CIRCUITPY_USB_MSC + usb_msc_unlock(); + #endif + if (result == FR_EXIST) { + _reply_no_content(socket, request); + } else if (result == FR_NO_PATH) { + _reply_missing(socket, request); + } else if (result != FR_OK) { + ESP_LOGE(TAG, "mkdir error %d %s", result, path); + _reply_server_error(socket, request); + } else { + _reply_created(socket, request); + return true; + } + } + } else { // Dealing with a file. + if (strcasecmp(request->method, "GET") == 0) { + FIL active_file; + FRESULT result = f_open(fs, &active_file, path, FA_READ); + + if (result != FR_OK) { + _reply_missing(socket, request); + } else { + _reply_with_file(socket, request, path, &active_file); + } + + f_close(&active_file); + } else if (strcasecmp(request->method, "PUT") == 0) { + _write_file_and_reply(socket, request, fs, path); + return true; + } + } + } + } else if (strcmp(request->path, "/edit/") == 0) { + if (!request->authenticated) { + if (_api_password[0] != '\0') { + _reply_unauthorized(socket, request); + } else { + _reply_forbidden(socket, request); + } + } else { + _REPLY_STATIC(socket, request, edit_html); + } + } else if (strcmp(request->path, "/code/") == 0) { + _REPLY_STATIC(socket, request, code_html); + } else if (strncmp(request->path, "/cp/", 4) == 0) { + const char *path = request->path + 3; + if (strcasecmp(request->method, "OPTIONS") == 0) { + // handle preflight requests to /cp/ + _reply_access_control(socket, request); + } else if (strcasecmp(request->method, "GET") != 0) { + _reply_method_not_allowed(socket, request); + } else if (strcmp(path, "/devices.json") == 0) { + _reply_with_devices_json(socket, request); + } else if (strcmp(path, "/version.json") == 0) { + _reply_with_version_json(socket, request); + } else if (strcmp(path, "/serial/") == 0) { + if (!request->authenticated) { + if (_api_password[0] != '\0') { + _reply_unauthorized(socket, request); + } else { + _reply_forbidden(socket, request); + } + } else if (request->websocket) { + _reply_websocket_upgrade(socket, request); + } else { + _REPLY_STATIC(socket, request, serial_html); + } + } else { + _reply_missing(socket, request); + } + } else if (strcasecmp(request->method, "GET") != 0) { + _reply_method_not_allowed(socket, request); + } else { + if (strcmp(request->path, "/") == 0) { + // TODO: Autogenerate this based on the blinka bitmap and change the + // palette based on MAC address. + _REPLY_STATIC(socket, request, welcome_html); + } else if (strcmp(request->path, "/directory.js") == 0) { + _REPLY_STATIC(socket, request, directory_js); + } else if (strcmp(request->path, "/welcome.js") == 0) { + _REPLY_STATIC(socket, request, welcome_js); + } else if (strcmp(request->path, "/serial.js") == 0) { + _REPLY_STATIC(socket, request, serial_js); + } else if (strcmp(request->path, "/edit.js") == 0) { + _REPLY_STATIC(socket, request, edit_js); + } else if (strcmp(request->path, "/style.css") == 0) { + _REPLY_STATIC(socket, request, style_css); + } else if (strcmp(request->path, "/favicon.ico") == 0) { + // TODO: Autogenerate this based on the blinka bitmap and change the + // palette based on MAC address. + _REPLY_STATIC(socket, request, blinka_16x16_ico); + } else { + _reply_missing(socket, request); + } + } + return false; +} + +static void _reset_request(_request *request) { + request->state = STATE_METHOD; + request->origin[0] = '\0'; + request->content_length = 0; + request->offset = 0; + request->timestamp_ms = 0; + request->redirect = false; + request->done = false; + request->in_progress = false; + request->authenticated = false; + request->expect = false; + request->json = false; + request->websocket = false; +} + +static void _process_request(socketpool_socket_obj_t *socket, _request *request) { + bool more = true; + bool error = false; + uint8_t c; + // This code assumes header lines are terminated with \r\n + while (more && !error) { + int len = socketpool_socket_recv_into(socket, &c, 1); + if (len != 1) { + more = false; + break; + } + if (!request->in_progress) { + autoreload_suspend(AUTORELOAD_SUSPEND_WEB); + request->in_progress = true; + } + switch (request->state) { + case STATE_METHOD: { + if (c == ' ') { + request->method[request->offset] = '\0'; + request->offset = 0; + request->state = STATE_PATH; + } else if (request->offset > sizeof(request->method) - 1) { + // Skip methods that are too long. + } else { + request->method[request->offset] = c; + request->offset++; + } + break; + } + case STATE_PATH: { + if (c == ' ') { + request->path[request->offset] = '\0'; + request->offset = 0; + ESP_LOGI(TAG, "Request %s %s", request->method, request->path); + request->state = STATE_VERSION; + } else if (request->offset > sizeof(request->path) - 1) { + // Skip methods that are too long. + } else { + request->path[request->offset] = c; + request->offset++; + } + break; + } + case STATE_VERSION: { + const char *supported_version = "HTTP/1.1\r"; + error = supported_version[request->offset] != c; + request->offset++; + if (request->offset == strlen(supported_version)) { + request->state = STATE_HEADER_KEY; + request->offset = 0; + } + break; + } + case STATE_HEADER_KEY: { + if (c == '\r') { + request->state = STATE_BODY; + } else if (c == '\n') { + // Consume the \n + } else if (c == ':') { + request->header_key[request->offset] = '\0'; + request->offset = 0; + request->state = STATE_HEADER_VALUE; + } else if (request->offset > sizeof(request->header_key) - 1) { + // Skip methods that are too long. + } else { + request->header_key[request->offset] = c; + request->offset++; + } + break; + } + case STATE_HEADER_VALUE: { + if (request->offset == 0) { + error = c != ' '; + request->offset++; + } else if (c == '\r') { + request->header_value[request->offset - 1] = '\0'; + request->offset = 0; + request->state = STATE_HEADER_KEY; + if (strcasecmp(request->header_key, "Authorization") == 0) { + const char *prefix = "Basic "; + request->authenticated = strncmp(request->header_value, prefix, strlen(prefix)) == 0 && + strcmp(_api_password, request->header_value + strlen(prefix)) == 0; + } else if (strcasecmp(request->header_key, "Host") == 0) { + // Do a prefix check so that port is ignored. Length must be the same or the + // header ends in :. + const char *cp_local = "circuitpython.local"; + request->redirect = strncmp(request->header_value, cp_local, strlen(cp_local)) == 0 && + (strlen(request->header_value) == strlen(cp_local) || + request->header_value[strlen(cp_local)] == ':'); + } else if (strcasecmp(request->header_key, "Content-Length") == 0) { + request->content_length = strtoul(request->header_value, NULL, 10); + } else if (strcasecmp(request->header_key, "Expect") == 0) { + request->expect = strcmp(request->header_value, "100-continue") == 0; + } else if (strcasecmp(request->header_key, "Accept") == 0) { + request->json = strcasecmp(request->header_value, "application/json") == 0; + } else if (strcasecmp(request->header_key, "Origin") == 0) { + strcpy(request->origin, request->header_value); + } else if (strcasecmp(request->header_key, "X-Timestamp") == 0) { + request->timestamp_ms = strtoull(request->header_value, NULL, 10); + } else if (strcasecmp(request->header_key, "Upgrade") == 0) { + request->websocket = strcmp(request->header_value, "websocket") == 0; + } else if (strcasecmp(request->header_key, "Sec-WebSocket-Version") == 0) { + request->websocket_version = strtoul(request->header_value, NULL, 10); + } else if (strcasecmp(request->header_key, "Sec-WebSocket-Key") == 0 && + strlen(request->header_value) == 24) { + strcpy(request->websocket_key, request->header_value); + } else if (strcasecmp(request->header_key, "X-Destination") == 0) { + strcpy(request->destination, request->header_value); + } + ESP_LOGI(TAG, "Header %s %s", request->header_key, request->header_value); + } else if (request->offset > sizeof(request->header_value) - 1) { + // Skip methods that are too long. + } else { + request->header_value[request->offset - 1] = c; + request->offset++; + } + break; + } + case STATE_BODY: + request->done = true; + more = false; + break; + } + } + if (error) { + const char *error_response = "HTTP/1.1 501 Not Implemented\r\n\r\n"; + int nodelay = 1; + lwip_setsockopt(socket->num, IPPROTO_TCP, TCP_NODELAY, &nodelay, sizeof(nodelay)); + socketpool_socket_send(socket, (const uint8_t *)error_response, strlen(error_response)); + } + if (!request->done) { + return; + } + bool reload = _reply(socket, request); + _reset_request(request); + autoreload_resume(AUTORELOAD_SUSPEND_WEB); + if (reload) { + autoreload_trigger(); + } +} + + +void supervisor_web_workflow_background(void) { + // Otherwise, see if we have another socket to accept. + if ((!common_hal_socketpool_socket_get_connected(&active) || !active_request.in_progress) && + !common_hal_socketpool_socket_get_closed(&listening) && + listening.num > 0) { + uint32_t ip; + uint32_t port; + int newsoc = socketpool_socket_accept(&listening, (uint8_t *)&ip, &port); + if (newsoc == -EBADF) { + common_hal_socketpool_socket_close(&listening); + return; + } + if (newsoc > 0) { + // Close the active socket because we have another we accepted. + if (!common_hal_socketpool_socket_get_closed(&active)) { + common_hal_socketpool_socket_close(&active); + } + // TODO: Don't do this because it uses the private struct layout. + // Create the socket + active.num = newsoc; + active.pool = &pool; + active.connected = true; + + common_hal_socketpool_socket_settimeout(&active, 0); + + _reset_request(&active_request); + + lwip_fcntl(newsoc, F_SETFL, O_NONBLOCK); + } + } + + // If we have a request in progress, continue working on it. + if (common_hal_socketpool_socket_get_connected(&active)) { + _process_request(&active, &active_request); + } else { + // Close the active socket if it is no longer connected. + common_hal_socketpool_socket_close(&active); + } + + websocket_background(); +} + +void supervisor_stop_web_workflow(void) { +} diff --git a/supervisor/shared/web_workflow/web_workflow.h b/supervisor/shared/web_workflow/web_workflow.h new file mode 100644 index 0000000000..166219c876 --- /dev/null +++ b/supervisor/shared/web_workflow/web_workflow.h @@ -0,0 +1,42 @@ +/* + * This file is part of the MicroPython project, http://micropython.org/ + * + * The MIT License (MIT) + * + * Copyright (c) 2022 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. + */ + +#pragma once + +#include + +#include "shared-bindings/socketpool/Socket.h" + +// This background function should be called repeatedly. It cannot be done based +// on events. +void supervisor_web_workflow_background(void); +bool supervisor_web_workflow_status_dirty(void); +void supervisor_web_workflow_status(void); +void supervisor_start_web_workflow(void); +void supervisor_stop_web_workflow(void); + +// To share with websocket. +void web_workflow_send_raw(socketpool_socket_obj_t *socket, const uint8_t *buf, int len); diff --git a/supervisor/shared/web_workflow/websocket.c b/supervisor/shared/web_workflow/websocket.c new file mode 100644 index 0000000000..3901c4eefe --- /dev/null +++ b/supervisor/shared/web_workflow/websocket.c @@ -0,0 +1,266 @@ +/* + * This file is part of the MicroPython project, http://micropython.org/ + * + * The MIT License (MIT) + * + * Copyright (c) 2022 Scott Shawcroft for Adafruit Industries + * + * Permission is hereby granted, free of charge, to any person obtaining a copy + * of this software and associated documentation files (the "Software"), to deal + * in the Software without restriction, including without limitation the rights + * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell + * copies of the Software, and to permit persons to whom the Software is + * furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice shall be included in + * all copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE + * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER + * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, + * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN + * THE SOFTWARE. + */ + +#include "supervisor/shared/web_workflow/websocket.h" + +#include "py/ringbuf.h" +#include "py/runtime.h" +#include "shared/runtime/interrupt_char.h" +#include "supervisor/shared/web_workflow/web_workflow.h" + +#if CIRCUITPY_STATUS_BAR +#include "supervisor/shared/status_bar.h" +#endif + +// TODO: Remove ESP specific stuff. For now, it is useful as we refine the server. +#include "esp_log.h" + +typedef struct { + socketpool_socket_obj_t socket; + uint8_t opcode; + uint8_t frame_len; + uint8_t payload_len_size; + bool masked; + bool closed; + uint8_t mask[4]; + int frame_index; + size_t payload_remaining; +} _websocket; + +// Buffer the incoming serial data in the background so that we can look for the +// interrupt character. +STATIC ringbuf_t _incoming_ringbuf; +STATIC uint8_t _buf[16]; + +static _websocket cp_serial; + +static const char *TAG = "CP websocket"; + +void websocket_init(void) { + cp_serial.socket.num = -1; + cp_serial.socket.connected = false; + + ringbuf_init(&_incoming_ringbuf, _buf, sizeof(_buf) - 1); +} + +void websocket_handoff(socketpool_socket_obj_t *socket) { + cp_serial.socket = *socket; + cp_serial.closed = false; + cp_serial.opcode = 0; + cp_serial.frame_index = 0; + cp_serial.frame_len = 2; + // Mark the original socket object as closed without telling the lower level. + socket->connected = false; + socket->num = -1; + + #if CIRCUITPY_STATUS_BAR + // Send the title bar for the new client. + supervisor_status_bar_request_update(true); + #endif +} + +bool websocket_connected(void) { + return _incoming_ringbuf.size > 0 && !cp_serial.closed && common_hal_socketpool_socket_get_connected(&cp_serial.socket); +} + +static bool _read_byte(uint8_t *c) { + int len = socketpool_socket_recv_into(&cp_serial.socket, c, 1); + if (len != 1) { + if (len != -EAGAIN) { + ESP_LOGE(TAG, "recv error %d", len); + } + return false; + } + return true; +} + +static void _read_next_frame_header(void) { + uint8_t h; + if (cp_serial.frame_index == 0 && _read_byte(&h)) { + cp_serial.frame_index++; + cp_serial.opcode = h & 0xf; + } + if (cp_serial.frame_index == 1 && _read_byte(&h)) { + cp_serial.frame_index++; + uint8_t len = h & 0x7f; + cp_serial.masked = (h >> 7) == 1; + if (len <= 125) { + cp_serial.payload_remaining = len; + cp_serial.payload_len_size = 0; + } else if (len == 126) { // 16 bit length + cp_serial.payload_len_size = 2; + } else if (len == 127) { // 64 bit length + cp_serial.payload_len_size = 8; + } + cp_serial.frame_len = 2 + cp_serial.payload_len_size; + if (cp_serial.masked) { + cp_serial.frame_len += 4; + } + } + while (cp_serial.frame_index >= 2 && + cp_serial.frame_index < (cp_serial.payload_len_size + 2) && + _read_byte(&h)) { + cp_serial.frame_index++; + cp_serial.payload_remaining = cp_serial.payload_remaining << 8 | h; + } + int mask_start = cp_serial.payload_len_size + 2; + while (cp_serial.frame_index >= mask_start && + cp_serial.frame_index < cp_serial.frame_len && + _read_byte(&h)) { + size_t mask_offset = cp_serial.frame_index - mask_start; + cp_serial.mask[mask_offset] = h; + cp_serial.frame_index++; + } + // Reply to PINGs and CLOSE. + while ((cp_serial.opcode == 0x8 || + cp_serial.opcode == 0x9) && + cp_serial.frame_index >= cp_serial.frame_len) { + + if (cp_serial.frame_index == cp_serial.frame_len) { + uint8_t opcode = 0x8; // CLOSE + if (cp_serial.opcode == 0x9) { + opcode = 0xA; // PONG + } else { + // Set the TCP socket to send immediately so that we send the payload back before + // closing the connection. + int nodelay = 1; + lwip_setsockopt(cp_serial.socket.num, IPPROTO_TCP, TCP_NODELAY, &nodelay, sizeof(nodelay)); + } + uint8_t frame_header[2]; + frame_header[0] = 1 << 7 | opcode; + if (cp_serial.payload_remaining > 125) { + ESP_LOGE(TAG, "CLOSE or PING has long payload"); + } + frame_header[1] = cp_serial.payload_remaining; + web_workflow_send_raw(&cp_serial.socket, (const uint8_t *)frame_header, 2); + } + + if (cp_serial.payload_remaining > 0 && _read_byte(&h)) { + // Send the payload back to the client. + cp_serial.frame_index++; + cp_serial.payload_remaining--; + web_workflow_send_raw(&cp_serial.socket, &h, 1); + } + + if (cp_serial.payload_remaining == 0) { + cp_serial.frame_index = 0; + if (cp_serial.opcode == 0x8) { + cp_serial.closed = true; + + common_hal_socketpool_socket_close(&cp_serial.socket); + } + } + } +} + +static bool _read_next_payload_byte(uint8_t *c) { + _read_next_frame_header(); + if (cp_serial.opcode == 0x1 && + cp_serial.frame_index >= cp_serial.frame_len && + cp_serial.payload_remaining > 0) { + if (_read_byte(c)) { + uint8_t mask_offset = (cp_serial.frame_index - cp_serial.frame_len) % 4; + *c ^= cp_serial.mask[mask_offset]; + cp_serial.frame_index++; + cp_serial.payload_remaining--; + if (cp_serial.payload_remaining == 0) { + cp_serial.frame_index = 0; + } + return true; + } + } + return false; +} + +bool websocket_available(void) { + if (!websocket_connected()) { + return false; + } + websocket_background(); + return ringbuf_num_filled(&_incoming_ringbuf) > 0; +} + +char websocket_read_char(void) { + websocket_background(); + if (ringbuf_num_filled(&_incoming_ringbuf) > 0) { + return ringbuf_get(&_incoming_ringbuf); + } + return -1; +} + +static void _websocket_send(_websocket *ws, const char *text, size_t len) { + if (!websocket_connected()) { + return; + } + uint32_t opcode = 1; + uint8_t frame_header[2]; + frame_header[0] = 1 << 7 | opcode; + uint8_t payload_len; + if (len <= 125) { + payload_len = len; + } else if (len < (1 << 16)) { + payload_len = 126; + } else { + payload_len = 127; + } + frame_header[1] = payload_len; + web_workflow_send_raw(&ws->socket, (const uint8_t *)frame_header, 2); + uint8_t extended_len[4]; + if (payload_len == 126) { + extended_len[0] = (len >> 8) & 0xff; + extended_len[1] = len & 0xff; + web_workflow_send_raw(&ws->socket, extended_len, 2); + } else if (payload_len == 127) { + uint32_t zero = 0; + // 64 bits where top four bytes are zero. + web_workflow_send_raw(&ws->socket, (const uint8_t *)&zero, 4); + extended_len[0] = (len >> 24) & 0xff; + extended_len[1] = (len >> 16) & 0xff; + extended_len[2] = (len >> 8) & 0xff; + extended_len[3] = len & 0xff; + web_workflow_send_raw(&ws->socket, extended_len, 4); + } + web_workflow_send_raw(&ws->socket, (const uint8_t *)text, len); +} + +void websocket_write(const char *text, size_t len) { + _websocket_send(&cp_serial, text, len); +} + +void websocket_background(void) { + if (!websocket_connected()) { + return; + } + uint8_t c; + while (ringbuf_num_empty(&_incoming_ringbuf) > 0 && + _read_next_payload_byte(&c)) { + if (c == mp_interrupt_char) { + mp_sched_keyboard_interrupt(); + continue; + } + ringbuf_put(&_incoming_ringbuf, c); + } +} diff --git a/supervisor/shared/web_workflow/websocket.h b/supervisor/shared/web_workflow/websocket.h new file mode 100644 index 0000000000..c3db2bf05c --- /dev/null +++ b/supervisor/shared/web_workflow/websocket.h @@ -0,0 +1,39 @@ +/* + * This file is part of the MicroPython project, http://micropython.org/ + * + * The MIT License (MIT) + * + * Copyright (c) 2022 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. + */ + +#pragma once + +#include + +#include "shared-bindings/socketpool/Socket.h" + +void websocket_init(void); +void websocket_handoff(socketpool_socket_obj_t *socket); +bool websocket_connected(void); +bool websocket_available(void); +char websocket_read_char(void); +void websocket_background(void); +void websocket_write(const char *text, size_t len); diff --git a/supervisor/shared/workflow.c b/supervisor/shared/workflow.c index 8d2c0f74fc..f3bc99cb5e 100644 --- a/supervisor/shared/workflow.c +++ b/supervisor/shared/workflow.c @@ -26,14 +26,56 @@ #include #include "py/mpconfig.h" +#include "py/mpstate.h" +#include "py/stackctrl.h" +#include "supervisor/background_callback.h" #include "supervisor/workflow.h" +#include "supervisor/serial.h" #include "supervisor/shared/workflow.h" +#if CIRCUITPY_BLEIO +#include "shared-bindings/_bleio/__init__.h" +#include "supervisor/shared/bluetooth/bluetooth.h" +#endif + #if CIRCUITPY_USB +#include "supervisor/usb.h" #include "tusb.h" #endif +#if CIRCUITPY_WEB_WORKFLOW +#include "supervisor/shared/web_workflow/web_workflow.h" +#endif +static background_callback_t workflow_background_cb; + +static bool workflow_started = false; + +static void workflow_background(void *data) { + #if CIRCUITPY_WEB_WORKFLOW + supervisor_web_workflow_background(); + #endif +} + +// Called during a VM reset. Doesn't actually reset things. void supervisor_workflow_reset(void) { + #if CIRCUITPY_BLEIO + supervisor_start_bluetooth(); + #endif + + #if CIRCUITPY_WEB_WORKFLOW + supervisor_start_web_workflow(); + #endif + + workflow_background_cb.fun = workflow_background; + workflow_background_cb.data = NULL; + supervisor_workflow_request_background(); +} + +void supervisor_workflow_request_background(void) { + if (!workflow_started) { + return; + } + background_callback_add_core(&workflow_background_cb); } // Return true as soon as USB communication with host has started, @@ -58,3 +100,84 @@ bool supervisor_workflow_active(void) { return false; #endif } + +void supervisor_workflow_start(void) { + // Start USB after giving boot.py a chance to tweak behavior. + #if CIRCUITPY_USB + // Setup USB connection after heap is available. + // It needs the heap to build descriptors. + usb_init(); + #endif + + // Set up any other serial connection. + serial_init(); + + #if CIRCUITPY_BLEIO + bleio_reset(); + supervisor_bluetooth_enable_workflow(); + supervisor_start_bluetooth(); + #endif + + #if CIRCUITPY_WEB_WORKFLOW + supervisor_start_web_workflow(); + #endif + + workflow_started = true; +} + +FRESULT supervisor_workflow_mkdir_parents(FATFS *fs, char *path) { + FRESULT result = FR_OK; + // Make parent directories. + for (size_t j = 1; j < strlen(path); j++) { + if (path[j] == '/') { + path[j] = '\0'; + result = f_mkdir(fs, path); + path[j] = '/'; + if (result != FR_OK && result != FR_EXIST) { + return result; + } + } + } + // Make the target directory. + return f_mkdir(fs, path); +} + +FRESULT supervisor_workflow_delete_directory_contents(FATFS *fs, const TCHAR *path) { + FF_DIR dir; + FILINFO file_info; + // Check the stack since we're putting paths on it. + if (mp_stack_usage() >= MP_STATE_THREAD(stack_limit)) { + return FR_INT_ERR; + } + FRESULT res = FR_OK; + while (res == FR_OK) { + res = f_opendir(fs, &dir, path); + if (res != FR_OK) { + break; + } + res = f_readdir(&dir, &file_info); + // We close and reopen the directory every time since we're deleting + // entries and it may invalidate the directory handle. + f_closedir(&dir); + if (res != FR_OK || file_info.fname[0] == '\0') { + break; + } + size_t pathlen = strlen(path); + size_t fnlen = strlen(file_info.fname); + TCHAR full_path[pathlen + 1 + fnlen]; + memcpy(full_path, path, pathlen); + full_path[pathlen] = '/'; + size_t full_pathlen = pathlen + 1 + fnlen; + memcpy(full_path + pathlen + 1, file_info.fname, fnlen); + full_path[full_pathlen] = '\0'; + if ((file_info.fattrib & AM_DIR) != 0) { + res = supervisor_workflow_delete_directory_contents(fs, full_path); + } + if (res != FR_OK) { + break; + } + res = f_unlink(fs, full_path); + } + f_closedir(&dir); + return res; +} diff --git a/supervisor/shared/workflow.h b/supervisor/shared/workflow.h index b3c817fb8b..df483e0ebc 100644 --- a/supervisor/shared/workflow.h +++ b/supervisor/shared/workflow.h @@ -26,4 +26,10 @@ #pragma once +#include "lib/oofatfs/ff.h" + extern bool supervisor_workflow_connecting(void); + +// File system helpers for workflow code. +FRESULT supervisor_workflow_mkdir_parents(FATFS *fs, char *path); +FRESULT supervisor_workflow_delete_directory_contents(FATFS *fs, const TCHAR *path); diff --git a/supervisor/stub/misc.c b/supervisor/stub/misc.c new file mode 100644 index 0000000000..a17188beff --- /dev/null +++ b/supervisor/stub/misc.c @@ -0,0 +1,33 @@ +/* + * This file is part of the MicroPython project, http://micropython.org/ + * + * The MIT License (MIT) + * + * SPDX-FileCopyrightText: Copyright (c) 2022 Jeff Epler for Adafruit Industries + * + * Permission is hereby granted, free of charge, to any person obtaining a copy + * of this software and associated documentation files (the "Software"), to deal + * in the Software without restriction, including without limitation the rights + * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell + * copies of the Software, and to permit persons to whom the Software is + * furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice shall be included in + * all copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE + * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER + * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, + * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN + * THE SOFTWARE. + */ +#include "stdbool.h" + +#include "supervisor/port.h" +#include "py/mpconfig.h" + + +MP_WEAK void port_post_boot_py(bool heap_valid) { +} diff --git a/supervisor/supervisor.mk b/supervisor/supervisor.mk index f4ca11db43..a8deb9606d 100644 --- a/supervisor/supervisor.mk +++ b/supervisor/supervisor.mk @@ -8,24 +8,44 @@ SRC_SUPERVISOR = \ supervisor/shared/lock.c \ supervisor/shared/memory.c \ supervisor/shared/micropython.c \ + supervisor/shared/port.c \ supervisor/shared/reload.c \ supervisor/shared/safe_mode.c \ - supervisor/shared/serial.c \ + supervisor/shared/serial.c \ supervisor/shared/stack.c \ supervisor/shared/status_leds.c \ supervisor/shared/tick.c \ supervisor/shared/traceback.c \ - supervisor/shared/translate.c \ - supervisor/shared/workflow.c - -ifeq ($(DISABLE_FILESYSTEM),1) -SRC_SUPERVISOR += supervisor/stub/filesystem.c -else -SRC_SUPERVISOR += supervisor/shared/filesystem.c -endif + supervisor/shared/translate/translate.c \ + supervisor/shared/workflow.c \ + supervisor/stub/misc.c \ NO_USB ?= $(wildcard supervisor/usb.c) + +ifeq ($(CIRCUITPY_USB),1) +CIRCUITPY_CREATOR_ID ?= $(USB_VID) +CIRCUITPY_CREATION_ID ?= $(USB_PID) +endif + +ifneq ($(CIRCUITPY_CREATOR_ID),) +CFLAGS += -DCIRCUITPY_CREATOR_ID=$(CIRCUITPY_CREATOR_ID) +endif + +ifneq ($(CIRCUITPY_CREATION_ID),) +CFLAGS += -DCIRCUITPY_CREATION_ID=$(CIRCUITPY_CREATION_ID) +endif + +ifeq ($(CIRCUITPY_BLEIO),1) + SRC_SUPERVISOR += supervisor/shared/bluetooth/bluetooth.c + ifeq ($(CIRCUITPY_BLE_FILE_SERVICE),1) + SRC_SUPERVISOR += supervisor/shared/bluetooth/file_transfer.c + endif + ifeq ($(CIRCUITPY_SERIAL_BLE),1) + SRC_SUPERVISOR += supervisor/shared/bluetooth/serial.c + endif +endif + INTERNAL_FLASH_FILESYSTEM ?= 0 CFLAGS += -DINTERNAL_FLASH_FILESYSTEM=$(INTERNAL_FLASH_FILESYSTEM) @@ -35,18 +55,13 @@ CFLAGS += -DQSPI_FLASH_FILESYSTEM=$(QSPI_FLASH_FILESYSTEM) SPI_FLASH_FILESYSTEM ?= 0 CFLAGS += -DSPI_FLASH_FILESYSTEM=$(SPI_FLASH_FILESYSTEM) -ifeq ($(CIRCUITPY_BLEIO),1) - SRC_SUPERVISOR += supervisor/shared/bluetooth/bluetooth.c - CIRCUITPY_CREATOR_ID ?= $(USB_VID) - CIRCUITPY_CREATION_ID ?= $(USB_PID) - CFLAGS += -DCIRCUITPY_CREATOR_ID=$(CIRCUITPY_CREATOR_ID) - CFLAGS += -DCIRCUITPY_CREATION_ID=$(CIRCUITPY_CREATION_ID) - ifeq ($(CIRCUITPY_BLE_FILE_SERVICE),1) - SRC_SUPERVISOR += supervisor/shared/bluetooth/file_transfer.c - endif - ifeq ($(CIRCUITPY_SERIAL_BLE),1) - SRC_SUPERVISOR += supervisor/shared/bluetooth/serial.c - endif +DISABLE_FILESYSTEM ?= 0 +CFLAGS += -DDISABLE_FILESYSTEM=$(DISABLE_FILESYSTEM) + +ifeq ($(DISABLE_FILESYSTEM),1) +SRC_SUPERVISOR += supervisor/stub/filesystem.c +else +SRC_SUPERVISOR += supervisor/shared/filesystem.c endif # Choose which flash filesystem impl to use. @@ -82,6 +97,12 @@ ifneq ($(wildcard supervisor/serial.c),) SRC_SUPERVISOR += supervisor/serial.c endif +ifeq ($(CIRCUITPY_STATUS_BAR),1) + SRC_SUPERVISOR += \ + supervisor/shared/status_bar.c \ + +endif + ifeq ($(CIRCUITPY_USB),1) SRC_SUPERVISOR += \ lib/tinyusb/src/class/cdc/cdc_device.c \ @@ -146,6 +167,20 @@ ifeq ($(CIRCUITPY_USB),1) endif endif +STATIC_RESOURCES = $(wildcard $(TOP)/supervisor/shared/web_workflow/static/*) + +$(BUILD)/autogen_web_workflow_static.c: ../../tools/gen_web_workflow_static.py $(STATIC_RESOURCES) | $(HEADER_BUILD) + $(STEPECHO) "GEN $@" + $(Q)$(PYTHON) $< \ + --output_c_file $@ \ + $(STATIC_RESOURCES) + +ifeq ($(CIRCUITPY_WEB_WORKFLOW),1) + SRC_SUPERVISOR += supervisor/shared/web_workflow/web_workflow.c \ + supervisor/shared/web_workflow/websocket.c + SRC_SUPERVISOR += $(BUILD)/autogen_web_workflow_static.c +endif + SRC_TINYUSB = $(filter lib/tinyusb/%.c, $(SRC_SUPERVISOR)) $(patsubst %.c,$(BUILD)/%.o,$(SRC_TINYUSB)): CFLAGS += -Wno-missing-prototypes @@ -155,9 +190,8 @@ ifeq ($(CIRCUITPY_DISPLAYIO), 1) SRC_SUPERVISOR += \ supervisor/shared/display.c - ifeq ($(CIRCUITPY_TERMINALIO), 1) - SUPERVISOR_O += $(BUILD)/autogen_display_resources.o - endif + # Include the display resources because it includes the Blinka logo as well. + SUPERVISOR_O += $(BUILD)/autogen_display_resources-$(TRANSLATION).o endif # Preserve double quotes in these values by single-quoting them. @@ -190,14 +224,14 @@ endif USB_HIGHSPEED ?= 0 CFLAGS += -DUSB_HIGHSPEED=$(USB_HIGHSPEED) -$(BUILD)/supervisor/shared/translate.o: $(HEADER_BUILD)/qstrdefs.generated.h +$(BUILD)/supervisor/shared/translate/translate.o: $(HEADER_BUILD)/qstrdefs.generated.h $(HEADER_BUILD)/compression.generated.h CIRCUITPY_DISPLAY_FONT ?= "../../tools/fonts/ter-u12n.bdf" -$(BUILD)/autogen_display_resources.c: ../../tools/gen_display_resources.py $(HEADER_BUILD)/qstrdefs.generated.h Makefile | $(HEADER_BUILD) +$(BUILD)/autogen_display_resources-$(TRANSLATION).c: ../../tools/gen_display_resources.py $(TOP)/locale/$(TRANSLATION).po Makefile | $(HEADER_BUILD) $(STEPECHO) "GEN $@" $(Q)install -d $(BUILD)/genhdr $(Q)$(PYTHON) ../../tools/gen_display_resources.py \ --font $(CIRCUITPY_DISPLAY_FONT) \ - --sample_file $(HEADER_BUILD)/qstrdefs.generated.h \ - --output_c_file $(BUILD)/autogen_display_resources.c + --sample_file $(TOP)/locale/$(TRANSLATION).po \ + --output_c_file $@ diff --git a/supervisor/usb.h b/supervisor/usb.h index 420f42391b..3c8da6f3b7 100644 --- a/supervisor/usb.h +++ b/supervisor/usb.h @@ -31,6 +31,8 @@ #include #include +#include "supervisor/memory.h" + // Ports must call this as frequently as they can in order to keep the USB // connection alive and responsive. Normally this is called from background // tasks after the USB IRQ handler is executed, but in specific circumstances @@ -58,10 +60,19 @@ typedef struct { size_t num_out_endpoints; } descriptor_counts_t; +typedef struct { + uint16_t vid; + uint16_t pid; + char manufacturer_name[128]; + char product_name[128]; +} usb_identification_t; + +extern supervisor_allocation *usb_identification_allocation; + // Shared implementation. bool usb_enabled(void); void usb_add_interface_string(uint8_t interface_string_index, const char str[]); -void usb_build_descriptors(void); +void usb_build_descriptors(const usb_identification_t *identification); void usb_disconnect(void); void usb_init(void); void usb_set_defaults(void); diff --git a/supervisor/workflow.h b/supervisor/workflow.h index 31900392cd..f550f8e88c 100755 --- a/supervisor/workflow.h +++ b/supervisor/workflow.h @@ -30,3 +30,7 @@ void supervisor_workflow_reset(void); // True when the user could be actively iterating on their code. bool supervisor_workflow_active(void); + +void supervisor_workflow_request_background(void); + +void supervisor_workflow_start(void); diff --git a/tests/circuitpython/dotenv_test.env b/tests/circuitpython/dotenv_test.env new file mode 100644 index 0000000000..e3bc23d6ce --- /dev/null +++ b/tests/circuitpython/dotenv_test.env @@ -0,0 +1,25 @@ +# Key "notpresent" is not present + # comment preceded by spaces +plain_value=value +value_with_comment=value # value followed by a comment +quoted_value='value' +quoted_value_with_comment='value' # quoted value followed by a comment +should_be_none +should_be_empty_string= +should_be_hash=# +quoted_should_be_empty_string='' +duplicate_key=wrong +duplicate_key=right +value_with_hash=value#value +quoted_value_with_hash='value#value' +multi_line_value='multi +line' + space_before_key=value +space_before_value= value +space_before_hash_value= #value +space_after_key =value +space_after_key_before_value = value +quoted_then_comment='value'#comment +hash_with_spaces=#value value +aa🐍bb=key with emoji +value_with_emoji=aa🐍bb diff --git a/tests/circuitpython/dotenv_test.py b/tests/circuitpython/dotenv_test.py new file mode 100644 index 0000000000..f217b72dbe --- /dev/null +++ b/tests/circuitpython/dotenv_test.py @@ -0,0 +1,27 @@ +import dotenv + +FILE = __file__.rsplit(".", 1)[0] + ".env" + +print(f"notpresent={dotenv.get_key(FILE, 'notpresent')}") +print(f"plain_value={dotenv.get_key(FILE, 'plain_value')}") +print(f"value_with_comment={dotenv.get_key(FILE, 'value_with_comment')}") +print(f"quoted_value={dotenv.get_key(FILE, 'quoted_value')}") +print(f"quoted_value_with_comment={dotenv.get_key(FILE, 'quoted_value_with_comment')}") +print(f"should_be_none={dotenv.get_key(FILE, 'should_be_none')}") +print(f"should_be_empty_string={dotenv.get_key(FILE, 'should_be_empty_string')}") +print(f"should_be_hash={dotenv.get_key(FILE, 'should_be_hash')}") +print(f"quoted_should_be_empty_string={dotenv.get_key(FILE, 'quoted_should_be_empty_string')}") +print(f"duplicate_key={dotenv.get_key(FILE, 'duplicate_key')}") +### This is the a difference from CPython dotenv. The trailing #value is taken as a comment. +print(f"value_with_hash={dotenv.get_key(FILE, 'value_with_hash')}") +print(f"quoted_value_with_hash={dotenv.get_key(FILE, 'quoted_value_with_hash')}") +print(f"multi_line_value={dotenv.get_key(FILE, 'multi_line_value')}") +print(f"space_before_key={dotenv.get_key(FILE, 'space_before_key')}") +print(f"space_before_value={dotenv.get_key(FILE, 'space_before_value')}") +print(f"space_before_hash_value={dotenv.get_key(FILE, 'space_before_hash_value')}") +print(f"space_after_key={dotenv.get_key(FILE, 'space_after_key')}") +print(f"space_after_key_before_value={dotenv.get_key(FILE, 'space_after_key_before_value')}") +print(f"quoted_then_comment={dotenv.get_key(FILE, 'quoted_then_comment')}") +print(f"hash_with_spaces={dotenv.get_key(FILE, 'hash_with_spaces')}") +print(f"aa🐍bb={dotenv.get_key(FILE, 'aa🐍bb')}") +print(f"value_with_emoji={dotenv.get_key(FILE, 'value_with_emoji')}") diff --git a/tests/circuitpython/dotenv_test.py.exp b/tests/circuitpython/dotenv_test.py.exp new file mode 100644 index 0000000000..d67d570999 --- /dev/null +++ b/tests/circuitpython/dotenv_test.py.exp @@ -0,0 +1,23 @@ +notpresent=None +plain_value=value +value_with_comment=value +quoted_value=value +quoted_value_with_comment=value +should_be_none=None +should_be_empty_string= +should_be_hash=# +quoted_should_be_empty_string= +duplicate_key=right +value_with_hash=value +quoted_value_with_hash=value#value +multi_line_value=multi +line +space_before_key=value +space_before_value=value +space_before_hash_value=#value +space_after_key=value +space_after_key_before_value=value +quoted_then_comment=value +hash_with_spaces=#value value +aa🐍bb=key with emoji +value_with_emoji=aa🐍bb diff --git a/tests/extmod/qrio.py b/tests/extmod/qrio.py index 5e9ed4c12a..53c83706f8 100644 --- a/tests/extmod/qrio.py +++ b/tests/extmod/qrio.py @@ -5,7 +5,7 @@ except: raise SystemExit loc = __file__.rsplit("/", 1)[0] -with open(f"{loc}/data/qr.pgm") as f: +with open(f"{loc}/data/qr.pgm", "rb") as f: content = f.read()[-320 * 240 :] decoder = qrio.QRDecoder(320, 240) diff --git a/tests/float/float_format_ftoe.py b/tests/float/float_format_ftoe.py new file mode 100644 index 0000000000..bc4e5a4a53 --- /dev/null +++ b/tests/float/float_format_ftoe.py @@ -0,0 +1,4 @@ +# check a case where rounding was suppressed inappropriately when "f" was +# promoted to "e" for large numbers. +v = 8.888e32 +print("%.2f" % v) # '%.2f' format with e32 becomes '%.2e', expect 8.89e+32. diff --git a/tests/float/float_format_ftoe.py.exp b/tests/float/float_format_ftoe.py.exp new file mode 100644 index 0000000000..f8b1deb3ec --- /dev/null +++ b/tests/float/float_format_ftoe.py.exp @@ -0,0 +1 @@ +8.89e+32 diff --git a/tests/float/float_format_ints.py b/tests/float/float_format_ints.py new file mode 100644 index 0000000000..0bf4baf12d --- /dev/null +++ b/tests/float/float_format_ints.py @@ -0,0 +1,31 @@ +# Test that integers format to exact values. + +for b in [13, 123, 457, 23456]: + for r in range(1, 10): + e_fmt = "{:." + str(r) + "e}" + f_fmt = "{:." + str(r) + "f}" + g_fmt = "{:." + str(r) + "g}" + for e in range(0, 5): + f = b * (10**e) + title = str(b) + " x 10^" + str(e) + print(title, "with format", e_fmt, "gives", e_fmt.format(f)) + print(title, "with format", f_fmt, "gives", f_fmt.format(f)) + print(title, "with format", g_fmt, "gives", g_fmt.format(f)) + +# Check that powers of 10 (that fit in float32) format correctly. +for i in range(31): + # It works to 12 digits on all platforms *except* qemu-arm, where + # 10^11 comes out as 10000000820 or something. + print("{:.7g}".format(float("1e" + str(i)))) + +# 16777215 is 2^24 - 1, the largest integer that can be completely held +# in a float32. +print("{:f}".format(16777215)) +# 4294967040 = 16777215 * 128 is the largest integer that is exactly +# represented by a float32 and that will also fit within a (signed) int32. +# The upper bound of our integer-handling code is actually double this, +# but that constant might cause trouble on systems using 32 bit ints. +print("{:f}".format(2147483520)) +# Very large positive integers can be a test for precision and resolution. +# This is a weird way to represent 1e38 (largest power of 10 for float32). +print("{:.6e}".format(float("9" * 30 + "e8"))) diff --git a/tests/float/float_format_ints_doubleprec.py b/tests/float/float_format_ints_doubleprec.py new file mode 100644 index 0000000000..57899d6d65 --- /dev/null +++ b/tests/float/float_format_ints_doubleprec.py @@ -0,0 +1,15 @@ +# Test formatting of very large ints. +# Relies on double-precision floats. + +import array +import sys + +# Challenging way to express 1e200 and 1e100. +print("{:.12e}".format(float("9" * 400 + "e-200"))) +print("{:.12e}".format(float("9" * 400 + "e-300"))) + +# These correspond to the binary representation of 1e200 in float64s: +v1 = 0x54B249AD2594C37D # 1e100 +v2 = 0x6974E718D7D7625A # 1e200 +print("{:.12e}".format(array.array("d", v1.to_bytes(8, sys.byteorder))[0])) +print("{:.12e}".format(array.array("d", v2.to_bytes(8, sys.byteorder))[0])) diff --git a/tests/micropython/import_mpy_invalid.py.exp b/tests/micropython/import_mpy_invalid.py.exp index ebf72c293c..432287028e 100644 --- a/tests/micropython/import_mpy_invalid.py.exp +++ b/tests/micropython/import_mpy_invalid.py.exp @@ -1,4 +1,4 @@ mod0 RuntimeError Corrupt .mpy file mod1 RuntimeError Corrupt .mpy file -mod2 MpyError Incompatible .mpy file. Please update all .mpy files. See http://adafru.it/mpy-update for more info. -mod3 MpyError Incompatible .mpy file. Please update all .mpy files. See http://adafru.it/mpy-update for more info. +mod2 ValueError Incompatible .mpy file. Please update all .mpy files. See http://adafru.it/mpy-update for more info. +mod3 ValueError Incompatible .mpy file. Please update all .mpy files. See http://adafru.it/mpy-update for more info. diff --git a/tests/run-tests.py b/tests/run-tests.py index a6d08aabb3..751b70886a 100755 --- a/tests/run-tests.py +++ b/tests/run-tests.py @@ -426,6 +426,7 @@ def run_tests(pyb, tests, args, result_dir, num_threads=1): if upy_float_precision < 64: skip_tests.add("float/float_divmod.py") # tested by float/float_divmod_relaxed.py instead skip_tests.add("float/float2int_doubleprec_intbig.py") + skip_tests.add("float/float_format_ints_doubleprec.py") skip_tests.add("float/float_parse_doubleprec.py") if not has_complex: diff --git a/tests/unix/extra_coverage.py.exp b/tests/unix/extra_coverage.py.exp index 98e56439ef..782ab95cc8 100644 --- a/tests/unix/extra_coverage.py.exp +++ b/tests/unix/extra_coverage.py.exp @@ -32,13 +32,14 @@ mport builtins micropython _asyncio _thread _uasyncio aesio array binascii bitmaptools btree cexample cmath -collections cppexample displayio errno -ffi framebuf gc gifio -hashlib json math qrio -rainbowio re sys termios -traceback ubinascii uctypes uerrno -uheapq uio ujson ulab -ulab.fft ulab.linalg ulab.numpy ulab.scipy +collections cppexample displayio dotenv +errno ffi framebuf gc +gifio hashlib json math +qrio rainbowio re sys +termios traceback ubinascii uctypes +uerrno uheapq uio ujson +ulab ulab.numpy ulab.numpy.fft +ulab.numpy.linalg ulab.scipy ulab.scipy.linalg ulab.scipy.optimize ulab.scipy.signal ulab.scipy.special ulab.utils uos urandom ure diff --git a/tools/black_bindings.py b/tools/black_bindings.py new file mode 100755 index 0000000000..1c6fa3cfe8 --- /dev/null +++ b/tools/black_bindings.py @@ -0,0 +1,129 @@ +#!/usr/bin/python3 +import os +import re +import subprocess +import sys +from concurrent.futures import ThreadPoolExecutor +from dataclasses import dataclass +from enum import Enum, auto + +MARK_C_IN_PY = "##| " +MARK_PY_IN_C = "//| " + + +class Mode(Enum): + C = auto() + PY = auto() + + +@dataclass(frozen=True) +class LineWithMode: + data: str + mode: Mode + + +class OutputWriter: + def __init__(self): + self.content = [] + + def write(self, line): + self.content.append(line.rstrip()) + + def getcontent(self): + return "\n".join(self.content) + + +class PythonOutputWriter(OutputWriter): + def write(self, line): + if isinstance(line, str): + super().write(line) + elif line.mode == Mode.PY: + super().write(line.data) + else: # line mode is C + super().write(MARK_C_IN_PY + line.data) + + +class COutputWriter(OutputWriter): + def write(self, line): + if isinstance(line, str): + super().write(line) + elif line.mode == Mode.PY: + super().write(MARK_PY_IN_C + line.data) + else: # line mode is C + super().write(line.data) + + +def parse_line(line, defmode, mark, smark, markmode): + sline = line.strip() + if sline == smark or sline.startswith(mark): + return LineWithMode(sline[len(mark) :], markmode) + else: + return LineWithMode(line, defmode) + + +def parse_lines(lines, defmode, mark, markmode): + smark = mark.strip() + return [parse_line(line, defmode, mark, smark, markmode) for line in lines] + + +def swap_comment_markers(content, input_mode): + lines = content.rstrip().split("\n") + + if input_mode == Mode.C: + parsed = parse_lines(lines, Mode.C, MARK_PY_IN_C, Mode.PY) + writer = PythonOutputWriter() + else: + parsed = parse_lines(lines, Mode.PY, MARK_C_IN_PY, Mode.C) + writer = COutputWriter() + + for line in parsed: + writer.write(line) + + newcontent = writer.getcontent() + "\n" + + return newcontent + + +def process_one_file(fn): + with open(fn, "r", encoding="utf-8") as f: + c_content = f.read() + + if not "\n//| " in c_content: + return + + py_content = swap_comment_markers(c_content, Mode.C) + + try: + # Line length is 95 so that with "//| " the max is 99 + result = subprocess.run( + ["black", "--pyi", "-l95", "-q", "-"], + input=py_content, + check=True, + stdout=subprocess.PIPE, + encoding="utf-8", + ) + except subprocess.CalledProcessError as e: + print(f"{fn}:0: Failed to process file ") + raise + + new_py_content = result.stdout + new_c_content = swap_comment_markers(new_py_content, Mode.PY) + + if new_c_content != c_content: + with open(fn, "w", encoding="utf-8") as f: + f.write(new_c_content) + + +if __name__ == "__main__": + # Use a thread pool because most processing is inside black! + executor = ThreadPoolExecutor(max_workers=os.cpu_count()) + futures = [executor.submit(process_one_file, fn) for fn in sys.argv[1:]] + status = 0 + for f in futures: + try: + f.result() + except Exception as e: + print(e) + status = 1 + executor.shutdown() + raise SystemExit(status) diff --git a/tools/build_board_info.py b/tools/build_board_info.py index 1534288b04..f810d942a7 100755 --- a/tools/build_board_info.py +++ b/tools/build_board_info.py @@ -19,70 +19,11 @@ import adabot.github_requests as github sys.path.append("../docs") from shared_bindings_matrix import ( SUPPORTED_PORTS, - aliases_by_board, support_matrix_by_board, + get_board_mapping, ) -BIN = ("bin",) -UF2 = ("uf2",) -BIN_UF2 = ("bin", "uf2") -HEX = ("hex",) -HEX_UF2 = ("hex", "uf2") -SPK = ("spk",) -DFU = ("dfu",) -BIN_DFU = ("bin", "dfu") -COMBINED_HEX = ("combined.hex",) -KERNEL8_IMG = ("disk.img.zip", "kernel8.img") -KERNEL_IMG = ("disk.img.zip", "kernel.img") - -# Default extensions -extension_by_port = { - "atmel-samd": UF2, - "broadcom": KERNEL8_IMG, - "cxd56": SPK, - "espressif": BIN_UF2, - "litex": DFU, - "mimxrt10xx": HEX_UF2, - "nrf": UF2, - "raspberrypi": UF2, - "stm": BIN, -} - -# Per board overrides -extension_by_board = { - # samd - "arduino_mkr1300": BIN_UF2, - "arduino_mkrzero": BIN_UF2, - "arduino_nano_33_iot": BIN_UF2, - "arduino_zero": BIN_UF2, - "feather_m0_adalogger": BIN_UF2, - "feather_m0_basic": BIN_UF2, - "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, - "microbit_v2": COMBINED_HEX, - # stm32 - "meowbit_v121": UF2, - # esp32c3 - "adafruit_qtpy_esp32c3": BIN, - "ai_thinker_esp32-c3s": BIN, - "ai_thinker_esp32-c3s-2m": BIN, - "espressif_esp32c3_devkitm_1_n4": BIN, - "lilygo_ttgo_t-01c3": BIN, - "microdev_micro_c3": BIN, - "lilygo_ttgo_t-oi-plus": BIN, - # broadcom - "raspberrypi_zero": KERNEL_IMG, - "raspberrypi_zero_w": KERNEL_IMG, -} - -language_allow_list = set( +LANGUAGE_ALLOW_LIST = set( [ "ID", "de_DE", @@ -111,38 +52,10 @@ def get_languages(list_all=False): if f.name.endswith(".po"): languages.add(f.name[:-3]) if not list_all: - languages = languages & language_allow_list + languages = languages & LANGUAGE_ALLOW_LIST return sorted(list(languages), key=str.casefold) -def get_board_mapping(): - boards = {} - for port in SUPPORTED_PORTS: - board_path = os.path.join("../ports", port, "boards") - for board_path in os.scandir(board_path): - if board_path.is_dir(): - board_files = os.listdir(board_path.path) - board_id = board_path.name - 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, - } - for alias in 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") @@ -277,7 +190,7 @@ def generate_download_info(): languages = get_languages() - support_matrix = support_matrix_by_board(use_branded_name=False) + support_matrix = support_matrix_by_board(use_branded_name=False, withurl=False) new_stable = "-" not in new_tag @@ -304,20 +217,19 @@ def generate_download_info(): board_files = os.listdir(board_path.path) board_id = board_path.name board_info = board_mapping[board_id] - for alias in [board_id] + board_info["aliases"]: alias_info = board_mapping[alias] if alias not in current_info: changes["new_boards"].append(alias) current_info[alias] = {"downloads": 0, "versions": []} - new_version = { "stable": new_stable, "version": new_tag, - "modules": support_matrix[alias][0], "languages": languages, - "extensions": board_info["extensions"], - "frozen_libraries": [frozen[0] for frozen in support_matrix[alias][1]], + # add modules, extensions, frozen_libraries explicitly + "modules": support_matrix[alias]["modules"], + "extensions": support_matrix[alias]["extensions"], + "frozen_libraries": support_matrix[alias]["frozen_libraries"], } current_info[alias]["downloads"] = alias_info["download_count"] current_info[alias]["versions"].append(new_version) @@ -327,9 +239,10 @@ def generate_download_info(): if changes["new_release"] and user: create_pr(changes, current_info, git_info, user) else: - print("No new release to update") if "DEBUG" in os.environ: print(create_json(current_info).decode("utf8")) + else: + print("No new release to update") if __name__ == "__main__": diff --git a/tools/build_release_files.py b/tools/build_release_files.py index 3fe714e393..309d91c368 100755 --- a/tools/build_release_files.py +++ b/tools/build_release_files.py @@ -12,6 +12,9 @@ import shutil import build_board_info as build_info import time +sys.path.append("../docs") +from shared_bindings_matrix import get_settings_from_makefile + for port in build_info.SUPPORTED_PORTS: result = subprocess.run("rm -rf ../ports/{port}/build*".format(port=port), shell=True) @@ -39,6 +42,7 @@ for board in build_boards: bin_directory = "../bin/{}/".format(board) os.makedirs(bin_directory, exist_ok=True) board_info = all_boards[board] + board_settings = get_settings_from_makefile("../ports/" + board_info["port"], board) for language in languages: bin_directory = "../bin/{board}/{language}".format(board=board, language=language) @@ -82,8 +86,12 @@ for board in build_boards: success = "\033[31mfailed\033[0m" other_output = "" + extensions = [ + extension.strip() + for extension in board_settings["CIRCUITPY_BUILD_EXTENSIONS"].split(",") + ] - for extension in board_info["extensions"]: + for extension in extensions: temp_filename = "../ports/{port}/{build}/firmware.{extension}".format( port=board_info["port"], build=build_dir, extension=extension ) diff --git a/tools/ci_check_duplicate_usb_vid_pid.py b/tools/ci_check_duplicate_usb_vid_pid.py index d9e7d99687..a75bd2b3f8 100644 --- a/tools/ci_check_duplicate_usb_vid_pid.py +++ b/tools/ci_check_duplicate_usb_vid_pid.py @@ -55,10 +55,16 @@ DEFAULT_CLUSTERLIST = { "espressif_esp32s3_devkitc_1_n8r2", "espressif_esp32s3_devkitc_1_n8r8", ], - "0x303A:0x7009": ["espressif_esp32s2_devkitc_1_n4", "espressif_esp32s2_devkitc_1_n4r2"], + "0x303A:0x7009": [ + "espressif_esp32s2_devkitc_1_n4", + "espressif_esp32s2_devkitc_1_n4r2", + "espressif_esp32s2_devkitc_1_n8r2", + ], } -cli_parser = argparse.ArgumentParser(description="USB VID/PID Duplicate Checker") +cli_parser = argparse.ArgumentParser( + description="USB VID/PID and Creator/Creation ID Duplicate Checker" +) def configboard_files(): @@ -71,31 +77,40 @@ def configboard_files(): return working_dir.glob("ports/**/boards/**/mpconfigboard.mk") +VID_PATTERN = re.compile(r"^USB_VID\s*=\s*(.*)", flags=re.M) +PID_PATTERN = re.compile(r"^USB_PID\s*=\s*(.*)", flags=re.M) +CREATOR_PATTERN = re.compile(r"^CIRCUITPY_CREATOR_ID\s*=\s*(.*)", flags=re.M) +CREATION_PATTERN = re.compile(r"^CIRCUITPY_CREATION_ID\s*=\s*(.*)", flags=re.M) + + def check_vid_pid(files, clusterlist): """Compiles a list of USB VID & PID values for all boards, and checks for duplicates. Exits with ``sys.exit()`` (non-zero exit code) if duplicates are found, and lists the duplicates. """ - vid_pattern = re.compile(r"^USB_VID\s*=\s*(.*)", flags=re.M) - pid_pattern = re.compile(r"^USB_PID\s*=\s*(.*)", flags=re.M) - usb_pattern = re.compile(r"^CIRCUITPY_USB\s*=\s*0$|^IDF_TARGET = esp32c3$", flags=re.M) + usb_pattern = re.compile(r"^CIRCUITPY_USB\s*=\s*0$|^IDF_TARGET = (esp32|esp32c3)$", flags=re.M) usb_ids = defaultdict(set) for board_config in files: src_text = board_config.read_text() - usb_vid = vid_pattern.search(src_text) - usb_pid = pid_pattern.search(src_text) + usb_vid = VID_PATTERN.search(src_text) + usb_pid = PID_PATTERN.search(src_text) + creator = CREATOR_PATTERN.search(src_text) + creation = CREATION_PATTERN.search(src_text) non_usb = usb_pattern.search(src_text) board_name = board_config.parts[-2] if usb_vid and usb_pid: id_group = f"0x{int(usb_vid.group(1), 16):04X}:0x{int(usb_pid.group(1), 16):04X}" elif non_usb: - continue + if creator is None or creation is None: + print(f"{board_name=} {creator=} {creation=}", file=sys.stderr) + continue + id_group = f"0x{int(creator.group(1), 16):08X}:0x{int(creation.group(1), 16):08X}" else: - raise SystemExit(f"Could not parse {board_config}") + raise SystemExit(f"Could not find expected settings in {board_config}") usb_ids[id_group].add(board_name) @@ -117,17 +132,19 @@ def check_vid_pid(files, clusterlist): duplicate_message = ( f"Duplicate VID/PID usage found!\n{duplicates}\n" f"If you are open source maker, then you can request a PID from http://pid.codes\n" + f"For boards without native USB, you can request a Creator ID from https://github.com/creationid/creators/\n" f"Otherwise, companies should pay the USB-IF for a vendor ID: https://www.usb.org/getting-vendor-id" ) sys.exit(duplicate_message) + else: - print("No USB PID duplicates found.") + print("No unexpected ID duplicates found.") if __name__ == "__main__": arguments = cli_parser.parse_args() - print("Running USB VID/PID Duplicate Checker...") + print("Running USB VID/PID and Creator/Creation ID Duplicate Checker...") board_files = configboard_files() check_vid_pid(board_files, DEFAULT_CLUSTERLIST) diff --git a/tools/ci_fetch_deps.py b/tools/ci_fetch_deps.py index 491d8da0e5..515c3b198f 100644 --- a/tools/ci_fetch_deps.py +++ b/tools/ci_fetch_deps.py @@ -25,14 +25,22 @@ port_deps = { ], "broadcom": ["extmod/ulab/", "lib/tinyusb/"], "cxd56": ["extmod/ulab/", "lib/tinyusb/"], - "espressif": ["extmod/ulab/", "lib/tinyusb/", "lib/protomatter/", "lib/quirc/"], + "espressif": [ + "extmod/ulab/", + "lib/certificates/nina-fw/", + "lib/protomatter/", + "lib/quirc/", + "lib/tinyusb/", + ], "litex": ["extmod/ulab/", "lib/tinyusb/"], "mimxrt10xx": ["extmod/ulab/", "lib/tinyusb/", "data/nvm.toml/"], "nrf": ["extmod/ulab/", "lib/mp3/", "lib/protomatter/", "lib/tinyusb/", "data/nvm.toml/"], "raspberrypi": [ "extmod/ulab/", "lib/adafruit_floppy/", + "lib/mbedtls/", "lib/mp3/", + "lib/certificates/nina-fw/", "lib/protomatter/", "lib/quirc/", "lib/tinyusb/", @@ -43,13 +51,15 @@ port_deps = { } -def run(title, command): +def run(title, command, check=True): print("::group::" + title, flush=True) print(command, flush=True) start = time.monotonic() - subprocess.run(shlex.split(command), stderr=subprocess.STDOUT) - print("Duration:", time.monotonic() - start, flush=True) - print("::endgroup::", flush=True) + try: + subprocess.run(shlex.split(command), stderr=subprocess.STDOUT, check=check) + finally: + print("Duration:", time.monotonic() - start, flush=True) + print("::endgroup::", flush=True) run( @@ -106,7 +116,11 @@ if submodules: submodules = " ".join(submodules) # This line will fail because the submodule's need different commits than the tip of the branch. We # fix it later. - run("Init the submodules we'll need", f"git submodule update --init -N --depth 1 {submodules}") + run( + "Init the submodules we'll need", + f"git submodule update --init -N --depth 1 {submodules}", + check=False, + ) run( "Fetch the submodule sha", diff --git a/tools/ci_set_matrix.py b/tools/ci_set_matrix.py index efb4427e7e..90cf04cea6 100644 --- a/tools/ci_set_matrix.py +++ b/tools/ci_set_matrix.py @@ -21,6 +21,7 @@ import json import yaml import build_board_info +from shared_bindings_matrix import get_settings_from_makefile PORT_TO_ARCH = { "atmel-samd": "arm", @@ -53,6 +54,7 @@ def set_boards_to_build(build_all): all_board_ids = set() port_to_boards = {} board_to_port = {} + board_settings = {} for board_id in boards_info_json: info = boards_info_json[board_id] if info.get("alias", False): @@ -70,6 +72,9 @@ def set_boards_to_build(build_all): boards_to_build = set() board_pattern = re.compile(r"^ports/[^/]+/boards/([^/]+)/") port_pattern = re.compile(r"^ports/([^/]+)/") + module_pattern = re.compile( + r"^(ports/[^/]+/common-hal|shared-bindings|shared-module)/([^/]+)/" + ) for p in changed_files: # See if it is board specific board_matches = board_pattern.search(p) @@ -80,7 +85,8 @@ def set_boards_to_build(build_all): # See if it is port specific port_matches = port_pattern.search(p) - if port_matches: + module_matches = module_pattern.search(p) + if port_matches and not module_matches: port = port_matches.group(1) if port != "unix": boards_to_build.update(port_to_boards[port]) @@ -90,8 +96,50 @@ def set_boards_to_build(build_all): if p in IGNORE: continue - # Boards don't run tests so ignore those as well. - if p.startswith("tests"): + # Boards don't run tests or docs so ignore those as well. + if p.startswith("tests") or p.startswith("docs"): + continue + + # As a (nearly) last resort, for some certain files, we compute the settings from the + # makefile for each board and determine whether to build them that way. + if p.startswith("frozen") or p.startswith("supervisor") or module_matches: + for board in all_board_ids: + if board not in board_settings: + board_settings[board] = get_settings_from_makefile( + "../ports/" + board_to_port[board], board + ) + settings = board_settings[board] + + # Check frozen files to see if they are in each board. + frozen = settings.get("FROZEN_MPY_DIRS", "") + if frozen and p.startswith("frozen") and p in frozen: + boards_to_build.add(board) + continue + + # Check supervisor files. This is useful for limiting workflow changes to the + # relevant boards. + supervisor = settings["SRC_SUPERVISOR"] + if p.startswith("supervisor"): + if p in supervisor: + boards_to_build.add(board) + continue + + web_workflow = settings["CIRCUITPY_WEB_WORKFLOW"] + while web_workflow.startswith("$("): + web_workflow = settings[web_workflow[2:-1]] + if ( + p.startswith("supervisor/shared/web_workflow/static/") + and web_workflow != "0" + ): + boards_to_build.add(board) + continue + + # Check module matches + if module_matches: + module = module_matches.group(2) + "/" + if module in settings["SRC_PATTERNS"]: + boards_to_build.add(board) + continue continue # Otherwise build it all @@ -101,7 +149,7 @@ def set_boards_to_build(build_all): # Split boards by architecture. print("Building boards:") arch_to_boards = {"aarch": [], "arm": [], "riscv": [], "espressif": []} - for board in boards_to_build: + for board in sorted(boards_to_build): print(" ", board) port = board_to_port.get(board) # A board can appear due to its _deletion_ (rare) diff --git a/tools/codeformat.py b/tools/codeformat.py index edefbc8ddc..223c2bad45 100644 --- a/tools/codeformat.py +++ b/tools/codeformat.py @@ -67,6 +67,8 @@ EXCLUSIONS = [ "tests/**/repl_*.py", # needs careful attention before applying automatic formatting "tests/basics/*.py", + # don't reindent this third-party code we vendored in + "ports/raspberrypi/lwip_src", ] # None of the standard Python path matching routines implement the matching @@ -214,8 +216,13 @@ def main(): if os.path.splitext(file)[1].lower() in exts: yield file + def bindings_files(): + for file in lang_files(C_EXTS): + if file.startswith("shared-bindings/") or "/bindings/" in file: + yield file + # Run tool on N files at a time (to avoid making the command line too long). - def batch(cmd, files, N=200): + def batch(cmd, files, N=200, check=False): while True: file_args = list(itertools.islice(files, N)) if not file_args: @@ -223,7 +230,10 @@ def main(): if args.dry_run: print(" ".join(cmd + file_args)) else: - subprocess.call(cmd + file_args) + if check: + subprocess.check_call(cmd + file_args) + else: + subprocess.run(cmd + file_args) # Format C files with uncrustify. if format_c: @@ -234,6 +244,10 @@ def main(): batch(command, lang_files(C_EXTS)) for file in lang_files(C_EXTS): fixup_c(file) + # Format bindings with black_bindings + if format_py: + command = ["python3", "tools/black_bindings.py"] + batch(command, bindings_files(), check=True) # Format Python files with black. if format_py: diff --git a/tools/describe b/tools/describe index 7fd624abe3..e20c2ffa44 100755 --- a/tools/describe +++ b/tools/describe @@ -1,3 +1,3 @@ #!/bin/sh # Add any supplied arguments. -git describe --first-parent --dirty --tags --always --match "[1-9].*" "$@" +git describe --first-parent --dirty --tags --match "[1-9].*" "$@" diff --git a/tools/gen_crt_bundle.py b/tools/gen_crt_bundle.py new file mode 100755 index 0000000000..eb314bf25e --- /dev/null +++ b/tools/gen_crt_bundle.py @@ -0,0 +1,298 @@ +#!/usr/bin/env python +# +# ESP32 x509 certificate bundle generation utility +# +# Converts PEM and DER certificates to a custom bundle format which stores just the +# subject name and public key to reduce space +# +# The bundle will have the format: number of certificates; crt 1 subject name length; crt 1 public key length; +# crt 1 subject name; crt 1 public key; crt 2... +# +# Copyright 2018-2019 Espressif Systems (Shanghai) PTE LTD +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +from __future__ import with_statement + +import argparse +import csv +import os +import re +import struct +import sys +import textwrap +from io import open + +try: + from cryptography import x509 + from cryptography.hazmat.backends import default_backend + from cryptography.hazmat.primitives import serialization +except ImportError: + print( + "The cryptography package is not installed." + "Please refer to the Get Started section of the ESP-IDF Programming Guide for " + "setting up the required packages." + ) + raise + +ca_bundle_bin_file = "x509_crt_bundle" + +quiet = False + + +def status(msg): + """Print status message to stderr""" + if not quiet: + critical(msg) + + +def critical(msg): + """Print critical message to stderr""" + sys.stderr.write("gen_crt_bundle.py: ") + sys.stderr.write(msg) + sys.stderr.write("\n") + + +class CertificateBundle: + def __init__(self): + self.certificates = [] + self.compressed_crts = [] + + if os.path.isfile(ca_bundle_bin_file): + os.remove(ca_bundle_bin_file) + + def add_from_path(self, crts_path): + + found = False + for file_path in os.listdir(crts_path): + found |= self.add_from_file(os.path.join(crts_path, file_path)) + + if found is False: + raise InputError("No valid x509 certificates found in %s" % crts_path) + + def add_from_file(self, file_path): + try: + if file_path.endswith(".pem"): + status("Parsing certificates from %s" % file_path) + with open(file_path, "r", encoding="utf-8") as f: + crt_str = f.read() + self.add_from_pem(crt_str) + return True + + elif file_path.endswith(".der"): + status("Parsing certificates from %s" % file_path) + with open(file_path, "rb") as f: + crt_str = f.read() + self.add_from_der(crt_str) + return True + + except ValueError: + critical("Invalid certificate in %s" % file_path) + raise InputError("Invalid certificate") + + return False + + def add_from_pem(self, crt_str): + """A single PEM file may have multiple certificates""" + + crt = "" + count = 0 + start = False + + for strg in crt_str.splitlines(True): + if strg == "-----BEGIN CERTIFICATE-----\n" and start is False: + crt = "" + start = True + elif strg == "-----END CERTIFICATE-----\n" and start is True: + crt += strg + "\n" + start = False + self.certificates.append( + x509.load_pem_x509_certificate(crt.encode(), default_backend()) + ) + count += 1 + if start is True: + crt += strg + + if count == 0: + raise InputError("No certificate found") + + status("Successfully added %d certificates" % count) + + def add_from_der(self, crt_str): + self.certificates.append(x509.load_der_x509_certificate(crt_str, default_backend())) + status("Successfully added 1 certificate") + + def create_bundle(self): + # Sort certificates in order to do binary search when looking up certificates + self.certificates = sorted( + self.certificates, key=lambda cert: cert.subject.public_bytes(default_backend()) + ) + + bundle = struct.pack(">H", len(self.certificates)) + + for crt in self.certificates: + """Read the public key as DER format""" + pub_key = crt.public_key() + pub_key_der = pub_key.public_bytes( + serialization.Encoding.DER, serialization.PublicFormat.SubjectPublicKeyInfo + ) + + """ Read the subject name as DER format """ + sub_name_der = crt.subject.public_bytes(default_backend()) + + name_len = len(sub_name_der) + key_len = len(pub_key_der) + len_data = struct.pack(">HH", name_len, key_len) + + bundle += len_data + bundle += sub_name_der + bundle += pub_key_der + + return bundle + + def add_with_filter(self, crts_path, filter_path): + + filter_set = set() + with open(filter_path, "r", encoding="utf-8") as f: + csv_reader = csv.reader(f, delimiter=",") + + # Skip header + next(csv_reader) + for row in csv_reader: + filter_set.add(row[1]) + + status("Parsing certificates from %s" % crts_path) + crt_str = [] + with open(crts_path, "r", encoding="utf-8") as f: + crt_str = f.read() + + # Split all certs into a list of (name, certificate string) tuples + pem_crts = re.findall( + r"(^.+?)\n(=+\n[\s\S]+?END CERTIFICATE-----\n)", crt_str, re.MULTILINE + ) + + filtered_crts = "" + for name, crt in pem_crts: + if name in filter_set: + filtered_crts += crt + + self.add_from_pem(filtered_crts) + + +class InputError(RuntimeError): + def __init__(self, e): + super(InputError, self).__init__(e) + + +def main(): + global quiet + + parser = argparse.ArgumentParser(description="ESP-IDF x509 certificate bundle utility") + + parser.add_argument( + "--quiet", + "-q", + help="Don't print non-critical status messages to stderr", + action="store_true", + ) + parser.add_argument( + "--input", + "-i", + nargs="+", + required=True, + help="Paths to the custom certificate folders or files to parse, parses all .pem or .der files", + ) + parser.add_argument( + "--filter", + "-f", + help="Path to CSV-file where the second columns contains the name of the certificates \ + that should be included from cacrt_all.pem", + ) + parser.add_argument( + "--asm", + "-S", + action="store_true", + default=False, + help="Output an asm file for use with gas, rather than a binary file", + ) + parser.add_argument("--symbol", help="The symbol to define", default="x509_crt_bundle") + parser.add_argument("--output", "-o", help="The output file", default=None) + + args = parser.parse_args() + + quiet = args.quiet + + bundle = CertificateBundle() + + for path in args.input: + if os.path.isfile(path): + if os.path.basename(path) == "cacrt_all.pem" and args.filter: + bundle.add_with_filter(path, args.filter) + else: + bundle.add_from_file(path) + elif os.path.isdir(path): + bundle.add_from_path(path) + else: + raise InputError("Invalid --input=%s, is neither file nor folder" % args.input) + + status("Successfully added %d certificates in total" % len(bundle.certificates)) + + crt_bundle = bundle.create_bundle() + + if args.asm: + symbol = args.symbol + filename = args.output or (ca_bundle_bin_file + ".S") + with open(filename, "w") as f: + print( + textwrap.dedent( + f"""\ + // Generated from {" ".join(args.input)} with {len(bundle.certificates)} certificates + .data + .section .rodata.embedded + + .global {symbol} + .global _binary_{symbol}_start + .global _binary_{symbol}_end + {symbol}: + _binary_{symbol}_start: + """ + ), + file=f, + ) + for i in range(0, len(crt_bundle), 16): + chunk = crt_bundle[i : i + 16] + formatted = ", ".join(f"0x{byte:02x}" for byte in chunk) + print(f".byte {formatted}", file=f) + print( + textwrap.dedent( + f"""\ + _binary_{symbol}_end: + + {symbol}_length: + .word {len(crt_bundle)} + """ + ), + file=f, + ) + else: + filename = args.output or ca_bundle_bin_file + with open(filename, "wb") as f: + f.write(crt_bundle) + + +if __name__ == "__main__": + try: + main() + except InputError as e: + print(e) + sys.exit(2) diff --git a/tools/gen_display_resources.py b/tools/gen_display_resources.py index 552e5f1245..e5ce775e4a 100644 --- a/tools/gen_display_resources.py +++ b/tools/gen_display_resources.py @@ -75,8 +75,7 @@ for c in set(all_characters): if missing > 0: print("Font missing", missing, "characters", file=sys.stderr) -x, y, dx, dy = f.get_bounding_box() -tile_x, tile_y = x - dx, y - dy +tile_x, tile_y, dx, dy = f.get_bounding_box() total_bits = tile_x * len(all_characters) total_bits += 32 - total_bits % 32 bytes_per_row = total_bits // 8 @@ -105,14 +104,170 @@ c_file = args.output_c_file c_file.write( """\ +#include "shared-bindings/displayio/Bitmap.h" #include "shared-bindings/displayio/Palette.h" #include "supervisor/shared/display.h" """ ) + c_file.write( """\ +#if CIRCUITPY_REPL_LOGO +""" +) +if tile_y == 16: + blinka_size = 16 + c_file.write( + """\ +uint32_t blinka_bitmap_data[32] = { + 0x00000011, 0x11000000, + 0x00000111, 0x53100000, + 0x00000111, 0x56110000, + 0x00000111, 0x11140000, + 0x00000111, 0x20002000, + 0x00000011, 0x13000000, + 0x00000001, 0x11200000, + 0x00000000, 0x11330000, + 0x00000000, 0x01122000, + 0x00001111, 0x44133000, + 0x00032323, 0x24112200, + 0x00111114, 0x44113300, + 0x00323232, 0x34112200, + 0x11111144, 0x44443300, + 0x11111111, 0x11144401, + 0x23232323, 0x21111110 +}; +""" + ) +else: + blinka_size = 12 + c_file.write( + """\ +uint32_t blinka_bitmap_data[28] = { + 0x00000111, 0x00000000, + 0x00001153, 0x10000000, + 0x00001156, 0x11000000, + 0x00001111, 0x14000000, + 0x00000112, 0x00200000, + 0x00000011, 0x30000000, + 0x00000011, 0x20000000, + 0x00011144, 0x13000000, + 0x00232324, 0x12000000, + 0x01111444, 0x13000000, + 0x32323234, 0x12010000, + 0x11111144, 0x44100000 +}; +""" + ) + +c_file.write( + """\ +displayio_bitmap_t blinka_bitmap = {{ + .base = {{.type = &displayio_bitmap_type }}, + .width = {0}, + .height = {0}, + .data = blinka_bitmap_data, + .stride = 2, + .bits_per_value = 4, + .x_shift = 3, + .x_mask = 0x7, + .bitmask = 0xf, + .read_only = true +}}; + +_displayio_color_t blinka_colors[7] = {{ + {{ + .rgb888 = 0x000000, + .rgb565 = 0x0000, + .luma = 0x00, + .chroma = 0, + .transparent = true + }}, + {{ + .rgb888 = 0x8428bc, + .rgb565 = 0x8978, + .luma = 0xff, // We cheat the luma here. It is actually 0x60 + .hue = 184, + .chroma = 148 + }}, + {{ + .rgb888 = 0xff89bc, + .rgb565 = 0xFCB8, + .luma = 0xb5, + .hue = 222, + .chroma = 118 + }}, + {{ + .rgb888 = 0x7beffe, + .rgb565 = 0x869F, + .luma = 0xe0, + .hue = 124, + .chroma = 131 + }}, + {{ + .rgb888 = 0x51395f, + .rgb565 = 0x5A0D, + .luma = 0x47, + .hue = 185, + .chroma = 38 + }}, + {{ + .rgb888 = 0xffffff, + .rgb565 = 0xffff, + .luma = 0xff, + .chroma = 0 + }}, + {{ + .rgb888 = 0x0736a0, + .rgb565 = 0x01f5, + .luma = 0x44, + .hue = 147, + .chroma = 153 + }}, +}}; + +displayio_palette_t blinka_palette = {{ + .base = {{.type = &displayio_palette_type }}, + .colors = blinka_colors, + .color_count = 7, + .needs_refresh = false +}}; + +displayio_tilegrid_t supervisor_blinka_sprite = {{ + .base = {{.type = &displayio_tilegrid_type }}, + .bitmap = &blinka_bitmap, + .pixel_shader = &blinka_palette, + .x = 0, + .y = 0, + .pixel_width = {0}, + .pixel_height = {0}, + .bitmap_width_in_tiles = 1, + .width_in_tiles = 1, + .height_in_tiles = 1, + .tile_width = {0}, + .tile_height = {0}, + .top_left_x = {0}, + .top_left_y = {0}, + .tiles = 0, + .partial_change = false, + .full_change = false, + .hidden = false, + .hidden_by_parent = false, + .moved = false, + .inline_tiles = true, + .in_group = true +}}; +#endif +""".format( + blinka_size + ) +) + +c_file.write( + """\ +#if CIRCUITPY_TERMINALIO _displayio_color_t terminal_colors[2] = { { .rgb888 = 0x000000, @@ -139,11 +294,41 @@ displayio_palette_t supervisor_terminal_color = { c_file.write( """\ -displayio_tilegrid_t supervisor_terminal_text_grid = {{ +displayio_tilegrid_t supervisor_terminal_scroll_area_text_grid = {{ .base = {{ .type = &displayio_tilegrid_type }}, .bitmap = (displayio_bitmap_t*) &supervisor_terminal_font_bitmap, .pixel_shader = &supervisor_terminal_color, - .x = 16, + .x = 0, + .y = 0, + .pixel_width = {1}, + .pixel_height = {2}, + .bitmap_width_in_tiles = {0}, + .tiles_in_bitmap = {0}, + .width_in_tiles = 1, + .height_in_tiles = 1, + .tile_width = {1}, + .tile_height = {2}, + .tiles = NULL, + .partial_change = false, + .full_change = false, + .hidden = false, + .hidden_by_parent = false, + .moved = false, + .inline_tiles = false, + .in_group = true +}}; +""".format( + len(all_characters), tile_x, tile_y + ) +) + +c_file.write( + """\ +displayio_tilegrid_t supervisor_terminal_status_bar_text_grid = {{ + .base = {{ .type = &displayio_tilegrid_type }}, + .bitmap = (displayio_bitmap_t*) &supervisor_terminal_font_bitmap, + .pixel_shader = &supervisor_terminal_color, + .x = 0, .y = 0, .pixel_width = {1}, .pixel_height = {2}, @@ -228,7 +413,10 @@ terminalio_terminal_obj_t supervisor_terminal = { .font = &supervisor_terminal_font, .cursor_x = 0, .cursor_y = 0, - .tilegrid = NULL + .scroll_area = NULL, + .status_bar = NULL }; + +#endif """ ) diff --git a/tools/gen_web_workflow_static.py b/tools/gen_web_workflow_static.py new file mode 100644 index 0000000000..172a80dac0 --- /dev/null +++ b/tools/gen_web_workflow_static.py @@ -0,0 +1,44 @@ +# SPDX-FileCopyrightText: 2014 MicroPython & CircuitPython contributors (https://github.com/adafruit/circuitpython/graphs/contributors) +# +# SPDX-License-Identifier: MIT + +import argparse +import gzip +import minify_html +import jsmin +import mimetypes +import pathlib + +parser = argparse.ArgumentParser(description="Generate displayio resources.") +parser.add_argument("--output_c_file", type=argparse.FileType("w"), required=True) +parser.add_argument("files", metavar="FILE", type=argparse.FileType("rb"), nargs="+") + +args = parser.parse_args() + + +c_file = args.output_c_file + +c_file.write(f"// Autogenerated by tools/gen_web_workflow_static.py\n") +c_file.write(f"#include \n\n") + +for f in args.files: + path = pathlib.Path(f.name) + variable = path.name.replace(".", "_") + uncompressed = f.read() + ulen = len(uncompressed) + if f.name.endswith(".html"): + uncompressed = minify_html.minify(uncompressed.decode("utf-8")).encode("utf-8") + elif f.name.endswith(".js"): + uncompressed = jsmin.jsmin(uncompressed.decode("utf-8"), quote_chars="'\"`").encode( + "utf-8" + ) + compressed = gzip.compress(uncompressed) + clen = len(compressed) + compressed = ", ".join([hex(x) for x in compressed]) + mime = mimetypes.guess_type(f.name)[0] + + c_file.write(f"// {f.name}\n") + c_file.write(f"// Original length: {ulen} Compressed length: {clen}\n") + c_file.write(f"const uint32_t {variable}_length = {clen};\n") + c_file.write(f'const char* {variable}_content_type = "{mime}";\n') + c_file.write(f"const uint8_t {variable}[{clen}] = {{{compressed}}};\n\n") diff --git a/tools/tinytest-codegen.py b/tools/tinytest-codegen.py index 5c14bf2d5b..79b03f1383 100755 --- a/tools/tinytest-codegen.py +++ b/tools/tinytest-codegen.py @@ -100,6 +100,7 @@ exclude_tests = ( "float/float_divmod.py", # requires double precision floating point to work "float/float2int_doubleprec_intbig.py", + "float/float_format_ints_doubleprec.py", "float/float_parse_doubleprec.py", # inline asm FP tests (require Cortex-M4) "inlineasm/asmfpaddsub.py",