diff --git a/.devcontainer/Readme.md b/.devcontainer/Readme.md new file mode 100644 index 0000000000..00acbb5786 --- /dev/null +++ b/.devcontainer/Readme.md @@ -0,0 +1,31 @@ +Build CircuitPython in a Github-Devcontainer +============================================ + +To build CircuitPython within a Github-Devcontainer, you need to perform +the following steps. + + 1. checkout the code to a devcontainer + + - click on the green "<> Code"-button + - select the Codespaces-tab + - choose "+ new with options..." from the "..."-menu + - in the following screen select the branch and then + - select ".devcontainer/cortex-m/devcontainer.json" instead + of "Default Codespaces configuration" + - update region as necessary + - finally, click on the green "Create codespace" button + + 2. Your codespace is created. Cloning the images is quite fast, but + preparing it for CircuitPython-development takes about 10 minutes. + Note that this is a one-time task. + + 3. During creation, you can run the command + `tail -f /workspaces/.codespaces/.persistedshare/creation.log` + to see what is going on. + + 4. To actually build CircuitPython, run + + cd ports/raspberrypi + make -j $(nproc) BOARD=whatever TRANSLATION=xx_XX + + This takes about 2m40s. diff --git a/.devcontainer/cortex-m/devcontainer.json b/.devcontainer/cortex-m/devcontainer.json new file mode 100644 index 0000000000..ee8aeb1ea0 --- /dev/null +++ b/.devcontainer/cortex-m/devcontainer.json @@ -0,0 +1,23 @@ +// For format details, see https://aka.ms/devcontainer.json. For config options, see the +// README at: https://github.com/devcontainers/templates/tree/main/src/universal +{ + "name": "CircuitPython Cortex-M Build-Environment (base: Default Linux Universal)", + "image": "mcr.microsoft.com/devcontainers/universal:2-linux", + "postCreateCommand": ".devcontainer/cortex-m/on-create.sh", + "remoteEnv": { "PATH": "/workspaces/gcc-arm-none-eabi/bin:${containerEnv:PATH}" } + + // Features to add to the dev container. More info: https://containers.dev/features. + // "features": {}, + + // Use 'forwardPorts' to make a list of ports inside the container available locally. + // "forwardPorts": [], + + // Use 'postCreateCommand' to run commands after the container is created. + // "postCreateCommand": "uname -a", + + // Configure tool-specific properties. + // "customizations": {}, + + // Uncomment to connect as root instead. More info: https://aka.ms/dev-containers-non-root. + // "remoteUser": "root" +} diff --git a/.devcontainer/cortex-m/on-create.sh b/.devcontainer/cortex-m/on-create.sh new file mode 100755 index 0000000000..8c4bd0cfed --- /dev/null +++ b/.devcontainer/cortex-m/on-create.sh @@ -0,0 +1,59 @@ +#!/bin/bash +# ----------------------------------------------------------------------------- +# on-create.sh: postCreateCommand-hook for devcontainer.json (Cortex-M build) +# +# Author: Bernhard Bablok +# +# ----------------------------------------------------------------------------- + +echo -e "[on-create.sh] downloading and installing gcc-arm-non-eabi toolchain" +cd /workspaces +wget -qO gcc-arm-none-eabi.tar.bz2 https://adafru.it/Pid +tar -xjf gcc-arm-none-eabi.tar.bz2 +ln -s gcc-arm-none-eabi-10-2020-q4-major gcc-arm-none-eabi +rm -f /workspaces/gcc-arm-none-eabi.tar.bz2 +export PATH=/workspaces/gcc-arm-none-eabi/bin:$PATH + +# add repository and install tools +echo -e "[on-create.sh] adding pybricks/ppa" +sudo add-apt-repository -y ppa:pybricks/ppa +echo -e "[on-create.sh] installing uncrustify and mtools" +sudo apt-get -y install uncrustify mtools + +# dosfstools >= 4.2 needed, standard repo only has 4.1 +echo -e "[on-create.sh] downloading and installing dosfstools" +wget https://github.com/dosfstools/dosfstools/releases/download/v4.2/dosfstools-4.2.tar.gz +tar -xzf dosfstools-4.2.tar.gz +cd dosfstools-4.2/ +./configure +make -j $(nproc) +sudo make install +cd /workspaces +rm -fr /workspaces/dosfstools-4.2 /workspaces/dosfstools-4.2.tar.gz + +# prepare source-code tree +cd /workspaces/circuitpython/ +echo -e "[on-create.sh] fetching submodules" +make fetch-submodules +echo -e "[on-create.sh] fetching tags" +git fetch --tags --recurse-submodules=no --shallow-since="2021-07-01" https://github.com/adafruit/circuitpython HEAD + +# additional python requirements +echo -e "[on-create.sh] pip-installing requirements" +pip install --upgrade -r requirements-dev.txt +pip install --upgrade -r requirements-doc.txt + +# add pre-commit +echo -e "[on-create.sh] installing pre-commit" +pre-commit install + +# create cross-compiler +echo -e "[on-create.sh] building mpy-cross" +make -j $(nproc) -C mpy-cross # time: about 36 sec + +# that's it! +echo -e "[on-create.sh] setup complete" + +#commands to actually build CP: +#cd ports/raspberrypi +#time make -j $(nproc) BOARD=pimoroni_tufty2040 TRANSLATION=de_DE diff --git a/.github/ISSUE_TEMPLATE/bug_report.yml b/.github/ISSUE_TEMPLATE/bug_report.yml index 7b6a53dbba..c81bf63123 100644 --- a/.github/ISSUE_TEMPLATE/bug_report.yml +++ b/.github/ISSUE_TEMPLATE/bug_report.yml @@ -6,7 +6,7 @@ body: - type: markdown attributes: value: >- - Thanks! for testing out CircuitPython. Now that you have encountered a + Thanks for testing out CircuitPython! Now that you have encountered a bug... you can file a report for it. - type: textarea id: firmware diff --git a/.github/actions/deps/external/action.yml b/.github/actions/deps/external/action.yml new file mode 100644 index 0000000000..5db7c04686 --- /dev/null +++ b/.github/actions/deps/external/action.yml @@ -0,0 +1,92 @@ +name: Fetch external deps + +inputs: + action: + required: false + default: restore + type: choice + options: + - cache + - restore + + platform: + required: false + default: none + type: choice + options: + - arm + - aarch + - esp + - riscv + - none + +runs: + using: composite + steps: + # aarch + - name: Get aarch toolchain + if: inputs.platform == 'aarch' + run: | + 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 + sudo apt-get install -y mtools + shell: bash + - name: Install mkfs.fat + if: inputs.platform == 'aarch' + run: | + wget https://github.com/dosfstools/dosfstools/releases/download/v4.2/dosfstools-4.2.tar.gz + tar -xaf dosfstools-4.2.tar.gz + cd dosfstools-4.2 + ./configure + make -j 2 + cd src + echo >> $GITHUB_PATH $(pwd) + shell: bash + + # arm + - name: Get arm toolchain + if: inputs.platform == 'aarch' || inputs.platform == 'arm' + uses: carlosperate/arm-none-eabi-gcc-action@v1 + with: + release: '10-2020-q4' + + # esp + - name: Get esp toolchain + if: inputs.platform == 'esp' + run: sudo apt-get install -y ninja-build + shell: bash + - name: Install IDF tools + if: inputs.platform == 'esp' + run: | + echo "Installing ESP-IDF tools" + $IDF_PATH/tools/idf_tools.py --non-interactive install required + $IDF_PATH/tools/idf_tools.py --non-interactive install cmake + echo "Installing Python environment and packages" + $IDF_PATH/tools/idf_tools.py --non-interactive install-python-env + rm -rf $IDF_TOOLS_PATH/dist + shell: bash + - name: Set environment + if: inputs.platform == 'esp' + run: | + source $IDF_PATH/export.sh + echo >> $GITHUB_ENV "IDF_PYTHON_ENV_PATH=$IDF_PYTHON_ENV_PATH" + echo >> $GITHUB_PATH "$PATH" + shell: bash + + # riscv + - name: Get riscv toolchain + if: inputs.platform == 'riscv' + run: | + wget https://static.dev.sifive.com/dev-tools/riscv64-unknown-elf-gcc-8.3.0-2019.08.0-x86_64-linux-centos6.tar.gz + sudo tar -C /usr --strip-components=1 -xaf riscv64-unknown-elf-gcc-8.3.0-2019.08.0-x86_64-linux-centos6.tar.gz + shell: bash + + # common + - name: Cache python dependencies + if: inputs.platform != 'esp' + uses: ./.github/actions/deps/python + with: + action: ${{ inputs.action }} + - name: Install python dependencies + run: pip install -r requirements-dev.txt + shell: bash diff --git a/.github/actions/deps/ports/espressif/action.yml b/.github/actions/deps/ports/espressif/action.yml new file mode 100644 index 0000000000..aa1e98f8a0 --- /dev/null +++ b/.github/actions/deps/ports/espressif/action.yml @@ -0,0 +1,36 @@ +name: Fetch espressif port deps + +runs: + using: composite + steps: + - name: Set IDF env + run: | + echo >> $GITHUB_ENV "IDF_PATH=$GITHUB_WORKSPACE/ports/espressif/esp-idf" + echo >> $GITHUB_ENV "IDF_TOOLS_PATH=$GITHUB_WORKSPACE/.idf_tools" + shell: bash + + - name: Get IDF commit + id: idf-commit + run: | + COMMIT=$(git submodule status ports/espressif/esp-idf | grep -o -P '(?<=^-).*(?= )') + echo "$COMMIT" + echo "commit=$COMMIT" >> $GITHUB_OUTPUT + shell: bash + + - name: Cache IDF submodules + uses: actions/cache@v3 + with: + path: | + .git/modules/ports/espressif/esp-idf + ports/espressif/esp-idf + key: submodules-idf-${{ steps.idf-commit.outputs.commit }} + + - name: Cache IDF tools + uses: actions/cache@v3 + with: + path: ${{ env.IDF_TOOLS_PATH }} + key: ${{ runner.os }}-${{ env.pythonLocation }}-tools-idf-${{ steps.idf-commit.outputs.commit }} + + - name: Initialize IDF submodules + run: git submodule update --init --depth=1 --recursive $IDF_PATH + shell: bash diff --git a/.github/actions/deps/python/action.yml b/.github/actions/deps/python/action.yml new file mode 100644 index 0000000000..9b3732c9e0 --- /dev/null +++ b/.github/actions/deps/python/action.yml @@ -0,0 +1,42 @@ +name: Fetch python deps + +inputs: + action: + description: The cache action to use + required: false + default: restore + type: choice + options: + - cache + - restore + +runs: + using: composite + steps: + - name: Cache python dependencies + id: cache-python-deps + if: inputs.action == 'cache' + uses: actions/cache@v3 + with: + path: .cp_tools + key: ${{ runner.os }}-${{ env.pythonLocation }}-tools-cp-${{ hashFiles('requirements-dev.txt') }} + + - name: Restore python dependencies + id: restore-python-deps + if: inputs.action == 'restore' + uses: actions/cache/restore@v3 + with: + path: .cp_tools + key: ${{ runner.os }}-${{ env.pythonLocation }}-tools-cp-${{ hashFiles('requirements-dev.txt') }} + + - name: Set up venv + if: inputs.action == 'cache' && !steps.cache-python-deps.outputs.cache-hit + run: python -m venv .cp_tools + shell: bash + + - name: Activate venv + if: inputs.action == 'cache' || (inputs.action == 'restore' && steps.restore-python-deps.outputs.cache-hit) + run: | + source .cp_tools/bin/activate + echo >> $GITHUB_PATH "$PATH" + shell: bash diff --git a/.github/actions/deps/submodules/action.yml b/.github/actions/deps/submodules/action.yml new file mode 100644 index 0000000000..bca76b204c --- /dev/null +++ b/.github/actions/deps/submodules/action.yml @@ -0,0 +1,87 @@ +name: 'Fetch Submodules' + +inputs: + target: + description: 'The target for ci_fetch_deps' + required: false + type: string + + submodules: + description: 'The submodules to cache' + required: false + default: '["extmod/ulab", "lib/", "tools/"]' + type: string + + action: + description: 'The cache action to use' + required: false + default: 'restore' + type: choice + options: + - cache + - restore + + version: + description: 'Whether to generate CP version' + required: false + default: false + type: boolean + +outputs: + frozen: + description: 'Whether frozen submodules were fetched' + value: ${{ steps.cp-deps.outputs.frozen_tags }} + + version: + description: 'The CP version' + value: ${{ steps.cp-version.outputs.cp-version }} + +runs: + using: "composite" + steps: + - name: Create submodule status + id: create-submodule-status + run: | + git submodule status ${{ join(fromJSON(inputs.submodules), ' ') }} >> submodule_status + echo $(cut -d ' ' -f 2 submodule_status) | echo "submodules=[\"$(sed "s/ /\", \"/g")\"]" >> $GITHUB_OUTPUT + shell: bash + + - name: Cache submodules + if: ${{ inputs.action == 'cache' }} + uses: actions/cache@v3 + with: + path: ".git/modules/\n${{ join(fromJSON(steps.create-submodule-status.outputs.submodules), '\n') }}" + key: submodules-common-${{ hashFiles('submodule_status') }} + enableCrossOsArchive: true + + - name: Restore submodules + if: ${{ inputs.action == 'restore' }} + uses: actions/cache/restore@v3 + with: + path: ".git/modules/\n${{ join(fromJSON(steps.create-submodule-status.outputs.submodules), '\n') }}" + key: submodules-common-${{ hashFiles('submodule_status') }} + enableCrossOsArchive: true + + - name: Remove submodule status + run: rm submodule_status + shell: bash + + - name: CircuitPython dependencies + id: cp-deps + run: python tools/ci_fetch_deps.py ${{ inputs.target || matrix.board || github.job }} + shell: bash + + - name: CircuitPython version + id: cp-version + if: ${{ inputs.version == 'true' }} + run: | + echo "::group::Fetch history and tags" + git fetch --no-recurse-submodules --shallow-since="2021-07-01" --tags https://github.com/adafruit/circuitpython HEAD + git fetch --no-recurse-submodules --shallow-since="2021-07-01" origin $GITHUB_SHA + git repack -d + echo "::endgroup::" + CP_VERSION=$(tools/describe) + echo "$CP_VERSION" + echo "CP_VERSION=$CP_VERSION" >> $GITHUB_ENV + echo "cp-version=$CP_VERSION" >> $GITHUB_OUTPUT + shell: bash diff --git a/.github/actions/mpy_cross/action.yml b/.github/actions/mpy_cross/action.yml new file mode 100644 index 0000000000..d9fe54fdc7 --- /dev/null +++ b/.github/actions/mpy_cross/action.yml @@ -0,0 +1,37 @@ +name: Set up mpy-cross + +inputs: + download: + required: false + default: true + type: boolean + +runs: + using: composite + steps: + - name: Download mpy-cross + id: download-mpy-cross + if: inputs.download == 'true' + continue-on-error: true + uses: actions/download-artifact@v3 + with: + name: mpy-cross + path: mpy-cross + + - name: Make mpy-cross executable + if: inputs.download == 'true' && steps.download-mpy-cross.outcome == 'success' + run: sudo chmod +x mpy-cross/mpy-cross + shell: bash + + - name: Build mpy-cross + if: inputs.download == 'false' || steps.download-mpy-cross.outcome == 'failure' + run: make -C mpy-cross -j2 + shell: bash + + - name: Upload mpy-cross + if: inputs.download == 'false' || steps.download-mpy-cross.outcome == 'failure' + continue-on-error: true + uses: actions/upload-artifact@v3 + with: + name: mpy-cross + path: mpy-cross/mpy-cross diff --git a/.github/actions/upload_aws/action.yml b/.github/actions/upload_aws/action.yml new file mode 100644 index 0000000000..643dd00342 --- /dev/null +++ b/.github/actions/upload_aws/action.yml @@ -0,0 +1,33 @@ +name: Upload to AWS S3 + +inputs: + source: + required: true + type: string + + destination: + required: false + type: string + + AWS_ACCESS_KEY_ID: + required: true + + AWS_SECRET_ACCESS_KEY: + required: true + +runs: + using: composite + steps: + - name: Upload to S3 + if: >- + (github.event_name == 'push' && github.ref == 'refs/heads/main' && github.repository_owner == 'adafruit') || + (github.event_name == 'release' && (github.event.action == 'published' || github.event.action == 'rerequested')) + run: >- + [ -z "$AWS_ACCESS_KEY_ID" ] || + aws s3 cp ${{ inputs.source }} s3://adafruit-circuit-python/bin/${{ inputs.destination }} + ${{ endsWith(inputs.source, '/') && '--recursive' || '' }} --no-progress --region us-east-1 + env: + AWS_PAGER: '' + AWS_ACCESS_KEY_ID: ${{ inputs.AWS_ACCESS_KEY_ID }} + AWS_SECRET_ACCESS_KEY: ${{ inputs.AWS_SECRET_ACCESS_KEY }} + shell: bash diff --git a/.github/workflows/build-boards-custom.yml b/.github/workflows/build-boards-custom.yml new file mode 100644 index 0000000000..22ba0f62f4 --- /dev/null +++ b/.github/workflows/build-boards-custom.yml @@ -0,0 +1,104 @@ +name: Custom board build + +on: + workflow_dispatch: + inputs: + board: + description: 'Board: Found in ports/*/boards/[board_id]' + required: true + type: string + version: + description: 'Version: Can be a tag or a commit (>=8.1.0)' + required: false + default: latest + type: string + language: + description: 'Language: Found in locale/[language].po' + required: false + default: en_US + type: string + flags: + description: 'Flags: Build flags (e.g. CIRCUITPY_WIFI=1)' + required: false + type: string + debug: + description: 'Make a debug build' + required: false + default: false + type: boolean + +run-name: ${{ inputs.board }}-${{ inputs.language }}-${{ inputs.version }}${{ inputs.flags != '' && '-custom' || '' }}${{ inputs.debug && '-debug' || '' }} + +jobs: + build: + runs-on: ubuntu-22.04 + env: + PLATFORM_atmel-samd: arm + PLATFORM_broadcom: aarch + PLATFORM_cxd56: arm + PLATFORM_espressif: esp + PLATFORM_litex: riscv + PLATFORM_mimxrt10xx: arm + PLATFORM_nrf: arm + PLATFORM_raspberrypi: arm + PLATFORM_stm: arm + steps: + - name: Set up repository + run: | + git clone --filter=tree:0 https://github.com/adafruit/circuitpython.git $GITHUB_WORKSPACE + git checkout ${{ inputs.version == 'latest' && 'HEAD' || inputs.version }} + - name: Set up identifier + if: inputs.debug || inputs.flags != '' + run: | + > custom-build && git add custom-build + - name: Get port + id: get-port + run: | + PORT=$(find ports/*/boards/ -type d -name ${{ inputs.board }} | sed 's/^ports\///g;s/\/boards.*//g') + if [ -z $PORT ]; then (exit 1); else echo >> $GITHUB_OUTPUT "port=$PORT"; fi + - name: Port to platform + run: echo >> $GITHUB_ENV "PLATFORM=${{ env[format('PLATFORM_{0}', steps.get-port.outputs.port)] }}" + - name: Set up python + uses: actions/setup-python@v4 + with: + python-version: 3.x + - name: Set up port + if: env.PLATFORM == 'esp' + uses: ./.github/actions/deps/ports/espressif + - name: Set up submodules + id: set-up-submodules + uses: ./.github/actions/deps/submodules + with: + action: cache + target: ${{ inputs.board }} + - name: Set up external + uses: ./.github/actions/deps/external + with: + action: cache + platform: ${{ env.PLATFORM }} + - name: Set up mpy-cross + if: steps.set-up-submodules.outputs.frozen == 'True' + uses: ./.github/actions/mpy_cross + with: + download: false + - name: Versions + run: | + tools/describe + gcc --version + python3 --version + cmake --version || true + ninja --version || true + aarch64-none-elf-gcc --version || true + arm-none-eabi-gcc --version || true + xtensa-esp32-elf-gcc --version || true + riscv32-esp-elf-gcc --version || true + riscv64-unknown-elf-gcc --version || true + mkfs.fat --version || true + - name: Build board + run: make -j2 ${{ inputs.flags }} BOARD=${{ inputs.board }} DEBUG=${{ inputs.debug && '1' || '0' }} TRANSLATION=${{ inputs.language }} + working-directory: ports/${{ steps.get-port.outputs.port }} + - name: Upload artifact + uses: actions/upload-artifact@v3 + with: + name: ${{ inputs.board }}-${{ inputs.language }}-${{ inputs.version }}${{ inputs.flags != '' && '-custom' || '' }}${{ inputs.debug && '-debug' || '' }} + path: ports/${{ steps.get-port.outputs.port }}/build-${{ inputs.board }}/firmware.* diff --git a/.github/workflows/build-boards.yml b/.github/workflows/build-boards.yml new file mode 100644 index 0000000000..457fce5b98 --- /dev/null +++ b/.github/workflows/build-boards.yml @@ -0,0 +1,85 @@ +name: Build boards + +on: + workflow_call: + inputs: + platform: + required: true + type: string + boards: + required: true + type: string + cp-version: + required: true + type: string + secrets: + AWS_ACCESS_KEY_ID: + required: false + AWS_SECRET_ACCESS_KEY: + required: false + +jobs: + build: + runs-on: ubuntu-22.04 + env: + CP_VERSION: ${{ inputs.cp-version }} + strategy: + fail-fast: false + matrix: + board: ${{ fromJSON(inputs.boards) }} + steps: + - name: Set up repository + uses: actions/checkout@v3 + with: + submodules: false + fetch-depth: 1 + - name: Set up python + uses: actions/setup-python@v4 + with: + python-version: 3.x + - name: Set up port + if: inputs.platform == 'esp' + uses: ./.github/actions/deps/ports/espressif + - name: Set up submodules + id: set-up-submodules + uses: ./.github/actions/deps/submodules + - name: Set up external + uses: ./.github/actions/deps/external + with: + platform: ${{ inputs.platform }} + - name: Set up mpy-cross + if: steps.set-up-submodules.outputs.frozen == 'True' + uses: ./.github/actions/mpy_cross + + - name: Versions + run: | + gcc --version + python3 --version + cmake --version || true + ninja --version || true + aarch64-none-elf-gcc --version || true + arm-none-eabi-gcc --version || true + xtensa-esp32-elf-gcc --version || true + riscv32-esp-elf-gcc --version || true + riscv64-unknown-elf-gcc --version || true + mkfs.fat --version || true + + - name: Set up build failure matcher + run: echo "::add-matcher::$GITHUB_WORKSPACE/.github/workflows/match-build-fail.json" + - name: Build board + run: python3 -u build_release_files.py + working-directory: tools + env: + BOARDS: ${{ matrix.board }} + + - name: Upload artifact + uses: actions/upload-artifact@v3 + with: + name: ${{ matrix.board }} + path: bin/${{ matrix.board }} + - name: Upload to S3 + uses: ./.github/actions/upload_aws + with: + source: bin/ + AWS_ACCESS_KEY_ID: ${{ secrets.AWS_ACCESS_KEY_ID }} + AWS_SECRET_ACCESS_KEY: ${{ secrets.AWS_SECRET_ACCESS_KEY }} diff --git a/.github/workflows/build-mpy-cross.yml b/.github/workflows/build-mpy-cross.yml new file mode 100644 index 0000000000..10c4498bc8 --- /dev/null +++ b/.github/workflows/build-mpy-cross.yml @@ -0,0 +1,70 @@ +name: Build mpy-cross + +on: + workflow_call: + inputs: + cp-version: + required: true + type: string + secrets: + AWS_ACCESS_KEY_ID: + required: false + AWS_SECRET_ACCESS_KEY: + required: false + +jobs: + build: + runs-on: ubuntu-22.04 + strategy: + fail-fast: false + matrix: + mpy-cross: ["static", "static-aarch64", "static-mingw", "static-raspbian"] + env: + CP_VERSION: ${{ inputs.cp-version }} + EX_static-mingw: static.exe + OS_static: linux-amd64 + OS_static-aarch64: linux-aarch64 + OS_static-mingw: windows + OS_static-raspbian: linux-raspbian + steps: + - name: Set up repository + uses: actions/checkout@v3 + with: + submodules: false + fetch-depth: 1 + - name: Set up python + uses: actions/setup-python@v4 + with: + python-version: 3.x + - name: Set up submodules + uses: ./.github/actions/deps/submodules + with: + target: mpy-cross + + - name: Install toolchain (aarch64) + if: matrix.mpy-cross == 'static-aarch64' + run: sudo apt-get install -y gcc-aarch64-linux-gnu + - name: Install toolchain (mingw) + if: matrix.mpy-cross == 'static-mingw' + run: sudo apt-get install -y mingw-w64 + + - name: Build mpy-cross.${{ matrix.mpy-cross }} + run: make -C mpy-cross -j2 -f Makefile.${{ matrix.mpy-cross }} + + - name: Set output + run: | + echo >> $GITHUB_ENV "EX=${{ env[format('EX_{0}', matrix.mpy-cross)] || matrix.mpy-cross }}" + echo >> $GITHUB_ENV "OS=${{ env[format('OS_{0}', matrix.mpy-cross)] }}" + + - name: Upload artifact + uses: actions/upload-artifact@v3 + with: + name: mpy-cross.${{ env.EX }} + path: mpy-cross/mpy-cross.${{ env.EX }} + - name: Upload to S3 + uses: ./.github/actions/upload_aws + with: + source: mpy-cross/mpy-cross.${{ env.EX }} + destination: mpy-cross/${{ env.OS }}/mpy-cross-${{ env.OS }}-${{ env.CP_VERSION }}.${{ env.EX }} + AWS_ACCESS_KEY_ID: ${{ secrets.AWS_ACCESS_KEY_ID }} + AWS_SECRET_ACCESS_KEY: ${{ secrets.AWS_SECRET_ACCESS_KEY }} diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index 8863664232..00c7f8749f 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -17,166 +17,113 @@ concurrency: cancel-in-progress: true jobs: - test: + scheduler: runs-on: ubuntu-20.04 outputs: build-doc: ${{ steps.set-matrix.outputs.build-doc }} - boards-arm: ${{ steps.set-matrix.outputs.boards-arm }} - boards-riscv: ${{ steps.set-matrix.outputs.boards-riscv }} - boards-espressif: ${{ steps.set-matrix.outputs.boards-espressif }} + build-boards: ${{ steps.set-matrix.outputs.build-boards }} boards-aarch: ${{ steps.set-matrix.outputs.boards-aarch }} + boards-arm: ${{ steps.set-matrix.outputs.boards-arm }} + boards-esp: ${{ steps.set-matrix.outputs.boards-esp }} + boards-riscv: ${{ steps.set-matrix.outputs.boards-riscv }} + boards-rpi: ${{ steps.set-matrix.outputs.boards-rpi }} + cp-version: ${{ steps.set-up-submodules.outputs.version }} steps: - name: Dump GitHub context + run: echo "$GITHUB_CONTEXT" env: GITHUB_CONTEXT: ${{ toJson(github) }} - run: echo "$GITHUB_CONTEXT" - - uses: actions/checkout@v3 + - name: Set up repository + uses: actions/checkout@v3 with: submodules: false fetch-depth: 1 - - name: Set up Python 3 + - name: Set up python uses: actions/setup-python@v4 with: - python-version: "3.10" - - name: Get CP deps - run: python tools/ci_fetch_deps.py test ${{ github.sha }} - - name: CircuitPython version - run: | - tools/describe || git log --parents HEAD~4.. - echo >>$GITHUB_ENV CP_VERSION=$(tools/describe) - - name: Install dependencies - run: | - sudo apt-get update - sudo apt-get install -y eatmydata - sudo eatmydata apt-get install -y gettext gcc-aarch64-linux-gnu mingw-w64 - pip install -r requirements-ci.txt -r requirements-dev.txt - - name: Versions - run: | - gcc --version - python3 --version - - name: Duplicate USB VID/PID Check + python-version: 3.x + - name: Duplicate USB VID/PID check run: python3 -u -m tools.ci_check_duplicate_usb_vid_pid - - name: Build mpy-cross - run: make -C mpy-cross -j2 - - name: Build unix port - run: | - make -C ports/unix VARIANT=coverage -j2 - - name: Test all - run: MICROPY_CPYTHON3=python3.8 MICROPY_MICROPYTHON=../ports/unix/micropython-coverage ./run-tests.py -j1 - working-directory: tests - - name: Print failure info - run: MICROPY_CPYTHON3=python3.8 MICROPY_MICROPYTHON=../ports/unix/micropython-coverage ./run-tests.py -j1 --print-failures - if: failure() - working-directory: tests - - name: Native Tests - run: MICROPY_CPYTHON3=python3.8 MICROPY_MICROPYTHON=../ports/unix/micropython-coverage ./run-tests.py -j1 --emit native - working-directory: tests - - name: mpy Tests - run: MICROPY_CPYTHON3=python3.8 MICROPY_MICROPYTHON=../ports/unix/micropython-coverage ./run-tests.py -j1 --via-mpy -d basics float micropython - working-directory: tests - - name: Native mpy Tests - run: MICROPY_CPYTHON3=python3.8 MICROPY_MICROPYTHON=../ports/unix/micropython-coverage ./run-tests.py -j1 --via-mpy --emit native -d basics float micropython - working-directory: tests - - name: Build native modules - run: | - make -C examples/natmod/features1 - make -C examples/natmod/features2 - make -C examples/natmod/btree - make -C examples/natmod/framebuf - make -C examples/natmod/uheapq - make -C examples/natmod/urandom - make -C examples/natmod/ure - make -C examples/natmod/uzlib - - name: Test native modules - run: MICROPY_CPYTHON3=python3.8 MICROPY_MICROPYTHON=../ports/unix/micropython-coverage ./run-natmodtests.py extmod/{btree*,framebuf*,uheapq*,ure*,uzlib*}.py - working-directory: tests - - name: Build mpy-cross.static-aarch64 - run: make -C mpy-cross -j2 -f Makefile.static-aarch64 - - uses: actions/upload-artifact@v3 + - name: Set up submodules + id: set-up-submodules + uses: ./.github/actions/deps/submodules 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@v3 + action: cache + version: true + - name: Set up external + uses: ./.github/actions/deps/external 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@v3 + action: cache + # Disabled: Needs to be updated + # - name: Get last commit with checks + # id: get-last-commit-with-checks + # if: github.event_name == 'pull_request' + # working-directory: tools + # run: python3 -u ci_changes_per_commit.py + # env: + # REPO: ${{ github.repository }} + # PULL: ${{ github.event.number }} + # GITHUB_TOKEN: ${{ github.token }} + # EXCLUDE_COMMIT: ${{ github.event.after }} + - name: Set up mpy-cross + uses: ./.github/actions/mpy_cross 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@v3 - with: - name: mpy-cross.static-x64-windows - path: mpy-cross/mpy-cross.static.exe - - name: Upload mpy-cross builds to S3 - if: (github.event_name == 'push' && github.ref == 'refs/heads/main' && github.repository_owner == 'adafruit') || (github.event_name == 'release' && (github.event.action == 'published' || github.event.action == 'rerequested')) - env: - AWS_PAGER: '' - AWS_ACCESS_KEY_ID: ${{ secrets.AWS_ACCESS_KEY_ID }} - AWS_SECRET_ACCESS_KEY: ${{ secrets.AWS_SECRET_ACCESS_KEY }} - run: | - [ -z "$AWS_ACCESS_KEY_ID" ] || aws s3 cp mpy-cross/mpy-cross.static-aarch64 s3://adafruit-circuit-python/bin/mpy-cross/mpy-cross.static-aarch64-${{ env.CP_VERSION }} --no-progress --region us-east-1 - [ -z "$AWS_ACCESS_KEY_ID" ] || aws s3 cp mpy-cross/mpy-cross.static-raspbian s3://adafruit-circuit-python/bin/mpy-cross/mpy-cross.static-raspbian-${{ env.CP_VERSION }} --no-progress --region us-east-1 - [ -z "$AWS_ACCESS_KEY_ID" ] || aws s3 cp mpy-cross/mpy-cross.static s3://adafruit-circuit-python/bin/mpy-cross/mpy-cross.static-amd64-linux-${{ env.CP_VERSION }} --no-progress --region us-east-1 - [ -z "$AWS_ACCESS_KEY_ID" ] || aws s3 cp mpy-cross/mpy-cross.static.exe s3://adafruit-circuit-python/bin/mpy-cross/mpy-cross.static-x64-windows-${{ env.CP_VERSION }}.exe --no-progress --region us-east-1 - - name: Get last commit with checks - id: get-last-commit-with-checks + download: false + - name: Set head sha if: github.event_name == 'pull_request' - working-directory: tools + run: echo "HEAD_SHA=$(git show -s --format=%s $GITHUB_SHA | grep -o -P "(?<=Merge ).*(?= into)")" >> $GITHUB_ENV + - name: Set base sha + if: github.event_name == 'pull_request' + run: | + git fetch --no-tags --no-recurse-submodules --depth=$((DEPTH + 1)) origin $HEAD_SHA + echo "BASE_SHA=$(git rev-list $HEAD_SHA --skip=$DEPTH --max-count=1)" >> $GITHUB_ENV env: - REPO: ${{ github.repository }} - PULL: ${{ github.event.number }} - GITHUB_TOKEN: ${{ github.token }} - EXCLUDE_COMMIT: ${{ github.event.after }} - run: python3 -u ci_changes_per_commit.py + DEPTH: ${{ steps.get-last-commit-with-checks.outputs.commit_depth || github.event.pull_request.commits }} - name: Get changes id: get-changes if: github.event_name == 'pull_request' - uses: tj-actions/changed-files@v34 - with: - json: true - sha: ${{ steps.get-last-commit-with-checks.outputs.commit && github.event.after }} - base_sha: ${{ steps.get-last-commit-with-checks.outputs.commit }} + run: echo $(git diff $BASE_SHA...$HEAD_SHA --name-only) | echo "changed_files=[\"$(sed "s/ /\", \"/g")\"]" >> $GITHUB_OUTPUT - name: Set matrix id: set-matrix working-directory: tools - env: - CHANGED_FILES: ${{ steps.get-changes.outputs.all_changed_and_modified_files }} - LAST_FAILED_JOBS: ${{ steps.get-last-commit-with-checks.outputs.checkruns }} run: python3 -u ci_set_matrix.py + env: + CHANGED_FILES: ${{ steps.get-changes.outputs.changed_files }} + LAST_FAILED_JOBS: ${{ steps.get-last-commit-with-checks.outputs.check_runs }} + tests: + needs: scheduler + if: needs.scheduler.outputs.build-boards == 'True' + uses: ./.github/workflows/run-tests.yml + with: + cp-version: ${{ needs.scheduler.outputs.cp-version }} + + mpy-cross: + needs: scheduler + if: needs.scheduler.outputs.build-boards == 'True' + uses: ./.github/workflows/build-mpy-cross.yml + secrets: inherit + with: + cp-version: ${{ needs.scheduler.outputs.cp-version }} mpy-cross-mac: runs-on: macos-11 + needs: scheduler + if: ${{ needs.scheduler.outputs.build-boards == 'True' }} + env: + CP_VERSION: ${{ needs.scheduler.outputs.cp-version }} steps: - - name: Dump GitHub context - env: - GITHUB_CONTEXT: ${{ toJson(github) }} - run: echo "$GITHUB_CONTEXT" - - uses: actions/checkout@v3 + - name: Set up repository + uses: actions/checkout@v3 with: submodules: false fetch-depth: 1 - - name: Set up Python 3 + - name: Set up python uses: actions/setup-python@v4 with: - python-version: "3.10" - - name: Get CP deps - run: python tools/ci_fetch_deps.py mpy-cross-mac ${{ github.sha }} - - name: CircuitPython version - run: | - tools/describe || git log --parents HEAD~4.. - echo >>$GITHUB_ENV CP_VERSION=$(tools/describe) - - name: Install dependencies - run: | - brew install gettext - echo >>$GITHUB_PATH /usr/local/opt/gettext/bin + python-version: 3.x + - name: Set up submodules + uses: ./.github/actions/deps/submodules - name: Versions run: | gcc --version @@ -196,47 +143,46 @@ jobs: 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@v3 + - name: Upload artifact + uses: actions/upload-artifact@v3 with: name: mpy-cross-macos-11-universal path: mpy-cross-macos-universal - - name: Upload mpy-cross build to S3 + - name: Upload to S3 + if: >- + (github.event_name == 'push' && github.ref == 'refs/heads/main' && github.repository_owner == 'adafruit') || + (github.event_name == 'release' && (github.event.action == 'published' || github.event.action == 'rerequested')) run: | - [ -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 + [ -z "$AWS_ACCESS_KEY_ID" ] || aws s3 cp mpy-cross-macos-universal s3://adafruit-circuit-python/bin/mpy-cross/macos-11/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/macos-11/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/macos-11/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 }} AWS_SECRET_ACCESS_KEY: ${{ secrets.AWS_SECRET_ACCESS_KEY }} - if: (github.event_name == 'push' && github.ref == 'refs/heads/main' && github.repository_owner == 'adafruit') || (github.event_name == 'release' && (github.event.action == 'published' || github.event.action == 'rerequested')) - build-doc: - runs-on: ubuntu-20.04 - needs: test - if: ${{ needs.test.outputs.build-doc == 'True' }} + runs-on: ubuntu-22.04 + needs: scheduler + if: ${{ needs.scheduler.outputs.build-doc == 'True' }} + env: + CP_VERSION: ${{ needs.scheduler.outputs.cp-version }} steps: - - uses: actions/checkout@v3 + - name: Set up repository + uses: actions/checkout@v3 with: submodules: false fetch-depth: 1 - - name: Get CP deps - run: python tools/ci_fetch_deps.py docs ${{ github.sha }} - - name: CircuitPython version - run: | - tools/describe || git log --parents HEAD~4.. - echo >>$GITHUB_ENV CP_VERSION=$(tools/describe) - - name: Set up Python 3 + - name: Set up python uses: actions/setup-python@v4 with: - python-version: "3.10" + python-version: 3.x + - name: Set up submodules + uses: ./.github/actions/deps/submodules - name: Install dependencies run: | - sudo apt-get update - sudo apt-get install -y eatmydata - sudo eatmydata apt-get install -y latexmk librsvg2-bin texlive-fonts-recommended texlive-latex-recommended texlive-latex-extra - pip install -r requirements-ci.txt -r requirements-doc.txt + sudo apt-get install -y latexmk librsvg2-bin texlive-fonts-recommended texlive-latex-recommended texlive-latex-extra + pip install -r requirements-doc.txt - name: Build and Validate Stubs run: make check-stubs -j2 - uses: actions/upload-artifact@v3 @@ -256,15 +202,13 @@ jobs: with: name: docs path: _build/latex - - name: Upload stubs to S3 - if: (github.event_name == 'push' && github.ref == 'refs/heads/main' && github.repository_owner == 'adafruit') || (github.event_name == 'release' && (github.event.action == 'published' || github.event.action == 'rerequested')) - env: - AWS_PAGER: '' + - name: Upload to S3 + uses: ./.github/actions/upload_aws + with: + source: circuitpython-stubs/dist/*.tar.gz + destination: stubs/circuitpython-stubs-${{ env.CP_VERSION }}.tar.gz AWS_ACCESS_KEY_ID: ${{ secrets.AWS_ACCESS_KEY_ID }} AWS_SECRET_ACCESS_KEY: ${{ secrets.AWS_SECRET_ACCESS_KEY }} - run: | - zip -9r circuitpython-stubs.zip circuitpython-stubs - [ -z "$AWS_ACCESS_KEY_ID" ] || aws s3 cp circuitpython-stubs/dist/*.tar.gz s3://adafruit-circuit-python/bin/stubs/circuitpython-stubs-${{ env.CP_VERSION }}.zip --no-progress --region us-east-1 - name: Upload stubs to PyPi if: github.event_name == 'release' && (github.event.action == 'published' || github.event.action == 'rerequested') env: @@ -275,263 +219,52 @@ jobs: [ -z "$TWINE_USERNAME" ] || echo "Uploading dev release to PyPi" [ -z "$TWINE_USERNAME" ] || twine upload circuitpython-stubs/dist/* + aarch: + needs: [scheduler, mpy-cross, tests] + if: ${{ needs.scheduler.outputs.boards-aarch != '[]' }} + uses: ./.github/workflows/build-boards.yml + secrets: inherit + with: + platform: aarch + boards: ${{ needs.scheduler.outputs.boards-aarch }} + cp-version: ${{ needs.scheduler.outputs.cp-version }} - build-arm: - runs-on: ubuntu-20.04 - needs: test - strategy: - fail-fast: false - matrix: - board: ${{ fromJSON(needs.test.outputs.boards-arm) }} - if: ${{ needs.test.outputs.boards-arm != '[]' }} - steps: - - name: Set up Python 3 - uses: actions/setup-python@v4 - with: - python-version: "3.10" - - 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 - - name: Versions - run: | - gcc --version - arm-none-eabi-gcc --version - python3 --version - - name: mpy-cross - run: make -C mpy-cross -j2 - - name: Setup build failure matcher - run: echo "::add-matcher::$GITHUB_WORKSPACE/.github/workflows/match-build-fail.json" - - name: build - run: python3 -u build_release_files.py - working-directory: tools - env: - BOARDS: ${{ matrix.board }} - - uses: actions/upload-artifact@v3 - with: - name: ${{ matrix.board }} - path: bin/${{ matrix.board }} - - name: Upload to S3 - run: "[ -z \"$AWS_ACCESS_KEY_ID\" ] || aws s3 cp bin/ s3://adafruit-circuit-python/bin/ --recursive --no-progress --region us-east-1" - env: - AWS_PAGER: '' - AWS_ACCESS_KEY_ID: ${{ secrets.AWS_ACCESS_KEY_ID }} - AWS_SECRET_ACCESS_KEY: ${{ secrets.AWS_SECRET_ACCESS_KEY }} - if: (github.event_name == 'push' && github.ref == 'refs/heads/main' && github.repository_owner == 'adafruit') || (github.event_name == 'release' && (github.event.action == 'published' || github.event.action == 'rerequested')) + arm: + needs: [scheduler, mpy-cross, tests] + if: ${{ needs.scheduler.outputs.boards-arm != '[]' }} + uses: ./.github/workflows/build-boards.yml + secrets: inherit + with: + platform: arm + boards: ${{ needs.scheduler.outputs.boards-arm }} + cp-version: ${{ needs.scheduler.outputs.cp-version }} + esp: + needs: [scheduler, mpy-cross, tests] + if: ${{ needs.scheduler.outputs.boards-esp != '[]' }} + uses: ./.github/workflows/build-boards.yml + secrets: inherit + with: + platform: esp + boards: ${{ needs.scheduler.outputs.boards-esp }} + cp-version: ${{ needs.scheduler.outputs.cp-version }} - build-riscv: - runs-on: ubuntu-20.04 - needs: test - strategy: - fail-fast: false - matrix: - board: ${{ fromJSON(needs.test.outputs.boards-riscv) }} - if: ${{ needs.test.outputs.boards-riscv != '[]' }} - steps: - - name: Set up Python 3 - uses: actions/setup-python@v4 - with: - python-version: "3.10" - - 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 }} - - name: Install dependencies - run: | - sudo apt-get install -y gettext - pip install -r requirements-ci.txt -r requirements-dev.txt - wget https://static.dev.sifive.com/dev-tools/riscv64-unknown-elf-gcc-8.3.0-2019.08.0-x86_64-linux-centos6.tar.gz - sudo tar -C /usr --strip-components=1 -xaf riscv64-unknown-elf-gcc-8.3.0-2019.08.0-x86_64-linux-centos6.tar.gz - - name: Versions - run: | - gcc --version - riscv64-unknown-elf-gcc --version - python3 --version - - name: mpy-cross - run: make -C mpy-cross -j2 - - name: Setup build failure matcher - run: echo "::add-matcher::$GITHUB_WORKSPACE/.github/workflows/match-build-fail.json" - - name: build - run: python3 -u build_release_files.py - working-directory: tools - env: - BOARDS: ${{ matrix.board }} - - uses: actions/upload-artifact@v3 - with: - name: ${{ matrix.board }} - path: bin/${{ matrix.board }} - - name: Upload to S3 - run: "[ -z \"$AWS_ACCESS_KEY_ID\" ] || aws s3 cp bin/ s3://adafruit-circuit-python/bin/ --recursive --no-progress --region us-east-1" - env: - AWS_PAGER: '' - AWS_ACCESS_KEY_ID: ${{ secrets.AWS_ACCESS_KEY_ID }} - AWS_SECRET_ACCESS_KEY: ${{ secrets.AWS_SECRET_ACCESS_KEY }} - if: (github.event_name == 'push' && github.ref == 'refs/heads/main' && github.repository_owner == 'adafruit') || (github.event_name == 'release' && (github.event.action == 'published' || github.event.action == 'rerequested')) + riscv: + needs: [scheduler, mpy-cross, tests] + if: ${{ needs.scheduler.outputs.boards-riscv != '[]' }} + uses: ./.github/workflows/build-boards.yml + secrets: inherit + with: + platform: riscv + boards: ${{ needs.scheduler.outputs.boards-riscv }} + cp-version: ${{ needs.scheduler.outputs.cp-version }} - - build-espressif: - runs-on: ubuntu-20.04 - needs: test - strategy: - fail-fast: false - matrix: - board: ${{ fromJSON(needs.test.outputs.boards-espressif) }} - if: ${{ needs.test.outputs.boards-espressif != '[]' }} - steps: - - name: Set up Python 3 - id: py3 - uses: actions/setup-python@v4 - with: - python-version: "3.10" - - 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 }} - - name: CircuitPython version - run: | - tools/describe || git log --parents HEAD~4.. - echo >>$GITHUB_ENV CP_VERSION=$(tools/describe) - - 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') }}-${{ steps.py3.outputs.python-path }}-20220404 - - name: Clone IDF submodules - run: | - (cd $IDF_PATH && git submodule update --init) - env: - IDF_PATH: ${{ github.workspace }}/ports/espressif/esp-idf - - name: Install IDF tools - run: | - $IDF_PATH/tools/idf_tools.py --non-interactive install required - $IDF_PATH/tools/idf_tools.py --non-interactive install cmake - $IDF_PATH/tools/idf_tools.py --non-interactive install-python-env - rm -rf $IDF_TOOLS_PATH/dist - env: - IDF_PATH: ${{ github.workspace }}/ports/espressif/esp-idf - IDF_TOOLS_PATH: ${{ github.workspace }}/.idf_tools - - name: Install dependencies - run: | - source $IDF_PATH/export.sh - sudo apt-get install -y gettext ninja-build - pip install -r requirements-ci.txt -r requirements-dev.txt - env: - IDF_PATH: ${{ github.workspace }}/ports/espressif/esp-idf - IDF_TOOLS_PATH: ${{ github.workspace }}/.idf_tools - - name: Versions - run: | - source $IDF_PATH/export.sh - gcc --version - xtensa-esp32s2-elf-gcc --version - python3 --version - ninja --version - cmake --version - shell: bash - env: - IDF_PATH: ${{ github.workspace }}/ports/espressif/esp-idf - IDF_TOOLS_PATH: ${{ github.workspace }}/.idf_tools - - name: mpy-cross - run: make -C mpy-cross -j2 - - name: Setup build failure matcher - run: echo "::add-matcher::$GITHUB_WORKSPACE/.github/workflows/match-build-fail.json" - - name: build - run: | - source $IDF_PATH/export.sh - python3 -u build_release_files.py - working-directory: tools - shell: bash - env: - IDF_PATH: ${{ github.workspace }}/ports/espressif/esp-idf - IDF_TOOLS_PATH: ${{ github.workspace }}/.idf_tools - BOARDS: ${{ matrix.board }} - - uses: actions/upload-artifact@v3 - with: - name: ${{ matrix.board }} - path: bin/${{ matrix.board }} - - name: Upload to S3 - run: "[ -z \"$AWS_ACCESS_KEY_ID\" ] || aws s3 cp bin/ s3://adafruit-circuit-python/bin/ --recursive --no-progress --region us-east-1" - env: - AWS_PAGER: '' - AWS_ACCESS_KEY_ID: ${{ secrets.AWS_ACCESS_KEY_ID }} - AWS_SECRET_ACCESS_KEY: ${{ secrets.AWS_SECRET_ACCESS_KEY }} - if: (github.event_name == 'push' && github.ref == 'refs/heads/main' && github.repository_owner == 'adafruit') || (github.event_name == 'release' && (github.event.action == 'published' || github.event.action == 'rerequested')) - - build-aarch: - runs-on: ubuntu-20.04 - needs: test - strategy: - fail-fast: false - matrix: - board: ${{ fromJSON(needs.test.outputs.boards-aarch) }} - if: ${{ needs.test.outputs.boards-aarch != '[]' }} - steps: - - name: Set up Python 3 - uses: actions/setup-python@v4 - with: - python-version: "3.10" - - 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 }} - - name: Install dependencies - run: | - sudo apt-get install -y gettext mtools - 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 - - 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 - tar -xaf dosfstools-4.2.tar.gz - cd dosfstools-4.2 - ./configure - make -j 2 - cd src - echo >>$GITHUB_PATH $(pwd) - - name: Versions - run: | - gcc --version - aarch64-none-elf-gcc --version - arm-none-eabi-gcc --version - python3 --version - mkfs.fat --version || true - - name: mpy-cross - run: make -C mpy-cross -j2 - - name: Setup build failure matcher - run: echo "::add-matcher::$GITHUB_WORKSPACE/.github/workflows/match-build-fail.json" - - name: build - run: python3 -u build_release_files.py - working-directory: tools - env: - BOARDS: ${{ matrix.board }} - - uses: actions/upload-artifact@v3 - with: - name: ${{ matrix.board }} - path: bin/${{ matrix.board }} - - name: Upload to S3 - run: "[ -z \"$AWS_ACCESS_KEY_ID\" ] || aws s3 cp bin/ s3://adafruit-circuit-python/bin/ --recursive --no-progress --region us-east-1" - env: - AWS_PAGER: '' - AWS_ACCESS_KEY_ID: ${{ secrets.AWS_ACCESS_KEY_ID }} - AWS_SECRET_ACCESS_KEY: ${{ secrets.AWS_SECRET_ACCESS_KEY }} - if: (github.event_name == 'push' && github.ref == 'refs/heads/main' && github.repository_owner == 'adafruit') || (github.event_name == 'release' && (github.event.action == 'published' || github.event.action == 'rerequested')) + rpi: + needs: [scheduler, mpy-cross, tests] + if: ${{ needs.scheduler.outputs.boards-rpi != '[]' }} + uses: ./.github/workflows/build-boards.yml + secrets: inherit + with: + platform: arm + boards: ${{ needs.scheduler.outputs.boards-rpi }} + cp-version: ${{ needs.scheduler.outputs.cp-version }} diff --git a/.github/workflows/create_website_pr.yml b/.github/workflows/create_website_pr.yml index 1658fe092c..eeae8c8299 100644 --- a/.github/workflows/create_website_pr.yml +++ b/.github/workflows/create_website_pr.yml @@ -6,41 +6,38 @@ name: Update CircuitPython.org on: release: - types: [published] + types: [published, rerequested] jobs: website: - runs-on: ubuntu-20.04 + runs-on: ubuntu-22.04 steps: - name: Dump GitHub context + run: echo "$GITHUB_CONTEXT" env: GITHUB_CONTEXT: ${{ toJson(github) }} - run: echo "$GITHUB_CONTEXT" - - uses: actions/checkout@v3 + - name: Set up repository + uses: actions/checkout@v3 with: submodules: false fetch-depth: 1 - - name: Set up Python 3 + - name: Set up python uses: actions/setup-python@v4 with: - python-version: "3.10" - - name: Get CP deps - run: python tools/ci_fetch_deps.py website ${{ github.sha }} - - name: Install deps - run: | - pip install -r requirements-dev.txt + python-version: 3.x + - name: Set up submodules + uses: ./.github/actions/deps/submodules + with: + version: true + - name: Set up external + uses: ./.github/actions/deps/external - name: Versions run: | gcc --version python3 --version - - name: CircuitPython version - run: | - tools/describe || git log --parents HEAD~4.. - echo >>$GITHUB_ENV CP_VERSION=$(tools/describe) - name: Website run: python3 build_board_info.py working-directory: tools env: RELEASE_TAG: ${{ github.event.release.tag_name }} ADABOT_GITHUB_ACCESS_TOKEN: ${{ secrets.ADABOT_GITHUB_ACCESS_TOKEN }} - if: github.event_name == 'release' && (github.event.action == 'published' || github.event.action == 'rerequested') diff --git a/.github/workflows/notify.yml b/.github/workflows/notify.yml index 4cfb22298f..da1ac0a18e 100644 --- a/.github/workflows/notify.yml +++ b/.github/workflows/notify.yml @@ -7,8 +7,12 @@ on: jobs: notify: runs-on: ubuntu-latest + permissions: + issues: write steps: - - uses: jenschelkopf/issue-label-notification-action@1.3 + - uses: tekktrik/issue-labeled-ping@v1 with: - recipients: | - ulab=@v923z + github-token: ${{ secrets.GITHUB_TOKEN }} + user: v923z + label: ulab + message: Heads up {user} - the "{label}" label was applied to this issue. diff --git a/.github/workflows/ports_windows.yml b/.github/workflows/ports_windows.yml index 6d38f3b853..ba2042660a 100644 --- a/.github/workflows/ports_windows.yml +++ b/.github/workflows/ports_windows.yml @@ -4,7 +4,7 @@ on: push: pull_request: paths: - - '.github/workflows/*.yml' + - '.github/workflows/ports_windows.yml' - 'extmod/**' - 'lib/**' - 'mpy-cross/**' @@ -19,8 +19,8 @@ concurrency: cancel-in-progress: true jobs: - build: - runs-on: windows-2019 + windows: + runs-on: windows-2022 defaults: run: # We define a custom shell script here, although `msys2.cmd` does neither exist nor is it available in the PATH yet @@ -32,8 +32,7 @@ jobs: shell: bash - name: Check python coding (cmd) - run: | - python -c "import sys, locale; print(sys.getdefaultencoding(), locale.getpreferredencoding(False))" + run: python -c "import sys, locale; print(sys.getdefaultencoding(), locale.getpreferredencoding(False))" shell: cmd # We use a JS Action, which calls the system terminal or other custom terminals directly, if required @@ -71,16 +70,16 @@ jobs: which python; python --version; python -c "import cascadetoml" which python3; python3 --version; python3 -c "import cascadetoml" - - uses: actions/checkout@v3 + - name: Set up repository + uses: actions/checkout@v3 with: submodules: false fetch-depth: 1 - - name: Get CP deps - run: python tools/ci_fetch_deps.py windows ${{ github.sha }} - - name: CircuitPython version - run: | - tools/describe || git log --parents HEAD~4.. - echo >>$GITHUB_ENV CP_VERSION=$(tools/describe) + + - name: Set up submodules + uses: ./.github/actions/deps/submodules + with: + version: true - name: build mpy-cross run: make -j2 -C mpy-cross diff --git a/.github/workflows/pre-commit.yml b/.github/workflows/pre-commit.yml index 556f89e63c..c0dff33564 100644 --- a/.github/workflows/pre-commit.yml +++ b/.github/workflows/pre-commit.yml @@ -16,24 +16,23 @@ jobs: pre-commit: runs-on: ubuntu-22.04 steps: - - uses: actions/checkout@v3 - - name: Set up Python 3 + - name: Set up repository + uses: actions/checkout@v3 + with: + submodules: false + fetch-depth: 1 + - name: Set up python uses: actions/setup-python@v4 with: - python-version: "3.10" - - name: Install deps - run: | - 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@v3 - with: - path: ~/.cache/pre-commit - key: pre-commit|${{ env.PY }}|${{ hashFiles('.pre-commit-config.yaml') }} - - uses: pre-commit/action@v3.0.0 + python-version: 3.x + - name: Set up submodules + uses: ./.github/actions/deps/submodules + - name: Set up external + uses: ./.github/actions/deps/external + - name: Install dependencies + run: sudo apt-get install -y gettext uncrustify + - name: Run pre-commit + uses: pre-commit/action@v3.0.0 - name: Make patch if: failure() run: git diff > ~/pre-commit.patch diff --git a/.github/workflows/run-tests.yml b/.github/workflows/run-tests.yml new file mode 100644 index 0000000000..12e8d2ef74 --- /dev/null +++ b/.github/workflows/run-tests.yml @@ -0,0 +1,67 @@ +name: Run tests + +on: + workflow_call: + inputs: + cp-version: + required: true + type: string + +jobs: + run: + runs-on: ubuntu-20.04 + strategy: + fail-fast: false + matrix: + test: [all, mpy, native, native_mpy] + env: + CP_VERSION: ${{ inputs.cp-version }} + MICROPY_CPYTHON3: python3.8 + MICROPY_MICROPYTHON: ../ports/unix/micropython-coverage + TEST_all: + TEST_mpy: --via-mpy -d basics float micropython + TEST_native: --emit native + TEST_native_mpy: --via-mpy --emit native -d basics float micropython + steps: + - name: Set up repository + uses: actions/checkout@v3 + with: + submodules: false + fetch-depth: 1 + - name: Set up python + uses: actions/setup-python@v4 + with: + python-version: 3.x + - name: Set up submodules + uses: ./.github/actions/deps/submodules + with: + target: tests + - name: Set up external + if: matrix.test == 'all' + uses: ./.github/actions/deps/external + - name: Set up mpy-cross + uses: ./.github/actions/mpy_cross + - name: Build unix port + run: make -C ports/unix VARIANT=coverage -j2 + - name: Run tests + run: ./run-tests.py -j2 ${{ env[format('TEST_{0}', matrix.test)] }} + working-directory: tests + - name: Print failure info + run: ./run-tests.py -j2 --print-failures + if: failure() + working-directory: tests + - name: Build native modules + if: matrix.test == 'all' + run: | + make -C examples/natmod/features1 + make -C examples/natmod/features2 + make -C examples/natmod/btree + make -C examples/natmod/framebuf + make -C examples/natmod/uheapq + make -C examples/natmod/urandom + make -C examples/natmod/ure + make -C examples/natmod/uzlib + - name: Test native modules + if: matrix.test == 'all' + run: ./run-natmodtests.py extmod/{btree*,framebuf*,uheapq*,ure*,uzlib*}.py + working-directory: tests diff --git a/.gitignore b/.gitignore index 2fdfe207a2..9cb1e9ea5e 100644 --- a/.gitignore +++ b/.gitignore @@ -9,6 +9,7 @@ !atmel-samd/asf/**/*.a *.elf *.bin +!*.toml.bin *.map *.hex *.dis diff --git a/.gitmodules b/.gitmodules index f13eb79e45..dfd718630c 100644 --- a/.gitmodules +++ b/.gitmodules @@ -146,7 +146,7 @@ [submodule "ports/espressif/esp-idf"] path = ports/espressif/esp-idf url = https://github.com/adafruit/esp-idf.git - branch = circuitpython8 + branch = release/v4.4-circuitpython [submodule "ports/espressif/certificates/nina-fw"] path = lib/certificates/nina-fw url = https://github.com/adafruit/nina-fw.git @@ -310,12 +310,15 @@ [submodule "ports/espressif/esp32-camera"] path = ports/espressif/esp32-camera url = https://github.com/adafruit/esp32-camera/ + branch = circuitpython [submodule "ports/raspberrypi/lib/cyw43-driver"] path = ports/raspberrypi/lib/cyw43-driver - url = https://github.com/georgerobotics/cyw43-driver.git + url = https://github.com/adafruit/cyw43-driver.git + branch = circuitpython8 [submodule "ports/raspberrypi/lib/lwip"] path = ports/raspberrypi/lib/lwip - url = https://github.com/lwip-tcpip/lwip.git + url = https://github.com/adafruit/lwip.git + branch = circuitpython8 [submodule "lib/mbedtls"] path = lib/mbedtls url = https://github.com/ARMmbed/mbedtls.git diff --git a/.readthedocs.yml b/.readthedocs.yml index 94ba8750b0..29a915766f 100644 --- a/.readthedocs.yml +++ b/.readthedocs.yml @@ -14,7 +14,7 @@ build: python: "3" jobs: post_install: - - python tools/ci_fetch_deps.py docs HEAD + - python tools/ci_fetch_deps.py build-doc formats: - pdf diff --git a/Makefile b/Makefile index b35b5c66b9..91d842231f 100644 --- a/Makefile +++ b/Makefile @@ -90,7 +90,7 @@ clean: rm -rf autoapi rm -rf $(STUBDIR) $(DISTDIR) *.egg-info -html: stubs +html: $(SPHINXBUILD) -b html $(ALLSPHINXOPTS) $(BUILDDIR)/html @echo @echo "Build finished. The HTML pages are in $(BUILDDIR)/html." @@ -323,10 +323,11 @@ clean-nrf: clean-stm: $(MAKE) -C ports/stm BOARD=feather_stm32f405_express clean + +# This update will fail because the commits we need aren't the latest on the +# branch. We can ignore that though because we fix it with the second command. +# (Only works for git servers that allow sha fetches.) .PHONY: fetch-submodules fetch-submodules: - # This update will fail because the commits we need aren't the latest on the - # branch. We can ignore that though because we fix it with the second command. - # (Only works for git servers that allow sha fetches.) git submodule update --init -N --depth 1 || true git submodule foreach 'git fetch --tags --depth 1 origin $$sha1 && git checkout -q $$sha1' diff --git a/README.rst b/README.rst index d8a35fb98c..1a6dc2c33e 100644 --- a/README.rst +++ b/README.rst @@ -138,6 +138,16 @@ Behavior - Adds a safe mode that does not run user code after a hard crash or brown out. This makes it 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. +- Safe mode may be handled programmatically by providing a ``safemode.py``. + ``safemode.py`` is run if the board has reset due to entering safe mode, unless the safe mode + initiated by the user by pressing button(s). + USB is not available so nothing can be printed. + ``safemode.py`` can determine why the safe mode occurred + using ``supervisor.runtime.safe_mode_reason``, and take appropriate action. For instance, + if a hard crash occurred, ``safemode.py`` may do a ``microcontroller.reset()`` + to automatically restart despite the crash. + If the battery is low, but is being charged, ``safemode.py`` may put the board in deep sleep + for a while. Or it may simply reset, and have ``code.py`` check the voltage and do the sleep. - RGB status LED indicating CircuitPython state. - One green flash - code completed without error. - Two red flashes - code ended due to an exception. @@ -145,9 +155,9 @@ Behavior - 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``, - ``main.txt`` -- Boot is one of these: ``boot.py``, ``boot.txt`` +- ``code.py`` may also be named``code.txt``, ``main.py``, or ``main.txt``. +- ``boot.py`` may also be named ``boot.txt``. +- ``safemode.py`` may also be named ``safemode.txt``. API ~~~ diff --git a/conf.py b/conf.py index 90f58979d9..7b3b4ca585 100644 --- a/conf.py +++ b/conf.py @@ -171,6 +171,7 @@ exclude_patterns = ["**/build*", ".env", ".venv", ".direnv", + ".devcontainer/Readme.md", "data", "docs/autoapi", "docs/README.md", diff --git a/devices/ble_hci/common-hal/_bleio/Adapter.c b/devices/ble_hci/common-hal/_bleio/Adapter.c index 8c7b8f67eb..f558d66d40 100644 --- a/devices/ble_hci/common-hal/_bleio/Adapter.c +++ b/devices/ble_hci/common-hal/_bleio/Adapter.c @@ -49,8 +49,8 @@ #include "shared-bindings/_bleio/ScanEntry.h" #include "shared-bindings/time/__init__.h" -#if CIRCUITPY_DOTENV -#include "shared-module/dotenv/__init__.h" +#if CIRCUITPY_OS_GETENV +#include "shared-bindings/os/__init__.h" #endif #define MSEC_TO_UNITS(TIME, RESOLUTION) (((TIME) * 1000) / (RESOLUTION)) @@ -284,15 +284,15 @@ char default_ble_name[] = { 'C', 'I', 'R', 'C', 'U', 'I', 'T', 'P', 'Y', 0, 0, 0 STATIC void bleio_adapter_hci_init(bleio_adapter_obj_t *self) { 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) { - self->name = mp_obj_new_str(ble_name, (size_t)name_len); + #if CIRCUITPY_OS_GETENV + mp_obj_t name = common_hal_os_getenv("CIRCUITPY_BLE_NAME", mp_const_none); + if (name != mp_const_none) { + mp_arg_validate_type_string(name, MP_QSTR_CIRCUITPY_BLE_NAME); + self->name = name; } #endif - if (name_len <= 0) { + if (!self->name) { name_len = sizeof(default_ble_name); bt_addr_t addr; hci_check_error(hci_read_bd_addr(&addr)); diff --git a/docs/design_guide.rst b/docs/design_guide.rst index 4170d499fe..784284892c 100644 --- a/docs/design_guide.rst +++ b/docs/design_guide.rst @@ -267,6 +267,14 @@ After the license comment:: """ +Version description +^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + +After the import statements:: + + __version__ = "0.0.0+auto.0" + __repo__ = "" + Class description ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ diff --git a/docs/drivers.rst b/docs/drivers.rst deleted file mode 100644 index 8855abbd2d..0000000000 --- a/docs/drivers.rst +++ /dev/null @@ -1,33 +0,0 @@ -Additional CircuitPython Libraries and Drivers on GitHub -========================================================= - -These are libraries and drivers available in separate GitHub repos. They are -designed for use with CircuitPython and may or may not work with -`MicroPython `_. - - -Adafruit CircuitPython Library Bundle --------------------------------------- - -We provide a bundle of all our libraries to ease installation of drivers and -their dependencies. The bundle is primarily geared to the Adafruit Express line -of boards which feature a relatively large external flash. With Express boards, -it's easy to copy them all onto the filesystem. However, if you don't have -enough space simply copy things over as they are needed. - -- The Adafruit bundles are available on GitHub: . - -- Documentation for the bundle, which includes links to documentation for all - libraries, is available here: . - - -CircuitPython Community Library Bundle ---------------------------------------- - -This bundle contains non-Adafruit sponsored libraries, that are written and submitted -by members of the community. - -- The Community bundles are available on GitHub: . - -- Documentation is not available on ReadTheDocs at this time. See each library for any - included documentation. diff --git a/docs/environment.rst b/docs/environment.rst index 5766b54380..58ada402c6 100644 --- a/docs/environment.rst +++ b/docs/environment.rst @@ -6,24 +6,49 @@ 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. +CircuitPython uses a file called ``settings.toml`` 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 ``settings.toml`` file contents +on every access. -These libraries store environment variables in a ``.env`` file. Here is a simple -example: +CircuitPython only supports a subset of the full toml specification, see below +for more details. The subset is very "Python-like", which is a key reason we +selected the format. -.. code-block:: bash +Due to technical limitations it probably also accepts some files that are +not valid TOML files; bugs of this nature are subject to change (i.e., be +fixed) without the usual deprecation period for incompatible changes. - KEY1='value1' - # Comment - KEY2='value2 - is multiple lines' +File format example: -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. +.. code-block:: + + str_key="Hello world" # with trailing comment + int_key = 7 + unicode_key="œuvre" + unicode_key2="\\u0153uvre" # same as above + unicode_key3="\\U00000153uvre" # same as above + escape_codes="supported, including \\r\\n\\"\\\\" + # comment + [subtable] + subvalue="cannot retrieve this using getenv" + + +Details of the toml language subset +----------------------------------- + +* The content is required to be in UTF-8 encoding +* The supported data types are string and integer +* Only basic strings are supported, not triple-quoted strings +* Only integers supported by strtol. (no 0o, no 0b, no underscores 1_000, 011 + is 9, not 11) +* Only bare keys are supported +* Duplicate keys are not diagnosed. +* Comments are supported +* Only values from the "root table" can be retrieved +* due to technical limitations, the content of multi-line + strings can erroneously be parsed as a value. CircuitPython behavior ---------------------- diff --git a/docs/index.rst b/docs/index.rst index abc0236995..e49b74b4e3 100644 --- a/docs/index.rst +++ b/docs/index.rst @@ -21,7 +21,7 @@ Full Table of Contents ../shared-bindings/index.rst supported_ports.rst troubleshooting.rst - drivers.rst + libraries.rst workflows environment.rst diff --git a/docs/libraries.rst b/docs/libraries.rst new file mode 100644 index 0000000000..2d34ccbe3f --- /dev/null +++ b/docs/libraries.rst @@ -0,0 +1,31 @@ +Adafruit CircuitPython Libraries +================================ + +Documentation for all Adafruit-sponsored CircuitPython libraries is at: +. + + +CircuitPython Library Bundles +============================= + +Many Python libraries, including device drivers, have been written for use with CircuitPython. +They are maintained in separate GitHub repos, one per library. + +Libraries are packaged in *bundles*, which are ZIP files that are snapshots in time of a group of libraries. + +Adafruit sponsors and maintains several hundred libraries, packaged in the **Adafruit Library Bundle**. +Adafruit-sponsored libraries are also available on . + +Yet other libraries are maintained by members of the CircuitPython community, +and are packaged in the **CircuitPython Community Library Bundle**. + +The Adafruit bundles are available on GitHub: . +The Community bundles are available at: . + +More detailed information about the bundles, and download links for the latest bundles +are at . + +Documentation about bundle construction is at: . + +Documentation for Community Libraries is not available on ReadTheDocs at this time. See the GitHub repository +for each library for any included documentation. diff --git a/docs/library/asyncio.rst b/docs/library/asyncio.rst deleted file mode 100644 index 87417f55e2..0000000000 --- a/docs/library/asyncio.rst +++ /dev/null @@ -1,323 +0,0 @@ -:mod:`uasyncio` --- asynchronous I/O scheduler -============================================== - -.. module:: uasyncio - :synopsis: asynchronous I/O scheduler for writing concurrent code - -|see_cpython_module| -`asyncio `_ - -Example:: - - import uasyncio - - async def blink(led, period_ms): - while True: - led.on() - await uasyncio.sleep_ms(5) - led.off() - await uasyncio.sleep_ms(period_ms) - - async def main(led1, led2): - uasyncio.create_task(blink(led1, 700)) - uasyncio.create_task(blink(led2, 400)) - await uasyncio.sleep_ms(10_000) - - # Running on a pyboard - from pyb import LED - uasyncio.run(main(LED(1), LED(2))) - - # Running on a generic board - from machine import Pin - uasyncio.run(main(Pin(1), Pin(2))) - -Core functions --------------- - -.. function:: create_task(coro) - - Create a new task from the given coroutine and schedule it to run. - - Returns the corresponding `Task` object. - -.. function:: current_task() - - Return the `Task` object associated with the currently running task. - -.. function:: run(coro) - - Create a new task from the given coroutine and run it until it completes. - - Returns the value returned by *coro*. - -.. function:: sleep(t) - - Sleep for *t* seconds (can be a float). - - This is a coroutine. - -.. function:: sleep_ms(t) - - Sleep for *t* milliseconds. - - This is a coroutine, and a MicroPython extension. - -Additional functions --------------------- - -.. function:: wait_for(awaitable, timeout) - - Wait for the *awaitable* to complete, but cancel it if it takes longer - that *timeout* seconds. If *awaitable* is not a task then a task will be - created from it. - - If a timeout occurs, it cancels the task and raises ``asyncio.TimeoutError``: - this should be trapped by the caller. - - Returns the return value of *awaitable*. - - This is a coroutine. - -.. function:: wait_for_ms(awaitable, timeout) - - Similar to `wait_for` but *timeout* is an integer in milliseconds. - - This is a coroutine, and a MicroPython extension. - -.. function:: gather(*awaitables, return_exceptions=False) - - Run all *awaitables* concurrently. Any *awaitables* that are not tasks are - promoted to tasks. - - Returns a list of return values of all *awaitables*. - - This is a coroutine. - -class Task ----------- - -.. class:: Task() - - This object wraps a coroutine into a running task. Tasks can be waited on - using ``await task``, which will wait for the task to complete and return - the return value of the task. - - Tasks should not be created directly, rather use `create_task` to create them. - -.. method:: Task.cancel() - - Cancel the task by injecting a ``CancelledError`` into it. The task may - or may not ignore this exception. - -class Event ------------ - -.. class:: Event() - - Create a new event which can be used to synchronise tasks. Events start - in the cleared state. - -.. method:: Event.is_set() - - Returns ``True`` if the event is set, ``False`` otherwise. - -.. method:: Event.set() - - Set the event. Any tasks waiting on the event will be scheduled to run. - -.. method:: Event.clear() - - Clear the event. - -.. method:: Event.wait() - - Wait for the event to be set. If the event is already set then it returns - immediately. - - This is a coroutine. - -class Lock ----------- - -.. class:: Lock() - - Create a new lock which can be used to coordinate tasks. Locks start in - the unlocked state. - - In addition to the methods below, locks can be used in an ``async with`` statement. - -.. method:: Lock.locked() - - Returns ``True`` if the lock is locked, otherwise ``False``. - -.. method:: Lock.acquire() - - Wait for the lock to be in the unlocked state and then lock it in an atomic - way. Only one task can acquire the lock at any one time. - - This is a coroutine. - -.. method:: Lock.release() - - Release the lock. If any tasks are waiting on the lock then the next one in the - queue is scheduled to run and the lock remains locked. Otherwise, no tasks are - waiting an the lock becomes unlocked. - -TCP stream connections ----------------------- - -.. function:: open_connection(host, port) - - Open a TCP connection to the given *host* and *port*. The *host* address will be - resolved using `socket.getaddrinfo`, which is currently a blocking call. - - Returns a pair of streams: a reader and a writer stream. - Will raise a socket-specific ``OSError`` if the host could not be resolved or if - the connection could not be made. - - This is a coroutine. - -.. function:: start_server(callback, host, port, backlog=5) - - Start a TCP server on the given *host* and *port*. The *callback* will be - called with incoming, accepted connections, and be passed 2 arguments: reader - and writer streams for the connection. - - Returns a `Server` object. - - This is a coroutine. - -.. class:: Stream() - - This represents a TCP stream connection. To minimise code this class implements - both a reader and a writer, and both ``StreamReader`` and ``StreamWriter`` alias to - this class. - -.. method:: Stream.get_extra_info(v) - - Get extra information about the stream, given by *v*. The valid values for *v* are: - ``peername``. - -.. method:: Stream.close() - - Close the stream. - -.. method:: Stream.wait_closed() - - Wait for the stream to close. - - This is a coroutine. - -.. method:: Stream.read(n) - - Read up to *n* bytes and return them. - - This is a coroutine. - -.. method:: Stream.readinto(buf) - - Read up to n bytes into *buf* with n being equal to the length of *buf*. - - Return the number of bytes read into *buf*. - - This is a coroutine, and a MicroPython extension. - -.. method:: Stream.readexactly(n) - - Read exactly *n* bytes and return them as a bytes object. - - Raises an ``EOFError`` exception if the stream ends before reading *n* bytes. - - This is a coroutine. - -.. method:: Stream.readline() - - Read a line and return it. - - This is a coroutine. - -.. method:: Stream.write(buf) - - Accumulated *buf* to the output buffer. The data is only flushed when - `Stream.drain` is called. It is recommended to call `Stream.drain` immediately - after calling this function. - -.. method:: Stream.drain() - - Drain (write) all buffered output data out to the stream. - - This is a coroutine. - -.. class:: Server() - - This represents the server class returned from `start_server`. It can be used - in an ``async with`` statement to close the server upon exit. - -.. method:: Server.close() - - Close the server. - -.. method:: Server.wait_closed() - - Wait for the server to close. - - This is a coroutine. - -Event Loop ----------- - -.. function:: get_event_loop() - - Return the event loop used to schedule and run tasks. See `Loop`. - -.. function:: new_event_loop() - - Reset the event loop and return it. - - Note: since MicroPython only has a single event loop this function just - resets the loop's state, it does not create a new one. - -.. class:: Loop() - - This represents the object which schedules and runs tasks. It cannot be - created, use `get_event_loop` instead. - -.. method:: Loop.create_task(coro) - - Create a task from the given *coro* and return the new `Task` object. - -.. method:: Loop.run_forever() - - Run the event loop until `stop()` is called. - -.. method:: Loop.run_until_complete(awaitable) - - Run the given *awaitable* until it completes. If *awaitable* is not a task - then it will be promoted to one. - -.. method:: Loop.stop() - - Stop the event loop. - -.. method:: Loop.close() - - Close the event loop. - -.. method:: Loop.set_exception_handler(handler) - - Set the exception handler to call when a Task raises an exception that is not - caught. The *handler* should accept two arguments: ``(loop, context)``. - -.. method:: Loop.get_exception_handler() - - Get the current exception handler. Returns the handler, or ``None`` if no - custom handler is set. - -.. method:: Loop.default_exception_handler(context) - - The default exception handler that is called. - -.. method:: Loop.call_exception_handler(context) - - Call the current exception handler. The argument *context* is passed through and - is a dictionary containing keys: ``'message'``, ``'exception'``, ``'future'``. diff --git a/docs/library/index.rst b/docs/library/index.rst index b71949c2dd..2a8e37a8f4 100644 --- a/docs/library/index.rst +++ b/docs/library/index.rst @@ -35,7 +35,6 @@ These libraries are not currently enabled in any CircuitPython build, but may be json.rst re.rst sys.rst - asyncio.rst ctypes.rst select.rst diff --git a/docs/workflows.md b/docs/workflows.md index 26f5179b51..29229bd00e 100644 --- a/docs/workflows.md +++ b/docs/workflows.md @@ -46,7 +46,7 @@ connection, the central device can discover two default services. One for file t 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 +can be put in the `settings.toml` 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 @@ -69,21 +69,21 @@ 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 +The web workflow is depends on adding Wi-Fi credentials into the `settings.toml` 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`: +Here is an example `/settings.toml`: ```bash # To auto-connect to Wi-Fi -CIRCUITPY_WIFI_SSID='scottswifi' -CIRCUITPY_WIFI_PASSWORD='secretpassword' +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_PASSWORD="passw0rd" CIRCUITPY_WEB_API_PORT=80 ``` @@ -124,7 +124,7 @@ All file system related APIs are protected by HTTP basic authentication. It is * 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 +The password is taken from `settings.toml` 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`. diff --git a/extmod/ulab b/extmod/ulab index 25a825e41c..f2dd2230c4 160000 --- a/extmod/ulab +++ b/extmod/ulab @@ -1 +1 @@ -Subproject commit 25a825e41c26cfcee018b762416741d0d63aeabf +Subproject commit f2dd2230c4fdf1aa5c7a160782efdde18e8204bb diff --git a/extmod/vfs_fat.c b/extmod/vfs_fat.c index 2a00566317..0a9737e53a 100644 --- a/extmod/vfs_fat.c +++ b/extmod/vfs_fat.c @@ -429,6 +429,18 @@ STATIC mp_obj_t vfs_fat_utime(mp_obj_t vfs_in, mp_obj_t path_in, mp_obj_t times_ } STATIC MP_DEFINE_CONST_FUN_OBJ_3(fat_vfs_utime_obj, vfs_fat_utime); +STATIC mp_obj_t vfs_fat_getreadonly(mp_obj_t self_in) { + fs_user_mount_t *self = MP_OBJ_TO_PTR(self_in); + return mp_obj_new_bool(!filesystem_is_writable_by_python(self)); +} +STATIC MP_DEFINE_CONST_FUN_OBJ_1(fat_vfs_getreadonly_obj, vfs_fat_getreadonly); +STATIC const mp_obj_property_t fat_vfs_readonly_obj = { + .base.type = &mp_type_property, + .proxy = {(mp_obj_t)&fat_vfs_getreadonly_obj, + MP_ROM_NONE, + MP_ROM_NONE}, +}; + #if MICROPY_FATFS_USE_LABEL STATIC mp_obj_t vfs_fat_getlabel(mp_obj_t self_in) { fs_user_mount_t *self = MP_OBJ_TO_PTR(self_in); @@ -481,6 +493,7 @@ STATIC const mp_rom_map_elem_t fat_vfs_locals_dict_table[] = { { MP_ROM_QSTR(MP_QSTR_mount), MP_ROM_PTR(&vfs_fat_mount_obj) }, { MP_ROM_QSTR(MP_QSTR_umount), MP_ROM_PTR(&fat_vfs_umount_obj) }, { MP_ROM_QSTR(MP_QSTR_utime), MP_ROM_PTR(&fat_vfs_utime_obj) }, + { MP_ROM_QSTR(MP_QSTR_readonly), MP_ROM_PTR(&fat_vfs_readonly_obj) }, #if MICROPY_FATFS_USE_LABEL { MP_ROM_QSTR(MP_QSTR_label), MP_ROM_PTR(&fat_vfs_label_obj) }, #endif diff --git a/frozen/Adafruit_CircuitPython_APDS9960 b/frozen/Adafruit_CircuitPython_APDS9960 index ba05423ed9..9ddd596505 160000 --- a/frozen/Adafruit_CircuitPython_APDS9960 +++ b/frozen/Adafruit_CircuitPython_APDS9960 @@ -1 +1 @@ -Subproject commit ba05423ed9aae09ce293603b519a4ac644ef0dab +Subproject commit 9ddd59650598b7a0641d70aabcc8aab71799cb93 diff --git a/frozen/Adafruit_CircuitPython_BLE b/frozen/Adafruit_CircuitPython_BLE index 4fd499e397..e07e1853d7 160000 --- a/frozen/Adafruit_CircuitPython_BLE +++ b/frozen/Adafruit_CircuitPython_BLE @@ -1 +1 @@ -Subproject commit 4fd499e39720f8ce970cceeb97c2a85c485f7335 +Subproject commit e07e1853d7e995b9797a064c098bccc5c384632e diff --git a/frozen/Adafruit_CircuitPython_DRV2605 b/frozen/Adafruit_CircuitPython_DRV2605 index 4a4619a524..ab0ffa938d 160000 --- a/frozen/Adafruit_CircuitPython_DRV2605 +++ b/frozen/Adafruit_CircuitPython_DRV2605 @@ -1 +1 @@ -Subproject commit 4a4619a524918f2705c05ca4959385937afa9a7c +Subproject commit ab0ffa938dfa7eb1fd7260353a7a4e28f55e537a diff --git a/frozen/Adafruit_CircuitPython_DS3231 b/frozen/Adafruit_CircuitPython_DS3231 index 726270f510..e6a9a0140e 160000 --- a/frozen/Adafruit_CircuitPython_DS3231 +++ b/frozen/Adafruit_CircuitPython_DS3231 @@ -1 +1 @@ -Subproject commit 726270f5103d9d94810eb8b52041b7521afafc5c +Subproject commit e6a9a0140ed44ef5f15d8040fce35b5319c1f216 diff --git a/frozen/Adafruit_CircuitPython_Display_Shapes b/frozen/Adafruit_CircuitPython_Display_Shapes index 656be4d791..cf2b173d0f 160000 --- a/frozen/Adafruit_CircuitPython_Display_Shapes +++ b/frozen/Adafruit_CircuitPython_Display_Shapes @@ -1 +1 @@ -Subproject commit 656be4d79196b5f25ab9ebca731d448c5b3bdc17 +Subproject commit cf2b173d0fc3ac2cd961754c6adf8f614a1c7c39 diff --git a/frozen/Adafruit_CircuitPython_Display_Text b/frozen/Adafruit_CircuitPython_Display_Text index 6cf9f3cf32..1590d81f7d 160000 --- a/frozen/Adafruit_CircuitPython_Display_Text +++ b/frozen/Adafruit_CircuitPython_Display_Text @@ -1 +1 @@ -Subproject commit 6cf9f3cf32e0c176c861de6356813ea4d08034d6 +Subproject commit 1590d81f7d1474b25aed6a0cb793c7e6dc7634ec diff --git a/frozen/Adafruit_CircuitPython_IRRemote b/frozen/Adafruit_CircuitPython_IRRemote index 992b601e24..340c62ef6c 160000 --- a/frozen/Adafruit_CircuitPython_IRRemote +++ b/frozen/Adafruit_CircuitPython_IRRemote @@ -1 +1 @@ -Subproject commit 992b601e2469f30e95ec35c9859b4aa2cd917504 +Subproject commit 340c62ef6ce867b3924d166afc3d2a171680f799 diff --git a/frozen/Adafruit_CircuitPython_IS31FL3731 b/frozen/Adafruit_CircuitPython_IS31FL3731 index 794488d1de..8e0f081a0f 160000 --- a/frozen/Adafruit_CircuitPython_IS31FL3731 +++ b/frozen/Adafruit_CircuitPython_IS31FL3731 @@ -1 +1 @@ -Subproject commit 794488d1de3d17d1a08887c4a651cfac2c5a1524 +Subproject commit 8e0f081a0fcc94053b8ef480a916b10855a3c0d5 diff --git a/frozen/Adafruit_CircuitPython_LC709203F b/frozen/Adafruit_CircuitPython_LC709203F index 1919916dcf..38bd02f014 160000 --- a/frozen/Adafruit_CircuitPython_LC709203F +++ b/frozen/Adafruit_CircuitPython_LC709203F @@ -1 +1 @@ -Subproject commit 1919916dcf57e0879832b9c274c5fb77712d7775 +Subproject commit 38bd02f014403954ab52154e3877e502d83862dc diff --git a/frozen/Adafruit_CircuitPython_LIS3DH b/frozen/Adafruit_CircuitPython_LIS3DH index 5b4703428f..61ca58788a 160000 --- a/frozen/Adafruit_CircuitPython_LIS3DH +++ b/frozen/Adafruit_CircuitPython_LIS3DH @@ -1 +1 @@ -Subproject commit 5b4703428fc299ac268d08350c885122b2af1e75 +Subproject commit 61ca58788aabd53558e10c32064a1304aa7454f2 diff --git a/frozen/Adafruit_CircuitPython_LSM6DS b/frozen/Adafruit_CircuitPython_LSM6DS index c8e82b96c6..d689ca77c6 160000 --- a/frozen/Adafruit_CircuitPython_LSM6DS +++ b/frozen/Adafruit_CircuitPython_LSM6DS @@ -1 +1 @@ -Subproject commit c8e82b96c68041a11a52f3053d0d2733ae2d1a49 +Subproject commit d689ca77c67806484037e00110c669cf55846b6e diff --git a/frozen/Adafruit_CircuitPython_MIDI b/frozen/Adafruit_CircuitPython_MIDI index b6891e7341..e38bf1f9cf 160000 --- a/frozen/Adafruit_CircuitPython_MIDI +++ b/frozen/Adafruit_CircuitPython_MIDI @@ -1 +1 @@ -Subproject commit b6891e734183f978e7b3d0a363140e98635c0a04 +Subproject commit e38bf1f9cf1e8faeb7d15a1d10674fb2c0a81e72 diff --git a/frozen/Adafruit_CircuitPython_Motor b/frozen/Adafruit_CircuitPython_Motor index 31c819f377..f26bead58d 160000 --- a/frozen/Adafruit_CircuitPython_Motor +++ b/frozen/Adafruit_CircuitPython_Motor @@ -1 +1 @@ -Subproject commit 31c819f377cf71f61cfb84eae159f1f948980db7 +Subproject commit f26bead58d3c4036eced586d275396816e92e80a diff --git a/frozen/Adafruit_CircuitPython_NeoPixel b/frozen/Adafruit_CircuitPython_NeoPixel index 1064fdee5a..9516aa97e9 160000 --- a/frozen/Adafruit_CircuitPython_NeoPixel +++ b/frozen/Adafruit_CircuitPython_NeoPixel @@ -1 +1 @@ -Subproject commit 1064fdee5a1421f528af452be5e45ae95ef2b89a +Subproject commit 9516aa97e9216eac2b229fbb7dac34fa60c347c4 diff --git a/frozen/Adafruit_CircuitPython_PortalBase b/frozen/Adafruit_CircuitPython_PortalBase index 7eeea1aaf6..759c5c3488 160000 --- a/frozen/Adafruit_CircuitPython_PortalBase +++ b/frozen/Adafruit_CircuitPython_PortalBase @@ -1 +1 @@ -Subproject commit 7eeea1aaf6bb5fa0deb080a1dc1aa3cd103f9aad +Subproject commit 759c5c348878932adc5fcc9e4f3b3f570b43e17f diff --git a/frozen/Adafruit_CircuitPython_ProgressBar b/frozen/Adafruit_CircuitPython_ProgressBar index cad34af526..74a1c26110 160000 --- a/frozen/Adafruit_CircuitPython_ProgressBar +++ b/frozen/Adafruit_CircuitPython_ProgressBar @@ -1 +1 @@ -Subproject commit cad34af5267aca3665fdaf1ea5a0eee921d13f06 +Subproject commit 74a1c261103cda43172053ff2370777255b9bf8d diff --git a/frozen/Adafruit_CircuitPython_RFM9x b/frozen/Adafruit_CircuitPython_RFM9x index df4c73a5e7..c46c59e300 160000 --- a/frozen/Adafruit_CircuitPython_RFM9x +++ b/frozen/Adafruit_CircuitPython_RFM9x @@ -1 +1 @@ -Subproject commit df4c73a5e719f17fae0309e811ff17627cd0f268 +Subproject commit c46c59e3004817c708c78c59d247b02161c6bf06 diff --git a/frozen/Adafruit_CircuitPython_Register b/frozen/Adafruit_CircuitPython_Register index f611d5e31c..46a49205f3 160000 --- a/frozen/Adafruit_CircuitPython_Register +++ b/frozen/Adafruit_CircuitPython_Register @@ -1 +1 @@ -Subproject commit f611d5e31c9735a3c3ac43185e35dcd5f659e3aa +Subproject commit 46a49205f3f14546273dd1267e66cad82f03986c diff --git a/frozen/Adafruit_CircuitPython_Requests b/frozen/Adafruit_CircuitPython_Requests index 317f4bdb79..203d0b1489 160000 --- a/frozen/Adafruit_CircuitPython_Requests +++ b/frozen/Adafruit_CircuitPython_Requests @@ -1 +1 @@ -Subproject commit 317f4bdb799afa59b164def4ea0610f57db9922e +Subproject commit 203d0b1489cb90a39f8a780570287f1a5bd610a0 diff --git a/frozen/Adafruit_CircuitPython_SD b/frozen/Adafruit_CircuitPython_SD index bb2fc8c157..eb17bffa75 160000 --- a/frozen/Adafruit_CircuitPython_SD +++ b/frozen/Adafruit_CircuitPython_SD @@ -1 +1 @@ -Subproject commit bb2fc8c157ee44869cde4cbc1ab20e6f31ac727f +Subproject commit eb17bffa757dc8c0a53fe9e61c45246c06418099 diff --git a/frozen/Adafruit_CircuitPython_ST7789 b/frozen/Adafruit_CircuitPython_ST7789 index 9ff56ce53f..e23c487145 160000 --- a/frozen/Adafruit_CircuitPython_ST7789 +++ b/frozen/Adafruit_CircuitPython_ST7789 @@ -1 +1 @@ -Subproject commit 9ff56ce53f05e23ff678965ba54af89b24b1199a +Subproject commit e23c4871456cdf0ef1bfb59d1c2f6e38b7b640ee diff --git a/frozen/Adafruit_CircuitPython_SimpleIO b/frozen/Adafruit_CircuitPython_SimpleIO index 0a8fcbfc92..eac33b430b 160000 --- a/frozen/Adafruit_CircuitPython_SimpleIO +++ b/frozen/Adafruit_CircuitPython_SimpleIO @@ -1 +1 @@ -Subproject commit 0a8fcbfc92060eb298ea52d5e88587b37347a0be +Subproject commit eac33b430b0cbe1f6f583000f6b29f75bfe8507e diff --git a/frozen/Adafruit_CircuitPython_Ticks b/frozen/Adafruit_CircuitPython_Ticks index 7832bbb544..2634ca0163 160000 --- a/frozen/Adafruit_CircuitPython_Ticks +++ b/frozen/Adafruit_CircuitPython_Ticks @@ -1 +1 @@ -Subproject commit 7832bbb5449d55d8c7b731e4ff7490b801e94a9e +Subproject commit 2634ca0163020bebec300fcca6e0b5afcdc655b8 diff --git a/frozen/Adafruit_CircuitPython_UC8151D b/frozen/Adafruit_CircuitPython_UC8151D index 565fed5151..b6d9f852f5 160000 --- a/frozen/Adafruit_CircuitPython_UC8151D +++ b/frozen/Adafruit_CircuitPython_UC8151D @@ -1 +1 @@ -Subproject commit 565fed515138f962c4bcce0ee756d32e708a151a +Subproject commit b6d9f852f50b489615f3f357f9758d0073335334 diff --git a/frozen/Adafruit_CircuitPython_asyncio b/frozen/Adafruit_CircuitPython_asyncio index fbdb77d712..596cc896e5 160000 --- a/frozen/Adafruit_CircuitPython_asyncio +++ b/frozen/Adafruit_CircuitPython_asyncio @@ -1 +1 @@ -Subproject commit fbdb77d7127e7d6a8d3574440b0f790c94a28cf8 +Subproject commit 596cc896e5c8815caa2a6f405560833193848149 diff --git a/frozen/Adafruit_CircuitPython_seesaw b/frozen/Adafruit_CircuitPython_seesaw index 6234787515..d4ff0388f3 160000 --- a/frozen/Adafruit_CircuitPython_seesaw +++ b/frozen/Adafruit_CircuitPython_seesaw @@ -1 +1 @@ -Subproject commit 6234787515e2f0ece40b6408722ff0b42824038e +Subproject commit d4ff0388f3e3af2745864f2c3e5926f500673a40 diff --git a/lib/oofatfs/ff.c b/lib/oofatfs/ff.c index e6afd57800..9d3c67cf7d 100644 --- a/lib/oofatfs/ff.c +++ b/lib/oofatfs/ff.c @@ -257,6 +257,11 @@ #define GET_FATTIME() get_fattime() #endif +#if FF_FS_MAKE_VOLID == 1 +#define MAKE_VOLID(x) (make_volid()) +#else +#define MAKE_VOLID(x) (GET_FATTIME()) +#endif /* File lock controls */ #if FF_FS_LOCK != 0 @@ -5421,6 +5426,7 @@ FRESULT f_mkfs ( DWORD tbl[3]; #endif + DWORD volid = MAKE_VOLID(); /* Check mounted drive and clear work area */ fs->fs_type = 0; /* Clear mounted volume */ @@ -5622,7 +5628,7 @@ FRESULT f_mkfs ( st_dword(buf + BPB_DataOfsEx, b_data - b_vol); /* Data offset [sector] */ st_dword(buf + BPB_NumClusEx, n_clst); /* Number of clusters */ st_dword(buf + BPB_RootClusEx, 2 + tbl[0] + tbl[1]); /* Root dir cluster # */ - st_dword(buf + BPB_VolIDEx, GET_FATTIME()); /* VSN */ + st_dword(buf + BPB_VolIDEx, volid); /* VSN */ st_word(buf + BPB_FSVerEx, 0x100); /* Filesystem version (1.00) */ for (buf[BPB_BytsPerSecEx] = 0, i = ss; i >>= 1; buf[BPB_BytsPerSecEx]++) ; /* Log2 of sector size [byte] */ for (buf[BPB_SecPerClusEx] = 0, i = au; i >>= 1; buf[BPB_SecPerClusEx]++) ; /* Log2 of cluster size [sector] */ @@ -5758,7 +5764,7 @@ FRESULT f_mkfs ( st_dword(buf + BPB_HiddSec, b_vol); /* Volume offset in the physical drive [sector] */ #if FF_MKFS_FAT32 if (fmt == FS_FAT32) { - st_dword(buf + BS_VolID32, GET_FATTIME()); /* VSN */ + st_dword(buf + BS_VolID32, volid); /* VSN */ st_dword(buf + BPB_FATSz32, sz_fat); /* FAT size [sector] */ st_dword(buf + BPB_RootClus32, 2); /* Root directory cluster # (2) */ st_word(buf + BPB_FSInfo32, 1); /* Offset of FSINFO sector (VBR + 1) */ @@ -5769,7 +5775,7 @@ FRESULT f_mkfs ( } else #endif { - st_dword(buf + BS_VolID, GET_FATTIME()); /* VSN */ + st_dword(buf + BS_VolID, volid); /* VSN */ st_word(buf + BPB_FATSz16, (WORD)sz_fat); /* FAT size [sector] */ buf[BS_DrvNum] = 0x80; /* Drive number (for int13) */ buf[BS_BootSig] = 0x29; /* Extended boot signature */ diff --git a/lib/oofatfs/ff.h b/lib/oofatfs/ff.h index a8aa00e9af..b133d770db 100644 --- a/lib/oofatfs/ff.h +++ b/lib/oofatfs/ff.h @@ -334,6 +334,10 @@ FRESULT f_setcp (WORD cp); /* Set curre DWORD get_fattime (void); #endif +#if FF_FS_MAKE_VOLID +DWORD make_volid (void); +#endif + /* LFN support functions */ #if FF_USE_LFN >= 1 /* Code conversion (defined in unicode.c) */ WCHAR ff_oem2uni (WCHAR oem, WORD cp); /* OEM code to Unicode conversion */ diff --git a/lib/oofatfs/ffconf.h b/lib/oofatfs/ffconf.h index 248987dda3..52ff6d0a7a 100644 --- a/lib/oofatfs/ffconf.h +++ b/lib/oofatfs/ffconf.h @@ -373,6 +373,10 @@ / SemaphoreHandle_t and etc. A header file for O/S definitions needs to be / included somewhere in the scope of ff.h. */ - +#ifndef FF_FS_MAKE_VOLID +#define FF_FS_MAKE_VOLID (0) +#endif +/* The option FF_FS_MAKE_VOLID enables the use of a function to return a 32-bit volume identifier. +/ If it is disabled, a Volume ID based on the current time is used. */ /*--- End of configuration options ---*/ diff --git a/lib/protomatter b/lib/protomatter index cc93ff18c3..d0a07e14ad 160000 --- a/lib/protomatter +++ b/lib/protomatter @@ -1 +1 @@ -Subproject commit cc93ff18c3a20b25396cb2babaee8ed33bb79528 +Subproject commit d0a07e14adcd71a7c22bcceb16c55aadb5e0d104 diff --git a/locale/ID.po b/locale/ID.po index fe346373ef..8c0b3066f8 100644 --- a/locale/ID.po +++ b/locale/ID.po @@ -33,12 +33,21 @@ msgstr "" #: supervisor/shared/safe_mode.c msgid "" "\n" -"Please file an issue with the contents of your CIRCUITPY drive at \n" -"https://github.com/adafruit/circuitpython/issues\n" +"Please file an issue with your program at https://github.com/adafruit/" +"circuitpython/issues." msgstr "" + +#: supervisor/shared/safe_mode.c +msgid "" "\n" -"Harap ajukan masalah dengan konten drive CIRCUITPY Anda di\n" -"https://github.com/adafruit/circuitpython/issues\n" +"Press reset to exit safe mode.\n" +msgstr "" + +#: supervisor/shared/safe_mode.c +msgid "" +"\n" +"You are in safe mode because:\n" +msgstr "" #: py/obj.c msgid " File \"%q\"" @@ -70,6 +79,11 @@ msgstr "%%c harus int atau char" msgid "%02X" msgstr "" +#: shared-module/os/getenv.c +#, c-format +msgid "%S" +msgstr "" + #: shared-bindings/rgbmatrix/RGBMatrix.c #, c-format msgid "" @@ -86,7 +100,7 @@ msgstr "" #: 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 +#: ports/stm/common-hal/canio/Listener.c ports/stm/common-hal/rtc/RTC.c msgid "%q" msgstr "" @@ -106,13 +120,18 @@ msgstr "%q berisi pin duplikat" msgid "%q failure: %d" msgstr "%q gagal: %d" +#: py/argcheck.c +msgid "%q in %q must be of type %q, not %q" +msgstr "" + +#: ports/espressif/common-hal/espulp/ULP.c #: ports/raspberrypi/common-hal/rp2pio/StateMachine.c #: shared-bindings/digitalio/DigitalInOut.c #: shared-bindings/microcontroller/Pin.c msgid "%q in use" msgstr "%q sedang digunakan" -#: py/obj.c py/objstr.c py/objstrunicode.c +#: py/objstr.c py/objstrunicode.c msgid "%q index out of range" msgstr "%q indeks di luar batas" @@ -124,7 +143,11 @@ msgstr "" msgid "%q is %q" msgstr "" -#: py/argcheck.c +#: ports/raspberrypi/common-hal/wifi/Radio.c +msgid "%q is read-only for this board" +msgstr "" + +#: py/argcheck.c shared-bindings/usb_hid/Device.c msgid "%q length must be %d" msgstr "" @@ -140,10 +163,6 @@ msgstr "" 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 "" @@ -165,24 +184,20 @@ msgid "%q must be >= %d" msgstr "%q harus >= %d" #: shared-bindings/analogbufio/BufferedIn.c +msgid "%q must be a bytearray or array of type 'H' or 'B'" +msgstr "" + #: 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" - -#: py/argcheck.c -msgid "%q must be an int" +#: ports/raspberrypi/bindings/cyw43/__init__.c py/argcheck.c py/objexcept.c +#: shared-bindings/canio/CAN.c shared-bindings/digitalio/Pull.c +msgid "%q must be of type %q or %q, not %q" msgstr "" -#: py/argcheck.c -msgid "%q must be of type %q" -msgstr "%q harus bertipe %q" - -#: shared-bindings/digitalio/Pull.c -msgid "%q must be of type %q or None" +#: py/argcheck.c py/obj.c py/objstrunicode.c +msgid "%q must be of type %q, not %q" msgstr "" #: ports/atmel-samd/common-hal/busio/UART.c @@ -195,7 +210,6 @@ msgstr "" #: ports/atmel-samd/common-hal/pulseio/PulseIn.c #: ports/cxd56/common-hal/pulseio/PulseIn.c -#: ports/espressif/common-hal/coproc/Coproc.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 @@ -207,8 +221,8 @@ msgstr "%q di luar jangkauan" msgid "%q pin invalid" msgstr "pin %q tidak valid" -#: shared-bindings/usb_hid/Device.c -msgid "%q with a report ID of 0 must be of length 1" +#: py/objrange.c py/objslice.c shared-bindings/random/__init__.c +msgid "%q step cannot be zero" msgstr "" #: py/bc.c py/objnamedtuple.c @@ -308,7 +322,7 @@ msgstr "" msgid "'%s' object doesn't support item deletion" msgstr "" -#: ports/raspberrypi/common-hal/wifi/Radio.c py/runtime.c +#: py/runtime.c msgid "'%s' object has no attribute '%q'" msgstr "Objek '%s' tidak memiliki atribut '%q'" @@ -408,6 +422,10 @@ msgstr "ADC2 sedang digunakan oleh WiFi" msgid "Address must be %d bytes long" msgstr "Alamat harus sepanjang %d byte" +#: ports/espressif/common-hal/memorymap/AddressRange.c +msgid "Address range not allowed" +msgstr "" + #: ports/espressif/common-hal/canio/CAN.c msgid "All CAN peripherals are in use" msgstr "" @@ -435,7 +453,6 @@ msgid "All SPI peripherals are in use" msgstr "Semua perangkat SPI sedang digunakan" #: 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 "Semua perangkat UART sedang digunakan" @@ -488,7 +505,7 @@ msgstr "Sudah disebarkan." msgid "Already have all-matches listener" msgstr "" -#: ports/espressif/common-hal/coproc/__init__.c +#: ports/espressif/common-hal/espulp/ULP.c #: shared-module/memorymonitor/AllocationAlarm.c #: shared-module/memorymonitor/AllocationSize.c msgid "Already running" @@ -499,6 +516,11 @@ msgstr "" msgid "Already scanning for wifi networks" msgstr "" +#: shared-module/os/getenv.c +#, c-format +msgid "An error occurred while retrieving '%s':\n" +msgstr "" + #: ports/stm/common-hal/audiopwmio/PWMAudioOut.c msgid "Another PWMAudioOut is already active" msgstr "" @@ -512,24 +534,16 @@ msgstr "Send yang lain sudah aktif" msgid "Array must contain halfwords (type 'H')" msgstr "Array harus mengandung halfwords (ketik 'H')" -#: shared-bindings/alarm/SleepMemory.c shared-bindings/coproc/CoprocMemory.c +#: shared-bindings/alarm/SleepMemory.c shared-bindings/memorymap/AddressRange.c #: shared-bindings/nvm/ByteArray.c msgid "Array values should be single bytes." msgstr "Nilai array harus berupa byte tunggal." -#: shared-bindings/microcontroller/Pin.c -msgid "At most %d %q may be specified (not %d)" -msgstr "Paling banyak %d %q dapat ditentukan (bukan %d)" - #: shared-module/memorymonitor/AllocationAlarm.c #, c-format msgid "Attempt to allocate %d blocks" msgstr "" -#: supervisor/shared/safe_mode.c -msgid "Attempted heap allocation when VM not running." -msgstr "" - #: ports/raspberrypi/audio_dma.c msgid "Audio conversion not implemented" msgstr "" @@ -580,20 +594,13 @@ msgid "Bitmap size and bits per value must match" msgstr "" #: supervisor/shared/safe_mode.c -msgid "Boot device must be first device (interface #0)." +msgid "Boot device must be first (interface #0)." msgstr "" #: ports/mimxrt10xx/common-hal/busio/UART.c msgid "Both RX and TX required for flow control" msgstr "" -#: ports/atmel-samd/boards/circuitplayground_express/mpconfigboard.h -#: ports/atmel-samd/boards/circuitplayground_express_crickit/mpconfigboard.h -#: ports/atmel-samd/boards/circuitplayground_express_displayio/mpconfigboard.h -#: ports/atmel-samd/boards/meowmeow/mpconfigboard.h -msgid "Both buttons were pressed at start up.\n" -msgstr "" - #: ports/atmel-samd/common-hal/rotaryio/IncrementalEncoder.c msgid "Both pins must support hardware interrupts" msgstr "Kedua pin harus mendukung hardware interrut" @@ -659,11 +666,6 @@ msgstr "" msgid "Bus pin %d is already in use" msgstr "Pin bus %d sudah digunakan" -#: ports/espressif/boards/m5stack_core_basic/mpconfigboard.h -#: ports/espressif/boards/m5stack_core_fire/mpconfigboard.h -msgid "Button A was pressed at start up.\n" -msgstr "" - #: shared-bindings/_bleio/UUID.c msgid "Byte buffer must be 16 bytes." msgstr "Byte buffer harus 16 byte." @@ -798,10 +800,6 @@ msgstr "Menulis CharacteristicBuffer tidak tersedia" msgid "CircuitPython core code crashed hard. Whoops!\n" msgstr "Kode inti CircuitPython mengalami crash. Aduh!\n" -#: supervisor/shared/safe_mode.c -msgid "CircuitPython was unable to allocate the heap." -msgstr "" - #: shared-module/bitbangio/I2C.c msgid "Clock stretch too long" msgstr "Peregangan clock terlalu panjang" @@ -841,10 +839,6 @@ msgstr "Tidak dapat memulai interupsi, RX sibuk" msgid "Couldn't allocate decoder" msgstr "Tidak dapat mengalokasikan dekoder" -#: supervisor/shared/safe_mode.c -msgid "Crash into the HardFault_Handler." -msgstr "Gagal ke HardFault_Handler." - #: ports/stm/common-hal/analogio/AnalogOut.c msgid "DAC Channel Init Error" msgstr "Terjadi kesalahan saat menginisialisasi kanal DAC" @@ -907,6 +901,10 @@ msgstr "" msgid "Drive mode not used when direction is input." msgstr "Mode kendara tidak digunakan saat arah input." +#: py/obj.c +msgid "During handling of the above exception, another exception occurred:" +msgstr "" + #: shared-bindings/aesio/aes.c msgid "ECB only operates on 16 bytes at a time" msgstr "ECB hanya beroperasi pada 16 byte di satu waktu" @@ -932,24 +930,16 @@ msgstr "" msgid "Error in regex" msgstr "Error pada regex" +#: supervisor/shared/safe_mode.c +msgid "Error in safemode.py." +msgstr "" + #: shared-bindings/socketpool/Socket.c shared-bindings/ssl/SSLSocket.c msgid "Error: Failure to bind" msgstr "" -#: py/enum.c shared-bindings/_bleio/__init__.c shared-bindings/aesio/aes.c -#: shared-bindings/alarm/__init__.c shared-bindings/alarm/coproc/CoprocAlarm.c -#: shared-bindings/busio/SPI.c shared-bindings/coproc/Coproc.c -#: shared-bindings/coproc/__init__.c shared-bindings/microcontroller/Pin.c -#: shared-bindings/neopixel_write/__init__.c -msgid "Expected a %q" -msgstr "Diharapkan %q" - -#: ports/raspberrypi/bindings/cyw43/__init__.c -msgid "Expected a %q or %q" -msgstr "" - #: shared-bindings/alarm/__init__.c -msgid "Expected an %q" +msgid "Expected a kind of %q" msgstr "" #: ports/espressif/common-hal/_bleio/Adapter.c @@ -1017,13 +1007,17 @@ msgid "Failed to write internal flash." msgstr "Gagal menulis flash internal." #: supervisor/shared/safe_mode.c -msgid "Fatal error." +msgid "Fault detected by hardware." msgstr "" #: py/moduerrno.c msgid "File exists" msgstr "File sudah ada" +#: shared-module/os/getenv.c +msgid "File not found" +msgstr "" + #: ports/atmel-samd/common-hal/canio/Listener.c #: ports/espressif/common-hal/canio/Listener.c #: ports/stm/common-hal/canio/Listener.c @@ -1038,7 +1032,6 @@ msgstr "" msgid "Firmware is invalid" msgstr "" -#: ports/espressif/common-hal/coproc/Coproc.c #: ports/espressif/common-hal/dualbank/__init__.c msgid "Firmware is too big" msgstr "" @@ -1080,6 +1073,8 @@ msgstr "" #: shared-bindings/displayio/Display.c #: shared-bindings/displayio/EPaperDisplay.c #: shared-bindings/framebufferio/FramebufferDisplay.c +#: shared-module/displayio/Display.c +#: shared-module/framebufferio/FramebufferDisplay.c msgid "Group already used" msgstr "Grup sudah digunakan" @@ -1100,6 +1095,15 @@ msgstr "Perangkat keras sibuk, coba pin alternatif" msgid "Hardware in use, try alternative pins" msgstr "Perangkat keras sedang digunakan, coba pin alternatif" +#: supervisor/shared/safe_mode.c +msgid "Heap allocation when VM not running." +msgstr "" + +#: supervisor/shared/safe_mode.c +msgid "" +"Heap was corrupted because the stack was too small. Increase stack size." +msgstr "" + #: extmod/vfs_posix_file.c py/objstringio.c msgid "I/O operation on closed file" msgstr "operasi I/O pada file tertutup" @@ -1117,11 +1121,6 @@ msgstr "" msgid "I2SOut not available" msgstr "" -#: shared-bindings/aesio/aes.c -#, c-format -msgid "IV must be %d bytes long" -msgstr "Panjang IV harus %d byte" - #: ports/raspberrypi/bindings/rp2pio/StateMachine.c msgid "In-buffer elements must be <= 4 bytes long" msgstr "" @@ -1208,6 +1207,7 @@ msgid "Internal define error" msgstr "Kesalahan definisi internal" #: ports/espressif/common-hal/paralleldisplay/ParallelBus.c +#: shared-module/os/getenv.c msgid "Internal error" msgstr "" @@ -1220,6 +1220,10 @@ msgstr "Kesalahan internal #%d" msgid "Internal watchdog timer expired." msgstr "" +#: supervisor/shared/safe_mode.c +msgid "Interrupt error." +msgstr "" + #: py/argcheck.c shared-bindings/digitalio/DigitalInOut.c msgid "Invalid %q" msgstr "" @@ -1254,6 +1258,11 @@ msgstr "Argumen tidak valid" msgid "Invalid bits per value" msgstr "Bit per nilai tidak valid" +#: shared-module/os/getenv.c +#, c-format +msgid "Invalid byte %.*s" +msgstr "" + #: ports/atmel-samd/common-hal/imagecapture/ParallelImageCapture.c #, c-format msgid "Invalid data_pins[%d]" @@ -1263,18 +1272,10 @@ msgstr "" msgid "Invalid format chunk size" msgstr "Ukuran potongan format tidak valid" -#: supervisor/shared/safe_mode.c -msgid "Invalid memory access." -msgstr "Akses memori tidak valid." - #: ports/espressif/common-hal/wifi/Radio.c msgid "Invalid multicast MAC address" msgstr "" -#: shared-bindings/busio/UART.c -msgid "Invalid pins" -msgstr "Pin-pin tidak valid" - #: ports/espressif/common-hal/espidf/__init__.c ports/espressif/esp_error.c msgid "Invalid size" msgstr "" @@ -1288,10 +1289,18 @@ msgstr "" msgid "Invalid state" msgstr "" +#: shared-module/os/getenv.c +msgid "Invalid unicode escape" +msgstr "" + #: shared-bindings/aesio/aes.c msgid "Key must be 16, 24, or 32 bytes long" msgstr "Panjang kunci harus 16, 24, atau 32 byte" +#: shared-module/os/getenv.c +msgid "Key not found" +msgstr "" + #: shared-module/is31fl3741/FrameBuffer.c msgid "LED mappings must match display size" msgstr "" @@ -1398,6 +1407,10 @@ msgstr "" msgid "NVS Error" msgstr "" +#: shared-bindings/socketpool/SocketPool.c +msgid "Name or service not known" +msgstr "" + #: py/qstr.c msgid "Name too long" msgstr "Nama terlalu panjang" @@ -1512,11 +1525,6 @@ msgstr "Tidak ada kunci yang ditentukan" msgid "No long integer support" msgstr "Tidak ada dukungan bilangan bulat yang panjang" -#: shared-module/usb_hid/__init__.c -#, c-format -msgid "No more than %d HID devices allowed" -msgstr "" - #: shared-bindings/wifi/Radio.c msgid "No network with that ssid" msgstr "" @@ -1552,10 +1560,6 @@ msgstr "Tidak ada file/direktori" msgid "No timer available" msgstr "Penghitung waktu tidak tersedia" -#: supervisor/shared/safe_mode.c -msgid "Nordic system firmware failure assertion." -msgstr "" - #: ports/nrf/common-hal/_bleio/__init__.c msgid "Nordic system firmware out of memory" msgstr "" @@ -1575,10 +1579,6 @@ msgstr "Tidak terhubung" msgid "Not playing" msgstr "Tidak berfungsi" -#: shared-bindings/_bleio/__init__.c -msgid "Not settable" -msgstr "" - #: ports/espressif/common-hal/paralleldisplay/ParallelBus.c #, c-format msgid "Number of data_pins must be 8 or 16, not %d" @@ -1646,11 +1646,14 @@ msgstr "" "Hanya monokrom, 4bpp atau 8bpp yang diindeks, dan 16bpp atau lebih yang " "didukung: %d bpp diberikan" -#: ports/espressif/common-hal/alarm/coproc/CoprocAlarm.c #: ports/espressif/common-hal/alarm/touch/TouchAlarm.c msgid "Only one %q can be set in deep sleep." msgstr "" +#: ports/espressif/common-hal/espulp/ULPAlarm.c +msgid "Only one %q can be set." +msgstr "" + #: ports/espressif/common-hal/i2ctarget/I2CTarget.c #: ports/raspberrypi/common-hal/i2ctarget/I2CTarget.c msgid "Only one address is allowed" @@ -1683,6 +1686,10 @@ msgstr "" msgid "Operation timed out" msgstr "Waktu habis" +#: ports/raspberrypi/common-hal/mdns/Server.c +msgid "Out of MDNS service slots" +msgstr "" + #: ports/espressif/common-hal/espidf/__init__.c ports/espressif/esp_error.c msgid "Out of memory" msgstr "Kehabisan memori" @@ -1813,6 +1820,10 @@ msgstr "" msgid "Program size invalid" msgstr "" +#: ports/espressif/common-hal/espulp/ULP.c +msgid "Program too long" +msgstr "" + #: shared-bindings/digitalio/DigitalInOut.c msgid "Pull not used when direction is output." msgstr "Pull tidak digunakan saat arah output." @@ -1852,8 +1863,9 @@ msgstr "RTC tidak didukung di board ini" msgid "Random number generation error" msgstr "Kesalahan pembuatan nomor acak" +#: shared-bindings/_bleio/__init__.c #: shared-bindings/memorymonitor/AllocationSize.c -#: shared-bindings/pulseio/PulseIn.c +#: shared-bindings/pulseio/PulseIn.c shared-module/displayio/Bitmap.c msgid "Read-only" msgstr "Baca-saja" @@ -1861,10 +1873,6 @@ msgstr "Baca-saja" msgid "Read-only filesystem" msgstr "sistem file (filesystem) bersifat Read-only" -#: shared-module/displayio/Bitmap.c -msgid "Read-only object" -msgstr "Objek Read-only" - #: ports/espressif/common-hal/espidf/__init__.c ports/espressif/esp_error.c msgid "Received response was invalid" msgstr "" @@ -1959,7 +1967,7 @@ msgstr "" msgid "Sleep Memory not available" msgstr "" -#: shared-bindings/alarm/SleepMemory.c shared-bindings/coproc/CoprocMemory.c +#: shared-bindings/alarm/SleepMemory.c shared-bindings/memorymap/AddressRange.c #: shared-bindings/nvm/ByteArray.c msgid "Slice and value different lengths." msgstr "Potongan dan nilai panjangnya berbeda." @@ -1996,6 +2004,10 @@ msgstr "" msgid "Stereo right must be on PWM channel B" msgstr "" +#: ports/raspberrypi/common-hal/wifi/Radio.c +msgid "Stopping AP is not supported." +msgstr "" + #: 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" @@ -2013,35 +2025,11 @@ msgid "Temperature read timed out" msgstr "Waktu baca suhu habis" #: supervisor/shared/safe_mode.c -msgid "The BOOT button was pressed at start up.\n" +msgid "The `microcontroller` module was used to boot into safe mode." msgstr "" -#: supervisor/shared/safe_mode.c -msgid "" -"The CircuitPython heap was corrupted because the stack was too small.\n" -"Increase the stack size if you know how. If not:" -msgstr "" - -#: ports/espressif/boards/adafruit_feather_esp32_v2/mpconfigboard.h -msgid "The SW38 button was pressed at start up.\n" -msgstr "" - -#: ports/espressif/boards/hardkernel_odroid_go/mpconfigboard.h -msgid "The VOLUME button was pressed at start up.\n" -msgstr "" - -#: supervisor/shared/safe_mode.c -msgid "" -"The `microcontroller` module was used to boot into safe mode. Press reset to " -"exit safe mode." -msgstr "" - -#: ports/espressif/boards/m5stack_atom_lite/mpconfigboard.h -msgid "The central button was pressed at start up.\n" -msgstr "" - -#: ports/nrf/boards/aramcon2_badge/mpconfigboard.h -msgid "The left button was pressed at start up.\n" +#: py/obj.c +msgid "The above exception was the direct cause of the following exception:" msgstr "" #: shared-bindings/rgbmatrix/RGBMatrix.c @@ -2049,10 +2037,7 @@ msgid "The length of rgb_pins must be 6, 12, 18, 24, or 30" msgstr "" #: supervisor/shared/safe_mode.c -msgid "" -"The microcontroller's power dipped. Make sure your power supply provides\n" -"enough power for the whole circuit and press reset (after ejecting " -"CIRCUITPY)." +msgid "The power dipped. Make sure you are providing enough power." msgstr "" #: shared-module/audiomixer/MixerVoice.c @@ -2071,6 +2056,10 @@ msgstr "Tingkat sampel dari sampel tidak cocok dengan mixer" msgid "The sample's signedness does not match the mixer's" msgstr "signedness dari sampel tidak cocok dengan mixer" +#: supervisor/shared/safe_mode.c +msgid "Third-party firmware fatal error." +msgstr "" + #: shared-module/imagecapture/ParallelImageCapture.c msgid "This microcontroller does not support continuous capture." msgstr "" @@ -2103,10 +2092,6 @@ msgstr "" msgid "Timeout is too long: Maximum timeout length is %d seconds" msgstr "" -#: supervisor/shared/safe_mode.c -msgid "To exit, please reset the board without requesting safe mode." -msgstr "" - #: ports/atmel-samd/common-hal/audiobusio/I2SOut.c msgid "Too many channels in sample" msgstr "" @@ -2151,6 +2136,10 @@ msgstr "" msgid "UART init" msgstr "" +#: ports/raspberrypi/common-hal/busio/UART.c +msgid "UART peripheral in use" +msgstr "" + #: ports/stm/common-hal/busio/UART.c msgid "UART re-init" msgstr "" @@ -2198,6 +2187,10 @@ msgstr "Nilai UUID bukan str, int atau byte buffer" msgid "Unable to allocate buffers for signed conversion" msgstr "Tidak dapat mengalokasikan buffer untuk signed conversion" +#: supervisor/shared/safe_mode.c +msgid "Unable to allocate the heap." +msgstr "" + #: ports/espressif/common-hal/busio/I2C.c msgid "Unable to create lock" msgstr "" @@ -2221,11 +2214,12 @@ msgid "Unable to read color palette data" msgstr "Tidak dapat membaca data palet warna" #: ports/espressif/common-hal/mdns/Server.c +#: ports/raspberrypi/common-hal/mdns/Server.c msgid "Unable to start mDNS query" msgstr "" -#: shared-bindings/coproc/CoprocMemory.c -msgid "Unable to write" +#: shared-bindings/memorymap/AddressRange.c +msgid "Unable to write to address." msgstr "" #: shared-bindings/nvm/ByteArray.c @@ -2296,6 +2290,7 @@ msgid "Unkown error code %d" msgstr "" #: shared-bindings/adafruit_pixelbuf/PixelBuf.c +#: shared-module/_pixelmap/PixelMap.c #, c-format msgid "Unmatched number of items on RHS (expected %d, got %d)." msgstr "Jumlah item pada RHS tidak cocok (diharapkan %d, didapatkan %d)." @@ -2382,6 +2377,18 @@ msgstr "" msgid "Wi-Fi: " msgstr "" +#: ports/raspberrypi/common-hal/wifi/Radio.c +msgid "Wifi is in access point mode." +msgstr "" + +#: ports/raspberrypi/common-hal/wifi/Radio.c +msgid "Wifi is in station mode." +msgstr "" + +#: ports/raspberrypi/common-hal/wifi/Radio.c +msgid "Wifi is not enabled" +msgstr "" + #: main.c msgid "Woken up by alarm.\n" msgstr "" @@ -2391,13 +2398,48 @@ msgstr "" msgid "Writes not supported on Characteristic" msgstr "Menulis tidak didukung pada Karakteristik" -#: supervisor/shared/safe_mode.c -msgid "You are in safe mode because:\n" +#: ports/atmel-samd/boards/circuitplayground_express/mpconfigboard.h +#: ports/atmel-samd/boards/circuitplayground_express_crickit/mpconfigboard.h +#: ports/atmel-samd/boards/circuitplayground_express_displayio/mpconfigboard.h +#: ports/atmel-samd/boards/meowmeow/mpconfigboard.h +msgid "You pressed both buttons at start up." +msgstr "" + +#: ports/espressif/boards/m5stack_core_basic/mpconfigboard.h +#: ports/espressif/boards/m5stack_core_fire/mpconfigboard.h +#: ports/espressif/boards/m5stack_stick_c/mpconfigboard.h +msgid "You pressed button A at start up." msgstr "" #: supervisor/shared/safe_mode.c -msgid "" -"You pressed the reset button during boot. Press again to exit safe mode." +msgid "You pressed the BOOT button at start up" +msgstr "" + +#: ports/espressif/boards/adafruit_feather_esp32_v2/mpconfigboard.h +msgid "You pressed the SW38 button at start up." +msgstr "" + +#: ports/espressif/boards/hardkernel_odroid_go/mpconfigboard.h +msgid "You pressed the VOLUME button at start up." +msgstr "" + +#: ports/espressif/boards/m5stack_atom_echo/mpconfigboard.h +#: ports/espressif/boards/m5stack_atom_lite/mpconfigboard.h +#: ports/espressif/boards/m5stack_atom_matrix/mpconfigboard.h +#: ports/espressif/boards/m5stack_atom_u/mpconfigboard.h +msgid "You pressed the central button at start up." +msgstr "" + +#: ports/nrf/boards/aramcon2_badge/mpconfigboard.h +msgid "You pressed the left button at start up." +msgstr "" + +#: supervisor/shared/safe_mode.c +msgid "You pressed the reset button during boot." +msgstr "" + +#: supervisor/shared/micropython.c +msgid "[truncated due to length]" msgstr "" #: py/objtype.c @@ -2469,8 +2511,12 @@ msgstr "" msgid "array has too many dimensions" msgstr "" +#: extmod/ulab/code/ndarray.c +msgid "array is too big" +msgstr "" + #: py/objarray.c shared-bindings/alarm/SleepMemory.c -#: shared-bindings/coproc/CoprocMemory.c shared-bindings/nvm/ByteArray.c +#: shared-bindings/memorymap/AddressRange.c shared-bindings/nvm/ByteArray.c msgid "array/bytes required on right side" msgstr "diperlukan array/byte di sisi kanan" @@ -2563,10 +2609,6 @@ msgstr "" msgid "buffer too small for requested bytes" msgstr "" -#: shared-bindings/adafruit_pixelbuf/PixelBuf.c -msgid "byteorder is not a string" -msgstr "" - #: py/objarray.c msgid "bytes length not a multiple of item size" msgstr "" @@ -2608,14 +2650,10 @@ msgstr "tidak dapat menetapkan ke ekspresi" msgid "can't cancel self" msgstr "" -#: py/obj.c py/objint.c shared-module/adafruit_pixelbuf/PixelBuf.c +#: py/obj.c py/objint.c py/runtime.c shared-module/adafruit_pixelbuf/PixelBuf.c msgid "can't convert %q to %q" msgstr "" -#: py/runtime.c -msgid "can't convert %q to int" -msgstr "" - #: py/obj.c #, c-format msgid "can't convert %s to complex" @@ -2697,6 +2735,10 @@ msgstr "" msgid "can't set attribute" msgstr "" +#: py/runtime.c +msgid "can't set attribute '%q'" +msgstr "" + #: py/emitnative.c msgid "can't store '%q'" msgstr "" @@ -2799,10 +2841,6 @@ msgstr "" msgid "comparison of int and uint" msgstr "" -#: py/objcomplex.c -msgid "complex division by zero" -msgstr "" - #: py/objfloat.c py/parsenum.c msgid "complex values not supported" msgstr "" @@ -2905,12 +2943,11 @@ msgstr "" msgid "div/mod not implemented for uint" msgstr "" -#: py/objfloat.c py/objint_mpz.c +#: extmod/ulab/code/numpy/create.c msgid "divide by zero" msgstr "" -#: py/modmath.c py/objint_longlong.c py/runtime.c -#: shared-bindings/math/__init__.c +#: py/runtime.c msgid "division by zero" msgstr "" @@ -2951,9 +2988,9 @@ msgstr "" msgid "error = 0x%08lX" msgstr "error = 0x%08lX" -#: ports/espressif/common-hal/esp32_camera/Camera.c +#: ports/espressif/common-hal/espcamera/Camera.c msgid "" -"esp32_camera.Camera requires reserved PSRAM to be configured. See the " +"espcamera.Camera requires reserved PSRAM to be configured. See the " "documentation for instructions." msgstr "" @@ -2961,14 +2998,6 @@ msgstr "" msgid "exceptions must derive from BaseException" msgstr "" -#: shared-bindings/canio/CAN.c -msgid "expected '%q' but got '%q'" -msgstr "" - -#: shared-bindings/canio/CAN.c -msgid "expected '%q' or '%q' but got '%q'" -msgstr "" - #: py/objstr.c msgid "expected ':' after format specifier" msgstr "" @@ -3067,10 +3096,6 @@ msgstr "" msgid "format requires a dict" msgstr "" -#: shared-bindings/microcontroller/Processor.c -msgid "frequency is read-only for this board" -msgstr "" - #: py/objdeque.c msgid "full" msgstr "" @@ -3183,8 +3208,12 @@ msgstr "lapisan (padding) tidak benar" msgid "index is out of bounds" msgstr "" +#: shared-bindings/_pixelmap/PixelMap.c +msgid "index must be tuple or int" +msgstr "" + #: extmod/ulab/code/numpy/numerical.c extmod/ulab/code/ulab_tools.c -#: ports/espressif/common-hal/pulseio/PulseIn.c py/obj.c +#: ports/espressif/common-hal/pulseio/PulseIn.c #: shared-bindings/bitmaptools/__init__.c msgid "index out of range" msgstr "index keluar dari jangkauan" @@ -3282,10 +3311,6 @@ msgstr "" msgid "inputs are not iterable" msgstr "" -#: py/parsenum.c -msgid "int() arg 2 must be >= 2 and <= 36" -msgstr "" - #: extmod/ulab/code/numpy/approx.c msgid "interp is defined for 1D iterables of equal length" msgstr "" @@ -3342,7 +3367,7 @@ msgstr "key tidak valid" msgid "invalid micropython decorator" msgstr "micropython decorator tidak valid" -#: ports/espressif/common-hal/esp32_camera/Camera.c +#: ports/espressif/common-hal/espcamera/Camera.c msgid "invalid setting" msgstr "" @@ -3367,10 +3392,6 @@ msgstr "" msgid "invalid syntax for number" msgstr "" -#: py/objexcept.c -msgid "invalid traceback" -msgstr "" - #: py/objtype.c msgid "issubclass() arg 1 must be a class" msgstr "" @@ -3427,19 +3448,17 @@ msgstr "" msgid "local variable referenced before assignment" msgstr "" -#: py/objint.c -msgid "long int not supported in this build" -msgstr "" - #: ports/espressif/common-hal/canio/CAN.c msgid "loopback + silent mode not supported by peripheral" msgstr "" #: ports/espressif/common-hal/mdns/Server.c +#: ports/raspberrypi/common-hal/mdns/Server.c msgid "mDNS already initialized" msgstr "" #: ports/espressif/common-hal/mdns/Server.c +#: ports/raspberrypi/common-hal/mdns/Server.c msgid "mDNS only works with built-in WiFi" msgstr "" @@ -3568,6 +3587,10 @@ msgstr "" msgid "negative shift count" msgstr "" +#: shared-bindings/_pixelmap/PixelMap.c +msgid "nested index must be int" +msgstr "" + #: shared-module/sdcardio/SDCard.c msgid "no SD card" msgstr "" @@ -3601,7 +3624,7 @@ msgstr "" msgid "no response from SD card" msgstr "" -#: ports/espressif/common-hal/esp32_camera/Camera.c py/objobject.c py/runtime.c +#: ports/espressif/common-hal/espcamera/Camera.c py/objobject.c py/runtime.c msgid "no such attribute" msgstr "" @@ -3738,6 +3761,10 @@ msgstr "" msgid "only mono is supported" msgstr "" +#: extmod/ulab/code/numpy/create.c +msgid "only ndarrays can be concatenated" +msgstr "" + #: ports/stm/common-hal/audiobusio/PDMIn.c msgid "only oversample=64 is supported" msgstr "" @@ -3748,7 +3775,7 @@ msgid "only sample_rate=16000 is supported" msgstr "" #: py/objarray.c py/objstr.c py/objstrunicode.c py/objtuple.c -#: shared-bindings/alarm/SleepMemory.c shared-bindings/coproc/CoprocMemory.c +#: shared-bindings/alarm/SleepMemory.c shared-bindings/memorymap/AddressRange.c #: shared-bindings/nvm/ByteArray.c msgid "only slices with step=1 (aka None) are supported" msgstr "" @@ -3964,10 +3991,6 @@ msgstr "" msgid "slice step can't be zero" msgstr "" -#: py/objslice.c -msgid "slice step cannot be zero" -msgstr "" - #: py/nativeglue.c msgid "slice unsupported" msgstr "" @@ -4016,10 +4039,6 @@ msgstr "" msgid "start/end indices" msgstr "" -#: shared-bindings/random/__init__.c -msgid "step must be non-zero" -msgstr "" - #: shared-bindings/random/__init__.c msgid "stop not reachable from start" msgstr "" @@ -4028,10 +4047,6 @@ msgstr "" msgid "stream operation not supported" msgstr "" -#: py/objstrunicode.c -msgid "string indices must be integers, not %q" -msgstr "" - #: py/stream.c msgid "string not supported; use bytes or bytearray" msgstr "" @@ -4064,10 +4079,6 @@ msgstr "sintaksis error pada JSON" msgid "syntax error in uctypes descriptor" msgstr "sintaksis error pada pendeskripsi uctypes" -#: shared-bindings/time/__init__.c -msgid "time.struct_time() takes a 9-sequence" -msgstr "" - #: ports/atmel-samd/common-hal/watchdog/WatchDogTimer.c #: ports/espressif/common-hal/watchdog/WatchDogTimer.c #: ports/nrf/common-hal/watchdog/WatchDogTimer.c @@ -4349,10 +4360,6 @@ msgstr "xTaskCreate gagal" msgid "y value out of bounds" msgstr "Nilai y di luar batas" -#: py/objrange.c -msgid "zero step" -msgstr "nol langkah" - #: extmod/ulab/code/scipy/signal/signal.c msgid "zi must be an ndarray" msgstr "zi harus ndarray" @@ -4365,6 +4372,49 @@ msgstr "zi harus berjenis float" msgid "zi must be of shape (n_section, 2)" msgstr "Zi harus berbentuk (n_section, 2)" +#~ msgid "" +#~ "\n" +#~ "Please file an issue with the contents of your CIRCUITPY drive at \n" +#~ "https://github.com/adafruit/circuitpython/issues\n" +#~ msgstr "" +#~ "\n" +#~ "Harap ajukan masalah dengan konten drive CIRCUITPY Anda di\n" +#~ "https://github.com/adafruit/circuitpython/issues\n" + +#~ msgid "Crash into the HardFault_Handler." +#~ msgstr "Gagal ke HardFault_Handler." + +#~ msgid "Invalid memory access." +#~ msgstr "Akses memori tidak valid." + +#~ msgid "%q must be of type %q" +#~ msgstr "%q harus bertipe %q" + +#~ msgid "Expected a %q" +#~ msgstr "Diharapkan %q" + +#, c-format +#~ msgid "IV must be %d bytes long" +#~ msgstr "Panjang IV harus %d byte" + +#~ msgid "Read-only object" +#~ msgstr "Objek Read-only" + +#~ msgid "%q length must be >= 1" +#~ msgstr "%q panjang harus >= 1" + +#~ msgid "%q must be a string" +#~ msgstr "%q harus berupa string" + +#~ msgid "At most %d %q may be specified (not %d)" +#~ msgstr "Paling banyak %d %q dapat ditentukan (bukan %d)" + +#~ msgid "Invalid pins" +#~ msgstr "Pin-pin tidak valid" + +#~ msgid "zero step" +#~ msgstr "nol langkah" + #~ msgid "%q indices must be integers, not %s" #~ msgstr "indeks %q harus bilangan bulat, bukan %s" diff --git a/locale/circuitpython.pot b/locale/circuitpython.pot old mode 100755 new mode 100644 index 044900bd30..082ea7bfa9 --- a/locale/circuitpython.pot +++ b/locale/circuitpython.pot @@ -31,8 +31,20 @@ msgstr "" #: supervisor/shared/safe_mode.c msgid "" "\n" -"Please file an issue with the contents of your CIRCUITPY drive at \n" -"https://github.com/adafruit/circuitpython/issues\n" +"Please file an issue with your program at https://github.com/adafruit/" +"circuitpython/issues." +msgstr "" + +#: supervisor/shared/safe_mode.c +msgid "" +"\n" +"Press reset to exit safe mode.\n" +msgstr "" + +#: supervisor/shared/safe_mode.c +msgid "" +"\n" +"You are in safe mode because:\n" msgstr "" #: py/obj.c @@ -65,6 +77,11 @@ msgstr "" msgid "%02X" msgstr "" +#: shared-module/os/getenv.c +#, c-format +msgid "%S" +msgstr "" + #: shared-bindings/rgbmatrix/RGBMatrix.c #, c-format msgid "" @@ -80,7 +97,7 @@ msgstr "" #: 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 +#: ports/stm/common-hal/canio/Listener.c ports/stm/common-hal/rtc/RTC.c msgid "%q" msgstr "" @@ -100,13 +117,18 @@ msgstr "" msgid "%q failure: %d" msgstr "" +#: py/argcheck.c +msgid "%q in %q must be of type %q, not %q" +msgstr "" + +#: ports/espressif/common-hal/espulp/ULP.c #: ports/raspberrypi/common-hal/rp2pio/StateMachine.c #: shared-bindings/digitalio/DigitalInOut.c #: shared-bindings/microcontroller/Pin.c msgid "%q in use" msgstr "" -#: py/obj.c py/objstr.c py/objstrunicode.c +#: py/objstr.c py/objstrunicode.c msgid "%q index out of range" msgstr "" @@ -118,7 +140,11 @@ msgstr "" msgid "%q is %q" msgstr "" -#: py/argcheck.c +#: ports/raspberrypi/common-hal/wifi/Radio.c +msgid "%q is read-only for this board" +msgstr "" + +#: py/argcheck.c shared-bindings/usb_hid/Device.c msgid "%q length must be %d" msgstr "" @@ -134,10 +160,6 @@ msgstr "" 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 "" @@ -159,24 +181,20 @@ msgid "%q must be >= %d" msgstr "" #: shared-bindings/analogbufio/BufferedIn.c +msgid "%q must be a bytearray or array of type 'H' or 'B'" +msgstr "" + #: 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" +#: ports/raspberrypi/bindings/cyw43/__init__.c py/argcheck.c py/objexcept.c +#: shared-bindings/canio/CAN.c shared-bindings/digitalio/Pull.c +msgid "%q must be of type %q or %q, not %q" msgstr "" -#: py/argcheck.c -msgid "%q must be an int" -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" +#: py/argcheck.c py/obj.c py/objstrunicode.c +msgid "%q must be of type %q, not %q" msgstr "" #: ports/atmel-samd/common-hal/busio/UART.c @@ -189,7 +207,6 @@ msgstr "" #: ports/atmel-samd/common-hal/pulseio/PulseIn.c #: ports/cxd56/common-hal/pulseio/PulseIn.c -#: ports/espressif/common-hal/coproc/Coproc.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 @@ -201,8 +218,8 @@ msgstr "" msgid "%q pin invalid" msgstr "" -#: shared-bindings/usb_hid/Device.c -msgid "%q with a report ID of 0 must be of length 1" +#: py/objrange.c py/objslice.c shared-bindings/random/__init__.c +msgid "%q step cannot be zero" msgstr "" #: py/bc.c py/objnamedtuple.c @@ -302,7 +319,7 @@ msgstr "" msgid "'%s' object doesn't support item deletion" msgstr "" -#: ports/raspberrypi/common-hal/wifi/Radio.c py/runtime.c +#: py/runtime.c msgid "'%s' object has no attribute '%q'" msgstr "" @@ -402,6 +419,10 @@ msgstr "" msgid "Address must be %d bytes long" msgstr "" +#: ports/espressif/common-hal/memorymap/AddressRange.c +msgid "Address range not allowed" +msgstr "" + #: ports/espressif/common-hal/canio/CAN.c msgid "All CAN peripherals are in use" msgstr "" @@ -429,7 +450,6 @@ msgid "All SPI peripherals are in use" msgstr "" #: 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 "" @@ -482,7 +502,7 @@ msgstr "" msgid "Already have all-matches listener" msgstr "" -#: ports/espressif/common-hal/coproc/__init__.c +#: ports/espressif/common-hal/espulp/ULP.c #: shared-module/memorymonitor/AllocationAlarm.c #: shared-module/memorymonitor/AllocationSize.c msgid "Already running" @@ -493,6 +513,11 @@ msgstr "" msgid "Already scanning for wifi networks" msgstr "" +#: shared-module/os/getenv.c +#, c-format +msgid "An error occurred while retrieving '%s':\n" +msgstr "" + #: ports/stm/common-hal/audiopwmio/PWMAudioOut.c msgid "Another PWMAudioOut is already active" msgstr "" @@ -506,24 +531,16 @@ msgstr "" msgid "Array must contain halfwords (type 'H')" msgstr "" -#: shared-bindings/alarm/SleepMemory.c shared-bindings/coproc/CoprocMemory.c +#: shared-bindings/alarm/SleepMemory.c shared-bindings/memorymap/AddressRange.c #: shared-bindings/nvm/ByteArray.c msgid "Array values should be single bytes." msgstr "" -#: shared-bindings/microcontroller/Pin.c -msgid "At most %d %q may be specified (not %d)" -msgstr "" - #: shared-module/memorymonitor/AllocationAlarm.c #, c-format msgid "Attempt to allocate %d blocks" msgstr "" -#: supervisor/shared/safe_mode.c -msgid "Attempted heap allocation when VM not running." -msgstr "" - #: ports/raspberrypi/audio_dma.c msgid "Audio conversion not implemented" msgstr "" @@ -572,20 +589,13 @@ msgid "Bitmap size and bits per value must match" msgstr "" #: supervisor/shared/safe_mode.c -msgid "Boot device must be first device (interface #0)." +msgid "Boot device must be first (interface #0)." msgstr "" #: ports/mimxrt10xx/common-hal/busio/UART.c msgid "Both RX and TX required for flow control" msgstr "" -#: ports/atmel-samd/boards/circuitplayground_express/mpconfigboard.h -#: ports/atmel-samd/boards/circuitplayground_express_crickit/mpconfigboard.h -#: ports/atmel-samd/boards/circuitplayground_express_displayio/mpconfigboard.h -#: ports/atmel-samd/boards/meowmeow/mpconfigboard.h -msgid "Both buttons were pressed at start up.\n" -msgstr "" - #: ports/atmel-samd/common-hal/rotaryio/IncrementalEncoder.c msgid "Both pins must support hardware interrupts" msgstr "" @@ -651,11 +661,6 @@ msgstr "" msgid "Bus pin %d is already in use" msgstr "" -#: ports/espressif/boards/m5stack_core_basic/mpconfigboard.h -#: ports/espressif/boards/m5stack_core_fire/mpconfigboard.h -msgid "Button A was pressed at start up.\n" -msgstr "" - #: shared-bindings/_bleio/UUID.c msgid "Byte buffer must be 16 bytes." msgstr "" @@ -786,10 +791,6 @@ msgstr "" msgid "CircuitPython core code crashed hard. Whoops!\n" msgstr "" -#: supervisor/shared/safe_mode.c -msgid "CircuitPython was unable to allocate the heap." -msgstr "" - #: shared-module/bitbangio/I2C.c msgid "Clock stretch too long" msgstr "" @@ -828,10 +829,6 @@ msgstr "" msgid "Couldn't allocate decoder" msgstr "" -#: supervisor/shared/safe_mode.c -msgid "Crash into the HardFault_Handler." -msgstr "" - #: ports/stm/common-hal/analogio/AnalogOut.c msgid "DAC Channel Init Error" msgstr "" @@ -894,6 +891,10 @@ msgstr "" msgid "Drive mode not used when direction is input." msgstr "" +#: py/obj.c +msgid "During handling of the above exception, another exception occurred:" +msgstr "" + #: shared-bindings/aesio/aes.c msgid "ECB only operates on 16 bytes at a time" msgstr "" @@ -919,24 +920,16 @@ msgstr "" msgid "Error in regex" msgstr "" +#: supervisor/shared/safe_mode.c +msgid "Error in safemode.py." +msgstr "" + #: shared-bindings/socketpool/Socket.c shared-bindings/ssl/SSLSocket.c msgid "Error: Failure to bind" msgstr "" -#: py/enum.c shared-bindings/_bleio/__init__.c shared-bindings/aesio/aes.c -#: shared-bindings/alarm/__init__.c shared-bindings/alarm/coproc/CoprocAlarm.c -#: shared-bindings/busio/SPI.c shared-bindings/coproc/Coproc.c -#: shared-bindings/coproc/__init__.c shared-bindings/microcontroller/Pin.c -#: shared-bindings/neopixel_write/__init__.c -msgid "Expected a %q" -msgstr "" - -#: ports/raspberrypi/bindings/cyw43/__init__.c -msgid "Expected a %q or %q" -msgstr "" - #: shared-bindings/alarm/__init__.c -msgid "Expected an %q" +msgid "Expected a kind of %q" msgstr "" #: ports/espressif/common-hal/_bleio/Adapter.c @@ -1004,13 +997,17 @@ msgid "Failed to write internal flash." msgstr "" #: supervisor/shared/safe_mode.c -msgid "Fatal error." +msgid "Fault detected by hardware." msgstr "" #: py/moduerrno.c msgid "File exists" msgstr "" +#: shared-module/os/getenv.c +msgid "File not found" +msgstr "" + #: ports/atmel-samd/common-hal/canio/Listener.c #: ports/espressif/common-hal/canio/Listener.c #: ports/stm/common-hal/canio/Listener.c @@ -1025,7 +1022,6 @@ msgstr "" msgid "Firmware is invalid" msgstr "" -#: ports/espressif/common-hal/coproc/Coproc.c #: ports/espressif/common-hal/dualbank/__init__.c msgid "Firmware is too big" msgstr "" @@ -1067,6 +1063,8 @@ msgstr "" #: shared-bindings/displayio/Display.c #: shared-bindings/displayio/EPaperDisplay.c #: shared-bindings/framebufferio/FramebufferDisplay.c +#: shared-module/displayio/Display.c +#: shared-module/framebufferio/FramebufferDisplay.c msgid "Group already used" msgstr "" @@ -1087,6 +1085,15 @@ msgstr "" msgid "Hardware in use, try alternative pins" msgstr "" +#: supervisor/shared/safe_mode.c +msgid "Heap allocation when VM not running." +msgstr "" + +#: supervisor/shared/safe_mode.c +msgid "" +"Heap was corrupted because the stack was too small. Increase stack size." +msgstr "" + #: extmod/vfs_posix_file.c py/objstringio.c msgid "I/O operation on closed file" msgstr "" @@ -1104,11 +1111,6 @@ msgstr "" msgid "I2SOut not available" msgstr "" -#: shared-bindings/aesio/aes.c -#, c-format -msgid "IV must be %d bytes long" -msgstr "" - #: ports/raspberrypi/bindings/rp2pio/StateMachine.c msgid "In-buffer elements must be <= 4 bytes long" msgstr "" @@ -1193,6 +1195,7 @@ msgid "Internal define error" msgstr "" #: ports/espressif/common-hal/paralleldisplay/ParallelBus.c +#: shared-module/os/getenv.c msgid "Internal error" msgstr "" @@ -1205,6 +1208,10 @@ msgstr "" msgid "Internal watchdog timer expired." msgstr "" +#: supervisor/shared/safe_mode.c +msgid "Interrupt error." +msgstr "" + #: py/argcheck.c shared-bindings/digitalio/DigitalInOut.c msgid "Invalid %q" msgstr "" @@ -1239,6 +1246,11 @@ msgstr "" msgid "Invalid bits per value" msgstr "" +#: shared-module/os/getenv.c +#, c-format +msgid "Invalid byte %.*s" +msgstr "" + #: ports/atmel-samd/common-hal/imagecapture/ParallelImageCapture.c #, c-format msgid "Invalid data_pins[%d]" @@ -1248,18 +1260,10 @@ msgstr "" msgid "Invalid format chunk size" msgstr "" -#: supervisor/shared/safe_mode.c -msgid "Invalid memory access." -msgstr "" - #: ports/espressif/common-hal/wifi/Radio.c msgid "Invalid multicast MAC address" msgstr "" -#: shared-bindings/busio/UART.c -msgid "Invalid pins" -msgstr "" - #: ports/espressif/common-hal/espidf/__init__.c ports/espressif/esp_error.c msgid "Invalid size" msgstr "" @@ -1273,10 +1277,18 @@ msgstr "" msgid "Invalid state" msgstr "" +#: shared-module/os/getenv.c +msgid "Invalid unicode escape" +msgstr "" + #: shared-bindings/aesio/aes.c msgid "Key must be 16, 24, or 32 bytes long" msgstr "" +#: shared-module/os/getenv.c +msgid "Key not found" +msgstr "" + #: shared-module/is31fl3741/FrameBuffer.c msgid "LED mappings must match display size" msgstr "" @@ -1383,6 +1395,10 @@ msgstr "" msgid "NVS Error" msgstr "" +#: shared-bindings/socketpool/SocketPool.c +msgid "Name or service not known" +msgstr "" + #: py/qstr.c msgid "Name too long" msgstr "" @@ -1497,11 +1513,6 @@ msgstr "" msgid "No long integer support" msgstr "" -#: shared-module/usb_hid/__init__.c -#, c-format -msgid "No more than %d HID devices allowed" -msgstr "" - #: shared-bindings/wifi/Radio.c msgid "No network with that ssid" msgstr "" @@ -1537,10 +1548,6 @@ msgstr "" msgid "No timer available" msgstr "" -#: supervisor/shared/safe_mode.c -msgid "Nordic system firmware failure assertion." -msgstr "" - #: ports/nrf/common-hal/_bleio/__init__.c msgid "Nordic system firmware out of memory" msgstr "" @@ -1560,10 +1567,6 @@ msgstr "" msgid "Not playing" msgstr "" -#: shared-bindings/_bleio/__init__.c -msgid "Not settable" -msgstr "" - #: ports/espressif/common-hal/paralleldisplay/ParallelBus.c #, c-format msgid "Number of data_pins must be 8 or 16, not %d" @@ -1626,11 +1629,14 @@ msgid "" "%d bpp given" msgstr "" -#: ports/espressif/common-hal/alarm/coproc/CoprocAlarm.c #: ports/espressif/common-hal/alarm/touch/TouchAlarm.c msgid "Only one %q can be set in deep sleep." msgstr "" +#: ports/espressif/common-hal/espulp/ULPAlarm.c +msgid "Only one %q can be set." +msgstr "" + #: ports/espressif/common-hal/i2ctarget/I2CTarget.c #: ports/raspberrypi/common-hal/i2ctarget/I2CTarget.c msgid "Only one address is allowed" @@ -1663,6 +1669,10 @@ msgstr "" msgid "Operation timed out" msgstr "" +#: ports/raspberrypi/common-hal/mdns/Server.c +msgid "Out of MDNS service slots" +msgstr "" + #: ports/espressif/common-hal/espidf/__init__.c ports/espressif/esp_error.c msgid "Out of memory" msgstr "" @@ -1786,6 +1796,10 @@ msgstr "" msgid "Program size invalid" msgstr "" +#: ports/espressif/common-hal/espulp/ULP.c +msgid "Program too long" +msgstr "" + #: shared-bindings/digitalio/DigitalInOut.c msgid "Pull not used when direction is output." msgstr "" @@ -1825,8 +1839,9 @@ msgstr "" msgid "Random number generation error" msgstr "" +#: shared-bindings/_bleio/__init__.c #: shared-bindings/memorymonitor/AllocationSize.c -#: shared-bindings/pulseio/PulseIn.c +#: shared-bindings/pulseio/PulseIn.c shared-module/displayio/Bitmap.c msgid "Read-only" msgstr "" @@ -1834,10 +1849,6 @@ msgstr "" msgid "Read-only filesystem" msgstr "" -#: shared-module/displayio/Bitmap.c -msgid "Read-only object" -msgstr "" - #: ports/espressif/common-hal/espidf/__init__.c ports/espressif/esp_error.c msgid "Received response was invalid" msgstr "" @@ -1930,7 +1941,7 @@ msgstr "" msgid "Sleep Memory not available" msgstr "" -#: shared-bindings/alarm/SleepMemory.c shared-bindings/coproc/CoprocMemory.c +#: shared-bindings/alarm/SleepMemory.c shared-bindings/memorymap/AddressRange.c #: shared-bindings/nvm/ByteArray.c msgid "Slice and value different lengths." msgstr "" @@ -1967,6 +1978,10 @@ msgstr "" msgid "Stereo right must be on PWM channel B" msgstr "" +#: ports/raspberrypi/common-hal/wifi/Radio.c +msgid "Stopping AP is not supported." +msgstr "" + #: ports/mimxrt10xx/common-hal/busio/UART.c ports/stm/common-hal/busio/UART.c msgid "Supply at least one UART pin" msgstr "" @@ -1984,35 +1999,11 @@ msgid "Temperature read timed out" msgstr "" #: supervisor/shared/safe_mode.c -msgid "The BOOT button was pressed at start up.\n" +msgid "The `microcontroller` module was used to boot into safe mode." msgstr "" -#: supervisor/shared/safe_mode.c -msgid "" -"The CircuitPython heap was corrupted because the stack was too small.\n" -"Increase the stack size if you know how. If not:" -msgstr "" - -#: ports/espressif/boards/adafruit_feather_esp32_v2/mpconfigboard.h -msgid "The SW38 button was pressed at start up.\n" -msgstr "" - -#: ports/espressif/boards/hardkernel_odroid_go/mpconfigboard.h -msgid "The VOLUME button was pressed at start up.\n" -msgstr "" - -#: supervisor/shared/safe_mode.c -msgid "" -"The `microcontroller` module was used to boot into safe mode. Press reset to " -"exit safe mode." -msgstr "" - -#: ports/espressif/boards/m5stack_atom_lite/mpconfigboard.h -msgid "The central button was pressed at start up.\n" -msgstr "" - -#: ports/nrf/boards/aramcon2_badge/mpconfigboard.h -msgid "The left button was pressed at start up.\n" +#: py/obj.c +msgid "The above exception was the direct cause of the following exception:" msgstr "" #: shared-bindings/rgbmatrix/RGBMatrix.c @@ -2020,10 +2011,7 @@ msgid "The length of rgb_pins must be 6, 12, 18, 24, or 30" msgstr "" #: supervisor/shared/safe_mode.c -msgid "" -"The microcontroller's power dipped. Make sure your power supply provides\n" -"enough power for the whole circuit and press reset (after ejecting " -"CIRCUITPY)." +msgid "The power dipped. Make sure you are providing enough power." msgstr "" #: shared-module/audiomixer/MixerVoice.c @@ -2042,6 +2030,10 @@ msgstr "" msgid "The sample's signedness does not match the mixer's" msgstr "" +#: supervisor/shared/safe_mode.c +msgid "Third-party firmware fatal error." +msgstr "" + #: shared-module/imagecapture/ParallelImageCapture.c msgid "This microcontroller does not support continuous capture." msgstr "" @@ -2074,10 +2066,6 @@ msgstr "" msgid "Timeout is too long: Maximum timeout length is %d seconds" msgstr "" -#: supervisor/shared/safe_mode.c -msgid "To exit, please reset the board without requesting safe mode." -msgstr "" - #: ports/atmel-samd/common-hal/audiobusio/I2SOut.c msgid "Too many channels in sample" msgstr "" @@ -2122,6 +2110,10 @@ msgstr "" msgid "UART init" msgstr "" +#: ports/raspberrypi/common-hal/busio/UART.c +msgid "UART peripheral in use" +msgstr "" + #: ports/stm/common-hal/busio/UART.c msgid "UART re-init" msgstr "" @@ -2169,6 +2161,10 @@ msgstr "" msgid "Unable to allocate buffers for signed conversion" msgstr "" +#: supervisor/shared/safe_mode.c +msgid "Unable to allocate the heap." +msgstr "" + #: ports/espressif/common-hal/busio/I2C.c msgid "Unable to create lock" msgstr "" @@ -2192,11 +2188,12 @@ msgid "Unable to read color palette data" msgstr "" #: ports/espressif/common-hal/mdns/Server.c +#: ports/raspberrypi/common-hal/mdns/Server.c msgid "Unable to start mDNS query" msgstr "" -#: shared-bindings/coproc/CoprocMemory.c -msgid "Unable to write" +#: shared-bindings/memorymap/AddressRange.c +msgid "Unable to write to address." msgstr "" #: shared-bindings/nvm/ByteArray.c @@ -2267,6 +2264,7 @@ msgid "Unkown error code %d" msgstr "" #: shared-bindings/adafruit_pixelbuf/PixelBuf.c +#: shared-module/_pixelmap/PixelMap.c #, c-format msgid "Unmatched number of items on RHS (expected %d, got %d)." msgstr "" @@ -2351,6 +2349,18 @@ msgstr "" msgid "Wi-Fi: " msgstr "" +#: ports/raspberrypi/common-hal/wifi/Radio.c +msgid "Wifi is in access point mode." +msgstr "" + +#: ports/raspberrypi/common-hal/wifi/Radio.c +msgid "Wifi is in station mode." +msgstr "" + +#: ports/raspberrypi/common-hal/wifi/Radio.c +msgid "Wifi is not enabled" +msgstr "" + #: main.c msgid "Woken up by alarm.\n" msgstr "" @@ -2360,13 +2370,48 @@ msgstr "" msgid "Writes not supported on Characteristic" msgstr "" -#: supervisor/shared/safe_mode.c -msgid "You are in safe mode because:\n" +#: ports/atmel-samd/boards/circuitplayground_express/mpconfigboard.h +#: ports/atmel-samd/boards/circuitplayground_express_crickit/mpconfigboard.h +#: ports/atmel-samd/boards/circuitplayground_express_displayio/mpconfigboard.h +#: ports/atmel-samd/boards/meowmeow/mpconfigboard.h +msgid "You pressed both buttons at start up." +msgstr "" + +#: ports/espressif/boards/m5stack_core_basic/mpconfigboard.h +#: ports/espressif/boards/m5stack_core_fire/mpconfigboard.h +#: ports/espressif/boards/m5stack_stick_c/mpconfigboard.h +msgid "You pressed button A at start up." msgstr "" #: supervisor/shared/safe_mode.c -msgid "" -"You pressed the reset button during boot. Press again to exit safe mode." +msgid "You pressed the BOOT button at start up" +msgstr "" + +#: ports/espressif/boards/adafruit_feather_esp32_v2/mpconfigboard.h +msgid "You pressed the SW38 button at start up." +msgstr "" + +#: ports/espressif/boards/hardkernel_odroid_go/mpconfigboard.h +msgid "You pressed the VOLUME button at start up." +msgstr "" + +#: ports/espressif/boards/m5stack_atom_echo/mpconfigboard.h +#: ports/espressif/boards/m5stack_atom_lite/mpconfigboard.h +#: ports/espressif/boards/m5stack_atom_matrix/mpconfigboard.h +#: ports/espressif/boards/m5stack_atom_u/mpconfigboard.h +msgid "You pressed the central button at start up." +msgstr "" + +#: ports/nrf/boards/aramcon2_badge/mpconfigboard.h +msgid "You pressed the left button at start up." +msgstr "" + +#: supervisor/shared/safe_mode.c +msgid "You pressed the reset button during boot." +msgstr "" + +#: supervisor/shared/micropython.c +msgid "[truncated due to length]" msgstr "" #: py/objtype.c @@ -2438,8 +2483,12 @@ msgstr "" msgid "array has too many dimensions" msgstr "" +#: extmod/ulab/code/ndarray.c +msgid "array is too big" +msgstr "" + #: py/objarray.c shared-bindings/alarm/SleepMemory.c -#: shared-bindings/coproc/CoprocMemory.c shared-bindings/nvm/ByteArray.c +#: shared-bindings/memorymap/AddressRange.c shared-bindings/nvm/ByteArray.c msgid "array/bytes required on right side" msgstr "" @@ -2532,10 +2581,6 @@ msgstr "" msgid "buffer too small for requested bytes" msgstr "" -#: shared-bindings/adafruit_pixelbuf/PixelBuf.c -msgid "byteorder is not a string" -msgstr "" - #: py/objarray.c msgid "bytes length not a multiple of item size" msgstr "" @@ -2577,14 +2622,10 @@ msgstr "" msgid "can't cancel self" msgstr "" -#: py/obj.c py/objint.c shared-module/adafruit_pixelbuf/PixelBuf.c +#: py/obj.c py/objint.c py/runtime.c shared-module/adafruit_pixelbuf/PixelBuf.c msgid "can't convert %q to %q" msgstr "" -#: py/runtime.c -msgid "can't convert %q to int" -msgstr "" - #: py/obj.c #, c-format msgid "can't convert %s to complex" @@ -2666,6 +2707,10 @@ msgstr "" msgid "can't set attribute" msgstr "" +#: py/runtime.c +msgid "can't set attribute '%q'" +msgstr "" + #: py/emitnative.c msgid "can't store '%q'" msgstr "" @@ -2768,10 +2813,6 @@ msgstr "" msgid "comparison of int and uint" msgstr "" -#: py/objcomplex.c -msgid "complex division by zero" -msgstr "" - #: py/objfloat.c py/parsenum.c msgid "complex values not supported" msgstr "" @@ -2874,12 +2915,11 @@ msgstr "" msgid "div/mod not implemented for uint" msgstr "" -#: py/objfloat.c py/objint_mpz.c +#: extmod/ulab/code/numpy/create.c msgid "divide by zero" msgstr "" -#: py/modmath.c py/objint_longlong.c py/runtime.c -#: shared-bindings/math/__init__.c +#: py/runtime.c msgid "division by zero" msgstr "" @@ -2920,9 +2960,9 @@ msgstr "" msgid "error = 0x%08lX" msgstr "" -#: ports/espressif/common-hal/esp32_camera/Camera.c +#: ports/espressif/common-hal/espcamera/Camera.c msgid "" -"esp32_camera.Camera requires reserved PSRAM to be configured. See the " +"espcamera.Camera requires reserved PSRAM to be configured. See the " "documentation for instructions." msgstr "" @@ -2930,14 +2970,6 @@ msgstr "" msgid "exceptions must derive from BaseException" msgstr "" -#: shared-bindings/canio/CAN.c -msgid "expected '%q' but got '%q'" -msgstr "" - -#: shared-bindings/canio/CAN.c -msgid "expected '%q' or '%q' but got '%q'" -msgstr "" - #: py/objstr.c msgid "expected ':' after format specifier" msgstr "" @@ -3036,10 +3068,6 @@ msgstr "" msgid "format requires a dict" msgstr "" -#: shared-bindings/microcontroller/Processor.c -msgid "frequency is read-only for this board" -msgstr "" - #: py/objdeque.c msgid "full" msgstr "" @@ -3152,8 +3180,12 @@ msgstr "" msgid "index is out of bounds" msgstr "" +#: shared-bindings/_pixelmap/PixelMap.c +msgid "index must be tuple or int" +msgstr "" + #: extmod/ulab/code/numpy/numerical.c extmod/ulab/code/ulab_tools.c -#: ports/espressif/common-hal/pulseio/PulseIn.c py/obj.c +#: ports/espressif/common-hal/pulseio/PulseIn.c #: shared-bindings/bitmaptools/__init__.c msgid "index out of range" msgstr "" @@ -3251,10 +3283,6 @@ msgstr "" msgid "inputs are not iterable" msgstr "" -#: py/parsenum.c -msgid "int() arg 2 must be >= 2 and <= 36" -msgstr "" - #: extmod/ulab/code/numpy/approx.c msgid "interp is defined for 1D iterables of equal length" msgstr "" @@ -3311,7 +3339,7 @@ msgstr "" msgid "invalid micropython decorator" msgstr "" -#: ports/espressif/common-hal/esp32_camera/Camera.c +#: ports/espressif/common-hal/espcamera/Camera.c msgid "invalid setting" msgstr "" @@ -3336,10 +3364,6 @@ msgstr "" msgid "invalid syntax for number" msgstr "" -#: py/objexcept.c -msgid "invalid traceback" -msgstr "" - #: py/objtype.c msgid "issubclass() arg 1 must be a class" msgstr "" @@ -3396,19 +3420,17 @@ msgstr "" msgid "local variable referenced before assignment" msgstr "" -#: py/objint.c -msgid "long int not supported in this build" -msgstr "" - #: ports/espressif/common-hal/canio/CAN.c msgid "loopback + silent mode not supported by peripheral" msgstr "" #: ports/espressif/common-hal/mdns/Server.c +#: ports/raspberrypi/common-hal/mdns/Server.c msgid "mDNS already initialized" msgstr "" #: ports/espressif/common-hal/mdns/Server.c +#: ports/raspberrypi/common-hal/mdns/Server.c msgid "mDNS only works with built-in WiFi" msgstr "" @@ -3537,6 +3559,10 @@ msgstr "" msgid "negative shift count" msgstr "" +#: shared-bindings/_pixelmap/PixelMap.c +msgid "nested index must be int" +msgstr "" + #: shared-module/sdcardio/SDCard.c msgid "no SD card" msgstr "" @@ -3570,7 +3596,7 @@ msgstr "" msgid "no response from SD card" msgstr "" -#: ports/espressif/common-hal/esp32_camera/Camera.c py/objobject.c py/runtime.c +#: ports/espressif/common-hal/espcamera/Camera.c py/objobject.c py/runtime.c msgid "no such attribute" msgstr "" @@ -3706,6 +3732,10 @@ msgstr "" msgid "only mono is supported" msgstr "" +#: extmod/ulab/code/numpy/create.c +msgid "only ndarrays can be concatenated" +msgstr "" + #: ports/stm/common-hal/audiobusio/PDMIn.c msgid "only oversample=64 is supported" msgstr "" @@ -3716,7 +3746,7 @@ msgid "only sample_rate=16000 is supported" msgstr "" #: py/objarray.c py/objstr.c py/objstrunicode.c py/objtuple.c -#: shared-bindings/alarm/SleepMemory.c shared-bindings/coproc/CoprocMemory.c +#: shared-bindings/alarm/SleepMemory.c shared-bindings/memorymap/AddressRange.c #: shared-bindings/nvm/ByteArray.c msgid "only slices with step=1 (aka None) are supported" msgstr "" @@ -3932,10 +3962,6 @@ msgstr "" msgid "slice step can't be zero" msgstr "" -#: py/objslice.c -msgid "slice step cannot be zero" -msgstr "" - #: py/nativeglue.c msgid "slice unsupported" msgstr "" @@ -3984,10 +4010,6 @@ msgstr "" msgid "start/end indices" msgstr "" -#: shared-bindings/random/__init__.c -msgid "step must be non-zero" -msgstr "" - #: shared-bindings/random/__init__.c msgid "stop not reachable from start" msgstr "" @@ -3996,10 +4018,6 @@ msgstr "" msgid "stream operation not supported" msgstr "" -#: py/objstrunicode.c -msgid "string indices must be integers, not %q" -msgstr "" - #: py/stream.c msgid "string not supported; use bytes or bytearray" msgstr "" @@ -4032,10 +4050,6 @@ msgstr "" msgid "syntax error in uctypes descriptor" msgstr "" -#: shared-bindings/time/__init__.c -msgid "time.struct_time() takes a 9-sequence" -msgstr "" - #: ports/atmel-samd/common-hal/watchdog/WatchDogTimer.c #: ports/espressif/common-hal/watchdog/WatchDogTimer.c #: ports/nrf/common-hal/watchdog/WatchDogTimer.c @@ -4317,10 +4331,6 @@ msgstr "" msgid "y value out of bounds" msgstr "" -#: py/objrange.c -msgid "zero step" -msgstr "" - #: extmod/ulab/code/scipy/signal/signal.c msgid "zi must be an ndarray" msgstr "" diff --git a/locale/cs.po b/locale/cs.po index 3ea4c2dcf3..c18e714f75 100644 --- a/locale/cs.po +++ b/locale/cs.po @@ -35,12 +35,21 @@ msgstr "" #: supervisor/shared/safe_mode.c msgid "" "\n" -"Please file an issue with the contents of your CIRCUITPY drive at \n" -"https://github.com/adafruit/circuitpython/issues\n" +"Please file an issue with your program at https://github.com/adafruit/" +"circuitpython/issues." msgstr "" + +#: supervisor/shared/safe_mode.c +msgid "" "\n" -"Prosím vytvořte tiket s obsahem vaší jednotky CIRCUITPY na adrese\n" -"https://github.com/adafruit/circuitpython/issues\n" +"Press reset to exit safe mode.\n" +msgstr "" + +#: supervisor/shared/safe_mode.c +msgid "" +"\n" +"You are in safe mode because:\n" +msgstr "" #: py/obj.c msgid " File \"%q\"" @@ -72,6 +81,11 @@ msgstr "%%c vyžaduje int nebo char" msgid "%02X" msgstr "" +#: shared-module/os/getenv.c +#, c-format +msgid "%S" +msgstr "" + #: shared-bindings/rgbmatrix/RGBMatrix.c #, c-format msgid "" @@ -87,7 +101,7 @@ msgstr "%d adresní pin, %d rgb pin a %d dlaždice indikuje výšku %d, ne %d" #: 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 +#: ports/stm/common-hal/canio/Listener.c ports/stm/common-hal/rtc/RTC.c msgid "%q" msgstr "%q" @@ -107,13 +121,18 @@ msgstr "%q obsahuje duplicitní piny" msgid "%q failure: %d" msgstr "%q: selhání %d" +#: py/argcheck.c +msgid "%q in %q must be of type %q, not %q" +msgstr "" + +#: ports/espressif/common-hal/espulp/ULP.c #: ports/raspberrypi/common-hal/rp2pio/StateMachine.c #: shared-bindings/digitalio/DigitalInOut.c #: shared-bindings/microcontroller/Pin.c msgid "%q in use" msgstr "%q se právě používá" -#: py/obj.c py/objstr.c py/objstrunicode.c +#: py/objstr.c py/objstrunicode.c msgid "%q index out of range" msgstr "Index %q je mimo rozsah" @@ -125,7 +144,11 @@ msgstr "Inicializace %q selhala" msgid "%q is %q" msgstr "" -#: py/argcheck.c +#: ports/raspberrypi/common-hal/wifi/Radio.c +msgid "%q is read-only for this board" +msgstr "" + +#: py/argcheck.c shared-bindings/usb_hid/Device.c msgid "%q length must be %d" msgstr "Délka %q musí být %d" @@ -141,10 +164,6 @@ msgstr "Délka %q musí být <= %d" 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" - #: py/argcheck.c msgid "%q must be %d" msgstr "%q musí být %d" @@ -166,25 +185,21 @@ msgid "%q must be >= %d" msgstr "%q musí být >= %d" #: shared-bindings/analogbufio/BufferedIn.c +msgid "%q must be a bytearray or array of type 'H' or 'B'" +msgstr "" + #: 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" +#: ports/raspberrypi/bindings/cyw43/__init__.c py/argcheck.c py/objexcept.c +#: shared-bindings/canio/CAN.c shared-bindings/digitalio/Pull.c +msgid "%q must be of type %q or %q, not %q" +msgstr "" -#: 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" -msgstr "%q musí být typu %q" - -#: shared-bindings/digitalio/Pull.c -msgid "%q must be of type %q or None" -msgstr "%q musí být typu %q nebo None" +#: py/argcheck.c py/obj.c py/objstrunicode.c +msgid "%q must be of type %q, not %q" +msgstr "" #: ports/atmel-samd/common-hal/busio/UART.c msgid "%q must be power of 2" @@ -196,7 +211,6 @@ msgstr "%q je mimo hranice" #: ports/atmel-samd/common-hal/pulseio/PulseIn.c #: ports/cxd56/common-hal/pulseio/PulseIn.c -#: ports/espressif/common-hal/coproc/Coproc.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 @@ -208,9 +222,9 @@ msgstr "%q je mimo rozsah" msgid "%q pin invalid" msgstr "pin %q není platný" -#: 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" +#: py/objrange.c py/objslice.c shared-bindings/random/__init__.c +msgid "%q step cannot be zero" +msgstr "" #: py/bc.c py/objnamedtuple.c msgid "%q() takes %d positional arguments but %d were given" @@ -309,7 +323,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" -#: ports/raspberrypi/common-hal/wifi/Radio.c py/runtime.c +#: py/runtime.c msgid "'%s' object has no attribute '%q'" msgstr "'%s' objekt nemá žádný atribut '%q'" @@ -409,6 +423,10 @@ msgstr "WiFi používá ADC2" msgid "Address must be %d bytes long" msgstr "Adresa musí být %d bajtů dlouhá" +#: ports/espressif/common-hal/memorymap/AddressRange.c +msgid "Address range not allowed" +msgstr "" + #: ports/espressif/common-hal/canio/CAN.c msgid "All CAN peripherals are in use" msgstr "Všechny CAN periferie jsou používány" @@ -436,7 +454,6 @@ msgid "All SPI peripherals are in use" 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 "Všechny UART periferie jsou používány" @@ -489,7 +506,7 @@ msgstr "Již propagujeme." msgid "Already have all-matches listener" msgstr "" -#: ports/espressif/common-hal/coproc/__init__.c +#: ports/espressif/common-hal/espulp/ULP.c #: shared-module/memorymonitor/AllocationAlarm.c #: shared-module/memorymonitor/AllocationSize.c msgid "Already running" @@ -500,6 +517,11 @@ msgstr "Již běží" msgid "Already scanning for wifi networks" msgstr "Již skenuje wifi sítě" +#: shared-module/os/getenv.c +#, c-format +msgid "An error occurred while retrieving '%s':\n" +msgstr "" + #: ports/stm/common-hal/audiopwmio/PWMAudioOut.c msgid "Another PWMAudioOut is already active" msgstr "Jiný PWMAudioOut je již aktivní" @@ -513,24 +535,16 @@ msgstr "Další odesílání je již aktivní" msgid "Array must contain halfwords (type 'H')" msgstr "Pole musí obsahovat poloviční slova (typ „H“)" -#: shared-bindings/alarm/SleepMemory.c shared-bindings/coproc/CoprocMemory.c +#: shared-bindings/alarm/SleepMemory.c shared-bindings/memorymap/AddressRange.c #: shared-bindings/nvm/ByteArray.c msgid "Array values should be single bytes." 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 "Lze zadat maximálně %d %q (nikoli %d)" - #: shared-module/memorymonitor/AllocationAlarm.c #, c-format msgid "Attempt to allocate %d blocks" msgstr "Pokus o alokování %d bloků" -#: supervisor/shared/safe_mode.c -msgid "Attempted heap allocation when VM not running." -msgstr "Pokus o alokaci haldy, když neběží VM." - #: ports/raspberrypi/audio_dma.c msgid "Audio conversion not implemented" msgstr "Konverze audia není implementována" @@ -581,20 +595,13 @@ msgid "Bitmap size and bits per value must match" 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 "Bootovací zařízení musí být první (rozhraní #0)." +msgid "Boot device must be first (interface #0)." +msgstr "" #: ports/mimxrt10xx/common-hal/busio/UART.c msgid "Both RX and TX required for flow control" msgstr "RX a TX jsou vyžadovány pro kontrolu toku" -#: ports/atmel-samd/boards/circuitplayground_express/mpconfigboard.h -#: ports/atmel-samd/boards/circuitplayground_express_crickit/mpconfigboard.h -#: ports/atmel-samd/boards/circuitplayground_express_displayio/mpconfigboard.h -#: ports/atmel-samd/boards/meowmeow/mpconfigboard.h -msgid "Both buttons were pressed at start up.\n" -msgstr "" - #: ports/atmel-samd/common-hal/rotaryio/IncrementalEncoder.c msgid "Both pins must support hardware interrupts" msgstr "Oba piny musí podporovat hardwarové přerušení" @@ -660,11 +667,6 @@ msgstr "Buffery musí mít stejnou velikost" msgid "Bus pin %d is already in use" msgstr "Sběrnicový pin %d je již používán" -#: ports/espressif/boards/m5stack_core_basic/mpconfigboard.h -#: ports/espressif/boards/m5stack_core_fire/mpconfigboard.h -msgid "Button A was pressed at start up.\n" -msgstr "" - #: shared-bindings/_bleio/UUID.c msgid "Byte buffer must be 16 bytes." msgstr "Bajtový buffer musí být 16 bajtů." @@ -796,10 +798,6 @@ msgstr "CharacteristicBuffer psaní není poskytováno" msgid "CircuitPython core code crashed hard. Whoops!\n" msgstr "Jádro kódu CircuitPython tvrdě havarovalo. Jejda!\n" -#: supervisor/shared/safe_mode.c -msgid "CircuitPython was unable to allocate the heap." -msgstr "CircuitPython nedokázal alokovat haldu." - #: shared-module/bitbangio/I2C.c msgid "Clock stretch too long" msgstr "Hodiny jsou příliš dlouhé" @@ -839,10 +837,6 @@ msgstr "Nelze začít přerušení, RX je zaneprázdněn" msgid "Couldn't allocate decoder" msgstr "Dekodér nelze přiřadit" -#: supervisor/shared/safe_mode.c -msgid "Crash into the HardFault_Handler." -msgstr "Pád do HardFault_Handler." - #: ports/stm/common-hal/analogio/AnalogOut.c msgid "DAC Channel Init Error" msgstr "Chyba inicializace kanálu DAC" @@ -905,6 +899,10 @@ msgstr "" msgid "Drive mode not used when direction is input." msgstr "" +#: py/obj.c +msgid "During handling of the above exception, another exception occurred:" +msgstr "" + #: shared-bindings/aesio/aes.c msgid "ECB only operates on 16 bytes at a time" msgstr "ECB operuje najednou pouze 16 bajtů" @@ -930,24 +928,16 @@ msgstr "Chyba v MIDI přenosu na pozici %d" msgid "Error in regex" msgstr "Chyba v regulárním výrazu" +#: supervisor/shared/safe_mode.c +msgid "Error in safemode.py." +msgstr "" + #: shared-bindings/socketpool/Socket.c shared-bindings/ssl/SSLSocket.c msgid "Error: Failure to bind" msgstr "" -#: py/enum.c shared-bindings/_bleio/__init__.c shared-bindings/aesio/aes.c -#: shared-bindings/alarm/__init__.c shared-bindings/alarm/coproc/CoprocAlarm.c -#: shared-bindings/busio/SPI.c shared-bindings/coproc/Coproc.c -#: shared-bindings/coproc/__init__.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 %q" +msgid "Expected a kind of %q" msgstr "" #: ports/espressif/common-hal/_bleio/Adapter.c @@ -1015,13 +1005,17 @@ msgid "Failed to write internal flash." msgstr "Nepodařilo se zapsat do interní paměti." #: supervisor/shared/safe_mode.c -msgid "Fatal error." -msgstr "Fatální chyba." +msgid "Fault detected by hardware." +msgstr "" #: py/moduerrno.c msgid "File exists" msgstr "soubor existuje" +#: shared-module/os/getenv.c +msgid "File not found" +msgstr "" + #: ports/atmel-samd/common-hal/canio/Listener.c #: ports/espressif/common-hal/canio/Listener.c #: ports/stm/common-hal/canio/Listener.c @@ -1036,7 +1030,6 @@ msgstr "" msgid "Firmware is invalid" msgstr "" -#: ports/espressif/common-hal/coproc/Coproc.c #: ports/espressif/common-hal/dualbank/__init__.c msgid "Firmware is too big" msgstr "" @@ -1080,6 +1073,8 @@ msgstr "Základní chyba" #: shared-bindings/displayio/Display.c #: shared-bindings/displayio/EPaperDisplay.c #: shared-bindings/framebufferio/FramebufferDisplay.c +#: shared-module/displayio/Display.c +#: shared-module/framebufferio/FramebufferDisplay.c msgid "Group already used" msgstr "Skupina již byla použita" @@ -1100,6 +1095,15 @@ msgstr "Hardware je zaneprázdněn, zkuste alternativní piny" msgid "Hardware in use, try alternative pins" msgstr "Hardware je používán, zkuste alternativní piny" +#: supervisor/shared/safe_mode.c +msgid "Heap allocation when VM not running." +msgstr "" + +#: supervisor/shared/safe_mode.c +msgid "" +"Heap was corrupted because the stack was too small. Increase stack size." +msgstr "" + #: extmod/vfs_posix_file.c py/objstringio.c msgid "I/O operation on closed file" msgstr "" @@ -1117,11 +1121,6 @@ msgstr "Periférie I2C je používána" msgid "I2SOut not available" msgstr "" -#: shared-bindings/aesio/aes.c -#, c-format -msgid "IV must be %d bytes long" -msgstr "IV musí být dlouhé %d bajtů" - #: ports/raspberrypi/bindings/rp2pio/StateMachine.c msgid "In-buffer elements must be <= 4 bytes long" msgstr "" @@ -1208,6 +1207,7 @@ msgid "Internal define error" msgstr "" #: ports/espressif/common-hal/paralleldisplay/ParallelBus.c +#: shared-module/os/getenv.c msgid "Internal error" msgstr "Interní chyba" @@ -1220,6 +1220,10 @@ msgstr "Vnitřní chyba #%d" msgid "Internal watchdog timer expired." msgstr "" +#: supervisor/shared/safe_mode.c +msgid "Interrupt error." +msgstr "" + #: py/argcheck.c shared-bindings/digitalio/DigitalInOut.c msgid "Invalid %q" msgstr "" @@ -1254,6 +1258,11 @@ msgstr "Neplatný argument" msgid "Invalid bits per value" msgstr "" +#: shared-module/os/getenv.c +#, c-format +msgid "Invalid byte %.*s" +msgstr "" + #: ports/atmel-samd/common-hal/imagecapture/ParallelImageCapture.c #, c-format msgid "Invalid data_pins[%d]" @@ -1263,18 +1272,10 @@ msgstr "Chybný data_pin[%d]" msgid "Invalid format chunk size" msgstr "Neplatná velikost bloku" -#: supervisor/shared/safe_mode.c -msgid "Invalid memory access." -msgstr "Neplatný přístup k paměti." - #: ports/espressif/common-hal/wifi/Radio.c msgid "Invalid multicast MAC address" msgstr "Chybná multicastová MAC adresa" -#: shared-bindings/busio/UART.c -msgid "Invalid pins" -msgstr "Neplatné piny" - #: ports/espressif/common-hal/espidf/__init__.c ports/espressif/esp_error.c msgid "Invalid size" msgstr "Chybná velikost" @@ -1288,10 +1289,18 @@ msgstr "Chybný soket pro TLS" msgid "Invalid state" msgstr "Chybný stav" +#: shared-module/os/getenv.c +msgid "Invalid unicode escape" +msgstr "" + #: shared-bindings/aesio/aes.c msgid "Key must be 16, 24, or 32 bytes long" msgstr "Klíč musí být dlouhý 16, 24 nebo 32 bajtů" +#: shared-module/os/getenv.c +msgid "Key not found" +msgstr "" + #: shared-module/is31fl3741/FrameBuffer.c msgid "LED mappings must match display size" msgstr "Mapování LED musí korespondovat s velikostí displeje" @@ -1398,6 +1407,10 @@ msgstr "" msgid "NVS Error" msgstr "Chyba NVS" +#: shared-bindings/socketpool/SocketPool.c +msgid "Name or service not known" +msgstr "" + #: py/qstr.c msgid "Name too long" msgstr "Jméno je příliš dlouhé" @@ -1512,11 +1525,6 @@ msgstr "Nebyl zadán klíč" msgid "No long integer support" msgstr "" -#: shared-module/usb_hid/__init__.c -#, c-format -msgid "No more than %d HID devices allowed" -msgstr "Ne více než %d HID zařízení je povoleno" - #: shared-bindings/wifi/Radio.c msgid "No network with that ssid" msgstr "Žádná síť s takovým SSID" @@ -1552,10 +1560,6 @@ msgstr "Žádný takový soubor / adresář" msgid "No timer available" msgstr "Není k dispozici žádný časovač" -#: supervisor/shared/safe_mode.c -msgid "Nordic system firmware failure assertion." -msgstr "" - #: ports/nrf/common-hal/_bleio/__init__.c msgid "Nordic system firmware out of memory" msgstr "" @@ -1575,10 +1579,6 @@ msgstr "Nepřipojený" msgid "Not playing" msgstr "Nehraje" -#: shared-bindings/_bleio/__init__.c -msgid "Not settable" -msgstr "" - #: ports/espressif/common-hal/paralleldisplay/ParallelBus.c #, c-format msgid "Number of data_pins must be 8 or 16, not %d" @@ -1642,11 +1642,14 @@ msgid "" "%d bpp given" msgstr "" -#: ports/espressif/common-hal/alarm/coproc/CoprocAlarm.c #: ports/espressif/common-hal/alarm/touch/TouchAlarm.c msgid "Only one %q can be set in deep sleep." msgstr "" +#: ports/espressif/common-hal/espulp/ULPAlarm.c +msgid "Only one %q can be set." +msgstr "" + #: ports/espressif/common-hal/i2ctarget/I2CTarget.c #: ports/raspberrypi/common-hal/i2ctarget/I2CTarget.c msgid "Only one address is allowed" @@ -1679,6 +1682,10 @@ msgstr "" msgid "Operation timed out" msgstr "" +#: ports/raspberrypi/common-hal/mdns/Server.c +msgid "Out of MDNS service slots" +msgstr "" + #: ports/espressif/common-hal/espidf/__init__.c ports/espressif/esp_error.c msgid "Out of memory" msgstr "" @@ -1804,6 +1811,10 @@ msgstr "" msgid "Program size invalid" msgstr "" +#: ports/espressif/common-hal/espulp/ULP.c +msgid "Program too long" +msgstr "" + #: shared-bindings/digitalio/DigitalInOut.c msgid "Pull not used when direction is output." msgstr "" @@ -1843,8 +1854,9 @@ msgstr "" msgid "Random number generation error" msgstr "" +#: shared-bindings/_bleio/__init__.c #: shared-bindings/memorymonitor/AllocationSize.c -#: shared-bindings/pulseio/PulseIn.c +#: shared-bindings/pulseio/PulseIn.c shared-module/displayio/Bitmap.c msgid "Read-only" msgstr "" @@ -1852,10 +1864,6 @@ msgstr "" msgid "Read-only filesystem" msgstr "" -#: shared-module/displayio/Bitmap.c -msgid "Read-only object" -msgstr "" - #: ports/espressif/common-hal/espidf/__init__.c ports/espressif/esp_error.c msgid "Received response was invalid" msgstr "" @@ -1948,7 +1956,7 @@ msgstr "" msgid "Sleep Memory not available" msgstr "" -#: shared-bindings/alarm/SleepMemory.c shared-bindings/coproc/CoprocMemory.c +#: shared-bindings/alarm/SleepMemory.c shared-bindings/memorymap/AddressRange.c #: shared-bindings/nvm/ByteArray.c msgid "Slice and value different lengths." msgstr "" @@ -1985,6 +1993,10 @@ msgstr "" msgid "Stereo right must be on PWM channel B" msgstr "" +#: ports/raspberrypi/common-hal/wifi/Radio.c +msgid "Stopping AP is not supported." +msgstr "" + #: ports/mimxrt10xx/common-hal/busio/UART.c ports/stm/common-hal/busio/UART.c msgid "Supply at least one UART pin" msgstr "" @@ -2002,35 +2014,11 @@ msgid "Temperature read timed out" msgstr "" #: supervisor/shared/safe_mode.c -msgid "The BOOT button was pressed at start up.\n" +msgid "The `microcontroller` module was used to boot into safe mode." msgstr "" -#: supervisor/shared/safe_mode.c -msgid "" -"The CircuitPython heap was corrupted because the stack was too small.\n" -"Increase the stack size if you know how. If not:" -msgstr "" - -#: ports/espressif/boards/adafruit_feather_esp32_v2/mpconfigboard.h -msgid "The SW38 button was pressed at start up.\n" -msgstr "" - -#: ports/espressif/boards/hardkernel_odroid_go/mpconfigboard.h -msgid "The VOLUME button was pressed at start up.\n" -msgstr "" - -#: supervisor/shared/safe_mode.c -msgid "" -"The `microcontroller` module was used to boot into safe mode. Press reset to " -"exit safe mode." -msgstr "" - -#: ports/espressif/boards/m5stack_atom_lite/mpconfigboard.h -msgid "The central button was pressed at start up.\n" -msgstr "" - -#: ports/nrf/boards/aramcon2_badge/mpconfigboard.h -msgid "The left button was pressed at start up.\n" +#: py/obj.c +msgid "The above exception was the direct cause of the following exception:" msgstr "" #: shared-bindings/rgbmatrix/RGBMatrix.c @@ -2038,10 +2026,7 @@ msgid "The length of rgb_pins must be 6, 12, 18, 24, or 30" msgstr "" #: supervisor/shared/safe_mode.c -msgid "" -"The microcontroller's power dipped. Make sure your power supply provides\n" -"enough power for the whole circuit and press reset (after ejecting " -"CIRCUITPY)." +msgid "The power dipped. Make sure you are providing enough power." msgstr "" #: shared-module/audiomixer/MixerVoice.c @@ -2060,6 +2045,10 @@ msgstr "" msgid "The sample's signedness does not match the mixer's" msgstr "" +#: supervisor/shared/safe_mode.c +msgid "Third-party firmware fatal error." +msgstr "" + #: shared-module/imagecapture/ParallelImageCapture.c msgid "This microcontroller does not support continuous capture." msgstr "" @@ -2092,10 +2081,6 @@ msgstr "" msgid "Timeout is too long: Maximum timeout length is %d seconds" msgstr "" -#: supervisor/shared/safe_mode.c -msgid "To exit, please reset the board without requesting safe mode." -msgstr "" - #: ports/atmel-samd/common-hal/audiobusio/I2SOut.c msgid "Too many channels in sample" msgstr "" @@ -2140,6 +2125,10 @@ msgstr "" msgid "UART init" msgstr "" +#: ports/raspberrypi/common-hal/busio/UART.c +msgid "UART peripheral in use" +msgstr "" + #: ports/stm/common-hal/busio/UART.c msgid "UART re-init" msgstr "" @@ -2187,6 +2176,10 @@ msgstr "" msgid "Unable to allocate buffers for signed conversion" msgstr "" +#: supervisor/shared/safe_mode.c +msgid "Unable to allocate the heap." +msgstr "" + #: ports/espressif/common-hal/busio/I2C.c msgid "Unable to create lock" msgstr "" @@ -2210,11 +2203,12 @@ msgid "Unable to read color palette data" msgstr "" #: ports/espressif/common-hal/mdns/Server.c +#: ports/raspberrypi/common-hal/mdns/Server.c msgid "Unable to start mDNS query" msgstr "" -#: shared-bindings/coproc/CoprocMemory.c -msgid "Unable to write" +#: shared-bindings/memorymap/AddressRange.c +msgid "Unable to write to address." msgstr "" #: shared-bindings/nvm/ByteArray.c @@ -2285,6 +2279,7 @@ msgid "Unkown error code %d" msgstr "" #: shared-bindings/adafruit_pixelbuf/PixelBuf.c +#: shared-module/_pixelmap/PixelMap.c #, c-format msgid "Unmatched number of items on RHS (expected %d, got %d)." msgstr "" @@ -2369,6 +2364,18 @@ msgstr "" msgid "Wi-Fi: " msgstr "" +#: ports/raspberrypi/common-hal/wifi/Radio.c +msgid "Wifi is in access point mode." +msgstr "" + +#: ports/raspberrypi/common-hal/wifi/Radio.c +msgid "Wifi is in station mode." +msgstr "" + +#: ports/raspberrypi/common-hal/wifi/Radio.c +msgid "Wifi is not enabled" +msgstr "" + #: main.c msgid "Woken up by alarm.\n" msgstr "" @@ -2378,13 +2385,48 @@ msgstr "" msgid "Writes not supported on Characteristic" msgstr "" -#: supervisor/shared/safe_mode.c -msgid "You are in safe mode because:\n" +#: ports/atmel-samd/boards/circuitplayground_express/mpconfigboard.h +#: ports/atmel-samd/boards/circuitplayground_express_crickit/mpconfigboard.h +#: ports/atmel-samd/boards/circuitplayground_express_displayio/mpconfigboard.h +#: ports/atmel-samd/boards/meowmeow/mpconfigboard.h +msgid "You pressed both buttons at start up." +msgstr "" + +#: ports/espressif/boards/m5stack_core_basic/mpconfigboard.h +#: ports/espressif/boards/m5stack_core_fire/mpconfigboard.h +#: ports/espressif/boards/m5stack_stick_c/mpconfigboard.h +msgid "You pressed button A at start up." msgstr "" #: supervisor/shared/safe_mode.c -msgid "" -"You pressed the reset button during boot. Press again to exit safe mode." +msgid "You pressed the BOOT button at start up" +msgstr "" + +#: ports/espressif/boards/adafruit_feather_esp32_v2/mpconfigboard.h +msgid "You pressed the SW38 button at start up." +msgstr "" + +#: ports/espressif/boards/hardkernel_odroid_go/mpconfigboard.h +msgid "You pressed the VOLUME button at start up." +msgstr "" + +#: ports/espressif/boards/m5stack_atom_echo/mpconfigboard.h +#: ports/espressif/boards/m5stack_atom_lite/mpconfigboard.h +#: ports/espressif/boards/m5stack_atom_matrix/mpconfigboard.h +#: ports/espressif/boards/m5stack_atom_u/mpconfigboard.h +msgid "You pressed the central button at start up." +msgstr "" + +#: ports/nrf/boards/aramcon2_badge/mpconfigboard.h +msgid "You pressed the left button at start up." +msgstr "" + +#: supervisor/shared/safe_mode.c +msgid "You pressed the reset button during boot." +msgstr "" + +#: supervisor/shared/micropython.c +msgid "[truncated due to length]" msgstr "" #: py/objtype.c @@ -2456,8 +2498,12 @@ msgstr "" msgid "array has too many dimensions" msgstr "" +#: extmod/ulab/code/ndarray.c +msgid "array is too big" +msgstr "" + #: py/objarray.c shared-bindings/alarm/SleepMemory.c -#: shared-bindings/coproc/CoprocMemory.c shared-bindings/nvm/ByteArray.c +#: shared-bindings/memorymap/AddressRange.c shared-bindings/nvm/ByteArray.c msgid "array/bytes required on right side" msgstr "" @@ -2550,10 +2596,6 @@ msgstr "" msgid "buffer too small for requested bytes" msgstr "" -#: shared-bindings/adafruit_pixelbuf/PixelBuf.c -msgid "byteorder is not a string" -msgstr "" - #: py/objarray.c msgid "bytes length not a multiple of item size" msgstr "" @@ -2595,14 +2637,10 @@ msgstr "" msgid "can't cancel self" msgstr "" -#: py/obj.c py/objint.c shared-module/adafruit_pixelbuf/PixelBuf.c +#: py/obj.c py/objint.c py/runtime.c shared-module/adafruit_pixelbuf/PixelBuf.c msgid "can't convert %q to %q" msgstr "" -#: py/runtime.c -msgid "can't convert %q to int" -msgstr "" - #: py/obj.c #, c-format msgid "can't convert %s to complex" @@ -2684,6 +2722,10 @@ msgstr "" msgid "can't set attribute" msgstr "" +#: py/runtime.c +msgid "can't set attribute '%q'" +msgstr "" + #: py/emitnative.c msgid "can't store '%q'" msgstr "" @@ -2786,10 +2828,6 @@ msgstr "" msgid "comparison of int and uint" msgstr "" -#: py/objcomplex.c -msgid "complex division by zero" -msgstr "" - #: py/objfloat.c py/parsenum.c msgid "complex values not supported" msgstr "" @@ -2892,12 +2930,11 @@ msgstr "" msgid "div/mod not implemented for uint" msgstr "" -#: py/objfloat.c py/objint_mpz.c +#: extmod/ulab/code/numpy/create.c msgid "divide by zero" msgstr "" -#: py/modmath.c py/objint_longlong.c py/runtime.c -#: shared-bindings/math/__init__.c +#: py/runtime.c msgid "division by zero" msgstr "" @@ -2938,9 +2975,9 @@ msgstr "" msgid "error = 0x%08lX" msgstr "" -#: ports/espressif/common-hal/esp32_camera/Camera.c +#: ports/espressif/common-hal/espcamera/Camera.c msgid "" -"esp32_camera.Camera requires reserved PSRAM to be configured. See the " +"espcamera.Camera requires reserved PSRAM to be configured. See the " "documentation for instructions." msgstr "" @@ -2948,14 +2985,6 @@ msgstr "" msgid "exceptions must derive from BaseException" msgstr "" -#: shared-bindings/canio/CAN.c -msgid "expected '%q' but got '%q'" -msgstr "" - -#: shared-bindings/canio/CAN.c -msgid "expected '%q' or '%q' but got '%q'" -msgstr "" - #: py/objstr.c msgid "expected ':' after format specifier" msgstr "" @@ -3054,10 +3083,6 @@ msgstr "" msgid "format requires a dict" msgstr "" -#: shared-bindings/microcontroller/Processor.c -msgid "frequency is read-only for this board" -msgstr "" - #: py/objdeque.c msgid "full" msgstr "" @@ -3170,8 +3195,12 @@ msgstr "" msgid "index is out of bounds" msgstr "" +#: shared-bindings/_pixelmap/PixelMap.c +msgid "index must be tuple or int" +msgstr "" + #: extmod/ulab/code/numpy/numerical.c extmod/ulab/code/ulab_tools.c -#: ports/espressif/common-hal/pulseio/PulseIn.c py/obj.c +#: ports/espressif/common-hal/pulseio/PulseIn.c #: shared-bindings/bitmaptools/__init__.c msgid "index out of range" msgstr "" @@ -3269,10 +3298,6 @@ msgstr "" msgid "inputs are not iterable" msgstr "" -#: py/parsenum.c -msgid "int() arg 2 must be >= 2 and <= 36" -msgstr "" - #: extmod/ulab/code/numpy/approx.c msgid "interp is defined for 1D iterables of equal length" msgstr "" @@ -3329,7 +3354,7 @@ msgstr "" msgid "invalid micropython decorator" msgstr "" -#: ports/espressif/common-hal/esp32_camera/Camera.c +#: ports/espressif/common-hal/espcamera/Camera.c msgid "invalid setting" msgstr "" @@ -3354,10 +3379,6 @@ msgstr "" msgid "invalid syntax for number" msgstr "" -#: py/objexcept.c -msgid "invalid traceback" -msgstr "" - #: py/objtype.c msgid "issubclass() arg 1 must be a class" msgstr "" @@ -3414,19 +3435,17 @@ msgstr "" msgid "local variable referenced before assignment" msgstr "" -#: py/objint.c -msgid "long int not supported in this build" -msgstr "" - #: ports/espressif/common-hal/canio/CAN.c msgid "loopback + silent mode not supported by peripheral" msgstr "" #: ports/espressif/common-hal/mdns/Server.c +#: ports/raspberrypi/common-hal/mdns/Server.c msgid "mDNS already initialized" msgstr "" #: ports/espressif/common-hal/mdns/Server.c +#: ports/raspberrypi/common-hal/mdns/Server.c msgid "mDNS only works with built-in WiFi" msgstr "" @@ -3555,6 +3574,10 @@ msgstr "" msgid "negative shift count" msgstr "" +#: shared-bindings/_pixelmap/PixelMap.c +msgid "nested index must be int" +msgstr "" + #: shared-module/sdcardio/SDCard.c msgid "no SD card" msgstr "" @@ -3588,7 +3611,7 @@ msgstr "" msgid "no response from SD card" msgstr "" -#: ports/espressif/common-hal/esp32_camera/Camera.c py/objobject.c py/runtime.c +#: ports/espressif/common-hal/espcamera/Camera.c py/objobject.c py/runtime.c msgid "no such attribute" msgstr "" @@ -3724,6 +3747,10 @@ msgstr "" msgid "only mono is supported" msgstr "" +#: extmod/ulab/code/numpy/create.c +msgid "only ndarrays can be concatenated" +msgstr "" + #: ports/stm/common-hal/audiobusio/PDMIn.c msgid "only oversample=64 is supported" msgstr "" @@ -3734,7 +3761,7 @@ msgid "only sample_rate=16000 is supported" msgstr "" #: py/objarray.c py/objstr.c py/objstrunicode.c py/objtuple.c -#: shared-bindings/alarm/SleepMemory.c shared-bindings/coproc/CoprocMemory.c +#: shared-bindings/alarm/SleepMemory.c shared-bindings/memorymap/AddressRange.c #: shared-bindings/nvm/ByteArray.c msgid "only slices with step=1 (aka None) are supported" msgstr "" @@ -3950,10 +3977,6 @@ msgstr "" msgid "slice step can't be zero" msgstr "" -#: py/objslice.c -msgid "slice step cannot be zero" -msgstr "" - #: py/nativeglue.c msgid "slice unsupported" msgstr "" @@ -4002,10 +4025,6 @@ msgstr "" msgid "start/end indices" msgstr "" -#: shared-bindings/random/__init__.c -msgid "step must be non-zero" -msgstr "" - #: shared-bindings/random/__init__.c msgid "stop not reachable from start" msgstr "" @@ -4014,10 +4033,6 @@ msgstr "" msgid "stream operation not supported" msgstr "" -#: py/objstrunicode.c -msgid "string indices must be integers, not %q" -msgstr "" - #: py/stream.c msgid "string not supported; use bytes or bytearray" msgstr "" @@ -4050,10 +4065,6 @@ msgstr "" msgid "syntax error in uctypes descriptor" msgstr "" -#: shared-bindings/time/__init__.c -msgid "time.struct_time() takes a 9-sequence" -msgstr "" - #: ports/atmel-samd/common-hal/watchdog/WatchDogTimer.c #: ports/espressif/common-hal/watchdog/WatchDogTimer.c #: ports/nrf/common-hal/watchdog/WatchDogTimer.c @@ -4335,10 +4346,6 @@ msgstr "" msgid "y value out of bounds" msgstr "" -#: py/objrange.c -msgid "zero step" -msgstr "" - #: extmod/ulab/code/scipy/signal/signal.c msgid "zi must be an ndarray" msgstr "" @@ -4351,6 +4358,68 @@ msgstr "" msgid "zi must be of shape (n_section, 2)" msgstr "" +#~ msgid "" +#~ "\n" +#~ "Please file an issue with the contents of your CIRCUITPY drive at \n" +#~ "https://github.com/adafruit/circuitpython/issues\n" +#~ msgstr "" +#~ "\n" +#~ "Prosím vytvořte tiket s obsahem vaší jednotky CIRCUITPY na adrese\n" +#~ "https://github.com/adafruit/circuitpython/issues\n" + +#~ msgid "Attempted heap allocation when VM not running." +#~ msgstr "Pokus o alokaci haldy, když neběží VM." + +#~ msgid "Boot device must be first device (interface #0)." +#~ msgstr "Bootovací zařízení musí být první (rozhraní #0)." + +#~ msgid "CircuitPython was unable to allocate the heap." +#~ msgstr "CircuitPython nedokázal alokovat haldu." + +#~ msgid "Crash into the HardFault_Handler." +#~ msgstr "Pád do HardFault_Handler." + +#~ msgid "Fatal error." +#~ msgstr "Fatální chyba." + +#~ msgid "Invalid memory access." +#~ msgstr "Neplatný přístup k paměti." + +#~ msgid "%q must be of type %q" +#~ msgstr "%q musí být typu %q" + +#~ msgid "%q must be of type %q or None" +#~ msgstr "%q musí být typu %q nebo None" + +#~ msgid "Expected a %q" +#~ msgstr "Očekává se %q" + +#, c-format +#~ msgid "IV must be %d bytes long" +#~ msgstr "IV musí být dlouhé %d bajtů" + +#~ msgid "%q length must be >= 1" +#~ msgstr "%q délka musí být >= 1" + +#~ msgid "%q must be a string" +#~ msgstr "%q musí být string" + +#~ msgid "%q must be an int" +#~ msgstr "%q musí být int" + +#~ 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" + +#~ msgid "At most %d %q may be specified (not %d)" +#~ msgstr "Lze zadat maximálně %d %q (nikoli %d)" + +#~ msgid "Invalid pins" +#~ msgstr "Neplatné piny" + +#, c-format +#~ msgid "No more than %d HID devices allowed" +#~ msgstr "Ne více než %d HID zařízení je povoleno" + #~ msgid "%q indices must be integers, not %s" #~ msgstr "Indexy %q musí být celá čísla, nikoli %s" diff --git a/locale/de_DE.po b/locale/de_DE.po index d9c21c5742..4569dfb508 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-11-09 19:20+0000\n" +"PO-Revision-Date: 2023-01-13 18:51+0000\n" "Last-Translator: Ettore Atalan \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.15-dev\n" +"X-Generator: Weblate 4.15.1-dev\n" #: main.c msgid "" @@ -34,12 +34,21 @@ msgstr "" #: supervisor/shared/safe_mode.c msgid "" "\n" -"Please file an issue with the contents of your CIRCUITPY drive at \n" -"https://github.com/adafruit/circuitpython/issues\n" +"Please file an issue with your program at https://github.com/adafruit/" +"circuitpython/issues." msgstr "" + +#: supervisor/shared/safe_mode.c +msgid "" "\n" -"Bitte melde ein Problem mit dem Inhalt Ihres CIRCUITPY-Laufwerks unter\n" -"https://github.com/adafruit/circuitpython/issues\n" +"Press reset to exit safe mode.\n" +msgstr "" + +#: supervisor/shared/safe_mode.c +msgid "" +"\n" +"You are in safe mode because:\n" +msgstr "" #: py/obj.c msgid " File \"%q\"" @@ -71,6 +80,11 @@ msgstr "%%c erwartet Int oder Char" msgid "%02X" msgstr "%02X" +#: shared-module/os/getenv.c +#, c-format +msgid "%S" +msgstr "" + #: shared-bindings/rgbmatrix/RGBMatrix.c #, c-format msgid "" @@ -88,7 +102,7 @@ msgstr "" #: 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 +#: ports/stm/common-hal/canio/Listener.c ports/stm/common-hal/rtc/RTC.c msgid "%q" msgstr "%q" @@ -108,13 +122,18 @@ msgstr "%q enthält doppelte Pins" msgid "%q failure: %d" msgstr "%q Fehler: %d" +#: py/argcheck.c +msgid "%q in %q must be of type %q, not %q" +msgstr "%q in %q muss von Typ %q sein, nicht %q" + +#: ports/espressif/common-hal/espulp/ULP.c #: ports/raspberrypi/common-hal/rp2pio/StateMachine.c #: shared-bindings/digitalio/DigitalInOut.c #: shared-bindings/microcontroller/Pin.c msgid "%q in use" msgstr "%q in Benutzung" -#: py/obj.c py/objstr.c py/objstrunicode.c +#: py/objstr.c py/objstrunicode.c msgid "%q index out of range" msgstr "Der Index %q befindet sich außerhalb des Bereiches" @@ -126,7 +145,11 @@ msgstr "%q Initialisierung ist gescheitert" msgid "%q is %q" msgstr "%q ist %q" -#: py/argcheck.c +#: ports/raspberrypi/common-hal/wifi/Radio.c +msgid "%q is read-only for this board" +msgstr "%q ist für diese Platine schreibgeschützt" + +#: py/argcheck.c shared-bindings/usb_hid/Device.c msgid "%q length must be %d" msgstr "%q länge muss %d betragen" @@ -142,10 +165,6 @@ msgstr "%q länge muss kleiner oder gleich %d sein" 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" @@ -167,26 +186,22 @@ msgid "%q must be >= %d" msgstr "%q muss >= %d sein" #: shared-bindings/analogbufio/BufferedIn.c +msgid "%q must be a bytearray or array of type 'H' or 'B'" +msgstr "" + #: shared-bindings/audiocore/RawSample.c msgid "%q must be a bytearray or array of type 'h', 'H', 'b', or 'B'" msgstr "" "%q muss ein Byte-Array oder ein array vom Typ 'h', 'H', 'b', oder 'B' sein" -#: py/argcheck.c -msgid "%q must be a string" -msgstr "%q muss ein String sein" +#: ports/raspberrypi/bindings/cyw43/__init__.c py/argcheck.c py/objexcept.c +#: shared-bindings/canio/CAN.c shared-bindings/digitalio/Pull.c +msgid "%q must be of type %q or %q, not %q" +msgstr "%q muss von Typ %q oder %q sein, nicht %q" -#: 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" -msgstr "%q muss vom Type %q sein" - -#: shared-bindings/digitalio/Pull.c -msgid "%q must be of type %q or None" -msgstr "%q muss vom Type %q oder None sein" +#: py/argcheck.c py/obj.c py/objstrunicode.c +msgid "%q must be of type %q, not %q" +msgstr "%q muss von Typ %q sein, nicht %q" #: ports/atmel-samd/common-hal/busio/UART.c msgid "%q must be power of 2" @@ -198,7 +213,6 @@ msgstr "%q außerhalb der Grenzen" #: ports/atmel-samd/common-hal/pulseio/PulseIn.c #: ports/cxd56/common-hal/pulseio/PulseIn.c -#: ports/espressif/common-hal/coproc/Coproc.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 @@ -210,9 +224,9 @@ msgstr "%q außerhalb des Bereichs" msgid "%q pin invalid" msgstr "%q Pin ungültig" -#: 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" +#: py/objrange.c py/objslice.c shared-bindings/random/__init__.c +msgid "%q step cannot be zero" +msgstr "Schritt %q kann nicht Null sein" #: py/bc.c py/objnamedtuple.c msgid "%q() takes %d positional arguments but %d were given" @@ -312,7 +326,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" -#: ports/raspberrypi/common-hal/wifi/Radio.c py/runtime.c +#: py/runtime.c msgid "'%s' object has no attribute '%q'" msgstr "'%s' Objekt hat kein Attribut '%q'" @@ -412,6 +426,10 @@ msgstr "ADC2 wird vom WiFi benutzt" msgid "Address must be %d bytes long" msgstr "Die Adresse muss %d Bytes lang sein" +#: ports/espressif/common-hal/memorymap/AddressRange.c +msgid "Address range not allowed" +msgstr "Adressbereich nicht erlaubt" + #: ports/espressif/common-hal/canio/CAN.c msgid "All CAN peripherals are in use" msgstr "Alle CAN-Schnittstellen sind in Benutzung" @@ -439,7 +457,6 @@ msgid "All SPI peripherals are in use" msgstr "Alle SPI-Peripheriegeräte sind in Benutzung" #: 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 "Alle UART-Peripheriegeräte sind in Benutzung" @@ -492,7 +509,7 @@ msgstr "Bereits am Anbieten (advertising)." msgid "Already have all-matches listener" msgstr "All-Matchers-Listener bereits vorhanden" -#: ports/espressif/common-hal/coproc/__init__.c +#: ports/espressif/common-hal/espulp/ULP.c #: shared-module/memorymonitor/AllocationAlarm.c #: shared-module/memorymonitor/AllocationSize.c msgid "Already running" @@ -503,6 +520,11 @@ msgstr "Läuft bereits" msgid "Already scanning for wifi networks" msgstr "Sucht bereits nach Wifi-Netzwerken" +#: shared-module/os/getenv.c +#, c-format +msgid "An error occurred while retrieving '%s':\n" +msgstr "" + #: ports/stm/common-hal/audiopwmio/PWMAudioOut.c msgid "Another PWMAudioOut is already active" msgstr "Ein anderer PWMAudioOut ist bereits aktiv" @@ -516,24 +538,16 @@ msgstr "Ein anderer Sendevorgang ist schon aktiv" msgid "Array must contain halfwords (type 'H')" msgstr "Array muss Halbwörter enthalten (type 'H')" -#: shared-bindings/alarm/SleepMemory.c shared-bindings/coproc/CoprocMemory.c +#: shared-bindings/alarm/SleepMemory.c shared-bindings/memorymap/AddressRange.c #: shared-bindings/nvm/ByteArray.c msgid "Array values should be single bytes." msgstr "Array-Werte sollten aus Einzelbytes bestehen." -#: shared-bindings/microcontroller/Pin.c -msgid "At most %d %q may be specified (not %d)" -msgstr "Es darf höchstens %d %q spezifiziert werden (nicht %d)" - #: shared-module/memorymonitor/AllocationAlarm.c #, c-format msgid "Attempt to allocate %d blocks" msgstr "Versuche %d Blöcke zu allokieren" -#: supervisor/shared/safe_mode.c -msgid "Attempted heap allocation when VM not running." -msgstr "Versuchte Heap-Zuordnung wenn VM nicht läuft." - #: ports/raspberrypi/audio_dma.c msgid "Audio conversion not implemented" msgstr "Audio-Konvertierung nicht implementiert" @@ -584,20 +598,13 @@ msgid "Bitmap size and bits per value must match" msgstr "Bitmap-Grösse und Bits pro Wert müssen übereinstimmen" #: supervisor/shared/safe_mode.c -msgid "Boot device must be first device (interface #0)." -msgstr "Boot-Gerät muss erstes Gerät sein (interface #0)." +msgid "Boot device must be first (interface #0)." +msgstr "" #: ports/mimxrt10xx/common-hal/busio/UART.c msgid "Both RX and TX required for flow control" msgstr "Sowohl RX als auch TX sind zu Flusssteuerung erforderlich" -#: ports/atmel-samd/boards/circuitplayground_express/mpconfigboard.h -#: ports/atmel-samd/boards/circuitplayground_express_crickit/mpconfigboard.h -#: ports/atmel-samd/boards/circuitplayground_express_displayio/mpconfigboard.h -#: ports/atmel-samd/boards/meowmeow/mpconfigboard.h -msgid "Both buttons were pressed at start up.\n" -msgstr "Beim Starten wurden beide Tasten gedrückt.\n" - #: ports/atmel-samd/common-hal/rotaryio/IncrementalEncoder.c msgid "Both pins must support hardware interrupts" msgstr "Beide Pins müssen Hardware-Interrupts unterstützen" @@ -663,11 +670,6 @@ msgstr "Buffers müssen gleiche Größe haben" msgid "Bus pin %d is already in use" msgstr "Bus-Pin %d wird schon benutzt" -#: ports/espressif/boards/m5stack_core_basic/mpconfigboard.h -#: ports/espressif/boards/m5stack_core_fire/mpconfigboard.h -msgid "Button A was pressed at start up.\n" -msgstr "Beim Starten wurde Taste A gedrückt.\n" - #: shared-bindings/_bleio/UUID.c msgid "Byte buffer must be 16 bytes." msgstr "Der Puffer muss 16 Bytes lang sein." @@ -803,10 +805,6 @@ msgstr "Schreiben von CharacteristicBuffer ist nicht vorgesehen" msgid "CircuitPython core code crashed hard. Whoops!\n" msgstr "Der CircuitPython-Kerncode ist hart abgestürzt. Hoppla!\n" -#: supervisor/shared/safe_mode.c -msgid "CircuitPython was unable to allocate the heap." -msgstr "CircuitPython war es nicht möglich heap-Speicher zu allozieren." - #: shared-module/bitbangio/I2C.c msgid "Clock stretch too long" msgstr "Clock stretch zu lang" @@ -847,10 +845,6 @@ msgstr "Interrupt konnte nicht gestartet werden, RX beschäftigt" msgid "Couldn't allocate decoder" msgstr "Decoder konnte nicht zugeordnet werden" -#: 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" @@ -913,6 +907,12 @@ msgstr "Fertig" msgid "Drive mode not used when direction is input." msgstr "Drive mode wird nicht verwendet, wenn die Richtung input ist." +#: py/obj.c +msgid "During handling of the above exception, another exception occurred:" +msgstr "" +"Während der Behandlung der oben genannten Ausnahme trat eine weitere " +"Ausnahme auf:" + #: shared-bindings/aesio/aes.c msgid "ECB only operates on 16 bytes at a time" msgstr "Die EZB arbeitet jeweils nur mit 16 Bytes" @@ -938,25 +938,17 @@ msgstr "Fehler in MIDI Datenstrom um Position %d" msgid "Error in regex" msgstr "Fehler in regex" +#: supervisor/shared/safe_mode.c +msgid "Error in safemode.py." +msgstr "" + #: shared-bindings/socketpool/Socket.c shared-bindings/ssl/SSLSocket.c msgid "Error: Failure to bind" msgstr "Error: Bind Fehler" -#: py/enum.c shared-bindings/_bleio/__init__.c shared-bindings/aesio/aes.c -#: shared-bindings/alarm/__init__.c shared-bindings/alarm/coproc/CoprocAlarm.c -#: shared-bindings/busio/SPI.c shared-bindings/coproc/Coproc.c -#: shared-bindings/coproc/__init__.c shared-bindings/microcontroller/Pin.c -#: shared-bindings/neopixel_write/__init__.c -msgid "Expected a %q" -msgstr "Erwartet ein(e) %q" - -#: ports/raspberrypi/bindings/cyw43/__init__.c -msgid "Expected a %q or %q" -msgstr "Erwartete ein %q oder %q" - #: shared-bindings/alarm/__init__.c -msgid "Expected an %q" -msgstr "Erwartet ein %q" +msgid "Expected a kind of %q" +msgstr "Erwartete eine Art von %q" #: ports/espressif/common-hal/_bleio/Adapter.c #: ports/nrf/common-hal/_bleio/Adapter.c @@ -1024,13 +1016,17 @@ msgid "Failed to write internal flash." msgstr "Interner Flash konnte nicht geschrieben werden." #: supervisor/shared/safe_mode.c -msgid "Fatal error." -msgstr "Fataler Fehler." +msgid "Fault detected by hardware." +msgstr "" #: py/moduerrno.c msgid "File exists" msgstr "Datei existiert" +#: shared-module/os/getenv.c +msgid "File not found" +msgstr "Datei nicht gefunden" + #: ports/atmel-samd/common-hal/canio/Listener.c #: ports/espressif/common-hal/canio/Listener.c #: ports/stm/common-hal/canio/Listener.c @@ -1045,7 +1041,6 @@ msgstr "Die Firmware ist doppelt vorhanden" msgid "Firmware is invalid" msgstr "Die Firmware ist ungültig" -#: ports/espressif/common-hal/coproc/Coproc.c #: ports/espressif/common-hal/dualbank/__init__.c msgid "Firmware is too big" msgstr "Die Firmware ist zu groß" @@ -1091,6 +1086,8 @@ msgstr "Generischer Fehler" #: shared-bindings/displayio/Display.c #: shared-bindings/displayio/EPaperDisplay.c #: shared-bindings/framebufferio/FramebufferDisplay.c +#: shared-module/displayio/Display.c +#: shared-module/framebufferio/FramebufferDisplay.c msgid "Group already used" msgstr "Gruppe schon benutzt" @@ -1111,6 +1108,15 @@ msgstr "Hardware beschäftigt, versuche alternative Pins" msgid "Hardware in use, try alternative pins" msgstr "Hardware in Benutzung, probiere alternative Pins" +#: supervisor/shared/safe_mode.c +msgid "Heap allocation when VM not running." +msgstr "" + +#: supervisor/shared/safe_mode.c +msgid "" +"Heap was corrupted because the stack was too small. Increase stack size." +msgstr "" + #: extmod/vfs_posix_file.c py/objstringio.c msgid "I/O operation on closed file" msgstr "Lese/Schreibe-operation an geschlossener Datei" @@ -1128,11 +1134,6 @@ msgstr "I2C Peripherie in Verwendung" msgid "I2SOut not available" msgstr "I2SOut nicht verfügbar" -#: shared-bindings/aesio/aes.c -#, c-format -msgid "IV must be %d bytes long" -msgstr "IV muss %d Bytes lang sein" - #: ports/raspberrypi/bindings/rp2pio/StateMachine.c msgid "In-buffer elements must be <= 4 bytes long" msgstr "In-Puffer-Elemente müssen <= 4 Bytes lang sein" @@ -1223,6 +1224,7 @@ msgid "Internal define error" msgstr "Interner Definitionsfehler" #: ports/espressif/common-hal/paralleldisplay/ParallelBus.c +#: shared-module/os/getenv.c msgid "Internal error" msgstr "Interner Fehler" @@ -1235,6 +1237,10 @@ msgstr "Interner Fehler #%d" msgid "Internal watchdog timer expired." msgstr "Der Interne WatchDog Timer ist abgelaufen." +#: supervisor/shared/safe_mode.c +msgid "Interrupt error." +msgstr "" + #: py/argcheck.c shared-bindings/digitalio/DigitalInOut.c msgid "Invalid %q" msgstr "Ungültiger %q" @@ -1269,6 +1275,11 @@ msgstr "Ungültiges Argument" msgid "Invalid bits per value" msgstr "Ungültige Bits pro Wert" +#: shared-module/os/getenv.c +#, c-format +msgid "Invalid byte %.*s" +msgstr "Ungültiges Byte %.*s" + #: ports/atmel-samd/common-hal/imagecapture/ParallelImageCapture.c #, c-format msgid "Invalid data_pins[%d]" @@ -1278,18 +1289,10 @@ msgstr "Ungültige data_pins[%d]" msgid "Invalid format chunk size" msgstr "Ungültige format chunk size" -#: supervisor/shared/safe_mode.c -msgid "Invalid memory access." -msgstr "Ungültiger Speicherzugriff." - #: ports/espressif/common-hal/wifi/Radio.c msgid "Invalid multicast MAC address" msgstr "Ungültige Multicast-MAC-Adresse" -#: shared-bindings/busio/UART.c -msgid "Invalid pins" -msgstr "Ungültige Pins" - #: ports/espressif/common-hal/espidf/__init__.c ports/espressif/esp_error.c msgid "Invalid size" msgstr "Ungültige Größe" @@ -1303,10 +1306,18 @@ msgstr "Ungültiges Socket für TLS" msgid "Invalid state" msgstr "Ungültiger Zustand" +#: shared-module/os/getenv.c +msgid "Invalid unicode escape" +msgstr "" + #: 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" +#: shared-module/os/getenv.c +msgid "Key not found" +msgstr "Schlüssel nicht gefunden" + #: shared-module/is31fl3741/FrameBuffer.c msgid "LED mappings must match display size" msgstr "LED-Zuordnungen müssen der Display-Größe entsprechen" @@ -1414,6 +1425,10 @@ msgstr "NLR-Sprung fehlgeschlagen. Mögliche Speicher-Beschädigung." msgid "NVS Error" msgstr "NVS-Fehler" +#: shared-bindings/socketpool/SocketPool.c +msgid "Name or service not known" +msgstr "Name oder Dienst nicht bekannt" + #: py/qstr.c msgid "Name too long" msgstr "Name zu lang" @@ -1528,11 +1543,6 @@ msgstr "Es wurde kein Schlüssel angegeben" msgid "No long integer support" msgstr "Keine langen Integer (long) unterstützt" -#: shared-module/usb_hid/__init__.c -#, c-format -msgid "No more than %d HID devices allowed" -msgstr "Keine weiteren %d HID-Geräte zulässig" - #: shared-bindings/wifi/Radio.c msgid "No network with that ssid" msgstr "Kein Netzwerk mit dieser SSID" @@ -1568,10 +1578,6 @@ msgstr "Keine solche Datei/Verzeichnis" msgid "No timer available" msgstr "Kein Timer verfügbar" -#: supervisor/shared/safe_mode.c -msgid "Nordic system firmware failure assertion." -msgstr "Nordic System-Firmware Fehler Assertion." - #: ports/nrf/common-hal/_bleio/__init__.c msgid "Nordic system firmware out of memory" msgstr "Nordic System-Firmware kein Speicher verfügbar" @@ -1591,10 +1597,6 @@ msgstr "Nicht verbunden" msgid "Not playing" msgstr "Spielt nicht ab" -#: shared-bindings/_bleio/__init__.c -msgid "Not settable" -msgstr "Kann nicht gesetzt werden" - #: ports/espressif/common-hal/paralleldisplay/ParallelBus.c #, c-format msgid "Number of data_pins must be 8 or 16, not %d" @@ -1663,11 +1665,14 @@ msgstr "" "Nur monochrome, indizierte 4bpp oder 8bpp, und 16bpp oder größere BMPs " "unterstützt: %d bpp wurden gegeben" -#: ports/espressif/common-hal/alarm/coproc/CoprocAlarm.c #: ports/espressif/common-hal/alarm/touch/TouchAlarm.c msgid "Only one %q can be set in deep sleep." msgstr "Nur ein %q kann im Deep-Sleep gesetzt werden." +#: ports/espressif/common-hal/espulp/ULPAlarm.c +msgid "Only one %q can be set." +msgstr "Es kann nur ein %q festgelegt werden." + #: ports/espressif/common-hal/i2ctarget/I2CTarget.c #: ports/raspberrypi/common-hal/i2ctarget/I2CTarget.c msgid "Only one address is allowed" @@ -1700,6 +1705,10 @@ msgstr "Vorgang oder Funktion wird nicht unterstützt" msgid "Operation timed out" msgstr "Zeit für Vorgang abgelaufen" +#: ports/raspberrypi/common-hal/mdns/Server.c +msgid "Out of MDNS service slots" +msgstr "" + #: ports/espressif/common-hal/espidf/__init__.c ports/espressif/esp_error.c msgid "Out of memory" msgstr "Kein Speicher mehr verfügbar" @@ -1829,6 +1838,10 @@ msgstr "Programm macht OUT ohne Laden von OSR" msgid "Program size invalid" msgstr "Programm-Größe ist ungültig" +#: ports/espressif/common-hal/espulp/ULP.c +msgid "Program too long" +msgstr "Programm zu lang" + #: shared-bindings/digitalio/DigitalInOut.c msgid "Pull not used when direction is output." msgstr "Pull wird nicht verwendet, wenn die Richtung output ist." @@ -1868,8 +1881,9 @@ msgstr "Eine RTC wird auf diesem Board nicht unterstützt" msgid "Random number generation error" msgstr "Fehler bei der Erzeugung von Zufallszahlen" +#: shared-bindings/_bleio/__init__.c #: shared-bindings/memorymonitor/AllocationSize.c -#: shared-bindings/pulseio/PulseIn.c +#: shared-bindings/pulseio/PulseIn.c shared-module/displayio/Bitmap.c msgid "Read-only" msgstr "Nur lesen möglich, da Schreibgeschützt" @@ -1877,10 +1891,6 @@ msgstr "Nur lesen möglich, da Schreibgeschützt" msgid "Read-only filesystem" msgstr "Schreibgeschützte Dateisystem" -#: shared-module/displayio/Bitmap.c -msgid "Read-only object" -msgstr "Schreibgeschützte Objekt" - #: ports/espressif/common-hal/espidf/__init__.c ports/espressif/esp_error.c msgid "Received response was invalid" msgstr "Erhaltene Antwort ist ungültig" @@ -1973,7 +1983,7 @@ msgstr "Größe nicht unterstützt" msgid "Sleep Memory not available" msgstr "Sleep-Speicher nicht verfügbar" -#: shared-bindings/alarm/SleepMemory.c shared-bindings/coproc/CoprocMemory.c +#: shared-bindings/alarm/SleepMemory.c shared-bindings/memorymap/AddressRange.c #: shared-bindings/nvm/ByteArray.c msgid "Slice and value different lengths." msgstr "Slice und Wert (value) haben unterschiedliche Längen." @@ -2010,6 +2020,10 @@ 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" +#: ports/raspberrypi/common-hal/wifi/Radio.c +msgid "Stopping AP is not supported." +msgstr "" + #: ports/mimxrt10xx/common-hal/busio/UART.c ports/stm/common-hal/busio/UART.c msgid "Supply at least one UART pin" msgstr "Gib mindestens einen UART-Pin an" @@ -2027,54 +2041,21 @@ msgid "Temperature read timed out" msgstr "Zeitüberschreitung beim Auslesen der Temperatur" #: supervisor/shared/safe_mode.c -msgid "The BOOT button was pressed at start up.\n" -msgstr "Beim Starten wurde die Taste BOOT gedrückt.\n" - -#: supervisor/shared/safe_mode.c -msgid "" -"The CircuitPython heap was corrupted because the stack was too small.\n" -"Increase the stack size if you know how. If not:" +msgid "The `microcontroller` module was used to boot into safe mode." msgstr "" -"Der Heap von CircuitPython wurde beschädigt, weil der Stack zu klein war.\n" -"Vergrößere den Stack, wenn du weißt, wie. Wenn nicht:" -#: ports/espressif/boards/adafruit_feather_esp32_v2/mpconfigboard.h -msgid "The SW38 button was pressed at start up.\n" -msgstr "Beim Starten wurde die Taste SW38 gedrückt.\n" - -#: ports/espressif/boards/hardkernel_odroid_go/mpconfigboard.h -msgid "The VOLUME button was pressed at start up.\n" -msgstr "Beim Starten wurde die Taste VOLUME gedrückt.\n" - -#: supervisor/shared/safe_mode.c -msgid "" -"The `microcontroller` module was used to boot into safe mode. Press reset to " -"exit safe mode." +#: py/obj.c +msgid "The above exception was the direct cause of the following exception:" msgstr "" -"Das Modul `microcontroller` wurde zum Booten in den abgesicherten Modus " -"verwendet. Drücke Reset, um den abgesicherten Modus zu verlassen." - -#: ports/espressif/boards/m5stack_atom_lite/mpconfigboard.h -msgid "The central button was pressed at start up.\n" -msgstr "Beim Starten wurde die zentrale Taste gedrückt.\n" - -#: ports/nrf/boards/aramcon2_badge/mpconfigboard.h -msgid "The left button was pressed at start up.\n" -msgstr "Beim Starten wurde die linke Taste gedrückt.\n" +"Die oben genannte Ausnahme war die direkte Ursache für die folgende Ausnahme:" #: shared-bindings/rgbmatrix/RGBMatrix.c msgid "The length of rgb_pins must be 6, 12, 18, 24, or 30" msgstr "Die Länge von rgb_pins muss 6, 12, 18, 24 oder 30 betragen" #: supervisor/shared/safe_mode.c -msgid "" -"The microcontroller's power dipped. Make sure your power supply provides\n" -"enough power for the whole circuit and press reset (after ejecting " -"CIRCUITPY)." +msgid "The power dipped. Make sure you are providing enough power." msgstr "" -"Der Mikrocontroller hatte einen Stromausfall. Vergewisser dich, dass die\n" -"Stromversorgung genügend Strom für die gesamte Schaltung liefert und\n" -"drücke Reset (nach dem Auswerfen von CIRCUITPY)." #: shared-module/audiomixer/MixerVoice.c msgid "The sample's bits_per_sample does not match the mixer's" @@ -2094,6 +2075,10 @@ msgid "The sample's signedness does not match the mixer's" msgstr "" "Die Art des Vorzeichens des Samples stimmt nicht mit dem des Mixers überein" +#: supervisor/shared/safe_mode.c +msgid "Third-party firmware fatal error." +msgstr "" + #: shared-module/imagecapture/ParallelImageCapture.c msgid "This microcontroller does not support continuous capture." msgstr "Dieser Mikrocontroller unterstützt keine kontinuierliche Erfassung." @@ -2129,12 +2114,6 @@ msgid "Timeout is too long: Maximum timeout length is %d seconds" msgstr "" "Zeitbeschränkung ist zu groß: Maximale Zeitbeschränkung ist %d Sekunden" -#: supervisor/shared/safe_mode.c -msgid "To exit, please reset the board without requesting safe mode." -msgstr "" -"Zum Beenden setze bitte das Board zurück, ohne den abgesicherten Modus " -"aufzurufen." - #: ports/atmel-samd/common-hal/audiobusio/I2SOut.c msgid "Too many channels in sample" msgstr "Zu viele Kanäle im Beispiel" @@ -2179,6 +2158,10 @@ msgstr "UART wird de-initialisiert" msgid "UART init" msgstr "UART-Initialisierung" +#: ports/raspberrypi/common-hal/busio/UART.c +msgid "UART peripheral in use" +msgstr "" + #: ports/stm/common-hal/busio/UART.c msgid "UART re-init" msgstr "UART wird erneut Initialisiert" @@ -2226,6 +2209,10 @@ msgstr "Der UUID-Wert ist kein str-, int- oder Byte-Puffer" msgid "Unable to allocate buffers for signed conversion" msgstr "Konnte keine Buffer für Vorzeichenumwandlung allozieren" +#: supervisor/shared/safe_mode.c +msgid "Unable to allocate the heap." +msgstr "" + #: ports/espressif/common-hal/busio/I2C.c msgid "Unable to create lock" msgstr "Lock kann nicht erzeugt werden" @@ -2249,12 +2236,13 @@ msgid "Unable to read color palette data" msgstr "Konnte Farbpalettendaten nicht lesen" #: ports/espressif/common-hal/mdns/Server.c +#: ports/raspberrypi/common-hal/mdns/Server.c msgid "Unable to start mDNS query" msgstr "mDNS-Abfrage kann nicht gestartet werden" -#: shared-bindings/coproc/CoprocMemory.c -msgid "Unable to write" -msgstr "Schreiben nicht möglich" +#: shared-bindings/memorymap/AddressRange.c +msgid "Unable to write to address." +msgstr "An die Adresse kann nicht geschrieben werden." #: shared-bindings/nvm/ByteArray.c msgid "Unable to write to nvm." @@ -2324,6 +2312,7 @@ msgid "Unkown error code %d" msgstr "Unbekannter Fehlercode %d" #: shared-bindings/adafruit_pixelbuf/PixelBuf.c +#: shared-module/_pixelmap/PixelMap.c #, c-format msgid "Unmatched number of items on RHS (expected %d, got %d)." msgstr "" @@ -2422,6 +2411,18 @@ msgstr "" msgid "Wi-Fi: " msgstr "Wi-Fi: " +#: ports/raspberrypi/common-hal/wifi/Radio.c +msgid "Wifi is in access point mode." +msgstr "" + +#: ports/raspberrypi/common-hal/wifi/Radio.c +msgid "Wifi is in station mode." +msgstr "" + +#: ports/raspberrypi/common-hal/wifi/Radio.c +msgid "Wifi is not enabled" +msgstr "WLAN ist nicht aktiviert" + #: main.c msgid "Woken up by alarm.\n" msgstr "Aufgeweckt durch Alarm.\n" @@ -2431,16 +2432,49 @@ msgstr "Aufgeweckt durch Alarm.\n" msgid "Writes not supported on Characteristic" msgstr "Schreiben nicht unterstüzt für diese Charakteristik" -#: supervisor/shared/safe_mode.c -msgid "You are in safe mode because:\n" -msgstr "Du befindest dich im abgesicherten Modus, weil:\n" +#: ports/atmel-samd/boards/circuitplayground_express/mpconfigboard.h +#: ports/atmel-samd/boards/circuitplayground_express_crickit/mpconfigboard.h +#: ports/atmel-samd/boards/circuitplayground_express_displayio/mpconfigboard.h +#: ports/atmel-samd/boards/meowmeow/mpconfigboard.h +msgid "You pressed both buttons at start up." +msgstr "" + +#: ports/espressif/boards/m5stack_core_basic/mpconfigboard.h +#: ports/espressif/boards/m5stack_core_fire/mpconfigboard.h +#: ports/espressif/boards/m5stack_stick_c/mpconfigboard.h +msgid "You pressed button A at start up." +msgstr "" #: supervisor/shared/safe_mode.c -msgid "" -"You pressed the reset button during boot. Press again to exit safe mode." +msgid "You pressed the BOOT button at start up" +msgstr "" + +#: ports/espressif/boards/adafruit_feather_esp32_v2/mpconfigboard.h +msgid "You pressed the SW38 button at start up." +msgstr "" + +#: ports/espressif/boards/hardkernel_odroid_go/mpconfigboard.h +msgid "You pressed the VOLUME button at start up." +msgstr "" + +#: ports/espressif/boards/m5stack_atom_echo/mpconfigboard.h +#: ports/espressif/boards/m5stack_atom_lite/mpconfigboard.h +#: ports/espressif/boards/m5stack_atom_matrix/mpconfigboard.h +#: ports/espressif/boards/m5stack_atom_u/mpconfigboard.h +msgid "You pressed the central button at start up." +msgstr "" + +#: ports/nrf/boards/aramcon2_badge/mpconfigboard.h +msgid "You pressed the left button at start up." +msgstr "" + +#: supervisor/shared/safe_mode.c +msgid "You pressed the reset button during boot." +msgstr "" + +#: supervisor/shared/micropython.c +msgid "[truncated due to length]" msgstr "" -"Du hast beim Booten die Reset-Taste gedrückt. Drücke sie erneut, um den " -"abgesicherten Modus zu beenden." #: py/objtype.c msgid "__init__() should return None" @@ -2511,8 +2545,12 @@ msgstr "Array- und Indexlänge müssen gleich sein" msgid "array has too many dimensions" msgstr "Das Array hat zu viele Dimensionen" +#: extmod/ulab/code/ndarray.c +msgid "array is too big" +msgstr "" + #: py/objarray.c shared-bindings/alarm/SleepMemory.c -#: shared-bindings/coproc/CoprocMemory.c shared-bindings/nvm/ByteArray.c +#: shared-bindings/memorymap/AddressRange.c shared-bindings/nvm/ByteArray.c msgid "array/bytes required on right side" msgstr "Array/Bytes auf der rechten Seite erforderlich" @@ -2605,10 +2643,6 @@ msgstr "Der Puffer ist zu klein" msgid "buffer too small for requested bytes" msgstr "Der Puffer ist zu klein für die angefragten Bytes" -#: shared-bindings/adafruit_pixelbuf/PixelBuf.c -msgid "byteorder is not a string" -msgstr "Byteorder ist kein String" - #: py/objarray.c msgid "bytes length not a multiple of item size" msgstr "Byte-Länge ist kein vielfaches der Item-Größe" @@ -2652,14 +2686,10 @@ msgstr "kann keinem Ausdruck zuweisen" msgid "can't cancel self" msgstr "kann self nicht abbrechen" -#: py/obj.c py/objint.c shared-module/adafruit_pixelbuf/PixelBuf.c +#: py/obj.c py/objint.c py/runtime.c shared-module/adafruit_pixelbuf/PixelBuf.c msgid "can't convert %q to %q" msgstr "kann %q nicht zu %q konvertieren" -#: py/runtime.c -msgid "can't convert %q to int" -msgstr "kann %q nicht nach int konvertieren" - #: py/obj.c #, c-format msgid "can't convert %s to complex" @@ -2743,6 +2773,10 @@ msgstr "Kann Blockgröße von 512 nicht setzen" msgid "can't set attribute" msgstr "kann Attribut nicht setzen" +#: py/runtime.c +msgid "can't set attribute '%q'" +msgstr "" + #: py/emitnative.c msgid "can't store '%q'" msgstr "Speichern von '%q' nicht möglich" @@ -2851,10 +2885,6 @@ msgstr "Farbe muss zwischen 0x000000 und 0xffffff liegen" msgid "comparison of int and uint" msgstr "Vergleich von int und uint" -#: py/objcomplex.c -msgid "complex division by zero" -msgstr "Komplexe Division durch null" - #: py/objfloat.c py/parsenum.c msgid "complex values not supported" msgstr "Komplexe Zahlen nicht unterstützt" @@ -2959,12 +2989,11 @@ msgstr "Abmessungen stimmen nicht überein" msgid "div/mod not implemented for uint" msgstr "div/mod für uint nicht implementiert" -#: py/objfloat.c py/objint_mpz.c +#: extmod/ulab/code/numpy/create.c msgid "divide by zero" msgstr "durch Null dividieren" -#: py/modmath.c py/objint_longlong.c py/runtime.c -#: shared-bindings/math/__init__.c +#: py/runtime.c msgid "division by zero" msgstr "Division durch Null" @@ -3005,26 +3034,16 @@ msgstr "epoch_time wird auf diesem Board nicht unterstützt" msgid "error = 0x%08lX" msgstr "Fehler = 0x%08lX" -#: ports/espressif/common-hal/esp32_camera/Camera.c +#: ports/espressif/common-hal/espcamera/Camera.c msgid "" -"esp32_camera.Camera requires reserved PSRAM to be configured. See the " +"espcamera.Camera requires reserved PSRAM to be configured. See the " "documentation for instructions." msgstr "" -"esp32_camera.Camera benötigt reservierten PSRAM um konfiguriert werden zu " -"können. Sieh in der Dokumentation für eine Anleitung nach." #: py/runtime.c msgid "exceptions must derive from BaseException" msgstr "Exceptions müssen von BaseException abgeleitet sein" -#: shared-bindings/canio/CAN.c -msgid "expected '%q' but got '%q'" -msgstr "erwartet '%q' aber bekommen '%q'" - -#: shared-bindings/canio/CAN.c -msgid "expected '%q' or '%q' but got '%q'" -msgstr "erwartete '%q' oder '%q', aber bekam '%q'" - #: py/objstr.c msgid "expected ':' after format specifier" msgstr "erwarte ':' nach format specifier" @@ -3123,10 +3142,6 @@ msgstr "Die Schriftart (font) muss 2048 Byte lang sein" msgid "format requires a dict" msgstr "Format erfordert ein Wörterbuch (dict)" -#: shared-bindings/microcontroller/Processor.c -msgid "frequency is read-only for this board" -msgstr "Frequenz ist für dieses Board schreibgeschützt" - #: py/objdeque.c msgid "full" msgstr "voll" @@ -3241,8 +3256,12 @@ msgstr "padding ist inkorrekt" msgid "index is out of bounds" msgstr "Index ist außerhalb der Grenzen" +#: shared-bindings/_pixelmap/PixelMap.c +msgid "index must be tuple or int" +msgstr "" + #: extmod/ulab/code/numpy/numerical.c extmod/ulab/code/ulab_tools.c -#: ports/espressif/common-hal/pulseio/PulseIn.c py/obj.c +#: ports/espressif/common-hal/pulseio/PulseIn.c #: shared-bindings/bitmaptools/__init__.c msgid "index out of range" msgstr "index außerhalb der Reichweite" @@ -3340,10 +3359,6 @@ msgstr "Eingabevektoren müssen gleich lang sein" msgid "inputs are not iterable" msgstr "Eingaben sind nicht iterierbar" -#: py/parsenum.c -msgid "int() arg 2 must be >= 2 and <= 36" -msgstr "int() arg 2 muss >= 2 und <= 36 sein" - #: extmod/ulab/code/numpy/approx.c msgid "interp is defined for 1D iterables of equal length" msgstr "interp ist für 1D-Iterables gleicher Länge definiert" @@ -3400,7 +3415,7 @@ msgstr "ungültiger Schlüssel" msgid "invalid micropython decorator" msgstr "ungültiger micropython decorator" -#: ports/espressif/common-hal/esp32_camera/Camera.c +#: ports/espressif/common-hal/espcamera/Camera.c msgid "invalid setting" msgstr "Invalide Einstellung" @@ -3425,10 +3440,6 @@ msgstr "ungültige Syntax für integer mit Basis %d" msgid "invalid syntax for number" msgstr "ungültige Syntax für number" -#: py/objexcept.c -msgid "invalid traceback" -msgstr "ungültiger Traceback" - #: py/objtype.c msgid "issubclass() arg 1 must be a class" msgstr "issubclass() arg 1 muss eine Klasse sein" @@ -3491,19 +3502,17 @@ msgstr "" "Es wurde versucht auf eine Variable zuzugreifen, die es (noch) nicht gibt. " "Variablen immer zuerst Zuweisen" -#: py/objint.c -msgid "long int not supported in this build" -msgstr "long int wird in diesem Build nicht unterstützt" - #: ports/espressif/common-hal/canio/CAN.c msgid "loopback + silent mode not supported by peripheral" msgstr "Loopback + Silent Mode wird vom Peripheriegerät nicht unterstützt" #: ports/espressif/common-hal/mdns/Server.c +#: ports/raspberrypi/common-hal/mdns/Server.c msgid "mDNS already initialized" msgstr "mDNS bereits initialisiert" #: ports/espressif/common-hal/mdns/Server.c +#: ports/raspberrypi/common-hal/mdns/Server.c msgid "mDNS only works with built-in WiFi" msgstr "mDNS funktioniert nur mit integriertem WiFi" @@ -3632,6 +3641,10 @@ msgstr "negative Potenz ohne Gleitkomma (float) Unterstützung" msgid "negative shift count" msgstr "Negative shift Anzahl" +#: shared-bindings/_pixelmap/PixelMap.c +msgid "nested index must be int" +msgstr "" + #: shared-module/sdcardio/SDCard.c msgid "no SD card" msgstr "keine SD-Karte" @@ -3665,7 +3678,7 @@ msgstr "kein Reset Pin verfügbar" msgid "no response from SD card" msgstr "keine Antwort von der SD-Karte" -#: ports/espressif/common-hal/esp32_camera/Camera.c py/objobject.c py/runtime.c +#: ports/espressif/common-hal/espcamera/Camera.c py/objobject.c py/runtime.c msgid "no such attribute" msgstr "kein solches Attribut" @@ -3801,6 +3814,10 @@ msgstr "nur eine bit_depth=16 wird unterstützt" #: ports/stm/common-hal/audiobusio/PDMIn.c msgid "only mono is supported" +msgstr "nur Mono wird unterstützt" + +#: extmod/ulab/code/numpy/create.c +msgid "only ndarrays can be concatenated" msgstr "" #: ports/stm/common-hal/audiobusio/PDMIn.c @@ -3813,7 +3830,7 @@ msgid "only sample_rate=16000 is supported" msgstr "nur eine sample_rate=16000 wird unterstützt" #: py/objarray.c py/objstr.c py/objstrunicode.c py/objtuple.c -#: shared-bindings/alarm/SleepMemory.c shared-bindings/coproc/CoprocMemory.c +#: shared-bindings/alarm/SleepMemory.c shared-bindings/memorymap/AddressRange.c #: shared-bindings/nvm/ByteArray.c msgid "only slices with step=1 (aka None) are supported" msgstr "" @@ -4032,10 +4049,6 @@ msgstr "Die Schlafdauer darf nicht negativ sein" msgid "slice step can't be zero" msgstr "Slice-Schritt darf nicht Null sein" -#: py/objslice.c -msgid "slice step cannot be zero" -msgstr "Der Slice-Schritt kann nicht Null sein" - #: py/nativeglue.c msgid "slice unsupported" msgstr "Slice nicht unterstützt" @@ -4084,10 +4097,6 @@ msgstr "source_bitmap muss value_count von 8 haben" msgid "start/end indices" msgstr "start/end Indizes" -#: shared-bindings/random/__init__.c -msgid "step must be non-zero" -msgstr "Schritt (step) darf nicht Null sein" - #: shared-bindings/random/__init__.c msgid "stop not reachable from start" msgstr "stop ist von start aus nicht erreichbar" @@ -4096,10 +4105,6 @@ msgstr "stop ist von start aus nicht erreichbar" msgid "stream operation not supported" msgstr "stream operation ist nicht unterstützt" -#: py/objstrunicode.c -msgid "string indices must be integers, not %q" -msgstr "String Indizes müssen Integer sein, nicht %q" - #: py/stream.c msgid "string not supported; use bytes or bytearray" msgstr "Zeichenfolgen werden nicht unterstützt; verwende bytes oder bytearray" @@ -4132,10 +4137,6 @@ msgstr "Syntaxfehler in JSON" msgid "syntax error in uctypes descriptor" msgstr "Syntaxfehler in uctypes Deskriptor" -#: shared-bindings/time/__init__.c -msgid "time.struct_time() takes a 9-sequence" -msgstr "time.struct_time() nimmt eine 9-Sequenz an" - #: ports/atmel-samd/common-hal/watchdog/WatchDogTimer.c #: ports/espressif/common-hal/watchdog/WatchDogTimer.c #: ports/nrf/common-hal/watchdog/WatchDogTimer.c @@ -4419,10 +4420,6 @@ msgstr "xTaskCreate fehlgeschlagen" msgid "y value out of bounds" msgstr "y Wert außerhalb der Grenzen" -#: py/objrange.c -msgid "zero step" -msgstr "Nullschritt" - #: extmod/ulab/code/scipy/signal/signal.c msgid "zi must be an ndarray" msgstr "zi muss ein ndarray sein" @@ -4435,6 +4432,194 @@ 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 "" +#~ "\n" +#~ "Please file an issue with the contents of your CIRCUITPY drive at \n" +#~ "https://github.com/adafruit/circuitpython/issues\n" +#~ msgstr "" +#~ "\n" +#~ "Bitte melde ein Problem mit dem Inhalt Ihres CIRCUITPY-Laufwerks unter\n" +#~ "https://github.com/adafruit/circuitpython/issues\n" + +#~ msgid "Attempted heap allocation when VM not running." +#~ msgstr "Versuchte Heap-Zuordnung wenn VM nicht läuft." + +#~ msgid "Boot device must be first device (interface #0)." +#~ msgstr "Boot-Gerät muss erstes Gerät sein (interface #0)." + +#~ msgid "Both buttons were pressed at start up.\n" +#~ msgstr "Beim Starten wurden beide Tasten gedrückt.\n" + +#~ msgid "Button A was pressed at start up.\n" +#~ msgstr "Beim Starten wurde Taste A gedrückt.\n" + +#~ msgid "CircuitPython was unable to allocate the heap." +#~ msgstr "CircuitPython war es nicht möglich heap-Speicher zu allozieren." + +#~ msgid "Crash into the HardFault_Handler." +#~ msgstr "Absturz in den HardFault_Handler." + +#~ msgid "Fatal error." +#~ msgstr "Fataler Fehler." + +#~ msgid "Invalid memory access." +#~ msgstr "Ungültiger Speicherzugriff." + +#~ msgid "Nordic system firmware failure assertion." +#~ msgstr "Nordic System-Firmware Fehler Assertion." + +#~ msgid "The BOOT button was pressed at start up.\n" +#~ msgstr "Beim Starten wurde die Taste BOOT gedrückt.\n" + +#~ msgid "" +#~ "The CircuitPython heap was corrupted because the stack was too small.\n" +#~ "Increase the stack size if you know how. If not:" +#~ msgstr "" +#~ "Der Heap von CircuitPython wurde beschädigt, weil der Stack zu klein " +#~ "war.\n" +#~ "Vergrößere den Stack, wenn du weißt, wie. Wenn nicht:" + +#~ msgid "The SW38 button was pressed at start up.\n" +#~ msgstr "Beim Starten wurde die Taste SW38 gedrückt.\n" + +#~ msgid "The VOLUME button was pressed at start up.\n" +#~ msgstr "Beim Starten wurde die Taste VOLUME gedrückt.\n" + +#~ msgid "" +#~ "The `microcontroller` module was used to boot into safe mode. Press reset " +#~ "to exit safe mode." +#~ msgstr "" +#~ "Das Modul `microcontroller` wurde zum Booten in den abgesicherten Modus " +#~ "verwendet. Drücke Reset, um den abgesicherten Modus zu verlassen." + +#~ msgid "The central button was pressed at start up.\n" +#~ msgstr "Beim Starten wurde die zentrale Taste gedrückt.\n" + +#~ msgid "The left button was pressed at start up.\n" +#~ msgstr "Beim Starten wurde die linke Taste gedrückt.\n" + +#~ msgid "" +#~ "The microcontroller's power dipped. Make sure your power supply provides\n" +#~ "enough power for the whole circuit and press reset (after ejecting " +#~ "CIRCUITPY)." +#~ msgstr "" +#~ "Der Mikrocontroller hatte einen Stromausfall. Vergewisser dich, dass die\n" +#~ "Stromversorgung genügend Strom für die gesamte Schaltung liefert und\n" +#~ "drücke Reset (nach dem Auswerfen von CIRCUITPY)." + +#~ msgid "To exit, please reset the board without requesting safe mode." +#~ msgstr "" +#~ "Zum Beenden setze bitte das Board zurück, ohne den abgesicherten Modus " +#~ "aufzurufen." + +#~ msgid "You are in safe mode because:\n" +#~ msgstr "Du befindest dich im abgesicherten Modus, weil:\n" + +#~ msgid "" +#~ "You pressed the reset button during boot. Press again to exit safe mode." +#~ msgstr "" +#~ "Du hast beim Booten die Reset-Taste gedrückt. Drücke sie erneut, um den " +#~ "abgesicherten Modus zu beenden." + +#~ msgid "" +#~ "esp32_camera.Camera requires reserved PSRAM to be configured. See the " +#~ "documentation for instructions." +#~ msgstr "" +#~ "esp32_camera.Camera benötigt reservierten PSRAM um konfiguriert werden zu " +#~ "können. Sieh in der Dokumentation für eine Anleitung nach." + +#~ msgid "%q must be of type %q" +#~ msgstr "%q muss vom Type %q sein" + +#~ msgid "%q must be of type %q or None" +#~ msgstr "%q muss vom Type %q oder None sein" + +#~ msgid "Expected a %q" +#~ msgstr "Erwartet ein(e) %q" + +#~ msgid "Expected a %q or %q" +#~ msgstr "Erwartete ein %q oder %q" + +#~ msgid "Expected an %q" +#~ msgstr "Erwartet ein %q" + +#, c-format +#~ msgid "IV must be %d bytes long" +#~ msgstr "IV muss %d Bytes lang sein" + +#~ msgid "Not settable" +#~ msgstr "Kann nicht gesetzt werden" + +#~ msgid "expected '%q' but got '%q'" +#~ msgstr "erwartet '%q' aber bekommen '%q'" + +#~ msgid "expected '%q' or '%q' but got '%q'" +#~ msgstr "erwartete '%q' oder '%q', aber bekam '%q'" + +#~ msgid "Read-only object" +#~ msgstr "Schreibgeschützte Objekt" + +#~ msgid "frequency is read-only for this board" +#~ msgstr "Frequenz ist für dieses Board schreibgeschützt" + +#~ msgid "Unable to write" +#~ msgstr "Schreiben nicht möglich" + +#~ msgid "%q length must be >= 1" +#~ msgstr "%q Länge muss >= 1 sein" + +#~ msgid "%q must be a string" +#~ msgstr "%q muss ein String sein" + +#~ msgid "%q must be an int" +#~ msgstr "%q muss vom Typ Integer sein" + +#~ 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" + +#~ msgid "At most %d %q may be specified (not %d)" +#~ msgstr "Es darf höchstens %d %q spezifiziert werden (nicht %d)" + +#~ msgid "Invalid pins" +#~ msgstr "Ungültige Pins" + +#, c-format +#~ msgid "No more than %d HID devices allowed" +#~ msgstr "Keine weiteren %d HID-Geräte zulässig" + +#~ msgid "byteorder is not a string" +#~ msgstr "Byteorder ist kein String" + +#~ msgid "can't convert %q to int" +#~ msgstr "kann %q nicht nach int konvertieren" + +#~ msgid "complex division by zero" +#~ msgstr "Komplexe Division durch null" + +#~ msgid "int() arg 2 must be >= 2 and <= 36" +#~ msgstr "int() arg 2 muss >= 2 und <= 36 sein" + +#~ msgid "long int not supported in this build" +#~ msgstr "long int wird in diesem Build nicht unterstützt" + +#~ msgid "slice step cannot be zero" +#~ msgstr "Der Slice-Schritt kann nicht Null sein" + +#~ msgid "step must be non-zero" +#~ msgstr "Schritt (step) darf nicht Null sein" + +#~ msgid "string indices must be integers, not %q" +#~ msgstr "String Indizes müssen Integer sein, nicht %q" + +#~ msgid "time.struct_time() takes a 9-sequence" +#~ msgstr "time.struct_time() nimmt eine 9-Sequenz an" + +#~ msgid "zero step" +#~ msgstr "Nullschritt" + +#~ msgid "invalid traceback" +#~ msgstr "ungültiger Traceback" + #~ msgid "%q indices must be integers, not %s" #~ msgstr "%q Indizes müssen Integer sein, nicht %s" diff --git a/locale/el.po b/locale/el.po index d47a0c5399..c939577cd5 100644 --- a/locale/el.po +++ b/locale/el.po @@ -38,13 +38,21 @@ msgstr "" #: supervisor/shared/safe_mode.c msgid "" "\n" -"Please file an issue with the contents of your CIRCUITPY drive at \n" -"https://github.com/adafruit/circuitpython/issues\n" +"Please file an issue with your program at https://github.com/adafruit/" +"circuitpython/issues." msgstr "" + +#: supervisor/shared/safe_mode.c +msgid "" "\n" -"Παρακαλώ δημιουγήστε ενα πρόβλημα με τα περιεχόμενα του CIRCUITPY δίσκου " -"στο\n" -"https://github.com/adafruit/circuitpython/issues\n" +"Press reset to exit safe mode.\n" +msgstr "" + +#: supervisor/shared/safe_mode.c +msgid "" +"\n" +"You are in safe mode because:\n" +msgstr "" #: py/obj.c msgid " File \"%q\"" @@ -76,6 +84,11 @@ msgstr "%%c απαιτεί int ή char" msgid "%02X" msgstr "" +#: shared-module/os/getenv.c +#, c-format +msgid "%S" +msgstr "" + #: shared-bindings/rgbmatrix/RGBMatrix.c #, c-format msgid "" @@ -92,7 +105,7 @@ msgstr "" #: 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 +#: ports/stm/common-hal/canio/Listener.c ports/stm/common-hal/rtc/RTC.c msgid "%q" msgstr "%q" @@ -112,13 +125,18 @@ msgstr "%q περιέχει διπλότυπα pins" msgid "%q failure: %d" msgstr "%q αποτυχία: %d" +#: py/argcheck.c +msgid "%q in %q must be of type %q, not %q" +msgstr "" + +#: ports/espressif/common-hal/espulp/ULP.c #: ports/raspberrypi/common-hal/rp2pio/StateMachine.c #: shared-bindings/digitalio/DigitalInOut.c #: shared-bindings/microcontroller/Pin.c msgid "%q in use" msgstr "%q είναι σε χρήση" -#: py/obj.c py/objstr.c py/objstrunicode.c +#: py/objstr.c py/objstrunicode.c msgid "%q index out of range" msgstr "%q δείκτης εκτός εμβέλειας" @@ -130,7 +148,11 @@ msgstr "%q εκκίνηση απέτυχε" msgid "%q is %q" msgstr "" -#: py/argcheck.c +#: ports/raspberrypi/common-hal/wifi/Radio.c +msgid "%q is read-only for this board" +msgstr "" + +#: py/argcheck.c shared-bindings/usb_hid/Device.c msgid "%q length must be %d" msgstr "%q μήκος πρέπει να είναι %d" @@ -146,10 +168,6 @@ msgstr "%q μήκος πρέπει να είναι <= %d" 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" @@ -171,25 +189,21 @@ msgid "%q must be >= %d" msgstr "%q πρέπει να είναι >= %d" #: shared-bindings/analogbufio/BufferedIn.c +msgid "%q must be a bytearray or array of type 'H' or 'B'" +msgstr "" + #: 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" +#: ports/raspberrypi/bindings/cyw43/__init__.c py/argcheck.c py/objexcept.c +#: shared-bindings/canio/CAN.c shared-bindings/digitalio/Pull.c +msgid "%q must be of type %q or %q, not %q" +msgstr "" -#: 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" +#: py/argcheck.c py/obj.c py/objstrunicode.c +msgid "%q must be of type %q, not %q" +msgstr "" #: ports/atmel-samd/common-hal/busio/UART.c msgid "%q must be power of 2" @@ -201,7 +215,6 @@ msgstr "%q εκτός ορίων" #: ports/atmel-samd/common-hal/pulseio/PulseIn.c #: ports/cxd56/common-hal/pulseio/PulseIn.c -#: ports/espressif/common-hal/coproc/Coproc.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 @@ -213,9 +226,9 @@ msgstr "%q εκτός εμβέλειας" msgid "%q pin invalid" msgstr "%q άκυρο pin" -#: shared-bindings/usb_hid/Device.c -msgid "%q with a report ID of 0 must be of length 1" -msgstr "%q με ID αναφοράς 0 πρέπει να έχει μήκος 1" +#: py/objrange.c py/objslice.c shared-bindings/random/__init__.c +msgid "%q step cannot be zero" +msgstr "" #: py/bc.c py/objnamedtuple.c msgid "%q() takes %d positional arguments but %d were given" @@ -314,7 +327,7 @@ msgstr "'%s' αντικείμενο δεν υποστηρίζει ορισμό msgid "'%s' object doesn't support item deletion" msgstr "'%s' αντικείμενο δεν υποστηρίζει διαγραφή πράγματος" -#: ports/raspberrypi/common-hal/wifi/Radio.c py/runtime.c +#: py/runtime.c msgid "'%s' object has no attribute '%q'" msgstr "'%s' αντικείμενο δεν έχει γνώρισμα '%q'" @@ -415,6 +428,10 @@ msgstr "Το ADC2 χρησιμοποιείται απο το WIFI" msgid "Address must be %d bytes long" msgstr "Η διεύθυνση πρέπει να είναι %d bytes μεγάλη" +#: ports/espressif/common-hal/memorymap/AddressRange.c +msgid "Address range not allowed" +msgstr "" + #: ports/espressif/common-hal/canio/CAN.c msgid "All CAN peripherals are in use" msgstr "Όλα τα περιφεριακά CAN είναι σε χρήση" @@ -442,7 +459,6 @@ msgid "All SPI peripherals are in use" 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 "Όλα τα UART περιφεριακά ειναι σε χρήση" @@ -495,7 +511,7 @@ msgstr "Ήδη διαφημίζουμε." msgid "Already have all-matches listener" msgstr "Ύπάρχει ήδη all-matches ακροατής" -#: ports/espressif/common-hal/coproc/__init__.c +#: ports/espressif/common-hal/espulp/ULP.c #: shared-module/memorymonitor/AllocationAlarm.c #: shared-module/memorymonitor/AllocationSize.c msgid "Already running" @@ -506,6 +522,11 @@ msgstr "Τρέχει ήδη" msgid "Already scanning for wifi networks" msgstr "Ήδη γίνεται σάρωση για δίκτυα wifi" +#: shared-module/os/getenv.c +#, c-format +msgid "An error occurred while retrieving '%s':\n" +msgstr "" + #: ports/stm/common-hal/audiopwmio/PWMAudioOut.c msgid "Another PWMAudioOut is already active" msgstr "Και άλλο PWMAudioOut είναι σε χρήση" @@ -519,24 +540,16 @@ msgstr "Άλλη αποστολή είναι ήδη ενεργή" msgid "Array must contain halfwords (type 'H')" msgstr "H παράταξη πρέπει να περιέχει halfwords (τύπου 'H')" -#: shared-bindings/alarm/SleepMemory.c shared-bindings/coproc/CoprocMemory.c +#: shared-bindings/alarm/SleepMemory.c shared-bindings/memorymap/AddressRange.c #: shared-bindings/nvm/ByteArray.c msgid "Array values should be single bytes." msgstr "Η τιμές της παράταξη πρέπει να είναι μονά bytes." -#: shared-bindings/microcontroller/Pin.c -msgid "At most %d %q may be specified (not %d)" -msgstr "Το πολύ %d %q μπορεί να είναι καθορισμένα (όχι %d)" - #: shared-module/memorymonitor/AllocationAlarm.c #, c-format msgid "Attempt to allocate %d blocks" msgstr "Προσπάθεια να δεσμευτούν %d blocks" -#: supervisor/shared/safe_mode.c -msgid "Attempted heap allocation when VM not running." -msgstr "Προσπάθεια δέσμευσης heap όταν το VM δεν τρέχει." - #: ports/raspberrypi/audio_dma.c msgid "Audio conversion not implemented" msgstr "Η μετατροπή ήχου δεν υποστηρίζεται" @@ -587,20 +600,13 @@ msgid "Bitmap size and bits per value must match" msgstr "Το μέγεθος του bitmap και τα bits ανα τιμή πρέπει να ταιριάζουν" #: supervisor/shared/safe_mode.c -msgid "Boot device must be first device (interface #0)." -msgstr "Η συσκευή boot πρέπει να είναι η πρώτη συσκευή (interface #0)." +msgid "Boot device must be first (interface #0)." +msgstr "" #: ports/mimxrt10xx/common-hal/busio/UART.c msgid "Both RX and TX required for flow control" msgstr "Και RX και TX απαιτούνται για έλεγχο flow" -#: ports/atmel-samd/boards/circuitplayground_express/mpconfigboard.h -#: ports/atmel-samd/boards/circuitplayground_express_crickit/mpconfigboard.h -#: ports/atmel-samd/boards/circuitplayground_express_displayio/mpconfigboard.h -#: ports/atmel-samd/boards/meowmeow/mpconfigboard.h -msgid "Both buttons were pressed at start up.\n" -msgstr "" - #: ports/atmel-samd/common-hal/rotaryio/IncrementalEncoder.c msgid "Both pins must support hardware interrupts" msgstr "Και τα δύο pin πρέπει να υποστηρίζουν interrupts υλικού" @@ -666,11 +672,6 @@ msgstr "Τα Buffers πρέπει να είναι του ιδίου μεγέθο msgid "Bus pin %d is already in use" msgstr "Bus pin %d είναι ήδη σε χρήση" -#: ports/espressif/boards/m5stack_core_basic/mpconfigboard.h -#: ports/espressif/boards/m5stack_core_fire/mpconfigboard.h -msgid "Button A was pressed at start up.\n" -msgstr "" - #: shared-bindings/_bleio/UUID.c msgid "Byte buffer must be 16 bytes." msgstr "Byte buffer πρέπει να είναι 16 bytes." @@ -809,10 +810,6 @@ msgstr "Δεν υποστηρίζονται εγγραφές στο Characterist msgid "CircuitPython core code crashed hard. Whoops!\n" msgstr "Ο πυρήνας της CircuitPython κατέρευσε. Οουπς!\n" -#: supervisor/shared/safe_mode.c -msgid "CircuitPython was unable to allocate the heap." -msgstr "Η CircuitPython δεν μπορέσε να δεσμεύσει το heap." - #: shared-module/bitbangio/I2C.c msgid "Clock stretch too long" msgstr "Stretch ρολογιού πολύ μεγάλο" @@ -853,10 +850,6 @@ msgstr "Δεν μπόρεσε να εκκινηθεί το interrupt, RX κατ msgid "Couldn't allocate decoder" msgstr "Δεν μπόρεσε να δεσμευτεί decoder" -#: supervisor/shared/safe_mode.c -msgid "Crash into the HardFault_Handler." -msgstr "Κατέρευσε μέσα στο HardFault_Handler." - #: ports/stm/common-hal/analogio/AnalogOut.c msgid "DAC Channel Init Error" msgstr "Σφάλμα εκκίνησης καναλιού DAC" @@ -919,6 +912,10 @@ msgstr "" msgid "Drive mode not used when direction is input." msgstr "" +#: py/obj.c +msgid "During handling of the above exception, another exception occurred:" +msgstr "" + #: shared-bindings/aesio/aes.c msgid "ECB only operates on 16 bytes at a time" msgstr "" @@ -944,24 +941,16 @@ msgstr "" msgid "Error in regex" msgstr "" +#: supervisor/shared/safe_mode.c +msgid "Error in safemode.py." +msgstr "" + #: shared-bindings/socketpool/Socket.c shared-bindings/ssl/SSLSocket.c msgid "Error: Failure to bind" msgstr "" -#: py/enum.c shared-bindings/_bleio/__init__.c shared-bindings/aesio/aes.c -#: shared-bindings/alarm/__init__.c shared-bindings/alarm/coproc/CoprocAlarm.c -#: shared-bindings/busio/SPI.c shared-bindings/coproc/Coproc.c -#: shared-bindings/coproc/__init__.c shared-bindings/microcontroller/Pin.c -#: shared-bindings/neopixel_write/__init__.c -msgid "Expected a %q" -msgstr "" - -#: ports/raspberrypi/bindings/cyw43/__init__.c -msgid "Expected a %q or %q" -msgstr "" - #: shared-bindings/alarm/__init__.c -msgid "Expected an %q" +msgid "Expected a kind of %q" msgstr "" #: ports/espressif/common-hal/_bleio/Adapter.c @@ -1029,13 +1018,17 @@ msgid "Failed to write internal flash." msgstr "" #: supervisor/shared/safe_mode.c -msgid "Fatal error." +msgid "Fault detected by hardware." msgstr "" #: py/moduerrno.c msgid "File exists" msgstr "" +#: shared-module/os/getenv.c +msgid "File not found" +msgstr "" + #: ports/atmel-samd/common-hal/canio/Listener.c #: ports/espressif/common-hal/canio/Listener.c #: ports/stm/common-hal/canio/Listener.c @@ -1050,7 +1043,6 @@ msgstr "" msgid "Firmware is invalid" msgstr "" -#: ports/espressif/common-hal/coproc/Coproc.c #: ports/espressif/common-hal/dualbank/__init__.c msgid "Firmware is too big" msgstr "" @@ -1092,6 +1084,8 @@ msgstr "" #: shared-bindings/displayio/Display.c #: shared-bindings/displayio/EPaperDisplay.c #: shared-bindings/framebufferio/FramebufferDisplay.c +#: shared-module/displayio/Display.c +#: shared-module/framebufferio/FramebufferDisplay.c msgid "Group already used" msgstr "" @@ -1112,6 +1106,15 @@ msgstr "" msgid "Hardware in use, try alternative pins" msgstr "" +#: supervisor/shared/safe_mode.c +msgid "Heap allocation when VM not running." +msgstr "" + +#: supervisor/shared/safe_mode.c +msgid "" +"Heap was corrupted because the stack was too small. Increase stack size." +msgstr "" + #: extmod/vfs_posix_file.c py/objstringio.c msgid "I/O operation on closed file" msgstr "" @@ -1129,11 +1132,6 @@ msgstr "" msgid "I2SOut not available" msgstr "" -#: shared-bindings/aesio/aes.c -#, c-format -msgid "IV must be %d bytes long" -msgstr "" - #: ports/raspberrypi/bindings/rp2pio/StateMachine.c msgid "In-buffer elements must be <= 4 bytes long" msgstr "" @@ -1218,6 +1216,7 @@ msgid "Internal define error" msgstr "" #: ports/espressif/common-hal/paralleldisplay/ParallelBus.c +#: shared-module/os/getenv.c msgid "Internal error" msgstr "" @@ -1230,6 +1229,10 @@ msgstr "" msgid "Internal watchdog timer expired." msgstr "" +#: supervisor/shared/safe_mode.c +msgid "Interrupt error." +msgstr "" + #: py/argcheck.c shared-bindings/digitalio/DigitalInOut.c msgid "Invalid %q" msgstr "" @@ -1264,6 +1267,11 @@ msgstr "" msgid "Invalid bits per value" msgstr "" +#: shared-module/os/getenv.c +#, c-format +msgid "Invalid byte %.*s" +msgstr "" + #: ports/atmel-samd/common-hal/imagecapture/ParallelImageCapture.c #, c-format msgid "Invalid data_pins[%d]" @@ -1273,18 +1281,10 @@ msgstr "" msgid "Invalid format chunk size" msgstr "" -#: supervisor/shared/safe_mode.c -msgid "Invalid memory access." -msgstr "" - #: ports/espressif/common-hal/wifi/Radio.c msgid "Invalid multicast MAC address" msgstr "" -#: shared-bindings/busio/UART.c -msgid "Invalid pins" -msgstr "" - #: ports/espressif/common-hal/espidf/__init__.c ports/espressif/esp_error.c msgid "Invalid size" msgstr "" @@ -1298,10 +1298,18 @@ msgstr "" msgid "Invalid state" msgstr "" +#: shared-module/os/getenv.c +msgid "Invalid unicode escape" +msgstr "" + #: shared-bindings/aesio/aes.c msgid "Key must be 16, 24, or 32 bytes long" msgstr "" +#: shared-module/os/getenv.c +msgid "Key not found" +msgstr "" + #: shared-module/is31fl3741/FrameBuffer.c msgid "LED mappings must match display size" msgstr "" @@ -1408,6 +1416,10 @@ msgstr "" msgid "NVS Error" msgstr "" +#: shared-bindings/socketpool/SocketPool.c +msgid "Name or service not known" +msgstr "" + #: py/qstr.c msgid "Name too long" msgstr "" @@ -1522,11 +1534,6 @@ msgstr "" msgid "No long integer support" msgstr "" -#: shared-module/usb_hid/__init__.c -#, c-format -msgid "No more than %d HID devices allowed" -msgstr "" - #: shared-bindings/wifi/Radio.c msgid "No network with that ssid" msgstr "" @@ -1562,10 +1569,6 @@ msgstr "" msgid "No timer available" msgstr "" -#: supervisor/shared/safe_mode.c -msgid "Nordic system firmware failure assertion." -msgstr "" - #: ports/nrf/common-hal/_bleio/__init__.c msgid "Nordic system firmware out of memory" msgstr "" @@ -1585,10 +1588,6 @@ msgstr "" msgid "Not playing" msgstr "" -#: shared-bindings/_bleio/__init__.c -msgid "Not settable" -msgstr "" - #: ports/espressif/common-hal/paralleldisplay/ParallelBus.c #, c-format msgid "Number of data_pins must be 8 or 16, not %d" @@ -1651,11 +1650,14 @@ msgid "" "%d bpp given" msgstr "" -#: ports/espressif/common-hal/alarm/coproc/CoprocAlarm.c #: ports/espressif/common-hal/alarm/touch/TouchAlarm.c msgid "Only one %q can be set in deep sleep." msgstr "" +#: ports/espressif/common-hal/espulp/ULPAlarm.c +msgid "Only one %q can be set." +msgstr "" + #: ports/espressif/common-hal/i2ctarget/I2CTarget.c #: ports/raspberrypi/common-hal/i2ctarget/I2CTarget.c msgid "Only one address is allowed" @@ -1688,6 +1690,10 @@ msgstr "" msgid "Operation timed out" msgstr "" +#: ports/raspberrypi/common-hal/mdns/Server.c +msgid "Out of MDNS service slots" +msgstr "" + #: ports/espressif/common-hal/espidf/__init__.c ports/espressif/esp_error.c msgid "Out of memory" msgstr "" @@ -1813,6 +1819,10 @@ msgstr "" msgid "Program size invalid" msgstr "" +#: ports/espressif/common-hal/espulp/ULP.c +msgid "Program too long" +msgstr "" + #: shared-bindings/digitalio/DigitalInOut.c msgid "Pull not used when direction is output." msgstr "" @@ -1852,8 +1862,9 @@ msgstr "" msgid "Random number generation error" msgstr "" +#: shared-bindings/_bleio/__init__.c #: shared-bindings/memorymonitor/AllocationSize.c -#: shared-bindings/pulseio/PulseIn.c +#: shared-bindings/pulseio/PulseIn.c shared-module/displayio/Bitmap.c msgid "Read-only" msgstr "" @@ -1861,10 +1872,6 @@ msgstr "" msgid "Read-only filesystem" msgstr "" -#: shared-module/displayio/Bitmap.c -msgid "Read-only object" -msgstr "" - #: ports/espressif/common-hal/espidf/__init__.c ports/espressif/esp_error.c msgid "Received response was invalid" msgstr "" @@ -1957,7 +1964,7 @@ msgstr "" msgid "Sleep Memory not available" msgstr "" -#: shared-bindings/alarm/SleepMemory.c shared-bindings/coproc/CoprocMemory.c +#: shared-bindings/alarm/SleepMemory.c shared-bindings/memorymap/AddressRange.c #: shared-bindings/nvm/ByteArray.c msgid "Slice and value different lengths." msgstr "" @@ -1994,6 +2001,10 @@ msgstr "" msgid "Stereo right must be on PWM channel B" msgstr "" +#: ports/raspberrypi/common-hal/wifi/Radio.c +msgid "Stopping AP is not supported." +msgstr "" + #: ports/mimxrt10xx/common-hal/busio/UART.c ports/stm/common-hal/busio/UART.c msgid "Supply at least one UART pin" msgstr "" @@ -2011,35 +2022,11 @@ msgid "Temperature read timed out" msgstr "" #: supervisor/shared/safe_mode.c -msgid "The BOOT button was pressed at start up.\n" +msgid "The `microcontroller` module was used to boot into safe mode." msgstr "" -#: supervisor/shared/safe_mode.c -msgid "" -"The CircuitPython heap was corrupted because the stack was too small.\n" -"Increase the stack size if you know how. If not:" -msgstr "" - -#: ports/espressif/boards/adafruit_feather_esp32_v2/mpconfigboard.h -msgid "The SW38 button was pressed at start up.\n" -msgstr "" - -#: ports/espressif/boards/hardkernel_odroid_go/mpconfigboard.h -msgid "The VOLUME button was pressed at start up.\n" -msgstr "" - -#: supervisor/shared/safe_mode.c -msgid "" -"The `microcontroller` module was used to boot into safe mode. Press reset to " -"exit safe mode." -msgstr "" - -#: ports/espressif/boards/m5stack_atom_lite/mpconfigboard.h -msgid "The central button was pressed at start up.\n" -msgstr "" - -#: ports/nrf/boards/aramcon2_badge/mpconfigboard.h -msgid "The left button was pressed at start up.\n" +#: py/obj.c +msgid "The above exception was the direct cause of the following exception:" msgstr "" #: shared-bindings/rgbmatrix/RGBMatrix.c @@ -2047,10 +2034,7 @@ msgid "The length of rgb_pins must be 6, 12, 18, 24, or 30" msgstr "" #: supervisor/shared/safe_mode.c -msgid "" -"The microcontroller's power dipped. Make sure your power supply provides\n" -"enough power for the whole circuit and press reset (after ejecting " -"CIRCUITPY)." +msgid "The power dipped. Make sure you are providing enough power." msgstr "" #: shared-module/audiomixer/MixerVoice.c @@ -2069,6 +2053,10 @@ msgstr "" msgid "The sample's signedness does not match the mixer's" msgstr "" +#: supervisor/shared/safe_mode.c +msgid "Third-party firmware fatal error." +msgstr "" + #: shared-module/imagecapture/ParallelImageCapture.c msgid "This microcontroller does not support continuous capture." msgstr "" @@ -2101,10 +2089,6 @@ msgstr "" msgid "Timeout is too long: Maximum timeout length is %d seconds" msgstr "" -#: supervisor/shared/safe_mode.c -msgid "To exit, please reset the board without requesting safe mode." -msgstr "" - #: ports/atmel-samd/common-hal/audiobusio/I2SOut.c msgid "Too many channels in sample" msgstr "" @@ -2149,6 +2133,10 @@ msgstr "" msgid "UART init" msgstr "" +#: ports/raspberrypi/common-hal/busio/UART.c +msgid "UART peripheral in use" +msgstr "" + #: ports/stm/common-hal/busio/UART.c msgid "UART re-init" msgstr "" @@ -2196,6 +2184,10 @@ msgstr "" msgid "Unable to allocate buffers for signed conversion" msgstr "" +#: supervisor/shared/safe_mode.c +msgid "Unable to allocate the heap." +msgstr "" + #: ports/espressif/common-hal/busio/I2C.c msgid "Unable to create lock" msgstr "" @@ -2219,11 +2211,12 @@ msgid "Unable to read color palette data" msgstr "" #: ports/espressif/common-hal/mdns/Server.c +#: ports/raspberrypi/common-hal/mdns/Server.c msgid "Unable to start mDNS query" msgstr "" -#: shared-bindings/coproc/CoprocMemory.c -msgid "Unable to write" +#: shared-bindings/memorymap/AddressRange.c +msgid "Unable to write to address." msgstr "" #: shared-bindings/nvm/ByteArray.c @@ -2294,6 +2287,7 @@ msgid "Unkown error code %d" msgstr "" #: shared-bindings/adafruit_pixelbuf/PixelBuf.c +#: shared-module/_pixelmap/PixelMap.c #, c-format msgid "Unmatched number of items on RHS (expected %d, got %d)." msgstr "" @@ -2378,6 +2372,18 @@ msgstr "" msgid "Wi-Fi: " msgstr "" +#: ports/raspberrypi/common-hal/wifi/Radio.c +msgid "Wifi is in access point mode." +msgstr "" + +#: ports/raspberrypi/common-hal/wifi/Radio.c +msgid "Wifi is in station mode." +msgstr "" + +#: ports/raspberrypi/common-hal/wifi/Radio.c +msgid "Wifi is not enabled" +msgstr "" + #: main.c msgid "Woken up by alarm.\n" msgstr "" @@ -2387,13 +2393,48 @@ msgstr "" msgid "Writes not supported on Characteristic" msgstr "" -#: supervisor/shared/safe_mode.c -msgid "You are in safe mode because:\n" +#: ports/atmel-samd/boards/circuitplayground_express/mpconfigboard.h +#: ports/atmel-samd/boards/circuitplayground_express_crickit/mpconfigboard.h +#: ports/atmel-samd/boards/circuitplayground_express_displayio/mpconfigboard.h +#: ports/atmel-samd/boards/meowmeow/mpconfigboard.h +msgid "You pressed both buttons at start up." +msgstr "" + +#: ports/espressif/boards/m5stack_core_basic/mpconfigboard.h +#: ports/espressif/boards/m5stack_core_fire/mpconfigboard.h +#: ports/espressif/boards/m5stack_stick_c/mpconfigboard.h +msgid "You pressed button A at start up." msgstr "" #: supervisor/shared/safe_mode.c -msgid "" -"You pressed the reset button during boot. Press again to exit safe mode." +msgid "You pressed the BOOT button at start up" +msgstr "" + +#: ports/espressif/boards/adafruit_feather_esp32_v2/mpconfigboard.h +msgid "You pressed the SW38 button at start up." +msgstr "" + +#: ports/espressif/boards/hardkernel_odroid_go/mpconfigboard.h +msgid "You pressed the VOLUME button at start up." +msgstr "" + +#: ports/espressif/boards/m5stack_atom_echo/mpconfigboard.h +#: ports/espressif/boards/m5stack_atom_lite/mpconfigboard.h +#: ports/espressif/boards/m5stack_atom_matrix/mpconfigboard.h +#: ports/espressif/boards/m5stack_atom_u/mpconfigboard.h +msgid "You pressed the central button at start up." +msgstr "" + +#: ports/nrf/boards/aramcon2_badge/mpconfigboard.h +msgid "You pressed the left button at start up." +msgstr "" + +#: supervisor/shared/safe_mode.c +msgid "You pressed the reset button during boot." +msgstr "" + +#: supervisor/shared/micropython.c +msgid "[truncated due to length]" msgstr "" #: py/objtype.c @@ -2465,8 +2506,12 @@ msgstr "" msgid "array has too many dimensions" msgstr "" +#: extmod/ulab/code/ndarray.c +msgid "array is too big" +msgstr "" + #: py/objarray.c shared-bindings/alarm/SleepMemory.c -#: shared-bindings/coproc/CoprocMemory.c shared-bindings/nvm/ByteArray.c +#: shared-bindings/memorymap/AddressRange.c shared-bindings/nvm/ByteArray.c msgid "array/bytes required on right side" msgstr "" @@ -2559,10 +2604,6 @@ msgstr "" msgid "buffer too small for requested bytes" msgstr "" -#: shared-bindings/adafruit_pixelbuf/PixelBuf.c -msgid "byteorder is not a string" -msgstr "" - #: py/objarray.c msgid "bytes length not a multiple of item size" msgstr "" @@ -2604,14 +2645,10 @@ msgstr "" msgid "can't cancel self" msgstr "" -#: py/obj.c py/objint.c shared-module/adafruit_pixelbuf/PixelBuf.c +#: py/obj.c py/objint.c py/runtime.c shared-module/adafruit_pixelbuf/PixelBuf.c msgid "can't convert %q to %q" msgstr "" -#: py/runtime.c -msgid "can't convert %q to int" -msgstr "" - #: py/obj.c #, c-format msgid "can't convert %s to complex" @@ -2693,6 +2730,10 @@ msgstr "" msgid "can't set attribute" msgstr "" +#: py/runtime.c +msgid "can't set attribute '%q'" +msgstr "" + #: py/emitnative.c msgid "can't store '%q'" msgstr "" @@ -2795,10 +2836,6 @@ msgstr "" msgid "comparison of int and uint" msgstr "" -#: py/objcomplex.c -msgid "complex division by zero" -msgstr "" - #: py/objfloat.c py/parsenum.c msgid "complex values not supported" msgstr "" @@ -2901,12 +2938,11 @@ msgstr "" msgid "div/mod not implemented for uint" msgstr "" -#: py/objfloat.c py/objint_mpz.c +#: extmod/ulab/code/numpy/create.c msgid "divide by zero" msgstr "" -#: py/modmath.c py/objint_longlong.c py/runtime.c -#: shared-bindings/math/__init__.c +#: py/runtime.c msgid "division by zero" msgstr "" @@ -2947,9 +2983,9 @@ msgstr "" msgid "error = 0x%08lX" msgstr "" -#: ports/espressif/common-hal/esp32_camera/Camera.c +#: ports/espressif/common-hal/espcamera/Camera.c msgid "" -"esp32_camera.Camera requires reserved PSRAM to be configured. See the " +"espcamera.Camera requires reserved PSRAM to be configured. See the " "documentation for instructions." msgstr "" @@ -2957,14 +2993,6 @@ msgstr "" msgid "exceptions must derive from BaseException" msgstr "" -#: shared-bindings/canio/CAN.c -msgid "expected '%q' but got '%q'" -msgstr "" - -#: shared-bindings/canio/CAN.c -msgid "expected '%q' or '%q' but got '%q'" -msgstr "" - #: py/objstr.c msgid "expected ':' after format specifier" msgstr "" @@ -3063,10 +3091,6 @@ msgstr "" msgid "format requires a dict" msgstr "" -#: shared-bindings/microcontroller/Processor.c -msgid "frequency is read-only for this board" -msgstr "" - #: py/objdeque.c msgid "full" msgstr "" @@ -3179,8 +3203,12 @@ msgstr "" msgid "index is out of bounds" msgstr "" +#: shared-bindings/_pixelmap/PixelMap.c +msgid "index must be tuple or int" +msgstr "" + #: extmod/ulab/code/numpy/numerical.c extmod/ulab/code/ulab_tools.c -#: ports/espressif/common-hal/pulseio/PulseIn.c py/obj.c +#: ports/espressif/common-hal/pulseio/PulseIn.c #: shared-bindings/bitmaptools/__init__.c msgid "index out of range" msgstr "" @@ -3278,10 +3306,6 @@ msgstr "" msgid "inputs are not iterable" msgstr "" -#: py/parsenum.c -msgid "int() arg 2 must be >= 2 and <= 36" -msgstr "" - #: extmod/ulab/code/numpy/approx.c msgid "interp is defined for 1D iterables of equal length" msgstr "" @@ -3338,7 +3362,7 @@ msgstr "" msgid "invalid micropython decorator" msgstr "" -#: ports/espressif/common-hal/esp32_camera/Camera.c +#: ports/espressif/common-hal/espcamera/Camera.c msgid "invalid setting" msgstr "" @@ -3363,10 +3387,6 @@ msgstr "" msgid "invalid syntax for number" msgstr "" -#: py/objexcept.c -msgid "invalid traceback" -msgstr "" - #: py/objtype.c msgid "issubclass() arg 1 must be a class" msgstr "" @@ -3423,19 +3443,17 @@ msgstr "" msgid "local variable referenced before assignment" msgstr "" -#: py/objint.c -msgid "long int not supported in this build" -msgstr "" - #: ports/espressif/common-hal/canio/CAN.c msgid "loopback + silent mode not supported by peripheral" msgstr "" #: ports/espressif/common-hal/mdns/Server.c +#: ports/raspberrypi/common-hal/mdns/Server.c msgid "mDNS already initialized" msgstr "" #: ports/espressif/common-hal/mdns/Server.c +#: ports/raspberrypi/common-hal/mdns/Server.c msgid "mDNS only works with built-in WiFi" msgstr "" @@ -3564,6 +3582,10 @@ msgstr "" msgid "negative shift count" msgstr "" +#: shared-bindings/_pixelmap/PixelMap.c +msgid "nested index must be int" +msgstr "" + #: shared-module/sdcardio/SDCard.c msgid "no SD card" msgstr "" @@ -3597,7 +3619,7 @@ msgstr "" msgid "no response from SD card" msgstr "" -#: ports/espressif/common-hal/esp32_camera/Camera.c py/objobject.c py/runtime.c +#: ports/espressif/common-hal/espcamera/Camera.c py/objobject.c py/runtime.c msgid "no such attribute" msgstr "" @@ -3733,6 +3755,10 @@ msgstr "" msgid "only mono is supported" msgstr "" +#: extmod/ulab/code/numpy/create.c +msgid "only ndarrays can be concatenated" +msgstr "" + #: ports/stm/common-hal/audiobusio/PDMIn.c msgid "only oversample=64 is supported" msgstr "" @@ -3743,7 +3769,7 @@ msgid "only sample_rate=16000 is supported" msgstr "" #: py/objarray.c py/objstr.c py/objstrunicode.c py/objtuple.c -#: shared-bindings/alarm/SleepMemory.c shared-bindings/coproc/CoprocMemory.c +#: shared-bindings/alarm/SleepMemory.c shared-bindings/memorymap/AddressRange.c #: shared-bindings/nvm/ByteArray.c msgid "only slices with step=1 (aka None) are supported" msgstr "" @@ -3959,10 +3985,6 @@ msgstr "" msgid "slice step can't be zero" msgstr "" -#: py/objslice.c -msgid "slice step cannot be zero" -msgstr "" - #: py/nativeglue.c msgid "slice unsupported" msgstr "" @@ -4011,10 +4033,6 @@ msgstr "" msgid "start/end indices" msgstr "" -#: shared-bindings/random/__init__.c -msgid "step must be non-zero" -msgstr "" - #: shared-bindings/random/__init__.c msgid "stop not reachable from start" msgstr "" @@ -4023,10 +4041,6 @@ msgstr "" msgid "stream operation not supported" msgstr "" -#: py/objstrunicode.c -msgid "string indices must be integers, not %q" -msgstr "" - #: py/stream.c msgid "string not supported; use bytes or bytearray" msgstr "" @@ -4059,10 +4073,6 @@ msgstr "" msgid "syntax error in uctypes descriptor" msgstr "" -#: shared-bindings/time/__init__.c -msgid "time.struct_time() takes a 9-sequence" -msgstr "" - #: ports/atmel-samd/common-hal/watchdog/WatchDogTimer.c #: ports/espressif/common-hal/watchdog/WatchDogTimer.c #: ports/nrf/common-hal/watchdog/WatchDogTimer.c @@ -4344,10 +4354,6 @@ msgstr "" msgid "y value out of bounds" msgstr "" -#: py/objrange.c -msgid "zero step" -msgstr "" - #: extmod/ulab/code/scipy/signal/signal.c msgid "zi must be an ndarray" msgstr "" @@ -4360,6 +4366,49 @@ msgstr "" msgid "zi must be of shape (n_section, 2)" msgstr "" +#~ msgid "" +#~ "\n" +#~ "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" + +#~ msgid "Attempted heap allocation when VM not running." +#~ msgstr "Προσπάθεια δέσμευσης heap όταν το VM δεν τρέχει." + +#~ msgid "Boot device must be first device (interface #0)." +#~ msgstr "Η συσκευή boot πρέπει να είναι η πρώτη συσκευή (interface #0)." + +#~ msgid "CircuitPython was unable to allocate the heap." +#~ msgstr "Η CircuitPython δεν μπορέσε να δεσμεύσει το heap." + +#~ msgid "Crash into the HardFault_Handler." +#~ msgstr "Κατέρευσε μέσα στο HardFault_Handler." + +#~ msgid "%q must be of type %q" +#~ msgstr "%q πρέπει να είναι τύπου %q" + +#~ msgid "%q must be of type %q or None" +#~ msgstr "%q πρέπει να είναι τύπου %q ή None" + +#~ msgid "%q length must be >= 1" +#~ msgstr "%q μήκος πρέπει να είναι >= 1" + +#~ msgid "%q must be a string" +#~ msgstr "%q πρέπει να είναι string" + +#~ msgid "%q must be an int" +#~ msgstr "%q πρέπει να είναι int" + +#~ msgid "%q with a report ID of 0 must be of length 1" +#~ msgstr "%q με ID αναφοράς 0 πρέπει να έχει μήκος 1" + +#~ msgid "At most %d %q may be specified (not %d)" +#~ msgstr "Το πολύ %d %q μπορεί να είναι καθορισμένα (όχι %d)" + #~ msgid "%q indices must be integers, not %s" #~ msgstr "%q δείκτες πρέπει να είναι ακέραιοι, όχι %s" diff --git a/locale/en_GB.po b/locale/en_GB.po index e6fabd93d9..e960651197 100644 --- a/locale/en_GB.po +++ b/locale/en_GB.po @@ -37,12 +37,21 @@ msgstr "" #: supervisor/shared/safe_mode.c msgid "" "\n" -"Please file an issue with the contents of your CIRCUITPY drive at \n" -"https://github.com/adafruit/circuitpython/issues\n" +"Please file an issue with your program at https://github.com/adafruit/" +"circuitpython/issues." msgstr "" + +#: supervisor/shared/safe_mode.c +msgid "" "\n" -"Please file an issue with the contents of your CIRCUITPY drive at \n" -"https://github.com/adafruit/circuitpython/issues\n" +"Press reset to exit safe mode.\n" +msgstr "" + +#: supervisor/shared/safe_mode.c +msgid "" +"\n" +"You are in safe mode because:\n" +msgstr "" #: py/obj.c msgid " File \"%q\"" @@ -74,6 +83,11 @@ msgstr "%%c requires int or char" msgid "%02X" msgstr "" +#: shared-module/os/getenv.c +#, c-format +msgid "%S" +msgstr "" + #: shared-bindings/rgbmatrix/RGBMatrix.c #, c-format msgid "" @@ -90,7 +104,7 @@ msgstr "" #: 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 +#: ports/stm/common-hal/canio/Listener.c ports/stm/common-hal/rtc/RTC.c msgid "%q" msgstr "" @@ -110,13 +124,18 @@ msgstr "%q contains duplicate pins" msgid "%q failure: %d" msgstr "%q failure: %d" +#: py/argcheck.c +msgid "%q in %q must be of type %q, not %q" +msgstr "" + +#: ports/espressif/common-hal/espulp/ULP.c #: ports/raspberrypi/common-hal/rp2pio/StateMachine.c #: shared-bindings/digitalio/DigitalInOut.c #: shared-bindings/microcontroller/Pin.c msgid "%q in use" msgstr "%q in use" -#: py/obj.c py/objstr.c py/objstrunicode.c +#: py/objstr.c py/objstrunicode.c msgid "%q index out of range" msgstr "%q index out of range" @@ -128,7 +147,11 @@ msgstr "" msgid "%q is %q" msgstr "" -#: py/argcheck.c +#: ports/raspberrypi/common-hal/wifi/Radio.c +msgid "%q is read-only for this board" +msgstr "" + +#: py/argcheck.c shared-bindings/usb_hid/Device.c msgid "%q length must be %d" msgstr "" @@ -144,10 +167,6 @@ msgstr "" 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 "" @@ -169,24 +188,20 @@ msgid "%q must be >= %d" msgstr "%q must be >= %d" #: shared-bindings/analogbufio/BufferedIn.c +msgid "%q must be a bytearray or array of type 'H' or 'B'" +msgstr "" + #: 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" - -#: py/argcheck.c -msgid "%q must be an int" +#: ports/raspberrypi/bindings/cyw43/__init__.c py/argcheck.c py/objexcept.c +#: shared-bindings/canio/CAN.c shared-bindings/digitalio/Pull.c +msgid "%q must be of type %q or %q, not %q" 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" +#: py/argcheck.c py/obj.c py/objstrunicode.c +msgid "%q must be of type %q, not %q" msgstr "" #: ports/atmel-samd/common-hal/busio/UART.c @@ -199,7 +214,6 @@ msgstr "" #: ports/atmel-samd/common-hal/pulseio/PulseIn.c #: ports/cxd56/common-hal/pulseio/PulseIn.c -#: ports/espressif/common-hal/coproc/Coproc.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 @@ -211,8 +225,8 @@ msgstr "%q out of range" msgid "%q pin invalid" msgstr "%q pin invalid" -#: shared-bindings/usb_hid/Device.c -msgid "%q with a report ID of 0 must be of length 1" +#: py/objrange.c py/objslice.c shared-bindings/random/__init__.c +msgid "%q step cannot be zero" msgstr "" #: py/bc.c py/objnamedtuple.c @@ -312,7 +326,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" -#: ports/raspberrypi/common-hal/wifi/Radio.c py/runtime.c +#: py/runtime.c msgid "'%s' object has no attribute '%q'" msgstr "'%s' object has no attribute '%q'" @@ -412,6 +426,10 @@ msgstr "ADC2 is being used by WiFi" msgid "Address must be %d bytes long" msgstr "Address must be %d bytes long" +#: ports/espressif/common-hal/memorymap/AddressRange.c +msgid "Address range not allowed" +msgstr "" + #: ports/espressif/common-hal/canio/CAN.c msgid "All CAN peripherals are in use" msgstr "All CAN peripherals are in use" @@ -439,7 +457,6 @@ msgid "All SPI peripherals are in use" msgstr "All SPI peripherals are in use" #: 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 "All UART peripherals are in use" @@ -492,7 +509,7 @@ msgstr "Already advertising." msgid "Already have all-matches listener" msgstr "Already have all-matches listener" -#: ports/espressif/common-hal/coproc/__init__.c +#: ports/espressif/common-hal/espulp/ULP.c #: shared-module/memorymonitor/AllocationAlarm.c #: shared-module/memorymonitor/AllocationSize.c msgid "Already running" @@ -503,6 +520,11 @@ msgstr "Already running" msgid "Already scanning for wifi networks" msgstr "Already scanning for WiFi networks" +#: shared-module/os/getenv.c +#, c-format +msgid "An error occurred while retrieving '%s':\n" +msgstr "" + #: ports/stm/common-hal/audiopwmio/PWMAudioOut.c msgid "Another PWMAudioOut is already active" msgstr "Another PWMAudioOut is already active" @@ -516,24 +538,16 @@ msgstr "Another send is already active" msgid "Array must contain halfwords (type 'H')" msgstr "Array must contain halfwords (type 'H')" -#: shared-bindings/alarm/SleepMemory.c shared-bindings/coproc/CoprocMemory.c +#: shared-bindings/alarm/SleepMemory.c shared-bindings/memorymap/AddressRange.c #: shared-bindings/nvm/ByteArray.c msgid "Array values should be single bytes." msgstr "Array values should be single bytes." -#: shared-bindings/microcontroller/Pin.c -msgid "At most %d %q may be specified (not %d)" -msgstr "At most %d %q may be specified (not %d)" - #: shared-module/memorymonitor/AllocationAlarm.c #, c-format msgid "Attempt to allocate %d blocks" msgstr "Attempt to allocate %d blocks" -#: supervisor/shared/safe_mode.c -msgid "Attempted heap allocation when VM not running." -msgstr "Attempted heap allocation when VM not running." - #: ports/raspberrypi/audio_dma.c msgid "Audio conversion not implemented" msgstr "Audio conversion not implemented" @@ -584,20 +598,13 @@ msgid "Bitmap size and bits per value must match" msgstr "" #: supervisor/shared/safe_mode.c -msgid "Boot device must be first device (interface #0)." +msgid "Boot device must be first (interface #0)." msgstr "" #: ports/mimxrt10xx/common-hal/busio/UART.c msgid "Both RX and TX required for flow control" msgstr "Both RX and TX required for flow control" -#: ports/atmel-samd/boards/circuitplayground_express/mpconfigboard.h -#: ports/atmel-samd/boards/circuitplayground_express_crickit/mpconfigboard.h -#: ports/atmel-samd/boards/circuitplayground_express_displayio/mpconfigboard.h -#: ports/atmel-samd/boards/meowmeow/mpconfigboard.h -msgid "Both buttons were pressed at start up.\n" -msgstr "" - #: ports/atmel-samd/common-hal/rotaryio/IncrementalEncoder.c msgid "Both pins must support hardware interrupts" msgstr "Both pins must support hardware interrupts" @@ -663,11 +670,6 @@ msgstr "" msgid "Bus pin %d is already in use" msgstr "Bus pin %d is already in use" -#: ports/espressif/boards/m5stack_core_basic/mpconfigboard.h -#: ports/espressif/boards/m5stack_core_fire/mpconfigboard.h -msgid "Button A was pressed at start up.\n" -msgstr "" - #: shared-bindings/_bleio/UUID.c msgid "Byte buffer must be 16 bytes." msgstr "Byte buffer must be 16 bytes." @@ -798,10 +800,6 @@ msgstr "CharacteristicBuffer writing not provided" msgid "CircuitPython core code crashed hard. Whoops!\n" msgstr "CircuitPython core code crashed hard. Crikey!\n" -#: supervisor/shared/safe_mode.c -msgid "CircuitPython was unable to allocate the heap." -msgstr "CircuitPython was unable to allocate the heap." - #: shared-module/bitbangio/I2C.c msgid "Clock stretch too long" msgstr "Clock stretch too long" @@ -842,10 +840,6 @@ msgstr "Could not start interrupt, RX busy" msgid "Couldn't allocate decoder" msgstr "Couldn't allocate decoder" -#: supervisor/shared/safe_mode.c -msgid "Crash into the HardFault_Handler." -msgstr "Crash into the HardFault_Handler." - #: ports/stm/common-hal/analogio/AnalogOut.c msgid "DAC Channel Init Error" msgstr "DAC channel init error" @@ -908,6 +902,10 @@ msgstr "" msgid "Drive mode not used when direction is input." msgstr "Drive mode not used when direction is input." +#: py/obj.c +msgid "During handling of the above exception, another exception occurred:" +msgstr "" + #: shared-bindings/aesio/aes.c msgid "ECB only operates on 16 bytes at a time" msgstr "ECB only operates on 16 bytes at a time" @@ -933,24 +931,16 @@ msgstr "Error in MIDI stream at position %d" msgid "Error in regex" msgstr "Error in regex" +#: supervisor/shared/safe_mode.c +msgid "Error in safemode.py." +msgstr "" + #: shared-bindings/socketpool/Socket.c shared-bindings/ssl/SSLSocket.c msgid "Error: Failure to bind" msgstr "Error: Failure to bind" -#: py/enum.c shared-bindings/_bleio/__init__.c shared-bindings/aesio/aes.c -#: shared-bindings/alarm/__init__.c shared-bindings/alarm/coproc/CoprocAlarm.c -#: shared-bindings/busio/SPI.c shared-bindings/coproc/Coproc.c -#: shared-bindings/coproc/__init__.c shared-bindings/microcontroller/Pin.c -#: shared-bindings/neopixel_write/__init__.c -msgid "Expected a %q" -msgstr "Expected a %q" - -#: ports/raspberrypi/bindings/cyw43/__init__.c -msgid "Expected a %q or %q" -msgstr "" - #: shared-bindings/alarm/__init__.c -msgid "Expected an %q" +msgid "Expected a kind of %q" msgstr "" #: ports/espressif/common-hal/_bleio/Adapter.c @@ -1018,13 +1008,17 @@ msgid "Failed to write internal flash." msgstr "Failed to write internal flash." #: supervisor/shared/safe_mode.c -msgid "Fatal error." -msgstr "Fatal error." +msgid "Fault detected by hardware." +msgstr "" #: py/moduerrno.c msgid "File exists" msgstr "File exists" +#: shared-module/os/getenv.c +msgid "File not found" +msgstr "" + #: ports/atmel-samd/common-hal/canio/Listener.c #: ports/espressif/common-hal/canio/Listener.c #: ports/stm/common-hal/canio/Listener.c @@ -1039,7 +1033,6 @@ msgstr "" msgid "Firmware is invalid" msgstr "" -#: ports/espressif/common-hal/coproc/Coproc.c #: ports/espressif/common-hal/dualbank/__init__.c msgid "Firmware is too big" msgstr "" @@ -1081,6 +1074,8 @@ msgstr "Generic Failure" #: shared-bindings/displayio/Display.c #: shared-bindings/displayio/EPaperDisplay.c #: shared-bindings/framebufferio/FramebufferDisplay.c +#: shared-module/displayio/Display.c +#: shared-module/framebufferio/FramebufferDisplay.c msgid "Group already used" msgstr "Group already used" @@ -1101,6 +1096,15 @@ msgstr "Hardware busy, try alternative pins" msgid "Hardware in use, try alternative pins" msgstr "Hardware in use, try alternative pins" +#: supervisor/shared/safe_mode.c +msgid "Heap allocation when VM not running." +msgstr "" + +#: supervisor/shared/safe_mode.c +msgid "" +"Heap was corrupted because the stack was too small. Increase stack size." +msgstr "" + #: extmod/vfs_posix_file.c py/objstringio.c msgid "I/O operation on closed file" msgstr "I/O operation on closed file" @@ -1118,11 +1122,6 @@ msgstr "I2C peripheral in use" msgid "I2SOut not available" msgstr "I2SOut not available" -#: shared-bindings/aesio/aes.c -#, c-format -msgid "IV must be %d bytes long" -msgstr "IV must be %d bytes long" - #: ports/raspberrypi/bindings/rp2pio/StateMachine.c msgid "In-buffer elements must be <= 4 bytes long" msgstr "In-buffer elements must be <= 4 bytes long" @@ -1209,6 +1208,7 @@ msgid "Internal define error" msgstr "Internal define error" #: ports/espressif/common-hal/paralleldisplay/ParallelBus.c +#: shared-module/os/getenv.c msgid "Internal error" msgstr "" @@ -1221,6 +1221,10 @@ msgstr "Internal error #%d" msgid "Internal watchdog timer expired." msgstr "" +#: supervisor/shared/safe_mode.c +msgid "Interrupt error." +msgstr "" + #: py/argcheck.c shared-bindings/digitalio/DigitalInOut.c msgid "Invalid %q" msgstr "Invalid %q" @@ -1255,6 +1259,11 @@ msgstr "Invalid argument" msgid "Invalid bits per value" msgstr "Invalid bits per value" +#: shared-module/os/getenv.c +#, c-format +msgid "Invalid byte %.*s" +msgstr "" + #: ports/atmel-samd/common-hal/imagecapture/ParallelImageCapture.c #, c-format msgid "Invalid data_pins[%d]" @@ -1264,18 +1273,10 @@ msgstr "Invalid data_pins[%d]" msgid "Invalid format chunk size" msgstr "Invalid format chunk size" -#: supervisor/shared/safe_mode.c -msgid "Invalid memory access." -msgstr "Invalid memory access." - #: ports/espressif/common-hal/wifi/Radio.c msgid "Invalid multicast MAC address" msgstr "" -#: shared-bindings/busio/UART.c -msgid "Invalid pins" -msgstr "Invalid pins" - #: ports/espressif/common-hal/espidf/__init__.c ports/espressif/esp_error.c msgid "Invalid size" msgstr "Invalid size" @@ -1289,10 +1290,18 @@ msgstr "Invalid socket for TLS" msgid "Invalid state" msgstr "Invalid state" +#: shared-module/os/getenv.c +msgid "Invalid unicode escape" +msgstr "" + #: 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" +#: shared-module/os/getenv.c +msgid "Key not found" +msgstr "" + #: shared-module/is31fl3741/FrameBuffer.c msgid "LED mappings must match display size" msgstr "" @@ -1399,6 +1408,10 @@ msgstr "NLR jump failed. Likely memory corruption." msgid "NVS Error" msgstr "NVS Error" +#: shared-bindings/socketpool/SocketPool.c +msgid "Name or service not known" +msgstr "" + #: py/qstr.c msgid "Name too long" msgstr "Name too long" @@ -1513,11 +1526,6 @@ msgstr "No key was specified" msgid "No long integer support" msgstr "No long integer support" -#: shared-module/usb_hid/__init__.c -#, c-format -msgid "No more than %d HID devices allowed" -msgstr "No more than %d HID devices allowed" - #: shared-bindings/wifi/Radio.c msgid "No network with that ssid" msgstr "No network with that ssid" @@ -1553,10 +1561,6 @@ msgstr "No such file/directory" msgid "No timer available" msgstr "No timer available" -#: supervisor/shared/safe_mode.c -msgid "Nordic system firmware failure assertion." -msgstr "Nordic system firmware failure assertion." - #: ports/nrf/common-hal/_bleio/__init__.c msgid "Nordic system firmware out of memory" msgstr "Nordic system firmware out of memory" @@ -1576,10 +1580,6 @@ msgstr "Not connected" msgid "Not playing" msgstr "Not playing" -#: shared-bindings/_bleio/__init__.c -msgid "Not settable" -msgstr "Not settable" - #: ports/espressif/common-hal/paralleldisplay/ParallelBus.c #, c-format msgid "Number of data_pins must be 8 or 16, not %d" @@ -1646,11 +1646,14 @@ msgstr "" "Only monochrome, indexed 4bpp or 8bpp, and 16bpp or greater BMPs supported: " "%d bpp given" -#: ports/espressif/common-hal/alarm/coproc/CoprocAlarm.c #: ports/espressif/common-hal/alarm/touch/TouchAlarm.c msgid "Only one %q can be set in deep sleep." msgstr "" +#: ports/espressif/common-hal/espulp/ULPAlarm.c +msgid "Only one %q can be set." +msgstr "" + #: ports/espressif/common-hal/i2ctarget/I2CTarget.c #: ports/raspberrypi/common-hal/i2ctarget/I2CTarget.c msgid "Only one address is allowed" @@ -1683,6 +1686,10 @@ msgstr "Operation or feature not supported" msgid "Operation timed out" msgstr "Operation timed out" +#: ports/raspberrypi/common-hal/mdns/Server.c +msgid "Out of MDNS service slots" +msgstr "" + #: ports/espressif/common-hal/espidf/__init__.c ports/espressif/esp_error.c msgid "Out of memory" msgstr "Out of memory" @@ -1810,6 +1817,10 @@ msgstr "Program does OUT without loading OSR" msgid "Program size invalid" msgstr "Program size invalid" +#: ports/espressif/common-hal/espulp/ULP.c +msgid "Program too long" +msgstr "" + #: shared-bindings/digitalio/DigitalInOut.c msgid "Pull not used when direction is output." msgstr "Pull not used when direction is output." @@ -1849,8 +1860,9 @@ msgstr "RTC is not supported on this board" msgid "Random number generation error" msgstr "Random number generation error" +#: shared-bindings/_bleio/__init__.c #: shared-bindings/memorymonitor/AllocationSize.c -#: shared-bindings/pulseio/PulseIn.c +#: shared-bindings/pulseio/PulseIn.c shared-module/displayio/Bitmap.c msgid "Read-only" msgstr "Read-only" @@ -1858,10 +1870,6 @@ msgstr "Read-only" msgid "Read-only filesystem" msgstr "Read-only filesystem" -#: shared-module/displayio/Bitmap.c -msgid "Read-only object" -msgstr "Read-only object" - #: ports/espressif/common-hal/espidf/__init__.c ports/espressif/esp_error.c msgid "Received response was invalid" msgstr "Received response was invalid" @@ -1954,7 +1962,7 @@ msgstr "Size not supported" msgid "Sleep Memory not available" msgstr "Sleep Memory not available" -#: shared-bindings/alarm/SleepMemory.c shared-bindings/coproc/CoprocMemory.c +#: shared-bindings/alarm/SleepMemory.c shared-bindings/memorymap/AddressRange.c #: shared-bindings/nvm/ByteArray.c msgid "Slice and value different lengths." msgstr "Slice and value different lengths." @@ -1991,6 +1999,10 @@ 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" +#: ports/raspberrypi/common-hal/wifi/Radio.c +msgid "Stopping AP is not supported." +msgstr "" + #: 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" @@ -2008,39 +2020,11 @@ msgid "Temperature read timed out" msgstr "Temperature read timed out" #: supervisor/shared/safe_mode.c -msgid "The BOOT button was pressed at start up.\n" +msgid "The `microcontroller` module was used to boot into safe mode." msgstr "" -#: supervisor/shared/safe_mode.c -msgid "" -"The CircuitPython heap was corrupted because the stack was too small.\n" -"Increase the stack size if you know how. If not:" -msgstr "" -"The CircuitPython heap was corrupted because the stack was too small.\n" -"Increase the stack size if you know how. If not:" - -#: ports/espressif/boards/adafruit_feather_esp32_v2/mpconfigboard.h -msgid "The SW38 button was pressed at start up.\n" -msgstr "" - -#: ports/espressif/boards/hardkernel_odroid_go/mpconfigboard.h -msgid "The VOLUME button was pressed at start up.\n" -msgstr "" - -#: supervisor/shared/safe_mode.c -msgid "" -"The `microcontroller` module was used to boot into safe mode. Press reset to " -"exit safe mode." -msgstr "" -"The `microcontroller` module was used to boot into safe mode. Press reset to " -"exit safe mode." - -#: ports/espressif/boards/m5stack_atom_lite/mpconfigboard.h -msgid "The central button was pressed at start up.\n" -msgstr "" - -#: ports/nrf/boards/aramcon2_badge/mpconfigboard.h -msgid "The left button was pressed at start up.\n" +#: py/obj.c +msgid "The above exception was the direct cause of the following exception:" msgstr "" #: shared-bindings/rgbmatrix/RGBMatrix.c @@ -2048,14 +2032,8 @@ msgid "The length of rgb_pins must be 6, 12, 18, 24, or 30" msgstr "The length of rgb_pins must be 6, 12, 18, 24, or 30" #: supervisor/shared/safe_mode.c -msgid "" -"The microcontroller's power dipped. Make sure your power supply provides\n" -"enough power for the whole circuit and press reset (after ejecting " -"CIRCUITPY)." +msgid "The power dipped. Make sure you are providing enough power." msgstr "" -"The microcontroller's power dipped. Make sure your power supply provides\n" -"enough power for the whole circuit and press reset (after ejecting " -"CIRCUITPY)." #: shared-module/audiomixer/MixerVoice.c msgid "The sample's bits_per_sample does not match the mixer's" @@ -2073,6 +2051,10 @@ msgstr "The sample's sample rate does not match the mixer's" msgid "The sample's signedness does not match the mixer's" msgstr "The sample's signedness does not match the mixer's" +#: supervisor/shared/safe_mode.c +msgid "Third-party firmware fatal error." +msgstr "" + #: shared-module/imagecapture/ParallelImageCapture.c msgid "This microcontroller does not support continuous capture." msgstr "" @@ -2105,10 +2087,6 @@ msgstr "Time is in the past." msgid "Timeout is too long: Maximum timeout length is %d seconds" msgstr "Timeout is too long: Maximum timeout length is %d seconds" -#: supervisor/shared/safe_mode.c -msgid "To exit, please reset the board without requesting safe mode." -msgstr "" - #: ports/atmel-samd/common-hal/audiobusio/I2SOut.c msgid "Too many channels in sample" msgstr "" @@ -2153,6 +2131,10 @@ msgstr "" msgid "UART init" msgstr "" +#: ports/raspberrypi/common-hal/busio/UART.c +msgid "UART peripheral in use" +msgstr "" + #: ports/stm/common-hal/busio/UART.c msgid "UART re-init" msgstr "" @@ -2200,6 +2182,10 @@ msgstr "UUID value is not str, int or byte buffer" msgid "Unable to allocate buffers for signed conversion" msgstr "Unable to allocate buffers for signed conversion" +#: supervisor/shared/safe_mode.c +msgid "Unable to allocate the heap." +msgstr "" + #: ports/espressif/common-hal/busio/I2C.c msgid "Unable to create lock" msgstr "Unable to create lock" @@ -2223,11 +2209,12 @@ msgid "Unable to read color palette data" msgstr "Unable to read colour palette data" #: ports/espressif/common-hal/mdns/Server.c +#: ports/raspberrypi/common-hal/mdns/Server.c msgid "Unable to start mDNS query" msgstr "" -#: shared-bindings/coproc/CoprocMemory.c -msgid "Unable to write" +#: shared-bindings/memorymap/AddressRange.c +msgid "Unable to write to address." msgstr "" #: shared-bindings/nvm/ByteArray.c @@ -2298,6 +2285,7 @@ msgid "Unkown error code %d" msgstr "" #: shared-bindings/adafruit_pixelbuf/PixelBuf.c +#: shared-module/_pixelmap/PixelMap.c #, c-format msgid "Unmatched number of items on RHS (expected %d, got %d)." msgstr "Unmatched number of items on RHS (expected %d, got %d)." @@ -2384,6 +2372,18 @@ msgstr "" msgid "Wi-Fi: " msgstr "" +#: ports/raspberrypi/common-hal/wifi/Radio.c +msgid "Wifi is in access point mode." +msgstr "" + +#: ports/raspberrypi/common-hal/wifi/Radio.c +msgid "Wifi is in station mode." +msgstr "" + +#: ports/raspberrypi/common-hal/wifi/Radio.c +msgid "Wifi is not enabled" +msgstr "" + #: main.c msgid "Woken up by alarm.\n" msgstr "Woken up by alarm.\n" @@ -2393,15 +2393,49 @@ msgstr "Woken up by alarm.\n" msgid "Writes not supported on Characteristic" msgstr "Writes not supported on Characteristic" -#: supervisor/shared/safe_mode.c -msgid "You are in safe mode because:\n" -msgstr "You are in safe mode because:\n" +#: ports/atmel-samd/boards/circuitplayground_express/mpconfigboard.h +#: ports/atmel-samd/boards/circuitplayground_express_crickit/mpconfigboard.h +#: ports/atmel-samd/boards/circuitplayground_express_displayio/mpconfigboard.h +#: ports/atmel-samd/boards/meowmeow/mpconfigboard.h +msgid "You pressed both buttons at start up." +msgstr "" + +#: ports/espressif/boards/m5stack_core_basic/mpconfigboard.h +#: ports/espressif/boards/m5stack_core_fire/mpconfigboard.h +#: ports/espressif/boards/m5stack_stick_c/mpconfigboard.h +msgid "You pressed button A at start up." +msgstr "" #: supervisor/shared/safe_mode.c -msgid "" -"You pressed the reset button during boot. Press again to exit safe mode." +msgid "You pressed the BOOT button at start up" +msgstr "" + +#: ports/espressif/boards/adafruit_feather_esp32_v2/mpconfigboard.h +msgid "You pressed the SW38 button at start up." +msgstr "" + +#: ports/espressif/boards/hardkernel_odroid_go/mpconfigboard.h +msgid "You pressed the VOLUME button at start up." +msgstr "" + +#: ports/espressif/boards/m5stack_atom_echo/mpconfigboard.h +#: ports/espressif/boards/m5stack_atom_lite/mpconfigboard.h +#: ports/espressif/boards/m5stack_atom_matrix/mpconfigboard.h +#: ports/espressif/boards/m5stack_atom_u/mpconfigboard.h +msgid "You pressed the central button at start up." +msgstr "" + +#: ports/nrf/boards/aramcon2_badge/mpconfigboard.h +msgid "You pressed the left button at start up." +msgstr "" + +#: supervisor/shared/safe_mode.c +msgid "You pressed the reset button during boot." +msgstr "" + +#: supervisor/shared/micropython.c +msgid "[truncated due to length]" msgstr "" -"You pressed the reset button during boot. Press again to exit safe mode." #: py/objtype.c msgid "__init__() should return None" @@ -2472,8 +2506,12 @@ msgstr "array and index length must be equal" msgid "array has too many dimensions" msgstr "" +#: extmod/ulab/code/ndarray.c +msgid "array is too big" +msgstr "" + #: py/objarray.c shared-bindings/alarm/SleepMemory.c -#: shared-bindings/coproc/CoprocMemory.c shared-bindings/nvm/ByteArray.c +#: shared-bindings/memorymap/AddressRange.c shared-bindings/nvm/ByteArray.c msgid "array/bytes required on right side" msgstr "array/bytes required on right side" @@ -2566,10 +2604,6 @@ msgstr "Buffer too small" msgid "buffer too small for requested bytes" msgstr "Buffer too small for requested bytes" -#: shared-bindings/adafruit_pixelbuf/PixelBuf.c -msgid "byteorder is not a string" -msgstr "Byteorder is not a string" - #: py/objarray.c msgid "bytes length not a multiple of item size" msgstr "Bytes length not a multiple of item size" @@ -2611,14 +2645,10 @@ msgstr "Can't assign to expression" msgid "can't cancel self" msgstr "can't cancel self" -#: py/obj.c py/objint.c shared-module/adafruit_pixelbuf/PixelBuf.c +#: py/obj.c py/objint.c py/runtime.c shared-module/adafruit_pixelbuf/PixelBuf.c msgid "can't convert %q to %q" msgstr "Can't convert %q to %q" -#: py/runtime.c -msgid "can't convert %q to int" -msgstr "can't convert %q to int" - #: py/obj.c #, c-format msgid "can't convert %s to complex" @@ -2700,6 +2730,10 @@ msgstr "can't set 512 block size" msgid "can't set attribute" msgstr "can't set attribute" +#: py/runtime.c +msgid "can't set attribute '%q'" +msgstr "" + #: py/emitnative.c msgid "can't store '%q'" msgstr "can't store '%q'" @@ -2804,10 +2838,6 @@ msgstr "colour must be between 0x000000 and 0xffffff" msgid "comparison of int and uint" msgstr "comparison of int and uint" -#: py/objcomplex.c -msgid "complex division by zero" -msgstr "complex division by zero" - #: py/objfloat.c py/parsenum.c msgid "complex values not supported" msgstr "complex values not supported" @@ -2911,12 +2941,11 @@ msgstr "dimensions do not match" msgid "div/mod not implemented for uint" msgstr "div/mod not implemented for uint" -#: py/objfloat.c py/objint_mpz.c +#: extmod/ulab/code/numpy/create.c msgid "divide by zero" msgstr "divide by zero" -#: py/modmath.c py/objint_longlong.c py/runtime.c -#: shared-bindings/math/__init__.c +#: py/runtime.c msgid "division by zero" msgstr "division by zero" @@ -2957,9 +2986,9 @@ msgstr "epoch_time not supported on this board" msgid "error = 0x%08lX" msgstr "error = 0x%08lX" -#: ports/espressif/common-hal/esp32_camera/Camera.c +#: ports/espressif/common-hal/espcamera/Camera.c msgid "" -"esp32_camera.Camera requires reserved PSRAM to be configured. See the " +"espcamera.Camera requires reserved PSRAM to be configured. See the " "documentation for instructions." msgstr "" @@ -2967,14 +2996,6 @@ msgstr "" msgid "exceptions must derive from BaseException" msgstr "exceptions must derive from BaseException" -#: shared-bindings/canio/CAN.c -msgid "expected '%q' but got '%q'" -msgstr "expected '%q' but got '%q'" - -#: shared-bindings/canio/CAN.c -msgid "expected '%q' or '%q' but got '%q'" -msgstr "expected '%q' or '%q' but got '%q'" - #: py/objstr.c msgid "expected ':' after format specifier" msgstr "expected ':' after format specifier" @@ -3073,10 +3094,6 @@ msgstr "font must be 2048 bytes long" msgid "format requires a dict" msgstr "format requires a dict" -#: shared-bindings/microcontroller/Processor.c -msgid "frequency is read-only for this board" -msgstr "" - #: py/objdeque.c msgid "full" msgstr "full" @@ -3189,8 +3206,12 @@ msgstr "incorrect padding" msgid "index is out of bounds" msgstr "index is out of bounds" +#: shared-bindings/_pixelmap/PixelMap.c +msgid "index must be tuple or int" +msgstr "" + #: extmod/ulab/code/numpy/numerical.c extmod/ulab/code/ulab_tools.c -#: ports/espressif/common-hal/pulseio/PulseIn.c py/obj.c +#: ports/espressif/common-hal/pulseio/PulseIn.c #: shared-bindings/bitmaptools/__init__.c msgid "index out of range" msgstr "index out of range" @@ -3288,10 +3309,6 @@ msgstr "input vectors must be of equal length" msgid "inputs are not iterable" msgstr "inputs are not iterable" -#: py/parsenum.c -msgid "int() arg 2 must be >= 2 and <= 36" -msgstr "int() arg 2 must be >= 2 and <= 36" - #: extmod/ulab/code/numpy/approx.c msgid "interp is defined for 1D iterables of equal length" msgstr "interp is defined for 1D iterables of equal length" @@ -3348,7 +3365,7 @@ msgstr "invalid key" msgid "invalid micropython decorator" msgstr "invalid micropython decorator" -#: ports/espressif/common-hal/esp32_camera/Camera.c +#: ports/espressif/common-hal/espcamera/Camera.c msgid "invalid setting" msgstr "" @@ -3373,10 +3390,6 @@ msgstr "invalid syntax for integer with base %d" msgid "invalid syntax for number" msgstr "invalid syntax for number" -#: py/objexcept.c -msgid "invalid traceback" -msgstr "invalid traceback" - #: py/objtype.c msgid "issubclass() arg 1 must be a class" msgstr "issubclass() arg 1 must be a class" @@ -3433,19 +3446,17 @@ msgstr "local '%q' used before type known" msgid "local variable referenced before assignment" msgstr "local variable referenced before assignment" -#: py/objint.c -msgid "long int not supported in this build" -msgstr "long int not supported in this build" - #: ports/espressif/common-hal/canio/CAN.c msgid "loopback + silent mode not supported by peripheral" msgstr "loopback + silent mode not supported by peripheral" #: ports/espressif/common-hal/mdns/Server.c +#: ports/raspberrypi/common-hal/mdns/Server.c msgid "mDNS already initialized" msgstr "" #: ports/espressif/common-hal/mdns/Server.c +#: ports/raspberrypi/common-hal/mdns/Server.c msgid "mDNS only works with built-in WiFi" msgstr "" @@ -3574,6 +3585,10 @@ msgstr "negative power with no float support" msgid "negative shift count" msgstr "negative shift count" +#: shared-bindings/_pixelmap/PixelMap.c +msgid "nested index must be int" +msgstr "" + #: shared-module/sdcardio/SDCard.c msgid "no SD card" msgstr "no SD card" @@ -3607,7 +3622,7 @@ msgstr "no reset pin available" msgid "no response from SD card" msgstr "no response from SD card" -#: ports/espressif/common-hal/esp32_camera/Camera.c py/objobject.c py/runtime.c +#: ports/espressif/common-hal/espcamera/Camera.c py/objobject.c py/runtime.c msgid "no such attribute" msgstr "no such attribute" @@ -3743,6 +3758,10 @@ msgstr "only bit_depth=16 is supported" msgid "only mono is supported" msgstr "" +#: extmod/ulab/code/numpy/create.c +msgid "only ndarrays can be concatenated" +msgstr "" + #: ports/stm/common-hal/audiobusio/PDMIn.c msgid "only oversample=64 is supported" msgstr "" @@ -3753,7 +3772,7 @@ msgid "only sample_rate=16000 is supported" msgstr "only sample_rate=16000 is supported" #: py/objarray.c py/objstr.c py/objstrunicode.c py/objtuple.c -#: shared-bindings/alarm/SleepMemory.c shared-bindings/coproc/CoprocMemory.c +#: shared-bindings/alarm/SleepMemory.c shared-bindings/memorymap/AddressRange.c #: shared-bindings/nvm/ByteArray.c msgid "only slices with step=1 (aka None) are supported" msgstr "only slices with step=1 (aka None) are supported" @@ -3969,10 +3988,6 @@ msgstr "sleep length must be non-negative" msgid "slice step can't be zero" msgstr "slice step can't be zero" -#: py/objslice.c -msgid "slice step cannot be zero" -msgstr "slice step cannot be zero" - #: py/nativeglue.c msgid "slice unsupported" msgstr "slice unsupported" @@ -4021,10 +4036,6 @@ msgstr "" msgid "start/end indices" msgstr "start/end indices" -#: shared-bindings/random/__init__.c -msgid "step must be non-zero" -msgstr "step must be non-zero" - #: shared-bindings/random/__init__.c msgid "stop not reachable from start" msgstr "stop not reachable from start" @@ -4033,10 +4044,6 @@ msgstr "stop not reachable from start" msgid "stream operation not supported" msgstr "stream operation not supported" -#: py/objstrunicode.c -msgid "string indices must be integers, not %q" -msgstr "string indices must be integers, not %q" - #: py/stream.c msgid "string not supported; use bytes or bytearray" msgstr "string not supported; use bytes or bytearray" @@ -4069,10 +4076,6 @@ msgstr "syntax error in JSON" msgid "syntax error in uctypes descriptor" msgstr "syntax error in uctypes descriptor" -#: shared-bindings/time/__init__.c -msgid "time.struct_time() takes a 9-sequence" -msgstr "time.struct_time() takes a 9-sequence" - #: ports/atmel-samd/common-hal/watchdog/WatchDogTimer.c #: ports/espressif/common-hal/watchdog/WatchDogTimer.c #: ports/nrf/common-hal/watchdog/WatchDogTimer.c @@ -4354,10 +4357,6 @@ msgstr "xTaskCreate failed" msgid "y value out of bounds" msgstr "y value out of bounds" -#: py/objrange.c -msgid "zero step" -msgstr "zero step" - #: extmod/ulab/code/scipy/signal/signal.c msgid "zi must be an ndarray" msgstr "zi must be an ndarray" @@ -4370,6 +4369,132 @@ 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 "" +#~ "\n" +#~ "Please file an issue with the contents of your CIRCUITPY drive at \n" +#~ "https://github.com/adafruit/circuitpython/issues\n" +#~ msgstr "" +#~ "\n" +#~ "Please file an issue with the contents of your CIRCUITPY drive at \n" +#~ "https://github.com/adafruit/circuitpython/issues\n" + +#~ msgid "Attempted heap allocation when VM not running." +#~ msgstr "Attempted heap allocation when VM not running." + +#~ msgid "CircuitPython was unable to allocate the heap." +#~ msgstr "CircuitPython was unable to allocate the heap." + +#~ msgid "Crash into the HardFault_Handler." +#~ msgstr "Crash into the HardFault_Handler." + +#~ msgid "Fatal error." +#~ msgstr "Fatal error." + +#~ msgid "Invalid memory access." +#~ msgstr "Invalid memory access." + +#~ msgid "Nordic system firmware failure assertion." +#~ msgstr "Nordic system firmware failure assertion." + +#~ msgid "" +#~ "The CircuitPython heap was corrupted because the stack was too small.\n" +#~ "Increase the stack size if you know how. If not:" +#~ msgstr "" +#~ "The CircuitPython heap was corrupted because the stack was too small.\n" +#~ "Increase the stack size if you know how. If not:" + +#~ msgid "" +#~ "The `microcontroller` module was used to boot into safe mode. Press reset " +#~ "to exit safe mode." +#~ msgstr "" +#~ "The `microcontroller` module was used to boot into safe mode. Press reset " +#~ "to exit safe mode." + +#~ msgid "" +#~ "The microcontroller's power dipped. Make sure your power supply provides\n" +#~ "enough power for the whole circuit and press reset (after ejecting " +#~ "CIRCUITPY)." +#~ msgstr "" +#~ "The microcontroller's power dipped. Make sure your power supply provides\n" +#~ "enough power for the whole circuit and press reset (after ejecting " +#~ "CIRCUITPY)." + +#~ msgid "You are in safe mode because:\n" +#~ msgstr "You are in safe mode because:\n" + +#~ msgid "" +#~ "You pressed the reset button during boot. Press again to exit safe mode." +#~ msgstr "" +#~ "You pressed the reset button during boot. Press again to exit safe mode." + +#~ msgid "Expected a %q" +#~ msgstr "Expected a %q" + +#, c-format +#~ msgid "IV must be %d bytes long" +#~ msgstr "IV must be %d bytes long" + +#~ msgid "Not settable" +#~ msgstr "Not settable" + +#~ msgid "expected '%q' but got '%q'" +#~ msgstr "expected '%q' but got '%q'" + +#~ msgid "expected '%q' or '%q' but got '%q'" +#~ msgstr "expected '%q' or '%q' but got '%q'" + +#~ msgid "Read-only object" +#~ msgstr "Read-only object" + +#~ msgid "%q length must be >= 1" +#~ msgstr "%q length must be >= 1" + +#~ msgid "%q must be a string" +#~ msgstr "%q must be a string" + +#~ msgid "At most %d %q may be specified (not %d)" +#~ msgstr "At most %d %q may be specified (not %d)" + +#~ msgid "Invalid pins" +#~ msgstr "Invalid pins" + +#, c-format +#~ msgid "No more than %d HID devices allowed" +#~ msgstr "No more than %d HID devices allowed" + +#~ msgid "byteorder is not a string" +#~ msgstr "Byteorder is not a string" + +#~ msgid "can't convert %q to int" +#~ msgstr "can't convert %q to int" + +#~ msgid "complex division by zero" +#~ msgstr "complex division by zero" + +#~ msgid "int() arg 2 must be >= 2 and <= 36" +#~ msgstr "int() arg 2 must be >= 2 and <= 36" + +#~ msgid "long int not supported in this build" +#~ msgstr "long int not supported in this build" + +#~ msgid "slice step cannot be zero" +#~ msgstr "slice step cannot be zero" + +#~ msgid "step must be non-zero" +#~ msgstr "step must be non-zero" + +#~ msgid "string indices must be integers, not %q" +#~ msgstr "string indices must be integers, not %q" + +#~ msgid "time.struct_time() takes a 9-sequence" +#~ msgstr "time.struct_time() takes a 9-sequence" + +#~ msgid "zero step" +#~ msgstr "zero step" + +#~ msgid "invalid traceback" +#~ msgstr "invalid traceback" + #~ msgid "%q indices must be integers, not %s" #~ msgstr "%q indices must be integers, not %s" diff --git a/locale/es.po b/locale/es.po index 13cb9a3821..3ca89f4430 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: 2022-09-23 17:20+0000\n" -"Last-Translator: Alvaro Figueroa \n" +"PO-Revision-Date: 2023-02-17 20:38+0000\n" +"Last-Translator: Jose David M \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.14.1\n" +"X-Generator: Weblate 4.16-dev\n" #: main.c msgid "" @@ -37,12 +37,28 @@ msgstr "" #: supervisor/shared/safe_mode.c msgid "" "\n" -"Please file an issue with the contents of your CIRCUITPY drive at \n" -"https://github.com/adafruit/circuitpython/issues\n" +"Please file an issue with your program at https://github.com/adafruit/" +"circuitpython/issues." msgstr "" "\n" -"Presente un problema con el contenido de su unidad CIRCUITPY en\n" -"https://github.com/adafruit/circuitpython/issues\n" +"Por favor describa su problema en https://github.com/adafruit/circuitpython/" +"issues." + +#: supervisor/shared/safe_mode.c +msgid "" +"\n" +"Press reset to exit safe mode.\n" +msgstr "" +"\n" +"Presione reset para salir de safe mode.\n" + +#: supervisor/shared/safe_mode.c +msgid "" +"\n" +"You are in safe mode because:\n" +msgstr "" +"\n" +"Estas in safe mode porque:\n" #: py/obj.c msgid " File \"%q\"" @@ -72,6 +88,11 @@ msgstr "%%c requiere int o char" #: main.c #, c-format msgid "%02X" +msgstr "%02X" + +#: shared-module/os/getenv.c +#, c-format +msgid "%S" msgstr "" #: shared-bindings/rgbmatrix/RGBMatrix.c @@ -91,8 +112,7 @@ msgstr "" #: 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 +#: ports/stm/common-hal/canio/Listener.c ports/stm/common-hal/rtc/RTC.c msgid "%q" msgstr "%q" @@ -112,13 +132,18 @@ msgstr "%q contiene pines duplicados" msgid "%q failure: %d" msgstr "%q fallo: %d" +#: py/argcheck.c +msgid "%q in %q must be of type %q, not %q" +msgstr "%q en %q debe ser del tipo %q, no %q" + +#: ports/espressif/common-hal/espulp/ULP.c #: ports/raspberrypi/common-hal/rp2pio/StateMachine.c #: shared-bindings/digitalio/DigitalInOut.c #: shared-bindings/microcontroller/Pin.c msgid "%q in use" msgstr "%q está siendo utilizado" -#: py/obj.c py/objstr.c py/objstrunicode.c +#: py/objstr.c py/objstrunicode.c msgid "%q index out of range" msgstr "%q indice fuera de rango" @@ -128,9 +153,13 @@ msgstr "%q inicializado fallido" #: shared-bindings/dualbank/__init__.c msgid "%q is %q" -msgstr "" +msgstr "%q es %q" -#: py/argcheck.c +#: ports/raspberrypi/common-hal/wifi/Radio.c +msgid "%q is read-only for this board" +msgstr "%q es solamente de lectura en esta tarjeta" + +#: py/argcheck.c shared-bindings/usb_hid/Device.c msgid "%q length must be %d" msgstr "%q tamaño debe ser %d" @@ -146,10 +175,6 @@ msgstr "%q tamaño debe ser <= %d" 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 "%q tamaño debe ser >= 1" - #: py/argcheck.c msgid "%q must be %d" msgstr "%q debe ser %d" @@ -171,37 +196,32 @@ msgid "%q must be >= %d" msgstr "%q debe ser >= %d" #: shared-bindings/analogbufio/BufferedIn.c +msgid "%q must be a bytearray or array of type 'H' or 'B'" +msgstr "%q debe ser un byte-matriz o matriz de tipo 'H' o 'B'" + #: shared-bindings/audiocore/RawSample.c msgid "%q must be a bytearray or array of type 'h', 'H', 'b', or 'B'" -msgstr "" +msgstr "%q debe ser un byte-matriz o matriz de tipo 'h', 'H', 'b', o 'B'" -#: py/argcheck.c -msgid "%q must be a string" -msgstr "%q debe ser una cadena" +#: ports/raspberrypi/bindings/cyw43/__init__.c py/argcheck.c py/objexcept.c +#: shared-bindings/canio/CAN.c shared-bindings/digitalio/Pull.c +msgid "%q must be of type %q or %q, not %q" +msgstr "%q debe ser del tipo %q o %q, y no %q" -#: py/argcheck.c -msgid "%q must be an int" -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 "" +#: py/argcheck.c py/obj.c py/objstrunicode.c +msgid "%q must be of type %q, not %q" +msgstr "%q debe ser del tipo %q, y no %q" #: ports/atmel-samd/common-hal/busio/UART.c msgid "%q must be power of 2" -msgstr "" +msgstr "%q debe ser potencia de 2" #: shared-bindings/wifi/Monitor.c msgid "%q out of bounds" -msgstr "" +msgstr "%q fuera de limites" #: ports/atmel-samd/common-hal/pulseio/PulseIn.c #: ports/cxd56/common-hal/pulseio/PulseIn.c -#: ports/espressif/common-hal/coproc/Coproc.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 @@ -213,9 +233,9 @@ msgstr "%q fuera de rango" msgid "%q pin invalid" msgstr "pin inválido %q" -#: shared-bindings/usb_hid/Device.c -msgid "%q with a report ID of 0 must be of length 1" -msgstr "" +#: py/objrange.c py/objslice.c shared-bindings/random/__init__.c +msgid "%q step cannot be zero" +msgstr "%q paso no puede ser cero" #: py/bc.c py/objnamedtuple.c msgid "%q() takes %d positional arguments but %d were given" @@ -223,11 +243,11 @@ msgstr "%q() toma %d argumentos posicionales pero %d fueron dados" #: shared-bindings/usb_hid/Device.c msgid "%q, %q, and %q must all be the same length" -msgstr "" +msgstr "%q, %q, y %q deben tener el mismo largo" #: py/objint.c shared-bindings/storage/__init__.c msgid "%q=%q" -msgstr "" +msgstr "%q=%q" #: ports/espressif/common-hal/espidf/__init__.c ports/espressif/esp_error.c #, c-format @@ -314,7 +334,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" -#: ports/raspberrypi/common-hal/wifi/Radio.c py/runtime.c +#: py/runtime.c msgid "'%s' object has no attribute '%q'" msgstr "objeto '%s' no tiene atributo '%q'" @@ -414,6 +434,10 @@ msgstr "ADC2 está siendo usado por WiFi" msgid "Address must be %d bytes long" msgstr "La dirección debe tener %d bytes de largo" +#: ports/espressif/common-hal/memorymap/AddressRange.c +msgid "Address range not allowed" +msgstr "Rango de dirección no permitido" + #: ports/espressif/common-hal/canio/CAN.c msgid "All CAN peripherals are in use" msgstr "Todos los periféricos CAN están en uso" @@ -441,7 +465,6 @@ msgid "All SPI peripherals are in use" msgstr "Todos los periféricos SPI están siendo usados" #: 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 "Todos los periféricos UART están siendo usados" @@ -496,7 +519,7 @@ msgstr "Ya se encuentra publicando." msgid "Already have all-matches listener" msgstr "Ya se tiene un escucha de todas las coincidencias" -#: ports/espressif/common-hal/coproc/__init__.c +#: ports/espressif/common-hal/espulp/ULP.c #: shared-module/memorymonitor/AllocationAlarm.c #: shared-module/memorymonitor/AllocationSize.c msgid "Already running" @@ -507,6 +530,11 @@ msgstr "Ya está en ejecución" msgid "Already scanning for wifi networks" msgstr "Ya se están buscando redes wifi" +#: shared-module/os/getenv.c +#, c-format +msgid "An error occurred while retrieving '%s':\n" +msgstr "Un error ocurrió mientras recuperaba '%s':\n" + #: ports/stm/common-hal/audiopwmio/PWMAudioOut.c msgid "Another PWMAudioOut is already active" msgstr "Otra salida PWMAudioOut esta ya activada" @@ -520,27 +548,19 @@ msgstr "Otro envío ya está activo" msgid "Array must contain halfwords (type 'H')" msgstr "El array debe contener medias palabras (escriba 'H')" -#: shared-bindings/alarm/SleepMemory.c shared-bindings/coproc/CoprocMemory.c +#: shared-bindings/alarm/SleepMemory.c shared-bindings/memorymap/AddressRange.c #: shared-bindings/nvm/ByteArray.c msgid "Array values should be single bytes." msgstr "Valores del array deben ser bytes individuales." -#: shared-bindings/microcontroller/Pin.c -msgid "At most %d %q may be specified (not %d)" -msgstr "Como máximo %d %q se puede especificar (no %d)" - #: shared-module/memorymonitor/AllocationAlarm.c #, c-format msgid "Attempt to allocate %d blocks" msgstr "Tratando de localizar %d bloques" -#: supervisor/shared/safe_mode.c -msgid "Attempted heap allocation when VM not running." -msgstr "Asignación del montículo mientras la VM no esta ejecutándose." - #: ports/raspberrypi/audio_dma.c msgid "Audio conversion not implemented" -msgstr "" +msgstr "Conversión de audio no esta implementada" #: shared-bindings/wifi/Radio.c msgid "AuthMode.OPEN is not used with password" @@ -585,23 +605,16 @@ msgstr "Bits depth debe ser múltiplo de 8." #: shared-bindings/bitmaptools/__init__.c msgid "Bitmap size and bits per value must match" -msgstr "" +msgstr "El tamaño del mapa de bits y los bits por valor deben cotejar" #: supervisor/shared/safe_mode.c -msgid "Boot device must be first device (interface #0)." -msgstr "" +msgid "Boot device must be first (interface #0)." +msgstr "El dispositivo de inicialización debe estar primero (interface #0)." #: ports/mimxrt10xx/common-hal/busio/UART.c msgid "Both RX and TX required for flow control" msgstr "Ambos RX y TX requeridos para control de flujo" -#: ports/atmel-samd/boards/circuitplayground_express/mpconfigboard.h -#: ports/atmel-samd/boards/circuitplayground_express_crickit/mpconfigboard.h -#: ports/atmel-samd/boards/circuitplayground_express_displayio/mpconfigboard.h -#: ports/atmel-samd/boards/meowmeow/mpconfigboard.h -msgid "Both buttons were pressed at start up.\n" -msgstr "" - #: ports/atmel-samd/common-hal/rotaryio/IncrementalEncoder.c msgid "Both pins must support hardware interrupts" msgstr "Ambos pines deben soportar interrupciones por hardware" @@ -630,17 +643,17 @@ msgstr "" #: shared-bindings/framebufferio/FramebufferDisplay.c msgid "Buffer is not a bytearray." -msgstr "Buffer no es un bytearray." +msgstr "Búfer no es un bytearray." #: ports/cxd56/common-hal/camera/Camera.c shared-bindings/displayio/Display.c #: shared-bindings/framebufferio/FramebufferDisplay.c msgid "Buffer is too small" -msgstr "El buffer es muy pequeño" +msgstr "Búfer es muy pequeño" #: ports/stm/common-hal/audiopwmio/PWMAudioOut.c #, c-format msgid "Buffer length %d too big. It must be less than %d" -msgstr "Longitud del buffer %d es demasiado grande. Tiene que ser menor a %d" +msgstr "Longitud del búfer %d es demasiado grande. Tiene que ser menor a %d" #: ports/atmel-samd/common-hal/sdioio/SDCard.c #: ports/cxd56/common-hal/sdioio/SDCard.c shared-module/sdcardio/SDCard.c @@ -654,11 +667,11 @@ msgstr "Búfer deber ser un múltiplo de 512 bytes" #: shared-bindings/_bleio/PacketBuffer.c #, c-format msgid "Buffer too short by %d bytes" -msgstr "Búffer muy corto por %d bytes" +msgstr "Búfer muy corto por %d bytes" #: ports/espressif/common-hal/imagecapture/ParallelImageCapture.c msgid "Buffers must be same size" -msgstr "" +msgstr "Búferes deben ser del mismo tamaño" #: ports/atmel-samd/common-hal/paralleldisplay/ParallelBus.c #: ports/espressif/common-hal/paralleldisplay/ParallelBus.c @@ -668,11 +681,6 @@ msgstr "" msgid "Bus pin %d is already in use" msgstr "Bus pin %d ya está siendo utilizado" -#: ports/espressif/boards/m5stack_core_basic/mpconfigboard.h -#: ports/espressif/boards/m5stack_core_fire/mpconfigboard.h -msgid "Button A was pressed at start up.\n" -msgstr "" - #: shared-bindings/_bleio/UUID.c msgid "Byte buffer must be 16 bytes." msgstr "Búfer Byte debe de ser 16 bytes." @@ -683,7 +691,7 @@ msgstr "Los bloques CBC deben ser múltiplos de 16 bytes" #: supervisor/shared/safe_mode.c msgid "CIRCUITPY drive could not be found or created." -msgstr "" +msgstr "El dispositivo CIRCUITPY no pudo ser encontrado o creado." #: ports/espressif/common-hal/espidf/__init__.c ports/espressif/esp_error.c msgid "CRC or checksum was invalid" @@ -695,7 +703,7 @@ msgstr "Llame a super().__init__() antes de acceder al objeto nativo." #: ports/cxd56/common-hal/camera/Camera.c msgid "Camera init" -msgstr "" +msgstr "Inicialización de cámara" #: ports/espressif/common-hal/alarm/pin/PinAlarm.c msgid "Can only alarm on RTC IO from deep sleep." @@ -765,6 +773,8 @@ msgstr "No se puede remountar '/' cuanto se es visible vía USB." #: ports/mimxrt10xx/common-hal/microcontroller/__init__.c msgid "Cannot reset into bootloader because no bootloader is present" msgstr "" +"No puede se reinicilizado al bootloader porque el bootloader no se encuentra " +"presente" #: ports/espressif/common-hal/socketpool/Socket.c msgid "Cannot set socket options" @@ -785,7 +795,7 @@ 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 "" +msgstr "No puede ser transferido si los pines MOSI y MISO" #: shared-bindings/pwmio/PWMOut.c msgid "Cannot vary frequency on a timer that is already in use" @@ -793,7 +803,7 @@ msgstr "No puede variar la frecuencia en un temporizador que ya está en uso" #: ports/nrf/common-hal/alarm/pin/PinAlarm.c msgid "Cannot wake on pin edge, only level" -msgstr "" +msgstr "No puede ser despertado en transición de pin, only nivel" #: ports/espressif/common-hal/alarm/pin/PinAlarm.c msgid "Cannot wake on pin edge. Only level." @@ -807,10 +817,6 @@ msgstr "CharateristicBuffer escritura no proporcionada" msgid "CircuitPython core code crashed hard. Whoops!\n" msgstr "El código central de CircuitPython se estrelló con fuerza. ¡Whoops!\n" -#: supervisor/shared/safe_mode.c -msgid "CircuitPython was unable to allocate the heap." -msgstr "CircuitPython no puedo encontrar el montículo." - #: shared-module/bitbangio/I2C.c msgid "Clock stretch too long" msgstr "Estirado de reloj demasiado largo" @@ -851,10 +857,6 @@ msgstr "No se pudo iniciar la interrupción, RX ocupado" msgid "Couldn't allocate decoder" msgstr "No se pudo encontrar el decodificador" -#: supervisor/shared/safe_mode.c -msgid "Crash into the HardFault_Handler." -msgstr "Choque contra el HardFault_Handler." - #: ports/stm/common-hal/analogio/AnalogOut.c msgid "DAC Channel Init Error" msgstr "Error de inicio del canal DAC" @@ -912,12 +914,16 @@ msgstr "Rotación de display debe ser en incrementos de 90 grados" #: main.c msgid "Done" -msgstr "" +msgstr "Hecho" #: 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." +#: py/obj.c +msgid "During handling of the above exception, another exception occurred:" +msgstr "Durante el procesamiento de esta excepción, otra excepción ocurrió:" + #: shared-bindings/aesio/aes.c msgid "ECB only operates on 16 bytes at a time" msgstr "ECB solo opera sobre 16 bytes a la vez" @@ -943,25 +949,17 @@ msgstr "Error en el flujo MIDI en la posición %d" msgid "Error in regex" msgstr "Error en regex" +#: supervisor/shared/safe_mode.c +msgid "Error in safemode.py." +msgstr "Error en safemode.py." + #: shared-bindings/socketpool/Socket.c shared-bindings/ssl/SSLSocket.c msgid "Error: Failure to bind" msgstr "Error: fallo al vincular" -#: py/enum.c shared-bindings/_bleio/__init__.c shared-bindings/aesio/aes.c -#: shared-bindings/alarm/__init__.c shared-bindings/alarm/coproc/CoprocAlarm.c -#: shared-bindings/busio/SPI.c shared-bindings/coproc/Coproc.c -#: shared-bindings/coproc/__init__.c shared-bindings/microcontroller/Pin.c -#: shared-bindings/neopixel_write/__init__.c -msgid "Expected a %q" -msgstr "Se espera un %q" - -#: ports/raspberrypi/bindings/cyw43/__init__.c -msgid "Expected a %q or %q" -msgstr "" - #: shared-bindings/alarm/__init__.c -msgid "Expected an %q" -msgstr "" +msgid "Expected a kind of %q" +msgstr "Esperando un tipo %q" #: ports/espressif/common-hal/_bleio/Adapter.c #: ports/nrf/common-hal/_bleio/Adapter.c @@ -991,7 +989,7 @@ msgstr "No se puede adquirir el mutex, error 0x%04x" #: shared-module/rgbmatrix/RGBMatrix.c msgid "Failed to allocate %q buffer" -msgstr "" +msgstr "Fallo para asignar el %q búfer" #: ports/espressif/common-hal/wifi/__init__.c msgid "Failed to allocate Wifi memory" @@ -1028,13 +1026,17 @@ msgid "Failed to write internal flash." msgstr "Error al escribir el flash interno." #: supervisor/shared/safe_mode.c -msgid "Fatal error." -msgstr "Error grave." +msgid "Fault detected by hardware." +msgstr "Falló detectado por el hardware." #: py/moduerrno.c msgid "File exists" msgstr "El archivo ya existe" +#: shared-module/os/getenv.c +msgid "File not found" +msgstr "Archivo no encontrado" + #: ports/atmel-samd/common-hal/canio/Listener.c #: ports/espressif/common-hal/canio/Listener.c #: ports/stm/common-hal/canio/Listener.c @@ -1043,24 +1045,26 @@ msgstr "Filtros muy complejos" #: ports/espressif/common-hal/dualbank/__init__.c msgid "Firmware is duplicate" -msgstr "" +msgstr "El Firmware es duplicado" #: ports/espressif/common-hal/dualbank/__init__.c msgid "Firmware is invalid" -msgstr "" +msgstr "El Firmware es inválido" -#: ports/espressif/common-hal/coproc/Coproc.c #: ports/espressif/common-hal/dualbank/__init__.c msgid "Firmware is too big" -msgstr "" +msgstr "El Firmaware es muy grande" #: shared-bindings/bitmaptools/__init__.c msgid "For L8 colorspace, input bitmap must have 8 bits per pixel" msgstr "" +"Para el espacio de color L8, el bitmap de entrada debe tener 8 bits por pixel" #: shared-bindings/bitmaptools/__init__.c msgid "For RGB colorspaces, input bitmap must have 16 bits per pixel" msgstr "" +"Para espacios de colores RGB, el bitmap de entrada debe tener 16 bits por " +"pixel" #: ports/cxd56/common-hal/camera/Camera.c msgid "Format not supported" @@ -1070,6 +1074,8 @@ msgstr "Sin capacidades para el formato" msgid "" "Frequency must be 24, 150, 396, 450, 528, 600, 720, 816, 912, 960 or 1008 Mhz" msgstr "" +"La frecuencia debe ser 24, 150, 396, 450, 528, 600, 720, 816, 912, 960 o " +"1008 Mhz" #: shared-bindings/pwmio/PWMOut.c msgid "Frequency must match existing PWMOut using this timer" @@ -1083,7 +1089,7 @@ msgstr "La función requiere lock" #: ports/cxd56/common-hal/gnss/GNSS.c msgid "GNSS init" -msgstr "" +msgstr "Inicialización GNSS" #: ports/espressif/common-hal/espidf/__init__.c ports/espressif/esp_error.c msgid "Generic Failure" @@ -1092,6 +1098,8 @@ msgstr "Fallo Genérico" #: shared-bindings/displayio/Display.c #: shared-bindings/displayio/EPaperDisplay.c #: shared-bindings/framebufferio/FramebufferDisplay.c +#: shared-module/displayio/Display.c +#: shared-module/framebufferio/FramebufferDisplay.c msgid "Group already used" msgstr "Grupo ya está siendo utilizado" @@ -1100,7 +1108,7 @@ msgstr "Grupo ya está siendo utilizado" #: ports/mimxrt10xx/common-hal/busio/SPI.c ports/nrf/common-hal/busio/SPI.c #: ports/raspberrypi/common-hal/busio/SPI.c msgid "Half duplex SPI is not implemented" -msgstr "" +msgstr "SPI Half Duplex no está implementado" #: 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 @@ -1112,13 +1120,23 @@ msgstr "Hardware ocupado, pruebe pines alternativos" msgid "Hardware in use, try alternative pins" msgstr "Hardware en uso, pruebe pines alternativos" +#: supervisor/shared/safe_mode.c +msgid "Heap allocation when VM not running." +msgstr "Alocación del Heap cuando la VM no esta corriendo." + +#: supervisor/shared/safe_mode.c +msgid "" +"Heap was corrupted because the stack was too small. Increase stack size." +msgstr "" +"El Heap está corrupto, ya que la pila era muy pequeña. Incremente el tamaño." + #: 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 "" +msgstr "Error en la inicialización I2C" #: ports/raspberrypi/common-hal/busio/I2C.c #: ports/raspberrypi/common-hal/i2ctarget/I2CTarget.c @@ -1129,11 +1147,6 @@ msgstr "Dispositivo I2C en uso" msgid "I2SOut not available" msgstr "I2SOut no disponible" -#: shared-bindings/aesio/aes.c -#, c-format -msgid "IV must be %d bytes long" -msgstr "IV debe tener %d bytes de longitud" - #: ports/raspberrypi/bindings/rp2pio/StateMachine.c msgid "In-buffer elements must be <= 4 bytes long" msgstr "" @@ -1216,19 +1229,20 @@ msgstr "Cifrado insuficiente" #: ports/espressif/common-hal/wifi/Radio.c msgid "Interface must be started" -msgstr "" +msgstr "La interfaz debe ser iniciada" #: ports/atmel-samd/audio_dma.c ports/raspberrypi/audio_dma.c msgid "Internal audio buffer too small" -msgstr "" +msgstr "El búfer de audio interno es muy pequeño" #: ports/stm/common-hal/busio/UART.c msgid "Internal define error" msgstr "Error interno de definición" #: ports/espressif/common-hal/paralleldisplay/ParallelBus.c +#: shared-module/os/getenv.c msgid "Internal error" -msgstr "" +msgstr "Error interno" #: shared-module/rgbmatrix/RGBMatrix.c #, c-format @@ -1237,7 +1251,11 @@ msgstr "Error interno #%d" #: supervisor/shared/safe_mode.c msgid "Internal watchdog timer expired." -msgstr "" +msgstr "El temporizador interno watchdog terminó." + +#: supervisor/shared/safe_mode.c +msgid "Interrupt error." +msgstr "Error de interrupción." #: py/argcheck.c shared-bindings/digitalio/DigitalInOut.c msgid "Invalid %q" @@ -1262,7 +1280,7 @@ msgstr "BSSID inválido" #: shared-bindings/wifi/Radio.c msgid "Invalid MAC address" -msgstr "" +msgstr "Dirección MAC inválida" #: ports/espressif/common-hal/espidf/__init__.c ports/espressif/esp_error.c #: py/moduerrno.c @@ -1273,6 +1291,11 @@ msgstr "Argumento inválido" msgid "Invalid bits per value" msgstr "Inválido bits por valor" +#: shared-module/os/getenv.c +#, c-format +msgid "Invalid byte %.*s" +msgstr "byte %.*s Inválido" + #: ports/atmel-samd/common-hal/imagecapture/ParallelImageCapture.c #, c-format msgid "Invalid data_pins[%d]" @@ -1282,17 +1305,9 @@ msgstr "Inválidos los data_pins[%d]" msgid "Invalid format chunk size" msgstr "Formato de fragmento de formato no válido" -#: supervisor/shared/safe_mode.c -msgid "Invalid memory access." -msgstr "Acceso a memoria no válido." - #: ports/espressif/common-hal/wifi/Radio.c msgid "Invalid multicast MAC address" -msgstr "" - -#: shared-bindings/busio/UART.c -msgid "Invalid pins" -msgstr "pines inválidos" +msgstr "Dirección MAC de multidifusión inválida" #: ports/espressif/common-hal/espidf/__init__.c ports/espressif/esp_error.c msgid "Invalid size" @@ -1307,13 +1322,21 @@ msgstr "socket invalido para TLS" msgid "Invalid state" msgstr "Estado invalido" +#: shared-module/os/getenv.c +msgid "Invalid unicode escape" +msgstr "Unicode del caracter \"escape\" inválido" + #: 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" +#: shared-module/os/getenv.c +msgid "Key not found" +msgstr "Key no fue encontrada" + #: shared-module/is31fl3741/FrameBuffer.c msgid "LED mappings must match display size" -msgstr "" +msgstr "Los mappings LED deben coincidir con el tamaño del display" #: py/compile.c msgid "LHS of keyword arg must be an id" @@ -1321,11 +1344,11 @@ msgstr "LHS del agumento por palabra clave deberia ser un identificador" #: shared-module/displayio/Group.c msgid "Layer already in a group" -msgstr "" +msgstr "El Layer ya esta en un grupo" #: shared-module/displayio/Group.c msgid "Layer must be a Group or TileGrid subclass" -msgstr "" +msgstr "El Layer debe ser un grupo o una subclase de TileGrid" #: ports/espressif/common-hal/espidf/__init__.c ports/espressif/esp_error.c msgid "MAC address was invalid" @@ -1333,7 +1356,7 @@ msgstr "La dirección MAC es incorrecta" #: shared-bindings/is31fl3741/IS31FL3741.c msgid "Mapping must be a tuple" -msgstr "" +msgstr "El mapping debe ser una dupla" #: shared-module/displayio/Shape.c #, c-format @@ -1347,11 +1370,11 @@ msgstr "Micrófono demora de inicio debe estar en el rango 0.0 a 1.0" #: ports/raspberrypi/bindings/rp2pio/StateMachine.c #: ports/raspberrypi/common-hal/rp2pio/StateMachine.c msgid "Mismatched data size" -msgstr "" +msgstr "Inconsistencia en el tamaño de los datos" #: ports/raspberrypi/common-hal/rp2pio/StateMachine.c msgid "Mismatched swap flag" -msgstr "" +msgstr "Inconsistencia en el flag de recambio" #: ports/mimxrt10xx/common-hal/busio/SPI.c msgid "Missing MISO or MOSI Pin" @@ -1359,7 +1382,7 @@ msgstr "Falta el pin MISO o MOSI" #: ports/stm/common-hal/busio/SPI.c msgid "Missing MISO or MOSI pin" -msgstr "" +msgstr "Falta el pin MISO o MOSI" #: ports/raspberrypi/common-hal/rp2pio/StateMachine.c #, c-format @@ -1398,7 +1421,7 @@ msgstr "" #: ports/raspberrypi/common-hal/rp2pio/StateMachine.c #, c-format msgid "Missing jmp_pin. Instruction %d jumps on pin" -msgstr "" +msgstr "Falta el jmp_pin. La instrucción %d se dispara en el pin" #: shared-bindings/busio/UART.c shared-bindings/displayio/Group.c msgid "Must be a %q subclass." @@ -1421,17 +1444,21 @@ msgstr "Salto NLR falló. Probablemente corrupción de memoria." msgid "NVS Error" msgstr "Error NVS" +#: shared-bindings/socketpool/SocketPool.c +msgid "Name or service not known" +msgstr "Nombre o servicio desconocido" + #: py/qstr.c msgid "Name too long" msgstr "Nombre muy largo" #: shared-bindings/displayio/TileGrid.c msgid "New bitmap must be same size as old bitmap" -msgstr "" +msgstr "El nuevo bitmap debe ser del mismo tamaño que el bitmap anterior" #: ports/espressif/common-hal/_bleio/__init__.c msgid "Nimble out of memory" -msgstr "" +msgstr "Nimble sin memoria" #: ports/espressif/common-hal/_bleio/Characteristic.c #: ports/nrf/common-hal/_bleio/Characteristic.c @@ -1457,11 +1484,11 @@ msgstr "timer por establecedor de paso DMA no encontrado" #: shared-module/adafruit_bus_device/i2c_device/I2CDevice.c #, c-format msgid "No I2C device at address: 0x%x" -msgstr "" +msgstr "No hay dispositivo en la dirección: 0x%x" #: supervisor/shared/web_workflow/web_workflow.c msgid "No IP" -msgstr "" +msgstr "No IP" #: ports/espressif/common-hal/busio/SPI.c #: ports/mimxrt10xx/common-hal/busio/SPI.c @@ -1470,7 +1497,7 @@ msgstr "Sin pin MISO" #: ports/stm/common-hal/busio/SPI.c shared-module/bitbangio/SPI.c msgid "No MISO pin" -msgstr "" +msgstr "No pin MISO" #: ports/espressif/common-hal/busio/SPI.c #: ports/mimxrt10xx/common-hal/busio/SPI.c @@ -1479,7 +1506,7 @@ msgstr "Sin pin MOSI" #: ports/stm/common-hal/busio/SPI.c shared-module/bitbangio/SPI.c msgid "No MOSI pin" -msgstr "" +msgstr "No pin MOSI" #: ports/atmel-samd/common-hal/busio/UART.c #: ports/espressif/common-hal/busio/UART.c @@ -1501,7 +1528,7 @@ msgstr "Relojes no disponibles" #: ports/espressif/common-hal/imagecapture/ParallelImageCapture.c msgid "No capture in progress" -msgstr "" +msgstr "No hay captura en marcha" #: shared-bindings/_bleio/PacketBuffer.c msgid "No connection: length cannot be determined" @@ -1535,11 +1562,6 @@ msgstr "No se especificó ninguna llave" msgid "No long integer support" msgstr "No hay soporte de entero largo" -#: shared-module/usb_hid/__init__.c -#, c-format -msgid "No more than %d HID devices allowed" -msgstr "No se permiten más de %d dispositivos HID permitidos" - #: shared-bindings/wifi/Radio.c msgid "No network with that ssid" msgstr "No hay una red con ese ssid" @@ -1565,7 +1587,7 @@ msgstr "No queda espacio en el dispositivo" #: py/moduerrno.c msgid "No such device" -msgstr "" +msgstr "No hay tal dispositivo" #: py/moduerrno.c msgid "No such file/directory" @@ -1575,10 +1597,6 @@ msgstr "No existe el archivo/directorio" msgid "No timer available" msgstr "No hay temporizador disponible" -#: supervisor/shared/safe_mode.c -msgid "Nordic system firmware failure assertion." -msgstr "Falla en la aserción del firmware del dispositivo Nordic." - #: ports/nrf/common-hal/_bleio/__init__.c msgid "Nordic system firmware out of memory" msgstr "El firmware del sistema Nordic no tiene memoria" @@ -1598,14 +1616,10 @@ msgstr "No conectado" msgid "Not playing" msgstr "No reproduciendo" -#: shared-bindings/_bleio/__init__.c -msgid "Not settable" -msgstr "No configurable" - #: ports/espressif/common-hal/paralleldisplay/ParallelBus.c #, c-format msgid "Number of data_pins must be 8 or 16, not %d" -msgstr "" +msgstr "El numero de pines de datos debe ser 8 o 16, no %d" #: shared-bindings/util.c msgid "" @@ -1620,11 +1634,11 @@ msgstr "Paridad impar no soportada" #: supervisor/shared/bluetooth/bluetooth.c msgid "Off" -msgstr "" +msgstr "Apagado" #: supervisor/shared/bluetooth/bluetooth.c msgid "Ok" -msgstr "" +msgstr "Ok" #: ports/atmel-samd/common-hal/audiobusio/PDMIn.c #: ports/raspberrypi/common-hal/audiobusio/PDMIn.c @@ -1670,21 +1684,24 @@ msgstr "" "Solo se admiten BMP monocromáticos, indexados de 4 bpp u 8 bpp y 16 bpp o " "más: %d bpp proporcionados" -#: ports/espressif/common-hal/alarm/coproc/CoprocAlarm.c #: ports/espressif/common-hal/alarm/touch/TouchAlarm.c msgid "Only one %q can be set in deep sleep." -msgstr "" +msgstr "Solamente un %q puede ser establecido en deep sleep." + +#: ports/espressif/common-hal/espulp/ULPAlarm.c +msgid "Only one %q can be set." +msgstr "Solamente un %q puede ser establecido." #: ports/espressif/common-hal/i2ctarget/I2CTarget.c #: ports/raspberrypi/common-hal/i2ctarget/I2CTarget.c msgid "Only one address is allowed" -msgstr "" +msgstr "Solamente una dirección es permitida" #: ports/atmel-samd/common-hal/alarm/time/TimeAlarm.c #: ports/nrf/common-hal/alarm/time/TimeAlarm.c #: ports/stm/common-hal/alarm/time/TimeAlarm.c msgid "Only one alarm.time alarm can be set" -msgstr "" +msgstr "Solamente una alarma alarm.time puede ser establecida" #: ports/espressif/common-hal/alarm/time/TimeAlarm.c #: ports/raspberrypi/common-hal/alarm/time/TimeAlarm.c @@ -1697,7 +1714,7 @@ msgstr "Solo un color puede ser transparente a la vez" #: py/moduerrno.c msgid "Operation not permitted" -msgstr "" +msgstr "La operación no es permitida" #: ports/espressif/common-hal/espidf/__init__.c ports/espressif/esp_error.c msgid "Operation or feature not supported" @@ -1707,6 +1724,10 @@ msgstr "Operación no característica no soportada" msgid "Operation timed out" msgstr "Tiempo de espera agotado" +#: ports/raspberrypi/common-hal/mdns/Server.c +msgid "Out of MDNS service slots" +msgstr "No hay slots MDNS de servicio" + #: ports/espressif/common-hal/espidf/__init__.c ports/espressif/esp_error.c msgid "Out of memory" msgstr "Memoria agotada" @@ -1737,7 +1758,7 @@ msgstr "" #: ports/stm/common-hal/pwmio/PWMOut.c msgid "PWM restart" -msgstr "" +msgstr "Reinicio de PWM" #: ports/raspberrypi/common-hal/countio/Counter.c msgid "PWM slice already in use" @@ -1797,7 +1818,7 @@ msgstr "Los pines deben estar en orden secuencial" #: ports/raspberrypi/common-hal/rotaryio/IncrementalEncoder.c msgid "Pins must be sequential GPIO pins" -msgstr "" +msgstr "Los pines deben ser pines GPIO secuenciales" #: ports/raspberrypi/common-hal/audiopwmio/PWMAudioOut.c msgid "Pins must share PWM slice" @@ -1838,6 +1859,10 @@ msgstr "El programa hace OUT sin cargar OSR" msgid "Program size invalid" msgstr "El tamaño del programa no es correcto" +#: ports/espressif/common-hal/espulp/ULP.c +msgid "Program too long" +msgstr "El programa es 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." @@ -1849,7 +1874,7 @@ msgstr "El modo RAISE no esta implementado" #: ports/raspberrypi/common-hal/countio/Counter.c msgid "RISE_AND_FALL not available on this chip" -msgstr "" +msgstr "RISE_AND_FALL no esta disponible para este chip" #: ports/stm/common-hal/os/__init__.c msgid "RNG DeInit Error" @@ -1862,7 +1887,7 @@ msgstr "Error de inicialización de RNG" #: 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 "" +msgstr "RS485" #: ports/espressif/common-hal/busio/UART.c #: ports/mimxrt10xx/common-hal/busio/UART.c @@ -1877,8 +1902,9 @@ msgstr "RTC no soportado en esta placa" msgid "Random number generation error" msgstr "Error de generación de números aleatorios" +#: shared-bindings/_bleio/__init__.c #: shared-bindings/memorymonitor/AllocationSize.c -#: shared-bindings/pulseio/PulseIn.c +#: shared-bindings/pulseio/PulseIn.c shared-module/displayio/Bitmap.c msgid "Read-only" msgstr "Solo-lectura" @@ -1886,17 +1912,13 @@ msgstr "Solo-lectura" msgid "Read-only filesystem" msgstr "Sistema de archivos de solo-Lectura" -#: shared-module/displayio/Bitmap.c -msgid "Read-only object" -msgstr "Objeto de solo-lectura" - #: 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 "" +msgstr "Reconectando" #: shared-bindings/displayio/EPaperDisplay.c msgid "Refresh too soon" @@ -1929,7 +1951,7 @@ msgstr "Sin capacidad para formato CSD para tarjeta SD" #: ports/cxd56/common-hal/sdioio/SDCard.c msgid "SDCard init" -msgstr "" +msgstr "Inicialización SDCard" #: ports/stm/common-hal/sdioio/SDCard.c #, c-format @@ -1947,7 +1969,7 @@ msgstr "Configuración de SPI fallida" #: ports/stm/common-hal/busio/SPI.c msgid "SPI init error" -msgstr "" +msgstr "Error de inicialización SPI" #: ports/raspberrypi/common-hal/busio/SPI.c msgid "SPI peripheral in use" @@ -1955,11 +1977,11 @@ msgstr "Periférico SPI en uso" #: ports/stm/common-hal/busio/SPI.c msgid "SPI re-init" -msgstr "" +msgstr "Re-inicialización SPI" #: shared-bindings/is31fl3741/FrameBuffer.c msgid "Scale dimensions must divide by 3" -msgstr "" +msgstr "Las dimensiones de escala debe ser divisibles por 3" #: ports/espressif/common-hal/_bleio/Adapter.c #: ports/nrf/common-hal/_bleio/Adapter.c @@ -1983,7 +2005,7 @@ msgstr "Sin capacidades para el tamaño" msgid "Sleep Memory not available" msgstr "Memoria de sueño no disponible" -#: shared-bindings/alarm/SleepMemory.c shared-bindings/coproc/CoprocMemory.c +#: shared-bindings/alarm/SleepMemory.c shared-bindings/memorymap/AddressRange.c #: shared-bindings/nvm/ByteArray.c msgid "Slice and value different lengths." msgstr "Slice y value tienen tamaños diferentes." @@ -2006,7 +2028,7 @@ msgstr "Los buffers de fuente y destino deben ser del mismo tamaño" #: shared-bindings/paralleldisplay/ParallelBus.c msgid "Specify exactly one of data0 or data_pins" -msgstr "" +msgstr "Especifique exactamente uno de data0 or data_pins" #: extmod/modure.c msgid "Splitting with sub-captures" @@ -2020,6 +2042,10 @@ 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" +#: ports/raspberrypi/common-hal/wifi/Radio.c +msgid "Stopping AP is not supported." +msgstr "Parar el AP no esta soportado." + #: 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" @@ -2037,55 +2063,22 @@ msgid "Temperature read timed out" msgstr "Lectura de temperatura expirada" #: supervisor/shared/safe_mode.c -msgid "The BOOT button was pressed at start up.\n" +msgid "The `microcontroller` module was used to boot into safe mode." msgstr "" +"El modulo `microcontrolador` fue usado para inicializar en modo seguro." -#: supervisor/shared/safe_mode.c -msgid "" -"The CircuitPython heap was corrupted because the stack was too small.\n" -"Increase the stack size if you know how. If not:" -msgstr "" -"El montículo de CircuitPython está corrupto porque la pila era muy pequeña.\n" -"Aumente el tamaño de pila si sabe como. De lo contrario:" - -#: ports/espressif/boards/adafruit_feather_esp32_v2/mpconfigboard.h -msgid "The SW38 button was pressed at start up.\n" -msgstr "" - -#: ports/espressif/boards/hardkernel_odroid_go/mpconfigboard.h -msgid "The VOLUME button was pressed at start up.\n" -msgstr "" - -#: supervisor/shared/safe_mode.c -msgid "" -"The `microcontroller` module was used to boot into safe mode. Press reset to " -"exit safe mode." -msgstr "" -"El módulo de `microcontroller` se usó para un arranque en modo seguro. " -"Presione reset para salir del modo seguro." - -#: ports/espressif/boards/m5stack_atom_lite/mpconfigboard.h -msgid "The central button was pressed at start up.\n" -msgstr "" - -#: ports/nrf/boards/aramcon2_badge/mpconfigboard.h -msgid "The left button was pressed at start up.\n" -msgstr "" +#: py/obj.c +msgid "The above exception was the direct cause of the following exception:" +msgstr "La excepción fue la causa directa de la excepción siguiente:" #: shared-bindings/rgbmatrix/RGBMatrix.c msgid "The length of rgb_pins must be 6, 12, 18, 24, or 30" msgstr "La longitud de rgb_pins debe ser 6, 12, 18, 24, o 30" #: supervisor/shared/safe_mode.c -msgid "" -"The microcontroller's power dipped. Make sure your power supply provides\n" -"enough power for the whole circuit and press reset (after ejecting " -"CIRCUITPY)." +msgid "The power dipped. Make sure you are providing enough power." msgstr "" -"La corriente eléctrica de la microcontroladora bajó. Asegúrate que tu fuente " -"de poder provee\n" -"suficiente corriente para todo el circuito y presiones reset (luego de " -"expulsar CIRCUITPY)." +"La potencia calló. Asegúrese que está suministrando suficiente energía." #: shared-module/audiomixer/MixerVoice.c msgid "The sample's bits_per_sample does not match the mixer's" @@ -2103,15 +2096,21 @@ msgstr "El sample rate del sample no iguala al del mixer" msgid "The sample's signedness does not match the mixer's" msgstr "El signo del sample no iguala al del mixer" +#: supervisor/shared/safe_mode.c +msgid "Third-party firmware fatal error." +msgstr "Error gráve del firmware de un tercero." + #: shared-module/imagecapture/ParallelImageCapture.c msgid "This microcontroller does not support continuous capture." -msgstr "" +msgstr "Este microcontrolador no soporta captura continua." #: shared-module/paralleldisplay/ParallelBus.c msgid "" "This microcontroller only supports data0=, not data_pins=, because it " "requires contiguous pins." msgstr "" +"Este microcontrolador solamente soporta data0=, not data_pins=, porque " +"requiere pines adyacentes." #: shared-bindings/displayio/TileGrid.c msgid "Tile height must exactly divide bitmap height" @@ -2137,13 +2136,9 @@ msgstr "" "Tiempo de espera demasiado largo: El tiempo máximo de espera es de %d " "segundos" -#: supervisor/shared/safe_mode.c -msgid "To exit, please reset the board without requesting safe mode." -msgstr "" - #: ports/atmel-samd/common-hal/audiobusio/I2SOut.c msgid "Too many channels in sample" -msgstr "" +msgstr "Demasiados canales en la muestra" #: ports/raspberrypi/common-hal/audiobusio/I2SOut.c msgid "Too many channels in sample." @@ -2178,24 +2173,28 @@ msgstr "Argumento tuple o struct_time requerido" #: ports/stm/common-hal/busio/UART.c msgid "UART de-init" -msgstr "" +msgstr "Desinicialización de 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 "Inicialización de UART" + +#: ports/raspberrypi/common-hal/busio/UART.c +msgid "UART peripheral in use" msgstr "" #: ports/stm/common-hal/busio/UART.c msgid "UART re-init" -msgstr "" +msgstr "Re-inicialización de UART" #: ports/stm/common-hal/busio/UART.c msgid "UART write" -msgstr "" +msgstr "Escribiendo UART" #: main.c msgid "UID:" -msgstr "" +msgstr "UID:" #: shared-module/usb_hid/Device.c msgid "USB busy" @@ -2232,6 +2231,10 @@ msgstr "UUID valor no es un str, int o byte buffer" msgid "Unable to allocate buffers for signed conversion" msgstr "No se pudieron asignar buffers para la conversión con signo" +#: supervisor/shared/safe_mode.c +msgid "Unable to allocate the heap." +msgstr "Imposible de asignar el heap." + #: ports/espressif/common-hal/busio/I2C.c msgid "Unable to create lock" msgstr "No se puede crear bloqueo" @@ -2255,12 +2258,13 @@ msgid "Unable to read color palette data" msgstr "No se pudo leer los datos de la paleta de colores" #: ports/espressif/common-hal/mdns/Server.c +#: ports/raspberrypi/common-hal/mdns/Server.c msgid "Unable to start mDNS query" -msgstr "" +msgstr "Imposible de incializar una consulta mDNS" -#: shared-bindings/coproc/CoprocMemory.c -msgid "Unable to write" -msgstr "" +#: shared-bindings/memorymap/AddressRange.c +msgid "Unable to write to address." +msgstr "Imposible de escribir en esa dirección." #: shared-bindings/nvm/ByteArray.c msgid "Unable to write to nvm." @@ -2282,12 +2286,12 @@ msgstr "Error no manejado de ESP TLS %d %d %x %d" #: ports/espressif/common-hal/_bleio/__init__.c #, c-format msgid "Unknown BLE error at %s:%d: %d" -msgstr "" +msgstr "Error BLE desconocido en %s:%d: %d" #: ports/espressif/common-hal/_bleio/__init__.c #, c-format msgid "Unknown BLE error: %d" -msgstr "" +msgstr "Error BLE desconocido: %d" #: shared-bindings/wifi/Radio.c #, c-format @@ -2312,7 +2316,7 @@ msgstr "Error de seguridad desconocido: 0x%04x" #: ports/espressif/common-hal/_bleio/__init__.c #, c-format msgid "Unknown system firmware error at %s:%d: %d" -msgstr "" +msgstr "Error del sistema firmware desconocido en %s:%d: %d" #: ports/nrf/common-hal/_bleio/__init__.c #, c-format @@ -2322,14 +2326,15 @@ msgstr "Error desconocido en el firmware sistema: %04x" #: ports/espressif/common-hal/_bleio/__init__.c #, c-format msgid "Unknown system firmware error: %d" -msgstr "" +msgstr "Error del sistema de firmware desconocido: %d" #: ports/raspberrypi/common-hal/wifi/__init__.c #, c-format msgid "Unkown error code %d" -msgstr "" +msgstr "Codigo de error desconocido: %d" #: shared-bindings/adafruit_pixelbuf/PixelBuf.c +#: shared-module/_pixelmap/PixelMap.c #, c-format msgid "Unmatched number of items on RHS (expected %d, got %d)." msgstr "Número incomparable de elementos en RHS (%d esperado,%d obtenido)." @@ -2344,7 +2349,7 @@ msgstr "" #: shared-bindings/bitmaptools/__init__.c msgid "Unsupported colorspace" -msgstr "" +msgstr "Espacio de color no sportado" #: shared-module/displayio/display_core.c msgid "Unsupported display bus type" @@ -2356,7 +2361,7 @@ msgstr "Formato no soportado" #: shared-bindings/hashlib/__init__.c msgid "Unsupported hash algorithm" -msgstr "" +msgstr "Algoritmo hash no soportado" #: ports/espressif/common-hal/dualbank/__init__.c msgid "Update Failed" @@ -2414,10 +2419,27 @@ msgid "" "\n" "To list built-in modules type `help(\"modules\")`.\n" msgstr "" +"Bienvenido a Adafruit CircuitPython %s!\n" +"\n" +"Visite circuitpython.org para mayor informacion.\n" +"\n" +"Para conocer la lista de modules built-in escriba `help(\"modules\")`.\n" #: supervisor/shared/web_workflow/web_workflow.c msgid "Wi-Fi: " -msgstr "" +msgstr "Wi-Fi: " + +#: ports/raspberrypi/common-hal/wifi/Radio.c +msgid "Wifi is in access point mode." +msgstr "Wifi est en modo de access point." + +#: ports/raspberrypi/common-hal/wifi/Radio.c +msgid "Wifi is in station mode." +msgstr "Wifi esta en modo station." + +#: ports/raspberrypi/common-hal/wifi/Radio.c +msgid "Wifi is not enabled" +msgstr "Wifi no esta activado" #: main.c msgid "Woken up by alarm.\n" @@ -2428,16 +2450,49 @@ msgstr "Despertado por la alarma.\n" msgid "Writes not supported on Characteristic" msgstr "Escrituras no admitidas en Characteristic" -#: supervisor/shared/safe_mode.c -msgid "You are in safe mode because:\n" -msgstr "Estás en modo seguro por la razón:\n" +#: ports/atmel-samd/boards/circuitplayground_express/mpconfigboard.h +#: ports/atmel-samd/boards/circuitplayground_express_crickit/mpconfigboard.h +#: ports/atmel-samd/boards/circuitplayground_express_displayio/mpconfigboard.h +#: ports/atmel-samd/boards/meowmeow/mpconfigboard.h +msgid "You pressed both buttons at start up." +msgstr "Usted presionó ambos botones al iniciar." + +#: ports/espressif/boards/m5stack_core_basic/mpconfigboard.h +#: ports/espressif/boards/m5stack_core_fire/mpconfigboard.h +#: ports/espressif/boards/m5stack_stick_c/mpconfigboard.h +msgid "You pressed button A at start up." +msgstr "Usted presionó el boton A al iniciar." #: supervisor/shared/safe_mode.c -msgid "" -"You pressed the reset button during boot. Press again to exit safe mode." -msgstr "" -"Has presionado el botón de reset durante el arranque. Presiones de nuevo " -"para salir del modo seguro." +msgid "You pressed the BOOT button at start up" +msgstr "Usted presionó el boton BOOT al iniciar" + +#: ports/espressif/boards/adafruit_feather_esp32_v2/mpconfigboard.h +msgid "You pressed the SW38 button at start up." +msgstr "Usted presionó el boton SW38 al iniciar." + +#: ports/espressif/boards/hardkernel_odroid_go/mpconfigboard.h +msgid "You pressed the VOLUME button at start up." +msgstr "Usted presionó el boton de Volumén al iniciar." + +#: ports/espressif/boards/m5stack_atom_echo/mpconfigboard.h +#: ports/espressif/boards/m5stack_atom_lite/mpconfigboard.h +#: ports/espressif/boards/m5stack_atom_matrix/mpconfigboard.h +#: ports/espressif/boards/m5stack_atom_u/mpconfigboard.h +msgid "You pressed the central button at start up." +msgstr "Usted presionó el boton central al iniciar." + +#: ports/nrf/boards/aramcon2_badge/mpconfigboard.h +msgid "You pressed the left button at start up." +msgstr "Usted presionó el boton izquierdo al iniciar." + +#: supervisor/shared/safe_mode.c +msgid "You pressed the reset button during boot." +msgstr "Usted presionó el boton izquierdo al iniciar." + +#: supervisor/shared/micropython.c +msgid "[truncated due to length]" +msgstr "[truncado debido a la longitud]" #: py/objtype.c msgid "__init__() should return None" @@ -2506,10 +2561,14 @@ msgstr "Longitud del array e índice tienen que ser iguales" #: extmod/ulab/code/numpy/io/io.c msgid "array has too many dimensions" -msgstr "" +msgstr "La matriz tiene demasiadas dimensiones" + +#: extmod/ulab/code/ndarray.c +msgid "array is too big" +msgstr "el arreglo es muy grande" #: py/objarray.c shared-bindings/alarm/SleepMemory.c -#: shared-bindings/coproc/CoprocMemory.c shared-bindings/nvm/ByteArray.c +#: shared-bindings/memorymap/AddressRange.c shared-bindings/nvm/ByteArray.c msgid "array/bytes required on right side" msgstr "array/bytes requeridos en el lado derecho" @@ -2539,7 +2598,7 @@ msgstr "Eje demasiado largo" #: shared-bindings/bitmaptools/__init__.c msgid "background value out of range of target" -msgstr "" +msgstr "El valor del fondo esta fuera del rango del objectivo" #: py/builtinevex.c msgid "bad compile mode" @@ -2563,7 +2622,7 @@ msgstr "operacion binaria %q no implementada" #: shared-bindings/bitmaptools/__init__.c msgid "bitmap sizes must match" -msgstr "" +msgstr "Los tamaños de los bitmap deben coincidir" #: extmod/modurandom.c msgid "bits must be 32 or less" @@ -2602,10 +2661,6 @@ msgstr "buffer demasiado pequeño" msgid "buffer too small for requested bytes" msgstr "búfer muy pequeño para los bytes solicitados" -#: shared-bindings/adafruit_pixelbuf/PixelBuf.c -msgid "byteorder is not a string" -msgstr "byteorder no es una cadena" - #: 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" @@ -2625,7 +2680,7 @@ msgstr "calibration es de solo lectura" #: shared-module/vectorio/Circle.c shared-module/vectorio/Polygon.c #: shared-module/vectorio/Rectangle.c msgid "can only have one parent" -msgstr "" +msgstr "solamente puede tener un parent" #: py/emitinlinethumb.c msgid "can only have up to 4 parameters to Thumb assembly" @@ -2647,14 +2702,10 @@ 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-module/adafruit_pixelbuf/PixelBuf.c +#: py/obj.c py/objint.c py/runtime.c shared-module/adafruit_pixelbuf/PixelBuf.c msgid "can't convert %q to %q" msgstr "no puede convertir %q a %q" -#: py/runtime.c -msgid "can't convert %q to int" -msgstr "no se puede convertir %q a int" - #: py/obj.c #, c-format msgid "can't convert %s to complex" @@ -2666,7 +2717,7 @@ msgstr "no se puede convertir el objeto '%q' a %q implícitamente" #: extmod/ulab/code/numpy/vector.c msgid "can't convert complex to float" -msgstr "" +msgstr "no se puede convertir complejo a float" #: py/obj.c msgid "can't convert to %q" @@ -2722,7 +2773,7 @@ msgstr "no se puede cargar con el índice '%q'" #: py/builtinimport.c msgid "can't perform relative import" -msgstr "" +msgstr "no se puede realizar una importacion relativa" #: py/objgenerator.c msgid "can't send non-None value to a just-started generator" @@ -2737,6 +2788,10 @@ msgstr "no se puede definir un tamaño de bloque de 512" msgid "can't set attribute" msgstr "no se puede asignar el atributo" +#: py/runtime.c +msgid "can't set attribute '%q'" +msgstr "no se puede configurar el attributo '%q'" + #: py/emitnative.c msgid "can't store '%q'" msgstr "no se puede almacenar '%q'" @@ -2765,7 +2820,7 @@ msgstr "" #: extmod/ulab/code/ndarray.c msgid "cannot assign new shape" -msgstr "" +msgstr "no se puede asignar una nueva forma" #: extmod/ulab/code/ndarray_operators.c msgid "cannot cast output with casting rule" @@ -2773,11 +2828,11 @@ msgstr "No se puede realizar cast de la salida sin una regla de cast" #: extmod/ulab/code/ndarray.c msgid "cannot convert complex to dtype" -msgstr "" +msgstr "no se puede convertir complex a dtype" #: extmod/ulab/code/ndarray.c msgid "cannot convert complex type" -msgstr "" +msgstr "no se puede convertir tipo complejo" #: py/objtype.c msgid "cannot create '%q' instances" @@ -2801,7 +2856,7 @@ msgstr "convirtiendo tipo" #: ports/stm/common-hal/pwmio/PWMOut.c msgid "channel re-init" -msgstr "" +msgstr "re-nicialización del canal" #: shared-bindings/_stage/Text.c msgid "chars buffer too small" @@ -2843,10 +2898,6 @@ msgstr "color debe estar entre 0x000000 y 0xffffff" msgid "comparison of int and uint" msgstr "comparación entre int y uint" -#: py/objcomplex.c -msgid "complex division by zero" -msgstr "división compleja por cero" - #: py/objfloat.c py/parsenum.c msgid "complex values not supported" msgstr "valores complejos no soportados" @@ -2877,7 +2928,7 @@ msgstr "los argumentos para convolve no deben estar vacíos" #: extmod/ulab/code/numpy/io/io.c msgid "corrupted file" -msgstr "" +msgstr "Archivo corrompido" #: extmod/ulab/code/numpy/poly.c msgid "could not invert Vandermonde matrix" @@ -2951,18 +3002,17 @@ msgstr "las dimensiones no concuerdan" msgid "div/mod not implemented for uint" msgstr "div/mod no implementado para uint" -#: py/objfloat.c py/objint_mpz.c +#: extmod/ulab/code/numpy/create.c msgid "divide by zero" msgstr "divide por cero" -#: py/modmath.c py/objint_longlong.c py/runtime.c -#: shared-bindings/math/__init__.c +#: py/runtime.c msgid "division by zero" msgstr "división por cero" #: extmod/ulab/code/numpy/vector.c msgid "dtype must be float, or complex" -msgstr "" +msgstr "dtype debe ser float, o complex" #: py/objdeque.c msgid "empty" @@ -2970,7 +3020,7 @@ msgstr "vacío" #: extmod/ulab/code/numpy/io/io.c msgid "empty file" -msgstr "" +msgstr "archivo vacio" #: extmod/moduasyncio.c extmod/moduheapq.c extmod/modutimeq.c msgid "empty heap" @@ -2997,24 +3047,18 @@ msgstr "epoch_time no esta soportado en esta tarjeta" msgid "error = 0x%08lX" msgstr "error = 0x%08lX" -#: ports/espressif/common-hal/esp32_camera/Camera.c +#: ports/espressif/common-hal/espcamera/Camera.c msgid "" -"esp32_camera.Camera requires reserved PSRAM to be configured. See the " +"espcamera.Camera requires reserved PSRAM to be configured. See the " "documentation for instructions." msgstr "" +"espcamera. La cámara requiere una configuración de PSRAM reservada. " +"Refiérase a la documentación para más instrucciones." #: py/runtime.c msgid "exceptions must derive from BaseException" msgstr "las excepciones deben derivar de BaseException" -#: shared-bindings/canio/CAN.c -msgid "expected '%q' but got '%q'" -msgstr "se espera '%q' pero se recibe '%q'" - -#: shared-bindings/canio/CAN.c -msgid "expected '%q' or '%q' but got '%q'" -msgstr "se espera '%q' o '%q' pero se recibe '%q'" - #: py/objstr.c msgid "expected ':' after format specifier" msgstr "se esperaba ':' después de un especificador de tipo format" @@ -3059,7 +3103,7 @@ msgstr "el archivo deberia ser una archivo abierto en modo byte" #: shared-bindings/traceback/__init__.c msgid "file write is not available" -msgstr "" +msgstr "la escritura del archivo no esta disponible" #: shared-bindings/storage/__init__.c msgid "filesystem must provide mount method" @@ -3113,10 +3157,6 @@ msgstr "font debe ser 2048 bytes de largo" msgid "format requires a dict" msgstr "format requiere un dict" -#: shared-bindings/microcontroller/Processor.c -msgid "frequency is read-only for this board" -msgstr "" - #: py/objdeque.c msgid "full" msgstr "lleno" @@ -3144,7 +3184,7 @@ msgstr "Función solo definida para ndarrays" #: extmod/ulab/code/numpy/carray/carray.c msgid "function is implemented for ndarrays only" -msgstr "" +msgstr "la funcion esta implementada solamente para ndarrays" #: py/argcheck.c #, c-format @@ -3229,8 +3269,12 @@ msgstr "relleno (padding) incorrecto" msgid "index is out of bounds" msgstr "el índice está fuera de límites" +#: shared-bindings/_pixelmap/PixelMap.c +msgid "index must be tuple or int" +msgstr "el indice debe ser tuple o int" + #: extmod/ulab/code/numpy/numerical.c extmod/ulab/code/ulab_tools.c -#: ports/espressif/common-hal/pulseio/PulseIn.c py/obj.c +#: ports/espressif/common-hal/pulseio/PulseIn.c #: shared-bindings/bitmaptools/__init__.c msgid "index out of range" msgstr "index fuera de rango" @@ -3241,7 +3285,7 @@ msgstr "los índices deben ser enteros, particiones o listas de booleanos" #: ports/espressif/common-hal/busio/I2C.c msgid "init I2C" -msgstr "" +msgstr "inicializacion I2C" #: extmod/ulab/code/scipy/optimize/optimize.c msgid "initial values must be iterable" @@ -3277,7 +3321,7 @@ msgstr "los datos de entrada deben ser iterables" #: extmod/ulab/code/numpy/vector.c msgid "input dtype must be float or complex" -msgstr "" +msgstr "dtype de entrada debe ser float o complex" #: extmod/ulab/code/numpy/linalg/linalg.c msgid "input matrix is asymmetric" @@ -3290,11 +3334,11 @@ msgstr "la matriz de entrada es singular" #: extmod/ulab/code/numpy/create.c msgid "input must be 1- or 2-d" -msgstr "" +msgstr "entrada debe ser 1-d o 2-d" #: extmod/ulab/code/numpy/carray/carray.c msgid "input must be a 1D ndarray" -msgstr "" +msgstr "entrada debe ser un ndarray de 1D" #: extmod/ulab/code/scipy/linalg/linalg.c extmod/ulab/code/user/user.c msgid "input must be a dense ndarray" @@ -3306,7 +3350,7 @@ msgstr "Entrada tiene que ser un ndarray" #: extmod/ulab/code/numpy/carray/carray.c msgid "input must be an ndarray, or a scalar" -msgstr "" +msgstr "entrada debe ser una ndarray o un escalar" #: extmod/ulab/code/scipy/signal/signal.c msgid "input must be one-dimensional" @@ -3328,10 +3372,6 @@ msgstr "los vectores de entrada deben ser de igual tamaño" msgid "inputs are not iterable" msgstr "Entradas no son iterables" -#: py/parsenum.c -msgid "int() arg 2 must be >= 2 and <= 36" -msgstr "int() arg 2 debe ser >= 2 y <= 36" - #: extmod/ulab/code/numpy/approx.c msgid "interp is defined for 1D iterables of equal length" msgstr "interp está definido para iterables 1D de igual tamaño" @@ -3348,7 +3388,7 @@ msgstr "arquitectura inválida" #: shared-bindings/bitmaptools/__init__.c #, c-format msgid "invalid bits_per_pixel %d, must be, 1, 2, 4, 8, 16, 24, or 32" -msgstr "" +msgstr "bits_per_pixel %d invalidos, deben ser, 1, 2, 4, 8, 16, 24, o 32" #: ports/raspberrypi/common-hal/ssl/SSLSocket.c msgid "invalid cert" @@ -3366,7 +3406,7 @@ msgstr "el element_size %d,no es valido, debe ser 1,2 ó 4" #: shared-bindings/traceback/__init__.c msgid "invalid exception" -msgstr "" +msgstr "excepcion invalida" #: extmod/modframebuf.c msgid "invalid format" @@ -3388,9 +3428,9 @@ msgstr "llave inválida" msgid "invalid micropython decorator" msgstr "decorador de micropython inválido" -#: ports/espressif/common-hal/esp32_camera/Camera.c +#: ports/espressif/common-hal/espcamera/Camera.c msgid "invalid setting" -msgstr "" +msgstr "configuracion invalida" #: shared-bindings/random/__init__.c msgid "invalid step" @@ -3413,10 +3453,6 @@ msgstr "sintaxis inválida para entero con base %d" msgid "invalid syntax for number" msgstr "sintaxis inválida para número" -#: py/objexcept.c -msgid "invalid traceback" -msgstr "" - #: py/objtype.c msgid "issubclass() arg 1 must be a class" msgstr "issubclass() arg 1 debe ser una clase" @@ -3476,21 +3512,19 @@ msgstr "variable local '%q' usada antes del tipo conocido" msgid "local variable referenced before assignment" msgstr "variable local referenciada antes de la asignación" -#: py/objint.c -msgid "long int not supported in this build" -msgstr "long int no soportado en esta compilación" - #: ports/espressif/common-hal/canio/CAN.c msgid "loopback + silent mode not supported by peripheral" msgstr "Loopback + modo silencioso no están soportados por periférico" #: ports/espressif/common-hal/mdns/Server.c +#: ports/raspberrypi/common-hal/mdns/Server.c msgid "mDNS already initialized" -msgstr "" +msgstr "mDNS ya esta inicializado" #: ports/espressif/common-hal/mdns/Server.c +#: ports/raspberrypi/common-hal/mdns/Server.c msgid "mDNS only works with built-in WiFi" -msgstr "" +msgstr "mDNS solo funciona con WIFI incorporado" #: py/parse.c msgid "malformed f-string" @@ -3517,7 +3551,7 @@ msgstr "max_length debe ser 0-%d cuando fixed_length es %s" #: extmod/ulab/code/ndarray.c msgid "maximum number of dimensions is " -msgstr "" +msgstr "el numero maximo de dimensiones es " #: py/runtime.c msgid "maximum recursion depth exceeded" @@ -3551,7 +3585,7 @@ msgstr "" #: extmod/ulab/code/numpy/linalg/linalg.c msgid "mode must be complete, or reduced" -msgstr "" +msgstr "el modo debe ser completo o reducido" #: py/builtinimport.c msgid "module not found" @@ -3559,7 +3593,7 @@ msgstr "módulo no encontrado" #: ports/espressif/common-hal/wifi/Monitor.c msgid "monitor init failed" -msgstr "" +msgstr "fallo en el monitor de inicializacion" #: extmod/ulab/code/numpy/poly.c msgid "more degrees of freedom than data points" @@ -3618,6 +3652,10 @@ msgstr "potencia negativa sin float support" msgid "negative shift count" msgstr "cuenta de corrimientos negativo" +#: shared-bindings/_pixelmap/PixelMap.c +msgid "nested index must be int" +msgstr "indice anidado debe ser int" + #: shared-module/sdcardio/SDCard.c msgid "no SD card" msgstr "no hay tarjeta SD" @@ -3651,7 +3689,7 @@ msgstr "no hay pin de reinicio disponible" msgid "no response from SD card" msgstr "no hay respuesta de la tarjeta SD" -#: ports/espressif/common-hal/esp32_camera/Camera.c py/objobject.c py/runtime.c +#: ports/espressif/common-hal/espcamera/Camera.c py/objobject.c py/runtime.c msgid "no such attribute" msgstr "no hay tal atributo" @@ -3701,7 +3739,7 @@ msgstr "no suficientes argumentos para format string" #: extmod/ulab/code/numpy/carray/carray_tools.c msgid "not implemented for complex dtype" -msgstr "" +msgstr "no esta implementado para complex dtype" #: extmod/ulab/code/numpy/create.c msgid "number of points must be at least 2" @@ -3763,7 +3801,7 @@ msgstr "string de longitud impar" #: supervisor/shared/web_workflow/web_workflow.c msgid "off" -msgstr "" +msgstr "apagado" #: extmod/ulab/code/utils/utils.c msgid "offset is too large" @@ -3788,11 +3826,15 @@ msgstr "solo se admite bit_depth=16" #: ports/stm/common-hal/audiobusio/PDMIn.c msgid "only mono is supported" -msgstr "" +msgstr "solamente mono esta suportado" + +#: extmod/ulab/code/numpy/create.c +msgid "only ndarrays can be concatenated" +msgstr "solamente ndarrays pueden ser concatenadas" #: ports/stm/common-hal/audiobusio/PDMIn.c msgid "only oversample=64 is supported" -msgstr "" +msgstr "solamente oversample=64 esta soportado" #: ports/nrf/common-hal/audiobusio/PDMIn.c #: ports/stm/common-hal/audiobusio/PDMIn.c @@ -3800,7 +3842,7 @@ msgid "only sample_rate=16000 is supported" msgstr "solo se admite sample_rate=16000" #: py/objarray.c py/objstr.c py/objstrunicode.c py/objtuple.c -#: shared-bindings/alarm/SleepMemory.c shared-bindings/coproc/CoprocMemory.c +#: shared-bindings/alarm/SleepMemory.c shared-bindings/memorymap/AddressRange.c #: shared-bindings/nvm/ByteArray.c msgid "only slices with step=1 (aka None) are supported" msgstr "solo se admiten segmentos con step=1 (alias None)" @@ -3816,11 +3858,11 @@ msgstr "los operandos no se pueden transmitir juntos" #: extmod/ulab/code/numpy/linalg/linalg.c msgid "operation is defined for 2D arrays only" -msgstr "" +msgstr "la operacion esta definida para matrices 2D solamente" #: extmod/ulab/code/numpy/linalg/linalg.c msgid "operation is defined for ndarrays only" -msgstr "" +msgstr "la operacion esta definida para ndarrays solamente" #: extmod/ulab/code/ndarray.c msgid "operation is implemented for 1D Boolean arrays only" @@ -3894,7 +3936,7 @@ msgstr "pixel_shader debe ser displayio.Palette o displayio.ColorConverter" #: extmod/vfs_posix_file.c msgid "poll on file not available on win32" -msgstr "" +msgstr "el sondeo del archivo no esta disponible en win32" #: ports/espressif/common-hal/pulseio/PulseIn.c msgid "pop from an empty PulseIn" @@ -3931,7 +3973,7 @@ msgstr "desbordamiento de cola(queue)" #: py/parse.c msgid "raw f-strings are not supported" -msgstr "" +msgstr "raw f-strings no esta soportadas" #: extmod/ulab/code/numpy/fft/fft_tools.c msgid "real and imaginary parts must be of equal length" @@ -4016,10 +4058,6 @@ msgstr "la longitud de sleep no puede ser negativa" msgid "slice step can't be zero" msgstr "el tamaño de la división no puede ser cero" -#: py/objslice.c -msgid "slice step cannot be zero" -msgstr "slice step no puede ser cero" - #: py/nativeglue.c msgid "slice unsupported" msgstr "sin capacidades para rebanado" @@ -4054,24 +4092,20 @@ msgstr "paleta fuente muy larga" #: shared-bindings/bitmaptools/__init__.c msgid "source_bitmap must have value_count of 2 or 65536" -msgstr "" +msgstr "source_bitmap debe tener value_count de 2 o 65536" #: shared-bindings/bitmaptools/__init__.c msgid "source_bitmap must have value_count of 65536" -msgstr "" +msgstr "source_bitmap debe tener value_count de 65536" #: shared-bindings/bitmaptools/__init__.c msgid "source_bitmap must have value_count of 8" -msgstr "" +msgstr "source_bitmap debe tener value_count de 8" #: py/objstr.c msgid "start/end indices" msgstr "índices inicio/final" -#: shared-bindings/random/__init__.c -msgid "step must be non-zero" -msgstr "paso debe ser numero no cero" - #: shared-bindings/random/__init__.c msgid "stop not reachable from start" msgstr "stop no se puede alcanzar del principio" @@ -4080,10 +4114,6 @@ msgstr "stop no se puede alcanzar del principio" msgid "stream operation not supported" msgstr "operación stream no soportada" -#: py/objstrunicode.c -msgid "string indices must be integers, not %q" -msgstr "índices de cadena deben ser enteros, no %q" - #: py/stream.c msgid "string not supported; use bytes or bytearray" msgstr "string no soportado; usa bytes o bytearray" @@ -4116,10 +4146,6 @@ msgstr "error de sintaxis en JSON" msgid "syntax error in uctypes descriptor" msgstr "error de sintaxis en el descriptor uctypes" -#: shared-bindings/time/__init__.c -msgid "time.struct_time() takes a 9-sequence" -msgstr "time.struct_time() toma un sequencio 9" - #: ports/atmel-samd/common-hal/watchdog/WatchDogTimer.c #: ports/espressif/common-hal/watchdog/WatchDogTimer.c #: ports/nrf/common-hal/watchdog/WatchDogTimer.c @@ -4142,7 +4168,7 @@ msgstr "tiempo de espera agotado esperando a tarjeta v2" #: ports/stm/common-hal/pwmio/PWMOut.c msgid "timer re-init" -msgstr "" +msgstr "temporizador re-inicializado" #: shared-bindings/time/__init__.c msgid "timestamp out of range for platform time_t" @@ -4239,7 +4265,7 @@ msgstr "nombre en unicode escapa" #: py/parse.c msgid "unindent doesn't match any outer indent level" -msgstr "" +msgstr "unindent no coteja ningún nivel de espacio exterior" #: py/objstr.c #, c-format @@ -4261,7 +4287,7 @@ msgstr "tipo desconocido '%q'" #: py/objstr.c #, c-format msgid "unmatched '%c' in format" -msgstr "" +msgstr "no coteja '%c' en formato" #: py/objtype.c py/runtime.c msgid "unreadable attribute" @@ -4283,11 +4309,11 @@ msgstr "instrucción Xtensa '%s' con %d argumentos no soportada" #: shared-module/gifio/GifWriter.c msgid "unsupported colorspace for GifWriter" -msgstr "" +msgstr "espacio de color no soportado para GifWriter" #: shared-bindings/bitmaptools/__init__.c msgid "unsupported colorspace for dither" -msgstr "" +msgstr "espacio de color no soportado para tramado" #: py/objstr.c #, c-format @@ -4308,11 +4334,11 @@ msgstr "tipos no soportados para %q: '%q', '%q'" #: extmod/ulab/code/numpy/io/io.c msgid "usecols is too high" -msgstr "" +msgstr "usecols es muy alto" #: extmod/ulab/code/numpy/io/io.c msgid "usecols keyword must be specified" -msgstr "" +msgstr "usecols palabra clave debe de ser especificada" #: py/objint.c #, c-format @@ -4321,7 +4347,7 @@ msgstr "el valor debe caber en %d byte(s)" #: shared-bindings/bitmaptools/__init__.c msgid "value out of range of target" -msgstr "" +msgstr "valor fuera de alcance al blanco" #: shared-bindings/displayio/Bitmap.c msgid "value_count must be > 0" @@ -4342,7 +4368,7 @@ msgstr "wifi no esta habilitado" #: ports/raspberrypi/common-hal/wifi/Monitor.c msgid "wifi.Monitor not available" -msgstr "" +msgstr "wifi.Monitor no esta disponible" #: shared-bindings/_bleio/Adapter.c msgid "window must be <= interval" @@ -4358,7 +4384,7 @@ msgstr "eje especificado erróneo" #: extmod/ulab/code/numpy/io/io.c msgid "wrong dtype" -msgstr "" +msgstr "erroneo dtype" #: extmod/ulab/code/numpy/transform.c msgid "wrong index type" @@ -4372,11 +4398,11 @@ msgstr "tipo de entrada incorrecta" #: extmod/ulab/code/numpy/transform.c msgid "wrong length of condition array" -msgstr "" +msgstr "largo erroneo en el arreglo de condiciones" #: extmod/ulab/code/numpy/transform.c msgid "wrong length of index array" -msgstr "" +msgstr "largo erroneo en el arreglo de índices" #: extmod/ulab/code/numpy/create.c py/objarray.c py/objstr.c msgid "wrong number of arguments" @@ -4402,10 +4428,6 @@ msgstr "fallo en xTaskCreate" msgid "y value out of bounds" msgstr "valor y fuera de límites" -#: py/objrange.c -msgid "zero step" -msgstr "paso cero" - #: extmod/ulab/code/scipy/signal/signal.c msgid "zi must be an ndarray" msgstr "zi debe ser un ndarray" @@ -4418,6 +4440,174 @@ 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 "" +#~ "\n" +#~ "Please file an issue with the contents of your CIRCUITPY drive at \n" +#~ "https://github.com/adafruit/circuitpython/issues\n" +#~ msgstr "" +#~ "\n" +#~ "Presente un problema con el contenido de su unidad CIRCUITPY en\n" +#~ "https://github.com/adafruit/circuitpython/issues\n" + +#~ msgid "Attempted heap allocation when VM not running." +#~ msgstr "Asignación del montículo mientras la VM no esta ejecutándose." + +#~ msgid "Boot device must be first device (interface #0)." +#~ msgstr "" +#~ "El dispositivo de arranque debe de ser el primer dispositivo (interfase " +#~ "#0)." + +#~ msgid "Both buttons were pressed at start up.\n" +#~ msgstr "Ambos botones fueron prensados al inicio\n" + +#~ msgid "Button A was pressed at start up.\n" +#~ msgstr "Botón A fue presionado al inicio.\n" + +#~ msgid "CircuitPython was unable to allocate the heap." +#~ msgstr "CircuitPython no puedo encontrar el montículo." + +#~ msgid "Crash into the HardFault_Handler." +#~ msgstr "Choque contra el HardFault_Handler." + +#~ msgid "Fatal error." +#~ msgstr "Error grave." + +#~ msgid "Invalid memory access." +#~ msgstr "Acceso a memoria no válido." + +#~ msgid "Nordic system firmware failure assertion." +#~ msgstr "Falla en la aserción del firmware del dispositivo Nordic." + +#~ msgid "The BOOT button was pressed at start up.\n" +#~ msgstr "El boton BOOT fur presionado durante el arranque.\n" + +#~ msgid "" +#~ "The CircuitPython heap was corrupted because the stack was too small.\n" +#~ "Increase the stack size if you know how. If not:" +#~ msgstr "" +#~ "El montículo de CircuitPython está corrupto porque la pila era muy " +#~ "pequeña.\n" +#~ "Aumente el tamaño de pila si sabe como. De lo contrario:" + +#~ msgid "The SW38 button was pressed at start up.\n" +#~ msgstr "El boton SW38 fue presionado durante el arranque.\n" + +#~ msgid "The VOLUME button was pressed at start up.\n" +#~ msgstr "El boton de Volumen fue presionado durante el arranque.\n" + +#~ msgid "" +#~ "The `microcontroller` module was used to boot into safe mode. Press reset " +#~ "to exit safe mode." +#~ msgstr "" +#~ "El módulo de `microcontroller` se usó para un arranque en modo seguro. " +#~ "Presione reset para salir del modo seguro." + +#~ msgid "The central button was pressed at start up.\n" +#~ msgstr "El boton central fue presionado durante el arranque.\n" + +#~ msgid "The left button was pressed at start up.\n" +#~ msgstr "El boton izquierdo fue presionado durante el arranque.\n" + +#~ msgid "" +#~ "The microcontroller's power dipped. Make sure your power supply provides\n" +#~ "enough power for the whole circuit and press reset (after ejecting " +#~ "CIRCUITPY)." +#~ msgstr "" +#~ "La corriente eléctrica de la microcontroladora bajó. Asegúrate que tu " +#~ "fuente de poder provee\n" +#~ "suficiente corriente para todo el circuito y presiones reset (luego de " +#~ "expulsar CIRCUITPY)." + +#~ msgid "To exit, please reset the board without requesting safe mode." +#~ msgstr "Para salir, por favor reinicialice la tarjeta sin pedir safe mode." + +#~ msgid "You are in safe mode because:\n" +#~ msgstr "Estás en modo seguro por la razón:\n" + +#~ msgid "" +#~ "You pressed the reset button during boot. Press again to exit safe mode." +#~ msgstr "" +#~ "Has presionado el botón de reset durante el arranque. Presiones de nuevo " +#~ "para salir del modo seguro." + +#~ msgid "" +#~ "esp32_camera.Camera requires reserved PSRAM to be configured. See the " +#~ "documentation for instructions." +#~ msgstr "" +#~ "esp32_camera. la camara necesita PSRAM reservada para ser configurada. " +#~ "Vea la documentacion para mas instrucciones." + +#~ msgid "%q must be of type %q" +#~ msgstr "%q debe ser de typo %q" + +#~ msgid "%q must be of type %q or None" +#~ msgstr "%q debe ser de tipo %q o None" + +#~ msgid "Expected a %q" +#~ msgstr "Se espera un %q" + +#, c-format +#~ msgid "IV must be %d bytes long" +#~ msgstr "IV debe tener %d bytes de longitud" + +#~ msgid "Not settable" +#~ msgstr "No configurable" + +#~ msgid "expected '%q' but got '%q'" +#~ msgstr "se espera '%q' pero se recibe '%q'" + +#~ msgid "expected '%q' or '%q' but got '%q'" +#~ msgstr "se espera '%q' o '%q' pero se recibe '%q'" + +#~ msgid "Read-only object" +#~ msgstr "Objeto de solo-lectura" + +#~ msgid "%q length must be >= 1" +#~ msgstr "%q tamaño debe ser >= 1" + +#~ msgid "%q must be a string" +#~ msgstr "%q debe ser una cadena" + +#~ msgid "At most %d %q may be specified (not %d)" +#~ msgstr "Como máximo %d %q se puede especificar (no %d)" + +#~ msgid "Invalid pins" +#~ msgstr "pines inválidos" + +#, c-format +#~ msgid "No more than %d HID devices allowed" +#~ msgstr "No se permiten más de %d dispositivos HID permitidos" + +#~ msgid "byteorder is not a string" +#~ msgstr "byteorder no es una cadena" + +#~ msgid "can't convert %q to int" +#~ msgstr "no se puede convertir %q a int" + +#~ msgid "complex division by zero" +#~ msgstr "división compleja por cero" + +#~ msgid "int() arg 2 must be >= 2 and <= 36" +#~ msgstr "int() arg 2 debe ser >= 2 y <= 36" + +#~ msgid "long int not supported in this build" +#~ msgstr "long int no soportado en esta compilación" + +#~ msgid "slice step cannot be zero" +#~ msgstr "slice step no puede ser cero" + +#~ msgid "step must be non-zero" +#~ msgstr "paso debe ser numero no cero" + +#~ msgid "string indices must be integers, not %q" +#~ msgstr "índices de cadena deben ser enteros, no %q" + +#~ msgid "time.struct_time() takes a 9-sequence" +#~ msgstr "time.struct_time() toma un sequencio 9" + +#~ msgid "zero step" +#~ msgstr "paso cero" + #~ msgid "%q indices must be integers, not %s" #~ msgstr "%q indices deben ser enteros, no %s" diff --git a/locale/fil.po b/locale/fil.po index f1e363b149..d5857a53ea 100644 --- a/locale/fil.po +++ b/locale/fil.po @@ -6,8 +6,8 @@ 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-12-27 18:02+0000\n" +"Last-Translator: Blinka CircuitPython \n" "Language-Team: fil\n" "Language: fil\n" "MIME-Version: 1.0\n" @@ -15,7 +15,7 @@ msgstr "" "Content-Transfer-Encoding: 8bit\n" "Plural-Forms: nplurals=2; plural=n != 1 && n != 2 && n != 3 && (n % 10 == 4 " "|| n % 10 == 6 || n % 10 == 9);\n" -"X-Generator: Weblate 4.8.1-dev\n" +"X-Generator: Weblate 4.15.1-dev\n" #: main.c msgid "" @@ -32,8 +32,20 @@ msgstr "" #: supervisor/shared/safe_mode.c msgid "" "\n" -"Please file an issue with the contents of your CIRCUITPY drive at \n" -"https://github.com/adafruit/circuitpython/issues\n" +"Please file an issue with your program at https://github.com/adafruit/" +"circuitpython/issues." +msgstr "" + +#: supervisor/shared/safe_mode.c +msgid "" +"\n" +"Press reset to exit safe mode.\n" +msgstr "" + +#: supervisor/shared/safe_mode.c +msgid "" +"\n" +"You are in safe mode because:\n" msgstr "" #: py/obj.c @@ -66,6 +78,11 @@ msgstr "%%c nangangailangan ng int o char" msgid "%02X" msgstr "" +#: shared-module/os/getenv.c +#, c-format +msgid "%S" +msgstr "%S" + #: shared-bindings/rgbmatrix/RGBMatrix.c #, c-format msgid "" @@ -81,7 +98,7 @@ msgstr "" #: 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 +#: ports/stm/common-hal/canio/Listener.c ports/stm/common-hal/rtc/RTC.c msgid "%q" msgstr "" @@ -101,13 +118,18 @@ msgstr "" msgid "%q failure: %d" msgstr "" +#: py/argcheck.c +msgid "%q in %q must be of type %q, not %q" +msgstr "" + +#: ports/espressif/common-hal/espulp/ULP.c #: ports/raspberrypi/common-hal/rp2pio/StateMachine.c #: shared-bindings/digitalio/DigitalInOut.c #: shared-bindings/microcontroller/Pin.c msgid "%q in use" msgstr "%q ay ginagamit" -#: py/obj.c py/objstr.c py/objstrunicode.c +#: py/objstr.c py/objstrunicode.c msgid "%q index out of range" msgstr "%q indeks wala sa sakop" @@ -119,7 +141,11 @@ msgstr "" msgid "%q is %q" msgstr "" -#: py/argcheck.c +#: ports/raspberrypi/common-hal/wifi/Radio.c +msgid "%q is read-only for this board" +msgstr "" + +#: py/argcheck.c shared-bindings/usb_hid/Device.c msgid "%q length must be %d" msgstr "" @@ -135,10 +161,6 @@ msgstr "" 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 "" @@ -160,24 +182,20 @@ msgid "%q must be >= %d" msgstr "" #: shared-bindings/analogbufio/BufferedIn.c +msgid "%q must be a bytearray or array of type 'H' or 'B'" +msgstr "" + #: 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" +#: ports/raspberrypi/bindings/cyw43/__init__.c py/argcheck.c py/objexcept.c +#: shared-bindings/canio/CAN.c shared-bindings/digitalio/Pull.c +msgid "%q must be of type %q or %q, not %q" msgstr "" -#: py/argcheck.c -msgid "%q must be an int" -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" +#: py/argcheck.c py/obj.c py/objstrunicode.c +msgid "%q must be of type %q, not %q" msgstr "" #: ports/atmel-samd/common-hal/busio/UART.c @@ -190,7 +208,6 @@ msgstr "" #: ports/atmel-samd/common-hal/pulseio/PulseIn.c #: ports/cxd56/common-hal/pulseio/PulseIn.c -#: ports/espressif/common-hal/coproc/Coproc.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 @@ -202,8 +219,8 @@ msgstr "" msgid "%q pin invalid" msgstr "" -#: shared-bindings/usb_hid/Device.c -msgid "%q with a report ID of 0 must be of length 1" +#: py/objrange.c py/objslice.c shared-bindings/random/__init__.c +msgid "%q step cannot be zero" msgstr "" #: py/bc.c py/objnamedtuple.c @@ -282,7 +299,7 @@ msgstr "Inaasahan ng '%s' ang hangang r%d" #: py/emitinlinethumb.c #, c-format msgid "'%s' expects {r0, r1, ...}" -msgstr "Inaasahan ng '%s' ay {r0, r1, …}" +msgstr "Inaasahan ng '%s' ay {r0, r1, ...}" #: py/emitinlinextensa.c #, c-format @@ -304,7 +321,7 @@ msgstr "" msgid "'%s' object doesn't support item deletion" msgstr "" -#: ports/raspberrypi/common-hal/wifi/Radio.c py/runtime.c +#: py/runtime.c msgid "'%s' object has no attribute '%q'" msgstr "'%s' object ay walang attribute '%q'" @@ -404,6 +421,10 @@ msgstr "" msgid "Address must be %d bytes long" msgstr "ang palette ay dapat 32 bytes ang haba" +#: ports/espressif/common-hal/memorymap/AddressRange.c +msgid "Address range not allowed" +msgstr "" + #: ports/espressif/common-hal/canio/CAN.c msgid "All CAN peripherals are in use" msgstr "" @@ -431,7 +452,6 @@ msgid "All SPI peripherals are in use" msgstr "Lahat ng SPI peripherals ay ginagamit" #: ports/espressif/common-hal/busio/UART.c ports/nrf/common-hal/busio/UART.c -#: ports/raspberrypi/common-hal/busio/UART.c #, fuzzy msgid "All UART peripherals are in use" msgstr "Lahat ng I2C peripherals ginagamit" @@ -485,7 +505,7 @@ msgstr "" msgid "Already have all-matches listener" msgstr "" -#: ports/espressif/common-hal/coproc/__init__.c +#: ports/espressif/common-hal/espulp/ULP.c #: shared-module/memorymonitor/AllocationAlarm.c #: shared-module/memorymonitor/AllocationSize.c msgid "Already running" @@ -496,6 +516,11 @@ msgstr "" msgid "Already scanning for wifi networks" msgstr "" +#: shared-module/os/getenv.c +#, c-format +msgid "An error occurred while retrieving '%s':\n" +msgstr "" + #: ports/stm/common-hal/audiopwmio/PWMAudioOut.c msgid "Another PWMAudioOut is already active" msgstr "" @@ -509,24 +534,16 @@ msgstr "Isa pang send ay aktibo na" msgid "Array must contain halfwords (type 'H')" msgstr "May halfwords (type 'H') dapat ang array" -#: shared-bindings/alarm/SleepMemory.c shared-bindings/coproc/CoprocMemory.c +#: shared-bindings/alarm/SleepMemory.c shared-bindings/memorymap/AddressRange.c #: shared-bindings/nvm/ByteArray.c msgid "Array values should be single bytes." msgstr "Array values ay dapat single bytes." -#: shared-bindings/microcontroller/Pin.c -msgid "At most %d %q may be specified (not %d)" -msgstr "" - #: shared-module/memorymonitor/AllocationAlarm.c #, c-format msgid "Attempt to allocate %d blocks" msgstr "" -#: supervisor/shared/safe_mode.c -msgid "Attempted heap allocation when VM not running." -msgstr "" - #: ports/raspberrypi/audio_dma.c msgid "Audio conversion not implemented" msgstr "" @@ -577,20 +594,13 @@ msgid "Bitmap size and bits per value must match" msgstr "" #: supervisor/shared/safe_mode.c -msgid "Boot device must be first device (interface #0)." +msgid "Boot device must be first (interface #0)." msgstr "" #: ports/mimxrt10xx/common-hal/busio/UART.c msgid "Both RX and TX required for flow control" msgstr "" -#: ports/atmel-samd/boards/circuitplayground_express/mpconfigboard.h -#: ports/atmel-samd/boards/circuitplayground_express_crickit/mpconfigboard.h -#: ports/atmel-samd/boards/circuitplayground_express_displayio/mpconfigboard.h -#: ports/atmel-samd/boards/meowmeow/mpconfigboard.h -msgid "Both buttons were pressed at start up.\n" -msgstr "" - #: ports/atmel-samd/common-hal/rotaryio/IncrementalEncoder.c msgid "Both pins must support hardware interrupts" msgstr "Ang parehong mga pin ay dapat na sumusuporta sa hardware interrupts" @@ -656,11 +666,6 @@ msgstr "" msgid "Bus pin %d is already in use" msgstr "Ginagamit na ang DAC" -#: ports/espressif/boards/m5stack_core_basic/mpconfigboard.h -#: ports/espressif/boards/m5stack_core_fire/mpconfigboard.h -msgid "Button A was pressed at start up.\n" -msgstr "" - #: shared-bindings/_bleio/UUID.c #, fuzzy msgid "Byte buffer must be 16 bytes." @@ -793,10 +798,6 @@ msgstr "" msgid "CircuitPython core code crashed hard. Whoops!\n" msgstr "" -#: supervisor/shared/safe_mode.c -msgid "CircuitPython was unable to allocate the heap." -msgstr "" - #: shared-module/bitbangio/I2C.c msgid "Clock stretch too long" msgstr "Masyadong mahaba ang Clock stretch" @@ -835,10 +836,6 @@ msgstr "" msgid "Couldn't allocate decoder" msgstr "" -#: supervisor/shared/safe_mode.c -msgid "Crash into the HardFault_Handler." -msgstr "" - #: ports/stm/common-hal/analogio/AnalogOut.c msgid "DAC Channel Init Error" msgstr "" @@ -904,6 +901,10 @@ msgstr "" msgid "Drive mode not used when direction is input." msgstr "Drive mode ay hindi ginagamit kapag ang direksyon ay input." +#: py/obj.c +msgid "During handling of the above exception, another exception occurred:" +msgstr "" + #: shared-bindings/aesio/aes.c msgid "ECB only operates on 16 bytes at a time" msgstr "" @@ -929,24 +930,16 @@ msgstr "" msgid "Error in regex" msgstr "May pagkakamali sa REGEX" +#: supervisor/shared/safe_mode.c +msgid "Error in safemode.py." +msgstr "" + #: shared-bindings/socketpool/Socket.c shared-bindings/ssl/SSLSocket.c msgid "Error: Failure to bind" msgstr "" -#: py/enum.c shared-bindings/_bleio/__init__.c shared-bindings/aesio/aes.c -#: shared-bindings/alarm/__init__.c shared-bindings/alarm/coproc/CoprocAlarm.c -#: shared-bindings/busio/SPI.c shared-bindings/coproc/Coproc.c -#: shared-bindings/coproc/__init__.c shared-bindings/microcontroller/Pin.c -#: shared-bindings/neopixel_write/__init__.c -msgid "Expected a %q" -msgstr "Umasa ng %q" - -#: ports/raspberrypi/bindings/cyw43/__init__.c -msgid "Expected a %q or %q" -msgstr "" - #: shared-bindings/alarm/__init__.c -msgid "Expected an %q" +msgid "Expected a kind of %q" msgstr "" #: ports/espressif/common-hal/_bleio/Adapter.c @@ -1014,13 +1007,17 @@ msgid "Failed to write internal flash." msgstr "" #: supervisor/shared/safe_mode.c -msgid "Fatal error." +msgid "Fault detected by hardware." msgstr "" #: py/moduerrno.c msgid "File exists" msgstr "Mayroong file" +#: shared-module/os/getenv.c +msgid "File not found" +msgstr "" + #: ports/atmel-samd/common-hal/canio/Listener.c #: ports/espressif/common-hal/canio/Listener.c #: ports/stm/common-hal/canio/Listener.c @@ -1035,7 +1032,6 @@ msgstr "" msgid "Firmware is invalid" msgstr "" -#: ports/espressif/common-hal/coproc/Coproc.c #: ports/espressif/common-hal/dualbank/__init__.c msgid "Firmware is too big" msgstr "" @@ -1077,6 +1073,8 @@ msgstr "" #: shared-bindings/displayio/Display.c #: shared-bindings/displayio/EPaperDisplay.c #: shared-bindings/framebufferio/FramebufferDisplay.c +#: shared-module/displayio/Display.c +#: shared-module/framebufferio/FramebufferDisplay.c msgid "Group already used" msgstr "" @@ -1097,6 +1095,15 @@ msgstr "" msgid "Hardware in use, try alternative pins" msgstr "" +#: supervisor/shared/safe_mode.c +msgid "Heap allocation when VM not running." +msgstr "" + +#: supervisor/shared/safe_mode.c +msgid "" +"Heap was corrupted because the stack was too small. Increase stack size." +msgstr "" + #: extmod/vfs_posix_file.c py/objstringio.c msgid "I/O operation on closed file" msgstr "I/O operasyon sa saradong file" @@ -1114,11 +1121,6 @@ msgstr "" msgid "I2SOut not available" msgstr "" -#: shared-bindings/aesio/aes.c -#, c-format -msgid "IV must be %d bytes long" -msgstr "" - #: ports/raspberrypi/bindings/rp2pio/StateMachine.c msgid "In-buffer elements must be <= 4 bytes long" msgstr "" @@ -1205,6 +1207,7 @@ msgid "Internal define error" msgstr "" #: ports/espressif/common-hal/paralleldisplay/ParallelBus.c +#: shared-module/os/getenv.c msgid "Internal error" msgstr "" @@ -1217,6 +1220,10 @@ msgstr "" msgid "Internal watchdog timer expired." msgstr "" +#: supervisor/shared/safe_mode.c +msgid "Interrupt error." +msgstr "" + #: py/argcheck.c shared-bindings/digitalio/DigitalInOut.c msgid "Invalid %q" msgstr "" @@ -1251,6 +1258,11 @@ msgstr "Maling argumento" msgid "Invalid bits per value" msgstr "" +#: shared-module/os/getenv.c +#, c-format +msgid "Invalid byte %.*s" +msgstr "" + #: ports/atmel-samd/common-hal/imagecapture/ParallelImageCapture.c #, c-format msgid "Invalid data_pins[%d]" @@ -1260,18 +1272,10 @@ msgstr "" msgid "Invalid format chunk size" msgstr "Mali ang format ng chunk size" -#: supervisor/shared/safe_mode.c -msgid "Invalid memory access." -msgstr "" - #: ports/espressif/common-hal/wifi/Radio.c msgid "Invalid multicast MAC address" msgstr "" -#: shared-bindings/busio/UART.c -msgid "Invalid pins" -msgstr "Mali ang pins" - #: ports/espressif/common-hal/espidf/__init__.c ports/espressif/esp_error.c msgid "Invalid size" msgstr "" @@ -1285,10 +1289,18 @@ msgstr "" msgid "Invalid state" msgstr "" +#: shared-module/os/getenv.c +msgid "Invalid unicode escape" +msgstr "" + #: shared-bindings/aesio/aes.c msgid "Key must be 16, 24, or 32 bytes long" msgstr "" +#: shared-module/os/getenv.c +msgid "Key not found" +msgstr "" + #: shared-module/is31fl3741/FrameBuffer.c msgid "LED mappings must match display size" msgstr "" @@ -1395,6 +1407,10 @@ msgstr "" msgid "NVS Error" msgstr "" +#: shared-bindings/socketpool/SocketPool.c +msgid "Name or service not known" +msgstr "" + #: py/qstr.c msgid "Name too long" msgstr "" @@ -1509,11 +1525,6 @@ msgstr "" msgid "No long integer support" msgstr "" -#: shared-module/usb_hid/__init__.c -#, c-format -msgid "No more than %d HID devices allowed" -msgstr "" - #: shared-bindings/wifi/Radio.c msgid "No network with that ssid" msgstr "" @@ -1549,10 +1560,6 @@ msgstr "Walang file/directory" msgid "No timer available" msgstr "" -#: supervisor/shared/safe_mode.c -msgid "Nordic system firmware failure assertion." -msgstr "" - #: ports/nrf/common-hal/_bleio/__init__.c msgid "Nordic system firmware out of memory" msgstr "" @@ -1573,10 +1580,6 @@ msgstr "Hindi maka connect sa AP" msgid "Not playing" msgstr "Hindi playing" -#: shared-bindings/_bleio/__init__.c -msgid "Not settable" -msgstr "" - #: ports/espressif/common-hal/paralleldisplay/ParallelBus.c #, c-format msgid "Number of data_pins must be 8 or 16, not %d" @@ -1641,11 +1644,14 @@ msgid "" "%d bpp given" msgstr "" -#: ports/espressif/common-hal/alarm/coproc/CoprocAlarm.c #: ports/espressif/common-hal/alarm/touch/TouchAlarm.c msgid "Only one %q can be set in deep sleep." msgstr "" +#: ports/espressif/common-hal/espulp/ULPAlarm.c +msgid "Only one %q can be set." +msgstr "" + #: ports/espressif/common-hal/i2ctarget/I2CTarget.c #: ports/raspberrypi/common-hal/i2ctarget/I2CTarget.c msgid "Only one address is allowed" @@ -1678,6 +1684,10 @@ msgstr "" msgid "Operation timed out" msgstr "" +#: ports/raspberrypi/common-hal/mdns/Server.c +msgid "Out of MDNS service slots" +msgstr "" + #: ports/espressif/common-hal/espidf/__init__.c ports/espressif/esp_error.c msgid "Out of memory" msgstr "" @@ -1802,6 +1812,10 @@ msgstr "" msgid "Program size invalid" msgstr "" +#: ports/espressif/common-hal/espulp/ULP.c +msgid "Program too long" +msgstr "" + #: shared-bindings/digitalio/DigitalInOut.c msgid "Pull not used when direction is output." msgstr "Pull hindi ginagamit kapag ang direksyon ay output." @@ -1841,8 +1855,9 @@ msgstr "Hindi supportado ang RTC sa board na ito" msgid "Random number generation error" msgstr "" +#: shared-bindings/_bleio/__init__.c #: shared-bindings/memorymonitor/AllocationSize.c -#: shared-bindings/pulseio/PulseIn.c +#: shared-bindings/pulseio/PulseIn.c shared-module/displayio/Bitmap.c msgid "Read-only" msgstr "Basahin-lamang" @@ -1850,11 +1865,6 @@ msgstr "Basahin-lamang" msgid "Read-only filesystem" msgstr "Basahin-lamang mode" -#: shared-module/displayio/Bitmap.c -#, fuzzy -msgid "Read-only object" -msgstr "Basahin-lamang" - #: ports/espressif/common-hal/espidf/__init__.c ports/espressif/esp_error.c msgid "Received response was invalid" msgstr "" @@ -1947,7 +1957,7 @@ msgstr "" msgid "Sleep Memory not available" msgstr "" -#: shared-bindings/alarm/SleepMemory.c shared-bindings/coproc/CoprocMemory.c +#: shared-bindings/alarm/SleepMemory.c shared-bindings/memorymap/AddressRange.c #: shared-bindings/nvm/ByteArray.c msgid "Slice and value different lengths." msgstr "Slice at value iba't ibang haba." @@ -1984,6 +1994,10 @@ msgstr "" msgid "Stereo right must be on PWM channel B" msgstr "" +#: ports/raspberrypi/common-hal/wifi/Radio.c +msgid "Stopping AP is not supported." +msgstr "" + #: ports/mimxrt10xx/common-hal/busio/UART.c ports/stm/common-hal/busio/UART.c msgid "Supply at least one UART pin" msgstr "" @@ -2001,35 +2015,11 @@ msgid "Temperature read timed out" msgstr "" #: supervisor/shared/safe_mode.c -msgid "The BOOT button was pressed at start up.\n" +msgid "The `microcontroller` module was used to boot into safe mode." msgstr "" -#: supervisor/shared/safe_mode.c -msgid "" -"The CircuitPython heap was corrupted because the stack was too small.\n" -"Increase the stack size if you know how. If not:" -msgstr "" - -#: ports/espressif/boards/adafruit_feather_esp32_v2/mpconfigboard.h -msgid "The SW38 button was pressed at start up.\n" -msgstr "" - -#: ports/espressif/boards/hardkernel_odroid_go/mpconfigboard.h -msgid "The VOLUME button was pressed at start up.\n" -msgstr "" - -#: supervisor/shared/safe_mode.c -msgid "" -"The `microcontroller` module was used to boot into safe mode. Press reset to " -"exit safe mode." -msgstr "" - -#: ports/espressif/boards/m5stack_atom_lite/mpconfigboard.h -msgid "The central button was pressed at start up.\n" -msgstr "" - -#: ports/nrf/boards/aramcon2_badge/mpconfigboard.h -msgid "The left button was pressed at start up.\n" +#: py/obj.c +msgid "The above exception was the direct cause of the following exception:" msgstr "" #: shared-bindings/rgbmatrix/RGBMatrix.c @@ -2037,10 +2027,7 @@ msgid "The length of rgb_pins must be 6, 12, 18, 24, or 30" msgstr "" #: supervisor/shared/safe_mode.c -msgid "" -"The microcontroller's power dipped. Make sure your power supply provides\n" -"enough power for the whole circuit and press reset (after ejecting " -"CIRCUITPY)." +msgid "The power dipped. Make sure you are providing enough power." msgstr "" #: shared-module/audiomixer/MixerVoice.c @@ -2059,6 +2046,10 @@ msgstr "Ang sample rate ng sample ay hindi tugma sa mixer" msgid "The sample's signedness does not match the mixer's" msgstr "Ang signedness ng sample hindi tugma sa mixer" +#: supervisor/shared/safe_mode.c +msgid "Third-party firmware fatal error." +msgstr "" + #: shared-module/imagecapture/ParallelImageCapture.c msgid "This microcontroller does not support continuous capture." msgstr "" @@ -2091,10 +2082,6 @@ msgstr "" msgid "Timeout is too long: Maximum timeout length is %d seconds" msgstr "" -#: supervisor/shared/safe_mode.c -msgid "To exit, please reset the board without requesting safe mode." -msgstr "" - #: ports/atmel-samd/common-hal/audiobusio/I2SOut.c msgid "Too many channels in sample" msgstr "" @@ -2139,6 +2126,10 @@ msgstr "" msgid "UART init" msgstr "" +#: ports/raspberrypi/common-hal/busio/UART.c +msgid "UART peripheral in use" +msgstr "" + #: ports/stm/common-hal/busio/UART.c msgid "UART re-init" msgstr "" @@ -2186,6 +2177,10 @@ msgstr "" msgid "Unable to allocate buffers for signed conversion" msgstr "Hindi ma-allocate ang buffers para sa naka-sign na conversion" +#: supervisor/shared/safe_mode.c +msgid "Unable to allocate the heap." +msgstr "" + #: ports/espressif/common-hal/busio/I2C.c msgid "Unable to create lock" msgstr "" @@ -2209,11 +2204,12 @@ msgid "Unable to read color palette data" msgstr "" #: ports/espressif/common-hal/mdns/Server.c +#: ports/raspberrypi/common-hal/mdns/Server.c msgid "Unable to start mDNS query" msgstr "" -#: shared-bindings/coproc/CoprocMemory.c -msgid "Unable to write" +#: shared-bindings/memorymap/AddressRange.c +msgid "Unable to write to address." msgstr "" #: shared-bindings/nvm/ByteArray.c @@ -2285,6 +2281,7 @@ msgid "Unkown error code %d" msgstr "" #: shared-bindings/adafruit_pixelbuf/PixelBuf.c +#: shared-module/_pixelmap/PixelMap.c #, c-format msgid "Unmatched number of items on RHS (expected %d, got %d)." msgstr "" @@ -2370,6 +2367,18 @@ msgstr "" msgid "Wi-Fi: " msgstr "" +#: ports/raspberrypi/common-hal/wifi/Radio.c +msgid "Wifi is in access point mode." +msgstr "" + +#: ports/raspberrypi/common-hal/wifi/Radio.c +msgid "Wifi is in station mode." +msgstr "" + +#: ports/raspberrypi/common-hal/wifi/Radio.c +msgid "Wifi is not enabled" +msgstr "" + #: main.c msgid "Woken up by alarm.\n" msgstr "" @@ -2379,13 +2388,48 @@ msgstr "" msgid "Writes not supported on Characteristic" msgstr "" -#: supervisor/shared/safe_mode.c -msgid "You are in safe mode because:\n" +#: ports/atmel-samd/boards/circuitplayground_express/mpconfigboard.h +#: ports/atmel-samd/boards/circuitplayground_express_crickit/mpconfigboard.h +#: ports/atmel-samd/boards/circuitplayground_express_displayio/mpconfigboard.h +#: ports/atmel-samd/boards/meowmeow/mpconfigboard.h +msgid "You pressed both buttons at start up." +msgstr "" + +#: ports/espressif/boards/m5stack_core_basic/mpconfigboard.h +#: ports/espressif/boards/m5stack_core_fire/mpconfigboard.h +#: ports/espressif/boards/m5stack_stick_c/mpconfigboard.h +msgid "You pressed button A at start up." msgstr "" #: supervisor/shared/safe_mode.c -msgid "" -"You pressed the reset button during boot. Press again to exit safe mode." +msgid "You pressed the BOOT button at start up" +msgstr "" + +#: ports/espressif/boards/adafruit_feather_esp32_v2/mpconfigboard.h +msgid "You pressed the SW38 button at start up." +msgstr "" + +#: ports/espressif/boards/hardkernel_odroid_go/mpconfigboard.h +msgid "You pressed the VOLUME button at start up." +msgstr "" + +#: ports/espressif/boards/m5stack_atom_echo/mpconfigboard.h +#: ports/espressif/boards/m5stack_atom_lite/mpconfigboard.h +#: ports/espressif/boards/m5stack_atom_matrix/mpconfigboard.h +#: ports/espressif/boards/m5stack_atom_u/mpconfigboard.h +msgid "You pressed the central button at start up." +msgstr "" + +#: ports/nrf/boards/aramcon2_badge/mpconfigboard.h +msgid "You pressed the left button at start up." +msgstr "" + +#: supervisor/shared/safe_mode.c +msgid "You pressed the reset button during boot." +msgstr "" + +#: supervisor/shared/micropython.c +msgid "[truncated due to length]" msgstr "" #: py/objtype.c @@ -2457,8 +2501,12 @@ msgstr "" msgid "array has too many dimensions" msgstr "" +#: extmod/ulab/code/ndarray.c +msgid "array is too big" +msgstr "" + #: py/objarray.c shared-bindings/alarm/SleepMemory.c -#: shared-bindings/coproc/CoprocMemory.c shared-bindings/nvm/ByteArray.c +#: shared-bindings/memorymap/AddressRange.c shared-bindings/nvm/ByteArray.c msgid "array/bytes required on right side" msgstr "array/bytes kinakailangan sa kanang bahagi" @@ -2552,10 +2600,6 @@ msgstr "masyadong maliit ang buffer" msgid "buffer too small for requested bytes" msgstr "" -#: shared-bindings/adafruit_pixelbuf/PixelBuf.c -msgid "byteorder is not a string" -msgstr "" - #: py/objarray.c msgid "bytes length not a multiple of item size" msgstr "" @@ -2598,14 +2642,10 @@ msgstr "hindi ma i-assign sa expression" msgid "can't cancel self" msgstr "" -#: py/obj.c py/objint.c shared-module/adafruit_pixelbuf/PixelBuf.c +#: py/obj.c py/objint.c py/runtime.c shared-module/adafruit_pixelbuf/PixelBuf.c msgid "can't convert %q to %q" msgstr "" -#: py/runtime.c -msgid "can't convert %q to int" -msgstr "" - #: py/obj.c #, c-format msgid "can't convert %s to complex" @@ -2688,6 +2728,10 @@ msgstr "" msgid "can't set attribute" msgstr "hindi ma i-set ang attribute" +#: py/runtime.c +msgid "can't set attribute '%q'" +msgstr "" + #: py/emitnative.c msgid "can't store '%q'" msgstr "hindi ma i-store ang '%q'" @@ -2784,7 +2828,7 @@ msgstr "" #: shared-bindings/displayio/Palette.c msgid "color buffer must be a bytearray or array of type 'b' or 'B'" -msgstr "ang color buffer ay dapat bytearray o array na type ‘b’ or ‘B’" +msgstr "ang color buffer ay dapat bytearray o array na type 'b' or 'B'" #: shared-bindings/displayio/Palette.c msgid "color must be between 0x000000 and 0xffffff" @@ -2794,10 +2838,6 @@ msgstr "color ay dapat mula sa 0x000000 hangang 0xffffff" msgid "comparison of int and uint" msgstr "" -#: py/objcomplex.c -msgid "complex division by zero" -msgstr "kumplikadong dibisyon sa pamamagitan ng zero" - #: py/objfloat.c py/parsenum.c msgid "complex values not supported" msgstr "kumplikadong values hindi sinusuportahan" @@ -2904,12 +2944,11 @@ msgstr "" msgid "div/mod not implemented for uint" msgstr "" -#: py/objfloat.c py/objint_mpz.c +#: extmod/ulab/code/numpy/create.c msgid "divide by zero" msgstr "" -#: py/modmath.c py/objint_longlong.c py/runtime.c -#: shared-bindings/math/__init__.c +#: py/runtime.c msgid "division by zero" msgstr "dibisyon ng zero" @@ -2950,9 +2989,9 @@ msgstr "" msgid "error = 0x%08lX" msgstr "" -#: ports/espressif/common-hal/esp32_camera/Camera.c +#: ports/espressif/common-hal/espcamera/Camera.c msgid "" -"esp32_camera.Camera requires reserved PSRAM to be configured. See the " +"espcamera.Camera requires reserved PSRAM to be configured. See the " "documentation for instructions." msgstr "" @@ -2960,14 +2999,6 @@ msgstr "" msgid "exceptions must derive from BaseException" msgstr "ang mga exceptions ay dapat makuha mula sa BaseException" -#: shared-bindings/canio/CAN.c -msgid "expected '%q' but got '%q'" -msgstr "" - -#: shared-bindings/canio/CAN.c -msgid "expected '%q' or '%q' but got '%q'" -msgstr "" - #: py/objstr.c msgid "expected ':' after format specifier" msgstr "umaasa ng ':' pagkatapos ng format specifier" @@ -3066,10 +3097,6 @@ msgstr "font ay dapat 2048 bytes ang haba" msgid "format requires a dict" msgstr "kailangan ng format ng dict" -#: shared-bindings/microcontroller/Processor.c -msgid "frequency is read-only for this board" -msgstr "" - #: py/objdeque.c msgid "full" msgstr "puno" @@ -3183,8 +3210,12 @@ msgstr "mali ang padding" msgid "index is out of bounds" msgstr "" +#: shared-bindings/_pixelmap/PixelMap.c +msgid "index must be tuple or int" +msgstr "" + #: extmod/ulab/code/numpy/numerical.c extmod/ulab/code/ulab_tools.c -#: ports/espressif/common-hal/pulseio/PulseIn.c py/obj.c +#: ports/espressif/common-hal/pulseio/PulseIn.c #: shared-bindings/bitmaptools/__init__.c msgid "index out of range" msgstr "index wala sa sakop" @@ -3282,10 +3313,6 @@ msgstr "" msgid "inputs are not iterable" msgstr "" -#: py/parsenum.c -msgid "int() arg 2 must be >= 2 and <= 36" -msgstr "int() arg 2 ay dapat >=2 at <= 36" - #: extmod/ulab/code/numpy/approx.c msgid "interp is defined for 1D iterables of equal length" msgstr "" @@ -3342,7 +3369,7 @@ msgstr "mali ang key" msgid "invalid micropython decorator" msgstr "mali ang micropython decorator" -#: ports/espressif/common-hal/esp32_camera/Camera.c +#: ports/espressif/common-hal/espcamera/Camera.c msgid "invalid setting" msgstr "" @@ -3367,10 +3394,6 @@ msgstr "maling sintaks sa integer na may base %d" msgid "invalid syntax for number" msgstr "maling sintaks sa number" -#: py/objexcept.c -msgid "invalid traceback" -msgstr "" - #: py/objtype.c msgid "issubclass() arg 1 must be a class" msgstr "issubclass() arg 1 ay dapat na class" @@ -3431,19 +3454,17 @@ msgstr "local '%q' ginamit bago alam ang type" msgid "local variable referenced before assignment" msgstr "local variable na reference bago na i-assign" -#: py/objint.c -msgid "long int not supported in this build" -msgstr "long int hindi sinusuportahan sa build na ito" - #: ports/espressif/common-hal/canio/CAN.c msgid "loopback + silent mode not supported by peripheral" msgstr "" #: ports/espressif/common-hal/mdns/Server.c +#: ports/raspberrypi/common-hal/mdns/Server.c msgid "mDNS already initialized" msgstr "" #: ports/espressif/common-hal/mdns/Server.c +#: ports/raspberrypi/common-hal/mdns/Server.c msgid "mDNS only works with built-in WiFi" msgstr "" @@ -3572,6 +3593,10 @@ msgstr "negatibong power na walang float support" msgid "negative shift count" msgstr "negative shift count" +#: shared-bindings/_pixelmap/PixelMap.c +msgid "nested index must be int" +msgstr "" + #: shared-module/sdcardio/SDCard.c msgid "no SD card" msgstr "" @@ -3605,7 +3630,7 @@ msgstr "" msgid "no response from SD card" msgstr "" -#: ports/espressif/common-hal/esp32_camera/Camera.c py/objobject.c py/runtime.c +#: ports/espressif/common-hal/espcamera/Camera.c py/objobject.c py/runtime.c msgid "no such attribute" msgstr "walang ganoon na attribute" @@ -3742,6 +3767,10 @@ msgstr "" msgid "only mono is supported" msgstr "" +#: extmod/ulab/code/numpy/create.c +msgid "only ndarrays can be concatenated" +msgstr "" + #: ports/stm/common-hal/audiobusio/PDMIn.c msgid "only oversample=64 is supported" msgstr "" @@ -3752,7 +3781,7 @@ msgid "only sample_rate=16000 is supported" msgstr "" #: py/objarray.c py/objstr.c py/objstrunicode.c py/objtuple.c -#: shared-bindings/alarm/SleepMemory.c shared-bindings/coproc/CoprocMemory.c +#: shared-bindings/alarm/SleepMemory.c shared-bindings/memorymap/AddressRange.c #: shared-bindings/nvm/ByteArray.c msgid "only slices with step=1 (aka None) are supported" msgstr "ang mga slices lamang na may hakbang = 1 (aka None) ang sinusuportahan" @@ -3904,7 +3933,7 @@ msgstr "return annotation ay dapat na identifier" #: py/emitnative.c msgid "return expected '%q' but got '%q'" -msgstr "return umasa ng '%q' pero ang nakuha ay ‘%q’" +msgstr "return umasa ng '%q' pero ang nakuha ay '%q'" #: shared-bindings/rgbmatrix/RGBMatrix.c #, c-format @@ -3969,10 +3998,6 @@ msgstr "sleep length ay dapat hindi negatibo" msgid "slice step can't be zero" msgstr "" -#: py/objslice.c -msgid "slice step cannot be zero" -msgstr "slice step ay hindi puedeng 0" - #: py/nativeglue.c msgid "slice unsupported" msgstr "" @@ -4021,10 +4046,6 @@ msgstr "" msgid "start/end indices" msgstr "start/end indeks" -#: shared-bindings/random/__init__.c -msgid "step must be non-zero" -msgstr "step ay dapat hindi zero" - #: shared-bindings/random/__init__.c msgid "stop not reachable from start" msgstr "stop hindi maabot sa simula" @@ -4033,10 +4054,6 @@ msgstr "stop hindi maabot sa simula" msgid "stream operation not supported" msgstr "stream operation hindi sinusuportahan" -#: py/objstrunicode.c -msgid "string indices must be integers, not %q" -msgstr "" - #: py/stream.c msgid "string not supported; use bytes or bytearray" msgstr "string hindi supportado; gumamit ng bytes o kaya bytearray" @@ -4069,10 +4086,6 @@ msgstr "sintaks error sa JSON" msgid "syntax error in uctypes descriptor" msgstr "may pagkakamali sa sintaks sa uctypes descriptor" -#: shared-bindings/time/__init__.c -msgid "time.struct_time() takes a 9-sequence" -msgstr "time.struct_time() kumukuha ng 9-sequence" - #: ports/atmel-samd/common-hal/watchdog/WatchDogTimer.c #: ports/espressif/common-hal/watchdog/WatchDogTimer.c #: ports/nrf/common-hal/watchdog/WatchDogTimer.c @@ -4356,10 +4369,6 @@ msgstr "" msgid "y value out of bounds" msgstr "wala sa sakop ang address" -#: py/objrange.c -msgid "zero step" -msgstr "zero step" - #: extmod/ulab/code/scipy/signal/signal.c msgid "zi must be an ndarray" msgstr "" @@ -4372,6 +4381,37 @@ msgstr "" msgid "zi must be of shape (n_section, 2)" msgstr "" +#~ msgid "Expected a %q" +#~ msgstr "Umasa ng %q" + +#, fuzzy +#~ msgid "Read-only object" +#~ msgstr "Basahin-lamang" + +#~ msgid "Invalid pins" +#~ msgstr "Mali ang pins" + +#~ msgid "complex division by zero" +#~ msgstr "kumplikadong dibisyon sa pamamagitan ng zero" + +#~ msgid "int() arg 2 must be >= 2 and <= 36" +#~ msgstr "int() arg 2 ay dapat >=2 at <= 36" + +#~ msgid "long int not supported in this build" +#~ msgstr "long int hindi sinusuportahan sa build na ito" + +#~ msgid "slice step cannot be zero" +#~ msgstr "slice step ay hindi puedeng 0" + +#~ msgid "step must be non-zero" +#~ msgstr "step ay dapat hindi zero" + +#~ msgid "time.struct_time() takes a 9-sequence" +#~ msgstr "time.struct_time() kumukuha ng 9-sequence" + +#~ msgid "zero step" +#~ msgstr "zero step" + #~ msgid "%q indices must be integers, not %s" #~ msgstr "%q indeks ay dapat integers, hindi %s" @@ -4614,7 +4654,7 @@ msgstr "" #~ "Mangyaring bisitahin ang learn.adafruit.com/category/circuitpython para " #~ "sa project guides.\n" #~ "\n" -#~ "Para makita ang listahan ng modules, `help(“modules”)`.\n" +#~ "Para makita ang listahan ng modules, `help(\"modules\")`.\n" #~ msgid "integer required" #~ msgstr "kailangan ng int" diff --git a/locale/fr.po b/locale/fr.po index 2a4d6b230f..19f75abfac 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: 2022-11-09 19:20+0000\n" -"Last-Translator: Deleted User \n" +"PO-Revision-Date: 2022-12-27 18:02+0000\n" +"Last-Translator: Blinka CircuitPython \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.15-dev\n" +"X-Generator: Weblate 4.15.1-dev\n" #: main.c msgid "" @@ -37,13 +37,21 @@ msgstr "" #: supervisor/shared/safe_mode.c msgid "" "\n" -"Please file an issue with the contents of your CIRCUITPY drive at \n" -"https://github.com/adafruit/circuitpython/issues\n" +"Please file an issue with your program at https://github.com/adafruit/" +"circuitpython/issues." msgstr "" + +#: supervisor/shared/safe_mode.c +msgid "" "\n" -"Veuillez signaler un problème avec le contenu de votre lecteur CIRCUITPY à " -"l'adresse\n" -"https://github.com/adafruit/circuitpython/issues\n" +"Press reset to exit safe mode.\n" +msgstr "" + +#: supervisor/shared/safe_mode.c +msgid "" +"\n" +"You are in safe mode because:\n" +msgstr "" #: py/obj.c msgid " File \"%q\"" @@ -75,6 +83,11 @@ msgstr "%%c nécessite un chiffre entier 'int' ou un caractère 'char'" msgid "%02X" msgstr "%02X" +#: shared-module/os/getenv.c +#, c-format +msgid "%S" +msgstr "%S" + #: shared-bindings/rgbmatrix/RGBMatrix.c #, c-format msgid "" @@ -92,7 +105,7 @@ msgstr "" #: 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 +#: ports/stm/common-hal/canio/Listener.c ports/stm/common-hal/rtc/RTC.c msgid "%q" msgstr "%q" @@ -112,13 +125,18 @@ msgstr "%q contient des broches en double" msgid "%q failure: %d" msgstr "Échec de %q : %d" +#: py/argcheck.c +msgid "%q in %q must be of type %q, not %q" +msgstr "" + +#: ports/espressif/common-hal/espulp/ULP.c #: ports/raspberrypi/common-hal/rp2pio/StateMachine.c #: shared-bindings/digitalio/DigitalInOut.c #: shared-bindings/microcontroller/Pin.c msgid "%q in use" msgstr "%q en cours d'utilisation" -#: py/obj.c py/objstr.c py/objstrunicode.c +#: py/objstr.c py/objstrunicode.c msgid "%q index out of range" msgstr "index %q hors de portée" @@ -130,7 +148,11 @@ msgstr "échec de l'initialisation %q" msgid "%q is %q" msgstr "" -#: py/argcheck.c +#: ports/raspberrypi/common-hal/wifi/Radio.c +msgid "%q is read-only for this board" +msgstr "" + +#: py/argcheck.c shared-bindings/usb_hid/Device.c msgid "%q length must be %d" msgstr "La longeur de %q doit être %d" @@ -146,10 +168,6 @@ msgstr "La longeur de %q doit être <= %d" 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" @@ -171,25 +189,21 @@ msgid "%q must be >= %d" msgstr "%q doit être >= %d" #: shared-bindings/analogbufio/BufferedIn.c +msgid "%q must be a bytearray or array of type 'H' or 'B'" +msgstr "" + #: shared-bindings/audiocore/RawSample.c msgid "%q must be a bytearray or array of type 'h', 'H', 'b', or 'B'" msgstr "%q doit être a bytearray ou array de type 'h', 'H', 'b', ou 'B'" -#: py/argcheck.c -msgid "%q must be a string" -msgstr "%q doit être une chaîne de caractères" +#: ports/raspberrypi/bindings/cyw43/__init__.c py/argcheck.c py/objexcept.c +#: shared-bindings/canio/CAN.c shared-bindings/digitalio/Pull.c +msgid "%q must be of type %q or %q, not %q" +msgstr "" -#: 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" -msgstr "%q doit être du type %q" - -#: shared-bindings/digitalio/Pull.c -msgid "%q must be of type %q or None" -msgstr "%q doit être du type %q ou None" +#: py/argcheck.c py/obj.c py/objstrunicode.c +msgid "%q must be of type %q, not %q" +msgstr "" #: ports/atmel-samd/common-hal/busio/UART.c msgid "%q must be power of 2" @@ -201,7 +215,6 @@ msgstr "%q est hors limites" #: ports/atmel-samd/common-hal/pulseio/PulseIn.c #: ports/cxd56/common-hal/pulseio/PulseIn.c -#: ports/espressif/common-hal/coproc/Coproc.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 @@ -213,9 +226,9 @@ msgstr "%q est hors de porté" msgid "%q pin invalid" msgstr "broche %q invalide" -#: 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" +#: py/objrange.c py/objslice.c shared-bindings/random/__init__.c +msgid "%q step cannot be zero" +msgstr "" #: py/bc.c py/objnamedtuple.c msgid "%q() takes %d positional arguments but %d were given" @@ -314,7 +327,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" -#: ports/raspberrypi/common-hal/wifi/Radio.c py/runtime.c +#: py/runtime.c msgid "'%s' object has no attribute '%q'" msgstr "l'objet '%s' n'a pas d'attribut '%q'" @@ -414,6 +427,10 @@ msgstr "ADC2 est utilisé pars le Wifi" msgid "Address must be %d bytes long" msgstr "L'adresse doit être longue de %d octets" +#: ports/espressif/common-hal/memorymap/AddressRange.c +msgid "Address range not allowed" +msgstr "" + #: ports/espressif/common-hal/canio/CAN.c msgid "All CAN peripherals are in use" msgstr "Tous les périphériques CAN sont utilisés" @@ -441,7 +458,6 @@ msgid "All SPI peripherals are in use" msgstr "Tous les périphériques SPI sont utilisés" #: 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 "Tous les périphériques UART sont utilisés" @@ -494,7 +510,7 @@ msgstr "S'annonce déjà." msgid "Already have all-matches listener" msgstr "Il y a déjà un auditeur all-matches" -#: ports/espressif/common-hal/coproc/__init__.c +#: ports/espressif/common-hal/espulp/ULP.c #: shared-module/memorymonitor/AllocationAlarm.c #: shared-module/memorymonitor/AllocationSize.c msgid "Already running" @@ -505,6 +521,11 @@ msgstr "Déjà en cours d'exécution" msgid "Already scanning for wifi networks" msgstr "Déjà à la recherche des réseaux wifi" +#: shared-module/os/getenv.c +#, c-format +msgid "An error occurred while retrieving '%s':\n" +msgstr "" + #: ports/stm/common-hal/audiopwmio/PWMAudioOut.c msgid "Another PWMAudioOut is already active" msgstr "Un autre PWMAudioOut est déjà actif" @@ -518,26 +539,16 @@ msgstr "Un autre envoi est déjà actif" msgid "Array must contain halfwords (type 'H')" msgstr "La matrice doit contenir des demi-mots (type 'H')" -#: shared-bindings/alarm/SleepMemory.c shared-bindings/coproc/CoprocMemory.c +#: shared-bindings/alarm/SleepMemory.c shared-bindings/memorymap/AddressRange.c #: shared-bindings/nvm/ByteArray.c msgid "Array values should be single bytes." msgstr "Les valeurs de la matrice doivent être des octets singuliers." -#: shared-bindings/microcontroller/Pin.c -msgid "At most %d %q may be specified (not %d)" -msgstr "Au plus %d %q peut être spécifié (pas %d)" - #: shared-module/memorymonitor/AllocationAlarm.c #, c-format msgid "Attempt to allocate %d blocks" msgstr "Tentative d'allocation de %d blocs" -#: supervisor/shared/safe_mode.c -msgid "Attempted heap allocation when VM not running." -msgstr "" -"Tentative d'allocation à la pile quand la Machine Virtuelle n'est pas en " -"exécution." - #: ports/raspberrypi/audio_dma.c msgid "Audio conversion not implemented" msgstr "La conversion audio n'est pas implémentée" @@ -590,20 +601,13 @@ msgid "Bitmap size and bits per value must match" msgstr "La dimension et la taille en bits de l'image doivent correspondre" #: supervisor/shared/safe_mode.c -msgid "Boot device must be first device (interface #0)." -msgstr "L'appareil de démarrage doit être le premier (interface #0)." +msgid "Boot device must be first (interface #0)." +msgstr "" #: ports/mimxrt10xx/common-hal/busio/UART.c msgid "Both RX and TX required for flow control" msgstr "RX et TX requis pour le contrôle de flux" -#: ports/atmel-samd/boards/circuitplayground_express/mpconfigboard.h -#: ports/atmel-samd/boards/circuitplayground_express_crickit/mpconfigboard.h -#: ports/atmel-samd/boards/circuitplayground_express_displayio/mpconfigboard.h -#: ports/atmel-samd/boards/meowmeow/mpconfigboard.h -msgid "Both buttons were pressed at start up.\n" -msgstr "Les deux boutons étaient pressés au démarrage.\n" - #: ports/atmel-samd/common-hal/rotaryio/IncrementalEncoder.c msgid "Both pins must support hardware interrupts" msgstr "Les deux broches doivent supporter les interruptions matérielles" @@ -669,11 +673,6 @@ msgstr "Les tampons doivent avoir la même taille" msgid "Bus pin %d is already in use" msgstr "La broche %d du bus est déjà utilisée" -#: ports/espressif/boards/m5stack_core_basic/mpconfigboard.h -#: ports/espressif/boards/m5stack_core_fire/mpconfigboard.h -msgid "Button A was pressed at start up.\n" -msgstr "Le bouton A était pressé au démarrage.\n" - #: shared-bindings/_bleio/UUID.c msgid "Byte buffer must be 16 bytes." msgstr "Le tampon doit être de 16 octets." @@ -684,7 +683,7 @@ 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 "L’appareil CIRCUITPY ne peut pas être trouvé ou créé." +msgstr "L'appareil CIRCUITPY ne peut pas être trouvé ou créé." #: ports/espressif/common-hal/espidf/__init__.c ports/espressif/esp_error.c msgid "CRC or checksum was invalid" @@ -816,10 +815,6 @@ msgstr "Ecriture sur 'CharacteristicBuffer' non fournie" msgid "CircuitPython core code crashed hard. Whoops!\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/I2C.c msgid "Clock stretch too long" msgstr "Période de l'horloge trop longue" @@ -842,11 +837,11 @@ msgstr "Fichier .mpy corrompu" #: ports/espressif/common-hal/neopixel_write/__init__.c msgid "Could not retrieve clock" -msgstr "Impossible d’obtenir l’horloge" +msgstr "Impossible d'obtenir l'horloge" #: shared-bindings/_bleio/Adapter.c msgid "Could not set address" -msgstr "Impossible de définir l’adresse" +msgstr "Impossible de définir l'adresse" #: shared-bindings/pwmio/PWMOut.c msgid "Could not start PWM" @@ -860,10 +855,6 @@ msgstr "Impossible de démarrer l'interruption, RX occupé" msgid "Couldn't allocate decoder" msgstr "Impossible d'allouer le décodeur" -#: supervisor/shared/safe_mode.c -msgid "Crash into the HardFault_Handler." -msgstr "Échec vers le HardFault_Handler." - #: ports/stm/common-hal/analogio/AnalogOut.c msgid "DAC Channel Init Error" msgstr "Erreur d'initialisation du canal DAC" @@ -928,6 +919,10 @@ msgid "Drive mode not used when direction is input." msgstr "" "Le mode Drive n'est pas utilisé quand la direction est entrante ('input')." +#: py/obj.c +msgid "During handling of the above exception, another exception occurred:" +msgstr "" + #: shared-bindings/aesio/aes.c msgid "ECB only operates on 16 bytes at a time" msgstr "La BCE ne fonctionne que sur 16 octets à la fois" @@ -953,24 +948,16 @@ msgstr "Erreur dans le flot MIDI à la position %d" msgid "Error in regex" msgstr "Erreur dans l'expression régulière" +#: supervisor/shared/safe_mode.c +msgid "Error in safemode.py." +msgstr "" + #: shared-bindings/socketpool/Socket.c shared-bindings/ssl/SSLSocket.c msgid "Error: Failure to bind" msgstr "Erreur : Impossible de lier" -#: py/enum.c shared-bindings/_bleio/__init__.c shared-bindings/aesio/aes.c -#: shared-bindings/alarm/__init__.c shared-bindings/alarm/coproc/CoprocAlarm.c -#: shared-bindings/busio/SPI.c shared-bindings/coproc/Coproc.c -#: shared-bindings/coproc/__init__.c shared-bindings/microcontroller/Pin.c -#: shared-bindings/neopixel_write/__init__.c -msgid "Expected a %q" -msgstr "Attendu un %q" - -#: ports/raspberrypi/bindings/cyw43/__init__.c -msgid "Expected a %q or %q" -msgstr "Attendu un %q ou %q" - #: shared-bindings/alarm/__init__.c -msgid "Expected an %q" +msgid "Expected a kind of %q" msgstr "" #: ports/espressif/common-hal/_bleio/Adapter.c @@ -1006,7 +993,7 @@ msgstr "Échec d'allocation du tampon %q" #: ports/espressif/common-hal/wifi/__init__.c msgid "Failed to allocate Wifi memory" -msgstr "Impossible d’allouer la mémoire pour Wifi" +msgstr "Impossible d'allouer la mémoire pour Wifi" #: ports/espressif/common-hal/wifi/ScannedNetworks.c msgid "Failed to allocate wifi scan memory" @@ -1039,13 +1026,17 @@ msgid "Failed to write internal flash." msgstr "Échec de l'écriture vers flash interne." #: supervisor/shared/safe_mode.c -msgid "Fatal error." -msgstr "Erreurre fatale." +msgid "Fault detected by hardware." +msgstr "" #: py/moduerrno.c msgid "File exists" msgstr "Le fichier existe" +#: shared-module/os/getenv.c +msgid "File not found" +msgstr "" + #: ports/atmel-samd/common-hal/canio/Listener.c #: ports/espressif/common-hal/canio/Listener.c #: ports/stm/common-hal/canio/Listener.c @@ -1060,7 +1051,6 @@ msgstr "Le logiciel est identique" msgid "Firmware is invalid" msgstr "Logiciel invalide" -#: ports/espressif/common-hal/coproc/Coproc.c #: ports/espressif/common-hal/dualbank/__init__.c msgid "Firmware is too big" msgstr "Logiciel trop volumineux" @@ -1108,6 +1098,8 @@ msgstr "Échec génerique" #: shared-bindings/displayio/Display.c #: shared-bindings/displayio/EPaperDisplay.c #: shared-bindings/framebufferio/FramebufferDisplay.c +#: shared-module/displayio/Display.c +#: shared-module/framebufferio/FramebufferDisplay.c msgid "Group already used" msgstr "Groupe déjà utilisé" @@ -1129,6 +1121,15 @@ msgstr "Matériel occupé, essayez d'autres broches" msgid "Hardware in use, try alternative pins" msgstr "Matériel utilisé, essayez d'autres broches" +#: supervisor/shared/safe_mode.c +msgid "Heap allocation when VM not running." +msgstr "" + +#: supervisor/shared/safe_mode.c +msgid "" +"Heap was corrupted because the stack was too small. Increase stack size." +msgstr "" + #: 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é" @@ -1146,11 +1147,6 @@ msgstr "périphérique I2C utilisé" msgid "I2SOut not available" msgstr "I2SOut n'est pas disponible" -#: shared-bindings/aesio/aes.c -#, c-format -msgid "IV must be %d bytes long" -msgstr "IV doit être de longueur de %d octets" - #: ports/raspberrypi/bindings/rp2pio/StateMachine.c msgid "In-buffer elements must be <= 4 bytes long" msgstr "Éléments dans le tampon doivent être <= à 4 octets" @@ -1246,6 +1242,7 @@ msgid "Internal define error" msgstr "Erreur de définition interne" #: ports/espressif/common-hal/paralleldisplay/ParallelBus.c +#: shared-module/os/getenv.c msgid "Internal error" msgstr "Erreur interne" @@ -1259,6 +1256,10 @@ msgstr "Erreur interne #%d" msgid "Internal watchdog timer expired." msgstr "Le minuteur du watchdog interne a expiré." +#: supervisor/shared/safe_mode.c +msgid "Interrupt error." +msgstr "" + #: py/argcheck.c shared-bindings/digitalio/DigitalInOut.c msgid "Invalid %q" msgstr "%q invalide" @@ -1293,6 +1294,11 @@ msgstr "Paramètre invalide" msgid "Invalid bits per value" msgstr "Bits par valeur invalides" +#: shared-module/os/getenv.c +#, c-format +msgid "Invalid byte %.*s" +msgstr "" + #: ports/atmel-samd/common-hal/imagecapture/ParallelImageCapture.c #, c-format msgid "Invalid data_pins[%d]" @@ -1302,18 +1308,10 @@ msgstr "data_pins[%d] invalide" msgid "Invalid format chunk size" msgstr "Taille de bloc de formatage invalide" -#: supervisor/shared/safe_mode.c -msgid "Invalid memory access." -msgstr "Accès à la mémoire invalide." - #: ports/espressif/common-hal/wifi/Radio.c msgid "Invalid multicast MAC address" msgstr "Adresse MAC multicast invalide" -#: shared-bindings/busio/UART.c -msgid "Invalid pins" -msgstr "Broches invalides" - #: ports/espressif/common-hal/espidf/__init__.c ports/espressif/esp_error.c msgid "Invalid size" msgstr "Taille invalide" @@ -1327,10 +1325,18 @@ msgstr "Socket non valide pour TLS" msgid "Invalid state" msgstr "État invalide" +#: shared-module/os/getenv.c +msgid "Invalid unicode escape" +msgstr "" + #: 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" +#: shared-module/os/getenv.c +msgid "Key not found" +msgstr "" + #: shared-module/is31fl3741/FrameBuffer.c msgid "LED mappings must match display size" msgstr "La disposition des LED doit correspondre à la taille de l'écran" @@ -1440,6 +1446,10 @@ msgstr "Saut NLR échoué. Corruption de mémoire probable." msgid "NVS Error" msgstr "Erreur NVS" +#: shared-bindings/socketpool/SocketPool.c +msgid "Name or service not known" +msgstr "" + #: py/qstr.c msgid "Name too long" msgstr "Nom trop long" @@ -1555,11 +1565,6 @@ msgstr "Aucune clé n'a été spécifiée" msgid "No long integer support" msgstr "Pas de support pour chiffre entier long" -#: shared-module/usb_hid/__init__.c -#, c-format -msgid "No more than %d HID devices allowed" -msgstr "Pas plus de %d appareils HID autorisés" - #: shared-bindings/wifi/Radio.c msgid "No network with that ssid" msgstr "Aucun réseau avec ce ssid" @@ -1595,10 +1600,6 @@ msgstr "Fichier/répertoire introuvable" msgid "No timer available" msgstr "Aucun minuteur disponible" -#: supervisor/shared/safe_mode.c -msgid "Nordic system firmware failure assertion." -msgstr "Assertion échouée du logiciel système Nordic." - #: ports/nrf/common-hal/_bleio/__init__.c msgid "Nordic system firmware out of memory" msgstr "Logiciel système Nordic n'a plus de mémoire" @@ -1618,10 +1619,6 @@ msgstr "Non connecté" msgid "Not playing" msgstr "Ne joue pas" -#: shared-bindings/_bleio/__init__.c -msgid "Not settable" -msgstr "Non réglable" - #: ports/espressif/common-hal/paralleldisplay/ParallelBus.c #, c-format msgid "Number of data_pins must be 8 or 16, not %d" @@ -1690,11 +1687,14 @@ msgstr "" "Seulement les BMP monochromes, 4 bpp ou 8 bpp, ou 16 bpp et plus sont " "supportés: %d bpp fournis" -#: ports/espressif/common-hal/alarm/coproc/CoprocAlarm.c #: ports/espressif/common-hal/alarm/touch/TouchAlarm.c msgid "Only one %q can be set in deep sleep." msgstr "Une seul %q autorisée en sommeil profond." +#: ports/espressif/common-hal/espulp/ULPAlarm.c +msgid "Only one %q can be set." +msgstr "" + #: ports/espressif/common-hal/i2ctarget/I2CTarget.c #: ports/raspberrypi/common-hal/i2ctarget/I2CTarget.c msgid "Only one address is allowed" @@ -1727,6 +1727,10 @@ msgstr "Opération ou fonction non supportée" msgid "Operation timed out" msgstr "Timeout de l'opération" +#: ports/raspberrypi/common-hal/mdns/Server.c +msgid "Out of MDNS service slots" +msgstr "" + #: ports/espressif/common-hal/espidf/__init__.c ports/espressif/esp_error.c msgid "Out of memory" msgstr "Mémoire insuffisante" @@ -1829,7 +1833,7 @@ msgstr "Ainsi que tout autres modules présents sur le système de fichiers\n" #: shared-module/vectorio/Polygon.c msgid "Polygon needs at least 3 points" -msgstr "Polygon a besoin d’au moins 3 points" +msgstr "Polygon a besoin d'au moins 3 points" #: shared-bindings/_bleio/Adapter.c msgid "Prefix buffer must be on the heap" @@ -1859,6 +1863,10 @@ msgstr "Le programme fait des sorties sans charger d'OSR" msgid "Program size invalid" msgstr "Taille du programme invalide" +#: ports/espressif/common-hal/espulp/ULP.c +msgid "Program too long" +msgstr "" + #: 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'." @@ -1898,8 +1906,9 @@ msgstr "RTC non supporté sur cette carte" msgid "Random number generation error" msgstr "Erreur de génération de chiffres aléatoires" +#: shared-bindings/_bleio/__init__.c #: shared-bindings/memorymonitor/AllocationSize.c -#: shared-bindings/pulseio/PulseIn.c +#: shared-bindings/pulseio/PulseIn.c shared-module/displayio/Bitmap.c msgid "Read-only" msgstr "Lecture seule" @@ -1907,10 +1916,6 @@ msgstr "Lecture seule" msgid "Read-only filesystem" msgstr "Système de fichier en lecture seule" -#: shared-module/displayio/Bitmap.c -msgid "Read-only object" -msgstr "Objet en lecture seule" - #: ports/espressif/common-hal/espidf/__init__.c ports/espressif/esp_error.c msgid "Received response was invalid" msgstr "Réponse reçue invalide" @@ -2003,7 +2008,7 @@ msgstr "Taille n'est pas supportée" msgid "Sleep Memory not available" msgstr "La mémoire de sommeil n'est pas disponible" -#: shared-bindings/alarm/SleepMemory.c shared-bindings/coproc/CoprocMemory.c +#: shared-bindings/alarm/SleepMemory.c shared-bindings/memorymap/AddressRange.c #: shared-bindings/nvm/ByteArray.c msgid "Slice and value different lengths." msgstr "Tranche et valeur de tailles différentes." @@ -2040,6 +2045,10 @@ 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" +#: ports/raspberrypi/common-hal/wifi/Radio.c +msgid "Stopping AP is not supported." +msgstr "" + #: 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" @@ -2057,55 +2066,20 @@ msgid "Temperature read timed out" msgstr "Délais de lecture de température dépassée" #: supervisor/shared/safe_mode.c -msgid "The BOOT button was pressed at start up.\n" -msgstr "Le bouton BOOT était pressé au démarrage.\n" - -#: supervisor/shared/safe_mode.c -msgid "" -"The CircuitPython heap was corrupted because the stack was too small.\n" -"Increase the stack size if you know how. If not:" +msgid "The `microcontroller` module was used to boot into safe mode." msgstr "" -"La pile de CircuitPython est corrompue parce que la pile était trop petite.\n" -"Augmentez la taille de la pile si vous savez comment. Sinon :" -#: ports/espressif/boards/adafruit_feather_esp32_v2/mpconfigboard.h -msgid "The SW38 button was pressed at start up.\n" -msgstr "Le bouton SW38 était pressé au démarrage.\n" - -#: ports/espressif/boards/hardkernel_odroid_go/mpconfigboard.h -msgid "The VOLUME button was pressed at start up.\n" -msgstr "Le bouton VOLUME était pressé au démarrage.\n" - -#: supervisor/shared/safe_mode.c -msgid "" -"The `microcontroller` module was used to boot into safe mode. Press reset to " -"exit safe mode." +#: py/obj.c +msgid "The above exception was the direct cause of the following exception:" msgstr "" -"Le module `microcontroller` a été utilisé pour démarrer en mode sûr. Pressez " -"reset pour quitter le mode sûr." - -#: ports/espressif/boards/m5stack_atom_lite/mpconfigboard.h -msgid "The central button was pressed at start up.\n" -msgstr "Le bouton central était pressé au démarrage.\n" - -#: ports/nrf/boards/aramcon2_badge/mpconfigboard.h -msgid "The left button was pressed at start up.\n" -msgstr "Le bouton gauche était pressé au démarrage.\n" #: shared-bindings/rgbmatrix/RGBMatrix.c msgid "The length of rgb_pins must be 6, 12, 18, 24, or 30" msgstr "La taille de rgb_pins doit être 6, 12, 18, 24 ou 30" #: supervisor/shared/safe_mode.c -msgid "" -"The microcontroller's power dipped. Make sure your power supply provides\n" -"enough power for the whole circuit and press reset (after ejecting " -"CIRCUITPY)." +msgid "The power dipped. Make sure you are providing enough power." msgstr "" -"L'alimentation du microcontrôleur a diminué. Veillez à ce que votre " -"alimentation fournisse\n" -"assez de puissance pour tout le circuit, puis appuyez sur 'reset' (après " -"avoir éjecté CIRCUITPY)." #: shared-module/audiomixer/MixerVoice.c msgid "The sample's bits_per_sample does not match the mixer's" @@ -2124,6 +2098,10 @@ msgstr "L'échantillonage de l'échantillon ne correspond pas à celui du mixer" msgid "The sample's signedness does not match the mixer's" msgstr "Le signe de l'échantillon ne correspond pas à celui du mixer" +#: supervisor/shared/safe_mode.c +msgid "Third-party firmware fatal error." +msgstr "" + #: shared-module/imagecapture/ParallelImageCapture.c msgid "This microcontroller does not support continuous capture." msgstr "Ce microcontrôleur ne support pas la capture continue." @@ -2158,10 +2136,6 @@ msgstr "L'heure est dans le passé." msgid "Timeout is too long: Maximum timeout length is %d seconds" msgstr "Le délai est trop long : le délai maximal est de %d secondes" -#: supervisor/shared/safe_mode.c -msgid "To exit, please reset the board without requesting safe mode." -msgstr "Pour le quitter, redémarrez sans demander le mode sans-échec." - #: ports/atmel-samd/common-hal/audiobusio/I2SOut.c msgid "Too many channels in sample" msgstr "Trop de canaux dans l'échantillon" @@ -2206,6 +2180,10 @@ msgstr "Dé-initialisation du UART" msgid "UART init" msgstr "Initialisation UART" +#: ports/raspberrypi/common-hal/busio/UART.c +msgid "UART peripheral in use" +msgstr "" + #: ports/stm/common-hal/busio/UART.c msgid "UART re-init" msgstr "Ré-initialisation du UART" @@ -2257,6 +2235,10 @@ msgstr "" msgid "Unable to allocate buffers for signed conversion" msgstr "Impossible d'allouer des tampons pour une conversion signée" +#: supervisor/shared/safe_mode.c +msgid "Unable to allocate the heap." +msgstr "" + #: ports/espressif/common-hal/busio/I2C.c msgid "Unable to create lock" msgstr "Impossible de créer un verrou ('lock')" @@ -2280,12 +2262,13 @@ msgid "Unable to read color palette data" msgstr "Impossible de lire les données de la palette de couleurs" #: ports/espressif/common-hal/mdns/Server.c +#: ports/raspberrypi/common-hal/mdns/Server.c msgid "Unable to start mDNS query" msgstr "Impossible de lancer la requête mDNS" -#: shared-bindings/coproc/CoprocMemory.c -msgid "Unable to write" -msgstr "Écriture impossible" +#: shared-bindings/memorymap/AddressRange.c +msgid "Unable to write to address." +msgstr "" #: shared-bindings/nvm/ByteArray.c msgid "Unable to write to nvm." @@ -2355,6 +2338,7 @@ msgid "Unkown error code %d" msgstr "Erreur inconnue %d" #: shared-bindings/adafruit_pixelbuf/PixelBuf.c +#: shared-module/_pixelmap/PixelMap.c #, c-format msgid "Unmatched number of items on RHS (expected %d, got %d)." msgstr "" @@ -2451,6 +2435,18 @@ msgstr "" msgid "Wi-Fi: " msgstr "Wi-Fi : " +#: ports/raspberrypi/common-hal/wifi/Radio.c +msgid "Wifi is in access point mode." +msgstr "" + +#: ports/raspberrypi/common-hal/wifi/Radio.c +msgid "Wifi is in station mode." +msgstr "" + +#: ports/raspberrypi/common-hal/wifi/Radio.c +msgid "Wifi is not enabled" +msgstr "" + #: main.c msgid "Woken up by alarm.\n" msgstr "Réveil par alarme.\n" @@ -2460,16 +2456,49 @@ msgstr "Réveil par alarme.\n" msgid "Writes not supported on Characteristic" msgstr "Écritures non supporté vers les Characteristic" -#: supervisor/shared/safe_mode.c -msgid "You are in safe mode because:\n" -msgstr "Vous êtres en mode sûr parce que :\n" +#: ports/atmel-samd/boards/circuitplayground_express/mpconfigboard.h +#: ports/atmel-samd/boards/circuitplayground_express_crickit/mpconfigboard.h +#: ports/atmel-samd/boards/circuitplayground_express_displayio/mpconfigboard.h +#: ports/atmel-samd/boards/meowmeow/mpconfigboard.h +msgid "You pressed both buttons at start up." +msgstr "" + +#: ports/espressif/boards/m5stack_core_basic/mpconfigboard.h +#: ports/espressif/boards/m5stack_core_fire/mpconfigboard.h +#: ports/espressif/boards/m5stack_stick_c/mpconfigboard.h +msgid "You pressed button A at start up." +msgstr "" #: supervisor/shared/safe_mode.c -msgid "" -"You pressed the reset button during boot. Press again to exit safe mode." +msgid "You pressed the BOOT button at start up" +msgstr "" + +#: ports/espressif/boards/adafruit_feather_esp32_v2/mpconfigboard.h +msgid "You pressed the SW38 button at start up." +msgstr "" + +#: ports/espressif/boards/hardkernel_odroid_go/mpconfigboard.h +msgid "You pressed the VOLUME button at start up." +msgstr "" + +#: ports/espressif/boards/m5stack_atom_echo/mpconfigboard.h +#: ports/espressif/boards/m5stack_atom_lite/mpconfigboard.h +#: ports/espressif/boards/m5stack_atom_matrix/mpconfigboard.h +#: ports/espressif/boards/m5stack_atom_u/mpconfigboard.h +msgid "You pressed the central button at start up." +msgstr "" + +#: ports/nrf/boards/aramcon2_badge/mpconfigboard.h +msgid "You pressed the left button at start up." +msgstr "" + +#: supervisor/shared/safe_mode.c +msgid "You pressed the reset button during boot." +msgstr "" + +#: supervisor/shared/micropython.c +msgid "[truncated due to length]" msgstr "" -"Vous avez pressé le bouton reset pendant le démarrage. Pressez-le à nouveau " -"pour sortir du mode sûr." #: py/objtype.c msgid "__init__() should return None" @@ -2540,14 +2569,18 @@ msgstr "la taille de la matrice et de l'index doivent être égaux" msgid "array has too many dimensions" msgstr "la tableau à trop de dimensions" +#: extmod/ulab/code/ndarray.c +msgid "array is too big" +msgstr "" + #: py/objarray.c shared-bindings/alarm/SleepMemory.c -#: shared-bindings/coproc/CoprocMemory.c shared-bindings/nvm/ByteArray.c +#: shared-bindings/memorymap/AddressRange.c shared-bindings/nvm/ByteArray.c msgid "array/bytes required on right side" msgstr "matrice/octets requis à la droite" #: extmod/ulab/code/numpy/numerical.c msgid "attempt to get (arg)min/(arg)max of empty sequence" -msgstr "tentative d’obtenir (arg)min/(arg)max d'une séquence vide" +msgstr "tentative d'obtenir (arg)min/(arg)max d'une séquence vide" #: extmod/ulab/code/numpy/numerical.c msgid "attempt to get argmin/argmax of an empty sequence" @@ -2615,7 +2648,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’élément" +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" @@ -2634,10 +2667,6 @@ msgstr "tampon trop petit" msgid "buffer too small for requested bytes" msgstr "tampon trop petit pour le nombre d'octets demandé" -#: shared-bindings/adafruit_pixelbuf/PixelBuf.c -msgid "byteorder is not a string" -msgstr "byteorder n'est pas une chaîne" - #: 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" @@ -2680,14 +2709,10 @@ 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-module/adafruit_pixelbuf/PixelBuf.c +#: py/obj.c py/objint.c py/runtime.c shared-module/adafruit_pixelbuf/PixelBuf.c msgid "can't convert %q to %q" msgstr "impossible de convertir %q en %q" -#: py/runtime.c -msgid "can't convert %q to int" -msgstr "ne peut convertir %q à int" - #: py/obj.c #, c-format msgid "can't convert %s to complex" @@ -2771,6 +2796,10 @@ msgstr "impossible de définir une taille de bloc de 512" msgid "can't set attribute" msgstr "attribut non modifiable" +#: py/runtime.c +msgid "can't set attribute '%q'" +msgstr "" + #: py/emitnative.c msgid "can't store '%q'" msgstr "impossible de stocker '%q'" @@ -2880,10 +2909,6 @@ msgstr "la couleur doit être entre 0x000000 et 0xffffff" msgid "comparison of int and uint" msgstr "comparaison entre int et uint" -#: py/objcomplex.c -msgid "complex division by zero" -msgstr "division complexe par zéro" - #: py/objfloat.c py/parsenum.c msgid "complex values not supported" msgstr "valeurs complexes non supportées" @@ -2989,12 +3014,11 @@ msgstr "les dimensions ne correspondent pas" msgid "div/mod not implemented for uint" msgstr "div/mod ne sont pas implémentés pour uint" -#: py/objfloat.c py/objint_mpz.c +#: extmod/ulab/code/numpy/create.c msgid "divide by zero" msgstr "division par zéro" -#: py/modmath.c py/objint_longlong.c py/runtime.c -#: shared-bindings/math/__init__.c +#: py/runtime.c msgid "division by zero" msgstr "division par zéro" @@ -3035,26 +3059,16 @@ msgstr "epoch_time n'est pas supporté sur ce panneau" msgid "error = 0x%08lX" msgstr "erreur = 0x%08lX" -#: ports/espressif/common-hal/esp32_camera/Camera.c +#: ports/espressif/common-hal/espcamera/Camera.c msgid "" -"esp32_camera.Camera requires reserved PSRAM to be configured. See the " +"espcamera.Camera requires reserved PSRAM to be configured. See the " "documentation for instructions." msgstr "" -"esp32_camera.Camera nécessite la configuration de PSRAM réservée. Se référer " -"à la documentation." #: py/runtime.c msgid "exceptions must derive from BaseException" msgstr "les exceptions doivent dériver de 'BaseException'" -#: shared-bindings/canio/CAN.c -msgid "expected '%q' but got '%q'" -msgstr "'%q' était attendu, mais reçu '%q'" - -#: shared-bindings/canio/CAN.c -msgid "expected '%q' or '%q' but got '%q'" -msgstr "'%q' ou '%q' était attendu, mais reçu '%q'" - #: py/objstr.c msgid "expected ':' after format specifier" msgstr "':' attendu après la spécification de format" @@ -3153,10 +3167,6 @@ msgstr "la police doit être longue de 2048 octets" msgid "format requires a dict" msgstr "le format nécessite un dict" -#: shared-bindings/microcontroller/Processor.c -msgid "frequency is read-only for this board" -msgstr "la fréquence est en lecture seule pour cette carte" - #: py/objdeque.c msgid "full" msgstr "plein" @@ -3176,7 +3186,7 @@ msgstr "la fonction a reçu plusieurs valeurs pour l'argument '%q'" #: extmod/ulab/code/scipy/optimize/optimize.c msgid "function has the same sign at the ends of interval" -msgstr "la fonction a le même signe aux extrémités de l’intervalle" +msgstr "la fonction a le même signe aux extrémités de l'intervalle" #: extmod/ulab/code/ndarray.c msgid "function is defined for ndarrays only" @@ -3269,8 +3279,12 @@ msgstr "espacement incorrect" msgid "index is out of bounds" msgstr "l'index est hors limites" +#: shared-bindings/_pixelmap/PixelMap.c +msgid "index must be tuple or int" +msgstr "" + #: extmod/ulab/code/numpy/numerical.c extmod/ulab/code/ulab_tools.c -#: ports/espressif/common-hal/pulseio/PulseIn.c py/obj.c +#: ports/espressif/common-hal/pulseio/PulseIn.c #: shared-bindings/bitmaptools/__init__.c msgid "index out of range" msgstr "index est hors bornes" @@ -3369,10 +3383,6 @@ msgstr "les vecteurs d'entrée doivent être de longueur égale" msgid "inputs are not iterable" msgstr "les entrées ne sont pas itérables" -#: py/parsenum.c -msgid "int() arg 2 must be >= 2 and <= 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" msgstr "interp n'est défini que pour les 1D itérables de taille identique" @@ -3430,7 +3440,7 @@ msgstr "clé invalide" msgid "invalid micropython decorator" msgstr "décorateur micropython invalide" -#: ports/espressif/common-hal/esp32_camera/Camera.c +#: ports/espressif/common-hal/espcamera/Camera.c msgid "invalid setting" msgstr "réglage invalide" @@ -3455,10 +3465,6 @@ msgstr "syntaxe invalide pour un entier de base %d" msgid "invalid syntax for number" msgstr "syntaxe invalide pour un nombre" -#: py/objexcept.c -msgid "invalid traceback" -msgstr "traceback invalide" - #: py/objtype.c msgid "issubclass() arg 1 must be a class" msgstr "l'argument 1 de issubclass() doit être une classe" @@ -3520,19 +3526,17 @@ msgstr "variable locale '%q' utilisée avant d'en connaitre le type" msgid "local variable referenced before assignment" msgstr "variable locale référencée avant d'être assignée" -#: py/objint.c -msgid "long int not supported in this build" -msgstr "entiers longs non supportés dans cette build" - #: ports/espressif/common-hal/canio/CAN.c msgid "loopback + silent mode not supported by peripheral" msgstr "loopback + silent mode non pris en charge par le périphérique" #: ports/espressif/common-hal/mdns/Server.c +#: ports/raspberrypi/common-hal/mdns/Server.c msgid "mDNS already initialized" msgstr "mDNS a déjà été initialisé" #: ports/espressif/common-hal/mdns/Server.c +#: ports/raspberrypi/common-hal/mdns/Server.c msgid "mDNS only works with built-in WiFi" msgstr "mDNS ne fonctionne que avec le WiFi intégré" @@ -3661,6 +3665,10 @@ msgstr "puissance négative sans support des nombres à virgule flottante" msgid "negative shift count" msgstr "compte de décalage négatif" +#: shared-bindings/_pixelmap/PixelMap.c +msgid "nested index must be int" +msgstr "" + #: shared-module/sdcardio/SDCard.c msgid "no SD card" msgstr "pas de carte SD" @@ -3694,7 +3702,7 @@ msgstr "pas de broche de réinitialisation disponible" msgid "no response from SD card" msgstr "pas de réponse de la carte SD" -#: ports/espressif/common-hal/esp32_camera/Camera.c py/objobject.c py/runtime.c +#: ports/espressif/common-hal/espcamera/Camera.c py/objobject.c py/runtime.c msgid "no such attribute" msgstr "pas de tel attribut" @@ -3833,6 +3841,10 @@ msgstr "seul bit_depth = 16 est pris en charge" msgid "only mono is supported" msgstr "" +#: extmod/ulab/code/numpy/create.c +msgid "only ndarrays can be concatenated" +msgstr "" + #: ports/stm/common-hal/audiobusio/PDMIn.c msgid "only oversample=64 is supported" msgstr "" @@ -3843,7 +3855,7 @@ msgid "only sample_rate=16000 is supported" msgstr "seul sample_rate = 16000 est pris en charge" #: py/objarray.c py/objstr.c py/objstrunicode.c py/objtuple.c -#: shared-bindings/alarm/SleepMemory.c shared-bindings/coproc/CoprocMemory.c +#: shared-bindings/alarm/SleepMemory.c shared-bindings/memorymap/AddressRange.c #: shared-bindings/nvm/ByteArray.c msgid "only slices with step=1 (aka None) are supported" msgstr "seules les tranches avec 'step=1' (cad None) sont supportées" @@ -4061,10 +4073,6 @@ msgstr "la longueur de sleep ne doit pas être négative" msgid "slice step can't be zero" msgstr "le pas 'step' de la tranche ne peut être zéro" -#: py/objslice.c -msgid "slice step cannot be zero" -msgstr "le pas 'step' de la tranche ne peut être zéro" - #: py/nativeglue.c msgid "slice unsupported" msgstr "slice non-supporté" @@ -4113,10 +4121,6 @@ msgstr "source_bitmap doit avoir une value_count de 8" msgid "start/end indices" msgstr "indices de début/fin" -#: shared-bindings/random/__init__.c -msgid "step must be non-zero" -msgstr "le pas 'step' doit être non nul" - #: shared-bindings/random/__init__.c msgid "stop not reachable from start" msgstr "stop n'est pas accessible au démarrage" @@ -4125,10 +4129,6 @@ msgstr "stop n'est pas accessible au démarrage" msgid "stream operation not supported" msgstr "opération de flux non supportée" -#: py/objstrunicode.c -msgid "string indices must be integers, not %q" -msgstr "les indices d'une chaîne doivent être des entiers, pas %q" - #: py/stream.c msgid "string not supported; use bytes or bytearray" msgstr "" @@ -4162,10 +4162,6 @@ msgstr "erreur de syntaxe JSON" msgid "syntax error in uctypes descriptor" msgstr "erreur de syntaxe dans le descripteur d'uctypes" -#: shared-bindings/time/__init__.c -msgid "time.struct_time() takes a 9-sequence" -msgstr "time.struct_time() prend une séquence de longueur 9" - #: ports/atmel-samd/common-hal/watchdog/WatchDogTimer.c #: ports/espressif/common-hal/watchdog/WatchDogTimer.c #: ports/nrf/common-hal/watchdog/WatchDogTimer.c @@ -4179,11 +4175,11 @@ msgstr "le délai (timeout) doit être < 655.35 secondes" #: shared-module/sdcardio/SDCard.c msgid "timeout waiting for v1 card" -msgstr "Délai d’expiration dépassé en attendant une carte v1" +msgstr "Délai d'expiration dépassé en attendant une carte v1" #: shared-module/sdcardio/SDCard.c msgid "timeout waiting for v2 card" -msgstr "Délai d’expiration dépassé en attendant une carte v2" +msgstr "Délai d'expiration dépassé en attendant une carte v2" #: ports/stm/common-hal/pwmio/PWMOut.c msgid "timer re-init" @@ -4383,7 +4379,7 @@ 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é" +msgstr "wifi n'est pas activé" #: ports/raspberrypi/common-hal/wifi/Monitor.c msgid "wifi.Monitor not available" @@ -4447,10 +4443,6 @@ msgstr "Échec de xTaskCreate" msgid "y value out of bounds" msgstr "valeur y hors limites" -#: py/objrange.c -msgid "zero step" -msgstr "'step' nul" - #: extmod/ulab/code/scipy/signal/signal.c msgid "zi must be an ndarray" msgstr "zi doit être un ndarray" @@ -4463,6 +4455,194 @@ 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 "" +#~ "\n" +#~ "Please file an issue with the contents of your CIRCUITPY drive at \n" +#~ "https://github.com/adafruit/circuitpython/issues\n" +#~ msgstr "" +#~ "\n" +#~ "Veuillez signaler un problème avec le contenu de votre lecteur CIRCUITPY " +#~ "à l'adresse\n" +#~ "https://github.com/adafruit/circuitpython/issues\n" + +#~ msgid "Attempted heap allocation when VM not running." +#~ msgstr "" +#~ "Tentative d'allocation à la pile quand la Machine Virtuelle n'est pas en " +#~ "exécution." + +#~ msgid "Boot device must be first device (interface #0)." +#~ msgstr "L'appareil de démarrage doit être le premier (interface #0)." + +#~ msgid "Both buttons were pressed at start up.\n" +#~ msgstr "Les deux boutons étaient pressés au démarrage.\n" + +#~ msgid "Button A was pressed at start up.\n" +#~ msgstr "Le bouton A était pressé au démarrage.\n" + +#~ msgid "CircuitPython was unable to allocate the heap." +#~ msgstr "CircuitPython n'as pu faire l'allocation de la pile." + +#~ msgid "Crash into the HardFault_Handler." +#~ msgstr "Échec vers le HardFault_Handler." + +#~ msgid "Fatal error." +#~ msgstr "Erreurre fatale." + +#~ msgid "Invalid memory access." +#~ msgstr "Accès à la mémoire invalide." + +#~ msgid "Nordic system firmware failure assertion." +#~ msgstr "Assertion échouée du logiciel système Nordic." + +#~ msgid "The BOOT button was pressed at start up.\n" +#~ msgstr "Le bouton BOOT était pressé au démarrage.\n" + +#~ msgid "" +#~ "The CircuitPython heap was corrupted because the stack was too small.\n" +#~ "Increase the stack size if you know how. If not:" +#~ msgstr "" +#~ "La pile de CircuitPython est corrompue parce que la pile était trop " +#~ "petite.\n" +#~ "Augmentez la taille de la pile si vous savez comment. Sinon :" + +#~ msgid "The SW38 button was pressed at start up.\n" +#~ msgstr "Le bouton SW38 était pressé au démarrage.\n" + +#~ msgid "The VOLUME button was pressed at start up.\n" +#~ msgstr "Le bouton VOLUME était pressé au démarrage.\n" + +#~ msgid "" +#~ "The `microcontroller` module was used to boot into safe mode. Press reset " +#~ "to exit safe mode." +#~ msgstr "" +#~ "Le module `microcontroller` a été utilisé pour démarrer en mode sûr. " +#~ "Pressez reset pour quitter le mode sûr." + +#~ msgid "The central button was pressed at start up.\n" +#~ msgstr "Le bouton central était pressé au démarrage.\n" + +#~ msgid "The left button was pressed at start up.\n" +#~ msgstr "Le bouton gauche était pressé au démarrage.\n" + +#~ msgid "" +#~ "The microcontroller's power dipped. Make sure your power supply provides\n" +#~ "enough power for the whole circuit and press reset (after ejecting " +#~ "CIRCUITPY)." +#~ msgstr "" +#~ "L'alimentation du microcontrôleur a diminué. Veillez à ce que votre " +#~ "alimentation fournisse\n" +#~ "assez de puissance pour tout le circuit, puis appuyez sur 'reset' (après " +#~ "avoir éjecté CIRCUITPY)." + +#~ msgid "To exit, please reset the board without requesting safe mode." +#~ msgstr "Pour le quitter, redémarrez sans demander le mode sans-échec." + +#~ msgid "You are in safe mode because:\n" +#~ 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 reset pendant le démarrage. Pressez-le à " +#~ "nouveau pour sortir du mode sûr." + +#~ msgid "" +#~ "esp32_camera.Camera requires reserved PSRAM to be configured. See the " +#~ "documentation for instructions." +#~ msgstr "" +#~ "esp32_camera.Camera nécessite la configuration de PSRAM réservée. Se " +#~ "référer à la documentation." + +#~ msgid "%q must be of type %q" +#~ msgstr "%q doit être du type %q" + +#~ msgid "%q must be of type %q or None" +#~ msgstr "%q doit être du type %q ou None" + +#~ msgid "Expected a %q" +#~ msgstr "Attendu un %q" + +#~ msgid "Expected a %q or %q" +#~ msgstr "Attendu un %q ou %q" + +#, c-format +#~ msgid "IV must be %d bytes long" +#~ msgstr "IV doit être de longueur de %d octets" + +#~ msgid "Not settable" +#~ msgstr "Non réglable" + +#~ msgid "expected '%q' but got '%q'" +#~ msgstr "'%q' était attendu, mais reçu '%q'" + +#~ msgid "expected '%q' or '%q' but got '%q'" +#~ msgstr "'%q' ou '%q' était attendu, mais reçu '%q'" + +#~ msgid "Read-only object" +#~ msgstr "Objet en lecture seule" + +#~ msgid "frequency is read-only for this board" +#~ msgstr "la fréquence est en lecture seule pour cette carte" + +#~ msgid "Unable to write" +#~ msgstr "Écriture impossible" + +#~ msgid "%q length must be >= 1" +#~ msgstr "La longueur de %q doit être >= 1" + +#~ msgid "%q must be a string" +#~ msgstr "%q doit être une chaîne de caractères" + +#~ msgid "%q must be an int" +#~ msgstr "%q doit être un entier" + +#~ 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" + +#~ msgid "At most %d %q may be specified (not %d)" +#~ msgstr "Au plus %d %q peut être spécifié (pas %d)" + +#~ msgid "Invalid pins" +#~ msgstr "Broches invalides" + +#, c-format +#~ msgid "No more than %d HID devices allowed" +#~ msgstr "Pas plus de %d appareils HID autorisés" + +#~ msgid "byteorder is not a string" +#~ msgstr "byteorder n'est pas une chaîne" + +#~ msgid "can't convert %q to int" +#~ msgstr "ne peut convertir %q à int" + +#~ msgid "complex division by zero" +#~ msgstr "division complexe par zéro" + +#~ msgid "int() arg 2 must be >= 2 and <= 36" +#~ msgstr "" +#~ "Le deuxième argument de int() doit être compris entre 2 et 36 inclus" + +#~ msgid "long int not supported in this build" +#~ msgstr "entiers longs non supportés dans cette build" + +#~ msgid "slice step cannot be zero" +#~ msgstr "le pas 'step' de la tranche ne peut être zéro" + +#~ msgid "step must be non-zero" +#~ msgstr "le pas 'step' doit être non nul" + +#~ msgid "string indices must be integers, not %q" +#~ msgstr "les indices d'une chaîne doivent être des entiers, pas %q" + +#~ msgid "time.struct_time() takes a 9-sequence" +#~ msgstr "time.struct_time() prend une séquence de longueur 9" + +#~ msgid "zero step" +#~ msgstr "'step' nul" + +#~ msgid "invalid traceback" +#~ msgstr "traceback invalide" + #~ msgid "%q indices must be integers, not %s" #~ msgstr "les indices %q doivent être des entiers, pas %s" diff --git a/locale/hi.po b/locale/hi.po index 3c3496600b..70bda4ec7c 100644 --- a/locale/hi.po +++ b/locale/hi.po @@ -31,8 +31,20 @@ msgstr "" #: supervisor/shared/safe_mode.c msgid "" "\n" -"Please file an issue with the contents of your CIRCUITPY drive at \n" -"https://github.com/adafruit/circuitpython/issues\n" +"Please file an issue with your program at https://github.com/adafruit/" +"circuitpython/issues." +msgstr "" + +#: supervisor/shared/safe_mode.c +msgid "" +"\n" +"Press reset to exit safe mode.\n" +msgstr "" + +#: supervisor/shared/safe_mode.c +msgid "" +"\n" +"You are in safe mode because:\n" msgstr "" #: py/obj.c @@ -65,6 +77,11 @@ msgstr "" msgid "%02X" msgstr "" +#: shared-module/os/getenv.c +#, c-format +msgid "%S" +msgstr "" + #: shared-bindings/rgbmatrix/RGBMatrix.c #, c-format msgid "" @@ -80,7 +97,7 @@ msgstr "" #: 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 +#: ports/stm/common-hal/canio/Listener.c ports/stm/common-hal/rtc/RTC.c msgid "%q" msgstr "" @@ -100,13 +117,18 @@ msgstr "" msgid "%q failure: %d" msgstr "" +#: py/argcheck.c +msgid "%q in %q must be of type %q, not %q" +msgstr "" + +#: ports/espressif/common-hal/espulp/ULP.c #: ports/raspberrypi/common-hal/rp2pio/StateMachine.c #: shared-bindings/digitalio/DigitalInOut.c #: shared-bindings/microcontroller/Pin.c msgid "%q in use" msgstr "" -#: py/obj.c py/objstr.c py/objstrunicode.c +#: py/objstr.c py/objstrunicode.c msgid "%q index out of range" msgstr "" @@ -118,7 +140,11 @@ msgstr "" msgid "%q is %q" msgstr "" -#: py/argcheck.c +#: ports/raspberrypi/common-hal/wifi/Radio.c +msgid "%q is read-only for this board" +msgstr "" + +#: py/argcheck.c shared-bindings/usb_hid/Device.c msgid "%q length must be %d" msgstr "" @@ -134,10 +160,6 @@ msgstr "" 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 "" @@ -159,24 +181,20 @@ msgid "%q must be >= %d" msgstr "" #: shared-bindings/analogbufio/BufferedIn.c +msgid "%q must be a bytearray or array of type 'H' or 'B'" +msgstr "" + #: 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" +#: ports/raspberrypi/bindings/cyw43/__init__.c py/argcheck.c py/objexcept.c +#: shared-bindings/canio/CAN.c shared-bindings/digitalio/Pull.c +msgid "%q must be of type %q or %q, not %q" msgstr "" -#: py/argcheck.c -msgid "%q must be an int" -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" +#: py/argcheck.c py/obj.c py/objstrunicode.c +msgid "%q must be of type %q, not %q" msgstr "" #: ports/atmel-samd/common-hal/busio/UART.c @@ -189,7 +207,6 @@ msgstr "" #: ports/atmel-samd/common-hal/pulseio/PulseIn.c #: ports/cxd56/common-hal/pulseio/PulseIn.c -#: ports/espressif/common-hal/coproc/Coproc.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 @@ -201,8 +218,8 @@ msgstr "" msgid "%q pin invalid" msgstr "" -#: shared-bindings/usb_hid/Device.c -msgid "%q with a report ID of 0 must be of length 1" +#: py/objrange.c py/objslice.c shared-bindings/random/__init__.c +msgid "%q step cannot be zero" msgstr "" #: py/bc.c py/objnamedtuple.c @@ -302,7 +319,7 @@ msgstr "" msgid "'%s' object doesn't support item deletion" msgstr "" -#: ports/raspberrypi/common-hal/wifi/Radio.c py/runtime.c +#: py/runtime.c msgid "'%s' object has no attribute '%q'" msgstr "" @@ -402,6 +419,10 @@ msgstr "" msgid "Address must be %d bytes long" msgstr "" +#: ports/espressif/common-hal/memorymap/AddressRange.c +msgid "Address range not allowed" +msgstr "" + #: ports/espressif/common-hal/canio/CAN.c msgid "All CAN peripherals are in use" msgstr "" @@ -429,7 +450,6 @@ msgid "All SPI peripherals are in use" msgstr "" #: 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 "" @@ -482,7 +502,7 @@ msgstr "" msgid "Already have all-matches listener" msgstr "" -#: ports/espressif/common-hal/coproc/__init__.c +#: ports/espressif/common-hal/espulp/ULP.c #: shared-module/memorymonitor/AllocationAlarm.c #: shared-module/memorymonitor/AllocationSize.c msgid "Already running" @@ -493,6 +513,11 @@ msgstr "" msgid "Already scanning for wifi networks" msgstr "" +#: shared-module/os/getenv.c +#, c-format +msgid "An error occurred while retrieving '%s':\n" +msgstr "" + #: ports/stm/common-hal/audiopwmio/PWMAudioOut.c msgid "Another PWMAudioOut is already active" msgstr "" @@ -506,24 +531,16 @@ msgstr "" msgid "Array must contain halfwords (type 'H')" msgstr "" -#: shared-bindings/alarm/SleepMemory.c shared-bindings/coproc/CoprocMemory.c +#: shared-bindings/alarm/SleepMemory.c shared-bindings/memorymap/AddressRange.c #: shared-bindings/nvm/ByteArray.c msgid "Array values should be single bytes." msgstr "" -#: shared-bindings/microcontroller/Pin.c -msgid "At most %d %q may be specified (not %d)" -msgstr "" - #: shared-module/memorymonitor/AllocationAlarm.c #, c-format msgid "Attempt to allocate %d blocks" msgstr "" -#: supervisor/shared/safe_mode.c -msgid "Attempted heap allocation when VM not running." -msgstr "" - #: ports/raspberrypi/audio_dma.c msgid "Audio conversion not implemented" msgstr "" @@ -572,20 +589,13 @@ msgid "Bitmap size and bits per value must match" msgstr "" #: supervisor/shared/safe_mode.c -msgid "Boot device must be first device (interface #0)." +msgid "Boot device must be first (interface #0)." msgstr "" #: ports/mimxrt10xx/common-hal/busio/UART.c msgid "Both RX and TX required for flow control" msgstr "" -#: ports/atmel-samd/boards/circuitplayground_express/mpconfigboard.h -#: ports/atmel-samd/boards/circuitplayground_express_crickit/mpconfigboard.h -#: ports/atmel-samd/boards/circuitplayground_express_displayio/mpconfigboard.h -#: ports/atmel-samd/boards/meowmeow/mpconfigboard.h -msgid "Both buttons were pressed at start up.\n" -msgstr "" - #: ports/atmel-samd/common-hal/rotaryio/IncrementalEncoder.c msgid "Both pins must support hardware interrupts" msgstr "" @@ -651,11 +661,6 @@ msgstr "" msgid "Bus pin %d is already in use" msgstr "" -#: ports/espressif/boards/m5stack_core_basic/mpconfigboard.h -#: ports/espressif/boards/m5stack_core_fire/mpconfigboard.h -msgid "Button A was pressed at start up.\n" -msgstr "" - #: shared-bindings/_bleio/UUID.c msgid "Byte buffer must be 16 bytes." msgstr "" @@ -786,10 +791,6 @@ msgstr "" msgid "CircuitPython core code crashed hard. Whoops!\n" msgstr "" -#: supervisor/shared/safe_mode.c -msgid "CircuitPython was unable to allocate the heap." -msgstr "" - #: shared-module/bitbangio/I2C.c msgid "Clock stretch too long" msgstr "" @@ -828,10 +829,6 @@ msgstr "" msgid "Couldn't allocate decoder" msgstr "" -#: supervisor/shared/safe_mode.c -msgid "Crash into the HardFault_Handler." -msgstr "" - #: ports/stm/common-hal/analogio/AnalogOut.c msgid "DAC Channel Init Error" msgstr "" @@ -894,6 +891,10 @@ msgstr "" msgid "Drive mode not used when direction is input." msgstr "" +#: py/obj.c +msgid "During handling of the above exception, another exception occurred:" +msgstr "" + #: shared-bindings/aesio/aes.c msgid "ECB only operates on 16 bytes at a time" msgstr "" @@ -919,24 +920,16 @@ msgstr "" msgid "Error in regex" msgstr "" +#: supervisor/shared/safe_mode.c +msgid "Error in safemode.py." +msgstr "" + #: shared-bindings/socketpool/Socket.c shared-bindings/ssl/SSLSocket.c msgid "Error: Failure to bind" msgstr "" -#: py/enum.c shared-bindings/_bleio/__init__.c shared-bindings/aesio/aes.c -#: shared-bindings/alarm/__init__.c shared-bindings/alarm/coproc/CoprocAlarm.c -#: shared-bindings/busio/SPI.c shared-bindings/coproc/Coproc.c -#: shared-bindings/coproc/__init__.c shared-bindings/microcontroller/Pin.c -#: shared-bindings/neopixel_write/__init__.c -msgid "Expected a %q" -msgstr "" - -#: ports/raspberrypi/bindings/cyw43/__init__.c -msgid "Expected a %q or %q" -msgstr "" - #: shared-bindings/alarm/__init__.c -msgid "Expected an %q" +msgid "Expected a kind of %q" msgstr "" #: ports/espressif/common-hal/_bleio/Adapter.c @@ -1004,13 +997,17 @@ msgid "Failed to write internal flash." msgstr "" #: supervisor/shared/safe_mode.c -msgid "Fatal error." +msgid "Fault detected by hardware." msgstr "" #: py/moduerrno.c msgid "File exists" msgstr "" +#: shared-module/os/getenv.c +msgid "File not found" +msgstr "" + #: ports/atmel-samd/common-hal/canio/Listener.c #: ports/espressif/common-hal/canio/Listener.c #: ports/stm/common-hal/canio/Listener.c @@ -1025,7 +1022,6 @@ msgstr "" msgid "Firmware is invalid" msgstr "" -#: ports/espressif/common-hal/coproc/Coproc.c #: ports/espressif/common-hal/dualbank/__init__.c msgid "Firmware is too big" msgstr "" @@ -1067,6 +1063,8 @@ msgstr "" #: shared-bindings/displayio/Display.c #: shared-bindings/displayio/EPaperDisplay.c #: shared-bindings/framebufferio/FramebufferDisplay.c +#: shared-module/displayio/Display.c +#: shared-module/framebufferio/FramebufferDisplay.c msgid "Group already used" msgstr "" @@ -1087,6 +1085,15 @@ msgstr "" msgid "Hardware in use, try alternative pins" msgstr "" +#: supervisor/shared/safe_mode.c +msgid "Heap allocation when VM not running." +msgstr "" + +#: supervisor/shared/safe_mode.c +msgid "" +"Heap was corrupted because the stack was too small. Increase stack size." +msgstr "" + #: extmod/vfs_posix_file.c py/objstringio.c msgid "I/O operation on closed file" msgstr "" @@ -1104,11 +1111,6 @@ msgstr "" msgid "I2SOut not available" msgstr "" -#: shared-bindings/aesio/aes.c -#, c-format -msgid "IV must be %d bytes long" -msgstr "" - #: ports/raspberrypi/bindings/rp2pio/StateMachine.c msgid "In-buffer elements must be <= 4 bytes long" msgstr "" @@ -1193,6 +1195,7 @@ msgid "Internal define error" msgstr "" #: ports/espressif/common-hal/paralleldisplay/ParallelBus.c +#: shared-module/os/getenv.c msgid "Internal error" msgstr "" @@ -1205,6 +1208,10 @@ msgstr "" msgid "Internal watchdog timer expired." msgstr "" +#: supervisor/shared/safe_mode.c +msgid "Interrupt error." +msgstr "" + #: py/argcheck.c shared-bindings/digitalio/DigitalInOut.c msgid "Invalid %q" msgstr "" @@ -1239,6 +1246,11 @@ msgstr "" msgid "Invalid bits per value" msgstr "" +#: shared-module/os/getenv.c +#, c-format +msgid "Invalid byte %.*s" +msgstr "" + #: ports/atmel-samd/common-hal/imagecapture/ParallelImageCapture.c #, c-format msgid "Invalid data_pins[%d]" @@ -1248,18 +1260,10 @@ msgstr "" msgid "Invalid format chunk size" msgstr "" -#: supervisor/shared/safe_mode.c -msgid "Invalid memory access." -msgstr "" - #: ports/espressif/common-hal/wifi/Radio.c msgid "Invalid multicast MAC address" msgstr "" -#: shared-bindings/busio/UART.c -msgid "Invalid pins" -msgstr "" - #: ports/espressif/common-hal/espidf/__init__.c ports/espressif/esp_error.c msgid "Invalid size" msgstr "" @@ -1273,10 +1277,18 @@ msgstr "" msgid "Invalid state" msgstr "" +#: shared-module/os/getenv.c +msgid "Invalid unicode escape" +msgstr "" + #: shared-bindings/aesio/aes.c msgid "Key must be 16, 24, or 32 bytes long" msgstr "" +#: shared-module/os/getenv.c +msgid "Key not found" +msgstr "" + #: shared-module/is31fl3741/FrameBuffer.c msgid "LED mappings must match display size" msgstr "" @@ -1383,6 +1395,10 @@ msgstr "" msgid "NVS Error" msgstr "" +#: shared-bindings/socketpool/SocketPool.c +msgid "Name or service not known" +msgstr "" + #: py/qstr.c msgid "Name too long" msgstr "" @@ -1497,11 +1513,6 @@ msgstr "" msgid "No long integer support" msgstr "" -#: shared-module/usb_hid/__init__.c -#, c-format -msgid "No more than %d HID devices allowed" -msgstr "" - #: shared-bindings/wifi/Radio.c msgid "No network with that ssid" msgstr "" @@ -1537,10 +1548,6 @@ msgstr "" msgid "No timer available" msgstr "" -#: supervisor/shared/safe_mode.c -msgid "Nordic system firmware failure assertion." -msgstr "" - #: ports/nrf/common-hal/_bleio/__init__.c msgid "Nordic system firmware out of memory" msgstr "" @@ -1560,10 +1567,6 @@ msgstr "" msgid "Not playing" msgstr "" -#: shared-bindings/_bleio/__init__.c -msgid "Not settable" -msgstr "" - #: ports/espressif/common-hal/paralleldisplay/ParallelBus.c #, c-format msgid "Number of data_pins must be 8 or 16, not %d" @@ -1626,11 +1629,14 @@ msgid "" "%d bpp given" msgstr "" -#: ports/espressif/common-hal/alarm/coproc/CoprocAlarm.c #: ports/espressif/common-hal/alarm/touch/TouchAlarm.c msgid "Only one %q can be set in deep sleep." msgstr "" +#: ports/espressif/common-hal/espulp/ULPAlarm.c +msgid "Only one %q can be set." +msgstr "" + #: ports/espressif/common-hal/i2ctarget/I2CTarget.c #: ports/raspberrypi/common-hal/i2ctarget/I2CTarget.c msgid "Only one address is allowed" @@ -1663,6 +1669,10 @@ msgstr "" msgid "Operation timed out" msgstr "" +#: ports/raspberrypi/common-hal/mdns/Server.c +msgid "Out of MDNS service slots" +msgstr "" + #: ports/espressif/common-hal/espidf/__init__.c ports/espressif/esp_error.c msgid "Out of memory" msgstr "" @@ -1786,6 +1796,10 @@ msgstr "" msgid "Program size invalid" msgstr "" +#: ports/espressif/common-hal/espulp/ULP.c +msgid "Program too long" +msgstr "" + #: shared-bindings/digitalio/DigitalInOut.c msgid "Pull not used when direction is output." msgstr "" @@ -1825,8 +1839,9 @@ msgstr "" msgid "Random number generation error" msgstr "" +#: shared-bindings/_bleio/__init__.c #: shared-bindings/memorymonitor/AllocationSize.c -#: shared-bindings/pulseio/PulseIn.c +#: shared-bindings/pulseio/PulseIn.c shared-module/displayio/Bitmap.c msgid "Read-only" msgstr "" @@ -1834,10 +1849,6 @@ msgstr "" msgid "Read-only filesystem" msgstr "" -#: shared-module/displayio/Bitmap.c -msgid "Read-only object" -msgstr "" - #: ports/espressif/common-hal/espidf/__init__.c ports/espressif/esp_error.c msgid "Received response was invalid" msgstr "" @@ -1930,7 +1941,7 @@ msgstr "" msgid "Sleep Memory not available" msgstr "" -#: shared-bindings/alarm/SleepMemory.c shared-bindings/coproc/CoprocMemory.c +#: shared-bindings/alarm/SleepMemory.c shared-bindings/memorymap/AddressRange.c #: shared-bindings/nvm/ByteArray.c msgid "Slice and value different lengths." msgstr "" @@ -1967,6 +1978,10 @@ msgstr "" msgid "Stereo right must be on PWM channel B" msgstr "" +#: ports/raspberrypi/common-hal/wifi/Radio.c +msgid "Stopping AP is not supported." +msgstr "" + #: ports/mimxrt10xx/common-hal/busio/UART.c ports/stm/common-hal/busio/UART.c msgid "Supply at least one UART pin" msgstr "" @@ -1984,35 +1999,11 @@ msgid "Temperature read timed out" msgstr "" #: supervisor/shared/safe_mode.c -msgid "The BOOT button was pressed at start up.\n" +msgid "The `microcontroller` module was used to boot into safe mode." msgstr "" -#: supervisor/shared/safe_mode.c -msgid "" -"The CircuitPython heap was corrupted because the stack was too small.\n" -"Increase the stack size if you know how. If not:" -msgstr "" - -#: ports/espressif/boards/adafruit_feather_esp32_v2/mpconfigboard.h -msgid "The SW38 button was pressed at start up.\n" -msgstr "" - -#: ports/espressif/boards/hardkernel_odroid_go/mpconfigboard.h -msgid "The VOLUME button was pressed at start up.\n" -msgstr "" - -#: supervisor/shared/safe_mode.c -msgid "" -"The `microcontroller` module was used to boot into safe mode. Press reset to " -"exit safe mode." -msgstr "" - -#: ports/espressif/boards/m5stack_atom_lite/mpconfigboard.h -msgid "The central button was pressed at start up.\n" -msgstr "" - -#: ports/nrf/boards/aramcon2_badge/mpconfigboard.h -msgid "The left button was pressed at start up.\n" +#: py/obj.c +msgid "The above exception was the direct cause of the following exception:" msgstr "" #: shared-bindings/rgbmatrix/RGBMatrix.c @@ -2020,10 +2011,7 @@ msgid "The length of rgb_pins must be 6, 12, 18, 24, or 30" msgstr "" #: supervisor/shared/safe_mode.c -msgid "" -"The microcontroller's power dipped. Make sure your power supply provides\n" -"enough power for the whole circuit and press reset (after ejecting " -"CIRCUITPY)." +msgid "The power dipped. Make sure you are providing enough power." msgstr "" #: shared-module/audiomixer/MixerVoice.c @@ -2042,6 +2030,10 @@ msgstr "" msgid "The sample's signedness does not match the mixer's" msgstr "" +#: supervisor/shared/safe_mode.c +msgid "Third-party firmware fatal error." +msgstr "" + #: shared-module/imagecapture/ParallelImageCapture.c msgid "This microcontroller does not support continuous capture." msgstr "" @@ -2074,10 +2066,6 @@ msgstr "" msgid "Timeout is too long: Maximum timeout length is %d seconds" msgstr "" -#: supervisor/shared/safe_mode.c -msgid "To exit, please reset the board without requesting safe mode." -msgstr "" - #: ports/atmel-samd/common-hal/audiobusio/I2SOut.c msgid "Too many channels in sample" msgstr "" @@ -2122,6 +2110,10 @@ msgstr "" msgid "UART init" msgstr "" +#: ports/raspberrypi/common-hal/busio/UART.c +msgid "UART peripheral in use" +msgstr "" + #: ports/stm/common-hal/busio/UART.c msgid "UART re-init" msgstr "" @@ -2169,6 +2161,10 @@ msgstr "" msgid "Unable to allocate buffers for signed conversion" msgstr "" +#: supervisor/shared/safe_mode.c +msgid "Unable to allocate the heap." +msgstr "" + #: ports/espressif/common-hal/busio/I2C.c msgid "Unable to create lock" msgstr "" @@ -2192,11 +2188,12 @@ msgid "Unable to read color palette data" msgstr "" #: ports/espressif/common-hal/mdns/Server.c +#: ports/raspberrypi/common-hal/mdns/Server.c msgid "Unable to start mDNS query" msgstr "" -#: shared-bindings/coproc/CoprocMemory.c -msgid "Unable to write" +#: shared-bindings/memorymap/AddressRange.c +msgid "Unable to write to address." msgstr "" #: shared-bindings/nvm/ByteArray.c @@ -2267,6 +2264,7 @@ msgid "Unkown error code %d" msgstr "" #: shared-bindings/adafruit_pixelbuf/PixelBuf.c +#: shared-module/_pixelmap/PixelMap.c #, c-format msgid "Unmatched number of items on RHS (expected %d, got %d)." msgstr "" @@ -2351,6 +2349,18 @@ msgstr "" msgid "Wi-Fi: " msgstr "" +#: ports/raspberrypi/common-hal/wifi/Radio.c +msgid "Wifi is in access point mode." +msgstr "" + +#: ports/raspberrypi/common-hal/wifi/Radio.c +msgid "Wifi is in station mode." +msgstr "" + +#: ports/raspberrypi/common-hal/wifi/Radio.c +msgid "Wifi is not enabled" +msgstr "" + #: main.c msgid "Woken up by alarm.\n" msgstr "" @@ -2360,13 +2370,48 @@ msgstr "" msgid "Writes not supported on Characteristic" msgstr "" -#: supervisor/shared/safe_mode.c -msgid "You are in safe mode because:\n" +#: ports/atmel-samd/boards/circuitplayground_express/mpconfigboard.h +#: ports/atmel-samd/boards/circuitplayground_express_crickit/mpconfigboard.h +#: ports/atmel-samd/boards/circuitplayground_express_displayio/mpconfigboard.h +#: ports/atmel-samd/boards/meowmeow/mpconfigboard.h +msgid "You pressed both buttons at start up." +msgstr "" + +#: ports/espressif/boards/m5stack_core_basic/mpconfigboard.h +#: ports/espressif/boards/m5stack_core_fire/mpconfigboard.h +#: ports/espressif/boards/m5stack_stick_c/mpconfigboard.h +msgid "You pressed button A at start up." msgstr "" #: supervisor/shared/safe_mode.c -msgid "" -"You pressed the reset button during boot. Press again to exit safe mode." +msgid "You pressed the BOOT button at start up" +msgstr "" + +#: ports/espressif/boards/adafruit_feather_esp32_v2/mpconfigboard.h +msgid "You pressed the SW38 button at start up." +msgstr "" + +#: ports/espressif/boards/hardkernel_odroid_go/mpconfigboard.h +msgid "You pressed the VOLUME button at start up." +msgstr "" + +#: ports/espressif/boards/m5stack_atom_echo/mpconfigboard.h +#: ports/espressif/boards/m5stack_atom_lite/mpconfigboard.h +#: ports/espressif/boards/m5stack_atom_matrix/mpconfigboard.h +#: ports/espressif/boards/m5stack_atom_u/mpconfigboard.h +msgid "You pressed the central button at start up." +msgstr "" + +#: ports/nrf/boards/aramcon2_badge/mpconfigboard.h +msgid "You pressed the left button at start up." +msgstr "" + +#: supervisor/shared/safe_mode.c +msgid "You pressed the reset button during boot." +msgstr "" + +#: supervisor/shared/micropython.c +msgid "[truncated due to length]" msgstr "" #: py/objtype.c @@ -2438,8 +2483,12 @@ msgstr "" msgid "array has too many dimensions" msgstr "" +#: extmod/ulab/code/ndarray.c +msgid "array is too big" +msgstr "" + #: py/objarray.c shared-bindings/alarm/SleepMemory.c -#: shared-bindings/coproc/CoprocMemory.c shared-bindings/nvm/ByteArray.c +#: shared-bindings/memorymap/AddressRange.c shared-bindings/nvm/ByteArray.c msgid "array/bytes required on right side" msgstr "" @@ -2532,10 +2581,6 @@ msgstr "" msgid "buffer too small for requested bytes" msgstr "" -#: shared-bindings/adafruit_pixelbuf/PixelBuf.c -msgid "byteorder is not a string" -msgstr "" - #: py/objarray.c msgid "bytes length not a multiple of item size" msgstr "" @@ -2577,14 +2622,10 @@ msgstr "" msgid "can't cancel self" msgstr "" -#: py/obj.c py/objint.c shared-module/adafruit_pixelbuf/PixelBuf.c +#: py/obj.c py/objint.c py/runtime.c shared-module/adafruit_pixelbuf/PixelBuf.c msgid "can't convert %q to %q" msgstr "" -#: py/runtime.c -msgid "can't convert %q to int" -msgstr "" - #: py/obj.c #, c-format msgid "can't convert %s to complex" @@ -2666,6 +2707,10 @@ msgstr "" msgid "can't set attribute" msgstr "" +#: py/runtime.c +msgid "can't set attribute '%q'" +msgstr "" + #: py/emitnative.c msgid "can't store '%q'" msgstr "" @@ -2768,10 +2813,6 @@ msgstr "" msgid "comparison of int and uint" msgstr "" -#: py/objcomplex.c -msgid "complex division by zero" -msgstr "" - #: py/objfloat.c py/parsenum.c msgid "complex values not supported" msgstr "" @@ -2874,12 +2915,11 @@ msgstr "" msgid "div/mod not implemented for uint" msgstr "" -#: py/objfloat.c py/objint_mpz.c +#: extmod/ulab/code/numpy/create.c msgid "divide by zero" msgstr "" -#: py/modmath.c py/objint_longlong.c py/runtime.c -#: shared-bindings/math/__init__.c +#: py/runtime.c msgid "division by zero" msgstr "" @@ -2920,9 +2960,9 @@ msgstr "" msgid "error = 0x%08lX" msgstr "" -#: ports/espressif/common-hal/esp32_camera/Camera.c +#: ports/espressif/common-hal/espcamera/Camera.c msgid "" -"esp32_camera.Camera requires reserved PSRAM to be configured. See the " +"espcamera.Camera requires reserved PSRAM to be configured. See the " "documentation for instructions." msgstr "" @@ -2930,14 +2970,6 @@ msgstr "" msgid "exceptions must derive from BaseException" msgstr "" -#: shared-bindings/canio/CAN.c -msgid "expected '%q' but got '%q'" -msgstr "" - -#: shared-bindings/canio/CAN.c -msgid "expected '%q' or '%q' but got '%q'" -msgstr "" - #: py/objstr.c msgid "expected ':' after format specifier" msgstr "" @@ -3036,10 +3068,6 @@ msgstr "" msgid "format requires a dict" msgstr "" -#: shared-bindings/microcontroller/Processor.c -msgid "frequency is read-only for this board" -msgstr "" - #: py/objdeque.c msgid "full" msgstr "" @@ -3152,8 +3180,12 @@ msgstr "" msgid "index is out of bounds" msgstr "" +#: shared-bindings/_pixelmap/PixelMap.c +msgid "index must be tuple or int" +msgstr "" + #: extmod/ulab/code/numpy/numerical.c extmod/ulab/code/ulab_tools.c -#: ports/espressif/common-hal/pulseio/PulseIn.c py/obj.c +#: ports/espressif/common-hal/pulseio/PulseIn.c #: shared-bindings/bitmaptools/__init__.c msgid "index out of range" msgstr "" @@ -3251,10 +3283,6 @@ msgstr "" msgid "inputs are not iterable" msgstr "" -#: py/parsenum.c -msgid "int() arg 2 must be >= 2 and <= 36" -msgstr "" - #: extmod/ulab/code/numpy/approx.c msgid "interp is defined for 1D iterables of equal length" msgstr "" @@ -3311,7 +3339,7 @@ msgstr "" msgid "invalid micropython decorator" msgstr "" -#: ports/espressif/common-hal/esp32_camera/Camera.c +#: ports/espressif/common-hal/espcamera/Camera.c msgid "invalid setting" msgstr "" @@ -3336,10 +3364,6 @@ msgstr "" msgid "invalid syntax for number" msgstr "" -#: py/objexcept.c -msgid "invalid traceback" -msgstr "" - #: py/objtype.c msgid "issubclass() arg 1 must be a class" msgstr "" @@ -3396,19 +3420,17 @@ msgstr "" msgid "local variable referenced before assignment" msgstr "" -#: py/objint.c -msgid "long int not supported in this build" -msgstr "" - #: ports/espressif/common-hal/canio/CAN.c msgid "loopback + silent mode not supported by peripheral" msgstr "" #: ports/espressif/common-hal/mdns/Server.c +#: ports/raspberrypi/common-hal/mdns/Server.c msgid "mDNS already initialized" msgstr "" #: ports/espressif/common-hal/mdns/Server.c +#: ports/raspberrypi/common-hal/mdns/Server.c msgid "mDNS only works with built-in WiFi" msgstr "" @@ -3537,6 +3559,10 @@ msgstr "" msgid "negative shift count" msgstr "" +#: shared-bindings/_pixelmap/PixelMap.c +msgid "nested index must be int" +msgstr "" + #: shared-module/sdcardio/SDCard.c msgid "no SD card" msgstr "" @@ -3570,7 +3596,7 @@ msgstr "" msgid "no response from SD card" msgstr "" -#: ports/espressif/common-hal/esp32_camera/Camera.c py/objobject.c py/runtime.c +#: ports/espressif/common-hal/espcamera/Camera.c py/objobject.c py/runtime.c msgid "no such attribute" msgstr "" @@ -3706,6 +3732,10 @@ msgstr "" msgid "only mono is supported" msgstr "" +#: extmod/ulab/code/numpy/create.c +msgid "only ndarrays can be concatenated" +msgstr "" + #: ports/stm/common-hal/audiobusio/PDMIn.c msgid "only oversample=64 is supported" msgstr "" @@ -3716,7 +3746,7 @@ msgid "only sample_rate=16000 is supported" msgstr "" #: py/objarray.c py/objstr.c py/objstrunicode.c py/objtuple.c -#: shared-bindings/alarm/SleepMemory.c shared-bindings/coproc/CoprocMemory.c +#: shared-bindings/alarm/SleepMemory.c shared-bindings/memorymap/AddressRange.c #: shared-bindings/nvm/ByteArray.c msgid "only slices with step=1 (aka None) are supported" msgstr "" @@ -3932,10 +3962,6 @@ msgstr "" msgid "slice step can't be zero" msgstr "" -#: py/objslice.c -msgid "slice step cannot be zero" -msgstr "" - #: py/nativeglue.c msgid "slice unsupported" msgstr "" @@ -3984,10 +4010,6 @@ msgstr "" msgid "start/end indices" msgstr "" -#: shared-bindings/random/__init__.c -msgid "step must be non-zero" -msgstr "" - #: shared-bindings/random/__init__.c msgid "stop not reachable from start" msgstr "" @@ -3996,10 +4018,6 @@ msgstr "" msgid "stream operation not supported" msgstr "" -#: py/objstrunicode.c -msgid "string indices must be integers, not %q" -msgstr "" - #: py/stream.c msgid "string not supported; use bytes or bytearray" msgstr "" @@ -4032,10 +4050,6 @@ msgstr "" msgid "syntax error in uctypes descriptor" msgstr "" -#: shared-bindings/time/__init__.c -msgid "time.struct_time() takes a 9-sequence" -msgstr "" - #: ports/atmel-samd/common-hal/watchdog/WatchDogTimer.c #: ports/espressif/common-hal/watchdog/WatchDogTimer.c #: ports/nrf/common-hal/watchdog/WatchDogTimer.c @@ -4317,10 +4331,6 @@ msgstr "" msgid "y value out of bounds" msgstr "" -#: py/objrange.c -msgid "zero step" -msgstr "" - #: extmod/ulab/code/scipy/signal/signal.c msgid "zi must be an ndarray" msgstr "" diff --git a/locale/it_IT.po b/locale/it_IT.po index e1ba5c3827..d3b91d4c3d 100644 --- a/locale/it_IT.po +++ b/locale/it_IT.po @@ -34,12 +34,21 @@ msgstr "" #: supervisor/shared/safe_mode.c msgid "" "\n" -"Please file an issue with the contents of your CIRCUITPY drive at \n" -"https://github.com/adafruit/circuitpython/issues\n" +"Please file an issue with your program at https://github.com/adafruit/" +"circuitpython/issues." msgstr "" + +#: supervisor/shared/safe_mode.c +msgid "" "\n" -"Per favore, segnala il problema con il contenuto del tuo CIRCUITPY a\n" -"https://github.com/adafruit/circuitpython/issues\n" +"Press reset to exit safe mode.\n" +msgstr "" + +#: supervisor/shared/safe_mode.c +msgid "" +"\n" +"You are in safe mode because:\n" +msgstr "" #: py/obj.c msgid " File \"%q\"" @@ -71,6 +80,11 @@ msgstr "%%c necessita di int o char" msgid "%02X" msgstr "" +#: shared-module/os/getenv.c +#, c-format +msgid "%S" +msgstr "" + #: shared-bindings/rgbmatrix/RGBMatrix.c #, c-format msgid "" @@ -87,7 +101,7 @@ msgstr "" #: 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 +#: ports/stm/common-hal/canio/Listener.c ports/stm/common-hal/rtc/RTC.c msgid "%q" msgstr "" @@ -107,13 +121,18 @@ msgstr "" msgid "%q failure: %d" msgstr "%q fallito: %d" +#: py/argcheck.c +msgid "%q in %q must be of type %q, not %q" +msgstr "" + +#: ports/espressif/common-hal/espulp/ULP.c #: ports/raspberrypi/common-hal/rp2pio/StateMachine.c #: shared-bindings/digitalio/DigitalInOut.c #: shared-bindings/microcontroller/Pin.c msgid "%q in use" msgstr "%q in uso" -#: py/obj.c py/objstr.c py/objstrunicode.c +#: py/objstr.c py/objstrunicode.c msgid "%q index out of range" msgstr "indice %q fuori intervallo" @@ -125,7 +144,11 @@ msgstr "" msgid "%q is %q" msgstr "" -#: py/argcheck.c +#: ports/raspberrypi/common-hal/wifi/Radio.c +msgid "%q is read-only for this board" +msgstr "" + +#: py/argcheck.c shared-bindings/usb_hid/Device.c msgid "%q length must be %d" msgstr "" @@ -141,10 +164,6 @@ msgstr "" 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 "" @@ -166,24 +185,20 @@ msgid "%q must be >= %d" msgstr "" #: shared-bindings/analogbufio/BufferedIn.c +msgid "%q must be a bytearray or array of type 'H' or 'B'" +msgstr "" + #: 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" +#: ports/raspberrypi/bindings/cyw43/__init__.c py/argcheck.c py/objexcept.c +#: shared-bindings/canio/CAN.c shared-bindings/digitalio/Pull.c +msgid "%q must be of type %q or %q, not %q" msgstr "" -#: py/argcheck.c -msgid "%q must be an int" -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" +#: py/argcheck.c py/obj.c py/objstrunicode.c +msgid "%q must be of type %q, not %q" msgstr "" #: ports/atmel-samd/common-hal/busio/UART.c @@ -196,7 +211,6 @@ msgstr "" #: ports/atmel-samd/common-hal/pulseio/PulseIn.c #: ports/cxd56/common-hal/pulseio/PulseIn.c -#: ports/espressif/common-hal/coproc/Coproc.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 @@ -208,8 +222,8 @@ msgstr "%q oltre il limite" msgid "%q pin invalid" msgstr "%q pin non valido" -#: shared-bindings/usb_hid/Device.c -msgid "%q with a report ID of 0 must be of length 1" +#: py/objrange.c py/objslice.c shared-bindings/random/__init__.c +msgid "%q step cannot be zero" msgstr "" #: py/bc.c py/objnamedtuple.c @@ -309,7 +323,7 @@ msgstr "" msgid "'%s' object doesn't support item deletion" msgstr "" -#: ports/raspberrypi/common-hal/wifi/Radio.c py/runtime.c +#: py/runtime.c msgid "'%s' object has no attribute '%q'" msgstr "l'oggetto '%s' non ha l'attributo '%q'" @@ -410,6 +424,10 @@ msgstr "ADC2 sta usando il WiFi" msgid "Address must be %d bytes long" msgstr "L'indirizzo deve essere lungo %d byte" +#: ports/espressif/common-hal/memorymap/AddressRange.c +msgid "Address range not allowed" +msgstr "" + #: ports/espressif/common-hal/canio/CAN.c msgid "All CAN peripherals are in use" msgstr "Tutte le periferiche CAN sono in uso" @@ -437,7 +455,6 @@ msgid "All SPI peripherals are in use" msgstr "Tutte le periferiche SPI sono in uso" #: ports/espressif/common-hal/busio/UART.c ports/nrf/common-hal/busio/UART.c -#: ports/raspberrypi/common-hal/busio/UART.c #, fuzzy msgid "All UART peripherals are in use" msgstr "Tutte le periferiche I2C sono in uso" @@ -491,7 +508,7 @@ msgstr "" msgid "Already have all-matches listener" msgstr "Già in possesso di tutti i listener abbinati" -#: ports/espressif/common-hal/coproc/__init__.c +#: ports/espressif/common-hal/espulp/ULP.c #: shared-module/memorymonitor/AllocationAlarm.c #: shared-module/memorymonitor/AllocationSize.c msgid "Already running" @@ -502,6 +519,11 @@ msgstr "Già in funzione" msgid "Already scanning for wifi networks" msgstr "Già in ricerca di collegamenti WiFi" +#: shared-module/os/getenv.c +#, c-format +msgid "An error occurred while retrieving '%s':\n" +msgstr "" + #: ports/stm/common-hal/audiopwmio/PWMAudioOut.c msgid "Another PWMAudioOut is already active" msgstr "" @@ -515,24 +537,16 @@ msgstr "Another send è gia activato" msgid "Array must contain halfwords (type 'H')" msgstr "Array deve avere mezzoparole (typo 'H')" -#: shared-bindings/alarm/SleepMemory.c shared-bindings/coproc/CoprocMemory.c +#: shared-bindings/alarm/SleepMemory.c shared-bindings/memorymap/AddressRange.c #: shared-bindings/nvm/ByteArray.c msgid "Array values should be single bytes." msgstr "I valori dell'Array dovrebbero essere bytes singoli." -#: shared-bindings/microcontroller/Pin.c -msgid "At most %d %q may be specified (not %d)" -msgstr "Almeno %d %q devono essere specificati (non %d)" - #: shared-module/memorymonitor/AllocationAlarm.c #, c-format msgid "Attempt to allocate %d blocks" msgstr "Provo ad allocare %d blocchi" -#: supervisor/shared/safe_mode.c -msgid "Attempted heap allocation when VM not running." -msgstr "" - #: ports/raspberrypi/audio_dma.c msgid "Audio conversion not implemented" msgstr "" @@ -584,20 +598,13 @@ msgid "Bitmap size and bits per value must match" msgstr "" #: supervisor/shared/safe_mode.c -msgid "Boot device must be first device (interface #0)." +msgid "Boot device must be first (interface #0)." msgstr "" #: ports/mimxrt10xx/common-hal/busio/UART.c msgid "Both RX and TX required for flow control" msgstr "Sia RX che TX richiedono il controllo del flow" -#: ports/atmel-samd/boards/circuitplayground_express/mpconfigboard.h -#: ports/atmel-samd/boards/circuitplayground_express_crickit/mpconfigboard.h -#: ports/atmel-samd/boards/circuitplayground_express_displayio/mpconfigboard.h -#: ports/atmel-samd/boards/meowmeow/mpconfigboard.h -msgid "Both buttons were pressed at start up.\n" -msgstr "" - #: ports/atmel-samd/common-hal/rotaryio/IncrementalEncoder.c msgid "Both pins must support hardware interrupts" msgstr "Entrambi i pin devono supportare gli interrupt hardware" @@ -663,11 +670,6 @@ msgstr "" msgid "Bus pin %d is already in use" msgstr "Bus pin %d è già in uso" -#: ports/espressif/boards/m5stack_core_basic/mpconfigboard.h -#: ports/espressif/boards/m5stack_core_fire/mpconfigboard.h -msgid "Button A was pressed at start up.\n" -msgstr "" - #: shared-bindings/_bleio/UUID.c msgid "Byte buffer must be 16 bytes." msgstr "I buffer byte devono essere di almeno 16 bytes." @@ -799,10 +801,6 @@ msgstr "CharacteristicBuffer scritura non dato" msgid "CircuitPython core code crashed hard. Whoops!\n" msgstr "" -#: supervisor/shared/safe_mode.c -msgid "CircuitPython was unable to allocate the heap." -msgstr "" - #: shared-module/bitbangio/I2C.c msgid "Clock stretch too long" msgstr "Orologio e troppo allungato" @@ -841,10 +839,6 @@ msgstr "" msgid "Couldn't allocate decoder" msgstr "" -#: supervisor/shared/safe_mode.c -msgid "Crash into the HardFault_Handler." -msgstr "" - #: ports/stm/common-hal/analogio/AnalogOut.c msgid "DAC Channel Init Error" msgstr "" @@ -909,6 +903,10 @@ msgstr "" msgid "Drive mode not used when direction is input." msgstr "" +#: py/obj.c +msgid "During handling of the above exception, another exception occurred:" +msgstr "" + #: shared-bindings/aesio/aes.c msgid "ECB only operates on 16 bytes at a time" msgstr "" @@ -934,24 +932,16 @@ msgstr "" msgid "Error in regex" msgstr "Errore nella regex" +#: supervisor/shared/safe_mode.c +msgid "Error in safemode.py." +msgstr "" + #: shared-bindings/socketpool/Socket.c shared-bindings/ssl/SSLSocket.c msgid "Error: Failure to bind" msgstr "" -#: py/enum.c shared-bindings/_bleio/__init__.c shared-bindings/aesio/aes.c -#: shared-bindings/alarm/__init__.c shared-bindings/alarm/coproc/CoprocAlarm.c -#: shared-bindings/busio/SPI.c shared-bindings/coproc/Coproc.c -#: shared-bindings/coproc/__init__.c shared-bindings/microcontroller/Pin.c -#: shared-bindings/neopixel_write/__init__.c -msgid "Expected a %q" -msgstr "Atteso un %q" - -#: ports/raspberrypi/bindings/cyw43/__init__.c -msgid "Expected a %q or %q" -msgstr "" - #: shared-bindings/alarm/__init__.c -msgid "Expected an %q" +msgid "Expected a kind of %q" msgstr "" #: ports/espressif/common-hal/_bleio/Adapter.c @@ -1019,13 +1009,17 @@ msgid "Failed to write internal flash." msgstr "" #: supervisor/shared/safe_mode.c -msgid "Fatal error." +msgid "Fault detected by hardware." msgstr "" #: py/moduerrno.c msgid "File exists" msgstr "File esistente" +#: shared-module/os/getenv.c +msgid "File not found" +msgstr "" + #: ports/atmel-samd/common-hal/canio/Listener.c #: ports/espressif/common-hal/canio/Listener.c #: ports/stm/common-hal/canio/Listener.c @@ -1040,7 +1034,6 @@ msgstr "" msgid "Firmware is invalid" msgstr "" -#: ports/espressif/common-hal/coproc/Coproc.c #: ports/espressif/common-hal/dualbank/__init__.c msgid "Firmware is too big" msgstr "" @@ -1082,6 +1075,8 @@ msgstr "" #: shared-bindings/displayio/Display.c #: shared-bindings/displayio/EPaperDisplay.c #: shared-bindings/framebufferio/FramebufferDisplay.c +#: shared-module/displayio/Display.c +#: shared-module/framebufferio/FramebufferDisplay.c msgid "Group already used" msgstr "" @@ -1102,6 +1097,15 @@ msgstr "" msgid "Hardware in use, try alternative pins" msgstr "" +#: supervisor/shared/safe_mode.c +msgid "Heap allocation when VM not running." +msgstr "" + +#: supervisor/shared/safe_mode.c +msgid "" +"Heap was corrupted because the stack was too small. Increase stack size." +msgstr "" + #: extmod/vfs_posix_file.c py/objstringio.c msgid "I/O operation on closed file" msgstr "operazione I/O su file chiuso" @@ -1119,11 +1123,6 @@ msgstr "" msgid "I2SOut not available" msgstr "" -#: shared-bindings/aesio/aes.c -#, c-format -msgid "IV must be %d bytes long" -msgstr "" - #: ports/raspberrypi/bindings/rp2pio/StateMachine.c msgid "In-buffer elements must be <= 4 bytes long" msgstr "" @@ -1210,6 +1209,7 @@ msgid "Internal define error" msgstr "" #: ports/espressif/common-hal/paralleldisplay/ParallelBus.c +#: shared-module/os/getenv.c msgid "Internal error" msgstr "" @@ -1222,6 +1222,10 @@ msgstr "" msgid "Internal watchdog timer expired." msgstr "" +#: supervisor/shared/safe_mode.c +msgid "Interrupt error." +msgstr "" + #: py/argcheck.c shared-bindings/digitalio/DigitalInOut.c msgid "Invalid %q" msgstr "" @@ -1256,6 +1260,11 @@ msgstr "Argomento non valido" msgid "Invalid bits per value" msgstr "bits per valore invalido" +#: shared-module/os/getenv.c +#, c-format +msgid "Invalid byte %.*s" +msgstr "" + #: ports/atmel-samd/common-hal/imagecapture/ParallelImageCapture.c #, c-format msgid "Invalid data_pins[%d]" @@ -1265,18 +1274,10 @@ msgstr "" msgid "Invalid format chunk size" msgstr "" -#: supervisor/shared/safe_mode.c -msgid "Invalid memory access." -msgstr "" - #: ports/espressif/common-hal/wifi/Radio.c msgid "Invalid multicast MAC address" msgstr "" -#: shared-bindings/busio/UART.c -msgid "Invalid pins" -msgstr "Pin non validi" - #: ports/espressif/common-hal/espidf/__init__.c ports/espressif/esp_error.c msgid "Invalid size" msgstr "" @@ -1290,10 +1291,18 @@ msgstr "" msgid "Invalid state" msgstr "" +#: shared-module/os/getenv.c +msgid "Invalid unicode escape" +msgstr "" + #: shared-bindings/aesio/aes.c msgid "Key must be 16, 24, or 32 bytes long" msgstr "" +#: shared-module/os/getenv.c +msgid "Key not found" +msgstr "" + #: shared-module/is31fl3741/FrameBuffer.c msgid "LED mappings must match display size" msgstr "" @@ -1401,6 +1410,10 @@ msgstr "" msgid "NVS Error" msgstr "" +#: shared-bindings/socketpool/SocketPool.c +msgid "Name or service not known" +msgstr "" + #: py/qstr.c msgid "Name too long" msgstr "" @@ -1515,11 +1528,6 @@ msgstr "" msgid "No long integer support" msgstr "" -#: shared-module/usb_hid/__init__.c -#, c-format -msgid "No more than %d HID devices allowed" -msgstr "" - #: shared-bindings/wifi/Radio.c msgid "No network with that ssid" msgstr "" @@ -1555,10 +1563,6 @@ msgstr "Nessun file/directory esistente" msgid "No timer available" msgstr "" -#: supervisor/shared/safe_mode.c -msgid "Nordic system firmware failure assertion." -msgstr "" - #: ports/nrf/common-hal/_bleio/__init__.c msgid "Nordic system firmware out of memory" msgstr "" @@ -1579,10 +1583,6 @@ msgstr "Impossible connettersi all'AP" msgid "Not playing" msgstr "In pausa" -#: shared-bindings/_bleio/__init__.c -msgid "Not settable" -msgstr "" - #: ports/espressif/common-hal/paralleldisplay/ParallelBus.c #, c-format msgid "Number of data_pins must be 8 or 16, not %d" @@ -1648,11 +1648,14 @@ msgid "" "%d bpp given" msgstr "" -#: ports/espressif/common-hal/alarm/coproc/CoprocAlarm.c #: ports/espressif/common-hal/alarm/touch/TouchAlarm.c msgid "Only one %q can be set in deep sleep." msgstr "" +#: ports/espressif/common-hal/espulp/ULPAlarm.c +msgid "Only one %q can be set." +msgstr "" + #: ports/espressif/common-hal/i2ctarget/I2CTarget.c #: ports/raspberrypi/common-hal/i2ctarget/I2CTarget.c msgid "Only one address is allowed" @@ -1685,6 +1688,10 @@ msgstr "" msgid "Operation timed out" msgstr "" +#: ports/raspberrypi/common-hal/mdns/Server.c +msgid "Out of MDNS service slots" +msgstr "" + #: ports/espressif/common-hal/espidf/__init__.c ports/espressif/esp_error.c msgid "Out of memory" msgstr "" @@ -1812,6 +1819,10 @@ msgstr "" msgid "Program size invalid" msgstr "" +#: ports/espressif/common-hal/espulp/ULP.c +msgid "Program too long" +msgstr "" + #: shared-bindings/digitalio/DigitalInOut.c msgid "Pull not used when direction is output." msgstr "" @@ -1851,8 +1862,9 @@ msgstr "RTC non supportato su questa scheda" msgid "Random number generation error" msgstr "" +#: shared-bindings/_bleio/__init__.c #: shared-bindings/memorymonitor/AllocationSize.c -#: shared-bindings/pulseio/PulseIn.c +#: shared-bindings/pulseio/PulseIn.c shared-module/displayio/Bitmap.c msgid "Read-only" msgstr "Sola lettura" @@ -1860,11 +1872,6 @@ msgstr "Sola lettura" msgid "Read-only filesystem" msgstr "Filesystem in sola lettura" -#: shared-module/displayio/Bitmap.c -#, fuzzy -msgid "Read-only object" -msgstr "Sola lettura" - #: ports/espressif/common-hal/espidf/__init__.c ports/espressif/esp_error.c msgid "Received response was invalid" msgstr "" @@ -1957,7 +1964,7 @@ msgstr "" msgid "Sleep Memory not available" msgstr "" -#: shared-bindings/alarm/SleepMemory.c shared-bindings/coproc/CoprocMemory.c +#: shared-bindings/alarm/SleepMemory.c shared-bindings/memorymap/AddressRange.c #: shared-bindings/nvm/ByteArray.c msgid "Slice and value different lengths." msgstr "" @@ -1994,6 +2001,10 @@ msgstr "" msgid "Stereo right must be on PWM channel B" msgstr "" +#: ports/raspberrypi/common-hal/wifi/Radio.c +msgid "Stopping AP is not supported." +msgstr "" + #: ports/mimxrt10xx/common-hal/busio/UART.c ports/stm/common-hal/busio/UART.c msgid "Supply at least one UART pin" msgstr "" @@ -2011,35 +2022,11 @@ msgid "Temperature read timed out" msgstr "" #: supervisor/shared/safe_mode.c -msgid "The BOOT button was pressed at start up.\n" +msgid "The `microcontroller` module was used to boot into safe mode." msgstr "" -#: supervisor/shared/safe_mode.c -msgid "" -"The CircuitPython heap was corrupted because the stack was too small.\n" -"Increase the stack size if you know how. If not:" -msgstr "" - -#: ports/espressif/boards/adafruit_feather_esp32_v2/mpconfigboard.h -msgid "The SW38 button was pressed at start up.\n" -msgstr "" - -#: ports/espressif/boards/hardkernel_odroid_go/mpconfigboard.h -msgid "The VOLUME button was pressed at start up.\n" -msgstr "" - -#: supervisor/shared/safe_mode.c -msgid "" -"The `microcontroller` module was used to boot into safe mode. Press reset to " -"exit safe mode." -msgstr "" - -#: ports/espressif/boards/m5stack_atom_lite/mpconfigboard.h -msgid "The central button was pressed at start up.\n" -msgstr "" - -#: ports/nrf/boards/aramcon2_badge/mpconfigboard.h -msgid "The left button was pressed at start up.\n" +#: py/obj.c +msgid "The above exception was the direct cause of the following exception:" msgstr "" #: shared-bindings/rgbmatrix/RGBMatrix.c @@ -2047,10 +2034,7 @@ msgid "The length of rgb_pins must be 6, 12, 18, 24, or 30" msgstr "" #: supervisor/shared/safe_mode.c -msgid "" -"The microcontroller's power dipped. Make sure your power supply provides\n" -"enough power for the whole circuit and press reset (after ejecting " -"CIRCUITPY)." +msgid "The power dipped. Make sure you are providing enough power." msgstr "" #: shared-module/audiomixer/MixerVoice.c @@ -2069,6 +2053,10 @@ msgstr "" msgid "The sample's signedness does not match the mixer's" msgstr "" +#: supervisor/shared/safe_mode.c +msgid "Third-party firmware fatal error." +msgstr "" + #: shared-module/imagecapture/ParallelImageCapture.c msgid "This microcontroller does not support continuous capture." msgstr "" @@ -2101,10 +2089,6 @@ msgstr "" msgid "Timeout is too long: Maximum timeout length is %d seconds" msgstr "" -#: supervisor/shared/safe_mode.c -msgid "To exit, please reset the board without requesting safe mode." -msgstr "" - #: ports/atmel-samd/common-hal/audiobusio/I2SOut.c msgid "Too many channels in sample" msgstr "" @@ -2149,6 +2133,10 @@ msgstr "" msgid "UART init" msgstr "" +#: ports/raspberrypi/common-hal/busio/UART.c +msgid "UART peripheral in use" +msgstr "" + #: ports/stm/common-hal/busio/UART.c msgid "UART re-init" msgstr "" @@ -2196,6 +2184,10 @@ msgstr "" msgid "Unable to allocate buffers for signed conversion" msgstr "Ipossibilitato ad allocare buffer per la conversione con segno" +#: supervisor/shared/safe_mode.c +msgid "Unable to allocate the heap." +msgstr "" + #: ports/espressif/common-hal/busio/I2C.c msgid "Unable to create lock" msgstr "" @@ -2219,11 +2211,12 @@ msgid "Unable to read color palette data" msgstr "" #: ports/espressif/common-hal/mdns/Server.c +#: ports/raspberrypi/common-hal/mdns/Server.c msgid "Unable to start mDNS query" msgstr "" -#: shared-bindings/coproc/CoprocMemory.c -msgid "Unable to write" +#: shared-bindings/memorymap/AddressRange.c +msgid "Unable to write to address." msgstr "" #: shared-bindings/nvm/ByteArray.c @@ -2295,6 +2288,7 @@ msgid "Unkown error code %d" msgstr "" #: shared-bindings/adafruit_pixelbuf/PixelBuf.c +#: shared-module/_pixelmap/PixelMap.c #, c-format msgid "Unmatched number of items on RHS (expected %d, got %d)." msgstr "" @@ -2380,6 +2374,18 @@ msgstr "" msgid "Wi-Fi: " msgstr "" +#: ports/raspberrypi/common-hal/wifi/Radio.c +msgid "Wifi is in access point mode." +msgstr "" + +#: ports/raspberrypi/common-hal/wifi/Radio.c +msgid "Wifi is in station mode." +msgstr "" + +#: ports/raspberrypi/common-hal/wifi/Radio.c +msgid "Wifi is not enabled" +msgstr "" + #: main.c msgid "Woken up by alarm.\n" msgstr "" @@ -2389,13 +2395,48 @@ msgstr "" msgid "Writes not supported on Characteristic" msgstr "" -#: supervisor/shared/safe_mode.c -msgid "You are in safe mode because:\n" +#: ports/atmel-samd/boards/circuitplayground_express/mpconfigboard.h +#: ports/atmel-samd/boards/circuitplayground_express_crickit/mpconfigboard.h +#: ports/atmel-samd/boards/circuitplayground_express_displayio/mpconfigboard.h +#: ports/atmel-samd/boards/meowmeow/mpconfigboard.h +msgid "You pressed both buttons at start up." +msgstr "" + +#: ports/espressif/boards/m5stack_core_basic/mpconfigboard.h +#: ports/espressif/boards/m5stack_core_fire/mpconfigboard.h +#: ports/espressif/boards/m5stack_stick_c/mpconfigboard.h +msgid "You pressed button A at start up." msgstr "" #: supervisor/shared/safe_mode.c -msgid "" -"You pressed the reset button during boot. Press again to exit safe mode." +msgid "You pressed the BOOT button at start up" +msgstr "" + +#: ports/espressif/boards/adafruit_feather_esp32_v2/mpconfigboard.h +msgid "You pressed the SW38 button at start up." +msgstr "" + +#: ports/espressif/boards/hardkernel_odroid_go/mpconfigboard.h +msgid "You pressed the VOLUME button at start up." +msgstr "" + +#: ports/espressif/boards/m5stack_atom_echo/mpconfigboard.h +#: ports/espressif/boards/m5stack_atom_lite/mpconfigboard.h +#: ports/espressif/boards/m5stack_atom_matrix/mpconfigboard.h +#: ports/espressif/boards/m5stack_atom_u/mpconfigboard.h +msgid "You pressed the central button at start up." +msgstr "" + +#: ports/nrf/boards/aramcon2_badge/mpconfigboard.h +msgid "You pressed the left button at start up." +msgstr "" + +#: supervisor/shared/safe_mode.c +msgid "You pressed the reset button during boot." +msgstr "" + +#: supervisor/shared/micropython.c +msgid "[truncated due to length]" msgstr "" #: py/objtype.c @@ -2467,8 +2508,12 @@ msgstr "" msgid "array has too many dimensions" msgstr "" +#: extmod/ulab/code/ndarray.c +msgid "array is too big" +msgstr "" + #: py/objarray.c shared-bindings/alarm/SleepMemory.c -#: shared-bindings/coproc/CoprocMemory.c shared-bindings/nvm/ByteArray.c +#: shared-bindings/memorymap/AddressRange.c shared-bindings/nvm/ByteArray.c msgid "array/bytes required on right side" msgstr "" @@ -2564,10 +2609,6 @@ msgstr "buffer troppo piccolo" msgid "buffer too small for requested bytes" msgstr "" -#: shared-bindings/adafruit_pixelbuf/PixelBuf.c -msgid "byteorder is not a string" -msgstr "" - #: py/objarray.c msgid "bytes length not a multiple of item size" msgstr "" @@ -2610,14 +2651,10 @@ msgstr "impossibile assegnare all'espressione" msgid "can't cancel self" msgstr "" -#: py/obj.c py/objint.c shared-module/adafruit_pixelbuf/PixelBuf.c +#: py/obj.c py/objint.c py/runtime.c shared-module/adafruit_pixelbuf/PixelBuf.c msgid "can't convert %q to %q" msgstr "" -#: py/runtime.c -msgid "can't convert %q to int" -msgstr "" - #: py/obj.c #, fuzzy, c-format msgid "can't convert %s to complex" @@ -2699,6 +2736,10 @@ msgstr "" msgid "can't set attribute" msgstr "impossibile impostare attributo" +#: py/runtime.c +msgid "can't set attribute '%q'" +msgstr "" + #: py/emitnative.c msgid "can't store '%q'" msgstr "impossibile memorizzare '%q'" @@ -2803,10 +2844,6 @@ msgstr "il colore deve essere compreso tra 0x000000 e 0xffffff" msgid "comparison of int and uint" msgstr "" -#: py/objcomplex.c -msgid "complex division by zero" -msgstr "complex divisione per zero" - #: py/objfloat.c py/parsenum.c msgid "complex values not supported" msgstr "valori complessi non supportai" @@ -2912,12 +2949,11 @@ msgstr "" msgid "div/mod not implemented for uint" msgstr "" -#: py/objfloat.c py/objint_mpz.c +#: extmod/ulab/code/numpy/create.c msgid "divide by zero" msgstr "" -#: py/modmath.c py/objint_longlong.c py/runtime.c -#: shared-bindings/math/__init__.c +#: py/runtime.c msgid "division by zero" msgstr "divisione per zero" @@ -2958,9 +2994,9 @@ msgstr "" msgid "error = 0x%08lX" msgstr "errore = 0x%08lX" -#: ports/espressif/common-hal/esp32_camera/Camera.c +#: ports/espressif/common-hal/espcamera/Camera.c msgid "" -"esp32_camera.Camera requires reserved PSRAM to be configured. See the " +"espcamera.Camera requires reserved PSRAM to be configured. See the " "documentation for instructions." msgstr "" @@ -2968,14 +3004,6 @@ msgstr "" msgid "exceptions must derive from BaseException" msgstr "le eccezioni devono derivare da BaseException" -#: shared-bindings/canio/CAN.c -msgid "expected '%q' but got '%q'" -msgstr "" - -#: shared-bindings/canio/CAN.c -msgid "expected '%q' or '%q' but got '%q'" -msgstr "" - #: py/objstr.c msgid "expected ':' after format specifier" msgstr "':' atteso dopo lo specificatore di formato" @@ -3074,10 +3102,6 @@ msgstr "il font deve essere lungo 2048 byte" msgid "format requires a dict" msgstr "la formattazione richiede un dict" -#: shared-bindings/microcontroller/Processor.c -msgid "frequency is read-only for this board" -msgstr "" - #: py/objdeque.c msgid "full" msgstr "pieno" @@ -3191,8 +3215,12 @@ msgstr "padding incorretto" msgid "index is out of bounds" msgstr "" +#: shared-bindings/_pixelmap/PixelMap.c +msgid "index must be tuple or int" +msgstr "" + #: extmod/ulab/code/numpy/numerical.c extmod/ulab/code/ulab_tools.c -#: ports/espressif/common-hal/pulseio/PulseIn.c py/obj.c +#: ports/espressif/common-hal/pulseio/PulseIn.c #: shared-bindings/bitmaptools/__init__.c msgid "index out of range" msgstr "indice fuori intervallo" @@ -3290,10 +3318,6 @@ msgstr "" msgid "inputs are not iterable" msgstr "" -#: py/parsenum.c -msgid "int() arg 2 must be >= 2 and <= 36" -msgstr "il secondo argomanto di int() deve essere >= 2 e <= 36" - #: extmod/ulab/code/numpy/approx.c msgid "interp is defined for 1D iterables of equal length" msgstr "" @@ -3350,7 +3374,7 @@ msgstr "chiave non valida" msgid "invalid micropython decorator" msgstr "decoratore non valido in micropython" -#: ports/espressif/common-hal/esp32_camera/Camera.c +#: ports/espressif/common-hal/espcamera/Camera.c msgid "invalid setting" msgstr "" @@ -3375,10 +3399,6 @@ msgstr "sintassi invalida per l'intero con base %d" msgid "invalid syntax for number" msgstr "sintassi invalida per il numero" -#: py/objexcept.c -msgid "invalid traceback" -msgstr "" - #: py/objtype.c msgid "issubclass() arg 1 must be a class" msgstr "il primo argomento di issubclass() deve essere una classe" @@ -3440,19 +3460,17 @@ msgstr "locla '%q' utilizzato prima che il tipo fosse noto" msgid "local variable referenced before assignment" msgstr "variabile locale richiamata prima di un assegnamento" -#: py/objint.c -msgid "long int not supported in this build" -msgstr "long int non supportata in questa build" - #: ports/espressif/common-hal/canio/CAN.c msgid "loopback + silent mode not supported by peripheral" msgstr "" #: ports/espressif/common-hal/mdns/Server.c +#: ports/raspberrypi/common-hal/mdns/Server.c msgid "mDNS already initialized" msgstr "" #: ports/espressif/common-hal/mdns/Server.c +#: ports/raspberrypi/common-hal/mdns/Server.c msgid "mDNS only works with built-in WiFi" msgstr "" @@ -3581,6 +3599,10 @@ msgstr "potenza negativa senza supporto per float" msgid "negative shift count" msgstr "" +#: shared-bindings/_pixelmap/PixelMap.c +msgid "nested index must be int" +msgstr "" + #: shared-module/sdcardio/SDCard.c msgid "no SD card" msgstr "" @@ -3614,7 +3636,7 @@ msgstr "" msgid "no response from SD card" msgstr "" -#: ports/espressif/common-hal/esp32_camera/Camera.c py/objobject.c py/runtime.c +#: ports/espressif/common-hal/espcamera/Camera.c py/objobject.c py/runtime.c msgid "no such attribute" msgstr "attributo inesistente" @@ -3753,6 +3775,10 @@ msgstr "" msgid "only mono is supported" msgstr "" +#: extmod/ulab/code/numpy/create.c +msgid "only ndarrays can be concatenated" +msgstr "" + #: ports/stm/common-hal/audiobusio/PDMIn.c msgid "only oversample=64 is supported" msgstr "" @@ -3763,7 +3789,7 @@ msgid "only sample_rate=16000 is supported" msgstr "" #: py/objarray.c py/objstr.c py/objstrunicode.c py/objtuple.c -#: shared-bindings/alarm/SleepMemory.c shared-bindings/coproc/CoprocMemory.c +#: shared-bindings/alarm/SleepMemory.c shared-bindings/memorymap/AddressRange.c #: shared-bindings/nvm/ByteArray.c msgid "only slices with step=1 (aka None) are supported" msgstr "solo slice con step=1 (aka None) sono supportate" @@ -3982,10 +4008,6 @@ msgstr "la lunghezza di sleed deve essere non negativa" msgid "slice step can't be zero" msgstr "" -#: py/objslice.c -msgid "slice step cannot be zero" -msgstr "la step della slice non può essere zero" - #: py/nativeglue.c msgid "slice unsupported" msgstr "" @@ -4034,10 +4056,6 @@ msgstr "" msgid "start/end indices" msgstr "" -#: shared-bindings/random/__init__.c -msgid "step must be non-zero" -msgstr "step deve essere non zero" - #: shared-bindings/random/__init__.c msgid "stop not reachable from start" msgstr "stop non raggiungibile dall'inizio" @@ -4046,10 +4064,6 @@ msgstr "stop non raggiungibile dall'inizio" msgid "stream operation not supported" msgstr "operazione di stream non supportata" -#: py/objstrunicode.c -msgid "string indices must be integers, not %q" -msgstr "" - #: py/stream.c msgid "string not supported; use bytes or bytearray" msgstr "" @@ -4082,10 +4096,6 @@ msgstr "errore di sintassi nel JSON" msgid "syntax error in uctypes descriptor" msgstr "errore di sintassi nel descrittore uctypes" -#: shared-bindings/time/__init__.c -msgid "time.struct_time() takes a 9-sequence" -msgstr "" - #: ports/atmel-samd/common-hal/watchdog/WatchDogTimer.c #: ports/espressif/common-hal/watchdog/WatchDogTimer.c #: ports/nrf/common-hal/watchdog/WatchDogTimer.c @@ -4369,10 +4379,6 @@ msgstr "" msgid "y value out of bounds" msgstr "indirizzo fuori limite" -#: py/objrange.c -msgid "zero step" -msgstr "zero step" - #: extmod/ulab/code/scipy/signal/signal.c msgid "zi must be an ndarray" msgstr "" @@ -4385,6 +4391,46 @@ msgstr "" msgid "zi must be of shape (n_section, 2)" msgstr "" +#~ msgid "" +#~ "\n" +#~ "Please file an issue with the contents of your CIRCUITPY drive at \n" +#~ "https://github.com/adafruit/circuitpython/issues\n" +#~ msgstr "" +#~ "\n" +#~ "Per favore, segnala il problema con il contenuto del tuo CIRCUITPY a\n" +#~ "https://github.com/adafruit/circuitpython/issues\n" + +#~ msgid "Expected a %q" +#~ msgstr "Atteso un %q" + +#, fuzzy +#~ msgid "Read-only object" +#~ msgstr "Sola lettura" + +#~ msgid "At most %d %q may be specified (not %d)" +#~ msgstr "Almeno %d %q devono essere specificati (non %d)" + +#~ msgid "Invalid pins" +#~ msgstr "Pin non validi" + +#~ msgid "complex division by zero" +#~ msgstr "complex divisione per zero" + +#~ msgid "int() arg 2 must be >= 2 and <= 36" +#~ msgstr "il secondo argomanto di int() deve essere >= 2 e <= 36" + +#~ msgid "long int not supported in this build" +#~ msgstr "long int non supportata in questa build" + +#~ msgid "slice step cannot be zero" +#~ msgstr "la step della slice non può essere zero" + +#~ msgid "step must be non-zero" +#~ msgstr "step deve essere non zero" + +#~ msgid "zero step" +#~ msgstr "zero step" + #~ msgid "%q indices must be integers, not %s" #~ msgstr "gli indici %q devono essere interi, non %s" diff --git a/locale/ja.po b/locale/ja.po index f0755961cf..dca26f752b 100644 --- a/locale/ja.po +++ b/locale/ja.po @@ -8,37 +8,50 @@ 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-08-24 06:48+0000\n" -"Last-Translator: Jeff Epler \n" +"PO-Revision-Date: 2023-01-05 02:52+0000\n" +"Last-Translator: Matt Watson \n" "Language-Team: none\n" "Language: ja\n" "MIME-Version: 1.0\n" "Content-Type: text/plain; charset=UTF-8\n" "Content-Transfer-Encoding: 8bit\n" "Plural-Forms: nplurals=1; plural=0;\n" -"X-Generator: Weblate 4.8.1-dev\n" +"X-Generator: Weblate 4.15.1-dev\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 "" "\n" -"Please file an issue with the contents of your CIRCUITPY drive at \n" -"https://github.com/adafruit/circuitpython/issues\n" +"Please file an issue with your program at https://github.com/adafruit/" +"circuitpython/issues." msgstr "" + +#: supervisor/shared/safe_mode.c +msgid "" "\n" -"CIRCUITPYドライブの内容を添えて問題を以下で報告してください:\n" -"https://github.com/adafruit/circuitpython/issues\n" +"Press reset to exit safe mode.\n" +msgstr "" + +#: supervisor/shared/safe_mode.c +msgid "" +"\n" +"You are in safe mode because:\n" +msgstr "" #: py/obj.c msgid " File \"%q\"" @@ -54,7 +67,7 @@ msgstr "" #: main.c msgid " not found.\n" -msgstr "" +msgstr " 見るからない\n" #: main.c msgid " output:\n" @@ -66,15 +79,20 @@ msgid "%%c requires int or char" msgstr "%%c にはintまたはcharが必要" #: main.c -#, c-format +#, fuzzy, c-format msgid "%02X" +msgstr "%02X" + +#: shared-module/os/getenv.c +#, c-format +msgid "%S" 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 "" +msgstr "%dアドレスピン、%dRGBピン、%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 @@ -85,9 +103,10 @@ msgstr "" #: 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 +#: ports/stm/common-hal/canio/Listener.c ports/stm/common-hal/rtc/RTC.c +#, fuzzy msgid "%q" -msgstr "" +msgstr "%q" #: shared-bindings/microcontroller/Pin.c msgid "%q and %q contain duplicate pins" @@ -95,7 +114,7 @@ msgstr "" #: ports/atmel-samd/common-hal/audioio/AudioOut.c msgid "%q and %q must be different" -msgstr "" +msgstr "%qと%qが必ず異なるのは必要" #: shared-bindings/microcontroller/Pin.c msgid "%q contains duplicate pins" @@ -105,25 +124,34 @@ msgstr "" msgid "%q failure: %d" msgstr "%q 失敗: %d" +#: py/argcheck.c +msgid "%q in %q must be of type %q, not %q" +msgstr "" + +#: ports/espressif/common-hal/espulp/ULP.c #: ports/raspberrypi/common-hal/rp2pio/StateMachine.c #: shared-bindings/digitalio/DigitalInOut.c #: shared-bindings/microcontroller/Pin.c msgid "%q in use" msgstr "%qは使用中" -#: py/obj.c py/objstr.c py/objstrunicode.c +#: py/objstr.c py/objstrunicode.c msgid "%q index out of range" msgstr "%q インデックスは範囲外" #: shared-module/bitbangio/SPI.c msgid "%q init failed" -msgstr "" +msgstr "%qは初期化には失敗" #: shared-bindings/dualbank/__init__.c msgid "%q is %q" -msgstr "" +msgstr "%qは%q" -#: py/argcheck.c +#: ports/raspberrypi/common-hal/wifi/Radio.c +msgid "%q is read-only for this board" +msgstr "このボードでは%qが読み取り専用" + +#: py/argcheck.c shared-bindings/usb_hid/Device.c msgid "%q length must be %d" msgstr "" @@ -139,10 +167,6 @@ msgstr "" 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 "" @@ -164,24 +188,20 @@ msgid "%q must be >= %d" msgstr "" #: shared-bindings/analogbufio/BufferedIn.c +msgid "%q must be a bytearray or array of type 'H' or 'B'" +msgstr "" + #: 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" +#: ports/raspberrypi/bindings/cyw43/__init__.c py/argcheck.c py/objexcept.c +#: shared-bindings/canio/CAN.c shared-bindings/digitalio/Pull.c +msgid "%q must be of type %q or %q, not %q" msgstr "" -#: py/argcheck.c -msgid "%q must be an int" -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" +#: py/argcheck.c py/obj.c py/objstrunicode.c +msgid "%q must be of type %q, not %q" msgstr "" #: ports/atmel-samd/common-hal/busio/UART.c @@ -194,7 +214,6 @@ msgstr "" #: ports/atmel-samd/common-hal/pulseio/PulseIn.c #: ports/cxd56/common-hal/pulseio/PulseIn.c -#: ports/espressif/common-hal/coproc/Coproc.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 @@ -206,8 +225,8 @@ msgstr "%q が範囲外" msgid "%q pin invalid" msgstr "%q ピンは無効" -#: shared-bindings/usb_hid/Device.c -msgid "%q with a report ID of 0 must be of length 1" +#: py/objrange.c py/objslice.c shared-bindings/random/__init__.c +msgid "%q step cannot be zero" msgstr "" #: py/bc.c py/objnamedtuple.c @@ -307,7 +326,7 @@ msgstr "" msgid "'%s' object doesn't support item deletion" msgstr "" -#: ports/raspberrypi/common-hal/wifi/Radio.c py/runtime.c +#: py/runtime.c msgid "'%s' object has no attribute '%q'" msgstr "" @@ -407,6 +426,10 @@ msgstr "" msgid "Address must be %d bytes long" msgstr "アドレスは、%dバイト長でなければなりません" +#: ports/espressif/common-hal/memorymap/AddressRange.c +msgid "Address range not allowed" +msgstr "" + #: ports/espressif/common-hal/canio/CAN.c msgid "All CAN peripherals are in use" msgstr "全てのCAN周辺機器が使用中" @@ -434,7 +457,6 @@ msgid "All SPI peripherals are in use" 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 "全てのUART周辺機器が使用中" @@ -487,7 +509,7 @@ msgstr "すでにアドバータイズ中" msgid "Already have all-matches listener" msgstr "" -#: ports/espressif/common-hal/coproc/__init__.c +#: ports/espressif/common-hal/espulp/ULP.c #: shared-module/memorymonitor/AllocationAlarm.c #: shared-module/memorymonitor/AllocationSize.c msgid "Already running" @@ -498,6 +520,11 @@ msgstr "すでに実行中" msgid "Already scanning for wifi networks" msgstr "" +#: shared-module/os/getenv.c +#, c-format +msgid "An error occurred while retrieving '%s':\n" +msgstr "" + #: ports/stm/common-hal/audiopwmio/PWMAudioOut.c msgid "Another PWMAudioOut is already active" msgstr "" @@ -511,24 +538,16 @@ msgstr "他のsendがすでにアクティブ" msgid "Array must contain halfwords (type 'H')" msgstr "array のタイプは16ビット ('H') でなければなりません" -#: shared-bindings/alarm/SleepMemory.c shared-bindings/coproc/CoprocMemory.c +#: shared-bindings/alarm/SleepMemory.c shared-bindings/memorymap/AddressRange.c #: shared-bindings/nvm/ByteArray.c msgid "Array values should be single bytes." msgstr "Arrayの各値は1バイトでなければなりません" -#: shared-bindings/microcontroller/Pin.c -msgid "At most %d %q may be specified (not %d)" -msgstr "最大で %d個の %q が指定できます(%d個でなく)" - #: shared-module/memorymonitor/AllocationAlarm.c #, c-format msgid "Attempt to allocate %d blocks" msgstr "%d個のブロックの確保を試みました" -#: supervisor/shared/safe_mode.c -msgid "Attempted heap allocation when VM not running." -msgstr "" - #: ports/raspberrypi/audio_dma.c msgid "Audio conversion not implemented" msgstr "" @@ -579,20 +598,13 @@ msgid "Bitmap size and bits per value must match" msgstr "" #: supervisor/shared/safe_mode.c -msgid "Boot device must be first device (interface #0)." +msgid "Boot device must be first (interface #0)." msgstr "" #: ports/mimxrt10xx/common-hal/busio/UART.c msgid "Both RX and TX required for flow control" msgstr "フロー制御のためRXとTXの両方が必要" -#: ports/atmel-samd/boards/circuitplayground_express/mpconfigboard.h -#: ports/atmel-samd/boards/circuitplayground_express_crickit/mpconfigboard.h -#: ports/atmel-samd/boards/circuitplayground_express_displayio/mpconfigboard.h -#: ports/atmel-samd/boards/meowmeow/mpconfigboard.h -msgid "Both buttons were pressed at start up.\n" -msgstr "" - #: ports/atmel-samd/common-hal/rotaryio/IncrementalEncoder.c msgid "Both pins must support hardware interrupts" msgstr "両方のピンにハードウェア割り込み対応が必要" @@ -658,11 +670,6 @@ msgstr "" msgid "Bus pin %d is already in use" msgstr "Busピン%dはすでに使用中" -#: ports/espressif/boards/m5stack_core_basic/mpconfigboard.h -#: ports/espressif/boards/m5stack_core_fire/mpconfigboard.h -msgid "Button A was pressed at start up.\n" -msgstr "" - #: shared-bindings/_bleio/UUID.c msgid "Byte buffer must be 16 bytes." msgstr "バッファは16バイトでなければなりません" @@ -795,10 +802,6 @@ msgstr "" msgid "CircuitPython core code crashed hard. Whoops!\n" msgstr "CircuitPythonのコアコードが激しくクラッシュしました。おっと!\n" -#: supervisor/shared/safe_mode.c -msgid "CircuitPython was unable to allocate the heap." -msgstr "CircuitPythonはヒープを確保できませんでした" - #: shared-module/bitbangio/I2C.c msgid "Clock stretch too long" msgstr "クロックのストレッチが長すぎ" @@ -837,10 +840,6 @@ msgstr "割り込みをスタートできません。RXビジー" msgid "Couldn't allocate decoder" msgstr "デコーダを確保できません" -#: supervisor/shared/safe_mode.c -msgid "Crash into the HardFault_Handler." -msgstr "クラッシュしてHardFault_Handlerに入りました" - #: ports/stm/common-hal/analogio/AnalogOut.c msgid "DAC Channel Init Error" msgstr "DACチャネル初期化エラー" @@ -903,6 +902,10 @@ msgstr "" msgid "Drive mode not used when direction is input." msgstr "方向がinputのときドライブモードは使われません" +#: py/obj.c +msgid "During handling of the above exception, another exception occurred:" +msgstr "" + #: shared-bindings/aesio/aes.c msgid "ECB only operates on 16 bytes at a time" msgstr "ECBは一度に16バイトの演算のみを行います" @@ -928,24 +931,16 @@ msgstr "" msgid "Error in regex" msgstr "正規表現にエラーがあります" +#: supervisor/shared/safe_mode.c +msgid "Error in safemode.py." +msgstr "" + #: shared-bindings/socketpool/Socket.c shared-bindings/ssl/SSLSocket.c msgid "Error: Failure to bind" msgstr "" -#: py/enum.c shared-bindings/_bleio/__init__.c shared-bindings/aesio/aes.c -#: shared-bindings/alarm/__init__.c shared-bindings/alarm/coproc/CoprocAlarm.c -#: shared-bindings/busio/SPI.c shared-bindings/coproc/Coproc.c -#: shared-bindings/coproc/__init__.c shared-bindings/microcontroller/Pin.c -#: shared-bindings/neopixel_write/__init__.c -msgid "Expected a %q" -msgstr "%qが必要" - -#: ports/raspberrypi/bindings/cyw43/__init__.c -msgid "Expected a %q or %q" -msgstr "" - #: shared-bindings/alarm/__init__.c -msgid "Expected an %q" +msgid "Expected a kind of %q" msgstr "" #: ports/espressif/common-hal/_bleio/Adapter.c @@ -1013,13 +1008,17 @@ msgid "Failed to write internal flash." msgstr "内部フラッシュ書き込みに失敗" #: supervisor/shared/safe_mode.c -msgid "Fatal error." +msgid "Fault detected by hardware." msgstr "" #: py/moduerrno.c msgid "File exists" msgstr "ファイルが存在します" +#: shared-module/os/getenv.c +msgid "File not found" +msgstr "" + #: ports/atmel-samd/common-hal/canio/Listener.c #: ports/espressif/common-hal/canio/Listener.c #: ports/stm/common-hal/canio/Listener.c @@ -1034,7 +1033,6 @@ msgstr "" msgid "Firmware is invalid" msgstr "" -#: ports/espressif/common-hal/coproc/Coproc.c #: ports/espressif/common-hal/dualbank/__init__.c msgid "Firmware is too big" msgstr "" @@ -1076,6 +1074,8 @@ msgstr "" #: shared-bindings/displayio/Display.c #: shared-bindings/displayio/EPaperDisplay.c #: shared-bindings/framebufferio/FramebufferDisplay.c +#: shared-module/displayio/Display.c +#: shared-module/framebufferio/FramebufferDisplay.c msgid "Group already used" msgstr "グループはすでに使われています" @@ -1096,6 +1096,15 @@ msgstr "ハードウェアビジー。代替のピンを試してください" msgid "Hardware in use, try alternative pins" msgstr "ハードウェア使用中。代わりのピンを試してください" +#: supervisor/shared/safe_mode.c +msgid "Heap allocation when VM not running." +msgstr "" + +#: supervisor/shared/safe_mode.c +msgid "" +"Heap was corrupted because the stack was too small. Increase stack size." +msgstr "" + #: extmod/vfs_posix_file.c py/objstringio.c msgid "I/O operation on closed file" msgstr "閉じられたファイルへのI/O操作" @@ -1113,11 +1122,6 @@ msgstr "" msgid "I2SOut not available" msgstr "I2SOutが利用できません" -#: shared-bindings/aesio/aes.c -#, c-format -msgid "IV must be %d bytes long" -msgstr "IVは%dバイト長でなければなりません" - #: ports/raspberrypi/bindings/rp2pio/StateMachine.c msgid "In-buffer elements must be <= 4 bytes long" msgstr "" @@ -1204,6 +1208,7 @@ msgid "Internal define error" msgstr "内部定義エラー" #: ports/espressif/common-hal/paralleldisplay/ParallelBus.c +#: shared-module/os/getenv.c msgid "Internal error" msgstr "" @@ -1216,6 +1221,10 @@ msgstr "内部エラー #%d" msgid "Internal watchdog timer expired." msgstr "" +#: supervisor/shared/safe_mode.c +msgid "Interrupt error." +msgstr "" + #: py/argcheck.c shared-bindings/digitalio/DigitalInOut.c msgid "Invalid %q" msgstr "不正な %q" @@ -1250,6 +1259,11 @@ msgstr "不正な引数" msgid "Invalid bits per value" msgstr "不正なbits per value" +#: shared-module/os/getenv.c +#, c-format +msgid "Invalid byte %.*s" +msgstr "" + #: ports/atmel-samd/common-hal/imagecapture/ParallelImageCapture.c #, c-format msgid "Invalid data_pins[%d]" @@ -1259,18 +1273,10 @@ msgstr "" msgid "Invalid format chunk size" msgstr "フォーマットチャンクのサイズが不正" -#: supervisor/shared/safe_mode.c -msgid "Invalid memory access." -msgstr "不正なメモリアクセス" - #: ports/espressif/common-hal/wifi/Radio.c msgid "Invalid multicast MAC address" msgstr "" -#: shared-bindings/busio/UART.c -msgid "Invalid pins" -msgstr "ピンが不正" - #: ports/espressif/common-hal/espidf/__init__.c ports/espressif/esp_error.c msgid "Invalid size" msgstr "" @@ -1284,10 +1290,18 @@ msgstr "" msgid "Invalid state" msgstr "" +#: shared-module/os/getenv.c +msgid "Invalid unicode escape" +msgstr "" + #: shared-bindings/aesio/aes.c msgid "Key must be 16, 24, or 32 bytes long" msgstr "Keyの長さは、16, 24, 32バイトのいずれかでなければなりません" +#: shared-module/os/getenv.c +msgid "Key not found" +msgstr "" + #: shared-module/is31fl3741/FrameBuffer.c msgid "LED mappings must match display size" msgstr "" @@ -1394,6 +1408,10 @@ msgstr "" msgid "NVS Error" msgstr "" +#: shared-bindings/socketpool/SocketPool.c +msgid "Name or service not known" +msgstr "" + #: py/qstr.c msgid "Name too long" msgstr "名前が長すぎます" @@ -1508,11 +1526,6 @@ msgstr "キーが指定されていません" msgid "No long integer support" msgstr "long integerに対応していません" -#: shared-module/usb_hid/__init__.c -#, c-format -msgid "No more than %d HID devices allowed" -msgstr "" - #: shared-bindings/wifi/Radio.c msgid "No network with that ssid" msgstr "" @@ -1548,10 +1561,6 @@ msgstr "指定されたファイル/ディレクトリはありません" msgid "No timer available" msgstr "利用できるタイマーなし" -#: supervisor/shared/safe_mode.c -msgid "Nordic system firmware failure assertion." -msgstr "" - #: ports/nrf/common-hal/_bleio/__init__.c msgid "Nordic system firmware out of memory" msgstr "" @@ -1571,10 +1580,6 @@ msgstr "接続されていません" msgid "Not playing" msgstr "再生していません" -#: shared-bindings/_bleio/__init__.c -msgid "Not settable" -msgstr "" - #: ports/espressif/common-hal/paralleldisplay/ParallelBus.c #, c-format msgid "Number of data_pins must be 8 or 16, not %d" @@ -1639,11 +1644,14 @@ msgid "" "%d bpp given" msgstr "" -#: ports/espressif/common-hal/alarm/coproc/CoprocAlarm.c #: ports/espressif/common-hal/alarm/touch/TouchAlarm.c msgid "Only one %q can be set in deep sleep." msgstr "" +#: ports/espressif/common-hal/espulp/ULPAlarm.c +msgid "Only one %q can be set." +msgstr "" + #: ports/espressif/common-hal/i2ctarget/I2CTarget.c #: ports/raspberrypi/common-hal/i2ctarget/I2CTarget.c msgid "Only one address is allowed" @@ -1676,6 +1684,10 @@ msgstr "" msgid "Operation timed out" msgstr "" +#: ports/raspberrypi/common-hal/mdns/Server.c +msgid "Out of MDNS service slots" +msgstr "" + #: ports/espressif/common-hal/espidf/__init__.c ports/espressif/esp_error.c msgid "Out of memory" msgstr "" @@ -1782,6 +1794,7 @@ msgstr "Prefixバッファはヒープ上になければなりません" #: main.c msgid "Press any key to enter the REPL. Use CTRL-D to reload.\n" msgstr "" +"REPLに入るため、エンターキーを押す。リーロードするため、Ctl-Dを入力する。\n" #: main.c msgid "Pretending to deep sleep until alarm, CTRL-C or file write.\n" @@ -1799,6 +1812,10 @@ msgstr "" msgid "Program size invalid" msgstr "" +#: ports/espressif/common-hal/espulp/ULP.c +msgid "Program too long" +msgstr "" + #: shared-bindings/digitalio/DigitalInOut.c msgid "Pull not used when direction is output." msgstr "方向がoutputのときpullは使われません" @@ -1838,8 +1855,9 @@ msgstr "このボードはRTCに対応していません" msgid "Random number generation error" msgstr "乱数生成エラー" +#: shared-bindings/_bleio/__init__.c #: shared-bindings/memorymonitor/AllocationSize.c -#: shared-bindings/pulseio/PulseIn.c +#: shared-bindings/pulseio/PulseIn.c shared-module/displayio/Bitmap.c msgid "Read-only" msgstr "読み込み専用" @@ -1847,10 +1865,6 @@ msgstr "読み込み専用" msgid "Read-only filesystem" msgstr "読み込み専用のファイルシステム" -#: shared-module/displayio/Bitmap.c -msgid "Read-only object" -msgstr "読み込み専用のオブジェクト" - #: ports/espressif/common-hal/espidf/__init__.c ports/espressif/esp_error.c msgid "Received response was invalid" msgstr "" @@ -1943,7 +1957,7 @@ msgstr "サイズは対応していません" msgid "Sleep Memory not available" msgstr "" -#: shared-bindings/alarm/SleepMemory.c shared-bindings/coproc/CoprocMemory.c +#: shared-bindings/alarm/SleepMemory.c shared-bindings/memorymap/AddressRange.c #: shared-bindings/nvm/ByteArray.c msgid "Slice and value different lengths." msgstr "スライスと値の長さが一致しません" @@ -1980,6 +1994,10 @@ msgstr "" msgid "Stereo right must be on PWM channel B" msgstr "" +#: ports/raspberrypi/common-hal/wifi/Radio.c +msgid "Stopping AP is not supported." +msgstr "" + #: ports/mimxrt10xx/common-hal/busio/UART.c ports/stm/common-hal/busio/UART.c msgid "Supply at least one UART pin" msgstr "少なくとも1つのUARTピンが必要" @@ -1997,35 +2015,11 @@ msgid "Temperature read timed out" msgstr "温度読み取りがタイムアウトしました" #: supervisor/shared/safe_mode.c -msgid "The BOOT button was pressed at start up.\n" +msgid "The `microcontroller` module was used to boot into safe mode." msgstr "" -#: supervisor/shared/safe_mode.c -msgid "" -"The CircuitPython heap was corrupted because the stack was too small.\n" -"Increase the stack size if you know how. If not:" -msgstr "" - -#: ports/espressif/boards/adafruit_feather_esp32_v2/mpconfigboard.h -msgid "The SW38 button was pressed at start up.\n" -msgstr "" - -#: ports/espressif/boards/hardkernel_odroid_go/mpconfigboard.h -msgid "The VOLUME button was pressed at start up.\n" -msgstr "" - -#: supervisor/shared/safe_mode.c -msgid "" -"The `microcontroller` module was used to boot into safe mode. Press reset to " -"exit safe mode." -msgstr "" - -#: ports/espressif/boards/m5stack_atom_lite/mpconfigboard.h -msgid "The central button was pressed at start up.\n" -msgstr "" - -#: ports/nrf/boards/aramcon2_badge/mpconfigboard.h -msgid "The left button was pressed at start up.\n" +#: py/obj.c +msgid "The above exception was the direct cause of the following exception:" msgstr "" #: shared-bindings/rgbmatrix/RGBMatrix.c @@ -2033,10 +2027,7 @@ msgid "The length of rgb_pins must be 6, 12, 18, 24, or 30" msgstr "" #: supervisor/shared/safe_mode.c -msgid "" -"The microcontroller's power dipped. Make sure your power supply provides\n" -"enough power for the whole circuit and press reset (after ejecting " -"CIRCUITPY)." +msgid "The power dipped. Make sure you are providing enough power." msgstr "" #: shared-module/audiomixer/MixerVoice.c @@ -2055,6 +2046,10 @@ msgstr "サンプルレートがサンプルとミキサーで一致しません msgid "The sample's signedness does not match the mixer's" msgstr "符号の有無がサンプルとミキサーで一致しません" +#: supervisor/shared/safe_mode.c +msgid "Third-party firmware fatal error." +msgstr "" + #: shared-module/imagecapture/ParallelImageCapture.c msgid "This microcontroller does not support continuous capture." msgstr "" @@ -2087,10 +2082,6 @@ msgstr "" msgid "Timeout is too long: Maximum timeout length is %d seconds" msgstr "タイムアウトが長すぎです。最大のタイムアウト長は%d秒" -#: supervisor/shared/safe_mode.c -msgid "To exit, please reset the board without requesting safe mode." -msgstr "" - #: ports/atmel-samd/common-hal/audiobusio/I2SOut.c msgid "Too many channels in sample" msgstr "" @@ -2135,6 +2126,10 @@ msgstr "" msgid "UART init" msgstr "" +#: ports/raspberrypi/common-hal/busio/UART.c +msgid "UART peripheral in use" +msgstr "" + #: ports/stm/common-hal/busio/UART.c msgid "UART re-init" msgstr "" @@ -2183,6 +2178,10 @@ msgstr "UUIDの値がstr, int, bufferのいずれでもありません" msgid "Unable to allocate buffers for signed conversion" msgstr "" +#: supervisor/shared/safe_mode.c +msgid "Unable to allocate the heap." +msgstr "" + #: ports/espressif/common-hal/busio/I2C.c msgid "Unable to create lock" msgstr "" @@ -2206,11 +2205,12 @@ msgid "Unable to read color palette data" msgstr "カラーパレットデータを読み込めません" #: ports/espressif/common-hal/mdns/Server.c +#: ports/raspberrypi/common-hal/mdns/Server.c msgid "Unable to start mDNS query" msgstr "" -#: shared-bindings/coproc/CoprocMemory.c -msgid "Unable to write" +#: shared-bindings/memorymap/AddressRange.c +msgid "Unable to write to address." msgstr "" #: shared-bindings/nvm/ByteArray.c @@ -2281,6 +2281,7 @@ msgid "Unkown error code %d" msgstr "" #: shared-bindings/adafruit_pixelbuf/PixelBuf.c +#: shared-module/_pixelmap/PixelMap.c #, c-format msgid "Unmatched number of items on RHS (expected %d, got %d)." msgstr "右辺の要素数が一致しません (expected %d, got %d)" @@ -2365,6 +2366,18 @@ msgstr "" msgid "Wi-Fi: " msgstr "" +#: ports/raspberrypi/common-hal/wifi/Radio.c +msgid "Wifi is in access point mode." +msgstr "" + +#: ports/raspberrypi/common-hal/wifi/Radio.c +msgid "Wifi is in station mode." +msgstr "" + +#: ports/raspberrypi/common-hal/wifi/Radio.c +msgid "Wifi is not enabled" +msgstr "" + #: main.c msgid "Woken up by alarm.\n" msgstr "" @@ -2374,13 +2387,48 @@ msgstr "" msgid "Writes not supported on Characteristic" msgstr "" -#: supervisor/shared/safe_mode.c -msgid "You are in safe mode because:\n" +#: ports/atmel-samd/boards/circuitplayground_express/mpconfigboard.h +#: ports/atmel-samd/boards/circuitplayground_express_crickit/mpconfigboard.h +#: ports/atmel-samd/boards/circuitplayground_express_displayio/mpconfigboard.h +#: ports/atmel-samd/boards/meowmeow/mpconfigboard.h +msgid "You pressed both buttons at start up." +msgstr "" + +#: ports/espressif/boards/m5stack_core_basic/mpconfigboard.h +#: ports/espressif/boards/m5stack_core_fire/mpconfigboard.h +#: ports/espressif/boards/m5stack_stick_c/mpconfigboard.h +msgid "You pressed button A at start up." msgstr "" #: supervisor/shared/safe_mode.c -msgid "" -"You pressed the reset button during boot. Press again to exit safe mode." +msgid "You pressed the BOOT button at start up" +msgstr "" + +#: ports/espressif/boards/adafruit_feather_esp32_v2/mpconfigboard.h +msgid "You pressed the SW38 button at start up." +msgstr "" + +#: ports/espressif/boards/hardkernel_odroid_go/mpconfigboard.h +msgid "You pressed the VOLUME button at start up." +msgstr "" + +#: ports/espressif/boards/m5stack_atom_echo/mpconfigboard.h +#: ports/espressif/boards/m5stack_atom_lite/mpconfigboard.h +#: ports/espressif/boards/m5stack_atom_matrix/mpconfigboard.h +#: ports/espressif/boards/m5stack_atom_u/mpconfigboard.h +msgid "You pressed the central button at start up." +msgstr "" + +#: ports/nrf/boards/aramcon2_badge/mpconfigboard.h +msgid "You pressed the left button at start up." +msgstr "" + +#: supervisor/shared/safe_mode.c +msgid "You pressed the reset button during boot." +msgstr "" + +#: supervisor/shared/micropython.c +msgid "[truncated due to length]" msgstr "" #: py/objtype.c @@ -2452,8 +2500,12 @@ msgstr "" msgid "array has too many dimensions" msgstr "" +#: extmod/ulab/code/ndarray.c +msgid "array is too big" +msgstr "" + #: py/objarray.c shared-bindings/alarm/SleepMemory.c -#: shared-bindings/coproc/CoprocMemory.c shared-bindings/nvm/ByteArray.c +#: shared-bindings/memorymap/AddressRange.c shared-bindings/nvm/ByteArray.c msgid "array/bytes required on right side" msgstr "右辺にはarray/bytesが必要" @@ -2546,10 +2598,6 @@ msgstr "" msgid "buffer too small for requested bytes" msgstr "" -#: shared-bindings/adafruit_pixelbuf/PixelBuf.c -msgid "byteorder is not a string" -msgstr "byteorderが文字列ではありません" - #: py/objarray.c msgid "bytes length not a multiple of item size" msgstr "" @@ -2591,14 +2639,10 @@ msgstr "式には代入できません" msgid "can't cancel self" msgstr "" -#: py/obj.c py/objint.c shared-module/adafruit_pixelbuf/PixelBuf.c +#: py/obj.c py/objint.c py/runtime.c shared-module/adafruit_pixelbuf/PixelBuf.c msgid "can't convert %q to %q" msgstr "%qを%qに変換できません" -#: py/runtime.c -msgid "can't convert %q to int" -msgstr "" - #: py/obj.c #, c-format msgid "can't convert %s to complex" @@ -2680,6 +2724,10 @@ msgstr "" msgid "can't set attribute" msgstr "" +#: py/runtime.c +msgid "can't set attribute '%q'" +msgstr "" + #: py/emitnative.c msgid "can't store '%q'" msgstr "" @@ -2784,10 +2832,6 @@ msgstr "色は0x000000から0xffffffでなければなりません" msgid "comparison of int and uint" msgstr "" -#: py/objcomplex.c -msgid "complex division by zero" -msgstr "複素数ゼロ除算" - #: py/objfloat.c py/parsenum.c msgid "complex values not supported" msgstr "" @@ -2892,12 +2936,11 @@ msgstr "" msgid "div/mod not implemented for uint" msgstr "" -#: py/objfloat.c py/objint_mpz.c +#: extmod/ulab/code/numpy/create.c msgid "divide by zero" msgstr "" -#: py/modmath.c py/objint_longlong.c py/runtime.c -#: shared-bindings/math/__init__.c +#: py/runtime.c msgid "division by zero" msgstr "ゼロ除算 (division by zero)" @@ -2938,9 +2981,9 @@ msgstr "" msgid "error = 0x%08lX" msgstr "error = 0x1%08lX" -#: ports/espressif/common-hal/esp32_camera/Camera.c +#: ports/espressif/common-hal/espcamera/Camera.c msgid "" -"esp32_camera.Camera requires reserved PSRAM to be configured. See the " +"espcamera.Camera requires reserved PSRAM to be configured. See the " "documentation for instructions." msgstr "" @@ -2948,14 +2991,6 @@ msgstr "" msgid "exceptions must derive from BaseException" msgstr "例外はBaseExceptionから派生していなければなりません" -#: shared-bindings/canio/CAN.c -msgid "expected '%q' but got '%q'" -msgstr "" - -#: shared-bindings/canio/CAN.c -msgid "expected '%q' or '%q' but got '%q'" -msgstr "" - #: py/objstr.c msgid "expected ':' after format specifier" msgstr "書式化指定子の後に':'が必要" @@ -3054,10 +3089,6 @@ msgstr "fontは2048バイト長でなければなりません" msgid "format requires a dict" msgstr "formatにはdictが必要" -#: shared-bindings/microcontroller/Processor.c -msgid "frequency is read-only for this board" -msgstr "" - #: py/objdeque.c msgid "full" msgstr "" @@ -3170,8 +3201,12 @@ msgstr "" msgid "index is out of bounds" msgstr "" +#: shared-bindings/_pixelmap/PixelMap.c +msgid "index must be tuple or int" +msgstr "" + #: extmod/ulab/code/numpy/numerical.c extmod/ulab/code/ulab_tools.c -#: ports/espressif/common-hal/pulseio/PulseIn.c py/obj.c +#: ports/espressif/common-hal/pulseio/PulseIn.c #: shared-bindings/bitmaptools/__init__.c msgid "index out of range" msgstr "インデクスが範囲外" @@ -3270,10 +3305,6 @@ msgstr "" msgid "inputs are not iterable" msgstr "" -#: py/parsenum.c -msgid "int() arg 2 must be >= 2 and <= 36" -msgstr "int()の第2引数は2以上36以下でなければなりません" - #: extmod/ulab/code/numpy/approx.c msgid "interp is defined for 1D iterables of equal length" msgstr "" @@ -3330,7 +3361,7 @@ msgstr "不正な鍵" msgid "invalid micropython decorator" msgstr "不正なmicropythonデコレータ" -#: ports/espressif/common-hal/esp32_camera/Camera.c +#: ports/espressif/common-hal/espcamera/Camera.c msgid "invalid setting" msgstr "" @@ -3355,10 +3386,6 @@ msgstr "" msgid "invalid syntax for number" msgstr "数字として不正な構文" -#: py/objexcept.c -msgid "invalid traceback" -msgstr "" - #: py/objtype.c msgid "issubclass() arg 1 must be a class" msgstr "issubclass()の第1引数はクラスでなければなりません" @@ -3415,19 +3442,17 @@ msgstr "" msgid "local variable referenced before assignment" msgstr "" -#: py/objint.c -msgid "long int not supported in this build" -msgstr "このビルドはlong intに非対応" - #: ports/espressif/common-hal/canio/CAN.c msgid "loopback + silent mode not supported by peripheral" msgstr "" #: ports/espressif/common-hal/mdns/Server.c +#: ports/raspberrypi/common-hal/mdns/Server.c msgid "mDNS already initialized" msgstr "" #: ports/espressif/common-hal/mdns/Server.c +#: ports/raspberrypi/common-hal/mdns/Server.c msgid "mDNS only works with built-in WiFi" msgstr "" @@ -3556,6 +3581,10 @@ msgstr "" msgid "negative shift count" msgstr "シフトカウントが負数" +#: shared-bindings/_pixelmap/PixelMap.c +msgid "nested index must be int" +msgstr "" + #: shared-module/sdcardio/SDCard.c msgid "no SD card" msgstr "SDカードがありません" @@ -3589,7 +3618,7 @@ msgstr "利用可能なリセットピンがありません" msgid "no response from SD card" msgstr "SDカードからの応答がありません" -#: ports/espressif/common-hal/esp32_camera/Camera.c py/objobject.c py/runtime.c +#: ports/espressif/common-hal/espcamera/Camera.c py/objobject.c py/runtime.c msgid "no such attribute" msgstr "指定の属性はありません" @@ -3725,6 +3754,10 @@ msgstr "bit_depth=16のみ対応しています" msgid "only mono is supported" msgstr "" +#: extmod/ulab/code/numpy/create.c +msgid "only ndarrays can be concatenated" +msgstr "" + #: ports/stm/common-hal/audiobusio/PDMIn.c msgid "only oversample=64 is supported" msgstr "" @@ -3735,7 +3768,7 @@ msgid "only sample_rate=16000 is supported" msgstr "" #: py/objarray.c py/objstr.c py/objstrunicode.c py/objtuple.c -#: shared-bindings/alarm/SleepMemory.c shared-bindings/coproc/CoprocMemory.c +#: shared-bindings/alarm/SleepMemory.c shared-bindings/memorymap/AddressRange.c #: shared-bindings/nvm/ByteArray.c msgid "only slices with step=1 (aka None) are supported" msgstr "" @@ -3953,10 +3986,6 @@ msgstr "sleepの長さは非負数でなければなりません" msgid "slice step can't be zero" msgstr "スライスのステップは0にできません" -#: py/objslice.c -msgid "slice step cannot be zero" -msgstr "" - #: py/nativeglue.c msgid "slice unsupported" msgstr "" @@ -4005,10 +4034,6 @@ msgstr "" msgid "start/end indices" msgstr "" -#: shared-bindings/random/__init__.c -msgid "step must be non-zero" -msgstr "stepは非ゼロ値でなければなりません" - #: shared-bindings/random/__init__.c msgid "stop not reachable from start" msgstr "" @@ -4017,10 +4042,6 @@ msgstr "" msgid "stream operation not supported" msgstr "ストリーム操作は非対応" -#: py/objstrunicode.c -msgid "string indices must be integers, not %q" -msgstr "文字列のインデクスは整数でなければなりません (%qでなく)" - #: py/stream.c msgid "string not supported; use bytes or bytearray" msgstr "文字列ではなくbytesまたはbytesarrayが必要" @@ -4053,10 +4074,6 @@ msgstr "JSONに構文エラーがあります" msgid "syntax error in uctypes descriptor" msgstr "uctypedディスクリプタの構文エラー" -#: shared-bindings/time/__init__.c -msgid "time.struct_time() takes a 9-sequence" -msgstr "time.struct_time()は9要素のシーケンスを受け取ります" - #: ports/atmel-samd/common-hal/watchdog/WatchDogTimer.c #: ports/espressif/common-hal/watchdog/WatchDogTimer.c #: ports/nrf/common-hal/watchdog/WatchDogTimer.c @@ -4338,10 +4355,6 @@ msgstr "" msgid "y value out of bounds" msgstr "yが範囲外" -#: py/objrange.c -msgid "zero step" -msgstr "ステップが0" - #: extmod/ulab/code/scipy/signal/signal.c msgid "zi must be an ndarray" msgstr "ziはndarrayでなければなりません" @@ -4354,6 +4367,64 @@ msgstr "ziはfloat値でなければなりません" msgid "zi must be of shape (n_section, 2)" msgstr "" +#~ msgid "" +#~ "\n" +#~ "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" + +#~ msgid "CircuitPython was unable to allocate the heap." +#~ msgstr "CircuitPythonはヒープを確保できませんでした" + +#~ msgid "Crash into the HardFault_Handler." +#~ msgstr "クラッシュしてHardFault_Handlerに入りました" + +#~ msgid "Invalid memory access." +#~ msgstr "不正なメモリアクセス" + +#~ msgid "Expected a %q" +#~ msgstr "%qが必要" + +#, c-format +#~ msgid "IV must be %d bytes long" +#~ msgstr "IVは%dバイト長でなければなりません" + +#~ msgid "Read-only object" +#~ msgstr "読み込み専用のオブジェクト" + +#~ msgid "At most %d %q may be specified (not %d)" +#~ msgstr "最大で %d個の %q が指定できます(%d個でなく)" + +#~ msgid "Invalid pins" +#~ msgstr "ピンが不正" + +#~ msgid "byteorder is not a string" +#~ msgstr "byteorderが文字列ではありません" + +#~ msgid "complex division by zero" +#~ msgstr "複素数ゼロ除算" + +#~ msgid "int() arg 2 must be >= 2 and <= 36" +#~ msgstr "int()の第2引数は2以上36以下でなければなりません" + +#~ msgid "long int not supported in this build" +#~ msgstr "このビルドはlong intに非対応" + +#~ msgid "step must be non-zero" +#~ msgstr "stepは非ゼロ値でなければなりません" + +#~ msgid "string indices must be integers, not %q" +#~ msgstr "文字列のインデクスは整数でなければなりません (%qでなく)" + +#~ msgid "time.struct_time() takes a 9-sequence" +#~ msgstr "time.struct_time()は9要素のシーケンスを受け取ります" + +#~ msgid "zero step" +#~ msgstr "ステップが0" + #~ msgid "WatchDogTimer.timeout must be greater than 0" #~ msgstr "WatchDogTimer.timeoutは0以上でなければなりません" diff --git a/locale/ko.po b/locale/ko.po index 4ec7ff804f..c08aa5b714 100644 --- a/locale/ko.po +++ b/locale/ko.po @@ -32,8 +32,20 @@ msgstr "" #: supervisor/shared/safe_mode.c msgid "" "\n" -"Please file an issue with the contents of your CIRCUITPY drive at \n" -"https://github.com/adafruit/circuitpython/issues\n" +"Please file an issue with your program at https://github.com/adafruit/" +"circuitpython/issues." +msgstr "" + +#: supervisor/shared/safe_mode.c +msgid "" +"\n" +"Press reset to exit safe mode.\n" +msgstr "" + +#: supervisor/shared/safe_mode.c +msgid "" +"\n" +"You are in safe mode because:\n" msgstr "" #: py/obj.c @@ -66,6 +78,11 @@ msgstr "%%c 전수(int)또는 캐릭터(char)필요합니다" msgid "%02X" msgstr "" +#: shared-module/os/getenv.c +#, c-format +msgid "%S" +msgstr "" + #: shared-bindings/rgbmatrix/RGBMatrix.c #, c-format msgid "" @@ -81,7 +98,7 @@ msgstr "" #: 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 +#: ports/stm/common-hal/canio/Listener.c ports/stm/common-hal/rtc/RTC.c msgid "%q" msgstr "" @@ -101,13 +118,18 @@ msgstr "" msgid "%q failure: %d" msgstr "" +#: py/argcheck.c +msgid "%q in %q must be of type %q, not %q" +msgstr "" + +#: ports/espressif/common-hal/espulp/ULP.c #: ports/raspberrypi/common-hal/rp2pio/StateMachine.c #: shared-bindings/digitalio/DigitalInOut.c #: shared-bindings/microcontroller/Pin.c msgid "%q in use" msgstr "%q 사용 중입니다" -#: py/obj.c py/objstr.c py/objstrunicode.c +#: py/objstr.c py/objstrunicode.c msgid "%q index out of range" msgstr "%q 인덱스 범위를 벗어났습니다" @@ -119,7 +141,11 @@ msgstr "" msgid "%q is %q" msgstr "" -#: py/argcheck.c +#: ports/raspberrypi/common-hal/wifi/Radio.c +msgid "%q is read-only for this board" +msgstr "" + +#: py/argcheck.c shared-bindings/usb_hid/Device.c msgid "%q length must be %d" msgstr "" @@ -135,10 +161,6 @@ msgstr "" 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 "" @@ -160,24 +182,20 @@ msgid "%q must be >= %d" msgstr "" #: shared-bindings/analogbufio/BufferedIn.c +msgid "%q must be a bytearray or array of type 'H' or 'B'" +msgstr "" + #: 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" +#: ports/raspberrypi/bindings/cyw43/__init__.c py/argcheck.c py/objexcept.c +#: shared-bindings/canio/CAN.c shared-bindings/digitalio/Pull.c +msgid "%q must be of type %q or %q, not %q" msgstr "" -#: py/argcheck.c -msgid "%q must be an int" -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" +#: py/argcheck.c py/obj.c py/objstrunicode.c +msgid "%q must be of type %q, not %q" msgstr "" #: ports/atmel-samd/common-hal/busio/UART.c @@ -190,7 +208,6 @@ msgstr "" #: ports/atmel-samd/common-hal/pulseio/PulseIn.c #: ports/cxd56/common-hal/pulseio/PulseIn.c -#: ports/espressif/common-hal/coproc/Coproc.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 @@ -202,8 +219,8 @@ msgstr "" msgid "%q pin invalid" msgstr "" -#: shared-bindings/usb_hid/Device.c -msgid "%q with a report ID of 0 must be of length 1" +#: py/objrange.c py/objslice.c shared-bindings/random/__init__.c +msgid "%q step cannot be zero" msgstr "" #: py/bc.c py/objnamedtuple.c @@ -303,7 +320,7 @@ msgstr "" msgid "'%s' object doesn't support item deletion" msgstr "" -#: ports/raspberrypi/common-hal/wifi/Radio.c py/runtime.c +#: py/runtime.c msgid "'%s' object has no attribute '%q'" msgstr "" @@ -403,6 +420,10 @@ msgstr "" msgid "Address must be %d bytes long" msgstr "" +#: ports/espressif/common-hal/memorymap/AddressRange.c +msgid "Address range not allowed" +msgstr "" + #: ports/espressif/common-hal/canio/CAN.c msgid "All CAN peripherals are in use" msgstr "" @@ -430,7 +451,6 @@ msgid "All SPI peripherals are in use" 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 "사용중인 모든 UART주변 기기" @@ -483,7 +503,7 @@ msgstr "" msgid "Already have all-matches listener" msgstr "" -#: ports/espressif/common-hal/coproc/__init__.c +#: ports/espressif/common-hal/espulp/ULP.c #: shared-module/memorymonitor/AllocationAlarm.c #: shared-module/memorymonitor/AllocationSize.c msgid "Already running" @@ -494,6 +514,11 @@ msgstr "" msgid "Already scanning for wifi networks" msgstr "" +#: shared-module/os/getenv.c +#, c-format +msgid "An error occurred while retrieving '%s':\n" +msgstr "" + #: ports/stm/common-hal/audiopwmio/PWMAudioOut.c msgid "Another PWMAudioOut is already active" msgstr "" @@ -507,24 +532,16 @@ msgstr "" msgid "Array must contain halfwords (type 'H')" msgstr "" -#: shared-bindings/alarm/SleepMemory.c shared-bindings/coproc/CoprocMemory.c +#: shared-bindings/alarm/SleepMemory.c shared-bindings/memorymap/AddressRange.c #: shared-bindings/nvm/ByteArray.c msgid "Array values should be single bytes." msgstr "" -#: shared-bindings/microcontroller/Pin.c -msgid "At most %d %q may be specified (not %d)" -msgstr "" - #: shared-module/memorymonitor/AllocationAlarm.c #, c-format msgid "Attempt to allocate %d blocks" msgstr "" -#: supervisor/shared/safe_mode.c -msgid "Attempted heap allocation when VM not running." -msgstr "" - #: ports/raspberrypi/audio_dma.c msgid "Audio conversion not implemented" msgstr "" @@ -575,20 +592,13 @@ msgid "Bitmap size and bits per value must match" msgstr "" #: supervisor/shared/safe_mode.c -msgid "Boot device must be first device (interface #0)." +msgid "Boot device must be first (interface #0)." msgstr "" #: ports/mimxrt10xx/common-hal/busio/UART.c msgid "Both RX and TX required for flow control" msgstr "" -#: ports/atmel-samd/boards/circuitplayground_express/mpconfigboard.h -#: ports/atmel-samd/boards/circuitplayground_express_crickit/mpconfigboard.h -#: ports/atmel-samd/boards/circuitplayground_express_displayio/mpconfigboard.h -#: ports/atmel-samd/boards/meowmeow/mpconfigboard.h -msgid "Both buttons were pressed at start up.\n" -msgstr "" - #: ports/atmel-samd/common-hal/rotaryio/IncrementalEncoder.c msgid "Both pins must support hardware interrupts" msgstr "" @@ -654,11 +664,6 @@ msgstr "" msgid "Bus pin %d is already in use" msgstr "" -#: ports/espressif/boards/m5stack_core_basic/mpconfigboard.h -#: ports/espressif/boards/m5stack_core_fire/mpconfigboard.h -msgid "Button A was pressed at start up.\n" -msgstr "" - #: shared-bindings/_bleio/UUID.c msgid "Byte buffer must be 16 bytes." msgstr "잘못된 크기의 버퍼. 16 바이트 여야합니다." @@ -789,10 +794,6 @@ msgstr "" msgid "CircuitPython core code crashed hard. Whoops!\n" msgstr "" -#: supervisor/shared/safe_mode.c -msgid "CircuitPython was unable to allocate the heap." -msgstr "" - #: shared-module/bitbangio/I2C.c msgid "Clock stretch too long" msgstr "" @@ -831,10 +832,6 @@ msgstr "" msgid "Couldn't allocate decoder" msgstr "" -#: supervisor/shared/safe_mode.c -msgid "Crash into the HardFault_Handler." -msgstr "" - #: ports/stm/common-hal/analogio/AnalogOut.c msgid "DAC Channel Init Error" msgstr "" @@ -897,6 +894,10 @@ msgstr "" msgid "Drive mode not used when direction is input." msgstr "" +#: py/obj.c +msgid "During handling of the above exception, another exception occurred:" +msgstr "" + #: shared-bindings/aesio/aes.c msgid "ECB only operates on 16 bytes at a time" msgstr "" @@ -922,24 +923,16 @@ msgstr "" msgid "Error in regex" msgstr "Regex에 오류가 있습니다." +#: supervisor/shared/safe_mode.c +msgid "Error in safemode.py." +msgstr "" + #: shared-bindings/socketpool/Socket.c shared-bindings/ssl/SSLSocket.c msgid "Error: Failure to bind" msgstr "" -#: py/enum.c shared-bindings/_bleio/__init__.c shared-bindings/aesio/aes.c -#: shared-bindings/alarm/__init__.c shared-bindings/alarm/coproc/CoprocAlarm.c -#: shared-bindings/busio/SPI.c shared-bindings/coproc/Coproc.c -#: shared-bindings/coproc/__init__.c shared-bindings/microcontroller/Pin.c -#: shared-bindings/neopixel_write/__init__.c -msgid "Expected a %q" -msgstr "%q 이 예상되었습니다." - -#: ports/raspberrypi/bindings/cyw43/__init__.c -msgid "Expected a %q or %q" -msgstr "" - #: shared-bindings/alarm/__init__.c -msgid "Expected an %q" +msgid "Expected a kind of %q" msgstr "" #: ports/espressif/common-hal/_bleio/Adapter.c @@ -1007,13 +1000,17 @@ msgid "Failed to write internal flash." msgstr "" #: supervisor/shared/safe_mode.c -msgid "Fatal error." +msgid "Fault detected by hardware." msgstr "" #: py/moduerrno.c msgid "File exists" msgstr "" +#: shared-module/os/getenv.c +msgid "File not found" +msgstr "" + #: ports/atmel-samd/common-hal/canio/Listener.c #: ports/espressif/common-hal/canio/Listener.c #: ports/stm/common-hal/canio/Listener.c @@ -1028,7 +1025,6 @@ msgstr "" msgid "Firmware is invalid" msgstr "" -#: ports/espressif/common-hal/coproc/Coproc.c #: ports/espressif/common-hal/dualbank/__init__.c msgid "Firmware is too big" msgstr "" @@ -1070,6 +1066,8 @@ msgstr "" #: shared-bindings/displayio/Display.c #: shared-bindings/displayio/EPaperDisplay.c #: shared-bindings/framebufferio/FramebufferDisplay.c +#: shared-module/displayio/Display.c +#: shared-module/framebufferio/FramebufferDisplay.c msgid "Group already used" msgstr "" @@ -1090,6 +1088,15 @@ msgstr "" msgid "Hardware in use, try alternative pins" msgstr "" +#: supervisor/shared/safe_mode.c +msgid "Heap allocation when VM not running." +msgstr "" + +#: supervisor/shared/safe_mode.c +msgid "" +"Heap was corrupted because the stack was too small. Increase stack size." +msgstr "" + #: extmod/vfs_posix_file.c py/objstringio.c msgid "I/O operation on closed file" msgstr "" @@ -1107,11 +1114,6 @@ msgstr "" msgid "I2SOut not available" msgstr "" -#: shared-bindings/aesio/aes.c -#, c-format -msgid "IV must be %d bytes long" -msgstr "" - #: ports/raspberrypi/bindings/rp2pio/StateMachine.c msgid "In-buffer elements must be <= 4 bytes long" msgstr "" @@ -1196,6 +1198,7 @@ msgid "Internal define error" msgstr "" #: ports/espressif/common-hal/paralleldisplay/ParallelBus.c +#: shared-module/os/getenv.c msgid "Internal error" msgstr "" @@ -1208,6 +1211,10 @@ msgstr "" msgid "Internal watchdog timer expired." msgstr "" +#: supervisor/shared/safe_mode.c +msgid "Interrupt error." +msgstr "" + #: py/argcheck.c shared-bindings/digitalio/DigitalInOut.c msgid "Invalid %q" msgstr "" @@ -1242,6 +1249,11 @@ msgstr "" msgid "Invalid bits per value" msgstr "" +#: shared-module/os/getenv.c +#, c-format +msgid "Invalid byte %.*s" +msgstr "" + #: ports/atmel-samd/common-hal/imagecapture/ParallelImageCapture.c #, c-format msgid "Invalid data_pins[%d]" @@ -1251,18 +1263,10 @@ msgstr "" msgid "Invalid format chunk size" msgstr "형식 청크 크기가 잘못되었습니다" -#: supervisor/shared/safe_mode.c -msgid "Invalid memory access." -msgstr "" - #: ports/espressif/common-hal/wifi/Radio.c msgid "Invalid multicast MAC address" msgstr "" -#: shared-bindings/busio/UART.c -msgid "Invalid pins" -msgstr "핀이 유효하지 않습니다" - #: ports/espressif/common-hal/espidf/__init__.c ports/espressif/esp_error.c msgid "Invalid size" msgstr "" @@ -1276,10 +1280,18 @@ msgstr "" msgid "Invalid state" msgstr "" +#: shared-module/os/getenv.c +msgid "Invalid unicode escape" +msgstr "" + #: shared-bindings/aesio/aes.c msgid "Key must be 16, 24, or 32 bytes long" msgstr "" +#: shared-module/os/getenv.c +msgid "Key not found" +msgstr "" + #: shared-module/is31fl3741/FrameBuffer.c msgid "LED mappings must match display size" msgstr "" @@ -1386,6 +1398,10 @@ msgstr "" msgid "NVS Error" msgstr "" +#: shared-bindings/socketpool/SocketPool.c +msgid "Name or service not known" +msgstr "" + #: py/qstr.c msgid "Name too long" msgstr "" @@ -1500,11 +1516,6 @@ msgstr "" msgid "No long integer support" msgstr "" -#: shared-module/usb_hid/__init__.c -#, c-format -msgid "No more than %d HID devices allowed" -msgstr "" - #: shared-bindings/wifi/Radio.c msgid "No network with that ssid" msgstr "" @@ -1540,10 +1551,6 @@ msgstr "" msgid "No timer available" msgstr "" -#: supervisor/shared/safe_mode.c -msgid "Nordic system firmware failure assertion." -msgstr "" - #: ports/nrf/common-hal/_bleio/__init__.c msgid "Nordic system firmware out of memory" msgstr "" @@ -1563,10 +1570,6 @@ msgstr "" msgid "Not playing" msgstr "" -#: shared-bindings/_bleio/__init__.c -msgid "Not settable" -msgstr "" - #: ports/espressif/common-hal/paralleldisplay/ParallelBus.c #, c-format msgid "Number of data_pins must be 8 or 16, not %d" @@ -1629,11 +1632,14 @@ msgid "" "%d bpp given" msgstr "" -#: ports/espressif/common-hal/alarm/coproc/CoprocAlarm.c #: ports/espressif/common-hal/alarm/touch/TouchAlarm.c msgid "Only one %q can be set in deep sleep." msgstr "" +#: ports/espressif/common-hal/espulp/ULPAlarm.c +msgid "Only one %q can be set." +msgstr "" + #: ports/espressif/common-hal/i2ctarget/I2CTarget.c #: ports/raspberrypi/common-hal/i2ctarget/I2CTarget.c msgid "Only one address is allowed" @@ -1666,6 +1672,10 @@ msgstr "" msgid "Operation timed out" msgstr "" +#: ports/raspberrypi/common-hal/mdns/Server.c +msgid "Out of MDNS service slots" +msgstr "" + #: ports/espressif/common-hal/espidf/__init__.c ports/espressif/esp_error.c msgid "Out of memory" msgstr "" @@ -1789,6 +1799,10 @@ msgstr "" msgid "Program size invalid" msgstr "" +#: ports/espressif/common-hal/espulp/ULP.c +msgid "Program too long" +msgstr "" + #: shared-bindings/digitalio/DigitalInOut.c msgid "Pull not used when direction is output." msgstr "" @@ -1828,8 +1842,9 @@ msgstr "" msgid "Random number generation error" msgstr "" +#: shared-bindings/_bleio/__init__.c #: shared-bindings/memorymonitor/AllocationSize.c -#: shared-bindings/pulseio/PulseIn.c +#: shared-bindings/pulseio/PulseIn.c shared-module/displayio/Bitmap.c msgid "Read-only" msgstr "" @@ -1837,10 +1852,6 @@ msgstr "" msgid "Read-only filesystem" msgstr "" -#: shared-module/displayio/Bitmap.c -msgid "Read-only object" -msgstr "" - #: ports/espressif/common-hal/espidf/__init__.c ports/espressif/esp_error.c msgid "Received response was invalid" msgstr "" @@ -1933,7 +1944,7 @@ msgstr "" msgid "Sleep Memory not available" msgstr "" -#: shared-bindings/alarm/SleepMemory.c shared-bindings/coproc/CoprocMemory.c +#: shared-bindings/alarm/SleepMemory.c shared-bindings/memorymap/AddressRange.c #: shared-bindings/nvm/ByteArray.c msgid "Slice and value different lengths." msgstr "" @@ -1970,6 +1981,10 @@ msgstr "" msgid "Stereo right must be on PWM channel B" msgstr "" +#: ports/raspberrypi/common-hal/wifi/Radio.c +msgid "Stopping AP is not supported." +msgstr "" + #: ports/mimxrt10xx/common-hal/busio/UART.c ports/stm/common-hal/busio/UART.c msgid "Supply at least one UART pin" msgstr "" @@ -1987,35 +2002,11 @@ msgid "Temperature read timed out" msgstr "" #: supervisor/shared/safe_mode.c -msgid "The BOOT button was pressed at start up.\n" +msgid "The `microcontroller` module was used to boot into safe mode." msgstr "" -#: supervisor/shared/safe_mode.c -msgid "" -"The CircuitPython heap was corrupted because the stack was too small.\n" -"Increase the stack size if you know how. If not:" -msgstr "" - -#: ports/espressif/boards/adafruit_feather_esp32_v2/mpconfigboard.h -msgid "The SW38 button was pressed at start up.\n" -msgstr "" - -#: ports/espressif/boards/hardkernel_odroid_go/mpconfigboard.h -msgid "The VOLUME button was pressed at start up.\n" -msgstr "" - -#: supervisor/shared/safe_mode.c -msgid "" -"The `microcontroller` module was used to boot into safe mode. Press reset to " -"exit safe mode." -msgstr "" - -#: ports/espressif/boards/m5stack_atom_lite/mpconfigboard.h -msgid "The central button was pressed at start up.\n" -msgstr "" - -#: ports/nrf/boards/aramcon2_badge/mpconfigboard.h -msgid "The left button was pressed at start up.\n" +#: py/obj.c +msgid "The above exception was the direct cause of the following exception:" msgstr "" #: shared-bindings/rgbmatrix/RGBMatrix.c @@ -2023,10 +2014,7 @@ msgid "The length of rgb_pins must be 6, 12, 18, 24, or 30" msgstr "" #: supervisor/shared/safe_mode.c -msgid "" -"The microcontroller's power dipped. Make sure your power supply provides\n" -"enough power for the whole circuit and press reset (after ejecting " -"CIRCUITPY)." +msgid "The power dipped. Make sure you are providing enough power." msgstr "" #: shared-module/audiomixer/MixerVoice.c @@ -2045,6 +2033,10 @@ msgstr "" msgid "The sample's signedness does not match the mixer's" msgstr "" +#: supervisor/shared/safe_mode.c +msgid "Third-party firmware fatal error." +msgstr "" + #: shared-module/imagecapture/ParallelImageCapture.c msgid "This microcontroller does not support continuous capture." msgstr "" @@ -2077,10 +2069,6 @@ msgstr "" msgid "Timeout is too long: Maximum timeout length is %d seconds" msgstr "" -#: supervisor/shared/safe_mode.c -msgid "To exit, please reset the board without requesting safe mode." -msgstr "" - #: ports/atmel-samd/common-hal/audiobusio/I2SOut.c msgid "Too many channels in sample" msgstr "" @@ -2125,6 +2113,10 @@ msgstr "" msgid "UART init" msgstr "" +#: ports/raspberrypi/common-hal/busio/UART.c +msgid "UART peripheral in use" +msgstr "" + #: ports/stm/common-hal/busio/UART.c msgid "UART re-init" msgstr "" @@ -2173,6 +2165,10 @@ msgstr "" msgid "Unable to allocate buffers for signed conversion" msgstr "" +#: supervisor/shared/safe_mode.c +msgid "Unable to allocate the heap." +msgstr "" + #: ports/espressif/common-hal/busio/I2C.c msgid "Unable to create lock" msgstr "" @@ -2196,11 +2192,12 @@ msgid "Unable to read color palette data" msgstr "" #: ports/espressif/common-hal/mdns/Server.c +#: ports/raspberrypi/common-hal/mdns/Server.c msgid "Unable to start mDNS query" msgstr "" -#: shared-bindings/coproc/CoprocMemory.c -msgid "Unable to write" +#: shared-bindings/memorymap/AddressRange.c +msgid "Unable to write to address." msgstr "" #: shared-bindings/nvm/ByteArray.c @@ -2271,6 +2268,7 @@ msgid "Unkown error code %d" msgstr "" #: shared-bindings/adafruit_pixelbuf/PixelBuf.c +#: shared-module/_pixelmap/PixelMap.c #, c-format msgid "Unmatched number of items on RHS (expected %d, got %d)." msgstr "" @@ -2355,6 +2353,18 @@ msgstr "" msgid "Wi-Fi: " msgstr "" +#: ports/raspberrypi/common-hal/wifi/Radio.c +msgid "Wifi is in access point mode." +msgstr "" + +#: ports/raspberrypi/common-hal/wifi/Radio.c +msgid "Wifi is in station mode." +msgstr "" + +#: ports/raspberrypi/common-hal/wifi/Radio.c +msgid "Wifi is not enabled" +msgstr "" + #: main.c msgid "Woken up by alarm.\n" msgstr "" @@ -2364,13 +2374,48 @@ msgstr "" msgid "Writes not supported on Characteristic" msgstr "" -#: supervisor/shared/safe_mode.c -msgid "You are in safe mode because:\n" +#: ports/atmel-samd/boards/circuitplayground_express/mpconfigboard.h +#: ports/atmel-samd/boards/circuitplayground_express_crickit/mpconfigboard.h +#: ports/atmel-samd/boards/circuitplayground_express_displayio/mpconfigboard.h +#: ports/atmel-samd/boards/meowmeow/mpconfigboard.h +msgid "You pressed both buttons at start up." +msgstr "" + +#: ports/espressif/boards/m5stack_core_basic/mpconfigboard.h +#: ports/espressif/boards/m5stack_core_fire/mpconfigboard.h +#: ports/espressif/boards/m5stack_stick_c/mpconfigboard.h +msgid "You pressed button A at start up." msgstr "" #: supervisor/shared/safe_mode.c -msgid "" -"You pressed the reset button during boot. Press again to exit safe mode." +msgid "You pressed the BOOT button at start up" +msgstr "" + +#: ports/espressif/boards/adafruit_feather_esp32_v2/mpconfigboard.h +msgid "You pressed the SW38 button at start up." +msgstr "" + +#: ports/espressif/boards/hardkernel_odroid_go/mpconfigboard.h +msgid "You pressed the VOLUME button at start up." +msgstr "" + +#: ports/espressif/boards/m5stack_atom_echo/mpconfigboard.h +#: ports/espressif/boards/m5stack_atom_lite/mpconfigboard.h +#: ports/espressif/boards/m5stack_atom_matrix/mpconfigboard.h +#: ports/espressif/boards/m5stack_atom_u/mpconfigboard.h +msgid "You pressed the central button at start up." +msgstr "" + +#: ports/nrf/boards/aramcon2_badge/mpconfigboard.h +msgid "You pressed the left button at start up." +msgstr "" + +#: supervisor/shared/safe_mode.c +msgid "You pressed the reset button during boot." +msgstr "" + +#: supervisor/shared/micropython.c +msgid "[truncated due to length]" msgstr "" #: py/objtype.c @@ -2442,8 +2487,12 @@ msgstr "" msgid "array has too many dimensions" msgstr "" +#: extmod/ulab/code/ndarray.c +msgid "array is too big" +msgstr "" + #: py/objarray.c shared-bindings/alarm/SleepMemory.c -#: shared-bindings/coproc/CoprocMemory.c shared-bindings/nvm/ByteArray.c +#: shared-bindings/memorymap/AddressRange.c shared-bindings/nvm/ByteArray.c msgid "array/bytes required on right side" msgstr "" @@ -2536,10 +2585,6 @@ msgstr "" msgid "buffer too small for requested bytes" msgstr "" -#: shared-bindings/adafruit_pixelbuf/PixelBuf.c -msgid "byteorder is not a string" -msgstr "" - #: py/objarray.c msgid "bytes length not a multiple of item size" msgstr "" @@ -2581,14 +2626,10 @@ msgstr "" msgid "can't cancel self" msgstr "" -#: py/obj.c py/objint.c shared-module/adafruit_pixelbuf/PixelBuf.c +#: py/obj.c py/objint.c py/runtime.c shared-module/adafruit_pixelbuf/PixelBuf.c msgid "can't convert %q to %q" msgstr "" -#: py/runtime.c -msgid "can't convert %q to int" -msgstr "" - #: py/obj.c #, c-format msgid "can't convert %s to complex" @@ -2670,6 +2711,10 @@ msgstr "" msgid "can't set attribute" msgstr "" +#: py/runtime.c +msgid "can't set attribute '%q'" +msgstr "" + #: py/emitnative.c msgid "can't store '%q'" msgstr "" @@ -2772,10 +2817,6 @@ msgstr "" msgid "comparison of int and uint" msgstr "" -#: py/objcomplex.c -msgid "complex division by zero" -msgstr "" - #: py/objfloat.c py/parsenum.c msgid "complex values not supported" msgstr "" @@ -2878,12 +2919,11 @@ msgstr "" msgid "div/mod not implemented for uint" msgstr "" -#: py/objfloat.c py/objint_mpz.c +#: extmod/ulab/code/numpy/create.c msgid "divide by zero" msgstr "" -#: py/modmath.c py/objint_longlong.c py/runtime.c -#: shared-bindings/math/__init__.c +#: py/runtime.c msgid "division by zero" msgstr "" @@ -2924,9 +2964,9 @@ msgstr "" msgid "error = 0x%08lX" msgstr "" -#: ports/espressif/common-hal/esp32_camera/Camera.c +#: ports/espressif/common-hal/espcamera/Camera.c msgid "" -"esp32_camera.Camera requires reserved PSRAM to be configured. See the " +"espcamera.Camera requires reserved PSRAM to be configured. See the " "documentation for instructions." msgstr "" @@ -2934,14 +2974,6 @@ msgstr "" msgid "exceptions must derive from BaseException" msgstr "" -#: shared-bindings/canio/CAN.c -msgid "expected '%q' but got '%q'" -msgstr "" - -#: shared-bindings/canio/CAN.c -msgid "expected '%q' or '%q' but got '%q'" -msgstr "" - #: py/objstr.c msgid "expected ':' after format specifier" msgstr "':'이 예상되었습니다" @@ -3040,10 +3072,6 @@ msgstr "" msgid "format requires a dict" msgstr "" -#: shared-bindings/microcontroller/Processor.c -msgid "frequency is read-only for this board" -msgstr "" - #: py/objdeque.c msgid "full" msgstr "완전한(full)" @@ -3156,8 +3184,12 @@ msgstr "" msgid "index is out of bounds" msgstr "" +#: shared-bindings/_pixelmap/PixelMap.c +msgid "index must be tuple or int" +msgstr "" + #: extmod/ulab/code/numpy/numerical.c extmod/ulab/code/ulab_tools.c -#: ports/espressif/common-hal/pulseio/PulseIn.c py/obj.c +#: ports/espressif/common-hal/pulseio/PulseIn.c #: shared-bindings/bitmaptools/__init__.c msgid "index out of range" msgstr "" @@ -3255,10 +3287,6 @@ msgstr "" msgid "inputs are not iterable" msgstr "" -#: py/parsenum.c -msgid "int() arg 2 must be >= 2 and <= 36" -msgstr "" - #: extmod/ulab/code/numpy/approx.c msgid "interp is defined for 1D iterables of equal length" msgstr "" @@ -3315,7 +3343,7 @@ msgstr "키가 유효하지 않습니다" msgid "invalid micropython decorator" msgstr "" -#: ports/espressif/common-hal/esp32_camera/Camera.c +#: ports/espressif/common-hal/espcamera/Camera.c msgid "invalid setting" msgstr "" @@ -3340,10 +3368,6 @@ msgstr "구문(syntax)가 정수가 유효하지 않습니다" msgid "invalid syntax for number" msgstr "숫자에 대한 구문(syntax)가 유효하지 않습니다" -#: py/objexcept.c -msgid "invalid traceback" -msgstr "" - #: py/objtype.c msgid "issubclass() arg 1 must be a class" msgstr "" @@ -3400,19 +3424,17 @@ msgstr "" msgid "local variable referenced before assignment" msgstr "" -#: py/objint.c -msgid "long int not supported in this build" -msgstr "" - #: ports/espressif/common-hal/canio/CAN.c msgid "loopback + silent mode not supported by peripheral" msgstr "" #: ports/espressif/common-hal/mdns/Server.c +#: ports/raspberrypi/common-hal/mdns/Server.c msgid "mDNS already initialized" msgstr "" #: ports/espressif/common-hal/mdns/Server.c +#: ports/raspberrypi/common-hal/mdns/Server.c msgid "mDNS only works with built-in WiFi" msgstr "" @@ -3541,6 +3563,10 @@ msgstr "" msgid "negative shift count" msgstr "" +#: shared-bindings/_pixelmap/PixelMap.c +msgid "nested index must be int" +msgstr "" + #: shared-module/sdcardio/SDCard.c msgid "no SD card" msgstr "" @@ -3574,7 +3600,7 @@ msgstr "" msgid "no response from SD card" msgstr "" -#: ports/espressif/common-hal/esp32_camera/Camera.c py/objobject.c py/runtime.c +#: ports/espressif/common-hal/espcamera/Camera.c py/objobject.c py/runtime.c msgid "no such attribute" msgstr "" @@ -3710,6 +3736,10 @@ msgstr "" msgid "only mono is supported" msgstr "" +#: extmod/ulab/code/numpy/create.c +msgid "only ndarrays can be concatenated" +msgstr "" + #: ports/stm/common-hal/audiobusio/PDMIn.c msgid "only oversample=64 is supported" msgstr "" @@ -3720,7 +3750,7 @@ msgid "only sample_rate=16000 is supported" msgstr "" #: py/objarray.c py/objstr.c py/objstrunicode.c py/objtuple.c -#: shared-bindings/alarm/SleepMemory.c shared-bindings/coproc/CoprocMemory.c +#: shared-bindings/alarm/SleepMemory.c shared-bindings/memorymap/AddressRange.c #: shared-bindings/nvm/ByteArray.c msgid "only slices with step=1 (aka None) are supported" msgstr "" @@ -3936,10 +3966,6 @@ msgstr "" msgid "slice step can't be zero" msgstr "" -#: py/objslice.c -msgid "slice step cannot be zero" -msgstr "" - #: py/nativeglue.c msgid "slice unsupported" msgstr "" @@ -3988,10 +4014,6 @@ msgstr "" msgid "start/end indices" msgstr "" -#: shared-bindings/random/__init__.c -msgid "step must be non-zero" -msgstr "" - #: shared-bindings/random/__init__.c msgid "stop not reachable from start" msgstr "" @@ -4000,10 +4022,6 @@ msgstr "" msgid "stream operation not supported" msgstr "" -#: py/objstrunicode.c -msgid "string indices must be integers, not %q" -msgstr "" - #: py/stream.c msgid "string not supported; use bytes or bytearray" msgstr "" @@ -4036,10 +4054,6 @@ msgstr "" msgid "syntax error in uctypes descriptor" msgstr "" -#: shared-bindings/time/__init__.c -msgid "time.struct_time() takes a 9-sequence" -msgstr "" - #: ports/atmel-samd/common-hal/watchdog/WatchDogTimer.c #: ports/espressif/common-hal/watchdog/WatchDogTimer.c #: ports/nrf/common-hal/watchdog/WatchDogTimer.c @@ -4321,10 +4335,6 @@ msgstr "" msgid "y value out of bounds" msgstr "" -#: py/objrange.c -msgid "zero step" -msgstr "" - #: extmod/ulab/code/scipy/signal/signal.c msgid "zi must be an ndarray" msgstr "" @@ -4337,6 +4347,12 @@ msgstr "" msgid "zi must be of shape (n_section, 2)" msgstr "" +#~ msgid "Expected a %q" +#~ msgstr "%q 이 예상되었습니다." + +#~ msgid "Invalid pins" +#~ msgstr "핀이 유효하지 않습니다" + #~ msgid "%q indices must be integers, not %s" #~ msgstr "%q 인덱스는 %s 가 아닌 정수 여야합니다" diff --git a/locale/nl.po b/locale/nl.po index fc1e1f77b8..9f5a7d382f 100644 --- a/locale/nl.po +++ b/locale/nl.po @@ -31,12 +31,21 @@ msgstr "" #: supervisor/shared/safe_mode.c msgid "" "\n" -"Please file an issue with the contents of your CIRCUITPY drive at \n" -"https://github.com/adafruit/circuitpython/issues\n" +"Please file an issue with your program at https://github.com/adafruit/" +"circuitpython/issues." msgstr "" + +#: supervisor/shared/safe_mode.c +msgid "" "\n" -"Meld een probleem met de inhoud van de CIRCUITPY drive op:\n" -"https://github.com/adafruit/circuitpython/issues\n" +"Press reset to exit safe mode.\n" +msgstr "" + +#: supervisor/shared/safe_mode.c +msgid "" +"\n" +"You are in safe mode because:\n" +msgstr "" #: py/obj.c msgid " File \"%q\"" @@ -68,6 +77,11 @@ msgstr "%%c vereist een int of char" msgid "%02X" msgstr "" +#: shared-module/os/getenv.c +#, c-format +msgid "%S" +msgstr "" + #: shared-bindings/rgbmatrix/RGBMatrix.c #, c-format msgid "" @@ -83,7 +97,7 @@ msgstr "" #: 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 +#: ports/stm/common-hal/canio/Listener.c ports/stm/common-hal/rtc/RTC.c msgid "%q" msgstr "" @@ -103,13 +117,18 @@ msgstr "" msgid "%q failure: %d" msgstr "%q fout: %d" +#: py/argcheck.c +msgid "%q in %q must be of type %q, not %q" +msgstr "" + +#: ports/espressif/common-hal/espulp/ULP.c #: ports/raspberrypi/common-hal/rp2pio/StateMachine.c #: shared-bindings/digitalio/DigitalInOut.c #: shared-bindings/microcontroller/Pin.c msgid "%q in use" msgstr "%q in gebruik" -#: py/obj.c py/objstr.c py/objstrunicode.c +#: py/objstr.c py/objstrunicode.c msgid "%q index out of range" msgstr "%q index buiten bereik" @@ -121,7 +140,11 @@ msgstr "" msgid "%q is %q" msgstr "" -#: py/argcheck.c +#: ports/raspberrypi/common-hal/wifi/Radio.c +msgid "%q is read-only for this board" +msgstr "" + +#: py/argcheck.c shared-bindings/usb_hid/Device.c msgid "%q length must be %d" msgstr "" @@ -137,10 +160,6 @@ msgstr "" 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 "" @@ -162,24 +181,20 @@ msgid "%q must be >= %d" msgstr "" #: shared-bindings/analogbufio/BufferedIn.c +msgid "%q must be a bytearray or array of type 'H' or 'B'" +msgstr "" + #: 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" +#: ports/raspberrypi/bindings/cyw43/__init__.c py/argcheck.c py/objexcept.c +#: shared-bindings/canio/CAN.c shared-bindings/digitalio/Pull.c +msgid "%q must be of type %q or %q, not %q" msgstr "" -#: py/argcheck.c -msgid "%q must be an int" -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" +#: py/argcheck.c py/obj.c py/objstrunicode.c +msgid "%q must be of type %q, not %q" msgstr "" #: ports/atmel-samd/common-hal/busio/UART.c @@ -192,7 +207,6 @@ msgstr "" #: ports/atmel-samd/common-hal/pulseio/PulseIn.c #: ports/cxd56/common-hal/pulseio/PulseIn.c -#: ports/espressif/common-hal/coproc/Coproc.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 @@ -204,8 +218,8 @@ msgstr "%q buiten bereik" msgid "%q pin invalid" msgstr "%q pin onjuist" -#: shared-bindings/usb_hid/Device.c -msgid "%q with a report ID of 0 must be of length 1" +#: py/objrange.c py/objslice.c shared-bindings/random/__init__.c +msgid "%q step cannot be zero" msgstr "" #: py/bc.c py/objnamedtuple.c @@ -283,7 +297,7 @@ msgstr "'%s' verwacht op zijn meest r%d" #: py/emitinlinethumb.c #, c-format msgid "'%s' expects {r0, r1, ...}" -msgstr "'%s' verwacht {r0, r1, …}" +msgstr "'%s' verwacht {r0, r1, ...}" #: py/emitinlinextensa.c #, c-format @@ -305,7 +319,7 @@ msgstr "" msgid "'%s' object doesn't support item deletion" msgstr "" -#: ports/raspberrypi/common-hal/wifi/Radio.c py/runtime.c +#: py/runtime.c msgid "'%s' object has no attribute '%q'" msgstr "'%s' object heeft geen attribuut '%q'" @@ -405,6 +419,10 @@ msgstr "ADC2 wordt gebruikt door WiFi" msgid "Address must be %d bytes long" msgstr "Adres moet %d bytes lang zijn" +#: ports/espressif/common-hal/memorymap/AddressRange.c +msgid "Address range not allowed" +msgstr "" + #: ports/espressif/common-hal/canio/CAN.c msgid "All CAN peripherals are in use" msgstr "Alle CAN-peripherals zijn in gebruik" @@ -432,7 +450,6 @@ msgid "All SPI peripherals are in use" msgstr "Alle SPI peripherals zijn in gebruik" #: 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 "Alle UART peripherals zijn in gebruik" @@ -485,7 +502,7 @@ msgstr "Advertising is al bezig." msgid "Already have all-matches listener" msgstr "Heeft al een luisteraar voor 'all-matches'" -#: ports/espressif/common-hal/coproc/__init__.c +#: ports/espressif/common-hal/espulp/ULP.c #: shared-module/memorymonitor/AllocationAlarm.c #: shared-module/memorymonitor/AllocationSize.c msgid "Already running" @@ -496,6 +513,11 @@ msgstr "Wordt al uitgevoerd" msgid "Already scanning for wifi networks" msgstr "Zoekt al naar WiFi netwerken" +#: shared-module/os/getenv.c +#, c-format +msgid "An error occurred while retrieving '%s':\n" +msgstr "" + #: ports/stm/common-hal/audiopwmio/PWMAudioOut.c msgid "Another PWMAudioOut is already active" msgstr "" @@ -509,24 +531,16 @@ msgstr "Een andere send is al actief" msgid "Array must contain halfwords (type 'H')" msgstr "Array moet halfwords (type 'H') bevatten" -#: shared-bindings/alarm/SleepMemory.c shared-bindings/coproc/CoprocMemory.c +#: shared-bindings/alarm/SleepMemory.c shared-bindings/memorymap/AddressRange.c #: shared-bindings/nvm/ByteArray.c msgid "Array values should be single bytes." msgstr "Array waardes moet enkele bytes zijn." -#: shared-bindings/microcontroller/Pin.c -msgid "At most %d %q may be specified (not %d)" -msgstr "Op zijn meest %d %q mogen worden gespecificeerd (niet %d)" - #: shared-module/memorymonitor/AllocationAlarm.c #, c-format msgid "Attempt to allocate %d blocks" msgstr "Poging om %d blokken toe te wijzen" -#: supervisor/shared/safe_mode.c -msgid "Attempted heap allocation when VM not running." -msgstr "" - #: ports/raspberrypi/audio_dma.c msgid "Audio conversion not implemented" msgstr "" @@ -577,20 +591,13 @@ msgid "Bitmap size and bits per value must match" msgstr "" #: supervisor/shared/safe_mode.c -msgid "Boot device must be first device (interface #0)." +msgid "Boot device must be first (interface #0)." msgstr "" #: ports/mimxrt10xx/common-hal/busio/UART.c msgid "Both RX and TX required for flow control" msgstr "RX en TX zijn beide vereist voor stroomregeling" -#: ports/atmel-samd/boards/circuitplayground_express/mpconfigboard.h -#: ports/atmel-samd/boards/circuitplayground_express_crickit/mpconfigboard.h -#: ports/atmel-samd/boards/circuitplayground_express_displayio/mpconfigboard.h -#: ports/atmel-samd/boards/meowmeow/mpconfigboard.h -msgid "Both buttons were pressed at start up.\n" -msgstr "" - #: ports/atmel-samd/common-hal/rotaryio/IncrementalEncoder.c msgid "Both pins must support hardware interrupts" msgstr "Beide pinnen moeten hardware interrupts ondersteunen" @@ -656,11 +663,6 @@ msgstr "" msgid "Bus pin %d is already in use" msgstr "Bus pin %d al in gebruik" -#: ports/espressif/boards/m5stack_core_basic/mpconfigboard.h -#: ports/espressif/boards/m5stack_core_fire/mpconfigboard.h -msgid "Button A was pressed at start up.\n" -msgstr "" - #: shared-bindings/_bleio/UUID.c msgid "Byte buffer must be 16 bytes." msgstr "Byte buffer moet 16 bytes zijn." @@ -792,10 +794,6 @@ msgstr "CharacteristicBuffer schrijven is niet beschikbaar" msgid "CircuitPython core code crashed hard. Whoops!\n" msgstr "CircuitPython core code is hard gecrashed. Ojee!\n" -#: supervisor/shared/safe_mode.c -msgid "CircuitPython was unable to allocate the heap." -msgstr "CircuitPython kon het heap geheugen niet toewijzen." - #: shared-module/bitbangio/I2C.c msgid "Clock stretch too long" msgstr "Clock stretch is te lang" @@ -836,10 +834,6 @@ msgstr "Kan interrupt niet starten, RX is bezig" msgid "Couldn't allocate decoder" msgstr "Kan decoder niet alloceren" -#: supervisor/shared/safe_mode.c -msgid "Crash into the HardFault_Handler." -msgstr "Crash naar de HardFault_Handler." - #: ports/stm/common-hal/analogio/AnalogOut.c msgid "DAC Channel Init Error" msgstr "DAC kanaal Init Fout" @@ -902,6 +896,10 @@ msgstr "" msgid "Drive mode not used when direction is input." msgstr "Drive modus niet gebruikt als de richting input is." +#: py/obj.c +msgid "During handling of the above exception, another exception occurred:" +msgstr "" + #: shared-bindings/aesio/aes.c msgid "ECB only operates on 16 bytes at a time" msgstr "ECB werkt alleen met 16 bytes tegelijkertijd" @@ -927,24 +925,16 @@ msgstr "" msgid "Error in regex" msgstr "Fout in regex" +#: supervisor/shared/safe_mode.c +msgid "Error in safemode.py." +msgstr "" + #: shared-bindings/socketpool/Socket.c shared-bindings/ssl/SSLSocket.c msgid "Error: Failure to bind" msgstr "" -#: py/enum.c shared-bindings/_bleio/__init__.c shared-bindings/aesio/aes.c -#: shared-bindings/alarm/__init__.c shared-bindings/alarm/coproc/CoprocAlarm.c -#: shared-bindings/busio/SPI.c shared-bindings/coproc/Coproc.c -#: shared-bindings/coproc/__init__.c shared-bindings/microcontroller/Pin.c -#: shared-bindings/neopixel_write/__init__.c -msgid "Expected a %q" -msgstr "Verwacht een %q" - -#: ports/raspberrypi/bindings/cyw43/__init__.c -msgid "Expected a %q or %q" -msgstr "" - #: shared-bindings/alarm/__init__.c -msgid "Expected an %q" +msgid "Expected a kind of %q" msgstr "" #: ports/espressif/common-hal/_bleio/Adapter.c @@ -1012,13 +1002,17 @@ msgid "Failed to write internal flash." msgstr "Schrijven naar interne flash mislukt." #: supervisor/shared/safe_mode.c -msgid "Fatal error." +msgid "Fault detected by hardware." msgstr "" #: py/moduerrno.c msgid "File exists" msgstr "Bestand bestaat" +#: shared-module/os/getenv.c +msgid "File not found" +msgstr "" + #: ports/atmel-samd/common-hal/canio/Listener.c #: ports/espressif/common-hal/canio/Listener.c #: ports/stm/common-hal/canio/Listener.c @@ -1033,7 +1027,6 @@ msgstr "" msgid "Firmware is invalid" msgstr "" -#: ports/espressif/common-hal/coproc/Coproc.c #: ports/espressif/common-hal/dualbank/__init__.c msgid "Firmware is too big" msgstr "" @@ -1076,6 +1069,8 @@ msgstr "" #: shared-bindings/displayio/Display.c #: shared-bindings/displayio/EPaperDisplay.c #: shared-bindings/framebufferio/FramebufferDisplay.c +#: shared-module/displayio/Display.c +#: shared-module/framebufferio/FramebufferDisplay.c msgid "Group already used" msgstr "Groep al gebruikt" @@ -1096,6 +1091,15 @@ msgstr "Hardware bezig, probeer alternatieve pinnen" msgid "Hardware in use, try alternative pins" msgstr "Hardware in gebruik, probeer alternatieve pinnen" +#: supervisor/shared/safe_mode.c +msgid "Heap allocation when VM not running." +msgstr "" + +#: supervisor/shared/safe_mode.c +msgid "" +"Heap was corrupted because the stack was too small. Increase stack size." +msgstr "" + #: extmod/vfs_posix_file.c py/objstringio.c msgid "I/O operation on closed file" msgstr "I/O actie op gesloten bestand" @@ -1113,11 +1117,6 @@ msgstr "" msgid "I2SOut not available" msgstr "I2SOut is niet beschikbaar" -#: shared-bindings/aesio/aes.c -#, c-format -msgid "IV must be %d bytes long" -msgstr "IV %d bytes lang zijn" - #: ports/raspberrypi/bindings/rp2pio/StateMachine.c msgid "In-buffer elements must be <= 4 bytes long" msgstr "" @@ -1204,6 +1203,7 @@ msgid "Internal define error" msgstr "Interne define fout" #: ports/espressif/common-hal/paralleldisplay/ParallelBus.c +#: shared-module/os/getenv.c msgid "Internal error" msgstr "" @@ -1216,6 +1216,10 @@ msgstr "Interne fout #%d" msgid "Internal watchdog timer expired." msgstr "" +#: supervisor/shared/safe_mode.c +msgid "Interrupt error." +msgstr "" + #: py/argcheck.c shared-bindings/digitalio/DigitalInOut.c msgid "Invalid %q" msgstr "Ongeldige %q" @@ -1250,6 +1254,11 @@ msgstr "Ongeldig argument" msgid "Invalid bits per value" msgstr "Ongeldige bits per waarde" +#: shared-module/os/getenv.c +#, c-format +msgid "Invalid byte %.*s" +msgstr "" + #: ports/atmel-samd/common-hal/imagecapture/ParallelImageCapture.c #, c-format msgid "Invalid data_pins[%d]" @@ -1259,18 +1268,10 @@ msgstr "" msgid "Invalid format chunk size" msgstr "Ongeldig formaat stuk grootte" -#: supervisor/shared/safe_mode.c -msgid "Invalid memory access." -msgstr "Ongeldig geheugen adres." - #: ports/espressif/common-hal/wifi/Radio.c msgid "Invalid multicast MAC address" msgstr "" -#: shared-bindings/busio/UART.c -msgid "Invalid pins" -msgstr "Ongeldige pinnen" - #: ports/espressif/common-hal/espidf/__init__.c ports/espressif/esp_error.c msgid "Invalid size" msgstr "" @@ -1284,10 +1285,18 @@ msgstr "" msgid "Invalid state" msgstr "" +#: shared-module/os/getenv.c +msgid "Invalid unicode escape" +msgstr "" + #: 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" +#: shared-module/os/getenv.c +msgid "Key not found" +msgstr "" + #: shared-module/is31fl3741/FrameBuffer.c msgid "LED mappings must match display size" msgstr "" @@ -1394,6 +1403,10 @@ msgstr "" msgid "NVS Error" msgstr "NVS-fout" +#: shared-bindings/socketpool/SocketPool.c +msgid "Name or service not known" +msgstr "" + #: py/qstr.c msgid "Name too long" msgstr "Naam te lang" @@ -1508,11 +1521,6 @@ msgstr "Een sleutel was niet gespecificeerd" msgid "No long integer support" msgstr "Geen lange integer ondersteuning" -#: shared-module/usb_hid/__init__.c -#, c-format -msgid "No more than %d HID devices allowed" -msgstr "" - #: shared-bindings/wifi/Radio.c msgid "No network with that ssid" msgstr "Geen netwerk met dat SSID gevonden" @@ -1548,10 +1556,6 @@ msgstr "Bestand/map bestaat niet" msgid "No timer available" msgstr "Geen timer beschikbaar" -#: supervisor/shared/safe_mode.c -msgid "Nordic system firmware failure assertion." -msgstr "" - #: ports/nrf/common-hal/_bleio/__init__.c msgid "Nordic system firmware out of memory" msgstr "" @@ -1571,10 +1575,6 @@ msgstr "Niet verbonden" msgid "Not playing" msgstr "Wordt niet afgespeeld" -#: shared-bindings/_bleio/__init__.c -msgid "Not settable" -msgstr "Niet instelbaar" - #: ports/espressif/common-hal/paralleldisplay/ParallelBus.c #, c-format msgid "Number of data_pins must be 8 or 16, not %d" @@ -1643,11 +1643,14 @@ msgstr "" "Alleen monochrome en 4bpp of 8bpp, en 16bpp of grotere geïndiceerde BMP's " "zijn ondersteund: %d bpp is gegeven" -#: ports/espressif/common-hal/alarm/coproc/CoprocAlarm.c #: ports/espressif/common-hal/alarm/touch/TouchAlarm.c msgid "Only one %q can be set in deep sleep." msgstr "" +#: ports/espressif/common-hal/espulp/ULPAlarm.c +msgid "Only one %q can be set." +msgstr "" + #: ports/espressif/common-hal/i2ctarget/I2CTarget.c #: ports/raspberrypi/common-hal/i2ctarget/I2CTarget.c msgid "Only one address is allowed" @@ -1680,6 +1683,10 @@ msgstr "" msgid "Operation timed out" msgstr "" +#: ports/raspberrypi/common-hal/mdns/Server.c +msgid "Out of MDNS service slots" +msgstr "" + #: ports/espressif/common-hal/espidf/__init__.c ports/espressif/esp_error.c msgid "Out of memory" msgstr "" @@ -1810,6 +1817,10 @@ msgstr "" msgid "Program size invalid" msgstr "" +#: ports/espressif/common-hal/espulp/ULP.c +msgid "Program too long" +msgstr "" + #: shared-bindings/digitalio/DigitalInOut.c msgid "Pull not used when direction is output." msgstr "Pull niet gebruikt wanneer de richting output is." @@ -1849,8 +1860,9 @@ msgstr "RTC is niet ondersteund door dit board" msgid "Random number generation error" msgstr "Random number generatie fout" +#: shared-bindings/_bleio/__init__.c #: shared-bindings/memorymonitor/AllocationSize.c -#: shared-bindings/pulseio/PulseIn.c +#: shared-bindings/pulseio/PulseIn.c shared-module/displayio/Bitmap.c msgid "Read-only" msgstr "Alleen-lezen" @@ -1858,10 +1870,6 @@ msgstr "Alleen-lezen" msgid "Read-only filesystem" msgstr "Alleen-lezen bestandssysteem" -#: shared-module/displayio/Bitmap.c -msgid "Read-only object" -msgstr "Alleen-lezen object" - #: ports/espressif/common-hal/espidf/__init__.c ports/espressif/esp_error.c msgid "Received response was invalid" msgstr "" @@ -1954,7 +1962,7 @@ msgstr "Afmeting niet ondersteund" msgid "Sleep Memory not available" msgstr "" -#: shared-bindings/alarm/SleepMemory.c shared-bindings/coproc/CoprocMemory.c +#: shared-bindings/alarm/SleepMemory.c shared-bindings/memorymap/AddressRange.c #: shared-bindings/nvm/ByteArray.c msgid "Slice and value different lengths." msgstr "Slice en waarde hebben verschillende lengtes." @@ -1991,6 +1999,10 @@ msgstr "" msgid "Stereo right must be on PWM channel B" msgstr "" +#: ports/raspberrypi/common-hal/wifi/Radio.c +msgid "Stopping AP is not supported." +msgstr "" + #: 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" @@ -2008,35 +2020,11 @@ msgid "Temperature read timed out" msgstr "Temperatuur lees time-out" #: supervisor/shared/safe_mode.c -msgid "The BOOT button was pressed at start up.\n" +msgid "The `microcontroller` module was used to boot into safe mode." msgstr "" -#: supervisor/shared/safe_mode.c -msgid "" -"The CircuitPython heap was corrupted because the stack was too small.\n" -"Increase the stack size if you know how. If not:" -msgstr "" - -#: ports/espressif/boards/adafruit_feather_esp32_v2/mpconfigboard.h -msgid "The SW38 button was pressed at start up.\n" -msgstr "" - -#: ports/espressif/boards/hardkernel_odroid_go/mpconfigboard.h -msgid "The VOLUME button was pressed at start up.\n" -msgstr "" - -#: supervisor/shared/safe_mode.c -msgid "" -"The `microcontroller` module was used to boot into safe mode. Press reset to " -"exit safe mode." -msgstr "" - -#: ports/espressif/boards/m5stack_atom_lite/mpconfigboard.h -msgid "The central button was pressed at start up.\n" -msgstr "" - -#: ports/nrf/boards/aramcon2_badge/mpconfigboard.h -msgid "The left button was pressed at start up.\n" +#: py/obj.c +msgid "The above exception was the direct cause of the following exception:" msgstr "" #: shared-bindings/rgbmatrix/RGBMatrix.c @@ -2044,10 +2032,7 @@ msgid "The length of rgb_pins must be 6, 12, 18, 24, or 30" msgstr "De lengte van rgb_pins moet 6, 12, 18, 24 of 30 zijn" #: supervisor/shared/safe_mode.c -msgid "" -"The microcontroller's power dipped. Make sure your power supply provides\n" -"enough power for the whole circuit and press reset (after ejecting " -"CIRCUITPY)." +msgid "The power dipped. Make sure you are providing enough power." msgstr "" #: shared-module/audiomixer/MixerVoice.c @@ -2066,6 +2051,10 @@ msgstr "De sample's sample rate komt niet overeen met die van de mixer" msgid "The sample's signedness does not match the mixer's" msgstr "De sample's signature komt niet overeen met die van de mixer" +#: supervisor/shared/safe_mode.c +msgid "Third-party firmware fatal error." +msgstr "" + #: shared-module/imagecapture/ParallelImageCapture.c msgid "This microcontroller does not support continuous capture." msgstr "" @@ -2098,10 +2087,6 @@ msgstr "Tijdstip ligt in het verleden." msgid "Timeout is too long: Maximum timeout length is %d seconds" msgstr "Time-out is te lang. Maximale time-out lengte is %d seconden" -#: supervisor/shared/safe_mode.c -msgid "To exit, please reset the board without requesting safe mode." -msgstr "" - #: ports/atmel-samd/common-hal/audiobusio/I2SOut.c msgid "Too many channels in sample" msgstr "" @@ -2146,6 +2131,10 @@ msgstr "" msgid "UART init" msgstr "" +#: ports/raspberrypi/common-hal/busio/UART.c +msgid "UART peripheral in use" +msgstr "" + #: ports/stm/common-hal/busio/UART.c msgid "UART re-init" msgstr "" @@ -2193,6 +2182,10 @@ msgstr "UUID waarde is geen str, int, of byte buffer" msgid "Unable to allocate buffers for signed conversion" msgstr "Niet in staat buffers voor gesigneerde conversie te alloceren" +#: supervisor/shared/safe_mode.c +msgid "Unable to allocate the heap." +msgstr "" + #: ports/espressif/common-hal/busio/I2C.c msgid "Unable to create lock" msgstr "Kan vergrendeling niet maken" @@ -2216,11 +2209,12 @@ msgid "Unable to read color palette data" msgstr "Niet in staat kleurenpalet data te lezen" #: ports/espressif/common-hal/mdns/Server.c +#: ports/raspberrypi/common-hal/mdns/Server.c msgid "Unable to start mDNS query" msgstr "" -#: shared-bindings/coproc/CoprocMemory.c -msgid "Unable to write" +#: shared-bindings/memorymap/AddressRange.c +msgid "Unable to write to address." msgstr "" #: shared-bindings/nvm/ByteArray.c @@ -2291,6 +2285,7 @@ msgid "Unkown error code %d" msgstr "" #: shared-bindings/adafruit_pixelbuf/PixelBuf.c +#: shared-module/_pixelmap/PixelMap.c #, c-format msgid "Unmatched number of items on RHS (expected %d, got %d)." msgstr "Niet overeenkomend aantal RHS items (verwachtte %d, kreeg %d)." @@ -2381,6 +2376,18 @@ msgstr "" msgid "Wi-Fi: " msgstr "" +#: ports/raspberrypi/common-hal/wifi/Radio.c +msgid "Wifi is in access point mode." +msgstr "" + +#: ports/raspberrypi/common-hal/wifi/Radio.c +msgid "Wifi is in station mode." +msgstr "" + +#: ports/raspberrypi/common-hal/wifi/Radio.c +msgid "Wifi is not enabled" +msgstr "" + #: main.c msgid "Woken up by alarm.\n" msgstr "Gewekt door alarm.\n" @@ -2390,13 +2397,48 @@ msgstr "Gewekt door alarm.\n" msgid "Writes not supported on Characteristic" msgstr "Schrijven niet ondersteund op Characteristic" -#: supervisor/shared/safe_mode.c -msgid "You are in safe mode because:\n" +#: ports/atmel-samd/boards/circuitplayground_express/mpconfigboard.h +#: ports/atmel-samd/boards/circuitplayground_express_crickit/mpconfigboard.h +#: ports/atmel-samd/boards/circuitplayground_express_displayio/mpconfigboard.h +#: ports/atmel-samd/boards/meowmeow/mpconfigboard.h +msgid "You pressed both buttons at start up." +msgstr "" + +#: ports/espressif/boards/m5stack_core_basic/mpconfigboard.h +#: ports/espressif/boards/m5stack_core_fire/mpconfigboard.h +#: ports/espressif/boards/m5stack_stick_c/mpconfigboard.h +msgid "You pressed button A at start up." msgstr "" #: supervisor/shared/safe_mode.c -msgid "" -"You pressed the reset button during boot. Press again to exit safe mode." +msgid "You pressed the BOOT button at start up" +msgstr "" + +#: ports/espressif/boards/adafruit_feather_esp32_v2/mpconfigboard.h +msgid "You pressed the SW38 button at start up." +msgstr "" + +#: ports/espressif/boards/hardkernel_odroid_go/mpconfigboard.h +msgid "You pressed the VOLUME button at start up." +msgstr "" + +#: ports/espressif/boards/m5stack_atom_echo/mpconfigboard.h +#: ports/espressif/boards/m5stack_atom_lite/mpconfigboard.h +#: ports/espressif/boards/m5stack_atom_matrix/mpconfigboard.h +#: ports/espressif/boards/m5stack_atom_u/mpconfigboard.h +msgid "You pressed the central button at start up." +msgstr "" + +#: ports/nrf/boards/aramcon2_badge/mpconfigboard.h +msgid "You pressed the left button at start up." +msgstr "" + +#: supervisor/shared/safe_mode.c +msgid "You pressed the reset button during boot." +msgstr "" + +#: supervisor/shared/micropython.c +msgid "[truncated due to length]" msgstr "" #: py/objtype.c @@ -2468,8 +2510,12 @@ msgstr "array en indexlengte moeten gelijk zijn" msgid "array has too many dimensions" msgstr "" +#: extmod/ulab/code/ndarray.c +msgid "array is too big" +msgstr "" + #: py/objarray.c shared-bindings/alarm/SleepMemory.c -#: shared-bindings/coproc/CoprocMemory.c shared-bindings/nvm/ByteArray.c +#: shared-bindings/memorymap/AddressRange.c shared-bindings/nvm/ByteArray.c msgid "array/bytes required on right side" msgstr "array/bytes vereist aan de rechterkant" @@ -2562,10 +2608,6 @@ msgstr "buffer te klein" msgid "buffer too small for requested bytes" msgstr "buffer te klein voor gevraagde bytes" -#: shared-bindings/adafruit_pixelbuf/PixelBuf.c -msgid "byteorder is not a string" -msgstr "byteorder is geen string" - #: py/objarray.c msgid "bytes length not a multiple of item size" msgstr "bytes lengte is geen veelvoud van itemgrootte" @@ -2608,14 +2650,10 @@ msgstr "kan niet toewijzen aan expressie" msgid "can't cancel self" msgstr "" -#: py/obj.c py/objint.c shared-module/adafruit_pixelbuf/PixelBuf.c +#: py/obj.c py/objint.c py/runtime.c shared-module/adafruit_pixelbuf/PixelBuf.c msgid "can't convert %q to %q" msgstr "kan %q niet naar %q converteren" -#: py/runtime.c -msgid "can't convert %q to int" -msgstr "" - #: py/obj.c #, c-format msgid "can't convert %s to complex" @@ -2697,6 +2735,10 @@ msgstr "kan geen 512 blokgrootte instellen" msgid "can't set attribute" msgstr "kan attribute niet instellen" +#: py/runtime.c +msgid "can't set attribute '%q'" +msgstr "" + #: py/emitnative.c msgid "can't store '%q'" msgstr "kan '%q' niet opslaan" @@ -2799,10 +2841,6 @@ msgstr "kleur moet tussen 0x000000 en 0xffffff liggen" msgid "comparison of int and uint" msgstr "" -#: py/objcomplex.c -msgid "complex division by zero" -msgstr "complexe deling door 0" - #: py/objfloat.c py/parsenum.c msgid "complex values not supported" msgstr "complexe waardes niet ondersteund" @@ -2907,12 +2945,11 @@ msgstr "" msgid "div/mod not implemented for uint" msgstr "" -#: py/objfloat.c py/objint_mpz.c +#: extmod/ulab/code/numpy/create.c msgid "divide by zero" msgstr "" -#: py/modmath.c py/objint_longlong.c py/runtime.c -#: shared-bindings/math/__init__.c +#: py/runtime.c msgid "division by zero" msgstr "deling door nul" @@ -2953,9 +2990,9 @@ msgstr "epoch_time niet ondersteund op dit bord" msgid "error = 0x%08lX" msgstr "fout = 0x%08lX" -#: ports/espressif/common-hal/esp32_camera/Camera.c +#: ports/espressif/common-hal/espcamera/Camera.c msgid "" -"esp32_camera.Camera requires reserved PSRAM to be configured. See the " +"espcamera.Camera requires reserved PSRAM to be configured. See the " "documentation for instructions." msgstr "" @@ -2963,14 +3000,6 @@ msgstr "" msgid "exceptions must derive from BaseException" msgstr "uitzonderingen moeten afleiden van BaseException" -#: shared-bindings/canio/CAN.c -msgid "expected '%q' but got '%q'" -msgstr "verwachtte '%q' maar ontving '%q'" - -#: shared-bindings/canio/CAN.c -msgid "expected '%q' or '%q' but got '%q'" -msgstr "verwachtte '%q' of '%q' maar ontving '%q'" - #: py/objstr.c msgid "expected ':' after format specifier" msgstr "verwachtte ':' na format specifier" @@ -3069,10 +3098,6 @@ msgstr "lettertype moet 2048 bytes lang zijn" msgid "format requires a dict" msgstr "format vereist een dict" -#: shared-bindings/microcontroller/Processor.c -msgid "frequency is read-only for this board" -msgstr "" - #: py/objdeque.c msgid "full" msgstr "vol" @@ -3186,8 +3211,12 @@ msgstr "vulling (padding) is onjuist" msgid "index is out of bounds" msgstr "index is buiten bereik" +#: shared-bindings/_pixelmap/PixelMap.c +msgid "index must be tuple or int" +msgstr "" + #: extmod/ulab/code/numpy/numerical.c extmod/ulab/code/ulab_tools.c -#: ports/espressif/common-hal/pulseio/PulseIn.c py/obj.c +#: ports/espressif/common-hal/pulseio/PulseIn.c #: shared-bindings/bitmaptools/__init__.c msgid "index out of range" msgstr "index is buiten bereik" @@ -3285,10 +3314,6 @@ msgstr "invoervectors moeten van gelijke lengte zijn" msgid "inputs are not iterable" msgstr "invoer is niet itereerbaar" -#: py/parsenum.c -msgid "int() arg 2 must be >= 2 and <= 36" -msgstr "int() argument 2 moet >=2 en <= 36 zijn" - #: extmod/ulab/code/numpy/approx.c msgid "interp is defined for 1D iterables of equal length" msgstr "" @@ -3345,7 +3370,7 @@ msgstr "ongeldige sleutel" msgid "invalid micropython decorator" msgstr "ongeldige micropython decorator" -#: ports/espressif/common-hal/esp32_camera/Camera.c +#: ports/espressif/common-hal/espcamera/Camera.c msgid "invalid setting" msgstr "" @@ -3370,10 +3395,6 @@ msgstr "ongeldige syntax voor integer met grondtal %d" msgid "invalid syntax for number" msgstr "ongeldige syntax voor nummer" -#: py/objexcept.c -msgid "invalid traceback" -msgstr "" - #: py/objtype.c msgid "issubclass() arg 1 must be a class" msgstr "issubclass() argument 1 moet een klasse zijn" @@ -3433,19 +3454,17 @@ msgstr "lokale '%q' gebruikt voordat type bekend is" msgid "local variable referenced before assignment" msgstr "verwijzing naar een (nog) niet toegewezen lokale variabele" -#: py/objint.c -msgid "long int not supported in this build" -msgstr "long int wordt niet ondersteund in deze build" - #: ports/espressif/common-hal/canio/CAN.c msgid "loopback + silent mode not supported by peripheral" msgstr "loopback + silent mode wordt niet ondersteund door randapparaat" #: ports/espressif/common-hal/mdns/Server.c +#: ports/raspberrypi/common-hal/mdns/Server.c msgid "mDNS already initialized" msgstr "" #: ports/espressif/common-hal/mdns/Server.c +#: ports/raspberrypi/common-hal/mdns/Server.c msgid "mDNS only works with built-in WiFi" msgstr "" @@ -3574,6 +3593,10 @@ msgstr "negatieve macht terwijl er geen ondersteuning is voor float" msgid "negative shift count" msgstr "negatieve verschuivingstelling (shift count)" +#: shared-bindings/_pixelmap/PixelMap.c +msgid "nested index must be int" +msgstr "" + #: shared-module/sdcardio/SDCard.c msgid "no SD card" msgstr "geen SD kaart" @@ -3607,7 +3630,7 @@ msgstr "geen reset pin beschikbaar" msgid "no response from SD card" msgstr "geen antwoord van SD kaart" -#: ports/espressif/common-hal/esp32_camera/Camera.c py/objobject.c py/runtime.c +#: ports/espressif/common-hal/espcamera/Camera.c py/objobject.c py/runtime.c msgid "no such attribute" msgstr "niet zo'n attribuut" @@ -3743,6 +3766,10 @@ msgstr "alleen bit_depth=16 wordt ondersteund" msgid "only mono is supported" msgstr "" +#: extmod/ulab/code/numpy/create.c +msgid "only ndarrays can be concatenated" +msgstr "" + #: ports/stm/common-hal/audiobusio/PDMIn.c msgid "only oversample=64 is supported" msgstr "" @@ -3753,7 +3780,7 @@ msgid "only sample_rate=16000 is supported" msgstr "alleen sample_rate=16000 wordt ondersteund" #: py/objarray.c py/objstr.c py/objstrunicode.c py/objtuple.c -#: shared-bindings/alarm/SleepMemory.c shared-bindings/coproc/CoprocMemory.c +#: shared-bindings/alarm/SleepMemory.c shared-bindings/memorymap/AddressRange.c #: shared-bindings/nvm/ByteArray.c msgid "only slices with step=1 (aka None) are supported" msgstr "alleen segmenten met step=1 (ook wel None) worden ondersteund" @@ -3969,10 +3996,6 @@ msgstr "de slaapduur mag niet negatief zijn" msgid "slice step can't be zero" msgstr "segmentstap mag niet nul zijn" -#: py/objslice.c -msgid "slice step cannot be zero" -msgstr "segmentstap mag niet nul zijn" - #: py/nativeglue.c msgid "slice unsupported" msgstr "" @@ -4021,10 +4044,6 @@ msgstr "" msgid "start/end indices" msgstr "start/stop indices" -#: shared-bindings/random/__init__.c -msgid "step must be non-zero" -msgstr "step mag geen nul zijn" - #: shared-bindings/random/__init__.c msgid "stop not reachable from start" msgstr "stop is niet bereikbaar vanaf start" @@ -4033,10 +4052,6 @@ msgstr "stop is niet bereikbaar vanaf start" msgid "stream operation not supported" msgstr "stream operatie niet ondersteund" -#: py/objstrunicode.c -msgid "string indices must be integers, not %q" -msgstr "string indices moeten integers zijn, geen %q" - #: py/stream.c msgid "string not supported; use bytes or bytearray" msgstr "string niet ondersteund; gebruik bytes of bytearray" @@ -4069,10 +4084,6 @@ msgstr "syntaxisfout in JSON" msgid "syntax error in uctypes descriptor" msgstr "syntaxisfout in uctypes aanduiding" -#: shared-bindings/time/__init__.c -msgid "time.struct_time() takes a 9-sequence" -msgstr "time.struct_time() accepteert een 9-rij" - #: ports/atmel-samd/common-hal/watchdog/WatchDogTimer.c #: ports/espressif/common-hal/watchdog/WatchDogTimer.c #: ports/nrf/common-hal/watchdog/WatchDogTimer.c @@ -4354,10 +4365,6 @@ msgstr "" msgid "y value out of bounds" msgstr "y-waarde buiten bereik" -#: py/objrange.c -msgid "zero step" -msgstr "nul-stap" - #: extmod/ulab/code/scipy/signal/signal.c msgid "zi must be an ndarray" msgstr "zi moet een ndarray zijn" @@ -4370,6 +4377,76 @@ 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 "" +#~ "\n" +#~ "Please file an issue with the contents of your CIRCUITPY drive at \n" +#~ "https://github.com/adafruit/circuitpython/issues\n" +#~ msgstr "" +#~ "\n" +#~ "Meld een probleem met de inhoud van de CIRCUITPY drive op:\n" +#~ "https://github.com/adafruit/circuitpython/issues\n" + +#~ msgid "CircuitPython was unable to allocate the heap." +#~ msgstr "CircuitPython kon het heap geheugen niet toewijzen." + +#~ msgid "Crash into the HardFault_Handler." +#~ msgstr "Crash naar de HardFault_Handler." + +#~ msgid "Invalid memory access." +#~ msgstr "Ongeldig geheugen adres." + +#~ msgid "Expected a %q" +#~ msgstr "Verwacht een %q" + +#, c-format +#~ msgid "IV must be %d bytes long" +#~ msgstr "IV %d bytes lang zijn" + +#~ msgid "Not settable" +#~ msgstr "Niet instelbaar" + +#~ msgid "expected '%q' but got '%q'" +#~ msgstr "verwachtte '%q' maar ontving '%q'" + +#~ msgid "expected '%q' or '%q' but got '%q'" +#~ msgstr "verwachtte '%q' of '%q' maar ontving '%q'" + +#~ msgid "Read-only object" +#~ msgstr "Alleen-lezen object" + +#~ msgid "At most %d %q may be specified (not %d)" +#~ msgstr "Op zijn meest %d %q mogen worden gespecificeerd (niet %d)" + +#~ msgid "Invalid pins" +#~ msgstr "Ongeldige pinnen" + +#~ msgid "byteorder is not a string" +#~ msgstr "byteorder is geen string" + +#~ msgid "complex division by zero" +#~ msgstr "complexe deling door 0" + +#~ msgid "int() arg 2 must be >= 2 and <= 36" +#~ msgstr "int() argument 2 moet >=2 en <= 36 zijn" + +#~ msgid "long int not supported in this build" +#~ msgstr "long int wordt niet ondersteund in deze build" + +#~ msgid "slice step cannot be zero" +#~ msgstr "segmentstap mag niet nul zijn" + +#~ msgid "step must be non-zero" +#~ msgstr "step mag geen nul zijn" + +#~ msgid "string indices must be integers, not %q" +#~ msgstr "string indices moeten integers zijn, geen %q" + +#~ msgid "time.struct_time() takes a 9-sequence" +#~ msgstr "time.struct_time() accepteert een 9-rij" + +#~ msgid "zero step" +#~ msgstr "nul-stap" + #~ msgid "%q indices must be integers, not %s" #~ msgstr "%q indexen moeten integers zijn, niet %s" diff --git a/locale/pl.po b/locale/pl.po index 22eacea387..6320ff566f 100644 --- a/locale/pl.po +++ b/locale/pl.po @@ -33,12 +33,21 @@ msgstr "" #: supervisor/shared/safe_mode.c msgid "" "\n" -"Please file an issue with the contents of your CIRCUITPY drive at \n" -"https://github.com/adafruit/circuitpython/issues\n" +"Please file an issue with your program at https://github.com/adafruit/" +"circuitpython/issues." msgstr "" + +#: supervisor/shared/safe_mode.c +msgid "" "\n" -"Zgłoś problem z zawartością dysku CIRCUITPY pod adresem\n" -"https://github.com/adafruit/circuitpython/issues\n" +"Press reset to exit safe mode.\n" +msgstr "" + +#: supervisor/shared/safe_mode.c +msgid "" +"\n" +"You are in safe mode because:\n" +msgstr "" #: py/obj.c msgid " File \"%q\"" @@ -70,6 +79,11 @@ msgstr "%%c wymaga int lub char" msgid "%02X" msgstr "" +#: shared-module/os/getenv.c +#, c-format +msgid "%S" +msgstr "" + #: shared-bindings/rgbmatrix/RGBMatrix.c #, c-format msgid "" @@ -85,7 +99,7 @@ msgstr "" #: 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 +#: ports/stm/common-hal/canio/Listener.c ports/stm/common-hal/rtc/RTC.c msgid "%q" msgstr "" @@ -105,13 +119,18 @@ msgstr "" msgid "%q failure: %d" msgstr "%q niepowodzenie: %d" +#: py/argcheck.c +msgid "%q in %q must be of type %q, not %q" +msgstr "" + +#: ports/espressif/common-hal/espulp/ULP.c #: ports/raspberrypi/common-hal/rp2pio/StateMachine.c #: shared-bindings/digitalio/DigitalInOut.c #: shared-bindings/microcontroller/Pin.c msgid "%q in use" msgstr "%q w użyciu" -#: py/obj.c py/objstr.c py/objstrunicode.c +#: py/objstr.c py/objstrunicode.c msgid "%q index out of range" msgstr "%q poza zakresem" @@ -123,7 +142,11 @@ msgstr "" msgid "%q is %q" msgstr "" -#: py/argcheck.c +#: ports/raspberrypi/common-hal/wifi/Radio.c +msgid "%q is read-only for this board" +msgstr "" + +#: py/argcheck.c shared-bindings/usb_hid/Device.c msgid "%q length must be %d" msgstr "" @@ -139,10 +162,6 @@ msgstr "" 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 "" @@ -164,24 +183,20 @@ msgid "%q must be >= %d" msgstr "" #: shared-bindings/analogbufio/BufferedIn.c +msgid "%q must be a bytearray or array of type 'H' or 'B'" +msgstr "" + #: 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" +#: ports/raspberrypi/bindings/cyw43/__init__.c py/argcheck.c py/objexcept.c +#: shared-bindings/canio/CAN.c shared-bindings/digitalio/Pull.c +msgid "%q must be of type %q or %q, not %q" msgstr "" -#: py/argcheck.c -msgid "%q must be an int" -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" +#: py/argcheck.c py/obj.c py/objstrunicode.c +msgid "%q must be of type %q, not %q" msgstr "" #: ports/atmel-samd/common-hal/busio/UART.c @@ -194,7 +209,6 @@ msgstr "" #: ports/atmel-samd/common-hal/pulseio/PulseIn.c #: ports/cxd56/common-hal/pulseio/PulseIn.c -#: ports/espressif/common-hal/coproc/Coproc.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 @@ -206,8 +220,8 @@ msgstr "%q poza zakresem" msgid "%q pin invalid" msgstr "nieprawidłowy pin %q" -#: shared-bindings/usb_hid/Device.c -msgid "%q with a report ID of 0 must be of length 1" +#: py/objrange.c py/objslice.c shared-bindings/random/__init__.c +msgid "%q step cannot be zero" msgstr "" #: py/bc.c py/objnamedtuple.c @@ -307,7 +321,7 @@ msgstr "" msgid "'%s' object doesn't support item deletion" msgstr "" -#: ports/raspberrypi/common-hal/wifi/Radio.c py/runtime.c +#: py/runtime.c msgid "'%s' object has no attribute '%q'" msgstr "'%s' obiekt nie ma atrybutu '%q'" @@ -407,6 +421,10 @@ msgstr "ADC2 jest używany przez WiFi" msgid "Address must be %d bytes long" msgstr "Adres musi mieć %d bajtów" +#: ports/espressif/common-hal/memorymap/AddressRange.c +msgid "Address range not allowed" +msgstr "" + #: ports/espressif/common-hal/canio/CAN.c msgid "All CAN peripherals are in use" msgstr "" @@ -434,7 +452,6 @@ msgid "All SPI peripherals are in use" msgstr "Wszystkie peryferia SPI w użyciu" #: 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 "Wszystkie peryferia UART w użyciu" @@ -487,7 +504,7 @@ msgstr "" msgid "Already have all-matches listener" msgstr "" -#: ports/espressif/common-hal/coproc/__init__.c +#: ports/espressif/common-hal/espulp/ULP.c #: shared-module/memorymonitor/AllocationAlarm.c #: shared-module/memorymonitor/AllocationSize.c msgid "Already running" @@ -498,6 +515,11 @@ msgstr "" msgid "Already scanning for wifi networks" msgstr "" +#: shared-module/os/getenv.c +#, c-format +msgid "An error occurred while retrieving '%s':\n" +msgstr "" + #: ports/stm/common-hal/audiopwmio/PWMAudioOut.c msgid "Another PWMAudioOut is already active" msgstr "" @@ -511,24 +533,16 @@ msgstr "Wysyłanie jest już w toku" msgid "Array must contain halfwords (type 'H')" msgstr "Tablica musi zawierać pół-słowa (typ 'H')" -#: shared-bindings/alarm/SleepMemory.c shared-bindings/coproc/CoprocMemory.c +#: shared-bindings/alarm/SleepMemory.c shared-bindings/memorymap/AddressRange.c #: shared-bindings/nvm/ByteArray.c msgid "Array values should be single bytes." msgstr "Wartości powinny być bajtami." -#: shared-bindings/microcontroller/Pin.c -msgid "At most %d %q may be specified (not %d)" -msgstr "" - #: shared-module/memorymonitor/AllocationAlarm.c #, c-format msgid "Attempt to allocate %d blocks" msgstr "Próba przydzielenia %d bloków" -#: supervisor/shared/safe_mode.c -msgid "Attempted heap allocation when VM not running." -msgstr "" - #: ports/raspberrypi/audio_dma.c msgid "Audio conversion not implemented" msgstr "" @@ -579,20 +593,13 @@ msgid "Bitmap size and bits per value must match" msgstr "" #: supervisor/shared/safe_mode.c -msgid "Boot device must be first device (interface #0)." +msgid "Boot device must be first (interface #0)." msgstr "" #: ports/mimxrt10xx/common-hal/busio/UART.c msgid "Both RX and TX required for flow control" msgstr "Do kontroli przepływu wymagane są zarówno RX, jak i TX" -#: ports/atmel-samd/boards/circuitplayground_express/mpconfigboard.h -#: ports/atmel-samd/boards/circuitplayground_express_crickit/mpconfigboard.h -#: ports/atmel-samd/boards/circuitplayground_express_displayio/mpconfigboard.h -#: ports/atmel-samd/boards/meowmeow/mpconfigboard.h -msgid "Both buttons were pressed at start up.\n" -msgstr "" - #: ports/atmel-samd/common-hal/rotaryio/IncrementalEncoder.c msgid "Both pins must support hardware interrupts" msgstr "Obie nóżki muszą wspierać przerwania sprzętowe" @@ -658,11 +665,6 @@ msgstr "" msgid "Bus pin %d is already in use" msgstr "Nóżka magistrali %d jest w użyciu" -#: ports/espressif/boards/m5stack_core_basic/mpconfigboard.h -#: ports/espressif/boards/m5stack_core_fire/mpconfigboard.h -msgid "Button A was pressed at start up.\n" -msgstr "" - #: shared-bindings/_bleio/UUID.c msgid "Byte buffer must be 16 bytes." msgstr "Bufor musi mieć 16 bajtów." @@ -793,10 +795,6 @@ msgstr "Pisanie do CharacteristicBuffer niewspierane" msgid "CircuitPython core code crashed hard. Whoops!\n" msgstr "" -#: supervisor/shared/safe_mode.c -msgid "CircuitPython was unable to allocate the heap." -msgstr "CircuitPython nie mógł przydzielić sterty." - #: shared-module/bitbangio/I2C.c msgid "Clock stretch too long" msgstr "Rozciągnięcie zegara zbyt duże" @@ -837,10 +835,6 @@ msgstr "Nie można rozpocząć przerwania, RX jest zajęty" msgid "Couldn't allocate decoder" msgstr "Nie udało się przydzielić dekodera" -#: supervisor/shared/safe_mode.c -msgid "Crash into the HardFault_Handler." -msgstr "" - #: ports/stm/common-hal/analogio/AnalogOut.c msgid "DAC Channel Init Error" msgstr "Błąd inicjalizacji kanału DAC" @@ -903,6 +897,10 @@ msgstr "" msgid "Drive mode not used when direction is input." msgstr "Tryb sterowania nieużywany w trybie wejścia." +#: py/obj.c +msgid "During handling of the above exception, another exception occurred:" +msgstr "" + #: shared-bindings/aesio/aes.c msgid "ECB only operates on 16 bytes at a time" msgstr "ECB działa tylko na 16 bajtach naraz" @@ -928,24 +926,16 @@ msgstr "" msgid "Error in regex" msgstr "Błąd w regex" +#: supervisor/shared/safe_mode.c +msgid "Error in safemode.py." +msgstr "" + #: shared-bindings/socketpool/Socket.c shared-bindings/ssl/SSLSocket.c msgid "Error: Failure to bind" msgstr "" -#: py/enum.c shared-bindings/_bleio/__init__.c shared-bindings/aesio/aes.c -#: shared-bindings/alarm/__init__.c shared-bindings/alarm/coproc/CoprocAlarm.c -#: shared-bindings/busio/SPI.c shared-bindings/coproc/Coproc.c -#: shared-bindings/coproc/__init__.c shared-bindings/microcontroller/Pin.c -#: shared-bindings/neopixel_write/__init__.c -msgid "Expected a %q" -msgstr "Oczekiwano %q" - -#: ports/raspberrypi/bindings/cyw43/__init__.c -msgid "Expected a %q or %q" -msgstr "" - #: shared-bindings/alarm/__init__.c -msgid "Expected an %q" +msgid "Expected a kind of %q" msgstr "" #: ports/espressif/common-hal/_bleio/Adapter.c @@ -1013,13 +1003,17 @@ msgid "Failed to write internal flash." msgstr "Nie udało się zapisać wewnętrznej pamięci flash." #: supervisor/shared/safe_mode.c -msgid "Fatal error." +msgid "Fault detected by hardware." msgstr "" #: py/moduerrno.c msgid "File exists" msgstr "Plik istnieje" +#: shared-module/os/getenv.c +msgid "File not found" +msgstr "" + #: ports/atmel-samd/common-hal/canio/Listener.c #: ports/espressif/common-hal/canio/Listener.c #: ports/stm/common-hal/canio/Listener.c @@ -1034,7 +1028,6 @@ msgstr "" msgid "Firmware is invalid" msgstr "" -#: ports/espressif/common-hal/coproc/Coproc.c #: ports/espressif/common-hal/dualbank/__init__.c msgid "Firmware is too big" msgstr "" @@ -1076,6 +1069,8 @@ msgstr "" #: shared-bindings/displayio/Display.c #: shared-bindings/displayio/EPaperDisplay.c #: shared-bindings/framebufferio/FramebufferDisplay.c +#: shared-module/displayio/Display.c +#: shared-module/framebufferio/FramebufferDisplay.c msgid "Group already used" msgstr "Grupa już używana" @@ -1096,6 +1091,15 @@ 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" +#: supervisor/shared/safe_mode.c +msgid "Heap allocation when VM not running." +msgstr "" + +#: supervisor/shared/safe_mode.c +msgid "" +"Heap was corrupted because the stack was too small. Increase stack size." +msgstr "" + #: extmod/vfs_posix_file.c py/objstringio.c msgid "I/O operation on closed file" msgstr "Operacja I/O na zamkniętym pliku" @@ -1113,11 +1117,6 @@ msgstr "" msgid "I2SOut not available" msgstr "I2SOut niedostępne" -#: shared-bindings/aesio/aes.c -#, c-format -msgid "IV must be %d bytes long" -msgstr "IV musi mieć długość %d bajtów" - #: ports/raspberrypi/bindings/rp2pio/StateMachine.c msgid "In-buffer elements must be <= 4 bytes long" msgstr "" @@ -1204,6 +1203,7 @@ msgid "Internal define error" msgstr "" #: ports/espressif/common-hal/paralleldisplay/ParallelBus.c +#: shared-module/os/getenv.c msgid "Internal error" msgstr "" @@ -1216,6 +1216,10 @@ msgstr "Błąd wewnętrzny #%d" msgid "Internal watchdog timer expired." msgstr "" +#: supervisor/shared/safe_mode.c +msgid "Interrupt error." +msgstr "" + #: py/argcheck.c shared-bindings/digitalio/DigitalInOut.c msgid "Invalid %q" msgstr "Nieprawidłowe %q" @@ -1250,6 +1254,11 @@ msgstr "Zły argument" msgid "Invalid bits per value" msgstr "Zła liczba bitów wartości" +#: shared-module/os/getenv.c +#, c-format +msgid "Invalid byte %.*s" +msgstr "" + #: ports/atmel-samd/common-hal/imagecapture/ParallelImageCapture.c #, c-format msgid "Invalid data_pins[%d]" @@ -1259,18 +1268,10 @@ msgstr "" msgid "Invalid format chunk size" msgstr "Zła wielkość fragmentu formatu" -#: supervisor/shared/safe_mode.c -msgid "Invalid memory access." -msgstr "Nieprawidłowy dostęp do pamięci." - #: ports/espressif/common-hal/wifi/Radio.c msgid "Invalid multicast MAC address" msgstr "" -#: shared-bindings/busio/UART.c -msgid "Invalid pins" -msgstr "Złe nóżki" - #: ports/espressif/common-hal/espidf/__init__.c ports/espressif/esp_error.c msgid "Invalid size" msgstr "Nieprawidłowy rozmiar" @@ -1284,10 +1285,18 @@ msgstr "" msgid "Invalid state" msgstr "Nieprawidłowy stan" +#: shared-module/os/getenv.c +msgid "Invalid unicode escape" +msgstr "" + #: 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" +#: shared-module/os/getenv.c +msgid "Key not found" +msgstr "" + #: shared-module/is31fl3741/FrameBuffer.c msgid "LED mappings must match display size" msgstr "" @@ -1394,6 +1403,10 @@ msgstr "" msgid "NVS Error" msgstr "" +#: shared-bindings/socketpool/SocketPool.c +msgid "Name or service not known" +msgstr "" + #: py/qstr.c msgid "Name too long" msgstr "Za długa nazwa" @@ -1508,11 +1521,6 @@ msgstr "Nie określono klucza" msgid "No long integer support" msgstr "" -#: shared-module/usb_hid/__init__.c -#, c-format -msgid "No more than %d HID devices allowed" -msgstr "" - #: shared-bindings/wifi/Radio.c msgid "No network with that ssid" msgstr "" @@ -1548,10 +1556,6 @@ msgstr "Brak pliku/katalogu" msgid "No timer available" msgstr "Brak dostępnego timera" -#: supervisor/shared/safe_mode.c -msgid "Nordic system firmware failure assertion." -msgstr "" - #: ports/nrf/common-hal/_bleio/__init__.c msgid "Nordic system firmware out of memory" msgstr "" @@ -1571,10 +1575,6 @@ msgstr "Nie podłączono" msgid "Not playing" msgstr "Nic nie jest odtwarzane" -#: shared-bindings/_bleio/__init__.c -msgid "Not settable" -msgstr "" - #: ports/espressif/common-hal/paralleldisplay/ParallelBus.c #, c-format msgid "Number of data_pins must be 8 or 16, not %d" @@ -1637,11 +1637,14 @@ msgid "" "%d bpp given" msgstr "" -#: ports/espressif/common-hal/alarm/coproc/CoprocAlarm.c #: ports/espressif/common-hal/alarm/touch/TouchAlarm.c msgid "Only one %q can be set in deep sleep." msgstr "" +#: ports/espressif/common-hal/espulp/ULPAlarm.c +msgid "Only one %q can be set." +msgstr "" + #: ports/espressif/common-hal/i2ctarget/I2CTarget.c #: ports/raspberrypi/common-hal/i2ctarget/I2CTarget.c msgid "Only one address is allowed" @@ -1674,6 +1677,10 @@ msgstr "" msgid "Operation timed out" msgstr "" +#: ports/raspberrypi/common-hal/mdns/Server.c +msgid "Out of MDNS service slots" +msgstr "" + #: ports/espressif/common-hal/espidf/__init__.c ports/espressif/esp_error.c msgid "Out of memory" msgstr "Brak pamięci" @@ -1797,6 +1804,10 @@ msgstr "" msgid "Program size invalid" msgstr "" +#: ports/espressif/common-hal/espulp/ULP.c +msgid "Program too long" +msgstr "" + #: shared-bindings/digitalio/DigitalInOut.c msgid "Pull not used when direction is output." msgstr "Podciągnięcie nieużywane w trybie wyjścia." @@ -1836,8 +1847,9 @@ msgstr "Brak obsługi RTC" msgid "Random number generation error" msgstr "Błąd generowania liczb losowych" +#: shared-bindings/_bleio/__init__.c #: shared-bindings/memorymonitor/AllocationSize.c -#: shared-bindings/pulseio/PulseIn.c +#: shared-bindings/pulseio/PulseIn.c shared-module/displayio/Bitmap.c msgid "Read-only" msgstr "Tylko do odczytu" @@ -1845,10 +1857,6 @@ msgstr "Tylko do odczytu" msgid "Read-only filesystem" msgstr "System plików tylko do odczytu" -#: shared-module/displayio/Bitmap.c -msgid "Read-only object" -msgstr "Obiekt tylko do odczytu" - #: ports/espressif/common-hal/espidf/__init__.c ports/espressif/esp_error.c msgid "Received response was invalid" msgstr "Otrzymana odpowiedź była nieprawidłowa" @@ -1941,7 +1949,7 @@ msgstr "" msgid "Sleep Memory not available" msgstr "" -#: shared-bindings/alarm/SleepMemory.c shared-bindings/coproc/CoprocMemory.c +#: shared-bindings/alarm/SleepMemory.c shared-bindings/memorymap/AddressRange.c #: shared-bindings/nvm/ByteArray.c msgid "Slice and value different lengths." msgstr "Fragment i wartość są różnych długości." @@ -1978,6 +1986,10 @@ msgstr "" msgid "Stereo right must be on PWM channel B" msgstr "" +#: ports/raspberrypi/common-hal/wifi/Radio.c +msgid "Stopping AP is not supported." +msgstr "" + #: 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" @@ -1995,35 +2007,11 @@ msgid "Temperature read timed out" msgstr "" #: supervisor/shared/safe_mode.c -msgid "The BOOT button was pressed at start up.\n" +msgid "The `microcontroller` module was used to boot into safe mode." msgstr "" -#: supervisor/shared/safe_mode.c -msgid "" -"The CircuitPython heap was corrupted because the stack was too small.\n" -"Increase the stack size if you know how. If not:" -msgstr "" - -#: ports/espressif/boards/adafruit_feather_esp32_v2/mpconfigboard.h -msgid "The SW38 button was pressed at start up.\n" -msgstr "" - -#: ports/espressif/boards/hardkernel_odroid_go/mpconfigboard.h -msgid "The VOLUME button was pressed at start up.\n" -msgstr "" - -#: supervisor/shared/safe_mode.c -msgid "" -"The `microcontroller` module was used to boot into safe mode. Press reset to " -"exit safe mode." -msgstr "" - -#: ports/espressif/boards/m5stack_atom_lite/mpconfigboard.h -msgid "The central button was pressed at start up.\n" -msgstr "" - -#: ports/nrf/boards/aramcon2_badge/mpconfigboard.h -msgid "The left button was pressed at start up.\n" +#: py/obj.c +msgid "The above exception was the direct cause of the following exception:" msgstr "" #: shared-bindings/rgbmatrix/RGBMatrix.c @@ -2031,10 +2019,7 @@ msgid "The length of rgb_pins must be 6, 12, 18, 24, or 30" msgstr "" #: supervisor/shared/safe_mode.c -msgid "" -"The microcontroller's power dipped. Make sure your power supply provides\n" -"enough power for the whole circuit and press reset (after ejecting " -"CIRCUITPY)." +msgid "The power dipped. Make sure you are providing enough power." msgstr "" #: shared-module/audiomixer/MixerVoice.c @@ -2053,6 +2038,10 @@ msgstr "Sample rate nie pasuje do miksera" msgid "The sample's signedness does not match the mixer's" msgstr "Znak nie pasuje do miksera" +#: supervisor/shared/safe_mode.c +msgid "Third-party firmware fatal error." +msgstr "" + #: shared-module/imagecapture/ParallelImageCapture.c msgid "This microcontroller does not support continuous capture." msgstr "" @@ -2085,10 +2074,6 @@ msgstr "" msgid "Timeout is too long: Maximum timeout length is %d seconds" msgstr "" -#: supervisor/shared/safe_mode.c -msgid "To exit, please reset the board without requesting safe mode." -msgstr "" - #: ports/atmel-samd/common-hal/audiobusio/I2SOut.c msgid "Too many channels in sample" msgstr "" @@ -2133,6 +2118,10 @@ msgstr "" msgid "UART init" msgstr "" +#: ports/raspberrypi/common-hal/busio/UART.c +msgid "UART peripheral in use" +msgstr "" + #: ports/stm/common-hal/busio/UART.c msgid "UART re-init" msgstr "" @@ -2180,6 +2169,10 @@ msgstr "UUID nie jest typu str, int lub bytes" msgid "Unable to allocate buffers for signed conversion" msgstr "Nie udała się alokacja buforów do konwersji ze znakiem" +#: supervisor/shared/safe_mode.c +msgid "Unable to allocate the heap." +msgstr "" + #: ports/espressif/common-hal/busio/I2C.c msgid "Unable to create lock" msgstr "" @@ -2203,11 +2196,12 @@ msgid "Unable to read color palette data" msgstr "Nie można odczytać danych palety" #: ports/espressif/common-hal/mdns/Server.c +#: ports/raspberrypi/common-hal/mdns/Server.c msgid "Unable to start mDNS query" msgstr "" -#: shared-bindings/coproc/CoprocMemory.c -msgid "Unable to write" +#: shared-bindings/memorymap/AddressRange.c +msgid "Unable to write to address." msgstr "" #: shared-bindings/nvm/ByteArray.c @@ -2278,6 +2272,7 @@ msgid "Unkown error code %d" msgstr "" #: shared-bindings/adafruit_pixelbuf/PixelBuf.c +#: shared-module/_pixelmap/PixelMap.c #, c-format msgid "Unmatched number of items on RHS (expected %d, got %d)." msgstr "Zła liczba obiektów po prawej stronie (oczekiwano %d, jest %d)." @@ -2362,6 +2357,18 @@ msgstr "" msgid "Wi-Fi: " msgstr "" +#: ports/raspberrypi/common-hal/wifi/Radio.c +msgid "Wifi is in access point mode." +msgstr "" + +#: ports/raspberrypi/common-hal/wifi/Radio.c +msgid "Wifi is in station mode." +msgstr "" + +#: ports/raspberrypi/common-hal/wifi/Radio.c +msgid "Wifi is not enabled" +msgstr "" + #: main.c msgid "Woken up by alarm.\n" msgstr "" @@ -2371,13 +2378,48 @@ msgstr "" msgid "Writes not supported on Characteristic" msgstr "" -#: supervisor/shared/safe_mode.c -msgid "You are in safe mode because:\n" +#: ports/atmel-samd/boards/circuitplayground_express/mpconfigboard.h +#: ports/atmel-samd/boards/circuitplayground_express_crickit/mpconfigboard.h +#: ports/atmel-samd/boards/circuitplayground_express_displayio/mpconfigboard.h +#: ports/atmel-samd/boards/meowmeow/mpconfigboard.h +msgid "You pressed both buttons at start up." +msgstr "" + +#: ports/espressif/boards/m5stack_core_basic/mpconfigboard.h +#: ports/espressif/boards/m5stack_core_fire/mpconfigboard.h +#: ports/espressif/boards/m5stack_stick_c/mpconfigboard.h +msgid "You pressed button A at start up." msgstr "" #: supervisor/shared/safe_mode.c -msgid "" -"You pressed the reset button during boot. Press again to exit safe mode." +msgid "You pressed the BOOT button at start up" +msgstr "" + +#: ports/espressif/boards/adafruit_feather_esp32_v2/mpconfigboard.h +msgid "You pressed the SW38 button at start up." +msgstr "" + +#: ports/espressif/boards/hardkernel_odroid_go/mpconfigboard.h +msgid "You pressed the VOLUME button at start up." +msgstr "" + +#: ports/espressif/boards/m5stack_atom_echo/mpconfigboard.h +#: ports/espressif/boards/m5stack_atom_lite/mpconfigboard.h +#: ports/espressif/boards/m5stack_atom_matrix/mpconfigboard.h +#: ports/espressif/boards/m5stack_atom_u/mpconfigboard.h +msgid "You pressed the central button at start up." +msgstr "" + +#: ports/nrf/boards/aramcon2_badge/mpconfigboard.h +msgid "You pressed the left button at start up." +msgstr "" + +#: supervisor/shared/safe_mode.c +msgid "You pressed the reset button during boot." +msgstr "" + +#: supervisor/shared/micropython.c +msgid "[truncated due to length]" msgstr "" #: py/objtype.c @@ -2449,8 +2491,12 @@ msgstr "" msgid "array has too many dimensions" msgstr "" +#: extmod/ulab/code/ndarray.c +msgid "array is too big" +msgstr "" + #: py/objarray.c shared-bindings/alarm/SleepMemory.c -#: shared-bindings/coproc/CoprocMemory.c shared-bindings/nvm/ByteArray.c +#: shared-bindings/memorymap/AddressRange.c shared-bindings/nvm/ByteArray.c msgid "array/bytes required on right side" msgstr "tablica/bytes wymagane po prawej stronie" @@ -2543,10 +2589,6 @@ msgstr "zbyt mały bufor" msgid "buffer too small for requested bytes" msgstr "" -#: shared-bindings/adafruit_pixelbuf/PixelBuf.c -msgid "byteorder is not a string" -msgstr "" - #: py/objarray.c msgid "bytes length not a multiple of item size" msgstr "" @@ -2588,14 +2630,10 @@ msgstr "przypisanie do wyrażenia" msgid "can't cancel self" msgstr "" -#: py/obj.c py/objint.c shared-module/adafruit_pixelbuf/PixelBuf.c +#: py/obj.c py/objint.c py/runtime.c shared-module/adafruit_pixelbuf/PixelBuf.c msgid "can't convert %q to %q" msgstr "nie można dokonać konwersji %q na %q" -#: py/runtime.c -msgid "can't convert %q to int" -msgstr "" - #: py/obj.c #, c-format msgid "can't convert %s to complex" @@ -2677,6 +2715,10 @@ msgstr "" msgid "can't set attribute" msgstr "nie można ustawić atrybutu" +#: py/runtime.c +msgid "can't set attribute '%q'" +msgstr "" + #: py/emitnative.c msgid "can't store '%q'" msgstr "nie można zapisać '%q'" @@ -2779,10 +2821,6 @@ msgstr "kolor musi być pomiędzy 0x000000 a 0xffffff" msgid "comparison of int and uint" msgstr "" -#: py/objcomplex.c -msgid "complex division by zero" -msgstr "zespolone dzielenie przez zero" - #: py/objfloat.c py/parsenum.c msgid "complex values not supported" msgstr "wartości zespolone nieobsługiwane" @@ -2886,12 +2924,11 @@ msgstr "" msgid "div/mod not implemented for uint" msgstr "" -#: py/objfloat.c py/objint_mpz.c +#: extmod/ulab/code/numpy/create.c msgid "divide by zero" msgstr "" -#: py/modmath.c py/objint_longlong.c py/runtime.c -#: shared-bindings/math/__init__.c +#: py/runtime.c msgid "division by zero" msgstr "dzielenie przez zero" @@ -2932,9 +2969,9 @@ msgstr "" msgid "error = 0x%08lX" msgstr "błąd = 0x%08lX" -#: ports/espressif/common-hal/esp32_camera/Camera.c +#: ports/espressif/common-hal/espcamera/Camera.c msgid "" -"esp32_camera.Camera requires reserved PSRAM to be configured. See the " +"espcamera.Camera requires reserved PSRAM to be configured. See the " "documentation for instructions." msgstr "" @@ -2942,14 +2979,6 @@ msgstr "" msgid "exceptions must derive from BaseException" msgstr "wyjątki muszą dziedziczyć po BaseException" -#: shared-bindings/canio/CAN.c -msgid "expected '%q' but got '%q'" -msgstr "" - -#: shared-bindings/canio/CAN.c -msgid "expected '%q' or '%q' but got '%q'" -msgstr "" - #: py/objstr.c msgid "expected ':' after format specifier" msgstr "oczekiwano ':' po specyfikacji formatu" @@ -3048,10 +3077,6 @@ msgstr "font musi mieć 2048 bajtów długości" msgid "format requires a dict" msgstr "format wymaga słownika" -#: shared-bindings/microcontroller/Processor.c -msgid "frequency is read-only for this board" -msgstr "" - #: py/objdeque.c msgid "full" msgstr "pełny" @@ -3164,8 +3189,12 @@ msgstr "złe wypełnienie" msgid "index is out of bounds" msgstr "indeks jest poza zakresem" +#: shared-bindings/_pixelmap/PixelMap.c +msgid "index must be tuple or int" +msgstr "" + #: extmod/ulab/code/numpy/numerical.c extmod/ulab/code/ulab_tools.c -#: ports/espressif/common-hal/pulseio/PulseIn.c py/obj.c +#: ports/espressif/common-hal/pulseio/PulseIn.c #: shared-bindings/bitmaptools/__init__.c msgid "index out of range" msgstr "indeks poza zakresem" @@ -3263,10 +3292,6 @@ msgstr "wektory wejściowe muszą być równej długości" msgid "inputs are not iterable" msgstr "" -#: py/parsenum.c -msgid "int() arg 2 must be >= 2 and <= 36" -msgstr "argument 2 do int() busi być pomiędzy 2 a 36" - #: extmod/ulab/code/numpy/approx.c msgid "interp is defined for 1D iterables of equal length" msgstr "" @@ -3323,7 +3348,7 @@ msgstr "zły klucz" msgid "invalid micropython decorator" msgstr "zły dekorator micropythona" -#: ports/espressif/common-hal/esp32_camera/Camera.c +#: ports/espressif/common-hal/espcamera/Camera.c msgid "invalid setting" msgstr "" @@ -3348,10 +3373,6 @@ msgstr "zła składnia dla liczby całkowitej w bazie %d" msgid "invalid syntax for number" msgstr "zła składnia dla liczby" -#: py/objexcept.c -msgid "invalid traceback" -msgstr "" - #: py/objtype.c msgid "issubclass() arg 1 must be a class" msgstr "argument 1 dla issubclass() musi być klasą" @@ -3408,19 +3429,17 @@ msgstr "local '%q' użyty zanim typ jest znany" msgid "local variable referenced before assignment" msgstr "zmienna lokalna użyta przed przypisaniem" -#: py/objint.c -msgid "long int not supported in this build" -msgstr "long int jest nieobsługiwany" - #: ports/espressif/common-hal/canio/CAN.c msgid "loopback + silent mode not supported by peripheral" msgstr "" #: ports/espressif/common-hal/mdns/Server.c +#: ports/raspberrypi/common-hal/mdns/Server.c msgid "mDNS already initialized" msgstr "" #: ports/espressif/common-hal/mdns/Server.c +#: ports/raspberrypi/common-hal/mdns/Server.c msgid "mDNS only works with built-in WiFi" msgstr "" @@ -3549,6 +3568,10 @@ msgstr "ujemna potęga, ale brak obsługi liczb zmiennoprzecinkowych" msgid "negative shift count" msgstr "ujemne przesunięcie" +#: shared-bindings/_pixelmap/PixelMap.c +msgid "nested index must be int" +msgstr "" + #: shared-module/sdcardio/SDCard.c msgid "no SD card" msgstr "" @@ -3582,7 +3605,7 @@ msgstr "" msgid "no response from SD card" msgstr "" -#: ports/espressif/common-hal/esp32_camera/Camera.c py/objobject.c py/runtime.c +#: ports/espressif/common-hal/espcamera/Camera.c py/objobject.c py/runtime.c msgid "no such attribute" msgstr "nie ma takiego atrybutu" @@ -3718,6 +3741,10 @@ msgstr "obsługiwane jest tylko bit_depth=16" msgid "only mono is supported" msgstr "" +#: extmod/ulab/code/numpy/create.c +msgid "only ndarrays can be concatenated" +msgstr "" + #: ports/stm/common-hal/audiobusio/PDMIn.c msgid "only oversample=64 is supported" msgstr "" @@ -3728,7 +3755,7 @@ msgid "only sample_rate=16000 is supported" msgstr "obsługiwane jest tylko sample_rate=16000" #: py/objarray.c py/objstr.c py/objstrunicode.c py/objtuple.c -#: shared-bindings/alarm/SleepMemory.c shared-bindings/coproc/CoprocMemory.c +#: shared-bindings/alarm/SleepMemory.c shared-bindings/memorymap/AddressRange.c #: shared-bindings/nvm/ByteArray.c msgid "only slices with step=1 (aka None) are supported" msgstr "tylko fragmenty ze step=1 (lub None) są wspierane" @@ -3945,10 +3972,6 @@ msgstr "okres snu musi być nieujemny" msgid "slice step can't be zero" msgstr "" -#: py/objslice.c -msgid "slice step cannot be zero" -msgstr "zerowy krok" - #: py/nativeglue.c msgid "slice unsupported" msgstr "" @@ -3997,10 +4020,6 @@ msgstr "" msgid "start/end indices" msgstr "początkowe/końcowe indeksy" -#: shared-bindings/random/__init__.c -msgid "step must be non-zero" -msgstr "step nie może być zerowe" - #: shared-bindings/random/__init__.c msgid "stop not reachable from start" msgstr "stop nie jest osiągalne ze start" @@ -4009,10 +4028,6 @@ msgstr "stop nie jest osiągalne ze start" msgid "stream operation not supported" msgstr "operacja na strumieniu nieobsługiwana" -#: py/objstrunicode.c -msgid "string indices must be integers, not %q" -msgstr "" - #: py/stream.c msgid "string not supported; use bytes or bytearray" msgstr "łańcuchy nieobsługiwane; użyj bytes lub bytearray" @@ -4045,10 +4060,6 @@ msgstr "błąd składni w JSON" msgid "syntax error in uctypes descriptor" msgstr "błąd składni w deskryptorze uctypes" -#: shared-bindings/time/__init__.c -msgid "time.struct_time() takes a 9-sequence" -msgstr "time.struct_time() wymaga 9-elementowej sekwencji" - #: ports/atmel-samd/common-hal/watchdog/WatchDogTimer.c #: ports/espressif/common-hal/watchdog/WatchDogTimer.c #: ports/nrf/common-hal/watchdog/WatchDogTimer.c @@ -4330,10 +4341,6 @@ msgstr "" msgid "y value out of bounds" msgstr "y poza zakresem" -#: py/objrange.c -msgid "zero step" -msgstr "zerowy krok" - #: extmod/ulab/code/scipy/signal/signal.c msgid "zi must be an ndarray" msgstr "" @@ -4346,6 +4353,55 @@ msgstr "" msgid "zi must be of shape (n_section, 2)" msgstr "" +#~ msgid "" +#~ "\n" +#~ "Please file an issue with the contents of your CIRCUITPY drive at \n" +#~ "https://github.com/adafruit/circuitpython/issues\n" +#~ msgstr "" +#~ "\n" +#~ "Zgłoś problem z zawartością dysku CIRCUITPY pod adresem\n" +#~ "https://github.com/adafruit/circuitpython/issues\n" + +#~ msgid "CircuitPython was unable to allocate the heap." +#~ msgstr "CircuitPython nie mógł przydzielić sterty." + +#~ msgid "Invalid memory access." +#~ msgstr "Nieprawidłowy dostęp do pamięci." + +#~ msgid "Expected a %q" +#~ msgstr "Oczekiwano %q" + +#, c-format +#~ msgid "IV must be %d bytes long" +#~ msgstr "IV musi mieć długość %d bajtów" + +#~ msgid "Read-only object" +#~ msgstr "Obiekt tylko do odczytu" + +#~ msgid "Invalid pins" +#~ msgstr "Złe nóżki" + +#~ msgid "complex division by zero" +#~ msgstr "zespolone dzielenie przez zero" + +#~ msgid "int() arg 2 must be >= 2 and <= 36" +#~ msgstr "argument 2 do int() busi być pomiędzy 2 a 36" + +#~ msgid "long int not supported in this build" +#~ msgstr "long int jest nieobsługiwany" + +#~ msgid "slice step cannot be zero" +#~ msgstr "zerowy krok" + +#~ msgid "step must be non-zero" +#~ msgstr "step nie może być zerowe" + +#~ msgid "time.struct_time() takes a 9-sequence" +#~ msgstr "time.struct_time() wymaga 9-elementowej sekwencji" + +#~ msgid "zero step" +#~ msgstr "zerowy krok" + #~ msgid "%q indices must be integers, not %s" #~ msgstr "%q indeks musi być liczbą całkowitą, a nie %s" diff --git a/locale/pt_BR.po b/locale/pt_BR.po index c3f7475167..eab698b723 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-11-11 18:49+0000\n" +"PO-Revision-Date: 2023-02-17 20:38+0000\n" "Last-Translator: Wellington Terumi Uemura \n" "Language-Team: \n" "Language: pt_BR\n" @@ -14,7 +14,7 @@ msgstr "" "Content-Type: text/plain; charset=UTF-8\n" "Content-Transfer-Encoding: 8bit\n" "Plural-Forms: nplurals=2; plural=n > 1;\n" -"X-Generator: Weblate 4.15-dev\n" +"X-Generator: Weblate 4.16-dev\n" #: main.c msgid "" @@ -35,12 +35,28 @@ msgstr "" #: supervisor/shared/safe_mode.c msgid "" "\n" -"Please file an issue with the contents of your CIRCUITPY drive at \n" -"https://github.com/adafruit/circuitpython/issues\n" +"Please file an issue with your program at https://github.com/adafruit/" +"circuitpython/issues." msgstr "" "\n" -"Registre um problema com o conteúdo do seu controlador no CIRCUITPY\n" -"https://github.com/adafruit/circuitpython/issues\n" +"Relate o problema com seu programa em https://github.com/adafruit/" +"circuitpython/issues." + +#: supervisor/shared/safe_mode.c +msgid "" +"\n" +"Press reset to exit safe mode.\n" +msgstr "" +"\n" +"Pressione reset para sair do modo de segurança.\n" + +#: supervisor/shared/safe_mode.c +msgid "" +"\n" +"You are in safe mode because:\n" +msgstr "" +"\n" +"Você está no modo de segurança porque:\n" #: py/obj.c msgid " File \"%q\"" @@ -72,6 +88,11 @@ msgstr "%%c requer int ou char" msgid "%02X" msgstr "%02X" +#: shared-module/os/getenv.c +#, c-format +msgid "%S" +msgstr "" + #: shared-bindings/rgbmatrix/RGBMatrix.c #, c-format msgid "" @@ -89,7 +110,7 @@ msgstr "" #: 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 +#: ports/stm/common-hal/canio/Listener.c ports/stm/common-hal/rtc/RTC.c msgid "%q" msgstr "%q" @@ -109,13 +130,18 @@ msgstr "%q contém pinos duplicados" msgid "%q failure: %d" msgstr "%q falha: %d" +#: py/argcheck.c +msgid "%q in %q must be of type %q, not %q" +msgstr "%q em %q deve ser do tipo %q e não %q" + +#: ports/espressif/common-hal/espulp/ULP.c #: ports/raspberrypi/common-hal/rp2pio/StateMachine.c #: shared-bindings/digitalio/DigitalInOut.c #: shared-bindings/microcontroller/Pin.c msgid "%q in use" msgstr "%q em uso" -#: py/obj.c py/objstr.c py/objstrunicode.c +#: py/objstr.c py/objstrunicode.c msgid "%q index out of range" msgstr "O índice %q está fora do intervalo" @@ -127,7 +153,11 @@ msgstr "a inicialização do %q falhou" msgid "%q is %q" msgstr "%q é %q" -#: py/argcheck.c +#: ports/raspberrypi/common-hal/wifi/Radio.c +msgid "%q is read-only for this board" +msgstr "%q é de somente leitura para esta placa" + +#: py/argcheck.c shared-bindings/usb_hid/Device.c msgid "%q length must be %d" msgstr "O comprimento de %q deve ser %d" @@ -143,10 +173,6 @@ msgstr "o comprimento de %q deve ser <= %d" 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" @@ -168,25 +194,21 @@ msgid "%q must be >= %d" msgstr "o %q deve ser >= %d" #: shared-bindings/analogbufio/BufferedIn.c +msgid "%q must be a bytearray or array of type 'H' or 'B'" +msgstr "%q deve ser um bytearray ou uma matriz do tipo 'H' ou 'B'" + #: 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" +#: ports/raspberrypi/bindings/cyw43/__init__.c py/argcheck.c py/objexcept.c +#: shared-bindings/canio/CAN.c shared-bindings/digitalio/Pull.c +msgid "%q must be of type %q or %q, not %q" +msgstr "%q deve ser do tipo %q ou %q e não %q" -#: 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" -msgstr "%q deve ser do tipo %q" - -#: shared-bindings/digitalio/Pull.c -msgid "%q must be of type %q or None" -msgstr "%q deve ser do tipo %q ou nenhum" +#: py/argcheck.c py/obj.c py/objstrunicode.c +msgid "%q must be of type %q, not %q" +msgstr "%q deve ser do tipo %q e não %q" #: ports/atmel-samd/common-hal/busio/UART.c msgid "%q must be power of 2" @@ -198,7 +220,6 @@ msgstr "%q fora dos limites" #: ports/atmel-samd/common-hal/pulseio/PulseIn.c #: ports/cxd56/common-hal/pulseio/PulseIn.c -#: ports/espressif/common-hal/coproc/Coproc.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 @@ -210,9 +231,9 @@ msgstr "%q fora do alcance" msgid "%q pin invalid" msgstr "%q pino inválido" -#: 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" +#: py/objrange.c py/objslice.c shared-bindings/random/__init__.c +msgid "%q step cannot be zero" +msgstr "A etapa %q não pode ser zero" #: py/bc.c py/objnamedtuple.c msgid "%q() takes %d positional arguments but %d were given" @@ -311,7 +332,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" -#: ports/raspberrypi/common-hal/wifi/Radio.c py/runtime.c +#: py/runtime.c msgid "'%s' object has no attribute '%q'" msgstr "O objeto '%s' não possui o atributo '%q'" @@ -415,6 +436,10 @@ 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" +#: ports/espressif/common-hal/memorymap/AddressRange.c +msgid "Address range not allowed" +msgstr "Intervalo de endereços não permitido" + #: ports/espressif/common-hal/canio/CAN.c msgid "All CAN peripherals are in use" msgstr "Todos os periféricos CAN estão em uso" @@ -442,7 +467,6 @@ msgid "All SPI peripherals are in use" msgstr "Todos os periféricos SPI estão em uso" #: 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 "Todos os periféricos UART estão em uso" @@ -495,7 +519,7 @@ msgstr "Já está anunciando." msgid "Already have all-matches listener" msgstr "Já há um ouvinte com todas as correspondências" -#: ports/espressif/common-hal/coproc/__init__.c +#: ports/espressif/common-hal/espulp/ULP.c #: shared-module/memorymonitor/AllocationAlarm.c #: shared-module/memorymonitor/AllocationSize.c msgid "Already running" @@ -506,6 +530,11 @@ msgstr "Já está em execução" msgid "Already scanning for wifi networks" msgstr "Já está em busca das redes de wifi" +#: shared-module/os/getenv.c +#, c-format +msgid "An error occurred while retrieving '%s':\n" +msgstr "Ocorreu um erro ao recuperar '%s':\n" + #: ports/stm/common-hal/audiopwmio/PWMAudioOut.c msgid "Another PWMAudioOut is already active" msgstr "Um outro PWMAudioOut já está ativo" @@ -519,25 +548,16 @@ msgstr "Outro envio já está ativo" msgid "Array must contain halfwords (type 'H')" msgstr "Array deve conter meias palavras (tipo 'H')" -#: shared-bindings/alarm/SleepMemory.c shared-bindings/coproc/CoprocMemory.c +#: shared-bindings/alarm/SleepMemory.c shared-bindings/memorymap/AddressRange.c #: shared-bindings/nvm/ByteArray.c msgid "Array values should be single bytes." msgstr "Os valores das matrizes devem ser bytes simples." -#: shared-bindings/microcontroller/Pin.c -msgid "At most %d %q may be specified (not %d)" -msgstr "Pelo menos %d %q pode ser definido (não %d)" - #: shared-module/memorymonitor/AllocationAlarm.c #, c-format msgid "Attempt to allocate %d blocks" msgstr "Tentativa de alocar %d blocos" -#: supervisor/shared/safe_mode.c -msgid "Attempted heap allocation when VM not running." -msgstr "" -"Tentativa de alocação das pilhas quando o VM não estiver em funcionamento." - #: ports/raspberrypi/audio_dma.c msgid "Audio conversion not implemented" msgstr "A conversão de áudio ainda não foi implementada" @@ -590,22 +610,13 @@ msgid "Bitmap size and bits per value must match" msgstr "O tamanho do bitmap e os bits por valor devem coincidir" #: supervisor/shared/safe_mode.c -msgid "Boot device must be first device (interface #0)." -msgstr "" -"O dispositivo de inicialização deve ser o primeiro dispositivo (interface " -"#0)." +msgid "Boot device must be first (interface #0)." +msgstr "O dispositivo de inicialização deve ser o primeiro (interface #0)." #: ports/mimxrt10xx/common-hal/busio/UART.c msgid "Both RX and TX required for flow control" msgstr "Ambos os RX e TX são necessários para o controle do fluxo" -#: ports/atmel-samd/boards/circuitplayground_express/mpconfigboard.h -#: ports/atmel-samd/boards/circuitplayground_express_crickit/mpconfigboard.h -#: ports/atmel-samd/boards/circuitplayground_express_displayio/mpconfigboard.h -#: ports/atmel-samd/boards/meowmeow/mpconfigboard.h -msgid "Both buttons were pressed at start up.\n" -msgstr "Ambos os botões foram pressionados na inicialização.\n" - #: ports/atmel-samd/common-hal/rotaryio/IncrementalEncoder.c msgid "Both pins must support hardware interrupts" msgstr "Ambos os pinos devem suportar interrupções de hardware" @@ -671,11 +682,6 @@ msgstr "Os buffers devem ter o mesmo tamanho" msgid "Bus pin %d is already in use" msgstr "O pino bus %d já está em uso" -#: ports/espressif/boards/m5stack_core_basic/mpconfigboard.h -#: ports/espressif/boards/m5stack_core_fire/mpconfigboard.h -msgid "Button A was pressed at start up.\n" -msgstr "O botão A foi pressionado na inicialização.\n" - #: shared-bindings/_bleio/UUID.c msgid "Byte buffer must be 16 bytes." msgstr "O buffer deve ter 16 bytes." @@ -812,10 +818,6 @@ msgstr "Escrita CharacteristicBuffer não informada" msgid "CircuitPython core code crashed hard. Whoops!\n" msgstr "O núcleo principal do CircuitPython falhou feio. Ops!\n" -#: supervisor/shared/safe_mode.c -msgid "CircuitPython was unable to allocate the heap." -msgstr "O CircuitPython não conseguiu alocar o heap." - #: shared-module/bitbangio/I2C.c msgid "Clock stretch too long" msgstr "Clock se estendeu por tempo demais" @@ -855,10 +857,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" -#: supervisor/shared/safe_mode.c -msgid "Crash into the HardFault_Handler." -msgstr "Falha no HardFault_Handler." - #: ports/stm/common-hal/analogio/AnalogOut.c msgid "DAC Channel Init Error" msgstr "Erro de Inicialização do Canal DAC" @@ -921,6 +919,10 @@ msgstr "Feito" msgid "Drive mode not used when direction is input." msgstr "O modo do controlador não é usado quando a direção for inserida." +#: py/obj.c +msgid "During handling of the above exception, another exception occurred:" +msgstr "Outra exceção ocorreu durante o tratamento da exceção acima:" + #: shared-bindings/aesio/aes.c msgid "ECB only operates on 16 bytes at a time" msgstr "O BCE opera apenas com 16 bytes por vez" @@ -946,25 +948,17 @@ msgstr "Houve um erro no fluxo MIDI na posição %d" msgid "Error in regex" msgstr "Erro no regex" +#: supervisor/shared/safe_mode.c +msgid "Error in safemode.py." +msgstr "Erro no safemode.py." + #: shared-bindings/socketpool/Socket.c shared-bindings/ssl/SSLSocket.c msgid "Error: Failure to bind" msgstr "Erro: Falha na vinculação" -#: py/enum.c shared-bindings/_bleio/__init__.c shared-bindings/aesio/aes.c -#: shared-bindings/alarm/__init__.c shared-bindings/alarm/coproc/CoprocAlarm.c -#: shared-bindings/busio/SPI.c shared-bindings/coproc/Coproc.c -#: shared-bindings/coproc/__init__.c shared-bindings/microcontroller/Pin.c -#: shared-bindings/neopixel_write/__init__.c -msgid "Expected a %q" -msgstr "Esperado um" - -#: ports/raspberrypi/bindings/cyw43/__init__.c -msgid "Expected a %q or %q" -msgstr "Era esperado um %q ou %q" - #: shared-bindings/alarm/__init__.c -msgid "Expected an %q" -msgstr "Esperava-se um(a) %q" +msgid "Expected a kind of %q" +msgstr "Era esperado uma espécie de %q" #: ports/espressif/common-hal/_bleio/Adapter.c #: ports/nrf/common-hal/_bleio/Adapter.c @@ -1031,13 +1025,17 @@ msgid "Failed to write internal flash." msgstr "Falha ao gravar o flash interno." #: supervisor/shared/safe_mode.c -msgid "Fatal error." -msgstr "Erro fatal." +msgid "Fault detected by hardware." +msgstr "Falha detectada pelo hardware." #: py/moduerrno.c msgid "File exists" msgstr "Arquivo já existe" +#: shared-module/os/getenv.c +msgid "File not found" +msgstr "Arquivo não encontrado" + #: ports/atmel-samd/common-hal/canio/Listener.c #: ports/espressif/common-hal/canio/Listener.c #: ports/stm/common-hal/canio/Listener.c @@ -1052,7 +1050,6 @@ msgstr "O firmware está duplicado" msgid "Firmware is invalid" msgstr "O firmware é inválido" -#: ports/espressif/common-hal/coproc/Coproc.c #: ports/espressif/common-hal/dualbank/__init__.c msgid "Firmware is too big" msgstr "O firmware é muito grande" @@ -1098,6 +1095,8 @@ msgstr "Falha Genérica" #: shared-bindings/displayio/Display.c #: shared-bindings/displayio/EPaperDisplay.c #: shared-bindings/framebufferio/FramebufferDisplay.c +#: shared-module/displayio/Display.c +#: shared-module/framebufferio/FramebufferDisplay.c msgid "Group already used" msgstr "O grupo já está em uso" @@ -1118,6 +1117,17 @@ 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" +#: supervisor/shared/safe_mode.c +msgid "Heap allocation when VM not running." +msgstr "Alocação dinâmica de variáveis quando a VM não estiver funcionando." + +#: supervisor/shared/safe_mode.c +msgid "" +"Heap was corrupted because the stack was too small. Increase stack size." +msgstr "" +"A área de alocação dinâmica de variáveis foi corrompida porque a pilha de " +"funções era muito pequena. Aumente o tamanho da pilha." + #: extmod/vfs_posix_file.c py/objstringio.c msgid "I/O operation on closed file" msgstr "Operação I/O no arquivo fechado" @@ -1135,11 +1145,6 @@ msgstr "Periférico I2C em uso" msgid "I2SOut not available" msgstr "O I2SOut não está disponível" -#: shared-bindings/aesio/aes.c -#, c-format -msgid "IV must be %d bytes long" -msgstr "O IV deve ter %d bytes de comprimento" - #: ports/raspberrypi/bindings/rp2pio/StateMachine.c msgid "In-buffer elements must be <= 4 bytes long" msgstr "Os elementos In-buffer devem ter um comprimento de <= 4 bytes" @@ -1232,6 +1237,7 @@ msgid "Internal define error" msgstr "Erro interno de definição" #: ports/espressif/common-hal/paralleldisplay/ParallelBus.c +#: shared-module/os/getenv.c msgid "Internal error" msgstr "Erro interno" @@ -1244,6 +1250,10 @@ msgstr "Erro interno #%d" msgid "Internal watchdog timer expired." msgstr "O temporizador do watchdog interno expirou." +#: supervisor/shared/safe_mode.c +msgid "Interrupt error." +msgstr "Erro de interrupção." + #: py/argcheck.c shared-bindings/digitalio/DigitalInOut.c msgid "Invalid %q" msgstr "%q Inválido" @@ -1278,6 +1288,11 @@ msgstr "Argumento inválido" msgid "Invalid bits per value" msgstr "Os valores por bits são inválidos" +#: shared-module/os/getenv.c +#, c-format +msgid "Invalid byte %.*s" +msgstr "Byte %.*s inválido" + #: ports/atmel-samd/common-hal/imagecapture/ParallelImageCapture.c #, c-format msgid "Invalid data_pins[%d]" @@ -1287,18 +1302,10 @@ msgstr "data_pins[%d] inválido" msgid "Invalid format chunk size" msgstr "Tamanho do pedaço de formato inválido" -#: supervisor/shared/safe_mode.c -msgid "Invalid memory access." -msgstr "O acesso da memória é inválido." - #: ports/espressif/common-hal/wifi/Radio.c msgid "Invalid multicast MAC address" msgstr "Endereço MAC multicast inválido" -#: shared-bindings/busio/UART.c -msgid "Invalid pins" -msgstr "Pinos inválidos" - #: ports/espressif/common-hal/espidf/__init__.c ports/espressif/esp_error.c msgid "Invalid size" msgstr "Tamanho inválido" @@ -1312,10 +1319,18 @@ msgstr "Soquete inválido para o TLS" msgid "Invalid state" msgstr "Estado inválido" +#: shared-module/os/getenv.c +msgid "Invalid unicode escape" +msgstr "Escape unicode inválido" + #: 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" +#: shared-module/os/getenv.c +msgid "Key not found" +msgstr "Chave não encontrada" + #: shared-module/is31fl3741/FrameBuffer.c msgid "LED mappings must match display size" msgstr "Os mapeamentos do led devem corresponder ao tamanho do display" @@ -1422,6 +1437,10 @@ msgstr "O salto NLR falhou. Possível corrupção da memória." msgid "NVS Error" msgstr "Erro NVS" +#: shared-bindings/socketpool/SocketPool.c +msgid "Name or service not known" +msgstr "Nome ou serviço desconhecido" + #: py/qstr.c msgid "Name too long" msgstr "Nome muito longo" @@ -1536,11 +1555,6 @@ msgstr "Nenhuma chave foi definida" msgid "No long integer support" msgstr "Não há compatibilidade com inteiro longo" -#: shared-module/usb_hid/__init__.c -#, c-format -msgid "No more than %d HID devices allowed" -msgstr "Não são permitidos mais do que %d dispositivos HID" - #: shared-bindings/wifi/Radio.c msgid "No network with that ssid" msgstr "Não há rede com este ssid" @@ -1578,10 +1592,6 @@ msgstr "Este arquivo/diretório não existe" msgid "No timer available" msgstr "Não há um temporizador disponível" -#: supervisor/shared/safe_mode.c -msgid "Nordic system firmware failure assertion." -msgstr "Declaração de falha do firmware do sistema nórdico." - #: ports/nrf/common-hal/_bleio/__init__.c msgid "Nordic system firmware out of memory" msgstr "O firmware do sistema nórdico está sem memória" @@ -1601,10 +1611,6 @@ msgstr "Não Conectado" msgid "Not playing" msgstr "Não está jogando" -#: shared-bindings/_bleio/__init__.c -msgid "Not settable" -msgstr "Não configurável" - #: ports/espressif/common-hal/paralleldisplay/ParallelBus.c #, c-format msgid "Number of data_pins must be 8 or 16, not %d" @@ -1672,11 +1678,14 @@ msgstr "" "São compatíveis apenas os BMPs monocromáticos, indexados em 4bpp ou 8bpp e " "16bpp ou superior: determinado %d bpp" -#: ports/espressif/common-hal/alarm/coproc/CoprocAlarm.c #: ports/espressif/common-hal/alarm/touch/TouchAlarm.c msgid "Only one %q can be set in deep sleep." msgstr "Apenas um %q pode ser colocado em hibernação profunda." +#: ports/espressif/common-hal/espulp/ULPAlarm.c +msgid "Only one %q can be set." +msgstr "Apenas um %q pode ser definido." + #: ports/espressif/common-hal/i2ctarget/I2CTarget.c #: ports/raspberrypi/common-hal/i2ctarget/I2CTarget.c msgid "Only one address is allowed" @@ -1709,6 +1718,10 @@ msgstr "A operação ou o recurso não é suportado" msgid "Operation timed out" msgstr "A operação expirou" +#: ports/raspberrypi/common-hal/mdns/Server.c +msgid "Out of MDNS service slots" +msgstr "Sem slots do serviço MDNS" + #: ports/espressif/common-hal/espidf/__init__.c ports/espressif/esp_error.c msgid "Out of memory" msgstr "Sem memória" @@ -1842,6 +1855,10 @@ msgstr "O programa faz OUT sem carregar o OSR" msgid "Program size invalid" msgstr "O tamanho do programa é inválido" +#: ports/espressif/common-hal/espulp/ULP.c +msgid "Program too long" +msgstr "Programa muito longo" + #: 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." @@ -1881,8 +1898,9 @@ msgstr "O RTC não é suportado nesta placa" msgid "Random number generation error" msgstr "Houve um erro na geração do número aleatório" +#: shared-bindings/_bleio/__init__.c #: shared-bindings/memorymonitor/AllocationSize.c -#: shared-bindings/pulseio/PulseIn.c +#: shared-bindings/pulseio/PulseIn.c shared-module/displayio/Bitmap.c msgid "Read-only" msgstr "Somente leitura" @@ -1890,10 +1908,6 @@ msgstr "Somente leitura" msgid "Read-only filesystem" msgstr "Sistema de arquivos somente leitura" -#: shared-module/displayio/Bitmap.c -msgid "Read-only object" -msgstr "Objeto de leitura apenas" - #: ports/espressif/common-hal/espidf/__init__.c ports/espressif/esp_error.c msgid "Received response was invalid" msgstr "A resposta recebida foi inválida" @@ -1986,7 +2000,7 @@ msgstr "O tamanho não é suportado" msgid "Sleep Memory not available" msgstr "Sleep memory não está disponível" -#: shared-bindings/alarm/SleepMemory.c shared-bindings/coproc/CoprocMemory.c +#: shared-bindings/alarm/SleepMemory.c shared-bindings/memorymap/AddressRange.c #: shared-bindings/nvm/ByteArray.c msgid "Slice and value different lengths." msgstr "Fatie e avalie os diferentes comprimentos." @@ -2023,6 +2037,10 @@ 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" +#: ports/raspberrypi/common-hal/wifi/Radio.c +msgid "Stopping AP is not supported." +msgstr "Não há suporte para a interrupção do AP." + #: 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" @@ -2040,56 +2058,22 @@ msgid "Temperature read timed out" msgstr "A leitura da temperatura expirou" #: supervisor/shared/safe_mode.c -msgid "The BOOT button was pressed at start up.\n" -msgstr "O botão BOOT foi pressionado na inicialização.\n" - -#: supervisor/shared/safe_mode.c -msgid "" -"The CircuitPython heap was corrupted because the stack was too small.\n" -"Increase the stack size if you know how. If not:" +msgid "The `microcontroller` module was used to boot into safe mode." msgstr "" -"A área de alocação dinâmica de variáveis (heap) do CircuitPython foi " -"corrompido pois a pilha era muito pequena.\n" -"Aumente o tamanho da pilha se souber como. Senão:" +"O módulo `microcontroller` foi usado para inicializar em modo de segurança." -#: ports/espressif/boards/adafruit_feather_esp32_v2/mpconfigboard.h -msgid "The SW38 button was pressed at start up.\n" -msgstr "O botão SW38 foi pressionado na inicialização.\n" - -#: ports/espressif/boards/hardkernel_odroid_go/mpconfigboard.h -msgid "The VOLUME button was pressed at start up.\n" -msgstr "O botão VOLUME foi pressionado na inicialização.\n" - -#: supervisor/shared/safe_mode.c -msgid "" -"The `microcontroller` module was used to boot into safe mode. Press reset to " -"exit safe mode." -msgstr "" -"O módulo `microcontrolador` foi utilizado para iniciar em modo seguro. " -"Pressione reset para encerrar do modo de segurança." - -#: ports/espressif/boards/m5stack_atom_lite/mpconfigboard.h -msgid "The central button was pressed at start up.\n" -msgstr "O botão central foi pressionado na inicialização.\n" - -#: ports/nrf/boards/aramcon2_badge/mpconfigboard.h -msgid "The left button was pressed at start up.\n" -msgstr "O botão esquerdo foi pressionado na inicialização.\n" +#: py/obj.c +msgid "The above exception was the direct cause of the following exception:" +msgstr "A exceção acima foi a causa direta da seguinte exceção:" #: shared-bindings/rgbmatrix/RGBMatrix.c msgid "The length of rgb_pins must be 6, 12, 18, 24, or 30" msgstr "O comprimento dos rgb_pins devem ser 6, 12, 18, 24, ou 30" #: supervisor/shared/safe_mode.c -msgid "" -"The microcontroller's power dipped. Make sure your power supply provides\n" -"enough power for the whole circuit and press reset (after ejecting " -"CIRCUITPY)." +msgid "The power dipped. Make sure you are providing enough power." msgstr "" -"O alimentação do micro controlador diminuiu. Certifique-se de que a sua " -"fonte de alimentação fornece\n" -"corrente suficiente para todo o circuito e pressione reset (depois de ejetar " -"o CIRCUITPY)." +"A alimentação foi reduzida. Certifique-se de fornecer energia suficiente." #: shared-module/audiomixer/MixerVoice.c msgid "The sample's bits_per_sample does not match the mixer's" @@ -2107,6 +2091,10 @@ msgstr "A taxa de amostragem da amostra não coincide com a do mixer" msgid "The sample's signedness does not match the mixer's" msgstr "A amostragem \"signedness\" não coincide com a do mixer" +#: supervisor/shared/safe_mode.c +msgid "Third-party firmware fatal error." +msgstr "Erro fatal no firmware de terceiros." + #: shared-module/imagecapture/ParallelImageCapture.c msgid "This microcontroller does not support continuous capture." msgstr "Este microcontrolador não tem suporte para captura contínua." @@ -2143,10 +2131,6 @@ msgstr "" "O tempo limite é long demais: O comprimento máximo do tempo limite é de %d " "segundos" -#: supervisor/shared/safe_mode.c -msgid "To exit, please reset the board without requesting safe mode." -msgstr "Para sair, reinicie a placa sem solicitar o modo de segurança." - #: ports/atmel-samd/common-hal/audiobusio/I2SOut.c msgid "Too many channels in sample" msgstr "Muitos canais na amostra" @@ -2191,6 +2175,10 @@ msgstr "descontinuar o início UART" msgid "UART init" msgstr "inicialização do UART" +#: ports/raspberrypi/common-hal/busio/UART.c +msgid "UART peripheral in use" +msgstr "" + #: ports/stm/common-hal/busio/UART.c msgid "UART re-init" msgstr "Reinicialização do UART" @@ -2239,6 +2227,10 @@ msgstr "O valor UUID não é um buffer str, int ou byte" msgid "Unable to allocate buffers for signed conversion" msgstr "Não é possível alocar buffers para conversão assinada" +#: supervisor/shared/safe_mode.c +msgid "Unable to allocate the heap." +msgstr "Não é possível alocar a área de alocação dinâmica de variáveis." + #: ports/espressif/common-hal/busio/I2C.c msgid "Unable to create lock" msgstr "Não é possível criar um lock" @@ -2262,12 +2254,13 @@ msgid "Unable to read color palette data" msgstr "Não foi possível ler os dados da paleta de cores" #: ports/espressif/common-hal/mdns/Server.c +#: ports/raspberrypi/common-hal/mdns/Server.c msgid "Unable to start mDNS query" msgstr "Não é possível iniciar a consulta mDNS" -#: shared-bindings/coproc/CoprocMemory.c -msgid "Unable to write" -msgstr "Não é possível escrever" +#: shared-bindings/memorymap/AddressRange.c +msgid "Unable to write to address." +msgstr "Não é possível gravar no endereço." #: shared-bindings/nvm/ByteArray.c msgid "Unable to write to nvm." @@ -2337,6 +2330,7 @@ msgid "Unkown error code %d" msgstr "Código de erro desconhecido %d" #: shared-bindings/adafruit_pixelbuf/PixelBuf.c +#: shared-module/_pixelmap/PixelMap.c #, c-format msgid "Unmatched number of items on RHS (expected %d, got %d)." msgstr "Quantidade inigualável de itens no RHS (%d esperado, obteve %d)." @@ -2432,6 +2426,18 @@ msgstr "" msgid "Wi-Fi: " msgstr "Wi-Fi: " +#: ports/raspberrypi/common-hal/wifi/Radio.c +msgid "Wifi is in access point mode." +msgstr "O Wi-Fi está em modo de ponto de acesso." + +#: ports/raspberrypi/common-hal/wifi/Radio.c +msgid "Wifi is in station mode." +msgstr "O Wi-Fi está em modo estação." + +#: ports/raspberrypi/common-hal/wifi/Radio.c +msgid "Wifi is not enabled" +msgstr "O Wi-Fi não está ativado" + #: main.c msgid "Woken up by alarm.\n" msgstr "Foi despertado através do alarme.\n" @@ -2441,16 +2447,49 @@ msgstr "Foi despertado através do alarme.\n" msgid "Writes not supported on Characteristic" msgstr "A escrita não é compatível na Característica" -#: supervisor/shared/safe_mode.c -msgid "You are in safe mode because:\n" -msgstr "Você está no modo de segurança pois:\n" +#: ports/atmel-samd/boards/circuitplayground_express/mpconfigboard.h +#: ports/atmel-samd/boards/circuitplayground_express_crickit/mpconfigboard.h +#: ports/atmel-samd/boards/circuitplayground_express_displayio/mpconfigboard.h +#: ports/atmel-samd/boards/meowmeow/mpconfigboard.h +msgid "You pressed both buttons at start up." +msgstr "Você pressionou os dois botões durante a inicialização." + +#: ports/espressif/boards/m5stack_core_basic/mpconfigboard.h +#: ports/espressif/boards/m5stack_core_fire/mpconfigboard.h +#: ports/espressif/boards/m5stack_stick_c/mpconfigboard.h +msgid "You pressed button A at start up." +msgstr "Você pressionou o botão A na inicialização." #: supervisor/shared/safe_mode.c -msgid "" -"You pressed the reset button during boot. Press again to exit safe mode." -msgstr "" -"Você pressionou o botão reset durante a inicialização. Pressione-o novamente " -"para sair do modo de segurança." +msgid "You pressed the BOOT button at start up" +msgstr "Você pressionou o botão BOOT na inicialização" + +#: ports/espressif/boards/adafruit_feather_esp32_v2/mpconfigboard.h +msgid "You pressed the SW38 button at start up." +msgstr "Você pressionou o botão SW38 na inicialização." + +#: ports/espressif/boards/hardkernel_odroid_go/mpconfigboard.h +msgid "You pressed the VOLUME button at start up." +msgstr "Você pressionou o botão VOLUME na inicialização." + +#: ports/espressif/boards/m5stack_atom_echo/mpconfigboard.h +#: ports/espressif/boards/m5stack_atom_lite/mpconfigboard.h +#: ports/espressif/boards/m5stack_atom_matrix/mpconfigboard.h +#: ports/espressif/boards/m5stack_atom_u/mpconfigboard.h +msgid "You pressed the central button at start up." +msgstr "Você pressionou o botão central na inicialização." + +#: ports/nrf/boards/aramcon2_badge/mpconfigboard.h +msgid "You pressed the left button at start up." +msgstr "Você pressionou o botão esquerdo na inicialização." + +#: supervisor/shared/safe_mode.c +msgid "You pressed the reset button during boot." +msgstr "Você pressionou o botão de reinicialização durante a inicialização." + +#: supervisor/shared/micropython.c +msgid "[truncated due to length]" +msgstr "[truncado devido ao comprimento]" #: py/objtype.c msgid "__init__() should return None" @@ -2521,8 +2560,12 @@ msgstr "a matriz e comprimento do índice devem ser iguais" msgid "array has too many dimensions" msgstr "a matriz possui muitas dimensões" +#: extmod/ulab/code/ndarray.c +msgid "array is too big" +msgstr "a array é grande demais" + #: py/objarray.c shared-bindings/alarm/SleepMemory.c -#: shared-bindings/coproc/CoprocMemory.c shared-bindings/nvm/ByteArray.c +#: shared-bindings/memorymap/AddressRange.c shared-bindings/nvm/ByteArray.c msgid "array/bytes required on right side" msgstr "matriz/bytes são necessários no lado direito" @@ -2615,10 +2658,6 @@ msgstr "o buffer é muito pequeno" msgid "buffer too small for requested bytes" msgstr "o buffer é pequeno demais para os bytes requisitados" -#: shared-bindings/adafruit_pixelbuf/PixelBuf.c -msgid "byteorder is not a string" -msgstr "a ordem dos bytes não é uma cadeia de caracteres" - #: 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" @@ -2660,14 +2699,10 @@ 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-module/adafruit_pixelbuf/PixelBuf.c +#: py/obj.c py/objint.c py/runtime.c shared-module/adafruit_pixelbuf/PixelBuf.c msgid "can't convert %q to %q" msgstr "não é possível converter %q para %q" -#: py/runtime.c -msgid "can't convert %q to int" -msgstr "Não é possível converter %q para int" - #: py/obj.c #, c-format msgid "can't convert %s to complex" @@ -2751,6 +2786,10 @@ msgstr "não é possível definir o tamanho de 512 blocos" msgid "can't set attribute" msgstr "não é possível definir o atributo" +#: py/runtime.c +msgid "can't set attribute '%q'" +msgstr "não é possível definir o atributo '%q'" + #: py/emitnative.c msgid "can't store '%q'" msgstr "não é possível armazenar '%q'" @@ -2857,10 +2896,6 @@ msgstr "cor deve estar entre 0x000000 e 0xffffff" msgid "comparison of int and uint" msgstr "comparação de int e uint" -#: py/objcomplex.c -msgid "complex division by zero" -msgstr "divisão complexa por zero" - #: py/objfloat.c py/parsenum.c msgid "complex values not supported" msgstr "os valores complexos não compatíveis" @@ -2966,12 +3001,11 @@ msgstr "as dimensões não coincidem" msgid "div/mod not implemented for uint" msgstr "div/mod não implementado para uint" -#: py/objfloat.c py/objint_mpz.c +#: extmod/ulab/code/numpy/create.c msgid "divide by zero" msgstr "divido por zero" -#: py/modmath.c py/objint_longlong.c py/runtime.c -#: shared-bindings/math/__init__.c +#: py/runtime.c msgid "division by zero" msgstr "divisão por zero" @@ -3012,26 +3046,18 @@ msgstr "O epoch_time não é compatível com esta placa" msgid "error = 0x%08lX" msgstr "erro = 0x%08lX" -#: ports/espressif/common-hal/esp32_camera/Camera.c +#: ports/espressif/common-hal/espcamera/Camera.c msgid "" -"esp32_camera.Camera requires reserved PSRAM to be configured. See the " +"espcamera.Camera requires reserved PSRAM to be configured. See the " "documentation for instructions." msgstr "" -"esp32_camera.Camera requer que uma reserva PSRAM seja configurada. Consulte " -"a documentação para obter mais informações." +"O espcamera.Camera requer que o PSRAM seja reservado para que possa ser " +"configurado. Consulte a documentação para obter mais informações." #: py/runtime.c msgid "exceptions must derive from BaseException" msgstr "as exceções devem derivar a partir do BaseException" -#: shared-bindings/canio/CAN.c -msgid "expected '%q' but got '%q'" -msgstr "o retorno esperado era '%q', porém obteve '%q'" - -#: shared-bindings/canio/CAN.c -msgid "expected '%q' or '%q' but got '%q'" -msgstr "o retorno esperado era '%q' ou '%q', porém obteve '%q'" - #: py/objstr.c msgid "expected ':' after format specifier" msgstr "é esperado ':' após o especificador do formato" @@ -3130,10 +3156,6 @@ msgstr "a fonte deve ter 2048 bytes de comprimento" msgid "format requires a dict" msgstr "formato requer um dict" -#: shared-bindings/microcontroller/Processor.c -msgid "frequency is read-only for this board" -msgstr "nesta placa, a frequência é de apenas leitura" - #: py/objdeque.c msgid "full" msgstr "cheio" @@ -3246,8 +3268,12 @@ msgstr "preenchimento incorreto" msgid "index is out of bounds" msgstr "o índice está fora dos limites" +#: shared-bindings/_pixelmap/PixelMap.c +msgid "index must be tuple or int" +msgstr "o índice deve ser tupla ou int" + #: extmod/ulab/code/numpy/numerical.c extmod/ulab/code/ulab_tools.c -#: ports/espressif/common-hal/pulseio/PulseIn.c py/obj.c +#: ports/espressif/common-hal/pulseio/PulseIn.c #: shared-bindings/bitmaptools/__init__.c msgid "index out of range" msgstr "Índice fora do intervalo" @@ -3346,10 +3372,6 @@ msgstr "os vetores da entrada devem ter o mesmo comprimento" msgid "inputs are not iterable" msgstr "as entradas não são iteráveis" -#: py/parsenum.c -msgid "int() arg 2 must be >= 2 and <= 36" -msgstr "int() arg 2 deve ser >= 2 e <= 36" - #: extmod/ulab/code/numpy/approx.c msgid "interp is defined for 1D iterables of equal length" msgstr "o interp é definido para iteráveis 1D com comprimento igual" @@ -3406,7 +3428,7 @@ msgstr "chave inválida" msgid "invalid micropython decorator" msgstr "o decorador micropython é inválido" -#: ports/espressif/common-hal/esp32_camera/Camera.c +#: ports/espressif/common-hal/espcamera/Camera.c msgid "invalid setting" msgstr "configuração inválida" @@ -3431,10 +3453,6 @@ msgstr "sintaxe inválida para o número inteiro com base %d" msgid "invalid syntax for number" msgstr "sintaxe inválida para o número" -#: py/objexcept.c -msgid "invalid traceback" -msgstr "rastreamento inválido" - #: py/objtype.c msgid "issubclass() arg 1 must be a class" msgstr "issubclass() arg 1 deve ser uma classe" @@ -3494,19 +3512,17 @@ msgstr "o local '%q' usado antes do tipo conhecido" msgid "local variable referenced before assignment" msgstr "a variável local referenciada antes da atribuição" -#: py/objint.c -msgid "long int not supported in this build" -msgstr "o long int não é suportado nesta compilação" - #: ports/espressif/common-hal/canio/CAN.c msgid "loopback + silent mode not supported by peripheral" msgstr "o loopback + o modo silencioso não é suportado pelo periférico" #: ports/espressif/common-hal/mdns/Server.c +#: ports/raspberrypi/common-hal/mdns/Server.c msgid "mDNS already initialized" msgstr "O mDNS já foi inicializado" #: ports/espressif/common-hal/mdns/Server.c +#: ports/raspberrypi/common-hal/mdns/Server.c msgid "mDNS only works with built-in WiFi" msgstr "O mDNS só funciona com WiFi integrado" @@ -3637,6 +3653,10 @@ msgstr "potência negativa sem suporte de flutuação" msgid "negative shift count" msgstr "contagem de turnos negativos" +#: shared-bindings/_pixelmap/PixelMap.c +msgid "nested index must be int" +msgstr "o índice aninhado deve ser int" + #: shared-module/sdcardio/SDCard.c msgid "no SD card" msgstr "nenhum cartão SD" @@ -3670,7 +3690,7 @@ msgstr "nenhum pino de redefinição está disponível" msgid "no response from SD card" msgstr "não houve resposta do cartão SD" -#: ports/espressif/common-hal/esp32_camera/Camera.c py/objobject.c py/runtime.c +#: ports/espressif/common-hal/espcamera/Camera.c py/objobject.c py/runtime.c msgid "no such attribute" msgstr "não há tal atributo" @@ -3806,6 +3826,10 @@ msgstr "apenas bit_depth = 16 é compatível" msgid "only mono is supported" msgstr "Apenas o mono é compatível" +#: extmod/ulab/code/numpy/create.c +msgid "only ndarrays can be concatenated" +msgstr "somente os ndarrays podem ser concatenados" + #: ports/stm/common-hal/audiobusio/PDMIn.c msgid "only oversample=64 is supported" msgstr "apenas oversample=64 é compatível" @@ -3816,7 +3840,7 @@ msgid "only sample_rate=16000 is supported" msgstr "apenas sample_rate = 16000 é compatível" #: py/objarray.c py/objstr.c py/objstrunicode.c py/objtuple.c -#: shared-bindings/alarm/SleepMemory.c shared-bindings/coproc/CoprocMemory.c +#: shared-bindings/alarm/SleepMemory.c shared-bindings/memorymap/AddressRange.c #: shared-bindings/nvm/ByteArray.c msgid "only slices with step=1 (aka None) are supported" msgstr "" @@ -4037,10 +4061,6 @@ msgstr "a duração do sleep não deve ser negativo" msgid "slice step can't be zero" msgstr "a etapa da fatia não pode ser zero" -#: py/objslice.c -msgid "slice step cannot be zero" -msgstr "a etapa da fatia não pode ser zero" - #: py/nativeglue.c msgid "slice unsupported" msgstr "fatia não suportada" @@ -4089,10 +4109,6 @@ msgstr "o source_bitmap deve ter o value_count de 8" msgid "start/end indices" msgstr "os índices de início/fim" -#: shared-bindings/random/__init__.c -msgid "step must be non-zero" -msgstr "o passo deve ser diferente de zero" - #: shared-bindings/random/__init__.c msgid "stop not reachable from start" msgstr "stop não está acessível a partir do início" @@ -4101,10 +4117,6 @@ msgstr "stop não está acessível a partir do início" msgid "stream operation not supported" msgstr "a operação do fluxo não é compatível" -#: py/objstrunicode.c -msgid "string indices must be integers, not %q" -msgstr "a sequência dos índices devem ser inteiros, não %q" - #: py/stream.c msgid "string not supported; use bytes or bytearray" msgstr "a string não é compatível; use bytes ou bytearray" @@ -4137,10 +4149,6 @@ msgstr "erro de sintaxe no JSON" msgid "syntax error in uctypes descriptor" msgstr "houve um erro de sintaxe no descritor uctypes" -#: shared-bindings/time/__init__.c -msgid "time.struct_time() takes a 9-sequence" -msgstr "time.struct_time() leva uma sequência com 9" - #: ports/atmel-samd/common-hal/watchdog/WatchDogTimer.c #: ports/espressif/common-hal/watchdog/WatchDogTimer.c #: ports/nrf/common-hal/watchdog/WatchDogTimer.c @@ -4422,10 +4430,6 @@ msgstr "o xTaskCreate falhou" msgid "y value out of bounds" msgstr "o valor y está fora dos limites" -#: py/objrange.c -msgid "zero step" -msgstr "passo zero" - #: extmod/ulab/code/scipy/signal/signal.c msgid "zi must be an ndarray" msgstr "zi deve ser um ndarray" @@ -4438,6 +4442,199 @@ 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 "" +#~ "\n" +#~ "Please file an issue with the contents of your CIRCUITPY drive at \n" +#~ "https://github.com/adafruit/circuitpython/issues\n" +#~ msgstr "" +#~ "\n" +#~ "Registre um problema com o conteúdo do seu controlador no CIRCUITPY\n" +#~ "https://github.com/adafruit/circuitpython/issues\n" + +#~ msgid "Attempted heap allocation when VM not running." +#~ msgstr "" +#~ "Tentativa de alocação das pilhas quando o VM não estiver em funcionamento." + +#~ msgid "Boot device must be first device (interface #0)." +#~ msgstr "" +#~ "O dispositivo de inicialização deve ser o primeiro dispositivo (interface " +#~ "#0)." + +#~ msgid "Both buttons were pressed at start up.\n" +#~ msgstr "Ambos os botões foram pressionados na inicialização.\n" + +#~ msgid "Button A was pressed at start up.\n" +#~ msgstr "O botão A foi pressionado na inicialização.\n" + +#~ msgid "CircuitPython was unable to allocate the heap." +#~ msgstr "O CircuitPython não conseguiu alocar o heap." + +#~ msgid "Crash into the HardFault_Handler." +#~ msgstr "Falha no HardFault_Handler." + +#~ msgid "Fatal error." +#~ msgstr "Erro fatal." + +#~ msgid "Invalid memory access." +#~ msgstr "O acesso da memória é inválido." + +#~ msgid "Nordic system firmware failure assertion." +#~ msgstr "Declaração de falha do firmware do sistema nórdico." + +#~ msgid "The BOOT button was pressed at start up.\n" +#~ msgstr "O botão BOOT foi pressionado na inicialização.\n" + +#~ msgid "" +#~ "The CircuitPython heap was corrupted because the stack was too small.\n" +#~ "Increase the stack size if you know how. If not:" +#~ msgstr "" +#~ "A área de alocação dinâmica de variáveis (heap) do CircuitPython foi " +#~ "corrompido pois a pilha era muito pequena.\n" +#~ "Aumente o tamanho da pilha se souber como. Senão:" + +#~ msgid "The SW38 button was pressed at start up.\n" +#~ msgstr "O botão SW38 foi pressionado na inicialização.\n" + +#~ msgid "The VOLUME button was pressed at start up.\n" +#~ msgstr "O botão VOLUME foi pressionado na inicialização.\n" + +#~ msgid "" +#~ "The `microcontroller` module was used to boot into safe mode. Press reset " +#~ "to exit safe mode." +#~ msgstr "" +#~ "O módulo `microcontrolador` foi utilizado para iniciar em modo seguro. " +#~ "Pressione reset para encerrar do modo de segurança." + +#~ msgid "The central button was pressed at start up.\n" +#~ msgstr "O botão central foi pressionado na inicialização.\n" + +#~ msgid "The left button was pressed at start up.\n" +#~ msgstr "O botão esquerdo foi pressionado na inicialização.\n" + +#~ msgid "" +#~ "The microcontroller's power dipped. Make sure your power supply provides\n" +#~ "enough power for the whole circuit and press reset (after ejecting " +#~ "CIRCUITPY)." +#~ msgstr "" +#~ "O alimentação do micro controlador diminuiu. Certifique-se de que a sua " +#~ "fonte de alimentação fornece\n" +#~ "corrente suficiente para todo o circuito e pressione reset (depois de " +#~ "ejetar o CIRCUITPY)." + +#~ msgid "To exit, please reset the board without requesting safe mode." +#~ msgstr "Para sair, reinicie a placa sem solicitar o modo de segurança." + +#~ msgid "You are in safe mode because:\n" +#~ msgstr "Você está no modo de segurança pois:\n" + +#~ msgid "" +#~ "You pressed the reset button during boot. Press again to exit safe mode." +#~ msgstr "" +#~ "Você pressionou o botão reset durante a inicialização. Pressione-o " +#~ "novamente para sair do modo de segurança." + +#~ msgid "" +#~ "esp32_camera.Camera requires reserved PSRAM to be configured. See the " +#~ "documentation for instructions." +#~ msgstr "" +#~ "esp32_camera.Camera requer que uma reserva PSRAM seja configurada. " +#~ "Consulte a documentação para obter mais informações." + +#~ msgid "%q must be of type %q" +#~ msgstr "%q deve ser do tipo %q" + +#~ msgid "%q must be of type %q or None" +#~ msgstr "%q deve ser do tipo %q ou nenhum" + +#~ msgid "Expected a %q" +#~ msgstr "Esperado um" + +#~ msgid "Expected a %q or %q" +#~ msgstr "Era esperado um %q ou %q" + +#~ msgid "Expected an %q" +#~ msgstr "Esperava-se um(a) %q" + +#, c-format +#~ msgid "IV must be %d bytes long" +#~ msgstr "O IV deve ter %d bytes de comprimento" + +#~ msgid "Not settable" +#~ msgstr "Não configurável" + +#~ msgid "expected '%q' but got '%q'" +#~ msgstr "o retorno esperado era '%q', porém obteve '%q'" + +#~ msgid "expected '%q' or '%q' but got '%q'" +#~ msgstr "o retorno esperado era '%q' ou '%q', porém obteve '%q'" + +#~ msgid "Read-only object" +#~ msgstr "Objeto de leitura apenas" + +#~ msgid "frequency is read-only for this board" +#~ msgstr "nesta placa, a frequência é de apenas leitura" + +#~ msgid "Pins 21+ not supported from ULP" +#~ msgstr "Os pinos 21+ não são suportados pelo ULP" + +#~ msgid "Unable to write" +#~ msgstr "Não é possível escrever" + +#~ msgid "%q length must be >= 1" +#~ msgstr "o comprimento %q deve ser >=1" + +#~ msgid "%q must be a string" +#~ msgstr "%q deve ser uma string" + +#~ msgid "%q must be an int" +#~ msgstr "%q deve ser um inteiro" + +#~ 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" + +#~ msgid "At most %d %q may be specified (not %d)" +#~ msgstr "Pelo menos %d %q pode ser definido (não %d)" + +#~ msgid "Invalid pins" +#~ msgstr "Pinos inválidos" + +#, c-format +#~ msgid "No more than %d HID devices allowed" +#~ msgstr "Não são permitidos mais do que %d dispositivos HID" + +#~ msgid "byteorder is not a string" +#~ msgstr "a ordem dos bytes não é uma cadeia de caracteres" + +#~ msgid "can't convert %q to int" +#~ msgstr "Não é possível converter %q para int" + +#~ msgid "complex division by zero" +#~ msgstr "divisão complexa por zero" + +#~ msgid "int() arg 2 must be >= 2 and <= 36" +#~ msgstr "int() arg 2 deve ser >= 2 e <= 36" + +#~ msgid "long int not supported in this build" +#~ msgstr "o long int não é suportado nesta compilação" + +#~ msgid "slice step cannot be zero" +#~ msgstr "a etapa da fatia não pode ser zero" + +#~ msgid "step must be non-zero" +#~ msgstr "o passo deve ser diferente de zero" + +#~ msgid "string indices must be integers, not %q" +#~ msgstr "a sequência dos índices devem ser inteiros, não %q" + +#~ msgid "time.struct_time() takes a 9-sequence" +#~ msgstr "time.struct_time() leva uma sequência com 9" + +#~ msgid "zero step" +#~ msgstr "passo zero" + +#~ msgid "invalid traceback" +#~ msgstr "rastreamento inválido" + #~ msgid "%q indices must be integers, not %s" #~ msgstr "Os índices %q devem ser inteiros, e não %s" diff --git a/locale/ru.po b/locale/ru.po index a575f05a40..7f73a33083 100644 --- a/locale/ru.po +++ b/locale/ru.po @@ -7,8 +7,8 @@ msgid "" msgstr "" "Project-Id-Version: PACKAGE VERSION\n" "Report-Msgid-Bugs-To: \n" -"PO-Revision-Date: 2022-04-06 13:37+0000\n" -"Last-Translator: Jeff Epler \n" +"PO-Revision-Date: 2022-12-27 17:42+0000\n" +"Last-Translator: Clay \n" "Language-Team: none\n" "Language: ru\n" "MIME-Version: 1.0\n" @@ -16,7 +16,7 @@ msgstr "" "Content-Transfer-Encoding: 8bit\n" "Plural-Forms: nplurals=3; plural=n%10==1 && n%100!=11 ? 0 : n%10>=2 && n" "%10<=4 && (n%100<10 || n%100>=20) ? 1 : 2;\n" -"X-Generator: Weblate 4.12-dev\n" +"X-Generator: Weblate 4.15.1-dev\n" #: main.c msgid "" @@ -31,17 +31,27 @@ msgid "" "\n" "Code stopped by auto-reload. Reloading soon.\n" msgstr "" +"\n" +"Программа остановлена автоматической перезагрузкой. Скоро перезагрузка.\n" #: supervisor/shared/safe_mode.c msgid "" "\n" -"Please file an issue with the contents of your CIRCUITPY drive at \n" -"https://github.com/adafruit/circuitpython/issues\n" +"Please file an issue with your program at https://github.com/adafruit/" +"circuitpython/issues." msgstr "" + +#: supervisor/shared/safe_mode.c +msgid "" "\n" -"Пожалуйста, сообщите о проблеме, приложив содержимое вашего диска CIRCUITPY " -"на\n" -"https://github.com/adafruit/circuitpython/issues\n" +"Press reset to exit safe mode.\n" +msgstr "" + +#: supervisor/shared/safe_mode.c +msgid "" +"\n" +"You are in safe mode because:\n" +msgstr "" #: py/obj.c msgid " File \"%q\"" @@ -71,13 +81,19 @@ msgstr "%%c требует int или char" #: main.c #, c-format msgid "%02X" +msgstr "%02X" + +#: shared-module/os/getenv.c +#, c-format +msgid "%S" 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" +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 @@ -88,9 +104,9 @@ msgstr "%d адресные пины, %d rgb пины и %d плитки ука #: 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 +#: ports/stm/common-hal/canio/Listener.c ports/stm/common-hal/rtc/RTC.c msgid "%q" -msgstr "" +msgstr "%q" #: shared-bindings/microcontroller/Pin.c msgid "%q and %q contain duplicate pins" @@ -98,7 +114,7 @@ msgstr "%q и %q содержат пины-дупликаты" #: ports/atmel-samd/common-hal/audioio/AudioOut.c msgid "%q and %q must be different" -msgstr "" +msgstr "%q и %q должны быть разными" #: shared-bindings/microcontroller/Pin.c msgid "%q contains duplicate pins" @@ -108,27 +124,36 @@ msgstr "%q содержит пины-дупликаты" msgid "%q failure: %d" msgstr "%q сбой: %d" +#: py/argcheck.c +msgid "%q in %q must be of type %q, not %q" +msgstr "" + +#: ports/espressif/common-hal/espulp/ULP.c #: ports/raspberrypi/common-hal/rp2pio/StateMachine.c #: shared-bindings/digitalio/DigitalInOut.c #: shared-bindings/microcontroller/Pin.c msgid "%q in use" msgstr "%q используется" -#: py/obj.c py/objstr.c py/objstrunicode.c +#: py/objstr.c py/objstrunicode.c msgid "%q index out of range" msgstr "Индекс %q вне диапазона" #: shared-module/bitbangio/SPI.c msgid "%q init failed" -msgstr "" +msgstr "Инициализация %q не удалась" #: shared-bindings/dualbank/__init__.c msgid "%q is %q" +msgstr "%q является %q" + +#: ports/raspberrypi/common-hal/wifi/Radio.c +msgid "%q is read-only for this board" msgstr "" -#: py/argcheck.c +#: py/argcheck.c shared-bindings/usb_hid/Device.c msgid "%q length must be %d" -msgstr "" +msgstr "Длинна %q должна быть %d" #: py/argcheck.c msgid "%q length must be %d-%d" @@ -136,55 +161,47 @@ msgstr "Длинна %q должна быть %d-%d" #: py/argcheck.c msgid "%q length must be <= %d" -msgstr "" +msgstr "Длинна %q должна быть <= %d" #: py/argcheck.c msgid "%q length must be >= %d" -msgstr "" - -#: shared-bindings/busio/I2C.c -msgid "%q length must be >= 1" -msgstr "Длинна %q должна быть >= 1" +msgstr "Длинна %q должна быть >= %d" #: py/argcheck.c msgid "%q must be %d" -msgstr "" +msgstr "%q должно быть %d" #: py/argcheck.c msgid "%q must be %d-%d" -msgstr "%q должен быть %d-%d" +msgstr "%q должно быть %d-%d" #: shared-bindings/displayio/Display.c msgid "%q must be 1 when %q is True" -msgstr "" +msgstr "%q должно быть 1 когда %q is True" #: py/argcheck.c shared-bindings/gifio/GifWriter.c msgid "%q must be <= %d" -msgstr "%q должен быть <= %d" +msgstr "%q должно быть <= %d" #: py/argcheck.c msgid "%q must be >= %d" -msgstr "%q должен быть >= %d" +msgstr "%q должно быть >= %d" #: shared-bindings/analogbufio/BufferedIn.c +msgid "%q must be a bytearray or array of type 'H' or 'B'" +msgstr "%q должно быть bytearray или array типа 'H' или 'B'" + #: 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'" + +#: ports/raspberrypi/bindings/cyw43/__init__.c py/argcheck.c py/objexcept.c +#: shared-bindings/canio/CAN.c shared-bindings/digitalio/Pull.c +msgid "%q must be of type %q or %q, not %q" msgstr "" -#: py/argcheck.c -msgid "%q must be a string" -msgstr "%q должен быть строкой" - -#: py/argcheck.c -msgid "%q must be an int" -msgstr "" - -#: 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" +#: py/argcheck.c py/obj.c py/objstrunicode.c +msgid "%q must be of type %q, not %q" msgstr "" #: ports/atmel-samd/common-hal/busio/UART.c @@ -197,7 +214,6 @@ msgstr "%q за пределом" #: ports/atmel-samd/common-hal/pulseio/PulseIn.c #: ports/cxd56/common-hal/pulseio/PulseIn.c -#: ports/espressif/common-hal/coproc/Coproc.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 @@ -209,9 +225,9 @@ msgstr "%q вне диапазона" msgid "%q pin invalid" msgstr "Пин %q не допустим" -#: shared-bindings/usb_hid/Device.c -msgid "%q with a report ID of 0 must be of length 1" -msgstr "%q с идентификатором отчёта 0 должен иметь длину 1" +#: py/objrange.c py/objslice.c shared-bindings/random/__init__.c +msgid "%q step cannot be zero" +msgstr "Шаг %q не может быть нулём" #: py/bc.c py/objnamedtuple.c msgid "%q() takes %d positional arguments but %d were given" @@ -223,7 +239,7 @@ msgstr "%q, %q, и %q должны быть одной длинны" #: py/objint.c shared-bindings/storage/__init__.c msgid "%q=%q" -msgstr "" +msgstr "%q=%q" #: ports/espressif/common-hal/espidf/__init__.c ports/espressif/esp_error.c #, c-format @@ -310,7 +326,7 @@ msgstr "Объект '%s' не поддерживает присвоение э msgid "'%s' object doesn't support item deletion" msgstr "Объект '%s' не поддерживает удаление элементов" -#: ports/raspberrypi/common-hal/wifi/Radio.c py/runtime.c +#: py/runtime.c msgid "'%s' object has no attribute '%q'" msgstr "Объект '%s' не имеет атрибута '%q'" @@ -357,7 +373,7 @@ msgstr "'data' требует как минимум 2 аргумента" #: py/compile.c msgid "'data' requires integer arguments" -msgstr "'data' требует целочисленных аргументов" +msgstr "'data' требует целочисленные аргументы" #: py/compile.c msgid "'label' requires 1 argument" @@ -410,6 +426,10 @@ msgstr "ADC2 используется WiFi" msgid "Address must be %d bytes long" msgstr "Адрес должен быть длиной %d байт" +#: ports/espressif/common-hal/memorymap/AddressRange.c +msgid "Address range not allowed" +msgstr "Диапазон адресов не разрешен" + #: ports/espressif/common-hal/canio/CAN.c msgid "All CAN peripherals are in use" msgstr "Все периферийные устройства CAN уже используются" @@ -437,7 +457,6 @@ msgid "All SPI peripherals are in use" 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 "Все периферийные устройства UART уже используются" @@ -490,7 +509,7 @@ msgstr "Уже объявляемся (advertising)." msgid "Already have all-matches listener" msgstr "Уже есть универсальный слушатель" -#: ports/espressif/common-hal/coproc/__init__.c +#: ports/espressif/common-hal/espulp/ULP.c #: shared-module/memorymonitor/AllocationAlarm.c #: shared-module/memorymonitor/AllocationSize.c msgid "Already running" @@ -501,6 +520,11 @@ msgstr "Уже запущен" msgid "Already scanning for wifi networks" msgstr "Поиск сетей wifi уже происходит" +#: shared-module/os/getenv.c +#, c-format +msgid "An error occurred while retrieving '%s':\n" +msgstr "" + #: ports/stm/common-hal/audiopwmio/PWMAudioOut.c msgid "Another PWMAudioOut is already active" msgstr "Другой PWMAudioOut уже активен" @@ -514,24 +538,16 @@ msgstr "Другая передача уже активна" msgid "Array must contain halfwords (type 'H')" msgstr "Массив должен содержать полуслова (тип 'H')" -#: shared-bindings/alarm/SleepMemory.c shared-bindings/coproc/CoprocMemory.c +#: shared-bindings/alarm/SleepMemory.c shared-bindings/memorymap/AddressRange.c #: shared-bindings/nvm/ByteArray.c msgid "Array values should be single bytes." msgstr "Значения массива должны быть однобайтовыми." -#: shared-bindings/microcontroller/Pin.c -msgid "At most %d %q may be specified (not %d)" -msgstr "Может быть указано не более %d %q (не %d)" - #: shared-module/memorymonitor/AllocationAlarm.c #, c-format msgid "Attempt to allocate %d blocks" msgstr "Попытка выделения %d блоков" -#: supervisor/shared/safe_mode.c -msgid "Attempted heap allocation when VM not running." -msgstr "Попытка выделения heap пока виртуальная машина не запущена." - #: ports/raspberrypi/audio_dma.c msgid "Audio conversion not implemented" msgstr "Преобразование звука не реализовано" @@ -586,20 +602,13 @@ msgid "Bitmap size and bits per value must match" msgstr "Размер bitmap и количество бит-на-значение должны совпадать" #: supervisor/shared/safe_mode.c -msgid "Boot device must be first device (interface #0)." -msgstr "Загрузочное устройство должно быть первым устройством (интерфейс #0)." +msgid "Boot device must be first (interface #0)." +msgstr "" #: ports/mimxrt10xx/common-hal/busio/UART.c msgid "Both RX and TX required for flow control" msgstr "Для управления потоком требуется как RX, так и TX" -#: ports/atmel-samd/boards/circuitplayground_express/mpconfigboard.h -#: ports/atmel-samd/boards/circuitplayground_express_crickit/mpconfigboard.h -#: ports/atmel-samd/boards/circuitplayground_express_displayio/mpconfigboard.h -#: ports/atmel-samd/boards/meowmeow/mpconfigboard.h -msgid "Both buttons were pressed at start up.\n" -msgstr "" - #: ports/atmel-samd/common-hal/rotaryio/IncrementalEncoder.c msgid "Both pins must support hardware interrupts" msgstr "Оба пина должны поддерживать аппаратные прерывания" @@ -665,11 +674,6 @@ msgstr "Буферы должны быть одинакового размера msgid "Bus pin %d is already in use" msgstr "Пин шины %d уже используется" -#: ports/espressif/boards/m5stack_core_basic/mpconfigboard.h -#: ports/espressif/boards/m5stack_core_fire/mpconfigboard.h -msgid "Button A was pressed at start up.\n" -msgstr "" - #: shared-bindings/_bleio/UUID.c msgid "Byte buffer must be 16 bytes." msgstr "Буфер байтов должен быть размером 16 байтам." @@ -680,7 +684,7 @@ msgstr "Блоки CBC должны быть кратны 16 байтам" #: supervisor/shared/safe_mode.c msgid "CIRCUITPY drive could not be found or created." -msgstr "" +msgstr "Не удалось найти или создать диск CIRCUITPY." #: ports/espressif/common-hal/espidf/__init__.c ports/espressif/esp_error.c msgid "CRC or checksum was invalid" @@ -692,7 +696,7 @@ msgstr "Вызовите super().__init__() перед обращением к #: ports/cxd56/common-hal/camera/Camera.c msgid "Camera init" -msgstr "" +msgstr "Иницализация камеры" #: ports/espressif/common-hal/alarm/pin/PinAlarm.c msgid "Can only alarm on RTC IO from deep sleep." @@ -764,7 +768,7 @@ msgstr "Невозможно перемонтировать '/' пока он в #: 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 "" +msgstr "Не удалось перезагрузится в загрузчик так как загрузчик отсутствует" #: ports/espressif/common-hal/socketpool/Socket.c msgid "Cannot set socket options" @@ -785,15 +789,18 @@ msgstr "Срез субкласса невозможен" #: shared-module/bitbangio/SPI.c msgid "Cannot transfer without MOSI and MISO pins" -msgstr "" +msgstr "Невозможно передать данные без пинов MOSI и MISO" #: 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 +#, fuzzy msgid "Cannot wake on pin edge, only level" msgstr "" +"Невозможно проснуться по изменению логического уровня (CHANGE), только по " +"уровню (LEVEL)" #: ports/espressif/common-hal/alarm/pin/PinAlarm.c msgid "Cannot wake on pin edge. Only level." @@ -807,10 +814,6 @@ msgstr "Запись в CharacteristicBuffer не предусмотрена" msgid "CircuitPython core code crashed hard. Whoops!\n" msgstr "Код ядра CircuitPython сильно крашнулся. Упс!\n" -#: supervisor/shared/safe_mode.c -msgid "CircuitPython was unable to allocate the heap." -msgstr "CircuitPython не смог выделить heap." - #: shared-module/bitbangio/I2C.c msgid "Clock stretch too long" msgstr "Длинна такта слишком велика" @@ -851,10 +854,6 @@ msgstr "Не удалось запустить прерывание, RX заня msgid "Couldn't allocate decoder" msgstr "Не удалось выделить место для декодера" -#: supervisor/shared/safe_mode.c -msgid "Crash into the HardFault_Handler." -msgstr "Крашнулся в HardFault_Handler." - #: ports/stm/common-hal/analogio/AnalogOut.c msgid "DAC Channel Init Error" msgstr "Ошибка инициализации канала ЦАП" @@ -913,12 +912,18 @@ msgstr "Поворот дисплея должен осуществляться #: main.c msgid "Done" -msgstr "" +msgstr "Выполнено" #: shared-bindings/digitalio/DigitalInOut.c msgid "Drive mode not used when direction is input." msgstr "Drive mode не используется, когда направление является входным." +#: py/obj.c +#, fuzzy +msgid "During handling of the above exception, another exception occurred:" +msgstr "" +"Во время обработки вышеупомянутого исключения произошло другое исключение:" + #: shared-bindings/aesio/aes.c msgid "ECB only operates on 16 bytes at a time" msgstr "ECB работает только с 16 байтами за раз" @@ -944,24 +949,16 @@ msgstr "Ошибка в MIDI-потоке на позиции %d" msgid "Error in regex" msgstr "Ошибка в регулярном выражении(regex)" +#: supervisor/shared/safe_mode.c +msgid "Error in safemode.py." +msgstr "" + #: shared-bindings/socketpool/Socket.c shared-bindings/ssl/SSLSocket.c msgid "Error: Failure to bind" msgstr "Ошибка: Сбой привязки" -#: py/enum.c shared-bindings/_bleio/__init__.c shared-bindings/aesio/aes.c -#: shared-bindings/alarm/__init__.c shared-bindings/alarm/coproc/CoprocAlarm.c -#: shared-bindings/busio/SPI.c shared-bindings/coproc/Coproc.c -#: shared-bindings/coproc/__init__.c shared-bindings/microcontroller/Pin.c -#: shared-bindings/neopixel_write/__init__.c -msgid "Expected a %q" -msgstr "Ожидалось(ся) %q" - -#: ports/raspberrypi/bindings/cyw43/__init__.c -msgid "Expected a %q or %q" -msgstr "" - #: shared-bindings/alarm/__init__.c -msgid "Expected an %q" +msgid "Expected a kind of %q" msgstr "" #: ports/espressif/common-hal/_bleio/Adapter.c @@ -992,7 +989,7 @@ msgstr "Не удалось получить mutex, ошибка 0x%04x" #: shared-module/rgbmatrix/RGBMatrix.c msgid "Failed to allocate %q buffer" -msgstr "" +msgstr "Не удалось выделить буфер %q" #: ports/espressif/common-hal/wifi/__init__.c msgid "Failed to allocate Wifi memory" @@ -1029,13 +1026,17 @@ msgid "Failed to write internal flash." msgstr "Не удалось записать внутреннюю флэш-память." #: supervisor/shared/safe_mode.c -msgid "Fatal error." -msgstr "Фатальная ошибка." +msgid "Fault detected by hardware." +msgstr "" #: py/moduerrno.c msgid "File exists" msgstr "Файл существует" +#: shared-module/os/getenv.c +msgid "File not found" +msgstr "Файл не найден" + #: ports/atmel-samd/common-hal/canio/Listener.c #: ports/espressif/common-hal/canio/Listener.c #: ports/stm/common-hal/canio/Listener.c @@ -1043,17 +1044,18 @@ msgid "Filters too complex" msgstr "Фильтры слишком сложные" #: ports/espressif/common-hal/dualbank/__init__.c +#, fuzzy msgid "Firmware is duplicate" -msgstr "" +msgstr "Прошивка является дубликатом" #: ports/espressif/common-hal/dualbank/__init__.c +#, fuzzy msgid "Firmware is invalid" -msgstr "" +msgstr "Прошивка является неправильной" -#: ports/espressif/common-hal/coproc/Coproc.c #: ports/espressif/common-hal/dualbank/__init__.c msgid "Firmware is too big" -msgstr "" +msgstr "Прошивка слишком большая" #: shared-bindings/bitmaptools/__init__.c msgid "For L8 colorspace, input bitmap must have 8 bits per pixel" @@ -1073,6 +1075,8 @@ msgstr "Формат не поддерживается" msgid "" "Frequency must be 24, 150, 396, 450, 528, 600, 720, 816, 912, 960 or 1008 Mhz" msgstr "" +"Частота должна быть 24, 150, 396, 450, 528, 600, 720, 816, 912, 960 или 1008 " +"МГц" #: shared-bindings/pwmio/PWMOut.c msgid "Frequency must match existing PWMOut using this timer" @@ -1087,7 +1091,7 @@ msgstr "Функция требует блокировки" #: ports/cxd56/common-hal/gnss/GNSS.c msgid "GNSS init" -msgstr "" +msgstr "Инициализация GNSS" #: ports/espressif/common-hal/espidf/__init__.c ports/espressif/esp_error.c msgid "Generic Failure" @@ -1096,6 +1100,8 @@ msgstr "Общий сбой" #: shared-bindings/displayio/Display.c #: shared-bindings/displayio/EPaperDisplay.c #: shared-bindings/framebufferio/FramebufferDisplay.c +#: shared-module/displayio/Display.c +#: shared-module/framebufferio/FramebufferDisplay.c msgid "Group already used" msgstr "Группа уже используется" @@ -1104,7 +1110,7 @@ msgstr "Группа уже используется" #: ports/mimxrt10xx/common-hal/busio/SPI.c ports/nrf/common-hal/busio/SPI.c #: ports/raspberrypi/common-hal/busio/SPI.c msgid "Half duplex SPI is not implemented" -msgstr "" +msgstr "Полудуплексный SPI не реализован" #: 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 @@ -1116,13 +1122,22 @@ msgstr "Оборудование занято, попробуйте исполь msgid "Hardware in use, try alternative pins" msgstr "Оборудование используется, попробуйте использовать другие пины" +#: supervisor/shared/safe_mode.c +msgid "Heap allocation when VM not running." +msgstr "" + +#: supervisor/shared/safe_mode.c +msgid "" +"Heap was corrupted because the stack was too small. Increase stack size." +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" -msgstr "" +msgstr "Ошибка инициализации I2C" #: ports/raspberrypi/common-hal/busio/I2C.c #: ports/raspberrypi/common-hal/i2ctarget/I2CTarget.c @@ -1133,11 +1148,6 @@ msgstr "Периферийное устройство I2C уже использ msgid "I2SOut not available" msgstr "I2SOut недоступен" -#: shared-bindings/aesio/aes.c -#, c-format -msgid "IV must be %d bytes long" -msgstr "IV должен быть длиной %d байт" - #: ports/raspberrypi/bindings/rp2pio/StateMachine.c msgid "In-buffer elements must be <= 4 bytes long" msgstr "Элементы буфера должны быть длиной <= 4 байта" @@ -1229,6 +1239,7 @@ msgid "Internal define error" msgstr "Внутренняя ошибка определения" #: ports/espressif/common-hal/paralleldisplay/ParallelBus.c +#: shared-module/os/getenv.c msgid "Internal error" msgstr "Внутренняя ошибка" @@ -1238,7 +1249,12 @@ msgid "Internal error #%d" msgstr "Внутренняя ошибка #%d" #: supervisor/shared/safe_mode.c +#, fuzzy msgid "Internal watchdog timer expired." +msgstr "Внутренний сторожевой таймер истек." + +#: supervisor/shared/safe_mode.c +msgid "Interrupt error." msgstr "" #: py/argcheck.c shared-bindings/digitalio/DigitalInOut.c @@ -1275,6 +1291,11 @@ msgstr "Недопустимый аргумент" msgid "Invalid bits per value" msgstr "Недопустимое бит-на-значение" +#: shared-module/os/getenv.c +#, c-format +msgid "Invalid byte %.*s" +msgstr "Неверный байт %.*s" + #: ports/atmel-samd/common-hal/imagecapture/ParallelImageCapture.c #, c-format msgid "Invalid data_pins[%d]" @@ -1284,18 +1305,10 @@ msgstr "Неверный data_pins[%d]" msgid "Invalid format chunk size" msgstr "Неверный размер блока формата" -#: supervisor/shared/safe_mode.c -msgid "Invalid memory access." -msgstr "Неправильный доступ к памяти." - #: ports/espressif/common-hal/wifi/Radio.c msgid "Invalid multicast MAC address" msgstr "Неверный MAC-адрес multicast" -#: shared-bindings/busio/UART.c -msgid "Invalid pins" -msgstr "Недопустимые пины" - #: ports/espressif/common-hal/espidf/__init__.c ports/espressif/esp_error.c msgid "Invalid size" msgstr "Неверный размер" @@ -1309,10 +1322,18 @@ msgstr "Неверный сокет для TLS" msgid "Invalid state" msgstr "Неверное состояние" +#: shared-module/os/getenv.c +msgid "Invalid unicode escape" +msgstr "" + #: shared-bindings/aesio/aes.c msgid "Key must be 16, 24, or 32 bytes long" msgstr "Ключ должен быть длинной 16, 24 или 32 байта" +#: shared-module/os/getenv.c +msgid "Key not found" +msgstr "Ключ не найден" + #: shared-module/is31fl3741/FrameBuffer.c msgid "LED mappings must match display size" msgstr "" @@ -1322,12 +1343,14 @@ msgid "LHS of keyword arg must be an id" msgstr "LHS ключевого слова arg должен быть идентификатором(id)" #: shared-module/displayio/Group.c +#, fuzzy msgid "Layer already in a group" -msgstr "" +msgstr "Слой уже в группе (Group)" #: shared-module/displayio/Group.c +#, fuzzy msgid "Layer must be a Group or TileGrid subclass" -msgstr "" +msgstr "Слой должен быть группой (Group) или субклассом TileGrid." #: ports/espressif/common-hal/espidf/__init__.c ports/espressif/esp_error.c msgid "MAC address was invalid" @@ -1349,11 +1372,11 @@ msgstr "Задержка включения микрофона должна бы #: ports/raspberrypi/bindings/rp2pio/StateMachine.c #: ports/raspberrypi/common-hal/rp2pio/StateMachine.c msgid "Mismatched data size" -msgstr "" +msgstr "Размер данных различается" #: ports/raspberrypi/common-hal/rp2pio/StateMachine.c msgid "Mismatched swap flag" -msgstr "" +msgstr "Несоответствие флага swap" #: ports/mimxrt10xx/common-hal/busio/SPI.c msgid "Missing MISO or MOSI Pin" @@ -1361,7 +1384,7 @@ msgstr "Отсутствует пин MISO или MOSI" #: ports/stm/common-hal/busio/SPI.c msgid "Missing MISO or MOSI pin" -msgstr "" +msgstr "Отсутствует пин MISO или MOSI" #: ports/raspberrypi/common-hal/rp2pio/StateMachine.c #, c-format @@ -1420,13 +1443,17 @@ msgstr "Не удалось выполнить NLR jump. Вероятно, по msgid "NVS Error" msgstr "Ошибка NVS" +#: shared-bindings/socketpool/SocketPool.c +msgid "Name or service not known" +msgstr "" + #: py/qstr.c msgid "Name too long" msgstr "Имя слишком длинное" #: shared-bindings/displayio/TileGrid.c msgid "New bitmap must be same size as old bitmap" -msgstr "" +msgstr "Новый bitmap должен быть того же размера что и старый" #: ports/espressif/common-hal/_bleio/__init__.c msgid "Nimble out of memory" @@ -1454,13 +1481,13 @@ msgid "No DMA pacing timer found" msgstr "" #: shared-module/adafruit_bus_device/i2c_device/I2CDevice.c -#, c-format +#, fuzzy, c-format msgid "No I2C device at address: 0x%x" -msgstr "" +msgstr "Не найдено устройство I2C по адресу: %x" #: supervisor/shared/web_workflow/web_workflow.c msgid "No IP" -msgstr "" +msgstr "Нет IP" #: ports/espressif/common-hal/busio/SPI.c #: ports/mimxrt10xx/common-hal/busio/SPI.c @@ -1469,7 +1496,7 @@ msgstr "Нет пина MISO" #: ports/stm/common-hal/busio/SPI.c shared-module/bitbangio/SPI.c msgid "No MISO pin" -msgstr "" +msgstr "Нет пина MISO" #: ports/espressif/common-hal/busio/SPI.c #: ports/mimxrt10xx/common-hal/busio/SPI.c @@ -1478,7 +1505,7 @@ msgstr "Нет пина MOSI" #: ports/stm/common-hal/busio/SPI.c shared-module/bitbangio/SPI.c msgid "No MOSI pin" -msgstr "" +msgstr "Нет пина MOSI" #: ports/atmel-samd/common-hal/busio/UART.c #: ports/espressif/common-hal/busio/UART.c @@ -1534,11 +1561,6 @@ msgstr "Ключ не был указан" msgid "No long integer support" msgstr "Нет поддержки длинных целых чисел (long integer)" -#: shared-module/usb_hid/__init__.c -#, c-format -msgid "No more than %d HID devices allowed" -msgstr "Допускается не более %d HID устройств" - #: shared-bindings/wifi/Radio.c msgid "No network with that ssid" msgstr "Нет сети с этим ssid" @@ -1564,8 +1586,9 @@ msgid "No space left on device" msgstr "На устройстве не осталось свободного места" #: py/moduerrno.c +#, fuzzy msgid "No such device" -msgstr "" +msgstr "Нет такого устройства" #: py/moduerrno.c msgid "No such file/directory" @@ -1575,10 +1598,6 @@ msgstr "Файл/директория не существует" msgid "No timer available" msgstr "Нет доступного таймера" -#: supervisor/shared/safe_mode.c -msgid "Nordic system firmware failure assertion." -msgstr "" - #: ports/nrf/common-hal/_bleio/__init__.c msgid "Nordic system firmware out of memory" msgstr "" @@ -1595,12 +1614,9 @@ msgstr "Не подключено" #: shared-bindings/audiobusio/I2SOut.c shared-bindings/audioio/AudioOut.c #: shared-bindings/audiopwmio/PWMAudioOut.c +#, fuzzy msgid "Not playing" -msgstr "Не играет" - -#: shared-bindings/_bleio/__init__.c -msgid "Not settable" -msgstr "Не устанавливается" +msgstr "Не воспроизводится (Not playing)" #: ports/espressif/common-hal/paralleldisplay/ParallelBus.c #, c-format @@ -1620,11 +1636,12 @@ msgstr "" #: supervisor/shared/bluetooth/bluetooth.c msgid "Off" -msgstr "" +msgstr "Выключено" #: supervisor/shared/bluetooth/bluetooth.c +#, fuzzy msgid "Ok" -msgstr "" +msgstr "Ok" #: ports/atmel-samd/common-hal/audiobusio/PDMIn.c #: ports/raspberrypi/common-hal/audiobusio/PDMIn.c @@ -1668,9 +1685,12 @@ msgid "" "%d bpp given" msgstr "" -#: ports/espressif/common-hal/alarm/coproc/CoprocAlarm.c #: ports/espressif/common-hal/alarm/touch/TouchAlarm.c msgid "Only one %q can be set in deep sleep." +msgstr "Только один %q может быть погружен в глубокий сон." + +#: ports/espressif/common-hal/espulp/ULPAlarm.c +msgid "Only one %q can be set." msgstr "" #: ports/espressif/common-hal/i2ctarget/I2CTarget.c @@ -1705,6 +1725,10 @@ msgstr "" msgid "Operation timed out" msgstr "" +#: ports/raspberrypi/common-hal/mdns/Server.c +msgid "Out of MDNS service slots" +msgstr "" + #: ports/espressif/common-hal/espidf/__init__.c ports/espressif/esp_error.c msgid "Out of memory" msgstr "" @@ -1833,6 +1857,10 @@ msgstr "" msgid "Program size invalid" msgstr "" +#: ports/espressif/common-hal/espulp/ULP.c +msgid "Program too long" +msgstr "" + #: shared-bindings/digitalio/DigitalInOut.c msgid "Pull not used when direction is output." msgstr "" @@ -1872,8 +1900,9 @@ msgstr "" msgid "Random number generation error" msgstr "" +#: shared-bindings/_bleio/__init__.c #: shared-bindings/memorymonitor/AllocationSize.c -#: shared-bindings/pulseio/PulseIn.c +#: shared-bindings/pulseio/PulseIn.c shared-module/displayio/Bitmap.c msgid "Read-only" msgstr "" @@ -1881,10 +1910,6 @@ msgstr "" msgid "Read-only filesystem" msgstr "" -#: shared-module/displayio/Bitmap.c -msgid "Read-only object" -msgstr "" - #: ports/espressif/common-hal/espidf/__init__.c ports/espressif/esp_error.c msgid "Received response was invalid" msgstr "" @@ -1977,7 +2002,7 @@ msgstr "" msgid "Sleep Memory not available" msgstr "" -#: shared-bindings/alarm/SleepMemory.c shared-bindings/coproc/CoprocMemory.c +#: shared-bindings/alarm/SleepMemory.c shared-bindings/memorymap/AddressRange.c #: shared-bindings/nvm/ByteArray.c msgid "Slice and value different lengths." msgstr "" @@ -2014,6 +2039,10 @@ msgstr "" msgid "Stereo right must be on PWM channel B" msgstr "" +#: ports/raspberrypi/common-hal/wifi/Radio.c +msgid "Stopping AP is not supported." +msgstr "" + #: ports/mimxrt10xx/common-hal/busio/UART.c ports/stm/common-hal/busio/UART.c msgid "Supply at least one UART pin" msgstr "Предоставьте хотяб один пин UART" @@ -2031,35 +2060,11 @@ msgid "Temperature read timed out" msgstr "" #: supervisor/shared/safe_mode.c -msgid "The BOOT button was pressed at start up.\n" +msgid "The `microcontroller` module was used to boot into safe mode." msgstr "" -#: supervisor/shared/safe_mode.c -msgid "" -"The CircuitPython heap was corrupted because the stack was too small.\n" -"Increase the stack size if you know how. If not:" -msgstr "" - -#: ports/espressif/boards/adafruit_feather_esp32_v2/mpconfigboard.h -msgid "The SW38 button was pressed at start up.\n" -msgstr "" - -#: ports/espressif/boards/hardkernel_odroid_go/mpconfigboard.h -msgid "The VOLUME button was pressed at start up.\n" -msgstr "" - -#: supervisor/shared/safe_mode.c -msgid "" -"The `microcontroller` module was used to boot into safe mode. Press reset to " -"exit safe mode." -msgstr "" - -#: ports/espressif/boards/m5stack_atom_lite/mpconfigboard.h -msgid "The central button was pressed at start up.\n" -msgstr "" - -#: ports/nrf/boards/aramcon2_badge/mpconfigboard.h -msgid "The left button was pressed at start up.\n" +#: py/obj.c +msgid "The above exception was the direct cause of the following exception:" msgstr "" #: shared-bindings/rgbmatrix/RGBMatrix.c @@ -2067,10 +2072,7 @@ msgid "The length of rgb_pins must be 6, 12, 18, 24, or 30" msgstr "Длина rgb_pins должна быть 6, 12, 18, 24 или 30" #: supervisor/shared/safe_mode.c -msgid "" -"The microcontroller's power dipped. Make sure your power supply provides\n" -"enough power for the whole circuit and press reset (after ejecting " -"CIRCUITPY)." +msgid "The power dipped. Make sure you are providing enough power." msgstr "" #: shared-module/audiomixer/MixerVoice.c @@ -2089,6 +2091,10 @@ msgstr "" msgid "The sample's signedness does not match the mixer's" msgstr "" +#: supervisor/shared/safe_mode.c +msgid "Third-party firmware fatal error." +msgstr "" + #: shared-module/imagecapture/ParallelImageCapture.c msgid "This microcontroller does not support continuous capture." msgstr "" @@ -2123,10 +2129,6 @@ msgstr "" msgid "Timeout is too long: Maximum timeout length is %d seconds" msgstr "" -#: supervisor/shared/safe_mode.c -msgid "To exit, please reset the board without requesting safe mode." -msgstr "" - #: ports/atmel-samd/common-hal/audiobusio/I2SOut.c msgid "Too many channels in sample" msgstr "" @@ -2171,6 +2173,10 @@ msgstr "" msgid "UART init" msgstr "" +#: ports/raspberrypi/common-hal/busio/UART.c +msgid "UART peripheral in use" +msgstr "" + #: ports/stm/common-hal/busio/UART.c msgid "UART re-init" msgstr "" @@ -2218,6 +2224,10 @@ msgstr "" msgid "Unable to allocate buffers for signed conversion" msgstr "" +#: supervisor/shared/safe_mode.c +msgid "Unable to allocate the heap." +msgstr "" + #: ports/espressif/common-hal/busio/I2C.c msgid "Unable to create lock" msgstr "" @@ -2241,11 +2251,12 @@ msgid "Unable to read color palette data" msgstr "" #: ports/espressif/common-hal/mdns/Server.c +#: ports/raspberrypi/common-hal/mdns/Server.c msgid "Unable to start mDNS query" msgstr "" -#: shared-bindings/coproc/CoprocMemory.c -msgid "Unable to write" +#: shared-bindings/memorymap/AddressRange.c +msgid "Unable to write to address." msgstr "" #: shared-bindings/nvm/ByteArray.c @@ -2316,6 +2327,7 @@ msgid "Unkown error code %d" msgstr "" #: shared-bindings/adafruit_pixelbuf/PixelBuf.c +#: shared-module/_pixelmap/PixelMap.c #, c-format msgid "Unmatched number of items on RHS (expected %d, got %d)." msgstr "" @@ -2400,6 +2412,18 @@ msgstr "" msgid "Wi-Fi: " msgstr "" +#: ports/raspberrypi/common-hal/wifi/Radio.c +msgid "Wifi is in access point mode." +msgstr "" + +#: ports/raspberrypi/common-hal/wifi/Radio.c +msgid "Wifi is in station mode." +msgstr "" + +#: ports/raspberrypi/common-hal/wifi/Radio.c +msgid "Wifi is not enabled" +msgstr "" + #: main.c msgid "Woken up by alarm.\n" msgstr "" @@ -2409,13 +2433,48 @@ msgstr "" msgid "Writes not supported on Characteristic" msgstr "" -#: supervisor/shared/safe_mode.c -msgid "You are in safe mode because:\n" +#: ports/atmel-samd/boards/circuitplayground_express/mpconfigboard.h +#: ports/atmel-samd/boards/circuitplayground_express_crickit/mpconfigboard.h +#: ports/atmel-samd/boards/circuitplayground_express_displayio/mpconfigboard.h +#: ports/atmel-samd/boards/meowmeow/mpconfigboard.h +msgid "You pressed both buttons at start up." +msgstr "" + +#: ports/espressif/boards/m5stack_core_basic/mpconfigboard.h +#: ports/espressif/boards/m5stack_core_fire/mpconfigboard.h +#: ports/espressif/boards/m5stack_stick_c/mpconfigboard.h +msgid "You pressed button A at start up." msgstr "" #: supervisor/shared/safe_mode.c -msgid "" -"You pressed the reset button during boot. Press again to exit safe mode." +msgid "You pressed the BOOT button at start up" +msgstr "" + +#: ports/espressif/boards/adafruit_feather_esp32_v2/mpconfigboard.h +msgid "You pressed the SW38 button at start up." +msgstr "" + +#: ports/espressif/boards/hardkernel_odroid_go/mpconfigboard.h +msgid "You pressed the VOLUME button at start up." +msgstr "" + +#: ports/espressif/boards/m5stack_atom_echo/mpconfigboard.h +#: ports/espressif/boards/m5stack_atom_lite/mpconfigboard.h +#: ports/espressif/boards/m5stack_atom_matrix/mpconfigboard.h +#: ports/espressif/boards/m5stack_atom_u/mpconfigboard.h +msgid "You pressed the central button at start up." +msgstr "" + +#: ports/nrf/boards/aramcon2_badge/mpconfigboard.h +msgid "You pressed the left button at start up." +msgstr "" + +#: supervisor/shared/safe_mode.c +msgid "You pressed the reset button during boot." +msgstr "" + +#: supervisor/shared/micropython.c +msgid "[truncated due to length]" msgstr "" #: py/objtype.c @@ -2487,8 +2546,12 @@ msgstr "" msgid "array has too many dimensions" msgstr "" +#: extmod/ulab/code/ndarray.c +msgid "array is too big" +msgstr "" + #: py/objarray.c shared-bindings/alarm/SleepMemory.c -#: shared-bindings/coproc/CoprocMemory.c shared-bindings/nvm/ByteArray.c +#: shared-bindings/memorymap/AddressRange.c shared-bindings/nvm/ByteArray.c msgid "array/bytes required on right side" msgstr "" @@ -2581,10 +2644,6 @@ msgstr "" msgid "buffer too small for requested bytes" msgstr "" -#: shared-bindings/adafruit_pixelbuf/PixelBuf.c -msgid "byteorder is not a string" -msgstr "" - #: py/objarray.c msgid "bytes length not a multiple of item size" msgstr "" @@ -2626,14 +2685,10 @@ msgstr "" msgid "can't cancel self" msgstr "" -#: py/obj.c py/objint.c shared-module/adafruit_pixelbuf/PixelBuf.c +#: py/obj.c py/objint.c py/runtime.c shared-module/adafruit_pixelbuf/PixelBuf.c msgid "can't convert %q to %q" msgstr "" -#: py/runtime.c -msgid "can't convert %q to int" -msgstr "" - #: py/obj.c #, c-format msgid "can't convert %s to complex" @@ -2715,6 +2770,10 @@ msgstr "" msgid "can't set attribute" msgstr "" +#: py/runtime.c +msgid "can't set attribute '%q'" +msgstr "" + #: py/emitnative.c msgid "can't store '%q'" msgstr "" @@ -2817,10 +2876,6 @@ msgstr "" msgid "comparison of int and uint" msgstr "" -#: py/objcomplex.c -msgid "complex division by zero" -msgstr "" - #: py/objfloat.c py/parsenum.c msgid "complex values not supported" msgstr "" @@ -2923,12 +2978,11 @@ msgstr "" msgid "div/mod not implemented for uint" msgstr "" -#: py/objfloat.c py/objint_mpz.c +#: extmod/ulab/code/numpy/create.c msgid "divide by zero" msgstr "" -#: py/modmath.c py/objint_longlong.c py/runtime.c -#: shared-bindings/math/__init__.c +#: py/runtime.c msgid "division by zero" msgstr "" @@ -2969,9 +3023,9 @@ msgstr "" msgid "error = 0x%08lX" msgstr "" -#: ports/espressif/common-hal/esp32_camera/Camera.c +#: ports/espressif/common-hal/espcamera/Camera.c msgid "" -"esp32_camera.Camera requires reserved PSRAM to be configured. See the " +"espcamera.Camera requires reserved PSRAM to be configured. See the " "documentation for instructions." msgstr "" @@ -2979,14 +3033,6 @@ msgstr "" msgid "exceptions must derive from BaseException" msgstr "" -#: shared-bindings/canio/CAN.c -msgid "expected '%q' but got '%q'" -msgstr "" - -#: shared-bindings/canio/CAN.c -msgid "expected '%q' or '%q' but got '%q'" -msgstr "" - #: py/objstr.c msgid "expected ':' after format specifier" msgstr "" @@ -3085,10 +3131,6 @@ msgstr "" msgid "format requires a dict" msgstr "" -#: shared-bindings/microcontroller/Processor.c -msgid "frequency is read-only for this board" -msgstr "" - #: py/objdeque.c msgid "full" msgstr "" @@ -3201,8 +3243,12 @@ msgstr "" msgid "index is out of bounds" msgstr "" +#: shared-bindings/_pixelmap/PixelMap.c +msgid "index must be tuple or int" +msgstr "" + #: extmod/ulab/code/numpy/numerical.c extmod/ulab/code/ulab_tools.c -#: ports/espressif/common-hal/pulseio/PulseIn.c py/obj.c +#: ports/espressif/common-hal/pulseio/PulseIn.c #: shared-bindings/bitmaptools/__init__.c msgid "index out of range" msgstr "" @@ -3300,10 +3346,6 @@ msgstr "" msgid "inputs are not iterable" msgstr "" -#: py/parsenum.c -msgid "int() arg 2 must be >= 2 and <= 36" -msgstr "" - #: extmod/ulab/code/numpy/approx.c msgid "interp is defined for 1D iterables of equal length" msgstr "" @@ -3360,7 +3402,7 @@ msgstr "" msgid "invalid micropython decorator" msgstr "" -#: ports/espressif/common-hal/esp32_camera/Camera.c +#: ports/espressif/common-hal/espcamera/Camera.c msgid "invalid setting" msgstr "" @@ -3385,10 +3427,6 @@ msgstr "" msgid "invalid syntax for number" msgstr "" -#: py/objexcept.c -msgid "invalid traceback" -msgstr "" - #: py/objtype.c msgid "issubclass() arg 1 must be a class" msgstr "" @@ -3445,19 +3483,17 @@ msgstr "" msgid "local variable referenced before assignment" msgstr "" -#: py/objint.c -msgid "long int not supported in this build" -msgstr "" - #: ports/espressif/common-hal/canio/CAN.c msgid "loopback + silent mode not supported by peripheral" msgstr "" #: ports/espressif/common-hal/mdns/Server.c +#: ports/raspberrypi/common-hal/mdns/Server.c msgid "mDNS already initialized" msgstr "" #: ports/espressif/common-hal/mdns/Server.c +#: ports/raspberrypi/common-hal/mdns/Server.c msgid "mDNS only works with built-in WiFi" msgstr "" @@ -3586,6 +3622,10 @@ msgstr "" msgid "negative shift count" msgstr "" +#: shared-bindings/_pixelmap/PixelMap.c +msgid "nested index must be int" +msgstr "" + #: shared-module/sdcardio/SDCard.c msgid "no SD card" msgstr "" @@ -3619,7 +3659,7 @@ msgstr "нет доступного контакта сброса" msgid "no response from SD card" msgstr "" -#: ports/espressif/common-hal/esp32_camera/Camera.c py/objobject.c py/runtime.c +#: ports/espressif/common-hal/espcamera/Camera.c py/objobject.c py/runtime.c msgid "no such attribute" msgstr "" @@ -3755,6 +3795,10 @@ msgstr "" msgid "only mono is supported" msgstr "" +#: extmod/ulab/code/numpy/create.c +msgid "only ndarrays can be concatenated" +msgstr "" + #: ports/stm/common-hal/audiobusio/PDMIn.c msgid "only oversample=64 is supported" msgstr "" @@ -3765,7 +3809,7 @@ msgid "only sample_rate=16000 is supported" msgstr "" #: py/objarray.c py/objstr.c py/objstrunicode.c py/objtuple.c -#: shared-bindings/alarm/SleepMemory.c shared-bindings/coproc/CoprocMemory.c +#: shared-bindings/alarm/SleepMemory.c shared-bindings/memorymap/AddressRange.c #: shared-bindings/nvm/ByteArray.c msgid "only slices with step=1 (aka None) are supported" msgstr "" @@ -3981,10 +4025,6 @@ msgstr "" msgid "slice step can't be zero" msgstr "" -#: py/objslice.c -msgid "slice step cannot be zero" -msgstr "" - #: py/nativeglue.c msgid "slice unsupported" msgstr "" @@ -4033,10 +4073,6 @@ msgstr "" msgid "start/end indices" msgstr "" -#: shared-bindings/random/__init__.c -msgid "step must be non-zero" -msgstr "" - #: shared-bindings/random/__init__.c msgid "stop not reachable from start" msgstr "" @@ -4045,10 +4081,6 @@ msgstr "" msgid "stream operation not supported" msgstr "" -#: py/objstrunicode.c -msgid "string indices must be integers, not %q" -msgstr "" - #: py/stream.c msgid "string not supported; use bytes or bytearray" msgstr "" @@ -4081,10 +4113,6 @@ msgstr "" msgid "syntax error in uctypes descriptor" msgstr "" -#: shared-bindings/time/__init__.c -msgid "time.struct_time() takes a 9-sequence" -msgstr "" - #: ports/atmel-samd/common-hal/watchdog/WatchDogTimer.c #: ports/espressif/common-hal/watchdog/WatchDogTimer.c #: ports/nrf/common-hal/watchdog/WatchDogTimer.c @@ -4352,7 +4380,7 @@ msgstr "" #: extmod/ulab/code/numpy/vector.c msgid "wrong output type" -msgstr "" +msgstr "неверный тип вывода" #: shared-module/displayio/Shape.c msgid "x value out of bounds" @@ -4360,19 +4388,15 @@ msgstr "" #: ports/espressif/common-hal/audiobusio/__init__.c msgid "xTaskCreate failed" -msgstr "" +msgstr "xTaskCreate провалился" #: shared-module/displayio/Shape.c msgid "y value out of bounds" msgstr "" -#: py/objrange.c -msgid "zero step" -msgstr "" - #: extmod/ulab/code/scipy/signal/signal.c msgid "zi must be an ndarray" -msgstr "" +msgstr "zi должен быть bytearray" #: extmod/ulab/code/scipy/signal/signal.c msgid "zi must be of float type" @@ -4382,6 +4406,91 @@ msgstr "zi должно быть типа float" msgid "zi must be of shape (n_section, 2)" msgstr "zi должен иметь форму (n_section, 2)" +#~ msgid "" +#~ "\n" +#~ "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" + +#~ msgid "Attempted heap allocation when VM not running." +#~ msgstr "Попытка выделения heap пока виртуальная машина не запущена." + +#~ msgid "Boot device must be first device (interface #0)." +#~ msgstr "" +#~ "Загрузочное устройство должно быть первым устройством (интерфейс #0)." + +#~ msgid "Both buttons were pressed at start up.\n" +#~ msgstr "Обе кнопки были нажаты при загрузке.\n" + +#~ msgid "Button A was pressed at start up.\n" +#~ msgstr "Кнопка A была нажата при загрузке\n" + +#~ msgid "CircuitPython was unable to allocate the heap." +#~ msgstr "CircuitPython не смог выделить heap." + +#~ msgid "Crash into the HardFault_Handler." +#~ msgstr "Крашнулся в HardFault_Handler." + +#~ msgid "Fatal error." +#~ msgstr "Фатальная ошибка." + +#~ msgid "Invalid memory access." +#~ msgstr "Неправильный доступ к памяти." + +#, fuzzy +#~ msgid "Nordic system firmware failure assertion." +#~ msgstr "Сбой системной прошивки Nordic (assertion)." + +#~ msgid "%q must be of type %q" +#~ msgstr "%q должно быть типа %q" + +#~ msgid "%q must be of type %q or None" +#~ msgstr "%q должно быть типа %q или None" + +#~ msgid "Expected a %q" +#~ msgstr "Ожидалось(ся) %q" + +#~ msgid "Expected a %q or %q" +#~ msgstr "Ожидалось %q или %q" + +#, fuzzy +#~ msgid "Expected an %q" +#~ msgstr "Ожидалось %q" + +#, c-format +#~ msgid "IV must be %d bytes long" +#~ msgstr "IV должен быть длиной %d байт" + +#, fuzzy +#~ msgid "Not settable" +#~ msgstr "Невозможно установить" + +#~ msgid "%q length must be >= 1" +#~ msgstr "Длинна %q должна быть >= 1" + +#~ msgid "%q must be a string" +#~ msgstr "%q должно быть строкой" + +#~ msgid "%q must be an int" +#~ msgstr "%q должно быть int" + +#~ msgid "%q with a report ID of 0 must be of length 1" +#~ msgstr "%q с идентификатором отчёта 0 должен иметь длину 1" + +#~ msgid "At most %d %q may be specified (not %d)" +#~ msgstr "Может быть указано не более %d %q (не %d)" + +#~ msgid "Invalid pins" +#~ msgstr "Недопустимые пины" + +#, c-format +#~ msgid "No more than %d HID devices allowed" +#~ msgstr "Допускается не более %d HID устройств" + #~ msgid "%q indices must be integers, not %s" #~ msgstr "Индексы %q должны быть целыми числами, а не %s" diff --git a/locale/sv.po b/locale/sv.po index 1980477f4f..cfd6fd582c 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-11-11 18:49+0000\n" +"PO-Revision-Date: 2023-02-17 20:38+0000\n" "Last-Translator: Jonny Bergdahl \n" "Language-Team: LANGUAGE \n" "Language: sv\n" @@ -14,7 +14,7 @@ msgstr "" "Content-Type: text/plain; charset=UTF-8\n" "Content-Transfer-Encoding: 8bit\n" "Plural-Forms: nplurals=2; plural=n != 1;\n" -"X-Generator: Weblate 4.15-dev\n" +"X-Generator: Weblate 4.16-dev\n" #: main.c msgid "" @@ -35,12 +35,28 @@ msgstr "" #: supervisor/shared/safe_mode.c msgid "" "\n" -"Please file an issue with the contents of your CIRCUITPY drive at \n" -"https://github.com/adafruit/circuitpython/issues\n" +"Please file an issue with your program at https://github.com/adafruit/" +"circuitpython/issues." msgstr "" "\n" -"Vänligen skapa ett ärende med innehållet i din CIRCUITPY-enhet på\n" -"https://github.com/adafruit/circuitpython/issues\n" +"Skicka in ett ärende med ditt program till https://github.com/adafruit/" +"circuitpython/issues." + +#: supervisor/shared/safe_mode.c +msgid "" +"\n" +"Press reset to exit safe mode.\n" +msgstr "" +"\n" +"Tryck reset för att lämna säkert läge.\n" + +#: supervisor/shared/safe_mode.c +msgid "" +"\n" +"You are in safe mode because:\n" +msgstr "" +"\n" +"Du är i säkert läge eftersom:\n" #: py/obj.c msgid " File \"%q\"" @@ -72,6 +88,11 @@ msgstr "%%c kräver int eller char" msgid "%02X" msgstr "%02X" +#: shared-module/os/getenv.c +#, c-format +msgid "%S" +msgstr "%S" + #: shared-bindings/rgbmatrix/RGBMatrix.c #, c-format msgid "" @@ -88,7 +109,7 @@ msgstr "" #: 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 +#: ports/stm/common-hal/canio/Listener.c ports/stm/common-hal/rtc/RTC.c msgid "%q" msgstr "%q" @@ -108,13 +129,18 @@ msgstr "%q innehåller dubblettstift" msgid "%q failure: %d" msgstr "%q-fel: %d" +#: py/argcheck.c +msgid "%q in %q must be of type %q, not %q" +msgstr "%q i %q måste vara av typen %q, inte %q" + +#: ports/espressif/common-hal/espulp/ULP.c #: ports/raspberrypi/common-hal/rp2pio/StateMachine.c #: shared-bindings/digitalio/DigitalInOut.c #: shared-bindings/microcontroller/Pin.c msgid "%q in use" msgstr "%q används redan" -#: py/obj.c py/objstr.c py/objstrunicode.c +#: py/objstr.c py/objstrunicode.c msgid "%q index out of range" msgstr "Index %q ligger utanför intervallet" @@ -126,7 +152,11 @@ msgstr "%q init misslyckades" msgid "%q is %q" msgstr "%q är %q" -#: py/argcheck.c +#: ports/raspberrypi/common-hal/wifi/Radio.c +msgid "%q is read-only for this board" +msgstr "%q är skrivskyddad för det här kortet" + +#: py/argcheck.c shared-bindings/usb_hid/Device.c msgid "%q length must be %d" msgstr "längden på %q måste vara %d" @@ -142,10 +172,6 @@ msgstr "längden på %q måste vara <= %d" 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" @@ -167,27 +193,23 @@ msgid "%q must be >= %d" msgstr "%q måste vara >= %d" #: shared-bindings/analogbufio/BufferedIn.c +msgid "%q must be a bytearray or array of type 'H' or 'B'" +msgstr "%q måste vara en bytearray eller array av typen 'H' eller 'B'" + #: 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" +#: ports/raspberrypi/bindings/cyw43/__init__.c py/argcheck.c py/objexcept.c +#: shared-bindings/canio/CAN.c shared-bindings/digitalio/Pull.c +msgid "%q must be of type %q or %q, not %q" +msgstr "%q måste vara av typen %q eller %q, inte %q" -#: 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" -msgstr "%q måste vara av typen %q" - -#: shared-bindings/digitalio/Pull.c -msgid "%q must be of type %q or None" -msgstr "%q måste vara av typen %q eller None" +#: py/argcheck.c py/obj.c py/objstrunicode.c +msgid "%q must be of type %q, not %q" +msgstr "%q måste vara av typen %q, inte %q" #: ports/atmel-samd/common-hal/busio/UART.c msgid "%q must be power of 2" @@ -199,7 +221,6 @@ msgstr "%q är utanför gränserna" #: ports/atmel-samd/common-hal/pulseio/PulseIn.c #: ports/cxd56/common-hal/pulseio/PulseIn.c -#: ports/espressif/common-hal/coproc/Coproc.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 @@ -211,9 +232,9 @@ msgstr "%q utanför intervallet" msgid "%q pin invalid" msgstr "Pinne %q ogiltig" -#: 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" +#: py/objrange.c py/objslice.c shared-bindings/random/__init__.c +msgid "%q step cannot be zero" +msgstr "%q steg kan inte vara noll" #: py/bc.c py/objnamedtuple.c msgid "%q() takes %d positional arguments but %d were given" @@ -312,7 +333,7 @@ msgstr "Objektet '%s' stöder inte tilldelning" msgid "'%s' object doesn't support item deletion" msgstr "Objektet '%s' stöder inte borttagning" -#: ports/raspberrypi/common-hal/wifi/Radio.c py/runtime.c +#: py/runtime.c msgid "'%s' object has no attribute '%q'" msgstr "Objektet '%s' har inget attribut '%q'" @@ -412,6 +433,10 @@ msgstr "ADC2 används av WiFi" msgid "Address must be %d bytes long" msgstr "Adressen måste vara %d byte lång" +#: ports/espressif/common-hal/memorymap/AddressRange.c +msgid "Address range not allowed" +msgstr "Adressintervallet är inte tillåtet" + #: ports/espressif/common-hal/canio/CAN.c msgid "All CAN peripherals are in use" msgstr "All I2C-kringutrustning används" @@ -439,7 +464,6 @@ msgid "All SPI peripherals are in use" msgstr "All SPI-kringutrustning används" #: 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 "Alla UART-kringutrustning används" @@ -492,7 +516,7 @@ msgstr "Annonserar redan." msgid "Already have all-matches listener" msgstr "Har redan lyssnare för all-matchningar" -#: ports/espressif/common-hal/coproc/__init__.c +#: ports/espressif/common-hal/espulp/ULP.c #: shared-module/memorymonitor/AllocationAlarm.c #: shared-module/memorymonitor/AllocationSize.c msgid "Already running" @@ -501,7 +525,12 @@ 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" +msgstr "Skannar redan efter WiFi-nätverk" + +#: shared-module/os/getenv.c +#, c-format +msgid "An error occurred while retrieving '%s':\n" +msgstr "Ett fel uppstod vid hämtning av '%s':\n" #: ports/stm/common-hal/audiopwmio/PWMAudioOut.c msgid "Another PWMAudioOut is already active" @@ -516,24 +545,16 @@ msgstr "En annan send är redan aktiv" msgid "Array must contain halfwords (type 'H')" msgstr "Matrisen måste innehålla halfwords (typ \"H\")" -#: shared-bindings/alarm/SleepMemory.c shared-bindings/coproc/CoprocMemory.c +#: shared-bindings/alarm/SleepMemory.c shared-bindings/memorymap/AddressRange.c #: shared-bindings/nvm/ByteArray.c msgid "Array values should be single bytes." msgstr "Matrisvärden ska bestå av enstaka bytes." -#: shared-bindings/microcontroller/Pin.c -msgid "At most %d %q may be specified (not %d)" -msgstr "Högst %d %q kan anges (inte %d)" - #: shared-module/memorymonitor/AllocationAlarm.c #, c-format msgid "Attempt to allocate %d blocks" msgstr "Försök att tilldela %d block" -#: supervisor/shared/safe_mode.c -msgid "Attempted heap allocation when VM not running." -msgstr "Försök till heap-allokering när den virtuella maskinen inte är igång." - #: ports/raspberrypi/audio_dma.c msgid "Audio conversion not implemented" msgstr "Ljudkonvertering inte implementerad" @@ -584,20 +605,13 @@ msgid "Bitmap size and bits per value must match" msgstr "Bitmappstorlek och bitar per värde måste överensstämma" #: supervisor/shared/safe_mode.c -msgid "Boot device must be first device (interface #0)." -msgstr "Startenheten måste vara den första enheten (gränssnitt #0)." +msgid "Boot device must be first (interface #0)." +msgstr "Boot-enhet måste vara först (gränssnitt #0)." #: ports/mimxrt10xx/common-hal/busio/UART.c msgid "Both RX and TX required for flow control" msgstr "Både RX och TX krävs för handskakning" -#: ports/atmel-samd/boards/circuitplayground_express/mpconfigboard.h -#: ports/atmel-samd/boards/circuitplayground_express_crickit/mpconfigboard.h -#: ports/atmel-samd/boards/circuitplayground_express_displayio/mpconfigboard.h -#: ports/atmel-samd/boards/meowmeow/mpconfigboard.h -msgid "Both buttons were pressed at start up.\n" -msgstr "Båda knapparna trycktes ned vid start.\n" - #: ports/atmel-samd/common-hal/rotaryio/IncrementalEncoder.c msgid "Both pins must support hardware interrupts" msgstr "Båda pinnarna måste stödja maskinvaruavbrott" @@ -663,11 +677,6 @@ msgstr "Buffertarna måste ha samma storlek" msgid "Bus pin %d is already in use" msgstr "Busspinne %d används redan" -#: ports/espressif/boards/m5stack_core_basic/mpconfigboard.h -#: ports/espressif/boards/m5stack_core_fire/mpconfigboard.h -msgid "Button A was pressed at start up.\n" -msgstr "Knapp A trycktes ned vid start.\n" - #: shared-bindings/_bleio/UUID.c msgid "Byte buffer must be 16 bytes." msgstr "Byte-buffert måste vara 16 byte." @@ -800,10 +809,6 @@ msgstr "Skrivning för CharacteristicBuffer är inte tillhandahållen" msgid "CircuitPython core code crashed hard. Whoops!\n" msgstr "CircuitPython kärnkod kraschade hårt. Hoppsan!\n" -#: supervisor/shared/safe_mode.c -msgid "CircuitPython was unable to allocate the heap." -msgstr "CircuitPython kunde inte allokera heap." - #: shared-module/bitbangio/I2C.c msgid "Clock stretch too long" msgstr "Klockförlängning för lång" @@ -844,10 +849,6 @@ msgstr "Det gick inte att starta avbrott, RX upptagen" msgid "Couldn't allocate decoder" msgstr "Det gick inte att allokera avkodaren" -#: supervisor/shared/safe_mode.c -msgid "Crash into the HardFault_Handler." -msgstr "Krasch in i HardFault_Handler." - #: ports/stm/common-hal/analogio/AnalogOut.c msgid "DAC Channel Init Error" msgstr "Initieringsfel för DAC-kanal" @@ -910,6 +911,11 @@ msgstr "Klar" msgid "Drive mode not used when direction is input." msgstr "Drivläge används inte när riktning är input." +#: py/obj.c +msgid "During handling of the above exception, another exception occurred:" +msgstr "" +"Under hanteringen av ovanstående undantag inträffade ett annat undantag:" + #: shared-bindings/aesio/aes.c msgid "ECB only operates on 16 bytes at a time" msgstr "ECB arbetar endast på 16 byte åt gången" @@ -935,25 +941,17 @@ msgstr "Fel i MIDI-ström vid position %d" msgid "Error in regex" msgstr "Fel i regex" +#: supervisor/shared/safe_mode.c +msgid "Error in safemode.py." +msgstr "Fel i safemode.py." + #: shared-bindings/socketpool/Socket.c shared-bindings/ssl/SSLSocket.c msgid "Error: Failure to bind" msgstr "Fel: Bind misslyckades" -#: py/enum.c shared-bindings/_bleio/__init__.c shared-bindings/aesio/aes.c -#: shared-bindings/alarm/__init__.c shared-bindings/alarm/coproc/CoprocAlarm.c -#: shared-bindings/busio/SPI.c shared-bindings/coproc/Coproc.c -#: shared-bindings/coproc/__init__.c shared-bindings/microcontroller/Pin.c -#: shared-bindings/neopixel_write/__init__.c -msgid "Expected a %q" -msgstr "Förväntade %q" - -#: ports/raspberrypi/bindings/cyw43/__init__.c -msgid "Expected a %q or %q" -msgstr "Förväntade %q eller %q" - #: shared-bindings/alarm/__init__.c -msgid "Expected an %q" -msgstr "Förväntade en %q" +msgid "Expected a kind of %q" +msgstr "Förväntade en typ av %q" #: ports/espressif/common-hal/_bleio/Adapter.c #: ports/nrf/common-hal/_bleio/Adapter.c @@ -1020,13 +1018,17 @@ msgid "Failed to write internal flash." msgstr "Det gick inte att skriva till intern flash." #: supervisor/shared/safe_mode.c -msgid "Fatal error." -msgstr "Fatalt fel." +msgid "Fault detected by hardware." +msgstr "Fel upptäckt av hårdvara." #: py/moduerrno.c msgid "File exists" msgstr "Filen finns redan" +#: shared-module/os/getenv.c +msgid "File not found" +msgstr "Filen hittades inte" + #: ports/atmel-samd/common-hal/canio/Listener.c #: ports/espressif/common-hal/canio/Listener.c #: ports/stm/common-hal/canio/Listener.c @@ -1041,7 +1043,6 @@ msgstr "Firmware är en dubblett" msgid "Firmware is invalid" msgstr "Firmware är ogiltig" -#: ports/espressif/common-hal/coproc/Coproc.c #: ports/espressif/common-hal/dualbank/__init__.c msgid "Firmware is too big" msgstr "Firmware är för stor" @@ -1085,6 +1086,8 @@ msgstr "Allmänt fel" #: shared-bindings/displayio/Display.c #: shared-bindings/displayio/EPaperDisplay.c #: shared-bindings/framebufferio/FramebufferDisplay.c +#: shared-module/displayio/Display.c +#: shared-module/framebufferio/FramebufferDisplay.c msgid "Group already used" msgstr "Grupp används redan" @@ -1105,6 +1108,15 @@ msgstr "Hårdvaran är upptagen, prova alternativa pinnar" msgid "Hardware in use, try alternative pins" msgstr "Hårdvaran används redan, prova alternativa pinnar" +#: supervisor/shared/safe_mode.c +msgid "Heap allocation when VM not running." +msgstr "Heap-allokering när VM inte körs." + +#: supervisor/shared/safe_mode.c +msgid "" +"Heap was corrupted because the stack was too small. Increase stack size." +msgstr "Heap skadades eftersom stacken var för liten. Öka stackstorlek." + #: extmod/vfs_posix_file.c py/objstringio.c msgid "I/O operation on closed file" msgstr "I/O-operation på stängd fil" @@ -1122,11 +1134,6 @@ msgstr "I2C-enhet används redan" msgid "I2SOut not available" msgstr "I2SOut är inte tillgängligt" -#: shared-bindings/aesio/aes.c -#, c-format -msgid "IV must be %d bytes long" -msgstr "IV måste vara %d byte lång" - #: ports/raspberrypi/bindings/rp2pio/StateMachine.c msgid "In-buffer elements must be <= 4 bytes long" msgstr "Antal element i buffert måste vara <= 4 byte" @@ -1215,6 +1222,7 @@ msgid "Internal define error" msgstr "Internt define-fel" #: ports/espressif/common-hal/paralleldisplay/ParallelBus.c +#: shared-module/os/getenv.c msgid "Internal error" msgstr "Internt fel" @@ -1227,6 +1235,10 @@ msgstr "Internt fel #%d" msgid "Internal watchdog timer expired." msgstr "Intern watchdog-timer har löpt ut." +#: supervisor/shared/safe_mode.c +msgid "Interrupt error." +msgstr "Interrupt-fel." + #: py/argcheck.c shared-bindings/digitalio/DigitalInOut.c msgid "Invalid %q" msgstr "Ogiltig %q" @@ -1261,6 +1273,11 @@ msgstr "Ogiltigt argument" msgid "Invalid bits per value" msgstr "Ogiltigt värde för bitar per värde" +#: shared-module/os/getenv.c +#, c-format +msgid "Invalid byte %.*s" +msgstr "Ogiltig byte %.*s" + #: ports/atmel-samd/common-hal/imagecapture/ParallelImageCapture.c #, c-format msgid "Invalid data_pins[%d]" @@ -1270,18 +1287,10 @@ msgstr "Ogiltig data_pins[%d]" msgid "Invalid format chunk size" msgstr "Ogiltig formatsegmentstorlek" -#: supervisor/shared/safe_mode.c -msgid "Invalid memory access." -msgstr "Ogiltig minnesåtkomst." - #: ports/espressif/common-hal/wifi/Radio.c msgid "Invalid multicast MAC address" msgstr "Ogiltig MAC-adress för multicast" -#: shared-bindings/busio/UART.c -msgid "Invalid pins" -msgstr "Ogiltiga pinnar" - #: ports/espressif/common-hal/espidf/__init__.c ports/espressif/esp_error.c msgid "Invalid size" msgstr "Ogiltig storlek" @@ -1295,10 +1304,18 @@ msgstr "Ogiltig socket för TLS" msgid "Invalid state" msgstr "Ogiltigt tillstånd" +#: shared-module/os/getenv.c +msgid "Invalid unicode escape" +msgstr "Ogiltig unicode escape" + #: 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" +#: shared-module/os/getenv.c +msgid "Key not found" +msgstr "Nyckeln hittades inte" + #: shared-module/is31fl3741/FrameBuffer.c msgid "LED mappings must match display size" msgstr "LED-mappning måste matcha displaystorlek" @@ -1406,6 +1423,10 @@ msgstr "NLR jump misslyckades. Troligen korrupt minne." msgid "NVS Error" msgstr "NVS-fel" +#: shared-bindings/socketpool/SocketPool.c +msgid "Name or service not known" +msgstr "Namn eller tjänst inte känd" + #: py/qstr.c msgid "Name too long" msgstr "Name är för långt" @@ -1520,11 +1541,6 @@ msgstr "Ingen nyckel angavs" msgid "No long integer support" msgstr "Inget stöd för långt heltal" -#: shared-module/usb_hid/__init__.c -#, c-format -msgid "No more than %d HID devices allowed" -msgstr "Högst %d HID-enheter är tillåtna" - #: shared-bindings/wifi/Radio.c msgid "No network with that ssid" msgstr "Inget nätverk med sådant ssid" @@ -1560,10 +1576,6 @@ msgstr "Ingen sådan fil/katalog" msgid "No timer available" msgstr "Ingen timer tillgänglig" -#: supervisor/shared/safe_mode.c -msgid "Nordic system firmware failure assertion." -msgstr "Felaktigt tillstånd i Nordic systemfirmware." - #: ports/nrf/common-hal/_bleio/__init__.c msgid "Nordic system firmware out of memory" msgstr "Nordic systemfirmware fick slut på minne" @@ -1583,10 +1595,6 @@ msgstr "Inte ansluten" msgid "Not playing" msgstr "Ingen uppspelning" -#: shared-bindings/_bleio/__init__.c -msgid "Not settable" -msgstr "Går inte sätta" - #: ports/espressif/common-hal/paralleldisplay/ParallelBus.c #, c-format msgid "Number of data_pins must be 8 or 16, not %d" @@ -1654,11 +1662,14 @@ msgstr "" "Endast monokrom, indexerad 4 bpp eller 8 bpp och 16 bpp eller högre BMP: er " "stöds: %d bpp angiven" -#: ports/espressif/common-hal/alarm/coproc/CoprocAlarm.c #: ports/espressif/common-hal/alarm/touch/TouchAlarm.c msgid "Only one %q can be set in deep sleep." msgstr "Endast en %q kan sättas i djup sömn." +#: ports/espressif/common-hal/espulp/ULPAlarm.c +msgid "Only one %q can be set." +msgstr "Endast en %q kan ställas in." + #: ports/espressif/common-hal/i2ctarget/I2CTarget.c #: ports/raspberrypi/common-hal/i2ctarget/I2CTarget.c msgid "Only one address is allowed" @@ -1691,6 +1702,10 @@ msgstr "Operation eller funktion stöds inte" msgid "Operation timed out" msgstr "Åtgärden orsakade timeout" +#: ports/raspberrypi/common-hal/mdns/Server.c +msgid "Out of MDNS service slots" +msgstr "Slut på MDNS-serviceplatser" + #: ports/espressif/common-hal/espidf/__init__.c ports/espressif/esp_error.c msgid "Out of memory" msgstr "Slut på minne" @@ -1821,6 +1836,10 @@ msgstr "Program gör OUT utan att läsa in OSR" msgid "Program size invalid" msgstr "Programstorlek ogiltig" +#: ports/espressif/common-hal/espulp/ULP.c +msgid "Program too long" +msgstr "Programmet är för långt" + #: shared-bindings/digitalio/DigitalInOut.c msgid "Pull not used when direction is output." msgstr "Pull används inte när riktningen är output." @@ -1860,8 +1879,9 @@ msgstr "RTC stöds inte av detta kort" msgid "Random number generation error" msgstr "Fel vid generering av slumptal" +#: shared-bindings/_bleio/__init__.c #: shared-bindings/memorymonitor/AllocationSize.c -#: shared-bindings/pulseio/PulseIn.c +#: shared-bindings/pulseio/PulseIn.c shared-module/displayio/Bitmap.c msgid "Read-only" msgstr "Skrivskyddad" @@ -1869,10 +1889,6 @@ msgstr "Skrivskyddad" msgid "Read-only filesystem" msgstr "Skrivskyddat filsystem" -#: shared-module/displayio/Bitmap.c -msgid "Read-only object" -msgstr "Skrivskyddat objekt" - #: ports/espressif/common-hal/espidf/__init__.c ports/espressif/esp_error.c msgid "Received response was invalid" msgstr "Mottaget svar var ogiltigt" @@ -1965,7 +1981,7 @@ msgstr "Storleken stöds inte" msgid "Sleep Memory not available" msgstr "Sömnminne inte tillgängligt" -#: shared-bindings/alarm/SleepMemory.c shared-bindings/coproc/CoprocMemory.c +#: shared-bindings/alarm/SleepMemory.c shared-bindings/memorymap/AddressRange.c #: shared-bindings/nvm/ByteArray.c msgid "Slice and value different lengths." msgstr "Slice och värde har olika längd." @@ -2002,6 +2018,10 @@ 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" +#: ports/raspberrypi/common-hal/wifi/Radio.c +msgid "Stopping AP is not supported." +msgstr "Stoppa AP stöds inte." + #: 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" @@ -2019,55 +2039,20 @@ msgid "Temperature read timed out" msgstr "Temperaturavläsning tog för lång tid" #: supervisor/shared/safe_mode.c -msgid "The BOOT button was pressed at start up.\n" -msgstr "BOOT-knappen trycktes ner vid start.\n" +msgid "The `microcontroller` module was used to boot into safe mode." +msgstr "Modulen `microcontroller` användes för att starta i felsäkert läge." -#: supervisor/shared/safe_mode.c -msgid "" -"The CircuitPython heap was corrupted because the stack was too small.\n" -"Increase the stack size if you know how. If not:" -msgstr "" -"CircuitPython-heapen blev korrupt eftersom stacken är för liten.\n" -"Öka stackstorleken om du vet hur, eller om inte:" - -#: ports/espressif/boards/adafruit_feather_esp32_v2/mpconfigboard.h -msgid "The SW38 button was pressed at start up.\n" -msgstr "SW38-knappen trycktes ned vid start.\n" - -#: ports/espressif/boards/hardkernel_odroid_go/mpconfigboard.h -msgid "The VOLUME button was pressed at start up.\n" -msgstr "VOLUME-knappen trycktes ned vid start.\n" - -#: supervisor/shared/safe_mode.c -msgid "" -"The `microcontroller` module was used to boot into safe mode. Press reset to " -"exit safe mode." -msgstr "" -"Modulen `microcontroller` användes för att starta upp i felsäkert läge. " -"Tryck på reset för att avsluta felsäkert läget." - -#: ports/espressif/boards/m5stack_atom_lite/mpconfigboard.h -msgid "The central button was pressed at start up.\n" -msgstr "Mittknappen trycktes in vid start.\n" - -#: ports/nrf/boards/aramcon2_badge/mpconfigboard.h -msgid "The left button was pressed at start up.\n" -msgstr "Den vänstra knappen trycktes ned vid start.\n" +#: py/obj.c +msgid "The above exception was the direct cause of the following exception:" +msgstr "Ovanstående undantag var den direkta orsaken till följande undantag:" #: shared-bindings/rgbmatrix/RGBMatrix.c msgid "The length of rgb_pins must be 6, 12, 18, 24, or 30" msgstr "Längden på rgb_pins vara 6, 12, 18, 24 eller 30" #: supervisor/shared/safe_mode.c -msgid "" -"The microcontroller's power dipped. Make sure your power supply provides\n" -"enough power for the whole circuit and press reset (after ejecting " -"CIRCUITPY)." -msgstr "" -"Mikrokontrollerns matningsspänning sjönk. Se till att strömförsörjningen " -"ger\n" -"tillräckligt med ström för hela kretsen och tryck på reset (efter utmatning " -"av CIRCUITPY)." +msgid "The power dipped. Make sure you are providing enough power." +msgstr "Spänningen sjönk. Se till att du ger tillräckligt med ström." #: shared-module/audiomixer/MixerVoice.c msgid "The sample's bits_per_sample does not match the mixer's" @@ -2085,6 +2070,10 @@ msgstr "Samplingens frekvens matchar inte mixerns" msgid "The sample's signedness does not match the mixer's" msgstr "Samplingens signerad/osignerad stämmer inte med mixern" +#: supervisor/shared/safe_mode.c +msgid "Third-party firmware fatal error." +msgstr "Fel från firmware från tredje part." + #: shared-module/imagecapture/ParallelImageCapture.c msgid "This microcontroller does not support continuous capture." msgstr "Den här mikrokontrollern stöder inte kontinuerlig insamling." @@ -2119,10 +2108,6 @@ msgstr "Tid har passerats." msgid "Timeout is too long: Maximum timeout length is %d seconds" msgstr "Åtgärden tog för lång tid: Max väntetid är %d sekunder" -#: supervisor/shared/safe_mode.c -msgid "To exit, please reset the board without requesting safe mode." -msgstr "För att avsluta, återställ kortet utan att begära säkert läge." - #: ports/atmel-samd/common-hal/audiobusio/I2SOut.c msgid "Too many channels in sample" msgstr "För många kanaler i urvalet" @@ -2167,6 +2152,10 @@ msgstr "UART omstart" msgid "UART init" msgstr "UART start" +#: ports/raspberrypi/common-hal/busio/UART.c +msgid "UART peripheral in use" +msgstr "" + #: ports/stm/common-hal/busio/UART.c msgid "UART re-init" msgstr "UART omstart" @@ -2214,6 +2203,10 @@ msgstr "UUID-värdet är inte str, int eller byte-buffert" msgid "Unable to allocate buffers for signed conversion" msgstr "Det går inte att allokera buffert för signerad konvertering" +#: supervisor/shared/safe_mode.c +msgid "Unable to allocate the heap." +msgstr "Kan inte allokera heap." + #: ports/espressif/common-hal/busio/I2C.c msgid "Unable to create lock" msgstr "Kan inte skapa lås" @@ -2237,12 +2230,13 @@ msgid "Unable to read color palette data" msgstr "Det går inte att läsa färgpalettdata" #: ports/espressif/common-hal/mdns/Server.c +#: ports/raspberrypi/common-hal/mdns/Server.c msgid "Unable to start mDNS query" msgstr "Det gick inte att starta mDNS-frågan" -#: shared-bindings/coproc/CoprocMemory.c -msgid "Unable to write" -msgstr "Kan inte skriva" +#: shared-bindings/memorymap/AddressRange.c +msgid "Unable to write to address." +msgstr "Det går inte att skriva till adress." #: shared-bindings/nvm/ByteArray.c msgid "Unable to write to nvm." @@ -2312,6 +2306,7 @@ msgid "Unkown error code %d" msgstr "Okänd felkod %d" #: shared-bindings/adafruit_pixelbuf/PixelBuf.c +#: shared-module/_pixelmap/PixelMap.c #, c-format msgid "Unmatched number of items on RHS (expected %d, got %d)." msgstr "Omatchat antal på RHS (förväntat %d, fick %d)." @@ -2404,6 +2399,18 @@ msgstr "" msgid "Wi-Fi: " msgstr "Wi-Fi: " +#: ports/raspberrypi/common-hal/wifi/Radio.c +msgid "Wifi is in access point mode." +msgstr "WiFi är i accesspunktläge." + +#: ports/raspberrypi/common-hal/wifi/Radio.c +msgid "Wifi is in station mode." +msgstr "WiFi är i stationsläge." + +#: ports/raspberrypi/common-hal/wifi/Radio.c +msgid "Wifi is not enabled" +msgstr "WiFi är inte aktiverat" + #: main.c msgid "Woken up by alarm.\n" msgstr "Vaknade av larm.\n" @@ -2413,16 +2420,49 @@ msgstr "Vaknade av larm.\n" msgid "Writes not supported on Characteristic" msgstr "Skrivning stöds inte på karaktäristik" -#: supervisor/shared/safe_mode.c -msgid "You are in safe mode because:\n" -msgstr "Du är i felsäkert läge eftersom:\n" +#: ports/atmel-samd/boards/circuitplayground_express/mpconfigboard.h +#: ports/atmel-samd/boards/circuitplayground_express_crickit/mpconfigboard.h +#: ports/atmel-samd/boards/circuitplayground_express_displayio/mpconfigboard.h +#: ports/atmel-samd/boards/meowmeow/mpconfigboard.h +msgid "You pressed both buttons at start up." +msgstr "Du tryckte ner båda knapparna vid start." + +#: ports/espressif/boards/m5stack_core_basic/mpconfigboard.h +#: ports/espressif/boards/m5stack_core_fire/mpconfigboard.h +#: ports/espressif/boards/m5stack_stick_c/mpconfigboard.h +msgid "You pressed button A at start up." +msgstr "Du tryckte ner knapp A vid start." #: supervisor/shared/safe_mode.c -msgid "" -"You pressed the reset button during boot. Press again to exit safe mode." -msgstr "" -"Du tryckte på resetknappen under uppstarten. Tryck igen för att avsluta " -"felsäkert läge." +msgid "You pressed the BOOT button at start up" +msgstr "Du tryckte ner BOOT-knappen vid start" + +#: ports/espressif/boards/adafruit_feather_esp32_v2/mpconfigboard.h +msgid "You pressed the SW38 button at start up." +msgstr "Du tryckte ned SW38-knappen vid start." + +#: ports/espressif/boards/hardkernel_odroid_go/mpconfigboard.h +msgid "You pressed the VOLUME button at start up." +msgstr "Du tryckte ned VOLYM-knappen vid start." + +#: ports/espressif/boards/m5stack_atom_echo/mpconfigboard.h +#: ports/espressif/boards/m5stack_atom_lite/mpconfigboard.h +#: ports/espressif/boards/m5stack_atom_matrix/mpconfigboard.h +#: ports/espressif/boards/m5stack_atom_u/mpconfigboard.h +msgid "You pressed the central button at start up." +msgstr "Du tryckte ned mittknappen vid start." + +#: ports/nrf/boards/aramcon2_badge/mpconfigboard.h +msgid "You pressed the left button at start up." +msgstr "Du tryckte ned vänster knapp vid start." + +#: supervisor/shared/safe_mode.c +msgid "You pressed the reset button during boot." +msgstr "Du tryckte på reset-knappen under uppstart." + +#: supervisor/shared/micropython.c +msgid "[truncated due to length]" +msgstr "[trunkerad på grund av längd]" #: py/objtype.c msgid "__init__() should return None" @@ -2493,8 +2533,12 @@ msgstr "array och indexlängd måste vara lika" msgid "array has too many dimensions" msgstr "array har för många dimensioner" +#: extmod/ulab/code/ndarray.c +msgid "array is too big" +msgstr "matrisen är för stor" + #: py/objarray.c shared-bindings/alarm/SleepMemory.c -#: shared-bindings/coproc/CoprocMemory.c shared-bindings/nvm/ByteArray.c +#: shared-bindings/memorymap/AddressRange.c shared-bindings/nvm/ByteArray.c msgid "array/bytes required on right side" msgstr "array/bytes krävs på höger sida" @@ -2587,10 +2631,6 @@ msgstr "buffert för liten" msgid "buffer too small for requested bytes" msgstr "buffert för liten för begärd längd" -#: shared-bindings/adafruit_pixelbuf/PixelBuf.c -msgid "byteorder is not a string" -msgstr "byteorder är inte en sträng" - #: py/objarray.c msgid "bytes length not a multiple of item size" msgstr "bytelängd inte en multipel av storlek" @@ -2632,14 +2672,10 @@ msgstr "kan inte tilldela uttryck" msgid "can't cancel self" msgstr "kan inte avbryta sig själv" -#: py/obj.c py/objint.c shared-module/adafruit_pixelbuf/PixelBuf.c +#: py/obj.c py/objint.c py/runtime.c shared-module/adafruit_pixelbuf/PixelBuf.c msgid "can't convert %q to %q" msgstr "kan inte konvertera %q till %q" -#: py/runtime.c -msgid "can't convert %q to int" -msgstr "kan inte konvertera %q till int" - #: py/obj.c #, c-format msgid "can't convert %s to complex" @@ -2721,6 +2757,10 @@ msgstr "kan inte sätta blockstorlek 512" msgid "can't set attribute" msgstr "kan inte att ange attribut" +#: py/runtime.c +msgid "can't set attribute '%q'" +msgstr "kan inte sätta attribut '%q'" + #: py/emitnative.c msgid "can't store '%q'" msgstr "kan inte lagra '%q'" @@ -2825,10 +2865,6 @@ msgstr "färg måste vara mellan 0x000000 och 0xffffff" msgid "comparison of int and uint" msgstr "jämförelse av int och uint" -#: py/objcomplex.c -msgid "complex division by zero" -msgstr "komplex division med noll" - #: py/objfloat.c py/parsenum.c msgid "complex values not supported" msgstr "komplexa värden stöds inte" @@ -2934,12 +2970,11 @@ msgstr "dimensioner matchar inte" msgid "div/mod not implemented for uint" msgstr "div/mod inte implementerat för uint" -#: py/objfloat.c py/objint_mpz.c +#: extmod/ulab/code/numpy/create.c msgid "divide by zero" msgstr "division med noll" -#: py/modmath.c py/objint_longlong.c py/runtime.c -#: shared-bindings/math/__init__.c +#: py/runtime.c msgid "division by zero" msgstr "division med noll" @@ -2980,26 +3015,18 @@ msgstr "epoch_time stöds inte av detta kort" msgid "error = 0x%08lX" msgstr "fel = 0x%08lX" -#: ports/espressif/common-hal/esp32_camera/Camera.c +#: ports/espressif/common-hal/espcamera/Camera.c msgid "" -"esp32_camera.Camera requires reserved PSRAM to be configured. See the " +"espcamera.Camera requires reserved PSRAM to be configured. See the " "documentation for instructions." msgstr "" -"esp32_camera.Camera kräver reserverad PSRAM att konfigureras. Se " +"espcamera.Camera kräver reserverat PSRAM att vara konfigurerat. Se " "dokumentationen för instruktioner." #: py/runtime.c msgid "exceptions must derive from BaseException" msgstr "exceptions måste ärvas från BaseException" -#: shared-bindings/canio/CAN.c -msgid "expected '%q' but got '%q'" -msgstr "förväntade '%q' men fick '%q'" - -#: shared-bindings/canio/CAN.c -msgid "expected '%q' or '%q' but got '%q'" -msgstr "förväntade '%q' eller '%q' men fick '%q'" - #: py/objstr.c msgid "expected ':' after format specifier" msgstr "förväntade ':' efter formatspecifikation" @@ -3098,10 +3125,6 @@ msgstr "typsnitt måste vara 2048 bytes långt" msgid "format requires a dict" msgstr "formatet kräver en dict" -#: shared-bindings/microcontroller/Processor.c -msgid "frequency is read-only for this board" -msgstr "frekvens är skrivskyddad för detta kort" - #: py/objdeque.c msgid "full" msgstr "full" @@ -3214,8 +3237,12 @@ msgstr "felaktig utfyllnad" msgid "index is out of bounds" msgstr "index är utanför gränserna" +#: shared-bindings/_pixelmap/PixelMap.c +msgid "index must be tuple or int" +msgstr "index måste vara tuple eller int" + #: extmod/ulab/code/numpy/numerical.c extmod/ulab/code/ulab_tools.c -#: ports/espressif/common-hal/pulseio/PulseIn.c py/obj.c +#: ports/espressif/common-hal/pulseio/PulseIn.c #: shared-bindings/bitmaptools/__init__.c msgid "index out of range" msgstr "index utanför intervallet" @@ -3313,10 +3340,6 @@ msgstr "indatavektorer måste ha samma längd" msgid "inputs are not iterable" msgstr "indata är inte iterbara" -#: py/parsenum.c -msgid "int() arg 2 must be >= 2 and <= 36" -msgstr "int() arg 2 måste vara >= 2 och <= 36" - #: extmod/ulab/code/numpy/approx.c msgid "interp is defined for 1D iterables of equal length" msgstr "interp är definierad för 1D-iterabla med samma längd" @@ -3373,7 +3396,7 @@ msgstr "ogiltig nyckel" msgid "invalid micropython decorator" msgstr "ogiltig mikropython-dekorator" -#: ports/espressif/common-hal/esp32_camera/Camera.c +#: ports/espressif/common-hal/espcamera/Camera.c msgid "invalid setting" msgstr "ogiltig inställning" @@ -3398,10 +3421,6 @@ msgstr "ogiltig syntax för heltal med bas %d" msgid "invalid syntax for number" msgstr "ogiltig syntax för tal" -#: py/objexcept.c -msgid "invalid traceback" -msgstr "Ogilitig källspårning" - #: py/objtype.c msgid "issubclass() arg 1 must be a class" msgstr "issubclass() arg 1 måste vara en klass" @@ -3461,19 +3480,17 @@ msgstr "lokal '%q' används innan typen är känd" msgid "local variable referenced before assignment" msgstr "lokal variabel refererad före tilldelning" -#: py/objint.c -msgid "long int not supported in this build" -msgstr "long int stöds inte i denna build" - #: ports/espressif/common-hal/canio/CAN.c msgid "loopback + silent mode not supported by peripheral" msgstr "loopback + tyst läge stöds inte av kringutrustning" #: ports/espressif/common-hal/mdns/Server.c +#: ports/raspberrypi/common-hal/mdns/Server.c msgid "mDNS already initialized" msgstr "mDNS har redan initierats" #: ports/espressif/common-hal/mdns/Server.c +#: ports/raspberrypi/common-hal/mdns/Server.c msgid "mDNS only works with built-in WiFi" msgstr "mDNS fungerar bara med inbyggt WiFi" @@ -3602,6 +3619,10 @@ msgstr "negativ exponent utan stöd för flyttal" msgid "negative shift count" msgstr "negativt skiftantal" +#: shared-bindings/_pixelmap/PixelMap.c +msgid "nested index must be int" +msgstr "nästlat index måste vara en int" + #: shared-module/sdcardio/SDCard.c msgid "no SD card" msgstr "inget SD-kort" @@ -3635,7 +3656,7 @@ msgstr "ingen reset-pinne tillgänglig" msgid "no response from SD card" msgstr "inget svar från SD-kort" -#: ports/espressif/common-hal/esp32_camera/Camera.c py/objobject.c py/runtime.c +#: ports/espressif/common-hal/espcamera/Camera.c py/objobject.c py/runtime.c msgid "no such attribute" msgstr "inget sådant attribut" @@ -3771,6 +3792,10 @@ msgstr "bara bit_depth=16 stöds" msgid "only mono is supported" msgstr "endast mono stöds" +#: extmod/ulab/code/numpy/create.c +msgid "only ndarrays can be concatenated" +msgstr "endast ndarrays kan sammanfogas" + #: ports/stm/common-hal/audiobusio/PDMIn.c msgid "only oversample=64 is supported" msgstr "endast oversample=64 stöds" @@ -3781,7 +3806,7 @@ msgid "only sample_rate=16000 is supported" msgstr "enbart sample_rate=16000 stöds" #: py/objarray.c py/objstr.c py/objstrunicode.c py/objtuple.c -#: shared-bindings/alarm/SleepMemory.c shared-bindings/coproc/CoprocMemory.c +#: shared-bindings/alarm/SleepMemory.c shared-bindings/memorymap/AddressRange.c #: shared-bindings/nvm/ByteArray.c msgid "only slices with step=1 (aka None) are supported" msgstr "endast segment med steg=1 (aka Ingen) stöds" @@ -3998,10 +4023,6 @@ msgstr "värdet för sleep måste vara positivt" msgid "slice step can't be zero" msgstr "segmentsteg kan inte vara noll" -#: py/objslice.c -msgid "slice step cannot be zero" -msgstr "segmentsteg kan inte vara noll" - #: py/nativeglue.c msgid "slice unsupported" msgstr "slice stöds inte" @@ -4050,10 +4071,6 @@ msgstr "source_bitmap måste ha value_count av 8" msgid "start/end indices" msgstr "start-/slutindex" -#: shared-bindings/random/__init__.c -msgid "step must be non-zero" -msgstr "step måste vara icke-noll" - #: shared-bindings/random/__init__.c msgid "stop not reachable from start" msgstr "stop kan inte nås från start" @@ -4062,10 +4079,6 @@ msgstr "stop kan inte nås från start" msgid "stream operation not supported" msgstr "stream-åtgärd stöds inte" -#: py/objstrunicode.c -msgid "string indices must be integers, not %q" -msgstr "strängindex måste vara heltal, inte %q" - #: py/stream.c msgid "string not supported; use bytes or bytearray" msgstr "sträng stöds inte; använd bytes eller bytearray" @@ -4098,10 +4111,6 @@ msgstr "syntaxfel i JSON" msgid "syntax error in uctypes descriptor" msgstr "syntaxfel i uctypes deskriptor" -#: shared-bindings/time/__init__.c -msgid "time.struct_time() takes a 9-sequence" -msgstr "time.struct_time() kräver en 9-sekvens" - #: ports/atmel-samd/common-hal/watchdog/WatchDogTimer.c #: ports/espressif/common-hal/watchdog/WatchDogTimer.c #: ports/nrf/common-hal/watchdog/WatchDogTimer.c @@ -4319,7 +4328,7 @@ 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" +msgstr "WiFi är inte aktiverat" #: ports/raspberrypi/common-hal/wifi/Monitor.c msgid "wifi.Monitor not available" @@ -4383,10 +4392,6 @@ msgstr "xTaskCreate misslyckades" msgid "y value out of bounds" msgstr "y-värde utanför intervall" -#: py/objrange.c -msgid "zero step" -msgstr "noll steg" - #: extmod/ulab/code/scipy/signal/signal.c msgid "zi must be an ndarray" msgstr "zi måste vara en ndarray" @@ -4399,6 +4404,196 @@ 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 "" +#~ "\n" +#~ "Please file an issue with the contents of your CIRCUITPY drive at \n" +#~ "https://github.com/adafruit/circuitpython/issues\n" +#~ msgstr "" +#~ "\n" +#~ "Vänligen skapa ett ärende med innehållet i din CIRCUITPY-enhet på\n" +#~ "https://github.com/adafruit/circuitpython/issues\n" + +#~ msgid "Attempted heap allocation when VM not running." +#~ msgstr "" +#~ "Försök till heap-allokering när den virtuella maskinen inte är igång." + +#~ msgid "Boot device must be first device (interface #0)." +#~ msgstr "Startenheten måste vara den första enheten (gränssnitt #0)." + +#~ msgid "Both buttons were pressed at start up.\n" +#~ msgstr "Båda knapparna trycktes ned vid start.\n" + +#~ msgid "Button A was pressed at start up.\n" +#~ msgstr "Knapp A trycktes ned vid start.\n" + +#~ msgid "CircuitPython was unable to allocate the heap." +#~ msgstr "CircuitPython kunde inte allokera heap." + +#~ msgid "Crash into the HardFault_Handler." +#~ msgstr "Krasch in i HardFault_Handler." + +#~ msgid "Fatal error." +#~ msgstr "Fatalt fel." + +#~ msgid "Invalid memory access." +#~ msgstr "Ogiltig minnesåtkomst." + +#~ msgid "Nordic system firmware failure assertion." +#~ msgstr "Felaktigt tillstånd i Nordic systemfirmware." + +#~ msgid "The BOOT button was pressed at start up.\n" +#~ msgstr "BOOT-knappen trycktes ner vid start.\n" + +#~ msgid "" +#~ "The CircuitPython heap was corrupted because the stack was too small.\n" +#~ "Increase the stack size if you know how. If not:" +#~ msgstr "" +#~ "CircuitPython-heapen blev korrupt eftersom stacken är för liten.\n" +#~ "Öka stackstorleken om du vet hur, eller om inte:" + +#~ msgid "The SW38 button was pressed at start up.\n" +#~ msgstr "SW38-knappen trycktes ned vid start.\n" + +#~ msgid "The VOLUME button was pressed at start up.\n" +#~ msgstr "VOLUME-knappen trycktes ned vid start.\n" + +#~ msgid "" +#~ "The `microcontroller` module was used to boot into safe mode. Press reset " +#~ "to exit safe mode." +#~ msgstr "" +#~ "Modulen `microcontroller` användes för att starta upp i felsäkert läge. " +#~ "Tryck på reset för att avsluta felsäkert läget." + +#~ msgid "The central button was pressed at start up.\n" +#~ msgstr "Mittknappen trycktes in vid start.\n" + +#~ msgid "The left button was pressed at start up.\n" +#~ msgstr "Den vänstra knappen trycktes ned vid start.\n" + +#~ msgid "" +#~ "The microcontroller's power dipped. Make sure your power supply provides\n" +#~ "enough power for the whole circuit and press reset (after ejecting " +#~ "CIRCUITPY)." +#~ msgstr "" +#~ "Mikrokontrollerns matningsspänning sjönk. Se till att strömförsörjningen " +#~ "ger\n" +#~ "tillräckligt med ström för hela kretsen och tryck på reset (efter " +#~ "utmatning av CIRCUITPY)." + +#~ msgid "To exit, please reset the board without requesting safe mode." +#~ msgstr "För att avsluta, återställ kortet utan att begära säkert läge." + +#~ msgid "You are in safe mode because:\n" +#~ msgstr "Du är i felsäkert läge eftersom:\n" + +#~ msgid "" +#~ "You pressed the reset button during boot. Press again to exit safe mode." +#~ msgstr "" +#~ "Du tryckte på resetknappen under uppstarten. Tryck igen för att avsluta " +#~ "felsäkert läge." + +#~ msgid "" +#~ "esp32_camera.Camera requires reserved PSRAM to be configured. See the " +#~ "documentation for instructions." +#~ msgstr "" +#~ "esp32_camera.Camera kräver reserverad PSRAM att konfigureras. Se " +#~ "dokumentationen för instruktioner." + +#~ msgid "%q must be of type %q" +#~ msgstr "%q måste vara av typen %q" + +#~ msgid "%q must be of type %q or None" +#~ msgstr "%q måste vara av typen %q eller None" + +#~ msgid "Expected a %q" +#~ msgstr "Förväntade %q" + +#~ msgid "Expected a %q or %q" +#~ msgstr "Förväntade %q eller %q" + +#~ msgid "Expected an %q" +#~ msgstr "Förväntade en %q" + +#, c-format +#~ msgid "IV must be %d bytes long" +#~ msgstr "IV måste vara %d byte lång" + +#~ msgid "Not settable" +#~ msgstr "Går inte sätta" + +#~ msgid "expected '%q' but got '%q'" +#~ msgstr "förväntade '%q' men fick '%q'" + +#~ msgid "expected '%q' or '%q' but got '%q'" +#~ msgstr "förväntade '%q' eller '%q' men fick '%q'" + +#~ msgid "Read-only object" +#~ msgstr "Skrivskyddat objekt" + +#~ msgid "frequency is read-only for this board" +#~ msgstr "frekvens är skrivskyddad för detta kort" + +#~ msgid "Pins 21+ not supported from ULP" +#~ msgstr "Pins 21+ stöds inte av ULP" + +#~ msgid "Unable to write" +#~ msgstr "Kan inte skriva" + +#~ msgid "%q length must be >= 1" +#~ msgstr "längden på %q måste vara >= 1" + +#~ msgid "%q must be a string" +#~ msgstr "%q måste vara en sträng" + +#~ msgid "%q must be an int" +#~ msgstr "%q måste vara en int" + +#~ 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" + +#~ msgid "At most %d %q may be specified (not %d)" +#~ msgstr "Högst %d %q kan anges (inte %d)" + +#~ msgid "Invalid pins" +#~ msgstr "Ogiltiga pinnar" + +#, c-format +#~ msgid "No more than %d HID devices allowed" +#~ msgstr "Högst %d HID-enheter är tillåtna" + +#~ msgid "byteorder is not a string" +#~ msgstr "byteorder är inte en sträng" + +#~ msgid "can't convert %q to int" +#~ msgstr "kan inte konvertera %q till int" + +#~ msgid "complex division by zero" +#~ msgstr "komplex division med noll" + +#~ msgid "int() arg 2 must be >= 2 and <= 36" +#~ msgstr "int() arg 2 måste vara >= 2 och <= 36" + +#~ msgid "long int not supported in this build" +#~ msgstr "long int stöds inte i denna build" + +#~ msgid "slice step cannot be zero" +#~ msgstr "segmentsteg kan inte vara noll" + +#~ msgid "step must be non-zero" +#~ msgstr "step måste vara icke-noll" + +#~ msgid "string indices must be integers, not %q" +#~ msgstr "strängindex måste vara heltal, inte %q" + +#~ msgid "time.struct_time() takes a 9-sequence" +#~ msgstr "time.struct_time() kräver en 9-sekvens" + +#~ msgid "zero step" +#~ msgstr "noll steg" + +#~ msgid "invalid traceback" +#~ msgstr "Ogilitig källspårning" + #~ msgid "%q indices must be integers, not %s" #~ msgstr "Indexet %q måste vara ett heltal, inte %s" diff --git a/locale/tr.po b/locale/tr.po index 1d8eacdae0..1adac6b08d 100644 --- a/locale/tr.po +++ b/locale/tr.po @@ -7,7 +7,7 @@ msgid "" msgstr "" "Project-Id-Version: PACKAGE VERSION\n" "Report-Msgid-Bugs-To: \n" -"PO-Revision-Date: 2022-10-10 18:23+0000\n" +"PO-Revision-Date: 2022-12-05 21:48+0000\n" "Last-Translator: Boran Roni \n" "Language-Team: none\n" "Language: tr\n" @@ -15,7 +15,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.14.1\n" +"X-Generator: Weblate 4.15-dev\n" #: main.c msgid "" @@ -37,13 +37,21 @@ msgstr "" #: supervisor/shared/safe_mode.c msgid "" "\n" -"Please file an issue with the contents of your CIRCUITPY drive at \n" -"https://github.com/adafruit/circuitpython/issues\n" +"Please file an issue with your program at https://github.com/adafruit/" +"circuitpython/issues." msgstr "" + +#: supervisor/shared/safe_mode.c +msgid "" "\n" -"Lütfen, şu adrese CIRCUITPY sürücünüzün içerikleri ile beraber bir hata/konu " -"kaydı ekleyin\n" -"https://github.com/adafruit/circuitpython/issues\n" +"Press reset to exit safe mode.\n" +msgstr "" + +#: supervisor/shared/safe_mode.c +msgid "" +"\n" +"You are in safe mode because:\n" +msgstr "" #: py/obj.c msgid " File \"%q\"" @@ -73,6 +81,11 @@ msgstr "%%c int veya char tipine ihtiyaç duyar" #: main.c #, c-format msgid "%02X" +msgstr "%02X" + +#: shared-module/os/getenv.c +#, c-format +msgid "%S" msgstr "" #: shared-bindings/rgbmatrix/RGBMatrix.c @@ -92,7 +105,7 @@ msgstr "" #: 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 +#: ports/stm/common-hal/canio/Listener.c ports/stm/common-hal/rtc/RTC.c msgid "%q" msgstr "%q" @@ -112,13 +125,18 @@ msgstr "%q yinelenen pinler içeriyor" msgid "%q failure: %d" msgstr "%q hata: %d" +#: py/argcheck.c +msgid "%q in %q must be of type %q, not %q" +msgstr "" + +#: ports/espressif/common-hal/espulp/ULP.c #: ports/raspberrypi/common-hal/rp2pio/StateMachine.c #: shared-bindings/digitalio/DigitalInOut.c #: shared-bindings/microcontroller/Pin.c msgid "%q in use" msgstr "%q kullanımda" -#: py/obj.c py/objstr.c py/objstrunicode.c +#: py/objstr.c py/objstrunicode.c msgid "%q index out of range" msgstr "%q indeksi aralık dışında" @@ -128,9 +146,13 @@ msgstr "%q init başarısız oldu" #: shared-bindings/dualbank/__init__.c msgid "%q is %q" +msgstr "%q %q dir" + +#: ports/raspberrypi/common-hal/wifi/Radio.c +msgid "%q is read-only for this board" msgstr "" -#: py/argcheck.c +#: py/argcheck.c shared-bindings/usb_hid/Device.c msgid "%q length must be %d" msgstr "%q boyutu %d olmalıdır" @@ -146,10 +168,6 @@ msgstr "%q boyutu <= %d olmalıdır" 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" @@ -171,25 +189,21 @@ msgid "%q must be >= %d" msgstr "%q >= %d olmalıdır" #: shared-bindings/analogbufio/BufferedIn.c +msgid "%q must be a bytearray or array of type 'H' or 'B'" +msgstr "%q 'H' ya da 'B' tipi bir bytearray ya da array olmalıdır" + #: 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ı" +msgstr "%q 'h', 'H', 'b' ya da 'B' tipi bir bytearray ya da array olmalı" -#: py/argcheck.c -msgid "%q must be a string" -msgstr "%q bir string olmalıdır" +#: ports/raspberrypi/bindings/cyw43/__init__.c py/argcheck.c py/objexcept.c +#: shared-bindings/canio/CAN.c shared-bindings/digitalio/Pull.c +msgid "%q must be of type %q or %q, not %q" +msgstr "" -#: 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" -msgstr "%q, %q türünde olmalıdır" - -#: shared-bindings/digitalio/Pull.c -msgid "%q must be of type %q or None" -msgstr "%q, %q ya da None türünde olmalıdır" +#: py/argcheck.c py/obj.c py/objstrunicode.c +msgid "%q must be of type %q, not %q" +msgstr "" #: ports/atmel-samd/common-hal/busio/UART.c msgid "%q must be power of 2" @@ -201,7 +215,6 @@ msgstr "%q sınırların dışında" #: ports/atmel-samd/common-hal/pulseio/PulseIn.c #: ports/cxd56/common-hal/pulseio/PulseIn.c -#: ports/espressif/common-hal/coproc/Coproc.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 @@ -213,9 +226,9 @@ msgstr "%q aralık dışında" msgid "%q pin invalid" msgstr "%q pini geçersiz" -#: 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" +#: py/objrange.c py/objslice.c shared-bindings/random/__init__.c +msgid "%q step cannot be zero" +msgstr "%q sıfır olamaz" #: py/bc.c py/objnamedtuple.c msgid "%q() takes %d positional arguments but %d were given" @@ -314,7 +327,7 @@ msgstr "'%s' nesnesi, öğe atamasını desteklemiyor" msgid "'%s' object doesn't support item deletion" msgstr "'%s' nesnesi, öğe silmeyi desteklemiyor" -#: ports/raspberrypi/common-hal/wifi/Radio.c py/runtime.c +#: py/runtime.c msgid "'%s' object has no attribute '%q'" msgstr "'%s' nesnesinin '%q' özelliği yok" @@ -415,6 +428,10 @@ msgstr "ADC2, WiFi tarafından kullanılmaktadır" msgid "Address must be %d bytes long" msgstr "Adres %d byte uzunluğunda olmalıdır" +#: ports/espressif/common-hal/memorymap/AddressRange.c +msgid "Address range not allowed" +msgstr "" + #: ports/espressif/common-hal/canio/CAN.c msgid "All CAN peripherals are in use" msgstr "Tüm CAN çevre birimleri kullanımda" @@ -442,7 +459,6 @@ msgid "All SPI peripherals are in use" msgstr "Tüm SPI çevre birimleri kullanımda" #: 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 "Tüm UART çevre birimleri kullanımda" @@ -495,7 +511,7 @@ msgstr "Halihazırda duyuruluyor." msgid "Already have all-matches listener" msgstr "Tüm eşleşmelerle eşleşen dinleyiciniz var" -#: ports/espressif/common-hal/coproc/__init__.c +#: ports/espressif/common-hal/espulp/ULP.c #: shared-module/memorymonitor/AllocationAlarm.c #: shared-module/memorymonitor/AllocationSize.c msgid "Already running" @@ -506,6 +522,11 @@ msgstr "Halihazırda çalışıyor" msgid "Already scanning for wifi networks" msgstr "Halihazırda wifi ağları için tarama yapılıyor" +#: shared-module/os/getenv.c +#, c-format +msgid "An error occurred while retrieving '%s':\n" +msgstr "" + #: ports/stm/common-hal/audiopwmio/PWMAudioOut.c msgid "Another PWMAudioOut is already active" msgstr "Başka bir PWMAudioOut zaten aktif durumda" @@ -519,24 +540,16 @@ msgstr "Başka bir gönderme zaten aktif" msgid "Array must contain halfwords (type 'H')" msgstr "Dizi yarımsözcüklere sahip olmalıdır (tip 'H')" -#: shared-bindings/alarm/SleepMemory.c shared-bindings/coproc/CoprocMemory.c +#: shared-bindings/alarm/SleepMemory.c shared-bindings/memorymap/AddressRange.c #: shared-bindings/nvm/ByteArray.c msgid "Array values should be single bytes." msgstr "Dizi değerleri tekil bytelar olmalıdır." -#: shared-bindings/microcontroller/Pin.c -msgid "At most %d %q may be specified (not %d)" -msgstr "En az %d %q belirtilmeli (%d değil)" - #: shared-module/memorymonitor/AllocationAlarm.c #, c-format msgid "Attempt to allocate %d blocks" msgstr "%d bloğun ayrılması girişimi" -#: supervisor/shared/safe_mode.c -msgid "Attempted heap allocation when VM not running." -msgstr "VM çalışmazken heap'ten alan tahsis edilmeye çalışıldı." - #: ports/raspberrypi/audio_dma.c msgid "Audio conversion not implemented" msgstr "Ses dönüşümü implemente edilmedi" @@ -572,39 +585,31 @@ msgstr "Minimum kare hızından altında" #: ports/raspberrypi/common-hal/audiobusio/I2SOut.c msgid "Bit clock and word select must be sequential pins" -msgstr "" +msgstr "Bit saati ve kelime seçimi pinleri sıralı olmalıdır" #: ports/atmel-samd/common-hal/audiobusio/I2SOut.c msgid "Bit clock and word select must share a clock unit" -msgstr "" +msgstr "Bit saati ve kelime seçimi, bir saat birimini paylaşmalıdır" #: shared-bindings/audiobusio/PDMIn.c msgid "Bit depth must be multiple of 8." msgstr "Bit derinliği 8'in katı olacak şekilde olmalı." #: shared-bindings/bitmaptools/__init__.c -#, fuzzy msgid "Bitmap size and bits per value must match" msgstr "Bitmap boyutu ve bit başına değer uyuşmalı" #: supervisor/shared/safe_mode.c -msgid "Boot device must be first device (interface #0)." -msgstr "Önyükleme cihazı ilk cihaz olmalı (arayüz #0)." +msgid "Boot device must be first (interface #0)." +msgstr "" #: ports/mimxrt10xx/common-hal/busio/UART.c msgid "Both RX and TX required for flow control" msgstr "Hem RX hem de TX akış kontrolü için gerekli" -#: ports/atmel-samd/boards/circuitplayground_express/mpconfigboard.h -#: ports/atmel-samd/boards/circuitplayground_express_crickit/mpconfigboard.h -#: ports/atmel-samd/boards/circuitplayground_express_displayio/mpconfigboard.h -#: ports/atmel-samd/boards/meowmeow/mpconfigboard.h -msgid "Both buttons were pressed at start up.\n" -msgstr "" - #: ports/atmel-samd/common-hal/rotaryio/IncrementalEncoder.c msgid "Both pins must support hardware interrupts" -msgstr "" +msgstr "Her iki pin de donanım kesintilerini desteklemelidir" #: shared-bindings/displayio/Display.c #: shared-bindings/framebufferio/FramebufferDisplay.c @@ -667,11 +672,6 @@ msgstr "Arabellek boyutları aynı olmalı" msgid "Bus pin %d is already in use" msgstr "Veriyolu pini %d kullanımda" -#: ports/espressif/boards/m5stack_core_basic/mpconfigboard.h -#: ports/espressif/boards/m5stack_core_fire/mpconfigboard.h -msgid "Button A was pressed at start up.\n" -msgstr "" - #: shared-bindings/_bleio/UUID.c msgid "Byte buffer must be 16 bytes." msgstr "Bit buffer'ı 16bit olmalı." @@ -690,7 +690,7 @@ msgstr "CRC yada checksum geçersiz" #: py/objtype.c msgid "Call super().__init__() before accessing native object." -msgstr "" +msgstr "Yerel nesneye erişmeden önce super().__init__() fonksiyonunu çağırın." #: ports/cxd56/common-hal/camera/Camera.c msgid "Camera init" @@ -720,7 +720,7 @@ msgstr "USB aygıtları şu an değiştirilemez" #: shared-bindings/_bleio/Adapter.c msgid "Cannot create a new Adapter; use _bleio.adapter;" -msgstr "Yeni Adapter oluşturulamaz, _bleio.adapter; kullanın" +msgstr "yeni Adaptör oluşturulamadı, _bleio.adapter kullanın" #: shared-bindings/displayio/Bitmap.c #: shared-bindings/memorymonitor/AllocationSize.c @@ -750,30 +750,30 @@ msgstr "" #: shared-bindings/audiobusio/PDMIn.c msgid "Cannot record to a file" -msgstr "" +msgstr "Dosyaya kayıt yapılamıyor" #: shared-module/storage/__init__.c msgid "Cannot remount '/' when visible via USB." -msgstr "" +msgstr "'/' USB ile görünür olduğunda, yeniden bağlanamaz." #: 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 "" +msgstr "Hiçbir bootloader bulunmadığından bootloader sıfırlanamıyor" #: ports/espressif/common-hal/socketpool/Socket.c msgid "Cannot set socket options" -msgstr "" +msgstr "Soket seçenekleri ayarlanamıyor" #: shared-bindings/digitalio/DigitalInOut.c msgid "Cannot set value when direction is input." -msgstr "" +msgstr "Yön, giriş olduğunda değer ayarlanamıyor." #: 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 "RS485 modunda RTS veya CTS belirtilemez" #: py/objslice.c msgid "Cannot subclass slice" @@ -781,11 +781,11 @@ msgstr "" #: shared-module/bitbangio/SPI.c msgid "Cannot transfer without MOSI and MISO pins" -msgstr "" +msgstr "MOSI ve MISO pinleri olmadan transfer edilemiyor" #: shared-bindings/pwmio/PWMOut.c msgid "Cannot vary frequency on a timer that is already in use" -msgstr "" +msgstr "Kullanımda olan bir zamanlayıcının frekansı değiştirilemez" #: ports/nrf/common-hal/alarm/pin/PinAlarm.c msgid "Cannot wake on pin edge, only level" @@ -797,19 +797,15 @@ msgstr "" #: shared-bindings/_bleio/CharacteristicBuffer.c msgid "CharacteristicBuffer writing not provided" -msgstr "" +msgstr "CharacteristicBuffer yazılmı sağlanmadı" #: supervisor/shared/safe_mode.c msgid "CircuitPython core code crashed hard. Whoops!\n" msgstr "CircuitPython kor kodu patladı. Haydaaa!\n" -#: supervisor/shared/safe_mode.c -msgid "CircuitPython was unable to allocate the heap." -msgstr "" - #: shared-module/bitbangio/I2C.c msgid "Clock stretch too long" -msgstr "" +msgstr "Saat uzatması çok uzun" #: ports/atmel-samd/common-hal/audiobusio/I2SOut.c msgid "Clock unit in use" @@ -831,7 +827,7 @@ msgstr "" #: shared-bindings/_bleio/Adapter.c msgid "Could not set address" -msgstr "" +msgstr "Adres ayarlanamadı" #: shared-bindings/pwmio/PWMOut.c msgid "Could not start PWM" @@ -839,16 +835,12 @@ msgstr "PWM başlatılamadı" #: ports/stm/common-hal/busio/UART.c msgid "Could not start interrupt, RX busy" -msgstr "" +msgstr "Kesinti başlatılamadı, RX kullanımda" #: shared-module/audiomp3/MP3Decoder.c msgid "Couldn't allocate decoder" msgstr "" -#: supervisor/shared/safe_mode.c -msgid "Crash into the HardFault_Handler." -msgstr "" - #: ports/stm/common-hal/analogio/AnalogOut.c msgid "DAC Channel Init Error" msgstr "" @@ -859,16 +851,16 @@ msgstr "" #: ports/atmel-samd/common-hal/audioio/AudioOut.c msgid "DAC already in use" -msgstr "" +msgstr "DAC zaten kullanımda" #: 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 pini bite hizalı olmalı" #: shared-module/audiocore/WaveFile.c msgid "Data chunk must follow fmt chunk" -msgstr "" +msgstr "Veri öbeği, fmt yığınını takip etmelidir" #: ports/espressif/common-hal/_bleio/Adapter.c #: ports/nrf/common-hal/_bleio/Adapter.c @@ -886,34 +878,38 @@ msgstr "" #: shared-bindings/audiobusio/PDMIn.c msgid "Destination capacity is smaller than destination_length." -msgstr "" +msgstr "Hedef kapasitesi, hedef_uzunluğundan daha küçük." #: ports/nrf/common-hal/audiobusio/I2SOut.c msgid "Device in use" -msgstr "" +msgstr "Cihaz kullanımda" #: shared-bindings/displayio/Display.c #: shared-bindings/framebufferio/FramebufferDisplay.c msgid "Display must have a 16 bit colorspace." -msgstr "" +msgstr "Ekran 16 bitlik bir renk uzayına sahip olmalıdır." #: 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 "" +msgstr "Ekran dönüşü 90 derecelik artışlarla olmalıdır" #: main.c msgid "Done" -msgstr "" +msgstr "Tamamlandı" #: shared-bindings/digitalio/DigitalInOut.c msgid "Drive mode not used when direction is input." -msgstr "" +msgstr "Yön, giriş olduğunda sürüş modu kullanılmaz." + +#: py/obj.c +msgid "During handling of the above exception, another exception occurred:" +msgstr "Yukarıdaki hatanın işlenmesi sırasında başka bir hata oluştu:" #: shared-bindings/aesio/aes.c msgid "ECB only operates on 16 bytes at a time" -msgstr "" +msgstr "ECB aynı anda yalnızca 16 baytla çalışır" #: ports/espressif/common-hal/busio/SPI.c #: ports/espressif/common-hal/canio/CAN.c @@ -925,35 +921,27 @@ 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 kanalı zaten kullanımda" #: shared-module/synthio/MidiTrack.c #, c-format msgid "Error in MIDI stream at position %d" -msgstr "" +msgstr "%d konumundaki MIDI akışında hata" #: extmod/modure.c msgid "Error in regex" +msgstr "regex'te hata" + +#: supervisor/shared/safe_mode.c +msgid "Error in safemode.py." msgstr "" #: shared-bindings/socketpool/Socket.c shared-bindings/ssl/SSLSocket.c msgid "Error: Failure to bind" -msgstr "" - -#: py/enum.c shared-bindings/_bleio/__init__.c shared-bindings/aesio/aes.c -#: shared-bindings/alarm/__init__.c shared-bindings/alarm/coproc/CoprocAlarm.c -#: shared-bindings/busio/SPI.c shared-bindings/coproc/Coproc.c -#: shared-bindings/coproc/__init__.c shared-bindings/microcontroller/Pin.c -#: shared-bindings/neopixel_write/__init__.c -msgid "Expected a %q" -msgstr "" - -#: ports/raspberrypi/bindings/cyw43/__init__.c -msgid "Expected a %q or %q" -msgstr "" +msgstr "Hata: Bağlanamadı" #: shared-bindings/alarm/__init__.c -msgid "Expected an %q" +msgid "Expected a kind of %q" msgstr "" #: ports/espressif/common-hal/_bleio/Adapter.c @@ -963,24 +951,24 @@ msgstr "" #: extmod/ulab/code/numpy/fft/fft_tools.c msgid "FFT is defined for ndarrays only" -msgstr "" +msgstr "FFT sadece ndarrays'te tanımlandı" #: extmod/ulab/code/numpy/fft/fft_tools.c msgid "FFT is implemented for linear arrays only" -msgstr "" +msgstr "FFT yalnızca doğrusal diziler için uygulanır" #: ports/espressif/common-hal/ssl/SSLSocket.c msgid "Failed SSL handshake" -msgstr "" +msgstr "SSL el sıkışma hatası" #: shared-bindings/ps2io/Ps2.c msgid "Failed sending command." -msgstr "" +msgstr "Komut gönderilemedi." #: ports/nrf/sd_mutex.c #, c-format msgid "Failed to acquire mutex, err 0x%04x" -msgstr "" +msgstr "Muteks alınamadı, err 0x%04x" #: shared-module/rgbmatrix/RGBMatrix.c msgid "Failed to allocate %q buffer" @@ -1001,38 +989,42 @@ msgstr "" #: ports/espressif/common-hal/_bleio/Adapter.c #: ports/nrf/common-hal/_bleio/Adapter.c msgid "Failed to connect: internal error" -msgstr "" +msgstr "Bağlantı kurulamadı: internal error" #: ports/nrf/common-hal/_bleio/Adapter.c msgid "Failed to connect: timeout" -msgstr "" +msgstr "Bağlantı kurulamadı: timeout" #: shared-module/audiomp3/MP3Decoder.c msgid "Failed to parse MP3 file" -msgstr "" +msgstr "MP3 dosyası ayrıştırılamadı" #: ports/nrf/sd_mutex.c #, c-format msgid "Failed to release mutex, err 0x%04x" -msgstr "" +msgstr "Muteks serbest bırakılamadı, err 0x%04x" #: supervisor/shared/safe_mode.c msgid "Failed to write internal flash." -msgstr "" +msgstr "Dahili flaş yazılamadı." #: supervisor/shared/safe_mode.c -msgid "Fatal error." +msgid "Fault detected by hardware." msgstr "" #: py/moduerrno.c msgid "File exists" +msgstr "Dosya var" + +#: shared-module/os/getenv.c +msgid "File not found" msgstr "" #: ports/atmel-samd/common-hal/canio/Listener.c #: ports/espressif/common-hal/canio/Listener.c #: ports/stm/common-hal/canio/Listener.c msgid "Filters too complex" -msgstr "" +msgstr "Filtreler çok karmaşık" #: ports/espressif/common-hal/dualbank/__init__.c msgid "Firmware is duplicate" @@ -1040,42 +1032,45 @@ msgstr "" #: ports/espressif/common-hal/dualbank/__init__.c msgid "Firmware is invalid" -msgstr "" +msgstr "Yazılım geçersiz" -#: ports/espressif/common-hal/coproc/Coproc.c #: ports/espressif/common-hal/dualbank/__init__.c msgid "Firmware is too big" -msgstr "" +msgstr "Yazılım çok büyük" #: shared-bindings/bitmaptools/__init__.c msgid "For L8 colorspace, input bitmap must have 8 bits per pixel" msgstr "" +"L8 renk uzayı için, giriş bitmap'i piksel başına 8 bayta sahip olmalıdır" #: shared-bindings/bitmaptools/__init__.c msgid "For RGB colorspaces, input bitmap must have 16 bits per pixel" msgstr "" +"RGB renk uzayı için, giriş bitmap'i piksel başına 16 bayta sahip olmalıdır" #: ports/cxd56/common-hal/camera/Camera.c msgid "Format not supported" -msgstr "" +msgstr "Format desteklenmiyor" #: 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 "" +"Frekans 24, 150, 396, 450, 528, 600, 720, 816, 912, 960 ya da 1008 Mhz " +"olmalıdır" #: shared-bindings/pwmio/PWMOut.c msgid "Frequency must match existing PWMOut using this timer" -msgstr "" +msgstr "Frekans, bu zamanlayıcıyı kullanan mevcut PWMOut ile eşleşmelidir" #: 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 "Fonksiyon kilit gerektirir" #: ports/cxd56/common-hal/gnss/GNSS.c msgid "GNSS init" -msgstr "" +msgstr "GNSS init" #: ports/espressif/common-hal/espidf/__init__.c ports/espressif/esp_error.c msgid "Generic Failure" @@ -1084,8 +1079,10 @@ msgstr "" #: shared-bindings/displayio/Display.c #: shared-bindings/displayio/EPaperDisplay.c #: shared-bindings/framebufferio/FramebufferDisplay.c +#: shared-module/displayio/Display.c +#: shared-module/framebufferio/FramebufferDisplay.c msgid "Group already used" -msgstr "" +msgstr "Grup zaten kullanılıyor" #: ports/atmel-samd/common-hal/busio/SPI.c ports/cxd56/common-hal/busio/SPI.c #: ports/espressif/common-hal/busio/SPI.c @@ -1098,205 +1095,222 @@ 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 "Donanım meşgul, alternatif pinleri deneyin" #: ports/mimxrt10xx/common-hal/busio/UART.c ports/stm/common-hal/busio/UART.c msgid "Hardware in use, try alternative pins" +msgstr "Donanım kullanımda, alternatif pinleri deneyin" + +#: supervisor/shared/safe_mode.c +msgid "Heap allocation when VM not running." +msgstr "" + +#: supervisor/shared/safe_mode.c +msgid "" +"Heap was corrupted because the stack was too small. Increase stack size." msgstr "" #: extmod/vfs_posix_file.c py/objstringio.c msgid "I/O operation on closed file" -msgstr "" +msgstr "Kapalı dosyada I/O işlemi" #: ports/stm/common-hal/busio/I2C.c msgid "I2C init error" -msgstr "" +msgstr "I2C init hatası" #: ports/raspberrypi/common-hal/busio/I2C.c #: ports/raspberrypi/common-hal/i2ctarget/I2CTarget.c msgid "I2C peripheral in use" -msgstr "" +msgstr "I2C çevre cihazı kullanımda" #: shared-bindings/audiobusio/I2SOut.c msgid "I2SOut not available" -msgstr "" - -#: shared-bindings/aesio/aes.c -#, c-format -msgid "IV must be %d bytes long" -msgstr "" +msgstr "I2SOut uygundeğil" #: ports/raspberrypi/bindings/rp2pio/StateMachine.c msgid "In-buffer elements must be <= 4 bytes long" -msgstr "" +msgstr "Buffer öğeleri <=4 bayt uzunluğunda olmalı" #: py/persistentcode.c msgid "" "Incompatible .mpy file. Please update all .mpy files. See http://adafru.it/" "mpy-update for more info." msgstr "" +"Uyumsuz .mpy dosyası. Lütfen tüm .mpy dosyalarını güncelleyin. Daha fazla " +"bilgi için http://adafru.it/mpy-update ." #: shared-bindings/_pew/PewPew.c msgid "Incorrect buffer size" -msgstr "" +msgstr "Yanlış buffer size" #: ports/raspberrypi/bindings/rp2pio/StateMachine.c msgid "Init program size invalid" -msgstr "" +msgstr "Init program boyutu geçersiz" #: ports/raspberrypi/common-hal/rp2pio/StateMachine.c msgid "Initial set pin direction conflicts with initial out pin direction" -msgstr "" +msgstr "İlk pin yönü, ilk çıkış pin yönüyle çakışıyor" #: ports/raspberrypi/common-hal/rp2pio/StateMachine.c msgid "Initial set pin state conflicts with initial out pin state" -msgstr "" +msgstr "İlk pinin durumu, ilk çıkış pininin durumu ile çakışıyor" #: ports/espressif/common-hal/watchdog/WatchDogTimer.c msgid "Initialization failed due to lack of memory" -msgstr "" +msgstr "Bellek yetersizliği nedeniyle başlatma başarısız oldu" #: shared-bindings/bitops/__init__.c #, c-format msgid "Input buffer length (%d) must be a multiple of the strand count (%d)" -msgstr "" +msgstr "Giriş buffer uzunluğu (%d) strand sayımının (%d) katı olmalıdır" #: ports/atmel-samd/common-hal/pulseio/PulseIn.c msgid "Input taking too long" -msgstr "" +msgstr "Giriş çok uzun sürüyor" #: ports/espressif/common-hal/neopixel_write/__init__.c py/moduerrno.c msgid "Input/output error" -msgstr "" +msgstr "Giriş/çıkış hatası" #: ports/raspberrypi/common-hal/rp2pio/StateMachine.c #, c-format msgid "Instruction %d shifts in more bits than pin count" -msgstr "" +msgstr "Komut %d pin sayısından daha fazla bit içe kaydırıyor" #: ports/raspberrypi/common-hal/rp2pio/StateMachine.c #, c-format msgid "Instruction %d shifts out more bits than pin count" -msgstr "" +msgstr "Komut %d pin sayısından daha fazla bit dışa kaydırıyor" #: ports/raspberrypi/common-hal/rp2pio/StateMachine.c #, c-format msgid "Instruction %d uses extra pin" -msgstr "" +msgstr "Komut %d extra pin kullanıyor" #: ports/raspberrypi/common-hal/rp2pio/StateMachine.c #, c-format msgid "Instruction %d waits on input outside of count" -msgstr "" +msgstr "Komut %d sayım dışında, girişte bekler" #: ports/nrf/common-hal/_bleio/__init__.c msgid "Insufficient authentication" -msgstr "" +msgstr "Yetersiz kimlik doğrulama" #: ports/nrf/common-hal/_bleio/__init__.c msgid "Insufficient encryption" -msgstr "" +msgstr "Yetersiz şifreleme" #: ports/espressif/common-hal/wifi/Radio.c msgid "Interface must be started" -msgstr "" +msgstr "Arayüz başlatılmalıdır" #: ports/atmel-samd/audio_dma.c ports/raspberrypi/audio_dma.c msgid "Internal audio buffer too small" -msgstr "" +msgstr "Dahili ses arabelleği çok küçük" #: ports/stm/common-hal/busio/UART.c msgid "Internal define error" -msgstr "" +msgstr "Dahili tanımlama hatası" #: ports/espressif/common-hal/paralleldisplay/ParallelBus.c +#: shared-module/os/getenv.c msgid "Internal error" -msgstr "" +msgstr "Dahili hata" #: shared-module/rgbmatrix/RGBMatrix.c #, c-format msgid "Internal error #%d" -msgstr "" +msgstr "Dahili hata #%d" #: supervisor/shared/safe_mode.c msgid "Internal watchdog timer expired." +msgstr "Dahili bekçi zamanlayıcısının süresi doldu." + +#: supervisor/shared/safe_mode.c +msgid "Interrupt error." msgstr "" #: py/argcheck.c shared-bindings/digitalio/DigitalInOut.c msgid "Invalid %q" -msgstr "" +msgstr "Geçersiz %q" #: shared-bindings/microcontroller/Pin.c msgid "Invalid %q pin" -msgstr "" +msgstr "Geersi %q pin" #: ports/stm/common-hal/analogio/AnalogIn.c msgid "Invalid ADC Unit value" -msgstr "" +msgstr "Geçersiz ADC Ünite değeri" #: ports/espressif/common-hal/_bleio/__init__.c #: ports/nrf/common-hal/_bleio/__init__.c msgid "Invalid BLE parameter" -msgstr "" +msgstr "Geçersiz BLE parametresi" #: shared-bindings/wifi/Radio.c msgid "Invalid BSSID" -msgstr "" +msgstr "Geçersiz BSSID" #: shared-bindings/wifi/Radio.c msgid "Invalid MAC address" -msgstr "" +msgstr "Geçersiz MAC adresi" #: ports/espressif/common-hal/espidf/__init__.c ports/espressif/esp_error.c #: py/moduerrno.c msgid "Invalid argument" -msgstr "" +msgstr "Geçersiz argüman" #: shared-module/displayio/Bitmap.c +#, fuzzy msgid "Invalid bits per value" +msgstr "Geçersiz bit başına değer" + +#: shared-module/os/getenv.c +#, c-format +msgid "Invalid byte %.*s" msgstr "" #: ports/atmel-samd/common-hal/imagecapture/ParallelImageCapture.c #, c-format msgid "Invalid data_pins[%d]" -msgstr "" +msgstr "Geçersiz veri_pini [%d]" #: shared-module/audiocore/WaveFile.c msgid "Invalid format chunk size" -msgstr "" - -#: supervisor/shared/safe_mode.c -msgid "Invalid memory access." -msgstr "" +msgstr "Geçersiz biçim yığın boyutu" #: ports/espressif/common-hal/wifi/Radio.c msgid "Invalid multicast MAC address" -msgstr "" - -#: shared-bindings/busio/UART.c -msgid "Invalid pins" -msgstr "" +msgstr "Geçersiz multicast MAC adresi" #: ports/espressif/common-hal/espidf/__init__.c ports/espressif/esp_error.c msgid "Invalid size" -msgstr "" +msgstr "Geçersiz boyut" #: ports/espressif/common-hal/ssl/SSLContext.c #: ports/raspberrypi/common-hal/ssl/SSLSocket.c msgid "Invalid socket for TLS" -msgstr "" +msgstr "TLS için geçersiz soket" #: ports/espressif/common-hal/espidf/__init__.c ports/espressif/esp_error.c msgid "Invalid state" +msgstr "Geçersiz durum" + +#: shared-module/os/getenv.c +msgid "Invalid unicode escape" msgstr "" #: shared-bindings/aesio/aes.c msgid "Key must be 16, 24, or 32 bytes long" +msgstr "Anahtar 16, 24 veya 32 bayt uzunluğunda olmalıdır" + +#: shared-module/os/getenv.c +msgid "Key not found" msgstr "" #: shared-module/is31fl3741/FrameBuffer.c msgid "LED mappings must match display size" -msgstr "" +msgstr "LED eşlemeleri ekran boyutuyla eşleşmelidir" #: py/compile.c msgid "LHS of keyword arg must be an id" @@ -1304,24 +1318,24 @@ msgstr "" #: shared-module/displayio/Group.c msgid "Layer already in a group" -msgstr "" +msgstr "Katman zaten bir grupta" #: shared-module/displayio/Group.c msgid "Layer must be a Group or TileGrid subclass" -msgstr "" +msgstr "Katman, bir Grup ya da TileGrid alt sınıfı olmalıdır" #: ports/espressif/common-hal/espidf/__init__.c ports/espressif/esp_error.c msgid "MAC address was invalid" -msgstr "" +msgstr "MAC adresi geçersiz" #: shared-bindings/is31fl3741/IS31FL3741.c msgid "Mapping must be a tuple" -msgstr "" +msgstr "Map tuple olmalıdır" #: shared-module/displayio/Shape.c #, c-format msgid "Maximum x value when mirrored is %d" -msgstr "" +msgstr "İkizlendiğinde maksimum x değeri %d'dir" #: shared-bindings/audiobusio/PDMIn.c msgid "Microphone startup delay must be in range 0.0 to 1.0" @@ -1338,11 +1352,11 @@ msgstr "" #: ports/mimxrt10xx/common-hal/busio/SPI.c msgid "Missing MISO or MOSI Pin" -msgstr "" +msgstr "Eksik MISO veya MOSI pini" #: ports/stm/common-hal/busio/SPI.c msgid "Missing MISO or MOSI pin" -msgstr "" +msgstr "Eksik MISO veya MOSI pini" #: ports/raspberrypi/common-hal/rp2pio/StateMachine.c #, c-format @@ -1398,11 +1412,15 @@ msgstr "" #: ports/espressif/common-hal/nvm/ByteArray.c msgid "NVS Error" +msgstr "NVS hatası" + +#: shared-bindings/socketpool/SocketPool.c +msgid "Name or service not known" msgstr "" #: py/qstr.c msgid "Name too long" -msgstr "" +msgstr "İsim çok uzun" #: shared-bindings/displayio/TileGrid.c msgid "New bitmap must be same size as old bitmap" @@ -1440,43 +1458,43 @@ msgstr "" #: supervisor/shared/web_workflow/web_workflow.c msgid "No IP" -msgstr "" +msgstr "IP yok" #: ports/espressif/common-hal/busio/SPI.c #: ports/mimxrt10xx/common-hal/busio/SPI.c msgid "No MISO Pin" -msgstr "" +msgstr "MISO pini yok" #: ports/stm/common-hal/busio/SPI.c shared-module/bitbangio/SPI.c msgid "No MISO pin" -msgstr "" +msgstr "MISO pini yok" #: ports/espressif/common-hal/busio/SPI.c #: ports/mimxrt10xx/common-hal/busio/SPI.c msgid "No MOSI Pin" -msgstr "" +msgstr "MOSI pini yok" #: ports/stm/common-hal/busio/SPI.c shared-module/bitbangio/SPI.c msgid "No MOSI pin" -msgstr "" +msgstr "MOSI pini yok" #: 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 "RX pini yok" #: 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 "TX pini yok" #: ports/atmel-samd/common-hal/frequencyio/FrequencyIn.c msgid "No available clocks" -msgstr "" +msgstr "Kullanılabilir saat yok" #: ports/espressif/common-hal/imagecapture/ParallelImageCapture.c msgid "No capture in progress" @@ -1514,11 +1532,6 @@ msgstr "" msgid "No long integer support" msgstr "" -#: shared-module/usb_hid/__init__.c -#, c-format -msgid "No more than %d HID devices allowed" -msgstr "" - #: shared-bindings/wifi/Radio.c msgid "No network with that ssid" msgstr "" @@ -1554,10 +1567,6 @@ msgstr "" msgid "No timer available" msgstr "" -#: supervisor/shared/safe_mode.c -msgid "Nordic system firmware failure assertion." -msgstr "" - #: ports/nrf/common-hal/_bleio/__init__.c msgid "Nordic system firmware out of memory" msgstr "" @@ -1577,10 +1586,6 @@ msgstr "" msgid "Not playing" msgstr "" -#: shared-bindings/_bleio/__init__.c -msgid "Not settable" -msgstr "" - #: ports/espressif/common-hal/paralleldisplay/ParallelBus.c #, c-format msgid "Number of data_pins must be 8 or 16, not %d" @@ -1643,11 +1648,14 @@ msgid "" "%d bpp given" msgstr "" -#: ports/espressif/common-hal/alarm/coproc/CoprocAlarm.c #: ports/espressif/common-hal/alarm/touch/TouchAlarm.c msgid "Only one %q can be set in deep sleep." msgstr "" +#: ports/espressif/common-hal/espulp/ULPAlarm.c +msgid "Only one %q can be set." +msgstr "" + #: ports/espressif/common-hal/i2ctarget/I2CTarget.c #: ports/raspberrypi/common-hal/i2ctarget/I2CTarget.c msgid "Only one address is allowed" @@ -1680,6 +1688,10 @@ msgstr "" msgid "Operation timed out" msgstr "" +#: ports/raspberrypi/common-hal/mdns/Server.c +msgid "Out of MDNS service slots" +msgstr "" + #: ports/espressif/common-hal/espidf/__init__.c ports/espressif/esp_error.c msgid "Out of memory" msgstr "" @@ -1806,6 +1818,10 @@ msgstr "" msgid "Program size invalid" msgstr "" +#: ports/espressif/common-hal/espulp/ULP.c +msgid "Program too long" +msgstr "" + #: shared-bindings/digitalio/DigitalInOut.c msgid "Pull not used when direction is output." msgstr "" @@ -1845,8 +1861,9 @@ msgstr "" msgid "Random number generation error" msgstr "" +#: shared-bindings/_bleio/__init__.c #: shared-bindings/memorymonitor/AllocationSize.c -#: shared-bindings/pulseio/PulseIn.c +#: shared-bindings/pulseio/PulseIn.c shared-module/displayio/Bitmap.c msgid "Read-only" msgstr "" @@ -1854,10 +1871,6 @@ msgstr "" msgid "Read-only filesystem" msgstr "" -#: shared-module/displayio/Bitmap.c -msgid "Read-only object" -msgstr "" - #: ports/espressif/common-hal/espidf/__init__.c ports/espressif/esp_error.c msgid "Received response was invalid" msgstr "" @@ -1950,7 +1963,7 @@ msgstr "" msgid "Sleep Memory not available" msgstr "" -#: shared-bindings/alarm/SleepMemory.c shared-bindings/coproc/CoprocMemory.c +#: shared-bindings/alarm/SleepMemory.c shared-bindings/memorymap/AddressRange.c #: shared-bindings/nvm/ByteArray.c msgid "Slice and value different lengths." msgstr "" @@ -1987,6 +2000,10 @@ msgstr "" msgid "Stereo right must be on PWM channel B" msgstr "" +#: ports/raspberrypi/common-hal/wifi/Radio.c +msgid "Stopping AP is not supported." +msgstr "" + #: ports/mimxrt10xx/common-hal/busio/UART.c ports/stm/common-hal/busio/UART.c msgid "Supply at least one UART pin" msgstr "" @@ -2004,35 +2021,11 @@ msgid "Temperature read timed out" msgstr "" #: supervisor/shared/safe_mode.c -msgid "The BOOT button was pressed at start up.\n" +msgid "The `microcontroller` module was used to boot into safe mode." msgstr "" -#: supervisor/shared/safe_mode.c -msgid "" -"The CircuitPython heap was corrupted because the stack was too small.\n" -"Increase the stack size if you know how. If not:" -msgstr "" - -#: ports/espressif/boards/adafruit_feather_esp32_v2/mpconfigboard.h -msgid "The SW38 button was pressed at start up.\n" -msgstr "" - -#: ports/espressif/boards/hardkernel_odroid_go/mpconfigboard.h -msgid "The VOLUME button was pressed at start up.\n" -msgstr "" - -#: supervisor/shared/safe_mode.c -msgid "" -"The `microcontroller` module was used to boot into safe mode. Press reset to " -"exit safe mode." -msgstr "" - -#: ports/espressif/boards/m5stack_atom_lite/mpconfigboard.h -msgid "The central button was pressed at start up.\n" -msgstr "" - -#: ports/nrf/boards/aramcon2_badge/mpconfigboard.h -msgid "The left button was pressed at start up.\n" +#: py/obj.c +msgid "The above exception was the direct cause of the following exception:" msgstr "" #: shared-bindings/rgbmatrix/RGBMatrix.c @@ -2040,10 +2033,7 @@ msgid "The length of rgb_pins must be 6, 12, 18, 24, or 30" msgstr "" #: supervisor/shared/safe_mode.c -msgid "" -"The microcontroller's power dipped. Make sure your power supply provides\n" -"enough power for the whole circuit and press reset (after ejecting " -"CIRCUITPY)." +msgid "The power dipped. Make sure you are providing enough power." msgstr "" #: shared-module/audiomixer/MixerVoice.c @@ -2062,6 +2052,10 @@ msgstr "" msgid "The sample's signedness does not match the mixer's" msgstr "" +#: supervisor/shared/safe_mode.c +msgid "Third-party firmware fatal error." +msgstr "" + #: shared-module/imagecapture/ParallelImageCapture.c msgid "This microcontroller does not support continuous capture." msgstr "" @@ -2094,10 +2088,6 @@ msgstr "" msgid "Timeout is too long: Maximum timeout length is %d seconds" msgstr "" -#: supervisor/shared/safe_mode.c -msgid "To exit, please reset the board without requesting safe mode." -msgstr "" - #: ports/atmel-samd/common-hal/audiobusio/I2SOut.c msgid "Too many channels in sample" msgstr "" @@ -2142,6 +2132,10 @@ msgstr "" msgid "UART init" msgstr "" +#: ports/raspberrypi/common-hal/busio/UART.c +msgid "UART peripheral in use" +msgstr "" + #: ports/stm/common-hal/busio/UART.c msgid "UART re-init" msgstr "" @@ -2189,6 +2183,10 @@ msgstr "" msgid "Unable to allocate buffers for signed conversion" msgstr "" +#: supervisor/shared/safe_mode.c +msgid "Unable to allocate the heap." +msgstr "" + #: ports/espressif/common-hal/busio/I2C.c msgid "Unable to create lock" msgstr "" @@ -2212,11 +2210,12 @@ msgid "Unable to read color palette data" msgstr "" #: ports/espressif/common-hal/mdns/Server.c +#: ports/raspberrypi/common-hal/mdns/Server.c msgid "Unable to start mDNS query" msgstr "" -#: shared-bindings/coproc/CoprocMemory.c -msgid "Unable to write" +#: shared-bindings/memorymap/AddressRange.c +msgid "Unable to write to address." msgstr "" #: shared-bindings/nvm/ByteArray.c @@ -2287,6 +2286,7 @@ msgid "Unkown error code %d" msgstr "" #: shared-bindings/adafruit_pixelbuf/PixelBuf.c +#: shared-module/_pixelmap/PixelMap.c #, c-format msgid "Unmatched number of items on RHS (expected %d, got %d)." msgstr "" @@ -2371,6 +2371,18 @@ msgstr "" msgid "Wi-Fi: " msgstr "" +#: ports/raspberrypi/common-hal/wifi/Radio.c +msgid "Wifi is in access point mode." +msgstr "" + +#: ports/raspberrypi/common-hal/wifi/Radio.c +msgid "Wifi is in station mode." +msgstr "" + +#: ports/raspberrypi/common-hal/wifi/Radio.c +msgid "Wifi is not enabled" +msgstr "" + #: main.c msgid "Woken up by alarm.\n" msgstr "" @@ -2380,13 +2392,48 @@ msgstr "" msgid "Writes not supported on Characteristic" msgstr "" -#: supervisor/shared/safe_mode.c -msgid "You are in safe mode because:\n" +#: ports/atmel-samd/boards/circuitplayground_express/mpconfigboard.h +#: ports/atmel-samd/boards/circuitplayground_express_crickit/mpconfigboard.h +#: ports/atmel-samd/boards/circuitplayground_express_displayio/mpconfigboard.h +#: ports/atmel-samd/boards/meowmeow/mpconfigboard.h +msgid "You pressed both buttons at start up." +msgstr "" + +#: ports/espressif/boards/m5stack_core_basic/mpconfigboard.h +#: ports/espressif/boards/m5stack_core_fire/mpconfigboard.h +#: ports/espressif/boards/m5stack_stick_c/mpconfigboard.h +msgid "You pressed button A at start up." msgstr "" #: supervisor/shared/safe_mode.c -msgid "" -"You pressed the reset button during boot. Press again to exit safe mode." +msgid "You pressed the BOOT button at start up" +msgstr "" + +#: ports/espressif/boards/adafruit_feather_esp32_v2/mpconfigboard.h +msgid "You pressed the SW38 button at start up." +msgstr "" + +#: ports/espressif/boards/hardkernel_odroid_go/mpconfigboard.h +msgid "You pressed the VOLUME button at start up." +msgstr "" + +#: ports/espressif/boards/m5stack_atom_echo/mpconfigboard.h +#: ports/espressif/boards/m5stack_atom_lite/mpconfigboard.h +#: ports/espressif/boards/m5stack_atom_matrix/mpconfigboard.h +#: ports/espressif/boards/m5stack_atom_u/mpconfigboard.h +msgid "You pressed the central button at start up." +msgstr "" + +#: ports/nrf/boards/aramcon2_badge/mpconfigboard.h +msgid "You pressed the left button at start up." +msgstr "" + +#: supervisor/shared/safe_mode.c +msgid "You pressed the reset button during boot." +msgstr "" + +#: supervisor/shared/micropython.c +msgid "[truncated due to length]" msgstr "" #: py/objtype.c @@ -2458,8 +2505,12 @@ msgstr "" msgid "array has too many dimensions" msgstr "" +#: extmod/ulab/code/ndarray.c +msgid "array is too big" +msgstr "" + #: py/objarray.c shared-bindings/alarm/SleepMemory.c -#: shared-bindings/coproc/CoprocMemory.c shared-bindings/nvm/ByteArray.c +#: shared-bindings/memorymap/AddressRange.c shared-bindings/nvm/ByteArray.c msgid "array/bytes required on right side" msgstr "" @@ -2552,10 +2603,6 @@ msgstr "" msgid "buffer too small for requested bytes" msgstr "" -#: shared-bindings/adafruit_pixelbuf/PixelBuf.c -msgid "byteorder is not a string" -msgstr "" - #: py/objarray.c msgid "bytes length not a multiple of item size" msgstr "" @@ -2597,14 +2644,10 @@ msgstr "" msgid "can't cancel self" msgstr "" -#: py/obj.c py/objint.c shared-module/adafruit_pixelbuf/PixelBuf.c +#: py/obj.c py/objint.c py/runtime.c shared-module/adafruit_pixelbuf/PixelBuf.c msgid "can't convert %q to %q" msgstr "" -#: py/runtime.c -msgid "can't convert %q to int" -msgstr "" - #: py/obj.c #, c-format msgid "can't convert %s to complex" @@ -2686,6 +2729,10 @@ msgstr "" msgid "can't set attribute" msgstr "" +#: py/runtime.c +msgid "can't set attribute '%q'" +msgstr "" + #: py/emitnative.c msgid "can't store '%q'" msgstr "" @@ -2788,10 +2835,6 @@ msgstr "" msgid "comparison of int and uint" msgstr "" -#: py/objcomplex.c -msgid "complex division by zero" -msgstr "" - #: py/objfloat.c py/parsenum.c msgid "complex values not supported" msgstr "" @@ -2894,12 +2937,11 @@ msgstr "" msgid "div/mod not implemented for uint" msgstr "" -#: py/objfloat.c py/objint_mpz.c +#: extmod/ulab/code/numpy/create.c msgid "divide by zero" msgstr "" -#: py/modmath.c py/objint_longlong.c py/runtime.c -#: shared-bindings/math/__init__.c +#: py/runtime.c msgid "division by zero" msgstr "" @@ -2940,9 +2982,9 @@ msgstr "" msgid "error = 0x%08lX" msgstr "" -#: ports/espressif/common-hal/esp32_camera/Camera.c +#: ports/espressif/common-hal/espcamera/Camera.c msgid "" -"esp32_camera.Camera requires reserved PSRAM to be configured. See the " +"espcamera.Camera requires reserved PSRAM to be configured. See the " "documentation for instructions." msgstr "" @@ -2950,14 +2992,6 @@ msgstr "" msgid "exceptions must derive from BaseException" msgstr "" -#: shared-bindings/canio/CAN.c -msgid "expected '%q' but got '%q'" -msgstr "" - -#: shared-bindings/canio/CAN.c -msgid "expected '%q' or '%q' but got '%q'" -msgstr "" - #: py/objstr.c msgid "expected ':' after format specifier" msgstr "" @@ -3056,10 +3090,6 @@ msgstr "" msgid "format requires a dict" msgstr "" -#: shared-bindings/microcontroller/Processor.c -msgid "frequency is read-only for this board" -msgstr "" - #: py/objdeque.c msgid "full" msgstr "" @@ -3172,8 +3202,12 @@ msgstr "" msgid "index is out of bounds" msgstr "" +#: shared-bindings/_pixelmap/PixelMap.c +msgid "index must be tuple or int" +msgstr "" + #: extmod/ulab/code/numpy/numerical.c extmod/ulab/code/ulab_tools.c -#: ports/espressif/common-hal/pulseio/PulseIn.c py/obj.c +#: ports/espressif/common-hal/pulseio/PulseIn.c #: shared-bindings/bitmaptools/__init__.c msgid "index out of range" msgstr "" @@ -3271,10 +3305,6 @@ msgstr "" msgid "inputs are not iterable" msgstr "" -#: py/parsenum.c -msgid "int() arg 2 must be >= 2 and <= 36" -msgstr "" - #: extmod/ulab/code/numpy/approx.c msgid "interp is defined for 1D iterables of equal length" msgstr "" @@ -3331,7 +3361,7 @@ msgstr "" msgid "invalid micropython decorator" msgstr "" -#: ports/espressif/common-hal/esp32_camera/Camera.c +#: ports/espressif/common-hal/espcamera/Camera.c msgid "invalid setting" msgstr "" @@ -3356,10 +3386,6 @@ msgstr "" msgid "invalid syntax for number" msgstr "" -#: py/objexcept.c -msgid "invalid traceback" -msgstr "" - #: py/objtype.c msgid "issubclass() arg 1 must be a class" msgstr "" @@ -3416,19 +3442,17 @@ msgstr "" msgid "local variable referenced before assignment" msgstr "" -#: py/objint.c -msgid "long int not supported in this build" -msgstr "" - #: ports/espressif/common-hal/canio/CAN.c msgid "loopback + silent mode not supported by peripheral" msgstr "" #: ports/espressif/common-hal/mdns/Server.c +#: ports/raspberrypi/common-hal/mdns/Server.c msgid "mDNS already initialized" msgstr "" #: ports/espressif/common-hal/mdns/Server.c +#: ports/raspberrypi/common-hal/mdns/Server.c msgid "mDNS only works with built-in WiFi" msgstr "" @@ -3557,6 +3581,10 @@ msgstr "" msgid "negative shift count" msgstr "" +#: shared-bindings/_pixelmap/PixelMap.c +msgid "nested index must be int" +msgstr "" + #: shared-module/sdcardio/SDCard.c msgid "no SD card" msgstr "" @@ -3590,7 +3618,7 @@ msgstr "" msgid "no response from SD card" msgstr "" -#: ports/espressif/common-hal/esp32_camera/Camera.c py/objobject.c py/runtime.c +#: ports/espressif/common-hal/espcamera/Camera.c py/objobject.c py/runtime.c msgid "no such attribute" msgstr "" @@ -3726,6 +3754,10 @@ msgstr "" msgid "only mono is supported" msgstr "" +#: extmod/ulab/code/numpy/create.c +msgid "only ndarrays can be concatenated" +msgstr "" + #: ports/stm/common-hal/audiobusio/PDMIn.c msgid "only oversample=64 is supported" msgstr "" @@ -3736,7 +3768,7 @@ msgid "only sample_rate=16000 is supported" msgstr "" #: py/objarray.c py/objstr.c py/objstrunicode.c py/objtuple.c -#: shared-bindings/alarm/SleepMemory.c shared-bindings/coproc/CoprocMemory.c +#: shared-bindings/alarm/SleepMemory.c shared-bindings/memorymap/AddressRange.c #: shared-bindings/nvm/ByteArray.c msgid "only slices with step=1 (aka None) are supported" msgstr "" @@ -3952,10 +3984,6 @@ msgstr "" msgid "slice step can't be zero" msgstr "" -#: py/objslice.c -msgid "slice step cannot be zero" -msgstr "" - #: py/nativeglue.c msgid "slice unsupported" msgstr "" @@ -4004,10 +4032,6 @@ msgstr "" msgid "start/end indices" msgstr "" -#: shared-bindings/random/__init__.c -msgid "step must be non-zero" -msgstr "" - #: shared-bindings/random/__init__.c msgid "stop not reachable from start" msgstr "" @@ -4016,10 +4040,6 @@ msgstr "" msgid "stream operation not supported" msgstr "" -#: py/objstrunicode.c -msgid "string indices must be integers, not %q" -msgstr "" - #: py/stream.c msgid "string not supported; use bytes or bytearray" msgstr "" @@ -4052,10 +4072,6 @@ msgstr "" msgid "syntax error in uctypes descriptor" msgstr "" -#: shared-bindings/time/__init__.c -msgid "time.struct_time() takes a 9-sequence" -msgstr "" - #: ports/atmel-samd/common-hal/watchdog/WatchDogTimer.c #: ports/espressif/common-hal/watchdog/WatchDogTimer.c #: ports/nrf/common-hal/watchdog/WatchDogTimer.c @@ -4337,10 +4353,6 @@ msgstr "" msgid "y value out of bounds" msgstr "" -#: py/objrange.c -msgid "zero step" -msgstr "" - #: extmod/ulab/code/scipy/signal/signal.c msgid "zi must be an ndarray" msgstr "" @@ -4353,6 +4365,65 @@ msgstr "" msgid "zi must be of shape (n_section, 2)" msgstr "" +#~ msgid "" +#~ "\n" +#~ "Please file an issue with the contents of your CIRCUITPY drive at \n" +#~ "https://github.com/adafruit/circuitpython/issues\n" +#~ msgstr "" +#~ "\n" +#~ "Lütfen, şu adrese CIRCUITPY sürücünüzün içerikleri ile beraber bir hata/" +#~ "konu kaydı ekleyin\n" +#~ "https://github.com/adafruit/circuitpython/issues\n" + +#~ msgid "Attempted heap allocation when VM not running." +#~ msgstr "VM çalışmazken heap'ten alan tahsis edilmeye çalışıldı." + +#~ msgid "Boot device must be first device (interface #0)." +#~ msgstr "Önyükleme cihazı ilk cihaz olmalı (arayüz #0)." + +#~ msgid "Both buttons were pressed at start up.\n" +#~ msgstr "Başlatma sırasında her iki düğmeye de basıldı.\n" + +#~ msgid "Button A was pressed at start up.\n" +#~ msgstr "Başlatma sırasında A düğmesine basıldı.\n" + +#~ msgid "Invalid memory access." +#~ msgstr "Geçersiz bellek erişimi." + +#~ msgid "%q must be of type %q" +#~ msgstr "%q, %q türünde olmalıdır" + +#~ msgid "%q must be of type %q or None" +#~ msgstr "%q, %q ya da None türünde olmalıdır" + +#~ msgid "Expected a %q" +#~ msgstr "%q bekleniyor" + +#~ msgid "Expected a %q or %q" +#~ msgstr "%q yada %q bekleniyor" + +#~ msgid "Expected an %q" +#~ msgstr "%q bekleniyor" + +#, c-format +#~ msgid "IV must be %d bytes long" +#~ msgstr "IV %d bayt uzunluğunda olmalı" + +#~ msgid "%q length must be >= 1" +#~ msgstr "%q boyutu >=1 olmalıdır" + +#~ msgid "%q must be a string" +#~ msgstr "%q bir string olmalıdır" + +#~ msgid "%q must be an int" +#~ msgstr "%q bir tam sayı olmalıdır" + +#~ 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" + +#~ msgid "At most %d %q may be specified (not %d)" +#~ msgstr "En az %d %q belirtilmeli (%d değil)" + #~ msgid "%q indices must be integers, not %s" #~ msgstr "%q indeksleri integer olmalı, %s değil" diff --git a/locale/zh_Latn_pinyin.po b/locale/zh_Latn_pinyin.po index 408b785287..5b180eaec1 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-11-19 18:48+0000\n" +"PO-Revision-Date: 2023-01-25 03:47+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.15-dev\n" +"X-Generator: Weblate 4.16-dev\n" #: main.c msgid "" @@ -37,12 +37,21 @@ msgstr "" #: supervisor/shared/safe_mode.c msgid "" "\n" -"Please file an issue with the contents of your CIRCUITPY drive at \n" -"https://github.com/adafruit/circuitpython/issues\n" +"Please file an issue with your program at https://github.com/adafruit/" +"circuitpython/issues." msgstr "" + +#: supervisor/shared/safe_mode.c +msgid "" "\n" -"Qǐng tōngguò https://github.com/adafruit/circuitpython/issues\n" -"tíjiāo yǒuguān nín de CIRCUITPY qūdòngqì nèiróng de wèntí \n" +"Press reset to exit safe mode.\n" +msgstr "" + +#: supervisor/shared/safe_mode.c +msgid "" +"\n" +"You are in safe mode because:\n" +msgstr "" #: py/obj.c msgid " File \"%q\"" @@ -74,6 +83,11 @@ msgstr "%%c xūyào zhěngshù huòzhě zìfú" msgid "%02X" msgstr "%02X" +#: shared-module/os/getenv.c +#, c-format +msgid "%S" +msgstr "" + #: shared-bindings/rgbmatrix/RGBMatrix.c #, c-format msgid "" @@ -91,7 +105,7 @@ msgstr "" #: 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 +#: ports/stm/common-hal/canio/Listener.c ports/stm/common-hal/rtc/RTC.c msgid "%q" msgstr "%q" @@ -111,13 +125,18 @@ msgstr "%q bāo hán chóng fù de yǐn jiǎo" msgid "%q failure: %d" msgstr "%q Shībài: %d" +#: py/argcheck.c +msgid "%q in %q must be of type %q, not %q" +msgstr "%q zhōng de %q bì xū shì %q lèi xíng, ér bù shì %q" + +#: ports/espressif/common-hal/espulp/ULP.c #: ports/raspberrypi/common-hal/rp2pio/StateMachine.c #: shared-bindings/digitalio/DigitalInOut.c #: shared-bindings/microcontroller/Pin.c msgid "%q in use" msgstr "%q zhèngzài bèi shǐyòng" -#: py/obj.c py/objstr.c py/objstrunicode.c +#: py/objstr.c py/objstrunicode.c msgid "%q index out of range" msgstr "%q suǒyǐn chāochū fànwéi" @@ -129,7 +148,11 @@ msgstr "%q chūshǐhuà shībài" msgid "%q is %q" msgstr "%q shì %q" -#: py/argcheck.c +#: ports/raspberrypi/common-hal/wifi/Radio.c +msgid "%q is read-only for this board" +msgstr "%q duì yú cǐ bǎn shì zhǐ dú de" + +#: py/argcheck.c shared-bindings/usb_hid/Device.c msgid "%q length must be %d" msgstr "%q de chángdù bìxū shì %d" @@ -145,10 +168,6 @@ msgstr "%q chángdù bìxū <= %d" 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" - #: py/argcheck.c msgid "%q must be %d" msgstr "%q bìxū %d" @@ -170,26 +189,22 @@ msgid "%q must be >= %d" msgstr "%q bìxū >= %d" #: shared-bindings/analogbufio/BufferedIn.c +msgid "%q must be a bytearray or array of type 'H' or 'B'" +msgstr "%q bì xū shì zì jié shù zǔ huò lèi xíng wéi 'H' huò 'B' de shù zǔ" + #: shared-bindings/audiocore/RawSample.c msgid "%q must be a bytearray or array of type 'h', 'H', 'b', or 'B'" msgstr "" "%q bì xū shì zì jié shù zǔ huò lèi xíng wéi 'h', 'H', 'b', huò 'B' de shù zǔ" -#: py/argcheck.c -msgid "%q must be a string" -msgstr "%q bìxū shì yí gè zì fú chuàn" +#: ports/raspberrypi/bindings/cyw43/__init__.c py/argcheck.c py/objexcept.c +#: shared-bindings/canio/CAN.c shared-bindings/digitalio/Pull.c +msgid "%q must be of type %q or %q, not %q" +msgstr "%q de lèi xíng bì xū shì %q huò %q, ér bù shì %q" -#: 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" -msgstr "%q bì xū shì %q lèi xíng" - -#: shared-bindings/digitalio/Pull.c -msgid "%q must be of type %q or None" -msgstr "%q lèi xíng bì xū wéi %q huò wú" +#: py/argcheck.c py/obj.c py/objstrunicode.c +msgid "%q must be of type %q, not %q" +msgstr "%q de lèi xíng bì xū shì %q, ér bù shì %q" #: ports/atmel-samd/common-hal/busio/UART.c msgid "%q must be power of 2" @@ -201,7 +216,6 @@ msgstr "%q chāo chū jiè xiàn" #: ports/atmel-samd/common-hal/pulseio/PulseIn.c #: ports/cxd56/common-hal/pulseio/PulseIn.c -#: ports/espressif/common-hal/coproc/Coproc.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 @@ -213,9 +227,9 @@ msgstr "%q chāochū fànwéi" msgid "%q pin invalid" msgstr "%q yǐn jiǎo wúxiào" -#: 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" +#: py/objrange.c py/objslice.c shared-bindings/random/__init__.c +msgid "%q step cannot be zero" +msgstr "%q bù cháng bù néng wéi líng" #: py/bc.c py/objnamedtuple.c msgid "%q() takes %d positional arguments but %d were given" @@ -314,7 +328,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ú" -#: ports/raspberrypi/common-hal/wifi/Radio.c py/runtime.c +#: py/runtime.c msgid "'%s' object has no attribute '%q'" msgstr "'%s' duìxiàng méiyǒu shǔxìng '%q'" @@ -414,6 +428,10 @@ 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é" +#: ports/espressif/common-hal/memorymap/AddressRange.c +msgid "Address range not allowed" +msgstr "bù yǔn xǔ de dì zhǐ fàn wé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" @@ -441,7 +459,6 @@ msgid "All SPI peripherals are in use" msgstr "suǒyǒu SPI wàishè dōu zài shǐyòng zhōng" #: 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 "suǒyǒu UART wàishè dōu zài shǐyòng zhōng" @@ -494,7 +511,7 @@ msgstr "Mùqián zhèngzài guǎngbō." msgid "Already have all-matches listener" msgstr "yǐjīng yǒu all-matches jiāntīng qì" -#: ports/espressif/common-hal/coproc/__init__.c +#: ports/espressif/common-hal/espulp/ULP.c #: shared-module/memorymonitor/AllocationAlarm.c #: shared-module/memorymonitor/AllocationSize.c msgid "Already running" @@ -505,6 +522,11 @@ msgstr "yǐjīng zài yùnxíng" msgid "Already scanning for wifi networks" msgstr "yǐjīng zài sǎomiáo WIFI wǎngluò" +#: shared-module/os/getenv.c +#, c-format +msgid "An error occurred while retrieving '%s':\n" +msgstr "jiǎn suǒ '%s' shí chū cuò:\n" + #: 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ò" @@ -518,24 +540,16 @@ msgstr "Lìng yīgè fāsòng (send) yǐjīng zài gōngzuò" msgid "Array must contain halfwords (type 'H')" msgstr "Shùzǔ bìxū bāohán halfwords (type 'H')" -#: shared-bindings/alarm/SleepMemory.c shared-bindings/coproc/CoprocMemory.c +#: shared-bindings/alarm/SleepMemory.c shared-bindings/memorymap/AddressRange.c #: shared-bindings/nvm/ByteArray.c msgid "Array values should be single bytes." msgstr "shùzǔ de zhí yīnggāi shì dān'gè zìjié." -#: shared-bindings/microcontroller/Pin.c -msgid "At most %d %q may be specified (not %d)" -msgstr "zuìduō kěyǐ zhǐdìng %d gè %q (érbúshì %d)" - #: shared-module/memorymonitor/AllocationAlarm.c #, c-format msgid "Attempt to allocate %d blocks" msgstr "shìtú fēnpèi %d blocks" -#: supervisor/shared/safe_mode.c -msgid "Attempted heap allocation when VM not running." -msgstr "shìtú zài xūnǐjī (VM) yùn xíng shí fēnpèi duī (heap)." - #: ports/raspberrypi/audio_dma.c msgid "Audio conversion not implemented" msgstr "yīnpín zhuǎnhuàn wèi bèi shíxiàn" @@ -586,20 +600,13 @@ msgid "Bitmap size and bits per value must match" 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)." -msgstr "yǐndǎo shèbèi bìxū shì dìyī tái shèbèi (interface #0)." +msgid "Boot device must be first (interface #0)." +msgstr "" #: ports/mimxrt10xx/common-hal/busio/UART.c msgid "Both RX and TX required for flow control" msgstr "RX hé TX dōu xū yào liúliàng kòngzhì" -#: ports/atmel-samd/boards/circuitplayground_express/mpconfigboard.h -#: ports/atmel-samd/boards/circuitplayground_express_crickit/mpconfigboard.h -#: ports/atmel-samd/boards/circuitplayground_express_displayio/mpconfigboard.h -#: ports/atmel-samd/boards/meowmeow/mpconfigboard.h -msgid "Both buttons were pressed at start up.\n" -msgstr "qǐ dòng shí àn xià le liǎng gè àn niǔ.\n" - #: ports/atmel-samd/common-hal/rotaryio/IncrementalEncoder.c msgid "Both pins must support hardware interrupts" msgstr "liǎnggè yǐnjiǎo dōu bìxū zhīchí yìngjiàn zhōngduàn" @@ -665,11 +672,6 @@ msgstr "huǎnchōng qū bìxū dàxiǎo xiāngtóng" msgid "Bus pin %d is already in use" msgstr "Zǒngxiàn yǐnjiǎo %d yǐjīng zài shǐyòng zhōng" -#: ports/espressif/boards/m5stack_core_basic/mpconfigboard.h -#: ports/espressif/boards/m5stack_core_fire/mpconfigboard.h -msgid "Button A was pressed at start up.\n" -msgstr "qǐ dòng shí àn xià àn niǔ A.\n" - #: shared-bindings/_bleio/UUID.c msgid "Byte buffer must be 16 bytes." msgstr "Zìjié huǎnchōng qū bìxū shì 16 zìjié." @@ -803,10 +805,6 @@ msgstr "Wèi tígōng zìfú huǎncún xiěrù" msgid "CircuitPython core code crashed hard. Whoops!\n" msgstr "CircuitPython de héxīn chūxiàn gùzhàng. Āiyā!\n" -#: supervisor/shared/safe_mode.c -msgid "CircuitPython was unable to allocate the heap." -msgstr "CircuitPython wúfǎ fēnpèi duī." - #: shared-module/bitbangio/I2C.c msgid "Clock stretch too long" msgstr "shízhōng yánzhǎn guòcháng" @@ -845,10 +843,6 @@ msgstr "Wúfǎ qǐdòng zhōngduàn,RX máng" msgid "Couldn't allocate decoder" msgstr "wúfǎ fēnpèi jiěmǎ qì" -#: supervisor/shared/safe_mode.c -msgid "Crash into the HardFault_Handler." -msgstr "gu4zhang4, jin4ru4 HardFault_Handler." - #: ports/stm/common-hal/analogio/AnalogOut.c msgid "DAC Channel Init Error" msgstr "DAC tōngdào chūshǐhuà cuòwù" @@ -912,6 +906,11 @@ msgstr "zuò" 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." +#: py/obj.c +msgid "During handling of the above exception, another exception occurred:" +msgstr "" +"zài chǔ lǐ shàng shù yì cháng qī jiān, fā shēng le lìng yí gè yì cháng:" + #: shared-bindings/aesio/aes.c msgid "ECB only operates on 16 bytes at a time" msgstr "ECB yí cì zhǐ shǐ yòng 16 gè zì jié" @@ -937,25 +936,17 @@ msgstr "wèi yú %d wèi zhì de MIDI liú zhōng de cuò wù" msgid "Error in regex" msgstr "Zhèngzé biǎodá shì cuòwù" +#: supervisor/shared/safe_mode.c +msgid "Error in safemode.py." +msgstr "" + #: shared-bindings/socketpool/Socket.c shared-bindings/ssl/SSLSocket.c msgid "Error: Failure to bind" msgstr "cuò wù: bǎng dìng shī bài" -#: py/enum.c shared-bindings/_bleio/__init__.c shared-bindings/aesio/aes.c -#: shared-bindings/alarm/__init__.c shared-bindings/alarm/coproc/CoprocAlarm.c -#: shared-bindings/busio/SPI.c shared-bindings/coproc/Coproc.c -#: shared-bindings/coproc/__init__.c shared-bindings/microcontroller/Pin.c -#: shared-bindings/neopixel_write/__init__.c -msgid "Expected a %q" -msgstr "Yù qí %q" - -#: ports/raspberrypi/bindings/cyw43/__init__.c -msgid "Expected a %q or %q" -msgstr "yù qī wéi %q huò %q" - #: shared-bindings/alarm/__init__.c -msgid "Expected an %q" -msgstr "yù qī wéi %q" +msgid "Expected a kind of %q" +msgstr "yù qī yì zhǒng %q" #: ports/espressif/common-hal/_bleio/Adapter.c #: ports/nrf/common-hal/_bleio/Adapter.c @@ -1022,13 +1013,17 @@ msgid "Failed to write internal flash." msgstr "Wúfǎ xiě rù nèibù shǎncún." #: supervisor/shared/safe_mode.c -msgid "Fatal error." -msgstr "zhì mìng cuò wù." +msgid "Fault detected by hardware." +msgstr "" #: py/moduerrno.c msgid "File exists" msgstr "Wénjiàn cúnzài" +#: shared-module/os/getenv.c +msgid "File not found" +msgstr "zhǎo bú dào wén jiàn" + #: ports/atmel-samd/common-hal/canio/Listener.c #: ports/espressif/common-hal/canio/Listener.c #: ports/stm/common-hal/canio/Listener.c @@ -1043,7 +1038,6 @@ msgstr "gù jiàn chóng fù" msgid "Firmware is invalid" msgstr "gù jiàn wú xiào" -#: ports/espressif/common-hal/coproc/Coproc.c #: ports/espressif/common-hal/dualbank/__init__.c msgid "Firmware is too big" msgstr "gù jiàn tài dà" @@ -1089,6 +1083,8 @@ msgstr "tōng yòng gù zhàng" #: shared-bindings/displayio/Display.c #: shared-bindings/displayio/EPaperDisplay.c #: shared-bindings/framebufferio/FramebufferDisplay.c +#: shared-module/displayio/Display.c +#: shared-module/framebufferio/FramebufferDisplay.c msgid "Group already used" msgstr "Jítuán yǐjīng shǐyòngguò" @@ -1109,6 +1105,15 @@ 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" +#: supervisor/shared/safe_mode.c +msgid "Heap allocation when VM not running." +msgstr "" + +#: supervisor/shared/safe_mode.c +msgid "" +"Heap was corrupted because the stack was too small. Increase stack size." +msgstr "" + #: 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ò" @@ -1126,11 +1131,6 @@ msgstr "I2C wài shè zhèng zài shǐ yòng zhōng" msgid "I2SOut not available" msgstr "I2SOut bù kě yòng" -#: shared-bindings/aesio/aes.c -#, c-format -msgid "IV must be %d bytes long" -msgstr "IV bì xū wéi %d zì jié cháng" - #: ports/raspberrypi/bindings/rp2pio/StateMachine.c msgid "In-buffer elements must be <= 4 bytes long" msgstr "huǎn chōng nèi yuán sù bì xū <= 4 zì jié cháng" @@ -1222,6 +1222,7 @@ msgid "Internal define error" msgstr "Nèibù dìngyì cuòwù" #: ports/espressif/common-hal/paralleldisplay/ParallelBus.c +#: shared-module/os/getenv.c msgid "Internal error" msgstr "nèi bù cuò wù" @@ -1234,6 +1235,10 @@ msgstr "nèi bù cuò wù #%d" msgid "Internal watchdog timer expired." msgstr "Nèibù kān mén gǒu dìngshí qì chāoshí." +#: supervisor/shared/safe_mode.c +msgid "Interrupt error." +msgstr "" + #: py/argcheck.c shared-bindings/digitalio/DigitalInOut.c msgid "Invalid %q" msgstr "wú xiào %q" @@ -1268,6 +1273,11 @@ msgstr "Wúxiào de cānshù" msgid "Invalid bits per value" msgstr "Měi gè zhí de wèi wúxiào" +#: shared-module/os/getenv.c +#, c-format +msgid "Invalid byte %.*s" +msgstr "wú xiào zì jié %.*s" + #: ports/atmel-samd/common-hal/imagecapture/ParallelImageCapture.c #, c-format msgid "Invalid data_pins[%d]" @@ -1277,18 +1287,10 @@ msgstr "wú xiào data_pins[%d]" msgid "Invalid format chunk size" msgstr "Géshì kuài dàxiǎo wúxiào" -#: supervisor/shared/safe_mode.c -msgid "Invalid memory access." -msgstr "Wúxiào de nèicún fǎngwèn." - #: ports/espressif/common-hal/wifi/Radio.c msgid "Invalid multicast MAC address" msgstr "wú xiào de duō bō MAC dì zhǐ" -#: shared-bindings/busio/UART.c -msgid "Invalid pins" -msgstr "Wúxiào de yǐn jiǎo" - #: ports/espressif/common-hal/espidf/__init__.c ports/espressif/esp_error.c msgid "Invalid size" msgstr "dà xiǎo wú xiào" @@ -1302,10 +1304,18 @@ msgstr "TLS de chā zuò wú xiào" msgid "Invalid state" msgstr "wú xiào zhuàng tài" +#: shared-module/os/getenv.c +msgid "Invalid unicode escape" +msgstr "wú xiào de unicode zhuǎn yì" + #: 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" +#: shared-module/os/getenv.c +msgid "Key not found" +msgstr "wèi zhǎo dào mì yào" + #: shared-module/is31fl3741/FrameBuffer.c msgid "LED mappings must match display size" msgstr "LED yìng shè bì xū yǔ xiǎn shì píng chǐ cùn pǐ pèi" @@ -1413,6 +1423,10 @@ msgstr "NLR tiào zhuǎn shī bài. kě néng shì nèi cún sǔn huài." msgid "NVS Error" msgstr "NVS cuò wù" +#: shared-bindings/socketpool/SocketPool.c +msgid "Name or service not known" +msgstr "míng chēng huò fú wù wèi zhī" + #: py/qstr.c msgid "Name too long" msgstr "Míngchēng tài zhǎng" @@ -1527,11 +1541,6 @@ msgstr "Wèi zhǐdìng mì yào" msgid "No long integer support" msgstr "Méiyǒu zhǎng zhěngshù zhīchí" -#: shared-module/usb_hid/__init__.c -#, c-format -msgid "No more than %d HID devices allowed" -msgstr "bù yǔn xǔ chāo guò %d HID shè bèi" - #: shared-bindings/wifi/Radio.c msgid "No network with that ssid" msgstr "Méiyǒu wǎngluò yǔ gāi ssid" @@ -1567,10 +1576,6 @@ msgstr "Méiyǒu cǐ lèi wénjiàn/mùlù" msgid "No timer available" msgstr "Méiyǒu jìshí qì" -#: supervisor/shared/safe_mode.c -msgid "Nordic system firmware failure assertion." -msgstr "běi ōu xì tǒng gù jiàn gù zhàng duàn yán." - #: ports/nrf/common-hal/_bleio/__init__.c msgid "Nordic system firmware out of memory" msgstr "běi ōu xì tǒng gù jiàn chū nèi cún" @@ -1590,10 +1595,6 @@ msgstr "Wèi liánjiē" msgid "Not playing" msgstr "Wèi bòfàng" -#: shared-bindings/_bleio/__init__.c -msgid "Not settable" -msgstr "bù kě shè zhì" - #: ports/espressif/common-hal/paralleldisplay/ParallelBus.c #, c-format msgid "Number of data_pins must be 8 or 16, not %d" @@ -1661,11 +1662,14 @@ msgstr "" "Jǐn zhīchí dān sè, suǒyǐn wéi 4bpp huò 8bpp yǐjí 16bpp huò gèng gāo de BMP: " "Gěi chū %d bpp" -#: ports/espressif/common-hal/alarm/coproc/CoprocAlarm.c #: ports/espressif/common-hal/alarm/touch/TouchAlarm.c msgid "Only one %q can be set in deep sleep." msgstr "zài shēn dù shuì mián zhōng zhǐ néng shè zhì yí gè %q." +#: ports/espressif/common-hal/espulp/ULPAlarm.c +msgid "Only one %q can be set." +msgstr "zhǐ néng shè zhì yí gè %q." + #: ports/espressif/common-hal/i2ctarget/I2CTarget.c #: ports/raspberrypi/common-hal/i2ctarget/I2CTarget.c msgid "Only one address is allowed" @@ -1698,6 +1702,10 @@ msgstr "bù zhī chí cāo zuò huò gōng néng" msgid "Operation timed out" msgstr "cāo zuò yǐ fēn shí" +#: ports/raspberrypi/common-hal/mdns/Server.c +msgid "Out of MDNS service slots" +msgstr "chāo chū MDNS fú wù chā cáo" + #: ports/espressif/common-hal/espidf/__init__.c ports/espressif/esp_error.c msgid "Out of memory" msgstr "nèi cún bù zú" @@ -1826,6 +1834,10 @@ msgstr "chéng xù zài bù jiā zǎi Osr de qíng kuàng xià zhí xíng OUT" msgid "Program size invalid" msgstr "chéng xù dà xiǎo wú xiào" +#: ports/espressif/common-hal/espulp/ULP.c +msgid "Program too long" +msgstr "chéng xù tài cháng" + #: 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." @@ -1865,8 +1877,9 @@ msgstr "Cǐ bǎn bù zhīchí RTC" msgid "Random number generation error" msgstr "Suíjī shù shēngchéng cuòwù" +#: shared-bindings/_bleio/__init__.c #: shared-bindings/memorymonitor/AllocationSize.c -#: shared-bindings/pulseio/PulseIn.c +#: shared-bindings/pulseio/PulseIn.c shared-module/displayio/Bitmap.c msgid "Read-only" msgstr "Zhǐ dú" @@ -1874,10 +1887,6 @@ msgstr "Zhǐ dú" msgid "Read-only filesystem" msgstr "Zhǐ dú wénjiàn xìtǒng" -#: shared-module/displayio/Bitmap.c -msgid "Read-only object" -msgstr "Zhǐ dú duìxiàng" - #: 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" @@ -1970,7 +1979,7 @@ msgstr "bù zhī chí dà xiǎo" msgid "Sleep Memory not available" msgstr "shuì mián jì yì bù kě yòng" -#: shared-bindings/alarm/SleepMemory.c shared-bindings/coproc/CoprocMemory.c +#: shared-bindings/alarm/SleepMemory.c shared-bindings/memorymap/AddressRange.c #: shared-bindings/nvm/ByteArray.c msgid "Slice and value different lengths." msgstr "Qiēpiàn hé zhí bùtóng chángdù." @@ -2007,6 +2016,10 @@ 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" +#: ports/raspberrypi/common-hal/wifi/Radio.c +msgid "Stopping AP is not supported." +msgstr "bù zhī chí tíng zhǐ AP." + #: 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" @@ -2024,54 +2037,20 @@ msgid "Temperature read timed out" msgstr "Wēndù dòu qǔ chāoshí" #: supervisor/shared/safe_mode.c -msgid "The BOOT button was pressed at start up.\n" -msgstr "qǐ dòng shí àn xià le yǐn dǎo àn niǔ.\n" - -#: supervisor/shared/safe_mode.c -msgid "" -"The CircuitPython heap was corrupted because the stack was too small.\n" -"Increase the stack size if you know how. If not:" +msgid "The `microcontroller` module was used to boot into safe mode." msgstr "" -"diàn lù dàn duī bèi sǔn huài, yīn wéi duī zhàn tài xiǎo.\n" -"rú guǒ nín zhī dào rú hé zēng jiā duī zhàn dà xiǎo. rú guǒ méi yǒu:" -#: ports/espressif/boards/adafruit_feather_esp32_v2/mpconfigboard.h -msgid "The SW38 button was pressed at start up.\n" -msgstr "qǐ dòng shí àn xià le SW38 àn niǔ .\n" - -#: ports/espressif/boards/hardkernel_odroid_go/mpconfigboard.h -msgid "The VOLUME button was pressed at start up.\n" -msgstr "qǐ dòng shí àn xià yīn liàng àn niǔ.\n" - -#: supervisor/shared/safe_mode.c -msgid "" -"The `microcontroller` module was used to boot into safe mode. Press reset to " -"exit safe mode." -msgstr "" -"`wēi kòng zhì qì` mó kuài yòng yú qǐ dòng dào ān quán mó shì. àn chóng zhì " -"tuì chū ān quán mó shì." - -#: ports/espressif/boards/m5stack_atom_lite/mpconfigboard.h -msgid "The central button was pressed at start up.\n" -msgstr "qǐ dòng shí àn xià zhōng yāng àn niǔ.\n" - -#: ports/nrf/boards/aramcon2_badge/mpconfigboard.h -msgid "The left button was pressed at start up.\n" -msgstr "qǐ dòng shí àn xià zuǒ àn niǔ.\n" +#: py/obj.c +msgid "The above exception was the direct cause of the following exception:" +msgstr "shàng shù yì cháng shì yǐ xià yì cháng de zhí jiē yuán yīn:" #: shared-bindings/rgbmatrix/RGBMatrix.c msgid "The length of rgb_pins must be 6, 12, 18, 24, or 30" msgstr "Rgb_pins de chángdù bìxū wèi 6,12,18,24 huò 30" #: supervisor/shared/safe_mode.c -msgid "" -"The microcontroller's power dipped. Make sure your power supply provides\n" -"enough power for the whole circuit and press reset (after ejecting " -"CIRCUITPY)." +msgid "The power dipped. Make sure you are providing enough power." msgstr "" -"wēi kòng zhì qì de gōng lǜ xià jiàng. què bǎo diàn yuán tí gòng\n" -"zú gòu de gōng lǜ yòng yú zhěng gè diàn lù hé àn chóng zhì (tán chū " -"CIRCUITPY hòu)." #: shared-module/audiomixer/MixerVoice.c msgid "The sample's bits_per_sample does not match the mixer's" @@ -2089,6 +2068,10 @@ msgstr "Yàngběn de yàngběn sùdù yǔ hǔn yīn qì de xiāngchà bù pǐpè msgid "The sample's signedness does not match the mixer's" msgstr "Yàngběn de qiānmíng yǔ hǔn yīn qì de qiānmíng bù pǐpèi" +#: supervisor/shared/safe_mode.c +msgid "Third-party firmware fatal error." +msgstr "" + #: shared-module/imagecapture/ParallelImageCapture.c msgid "This microcontroller does not support continuous capture." msgstr "cǐ wēi kòng zhì qì bù zhī chí lián xù bǔ huò." @@ -2123,12 +2106,6 @@ msgstr "shí jiān yǐ jīng guò qù." msgid "Timeout is too long: Maximum timeout length is %d seconds" msgstr "Chāoshí shíjiān tài zhǎng: Zuìdà chāoshí shíjiān wèi%d miǎo" -#: supervisor/shared/safe_mode.c -msgid "To exit, please reset the board without requesting safe mode." -msgstr "" -"yào tuì chū, qǐng zài bù qǐng qiú ān quán mó shì de qíng kuàng xià chóng zhì " -"zhǔ bǎn." - #: 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ō" @@ -2173,6 +2150,10 @@ msgstr "UART qù chūshǐhuà" msgid "UART init" msgstr "UART chūshǐhuà" +#: ports/raspberrypi/common-hal/busio/UART.c +msgid "UART peripheral in use" +msgstr "" + #: ports/stm/common-hal/busio/UART.c msgid "UART re-init" msgstr "UART chóngxīn qǐdòng" @@ -2220,6 +2201,10 @@ msgstr "UUID zhí bùshì str,int huò zì jié huǎnchōng qū" msgid "Unable to allocate buffers for signed conversion" msgstr "Wúfǎ fēnpèi huǎnchōng qū yòng yú qiānmíng zhuǎnhuàn" +#: supervisor/shared/safe_mode.c +msgid "Unable to allocate the heap." +msgstr "" + #: ports/espressif/common-hal/busio/I2C.c msgid "Unable to create lock" msgstr "Wúfǎ chuàngjiàn suǒ" @@ -2243,12 +2228,13 @@ msgid "Unable to read color palette data" msgstr "Wúfǎ dúqǔ tiáosèbǎn shùjù" #: ports/espressif/common-hal/mdns/Server.c +#: ports/raspberrypi/common-hal/mdns/Server.c msgid "Unable to start mDNS query" msgstr "wú fǎ qǐ dòng mDNS chá xún" -#: shared-bindings/coproc/CoprocMemory.c -msgid "Unable to write" -msgstr "wú fǎ xiě rù" +#: shared-bindings/memorymap/AddressRange.c +msgid "Unable to write to address." +msgstr "Wú fǎ xiě rù dì zhǐ." #: shared-bindings/nvm/ByteArray.c msgid "Unable to write to nvm." @@ -2318,6 +2304,7 @@ msgid "Unkown error code %d" msgstr "wèi zhī cuò wù dài %d" #: shared-bindings/adafruit_pixelbuf/PixelBuf.c +#: shared-module/_pixelmap/PixelMap.c #, c-format msgid "Unmatched number of items on RHS (expected %d, got %d)." msgstr "RHS (yùqí %d, huòdé %d) shàng wèi pǐpèi de xiàngmù." @@ -2410,6 +2397,18 @@ msgstr "" msgid "Wi-Fi: " msgstr "Wi-Fi: " +#: ports/raspberrypi/common-hal/wifi/Radio.c +msgid "Wifi is in access point mode." +msgstr "Wú xiàn wǎng luò chǔ yú jiē rù diǎn mó shì." + +#: ports/raspberrypi/common-hal/wifi/Radio.c +msgid "Wifi is in station mode." +msgstr "Wú xiàn wǎng luò chǔ yú gōng zuò zhàn mó shì." + +#: ports/raspberrypi/common-hal/wifi/Radio.c +msgid "Wifi is not enabled" +msgstr "wú xiàn wǎng luò wèi qǐ yòng" + #: main.c msgid "Woken up by alarm.\n" msgstr "bèi jǐng bào chǎo xǐng.\n" @@ -2419,16 +2418,49 @@ msgstr "bèi jǐng bào chǎo xǐng.\n" msgid "Writes not supported on Characteristic" msgstr "Tèzhēng bù zhīchí xiě rù" -#: supervisor/shared/safe_mode.c -msgid "You are in safe mode because:\n" -msgstr "nín chǔ yú ān quán mó shì, yīn wéi:\n" +#: ports/atmel-samd/boards/circuitplayground_express/mpconfigboard.h +#: ports/atmel-samd/boards/circuitplayground_express_crickit/mpconfigboard.h +#: ports/atmel-samd/boards/circuitplayground_express_displayio/mpconfigboard.h +#: ports/atmel-samd/boards/meowmeow/mpconfigboard.h +msgid "You pressed both buttons at start up." +msgstr "" + +#: ports/espressif/boards/m5stack_core_basic/mpconfigboard.h +#: ports/espressif/boards/m5stack_core_fire/mpconfigboard.h +#: ports/espressif/boards/m5stack_stick_c/mpconfigboard.h +msgid "You pressed button A at start up." +msgstr "" #: supervisor/shared/safe_mode.c -msgid "" -"You pressed the reset button during boot. Press again to exit safe mode." +msgid "You pressed the BOOT button at start up" +msgstr "" + +#: ports/espressif/boards/adafruit_feather_esp32_v2/mpconfigboard.h +msgid "You pressed the SW38 button at start up." +msgstr "" + +#: ports/espressif/boards/hardkernel_odroid_go/mpconfigboard.h +msgid "You pressed the VOLUME button at start up." +msgstr "" + +#: ports/espressif/boards/m5stack_atom_echo/mpconfigboard.h +#: ports/espressif/boards/m5stack_atom_lite/mpconfigboard.h +#: ports/espressif/boards/m5stack_atom_matrix/mpconfigboard.h +#: ports/espressif/boards/m5stack_atom_u/mpconfigboard.h +msgid "You pressed the central button at start up." +msgstr "" + +#: ports/nrf/boards/aramcon2_badge/mpconfigboard.h +msgid "You pressed the left button at start up." +msgstr "" + +#: supervisor/shared/safe_mode.c +msgid "You pressed the reset button during boot." +msgstr "" + +#: supervisor/shared/micropython.c +msgid "[truncated due to length]" msgstr "" -"zài qǐ dòng guò chéng zhōng, nín àn xià le chóng zhì àn niǔ. zài cì àn xià " -"yǐ tuì chū ān quán mó shì." #: py/objtype.c msgid "__init__() should return None" @@ -2499,8 +2531,12 @@ msgstr "shù zǔ hé suǒ yǐn cháng dù bì xū xiāng děng" msgid "array has too many dimensions" msgstr "shùzǔ yǒu tài duō wéidù" +#: extmod/ulab/code/ndarray.c +msgid "array is too big" +msgstr "" + #: py/objarray.c shared-bindings/alarm/SleepMemory.c -#: shared-bindings/coproc/CoprocMemory.c shared-bindings/nvm/ByteArray.c +#: shared-bindings/memorymap/AddressRange.c shared-bindings/nvm/ByteArray.c msgid "array/bytes required on right side" msgstr "yòu cè xūyào shùzǔ/zì jié" @@ -2593,10 +2629,6 @@ msgstr "huǎnchōng qū tài xiǎo" msgid "buffer too small for requested bytes" msgstr "huǎn chōng qū tài xiǎo, duì yú qǐng qiú de zì jié" -#: shared-bindings/adafruit_pixelbuf/PixelBuf.c -msgid "byteorder is not a string" -msgstr "byteorder bùshì zìfú chuàn" - #: 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ù" @@ -2638,14 +2670,10 @@ 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-module/adafruit_pixelbuf/PixelBuf.c +#: py/obj.c py/objint.c py/runtime.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" -#: py/runtime.c -msgid "can't convert %q to int" -msgstr "wú fǎ jiāng %q zhuǎn huàn wéi nèi zài" - #: py/obj.c #, c-format msgid "can't convert %s to complex" @@ -2727,6 +2755,10 @@ msgstr "wúfǎ shèzhì 512 kuài dàxiǎo" msgid "can't set attribute" msgstr "wúfǎ shèzhì shǔxìng" +#: py/runtime.c +msgid "can't set attribute '%q'" +msgstr "wú fǎ shè zhì shǔ xìng '%q'" + #: py/emitnative.c msgid "can't store '%q'" msgstr "wúfǎ cúnchú '%q'" @@ -2833,10 +2865,6 @@ msgstr "yánsè bìxū jiè yú 0x000000 hé 0xffffff zhī jiān" msgid "comparison of int and uint" msgstr "yīn tè hé wū yīn tè de bǐ jiào" -#: py/objcomplex.c -msgid "complex division by zero" -msgstr "fùzá de fēngé wèi 0" - #: py/objfloat.c py/parsenum.c msgid "complex values not supported" msgstr "bù zhīchí fùzá de zhí" @@ -2941,12 +2969,11 @@ msgstr "chǐ cùn bù pǐ pèi" msgid "div/mod not implemented for uint" msgstr "div/ mó zǔ wèi wéi wèi shí xiàn" -#: py/objfloat.c py/objint_mpz.c +#: extmod/ulab/code/numpy/create.c msgid "divide by zero" msgstr "chú yǐ líng" -#: py/modmath.c py/objint_longlong.c py/runtime.c -#: shared-bindings/math/__init__.c +#: py/runtime.c msgid "division by zero" msgstr "bèi líng chú" @@ -2987,26 +3014,16 @@ msgstr "epoch_time bǎn bù zhī chí cǐ bǎn běn" msgid "error = 0x%08lX" msgstr "cuòwù = 0x%08lX" -#: ports/espressif/common-hal/esp32_camera/Camera.c +#: ports/espressif/common-hal/espcamera/Camera.c msgid "" -"esp32_camera.Camera requires reserved PSRAM to be configured. See the " +"espcamera.Camera requires reserved PSRAM to be configured. See the " "documentation for instructions." msgstr "" -"esp32_camera. shè xiàng jī xū yào pèi zhì yù liú de PSRAM. yǒu guān shuō " -"míng, qǐng cān yuè wén dàng." #: py/runtime.c msgid "exceptions must derive from BaseException" msgstr "lìwài bìxū láizì BaseException" -#: shared-bindings/canio/CAN.c -msgid "expected '%q' but got '%q'" -msgstr "yùqí wèi'%q'dàn dédàole'%q'" - -#: shared-bindings/canio/CAN.c -msgid "expected '%q' or '%q' but got '%q'" -msgstr "yùqí wèi'%q'huò'%q', dàn huòdéle'%q'" - #: py/objstr.c msgid "expected ':' after format specifier" msgstr "zài géshì shuōmíng fú zhīhòu yùqí ':'" @@ -3105,10 +3122,6 @@ msgstr "zìtǐ bìxū wèi 2048 zì jié" msgid "format requires a dict" msgstr "géshì yāoqiú yīgè yǔjù" -#: shared-bindings/microcontroller/Processor.c -msgid "frequency is read-only for this board" -msgstr "cǐ zhǔ bǎn de pín lǜ wéi zhǐ dú" - #: py/objdeque.c msgid "full" msgstr "chōngfèn" @@ -3221,8 +3234,12 @@ msgstr "bù zhèngquè de tiánchōng" msgid "index is out of bounds" msgstr "suǒyǐn chāochū fànwéi" +#: shared-bindings/_pixelmap/PixelMap.c +msgid "index must be tuple or int" +msgstr "suǒ yǐn bì xū shì yuán zǔ huò zhěng shù" + #: extmod/ulab/code/numpy/numerical.c extmod/ulab/code/ulab_tools.c -#: ports/espressif/common-hal/pulseio/PulseIn.c py/obj.c +#: ports/espressif/common-hal/pulseio/PulseIn.c #: shared-bindings/bitmaptools/__init__.c msgid "index out of range" msgstr "suǒyǐn chāochū fànwéi" @@ -3320,10 +3337,6 @@ msgstr "shūrù xiàngliàng de chángdù bìxū xiāngděng" msgid "inputs are not iterable" msgstr "shū rù bù kě yí dòng" -#: py/parsenum.c -msgid "int() arg 2 must be >= 2 and <= 36" -msgstr "zhěngshù() cānshù 2 bìxū > = 2 qiě <= 36" - #: extmod/ulab/code/numpy/approx.c msgid "interp is defined for 1D iterables of equal length" msgstr "zhōng jiān wéi cháng dù xiāng děng de 1D kě yì jiāo qì dìng yì" @@ -3380,7 +3393,7 @@ msgstr "wúxiào de mì yào" msgid "invalid micropython decorator" msgstr "wúxiào de MicroPython zhuāngshì qì" -#: ports/espressif/common-hal/esp32_camera/Camera.c +#: ports/espressif/common-hal/espcamera/Camera.c msgid "invalid setting" msgstr "shèzhì wúxiào" @@ -3405,10 +3418,6 @@ msgstr "jīshù wèi %d de zhěng shǔ de yǔfǎ wúxiào" msgid "invalid syntax for number" msgstr "wúxiào de hàomǎ yǔfǎ" -#: py/objexcept.c -msgid "invalid traceback" -msgstr "wú xiào zhuī sù" - #: py/objtype.c msgid "issubclass() arg 1 must be a class" msgstr "issubclass() cānshù 1 bìxū shì yīgè lèi" @@ -3466,19 +3475,17 @@ msgstr "běndì '%q' zài zhī lèixíng zhīqián shǐyòng" msgid "local variable referenced before assignment" msgstr "fùzhí qián yǐnyòng de júbù biànliàng" -#: py/objint.c -msgid "long int not supported in this build" -msgstr "cǐ bǎnběn bù zhīchí zhǎng zhěngshù" - #: ports/espressif/common-hal/canio/CAN.c msgid "loopback + silent mode not supported by peripheral" msgstr "Wài shè bù zhī chí huán huí + jìng yīn mó shì" #: ports/espressif/common-hal/mdns/Server.c +#: ports/raspberrypi/common-hal/mdns/Server.c msgid "mDNS already initialized" msgstr "mDNS yǐ chū shǐ huà" #: ports/espressif/common-hal/mdns/Server.c +#: ports/raspberrypi/common-hal/mdns/Server.c msgid "mDNS only works with built-in WiFi" msgstr "mDNS jǐn shì yòng yú nèi zhì wú xiàn wǎng luò" @@ -3607,6 +3614,10 @@ msgstr "méiyǒu fú diǎn zhīchí de xiāojí gōnglǜ" msgid "negative shift count" msgstr "fù zhuǎnyí jìshù" +#: shared-bindings/_pixelmap/PixelMap.c +msgid "nested index must be int" +msgstr "qiàn tào suǒ yǐn bì xū shì int" + #: shared-module/sdcardio/SDCard.c msgid "no SD card" msgstr "méiyǒu SD kǎ" @@ -3640,7 +3651,7 @@ msgstr "Méiyǒu kěyòng de fùwèi yǐn jiǎo" msgid "no response from SD card" msgstr "SD kǎ wú huíyīng" -#: ports/espressif/common-hal/esp32_camera/Camera.c py/objobject.c py/runtime.c +#: ports/espressif/common-hal/espcamera/Camera.c py/objobject.c py/runtime.c msgid "no such attribute" msgstr "méiyǒu cǐ shǔxìng" @@ -3776,6 +3787,10 @@ msgstr "Jǐn zhīchí wèi shēndù = 16" msgid "only mono is supported" msgstr "jǐn zhī chí dān shēng dào" +#: extmod/ulab/code/numpy/create.c +msgid "only ndarrays can be concatenated" +msgstr "" + #: ports/stm/common-hal/audiobusio/PDMIn.c msgid "only oversample=64 is supported" msgstr "jǐn zhī chí guò cǎi yàng =64" @@ -3786,7 +3801,7 @@ msgid "only sample_rate=16000 is supported" msgstr "Jǐn zhīchí cǎiyàng lǜ = 16000" #: py/objarray.c py/objstr.c py/objstrunicode.c py/objtuple.c -#: shared-bindings/alarm/SleepMemory.c shared-bindings/coproc/CoprocMemory.c +#: shared-bindings/alarm/SleepMemory.c shared-bindings/memorymap/AddressRange.c #: shared-bindings/nvm/ByteArray.c msgid "only slices with step=1 (aka None) are supported" msgstr "jǐn zhīchí bù zhǎng = 1(jí wú) de qiēpiàn" @@ -4002,10 +4017,6 @@ msgstr "shuìmián chángdù bìxū shìfēi fùshù" msgid "slice step can't be zero" msgstr "qiēpiàn bù cháng bùnéng wéi líng" -#: py/objslice.c -msgid "slice step cannot be zero" -msgstr "qiēpiàn bù bùnéng wéi líng" - #: py/nativeglue.c msgid "slice unsupported" msgstr "qiē piàn bù shòu zhī chí" @@ -4057,10 +4068,6 @@ msgstr "yuán wèi tú (source_bitmap) de zhí de shù mù (value_count) bì xū msgid "start/end indices" msgstr "kāishǐ/jiéshù zhǐshù" -#: shared-bindings/random/__init__.c -msgid "step must be non-zero" -msgstr "bùzhòu bìxū shìfēi líng" - #: 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" @@ -4069,10 +4076,6 @@ msgstr "tíngzhǐ wúfǎ cóng kāishǐ zhōng zhǎodào" msgid "stream operation not supported" msgstr "bù zhīchí liú cāozuò" -#: py/objstrunicode.c -msgid "string indices must be integers, not %q" -msgstr "zìfú chuàn suǒyǐn bìxū shì zhěngshù, ér bùshì %q" - #: py/stream.c msgid "string not supported; use bytes or bytearray" msgstr "zìfú chuàn bù zhīchí; shǐyòng zì jié huò zì jié zǔ" @@ -4105,10 +4108,6 @@ msgstr "JSON yǔfǎ cuòwù" msgid "syntax error in uctypes descriptor" msgstr "uctypes miáoshù fú zhōng de yǔfǎ cuòwù" -#: shared-bindings/time/__init__.c -msgid "time.struct_time() takes a 9-sequence" -msgstr "time.struct_time() xūyào 9 xùliè" - #: ports/atmel-samd/common-hal/watchdog/WatchDogTimer.c #: ports/espressif/common-hal/watchdog/WatchDogTimer.c #: ports/nrf/common-hal/watchdog/WatchDogTimer.c @@ -4390,10 +4389,6 @@ msgstr "xTaskCreate shī bài" msgid "y value out of bounds" msgstr "y zhí chāochū biānjiè" -#: py/objrange.c -msgid "zero step" -msgstr "líng bù" - #: extmod/ulab/code/scipy/signal/signal.c msgid "zi must be an ndarray" msgstr "zi bìxū shì ndarray" @@ -4406,6 +4401,193 @@ 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 "" +#~ "\n" +#~ "Please file an issue with the contents of your CIRCUITPY drive at \n" +#~ "https://github.com/adafruit/circuitpython/issues\n" +#~ msgstr "" +#~ "\n" +#~ "Qǐng tōngguò https://github.com/adafruit/circuitpython/issues\n" +#~ "tíjiāo yǒuguān nín de CIRCUITPY qūdòngqì nèiróng de wèntí \n" + +#~ msgid "Attempted heap allocation when VM not running." +#~ msgstr "shìtú zài xūnǐjī (VM) yùn xíng shí fēnpèi duī (heap)." + +#~ msgid "Boot device must be first device (interface #0)." +#~ msgstr "yǐndǎo shèbèi bìxū shì dìyī tái shèbèi (interface #0)." + +#~ msgid "Both buttons were pressed at start up.\n" +#~ msgstr "qǐ dòng shí àn xià le liǎng gè àn niǔ.\n" + +#~ msgid "Button A was pressed at start up.\n" +#~ msgstr "qǐ dòng shí àn xià àn niǔ A.\n" + +#~ msgid "CircuitPython was unable to allocate the heap." +#~ msgstr "CircuitPython wúfǎ fēnpèi duī." + +#~ msgid "Crash into the HardFault_Handler." +#~ msgstr "gu4zhang4, jin4ru4 HardFault_Handler." + +#~ msgid "Fatal error." +#~ msgstr "zhì mìng cuò wù." + +#~ msgid "Invalid memory access." +#~ msgstr "Wúxiào de nèicún fǎngwèn." + +#~ msgid "Nordic system firmware failure assertion." +#~ msgstr "běi ōu xì tǒng gù jiàn gù zhàng duàn yán." + +#~ msgid "The BOOT button was pressed at start up.\n" +#~ msgstr "qǐ dòng shí àn xià le yǐn dǎo àn niǔ.\n" + +#~ msgid "" +#~ "The CircuitPython heap was corrupted because the stack was too small.\n" +#~ "Increase the stack size if you know how. If not:" +#~ msgstr "" +#~ "diàn lù dàn duī bèi sǔn huài, yīn wéi duī zhàn tài xiǎo.\n" +#~ "rú guǒ nín zhī dào rú hé zēng jiā duī zhàn dà xiǎo. rú guǒ méi yǒu:" + +#~ msgid "The SW38 button was pressed at start up.\n" +#~ msgstr "qǐ dòng shí àn xià le SW38 àn niǔ .\n" + +#~ msgid "The VOLUME button was pressed at start up.\n" +#~ msgstr "qǐ dòng shí àn xià yīn liàng àn niǔ.\n" + +#~ msgid "" +#~ "The `microcontroller` module was used to boot into safe mode. Press reset " +#~ "to exit safe mode." +#~ msgstr "" +#~ "`wēi kòng zhì qì` mó kuài yòng yú qǐ dòng dào ān quán mó shì. àn chóng " +#~ "zhì tuì chū ān quán mó shì." + +#~ msgid "The central button was pressed at start up.\n" +#~ msgstr "qǐ dòng shí àn xià zhōng yāng àn niǔ.\n" + +#~ msgid "The left button was pressed at start up.\n" +#~ msgstr "qǐ dòng shí àn xià zuǒ àn niǔ.\n" + +#~ msgid "" +#~ "The microcontroller's power dipped. Make sure your power supply provides\n" +#~ "enough power for the whole circuit and press reset (after ejecting " +#~ "CIRCUITPY)." +#~ msgstr "" +#~ "wēi kòng zhì qì de gōng lǜ xià jiàng. què bǎo diàn yuán tí gòng\n" +#~ "zú gòu de gōng lǜ yòng yú zhěng gè diàn lù hé àn chóng zhì (tán chū " +#~ "CIRCUITPY hòu)." + +#~ msgid "To exit, please reset the board without requesting safe mode." +#~ msgstr "" +#~ "yào tuì chū, qǐng zài bù qǐng qiú ān quán mó shì de qíng kuàng xià chóng " +#~ "zhì zhǔ bǎn." + +#~ msgid "You are in safe mode because:\n" +#~ msgstr "nín chǔ yú ān quán mó shì, yīn wéi:\n" + +#~ msgid "" +#~ "You pressed the reset button during boot. Press again to exit safe mode." +#~ msgstr "" +#~ "zài qǐ dòng guò chéng zhōng, nín àn xià le chóng zhì àn niǔ. zài cì àn " +#~ "xià yǐ tuì chū ān quán mó shì." + +#~ msgid "" +#~ "esp32_camera.Camera requires reserved PSRAM to be configured. See the " +#~ "documentation for instructions." +#~ msgstr "" +#~ "esp32_camera. shè xiàng jī xū yào pèi zhì yù liú de PSRAM. yǒu guān shuō " +#~ "míng, qǐng cān yuè wén dàng." + +#~ msgid "%q must be of type %q" +#~ msgstr "%q bì xū shì %q lèi xíng" + +#~ msgid "%q must be of type %q or None" +#~ msgstr "%q lèi xíng bì xū wéi %q huò wú" + +#~ msgid "Expected a %q" +#~ msgstr "Yù qí %q" + +#~ msgid "Expected a %q or %q" +#~ msgstr "yù qī wéi %q huò %q" + +#~ msgid "Expected an %q" +#~ msgstr "yù qī wéi %q" + +#, c-format +#~ msgid "IV must be %d bytes long" +#~ msgstr "IV bì xū wéi %d zì jié cháng" + +#~ msgid "Not settable" +#~ msgstr "bù kě shè zhì" + +#~ msgid "expected '%q' but got '%q'" +#~ msgstr "yùqí wèi'%q'dàn dédàole'%q'" + +#~ msgid "expected '%q' or '%q' but got '%q'" +#~ msgstr "yùqí wèi'%q'huò'%q', dàn huòdéle'%q'" + +#~ msgid "Read-only object" +#~ msgstr "Zhǐ dú duìxiàng" + +#~ msgid "frequency is read-only for this board" +#~ msgstr "cǐ zhǔ bǎn de pín lǜ wéi zhǐ dú" + +#~ msgid "Unable to write" +#~ msgstr "wú fǎ xiě rù" + +#~ msgid "%q length must be >= 1" +#~ msgstr "%q cháng dù bìxū >= 1" + +#~ msgid "%q must be a string" +#~ msgstr "%q bìxū shì yí gè zì fú chuàn" + +#~ msgid "%q must be an int" +#~ msgstr "%q bìxū shì zhěng xíng" + +#~ 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" + +#~ msgid "At most %d %q may be specified (not %d)" +#~ msgstr "zuìduō kěyǐ zhǐdìng %d gè %q (érbúshì %d)" + +#~ msgid "Invalid pins" +#~ msgstr "Wúxiào de yǐn jiǎo" + +#, c-format +#~ msgid "No more than %d HID devices allowed" +#~ msgstr "bù yǔn xǔ chāo guò %d HID shè bèi" + +#~ msgid "byteorder is not a string" +#~ msgstr "byteorder bùshì zìfú chuàn" + +#~ msgid "can't convert %q to int" +#~ msgstr "wú fǎ jiāng %q zhuǎn huàn wéi nèi zài" + +#~ msgid "complex division by zero" +#~ msgstr "fùzá de fēngé wèi 0" + +#~ msgid "int() arg 2 must be >= 2 and <= 36" +#~ msgstr "zhěngshù() cānshù 2 bìxū > = 2 qiě <= 36" + +#~ msgid "long int not supported in this build" +#~ msgstr "cǐ bǎnběn bù zhīchí zhǎng zhěngshù" + +#~ msgid "slice step cannot be zero" +#~ msgstr "qiēpiàn bù bùnéng wéi líng" + +#~ msgid "step must be non-zero" +#~ msgstr "bùzhòu bìxū shìfēi líng" + +#~ msgid "string indices must be integers, not %q" +#~ msgstr "zìfú chuàn suǒyǐn bìxū shì zhěngshù, ér bùshì %q" + +#~ msgid "time.struct_time() takes a 9-sequence" +#~ msgstr "time.struct_time() xūyào 9 xùliè" + +#~ msgid "zero step" +#~ msgstr "líng bù" + +#~ msgid "invalid traceback" +#~ msgstr "wú xiào zhuī sù" + #~ msgid "%q indices must be integers, not %s" #~ msgstr "%q suǒyǐn bìxū shì zhěngshù, ér bùshì %s" diff --git a/main.c b/main.c index 10fdc65224..ee08726425 100644 --- a/main.c +++ b/main.c @@ -218,12 +218,10 @@ void supervisor_execution_status(void) { } #endif -#define STRING_LIST(...) {__VA_ARGS__, ""} - // Look for the first file that exists in the list of filenames, using mp_import_stat(). // Return its index. If no file found, return -1. -STATIC const char *first_existing_file_in_list(const char *const *filenames) { - for (int i = 0; filenames[i] != (char *)""; i++) { +STATIC const char *first_existing_file_in_list(const char *const *filenames, size_t n_filenames) { + for (size_t i = 0; i < n_filenames; i++) { mp_import_stat_t stat = mp_import_stat(filenames[i]); if (stat == MP_IMPORT_STAT_FILE) { return filenames[i]; @@ -232,11 +230,11 @@ STATIC const char *first_existing_file_in_list(const char *const *filenames) { return NULL; } -STATIC bool maybe_run_list(const char *const *filenames) { +STATIC bool maybe_run_list(const char *const *filenames, size_t n_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); + _current_executing_filename = first_existing_file_in_list(filenames, n_filenames); if (_current_executing_filename == NULL) { return false; } @@ -360,7 +358,7 @@ STATIC void print_code_py_status_message(safe_mode_t safe_mode) { } else { serial_write_compressed(translate("Auto-reload is off.\n")); } - if (safe_mode != NO_SAFE_MODE) { + if (safe_mode != SAFE_MODE_NONE) { serial_write_compressed(translate("Running in safe mode! Not running saved code.\n")); } } @@ -386,17 +384,19 @@ STATIC bool run_code_py(safe_mode_t safe_mode, bool *simulate_reset) { // Do the filesystem flush check before reload in case another write comes // in while we're doing the flush. - if (safe_mode == NO_SAFE_MODE) { + if (safe_mode == SAFE_MODE_NONE) { stack_resize(); filesystem_flush(); } - if (safe_mode == NO_SAFE_MODE && !autoreload_pending()) { - static const char *const supported_filenames[] = STRING_LIST( - "code.txt", "code.py", "main.py", "main.txt"); + if (safe_mode == SAFE_MODE_NONE && !autoreload_pending()) { + static const char *const supported_filenames[] = { + "code.txt", "code.py", "main.py", "main.txt" + }; #if CIRCUITPY_FULL_BUILD - static const char *const double_extension_filenames[] = STRING_LIST( + static const char *const double_extension_filenames[] = { "code.txt.py", "code.py.txt", "code.txt.txt","code.py.py", - "main.txt.py", "main.py.txt", "main.txt.txt","main.py.py"); + "main.txt.py", "main.py.txt", "main.txt.txt","main.py.py" + }; #endif supervisor_allocation *heap = allocate_remaining_memory(); @@ -410,14 +410,15 @@ STATIC bool run_code_py(safe_mode_t safe_mode, bool *simulate_reset) { // Check if a different run file has been allocated if (next_code_allocation) { - ((next_code_info_t *)next_code_allocation->ptr)->options &= ~SUPERVISOR_NEXT_CODE_OPT_NEWLY_SET; - next_code_options = ((next_code_info_t *)next_code_allocation->ptr)->options; - 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, ""}; + next_code_info_t *info = ((next_code_info_t *)next_code_allocation->ptr); + info->options &= ~SUPERVISOR_NEXT_CODE_OPT_NEWLY_SET; + next_code_options = info->options; + if (info->filename[0] != '\0') { // This is where the user's python code is actually executed: - found_main = maybe_run_list(next_list); + const char *const filenames[] = { info->filename }; + found_main = maybe_run_list(filenames, MP_ARRAY_SIZE(filenames)); if (!found_main) { - serial_write(((next_code_info_t *)next_code_allocation->ptr)->filename); + serial_write(info->filename); serial_write_compressed(translate(" not found.\n")); } } @@ -425,11 +426,11 @@ STATIC bool run_code_py(safe_mode_t safe_mode, bool *simulate_reset) { // 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); + found_main = maybe_run_list(supported_filenames, MP_ARRAY_SIZE(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); + found_main = maybe_run_list(double_extension_filenames, MP_ARRAY_SIZE(double_extension_filenames)); if (found_main) { serial_write_compressed(translate("WARNING: Your code filename has two extensions\n")); } @@ -509,7 +510,7 @@ STATIC bool run_code_py(safe_mode_t safe_mode, bool *simulate_reset) { } else #endif if (_exec_result.return_code != PYEXEC_EXCEPTION) { - if (safe_mode == NO_SAFE_MODE) { + if (safe_mode == SAFE_MODE_NONE) { color = ALL_DONE; blink_count = ALL_DONE_BLINKS; } else { @@ -729,8 +730,34 @@ STATIC bool run_code_py(safe_mode_t safe_mode, bool *simulate_reset) { vstr_t *boot_output; +#if CIRCUITPY_SAFEMODE_PY +STATIC void __attribute__ ((noinline)) run_safemode_py(safe_mode_t safe_mode) { + // Don't run if we aren't in safe mode or we won't be able to find safemode.py. + // Also don't run if it's a user-initiated safemode (pressing button(s) during boot), + // since that's deliberate. + if (safe_mode == SAFE_MODE_NONE || safe_mode == SAFE_MODE_USER || !filesystem_present()) { + return; + } + + supervisor_allocation *heap = allocate_remaining_memory(); + start_mp(heap); + + static const char *const safemode_py_filenames[] = {"safemode.py", "safemode.txt"}; + maybe_run_list(safemode_py_filenames, MP_ARRAY_SIZE(safemode_py_filenames)); + + // If safemode.py itself caused an error, change the safe_mode state to indicate that. + if (_exec_result.exception != MP_OBJ_NULL && + _exec_result.exception != MP_OBJ_SENTINEL) { + set_safe_mode(SAFE_MODE_SAFEMODE_PY_ERROR); + } + + cleanup_after_vm(heap, _exec_result.exception); + _exec_result.exception = NULL; +} +#endif + STATIC void __attribute__ ((noinline)) run_boot_py(safe_mode_t safe_mode) { - if (safe_mode == NO_HEAP) { + if (safe_mode == SAFE_MODE_NO_HEAP) { return; } @@ -738,10 +765,10 @@ STATIC void __attribute__ ((noinline)) run_boot_py(safe_mode_t safe_mode) { // There is USB setup to do even if boot.py is not actually run. const bool ok_to_run = filesystem_present() - && safe_mode == NO_SAFE_MODE + && safe_mode == SAFE_MODE_NONE && MP_STATE_VM(vfs_mount_table) != NULL; - static const char *const boot_py_filenames[] = STRING_LIST("boot.py", "boot.txt"); + static const char *const boot_py_filenames[] = {"boot.py", "boot.txt"}; // Do USB setup even if boot.py is not run. @@ -778,7 +805,7 @@ STATIC void __attribute__ ((noinline)) run_boot_py(safe_mode_t safe_mode) { port_boot_info(); #endif - bool found_boot = maybe_run_list(boot_py_filenames); + bool found_boot = maybe_run_list(boot_py_filenames, MP_ARRAY_SIZE(boot_py_filenames)); (void)found_boot; @@ -912,7 +939,7 @@ STATIC int run_repl(void) { int __attribute__((used)) main(void) { // initialise the cpu and peripherals - safe_mode_t safe_mode = port_init(); + set_safe_mode(port_init()); // Turn on RX and TX LEDs if we have them. init_rxtx_leds(); @@ -924,9 +951,12 @@ int __attribute__((used)) main(void) { common_hal_nvm_bytearray_set_bytes(&common_hal_mcu_nvm_obj,0,&value_out,1); #endif + // Start the debug serial + serial_early_init(); + // Wait briefly to give a reset window where we'll enter safe mode after the reset. - if (safe_mode == NO_SAFE_MODE) { - safe_mode = wait_for_safe_mode_reset(); + if (get_safe_mode() == SAFE_MODE_NONE) { + set_safe_mode(wait_for_safe_mode_reset()); } stack_init(); @@ -940,9 +970,6 @@ int __attribute__((used)) main(void) { supervisor_bluetooth_init(); #endif - // Start the debug serial - serial_early_init(); - #if !INTERNAL_FLASH_FILESYSTEM // Set up anything that might need to get done before we try to use SPI flash // This is needed for some boards where flash relies on GPIO setup to work @@ -955,8 +982,8 @@ int __attribute__((used)) main(void) { // Check whether CIRCUITPY is available. No need to reset to get safe mode // since we haven't run user code yet. - if (!filesystem_init(safe_mode == NO_SAFE_MODE, false)) { - safe_mode = NO_CIRCUITPY; + if (!filesystem_init(get_safe_mode() == SAFE_MODE_NONE, false)) { + set_safe_mode(SAFE_MODE_NO_CIRCUITPY); } #if CIRCUITPY_ALARM @@ -981,16 +1008,23 @@ int __attribute__((used)) main(void) { supervisor_set_run_reason(RUN_REASON_STARTUP); // If not in safe mode turn on autoreload by default but before boot.py in case it wants to change it. - if (safe_mode == NO_SAFE_MODE) { + if (get_safe_mode() == SAFE_MODE_NONE) { autoreload_enable(); } // By default our internal flash is readonly to local python code and - // writable over USB. Set it here so that boot.py can change it. + // writable over USB. Set it here so that safemode.py or boot.py can change it. filesystem_set_internal_concurrent_write_protection(true); filesystem_set_internal_writable_by_usb(CIRCUITPY_USB == 1); - run_boot_py(safe_mode); + #if CIRCUITPY_SAFEMODE_PY + // Run safemode.py if we ARE in safe mode. + // If safemode.py does not do a hard reset, and exits normally, we will continue on + // and report the safe mode as usual. + run_safemode_py(get_safe_mode()); + #endif + + run_boot_py(get_safe_mode()); supervisor_workflow_start(); @@ -1015,7 +1049,7 @@ int __attribute__((used)) main(void) { // If code.py did a fake deep sleep, pretend that we // are running code.py for the first time after a hard // reset. This will preserve any alarm information. - skip_repl = run_code_py(safe_mode, &simulate_reset); + skip_repl = run_code_py(get_safe_mode(), &simulate_reset); } else { skip_repl = false; } @@ -1075,14 +1109,14 @@ void gc_collect(void) { } void NORETURN nlr_jump_fail(void *val) { - reset_into_safe_mode(MICROPY_NLR_JUMP_FAIL); + reset_into_safe_mode(SAFE_MODE_NLR_JUMP_FAIL); while (true) { } } #ifndef NDEBUG static void NORETURN __fatal_error(const char *msg) { - reset_into_safe_mode(MICROPY_FATAL_ERROR); + reset_into_safe_mode(SAFE_MODE_HARD_FAULT); while (true) { } } diff --git a/ports/atmel-samd/Makefile b/ports/atmel-samd/Makefile index fdfb6c81b8..68beeaf129 100644 --- a/ports/atmel-samd/Makefile +++ b/ports/atmel-samd/Makefile @@ -79,7 +79,7 @@ endif ifeq ($(CHIP_FAMILY), same54) PERIPHERALS_CHIP_FAMILY=sam_d5x_e5x -OPTIMIZATION_FLAGS ?= -O2 +OPTIMIZATION_FLAGS ?= -Os # TinyUSB defines CFLAGS += -DCFG_TUSB_MCU=OPT_MCU_SAME5X -DCFG_TUD_MIDI_RX_BUFSIZE=128 -DCFG_TUD_CDC_RX_BUFSIZE=256 -DCFG_TUD_MIDI_TX_BUFSIZE=128 -DCFG_TUD_CDC_TX_BUFSIZE=256 -DCFG_TUD_MSC_BUFSIZE=1024 endif @@ -293,7 +293,6 @@ SRC_C += \ boards/$(BOARD)/board.c \ boards/$(BOARD)/pins.c \ eic_handler.c \ - fatfs_port.c \ lib/tinyusb/src/portable/microchip/samd/dcd_samd.c \ mphalport.c \ reset.c \ diff --git a/ports/atmel-samd/boards/circuitplayground_express/mpconfigboard.h b/ports/atmel-samd/boards/circuitplayground_express/mpconfigboard.h index 33910221a0..d7ca2a107c 100644 --- a/ports/atmel-samd/boards/circuitplayground_express/mpconfigboard.h +++ b/ports/atmel-samd/boards/circuitplayground_express/mpconfigboard.h @@ -23,7 +23,7 @@ #define CALIBRATE_CRYSTALLESS 1 // Explanation of how a user got into safe mode. -#define BOARD_USER_SAFE_MODE_ACTION translate("Both buttons were pressed at start up.\n") +#define BOARD_USER_SAFE_MODE_ACTION translate("You pressed both buttons at start up.") // Increase stack size slightly due to CPX library import nesting #define CIRCUITPY_DEFAULT_STACK_SIZE (4248) // divisible by 8 diff --git a/ports/atmel-samd/boards/circuitplayground_express_crickit/mpconfigboard.h b/ports/atmel-samd/boards/circuitplayground_express_crickit/mpconfigboard.h index 7f0e041f25..6ee5e0504b 100644 --- a/ports/atmel-samd/boards/circuitplayground_express_crickit/mpconfigboard.h +++ b/ports/atmel-samd/boards/circuitplayground_express_crickit/mpconfigboard.h @@ -23,7 +23,7 @@ #define CALIBRATE_CRYSTALLESS 1 // Explanation of how a user got into safe mode. -#define BOARD_USER_SAFE_MODE_ACTION translate("Both buttons were pressed at start up.\n") +#define BOARD_USER_SAFE_MODE_ACTION translate("You pressed both buttons at start up.") // Increase stack size slightly due to CPX library import nesting #define CIRCUITPY_DEFAULT_STACK_SIZE (4248) // divisible by 8 diff --git a/ports/atmel-samd/boards/circuitplayground_express_displayio/mpconfigboard.h b/ports/atmel-samd/boards/circuitplayground_express_displayio/mpconfigboard.h index 12fd30e005..c0f2d07e9d 100644 --- a/ports/atmel-samd/boards/circuitplayground_express_displayio/mpconfigboard.h +++ b/ports/atmel-samd/boards/circuitplayground_express_displayio/mpconfigboard.h @@ -23,7 +23,7 @@ #define CALIBRATE_CRYSTALLESS 1 // Explanation of how a user got into safe mode. -#define BOARD_USER_SAFE_MODE_ACTION translate("Both buttons were pressed at start up.\n") +#define BOARD_USER_SAFE_MODE_ACTION translate("You pressed both buttons at start up.") // Increase stack size slightly due to CPX library import nesting. #define CIRCUITPY_DEFAULT_STACK_SIZE (4248) // divisible by 8 diff --git a/ports/atmel-samd/boards/meowmeow/mpconfigboard.h b/ports/atmel-samd/boards/meowmeow/mpconfigboard.h index ad6901230f..ab5f652d1e 100644 --- a/ports/atmel-samd/boards/meowmeow/mpconfigboard.h +++ b/ports/atmel-samd/boards/meowmeow/mpconfigboard.h @@ -6,7 +6,7 @@ #define CALIBRATE_CRYSTALLESS 1 // Explanation of how a user got into safe mode. -#define BOARD_USER_SAFE_MODE_ACTION translate("Both buttons were pressed at start up.\n") +#define BOARD_USER_SAFE_MODE_ACTION translate("You pressed both buttons at start up.") #define DEFAULT_I2C_BUS_SCL (&pin_PA01) #define DEFAULT_I2C_BUS_SDA (&pin_PA00) diff --git a/ports/atmel-samd/boards/pewpew_m4/mpconfigboard.mk b/ports/atmel-samd/boards/pewpew_m4/mpconfigboard.mk index 32be4805d7..1e1bd31a24 100644 --- a/ports/atmel-samd/boards/pewpew_m4/mpconfigboard.mk +++ b/ports/atmel-samd/boards/pewpew_m4/mpconfigboard.mk @@ -11,6 +11,7 @@ LONGINT_IMPL = NONE CIRCUITPY_FULL_BUILD = 0 +CIRCUITPY_ANALOGIO = 0 CIRCUITPY_ALARM = 0 CIRCUITPY_AUDIOBUSIO = 0 CIRCUITPY_AUDIOMP3 = 0 @@ -31,14 +32,13 @@ CIRCUITPY_ROTARYIO = 0 CIRCUITPY_RTC = 0 CIRCUITPY_SAMD = 0 CIRCUITPY_TOUCHIO = 0 -CIRCUITPY_USB_CDC = 0 CIRCUITPY_USB_HID = 0 CIRCUITPY_USB_MIDI = 0 CIRCUITPY_VECTORIO = 0 CIRCUITPY_BUSDEVICE = 0 CIRCUITPY_BITMAPTOOLS = 0 +CIRCUITPY_WATCHDOG = 0 -CIRCUITPY_ANALOGIO = 1 CIRCUITPY_AUDIOIO = 1 CIRCUITPY_AUDIOMIXER = 1 CIRCUITPY_DISPLAYIO = 1 @@ -53,3 +53,13 @@ CIRCUITPY_DISPLAY_FONT = $(TOP)/ports/atmel-samd/boards/ugame10/brutalist-6.bdf # Override optimization to keep binary small OPTIMIZATION_FLAGS = -Os + +# 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. +ifneq (,$(filter $(TRANSLATION),ja ko ru)) +CIRCUITPY_TERMINALIO = 0 +RELEASE_NEEDS_CLEAN_BUILD = $(CIRCUITPY_DISPLAYIO) +endif diff --git a/ports/atmel-samd/common-hal/audioio/AudioOut.c b/ports/atmel-samd/common-hal/audioio/AudioOut.c index a565a77042..7007672b3f 100644 --- a/ports/atmel-samd/common-hal/audioio/AudioOut.c +++ b/ports/atmel-samd/common-hal/audioio/AudioOut.c @@ -405,7 +405,13 @@ void common_hal_audioio_audioout_play(audioio_audioout_obj_t *self, if (self->right_channel == &pin_PA02) { right_channel_reg = (uint32_t)&DAC->DATABUF[0].reg; } - if (right_channel_reg == left_channel_reg + 2 && audiosample_bits_per_sample(sample) == 16) { + + size_t num_channels = audiosample_channel_count(sample); + + if (num_channels == 2 && + // Are DAC channels sequential? + left_channel_reg + 2 == right_channel_reg && + audiosample_bits_per_sample(sample) == 16) { result = audio_dma_setup_playback(&self->left_dma, sample, loop, false, 0, false /* output unsigned */, left_channel_reg, @@ -415,7 +421,11 @@ void common_hal_audioio_audioout_play(audioio_audioout_obj_t *self, false /* output unsigned */, left_channel_reg, left_channel_trigger); - if (right_channel_reg != 0 && result == AUDIO_DMA_OK) { + // Don't play back on right channel unless stereo. + // TODO possibility: Set up non-incrementing DMA on one channel so they use the same samples? + // Right now, playing back mono on both channels causes sample to play twice as fast. + if (num_channels == 2 && + right_channel_reg != 0 && result == AUDIO_DMA_OK) { result = audio_dma_setup_playback(&self->right_dma, sample, loop, true, 1, false /* output unsigned */, right_channel_reg, diff --git a/ports/atmel-samd/common-hal/busio/UART.c b/ports/atmel-samd/common-hal/busio/UART.c index 3a9b628e0b..6027b6a5fa 100644 --- a/ports/atmel-samd/common-hal/busio/UART.c +++ b/ports/atmel-samd/common-hal/busio/UART.c @@ -24,6 +24,7 @@ * THE SOFTWARE. */ +#if CIRCUITPY_BUSIO_UART #include "shared-bindings/microcontroller/__init__.h" #include "shared-bindings/microcontroller/Pin.h" #include "shared-bindings/busio/UART.h" @@ -485,3 +486,4 @@ bool common_hal_busio_uart_ready_to_tx(busio_uart_obj_t *self) { usart_async_get_status(usart_desc_p, &async_status); return !(async_status.flags & USART_ASYNC_STATUS_BUSY); } +#endif diff --git a/ports/atmel-samd/common-hal/microcontroller/__init__.c b/ports/atmel-samd/common-hal/microcontroller/__init__.c index 60b35a2c5c..d1c02b360f 100644 --- a/ports/atmel-samd/common-hal/microcontroller/__init__.c +++ b/ports/atmel-samd/common-hal/microcontroller/__init__.c @@ -51,9 +51,8 @@ void common_hal_mcu_disable_interrupts(void) { void common_hal_mcu_enable_interrupts(void) { if (nesting_count == 0) { - // This is very very bad because it means there was mismatched disable/enables so we - // "HardFault". - HardFault_Handler(); + // This is very very bad because it means there was mismatched disable/enables. + reset_into_safe_mode(SAFE_MODE_INTERRUPT_ERROR); } nesting_count--; if (nesting_count > 0) { @@ -76,7 +75,7 @@ void common_hal_mcu_on_next_reset(mcu_runmode_t runmode) { _bootloader_dbl_tap = DBL_TAP_MAGIC_QUICK_BOOT; } if (runmode == RUNMODE_SAFE_MODE) { - safe_mode_on_next_reset(PROGRAMMATIC_SAFE_MODE); + safe_mode_on_next_reset(SAFE_MODE_PROGRAMMATIC); } } diff --git a/ports/atmel-samd/common-hal/sdioio/SDCard.c b/ports/atmel-samd/common-hal/sdioio/SDCard.c index 7ce8a1e1b1..e641db75ac 100644 --- a/ports/atmel-samd/common-hal/sdioio/SDCard.c +++ b/ports/atmel-samd/common-hal/sdioio/SDCard.c @@ -114,8 +114,6 @@ CLK PA21 PCC_D? (D32) BROWN gpio_set_pin_pull_mode(functions[i]->pin, (i == 1 || i == 5) ? GPIO_PULL_OFF : GPIO_PULL_UP); gpio_set_pin_function(functions[i]->pin, GPIO_PIN_FUNCTION_SDIO); - - common_hal_never_reset_pin(functions[i]->obj); } self->num_data = num_data; @@ -145,6 +143,12 @@ CLK PA21 PCC_D? (D32) BROWN } if (result != SD_MMC_OK) { + for (size_t i = 0; i < MP_ARRAY_SIZE(functions); i++) { + if (!functions[i]->obj) { + break; + } + reset_pin_number(functions[i]->obj->number); + } mp_raise_OSError_msg_varg(translate("%q failure: %d"), MP_QSTR_sd_mmc_check, (int)result); } // sd_mmc_get_capacity() is in KiB, but our "capacity" is in 512-byte blocks diff --git a/ports/atmel-samd/fatfs_port.c b/ports/atmel-samd/fatfs_port.c deleted file mode 100644 index 58a0ef0d72..0000000000 --- a/ports/atmel-samd/fatfs_port.c +++ /dev/null @@ -1,48 +0,0 @@ -/* - * This file is part of the MicroPython project, http://micropython.org/ - * - * The MIT License (MIT) - * - * SPDX-FileCopyrightText: Copyright (c) 2013, 2014 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 "py/mphal.h" -#include "py/runtime.h" -#include "lib/oofatfs/ff.h" /* FatFs lower layer API */ -#include "lib/oofatfs/diskio.h" /* FatFs lower layer API */ -#include "shared/timeutils/timeutils.h" - -#if CIRCUITPY_RTC -#include "shared-bindings/rtc/RTC.h" -#endif - -DWORD get_fattime(void) { - #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 - - -} diff --git a/ports/atmel-samd/mpconfigport.mk b/ports/atmel-samd/mpconfigport.mk index e6f5759f1c..d4d1ff31a3 100644 --- a/ports/atmel-samd/mpconfigport.mk +++ b/ports/atmel-samd/mpconfigport.mk @@ -24,13 +24,13 @@ ifeq ($(CHIP_FAMILY),samd21) CIRCUITPY_AESIO ?= 0 CIRCUITPY_ATEXIT ?= 0 CIRCUITPY_AUDIOMIXER ?= 0 +CIRCUITPY_AUDIOMP3 ?= 0 CIRCUITPY_BINASCII ?= 0 CIRCUITPY_BITBANGIO ?= 0 CIRCUITPY_BITMAPTOOLS ?= 0 -CIRCUITPY_BUSDEVICE ?= 0 -CIRCUITPY_AUDIOMP3 ?= 0 CIRCUITPY_BLEIO_HCI = 0 CIRCUITPY_BUILTINS_POW3 ?= 0 +CIRCUITPY_BUSDEVICE ?= 0 CIRCUITPY_COMPUTED_GOTO_SAVE_SPACE ?= 1 CIRCUITPY_COUNTIO ?= 0 # Not enough RAM for framebuffers @@ -42,6 +42,8 @@ CIRCUITPY_I2CTARGET ?= 0 CIRCUITPY_JSON ?= 0 CIRCUITPY_KEYPAD ?= 0 CIRCUITPY_MSGPACK ?= 0 +CIRCUITPY_OS_GETENV ?= 0 +CIRCUITPY_PIXELMAP ?= 0 CIRCUITPY_RE ?= 0 CIRCUITPY_SDCARDIO ?= 0 CIRCUITPY_SYNTHIO ?= 0 @@ -55,6 +57,7 @@ CIRCUITPY_ZLIB = 0 ifeq ($(INTERNAL_FLASH_FILESYSTEM),1) CIRCUITPY_ONEWIREIO ?= 0 +CIRCUITPY_SAFEMODE_PY ?= 0 CIRCUITPY_USB_IDENTIFICATION ?= 0 endif @@ -75,10 +78,8 @@ 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. +# On smaller builds this saves about 180 bytes. On other boards, it may -increase- space used, so use with care. CFLAGS_BOARD = -fweb -frename-registers -endif endif # samd21 ###################################################################### diff --git a/ports/atmel-samd/peripherals b/ports/atmel-samd/peripherals index 57133eefeb..baca4c0843 160000 --- a/ports/atmel-samd/peripherals +++ b/ports/atmel-samd/peripherals @@ -1 +1 @@ -Subproject commit 57133eefeb077f73b5ac17ee044d9feaf566da8e +Subproject commit baca4c084334aa8625f525a4032d66a397199ea6 diff --git a/ports/atmel-samd/supervisor/port.c b/ports/atmel-samd/supervisor/port.c index 2c63e28a17..45b999f1a1 100644 --- a/ports/atmel-samd/supervisor/port.c +++ b/ports/atmel-samd/supervisor/port.c @@ -368,20 +368,20 @@ safe_mode_t port_init(void) { #ifdef SAMD21 if (PM->RCAUSE.bit.BOD33 == 1 || PM->RCAUSE.bit.BOD12 == 1) { - return BROWNOUT; + return SAFE_MODE_BROWNOUT; } #endif #ifdef SAM_D5X_E5X if (RSTC->RCAUSE.bit.BODVDD == 1 || RSTC->RCAUSE.bit.BODCORE == 1) { - return BROWNOUT; + return SAFE_MODE_BROWNOUT; } #endif if (board_requests_safe_mode()) { - return USER_SAFE_MODE; + return SAFE_MODE_USER; } - return NO_SAFE_MODE; + return SAFE_MODE_NONE; } void reset_port(void) { @@ -720,7 +720,7 @@ __attribute__((used)) void HardFault_Handler(void) { REG_MTB_MASTER = 0x00000000 + 6; #endif - reset_into_safe_mode(HARD_CRASH); + reset_into_safe_mode(SAFE_MODE_HARD_FAULT); while (true) { asm ("nop;"); } diff --git a/ports/broadcom/Makefile b/ports/broadcom/Makefile index cbd072e833..b6dd62dedf 100644 --- a/ports/broadcom/Makefile +++ b/ports/broadcom/Makefile @@ -58,7 +58,6 @@ SRC_C += bindings/videocore/__init__.c \ boards/$(BOARD)/pins.c \ background.c \ common-hal/videocore/Framebuffer.c \ - fatfs_port.c \ mphalport.c \ lib/sdmmc/sdmmc_cmd.c \ lib/sdmmc/sdmmc_common.c \ diff --git a/ports/broadcom/common-hal/microcontroller/__init__.c b/ports/broadcom/common-hal/microcontroller/__init__.c index a1491d9668..53f04ebec3 100644 --- a/ports/broadcom/common-hal/microcontroller/__init__.c +++ b/ports/broadcom/common-hal/microcontroller/__init__.c @@ -46,7 +46,7 @@ void common_hal_mcu_disable_interrupts(void) { void common_hal_mcu_enable_interrupts(void) { if (nesting_count == 0) { - // reset_into_safe_mode(LOCKING_ERROR); + // reset_into_safe_mode(SAFE_MODE_INTERRUPT_ERROR); } nesting_count--; if (nesting_count > 0) { diff --git a/ports/broadcom/common-hal/neopixel_write/__init__.c b/ports/broadcom/common-hal/neopixel_write/__init__.c index 0cd76ebca9..245244614f 100644 --- a/ports/broadcom/common-hal/neopixel_write/__init__.c +++ b/ports/broadcom/common-hal/neopixel_write/__init__.c @@ -45,7 +45,10 @@ void common_hal_neopixel_write(const digitalio_digitalinout_obj_t *digitalinout, uint8_t *pixels, uint32_t num_bytes) { // Wait to make sure we don't append onto the last transmission. This should only be a tick or // two. - while (port_get_raw_ticks(NULL) < next_start_raw_ticks) { + int icnt; + while ((port_get_raw_ticks(NULL) < next_start_raw_ticks) && + (next_start_raw_ticks - port_get_raw_ticks(NULL) < 100)) { + RUN_BACKGROUND_TASKS; } BP_Function_Enum alt_function = GPIO_FUNCTION_OUTPUT; @@ -92,7 +95,8 @@ void common_hal_neopixel_write(const digitalio_digitalinout_obj_t *digitalinout, // Wait for the clock to start up. COMPLETE_MEMORY_READS; - while (CM_PWM->CS_b.BUSY == 0) { + icnt = 0; + while ((CM_PWM->CS_b.BUSY == 0) && (icnt++ < 1000)) { } } @@ -134,24 +138,45 @@ void common_hal_neopixel_write(const digitalio_digitalinout_obj_t *digitalinout, expanded |= 0x80000000; } } - while (pwm->STA_b.FULL1 == 1) { - RUN_BACKGROUND_TASKS; - } if (channel == 1) { + icnt = 0; + while ((pwm->STA_b.FULL1 == 1) && (icnt++ < 150)) { + RUN_BACKGROUND_TASKS; + } // Dummy value for the first channel. pwm->FIF1 = 0x000000; } + icnt = 0; + while ((pwm->STA_b.FULL1 == 1) && (icnt++ < 150)) { + RUN_BACKGROUND_TASKS; + } pwm->FIF1 = expanded; if (channel == 0) { + icnt = 0; + while ((pwm->STA_b.FULL1 == 1) && (icnt++ < 150)) { + RUN_BACKGROUND_TASKS; + } // Dummy value for the second channel. pwm->FIF1 = 0x000000; } } - // Wait just a little bit so that transmission can start. - common_hal_mcu_delay_us(2); - while (pwm->STA_b.STA1 == 1) { + + icnt = 0; + while ((pwm->STA_b.EMPT1 == 0) && (icnt++ < 2500)) { RUN_BACKGROUND_TASKS; } + // Wait for transmission to start. + icnt = 0; + while (((pwm->STA_b.STA1 == 0) && (pwm->STA_b.STA2 == 0)) && (icnt++ < 150)) { + RUN_BACKGROUND_TASKS; + } + // Wait for transmission to complete. + icnt = 0; + while (((pwm->STA_b.STA1 == 1) || (pwm->STA_b.STA2 == 1)) && (icnt++ < 150)) { + RUN_BACKGROUND_TASKS; + } + // Shouldn't be anything left in queue but clear it so the clock doesn't crash if there is + pwm->CTL = PWM0_CTL_CLRF1_Msk; gpio_set_function(digitalinout->pin->number, GPIO_FUNCTION_OUTPUT); diff --git a/ports/mimxrt10xx/fatfs_port.c b/ports/broadcom/common-hal/rtc/RTC.c similarity index 55% rename from ports/mimxrt10xx/fatfs_port.c rename to ports/broadcom/common-hal/rtc/RTC.c index 58a0ef0d72..8f6743cb05 100644 --- a/ports/mimxrt10xx/fatfs_port.c +++ b/ports/broadcom/common-hal/rtc/RTC.c @@ -3,7 +3,8 @@ * * The MIT License (MIT) * - * SPDX-FileCopyrightText: Copyright (c) 2013, 2014 Damien P. George + * Copyright (c) 2019 Nick Moore for Adafruit Industries + * Copyright (c) 2019 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 @@ -24,25 +25,34 @@ * THE SOFTWARE. */ -#include "py/mphal.h" +#include + +#include "py/obj.h" #include "py/runtime.h" -#include "lib/oofatfs/ff.h" /* FatFs lower layer API */ -#include "lib/oofatfs/diskio.h" /* FatFs lower layer API */ #include "shared/timeutils/timeutils.h" +#include "supervisor/port.h" -#if CIRCUITPY_RTC -#include "shared-bindings/rtc/RTC.h" -#endif - -DWORD get_fattime(void) { - #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 - +// 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. +static uint32_t rtc_offset = 0; +void common_hal_rtc_get_time(timeutils_struct_time_t *tm) { + uint64_t ticks_s = port_get_raw_ticks(NULL) / 1024; + timeutils_seconds_since_2000_to_struct_time(rtc_offset + ticks_s, tm); +} + +void common_hal_rtc_set_time(timeutils_struct_time_t *tm) { + uint64_t ticks_s = port_get_raw_ticks(NULL) / 1024; + uint32_t epoch_s = timeutils_seconds_since_2000( + tm->tm_year, tm->tm_mon, tm->tm_mday, tm->tm_hour, tm->tm_min, tm->tm_sec + ); + rtc_offset = epoch_s - ticks_s; +} + +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/litex/fatfs_port.c b/ports/broadcom/common-hal/rtc/RTC.h similarity index 79% rename from ports/litex/fatfs_port.c rename to ports/broadcom/common-hal/rtc/RTC.h index 631f7f0982..09ae4ea86f 100644 --- a/ports/litex/fatfs_port.c +++ b/ports/broadcom/common-hal/rtc/RTC.h @@ -3,7 +3,8 @@ * * The MIT License (MIT) * - * SPDX-FileCopyrightText: Copyright (c) 2013, 2014 Damien P. George + * Copyright (c) 2018 Noralf Trønnes + * Copyright (c) 2019 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 @@ -24,10 +25,9 @@ * THE SOFTWARE. */ -#include "py/runtime.h" -#include "lib/oofatfs/ff.h" +#ifndef MICROPY_INCLUDED_BROADCOM_COMMON_HAL_RTC_RTC_H +#define MICROPY_INCLUDED_BROADCOM_COMMON_HAL_RTC_RTC_H -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); -} +extern void rtc_reset(void); + +#endif // MICROPY_INCLUDED_BROADCOM_COMMON_HAL_RTC_RTC_H diff --git a/ports/broadcom/common-hal/rtc/__init__.c b/ports/broadcom/common-hal/rtc/__init__.c new file mode 100644 index 0000000000..e69de29bb2 diff --git a/ports/broadcom/mpconfigport.mk b/ports/broadcom/mpconfigport.mk index 839ef00514..b992d24f0e 100644 --- a/ports/broadcom/mpconfigport.mk +++ b/ports/broadcom/mpconfigport.mk @@ -15,7 +15,6 @@ CIRCUITPY_PARALLELDISPLAY = 0 CIRCUITPY_PULSEIO = 0 CIRCUITPY_PWMIO = 0 CIRCUITPY_ROTARYIO = 0 -CIRCUITPY_RTC = 0 CIRCUITPY_SDIOIO = 1 CIRCUITPY_VIDEOCORE = 1 diff --git a/ports/broadcom/supervisor/port.c b/ports/broadcom/supervisor/port.c index e036a76cef..ec6feb8703 100644 --- a/ports/broadcom/supervisor/port.c +++ b/ports/broadcom/supervisor/port.c @@ -32,7 +32,7 @@ #include "genhdr/mpversion.h" -// #include "common-hal/rtc/RTC.h" +#include "common-hal/rtc/RTC.h" #include "common-hal/busio/I2C.h" #include "common-hal/busio/SPI.h" #include "common-hal/busio/UART.h" @@ -78,10 +78,10 @@ safe_mode_t port_init(void) { // Check brownout. if (board_requests_safe_mode()) { - return USER_SAFE_MODE; + return SAFE_MODE_USER; } - return NO_SAFE_MODE; + return SAFE_MODE_NONE; } void reset_port(void) { diff --git a/ports/cxd56/Makefile b/ports/cxd56/Makefile index 389b8a7fe6..f90b6dd460 100644 --- a/ports/cxd56/Makefile +++ b/ports/cxd56/Makefile @@ -134,13 +134,13 @@ SRC_COMMON_HAL_EXPANDED = $(addprefix shared-bindings/, $(SRC_COMMON_HAL)) \ $(addprefix common-hal/, $(SRC_COMMON_HAL)) SRC_SHARED_MODULE_EXPANDED = $(addprefix shared-bindings/, $(SRC_SHARED_MODULE)) \ - $(addprefix shared-module/, $(SRC_SHARED_MODULE)) + $(addprefix shared-module/, $(SRC_SHARED_MODULE)) \ + $(addprefix shared-module/, $(SRC_SHARED_MODULE_INTERNAL)) SRC_S = supervisor/cpu.s SRC_C += \ background.c \ - fatfs_port.c \ mphalport.c \ boards/$(BOARD)/board.c \ boards/$(BOARD)/pins.c \ diff --git a/ports/cxd56/README.md b/ports/cxd56/README.md index 0656ad1f1a..4266c61c0c 100644 --- a/ports/cxd56/README.md +++ b/ports/cxd56/README.md @@ -75,7 +75,7 @@ Bootloader information: * You have to accept the End User License Agreement to be able to download and use the Spresense bootloader binary. -Download the spresense binaries zip archive from: [Spresense firmware v2-3-000](https://developer.sony.com/file/download/download-spresense-firmware-v2-3-000) +Download the spresense binaries zip archive from: [Spresense firmware v2-4-000](https://developer.sony.com/file/download/download-spresense-firmware-v2-4-000) Extract spresense binaries in your PC to ports/spresense/spresense-exported-sdk/firmware/ diff --git a/ports/cxd56/common-hal/camera/Camera.c b/ports/cxd56/common-hal/camera/Camera.c index f304ed8f74..606ad0f1e6 100644 --- a/ports/cxd56/common-hal/camera/Camera.c +++ b/ports/cxd56/common-hal/camera/Camera.c @@ -47,7 +47,7 @@ typedef struct { uint16_t height; } image_size_t; -STATIC const image_size_t image_size_table[] = { +STATIC const image_size_t isx012_image_size_table[] = { { VIDEO_HSIZE_QVGA, VIDEO_VSIZE_QVGA }, { VIDEO_HSIZE_VGA, VIDEO_VSIZE_VGA }, { VIDEO_HSIZE_HD, VIDEO_VSIZE_HD }, @@ -57,12 +57,40 @@ STATIC const image_size_t image_size_table[] = { { VIDEO_HSIZE_5M, VIDEO_VSIZE_5M }, }; +STATIC const image_size_t isx019_image_size_table[] = { + { VIDEO_HSIZE_QVGA, VIDEO_VSIZE_QVGA }, + { VIDEO_HSIZE_VGA, VIDEO_VSIZE_VGA }, + { VIDEO_HSIZE_HD, VIDEO_VSIZE_HD }, + { VIDEO_HSIZE_QUADVGA, VIDEO_VSIZE_QUADVGA }, +}; + +static const char *get_imgsensor_name() { + static struct v4l2_capability cap; + + ioctl(camera_dev.fd, VIDIOC_QUERYCAP, (unsigned long)&cap); + + return (const char *)cap.driver; +} + static bool camera_check_width_and_height(uint16_t width, uint16_t height) { - for (int i = 0; i < MP_ARRAY_SIZE(image_size_table); i++) { - if (image_size_table[i].width == width && image_size_table[i].height == height) { - return true; + const char *sensor; + + sensor = get_imgsensor_name(); + + if (strncmp(sensor, "ISX012", strlen("ISX012")) == 0) { + for (int i = 0; i < MP_ARRAY_SIZE(isx012_image_size_table); i++) { + if (isx012_image_size_table[i].width == width && isx012_image_size_table[i].height == height) { + return true; + } + } + } else if (strncmp(sensor, "ISX019", strlen("ISX019"))) { + for (int i = 0; i < MP_ARRAY_SIZE(isx019_image_size_table); i++) { + if (isx019_image_size_table[i].width == width && isx019_image_size_table[i].height == height) { + return true; + } } } + return false; } diff --git a/ports/cxd56/common-hal/microcontroller/__init__.c b/ports/cxd56/common-hal/microcontroller/__init__.c index dd9a54063f..c77a8829f2 100644 --- a/ports/cxd56/common-hal/microcontroller/__init__.c +++ b/ports/cxd56/common-hal/microcontroller/__init__.c @@ -74,7 +74,7 @@ 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")); } else if (runmode == RUNMODE_SAFE_MODE) { - safe_mode_on_next_reset(PROGRAMMATIC_SAFE_MODE); + safe_mode_on_next_reset(SAFE_MODE_PROGRAMMATIC); } } diff --git a/ports/cxd56/configs/circuitpython/defconfig b/ports/cxd56/configs/circuitpython/defconfig index 6a7c39cba8..92e282649b 100644 --- a/ports/cxd56/configs/circuitpython/defconfig +++ b/ports/cxd56/configs/circuitpython/defconfig @@ -113,4 +113,5 @@ CONFIG_USEC_PER_TICK=1000 CONFIG_USERMAIN_STACKSIZE=8192 CONFIG_USER_ENTRYPOINT="spresense_main" CONFIG_VIDEO_ISX012=y +CONFIG_VIDEO_ISX019=y CONFIG_VIDEO_STREAM=y diff --git a/ports/cxd56/fatfs_port.c b/ports/cxd56/fatfs_port.c deleted file mode 100644 index e672b095b7..0000000000 --- a/ports/cxd56/fatfs_port.c +++ /dev/null @@ -1,46 +0,0 @@ -/* - * This file is part of the MicroPython project, http://micropython.org/ - * - * The MIT License (MIT) - * - * Copyright 2019 Sony Semiconductor Solutions Corporation - * - * 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/mphal.h" -#include "py/runtime.h" -#include "lib/oofatfs/ff.h" /* FatFs lower layer API */ -#include "lib/oofatfs/diskio.h" /* FatFs lower layer API */ -#include "shared/timeutils/timeutils.h" - -#if CIRCUITPY_RTC -#include "shared-bindings/rtc/RTC.h" -#endif - -DWORD get_fattime(void) { - #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 -} diff --git a/ports/cxd56/spresense-exported-sdk b/ports/cxd56/spresense-exported-sdk index 6a148be849..4f902ca3ff 160000 --- a/ports/cxd56/spresense-exported-sdk +++ b/ports/cxd56/spresense-exported-sdk @@ -1 +1 @@ -Subproject commit 6a148be8497704d4afb5d14c175a12a592813fac +Subproject commit 4f902ca3ffeb327e6c325940ef5133eda588c2e4 diff --git a/ports/cxd56/supervisor/port.c b/ports/cxd56/supervisor/port.c index 10fa4112e8..36d46dbad8 100644 --- a/ports/cxd56/supervisor/port.c +++ b/ports/cxd56/supervisor/port.c @@ -66,10 +66,10 @@ safe_mode_t port_init(void) { heap_size = size / sizeof(uint32_t); if (board_requests_safe_mode()) { - return USER_SAFE_MODE; + return SAFE_MODE_USER; } - return NO_SAFE_MODE; + return SAFE_MODE_NONE; } void reset_cpu(void) { @@ -111,13 +111,13 @@ bool port_has_fixed_stack(void) { uint32_t *port_stack_get_limit(void) { struct tcb_s *rtcb = this_task(); - return rtcb->adj_stack_ptr - (uint32_t)rtcb->adj_stack_size; + return rtcb->stack_base_ptr; } uint32_t *port_stack_get_top(void) { struct tcb_s *rtcb = this_task(); - return rtcb->adj_stack_ptr; + return rtcb->stack_base_ptr + (uint32_t)rtcb->adj_stack_size; } uint32_t *port_heap_get_bottom(void) { diff --git a/ports/espressif/CMakeLists.txt b/ports/espressif/CMakeLists.txt index ea4de9f343..ce2935a502 100644 --- a/ports/espressif/CMakeLists.txt +++ b/ports/espressif/CMakeLists.txt @@ -8,7 +8,7 @@ set(ENV{IDF_PATH} ${CMAKE_SOURCE_DIR}/esp-idf) # can build. set(COMPONENTS esptool_py soc driver log main esp-tls mbedtls mdns esp_event esp_adc_cal esp_netif esp_wifi lwip ulp wpa_supplicant freertos bt usb) -if("${CIRCUITPY_ESP32_CAMERA}") +if("${CIRCUITPY_ESPCAMERA}") message("Including esp32-camera") set(EXTRA_COMPONENT_DIRS "esp32-camera") list(APPEND COMPONENTS "esp32-camera") diff --git a/ports/espressif/Makefile b/ports/espressif/Makefile index b197195aa2..1c79691b33 100644 --- a/ports/espressif/Makefile +++ b/ports/espressif/Makefile @@ -100,8 +100,6 @@ INC += \ -isystem esp-idf/components/soc/include \ -isystem esp-idf/components/soc/$(IDF_TARGET)/include \ -isystem esp-idf/components/spi_flash/include \ - -isystem esp-idf/components/ulp/include \ - -isystem esp-idf/components/ulp/ulp_riscv/include \ -isystem esp-idf/components/$(IDF_TARGET_ARCH)/include \ -isystem esp-idf/components/$(IDF_TARGET_ARCH)/$(IDF_TARGET)/include @@ -215,7 +213,6 @@ endif SRC_C += \ background.c \ - fatfs_port.c \ mphalport.c \ bindings/espidf/__init__.c \ boards/$(BOARD)/board.c \ @@ -253,15 +250,24 @@ endif SRC_C += $(wildcard common-hal/espidf/*.c) -ifneq ($(CIRCUITPY_ESP32_CAMERA),0) +ifneq ($(CIRCUITPY_ESPCAMERA),0) SRC_CAMERA := \ - $(wildcard common-hal/esp32_camera/*.c) \ - $(wildcard bindings/esp32_camera/*.c) + $(wildcard common-hal/espcamera/*.c) \ + $(wildcard bindings/espcamera/*.c) SRC_C += $(SRC_CAMERA) CFLAGS += -isystem esp32-camera/driver/include CFLAGS += -isystem esp32-camera/conversions/include endif +ifneq ($(CIRCUITPY_ESPULP),0) +SRC_ULP := \ + $(wildcard common-hal/espulp/*.c) \ + $(wildcard bindings/espulp/*.c) +SRC_C += $(SRC_ULP) +CFLAGS += -isystem esp-idf/components/ulp/include +CFLAGS += -isystem esp-idf/components/ulp/ulp_riscv/include +endif + SRC_COMMON_HAL_EXPANDED = \ $(addprefix shared-bindings/, $(SRC_COMMON_HAL)) \ $(addprefix shared-bindings/, $(SRC_BINDINGS_ENUMS)) \ @@ -327,7 +333,7 @@ endif .PHONY: do-sdkconfig do-sdkconfig: $(BUILD)/esp-idf/config/sdkconfig.h $(BUILD)/esp-idf/config/sdkconfig.h: boards/$(BOARD)/sdkconfig CMakeLists.txt | $(BUILD)/esp-idf - IDF_PATH=$(IDF_PATH) cmake -S . -B $(BUILD)/esp-idf -DSDKCONFIG=$(BUILD)/esp-idf/sdkconfig -DSDKCONFIG_DEFAULTS="$(SDKCONFIGS)" -DCMAKE_TOOLCHAIN_FILE=$(IDF_PATH)/tools/cmake/toolchain-$(IDF_TARGET).cmake -DIDF_TARGET=$(IDF_TARGET) -GNinja -DCIRCUITPY_ESP32_CAMERA=$(CIRCUITPY_ESP32_CAMERA) + IDF_PATH=$(IDF_PATH) cmake -S . -B $(BUILD)/esp-idf -DSDKCONFIG=$(BUILD)/esp-idf/sdkconfig -DSDKCONFIG_DEFAULTS="$(SDKCONFIGS)" -DCMAKE_TOOLCHAIN_FILE=$(IDF_PATH)/tools/cmake/toolchain-$(IDF_TARGET).cmake -DIDF_TARGET=$(IDF_TARGET) -GNinja -DCIRCUITPY_ESPCAMERA=$(CIRCUITPY_ESPCAMERA) # build a lib # Adding -d explain -j 1 -v to the ninja line will output debug info @@ -365,7 +371,7 @@ ifneq ($(CIRCUITPY_BLEIO),0) BINARY_BLOBS += esp-idf/components/esp_phy/lib/$(IDF_TARGET)/libbtbb.a \ esp-idf/components/bt/controller/lib_esp32c3_family/$(IDF_TARGET)/libbtdm_app.a endif -ifneq ($(CIRCUITPY_COPROC),0) +ifneq ($(CIRCUITPY_ESPULP),0) ESP_IDF_COMPONENTS_LINK += ulp endif @@ -379,7 +385,7 @@ BINARY_BLOBS += esp-idf/components/xtensa/$(IDF_TARGET)/libxt_hal.a ESP_IDF_COMPONENTS_EXPANDED += esp-idf/components/xtensa/$(IDF_TARGET)/libxt_hal.a endif -ifneq ($(CIRCUITPY_ESP32_CAMERA),0) +ifneq ($(CIRCUITPY_ESPCAMERA),0) ESP_IDF_COMPONENTS_EXPANDED += $(BUILD)/esp-idf/esp-idf/esp32-camera/libesp32-camera.a #$(error $(ESP_IDF_COMPONENTS_EXPANDED)) endif @@ -423,7 +429,7 @@ esp-idf-stamp: $(BUILD)/esp-idf/config/sdkconfig.h $(BUILD)/firmware.elf: $(OBJ) | esp-idf-stamp $(STEPECHO) "LINK $@" - $(Q)$(CC) -o $@ $(LDFLAGS) $^ -Wl,--start-group $(ESP_IDF_COMPONENTS_EXPANDED) $(BINARY_BLOBS) $(MBEDTLS_COMPONENTS_LINK_EXPANDED) $(BUILD)/esp-idf/esp-idf/newlib/libnewlib.a -Wl,--end-group -u newlib_include_pthread_impl -Wl,--start-group $(LIBS) -Wl,--end-group $(BUILD)/esp-idf/esp-idf/pthread/libpthread.a -u __cxx_fatal_exception + $(Q)$(CC) -o $@ $(LDFLAGS) $^ -Wl,--start-group $(ESP_IDF_COMPONENTS_EXPANDED) $(BINARY_BLOBS) $(MBEDTLS_COMPONENTS_LINK_EXPANDED) $(BUILD)/esp-idf/esp-idf/newlib/libnewlib.a -Wl,--end-group -u newlib_include_pthread_impl -u ld_include_highint_hdl -Wl,--start-group $(LIBS) -Wl,--end-group $(BUILD)/esp-idf/esp-idf/pthread/libpthread.a -u __cxx_fatal_exception $(BUILD)/circuitpython-firmware.bin: $(BUILD)/firmware.elf | tools/build_memory_info.py $(STEPECHO) "Create $@" diff --git a/ports/espressif/bindings/esp32_camera/Camera.c b/ports/espressif/bindings/esp32_camera/Camera.c deleted file mode 100644 index a770ea8ff7..0000000000 --- a/ports/espressif/bindings/esp32_camera/Camera.c +++ /dev/null @@ -1,994 +0,0 @@ -/* - * This file is part of the MicroPython project, http://micropython.org/ - * - * The MIT License (MIT) - * - * Copyright (c) 2022 Jeff Epler for Adafruit Industries - * - * Permission is hereby granted, free of charge, to any person obtaining a copy - * of this software and associated documentation files (the "Software"), to deal - * in the Software without restriction, including without limitation the rights - * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell - * copies of the Software, and to permit persons to whom the Software is - * furnished to do so, subject to the following conditions: - * - * The above copyright notice and this permission notice shall be included in - * all copies or substantial portions of the Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR - * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, - * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE - * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER - * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, - * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN - * THE SOFTWARE. - */ - -#include - -#include "py/mphal.h" -#include "py/obj.h" -#include "py/objproperty.h" -#include "py/runtime.h" - -#include "bindings/esp32_camera/__init__.h" -#include "bindings/esp32_camera/Camera.h" -#include "common-hal/esp32_camera/Camera.h" - -#include "shared-bindings/displayio/Bitmap.h" -#include "shared-bindings/microcontroller/Pin.h" -#include "shared-bindings/util.h" -#include "esp_camera.h" -#include "sensor.h" - -//| class Camera: -//| def __init__( -//| self, -//| *, -//| data_pins: List[microcontroller.Pin], -//| pixel_clock_pin: microcontroller.Pin, -//| vsync_pin: microcontroller.Pin, -//| href_pin: microcontroller.Pin, -//| i2c: busio.I2C, -//| external_clock_pin: 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/espcamera/Camera.c b/ports/espressif/bindings/espcamera/Camera.c new file mode 100644 index 0000000000..824bc7d3dc --- /dev/null +++ b/ports/espressif/bindings/espcamera/Camera.c @@ -0,0 +1,1001 @@ +/* + * This file is part of the MicroPython project, http://micropython.org/ + * + * The MIT License (MIT) + * + * Copyright (c) 2022 Jeff Epler for Adafruit Industries + * + * Permission is hereby granted, free of charge, to any person obtaining a copy + * of this software and associated documentation files (the "Software"), to deal + * in the Software without restriction, including without limitation the rights + * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell + * copies of the Software, and to permit persons to whom the Software is + * furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice shall be included in + * all copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE + * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER + * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, + * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN + * THE SOFTWARE. + */ + +#include + +#include "py/mphal.h" +#include "py/obj.h" +#include "py/objproperty.h" +#include "py/runtime.h" + +#include "bindings/espcamera/__init__.h" +#include "bindings/espcamera/Camera.h" +#include "common-hal/espcamera/Camera.h" + +#include "shared-bindings/displayio/Bitmap.h" +#include "shared-bindings/microcontroller/Pin.h" +#include "shared-bindings/util.h" +#include "esp_camera.h" +#include "sensor.h" + +//| class Camera: +//| def __init__( +//| self, +//| *, +//| data_pins: List[microcontroller.Pin], +//| pixel_clock_pin: microcontroller.Pin, +//| vsync_pin: microcontroller.Pin, +//| href_pin: microcontroller.Pin, +//| i2c: busio.I2C, +//| external_clock_pin: Optional[microcontroller.Pin] = None, +//| external_clock_frequency: int = 20_000_000, +//| powerdown_pin: Optional[microcontroller.Pin] = None, +//| reset_pin: Optional[microcontroller.Pin] = None, +//| pixel_format: PixelFormat = PixelFormat.RGB565, +//| frame_size: FrameSize = FrameSize.QQVGA, +//| jpeg_quality: int = 15, +//| framebuffer_count: int = 1, +//| grab_mode: GrabMode = GrabMode.WHEN_EMPTY, +//| ) -> None: +//| """ +//| Configure and initialize a camera with the given properties +//| +//| This driver requires that the ``CIRCUITPY_RESERVED_PSRAM`` in ``settings.toml`` be large enough to hold the camera frambuffer(s). Generally, boards with built-in cameras will have a default setting that is large enough. If the constructor raises a MemoryError or an IDFError, this probably indicates the setting is too small and should be increased. +//| +//| +//| .. important:: +//| +//| Not all supported sensors have all +//| of the properties listed below. For instance, the +//| OV5640 supports `denoise`, but the +//| OV2640 does not. The underlying esp32-camera +//| library does not provide a reliable API to check +//| which settings are supported. CircuitPython makes +//| a best effort to determine when an unsupported +//| property is set and will raise an exception in +//| that case. +//| +//| :param data_pins: The 8 data data_pins used for image data transfer from the camera module, least significant bit first +//| :param pixel_clock_pin: The pixel clock output from the camera module +//| :param vsync_pin: The vertical sync pulse output from the camera module +//| :param href_pin: The horizontal reference output from the camera module +//| :param i2c: The I2C bus connected to the camera module +//| :param external_clock_pin: The pin on which to generate the external clock +//| :param external_clock_frequency: The frequency generated on the external clock pin +//| :param powerdown_pin: The powerdown input to the camera module +//| :param reset_pin: The reset input to the camera module +//| :param pixel_format: The pixel format of the captured image +//| :param frame_size: The size of captured image +//| :param jpeg_quality: For `PixelFormat.JPEG`, the quality. Higher numbers increase quality. If the quality is too high, the JPEG data will be larger than the availalble buffer size and the image will be unusable or truncated. The exact range of appropriate values depends on the sensor and must be determined empirically. +//| :param framebuffer_count: The number of framebuffers (1 for single-buffered and 2 for double-buffered) +//| :param grab_mode: When to grab a new frame +//| """ +STATIC mp_obj_t espcamera_camera_make_new(const mp_obj_type_t *type, size_t n_args, size_t n_kw, const mp_obj_t *all_args) { + enum { ARG_data_pins, ARG_pixel_clock_pin, ARG_vsync_pin, ARG_href_pin, ARG_i2c, ARG_external_clock_pin, ARG_external_clock_frequency, ARG_powerdown_pin, ARG_reset_pin, ARG_pixel_format, ARG_frame_size, ARG_jpeg_quality, ARG_framebuffer_count, ARG_grab_mode, NUM_ARGS }; + static const mp_arg_t allowed_args[] = { + { MP_QSTR_data_pins, MP_ARG_OBJ | MP_ARG_KW_ONLY | MP_ARG_REQUIRED }, + { MP_QSTR_pixel_clock_pin, MP_ARG_OBJ | MP_ARG_KW_ONLY | MP_ARG_REQUIRED }, + { MP_QSTR_vsync_pin, MP_ARG_OBJ | MP_ARG_KW_ONLY | MP_ARG_REQUIRED }, + { MP_QSTR_href_pin, MP_ARG_OBJ | MP_ARG_KW_ONLY | MP_ARG_REQUIRED }, + { MP_QSTR_i2c, MP_ARG_OBJ | MP_ARG_KW_ONLY | MP_ARG_REQUIRED }, + { MP_QSTR_external_clock_pin, MP_ARG_OBJ | MP_ARG_KW_ONLY, { .u_obj = MP_ROM_NONE } }, + { MP_QSTR_external_clock_frequency, MP_ARG_INT | MP_ARG_KW_ONLY, { .u_int = 20000000L } }, + { MP_QSTR_powerdown_pin, MP_ARG_OBJ | MP_ARG_KW_ONLY, { .u_obj = MP_ROM_NONE } }, + { MP_QSTR_reset_pin, MP_ARG_OBJ | MP_ARG_KW_ONLY, { .u_obj = MP_ROM_NONE } }, + { MP_QSTR_pixel_format, MP_ARG_OBJ | MP_ARG_KW_ONLY, { .u_obj = MP_ROM_PTR((void *)&pixel_format_RGB565_obj) } }, + { MP_QSTR_frame_size, MP_ARG_OBJ | MP_ARG_KW_ONLY, { .u_obj = MP_ROM_PTR((void *)&frame_size_QQVGA_obj) } }, + { MP_QSTR_jpeg_quality, MP_ARG_INT | MP_ARG_KW_ONLY, { .u_int = 15 } }, + { MP_QSTR_framebuffer_count, MP_ARG_INT | MP_ARG_KW_ONLY, { .u_int = 1 } }, + { MP_QSTR_grab_mode, MP_ARG_OBJ | MP_ARG_KW_ONLY, { .u_obj = MP_ROM_PTR((void *)&grab_mode_WHEN_EMPTY_obj) } }, + }; + + mp_arg_val_t args[MP_ARRAY_SIZE(allowed_args)]; + MP_STATIC_ASSERT(MP_ARRAY_SIZE(allowed_args) == NUM_ARGS); + mp_arg_parse_all_kw_array(n_args, n_kw, all_args, MP_ARRAY_SIZE(allowed_args), allowed_args, args); + + uint8_t data_pins[8]; + uint8_t data_pin_count; + validate_pins(MP_QSTR_data_pins, data_pins, MP_ARRAY_SIZE(data_pins), args[ARG_data_pins].u_obj, &data_pin_count); + mp_arg_validate_length(data_pin_count, 8, MP_QSTR_data_pins); + + const mcu_pin_obj_t *pixel_clock_pin = + validate_obj_is_free_pin(args[ARG_pixel_clock_pin].u_obj, MP_QSTR_pixel_clock_pin); + const mcu_pin_obj_t *vsync_pin = + validate_obj_is_free_pin(args[ARG_vsync_pin].u_obj, MP_QSTR_vsync_pin); + const mcu_pin_obj_t *href_pin = + validate_obj_is_free_pin(args[ARG_href_pin].u_obj, MP_QSTR_href_pin); + busio_i2c_obj_t *i2c = MP_OBJ_TO_PTR(mp_arg_validate_type(args[ARG_i2c].u_obj, &busio_i2c_type, MP_QSTR_i2c)); + const mcu_pin_obj_t *external_clock_pin = + validate_obj_is_free_pin_or_none(args[ARG_external_clock_pin].u_obj, MP_QSTR_external_clock_pin); + const mcu_pin_obj_t *powerdown_pin = + validate_obj_is_free_pin_or_none(args[ARG_powerdown_pin].u_obj, MP_QSTR_powerdown_pin); + const mcu_pin_obj_t *reset_pin = + validate_obj_is_free_pin_or_none(args[ARG_reset_pin].u_obj, MP_QSTR_reset_pin); + const mp_int_t external_clock_frequency = + mp_arg_validate_int_range(args[ARG_external_clock_frequency].u_int, 0, 40000000, MP_QSTR_external_clock_frequency); + + camera_grab_mode_t grab_mode = validate_grab_mode(args[ARG_grab_mode].u_obj, MP_QSTR_grab_mode); + framesize_t frame_size = validate_frame_size(args[ARG_frame_size].u_obj, MP_QSTR_frame_size); + pixformat_t pixel_format = validate_pixel_format(args[ARG_pixel_format].u_obj, MP_QSTR_pixel_format); + mp_int_t jpeg_quality = mp_arg_validate_int_range(args[ARG_jpeg_quality].u_int, 2, 55, MP_QSTR_jpeg_quality); + mp_int_t framebuffer_count = mp_arg_validate_int_range(args[ARG_framebuffer_count].u_int, 1, 2, MP_QSTR_framebuffer_count); + + espcamera_camera_obj_t *self = m_new_obj(espcamera_camera_obj_t); + self->base.type = &espcamera_camera_type; + common_hal_espcamera_camera_construct( + self, + data_pins, + external_clock_pin, + pixel_clock_pin, + vsync_pin, + href_pin, + powerdown_pin, + reset_pin, + i2c, + external_clock_frequency, + pixel_format, + frame_size, + jpeg_quality, + framebuffer_count, + grab_mode); + return MP_OBJ_FROM_PTR(self); +} + +//| def deinit(self) -> None: +//| """Deinitialises the camera and releases all memory resources for reuse.""" +//| ... +STATIC mp_obj_t espcamera_camera_deinit(mp_obj_t self_in) { + espcamera_camera_obj_t *self = MP_OBJ_TO_PTR(self_in); + common_hal_espcamera_camera_deinit(self); + return mp_const_none; +} +STATIC MP_DEFINE_CONST_FUN_OBJ_1(espcamera_camera_deinit_obj, espcamera_camera_deinit); + +STATIC void check_for_deinit(espcamera_camera_obj_t *self) { + if (common_hal_espcamera_camera_deinited(self)) { + raise_deinited_error(); + } +} + +//| def __enter__(self) -> Camera: +//| """No-op used by Context Managers.""" +//| ... +// Provided by context manager helper. + +//| def __exit__(self) -> None: +//| """Automatically deinitializes the hardware when exiting a context. See +//| :ref:`lifetime-and-contextmanagers` for more info.""" +//| ... +STATIC mp_obj_t espcamera_camera_obj___exit__(size_t n_args, const mp_obj_t *args) { + (void)n_args; + return espcamera_camera_deinit(args[0]); +} +STATIC MP_DEFINE_CONST_FUN_OBJ_VAR_BETWEEN(espcamera_camera___exit___obj, 4, 4, espcamera_camera_obj___exit__); + +//| frame_available: bool +//| """True if a frame is available, False otherwise""" + +STATIC mp_obj_t espcamera_camera_frame_available_get(const mp_obj_t self_in) { + espcamera_camera_obj_t *self = MP_OBJ_TO_PTR(self_in); + check_for_deinit(self); + return mp_obj_new_bool(esp_camera_fb_available()); +} +STATIC MP_DEFINE_CONST_FUN_OBJ_1(espcamera_camera_frame_available_get_obj, espcamera_camera_frame_available_get); + +MP_PROPERTY_GETTER(espcamera_camera_frame_available_obj, + (mp_obj_t)&espcamera_camera_frame_available_get_obj); + +//| def take( +//| self, timeout: Optional[float] = 0.25 +//| ) -> Optional[displayio.Bitmap | ReadableBuffer]: +//| """Record a frame. Wait up to 'timeout' seconds for a frame to be captured. +//| +//| In the case of timeout, `None` is returned. +//| If `pixel_format` is `PixelFormat.JPEG`, the returned value is a read-only `memoryview`. +//| Otherwise, the returned value is a read-only `displayio.Bitmap`. +//| """ +STATIC mp_obj_t espcamera_camera_take(size_t n_args, const mp_obj_t *args) { + espcamera_camera_obj_t *self = MP_OBJ_TO_PTR(args[0]); + mp_float_t timeout = n_args < 2 ? MICROPY_FLOAT_CONST(0.25) : mp_obj_get_float(args[1]); + check_for_deinit(self); + camera_fb_t *result = common_hal_espcamera_camera_take(self, (int)MICROPY_FLOAT_C_FUN(round)(timeout * 1000)); + if (!result) { + return mp_const_none; + } + pixformat_t format = common_hal_espcamera_camera_get_pixel_format(self); + if (format == PIXFORMAT_JPEG) { + return mp_obj_new_memoryview('b', result->len, result->buf); + } else { + int width = common_hal_espcamera_camera_get_width(self); + int height = common_hal_espcamera_camera_get_height(self); + displayio_bitmap_t *bitmap = m_new_obj(displayio_bitmap_t); + bitmap->base.type = &displayio_bitmap_type; + common_hal_displayio_bitmap_construct_from_buffer(bitmap, width, height, (format == PIXFORMAT_RGB565) ? 16 : 8, (uint32_t *)(void *)result->buf, true); + return bitmap; + } +} +STATIC MP_DEFINE_CONST_FUN_OBJ_VAR_BETWEEN(espcamera_camera_take_obj, 1, 2, espcamera_camera_take); + + +//| def reconfigure( +//| self, +//| frame_size: Optional[FrameSize] = None, +//| pixel_format: Optional[PixelFormat] = None, +//| grab_mode: Optional[GrabMode] = None, +//| framebuffer_count: Optional[int] = None, +//| ) -> None: +//| """Change multiple related camera settings simultaneously +//| +//| Because these settings interact in complex ways, and take longer than +//| the other properties to set, they are set together in a single function call. +//| +//| If an argument is unspecified or None, then the setting is unchanged.""" + +STATIC mp_obj_t espcamera_camera_reconfigure(mp_uint_t n_args, const mp_obj_t *pos_args, mp_map_t *kw_args) { + espcamera_camera_obj_t *self = MP_OBJ_TO_PTR(pos_args[0]); + check_for_deinit(self); + + enum { ARG_frame_size, ARG_pixel_format, ARG_grab_mode, ARG_framebuffer_count }; + static const mp_arg_t allowed_args[] = { + { MP_QSTR_frame_size, MP_ARG_OBJ, {.u_obj = MP_ROM_NONE} }, + { MP_QSTR_pixel_format, MP_ARG_OBJ, {.u_obj = MP_ROM_NONE} }, + { MP_QSTR_grab_mode, MP_ARG_OBJ, {.u_obj = MP_ROM_NONE} }, + { MP_QSTR_framebuffer_count, MP_ARG_OBJ, {.u_obj = MP_ROM_NONE} }, + }; + + mp_arg_val_t args[MP_ARRAY_SIZE(allowed_args)]; + mp_arg_parse_all(n_args - 1, pos_args + 1, kw_args, MP_ARRAY_SIZE(allowed_args), allowed_args, args); + + framesize_t frame_size = + args[ARG_frame_size].u_obj != MP_ROM_NONE + ? validate_frame_size(args[ARG_frame_size].u_obj, MP_QSTR_frame_size) + : common_hal_espcamera_camera_get_frame_size(self); + pixformat_t pixel_format = + args[ARG_pixel_format].u_obj != MP_ROM_NONE + ? validate_pixel_format(args[ARG_pixel_format].u_obj, MP_QSTR_pixel_format) + : common_hal_espcamera_camera_get_pixel_format(self); + camera_grab_mode_t grab_mode = + args[ARG_grab_mode].u_obj != MP_ROM_NONE + ? validate_grab_mode(args[ARG_grab_mode].u_obj, MP_QSTR_grab_mode) + : common_hal_espcamera_camera_get_grab_mode(self); + bool framebuffer_count = + args[ARG_framebuffer_count].u_obj != MP_ROM_NONE + ? mp_obj_get_int(args[ARG_framebuffer_count].u_obj) + : common_hal_espcamera_camera_get_framebuffer_count(self); + + common_hal_espcamera_camera_reconfigure(self, frame_size, pixel_format, grab_mode, framebuffer_count); + + return mp_const_none; +} +MP_DEFINE_CONST_FUN_OBJ_KW(espcamera_camera_reconfigure_obj, 1, espcamera_camera_reconfigure); + +//| pixel_format: PixelFormat +//| """The pixel format of captured frames""" + +STATIC mp_obj_t espcamera_camera_get_pixel_format(const mp_obj_t self_in) { + espcamera_camera_obj_t *self = MP_OBJ_TO_PTR(self_in); + check_for_deinit(self); + return cp_enum_find(&espcamera_pixel_format_type, common_hal_espcamera_camera_get_pixel_format(self)); +} +STATIC MP_DEFINE_CONST_FUN_OBJ_1(espcamera_camera_get_pixel_format_obj, espcamera_camera_get_pixel_format); + +MP_PROPERTY_GETTER(espcamera_camera_pixel_format_obj, + (mp_obj_t)&espcamera_camera_get_pixel_format_obj); + + +//| frame_size: FrameSize +//| """The size of captured frames""" + +STATIC mp_obj_t espcamera_camera_get_frame_size(const mp_obj_t self_in) { + espcamera_camera_obj_t *self = MP_OBJ_TO_PTR(self_in); + check_for_deinit(self); + return cp_enum_find(&espcamera_frame_size_type, common_hal_espcamera_camera_get_frame_size(self)); +} +STATIC MP_DEFINE_CONST_FUN_OBJ_1(espcamera_camera_get_frame_size_obj, espcamera_camera_get_frame_size); + +MP_PROPERTY_GETTER(espcamera_camera_frame_size_obj, + (mp_obj_t)&espcamera_camera_get_frame_size_obj); + +//| contrast: int +//| """The sensor contrast. Positive values increase contrast, negative values lower it. The total range is device-specific but is often from -2 to +2 inclusive.""" + +STATIC mp_obj_t espcamera_camera_get_contrast(const mp_obj_t self_in) { + espcamera_camera_obj_t *self = MP_OBJ_TO_PTR(self_in); + check_for_deinit(self); + return MP_OBJ_NEW_SMALL_INT(common_hal_espcamera_camera_get_contrast(self)); +} +STATIC MP_DEFINE_CONST_FUN_OBJ_1(espcamera_camera_get_contrast_obj, espcamera_camera_get_contrast); + +STATIC mp_obj_t espcamera_camera_set_contrast(const mp_obj_t self_in, const mp_obj_t arg) { + espcamera_camera_obj_t *self = MP_OBJ_TO_PTR(self_in); + check_for_deinit(self); + common_hal_espcamera_camera_set_contrast(self, mp_obj_get_int(arg)); + return mp_const_none; +} +STATIC MP_DEFINE_CONST_FUN_OBJ_2(espcamera_camera_set_contrast_obj, espcamera_camera_set_contrast); +MP_PROPERTY_GETSET(espcamera_camera_contrast_obj, + (mp_obj_t)&espcamera_camera_get_contrast_obj, + (mp_obj_t)&espcamera_camera_set_contrast_obj); + +//| brightness: int +//| """The sensor brightness. Positive values increase brightness, negative values lower it. The total range is device-specific but is often from -2 to +2 inclusive.""" + +STATIC mp_obj_t espcamera_camera_get_brightness(const mp_obj_t self_in) { + espcamera_camera_obj_t *self = MP_OBJ_TO_PTR(self_in); + check_for_deinit(self); + return MP_OBJ_NEW_SMALL_INT(common_hal_espcamera_camera_get_brightness(self)); +} +STATIC MP_DEFINE_CONST_FUN_OBJ_1(espcamera_camera_get_brightness_obj, espcamera_camera_get_brightness); + +STATIC mp_obj_t espcamera_camera_set_brightness(const mp_obj_t self_in, const mp_obj_t arg) { + espcamera_camera_obj_t *self = MP_OBJ_TO_PTR(self_in); + check_for_deinit(self); + common_hal_espcamera_camera_set_brightness(self, mp_obj_get_int(arg)); + return mp_const_none; +} +STATIC MP_DEFINE_CONST_FUN_OBJ_2(espcamera_camera_set_brightness_obj, espcamera_camera_set_brightness); +MP_PROPERTY_GETSET(espcamera_camera_brightness_obj, + (mp_obj_t)&espcamera_camera_get_brightness_obj, + (mp_obj_t)&espcamera_camera_set_brightness_obj); + +//| saturation: int +//| """The sensor saturation. Positive values increase saturation (more vibrant colors), negative values lower it (more muted colors). The total range is device-specific but the value is often from -2 to +2 inclusive.""" + +STATIC mp_obj_t espcamera_camera_get_saturation(const mp_obj_t self_in) { + espcamera_camera_obj_t *self = MP_OBJ_TO_PTR(self_in); + check_for_deinit(self); + return MP_OBJ_NEW_SMALL_INT(common_hal_espcamera_camera_get_saturation(self)); +} +STATIC MP_DEFINE_CONST_FUN_OBJ_1(espcamera_camera_get_saturation_obj, espcamera_camera_get_saturation); + +STATIC mp_obj_t espcamera_camera_set_saturation(const mp_obj_t self_in, const mp_obj_t arg) { + espcamera_camera_obj_t *self = MP_OBJ_TO_PTR(self_in); + check_for_deinit(self); + common_hal_espcamera_camera_set_saturation(self, mp_obj_get_int(arg)); + return mp_const_none; +} +STATIC MP_DEFINE_CONST_FUN_OBJ_2(espcamera_camera_set_saturation_obj, espcamera_camera_set_saturation); +MP_PROPERTY_GETSET(espcamera_camera_saturation_obj, + (mp_obj_t)&espcamera_camera_get_saturation_obj, + (mp_obj_t)&espcamera_camera_set_saturation_obj); + +//| sharpness: int +//| """The sensor sharpness. Positive values increase sharpness (more defined edges), negative values lower it (softer edges). The total range is device-specific but the value is often from -2 to +2 inclusive.""" + +STATIC mp_obj_t espcamera_camera_get_sharpness(const mp_obj_t self_in) { + espcamera_camera_obj_t *self = MP_OBJ_TO_PTR(self_in); + check_for_deinit(self); + return MP_OBJ_NEW_SMALL_INT(common_hal_espcamera_camera_get_sharpness(self)); +} +STATIC MP_DEFINE_CONST_FUN_OBJ_1(espcamera_camera_get_sharpness_obj, espcamera_camera_get_sharpness); + +STATIC mp_obj_t espcamera_camera_set_sharpness(const mp_obj_t self_in, const mp_obj_t arg) { + espcamera_camera_obj_t *self = MP_OBJ_TO_PTR(self_in); + check_for_deinit(self); + common_hal_espcamera_camera_set_sharpness(self, mp_obj_get_int(arg)); + return mp_const_none; +} +STATIC MP_DEFINE_CONST_FUN_OBJ_2(espcamera_camera_set_sharpness_obj, espcamera_camera_set_sharpness); +MP_PROPERTY_GETSET(espcamera_camera_sharpness_obj, + (mp_obj_t)&espcamera_camera_get_sharpness_obj, + (mp_obj_t)&espcamera_camera_set_sharpness_obj); + +//| denoise: int +//| """The sensor 'denoise' setting. Any camera sensor has inherent 'noise', especially in low brightness environments. Software algorithms can decrease noise at the expense of fine detail. A larger value increases the amount of software noise removal. The total range is device-specific but the value is often from 0 to 10.""" + +STATIC mp_obj_t espcamera_camera_get_denoise(const mp_obj_t self_in) { + espcamera_camera_obj_t *self = MP_OBJ_TO_PTR(self_in); + check_for_deinit(self); + return MP_OBJ_NEW_SMALL_INT(common_hal_espcamera_camera_get_denoise(self)); +} +STATIC MP_DEFINE_CONST_FUN_OBJ_1(espcamera_camera_get_denoise_obj, espcamera_camera_get_denoise); + +STATIC mp_obj_t espcamera_camera_set_denoise(const mp_obj_t self_in, const mp_obj_t arg) { + espcamera_camera_obj_t *self = MP_OBJ_TO_PTR(self_in); + check_for_deinit(self); + common_hal_espcamera_camera_set_denoise(self, mp_obj_get_int(arg)); + return mp_const_none; +} +STATIC MP_DEFINE_CONST_FUN_OBJ_2(espcamera_camera_set_denoise_obj, espcamera_camera_set_denoise); +MP_PROPERTY_GETSET(espcamera_camera_denoise_obj, + (mp_obj_t)&espcamera_camera_get_denoise_obj, + (mp_obj_t)&espcamera_camera_set_denoise_obj); + +//| gain_ceiling: GainCeiling +//| """The sensor 'gain ceiling' setting. "Gain" is an analog multiplier applied to the raw sensor data. The 'ceiling' is the maximum gain value that the sensor will use. A higher gain means that the sensor has a greater response to light, but also makes sensor noise more visible.""" + +STATIC mp_obj_t espcamera_camera_get_gain_ceiling(const mp_obj_t self_in) { + espcamera_camera_obj_t *self = MP_OBJ_TO_PTR(self_in); + check_for_deinit(self); + return cp_enum_find(&espcamera_gain_ceiling_type, common_hal_espcamera_camera_get_gainceiling(self)); +} +STATIC MP_DEFINE_CONST_FUN_OBJ_1(espcamera_camera_get_gain_ceiling_obj, espcamera_camera_get_gain_ceiling); + +STATIC mp_obj_t espcamera_camera_set_gain_ceiling(const mp_obj_t self_in, const mp_obj_t arg) { + espcamera_camera_obj_t *self = MP_OBJ_TO_PTR(self_in); + check_for_deinit(self); + common_hal_espcamera_camera_set_gainceiling(self, validate_gain_ceiling(arg, MP_QSTR_gain_ceiling)); + return mp_const_none; +} +STATIC MP_DEFINE_CONST_FUN_OBJ_2(espcamera_camera_set_gain_ceiling_obj, espcamera_camera_set_gain_ceiling); +MP_PROPERTY_GETSET(espcamera_camera_gain_ceiling_obj, + (mp_obj_t)&espcamera_camera_get_gain_ceiling_obj, + (mp_obj_t)&espcamera_camera_set_gain_ceiling_obj); + +//| quality: int +//| """The 'quality' setting when capturing JPEG images. This is similar to the quality setting when exporting a jpeg image from photo editing software. Typical values range from 5 to 40, with higher numbers leading to larger image sizes and better overall image quality. However, when the quality is set to a high number, the total size of the JPEG data can exceed the size of an internal buffer, causing image capture to fail.""" + +STATIC mp_obj_t espcamera_camera_get_quality(const mp_obj_t self_in) { + espcamera_camera_obj_t *self = MP_OBJ_TO_PTR(self_in); + check_for_deinit(self); + return MP_OBJ_NEW_SMALL_INT(common_hal_espcamera_camera_get_quality(self)); +} +STATIC MP_DEFINE_CONST_FUN_OBJ_1(espcamera_camera_get_quality_obj, espcamera_camera_get_quality); + +STATIC mp_obj_t espcamera_camera_set_quality(const mp_obj_t self_in, const mp_obj_t arg) { + espcamera_camera_obj_t *self = MP_OBJ_TO_PTR(self_in); + check_for_deinit(self); + common_hal_espcamera_camera_set_quality(self, mp_obj_get_int(arg)); + return mp_const_none; +} +STATIC MP_DEFINE_CONST_FUN_OBJ_2(espcamera_camera_set_quality_obj, espcamera_camera_set_quality); +MP_PROPERTY_GETSET(espcamera_camera_quality_obj, + (mp_obj_t)&espcamera_camera_get_quality_obj, + (mp_obj_t)&espcamera_camera_set_quality_obj); + +//| colorbar: bool +//| """When `True`, a test pattern image is captured and the real sensor data is not used.""" + +STATIC mp_obj_t espcamera_camera_get_colorbar(const mp_obj_t self_in) { + espcamera_camera_obj_t *self = MP_OBJ_TO_PTR(self_in); + check_for_deinit(self); + return mp_obj_new_bool(common_hal_espcamera_camera_get_colorbar(self)); +} +STATIC MP_DEFINE_CONST_FUN_OBJ_1(espcamera_camera_get_colorbar_obj, espcamera_camera_get_colorbar); + +STATIC mp_obj_t espcamera_camera_set_colorbar(const mp_obj_t self_in, const mp_obj_t arg) { + espcamera_camera_obj_t *self = MP_OBJ_TO_PTR(self_in); + check_for_deinit(self); + common_hal_espcamera_camera_set_colorbar(self, mp_obj_is_true(arg)); + return mp_const_none; +} +STATIC MP_DEFINE_CONST_FUN_OBJ_2(espcamera_camera_set_colorbar_obj, espcamera_camera_set_colorbar); +MP_PROPERTY_GETSET(espcamera_camera_colorbar_obj, + (mp_obj_t)&espcamera_camera_get_colorbar_obj, + (mp_obj_t)&espcamera_camera_set_colorbar_obj); + +//| whitebal: bool +//| """When `True`, the camera attempts to automatically control white balance. When `False`, the `wb_mode` setting is used instead.""" + +STATIC mp_obj_t espcamera_camera_get_whitebal(const mp_obj_t self_in) { + espcamera_camera_obj_t *self = MP_OBJ_TO_PTR(self_in); + check_for_deinit(self); + return mp_obj_new_bool(common_hal_espcamera_camera_get_whitebal(self)); +} +STATIC MP_DEFINE_CONST_FUN_OBJ_1(espcamera_camera_get_whitebal_obj, espcamera_camera_get_whitebal); + +STATIC mp_obj_t espcamera_camera_set_whitebal(const mp_obj_t self_in, const mp_obj_t arg) { + espcamera_camera_obj_t *self = MP_OBJ_TO_PTR(self_in); + check_for_deinit(self); + common_hal_espcamera_camera_set_whitebal(self, mp_obj_is_true(arg)); + return mp_const_none; +} +STATIC MP_DEFINE_CONST_FUN_OBJ_2(espcamera_camera_set_whitebal_obj, espcamera_camera_set_whitebal); +MP_PROPERTY_GETSET(espcamera_camera_whitebal_obj, + (mp_obj_t)&espcamera_camera_get_whitebal_obj, + (mp_obj_t)&espcamera_camera_set_whitebal_obj); + +//| gain_ctrl: bool +//| """When `True`, the camera attempts to automatically control the sensor gain, up to the value in the `gain_ceiling` property. When `False`, the `agc_gain` setting is used instead.""" + +STATIC mp_obj_t espcamera_camera_get_gain_ctrl(const mp_obj_t self_in) { + espcamera_camera_obj_t *self = MP_OBJ_TO_PTR(self_in); + check_for_deinit(self); + return mp_obj_new_bool(common_hal_espcamera_camera_get_gain_ctrl(self)); +} +STATIC MP_DEFINE_CONST_FUN_OBJ_1(espcamera_camera_get_gain_ctrl_obj, espcamera_camera_get_gain_ctrl); + +STATIC mp_obj_t espcamera_camera_set_gain_ctrl(const mp_obj_t self_in, const mp_obj_t arg) { + espcamera_camera_obj_t *self = MP_OBJ_TO_PTR(self_in); + check_for_deinit(self); + common_hal_espcamera_camera_set_gain_ctrl(self, mp_obj_is_true(arg)); + return mp_const_none; +} +STATIC MP_DEFINE_CONST_FUN_OBJ_2(espcamera_camera_set_gain_ctrl_obj, espcamera_camera_set_gain_ctrl); +MP_PROPERTY_GETSET(espcamera_camera_gain_ctrl_obj, + (mp_obj_t)&espcamera_camera_get_gain_ctrl_obj, + (mp_obj_t)&espcamera_camera_set_gain_ctrl_obj); + +//| exposure_ctrl: bool +//| """When `True` the camera attempts to automatically control the exposure. When `False`, the `aec_value` setting is used instead.""" + +STATIC mp_obj_t espcamera_camera_get_exposure_ctrl(const mp_obj_t self_in) { + espcamera_camera_obj_t *self = MP_OBJ_TO_PTR(self_in); + check_for_deinit(self); + return mp_obj_new_bool(common_hal_espcamera_camera_get_exposure_ctrl(self)); +} +STATIC MP_DEFINE_CONST_FUN_OBJ_1(espcamera_camera_get_exposure_ctrl_obj, espcamera_camera_get_exposure_ctrl); + +STATIC mp_obj_t espcamera_camera_set_exposure_ctrl(const mp_obj_t self_in, const mp_obj_t arg) { + espcamera_camera_obj_t *self = MP_OBJ_TO_PTR(self_in); + check_for_deinit(self); + common_hal_espcamera_camera_set_exposure_ctrl(self, mp_obj_is_true(arg)); + return mp_const_none; +} +STATIC MP_DEFINE_CONST_FUN_OBJ_2(espcamera_camera_set_exposure_ctrl_obj, espcamera_camera_set_exposure_ctrl); +MP_PROPERTY_GETSET(espcamera_camera_exposure_ctrl_obj, + (mp_obj_t)&espcamera_camera_get_exposure_ctrl_obj, + (mp_obj_t)&espcamera_camera_set_exposure_ctrl_obj); + +//| hmirror: bool +//| """When `True` the camera image is mirrored left-to-right""" + +STATIC mp_obj_t espcamera_camera_get_hmirror(const mp_obj_t self_in) { + espcamera_camera_obj_t *self = MP_OBJ_TO_PTR(self_in); + check_for_deinit(self); + return mp_obj_new_bool(common_hal_espcamera_camera_get_hmirror(self)); +} +STATIC MP_DEFINE_CONST_FUN_OBJ_1(espcamera_camera_get_hmirror_obj, espcamera_camera_get_hmirror); + +STATIC mp_obj_t espcamera_camera_set_hmirror(const mp_obj_t self_in, const mp_obj_t arg) { + espcamera_camera_obj_t *self = MP_OBJ_TO_PTR(self_in); + check_for_deinit(self); + common_hal_espcamera_camera_set_hmirror(self, mp_obj_is_true(arg)); + return mp_const_none; +} +STATIC MP_DEFINE_CONST_FUN_OBJ_2(espcamera_camera_set_hmirror_obj, espcamera_camera_set_hmirror); +MP_PROPERTY_GETSET(espcamera_camera_hmirror_obj, + (mp_obj_t)&espcamera_camera_get_hmirror_obj, + (mp_obj_t)&espcamera_camera_set_hmirror_obj); + +//| vflip: bool +//| """When `True` the camera image is flipped top-to-bottom""" + +STATIC mp_obj_t espcamera_camera_get_vflip(const mp_obj_t self_in) { + espcamera_camera_obj_t *self = MP_OBJ_TO_PTR(self_in); + check_for_deinit(self); + return mp_obj_new_bool(common_hal_espcamera_camera_get_vflip(self)); +} +STATIC MP_DEFINE_CONST_FUN_OBJ_1(espcamera_camera_get_vflip_obj, espcamera_camera_get_vflip); + +STATIC mp_obj_t espcamera_camera_set_vflip(const mp_obj_t self_in, const mp_obj_t arg) { + espcamera_camera_obj_t *self = MP_OBJ_TO_PTR(self_in); + check_for_deinit(self); + common_hal_espcamera_camera_set_vflip(self, mp_obj_is_true(arg)); + return mp_const_none; +} +STATIC MP_DEFINE_CONST_FUN_OBJ_2(espcamera_camera_set_vflip_obj, espcamera_camera_set_vflip); +MP_PROPERTY_GETSET(espcamera_camera_vflip_obj, + (mp_obj_t)&espcamera_camera_get_vflip_obj, + (mp_obj_t)&espcamera_camera_set_vflip_obj); + +//| aec2: bool +//| """When `True` the sensor's "night mode" is enabled, extending the range of automatic gain control.""" + +STATIC mp_obj_t espcamera_camera_get_aec2(const mp_obj_t self_in) { + espcamera_camera_obj_t *self = MP_OBJ_TO_PTR(self_in); + check_for_deinit(self); + return mp_obj_new_bool(common_hal_espcamera_camera_get_aec2(self)); +} +STATIC MP_DEFINE_CONST_FUN_OBJ_1(espcamera_camera_get_aec2_obj, espcamera_camera_get_aec2); + +STATIC mp_obj_t espcamera_camera_set_aec2(const mp_obj_t self_in, const mp_obj_t arg) { + espcamera_camera_obj_t *self = MP_OBJ_TO_PTR(self_in); + check_for_deinit(self); + common_hal_espcamera_camera_set_aec2(self, mp_obj_is_true(arg)); + return mp_const_none; +} +STATIC MP_DEFINE_CONST_FUN_OBJ_2(espcamera_camera_set_aec2_obj, espcamera_camera_set_aec2); +MP_PROPERTY_GETSET(espcamera_camera_aec2_obj, + (mp_obj_t)&espcamera_camera_get_aec2_obj, + (mp_obj_t)&espcamera_camera_set_aec2_obj); + +//| awb_gain: bool +//| """Access the awb_gain property of the camera sensor""" + +STATIC mp_obj_t espcamera_camera_get_awb_gain(const mp_obj_t self_in) { + espcamera_camera_obj_t *self = MP_OBJ_TO_PTR(self_in); + check_for_deinit(self); + return mp_obj_new_bool(common_hal_espcamera_camera_get_awb_gain(self)); +} +STATIC MP_DEFINE_CONST_FUN_OBJ_1(espcamera_camera_get_awb_gain_obj, espcamera_camera_get_awb_gain); + +STATIC mp_obj_t espcamera_camera_set_awb_gain(const mp_obj_t self_in, const mp_obj_t arg) { + espcamera_camera_obj_t *self = MP_OBJ_TO_PTR(self_in); + check_for_deinit(self); + common_hal_espcamera_camera_set_awb_gain(self, mp_obj_is_true(arg)); + return mp_const_none; +} +STATIC MP_DEFINE_CONST_FUN_OBJ_2(espcamera_camera_set_awb_gain_obj, espcamera_camera_set_awb_gain); +MP_PROPERTY_GETSET(espcamera_camera_awb_gain_obj, + (mp_obj_t)&espcamera_camera_get_awb_gain_obj, + (mp_obj_t)&espcamera_camera_set_awb_gain_obj); + +//| agc_gain: int +//| """Access the gain level of the sensor. Higher values produce brighter images. Typical settings range from 0 to 30. """ + +STATIC mp_obj_t espcamera_camera_get_agc_gain(const mp_obj_t self_in) { + espcamera_camera_obj_t *self = MP_OBJ_TO_PTR(self_in); + check_for_deinit(self); + return MP_OBJ_NEW_SMALL_INT(common_hal_espcamera_camera_get_agc_gain(self)); +} +STATIC MP_DEFINE_CONST_FUN_OBJ_1(espcamera_camera_get_agc_gain_obj, espcamera_camera_get_agc_gain); + +STATIC mp_obj_t espcamera_camera_set_agc_gain(const mp_obj_t self_in, const mp_obj_t arg) { + espcamera_camera_obj_t *self = MP_OBJ_TO_PTR(self_in); + check_for_deinit(self); + common_hal_espcamera_camera_set_agc_gain(self, mp_obj_get_int(arg)); + return mp_const_none; +} +STATIC MP_DEFINE_CONST_FUN_OBJ_2(espcamera_camera_set_agc_gain_obj, espcamera_camera_set_agc_gain); +MP_PROPERTY_GETSET(espcamera_camera_agc_gain_obj, + (mp_obj_t)&espcamera_camera_get_agc_gain_obj, + (mp_obj_t)&espcamera_camera_set_agc_gain_obj); + +//| aec_value: int +//| """Access the exposure value of the camera. Higher values produce brighter images. Typical settings range from 0 to 1200.""" + +STATIC mp_obj_t espcamera_camera_get_aec_value(const mp_obj_t self_in) { + espcamera_camera_obj_t *self = MP_OBJ_TO_PTR(self_in); + check_for_deinit(self); + return MP_OBJ_NEW_SMALL_INT(common_hal_espcamera_camera_get_aec_value(self)); +} +STATIC MP_DEFINE_CONST_FUN_OBJ_1(espcamera_camera_get_aec_value_obj, espcamera_camera_get_aec_value); + +STATIC mp_obj_t espcamera_camera_set_aec_value(const mp_obj_t self_in, const mp_obj_t arg) { + espcamera_camera_obj_t *self = MP_OBJ_TO_PTR(self_in); + check_for_deinit(self); + common_hal_espcamera_camera_set_aec_value(self, mp_obj_get_int(arg)); + return mp_const_none; +} +STATIC MP_DEFINE_CONST_FUN_OBJ_2(espcamera_camera_set_aec_value_obj, espcamera_camera_set_aec_value); +MP_PROPERTY_GETSET(espcamera_camera_aec_value_obj, + (mp_obj_t)&espcamera_camera_get_aec_value_obj, + (mp_obj_t)&espcamera_camera_set_aec_value_obj); + +//| special_effect: int +//| """Enable a "special effect". Zero is no special effect. On OV5640, special effects range from 0 to 6 inclusive and select various color modes.""" + +STATIC mp_obj_t espcamera_camera_get_special_effect(const mp_obj_t self_in) { + espcamera_camera_obj_t *self = MP_OBJ_TO_PTR(self_in); + check_for_deinit(self); + return MP_OBJ_NEW_SMALL_INT(common_hal_espcamera_camera_get_special_effect(self)); +} +STATIC MP_DEFINE_CONST_FUN_OBJ_1(espcamera_camera_get_special_effect_obj, espcamera_camera_get_special_effect); + +STATIC mp_obj_t espcamera_camera_set_special_effect(const mp_obj_t self_in, const mp_obj_t arg) { + espcamera_camera_obj_t *self = MP_OBJ_TO_PTR(self_in); + check_for_deinit(self); + common_hal_espcamera_camera_set_special_effect(self, mp_obj_get_int(arg)); + return mp_const_none; +} +STATIC MP_DEFINE_CONST_FUN_OBJ_2(espcamera_camera_set_special_effect_obj, espcamera_camera_set_special_effect); +MP_PROPERTY_GETSET(espcamera_camera_special_effect_obj, + (mp_obj_t)&espcamera_camera_get_special_effect_obj, + (mp_obj_t)&espcamera_camera_set_special_effect_obj); + +//| wb_mode: int +//| """The white balance mode. 0 is automatic white balance. Typical values range from 0 to 4 inclusive.""" + +STATIC mp_obj_t espcamera_camera_get_wb_mode(const mp_obj_t self_in) { + espcamera_camera_obj_t *self = MP_OBJ_TO_PTR(self_in); + check_for_deinit(self); + return MP_OBJ_NEW_SMALL_INT(common_hal_espcamera_camera_get_wb_mode(self)); +} +STATIC MP_DEFINE_CONST_FUN_OBJ_1(espcamera_camera_get_wb_mode_obj, espcamera_camera_get_wb_mode); + +STATIC mp_obj_t espcamera_camera_set_wb_mode(const mp_obj_t self_in, const mp_obj_t arg) { + espcamera_camera_obj_t *self = MP_OBJ_TO_PTR(self_in); + check_for_deinit(self); + common_hal_espcamera_camera_set_wb_mode(self, mp_obj_get_int(arg)); + return mp_const_none; +} +STATIC MP_DEFINE_CONST_FUN_OBJ_2(espcamera_camera_set_wb_mode_obj, espcamera_camera_set_wb_mode); +MP_PROPERTY_GETSET(espcamera_camera_wb_mode_obj, + (mp_obj_t)&espcamera_camera_get_wb_mode_obj, + (mp_obj_t)&espcamera_camera_set_wb_mode_obj); + +//| ae_level: int +//| """The exposure offset for automatic exposure. Typical values range from -2 to +2.""" + +STATIC mp_obj_t espcamera_camera_get_ae_level(const mp_obj_t self_in) { + espcamera_camera_obj_t *self = MP_OBJ_TO_PTR(self_in); + check_for_deinit(self); + return MP_OBJ_NEW_SMALL_INT(common_hal_espcamera_camera_get_ae_level(self)); +} +STATIC MP_DEFINE_CONST_FUN_OBJ_1(espcamera_camera_get_ae_level_obj, espcamera_camera_get_ae_level); + +STATIC mp_obj_t espcamera_camera_set_ae_level(const mp_obj_t self_in, const mp_obj_t arg) { + espcamera_camera_obj_t *self = MP_OBJ_TO_PTR(self_in); + check_for_deinit(self); + common_hal_espcamera_camera_set_ae_level(self, mp_obj_get_int(arg)); + return mp_const_none; +} +STATIC MP_DEFINE_CONST_FUN_OBJ_2(espcamera_camera_set_ae_level_obj, espcamera_camera_set_ae_level); +MP_PROPERTY_GETSET(espcamera_camera_ae_level_obj, + (mp_obj_t)&espcamera_camera_get_ae_level_obj, + (mp_obj_t)&espcamera_camera_set_ae_level_obj); + +//| dcw: bool +//| """When `True` an advanced white balance mode is selected.""" + +STATIC mp_obj_t espcamera_camera_get_dcw(const mp_obj_t self_in) { + espcamera_camera_obj_t *self = MP_OBJ_TO_PTR(self_in); + check_for_deinit(self); + return mp_obj_new_bool(common_hal_espcamera_camera_get_dcw(self)); +} +STATIC MP_DEFINE_CONST_FUN_OBJ_1(espcamera_camera_get_dcw_obj, espcamera_camera_get_dcw); + +STATIC mp_obj_t espcamera_camera_set_dcw(const mp_obj_t self_in, const mp_obj_t arg) { + espcamera_camera_obj_t *self = MP_OBJ_TO_PTR(self_in); + check_for_deinit(self); + common_hal_espcamera_camera_set_dcw(self, mp_obj_is_true(arg)); + return mp_const_none; +} +STATIC MP_DEFINE_CONST_FUN_OBJ_2(espcamera_camera_set_dcw_obj, espcamera_camera_set_dcw); +MP_PROPERTY_GETSET(espcamera_camera_dcw_obj, + (mp_obj_t)&espcamera_camera_get_dcw_obj, + (mp_obj_t)&espcamera_camera_set_dcw_obj); + +//| bpc: bool +//| """When `True`, "black point compensation" is enabled. This can make black parts of the image darker.""" + +STATIC mp_obj_t espcamera_camera_get_bpc(const mp_obj_t self_in) { + espcamera_camera_obj_t *self = MP_OBJ_TO_PTR(self_in); + check_for_deinit(self); + return mp_obj_new_bool(common_hal_espcamera_camera_get_bpc(self)); +} +STATIC MP_DEFINE_CONST_FUN_OBJ_1(espcamera_camera_get_bpc_obj, espcamera_camera_get_bpc); + +STATIC mp_obj_t espcamera_camera_set_bpc(const mp_obj_t self_in, const mp_obj_t arg) { + espcamera_camera_obj_t *self = MP_OBJ_TO_PTR(self_in); + check_for_deinit(self); + common_hal_espcamera_camera_set_bpc(self, mp_obj_is_true(arg)); + return mp_const_none; +} +STATIC MP_DEFINE_CONST_FUN_OBJ_2(espcamera_camera_set_bpc_obj, espcamera_camera_set_bpc); +MP_PROPERTY_GETSET(espcamera_camera_bpc_obj, + (mp_obj_t)&espcamera_camera_get_bpc_obj, + (mp_obj_t)&espcamera_camera_set_bpc_obj); + +//| wpc: bool +//| """When `True`, "white point compensation" is enabled. This can make white parts of the image whiter.""" + +STATIC mp_obj_t espcamera_camera_get_wpc(const mp_obj_t self_in) { + espcamera_camera_obj_t *self = MP_OBJ_TO_PTR(self_in); + check_for_deinit(self); + return mp_obj_new_bool(common_hal_espcamera_camera_get_wpc(self)); +} +STATIC MP_DEFINE_CONST_FUN_OBJ_1(espcamera_camera_get_wpc_obj, espcamera_camera_get_wpc); + +STATIC mp_obj_t espcamera_camera_set_wpc(const mp_obj_t self_in, const mp_obj_t arg) { + espcamera_camera_obj_t *self = MP_OBJ_TO_PTR(self_in); + check_for_deinit(self); + common_hal_espcamera_camera_set_wpc(self, mp_obj_is_true(arg)); + return mp_const_none; +} +STATIC MP_DEFINE_CONST_FUN_OBJ_2(espcamera_camera_set_wpc_obj, espcamera_camera_set_wpc); +MP_PROPERTY_GETSET(espcamera_camera_wpc_obj, + (mp_obj_t)&espcamera_camera_get_wpc_obj, + (mp_obj_t)&espcamera_camera_set_wpc_obj); + +//| raw_gma: bool +//| """When `True`, raw gamma mode is enabled.""" + +STATIC mp_obj_t espcamera_camera_get_raw_gma(const mp_obj_t self_in) { + espcamera_camera_obj_t *self = MP_OBJ_TO_PTR(self_in); + check_for_deinit(self); + return mp_obj_new_bool(common_hal_espcamera_camera_get_raw_gma(self)); +} +STATIC MP_DEFINE_CONST_FUN_OBJ_1(espcamera_camera_get_raw_gma_obj, espcamera_camera_get_raw_gma); + +STATIC mp_obj_t espcamera_camera_set_raw_gma(const mp_obj_t self_in, const mp_obj_t arg) { + espcamera_camera_obj_t *self = MP_OBJ_TO_PTR(self_in); + check_for_deinit(self); + common_hal_espcamera_camera_set_raw_gma(self, mp_obj_is_true(arg)); + return mp_const_none; +} +STATIC MP_DEFINE_CONST_FUN_OBJ_2(espcamera_camera_set_raw_gma_obj, espcamera_camera_set_raw_gma); +MP_PROPERTY_GETSET(espcamera_camera_raw_gma_obj, + (mp_obj_t)&espcamera_camera_get_raw_gma_obj, + (mp_obj_t)&espcamera_camera_set_raw_gma_obj); + +//| lenc: bool +//| """Enable "lens correction". This can help compensate for light fall-off at the edge of the sensor area.""" + +STATIC mp_obj_t espcamera_camera_get_lenc(const mp_obj_t self_in) { + espcamera_camera_obj_t *self = MP_OBJ_TO_PTR(self_in); + check_for_deinit(self); + return mp_obj_new_bool(common_hal_espcamera_camera_get_lenc(self)); +} +STATIC MP_DEFINE_CONST_FUN_OBJ_1(espcamera_camera_get_lenc_obj, espcamera_camera_get_lenc); + +STATIC mp_obj_t espcamera_camera_set_lenc(const mp_obj_t self_in, const mp_obj_t arg) { + espcamera_camera_obj_t *self = MP_OBJ_TO_PTR(self_in); + check_for_deinit(self); + common_hal_espcamera_camera_set_lenc(self, mp_obj_is_true(arg)); + return mp_const_none; +} +STATIC MP_DEFINE_CONST_FUN_OBJ_2(espcamera_camera_set_lenc_obj, espcamera_camera_set_lenc); +MP_PROPERTY_GETSET(espcamera_camera_lenc_obj, + (mp_obj_t)&espcamera_camera_get_lenc_obj, + (mp_obj_t)&espcamera_camera_set_lenc_obj); + +//| max_frame_size: FrameSize +//| """The maximum frame size that can be captured""" +STATIC mp_obj_t espcamera_camera_get_max_frame_size(const mp_obj_t self_in) { + espcamera_camera_obj_t *self = MP_OBJ_TO_PTR(self_in); + check_for_deinit(self); + return cp_enum_find(&espcamera_frame_size_type, common_hal_espcamera_camera_get_max_frame_size(self)); +} +STATIC MP_DEFINE_CONST_FUN_OBJ_1(espcamera_camera_get_max_frame_size_obj, espcamera_camera_get_max_frame_size); + +MP_PROPERTY_GETTER(espcamera_camera_max_frame_size_obj, + (mp_obj_t)&espcamera_camera_get_max_frame_size_obj); + + +//| address: int +//| """The I2C (SCCB) address of the sensor""" +STATIC mp_obj_t espcamera_camera_get_address(const mp_obj_t self_in) { + espcamera_camera_obj_t *self = MP_OBJ_TO_PTR(self_in); + check_for_deinit(self); + return MP_OBJ_NEW_SMALL_INT(common_hal_espcamera_camera_get_address(self)); +} +STATIC MP_DEFINE_CONST_FUN_OBJ_1(espcamera_camera_get_address_obj, espcamera_camera_get_address); + +MP_PROPERTY_GETTER(espcamera_camera_address_obj, + (mp_obj_t)&espcamera_camera_get_address_obj); + + +//| sensor_name: str +//| """The name of the sensor""" +STATIC mp_obj_t espcamera_camera_get_sensor_name(const mp_obj_t self_in) { + espcamera_camera_obj_t *self = MP_OBJ_TO_PTR(self_in); + check_for_deinit(self); + const char *sensor_name = common_hal_espcamera_camera_get_sensor_name(self); + return mp_obj_new_str(sensor_name, strlen(sensor_name)); +} +STATIC MP_DEFINE_CONST_FUN_OBJ_1(espcamera_camera_get_sensor_name_obj, espcamera_camera_get_sensor_name); + +MP_PROPERTY_GETTER(espcamera_camera_sensor_name_obj, + (mp_obj_t)&espcamera_camera_get_sensor_name_obj); + + +//| supports_jpeg: bool +//| """True if the sensor can capture images in JPEG format""" +STATIC mp_obj_t espcamera_camera_get_supports_jpeg(const mp_obj_t self_in) { + espcamera_camera_obj_t *self = MP_OBJ_TO_PTR(self_in); + check_for_deinit(self); + return mp_obj_new_bool(common_hal_espcamera_camera_get_supports_jpeg(self)); +} +STATIC MP_DEFINE_CONST_FUN_OBJ_1(espcamera_camera_get_supports_jpeg_obj, espcamera_camera_get_supports_jpeg); + +MP_PROPERTY_GETTER(espcamera_camera_supports_jpeg_obj, + (mp_obj_t)&espcamera_camera_get_supports_jpeg_obj); + +//| height: int +//| """The height of the image being captured""" +STATIC mp_obj_t espcamera_camera_get_height(const mp_obj_t self_in) { + espcamera_camera_obj_t *self = MP_OBJ_TO_PTR(self_in); + check_for_deinit(self); + return MP_OBJ_NEW_SMALL_INT(common_hal_espcamera_camera_get_height(self)); +} +STATIC MP_DEFINE_CONST_FUN_OBJ_1(espcamera_camera_get_height_obj, espcamera_camera_get_height); + +MP_PROPERTY_GETTER(espcamera_camera_height_obj, + (mp_obj_t)&espcamera_camera_get_height_obj); + +//| width: int +//| """The width of the image being captured""" +STATIC mp_obj_t espcamera_camera_get_width(const mp_obj_t self_in) { + espcamera_camera_obj_t *self = MP_OBJ_TO_PTR(self_in); + check_for_deinit(self); + return MP_OBJ_NEW_SMALL_INT(common_hal_espcamera_camera_get_width(self)); +} +STATIC MP_DEFINE_CONST_FUN_OBJ_1(espcamera_camera_get_width_obj, espcamera_camera_get_width); + +MP_PROPERTY_GETTER(espcamera_camera_width_obj, + (mp_obj_t)&espcamera_camera_get_width_obj); + +//| grab_mode: GrabMode +//| """The grab mode of the camera""" +STATIC mp_obj_t espcamera_camera_get_grab_mode(const mp_obj_t self_in) { + espcamera_camera_obj_t *self = MP_OBJ_TO_PTR(self_in); + check_for_deinit(self); + return cp_enum_find(&espcamera_grab_mode_type, common_hal_espcamera_camera_get_grab_mode(self)); +} +STATIC MP_DEFINE_CONST_FUN_OBJ_1(espcamera_camera_get_grab_mode_obj, espcamera_camera_get_grab_mode); + +MP_PROPERTY_GETTER(espcamera_camera_grab_mode_obj, + (mp_obj_t)&espcamera_camera_get_grab_mode_obj); + + +//| framebuffer_count: int +//| """True if double buffering is used""" +//| +STATIC mp_obj_t espcamera_camera_get_framebuffer_count(const mp_obj_t self_in) { + espcamera_camera_obj_t *self = MP_OBJ_TO_PTR(self_in); + check_for_deinit(self); + return MP_OBJ_NEW_SMALL_INT(common_hal_espcamera_camera_get_framebuffer_count(self)); +} +STATIC MP_DEFINE_CONST_FUN_OBJ_1(espcamera_camera_get_framebuffer_count_obj, espcamera_camera_get_framebuffer_count); + +MP_PROPERTY_GETTER(espcamera_camera_framebuffer_count_obj, + (mp_obj_t)&espcamera_camera_get_framebuffer_count_obj); + + +STATIC const mp_rom_map_elem_t espcamera_camera_locals_table[] = { + { MP_ROM_QSTR(MP_QSTR_address), MP_ROM_PTR(&espcamera_camera_address_obj) }, + { MP_ROM_QSTR(MP_QSTR_aec2), MP_ROM_PTR(&espcamera_camera_aec2_obj) }, + { MP_ROM_QSTR(MP_QSTR_aec_value), MP_ROM_PTR(&espcamera_camera_aec_value_obj) }, + { MP_ROM_QSTR(MP_QSTR_ae_level), MP_ROM_PTR(&espcamera_camera_ae_level_obj) }, + { MP_ROM_QSTR(MP_QSTR_agc_gain), MP_ROM_PTR(&espcamera_camera_agc_gain_obj) }, + { MP_ROM_QSTR(MP_QSTR_awb_gain), MP_ROM_PTR(&espcamera_camera_awb_gain_obj) }, + { MP_ROM_QSTR(MP_QSTR_bpc), MP_ROM_PTR(&espcamera_camera_bpc_obj) }, + { MP_ROM_QSTR(MP_QSTR_brightness), MP_ROM_PTR(&espcamera_camera_brightness_obj) }, + { MP_ROM_QSTR(MP_QSTR_colorbar), MP_ROM_PTR(&espcamera_camera_colorbar_obj) }, + { MP_ROM_QSTR(MP_QSTR_contrast), MP_ROM_PTR(&espcamera_camera_contrast_obj) }, + { MP_ROM_QSTR(MP_QSTR_dcw), MP_ROM_PTR(&espcamera_camera_dcw_obj) }, + { MP_ROM_QSTR(MP_QSTR_deinit), MP_ROM_PTR(&espcamera_camera_deinit_obj) }, + { MP_ROM_QSTR(MP_QSTR_denoise), MP_ROM_PTR(&espcamera_camera_denoise_obj) }, + { MP_ROM_QSTR(MP_QSTR_framebuffer_count), MP_ROM_PTR(&espcamera_camera_framebuffer_count_obj) }, + { MP_ROM_QSTR(MP_QSTR___enter__), MP_ROM_PTR(&mp_identity_obj) }, + { MP_ROM_QSTR(MP_QSTR___exit__), MP_ROM_PTR(&espcamera_camera___exit___obj) }, + { MP_ROM_QSTR(MP_QSTR_exposure_ctrl), MP_ROM_PTR(&espcamera_camera_exposure_ctrl_obj) }, + { MP_ROM_QSTR(MP_QSTR_frame_available), MP_ROM_PTR(&espcamera_camera_frame_available_obj) }, + { MP_ROM_QSTR(MP_QSTR_frame_size), MP_ROM_PTR(&espcamera_camera_frame_size_obj) }, + { MP_ROM_QSTR(MP_QSTR_gain_ceiling), MP_ROM_PTR(&espcamera_camera_gain_ceiling_obj) }, + { MP_ROM_QSTR(MP_QSTR_gain_ctrl), MP_ROM_PTR(&espcamera_camera_gain_ctrl_obj) }, + { MP_ROM_QSTR(MP_QSTR_grab_mode), MP_ROM_PTR(&espcamera_camera_grab_mode_obj) }, + { MP_ROM_QSTR(MP_QSTR_height), MP_ROM_PTR(&espcamera_camera_height_obj) }, + { MP_ROM_QSTR(MP_QSTR_hmirror), MP_ROM_PTR(&espcamera_camera_hmirror_obj) }, + { MP_ROM_QSTR(MP_QSTR_lenc), MP_ROM_PTR(&espcamera_camera_lenc_obj) }, + { MP_ROM_QSTR(MP_QSTR_max_frame_size), MP_ROM_PTR(&espcamera_camera_max_frame_size_obj) }, + { MP_ROM_QSTR(MP_QSTR_pixel_format), MP_ROM_PTR(&espcamera_camera_pixel_format_obj) }, + { MP_ROM_QSTR(MP_QSTR_quality), MP_ROM_PTR(&espcamera_camera_quality_obj) }, + { MP_ROM_QSTR(MP_QSTR_raw_gma), MP_ROM_PTR(&espcamera_camera_raw_gma_obj) }, + { MP_ROM_QSTR(MP_QSTR_reconfigure), MP_ROM_PTR(&espcamera_camera_reconfigure_obj) }, + { MP_ROM_QSTR(MP_QSTR_saturation), MP_ROM_PTR(&espcamera_camera_saturation_obj) }, + { MP_ROM_QSTR(MP_QSTR_sensor_name), MP_ROM_PTR(&espcamera_camera_sensor_name_obj) }, + { MP_ROM_QSTR(MP_QSTR_sharpness), MP_ROM_PTR(&espcamera_camera_sharpness_obj) }, + { MP_ROM_QSTR(MP_QSTR_special_effect), MP_ROM_PTR(&espcamera_camera_special_effect_obj) }, + { MP_ROM_QSTR(MP_QSTR_supports_jpeg), MP_ROM_PTR(&espcamera_camera_supports_jpeg_obj) }, + { MP_ROM_QSTR(MP_QSTR_take), MP_ROM_PTR(&espcamera_camera_take_obj) }, + { MP_ROM_QSTR(MP_QSTR_vflip), MP_ROM_PTR(&espcamera_camera_vflip_obj) }, + { MP_ROM_QSTR(MP_QSTR_wb_mode), MP_ROM_PTR(&espcamera_camera_wb_mode_obj) }, + { MP_ROM_QSTR(MP_QSTR_whitebal), MP_ROM_PTR(&espcamera_camera_whitebal_obj) }, + { MP_ROM_QSTR(MP_QSTR_width), MP_ROM_PTR(&espcamera_camera_width_obj) }, + { MP_ROM_QSTR(MP_QSTR_wpc), MP_ROM_PTR(&espcamera_camera_wpc_obj) }, +}; + +STATIC MP_DEFINE_CONST_DICT(espcamera_camera_locals_dict, espcamera_camera_locals_table); + +const mp_obj_type_t espcamera_camera_type = { + .base = { &mp_type_type }, + .name = MP_QSTR_Camera, + .make_new = espcamera_camera_make_new, + .locals_dict = (mp_obj_t)&espcamera_camera_locals_dict, +}; diff --git a/ports/espressif/bindings/esp32_camera/Camera.h b/ports/espressif/bindings/espcamera/Camera.h similarity index 72% rename from ports/espressif/bindings/esp32_camera/Camera.h rename to ports/espressif/bindings/espcamera/Camera.h index f190808531..c6d8182090 100644 --- a/ports/espressif/bindings/esp32_camera/Camera.h +++ b/ports/espressif/bindings/espcamera/Camera.h @@ -33,11 +33,11 @@ #include "shared-bindings/busio/I2C.h" -extern const mp_obj_type_t esp32_camera_camera_type; -typedef struct esp32_camera_camera_obj esp32_camera_camera_obj_t; +extern const mp_obj_type_t espcamera_camera_type; +typedef struct espcamera_camera_obj espcamera_camera_obj_t; -extern void common_hal_esp32_camera_camera_construct( - esp32_camera_camera_obj_t *self, +extern void common_hal_espcamera_camera_construct( + espcamera_camera_obj_t *self, uint8_t data_pins[8], const mcu_pin_obj_t *external_clock_pin, const mcu_pin_obj_t *pixel_clock_pin, @@ -53,11 +53,11 @@ extern void common_hal_esp32_camera_camera_construct( mp_int_t framebuffer_count, camera_grab_mode_t grab_mode); -extern void common_hal_esp32_camera_camera_deinit(esp32_camera_camera_obj_t *self); -extern bool common_hal_esp32_camera_camera_deinited(esp32_camera_camera_obj_t *self); -extern bool common_hal_esp32_camera_camera_available(esp32_camera_camera_obj_t *self); -extern camera_fb_t *common_hal_esp32_camera_camera_take(esp32_camera_camera_obj_t *self, int timeout_ms); -extern void common_hal_esp32_camera_camera_reconfigure(esp32_camera_camera_obj_t *self, framesize_t frame_size, pixformat_t pixel_format, camera_grab_mode_t grab_mode, mp_int_t framebuffer_count); +extern void common_hal_espcamera_camera_deinit(espcamera_camera_obj_t *self); +extern bool common_hal_espcamera_camera_deinited(espcamera_camera_obj_t *self); +extern bool common_hal_espcamera_camera_available(espcamera_camera_obj_t *self); +extern camera_fb_t *common_hal_espcamera_camera_take(espcamera_camera_obj_t *self, int timeout_ms); +extern void common_hal_espcamera_camera_reconfigure(espcamera_camera_obj_t *self, framesize_t frame_size, pixformat_t pixel_format, camera_grab_mode_t grab_mode, mp_int_t framebuffer_count); #define DECLARE_SENSOR_GETSET(type, name, field_name, setter_function_name) \ DECLARE_SENSOR_GET(type, name, field_name, setter_function_name) \ @@ -70,10 +70,10 @@ extern void common_hal_esp32_camera_camera_reconfigure(esp32_camera_camera_obj_t DECLARE_SENSOR_GET(type, name, status.status_field_name, setter_function_name) #define DECLARE_SENSOR_GET(type, name, status_field_name, setter_function_name) \ - extern type common_hal_esp32_camera_camera_get_##name(esp32_camera_camera_obj_t * self); + extern type common_hal_espcamera_camera_get_##name(espcamera_camera_obj_t * self); #define DECLARE_SENSOR_SET(type, name, setter_function_name) \ - extern void common_hal_esp32_camera_camera_set_##name(esp32_camera_camera_obj_t * self, type value); + extern void common_hal_espcamera_camera_set_##name(espcamera_camera_obj_t * self, type value); DECLARE_SENSOR_GET(pixformat_t, pixel_format, pixformat, set_pixformat) DECLARE_SENSOR_STATUS_GET(framesize_t, frame_size, framesize, set_framesize) @@ -104,13 +104,13 @@ DECLARE_SENSOR_STATUS_GETSET(bool, raw_gma, raw_gma, set_raw_gma); DECLARE_SENSOR_STATUS_GETSET(bool, lenc, lenc, set_lenc); // From settings -extern camera_grab_mode_t common_hal_esp32_camera_camera_get_grab_mode(esp32_camera_camera_obj_t *self); -extern int common_hal_esp32_camera_camera_get_framebuffer_count(esp32_camera_camera_obj_t *self); +extern camera_grab_mode_t common_hal_espcamera_camera_get_grab_mode(espcamera_camera_obj_t *self); +extern int common_hal_espcamera_camera_get_framebuffer_count(espcamera_camera_obj_t *self); // From camera_sensor_info_t -extern int common_hal_esp32_camera_camera_get_address(esp32_camera_camera_obj_t *self); -extern const char *common_hal_esp32_camera_camera_get_sensor_name(esp32_camera_camera_obj_t *self); -extern const bool common_hal_esp32_camera_camera_get_supports_jpeg(esp32_camera_camera_obj_t *self); -extern framesize_t common_hal_esp32_camera_camera_get_max_frame_size(esp32_camera_camera_obj_t *self); -extern int common_hal_esp32_camera_camera_get_width(esp32_camera_camera_obj_t *self); -extern int common_hal_esp32_camera_camera_get_height(esp32_camera_camera_obj_t *self); +extern int common_hal_espcamera_camera_get_address(espcamera_camera_obj_t *self); +extern const char *common_hal_espcamera_camera_get_sensor_name(espcamera_camera_obj_t *self); +extern const bool common_hal_espcamera_camera_get_supports_jpeg(espcamera_camera_obj_t *self); +extern framesize_t common_hal_espcamera_camera_get_max_frame_size(espcamera_camera_obj_t *self); +extern int common_hal_espcamera_camera_get_width(espcamera_camera_obj_t *self); +extern int common_hal_espcamera_camera_get_height(espcamera_camera_obj_t *self); diff --git a/ports/espressif/bindings/esp32_camera/__init__.c b/ports/espressif/bindings/espcamera/__init__.c similarity index 52% rename from ports/espressif/bindings/esp32_camera/__init__.c rename to ports/espressif/bindings/espcamera/__init__.c index f1ee4b6891..633f547fe9 100644 --- a/ports/espressif/bindings/esp32_camera/__init__.c +++ b/ports/espressif/bindings/espcamera/__init__.c @@ -29,13 +29,13 @@ #include "py/mphal.h" #include "bindings/espidf/__init__.h" -#include "bindings/esp32_camera/__init__.h" -#include "bindings/esp32_camera/Camera.h" +#include "bindings/espcamera/__init__.h" +#include "bindings/espcamera/Camera.h" #include "esp_camera.h" #include "sensor.h" -//| """Wrapper for the esp32_camera library +//| """Wrapper for the espcamera library //| //| This library enables access to any camera sensor supported by the library, //| including OV5640 and OV2640. @@ -45,6 +45,7 @@ //| Non-Espressif microcontrollers use the `imagecapture` module together with wrapper libraries such as `adafruit_ov5640 `_. //| //| """ +//| //| class GrabMode: //| """Controls when a new frame is grabbed.""" @@ -56,20 +57,20 @@ //| """Except when 1 frame buffer is used, queue will always contain the last ``fb_count`` frames""" //| -MAKE_ENUM_VALUE(esp32_camera_grab_mode_type, grab_mode, WHEN_EMPTY, CAMERA_GRAB_WHEN_EMPTY); -MAKE_ENUM_VALUE(esp32_camera_grab_mode_type, grab_mode, LATEST, CAMERA_GRAB_LATEST); +MAKE_ENUM_VALUE(espcamera_grab_mode_type, grab_mode, WHEN_EMPTY, CAMERA_GRAB_WHEN_EMPTY); +MAKE_ENUM_VALUE(espcamera_grab_mode_type, grab_mode, LATEST, CAMERA_GRAB_LATEST); -MAKE_ENUM_MAP(esp32_camera_grab_mode) { +MAKE_ENUM_MAP(espcamera_grab_mode) { MAKE_ENUM_MAP_ENTRY(grab_mode, WHEN_EMPTY), MAKE_ENUM_MAP_ENTRY(grab_mode, LATEST), }; -STATIC MP_DEFINE_CONST_DICT(esp32_camera_grab_mode_locals_dict, esp32_camera_grab_mode_locals_table); -MAKE_PRINTER(esp32_camera, esp32_camera_grab_mode); -MAKE_ENUM_TYPE(esp32_camera, GrabMode, esp32_camera_grab_mode); +STATIC MP_DEFINE_CONST_DICT(espcamera_grab_mode_locals_dict, espcamera_grab_mode_locals_table); +MAKE_PRINTER(espcamera, espcamera_grab_mode); +MAKE_ENUM_TYPE(espcamera, GrabMode, espcamera_grab_mode); camera_grab_mode_t validate_grab_mode(mp_obj_t obj, qstr arg_name) { - return cp_enum_value(&esp32_camera_grab_mode_type, mp_arg_validate_type(obj, &esp32_camera_grab_mode_type, arg_name)); + return cp_enum_value(&espcamera_grab_mode_type, obj, arg_name); } //| class PixelFormat: @@ -85,22 +86,22 @@ camera_grab_mode_t validate_grab_mode(mp_obj_t obj, qstr arg_name) { //| """A compressed format""" //| -MAKE_ENUM_VALUE(esp32_camera_pixel_format_type, pixel_format, RGB565, PIXFORMAT_RGB565); -MAKE_ENUM_VALUE(esp32_camera_pixel_format_type, pixel_format, GRAYSCALE, PIXFORMAT_GRAYSCALE); -MAKE_ENUM_VALUE(esp32_camera_pixel_format_type, pixel_format, JPEG, PIXFORMAT_JPEG); +MAKE_ENUM_VALUE(espcamera_pixel_format_type, pixel_format, RGB565, PIXFORMAT_RGB565); +MAKE_ENUM_VALUE(espcamera_pixel_format_type, pixel_format, GRAYSCALE, PIXFORMAT_GRAYSCALE); +MAKE_ENUM_VALUE(espcamera_pixel_format_type, pixel_format, JPEG, PIXFORMAT_JPEG); -MAKE_ENUM_MAP(esp32_camera_pixel_format) { +MAKE_ENUM_MAP(espcamera_pixel_format) { MAKE_ENUM_MAP_ENTRY(pixel_format, RGB565), MAKE_ENUM_MAP_ENTRY(pixel_format, GRAYSCALE), MAKE_ENUM_MAP_ENTRY(pixel_format, JPEG), }; -STATIC MP_DEFINE_CONST_DICT(esp32_camera_pixel_format_locals_dict, esp32_camera_pixel_format_locals_table); -MAKE_PRINTER(esp32_camera, esp32_camera_pixel_format); -MAKE_ENUM_TYPE(esp32_camera, PixelFormat, esp32_camera_pixel_format); +STATIC MP_DEFINE_CONST_DICT(espcamera_pixel_format_locals_dict, espcamera_pixel_format_locals_table); +MAKE_PRINTER(espcamera, espcamera_pixel_format); +MAKE_ENUM_TYPE(espcamera, PixelFormat, espcamera_pixel_format); pixformat_t validate_pixel_format(mp_obj_t obj, qstr arg_name) { - return cp_enum_value(&esp32_camera_pixel_format_type, mp_arg_validate_type(obj, &esp32_camera_pixel_format_type, arg_name)); + return cp_enum_value(&espcamera_pixel_format_type, obj, arg_name); } //| class FrameSize: @@ -173,29 +174,29 @@ pixformat_t validate_pixel_format(mp_obj_t obj, qstr arg_name) { //| """2560x1920""" //| -MAKE_ENUM_VALUE(esp32_camera_frame_size_type, frame_size, R96X96, FRAMESIZE_96X96); -MAKE_ENUM_VALUE(esp32_camera_frame_size_type, frame_size, R240X240, FRAMESIZE_240X240); -MAKE_ENUM_VALUE(esp32_camera_frame_size_type, frame_size, QQVGA, FRAMESIZE_QQVGA); -MAKE_ENUM_VALUE(esp32_camera_frame_size_type, frame_size, QCIF, FRAMESIZE_QCIF); -MAKE_ENUM_VALUE(esp32_camera_frame_size_type, frame_size, HQVGA, FRAMESIZE_HQVGA); -MAKE_ENUM_VALUE(esp32_camera_frame_size_type, frame_size, QVGA, FRAMESIZE_QVGA); -MAKE_ENUM_VALUE(esp32_camera_frame_size_type, frame_size, CIF, FRAMESIZE_CIF); -MAKE_ENUM_VALUE(esp32_camera_frame_size_type, frame_size, HVGA, FRAMESIZE_HVGA); -MAKE_ENUM_VALUE(esp32_camera_frame_size_type, frame_size, VGA, FRAMESIZE_VGA); -MAKE_ENUM_VALUE(esp32_camera_frame_size_type, frame_size, SVGA, FRAMESIZE_SVGA); -MAKE_ENUM_VALUE(esp32_camera_frame_size_type, frame_size, XGA, FRAMESIZE_XGA); -MAKE_ENUM_VALUE(esp32_camera_frame_size_type, frame_size, HD, FRAMESIZE_HD); -MAKE_ENUM_VALUE(esp32_camera_frame_size_type, frame_size, SXGA, FRAMESIZE_SXGA); -MAKE_ENUM_VALUE(esp32_camera_frame_size_type, frame_size, UXGA, FRAMESIZE_UXGA); -MAKE_ENUM_VALUE(esp32_camera_frame_size_type, frame_size, FHD, FRAMESIZE_FHD); -MAKE_ENUM_VALUE(esp32_camera_frame_size_type, frame_size, P_HD, FRAMESIZE_P_HD); -MAKE_ENUM_VALUE(esp32_camera_frame_size_type, frame_size, P_3MP, FRAMESIZE_P_3MP); -MAKE_ENUM_VALUE(esp32_camera_frame_size_type, frame_size, QXGA, FRAMESIZE_QXGA); -MAKE_ENUM_VALUE(esp32_camera_frame_size_type, frame_size, QHD, FRAMESIZE_QHD); -MAKE_ENUM_VALUE(esp32_camera_frame_size_type, frame_size, WQXGA, FRAMESIZE_WQXGA); -MAKE_ENUM_VALUE(esp32_camera_frame_size_type, frame_size, P_FHD, FRAMESIZE_P_FHD); -MAKE_ENUM_VALUE(esp32_camera_frame_size_type, frame_size, QSXGA, FRAMESIZE_QSXGA); -MAKE_ENUM_MAP(esp32_camera_frame_size) { +MAKE_ENUM_VALUE(espcamera_frame_size_type, frame_size, R96X96, FRAMESIZE_96X96); +MAKE_ENUM_VALUE(espcamera_frame_size_type, frame_size, R240X240, FRAMESIZE_240X240); +MAKE_ENUM_VALUE(espcamera_frame_size_type, frame_size, QQVGA, FRAMESIZE_QQVGA); +MAKE_ENUM_VALUE(espcamera_frame_size_type, frame_size, QCIF, FRAMESIZE_QCIF); +MAKE_ENUM_VALUE(espcamera_frame_size_type, frame_size, HQVGA, FRAMESIZE_HQVGA); +MAKE_ENUM_VALUE(espcamera_frame_size_type, frame_size, QVGA, FRAMESIZE_QVGA); +MAKE_ENUM_VALUE(espcamera_frame_size_type, frame_size, CIF, FRAMESIZE_CIF); +MAKE_ENUM_VALUE(espcamera_frame_size_type, frame_size, HVGA, FRAMESIZE_HVGA); +MAKE_ENUM_VALUE(espcamera_frame_size_type, frame_size, VGA, FRAMESIZE_VGA); +MAKE_ENUM_VALUE(espcamera_frame_size_type, frame_size, SVGA, FRAMESIZE_SVGA); +MAKE_ENUM_VALUE(espcamera_frame_size_type, frame_size, XGA, FRAMESIZE_XGA); +MAKE_ENUM_VALUE(espcamera_frame_size_type, frame_size, HD, FRAMESIZE_HD); +MAKE_ENUM_VALUE(espcamera_frame_size_type, frame_size, SXGA, FRAMESIZE_SXGA); +MAKE_ENUM_VALUE(espcamera_frame_size_type, frame_size, UXGA, FRAMESIZE_UXGA); +MAKE_ENUM_VALUE(espcamera_frame_size_type, frame_size, FHD, FRAMESIZE_FHD); +MAKE_ENUM_VALUE(espcamera_frame_size_type, frame_size, P_HD, FRAMESIZE_P_HD); +MAKE_ENUM_VALUE(espcamera_frame_size_type, frame_size, P_3MP, FRAMESIZE_P_3MP); +MAKE_ENUM_VALUE(espcamera_frame_size_type, frame_size, QXGA, FRAMESIZE_QXGA); +MAKE_ENUM_VALUE(espcamera_frame_size_type, frame_size, QHD, FRAMESIZE_QHD); +MAKE_ENUM_VALUE(espcamera_frame_size_type, frame_size, WQXGA, FRAMESIZE_WQXGA); +MAKE_ENUM_VALUE(espcamera_frame_size_type, frame_size, P_FHD, FRAMESIZE_P_FHD); +MAKE_ENUM_VALUE(espcamera_frame_size_type, frame_size, QSXGA, FRAMESIZE_QSXGA); +MAKE_ENUM_MAP(espcamera_frame_size) { MAKE_ENUM_MAP_ENTRY(frame_size, R96X96), MAKE_ENUM_MAP_ENTRY(frame_size, R240X240), MAKE_ENUM_MAP_ENTRY(frame_size, QQVGA), @@ -220,12 +221,12 @@ MAKE_ENUM_MAP(esp32_camera_frame_size) { MAKE_ENUM_MAP_ENTRY(frame_size, QSXGA), }; -STATIC MP_DEFINE_CONST_DICT(esp32_camera_frame_size_locals_dict, esp32_camera_frame_size_locals_table); -MAKE_PRINTER(esp32_camera, esp32_camera_frame_size); -MAKE_ENUM_TYPE(esp32_camera, FrameSize, esp32_camera_frame_size); +STATIC MP_DEFINE_CONST_DICT(espcamera_frame_size_locals_dict, espcamera_frame_size_locals_table); +MAKE_PRINTER(espcamera, espcamera_frame_size); +MAKE_ENUM_TYPE(espcamera, FrameSize, espcamera_frame_size); framesize_t validate_frame_size(mp_obj_t obj, qstr arg_name) { - return cp_enum_value(&esp32_camera_frame_size_type, mp_arg_validate_type(obj, &esp32_camera_frame_size_type, arg_name)); + return cp_enum_value(&espcamera_frame_size_type, obj, arg_name); } //| class GainCeiling: @@ -242,15 +243,15 @@ framesize_t validate_frame_size(mp_obj_t obj, qstr arg_name) { //| GAIN_128X: GainCeiling //| -MAKE_ENUM_VALUE(esp32_camera_gain_ceiling_type, gain_ceiling, GAIN_2X, GAINCEILING_2X); -MAKE_ENUM_VALUE(esp32_camera_gain_ceiling_type, gain_ceiling, GAIN_4X, GAINCEILING_4X); -MAKE_ENUM_VALUE(esp32_camera_gain_ceiling_type, gain_ceiling, GAIN_8X, GAINCEILING_8X); -MAKE_ENUM_VALUE(esp32_camera_gain_ceiling_type, gain_ceiling, GAIN_16X, GAINCEILING_16X); -MAKE_ENUM_VALUE(esp32_camera_gain_ceiling_type, gain_ceiling, GAIN_32X, GAINCEILING_32X); -MAKE_ENUM_VALUE(esp32_camera_gain_ceiling_type, gain_ceiling, GAIN_64X, GAINCEILING_64X); -MAKE_ENUM_VALUE(esp32_camera_gain_ceiling_type, gain_ceiling, GAIN_128X, GAINCEILING_128X); +MAKE_ENUM_VALUE(espcamera_gain_ceiling_type, gain_ceiling, GAIN_2X, GAINCEILING_2X); +MAKE_ENUM_VALUE(espcamera_gain_ceiling_type, gain_ceiling, GAIN_4X, GAINCEILING_4X); +MAKE_ENUM_VALUE(espcamera_gain_ceiling_type, gain_ceiling, GAIN_8X, GAINCEILING_8X); +MAKE_ENUM_VALUE(espcamera_gain_ceiling_type, gain_ceiling, GAIN_16X, GAINCEILING_16X); +MAKE_ENUM_VALUE(espcamera_gain_ceiling_type, gain_ceiling, GAIN_32X, GAINCEILING_32X); +MAKE_ENUM_VALUE(espcamera_gain_ceiling_type, gain_ceiling, GAIN_64X, GAINCEILING_64X); +MAKE_ENUM_VALUE(espcamera_gain_ceiling_type, gain_ceiling, GAIN_128X, GAINCEILING_128X); -MAKE_ENUM_MAP(esp32_camera_gain_ceiling) { +MAKE_ENUM_MAP(espcamera_gain_ceiling) { MAKE_ENUM_MAP_ENTRY(gain_ceiling, GAIN_2X), MAKE_ENUM_MAP_ENTRY(gain_ceiling, GAIN_4X), MAKE_ENUM_MAP_ENTRY(gain_ceiling, GAIN_8X), @@ -260,28 +261,28 @@ MAKE_ENUM_MAP(esp32_camera_gain_ceiling) { MAKE_ENUM_MAP_ENTRY(gain_ceiling, GAIN_128X) }; -STATIC MP_DEFINE_CONST_DICT(esp32_camera_gain_ceiling_locals_dict, esp32_camera_gain_ceiling_locals_table); -MAKE_PRINTER(esp32_camera, esp32_camera_gain_ceiling); -MAKE_ENUM_TYPE(esp32_camera, GainCeiling, esp32_camera_gain_ceiling); +STATIC MP_DEFINE_CONST_DICT(espcamera_gain_ceiling_locals_dict, espcamera_gain_ceiling_locals_table); +MAKE_PRINTER(espcamera, espcamera_gain_ceiling); +MAKE_ENUM_TYPE(espcamera, GainCeiling, espcamera_gain_ceiling); gainceiling_t validate_gain_ceiling(mp_obj_t obj, qstr arg_name) { - return cp_enum_value(&esp32_camera_gain_ceiling_type, mp_arg_validate_type(obj, &esp32_camera_gain_ceiling_type, arg_name)); + return cp_enum_value(&espcamera_gain_ceiling_type, obj, arg_name); } -STATIC const mp_rom_map_elem_t esp32_camera_module_globals_table[] = { - { MP_ROM_QSTR(MP_QSTR___name__), MP_ROM_QSTR(MP_QSTR_esp32_camera) }, - { MP_ROM_QSTR(MP_QSTR_Camera), MP_ROM_PTR(&esp32_camera_camera_type), }, - { MP_ROM_QSTR(MP_QSTR_FrameSize), &esp32_camera_frame_size_type }, - { MP_ROM_QSTR(MP_QSTR_GainCeiling), &esp32_camera_gain_ceiling_type }, - { MP_ROM_QSTR(MP_QSTR_GrabMode), &esp32_camera_grab_mode_type }, - { MP_ROM_QSTR(MP_QSTR_PixelFormat), &esp32_camera_pixel_format_type }, +STATIC const mp_rom_map_elem_t espcamera_module_globals_table[] = { + { MP_ROM_QSTR(MP_QSTR___name__), MP_ROM_QSTR(MP_QSTR_espcamera) }, + { MP_ROM_QSTR(MP_QSTR_Camera), MP_ROM_PTR(&espcamera_camera_type), }, + { MP_ROM_QSTR(MP_QSTR_FrameSize), &espcamera_frame_size_type }, + { MP_ROM_QSTR(MP_QSTR_GainCeiling), &espcamera_gain_ceiling_type }, + { MP_ROM_QSTR(MP_QSTR_GrabMode), &espcamera_grab_mode_type }, + { MP_ROM_QSTR(MP_QSTR_PixelFormat), &espcamera_pixel_format_type }, }; -STATIC MP_DEFINE_CONST_DICT(esp32_camera_module_globals, esp32_camera_module_globals_table); +STATIC MP_DEFINE_CONST_DICT(espcamera_module_globals, espcamera_module_globals_table); -const mp_obj_module_t esp32_camera_module = { +const mp_obj_module_t espcamera_module = { .base = { &mp_type_module }, - .globals = (mp_obj_dict_t *)&esp32_camera_module_globals, + .globals = (mp_obj_dict_t *)&espcamera_module_globals, }; -MP_REGISTER_MODULE(MP_QSTR_esp32_camera, esp32_camera_module, CIRCUITPY_ESP32_CAMERA); +MP_REGISTER_MODULE(MP_QSTR_espcamera, espcamera_module, CIRCUITPY_ESPCAMERA); diff --git a/ports/espressif/bindings/esp32_camera/__init__.h b/ports/espressif/bindings/espcamera/__init__.h similarity index 88% rename from ports/espressif/bindings/esp32_camera/__init__.h rename to ports/espressif/bindings/espcamera/__init__.h index a0e7290ff9..6e55ac3870 100644 --- a/ports/espressif/bindings/esp32_camera/__init__.h +++ b/ports/espressif/bindings/espcamera/__init__.h @@ -31,13 +31,13 @@ #include "esp_camera.h" -extern const mp_obj_type_t esp32_camera_grab_mode_type; +extern const mp_obj_type_t espcamera_grab_mode_type; extern const cp_enum_obj_t grab_mode_WHEN_EMPTY_obj; -extern const mp_obj_type_t esp32_camera_pixel_format_type; +extern const mp_obj_type_t espcamera_pixel_format_type; extern const cp_enum_obj_t pixel_format_RGB565_obj; -extern const mp_obj_type_t esp32_camera_frame_size_type; +extern const mp_obj_type_t espcamera_frame_size_type; extern const cp_enum_obj_t frame_size_QQVGA_obj; -extern const mp_obj_type_t esp32_camera_gain_ceiling_type; +extern const mp_obj_type_t espcamera_gain_ceiling_type; extern camera_grab_mode_t validate_grab_mode(mp_obj_t obj, qstr arg_name); extern pixformat_t validate_pixel_format(mp_obj_t obj, qstr arg_name); diff --git a/ports/espressif/bindings/espidf/__init__.c b/ports/espressif/bindings/espidf/__init__.c index c42a9e549d..c1ef9da1e0 100644 --- a/ports/espressif/bindings/espidf/__init__.c +++ b/ports/espressif/bindings/espidf/__init__.c @@ -37,6 +37,7 @@ //| """Direct access to a few ESP-IDF details. This module *should not* include any functionality //| that could be implemented by other frameworks. It should only include ESP-IDF specific //| things.""" +//| //| def heap_caps_get_total_size() -> int: //| """Return the total size of the ESP-IDF, which includes the CircuitPython heap.""" @@ -72,7 +73,8 @@ MP_DEFINE_CONST_FUN_OBJ_0(espidf_heap_caps_get_largest_free_block_obj, espidf_he //| """Erase all data in the non-volatile storage (nvs), including data stored by with `microcontroller.nvm` //| //| This is necessary when upgrading from CircuitPython 6.3.0 or earlier to CircuitPython 7.0.0, because the -//| layout of data in nvs has changed. The old data will be lost when you perform this operation.""" +//| layout of data in nvs has changed. The old data will be lost when you perform this operation. +//| """ //| STATIC mp_obj_t espidf_erase_nvs(void) { ESP_ERROR_CHECK(nvs_flash_deinit()); @@ -132,7 +134,7 @@ STATIC mp_obj_t espidf_get_total_psram(void) { 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``.""" +//| """Returns number of bytes of psram reserved for use by esp-idf, either a board-specific default value or the value defined in ``settings.toml``.""" //| STATIC mp_obj_t espidf_get_reserved_psram(void) { return MP_OBJ_NEW_SMALL_INT(common_hal_espidf_get_reserved_psram()); diff --git a/ports/espressif/bindings/espulp/Architecture.c b/ports/espressif/bindings/espulp/Architecture.c new file mode 100644 index 0000000000..d87691716c --- /dev/null +++ b/ports/espressif/bindings/espulp/Architecture.c @@ -0,0 +1,51 @@ +/* + * This file is part of the MicroPython project, http://micropython.org/ + * + * The MIT License (MIT) + * + * Copyright (c) 2023 MicroDev + * + * Permission is hereby granted, free of charge, to any person obtaining a copy + * of this software and associated documentation files (the "Software"), to deal + * in the Software without restriction, including without limitation the rights + * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell + * copies of the Software, and to permit persons to whom the Software is + * furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice shall be included in + * all copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE + * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER + * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, + * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN + * THE SOFTWARE. + */ + +#include "py/enum.h" + +#include "bindings/espulp/Architecture.h" + +MAKE_ENUM_VALUE(espulp_architecture_type, architecture, FSM, FSM); +MAKE_ENUM_VALUE(espulp_architecture_type, architecture, RISCV, RISCV); + +//| class Architecture: +//| """The ULP architectures available.""" +//| +//| FSM: Architecture +//| """The ULP Finite State Machine.""" +//| +//| RISCV: Architecture +//| """The ULP RISC-V Coprocessor.""" +//| +MAKE_ENUM_MAP(espulp_architecture) { + MAKE_ENUM_MAP_ENTRY(architecture, FSM), + MAKE_ENUM_MAP_ENTRY(architecture, RISCV), +}; +STATIC MP_DEFINE_CONST_DICT(espulp_architecture_locals_dict, espulp_architecture_locals_table); + +MAKE_PRINTER(espulp, espulp_architecture); + +MAKE_ENUM_TYPE(espulp, Architecture, espulp_architecture); diff --git a/ports/espressif/bindings/espulp/Architecture.h b/ports/espressif/bindings/espulp/Architecture.h new file mode 100644 index 0000000000..54c0677f05 --- /dev/null +++ b/ports/espressif/bindings/espulp/Architecture.h @@ -0,0 +1,40 @@ +/* + * This file is part of the MicroPython project, http://micropython.org/ + * + * The MIT License (MIT) + * + * Copyright (c) 2023 MicroDev + * + * Permission is hereby granted, free of charge, to any person obtaining a copy + * of this software and associated documentation files (the "Software"), to deal + * in the Software without restriction, including without limitation the rights + * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell + * copies of the Software, and to permit persons to whom the Software is + * furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice shall be included in + * all copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE + * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER + * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, + * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN + * THE SOFTWARE. + */ + +#ifndef MICROPY_INCLUDED_BINDINGS_ESPULP_ARCHITECTURE_H +#define MICROPY_INCLUDED_BINDINGS_ESPULP_ARCHITECTURE_H + +#include "py/enum.h" + +typedef enum { + FSM, + RISCV +} espulp_architecture_t; + +extern const mp_obj_type_t espulp_architecture_type; +extern const cp_enum_obj_t architecture_FSM_obj; + +#endif // MICROPY_INCLUDED_BINDINGS_ESPULP_ARCHITECTURE_H diff --git a/ports/espressif/bindings/espulp/ULP.c b/ports/espressif/bindings/espulp/ULP.c new file mode 100644 index 0000000000..c9666fb143 --- /dev/null +++ b/ports/espressif/bindings/espulp/ULP.c @@ -0,0 +1,181 @@ +/* + * This file is part of the Micro Python project, http://micropython.org/ + * + * The MIT License (MIT) + * + * Copyright (c) 2022 microDev + * + * Permission is hereby granted, free of charge, to any person obtaining a copy + * of this software and associated documentation files (the "Software"), to deal + * in the Software without restriction, including without limitation the rights + * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell + * copies of the Software, and to permit persons to whom the Software is + * furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice shall be included in + * all copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE + * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER + * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, + * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN + * THE SOFTWARE. + */ + +#include "shared-bindings/microcontroller/Pin.h" +#include "shared-bindings/util.h" +#include "bindings/espulp/ULP.h" + +#include "py/enum.h" +#include "py/runtime.h" +#include "py/objproperty.h" + +//| class ULP: +//| def __init__(self, arch: Architecture = Architecture.FSM): +//| """The ultra-low-power processor. +//| +//| Raises an exception if another ULP has been instantiated. This +//| ensures that is is only used by one piece of code at a time. +//| +//| :param Architecture arch: The ulp arch""" +//| ... +STATIC mp_obj_t espulp_ulp_make_new(const mp_obj_type_t *type, size_t n_args, size_t n_kw, const mp_obj_t *all_args) { + enum { ARG_arch }; + static const mp_arg_t allowed_args[] = { + { MP_QSTR_arch, MP_ARG_OBJ, {.u_obj = (void *)&architecture_FSM_obj} }, + }; + + mp_arg_val_t args[MP_ARRAY_SIZE(allowed_args)]; + mp_arg_parse_all_kw_array(n_args, n_kw, all_args, MP_ARRAY_SIZE(allowed_args), allowed_args, args); + + const espulp_architecture_t arch = cp_enum_value(&espulp_architecture_type, args[ARG_arch].u_obj, MP_QSTR_arch); + + espulp_ulp_obj_t *self = m_new_obj(espulp_ulp_obj_t); + self->base.type = &espulp_ulp_type; + + common_hal_espulp_ulp_construct(self, arch); + + return MP_OBJ_FROM_PTR(self); +} + +STATIC void check_for_deinit(espulp_ulp_obj_t *self) { + if (common_hal_espulp_ulp_deinited(self)) { + raise_deinited_error(); + } +} + +//| def deinit(self) -> None: +//| """Deinitialises the ULP and releases it for another program.""" +//| ... +STATIC mp_obj_t espulp_ulp_deinit(mp_obj_t self_in) { + espulp_ulp_obj_t *self = MP_OBJ_TO_PTR(self_in); + common_hal_espulp_ulp_deinit(self); + return mp_const_none; +} +STATIC MP_DEFINE_CONST_FUN_OBJ_1(espulp_ulp_deinit_obj, espulp_ulp_deinit); + +//| def __enter__(self) -> ULP: +//| """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 espulp_ulp_obj___exit__(size_t n_args, const mp_obj_t *args) { + (void)n_args; + return espulp_ulp_deinit(args[0]); +} +STATIC MP_DEFINE_CONST_FUN_OBJ_VAR_BETWEEN(espulp_ulp___exit___obj, 4, 4, espulp_ulp_obj___exit__); + +//| def run( +//| self, program: ReadableBuffer, *, pins: Sequence[microcontroller.Pin] = () +//| ) -> None: +//| """Loads the program into ULP memory and then runs the program. The given pins are +//| claimed and not reset until `halt()` is called. +//| +//| The program will continue to run even when the running Python is halted.""" +//| ... +STATIC mp_obj_t espulp_ulp_run(size_t n_args, const mp_obj_t *pos_args, mp_map_t *kw_args) { + espulp_ulp_obj_t *self = MP_OBJ_TO_PTR(pos_args[0]); + check_for_deinit(self); + + enum { ARG_program, ARG_pins }; + static const mp_arg_t allowed_args[] = { + { MP_QSTR_program, MP_ARG_REQUIRED | MP_ARG_OBJ}, + { MP_QSTR_pins, MP_ARG_KW_ONLY | MP_ARG_OBJ, {.u_obj = mp_const_empty_tuple} }, + }; + + 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 bufinfo; + mp_get_buffer_raise(args[ARG_program].u_obj, &bufinfo, MP_BUFFER_READ); + + mp_obj_t pins_in = args[ARG_pins].u_obj; + const size_t num_pins = (size_t)MP_OBJ_SMALL_INT_VALUE(mp_obj_len(pins_in)); + + // The ULP only supports 21 pins on the ESP32-S2 and S3. So we can store it + // as a bitmask in a 32 bit number. The common-hal code does further checks. + uint32_t pin_mask = 0; + + for (mp_uint_t i = 0; i < num_pins; i++) { + mp_obj_t pin_obj = mp_obj_subscr(pins_in, MP_OBJ_NEW_SMALL_INT(i), MP_OBJ_SENTINEL); + validate_obj_is_free_pin(pin_obj, MP_QSTR_pin); + const mcu_pin_obj_t *pin = ((const mcu_pin_obj_t *)pin_obj); + if (pin->number >= 32) { + raise_ValueError_invalid_pin(); + } + pin_mask |= 1 << pin->number; + } + + common_hal_espulp_ulp_run(self, bufinfo.buf, bufinfo.len, pin_mask); + return mp_const_none; +} +STATIC MP_DEFINE_CONST_FUN_OBJ_KW(espulp_ulp_run_obj, 2, espulp_ulp_run); + +//| def halt(self) -> None: +//| """Halts the running program and releases the pins given in `run()`.""" +//| ... +STATIC mp_obj_t espulp_ulp_halt(mp_obj_t self_in) { + espulp_ulp_obj_t *self = MP_OBJ_TO_PTR(self_in); + check_for_deinit(self); + + common_hal_espulp_ulp_halt(self); + return mp_const_none; +} +STATIC MP_DEFINE_CONST_FUN_OBJ_1(espulp_ulp_halt_obj, espulp_ulp_halt); + +//| arch: Architecture +//| """The ulp architecture. (read-only)""" +//| +STATIC mp_obj_t espulp_ulp_get_arch(mp_obj_t self_in) { + espulp_ulp_obj_t *self = MP_OBJ_TO_PTR(self_in); + check_for_deinit(self); + + return cp_enum_find(&espulp_architecture_type, self->arch); +} +MP_DEFINE_CONST_FUN_OBJ_1(espulp_ulp_get_arch_obj, espulp_ulp_get_arch); + +MP_PROPERTY_GETTER(espulp_ulp_arch_obj, + (mp_obj_t)&espulp_ulp_get_arch_obj); + +STATIC const mp_rom_map_elem_t espulp_ulp_locals_table[] = { + { MP_ROM_QSTR(MP_QSTR_deinit), MP_ROM_PTR(&espulp_ulp_deinit_obj) }, + { MP_ROM_QSTR(MP_QSTR___enter__), MP_ROM_PTR(&mp_identity_obj) }, + { MP_ROM_QSTR(MP_QSTR___exit__), MP_ROM_PTR(&espulp_ulp___exit___obj) }, + { MP_ROM_QSTR(MP_QSTR_run), MP_ROM_PTR(&espulp_ulp_run_obj) }, + { MP_ROM_QSTR(MP_QSTR_halt), MP_ROM_PTR(&espulp_ulp_halt_obj) }, + { MP_ROM_QSTR(MP_QSTR_arch), MP_ROM_PTR(&espulp_ulp_arch_obj) }, +}; +STATIC MP_DEFINE_CONST_DICT(espulp_ulp_locals_dict, espulp_ulp_locals_table); + +const mp_obj_type_t espulp_ulp_type = { + { &mp_type_type }, + .name = MP_QSTR_ULP, + .make_new = espulp_ulp_make_new, + .locals_dict = (mp_obj_t)&espulp_ulp_locals_dict, +}; diff --git a/shared-bindings/coproc/__init__.h b/ports/espressif/bindings/espulp/ULP.h similarity index 72% rename from shared-bindings/coproc/__init__.h rename to ports/espressif/bindings/espulp/ULP.h index 6f2b2a56ae..490cbef1ca 100644 --- a/shared-bindings/coproc/__init__.h +++ b/ports/espressif/bindings/espulp/ULP.h @@ -24,14 +24,16 @@ * THE SOFTWARE. */ -#ifndef MICROPY_INCLUDED_SHARED_BINDINGS_COPROC___INIT___H -#define MICROPY_INCLUDED_SHARED_BINDINGS_COPROC___INIT___H +#pragma once #include "py/obj.h" -#include "common-hal/coproc/Coproc.h" +#include "common-hal/espulp/ULP.h" -extern void common_hal_coproc_run(coproc_coproc_obj_t *self); -extern void common_hal_coproc_halt(coproc_coproc_obj_t *self); -extern mp_obj_t common_hal_coproc_memory(coproc_coproc_obj_t *self); +extern const mp_obj_type_t espulp_ulp_type; -#endif // MICROPY_INCLUDED_SHARED_BINDINGS_COPROC___INIT___H +void common_hal_espulp_ulp_construct(espulp_ulp_obj_t *self, espulp_architecture_t arch); +bool common_hal_espulp_ulp_deinited(espulp_ulp_obj_t *self); +void common_hal_espulp_ulp_deinit(espulp_ulp_obj_t *self); + +void common_hal_espulp_ulp_run(espulp_ulp_obj_t *self, uint32_t *program, size_t length, uint32_t pin_mask); +void common_hal_espulp_ulp_halt(espulp_ulp_obj_t *self); diff --git a/shared-bindings/alarm/coproc/CoprocAlarm.c b/ports/espressif/bindings/espulp/ULPAlarm.c similarity index 51% rename from shared-bindings/alarm/coproc/CoprocAlarm.c rename to ports/espressif/bindings/espulp/ULPAlarm.c index 0b60282c2f..6efd1c98ef 100644 --- a/shared-bindings/alarm/coproc/CoprocAlarm.c +++ b/ports/espressif/bindings/espulp/ULPAlarm.c @@ -24,64 +24,44 @@ * THE SOFTWARE. */ +#include "bindings/espulp/ULPAlarm.h" + #include "py/runtime.h" +#include "py/objproperty.h" -#if CIRCUITPY_COPROC -#include "shared-bindings/util.h" -#include "shared-bindings/alarm/coproc/CoprocAlarm.h" -#include "shared-bindings/coproc/Coproc.h" - -STATIC coproc_coproc_obj_t *get_coproc_obj(mp_obj_t *self_in) { - if (!mp_obj_is_type(*self_in, &coproc_coproc_type)) { - mp_raise_TypeError_varg(translate("Expected a %q"), MP_QSTR_Coproc); - } - coproc_coproc_obj_t *self = MP_OBJ_TO_PTR(*self_in); - if (common_hal_coproc_coproc_deinited(self)) { - raise_deinited_error(); - } - return self; -} -#endif - -//| class CoprocAlarm: -//| """Trigger an alarm when another core or co-processor requests wake-up.""" +//| class ULPAlarm: +//| """Trigger an alarm when the ULP requests wake-up.""" //| -//| def __init__(self, coproc: coproc.Coproc) -> None: -//| """Create an alarm that will be triggered when the co-processor requests wake-up. +//| def __init__(self, ulp: ULP) -> None: +//| """Create an alarm that will be triggered when the ULP requests wake-up. //| //| The alarm is not active until it is passed to an `alarm`-enabling function, such as //| `alarm.light_sleep_until_alarms()` or `alarm.exit_and_deep_sleep_until_alarms()`. //| -//| :param coproc.Coproc coproc: The coproc program to run. -//| -//| """ +//| :param ULP ulp: The ulp instance""" //| ... //| -STATIC mp_obj_t alarm_coproc_coprocalarm_make_new(const mp_obj_type_t *type, - size_t n_args, size_t n_kw, const mp_obj_t *all_args) { - enum { ARG_coproc }; +STATIC mp_obj_t espulp_ulpalarm_make_new(const mp_obj_type_t *type, size_t n_args, size_t n_kw, const mp_obj_t *all_args) { + enum { ARG_ulp }; static const mp_arg_t allowed_args[] = { - { MP_QSTR_coproc, MP_ARG_REQUIRED | MP_ARG_OBJ }, + { MP_QSTR_ulp, MP_ARG_REQUIRED | MP_ARG_OBJ }, }; mp_arg_val_t args[MP_ARRAY_SIZE(allowed_args)]; mp_arg_parse_all_kw_array(n_args, n_kw, all_args, MP_ARRAY_SIZE(allowed_args), allowed_args, args); - #if CIRCUITPY_COPROC - // initialize CoprocAlarm object - alarm_coproc_coprocalarm_obj_t *self = m_new_obj(alarm_coproc_coprocalarm_obj_t); - self->base.type = &alarm_coproc_coprocalarm_type; - self->coproc = get_coproc_obj(&args[ARG_coproc].u_obj); - // return CoprocAlarm object + espulp_ulpalarm_obj_t *self = m_new_obj(espulp_ulpalarm_obj_t); + self->base.type = &espulp_ulpalarm_type; + + espulp_ulp_obj_t *ulp = mp_arg_validate_type(args[ARG_ulp].u_obj, &espulp_ulp_type, MP_QSTR_ulp); + + common_hal_espulp_ulpalarm_construct(self, ulp); + return MP_OBJ_FROM_PTR(self); - #else - mp_raise_NotImplementedError(NULL); - return mp_const_none; - #endif } -const mp_obj_type_t alarm_coproc_coprocalarm_type = { +const mp_obj_type_t espulp_ulpalarm_type = { { &mp_type_type }, - .name = MP_QSTR_CoprocAlarm, - .make_new = alarm_coproc_coprocalarm_make_new, + .name = MP_QSTR_ULPAlarm, + .make_new = espulp_ulpalarm_make_new, }; diff --git a/shared-bindings/alarm/coproc/CoprocAlarm.h b/ports/espressif/bindings/espulp/ULPAlarm.h similarity index 79% rename from shared-bindings/alarm/coproc/CoprocAlarm.h rename to ports/espressif/bindings/espulp/ULPAlarm.h index 8f3a85de56..f2b2e69bba 100644 --- a/shared-bindings/alarm/coproc/CoprocAlarm.h +++ b/ports/espressif/bindings/espulp/ULPAlarm.h @@ -24,11 +24,10 @@ * THE SOFTWARE. */ -#ifndef MICROPY_INCLUDED_SHARED_BINDINGS_ALARM_COPROC_COPROCALARM_H -#define MICROPY_INCLUDED_SHARED_BINDINGS_ALARM_COPROC_COPROCALARM_H +#pragma once -#include "common-hal/alarm/coproc/CoprocAlarm.h" +#include "common-hal/espulp/ULPAlarm.h" -extern const mp_obj_type_t alarm_coproc_coprocalarm_type; +extern const mp_obj_type_t espulp_ulpalarm_type; -#endif // MICROPY_INCLUDED_SHARED_BINDINGS_ALARM_COPROC_COPROCALARM_H +void common_hal_espulp_ulpalarm_construct(espulp_ulpalarm_obj_t *self, espulp_ulp_obj_t *ulp); diff --git a/ports/espressif/bindings/espulp/__init__.c b/ports/espressif/bindings/espulp/__init__.c new file mode 100644 index 0000000000..f2b688dda4 --- /dev/null +++ b/ports/espressif/bindings/espulp/__init__.c @@ -0,0 +1,94 @@ +/* + * This file is part of the Micro Python project, http://micropython.org/ + * + * The MIT License (MIT) + * + * Copyright (c) 2022 microDev + * + * Permission is hereby granted, free of charge, to any person obtaining a copy + * of this software and associated documentation files (the "Software"), to deal + * in the Software without restriction, including without limitation the rights + * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell + * copies of the Software, and to permit persons to whom the Software is + * furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice shall be included in + * all copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE + * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER + * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, + * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN + * THE SOFTWARE. + */ + +#include "shared-bindings/util.h" + +#include "bindings/espulp/__init__.h" +#include "bindings/espulp/ULP.h" +#include "bindings/espulp/ULPAlarm.h" +#include "bindings/espulp/Architecture.h" + +#include "py/runtime.h" + +//| """ESP Ultra Low Power Processor Module +//| +//| The `espulp` module adds ability to load and run +//| programs on the ESP32-Sx's ultra-low-power RISC-V processor. +//| +//| .. code-block:: python +//| +//| import espulp +//| import memorymap +//| +//| shared_mem = memorymap.AddressRange(start=0x50000000, length=1024) +//| ulp = espulp.ULP() +//| +//| with open("program.bin", "rb") as f: +//| program = f.read() +//| +//| ulp.run(program) +//| print(shared_mem[0]) +//| # ulp.halt() +//| """ +//| ... +//| + +//| def get_rtc_gpio_number(pin: microcontroller.Pin) -> Optional[int]: +//| """Return the RTC GPIO number of the given pin or None if not connected +//| to RTC GPIO.""" +//| ... +//| + +STATIC mp_obj_t espulp_get_rtc_gpio_number(mp_obj_t pin_obj) { + const mcu_pin_obj_t *pin = validate_obj_is_pin(pin_obj, MP_QSTR_pin); + mp_int_t number = common_hal_espulp_get_rtc_gpio_number(pin); + if (number < 0) { + return mp_const_none; + } + return MP_OBJ_NEW_SMALL_INT(number); +} +MP_DEFINE_CONST_FUN_OBJ_1(espulp_get_rtc_gpio_number_obj, espulp_get_rtc_gpio_number); + +STATIC const mp_rom_map_elem_t espulp_module_globals_table[] = { + // module name + { MP_ROM_QSTR(MP_QSTR___name__), MP_ROM_QSTR(MP_QSTR_espulp) }, + + // module functions + { MP_ROM_QSTR(MP_QSTR_get_rtc_gpio_number), MP_OBJ_FROM_PTR(&espulp_get_rtc_gpio_number_obj) }, + + // module classes + { MP_ROM_QSTR(MP_QSTR_ULP), MP_OBJ_FROM_PTR(&espulp_ulp_type) }, + { MP_ROM_QSTR(MP_QSTR_ULPAlarm), MP_OBJ_FROM_PTR(&espulp_ulpalarm_type) }, + { MP_ROM_QSTR(MP_QSTR_Architecture), MP_ROM_PTR(&espulp_architecture_type) }, +}; +STATIC MP_DEFINE_CONST_DICT(espulp_module_globals, espulp_module_globals_table); + +const mp_obj_module_t espulp_module = { + .base = { &mp_type_module }, + .globals = (mp_obj_dict_t *)&espulp_module_globals, +}; + +MP_REGISTER_MODULE(MP_QSTR_espulp, espulp_module, CIRCUITPY_ESPULP); diff --git a/ports/espressif/common-hal/coproc/Coproc.h b/ports/espressif/bindings/espulp/__init__.h similarity index 75% rename from ports/espressif/common-hal/coproc/Coproc.h rename to ports/espressif/bindings/espulp/__init__.h index 19082871cc..70daf53183 100644 --- a/ports/espressif/common-hal/coproc/Coproc.h +++ b/ports/espressif/bindings/espulp/__init__.h @@ -24,17 +24,10 @@ * THE SOFTWARE. */ -#ifndef MICROPY_INCLUDED_ESPRESSIF_COMMON_HAL_COPROC_COPROC_H -#define MICROPY_INCLUDED_ESPRESSIF_COMMON_HAL_COPROC_COPROC_H +#pragma once -#include "py/obj.h" -#include "common-hal/coproc/CoprocMemory.h" +#include "shared-bindings/microcontroller/Pin.h" -typedef struct { - mp_obj_base_t base; - uint8_t *buf; - size_t buf_len; - coproc_memory_obj_t *coproc_memory; -} coproc_coproc_obj_t; +void espulp_reset(void); -#endif // MICROPY_INCLUDED_ESPRESSIF_COMMON_HAL_COPROC_COPROC_H +mp_int_t common_hal_espulp_get_rtc_gpio_number(const mcu_pin_obj_t *pin); diff --git a/ports/espressif/boards/adafruit_feather_esp32_v2/mpconfigboard.h b/ports/espressif/boards/adafruit_feather_esp32_v2/mpconfigboard.h index b7f2513217..4e9e679e5f 100644 --- a/ports/espressif/boards/adafruit_feather_esp32_v2/mpconfigboard.h +++ b/ports/espressif/boards/adafruit_feather_esp32_v2/mpconfigboard.h @@ -47,7 +47,7 @@ #define CIRCUITPY_BOOT_BUTTON (&pin_GPIO38) // Explanation of how a user got into safe mode -#define BOARD_USER_SAFE_MODE_ACTION translate("The SW38 button was pressed at start up.\n") +#define BOARD_USER_SAFE_MODE_ACTION translate("You pressed the SW38 button at start up.") // UART pins attached to the USB-serial converter chip #define CIRCUITPY_CONSOLE_UART_TX (&pin_GPIO1) diff --git a/ports/espressif/boards/adafruit_feather_esp32s2_reverse_tft/board.c b/ports/espressif/boards/adafruit_feather_esp32s2_reverse_tft/board.c new file mode 100644 index 0000000000..360c71804c --- /dev/null +++ b/ports/espressif/boards/adafruit_feather_esp32s2_reverse_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_GPIO40, // DC + &pin_GPIO42, // CS + &pin_GPIO41, // 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_esp32s2_tftback_nopsram/mpconfigboard.h b/ports/espressif/boards/adafruit_feather_esp32s2_reverse_tft/mpconfigboard.h similarity index 88% rename from ports/espressif/boards/adafruit_feather_esp32s2_tftback_nopsram/mpconfigboard.h rename to ports/espressif/boards/adafruit_feather_esp32s2_reverse_tft/mpconfigboard.h index b4034568c0..d170bba487 100644 --- a/ports/espressif/boards/adafruit_feather_esp32s2_tftback_nopsram/mpconfigboard.h +++ b/ports/espressif/boards/adafruit_feather_esp32s2_reverse_tft/mpconfigboard.h @@ -26,11 +26,11 @@ // Micropython setup -#define MICROPY_HW_BOARD_NAME "Feather ESP32S2 without PSRAM" +#define MICROPY_HW_BOARD_NAME "Adafruit Feather ESP32-S2 Reverse TFT" #define MICROPY_HW_MCU_NAME "ESP32S2" #define MICROPY_HW_NEOPIXEL (&pin_GPIO33) -#define CIRCUITPY_STATUS_LED_POWER (&pin_GPIO21) +#define CIRCUITPY_STATUS_LED_POWER (&pin_GPIO34) #define MICROPY_HW_LED_STATUS (&pin_GPIO13) @@ -41,4 +41,7 @@ #define DEFAULT_SPI_BUS_MOSI (&pin_GPIO35) #define DEFAULT_SPI_BUS_MISO (&pin_GPIO37) +#define DEFAULT_UART_BUS_RX (&pin_GPIO34) +#define DEFAULT_UART_BUS_TX (&pin_GPIO35) + #define DOUBLE_TAP_PIN (&pin_GPIO34) diff --git a/ports/espressif/boards/adafruit_feather_esp32s2_reverse_tft/mpconfigboard.mk b/ports/espressif/boards/adafruit_feather_esp32s2_reverse_tft/mpconfigboard.mk new file mode 100644 index 0000000000..920b748e3d --- /dev/null +++ b/ports/espressif/boards/adafruit_feather_esp32s2_reverse_tft/mpconfigboard.mk @@ -0,0 +1,11 @@ +USB_VID = 0x239A +USB_PID = 0x80EE + +USB_PRODUCT = "Feather ESP32-S2 Reverse TFT" +USB_MANUFACTURER = "Adafruit" + +IDF_TARGET = esp32s2 + +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/pins.c b/ports/espressif/boards/adafruit_feather_esp32s2_reverse_tft/pins.c similarity index 83% rename from ports/espressif/boards/adafruit_feather_esp32s2_tftback_nopsram/pins.c rename to ports/espressif/boards/adafruit_feather_esp32s2_reverse_tft/pins.c index 54b9051d73..32718700b1 100644 --- a/ports/espressif/boards/adafruit_feather_esp32s2_tftback_nopsram/pins.c +++ b/ports/espressif/boards/adafruit_feather_esp32s2_reverse_tft/pins.c @@ -5,22 +5,14 @@ STATIC const mp_rom_map_elem_t board_module_globals_table[] = { CIRCUITPYTHON_BOARD_DICT_STANDARD_ITEMS - { MP_ROM_QSTR(MP_QSTR_D0), MP_ROM_PTR(&pin_GPIO0) }, + { MP_ROM_QSTR(MP_QSTR_TX), MP_ROM_PTR(&pin_GPIO39) }, + { MP_ROM_QSTR(MP_QSTR_D39), MP_ROM_PTR(&pin_GPIO39) }, - { MP_ROM_QSTR(MP_QSTR_D3), MP_ROM_PTR(&pin_GPIO3) }, - { MP_ROM_QSTR(MP_QSTR_SDA), MP_ROM_PTR(&pin_GPIO3) }, - - { MP_ROM_QSTR(MP_QSTR_D4), MP_ROM_PTR(&pin_GPIO4) }, - { MP_ROM_QSTR(MP_QSTR_SCL), MP_ROM_PTR(&pin_GPIO4) }, + { MP_ROM_QSTR(MP_QSTR_RX), MP_ROM_PTR(&pin_GPIO38) }, + { MP_ROM_QSTR(MP_QSTR_D38), MP_ROM_PTR(&pin_GPIO38) }, { MP_ROM_QSTR(MP_QSTR_D5), MP_ROM_PTR(&pin_GPIO5) }, { MP_ROM_QSTR(MP_QSTR_D6), MP_ROM_PTR(&pin_GPIO6) }, - - { MP_ROM_QSTR(MP_QSTR_TFT_BACKLIGHT), MP_ROM_PTR(&pin_GPIO7) }, - - { MP_ROM_QSTR(MP_QSTR_D8), MP_ROM_PTR(&pin_GPIO8) }, - { MP_ROM_QSTR(MP_QSTR_A5), MP_ROM_PTR(&pin_GPIO8) }, - { MP_ROM_QSTR(MP_QSTR_D9), MP_ROM_PTR(&pin_GPIO9) }, { MP_ROM_QSTR(MP_QSTR_D10), MP_ROM_PTR(&pin_GPIO10) }, { MP_ROM_QSTR(MP_QSTR_D11), MP_ROM_PTR(&pin_GPIO11) }, @@ -30,46 +22,61 @@ STATIC const mp_rom_map_elem_t board_module_globals_table[] = { { MP_ROM_QSTR(MP_QSTR_D13), MP_ROM_PTR(&pin_GPIO13) }, { MP_ROM_QSTR(MP_QSTR_L), MP_ROM_PTR(&pin_GPIO13) }, - { MP_ROM_QSTR(MP_QSTR_D14), MP_ROM_PTR(&pin_GPIO14) }, + { MP_ROM_QSTR(MP_QSTR_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_D15), MP_ROM_PTR(&pin_GPIO15) }, { 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_D16), MP_ROM_PTR(&pin_GPIO16) }, { 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_D17), MP_ROM_PTR(&pin_GPIO17) }, { 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_D18), MP_ROM_PTR(&pin_GPIO18) }, { 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_NEOPIXEL_POWER), MP_ROM_PTR(&pin_GPIO21) }, + + { MP_ROM_QSTR(MP_QSTR_TFT_I2C_POWER), MP_ROM_PTR(&pin_GPIO7) }, - { MP_ROM_QSTR(MP_QSTR_D35), MP_ROM_PTR(&pin_GPIO35) }, { MP_ROM_QSTR(MP_QSTR_MOSI), MP_ROM_PTR(&pin_GPIO35) }, + { MP_ROM_QSTR(MP_QSTR_D35), MP_ROM_PTR(&pin_GPIO35) }, - { MP_ROM_QSTR(MP_QSTR_D36), MP_ROM_PTR(&pin_GPIO36) }, { MP_ROM_QSTR(MP_QSTR_SCK), MP_ROM_PTR(&pin_GPIO36) }, + { MP_ROM_QSTR(MP_QSTR_D36), MP_ROM_PTR(&pin_GPIO36) }, - { MP_ROM_QSTR(MP_QSTR_D37), MP_ROM_PTR(&pin_GPIO37) }, { MP_ROM_QSTR(MP_QSTR_MISO), MP_ROM_PTR(&pin_GPIO37) }, + { MP_ROM_QSTR(MP_QSTR_D37), MP_ROM_PTR(&pin_GPIO37) }, - { MP_ROM_QSTR(MP_QSTR_D38), MP_ROM_PTR(&pin_GPIO38) }, - { MP_ROM_QSTR(MP_QSTR_RX), MP_ROM_PTR(&pin_GPIO38) }, + { MP_ROM_QSTR(MP_QSTR_SCL), MP_ROM_PTR(&pin_GPIO4) }, + { MP_ROM_QSTR(MP_QSTR_D4), MP_ROM_PTR(&pin_GPIO4) }, - { MP_ROM_QSTR(MP_QSTR_D39), MP_ROM_PTR(&pin_GPIO39) }, - { MP_ROM_QSTR(MP_QSTR_TX), MP_ROM_PTR(&pin_GPIO39) }, + { MP_ROM_QSTR(MP_QSTR_SDA), MP_ROM_PTR(&pin_GPIO3) }, + { MP_ROM_QSTR(MP_QSTR_D3), MP_ROM_PTR(&pin_GPIO3) }, + { MP_ROM_QSTR(MP_QSTR_TFT_CS), MP_ROM_PTR(&pin_GPIO42) }, { MP_ROM_QSTR(MP_QSTR_TFT_DC), MP_ROM_PTR(&pin_GPIO40) }, { MP_ROM_QSTR(MP_QSTR_TFT_RESET), MP_ROM_PTR(&pin_GPIO41) }, - { MP_ROM_QSTR(MP_QSTR_TFT_CS), MP_ROM_PTR(&pin_GPIO42) }, + { MP_ROM_QSTR(MP_QSTR_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_D0), MP_ROM_PTR(&pin_GPIO0) }, + + { MP_ROM_QSTR(MP_QSTR_D1), MP_ROM_PTR(&pin_GPIO1) }, + { MP_ROM_QSTR(MP_QSTR_D2), MP_ROM_PTR(&pin_GPIO2) }, { MP_ROM_QSTR(MP_QSTR_I2C), MP_ROM_PTR(&board_i2c_obj) }, + { MP_ROM_QSTR(MP_QSTR_STEMMA_I2C), MP_ROM_PTR(&board_i2c_obj) }, { 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_ROM_QSTR(MP_QSTR_DISPLAY), MP_ROM_PTR(&displays[0].display)} }; MP_DEFINE_CONST_DICT(board_module_globals, board_module_globals_table); diff --git a/ports/espressif/boards/adafruit_feather_esp32s2_reverse_tft/sdkconfig b/ports/espressif/boards/adafruit_feather_esp32s2_reverse_tft/sdkconfig new file mode 100644 index 0000000000..f19afafa3d --- /dev/null +++ b/ports/espressif/boards/adafruit_feather_esp32s2_reverse_tft/sdkconfig @@ -0,0 +1,37 @@ +CONFIG_ESP32S2_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 +# 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 is not set +CONFIG_SPIRAM_SPEED_40M=y +# 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="espressif" +# end of LWIP diff --git a/ports/espressif/boards/adafruit_feather_esp32s2_tftback_nopsram/mpconfigboard.mk b/ports/espressif/boards/adafruit_feather_esp32s2_tftback_nopsram/mpconfigboard.mk deleted file mode 100644 index b07161cee3..0000000000 --- a/ports/espressif/boards/adafruit_feather_esp32s2_tftback_nopsram/mpconfigboard.mk +++ /dev/null @@ -1,15 +0,0 @@ -USB_VID = 0x239A -USB_PID = 0x80EE -USB_PRODUCT = "Feather ESP32S2 TFT no PSRAM" -USB_MANUFACTURER = "Adafruit" - -IDF_TARGET = esp32s2 - -CIRCUITPY_ESP_FLASH_MODE = dio -CIRCUITPY_ESP_FLASH_FREQ = 40m -CIRCUITPY_ESP_FLASH_SIZE = 4MB - -FROZEN_MPY_DIRS += $(TOP)/frozen/Adafruit_CircuitPython_Requests -FROZEN_MPY_DIRS += $(TOP)/frozen/Adafruit_CircuitPython_NeoPixel -FROZEN_MPY_DIRS += $(TOP)/frozen/Adafruit_CircuitPython_Register -CIRCUITPY_ESP32_CAMERA = 0 diff --git a/ports/espressif/boards/adafruit_feather_esp32s2_tftback_nopsram/sdkconfig b/ports/espressif/boards/adafruit_feather_esp32s2_tftback_nopsram/sdkconfig deleted file mode 100644 index 5b9c86dcc3..0000000000 --- a/ports/espressif/boards/adafruit_feather_esp32s2_tftback_nopsram/sdkconfig +++ /dev/null @@ -1,6 +0,0 @@ -# CONFIG_ESP32S2_SPIRAM_SUPPORT is not set -# -# LWIP -# -CONFIG_LWIP_LOCAL_HOSTNAME="espressif" -# end of LWIP diff --git a/ports/espressif/boards/adafruit_feather_esp32s3_4mbflash_2mbpsram/mpconfigboard.mk b/ports/espressif/boards/adafruit_feather_esp32s3_4mbflash_2mbpsram/mpconfigboard.mk index 4ecf6aa969..a8d02f082c 100644 --- a/ports/espressif/boards/adafruit_feather_esp32s3_4mbflash_2mbpsram/mpconfigboard.mk +++ b/ports/espressif/boards/adafruit_feather_esp32s3_4mbflash_2mbpsram/mpconfigboard.mk @@ -10,4 +10,4 @@ CIRCUITPY_ESP_FLASH_FREQ = 40m CIRCUITPY_ESP_FLASH_SIZE = 4MB OPTIMIZATION_FLAGS = -Os -CIRCUITPY_ESP32_CAMERA = 0 +CIRCUITPY_ESPCAMERA = 0 diff --git a/ports/espressif/boards/adafruit_feather_esp32s3_nopsram/mpconfigboard.mk b/ports/espressif/boards/adafruit_feather_esp32s3_nopsram/mpconfigboard.mk index 3c1cf0d609..582ed4409c 100644 --- a/ports/espressif/boards/adafruit_feather_esp32s3_nopsram/mpconfigboard.mk +++ b/ports/espressif/boards/adafruit_feather_esp32s3_nopsram/mpconfigboard.mk @@ -8,4 +8,4 @@ IDF_TARGET = esp32s3 CIRCUITPY_ESP_FLASH_MODE = qio CIRCUITPY_ESP_FLASH_FREQ = 80m CIRCUITPY_ESP_FLASH_SIZE = 8MB -CIRCUITPY_ESP32_CAMERA = 0 +CIRCUITPY_ESPCAMERA = 0 diff --git a/ports/espressif/boards/adafruit_feather_esp32s3_reverse_tft/board.c b/ports/espressif/boards/adafruit_feather_esp32s3_reverse_tft/board.c new file mode 100644 index 0000000000..360c71804c --- /dev/null +++ b/ports/espressif/boards/adafruit_feather_esp32s3_reverse_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_GPIO40, // DC + &pin_GPIO42, // CS + &pin_GPIO41, // 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_reverse_tft/mpconfigboard.h b/ports/espressif/boards/adafruit_feather_esp32s3_reverse_tft/mpconfigboard.h new file mode 100644 index 0000000000..cb0237c3e5 --- /dev/null +++ b/ports/espressif/boards/adafruit_feather_esp32s3_reverse_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 Reverse 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_GPIO4) +#define DEFAULT_I2C_BUS_SDA (&pin_GPIO3) + +#define DEFAULT_SPI_BUS_SCK (&pin_GPIO36) +#define DEFAULT_SPI_BUS_MOSI (&pin_GPIO35) +#define DEFAULT_SPI_BUS_MISO (&pin_GPIO37) + +#define DEFAULT_UART_BUS_RX (&pin_GPIO34) +#define DEFAULT_UART_BUS_TX (&pin_GPIO35) + +#define DOUBLE_TAP_PIN (&pin_GPIO34) diff --git a/ports/espressif/boards/adafruit_feather_esp32s3_reverse_tft/mpconfigboard.mk b/ports/espressif/boards/adafruit_feather_esp32s3_reverse_tft/mpconfigboard.mk new file mode 100644 index 0000000000..3fdb028f5e --- /dev/null +++ b/ports/espressif/boards/adafruit_feather_esp32s3_reverse_tft/mpconfigboard.mk @@ -0,0 +1,11 @@ +USB_VID = 0x239A +USB_PID = 0x8124 + +USB_PRODUCT = "Feather ESP32-S3 Reverse TFT" +USB_MANUFACTURER = "Adafruit" + +IDF_TARGET = esp32s3 + +CIRCUITPY_ESP_FLASH_MODE = dio +CIRCUITPY_ESP_FLASH_FREQ = 40m +CIRCUITPY_ESP_FLASH_SIZE = 4MB diff --git a/ports/espressif/boards/adafruit_feather_esp32s3_reverse_tft/pins.c b/ports/espressif/boards/adafruit_feather_esp32s3_reverse_tft/pins.c new file mode 100644 index 0000000000..32718700b1 --- /dev/null +++ b/ports/espressif/boards/adafruit_feather_esp32s3_reverse_tft/pins.c @@ -0,0 +1,82 @@ +#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_GPIO39) }, + { MP_ROM_QSTR(MP_QSTR_D39), MP_ROM_PTR(&pin_GPIO39) }, + + { 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_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_GPIO21) }, + + { MP_ROM_QSTR(MP_QSTR_TFT_I2C_POWER), MP_ROM_PTR(&pin_GPIO7) }, + + { 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_GPIO4) }, + { MP_ROM_QSTR(MP_QSTR_D4), MP_ROM_PTR(&pin_GPIO4) }, + + { 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_TFT_CS), MP_ROM_PTR(&pin_GPIO42) }, + { MP_ROM_QSTR(MP_QSTR_TFT_DC), MP_ROM_PTR(&pin_GPIO40) }, + { MP_ROM_QSTR(MP_QSTR_TFT_RESET), MP_ROM_PTR(&pin_GPIO41) }, + { MP_ROM_QSTR(MP_QSTR_TFT_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_D0), MP_ROM_PTR(&pin_GPIO0) }, + + { MP_ROM_QSTR(MP_QSTR_D1), MP_ROM_PTR(&pin_GPIO1) }, + { MP_ROM_QSTR(MP_QSTR_D2), MP_ROM_PTR(&pin_GPIO2) }, + + { MP_ROM_QSTR(MP_QSTR_I2C), MP_ROM_PTR(&board_i2c_obj) }, + { MP_ROM_QSTR(MP_QSTR_STEMMA_I2C), MP_ROM_PTR(&board_i2c_obj) }, + { 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_reverse_tft/sdkconfig b/ports/espressif/boards/adafruit_feather_esp32s3_reverse_tft/sdkconfig new file mode 100644 index 0000000000..9a05ab0205 --- /dev/null +++ b/ports/espressif/boards/adafruit_feather_esp32s3_reverse_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_esp32s3_tft/mpconfigboard.mk b/ports/espressif/boards/adafruit_feather_esp32s3_tft/mpconfigboard.mk index baff69b1ac..858d0b1859 100644 --- a/ports/espressif/boards/adafruit_feather_esp32s3_tft/mpconfigboard.mk +++ b/ports/espressif/boards/adafruit_feather_esp32s3_tft/mpconfigboard.mk @@ -11,4 +11,4 @@ CIRCUITPY_ESP_FLASH_FREQ = 40m CIRCUITPY_ESP_FLASH_SIZE = 4MB OPTIMIZATION_FLAGS = -Os -CIRCUITPY_ESP32_CAMERA = 0 +CIRCUITPY_ESPCAMERA = 0 diff --git a/ports/espressif/boards/adafruit_feather_huzzah32/mpconfigboard.mk b/ports/espressif/boards/adafruit_feather_huzzah32/mpconfigboard.mk index 221543547c..c314f90246 100644 --- a/ports/espressif/boards/adafruit_feather_huzzah32/mpconfigboard.mk +++ b/ports/espressif/boards/adafruit_feather_huzzah32/mpconfigboard.mk @@ -6,4 +6,4 @@ IDF_TARGET = esp32 CIRCUITPY_ESP_FLASH_MODE = dio CIRCUITPY_ESP_FLASH_FREQ = 40m CIRCUITPY_ESP_FLASH_SIZE = 4MB -CIRCUITPY_ESP32_CAMERA = 0 +CIRCUITPY_ESPCAMERA = 0 diff --git a/ports/espressif/boards/adafruit_funhouse/mpconfigboard.mk b/ports/espressif/boards/adafruit_funhouse/mpconfigboard.mk index 8b08c94022..7d5c91f154 100644 --- a/ports/espressif/boards/adafruit_funhouse/mpconfigboard.mk +++ b/ports/espressif/boards/adafruit_funhouse/mpconfigboard.mk @@ -9,7 +9,7 @@ CIRCUITPY_ESP_FLASH_MODE = dio CIRCUITPY_ESP_FLASH_FREQ = 40m CIRCUITPY_ESP_FLASH_SIZE = 4MB -CIRCUITPY_ESP32_CAMERA = 0 +CIRCUITPY_ESPCAMERA = 0 # Include these Python libraries in firmware. FROZEN_MPY_DIRS += $(TOP)/frozen/Adafruit_CircuitPython_PortalBase diff --git a/ports/espressif/boards/adafruit_magtag_2.9_grayscale/mpconfigboard.mk b/ports/espressif/boards/adafruit_magtag_2.9_grayscale/mpconfigboard.mk index ee2bfdb069..d941039078 100644 --- a/ports/espressif/boards/adafruit_magtag_2.9_grayscale/mpconfigboard.mk +++ b/ports/espressif/boards/adafruit_magtag_2.9_grayscale/mpconfigboard.mk @@ -9,7 +9,7 @@ CIRCUITPY_ESP_FLASH_MODE = dio CIRCUITPY_ESP_FLASH_FREQ = 40m CIRCUITPY_ESP_FLASH_SIZE = 4MB -CIRCUITPY_ESP32_CAMERA = 0 +CIRCUITPY_ESPCAMERA = 0 # Include these Python libraries in firmware. FROZEN_MPY_DIRS += $(TOP)/frozen/Adafruit_CircuitPython_PortalBase diff --git a/ports/espressif/boards/adafruit_qtpy_esp32s3_nopsram/mpconfigboard.mk b/ports/espressif/boards/adafruit_qtpy_esp32s3_nopsram/mpconfigboard.mk index 15dd51e5ff..e695bae635 100644 --- a/ports/espressif/boards/adafruit_qtpy_esp32s3_nopsram/mpconfigboard.mk +++ b/ports/espressif/boards/adafruit_qtpy_esp32s3_nopsram/mpconfigboard.mk @@ -13,4 +13,4 @@ CIRCUITPY_ESP_FLASH_SIZE = 8MB FROZEN_MPY_DIRS += $(TOP)/frozen/Adafruit_CircuitPython_Requests FROZEN_MPY_DIRS += $(TOP)/frozen/Adafruit_CircuitPython_NeoPixel FROZEN_MPY_DIRS += $(TOP)/frozen/Adafruit_CircuitPython_Register -CIRCUITPY_ESP32_CAMERA = 0 +CIRCUITPY_ESPCAMERA = 0 diff --git a/ports/espressif/boards/bpi_bit_s2/mpconfigboard.h b/ports/espressif/boards/bpi_bit_s2/mpconfigboard.h index 5225325454..ddb51cdb6d 100644 --- a/ports/espressif/boards/bpi_bit_s2/mpconfigboard.h +++ b/ports/espressif/boards/bpi_bit_s2/mpconfigboard.h @@ -30,6 +30,7 @@ #define MICROPY_HW_MCU_NAME "ESP32S2" // #define MICROPY_HW_NEOPIXEL (&pin_GPIO18) +#define MICROPY_HW_LED_STATUS (&pin_GPIO0) #define DEFAULT_I2C_BUS_SCL (&pin_GPIO16) #define DEFAULT_I2C_BUS_SDA (&pin_GPIO15) diff --git a/ports/espressif/boards/bpi_picow_s3/mpconfigboard.h b/ports/espressif/boards/bpi_picow_s3/mpconfigboard.h index f7e7fde31b..a261ed17fa 100644 --- a/ports/espressif/boards/bpi_picow_s3/mpconfigboard.h +++ b/ports/espressif/boards/bpi_picow_s3/mpconfigboard.h @@ -31,6 +31,8 @@ #define MICROPY_HW_NEOPIXEL (&pin_GPIO48) +#define MICROPY_HW_LED_STATUS (&pin_GPIO46) + #define DEFAULT_UART_BUS_RX (&pin_GPIO44) #define DEFAULT_UART_BUS_TX (&pin_GPIO43) diff --git a/ports/espressif/boards/brainboardz_neuron/board.c b/ports/espressif/boards/brainboardz_neuron/board.c new file mode 100755 index 0000000000..3b1f5efd87 --- /dev/null +++ b/ports/espressif/boards/brainboardz_neuron/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 +} + +// Use the MP_WEAK supervisor/shared/board.c versions of routines not defined here. diff --git a/ports/stm/fatfs_port.c b/ports/espressif/boards/brainboardz_neuron/mpconfigboard.h old mode 100644 new mode 100755 similarity index 79% rename from ports/stm/fatfs_port.c rename to ports/espressif/boards/brainboardz_neuron/mpconfigboard.h index 631f7f0982..9507917ead --- a/ports/stm/fatfs_port.c +++ b/ports/espressif/boards/brainboardz_neuron/mpconfigboard.h @@ -3,7 +3,7 @@ * * The MIT License (MIT) * - * SPDX-FileCopyrightText: Copyright (c) 2013, 2014 Damien P. George + * 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,10 @@ * THE SOFTWARE. */ -#include "py/runtime.h" -#include "lib/oofatfs/ff.h" +// Micropython setup -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); -} +#define MICROPY_HW_BOARD_NAME "Neuron" +#define MICROPY_HW_MCU_NAME "ESP32S3" + +#define DEFAULT_UART_BUS_RX (&pin_GPIO44) +#define DEFAULT_UART_BUS_TX (&pin_GPIO43) diff --git a/ports/espressif/boards/brainboardz_neuron/mpconfigboard.mk b/ports/espressif/boards/brainboardz_neuron/mpconfigboard.mk new file mode 100755 index 0000000000..1083b18264 --- /dev/null +++ b/ports/espressif/boards/brainboardz_neuron/mpconfigboard.mk @@ -0,0 +1,11 @@ +USB_VID = 0x303A +USB_PID = 0x80C8 + +USB_PRODUCT = "Neuron" +USB_MANUFACTURER = "BrainBoardz" + +IDF_TARGET = esp32s3 + +CIRCUITPY_ESP_FLASH_MODE=dio +CIRCUITPY_ESP_FLASH_FREQ=80m +CIRCUITPY_ESP_FLASH_SIZE=8MB diff --git a/ports/espressif/boards/brainboardz_neuron/pins.c b/ports/espressif/boards/brainboardz_neuron/pins.c new file mode 100755 index 0000000000..b0cbb91563 --- /dev/null +++ b/ports/espressif/boards/brainboardz_neuron/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_BT), MP_ROM_PTR(&pin_GPIO0) }, + + { MP_ROM_QSTR(MP_QSTR_IO1), MP_ROM_PTR(&pin_GPIO1) }, + { MP_ROM_QSTR(MP_QSTR_IO2), MP_ROM_PTR(&pin_GPIO2) }, + { MP_ROM_QSTR(MP_QSTR_IO3), MP_ROM_PTR(&pin_GPIO3) }, + { 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_SDA), MP_ROM_PTR(&pin_GPIO8) }, + + { MP_ROM_QSTR(MP_QSTR_IO9), MP_ROM_PTR(&pin_GPIO9) }, + { MP_ROM_QSTR(MP_QSTR_SCL), MP_ROM_PTR(&pin_GPIO9) }, + + { MP_ROM_QSTR(MP_QSTR_IO10), MP_ROM_PTR(&pin_GPIO10) }, + { MP_ROM_QSTR(MP_QSTR_IO11), MP_ROM_PTR(&pin_GPIO11) }, + { MP_ROM_QSTR(MP_QSTR_IO12), MP_ROM_PTR(&pin_GPIO12) }, + + { MP_ROM_QSTR(MP_QSTR_IO13), MP_ROM_PTR(&pin_GPIO13) }, + { MP_ROM_QSTR(MP_QSTR_SD_MISO), MP_ROM_PTR(&pin_GPIO13) }, + + { MP_ROM_QSTR(MP_QSTR_IO14), MP_ROM_PTR(&pin_GPIO14) }, + { MP_ROM_QSTR(MP_QSTR_SD_CLK), MP_ROM_PTR(&pin_GPIO14) }, + + { MP_ROM_QSTR(MP_QSTR_IO15), MP_ROM_PTR(&pin_GPIO15) }, + { MP_ROM_QSTR(MP_QSTR_SD_MOSI), MP_ROM_PTR(&pin_GPIO15) }, + + { MP_ROM_QSTR(MP_QSTR_IO16), MP_ROM_PTR(&pin_GPIO16) }, + { MP_ROM_QSTR(MP_QSTR_SD_CS), MP_ROM_PTR(&pin_GPIO16) }, + + { MP_ROM_QSTR(MP_QSTR_IO17), MP_ROM_PTR(&pin_GPIO17) }, + { MP_ROM_QSTR(MP_QSTR_IO18), MP_ROM_PTR(&pin_GPIO18) }, + { MP_ROM_QSTR(MP_QSTR_IO19), MP_ROM_PTR(&pin_GPIO19) }, + { MP_ROM_QSTR(MP_QSTR_IO20), MP_ROM_PTR(&pin_GPIO20) }, + + { MP_ROM_QSTR(MP_QSTR_IO21), MP_ROM_PTR(&pin_GPIO21) }, + { MP_ROM_QSTR(MP_QSTR_LED), MP_ROM_PTR(&pin_GPIO21) }, + + { MP_ROM_QSTR(MP_QSTR_IO35), MP_ROM_PTR(&pin_GPIO35) }, + { MP_ROM_QSTR(MP_QSTR_IO36), MP_ROM_PTR(&pin_GPIO36) }, + { MP_ROM_QSTR(MP_QSTR_IO37), MP_ROM_PTR(&pin_GPIO37) }, + { 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_TX), MP_ROM_PTR(&pin_GPIO43) }, + + { MP_ROM_QSTR(MP_QSTR_IO44), MP_ROM_PTR(&pin_GPIO44) }, + { MP_ROM_QSTR(MP_QSTR_RX), MP_ROM_PTR(&pin_GPIO44) }, + + { MP_ROM_QSTR(MP_QSTR_IO45), MP_ROM_PTR(&pin_GPIO45) }, + { MP_ROM_QSTR(MP_QSTR_IO46), MP_ROM_PTR(&pin_GPIO46) }, + { MP_ROM_QSTR(MP_QSTR_IO47), MP_ROM_PTR(&pin_GPIO47) }, + { MP_ROM_QSTR(MP_QSTR_IO48), MP_ROM_PTR(&pin_GPIO48) }, + +}; +MP_DEFINE_CONST_DICT(board_module_globals, board_module_globals_table); diff --git a/ports/espressif/boards/brainboardz_neuron/sdkconfig b/ports/espressif/boards/brainboardz_neuron/sdkconfig new file mode 100755 index 0000000000..39bd2cdb4e --- /dev/null +++ b/ports/espressif/boards/brainboardz_neuron/sdkconfig @@ -0,0 +1,34 @@ +CONFIG_ESP32S3_SPIRAM_SUPPORT=y +# +# SPI RAM config +# +# CONFIG_SPIRAM_MODE_QUAD is not set +CONFIG_SPIRAM_MODE_OCT=y +# CONFIG_SPIRAM_TYPE_AUTO is not set +CONFIG_SPIRAM_TYPE_ESPPSRAM64=y +CONFIG_SPIRAM_SIZE=8388608 +# end of SPI RAM config + +CONFIG_DEFAULT_PSRAM_CLK_IO=30 +# +# PSRAM Clock and CS IO for ESP32S3 +# +CONFIG_DEFAULT_PSRAM_CS_IO=26 +# end of PSRAM Clock and CS IO for ESP32S3 + +# CONFIG_SPIRAM_FETCH_INSTRUCTIONS is not set +# CONFIG_SPIRAM_RODATA is not set +CONFIG_SPIRAM_SPEED_80M=y +# CONFIG_SPIRAM_SPEED_40M is not set +CONFIG_SPIRAM=y +CONFIG_SPIRAM_BOOT_INIT=y +# CONFIG_SPIRAM_IGNORE_NOTFOUND is not set +CONFIG_SPIRAM_USE_MEMMAP=y +# CONFIG_SPIRAM_USE_CAPS_ALLOC is not set +# CONFIG_SPIRAM_USE_MALLOC is not set +CONFIG_SPIRAM_MEMTEST=y +# +# LWIP +# +CONFIG_LWIP_LOCAL_HOSTNAME="BrainBoardzNeuron" +# end of LWIP diff --git a/ports/espressif/boards/crcibernetica-ideaboard/mpconfigboard.mk b/ports/espressif/boards/crcibernetica-ideaboard/mpconfigboard.mk index cbc468b3ec..5862ee1192 100644 --- a/ports/espressif/boards/crcibernetica-ideaboard/mpconfigboard.mk +++ b/ports/espressif/boards/crcibernetica-ideaboard/mpconfigboard.mk @@ -5,5 +5,11 @@ IDF_TARGET = esp32 CIRCUITPY_ESP_FLASH_MODE = dio CIRCUITPY_ESP_FLASH_FREQ = 40m -CIRCUITPY_ESP_FLASH_SIZE = 16MB -CIRCUITPY_ESP32_CAMERA = 0 +CIRCUITPY_ESP_FLASH_SIZE = 8MB +CIRCUITPY_ESPCAMERA = 0 + +# Include these Python libraries in firmware +FROZEN_MPY_DIRS += $(TOP)/frozen/Adafruit_CircuitPython_Requests +FROZEN_MPY_DIRS += $(TOP)/frozen/Adafruit_CircuitPython_NeoPixel +FROZEN_MPY_DIRS += $(TOP)/frozen/Adafruit_CircuitPython_SimpleIO +FROZEN_MPY_DIRS += $(TOP)/frozen/Adafruit_CircuitPython_Motor diff --git a/ports/espressif/boards/doit_esp32_devkit_v1/board.c b/ports/espressif/boards/doit_esp32_devkit_v1/board.c new file mode 100644 index 0000000000..164430c88c --- /dev/null +++ b/ports/espressif/boards/doit_esp32_devkit_v1/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/broadcom/fatfs_port.c b/ports/espressif/boards/doit_esp32_devkit_v1/mpconfigboard.h similarity index 61% rename from ports/broadcom/fatfs_port.c rename to ports/espressif/boards/doit_esp32_devkit_v1/mpconfigboard.h index 58a0ef0d72..2a0dcd0104 100644 --- a/ports/broadcom/fatfs_port.c +++ b/ports/espressif/boards/doit_esp32_devkit_v1/mpconfigboard.h @@ -3,7 +3,7 @@ * * The MIT License (MIT) * - * SPDX-FileCopyrightText: Copyright (c) 2013, 2014 Damien P. George + * 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 @@ -24,25 +24,22 @@ * THE SOFTWARE. */ -#include "py/mphal.h" -#include "py/runtime.h" -#include "lib/oofatfs/ff.h" /* FatFs lower layer API */ -#include "lib/oofatfs/diskio.h" /* FatFs lower layer API */ -#include "shared/timeutils/timeutils.h" +// Micropython setup -#if CIRCUITPY_RTC -#include "shared-bindings/rtc/RTC.h" -#endif +#define MICROPY_HW_BOARD_NAME "ESP32 Devkit V1" +#define MICROPY_HW_MCU_NAME "ESP32" -DWORD get_fattime(void) { - #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 +#define MICROPY_HW_LED_STATUS (&pin_GPIO2) +#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_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/doit_esp32_devkit_v1/mpconfigboard.mk b/ports/espressif/boards/doit_esp32_devkit_v1/mpconfigboard.mk new file mode 100644 index 0000000000..23f905dfdf --- /dev/null +++ b/ports/espressif/boards/doit_esp32_devkit_v1/mpconfigboard.mk @@ -0,0 +1,9 @@ +CIRCUITPY_CREATOR_ID = 0xB0D00000 +CIRCUITPY_CREATION_ID = 0x00320002 + +IDF_TARGET = esp32 + +CIRCUITPY_ESP_FLASH_MODE = dio +CIRCUITPY_ESP_FLASH_FREQ = 40m +CIRCUITPY_ESP_FLASH_SIZE = 4MB +CIRCUITPY_ESPCAMERA = 0 diff --git a/ports/espressif/boards/doit_esp32_devkit_v1/pins.c b/ports/espressif/boards/doit_esp32_devkit_v1/pins.c new file mode 100644 index 0000000000..78c37897ac --- /dev/null +++ b/ports/espressif/boards/doit_esp32_devkit_v1/pins.c @@ -0,0 +1,46 @@ +#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_D15), MP_ROM_PTR(&pin_GPIO15)}, + {MP_ROM_QSTR(MP_QSTR_D2), MP_ROM_PTR(&pin_GPIO2)}, + {MP_ROM_QSTR(MP_QSTR_RX2), MP_ROM_PTR(&pin_GPIO16)}, + {MP_ROM_QSTR(MP_QSTR_TX2), MP_ROM_PTR(&pin_GPIO17)}, + {MP_ROM_QSTR(MP_QSTR_D5), MP_ROM_PTR(&pin_GPIO5)}, + {MP_ROM_QSTR(MP_QSTR_D18), MP_ROM_PTR(&pin_GPIO18)}, + {MP_ROM_QSTR(MP_QSTR_D19), MP_ROM_PTR(&pin_GPIO19)}, + {MP_ROM_QSTR(MP_QSTR_D21), MP_ROM_PTR(&pin_GPIO21)}, + {MP_ROM_QSTR(MP_QSTR_RX0), MP_ROM_PTR(&pin_GPIO1)}, + {MP_ROM_QSTR(MP_QSTR_TX0), MP_ROM_PTR(&pin_GPIO3)}, + {MP_ROM_QSTR(MP_QSTR_D22), MP_ROM_PTR(&pin_GPIO22)}, + {MP_ROM_QSTR(MP_QSTR_D23), MP_ROM_PTR(&pin_GPIO23)}, + {MP_ROM_QSTR(MP_QSTR_D13), MP_ROM_PTR(&pin_GPIO13)}, + {MP_ROM_QSTR(MP_QSTR_D12), MP_ROM_PTR(&pin_GPIO12)}, + {MP_ROM_QSTR(MP_QSTR_D14), MP_ROM_PTR(&pin_GPIO14)}, + {MP_ROM_QSTR(MP_QSTR_D27), MP_ROM_PTR(&pin_GPIO27)}, + {MP_ROM_QSTR(MP_QSTR_D26), MP_ROM_PTR(&pin_GPIO26)}, + {MP_ROM_QSTR(MP_QSTR_D25), MP_ROM_PTR(&pin_GPIO25)}, + {MP_ROM_QSTR(MP_QSTR_D33), MP_ROM_PTR(&pin_GPIO33)}, + {MP_ROM_QSTR(MP_QSTR_D32), MP_ROM_PTR(&pin_GPIO32)}, + {MP_ROM_QSTR(MP_QSTR_D35), MP_ROM_PTR(&pin_GPIO35)}, + {MP_ROM_QSTR(MP_QSTR_D34), MP_ROM_PTR(&pin_GPIO34)}, + + {MP_ROM_QSTR(MP_QSTR_LED), MP_ROM_PTR(&pin_GPIO2)}, + + {MP_ROM_QSTR(MP_QSTR_SDA), MP_ROM_PTR(&pin_GPIO21)}, + {MP_ROM_QSTR(MP_QSTR_SCL), MP_ROM_PTR(&pin_GPIO22)}, + + {MP_ROM_QSTR(MP_QSTR_SCK), MP_ROM_PTR(&pin_GPIO18)}, + {MP_ROM_QSTR(MP_QSTR_MOSI), MP_ROM_PTR(&pin_GPIO23)}, + {MP_ROM_QSTR(MP_QSTR_MISO), MP_ROM_PTR(&pin_GPIO19)}, + + {MP_ROM_QSTR(MP_QSTR_TX), MP_ROM_PTR(&pin_GPIO17)}, + {MP_ROM_QSTR(MP_QSTR_RX), MP_ROM_PTR(&pin_GPIO16)}, + + {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/doit_esp32_devkit_v1/sdkconfig b/ports/espressif/boards/doit_esp32_devkit_v1/sdkconfig new file mode 100644 index 0000000000..6c0168c829 --- /dev/null +++ b/ports/espressif/boards/doit_esp32_devkit_v1/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/electroniccats_bastwifi/mpconfigboard.mk b/ports/espressif/boards/electroniccats_bastwifi/mpconfigboard.mk index 67e88a1639..73acab519c 100644 --- a/ports/espressif/boards/electroniccats_bastwifi/mpconfigboard.mk +++ b/ports/espressif/boards/electroniccats_bastwifi/mpconfigboard.mk @@ -10,4 +10,4 @@ CIRCUITPY_NEOPIXEL_WRITE = 0 CIRCUITPY_ESP_FLASH_MODE = dio CIRCUITPY_ESP_FLASH_FREQ = 40m CIRCUITPY_ESP_FLASH_SIZE = 4MB -CIRCUITPY_ESP32_CAMERA = 0 +CIRCUITPY_ESPCAMERA = 0 diff --git a/ports/espressif/boards/espressif_esp32s2_devkitc_1_n4/mpconfigboard.mk b/ports/espressif/boards/espressif_esp32s2_devkitc_1_n4/mpconfigboard.mk index 31e79b2425..d92eff48d0 100644 --- a/ports/espressif/boards/espressif_esp32s2_devkitc_1_n4/mpconfigboard.mk +++ b/ports/espressif/boards/espressif_esp32s2_devkitc_1_n4/mpconfigboard.mk @@ -8,4 +8,4 @@ IDF_TARGET = esp32s2 CIRCUITPY_ESP_FLASH_MODE = dio CIRCUITPY_ESP_FLASH_FREQ = 40m CIRCUITPY_ESP_FLASH_SIZE = 4MB -CIRCUITPY_ESP32_CAMERA = 0 +CIRCUITPY_ESPCAMERA = 0 diff --git a/ports/espressif/boards/espressif_esp32s3_box/mpconfigboard.mk b/ports/espressif/boards/espressif_esp32s3_box/mpconfigboard.mk index 7ffb076348..5a2a4794bd 100644 --- a/ports/espressif/boards/espressif_esp32s3_box/mpconfigboard.mk +++ b/ports/espressif/boards/espressif_esp32s3_box/mpconfigboard.mk @@ -9,4 +9,4 @@ CIRCUITPY_ESP_FLASH_MODE = dio CIRCUITPY_ESP_FLASH_FREQ = 40m CIRCUITPY_ESP_FLASH_SIZE = 16MB -CIRCUITPY_ESP32_CAMERA = 0 +CIRCUITPY_ESPCAMERA = 0 diff --git a/ports/espressif/boards/espressif_esp32s3_box_lite/mpconfigboard.mk b/ports/espressif/boards/espressif_esp32s3_box_lite/mpconfigboard.mk index 2e63089b9c..a4bd29fa52 100644 --- a/ports/espressif/boards/espressif_esp32s3_box_lite/mpconfigboard.mk +++ b/ports/espressif/boards/espressif_esp32s3_box_lite/mpconfigboard.mk @@ -5,6 +5,8 @@ USB_MANUFACTURER = "Espressif" IDF_TARGET = esp32s3 -CIRCUITPY_ESP_FLASH_MODE=dio -CIRCUITPY_ESP_FLASH_FREQ=40m -CIRCUITPY_ESP_FLASH_SIZE=16MB +CIRCUITPY_ESP_FLASH_MODE = dio +CIRCUITPY_ESP_FLASH_FREQ = 40m +CIRCUITPY_ESP_FLASH_SIZE = 16MB + +CIRCUITPY_ESPCAMERA = 0 diff --git a/ports/espressif/boards/espressif_esp32s3_box_lite/sdkconfig b/ports/espressif/boards/espressif_esp32s3_box_lite/sdkconfig index 7fcf8ef297..ead0088da5 100644 --- a/ports/espressif/boards/espressif_esp32s3_box_lite/sdkconfig +++ b/ports/espressif/boards/espressif_esp32s3_box_lite/sdkconfig @@ -1,35 +1,11 @@ -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_MODE_OCT=y +CONFIG_SPIRAM_SPEED_80M=y +CONFIG_SPIRAM_TYPE_AUTO=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 +CONFIG_SPIRAM_USE_MEMMAP=y + # # LWIP # diff --git a/ports/espressif/boards/espressif_esp32s3_devkitc_1_n32r8/board.c b/ports/espressif/boards/espressif_esp32s3_devkitc_1_n32r8/board.c new file mode 100644 index 0000000000..ff9418ec86 --- /dev/null +++ b/ports/espressif/boards/espressif_esp32s3_devkitc_1_n32r8/board.c @@ -0,0 +1,48 @@ +/* + * This file is part of the MicroPython project, http://micropython.org/ + * + * The MIT License (MIT) + * + * Copyright (c) 2020 Scott Shawcroft for Adafruit Industries + * + * Permission is hereby granted, free of charge, to any person obtaining a copy + * of this software and associated documentation files (the "Software"), to deal + * in the Software without restriction, including without limitation the rights + * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell + * copies of the Software, and to permit persons to whom the Software is + * furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice shall be included in + * all copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE + * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER + * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, + * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN + * THE SOFTWARE. + */ + +#include "supervisor/board.h" +#include "mpconfigboard.h" +#include "shared-bindings/microcontroller/Pin.h" + +void board_init(void) { + // Debug UART + #ifdef DEBUG + common_hal_never_reset_pin(&pin_GPIO43); + common_hal_never_reset_pin(&pin_GPIO44); + #endif +} + +bool board_requests_safe_mode(void) { + return false; +} + +void reset_board(void) { + +} + +void board_deinit(void) { +} diff --git a/ports/espressif/boards/espressif_esp32s3_devkitc_1_n32r8/mpconfigboard.h b/ports/espressif/boards/espressif_esp32s3_devkitc_1_n32r8/mpconfigboard.h new file mode 100644 index 0000000000..26410bb210 --- /dev/null +++ b/ports/espressif/boards/espressif_esp32s3_devkitc_1_n32r8/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-S3-DevKitC-1-N32R8" +#define MICROPY_HW_MCU_NAME "ESP32S3" + +#define MICROPY_HW_NEOPIXEL (&pin_GPIO48) + +#define CIRCUITPY_BOOT_BUTTON (&pin_GPIO0) + +#define DEFAULT_UART_BUS_RX (&pin_GPIO44) +#define DEFAULT_UART_BUS_TX (&pin_GPIO43) + +#define AUTORESET_DELAY_MS 500 diff --git a/ports/espressif/boards/espressif_esp32s3_devkitc_1_n32r8/mpconfigboard.mk b/ports/espressif/boards/espressif_esp32s3_devkitc_1_n32r8/mpconfigboard.mk new file mode 100644 index 0000000000..78423955bb --- /dev/null +++ b/ports/espressif/boards/espressif_esp32s3_devkitc_1_n32r8/mpconfigboard.mk @@ -0,0 +1,10 @@ +USB_VID = 0x303A +USB_PID = 0x7003 +USB_PRODUCT = "ESP32-S3-DevKitC-1-N32R8" +USB_MANUFACTURER = "Espressif" + +IDF_TARGET = esp32s3 + +CIRCUITPY_ESP_FLASH_MODE=dout +CIRCUITPY_ESP_FLASH_FREQ=80m +CIRCUITPY_ESP_FLASH_SIZE=32MB diff --git a/ports/espressif/boards/espressif_esp32s3_devkitc_1_n32r8/pins.c b/ports/espressif/boards/espressif_esp32s3_devkitc_1_n32r8/pins.c new file mode 100644 index 0000000000..919deca8b4 --- /dev/null +++ b/ports/espressif/boards/espressif_esp32s3_devkitc_1_n32r8/pins.c @@ -0,0 +1,49 @@ +#include "shared-bindings/board/__init__.h" + +STATIC const mp_rom_map_elem_t board_module_globals_table[] = { + CIRCUITPYTHON_BOARD_DICT_STANDARD_ITEMS + + { MP_ROM_QSTR(MP_QSTR_IO0), MP_ROM_PTR(&pin_GPIO0) }, + { MP_ROM_QSTR(MP_QSTR_IO1), MP_ROM_PTR(&pin_GPIO1) }, + { MP_ROM_QSTR(MP_QSTR_IO2), MP_ROM_PTR(&pin_GPIO2) }, + { MP_ROM_QSTR(MP_QSTR_IO3), MP_ROM_PTR(&pin_GPIO3) }, + { MP_ROM_QSTR(MP_QSTR_IO4), MP_ROM_PTR(&pin_GPIO4) }, + { MP_ROM_QSTR(MP_QSTR_IO5), MP_ROM_PTR(&pin_GPIO5) }, + { MP_ROM_QSTR(MP_QSTR_IO6), MP_ROM_PTR(&pin_GPIO6) }, + { MP_ROM_QSTR(MP_QSTR_IO7), MP_ROM_PTR(&pin_GPIO7) }, + { MP_ROM_QSTR(MP_QSTR_IO8), MP_ROM_PTR(&pin_GPIO8) }, + { MP_ROM_QSTR(MP_QSTR_IO9), MP_ROM_PTR(&pin_GPIO9) }, + { MP_ROM_QSTR(MP_QSTR_IO10), MP_ROM_PTR(&pin_GPIO10) }, + { MP_ROM_QSTR(MP_QSTR_IO11), MP_ROM_PTR(&pin_GPIO11) }, + { MP_ROM_QSTR(MP_QSTR_IO12), MP_ROM_PTR(&pin_GPIO12) }, + { MP_ROM_QSTR(MP_QSTR_IO13), MP_ROM_PTR(&pin_GPIO13) }, + { MP_ROM_QSTR(MP_QSTR_IO14), MP_ROM_PTR(&pin_GPIO14) }, + { MP_ROM_QSTR(MP_QSTR_IO15), MP_ROM_PTR(&pin_GPIO15) }, + { MP_ROM_QSTR(MP_QSTR_IO16), MP_ROM_PTR(&pin_GPIO16) }, + { MP_ROM_QSTR(MP_QSTR_IO17), MP_ROM_PTR(&pin_GPIO17) }, + { MP_ROM_QSTR(MP_QSTR_IO18), MP_ROM_PTR(&pin_GPIO18) }, + { MP_ROM_QSTR(MP_QSTR_IO19), MP_ROM_PTR(&pin_GPIO19) }, + { MP_ROM_QSTR(MP_QSTR_IO20), MP_ROM_PTR(&pin_GPIO20) }, + { MP_ROM_QSTR(MP_QSTR_IO21), MP_ROM_PTR(&pin_GPIO21) }, + { MP_ROM_QSTR(MP_QSTR_IO35), MP_ROM_PTR(&pin_GPIO35) }, + { MP_ROM_QSTR(MP_QSTR_IO36), MP_ROM_PTR(&pin_GPIO36) }, + { MP_ROM_QSTR(MP_QSTR_IO37), MP_ROM_PTR(&pin_GPIO37) }, + { MP_ROM_QSTR(MP_QSTR_IO38), MP_ROM_PTR(&pin_GPIO38) }, + { MP_ROM_QSTR(MP_QSTR_IO39), MP_ROM_PTR(&pin_GPIO39) }, + { MP_ROM_QSTR(MP_QSTR_IO40), MP_ROM_PTR(&pin_GPIO40) }, + { MP_ROM_QSTR(MP_QSTR_IO41), MP_ROM_PTR(&pin_GPIO41) }, + { MP_ROM_QSTR(MP_QSTR_IO42), MP_ROM_PTR(&pin_GPIO42) }, + { MP_ROM_QSTR(MP_QSTR_IO43), MP_ROM_PTR(&pin_GPIO43) }, + { MP_ROM_QSTR(MP_QSTR_IO44), MP_ROM_PTR(&pin_GPIO44) }, + { MP_ROM_QSTR(MP_QSTR_IO45), MP_ROM_PTR(&pin_GPIO45) }, + { MP_ROM_QSTR(MP_QSTR_IO46), MP_ROM_PTR(&pin_GPIO46) }, + { MP_ROM_QSTR(MP_QSTR_IO47), MP_ROM_PTR(&pin_GPIO47) }, + { MP_ROM_QSTR(MP_QSTR_IO48), MP_ROM_PTR(&pin_GPIO48) }, + { MP_ROM_QSTR(MP_QSTR_NEOPIXEL), MP_ROM_PTR(&pin_GPIO48) }, + + { MP_ROM_QSTR(MP_QSTR_TX), MP_ROM_PTR(&pin_GPIO43) }, + { MP_ROM_QSTR(MP_QSTR_RX), MP_ROM_PTR(&pin_GPIO44) }, + + { MP_ROM_QSTR(MP_QSTR_UART), MP_ROM_PTR(&board_uart_obj) }, +}; +MP_DEFINE_CONST_DICT(board_module_globals, board_module_globals_table); diff --git a/ports/espressif/boards/espressif_esp32s3_devkitc_1_n32r8/sdkconfig b/ports/espressif/boards/espressif_esp32s3_devkitc_1_n32r8/sdkconfig new file mode 100644 index 0000000000..f915462e11 --- /dev/null +++ b/ports/espressif/boards/espressif_esp32s3_devkitc_1_n32r8/sdkconfig @@ -0,0 +1,77 @@ +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 + +# +# Serial flasher config +# +CONFIG_ESPTOOLPY_BAUD_OTHER_VAL=115200 +# CONFIG_ESPTOOLPY_NO_STUB is not set +CONFIG_ESPTOOLPY_OCT_FLASH=y +CONFIG_ESPTOOLPY_FLASHMODE_OPI=y +# CONFIG_ESPTOOLPY_FLASH_SAMPLE_MODE_STR is not set +CONFIG_ESPTOOLPY_FLASH_SAMPLE_MODE_DTR=y +CONFIG_ESPTOOLPY_FLASHMODE="dout" +CONFIG_ESPTOOLPY_FLASHFREQ_80M=y +# CONFIG_ESPTOOLPY_FLASHFREQ_40M is not set +# CONFIG_ESPTOOLPY_FLASHFREQ_20M is not set +CONFIG_ESPTOOLPY_FLASHFREQ="80m" +# CONFIG_ESPTOOLPY_FLASHSIZE_1MB is not set +# CONFIG_ESPTOOLPY_FLASHSIZE_2MB is not set +# CONFIG_ESPTOOLPY_FLASHSIZE_4MB is not set +# CONFIG_ESPTOOLPY_FLASHSIZE_8MB is not set +# CONFIG_ESPTOOLPY_FLASHSIZE_16MB is not set +CONFIG_ESPTOOLPY_FLASHSIZE_32MB=y +# CONFIG_ESPTOOLPY_FLASHSIZE_64MB is not set +# CONFIG_ESPTOOLPY_FLASHSIZE_128MB is not set +CONFIG_ESPTOOLPY_FLASHSIZE="32MB" +CONFIG_ESPTOOLPY_FLASHSIZE_DETECT=y +CONFIG_ESPTOOLPY_BEFORE_RESET=y +# CONFIG_ESPTOOLPY_BEFORE_NORESET is not set +CONFIG_ESPTOOLPY_BEFORE="default_reset" +CONFIG_ESPTOOLPY_AFTER_RESET=y +# CONFIG_ESPTOOLPY_AFTER_NORESET is not set +CONFIG_ESPTOOLPY_AFTER="hard_reset" +# CONFIG_ESPTOOLPY_MONITOR_BAUD_CONSOLE is not set +# CONFIG_ESPTOOLPY_MONITOR_BAUD_9600B is not set +# CONFIG_ESPTOOLPY_MONITOR_BAUD_57600B is not set +CONFIG_ESPTOOLPY_MONITOR_BAUD_115200B=y +# CONFIG_ESPTOOLPY_MONITOR_BAUD_230400B is not set +# CONFIG_ESPTOOLPY_MONITOR_BAUD_921600B is not set +# CONFIG_ESPTOOLPY_MONITOR_BAUD_2MB is not set +# CONFIG_ESPTOOLPY_MONITOR_BAUD_OTHER is not set +CONFIG_ESPTOOLPY_MONITOR_BAUD_OTHER_VAL=115200 +CONFIG_ESPTOOLPY_MONITOR_BAUD=115200 +# end of Serial flasher config + +# +# LWIP +# +CONFIG_LWIP_LOCAL_HOSTNAME="espressif-esp32s3" +# end of LWIP diff --git a/ports/espressif/boards/espressif_esp32s3_devkitc_1_n8/mpconfigboard.mk b/ports/espressif/boards/espressif_esp32s3_devkitc_1_n8/mpconfigboard.mk index 7ae39254b4..6f56013e09 100644 --- a/ports/espressif/boards/espressif_esp32s3_devkitc_1_n8/mpconfigboard.mk +++ b/ports/espressif/boards/espressif_esp32s3_devkitc_1_n8/mpconfigboard.mk @@ -8,4 +8,4 @@ IDF_TARGET = esp32s3 CIRCUITPY_ESP_FLASH_MODE = dio CIRCUITPY_ESP_FLASH_FREQ = 80m CIRCUITPY_ESP_FLASH_SIZE = 8MB -CIRCUITPY_ESP32_CAMERA = 0 +CIRCUITPY_ESPCAMERA = 0 diff --git a/ports/espressif/boards/espressif_esp32s3_devkitm_1_n8/mpconfigboard.mk b/ports/espressif/boards/espressif_esp32s3_devkitm_1_n8/mpconfigboard.mk index ac58db8aed..55ad754736 100644 --- a/ports/espressif/boards/espressif_esp32s3_devkitm_1_n8/mpconfigboard.mk +++ b/ports/espressif/boards/espressif_esp32s3_devkitm_1_n8/mpconfigboard.mk @@ -8,4 +8,4 @@ IDF_TARGET = esp32s3 CIRCUITPY_ESP_FLASH_MODE = dio CIRCUITPY_ESP_FLASH_FREQ = 80m CIRCUITPY_ESP_FLASH_SIZE = 8MB -CIRCUITPY_ESP32_CAMERA = 0 +CIRCUITPY_ESPCAMERA = 0 diff --git a/ports/espressif/boards/espressif_esp32s3_usb_otg_n8/mpconfigboard.mk b/ports/espressif/boards/espressif_esp32s3_usb_otg_n8/mpconfigboard.mk index dd8403f779..868e29bf60 100644 --- a/ports/espressif/boards/espressif_esp32s3_usb_otg_n8/mpconfigboard.mk +++ b/ports/espressif/boards/espressif_esp32s3_usb_otg_n8/mpconfigboard.mk @@ -8,4 +8,4 @@ IDF_TARGET = esp32s3 CIRCUITPY_ESP_FLASH_MODE = dio CIRCUITPY_ESP_FLASH_FREQ = 80m CIRCUITPY_ESP_FLASH_SIZE = 8MB -CIRCUITPY_ESP32_CAMERA = 0 +CIRCUITPY_ESPCAMERA = 0 diff --git a/ports/espressif/boards/espressif_saola_1_wroom/mpconfigboard.mk b/ports/espressif/boards/espressif_saola_1_wroom/mpconfigboard.mk index 4748b1c306..03feef98ce 100644 --- a/ports/espressif/boards/espressif_saola_1_wroom/mpconfigboard.mk +++ b/ports/espressif/boards/espressif_saola_1_wroom/mpconfigboard.mk @@ -8,4 +8,4 @@ IDF_TARGET = esp32s2 CIRCUITPY_ESP_FLASH_MODE = dio CIRCUITPY_ESP_FLASH_FREQ = 40m CIRCUITPY_ESP_FLASH_SIZE = 4MB -CIRCUITPY_ESP32_CAMERA = 0 +CIRCUITPY_ESPCAMERA = 0 diff --git a/ports/espressif/boards/franzininho_wifi_wroom/mpconfigboard.mk b/ports/espressif/boards/franzininho_wifi_wroom/mpconfigboard.mk index 193a867fb2..76661511e2 100644 --- a/ports/espressif/boards/franzininho_wifi_wroom/mpconfigboard.mk +++ b/ports/espressif/boards/franzininho_wifi_wroom/mpconfigboard.mk @@ -8,4 +8,4 @@ IDF_TARGET = esp32s2 CIRCUITPY_ESP_FLASH_MODE = dio CIRCUITPY_ESP_FLASH_FREQ = 40m CIRCUITPY_ESP_FLASH_SIZE = 4MB -CIRCUITPY_ESP32_CAMERA = 0 +CIRCUITPY_ESPCAMERA = 0 diff --git a/ports/espressif/boards/gravitech_cucumber_m/mpconfigboard.mk b/ports/espressif/boards/gravitech_cucumber_m/mpconfigboard.mk index a7d4d9fb7c..801bd8b508 100644 --- a/ports/espressif/boards/gravitech_cucumber_m/mpconfigboard.mk +++ b/ports/espressif/boards/gravitech_cucumber_m/mpconfigboard.mk @@ -8,4 +8,4 @@ IDF_TARGET = esp32s2 CIRCUITPY_ESP_FLASH_MODE = dio CIRCUITPY_ESP_FLASH_FREQ = 40m CIRCUITPY_ESP_FLASH_SIZE = 4MB -CIRCUITPY_ESP32_CAMERA = 0 +CIRCUITPY_ESPCAMERA = 0 diff --git a/ports/espressif/boards/gravitech_cucumber_ms/mpconfigboard.mk b/ports/espressif/boards/gravitech_cucumber_ms/mpconfigboard.mk index bbcbfde29a..b57f74f23d 100644 --- a/ports/espressif/boards/gravitech_cucumber_ms/mpconfigboard.mk +++ b/ports/espressif/boards/gravitech_cucumber_ms/mpconfigboard.mk @@ -8,4 +8,4 @@ IDF_TARGET = esp32s2 CIRCUITPY_ESP_FLASH_MODE = dio CIRCUITPY_ESP_FLASH_FREQ = 40m CIRCUITPY_ESP_FLASH_SIZE = 4MB -CIRCUITPY_ESP32_CAMERA = 0 +CIRCUITPY_ESPCAMERA = 0 diff --git a/ports/espressif/boards/hardkernel_odroid_go/mpconfigboard.h b/ports/espressif/boards/hardkernel_odroid_go/mpconfigboard.h index 7de90b0ae8..49d49f2427 100644 --- a/ports/espressif/boards/hardkernel_odroid_go/mpconfigboard.h +++ b/ports/espressif/boards/hardkernel_odroid_go/mpconfigboard.h @@ -35,7 +35,7 @@ #define CIRCUITPY_BOOT_BUTTON (&pin_GPIO0) // Explanation of how a user got into safe mode -#define BOARD_USER_SAFE_MODE_ACTION translate("The VOLUME button was pressed at start up.\n") +#define BOARD_USER_SAFE_MODE_ACTION translate("You pressed the VOLUME button at start up.") // UART pins attached to the USB-serial converter chip #define CIRCUITPY_CONSOLE_UART_TX (&pin_GPIO1) diff --git a/ports/espressif/boards/lilygo_ttgo_t8_esp32_s2_wroom/mpconfigboard.mk b/ports/espressif/boards/lilygo_ttgo_t8_esp32_s2_wroom/mpconfigboard.mk index b5cc1bae7c..3244d38869 100644 --- a/ports/espressif/boards/lilygo_ttgo_t8_esp32_s2_wroom/mpconfigboard.mk +++ b/ports/espressif/boards/lilygo_ttgo_t8_esp32_s2_wroom/mpconfigboard.mk @@ -8,4 +8,4 @@ IDF_TARGET = esp32s2 CIRCUITPY_ESP_FLASH_MODE = dio CIRCUITPY_ESP_FLASH_FREQ = 40m CIRCUITPY_ESP_FLASH_SIZE = 4MB -CIRCUITPY_ESP32_CAMERA = 0 +CIRCUITPY_ESPCAMERA = 0 diff --git a/ports/espressif/boards/lolin_c3_mini/pins.c b/ports/espressif/boards/lolin_c3_mini/pins.c index ccc70f6043..6b16020205 100644 --- a/ports/espressif/boards/lolin_c3_mini/pins.c +++ b/ports/espressif/boards/lolin_c3_mini/pins.c @@ -46,6 +46,7 @@ STATIC const mp_rom_map_elem_t board_module_globals_table[] = { { 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_NEOPIXEL), 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) }, diff --git a/ports/espressif/boards/lolin_s3/mpconfigboard.mk b/ports/espressif/boards/lolin_s3/mpconfigboard.mk index b0b146b03c..c81e3e6fb9 100644 --- a/ports/espressif/boards/lolin_s3/mpconfigboard.mk +++ b/ports/espressif/boards/lolin_s3/mpconfigboard.mk @@ -10,4 +10,4 @@ CIRCUITPY_ESP_FLASH_FREQ = 80m CIRCUITPY_ESP_FLASH_SIZE = 16MB OPTIMIZATION_FLAGS = -Os -CIRCUITPY_ESP32_CAMERA = 0 +CIRCUITPY_ESPCAMERA = 0 diff --git a/ports/espressif/boards/luatos_core_esp32c3/board.c b/ports/espressif/boards/luatos_core_esp32c3/board.c new file mode 100644 index 0000000000..164430c88c --- /dev/null +++ b/ports/espressif/boards/luatos_core_esp32c3/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/luatos_core_esp32c3/mpconfigboard.h b/ports/espressif/boards/luatos_core_esp32c3/mpconfigboard.h new file mode 100644 index 0000000000..23bb5ee9b2 --- /dev/null +++ b/ports/espressif/boards/luatos_core_esp32c3/mpconfigboard.h @@ -0,0 +1,38 @@ +/* + * 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 "Luatos Core-ESP32C3" +#define MICROPY_HW_MCU_NAME "ESP32-C3" + +// Status LED +#define MICROPY_HW_LED_STATUS (&pin_GPIO12) + +#define CIRCUITPY_BOARD_UART (1) +#define CIRCUITPY_BOARD_UART_PIN {{.tx = &pin_GPIO21, .rx = &pin_GPIO20}} + +#define CIRCUITPY_ESP_USB_SERIAL_JTAG (1) diff --git a/ports/espressif/boards/luatos_core_esp32c3/mpconfigboard.mk b/ports/espressif/boards/luatos_core_esp32c3/mpconfigboard.mk new file mode 100644 index 0000000000..e0df58f756 --- /dev/null +++ b/ports/espressif/boards/luatos_core_esp32c3/mpconfigboard.mk @@ -0,0 +1,8 @@ +CIRCUITPY_CREATOR_ID = 0xDEADBEEF +CIRCUITPY_CREATION_ID = 0x00C30001 + +IDF_TARGET = esp32c3 + +CIRCUITPY_ESP_FLASH_MODE=dio +CIRCUITPY_ESP_FLASH_FREQ=80m +CIRCUITPY_ESP_FLASH_SIZE=4MB diff --git a/ports/espressif/boards/luatos_core_esp32c3/pins.c b/ports/espressif/boards/luatos_core_esp32c3/pins.c new file mode 100644 index 0000000000..f45205b5c3 --- /dev/null +++ b/ports/espressif/boards/luatos_core_esp32c3/pins.c @@ -0,0 +1,36 @@ +#include "shared-bindings/board/__init__.h" + +STATIC const mp_rom_map_elem_t board_module_globals_table[] = { + CIRCUITPYTHON_BOARD_DICT_STANDARD_ITEMS + + // Luatos Core ESP32-C3 + // Documentation (Chinese only): + // https://wiki.luatos.com/chips/esp32c3/index.html + // Pinout: + // https://wiki.luatos.com/_images/20221023.png + // 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_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_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) }, + // IO11 used internally on this board version despite being broken out to a pin + { MP_ROM_QSTR(MP_QSTR_IO12), MP_ROM_PTR(&pin_GPIO12) }, + { MP_ROM_QSTR(MP_QSTR_LED), MP_ROM_PTR(&pin_GPIO12) }, + { MP_ROM_QSTR(MP_QSTR_IO13), MP_ROM_PTR(&pin_GPIO13) }, + { MP_ROM_QSTR(MP_QSTR_LED2), MP_ROM_PTR(&pin_GPIO13) }, + { 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_UART), MP_ROM_PTR(&board_uart_obj) }, +}; +MP_DEFINE_CONST_DICT(board_module_globals, board_module_globals_table); diff --git a/ports/espressif/boards/luatos_core_esp32c3/sdkconfig b/ports/espressif/boards/luatos_core_esp32c3/sdkconfig new file mode 100644 index 0000000000..ccc70917b5 --- /dev/null +++ b/ports/espressif/boards/luatos_core_esp32c3/sdkconfig @@ -0,0 +1,5 @@ +# +# LWIP +# +CONFIG_LWIP_LOCAL_HOSTNAME="luatos-core-esp32c3" +# end of LWIP diff --git a/ports/espressif/boards/m5stack_atom_echo/board.c b/ports/espressif/boards/m5stack_atom_echo/board.c new file mode 100644 index 0000000000..c0d9676d86 --- /dev/null +++ b/ports/espressif/boards/m5stack_atom_echo/board.c @@ -0,0 +1,29 @@ +/* + * This file is part of the MicroPython project, http://micropython.org/ + * + * The MIT License (MIT) + * + * Copyright (c) 2022 CDarius + * + * 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/m5stack_atom_echo/mpconfigboard.h b/ports/espressif/boards/m5stack_atom_echo/mpconfigboard.h new file mode 100644 index 0000000000..426d5c3bf7 --- /dev/null +++ b/ports/espressif/boards/m5stack_atom_echo/mpconfigboard.h @@ -0,0 +1,45 @@ +/* + * This file is part of the MicroPython project, http://micropython.org/ + * + * The MIT License (MIT) + * + * Copyright (c) 2022 CDarius + * + * 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 "M5Stack Atom Echo" +#define MICROPY_HW_MCU_NAME "ESP32" + +#define MICROPY_HW_NEOPIXEL (&pin_GPIO27) + +#define CIRCUITPY_BOARD_I2C (1) +#define CIRCUITPY_BOARD_I2C_PIN {{.scl = &pin_GPIO32, .sda = &pin_GPIO26}} + +// For entering safe mode +#define CIRCUITPY_BOOT_BUTTON (&pin_GPIO39) + +// Explanation of how a user got into safe mode +#define BOARD_USER_SAFE_MODE_ACTION translate("You pressed the central button at start up.") + +// 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/m5stack_atom_echo/mpconfigboard.mk b/ports/espressif/boards/m5stack_atom_echo/mpconfigboard.mk new file mode 100644 index 0000000000..63ed093f0a --- /dev/null +++ b/ports/espressif/boards/m5stack_atom_echo/mpconfigboard.mk @@ -0,0 +1,10 @@ +CIRCUITPY_CREATOR_ID = 0x10151015 +CIRCUITPY_CREATION_ID = 0x00320005 + +IDF_TARGET = esp32 + +CIRCUITPY_ESP_FLASH_MODE = dio +CIRCUITPY_ESP_FLASH_FREQ = 40m +CIRCUITPY_ESP_FLASH_SIZE = 4MB + +CIRCUITPY_ESPCAMERA = 0 diff --git a/ports/espressif/boards/m5stack_atom_echo/pins.c b/ports/espressif/boards/m5stack_atom_echo/pins.c new file mode 100644 index 0000000000..68b6389215 --- /dev/null +++ b/ports/espressif/boards/m5stack_atom_echo/pins.c @@ -0,0 +1,43 @@ +#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 + + // External pins are in silkscreen order, from top to bottom, left side, then right side + + { MP_ROM_QSTR(MP_QSTR_SPK_I2S_SDO), MP_ROM_PTR(&pin_GPIO22) }, + { MP_ROM_QSTR(MP_QSTR_SPK_I2S_SCK), MP_ROM_PTR(&pin_GPIO19) }, + + { MP_ROM_QSTR(MP_QSTR_SPK_I2S_LRC), MP_ROM_PTR(&pin_GPIO33) }, + { MP_ROM_QSTR(MP_QSTR_PDM_MIC_CLK), MP_ROM_PTR(&pin_GPIO33) }, + + { MP_ROM_QSTR(MP_QSTR_PDM_MIC_DATA), MP_ROM_PTR(&pin_GPIO23) }, + + { MP_ROM_QSTR(MP_QSTR_SCL), MP_ROM_PTR(&pin_GPIO21) }, + { MP_ROM_QSTR(MP_QSTR_D21), MP_ROM_PTR(&pin_GPIO21) }, + + { MP_ROM_QSTR(MP_QSTR_SDA), MP_ROM_PTR(&pin_GPIO25) }, + { MP_ROM_QSTR(MP_QSTR_A25), MP_ROM_PTR(&pin_GPIO25) }, + { MP_ROM_QSTR(MP_QSTR_D25), MP_ROM_PTR(&pin_GPIO25) }, + { MP_ROM_QSTR(MP_QSTR_DAC1), MP_ROM_PTR(&pin_GPIO25) }, + + { MP_ROM_QSTR(MP_QSTR_PORTA_SDA), MP_ROM_PTR(&pin_GPIO26) }, + { MP_ROM_QSTR(MP_QSTR_A26), MP_ROM_PTR(&pin_GPIO26) }, + { MP_ROM_QSTR(MP_QSTR_D26), MP_ROM_PTR(&pin_GPIO26) }, + { MP_ROM_QSTR(MP_QSTR_DAC2), MP_ROM_PTR(&pin_GPIO25) }, + + { MP_ROM_QSTR(MP_QSTR_PORTA_SCL), MP_ROM_PTR(&pin_GPIO32) }, + { MP_ROM_QSTR(MP_QSTR_A32), MP_ROM_PTR(&pin_GPIO32) }, + { MP_ROM_QSTR(MP_QSTR_D32), MP_ROM_PTR(&pin_GPIO32) }, + + { MP_ROM_QSTR(MP_QSTR_NEOPIXEL), MP_ROM_PTR(&pin_GPIO27) }, + + { MP_ROM_QSTR(MP_QSTR_BTN), MP_ROM_PTR(&pin_GPIO39) }, + + { MP_ROM_QSTR(MP_QSTR_IR_LED), MP_ROM_PTR(&pin_GPIO12) }, + + { MP_ROM_QSTR(MP_QSTR_PORTA_I2C), MP_ROM_PTR(&board_i2c_obj) }, + +}; +MP_DEFINE_CONST_DICT(board_module_globals, board_module_globals_table); diff --git a/ports/espressif/boards/m5stack_atom_echo/sdkconfig b/ports/espressif/boards/m5stack_atom_echo/sdkconfig new file mode 100644 index 0000000000..3879222bab --- /dev/null +++ b/ports/espressif/boards/m5stack_atom_echo/sdkconfig @@ -0,0 +1,26 @@ +CONFIG_ESP32_SPIRAM_SUPPORT=n + +# CONFIG_SPIRAM_ALLOW_BSS_SEG_EXTERNAL_MEMORY is not set +# +# LWIP +# +CONFIG_LWIP_LOCAL_HOSTNAME="M5StaskAtomEcho" +# end of LWIP + +# 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/m5stack_atom_lite/mpconfigboard.h b/ports/espressif/boards/m5stack_atom_lite/mpconfigboard.h index dfa12b53b0..9ec15fa0f2 100644 --- a/ports/espressif/boards/m5stack_atom_lite/mpconfigboard.h +++ b/ports/espressif/boards/m5stack_atom_lite/mpconfigboard.h @@ -42,7 +42,7 @@ #define CIRCUITPY_BOOT_BUTTON (&pin_GPIO39) // Explanation of how a user got into safe mode -#define BOARD_USER_SAFE_MODE_ACTION translate("The central button was pressed at start up.\n") +#define BOARD_USER_SAFE_MODE_ACTION translate("You pressed the central button at start up.") // UART pins attached to the USB-serial converter chip #define CIRCUITPY_CONSOLE_UART_TX (&pin_GPIO1) diff --git a/ports/espressif/boards/m5stack_atom_lite/mpconfigboard.mk b/ports/espressif/boards/m5stack_atom_lite/mpconfigboard.mk index 6adf65d2bc..e1ba503b8c 100644 --- a/ports/espressif/boards/m5stack_atom_lite/mpconfigboard.mk +++ b/ports/espressif/boards/m5stack_atom_lite/mpconfigboard.mk @@ -7,4 +7,4 @@ CIRCUITPY_ESP_FLASH_MODE = dio CIRCUITPY_ESP_FLASH_FREQ = 40m CIRCUITPY_ESP_FLASH_SIZE = 4MB -CIRCUITPY_ESP32_CAMERA = 0 +CIRCUITPY_ESPCAMERA = 0 diff --git a/ports/espressif/boards/m5stack_atom_matrix/board.c b/ports/espressif/boards/m5stack_atom_matrix/board.c new file mode 100644 index 0000000000..c0d9676d86 --- /dev/null +++ b/ports/espressif/boards/m5stack_atom_matrix/board.c @@ -0,0 +1,29 @@ +/* + * This file is part of the MicroPython project, http://micropython.org/ + * + * The MIT License (MIT) + * + * Copyright (c) 2022 CDarius + * + * 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/m5stack_atom_matrix/mpconfigboard.h b/ports/espressif/boards/m5stack_atom_matrix/mpconfigboard.h new file mode 100644 index 0000000000..77eba4ab92 --- /dev/null +++ b/ports/espressif/boards/m5stack_atom_matrix/mpconfigboard.h @@ -0,0 +1,49 @@ +/* + * This file is part of the MicroPython project, http://micropython.org/ + * + * The MIT License (MIT) + * + * Copyright (c) 2022 CDarius + * + * 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 "M5Stack Atom Matrix" +#define MICROPY_HW_MCU_NAME "ESP32" + +#define MICROPY_HW_NEOPIXEL (&pin_GPIO27) + +#define CIRCUITPY_BOARD_I2C (2) +#define CIRCUITPY_BOARD_I2C_PIN {{.scl = &pin_GPIO21, .sda = &pin_GPIO25}, \ + {.scl = &pin_GPIO32, .sda = &pin_GPIO26}} + +#define CIRCUITPY_BOARD_SPI (1) +#define CIRCUITPY_BOARD_SPI_PIN {{.clock = &pin_GPIO23, .mosi = &pin_GPIO19, .miso = &pin_GPIO33}} + +// For entering safe mode +#define CIRCUITPY_BOOT_BUTTON (&pin_GPIO39) + +// Explanation of how a user got into safe mode +#define BOARD_USER_SAFE_MODE_ACTION translate("You pressed the central button at start up.") + +// 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/m5stack_atom_matrix/mpconfigboard.mk b/ports/espressif/boards/m5stack_atom_matrix/mpconfigboard.mk new file mode 100644 index 0000000000..ecf9319584 --- /dev/null +++ b/ports/espressif/boards/m5stack_atom_matrix/mpconfigboard.mk @@ -0,0 +1,10 @@ +CIRCUITPY_CREATOR_ID = 0x10151015 +CIRCUITPY_CREATION_ID = 0x00320004 + +IDF_TARGET = esp32 + +CIRCUITPY_ESP_FLASH_MODE = dio +CIRCUITPY_ESP_FLASH_FREQ = 40m +CIRCUITPY_ESP_FLASH_SIZE = 4MB + +CIRCUITPY_ESPCAMERA = 0 diff --git a/ports/espressif/boards/m5stack_atom_matrix/pins.c b/ports/espressif/boards/m5stack_atom_matrix/pins.c new file mode 100644 index 0000000000..9b18b954f0 --- /dev/null +++ b/ports/espressif/boards/m5stack_atom_matrix/pins.c @@ -0,0 +1,51 @@ +#include "shared-bindings/board/__init__.h" +#include "shared-module/displayio/__init__.h" + +CIRCUITPY_BOARD_BUS_SINGLETON(porta_i2c, i2c, 1) + +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_D22), MP_ROM_PTR(&pin_GPIO22) }, + + { 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_SCK), MP_ROM_PTR(&pin_GPIO23) }, + { MP_ROM_QSTR(MP_QSTR_D23), MP_ROM_PTR(&pin_GPIO23) }, + + { MP_ROM_QSTR(MP_QSTR_MISO), 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_SCL), MP_ROM_PTR(&pin_GPIO21) }, + { MP_ROM_QSTR(MP_QSTR_D21), MP_ROM_PTR(&pin_GPIO21) }, + + { MP_ROM_QSTR(MP_QSTR_SDA), MP_ROM_PTR(&pin_GPIO25) }, + { MP_ROM_QSTR(MP_QSTR_A25), MP_ROM_PTR(&pin_GPIO25) }, + { MP_ROM_QSTR(MP_QSTR_D25), MP_ROM_PTR(&pin_GPIO25) }, + { MP_ROM_QSTR(MP_QSTR_DAC1), MP_ROM_PTR(&pin_GPIO25) }, + + { MP_ROM_QSTR(MP_QSTR_PORTA_SDA), MP_ROM_PTR(&pin_GPIO26) }, + { MP_ROM_QSTR(MP_QSTR_A26), MP_ROM_PTR(&pin_GPIO26) }, + { MP_ROM_QSTR(MP_QSTR_D26), MP_ROM_PTR(&pin_GPIO26) }, + { MP_ROM_QSTR(MP_QSTR_DAC2), MP_ROM_PTR(&pin_GPIO25) }, + + { MP_ROM_QSTR(MP_QSTR_PORTA_SCL), MP_ROM_PTR(&pin_GPIO32) }, + { MP_ROM_QSTR(MP_QSTR_A32), MP_ROM_PTR(&pin_GPIO32) }, + { MP_ROM_QSTR(MP_QSTR_D32), MP_ROM_PTR(&pin_GPIO32) }, + + { MP_ROM_QSTR(MP_QSTR_NEOPIXEL), MP_ROM_PTR(&pin_GPIO27) }, + + { MP_ROM_QSTR(MP_QSTR_BTN), MP_ROM_PTR(&pin_GPIO39) }, + + { MP_ROM_QSTR(MP_QSTR_IR_LED), MP_ROM_PTR(&pin_GPIO12) }, + + { MP_ROM_QSTR(MP_QSTR_I2C), MP_ROM_PTR(&board_i2c_obj) }, + { MP_ROM_QSTR(MP_QSTR_PORTA_I2C), MP_ROM_PTR(&board_porta_i2c_obj) }, + { MP_ROM_QSTR(MP_QSTR_SPI), MP_ROM_PTR(&board_spi_obj) }, + +}; +MP_DEFINE_CONST_DICT(board_module_globals, board_module_globals_table); diff --git a/ports/espressif/boards/m5stack_atom_matrix/sdkconfig b/ports/espressif/boards/m5stack_atom_matrix/sdkconfig new file mode 100644 index 0000000000..474a760b56 --- /dev/null +++ b/ports/espressif/boards/m5stack_atom_matrix/sdkconfig @@ -0,0 +1,26 @@ +CONFIG_ESP32_SPIRAM_SUPPORT=n + +# CONFIG_SPIRAM_ALLOW_BSS_SEG_EXTERNAL_MEMORY is not set +# +# LWIP +# +CONFIG_LWIP_LOCAL_HOSTNAME="M5StaskAtomMatrix" +# end of LWIP + +# 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/m5stack_atom_u/board.c b/ports/espressif/boards/m5stack_atom_u/board.c new file mode 100644 index 0000000000..c0d9676d86 --- /dev/null +++ b/ports/espressif/boards/m5stack_atom_u/board.c @@ -0,0 +1,29 @@ +/* + * This file is part of the MicroPython project, http://micropython.org/ + * + * The MIT License (MIT) + * + * Copyright (c) 2022 CDarius + * + * 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/m5stack_atom_u/mpconfigboard.h b/ports/espressif/boards/m5stack_atom_u/mpconfigboard.h new file mode 100644 index 0000000000..b5b2101134 --- /dev/null +++ b/ports/espressif/boards/m5stack_atom_u/mpconfigboard.h @@ -0,0 +1,48 @@ +/* + * This file is part of the MicroPython project, http://micropython.org/ + * + * The MIT License (MIT) + * + * Copyright (c) 2022 CDarius + * + * 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 "M5Stack Atom U" +#define MICROPY_HW_MCU_NAME "ESP32" + +#define MICROPY_HW_NEOPIXEL (&pin_GPIO27) + +#define CIRCUITPY_BOARD_I2C (1) +#define CIRCUITPY_BOARD_I2C_PIN {{.scl = &pin_GPIO32, .sda = &pin_GPIO26}} + +#define CIRCUITPY_BOARD_SPI (1) +#define CIRCUITPY_BOARD_SPI_PIN {{.clock = &pin_GPIO23, .mosi = &pin_GPIO19, .miso = &pin_GPIO33}} + +// For entering safe mode +#define CIRCUITPY_BOOT_BUTTON (&pin_GPIO39) + +// Explanation of how a user got into safe mode +#define BOARD_USER_SAFE_MODE_ACTION translate("You pressed the central button at start up.") + +// 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/m5stack_atom_u/mpconfigboard.mk b/ports/espressif/boards/m5stack_atom_u/mpconfigboard.mk new file mode 100644 index 0000000000..f271671113 --- /dev/null +++ b/ports/espressif/boards/m5stack_atom_u/mpconfigboard.mk @@ -0,0 +1,10 @@ +CIRCUITPY_CREATOR_ID = 0x10151015 +CIRCUITPY_CREATION_ID = 0x00320006 + +IDF_TARGET = esp32 + +CIRCUITPY_ESP_FLASH_MODE = dio +CIRCUITPY_ESP_FLASH_FREQ = 40m +CIRCUITPY_ESP_FLASH_SIZE = 4MB + +CIRCUITPY_ESPCAMERA = 0 diff --git a/ports/espressif/boards/m5stack_atom_u/pins.c b/ports/espressif/boards/m5stack_atom_u/pins.c new file mode 100644 index 0000000000..4ba62ae2b7 --- /dev/null +++ b/ports/espressif/boards/m5stack_atom_u/pins.c @@ -0,0 +1,42 @@ +#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 + + // External pins are in silkscreen order, from top to bottom, left side, then right side + + { MP_ROM_QSTR(MP_QSTR_A25), MP_ROM_PTR(&pin_GPIO25) }, + { MP_ROM_QSTR(MP_QSTR_D25), MP_ROM_PTR(&pin_GPIO25) }, + { MP_ROM_QSTR(MP_QSTR_DAC1), MP_ROM_PTR(&pin_GPIO25) }, + + { 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_D22), MP_ROM_PTR(&pin_GPIO22) }, + + { MP_ROM_QSTR(MP_QSTR_D21), MP_ROM_PTR(&pin_GPIO21) }, + + { MP_ROM_QSTR(MP_QSTR_PORTA_SDA), MP_ROM_PTR(&pin_GPIO26) }, + { MP_ROM_QSTR(MP_QSTR_A26), MP_ROM_PTR(&pin_GPIO26) }, + { MP_ROM_QSTR(MP_QSTR_D26), MP_ROM_PTR(&pin_GPIO26) }, + { MP_ROM_QSTR(MP_QSTR_DAC2), MP_ROM_PTR(&pin_GPIO25) }, + + { MP_ROM_QSTR(MP_QSTR_PORTA_SCL), MP_ROM_PTR(&pin_GPIO32) }, + { MP_ROM_QSTR(MP_QSTR_A32), MP_ROM_PTR(&pin_GPIO32) }, + { MP_ROM_QSTR(MP_QSTR_D32), MP_ROM_PTR(&pin_GPIO32) }, + + { MP_ROM_QSTR(MP_QSTR_NEOPIXEL), MP_ROM_PTR(&pin_GPIO27) }, + + { MP_ROM_QSTR(MP_QSTR_BTN), MP_ROM_PTR(&pin_GPIO39) }, + + { MP_ROM_QSTR(MP_QSTR_IR_LED), MP_ROM_PTR(&pin_GPIO12) }, + + { MP_ROM_QSTR(MP_QSTR_PDM_MIC_CLK), MP_ROM_PTR(&pin_GPIO5) }, + + { MP_ROM_QSTR(MP_QSTR_PDM_MIC_DATA), MP_ROM_PTR(&pin_GPIO19) }, + + { MP_ROM_QSTR(MP_QSTR_PORTA_I2C), MP_ROM_PTR(&board_i2c_obj) }, + +}; +MP_DEFINE_CONST_DICT(board_module_globals, board_module_globals_table); diff --git a/ports/espressif/boards/m5stack_atom_u/sdkconfig b/ports/espressif/boards/m5stack_atom_u/sdkconfig new file mode 100644 index 0000000000..90c99459a8 --- /dev/null +++ b/ports/espressif/boards/m5stack_atom_u/sdkconfig @@ -0,0 +1,26 @@ +CONFIG_ESP32_SPIRAM_SUPPORT=n + +# CONFIG_SPIRAM_ALLOW_BSS_SEG_EXTERNAL_MEMORY is not set +# +# LWIP +# +CONFIG_LWIP_LOCAL_HOSTNAME="M5StaskAtomU" +# end of LWIP + +# 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/m5stack_core_basic/mpconfigboard.h b/ports/espressif/boards/m5stack_core_basic/mpconfigboard.h index c974c64874..0135b66661 100755 --- a/ports/espressif/boards/m5stack_core_basic/mpconfigboard.h +++ b/ports/espressif/boards/m5stack_core_basic/mpconfigboard.h @@ -42,7 +42,7 @@ #define CIRCUITPY_BOOT_BUTTON (&pin_GPIO39) // Explanation of how a user got into safe mode -#define BOARD_USER_SAFE_MODE_ACTION translate("Button A was pressed at start up.\n") +#define BOARD_USER_SAFE_MODE_ACTION translate("You pressed button A at start up.") // UART pins attached to the USB-serial converter chip #define CIRCUITPY_CONSOLE_UART_TX (&pin_GPIO1) diff --git a/ports/espressif/boards/m5stack_core_basic/mpconfigboard.mk b/ports/espressif/boards/m5stack_core_basic/mpconfigboard.mk index 1abf68428c..dedcde81e6 100644 --- a/ports/espressif/boards/m5stack_core_basic/mpconfigboard.mk +++ b/ports/espressif/boards/m5stack_core_basic/mpconfigboard.mk @@ -6,4 +6,4 @@ IDF_TARGET = esp32 CIRCUITPY_ESP_FLASH_MODE = qio CIRCUITPY_ESP_FLASH_FREQ = 80m CIRCUITPY_ESP_FLASH_SIZE = 16MB -CIRCUITPY_ESP32_CAMERA = 0 +CIRCUITPY_ESPCAMERA = 0 diff --git a/ports/espressif/boards/m5stack_core_fire/mpconfigboard.h b/ports/espressif/boards/m5stack_core_fire/mpconfigboard.h index f56a8fe901..2073473e1a 100755 --- a/ports/espressif/boards/m5stack_core_fire/mpconfigboard.h +++ b/ports/espressif/boards/m5stack_core_fire/mpconfigboard.h @@ -43,7 +43,7 @@ #define CIRCUITPY_BOOT_BUTTON (&pin_GPIO39) // Explanation of how a user got into safe mode -#define BOARD_USER_SAFE_MODE_ACTION translate("Button A was pressed at start up.\n") +#define BOARD_USER_SAFE_MODE_ACTION translate("You pressed button A at start up.") // UART pins attached to the USB-serial converter chip #define CIRCUITPY_CONSOLE_UART_TX (&pin_GPIO1) diff --git a/ports/espressif/boards/m5stack_core_fire/mpconfigboard.mk b/ports/espressif/boards/m5stack_core_fire/mpconfigboard.mk index 7a66a977b1..82e462012c 100644 --- a/ports/espressif/boards/m5stack_core_fire/mpconfigboard.mk +++ b/ports/espressif/boards/m5stack_core_fire/mpconfigboard.mk @@ -6,4 +6,4 @@ IDF_TARGET = esp32 CIRCUITPY_ESP_FLASH_MODE = qio CIRCUITPY_ESP_FLASH_FREQ = 80m CIRCUITPY_ESP_FLASH_SIZE = 16MB -CIRCUITPY_ESP32_CAMERA = 0 +CIRCUITPY_ESPCAMERA = 0 diff --git a/ports/espressif/boards/m5stack_stick_c/axp192.h b/ports/espressif/boards/m5stack_stick_c/axp192.h new file mode 100644 index 0000000000..78c2d253e4 --- /dev/null +++ b/ports/espressif/boards/m5stack_stick_c/axp192.h @@ -0,0 +1,256 @@ +/* + * + * The MIT License (MIT) + * + * Copyright (c) 2022 Stephen Oliver + * Copyright (c) 2023 CDarius + * + * 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_AXP192_H +#define MICROPY_AXP192_H + +#define AXP192_I2C_ADDRESS 0x34 + +#define AXP192_EXTEN_DCDC2_CTRL 0x10 +#define AXP192_EXTEN_DCDC2_CTRL_EXTEN 0b00000100 +#define AXP192_EXTEN_DCDC2_CTRL_DCDC2 0b00000001 + +#define AXP192_DCDC13_LDO23_CTRL 0x12 +#define AXP192_DCDC13_LDO23_CTRL_EXTEN 0b01000000 +#define AXP192_DCDC13_LDO23_CTRL_LDO3 0b00001000 +#define AXP192_DCDC13_LDO23_CTRL_LDO2 0b00000100 +#define AXP192_DCDC13_LDO23_CTRL_DCDC3 0b00000010 +#define AXP192_DCDC13_LDO23_CTRL_DCDC1 0b00000001 + +#define AXP192_DCDC2_OUT_VOLTAGE 0x25 + +#define AXP192_DCDC1_OUT_VOLTAGE 0x26 +#define AXP192_DCDC1_OUT_VOLTAGE_3_350V 0b01101010 + +#define AXP192_DCDC3_OUT_VOLTAGE 0x27 + + +#define AXP192_LDO23_OUT_VOLTAGE 0x28 +#define AXP192_LDO23_OUT_VOLTAGE_LDO2_3_0V 0b11000000 +#define AXP192_LDO23_OUT_VOLTAGE_LDO2_2_8V 0b10100000 +#define AXP192_LDO23_OUT_VOLTAGE_LDO2_MASK 0b11110000 +#define AXP192_LDO23_OUT_VOLTAGE_LDO3_3_0V 0b00001100 +#define AXP192_LDO23_OUT_VOLTAGE_LDO3_2_8V 0b00001010 +#define AXP192_LDO23_OUT_VOLTAGE_LDO3_MASK 0b00001111 + +#define AXP192_VBUS_IPSOUT 0x30 +#define AXP192_VBUS_IPSOUT_IGNORE_VBUSEN 0b10000000 +#define AXP192_VBUS_IPSOUT_VHOLD_LIMIT 0b01000000 +#define AXP192_VBUS_IPSOUT_VHOLD_VOLTAGE_4_4V 0b00100000 +#define AXP192_VBUS_IPSOUT_VHOLD_VOLTAGE_MASK 0b00111000 +#define AXP192_VBUS_IPSOUT_VBUS_LIMIT_CURRENT 0b00000010 +#define AXP192_VBUS_IPSOUT_VBUS_LIMIT_CURRENT_500mA 0b00000001 +#define AXP192_VBUS_IPSOUT_VBUS_LIMIT_CURRENT_100mA 0b00000000 + +#define AXP192_POWER_OFF_VOLTAGE 0x31 +#define AXP192_POWER_OFF_VOLTAGE_2_6V 0b0000 +#define AXP192_POWER_OFF_VOLTAGE_2_7V 0b0001 +#define AXP192_POWER_OFF_VOLTAGE_2_8V 0b0010 +#define AXP192_POWER_OFF_VOLTAGE_2_9V 0b0011 +#define AXP192_POWER_OFF_VOLTAGE_3_0V 0b0100 +#define AXP192_POWER_OFF_VOLTAGE_3_1V 0b0101 +#define AXP192_POWER_OFF_VOLTAGE_3_2V 0b0110 +#define AXP192_POWER_OFF_VOLTAGE_3_3V 0b0111 +#define AXP192_POWER_OFF_VOLTAGE_MASK 0b0111 + +#define AXP192_POWER_OFF_BATT_CHGLED_CTRL 0x32 +#define AXP192_POWER_OFF_BATT_CHGLED_CTRL_OFF 0b10000000 + +#define AXP192_CHARGING_CTRL1 0x33 +#define AXP192_CHARGING_CTRL1_ENABLE 0b10000000 +#define AXP192_CHARGING_CTRL1_VOLTAGE_4_36V 0b01100000 +#define AXP192_CHARGING_CTRL1_VOLTAGE_4_20V 0b01000000 +#define AXP192_CHARGING_CTRL1_VOLTAGE_4_15V 0b00100000 +#define AXP192_CHARGING_CTRL1_VOLTAGE_4_10V 0b00000000 +#define AXP192_CHARGING_CTRL1_VOLTAGE_MASK 0b01100000 +#define AXP192_CHARGING_CTRL1_CHARGING_THRESH_15PERC 0b00010000 +#define AXP192_CHARGING_CTRL1_CHARGING_THRESH_10PERC 0b00000000 +#define AXP192_CHARGING_CTRL1_CHARGING_THRESH_MASK 0b00010000 +#define AXP192_CHARGING_CTRL1_CURRENT_100mA 0b00000000 +#define AXP192_CHARGING_CTRL1_CURRENT_190mA 0b00000001 +#define AXP192_CHARGING_CTRL1_CURRENT_280mA 0b00000010 +#define AXP192_CHARGING_CTRL1_CURRENT_360mA 0b00000011 +#define AXP192_CHARGING_CTRL1_CURRENT_450mA 0b00000100 +#define AXP192_CHARGING_CTRL1_CURRENT_550mA 0b00000101 +#define AXP192_CHARGING_CTRL1_CURRENT_630mA 0b00000110 +#define AXP192_CHARGING_CTRL1_CURRENT_700mA 0b00000111 +#define AXP192_CHARGING_CTRL1_CURRENT_780mA 0b00001000 +#define AXP192_CHARGING_CTRL1_CURRENT_880mA 0b00001001 +#define AXP192_CHARGING_CTRL1_CURRENT_960mA 0b00001010 +#define AXP192_CHARGING_CTRL1_CURRENT_1000mA 0b00001011 + +#define AXP192_CHARGING_CTRL1_CURRENT_MASK 0b00001111 + +#define AXP192_CHARGING_CTRL2 0x34 + +#define AXP192_BACKUP_BATT 0x35 +#define AXP192_BACKUP_BATT_CHARGING_ENABLE 0b10000000 +#define AXP192_BACKUP_BATT_CHARGING_VOLTAGE_2_5V 0b01100000 +#define AXP192_BACKUP_BATT_CHARGING_VOLTAGE_3_0V 0b00100000 +#define AXP192_BACKUP_BATT_CHARGING_VOLTAGE_3_1V 0b00000000 +#define AXP192_BACKUP_BATT_CHARGING_VOLTAGE_MASK 0b01100000 +#define AXP192_BACKUP_BATT_CHARGING_CURRENT_400uA 0b00000011 +#define AXP192_BACKUP_BATT_CHARGING_CURRENT_200uA 0b00000010 +#define AXP192_BACKUP_BATT_CHARGING_CURRENT_100uA 0b00000001 +#define AXP192_BACKUP_BATT_CHARGING_CURRENT_50uA 0b00000000 +#define AXP192_BACKUP_BATT_CHARGING_CURRENT_MASK 0b00000011 + +#define AXP192_PEK 0x36 +#define AXP192_PEK_SHORT_PRESS_1S 0b11000000 +#define AXP192_PEK_SHORT_PRESS_512mS 0b10000000 +#define AXP192_PEK_SHORT_PRESS_256mS 0b01000000 +#define AXP192_PEK_SHORT_PRESS_128mS 0b00000000 +#define AXP192_PEK_SHORT_PRESS_MASK 0b11000000 +#define AXP192_PEK_LONG_PRESS_2_5S 0b00110000 +#define AXP192_PEK_LONG_PRESS_2_0S 0b00100000 +#define AXP192_PEK_LONG_PRESS_1_5S 0b00010000 +#define AXP192_PEK_LONG_PRESS_1_0S 0b00000000 +#define AXP192_PEK_LONG_PRESS_MASK 0b00110000 +#define AXP192_PEK_LONG_PRESS_POWER_OFF 0b00001000 +#define AXP192_PEK_PWROK_DELAY_64mS 0b00000100 +#define AXP192_PEK_PWROK_DELAY_32mS 0b00000000 +#define AXP192_PEK_PWROK_DELAY_MASK 0b00000100 +#define AXP192_PEK_POWER_OFF_TIME_12S 0b00000011 +#define AXP192_PEK_POWER_OFF_TIME_8S 0b00000010 +#define AXP192_PEK_POWER_OFF_TIME_6S 0b00000001 +#define AXP192_PEK_POWER_OFF_TIME_4S 0b00000000 +#define AXP192_PEK_POWER_OFF_TIME_MASK 0b00000011 + +#define AXP192_BATT_TEMP_LOW_THRESH 0x38 +#define AXP192_BATT_TEMP_HIGH_THRESH 0x39 +#define AXP192_BATT_TEMP_HIGH_THRESH_DEFAULT 0b11111100 + +#define AXP192_IRQ_1_ENABLE 0x40 +#define AXP192_IRQ_2_ENABLE 0x41 +#define AXP192_IRQ_3_ENABLE 0x42 +#define AXP192_IRQ_4_ENABLE 0x43 +#define AXP192_IRQ_5_ENABLE 0x4a + +#define AXP192_IRQ_1_STATUS 0x44 +#define AXP192_IRQ_2_STATUS 0x45 +#define AXP192_IRQ_3_STATUS 0x46 +#define AXP192_IRQ_4_STATUS 0x47 +#define AXP192_IRQ_5_STATUS 0x4d + +#define AXP192_IRQ_3_PEK_SHORT_PRESS 0b00000010 +#define AXP192_IRQ_3_PEK_LONG_PRESS 0b00000001 + +#define AXP192_ADC_ACIN_VOLTAGE_H 0x56 +#define AXP192_ADC_ACIN_VOLTAGE_L 0x57 +#define AXP192_ADC_ACIN_CURRENT_H 0x58 +#define AXP192_ADC_ACIN_CURRENT_L 0x59 +#define AXP192_ADC_VBUS_VOLTAGE_H 0x5a +#define AXP192_ADC_VBUS_VOLTAGE_L 0x5b +#define AXP192_ADC_VBUS_CURRENT_H 0x5c +#define AXP192_ADC_VBUS_CURRENT_L 0x5d +#define AXP192_ADC_INTERNAL_TEMP_H 0x5e +#define AXP192_ADC_INTERNAL_TEMP_L 0x5f + +#define AXP192_ADC_BATT_VOLTAGE_H 0x78 +#define AXP192_ADC_BATT_VOLTAGE_L 0x79 + +#define AXP192_ADC_BATT_POWER_H 0x70 +#define AXP192_ADC_BATT_POWER_M 0x71 +#define AXP192_ADC_BATT_POWER_L 0x72 + +#define AXP192_ADC_BATT_CHARGE_CURRENT_H 0x7a +#define AXP192_ADC_BATT_CHARGE_CURRENT_L 0x7b +#define AXP192_ADC_BATT_DISCHARGE_CURRENT_H 0x7c +#define AXP192_ADC_BATT_DISCHARGE_CURRENT_L 0x7d +#define AXP192_ADC_APS_VOLTAGE_H 0x7e +#define AXP192_ADC_APS_VOLTAGE_L 0x7f + +#define AXP192_ADC_ENABLE_1 0x82 +#define AXP192_ADC_ENABLE_1_BATT_VOL 0b10000000 +#define AXP192_ADC_ENABLE_1_BATT_CUR 0b01000000 +#define AXP192_ADC_ENABLE_1_ACIN_VOL 0b00100000 +#define AXP192_ADC_ENABLE_1_ACIN_CUR 0b00010000 +#define AXP192_ADC_ENABLE_1_VBUS_VOL 0b00001000 +#define AXP192_ADC_ENABLE_1_VBUS_CUR 0b00000100 +#define AXP192_ADC_ENABLE_1_APS_VOL 0b00000010 +#define AXP192_ADC_ENABLE_1_TS_PIN 0b00000001 + +#define AXP192_ADC_ENABLE_2 0x83 +#define AXP192_ADC_ENABLE_2_TEMP_MON 0b10000000 +#define AXP192_ADC_ENABLE_2_GPIO0 0b00001000 +#define AXP192_ADC_ENABLE_2_GPIO1 0b00000100 +#define AXP192_ADC_ENABLE_2_GPIO2 0b00000010 +#define AXP192_ADC_ENABLE_2_GPIO3 0b00000001 + +#define AXP192_ADC_TS 0x84 +#define AXP192_ADC_TS_SAMPLE_200HZ 0b11000000 +#define AXP192_ADC_TS_SAMPLE_100HZ 0b10000000 +#define AXP192_ADC_TS_SAMPLE_50HZ 0b01000000 +#define AXP192_ADC_TS_SAMPLE_25HZ 0b00000000 +#define AXP192_ADC_TS_SAMPLE_MASK 0b11000000 +#define AXP192_ADC_TS_OUT_CUR_80uA 0b00110000 +#define AXP192_ADC_TS_OUT_CUR_60uA 0b00100000 +#define AXP192_ADC_TS_OUT_CUR_40uA 0b00010000 +#define AXP192_ADC_TS_OUT_CUR_20uA 0b00000000 +#define AXP192_ADC_TS_OUT_CUR_MASK 0b00110000 +#define AXP192_ADC_TS_PIN_TEMP_MON 0b00000000 +#define AXP192_ADC_TS_PIN_EXTERN_ADC 0b00000100 +#define AXP192_ADC_TS_PIN_OUT_ALWAYS 0b00000011 +#define AXP192_ADC_TS_PIN_OUT_SAVE_ENG 0b00000010 +#define AXP192_ADC_TS_PIN_OUT_CHG 0b00000001 +#define AXP192_ADC_TS_PIN_OUT_DIS 0b00000000 +#define AXP192_ADC_TS_PIN_OUT_MASK 0b00000011 + +#define AXP192_GPIO0_FUNCTION 0x90 +#define AXP192_GPIO0_FUNCTION_FLOATING 0b00000111 +#define AXP192_GPIO0_FUNCTION_LOW_OUTPUT 0b00000101 +#define AXP192_GPIO0_FUNCTION_ADC_INPUT 0b00000100 +#define AXP192_GPIO0_FUNCTION_LDO_OUTPUT 0b00000010 +#define AXP192_GPIO0_FUNCTION_GENERAL_INPUT 0b00000001 +#define AXP192_GPIO0_FUNCTION_OPEN_DRAIN_OUTPUT 0b00000000 + +#define AXP192_GPIO0_LDO_VOLTAGE 0x91 +#define AXP192_GPIO0_LDO_VOLTAGE_3_3V 0b11110000 +#define AXP192_GPIO0_LDO_VOLTAGE_2_8V 0b10100000 +#define AXP192_GPIO0_LDO_VOLTAGE_1_8V 0b00000000 + + +#define AXP192_GPIO1_FUNCTION 0x92 +#define AXP192_GPIO1_FUNCTION_FLOATING 0b00000111 +#define AXP192_GPIO1_FUNCTION_LOW_OUTPUT 0b00000101 +#define AXP192_GPIO1_FUNCTION_ADC_INPUT 0b00000100 +#define AXP192_GPIO1_FUNCTION_PWM1_OUTPUT 0b00000010 +#define AXP192_GPIO1_FUNCTION_GENERAL_INPUT 0b00000001 +#define AXP192_GPIO1_FUNCTION_OPEN_DRAIN_OUTPUT 0b00000000 + + +#define AXP192_GPIO2_FUNCTION 0x93 +#define AXP192_GPIO2_FUNCTION_FLOATING 0b00000111 +#define AXP192_GPIO2_FUNCTION_LOW_OUTPUT 0b00000101 +#define AXP192_GPIO2_FUNCTION_ADC_INPUT 0b00000100 +#define AXP192_GPIO1_FUNCTION_PWM2_OUTPUT 0b00000010 +#define AXP192_GPIO2_FUNCTION_GENERAL_INPUT 0b00000001 +#define AXP192_GPIO2_FUNCTION_OPEN_DRAIN_OUTPUT 0b00000000 + +#define AXP192_PWM1_DUTY_RATIO 0x9A + +#endif diff --git a/ports/espressif/boards/m5stack_stick_c/board.c b/ports/espressif/boards/m5stack_stick_c/board.c new file mode 100644 index 0000000000..bbc0447056 --- /dev/null +++ b/ports/espressif/boards/m5stack_stick_c/board.c @@ -0,0 +1,285 @@ +/* + * This file is part of the MicroPython project, http://micropython.org/ + * + * The MIT License (MIT) + * + * Copyright (c) 2023 CDarius + * + * 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/busio/I2C.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" + +#include "axp192.h" + +// display init sequence according to adafruit_st7735r.py library +uint8_t display_init_sequence[] = { + 0x01,0x80,0x96, // SWRESET and Delay 150ms + 0x11,0x80,0xff, // SLPOUT and Delay + 0xb1,0x03,0x01,0x2C,0x2D, // _FRMCTR1 + 0xb2,0x03,0x01,0x2C,0x2D, // _FRMCTR2 + 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 + 0x36,0x01,0xc8, // MADCTL Rotate display + 0x21,0x00, // _INVON + 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,0x80,0x0a, // _NORON + 0x29,0x80,0x64 // _DISPON +}; + +static bool pmic_init(void) { + int rc; + // uint8_t read_buf[1]; + uint8_t write_buf[2]; + + busio_i2c_obj_t *internal_i2c = common_hal_board_create_i2c(0); + + // Reg: 30h + // The VBUS-IPSOUT path can be selected to be opened regardless of the status of N_VBUSEN + // VBUS VHOLD pressure limit control disabled + // VBUS current limit control disabled + write_buf[0] = AXP192_VBUS_IPSOUT; + write_buf[1] = AXP192_VBUS_IPSOUT_IGNORE_VBUSEN; + rc = common_hal_busio_i2c_write(internal_i2c, AXP192_I2C_ADDRESS, write_buf, sizeof(write_buf)); + if (rc != 0) { + return false; + } + + // Reg: 31h + // VOFF Shutdown voltage setting ( 3.0V ) + write_buf[0] = AXP192_POWER_OFF_VOLTAGE; + write_buf[1] = AXP192_POWER_OFF_VOLTAGE_3_0V; + rc = common_hal_busio_i2c_write(internal_i2c, AXP192_I2C_ADDRESS, write_buf, sizeof(write_buf)); + if (rc != 0) { + return false; + } + + // Reg: 33h + // Charge function enable control bit, including internal and external channels + // Charging target voltage: 4.2V + // Charging end current: End charging when charging current is less than 10% setting + // Internal path charging current: 100mA + write_buf[0] = AXP192_CHARGING_CTRL1; + write_buf[1] = AXP192_CHARGING_CTRL1_ENABLE | + AXP192_CHARGING_CTRL1_VOLTAGE_4_20V | + AXP192_CHARGING_CTRL1_CURRENT_100mA; + rc = common_hal_busio_i2c_write(internal_i2c, AXP192_I2C_ADDRESS, write_buf, sizeof(write_buf)); + if (rc != 0) { + return false; + } + + // Reg: 35h + // Enable RTC battery charge: 3.0V, 200uA + write_buf[0] = AXP192_BACKUP_BATT; + write_buf[1] = AXP192_BACKUP_BATT_CHARGING_ENABLE | + AXP192_BACKUP_BATT_CHARGING_VOLTAGE_3_0V | + AXP192_BACKUP_BATT_CHARGING_CURRENT_200uA; + rc = common_hal_busio_i2c_write(internal_i2c, AXP192_I2C_ADDRESS, write_buf, sizeof(write_buf)); + if (rc != 0) { + return false; + } + + // Reg: 36h + // Power on: Short press 128ms + // Power off: Long press 1s + // Power OK delay 64ms + // Power off delay 4s + write_buf[0] = AXP192_PEK; + write_buf[1] = AXP192_PEK_SHORT_PRESS_128mS | + AXP192_PEK_LONG_PRESS_1_0S | + AXP192_PEK_LONG_PRESS_POWER_OFF | + AXP192_PEK_PWROK_DELAY_64mS | + AXP192_PEK_POWER_OFF_TIME_4S; + rc = common_hal_busio_i2c_write(internal_i2c, AXP192_I2C_ADDRESS, write_buf, sizeof(write_buf)); + if (rc != 0) { + return false; + } + + // Reg: 82h + // ADC all on + write_buf[0] = AXP192_ADC_ENABLE_1; + write_buf[1] = AXP192_ADC_ENABLE_1_BATT_VOL | + AXP192_ADC_ENABLE_1_BATT_CUR | + AXP192_ADC_ENABLE_1_ACIN_VOL | + AXP192_ADC_ENABLE_1_ACIN_CUR | + AXP192_ADC_ENABLE_1_VBUS_VOL | + AXP192_ADC_ENABLE_1_VBUS_CUR | + AXP192_ADC_ENABLE_1_APS_VOL | + AXP192_ADC_ENABLE_1_TS_PIN; + rc = common_hal_busio_i2c_write(internal_i2c, AXP192_I2C_ADDRESS, write_buf, sizeof(write_buf)); + if (rc != 0) { + return false; + } + + // Reg: 83h + // ADC temperature on + write_buf[0] = AXP192_ADC_ENABLE_2; + write_buf[1] = AXP192_ADC_ENABLE_2_TEMP_MON; + rc = common_hal_busio_i2c_write(internal_i2c, AXP192_I2C_ADDRESS, write_buf, sizeof(write_buf)); + if (rc != 0) { + return false; + } + + // Reg: 84h + // ADC 25Hz + write_buf[0] = AXP192_ADC_TS; + write_buf[1] = AXP192_ADC_TS_SAMPLE_25HZ | + AXP192_ADC_TS_OUT_CUR_80uA | + AXP192_ADC_TS_PIN_OUT_SAVE_ENG; + rc = common_hal_busio_i2c_write(internal_i2c, AXP192_I2C_ADDRESS, write_buf, sizeof(write_buf)); + if (rc != 0) { + return false; + } + + // Reg: 90h + // GPIO0(LDOio0) floating + write_buf[0] = AXP192_GPIO0_FUNCTION; + write_buf[1] = AXP192_GPIO0_FUNCTION_FLOATING; + rc = common_hal_busio_i2c_write(internal_i2c, AXP192_I2C_ADDRESS, write_buf, sizeof(write_buf)); + if (rc != 0) { + return false; + } + + // Reg: 91h + // GPIO0(LDOio0) 2.8V + write_buf[0] = AXP192_GPIO0_LDO_VOLTAGE; + write_buf[1] = AXP192_GPIO0_LDO_VOLTAGE_2_8V; + rc = common_hal_busio_i2c_write(internal_i2c, AXP192_I2C_ADDRESS, write_buf, sizeof(write_buf)); + if (rc != 0) { + return false; + } + + // Reg: 28h + // LDO2 (TFT backlight): 2.8V + // LDO3 (TFT logic): 3.0V + write_buf[0] = AXP192_LDO23_OUT_VOLTAGE; + write_buf[1] = AXP192_LDO23_OUT_VOLTAGE_LDO2_2_8V | + AXP192_LDO23_OUT_VOLTAGE_LDO3_3_0V; + rc = common_hal_busio_i2c_write(internal_i2c, AXP192_I2C_ADDRESS, write_buf, sizeof(write_buf)); + if (rc != 0) { + return false; + } + + // Reg: 12h + // Enable EXTEN, DCDC1, LDO2 and LDO3 + write_buf[0] = AXP192_DCDC13_LDO23_CTRL; + write_buf[1] = AXP192_DCDC13_LDO23_CTRL_EXTEN | + AXP192_DCDC13_LDO23_CTRL_LDO3 | + AXP192_DCDC13_LDO23_CTRL_LDO2 | + AXP192_DCDC13_LDO23_CTRL_DCDC1; + rc = common_hal_busio_i2c_write(internal_i2c, AXP192_I2C_ADDRESS, write_buf, sizeof(write_buf)); + if (rc != 0) { + return false; + } + + // Reg: 28h + // DCDC1 (ESP32 VDD): 3.350V + write_buf[0] = AXP192_DCDC1_OUT_VOLTAGE; + write_buf[1] = AXP192_DCDC1_OUT_VOLTAGE_3_350V; + rc = common_hal_busio_i2c_write(internal_i2c, AXP192_I2C_ADDRESS, write_buf, sizeof(write_buf)); + if (rc != 0) { + return false; + } + + return true; +} + +static bool display_init(void) { + busio_spi_obj_t *spi = &displays[0].fourwire_bus.inline_bus; + common_hal_busio_spi_construct(spi, &pin_GPIO13, &pin_GPIO15, 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_GPIO23, // DC + &pin_GPIO5, // CS + &pin_GPIO18, // RST + 10000000, // 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, + 80, // width (after rotation) + 160, // height (after rotation) + 26, // column start + 1, // 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), + NULL, // backlight pin + NO_BRIGHTNESS_COMMAND, + 1.0f, // brightness + false, // single_byte_bounds + false, // data_as_commands + true, // auto_refresh + 80, // native_frames_per_second + false, // backlight_on_high + false, // SH1107_addressing + 50000 // backlight pwm frequency + ); + + return true; +} + +void board_init(void) { + if (!pmic_init()) { + mp_printf(&mp_plat_print, "could not initialize axp192 pmic\n"); + return; + } + + if (!display_init()) { + mp_printf(&mp_plat_print, "could not initialize ili9342c LCD"); + return; + } +} diff --git a/ports/espressif/boards/m5stack_stick_c/mpconfigboard.h b/ports/espressif/boards/m5stack_stick_c/mpconfigboard.h new file mode 100644 index 0000000000..c80dbc9ee2 --- /dev/null +++ b/ports/espressif/boards/m5stack_stick_c/mpconfigboard.h @@ -0,0 +1,46 @@ +/* + * This file is part of the MicroPython project, http://micropython.org/ + * + * The MIT License (MIT) + * + * Copyright (c) 2023 CDarius + * + * 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 "M5Stack Stick C" +#define MICROPY_HW_MCU_NAME "ESP32" + +#define MICROPY_HW_LED_STATUS (&pin_GPIO10) + +#define CIRCUITPY_BOARD_I2C (2) +#define CIRCUITPY_BOARD_I2C_PIN {{.scl = &pin_GPIO22, .sda = &pin_GPIO21}, \ + {.scl = &pin_GPIO33, .sda = &pin_GPIO32}} + +// For entering safe mode +#define CIRCUITPY_BOOT_BUTTON (&pin_GPIO37) + +// Explanation of how a user got into safe mode +#define BOARD_USER_SAFE_MODE_ACTION translate("You pressed button A at start up.") + +// 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/m5stack_stick_c/mpconfigboard.mk b/ports/espressif/boards/m5stack_stick_c/mpconfigboard.mk new file mode 100644 index 0000000000..5910605915 --- /dev/null +++ b/ports/espressif/boards/m5stack_stick_c/mpconfigboard.mk @@ -0,0 +1,9 @@ +CIRCUITPY_CREATOR_ID = 0x10151015 +CIRCUITPY_CREATION_ID = 0x00320007 + +IDF_TARGET = esp32 + +CIRCUITPY_ESP_FLASH_MODE = qio +CIRCUITPY_ESP_FLASH_FREQ = 80m +CIRCUITPY_ESP_FLASH_SIZE = 4MB +CIRCUITPY_ESPCAMERA = 0 diff --git a/ports/espressif/boards/m5stack_stick_c/pins.c b/ports/espressif/boards/m5stack_stick_c/pins.c new file mode 100644 index 0000000000..65f0960382 --- /dev/null +++ b/ports/espressif/boards/m5stack_stick_c/pins.c @@ -0,0 +1,56 @@ +#include "shared-bindings/board/__init__.h" +#include "shared-module/displayio/__init__.h" + +CIRCUITPY_BOARD_BUS_SINGLETON(porta_i2c, i2c, 1) + +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_A26), MP_ROM_PTR(&pin_GPIO26) }, + { MP_ROM_QSTR(MP_QSTR_D26), MP_ROM_PTR(&pin_GPIO26) }, + + { MP_ROM_QSTR(MP_QSTR_A36), MP_ROM_PTR(&pin_GPIO36) }, + { MP_ROM_QSTR(MP_QSTR_D36), MP_ROM_PTR(&pin_GPIO36) }, + + { 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_PORTA_SDA), MP_ROM_PTR(&pin_GPIO32) }, + { MP_ROM_QSTR(MP_QSTR_D32), MP_ROM_PTR(&pin_GPIO32) }, + + { MP_ROM_QSTR(MP_QSTR_PORTA_SCL), MP_ROM_PTR(&pin_GPIO33) }, + { MP_ROM_QSTR(MP_QSTR_D33), MP_ROM_PTR(&pin_GPIO33) }, + + { MP_ROM_QSTR(MP_QSTR_LED), MP_ROM_PTR(&pin_GPIO10) }, + { MP_ROM_QSTR(MP_QSTR_IR_LED), MP_ROM_PTR(&pin_GPIO9) }, + + // buttons + { MP_ROM_QSTR(MP_QSTR_BTN_A), MP_ROM_PTR(&pin_GPIO37) }, + { MP_ROM_QSTR(MP_QSTR_BTN_B), MP_ROM_PTR(&pin_GPIO39) }, + + // internal i2c bus + { MP_ROM_QSTR(MP_QSTR_SYS_SDA), MP_ROM_PTR(&pin_GPIO21) }, + { MP_ROM_QSTR(MP_QSTR_SYS_SCL), MP_ROM_PTR(&pin_GPIO22) }, + + // internal devices interrupt + { MP_ROM_QSTR(MP_QSTR_SYS_INT), MP_ROM_PTR(&pin_GPIO35) }, + + // pdm microphone + { MP_ROM_QSTR(MP_QSTR_PDM_MIC_CLK), MP_ROM_PTR(&pin_GPIO0) }, + { MP_ROM_QSTR(MP_QSTR_PDM_MIC_DATA), MP_ROM_PTR(&pin_GPIO34) }, + + // lcd spi bus + { MP_ROM_QSTR(MP_QSTR_LCD_MOSI), MP_ROM_PTR(&pin_GPIO15) }, + { MP_ROM_QSTR(MP_QSTR_LCD_CLK), MP_ROM_PTR(&pin_GPIO13) }, + { MP_ROM_QSTR(MP_QSTR_LCD_DC), MP_ROM_PTR(&pin_GPIO23) }, + { MP_ROM_QSTR(MP_QSTR_LCD_RST), MP_ROM_PTR(&pin_GPIO18) }, + { MP_ROM_QSTR(MP_QSTR_LCD_CS), MP_ROM_PTR(&pin_GPIO5) }, + + { MP_ROM_QSTR(MP_QSTR_SYS_I2C), MP_ROM_PTR(&board_i2c_obj) }, + { MP_ROM_QSTR(MP_QSTR_PORTA_I2C), MP_ROM_PTR(&board_porta_i2c_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/m5stack_stick_c/sdkconfig b/ports/espressif/boards/m5stack_stick_c/sdkconfig new file mode 100644 index 0000000000..7ec6f90c15 --- /dev/null +++ b/ports/espressif/boards/m5stack_stick_c/sdkconfig @@ -0,0 +1,26 @@ +CONFIG_ESP32_SPIRAM_SUPPORT=n + +# CONFIG_SPIRAM_ALLOW_BSS_SEG_EXTERNAL_MEMORY is not set +# +# LWIP +# +CONFIG_LWIP_LOCAL_HOSTNAME="M5StaskStickC" +# end of LWIP + +# 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/maker_badge/mpconfigboard.mk b/ports/espressif/boards/maker_badge/mpconfigboard.mk index 75d713d904..687f91ad60 100644 --- a/ports/espressif/boards/maker_badge/mpconfigboard.mk +++ b/ports/espressif/boards/maker_badge/mpconfigboard.mk @@ -3,7 +3,7 @@ USB_PID = 0x2030 USB_PRODUCT = "Maker badge" USB_MANUFACTURER = "Czech maker" -CIRCUITPY_ESP32_CAMERA = 0 +CIRCUITPY_ESPCAMERA = 0 CIRCUITPY_ESP_FLASH_MODE=dio CIRCUITPY_ESP_FLASH_FREQ=40m diff --git a/ports/espressif/boards/microdev_micro_c3/pins.c b/ports/espressif/boards/microdev_micro_c3/pins.c index 240966404f..ab3abdb39c 100644 --- a/ports/espressif/boards/microdev_micro_c3/pins.c +++ b/ports/espressif/boards/microdev_micro_c3/pins.c @@ -40,6 +40,9 @@ STATIC const mp_rom_map_elem_t board_module_globals_table[] = { { 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) }, + + /* + Reserved for Flash: { 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) }, @@ -47,6 +50,8 @@ STATIC const mp_rom_map_elem_t board_module_globals_table[] = { { 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) }, diff --git a/ports/espressif/boards/mixgo_ce_serial/mpconfigboard.mk b/ports/espressif/boards/mixgo_ce_serial/mpconfigboard.mk index 490675e467..1e4ed0b859 100644 --- a/ports/espressif/boards/mixgo_ce_serial/mpconfigboard.mk +++ b/ports/espressif/boards/mixgo_ce_serial/mpconfigboard.mk @@ -9,9 +9,9 @@ CIRCUITPY_ESP_FLASH_MODE = dio CIRCUITPY_ESP_FLASH_FREQ = 40m CIRCUITPY_ESP_FLASH_SIZE = 4MB -CIRCUITPY_ESP32_CAMERA = 0 +CIRCUITPY_ESPCAMERA = 0 FROZEN_MPY_DIRS += $(TOP)/frozen/Adafruit_CircuitPython_Requests FROZEN_MPY_DIRS += $(TOP)/frozen/Adafruit_CircuitPython_NeoPixel FROZEN_MPY_DIRS += $(TOP)/frozen/mixgo_cp_lib/mixgoce_lib -CIRCUITPY_ESP32_CAMERA = 0 +CIRCUITPY_ESPCAMERA = 0 diff --git a/ports/espressif/boards/mixgo_ce_udisk/mpconfigboard.mk b/ports/espressif/boards/mixgo_ce_udisk/mpconfigboard.mk index 5c6649ce6e..e9cd0c6d4a 100644 --- a/ports/espressif/boards/mixgo_ce_udisk/mpconfigboard.mk +++ b/ports/espressif/boards/mixgo_ce_udisk/mpconfigboard.mk @@ -9,9 +9,9 @@ CIRCUITPY_ESP_FLASH_MODE = dio CIRCUITPY_ESP_FLASH_FREQ = 40m CIRCUITPY_ESP_FLASH_SIZE = 4MB -CIRCUITPY_ESP32_CAMERA = 0 +CIRCUITPY_ESPCAMERA = 0 FROZEN_MPY_DIRS += $(TOP)/frozen/Adafruit_CircuitPython_Requests FROZEN_MPY_DIRS += $(TOP)/frozen/Adafruit_CircuitPython_NeoPixel FROZEN_MPY_DIRS += $(TOP)/frozen/mixgo_cp_lib/mixgoce_lib -CIRCUITPY_ESP32_CAMERA = 0 +CIRCUITPY_ESPCAMERA = 0 diff --git a/ports/espressif/boards/morpheans_morphesp-240/mpconfigboard.mk b/ports/espressif/boards/morpheans_morphesp-240/mpconfigboard.mk index abd2fc12e9..18dd435c53 100644 --- a/ports/espressif/boards/morpheans_morphesp-240/mpconfigboard.mk +++ b/ports/espressif/boards/morpheans_morphesp-240/mpconfigboard.mk @@ -8,4 +8,4 @@ IDF_TARGET = esp32s2 CIRCUITPY_ESP_FLASH_MODE = dio CIRCUITPY_ESP_FLASH_FREQ = 40m CIRCUITPY_ESP_FLASH_SIZE = 4MB -CIRCUITPY_ESP32_CAMERA = 0 +CIRCUITPY_ESPCAMERA = 0 diff --git a/ports/espressif/boards/muselab_nanoesp32_s2_wroom/mpconfigboard.mk b/ports/espressif/boards/muselab_nanoesp32_s2_wroom/mpconfigboard.mk index f2a622bc08..04fde1e562 100644 --- a/ports/espressif/boards/muselab_nanoesp32_s2_wroom/mpconfigboard.mk +++ b/ports/espressif/boards/muselab_nanoesp32_s2_wroom/mpconfigboard.mk @@ -8,4 +8,4 @@ IDF_TARGET = esp32s2 CIRCUITPY_ESP_FLASH_MODE = dio CIRCUITPY_ESP_FLASH_FREQ = 40m CIRCUITPY_ESP_FLASH_SIZE = 4MB -CIRCUITPY_ESP32_CAMERA = 0 +CIRCUITPY_ESPCAMERA = 0 diff --git a/ports/espressif/boards/seeed_xiao_esp32c3/mpconfigboard.mk b/ports/espressif/boards/seeed_xiao_esp32c3/mpconfigboard.mk index 68722982ab..d7325cf44e 100644 --- a/ports/espressif/boards/seeed_xiao_esp32c3/mpconfigboard.mk +++ b/ports/espressif/boards/seeed_xiao_esp32c3/mpconfigboard.mk @@ -3,6 +3,6 @@ CIRCUITPY_CREATION_ID = 0x00C30001 IDF_TARGET = esp32c3 -CIRCUITPY_ESP_FLASH_MODE = qio +CIRCUITPY_ESP_FLASH_MODE = dio CIRCUITPY_ESP_FLASH_FREQ = 80m CIRCUITPY_ESP_FLASH_SIZE = 4MB diff --git a/ports/espressif/boards/smartbeedesigns_bee_motion_s3/mpconfigboard.mk b/ports/espressif/boards/smartbeedesigns_bee_motion_s3/mpconfigboard.mk index 8a5fab0c1a..7e58f9979d 100644 --- a/ports/espressif/boards/smartbeedesigns_bee_motion_s3/mpconfigboard.mk +++ b/ports/espressif/boards/smartbeedesigns_bee_motion_s3/mpconfigboard.mk @@ -11,4 +11,4 @@ CIRCUITPY_ESP_FLASH_SIZE = 8MB FROZEN_MPY_DIRS += $(TOP)/frozen/Adafruit_CircuitPython_NeoPixel -CIRCUITPY_ESP32_CAMERA = 0 +CIRCUITPY_ESPCAMERA = 0 diff --git a/ports/espressif/boards/smartbeedesigns_bee_s3/mpconfigboard.mk b/ports/espressif/boards/smartbeedesigns_bee_s3/mpconfigboard.mk index 25a1db15ec..9d0974517d 100644 --- a/ports/espressif/boards/smartbeedesigns_bee_s3/mpconfigboard.mk +++ b/ports/espressif/boards/smartbeedesigns_bee_s3/mpconfigboard.mk @@ -11,4 +11,4 @@ CIRCUITPY_ESP_FLASH_SIZE = 8MB FROZEN_MPY_DIRS += $(TOP)/frozen/Adafruit_CircuitPython_NeoPixel -CIRCUITPY_ESP32_CAMERA = 0 +CIRCUITPY_ESPCAMERA = 0 diff --git a/ports/espressif/boards/targett_module_clip_wroom/mpconfigboard.mk b/ports/espressif/boards/targett_module_clip_wroom/mpconfigboard.mk index 3163320208..e13c654aa6 100644 --- a/ports/espressif/boards/targett_module_clip_wroom/mpconfigboard.mk +++ b/ports/espressif/boards/targett_module_clip_wroom/mpconfigboard.mk @@ -8,4 +8,4 @@ IDF_TARGET = esp32s2 CIRCUITPY_ESP_FLASH_MODE = dio CIRCUITPY_ESP_FLASH_FREQ = 40m CIRCUITPY_ESP_FLASH_SIZE = 4MB -CIRCUITPY_ESP32_CAMERA = 0 +CIRCUITPY_ESPCAMERA = 0 diff --git a/ports/espressif/boards/waveshare_esp32s2_pico/mpconfigboard.mk b/ports/espressif/boards/waveshare_esp32s2_pico/mpconfigboard.mk index 70f4bf008f..2db911fb26 100644 --- a/ports/espressif/boards/waveshare_esp32s2_pico/mpconfigboard.mk +++ b/ports/espressif/boards/waveshare_esp32s2_pico/mpconfigboard.mk @@ -5,6 +5,6 @@ USB_MANUFACTURER = "Waveshare Electronics" IDF_TARGET = esp32s2 -CIRCUITPY_ESP_FLASH_MODE = dio +CIRCUITPY_ESP_FLASH_MODE = qio CIRCUITPY_ESP_FLASH_FREQ = 80m CIRCUITPY_ESP_FLASH_SIZE = 4MB diff --git a/ports/espressif/boards/waveshare_esp32s2_pico/sdkconfig b/ports/espressif/boards/waveshare_esp32s2_pico/sdkconfig index e1635f6d17..3a2989a41e 100644 --- a/ports/espressif/boards/waveshare_esp32s2_pico/sdkconfig +++ b/ports/espressif/boards/waveshare_esp32s2_pico/sdkconfig @@ -1,9 +1,11 @@ +# +# SPI RAM config +# CONFIG_ESP32S2_SPIRAM_SUPPORT=y - CONFIG_DEFAULT_PSRAM_CLK_IO=30 CONFIG_DEFAULT_PSRAM_CS_IO=26 - CONFIG_SPIRAM_TYPE_ESPPSRAM64=y +CONFIG_SPIRAM_SIZE=8388608 CONFIG_SPIRAM_SPEED_80M=y CONFIG_SPIRAM=y CONFIG_SPIRAM_BOOT_INIT=y diff --git a/ports/espressif/common-hal/_bleio/Adapter.c b/ports/espressif/common-hal/_bleio/Adapter.c index 5eaf6e9cf4..3239c501cc 100644 --- a/ports/espressif/common-hal/_bleio/Adapter.c +++ b/ports/espressif/common-hal/_bleio/Adapter.c @@ -59,8 +59,8 @@ #include "esp_bt.h" #include "esp_nimble_hci.h" -#if CIRCUITPY_DOTENV -#include "shared-module/dotenv/__init__.h" +#if CIRCUITPY_OS_GETENV +#include "shared-module/os/__init__.h" #endif bleio_connection_internal_t bleio_connections[BLEIO_TOTAL_CONNECTION_COUNT]; @@ -101,22 +101,16 @@ void common_hal_bleio_adapter_set_enabled(bleio_adapter_obj_t *self, bool enable 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'; + #if CIRCUITPY_OS_GETENV + char ble_name[1 + MYNEWT_VAL_BLE_SVC_GAP_DEVICE_NAME_MAX_LENGTH]; + os_getenv_err_t result = common_hal_os_getenv_str("CIRCUITPY_BLE_NAME", ble_name, sizeof(ble_name)); + if (result == GETENV_OK) { ble_svc_gap_device_name_set(ble_name); - } else { + } else + #endif + { 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 48be3abd67..96de70bf84 100644 --- a/ports/espressif/common-hal/_bleio/CharacteristicBuffer.c +++ b/ports/espressif/common-hal/_bleio/CharacteristicBuffer.c @@ -49,7 +49,19 @@ STATIC int characteristic_buffer_on_ble_evt(struct ble_gap_event *event, void *p event->notify_rx.attr_handle == self->characteristic->handle) { const struct os_mbuf *m = event->notify_rx.om; while (m != NULL) { - ringbuf_put_n(&self->ringbuf, m->om_data, m->om_len); + const uint8_t *data = m->om_data; + uint16_t len = m->om_len; + if (self->watch_for_interrupt_char) { + for (uint16_t i = 0; i < len; i++) { + if (data[i] == mp_interrupt_char) { + mp_sched_keyboard_interrupt(); + } else { + ringbuf_put(&self->ringbuf, data[i]); + } + } + } else { + ringbuf_put_n(&self->ringbuf, data, len); + } m = SLIST_NEXT(m, om_next); } } @@ -69,9 +81,11 @@ void _common_hal_bleio_characteristic_buffer_construct(bleio_characteristic_buff bleio_characteristic_obj_t *characteristic, mp_float_t timeout, uint8_t *buffer, size_t buffer_size, - void *static_handler_entry) { + void *static_handler_entry, + bool watch_for_interrupt_char) { self->characteristic = characteristic; self->timeout_ms = timeout * 1000; + self->watch_for_interrupt_char = watch_for_interrupt_char; ringbuf_init(&self->ringbuf, buffer, buffer_size); if (static_handler_entry != NULL) { @@ -87,7 +101,7 @@ void common_hal_bleio_characteristic_buffer_construct(bleio_characteristic_buffe mp_float_t timeout, size_t buffer_size) { uint8_t *buffer = m_malloc(buffer_size, true); - _common_hal_bleio_characteristic_buffer_construct(self, characteristic, timeout, buffer, buffer_size, NULL); + _common_hal_bleio_characteristic_buffer_construct(self, characteristic, timeout, buffer, buffer_size, NULL, false); } uint32_t common_hal_bleio_characteristic_buffer_read(bleio_characteristic_buffer_obj_t *self, uint8_t *data, size_t len, int *errcode) { diff --git a/ports/espressif/common-hal/_bleio/CharacteristicBuffer.h b/ports/espressif/common-hal/_bleio/CharacteristicBuffer.h index e5247c20f7..30c3c426e6 100644 --- a/ports/espressif/common-hal/_bleio/CharacteristicBuffer.h +++ b/ports/espressif/common-hal/_bleio/CharacteristicBuffer.h @@ -27,6 +27,8 @@ #ifndef MICROPY_INCLUDED_ESPRESSIF_COMMON_HAL_BLEIO_CHARACTERISTICBUFFER_H #define MICROPY_INCLUDED_ESPRESSIF_COMMON_HAL_BLEIO_CHARACTERISTICBUFFER_H +#include + #include "py/ringbuf.h" #include "shared-bindings/_bleio/Characteristic.h" @@ -36,6 +38,7 @@ typedef struct { uint32_t timeout_ms; // Ring buffer storing consecutive incoming values. ringbuf_t ringbuf; + bool watch_for_interrupt_char; } bleio_characteristic_buffer_obj_t; #endif // MICROPY_INCLUDED_ESPRESSIF_COMMON_HAL_BLEIO_CHARACTERISTICBUFFER_H diff --git a/ports/espressif/common-hal/alarm/__init__.c b/ports/espressif/common-hal/alarm/__init__.c index 02ce3e1082..0c288d89b4 100644 --- a/ports/espressif/common-hal/alarm/__init__.c +++ b/ports/espressif/common-hal/alarm/__init__.c @@ -35,11 +35,14 @@ #include "shared-bindings/alarm/pin/PinAlarm.h" #include "shared-bindings/alarm/time/TimeAlarm.h" #include "shared-bindings/alarm/touch/TouchAlarm.h" -#include "shared-bindings/alarm/coproc/CoprocAlarm.h" #include "shared-bindings/wifi/__init__.h" #include "shared-bindings/microcontroller/__init__.h" +#if CIRCUITPY_ESPULP +#include "bindings/espulp/ULPAlarm.h" +#endif + #include "common-hal/digitalio/DigitalInOut.h" #include "supervisor/port.h" @@ -67,11 +70,13 @@ void alarm_reset(void) { alarm_pin_pinalarm_reset(); alarm_time_timealarm_reset(); alarm_touch_touchalarm_reset(); - alarm_coproc_coprocalarm_reset(); + #if CIRCUITPY_ESPULP + espulp_ulpalarm_reset(); + #endif esp_sleep_disable_wakeup_source(ESP_SLEEP_WAKEUP_ALL); } -STATIC esp_sleep_wakeup_cause_t _get_wakeup_cause(void) { +STATIC esp_sleep_wakeup_cause_t _get_wakeup_cause(bool deep_sleep) { // First check if the modules remember what last woke up if (alarm_pin_pinalarm_woke_this_cycle()) { return ESP_SLEEP_WAKEUP_GPIO; @@ -82,22 +87,27 @@ STATIC esp_sleep_wakeup_cause_t _get_wakeup_cause(void) { if (alarm_touch_touchalarm_woke_this_cycle()) { return ESP_SLEEP_WAKEUP_TOUCHPAD; } - if (alarm_coproc_coprocalarm_woke_this_cycle()) { + #if CIRCUITPY_ESPULP + if (espulp_ulpalarm_woke_this_cycle()) { return ESP_SLEEP_WAKEUP_ULP; } + #endif // If waking from true deep sleep, modules will have lost their state, // so check the deep wakeup cause manually - return esp_sleep_get_wakeup_cause(); + if (deep_sleep) { + return esp_sleep_get_wakeup_cause(); + } + return ESP_SLEEP_WAKEUP_UNDEFINED; } bool common_hal_alarm_woken_from_sleep(void) { - return _get_wakeup_cause() != ESP_SLEEP_WAKEUP_UNDEFINED; + return _get_wakeup_cause(false) != ESP_SLEEP_WAKEUP_UNDEFINED; } mp_obj_t common_hal_alarm_record_wake_alarm(void) { // If woken from deep sleep, create a copy alarm similar to what would have // been passed in originally. Otherwise, just return none - esp_sleep_wakeup_cause_t cause = _get_wakeup_cause(); + esp_sleep_wakeup_cause_t cause = _get_wakeup_cause(true); switch (cause) { case ESP_SLEEP_WAKEUP_TIMER: { return alarm_time_timealarm_record_wake_alarm(); @@ -113,9 +123,11 @@ mp_obj_t common_hal_alarm_record_wake_alarm(void) { return alarm_touch_touchalarm_record_wake_alarm(); } + #if CIRCUITPY_ESPULP case ESP_SLEEP_WAKEUP_ULP: { - return alarm_coproc_coprocalarm_record_wake_alarm(); + return espulp_ulpalarm_record_wake_alarm(); } + #endif case ESP_SLEEP_WAKEUP_UNDEFINED: default: @@ -130,7 +142,9 @@ STATIC void _setup_sleep_alarms(bool deep_sleep, size_t n_alarms, const mp_obj_t alarm_pin_pinalarm_set_alarms(deep_sleep, n_alarms, alarms); alarm_time_timealarm_set_alarms(deep_sleep, n_alarms, alarms); alarm_touch_touchalarm_set_alarm(deep_sleep, n_alarms, alarms); - alarm_coproc_coprocalarm_set_alarm(deep_sleep, n_alarms, alarms); + #if CIRCUITPY_ESPULP + espulp_ulpalarm_set_alarm(deep_sleep, n_alarms, alarms); + #endif } mp_obj_t common_hal_alarm_light_sleep_until_alarms(size_t n_alarms, const mp_obj_t *alarms) { @@ -143,7 +157,7 @@ mp_obj_t common_hal_alarm_light_sleep_until_alarms(size_t n_alarms, const mp_obj RUN_BACKGROUND_TASKS; // Detect if interrupt was alarm or ctrl-C interrupt. if (common_hal_alarm_woken_from_sleep()) { - esp_sleep_wakeup_cause_t cause = _get_wakeup_cause(); + esp_sleep_wakeup_cause_t cause = _get_wakeup_cause(false); switch (cause) { case ESP_SLEEP_WAKEUP_TIMER: { wake_alarm = alarm_time_timealarm_find_triggered_alarm(n_alarms,alarms); @@ -157,10 +171,12 @@ mp_obj_t common_hal_alarm_light_sleep_until_alarms(size_t n_alarms, const mp_obj wake_alarm = alarm_touch_touchalarm_find_triggered_alarm(n_alarms,alarms); break; } + #if CIRCUITPY_ESPULP case ESP_SLEEP_WAKEUP_ULP: { - wake_alarm = alarm_coproc_coprocalarm_find_triggered_alarm(n_alarms,alarms); + wake_alarm = espulp_ulpalarm_find_triggered_alarm(n_alarms,alarms); break; } + #endif default: // Should not reach this, if all light sleep types are covered correctly break; @@ -187,7 +203,9 @@ void common_hal_alarm_set_deep_sleep_alarms(size_t n_alarms, const mp_obj_t *ala void NORETURN common_hal_alarm_enter_deep_sleep(void) { alarm_pin_pinalarm_prepare_for_deep_sleep(); alarm_touch_touchalarm_prepare_for_deep_sleep(); - alarm_coproc_coprocalarm_prepare_for_deep_sleep(); + #if CIRCUITPY_ESPULP + espulp_ulpalarm_prepare_for_deep_sleep(); + #endif // We no longer need to remember the pin preservations, since any pin resets are all done. clear_pin_preservations(); diff --git a/ports/espressif/common-hal/alarm/__init__.h b/ports/espressif/common-hal/alarm/__init__.h index 9f762f9c00..02e27e9806 100644 --- a/ports/espressif/common-hal/alarm/__init__.h +++ b/ports/espressif/common-hal/alarm/__init__.h @@ -27,13 +27,18 @@ #pragma once #include "common-hal/alarm/SleepMemory.h" -#include "common-hal/alarm/coproc/CoprocAlarm.h" #include "common-hal/alarm/pin/PinAlarm.h" #include "common-hal/alarm/time/TimeAlarm.h" #include "common-hal/alarm/touch/TouchAlarm.h" +#if CIRCUITPY_ESPULP +#include "common-hal/espulp/ULPAlarm.h" +#endif + typedef union { - alarm_coproc_coprocalarm_obj_t coproc_alarm; + #if CIRCUITPY_ESPULP + espulp_ulpalarm_obj_t ulp_alarm; + #endif alarm_pin_pinalarm_obj_t pin_alarm; alarm_time_timealarm_obj_t time_alarm; alarm_touch_touchalarm_obj_t touch_alarm; diff --git a/ports/espressif/common-hal/alarm/coproc/CoprocAlarm.c b/ports/espressif/common-hal/alarm/coproc/CoprocAlarm.c deleted file mode 100644 index 9ee187d27c..0000000000 --- a/ports/espressif/common-hal/alarm/coproc/CoprocAlarm.c +++ /dev/null @@ -1,132 +0,0 @@ -/* - * This file is part of the MicroPython project, http://micropython.org/ - * - * The MIT License (MIT) - * - * Copyright (c) 2022 microDev - * - * Permission is hereby granted, free of charge, to any person obtaining a copy - * of this software and associated documentation files (the "Software"), to deal - * in the Software without restriction, including without limitation the rights - * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell - * copies of the Software, and to permit persons to whom the Software is - * furnished to do so, subject to the following conditions: - * - * The above copyright notice and this permission notice shall be included in - * all copies or substantial portions of the Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR - * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, - * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE - * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER - * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, - * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN - * THE SOFTWARE. - */ - -#include "shared-bindings/alarm/__init__.h" -#include "shared-bindings/alarm/coproc/CoprocAlarm.h" -#include "shared-bindings/coproc/__init__.h" - -#if CIRCUITPY_COPROC - -#include "supervisor/port.h" - -#include "driver/rtc_cntl.h" -#include "soc/rtc_cntl_reg.h" - -#include "esp_sleep.h" - -static volatile bool woke_up = false; - -mp_obj_t alarm_coproc_coprocalarm_find_triggered_alarm(const size_t n_alarms, const mp_obj_t *alarms) { - for (size_t i = 0; i < n_alarms; i++) { - if (mp_obj_is_type(alarms[i], &alarm_coproc_coprocalarm_type)) { - return alarms[i]; - } - } - return mp_const_none; -} - -mp_obj_t alarm_coproc_coprocalarm_record_wake_alarm(void) { - alarm_coproc_coprocalarm_obj_t *const alarm = &alarm_wake_alarm.coproc_alarm; - - alarm->base.type = &alarm_coproc_coprocalarm_type; - return alarm; -} - -// This is used to wake the main CircuitPython task. -STATIC void coproc_interrupt(void *arg) { - (void)arg; - woke_up = true; - port_wake_main_task_from_isr(); -} - -void alarm_coproc_coprocalarm_set_alarm(const bool deep_sleep, const size_t n_alarms, const mp_obj_t *alarms) { - bool coproc_alarm_set = false; - alarm_coproc_coprocalarm_obj_t *coproc_alarm = MP_OBJ_NULL; - - for (size_t i = 0; i < n_alarms; i++) { - if (mp_obj_is_type(alarms[i], &alarm_coproc_coprocalarm_type)) { - if (deep_sleep && coproc_alarm_set) { - mp_raise_ValueError_varg(translate("Only one %q can be set in deep sleep."), MP_QSTR_CoprocAlarm); - } - coproc_alarm = MP_OBJ_TO_PTR(alarms[i]); - coproc_alarm_set = true; - } - } - - if (!coproc_alarm_set) { - return; - } - - // enable coproc interrupt - rtc_isr_register(&coproc_interrupt, NULL, RTC_CNTL_COCPU_INT_ST); - REG_SET_BIT(RTC_CNTL_INT_ENA_REG, RTC_CNTL_COCPU_INT_ENA); - - // start coproc program - common_hal_coproc_run(coproc_alarm->coproc); -} - -void alarm_coproc_coprocalarm_prepare_for_deep_sleep(void) { - // disbale coproc interrupt - rtc_isr_deregister(&coproc_interrupt, NULL); - REG_CLR_BIT(RTC_CNTL_INT_ENA_REG, RTC_CNTL_COCPU_INT_ENA); - - // enable coproc wakeup - esp_sleep_enable_ulp_wakeup(); - esp_sleep_pd_config(ESP_PD_DOMAIN_RTC_SLOW_MEM, ESP_PD_OPTION_ON); -} - -bool alarm_coproc_coprocalarm_woke_this_cycle(void) { - return woke_up; -} - -void alarm_coproc_coprocalarm_reset(void) { - woke_up = false; -} - -#else // CIRCUITPY_COPROC - -mp_obj_t alarm_coproc_coprocalarm_find_triggered_alarm(const size_t n_alarms, const mp_obj_t *alarms) { - return mp_const_none; -} - -mp_obj_t alarm_coproc_coprocalarm_record_wake_alarm(void) { - return mp_const_none; -} - -void alarm_coproc_coprocalarm_set_alarm(const bool deep_sleep, const size_t n_alarms, const mp_obj_t *alarms) { -} - -void alarm_coproc_coprocalarm_prepare_for_deep_sleep(void) { -} - -bool alarm_coproc_coprocalarm_woke_this_cycle(void) { - return false; -} - -void alarm_coproc_coprocalarm_reset(void) { -} - -#endif // CIRCUITPY_COPROC diff --git a/ports/espressif/common-hal/audiobusio/__init__.c b/ports/espressif/common-hal/audiobusio/__init__.c index d6c3676d6a..e58aeefe88 100644 --- a/ports/espressif/common-hal/audiobusio/__init__.c +++ b/ports/espressif/common-hal/audiobusio/__init__.c @@ -80,11 +80,13 @@ void i2s_reset(void) { } } +#define I2S_WRITE_DELAY pdMS_TO_TICKS(1) + static void i2s_fill_buffer(i2s_t *self) { if (self->instance < 0 || self->instance >= I2S_NUM_MAX) { return; } -#define STACK_BUFFER_SIZE (512) +#define STACK_BUFFER_SIZE (4096) int16_t signed_samples[STACK_BUFFER_SIZE / sizeof(int16_t)]; if (!self->playing || self->paused || !self->sample || self->stopping) { @@ -92,7 +94,7 @@ static void i2s_fill_buffer(i2s_t *self) { size_t bytes_written = 0; do { - CHECK_ESP_RESULT(i2s_write(self->instance, signed_samples, sizeof(signed_samples), &bytes_written, 0)); + CHECK_ESP_RESULT(i2s_write(self->instance, signed_samples, sizeof(signed_samples), &bytes_written, I2S_WRITE_DELAY)); } while (bytes_written != 0); return; } @@ -120,9 +122,9 @@ static void i2s_fill_buffer(i2s_t *self) { size_t bytecount = self->sample_end - self->sample_data; if (self->samples_signed && self->channel_count == 2) { if (self->bytes_per_sample == 2) { - CHECK_ESP_RESULT(i2s_write(self->instance, self->sample_data, bytecount, &bytes_written, 0)); + CHECK_ESP_RESULT(i2s_write(self->instance, self->sample_data, bytecount, &bytes_written, I2S_WRITE_DELAY)); } else { - CHECK_ESP_RESULT(i2s_write_expand(self->instance, self->sample_data, bytecount, 8, 16, &bytes_written, 0)); + CHECK_ESP_RESULT(i2s_write_expand(self->instance, self->sample_data, bytecount, 8, 16, &bytes_written, I2S_WRITE_DELAY)); } } else { const size_t bytes_per_output_frame = 4; @@ -151,7 +153,7 @@ static void i2s_fill_buffer(i2s_t *self) { } } size_t expanded_bytes_written = 0; - CHECK_ESP_RESULT(i2s_write(self->instance, signed_samples, bytes_per_output_frame * framecount, &expanded_bytes_written, 0)); + CHECK_ESP_RESULT(i2s_write(self->instance, signed_samples, bytes_per_output_frame * framecount, &expanded_bytes_written, I2S_WRITE_DELAY)); assert(expanded_bytes_written % 4 == 0); bytes_written = expanded_bytes_written / bytes_per_output_frame * bytes_per_input_frame; } @@ -188,8 +190,8 @@ void port_i2s_allocate_init(i2s_t *self, bool left_justified) { .bits_per_sample = 16, .channel_format = I2S_CHANNEL_FMT_RIGHT_LEFT, .communication_format = left_justified ? I2S_COMM_FORMAT_STAND_I2S : I2S_COMM_FORMAT_STAND_I2S, - .dma_buf_count = 2, - .dma_buf_len = 128, // in _frames_, so 128 is 512 bytes per dma buf + .dma_buf_count = 3, + .dma_buf_len = 1024, // in _frames_, so 1024 is 4096 bytes per dma buf .use_apll = false, }; CHECK_ESP_RESULT(i2s_driver_install(self->instance, &i2s_config, I2S_QUEUE_SIZE, &i2s_queues[self->instance])); @@ -223,7 +225,11 @@ void port_i2s_play(i2s_t *self, mp_obj_t sample, bool loop) { audiosample_reset_buffer(self->sample, false, 0); - CHECK_ESP_RESULT(i2s_set_sample_rates(self->instance, audiosample_sample_rate(sample))); + uint32_t sample_rate = audiosample_sample_rate(sample); + if (sample_rate != self->i2s_config.sample_rate) { + CHECK_ESP_RESULT(i2s_set_sample_rates(self->instance, audiosample_sample_rate(sample))); + self->i2s_config.sample_rate = sample_rate; + } background_callback_add(&self->callback, i2s_callback_fun, self); } diff --git a/ports/espressif/common-hal/coproc/Coproc.c b/ports/espressif/common-hal/coproc/Coproc.c deleted file mode 100644 index c2115c1e94..0000000000 --- a/ports/espressif/common-hal/coproc/Coproc.c +++ /dev/null @@ -1,73 +0,0 @@ -/* - * This file is part of the Micro Python project, http://micropython.org/ - * - * The MIT License (MIT) - * - * Copyright (c) 2022 microDev - * - * Permission is hereby granted, free of charge, to any person obtaining a copy - * of this software and associated documentation files (the "Software"), to deal - * in the Software without restriction, including without limitation the rights - * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell - * copies of the Software, and to permit persons to whom the Software is - * furnished to do so, subject to the following conditions: - * - * The above copyright notice and this permission notice shall be included in - * all copies or substantial portions of the Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR - * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, - * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE - * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER - * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, - * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN - * THE SOFTWARE. - */ - -#include "shared-bindings/coproc/Coproc.h" -#include "shared-bindings/coproc/CoprocMemory.h" - -#include "py/runtime.h" - -#if defined(CONFIG_IDF_TARGET_ESP32S2) -#include "esp32s2/ulp.h" -#define ULP_COPROC_RESERVE_MEM (CONFIG_ESP32S2_ULP_COPROC_RESERVE_MEM) -#elif defined(CONFIG_IDF_TARGET_ESP32S3) -#include "esp32s3/ulp.h" -#define ULP_COPROC_RESERVE_MEM (CONFIG_ESP32S3_ULP_COPROC_RESERVE_MEM) -#endif - -#define RTC_SLOW_MEM_END ((uint32_t)RTC_SLOW_MEM + ULP_COPROC_RESERVE_MEM) - -void common_hal_coproc_coproc_construct(coproc_coproc_obj_t *self, - const uint8_t *buf, const size_t buf_len, coproc_memory_obj_t *coproc_memory) { - // set CoprocMemory object - if (coproc_memory != NULL) { - if (coproc_memory->address < ((uint32_t)RTC_SLOW_MEM + buf_len) || - coproc_memory->address > (RTC_SLOW_MEM_END - coproc_memory->len)) { - mp_raise_ValueError_varg(translate("%q out of range"), MP_QSTR_CoprocMemory); - } - } - self->coproc_memory = coproc_memory; - - // load buffer - if (buf_len > ULP_COPROC_RESERVE_MEM) { - mp_raise_RuntimeError(translate("Firmware is too big")); - } - self->buf_len = buf_len; - self->buf = (uint8_t *)m_malloc(self->buf_len, false); - memcpy(self->buf, buf, self->buf_len); -} - -bool common_hal_coproc_coproc_deinited(coproc_coproc_obj_t *self) { - return self->buf == NULL; -} - -void common_hal_coproc_coproc_deinit(coproc_coproc_obj_t *self) { - if (common_hal_coproc_coproc_deinited(self)) { - return; - } - m_free(self->buf); - self->buf = NULL; - self->coproc_memory = NULL; -} diff --git a/ports/espressif/common-hal/coproc/__init__.c b/ports/espressif/common-hal/coproc/__init__.c deleted file mode 100644 index e372bfa235..0000000000 --- a/ports/espressif/common-hal/coproc/__init__.c +++ /dev/null @@ -1,72 +0,0 @@ -/* - * This file is part of the Micro Python project, http://micropython.org/ - * - * The MIT License (MIT) - * - * Copyright (c) 2022 microDev - * - * Permission is hereby granted, free of charge, to any person obtaining a copy - * of this software and associated documentation files (the "Software"), to deal - * in the Software without restriction, including without limitation the rights - * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell - * copies of the Software, and to permit persons to whom the Software is - * furnished to do so, subject to the following conditions: - * - * The above copyright notice and this permission notice shall be included in - * all copies or substantial portions of the Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR - * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, - * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE - * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER - * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, - * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN - * THE SOFTWARE. - */ - -#include "shared-bindings/coproc/__init__.h" - -#include "py/runtime.h" - -#if defined(CONFIG_IDF_TARGET_ESP32S2) -#include "esp32s2/ulp.h" -#include "esp32s2/ulp_riscv.h" -#elif defined(CONFIG_IDF_TARGET_ESP32S3) -#include "esp32s3/ulp.h" -#include "esp32s3/ulp_riscv.h" -#endif - -// To-do idf v5.0: remove following include -#include "soc/rtc_cntl_reg.h" - -void common_hal_coproc_run(coproc_coproc_obj_t *self) { - if (GET_PERI_REG_MASK(RTC_CNTL_ULP_CP_TIMER_REG, RTC_CNTL_ULP_CP_SLP_TIMER_EN)) { - mp_raise_RuntimeError(translate("Already running")); - } - - ulp_riscv_load_binary(self->buf, self->buf_len); - m_free(self->buf); - self->buf = (uint8_t *)RTC_SLOW_MEM; - - ulp_riscv_run(); -} - -void common_hal_coproc_halt(coproc_coproc_obj_t *self) { - self->buf = (uint8_t *)m_malloc(self->buf_len, false); - memcpy(self->buf, (uint8_t *)RTC_SLOW_MEM, self->buf_len); - - // To-do idf v5.0: use following functions - // ulp_riscv_timer_stop(); - // ulp_riscv_halt(); - - // stop the ulp timer - CLEAR_PERI_REG_MASK(RTC_CNTL_ULP_CP_TIMER_REG, RTC_CNTL_ULP_CP_SLP_TIMER_EN); - // suspends the ulp operation - SET_PERI_REG_MASK(RTC_CNTL_COCPU_CTRL_REG, RTC_CNTL_COCPU_DONE); - // resets the processor - SET_PERI_REG_MASK(RTC_CNTL_COCPU_CTRL_REG, RTC_CNTL_COCPU_SHUT_RESET_EN); -} - -mp_obj_t common_hal_coproc_memory(coproc_coproc_obj_t *self) { - return (self->coproc_memory) ? MP_OBJ_FROM_PTR(self->coproc_memory) : mp_const_none; -} diff --git a/ports/espressif/common-hal/esp32_camera/Camera.c b/ports/espressif/common-hal/espcamera/Camera.c similarity index 80% rename from ports/espressif/common-hal/esp32_camera/Camera.c rename to ports/espressif/common-hal/espcamera/Camera.c index 65d2d0fbc6..e3e5ef49f9 100644 --- a/ports/espressif/common-hal/esp32_camera/Camera.c +++ b/ports/espressif/common-hal/espcamera/Camera.c @@ -27,9 +27,9 @@ #include "py/mperrno.h" #include "py/runtime.h" -#include "bindings/esp32_camera/Camera.h" +#include "bindings/espcamera/Camera.h" #include "bindings/espidf/__init__.h" -#include "common-hal/esp32_camera/Camera.h" +#include "common-hal/espcamera/Camera.h" #include "shared-bindings/busio/I2C.h" #include "shared-bindings/microcontroller/Pin.h" #include "shared-bindings/util.h" @@ -38,10 +38,10 @@ #include "esp32-camera/driver/private_include/cam_hal.h" #if !CONFIG_SPIRAM -#error esp32_camera only works on boards configured with spiram, disable it in mpconfigboard.mk +#error espcamera only works on boards configured with spiram, disable it in mpconfigboard.mk #endif -static void i2c_lock(esp32_camera_camera_obj_t *self) { +static void i2c_lock(espcamera_camera_obj_t *self) { if (common_hal_busio_i2c_deinited(self->i2c)) { raise_deinited_error(); } @@ -50,7 +50,7 @@ static void i2c_lock(esp32_camera_camera_obj_t *self) { } } -static void i2c_unlock(esp32_camera_camera_obj_t *self) { +static void i2c_unlock(espcamera_camera_obj_t *self) { common_hal_busio_i2c_unlock(self->i2c); } @@ -60,8 +60,8 @@ static void maybe_claim_pin(const mcu_pin_obj_t *pin) { } } -void common_hal_esp32_camera_camera_construct( - esp32_camera_camera_obj_t *self, +void common_hal_espcamera_camera_construct( + espcamera_camera_obj_t *self, uint8_t data_pins[8], const mcu_pin_obj_t *external_clock_pin, const mcu_pin_obj_t *pixel_clock_pin, @@ -79,20 +79,26 @@ void common_hal_esp32_camera_camera_construct( if (common_hal_espidf_get_reserved_psram() == 0) { mp_raise_msg(&mp_type_MemoryError, translate( - "esp32_camera.Camera requires reserved PSRAM to be configured. " + "espcamera.Camera requires reserved PSRAM to be configured. " "See the documentation for instructions.")); } for (int i = 0; i < 8; i++) { claim_pin_number(data_pins[i]); } - claim_pin(external_clock_pin); + maybe_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); + if (external_clock_pin) { + common_hal_pwmio_pwmout_construct(&self->pwm, external_clock_pin, 1, external_clock_frequency, true); + self->camera_config.ledc_timer = self->pwm.tim_handle.timer_num; + self->camera_config.ledc_channel = self->pwm.chan_handle.channel; + } else { + self->camera_config.ledc_channel = 0xff; // NO_CAMERA_LEDC_CHANNEL + } self->i2c = i2c; @@ -119,9 +125,6 @@ void common_hal_esp32_camera_camera_construct( 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; @@ -137,8 +140,8 @@ void common_hal_esp32_camera_camera_construct( CHECK_ESP_RESULT(result); } -extern void common_hal_esp32_camera_camera_deinit(esp32_camera_camera_obj_t *self) { - if (common_hal_esp32_camera_camera_deinited(self)) { +extern void common_hal_espcamera_camera_deinit(espcamera_camera_obj_t *self) { + if (common_hal_espcamera_camera_deinited(self)) { return; } @@ -162,15 +165,15 @@ extern void common_hal_esp32_camera_camera_deinit(esp32_camera_camera_obj_t *sel self->camera_config.xclk_freq_hz = 0; } -bool common_hal_esp32_camera_camera_deinited(esp32_camera_camera_obj_t *self) { +bool common_hal_espcamera_camera_deinited(espcamera_camera_obj_t *self) { return !self->camera_config.xclk_freq_hz; } -bool common_hal_esp32_camera_camera_available(esp32_camera_camera_obj_t *self) { +bool common_hal_espcamera_camera_available(espcamera_camera_obj_t *self) { return esp_camera_fb_available(); } -camera_fb_t *common_hal_esp32_camera_camera_take(esp32_camera_camera_obj_t *self, int timeout_ms) { +camera_fb_t *common_hal_espcamera_camera_take(espcamera_camera_obj_t *self, int timeout_ms) { if (self->buffer_to_return) { esp_camera_fb_return(self->buffer_to_return); self->buffer_to_return = NULL; @@ -186,7 +189,7 @@ camera_fb_t *common_hal_esp32_camera_camera_take(esp32_camera_camera_obj_t *self SENSOR_GETSET(type, name, status.status_field_name, setter_function_name) #define SENSOR_GET(type, name, status_field_name, setter_function_name) \ - type common_hal_esp32_camera_camera_get_##name(esp32_camera_camera_obj_t * self) { \ + type common_hal_espcamera_camera_get_##name(espcamera_camera_obj_t * self) { \ i2c_lock(self); \ sensor_t *sensor = esp_camera_sensor_get(); \ i2c_unlock(self); \ @@ -197,7 +200,7 @@ camera_fb_t *common_hal_esp32_camera_camera_take(esp32_camera_camera_obj_t *self } #define SENSOR_SET(type, name, setter_function_name) \ - void common_hal_esp32_camera_camera_set_##name(esp32_camera_camera_obj_t * self, type value) { \ + void common_hal_espcamera_camera_set_##name(espcamera_camera_obj_t * self, type value) { \ i2c_lock(self); \ sensor_t *sensor = esp_camera_sensor_get(); \ i2c_unlock(self); \ @@ -209,15 +212,15 @@ camera_fb_t *common_hal_esp32_camera_camera_take(esp32_camera_camera_obj_t *self } \ } -pixformat_t common_hal_esp32_camera_camera_get_pixel_format(esp32_camera_camera_obj_t *self) { +pixformat_t common_hal_espcamera_camera_get_pixel_format(espcamera_camera_obj_t *self) { return self->camera_config.pixel_format; } -framesize_t common_hal_esp32_camera_camera_get_frame_size(esp32_camera_camera_obj_t *self) { +framesize_t common_hal_espcamera_camera_get_frame_size(espcamera_camera_obj_t *self) { return self->camera_config.frame_size; } -void common_hal_esp32_camera_camera_reconfigure(esp32_camera_camera_obj_t *self, framesize_t frame_size, pixformat_t pixel_format, camera_grab_mode_t grab_mode, mp_int_t framebuffer_count) { +void common_hal_espcamera_camera_reconfigure(espcamera_camera_obj_t *self, framesize_t frame_size, pixformat_t pixel_format, camera_grab_mode_t grab_mode, mp_int_t framebuffer_count) { sensor_t *sensor = esp_camera_sensor_get(); camera_sensor_info_t *sensor_info = esp_camera_sensor_get_info(&sensor->id); @@ -269,46 +272,46 @@ SENSOR_STATUS_GETSET(bool, wpc, wpc, set_wpc); SENSOR_STATUS_GETSET(bool, raw_gma, raw_gma, set_raw_gma); SENSOR_STATUS_GETSET(bool, lenc, lenc, set_lenc); -const char *common_hal_esp32_camera_camera_get_sensor_name(esp32_camera_camera_obj_t *self) { +const char *common_hal_espcamera_camera_get_sensor_name(espcamera_camera_obj_t *self) { sensor_t *sensor = esp_camera_sensor_get(); camera_sensor_info_t *sensor_info = esp_camera_sensor_get_info(&sensor->id); return sensor_info->name; } -const bool common_hal_esp32_camera_camera_get_supports_jpeg(esp32_camera_camera_obj_t *self) { +const bool common_hal_espcamera_camera_get_supports_jpeg(espcamera_camera_obj_t *self) { sensor_t *sensor = esp_camera_sensor_get(); camera_sensor_info_t *sensor_info = esp_camera_sensor_get_info(&sensor->id); return sensor_info->support_jpeg; } -const framesize_t common_hal_esp32_camera_camera_get_max_frame_size(esp32_camera_camera_obj_t *self) { +const framesize_t common_hal_espcamera_camera_get_max_frame_size(espcamera_camera_obj_t *self) { sensor_t *sensor = esp_camera_sensor_get(); camera_sensor_info_t *sensor_info = esp_camera_sensor_get_info(&sensor->id); return sensor_info->max_size; } -const int common_hal_esp32_camera_camera_get_address(esp32_camera_camera_obj_t *self) { +const int common_hal_espcamera_camera_get_address(espcamera_camera_obj_t *self) { sensor_t *sensor = esp_camera_sensor_get(); camera_sensor_info_t *sensor_info = esp_camera_sensor_get_info(&sensor->id); return sensor_info->sccb_addr; } -const int common_hal_esp32_camera_camera_get_width(esp32_camera_camera_obj_t *self) { +const int common_hal_espcamera_camera_get_width(espcamera_camera_obj_t *self) { sensor_t *sensor = esp_camera_sensor_get(); framesize_t framesize = sensor->status.framesize; return resolution[framesize].width; } -const int common_hal_esp32_camera_camera_get_height(esp32_camera_camera_obj_t *self) { +const int common_hal_espcamera_camera_get_height(espcamera_camera_obj_t *self) { sensor_t *sensor = esp_camera_sensor_get(); framesize_t framesize = sensor->status.framesize; return resolution[framesize].height; } -const camera_grab_mode_t common_hal_esp32_camera_camera_get_grab_mode(esp32_camera_camera_obj_t *self) { +const camera_grab_mode_t common_hal_espcamera_camera_get_grab_mode(espcamera_camera_obj_t *self) { return self->camera_config.grab_mode; } -const int common_hal_esp32_camera_camera_get_framebuffer_count(esp32_camera_camera_obj_t *self) { +const int common_hal_espcamera_camera_get_framebuffer_count(espcamera_camera_obj_t *self) { return self->camera_config.fb_count; } diff --git a/ports/espressif/common-hal/esp32_camera/Camera.h b/ports/espressif/common-hal/espcamera/Camera.h similarity index 96% rename from ports/espressif/common-hal/esp32_camera/Camera.h rename to ports/espressif/common-hal/espcamera/Camera.h index 4f34fa54cd..007686a523 100644 --- a/ports/espressif/common-hal/esp32_camera/Camera.h +++ b/ports/espressif/common-hal/espcamera/Camera.h @@ -31,10 +31,10 @@ #include "shared-bindings/pwmio/PWMOut.h" #include "common-hal/busio/I2C.h" -typedef struct esp32_camera_camera_obj { +typedef struct espcamera_camera_obj { mp_obj_base_t base; camera_config_t camera_config; camera_fb_t *buffer_to_return; pwmio_pwmout_obj_t pwm; busio_i2c_obj_t *i2c; -} esp32_camera_obj_t; +} espcamera_obj_t; diff --git a/ports/espressif/common-hal/espulp/ULP.c b/ports/espressif/common-hal/espulp/ULP.c new file mode 100644 index 0000000000..3350f6d45c --- /dev/null +++ b/ports/espressif/common-hal/espulp/ULP.c @@ -0,0 +1,165 @@ +/* + * This file is part of the Micro Python project, http://micropython.org/ + * + * The MIT License (MIT) + * + * Copyright (c) 2022 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 "bindings/espulp/__init__.h" +#include "bindings/espulp/ULP.h" + +#include "py/runtime.h" + +#include "shared-bindings/microcontroller/Pin.h" + +#if defined(CONFIG_IDF_TARGET_ESP32) +#include "esp32/ulp.h" +#define ULP_COPROC_RESERVE_MEM (CONFIG_ESP32_ULP_COPROC_RESERVE_MEM) +#elif defined(CONFIG_IDF_TARGET_ESP32S2) +#include "esp32s2/ulp.h" +#include "esp32s2/ulp_riscv.h" +#define ULP_COPROC_RESERVE_MEM (CONFIG_ESP32S2_ULP_COPROC_RESERVE_MEM) +#elif defined(CONFIG_IDF_TARGET_ESP32S3) +#include "esp32s3/ulp.h" +#include "esp32s3/ulp_riscv.h" +#define ULP_COPROC_RESERVE_MEM (CONFIG_ESP32S3_ULP_COPROC_RESERVE_MEM) +#endif + +// To-do idf v5.0: remove following include +#include "soc/rtc_cntl_reg.h" + +STATIC bool ulp_used = false; +STATIC uint32_t pins_used = 0; + +void espulp_reset(void) { + // NOTE: This *doesn't* disable the ULP. It'll keep running even when CircuitPython isn't. + ulp_used = false; +} + +void common_hal_espulp_ulp_run(espulp_ulp_obj_t *self, uint32_t *program, size_t length, uint32_t pin_mask) { + if (length > ULP_COPROC_RESERVE_MEM) { + mp_raise_ValueError(translate("Program too long")); + } + + if ( + #ifdef CONFIG_IDF_TARGET_ESP32 + GET_PERI_REG_MASK(RTC_CNTL_STATE0_REG, RTC_CNTL_ULP_CP_SLP_TIMER_EN) + #else + GET_PERI_REG_MASK(RTC_CNTL_ULP_CP_TIMER_REG, RTC_CNTL_ULP_CP_SLP_TIMER_EN) + #endif + ) { + mp_raise_RuntimeError(translate("Already running")); + } + + if (pin_mask >= (1 << 22)) { + raise_ValueError_invalid_pin(); + } + + for (uint8_t i = 0; i < 32; i++) { + if ((pin_mask & (1 << i)) != 0 && !pin_number_is_free(i)) { + mp_raise_ValueError_varg(translate("%q in use"), MP_QSTR_Pin); + } + } + + for (uint8_t i = 0; i < 32; i++) { + if ((pin_mask & (1 << i)) != 0) { + claim_pin_number(i); + never_reset_pin_number(i); + } + } + pins_used = pin_mask; + + ulp_set_wakeup_period(0, 20000); + + switch (self->arch) { + case FSM: + ulp_load_binary(0, (const uint8_t *)program, length); + ulp_run(0); + break; + case RISCV: + #ifndef CONFIG_IDF_TARGET_ESP32 + ulp_riscv_load_binary((const uint8_t *)program, length); + ulp_riscv_run(); + break; + #endif + default: + mp_raise_NotImplementedError(NULL); + break; + } +} + +void common_hal_espulp_ulp_halt(espulp_ulp_obj_t *self) { + #ifdef CONFIG_IDF_TARGET_ESP32 + mp_raise_NotImplementedError(NULL); + #else + // To-do idf v5.0: use following functions + // ulp_riscv_timer_stop(); + // ulp_riscv_halt(); + + // stop the ulp timer so that it doesn't restart the cpu + CLEAR_PERI_REG_MASK(RTC_CNTL_ULP_CP_TIMER_REG, RTC_CNTL_ULP_CP_SLP_TIMER_EN); + + // suspends the ulp operation + SET_PERI_REG_MASK(RTC_CNTL_COCPU_CTRL_REG, RTC_CNTL_COCPU_DONE); + + // resets the processor + SET_PERI_REG_MASK(RTC_CNTL_COCPU_CTRL_REG, RTC_CNTL_COCPU_SHUT_RESET_EN); + #endif + + // Release pins we were using. + for (uint8_t i = 0; i < 32; i++) { + if ((pins_used & (1 << i)) != 0) { + reset_pin_number(i); + } + } +} + +void common_hal_espulp_ulp_construct(espulp_ulp_obj_t *self, espulp_architecture_t arch) { + // Use a static variable to track ULP in use so that subsequent code runs can + // use a running ULP. This is only to prevent multiple portions of user code + // from using the ULP concurrently. + if (ulp_used) { + mp_raise_ValueError_varg(translate("%q in use"), MP_QSTR_ULP); + } + + #ifdef CONFIG_IDF_TARGET_ESP32 + if (self->arch == RISCV) { + mp_raise_NotImplementedError(NULL); + } + #endif + + self->arch = arch; + self->inited = true; +} + +bool common_hal_espulp_ulp_deinited(espulp_ulp_obj_t *self) { + return !self->inited; +} + +void common_hal_espulp_ulp_deinit(espulp_ulp_obj_t *self) { + if (common_hal_espulp_ulp_deinited(self)) { + return; + } + common_hal_espulp_ulp_halt(self); + self->inited = false; + ulp_used = false; +} diff --git a/ports/espressif/common-hal/coproc/CoprocMemory.h b/ports/espressif/common-hal/espulp/ULP.h similarity index 82% rename from ports/espressif/common-hal/coproc/CoprocMemory.h rename to ports/espressif/common-hal/espulp/ULP.h index c4aa088394..360dd0c9fd 100644 --- a/ports/espressif/common-hal/coproc/CoprocMemory.h +++ b/ports/espressif/common-hal/espulp/ULP.h @@ -24,15 +24,13 @@ * THE SOFTWARE. */ -#ifndef MICROPY_INCLUDED_ESPRESSIF_COMMON_HAL_COPROC_COPROCMEMORY_H -#define MICROPY_INCLUDED_ESPRESSIF_COMMON_HAL_COPROC_COPROCMEMORY_H +#pragma once #include "py/obj.h" +#include "bindings/espulp/Architecture.h" typedef struct { mp_obj_base_t base; - uint32_t address; - uint16_t len; -} coproc_memory_obj_t; - -#endif // MICROPY_INCLUDED_ESPRESSIF_COMMON_HAL_COPROC_COPROCMEMORY_H + espulp_architecture_t arch; + bool inited; +} espulp_ulp_obj_t; diff --git a/ports/espressif/common-hal/espulp/ULPAlarm.c b/ports/espressif/common-hal/espulp/ULPAlarm.c new file mode 100644 index 0000000000..3717d2ab71 --- /dev/null +++ b/ports/espressif/common-hal/espulp/ULPAlarm.c @@ -0,0 +1,130 @@ +/* + * This file is part of the MicroPython project, http://micropython.org/ + * + * The MIT License (MIT) + * + * Copyright (c) 2022 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 "bindings/espulp/ULPAlarm.h" + +#include "common-hal/alarm/__init__.h" +#include "supervisor/port.h" + +#include "driver/rtc_cntl.h" +#include "soc/rtc_cntl_reg.h" + +#include "esp_sleep.h" + +static volatile bool woke_up = false; +static bool alarm_set = false; + +void common_hal_espulp_ulpalarm_construct(espulp_ulpalarm_obj_t *self, espulp_ulp_obj_t *ulp) { + self->ulp = ulp; +} + +mp_obj_t espulp_ulpalarm_find_triggered_alarm(const size_t n_alarms, const mp_obj_t *alarms) { + for (size_t i = 0; i < n_alarms; i++) { + if (mp_obj_is_type(alarms[i], &espulp_ulpalarm_type)) { + return alarms[i]; + } + } + return mp_const_none; +} + +mp_obj_t espulp_ulpalarm_record_wake_alarm(void) { + espulp_ulpalarm_obj_t *const alarm = &alarm_wake_alarm.ulp_alarm; + alarm->base.type = &espulp_ulpalarm_type; + return alarm; +} + +// This is used to wake the main CircuitPython task. +STATIC void ulp_interrupt(void *arg) { + (void)arg; + woke_up = true; + port_wake_main_task_from_isr(); +} + +void espulp_ulpalarm_set_alarm(const bool deep_sleep, const size_t n_alarms, const mp_obj_t *alarms) { + espulp_ulpalarm_obj_t *alarm = MP_OBJ_NULL; + + for (size_t i = 0; i < n_alarms; i++) { + if (mp_obj_is_type(alarms[i], &espulp_ulpalarm_type)) { + if (alarm != MP_OBJ_NULL) { + mp_raise_ValueError_varg(translate("Only one %q can be set."), MP_QSTR_ULPAlarm); + } + alarm = MP_OBJ_TO_PTR(alarms[i]); + } + } + + if (alarm == MP_OBJ_NULL) { + return; + } + + // enable ulp interrupt + switch (alarm->ulp->arch) { + case FSM: + #ifdef CONFIG_IDF_TARGET_ESP32 + rtc_isr_register(&ulp_interrupt, NULL, RTC_CNTL_ULP_CP_INT_RAW); + #else + rtc_isr_register(&ulp_interrupt, NULL, RTC_CNTL_ULP_CP_INT_ST); + #endif + REG_SET_BIT(RTC_CNTL_INT_ENA_REG, RTC_CNTL_ULP_CP_INT_ENA); + break; + case RISCV: + #ifndef CONFIG_IDF_TARGET_ESP32 + rtc_isr_register(&ulp_interrupt, NULL, RTC_CNTL_COCPU_INT_ST); + REG_SET_BIT(RTC_CNTL_INT_ENA_REG, RTC_CNTL_COCPU_INT_ENA); + break; + #endif + default: + mp_raise_NotImplementedError(NULL); + break; + } + + alarm_set = true; +} + +void espulp_ulpalarm_prepare_for_deep_sleep(void) { + if (!alarm_set) { + return; + } + + // disable ulp interrupt + rtc_isr_deregister(&ulp_interrupt, NULL); + REG_CLR_BIT(RTC_CNTL_INT_ENA_REG, RTC_CNTL_ULP_CP_INT_ENA); + #ifndef CONFIG_IDF_TARGET_ESP32 + REG_CLR_BIT(RTC_CNTL_INT_ENA_REG, RTC_CNTL_COCPU_INT_ENA); + #endif + + // enable ulp wakeup + esp_sleep_enable_ulp_wakeup(); + esp_sleep_pd_config(ESP_PD_DOMAIN_RTC_SLOW_MEM, ESP_PD_OPTION_ON); +} + +bool espulp_ulpalarm_woke_this_cycle(void) { + return woke_up; +} + +void espulp_ulpalarm_reset(void) { + woke_up = false; + alarm_set = false; +} diff --git a/ports/espressif/common-hal/alarm/coproc/CoprocAlarm.h b/ports/espressif/common-hal/espulp/ULPAlarm.h similarity index 71% rename from ports/espressif/common-hal/alarm/coproc/CoprocAlarm.h rename to ports/espressif/common-hal/espulp/ULPAlarm.h index 57a9bcdbff..99d21180fd 100644 --- a/ports/espressif/common-hal/alarm/coproc/CoprocAlarm.h +++ b/ports/espressif/common-hal/espulp/ULPAlarm.h @@ -29,17 +29,17 @@ #include "py/obj.h" #include "py/runtime.h" -#include "common-hal/coproc/Coproc.h" +#include "bindings/espulp/ULP.h" typedef struct { mp_obj_base_t base; - coproc_coproc_obj_t *coproc; -} alarm_coproc_coprocalarm_obj_t; + espulp_ulp_obj_t *ulp; +} espulp_ulpalarm_obj_t; -mp_obj_t alarm_coproc_coprocalarm_find_triggered_alarm(const size_t n_alarms, const mp_obj_t *alarms); -mp_obj_t alarm_coproc_coprocalarm_record_wake_alarm(void); +mp_obj_t espulp_ulpalarm_find_triggered_alarm(const size_t n_alarms, const mp_obj_t *alarms); +mp_obj_t espulp_ulpalarm_record_wake_alarm(void); -void alarm_coproc_coprocalarm_prepare_for_deep_sleep(void); -void alarm_coproc_coprocalarm_reset(void); -void alarm_coproc_coprocalarm_set_alarm(const bool deep_sleep, const size_t n_alarms, const mp_obj_t *alarms); -bool alarm_coproc_coprocalarm_woke_this_cycle(void); +void espulp_ulpalarm_prepare_for_deep_sleep(void); +void espulp_ulpalarm_reset(void); +void espulp_ulpalarm_set_alarm(const bool deep_sleep, const size_t n_alarms, const mp_obj_t *alarms); +bool espulp_ulpalarm_woke_this_cycle(void); diff --git a/ports/espressif/common-hal/espulp/__init__.c b/ports/espressif/common-hal/espulp/__init__.c new file mode 100644 index 0000000000..5d403129a6 --- /dev/null +++ b/ports/espressif/common-hal/espulp/__init__.c @@ -0,0 +1,34 @@ +/* + * This file is part of the Micro Python project, http://micropython.org/ + * + * The MIT License (MIT) + * + * Copyright (c) 2022 Scott Shawcroft for Adafruit Industries LLC + * + * 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/espulp/__init__.h" + +mp_int_t common_hal_espulp_get_rtc_gpio_number(const mcu_pin_obj_t *pin) { + if (pin->number <= 21) { + return pin->number; + } + return -1; +} diff --git a/ports/espressif/common-hal/mdns/Server.c b/ports/espressif/common-hal/mdns/Server.c index d657a84eb7..18c0f0f5e4 100644 --- a/ports/espressif/common-hal/mdns/Server.c +++ b/ports/espressif/common-hal/mdns/Server.c @@ -33,19 +33,27 @@ #include "components/mdns/include/mdns.h" -STATIC bool inited = false; +// Track whether the underlying IDF mdns has been started so that we only +// create a single inited MDNS object to CircuitPython. (After deinit, another +// could be created.) +STATIC bool mdns_started = false; void mdns_server_construct(mdns_server_obj_t *self, bool workflow) { - if (inited) { + if (mdns_started) { + // Mark this object as deinited because another is already using MDNS. + self->inited = false; return; } mdns_init(); + mdns_started = true; uint8_t mac[6]; esp_netif_get_mac(common_hal_wifi_radio_obj.netif, mac); 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); + self->inited = true; + if (workflow) { // Set a delegated entry to ourselves. This allows us to respond to "circuitpython.local" // queries as well. @@ -67,21 +75,23 @@ void common_hal_mdns_server_construct(mdns_server_obj_t *self, mp_obj_t network_ mp_raise_ValueError(translate("mDNS only works with built-in WiFi")); return; } - if (inited) { + mdns_server_construct(self, false); + if (common_hal_mdns_server_deinited(self)) { mp_raise_RuntimeError(translate("mDNS already initialized")); } - mdns_server_construct(self, false); } void common_hal_mdns_server_deinit(mdns_server_obj_t *self) { - inited = false; + if (common_hal_mdns_server_deinited(self)) { + return; + } + self->inited = false; + mdns_started = false; mdns_free(); } bool common_hal_mdns_server_deinited(mdns_server_obj_t *self) { - // This returns INVALID_STATE when not initialized and INVALID_PARAM when it - // is. - return mdns_instance_name_set(NULL) == ESP_ERR_INVALID_STATE; + return !self->inited; } const char *common_hal_mdns_server_get_hostname(mdns_server_obj_t *self) { diff --git a/ports/espressif/common-hal/mdns/Server.h b/ports/espressif/common-hal/mdns/Server.h index 770f55ece4..ee463657f1 100644 --- a/ports/espressif/common-hal/mdns/Server.h +++ b/ports/espressif/common-hal/mdns/Server.h @@ -32,6 +32,7 @@ typedef struct { mp_obj_base_t base; const char *hostname; const char *instance_name; - // "cpy-" "XXXXXX" "\0" - char default_hostname[4 + 6 + 1]; + char default_hostname[sizeof("cpy-XXXXXX")]; + // Track if this object owns access to the underlying MDNS service. + bool inited; } mdns_server_obj_t; diff --git a/ports/espressif/common-hal/memorymap/AddressRange.c b/ports/espressif/common-hal/memorymap/AddressRange.c new file mode 100644 index 0000000000..ed46c159bb --- /dev/null +++ b/ports/espressif/common-hal/memorymap/AddressRange.c @@ -0,0 +1,107 @@ +/* + * This file is part of the MicroPython project, http://micropython.org/ + * + * The MIT License (MIT) + * + * Copyright (c) 2020 microDev + * + * Permission is hereby granted, free of charge, to any person obtaining a copy + * of this software and associated documentation files (the "Software"), to deal + * in the Software without restriction, including without limitation the rights + * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell + * copies of the Software, and to permit persons to whom the Software is + * furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice shall be included in + * all copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE + * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER + * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, + * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN + * THE SOFTWARE. + */ + +#include + +#include "shared-bindings/memorymap/AddressRange.h" + +#include "py/runtime.h" + +#include "soc/soc.h" + +size_t allow_ranges[][2] = { + // ULP accessible RAM + {SOC_RTC_DATA_LOW, SOC_RTC_DATA_HIGH}, + // CPU accessible RAM that is preserved during sleep if the RTC power domain is left on. + {SOC_RTC_DRAM_LOW, SOC_RTC_DRAM_HIGH}, + // RTC peripheral registers + {0x60008000, 0x60009000} + +}; + +void common_hal_memorymap_addressrange_construct(memorymap_addressrange_obj_t *self, uint8_t *start_address, size_t length) { + bool allowed = false; + for (size_t i = 0; i < MP_ARRAY_SIZE(allow_ranges); i++) { + uint8_t *allowed_start = (uint8_t *)allow_ranges[i][0]; + uint8_t *allowed_end = (uint8_t *)allow_ranges[i][1]; + if (allowed_start <= start_address && + (start_address + length) <= allowed_end) { + allowed = true; + break; + } + } + + if (!allowed) { + mp_raise_ValueError(translate("Address range not allowed")); + } + + self->start_address = start_address; + self->len = length; +} + +size_t common_hal_memorymap_addressrange_get_length(const memorymap_addressrange_obj_t *self) { + return self->len; +} + +bool common_hal_memorymap_addressrange_set_bytes(const memorymap_addressrange_obj_t *self, + size_t start_index, uint8_t *values, size_t len) { + uint8_t *address = self->start_address + start_index; + #pragma GCC diagnostic push + #pragma GCC diagnostic ignored "-Wcast-align" + if (len == 1) { + *((uint8_t *)address) = values[0]; + } else if (len == sizeof(uint16_t) && (((size_t)address) % sizeof(uint16_t)) == 0) { + *((uint16_t *)address) = ((uint16_t *)values)[0]; + } else if (len == sizeof(uint32_t) && (((size_t)address) % sizeof(uint32_t)) == 0) { + *((uint32_t *)address) = ((uint32_t *)values)[0]; + } else if (len == sizeof(uint64_t) && (((size_t)address) % sizeof(uint64_t)) == 0) { + *((uint64_t *)address) = ((uint64_t *)values)[0]; + } else { + memcpy(address, values, len); + } + #pragma GCC diagnostic pop + + return true; +} + +void common_hal_memorymap_addressrange_get_bytes(const memorymap_addressrange_obj_t *self, + size_t start_index, size_t len, uint8_t *values) { + uint8_t *address = self->start_address + start_index; + #pragma GCC diagnostic push + #pragma GCC diagnostic ignored "-Wcast-align" + if (len == 1) { + values[0] = *((uint8_t *)address); + } else if (len == sizeof(uint16_t) && (((size_t)address) % sizeof(uint16_t)) == 0) { + ((uint16_t *)values)[0] = *((uint16_t *)address); + } else if (len == sizeof(uint32_t) && (((size_t)address) % sizeof(uint32_t)) == 0) { + ((uint32_t *)values)[0] = *((uint32_t *)address); + } else if (len == sizeof(uint64_t) && (((size_t)address) % sizeof(uint64_t)) == 0) { + ((uint64_t *)values)[0] = *((uint64_t *)address); + } else { + memcpy(values, address, len); + } + #pragma GCC diagnostic pop +} diff --git a/ports/espressif/common-hal/memorymap/AddressRange.h b/ports/espressif/common-hal/memorymap/AddressRange.h new file mode 100644 index 0000000000..e67cf32f5f --- /dev/null +++ b/ports/espressif/common-hal/memorymap/AddressRange.h @@ -0,0 +1,38 @@ +/* + * This file is part of the MicroPython project, http://micropython.org/ + * + * The MIT License (MIT) + * + * Copyright (c) 2020 microDev + * + * Permission is hereby granted, free of charge, to any person obtaining a copy + * of this software and associated documentation files (the "Software"), to deal + * in the Software without restriction, including without limitation the rights + * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell + * copies of the Software, and to permit persons to whom the Software is + * furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice shall be included in + * all copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE + * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER + * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, + * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN + * THE SOFTWARE. + */ + +#ifndef MICROPY_INCLUDED_ESPRESSIF_COMMON_HAL_MEMORYMAP_ADDRESSRANGE_H +#define MICROPY_INCLUDED_ESPRESSIF_COMMON_HAL_MEMORYMAP_ADDRESSRANGE_H + +#include "py/obj.h" + +typedef struct { + mp_obj_base_t base; + uint8_t *start_address; + size_t len; +} memorymap_addressrange_obj_t; + +#endif // MICROPY_INCLUDED_ESPRESSIF_COMMON_HAL_MEMORYMAP_ADDRESSRANGE_H diff --git a/ports/espressif/common-hal/memorymap/__init__.c b/ports/espressif/common-hal/memorymap/__init__.c new file mode 100644 index 0000000000..c15b17f451 --- /dev/null +++ b/ports/espressif/common-hal/memorymap/__init__.c @@ -0,0 +1 @@ +// No memorymap module functions. diff --git a/ports/espressif/common-hal/microcontroller/Processor.c b/ports/espressif/common-hal/microcontroller/Processor.c index bacc48c07b..1f09742955 100644 --- a/ports/espressif/common-hal/microcontroller/Processor.c +++ b/ports/espressif/common-hal/microcontroller/Processor.c @@ -139,6 +139,7 @@ mcu_reset_reason_t common_hal_mcu_processor_get_reset_reason(void) { case ESP_SLEEP_WAKEUP_EXT0: case ESP_SLEEP_WAKEUP_EXT1: case ESP_SLEEP_WAKEUP_TOUCHPAD: + case ESP_SLEEP_WAKEUP_ULP: return RESET_REASON_DEEP_SLEEP_ALARM; case ESP_SLEEP_WAKEUP_UNDEFINED: diff --git a/ports/espressif/common-hal/microcontroller/__init__.c b/ports/espressif/common-hal/microcontroller/__init__.c index 68479dc46f..23c7c153e9 100644 --- a/ports/espressif/common-hal/microcontroller/__init__.c +++ b/ports/espressif/common-hal/microcontroller/__init__.c @@ -108,7 +108,7 @@ void common_hal_mcu_on_next_reset(mcu_runmode_t runmode) { break; case RUNMODE_SAFE_MODE: // enter safe mode on next boot - safe_mode_on_next_reset(PROGRAMMATIC_SAFE_MODE); + safe_mode_on_next_reset(SAFE_MODE_PROGRAMMATIC); break; case RUNMODE_BOOTLOADER: // DFU download diff --git a/ports/espressif/common-hal/paralleldisplay/ParallelBus.c b/ports/espressif/common-hal/paralleldisplay/ParallelBus.c index 1b6ee41c40..c9ba3edd06 100644 --- a/ports/espressif/common-hal/paralleldisplay/ParallelBus.c +++ b/ports/espressif/common-hal/paralleldisplay/ParallelBus.c @@ -118,7 +118,8 @@ void common_hal_paralleldisplay_parallelbus_construct(paralleldisplay_parallelbu const mcu_pin_obj_t *data_pins[8]; for (int i = 0; i < 8; i++) { snprintf(buf, sizeof(buf), "GPIO%d", data0->number + i); - data_pins[i] = validate_obj_is_free_pin(mp_obj_dict_get(MP_OBJ_FROM_PTR(&mcu_pin_globals), mp_obj_new_str(buf, strlen(buf)))); + data_pins[i] = validate_obj_is_free_pin( + mp_obj_dict_get(MP_OBJ_FROM_PTR(&mcu_pin_globals), mp_obj_new_str(buf, strlen(buf))), MP_QSTR_pin); } common_hal_paralleldisplay_parallelbus_construct_nonsequential(self, 8, data_pins, command, chip_select, write, read, reset, frequency); } diff --git a/ports/espressif/common-hal/pulseio/PulseIn.c b/ports/espressif/common-hal/pulseio/PulseIn.c index 41c1dcb189..bb6ef7f975 100644 --- a/ports/espressif/common-hal/pulseio/PulseIn.c +++ b/ports/espressif/common-hal/pulseio/PulseIn.c @@ -41,7 +41,12 @@ STATIC void update_internal_buffer(pulseio_pulsein_obj_t *self) { length /= 4; for (size_t i = 0; i < length; i++) { uint16_t pos = (self->start + self->len) % self->maxlen; - self->buffer[pos] = items[i].duration0 * 3; + uint32_t val = items[i].duration0 * 3; + // make sure the value returned does not exceed the max uint16 value. + if (val > 65535) { + val = 65535; + } + self->buffer[pos] = (uint16_t)val; if (self->len < self->maxlen) { self->len++; } else { @@ -50,7 +55,11 @@ STATIC void update_internal_buffer(pulseio_pulsein_obj_t *self) { // Check if second item exists if (items[i].duration1) { pos = (self->start + self->len) % self->maxlen; - self->buffer[pos] = items[i].duration1 * 3; + val = items[i].duration1 * 3; + if (val > 65535) { + val = 65535; + } + self->buffer[pos] = (uint16_t)val; if (self->len < self->maxlen) { self->len++; } else { diff --git a/ports/espressif/common-hal/socketpool/Socket.c b/ports/espressif/common-hal/socketpool/Socket.c index ce177f3821..8b6cff30ef 100644 --- a/ports/espressif/common-hal/socketpool/Socket.c +++ b/ports/espressif/common-hal/socketpool/Socket.c @@ -31,6 +31,8 @@ #include "py/mperrno.h" #include "py/runtime.h" #include "shared-bindings/socketpool/SocketPool.h" +#include "shared-bindings/ssl/SSLSocket.h" +#include "common-hal/ssl/SSLSocket.h" #include "supervisor/port.h" #include "supervisor/shared/tick.h" #include "supervisor/workflow.h" @@ -44,7 +46,7 @@ StackType_t socket_select_stack[2 * configMINIMAL_STACK_SIZE]; STATIC int open_socket_fds[CONFIG_LWIP_MAX_SOCKETS]; -STATIC bool user_socket[CONFIG_LWIP_MAX_SOCKETS]; +STATIC socketpool_socket_obj_t *user_socket[CONFIG_LWIP_MAX_SOCKETS]; StaticTask_t socket_select_task_handle; STATIC int socket_change_fd = -1; @@ -117,7 +119,7 @@ void socket_user_reset(void) { for (size_t i = 0; i < MP_ARRAY_SIZE(open_socket_fds); i++) { open_socket_fds[i] = -1; - user_socket[i] = false; + user_socket[i] = NULL; } socket_change_fd = eventfd(0, 0); // Run this at the same priority as CP so that the web workflow background task can be @@ -134,12 +136,13 @@ void socket_user_reset(void) { for (size_t i = 0; i < MP_ARRAY_SIZE(open_socket_fds); i++) { if (open_socket_fds[i] >= 0 && user_socket[i]) { + common_hal_socketpool_socket_close(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; + user_socket[i] = NULL; } } } @@ -165,16 +168,18 @@ STATIC void unregister_open_socket(int fd) { if (open_socket_fds[i] == fd) { open_socket_fds[i] = -1; user_socket[i] = false; - write(socket_change_fd, &fd, sizeof(fd)); + // Write must be 8 bytes for an eventfd. + uint64_t signal = 1; + write(socket_change_fd, &signal, sizeof(signal)); return; } } } -STATIC void mark_user_socket(int fd) { +STATIC void mark_user_socket(int fd, socketpool_socket_obj_t *obj) { for (size_t i = 0; i < MP_ARRAY_SIZE(open_socket_fds); i++) { if (open_socket_fds[i] == fd) { - user_socket[i] = true; + user_socket[i] = obj; return; } } @@ -236,11 +241,11 @@ socketpool_socket_obj_t *common_hal_socketpool_socket(socketpool_socketpool_obj_ if (!socketpool_socket(self, family, type, sock)) { mp_raise_RuntimeError(translate("Out of sockets")); } - mark_user_socket(sock->num); + mark_user_socket(sock->num, sock); return sock; } -int socketpool_socket_accept(socketpool_socket_obj_t *self, uint8_t *ip, uint32_t *port) { +int socketpool_socket_accept(socketpool_socket_obj_t *self, uint8_t *ip, uint32_t *port, socketpool_socket_obj_t *accepted) { struct sockaddr_in accept_addr; socklen_t socklen = sizeof(accept_addr); int newsoc = -1; @@ -248,7 +253,9 @@ int socketpool_socket_accept(socketpool_socket_obj_t *self, uint8_t *ip, uint32_ uint64_t start_ticks = supervisor_ticks_ms64(); // Allow timeouts and interrupts - while (newsoc == -1 && !timed_out) { + while (newsoc == -1 && + !timed_out && + !mp_hal_is_interrupted()) { if (self->timeout_ms != (uint)-1 && self->timeout_ms != 0) { timed_out = supervisor_ticks_ms64() - start_ticks >= self->timeout_ms; } @@ -260,6 +267,9 @@ int socketpool_socket_accept(socketpool_socket_obj_t *self, uint8_t *ip, uint32_ } } + // New client socket will not be non-blocking by default, so make it non-blocking. + lwip_fcntl(newsoc, F_SETFL, O_NONBLOCK); + if (!timed_out) { // harmless on failure but avoiding memcpy is faster memcpy((void *)ip, (void *)&accept_addr.sin_addr.s_addr, sizeof(accept_addr.sin_addr.s_addr)); @@ -274,23 +284,35 @@ int socketpool_socket_accept(socketpool_socket_obj_t *self, uint8_t *ip, uint32_ lwip_close(newsoc); return -MP_EBADF; } + + + if (accepted != NULL) { + // Close the active socket because we have another we accepted. + if (!common_hal_socketpool_socket_get_closed(accepted)) { + common_hal_socketpool_socket_close(accepted); + } + // Replace the old accepted socket with the new one. + accepted->num = newsoc; + accepted->pool = self->pool; + accepted->connected = true; + } + 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); + socketpool_socket_obj_t *sock = m_new_obj_with_finaliser(socketpool_socket_obj_t); + int newsoc = socketpool_socket_accept(self, ip, port, NULL); if (newsoc > 0) { - mark_user_socket(newsoc); // Create the socket - socketpool_socket_obj_t *sock = m_new_obj_with_finaliser(socketpool_socket_obj_t); + mark_user_socket(newsoc, sock); sock->base.type = &socketpool_socket_type; sock->num = newsoc; sock->pool = self->pool; sock->connected = true; - lwip_fcntl(newsoc, F_SETFL, O_NONBLOCK); return sock; } else { mp_raise_OSError(-newsoc); @@ -325,6 +347,12 @@ bool common_hal_socketpool_socket_bind(socketpool_socket_obj_t *self, } void socketpool_socket_close(socketpool_socket_obj_t *self) { + if (self->ssl_socket) { + ssl_sslsocket_obj_t *ssl_socket = self->ssl_socket; + self->ssl_socket = NULL; + common_hal_ssl_sslsocket_close(ssl_socket); + return; + } self->connected = false; if (self->num >= 0) { lwip_shutdown(self->num, SHUT_RDWR); @@ -347,7 +375,7 @@ void common_hal_socketpool_socket_connect(socketpool_socket_obj_t *self, struct addrinfo *result_i; int error = lwip_getaddrinfo(host, NULL, &hints, &result_i); if (error != 0 || result_i == NULL) { - mp_raise_OSError(EHOSTUNREACH); + common_hal_socketpool_socketpool_raise_gaierror_noname(); } // Set parameters @@ -528,7 +556,7 @@ mp_uint_t common_hal_socketpool_socket_sendto(socketpool_socket_obj_t *self, struct addrinfo *result_i; int error = lwip_getaddrinfo(host, NULL, &hints, &result_i); if (error != 0 || result_i == NULL) { - mp_raise_OSError(EHOSTUNREACH); + common_hal_socketpool_socketpool_raise_gaierror_noname(); } // Set parameters @@ -554,6 +582,15 @@ void common_hal_socketpool_socket_settimeout(socketpool_socket_obj_t *self, uint self->timeout_ms = timeout_ms; } + +int common_hal_socketpool_socket_setsockopt(socketpool_socket_obj_t *self, int level, int optname, const void *value, size_t optlen) { + int err = lwip_setsockopt(self->num, level, optname, value, optlen); + if (err != 0) { + return -errno; + } + return 0; +} + bool common_hal_socketpool_readable(socketpool_socket_obj_t *self) { struct timeval immediate = {0, 0}; @@ -577,3 +614,18 @@ bool common_hal_socketpool_writable(socketpool_socket_obj_t *self) { // including returning true in the error case return num_triggered != 0; } + +void socketpool_socket_move(socketpool_socket_obj_t *self, socketpool_socket_obj_t *sock) { + *sock = *self; + self->connected = false; + self->num = -1; +} + +void socketpool_socket_reset(socketpool_socket_obj_t *self) { + if (self->base.type == &socketpool_socket_type) { + return; + } + self->base.type = &socketpool_socket_type; + self->connected = false; + self->num = -1; +} diff --git a/ports/espressif/common-hal/socketpool/Socket.h b/ports/espressif/common-hal/socketpool/Socket.h index b91419807c..45e36e58ca 100644 --- a/ports/espressif/common-hal/socketpool/Socket.h +++ b/ports/espressif/common-hal/socketpool/Socket.h @@ -24,8 +24,7 @@ * THE SOFTWARE. */ -#ifndef MICROPY_INCLUDED_ESPRESSIF_COMMON_HAL_SOCKETPOOL_SOCKET_H -#define MICROPY_INCLUDED_ESPRESSIF_COMMON_HAL_SOCKETPOOL_SOCKET_H +#pragma once #include "py/obj.h" @@ -34,6 +33,8 @@ #include "components/esp-tls/esp_tls.h" +typedef struct ssl_sslsocket_obj ssl_sslsocket_obj_t; + typedef struct { mp_obj_base_t base; int num; @@ -42,9 +43,8 @@ typedef struct { int ipproto; bool connected; socketpool_socketpool_obj_t *pool; + ssl_sslsocket_obj_t *ssl_socket; mp_uint_t timeout_ms; } socketpool_socket_obj_t; 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 1d1aafa638..780e90c42c 100644 --- a/ports/espressif/common-hal/socketpool/SocketPool.c +++ b/ports/espressif/common-hal/socketpool/SocketPool.c @@ -45,6 +45,16 @@ void common_hal_socketpool_socketpool_construct(socketpool_socketpool_obj_t *sel mp_obj_t common_hal_socketpool_socketpool_gethostbyname(socketpool_socketpool_obj_t *self, const char *host) { + // As of 2022, the version of lwip in esp-idf does not handle the + // trailing-dot syntax of domain names, so emulate it. + // Remove this once https://github.com/espressif/esp-idf/issues/10013 has + // been implemented + size_t strlen_host = strlen(host); + if (strlen_host && host[strlen_host - 1] == '.') { + mp_obj_t nodot = mp_obj_new_str(host, strlen_host - 1); + host = mp_obj_str_get_str(nodot); + } + const struct addrinfo hints = { .ai_family = AF_INET, .ai_socktype = SOCK_STREAM, diff --git a/ports/espressif/common-hal/ssl/SSLContext.c b/ports/espressif/common-hal/ssl/SSLContext.c index 386986e6be..1923a9c2a9 100644 --- a/ports/espressif/common-hal/ssl/SSLContext.c +++ b/ports/espressif/common-hal/ssl/SSLContext.c @@ -48,6 +48,7 @@ ssl_sslsocket_obj_t *common_hal_ssl_sslcontext_wrap_socket(ssl_sslcontext_obj_t sock->base.type = &ssl_sslsocket_type; sock->ssl_context = self; sock->sock = socket; + socket->ssl_socket = sock; // Create a copy of the ESP-TLS config object and store the server hostname // Note that ESP-TLS will use common_name for both SNI and verification diff --git a/ports/espressif/common-hal/ssl/SSLSocket.h b/ports/espressif/common-hal/ssl/SSLSocket.h index 097f19857b..6b65a56223 100644 --- a/ports/espressif/common-hal/ssl/SSLSocket.h +++ b/ports/espressif/common-hal/ssl/SSLSocket.h @@ -34,7 +34,7 @@ #include "components/esp-tls/esp_tls.h" -typedef struct { +typedef struct ssl_sslsocket_obj { mp_obj_base_t base; socketpool_socket_obj_t *sock; esp_tls_t *tls; diff --git a/ports/espressif/common-hal/wifi/Network.c b/ports/espressif/common-hal/wifi/Network.c index 34cb15d603..9a20decd4a 100644 --- a/ports/espressif/common-hal/wifi/Network.c +++ b/ports/espressif/common-hal/wifi/Network.c @@ -55,40 +55,40 @@ mp_obj_t common_hal_wifi_network_get_country(wifi_network_obj_t *self) { } mp_obj_t common_hal_wifi_network_get_authmode(wifi_network_obj_t *self) { - uint8_t authmode_mask = 0; + uint32_t authmode_mask = 0; switch (self->record.authmode) { case WIFI_AUTH_OPEN: - authmode_mask = (1 << AUTHMODE_OPEN); + authmode_mask = AUTHMODE_OPEN; break; case WIFI_AUTH_WEP: - authmode_mask = (1 << AUTHMODE_WEP); + authmode_mask = AUTHMODE_WEP; break; case WIFI_AUTH_WPA_PSK: - authmode_mask = (1 << AUTHMODE_WPA) | (1 << AUTHMODE_PSK); + authmode_mask = AUTHMODE_WPA | AUTHMODE_PSK; break; case WIFI_AUTH_WPA2_PSK: - authmode_mask = (1 << AUTHMODE_WPA2) | (1 << AUTHMODE_PSK); + authmode_mask = AUTHMODE_WPA2 | AUTHMODE_PSK; break; case WIFI_AUTH_WPA_WPA2_PSK: - authmode_mask = (1 << AUTHMODE_WPA) | (1 << AUTHMODE_WPA2) | (1 << AUTHMODE_PSK); + authmode_mask = AUTHMODE_WPA | AUTHMODE_WPA2 | AUTHMODE_PSK; break; case WIFI_AUTH_WPA2_ENTERPRISE: - authmode_mask = (1 << AUTHMODE_WPA2) | (1 << AUTHMODE_ENTERPRISE); + authmode_mask = AUTHMODE_WPA2 | AUTHMODE_ENTERPRISE; break; case WIFI_AUTH_WPA3_PSK: - authmode_mask = (1 << AUTHMODE_WPA3) | (1 << AUTHMODE_PSK); + authmode_mask = AUTHMODE_WPA3 | AUTHMODE_PSK; break; case WIFI_AUTH_WPA2_WPA3_PSK: - authmode_mask = (1 << AUTHMODE_WPA2) | (1 << AUTHMODE_WPA3) | (1 << AUTHMODE_PSK); + authmode_mask = AUTHMODE_WPA2 | AUTHMODE_WPA3 | AUTHMODE_PSK; break; default: break; } mp_obj_t authmode_list = mp_obj_new_list(0, NULL); if (authmode_mask != 0) { - for (uint8_t i = 0; i < 8; i++) { + for (uint8_t i = 0; i < 32; i++) { if ((authmode_mask >> i) & 1) { - mp_obj_list_append(authmode_list, cp_enum_find(&wifi_authmode_type, i)); + mp_obj_list_append(authmode_list, cp_enum_find(&wifi_authmode_type, 1 << i)); } } } diff --git a/ports/espressif/common-hal/wifi/Radio.c b/ports/espressif/common-hal/wifi/Radio.c index 27e2c8c610..acd6ae53bc 100644 --- a/ports/espressif/common-hal/wifi/Radio.c +++ b/ports/espressif/common-hal/wifi/Radio.c @@ -205,20 +205,21 @@ void common_hal_wifi_radio_stop_station(wifi_radio_obj_t *self) { set_mode_station(self, false); } -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) { +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, uint32_t authmodes, uint8_t max_connections) { set_mode_ap(self, true); - switch (authmode) { - case (1 << AUTHMODE_OPEN): + uint8_t authmode = 0; + switch (authmodes) { + case AUTHMODE_OPEN: authmode = WIFI_AUTH_OPEN; break; - case ((1 << AUTHMODE_WPA) | (1 << AUTHMODE_PSK)): + case AUTHMODE_WPA | AUTHMODE_PSK: authmode = WIFI_AUTH_WPA_PSK; break; - case ((1 << AUTHMODE_WPA2) | (1 << AUTHMODE_PSK)): + case AUTHMODE_WPA2 | AUTHMODE_PSK: authmode = WIFI_AUTH_WPA2_PSK; break; - case ((1 << AUTHMODE_WPA) | (1 << AUTHMODE_WPA2) | (1 << AUTHMODE_PSK)): + case AUTHMODE_WPA | AUTHMODE_WPA2 | AUTHMODE_PSK: authmode = WIFI_AUTH_WPA_WPA2_PSK; break; default: diff --git a/ports/espressif/esp-idf b/ports/espressif/esp-idf index 716d8531d7..630c2724fc 160000 --- a/ports/espressif/esp-idf +++ b/ports/espressif/esp-idf @@ -1 +1 @@ -Subproject commit 716d8531d71b122975e2966a24ec7613b87eb7b0 +Subproject commit 630c2724fc8c69eeaaa1bb025de52b99c5cb11aa diff --git a/ports/espressif/esp-idf-config/partitions-16MB-no-uf2.csv b/ports/espressif/esp-idf-config/partitions-16MB-no-uf2.csv index 8e73e8d056..c4b103aed1 100644 --- a/ports/espressif/esp-idf-config/partitions-16MB-no-uf2.csv +++ b/ports/espressif/esp-idf-config/partitions-16MB-no-uf2.csv @@ -1,9 +1,8 @@ -# 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, +# Name, Type, SubType, Offset, Size +# bootloader, app, boot, 0x1000/0x0, 28/32K +# partition_table, data, table, 0x8000, 4K +nvs, data, nvs, 0x9000, 20K +otadata, data, ota, 0xe000, 8K +ota_0, app, ota_0, 0x10000, 2048K +ota_1, app, ota_1, 0x210000, 2048K +user_fs, data, fat, 0x410000, 12224K diff --git a/ports/espressif/esp-idf-config/partitions-16MB.csv b/ports/espressif/esp-idf-config/partitions-16MB.csv index 13ea81bea5..16c73da32b 100644 --- a/ports/espressif/esp-idf-config/partitions-16MB.csv +++ b/ports/espressif/esp-idf-config/partitions-16MB.csv @@ -1,10 +1,9 @@ -# ESP-IDF Partition Table -# Name, Type, SubType, Offset, Size, Flags -# bootloader.bin,, 0x1000, 32K -# partition table,, 0x8000, 4K -nvs, data, nvs, 0x9000, 20K, -otadata, data, ota, 0xe000, 8K, -ota_0, 0, ota_0, 0x10000, 2048K, -ota_1, 0, ota_1, 0x210000, 2048K, -uf2, app, factory,0x410000, 256K, -user_fs, data, fat, 0x450000, 11968K, +# Name, Type, SubType, Offset, Size +# bootloader, app, boot, 0x1000/0x0, 28/32K +# partition_table, data, table, 0x8000, 4K +nvs, data, nvs, 0x9000, 20K +otadata, data, ota, 0xe000, 8K +ota_0, app, ota_0, 0x10000, 2048K +ota_1, app, ota_1, 0x210000, 2048K +uf2, app, factory, 0x410000, 256K +user_fs, data, fat, 0x450000, 11968K diff --git a/ports/espressif/esp-idf-config/partitions-2MB-no-ota-no-uf2.csv b/ports/espressif/esp-idf-config/partitions-2MB-no-ota-no-uf2.csv index 869e7ac86e..1c38195565 100644 --- a/ports/espressif/esp-idf-config/partitions-2MB-no-ota-no-uf2.csv +++ b/ports/espressif/esp-idf-config/partitions-2MB-no-ota-no-uf2.csv @@ -1,7 +1,6 @@ -# ESP-IDF Partition Table -# Name, Type, SubType, Offset, Size, Flags -# bootloader.bin,, 0x1000, 32K -# partition table,, 0x8000, 4K -nvs, data, nvs, 0x9000, 20K, -app, app, factory, 0x10000, 1408K, -user_fs, data, fat, 0x170000, 576K, +# Name, Type, SubType, Offset, Size +# bootloader, app, boot, 0x1000/0x0, 28/32K +# partition_table, data, table, 0x8000, 4K +nvs, data, nvs, 0x9000, 20K +app, app, factory, 0x10000, 1408K, +user_fs, data, fat, 0x170000, 576K, diff --git a/ports/espressif/esp-idf-config/partitions-32MB.csv b/ports/espressif/esp-idf-config/partitions-32MB.csv new file mode 100644 index 0000000000..42c4084f6c --- /dev/null +++ b/ports/espressif/esp-idf-config/partitions-32MB.csv @@ -0,0 +1,9 @@ +# Name, Type, SubType, Offset, Size +# bootloader, app, boot, 0x1000/0x0, 28/32K +# partition_table, data, table, 0x8000, 4K +nvs, data, nvs, 0x9000, 20K +otadata, data, ota, 0xe000, 8K +ota_0, app, ota_0, 0x10000, 2048K +ota_1, app, ota_1, 0x210000, 2048K +uf2, app, factory, 0x410000, 256K +user_fs, data, fat, 0x450000, 28352K diff --git a/ports/espressif/esp-idf-config/partitions-4MB-no-uf2.csv b/ports/espressif/esp-idf-config/partitions-4MB-no-uf2.csv index 6dc2dcf2e9..6d27e22e76 100644 --- a/ports/espressif/esp-idf-config/partitions-4MB-no-uf2.csv +++ b/ports/espressif/esp-idf-config/partitions-4MB-no-uf2.csv @@ -1,9 +1,8 @@ -# 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, 1408K, -ota_1, 0, ota_1, 0x170000, 1408K, -user_fs, data, fat, 0x2d0000, 1216K, +# Name, Type, SubType, Offset, Size +# bootloader, app, boot, 0x1000/0x0, 28/32K +# partition_table, data, table, 0x8000, 4K +nvs, data, nvs, 0x9000, 20K +otadata, data, ota, 0xe000, 8K +ota_0, app, ota_0, 0x10000, 1408K +ota_1, app, ota_1, 0x170000, 1408K +user_fs, data, fat, 0x2d0000, 1216K diff --git a/ports/espressif/esp-idf-config/partitions-4MB.csv b/ports/espressif/esp-idf-config/partitions-4MB.csv index cf9b3cca84..981aee0b17 100644 --- a/ports/espressif/esp-idf-config/partitions-4MB.csv +++ b/ports/espressif/esp-idf-config/partitions-4MB.csv @@ -1,10 +1,9 @@ -# ESP-IDF Partition Table -# Name, Type, SubType, Offset, Size, Flags -# bootloader.bin,, 0x1000, 32K -# partition table,, 0x8000, 4K -nvs, data, nvs, 0x9000, 20K, -otadata, data, ota, 0xe000, 8K, -ota_0, 0, ota_0, 0x10000, 1408K, -ota_1, 0, ota_1, 0x170000, 1408K, -uf2, app, factory,0x2d0000, 256K, -user_fs, data, fat, 0x310000, 960K, +# Name, Type, SubType, Offset, Size +# bootloader, app, boot, 0x1000/0x0, 28/32K +# partition_table, data, table, 0x8000, 4K +nvs, data, nvs, 0x9000, 20K +otadata, data, ota, 0xe000, 8K +ota_0, app, ota_0, 0x10000, 1408K +ota_1, app, ota_1, 0x170000, 1408K +uf2, app, factory, 0x2d0000, 256K +user_fs, data, fat, 0x310000, 960K diff --git a/ports/espressif/esp-idf-config/partitions-8MB-no-uf2.csv b/ports/espressif/esp-idf-config/partitions-8MB-no-uf2.csv index ba92d9fc73..6d78fe8af5 100644 --- a/ports/espressif/esp-idf-config/partitions-8MB-no-uf2.csv +++ b/ports/espressif/esp-idf-config/partitions-8MB-no-uf2.csv @@ -1,9 +1,8 @@ -# 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, +# Name, Type, SubType, Offset, Size +# bootloader, app, boot, 0x1000/0x0, 28/32K +# partition_table, data, table, 0x8000, 4K +nvs, data, nvs, 0x9000, 20K +otadata, data, ota, 0xe000, 8K +ota_0, app, ota_0, 0x10000, 2048K +ota_1, app, ota_1, 0x210000, 2048K +user_fs, data, fat, 0x410000, 4032K diff --git a/ports/espressif/esp-idf-config/partitions-8MB.csv b/ports/espressif/esp-idf-config/partitions-8MB.csv index f4ba9b60a1..40674d322c 100644 --- a/ports/espressif/esp-idf-config/partitions-8MB.csv +++ b/ports/espressif/esp-idf-config/partitions-8MB.csv @@ -1,10 +1,9 @@ -# ESP-IDF Partition Table -# Name, Type, SubType, Offset, Size, Flags -# bootloader.bin,, 0x1000, 32K -# partition table,, 0x8000, 4K -nvs, data, nvs, 0x9000, 20K, -otadata, data, ota, 0xe000, 8K, -ota_0, 0, ota_0, 0x10000, 2048K, -ota_1, 0, ota_1, 0x210000, 2048K, -uf2, app, factory,0x410000, 256K, -user_fs, data, fat, 0x450000, 3776K, +# Name, Type, SubType, Offset, Size +# bootloader, app, boot, 0x1000/0x0, 28/32K +# partition_table, data, table, 0x8000, 4K +nvs, data, nvs, 0x9000, 20K +otadata, data, ota, 0xe000, 8K +ota_0, app, ota_0, 0x10000, 2048K +ota_1, app, ota_1, 0x210000, 2048K +uf2, app, factory, 0x410000, 256K +user_fs, data, fat, 0x450000, 3776K diff --git a/ports/espressif/esp-idf-config/sdkconfig-32MB.defaults b/ports/espressif/esp-idf-config/sdkconfig-32MB.defaults new file mode 100644 index 0000000000..bbdd32afb8 --- /dev/null +++ b/ports/espressif/esp-idf-config/sdkconfig-32MB.defaults @@ -0,0 +1,19 @@ +# +# Serial flasher config +# +# CONFIG_ESPTOOLPY_FLASHSIZE_1MB is not set +# CONFIG_ESPTOOLPY_FLASHSIZE_2MB is not set +# CONFIG_ESPTOOLPY_FLASHSIZE_4MB is not set +# CONFIG_ESPTOOLPY_FLASHSIZE_8MB is not set +# CONFIG_ESPTOOLPY_FLASHSIZE_16MB is not set +CONFIG_ESPTOOLPY_FLASHSIZE_32MB=y +CONFIG_ESPTOOLPY_FLASHSIZE="32MB" +CONFIG_ESPTOOLPY_FLASHSIZE_DETECT=y +# end of Serial flasher config + +CONFIG_PARTITION_TABLE_CUSTOM_FILENAME="esp-idf-config/partitions-32MB.csv" +# +# Partition Table +# +CONFIG_PARTITION_TABLE_FILENAME="esp-idf-config/partitions-32MB.csv" +# end of Partition Table diff --git a/ports/espressif/esp-idf-config/sdkconfig-debug.defaults b/ports/espressif/esp-idf-config/sdkconfig-debug.defaults index e93b3d2825..bef5ee5fe8 100644 --- a/ports/espressif/esp-idf-config/sdkconfig-debug.defaults +++ b/ports/espressif/esp-idf-config/sdkconfig-debug.defaults @@ -8,8 +8,8 @@ CONFIG_BOOTLOADER_COMPILER_OPTIMIZATION_SIZE=y # CONFIG_BOOTLOADER_LOG_LEVEL_NONE is not set # 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=y +CONFIG_BOOTLOADER_LOG_LEVEL_INFO=y +# CONFIG_BOOTLOADER_LOG_LEVEL_DEBUG is not set # CONFIG_BOOTLOADER_LOG_LEVEL_VERBOSE is not set # end of Bootloader config @@ -72,8 +72,8 @@ CONFIG_HAL_DEFAULT_ASSERTION_LEVEL=2 # 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 is not set -CONFIG_LOG_DEFAULT_LEVEL_DEBUG=y +CONFIG_LOG_DEFAULT_LEVEL_INFO=y +# CONFIG_LOG_DEFAULT_LEVEL_DEBUG is not set # CONFIG_LOG_DEFAULT_LEVEL_VERBOSE is not set # end of Log output diff --git a/ports/espressif/esp-idf-config/sdkconfig-esp32.defaults b/ports/espressif/esp-idf-config/sdkconfig-esp32.defaults index 483e0f9b87..b6c5a938b1 100644 --- a/ports/espressif/esp-idf-config/sdkconfig-esp32.defaults +++ b/ports/espressif/esp-idf-config/sdkconfig-esp32.defaults @@ -313,8 +313,8 @@ CONFIG_SPIRAM_SPIWP_SD3_PIN=7 # CONFIG_ESP32_TRAX is not set CONFIG_ESP32_TRACEMEM_RESERVE_DRAM=0x0 -# CONFIG_ESP32_ULP_COPROC_ENABLED is not set -CONFIG_ESP32_ULP_COPROC_RESERVE_MEM=0 +CONFIG_ESP32_ULP_COPROC_ENABLED=y +CONFIG_ESP32_ULP_COPROC_RESERVE_MEM=4080 CONFIG_ESP32_DEBUG_OCDAWARE=y CONFIG_ESP32_BROWNOUT_DET=y CONFIG_ESP32_BROWNOUT_DET_LVL_SEL_0=y diff --git a/ports/espressif/esp32-camera b/ports/espressif/esp32-camera index 54c3f61c86..4ff7f348d0 160000 --- a/ports/espressif/esp32-camera +++ b/ports/espressif/esp32-camera @@ -1 +1 @@ -Subproject commit 54c3f61c864c3d3ffd779042454554045b9dd9d2 +Subproject commit 4ff7f348d0713ea8eca022f73a059b0fe0934531 diff --git a/ports/espressif/mpconfigport.h b/ports/espressif/mpconfigport.h index 632a7a13cd..c296be2024 100644 --- a/ports/espressif/mpconfigport.h +++ b/ports/espressif/mpconfigport.h @@ -33,6 +33,8 @@ #define MICROPY_USE_INTERNAL_PRINTF (0) #define MICROPY_PY_SYS_PLATFORM "Espressif" +#define CIRCUITPY_DIGITALIO_HAVE_INPUT_ONLY (1) + #include "py/circuitpy_mpconfig.h" #if CIRCUITPY_BLEIO diff --git a/ports/espressif/mpconfigport.mk b/ports/espressif/mpconfigport.mk index f1fa24a59b..460e651705 100644 --- a/ports/espressif/mpconfigport.mk +++ b/ports/espressif/mpconfigport.mk @@ -22,16 +22,17 @@ CIRCUITPY_AUDIOMP3 ?= 0 CIRCUITPY_BLEIO ?= 1 CIRCUITPY_BLEIO_HCI = 0 CIRCUITPY_CANIO ?= 1 -CIRCUITPY_COPROC ?= 1 CIRCUITPY_COUNTIO ?= 1 CIRCUITPY_DUALBANK ?= 1 -CIRCUITPY_ESP32_CAMERA ?= 1 +CIRCUITPY_ESPCAMERA ?= 1 CIRCUITPY_ESPIDF ?= 1 +CIRCUITPY_ESPULP ?= 1 CIRCUITPY_FRAMEBUFFERIO ?= 1 CIRCUITPY_FREQUENCYIO ?= 1 CIRCUITPY_HASHLIB ?= 1 CIRCUITPY_I2CTARGET ?= 1 CIRCUITPY_IMAGECAPTURE = 0 +CIRCUITPY_MEMORYMAP ?= 1 CIRCUITPY_NVM ?= 1 CIRCUITPY_PS2IO ?= 1 CIRCUITPY_RGBMATRIX ?= 1 @@ -44,7 +45,6 @@ CIRCUITPY_WIFI ?= 1 ifeq ($(IDF_TARGET),esp32) # Modules CIRCUITPY_BLEIO = 0 -CIRCUITPY_COPROC = 0 CIRCUITPY_PARALLELDISPLAY = 0 CIRCUITPY_RGBMATRIX = 0 # Features @@ -54,10 +54,11 @@ else ifeq ($(IDF_TARGET),esp32c3) # Modules CIRCUITPY_ALARM = 0 CIRCUITPY_AUDIOBUSIO = 0 -CIRCUITPY_COPROC = 0 CIRCUITPY_COUNTIO = 0 -CIRCUITPY_ESP32_CAMERA = 0 +CIRCUITPY_ESPCAMERA = 0 +CIRCUITPY_ESPULP = 0 CIRCUITPY_FREQUENCYIO = 0 +CIRCUITPY_MEMORYMAP = 0 CIRCUITPY_PARALLELDISPLAY = 0 CIRCUITPY_ROTARYIO = 0 CIRCUITPY_TOUCHIO ?= 1 @@ -80,8 +81,8 @@ CIRCUITPY_DUALBANK = 0 endif # Modules dependent on other modules -CIRCUITPY_GIFIO ?= $(CIRCUITPY_ESP32_CAMERA) -CIRCUITPY_QRIO ?= $(CIRCUITPY_ESP32_CAMERA) +CIRCUITPY_GIFIO ?= $(CIRCUITPY_ESPCAMERA) +CIRCUITPY_QRIO ?= $(CIRCUITPY_ESPCAMERA) # Features dependent on other features ifneq ($(CIRCUITPY_USB),0) diff --git a/ports/espressif/peripherals/rmt.c b/ports/espressif/peripherals/rmt.c index 362bf85748..8dea2c0ab1 100644 --- a/ports/espressif/peripherals/rmt.c +++ b/ports/espressif/peripherals/rmt.c @@ -40,6 +40,14 @@ void peripherals_rmt_reset(void) { rmt_channel_t peripherals_find_and_reserve_rmt(bool mode) { size_t start_channel = 0; size_t end_channel = RMT_CHANNEL_MAX; + // ESP32C3 can only send on channels 0-1 and receive on channels 2-3 + #if defined(CONFIG_IDF_TARGET_ESP32C3) + if (mode == RECEIVE_MODE) { + start_channel = 2; + } else { + end_channel = 2; + } + #endif // ESP32C3 #if SOC_RMT_CHANNELS_PER_GROUP > 4 if (mode == RECEIVE_MODE) { start_channel = 4; diff --git a/ports/espressif/supervisor/port.c b/ports/espressif/supervisor/port.c index 3106f4b991..a71825afa5 100644 --- a/ports/espressif/supervisor/port.c +++ b/ports/espressif/supervisor/port.c @@ -30,12 +30,14 @@ #include "supervisor/board.h" #include "supervisor/port.h" #include "supervisor/filesystem.h" +#include "supervisor/shared/reload.h" #include "py/runtime.h" #include "freertos/FreeRTOS.h" #include "freertos/task.h" #include "bindings/espidf/__init__.h" +#include "bindings/espulp/__init__.h" #include "common-hal/microcontroller/Pin.h" #include "common-hal/analogio/AnalogOut.h" #include "common-hal/busio/I2C.h" @@ -55,7 +57,7 @@ #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 "shared-module/os/__init__.h" #include "peripherals/rmt.h" #include "peripherals/timer.h" @@ -76,7 +78,7 @@ #include "shared-bindings/_bleio/__init__.h" #endif -#if CIRCUITPY_ESP32_CAMERA +#if CIRCUITPY_ESPCAMERA #include "esp_camera.h" #endif @@ -316,30 +318,30 @@ safe_mode_t port_init(void) { } if (heap == NULL) { heap_size = 0; - return NO_HEAP; + return SAFE_MODE_NO_HEAP; } esp_reset_reason_t reason = esp_reset_reason(); switch (reason) { case ESP_RST_BROWNOUT: - return BROWNOUT; + return SAFE_MODE_BROWNOUT; case ESP_RST_PANIC: - return HARD_CRASH; + return SAFE_MODE_HARD_FAULT; 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; + return SAFE_MODE_WATCHDOG; case ESP_RST_WDT: default: break; } - return NO_SAFE_MODE; + return SAFE_MODE_NONE; } void reset_port(void) { // TODO deinit for esp32-camera - #if CIRCUITPY_ESP32_CAMERA + #if CIRCUITPY_ESPCAMERA esp_camera_deinit(); #endif @@ -367,6 +369,10 @@ void reset_port(void) { dualbank_reset(); #endif + #if CIRCUITPY_ESPULP + espulp_reset(); + #endif + #if CIRCUITPY_FREQUENCYIO peripherals_timer_reset(); #endif @@ -511,7 +517,7 @@ void port_interrupt_after_ticks(uint32_t ticks) { // On the ESP we use FreeRTOS notifications instead of interrupts so this is a // bit of a misnomer. void port_idle_until_interrupt(void) { - if (!background_callback_pending()) { + if (!background_callback_pending() && !autoreload_pending()) { xTaskNotifyWait(0x01, 0x01, NULL, portMAX_DELAY); } } @@ -519,7 +525,7 @@ 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)) { + if (common_hal_os_getenv_int("CIRCUITPY_RESERVED_PSRAM", &reserved) == GETENV_OK) { common_hal_espidf_set_reserved_psram(reserved); } common_hal_espidf_reserve_psram(); diff --git a/ports/litex/Makefile b/ports/litex/Makefile index 1c5c0a014e..efe99dc5b4 100644 --- a/ports/litex/Makefile +++ b/ports/litex/Makefile @@ -87,7 +87,6 @@ CFLAGS += -DCFG_TUSB_MCU=OPT_MCU_VALENTYUSB_EPTRI -DCFG_TUD_CDC_RX_BUFSIZE=1024 SRC_C += \ background.c \ - fatfs_port.c \ mphalport.c \ boards/$(BOARD)/board.c \ boards/$(BOARD)/pins.c diff --git a/ports/litex/common-hal/microcontroller/__init__.c b/ports/litex/common-hal/microcontroller/__init__.c index 0a496d804e..1de55653fb 100644 --- a/ports/litex/common-hal/microcontroller/__init__.c +++ b/ports/litex/common-hal/microcontroller/__init__.c @@ -70,9 +70,8 @@ void common_hal_mcu_disable_interrupts(void) { __attribute__((section(".ramtext"))) void common_hal_mcu_enable_interrupts(void) { if (nesting_count == 0) { - // This is very very bad because it means there was mismatched disable/enables so we - // "HardFault". - asm ("ebreak"); + // This is very very bad because it means there was mismatched disable/enables. + reset_into_safe_mode(SAFE_MODE_INTERRUPT_ERROR); } nesting_count--; if (nesting_count > 0) { @@ -83,7 +82,7 @@ void common_hal_mcu_enable_interrupts(void) { void common_hal_mcu_on_next_reset(mcu_runmode_t runmode) { if (runmode == RUNMODE_SAFE_MODE) { - safe_mode_on_next_reset(PROGRAMMATIC_SAFE_MODE); + safe_mode_on_next_reset(SAFE_MODE_PROGRAMMATIC); } } diff --git a/ports/litex/supervisor/port.c b/ports/litex/supervisor/port.c index 42d3a63920..45f9b91976 100644 --- a/ports/litex/supervisor/port.c +++ b/ports/litex/supervisor/port.c @@ -71,7 +71,7 @@ safe_mode_t port_init(void) { irq_setmask(0); irq_setie(1); tick_init(); - return NO_SAFE_MODE; + return SAFE_MODE_NONE; } extern uint32_t _ebss; diff --git a/ports/mimxrt10xx/Makefile b/ports/mimxrt10xx/Makefile index 1c5c62bb85..b38f120ee2 100644 --- a/ports/mimxrt10xx/Makefile +++ b/ports/mimxrt10xx/Makefile @@ -109,6 +109,7 @@ SRC_SDK := \ drivers/fsl_ocotp.c \ drivers/fsl_pwm.c \ drivers/fsl_snvs_hp.c \ + drivers/fsl_snvs_lp.c \ drivers/fsl_tempmon.c \ drivers/fsl_trng.c \ system_$(CHIP_FAMILY).c \ @@ -121,7 +122,6 @@ SRC_C += \ boards/$(BOARD)/board.c \ boards/$(BOARD)/flash_config.c \ boards/$(BOARD)/pins.c \ - fatfs_port.c \ lib/tinyusb/src/portable/chipidea/ci_hs/dcd_ci_hs.c \ mphalport.c \ peripherals/mimxrt10xx/$(CHIP_FAMILY)/clocks.c \ diff --git a/ports/mimxrt10xx/boards/feather_m7_1011/board.c b/ports/mimxrt10xx/boards/feather_m7_1011/board.c index fa37b8ebfd..9587ea71e8 100644 --- a/ports/mimxrt10xx/boards/feather_m7_1011/board.c +++ b/ports/mimxrt10xx/boards/feather_m7_1011/board.c @@ -26,21 +26,23 @@ */ #include "supervisor/board.h" -#include "boards/flash_config.h" -#include "mpconfigboard.h" #include "shared-bindings/microcontroller/Pin.h" -void board_init(void) { - // SWD Pins - common_hal_never_reset_pin(&pin_GPIO_AD_13);// SWDIO - common_hal_never_reset_pin(&pin_GPIO_AD_12);// SWCLK +// These pins should never ever be reset; doing so could interfere with basic operation. +// Used in common-hal/microcontroller/Pin.c +const mcu_pin_obj_t *mimxrt10xx_reset_forbidden_pins[] = { + &pin_GPIO_AD_13,// SWDIO + &pin_GPIO_AD_12,// SWCLK // FLEX flash - common_hal_never_reset_pin(&pin_GPIO_SD_12); - common_hal_never_reset_pin(&pin_GPIO_SD_11); - common_hal_never_reset_pin(&pin_GPIO_SD_10); - common_hal_never_reset_pin(&pin_GPIO_SD_09); - common_hal_never_reset_pin(&pin_GPIO_SD_08); - common_hal_never_reset_pin(&pin_GPIO_SD_07); - common_hal_never_reset_pin(&pin_GPIO_SD_06); -} + &pin_GPIO_SD_12, + &pin_GPIO_SD_11, + &pin_GPIO_SD_10, + &pin_GPIO_SD_09, + &pin_GPIO_SD_08, + &pin_GPIO_SD_07, + &pin_GPIO_SD_06, + NULL, // Must end in NULL. +}; + +// Use the MP_WEAK supervisor/shared/board.c versions of routines not defined here. diff --git a/ports/mimxrt10xx/boards/feather_mimxrt1011/board.c b/ports/mimxrt10xx/boards/feather_mimxrt1011/board.c index 1514503834..9587ea71e8 100644 --- a/ports/mimxrt10xx/boards/feather_mimxrt1011/board.c +++ b/ports/mimxrt10xx/boards/feather_mimxrt1011/board.c @@ -26,23 +26,23 @@ */ #include "supervisor/board.h" -#include "boards/flash_config.h" -#include "mpconfigboard.h" #include "shared-bindings/microcontroller/Pin.h" -void board_init(void) { - // SWD Pins - common_hal_never_reset_pin(&pin_GPIO_AD_13);// SWDIO - common_hal_never_reset_pin(&pin_GPIO_AD_12);// SWCLK +// These pins should never ever be reset; doing so could interfere with basic operation. +// Used in common-hal/microcontroller/Pin.c +const mcu_pin_obj_t *mimxrt10xx_reset_forbidden_pins[] = { + &pin_GPIO_AD_13,// SWDIO + &pin_GPIO_AD_12,// SWCLK // FLEX flash - common_hal_never_reset_pin(&pin_GPIO_SD_12); - common_hal_never_reset_pin(&pin_GPIO_SD_11); - common_hal_never_reset_pin(&pin_GPIO_SD_10); - common_hal_never_reset_pin(&pin_GPIO_SD_09); - common_hal_never_reset_pin(&pin_GPIO_SD_08); - common_hal_never_reset_pin(&pin_GPIO_SD_07); - common_hal_never_reset_pin(&pin_GPIO_SD_06); -} + &pin_GPIO_SD_12, + &pin_GPIO_SD_11, + &pin_GPIO_SD_10, + &pin_GPIO_SD_09, + &pin_GPIO_SD_08, + &pin_GPIO_SD_07, + &pin_GPIO_SD_06, + NULL, // Must end in NULL. +}; // 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 df3d502d80..5a8de5a522 100644 --- a/ports/mimxrt10xx/boards/feather_mimxrt1062/board.c +++ b/ports/mimxrt10xx/boards/feather_mimxrt1062/board.c @@ -26,22 +26,23 @@ */ #include "supervisor/board.h" -#include "boards/flash_config.h" -#include "mpconfigboard.h" #include "shared-bindings/microcontroller/Pin.h" -void board_init(void) { +// These pins should never ever be reset; doing so could interfere with basic operation. +// Used in common-hal/microcontroller/Pin.c +const mcu_pin_obj_t *mimxrt10xx_reset_forbidden_pins[] = { // SWD Pins - common_hal_never_reset_pin(&pin_GPIO_AD_B0_06);// SWDIO - common_hal_never_reset_pin(&pin_GPIO_AD_B0_07);// SWCLK + &pin_GPIO_AD_B0_06,// SWDIO + &pin_GPIO_AD_B0_07,// SWCLK // FLEX flash - common_hal_never_reset_pin(&pin_GPIO_SD_B1_06); - common_hal_never_reset_pin(&pin_GPIO_SD_B1_07); - common_hal_never_reset_pin(&pin_GPIO_SD_B1_08); - common_hal_never_reset_pin(&pin_GPIO_SD_B1_09); - common_hal_never_reset_pin(&pin_GPIO_SD_B1_10); - common_hal_never_reset_pin(&pin_GPIO_SD_B1_11); -} + &pin_GPIO_SD_B1_06, + &pin_GPIO_SD_B1_07, + &pin_GPIO_SD_B1_08, + &pin_GPIO_SD_B1_09, + &pin_GPIO_SD_B1_10, + &pin_GPIO_SD_B1_11, + NULL, // Must end in NULL. +}; // 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 5a4cbcfc66..b839ffa666 100644 --- a/ports/mimxrt10xx/boards/imxrt1010_evk/board.c +++ b/ports/mimxrt10xx/boards/imxrt1010_evk/board.c @@ -26,25 +26,25 @@ */ #include "supervisor/board.h" -#include "boards/flash_config.h" -#include "mpconfigboard.h" #include "shared-bindings/microcontroller/Pin.h" -void board_init(void) { - // SWD Pins - common_hal_never_reset_pin(&pin_GPIO_AD_13); // SWDIO - common_hal_never_reset_pin(&pin_GPIO_AD_12); // SWCLK +// These pins should never ever be reset; doing so could interfere with basic operation. +// Used in common-hal/microcontroller/Pin.c +const mcu_pin_obj_t *mimxrt10xx_reset_forbidden_pins[] = { + &pin_GPIO_AD_13, // SWDIO + &pin_GPIO_AD_12, // SWCLK // FLEX flash - common_hal_never_reset_pin(&pin_GPIO_SD_12); - common_hal_never_reset_pin(&pin_GPIO_SD_11); - common_hal_never_reset_pin(&pin_GPIO_SD_10); - common_hal_never_reset_pin(&pin_GPIO_SD_09); - common_hal_never_reset_pin(&pin_GPIO_SD_08); - common_hal_never_reset_pin(&pin_GPIO_SD_07); - common_hal_never_reset_pin(&pin_GPIO_SD_06); + &pin_GPIO_SD_12, + &pin_GPIO_SD_11, + &pin_GPIO_SD_10, + &pin_GPIO_SD_09, + &pin_GPIO_SD_08, + &pin_GPIO_SD_07, + &pin_GPIO_SD_06, // USB Pins - common_hal_never_reset_pin(&pin_GPIO_12); - common_hal_never_reset_pin(&pin_GPIO_13); -} + &pin_GPIO_12, + &pin_GPIO_13, + NULL, // Must end in NULL. +}; // 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 a9eea2d14e..afbc0c58b5 100644 --- a/ports/mimxrt10xx/boards/imxrt1020_evk/board.c +++ b/ports/mimxrt10xx/boards/imxrt1020_evk/board.c @@ -26,26 +26,27 @@ */ #include "supervisor/board.h" -#include "boards/flash_config.h" -#include "mpconfigboard.h" #include "shared-bindings/microcontroller/Pin.h" -void board_init(void) { +// These pins should never ever be reset; doing so could interfere with basic operation. +// Used in common-hal/microcontroller/Pin.c +const mcu_pin_obj_t *mimxrt10xx_reset_forbidden_pins[] = { // SWD Pins - common_hal_never_reset_pin(&pin_GPIO_AD_B0_00);// SWDIO - common_hal_never_reset_pin(&pin_GPIO_AD_B0_01);// SWCLK + &pin_GPIO_AD_B0_00,// SWDIO + &pin_GPIO_AD_B0_01,// SWCLK // FLEX flash - common_hal_never_reset_pin(&pin_GPIO_SD_B1_06); - common_hal_never_reset_pin(&pin_GPIO_SD_B1_07); - common_hal_never_reset_pin(&pin_GPIO_SD_B1_08); - common_hal_never_reset_pin(&pin_GPIO_SD_B1_09); - common_hal_never_reset_pin(&pin_GPIO_SD_B1_10); - common_hal_never_reset_pin(&pin_GPIO_SD_B1_11); + &pin_GPIO_SD_B1_06, + &pin_GPIO_SD_B1_07, + &pin_GPIO_SD_B1_08, + &pin_GPIO_SD_B1_09, + &pin_GPIO_SD_B1_10, + &pin_GPIO_SD_B1_11, // USB Pins - common_hal_never_reset_pin(&pin_GPIO_AD_B1_11); - common_hal_never_reset_pin(&pin_GPIO_AD_B1_12); -} + &pin_GPIO_AD_B1_11, + &pin_GPIO_AD_B1_12, + NULL, // Must end in NULL. +}; // 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 12e75738f8..f27f549c64 100644 --- a/ports/mimxrt10xx/boards/imxrt1060_evk/board.c +++ b/ports/mimxrt10xx/boards/imxrt1060_evk/board.c @@ -26,30 +26,33 @@ */ #include "supervisor/board.h" -#include "boards/flash_config.h" -#include "mpconfigboard.h" #include "shared-bindings/microcontroller/Pin.h" -void board_init(void) { +// These pins should never ever be reset; doing so could interfere with basic operation. +// Used in common-hal/microcontroller/Pin.c +const mcu_pin_obj_t *mimxrt10xx_reset_forbidden_pins[] = { // SWD Pins - common_hal_never_reset_pin(&pin_GPIO_AD_B0_06);// SWDIO - common_hal_never_reset_pin(&pin_GPIO_AD_B0_07);// SWCLK + &pin_GPIO_AD_B0_06, // SWDIO + &pin_GPIO_AD_B0_07, // SWCLK // FLEX flash - common_hal_never_reset_pin(&pin_GPIO_SD_B1_00); - common_hal_never_reset_pin(&pin_GPIO_SD_B1_01); - common_hal_never_reset_pin(&pin_GPIO_SD_B1_02); - common_hal_never_reset_pin(&pin_GPIO_SD_B1_03); - common_hal_never_reset_pin(&pin_GPIO_SD_B1_04); - common_hal_never_reset_pin(&pin_GPIO_SD_B1_05); - common_hal_never_reset_pin(&pin_GPIO_SD_B1_06); - common_hal_never_reset_pin(&pin_GPIO_SD_B1_07); - common_hal_never_reset_pin(&pin_GPIO_SD_B1_08); - common_hal_never_reset_pin(&pin_GPIO_SD_B1_09); - common_hal_never_reset_pin(&pin_GPIO_SD_B1_10); - common_hal_never_reset_pin(&pin_GPIO_SD_B1_11); + &pin_GPIO_SD_B1_00, + &pin_GPIO_SD_B1_01, + &pin_GPIO_SD_B1_02, + &pin_GPIO_SD_B1_03, + &pin_GPIO_SD_B1_04, + &pin_GPIO_SD_B1_05, + &pin_GPIO_SD_B1_06, + &pin_GPIO_SD_B1_07, + &pin_GPIO_SD_B1_08, + &pin_GPIO_SD_B1_09, + &pin_GPIO_SD_B1_10, + &pin_GPIO_SD_B1_11, // USB Pins - common_hal_never_reset_pin(&pin_GPIO_AD_B0_01); - common_hal_never_reset_pin(&pin_GPIO_AD_B0_03); -} + &pin_GPIO_AD_B0_01, + &pin_GPIO_AD_B0_03, + NULL, // Must end in NULL. +}; + +// Use the MP_WEAK supervisor/shared/board.c versions of routines not defined here. diff --git a/ports/mimxrt10xx/boards/metro_m7_1011/board.c b/ports/mimxrt10xx/boards/metro_m7_1011/board.c index 1514503834..27cbd3eb96 100644 --- a/ports/mimxrt10xx/boards/metro_m7_1011/board.c +++ b/ports/mimxrt10xx/boards/metro_m7_1011/board.c @@ -26,23 +26,24 @@ */ #include "supervisor/board.h" -#include "boards/flash_config.h" -#include "mpconfigboard.h" #include "shared-bindings/microcontroller/Pin.h" -void board_init(void) { +// These pins should never ever be reset; doing so could interfere with basic operation. +// Used in common-hal/microcontroller/Pin.c +const mcu_pin_obj_t *mimxrt10xx_reset_forbidden_pins[] = { // SWD Pins - common_hal_never_reset_pin(&pin_GPIO_AD_13);// SWDIO - common_hal_never_reset_pin(&pin_GPIO_AD_12);// SWCLK + &pin_GPIO_AD_13,// SWDIO + &pin_GPIO_AD_12,// SWCLK // FLEX flash - common_hal_never_reset_pin(&pin_GPIO_SD_12); - common_hal_never_reset_pin(&pin_GPIO_SD_11); - common_hal_never_reset_pin(&pin_GPIO_SD_10); - common_hal_never_reset_pin(&pin_GPIO_SD_09); - common_hal_never_reset_pin(&pin_GPIO_SD_08); - common_hal_never_reset_pin(&pin_GPIO_SD_07); - common_hal_never_reset_pin(&pin_GPIO_SD_06); -} + &pin_GPIO_SD_12, + &pin_GPIO_SD_11, + &pin_GPIO_SD_10, + &pin_GPIO_SD_09, + &pin_GPIO_SD_08, + &pin_GPIO_SD_07, + &pin_GPIO_SD_06, + NULL, // Must end in NULL. +}; // Use the MP_WEAK supervisor/shared/board.c versions of routines not defined here. diff --git a/ports/mimxrt10xx/boards/metro_m7_1011/mpconfigboard.h b/ports/mimxrt10xx/boards/metro_m7_1011/mpconfigboard.h index 23009f353f..589b2a2b65 100644 --- a/ports/mimxrt10xx/boards/metro_m7_1011/mpconfigboard.h +++ b/ports/mimxrt10xx/boards/metro_m7_1011/mpconfigboard.h @@ -7,7 +7,7 @@ // make sure you don't overwrite code #define CIRCUITPY_INTERNAL_NVM_SIZE 0 -#define BOARD_FLASH_SIZE (4 * 1024 * 1024) +#define BOARD_FLASH_SIZE (8 * 1024 * 1024) #define DEFAULT_I2C_BUS_SCL (&pin_GPIO_02) #define DEFAULT_I2C_BUS_SDA (&pin_GPIO_01) diff --git a/ports/mimxrt10xx/boards/metro_m7_1011/mpconfigboard.mk b/ports/mimxrt10xx/boards/metro_m7_1011/mpconfigboard.mk index 2655217c78..56155aa4d0 100644 --- a/ports/mimxrt10xx/boards/metro_m7_1011/mpconfigboard.mk +++ b/ports/mimxrt10xx/boards/metro_m7_1011/mpconfigboard.mk @@ -5,7 +5,7 @@ USB_MANUFACTURER = "Adafruit" CHIP_VARIANT = MIMXRT1011DAE5A CHIP_FAMILY = MIMXRT1011 -FLASH = W25Q32JV +FLASH = W25Q64JV # Include these Python libraries in the firmware FROZEN_MPY_DIRS += $(TOP)/frozen/Adafruit_CircuitPython_ESP32SPI diff --git a/ports/mimxrt10xx/boards/sparkfun_teensy_micromod/board.c b/ports/mimxrt10xx/boards/sparkfun_teensy_micromod/board.c index 55cd826de2..fda0b1d202 100644 --- a/ports/mimxrt10xx/boards/sparkfun_teensy_micromod/board.c +++ b/ports/mimxrt10xx/boards/sparkfun_teensy_micromod/board.c @@ -26,31 +26,31 @@ */ #include "supervisor/board.h" -#include "boards/flash_config.h" -#include "mpconfigboard.h" #include "shared-bindings/microcontroller/Pin.h" -void board_init(void) { - // FLEX flash - common_hal_never_reset_pin(&pin_GPIO_SD_B1_06); - common_hal_never_reset_pin(&pin_GPIO_SD_B1_07); - common_hal_never_reset_pin(&pin_GPIO_SD_B1_08); - common_hal_never_reset_pin(&pin_GPIO_SD_B1_09); - common_hal_never_reset_pin(&pin_GPIO_SD_B1_10); - common_hal_never_reset_pin(&pin_GPIO_SD_B1_11); +// These pins should never ever be reset; doing so could interfere with basic operation. +// Used in common-hal/microcontroller/Pin.c +const mcu_pin_obj_t *mimxrt10xx_reset_forbidden_pins[] = { + &pin_GPIO_SD_B1_06, + &pin_GPIO_SD_B1_07, + &pin_GPIO_SD_B1_08, + &pin_GPIO_SD_B1_09, + &pin_GPIO_SD_B1_10, + &pin_GPIO_SD_B1_11, // FLEX flash 2 - common_hal_never_reset_pin(&pin_GPIO_AD_B0_04); - common_hal_never_reset_pin(&pin_GPIO_AD_B0_06); - common_hal_never_reset_pin(&pin_GPIO_AD_B0_07); - common_hal_never_reset_pin(&pin_GPIO_AD_B0_08); - common_hal_never_reset_pin(&pin_GPIO_AD_B0_09); - common_hal_never_reset_pin(&pin_GPIO_AD_B0_10); - common_hal_never_reset_pin(&pin_GPIO_EMC_01); - common_hal_never_reset_pin(&pin_GPIO_B0_13); - common_hal_never_reset_pin(&pin_GPIO_AD_B0_11); + &pin_GPIO_AD_B0_04, + &pin_GPIO_AD_B0_06, + &pin_GPIO_AD_B0_07, + &pin_GPIO_AD_B0_08, + &pin_GPIO_AD_B0_09, + &pin_GPIO_AD_B0_10, + &pin_GPIO_EMC_01, + &pin_GPIO_B0_13, + &pin_GPIO_AD_B0_11, // Data strobe needs protection despite being grounded - common_hal_never_reset_pin(&pin_GPIO_SD_B1_05); -} + &pin_GPIO_SD_B1_05, + NULL, // Must end in NULL. +}; // Use the MP_WEAK supervisor/shared/board.c versions of routines not defined here. diff --git a/ports/mimxrt10xx/boards/teensy40/board.c b/ports/mimxrt10xx/boards/teensy40/board.c index 55cd826de2..8ece1546d7 100644 --- a/ports/mimxrt10xx/boards/teensy40/board.c +++ b/ports/mimxrt10xx/boards/teensy40/board.c @@ -26,31 +26,32 @@ */ #include "supervisor/board.h" -#include "boards/flash_config.h" -#include "mpconfigboard.h" #include "shared-bindings/microcontroller/Pin.h" -void board_init(void) { +// These pins should never ever be reset; doing so could interfere with basic operation. +// Used in common-hal/microcontroller/Pin.c +const mcu_pin_obj_t *mimxrt10xx_reset_forbidden_pins[] = { // FLEX flash - common_hal_never_reset_pin(&pin_GPIO_SD_B1_06); - common_hal_never_reset_pin(&pin_GPIO_SD_B1_07); - common_hal_never_reset_pin(&pin_GPIO_SD_B1_08); - common_hal_never_reset_pin(&pin_GPIO_SD_B1_09); - common_hal_never_reset_pin(&pin_GPIO_SD_B1_10); - common_hal_never_reset_pin(&pin_GPIO_SD_B1_11); + &pin_GPIO_SD_B1_06, + &pin_GPIO_SD_B1_07, + &pin_GPIO_SD_B1_08, + &pin_GPIO_SD_B1_09, + &pin_GPIO_SD_B1_10, + &pin_GPIO_SD_B1_11, // FLEX flash 2 - common_hal_never_reset_pin(&pin_GPIO_AD_B0_04); - common_hal_never_reset_pin(&pin_GPIO_AD_B0_06); - common_hal_never_reset_pin(&pin_GPIO_AD_B0_07); - common_hal_never_reset_pin(&pin_GPIO_AD_B0_08); - common_hal_never_reset_pin(&pin_GPIO_AD_B0_09); - common_hal_never_reset_pin(&pin_GPIO_AD_B0_10); - common_hal_never_reset_pin(&pin_GPIO_EMC_01); - common_hal_never_reset_pin(&pin_GPIO_B0_13); - common_hal_never_reset_pin(&pin_GPIO_AD_B0_11); + &pin_GPIO_AD_B0_04, + &pin_GPIO_AD_B0_06, + &pin_GPIO_AD_B0_07, + &pin_GPIO_AD_B0_08, + &pin_GPIO_AD_B0_09, + &pin_GPIO_AD_B0_10, + &pin_GPIO_EMC_01, + &pin_GPIO_B0_13, + &pin_GPIO_AD_B0_11, // Data strobe needs protection despite being grounded - common_hal_never_reset_pin(&pin_GPIO_SD_B1_05); -} + &pin_GPIO_SD_B1_05, + NULL, // Must end in NULL. +}; // Use the MP_WEAK supervisor/shared/board.c versions of routines not defined here. diff --git a/ports/mimxrt10xx/boards/teensy41/board.c b/ports/mimxrt10xx/boards/teensy41/board.c index 628befd02b..8ece1546d7 100644 --- a/ports/mimxrt10xx/boards/teensy41/board.c +++ b/ports/mimxrt10xx/boards/teensy41/board.c @@ -26,29 +26,32 @@ */ #include "supervisor/board.h" -#include "boards/flash_config.h" -#include "mpconfigboard.h" #include "shared-bindings/microcontroller/Pin.h" -void board_init(void) { +// These pins should never ever be reset; doing so could interfere with basic operation. +// Used in common-hal/microcontroller/Pin.c +const mcu_pin_obj_t *mimxrt10xx_reset_forbidden_pins[] = { // FLEX flash - common_hal_never_reset_pin(&pin_GPIO_SD_B1_06); - common_hal_never_reset_pin(&pin_GPIO_SD_B1_07); - common_hal_never_reset_pin(&pin_GPIO_SD_B1_08); - common_hal_never_reset_pin(&pin_GPIO_SD_B1_09); - common_hal_never_reset_pin(&pin_GPIO_SD_B1_10); - common_hal_never_reset_pin(&pin_GPIO_SD_B1_11); + &pin_GPIO_SD_B1_06, + &pin_GPIO_SD_B1_07, + &pin_GPIO_SD_B1_08, + &pin_GPIO_SD_B1_09, + &pin_GPIO_SD_B1_10, + &pin_GPIO_SD_B1_11, // FLEX flash 2 - common_hal_never_reset_pin(&pin_GPIO_AD_B0_04); - common_hal_never_reset_pin(&pin_GPIO_AD_B0_06); - common_hal_never_reset_pin(&pin_GPIO_AD_B0_07); - common_hal_never_reset_pin(&pin_GPIO_AD_B0_08); - common_hal_never_reset_pin(&pin_GPIO_AD_B0_09); - common_hal_never_reset_pin(&pin_GPIO_AD_B0_10); - common_hal_never_reset_pin(&pin_GPIO_EMC_01); - common_hal_never_reset_pin(&pin_GPIO_B0_13); - common_hal_never_reset_pin(&pin_GPIO_AD_B0_11); + &pin_GPIO_AD_B0_04, + &pin_GPIO_AD_B0_06, + &pin_GPIO_AD_B0_07, + &pin_GPIO_AD_B0_08, + &pin_GPIO_AD_B0_09, + &pin_GPIO_AD_B0_10, + &pin_GPIO_EMC_01, + &pin_GPIO_B0_13, + &pin_GPIO_AD_B0_11, // Data strobe needs protection despite being grounded - common_hal_never_reset_pin(&pin_GPIO_SD_B1_05); -} + &pin_GPIO_SD_B1_05, + NULL, // Must end in NULL. +}; + +// Use the MP_WEAK supervisor/shared/board.c versions of routines not defined here. diff --git a/ports/mimxrt10xx/common-hal/busio/UART.c b/ports/mimxrt10xx/common-hal/busio/UART.c index 20430c91c8..871d57648d 100644 --- a/ports/mimxrt10xx/common-hal/busio/UART.c +++ b/ports/mimxrt10xx/common-hal/busio/UART.c @@ -113,7 +113,7 @@ void common_hal_busio_uart_construct(busio_uart_obj_t *self, bool sigint_enabled) { self->baudrate = baudrate; - self->character_bits = (uint8_t)mp_arg_validate_int_range(self->character_bits, 7, 8, MP_QSTR_bits); + self->character_bits = (uint8_t)mp_arg_validate_int_range(bits, 7, 8, MP_QSTR_bits); self->timeout_ms = timeout * 1000; diff --git a/ports/mimxrt10xx/common-hal/microcontroller/Pin.c b/ports/mimxrt10xx/common-hal/microcontroller/Pin.c index 06a2a34fe1..3c8c7f2b27 100644 --- a/ports/mimxrt10xx/common-hal/microcontroller/Pin.c +++ b/ports/mimxrt10xx/common-hal/microcontroller/Pin.c @@ -31,6 +31,22 @@ STATIC bool claimed_pins[IOMUXC_SW_PAD_CTL_PAD_COUNT]; STATIC bool never_reset_pins[IOMUXC_SW_PAD_CTL_PAD_COUNT]; +// Default is that no pins are forbidden to reset. +MP_WEAK const mcu_pin_obj_t *mimxrt10xx_reset_forbidden_pins[] = { + NULL, +}; + +STATIC bool _reset_forbidden(const mcu_pin_obj_t *pin) { + const mcu_pin_obj_t **forbidden_pin = &mimxrt10xx_reset_forbidden_pins[0]; + while (*forbidden_pin) { + if (pin == *forbidden_pin) { + return true; + } + forbidden_pin++; + } + return false; +} + // There are two numbering systems used here: // IOMUXC index, used for iterating through pins and accessing reset information, // and GPIO port and number, used to store claimed and reset tagging. The two number @@ -44,17 +60,30 @@ void reset_all_pins(void) { if (never_reset_pins[pin->mux_idx]) { continue; } - *(uint32_t *)pin->mux_reg = pin->mux_reset; - *(uint32_t *)pin->cfg_reg = pin->pad_reset; + common_hal_reset_pin(pin); } } +MP_WEAK bool mimxrt10xx_board_reset_pin_number(const mcu_pin_obj_t *pin) { + return false; +} + // Since i.MX pins need extra register and reset information to reset properly, // resetting pins by number alone has been removed. void common_hal_reset_pin(const mcu_pin_obj_t *pin) { if (pin == NULL) { return; } + + if (_reset_forbidden(pin)) { + return; + } + + // Give the board a chance to reset the pin in a particular way, or not reset it at all. + if (mimxrt10xx_board_reset_pin_number(pin)) { + return; + } + never_reset_pins[pin->mux_idx] = false; claimed_pins[pin->mux_idx] = false; *(uint32_t *)pin->mux_reg = pin->mux_reset; diff --git a/ports/mimxrt10xx/common-hal/microcontroller/Pin.h b/ports/mimxrt10xx/common-hal/microcontroller/Pin.h index 2638eb89b8..1bfbe41a18 100644 --- a/ports/mimxrt10xx/common-hal/microcontroller/Pin.h +++ b/ports/mimxrt10xx/common-hal/microcontroller/Pin.h @@ -35,4 +35,14 @@ void reset_all_pins(void); void claim_pin(const mcu_pin_obj_t *pin); +// List of pins that should never be reset. +extern const mcu_pin_obj_t *mimxrt10xx_reset_forbidden_pins[]; + +// 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, +// or to simply not reset the pin at all. +// Return true to indicate that the pin was handled in a special way. Returning false will lead to +// the port-default reset behavior. +extern bool mimxrt10xx_board_reset_pin_number(const mcu_pin_obj_t *pin); + #endif // MICROPY_INCLUDED_MIMXRT10XX_COMMON_HAL_MICROCONTROLLER_PIN_H diff --git a/ports/mimxrt10xx/common-hal/microcontroller/__init__.c b/ports/mimxrt10xx/common-hal/microcontroller/__init__.c index 8de63061ad..ded46b648e 100644 --- a/ports/mimxrt10xx/common-hal/microcontroller/__init__.c +++ b/ports/mimxrt10xx/common-hal/microcontroller/__init__.c @@ -52,12 +52,10 @@ void common_hal_mcu_disable_interrupts(void) { nesting_count++; } -void HardFault_Handler(void); void common_hal_mcu_enable_interrupts(void) { if (nesting_count == 0) { - // This is very very bad because it means there was mismatched disable/enables so we - // "HardFault". - HardFault_Handler(); + // This is very very bad because it means there was mismatched disable/enables + reset_into_safe_mode(SAFE_MODE_INTERRUPT_ERROR); } nesting_count--; if (nesting_count > 0) { @@ -80,7 +78,7 @@ void common_hal_mcu_on_next_reset(mcu_runmode_t runmode) { DBL_TAP_REG = DBL_TAP_MAGIC_QUICK_BOOT; } if (runmode == RUNMODE_SAFE_MODE) { - safe_mode_on_next_reset(PROGRAMMATIC_SAFE_MODE); + safe_mode_on_next_reset(SAFE_MODE_PROGRAMMATIC); } } diff --git a/ports/mimxrt10xx/common-hal/rtc/RTC.c b/ports/mimxrt10xx/common-hal/rtc/RTC.c index 7ed65a3499..0cf5fe7713 100644 --- a/ports/mimxrt10xx/common-hal/rtc/RTC.c +++ b/ports/mimxrt10xx/common-hal/rtc/RTC.c @@ -36,18 +36,26 @@ #include "supervisor/shared/translate/translate.h" #include "fsl_snvs_hp.h" +#include "fsl_snvs_lp.h" void rtc_init(void) { - snvs_hp_rtc_config_t config; - SNVS_HP_RTC_GetDefaultConfig(&config); + snvs_hp_rtc_config_t hpconfig; + SNVS_HP_RTC_GetDefaultConfig(&hpconfig); - SNVS_HP_RTC_Init(SNVS, &config); + SNVS_HP_RTC_Init(SNVS, &hpconfig); + + snvs_lp_srtc_config_t lpconfig; + SNVS_LP_SRTC_GetDefaultConfig(&lpconfig); + + SNVS_LP_SRTC_Init(SNVS, &lpconfig); + + SNVS_LP_SRTC_StartTimer(SNVS); SNVS_HP_RTC_StartTimer(SNVS); } void common_hal_rtc_get_time(timeutils_struct_time_t *tm) { - snvs_hp_rtc_datetime_t rtcDate; - SNVS_HP_RTC_GetDatetime(SNVS, &rtcDate); + snvs_lp_srtc_datetime_t rtcDate; + SNVS_LP_SRTC_GetDatetime(SNVS, &rtcDate); tm->tm_year = rtcDate.year; tm->tm_mon = rtcDate.month; @@ -58,7 +66,7 @@ void common_hal_rtc_get_time(timeutils_struct_time_t *tm) { } void common_hal_rtc_set_time(timeutils_struct_time_t *tm) { - snvs_hp_rtc_datetime_t rtcDate; + snvs_lp_srtc_datetime_t rtcDate; rtcDate.year = tm->tm_year; rtcDate.month = tm->tm_mon; rtcDate.day = tm->tm_mday; @@ -66,7 +74,7 @@ void common_hal_rtc_set_time(timeutils_struct_time_t *tm) { rtcDate.minute = tm->tm_min; rtcDate.second = tm->tm_sec; - SNVS_HP_RTC_SetDatetime(SNVS, &rtcDate); + SNVS_LP_SRTC_SetDatetime(SNVS, &rtcDate); } int common_hal_rtc_get_calibration(void) { diff --git a/ports/mimxrt10xx/supervisor/port.c b/ports/mimxrt10xx/supervisor/port.c index fbf0e8a9d8..2ac7995943 100644 --- a/ports/mimxrt10xx/supervisor/port.c +++ b/ports/mimxrt10xx/supervisor/port.c @@ -259,10 +259,10 @@ safe_mode_t port_init(void) { // run yet, which uses `never_reset` to protect critical pins from being reset by `reset_port`. if (board_requests_safe_mode()) { - return USER_SAFE_MODE; + return SAFE_MODE_USER; } - return NO_SAFE_MODE; + return SAFE_MODE_NONE; } void reset_port(void) { @@ -419,7 +419,7 @@ void port_idle_until_interrupt(void) { */ void MemManage_Handler(void); __attribute__((used)) void MemManage_Handler(void) { - reset_into_safe_mode(MEM_MANAGE); + reset_into_safe_mode(SAFE_MODE_HARD_FAULT); while (true) { asm ("nop;"); } @@ -430,7 +430,7 @@ __attribute__((used)) void MemManage_Handler(void) { */ void BusFault_Handler(void); __attribute__((used)) void BusFault_Handler(void) { - reset_into_safe_mode(MEM_MANAGE); + reset_into_safe_mode(SAFE_MODE_HARD_FAULT); while (true) { asm ("nop;"); } @@ -441,7 +441,7 @@ __attribute__((used)) void BusFault_Handler(void) { */ void UsageFault_Handler(void); __attribute__((used)) void UsageFault_Handler(void) { - reset_into_safe_mode(MEM_MANAGE); + reset_into_safe_mode(SAFE_MODE_HARD_FAULT); while (true) { asm ("nop;"); } @@ -452,7 +452,7 @@ __attribute__((used)) void UsageFault_Handler(void) { */ void HardFault_Handler(void); __attribute__((used)) void HardFault_Handler(void) { - reset_into_safe_mode(HARD_CRASH); + reset_into_safe_mode(SAFE_MODE_HARD_FAULT); while (true) { asm ("nop;"); } diff --git a/ports/nrf/Makefile b/ports/nrf/Makefile index 67d2a5e685..d1b71799bf 100755 --- a/ports/nrf/Makefile +++ b/ports/nrf/Makefile @@ -130,7 +130,6 @@ endif SRC_C += \ background.c \ - fatfs_port.c \ boards/$(BOARD)/board.c \ boards/$(BOARD)/pins.c \ device/$(MCU_VARIANT)/startup_$(MCU_SUB_VARIANT).c \ diff --git a/ports/nrf/boards/Seeed_XIAO_nRF52840_Sense/pins.c b/ports/nrf/boards/Seeed_XIAO_nRF52840_Sense/pins.c index 00fa2c1ed5..8714f9bf8c 100644 --- a/ports/nrf/boards/Seeed_XIAO_nRF52840_Sense/pins.c +++ b/ports/nrf/boards/Seeed_XIAO_nRF52840_Sense/pins.c @@ -52,6 +52,7 @@ STATIC const mp_rom_map_elem_t board_module_globals_table[] = { {MP_ROM_QSTR(MP_QSTR_READ_BATT_ENABLE),MP_ROM_PTR(&pin_P0_14)}, {MP_ROM_QSTR(MP_QSTR_VBATT),MP_ROM_PTR(&pin_P0_31)}, {MP_ROM_QSTR(MP_QSTR_CHARGE_STATUS),MP_ROM_PTR(&pin_P0_17)}, + {MP_ROM_QSTR(MP_QSTR_CHARGE_RATE),MP_ROM_PTR(&pin_P0_13)}, { MP_ROM_QSTR(MP_QSTR_UART), MP_ROM_PTR(&board_uart_obj) }, { MP_ROM_QSTR(MP_QSTR_SPI), MP_ROM_PTR(&board_spi_obj) }, diff --git a/ports/nrf/boards/aramcon2_badge/mpconfigboard.h b/ports/nrf/boards/aramcon2_badge/mpconfigboard.h index af8e3c3507..58df3a4058 100644 --- a/ports/nrf/boards/aramcon2_badge/mpconfigboard.h +++ b/ports/nrf/boards/aramcon2_badge/mpconfigboard.h @@ -52,7 +52,7 @@ #define CIRCUITPY_BOOT_BUTTON (&pin_P0_29) -#define BOARD_USER_SAFE_MODE_ACTION translate("The left button was pressed at start up.\n") +#define BOARD_USER_SAFE_MODE_ACTION translate("You pressed the left button at start up.") #define CIRCUITPY_INTERNAL_NVM_SIZE (4096) diff --git a/ports/nrf/boards/aramcon_badge_2019/mpconfigboard.mk b/ports/nrf/boards/aramcon_badge_2019/mpconfigboard.mk index 06cd9633d1..5bf2eb721b 100644 --- a/ports/nrf/boards/aramcon_badge_2019/mpconfigboard.mk +++ b/ports/nrf/boards/aramcon_badge_2019/mpconfigboard.mk @@ -9,5 +9,6 @@ QSPI_FLASH_FILESYSTEM = 1 EXTERNAL_FLASH_DEVICES = "GD25Q16C" CIRCUITPY_DISPLAYIO = 1 +CIRCUITPY_PIXELMAP = 0 CIRCUITPY_REQUIRE_I2C_PULLUPS = 0 diff --git a/ports/nrf/boards/bluemicro833/mpconfigboard.mk b/ports/nrf/boards/bluemicro833/mpconfigboard.mk index 6108f23102..9b230e9a53 100644 --- a/ports/nrf/boards/bluemicro833/mpconfigboard.mk +++ b/ports/nrf/boards/bluemicro833/mpconfigboard.mk @@ -13,4 +13,5 @@ CIRCUITPY_KEYPAD = 1 CIRCUITPY_NVM = 0 CIRCUITPY_ONEWIREIO = 0 CIRCUITPY_PIXELBUF = 1 +CIRCUITPY_PIXELMAP = 0 CIRCUITPY_TOUCHIO = 0 diff --git a/ports/nrf/boards/challenger_840/board.c b/ports/nrf/boards/challenger_840/board.c index fb1ce4fb83..14a52fc4de 100644 --- a/ports/nrf/boards/challenger_840/board.c +++ b/ports/nrf/boards/challenger_840/board.c @@ -23,7 +23,3 @@ * 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/nrf/boards/challenger_840/challenger_840.py b/ports/nrf/boards/challenger_840/challenger_840.py new file mode 100644 index 0000000000..bf3ae77170 --- /dev/null +++ b/ports/nrf/boards/challenger_840/challenger_840.py @@ -0,0 +1,16 @@ +import board +import digitalio + +_LDO_PIN = digitalio.DigitalInOut(board.LDO_CONTROL) +_LDO_PIN.direction = digitalio.Direction.OUTPUT +_LDO_PIN.value = True + + +def ldo_on(): + global _LDO_PIN + _LDO_PIN.value = True + + +def ldo_off(): + global _LDO_PIN + _LDO_PIN.value = False diff --git a/ports/nrf/boards/challenger_840/mpconfigboard.h b/ports/nrf/boards/challenger_840/mpconfigboard.h index e68fbc76fb..5226c818d4 100644 --- a/ports/nrf/boards/challenger_840/mpconfigboard.h +++ b/ports/nrf/boards/challenger_840/mpconfigboard.h @@ -10,6 +10,7 @@ #define SPI_FLASH_MISO_PIN (&pin_P0_11) #define SPI_FLASH_SCK_PIN (&pin_P0_14) #define SPI_FLASH_CS_PIN (&pin_P0_08) +#define SPI_FLASH_MAX_BAUDRATE 20000000 #endif #define CIRCUITPY_AUTORELOAD_DELAY_MS 500 diff --git a/ports/nrf/boards/challenger_840/mpconfigboard.mk b/ports/nrf/boards/challenger_840/mpconfigboard.mk index ddb55ce705..03cbc20b21 100644 --- a/ports/nrf/boards/challenger_840/mpconfigboard.mk +++ b/ports/nrf/boards/challenger_840/mpconfigboard.mk @@ -6,4 +6,8 @@ USB_MANUFACTURER = "Invector Labs AB" MCU_CHIP = nrf52840 SPI_FLASH_FILESYSTEM = 1 -EXTERNAL_FLASH_DEVICES = "W25Q16JVxQ,W25Q32FV,W25Q64FV" +EXTERNAL_FLASH_DEVICES = "W25Q16JVxQ,W25Q32FV,W25Q32JVxQ,W25Q64FV,W25Q64JVxQ" + +FROZEN_MPY_DIRS += $(TOP)/ports/nrf/boards/challenger_840 +FROZEN_MPY_DIRS += $(TOP)/frozen/Adafruit_CircuitPython_BLE +FROZEN_MPY_DIRS += $(TOP)/frozen/Adafruit_CircuitPython_NeoPixel diff --git a/ports/nrf/boards/challenger_840/pins.c b/ports/nrf/boards/challenger_840/pins.c index 26d780fffe..e059c17a15 100644 --- a/ports/nrf/boards/challenger_840/pins.c +++ b/ports/nrf/boards/challenger_840/pins.c @@ -32,6 +32,7 @@ STATIC const mp_rom_map_elem_t board_module_globals_table[] = { { MP_ROM_QSTR(MP_QSTR_D13), MP_ROM_PTR(&pin_P0_06) }, { MP_ROM_QSTR(MP_QSTR_NEOPIXEL), MP_ROM_PTR(&pin_P1_08) }, + { MP_ROM_QSTR(MP_QSTR_LDO_CONTROL), MP_ROM_PTR(&pin_P1_09) }, { MP_ROM_QSTR(MP_QSTR_SCL), MP_ROM_PTR(&pin_P0_12) }, { MP_ROM_QSTR(MP_QSTR_SDA), MP_ROM_PTR(&pin_P0_11) }, diff --git a/ports/nrf/common-hal/_bleio/Adapter.c b/ports/nrf/common-hal/_bleio/Adapter.c index 49b5d638f3..1c3c829c5b 100644 --- a/ports/nrf/common-hal/_bleio/Adapter.c +++ b/ports/nrf/common-hal/_bleio/Adapter.c @@ -52,8 +52,9 @@ #include "shared-bindings/_bleio/ScanEntry.h" #include "shared-bindings/time/__init__.h" -#if CIRCUITPY_DOTENV -#include "shared-module/dotenv/__init__.h" +#if CIRCUITPY_OS_GETENV +#include "shared-bindings/os/__init__.h" +#include "shared-module/os/__init__.h" #endif #define BLE_MIN_CONN_INTERVAL MSEC_TO_UNITS(15, UNIT_0_625_MS) @@ -90,7 +91,7 @@ const nvm_bytearray_obj_t common_hal_bleio_nvm_obj = { }; STATIC void softdevice_assert_handler(uint32_t id, uint32_t pc, uint32_t info) { - reset_into_safe_mode(NORDIC_SOFT_DEVICE_ASSERT); + reset_into_safe_mode(SAFE_MODE_SDK_FATAL_ERROR); } bleio_connection_internal_t bleio_connections[BLEIO_TOTAL_CONNECTION_COUNT]; @@ -343,20 +344,17 @@ STATIC void bleio_adapter_reset_name(bleio_adapter_obj_t *self) { 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 - mp_int_t name_len = 0; - - #if CIRCUITPY_DOTENV + #if CIRCUITPY_OS_GETENV 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); + + os_getenv_err_t result = common_hal_os_getenv_str("CIRCUITPY_BLE_NAME", ble_name, sizeof(ble_name)); + if (result == GETENV_OK) { + common_hal_bleio_adapter_set_name(self, ble_name); + return; } #endif - if (name_len <= 0) { - common_hal_bleio_adapter_set_name(self, (char *)default_ble_name); - } + common_hal_bleio_adapter_set_name(self, (char *)default_ble_name); } static void bluetooth_adapter_background(void *data) { diff --git a/ports/nrf/common-hal/_bleio/CharacteristicBuffer.c b/ports/nrf/common-hal/_bleio/CharacteristicBuffer.c index d13ffa1a94..58dc94fe25 100644 --- a/ports/nrf/common-hal/_bleio/CharacteristicBuffer.c +++ b/ports/nrf/common-hal/_bleio/CharacteristicBuffer.c @@ -45,7 +45,17 @@ STATIC void write_to_ringbuf(bleio_characteristic_buffer_obj_t *self, uint8_t *data, uint16_t len) { uint8_t is_nested_critical_region; sd_nvic_critical_region_enter(&is_nested_critical_region); - ringbuf_put_n(&self->ringbuf, data, len); + if (self->watch_for_interrupt_char) { + for (uint16_t i = 0; i < len; i++) { + if (data[i] == mp_interrupt_char) { + mp_sched_keyboard_interrupt(); + } else { + ringbuf_put(&self->ringbuf, data[i]); + } + } + } else { + ringbuf_put_n(&self->ringbuf, data, len); + } sd_nvic_critical_region_exit(is_nested_critical_region); } @@ -85,10 +95,12 @@ void _common_hal_bleio_characteristic_buffer_construct(bleio_characteristic_buff bleio_characteristic_obj_t *characteristic, mp_float_t timeout, uint8_t *buffer, size_t buffer_size, - void *static_handler_entry) { + void *static_handler_entry, + bool watch_for_interrupt_char) { self->characteristic = characteristic; self->timeout_ms = timeout * 1000; + self->watch_for_interrupt_char = watch_for_interrupt_char; ringbuf_init(&self->ringbuf, buffer, buffer_size); @@ -105,7 +117,7 @@ void common_hal_bleio_characteristic_buffer_construct(bleio_characteristic_buffe mp_float_t timeout, size_t buffer_size) { uint8_t *buffer = m_malloc(buffer_size, true); - _common_hal_bleio_characteristic_buffer_construct(self, characteristic, timeout, buffer, buffer_size, NULL); + _common_hal_bleio_characteristic_buffer_construct(self, characteristic, timeout, buffer, buffer_size, NULL, false); } uint32_t common_hal_bleio_characteristic_buffer_read(bleio_characteristic_buffer_obj_t *self, uint8_t *data, size_t len, int *errcode) { diff --git a/ports/nrf/common-hal/_bleio/CharacteristicBuffer.h b/ports/nrf/common-hal/_bleio/CharacteristicBuffer.h index f0949251cd..ba3d7ba3fc 100644 --- a/ports/nrf/common-hal/_bleio/CharacteristicBuffer.h +++ b/ports/nrf/common-hal/_bleio/CharacteristicBuffer.h @@ -27,6 +27,8 @@ #ifndef MICROPY_INCLUDED_NRF_COMMON_HAL_BLEIO_CHARACTERISTICBUFFER_H #define MICROPY_INCLUDED_NRF_COMMON_HAL_BLEIO_CHARACTERISTICBUFFER_H +#include + #include "nrf_soc.h" #include "py/ringbuf.h" @@ -38,6 +40,7 @@ typedef struct { uint32_t timeout_ms; // Ring buffer storing consecutive incoming values. ringbuf_t ringbuf; + bool watch_for_interrupt_char; } bleio_characteristic_buffer_obj_t; #endif // MICROPY_INCLUDED_NRF_COMMON_HAL_BLEIO_CHARACTERISTICBUFFER_H diff --git a/ports/nrf/common-hal/microcontroller/__init__.c b/ports/nrf/common-hal/microcontroller/__init__.c index d84cc58455..cd4114dcfb 100644 --- a/ports/nrf/common-hal/microcontroller/__init__.c +++ b/ports/nrf/common-hal/microcontroller/__init__.c @@ -68,9 +68,8 @@ void common_hal_mcu_disable_interrupts() { void common_hal_mcu_enable_interrupts() { if (nesting_count == 0) { - // This is very very bad because it means there was mismatched disable/enables so we - // crash. - reset_into_safe_mode(HARD_CRASH); + // This is very very bad because it means there was mismatched disable/enables. + reset_into_safe_mode(SAFE_MODE_INTERRUPT_ERROR); } nesting_count--; if (nesting_count > 0) { @@ -82,13 +81,13 @@ void common_hal_mcu_enable_interrupts() { void common_hal_mcu_on_next_reset(mcu_runmode_t runmode) { enum { DFU_MAGIC_UF2_RESET = 0x57 }; - if (runmode == RUNMODE_BOOTLOADER) { - NRF_POWER->GPREGRET = DFU_MAGIC_UF2_RESET; + if (runmode == RUNMODE_BOOTLOADER || runmode == RUNMODE_UF2) { + sd_power_gpregret_set(0,DFU_MAGIC_UF2_RESET); } else { - NRF_POWER->GPREGRET = 0; + sd_power_gpregret_set(0,0); } if (runmode == RUNMODE_SAFE_MODE) { - safe_mode_on_next_reset(PROGRAMMATIC_SAFE_MODE); + safe_mode_on_next_reset(SAFE_MODE_PROGRAMMATIC); } } diff --git a/ports/nrf/fatfs_port.c b/ports/nrf/fatfs_port.c deleted file mode 100644 index 38c2d923b8..0000000000 --- a/ports/nrf/fatfs_port.c +++ /dev/null @@ -1,51 +0,0 @@ -/* - * This file is part of the MicroPython project, http://micropython.org/ - * - * The MIT License (MIT) - * - * SPDX-FileCopyrightText: Copyright (c) 2013, 2014 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 "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) { - 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/nrf/peripherals/nrf/cache.c b/ports/nrf/peripherals/nrf/cache.c index 6eb590d770..54bb77980b 100644 --- a/ports/nrf/peripherals/nrf/cache.c +++ b/ports/nrf/peripherals/nrf/cache.c @@ -29,8 +29,18 @@ // Turn off cache and invalidate all data in it. void nrf_peripherals_disable_and_clear_cache(void) { + // Memory fence for hardware and compiler reasons. If this routine is inlined, the compiler + // needs to know that everything written out be stored before this is called. + // -O2 optimization needed this on SAMD51. Assuming nRF may have the same issue. + // __sync_synchronize() includes volatile asm(), which tells the compiler not to assume + // state across this call. + __sync_synchronize(); + // Disabling cache also invalidates all cache entries. NRF_NVMC->ICACHECNF &= ~(1 << NVMC_ICACHECNF_CACHEEN_Pos); + + // Memory fence for hardware and compiler reasons. + __sync_synchronize(); } // Enable cache diff --git a/ports/nrf/supervisor/internal_flash.c b/ports/nrf/supervisor/internal_flash.c index cce48a4c32..4229ec771b 100644 --- a/ports/nrf/supervisor/internal_flash.c +++ b/ports/nrf/supervisor/internal_flash.c @@ -75,7 +75,7 @@ void port_internal_flash_flush(void) { // Skip if data is the same if (memcmp(_flash_cache, (void *)_flash_page_addr, FLASH_PAGE_SIZE) != 0) { if (!nrf_nvm_safe_flash_page_write(_flash_page_addr, _flash_cache)) { - reset_into_safe_mode(FLASH_WRITE_FAIL); + reset_into_safe_mode(SAFE_MODE_FLASH_WRITE_FAIL); } } } diff --git a/ports/nrf/supervisor/port.c b/ports/nrf/supervisor/port.c index e67f641900..313ecd7e44 100644 --- a/ports/nrf/supervisor/port.c +++ b/ports/nrf/supervisor/port.c @@ -77,7 +77,7 @@ extern void qspi_disable(void); #endif static void power_warning_handler(void) { - reset_into_safe_mode(BROWNOUT); + reset_into_safe_mode(SAFE_MODE_BROWNOUT); } uint32_t reset_reason_saved = 0; @@ -204,11 +204,11 @@ safe_mode_t port_init(void) { // If USB is connected, then the user might be editing `code.py`, // in which case we should reboot into Safe Mode. if (usb_reg & POWER_USBREGSTATUS_VBUSDETECT_Msk) { - return WATCHDOG_RESET; + return SAFE_MODE_WATCHDOG; } } - return NO_SAFE_MODE; + return SAFE_MODE_NONE; } void reset_port(void) { @@ -399,7 +399,7 @@ void port_idle_until_interrupt(void) { extern void HardFault_Handler(void); void HardFault_Handler(void) { - reset_into_safe_mode(HARD_CRASH); + reset_into_safe_mode(SAFE_MODE_HARD_FAULT); while (true) { asm ("nop;"); } diff --git a/ports/raspberrypi/Makefile b/ports/raspberrypi/Makefile index 3a4530ec71..ee0356b852 100644 --- a/ports/raspberrypi/Makefile +++ b/ports/raspberrypi/Makefile @@ -36,7 +36,7 @@ INC_CYW43 := \ -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 +CFLAGS_CYW43 := -DCYW43_LWIP=1 -DPICO_CYW43_ARCH_THREADSAFE_BACKGROUND=1 -DCYW43_USE_SPI -DIGNORE_GPIO25 -DIGNORE_GPIO23 -DIGNORE_GPIO24 -DCYW43_LOGIC_DEBUG=0 -DCYW43_NETUTILS=1 SRC_SDK_CYW43 := \ src/common/pico_sync/sem.c \ src/rp2_common/cyw43_driver/cyw43_bus_pio_spi.c \ @@ -47,6 +47,9 @@ SRC_SDK_CYW43 := \ SRC_LWIP := \ shared/netutils/netutils.c \ + shared/netutils/trace.c \ + shared/netutils/dhcpserver.c \ + $(wildcard lib/lwip/src/apps/mdns/*.c) \ $(wildcard lib/lwip/src/core/*.c) \ $(wildcard lib/lwip/src/core/ipv4/*.c) \ lib/lwip/src/netif/ethernet.c \ @@ -182,13 +185,15 @@ CFLAGS += \ -msoft-float \ -mfloat-abi=soft -PICO_LDFLAGS = --specs=nosys.specs -Wl,--wrap=__aeabi_ldiv0 -Wl,--wrap=__aeabi_idiv0 -Wl,--wrap=__aeabi_lmul -Wl,--wrap=__clzsi2 -Wl,--wrap=__clzdi2 -Wl,--wrap=__ctzsi2 -Wl,--wrap=__ctzdi2 -Wl,--wrap=__popcountsi2 -Wl,--wrap=__popcountdi2 -Wl,--wrap=__clz -Wl,--wrap=__clzl -Wl,--wrap=__clzll -Wl,--wrap=__aeabi_idiv -Wl,--wrap=__aeabi_idivmod -Wl,--wrap=__aeabi_ldivmod -Wl,--wrap=__aeabi_uidiv -Wl,--wrap=__aeabi_uidivmod -Wl,--wrap=__aeabi_uldivmod -Wl,--wrap=__aeabi_dadd -Wl,--wrap=__aeabi_ddiv -Wl,--wrap=__aeabi_dmul -Wl,--wrap=__aeabi_drsub -Wl,--wrap=__aeabi_dsub -Wl,--wrap=__aeabi_cdcmpeq -Wl,--wrap=__aeabi_cdrcmple -Wl,--wrap=__aeabi_cdcmple -Wl,--wrap=__aeabi_dcmpeq -Wl,--wrap=__aeabi_dcmplt -Wl,--wrap=__aeabi_dcmple -Wl,--wrap=__aeabi_dcmpge -Wl,--wrap=__aeabi_dcmpgt -Wl,--wrap=__aeabi_dcmpun -Wl,--wrap=__aeabi_i2d -Wl,--wrap=__aeabi_l2d -Wl,--wrap=__aeabi_ui2d -Wl,--wrap=__aeabi_ul2d -Wl,--wrap=__aeabi_d2iz -Wl,--wrap=__aeabi_d2lz -Wl,--wrap=__aeabi_d2uiz -Wl,--wrap=__aeabi_d2ulz -Wl,--wrap=__aeabi_d2f -Wl,--wrap=sqrt -Wl,--wrap=cos -Wl,--wrap=sin -Wl,--wrap=tan -Wl,--wrap=atan2 -Wl,--wrap=exp -Wl,--wrap=log -Wl,--wrap=ldexp -Wl,--wrap=copysign -Wl,--wrap=trunc -Wl,--wrap=floor -Wl,--wrap=ceil -Wl,--wrap=round -Wl,--wrap=sincos -Wl,--wrap=asin -Wl,--wrap=acos -Wl,--wrap=atan -Wl,--wrap=sinh -Wl,--wrap=cosh -Wl,--wrap=tanh -Wl,--wrap=asinh -Wl,--wrap=acosh -Wl,--wrap=atanh -Wl,--wrap=exp2 -Wl,--wrap=log2 -Wl,--wrap=exp10 -Wl,--wrap=log10 -Wl,--wrap=pow -Wl,--wrap=powint -Wl,--wrap=hypot -Wl,--wrap=cbrt -Wl,--wrap=fmod -Wl,--wrap=drem -Wl,--wrap=remainder -Wl,--wrap=remquo -Wl,--wrap=expm1 -Wl,--wrap=log1p -Wl,--wrap=fma -Wl,--wrap=__aeabi_fadd -Wl,--wrap=__aeabi_fdiv -Wl,--wrap=__aeabi_fmul -Wl,--wrap=__aeabi_frsub -Wl,--wrap=__aeabi_fsub -Wl,--wrap=__aeabi_cfcmpeq -Wl,--wrap=__aeabi_cfrcmple -Wl,--wrap=__aeabi_cfcmple -Wl,--wrap=__aeabi_fcmpeq -Wl,--wrap=__aeabi_fcmplt -Wl,--wrap=__aeabi_fcmple -Wl,--wrap=__aeabi_fcmpge -Wl,--wrap=__aeabi_fcmpgt -Wl,--wrap=__aeabi_fcmpun -Wl,--wrap=__aeabi_i2f -Wl,--wrap=__aeabi_l2f -Wl,--wrap=__aeabi_ui2f -Wl,--wrap=__aeabi_ul2f -Wl,--wrap=__aeabi_f2iz -Wl,--wrap=__aeabi_f2lz -Wl,--wrap=__aeabi_f2uiz -Wl,--wrap=__aeabi_f2ulz -Wl,--wrap=__aeabi_f2d -Wl,--wrap=sqrtf -Wl,--wrap=cosf -Wl,--wrap=sinf -Wl,--wrap=tanf -Wl,--wrap=atan2f -Wl,--wrap=expf -Wl,--wrap=logf -Wl,--wrap=ldexpf -Wl,--wrap=copysignf -Wl,--wrap=truncf -Wl,--wrap=floorf -Wl,--wrap=ceilf -Wl,--wrap=roundf -Wl,--wrap=sincosf -Wl,--wrap=asinf -Wl,--wrap=acosf -Wl,--wrap=atanf -Wl,--wrap=sinhf -Wl,--wrap=coshf -Wl,--wrap=tanhf -Wl,--wrap=asinhf -Wl,--wrap=acoshf -Wl,--wrap=atanhf -Wl,--wrap=exp2f -Wl,--wrap=log2f -Wl,--wrap=exp10f -Wl,--wrap=log10f -Wl,--wrap=powf -Wl,--wrap=powintf -Wl,--wrap=hypotf -Wl,--wrap=cbrtf -Wl,--wrap=fmodf -Wl,--wrap=dremf -Wl,--wrap=remainderf -Wl,--wrap=remquof -Wl,--wrap=expm1f -Wl,--wrap=log1pf -Wl,--wrap=fmaf -Wl,--wrap=memcpy -Wl,--wrap=memset -Wl,--wrap=__aeabi_memcpy -Wl,--wrap=__aeabi_memset -Wl,--wrap=__aeabi_memcpy4 -Wl,--wrap=__aeabi_memset4 -Wl,--wrap=__aeabi_memcpy8 -Wl,--wrap=__aeabi_memset8 +PICO_LDFLAGS = --specs=nosys.specs --specs=nano.specs -Wl,--wrap=__aeabi_ldiv0 -Wl,--wrap=__aeabi_idiv0 -Wl,--wrap=__aeabi_lmul -Wl,--wrap=__clzsi2 -Wl,--wrap=__clzdi2 -Wl,--wrap=__ctzsi2 -Wl,--wrap=__ctzdi2 -Wl,--wrap=__popcountsi2 -Wl,--wrap=__popcountdi2 -Wl,--wrap=__clz -Wl,--wrap=__clzl -Wl,--wrap=__clzll -Wl,--wrap=__aeabi_idiv -Wl,--wrap=__aeabi_idivmod -Wl,--wrap=__aeabi_ldivmod -Wl,--wrap=__aeabi_uidiv -Wl,--wrap=__aeabi_uidivmod -Wl,--wrap=__aeabi_uldivmod -Wl,--wrap=__aeabi_dadd -Wl,--wrap=__aeabi_ddiv -Wl,--wrap=__aeabi_dmul -Wl,--wrap=__aeabi_drsub -Wl,--wrap=__aeabi_dsub -Wl,--wrap=__aeabi_cdcmpeq -Wl,--wrap=__aeabi_cdrcmple -Wl,--wrap=__aeabi_cdcmple -Wl,--wrap=__aeabi_dcmpeq -Wl,--wrap=__aeabi_dcmplt -Wl,--wrap=__aeabi_dcmple -Wl,--wrap=__aeabi_dcmpge -Wl,--wrap=__aeabi_dcmpgt -Wl,--wrap=__aeabi_dcmpun -Wl,--wrap=__aeabi_i2d -Wl,--wrap=__aeabi_l2d -Wl,--wrap=__aeabi_ui2d -Wl,--wrap=__aeabi_ul2d -Wl,--wrap=__aeabi_d2iz -Wl,--wrap=__aeabi_d2lz -Wl,--wrap=__aeabi_d2uiz -Wl,--wrap=__aeabi_d2ulz -Wl,--wrap=__aeabi_d2f -Wl,--wrap=sqrt -Wl,--wrap=cos -Wl,--wrap=sin -Wl,--wrap=tan -Wl,--wrap=atan2 -Wl,--wrap=exp -Wl,--wrap=log -Wl,--wrap=ldexp -Wl,--wrap=copysign -Wl,--wrap=trunc -Wl,--wrap=floor -Wl,--wrap=ceil -Wl,--wrap=round -Wl,--wrap=sincos -Wl,--wrap=asin -Wl,--wrap=acos -Wl,--wrap=atan -Wl,--wrap=sinh -Wl,--wrap=cosh -Wl,--wrap=tanh -Wl,--wrap=asinh -Wl,--wrap=acosh -Wl,--wrap=atanh -Wl,--wrap=exp2 -Wl,--wrap=log2 -Wl,--wrap=exp10 -Wl,--wrap=log10 -Wl,--wrap=pow -Wl,--wrap=powint -Wl,--wrap=hypot -Wl,--wrap=cbrt -Wl,--wrap=fmod -Wl,--wrap=drem -Wl,--wrap=remainder -Wl,--wrap=remquo -Wl,--wrap=expm1 -Wl,--wrap=log1p -Wl,--wrap=fma -Wl,--wrap=__aeabi_fadd -Wl,--wrap=__aeabi_fdiv -Wl,--wrap=__aeabi_fmul -Wl,--wrap=__aeabi_frsub -Wl,--wrap=__aeabi_fsub -Wl,--wrap=__aeabi_cfcmpeq -Wl,--wrap=__aeabi_cfrcmple -Wl,--wrap=__aeabi_cfcmple -Wl,--wrap=__aeabi_fcmpeq -Wl,--wrap=__aeabi_fcmplt -Wl,--wrap=__aeabi_fcmple -Wl,--wrap=__aeabi_fcmpge -Wl,--wrap=__aeabi_fcmpgt -Wl,--wrap=__aeabi_fcmpun -Wl,--wrap=__aeabi_i2f -Wl,--wrap=__aeabi_l2f -Wl,--wrap=__aeabi_ui2f -Wl,--wrap=__aeabi_ul2f -Wl,--wrap=__aeabi_f2iz -Wl,--wrap=__aeabi_f2lz -Wl,--wrap=__aeabi_f2uiz -Wl,--wrap=__aeabi_f2ulz -Wl,--wrap=__aeabi_f2d -Wl,--wrap=sqrtf -Wl,--wrap=cosf -Wl,--wrap=sinf -Wl,--wrap=tanf -Wl,--wrap=atan2f -Wl,--wrap=expf -Wl,--wrap=logf -Wl,--wrap=ldexpf -Wl,--wrap=copysignf -Wl,--wrap=truncf -Wl,--wrap=floorf -Wl,--wrap=ceilf -Wl,--wrap=roundf -Wl,--wrap=sincosf -Wl,--wrap=asinf -Wl,--wrap=acosf -Wl,--wrap=atanf -Wl,--wrap=sinhf -Wl,--wrap=coshf -Wl,--wrap=tanhf -Wl,--wrap=asinhf -Wl,--wrap=acoshf -Wl,--wrap=atanhf -Wl,--wrap=exp2f -Wl,--wrap=log2f -Wl,--wrap=exp10f -Wl,--wrap=log10f -Wl,--wrap=powf -Wl,--wrap=powintf -Wl,--wrap=hypotf -Wl,--wrap=cbrtf -Wl,--wrap=fmodf -Wl,--wrap=dremf -Wl,--wrap=remainderf -Wl,--wrap=remquof -Wl,--wrap=expm1f -Wl,--wrap=log1pf -Wl,--wrap=fmaf -Wl,--wrap=memcpy -Wl,--wrap=memset -Wl,--wrap=__aeabi_memcpy -Wl,--wrap=__aeabi_memset -Wl,--wrap=__aeabi_memcpy4 -Wl,--wrap=__aeabi_memset4 -Wl,--wrap=__aeabi_memcpy8 -Wl,--wrap=__aeabi_memset8 # Use toolchain libm if we're not using our own. ifndef INTERNAL_LIBM LIBS += -lm endif +LIBS += -lc + SRC_SDK := \ src/common/pico_sync/critical_section.c \ src/common/pico_sync/lock_core.c \ @@ -228,7 +233,7 @@ SRC_SDK := \ $(SRC_SDK_CYW43) \ SRC_SDK := $(addprefix sdk/, $(SRC_SDK)) -$(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 +$(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 -Ilib/cyw43-driver SRC_C += \ boards/$(BOARD)/board.c \ @@ -241,7 +246,6 @@ SRC_C += \ background.c \ peripherals/pins.c \ lib/crypto-algorithms/sha256.c \ - fatfs_port.c \ lib/tinyusb/src/portable/raspberrypi/rp2040/dcd_rp2040.c \ lib/tinyusb/src/portable/raspberrypi/rp2040/rp2040_usb.c \ mphalport.c \ @@ -412,7 +416,7 @@ $(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)$(CC) -o $@ $(CFLAGS) @$(BUILD)/firmware.ldflags -Wl,-T,$(LINK_LD) -Wl,-Map=$@.map -Wl,-cref -Wl,--gc-sections @$(BUILD)/firmware.objs -Wl,-lc $(Q)$(SIZE) $@ | $(PYTHON) $(TOP)/tools/build_memory_info.py $(LINK_LD) $(BUILD)/firmware.bin: $(BUILD)/firmware.elf diff --git a/ports/raspberrypi/bindings/cyw43/__init__.c b/ports/raspberrypi/bindings/cyw43/__init__.c index c72581a6e4..778da1ab62 100644 --- a/ports/raspberrypi/bindings/cyw43/__init__.c +++ b/ports/raspberrypi/bindings/cyw43/__init__.c @@ -116,23 +116,23 @@ STATIC mp_obj_t cyw43_get_power_management() { } 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) { +const mcu_pin_obj_t *validate_obj_is_pin_including_cyw43(mp_obj_t obj, qstr arg_name) { 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); + mp_raise_TypeError_varg(translate("%q must be of type %q or %q, not %q"), arg_name, mcu_pin_type.name, cyw43_pin_type.name, mp_obj_get_type(obj)->name); } return MP_OBJ_TO_PTR(obj); } -const mcu_pin_obj_t *validate_obj_is_free_pin_or_gpio29(mp_obj_t obj) { - const mcu_pin_obj_t *pin = validate_obj_is_pin(obj); +const mcu_pin_obj_t *validate_obj_is_free_pin_or_gpio29(mp_obj_t obj, qstr arg_name) { + const mcu_pin_obj_t *pin = validate_obj_is_pin(obj, arg_name); if (obj != &pin_GPIO29) { assert_pin_free(pin); } return pin; } -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); +const mcu_pin_obj_t *validate_obj_is_free_pin_including_cyw43(mp_obj_t obj, qstr arg_name) { + const mcu_pin_obj_t *pin = validate_obj_is_pin_including_cyw43(obj, arg_name); assert_pin_free(pin); return pin; } diff --git a/ports/raspberrypi/bindings/cyw43/__init__.h b/ports/raspberrypi/bindings/cyw43/__init__.h index 65e9813f99..26c1aa008f 100644 --- a/ports/raspberrypi/bindings/cyw43/__init__.h +++ b/ports/raspberrypi/bindings/cyw43/__init__.h @@ -31,9 +31,9 @@ #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_free_pin_or_gpio29(mp_obj_t obj); -const mcu_pin_obj_t *validate_obj_is_pin_including_cyw43(mp_obj_t obj); +const mcu_pin_obj_t *validate_obj_is_free_pin_including_cyw43(mp_obj_t obj, qstr arg_name); +const mcu_pin_obj_t *validate_obj_is_free_pin_or_gpio29(mp_obj_t obj, qstr arg_name); +const mcu_pin_obj_t *validate_obj_is_pin_including_cyw43(mp_obj_t obj, qstr arg_name); #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 */ \ diff --git a/ports/raspberrypi/bindings/rp2pio/StateMachine.c b/ports/raspberrypi/bindings/rp2pio/StateMachine.c index f45dc07357..ada9f46020 100644 --- a/ports/raspberrypi/bindings/rp2pio/StateMachine.c +++ b/ports/raspberrypi/bindings/rp2pio/StateMachine.c @@ -94,7 +94,6 @@ //| wrap_target: int = 0, //| wrap: int = -1, //| ) -> None: -//| //| """Construct a StateMachine object on the given pins with the given program. //| //| :param ReadableBuffer program: the program to run with the state machine @@ -222,19 +221,25 @@ STATIC mp_obj_t rp2pio_statemachine_make_new(const mp_obj_type_t *type, size_t n mp_get_buffer(args[ARG_init].u_obj, &init_bufinfo, MP_BUFFER_READ); // 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); + const mcu_pin_obj_t *first_out_pin = + validate_obj_is_pin_or_none(args[ARG_first_out_pin].u_obj, MP_QSTR_first_out_pin); 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); + const mcu_pin_obj_t *first_in_pin = + validate_obj_is_pin_or_none(args[ARG_first_in_pin].u_obj, MP_QSTR_first_in_pin); 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); + const mcu_pin_obj_t *first_set_pin = + validate_obj_is_pin_or_none(args[ARG_first_set_pin].u_obj, MP_QSTR_first_set_pin); 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); - 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 *first_sideset_pin = + validate_obj_is_pin_or_none(args[ARG_first_sideset_pin].u_obj, MP_QSTR_first_sideset_pin); + 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); + const mcu_pin_obj_t *jmp_pin = + validate_obj_is_pin_or_none(args[ARG_jmp_pin].u_obj, MP_QSTR_jmp_pin); 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 = @@ -390,17 +395,22 @@ STATIC mp_obj_t rp2pio_statemachine_write(size_t n_args, const mp_obj_t *pos_arg mp_buffer_info_t bufinfo; mp_get_buffer_raise(args[ARG_buffer].u_obj, &bufinfo, MP_BUFFER_READ); - int32_t start = args[ARG_start].u_int; - size_t length = bufinfo.len; - normalize_buffer_bounds(&start, args[ARG_end].u_int, &length); - if (length == 0) { - return mp_const_none; - } - 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")); } + int32_t start = args[ARG_start].u_int; + size_t length = bufinfo.len / stride_in_bytes; + // Normalize in element size units, not bytes. + normalize_buffer_bounds(&start, args[ARG_end].u_int, &length); + + // Treat start and length in terms of bytes from now on. + start *= stride_in_bytes; + length *= stride_in_bytes; + + if (length == 0) { + return mp_const_none; + } bool ok = common_hal_rp2pio_statemachine_write(self, ((uint8_t *)bufinfo.buf) + start, length, stride_in_bytes, args[ARG_swap].u_bool); if (mp_hal_is_interrupted()) { @@ -422,7 +432,7 @@ MP_DEFINE_CONST_FUN_OBJ_KW(rp2pio_statemachine_write_obj, 2, rp2pio_statemachine //| ) -> 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. +//| First, if any previous ``once`` or ``loop`` buffer has not been started, this function blocks until they have been started. //| This means that any ``once`` or ``loop`` buffer will be written at least once. //| Then the ``once`` and/or ``loop`` buffers are queued. and the function returns. //| The ``once`` buffer (if specified) will be written just once. @@ -597,18 +607,20 @@ STATIC mp_obj_t rp2pio_statemachine_readinto(size_t n_args, const mp_obj_t *pos_ mp_buffer_info_t bufinfo; mp_get_buffer_raise(args[ARG_buffer].u_obj, &bufinfo, MP_BUFFER_WRITE); - int32_t start = args[ARG_start].u_int; - size_t length = bufinfo.len; - normalize_buffer_bounds(&start, args[ARG_end].u_int, &length); - - if (length == 0) { - return mp_const_none; - } - 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")); } + int32_t start = args[ARG_start].u_int; + size_t length = bufinfo.len / stride_in_bytes; + normalize_buffer_bounds(&start, args[ARG_end].u_int, &length); + + // Treat start and length in terms of bytes from now on. + start *= stride_in_bytes; + length *= stride_in_bytes; + if (length == 0) { + return mp_const_none; + } bool ok = common_hal_rp2pio_statemachine_readinto(self, ((uint8_t *)bufinfo.buf) + start, length, stride_in_bytes, args[ARG_swap].u_bool); if (!ok) { @@ -646,7 +658,8 @@ MP_DEFINE_CONST_FUN_OBJ_KW(rp2pio_statemachine_readinto_obj, 2, rp2pio_statemach //| :param int in_start: Start of the slice of ``buffer_in`` to read into: ``buffer_in[in_start:in_end]`` //| :param int in_end: End of the slice; this index is not included. Defaults to ``len(buffer_in)`` //| :param bool swap_out: For 2- and 4-byte elements, swap (reverse) the byte order for the buffer being transmitted (written) -//| :param bool swap_in: For 2- and 4-rx elements, swap (reverse) the byte order for the buffer being received (read)""" +//| :param bool swap_in: For 2- and 4-rx elements, swap (reverse) the byte order for the buffer being received (read) +//| """ //| ... STATIC mp_obj_t rp2pio_statemachine_write_readinto(size_t n_args, const mp_obj_t *pos_args, mp_map_t *kw_args) { @@ -668,28 +681,32 @@ STATIC mp_obj_t rp2pio_statemachine_write_readinto(size_t n_args, const mp_obj_t mp_buffer_info_t buf_out_info; mp_get_buffer_raise(args[ARG_buffer_out].u_obj, &buf_out_info, MP_BUFFER_READ); + int out_stride_in_bytes = mp_binary_get_size('@', buf_out_info.typecode, NULL); + if (out_stride_in_bytes > 4) { + mp_raise_ValueError(translate("Out-buffer elements must be <= 4 bytes long")); + } int32_t out_start = args[ARG_out_start].u_int; - size_t out_length = buf_out_info.len; + size_t out_length = buf_out_info.len / out_stride_in_bytes; normalize_buffer_bounds(&out_start, args[ARG_out_end].u_int, &out_length); mp_buffer_info_t buf_in_info; mp_get_buffer_raise(args[ARG_buffer_in].u_obj, &buf_in_info, MP_BUFFER_WRITE); - int32_t in_start = args[ARG_in_start].u_int; - size_t in_length = buf_in_info.len; - normalize_buffer_bounds(&in_start, args[ARG_in_end].u_int, &in_length); - - if (out_length == 0 && in_length == 0) { - return mp_const_none; - } - int in_stride_in_bytes = mp_binary_get_size('@', buf_in_info.typecode, NULL); if (in_stride_in_bytes > 4) { mp_raise_ValueError(translate("In-buffer elements must be <= 4 bytes long")); } + int32_t in_start = args[ARG_in_start].u_int; + size_t in_length = buf_in_info.len / in_stride_in_bytes; + normalize_buffer_bounds(&in_start, args[ARG_in_end].u_int, &in_length); - int out_stride_in_bytes = mp_binary_get_size('@', buf_out_info.typecode, NULL); - if (out_stride_in_bytes > 4) { - mp_raise_ValueError(translate("Out-buffer elements must be <= 4 bytes long")); + // Treat start and length in terms of bytes from now on. + out_start *= out_stride_in_bytes; + out_length *= out_stride_in_bytes; + in_start *= in_stride_in_bytes; + in_length *= in_stride_in_bytes; + + if (out_length == 0 && in_length == 0) { + return mp_const_none; } bool ok = common_hal_rp2pio_statemachine_write_readinto(self, diff --git a/ports/raspberrypi/bindings/rp2pio/StateMachine.h b/ports/raspberrypi/bindings/rp2pio/StateMachine.h index 3ec70a8703..6f07ac1fa1 100644 --- a/ports/raspberrypi/bindings/rp2pio/StateMachine.h +++ b/ports/raspberrypi/bindings/rp2pio/StateMachine.h @@ -64,7 +64,7 @@ void common_hal_rp2pio_statemachine_restart(rp2pio_statemachine_obj_t *self); void common_hal_rp2pio_statemachine_stop(rp2pio_statemachine_obj_t *self); void common_hal_rp2pio_statemachine_run(rp2pio_statemachine_obj_t *self, const uint16_t *instructions, size_t len); -// Writes out the given data. +// Lengths are in bytes. bool common_hal_rp2pio_statemachine_write(rp2pio_statemachine_obj_t *self, const uint8_t *data, size_t len, uint8_t stride_in_bytes, bool swap); bool common_hal_rp2pio_statemachine_background_write(rp2pio_statemachine_obj_t *self, const sm_buf_info *once_obj, const sm_buf_info *loop_obj, uint8_t stride_in_bytes, bool swap); bool common_hal_rp2pio_statemachine_stop_background_write(rp2pio_statemachine_obj_t *self); diff --git a/ports/raspberrypi/bindings/rp2pio/__init__.c b/ports/raspberrypi/bindings/rp2pio/__init__.c index 6256d4d898..193a3a2025 100644 --- a/ports/raspberrypi/bindings/rp2pio/__init__.c +++ b/ports/raspberrypi/bindings/rp2pio/__init__.c @@ -38,16 +38,23 @@ //| Learn guide `_. //| //| """ +//| //| def pins_are_sequential(pins: List[microcontroller.Pin]) -> bool: //| """Return True if the pins have sequential GPIO numbers, False otherwise""" //| ... //| -STATIC mp_obj_t rp2pio_pins_are_sequential(const mp_obj_t pins) { +STATIC mp_obj_t rp2pio_pins_are_sequential(mp_obj_t pins_obj) { size_t len; mp_obj_t *items; - mp_obj_get_array(pins, &len, &items); - return mp_obj_new_bool(common_hal_rp2pio_pins_are_sequential(len, items)); + mp_obj_get_array(pins_obj, &len, &items); + + const mcu_pin_obj_t *pins[len]; + for (size_t i = 0; i < len; i++) { + pins[i] = validate_obj_is_pin(items[i], MP_QSTR_pins); + } + + return mp_obj_new_bool(common_hal_rp2pio_pins_are_sequential(len, pins)); } STATIC MP_DEFINE_CONST_FUN_OBJ_1(rp2pio_pins_are_sequential_obj, rp2pio_pins_are_sequential); diff --git a/ports/raspberrypi/bindings/rp2pio/__init__.h b/ports/raspberrypi/bindings/rp2pio/__init__.h index 89dc7ff98f..5cf73cbde3 100644 --- a/ports/raspberrypi/bindings/rp2pio/__init__.h +++ b/ports/raspberrypi/bindings/rp2pio/__init__.h @@ -26,4 +26,6 @@ #pragma once -bool common_hal_rp2pio_pins_are_sequential(size_t len, mp_obj_t *items); +#include "shared-bindings/microcontroller/Pin.h" + +bool common_hal_rp2pio_pins_are_sequential(size_t len, const mcu_pin_obj_t **pins); diff --git a/ports/raspberrypi/boards/0xcb_helios/board.c b/ports/raspberrypi/boards/0xcb_helios/board.c new file mode 100644 index 0000000000..7d8b03d5f4 --- /dev/null +++ b/ports/raspberrypi/boards/0xcb_helios/board.c @@ -0,0 +1,29 @@ +/* + * This file is part of the MicroPython project, http://micropython.org/ + * + * The MIT License (MIT) + * + * Copyright (c) 2023 Conor Burns 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/0xcb_helios/mpconfigboard.h b/ports/raspberrypi/boards/0xcb_helios/mpconfigboard.h new file mode 100644 index 0000000000..fcc3f7d277 --- /dev/null +++ b/ports/raspberrypi/boards/0xcb_helios/mpconfigboard.h @@ -0,0 +1,14 @@ +#define MICROPY_HW_BOARD_NAME "0xCB Helios" +#define MICROPY_HW_MCU_NAME "rp2040" + +#define MICROPY_HW_LED_STATUS (&pin_GPIO17) + +#define DEFAULT_I2C_BUS_SCL (&pin_GPIO3) +#define DEFAULT_I2C_BUS_SDA (&pin_GPIO2) + +#define DEFAULT_SPI_BUS_SCK (&pin_GPIO22) +#define DEFAULT_SPI_BUS_MOSI (&pin_GPIO23) +#define DEFAULT_SPI_BUS_MISO (&pin_GPIO20) + +#define DEFAULT_UART_BUS_RX (&pin_GPIO1) +#define DEFAULT_UART_BUS_TX (&pin_GPIO0) diff --git a/ports/raspberrypi/boards/0xcb_helios/mpconfigboard.mk b/ports/raspberrypi/boards/0xcb_helios/mpconfigboard.mk new file mode 100644 index 0000000000..db3e55ed1f --- /dev/null +++ b/ports/raspberrypi/boards/0xcb_helios/mpconfigboard.mk @@ -0,0 +1,9 @@ +USB_VID = 0x1209 +USB_PID = 0xCB74 +USB_PRODUCT = "Helios" +USB_MANUFACTURER = "0xCB" + +CHIP_VARIANT = RP2040 +CHIP_FAMILY = rp2 + +EXTERNAL_FLASH_DEVICES = "W25Q128JVxQ" diff --git a/ports/raspberrypi/boards/0xcb_helios/pico-sdk-configboard.h b/ports/raspberrypi/boards/0xcb_helios/pico-sdk-configboard.h new file mode 100644 index 0000000000..36da55d457 --- /dev/null +++ b/ports/raspberrypi/boards/0xcb_helios/pico-sdk-configboard.h @@ -0,0 +1 @@ +// Put board-specific pico-sdk definitions here. This file must exist. diff --git a/ports/raspberrypi/boards/0xcb_helios/pins.c b/ports/raspberrypi/boards/0xcb_helios/pins.c new file mode 100644 index 0000000000..3d1b22b0a4 --- /dev/null +++ b/ports/raspberrypi/boards/0xcb_helios/pins.c @@ -0,0 +1,69 @@ +#include "shared-bindings/board/__init__.h" + +STATIC const mp_rom_map_elem_t board_module_globals_table[] = { + CIRCUITPYTHON_BOARD_DICT_STANDARD_ITEMS + + // Left side top to bottom + { MP_ROM_QSTR(MP_QSTR_GP10), MP_ROM_PTR(&pin_GPIO10) }, + + { MP_ROM_QSTR(MP_QSTR_RX), MP_ROM_PTR(&pin_GPIO1) }, + { MP_ROM_QSTR(MP_QSTR_GP1), MP_ROM_PTR(&pin_GPIO1) }, + { MP_ROM_QSTR(MP_QSTR_TX), MP_ROM_PTR(&pin_GPIO0) }, + { MP_ROM_QSTR(MP_QSTR_GP0), MP_ROM_PTR(&pin_GPIO0) }, + + { MP_ROM_QSTR(MP_QSTR_SDA), MP_ROM_PTR(&pin_GPIO2) }, + { MP_ROM_QSTR(MP_QSTR_SCL), MP_ROM_PTR(&pin_GPIO3) }, + + { 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) }, + + + // Right side top to bottom + { MP_ROM_QSTR(MP_QSTR_GP11), MP_ROM_PTR(&pin_GPIO11) }, + + { 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_A2), MP_ROM_PTR(&pin_GPIO28) }, + { MP_ROM_QSTR(MP_QSTR_GP28), MP_ROM_PTR(&pin_GPIO28) }, + { 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_A0), MP_ROM_PTR(&pin_GPIO26) }, + { MP_ROM_QSTR(MP_QSTR_GP26), MP_ROM_PTR(&pin_GPIO26) }, + + { 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_SDI), MP_ROM_PTR(&pin_GPIO20) }, + { MP_ROM_QSTR(MP_QSTR_GP20), MP_ROM_PTR(&pin_GPIO20) }, + { MP_ROM_QSTR(MP_QSTR_SDO), MP_ROM_PTR(&pin_GPIO23) }, + { MP_ROM_QSTR(MP_QSTR_GP23), MP_ROM_PTR(&pin_GPIO23) }, + { MP_ROM_QSTR(MP_QSTR_CS), MP_ROM_PTR(&pin_GPIO21) }, + { MP_ROM_QSTR(MP_QSTR_GP21), MP_ROM_PTR(&pin_GPIO21) }, + + + // Bottom side left to right + { 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) }, + + + // Internal Pins + { MP_ROM_QSTR(MP_QSTR_RGB), MP_ROM_PTR(&pin_GPIO25) }, + { MP_ROM_QSTR(MP_QSTR_GP25), MP_ROM_PTR(&pin_GPIO25) }, + { MP_ROM_QSTR(MP_QSTR_LED), MP_ROM_PTR(&pin_GPIO17) }, + { MP_ROM_QSTR(MP_QSTR_GP17), MP_ROM_PTR(&pin_GPIO17) }, + { MP_ROM_QSTR(MP_QSTR_VBUS_SENSE), MP_ROM_PTR(&pin_GPIO19) }, + { MP_ROM_QSTR(MP_QSTR_GP19), 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_DEFINE_CONST_DICT(board_module_globals, board_module_globals_table); diff --git a/ports/raspberrypi/boards/challenger_rp2040_sdrtc/board.c b/ports/raspberrypi/boards/challenger_rp2040_sdrtc/board.c new file mode 100644 index 0000000000..b66ea0e27f --- /dev/null +++ b/ports/raspberrypi/boards/challenger_rp2040_sdrtc/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_sdrtc/mpconfigboard.h b/ports/raspberrypi/boards/challenger_rp2040_sdrtc/mpconfigboard.h new file mode 100644 index 0000000000..b8f08b9956 --- /dev/null +++ b/ports/raspberrypi/boards/challenger_rp2040_sdrtc/mpconfigboard.h @@ -0,0 +1,10 @@ +#define MICROPY_HW_BOARD_NAME "Challenger RP2040 SD/RTC" +#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_sdrtc/mpconfigboard.mk b/ports/raspberrypi/boards/challenger_rp2040_sdrtc/mpconfigboard.mk new file mode 100644 index 0000000000..022dbd143c --- /dev/null +++ b/ports/raspberrypi/boards/challenger_rp2040_sdrtc/mpconfigboard.mk @@ -0,0 +1,13 @@ +USB_VID = 0x2e8a +USB_PID = 0x102d +USB_PRODUCT = "Challenger RP2040 SD/RTC" +USB_MANUFACTURER = "Invector Labs" + +CHIP_VARIANT = RP2040 +CHIP_FAMILY = rp2 + +EXTERNAL_FLASH_DEVICES = "W25Q64JVxQ" + +CIRCUITPY__EVE = 1 + +FROZEN_MPY_DIRS += $(TOP)/frozen/Adafruit_CircuitPython_SD diff --git a/ports/raspberrypi/boards/challenger_rp2040_sdrtc/pico-sdk-configboard.h b/ports/raspberrypi/boards/challenger_rp2040_sdrtc/pico-sdk-configboard.h new file mode 100644 index 0000000000..36da55d457 --- /dev/null +++ b/ports/raspberrypi/boards/challenger_rp2040_sdrtc/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_sdrtc/pins.c b/ports/raspberrypi/boards/challenger_rp2040_sdrtc/pins.c new file mode 100644 index 0000000000..7f4f620b59 --- /dev/null +++ b/ports/raspberrypi/boards/challenger_rp2040_sdrtc/pins.c @@ -0,0 +1,76 @@ +#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_SD_CS), MP_ROM_PTR(&pin_GPIO9) }, + { MP_ROM_QSTR(MP_QSTR_GP9), MP_ROM_PTR(&pin_GPIO9) }, + { MP_ROM_QSTR(MP_QSTR_SD_SCK), MP_ROM_PTR(&pin_GPIO10) }, + { MP_ROM_QSTR(MP_QSTR_GP10), MP_ROM_PTR(&pin_GPIO10) }, + { MP_ROM_QSTR(MP_QSTR_SD_SDO), MP_ROM_PTR(&pin_GPIO11) }, + { MP_ROM_QSTR(MP_QSTR_GP11), MP_ROM_PTR(&pin_GPIO11) }, + { MP_ROM_QSTR(MP_QSTR_SD_SDI), MP_ROM_PTR(&pin_GPIO12) }, + { MP_ROM_QSTR(MP_QSTR_GP12), MP_ROM_PTR(&pin_GPIO12) }, + { MP_ROM_QSTR(MP_QSTR_SD_CARD_DETECT), 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_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/e_fidget/board.c b/ports/raspberrypi/boards/e_fidget/board.c new file mode 100644 index 0000000000..331653173e --- /dev/null +++ b/ports/raspberrypi/boards/e_fidget/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/e_fidget/mpconfigboard.h b/ports/raspberrypi/boards/e_fidget/mpconfigboard.h new file mode 100644 index 0000000000..5c34c77f94 --- /dev/null +++ b/ports/raspberrypi/boards/e_fidget/mpconfigboard.h @@ -0,0 +1,5 @@ +#define MICROPY_HW_BOARD_NAME "E-Fidget" +#define MICROPY_HW_MCU_NAME "rp2040" + +#define MICROPY_HW_NEOPIXEL (&pin_GPIO18) +#define MICROPY_HW_NEOPIXEL_COUNT (3) diff --git a/ports/raspberrypi/boards/e_fidget/mpconfigboard.mk b/ports/raspberrypi/boards/e_fidget/mpconfigboard.mk new file mode 100644 index 0000000000..62195e46f3 --- /dev/null +++ b/ports/raspberrypi/boards/e_fidget/mpconfigboard.mk @@ -0,0 +1,11 @@ +USB_VID = 0x1209 +USB_PID = 0xEF00 +USB_PRODUCT = "E-Fidget" +USB_MANUFACTURER = "2231puppy" + +CHIP_VARIANT = RP2040 +CHIP_FAMILY = rp2 + +EXTERNAL_FLASH_DEVICES = "W25Q16JVxQ" + +CIRCUITPY__EVE = 1 diff --git a/ports/raspberrypi/boards/e_fidget/pico-sdk-configboard.h b/ports/raspberrypi/boards/e_fidget/pico-sdk-configboard.h new file mode 100644 index 0000000000..5f7eb47ae3 --- /dev/null +++ b/ports/raspberrypi/boards/e_fidget/pico-sdk-configboard.h @@ -0,0 +1,2 @@ +// Put board-specific pico-sdk definitions here. This file must exist. +#define PICO_XOSC_STARTUP_DELAY_MULTIPLIER 64 diff --git a/ports/raspberrypi/boards/e_fidget/pins.c b/ports/raspberrypi/boards/e_fidget/pins.c new file mode 100644 index 0000000000..dbb27b782d --- /dev/null +++ b/ports/raspberrypi/boards/e_fidget/pins.c @@ -0,0 +1,32 @@ +#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_BTN1), MP_ROM_PTR(&pin_GPIO3)}, + {MP_ROM_QSTR(MP_QSTR_BTN3), MP_ROM_PTR(&pin_GPIO4)}, + {MP_ROM_QSTR(MP_QSTR_BTN2), MP_ROM_PTR(&pin_GPIO5)}, + {MP_ROM_QSTR(MP_QSTR_M1), MP_ROM_PTR(&pin_GPIO7)}, + {MP_ROM_QSTR(MP_QSTR_M2), MP_ROM_PTR(&pin_GPIO11)}, + {MP_ROM_QSTR(MP_QSTR_M3), MP_ROM_PTR(&pin_GPIO13)}, + {MP_ROM_QSTR(MP_QSTR_M4), MP_ROM_PTR(&pin_GPIO9)}, + {MP_ROM_QSTR(MP_QSTR_M5), MP_ROM_PTR(&pin_GPIO8)}, + {MP_ROM_QSTR(MP_QSTR_M6), MP_ROM_PTR(&pin_GPIO10)}, + {MP_ROM_QSTR(MP_QSTR_M7), MP_ROM_PTR(&pin_GPIO12)}, + {MP_ROM_QSTR(MP_QSTR_M8), MP_ROM_PTR(&pin_GPIO14)}, + {MP_ROM_QSTR(MP_QSTR_NEOPIXEL), MP_ROM_PTR(&pin_GPIO18)}, + + {MP_ROM_QSTR(MP_QSTR_SMPS_MODE), MP_ROM_PTR(&pin_GPIO23)}, + + {MP_ROM_QSTR(MP_QSTR_VBUS_SENSE), MP_ROM_PTR(&pin_GPIO24)}, + + {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_VOLTAGE_MONITOR), MP_ROM_PTR(&pin_GPIO29)}, +}; +MP_DEFINE_CONST_DICT(board_module_globals, board_module_globals_table); diff --git a/ports/espressif/boards/adafruit_feather_esp32s2_tftback_nopsram/board.c b/ports/raspberrypi/boards/hack_club_sprig/board.c similarity index 56% rename from ports/espressif/boards/adafruit_feather_esp32s2_tftback_nopsram/board.c rename to ports/raspberrypi/boards/hack_club_sprig/board.c index e0edec2fa2..775e6ca5df 100644 --- a/ports/espressif/boards/adafruit_feather_esp32s2_tftback_nopsram/board.c +++ b/ports/raspberrypi/boards/hack_club_sprig/board.c @@ -3,7 +3,7 @@ * * The MIT License (MIT) * - * Copyright (c) 2020 Scott Shawcroft for Adafruit Industries + * Copyright (c) 2023 ajs256 * * Permission is hereby granted, free of charge, to any person obtaining a copy * of this software and associated documentation files (the "Software"), to deal @@ -28,71 +28,92 @@ #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 "supervisor/shared/board.h" -/* displayio_fourwire_obj_t board_display_obj; -#define DELAY 0x80 - +// display init sequence from CircuitPython library https://github.com/adafruit/Adafruit_CircuitPython_ST7735R/blob/dfae353330cf051d1f31db9e4b681c8d70900cc5/adafruit_st7735r.py uint8_t display_init_sequence[] = { - 0x01, 0 | DELAY, 150, // SWRESET - 0x11, 0 | DELAY, 255, // SLPOUT - 0x36, 1, 0x00, // _MADCTL bottom to top refresh in vsync aligned order. - 0x3a, 1, 0x55, // COLMOD - 16bit color - 0x21, 0 | DELAY, 10, // _INVON - 0x13, 0 | DELAY, 10, // _NORON - 0x29, 0 | DELAY, 255, // _DISPON + // sw reset + 0x01, 0x80, 0x96, + // sleep out and delay + 0x11, 0x80, 0xFF, + // _FRMCTR1 + 0xB1, 0x03, 0x01, 0x2C, 0x2D, + // _FRMCTR2 + 0xB2, 0x03, 0x01, 0x2C, 0x2D, + // _FRMCTR3 + 0xB3, 0x06, 0x01, 0x2C, 0x2D, 0x01, 0x2C, 0x2D, + // _INVCTR line inversion + 0xB4, 0x01, 0x07, + // _PWCTR1 GVDD = 4.7V, 1.0uA + 0xC0, 0x03, 0xA2, 0x02, 0x84, + // _PWCTR2 VGH=14.7V, VGL=-7.35V + 0xC1, 0x01, 0xC5, + // _PWCTR3 Opamp current small, Boost frequency + 0xC2, 0x02, 0x0A, 0x00, + 0xC3, 0x02, 0x8A, 0x2A, + 0xC4, 0x02, 0x8A, 0xEE, + // _VMCTR1 VCOMH = 4V, VOML = -1.1V + 0xC5, 0x01, 0x0E, + // _INVOFF + 0x20, 0x00, + // _MADCTL bottom to top refresh + 0x36, 0x01, 0x18, + // COLMOD - 16 bit color + 0x3A, 0x01, 0x05, + // _GMCTRP1 Gamma + 0xE0, 0x10, 0x02, 0x1C, 0x07, 0x12, 0x37, 0x32, 0x29, 0x2D, 0x29, 0x25, 0x2B, 0x39, 0x00, 0x01, 0x03, 0x10, + // _GMCTRN1 + 0xE1, 0x10, 0x03, 0x1d, 0x07, 0x06, 0x2E, 0x2C, 0x29, 0x2D, 0x2E, 0x2E, 0x37, 0x3F, 0x00, 0x00, 0x02, 0x10, + // _NORON + 0x13, 0x80, 0x0A, + // _DISPON + 0x29, 0x80, 0x64, + // _MADCTL Default rotation + BGR encoding + 0x36, 0x01, 0xC0, }; -*/ void board_init(void) { - // Debug UART - #ifdef DEBUG - common_hal_never_reset_pin(&pin_GPIO43); - common_hal_never_reset_pin(&pin_GPIO44); - #endif /* DEBUG */ - - /* - busio_spi_obj_t* spi = &displays[0].fourwire_bus.inline_bus; - common_hal_busio_spi_construct(spi, &pin_GPIO36, &pin_GPIO35, NULL); + busio_spi_obj_t *spi = &displays[0].fourwire_bus.inline_bus; + common_hal_busio_spi_construct(spi, &pin_GPIO18, &pin_GPIO19, &pin_GPIO16, false); common_hal_busio_spi_never_reset(spi); - displayio_fourwire_obj_t* bus = &displays[0].fourwire_bus; + displayio_fourwire_obj_t *bus = &displays[0].fourwire_bus; bus->base.type = &displayio_fourwire_type; common_hal_displayio_fourwire_construct(bus, spi, - &pin_GPIO40, // TFT_DC Command or data - &pin_GPIO42, // TFT_CS Chip select - &pin_GPIO41, // TFT_RST Reset - 4000000, // Baudrate - 0, // Polarity - 0); // Phase + &pin_GPIO22, // DC + &pin_GPIO20, // CS + &pin_GPIO26, // RST + 30000000, + 0, + 0); - displayio_display_obj_t* display = &displays[0].display; + 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) + 160, // Width + 128, // Height 0, // column start 0, // row start - 0, // rotation + 270, // rotation 16, // Color depth false, // Grayscale - false, // Pixels in a byte share a row. Only used for depth < 8 + 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 + true, // reverse_bytes_in_word MIPI_COMMAND_SET_COLUMN_ADDRESS, // Set column command MIPI_COMMAND_SET_PAGE_ADDRESS, // Set row command MIPI_COMMAND_WRITE_MEMORY_START, // Write memory command display_init_sequence, sizeof(display_init_sequence), - &pin_GPIO7, // backlight pin + &pin_GPIO17, // backlight pin NO_BRIGHTNESS_COMMAND, 1.0f, // brightness false, // single_byte_bounds @@ -100,9 +121,8 @@ void board_init(void) { true, // auto_refresh 60, // native_frames_per_second true, // backlight_on_high - false, // not SH1107 + false, // SH1107_addressing 50000); // backlight pwm frequency - */ } // Use the MP_WEAK supervisor/shared/board.c versions of routines not defined here. diff --git a/ports/raspberrypi/boards/hack_club_sprig/mpconfigboard.h b/ports/raspberrypi/boards/hack_club_sprig/mpconfigboard.h new file mode 100644 index 0000000000..442e455c5e --- /dev/null +++ b/ports/raspberrypi/boards/hack_club_sprig/mpconfigboard.h @@ -0,0 +1,4 @@ +#define MICROPY_HW_BOARD_NAME "Hack Club Sprig" +#define MICROPY_HW_MCU_NAME "rp2040" + +#define MICROPY_HW_LED_STATUS (&pin_GPIO4) diff --git a/ports/raspberrypi/boards/hack_club_sprig/mpconfigboard.mk b/ports/raspberrypi/boards/hack_club_sprig/mpconfigboard.mk new file mode 100644 index 0000000000..1bde636031 --- /dev/null +++ b/ports/raspberrypi/boards/hack_club_sprig/mpconfigboard.mk @@ -0,0 +1,11 @@ +USB_VID = 0x1209 +USB_PID = 0x9000 +USB_PRODUCT = "Sprig" +USB_MANUFACTURER = "Hack Club" + +CHIP_VARIANT = RP2040 +CHIP_FAMILY = rp2 + +EXTERNAL_FLASH_DEVICES = "W25Q16JVxQ" + +CIRCUITPY__EVE = 1 diff --git a/ports/raspberrypi/boards/hack_club_sprig/pico-sdk-configboard.h b/ports/raspberrypi/boards/hack_club_sprig/pico-sdk-configboard.h new file mode 100644 index 0000000000..36da55d457 --- /dev/null +++ b/ports/raspberrypi/boards/hack_club_sprig/pico-sdk-configboard.h @@ -0,0 +1 @@ +// Put board-specific pico-sdk definitions here. This file must exist. diff --git a/ports/raspberrypi/boards/hack_club_sprig/pins.c b/ports/raspberrypi/boards/hack_club_sprig/pins.c new file mode 100644 index 0000000000..f82b8fafc5 --- /dev/null +++ b/ports/raspberrypi/boards/hack_club_sprig/pins.c @@ -0,0 +1,85 @@ +#include "shared-bindings/board/__init__.h" + +STATIC const mp_rom_map_elem_t board_module_globals_table[] = { + CIRCUITPYTHON_BOARD_DICT_STANDARD_ITEMS + + { MP_ROM_QSTR(MP_QSTR_GP0), MP_ROM_PTR(&pin_GPIO0) }, + { MP_ROM_QSTR(MP_QSTR_GP1), MP_ROM_PTR(&pin_GPIO1) }, + { MP_ROM_QSTR(MP_QSTR_GP2), MP_ROM_PTR(&pin_GPIO2) }, + { MP_ROM_QSTR(MP_QSTR_GP3), MP_ROM_PTR(&pin_GPIO3) }, + { MP_ROM_QSTR(MP_QSTR_GP4), MP_ROM_PTR(&pin_GPIO4) }, + { MP_ROM_QSTR(MP_QSTR_GP5), MP_ROM_PTR(&pin_GPIO5) }, + { MP_ROM_QSTR(MP_QSTR_GP6), MP_ROM_PTR(&pin_GPIO6) }, + { MP_ROM_QSTR(MP_QSTR_GP7), MP_ROM_PTR(&pin_GPIO7) }, + { MP_ROM_QSTR(MP_QSTR_GP8), MP_ROM_PTR(&pin_GPIO8) }, + { MP_ROM_QSTR(MP_QSTR_GP9), MP_ROM_PTR(&pin_GPIO9) }, + { MP_ROM_QSTR(MP_QSTR_GP10), MP_ROM_PTR(&pin_GPIO10) }, + { MP_ROM_QSTR(MP_QSTR_GP11), MP_ROM_PTR(&pin_GPIO11) }, + { MP_ROM_QSTR(MP_QSTR_GP12), MP_ROM_PTR(&pin_GPIO12) }, + { MP_ROM_QSTR(MP_QSTR_GP13), MP_ROM_PTR(&pin_GPIO13) }, + { MP_ROM_QSTR(MP_QSTR_GP14), MP_ROM_PTR(&pin_GPIO14) }, + { MP_ROM_QSTR(MP_QSTR_GP15), MP_ROM_PTR(&pin_GPIO15) }, + { MP_ROM_QSTR(MP_QSTR_GP16), MP_ROM_PTR(&pin_GPIO16) }, + { MP_ROM_QSTR(MP_QSTR_GP17), MP_ROM_PTR(&pin_GPIO17) }, + { MP_ROM_QSTR(MP_QSTR_GP18), MP_ROM_PTR(&pin_GPIO18) }, + { MP_ROM_QSTR(MP_QSTR_GP19), MP_ROM_PTR(&pin_GPIO19) }, + { MP_ROM_QSTR(MP_QSTR_GP20), MP_ROM_PTR(&pin_GPIO20) }, + { MP_ROM_QSTR(MP_QSTR_GP21), MP_ROM_PTR(&pin_GPIO21) }, + { MP_ROM_QSTR(MP_QSTR_GP22), MP_ROM_PTR(&pin_GPIO22) }, + + { MP_ROM_QSTR(MP_QSTR_SMPS_MODE), MP_ROM_PTR(&pin_GPIO23) }, + { MP_ROM_QSTR(MP_QSTR_GP23), MP_ROM_PTR(&pin_GPIO23) }, + + { MP_ROM_QSTR(MP_QSTR_VBUS_SENSE), MP_ROM_PTR(&pin_GPIO24) }, + { MP_ROM_QSTR(MP_QSTR_GP24), MP_ROM_PTR(&pin_GPIO24) }, + + { MP_ROM_QSTR(MP_QSTR_LED), MP_ROM_PTR(&pin_GPIO25) }, + { MP_ROM_QSTR(MP_QSTR_GP25), MP_ROM_PTR(&pin_GPIO25) }, + + { MP_ROM_QSTR(MP_QSTR_GP26_A0), MP_ROM_PTR(&pin_GPIO26) }, + { MP_ROM_QSTR(MP_QSTR_GP26), MP_ROM_PTR(&pin_GPIO26) }, + { MP_ROM_QSTR(MP_QSTR_A0), MP_ROM_PTR(&pin_GPIO26) }, + + { MP_ROM_QSTR(MP_QSTR_GP27_A1), MP_ROM_PTR(&pin_GPIO27) }, + { MP_ROM_QSTR(MP_QSTR_GP27), MP_ROM_PTR(&pin_GPIO27) }, + { MP_ROM_QSTR(MP_QSTR_A1), MP_ROM_PTR(&pin_GPIO27) }, + + { MP_ROM_QSTR(MP_QSTR_GP28_A2), MP_ROM_PTR(&pin_GPIO28) }, + { MP_ROM_QSTR(MP_QSTR_GP28), MP_ROM_PTR(&pin_GPIO28) }, + { MP_ROM_QSTR(MP_QSTR_A2), MP_ROM_PTR(&pin_GPIO28) }, + + { MP_ROM_QSTR(MP_QSTR_A3), MP_ROM_PTR(&pin_GPIO29) }, + { MP_ROM_QSTR(MP_QSTR_VOLTAGE_MONITOR), MP_ROM_PTR(&pin_GPIO29) }, + + + // Start Sprig-specific definitions + + { MP_ROM_QSTR(MP_QSTR_BLUE_LED), MP_ROM_PTR(&pin_GPIO4) }, + + { MP_ROM_QSTR(MP_QSTR_BUTTON_W), MP_ROM_PTR(&pin_GPIO5) }, + { MP_ROM_QSTR(MP_QSTR_BUTTON_A), MP_ROM_PTR(&pin_GPIO6) }, + { MP_ROM_QSTR(MP_QSTR_BUTTON_S), MP_ROM_PTR(&pin_GPIO7) }, + { MP_ROM_QSTR(MP_QSTR_BUTTON_D), MP_ROM_PTR(&pin_GPIO8) }, + + { MP_ROM_QSTR(MP_QSTR_AUDIO_DIN), MP_ROM_PTR(&pin_GPIO9) }, + { MP_ROM_QSTR(MP_QSTR_AUDIO_BCLK), MP_ROM_PTR(&pin_GPIO10) }, + { MP_ROM_QSTR(MP_QSTR_AUDIO_LRCLK), MP_ROM_PTR(&pin_GPIO11) }, + + { MP_ROM_QSTR(MP_QSTR_BUTTON_I), MP_ROM_PTR(&pin_GPIO12) }, + { MP_ROM_QSTR(MP_QSTR_BUTTON_J), MP_ROM_PTR(&pin_GPIO13) }, + { MP_ROM_QSTR(MP_QSTR_BUTTON_K), MP_ROM_PTR(&pin_GPIO14) }, + { MP_ROM_QSTR(MP_QSTR_BUTTON_L), MP_ROM_PTR(&pin_GPIO15) }, + + { MP_ROM_QSTR(MP_QSTR_MISO), MP_ROM_PTR(&pin_GPIO16) }, + { MP_ROM_QSTR(MP_QSTR_TFT_LITE), MP_ROM_PTR(&pin_GPIO17) }, + { MP_ROM_QSTR(MP_QSTR_SCK), MP_ROM_PTR(&pin_GPIO18) }, + { MP_ROM_QSTR(MP_QSTR_MOSI), MP_ROM_PTR(&pin_GPIO19) }, + { MP_ROM_QSTR(MP_QSTR_TFT_CS), MP_ROM_PTR(&pin_GPIO20) }, + { MP_ROM_QSTR(MP_QSTR_CARD_CS), MP_ROM_PTR(&pin_GPIO21) }, + { MP_ROM_QSTR(MP_QSTR_TFT_DC), MP_ROM_PTR(&pin_GPIO22) }, + { MP_ROM_QSTR(MP_QSTR_TFT_RESET), MP_ROM_PTR(&pin_GPIO23) }, + + { MP_ROM_QSTR(MP_QSTR_WHITE_LED), MP_ROM_PTR(&pin_GPIO28) }, + +}; +MP_DEFINE_CONST_DICT(board_module_globals, board_module_globals_table); diff --git a/ports/raspberrypi/boards/jpconstantineau_pykey18/board.c b/ports/raspberrypi/boards/jpconstantineau_pykey18/board.c index 4785f742ec..5b1190727f 100644 --- a/ports/raspberrypi/boards/jpconstantineau_pykey18/board.c +++ b/ports/raspberrypi/boards/jpconstantineau_pykey18/board.c @@ -31,7 +31,7 @@ void reset_board(void) { // turn off any left over LED - board_reset_user_neopixels(&pin_GPIO29, 62); + board_reset_user_neopixels(&pin_GPIO29, 19); } // Use the MP_WEAK supervisor/shared/board.c versions of routines not defined here. diff --git a/ports/raspberrypi/boards/jpconstantineau_pykey44/board.c b/ports/raspberrypi/boards/jpconstantineau_pykey44/board.c index 4785f742ec..4e0aa74450 100644 --- a/ports/raspberrypi/boards/jpconstantineau_pykey44/board.c +++ b/ports/raspberrypi/boards/jpconstantineau_pykey44/board.c @@ -31,7 +31,7 @@ void reset_board(void) { // turn off any left over LED - board_reset_user_neopixels(&pin_GPIO29, 62); + board_reset_user_neopixels(&pin_GPIO29, 45); } // Use the MP_WEAK supervisor/shared/board.c versions of routines not defined here. diff --git a/ports/raspberrypi/boards/jpconstantineau_pykey87/board.c b/ports/raspberrypi/boards/jpconstantineau_pykey87/board.c index 4785f742ec..a77563c663 100644 --- a/ports/raspberrypi/boards/jpconstantineau_pykey87/board.c +++ b/ports/raspberrypi/boards/jpconstantineau_pykey87/board.c @@ -31,7 +31,7 @@ void reset_board(void) { // turn off any left over LED - board_reset_user_neopixels(&pin_GPIO29, 62); + board_reset_user_neopixels(&pin_GPIO29, 88); } // Use the MP_WEAK supervisor/shared/board.c versions of routines not defined here. diff --git a/ports/raspberrypi/boards/nullbits_bit_c_pro/board.c b/ports/raspberrypi/boards/nullbits_bit_c_pro/board.c new file mode 100644 index 0000000000..331653173e --- /dev/null +++ b/ports/raspberrypi/boards/nullbits_bit_c_pro/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/nullbits_bit_c_pro/mpconfigboard.h b/ports/raspberrypi/boards/nullbits_bit_c_pro/mpconfigboard.h new file mode 100644 index 0000000000..d2a514006a --- /dev/null +++ b/ports/raspberrypi/boards/nullbits_bit_c_pro/mpconfigboard.h @@ -0,0 +1,17 @@ +#define MICROPY_HW_BOARD_NAME "nullbits Bit-C PRO" +#define MICROPY_HW_MCU_NAME "rp2040" + +#define DEFAULT_I2C_BUS_SCL (&pin_GPIO3) +#define DEFAULT_I2C_BUS_SDA (&pin_GPIO2) + +#define DEFAULT_SPI_BUS_SCK (&pin_GPIO22) +#define DEFAULT_SPI_BUS_MOSI (&pin_GPIO23) +#define DEFAULT_SPI_BUS_MISO (&pin_GPIO20) + +#define DEFAULT_UART_BUS_RX (&pin_GPIO1) +#define DEFAULT_UART_BUS_TX (&pin_GPIO0) + +#define CIRCUITPY_RGB_STATUS_INVERTED_PWM +#define CIRCUITPY_RGB_STATUS_R (&pin_GPIO16) +#define CIRCUITPY_RGB_STATUS_G (&pin_GPIO17) +#define CIRCUITPY_RGB_STATUS_B (&pin_GPIO18) diff --git a/ports/raspberrypi/boards/nullbits_bit_c_pro/mpconfigboard.mk b/ports/raspberrypi/boards/nullbits_bit_c_pro/mpconfigboard.mk new file mode 100644 index 0000000000..81271d3721 --- /dev/null +++ b/ports/raspberrypi/boards/nullbits_bit_c_pro/mpconfigboard.mk @@ -0,0 +1,9 @@ +USB_VID = 0x2E8A +USB_PID = 0x1048 +USB_PRODUCT = "Bit-C PRO" +USB_MANUFACTURER = "nullbits" + +CHIP_VARIANT = RP2040 +CHIP_FAMILY = rp2 + +EXTERNAL_FLASH_DEVICES = "GD25Q32C" diff --git a/ports/raspberrypi/boards/nullbits_bit_c_pro/pico-sdk-configboard.h b/ports/raspberrypi/boards/nullbits_bit_c_pro/pico-sdk-configboard.h new file mode 100644 index 0000000000..a41131dd22 --- /dev/null +++ b/ports/raspberrypi/boards/nullbits_bit_c_pro/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/nullbits_bit_c_pro/pins.c b/ports/raspberrypi/boards/nullbits_bit_c_pro/pins.c new file mode 100644 index 0000000000..ac1b1a8065 --- /dev/null +++ b/ports/raspberrypi/boards/nullbits_bit_c_pro/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_GPIO26) }, + { MP_ROM_QSTR(MP_QSTR_D26), MP_ROM_PTR(&pin_GPIO26) }, + { MP_ROM_QSTR(MP_QSTR_A1), MP_ROM_PTR(&pin_GPIO27) }, + { MP_ROM_QSTR(MP_QSTR_D27), MP_ROM_PTR(&pin_GPIO27) }, + { MP_ROM_QSTR(MP_QSTR_A2), MP_ROM_PTR(&pin_GPIO28) }, + { MP_ROM_QSTR(MP_QSTR_D28), MP_ROM_PTR(&pin_GPIO28) }, + { MP_ROM_QSTR(MP_QSTR_A3), MP_ROM_PTR(&pin_GPIO29) }, + { MP_ROM_QSTR(MP_QSTR_D29), MP_ROM_PTR(&pin_GPIO29) }, + + { MP_ROM_QSTR(MP_QSTR_SCK), MP_ROM_PTR(&pin_GPIO22) }, + { MP_ROM_QSTR(MP_QSTR_D22), MP_ROM_PTR(&pin_GPIO22) }, + { MP_ROM_QSTR(MP_QSTR_MOSI), MP_ROM_PTR(&pin_GPIO23) }, + { MP_ROM_QSTR(MP_QSTR_D23), MP_ROM_PTR(&pin_GPIO23) }, + { MP_ROM_QSTR(MP_QSTR_MISO), MP_ROM_PTR(&pin_GPIO20) }, + { MP_ROM_QSTR(MP_QSTR_D20), MP_ROM_PTR(&pin_GPIO20) }, + + { MP_ROM_QSTR(MP_QSTR_D1), MP_ROM_PTR(&pin_GPIO1) }, + { MP_ROM_QSTR(MP_QSTR_RX), MP_ROM_PTR(&pin_GPIO1) }, + { MP_ROM_QSTR(MP_QSTR_D0), MP_ROM_PTR(&pin_GPIO0) }, + { MP_ROM_QSTR(MP_QSTR_TX), MP_ROM_PTR(&pin_GPIO0) }, + + { MP_ROM_QSTR(MP_QSTR_D2), MP_ROM_PTR(&pin_GPIO2) }, + { MP_ROM_QSTR(MP_QSTR_D3), MP_ROM_PTR(&pin_GPIO3) }, + { MP_ROM_QSTR(MP_QSTR_SDA), MP_ROM_PTR(&pin_GPIO2) }, + { MP_ROM_QSTR(MP_QSTR_SCL), MP_ROM_PTR(&pin_GPIO3) }, + + { 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_D7), MP_ROM_PTR(&pin_GPIO7) }, + { 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_D21), MP_ROM_PTR(&pin_GPIO21) }, + + { MP_ROM_QSTR(MP_QSTR_LED_RED), MP_ROM_PTR(&pin_GPIO16) }, + { MP_ROM_QSTR(MP_QSTR_LED_GREEN), MP_ROM_PTR(&pin_GPIO17) }, + { MP_ROM_QSTR(MP_QSTR_LED_BLUE), MP_ROM_PTR(&pin_GPIO18) }, + { MP_ROM_QSTR(MP_QSTR_LED), 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_DEFINE_CONST_DICT(board_module_globals, board_module_globals_table); diff --git a/ports/raspberrypi/boards/raspberry_pi_pico/mpconfigboard.h b/ports/raspberrypi/boards/raspberry_pi_pico/mpconfigboard.h index 4714241999..548af930ba 100644 --- a/ports/raspberrypi/boards/raspberry_pi_pico/mpconfigboard.h +++ b/ports/raspberrypi/boards/raspberry_pi_pico/mpconfigboard.h @@ -1,5 +1,7 @@ #define MICROPY_HW_BOARD_NAME "Raspberry Pi Pico" #define MICROPY_HW_MCU_NAME "rp2040" +#define MICROPY_HW_LED_STATUS (&pin_GPIO25) + #define CIRCUITPY_BOARD_I2C (1) #define CIRCUITPY_BOARD_I2C_PIN {{.scl = &pin_GPIO5, .sda = &pin_GPIO4}} diff --git a/ports/raspberrypi/boards/raspberry_pi_pico_w/mpconfigboard.h b/ports/raspberrypi/boards/raspberry_pi_pico_w/mpconfigboard.h index e5d8660b2b..a31ee7327c 100644 --- a/ports/raspberrypi/boards/raspberry_pi_pico_w/mpconfigboard.h +++ b/ports/raspberrypi/boards/raspberry_pi_pico_w/mpconfigboard.h @@ -4,5 +4,7 @@ #define CIRCUITPY_DIGITALIO_HAVE_INVALID_PULL (1) #define CIRCUITPY_DIGITALIO_HAVE_INVALID_DRIVE_MODE (1) +#define MICROPY_HW_LED_STATUS (&pin_CYW0) + #define CIRCUITPY_BOARD_I2C (1) #define CIRCUITPY_BOARD_I2C_PIN {{.scl = &pin_GPIO5, .sda = &pin_GPIO4}} diff --git a/ports/raspberrypi/boards/raspberry_pi_pico_w/mpconfigboard.mk b/ports/raspberrypi/boards/raspberry_pi_pico_w/mpconfigboard.mk index 9773755649..a050391505 100644 --- a/ports/raspberrypi/boards/raspberry_pi_pico_w/mpconfigboard.mk +++ b/ports/raspberrypi/boards/raspberry_pi_pico_w/mpconfigboard.mk @@ -14,8 +14,8 @@ CIRCUITPY_CYW43 = 1 CIRCUITPY_SSL = 1 CIRCUITPY_SSL_MBEDTLS = 1 CIRCUITPY_HASHLIB = 1 -CIRCUITPY_WEB_WORKFLOW = 0 -CIRCUITPY_MDNS = 0 +CIRCUITPY_WEB_WORKFLOW = 1 +CIRCUITPY_MDNS = 1 CIRCUITPY_SOCKETPOOL = 1 CIRCUITPY_WIFI = 1 diff --git a/ports/raspberrypi/boards/waveshare_rp2040_lcd_1_28/board.c b/ports/raspberrypi/boards/waveshare_rp2040_lcd_1_28/board.c new file mode 100644 index 0000000000..331653173e --- /dev/null +++ b/ports/raspberrypi/boards/waveshare_rp2040_lcd_1_28/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/waveshare_rp2040_lcd_1_28/mpconfigboard.h b/ports/raspberrypi/boards/waveshare_rp2040_lcd_1_28/mpconfigboard.h new file mode 100644 index 0000000000..db90970b7f --- /dev/null +++ b/ports/raspberrypi/boards/waveshare_rp2040_lcd_1_28/mpconfigboard.h @@ -0,0 +1,2 @@ +#define MICROPY_HW_BOARD_NAME "Waveshare RP2040-LCD-1.28" +#define MICROPY_HW_MCU_NAME "rp2040" diff --git a/ports/raspberrypi/boards/waveshare_rp2040_lcd_1_28/mpconfigboard.mk b/ports/raspberrypi/boards/waveshare_rp2040_lcd_1_28/mpconfigboard.mk new file mode 100644 index 0000000000..8c5c9f5f50 --- /dev/null +++ b/ports/raspberrypi/boards/waveshare_rp2040_lcd_1_28/mpconfigboard.mk @@ -0,0 +1,17 @@ +USB_VID = 0x2E8A +USB_PID = 0x1039 +USB_PRODUCT = "Waveshare RP2040-LCD-1.28" +USB_MANUFACTURER = "Waveshare Electronics" + +CHIP_VARIANT = RP2040 +CHIP_FAMILY = rp2 + +EXTERNAL_FLASH_DEVICES = "W25Q32JVxQ" + +CIRCUITPY__EVE = 1 + +# TODO: Add custom QMI8658 driver +# FROZEN_MPY_DIRS += $(TOP)/frozen/circuitpython_qmi8658 + +# TODO: Add custom GC9A01 driver +# FROZEN_MPY_DIRS += $(TOP)/frozen/circuitpython_gc9a01 diff --git a/ports/raspberrypi/boards/waveshare_rp2040_lcd_1_28/pico-sdk-configboard.h b/ports/raspberrypi/boards/waveshare_rp2040_lcd_1_28/pico-sdk-configboard.h new file mode 100644 index 0000000000..36da55d457 --- /dev/null +++ b/ports/raspberrypi/boards/waveshare_rp2040_lcd_1_28/pico-sdk-configboard.h @@ -0,0 +1 @@ +// Put board-specific pico-sdk definitions here. This file must exist. diff --git a/ports/raspberrypi/boards/waveshare_rp2040_lcd_1_28/pins.c b/ports/raspberrypi/boards/waveshare_rp2040_lcd_1_28/pins.c new file mode 100644 index 0000000000..9153e8f78a --- /dev/null +++ b/ports/raspberrypi/boards/waveshare_rp2040_lcd_1_28/pins.c @@ -0,0 +1,70 @@ +#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_IMU_SDA), MP_ROM_PTR(&pin_GPIO6) }, + { MP_ROM_QSTR(MP_QSTR_GP6), MP_ROM_PTR(&pin_GPIO6) }, + + { MP_ROM_QSTR(MP_QSTR_IMU_SCL), MP_ROM_PTR(&pin_GPIO7) }, + { MP_ROM_QSTR(MP_QSTR_GP7), MP_ROM_PTR(&pin_GPIO7) }, + + { MP_ROM_QSTR(MP_QSTR_LCD_DC), MP_ROM_PTR(&pin_GPIO8) }, + { MP_ROM_QSTR(MP_QSTR_GP8), MP_ROM_PTR(&pin_GPIO8) }, + + { MP_ROM_QSTR(MP_QSTR_LCD_CS), MP_ROM_PTR(&pin_GPIO9) }, + { MP_ROM_QSTR(MP_QSTR_GP9), MP_ROM_PTR(&pin_GPIO9) }, + + { MP_ROM_QSTR(MP_QSTR_LCD_CLK), MP_ROM_PTR(&pin_GPIO10) }, + { MP_ROM_QSTR(MP_QSTR_GP10), MP_ROM_PTR(&pin_GPIO10) }, + + { MP_ROM_QSTR(MP_QSTR_LCD_DIN), MP_ROM_PTR(&pin_GPIO11) }, + { MP_ROM_QSTR(MP_QSTR_GP11), MP_ROM_PTR(&pin_GPIO11) }, + + { MP_ROM_QSTR(MP_QSTR_LCD_RST), MP_ROM_PTR(&pin_GPIO12) }, + { 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_IMU_INT1), MP_ROM_PTR(&pin_GPIO23) }, + { MP_ROM_QSTR(MP_QSTR_GP23), MP_ROM_PTR(&pin_GPIO23) }, + + { MP_ROM_QSTR(MP_QSTR_IMU_INT2), MP_ROM_PTR(&pin_GPIO24) }, + { MP_ROM_QSTR(MP_QSTR_GP24), MP_ROM_PTR(&pin_GPIO24) }, + + { MP_ROM_QSTR(MP_QSTR_LCD_BL), 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_BAT_ADC), MP_ROM_PTR(&pin_GPIO29) }, // Battery voltage readout, 0.50 bias +}; +MP_DEFINE_CONST_DICT(board_module_globals, board_module_globals_table); diff --git a/ports/raspberrypi/common-hal/alarm/SleepMemory.c b/ports/raspberrypi/common-hal/alarm/SleepMemory.c index c1765296dc..1f0dddfc51 100644 --- a/ports/raspberrypi/common-hal/alarm/SleepMemory.c +++ b/ports/raspberrypi/common-hal/alarm/SleepMemory.c @@ -34,7 +34,6 @@ void alarm_sleep_memory_reset(void) { } uint32_t common_hal_alarm_sleep_memory_get_length(alarm_sleep_memory_obj_t *self) { - mp_raise_NotImplementedError(translate("Sleep Memory not available")); return 0; } diff --git a/ports/raspberrypi/common-hal/analogbufio/BufferedIn.c b/ports/raspberrypi/common-hal/analogbufio/BufferedIn.c index 951c07af03..bc5f9028b7 100644 --- a/ports/raspberrypi/common-hal/analogbufio/BufferedIn.c +++ b/ports/raspberrypi/common-hal/analogbufio/BufferedIn.c @@ -33,6 +33,7 @@ #include "common-hal/analogbufio/BufferedIn.h" #include "shared-bindings/analogbufio/BufferedIn.h" #include "shared-bindings/microcontroller/Pin.h" +#include "shared/runtime/interrupt_char.h" #include "py/runtime.h" #include "supervisor/shared/translate/translate.h" #include "src/rp2_common/hardware_adc/include/hardware/adc.h" @@ -42,13 +43,18 @@ #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) { +#define ADC_CLOCK_INPUT 48000000 +#define ADC_MAX_CLOCK_DIV (1 << (ADC_DIV_INT_MSB - ADC_DIV_INT_LSB + 1)) +void common_hal_analogbufio_bufferedin_construct(analogbufio_bufferedin_obj_t *self, const mcu_pin_obj_t *pin, 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(); } + // Validate sample rate here + sample_rate = (uint32_t)mp_arg_validate_int_range(sample_rate, ADC_CLOCK_INPUT / ADC_MAX_CLOCK_DIV, ADC_CLOCK_INPUT / 96, MP_QSTR_sample_rate); + // Set pin and channel self->pin = pin; claim_pin(pin); @@ -56,45 +62,13 @@ void common_hal_analogbufio_bufferedin_construct(analogbufio_bufferedin_obj_t *s // 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. + // TODO: Make sure we share the ADC well. Right now we just assume it is + // unused. 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 @@ -104,7 +78,8 @@ void common_hal_analogbufio_bufferedin_construct(analogbufio_bufferedin_obj_t *s // 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); + float clk_div = (float)ADC_CLOCK_INPUT / (float)sample_rate; + adc_set_clkdiv(clk_div); // Set up the DMA to start transferring data as soon as it appears in FIFO uint dma_chan = dma_claim_unused_channel(true); @@ -114,7 +89,6 @@ void common_hal_analogbufio_bufferedin_construct(analogbufio_bufferedin_obj_t *s 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); @@ -143,14 +117,38 @@ void common_hal_analogbufio_bufferedin_deinit(analogbufio_bufferedin_obj_t *self dma_channel_unclaim(self->dma_chan); } -void common_hal_analogbufio_bufferedin_read(analogbufio_bufferedin_obj_t *self) { +uint32_t common_hal_analogbufio_bufferedin_readinto(analogbufio_bufferedin_obj_t *self, uint8_t *buffer, uint32_t len, uint8_t bytes_per_sample) { + // 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 12-bit and error bit is present. We + // stretch the 12-bit value to 16-bits and truncate the number of valid + // samples at the first sample with the error bit set. + // Number of transfers is always the number of samples which is the array + // byte length divided by the bytes_per_sample. + uint dma_size = DMA_SIZE_8; + bool show_error_bit = false; + if (bytes_per_sample == 2) { + dma_size = DMA_SIZE_16; + show_error_bit = true; + } - uint32_t cdl = self->len / self->bytes_per_sample; + 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 + bytes_per_sample == 1 // Shift each sample to 8 bits when pushing to FIFO + ); + + uint32_t sample_count = len / bytes_per_sample; + + channel_config_set_transfer_data_size(&(self->cfg), dma_size); dma_channel_configure(self->dma_chan, &(self->cfg), - self->buffer, // dst + buffer, // dst &adc_hw->fifo, // src - cdl, // transfer count + sample_count, // transfer count true // start immediately ); @@ -159,9 +157,34 @@ void common_hal_analogbufio_bufferedin_read(analogbufio_bufferedin_obj_t *self) // 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); + uint32_t remaining_transfers = sample_count; + while (dma_channel_is_busy(self->dma_chan) && + !mp_hal_is_interrupted()) { + RUN_BACKGROUND_TASKS; + } + remaining_transfers = dma_channel_hw_addr(self->dma_chan)->transfer_count; // Clean up adc_run(false); + // Stopping early so abort. + if (dma_channel_is_busy(self->dma_chan)) { + dma_channel_abort(self->dma_chan); + } adc_fifo_drain(); + + size_t captured_count = sample_count - remaining_transfers; + if (dma_size == DMA_SIZE_16) { + uint16_t *buf16 = (uint16_t *)buffer; + for (size_t i = 0; i < captured_count; i++) { + uint16_t value = buf16[i]; + // Check the error bit and "truncate" the buffer if there is an error. + if ((value & ADC_FIFO_ERR_BITS) != 0) { + captured_count = i; + break; + } + // Scale the values to the standard 16 bit range. + buf16[i] = (value << 4) | (value >> 8); + } + } + return captured_count; } diff --git a/ports/raspberrypi/common-hal/analogbufio/BufferedIn.h b/ports/raspberrypi/common-hal/analogbufio/BufferedIn.h index 8b183a1d70..8ed4cf3a2c 100644 --- a/ports/raspberrypi/common-hal/analogbufio/BufferedIn.h +++ b/ports/raspberrypi/common-hal/analogbufio/BufferedIn.h @@ -41,16 +41,9 @@ 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/analogio/AnalogIn.c b/ports/raspberrypi/common-hal/analogio/AnalogIn.c index 8811cd54e4..afa31e3c83 100644 --- a/ports/raspberrypi/common-hal/analogio/AnalogIn.c +++ b/ports/raspberrypi/common-hal/analogio/AnalogIn.c @@ -44,7 +44,7 @@ #define SPECIAL_PIN(pin) (pin->number == 29) const mcu_pin_obj_t *common_hal_analogio_analogin_validate_pin(mp_obj_t obj) { - return validate_obj_is_free_pin_or_gpio29(obj); + return validate_obj_is_free_pin_or_gpio29(obj, MP_QSTR_pin); } #else #define SPECIAL_PIN(pin) false diff --git a/ports/raspberrypi/common-hal/busio/UART.c b/ports/raspberrypi/common-hal/busio/UART.c index 4212249ec9..156a5e11ce 100644 --- a/ports/raspberrypi/common-hal/busio/UART.c +++ b/ports/raspberrypi/common-hal/busio/UART.c @@ -111,7 +111,7 @@ void common_hal_busio_uart_construct(busio_uart_obj_t *self, uint8_t uart_id = ((((tx != NULL) ? tx->number : rx->number) + 4) / 8) % NUM_UARTS; if (uart_status[uart_id] != STATUS_FREE) { - mp_raise_RuntimeError(translate("All UART peripherals are in use")); + mp_raise_ValueError(translate("UART peripheral in use")); } // These may raise exceptions if pins are already in use. self->tx_pin = pin_init(uart_id, tx, 0); @@ -339,3 +339,18 @@ bool common_hal_busio_uart_ready_to_tx(busio_uart_obj_t *self) { } return uart_is_writable(self->uart); } + +STATIC void pin_never_reset(uint8_t pin) { + if (pin != NO_PIN) { + never_reset_pin_number(pin); + } +} + +void common_hal_busio_uart_never_reset(busio_uart_obj_t *self) { + never_reset_uart(self->uart_id); + pin_never_reset(self->tx_pin); + pin_never_reset(self->rx_pin); + pin_never_reset(self->cts_pin); + pin_never_reset(self->rs485_dir_pin); + pin_never_reset(self->rts_pin); +} diff --git a/ports/raspberrypi/common-hal/digitalio/DigitalInOut.c b/ports/raspberrypi/common-hal/digitalio/DigitalInOut.c index eb498d3f19..d90c0db81b 100644 --- a/ports/raspberrypi/common-hal/digitalio/DigitalInOut.c +++ b/ports/raspberrypi/common-hal/digitalio/DigitalInOut.c @@ -43,7 +43,7 @@ #define IS_CYW(self) ((self)->pin->base.type == &cyw43_pin_type) const mcu_pin_obj_t *common_hal_digitalio_validate_pin(mp_obj_t obj) { - return validate_obj_is_free_pin_including_cyw43(obj); + return validate_obj_is_free_pin_including_cyw43(obj, MP_QSTR_pin); } #endif diff --git a/ports/raspberrypi/common-hal/mdns/RemoteService.c b/ports/raspberrypi/common-hal/mdns/RemoteService.c new file mode 100644 index 0000000000..071a9c1648 --- /dev/null +++ b/ports/raspberrypi/common-hal/mdns/RemoteService.c @@ -0,0 +1,64 @@ +/* + * 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/mdns/RemoteService.h" + +#include "shared-bindings/ipaddress/IPv4Address.h" + +const char *common_hal_mdns_remoteservice_get_service_type(mdns_remoteservice_obj_t *self) { + return self->service_name; +} + +const char *common_hal_mdns_remoteservice_get_protocol(mdns_remoteservice_obj_t *self) { + return self->protocol; +} + +const char *common_hal_mdns_remoteservice_get_instance_name(mdns_remoteservice_obj_t *self) { + return self->instance_name; +} + +const char *common_hal_mdns_remoteservice_get_hostname(mdns_remoteservice_obj_t *self) { + return self->hostname; +} + +mp_int_t common_hal_mdns_remoteservice_get_port(mdns_remoteservice_obj_t *self) { + return self->port; +} + +uint32_t mdns_remoteservice_get_ipv4_address(mdns_remoteservice_obj_t *self) { + return self->ipv4_address; +} + +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) { +} diff --git a/ports/raspberrypi/common-hal/mdns/RemoteService.h b/ports/raspberrypi/common-hal/mdns/RemoteService.h new file mode 100644 index 0000000000..06814f0fbb --- /dev/null +++ b/ports/raspberrypi/common-hal/mdns/RemoteService.h @@ -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. + */ + +#pragma once + +#include "lwip/apps/mdns.h" + +typedef struct { + mp_obj_base_t base; + uint32_t ipv4_address; + uint16_t port; + char protocol[5]; // RFC 6763 Section 7.2 - 4 bytes + 1 for NUL + char service_name[17]; // RFC 6763 Section 7.2 - 16 bytes + 1 for NUL + char instance_name[64]; // RFC 6763 Section 7.2 - 63 bytes + 1 for NUL + char hostname[64]; // RFC 6762 Appendix A - 63 bytes for label + 1 for NUL + mp_obj_t next; +} mdns_remoteservice_obj_t; diff --git a/ports/raspberrypi/common-hal/mdns/Server.c b/ports/raspberrypi/common-hal/mdns/Server.c new file mode 100644 index 0000000000..ab0a7079af --- /dev/null +++ b/ports/raspberrypi/common-hal/mdns/Server.c @@ -0,0 +1,322 @@ +/* + * 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/mdns/Server.h" + +#include "py/gc.h" +#include "py/runtime.h" +#include "shared/runtime/interrupt_char.h" +#include "shared-bindings/mdns/RemoteService.h" +#include "shared-bindings/wifi/__init__.h" +#include "supervisor/shared/tick.h" + +#include "lwip/apps/mdns.h" +#include "lwip/prot/dns.h" + +// Track if we've inited the LWIP MDNS at all. It expects to only init once. +// Subsequent times, we restart it. +STATIC bool inited = false; +// Track if we are globally inited. This essentially forces one inited MDNS +// object at a time. (But ignores MDNS objects that are deinited.) +STATIC bool object_inited = false; + +#define NETIF_STA (&cyw43_state.netif[CYW43_ITF_STA]) +#define NETIF_AP (&cyw43_state.netif[CYW43_ITF_AP]) + +void mdns_server_construct(mdns_server_obj_t *self, bool workflow) { + if (object_inited) { + // Mark the object as deinit since another is already using MDNS. + self->inited = false; + return; + } + + if (!inited) { + mdns_resp_init(); + inited = true; + } else { + mdns_resp_restart(NETIF_STA); + } + self->inited = true; + + uint8_t mac[6]; + wifi_radio_get_mac_address(&common_hal_wifi_radio_obj, mac); + 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); + + if (workflow) { + // Add a second host entry to respond to "circuitpython.local" queries as well. + + #if MDNS_MAX_SECONDARY_HOSTNAMES > 0 + mdns_resp_add_secondary_hostname(NETIF_STA, "circuitpython"); + #endif + } +} + +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 (object_inited) { + mp_raise_RuntimeError(translate("mDNS already initialized")); + } + mdns_server_construct(self, false); +} + +void common_hal_mdns_server_deinit(mdns_server_obj_t *self) { + if (common_hal_mdns_server_deinited(self)) { + return; + } + self->inited = false; + object_inited = false; + mdns_resp_remove_netif(NETIF_STA); +} + +bool common_hal_mdns_server_deinited(mdns_server_obj_t *self) { + return !self->inited; +} + +const char *common_hal_mdns_server_get_hostname(mdns_server_obj_t *self) { + return self->hostname; +} + +void common_hal_mdns_server_set_hostname(mdns_server_obj_t *self, const char *hostname) { + if (mdns_resp_netif_active(NETIF_STA)) { + mdns_resp_rename_netif(NETIF_STA, hostname); + } else { + mdns_resp_add_netif(NETIF_STA, hostname); + } + + self->hostname = hostname; +} + +const char *common_hal_mdns_server_get_instance_name(mdns_server_obj_t *self) { + return self->instance_name; +} + +void common_hal_mdns_server_set_instance_name(mdns_server_obj_t *self, const char *instance_name) { + self->instance_name = instance_name; +} + +typedef struct { + uint8_t request_id; + size_t i; + mdns_remoteservice_obj_t *out; + size_t out_len; +} nonalloc_search_state_t; + +STATIC void copy_data_into_remote_service(struct mdns_answer *answer, const char *varpart, int varlen, mdns_remoteservice_obj_t *out) { + if (varlen > 0) { + if (answer->info.type == DNS_RRTYPE_A) { + char *hostname = out->hostname; + size_t len = MIN(63, answer->info.domain.name[0]); + memcpy(hostname, answer->info.domain.name + 1, len); + hostname[len] = '\0'; + out->ipv4_address = varpart[0] | varpart[1] << 8 | varpart[2] << 16 | varpart[3] << 24; + } + if (answer->info.type == DNS_RRTYPE_SRV) { + // This isn't a null terminated string. Its length encoded. + uint8_t *domain = answer->info.domain.name; + char *instance_name = out->instance_name; + size_t offset = 0; + uint8_t iname_len = domain[offset++]; + size_t len = MIN(63, iname_len); + memcpy(instance_name, domain + offset, len); + offset += iname_len; + instance_name[len] = '\0'; + + uint8_t sn_len = domain[offset++]; + char *service_name = out->service_name; + len = MIN(16, sn_len); + memcpy(service_name, domain + offset, len); + offset += sn_len; + service_name[len] = '\0'; + + uint8_t proto_len = domain[offset++]; + char *protocol = out->protocol; + len = MIN(4, proto_len); + memcpy(protocol, domain + offset, len); + offset += proto_len; + protocol[len] = '\0'; + + out->port = varpart[4] << 8 | varpart[5]; + } + } +} + +STATIC void search_result_cb(struct mdns_answer *answer, const char *varpart, int varlen, int flags, void *arg) { + nonalloc_search_state_t *state = arg; + state->out[state->i].base.type = &mdns_remoteservice_type; + + copy_data_into_remote_service(answer, varpart, varlen, &state->out[state->i]); + + if ((flags & MDNS_SEARCH_RESULT_LAST) != 0) { + state->i += 1; + } + + if (state->i == state->out_len) { + mdns_search_stop(state->request_id); + state->request_id = MDNS_MAX_REQUESTS; + } +} + +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) { + + enum mdns_sd_proto proto = DNSSD_PROTO_UDP; + if (strcmp(protocol, "_tcp") == 0) { + proto = DNSSD_PROTO_TCP; + } + + nonalloc_search_state_t state; + state.i = 0; + state.out = out; + state.out_len = out_len; + + err_t err = mdns_search_service(NULL, service_type, proto, + NETIF_STA, &search_result_cb, &state, + &state.request_id); + if (err != ERR_OK) { + return 0; + } + + uint64_t start_ticks = supervisor_ticks_ms64(); + uint64_t timeout_ms = timeout * 1000; + + while (state.request_id < MDNS_MAX_REQUESTS && + !mp_hal_is_interrupted() && + supervisor_ticks_ms64() - start_ticks < timeout_ms) { + RUN_BACKGROUND_TASKS; + } + if (state.request_id < MDNS_MAX_REQUESTS) { + mdns_search_stop(state.request_id); + state.request_id = MDNS_MAX_REQUESTS; + } + + return state.i; +} + +typedef struct { + uint8_t request_id; + mdns_remoteservice_obj_t *head; + size_t count; +} alloc_search_state_t; + +STATIC void alloc_search_result_cb(struct mdns_answer *answer, const char *varpart, int varlen, int flags, void *arg) { + alloc_search_state_t *state = arg; + + if ((flags & MDNS_SEARCH_RESULT_FIRST) != 0) { + // first + mdns_remoteservice_obj_t *service = gc_alloc(sizeof(mdns_remoteservice_obj_t), 0, false); + if (service == NULL) { + // alloc fails + mdns_search_stop(state->request_id); + state->request_id = MDNS_MAX_REQUESTS; + if (state->count == 0) { + m_malloc_fail(sizeof(mdns_remoteservice_obj_t)); + } + return; + } + service->base.type = &mdns_remoteservice_type; + state->count++; + service->next = state->head; + state->head = service; + } + + copy_data_into_remote_service(answer, varpart, varlen, state->head); +} + +mp_obj_t common_hal_mdns_server_find(mdns_server_obj_t *self, const char *service_type, const char *protocol, mp_float_t timeout) { + enum mdns_sd_proto proto = DNSSD_PROTO_UDP; + if (strcmp(protocol, "_tcp") == 0) { + proto = DNSSD_PROTO_TCP; + } + + alloc_search_state_t state; + state.count = 0; + state.head = NULL; + + err_t err = mdns_search_service(NULL, service_type, proto, + NETIF_STA, &alloc_search_result_cb, &state, + &state.request_id); + if (err != ERR_OK) { + mp_raise_RuntimeError(translate("Unable to start mDNS query")); + } + + uint64_t start_ticks = supervisor_ticks_ms64(); + uint64_t timeout_ms = timeout * 1000; + + while (state.request_id < MDNS_MAX_REQUESTS && + !mp_hal_is_interrupted() && + supervisor_ticks_ms64() - start_ticks < timeout_ms) { + RUN_BACKGROUND_TASKS; + } + if (state.request_id < MDNS_MAX_REQUESTS) { + mdns_search_stop(state.request_id); + state.request_id = MDNS_MAX_REQUESTS; + } + + mp_obj_tuple_t *tuple = MP_OBJ_TO_PTR(mp_obj_new_tuple(state.count, NULL)); + mdns_remoteservice_obj_t *next = state.head; + uint8_t added = 0; + while (next != NULL) { + mdns_remoteservice_obj_t *cur = next; + tuple->items[added] = MP_OBJ_FROM_PTR(cur); + next = cur->next; + // Set next back to NULL so that each service object is independently + // tracked for GC. + cur->next = NULL; + added++; + } + + return MP_OBJ_FROM_PTR(tuple); +} + +void common_hal_mdns_server_advertise_service(mdns_server_obj_t *self, const char *service_type, const char *protocol, mp_int_t port) { + enum mdns_sd_proto proto = DNSSD_PROTO_UDP; + if (strcmp(protocol, "_tcp") == 0) { + proto = DNSSD_PROTO_TCP; + } + // Remove the existing service if it was already added. + int8_t existing_slot = MDNS_MAX_SERVICES; + for (int i = 0; i < MDNS_MAX_SERVICES; i++) { + if (self->service_type[i] != NULL && + (service_type == self->service_type[i] || + strcmp(service_type, self->service_type[i]) == 0)) { + existing_slot = i; + break; + } + } + if (existing_slot < MDNS_MAX_SERVICES) { + mdns_resp_del_service(NETIF_STA, existing_slot); + } + int8_t slot = mdns_resp_add_service(NETIF_STA, self->instance_name, service_type, proto, port, NULL, NULL); + if (slot < 0) { + mp_raise_RuntimeError(translate("Out of MDNS service slots")); + return; + } + self->service_type[slot] = service_type; +} diff --git a/ports/raspberrypi/common-hal/mdns/Server.h b/ports/raspberrypi/common-hal/mdns/Server.h new file mode 100644 index 0000000000..a4dab8aa06 --- /dev/null +++ b/ports/raspberrypi/common-hal/mdns/Server.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. + */ + +#pragma once + +#include "py/obj.h" + +#include "lwip/apps/mdns_opts.h" + +typedef struct { + mp_obj_base_t base; + const char *hostname; + const char *instance_name; + char default_hostname[sizeof("cpy-XXXXXX")]; + const char *service_type[MDNS_MAX_SERVICES]; + // Track if this object owns access to the underlying MDNS service. + bool inited; +} mdns_server_obj_t; diff --git a/ports/raspberrypi/common-hal/mdns/__init__.c b/ports/raspberrypi/common-hal/mdns/__init__.c new file mode 100644 index 0000000000..57740777c8 --- /dev/null +++ b/ports/raspberrypi/common-hal/mdns/__init__.c @@ -0,0 +1 @@ +// No mdns module functions. diff --git a/ports/raspberrypi/common-hal/microcontroller/Processor.c b/ports/raspberrypi/common-hal/microcontroller/Processor.c index 8c5bc7ba75..b22d385eec 100644 --- a/ports/raspberrypi/common-hal/microcontroller/Processor.c +++ b/ports/raspberrypi/common-hal/microcontroller/Processor.c @@ -34,6 +34,7 @@ #include "src/rp2_common/hardware_adc/include/hardware/adc.h" #include "src/rp2_common/hardware_clocks/include/hardware/clocks.h" +#include "src/rp2_common/hardware_watchdog/include/hardware/watchdog.h" #include "src/rp2040/hardware_regs/include/hardware/regs/vreg_and_chip_reset.h" #include "src/rp2040/hardware_regs/include/hardware/regs/watchdog.h" @@ -68,7 +69,6 @@ void common_hal_mcu_processor_get_uid(uint8_t raw_id[]) { mcu_reset_reason_t common_hal_mcu_processor_get_reset_reason(void) { mcu_reset_reason_t reason = RESET_REASON_UNKNOWN; - uint32_t watchdog_reset_reg = watchdog_hw->reason; uint32_t chip_reset_reg = vreg_and_chip_reset_hw->chip_reset; if (chip_reset_reg & VREG_AND_CHIP_RESET_CHIP_RESET_HAD_PSM_RESTART_BITS) { @@ -86,13 +86,14 @@ mcu_reset_reason_t common_hal_mcu_processor_get_reset_reason(void) { // Check watchdog after chip reset since watchdog doesn't clear chip_reset, while chip_reset clears the watchdog - if (watchdog_reset_reg & WATCHDOG_REASON_TIMER_BITS) { - // This bit can also be set during a software reset because the pico-sdk performs a software reset by setting an extremely low timeout on the watchdog, rather than triggering a watchdog reset manually - reason = RESET_REASON_WATCHDOG; + // The watchdog is used for software reboots such as resetting after copying a UF2 via the bootloader. + if (watchdog_caused_reboot()) { + reason = RESET_REASON_SOFTWARE; } - if (watchdog_reset_reg & WATCHDOG_REASON_FORCE_BITS) { - reason = RESET_REASON_SOFTWARE; + // Actual watchdog usage will set a special value that this function detects. + if (watchdog_enable_caused_reboot()) { + reason = RESET_REASON_WATCHDOG; } return reason; diff --git a/ports/raspberrypi/common-hal/microcontroller/__init__.c b/ports/raspberrypi/common-hal/microcontroller/__init__.c index 327799a6e7..6d9b3d7fa0 100644 --- a/ports/raspberrypi/common-hal/microcontroller/__init__.c +++ b/ports/raspberrypi/common-hal/microcontroller/__init__.c @@ -60,7 +60,7 @@ void common_hal_mcu_disable_interrupts(void) { void common_hal_mcu_enable_interrupts(void) { if (nesting_count == 0) { - // reset_into_safe_mode(LOCKING_ERROR); + // reset_into_safe_mode(SAFE_MODE_INTERRUPT_ERROR); } nesting_count--; if (nesting_count > 0) { @@ -79,7 +79,7 @@ void common_hal_mcu_on_next_reset(mcu_runmode_t runmode) { next_reset_to_bootloader = true; break; case RUNMODE_SAFE_MODE: - safe_mode_on_next_reset(PROGRAMMATIC_SAFE_MODE); + safe_mode_on_next_reset(SAFE_MODE_PROGRAMMATIC); break; default: break; diff --git a/ports/raspberrypi/common-hal/pwmio/PWMOut.c b/ports/raspberrypi/common-hal/pwmio/PWMOut.c index e6f88f8894..f75c4b3451 100644 --- a/ports/raspberrypi/common-hal/pwmio/PWMOut.c +++ b/ports/raspberrypi/common-hal/pwmio/PWMOut.c @@ -236,14 +236,6 @@ extern void common_hal_pwmio_pwmout_set_duty_cycle(pwmio_pwmout_obj_t *self, uin } // compare_count is the CC register value, which should be TOP+1 for 100% duty cycle. pwm_set_chan_level(self->slice, self->ab_channel, compare_count); - // Wait for wrap so that we know our new cc value has been applied. Clear - // the internal interrupt and then wait for it to be set. Worst case, we - // wait a full cycle. - pwm_hw->intr = 1 << self->slice; - while ((pwm_hw->en & (1 << self->slice)) != 0 && - (pwm_hw->intr & (1 << self->slice)) == 0 && - !mp_hal_is_interrupted()) { - } } uint16_t common_hal_pwmio_pwmout_get_duty_cycle(pwmio_pwmout_obj_t *self) { diff --git a/ports/raspberrypi/common-hal/rotaryio/IncrementalEncoder.c b/ports/raspberrypi/common-hal/rotaryio/IncrementalEncoder.c index 0da12e5923..7cb4c84382 100644 --- a/ports/raspberrypi/common-hal/rotaryio/IncrementalEncoder.c +++ b/ports/raspberrypi/common-hal/rotaryio/IncrementalEncoder.c @@ -61,12 +61,13 @@ STATIC void incrementalencoder_interrupt_handler(void *self_in); 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) { - mp_obj_t pins[] = {MP_OBJ_FROM_PTR(pin_a), MP_OBJ_FROM_PTR(pin_b)}; + const mcu_pin_obj_t *pins[] = { pin_a, pin_b }; + // Start out with swapped to match behavior with other ports. self->swapped = true; if (!common_hal_rp2pio_pins_are_sequential(2, pins)) { - pins[0] = MP_OBJ_FROM_PTR(pin_b); - pins[1] = MP_OBJ_FROM_PTR(pin_a); + pins[0] = pin_b; + pins[1] = pin_a; self->swapped = false; if (!common_hal_rp2pio_pins_are_sequential(2, pins)) { mp_raise_RuntimeError(translate("Pins must be sequential GPIO pins")); diff --git a/ports/raspberrypi/common-hal/rp2pio/StateMachine.c b/ports/raspberrypi/common-hal/rp2pio/StateMachine.c index ecaee90cc2..e9cb3d34bb 100644 --- a/ports/raspberrypi/common-hal/rp2pio/StateMachine.c +++ b/ports/raspberrypi/common-hal/rp2pio/StateMachine.c @@ -289,6 +289,11 @@ bool rp2pio_statemachine_construct(rp2pio_statemachine_obj_t *self, } pio_gpio_init(self->pio, pin_number); } + + // Use lowest drive level for all State Machine outputs. (#7515 + // workaround). Remove if/when Pin objects get a drive_strength + // property and use that value instead. + gpio_set_drive_strength(pin_number, GPIO_DRIVE_STRENGTH_2MA); } pio_sm_config c = {0, 0, 0}; diff --git a/ports/raspberrypi/common-hal/rp2pio/__init__.c b/ports/raspberrypi/common-hal/rp2pio/__init__.c index 61a77e021c..7634001c98 100644 --- a/ports/raspberrypi/common-hal/rp2pio/__init__.c +++ b/ports/raspberrypi/common-hal/rp2pio/__init__.c @@ -28,13 +28,13 @@ #include "shared-bindings/microcontroller/Pin.h" #include "bindings/rp2pio/__init__.h" -bool common_hal_rp2pio_pins_are_sequential(size_t len, mp_obj_t *items) { +bool common_hal_rp2pio_pins_are_sequential(size_t len, const mcu_pin_obj_t **pins) { if (len == 0) { return true; } - const mcu_pin_obj_t *last_pin = validate_obj_is_pin(items[0]); + const mcu_pin_obj_t *last_pin = pins[0]; for (size_t i = 1; i < len; i++) { - const mcu_pin_obj_t *pin = validate_obj_is_pin(items[i]); + const mcu_pin_obj_t *pin = pins[i]; if (pin->number != last_pin->number + 1) { return false; } diff --git a/ports/raspberrypi/common-hal/socketpool/Socket.c b/ports/raspberrypi/common-hal/socketpool/Socket.c index 440fe56d42..fe12f461fb 100644 --- a/ports/raspberrypi/common-hal/socketpool/Socket.c +++ b/ports/raspberrypi/common-hal/socketpool/Socket.c @@ -166,6 +166,7 @@ static inline void exec_user_callback(socketpool_socket_obj_t *socket) { mp_sched_schedule(socket->callback, MP_OBJ_FROM_PTR(socket)); } #endif + supervisor_workflow_request_background(); } #if MICROPY_PY_LWIP_SOCK_RAW @@ -745,57 +746,47 @@ socketpool_socket_obj_t *common_hal_socketpool_socket(socketpool_socketpool_obj_ 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); +int socketpool_socket_accept(socketpool_socket_obj_t *self, uint8_t *ip, uint32_t *port, socketpool_socket_obj_t *accepted) { + if (self->type != MOD_NETWORK_SOCK_STREAM) { + return -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; + if (common_hal_socketpool_socket_get_closed(self)) { + return -MP_EBADF; + } MICROPY_PY_LWIP_ENTER - if (socket->pcb.tcp == NULL) { + if (self->pcb.tcp == NULL) { MICROPY_PY_LWIP_EXIT - m_del_obj(socketpool_socket_obj_t, socket2); - mp_raise_OSError(MP_EBADF); + return -MP_EBADF; } // I need to do this because "tcp_accepted", later, is a macro. - struct tcp_pcb *listener = socket->pcb.tcp; + struct tcp_pcb *listener = self->pcb.tcp; if (listener->state != LISTEN) { MICROPY_PY_LWIP_EXIT - m_del_obj(socketpool_socket_obj_t, socket2); - mp_raise_OSError(MP_EINVAL); + return -MP_EINVAL; } // accept incoming connection - struct tcp_pcb *volatile *incoming_connection = &lwip_socket_incoming_array(socket)[socket->incoming.connection.iget]; + struct tcp_pcb *volatile *incoming_connection = &lwip_socket_incoming_array(self)[self->incoming.connection.iget]; if (*incoming_connection == NULL) { - if (socket->timeout == 0) { + if (self->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) { + return -MP_EAGAIN; + } else if (self->timeout != (unsigned)-1) { + mp_uint_t retries = self->timeout / 100; + while (*incoming_connection == NULL && !mp_hal_is_interrupted()) { MICROPY_PY_LWIP_EXIT if (retries-- == 0) { - m_del_obj(socketpool_socket_obj_t, socket2); - mp_raise_OSError(MP_ETIMEDOUT); + return -MP_ETIMEDOUT; } mp_hal_delay_ms(100); MICROPY_PY_LWIP_REENTER } } else { - while (*incoming_connection == NULL) { + while (*incoming_connection == NULL && !mp_hal_is_interrupted()) { MICROPY_PY_LWIP_EXIT poll_sockets(); MICROPY_PY_LWIP_REENTER @@ -803,43 +794,75 @@ socketpool_socket_obj_t *common_hal_socketpool_socket_accept(socketpool_socket_o } } + if (*incoming_connection == NULL) { + // We were interrupted. + return 0; + } + + // Close the accepted socket because we have another we accepted. + if (!common_hal_socketpool_socket_get_closed(accepted)) { + common_hal_socketpool_socket_close(accepted); + } + // 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; + accepted->pcb.tcp = *incoming_connection; + if (++self->incoming.connection.iget >= self->incoming.connection.alloc) { + self->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); + accepted->domain = MOD_NETWORK_AF_INET; + accepted->type = MOD_NETWORK_SOCK_STREAM; + accepted->incoming.pbuf = NULL; + accepted->timeout = self->timeout; + accepted->state = STATE_CONNECTED; + accepted->recv_offset = 0; + accepted->callback = MP_OBJ_NULL; + tcp_arg(accepted->pcb.tcp, (void *)accepted); + tcp_err(accepted->pcb.tcp, _lwip_tcp_error); + tcp_recv(accepted->pcb.tcp, _lwip_tcp_recv); tcp_accepted(listener); MICROPY_PY_LWIP_EXIT + // output values + memcpy(ip, &(accepted->pcb.tcp->remote_ip), NETUTILS_IPV4ADDR_BUFSIZE); + *port = (mp_uint_t)accepted->pcb.tcp->remote_port; + + return 1; +} + +socketpool_socket_obj_t *common_hal_socketpool_socket_accept(socketpool_socket_obj_t *socket, + uint8_t *ip, uint32_t *port) { + // 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 *accepted = m_new_ll_obj_with_finaliser(socketpool_socket_obj_t); + socketpool_socket_reset(accepted); + + int ret = socketpool_socket_accept(socket, ip, port, accepted); + + if (ret <= 0) { + m_del_obj(socketpool_socket_obj_t, accepted); + if (ret == 0) { + // Interrupted. + return mp_const_none; + } + mp_raise_OSError(-ret); + } + DEBUG_printf("registering socket in socketpool_socket_accept()\n"); - if (!register_open_socket(socket2)) { + if (!register_open_socket(accepted)) { DEBUG_printf("collecting garbage to open socket\n"); gc_collect(); - if (!register_open_socket(socket2)) { + if (!register_open_socket(accepted)) { mp_raise_RuntimeError(translate("Out of sockets")); } } - mark_user_socket(socket2); + mark_user_socket(accepted); - // 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); + return MP_OBJ_FROM_PTR(accepted); } bool common_hal_socketpool_socket_bind(socketpool_socket_obj_t *socket, @@ -847,21 +870,22 @@ bool common_hal_socketpool_socket_bind(socketpool_socket_obj_t *socket, // get address ip_addr_t bind_addr; - int error = socketpool_resolve_host(socket->pool, host, &bind_addr); - if (error != 0) { - mp_raise_OSError(EHOSTUNREACH); + const ip_addr_t *bind_addr_ptr = &bind_addr; + if (hostlen > 0) { + socketpool_resolve_host_raise(socket->pool, host, &bind_addr); + } else { + bind_addr_ptr = IP_ANY_TYPE; } - ip_set_option(socket->pcb.ip, SOF_REUSEADDR); err_t err = ERR_ARG; switch (socket->type) { case MOD_NETWORK_SOCK_STREAM: { - err = tcp_bind(socket->pcb.tcp, &bind_addr, port); + err = tcp_bind(socket->pcb.tcp, bind_addr_ptr, port); break; } case MOD_NETWORK_SOCK_DGRAM: { - err = udp_bind(socket->pcb.udp, &bind_addr, port); + err = udp_bind(socket->pcb.udp, bind_addr_ptr, port); break; } } @@ -937,10 +961,7 @@ void common_hal_socketpool_socket_connect(socketpool_socket_obj_t *socket, // get address ip_addr_t dest; - int error = socketpool_resolve_host(socket->pool, host, &dest); - if (error != 0) { - mp_raise_OSError(EHOSTUNREACH); - } + socketpool_resolve_host_raise(socket->pool, host, &dest); err_t err = ERR_ARG; switch (socket->type) { @@ -1135,10 +1156,7 @@ 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); - } + socketpool_resolve_host_raise(socket->pool, host, &ip); mp_uint_t ret = 0; switch (socket->type) { @@ -1164,6 +1182,20 @@ void common_hal_socketpool_socket_settimeout(socketpool_socket_obj_t *self, uint self->timeout = timeout_ms; } +int common_hal_socketpool_socket_setsockopt(socketpool_socket_obj_t *self, int level, int optname, const void *value, size_t optlen) { + if (level == SOCKETPOOL_IPPROTO_TCP && optname == SOCKETPOOL_TCP_NODELAY) { + int one = 1; + bool enable = optlen == sizeof(&one) && memcmp(value, &one, optlen); + if (enable) { + tcp_set_flags(self->pcb.tcp, TF_NODELAY); + } else { + tcp_clear_flags(self->pcb.tcp, TF_NODELAY); + } + return 0; + } + return -MP_EOPNOTSUPP; +} + bool common_hal_socketpool_readable(socketpool_socket_obj_t *self) { MICROPY_PY_LWIP_ENTER; @@ -1206,3 +1238,32 @@ bool common_hal_socketpool_writable(socketpool_socket_obj_t *self) { return result; } + +void socketpool_socket_move(socketpool_socket_obj_t *self, socketpool_socket_obj_t *sock) { + *sock = *self; + self->state = _ERR_BADF; + + // Reregister the callbacks with the new socket copy. + MICROPY_PY_LWIP_ENTER; + + tcp_arg(self->pcb.tcp, NULL); + tcp_err(self->pcb.tcp, NULL); + tcp_recv(self->pcb.tcp, NULL); + + self->pcb.tcp = NULL; + + tcp_arg(sock->pcb.tcp, (void *)sock); + tcp_err(sock->pcb.tcp, _lwip_tcp_error); + tcp_recv(sock->pcb.tcp, _lwip_tcp_recv); + + MICROPY_PY_LWIP_EXIT; +} + +void socketpool_socket_reset(socketpool_socket_obj_t *self) { + if (self->base.type == &socketpool_socket_type) { + return; + } + self->base.type = &socketpool_socket_type; + self->pcb.tcp = NULL; + self->state = _ERR_BADF; +} diff --git a/ports/raspberrypi/common-hal/socketpool/SocketPool.c b/ports/raspberrypi/common-hal/socketpool/SocketPool.c index d2f403c852..e562314d69 100644 --- a/ports/raspberrypi/common-hal/socketpool/SocketPool.c +++ b/ports/raspberrypi/common-hal/socketpool/SocketPool.c @@ -57,7 +57,7 @@ STATIC void lwip_getaddrinfo_cb(const char *name, const ip_addr_t *ipaddr, void } } -int socketpool_resolve_host(socketpool_socketpool_obj_t *self, const char *host, ip_addr_t *addr) { +STATIC int socketpool_resolve_host(socketpool_socketpool_obj_t *self, const char *host, ip_addr_t *addr) { getaddrinfo_state_t state; state.status = 0; @@ -94,17 +94,26 @@ int socketpool_resolve_host(socketpool_socketpool_obj_t *self, const char *host, 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); +void socketpool_resolve_host_raise(socketpool_socketpool_obj_t *self, const char *host, ip_addr_t *addr) { + int result = socketpool_resolve_host(self, host, addr); if (result < 0) { + printf("socket_resolve_host() returned %d\n", result); + common_hal_socketpool_socketpool_raise_gaierror_noname(); mp_raise_OSError(-result); } +} + +mp_obj_t common_hal_socketpool_socketpool_gethostbyname(socketpool_socketpool_obj_t *self, const char *host) { + + ip_addr_t addr; + socketpool_resolve_host_raise(self, host, &addr); 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; } + +mp_obj_t common_hal_socketpool_socketpool_gethostbyname_raise(socketpool_socketpool_obj_t *self, const char *host) { + return common_hal_socketpool_socketpool_gethostbyname(self, host); +} diff --git a/ports/raspberrypi/common-hal/socketpool/SocketPool.h b/ports/raspberrypi/common-hal/socketpool/SocketPool.h index 3d498d9a49..a7ad36b92f 100644 --- a/ports/raspberrypi/common-hal/socketpool/SocketPool.h +++ b/ports/raspberrypi/common-hal/socketpool/SocketPool.h @@ -32,4 +32,4 @@ typedef struct { mp_obj_base_t base; } socketpool_socketpool_obj_t; -int socketpool_resolve_host(socketpool_socketpool_obj_t *self, const char *host, ip_addr_t *addr); +void socketpool_resolve_host_raise(socketpool_socketpool_obj_t *self, const char *host, ip_addr_t *addr); diff --git a/ports/raspberrypi/common-hal/wifi/Network.c b/ports/raspberrypi/common-hal/wifi/Network.c index 8db42e962c..ef81247712 100644 --- a/ports/raspberrypi/common-hal/wifi/Network.c +++ b/ports/raspberrypi/common-hal/wifi/Network.c @@ -53,27 +53,27 @@ mp_obj_t common_hal_wifi_network_get_country(wifi_network_obj_t *self) { } mp_obj_t common_hal_wifi_network_get_authmode(wifi_network_obj_t *self) { - uint8_t authmode_mask = 0; + uint32_t authmode_mask = 0; if (self->record.auth_mode == 0) { - authmode_mask = (1 << AUTHMODE_OPEN); + authmode_mask = AUTHMODE_OPEN; } if (self->record.auth_mode & 1) { - authmode_mask |= (1 << AUTHMODE_PSK); + authmode_mask |= AUTHMODE_PSK; } ; if (self->record.auth_mode & 2) { - authmode_mask |= (1 << AUTHMODE_WPA); + authmode_mask |= AUTHMODE_WPA; } ; if (self->record.auth_mode & 4) { - authmode_mask |= (1 << AUTHMODE_WPA2); + authmode_mask |= 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++) { + for (uint32_t i = 0; i < 32; i++) { if ((authmode_mask >> i) & 1) { - mp_obj_list_append(authmode_list, cp_enum_find(&wifi_authmode_type, i)); + mp_obj_list_append(authmode_list, cp_enum_find(&wifi_authmode_type, 1 << i)); } } } diff --git a/ports/raspberrypi/common-hal/wifi/Radio.c b/ports/raspberrypi/common-hal/wifi/Radio.c index 2a74c16e0a..ae14d29ade 100644 --- a/ports/raspberrypi/common-hal/wifi/Radio.c +++ b/ports/raspberrypi/common-hal/wifi/Radio.c @@ -42,10 +42,6 @@ #include "shared-bindings/time/__init__.h" #include "shared-module/ipaddress/__init__.h" -#if CIRCUITPY_MDNS -#include "components/mdns/include/mdns.h" -#endif - #include "lwip/sys.h" #include "lwip/dns.h" #include "lwip/icmp.h" @@ -68,18 +64,17 @@ static inline void nw_put_le32(uint8_t *buf, uint32_t x) { 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); +NORETURN static void ro_attribute(qstr attr) { + mp_raise_NotImplementedError_varg(translate("%q is read-only for this board"), attr); } bool common_hal_wifi_radio_get_enabled(wifi_radio_obj_t *self) { - return true; + return self->enabled; } void common_hal_wifi_radio_set_enabled(wifi_radio_obj_t *self, bool enabled) { - if (!enabled) { - ro_attribute(MP_QSTR_enabled); - } + self->enabled = enabled; + // TODO: Actually enable and disable the WiFi module at this point. } mp_obj_t common_hal_wifi_radio_get_hostname(wifi_radio_obj_t *self) { @@ -96,6 +91,10 @@ void common_hal_wifi_radio_set_hostname(wifi_radio_obj_t *self, const char *host netif_set_hostname(NETIF_AP, self->hostname); } +void wifi_radio_get_mac_address(wifi_radio_obj_t *self, uint8_t *mac) { + memcpy(mac, cyw43_state.mac, MAC_ADDRESS_LENGTH); +} + 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); } @@ -134,7 +133,7 @@ mp_obj_t common_hal_wifi_radio_start_scanning_networks(wifi_radio_obj_t *self, u 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")); + 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; @@ -155,35 +154,99 @@ void common_hal_wifi_radio_start_station(wifi_radio_obj_t *self) { } void common_hal_wifi_radio_stop_station(wifi_radio_obj_t *self) { + cyw43_wifi_leave(&cyw43_state, CYW43_ITF_STA); // This is wrong, but without this call the state of ITF_STA is still // reported as CYW43_LINK_JOIN (by wifi_link_status) and CYW43_LINK_UP - // (by tcpip_link_status). Until AP support is added, we can ignore the - // problem. + // (by tcpip_link_status). However since ap disconnection isn't working + // either, this is not an issue. cyw43_wifi_leave(&cyw43_state, CYW43_ITF_AP); + bindings_cyw43_wifi_enforce_pm(); } -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); +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, uint32_t authmodes, uint8_t max_connections) { + if (!common_hal_wifi_radio_get_enabled(self)) { + mp_raise_RuntimeError(translate("Wifi is not enabled")); + } + + if (cyw43_tcpip_link_status(&cyw43_state, CYW43_ITF_STA) != CYW43_LINK_DOWN) { + mp_raise_RuntimeError(translate("Wifi is in station mode.")); + } + + common_hal_wifi_radio_stop_ap(self); + + // Channel can only be changed after inital powerup and config of ap. + // Defaults to 1 if not set or invalid (i.e. 13) + cyw43_wifi_ap_set_channel(&cyw43_state, (const uint32_t)channel); + + cyw43_arch_enable_ap_mode((const char *)ssid, (const char *)password, CYW43_AUTH_WPA2_AES_PSK); + + // TODO: Implement authmode check like in espressif bindings_cyw43_wifi_enforce_pm(); } void common_hal_wifi_radio_stop_ap(wifi_radio_obj_t *self) { - mp_raise_NotImplementedError(NULL); + if (!common_hal_wifi_radio_get_enabled(self)) { + mp_raise_RuntimeError(translate("wifi is not enabled")); + } + + if (cyw43_tcpip_link_status(&cyw43_state, CYW43_ITF_AP) != CYW43_LINK_DOWN) { + mp_raise_NotImplementedError(translate("Stopping AP is not supported.")); + } + + /* + * AP cannot be disconnected. cyw43_wifi_leave is broken. + * This code snippet should work, but doesn't. + * + * cyw43_wifi_leave(&cyw43_state, CYW43_ITF_AP); + * cyw43_wifi_leave(&cyw43_state, CYW43_ITF_STA); + * + * bindings_cyw43_wifi_enforce_pm(); + */ +} + +static bool connection_unchanged(wifi_radio_obj_t *self, const uint8_t *ssid, size_t ssid_len) { + if (cyw43_tcpip_link_status(&cyw43_state, CYW43_ITF_STA) != CYW43_LINK_UP) { + return false; + } + if (ssid_len != self->connected_ssid_len) { + return false; + } + if (memcmp(ssid, self->connected_ssid, self->connected_ssid_len)) { + return false; + } + return true; } 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")); + mp_raise_RuntimeError(translate("Wifi is not enabled")); + } + + if (cyw43_tcpip_link_status(&cyw43_state, CYW43_ITF_AP) != CYW43_LINK_DOWN) { + mp_raise_RuntimeError(translate("Wifi is in access point mode.")); + } + + if (ssid_len > 32) { + return WIFI_RADIO_ERROR_CONNECTION_FAIL; } size_t timeout_ms = timeout <= 0 ? 8000 : (size_t)MICROPY_FLOAT_C_FUN(ceil)(timeout * 1000); uint64_t start = port_get_raw_ticks(NULL); uint64_t deadline = start + timeout_ms; + if (connection_unchanged(self, ssid, ssid_len)) { + return WIFI_RADIO_ERROR_NONE; + } + + // disconnect + common_hal_wifi_radio_stop_station(self); + // connect - cyw43_arch_wifi_connect_async((const char *)ssid, (const char *)password, CYW43_AUTH_WPA2_AES_PSK); + int auth_mode = password_len ? CYW43_AUTH_WPA2_AES_PSK : CYW43_AUTH_OPEN; + cyw43_arch_wifi_connect_async((const char *)ssid, (const char *)password, auth_mode); + // TODO: Implement authmode check like in espressif while (port_get_raw_ticks(NULL) < deadline) { RUN_BACKGROUND_TASKS; @@ -195,6 +258,8 @@ wifi_radio_error_t common_hal_wifi_radio_connect(wifi_radio_obj_t *self, uint8_t switch (result) { case CYW43_LINK_UP: + memcpy(self->connected_ssid, ssid, ssid_len); + self->connected_ssid_len = ssid_len; bindings_cyw43_wifi_enforce_pm(); return WIFI_RADIO_ERROR_NONE; case CYW43_LINK_FAIL: @@ -242,6 +307,13 @@ mp_obj_t common_hal_wifi_radio_get_ipv4_subnet_ap(wifi_radio_obj_t *self) { return common_hal_ipaddress_new_ipv4address(NETIF_AP->netmask.addr); } +uint32_t wifi_radio_get_ipv4_address(wifi_radio_obj_t *self) { + if (cyw43_tcpip_link_status(&cyw43_state, CYW43_ITF_STA) != CYW43_LINK_UP) { + return 0; + } + return NETIF_STA->ip_addr.addr; +} + mp_obj_t common_hal_wifi_radio_get_ipv4_address(wifi_radio_obj_t *self) { if (cyw43_tcpip_link_status(&cyw43_state, CYW43_ITF_STA) != CYW43_LINK_UP) { return mp_const_none; diff --git a/ports/raspberrypi/common-hal/wifi/Radio.h b/ports/raspberrypi/common-hal/wifi/Radio.h index 0dc18c8957..a4125fe7ba 100644 --- a/ports/raspberrypi/common-hal/wifi/Radio.h +++ b/ports/raspberrypi/common-hal/wifi/Radio.h @@ -35,6 +35,9 @@ 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; + uint8_t connected_ssid[32]; + uint8_t connected_ssid_len; + bool enabled; } wifi_radio_obj_t; extern void common_hal_wifi_radio_gc_collect(wifi_radio_obj_t *self); diff --git a/ports/raspberrypi/lib/cyw43-driver b/ports/raspberrypi/lib/cyw43-driver index 195dfcc10b..2cf328d9e4 160000 --- a/ports/raspberrypi/lib/cyw43-driver +++ b/ports/raspberrypi/lib/cyw43-driver @@ -1 +1 @@ -Subproject commit 195dfcc10bb6f379e3dea45147590db2203d3c7b +Subproject commit 2cf328d9e41603405a037a29e081a7d30dd519e6 diff --git a/ports/raspberrypi/lib/lwip b/ports/raspberrypi/lib/lwip index 239918ccc1..d26459c32c 160000 --- a/ports/raspberrypi/lib/lwip +++ b/ports/raspberrypi/lib/lwip @@ -1 +1 @@ -Subproject commit 239918ccc173cb2c2a62f41a40fd893f57faf1d6 +Subproject commit d26459c32c83aa14a6d4e30237d91cee36e0adbd diff --git a/ports/raspberrypi/lwip_inc/lwipopts.h b/ports/raspberrypi/lwip_inc/lwipopts.h index 0d4ecd3707..6d116e89b6 100644 --- a/ports/raspberrypi/lwip_inc/lwipopts.h +++ b/ports/raspberrypi/lwip_inc/lwipopts.h @@ -54,6 +54,14 @@ #define LWIP_DHCP_DOES_ACD_CHECK 0 #define SO_REUSE 1 +#if CIRCUITPY_MDNS +#define LWIP_IGMP 1 +#define LWIP_MDNS_RESPONDER 1 +#define LWIP_NUM_NETIF_CLIENT_DATA 1 +#define LWIP_NETIF_EXT_STATUS_CALLBACK 1 +#define MDNS_MAX_SECONDARY_HOSTNAMES 1 +#endif + #ifndef NDEBUG #define LWIP_DEBUG 1 #define LWIP_STATS 1 @@ -88,6 +96,7 @@ #define PPP_DEBUG LWIP_DBG_OFF #define SLIP_DEBUG LWIP_DBG_OFF #define DHCP_DEBUG LWIP_DBG_OFF +#define MDNS_DEBUG LWIP_DBG_OFF #define LWIP_TIMEVAL_PRIVATE 0 diff --git a/ports/raspberrypi/mpconfigport.mk b/ports/raspberrypi/mpconfigport.mk index fa1f0c153d..c5de2a439d 100644 --- a/ports/raspberrypi/mpconfigport.mk +++ b/ports/raspberrypi/mpconfigport.mk @@ -2,6 +2,9 @@ LONGINT_IMPL = MPZ CIRCUITPY_OPTIMIZE_PROPERTY_FLASH_SIZE ?= 1 +# CYW43 support does not provide settable MAC addresses for station or AP. +CIRCUITPY_WIFI_RADIO_SETTABLE_MAC_ADDRESS = 0 + CIRCUITPY_ALARM ?= 1 CIRCUITPY_RP2PIO ?= 1 diff --git a/ports/raspberrypi/supervisor/port.c b/ports/raspberrypi/supervisor/port.c index 89e451a3b0..f3da71cbd7 100644 --- a/ports/raspberrypi/supervisor/port.c +++ b/ports/raspberrypi/supervisor/port.c @@ -62,6 +62,7 @@ #include "src/rp2_common/hardware_sync/include/hardware/sync.h" #include "src/rp2_common/hardware_timer/include/hardware/timer.h" #if CIRCUITPY_CYW43 +#include "py/mphal.h" #include "pico/cyw43_arch.h" #endif #include "src/common/pico_time/include/pico/time.h" @@ -126,6 +127,13 @@ safe_mode_t port_init(void) { (&_ld_dtcm_bss_start)[i] = 0; } + #if CIRCUITPY_CYW43 + never_reset_pin_number(23); + never_reset_pin_number(24); + never_reset_pin_number(25); + never_reset_pin_number(29); + #endif + // Reset everything into a known state before board_init. reset_port(); @@ -139,21 +147,24 @@ 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()) { + // A small number of samples of pico w need an additional delay before + // initializing the cyw43 chip. Delays inside cyw43_arch_init_with_country + // are intended to meet the power on timing requirements, but apparently + // are inadequate. We'll back off this long delay based on future testing. + mp_hal_delay_ms(1000); + // Change this as a placeholder as to how to init with country code. + // Default country code is CYW43_COUNTRY_WORLDWIDE) + if (cyw43_arch_init_with_country(PICO_CYW43_ARCH_DEFAULT_COUNTRY_CODE)) { serial_write("WiFi init failed\n"); } else { cyw_ever_init = true; } #endif if (board_requests_safe_mode()) { - return USER_SAFE_MODE; + return SAFE_MODE_USER; } - return NO_SAFE_MODE; + return SAFE_MODE_NONE; } void reset_port(void) { @@ -301,7 +312,7 @@ __attribute__((used)) void HardFault_Handler(void) { REG_MTB_MASTER = 0x00000000 + 6; #endif - reset_into_safe_mode(HARD_CRASH); + reset_into_safe_mode(SAFE_MODE_HARD_FAULT); while (true) { asm ("nop;"); } diff --git a/ports/stm/Makefile b/ports/stm/Makefile index 680cfa34f3..094bee7aef 100755 --- a/ports/stm/Makefile +++ b/ports/stm/Makefile @@ -191,7 +191,6 @@ SRC_STM32 += boards/system_stm32$(MCU_SERIES_LOWER)xx.c SRC_C += \ background.c \ - fatfs_port.c \ mphalport.c \ boards/$(BOARD)/board.c \ boards/$(BOARD)/pins.c \ diff --git a/ports/stm/boards/swan_r5/tests/board_voltage.py b/ports/stm/boards/swan_r5/tests/board_voltage.py index 6191067fde..2cb0ad4cc0 100644 --- a/ports/stm/boards/swan_r5/tests/board_voltage.py +++ b/ports/stm/boards/swan_r5/tests/board_voltage.py @@ -44,6 +44,7 @@ PASS = "PASS" FAIL = "FAIL" NA = "N/A" + # Determine if given value is a number def _is_number(val): try: @@ -61,7 +62,6 @@ def _deinit_pins(gpios): # Toggle IO pins while waiting for answer def _toggle_wait(pin_gpios): - timestamp = time.monotonic() led_state = False failed = [] @@ -96,7 +96,6 @@ def buildPin(pin): def run_test(pins): - """ Toggles all available GPIO on and off repeatedly. @@ -114,7 +113,6 @@ def run_test(pins): gpio_pins = analog_pins + digital_pins if gpio_pins: - # Print out the LEDs found print("GPIO pins found:", end=" ") for pin in gpio_pins: diff --git a/ports/stm/common-hal/canio/Listener.c b/ports/stm/common-hal/canio/Listener.c index 69c196b78d..0def8192f9 100644 --- a/ports/stm/common-hal/canio/Listener.c +++ b/ports/stm/common-hal/canio/Listener.c @@ -105,8 +105,7 @@ STATIC int next_filter(canio_can_obj_t *can) { return i; } } - reset_into_safe_mode(MICROPY_FATAL_ERROR); - return -1; + mp_raise_msg_varg(&mp_type_RuntimeError, translate("%q"), MP_QSTR_Listener); } // IDE = "extended ID" flag of packet header. We always add this bit to the diff --git a/ports/stm/common-hal/microcontroller/__init__.c b/ports/stm/common-hal/microcontroller/__init__.c index c399951f54..dc2e125a68 100644 --- a/ports/stm/common-hal/microcontroller/__init__.c +++ b/ports/stm/common-hal/microcontroller/__init__.c @@ -61,9 +61,8 @@ void common_hal_mcu_disable_interrupts(void) { void common_hal_mcu_enable_interrupts(void) { if (nesting_count == 0) { - // This is very very bad because it means there was mismatched disable/enables so we - // "HardFault". - asm ("bkpt"); + // This is very very bad because it means there was mismatched disable/enables. + reset_into_safe_mode(SAFE_MODE_INTERRUPT_ERROR); } nesting_count--; if (nesting_count > 0) { @@ -77,7 +76,7 @@ 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); + safe_mode_on_next_reset(SAFE_MODE_PROGRAMMATIC); } if (runmode == RUNMODE_BOOTLOADER) { next_reset_to_bootloader = true; diff --git a/ports/stm/supervisor/internal_flash.c b/ports/stm/supervisor/internal_flash.c index e0f4153cb1..f3f9719753 100644 --- a/ports/stm/supervisor/internal_flash.c +++ b/ports/stm/supervisor/internal_flash.c @@ -215,7 +215,7 @@ void port_internal_flash_flush(void) { EraseInitStruct.NbSectors = 1; #endif if (sector_size > sizeof(_flash_cache) || sector_start_addr == 0xffffffff) { - reset_into_safe_mode(FLASH_WRITE_FAIL); + reset_into_safe_mode(SAFE_MODE_FLASH_WRITE_FAIL); } // Skip if data is the same @@ -228,7 +228,7 @@ void port_internal_flash_flush(void) { if (HAL_FLASHEx_Erase(&EraseInitStruct, &SectorError) != HAL_OK) { // error occurred during sector erase HAL_FLASH_Lock(); // lock the flash - reset_into_safe_mode(FLASH_WRITE_FAIL); + reset_into_safe_mode(SAFE_MODE_FLASH_WRITE_FAIL); } uint32_t *cache_addr = (uint32_t *)_flash_cache; @@ -240,7 +240,7 @@ void port_internal_flash_flush(void) { (uint32_t)cache_addr) != HAL_OK) { // error occurred during flash write HAL_FLASH_Lock(); // lock the flash - reset_into_safe_mode(FLASH_WRITE_FAIL); + reset_into_safe_mode(SAFE_MODE_FLASH_WRITE_FAIL); } // RAM memory is by word (4 byte), but flash memory is by byte cache_addr += 8; @@ -253,7 +253,7 @@ void port_internal_flash_flush(void) { *(uint64_t *)cache_addr) != HAL_OK) { // error occurred during flash write HAL_FLASH_Lock(); // lock the flash - reset_into_safe_mode(FLASH_WRITE_FAIL); + reset_into_safe_mode(SAFE_MODE_FLASH_WRITE_FAIL); } // RAM memory is by word (4 byte), but flash memory is by byte cache_addr += 2; @@ -267,7 +267,7 @@ void port_internal_flash_flush(void) { (uint64_t)*cache_addr) != HAL_OK) { // error occurred during flash write HAL_FLASH_Lock(); // lock the flash - reset_into_safe_mode(FLASH_WRITE_FAIL); + reset_into_safe_mode(SAFE_MODE_FLASH_WRITE_FAIL); } // RAM memory is by word (4 byte), but flash memory is by byte cache_addr += 1; @@ -335,7 +335,7 @@ mp_uint_t supervisor_flash_write_blocks(const uint8_t *src, uint32_t block_num, // Fail for any sector outside what's supported by the cache if (sector_size > sizeof(_flash_cache)) { - reset_into_safe_mode(FLASH_WRITE_FAIL); + reset_into_safe_mode(SAFE_MODE_FLASH_WRITE_FAIL); } // Find how many blocks are left in the sector diff --git a/ports/stm/supervisor/port.c b/ports/stm/supervisor/port.c index 97bd1c4982..1fb3f36377 100644 --- a/ports/stm/supervisor/port.c +++ b/ports/stm/supervisor/port.c @@ -211,7 +211,7 @@ safe_mode_t port_init(void) { // Turn off SysTick SysTick->CTRL = 0; - return NO_SAFE_MODE; + return SAFE_MODE_NONE; } void HAL_Delay(uint32_t delay_ms) { @@ -357,28 +357,28 @@ uint32_t port_get_saved_word(void) { } __attribute__((used)) void MemManage_Handler(void) { - reset_into_safe_mode(MEM_MANAGE); + reset_into_safe_mode(SAFE_MODE_HARD_FAULT); while (true) { asm ("nop;"); } } __attribute__((used)) void BusFault_Handler(void) { - reset_into_safe_mode(MEM_MANAGE); + reset_into_safe_mode(SAFE_MODE_HARD_FAULT); while (true) { asm ("nop;"); } } __attribute__((used)) void UsageFault_Handler(void) { - reset_into_safe_mode(MEM_MANAGE); + reset_into_safe_mode(SAFE_MODE_HARD_FAULT); while (true) { asm ("nop;"); } } __attribute__((used)) void HardFault_Handler(void) { - reset_into_safe_mode(HARD_CRASH); + reset_into_safe_mode(SAFE_MODE_HARD_FAULT); while (true) { asm ("nop;"); } diff --git a/ports/stm/tools/parse_af_csv.py b/ports/stm/tools/parse_af_csv.py index 3e48d4145d..e3188e2e24 100644 --- a/ports/stm/tools/parse_af_csv.py +++ b/ports/stm/tools/parse_af_csv.py @@ -31,6 +31,7 @@ import sys # # See examples/stm32f405.csv for example formatting. + # Most peripherals (SPI, I2C) output 3 values: # peripheral index, alt function, pin string def evaluate_periph(inper, inlist, periph, subtype, altfn, pin): diff --git a/ports/unix/modos.c b/ports/unix/modos.c index 6241dfa6c3..a6365aa6a3 100644 --- a/ports/unix/modos.c +++ b/ports/unix/modos.c @@ -56,6 +56,14 @@ #endif #endif +#if defined(MICROPY_UNIX_COVERAGE) +#include "py/objstr.h" +typedef int os_getenv_err_t; +mp_obj_t common_hal_os_getenv(const char *key, mp_obj_t default_); +os_getenv_err_t common_hal_os_getenv_str(const char *key, char *value, size_t value_len); +os_getenv_err_t common_hal_os_getenv_int(const char *key, mp_int_t *value); +#endif + STATIC mp_obj_t mod_os_urandom(mp_obj_t num) { mp_int_t n = mp_obj_get_int(num); vstr_t vstr; @@ -194,6 +202,12 @@ STATIC mp_obj_t mod_os_system(mp_obj_t cmd_in) { MP_DEFINE_CONST_FUN_OBJ_1(mod_os_system_obj, mod_os_system); STATIC mp_obj_t mod_os_getenv(mp_obj_t var_in) { + #if defined(MICROPY_UNIX_COVERAGE) + mp_obj_t result = common_hal_os_getenv(mp_obj_str_get_str(var_in), mp_const_none); + if (result != mp_const_none) { + return result; + } + #endif const char *s = getenv(mp_obj_str_get_str(var_in)); if (s == NULL) { return mp_const_none; @@ -202,6 +216,28 @@ STATIC mp_obj_t mod_os_getenv(mp_obj_t var_in) { } MP_DEFINE_CONST_FUN_OBJ_1(mod_os_getenv_obj, mod_os_getenv); +#if defined(MICROPY_UNIX_COVERAGE) +STATIC mp_obj_t mod_os_getenv_int(mp_obj_t var_in) { + mp_int_t value; + os_getenv_err_t result = common_hal_os_getenv_int(mp_obj_str_get_str(var_in), &value); + if (result == 0) { + return mp_obj_new_int(value); + } + return mp_const_none; +} +MP_DEFINE_CONST_FUN_OBJ_1(mod_os_getenv_int_obj, mod_os_getenv_int); + +STATIC mp_obj_t mod_os_getenv_str(mp_obj_t var_in) { + char buf[4096]; + os_getenv_err_t result = common_hal_os_getenv_str(mp_obj_str_get_str(var_in), buf, sizeof(buf)); + if (result == 0) { + return mp_obj_new_str_copy(&mp_type_str, (byte *)buf, strlen(buf)); + } + return mp_const_none; +} +MP_DEFINE_CONST_FUN_OBJ_1(mod_os_getenv_str_obj, mod_os_getenv_str); +#endif + STATIC mp_obj_t mod_os_putenv(mp_obj_t key_in, mp_obj_t value_in) { const char *key = mp_obj_str_get_str(key_in); const char *value = mp_obj_str_get_str(value_in); @@ -341,6 +377,10 @@ STATIC const mp_rom_map_elem_t mp_module_os_globals_table[] = { { MP_ROM_QSTR(MP_QSTR_rename), MP_ROM_PTR(&mod_os_rename_obj) }, { MP_ROM_QSTR(MP_QSTR_rmdir), MP_ROM_PTR(&mod_os_rmdir_obj) }, { MP_ROM_QSTR(MP_QSTR_getenv), MP_ROM_PTR(&mod_os_getenv_obj) }, + #if defined(MICROPY_UNIX_COVERAGE) + { MP_ROM_QSTR(MP_QSTR_getenv_int), MP_ROM_PTR(&mod_os_getenv_int_obj) }, + { MP_ROM_QSTR(MP_QSTR_getenv_str), MP_ROM_PTR(&mod_os_getenv_str_obj) }, + #endif { MP_ROM_QSTR(MP_QSTR_putenv), MP_ROM_PTR(&mod_os_putenv_obj) }, { MP_ROM_QSTR(MP_QSTR_unsetenv), MP_ROM_PTR(&mod_os_unsetenv_obj) }, { MP_ROM_QSTR(MP_QSTR_mkdir), MP_ROM_PTR(&mod_os_mkdir_obj) }, diff --git a/ports/unix/moduos_vfs.c b/ports/unix/moduos_vfs.c index 41273bc7e2..495679290a 100644 --- a/ports/unix/moduos_vfs.c +++ b/ports/unix/moduos_vfs.c @@ -37,6 +37,10 @@ // These are defined in modos.c MP_DECLARE_CONST_FUN_OBJ_VAR_BETWEEN(mod_os_errno_obj); MP_DECLARE_CONST_FUN_OBJ_1(mod_os_getenv_obj); +#if defined(MICROPY_UNIX_COVERAGE) +MP_DECLARE_CONST_FUN_OBJ_1(mod_os_getenv_int_obj); +MP_DECLARE_CONST_FUN_OBJ_1(mod_os_getenv_str_obj); +#endif MP_DECLARE_CONST_FUN_OBJ_1(mod_os_putenv_obj); MP_DECLARE_CONST_FUN_OBJ_1(mod_os_unsetenv_obj); MP_DECLARE_CONST_FUN_OBJ_1(mod_os_system_obj); @@ -47,6 +51,10 @@ STATIC const mp_rom_map_elem_t uos_vfs_module_globals_table[] = { { MP_ROM_QSTR(MP_QSTR_errno), MP_ROM_PTR(&mod_os_errno_obj) }, { MP_ROM_QSTR(MP_QSTR_getenv), MP_ROM_PTR(&mod_os_getenv_obj) }, + #if defined(MICROPY_UNIX_COVERAGE) + { MP_ROM_QSTR(MP_QSTR_getenv_int), MP_ROM_PTR(&mod_os_getenv_int_obj) }, + { MP_ROM_QSTR(MP_QSTR_getenv_str), MP_ROM_PTR(&mod_os_getenv_str_obj) }, + #endif { MP_ROM_QSTR(MP_QSTR_putenv), MP_ROM_PTR(&mod_os_putenv_obj) }, { MP_ROM_QSTR(MP_QSTR_unsetenv), MP_ROM_PTR(&mod_os_unsetenv_obj) }, { MP_ROM_QSTR(MP_QSTR_system), MP_ROM_PTR(&mod_os_system_obj) }, diff --git a/ports/unix/variants/coverage/mpconfigvariant.h b/ports/unix/variants/coverage/mpconfigvariant.h index f6ebc2087b..ba9e941c28 100644 --- a/ports/unix/variants/coverage/mpconfigvariant.h +++ b/ports/unix/variants/coverage/mpconfigvariant.h @@ -65,6 +65,7 @@ #define MICROPY_PY_UCRYPTOLIB (1) #define MICROPY_PY_UCRYPTOLIB_CTR (1) #define MICROPY_PY_MICROPYTHON_HEAP_LOCKED (1) +#define MICROPY_CPYTHON_EXCEPTION_CHAIN (1) // use vfs's functions for import stat and builtin open #define mp_import_stat mp_vfs_import_stat diff --git a/ports/unix/variants/coverage/mpconfigvariant.mk b/ports/unix/variants/coverage/mpconfigvariant.mk index 1e8e59f9a9..e351fc0836 100644 --- a/ports/unix/variants/coverage/mpconfigvariant.mk +++ b/ports/unix/variants/coverage/mpconfigvariant.mk @@ -33,7 +33,6 @@ 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 \ @@ -45,7 +44,7 @@ SRC_BITMAP := \ shared-module/displayio/Bitmap.c \ shared-module/displayio/ColorConverter.c \ shared-module/displayio/ColorConverter.c \ - shared-module/dotenv/__init__.c \ + shared-module/os/getenv.c \ shared-module/rainbowio/__init__.c \ shared-module/traceback/__init__.c \ shared-module/zlib/__init__.c \ @@ -56,7 +55,7 @@ CFLAGS += \ -DCIRCUITPY_AESIO=1 \ -DCIRCUITPY_BITMAPTOOLS=1 \ -DCIRCUITPY_DISPLAYIO_UNIX=1 \ - -DCIRCUITPY_DOTENV=1 \ + -DCIRCUITPY_OS_GETENV=1 \ -DCIRCUITPY_GIFIO=1 \ -DCIRCUITPY_RAINBOWIO=1 \ -DCIRCUITPY_TRACEBACK=1 \ diff --git a/py/argcheck.c b/py/argcheck.c index c28c577088..05c2567ca2 100644 --- a/py/argcheck.c +++ b/py/argcheck.c @@ -145,9 +145,11 @@ void mp_arg_parse_all_kw_array(size_t n_pos, size_t n_kw, const mp_obj_t *args, mp_arg_parse_all(n_pos, args, &kw_args, n_allowed, allowed, out_vals); } +#if MICROPY_ERROR_REPORTING <= MICROPY_ERROR_REPORTING_TERSE NORETURN void mp_arg_error_terse_mismatch(void) { mp_raise_TypeError(MP_ERROR_TEXT("argument num/types mismatch")); } +#endif #if MICROPY_CPYTHON_COMPAT NORETURN void mp_arg_error_unimpl_kw(void) { @@ -232,14 +234,28 @@ mp_int_t mp_arg_validate_index_range(mp_int_t index, mp_int_t min, mp_int_t max, 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); + mp_raise_TypeError_varg(translate("%q must be of type %q, not %q"), arg_name, type->name, mp_obj_get_type(obj)->name); + } + return obj; +} + +mp_obj_t mp_arg_validate_type_in(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 in %q must be of type %q, not %q"), MP_QSTR_object, arg_name, type->name, mp_obj_get_type(obj)->name); + } + return obj; +} + +mp_obj_t mp_arg_validate_type_or_none(mp_obj_t obj, const mp_obj_type_t *type, qstr arg_name) { + if (obj != mp_const_none && !mp_obj_is_type(obj, type)) { + mp_raise_TypeError_varg(translate("%q must be of type %q or %q, not %q"), arg_name, type->name, MP_QSTR_None, mp_obj_get_type(obj)->name); } return obj; } 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); + mp_raise_TypeError_varg(translate("%q must be of type %q, not %q"), arg_name, MP_QSTR_str, mp_obj_get_type(obj)->name); } return obj; } @@ -247,7 +263,7 @@ mp_obj_t mp_arg_validate_type_string(mp_obj_t obj, qstr arg_name) { 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); + mp_raise_TypeError_varg(translate("%q must be of type %q, not %q"), arg_name, MP_QSTR_int, mp_obj_get_type(obj)->name); } return an_int; } diff --git a/py/circuitpy_defns.mk b/py/circuitpy_defns.mk index ee51a58c58..9de0e5a804 100644 --- a/py/circuitpy_defns.mk +++ b/py/circuitpy_defns.mk @@ -167,9 +167,6 @@ endif ifeq ($(CIRCUITPY_CANIO),1) SRC_PATTERNS += canio/% endif -ifeq ($(CIRCUITPY_COPROC),1) -SRC_PATTERNS += coproc/% -endif ifeq ($(CIRCUITPY_COUNTIO),1) SRC_PATTERNS += countio/% endif @@ -182,9 +179,6 @@ endif ifeq ($(CIRCUITPY_DISPLAYIO),1) SRC_PATTERNS += displayio/% endif -ifeq ($(CIRCUITPY_DOTENV),1) -SRC_PATTERNS += dotenv/% -endif ifeq ($(CIRCUITPY__EVE),1) SRC_PATTERNS += _eve/% endif @@ -230,6 +224,9 @@ endif ifeq ($(CIRCUITPY_MATH),1) SRC_PATTERNS += math/% endif +ifeq ($(CIRCUITPY_MEMORYMAP),1) +SRC_PATTERNS += memorymap/% +endif ifeq ($(CIRCUITPY_MEMORYMONITOR),1) SRC_PATTERNS += memorymonitor/% endif @@ -266,6 +263,9 @@ endif ifeq ($(CIRCUITPY_PIXELBUF),1) SRC_PATTERNS += adafruit_pixelbuf/% endif +ifeq ($(CIRCUITPY_PIXELMAP),1) +SRC_PATTERNS += _pixelmap/% +endif ifeq ($(CIRCUITPY_QRIO),1) SRC_PATTERNS += qrio/% endif @@ -400,7 +400,6 @@ SRC_COMMON_HAL_ALL = \ alarm/pin/PinAlarm.c \ alarm/time/TimeAlarm.c \ alarm/touch/TouchAlarm.c \ - alarm/coproc/CoprocAlarm.c \ analogbufio/BufferedIn.c \ analogbufio/__init__.c \ analogio/AnalogIn.c \ @@ -423,9 +422,6 @@ SRC_COMMON_HAL_ALL = \ canio/CAN.c \ canio/Listener.c \ canio/__init__.c \ - coproc/__init__.c \ - coproc/Coproc.c \ - coproc/CoprocMemory.c \ countio/Counter.c \ countio/__init__.c \ digitalio/DigitalInOut.c \ @@ -443,9 +439,11 @@ SRC_COMMON_HAL_ALL = \ hashlib/Hash.c \ i2ctarget/I2CTarget.c \ i2ctarget/__init__.c \ + memorymap/__init__.c \ + memorymap/AddressRange.c \ + microcontroller/__init__.c \ microcontroller/Pin.c \ microcontroller/Processor.c \ - microcontroller/__init__.c \ mdns/__init__.c \ mdns/Server.c \ mdns/RemoteService.c \ @@ -532,6 +530,11 @@ $(filter $(SRC_PATTERNS), \ wifi/Packet.c \ ) +ifeq ($(CIRCUITPY_SAFEMODE_PY),1) +SRC_BINDINGS_ENUMS += \ + supervisor/SafeModeReason.c +endif + SRC_BINDINGS_ENUMS += \ util.c @@ -543,6 +546,8 @@ SRC_SHARED_MODULE_ALL = \ _eve/__init__.c \ adafruit_pixelbuf/PixelBuf.c \ adafruit_pixelbuf/__init__.c \ + _pixelmap/PixelMap.c \ + _pixelmap/__init__.c \ _stage/Layer.c \ _stage/Text.c \ _stage/__init__.c \ @@ -584,7 +589,6 @@ 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 \ @@ -713,6 +717,7 @@ endif SRC_SHARED_MODULE_INTERNAL = \ $(filter $(SRC_PATTERNS), \ displayio/display_core.c \ + os/getenv.c \ usb/utf16le.c \ ) diff --git a/py/circuitpy_mpconfig.h b/py/circuitpy_mpconfig.h index 6ae8275058..8bfb69297a 100644 --- a/py/circuitpy_mpconfig.h +++ b/py/circuitpy_mpconfig.h @@ -224,6 +224,9 @@ typedef long mp_off_t; #ifndef MICROPY_CPYTHON_COMPAT #define MICROPY_CPYTHON_COMPAT (CIRCUITPY_FULL_BUILD) #endif +#ifndef MICROPY_CPYTHON_EXCEPTION_CHAIN +#define MICROPY_CPYTHON_EXCEPTION_CHAIN (CIRCUITPY_FULL_BUILD) +#endif #define MICROPY_PY_BUILTINS_POW3 (CIRCUITPY_BUILTINS_POW3) #define MICROPY_PY_FSTRINGS (1) #define MICROPY_MODULE_WEAK_LINKS (0) @@ -579,6 +582,10 @@ void supervisor_run_background_tasks_if_tick(void); #define MICROPY_WRAP_MP_EXECUTE_BYTECODE PLACE_IN_ITCM #endif +#ifndef CIRCUITPY_DIGITALIO_HAVE_INPUT_ONLY +#define CIRCUITPY_DIGITALIO_HAVE_INPUT_ONLY (0) +#endif + #ifndef CIRCUITPY_DIGITALIO_HAVE_INVALID_PULL #define CIRCUITPY_DIGITALIO_HAVE_INVALID_PULL (0) #endif @@ -587,6 +594,7 @@ void supervisor_run_background_tasks_if_tick(void); #define CIRCUITPY_DIGITALIO_HAVE_INVALID_DRIVE_MODE (0) #endif +#define FF_FS_MAKE_VOLID (1) #define MICROPY_PY_OPTIMIZE_PROPERTY_FLASH_SIZE (CIRCUITPY_OPTIMIZE_PROPERTY_FLASH_SIZE) diff --git a/py/circuitpy_mpconfig.mk b/py/circuitpy_mpconfig.mk index fbf0b587b7..4ea6ead794 100644 --- a/py/circuitpy_mpconfig.mk +++ b/py/circuitpy_mpconfig.mk @@ -208,9 +208,6 @@ 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) @@ -218,17 +215,22 @@ CFLAGS += -DCIRCUITPY_DUALBANK=$(CIRCUITPY_DUALBANK) CIRCUITPY_ENABLE_MPY_NATIVE ?= 0 CFLAGS += -DCIRCUITPY_ENABLE_MPY_NATIVE=$(CIRCUITPY_ENABLE_MPY_NATIVE) +CIRCUITPY_OS_GETENV ?= $(CIRCUITPY_FULL_BUILD) +CFLAGS += -DCIRCUITPY_OS_GETENV=$(CIRCUITPY_OS_GETENV) + CIRCUITPY_ERRNO ?= $(CIRCUITPY_FULL_BUILD) CFLAGS += -DCIRCUITPY_ERRNO=$(CIRCUITPY_ERRNO) -# CIRCUITPY_ESPIDF is handled in the espressif tree. -# Only for ESP32S chips. -# Assume not a ESP build. +# Espressif specific modules. +# Assume not an Espressif build. CIRCUITPY_ESPIDF ?= 0 CFLAGS += -DCIRCUITPY_ESPIDF=$(CIRCUITPY_ESPIDF) -CIRCUITPY_ESP32_CAMERA ?= 0 -CFLAGS += -DCIRCUITPY_ESP32_CAMERA=$(CIRCUITPY_ESP32_CAMERA) +CIRCUITPY_ESPULP ?= 0 +CFLAGS += -DCIRCUITPY_ESPULP=$(CIRCUITPY_ESPULP) + +CIRCUITPY_ESPCAMERA ?= 0 +CFLAGS += -DCIRCUITPY_ESPCAMERA=$(CIRCUITPY_ESPCAMERA) CIRCUITPY__EVE ?= 0 CFLAGS += -DCIRCUITPY__EVE=$(CIRCUITPY__EVE) @@ -283,6 +285,9 @@ CFLAGS += -DCIRCUITPY_KEYPAD=$(CIRCUITPY_KEYPAD) CIRCUITPY_MATH ?= 1 CFLAGS += -DCIRCUITPY_MATH=$(CIRCUITPY_MATH) +CIRCUITPY_MEMORYMAP ?= 0 +CFLAGS += -DCIRCUITPY_MEMORYMAP=$(CIRCUITPY_MEMORYMAP) + CIRCUITPY_MEMORYMONITOR ?= 0 CFLAGS += -DCIRCUITPY_MEMORYMONITOR=$(CIRCUITPY_MEMORYMONITOR) @@ -319,6 +324,9 @@ CFLAGS += -DCIRCUITPY_PEW=$(CIRCUITPY_PEW) CIRCUITPY_PIXELBUF ?= $(CIRCUITPY_FULL_BUILD) CFLAGS += -DCIRCUITPY_PIXELBUF=$(CIRCUITPY_PIXELBUF) +CIRCUITPY_PIXELMAP ?= $(CIRCUITPY_PIXELBUF) +CFLAGS += -DCIRCUITPY_PIXELMAP=$(CIRCUITPY_PIXELMAP) + # Only for SAMD boards for the moment CIRCUITPY_PS2IO ?= 0 CFLAGS += -DCIRCUITPY_PS2IO=$(CIRCUITPY_PS2IO) @@ -364,6 +372,10 @@ CFLAGS += -DCIRCUITPY_ROTARYIO_SOFTENCODER=$(CIRCUITPY_ROTARYIO_SOFTENCODER) CIRCUITPY_RTC ?= 1 CFLAGS += -DCIRCUITPY_RTC=$(CIRCUITPY_RTC) +# Enable support for safemode.py +CIRCUITPY_SAFEMODE_PY ?= 1 +CFLAGS += -DCIRCUITPY_SAFEMODE_PY=$(CIRCUITPY_SAFEMODE_PY) + # CIRCUITPY_SAMD is handled in the atmel-samd tree. # Only for SAMD chips. # Assume not a SAMD build. @@ -385,6 +397,11 @@ CFLAGS += -DCIRCUITPY_SETTABLE_PROCESSOR_FREQUENCY=$(CIRCUITPY_SETTABLE_PROCESSO CIRCUITPY_SHARPDISPLAY ?= $(CIRCUITPY_FRAMEBUFFERIO) CFLAGS += -DCIRCUITPY_SHARPDISPLAY=$(CIRCUITPY_SHARPDISPLAY) +# Disable the safe mode blink at boot. Speeds up boot time, but makes it +# impossible to enter safe mode by pressing buttons on boot. +CIRCUITPY_SKIP_SAFE_MODE_WAIT ?= 0 +CFLAGS += -DCIRCUITPY_SKIP_SAFE_MODE_WAIT=$(CIRCUITPY_SKIP_SAFE_MODE_WAIT) + CIRCUITPY_SOCKETPOOL ?= $(CIRCUITPY_WIFI) CFLAGS += -DCIRCUITPY_SOCKETPOOL=$(CIRCUITPY_SOCKETPOOL) @@ -529,6 +546,9 @@ CFLAGS += -DCIRCUITPY_WIFI=$(CIRCUITPY_WIFI) CIRCUITPY_WEB_WORKFLOW ?= $(CIRCUITPY_WIFI) CFLAGS += -DCIRCUITPY_WEB_WORKFLOW=$(CIRCUITPY_WEB_WORKFLOW) +CIRCUITPY_WIFI_RADIO_SETTABLE_MAC_ADDRESS?= 1 +CFLAGS += -DCIRCUITPY_WIFI_RADIO_SETTABLE_MAC_ADDRESS=$(CIRCUITPY_WIFI_RADIO_SETTABLE_MAC_ADDRESS) + # tinyusb port tailored configuration CIRCUITPY_TUSB_MEM_ALIGN ?= 4 CFLAGS += -DCIRCUITPY_TUSB_MEM_ALIGN=$(CIRCUITPY_TUSB_MEM_ALIGN) diff --git a/py/enum.c b/py/enum.c index 681c3b3103..22b9090196 100644 --- a/py/enum.c +++ b/py/enum.c @@ -40,10 +40,8 @@ mp_obj_t cp_enum_find(const mp_obj_type_t *type, int value) { return mp_const_none; } -int cp_enum_value(const mp_obj_type_t *type, mp_obj_t obj) { - if (!mp_obj_is_type(obj, type)) { - mp_raise_TypeError_varg(MP_ERROR_TEXT("Expected a %q"), type->name); - } +int cp_enum_value(const mp_obj_type_t *type, mp_obj_t obj, qstr arg_name) { + (void)mp_arg_validate_type(obj, type, arg_name); return ((cp_enum_obj_t *)MP_OBJ_TO_PTR(obj))->value; } diff --git a/py/enum.h b/py/enum.h index d0b8529a4d..63191047e0 100644 --- a/py/enum.h +++ b/py/enum.h @@ -61,5 +61,5 @@ typedef struct { mp_obj_t cp_enum_find(const mp_obj_type_t *type, int value); -int cp_enum_value(const mp_obj_type_t *type, mp_obj_t obj); +int cp_enum_value(const mp_obj_type_t *type, mp_obj_t obj, qstr arg_name); void cp_enum_obj_print_helper(uint16_t module, const mp_print_t *print, mp_obj_t self_in, mp_print_kind_t kind); diff --git a/py/gc.c b/py/gc.c index fc6bc90b67..0ced4c854d 100644 --- a/py/gc.c +++ b/py/gc.c @@ -518,7 +518,7 @@ void *gc_alloc(size_t n_bytes, unsigned int alloc_flags, bool long_lived) { } if (MP_STATE_MEM(gc_pool_start) == 0) { - reset_into_safe_mode(GC_ALLOC_OUTSIDE_VM); + reset_into_safe_mode(SAFE_MODE_GC_ALLOC_OUTSIDE_VM); } GC_ENTER(); @@ -712,7 +712,7 @@ void gc_free(void *ptr) { GC_EXIT(); } else { if (MP_STATE_MEM(gc_pool_start) == 0) { - reset_into_safe_mode(GC_ALLOC_OUTSIDE_VM); + reset_into_safe_mode(SAFE_MODE_GC_ALLOC_OUTSIDE_VM); } // get the GC block number corresponding to this pointer assert(VERIFY_PTR(ptr)); diff --git a/py/genlast.py b/py/genlast.py index ad44745d97..1c5089fdfc 100644 --- a/py/genlast.py +++ b/py/genlast.py @@ -12,7 +12,7 @@ import subprocess from makeqstrdefs import qstr_unescape, QSTRING_BLOCK_LIST re_line = re.compile(r"#[line]*\s(\d+)\s\"([^\"]+)\"", re.DOTALL) -re_qstr = re.compile(r"MP_QSTR_[_a-zA-Z0-9]+", re.DOTALL) +re_qstr = re.compile(r"\bMP_QSTR_[_a-zA-Z0-9]+", re.DOTALL) re_translate = re.compile(r"translate\(\"((?:(?=(\\?))\2.)*?)\"\)", re.DOTALL) @@ -59,7 +59,6 @@ def maybe_preprocess(command, output_dir, fn): if __name__ == "__main__": - idx1 = sys.argv.index("--") idx2 = sys.argv.index("--", idx1 + 1) output_dir = sys.argv[1] diff --git a/py/makeqstrdata.py b/py/makeqstrdata.py index 2abbdedefd..d16bb0d09a 100644 --- a/py/makeqstrdata.py +++ b/py/makeqstrdata.py @@ -249,6 +249,7 @@ static_qstr_list = [ "zip", ] + # this must match the equivalent function in qstr.c def compute_hash(qstr, bytes_hash): hash = 5381 diff --git a/py/makeqstrdefs.py b/py/makeqstrdefs.py index f035ed5745..974227f2a5 100644 --- a/py/makeqstrdefs.py +++ b/py/makeqstrdefs.py @@ -65,6 +65,7 @@ name2codepoint["tilde"] = ord("~") # These are just vexing! del name2codepoint["and"] del name2codepoint["or"] +del name2codepoint["not"] def preprocess(): diff --git a/py/maketranslationdata.py b/py/maketranslationdata.py index c0ae85f4e0..a07f70265c 100644 --- a/py/maketranslationdata.py +++ b/py/maketranslationdata.py @@ -10,6 +10,7 @@ supervisor/shared/translate/translate.h from __future__ import print_function import bisect +from dataclasses import dataclass import re import sys @@ -83,6 +84,7 @@ C_ESCAPES = { '"': '\\"', } + # this must match the equivalent function in qstr.c def compute_hash(qstr, bytes_hash): hash = 5381 @@ -146,15 +148,69 @@ def iter_substrings(s, minlen, maxlen): yield s[begin : begin + n] -def compute_huffman_coding(translations, f): +translation_requires_uint16 = {"cs", "ja", "ko", "pl", "tr", "zh_Latn_pinyin"} + + +def compute_unicode_offset(texts): + all_ch = set(" ".join(texts)) + ch_160 = sorted(c for c in all_ch if 160 <= ord(c) < 255) + ch_256 = sorted(c for c in all_ch if 255 < ord(c)) + if not ch_256: + return 0, 0 + min_256 = ord(min(ch_256)) + span = ord(max(ch_256)) - ord(min(ch_256)) + 1 + + if ch_160: + max_160 = ord(max(ch_160)) + 1 + else: + max_160 = max(160, 255 - span) + + if max_160 + span > 256: + return 0, 0 + + offstart = max_160 + offset = min_256 - max_160 + return offstart, offset + + +@dataclass +class EncodingTable: + values: object + lengths: object + words: object + canonical: object + extractor: object + apply_offset: object + remove_offset: object + + +def compute_huffman_coding(translation_name, translations, f): texts = [t[1] for t in translations] words = [] start_unused = 0x80 end_unused = 0xFF max_ord = 0 + offstart, offset = compute_unicode_offset(texts) + + def apply_offset(c): + oc = ord(c) + if oc >= offstart: + oc += offset + return chr(oc) + + def remove_offset(c): + oc = ord(c) + if oc >= offstart: + oc = oc - offset + try: + return chr(oc) + except Exception as e: + raise ValueError(f"remove_offset {offstart=} {oc=}") from e + for text in texts: for c in text: + c = remove_offset(c) ord_c = ord(c) max_ord = max(ord_c, max_ord) if 0x80 <= ord_c < 0xFF: @@ -163,6 +219,12 @@ def compute_huffman_coding(translations, f): bits_per_codepoint = 16 if max_ord > 255 else 8 values_type = "uint16_t" if max_ord > 255 else "uint8_t" + translation_name = translation_name.split("/")[-1].split(".")[0] + if max_ord > 255 and translation_name not in translation_requires_uint16: + raise ValueError( + f"Translation {translation_name} expected to fit in 8 bits but required 16 bits" + ) + 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. @@ -216,7 +278,7 @@ def compute_huffman_coding(translations, f): counter = collections.Counter() for t in texts: - for (found, word) in extractor.iter_words(t): + for found, word in extractor.iter_words(t): if not found: for substr in iter_substrings(word, minlen=2, maxlen=11): counter[substr] += 1 @@ -267,15 +329,17 @@ def compute_huffman_coding(translations, f): 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) + canonical[atom] = "{0:0{width}b}".format(renumbered, width=length) if len(atom) > 1: o = words.index(atom) + 0x80 s = "".join(C_ESCAPES.get(ch1, ch1) for ch1 in atom) + f.write(f"// {o} {s} {counter[atom]} {canonical[atom]} {renumbered}\n") else: s = C_ESCAPES.get(atom, atom) + canonical[atom] = "{0:0{width}b}".format(renumbered, width=length) o = ord(atom) - f.write(f"// {o} {s} {counter[atom]} {canonical[atom]} {renumbered}\n") + f.write(f"// {o} {s} {counter[atom]} {canonical[atom]} {renumbered}\n") renumbered += 1 last_length = length lengths = bytearray() @@ -297,7 +361,11 @@ def compute_huffman_coding(translations, f): 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( + "const mchar_t values[] = {{ {} }};\n".format( + ", ".join(str(ord(remove_offset(u))) for u in values) + ) + ) f.write( "#define compress_max_length_bits ({})\n".format( max_translation_encoded_length.bit_length() @@ -305,7 +373,7 @@ def compute_huffman_coding(translations, f): ) f.write( "const mchar_t words[] = {{ {} }};\n".format( - ", ".join(str(ord(c)) for w in words for c in w) + ", ".join(str(ord(remove_offset(c))) for w in words for c in w) ) ) f.write("const uint8_t wlencount[] = {{ {} }};\n".format(", ".join(str(p) for p in wlencount))) @@ -313,12 +381,17 @@ def compute_huffman_coding(translations, f): f.write("#define word_end {}\n".format(word_end)) f.write("#define minlen {}\n".format(minlen)) f.write("#define maxlen {}\n".format(maxlen)) + f.write("#define translation_offstart {}\n".format(offstart)) + f.write("#define translation_offset {}\n".format(offset)) - return (values, lengths, words, canonical, extractor) + return EncodingTable(values, lengths, words, canonical, extractor, apply_offset, remove_offset) def decompress(encoding_table, encoded, encoded_length_bits): - (values, lengths, words, _, _) = encoding_table + values = encoding_table.values + lengths = encoding_table.lengths + words = encoding_table.words + dec = [] this_byte = 0 this_bit = 7 @@ -376,7 +449,8 @@ def decompress(encoding_table, encoded, encoded_length_bits): def compress(encoding_table, decompressed, encoded_length_bits, len_translation_encoded): if not isinstance(decompressed, str): raise TypeError() - (_, _, _, canonical, extractor) = encoding_table + canonical = encoding_table.canonical + extractor = encoding_table.extractor enc = bytearray(len(decompressed) * 3) current_bit = 7 @@ -522,5 +596,7 @@ if __name__ == "__main__": i18ns = parse_input_headers(args.infiles) i18ns = sorted(i18ns) translations = translate(args.translation, i18ns) - encoding_table = compute_huffman_coding(translations, args.compression_filename) + encoding_table = compute_huffman_coding( + args.translation, translations, args.compression_filename + ) output_translation_data(encoding_table, translations, args.translation_filename) diff --git a/py/modmath.c b/py/modmath.c index 167d46d02b..bf27e68eaf 100644 --- a/py/modmath.c +++ b/py/modmath.c @@ -254,7 +254,7 @@ STATIC mp_obj_t mp_math_log(size_t n_args, const mp_obj_t *args) { if (base <= (mp_float_t)0.0) { math_error(); } else if (base == (mp_float_t)1.0) { - mp_raise_msg(&mp_type_ZeroDivisionError, MP_ERROR_TEXT("division by zero")); + mp_raise_ZeroDivisionError(); } return mp_obj_new_float(l / MICROPY_FLOAT_C_FUN(log)(base)); } diff --git a/py/mpconfig.h b/py/mpconfig.h index 386a9765eb..9d68f4ce9d 100644 --- a/py/mpconfig.h +++ b/py/mpconfig.h @@ -773,6 +773,16 @@ typedef long long mp_longint_impl_t; #define MICROPY_WARNINGS (0) #endif +// Whether to support chained exceptions +#ifndef MICROPY_CPYTHON_EXCEPTION_CHAIN +#define MICROPY_CPYTHON_EXCEPTION_CHAIN (0) +#endif + +// Whether the statically allocated GeneratorExit exception may be const +#ifndef MICROPY_CONST_GENERATOREXIT_OBJ +#define MICROPY_CONST_GENERATOREXIT_OBJ (!MICROPY_CPYTHON_EXCEPTION_CHAIN) +#endif + // Whether to support warning categories #ifndef MICROPY_WARNINGS_CATEGORY #define MICROPY_WARNINGS_CATEGORY (0) diff --git a/py/nlrthumb.c b/py/nlrthumb.c index 30f9f2c196..4b20d30c6e 100644 --- a/py/nlrthumb.c +++ b/py/nlrthumb.c @@ -36,7 +36,7 @@ // For reference, arm/thumb callee save regs are: // r4-r11, r13=sp -__attribute__((naked)) unsigned int nlr_push(nlr_buf_t *nlr) { +__attribute__((naked, returns_twice)) unsigned int nlr_push(nlr_buf_t *nlr) { __asm volatile ( "str r4, [r0, #12] \n" // store r4 into nlr_buf diff --git a/py/obj.c b/py/obj.c index af2f4c1b68..c394656016 100644 --- a/py/obj.c +++ b/py/obj.c @@ -142,9 +142,33 @@ void mp_obj_print(mp_obj_t o_in, mp_print_kind_t kind) { mp_obj_print_helper(MP_PYTHON_PRINTER, o_in, kind); } +static void mp_obj_print_inner_exception(const mp_print_t *print, mp_obj_t self_in, mp_int_t limit) { + #if MICROPY_CPYTHON_EXCEPTION_CHAIN + mp_obj_exception_t *self = mp_obj_exception_get_native(self_in); + const compressed_string_t *msg = MP_ERROR_TEXT("During handling of the above exception, another exception occurred:"); + mp_obj_exception_t *inner = NULL; + if (self->cause) { + msg = MP_ERROR_TEXT("The above exception was the direct cause of the following exception:"); + inner = self->cause; + } else if (!self->suppress_context) { + inner = self->context; + } + if (inner && !inner->marked) { + inner->marked = true; + mp_obj_print_exception_with_limit(print, MP_OBJ_FROM_PTR(inner), limit); + inner->marked = false; + mp_printf(print, "\n"); + mp_cprintf(print, msg); + mp_printf(print, "\n\n"); + } + #endif +} + // helper function to print an exception with traceback void mp_obj_print_exception_with_limit(const mp_print_t *print, mp_obj_t exc, mp_int_t limit) { if (mp_obj_is_exception_instance(exc) && stack_ok()) { + mp_obj_print_inner_exception(print, exc, limit); + size_t n, *values; mp_obj_exception_get_traceback(exc, &n, &values); if (n > 0) { @@ -497,7 +521,7 @@ size_t mp_get_index(const mp_obj_type_t *type, size_t len, mp_obj_t index, bool if (mp_obj_is_small_int(index)) { i = MP_OBJ_SMALL_INT_VALUE(index); } else if (!mp_obj_get_int_maybe(index, &i)) { - mp_raise_TypeError_varg(translate("%q must be of type %q"), MP_QSTR_index, MP_QSTR_int); + mp_raise_TypeError_varg(MP_ERROR_TEXT("%q must be of type %q, not %q"), MP_QSTR_index, MP_QSTR_int, mp_obj_get_type(index)->name); } if (i < 0) { diff --git a/py/obj.h b/py/obj.h index 7fa21f5e38..b7e76a1106 100644 --- a/py/obj.h +++ b/py/obj.h @@ -791,7 +791,9 @@ extern const struct _mp_obj_dict_t mp_const_empty_dict_obj; extern const struct _mp_obj_traceback_t mp_const_empty_traceback_obj; extern const struct _mp_obj_singleton_t mp_const_ellipsis_obj; extern const struct _mp_obj_singleton_t mp_const_notimplemented_obj; -extern const struct _mp_obj_exception_t mp_const_GeneratorExit_obj; +#if MICROPY_CONST_GENERATOREXIT_OBJ +extern const struct _mp_obj_exception_t mp_static_GeneratorExit_obj; +#endif // Fixed empty map. Useful when calling keyword-receiving functions // without any keywords from C, etc. diff --git a/py/objarray.c b/py/objarray.c index a66a73a5ac..763ec15cdb 100644 --- a/py/objarray.c +++ b/py/objarray.c @@ -458,26 +458,32 @@ STATIC mp_obj_t array_extend(mp_obj_t self_in, mp_obj_t arg_in) { // allow to extend by anything that has the buffer protocol (extension to CPython) mp_buffer_info_t arg_bufinfo; - mp_get_buffer_raise(arg_in, &arg_bufinfo, MP_BUFFER_READ); + if (mp_get_buffer(arg_in, &arg_bufinfo, MP_BUFFER_READ)) { + size_t sz = mp_binary_get_size('@', self->typecode, NULL); - size_t sz = mp_binary_get_size('@', self->typecode, NULL); + // convert byte count to element count + size_t len = arg_bufinfo.len / sz; - // convert byte count to element count - size_t len = arg_bufinfo.len / sz; + // make sure we have enough room to extend + // TODO: alloc policy; at the moment we go conservative + if (self->free < len) { + self->items = m_renew(byte, self->items, (self->len + self->free) * sz, (self->len + len) * sz); + self->free = 0; + } else { + self->free -= len; + } - // make sure we have enough room to extend - // TODO: alloc policy; at the moment we go conservative - if (self->free < len) { - self->items = m_renew(byte, self->items, (self->len + self->free) * sz, (self->len + len) * sz); - self->free = 0; + // extend + mp_seq_copy((byte *)self->items + self->len * sz, arg_bufinfo.buf, len * sz, byte); + self->len += len; } else { - self->free -= len; + // Otherwise argument must be an iterable of items to append + mp_obj_t iterable = mp_getiter(arg_in, NULL); + mp_obj_t item; + while ((item = mp_iternext(iterable)) != MP_OBJ_STOP_ITERATION) { + array_append(self_in, item); + } } - - // extend - mp_seq_copy((byte *)self->items + self->len * sz, arg_bufinfo.buf, len * sz, byte); - self->len += len; - return mp_const_none; } STATIC MP_DEFINE_CONST_FUN_OBJ_2(array_extend_obj, array_extend); diff --git a/py/objcomplex.c b/py/objcomplex.c index f205249bb4..7f4fd621e6 100644 --- a/py/objcomplex.c +++ b/py/objcomplex.c @@ -217,7 +217,7 @@ mp_obj_t mp_obj_complex_binary_op(mp_binary_op_t op, mp_float_t lhs_real, mp_flo case MP_BINARY_OP_INPLACE_TRUE_DIVIDE: if (rhs_imag == 0) { if (rhs_real == 0) { - mp_raise_msg(&mp_type_ZeroDivisionError, MP_ERROR_TEXT("complex division by zero")); + mp_raise_ZeroDivisionError(); } lhs_real /= rhs_real; lhs_imag /= rhs_real; diff --git a/py/objexcept.c b/py/objexcept.c index 32dacbb17a..24fb564e23 100644 --- a/py/objexcept.c +++ b/py/objexcept.c @@ -155,6 +155,12 @@ void mp_obj_exception_print(const mp_print_t *print, mp_obj_t o_in, mp_print_kin mp_obj_tuple_print(print, MP_OBJ_FROM_PTR(o->args), kind); } +void mp_obj_exception_initialize0(mp_obj_exception_t *o_exc, const mp_obj_type_t *type) { + o_exc->base.type = type; + o_exc->args = (mp_obj_tuple_t *)&mp_const_empty_tuple_obj; + mp_obj_exception_clear_traceback(o_exc); +} + mp_obj_t mp_obj_exception_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, 0, MP_OBJ_FUN_ARGS_MAX, false); @@ -218,19 +224,45 @@ void mp_obj_exception_attr(mp_obj_t self_in, qstr attr, mp_obj_t *dest) { mp_obj_exception_t *self = MP_OBJ_TO_PTR(self_in); if (dest[0] != MP_OBJ_NULL) { // store/delete attribute - if (self == &mp_const_GeneratorExit_obj) { + #if MICROPY_CONST_GENERATOREXIT_OBJ + if (self == &mp_static_GeneratorExit_obj) { mp_raise_AttributeError(MP_ERROR_TEXT("can't set attribute")); } + #endif if (attr == MP_QSTR___traceback__) { if (dest[1] == mp_const_none) { self->traceback = (mp_obj_traceback_t *)&mp_const_empty_traceback_obj; } else { if (!mp_obj_is_type(dest[1], &mp_type_traceback)) { - mp_raise_TypeError(MP_ERROR_TEXT("invalid traceback")); + mp_raise_TypeError_varg(MP_ERROR_TEXT("%q must be of type %q or %q, not %q"), MP_QSTR___context__, MP_QSTR_traceback, MP_QSTR_None, mp_obj_get_type(dest[1])->name); } self->traceback = MP_OBJ_TO_PTR(dest[1]); } dest[0] = MP_OBJ_NULL; // indicate success + #if MICROPY_CPYTHON_EXCEPTION_CHAIN + } else if (attr == MP_QSTR___cause__) { + if (dest[1] == mp_const_none) { + self->cause = NULL; + } else if (!mp_obj_is_type(dest[1], &mp_type_BaseException)) { + self->cause = dest[1]; + } else { + mp_raise_TypeError_varg(MP_ERROR_TEXT("%q must be of type %q or %q, not %q"), attr, MP_QSTR_BaseException, MP_QSTR_None, mp_obj_get_type(dest[1])->name); + } + self->suppress_context = true; + dest[0] = MP_OBJ_NULL; // indicate success + } else if (attr == MP_QSTR___context__) { + if (dest[1] == mp_const_none) { + self->context = NULL; + } else if (!mp_obj_is_type(dest[1], &mp_type_BaseException)) { + self->context = dest[1]; + } else { + mp_raise_TypeError_varg(MP_ERROR_TEXT("%q must be of type %q or %q, not %q"), attr, MP_QSTR_BaseException, MP_QSTR_None, mp_obj_get_type(dest[1])->name); + } + dest[0] = MP_OBJ_NULL; // indicate success + } else if (attr == MP_QSTR___suppress_context__) { + self->suppress_context = mp_obj_is_true(dest[1]); + dest[0] = MP_OBJ_NULL; // indicate success + #endif } return; } @@ -240,6 +272,14 @@ void mp_obj_exception_attr(mp_obj_t self_in, qstr attr, mp_obj_t *dest) { dest[0] = mp_obj_exception_get_value(self_in); } else if (attr == MP_QSTR___traceback__) { dest[0] = (self->traceback) ? MP_OBJ_FROM_PTR(self->traceback) : mp_const_none; + #if MICROPY_CPYTHON_EXCEPTION_CHAIN + } else if (attr == MP_QSTR___cause__) { + dest[0] = (self->cause) ? MP_OBJ_FROM_PTR(self->cause) : mp_const_none; + } else if (attr == MP_QSTR___context__) { + dest[0] = (self->context) ? MP_OBJ_FROM_PTR(self->context) : mp_const_none; + } else if (attr == MP_QSTR___suppress_context__) { + dest[0] = mp_obj_new_bool(self->suppress_context); + #endif #if MICROPY_CPYTHON_COMPAT } else if (mp_obj_is_subclass_fast(MP_OBJ_FROM_PTR(self->base.type), MP_OBJ_FROM_PTR(&mp_type_OSError))) { if (attr == MP_QSTR_errno) { @@ -549,6 +589,12 @@ void mp_obj_exception_clear_traceback(mp_obj_t self_in) { // just set the traceback to the empty traceback object // we don't want to call any memory management functions here self->traceback = (mp_obj_traceback_t *)&mp_const_empty_traceback_obj; + #if MICROPY_CPYTHON_EXCEPTION_CHAIN + self->cause = 0; + self->context = 0; + self->suppress_context = false; + self->marked = false; + #endif } void mp_obj_exception_add_traceback(mp_obj_t self_in, qstr file, size_t line, qstr block) { diff --git a/py/objexcept.h b/py/objexcept.h index f28f50f5dc..1230fdf18a 100644 --- a/py/objexcept.h +++ b/py/objexcept.h @@ -34,10 +34,16 @@ typedef struct _mp_obj_exception_t { mp_obj_base_t base; mp_obj_tuple_t *args; mp_obj_traceback_t *traceback; + #if MICROPY_CPYTHON_EXCEPTION_CHAIN + struct _mp_obj_exception_t *cause, *context; + bool suppress_context; + bool marked; + #endif } mp_obj_exception_t; void mp_obj_exception_print(const mp_print_t *print, mp_obj_t o_in, mp_print_kind_t kind); void mp_obj_exception_attr(mp_obj_t self_in, qstr attr, mp_obj_t *dest); +void mp_obj_exception_initialize0(mp_obj_exception_t *o_exc, const mp_obj_type_t *type); mp_obj_exception_t *mp_obj_exception_get_native(mp_obj_t self_in); #define MP_DEFINE_EXCEPTION(exc_name, base_name) \ diff --git a/py/objfloat.c b/py/objfloat.c index f8261df933..7aebcfdeb2 100644 --- a/py/objfloat.c +++ b/py/objfloat.c @@ -266,7 +266,7 @@ mp_obj_t mp_obj_float_binary_op(mp_binary_op_t op, mp_float_t lhs_val, mp_obj_t case MP_BINARY_OP_INPLACE_FLOOR_DIVIDE: if (rhs_val == 0) { zero_division_error: - mp_raise_msg(&mp_type_ZeroDivisionError, MP_ERROR_TEXT("divide by zero")); + mp_raise_ZeroDivisionError(); } // Python specs require that x == (x//y)*y + (x%y) so we must // call divmod to compute the correct floor division, which diff --git a/py/objgenerator.c b/py/objgenerator.c index c9af11fbb5..7c3ec99307 100644 --- a/py/objgenerator.c +++ b/py/objgenerator.c @@ -38,7 +38,13 @@ #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}; +#if MICROPY_CONST_GENERATOREXIT_OBJ +const +mp_obj_exception_t mp_static_GeneratorExit_obj = {{&mp_type_GeneratorExit}, (mp_obj_tuple_t *)&mp_const_empty_tuple_obj, (mp_obj_traceback_t *)&mp_const_empty_traceback_obj}; +#else +static +mp_obj_exception_t mp_static_GeneratorExit_obj; +#endif /******************************************************************************/ /* generator wrapper */ @@ -362,9 +368,17 @@ STATIC mp_obj_t gen_instance_throw(size_t n_args, const mp_obj_t *args) { } STATIC MP_DEFINE_CONST_FUN_OBJ_VAR_BETWEEN(gen_instance_throw_obj, 2, 4, gen_instance_throw); +static mp_obj_t generatorexit(void) { + #if MICROPY_CPYTHON_EXCEPTION_CHAIN + MP_STATIC_ASSERT(!MICROPY_CONST_GENERATOREXIT_OBJ); + mp_obj_exception_initialize0(&mp_static_GeneratorExit_obj, &mp_type_GeneratorExit); + #endif + return MP_OBJ_FROM_PTR(&mp_static_GeneratorExit_obj); +} + STATIC mp_obj_t gen_instance_close(mp_obj_t self_in) { mp_obj_t ret; - switch (mp_obj_gen_resume(self_in, mp_const_none, MP_OBJ_FROM_PTR(&mp_const_GeneratorExit_obj), &ret)) { + switch (mp_obj_gen_resume(self_in, mp_const_none, generatorexit(), &ret)) { case MP_VM_RETURN_YIELD: mp_raise_msg(&mp_type_RuntimeError, MP_ERROR_TEXT("generator ignored GeneratorExit")); diff --git a/py/objint.c b/py/objint.c index b44a2e3b4a..6dc675823f 100644 --- a/py/objint.c +++ b/py/objint.c @@ -396,7 +396,7 @@ mp_obj_t mp_obj_int_binary_op(mp_binary_op_t op, mp_obj_t lhs_in, mp_obj_t rhs_i // This is called only with strings whose value doesn't fit in SMALL_INT mp_obj_t mp_obj_new_int_from_str_len(const char **str, size_t len, bool neg, unsigned int base) { - mp_raise_msg(&mp_type_OverflowError, MP_ERROR_TEXT("long int not supported in this build")); + mp_raise_msg(&mp_type_OverflowError, MP_ERROR_TEXT("small int overflow")); return mp_const_none; } diff --git a/py/objint_longlong.c b/py/objint_longlong.c index 67ec844f47..d318eab38e 100644 --- a/py/objint_longlong.c +++ b/py/objint_longlong.c @@ -236,7 +236,7 @@ mp_obj_t mp_obj_int_binary_op(mp_binary_op_t op, mp_obj_t lhs_in, mp_obj_t rhs_i } zero_division: - mp_raise_msg(&mp_type_ZeroDivisionError, MP_ERROR_TEXT("division by zero")); + mp_raise_ZeroDivisionError(); } mp_obj_t mp_obj_new_int(mp_int_t value) { diff --git a/py/objint_mpz.c b/py/objint_mpz.c index fd74803fe7..e147e5f08a 100644 --- a/py/objint_mpz.c +++ b/py/objint_mpz.c @@ -244,7 +244,7 @@ mp_obj_t mp_obj_int_binary_op(mp_binary_op_t op, mp_obj_t lhs_in, mp_obj_t rhs_i case MP_BINARY_OP_INPLACE_FLOOR_DIVIDE: { if (mpz_is_zero(zrhs)) { zero_division_error: - mp_raise_msg(&mp_type_ZeroDivisionError, MP_ERROR_TEXT("divide by zero")); + mp_raise_ZeroDivisionError(); } mpz_t rem; mpz_init_zero(&rem); diff --git a/py/objrange.c b/py/objrange.c index b0c74815dc..78a5fcd0f8 100644 --- a/py/objrange.c +++ b/py/objrange.c @@ -110,7 +110,7 @@ STATIC mp_obj_t range_make_new(const mp_obj_type_t *type, size_t n_args, size_t if (n_args == 3) { o->step = mp_obj_get_int(args[2]); if (o->step == 0) { - mp_raise_ValueError(MP_ERROR_TEXT("zero step")); + mp_raise_ValueError_varg(MP_ERROR_TEXT("%q step cannot be zero"), MP_QSTR_range); } } } diff --git a/py/objslice.c b/py/objslice.c index 3172f798c0..395af727e8 100644 --- a/py/objslice.c +++ b/py/objslice.c @@ -157,7 +157,7 @@ void mp_obj_slice_indices(mp_obj_t self_in, mp_int_t length, mp_bound_slice_t *r } else { step = mp_obj_get_int(self->step); if (step == 0) { - mp_raise_ValueError(MP_ERROR_TEXT("slice step cannot be zero")); + mp_raise_ValueError_varg(MP_ERROR_TEXT("%q step cannot be zero"), MP_QSTR_slice); } } diff --git a/py/objstrunicode.c b/py/objstrunicode.c index 0f26da62cf..b3b23d0f01 100644 --- a/py/objstrunicode.c +++ b/py/objstrunicode.c @@ -159,7 +159,7 @@ const byte *str_index_to_ptr(const mp_obj_type_t *type, const byte *self_data, s if (mp_obj_is_small_int(index)) { i = MP_OBJ_SMALL_INT_VALUE(index); } else if (!mp_obj_get_int_maybe(index, &i)) { - mp_raise_TypeError_varg(MP_ERROR_TEXT("string indices must be integers, not %q"), mp_obj_get_type_qstr(index)); + mp_raise_TypeError_varg(MP_ERROR_TEXT("%q must be of type %q, not %q"), MP_QSTR_index, MP_QSTR_int, mp_obj_get_type(index)->name); } const byte *s, *top = self_data + self_len; if (i < 0) { diff --git a/py/objtype.c b/py/objtype.c index 0914ad5f2e..76b9551be8 100644 --- a/py/objtype.c +++ b/py/objtype.c @@ -106,7 +106,9 @@ STATIC mp_obj_t native_base_init_wrapper(size_t n_args, const mp_obj_t *pos_args // copy in args memcpy(args2, pos_args, n_args * sizeof(mp_obj_t)); // copy in kwargs - memcpy(args2 + n_args, kw_args->table, 2 * n_kw * sizeof(mp_obj_t)); + if (n_kw) { + memcpy(args2 + n_args, kw_args->table, 2 * n_kw * sizeof(mp_obj_t)); + } self->subobj[0] = native_base->make_new(native_base, n_args, n_kw, args2); m_del(mp_obj_t, args2, n_args + 2 * n_kw); diff --git a/py/parsenum.c b/py/parsenum.c index adf2a4d84d..24d46705a7 100644 --- a/py/parsenum.c +++ b/py/parsenum.c @@ -55,9 +55,9 @@ mp_obj_t mp_parse_num_integer(const char *restrict str_, size_t len, int base, m mp_obj_t ret_val; // check radix base - if ((base != 0 && base < 2) || base > 36) { + if (base != 0) { // this won't be reached if lex!=NULL - mp_raise_ValueError(MP_ERROR_TEXT("int() arg 2 must be >= 2 and <= 36")); + mp_arg_validate_int_range(base, 2, 36, MP_QSTR_base); } // skip leading space diff --git a/py/py.mk b/py/py.mk index 6827fbe786..c598f44cbd 100644 --- a/py/py.mk +++ b/py/py.mk @@ -243,7 +243,7 @@ $(HEADER_BUILD)/mpversion.h: FORCE | $(HEADER_BUILD) MPCONFIGPORT_MK = $(wildcard mpconfigport.mk) $(HEADER_BUILD)/$(TRANSLATION).mo: $(TOP)/locale/$(TRANSLATION).po | $(HEADER_BUILD) - $(Q)msgfmt -o $@ $^ + $(Q)$(PYTHON) $(TOP)/tools/msgfmt.py -o $@ $^ $(HEADER_BUILD)/qstrdefs.preprocessed.h: $(PY_QSTR_DEFS) $(QSTR_DEFS) $(QSTR_DEFS_COLLECTED) mpconfigport.h $(MPCONFIGPORT_MK) $(PY_SRC)/mpconfig.h | $(HEADER_BUILD) $(STEPECHO) "GEN $@" @@ -262,8 +262,15 @@ $(HEADER_BUILD)/qstrdefs.generated.h: $(PY_SRC)/makeqstrdata.py $(HEADER_BUILD)/ $(STEPECHO) "GEN $@" $(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 +# Is generated as a side-effect of building compression.generated.h +# Specifying both in a single rule actually causes the rule to be run twice! +# This alternative makes it run just once. +$(PY_BUILD)/translations-$(TRANSLATION).c: $(HEADER_BUILD)/compression.generated.h + @true + +$(HEADER_BUILD)/compression.generated.h: $(PY_SRC)/maketranslationdata.py $(HEADER_BUILD)/$(TRANSLATION).mo $(HEADER_BUILD)/qstrdefs.preprocessed.h $(STEPECHO) "GEN $@" + $(Q)mkdir -p $(PY_BUILD) $(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 diff --git a/py/qstrdefs.h b/py/qstrdefs.h index 02b87f4ec3..70753866bd 100644 --- a/py/qstrdefs.h +++ b/py/qstrdefs.h @@ -49,7 +49,6 @@ Q({:#x}) Q({:#b}) Q( ) Q(\n) -Q(maximum recursion depth exceeded) Q() Q() Q() @@ -63,7 +62,3 @@ Q(utf-8) #if MICROPY_MODULE_FROZEN Q(.frozen) #endif - -#if MICROPY_ENABLE_PYSTACK -Q(pystack exhausted) -#endif diff --git a/py/runtime.c b/py/runtime.c index e5b411b0d3..9227594d83 100644 --- a/py/runtime.c +++ b/py/runtime.c @@ -78,14 +78,10 @@ void mp_init(void) { #if MICROPY_KBD_EXCEPTION // initialise the exception object for raising KeyboardInterrupt - MP_STATE_VM(mp_kbd_exception).base.type = &mp_type_KeyboardInterrupt; - MP_STATE_VM(mp_kbd_exception).args = (mp_obj_tuple_t *)&mp_const_empty_tuple_obj; - MP_STATE_VM(mp_kbd_exception).traceback = (mp_obj_traceback_t *)&mp_const_empty_traceback_obj; + mp_obj_exception_initialize0(&MP_STATE_VM(mp_kbd_exception), &mp_type_KeyboardInterrupt); #endif - MP_STATE_VM(mp_reload_exception).base.type = &mp_type_ReloadException; - MP_STATE_VM(mp_reload_exception).args = (mp_obj_tuple_t *)&mp_const_empty_tuple_obj; - MP_STATE_VM(mp_reload_exception).traceback = (mp_obj_traceback_t *)&mp_const_empty_traceback_obj; + mp_obj_exception_initialize0(&MP_STATE_VM(mp_reload_exception), &mp_type_ReloadException); // call port specific initialization if any #ifdef MICROPY_PORT_INIT_FUNC @@ -310,7 +306,7 @@ mp_obj_t mp_unary_op(mp_unary_op_t op, mp_obj_t arg) { } #else if (op == MP_UNARY_OP_INT) { - mp_raise_TypeError_varg(MP_ERROR_TEXT("can't convert %q to int"), mp_obj_get_type_qstr(arg)); + mp_raise_TypeError_varg(MP_ERROR_TEXT("can't convert %q to %q"), mp_obj_get_type_qstr(arg), MP_QSTR_int); } else { mp_raise_TypeError_varg(MP_ERROR_TEXT("unsupported type for %q: '%q'"), mp_unary_op_method_name[op], mp_obj_get_type_qstr(arg)); @@ -631,7 +627,7 @@ unsupported_op: #endif zero_division: - mp_raise_msg(&mp_type_ZeroDivisionError, MP_ERROR_TEXT("division by zero")); + mp_raise_ZeroDivisionError(); } mp_obj_t mp_call_function_0(mp_obj_t fun) { @@ -1247,8 +1243,8 @@ void mp_store_attr(mp_obj_t base, qstr attr, mp_obj_t value) { mp_raise_AttributeError(MP_ERROR_TEXT("no such attribute")); #else mp_raise_msg_varg(&mp_type_AttributeError, - MP_ERROR_TEXT("'%s' object has no attribute '%q'"), - mp_obj_get_type_str(base), attr); + MP_ERROR_TEXT("can't set attribute '%q'"), + attr); #endif } @@ -1765,3 +1761,7 @@ NORETURN void mp_raise_recursion_depth(void) { mp_raise_RuntimeError(MP_ERROR_TEXT("maximum recursion depth exceeded")); } #endif + +NORETURN void mp_raise_ZeroDivisionError(void) { + mp_raise_msg(&mp_type_ZeroDivisionError, MP_ERROR_TEXT("division by zero")); +} diff --git a/py/runtime.h b/py/runtime.h index 923071f7ca..1a7a5d1698 100644 --- a/py/runtime.h +++ b/py/runtime.h @@ -91,7 +91,9 @@ static inline void mp_arg_check_num(size_t n_args, size_t n_kw, size_t n_args_mi } void mp_arg_parse_all(size_t n_pos, const mp_obj_t *pos, mp_map_t *kws, size_t n_allowed, const mp_arg_t *allowed, mp_arg_val_t *out_vals); void mp_arg_parse_all_kw_array(size_t n_pos, size_t n_kw, const mp_obj_t *args, size_t n_allowed, const mp_arg_t *allowed, mp_arg_val_t *out_vals); +#if MICROPY_ERROR_REPORTING <= MICROPY_ERROR_REPORTING_TERSE NORETURN void mp_arg_error_terse_mismatch(void); +#endif NORETURN void mp_arg_error_unimpl_kw(void); NORETURN void mp_arg_error_invalid(qstr arg_name); @@ -108,6 +110,8 @@ mp_uint_t mp_arg_validate_length_range(mp_uint_t length, mp_uint_t min, mp_uint_ 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_type_in(mp_obj_t obj, const mp_obj_type_t *type, qstr arg_name); +mp_obj_t mp_arg_validate_type_or_none(mp_obj_t obj, const mp_obj_type_t *type, 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); @@ -226,6 +230,7 @@ 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_recursion_depth(void); +NORETURN void mp_raise_ZeroDivisionError(void); #endif #if MICROPY_BUILTIN_METHOD_CHECK_SELF_ARG diff --git a/py/vm.c b/py/vm.c index 12a0f2d445..2663b5fd68 100644 --- a/py/vm.c +++ b/py/vm.c @@ -183,6 +183,15 @@ #define TRACE_TICK(current_ip, current_sp, is_exception) #endif // MICROPY_PY_SYS_SETTRACE +STATIC mp_obj_t get_active_exception(mp_exc_stack_t *exc_sp, mp_exc_stack_t *exc_stack) { + for (mp_exc_stack_t *e = exc_sp; e >= exc_stack; --e) { + if (e->prev_exc != NULL) { + return MP_OBJ_FROM_PTR(e->prev_exc); + } + } + return MP_OBJ_NULL; +} + // fastn has items in reverse order (fastn[0] is local[0], fastn[-1] is local[1], etc) // sp points to bottom of stack which grows up // returns: @@ -1129,13 +1138,7 @@ unwind_return: ENTRY(MP_BC_RAISE_LAST): { MARK_EXC_IP_SELECTIVE(); // search for the inner-most previous exception, to reraise it - mp_obj_t obj = MP_OBJ_NULL; - for (mp_exc_stack_t *e = exc_sp; e >= exc_stack; --e) { - if (e->prev_exc != NULL) { - obj = MP_OBJ_FROM_PTR(e->prev_exc); - break; - } - } + mp_obj_t obj = get_active_exception(exc_sp, exc_stack); if (obj == MP_OBJ_NULL) { obj = mp_obj_new_exception_msg(&mp_type_RuntimeError, MP_ERROR_TEXT("no active exception to reraise")); } @@ -1145,14 +1148,30 @@ unwind_return: ENTRY(MP_BC_RAISE_OBJ): { MARK_EXC_IP_SELECTIVE(); mp_obj_t obj = mp_make_raise_obj(TOP()); + #if MICROPY_CPYTHON_EXCEPTION_CHAIN + mp_obj_t active_exception = get_active_exception(exc_sp, exc_stack); + if (active_exception != MP_OBJ_NULL && active_exception != obj) { + mp_store_attr(obj, MP_QSTR___context__, active_exception); + } + #endif RAISE(obj); } ENTRY(MP_BC_RAISE_FROM): { MARK_EXC_IP_SELECTIVE(); - mp_warning(NULL, "exception chaining not supported"); - sp--; // ignore (pop) "from" argument + mp_obj_t cause = POP(); mp_obj_t obj = mp_make_raise_obj(TOP()); + #if MICROPY_CPYTHON_EXCEPTION_CHAIN + // search for the inner-most previous exception, to chain it + mp_obj_t active_exception = get_active_exception(exc_sp, exc_stack); + if (active_exception != MP_OBJ_NULL && active_exception != obj) { + mp_store_attr(obj, MP_QSTR___context__, active_exception); + } + mp_store_attr(obj, MP_QSTR___cause__, cause); + #else + (void)cause; + mp_warning(NULL, "exception chaining not supported"); + #endif RAISE(obj); } @@ -1391,7 +1410,10 @@ unwind_loop: // - constant GeneratorExit object, because it's const // - exceptions re-raised by END_FINALLY // - exceptions re-raised explicitly by "raise" - if (nlr.ret_val != &mp_const_GeneratorExit_obj + if ( true + #if MICROPY_CONST_GENERATOREXIT_OBJ + && nlr.ret_val != &mp_static_GeneratorExit_obj + #endif && *code_state->ip != MP_BC_END_FINALLY && *code_state->ip != MP_BC_RAISE_LAST) { const byte *ip = code_state->fun_bc->bytecode; @@ -1434,10 +1456,19 @@ unwind_loop: // catch exception and pass to byte code code_state->ip = exc_sp->handler; mp_obj_t *sp = MP_TAGPTR_PTR(exc_sp->val_sp); + #if MICROPY_CPYTHON_EXCEPTION_CHAIN + mp_obj_t active_exception = get_active_exception(exc_sp, exc_stack); + #endif // save this exception in the stack so it can be used in a reraise, if needed exc_sp->prev_exc = nlr.ret_val; + mp_obj_t obj = MP_OBJ_FROM_PTR(nlr.ret_val); + #if MICROPY_CPYTHON_EXCEPTION_CHAIN + if (active_exception != MP_OBJ_NULL && active_exception != obj) { + mp_store_attr(obj, MP_QSTR___context__, active_exception); + } + #endif // push exception object so it can be handled by bytecode - PUSH(MP_OBJ_FROM_PTR(nlr.ret_val)); + PUSH(obj); code_state->sp = sp; #if MICROPY_STACKLESS diff --git a/requirements-ci.txt b/requirements-ci.txt index 81deb34beb..2f6e042fb8 100644 --- a/requirements-ci.txt +++ b/requirements-ci.txt @@ -1,2 +1,2 @@ # For uploading artifacts -awscli +# awscli diff --git a/requirements-dev.txt b/requirements-dev.txt index 0dcfad3956..5e8fe3d3f6 100644 --- a/requirements-dev.txt +++ b/requirements-dev.txt @@ -6,6 +6,7 @@ typer sh click cpp-coveralls + requests requests-cache @@ -13,8 +14,8 @@ requests-cache polib # For pre-commit -pyyaml black +pyyaml pre-commit # for combining the Nordic SoftDevice with CircuitPython @@ -23,9 +24,6 @@ intelhex # for building & testing natmods pyelftools -# for stubs and annotations -adafruit-circuitpython-typing - # for mbedtls certificate store cryptography diff --git a/shared-bindings/_bleio/Characteristic.c b/shared-bindings/_bleio/Characteristic.c index e1c5fc3ad5..823250c365 100644 --- a/shared-bindings/_bleio/Characteristic.c +++ b/shared-bindings/_bleio/Characteristic.c @@ -256,7 +256,8 @@ MP_PROPERTY_GETTER(bleio_characteristic_service_obj, //| """Set the remote characteristic's CCCD to enable or disable notification and indication. //| //| :param bool notify: True if Characteristic should receive notifications of remote writes -//| :param float indicate: True if Characteristic should receive indications of remote writes""" +//| :param float indicate: True if Characteristic should receive indications of remote writes +//| """ //| ... STATIC mp_obj_t bleio_characteristic_set_cccd(mp_uint_t n_args, const mp_obj_t *pos_args, mp_map_t *kw_args) { bleio_characteristic_obj_t *self = MP_OBJ_TO_PTR(pos_args[0]); diff --git a/shared-bindings/_bleio/CharacteristicBuffer.c b/shared-bindings/_bleio/CharacteristicBuffer.c index 12853b3ac3..218d72bdbb 100644 --- a/shared-bindings/_bleio/CharacteristicBuffer.c +++ b/shared-bindings/_bleio/CharacteristicBuffer.c @@ -47,7 +47,6 @@ STATIC void raise_error_if_not_connected(bleio_characteristic_buffer_obj_t *self //| def __init__( //| self, characteristic: Characteristic, *, timeout: int = 1, buffer_size: int = 64 //| ) -> None: -//| //| """Monitor the given Characteristic. Each time a new value is written to the Characteristic //| add the newly-written bytes to a FIFO buffer. //| diff --git a/shared-bindings/_bleio/CharacteristicBuffer.h b/shared-bindings/_bleio/CharacteristicBuffer.h index de85f019bc..9dc3252d5a 100644 --- a/shared-bindings/_bleio/CharacteristicBuffer.h +++ b/shared-bindings/_bleio/CharacteristicBuffer.h @@ -27,6 +27,8 @@ #ifndef MICROPY_INCLUDED_SHARED_BINDINGS_BLEIO_CHARACTERISTICBUFFER_H #define MICROPY_INCLUDED_SHARED_BINDINGS_BLEIO_CHARACTERISTICBUFFER_H +#include + #include "common-hal/_bleio/CharacteristicBuffer.h" extern const mp_obj_type_t bleio_characteristic_buffer_type; @@ -35,7 +37,8 @@ void _common_hal_bleio_characteristic_buffer_construct(bleio_characteristic_buff bleio_characteristic_obj_t *characteristic, mp_float_t timeout, uint8_t *buffer, size_t buffer_size, - void *static_handler_entry); + void *static_handler_entry, + bool watch_for_interrupt_char); void common_hal_bleio_characteristic_buffer_construct(bleio_characteristic_buffer_obj_t *self, bleio_characteristic_obj_t *characteristic, mp_float_t timeout, diff --git a/shared-bindings/_bleio/ScanResults.c b/shared-bindings/_bleio/ScanResults.c index b0f37d9fe5..ec4e0c72e8 100644 --- a/shared-bindings/_bleio/ScanResults.c +++ b/shared-bindings/_bleio/ScanResults.c @@ -54,7 +54,8 @@ STATIC mp_obj_t scanresults_iternext(mp_obj_t self_in) { //| ... //| def __next__(self) -> ScanEntry: //| """Returns the next `_bleio.ScanEntry`. Blocks if none have been received and scanning is still -//| active. Raises `StopIteration` if scanning is finished and no other results are available.""" +//| active. Raises `StopIteration` if scanning is finished and no other results are available. +//| """ //| ... //| diff --git a/shared-bindings/_bleio/__init__.c b/shared-bindings/_bleio/__init__.c index 1ec2a2758a..f34d3af5c5 100644 --- a/shared-bindings/_bleio/__init__.c +++ b/shared-bindings/_bleio/__init__.c @@ -58,6 +58,7 @@ //| adapter: Adapter //| """BLE Adapter used to manage device discovery and connections. //| This object is the sole instance of `_bleio.Adapter`.""" +//| //| class BluetoothError(Exception): //| """Catchall exception for Bluetooth related errors.""" @@ -121,9 +122,7 @@ STATIC mp_obj_dict_t bleio_module_globals; //| mp_obj_t bleio_set_adapter(mp_obj_t adapter_obj) { #if CIRCUITPY_BLEIO_HCI - if (adapter_obj != mp_const_none && !mp_obj_is_type(adapter_obj, &bleio_adapter_type)) { - mp_raise_TypeError_varg(translate("Expected a %q"), bleio_adapter_type.name); - } + (void)mp_arg_validate_type_or_none(adapter_obj, &bleio_adapter_type, MP_QSTR_adapter); // Equivalent of: // bleio.adapter = adapter_obj @@ -132,7 +131,7 @@ mp_obj_t bleio_set_adapter(mp_obj_t adapter_obj) { elem->value = adapter_obj; } #else - mp_raise_NotImplementedError(translate("Not settable")); + mp_raise_NotImplementedError(translate("Read-only")); #endif return mp_const_none; } diff --git a/shared-bindings/_eve/__init__.c b/shared-bindings/_eve/__init__.c index bd0cf9b4ea..5975ee1ca1 100644 --- a/shared-bindings/_eve/__init__.c +++ b/shared-bindings/_eve/__init__.c @@ -93,7 +93,8 @@ STATIC MP_DEFINE_CONST_FUN_OBJ_2(cc_obj, _cc); //| :param int func: specifies the test function, one of ``NEVER``, ``LESS``, ``LEQUAL``, ``GREATER``, ``GEQUAL``, ``EQUAL``, ``NOTEQUAL``, or ``ALWAYS``. Range 0-7. The initial value is ALWAYS(7) //| :param int ref: specifies the reference value for the alpha test. Range 0-255. The initial value is 0 //| -//| These values are part of the graphics context and are saved and restored by :meth:`SaveContext` and :meth:`RestoreContext`.""" +//| These values are part of the graphics context and are saved and restored by :meth:`SaveContext` and :meth:`RestoreContext`. +//| """ //| ... STATIC mp_obj_t _alphafunc(mp_obj_t self, mp_obj_t a0, mp_obj_t a1) { @@ -109,7 +110,8 @@ STATIC MP_DEFINE_CONST_FUN_OBJ_3(alphafunc_obj, _alphafunc); //| //| :param int prim: graphics primitive. //| -//| Valid primitives are ``BITMAPS``, ``POINTS``, ``LINES``, ``LINE_STRIP``, ``EDGE_STRIP_R``, ``EDGE_STRIP_L``, ``EDGE_STRIP_A``, ``EDGE_STRIP_B`` and ``RECTS``.""" +//| Valid primitives are ``BITMAPS``, ``POINTS``, ``LINES``, ``LINE_STRIP``, ``EDGE_STRIP_R``, ``EDGE_STRIP_L``, ``EDGE_STRIP_A``, ``EDGE_STRIP_B`` and ``RECTS``. +//| """ //| ... STATIC mp_obj_t _begin(mp_obj_t self, mp_obj_t a0) { @@ -137,7 +139,8 @@ STATIC MP_DEFINE_CONST_FUN_OBJ_2(bitmapextformat_obj, _bitmapextformat); //| //| :param int handle: bitmap handle. Range 0-31. The initial value is 0 //| -//| This value is part of the graphics context and is saved and restored by :meth:`SaveContext` and :meth:`RestoreContext`.""" +//| This value is part of the graphics context and is saved and restored by :meth:`SaveContext` and :meth:`RestoreContext`. +//| """ //| ... STATIC mp_obj_t _bitmaphandle(mp_obj_t self, mp_obj_t a0) { @@ -218,7 +221,8 @@ STATIC MP_DEFINE_CONST_FUN_OBJ_VAR_BETWEEN(bitmapsize_obj, 6, 6, _bitmapsize); //| def BitmapSource(self, addr: int) -> None: //| """Set the source address for bitmap graphics //| -//| :param int addr: Bitmap start address, pixel-aligned. May be in SRAM or flash. Range 0-16777215""" +//| :param int addr: Bitmap start address, pixel-aligned. May be in SRAM or flash. Range 0-16777215 +//| """ //| ... STATIC mp_obj_t _bitmapsource(mp_obj_t self, mp_obj_t a0) { @@ -255,7 +259,8 @@ STATIC MP_DEFINE_CONST_FUN_OBJ_VAR_BETWEEN(bitmapswizzle_obj, 5, 5, _bitmapswizz //| //| The initial value is **p** = 0, **v** = 256. This represents the value 1.0. //| -//| These values are part of the graphics context and are saved and restored by :meth:`SaveContext` and :meth:`RestoreContext`.""" +//| These values are part of the graphics context and are saved and restored by :meth:`SaveContext` and :meth:`RestoreContext`. +//| """ //| ... STATIC mp_obj_t _bitmaptransforma(mp_obj_t self, mp_obj_t a0, mp_obj_t a1) { @@ -274,7 +279,8 @@ STATIC MP_DEFINE_CONST_FUN_OBJ_3(bitmaptransforma_obj, _bitmaptransforma); //| //| The initial value is **p** = 0, **v** = 0. This represents the value 0.0. //| -//| These values are part of the graphics context and are saved and restored by :meth:`SaveContext` and :meth:`RestoreContext`.""" +//| These values are part of the graphics context and are saved and restored by :meth:`SaveContext` and :meth:`RestoreContext`. +//| """ //| ... STATIC mp_obj_t _bitmaptransformb(mp_obj_t self, mp_obj_t a0, mp_obj_t a1) { @@ -290,7 +296,8 @@ STATIC MP_DEFINE_CONST_FUN_OBJ_3(bitmaptransformb_obj, _bitmaptransformb); //| //| :param int v: The :math:`c` component of the bitmap transform matrix, in signed 15.8 bit fixed-point form. Range 0-16777215. The initial value is 0 //| -//| This value is part of the graphics context and is saved and restored by :meth:`SaveContext` and :meth:`RestoreContext`.""" +//| This value is part of the graphics context and is saved and restored by :meth:`SaveContext` and :meth:`RestoreContext`. +//| """ //| ... STATIC mp_obj_t _bitmaptransformc(mp_obj_t self, mp_obj_t a0) { @@ -308,7 +315,8 @@ STATIC MP_DEFINE_CONST_FUN_OBJ_2(bitmaptransformc_obj, _bitmaptransformc); //| //| The initial value is **p** = 0, **v** = 0. This represents the value 0.0. //| -//| These values are part of the graphics context and are saved and restored by :meth:`SaveContext` and :meth:`RestoreContext`.""" +//| These values are part of the graphics context and are saved and restored by :meth:`SaveContext` and :meth:`RestoreContext`. +//| """ //| ... STATIC mp_obj_t _bitmaptransformd(mp_obj_t self, mp_obj_t a0, mp_obj_t a1) { @@ -327,7 +335,8 @@ STATIC MP_DEFINE_CONST_FUN_OBJ_3(bitmaptransformd_obj, _bitmaptransformd); //| //| The initial value is **p** = 0, **v** = 256. This represents the value 1.0. //| -//| These values are part of the graphics context and are saved and restored by :meth:`SaveContext` and :meth:`RestoreContext`.""" +//| These values are part of the graphics context and are saved and restored by :meth:`SaveContext` and :meth:`RestoreContext`. +//| """ //| ... STATIC mp_obj_t _bitmaptransforme(mp_obj_t self, mp_obj_t a0, mp_obj_t a1) { @@ -343,7 +352,8 @@ STATIC MP_DEFINE_CONST_FUN_OBJ_3(bitmaptransforme_obj, _bitmaptransforme); //| //| :param int v: The :math:`f` component of the bitmap transform matrix, in signed 15.8 bit fixed-point form. Range 0-16777215. The initial value is 0 //| -//| This value is part of the graphics context and is saved and restored by :meth:`SaveContext` and :meth:`RestoreContext`.""" +//| This value is part of the graphics context and is saved and restored by :meth:`SaveContext` and :meth:`RestoreContext`. +//| """ //| ... STATIC mp_obj_t _bitmaptransformf(mp_obj_t self, mp_obj_t a0) { @@ -359,7 +369,8 @@ STATIC MP_DEFINE_CONST_FUN_OBJ_2(bitmaptransformf_obj, _bitmaptransformf); //| :param int src: specifies how the source blending factor is computed. One of ``ZERO``, ``ONE``, ``SRC_ALPHA``, ``DST_ALPHA``, ``ONE_MINUS_SRC_ALPHA`` or ``ONE_MINUS_DST_ALPHA``. Range 0-7. The initial value is SRC_ALPHA(2) //| :param int dst: specifies how the destination blending factor is computed, one of the same constants as **src**. Range 0-7. The initial value is ONE_MINUS_SRC_ALPHA(4) //| -//| These values are part of the graphics context and are saved and restored by :meth:`SaveContext` and :meth:`RestoreContext`.""" +//| These values are part of the graphics context and are saved and restored by :meth:`SaveContext` and :meth:`RestoreContext`. +//| """ //| ... STATIC mp_obj_t _blendfunc(mp_obj_t self, mp_obj_t a0, mp_obj_t a1) { @@ -388,7 +399,8 @@ STATIC MP_DEFINE_CONST_FUN_OBJ_2(call_obj, _call); //| //| :param int cell: bitmap cell number. Range 0-127. The initial value is 0 //| -//| This value is part of the graphics context and is saved and restored by :meth:`SaveContext` and :meth:`RestoreContext`.""" +//| This value is part of the graphics context and is saved and restored by :meth:`SaveContext` and :meth:`RestoreContext`. +//| """ //| ... STATIC mp_obj_t _cell(mp_obj_t self, mp_obj_t a0) { @@ -403,7 +415,8 @@ STATIC MP_DEFINE_CONST_FUN_OBJ_2(cell_obj, _cell); //| //| :param int alpha: alpha value used when the color buffer is cleared. Range 0-255. The initial value is 0 //| -//| This value is part of the graphics context and is saved and restored by :meth:`SaveContext` and :meth:`RestoreContext`.""" +//| This value is part of the graphics context and is saved and restored by :meth:`SaveContext` and :meth:`RestoreContext`. +//| """ //| ... STATIC mp_obj_t _clearcolora(mp_obj_t self, mp_obj_t a0) { @@ -420,7 +433,8 @@ STATIC MP_DEFINE_CONST_FUN_OBJ_2(clearcolora_obj, _clearcolora); //| :param int green: green value used when the color buffer is cleared. Range 0-255. The initial value is 0 //| :param int blue: blue value used when the color buffer is cleared. Range 0-255. The initial value is 0 //| -//| These values are part of the graphics context and are saved and restored by :meth:`SaveContext` and :meth:`RestoreContext`.""" +//| These values are part of the graphics context and are saved and restored by :meth:`SaveContext` and :meth:`RestoreContext`. +//| """ //| ... STATIC mp_obj_t _clearcolorrgb(size_t n_args, const mp_obj_t *args) { @@ -454,7 +468,8 @@ STATIC MP_DEFINE_CONST_FUN_OBJ_VAR_BETWEEN(clear_obj, 1, 4, _clear); //| //| :param int s: value used when the stencil buffer is cleared. Range 0-255. The initial value is 0 //| -//| This value is part of the graphics context and is saved and restored by :meth:`SaveContext` and :meth:`RestoreContext`.""" +//| This value is part of the graphics context and is saved and restored by :meth:`SaveContext` and :meth:`RestoreContext`. +//| """ //| ... STATIC mp_obj_t _clearstencil(mp_obj_t self, mp_obj_t a0) { @@ -469,7 +484,8 @@ STATIC MP_DEFINE_CONST_FUN_OBJ_2(clearstencil_obj, _clearstencil); //| //| :param int s: value used when the tag buffer is cleared. Range 0-255. The initial value is 0 //| -//| This value is part of the graphics context and is saved and restored by :meth:`SaveContext` and :meth:`RestoreContext`.""" +//| This value is part of the graphics context and is saved and restored by :meth:`SaveContext` and :meth:`RestoreContext`. +//| """ STATIC mp_obj_t _cleartag(mp_obj_t self, mp_obj_t a0) { uint32_t s = mp_obj_get_int_truncated(a0); @@ -483,7 +499,8 @@ STATIC MP_DEFINE_CONST_FUN_OBJ_2(cleartag_obj, _cleartag); //| //| :param int alpha: alpha for the current color. Range 0-255. The initial value is 255 //| -//| This value is part of the graphics context and is saved and restored by :meth:`SaveContext` and :meth:`RestoreContext`.""" +//| This value is part of the graphics context and is saved and restored by :meth:`SaveContext` and :meth:`RestoreContext`. +//| """ //| ... STATIC mp_obj_t _colora(mp_obj_t self, mp_obj_t a0) { @@ -501,7 +518,8 @@ STATIC MP_DEFINE_CONST_FUN_OBJ_2(colora_obj, _colora); //| :param int b: allow updates to the frame buffer blue component. Range 0-1. The initial value is 1 //| :param int a: allow updates to the frame buffer alpha component. Range 0-1. The initial value is 1 //| -//| These values are part of the graphics context and are saved and restored by :meth:`SaveContext` and :meth:`RestoreContext`.""" +//| These values are part of the graphics context and are saved and restored by :meth:`SaveContext` and :meth:`RestoreContext`. +//| """ //| ... STATIC mp_obj_t _colormask(size_t n_args, const mp_obj_t *args) { @@ -521,7 +539,8 @@ STATIC MP_DEFINE_CONST_FUN_OBJ_VAR_BETWEEN(colormask_obj, 5, 5, _colormask); //| :param int green: green for the current color. Range 0-255. The initial value is 255 //| :param int blue: blue for the current color. Range 0-255. The initial value is 255 //| -//| These values are part of the graphics context and are saved and restored by :meth:`SaveContext` and :meth:`RestoreContext`.""" +//| These values are part of the graphics context and are saved and restored by :meth:`SaveContext` and :meth:`RestoreContext`. +//| """ //| ... STATIC mp_obj_t _colorrgb(size_t n_args, const mp_obj_t *args) { @@ -547,7 +566,8 @@ STATIC MP_DEFINE_CONST_FUN_OBJ_1(display_obj, _display); //| def End(self) -> None: //| """End drawing a graphics primitive //| -//| :meth:`Vertex2ii` and :meth:`Vertex2f` calls are ignored until the next :meth:`Begin`.""" +//| :meth:`Vertex2ii` and :meth:`Vertex2f` calls are ignored until the next :meth:`Begin`. +//| """ //| ... STATIC mp_obj_t _end(mp_obj_t self) { @@ -599,7 +619,8 @@ STATIC MP_DEFINE_CONST_FUN_OBJ_1(nop_obj, _nop); //| //| :param int addr: Address in graphics SRAM, 2-byte aligned. Range 0-4194303. The initial value is 0 //| -//| This value is part of the graphics context and is saved and restored by :meth:`SaveContext` and :meth:`RestoreContext`.""" +//| This value is part of the graphics context and is saved and restored by :meth:`SaveContext` and :meth:`RestoreContext`. +//| """ //| ... STATIC mp_obj_t _palettesource(mp_obj_t self, mp_obj_t a0) { @@ -648,7 +669,8 @@ STATIC MP_DEFINE_CONST_FUN_OBJ_1(savecontext_obj, _savecontext); //| :param int width: The width of the scissor clip rectangle, in pixels. Range 0-4095. The initial value is hsize //| :param int height: The height of the scissor clip rectangle, in pixels. Range 0-4095. The initial value is 2048 //| -//| These values are part of the graphics context and are saved and restored by :meth:`SaveContext` and :meth:`RestoreContext`.""" +//| These values are part of the graphics context and are saved and restored by :meth:`SaveContext` and :meth:`RestoreContext`. +//| """ //| ... STATIC mp_obj_t _scissorsize(mp_obj_t self, mp_obj_t a0, mp_obj_t a1) { @@ -665,7 +687,8 @@ STATIC MP_DEFINE_CONST_FUN_OBJ_3(scissorsize_obj, _scissorsize); //| :param int x: The :math:`x` coordinate of the scissor clip rectangle, in pixels. Range 0-2047. The initial value is 0 //| :param int y: The :math:`y` coordinate of the scissor clip rectangle, in pixels. Range 0-2047. The initial value is 0 //| -//| These values are part of the graphics context and are saved and restored by :meth:`SaveContext` and :meth:`RestoreContext`.""" +//| These values are part of the graphics context and are saved and restored by :meth:`SaveContext` and :meth:`RestoreContext`. +//| """ //| ... STATIC mp_obj_t _scissorxy(mp_obj_t self, mp_obj_t a0, mp_obj_t a1) { @@ -683,7 +706,8 @@ STATIC MP_DEFINE_CONST_FUN_OBJ_3(scissorxy_obj, _scissorxy); //| :param int ref: specifies the reference value for the stencil test. Range 0-255. The initial value is 0 //| :param int mask: specifies a mask that is ANDed with the reference value and the stored stencil value. Range 0-255. The initial value is 255 //| -//| These values are part of the graphics context and are saved and restored by :meth:`SaveContext` and :meth:`RestoreContext`.""" +//| These values are part of the graphics context and are saved and restored by :meth:`SaveContext` and :meth:`RestoreContext`. +//| """ //| ... STATIC mp_obj_t _stencilfunc(size_t n_args, const mp_obj_t *args) { @@ -700,7 +724,8 @@ STATIC MP_DEFINE_CONST_FUN_OBJ_VAR_BETWEEN(stencilfunc_obj, 4, 4, _stencilfunc); //| //| :param int mask: the mask used to enable writing stencil bits. Range 0-255. The initial value is 255 //| -//| This value is part of the graphics context and is saved and restored by :meth:`SaveContext` and :meth:`RestoreContext`.""" +//| This value is part of the graphics context and is saved and restored by :meth:`SaveContext` and :meth:`RestoreContext`. +//| """ //| ... STATIC mp_obj_t _stencilmask(mp_obj_t self, mp_obj_t a0) { @@ -716,7 +741,8 @@ STATIC MP_DEFINE_CONST_FUN_OBJ_2(stencilmask_obj, _stencilmask); //| :param int sfail: specifies the action to take when the stencil test fails, one of ``KEEP``, ``ZERO``, ``REPLACE``, ``INCR``, ``INCR_WRAP``, ``DECR``, ``DECR_WRAP``, and ``INVERT``. Range 0-7. The initial value is KEEP(1) //| :param int spass: specifies the action to take when the stencil test passes, one of the same constants as **sfail**. Range 0-7. The initial value is KEEP(1) //| -//| These values are part of the graphics context and are saved and restored by :meth:`SaveContext` and :meth:`RestoreContext`.""" +//| These values are part of the graphics context and are saved and restored by :meth:`SaveContext` and :meth:`RestoreContext`. +//| """ //| ... STATIC mp_obj_t _stencilop(mp_obj_t self, mp_obj_t a0, mp_obj_t a1) { @@ -732,7 +758,8 @@ STATIC MP_DEFINE_CONST_FUN_OBJ_3(stencilop_obj, _stencilop); //| //| :param int mask: allow updates to the tag buffer. Range 0-1. The initial value is 1 //| -//| This value is part of the graphics context and is saved and restored by :meth:`SaveContext` and :meth:`RestoreContext`.""" +//| This value is part of the graphics context and is saved and restored by :meth:`SaveContext` and :meth:`RestoreContext`. +//| """ //| ... STATIC mp_obj_t _tagmask(mp_obj_t self, mp_obj_t a0) { @@ -747,7 +774,8 @@ STATIC MP_DEFINE_CONST_FUN_OBJ_2(tagmask_obj, _tagmask); //| //| :param int s: tag value. Range 0-255. The initial value is 255 //| -//| This value is part of the graphics context and is saved and restored by :meth:`SaveContext` and :meth:`RestoreContext`.""" +//| This value is part of the graphics context and is saved and restored by :meth:`SaveContext` and :meth:`RestoreContext`. +//| """ //| ... STATIC mp_obj_t _tag(mp_obj_t self, mp_obj_t a0) { @@ -857,7 +885,8 @@ STATIC MP_DEFINE_CONST_FUN_OBJ_3(vertex2f_obj, _vertex2f); //| //| :param float width: line width in pixels. Range 0-511. The initial value is 1 //| -//| This value is part of the graphics context and is saved and restored by :meth:`SaveContext` and :meth:`RestoreContext`.""" +//| This value is part of the graphics context and is saved and restored by :meth:`SaveContext` and :meth:`RestoreContext`. +//| """ //| ... STATIC mp_obj_t _linewidth(mp_obj_t self, mp_obj_t a0) { @@ -872,7 +901,8 @@ STATIC MP_DEFINE_CONST_FUN_OBJ_2(linewidth_obj, _linewidth); //| //| :param float size: point diameter in pixels. Range 0-1023. The initial value is 1 //| -//| This value is part of the graphics context and is saved and restored by :meth:`SaveContext` and :meth:`RestoreContext`.""" +//| This value is part of the graphics context and is saved and restored by :meth:`SaveContext` and :meth:`RestoreContext`. +//| """ //| ... STATIC mp_obj_t _pointsize(mp_obj_t self, mp_obj_t a0) { @@ -887,7 +917,8 @@ STATIC MP_DEFINE_CONST_FUN_OBJ_2(pointsize_obj, _pointsize); //| //| :param float x: signed x-coordinate in pixels. Range ±4095. The initial value is 0 //| -//| This value is part of the graphics context and is saved and restored by :meth:`SaveContext` and :meth:`RestoreContext`.""" +//| This value is part of the graphics context and is saved and restored by :meth:`SaveContext` and :meth:`RestoreContext`. +//| """ //| ... STATIC mp_obj_t _vertextranslatex(mp_obj_t self, mp_obj_t a0) { @@ -902,7 +933,8 @@ STATIC MP_DEFINE_CONST_FUN_OBJ_2(vertextranslatex_obj, _vertextranslatex); //| //| :param float y: signed y-coordinate in pixels. Range ±4095. The initial value is 0 //| -//| This value is part of the graphics context and is saved and restored by :meth:`SaveContext` and :meth:`RestoreContext`.""" +//| This value is part of the graphics context and is saved and restored by :meth:`SaveContext` and :meth:`RestoreContext`. +//| """ //| ... @@ -918,7 +950,8 @@ STATIC MP_DEFINE_CONST_FUN_OBJ_2(vertextranslatey_obj, _vertextranslatey); //| //| :param int frac: Number of fractional bits in X,Y coordinates, 0-4. Range 0-7. The initial value is 4 //| -//| This value is part of the graphics context and is saved and restored by :meth:`SaveContext` and :meth:`RestoreContext`.""" +//| This value is part of the graphics context and is saved and restored by :meth:`SaveContext` and :meth:`RestoreContext`. +//| """ //| ... // } diff --git a/shared-bindings/_pixelmap/PixelMap.c b/shared-bindings/_pixelmap/PixelMap.c new file mode 100644 index 0000000000..94fa4d5c96 --- /dev/null +++ b/shared-bindings/_pixelmap/PixelMap.c @@ -0,0 +1,269 @@ +/* + * This file is part of the CircuitPython project, https://github.com/adafruit/circuitpython + * + * The MIT License (MIT) + * + * Copyright (c) 2018 Rose Hooper + * 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/objproperty.h" +#include "py/objtype.h" +#include "py/runtime.h" + +#include "shared-bindings/_pixelmap/PixelMap.h" +#include "shared-bindings/adafruit_pixelbuf/PixelBuf.h" +#include "shared-module/_pixelmap/PixelMap.h" + +//| from adafruit_pixelbuf import PixelBuf, PixelReturnType, PixelSequence, PixelType +//| +//| class PixelMap: +//| def __init__(self, pixelbuf: PixelBuf, indices: Tuple[Union[int, Tuple[int]]]) -> None: +//| """Construct a PixelMap object that uses the given indices of the underlying pixelbuf""" + +STATIC mp_obj_t pixelmap_pixelmap_make_new(const mp_obj_type_t *type, size_t n_args, size_t n_kw, const mp_obj_t *all_args) { + enum { ARG_pixelbuf, ARG_indices }; + static const mp_arg_t allowed_args[] = { + { MP_QSTR_pixelbuf, MP_ARG_REQUIRED }, + { MP_QSTR_indices, MP_ARG_REQUIRED }, + }; + + 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_obj_t pixelbuf = args[ARG_pixelbuf].u_obj; + + mp_obj_t native_pixelbuf = mp_obj_cast_to_native_base(pixelbuf, &pixelbuf_pixelbuf_type); + if (!native_pixelbuf) { + (void)mp_arg_validate_type(args[ARG_pixelbuf].u_obj, &pixelbuf_pixelbuf_type, MP_QSTR_pixelbuf); + } + mp_obj_assert_native_inited(native_pixelbuf); + + size_t buflen = common_hal_adafruit_pixelbuf_pixelbuf_get_len(pixelbuf); + + mp_obj_t indices = mp_arg_validate_type(args[ARG_indices].u_obj, &mp_type_tuple, MP_QSTR_indices); + + // validate indices + size_t len; + mp_obj_t *items; + mp_obj_tuple_get(indices, &len, &items); + mp_arg_validate_length_min(len, 1, MP_QSTR_items); + + for (size_t i = 0; i < len; i++) { + mp_obj_t item = items[i]; + if (mp_obj_is_small_int(item)) { + mp_arg_validate_index_range(MP_OBJ_SMALL_INT_VALUE(item), 0, buflen - 1, MP_QSTR_index); + } else if (mp_obj_is_tuple_compatible(item)) { + size_t len1; + mp_obj_t *items1; + mp_obj_tuple_get(item, &len1, &items1); + for (size_t j = 0; j < len1; j++) { + mp_obj_t item1 = items1[j]; + if (!mp_obj_is_small_int(item1)) { + mp_raise_TypeError(translate("nested index must be int")); + } + mp_arg_validate_index_range(MP_OBJ_SMALL_INT_VALUE(item1), 0, buflen - 1, MP_QSTR_index); + } + } else { + mp_raise_TypeError(translate("index must be tuple or int")); + } + } + + pixelmap_pixelmap_obj_t *self = m_new_obj(pixelmap_pixelmap_obj_t); + self->base.type = &pixelmap_pixelmap_type; + shared_module_pixelmap_pixelmap_construct(self, pixelbuf, indices); + + return MP_OBJ_FROM_PTR(self); +} + +//| auto_write: bool +//| """True if updates should be automatically written""" +STATIC mp_obj_t pixelmap_pixelmap_auto_write_get(const mp_obj_t self_in) { + pixelmap_pixelmap_obj_t *self = MP_OBJ_TO_PTR(self_in); + return mp_obj_new_bool(shared_module_pixelmap_pixelmap_auto_write_get(self)); +} +MP_DEFINE_CONST_FUN_OBJ_1(pixelmap_pixelmap_auto_write_get_obj, pixelmap_pixelmap_auto_write_get); + +STATIC mp_obj_t pixelmap_pixelmap_auto_write_set(const mp_obj_t self_in, const mp_obj_t arg) { + pixelmap_pixelmap_obj_t *self = MP_OBJ_TO_PTR(self_in); + shared_module_pixelmap_pixelmap_auto_write_set(self, mp_obj_is_true(arg)); + return mp_const_none; +} +MP_DEFINE_CONST_FUN_OBJ_2(pixelmap_pixelmap_auto_write_set_obj, pixelmap_pixelmap_auto_write_set); + +MP_PROPERTY_GETSET(pixelmap_pixelmap_auto_write_obj, + (mp_obj_t)&pixelmap_pixelmap_auto_write_get_obj, + (mp_obj_t)&pixelmap_pixelmap_auto_write_set_obj); + +//| bpp: int +//| """The number of bytes per pixel in the buffer (read-only)""" +STATIC mp_obj_t pixelmap_pixelmap_obj_get_bpp(mp_obj_t self_in) { + pixelmap_pixelmap_obj_t *self = MP_OBJ_TO_PTR(self_in); + return MP_OBJ_NEW_SMALL_INT(common_hal_adafruit_pixelbuf_pixelbuf_get_bpp(self->pixelbuf)); +} +MP_DEFINE_CONST_FUN_OBJ_1(pixelmap_pixelmap_get_bpp_obj, pixelmap_pixelmap_obj_get_bpp); + +MP_PROPERTY_GETTER(pixelmap_pixelmap_bpp_obj, + (mp_obj_t)&pixelmap_pixelmap_get_bpp_obj); + +//| byteorder: str +//| """byteorder string for the buffer (read-only)""" +STATIC mp_obj_t pixelmap_pixelmap_obj_get_byteorder(mp_obj_t self_in) { + pixelmap_pixelmap_obj_t *self = MP_OBJ_TO_PTR(self_in); + return common_hal_adafruit_pixelbuf_pixelbuf_get_byteorder_string(self->pixelbuf); +} +MP_DEFINE_CONST_FUN_OBJ_1(pixelmap_pixelmap_get_byteorder, pixelmap_pixelmap_obj_get_byteorder); +MP_PROPERTY_GETTER(pixelmap_pixelmap_byteorder_obj, + (mp_obj_t)&pixelmap_pixelmap_get_byteorder); + +//| +//| def fill(self, color: PixelType) -> None: +//| """Fill all the pixels in the map with the given color""" +STATIC mp_obj_t pixelmap_pixelmap_fill(const mp_obj_t self_in, const mp_obj_t color) { + pixelmap_pixelmap_obj_t *self = MP_OBJ_TO_PTR(self_in); + + shared_module_pixelmap_pixelmap_fill(self, color); + return mp_const_none; +} +MP_DEFINE_CONST_FUN_OBJ_2(pixelmap_pixelmap_fill_obj, pixelmap_pixelmap_fill); + +//| +//| def indices(self, index: int) -> Tuple[int]: +//| """Return the PixelBuf indices for a PixelMap index""" +STATIC mp_obj_t pixelmap_pixelmap_indices(const mp_obj_t self_in, const mp_obj_t index) { + pixelmap_pixelmap_obj_t *self = MP_OBJ_TO_PTR(self_in); + + return shared_module_pixelmap_pixelmap_indices(self, mp_obj_get_int(index)); + return mp_const_none; +} +MP_DEFINE_CONST_FUN_OBJ_2(pixelmap_pixelmap_indices_obj, pixelmap_pixelmap_indices); + + +//| @overload +//| def __getitem__(self, index: slice) -> PixelReturnSequence: +//| """Retrieve the value of the underlying pixels.""" +//| ... +//| @overload +//| def __getitem__(self, index: int) -> PixelReturnType: +//| """Retrieve the value of one of the underlying pixels at 'index'.""" +//| ... +//| @overload +//| def __setitem__(self, index: slice, value: PixelSequence) -> None: ... +//| @overload +//| def __setitem__(self, index: int, value: PixelType) -> 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). +//| For RGBW byteorders, if given only RGB values either as an int or as a tuple, the white value +//| is used instead when the red, green, and blue values are the same.""" +//| ... +STATIC mp_obj_t pixelmap_pixelmap_subscr(mp_obj_t self_in, mp_obj_t index_in, mp_obj_t value) { + pixelmap_pixelmap_obj_t *self = MP_OBJ_TO_PTR(self_in); + if (value == MP_OBJ_NULL) { + // delete + return MP_OBJ_NULL; // op not supported + } + + if (0) { + #if MICROPY_PY_BUILTINS_SLICE + } else if (mp_obj_is_type(index_in, &mp_type_slice)) { + mp_bound_slice_t slice; + mp_seq_get_fast_slice_indexes(self->len, index_in, &slice); + size_t slice_len; + if (slice.step > 0) { + slice_len = slice.stop - slice.start; + } else { + slice_len = 1 + slice.start - slice.stop; + } + if (slice.step > 1 || slice.step < -1) { + size_t step = slice.step > 0 ? slice.step : slice.step * -1; + slice_len = (slice_len / step) + (slice_len % step ? 1 : 0); + } + + if (value == MP_OBJ_SENTINEL) { // Get + return shared_module_pixelmap_pixelmap_getslice(self, slice, slice_len); + } else { // Set + shared_module_pixelmap_pixelmap_setslice(self, value, slice, slice_len); + return mp_const_none; + } + #endif + } else { // single index + int index = mp_obj_get_int(index_in); + + if (value == MP_OBJ_SENTINEL) { // Get + return shared_module_pixelmap_pixelmap_getitem(self, index); + } else { + shared_module_pixelmap_pixelmap_setitem(self, mp_obj_get_int(index_in), value); + return mp_const_none; + } + } +} + +//| def __len__(self) -> int: +//| """Length of the map""" +STATIC mp_obj_t pixelmap_pixelmap_unary_op(mp_unary_op_t op, mp_obj_t self_in) { + pixelmap_pixelmap_obj_t *self = MP_OBJ_TO_PTR(self_in); + switch (op) { + case MP_UNARY_OP_BOOL: + return mp_const_true; + case MP_UNARY_OP_LEN: + return MP_OBJ_NEW_SMALL_INT(self->len); + default: + return MP_OBJ_NULL; // op not supported + } +} + +//| def show(self) -> None: +//| """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 pixelmap_pixelmap_show(mp_obj_t self_in) { + pixelmap_pixelmap_obj_t *self = MP_OBJ_TO_PTR(self_in); + common_hal_adafruit_pixelbuf_pixelbuf_show(self->pixelbuf); + return mp_const_none; +} +STATIC MP_DEFINE_CONST_FUN_OBJ_1(pixelmap_pixelmap_show_obj, pixelmap_pixelmap_show); + +STATIC const mp_rom_map_elem_t pixelmap_pixelmap_locals_dict_table[] = { + { MP_ROM_QSTR(MP_QSTR_auto_write), MP_ROM_PTR(&pixelmap_pixelmap_auto_write_obj) }, + { MP_ROM_QSTR(MP_QSTR_bpp), MP_ROM_PTR(&pixelmap_pixelmap_bpp_obj) }, + { MP_ROM_QSTR(MP_QSTR_byteorder), MP_ROM_PTR(&pixelmap_pixelmap_byteorder_obj) }, + { MP_ROM_QSTR(MP_QSTR_fill), MP_ROM_PTR(&pixelmap_pixelmap_fill_obj) }, + { MP_ROM_QSTR(MP_QSTR_indices), MP_ROM_PTR(&pixelmap_pixelmap_indices_obj) }, + { MP_ROM_QSTR(MP_QSTR_show), MP_ROM_PTR(&pixelmap_pixelmap_show_obj) }, +}; + +STATIC MP_DEFINE_CONST_DICT(pixelmap_pixelmap_locals_dict, pixelmap_pixelmap_locals_dict_table); + + +const mp_obj_type_t pixelmap_pixelmap_type = { + { &mp_type_type }, + .name = MP_QSTR_PixelMap, + .flags = MP_TYPE_FLAG_EXTENDED, + .locals_dict = (mp_obj_t)&pixelmap_pixelmap_locals_dict, + .make_new = pixelmap_pixelmap_make_new, + MP_TYPE_EXTENDED_FIELDS( + .subscr = pixelmap_pixelmap_subscr, + .unary_op = pixelmap_pixelmap_unary_op, + ), +}; diff --git a/shared-bindings/_pixelmap/PixelMap.h b/shared-bindings/_pixelmap/PixelMap.h new file mode 100644 index 0000000000..fef0db44d0 --- /dev/null +++ b/shared-bindings/_pixelmap/PixelMap.h @@ -0,0 +1,43 @@ +/* + * This file is part of the CircuitPython project, https://github.com/adafruit/circuitpython + * + * The MIT License (MIT) + * + * Copyright (c) 2018 Rose Hooper + * 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" + +extern const mp_obj_type_t pixelmap_pixelmap_type; + +typedef struct _pixelmap_pixelmap_obj pixelmap_pixelmap_obj_t; + +void shared_module_pixelmap_pixelmap_construct(pixelmap_pixelmap_obj_t *self, mp_obj_t pixelbuf, mp_obj_t indices); +bool shared_module_pixelmap_pixelmap_auto_write_get(pixelmap_pixelmap_obj_t *self); +void shared_module_pixelmap_pixelmap_auto_write_set(pixelmap_pixelmap_obj_t *self, bool auto_write); +void shared_module_pixelmap_pixelmap_fill(pixelmap_pixelmap_obj_t *self, const mp_obj_t color); +mp_obj_t shared_module_pixelmap_pixelmap_indices(pixelmap_pixelmap_obj_t *self, int index); +void shared_module_pixelmap_pixelmap_setslice(pixelmap_pixelmap_obj_t *self, const mp_obj_t value, mp_bound_slice_t slice, size_t slice_len); +mp_obj_t shared_module_pixelmap_pixelmap_getslice(pixelmap_pixelmap_obj_t *self, mp_bound_slice_t slice, size_t slice_len); +mp_obj_t shared_module_pixelmap_pixelmap_getitem(pixelmap_pixelmap_obj_t *self, mp_int_t index); +void shared_module_pixelmap_pixelmap_setitem(pixelmap_pixelmap_obj_t *self, mp_int_t index, const mp_obj_t value); diff --git a/shared-bindings/_pixelmap/__init__.c b/shared-bindings/_pixelmap/__init__.c new file mode 100644 index 0000000000..13a09d69d2 --- /dev/null +++ b/shared-bindings/_pixelmap/__init__.c @@ -0,0 +1,62 @@ +/* + * This file is part of the CircuitPython project, https://github.com/adafruit/circuitpython + * + * The MIT License (MIT) + * + * Copyright (c) 2018 Rose Hooper + * + * 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 "py/runtime.h" +#include "py/objproperty.h" + +#include "shared-bindings/_pixelmap/__init__.h" +#include "shared-bindings/_pixelmap/PixelMap.h" + + +//| """A fast pixel mapping library +//| +//| The `_pixelmap` module provides the :py:class:`PixelMap` class to accelerate +//| RGB(W) strip/matrix manipulation, such as DotStar and Neopixel.""" +//| +//| # The types accepted when getting a pixel value +//| PixelReturnType = Union[ +//| Tuple[int, int, int], Tuple[int, int, int, int], Tuple[int, int, int, float] +//| ] +//| PixelReturnSequence = Tuple[PixelReturnType] +//| # The types returned when getting a pixel value +//| PixelType = Union[int, PixelReturnType] +//| PixelSequence = Union[Tuple[PixelType], List[PixelType]] + +STATIC const mp_rom_map_elem_t pixelmap_module_globals_table[] = { + { MP_ROM_QSTR(MP_QSTR___name__), MP_ROM_QSTR(MP_QSTR__pixelmap) }, + { MP_ROM_QSTR(MP_QSTR_PixelMap), MP_ROM_PTR(&pixelmap_pixelmap_type) }, +}; + +STATIC MP_DEFINE_CONST_DICT(pixelmap_module_globals, pixelmap_module_globals_table); + +const mp_obj_module_t pixelmap_module = { + .base = { &mp_type_module }, + .globals = (mp_obj_dict_t *)&pixelmap_module_globals, +}; + +MP_REGISTER_MODULE(MP_QSTR__pixelmap, pixelmap_module, CIRCUITPY_PIXELMAP); diff --git a/shared-bindings/_pixelmap/__init__.h b/shared-bindings/_pixelmap/__init__.h new file mode 100644 index 0000000000..9a84bc68a7 --- /dev/null +++ b/shared-bindings/_pixelmap/__init__.h @@ -0,0 +1,30 @@ +/* + * This file is part of the CircuitPython project, https://github.com/adafruit/circuitpython + * + * The MIT License (MIT) + * + * Copyright (c) 2018 Rose Hooper + * + * 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 CP_SHARED_BINDINGS_PIXELBUF_INIT_H +#define CP_SHARED_BINDINGS_PIXELBUF_INIT_H + +#endif // CP_SHARED_BINDINGS_PIXELBUF_INIT_H diff --git a/shared-bindings/adafruit_bus_device/i2c_device/I2CDevice.c b/shared-bindings/adafruit_bus_device/i2c_device/I2CDevice.c index d2b7f0c6ce..a77179c886 100644 --- a/shared-bindings/adafruit_bus_device/i2c_device/I2CDevice.c +++ b/shared-bindings/adafruit_bus_device/i2c_device/I2CDevice.c @@ -43,7 +43,6 @@ //| """I2C Device Manager""" //| //| def __init__(self, i2c: busio.I2C, device_address: int, probe: bool = True) -> None: -//| //| """Represents a single I2C device and manages locking the bus and the device //| address. //| diff --git a/shared-bindings/adafruit_bus_device/spi_device/SPIDevice.c b/shared-bindings/adafruit_bus_device/spi_device/SPIDevice.c index afb11856e2..6108247aa1 100644 --- a/shared-bindings/adafruit_bus_device/spi_device/SPIDevice.c +++ b/shared-bindings/adafruit_bus_device/spi_device/SPIDevice.c @@ -51,7 +51,6 @@ //| phase: int = 0, //| extra_clocks: int = 0 //| ) -> None: -//| //| """ //| Represents a single SPI device and manages locking the bus and the device address. //| @@ -105,9 +104,13 @@ STATIC mp_obj_t adafruit_bus_device_spidevice_make_new(const mp_obj_type_t *type if (args[ARG_chip_select].u_obj != MP_OBJ_NULL) { digitalinout_result_t result = common_hal_digitalio_digitalinout_switch_to_output(MP_OBJ_TO_PTR(args[ARG_chip_select].u_obj), true, DRIVE_MODE_PUSH_PULL); + #if CIRCUITPY_DIGITALIO_HAVE_INPUT_ONLY if (result == DIGITALINOUT_INPUT_ONLY) { mp_raise_NotImplementedError(translate("Pin is input only")); } + #else + (void)result; + #endif } return (mp_obj_t)self; diff --git a/shared-bindings/adafruit_pixelbuf/PixelBuf.c b/shared-bindings/adafruit_pixelbuf/PixelBuf.c index 6203f672ad..2848a02c62 100644 --- a/shared-bindings/adafruit_pixelbuf/PixelBuf.c +++ b/shared-bindings/adafruit_pixelbuf/PixelBuf.c @@ -40,7 +40,7 @@ #include "shared-module/adafruit_pixelbuf/PixelBuf.h" #include "shared-bindings/digitalio/DigitalInOut.h" -#ifdef CIRCUITPY_ULAB +#if CIRCUITPY_ULAB #include "extmod/ulab/code/ndarray.h" #endif @@ -78,7 +78,8 @@ static void parse_byteorder(mp_obj_t byteorder_obj, pixelbuf_byteorder_details_t //| :param float brightness: Brightness (0 to 1.0, default 1.0) //| :param bool auto_write: Whether to automatically write pixels (Default False) //| :param ~circuitpython_typing.ReadableBuffer header: Sequence of bytes to always send before pixel values. -//| :param ~circuitpython_typing.ReadableBuffer trailer: Sequence of bytes to always send after pixel values.""" +//| :param ~circuitpython_typing.ReadableBuffer trailer: Sequence of bytes to always send after pixel values. +//| """ //| ... STATIC mp_obj_t pixelbuf_pixelbuf_make_new(const mp_obj_type_t *type, size_t n_args, size_t n_kw, const mp_obj_t *all_args) { enum { ARG_size, ARG_byteorder, ARG_brightness, ARG_auto_write, ARG_header, ARG_trailer }; @@ -129,9 +130,7 @@ STATIC mp_obj_t pixelbuf_pixelbuf_make_new(const mp_obj_type_t *type, size_t n_a } static void parse_byteorder(mp_obj_t byteorder_obj, pixelbuf_byteorder_details_t *parsed) { - if (!mp_obj_is_str(byteorder_obj)) { - mp_raise_TypeError(translate("byteorder is not a string")); - } + mp_arg_validate_type_string(byteorder_obj, MP_QSTR_byteorder); size_t bo_len; const char *byteorder = mp_obj_str_get_data(byteorder_obj, &bo_len); @@ -253,9 +252,7 @@ STATIC mp_obj_t pixelbuf_pixelbuf_show(mp_obj_t self_in) { } STATIC MP_DEFINE_CONST_FUN_OBJ_1(pixelbuf_pixelbuf_show_obj, pixelbuf_pixelbuf_show); -//| def fill( -//| self, color: Union[int, Tuple[int, int, int], Tuple[int, int, int, float]] -//| ) -> None: +//| def fill(self, color: PixelType) -> None: //| """Fills the given pixelbuf with the given color.""" //| ... @@ -267,29 +264,21 @@ 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], ...]]: ... -//| @overload -//| def __getitem__( -//| self, index: int -//| ) -> Union[Tuple[int, int, int], Tuple[int, int, int, float]]: +//| def __getitem__(self, index: slice) -> PixelReturnSequence: //| """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 __getitem__(self, index: int) -> PixelReturnType: +//| """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: List[Union[int, Tuple[float, ...], List[float]]] -//| ) -> None: ... +//| def __setitem__(self, index: slice, value: PixelSequence) -> None: ... //| @overload -//| def __setitem__( -//| self, index: int, value: Union[int, Tuple[float, ...], List[float]] -//| ) -> None: +//| def __setitem__(self, index: int, value: PixelType) -> 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/adafruit_pixelbuf/PixelBuf.h b/shared-bindings/adafruit_pixelbuf/PixelBuf.h index e73d3e02d6..e77153322d 100644 --- a/shared-bindings/adafruit_pixelbuf/PixelBuf.h +++ b/shared-bindings/adafruit_pixelbuf/PixelBuf.h @@ -27,6 +27,7 @@ #ifndef CP_SHARED_BINDINGS_PIXELBUF_PIXELBUF_H #define CP_SHARED_BINDINGS_PIXELBUF_PIXELBUF_H +#include "py/objtuple.h" #include "shared-module/adafruit_pixelbuf/PixelBuf.h" extern const mp_obj_type_t pixelbuf_pixelbuf_type; @@ -55,5 +56,7 @@ void common_hal_adafruit_pixelbuf_pixelbuf_show(mp_obj_t self); mp_obj_t common_hal_adafruit_pixelbuf_pixelbuf_get_pixel(mp_obj_t self, size_t index); void common_hal_adafruit_pixelbuf_pixelbuf_set_pixel(mp_obj_t self, size_t index, mp_obj_t item); void common_hal_adafruit_pixelbuf_pixelbuf_set_pixels(mp_obj_t self_in, size_t start, mp_int_t step, size_t slice_len, mp_obj_t *values, mp_obj_tuple_t *flatten_to); +void common_hal_adafruit_pixelbuf_pixelbuf_parse_color(mp_obj_t self, mp_obj_t color, uint8_t *r, uint8_t *g, uint8_t *b, uint8_t *w); +void common_hal_adafruit_pixelbuf_pixelbuf_set_pixel_color(mp_obj_t self, size_t index, uint8_t r, uint8_t g, uint8_t b, uint8_t w); #endif // CP_SHARED_BINDINGS_PIXELBUF_PIXELBUF_H diff --git a/shared-bindings/adafruit_pixelbuf/__init__.c b/shared-bindings/adafruit_pixelbuf/__init__.c index 40bf80094c..fd2915ee0a 100644 --- a/shared-bindings/adafruit_pixelbuf/__init__.c +++ b/shared-bindings/adafruit_pixelbuf/__init__.c @@ -39,6 +39,15 @@ //| RGB(W) strip/matrix manipulation, such as DotStar and Neopixel. //| //| Byteorders are configured with strings, such as "RGB" or "RGBD".""" +//| +//| # The types accepted when getting a pixel value +//| PixelReturnType = Union[ +//| Tuple[int, int, int], Tuple[int, int, int, int], Tuple[int, int, int, float] +//| ] +//| PixelReturnSequence = Tuple[PixelReturnType] +//| # The types returned when getting a pixel value +//| PixelType = Union[int, PixelReturnType] +//| PixelSequence = Union[Tuple[PixelType], List[PixelType]] // TODO: Pull in docs from adafruit_pixelbuf. STATIC const mp_rom_map_elem_t pixelbuf_module_globals_table[] = { diff --git a/shared-bindings/aesio/aes.c b/shared-bindings/aesio/aes.c index 9170b63799..50e07a5b61 100644 --- a/shared-bindings/aesio/aes.c +++ b/shared-bindings/aesio/aes.c @@ -47,7 +47,9 @@ 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) { - (void)type; + aesio_aes_obj_t *self = m_new_obj(aesio_aes_obj_t); + self->base.type = &aesio_aes_type; + enum { ARG_key, ARG_mode, ARG_IV, ARG_counter, ARG_segment_size }; static const mp_arg_t allowed_args[] = { {MP_QSTR_key, MP_ARG_OBJ | MP_ARG_REQUIRED, {.u_obj = MP_OBJ_NULL} }, @@ -61,16 +63,13 @@ STATIC mp_obj_t aesio_aes_make_new(const mp_obj_type_t *type, size_t n_args, mp_arg_parse_all_kw_array(n_args, n_kw, all_args, MP_ARRAY_SIZE(allowed_args), allowed_args, args); - aesio_aes_obj_t *self = m_new_obj(aesio_aes_obj_t); - self->base.type = &aesio_aes_type; - mp_buffer_info_t bufinfo; const uint8_t *key = NULL; uint32_t key_length = 0; 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")); + mp_raise_ValueError(translate("Key must be 16, 24, or 32 bytes long")); } key = bufinfo.buf; key_length = bufinfo.len; @@ -82,17 +81,15 @@ STATIC mp_obj_t aesio_aes_make_new(const mp_obj_type_t *type, size_t n_args, case AES_MODE_CTR: break; default: - mp_raise_TypeError(translate("Requested AES mode is unsupported")); + mp_raise_NotImplementedError(translate("Requested AES mode is unsupported")); } // IV is required for CBC mode and is ignored for other modes. const uint8_t *iv = NULL; if (args[ARG_IV].u_obj != NULL && mp_get_buffer(args[ARG_IV].u_obj, &bufinfo, MP_BUFFER_READ)) { - if (bufinfo.len != AES_BLOCKLEN) { - mp_raise_TypeError_varg(translate("IV must be %d bytes long"), - AES_BLOCKLEN); - } + (void)mp_arg_validate_length(bufinfo.len, AES_BLOCKLEN, MP_QSTR_IV); + iv = bufinfo.buf; } @@ -112,7 +109,7 @@ STATIC mp_obj_t aesio_aes_rekey(size_t n_args, const mp_obj_t *pos_args) { mp_raise_ValueError(translate("No key was specified")); } if ((key_length != 16) && (key_length != 24) && (key_length != 32)) { - mp_raise_TypeError(translate("Key must be 16, 24, or 32 bytes long")); + mp_raise_ValueError(translate("Key must be 16, 24, or 32 bytes long")); } const uint8_t *iv = NULL; @@ -120,10 +117,7 @@ STATIC mp_obj_t aesio_aes_rekey(size_t n_args, const mp_obj_t *pos_args) { mp_get_buffer_raise(pos_args[2], &bufinfo, MP_BUFFER_READ); size_t iv_length = bufinfo.len; iv = (const uint8_t *)bufinfo.buf; - if (iv_length != AES_BLOCKLEN) { - mp_raise_TypeError_varg(translate("IV must be %d bytes long"), - AES_BLOCKLEN); - } + (void)mp_arg_validate_length(iv_length, AES_BLOCKLEN, MP_QSTR_IV); } common_hal_aesio_aes_rekey(self, key, key_length, iv); @@ -142,14 +136,12 @@ STATIC void validate_length(aesio_aes_obj_t *self, size_t src_length, switch (self->mode) { case AES_MODE_ECB: if (src_length != 16) { - mp_raise_msg(&mp_type_ValueError, - translate("ECB only operates on 16 bytes at a time")); + mp_raise_ValueError(translate("ECB only operates on 16 bytes at a time")); } break; case AES_MODE_CBC: if ((src_length & 15) != 0) { - mp_raise_msg(&mp_type_ValueError, - translate("CBC blocks must be multiples of 16 bytes")); + mp_raise_ValueError(translate("CBC blocks must be multiples of 16 bytes")); } break; case AES_MODE_CTR: @@ -164,28 +156,21 @@ STATIC void validate_length(aesio_aes_obj_t *self, size_t src_length, //| 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)) { - mp_raise_TypeError_varg(translate("Expected a %q"), aesio_aes_type.name); - } - // Convert parameters into expected types. - aesio_aes_obj_t *aes = MP_OBJ_TO_PTR(aesio_obj); +STATIC mp_obj_t aesio_aes_encrypt_into(mp_obj_t self_in, mp_obj_t src, mp_obj_t dest) { + aesio_aes_obj_t *self = MP_OBJ_TO_PTR(self_in); mp_buffer_info_t srcbufinfo, destbufinfo; mp_get_buffer_raise(src, &srcbufinfo, MP_BUFFER_READ); mp_get_buffer_raise(dest, &destbufinfo, MP_BUFFER_WRITE); - validate_length(aes, srcbufinfo.len, destbufinfo.len); + validate_length(self, srcbufinfo.len, destbufinfo.len); memcpy(destbufinfo.buf, srcbufinfo.buf, srcbufinfo.len); - common_hal_aesio_aes_encrypt(aes, (uint8_t *)destbufinfo.buf, - destbufinfo.len); + common_hal_aesio_aes_encrypt(self, (uint8_t *)destbufinfo.buf, destbufinfo.len); return mp_const_none; } -STATIC MP_DEFINE_CONST_FUN_OBJ_3(aesio_aes_encrypt_into_obj, - aesio_aes_encrypt_into); +STATIC MP_DEFINE_CONST_FUN_OBJ_3(aesio_aes_encrypt_into_obj, aesio_aes_encrypt_into); //| def decrypt_into(self, src: ReadableBuffer, dest: WriteableBuffer) -> None: //| """Decrypt the buffer from ``src`` into ``dest``. @@ -194,43 +179,31 @@ STATIC MP_DEFINE_CONST_FUN_OBJ_3(aesio_aes_encrypt_into_obj, //| CTX mode, there are no restrictions.""" //| ... //| -STATIC mp_obj_t aesio_aes_decrypt_into(mp_obj_t aesio_obj, mp_obj_t src, - mp_obj_t dest) { - if (!mp_obj_is_type(aesio_obj, &aesio_aes_type)) { - mp_raise_TypeError_varg(translate("Expected a %q"), aesio_aes_type.name); - } - // Convert parameters into expected types. - aesio_aes_obj_t *aes = MP_OBJ_TO_PTR(aesio_obj); +STATIC mp_obj_t aesio_aes_decrypt_into(mp_obj_t self_in, mp_obj_t src, mp_obj_t dest) { + aesio_aes_obj_t *self = MP_OBJ_TO_PTR(self_in); mp_buffer_info_t srcbufinfo, destbufinfo; mp_get_buffer_raise(src, &srcbufinfo, MP_BUFFER_READ); mp_get_buffer_raise(dest, &destbufinfo, MP_BUFFER_WRITE); - validate_length(aes, srcbufinfo.len, destbufinfo.len); + validate_length(self, srcbufinfo.len, destbufinfo.len); memcpy(destbufinfo.buf, srcbufinfo.buf, srcbufinfo.len); - common_hal_aesio_aes_decrypt(aes, (uint8_t *)destbufinfo.buf, - destbufinfo.len); + common_hal_aesio_aes_decrypt(self, (uint8_t *)destbufinfo.buf, destbufinfo.len); return mp_const_none; } -STATIC MP_DEFINE_CONST_FUN_OBJ_3(aesio_aes_decrypt_into_obj, - aesio_aes_decrypt_into); +STATIC MP_DEFINE_CONST_FUN_OBJ_3(aesio_aes_decrypt_into_obj, aesio_aes_decrypt_into); + +STATIC mp_obj_t aesio_aes_get_mode(mp_obj_t self_in) { + aesio_aes_obj_t *self = MP_OBJ_TO_PTR(self_in); -STATIC mp_obj_t aesio_aes_get_mode(mp_obj_t aesio_obj) { - if (!mp_obj_is_type(aesio_obj, &aesio_aes_type)) { - mp_raise_TypeError_varg(translate("Expected a %q"), aesio_aes_type.name); - } - aesio_aes_obj_t *self = MP_OBJ_TO_PTR(aesio_obj); return MP_OBJ_NEW_SMALL_INT(self->mode); } MP_DEFINE_CONST_FUN_OBJ_1(aesio_aes_get_mode_obj, aesio_aes_get_mode); -STATIC mp_obj_t aesio_aes_set_mode(mp_obj_t aesio_obj, mp_obj_t mode_obj) { - if (!mp_obj_is_type(aesio_obj, &aesio_aes_type)) { - mp_raise_TypeError_varg(translate("Expected a %q"), aesio_aes_type.name); - } - aesio_aes_obj_t *self = MP_OBJ_TO_PTR(aesio_obj); +STATIC mp_obj_t aesio_aes_set_mode(mp_obj_t self_in, mp_obj_t mode_obj) { + aesio_aes_obj_t *self = MP_OBJ_TO_PTR(self_in); int mode = mp_obj_get_int(mode_obj); switch (mode) { @@ -239,7 +212,7 @@ STATIC mp_obj_t aesio_aes_set_mode(mp_obj_t aesio_obj, mp_obj_t mode_obj) { case AES_MODE_CTR: break; default: - mp_raise_TypeError(translate("Requested AES mode is unsupported")); + mp_raise_NotImplementedError(translate("Requested AES mode is unsupported")); } common_hal_aesio_aes_set_mode(self, mode); diff --git a/shared-bindings/alarm/__init__.c b/shared-bindings/alarm/__init__.c index bd11b16996..29c9b49d3f 100644 --- a/shared-bindings/alarm/__init__.c +++ b/shared-bindings/alarm/__init__.c @@ -27,12 +27,15 @@ #include "py/obj.h" #include "py/runtime.h" +#if CIRCUITPY_ESPULP +#include "bindings/espulp/ULPAlarm.h" +#endif + #include "shared-bindings/alarm/__init__.h" #include "shared-bindings/alarm/SleepMemory.h" #include "shared-bindings/alarm/pin/PinAlarm.h" #include "shared-bindings/alarm/time/TimeAlarm.h" #include "shared-bindings/alarm/touch/TouchAlarm.h" -#include "shared-bindings/alarm/coproc/CoprocAlarm.h" #include "shared-bindings/digitalio/DigitalInOut.h" #include "shared-bindings/supervisor/Runtime.h" #include "shared-bindings/time/__init__.h" @@ -70,6 +73,7 @@ //| """The most recently triggered alarm. If CircuitPython was sleeping, the alarm that woke it from sleep. //| If no alarm occured since the last hard reset or soft restart, value is ``None``. //| """ +//| // wake_alarm is implemented as a dictionary entry, so there's no code here. @@ -77,11 +81,13 @@ STATIC void validate_objs_are_alarms(size_t n_args, const mp_obj_t *objs) { for (size_t i = 0; i < n_args; i++) { if (mp_obj_is_type(objs[i], &alarm_pin_pinalarm_type) || mp_obj_is_type(objs[i], &alarm_time_timealarm_type) || - mp_obj_is_type(objs[i], &alarm_touch_touchalarm_type) || - mp_obj_is_type(objs[i], &alarm_coproc_coprocalarm_type)) { + #if CIRCUITPY_ESPULP + mp_obj_is_type(objs[i], &espulp_ulpalarm_type) || + #endif + mp_obj_is_type(objs[i], &alarm_touch_touchalarm_type)) { continue; } - mp_raise_TypeError_varg(translate("Expected an %q"), MP_QSTR_Alarm); + mp_raise_TypeError_varg(translate("Expected a kind of %q"), MP_QSTR_Alarm); } } @@ -202,10 +208,7 @@ STATIC mp_obj_t alarm_exit_and_deep_sleep_until_alarms(size_t n_args, const mp_o 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); + dios_array[i] = mp_arg_validate_type(dio, &digitalio_digitalinout_type, MP_QSTR_alarm); } common_hal_alarm_set_deep_sleep_alarms(n_args, pos_args, num_dios, dios_array); @@ -256,18 +259,6 @@ STATIC const mp_obj_module_t alarm_touch_module = { .globals = (mp_obj_dict_t *)&alarm_touch_globals, }; -STATIC const mp_map_elem_t alarm_coproc_globals_table[] = { - { MP_ROM_QSTR(MP_QSTR___name__), MP_ROM_QSTR(MP_QSTR_coproc) }, - { MP_ROM_QSTR(MP_QSTR_CoprocAlarm), MP_OBJ_FROM_PTR(&alarm_coproc_coprocalarm_type) }, -}; - -STATIC MP_DEFINE_CONST_DICT(alarm_coproc_globals, alarm_coproc_globals_table); - -STATIC const mp_obj_module_t alarm_coproc_module = { - .base = { &mp_type_module }, - .globals = (mp_obj_dict_t *)&alarm_coproc_globals, -}; - // The module table is mutable because .wake_alarm is a mutable attribute. STATIC mp_map_elem_t alarm_module_globals_table[] = { { MP_ROM_QSTR(MP_QSTR___name__), MP_ROM_QSTR(MP_QSTR_alarm) }, @@ -282,7 +273,6 @@ STATIC mp_map_elem_t alarm_module_globals_table[] = { { MP_ROM_QSTR(MP_QSTR_pin), MP_OBJ_FROM_PTR(&alarm_pin_module) }, { MP_ROM_QSTR(MP_QSTR_time), MP_OBJ_FROM_PTR(&alarm_time_module) }, { MP_ROM_QSTR(MP_QSTR_touch), MP_OBJ_FROM_PTR(&alarm_touch_module) }, - { MP_ROM_QSTR(MP_QSTR_coproc), MP_OBJ_FROM_PTR(&alarm_coproc_module) }, { MP_ROM_QSTR(MP_QSTR_SleepMemory), MP_OBJ_FROM_PTR(&alarm_sleep_memory_type) }, { MP_ROM_QSTR(MP_QSTR_sleep_memory), MP_OBJ_FROM_PTR(&alarm_sleep_memory_obj) }, diff --git a/shared-bindings/alarm/pin/PinAlarm.c b/shared-bindings/alarm/pin/PinAlarm.c index 6e8bc5341e..c75061b77a 100644 --- a/shared-bindings/alarm/pin/PinAlarm.c +++ b/shared-bindings/alarm/pin/PinAlarm.c @@ -74,7 +74,7 @@ STATIC mp_obj_t alarm_pin_pinalarm_make_new(const mp_obj_type_t *type, mp_uint_t 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 *pin = validate_obj_is_free_pin(args[ARG_pin].u_obj); + const mcu_pin_obj_t *pin = validate_obj_is_free_pin(args[ARG_pin].u_obj, MP_QSTR_pin); common_hal_alarm_pin_pinalarm_construct(self, pin, diff --git a/shared-bindings/alarm/time/TimeAlarm.c b/shared-bindings/alarm/time/TimeAlarm.c index 7bd0a309b9..abbb050c64 100644 --- a/shared-bindings/alarm/time/TimeAlarm.c +++ b/shared-bindings/alarm/time/TimeAlarm.c @@ -51,11 +51,12 @@ mp_obj_t MP_WEAK rtc_get_time_source_time(void) { //| ``monotonic_time``, or when `time.time()` would equal ``epoch_time``. //| Only one of the two arguments can be given. //| The alarm is not active until it is passed to an -//| `alarm`-enabling function, such as `alarm.light_sleep_until_alarms()` or +//| `alarm`-enabling sleep function, such as `alarm.light_sleep_until_alarms()` or //| `alarm.exit_and_deep_sleep_until_alarms()`. //| -//| If the given time is in the past when sleep occurs, the alarm will be triggered -//| immediately. +//| If the given time is already in the past, then an exception is raised. +//| If the sleep happens after the given time, then it will wake immediately +//| due to this time alarm. //| """ //| ... STATIC mp_obj_t alarm_time_timealarm_make_new(const mp_obj_type_t *type, diff --git a/shared-bindings/alarm/touch/TouchAlarm.c b/shared-bindings/alarm/touch/TouchAlarm.c index cce31e6ffe..20612cb106 100644 --- a/shared-bindings/alarm/touch/TouchAlarm.c +++ b/shared-bindings/alarm/touch/TouchAlarm.c @@ -56,7 +56,7 @@ STATIC mp_obj_t alarm_touch_touchalarm_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); - const mcu_pin_obj_t *pin = validate_obj_is_free_pin(args[ARG_pin].u_obj); + const mcu_pin_obj_t *pin = validate_obj_is_free_pin(args[ARG_pin].u_obj, MP_QSTR_pin); common_hal_alarm_touch_touchalarm_construct(self, pin); diff --git a/shared-bindings/analogbufio/BufferedIn.c b/shared-bindings/analogbufio/BufferedIn.c index 8bdc1b0ea8..4641df6891 100644 --- a/shared-bindings/analogbufio/BufferedIn.c +++ b/shared-bindings/analogbufio/BufferedIn.c @@ -47,10 +47,10 @@ //| import array //| //| length = 1000 -//| mybuffer = array.array("H", 0x0000 for i in range(length)) +//| mybuffer = array.array("H", [0x0000] * length) //| rate = 500000 -//| adcbuf = analogbufio.BufferedIn(board.GP26, mybuffer, rate) -//| adcbuf.read() +//| adcbuf = analogbufio.BufferedIn(board.GP26, sample_rate=rate) +//| adcbuf.readinto(mybuffer) //| adcbuf.deinit() //| for i in range(length): //| print(i, mybuffer[i]) @@ -60,64 +60,30 @@ //| (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) +//| def __init__(self, pin: microcontroller.Pin, *, sample_rate: int) -> None: +//| """Create a `BufferedIn` on the given pin and given sample rate. //| //| :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 }; + enum { ARG_pin, 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_QSTR_sample_rate, MP_ARG_KW_ONLY | MP_ARG_REQUIRED | MP_ARG_INT }, }; 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); + const mcu_pin_obj_t *pin = validate_obj_is_free_pin(args[ARG_pin].u_obj, MP_QSTR_pin); // Create local object - analogbufio_bufferedin_obj_t *self = m_new_obj(analogbufio_bufferedin_obj_t); + analogbufio_bufferedin_obj_t *self = m_new_obj_with_finaliser(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 - ); + // Call local interface in ports/common-hal/analogbufio + common_hal_analogbufio_bufferedin_construct(self, pin, args[ARG_sample_rate].u_int); return MP_OBJ_FROM_PTR(self); } @@ -153,23 +119,46 @@ STATIC mp_obj_t analogbufio_bufferedin___exit__(size_t n_args, const mp_obj_t *a } 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.""" +//| def readinto(self, buffer: WriteableBuffer) -> int: +//| """Fills the provided buffer with ADC voltage values. +//| +//| ADC values will be read into the given buffer at the supplied sample_rate. +//| Depending on the buffer typecode, 'B', 'H', samples are 8-bit byte-arrays or +//| 16-bit half-words and are always unsigned. +//| The ADC most significant bits of the ADC are kept. (See +//| https://docs.circuitpython.org/en/latest/docs/library/array.html) +//| +//| :param ~circuitpython_typing.WriteableBuffer buffer: buffer: A buffer for samples""" //| ... //| -STATIC mp_obj_t analogbufio_bufferedin_obj_read(mp_obj_t self_in) { +STATIC mp_obj_t analogbufio_bufferedin_obj_readinto(mp_obj_t self_in, mp_obj_t buffer_obj) { 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; + + // Buffer defined and allocated by user + mp_buffer_info_t bufinfo; + mp_get_buffer_raise(buffer_obj, &bufinfo, MP_BUFFER_READ); + + uint8_t bytes_per_sample = 1; + + // Bytes Per Sample + if (bufinfo.typecode == 'H') { + bytes_per_sample = 2; + } else if (bufinfo.typecode != 'B' && bufinfo.typecode != BYTEARRAY_TYPECODE) { + mp_raise_ValueError_varg(translate("%q must be a bytearray or array of type 'H' or 'B'"), MP_QSTR_buffer); + } + + mp_uint_t captured = common_hal_analogbufio_bufferedin_readinto(self, bufinfo.buf, bufinfo.len, bytes_per_sample); + return MP_OBJ_NEW_SMALL_INT(captured); } -MP_DEFINE_CONST_FUN_OBJ_1(analogbufio_bufferedin_read_obj, analogbufio_bufferedin_obj_read); +MP_DEFINE_CONST_FUN_OBJ_2(analogbufio_bufferedin_readinto_obj, analogbufio_bufferedin_obj_readinto); STATIC const mp_rom_map_elem_t analogbufio_bufferedin_locals_dict_table[] = { + { MP_ROM_QSTR(MP_QSTR___del__), MP_ROM_PTR(&analogbufio_bufferedin_deinit_obj) }, { 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)}, + { MP_ROM_QSTR(MP_QSTR_readinto), MP_ROM_PTR(&analogbufio_bufferedin_readinto_obj)}, }; diff --git a/shared-bindings/analogbufio/BufferedIn.h b/shared-bindings/analogbufio/BufferedIn.h index 7d59720cb4..cfd8050bc5 100644 --- a/shared-bindings/analogbufio/BufferedIn.h +++ b/shared-bindings/analogbufio/BufferedIn.h @@ -32,9 +32,9 @@ 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_construct(analogbufio_bufferedin_obj_t *self, const mcu_pin_obj_t *pin, 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); +uint32_t common_hal_analogbufio_bufferedin_readinto(analogbufio_bufferedin_obj_t *self, uint8_t *buffer, uint32_t len, uint8_t bytes_per_sample); #endif // __MICROPY_INCLUDED_SHARED_BINDINGS_ANALOGBUFIO_BUFFEREDIN_H__ diff --git a/shared-bindings/analogbufio/__init__.c b/shared-bindings/analogbufio/__init__.c index 49463d6334..749f1aec09 100644 --- a/shared-bindings/analogbufio/__init__.c +++ b/shared-bindings/analogbufio/__init__.c @@ -40,22 +40,6 @@ //| 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 `_ //| diff --git a/shared-bindings/analogio/AnalogIn.c b/shared-bindings/analogio/AnalogIn.c index 800c0bfa21..3b71f688c8 100644 --- a/shared-bindings/analogio/AnalogIn.c +++ b/shared-bindings/analogio/AnalogIn.c @@ -37,7 +37,7 @@ #include "shared-bindings/util.h" MP_WEAK const mcu_pin_obj_t *common_hal_analogio_analogin_validate_pin(mp_obj_t obj) { - return validate_obj_is_free_pin(obj); + return validate_obj_is_free_pin(obj, MP_QSTR_pin); } //| class AnalogIn: diff --git a/shared-bindings/analogio/AnalogOut.c b/shared-bindings/analogio/AnalogOut.c index de6811b5a3..6b10d37571 100644 --- a/shared-bindings/analogio/AnalogOut.c +++ b/shared-bindings/analogio/AnalogOut.c @@ -61,7 +61,7 @@ STATIC mp_obj_t analogio_analogout_make_new(const mp_obj_type_t *type, mp_uint_t // check arguments mp_arg_check_num(n_args, n_kw, 1, 1, false); - const mcu_pin_obj_t *pin = validate_obj_is_free_pin(args[0]); + const mcu_pin_obj_t *pin = validate_obj_is_free_pin(args[0], MP_QSTR_pin); analogio_analogout_obj_t *self = m_new_obj(analogio_analogout_obj_t); self->base.type = &analogio_analogout_type; diff --git a/shared-bindings/atexit/__init__.c b/shared-bindings/atexit/__init__.c index 914cac582b..9a91e0bc80 100644 --- a/shared-bindings/atexit/__init__.c +++ b/shared-bindings/atexit/__init__.c @@ -37,11 +37,11 @@ //| |see_cpython_module| :mod:`cpython:atexit`. //| """ //| ... +//| //| def register( //| func: Callable[..., Any], *args: Optional[Any], **kwargs: Optional[Any] //| ) -> Callable[..., Any]: -//| //| """Register func as a function to be executed at termination. //| //| Any optional arguments that are to be passed to func must be passed as arguments to `register()`. @@ -65,7 +65,6 @@ STATIC mp_obj_t atexit_register(size_t n_args, const mp_obj_t *pos_args, mp_map_ STATIC MP_DEFINE_CONST_FUN_OBJ_KW(atexit_register_obj, 1, atexit_register); //| def unregister(func: Callable[..., Any]) -> None: -//| //| """Remove func from the list of functions to be run at termination. //| //| `unregister()` silently does nothing if func was not previously registered. If func has been registered more than once, diff --git a/shared-bindings/audiobusio/I2SOut.c b/shared-bindings/audiobusio/I2SOut.c index b570191da9..3713caeb7b 100644 --- a/shared-bindings/audiobusio/I2SOut.c +++ b/shared-bindings/audiobusio/I2SOut.c @@ -110,9 +110,9 @@ STATIC mp_obj_t audiobusio_i2sout_make_new(const mp_obj_type_t *type, size_t n_a 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 *bit_clock = validate_obj_is_free_pin(args[ARG_bit_clock].u_obj); - const mcu_pin_obj_t *word_select = validate_obj_is_free_pin(args[ARG_word_select].u_obj); - const mcu_pin_obj_t *data = validate_obj_is_free_pin(args[ARG_data].u_obj); + const mcu_pin_obj_t *bit_clock = validate_obj_is_free_pin(args[ARG_bit_clock].u_obj, MP_QSTR_bit_clock); + const mcu_pin_obj_t *word_select = validate_obj_is_free_pin(args[ARG_word_select].u_obj, MP_QSTR_word_select); + const mcu_pin_obj_t *data = validate_obj_is_free_pin(args[ARG_data].u_obj, MP_QSTR_data); audiobusio_i2sout_obj_t *self = m_new_obj_with_finaliser(audiobusio_i2sout_obj_t); self->base.type = &audiobusio_i2sout_type; diff --git a/shared-bindings/audiobusio/PDMIn.c b/shared-bindings/audiobusio/PDMIn.c index db19ab6edd..b6a316fadb 100644 --- a/shared-bindings/audiobusio/PDMIn.c +++ b/shared-bindings/audiobusio/PDMIn.c @@ -112,8 +112,8 @@ STATIC mp_obj_t audiobusio_pdmin_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); - 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); + const mcu_pin_obj_t *clock_pin = validate_obj_is_free_pin(args[ARG_clock_pin].u_obj, MP_QSTR_clock_pin); + const mcu_pin_obj_t *data_pin = validate_obj_is_free_pin(args[ARG_data_pin].u_obj, MP_QSTR_data_pin); // create PDMIn object from the given pin audiobusio_pdmin_obj_t *self = m_new_obj(audiobusio_pdmin_obj_t); diff --git a/shared-bindings/audioio/AudioOut.c b/shared-bindings/audioio/AudioOut.c index a569097480..7909176114 100644 --- a/shared-bindings/audioio/AudioOut.c +++ b/shared-bindings/audioio/AudioOut.c @@ -105,8 +105,10 @@ STATIC mp_obj_t audioio_audioout_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); - const mcu_pin_obj_t *left_channel_pin = validate_obj_is_free_pin(args[ARG_left_channel].u_obj); - const mcu_pin_obj_t *right_channel_pin = validate_obj_is_free_pin_or_none(args[ARG_right_channel].u_obj); + const mcu_pin_obj_t *left_channel_pin = + validate_obj_is_free_pin(args[ARG_left_channel].u_obj, MP_QSTR_left_channel); + const mcu_pin_obj_t *right_channel_pin = + validate_obj_is_free_pin_or_none(args[ARG_right_channel].u_obj, MP_QSTR_right_channel); // create AudioOut object from the given pin audioio_audioout_obj_t *self = m_new_obj(audioio_audioout_obj_t); diff --git a/shared-bindings/audiomixer/MixerVoice.c b/shared-bindings/audiomixer/MixerVoice.c index 0bdef1f4cd..16a1be520f 100644 --- a/shared-bindings/audiomixer/MixerVoice.c +++ b/shared-bindings/audiomixer/MixerVoice.c @@ -62,7 +62,8 @@ STATIC mp_obj_t audiomixer_mixervoice_make_new(const mp_obj_type_t *type, size_t //| //| Sample must be an `audiocore.WaveFile`, `audiocore.RawSample`, `audiomixer.Mixer` or `audiomp3.MP3Decoder`. //| -//| The sample must match the `audiomixer.Mixer`'s encoding settings given in the constructor.""" +//| The sample must match the `audiomixer.Mixer`'s encoding settings given in the constructor. +//| """ //| ... STATIC mp_obj_t audiomixer_mixervoice_obj_play(size_t n_args, const mp_obj_t *pos_args, mp_map_t *kw_args) { enum { ARG_sample, ARG_loop }; diff --git a/shared-bindings/audiomp3/MP3Decoder.c b/shared-bindings/audiomp3/MP3Decoder.c index 4a8805b294..68e78cb0d5 100644 --- a/shared-bindings/audiomp3/MP3Decoder.c +++ b/shared-bindings/audiomp3/MP3Decoder.c @@ -45,7 +45,6 @@ //| """ //| //| def __init__(self, file: Union[str, typing.BinaryIO], buffer: WriteableBuffer) -> None: -//| //| """Load a .mp3 file for playback with `audioio.AudioOut` or `audiobusio.I2SOut`. //| //| :param Union[str, typing.BinaryIO] file: The name of a mp3 file (preferred) or an already opened mp3 file diff --git a/shared-bindings/audiopwmio/PWMAudioOut.c b/shared-bindings/audiopwmio/PWMAudioOut.c index 2e17bbda8c..b4cea75184 100644 --- a/shared-bindings/audiopwmio/PWMAudioOut.c +++ b/shared-bindings/audiopwmio/PWMAudioOut.c @@ -108,8 +108,10 @@ STATIC mp_obj_t audiopwmio_pwmaudioout_make_new(const mp_obj_type_t *type, size_ 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 *left_channel_pin = validate_obj_is_free_pin(args[ARG_left_channel].u_obj); - const mcu_pin_obj_t *right_channel_pin = validate_obj_is_free_pin_or_none(args[ARG_right_channel].u_obj); + const mcu_pin_obj_t *left_channel_pin = + validate_obj_is_free_pin(args[ARG_left_channel].u_obj, MP_QSTR_left_channel); + const mcu_pin_obj_t *right_channel_pin = + validate_obj_is_free_pin_or_none(args[ARG_right_channel].u_obj, MP_QSTR_right_channel); // create AudioOut object from the given pin audiopwmio_pwmaudioout_obj_t *self = m_new_obj(audiopwmio_pwmaudioout_obj_t); diff --git a/shared-bindings/bitbangio/I2C.c b/shared-bindings/bitbangio/I2C.c index 19c27740e3..9684b87df2 100644 --- a/shared-bindings/bitbangio/I2C.c +++ b/shared-bindings/bitbangio/I2C.c @@ -33,6 +33,7 @@ #include "shared/runtime/buffer_helper.h" #include "shared/runtime/context_manager_helpers.h" +#include "py/binary.h" #include "py/mperrno.h" #include "py/runtime.h" #include "supervisor/shared/translate/translate.h" @@ -76,8 +77,8 @@ STATIC mp_obj_t bitbangio_i2c_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); - 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); + const mcu_pin_obj_t *scl = validate_obj_is_free_pin(args[ARG_scl].u_obj, MP_QSTR_scl); + const mcu_pin_obj_t *sda = validate_obj_is_free_pin(args[ARG_sda].u_obj, MP_QSTR_sda); bitbangio_i2c_obj_t *self = m_new_obj(bitbangio_i2c_obj_t); self->base.type = &bitbangio_i2c_type; @@ -187,10 +188,15 @@ STATIC void readfrom(bitbangio_i2c_obj_t *self, mp_int_t address, mp_obj_t buffe mp_buffer_info_t bufinfo; mp_get_buffer_raise(buffer, &bufinfo, MP_BUFFER_WRITE); - size_t length = bufinfo.len; + int stride_in_bytes = mp_binary_get_size('@', bufinfo.typecode, NULL); + size_t length = bufinfo.len / stride_in_bytes; normalize_buffer_bounds(&start, end, &length); mp_arg_validate_length_min(length, 1, MP_QSTR_buffer); + // Treat start and length in terms of bytes from now on. + start *= stride_in_bytes; + length *= stride_in_bytes; + uint8_t status = shared_module_bitbangio_i2c_read(self, address, ((uint8_t *)bufinfo.buf) + start, length); if (status != 0) { mp_raise_OSError(status); @@ -244,10 +250,15 @@ STATIC void writeto(bitbangio_i2c_obj_t *self, mp_int_t address, mp_obj_t buffer mp_buffer_info_t bufinfo; mp_get_buffer_raise(buffer, &bufinfo, MP_BUFFER_READ); - size_t length = bufinfo.len; + int stride_in_bytes = mp_binary_get_size('@', bufinfo.typecode, NULL); + size_t length = bufinfo.len / stride_in_bytes; normalize_buffer_bounds(&start, end, &length); - // do the transfer + // Treat start and length in terms of bytes from now on. + start *= stride_in_bytes; + length *= stride_in_bytes; + + // Do the transfer uint8_t status = shared_module_bitbangio_i2c_write(self, address, ((uint8_t *)bufinfo.buf) + start, length, stop); diff --git a/shared-bindings/bitbangio/SPI.c b/shared-bindings/bitbangio/SPI.c index 1b7c877bda..cf4f34f0e4 100644 --- a/shared-bindings/bitbangio/SPI.c +++ b/shared-bindings/bitbangio/SPI.c @@ -35,6 +35,7 @@ #include "shared/runtime/buffer_helper.h" #include "shared/runtime/context_manager_helpers.h" +#include "py/binary.h" #include "py/mperrno.h" #include "py/runtime.h" #include "supervisor/shared/translate/translate.h" @@ -84,9 +85,9 @@ STATIC mp_obj_t bitbangio_spi_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); - const mcu_pin_obj_t *clock = validate_obj_is_free_pin(args[ARG_clock].u_obj); - const mcu_pin_obj_t *mosi = validate_obj_is_free_pin_or_none(args[ARG_MOSI].u_obj); - const mcu_pin_obj_t *miso = validate_obj_is_free_pin_or_none(args[ARG_MISO].u_obj); + const mcu_pin_obj_t *clock = validate_obj_is_free_pin(args[ARG_clock].u_obj, MP_QSTR_clock); + const mcu_pin_obj_t *mosi = validate_obj_is_free_pin_or_none(args[ARG_MOSI].u_obj, MP_QSTR_mosi); + const mcu_pin_obj_t *miso = validate_obj_is_free_pin_or_none(args[ARG_MISO].u_obj, MP_QSTR_miso); bitbangio_spi_obj_t *self = m_new_obj(bitbangio_spi_obj_t); self->base.type = &bitbangio_spi_type; @@ -192,9 +193,19 @@ STATIC mp_obj_t bitbangio_spi_obj_unlock(mp_obj_t self_in) { } MP_DEFINE_CONST_FUN_OBJ_1(bitbangio_spi_unlock_obj, bitbangio_spi_obj_unlock); -//| def write(self, buf: ReadableBuffer) -> None: +//| import sys +//| def write(self, buf: ReadableBuffer, *, start: int = 0, end: int = sys.maxsize) -> None: //| """Write the data contained in ``buf``. Requires the SPI being locked. -//| If the buffer is empty, nothing happens.""" +//| If the buffer is empty, nothing happens. +//| +//| If ``start`` or ``end`` is provided, then the buffer will be sliced +//| as if ``buffer[start:end]`` were passed, but without copying the data. +//| The number of bytes written will be the length of ``buffer[start:end]``. +//| +//| :param ReadableBuffer buffer: buffer containing the bytes to write +//| :param int start: beginning of buffer slice +//| :param int end: end of buffer slice; if not specified, use ``len(buffer)`` +//| """ //| ... 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 }; @@ -211,10 +222,16 @@ STATIC mp_obj_t bitbangio_spi_write(size_t n_args, const mp_obj_t *pos_args, mp_ mp_buffer_info_t bufinfo; mp_get_buffer_raise(args[ARG_buffer].u_obj, &bufinfo, MP_BUFFER_READ); + // Compute bounds in terms of elements, not bytes. + int stride_in_bytes = mp_binary_get_size('@', bufinfo.typecode, NULL); int32_t start = args[ARG_start].u_int; - size_t length = bufinfo.len; + size_t length = bufinfo.len / stride_in_bytes; normalize_buffer_bounds(&start, args[ARG_end].u_int, &length); + // Treat start and length in terms of bytes from now on. + start *= stride_in_bytes; + length *= stride_in_bytes; + if (length == 0) { return mp_const_none; } @@ -267,10 +284,16 @@ STATIC mp_obj_t bitbangio_spi_readinto(size_t n_args, const mp_obj_t *pos_args, mp_buffer_info_t bufinfo; mp_get_buffer_raise(args[ARG_buffer].u_obj, &bufinfo, MP_BUFFER_WRITE); + int stride_in_bytes = mp_binary_get_size('@', bufinfo.typecode, NULL); + // Compute bounds in terms of elements, not bytes. int32_t start = args[ARG_start].u_int; - size_t length = bufinfo.len; + size_t length = bufinfo.len / stride_in_bytes; normalize_buffer_bounds(&start, args[ARG_end].u_int, &length); + // Treat start and length in terms of bytes from now on. + start *= stride_in_bytes; + length *= stride_in_bytes; + if (length == 0) { return mp_const_none; } @@ -337,16 +360,24 @@ STATIC mp_obj_t bitbangio_spi_write_readinto(size_t n_args, const mp_obj_t *pos_ mp_buffer_info_t buf_out_info; mp_get_buffer_raise(args[ARG_out_buffer].u_obj, &buf_out_info, MP_BUFFER_READ); + int out_stride_in_bytes = mp_binary_get_size('@', buf_out_info.typecode, NULL); int32_t out_start = args[ARG_out_start].u_int; - size_t out_length = buf_out_info.len; + size_t out_length = buf_out_info.len / out_stride_in_bytes; normalize_buffer_bounds(&out_start, args[ARG_out_end].u_int, &out_length); mp_buffer_info_t buf_in_info; mp_get_buffer_raise(args[ARG_in_buffer].u_obj, &buf_in_info, MP_BUFFER_WRITE); + int in_stride_in_bytes = mp_binary_get_size('@', buf_in_info.typecode, NULL); int32_t in_start = args[ARG_in_start].u_int; - size_t in_length = buf_in_info.len; + size_t in_length = buf_in_info.len / in_stride_in_bytes; normalize_buffer_bounds(&in_start, args[ARG_in_end].u_int, &in_length); + // Treat start and length in terms of bytes from now on. + out_start *= out_stride_in_bytes; + out_length *= out_stride_in_bytes; + in_start *= in_stride_in_bytes; + in_length *= in_stride_in_bytes; + if (out_length != in_length) { mp_raise_ValueError(translate("buffer slices must be of equal length")); } diff --git a/shared-bindings/bitmaptools/__init__.c b/shared-bindings/bitmaptools/__init__.c index dd62b515fe..493ff93b09 100644 --- a/shared-bindings/bitmaptools/__init__.c +++ b/shared-bindings/bitmaptools/__init__.c @@ -50,6 +50,7 @@ //| `_ //| for information about using the :py:mod:`displayio` module. //| """ +//| STATIC int16_t validate_point(mp_obj_t point, int16_t default_value) { // Checks if point is None and returns default_value, otherwise decodes integer value @@ -319,7 +320,7 @@ STATIC mp_obj_t bitmaptools_alphablend(size_t n_args, const mp_obj_t *pos_args, mp_float_t factor1 = (args[ARG_factor_1].u_obj == mp_const_none) ? MICROPY_FLOAT_CONST(.5) : mp_obj_get_float(args[ARG_factor_1].u_obj); mp_float_t factor2 = (args[ARG_factor_2].u_obj == mp_const_none) ? 1 - factor1 : mp_obj_get_float(args[ARG_factor_2].u_obj); - displayio_colorspace_t colorspace = (displayio_colorspace_t)cp_enum_value(&displayio_colorspace_type, args[ARG_colorspace].u_obj); + displayio_colorspace_t colorspace = (displayio_colorspace_t)cp_enum_value(&displayio_colorspace_type, args[ARG_colorspace].u_obj, MP_QSTR_colorspace); if (destination->width != source1->width || destination->height != source1->height @@ -514,13 +515,6 @@ STATIC mp_obj_t bitmaptools_obj_draw_line(size_t n_args, const mp_obj_t *pos_arg int16_t x2 = args[ARG_x2].u_int; int16_t y2 = args[ARG_y2].u_int; - // verify points are within the bitmap boundary (inclusive) - if ((x1 < 0) || (x2 < 0) || (y1 < 0) || (y2 < 0) || - (x1 >= destination->width) || (x2 >= destination->width) || - (y1 >= destination->height) || (y2 >= destination->height)) { - mp_raise_ValueError(translate("out of range of target")); - } - common_hal_bitmaptools_draw_line(destination, x1, y1, x2, y2, value); return mp_const_none; @@ -741,8 +735,8 @@ STATIC mp_obj_t bitmaptools_dither(size_t n_args, const mp_obj_t *pos_args, mp_m mp_arg_parse_all(n_args, pos_args, kw_args, MP_ARRAY_SIZE(allowed_args), allowed_args, args); displayio_bitmap_t *source_bitmap = mp_arg_validate_type(args[ARG_source_bitmap].u_obj, &displayio_bitmap_type, MP_QSTR_source_bitmap); displayio_bitmap_t *dest_bitmap = mp_arg_validate_type(args[ARG_dest_bitmap].u_obj, &displayio_bitmap_type, MP_QSTR_dest_bitmap); - bitmaptools_dither_algorithm_t algorithm = cp_enum_value(&bitmaptools_dither_algorithm_type, args[ARG_algorithm].u_obj); - displayio_colorspace_t colorspace = cp_enum_value(&displayio_colorspace_type, args[ARG_source_colorspace].u_obj); + bitmaptools_dither_algorithm_t algorithm = cp_enum_value(&bitmaptools_dither_algorithm_type, args[ARG_algorithm].u_obj, MP_QSTR_algorithm); + displayio_colorspace_t colorspace = cp_enum_value(&displayio_colorspace_type, args[ARG_source_colorspace].u_obj, MP_QSTR_source_colorspace); if (source_bitmap->width != dest_bitmap->width || source_bitmap->height != dest_bitmap->height) { mp_raise_TypeError(translate("bitmap sizes must match")); diff --git a/shared-bindings/bitops/__init__.c b/shared-bindings/bitops/__init__.c index ea4e70ae3a..3107b310db 100644 --- a/shared-bindings/bitops/__init__.c +++ b/shared-bindings/bitops/__init__.c @@ -30,6 +30,7 @@ #include "shared-bindings/bitops/__init__.h" //| """Routines for low-level manipulation of binary data""" +//| //| def bit_transpose( //| input: ReadableBuffer, output: WriteableBuffer, width: int = 8 diff --git a/shared-bindings/board/__init__.c b/shared-bindings/board/__init__.c index e4003d4f6b..971ed2f676 100644 --- a/shared-bindings/board/__init__.c +++ b/shared-bindings/board/__init__.c @@ -58,10 +58,12 @@ //| """Board ID string. The unique identifier for the board model in //| circuitpython, as well as on circuitpython.org. //| Example: "hallowing_m0_express".""" +//| //| def I2C() -> busio.I2C: //| """Returns the `busio.I2C` object for the board's designated I2C bus(es). -//| The object created is a singleton, and uses the default parameter values for `busio.I2C`.""" +//| The object created is a singleton, and uses the default parameter values for `busio.I2C`. +//| """ //| ... //| #if CIRCUITPY_BOARD_I2C @@ -78,7 +80,8 @@ MP_DEFINE_CONST_FUN_OBJ_0(board_i2c_obj, board_i2c_0); //| def SPI() -> busio.SPI: //| """Returns the `busio.SPI` object for the board's designated SPI bus(es). -//| The object created is a singleton, and uses the default parameter values for `busio.SPI`.""" +//| The object created is a singleton, and uses the default parameter values for `busio.SPI`. +//| """ //| ... //| #if CIRCUITPY_BOARD_SPI @@ -95,7 +98,8 @@ MP_DEFINE_CONST_FUN_OBJ_0(board_spi_obj, board_spi_0); //| def UART() -> busio.UART: //| """Returns the `busio.UART` object for the board's designated UART bus(es). -//| The object created is a singleton, and uses the default parameter values for `busio.UART`.""" +//| The object created is a singleton, and uses the default parameter values for `busio.UART`. +//| """ //| ... //| #if CIRCUITPY_BOARD_UART diff --git a/shared-bindings/busio/I2C.c b/shared-bindings/busio/I2C.c index 71ac0e3995..5cf52eaa1a 100644 --- a/shared-bindings/busio/I2C.c +++ b/shared-bindings/busio/I2C.c @@ -33,6 +33,7 @@ #include "shared/runtime/buffer_helper.h" #include "shared/runtime/context_manager_helpers.h" +#include "py/binary.h" #include "py/runtime.h" #include "supervisor/shared/translate/translate.h" @@ -47,7 +48,6 @@ //| frequency: int = 100000, //| timeout: int = 255 //| ) -> None: -//| //| """I2C is a two-wire protocol for communicating between devices. At the //| physical level it consists of 2 wires: SCL and SDA, the clock and data //| lines respectively. @@ -80,8 +80,8 @@ STATIC mp_obj_t busio_i2c_make_new(const mp_obj_type_t *type, size_t n_args, siz 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); + const mcu_pin_obj_t *scl = validate_obj_is_free_pin(args[ARG_scl].u_obj, MP_QSTR_scl); + const mcu_pin_obj_t *sda = validate_obj_is_free_pin(args[ARG_sda].u_obj, MP_QSTR_sda); common_hal_busio_i2c_construct(self, scl, sda, args[ARG_frequency].u_int, args[ARG_timeout].u_int); return (mp_obj_t)self; @@ -207,12 +207,18 @@ STATIC mp_obj_t busio_i2c_readfrom_into(size_t n_args, const mp_obj_t *pos_args, mp_buffer_info_t bufinfo; mp_get_buffer_raise(args[ARG_buffer].u_obj, &bufinfo, MP_BUFFER_WRITE); - size_t length = bufinfo.len; + // Compute bounds in terms of elements, not bytes. + int stride_in_bytes = mp_binary_get_size('@', bufinfo.typecode, NULL); + size_t length = bufinfo.len / stride_in_bytes; int32_t start = args[ARG_start].u_int; const int32_t end = args[ARG_end].u_int; normalize_buffer_bounds(&start, end, &length); mp_arg_validate_length_min(length, 1, MP_QSTR_buffer); + // Treat start and length in terms of bytes from now on. + start *= stride_in_bytes; + length *= stride_in_bytes; + uint8_t status = common_hal_busio_i2c_read(self, args[ARG_address].u_int, ((uint8_t *)bufinfo.buf) + start, length); if (status != 0) { @@ -260,12 +266,18 @@ STATIC mp_obj_t busio_i2c_writeto(size_t n_args, const mp_obj_t *pos_args, mp_ma // get the buffer to write the data from mp_buffer_info_t bufinfo; mp_get_buffer_raise(args[ARG_buffer].u_obj, &bufinfo, MP_BUFFER_READ); + int stride_in_bytes = mp_binary_get_size('@', bufinfo.typecode, NULL); - size_t length = bufinfo.len; + // Compute bounds in terms of elements, not bytes. + size_t length = bufinfo.len / stride_in_bytes; int32_t start = args[ARG_start].u_int; const int32_t end = args[ARG_end].u_int; normalize_buffer_bounds(&start, end, &length); + // Treat start and length in terms of bytes from now on. + start *= stride_in_bytes; + length *= stride_in_bytes; + // do the transfer uint8_t status = common_hal_busio_i2c_write(self, args[ARG_address].u_int, ((uint8_t *)bufinfo.buf) + start, length); @@ -331,25 +343,29 @@ STATIC mp_obj_t busio_i2c_writeto_then_readfrom(size_t n_args, const mp_obj_t *p mp_buffer_info_t out_bufinfo; mp_get_buffer_raise(args[ARG_out_buffer].u_obj, &out_bufinfo, MP_BUFFER_READ); - - size_t out_length = out_bufinfo.len; + int out_stride_in_bytes = mp_binary_get_size('@', out_bufinfo.typecode, NULL); + size_t out_length = out_bufinfo.len / out_stride_in_bytes; int32_t out_start = args[ARG_out_start].u_int; const int32_t out_end = args[ARG_out_end].u_int; normalize_buffer_bounds(&out_start, out_end, &out_length); mp_buffer_info_t in_bufinfo; mp_get_buffer_raise(args[ARG_in_buffer].u_obj, &in_bufinfo, MP_BUFFER_WRITE); - - size_t in_length = in_bufinfo.len; + int in_stride_in_bytes = mp_binary_get_size('@', in_bufinfo.typecode, NULL); + size_t in_length = in_bufinfo.len / in_stride_in_bytes; int32_t in_start = args[ARG_in_start].u_int; const int32_t in_end = args[ARG_in_end].u_int; normalize_buffer_bounds(&in_start, in_end, &in_length); - if (in_length == 0) { - mp_raise_ValueError_varg(translate("%q length must be >= 1"), MP_QSTR_out_buffer); - } + mp_arg_validate_length_min(in_length, 1, MP_QSTR_out_buffer); + + // Treat start and length in terms of bytes from now on. + out_start *= out_stride_in_bytes; + out_length *= out_stride_in_bytes; + in_start *= in_stride_in_bytes; + in_length *= in_stride_in_bytes; uint8_t status = common_hal_busio_i2c_write_read(self, args[ARG_address].u_int, - ((uint8_t *)out_bufinfo.buf) + out_start, out_length,((uint8_t *)in_bufinfo.buf) + in_start, in_length); + ((uint8_t *)out_bufinfo.buf) + out_start, out_length, ((uint8_t *)in_bufinfo.buf) + in_start, in_length); if (status != 0) { mp_raise_OSError(status); } diff --git a/shared-bindings/busio/SPI.c b/shared-bindings/busio/SPI.c index badf80bf93..ccdceb5760 100644 --- a/shared-bindings/busio/SPI.c +++ b/shared-bindings/busio/SPI.c @@ -35,6 +35,7 @@ #include "shared/runtime/buffer_helper.h" #include "shared/runtime/context_manager_helpers.h" +#include "py/binary.h" #include "py/mperrno.h" #include "py/objproperty.h" #include "py/runtime.h" @@ -60,7 +61,6 @@ //| MISO: Optional[microcontroller.Pin] = None, //| half_duplex: bool = False, //| ) -> None: -//| //| """Construct an SPI object on the given pins. //| //| .. note:: The SPI peripherals allocated in order of desirability, if possible, @@ -103,9 +103,9 @@ STATIC mp_obj_t busio_spi_make_new(const mp_obj_type_t *type, size_t n_args, siz 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 *clock = validate_obj_is_free_pin(args[ARG_clock].u_obj); - const mcu_pin_obj_t *mosi = validate_obj_is_free_pin_or_none(args[ARG_MOSI].u_obj); - const mcu_pin_obj_t *miso = validate_obj_is_free_pin_or_none(args[ARG_MISO].u_obj); + const mcu_pin_obj_t *clock = validate_obj_is_free_pin(args[ARG_clock].u_obj, MP_QSTR_clock); + const mcu_pin_obj_t *mosi = validate_obj_is_free_pin_or_none(args[ARG_MOSI].u_obj, MP_QSTR_mosi); + const mcu_pin_obj_t *miso = validate_obj_is_free_pin_or_none(args[ARG_MISO].u_obj, MP_QSTR_miso); if (!miso && !mosi) { mp_raise_ValueError(translate("Must provide MISO or MOSI pin")); @@ -264,10 +264,16 @@ STATIC mp_obj_t busio_spi_write(size_t n_args, const mp_obj_t *pos_args, mp_map_ mp_buffer_info_t bufinfo; mp_get_buffer_raise(args[ARG_buffer].u_obj, &bufinfo, MP_BUFFER_READ); + // Compute bounds in terms of elements, not bytes. + int stride_in_bytes = mp_binary_get_size('@', bufinfo.typecode, NULL); int32_t start = args[ARG_start].u_int; - size_t length = bufinfo.len; + size_t length = bufinfo.len / stride_in_bytes; normalize_buffer_bounds(&start, args[ARG_end].u_int, &length); + // Treat start and length in terms of bytes from now on. + start *= stride_in_bytes; + length *= stride_in_bytes; + if (length == 0) { return mp_const_none; } @@ -323,10 +329,16 @@ STATIC mp_obj_t busio_spi_readinto(size_t n_args, const mp_obj_t *pos_args, mp_m mp_buffer_info_t bufinfo; mp_get_buffer_raise(args[ARG_buffer].u_obj, &bufinfo, MP_BUFFER_WRITE); + // Compute bounds in terms of elements, not bytes. + int stride_in_bytes = mp_binary_get_size('@', bufinfo.typecode, NULL); int32_t start = args[ARG_start].u_int; - size_t length = bufinfo.len; + size_t length = bufinfo.len / stride_in_bytes; normalize_buffer_bounds(&start, args[ARG_end].u_int, &length); + // Treat start and length in terms of bytes from now on. + start *= stride_in_bytes; + length *= stride_in_bytes; + if (length == 0) { return mp_const_none; } @@ -392,16 +404,24 @@ STATIC mp_obj_t busio_spi_write_readinto(size_t n_args, const mp_obj_t *pos_args mp_buffer_info_t buf_out_info; mp_get_buffer_raise(args[ARG_out_buffer].u_obj, &buf_out_info, MP_BUFFER_READ); + int out_stride_in_bytes = mp_binary_get_size('@', buf_out_info.typecode, NULL); int32_t out_start = args[ARG_out_start].u_int; - size_t out_length = buf_out_info.len; + size_t out_length = buf_out_info.len / out_stride_in_bytes; normalize_buffer_bounds(&out_start, args[ARG_out_end].u_int, &out_length); mp_buffer_info_t buf_in_info; mp_get_buffer_raise(args[ARG_in_buffer].u_obj, &buf_in_info, MP_BUFFER_WRITE); + int in_stride_in_bytes = mp_binary_get_size('@', buf_in_info.typecode, NULL); int32_t in_start = args[ARG_in_start].u_int; - size_t in_length = buf_in_info.len; + size_t in_length = buf_in_info.len / in_stride_in_bytes; normalize_buffer_bounds(&in_start, args[ARG_in_end].u_int, &in_length); + // Treat start and length in terms of bytes from now on. + out_start *= out_stride_in_bytes; + out_length *= out_stride_in_bytes; + in_start *= in_stride_in_bytes; + in_length *= in_stride_in_bytes; + if (out_length != in_length) { mp_raise_ValueError(translate("buffer slices must be of equal length")); } @@ -463,9 +483,6 @@ const mp_obj_type_t busio_spi_type = { .locals_dict = (mp_obj_dict_t *)&busio_spi_locals_dict, }; -busio_spi_obj_t *validate_obj_is_spi_bus(mp_obj_t obj) { - if (!mp_obj_is_type(obj, &busio_spi_type)) { - mp_raise_TypeError_varg(translate("Expected a %q"), busio_spi_type.name); - } - return MP_OBJ_TO_PTR(obj); +busio_spi_obj_t *validate_obj_is_spi_bus(mp_obj_t obj, qstr arg_name) { + return mp_arg_validate_type(obj, &busio_spi_type, arg_name); } diff --git a/shared-bindings/busio/SPI.h b/shared-bindings/busio/SPI.h index 76166580a0..3b8f831219 100644 --- a/shared-bindings/busio/SPI.h +++ b/shared-bindings/busio/SPI.h @@ -70,6 +70,6 @@ uint8_t common_hal_busio_spi_get_polarity(busio_spi_obj_t *self); // This is used by the supervisor to claim SPI devices indefinitely. extern void common_hal_busio_spi_never_reset(busio_spi_obj_t *self); -extern busio_spi_obj_t *validate_obj_is_spi_bus(mp_obj_t obj_in); +extern busio_spi_obj_t *validate_obj_is_spi_bus(mp_obj_t obj_in, qstr arg_name); #endif // MICROPY_INCLUDED_SHARED_BINDINGS_BUSIO_SPI_H diff --git a/shared-bindings/busio/UART.c b/shared-bindings/busio/UART.c index eb1d1685a5..aada49a051 100644 --- a/shared-bindings/busio/UART.c +++ b/shared-bindings/busio/UART.c @@ -116,8 +116,8 @@ STATIC mp_obj_t busio_uart_make_new(const mp_obj_type_t *type, size_t n_args, si 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 *rx = validate_obj_is_free_pin_or_none(args[ARG_rx].u_obj); - const mcu_pin_obj_t *tx = validate_obj_is_free_pin_or_none(args[ARG_tx].u_obj); + const mcu_pin_obj_t *rx = validate_obj_is_free_pin_or_none(args[ARG_rx].u_obj, MP_QSTR_rx); + const mcu_pin_obj_t *tx = validate_obj_is_free_pin_or_none(args[ARG_tx].u_obj, MP_QSTR_tx); if ((tx == NULL) && (rx == NULL)) { mp_raise_ValueError(translate("tx and rx cannot both be None")); @@ -137,9 +137,9 @@ STATIC mp_obj_t busio_uart_make_new(const mp_obj_type_t *type, size_t n_args, si mp_float_t timeout = mp_obj_get_float(args[ARG_timeout].u_obj); validate_timeout(timeout); - const mcu_pin_obj_t *rts = validate_obj_is_free_pin_or_none(args[ARG_rts].u_obj); - const mcu_pin_obj_t *cts = validate_obj_is_free_pin_or_none(args[ARG_cts].u_obj); - const mcu_pin_obj_t *rs485_dir = validate_obj_is_free_pin_or_none(args[ARG_rs485_dir].u_obj); + const mcu_pin_obj_t *rts = validate_obj_is_free_pin_or_none(args[ARG_rts].u_obj, MP_QSTR_rts); + const mcu_pin_obj_t *cts = validate_obj_is_free_pin_or_none(args[ARG_cts].u_obj, MP_QSTR_cts); + const mcu_pin_obj_t *rs485_dir = validate_obj_is_free_pin_or_none(args[ARG_rs485_dir].u_obj, MP_QSTR_rs485_dir); const bool rs485_invert = args[ARG_rs485_invert].u_bool; @@ -155,7 +155,7 @@ STATIC mp_obj_t busio_uart_make_new(const mp_obj_type_t *type, size_t n_args, si args[ARG_receiver_buffer_size].u_int, NULL, false); return (mp_obj_t)self; #else - mp_raise_ValueError(translate("Invalid pins")); + mp_raise_NotImplementedError(NULL); #endif // CIRCUITPY_BUSIO_UART } diff --git a/shared-bindings/canio/CAN.c b/shared-bindings/canio/CAN.c index b2e85c0244..bce581f501 100644 --- a/shared-bindings/canio/CAN.c +++ b/shared-bindings/canio/CAN.c @@ -77,8 +77,8 @@ STATIC mp_obj_t canio_can_make_new(const mp_obj_type_t *type, size_t n_args, siz 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 *rx_pin = validate_obj_is_free_pin_or_none(args[ARG_rx].u_obj); - const mcu_pin_obj_t *tx_pin = validate_obj_is_free_pin_or_none(args[ARG_tx].u_obj); + const mcu_pin_obj_t *rx_pin = validate_obj_is_free_pin_or_none(args[ARG_rx].u_obj, MP_QSTR_rx); + const mcu_pin_obj_t *tx_pin = validate_obj_is_free_pin_or_none(args[ARG_tx].u_obj, MP_QSTR_tx); if (!rx_pin && !tx_pin) { mp_raise_ValueError(translate("tx and rx cannot both be None")); } @@ -233,11 +233,7 @@ STATIC mp_obj_t canio_can_listen(size_t n_args, const mp_obj_t *pos_args, mp_map canio_match_obj_t *matches[nmatch]; for (size_t i = 0; i < nmatch; i++) { - const mp_obj_type_t *type = mp_obj_get_type(match_objects[i]); - if (type != &canio_match_type) { - mp_raise_TypeError_varg(translate("expected '%q' but got '%q'"), MP_QSTR_Match, type->name); - } - matches[i] = MP_OBJ_TO_PTR(match_objects[i]); + matches[i] = mp_arg_validate_type_in(match_objects[i], &canio_match_type, MP_QSTR_matches); } float timeout = args[ARG_timeout].u_obj ? mp_obj_get_float(args[ARG_timeout].u_obj) : 10.0f; @@ -272,7 +268,7 @@ STATIC mp_obj_t canio_can_send(mp_obj_t self_in, mp_obj_t message_in) { common_hal_canio_can_check_for_deinit(self); const mp_obj_type_t *message_type = mp_obj_get_type(message_in); if (message_type != &canio_message_type && message_type != &canio_remote_transmission_request_type) { - mp_raise_TypeError_varg(translate("expected '%q' or '%q' but got '%q'"), MP_QSTR_Message, MP_QSTR_RemoteTransmissionRequest, message_type->name); + mp_raise_TypeError_varg(translate("%q must be of type %q or %q, not %q"), MP_QSTR_message, MP_QSTR_Message, MP_QSTR_RemoteTransmissionRequest, message_type->name); } canio_message_obj_t *message = message_in; diff --git a/shared-bindings/canio/__init__.c b/shared-bindings/canio/__init__.c index 0416e5cb39..ecef7ebde6 100644 --- a/shared-bindings/canio/__init__.c +++ b/shared-bindings/canio/__init__.c @@ -58,6 +58,7 @@ //| For more information on working with this module, refer to //| `this Learn Guide on using it `_. //| """ +//| #include "py/obj.h" #include "py/enum.h" diff --git a/shared-bindings/coproc/Coproc.c b/shared-bindings/coproc/Coproc.c deleted file mode 100644 index 85595578c8..0000000000 --- a/shared-bindings/coproc/Coproc.c +++ /dev/null @@ -1,110 +0,0 @@ -/* - * This file is part of the Micro Python project, http://micropython.org/ - * - * The MIT License (MIT) - * - * Copyright (c) 2022 microDev - * - * Permission is hereby granted, free of charge, to any person obtaining a copy - * of this software and associated documentation files (the "Software"), to deal - * in the Software without restriction, including without limitation the rights - * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell - * copies of the Software, and to permit persons to whom the Software is - * furnished to do so, subject to the following conditions: - * - * The above copyright notice and this permission notice shall be included in - * all copies or substantial portions of the Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR - * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, - * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE - * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER - * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, - * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN - * THE SOFTWARE. - */ - -#include "shared/runtime/context_manager_helpers.h" -#include "py/objproperty.h" -#include "py/runtime.h" - -#include "shared-bindings/coproc/Coproc.h" -#include "shared-bindings/coproc/CoprocMemory.h" - -STATIC coproc_memory_obj_t *get_coproc_memory_obj(mp_obj_t *self_in) { - if (!mp_obj_is_type(*self_in, &coproc_memory_type)) { - mp_raise_TypeError_varg(translate("Expected a %q"), MP_QSTR_CoprocMemory); - } - return MP_OBJ_TO_PTR(*self_in); -} - -//| class Coproc: -//| def __init__(self, buffer: ReadableBuffer, memory: CoprocMemory) -> None: -//| """Loads the program binary into memory. -//| -//| :param buffer: The program binary to run on the core/co-processor -//| :param memory: The `CoprocMemory` object used to access shared memory""" -STATIC mp_obj_t coproc_coproc_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_memory }; - static const mp_arg_t allowed_args[] = { - { MP_QSTR_buffer, MP_ARG_REQUIRED | MP_ARG_OBJ }, - { MP_QSTR_memory, 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); - - coproc_coproc_obj_t *self = m_new_obj(coproc_coproc_obj_t); - self->base.type = &coproc_coproc_type; - - mp_buffer_info_t bufinfo; - mp_get_buffer_raise(args[ARG_buffer].u_obj, &bufinfo, MP_BUFFER_READ); - - coproc_memory_obj_t *coproc_memory = (args[ARG_memory].u_obj == mp_const_none) ? NULL : get_coproc_memory_obj(&args[ARG_memory].u_obj); - - common_hal_coproc_coproc_construct(self, bufinfo.buf, bufinfo.len, coproc_memory); - - return MP_OBJ_FROM_PTR(self); -} - -//| def deinit(self) -> None: -//| """Releases control of the underlying hardware so other classes can use it.""" -//| ... -STATIC mp_obj_t coproc_coproc_obj_deinit(mp_obj_t self_in) { - coproc_coproc_obj_t *self = MP_OBJ_TO_PTR(self_in); - common_hal_coproc_coproc_deinit(self); - return mp_const_none; -} -MP_DEFINE_CONST_FUN_OBJ_1(coproc_coproc_deinit_obj, coproc_coproc_obj_deinit); - -//| def __enter__(self) -> Coproc: -//| """No-op used in Context Managers.""" -//| ... -// Provided by context manager helper. - -//| def __exit__(self) -> None: -//| """Close the request.""" -//| ... -//| -STATIC mp_obj_t coproc_coproc_obj___exit__(size_t n_args, const mp_obj_t *args) { - (void)n_args; - mp_check_self(mp_obj_is_type(args[0], &coproc_coproc_type)); - return coproc_coproc_obj_deinit(args[0]); -} -STATIC MP_DEFINE_CONST_FUN_OBJ_VAR_BETWEEN(coproc_coproc___exit___obj, 4, 4, coproc_coproc_obj___exit__); - -STATIC const mp_rom_map_elem_t coproc_coproc_locals_dict_table[] = { - // context managers - { MP_ROM_QSTR(MP_QSTR___enter__), MP_ROM_PTR(&default___enter___obj) }, - { MP_ROM_QSTR(MP_QSTR___exit__), MP_ROM_PTR(&coproc_coproc___exit___obj) }, - - // functions - { MP_ROM_QSTR(MP_QSTR_deinit), MP_ROM_PTR(&coproc_coproc_deinit_obj) }, -}; -STATIC MP_DEFINE_CONST_DICT(coproc_coproc_locals_dict, coproc_coproc_locals_dict_table); - -const mp_obj_type_t coproc_coproc_type = { - { &mp_type_type }, - .name = MP_QSTR_Coproc, - .make_new = coproc_coproc_make_new, - .locals_dict = (mp_obj_dict_t *)&coproc_coproc_locals_dict, -}; diff --git a/shared-bindings/coproc/Coproc.h b/shared-bindings/coproc/Coproc.h deleted file mode 100644 index fbf9bd9ae0..0000000000 --- a/shared-bindings/coproc/Coproc.h +++ /dev/null @@ -1,40 +0,0 @@ -/* - * This file is part of the Micro Python project, http://micropython.org/ - * - * The MIT License (MIT) - * - * Copyright (c) 2022 microDev - * - * Permission is hereby granted, free of charge, to any person obtaining a copy - * of this software and associated documentation files (the "Software"), to deal - * in the Software without restriction, including without limitation the rights - * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell - * copies of the Software, and to permit persons to whom the Software is - * furnished to do so, subject to the following conditions: - * - * The above copyright notice and this permission notice shall be included in - * all copies or substantial portions of the Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR - * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, - * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE - * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER - * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, - * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN - * THE SOFTWARE. - */ - -#ifndef MICROPY_INCLUDED_SHARED_BINDINGS_COPROC_COPROC_H -#define MICROPY_INCLUDED_SHARED_BINDINGS_COPROC_COPROC_H - -#include "common-hal/coproc/Coproc.h" - -extern const mp_obj_type_t coproc_coproc_type; - -extern void common_hal_coproc_coproc_construct(coproc_coproc_obj_t *self, - const uint8_t *buf, const size_t buf_len, coproc_memory_obj_t *coproc_memory); - -extern void common_hal_coproc_coproc_deinit(coproc_coproc_obj_t *self); -extern bool common_hal_coproc_coproc_deinited(coproc_coproc_obj_t *self); - -#endif // MICROPY_INCLUDED_SHARED_BINDINGS_COPROC_COPROC_H diff --git a/shared-bindings/coproc/CoprocMemory.h b/shared-bindings/coproc/CoprocMemory.h deleted file mode 100644 index fdbb2fa0fa..0000000000 --- a/shared-bindings/coproc/CoprocMemory.h +++ /dev/null @@ -1,39 +0,0 @@ -/* - * This file is part of the Micro Python project, http://micropython.org/ - * - * The MIT License (MIT) - * - * Copyright (c) 2022 microDev - * - * Permission is hereby granted, free of charge, to any person obtaining a copy - * of this software and associated documentation files (the "Software"), to deal - * in the Software without restriction, including without limitation the rights - * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell - * copies of the Software, and to permit persons to whom the Software is - * furnished to do so, subject to the following conditions: - * - * The above copyright notice and this permission notice shall be included in - * all copies or substantial portions of the Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR - * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, - * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE - * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER - * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, - * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN - * THE SOFTWARE. - */ - -#ifndef MICROPY_INCLUDED_SHARED_BINDINGS_COPROC_COPROCMEMORY_H -#define MICROPY_INCLUDED_SHARED_BINDINGS_COPROC_COPROCMEMORY_H - -#include "common-hal/coproc/CoprocMemory.h" - -extern const mp_obj_type_t coproc_memory_type; - -uint32_t common_hal_coproc_memory_get_length(coproc_memory_obj_t *self); - -bool common_hal_coproc_memory_set_bytes(coproc_memory_obj_t *self, uint32_t start_index, const uint8_t *values, uint32_t len); -void common_hal_coproc_memory_get_bytes(coproc_memory_obj_t *self, uint32_t start_index, uint8_t *values, uint32_t len); - -#endif // MICROPY_INCLUDED_SHARED_BINDINGS_COPROC_COPROCMEMORY_H diff --git a/shared-bindings/coproc/__init__.c b/shared-bindings/coproc/__init__.c deleted file mode 100644 index 06b196d8be..0000000000 --- a/shared-bindings/coproc/__init__.c +++ /dev/null @@ -1,115 +0,0 @@ -/* - * This file is part of the Micro Python project, http://micropython.org/ - * - * The MIT License (MIT) - * - * Copyright (c) 2022 microDev - * - * Permission is hereby granted, free of charge, to any person obtaining a copy - * of this software and associated documentation files (the "Software"), to deal - * in the Software without restriction, including without limitation the rights - * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell - * copies of the Software, and to permit persons to whom the Software is - * furnished to do so, subject to the following conditions: - * - * The above copyright notice and this permission notice shall be included in - * all copies or substantial portions of the Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR - * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, - * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE - * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER - * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, - * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN - * THE SOFTWARE. - */ - -#include "shared-bindings/util.h" -#include "shared-bindings/coproc/__init__.h" -#include "shared-bindings/coproc/Coproc.h" -#include "shared-bindings/coproc/CoprocMemory.h" - -#include "py/runtime.h" - -//| """COPROC Module -//| -//| The `coproc` module adds ability to load and run -//| programs on a co-processor or a different cpu core. -//| -//| .. code-block:: python -//| -//| import coproc -//| -//| shared_mem = coproc.CoprocMemory(address=0x500007fc, length=1024) -//| -//| with open("program.bin", "rb") as f: -//| program = coproc.Coproc(buffer=f.read(), memory=shared_mem) -//| -//| coproc.run(program) -//| print(coproc.memory(program)[0]) -//| # coproc.halt(program) -//| """ -//| ... -//| - -STATIC coproc_coproc_obj_t *get_coproc_obj(mp_obj_t *self_in) { - if (!mp_obj_is_type(*self_in, &coproc_coproc_type)) { - mp_raise_TypeError_varg(translate("Expected a %q"), MP_QSTR_Coproc); - } - coproc_coproc_obj_t *self = MP_OBJ_TO_PTR(*self_in); - if (common_hal_coproc_coproc_deinited(self)) { - raise_deinited_error(); - } - return self; -} - -//| def run(*coproc: Coproc) -> None: -//| """Runs the loaded program.""" -//| ... -//| -STATIC mp_obj_t coproc_run(mp_obj_t self_in) { - common_hal_coproc_run(get_coproc_obj(&self_in)); - return mp_const_none; -} -STATIC MP_DEFINE_CONST_FUN_OBJ_1(coproc_run_obj, coproc_run); - -//| def halt(*coproc: Coproc) -> None: -//| """Halts the loaded program.""" -//| ... -//| -STATIC mp_obj_t coproc_halt(mp_obj_t self_in) { - common_hal_coproc_halt(get_coproc_obj(&self_in)); - return mp_const_none; -} -STATIC MP_DEFINE_CONST_FUN_OBJ_1(coproc_halt_obj, coproc_halt); - -//| def memory(*coproc: Coproc) -> CoprocMemory: -//| """Returns the shared memory as a bytearray.""" -//| ... -//| -STATIC mp_obj_t coproc_memory(mp_obj_t self_in) { - return common_hal_coproc_memory(get_coproc_obj(&self_in)); -} -STATIC MP_DEFINE_CONST_FUN_OBJ_1(coproc_memory_obj, coproc_memory); - -STATIC const mp_rom_map_elem_t coproc_module_globals_table[] = { - // module name - { MP_ROM_QSTR(MP_QSTR___name__), MP_ROM_QSTR(MP_QSTR_coproc) }, - - // module functions - { MP_ROM_QSTR(MP_QSTR_run), MP_ROM_PTR(&coproc_run_obj) }, - { MP_ROM_QSTR(MP_QSTR_halt), MP_ROM_PTR(&coproc_halt_obj) }, - { MP_ROM_QSTR(MP_QSTR_memory), MP_ROM_PTR(&coproc_memory_obj) }, - - // module classes - { MP_ROM_QSTR(MP_QSTR_Coproc), MP_OBJ_FROM_PTR(&coproc_coproc_type) }, - { MP_ROM_QSTR(MP_QSTR_CoprocMemory), MP_OBJ_FROM_PTR(&coproc_memory_type) }, -}; -STATIC MP_DEFINE_CONST_DICT(coproc_module_globals, coproc_module_globals_table); - -const mp_obj_module_t coproc_module = { - .base = { &mp_type_module }, - .globals = (mp_obj_dict_t *)&coproc_module_globals, -}; - -MP_REGISTER_MODULE(MP_QSTR_coproc, coproc_module, CIRCUITPY_COPROC); diff --git a/shared-bindings/countio/Counter.c b/shared-bindings/countio/Counter.c index eed676a17e..4f0e0a692f 100644 --- a/shared-bindings/countio/Counter.c +++ b/shared-bindings/countio/Counter.c @@ -53,7 +53,7 @@ STATIC mp_obj_t countio_counter_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); - const mcu_pin_obj_t *pin = validate_obj_is_free_pin(args[ARG_pin].u_obj); + const mcu_pin_obj_t *pin = validate_obj_is_free_pin(args[ARG_pin].u_obj, MP_QSTR_pin); const countio_edge_t edge = validate_edge(args[ARG_edge].u_obj, MP_QSTR_edge); const digitalio_pull_t pull = validate_pull(args[ARG_pull].u_obj, MP_QSTR_pull); // Make long-lived because some implementations use a pointer to the object as interrupt-handler data. diff --git a/shared-bindings/countio/Edge.c b/shared-bindings/countio/Edge.c index ec96163b3e..9b8e74304b 100644 --- a/shared-bindings/countio/Edge.c +++ b/shared-bindings/countio/Edge.c @@ -65,5 +65,5 @@ MAKE_PRINTER(countio, countio_edge); MAKE_ENUM_TYPE(countio, Edge, countio_edge); countio_edge_t validate_edge(mp_obj_t obj, qstr arg_name) { - return cp_enum_value(&countio_edge_type, mp_arg_validate_type(obj, &countio_edge_type, arg_name)); + return cp_enum_value(&countio_edge_type, obj, arg_name); } diff --git a/shared-bindings/digitalio/DigitalInOut.c b/shared-bindings/digitalio/DigitalInOut.c index eb3c1ec69d..de4d66f9d8 100644 --- a/shared-bindings/digitalio/DigitalInOut.c +++ b/shared-bindings/digitalio/DigitalInOut.c @@ -53,8 +53,10 @@ STATIC void check_result(digitalinout_result_t result) { return; case DIGITALINOUT_PIN_BUSY: mp_raise_ValueError_varg(translate("%q in use"), MP_QSTR_Pin); + #if CIRCUITPY_DIGITALIO_HAVE_INPUT_ONLY case DIGITALINOUT_INPUT_ONLY: mp_raise_ValueError_varg(translate("Invalid %q"), MP_QSTR_direction); + #endif #if CIRCUITPY_DIGITALIO_HAVE_INVALID_PULL case DIGITALINOUT_INVALID_PULL: mp_raise_ValueError_varg(translate("Invalid %q"), MP_QSTR_pull); @@ -67,7 +69,7 @@ STATIC void check_result(digitalinout_result_t result) { } MP_WEAK const mcu_pin_obj_t *common_hal_digitalio_validate_pin(mp_obj_t obj) { - return validate_obj_is_free_pin(obj); + return validate_obj_is_free_pin(obj, MP_QSTR_pin); } //| class DigitalInOut: diff --git a/shared-bindings/digitalio/DigitalInOut.h b/shared-bindings/digitalio/DigitalInOut.h index 80c3970f0e..79a700c905 100644 --- a/shared-bindings/digitalio/DigitalInOut.h +++ b/shared-bindings/digitalio/DigitalInOut.h @@ -38,7 +38,9 @@ extern const mp_obj_type_t digitalio_digitalinout_type; typedef enum { DIGITALINOUT_OK, DIGITALINOUT_PIN_BUSY, + #if CIRCUITPY_DIGITALIO_HAVE_INPUT_ONLY DIGITALINOUT_INPUT_ONLY, + #endif #if CIRCUITPY_DIGITALIO_HAVE_INVALID_PULL DIGITALINOUT_INVALID_PULL, #endif diff --git a/shared-bindings/digitalio/Pull.c b/shared-bindings/digitalio/Pull.c index 5934ddb9c2..3c7a036d1e 100644 --- a/shared-bindings/digitalio/Pull.c +++ b/shared-bindings/digitalio/Pull.c @@ -83,5 +83,5 @@ digitalio_pull_t validate_pull(mp_rom_obj_t obj, qstr arg_name) { if (obj == MP_ROM_NONE) { return PULL_NONE; } - mp_raise_TypeError_varg(translate("%q must be of type %q or None"), arg_name, MP_QSTR_Pull); + mp_raise_TypeError_varg(translate("%q must be of type %q or %q, not %q"), arg_name, MP_QSTR_Pull, MP_QSTR_None, mp_obj_get_type(obj)->name); } diff --git a/shared-bindings/displayio/ColorConverter.c b/shared-bindings/displayio/ColorConverter.c index 997174f28b..9c3d297fdc 100644 --- a/shared-bindings/displayio/ColorConverter.c +++ b/shared-bindings/displayio/ColorConverter.c @@ -61,7 +61,7 @@ STATIC mp_obj_t displayio_colorconverter_make_new(const mp_obj_type_t *type, siz displayio_colorconverter_t *self = m_new_obj(displayio_colorconverter_t); self->base.type = &displayio_colorconverter_type; - common_hal_displayio_colorconverter_construct(self, args[ARG_dither].u_bool, (displayio_colorspace_t)cp_enum_value(&displayio_colorspace_type, args[ARG_input_colorspace].u_obj)); + common_hal_displayio_colorconverter_construct(self, args[ARG_dither].u_bool, (displayio_colorspace_t)cp_enum_value(&displayio_colorspace_type, args[ARG_input_colorspace].u_obj, MP_QSTR_input_colorspace)); return MP_OBJ_FROM_PTR(self); } diff --git a/shared-bindings/displayio/Display.c b/shared-bindings/displayio/Display.c index 512969eb20..47b1de8914 100644 --- a/shared-bindings/displayio/Display.c +++ b/shared-bindings/displayio/Display.c @@ -41,6 +41,7 @@ //| _DisplayBus = Union["FourWire", "paralleldisplay.ParallelBus", "I2CDisplay"] //| """:py:class:`FourWire`, :py:class:`paralleldisplay.ParallelBus` or :py:class:`I2CDisplay`""" +//| //| class Display: //| """Manage updating a display over a display bus @@ -185,7 +186,8 @@ STATIC mp_obj_t displayio_display_make_new(const mp_obj_type_t *type, size_t n_a mp_buffer_info_t bufinfo; mp_get_buffer_raise(args[ARG_init_sequence].u_obj, &bufinfo, MP_BUFFER_READ); - const mcu_pin_obj_t *backlight_pin = validate_obj_is_free_pin_or_none(args[ARG_backlight_pin].u_obj); + const mcu_pin_obj_t *backlight_pin = + validate_obj_is_free_pin_or_none(args[ARG_backlight_pin].u_obj, MP_QSTR_backlight_pin); mp_float_t brightness = mp_obj_get_float(args[ARG_brightness].u_obj); @@ -281,7 +283,8 @@ MP_DEFINE_CONST_FUN_OBJ_2(displayio_display_show_obj, displayio_display_obj_show //| //| :param Optional[int] target_frames_per_second: The target frame rate that :py:func:`refresh` should try to //| achieve. Set to `None` for immediate refresh. -//| :param int minimum_frames_per_second: The minimum number of times the screen should be updated per second.""" +//| :param int minimum_frames_per_second: The minimum number of times the screen should be updated per second. +//| """ //| ... STATIC mp_obj_t displayio_display_obj_refresh(size_t n_args, const mp_obj_t *pos_args, mp_map_t *kw_args) { enum { ARG_target_frames_per_second, ARG_minimum_frames_per_second }; @@ -423,15 +426,29 @@ STATIC mp_obj_t displayio_display_obj_get_root_group(mp_obj_t self_in) { } MP_DEFINE_CONST_FUN_OBJ_1(displayio_display_get_root_group_obj, displayio_display_obj_get_root_group); -MP_PROPERTY_GETTER(displayio_display_root_group_obj, - (mp_obj_t)&displayio_display_get_root_group_obj); +STATIC mp_obj_t displayio_display_obj_set_root_group(mp_obj_t self_in, mp_obj_t group_in) { + displayio_display_obj_t *self = native_display(self_in); + displayio_group_t *group = NULL; + if (group_in != mp_const_none) { + group = MP_OBJ_TO_PTR(native_group(group_in)); + } + + common_hal_displayio_display_set_root_group(self, group); + return mp_const_none; +} +MP_DEFINE_CONST_FUN_OBJ_2(displayio_display_set_root_group_obj, displayio_display_obj_set_root_group); + +MP_PROPERTY_GETSET(displayio_display_root_group_obj, + (mp_obj_t)&displayio_display_get_root_group_obj, + (mp_obj_t)&displayio_display_set_root_group_obj); //| def fill_row(self, y: int, buffer: WriteableBuffer) -> WriteableBuffer: //| """Extract the pixels from a single row //| //| :param int y: The top edge of the area -//| :param ~circuitpython_typing.WriteableBuffer buffer: The buffer in which to place the pixel data""" +//| :param ~circuitpython_typing.WriteableBuffer buffer: The buffer in which to place the pixel data +//| """ //| ... //| STATIC mp_obj_t displayio_display_obj_fill_row(size_t n_args, const mp_obj_t *pos_args, mp_map_t *kw_args) { diff --git a/shared-bindings/displayio/Display.h b/shared-bindings/displayio/Display.h index 35ba0d479a..35f23ae40f 100644 --- a/shared-bindings/displayio/Display.h +++ b/shared-bindings/displayio/Display.h @@ -67,5 +67,6 @@ bool common_hal_displayio_display_set_brightness(displayio_display_obj_t *self, mp_obj_t common_hal_displayio_display_get_bus(displayio_display_obj_t *self); mp_obj_t common_hal_displayio_display_get_root_group(displayio_display_obj_t *self); +mp_obj_t common_hal_displayio_display_set_root_group(displayio_display_obj_t *self, displayio_group_t *root_group); #endif // MICROPY_INCLUDED_SHARED_BINDINGS_DISPLAYIO_DISPLAY_H diff --git a/shared-bindings/displayio/EPaperDisplay.c b/shared-bindings/displayio/EPaperDisplay.c index 7b77b42fa4..4745223ad3 100644 --- a/shared-bindings/displayio/EPaperDisplay.c +++ b/shared-bindings/displayio/EPaperDisplay.c @@ -117,7 +117,8 @@ //| :param float seconds_per_frame: Minimum number of seconds between screen refreshes //| :param bool always_toggle_chip_select: When True, chip select is toggled every byte //| :param bool grayscale: When true, the color ram is the low bit of 2-bit grayscale -//| :param bool two_byte_sequence_length: When true, use two bytes to define sequence length""" +//| :param bool two_byte_sequence_length: When true, use two bytes to define sequence length +//| """ //| ... STATIC mp_obj_t displayio_epaperdisplay_make_new(const mp_obj_type_t *type, size_t n_args, size_t n_kw, const mp_obj_t *all_args) { enum { ARG_display_bus, ARG_start_sequence, ARG_stop_sequence, ARG_width, ARG_height, @@ -167,7 +168,7 @@ STATIC mp_obj_t displayio_epaperdisplay_make_new(const mp_obj_type_t *type, size mp_get_buffer_raise(args[ARG_stop_sequence].u_obj, &stop_bufinfo, MP_BUFFER_READ); - const mcu_pin_obj_t *busy_pin = validate_obj_is_free_pin_or_none(args[ARG_busy_pin].u_obj); + const mcu_pin_obj_t *busy_pin = validate_obj_is_free_pin_or_none(args[ARG_busy_pin].u_obj, MP_QSTR_busy_pin); mp_int_t rotation = args[ARG_rotation].u_int; if (rotation % 90 != 0) { @@ -349,6 +350,30 @@ MP_DEFINE_CONST_FUN_OBJ_1(displayio_epaperdisplay_get_bus_obj, displayio_epaperd MP_PROPERTY_GETTER(displayio_epaperdisplay_bus_obj, (mp_obj_t)&displayio_epaperdisplay_get_bus_obj); +//| root_group: Group +//| """The root group on the epaper display.""" +//| +STATIC mp_obj_t displayio_epaperdisplay_obj_get_root_group(mp_obj_t self_in) { + displayio_epaperdisplay_obj_t *self = native_display(self_in); + return common_hal_displayio_epaperdisplay_get_root_group(self); +} +MP_DEFINE_CONST_FUN_OBJ_1(displayio_epaperdisplay_get_root_group_obj, displayio_epaperdisplay_obj_get_root_group); + +STATIC mp_obj_t displayio_epaperdisplay_obj_set_root_group(mp_obj_t self_in, mp_obj_t group_in) { + displayio_epaperdisplay_obj_t *self = native_display(self_in); + displayio_group_t *group = NULL; + if (group_in != mp_const_none) { + group = MP_OBJ_TO_PTR(native_group(group_in)); + } + + common_hal_displayio_epaperdisplay_set_root_group(self, group); + return mp_const_none; +} +MP_DEFINE_CONST_FUN_OBJ_2(displayio_epaperdisplay_set_root_group_obj, displayio_epaperdisplay_obj_set_root_group); + +MP_PROPERTY_GETSET(displayio_epaperdisplay_root_group_obj, + (mp_obj_t)&displayio_epaperdisplay_get_root_group_obj, + (mp_obj_t)&displayio_epaperdisplay_set_root_group_obj); STATIC const mp_rom_map_elem_t displayio_epaperdisplay_locals_dict_table[] = { { MP_ROM_QSTR(MP_QSTR_show), MP_ROM_PTR(&displayio_epaperdisplay_show_obj) }, @@ -361,6 +386,7 @@ STATIC const mp_rom_map_elem_t displayio_epaperdisplay_locals_dict_table[] = { { MP_ROM_QSTR(MP_QSTR_bus), MP_ROM_PTR(&displayio_epaperdisplay_bus_obj) }, { MP_ROM_QSTR(MP_QSTR_busy), MP_ROM_PTR(&displayio_epaperdisplay_busy_obj) }, { MP_ROM_QSTR(MP_QSTR_time_to_refresh), MP_ROM_PTR(&displayio_epaperdisplay_time_to_refresh_obj) }, + { MP_ROM_QSTR(MP_QSTR_root_group), MP_ROM_PTR(&displayio_epaperdisplay_root_group_obj) }, }; STATIC MP_DEFINE_CONST_DICT(displayio_epaperdisplay_locals_dict, displayio_epaperdisplay_locals_dict_table); diff --git a/shared-bindings/displayio/EPaperDisplay.h b/shared-bindings/displayio/EPaperDisplay.h index ba6dffcb4b..13fd51d132 100644 --- a/shared-bindings/displayio/EPaperDisplay.h +++ b/shared-bindings/displayio/EPaperDisplay.h @@ -48,6 +48,9 @@ bool common_hal_displayio_epaperdisplay_refresh(displayio_epaperdisplay_obj_t *s bool common_hal_displayio_epaperdisplay_show(displayio_epaperdisplay_obj_t *self, displayio_group_t *root_group); +mp_obj_t common_hal_displayio_epaperdisplay_get_root_group(displayio_epaperdisplay_obj_t *self); +bool common_hal_displayio_epaperdisplay_set_root_group(displayio_epaperdisplay_obj_t *self, displayio_group_t *root_group); + // Returns time in milliseconds. uint32_t common_hal_displayio_epaperdisplay_get_time_to_refresh(displayio_epaperdisplay_obj_t *self); bool common_hal_displayio_epaperdisplay_get_busy(displayio_epaperdisplay_obj_t *self); diff --git a/shared-bindings/displayio/FourWire.c b/shared-bindings/displayio/FourWire.c index edcf2ade0e..1f099f5061 100644 --- a/shared-bindings/displayio/FourWire.c +++ b/shared-bindings/displayio/FourWire.c @@ -89,9 +89,9 @@ STATIC mp_obj_t displayio_fourwire_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); - const mcu_pin_obj_t *command = validate_obj_is_free_pin_or_none(args[ARG_command].u_obj); - const mcu_pin_obj_t *chip_select = validate_obj_is_free_pin(args[ARG_chip_select].u_obj); - const mcu_pin_obj_t *reset = validate_obj_is_free_pin_or_none(args[ARG_reset].u_obj); + const mcu_pin_obj_t *command = validate_obj_is_free_pin_or_none(args[ARG_command].u_obj, MP_QSTR_command); + const mcu_pin_obj_t *chip_select = validate_obj_is_free_pin(args[ARG_chip_select].u_obj, MP_QSTR_chip_select); + const mcu_pin_obj_t *reset = validate_obj_is_free_pin_or_none(args[ARG_reset].u_obj, MP_QSTR_reset); mp_obj_t spi = mp_arg_validate_type(args[ARG_spi_bus].u_obj, &busio_spi_type, MP_QSTR_spi_bus); diff --git a/shared-bindings/displayio/I2CDisplay.c b/shared-bindings/displayio/I2CDisplay.c index 2374e58e4a..f2647b0b16 100644 --- a/shared-bindings/displayio/I2CDisplay.c +++ b/shared-bindings/displayio/I2CDisplay.c @@ -59,7 +59,8 @@ //| //| :param busio.I2C i2c_bus: The I2C bus that make up the clock and data lines //| :param int device_address: The I2C address of the device -//| :param microcontroller.Pin reset: Reset pin. When None only software reset can be used""" +//| :param microcontroller.Pin reset: Reset pin. When None only software reset can be used +//| """ //| ... STATIC mp_obj_t displayio_i2cdisplay_make_new(const mp_obj_type_t *type, size_t n_args, size_t n_kw, const mp_obj_t *all_args) { enum { ARG_i2c_bus, ARG_device_address, ARG_reset }; @@ -71,7 +72,7 @@ STATIC mp_obj_t displayio_i2cdisplay_make_new(const mp_obj_type_t *type, size_t 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 *reset = validate_obj_is_free_pin_or_none(args[ARG_reset].u_obj); + const mcu_pin_obj_t *reset = validate_obj_is_free_pin_or_none(args[ARG_reset].u_obj, MP_QSTR_reset); mp_obj_t i2c = mp_arg_validate_type(args[ARG_i2c_bus].u_obj, &busio_i2c_type, MP_QSTR_i2c_bus); displayio_i2cdisplay_obj_t *self = &allocate_display_bus_or_raise()->i2cdisplay_bus; diff --git a/shared-bindings/displayio/__init__.c b/shared-bindings/displayio/__init__.c index 80fcde6e49..3fcd1d082b 100644 --- a/shared-bindings/displayio/__init__.c +++ b/shared-bindings/displayio/__init__.c @@ -45,6 +45,7 @@ #endif #include "shared-bindings/displayio/Shape.h" #include "shared-bindings/displayio/TileGrid.h" +#include "shared-module/displayio/__init__.h" //| """Native helpers for driving displays //| @@ -95,6 +96,7 @@ STATIC const mp_rom_map_elem_t displayio_module_globals_table[] = { #endif { MP_ROM_QSTR(MP_QSTR_release_displays), MP_ROM_PTR(&displayio_release_displays_obj) }, + { MP_ROM_QSTR(MP_QSTR_CIRCUITPYTHON_TERMINAL), MP_ROM_PTR(&circuitpython_splash) }, }; STATIC MP_DEFINE_CONST_DICT(displayio_module_globals, displayio_module_globals_table); diff --git a/shared-bindings/dotenv/__init__.c b/shared-bindings/dotenv/__init__.c deleted file mode 100644 index 193338c7c2..0000000000 --- a/shared-bindings/dotenv/__init__.c +++ /dev/null @@ -1,113 +0,0 @@ -/* - * 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/dualbank/__init__.c b/shared-bindings/dualbank/__init__.c index d3f75a4153..b77fb6d76b 100644 --- a/shared-bindings/dualbank/__init__.c +++ b/shared-bindings/dualbank/__init__.c @@ -30,25 +30,32 @@ #include "supervisor/flash.h" #endif -//| """DUALBANK Module +//| """Dualbank Module //| -//| The `dualbank` module adds ability to update and switch -//| between the two app partitions. +//| The `dualbank` module adds ability to update and switch between the +//| two identical app partitions, which can contain different firmware versions. //| -//| There are two identical partitions, these contain different -//| firmware versions. //| Having two partitions enables rollback functionality. //| -//| The two partitions are defined as boot partition and -//| next-update partition. Calling `dualbank.flash()` writes -//| the next-update partition. +//| The two partitions are defined as the boot partition and the next-update partition. +//| Calling `dualbank.flash()` writes the next-update partition. //| -//| After the next-update partition is written a validation -//| check is performed and on a successful validation this -//| partition is set as the boot partition. On next reset, -//| firmware will be loaded from this partition. +//| After the next-update partition is written a validation check is performed +//| and on a successful validation this partition is set as the boot partition. +//| On next reset, firmware will be loaded from this partition. //| -//| Here is the sequence of commands to follow: +//| Use cases: +//| * Can be used for ``OTA`` Over-The-Air updates. +//| * Can be used for ``dual-boot`` of different firmware versions or platforms. +//| +//| .. note:: +//| +//| Boards with flash ``=2MB``: +//| This module is unavailable as the flash is only large enough for one app partition. +//| +//| Boards with flash ``>2MB``: +//| This module is enabled/disabled at runtime based on whether the ``CIRCUITPY`` drive +//| is extended or not. See `storage.erase_filesystem()` for more information. //| //| .. code-block:: python //| @@ -58,6 +65,7 @@ //| dualbank.switch() //| """ //| ... +//| #if CIRCUITPY_STORAGE_EXTEND STATIC void raise_error_if_storage_extended(void) { @@ -68,10 +76,12 @@ STATIC void raise_error_if_storage_extended(void) { #endif //| def flash(buffer: ReadableBuffer, offset: int = 0) -> None: -//| """Writes one of two app partitions at the given offset. +//| """Writes one of the two app partitions at the given offset. //| -//| This can be called multiple times when flashing the firmware -//| in small chunks. +//| This can be called multiple times when flashing the firmware in smaller chunks. +//| +//| :param ReadableBuffer buffer: The entire firmware or a partial chunk. +//| :param int offset: Start writing at this offset in the app partition. //| """ //| ... //| @@ -102,10 +112,9 @@ STATIC mp_obj_t dualbank_flash(size_t n_args, const mp_obj_t *pos_args, mp_map_t STATIC MP_DEFINE_CONST_FUN_OBJ_KW(dualbank_flash_obj, 0, dualbank_flash); //| def switch() -> None: -//| """Switches the boot partition. +//| """Switches to the next-update partition. //| -//| On next reset, firmware will be loaded from the partition -//| just switched over to. +//| On next reset, firmware will be loaded from the partition just switched over to. //| """ //| ... //| diff --git a/shared-bindings/framebufferio/FramebufferDisplay.c b/shared-bindings/framebufferio/FramebufferDisplay.c index 20e555eef9..030b924c1e 100644 --- a/shared-bindings/framebufferio/FramebufferDisplay.c +++ b/shared-bindings/framebufferio/FramebufferDisplay.c @@ -58,7 +58,8 @@ //| //| :param ~circuitpython_typing.FrameBuffer framebuffer: The framebuffer that the display is connected to //| :param bool auto_refresh: Automatically refresh the screen -//| :param int rotation: The rotation of the display in degrees clockwise. Must be in 90 degree increments (0, 90, 180, 270)""" +//| :param int rotation: The rotation of the display in degrees clockwise. Must be in 90 degree increments (0, 90, 180, 270) +//| """ //| ... STATIC mp_obj_t framebufferio_framebufferdisplay_make_new(const mp_obj_type_t *type, size_t n_args, size_t n_kw, const mp_obj_t *all_args) { enum { ARG_framebuffer, ARG_rotation, ARG_auto_refresh, NUM_ARGS }; @@ -134,7 +135,8 @@ MP_DEFINE_CONST_FUN_OBJ_2(framebufferio_framebufferdisplay_show_obj, framebuffer //| without calls to this.) //| //| :param int target_frames_per_second: How many times a second `refresh` should be called and the screen updated. -//| :param int minimum_frames_per_second: The minimum number of times the screen should be updated per second.""" +//| :param int minimum_frames_per_second: The minimum number of times the screen should be updated per second. +//| """ //| ... STATIC mp_obj_t framebufferio_framebufferdisplay_obj_refresh(size_t n_args, const mp_obj_t *pos_args, mp_map_t *kw_args) { enum { ARG_target_frames_per_second, ARG_minimum_frames_per_second }; @@ -263,7 +265,8 @@ MP_PROPERTY_GETTER(framebufferio_framebufferframebuffer_obj, //| """Extract the pixels from a single row //| //| :param int y: The top edge of the area -//| :param ~circuitpython_typing.WriteableBuffer buffer: The buffer in which to place the pixel data""" +//| :param ~circuitpython_typing.WriteableBuffer buffer: The buffer in which to place the pixel data +//| """ //| ... STATIC mp_obj_t framebufferio_framebufferdisplay_obj_fill_row(size_t n_args, const mp_obj_t *pos_args, mp_map_t *kw_args) { enum { ARG_y, ARG_buffer }; @@ -328,8 +331,24 @@ STATIC mp_obj_t framebufferio_framebufferdisplay_obj_get_root_group(mp_obj_t sel } 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 mp_obj_t framebufferio_framebufferdisplay_obj_set_root_group(mp_obj_t self_in, mp_obj_t group_in) { + framebufferio_framebufferdisplay_obj_t *self = native_display(self_in); + displayio_group_t *group = NULL; + if (group_in != mp_const_none) { + group = MP_OBJ_TO_PTR(native_group(group_in)); + } + + bool ok = common_hal_framebufferio_framebufferdisplay_set_root_group(self, group); + if (!ok) { + mp_raise_ValueError(translate("Group already used")); + } + return mp_const_none; +} +MP_DEFINE_CONST_FUN_OBJ_2(framebufferio_framebufferdisplay_set_root_group_obj, framebufferio_framebufferdisplay_obj_set_root_group); + +MP_PROPERTY_GETSET(framebufferio_framebufferdisplay_root_group_obj, + (mp_obj_t)&framebufferio_framebufferdisplay_get_root_group_obj, + (mp_obj_t)&framebufferio_framebufferdisplay_set_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) }, diff --git a/shared-bindings/framebufferio/FramebufferDisplay.h b/shared-bindings/framebufferio/FramebufferDisplay.h index 7c63587df7..6526e25afb 100644 --- a/shared-bindings/framebufferio/FramebufferDisplay.h +++ b/shared-bindings/framebufferio/FramebufferDisplay.h @@ -61,5 +61,6 @@ bool common_hal_framebufferio_framebufferdisplay_set_brightness(framebufferio_fr 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); +mp_obj_t common_hal_framebufferio_framebufferdisplay_set_root_group(framebufferio_framebufferdisplay_obj_t *self, displayio_group_t *root_group); #endif // MICROPY_INCLUDED_SHARED_BINDINGS_DISPLAYIO_FRAMEBUFFERDISPLAY_H diff --git a/shared-bindings/frequencyio/FrequencyIn.c b/shared-bindings/frequencyio/FrequencyIn.c index 3138f543e7..bf09196e3d 100644 --- a/shared-bindings/frequencyio/FrequencyIn.c +++ b/shared-bindings/frequencyio/FrequencyIn.c @@ -83,7 +83,7 @@ STATIC mp_obj_t frequencyio_frequencyin_make_new(const mp_obj_type_t *type, size 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 *pin = validate_obj_is_free_pin(args[ARG_pin].u_obj); + const mcu_pin_obj_t *pin = validate_obj_is_free_pin(args[ARG_pin].u_obj, MP_QSTR_pin); const uint16_t capture_period = args[ARG_capture_period].u_int; diff --git a/shared-bindings/getpass/__init__.c b/shared-bindings/getpass/__init__.c index 340b8fd7c6..811d78e03d 100644 --- a/shared-bindings/getpass/__init__.c +++ b/shared-bindings/getpass/__init__.c @@ -33,9 +33,9 @@ //| //| """ //| ... +//| //| def getpass(prompt: Optional[str] = "Password: ", stream: Optional[io.FileIO] = None) -> str: -//| //| """Prompt the user without echoing. //| //| :param str prompt: The user is prompted using the string ``prompt``, which defaults to ``'Password: '``. diff --git a/shared-bindings/gifio/GifWriter.c b/shared-bindings/gifio/GifWriter.c index 57c38b554e..a0de52e2cc 100644 --- a/shared-bindings/gifio/GifWriter.c +++ b/shared-bindings/gifio/GifWriter.c @@ -80,7 +80,7 @@ static mp_obj_t gifio_gifwriter_make_new(const mp_obj_type_t *type, size_t n_arg file, args[ARG_width].u_int, args[ARG_height].u_int, - (displayio_colorspace_t)cp_enum_value(&displayio_colorspace_type, args[ARG_colorspace].u_obj), + (displayio_colorspace_t)cp_enum_value(&displayio_colorspace_type, args[ARG_colorspace].u_obj, MP_QSTR_colorspace), args[ARG_loop].u_bool, args[ARG_dither].u_bool, own_file); diff --git a/shared-bindings/hashlib/Hash.c b/shared-bindings/hashlib/Hash.c index f385885b4d..e3cbbc39d3 100644 --- a/shared-bindings/hashlib/Hash.c +++ b/shared-bindings/hashlib/Hash.c @@ -49,7 +49,8 @@ MP_PROPERTY_GETTER(hashlib_hash_digest_size_obj, (mp_obj_t)&hashlib_hash_digest_ //| def update(self, data: ReadableBuffer) -> None: //| """Update the hash with the given bytes. //| -//| :param ~circuitpython_typing.ReadableBuffer data: Update the hash from data in this buffer""" +//| :param ~circuitpython_typing.ReadableBuffer data: Update the hash from data in this buffer +//| """ //| ... mp_obj_t hashlib_hash_update(mp_obj_t self_in, mp_obj_t buf_in) { mp_check_self(mp_obj_is_type(self_in, &hashlib_hash_type)); diff --git a/shared-bindings/i2ctarget/I2CTarget.c b/shared-bindings/i2ctarget/I2CTarget.c index 17da952118..a07d038c6f 100644 --- a/shared-bindings/i2ctarget/I2CTarget.c +++ b/shared-bindings/i2ctarget/I2CTarget.c @@ -81,8 +81,8 @@ STATIC mp_obj_t i2ctarget_i2c_target_make_new(const mp_obj_type_t *type, size_t 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); + const mcu_pin_obj_t *scl = validate_obj_is_free_pin(args[ARG_scl].u_obj, MP_QSTR_scl); + const mcu_pin_obj_t *sda = validate_obj_is_free_pin(args[ARG_sda].u_obj, MP_QSTR_sda); mp_obj_iter_buf_t iter_buf; mp_obj_t iterable = mp_getiter(args[ARG_addresses].u_obj, &iter_buf); diff --git a/shared-bindings/imagecapture/ParallelImageCapture.c b/shared-bindings/imagecapture/ParallelImageCapture.c index b6352514bf..d568da158f 100644 --- a/shared-bindings/imagecapture/ParallelImageCapture.c +++ b/shared-bindings/imagecapture/ParallelImageCapture.c @@ -72,9 +72,9 @@ STATIC mp_obj_t imagecapture_parallelimagecapture_make_new(const mp_obj_type_t * uint8_t pin_count; validate_pins(MP_QSTR_data, pins, MP_ARRAY_SIZE(pins), args[ARG_data_pins].u_obj, &pin_count); - const mcu_pin_obj_t *clock = validate_obj_is_free_pin(args[ARG_clock].u_obj); - const mcu_pin_obj_t *vsync = validate_obj_is_free_pin_or_none(args[ARG_vsync].u_obj); - const mcu_pin_obj_t *href = validate_obj_is_free_pin_or_none(args[ARG_href].u_obj); + const mcu_pin_obj_t *clock = validate_obj_is_free_pin(args[ARG_clock].u_obj, MP_QSTR_clock); + const mcu_pin_obj_t *vsync = validate_obj_is_free_pin_or_none(args[ARG_vsync].u_obj, MP_QSTR_vsync); + const mcu_pin_obj_t *href = validate_obj_is_free_pin_or_none(args[ARG_href].u_obj, MP_QSTR_href); imagecapture_parallelimagecapture_obj_t *self = m_new_obj(imagecapture_parallelimagecapture_obj_t); self->base.type = &imagecapture_parallelimagecapture_type; diff --git a/shared-bindings/imagecapture/__init__.c b/shared-bindings/imagecapture/__init__.c index fdd4424114..71d0b9125b 100644 --- a/shared-bindings/imagecapture/__init__.c +++ b/shared-bindings/imagecapture/__init__.c @@ -35,7 +35,7 @@ //| //| .. seealso:: //| -//| Espressif microcontrollers use the `esp32_camera` module together. +//| Espressif microcontrollers use the `espcamera` module together. //| //| """ STATIC const mp_rom_map_elem_t imagecapture_module_globals_table[] = { diff --git a/shared-bindings/ipaddress/__init__.c b/shared-bindings/ipaddress/__init__.c index fb4c8bf38d..6da5a52299 100644 --- a/shared-bindings/ipaddress/__init__.c +++ b/shared-bindings/ipaddress/__init__.c @@ -35,6 +35,7 @@ //| The `ipaddress` module provides types for IP addresses. It is a subset of CPython's ipaddress //| module. //| """ +//| bool ipaddress_parse_ipv4address(const char *str_data, size_t str_len, uint32_t *ip_out) { diff --git a/shared-bindings/is31fl3741/IS31FL3741.c b/shared-bindings/is31fl3741/IS31FL3741.c index 706e3deb2b..17b12da67a 100644 --- a/shared-bindings/is31fl3741/IS31FL3741.c +++ b/shared-bindings/is31fl3741/IS31FL3741.c @@ -141,7 +141,8 @@ MP_DEFINE_CONST_FUN_OBJ_VAR_BETWEEN(is31fl3741_IS31FL3741_set_led_obj, 4, 4, is3 //| """Write buf out on the I2C bus to the IS31FL3741. //| //| :param ~Tuple[int, ...] mapping: map the pixels in the buffer to the order addressed by the driver chip -//| :param ~_typing.ReadableBuffer buf: The bytes to clock out. No assumption is made about color order""" +//| :param ~_typing.ReadableBuffer buf: The bytes to clock out. No assumption is made about color order +//| """ //| ... //| STATIC mp_obj_t is31fl3741_IS31FL3741_write(mp_obj_t self_in, mp_obj_t mapping, mp_obj_t buffer) { diff --git a/shared-bindings/keypad/Event.c b/shared-bindings/keypad/Event.c index 56a5815636..c8d24294f8 100644 --- a/shared-bindings/keypad/Event.c +++ b/shared-bindings/keypad/Event.c @@ -148,7 +148,8 @@ STATIC mp_obj_t keypad_event_binary_op(mp_binary_op_t op, mp_obj_t lhs_in, mp_ob //| def __hash__(self) -> int: //| """Returns a hash for the `Event`, so it can be used in dictionaries, etc.. //| -//| Note that as events with different timestamps compare equal, they also hash to the same value.""" +//| Note that as events with different timestamps compare equal, they also hash to the same value. +//| """ //| ... //| STATIC mp_obj_t keypad_event_unary_op(mp_unary_op_t op, mp_obj_t self_in) { diff --git a/shared-bindings/keypad/KeyMatrix.c b/shared-bindings/keypad/KeyMatrix.c index 28a68602ab..49723dbb9e 100644 --- a/shared-bindings/keypad/KeyMatrix.c +++ b/shared-bindings/keypad/KeyMatrix.c @@ -102,13 +102,13 @@ STATIC mp_obj_t keypad_keymatrix_make_new(const mp_obj_type_t *type, size_t n_ar for (size_t row = 0; row < num_row_pins; row++) { const mcu_pin_obj_t *pin = - validate_obj_is_free_pin(mp_obj_subscr(row_pins, MP_OBJ_NEW_SMALL_INT(row), MP_OBJ_SENTINEL)); + validate_obj_is_free_pin(mp_obj_subscr(row_pins, MP_OBJ_NEW_SMALL_INT(row), MP_OBJ_SENTINEL), MP_QSTR_pin); row_pins_array[row] = pin; } for (size_t column = 0; column < num_column_pins; column++) { const mcu_pin_obj_t *pin = - validate_obj_is_free_pin(mp_obj_subscr(column_pins, MP_OBJ_NEW_SMALL_INT(column), MP_OBJ_SENTINEL)); + validate_obj_is_free_pin(mp_obj_subscr(column_pins, MP_OBJ_NEW_SMALL_INT(column), MP_OBJ_SENTINEL), MP_QSTR_pin); column_pins_array[column] = pin; } diff --git a/shared-bindings/keypad/Keys.c b/shared-bindings/keypad/Keys.c index 3a9eb84cf3..10519958c7 100644 --- a/shared-bindings/keypad/Keys.c +++ b/shared-bindings/keypad/Keys.c @@ -100,7 +100,7 @@ STATIC mp_obj_t keypad_keys_make_new(const mp_obj_type_t *type, size_t n_args, s for (mp_uint_t i = 0; i < num_pins; i++) { pins_array[i] = - validate_obj_is_free_pin(mp_obj_subscr(pins, MP_OBJ_NEW_SMALL_INT(i), MP_OBJ_SENTINEL)); + validate_obj_is_free_pin(mp_obj_subscr(pins, MP_OBJ_NEW_SMALL_INT(i), MP_OBJ_SENTINEL), MP_QSTR_pin); } common_hal_keypad_keys_construct(self, num_pins, pins_array, value_when_pressed, args[ARG_pull].u_bool, interval, max_events); diff --git a/shared-bindings/keypad/ShiftRegisterKeys.c b/shared-bindings/keypad/ShiftRegisterKeys.c index 0703a78b66..9113be33d2 100644 --- a/shared-bindings/keypad/ShiftRegisterKeys.c +++ b/shared-bindings/keypad/ShiftRegisterKeys.c @@ -98,9 +98,9 @@ STATIC mp_obj_t keypad_shiftregisterkeys_make_new(const mp_obj_type_t *type, siz 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 *clock = validate_obj_is_free_pin(args[ARG_clock].u_obj); - const mcu_pin_obj_t *data = validate_obj_is_free_pin(args[ARG_data].u_obj); - const mcu_pin_obj_t *latch = validate_obj_is_free_pin(args[ARG_latch].u_obj); + const mcu_pin_obj_t *clock = validate_obj_is_free_pin(args[ARG_clock].u_obj, MP_QSTR_clock); + const mcu_pin_obj_t *data = validate_obj_is_free_pin(args[ARG_data].u_obj, MP_QSTR_data); + const mcu_pin_obj_t *latch = validate_obj_is_free_pin(args[ARG_latch].u_obj, MP_QSTR_latch); const bool value_to_latch = args[ARG_value_to_latch].u_bool; const size_t key_count = (size_t)mp_arg_validate_int_min(args[ARG_key_count].u_int, 1, MP_QSTR_key_count); diff --git a/shared-bindings/math/__init__.c b/shared-bindings/math/__init__.c index 58405564db..8aee44ffb8 100644 --- a/shared-bindings/math/__init__.c +++ b/shared-bindings/math/__init__.c @@ -86,6 +86,7 @@ STATIC NORETURN void math_error(void) { //| //| pi: float //| """the ratio of a circle's circumference to its diameter""" +//| //| def acos(x: float) -> float: //| """Return the inverse cosine of ``x``.""" @@ -371,7 +372,7 @@ STATIC mp_obj_t mp_math_log(size_t n_args, const mp_obj_t *args) { #pragma GCC diagnostic ignored "-Wfloat-equal" } else if (base == (mp_float_t)1.0) { #pragma GCC diagnostic pop - mp_raise_msg(&mp_type_ZeroDivisionError, translate("division by zero")); + math_error(); } return mp_obj_new_float(l / MICROPY_FLOAT_C_FUN(log)(base)); } diff --git a/shared-bindings/mdns/Server.c b/shared-bindings/mdns/Server.c index aab7f7e350..0d06d67f0d 100644 --- a/shared-bindings/mdns/Server.c +++ b/shared-bindings/mdns/Server.c @@ -33,6 +33,10 @@ #include "shared-bindings/mdns/Server.h" #include "shared-bindings/util.h" +#if CIRCUITPY_WEB_WORKFLOW +#include "supervisor/shared/web_workflow/web_workflow.h" +#endif + //| class Server: //| """The MDNS Server responds to queries for this device's information and allows for querying //| other devices.""" @@ -53,7 +57,14 @@ STATIC mp_obj_t mdns_server_make_new(const mp_obj_type_t *type, size_t n_args, s 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); - mdns_server_obj_t *self = m_new_obj(mdns_server_obj_t); + #if CIRCUITPY_WEB_WORKFLOW + mdns_server_obj_t *web_workflow_mdns = supervisor_web_workflow_mdns(args[ARG_network_interface].u_obj); + if (web_workflow_mdns != NULL) { + return web_workflow_mdns; + } + #endif + + mdns_server_obj_t *self = m_new_obj_with_finaliser(mdns_server_obj_t); self->base.type = &mdns_server_type; common_hal_mdns_server_construct(self, args[ARG_network_interface].u_obj); @@ -194,6 +205,7 @@ STATIC const mp_rom_map_elem_t mdns_server_locals_dict_table[] = { { MP_ROM_QSTR(MP_QSTR_find), MP_ROM_PTR(&mdns_server_find_obj) }, { MP_ROM_QSTR(MP_QSTR_advertise_service), MP_ROM_PTR(&mdns_server_advertise_service_obj) }, + { MP_ROM_QSTR(MP_QSTR___del__), MP_ROM_PTR(&mdns_server_deinit_obj) }, { MP_ROM_QSTR(MP_QSTR_deinit), MP_ROM_PTR(&mdns_server_deinit_obj) }, }; diff --git a/shared-bindings/coproc/CoprocMemory.c b/shared-bindings/memorymap/AddressRange.c similarity index 58% rename from shared-bindings/coproc/CoprocMemory.c rename to shared-bindings/memorymap/AddressRange.c index 0d49a2f008..fb55c07efe 100644 --- a/shared-bindings/coproc/CoprocMemory.c +++ b/shared-bindings/memorymap/AddressRange.c @@ -3,7 +3,7 @@ * * The MIT License (MIT) * - * Copyright (c) 2022 microDev + * 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 @@ -28,45 +28,62 @@ #include "py/objproperty.h" #include "py/runtime.h" #include "py/runtime0.h" - -#include "shared-bindings/coproc/CoprocMemory.h" +#include "shared-bindings/memorymap/AddressRange.h" #include "supervisor/shared/translate/translate.h" -//| class CoprocMemory: -//| def __init__(self, address: int, length: int) -> None: -//| """Initialize coproc shared memory. +//| class AddressRange: +//| r"""Presents a range of addresses as a bytearray. //| -//| :param address: address of shared memory -//| :param length: length of shared memory""" -STATIC mp_obj_t coproc_memory_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_length }; - static const mp_arg_t allowed_args[] = { - { MP_QSTR_address, MP_ARG_REQUIRED | MP_ARG_INT }, - { MP_QSTR_length, MP_ARG_REQUIRED | MP_ARG_INT }, - }; +//| The addresses may access memory or memory mapped peripherals. +//| +//| Some address ranges may be protected by CircuitPython to prevent errors. +//| An exception will be raised when constructing an AddressRange for an +//| invalid or protected address. +//| +//| Multiple AddressRanges may overlap. There is no "claiming" of addresses. +//| +//| Example usage on ESP32-S2:: +//| +//| import memorymap +//| rtc_slow_mem = memorymap.AddressRange(start=0x50000000, length=0x2000) +//| rtc_slow_mem[0:3] = b"\xcc\x10\x00" +//| """ +//| def __init__(self, *, start, length) -> None: +//| """Constructs an address range starting at ``start`` and ending at +//| ``start + length``. An exception will be raised if any of the +//| addresses are invalid or protected.""" +//| ... +STATIC mp_obj_t memorymap_addressrange_make_new(const mp_obj_type_t *type, size_t n_args, size_t n_kw, const mp_obj_t *all_args) { + enum { ARG_start, ARG_length }; + static const mp_arg_t allowed_args[] = { + { MP_QSTR_start, MP_ARG_KW_ONLY | MP_ARG_REQUIRED | MP_ARG_INT }, + { MP_QSTR_length, MP_ARG_KW_ONLY | MP_ARG_REQUIRED | MP_ARG_INT }, + }; 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); - coproc_memory_obj_t *self = m_new_obj(coproc_memory_obj_t); - self->base.type = &coproc_memory_type; - self->address = args[ARG_address].u_int; - self->len = args[ARG_length].u_int; + size_t start = + mp_arg_validate_int_min(args[ARG_start].u_int, 0, MP_QSTR_start); + size_t length = + mp_arg_validate_int_min(args[ARG_length].u_int, 1, MP_QSTR_length); + + + memorymap_addressrange_obj_t *self = m_new_obj(memorymap_addressrange_obj_t); + self->base.type = &memorymap_addressrange_type; + + common_hal_memorymap_addressrange_construct(self, (uint8_t *)start, length); return MP_OBJ_FROM_PTR(self); } -//| def __bool__(self) -> bool: -//| """``coproc_memory`` is ``True`` if its length is greater than zero. -//| This is an easy way to check for its existence. -//| """ -//| ... +//| def __bool__(self) -> bool: ... //| def __len__(self) -> int: //| """Return the length. This is used by (`len`)""" //| ... -STATIC mp_obj_t coproc_memory_unary_op(mp_unary_op_t op, mp_obj_t self_in) { - coproc_memory_obj_t *self = MP_OBJ_TO_PTR(self_in); - uint16_t len = common_hal_coproc_memory_get_length(self); +STATIC mp_obj_t memorymap_addressrange_unary_op(mp_unary_op_t op, mp_obj_t self_in) { + memorymap_addressrange_obj_t *self = MP_OBJ_TO_PTR(self_in); + uint16_t len = common_hal_memorymap_addressrange_get_length(self); switch (op) { case MP_UNARY_OP_BOOL: return mp_obj_new_bool(len != 0); @@ -77,36 +94,42 @@ STATIC mp_obj_t coproc_memory_unary_op(mp_unary_op_t op, mp_obj_t self_in) { } } -STATIC const mp_rom_map_elem_t coproc_memory_locals_dict_table[] = { +STATIC const mp_rom_map_elem_t memorymap_addressrange_locals_dict_table[] = { }; -STATIC MP_DEFINE_CONST_DICT(coproc_memory_locals_dict, coproc_memory_locals_dict_table); +STATIC MP_DEFINE_CONST_DICT(memorymap_addressrange_locals_dict, memorymap_addressrange_locals_dict_table); //| @overload //| def __getitem__(self, index: slice) -> bytearray: ... //| @overload //| def __getitem__(self, index: int) -> int: -//| """Returns the value at the given index.""" +//| """Returns the value(s) at the given index. +//| +//| 1, 2, 4 and 8 byte aligned reads will be done in one transaction. +//| All others may use multiple transactions.""" //| ... //| @overload //| def __setitem__(self, index: slice, value: ReadableBuffer) -> None: ... //| @overload //| def __setitem__(self, index: int, value: int) -> None: -//| """Set the value at the given index.""" +//| """Set the value(s) at the given index. +//| +//| 1, 2, 4 and 8 byte aligned writes will be done in one transaction. +//| All others may use multiple transactions.""" //| ... //| -STATIC mp_obj_t coproc_memory_subscr(mp_obj_t self_in, mp_obj_t index_in, mp_obj_t value) { +STATIC mp_obj_t memorymap_addressrange_subscr(mp_obj_t self_in, mp_obj_t index_in, mp_obj_t value) { if (value == MP_OBJ_NULL) { // delete item // slice deletion return MP_OBJ_NULL; // op not supported } else { - coproc_memory_obj_t *self = MP_OBJ_TO_PTR(self_in); + memorymap_addressrange_obj_t *self = MP_OBJ_TO_PTR(self_in); if (0) { #if MICROPY_PY_BUILTINS_SLICE } else if (mp_obj_is_type(index_in, &mp_type_slice)) { mp_bound_slice_t slice; - if (!mp_seq_get_fast_slice_indexes(common_hal_coproc_memory_get_length(self), index_in, &slice)) { + if (!mp_seq_get_fast_slice_indexes(common_hal_memorymap_addressrange_get_length(self), index_in, &slice)) { mp_raise_NotImplementedError(translate("only slices with step=1 (aka None) are supported")); } if (value != MP_OBJ_SENTINEL) { @@ -132,8 +155,8 @@ STATIC mp_obj_t coproc_memory_subscr(mp_obj_t self_in, mp_obj_t index_in, mp_obj mp_raise_NotImplementedError(translate("array/bytes required on right side")); } - if (!common_hal_coproc_memory_set_bytes(self, slice.start, src_items, src_len)) { - mp_raise_RuntimeError(translate("Unable to write")); + if (!common_hal_memorymap_addressrange_set_bytes(self, slice.start, src_items, src_len)) { + mp_raise_RuntimeError(translate("Unable to write to address.")); } return mp_const_none; #else @@ -143,18 +166,18 @@ STATIC mp_obj_t coproc_memory_subscr(mp_obj_t self_in, mp_obj_t index_in, mp_obj // Read slice. size_t len = slice.stop - slice.start; uint8_t *items = m_new(uint8_t, len); - common_hal_coproc_memory_get_bytes(self, slice.start, items, len); + common_hal_memorymap_addressrange_get_bytes(self, slice.start, len, items); return mp_obj_new_bytearray_by_ref(len, items); } #endif } else { // Single index rather than slice. - size_t index = mp_get_index(self->base.type, common_hal_coproc_memory_get_length(self), + size_t index = mp_get_index(self->base.type, common_hal_memorymap_addressrange_get_length(self), index_in, false); if (value == MP_OBJ_SENTINEL) { // load uint8_t value_out; - common_hal_coproc_memory_get_bytes(self, index, &value_out, 1); + common_hal_memorymap_addressrange_get_bytes(self, index, 1, &value_out); return MP_OBJ_NEW_SMALL_INT(value_out); } else { // store @@ -162,8 +185,8 @@ STATIC mp_obj_t coproc_memory_subscr(mp_obj_t self_in, mp_obj_t index_in, mp_obj mp_arg_validate_int_range(byte_value, 0, 255, MP_QSTR_bytes); uint8_t short_value = byte_value; - if (!common_hal_coproc_memory_set_bytes(self, index, &short_value, 1)) { - mp_raise_RuntimeError(translate("Unable to write")); + if (!common_hal_memorymap_addressrange_set_bytes(self, index, &short_value, 1)) { + mp_raise_RuntimeError(translate("Unable to write to address.")); } return mp_const_none; } @@ -171,14 +194,14 @@ STATIC mp_obj_t coproc_memory_subscr(mp_obj_t self_in, mp_obj_t index_in, mp_obj } } -const mp_obj_type_t coproc_memory_type = { +const mp_obj_type_t memorymap_addressrange_type = { { &mp_type_type }, - .name = MP_QSTR_CoprocMemory, .flags = MP_TYPE_FLAG_EXTENDED, - .make_new = coproc_memory_make_new, - .locals_dict = (mp_obj_t)&coproc_memory_locals_dict, + .name = MP_QSTR_AddressRange, + .make_new = memorymap_addressrange_make_new, + .locals_dict = (mp_obj_t)&memorymap_addressrange_locals_dict, MP_TYPE_EXTENDED_FIELDS( - .subscr = coproc_memory_subscr, - .unary_op = coproc_memory_unary_op, + .subscr = memorymap_addressrange_subscr, + .unary_op = memorymap_addressrange_unary_op, ), }; diff --git a/ports/espressif/common-hal/coproc/CoprocMemory.c b/shared-bindings/memorymap/AddressRange.h similarity index 53% rename from ports/espressif/common-hal/coproc/CoprocMemory.c rename to shared-bindings/memorymap/AddressRange.h index ca9a82dbcf..74a214d949 100644 --- a/ports/espressif/common-hal/coproc/CoprocMemory.c +++ b/shared-bindings/memorymap/AddressRange.h @@ -3,7 +3,7 @@ * * The MIT License (MIT) * - * Copyright (c) 2022 microDev + * 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 @@ -24,29 +24,23 @@ * THE SOFTWARE. */ -#include "shared-bindings/coproc/CoprocMemory.h" +#ifndef MICROPY_INCLUDED_SHARED_BINDINGS_MEMORYMAP_ADDRESSRANGE_H +#define MICROPY_INCLUDED_SHARED_BINDINGS_MEMORYMAP_ADDRESSRANGE_H -uint32_t common_hal_coproc_memory_get_length(coproc_memory_obj_t *self) { - return self->len; -} +#include "common-hal/memorymap/AddressRange.h" -bool common_hal_coproc_memory_set_bytes(coproc_memory_obj_t *self, - uint32_t start_index, const uint8_t *values, uint32_t len) { +extern const mp_obj_type_t memorymap_addressrange_type; - if (start_index + len > self->len) { - return false; - } +void common_hal_memorymap_addressrange_construct(memorymap_addressrange_obj_t *self, uint8_t *start_address, size_t length); - memcpy((uint8_t *)(self->address + start_index), values, len); - return true; -} +uint32_t common_hal_memorymap_addressrange_get_length(const memorymap_addressrange_obj_t *self); -void common_hal_coproc_memory_get_bytes(coproc_memory_obj_t *self, - uint32_t start_index, uint8_t *values, uint32_t len) { +bool common_hal_memorymap_addressrange_set_bytes(const memorymap_addressrange_obj_t *self, + uint32_t start_index, uint8_t *values, uint32_t len); - if (start_index + len > self->len) { - return; - } +// len and values are intentionally swapped to signify values is an output and +// also leverage the compiler to validate uses are expected. +void common_hal_memorymap_addressrange_get_bytes(const memorymap_addressrange_obj_t *self, + uint32_t start_index, uint32_t len, uint8_t *values); - memcpy(values, (uint8_t *)(self->address + start_index), len); -} +#endif // MICROPY_INCLUDED_SHARED_BINDINGS_MEMORYMAP_ADDRESSRANGE_H diff --git a/ports/raspberrypi/fatfs_port.c b/shared-bindings/memorymap/__init__.c similarity index 56% rename from ports/raspberrypi/fatfs_port.c rename to shared-bindings/memorymap/__init__.c index 58a0ef0d72..576c7f1e1d 100644 --- a/ports/raspberrypi/fatfs_port.c +++ b/shared-bindings/memorymap/__init__.c @@ -3,7 +3,7 @@ * * The MIT License (MIT) * - * SPDX-FileCopyrightText: Copyright (c) 2013, 2014 Damien P. George + * 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 @@ -24,25 +24,29 @@ * THE SOFTWARE. */ +#include "py/obj.h" #include "py/mphal.h" #include "py/runtime.h" -#include "lib/oofatfs/ff.h" /* FatFs lower layer API */ -#include "lib/oofatfs/diskio.h" /* FatFs lower layer API */ -#include "shared/timeutils/timeutils.h" -#if CIRCUITPY_RTC -#include "shared-bindings/rtc/RTC.h" -#endif +#include "shared-bindings/memorymap/__init__.h" +#include "shared-bindings/memorymap/AddressRange.h" -DWORD get_fattime(void) { - #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 +//| """Raw memory map access +//| +//| The `memorymap` module allows you to read and write memory addresses in the +//| address space seen from the processor running CircuitPython. It is usually +//| the physical address space. +//| """ +STATIC const mp_rom_map_elem_t memorymap_module_globals_table[] = { + { MP_ROM_QSTR(MP_QSTR___name__), MP_ROM_QSTR(MP_QSTR_memorymap) }, + { MP_ROM_QSTR(MP_QSTR_AddressRange), MP_ROM_PTR(&memorymap_addressrange_type) }, +}; +STATIC MP_DEFINE_CONST_DICT(memorymap_module_globals, memorymap_module_globals_table); -} +const mp_obj_module_t memorymap_module = { + .base = { &mp_type_module }, + .globals = (mp_obj_dict_t *)&memorymap_module_globals, +}; + +MP_REGISTER_MODULE(MP_QSTR_memorymap, memorymap_module, CIRCUITPY_MEMORYMAP); diff --git a/shared-bindings/dotenv/__init__.h b/shared-bindings/memorymap/__init__.h similarity index 77% rename from shared-bindings/dotenv/__init__.h rename to shared-bindings/memorymap/__init__.h index 18a6c280dd..f4e6c51481 100644 --- a/shared-bindings/dotenv/__init__.h +++ b/shared-bindings/memorymap/__init__.h @@ -24,16 +24,7 @@ * THE SOFTWARE. */ -#ifndef MICROPY_INCLUDED_SHARED_BINDINGS_DOTENV___INIT___H -#define MICROPY_INCLUDED_SHARED_BINDINGS_DOTENV___INIT___H +#ifndef SHARED_BINDINGS_MEMORYMAP_H +#define SHARED_BINDINGS_MEMORYMAP_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 +#endif // SHARED_BINDINGS_MEMORYMAP_H diff --git a/shared-bindings/memorymonitor/__init__.c b/shared-bindings/memorymonitor/__init__.c index 12c91cd150..7b05acd095 100644 --- a/shared-bindings/memorymonitor/__init__.c +++ b/shared-bindings/memorymonitor/__init__.c @@ -34,6 +34,7 @@ #include "shared-bindings/memorymonitor/AllocationSize.h" //| """Memory monitoring helpers""" +//| //| class AllocationError(Exception): //| """Catchall exception for allocation related errors.""" diff --git a/shared-bindings/microcontroller/Pin.c b/shared-bindings/microcontroller/Pin.c index 42076aa90e..ea27df9812 100644 --- a/shared-bindings/microcontroller/Pin.c +++ b/shared-bindings/microcontroller/Pin.c @@ -93,23 +93,24 @@ const mp_obj_type_t mcu_pin_type = { ) }; -const mcu_pin_obj_t *validate_obj_is_pin(mp_obj_t obj) { - if (!mp_obj_is_type(obj, &mcu_pin_type)) { - mp_raise_TypeError_varg(translate("Expected a %q"), mcu_pin_type.name); - } - return MP_OBJ_TO_PTR(obj); +const mcu_pin_obj_t *validate_obj_is_pin(mp_obj_t obj, qstr arg_name) { + return MP_OBJ_TO_PTR(mp_arg_validate_type(obj, &mcu_pin_type, arg_name)); +} + +const mcu_pin_obj_t *validate_obj_is_pin_in(mp_obj_t obj, qstr arg_name) { + return MP_OBJ_TO_PTR(mp_arg_validate_type_in(obj, &mcu_pin_type, arg_name)); } // Validate that the obj is a pin or None. Return an mcu_pin_obj_t* or NULL, correspondingly. -const mcu_pin_obj_t *validate_obj_is_pin_or_none(mp_obj_t obj) { +const mcu_pin_obj_t *validate_obj_is_pin_or_none(mp_obj_t obj, qstr arg_name) { if (obj == mp_const_none) { return NULL; } - return validate_obj_is_pin(obj); + return validate_obj_is_pin(obj, arg_name); } -const mcu_pin_obj_t *validate_obj_is_free_pin(mp_obj_t obj) { - const mcu_pin_obj_t *pin = validate_obj_is_pin(obj); +const mcu_pin_obj_t *validate_obj_is_free_pin(mp_obj_t obj, qstr arg_name) { + const mcu_pin_obj_t *pin = validate_obj_is_pin(obj, arg_name); assert_pin_free(pin); return pin; } @@ -120,11 +121,11 @@ void validate_no_duplicate_pins(mp_obj_t seq, qstr arg_name) { for (size_t pin_cnt = 0; pin_cnt < num_pins; pin_cnt++) { mp_obj_t pin1_obj = mp_obj_subscr(seq, MP_OBJ_NEW_SMALL_INT(pin_cnt), MP_OBJ_SENTINEL); - const mcu_pin_obj_t *pin1 = validate_obj_is_pin(pin1_obj); + const mcu_pin_obj_t *pin1 = validate_obj_is_pin_in(pin1_obj, arg_name); for (size_t pin_cnt_2 = pin_cnt + 1; pin_cnt_2 < num_pins; pin_cnt_2++) { mp_obj_t pin2_obj = mp_obj_subscr(seq, MP_OBJ_NEW_SMALL_INT(pin_cnt_2), MP_OBJ_SENTINEL); - const mcu_pin_obj_t *pin2 = validate_obj_is_pin(pin2_obj); + const mcu_pin_obj_t *pin2 = validate_obj_is_pin_in(pin2_obj, arg_name); if (pin1 == pin2) { mp_raise_TypeError_varg(translate("%q contains duplicate pins"), arg_name); } @@ -141,11 +142,11 @@ void validate_no_duplicate_pins_2(mp_obj_t seq1, mp_obj_t seq2, qstr arg_name1, for (size_t pin_cnt_1 = 0; pin_cnt_1 < num_pins_1; pin_cnt_1++) { mp_obj_t pin1_obj = mp_obj_subscr(seq1, MP_OBJ_NEW_SMALL_INT(pin_cnt_1), MP_OBJ_SENTINEL); - const mcu_pin_obj_t *pin1 = validate_obj_is_pin(pin1_obj); + const mcu_pin_obj_t *pin1 = validate_obj_is_pin_in(pin1_obj, arg_name1); for (size_t pin_cnt_2 = 0; pin_cnt_2 < num_pins_2; pin_cnt_2++) { mp_obj_t pin2_obj = mp_obj_subscr(seq2, MP_OBJ_NEW_SMALL_INT(pin_cnt_2), MP_OBJ_SENTINEL); - const mcu_pin_obj_t *pin2 = validate_obj_is_pin(pin2_obj); + const mcu_pin_obj_t *pin2 = validate_obj_is_pin_in(pin2_obj, arg_name2); if (pin1 == pin2) { mp_raise_TypeError_varg(translate("%q and %q contain duplicate pins"), arg_name1, arg_name2); } @@ -156,21 +157,21 @@ void validate_no_duplicate_pins_2(mp_obj_t seq1, mp_obj_t seq2, qstr arg_name1, // Validate every element in the list to be a free pin. 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) { mp_int_t len = MP_OBJ_SMALL_INT_VALUE(mp_obj_len(seq)); - if (len > max_pins) { - mp_raise_ValueError_varg(translate("At most %d %q may be specified (not %d)"), max_pins, what, len); - } + mp_arg_validate_length_max(len, max_pins, what); *count_out = len; for (mp_int_t i = 0; i < len; i++) { - pins_out[i] = validate_obj_is_free_pin(mp_obj_subscr(seq, MP_OBJ_NEW_SMALL_INT(i), MP_OBJ_SENTINEL)); + pins_out[i] = + validate_obj_is_pin_in(mp_obj_subscr(seq, MP_OBJ_NEW_SMALL_INT(i), MP_OBJ_SENTINEL), what); + assert_pin_free(pins_out[i]); } } // Validate that the obj is a free pin or None. Return an mcu_pin_obj_t* or NULL, correspondingly. -const mcu_pin_obj_t *validate_obj_is_free_pin_or_none(mp_obj_t obj) { +const mcu_pin_obj_t *validate_obj_is_free_pin_or_none(mp_obj_t obj, qstr arg_name) { if (obj == mp_const_none) { return NULL; } - const mcu_pin_obj_t *pin = validate_obj_is_pin(obj); + const mcu_pin_obj_t *pin = validate_obj_is_pin(obj, arg_name); assert_pin_free(pin); return pin; } diff --git a/shared-bindings/microcontroller/Pin.h b/shared-bindings/microcontroller/Pin.h index b41b3c308a..28d0949042 100644 --- a/shared-bindings/microcontroller/Pin.h +++ b/shared-bindings/microcontroller/Pin.h @@ -33,10 +33,11 @@ // Type object used in Python. Should be shared between ports. extern const mp_obj_type_t mcu_pin_type; -const mcu_pin_obj_t *validate_obj_is_pin(mp_obj_t obj); -const mcu_pin_obj_t *validate_obj_is_pin_or_none(mp_obj_t obj); -const mcu_pin_obj_t *validate_obj_is_free_pin(mp_obj_t obj); -const mcu_pin_obj_t *validate_obj_is_free_pin_or_none(mp_obj_t obj); +const mcu_pin_obj_t *validate_obj_is_pin(mp_obj_t obj, qstr arg_name); +const mcu_pin_obj_t *validate_obj_is_pin_in(mp_obj_t obj, qstr arg_name); +const mcu_pin_obj_t *validate_obj_is_pin_or_none(mp_obj_t obj, qstr arg_name); +const mcu_pin_obj_t *validate_obj_is_free_pin(mp_obj_t obj, qstr arg_name); +const mcu_pin_obj_t *validate_obj_is_free_pin_or_none(mp_obj_t obj, qstr arg_name); 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); diff --git a/shared-bindings/microcontroller/Processor.c b/shared-bindings/microcontroller/Processor.c index 3b671d0c7b..986f81ea53 100644 --- a/shared-bindings/microcontroller/Processor.c +++ b/shared-bindings/microcontroller/Processor.c @@ -65,19 +65,21 @@ //| ... //| frequency: int -//| """The CPU operating frequency in Hertz. (read-only)""" +//| """The CPU operating frequency in Hertz. +//| +//| **Limitations:** Setting the ``frequency`` is possible only on some i.MX boards. +//| On most boards, ``frequency`` is read-only. +//| """ +#if CIRCUITPY_SETTABLE_PROCESSOR_FREQUENCY STATIC mp_obj_t mcu_processor_set_frequency(mp_obj_t self, mp_obj_t freq) { - #if CIRCUITPY_SETTABLE_PROCESSOR_FREQUENCY uint32_t value_of_freq = (uint32_t)mp_arg_validate_int_min(mp_obj_get_int(freq), 0, MP_QSTR_frequency); common_hal_mcu_processor_set_frequency(self, value_of_freq); - #else - mp_raise_msg(&mp_type_NotImplementedError,translate("frequency is read-only for this board")); - #endif return mp_const_none; } MP_DEFINE_CONST_FUN_OBJ_2(mcu_processor_set_frequency_obj, mcu_processor_set_frequency); +#endif STATIC mp_obj_t mcu_processor_get_frequency(mp_obj_t self) { @@ -86,9 +88,14 @@ STATIC mp_obj_t mcu_processor_get_frequency(mp_obj_t self) { MP_DEFINE_CONST_FUN_OBJ_1(mcu_processor_get_frequency_obj, mcu_processor_get_frequency); +#if CIRCUITPY_SETTABLE_PROCESSOR_FREQUENCY MP_PROPERTY_GETSET(mcu_processor_frequency_obj, (mp_obj_t)&mcu_processor_get_frequency_obj, (mp_obj_t)&mcu_processor_set_frequency_obj); +#else +MP_PROPERTY_GETTER(mcu_processor_frequency_obj, + (mp_obj_t)&mcu_processor_get_frequency_obj); +#endif //| reset_reason: microcontroller.ResetReason //| """The reason the microcontroller started up from reset state.""" diff --git a/shared-bindings/microcontroller/ResetReason.c b/shared-bindings/microcontroller/ResetReason.c index 905c19f83f..13a8f25e6d 100644 --- a/shared-bindings/microcontroller/ResetReason.c +++ b/shared-bindings/microcontroller/ResetReason.c @@ -42,7 +42,7 @@ MAKE_ENUM_VALUE(mcu_reset_reason_type, reset_reason, RESCUE_DEBUG, RESET_REASON_ //| """The reason the microntroller was last reset""" //| //| POWER_ON: object -//| """The microntroller was started from power off.""" +//| """The microcontroller was started from power off.""" //| //| BROWNOUT: object //| """The microntroller was reset due to too low a voltage.""" diff --git a/shared-bindings/microcontroller/__init__.c b/shared-bindings/microcontroller/__init__.c index 5716f7270e..2c1fdd5b58 100644 --- a/shared-bindings/microcontroller/__init__.c +++ b/shared-bindings/microcontroller/__init__.c @@ -60,6 +60,7 @@ //| """CPU information and control, such as ``cpus[0].temperature`` and ``cpus[1].frequency`` //| (clock frequency) on chips with more than 1 cpu. The index selects which cpu. //| This object is an instance of `microcontroller.Processor`.""" +//| //| def delay_us(delay: int) -> None: //| """Dedicated delay method used for very short delays. **Do not** do long delays diff --git a/shared-bindings/msgpack/__init__.c b/shared-bindings/msgpack/__init__.c index d505e3a6d8..7773d6d190 100644 --- a/shared-bindings/msgpack/__init__.c +++ b/shared-bindings/msgpack/__init__.c @@ -84,6 +84,7 @@ //| print(f"{data} -> {buffer.getvalue()} -> {decoded}") //| //| """ +//| //| def pack( //| obj: object, diff --git a/shared-bindings/neopixel_write/__init__.c b/shared-bindings/neopixel_write/__init__.c index 3a35fa8243..cc0e2a041a 100644 --- a/shared-bindings/neopixel_write/__init__.c +++ b/shared-bindings/neopixel_write/__init__.c @@ -109,16 +109,13 @@ STATIC void check_for_deinit(digitalio_digitalinout_obj_t *self) { //| """Write buf out on the given DigitalInOut. //| //| :param ~digitalio.DigitalInOut digitalinout: the DigitalInOut to output with -//| :param ~circuitpython_typing.ReadableBuffer buf: The bytes to clock out. No assumption is made about color order""" +//| :param ~circuitpython_typing.ReadableBuffer buf: The bytes to clock out. No assumption is made about color order +//| """ //| ... //| STATIC mp_obj_t neopixel_write_neopixel_write_(mp_obj_t digitalinout_obj, mp_obj_t buf) { - if (!mp_obj_is_type(digitalinout_obj, &digitalio_digitalinout_type)) { - mp_raise_TypeError_varg(translate("Expected a %q"), digitalio_digitalinout_type.name); - } - - // Convert parameters into expected types. - const digitalio_digitalinout_obj_t *digitalinout = MP_OBJ_TO_PTR(digitalinout_obj); + const digitalio_digitalinout_obj_t *digitalinout = + mp_arg_validate_type(digitalinout_obj, &digitalio_digitalinout_type, MP_QSTR_digitalinout); // Check to see if the NeoPixel has been deinited before writing to it. check_for_deinit(digitalinout_obj); diff --git a/shared-bindings/onewireio/OneWire.c b/shared-bindings/onewireio/OneWire.c index 4a0140ac5d..3f0dc87722 100644 --- a/shared-bindings/onewireio/OneWire.c +++ b/shared-bindings/onewireio/OneWire.c @@ -60,7 +60,7 @@ STATIC mp_obj_t onewireio_onewire_make_new(const mp_obj_type_t *type, size_t n_a }; 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 *pin = validate_obj_is_free_pin(args[ARG_pin].u_obj); + const mcu_pin_obj_t *pin = validate_obj_is_free_pin(args[ARG_pin].u_obj, MP_QSTR_pin); onewireio_onewire_obj_t *self = m_new_obj(onewireio_onewire_obj_t); self->base.type = &onewireio_onewire_type; diff --git a/shared-bindings/os/__init__.c b/shared-bindings/os/__init__.c index 1260903203..b2fb8ff095 100644 --- a/shared-bindings/os/__init__.c +++ b/shared-bindings/os/__init__.c @@ -92,6 +92,7 @@ MP_DEFINE_CONST_FUN_OBJ_0(os_getcwd_obj, os_getcwd); //| ... //| STATIC mp_obj_t os_getenv(size_t n_args, const mp_obj_t *pos_args, mp_map_t *kw_args) { + #if CIRCUITPY_OS_GETENV enum { ARG_key, ARG_default }; static const mp_arg_t allowed_args[] = { { MP_QSTR_key, MP_ARG_REQUIRED | MP_ARG_OBJ }, @@ -101,6 +102,9 @@ STATIC mp_obj_t os_getenv(size_t n_args, const mp_obj_t *pos_args, mp_map_t *kw_ 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); + #else + return mp_const_none; + #endif } STATIC MP_DEFINE_CONST_FUN_OBJ_KW(os_getenv_obj, 1, os_getenv); diff --git a/shared-bindings/os/__init__.h b/shared-bindings/os/__init__.h index 00d8c28a50..49b12cd52a 100644 --- a/shared-bindings/os/__init__.h +++ b/shared-bindings/os/__init__.h @@ -38,6 +38,8 @@ 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_getenv_path(const char *path, 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 2f18624f1a..42b4c788c7 100644 --- a/shared-bindings/paralleldisplay/ParallelBus.c +++ b/shared-bindings/paralleldisplay/ParallelBus.c @@ -85,11 +85,11 @@ STATIC mp_obj_t paralleldisplay_parallelbus_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); - const mcu_pin_obj_t *command = validate_obj_is_free_pin(args[ARG_command].u_obj); - const mcu_pin_obj_t *chip_select = validate_obj_is_free_pin(args[ARG_chip_select].u_obj); - const mcu_pin_obj_t *write = validate_obj_is_free_pin(args[ARG_write].u_obj); - const mcu_pin_obj_t *read = validate_obj_is_free_pin_or_none(args[ARG_read].u_obj); - const mcu_pin_obj_t *reset = validate_obj_is_free_pin_or_none(args[ARG_reset].u_obj); + const mcu_pin_obj_t *command = validate_obj_is_free_pin(args[ARG_command].u_obj, MP_QSTR_command); + const mcu_pin_obj_t *chip_select = validate_obj_is_free_pin(args[ARG_chip_select].u_obj, MP_QSTR_chip_select); + const mcu_pin_obj_t *write = validate_obj_is_free_pin(args[ARG_write].u_obj, MP_QSTR_write); + const mcu_pin_obj_t *read = validate_obj_is_free_pin_or_none(args[ARG_read].u_obj, MP_QSTR_read); + const mcu_pin_obj_t *reset = validate_obj_is_free_pin_or_none(args[ARG_reset].u_obj, MP_QSTR_reset); paralleldisplay_parallelbus_obj_t *self = &allocate_display_bus_or_raise()->parallel_bus; self->base.type = ¶lleldisplay_parallelbus_type; @@ -102,7 +102,7 @@ STATIC mp_obj_t paralleldisplay_parallelbus_make_new(const mp_obj_type_t *type, } if (specified_data0) { - const mcu_pin_obj_t *data0 = validate_obj_is_free_pin(args[ARG_data0].u_obj); + const mcu_pin_obj_t *data0 = validate_obj_is_free_pin(args[ARG_data0].u_obj, MP_QSTR_data0); common_hal_paralleldisplay_parallelbus_construct(self, data0, command, chip_select, write, read, reset, args[ARG_frequency].u_int); } else { uint8_t num_pins; diff --git a/shared-bindings/ps2io/Ps2.c b/shared-bindings/ps2io/Ps2.c index 5aeb3af51e..67cffc9f7b 100644 --- a/shared-bindings/ps2io/Ps2.c +++ b/shared-bindings/ps2io/Ps2.c @@ -75,8 +75,8 @@ STATIC mp_obj_t ps2io_ps2_make_new(const mp_obj_type_t *type, size_t n_args, siz 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 *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); + const mcu_pin_obj_t *clock_pin = validate_obj_is_free_pin(args[ARG_clock_pin].u_obj, MP_QSTR_clock_pin); + const mcu_pin_obj_t *data_pin = validate_obj_is_free_pin(args[ARG_data_pin].u_obj, MP_QSTR_data_pin); ps2io_ps2_obj_t *self = m_new_obj(ps2io_ps2_obj_t); self->base.type = &ps2io_ps2_type; diff --git a/shared-bindings/pulseio/PulseIn.c b/shared-bindings/pulseio/PulseIn.c index 6d1830c4f2..81edc48bfd 100644 --- a/shared-bindings/pulseio/PulseIn.c +++ b/shared-bindings/pulseio/PulseIn.c @@ -86,7 +86,7 @@ STATIC mp_obj_t pulseio_pulsein_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); - const mcu_pin_obj_t *pin = validate_obj_is_free_pin(args[ARG_pin].u_obj); + const mcu_pin_obj_t *pin = validate_obj_is_free_pin(args[ARG_pin].u_obj, MP_QSTR_pin); // Make object long-lived to avoid moving between imports pulseio_pulsein_obj_t *self = m_new_ll_obj(pulseio_pulsein_obj_t); diff --git a/shared-bindings/pulseio/PulseOut.c b/shared-bindings/pulseio/PulseOut.c index 758d3c2e77..2af07a46d8 100644 --- a/shared-bindings/pulseio/PulseOut.c +++ b/shared-bindings/pulseio/PulseOut.c @@ -77,10 +77,10 @@ STATIC mp_obj_t pulseio_pulseout_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); - const mcu_pin_obj_t *pin = args[ARG_pin].u_obj; + const mcu_pin_obj_t *pin = validate_obj_is_free_pin(args[ARG_pin].u_obj, MP_QSTR_pin); mp_int_t frequency = args[ARG_frequency].u_int; mp_int_t duty_cycle = args[ARG_duty_cycle].u_int; - 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; common_hal_pulseio_pulseout_construct(self, pin, frequency, duty_cycle); diff --git a/shared-bindings/pwmio/PWMOut.c b/shared-bindings/pwmio/PWMOut.c index 92eea1d1e0..1fd69272da 100644 --- a/shared-bindings/pwmio/PWMOut.c +++ b/shared-bindings/pwmio/PWMOut.c @@ -147,7 +147,7 @@ STATIC mp_obj_t pwmio_pwmout_make_new(const mp_obj_type_t *type, size_t n_args, mp_arg_val_t parsed_args[MP_ARRAY_SIZE(allowed_args)]; mp_arg_parse_all_kw_array(n_args, n_kw, args, MP_ARRAY_SIZE(allowed_args), allowed_args, parsed_args); - const mcu_pin_obj_t *pin = validate_obj_is_free_pin(parsed_args[ARG_pin].u_obj); + const mcu_pin_obj_t *pin = validate_obj_is_free_pin(parsed_args[ARG_pin].u_obj, MP_QSTR_pin); uint16_t duty_cycle = parsed_args[ARG_duty_cycle].u_int; uint32_t frequency = parsed_args[ARG_frequency].u_int; diff --git a/shared-bindings/qrio/QRDecoder.c b/shared-bindings/qrio/QRDecoder.c index 5ff65578e4..b37a14fd8f 100644 --- a/shared-bindings/qrio/QRDecoder.c +++ b/shared-bindings/qrio/QRDecoder.c @@ -80,7 +80,7 @@ STATIC mp_obj_t qrio_qrdecoder_decode(size_t n_args, const mp_obj_t *pos_args, m // verify that the buffer is big enough int sz = width * height; - qrio_pixel_policy_t policy = cp_enum_value(&qrio_pixel_policy_type, args[ARG_pixel_policy].u_obj); + qrio_pixel_policy_t policy = cp_enum_value(&qrio_pixel_policy_type, args[ARG_pixel_policy].u_obj, MP_QSTR_pixel_policy); if (policy != QRIO_EVERY_BYTE) { sz *= 2; } diff --git a/shared-bindings/rainbowio/__init__.c b/shared-bindings/rainbowio/__init__.c index 0dfdcd3a45..324f43198e 100644 --- a/shared-bindings/rainbowio/__init__.c +++ b/shared-bindings/rainbowio/__init__.c @@ -33,7 +33,8 @@ //| //| def colorwheel(n: float) -> int: //| """C implementation of the common colorwheel() function found in many examples. -//| Returns the colorwheel RGB value as an integer value for n (usable in neopixel and dotstar).""" +//| Returns the colorwheel RGB value as an integer value for n (usable in neopixel and dotstar). +//| """ //| ... //| STATIC mp_obj_t rainbowio_colorwheel(mp_obj_t n) { diff --git a/shared-bindings/random/__init__.c b/shared-bindings/random/__init__.c index 29c6a0e74b..33cd9e90d0 100644 --- a/shared-bindings/random/__init__.c +++ b/shared-bindings/random/__init__.c @@ -47,6 +47,7 @@ //| from typing import TypeVar //| //| _T = TypeVar("_T") +//| //| def seed(seed: int) -> None: //| """Sets the starting seed of the random number generation. Further calls to @@ -108,7 +109,7 @@ STATIC mp_obj_t random_randrange(size_t n_args, const mp_obj_t *args) { } else if (step < 0) { n = (stop - start + step + 1) / step; } else { - mp_raise_ValueError(translate("step must be non-zero")); + mp_raise_ValueError_varg(MP_ERROR_TEXT("%q step cannot be zero"), MP_QSTR_randrange); } if (n <= 0) { mp_raise_ValueError(translate("invalid step")); diff --git a/shared-bindings/rgbmatrix/RGBMatrix.c b/shared-bindings/rgbmatrix/RGBMatrix.c index 456f0cfbb1..f2877531bb 100644 --- a/shared-bindings/rgbmatrix/RGBMatrix.c +++ b/shared-bindings/rgbmatrix/RGBMatrix.c @@ -44,8 +44,8 @@ extern Protomatter_core *_PM_protoPtr; -STATIC uint8_t validate_pin(mp_obj_t obj) { - const mcu_pin_obj_t *result = validate_obj_is_free_pin(obj); +STATIC uint8_t validate_pin(mp_obj_t obj, qstr arg_name) { + const mcu_pin_obj_t *result = validate_obj_is_free_pin(obj, arg_name); return common_hal_mcu_pin_number(result); } @@ -210,9 +210,9 @@ STATIC mp_obj_t rgbmatrix_rgbmatrix_make_new(const mp_obj_type_t *type, size_t n uint8_t rgb_count, addr_count; uint8_t rgb_pins[MP_ARRAY_SIZE(self->rgb_pins)]; uint8_t addr_pins[MP_ARRAY_SIZE(self->addr_pins)]; - 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); + uint8_t clock_pin = validate_pin(args[ARG_clock_pin].u_obj, MP_QSTR_clock_pin); + uint8_t latch_pin = validate_pin(args[ARG_latch_pin].u_obj, MP_QSTR_latch_pin); + uint8_t output_enable_pin = validate_pin(args[ARG_output_enable_pin].u_obj, MP_QSTR_output_enable_pin); 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); diff --git a/shared-bindings/rotaryio/IncrementalEncoder.c b/shared-bindings/rotaryio/IncrementalEncoder.c index e05ffb9e43..fae55db317 100644 --- a/shared-bindings/rotaryio/IncrementalEncoder.c +++ b/shared-bindings/rotaryio/IncrementalEncoder.c @@ -72,8 +72,8 @@ STATIC mp_obj_t rotaryio_incrementalencoder_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); - 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); + const mcu_pin_obj_t *pin_a = validate_obj_is_free_pin(args[ARG_pin_a].u_obj, MP_QSTR_pin_a); + const mcu_pin_obj_t *pin_b = validate_obj_is_free_pin(args[ARG_pin_b].u_obj, MP_QSTR_pin_b); // 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); diff --git a/shared-bindings/rtc/__init__.c b/shared-bindings/rtc/__init__.c index 64adfe7d9e..0220745c0f 100644 --- a/shared-bindings/rtc/__init__.c +++ b/shared-bindings/rtc/__init__.c @@ -36,6 +36,7 @@ //| The `rtc` module provides support for a Real Time Clock. You can access and manage the //| RTC using :class:`rtc.RTC`. It also backs the :func:`time.time` and :func:`time.localtime` //| functions using the onboard RTC if present.""" +//| void rtc_reset(void) { MP_STATE_VM(rtc_time_source) = (mp_obj_t)&rtc_rtc_obj; diff --git a/shared-bindings/sdcardio/SDCard.c b/shared-bindings/sdcardio/SDCard.c index a71541c548..ce67834774 100644 --- a/shared-bindings/sdcardio/SDCard.c +++ b/shared-bindings/sdcardio/SDCard.c @@ -89,8 +89,8 @@ STATIC mp_obj_t sdcardio_sdcard_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); - busio_spi_obj_t *spi = validate_obj_is_spi_bus(args[ARG_spi].u_obj); - const mcu_pin_obj_t *cs = validate_obj_is_free_pin(args[ARG_cs].u_obj); + busio_spi_obj_t *spi = validate_obj_is_spi_bus(args[ARG_spi].u_obj, MP_QSTR_spi); + const mcu_pin_obj_t *cs = validate_obj_is_free_pin(args[ARG_cs].u_obj, MP_QSTR_cs); sdcardio_sdcard_obj_t *self = m_new_obj(sdcardio_sdcard_obj_t); self->base.type = &sdcardio_SDCard_type; @@ -126,7 +126,6 @@ MP_DEFINE_CONST_FUN_OBJ_1(sdcardio_sdcard_deinit_obj, sdcardio_sdcard_deinit); //| def readblocks(self, start_block: int, buf: WriteableBuffer) -> None: -//| //| """Read one or more blocks from the card //| //| :param int start_block: The block to start reading from @@ -166,7 +165,6 @@ MP_DEFINE_CONST_FUN_OBJ_1(sdcardio_sdcard_sync_obj, sdcardio_sdcard_sync); //| def writeblocks(self, start_block: int, buf: ReadableBuffer) -> None: -//| //| """Write one or more blocks to the card //| //| :param int start_block: The block to start writing from diff --git a/shared-bindings/sdioio/SDCard.c b/shared-bindings/sdioio/SDCard.c index 7e57330fc4..776b20fafe 100644 --- a/shared-bindings/sdioio/SDCard.c +++ b/shared-bindings/sdioio/SDCard.c @@ -98,8 +98,8 @@ STATIC mp_obj_t sdioio_sdcard_make_new(const mp_obj_type_t *type, size_t n_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 *clock = validate_obj_is_free_pin(args[ARG_clock].u_obj); - const mcu_pin_obj_t *command = validate_obj_is_free_pin(args[ARG_command].u_obj); + const mcu_pin_obj_t *clock = validate_obj_is_free_pin(args[ARG_clock].u_obj, MP_QSTR_clock); + const mcu_pin_obj_t *command = validate_obj_is_free_pin(args[ARG_command].u_obj, MP_QSTR_command); const mcu_pin_obj_t *data_pins[4]; uint8_t num_data; validate_list_is_free_pins(MP_QSTR_data, data_pins, MP_ARRAY_SIZE(data_pins), args[ARG_data].u_obj, &num_data); @@ -160,7 +160,6 @@ STATIC mp_obj_t sdioio_sdcard_count(mp_obj_t self_in) { MP_DEFINE_CONST_FUN_OBJ_1(sdioio_sdcard_count_obj, sdioio_sdcard_count); //| def readblocks(self, start_block: int, buf: WriteableBuffer) -> None: -//| //| """Read one or more blocks from the card //| //| :param int start_block: The block to start reading from @@ -182,7 +181,6 @@ STATIC mp_obj_t sdioio_sdcard_readblocks(mp_obj_t self_in, mp_obj_t start_block_ MP_DEFINE_CONST_FUN_OBJ_3(sdioio_sdcard_readblocks_obj, sdioio_sdcard_readblocks); //| def writeblocks(self, start_block: int, buf: ReadableBuffer) -> None: -//| //| """Write one or more blocks to the card //| //| :param int start_block: The block to start writing from diff --git a/shared-bindings/sharpdisplay/SharpMemoryFramebuffer.c b/shared-bindings/sharpdisplay/SharpMemoryFramebuffer.c index 35e06b7838..b0f68333e6 100644 --- a/shared-bindings/sharpdisplay/SharpMemoryFramebuffer.c +++ b/shared-bindings/sharpdisplay/SharpMemoryFramebuffer.c @@ -47,8 +47,8 @@ STATIC mp_obj_t sharpdisplay_framebuffer_make_new(const mp_obj_type_t *type, siz 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 *chip_select = validate_obj_is_free_pin(args[ARG_chip_select].u_obj); - busio_spi_obj_t *spi = validate_obj_is_spi_bus(args[ARG_spi_bus].u_obj); + const mcu_pin_obj_t *chip_select = validate_obj_is_free_pin(args[ARG_chip_select].u_obj, MP_QSTR_chip_select); + busio_spi_obj_t *spi = validate_obj_is_spi_bus(args[ARG_spi_bus].u_obj, MP_QSTR_spi_bus); sharpdisplay_framebuffer_obj_t *self = &allocate_display_bus_or_raise()->sharpdisplay; self->base.type = &sharpdisplay_framebuffer_type; diff --git a/shared-bindings/socketpool/Socket.c b/shared-bindings/socketpool/Socket.c index 7a60463c4b..9d439b5bd4 100644 --- a/shared-bindings/socketpool/Socket.c +++ b/shared-bindings/socketpool/Socket.c @@ -344,44 +344,43 @@ STATIC mp_obj_t socketpool_socket_setblocking(mp_obj_t self_in, mp_obj_t blockin } STATIC MP_DEFINE_CONST_FUN_OBJ_2(socketpool_socket_setblocking_obj, socketpool_socket_setblocking); -// //| def setsockopt(self, level: int, optname: int, value: int) -> None: -// //| """Sets socket options""" -// //| ... -// //| -// STATIC mp_obj_t socketpool_socket_setsockopt(size_t n_args, const mp_obj_t *args) { -// // mod_network_socket_obj_t *self = MP_OBJ_TO_PTR(args[0]); +//| def setsockopt(self, level: int, optname: int, value: int) -> None: +//| """Sets socket options""" +//| ... +STATIC mp_obj_t socketpool_socket_setsockopt(size_t n_args, const mp_obj_t *args) { + socketpool_socket_obj_t *self = MP_OBJ_TO_PTR(args[0]); + mp_int_t level = mp_obj_get_int(args[1]); + mp_int_t opt = mp_obj_get_int(args[2]); -// // mp_int_t level = mp_obj_get_int(args[1]); -// // mp_int_t opt = mp_obj_get_int(args[2]); + const void *optval; + mp_uint_t optlen; + mp_int_t val; + if (mp_obj_is_integer(args[3])) { + val = mp_obj_get_int_truncated(args[3]); + optval = &val; + optlen = sizeof(val); + } else { + mp_buffer_info_t bufinfo; + mp_get_buffer_raise(args[3], &bufinfo, MP_BUFFER_READ); + optval = bufinfo.buf; + optlen = bufinfo.len; + } -// // const void *optval; -// // mp_uint_t optlen; -// // mp_int_t val; -// // if (mp_obj_is_integer(args[3])) { -// // val = mp_obj_get_int_truncated(args[3]); -// // optval = &val; -// // optlen = sizeof(val); -// // } else { -// // mp_buffer_info_t bufinfo; -// // mp_get_buffer_raise(args[3], &bufinfo, MP_BUFFER_READ); -// // optval = bufinfo.buf; -// // optlen = bufinfo.len; -// // } + int _errno = common_hal_socketpool_socket_setsockopt(self, level, opt, optval, optlen); + if (_errno < 0) { + mp_raise_OSError(-_errno); + } -// // int _errno; -// // if (self->nic_type->setsockopt(self, level, opt, optval, optlen, &_errno) != 0) { -// // mp_raise_OSError(_errno); -// // } - -// return mp_const_none; -// } -// STATIC MP_DEFINE_CONST_FUN_OBJ_VAR_BETWEEN(socketpool_socket_setsockopt_obj, 4, 4, socketpool_socket_setsockopt); + return mp_const_none; +} +STATIC MP_DEFINE_CONST_FUN_OBJ_VAR_BETWEEN(socketpool_socket_setsockopt_obj, 4, 4, socketpool_socket_setsockopt); //| def settimeout(self, value: int) -> None: //| """Set the timeout value for this socket. //| -//| :param ~int value: timeout in seconds. 0 means non-blocking. None means block indefinitely.""" +//| :param ~int value: timeout in seconds. 0 means non-blocking. None means block indefinitely. +//| """ //| ... //| STATIC mp_obj_t socketpool_socket_settimeout(mp_obj_t self_in, mp_obj_t timeout_in) { @@ -417,7 +416,7 @@ STATIC const mp_rom_map_elem_t socketpool_socket_locals_dict_table[] = { { MP_ROM_QSTR(MP_QSTR_sendall), MP_ROM_PTR(&socketpool_socket_sendall_obj) }, { MP_ROM_QSTR(MP_QSTR_sendto), MP_ROM_PTR(&socketpool_socket_sendto_obj) }, { MP_ROM_QSTR(MP_QSTR_setblocking), MP_ROM_PTR(&socketpool_socket_setblocking_obj) }, - // { MP_ROM_QSTR(MP_QSTR_setsockopt), MP_ROM_PTR(&socketpool_socket_setsockopt_obj) }, + { MP_ROM_QSTR(MP_QSTR_setsockopt), MP_ROM_PTR(&socketpool_socket_setsockopt_obj) }, { MP_ROM_QSTR(MP_QSTR_settimeout), MP_ROM_PTR(&socketpool_socket_settimeout_obj) }, }; diff --git a/shared-bindings/socketpool/Socket.h b/shared-bindings/socketpool/Socket.h index cf5a97a428..690c9f8363 100644 --- a/shared-bindings/socketpool/Socket.h +++ b/shared-bindings/socketpool/Socket.h @@ -46,13 +46,22 @@ mp_uint_t common_hal_socketpool_socket_send(socketpool_socket_obj_t *self, const 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); +int common_hal_socketpool_socket_setsockopt(socketpool_socket_obj_t *self, int level, int optname, const void *value, size_t optlen); bool common_hal_socketpool_readable(socketpool_socket_obj_t *self); bool common_hal_socketpool_writable(socketpool_socket_obj_t *self); // Non-allocating versions for internal use. -int socketpool_socket_accept(socketpool_socket_obj_t *self, uint8_t *ip, uint32_t *port); +int socketpool_socket_accept(socketpool_socket_obj_t *self, uint8_t *ip, uint32_t *port, socketpool_socket_obj_t *accepted); 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); + +// Moves self to sock without closing the real socket. self will think its closed afterwards. +void socketpool_socket_move(socketpool_socket_obj_t *self, socketpool_socket_obj_t *sock); + +// Resets the socket object state so it appears closed and disconnected. This only works on +// uninitialized memory. +void socketpool_socket_reset(socketpool_socket_obj_t *self); + #endif // MICROPY_INCLUDED_SHARED_BINDINGS_SOCKETPOOL_SOCKET_H diff --git a/shared-bindings/socketpool/SocketPool.c b/shared-bindings/socketpool/SocketPool.c index e500784f1f..3023721378 100644 --- a/shared-bindings/socketpool/SocketPool.c +++ b/shared-bindings/socketpool/SocketPool.c @@ -52,7 +52,7 @@ //| returned by :py:attr:`wifi.radio` //| """ //| ... - +//| STATIC mp_obj_t socketpool_socketpool_make_new(const mp_obj_type_t *type, size_t n_args, size_t n_kw, const mp_obj_t *args) { mp_arg_check_num(n_args, n_kw, 1, 1, false); @@ -65,12 +65,23 @@ STATIC mp_obj_t socketpool_socketpool_make_new(const mp_obj_type_t *type, size_t return MP_OBJ_FROM_PTR(s); } +//| class gaierror(OSError): +//| """Errors raised by getaddrinfo""" +//| +MP_DEFINE_EXCEPTION(gaierror, OSError) + +//| //| AF_INET: int //| AF_INET6: int +//| //| SOCK_STREAM: int //| SOCK_DGRAM: int //| SOCK_RAW: int +//| EAI_NONAME: int //| +//| TCP_NODELAY: int +//| +//| IPPROTO_TCP: int //| def socket(self, family: int = AF_INET, type: int = SOCK_STREAM) -> socketpool.Socket: //| """Create a new socket //| @@ -139,11 +150,7 @@ STATIC mp_obj_t socketpool_socketpool_getaddrinfo(size_t n_args, const mp_obj_t } if (ip_str == mp_const_none) { - ip_str = common_hal_socketpool_socketpool_gethostbyname(self, host); - } - - if (ip_str == mp_const_none) { - mp_raise_OSError(-2); // socket.EAI_NONAME from CPython + ip_str = common_hal_socketpool_socketpool_gethostbyname_raise(self, host); } mp_obj_tuple_t *tuple = MP_OBJ_TO_PTR(mp_obj_new_tuple(5, NULL)); @@ -162,6 +169,7 @@ STATIC MP_DEFINE_CONST_FUN_OBJ_KW(socketpool_socketpool_getaddrinfo_obj, 1, sock STATIC const mp_rom_map_elem_t socketpool_socketpool_locals_dict_table[] = { { MP_ROM_QSTR(MP_QSTR_socket), MP_ROM_PTR(&socketpool_socketpool_socket_obj) }, { MP_ROM_QSTR(MP_QSTR_getaddrinfo), MP_ROM_PTR(&socketpool_socketpool_getaddrinfo_obj) }, + { MP_ROM_QSTR(MP_QSTR_gaierror), MP_ROM_PTR(&mp_type_gaierror) }, // class constants { MP_ROM_QSTR(MP_QSTR_AF_INET), MP_ROM_INT(SOCKETPOOL_AF_INET) }, @@ -170,6 +178,12 @@ STATIC const mp_rom_map_elem_t socketpool_socketpool_locals_dict_table[] = { { MP_ROM_QSTR(MP_QSTR_SOCK_STREAM), MP_ROM_INT(SOCKETPOOL_SOCK_STREAM) }, { MP_ROM_QSTR(MP_QSTR_SOCK_DGRAM), MP_ROM_INT(SOCKETPOOL_SOCK_DGRAM) }, { MP_ROM_QSTR(MP_QSTR_SOCK_RAW), MP_ROM_INT(SOCKETPOOL_SOCK_RAW) }, + + { MP_ROM_QSTR(MP_QSTR_TCP_NODELAY), MP_ROM_INT(SOCKETPOOL_TCP_NODELAY) }, + + { MP_ROM_QSTR(MP_QSTR_IPPROTO_TCP), MP_ROM_INT(SOCKETPOOL_IPPROTO_TCP) }, + + { MP_ROM_QSTR(MP_QSTR_EAI_NONAME), MP_ROM_INT(SOCKETPOOL_EAI_NONAME) }, }; STATIC MP_DEFINE_CONST_DICT(socketpool_socketpool_locals_dict, socketpool_socketpool_locals_dict_table); @@ -180,3 +194,26 @@ const mp_obj_type_t socketpool_socketpool_type = { .make_new = socketpool_socketpool_make_new, .locals_dict = (mp_obj_dict_t *)&socketpool_socketpool_locals_dict, }; + +MP_WEAK +mp_obj_t common_hal_socketpool_socketpool_gethostbyname_raise(socketpool_socketpool_obj_t *self, const char *host) { + mp_obj_t ip_str = common_hal_socketpool_socketpool_gethostbyname(self, host); + if (ip_str == mp_const_none) { + common_hal_socketpool_socketpool_raise_gaierror_noname(); + } + return ip_str; +} + +MP_WEAK NORETURN +void common_hal_socketpool_socketpool_raise_gaierror_noname(void) { + vstr_t vstr; + mp_print_t print; + vstr_init_print(&vstr, 64, &print); + mp_printf(&print, "%S", translate("Name or service not known")); + + mp_obj_t exc_args[] = { + MP_OBJ_NEW_SMALL_INT(SOCKETPOOL_EAI_NONAME), + mp_obj_new_str_from_vstr(&mp_type_str, &vstr), + }; + nlr_raise(mp_obj_new_exception_args(&mp_type_gaierror, MP_ARRAY_SIZE(exc_args), exc_args)); +} diff --git a/shared-bindings/socketpool/SocketPool.h b/shared-bindings/socketpool/SocketPool.h index 92382078e1..6409f8c763 100644 --- a/shared-bindings/socketpool/SocketPool.h +++ b/shared-bindings/socketpool/SocketPool.h @@ -34,16 +34,28 @@ extern const mp_obj_type_t socketpool_socketpool_type; typedef enum { - SOCKETPOOL_SOCK_STREAM, - SOCKETPOOL_SOCK_DGRAM, - SOCKETPOOL_SOCK_RAW + SOCKETPOOL_SOCK_STREAM = 1, + SOCKETPOOL_SOCK_DGRAM = 2, + SOCKETPOOL_SOCK_RAW = 3 } socketpool_socketpool_sock_t; typedef enum { - SOCKETPOOL_AF_INET, - SOCKETPOOL_AF_INET6 + SOCKETPOOL_AF_INET = 2, + SOCKETPOOL_AF_INET6 = 10 } socketpool_socketpool_addressfamily_t; +typedef enum { + SOCKETPOOL_IPPROTO_TCP = 6, +} socketpool_socketpool_ipproto_t; + +typedef enum { + SOCKETPOOL_TCP_NODELAY = 1, +} socketpool_socketpool_tcpopt_t; + +typedef enum { + SOCKETPOOL_EAI_NONAME = -2, +} socketpool_eai_t; + void common_hal_socketpool_socketpool_construct(socketpool_socketpool_obj_t *self, mp_obj_t radio); socketpool_socket_obj_t *common_hal_socketpool_socket(socketpool_socketpool_obj_t *self, @@ -51,6 +63,9 @@ 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); +// raises an exception instead of returning mp_const_none in the case of error +mp_obj_t common_hal_socketpool_socketpool_gethostbyname_raise(socketpool_socketpool_obj_t *self, + const char *host); // Non-allocating version for internal use. These sockets are not registered and, therefore, not // closed automatically. @@ -58,4 +73,6 @@ bool socketpool_socket(socketpool_socketpool_obj_t *self, socketpool_socketpool_addressfamily_t family, socketpool_socketpool_sock_t type, socketpool_socket_obj_t *sock); +NORETURN void common_hal_socketpool_socketpool_raise_gaierror_noname(void); + #endif // MICROPY_INCLUDED_SHARED_BINDINGS_SOCKETPOOL_SOCKETPOOL_H diff --git a/shared-bindings/ssl/SSLSocket.c b/shared-bindings/ssl/SSLSocket.c index d6f4ad051c..e0e7911715 100644 --- a/shared-bindings/ssl/SSLSocket.c +++ b/shared-bindings/ssl/SSLSocket.c @@ -240,7 +240,8 @@ STATIC MP_DEFINE_CONST_FUN_OBJ_2(ssl_sslsocket_send_obj, ssl_sslsocket_send); //| def settimeout(self, value: int) -> None: //| """Set the timeout value for this socket. //| -//| :param ~int value: timeout in seconds. 0 means non-blocking. None means block indefinitely.""" +//| :param ~int value: timeout in seconds. 0 means non-blocking. None means block indefinitely. +//| """ //| ... STATIC mp_obj_t ssl_sslsocket_settimeout(mp_obj_t self_in, mp_obj_t timeout_in) { ssl_sslsocket_obj_t *self = MP_OBJ_TO_PTR(self_in); diff --git a/shared-bindings/ssl/__init__.c b/shared-bindings/ssl/__init__.c index 9204c92790..6967860054 100644 --- a/shared-bindings/ssl/__init__.c +++ b/shared-bindings/ssl/__init__.c @@ -36,6 +36,7 @@ //| //| |see_cpython_module| :mod:`cpython:ssl`. //| """ +//| //| def create_default_context() -> ssl.SSLContext: //| """Return the default SSLContext.""" diff --git a/shared-bindings/storage/__init__.c b/shared-bindings/storage/__init__.c index 838395efb3..8e2eee6511 100644 --- a/shared-bindings/storage/__init__.c +++ b/shared-bindings/storage/__init__.c @@ -166,8 +166,11 @@ MP_DEFINE_CONST_FUN_OBJ_1(storage_getmount_obj, storage_getmount); //| extended by setting this to `True`. If this isn't provided or //| set to `None` (default), the existing configuration will be used. //| +//| .. note:: New firmware starts with storage extended. In case of an existing +//| filesystem (e.g. uf2 load), the existing extension setting is preserved. +//| //| .. warning:: All the data on ``CIRCUITPY`` will be lost, and -//| CircuitPython will restart on certain boards.""" +//| CircuitPython will restart on certain boards.""" //| ... //| @@ -258,6 +261,10 @@ STATIC const mp_rom_map_elem_t storage_module_globals_table[] = { //| this property can only be set when the device is writable by the //| microcontroller.""" //| ... +//| readonly: bool +//| """``True`` when the device is mounted as readonly by the microcontroller. +//| This property cannot be changed, use `storage.remount` instead.""" +//| ... //| //| def mkfs(self) -> None: //| """Format the block device, deleting any data that may have been there""" diff --git a/shared-bindings/struct/__init__.c b/shared-bindings/struct/__init__.c index 59bc78005d..5b63a15f15 100644 --- a/shared-bindings/struct/__init__.c +++ b/shared-bindings/struct/__init__.c @@ -46,6 +46,7 @@ //| //| Supported format codes: *b*, *B*, *x*, *h*, *H*, *i*, *I*, *l*, *L*, *q*, *Q*, //| *s*, *P*, *f*, *d* (the latter 2 depending on the floating-point support).""" +//| //| def calcsize(fmt: str) -> int: diff --git a/shared-bindings/supervisor/Runtime.c b/shared-bindings/supervisor/Runtime.c index 4d8ddbacc7..db3d8d1e4d 100644 --- a/shared-bindings/supervisor/Runtime.c +++ b/shared-bindings/supervisor/Runtime.c @@ -32,6 +32,7 @@ #include "shared-bindings/supervisor/RunReason.h" #include "shared-bindings/supervisor/Runtime.h" +#include "shared-bindings/supervisor/SafeModeReason.h" #include "supervisor/shared/reload.h" #include "supervisor/shared/stack.h" @@ -106,7 +107,7 @@ void supervisor_set_run_reason(supervisor_run_reason_t run_reason) { } //| run_reason: RunReason -//| """Why CircuitPython started running this particular time.""" +//| """Why CircuitPython started running this particular time (read-only).""" STATIC mp_obj_t supervisor_runtime_get_run_reason(mp_obj_t self) { return cp_enum_find(&supervisor_run_reason_type, _run_reason); } @@ -115,6 +116,23 @@ 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); +//| safe_mode_reason: SafeModeReason +//| """Why CircuitPython went into safe mode this particular time (read-only). +//| +//| **Limitations**: Raises ``NotImplementedError`` on builds that do not implement ``safemode.py``. +//| """ +STATIC mp_obj_t supervisor_runtime_get_safe_mode_reason(mp_obj_t self) { + #if CIRCUITPY_SAFEMODE_PY + return cp_enum_find(&supervisor_safe_mode_reason_type, get_safe_mode()); + #else + mp_raise_NotImplementedError(NULL); + #endif +} +MP_DEFINE_CONST_FUN_OBJ_1(supervisor_runtime_get_safe_mode_reason_obj, supervisor_runtime_get_safe_mode_reason); + +MP_PROPERTY_GETTER(supervisor_runtime_safe_mode_reason_obj, + (mp_obj_t)&supervisor_runtime_get_safe_mode_reason_obj); + //| autoreload: bool //| """Whether CircuitPython may autoreload based on workflow writes to the filesystem.""" //| @@ -218,6 +236,7 @@ STATIC const mp_rom_map_elem_t supervisor_runtime_locals_dict_table[] = { { 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_safe_mode_reason), MP_ROM_PTR(&supervisor_runtime_safe_mode_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) }, diff --git a/shared-bindings/supervisor/Runtime.h b/shared-bindings/supervisor/Runtime.h index debc5ec79c..3c3e2611f6 100644 --- a/shared-bindings/supervisor/Runtime.h +++ b/shared-bindings/supervisor/Runtime.h @@ -31,12 +31,16 @@ #include "py/obj.h" #include "shared-bindings/supervisor/RunReason.h" +#include "shared-bindings/supervisor/SafeModeReason.h" extern const mp_obj_type_t supervisor_runtime_type; supervisor_run_reason_t supervisor_get_run_reason(void); void supervisor_set_run_reason(supervisor_run_reason_t run_reason); +safe_mode_t supervisor_get_safe_mode(void); +void supervisor_set_safe_mode(safe_mode_t safe_mode); + bool common_hal_supervisor_runtime_get_serial_connected(void); bool common_hal_supervisor_runtime_get_serial_bytes_available(void); diff --git a/shared-bindings/supervisor/SafeModeReason.c b/shared-bindings/supervisor/SafeModeReason.c new file mode 100644 index 0000000000..2da03bdced --- /dev/null +++ b/shared-bindings/supervisor/SafeModeReason.c @@ -0,0 +1,158 @@ +/* + * This file is part of the MicroPython project, http://micropython.org/ + * + * The MIT License (MIT) + * + * Copyright (c) 2023 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 "py/enum.h" + +#include "shared-bindings/supervisor/SafeModeReason.h" + +// Reuse the non-Python safe_mode_t enum +#include "supervisor/shared/safe_mode.h" + +MAKE_ENUM_VALUE(supervisor_safe_mode_reason_type, safe_mode_reason, NONE, SAFE_MODE_NONE); +MAKE_ENUM_VALUE(supervisor_safe_mode_reason_type, safe_mode_reason, BROWNOUT, SAFE_MODE_BROWNOUT); +// alphabetical from here down +MAKE_ENUM_VALUE(supervisor_safe_mode_reason_type, safe_mode_reason, FLASH_WRITE_FAIL, SAFE_MODE_FLASH_WRITE_FAIL); +MAKE_ENUM_VALUE(supervisor_safe_mode_reason_type, safe_mode_reason, GC_ALLOC_OUTSIDE_VM, SAFE_MODE_GC_ALLOC_OUTSIDE_VM); +MAKE_ENUM_VALUE(supervisor_safe_mode_reason_type, safe_mode_reason, HARD_FAULT, SAFE_MODE_HARD_FAULT); +MAKE_ENUM_VALUE(supervisor_safe_mode_reason_type, safe_mode_reason, INTERRUPT_ERROR, SAFE_MODE_INTERRUPT_ERROR); +MAKE_ENUM_VALUE(supervisor_safe_mode_reason_type, safe_mode_reason, NLR_JUMP_FAIL, SAFE_MODE_NLR_JUMP_FAIL); +MAKE_ENUM_VALUE(supervisor_safe_mode_reason_type, safe_mode_reason, NO_CIRCUITPY, SAFE_MODE_NO_CIRCUITPY); +MAKE_ENUM_VALUE(supervisor_safe_mode_reason_type, safe_mode_reason, NO_HEAP, SAFE_MODE_NO_HEAP); +MAKE_ENUM_VALUE(supervisor_safe_mode_reason_type, safe_mode_reason, PROGRAMMATIC, SAFE_MODE_PROGRAMMATIC); +MAKE_ENUM_VALUE(supervisor_safe_mode_reason_type, safe_mode_reason, SDK_FATAL_ERROR, SAFE_MODE_SDK_FATAL_ERROR); +MAKE_ENUM_VALUE(supervisor_safe_mode_reason_type, safe_mode_reason, STACK_OVERFLOW, SAFE_MODE_STACK_OVERFLOW); +MAKE_ENUM_VALUE(supervisor_safe_mode_reason_type, safe_mode_reason, USB_BOOT_DEVICE_NOT_INTERFACE_ZERO, SAFE_MODE_USB_BOOT_DEVICE_NOT_INTERFACE_ZERO); +MAKE_ENUM_VALUE(supervisor_safe_mode_reason_type, safe_mode_reason, USB_TOO_MANY_ENDPOINTS, SAFE_MODE_USB_TOO_MANY_ENDPOINTS); +MAKE_ENUM_VALUE(supervisor_safe_mode_reason_type, safe_mode_reason, USB_TOO_MANY_INTERFACE_NAMES, SAFE_MODE_USB_TOO_MANY_INTERFACE_NAMES); +MAKE_ENUM_VALUE(supervisor_safe_mode_reason_type, safe_mode_reason, USER, SAFE_MODE_USER); +MAKE_ENUM_VALUE(supervisor_safe_mode_reason_type, safe_mode_reason, WATCHDOG, SAFE_MODE_WATCHDOG); + + +//| class SafeModeReason: +//| """The reason that CircuitPython went into safe mode. +//| +//| **Limitations**: Class not available on builds that do not implement ``safemode.py``. +//| """ +//| +MAKE_ENUM_MAP(supervisor_safe_mode_reason) { + +//| NONE: object +//| """CircuitPython is not in safe mode.""" +//| + MAKE_ENUM_MAP_ENTRY(safe_mode_reason, NONE), + +//| BROWNOUT: object +//| """The microcontroller voltage dropped too low.""" +//| + MAKE_ENUM_MAP_ENTRY(safe_mode_reason, BROWNOUT), + +// alphabetical from here down + +//| FLASH_WRITE_FAIL: object +//| """Could not write to flash memory.""" +//| + MAKE_ENUM_MAP_ENTRY(safe_mode_reason, FLASH_WRITE_FAIL), + +//| GC_ALLOC_OUTSIDE_VM: object +//| """CircuitPython tried to allocate storage when its virtual machine was not running.""" +//| + MAKE_ENUM_MAP_ENTRY(safe_mode_reason, GC_ALLOC_OUTSIDE_VM), + +//| HARD_FAULT: object +//| """The microcontroller detected a fault, such as an out-of-bounds memory write.""" +//| + MAKE_ENUM_MAP_ENTRY(safe_mode_reason, HARD_FAULT), + +//| INTERRUPT_ERROR: object +//| """Internal error related to interrupts.""" +//| + MAKE_ENUM_MAP_ENTRY(safe_mode_reason, INTERRUPT_ERROR), + +//| NLR_JUMP_FAIL: object +//| """An error occurred during exception handling, possibly due to memory corruption.""" +//| + MAKE_ENUM_MAP_ENTRY(safe_mode_reason, NLR_JUMP_FAIL), + +//| NO_CIRCUITPY: object +//| """The CIRCUITPY drive was not available.""" +//| + MAKE_ENUM_MAP_ENTRY(safe_mode_reason, NO_CIRCUITPY), + +//| NO_HEAP: object +//| """Heap storage was not present.""" +//| + MAKE_ENUM_MAP_ENTRY(safe_mode_reason, NO_HEAP), + +//| PROGRAMMATIC: object +//| """The program entered safe mode using the `supervisor` module.""" +//| + MAKE_ENUM_MAP_ENTRY(safe_mode_reason, PROGRAMMATIC), + +//| SDK_FATAL_ERROR: object +//| """Third party firmware reported a fatal error.""" +//| + MAKE_ENUM_MAP_ENTRY(safe_mode_reason, SDK_FATAL_ERROR), + +//| STACK_OVERFLOW: object +//| """The CircuitPython heap was corrupted because the stack was too small.""" +//| + MAKE_ENUM_MAP_ENTRY(safe_mode_reason, STACK_OVERFLOW), + +//| USB_BOOT_DEVICE_NOT_INTERFACE_ZERO: object +//| """The USB HID boot device was not set up to be the first device, on interface #0.""" +//| + MAKE_ENUM_MAP_ENTRY(safe_mode_reason, USB_BOOT_DEVICE_NOT_INTERFACE_ZERO), + +//| USB_TOO_MANY_ENDPOINTS: object +//| """USB devices need more endpoints than are available.""" +//| + MAKE_ENUM_MAP_ENTRY(safe_mode_reason, USB_TOO_MANY_ENDPOINTS), + +//| USB_TOO_MANY_INTERFACE_NAMES: object +//| """USB devices specify too many interface names.""" +//| + MAKE_ENUM_MAP_ENTRY(safe_mode_reason, USB_TOO_MANY_INTERFACE_NAMES), + +//| USER: object +//| """The user pressed one or more buttons to enter safe mode. +//| This safe mode does **not** cause ``safemode.py`` to be run, since its purpose +//| is to prevent all user code from running. +//| This allows errors in ``safemode.py`` to be corrected easily. +//| """ +//| + MAKE_ENUM_MAP_ENTRY(safe_mode_reason, USER), + +//| SAFE_MODE_WATCHDOG: object +//| """An internal watchdog timer expired.""" +//| + MAKE_ENUM_MAP_ENTRY(safe_mode_reason, WATCHDOG), +}; + +STATIC MP_DEFINE_CONST_DICT(supervisor_safe_mode_reason_locals_dict, supervisor_safe_mode_reason_locals_table); + +MAKE_PRINTER(supervisor, supervisor_safe_mode_reason); + +MAKE_ENUM_TYPE(supervisor, SafeModeReason, supervisor_safe_mode_reason); diff --git a/shared-bindings/supervisor/SafeModeReason.h b/shared-bindings/supervisor/SafeModeReason.h new file mode 100644 index 0000000000..d061d75154 --- /dev/null +++ b/shared-bindings/supervisor/SafeModeReason.h @@ -0,0 +1,31 @@ +/* + * This file is part of the MicroPython project, http://micropython.org/ + * + * The MIT License (MIT) + * + * Copyright (c) 2023 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. + */ + +#pragma once + +#include "supervisor/shared/safe_mode.h" + +extern const mp_obj_type_t supervisor_safe_mode_reason_type; diff --git a/shared-bindings/supervisor/__init__.c b/shared-bindings/supervisor/__init__.c index b61d05d636..491cac2f17 100644 --- a/shared-bindings/supervisor/__init__.c +++ b/shared-bindings/supervisor/__init__.c @@ -59,6 +59,7 @@ //| The status bar reports the current IP or BLE connection, what file is running, //| the last exception name and location, and firmware version information. //| This object is the sole instance of `supervisor.StatusBar`.""" +//| //| def reload() -> None: //| """Reload the main Python code and run it (equivalent to hitting Ctrl-D at the REPL).""" @@ -197,7 +198,7 @@ MP_DEFINE_CONST_FUN_OBJ_KW(supervisor_set_next_code_file_obj, 0, supervisor_set_ //| //| def ticks_add(ticks, delta): //| "Add a delta to a base number of ticks, performing wraparound at 2**29ms." -//| return (a + b) % _TICKS_PERIOD +//| return (ticks + delta) % _TICKS_PERIOD //| //| def ticks_diff(ticks1, ticks2): //| "Compute the signed difference between two ticks values, assuming that they are within 2**28 ticks" @@ -335,6 +336,11 @@ STATIC const mp_rom_map_elem_t supervisor_module_globals_table[] = { { 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) }, + #if CIRCUITPY_SAFEMODE_PY + { MP_ROM_QSTR(MP_QSTR_SafeModeReason), MP_ROM_PTR(&supervisor_safe_mode_reason_type) }, + #else + { MP_ROM_QSTR(MP_QSTR_SafeModeReason), MP_ROM_NONE }, + #endif { 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) }, diff --git a/shared-bindings/time/__init__.c b/shared-bindings/time/__init__.c index 096c80d382..d02923f162 100644 --- a/shared-bindings/time/__init__.c +++ b/shared-bindings/time/__init__.c @@ -97,9 +97,7 @@ STATIC mp_obj_t struct_time_make_new(const mp_obj_type_t *type, size_t n_args, s size_t len; mp_obj_t *items; mp_obj_get_array(args[0], &len, &items); - if (len != 9) { - mp_raise_TypeError(translate("time.struct_time() takes a 9-sequence")); - } + mp_arg_validate_length(len, 9, MP_QSTR_value); return namedtuple_make_new(type, len, 0, items); } diff --git a/shared-bindings/touchio/TouchIn.c b/shared-bindings/touchio/TouchIn.c index 226fa445da..7f26149b00 100644 --- a/shared-bindings/touchio/TouchIn.c +++ b/shared-bindings/touchio/TouchIn.c @@ -63,7 +63,7 @@ STATIC mp_obj_t touchio_touchin_make_new(const mp_obj_type_t *type, mp_arg_check_num(n_args, n_kw, 1, 1, false); // 1st argument is the pin - const mcu_pin_obj_t *pin = validate_obj_is_free_pin(args[0]); + const mcu_pin_obj_t *pin = validate_obj_is_free_pin(args[0], MP_QSTR_pin); touchio_touchin_obj_t *self = m_new_obj(touchio_touchin_obj_t); self->base.type = &touchio_touchin_type; diff --git a/shared-bindings/traceback/__init__.c b/shared-bindings/traceback/__init__.c index eeb7bc458d..3ad601eb39 100644 --- a/shared-bindings/traceback/__init__.c +++ b/shared-bindings/traceback/__init__.c @@ -37,6 +37,7 @@ //| |see_cpython_module| :mod:`cpython:traceback`. //| """ //| ... +//| STATIC void traceback_exception_common(bool is_print_exception, mp_print_t *print, size_t n_args, const mp_obj_t *pos_args, mp_map_t *kw_args) { enum { ARG_exc, ARG_value, ARG_tb, ARG_limit, ARG_file, ARG_chain }; @@ -58,6 +59,7 @@ STATIC void traceback_exception_common(bool is_print_exception, mp_print_t *prin } mp_obj_t tb_obj = args[ARG_tb].u_obj; mp_obj_t limit_obj = args[ARG_limit].u_obj; + bool chain = args[ARG_chain].u_bool; if (args[ARG_file].u_obj != mp_const_none) { if (!is_print_exception) { @@ -90,6 +92,15 @@ STATIC void traceback_exception_common(bool is_print_exception, mp_print_t *prin mp_obj_exception_t *exc = mp_obj_exception_get_native(value); mp_obj_traceback_t *trace_backup = exc->traceback; + #if MICROPY_CPYTHON_EXCEPTION_CHAIN + mp_obj_exception_t *context_backup = exc->context; + mp_obj_exception_t *cause_backup = exc->cause; + + if (!chain) { + exc->context = NULL; + exc->cause = NULL; + } + #endif if (tb_obj == MP_OBJ_NULL) { /* Print the traceback's exception as is */ @@ -101,6 +112,10 @@ STATIC void traceback_exception_common(bool is_print_exception, mp_print_t *prin shared_module_traceback_print_exception(MP_OBJ_TO_PTR(value), print, limit); exc->traceback = trace_backup; + #if MICROPY_CPYTHON_EXCEPTION_CHAIN + exc->context = context_backup; + exc->cause = cause_backup; + #endif } //| def format_exception( @@ -128,14 +143,12 @@ STATIC void traceback_exception_common(bool is_print_exception, mp_print_t *prin //| these lines are concatenated and printed, exactly the same text is //| printed as does print_exception(). //| -//| .. note:: Setting ``chain`` will have no effect as chained exceptions are not yet implemented. -//| //| :param exc: The exception. Must be an instance of `BaseException`. Unused if value is specified. //| :param value: If specified, is used in place of ``exc``. //| :param TracebackType tb: When value is alsp specified, ``tb`` is used in place of the exception's own traceback. If `None`, the traceback will not be printed. //| :param int limit: Print up to limit stack trace entries (starting from the caller’s frame) if limit is positive. //| Otherwise, print the last ``abs(limit)`` entries. If limit is omitted or None, all entries are printed. -//| :param bool chain: If `True` then chained exceptions will be printed (note: not yet implemented). +//| :param bool chain: If `True` then chained exceptions will be printed. //| """ //| STATIC mp_obj_t traceback_format_exception(size_t n_args, const mp_obj_t *pos_args, mp_map_t *kw_args) { @@ -169,8 +182,6 @@ STATIC MP_DEFINE_CONST_FUN_OBJ_KW(traceback_format_exception_obj, 0, traceback_f //| no traceback will be shown. This is compatible with CPython 3.5 and //| newer. //| -//| .. note:: Setting ``chain`` will have no effect as chained exceptions are not yet implemented. -//| //| :param exc: The exception. Must be an instance of `BaseException`. Unused if value is specified. //| :param value: If specified, is used in place of ``exc``. //| :param tb: When value is alsp specified, ``tb`` is used in place of the exception's own traceback. If `None`, the traceback will not be printed. @@ -178,7 +189,7 @@ STATIC MP_DEFINE_CONST_FUN_OBJ_KW(traceback_format_exception_obj, 0, traceback_f //| Otherwise, print the last ``abs(limit)`` entries. If limit is omitted or None, all entries are printed. //| :param io.FileIO file: If file is omitted or `None`, the output goes to `sys.stderr`; otherwise it should be an open //| file or file-like object to receive the output. -//| :param bool chain: If `True` then chained exceptions will be printed (note: not yet implemented). +//| :param bool chain: If `True` then chained exceptions will be printed. //| //| """ //| ... diff --git a/shared-bindings/uheap/__init__.c b/shared-bindings/uheap/__init__.c index 376be78ef1..40aa869225 100644 --- a/shared-bindings/uheap/__init__.c +++ b/shared-bindings/uheap/__init__.c @@ -32,6 +32,7 @@ #include "shared-bindings/uheap/__init__.h" //| """Heap size analysis""" +//| //| def info(object: object) -> int: //| """Prints memory debugging info for the given object and returns the diff --git a/shared-bindings/usb/core/__init__.c b/shared-bindings/usb/core/__init__.c index 84d202945a..faeef23a88 100644 --- a/shared-bindings/usb/core/__init__.c +++ b/shared-bindings/usb/core/__init__.c @@ -40,6 +40,7 @@ //| //| This is a subset of the PyUSB core module. //| """ +//| //| class USBError(OSError): //| """Catchall exception for USB related errors.""" diff --git a/shared-bindings/usb_cdc/__init__.c b/shared-bindings/usb_cdc/__init__.c index e23e289309..b4e712e854 100644 --- a/shared-bindings/usb_cdc/__init__.c +++ b/shared-bindings/usb_cdc/__init__.c @@ -62,6 +62,7 @@ //| """A `Serial` object that can be used to send and receive binary data to and from //| the host. //| Note that `data` is *disabled* by default. ``data`` is ``None`` if disabled.""" +//| //| def disable() -> None: //| """Do not present any USB CDC device to the host. diff --git a/shared-bindings/usb_hid/Device.c b/shared-bindings/usb_hid/Device.c index 97196144be..cb88766b3e 100644 --- a/shared-bindings/usb_hid/Device.c +++ b/shared-bindings/usb_hid/Device.c @@ -155,7 +155,7 @@ STATIC mp_obj_t usb_hid_device_make_new(const mp_obj_type_t *type, size_t n_args } if (report_ids_array[0] == 0 && report_ids_count > 1) { - mp_raise_ValueError_varg(translate("%q with a report ID of 0 must be of length 1"), MP_QSTR_report_ids); + mp_raise_ValueError_varg(translate("%q length must be %d"), MP_QSTR_report_id_space_0, 1); } common_hal_usb_hid_device_construct( diff --git a/shared-bindings/usb_hid/__init__.c b/shared-bindings/usb_hid/__init__.c index 9cb9303143..5c61cc52de 100644 --- a/shared-bindings/usb_hid/__init__.c +++ b/shared-bindings/usb_hid/__init__.c @@ -47,6 +47,7 @@ //| containing a `Device` that describes the boot device chosen (keyboard or mouse). //| The request for a boot device overrides any other HID devices. //| """ +//| //| def disable() -> None: //| """Do not present any USB HID devices to the host computer. diff --git a/shared-bindings/usb_host/Port.c b/shared-bindings/usb_host/Port.c index 7fb79e75a5..53b1fec54f 100644 --- a/shared-bindings/usb_host/Port.c +++ b/shared-bindings/usb_host/Port.c @@ -47,8 +47,8 @@ STATIC mp_obj_t usb_host_port_make_new(const mp_obj_type_t *type, // check number of arguments mp_arg_check_num(n_args, n_kw, 2, 2, false); - const mcu_pin_obj_t *dp = validate_obj_is_free_pin(args[0]); - const mcu_pin_obj_t *dm = validate_obj_is_free_pin(args[1]); + const mcu_pin_obj_t *dp = validate_obj_is_free_pin(args[0], MP_QSTR_dp); + const mcu_pin_obj_t *dm = validate_obj_is_free_pin(args[1], MP_QSTR_dm); usb_host_port_obj_t *self = m_new_obj(usb_host_port_obj_t); self->base.type = &usb_host_port_type; diff --git a/shared-bindings/usb_midi/__init__.c b/shared-bindings/usb_midi/__init__.c index 982cd144da..d3d5cf2626 100644 --- a/shared-bindings/usb_midi/__init__.c +++ b/shared-bindings/usb_midi/__init__.c @@ -42,6 +42,7 @@ //| //| ports: Tuple[Union[PortIn, PortOut], ...] //| """Tuple of all MIDI ports. Each item is ether `PortIn` or `PortOut`.""" +//| //| def disable() -> None: //| """Disable presenting a USB MIDI device to the host. diff --git a/shared-bindings/ustack/__init__.c b/shared-bindings/ustack/__init__.c index b42fb2a614..17bdcbb1c0 100644 --- a/shared-bindings/ustack/__init__.c +++ b/shared-bindings/ustack/__init__.c @@ -35,6 +35,7 @@ //| """Stack information and analysis""" +//| #if MICROPY_MAX_STACK_USAGE //| def max_stack_usage() -> int: diff --git a/shared-bindings/vectorio/Circle.c b/shared-bindings/vectorio/Circle.c index 87cd46ad9a..9896876a8a 100644 --- a/shared-bindings/vectorio/Circle.c +++ b/shared-bindings/vectorio/Circle.c @@ -24,7 +24,8 @@ //| :param int radius: The radius of the circle in pixels //| :param int x: Initial x position of the axis. //| :param int y: Initial y position of the axis. -//| :param int color_index: Initial color_index to use when selecting color from the palette.""" +//| :param int color_index: Initial color_index to use when selecting color from the palette. +//| """ static mp_obj_t vectorio_circle_make_new(const mp_obj_type_t *type, size_t n_args, size_t n_kw, const mp_obj_t *all_args) { enum { ARG_pixel_shader, ARG_radius, ARG_x, ARG_y, ARG_color_index }; static const mp_arg_t allowed_args[] = { diff --git a/shared-bindings/vectorio/Polygon.c b/shared-bindings/vectorio/Polygon.c index 6ad102e6e6..b188fc4955 100644 --- a/shared-bindings/vectorio/Polygon.c +++ b/shared-bindings/vectorio/Polygon.c @@ -32,7 +32,8 @@ //| :param List[Tuple[int,int]] points: Vertices for the polygon //| :param int x: Initial screen x position of the 0,0 origin in the points list. //| :param int y: Initial screen y position of the 0,0 origin in the points list. -//| :param int color_index: Initial color_index to use when selecting color from the palette.""" +//| :param int color_index: Initial color_index to use when selecting color from the palette. +//| """ static mp_obj_t vectorio_polygon_make_new(const mp_obj_type_t *type, size_t n_args, size_t n_kw, const mp_obj_t *all_args) { enum { ARG_pixel_shader, ARG_points_list, ARG_x, ARG_y, ARG_color_index }; static const mp_arg_t allowed_args[] = { diff --git a/shared-bindings/vectorio/Rectangle.c b/shared-bindings/vectorio/Rectangle.c index a4f3e12e69..ad864f2c2d 100644 --- a/shared-bindings/vectorio/Rectangle.c +++ b/shared-bindings/vectorio/Rectangle.c @@ -25,7 +25,8 @@ //| :param int height: The number of pixels high //| :param int x: Initial x position of the top left corner. //| :param int y: Initial y position of the top left corner. -//| :param int color_index: Initial color_index to use when selecting color from the palette.""" +//| :param int color_index: Initial color_index to use when selecting color from the palette. +//| """ static mp_obj_t vectorio_rectangle_make_new(const mp_obj_type_t *type, size_t n_args, size_t n_kw, const mp_obj_t *all_args) { enum { ARG_pixel_shader, ARG_width, ARG_height, ARG_x, ARG_y, ARG_color_index }; static const mp_arg_t allowed_args[] = { diff --git a/shared-bindings/watchdog/__init__.c b/shared-bindings/watchdog/__init__.c index df55ab7c16..5281f1c3fc 100644 --- a/shared-bindings/watchdog/__init__.c +++ b/shared-bindings/watchdog/__init__.c @@ -49,6 +49,7 @@ //| w.timeout=2.5 # Set a timeout of 2.5 seconds //| w.mode = WatchDogMode.RAISE //| w.feed()""" +//| //| class WatchDogTimeout(Exception): //| """Exception raised when the watchdog timer is set to diff --git a/shared-bindings/wifi/AuthMode.h b/shared-bindings/wifi/AuthMode.h index a1016d6c8a..c514fb2a32 100644 --- a/shared-bindings/wifi/AuthMode.h +++ b/shared-bindings/wifi/AuthMode.h @@ -30,13 +30,13 @@ #include "py/enum.h" typedef enum { - AUTHMODE_OPEN, - AUTHMODE_WEP, - AUTHMODE_WPA, - AUTHMODE_WPA2, - AUTHMODE_WPA3, - AUTHMODE_PSK, - AUTHMODE_ENTERPRISE + AUTHMODE_OPEN = 1 << 0, + AUTHMODE_WEP = 1 << 1, + AUTHMODE_WPA = 1 << 2, + AUTHMODE_WPA2 = 1 << 3, + AUTHMODE_WPA3 = 1 << 4, + AUTHMODE_PSK = 1 << 5, + AUTHMODE_ENTERPRISE = 1 << 6, } wifi_authmode_t; extern const mp_obj_type_t wifi_authmode_type; diff --git a/shared-bindings/wifi/Monitor.c b/shared-bindings/wifi/Monitor.c index bd688d357d..d087ec587b 100644 --- a/shared-bindings/wifi/Monitor.c +++ b/shared-bindings/wifi/Monitor.c @@ -36,15 +36,14 @@ //| """For monitoring WiFi packets.""" //| -//| def __init__(self, channel: Optional[int] = 1, queue: Optional[int] = 128) -> None: -//| """Initialize `wifi.Monitor` singleton. +//| def __init__(self, channel: Optional[int] = 1, queue: Optional[int] = 128) -> None: +//| """Initialize `wifi.Monitor` singleton. //| -//| :param int channel: The WiFi channel to scan. -//| :param int queue: The queue size for buffering the packet. -//| -//| """ -//| ... +//| :param int channel: The WiFi channel to scan. +//| :param int queue: The queue size for buffering the packet. //| +//| """ +//| ... STATIC mp_obj_t wifi_monitor_make_new(const mp_obj_type_t *type, size_t n_args, size_t n_kw, const mp_obj_t *all_args) { enum { ARG_channel, ARG_queue }; static const mp_arg_t allowed_args[] = { @@ -69,8 +68,8 @@ STATIC mp_obj_t wifi_monitor_make_new(const mp_obj_type_t *type, size_t n_args, return MP_OBJ_FROM_PTR(self); } -//| channel: int -//| """The WiFi channel to scan.""" +//| 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); } @@ -90,8 +89,8 @@ MP_PROPERTY_GETSET(wifi_monitor_channel_obj, (mp_obj_t)&wifi_monitor_get_channel_obj, (mp_obj_t)&wifi_monitor_set_channel_obj); -//| queue: int -//| """The queue size for buffering the packet.""" +//| 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); } @@ -100,29 +99,26 @@ MP_DEFINE_CONST_FUN_OBJ_1(wifi_monitor_get_queue_obj, wifi_monitor_obj_get_queue MP_PROPERTY_GETTER(wifi_monitor_queue_obj, (mp_obj_t)&wifi_monitor_get_queue_obj); -//| def deinit(self) -> None: -//| """De-initialize `wifi.Monitor` singleton.""" -//| ... -//| +//| def deinit(self) -> None: +//| """De-initialize `wifi.Monitor` singleton.""" +//| ... STATIC mp_obj_t wifi_monitor_obj_deinit(mp_obj_t self_in) { common_hal_wifi_monitor_deinit(self_in); return mp_const_none; } STATIC MP_DEFINE_CONST_FUN_OBJ_1(wifi_monitor_deinit_obj, wifi_monitor_obj_deinit); -//| def lost(self) -> int: -//| """Returns the packet loss count. The counter resets after each poll.""" -//| ... -//| +//| def lost(self) -> int: +//| """Returns the packet loss count. The counter resets after each poll.""" +//| ... STATIC mp_obj_t wifi_monitor_obj_get_lost(mp_obj_t self_in) { return common_hal_wifi_monitor_get_lost(self_in); } MP_DEFINE_CONST_FUN_OBJ_1(wifi_monitor_lost_obj, wifi_monitor_obj_get_lost); -//| def queued(self) -> int: -//| """Returns the packet queued count.""" -//| ... -//| +//| def queued(self) -> int: +//| """Returns the packet queued count.""" +//| ... STATIC mp_obj_t wifi_monitor_obj_get_queued(mp_obj_t self_in) { if (common_hal_wifi_monitor_deinited()) { return mp_obj_new_int_from_uint(0); @@ -131,9 +127,9 @@ STATIC mp_obj_t wifi_monitor_obj_get_queued(mp_obj_t self_in) { } MP_DEFINE_CONST_FUN_OBJ_1(wifi_monitor_queued_obj, wifi_monitor_obj_get_queued); -//| def packet(self) -> dict: -//| """Returns the monitor packet.""" -//| ... +//| def packet(self) -> dict: +//| """Returns the monitor packet.""" +//| ... //| STATIC mp_obj_t wifi_monitor_obj_get_packet(mp_obj_t self_in) { if (common_hal_wifi_monitor_deinited()) { diff --git a/shared-bindings/wifi/Radio.c b/shared-bindings/wifi/Radio.c index 57e953ec68..fc3cc345b8 100644 --- a/shared-bindings/wifi/Radio.c +++ b/shared-bindings/wifi/Radio.c @@ -139,13 +139,19 @@ 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) { +//| the changes would only be reflected once the interface reconnects. +//| +//| **Limitations:** Not settable on RP2040 CYW43 boards, such as Pi Pico W. +//| """ + + +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)); } -MP_DEFINE_CONST_FUN_OBJ_1(wifi_radio_get_mac_address_obj, wifi_radio_get_mac_address); +MP_DEFINE_CONST_FUN_OBJ_1(wifi_radio_get_mac_address_obj, _wifi_radio_get_mac_address); +#if CIRCUITPY_WIFI_RADIO_SETTABLE_MAC_ADDRESS STATIC mp_obj_t wifi_radio_set_mac_address(mp_obj_t self_in, mp_obj_t mac_address_in) { mp_buffer_info_t mac_address; mp_get_buffer_raise(mac_address_in, &mac_address, MP_BUFFER_READ); @@ -160,10 +166,16 @@ STATIC mp_obj_t wifi_radio_set_mac_address(mp_obj_t self_in, mp_obj_t mac_addres return mp_const_none; } MP_DEFINE_CONST_FUN_OBJ_2(wifi_radio_set_mac_address_obj, wifi_radio_set_mac_address); +#endif +#if CIRCUITPY_WIFI_RADIO_SETTABLE_MAC_ADDRESS 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); +#else +MP_PROPERTY_GETTER(wifi_radio_mac_address_obj, + (mp_obj_t)&wifi_radio_get_mac_address_obj); +#endif //| tx_power: float //| """Wifi transmission power, in dBm.""" @@ -187,13 +199,17 @@ MP_PROPERTY_GETSET(wifi_radio_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.""" +//| the changes would only be reflected once the interface restarts. +//| +//| **Limitations:** Not settable on RP2040 CYW43 boards, such as Pi Pico W. +//| """ 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)); } MP_DEFINE_CONST_FUN_OBJ_1(wifi_radio_get_mac_address_ap_obj, wifi_radio_get_mac_address_ap); +#if CIRCUITPY_WIFI_RADIO_SETTABLE_MAC_ADDRESS STATIC mp_obj_t wifi_radio_set_mac_address_ap(mp_obj_t self_in, mp_obj_t mac_address_in) { mp_buffer_info_t mac_address; mp_get_buffer_raise(mac_address_in, &mac_address, MP_BUFFER_READ); @@ -208,10 +224,16 @@ STATIC mp_obj_t wifi_radio_set_mac_address_ap(mp_obj_t self_in, mp_obj_t mac_add return mp_const_none; } MP_DEFINE_CONST_FUN_OBJ_2(wifi_radio_set_mac_address_ap_obj, wifi_radio_set_mac_address_ap); +#endif +#if CIRCUITPY_WIFI_RADIO_SETTABLE_MAC_ADDRESS 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); +#else +MP_PROPERTY_GETTER(wifi_radio_mac_address_ap_obj, + (mp_obj_t)&wifi_radio_get_mac_address_ap_obj); +#endif //| def start_scanning_networks( //| self, *, start_channel: int = 1, stop_channel: int = 11 @@ -282,10 +304,10 @@ 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] = "", +//| password: Union[str | ReadableBuffer] = b"", //| *, -//| channel: Optional[int] = 1, -//| authmode: Optional[AuthMode], +//| channel: int = 1, +//| authmode: Optional[AuthMode] = None, //| max_connections: Optional[int] = 4 //| ) -> None: //| """Starts an Access Point with the specified ssid and password. @@ -293,10 +315,11 @@ MP_DEFINE_CONST_FUN_OBJ_1(wifi_radio_stop_station_obj, wifi_radio_stop_station); //| 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 not None, the access point will use that Authentication +//| mode. If a non-empty password is given, ``authmode`` must not be ``OPEN``. +//| If ``authmode`` is not given or is None, +//| ``OPEN`` will be used when the password is the empty string, +//| otherwise ``authmode`` will be ``WPA_WPA2_PSK``. //| //| If ``max_connections`` is given, the access point will allow up to //| that number of stations to connect.""" @@ -305,9 +328,9 @@ STATIC mp_obj_t wifi_radio_start_ap(size_t n_args, const mp_obj_t *pos_args, mp_ enum { ARG_ssid, ARG_password, ARG_channel, ARG_authmode, ARG_max_connections }; static const mp_arg_t allowed_args[] = { { MP_QSTR_ssid, MP_ARG_REQUIRED | MP_ARG_OBJ }, - { MP_QSTR_password, MP_ARG_OBJ, {.u_obj = MP_OBJ_NULL} }, + { MP_QSTR_password, MP_ARG_OBJ, {.u_obj = mp_const_empty_bytes} }, { MP_QSTR_channel, MP_ARG_KW_ONLY | MP_ARG_INT, {.u_int = 1} }, - { MP_QSTR_authmode, MP_ARG_KW_ONLY | MP_ARG_OBJ, {.u_obj = MP_OBJ_NULL} }, + { MP_QSTR_authmode, MP_ARG_KW_ONLY | MP_ARG_OBJ, {.u_obj = mp_const_none } }, { MP_QSTR_max_connections, MP_ARG_KW_ONLY | MP_ARG_INT, {.u_int = 4} }, }; @@ -315,12 +338,13 @@ STATIC mp_obj_t wifi_radio_start_ap(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 authmode = 0; - if (args[ARG_authmode].u_obj != MP_OBJ_NULL) { + // 0 indicates mode wasn't given. + uint32_t authmodes = 0; + if (args[ARG_authmode].u_obj != mp_const_none) { mp_obj_iter_buf_t iter_buf; mp_obj_t item, iterable = mp_getiter(args[ARG_authmode].u_obj, &iter_buf); while ((item = mp_iternext(iterable)) != MP_OBJ_STOP_ITERATION) { - authmode |= (1 << (wifi_authmode_t)cp_enum_value(&wifi_authmode_type, item)); + authmodes |= cp_enum_value(&wifi_authmode_type, item, MP_QSTR_authmode); } } @@ -329,20 +353,24 @@ STATIC mp_obj_t wifi_radio_start_ap(size_t n_args, const mp_obj_t *pos_args, mp_ 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) { - if (authmode == 1) { - mp_raise_ValueError(translate("AuthMode.OPEN is not used with password")); - } else if (authmode == 0) { - authmode = (1 << AUTHMODE_WPA) | (1 << AUTHMODE_WPA2) | (1 << AUTHMODE_PSK); + mp_get_buffer_raise(args[ARG_password].u_obj, &password, MP_BUFFER_READ); + if (authmodes == 0) { + if (password.len == 0) { + authmodes = AUTHMODE_OPEN; + } else { + authmodes = AUTHMODE_WPA | AUTHMODE_WPA2 | AUTHMODE_PSK; } - mp_get_buffer_raise(args[ARG_password].u_obj, &password, MP_BUFFER_READ); - mp_arg_validate_length_range(password.len, 8, 63, MP_QSTR_password); - } else { - authmode = 1; } - common_hal_wifi_radio_start_ap(self, ssid.buf, ssid.len, password.buf, password.len, args[ARG_channel].u_int, authmode, args[ARG_max_connections].u_int); + if (authmodes == AUTHMODE_OPEN && password.len > 0) { + mp_raise_ValueError(translate("AuthMode.OPEN is not used with password")); + } + + if (authmodes != AUTHMODE_OPEN) { + mp_arg_validate_length_range(password.len, 8, 63, MP_QSTR_password); + } + + common_hal_wifi_radio_start_ap(self, ssid.buf, ssid.len, password.buf, password.len, args[ARG_channel].u_int, authmodes, args[ARG_max_connections].u_int); return mp_const_none; } STATIC MP_DEFINE_CONST_FUN_OBJ_KW(wifi_radio_start_ap_obj, 1, wifi_radio_start_ap); @@ -359,10 +387,10 @@ 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] = "", +//| password: Union[str | ReadableBuffer] = b"", //| *, -//| channel: Optional[int] = 0, -//| bssid: Optional[Union[str | ReadableBuffer]] = "", +//| channel: int = 0, +//| bssid: Optional[Union[str | ReadableBuffer]] = None, //| timeout: Optional[float] = None //| ) -> None: //| """Connects to the given ssid and waits for an ip address. Reconnections are handled @@ -371,20 +399,20 @@ MP_DEFINE_CONST_FUN_OBJ_1(wifi_radio_stop_ap_obj, wifi_radio_stop_ap); //| 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 +//| If ``channel`` is non-zero, 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 +//| If ``bssid`` is given and not None, 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[] = { { MP_QSTR_ssid, MP_ARG_REQUIRED | MP_ARG_OBJ }, - { MP_QSTR_password, MP_ARG_OBJ, {.u_obj = MP_OBJ_NULL} }, + { MP_QSTR_password, MP_ARG_OBJ, {.u_obj = mp_const_empty_bytes} }, { MP_QSTR_channel, MP_ARG_KW_ONLY | MP_ARG_INT, {.u_int = 0} }, - { MP_QSTR_bssid, MP_ARG_KW_ONLY | MP_ARG_OBJ, {.u_obj = MP_OBJ_NULL} }, + { MP_QSTR_bssid, MP_ARG_KW_ONLY | MP_ARG_OBJ, {.u_obj = mp_const_none} }, { MP_QSTR_timeout, MP_ARG_KW_ONLY | MP_ARG_OBJ, {.u_obj = mp_const_none} }, }; @@ -404,9 +432,11 @@ STATIC mp_obj_t wifi_radio_connect(size_t n_args, const mp_obj_t *pos_args, mp_m mp_buffer_info_t password; password.len = 0; - if (args[ARG_password].u_obj != MP_OBJ_NULL) { + if (args[ARG_password].u_obj != mp_const_none) { mp_get_buffer_raise(args[ARG_password].u_obj, &password, MP_BUFFER_READ); - mp_arg_validate_length_range(password.len, 8, 63, MP_QSTR_password); + if (password.len != 0) { + mp_arg_validate_length_range(password.len, 8, 63, MP_QSTR_password); + } } #define MAC_ADDRESS_LENGTH 6 @@ -414,7 +444,7 @@ STATIC mp_obj_t wifi_radio_connect(size_t n_args, const mp_obj_t *pos_args, mp_m mp_buffer_info_t bssid; bssid.len = 0; // Should probably make sure bssid is just bytes and not something else too - if (args[ARG_bssid].u_obj != MP_OBJ_NULL) { + if (args[ARG_bssid].u_obj != mp_const_none) { mp_get_buffer_raise(args[ARG_bssid].u_obj, &bssid, MP_BUFFER_READ); if (bssid.len != MAC_ADDRESS_LENGTH) { mp_raise_ValueError(translate("Invalid BSSID")); diff --git a/shared-bindings/wifi/Radio.h b/shared-bindings/wifi/Radio.h index 370bdbd917..dbaeb9cce8 100644 --- a/shared-bindings/wifi/Radio.h +++ b/shared-bindings/wifi/Radio.h @@ -77,6 +77,8 @@ extern void common_hal_wifi_radio_set_enabled(wifi_radio_obj_t *self, bool enabl extern mp_obj_t common_hal_wifi_radio_get_hostname(wifi_radio_obj_t *self); extern void common_hal_wifi_radio_set_hostname(wifi_radio_obj_t *self, const char *hostname); + +extern void wifi_radio_get_mac_address(wifi_radio_obj_t *self, uint8_t *mac); extern mp_obj_t common_hal_wifi_radio_get_mac_address(wifi_radio_obj_t *self); extern void common_hal_wifi_radio_set_mac_address(wifi_radio_obj_t *self, const uint8_t *mac); extern mp_obj_t common_hal_wifi_radio_get_mac_address_ap(wifi_radio_obj_t *self); @@ -91,7 +93,7 @@ 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); 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_start_ap(wifi_radio_obj_t *self, uint8_t *ssid, size_t ssid_len, uint8_t *password, size_t password_len, uint8_t channel, uint32_t authmodes, 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); diff --git a/shared-bindings/zlib/__init__.c b/shared-bindings/zlib/__init__.c index d9c2a01810..ba02914638 100644 --- a/shared-bindings/zlib/__init__.c +++ b/shared-bindings/zlib/__init__.c @@ -46,6 +46,7 @@ //| The `zlib` module allows limited functionality similar to the CPython zlib library. //| This module allows to decompress binary data compressed with DEFLATE algorithm //| (commonly used in zlib library and gzip archiver). Compression is not yet implemented.""" +//| //| def zlib_decompress( //| data: bytes, wbits: Optional[int] = 0, bufsize: Optional[int] = 0 diff --git a/shared-module/_pixelmap/PixelMap.c b/shared-module/_pixelmap/PixelMap.c new file mode 100644 index 0000000000..5eaad0b2f8 --- /dev/null +++ b/shared-module/_pixelmap/PixelMap.c @@ -0,0 +1,174 @@ +/* + * This file is part of the CircuitPython project, https://github.com/adafruit/circuitpython + * + * The MIT License (MIT) + * + * Copyright (c) 2018 Rose Hooper + * 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/smallint.h" +#include "py/runtime.h" + +#include "shared-bindings/_pixelmap/PixelMap.h" +#include "shared-bindings/adafruit_pixelbuf/PixelBuf.h" +#include "shared-module/_pixelmap/PixelMap.h" + + +static void pixelmap_set_pixel_rgbw(pixelmap_pixelmap_obj_t *self, size_t i, color_u rgbw) { + mp_arg_validate_index_range(i, 0, self->len - 1, MP_QSTR_index); + + mp_obj_t item = self->items[i]; + if (mp_obj_is_small_int(item)) { + common_hal_adafruit_pixelbuf_pixelbuf_set_pixel_color(self->pixelbuf, MP_OBJ_SMALL_INT_VALUE(item), rgbw.r, rgbw.g, rgbw.b, rgbw.w); + } else { + size_t len; + mp_obj_t *items; + mp_obj_tuple_get(item, &len, &items); + + for (size_t j = 0; j < len; j++) { + common_hal_adafruit_pixelbuf_pixelbuf_set_pixel_color(self->pixelbuf, MP_OBJ_SMALL_INT_VALUE(items[j]), rgbw.r, rgbw.g, rgbw.b, rgbw.w); + } + } +} + +static void pixelmap_set_pixel(pixelmap_pixelmap_obj_t *self, size_t i, mp_obj_t color) { + color_u rgbw; + common_hal_adafruit_pixelbuf_pixelbuf_parse_color(self->pixelbuf, color, &rgbw.r, &rgbw.g, &rgbw.b, &rgbw.w); + pixelmap_set_pixel_rgbw(self, i, rgbw); +} + +void shared_module_pixelmap_pixelmap_construct(pixelmap_pixelmap_obj_t *self, mp_obj_t pixelbuf, mp_obj_t indices) { + self->pixelbuf = pixelbuf; + self->indices = indices; + mp_obj_tuple_get(indices, &self->len, &self->items); +} + +static bool auto_write_get_and_clear(pixelmap_pixelmap_obj_t *self) { + bool auto_write = self->auto_write && common_hal_adafruit_pixelbuf_pixelbuf_get_auto_write(self->pixelbuf); + if (auto_write) { + common_hal_adafruit_pixelbuf_pixelbuf_set_auto_write(self->pixelbuf, false); + } + return auto_write; +} + +static void auto_write_reapply(pixelmap_pixelmap_obj_t *self, bool auto_write) { + if (auto_write) { + common_hal_adafruit_pixelbuf_pixelbuf_set_auto_write(self->pixelbuf, true); + common_hal_adafruit_pixelbuf_pixelbuf_show(self->pixelbuf); + } +} + +bool shared_module_pixelmap_pixelmap_auto_write_get(pixelmap_pixelmap_obj_t *self) { + return self->auto_write; +} + +void shared_module_pixelmap_pixelmap_auto_write_set(pixelmap_pixelmap_obj_t *self, bool auto_write) { + self->auto_write = auto_write; +} + +void shared_module_pixelmap_pixelmap_fill(pixelmap_pixelmap_obj_t *self, const mp_obj_t color) { + color_u rgbw; + common_hal_adafruit_pixelbuf_pixelbuf_parse_color(self->pixelbuf, color, &rgbw.r, &rgbw.g, &rgbw.b, &rgbw.w); + bool auto_write = auto_write_get_and_clear(self); + + for (size_t i = 0; i < self->len; i++) { + pixelmap_set_pixel_rgbw(self, i, rgbw); + } + + auto_write_reapply(self, auto_write); +} + +mp_obj_t shared_module_pixelmap_pixelmap_indices(pixelmap_pixelmap_obj_t *self, int index) { + mp_arg_validate_index_range(index, 0, self->len - 1, MP_QSTR_index); + + mp_obj_t item = self->items[index]; + if (mp_obj_is_small_int(item)) { + return mp_obj_new_tuple(1, &item); + } else { + return item; + } +} + +#if MICROPY_PY_BUILTINS_SLICE + +mp_obj_t shared_module_pixelmap_pixelmap_getslice(pixelmap_pixelmap_obj_t *self, mp_bound_slice_t slice, size_t slice_len) { + mp_obj_tuple_t *t = MP_OBJ_TO_PTR(mp_obj_new_tuple(slice_len, NULL)); + for (uint i = 0; i < slice_len; i++) { + t->items[i] = shared_module_pixelmap_pixelmap_getitem(self, i * slice.step + slice.start); + } + return MP_OBJ_FROM_PTR(t); +} + +void shared_module_pixelmap_pixelmap_setslice(pixelmap_pixelmap_obj_t *self, const mp_obj_t values, mp_bound_slice_t slice, size_t slice_len) { + size_t num_items = mp_obj_get_int(mp_obj_len(values)); + if (num_items != slice_len) { + mp_raise_ValueError_varg(translate("Unmatched number of items on RHS (expected %d, got %d)."), slice_len, num_items); + } + + bool auto_write = auto_write_get_and_clear(self); + + // because we didn't preflight the pixel values, an exception could occur. + // In that case we need to do the auto-write of any pixels that were set + // before re-raising the exception + nlr_buf_t nlr; + + size_t start = slice.start; + mp_int_t step = slice.step; + + if (nlr_push(&nlr) == 0) { + mp_obj_iter_buf_t iter_buf; + mp_obj_t iterable = mp_getiter(values, &iter_buf); + mp_obj_t item; + while ((item = mp_iternext(iterable)) != MP_OBJ_STOP_ITERATION) { + pixelmap_set_pixel(self, start, item); + start += step; + } + nlr_pop(); + auto_write_reapply(self, auto_write); + } else { + auto_write_reapply(self, auto_write); + // exception converting color value, re-raise + nlr_raise(MP_OBJ_FROM_PTR(nlr.ret_val)); + } +} +#endif + +void shared_module_pixelmap_pixelmap_setitem(pixelmap_pixelmap_obj_t *self, mp_int_t i, mp_obj_t color) { + color_u rgbw; + common_hal_adafruit_pixelbuf_pixelbuf_parse_color(self->pixelbuf, color, &rgbw.r, &rgbw.g, &rgbw.b, &rgbw.w); + bool auto_write = auto_write_get_and_clear(self); + pixelmap_set_pixel_rgbw(self, i, rgbw); + auto_write_reapply(self, auto_write); +} + +mp_obj_t shared_module_pixelmap_pixelmap_getitem(pixelmap_pixelmap_obj_t *self, mp_int_t i) { + mp_arg_validate_index_range(i, 0, self->len - 1, MP_QSTR_index); + mp_obj_t item = self->items[i]; + if (mp_obj_is_small_int(item)) { + return common_hal_adafruit_pixelbuf_pixelbuf_get_pixel(self->pixelbuf, MP_OBJ_SMALL_INT_VALUE(item)); + } else { + size_t len; + mp_obj_t *items; + mp_obj_tuple_get(item, &len, &items); + return common_hal_adafruit_pixelbuf_pixelbuf_get_pixel(self->pixelbuf, MP_OBJ_SMALL_INT_VALUE(items[0])); + } +} diff --git a/shared-module/_pixelmap/PixelMap.h b/shared-module/_pixelmap/PixelMap.h new file mode 100644 index 0000000000..192d6a4f9c --- /dev/null +++ b/shared-module/_pixelmap/PixelMap.h @@ -0,0 +1,39 @@ +/* + * This file is part of the CircuitPython project, https://github.com/adafruit/circuitpython + * + * The MIT License (MIT) + * + * Copyright (c) 2018 Rose Hooper + * 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 "shared-module/adafruit_pixelbuf/PixelBuf.h" + +typedef struct _pixelmap_pixelmap_obj { + mp_obj_base_t base; + mp_obj_t pixelbuf; + mp_obj_t indices; + size_t len; + mp_obj_t *items; + bool auto_write; +} pixelmap_pixelmap_obj_t; diff --git a/shared-module/_pixelmap/__init__.c b/shared-module/_pixelmap/__init__.c new file mode 100644 index 0000000000..e69de29bb2 diff --git a/shared-module/adafruit_pixelbuf/PixelBuf.c b/shared-module/adafruit_pixelbuf/PixelBuf.c index 5017ba2f2c..ca8f1c05b0 100644 --- a/shared-module/adafruit_pixelbuf/PixelBuf.c +++ b/shared-module/adafruit_pixelbuf/PixelBuf.c @@ -154,56 +154,55 @@ STATIC uint8_t _pixelbuf_get_as_uint8(mp_obj_t obj) { translate("can't convert %q to %q"), mp_obj_get_type_qstr(obj), MP_QSTR_int); } -STATIC color_u _pixelbuf_parse_color(pixelbuf_pixelbuf_obj_t *self, mp_obj_t color) { - color_u result; +static void pixelbuf_parse_color(pixelbuf_pixelbuf_obj_t *self, mp_obj_t color, uint8_t *r, uint8_t *g, uint8_t *b, uint8_t *w) { pixelbuf_byteorder_details_t *byteorder = &self->byteorder; // w is shared between white in NeoPixels and brightness in dotstars (so that DotStars can have // per-pixel brightness). Set the defaults here in case it isn't set below. if (byteorder->is_dotstar) { - result.w = 255; + *w = 255; } else { - result.w = 0; + *w = 0; } if (mp_obj_is_int(color) || mp_obj_is_float(color)) { mp_int_t value = mp_obj_is_int(color) ? mp_obj_get_int_truncated(color) : (mp_int_t)mp_obj_get_float(color); - result.r = value >> 16 & 0xff; - result.g = (value >> 8) & 0xff; - result.b = value & 0xff; + *r = value >> 16 & 0xff; + *g = (value >> 8) & 0xff; + *b = value & 0xff; } else { mp_obj_t *items; size_t len; mp_obj_get_array(color, &len, &items); mp_arg_validate_length_range(len, 3, 4, MP_QSTR_color); - result.r = _pixelbuf_get_as_uint8(items[PIXEL_R]); - result.g = _pixelbuf_get_as_uint8(items[PIXEL_G]); - result.b = _pixelbuf_get_as_uint8(items[PIXEL_B]); + *r = _pixelbuf_get_as_uint8(items[PIXEL_R]); + *g = _pixelbuf_get_as_uint8(items[PIXEL_G]); + *b = _pixelbuf_get_as_uint8(items[PIXEL_B]); if (len > 3) { if (mp_obj_is_float(items[PIXEL_W])) { - result.w = 255 * mp_obj_get_float(items[PIXEL_W]); + *w = 255 * mp_obj_get_float(items[PIXEL_W]); } else { - result.w = mp_obj_get_int_truncated(items[PIXEL_W]); + *w = mp_obj_get_int_truncated(items[PIXEL_W]); } - return result; + return; } } // Int colors can't set white directly so convert to white when all components are equal. // Also handles RGBW values assigned an RGB tuple. - if (!byteorder->is_dotstar && byteorder->bpp == 4 && byteorder->has_white && result.r == result.g && result.r == result.b) { - result.w = result.r; - result.r = 0; - result.g = 0; - result.b = 0; + if (!byteorder->is_dotstar && byteorder->bpp == 4 && byteorder->has_white && *r == *g && *r == *b) { + *w = *r; + *r = 0; + *g = 0; + *b = 0; } - return result; } -STATIC void _pixelbuf_set_pixel_color(pixelbuf_pixelbuf_obj_t *self, size_t index, color_u rgbw) { - uint8_t r = rgbw.r; - uint8_t g = rgbw.g; - uint8_t b = rgbw.b; - uint8_t w = rgbw.w; +void common_hal_adafruit_pixelbuf_pixelbuf_parse_color(mp_obj_t self_in, mp_obj_t color, uint8_t *r, uint8_t *g, uint8_t *b, uint8_t *w) { + pixelbuf_pixelbuf_obj_t *self = native_pixelbuf(self_in); + pixelbuf_parse_color(self, color, r, g, b, w); +} + +static void pixelbuf_set_pixel_color(pixelbuf_pixelbuf_obj_t *self, size_t index, uint8_t r, uint8_t g, uint8_t b, uint8_t w) { // DotStars don't have white, instead they have 5 bit brightness so pack it into w. Shift right // by three to leave the top five bits. if (self->bytes_per_pixel == 4 && self->byteorder.is_dotstar) { @@ -240,10 +239,18 @@ STATIC void _pixelbuf_set_pixel_color(pixelbuf_pixelbuf_obj_t *self, size_t inde scaled_buffer[rgbw_order->b] = (b * self->scaled_brightness) / 256; } } +void common_hal_adafruit_pixelbuf_pixelbuf_set_pixel_color(mp_obj_t self_in, size_t index, uint8_t r, uint8_t g, uint8_t b, uint8_t w) { + pixelbuf_pixelbuf_obj_t *self = native_pixelbuf(self_in); + pixelbuf_set_pixel_color(self, index, r, g, b, w); +} STATIC void _pixelbuf_set_pixel(pixelbuf_pixelbuf_obj_t *self, size_t index, mp_obj_t value) { - color_u rgbw = _pixelbuf_parse_color(self, value); - _pixelbuf_set_pixel_color(self, index, rgbw); + uint8_t r; + uint8_t g; + uint8_t b; + uint8_t w; + common_hal_adafruit_pixelbuf_pixelbuf_parse_color(self, value, &r, &g, &b, &w); + common_hal_adafruit_pixelbuf_pixelbuf_set_pixel_color(self, index, r, g, b, w); } void common_hal_adafruit_pixelbuf_pixelbuf_set_pixels(mp_obj_t self_in, size_t start, mp_int_t step, size_t slice_len, mp_obj_t *values, @@ -322,10 +329,14 @@ void common_hal_adafruit_pixelbuf_pixelbuf_show(mp_obj_t self_in) { void common_hal_adafruit_pixelbuf_pixelbuf_fill(mp_obj_t self_in, mp_obj_t fill_color) { pixelbuf_pixelbuf_obj_t *self = native_pixelbuf(self_in); - color_u rgbw = _pixelbuf_parse_color(self, fill_color); + uint8_t r; + uint8_t g; + uint8_t b; + uint8_t w; + common_hal_adafruit_pixelbuf_pixelbuf_parse_color(self, fill_color, &r, &g, &b, &w); for (size_t i = 0; i < self->pixel_count; i++) { - _pixelbuf_set_pixel_color(self, i, rgbw); + common_hal_adafruit_pixelbuf_pixelbuf_set_pixel_color(self, i, r, g, b, w); } if (self->auto_write) { common_hal_adafruit_pixelbuf_pixelbuf_show(self_in); diff --git a/shared-module/adafruit_pixelbuf/PixelBuf.h b/shared-module/adafruit_pixelbuf/PixelBuf.h index b526254f29..a4a753baa0 100644 --- a/shared-module/adafruit_pixelbuf/PixelBuf.h +++ b/shared-module/adafruit_pixelbuf/PixelBuf.h @@ -24,13 +24,11 @@ * THE SOFTWARE. */ +#pragma once #include "py/obj.h" #include "py/objarray.h" -#ifndef PIXELBUF_SHARED_MODULE_H -#define PIXELBUF_SHARED_MODULE_H - typedef struct { uint8_t r; uint8_t g; @@ -68,5 +66,3 @@ typedef struct { #define DOTSTAR_LED_START 0b11100000 #define DOTSTAR_LED_START_FULL_BRIGHT 0xFF - -#endif diff --git a/shared-module/bitmaptools/__init__.c b/shared-module/bitmaptools/__init__.c index 4c73d8fb8e..dbf5a9ef96 100644 --- a/shared-module/bitmaptools/__init__.c +++ b/shared-module/bitmaptools/__init__.c @@ -423,6 +423,8 @@ void common_hal_bitmaptools_draw_line(displayio_bitmap_t *destination, y0 = y1; y1 = temp; } + y0 = MAX(0, y0); // only draw inside bitmap + y1 = MIN(y1, destination->height - 1); for (y = y0; y < (y1 + 1); y++) { // write a horizontal line displayio_bitmap_write_pixel(destination, x0, y, value); } @@ -432,6 +434,8 @@ void common_hal_bitmaptools_draw_line(displayio_bitmap_t *destination, x0 = x1; x1 = temp; } + x0 = MAX(0, x0); // only draw inside bitmap + x1 = MIN(x1, destination->width - 1); for (x = x0; x < (x1 + 1); x++) { // write a horizontal line displayio_bitmap_write_pixel(destination, x, y0, value); } @@ -689,7 +693,7 @@ STATIC void fill_row(displayio_bitmap_t *bitmap, int swap, int16_t *luminance_da static void write_pixels(displayio_bitmap_t *bitmap, int y, bool *data) { if (bitmap->bits_per_value == 1) { uint32_t *pixel_data = (uint32_t *)(bitmap->data + bitmap->stride * y); - for (int i = 0; i < bitmap->stride; i++) { + for (int i = 0; i < bitmap->width; i++) { uint32_t p = 0; for (int j = 0; j < 32; j++) { p = (p << 1); diff --git a/shared-module/displayio/Bitmap.c b/shared-module/displayio/Bitmap.c index 676aec2186..dc82d04e05 100644 --- a/shared-module/displayio/Bitmap.c +++ b/shared-module/displayio/Bitmap.c @@ -30,12 +30,12 @@ #include "py/runtime.h" -enum { align_bits = 8 * sizeof(uint32_t) }; +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 - return (row_width + align_bits - 1) / align_bits; + return (row_width + ALIGN_BITS - 1) / ALIGN_BITS; } void common_hal_displayio_bitmap_construct(displayio_bitmap_t *self, uint32_t width, @@ -66,12 +66,12 @@ void common_hal_displayio_bitmap_construct_from_buffer(displayio_bitmap_t *self, self->x_shift = 0; // Used to divide the index by the number of pixels per word. Its used in a // shift which effectively divides by 2 ** x_shift. uint32_t power_of_two = 1; - while (power_of_two < align_bits / bits_per_value) { + while (power_of_two < ALIGN_BITS / bits_per_value) { self->x_shift++; power_of_two <<= 1; } - self->x_mask = (1 << self->x_shift) - 1; // Used as a modulus on the x value - self->bitmask = (1 << bits_per_value) - 1; + self->x_mask = (1u << self->x_shift) - 1u; // Used as a modulus on the x value + self->bitmask = (1u << bits_per_value) - 1u; self->dirty_area.x1 = 0; self->dirty_area.x2 = width; @@ -117,7 +117,7 @@ uint32_t common_hal_displayio_bitmap_get_pixel(displayio_bitmap_t *self, int16_t void displayio_bitmap_set_dirty_area(displayio_bitmap_t *self, const displayio_area_t *dirty_area) { if (self->read_only) { - mp_raise_RuntimeError(translate("Read-only object")); + mp_raise_RuntimeError(translate("Read-only")); } displayio_area_t area = *dirty_area; @@ -131,6 +131,11 @@ void displayio_bitmap_write_pixel(displayio_bitmap_t *self, int16_t x, int16_t y // Writes the color index value into a pixel position // Must update the dirty area separately + // Don't write if out of area + if (0 > x || x >= self->width || 0 > y || y >= self->height) { + return; + } + // Update one pixel of data int32_t row_start = y * self->stride; uint32_t bytes_per_value = self->bits_per_value / 8; diff --git a/shared-module/displayio/Display.c b/shared-module/displayio/Display.c index 9fd55fe19d..8367e23b59 100644 --- a/shared-module/displayio/Display.c +++ b/shared-module/displayio/Display.c @@ -136,12 +136,15 @@ void common_hal_displayio_display_construct(displayio_display_obj_t *self, // Set the group after initialization otherwise we may send pixels while we delay in // initialization. - common_hal_displayio_display_show(self, &circuitpython_splash); + common_hal_displayio_display_set_root_group(self, &circuitpython_splash); common_hal_displayio_display_set_auto_refresh(self, auto_refresh); } bool common_hal_displayio_display_show(displayio_display_obj_t *self, displayio_group_t *root_group) { - return displayio_display_core_show(&self->core, root_group); + if (root_group == NULL) { + root_group = &circuitpython_splash; + } + return displayio_display_core_set_root_group(&self->core, root_group); } uint16_t common_hal_displayio_display_get_width(displayio_display_obj_t *self) { @@ -206,6 +209,9 @@ mp_obj_t common_hal_displayio_display_get_bus(displayio_display_obj_t *self) { } mp_obj_t common_hal_displayio_display_get_root_group(displayio_display_obj_t *self) { + if (self->core.current_group == NULL) { + return mp_const_none; + } return self->core.current_group; } @@ -398,6 +404,14 @@ void common_hal_displayio_display_set_auto_refresh(displayio_display_obj_t *self self->auto_refresh = auto_refresh; } +mp_obj_t common_hal_displayio_display_set_root_group(displayio_display_obj_t *self, displayio_group_t *root_group) { + bool ok = displayio_display_core_set_root_group(&self->core, root_group); + if (!ok) { + mp_raise_ValueError(translate("Group already used")); + } + return mp_const_none; +} + void displayio_display_background(displayio_display_obj_t *self) { if (self->auto_refresh && (supervisor_ticks_ms64() - self->core.last_refresh) > self->native_ms_per_frame) { _refresh_display(self); @@ -421,7 +435,10 @@ 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); - common_hal_displayio_display_show(self, NULL); + circuitpython_splash.x = 0; // reset position in case someone moved it. + circuitpython_splash.y = 0; + supervisor_start_terminal(self->core.width, self->core.height); + common_hal_displayio_display_set_root_group(self, &circuitpython_splash); } void displayio_display_collect_ptrs(displayio_display_obj_t *self) { diff --git a/shared-module/displayio/Display.h b/shared-module/displayio/Display.h index f513a9d462..c60adc482f 100644 --- a/shared-module/displayio/Display.h +++ b/shared-module/displayio/Display.h @@ -64,7 +64,6 @@ typedef struct { void displayio_display_background(displayio_display_obj_t *self); void release_display(displayio_display_obj_t *self); void reset_display(displayio_display_obj_t *self); - void displayio_display_collect_ptrs(displayio_display_obj_t *self); #endif // MICROPY_INCLUDED_SHARED_MODULE_DISPLAYIO_DISPLAY_H diff --git a/shared-module/displayio/EPaperDisplay.c b/shared-module/displayio/EPaperDisplay.c index 0010d88d12..d876599650 100644 --- a/shared-module/displayio/EPaperDisplay.c +++ b/shared-module/displayio/EPaperDisplay.c @@ -103,7 +103,14 @@ void common_hal_displayio_epaperdisplay_construct(displayio_epaperdisplay_obj_t } bool common_hal_displayio_epaperdisplay_show(displayio_epaperdisplay_obj_t *self, displayio_group_t *root_group) { - return displayio_display_core_show(&self->core, root_group); + if (root_group == NULL) { + root_group = &circuitpython_splash; + } + return displayio_display_core_set_root_group(&self->core, root_group); +} + +bool common_hal_displayio_epaperdisplay_set_root_group(displayio_epaperdisplay_obj_t *self, displayio_group_t *root_group) { + return displayio_display_core_set_root_group(&self->core, root_group); } STATIC const displayio_area_t *displayio_epaperdisplay_get_refresh_areas(displayio_epaperdisplay_obj_t *self) { @@ -239,6 +246,12 @@ uint16_t common_hal_displayio_epaperdisplay_get_rotation(displayio_epaperdisplay return self->core.rotation; } +mp_obj_t common_hal_displayio_epaperdisplay_get_root_group(displayio_epaperdisplay_obj_t *self) { + if (self->core.current_group == NULL) { + return mp_const_none; + } + return self->core.current_group; +} STATIC bool displayio_epaperdisplay_refresh_area(displayio_epaperdisplay_obj_t *self, const displayio_area_t *area) { uint16_t buffer_size = 128; // In uint32_ts diff --git a/shared-module/displayio/Group.c b/shared-module/displayio/Group.c index ad45852379..7eec72404f 100644 --- a/shared-module/displayio/Group.c +++ b/shared-module/displayio/Group.c @@ -310,6 +310,7 @@ static void _remove_layer(displayio_group_t *self, size_t index) { self->members->items[index], &displayio_tilegrid_type); if (layer != MP_OBJ_NULL) { displayio_tilegrid_t *tilegrid = layer; + tilegrid->in_group = false; rendered_last_frame = displayio_tilegrid_get_previous_area(tilegrid, &layer_area); displayio_tilegrid_update_transform(tilegrid, NULL); } @@ -317,6 +318,7 @@ static void _remove_layer(displayio_group_t *self, size_t index) { self->members->items[index], &displayio_group_type); if (layer != MP_OBJ_NULL) { displayio_group_t *group = layer; + group->in_group = false; rendered_last_frame = displayio_group_get_previous_area(group, &layer_area); displayio_group_update_transform(group, NULL); } diff --git a/shared-module/displayio/I2CDisplay.c b/shared-module/displayio/I2CDisplay.c index 8fae5d31fd..f38e4d6296 100644 --- a/shared-module/displayio/I2CDisplay.c +++ b/shared-module/displayio/I2CDisplay.c @@ -54,6 +54,7 @@ void common_hal_displayio_i2cdisplay_construct(displayio_i2cdisplay_obj_t *self, // Probe the bus to see if a device acknowledges the given address. if (!common_hal_busio_i2c_probe(i2c, device_address)) { self->base.type = &mp_type_NoneType; + common_hal_displayio_i2cdisplay_deinit(self); mp_raise_ValueError_varg(translate("Unable to find I2C Display at %x"), device_address); } diff --git a/shared-module/displayio/display_core.c b/shared-module/displayio/display_core.c index 8b2f0bfdf8..c21d87316d 100644 --- a/shared-module/displayio/display_core.c +++ b/shared-module/displayio/display_core.c @@ -162,17 +162,10 @@ void displayio_display_core_set_rotation(displayio_display_core_t *self, } } -bool displayio_display_core_show(displayio_display_core_t *self, displayio_group_t *root_group) { +bool displayio_display_core_set_root_group(displayio_display_core_t *self, displayio_group_t *root_group) { - if (root_group == NULL) { // set the display to the REPL, reset REPL position and size - circuitpython_splash.in_group = false; - // force the circuit_python_splash out of any group (Note: could cause problems with the parent group) - circuitpython_splash.x = 0; // reset position in case someone moved it. - circuitpython_splash.y = 0; - - supervisor_start_terminal(self->width, self->height); - - root_group = &circuitpython_splash; + if (root_group == NULL) { + // Show nothing on the display } if (root_group == self->current_group) { return true; @@ -366,7 +359,10 @@ void displayio_display_core_collect_ptrs(displayio_display_core_t *self) { } bool displayio_display_core_fill_area(displayio_display_core_t *self, displayio_area_t *area, uint32_t *mask, uint32_t *buffer) { - return displayio_group_fill_area(self->current_group, &self->colorspace, area, mask, buffer); + if (self->current_group != NULL) { + return displayio_group_fill_area(self->current_group,&self->colorspace, area, mask, buffer); + } + return false; } bool displayio_display_core_clip_area(displayio_display_core_t *self, const displayio_area_t *area, displayio_area_t *clipped) { diff --git a/shared-module/displayio/display_core.h b/shared-module/displayio/display_core.h index 8c2ba21b5e..2167683a0d 100644 --- a/shared-module/displayio/display_core.h +++ b/shared-module/displayio/display_core.h @@ -61,7 +61,7 @@ void displayio_display_core_construct(displayio_display_core_t *self, mp_obj_t bus, uint16_t width, uint16_t height, uint16_t ram_width, uint16_t ram_height, int16_t colstart, int16_t rowstart, uint16_t rotation, uint16_t color_depth, bool grayscale, bool pixels_in_byte_share_row, uint8_t bytes_per_cell, bool reverse_pixels_in_byte, bool reverse_bytes_in_word); -bool displayio_display_core_show(displayio_display_core_t *self, displayio_group_t *root_group); +bool displayio_display_core_set_root_group(displayio_display_core_t *self, displayio_group_t *root_group); uint16_t displayio_display_core_get_width(displayio_display_core_t *self); uint16_t displayio_display_core_get_height(displayio_display_core_t *self); diff --git a/shared-module/dotenv/__init__.c b/shared-module/dotenv/__init__.c deleted file mode 100644 index ead7c6561b..0000000000 --- a/shared-module/dotenv/__init__.c +++ /dev/null @@ -1,312 +0,0 @@ -/* - * 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/misc.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)) { - byte *buf = m_new(byte, actual_len + 1); - dotenv_get_key(path, key, (char *)buf, actual_len); - buf[actual_len] = 0; - - mp_obj_str_t *o = m_new_obj(mp_obj_str_t); - o->base.type = &mp_type_str; - o->len = actual_len; - o->data = buf; - o->hash = qstr_compute_hash(buf, actual_len); - - return MP_OBJ_FROM_PTR(o); - } - 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/framebufferio/FramebufferDisplay.c b/shared-module/framebufferio/FramebufferDisplay.c index e2e7d11106..3d66370c04 100644 --- a/shared-module/framebufferio/FramebufferDisplay.c +++ b/shared-module/framebufferio/FramebufferDisplay.c @@ -102,7 +102,10 @@ void common_hal_framebufferio_framebufferdisplay_construct(framebufferio_framebu } bool common_hal_framebufferio_framebufferdisplay_show(framebufferio_framebufferdisplay_obj_t *self, displayio_group_t *root_group) { - return displayio_display_core_show(&self->core, root_group); + if (root_group == NULL) { + root_group = &circuitpython_splash; + } + return displayio_display_core_set_root_group(&self->core, root_group); } uint16_t common_hal_framebufferio_framebufferdisplay_get_width(framebufferio_framebufferdisplay_obj_t *self) { @@ -360,5 +363,16 @@ void framebufferio_framebufferdisplay_reset(framebufferio_framebufferdisplay_obj } mp_obj_t common_hal_framebufferio_framebufferdisplay_get_root_group(framebufferio_framebufferdisplay_obj_t *self) { + if (self->core.current_group == NULL) { + return mp_const_none; + } return self->core.current_group; } + +mp_obj_t common_hal_framebufferio_framebufferdisplay_set_root_group(framebufferio_framebufferdisplay_obj_t *self, displayio_group_t *root_group) { + bool ok = displayio_display_core_set_root_group(&self->core, root_group); + if (!ok) { + mp_raise_ValueError(translate("Group already used")); + } + return mp_const_none; +} diff --git a/shared-module/is31fl3741/FrameBuffer.c b/shared-module/is31fl3741/FrameBuffer.c index d795c0d5e7..07bd3324f9 100644 --- a/shared-module/is31fl3741/FrameBuffer.c +++ b/shared-module/is31fl3741/FrameBuffer.c @@ -172,7 +172,7 @@ void common_hal_is31fl3741_FrameBuffer_refresh(is31fl3741_FrameBuffer_obj_t *sel } else { color = (rsum << 16) + (gsum << 8) + bsum; } - common_hal_is31fl3741_draw_pixel(self->is31fl3741, x, y, color, self->mapping, self->height); + common_hal_is31fl3741_draw_pixel(self->is31fl3741, x, y, color, self->mapping, self->scale_height); } } } else { @@ -193,7 +193,7 @@ void common_hal_is31fl3741_FrameBuffer_refresh(is31fl3741_FrameBuffer_obj_t *sel color = *buffer; } - common_hal_is31fl3741_draw_pixel(self->is31fl3741, x, y, color, self->mapping, self->height); + common_hal_is31fl3741_draw_pixel(self->is31fl3741, x, y, color, self->mapping, self->scale_height); buffer++; } } else { diff --git a/shared-module/os/__init__.c b/shared-module/os/__init__.c index 200fcb2f61..4a4c02e636 100644 --- a/shared-module/os/__init__.c +++ b/shared-module/os/__init__.c @@ -36,10 +36,6 @@ #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. @@ -111,16 +107,6 @@ 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/dotenv/__init__.h b/shared-module/os/__init__.h similarity index 60% rename from shared-module/dotenv/__init__.h rename to shared-module/os/__init__.h index fb27233692..1b18a1f4b9 100644 --- a/shared-module/dotenv/__init__.h +++ b/shared-module/os/__init__.h @@ -24,13 +24,25 @@ * THE SOFTWARE. */ +#pragma once + +typedef enum { + GETENV_OK = 0, + GETENV_ERR_OPEN, + GETENV_ERR_UNICODE, + GETENV_ERR_LENGTH, + GETENV_ERR_NOT_FOUND, + GETENV_ERR_UNEXPECTED = 0xff00, // logical or'd with the byte value +} os_getenv_err_t; + // 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); +// If it fits, the return value is 0-terminated. The passed in buffer +// may be modified even if an error is returned. Allocation free. +// An error that is not 'open' or 'not found' is printed on the repl. +os_getenv_err_t common_hal_os_getenv_str(const char *key, char *value, size_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); +// Returns GETENV_OK and sets value to the read value. Returns +// GETENV_ERR_... if the value was not numeric. allocation-free. +// If any error code is returned, value is guaranteed not modified +// An error that is not 'open' or 'not found' is printed on the repl. +os_getenv_err_t common_hal_os_getenv_int(const char *key, mp_int_t *value); diff --git a/shared-module/os/getenv.c b/shared-module/os/getenv.c new file mode 100644 index 0000000000..870973c5d2 --- /dev/null +++ b/shared-module/os/getenv.c @@ -0,0 +1,431 @@ +/* + * 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. + */ + +// These functions are separate from __init__.c so that os.getenv() can be +// tested in the unix "coverage" build, without bringing in "our" os module + +#include +#include +#include + +#include "shared-bindings/os/__init__.h" +#include "shared-module/os/__init__.h" + +#include "py/gc.h" +#include "py/misc.h" +#include "py/mpstate.h" +#include "py/mpprint.h" +#include "py/objstr.h" +#include "py/parsenum.h" +#include "py/runtime.h" +#include "supervisor/filesystem.h" +#include "supervisor/memory.h" + +#define GETENV_PATH "/settings.toml" + +#include "extmod/vfs.h" +#include "extmod/vfs_fat.h" +typedef FIL file_arg; +STATIC bool open_file(const char *name, file_arg *active_file) { + #if defined(UNIX) + nlr_buf_t nlr; + if (nlr_push(&nlr) == 0) { + mp_obj_t file_obj = mp_call_function_2(MP_OBJ_FROM_PTR(&mp_builtin_open_obj), mp_obj_new_str(name, strlen(name)), MP_ROM_QSTR(MP_QSTR_rb)); + mp_arg_validate_type(file_obj, &mp_type_vfs_fat_fileio, MP_QSTR_file); + pyb_file_obj_t *file = MP_OBJ_TO_PTR(file_obj); + *active_file = file->fp; + nlr_pop(); + return true; + } else { + return false; + } + #else + FATFS *fs = filesystem_circuitpy(); + FRESULT result = f_open(fs, active_file, name, FA_READ); + return result == FR_OK; + #endif +} +STATIC void close_file(file_arg *active_file) { + // nothing +} +STATIC bool is_eof(file_arg *active_file) { + return f_eof(active_file); +} + +// Return 0 if there is no next character (EOF). +STATIC uint8_t get_next_byte(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_eof(file_arg *active_file) { + f_lseek(active_file, f_size(active_file)); +} + +// For a fixed buffer, record the required size rather than throwing +STATIC void vstr_add_byte_nonstd(vstr_t *vstr, byte b) { + if (!vstr->fixed_buf || vstr->alloc > vstr->len) { + vstr_add_byte(vstr, b); + } else { + vstr->len++; + } +} + +// For a fixed buffer, record the required size rather than throwing +STATIC void vstr_add_char_nonstd(vstr_t *vstr, unichar c) { + size_t ulen = + (c < 0x80) ? 1 : + (c < 0x800) ? 2 : + (c < 0x10000) ? 3 : 4; + if (!vstr->fixed_buf || vstr->alloc > vstr->len + ulen) { + vstr_add_char(vstr, c); + } else { + vstr->len += ulen; + } +} + +STATIC void next_line(file_arg *active_file) { + uint8_t character; + do { + character = get_next_byte(active_file); + } while (character != 0 && character != '\n'); +} + +// 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_byte(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. +// +// If result is true, the key matches and file pointer is pointing just after the "=". +// If the result is false, the key does NOT match and the file pointer is +// pointing at the start of the next line, if any +STATIC bool key_matches(file_arg *active_file, const char *key) { + uint8_t character; + character = consume_whitespace(active_file); + if (character == '[' || character == 0) { + seek_eof(active_file); + return false; + } + while (*key) { + if (character != *key++) { + // A character didn't match the key, so it's not a match + // If the non-matching char was not the end of the line, + // then consume the rest of the line + if (character != '\n') { + next_line(active_file); + } + return false; + } + character = get_next_byte(active_file); + } + // the next character could be whitespace; consume if necessary + if (unichar_isspace(character)) { + character = consume_whitespace(active_file); + } + // If we're not looking at the "=" then the key didn't match + if (character != '=') { + // A character didn't match the key, so it's not a match + // If the non-matching char was not the end of the line, + // then consume the rest of the line + if (character != '\n') { + next_line(active_file); + } + return false; + } + return true; +} + +STATIC os_getenv_err_t read_unicode_escape(file_arg *active_file, int sz, vstr_t *buf) { + char hex_buf[sz + 1]; + for (int i = 0; i < sz; i++) { + hex_buf[i] = get_next_byte(active_file); + } + hex_buf[sz] = 0; + char *end; + unsigned long c = strtoul(hex_buf, &end, 16); + if (end != &hex_buf[sz]) { + return GETENV_ERR_UNEXPECTED | *end; + } + if (c >= 0x110000) { + return GETENV_ERR_UNICODE; + } + vstr_add_char_nonstd(buf, c); + return GETENV_OK; +} + +// Read a quoted string +STATIC os_getenv_err_t read_string_value(file_arg *active_file, vstr_t *buf) { + while (true) { + int character = get_next_byte(active_file); + switch (character) { + case 0: + case '\n': + return GETENV_ERR_UNEXPECTED | character; + + case '"': + character = consume_whitespace(active_file); + switch (character) { + case '#': + next_line(active_file); + MP_FALLTHROUGH; + case 0: + case '\n': + return GETENV_OK; + default: + return GETENV_ERR_UNEXPECTED | character; + } + + case '\\': + character = get_next_byte(active_file); + switch (character) { + case 0: + case '\n': + return GETENV_ERR_UNEXPECTED | character; + case 'b': + character = '\b'; + break; + case 'r': + character = '\r'; + break; + case 'n': + character = '\n'; + break; + case 't': + character = '\t'; + break; + case 'v': + character = '\v'; + break; + case 'f': + character = '\f'; + break; + case 'U': + case 'u': { + int sz = (character == 'u') ? 4 : 8; + os_getenv_err_t res; + res = read_unicode_escape(active_file, sz, buf); + if (res != GETENV_OK) { + return res; + } + continue; + } + // default falls through, other escaped characters + // represent themselves + } + MP_FALLTHROUGH; + default: + vstr_add_byte_nonstd(buf, character); + } + } +} + +// Read a numeric value (non-quoted value) as a string +STATIC os_getenv_err_t read_bare_value(file_arg *active_file, vstr_t *buf, int first_character) { + int character = first_character; + while (true) { + switch (character) { + case 0: + case '\n': + return GETENV_OK; + case '#': + next_line(active_file); + return GETENV_OK; + default: + vstr_add_byte_nonstd(buf, character); + } + character = get_next_byte(active_file); + } +} + +STATIC mp_int_t read_value(file_arg *active_file, vstr_t *buf, bool *quoted) { + uint8_t character; + character = consume_whitespace(active_file); + *quoted = (character == '"'); + + if (*quoted) { + return read_string_value(active_file, buf); + } else { + return read_bare_value(active_file, buf, character); + } +} + +STATIC os_getenv_err_t os_getenv_vstr(const char *path, const char *key, vstr_t *buf, bool *quoted) { + file_arg active_file; + if (!open_file(path, &active_file)) { + return GETENV_ERR_OPEN; + } + + os_getenv_err_t result = GETENV_ERR_NOT_FOUND; + while (!is_eof(&active_file)) { + if (key_matches(&active_file, key)) { + result = read_value(&active_file, buf, quoted); + break; + } + } + close_file(&active_file); + return result; +} + +STATIC os_getenv_err_t os_getenv_buf_terminated(const char *key, char *value, size_t value_len, bool *quoted) { + vstr_t buf; + vstr_init_fixed_buf(&buf, value_len, value); + os_getenv_err_t result = os_getenv_vstr(GETENV_PATH, key, &buf, quoted); + + if (result == GETENV_OK) { + vstr_add_byte_nonstd(&buf, 0); + memcpy(value, buf.buf, MIN(buf.len, value_len)); + if (buf.len > value_len) { // this length includes trailing NUL + result = GETENV_ERR_LENGTH; + } + } + return result; +} + +STATIC void print_dont_raise(const mp_obj_type_t *exc_type, const compressed_string_t *fmt, ...) { + va_list argptr; + va_start(argptr,fmt); + mp_vcprintf(&mp_plat_print, fmt, argptr); + mp_printf(&mp_plat_print, "\n"); + va_end(argptr); +} + +STATIC void handle_getenv_error(os_getenv_err_t error, void (*handle)(const mp_obj_type_t *exc_type, const compressed_string_t *fmt, ...)) { + if (error == GETENV_OK) { + return; + } + if (error & GETENV_ERR_UNEXPECTED) { + byte character = (error & 0xff); + char buf[8]; + vstr_t vstr; + vstr_init_fixed_buf(&vstr, sizeof(buf), buf); + mp_print_t print = { .data = &vstr, .print_strn = (mp_print_strn_t)vstr_add_strn }; + + if (character) { + mp_str_print_quoted(&print, &character, 1, true); + } else { + mp_str_print_quoted(&print, (byte *)"EOF", 3, true); + } + handle(&mp_type_ValueError, translate("Invalid byte %.*s"), vstr.len, vstr.buf); + } else { + switch (error) { + case GETENV_ERR_OPEN: + handle(&mp_type_ValueError, translate("%S"), translate("File not found")); + break; + case GETENV_ERR_UNICODE: + handle(&mp_type_ValueError, translate("%S"), translate("Invalid unicode escape")); + break; + case GETENV_ERR_NOT_FOUND: + handle(&mp_type_ValueError, translate("%S"), translate("Key not found")); + break; + default: + handle(&mp_type_RuntimeError, translate("%S"), translate("Internal error")); + break; + } + } +} + +STATIC void common_hal_os_getenv_showerr(const char *key, os_getenv_err_t result) { + if (result != GETENV_OK && result != GETENV_ERR_OPEN && result != GETENV_ERR_NOT_FOUND) { + mp_cprintf(&mp_plat_print, translate("An error occurred while retrieving '%s':\n"), key); + handle_getenv_error(result, print_dont_raise); + } +} + +STATIC +os_getenv_err_t common_hal_os_getenv_str_inner(const char *key, char *value, size_t value_len) { + bool quoted; + os_getenv_err_t result = os_getenv_buf_terminated(key, value, value_len, "ed); + if (result == GETENV_OK && !quoted) { + result = GETENV_ERR_UNEXPECTED | value[0]; + } + return result; +} + +os_getenv_err_t common_hal_os_getenv_str(const char *key, char *value, size_t value_len) { + os_getenv_err_t result = common_hal_os_getenv_str_inner(key, value, value_len); + common_hal_os_getenv_showerr(key, result); + return result; +} + +mp_obj_t common_hal_os_getenv_path(const char *path, const char *key, mp_obj_t default_) { + vstr_t buf; + bool quoted; + + vstr_init(&buf, 64); + os_getenv_err_t result = os_getenv_vstr(path, key, &buf, "ed); + if (result == GETENV_ERR_NOT_FOUND || result == GETENV_ERR_OPEN) { + return default_; + } + handle_getenv_error(result, mp_raise_msg_varg); + + if (quoted) { + return mp_obj_new_str_from_vstr(&mp_type_str, &buf); + } else { + return mp_parse_num_integer(buf.buf, buf.len, 0, NULL); + } +} + +mp_obj_t common_hal_os_getenv(const char *key, mp_obj_t default_) { + return common_hal_os_getenv_path(GETENV_PATH, key, default_); +} + +STATIC os_getenv_err_t common_hal_os_getenv_int_inner(const char *key, mp_int_t *value) { + char buf[16]; + bool quoted; + os_getenv_err_t result = os_getenv_buf_terminated(key, buf, sizeof(buf), "ed); + if (result != GETENV_OK) { + return result; + } + if (quoted) { + return GETENV_ERR_UNEXPECTED | '"'; + } + char *end; + long num = strtol(buf, &end, 0); + while (unichar_isspace(*end)) { + end++; + } + if (end == buf || *end) { // If the whole buffer was not consumed it's an error + return GETENV_ERR_UNEXPECTED | *end; + } + *value = (mp_int_t)num; + return GETENV_OK; +} + +os_getenv_err_t common_hal_os_getenv_int(const char *key, mp_int_t *value) { + os_getenv_err_t result = common_hal_os_getenv_int_inner(key, value); + common_hal_os_getenv_showerr(key, result); + return result; +} diff --git a/shared-module/usb_hid/__init__.c b/shared-module/usb_hid/__init__.c index 99be84542f..11b87a78f1 100644 --- a/shared-module/usb_hid/__init__.c +++ b/shared-module/usb_hid/__init__.c @@ -220,9 +220,7 @@ bool common_hal_usb_hid_enable(const mp_obj_t devices, uint8_t boot_device) { } const mp_int_t num_devices = MP_OBJ_SMALL_INT_VALUE(mp_obj_len(devices)); - if (num_devices > MAX_HID_DEVICES) { - mp_raise_ValueError_varg(translate("No more than %d HID devices allowed"), MAX_HID_DEVICES); - } + mp_arg_validate_length_max(num_devices, MAX_HID_DEVICES, MP_QSTR_devices); num_hid_devices = num_devices; diff --git a/shared/netutils/dhcpserver.c b/shared/netutils/dhcpserver.c index 9db42b3fd9..d396a2ba56 100644 --- a/shared/netutils/dhcpserver.c +++ b/shared/netutils/dhcpserver.c @@ -33,7 +33,7 @@ #include "py/mperrno.h" #include "py/mphal.h" -#if MICROPY_PY_LWIP +#if LWIP_UDP #include "shared/netutils/dhcpserver.h" #include "lwip/udp.h" @@ -265,9 +265,9 @@ static void dhcp_server_process(void *arg, struct udp_pcb *upcb, struct pbuf *p, d->lease[yi].expiry = (mp_hal_ticks_ms() + DEFAULT_LEASE_TIME_S * 1000) >> 16; dhcp_msg.yiaddr[3] = DHCPS_BASE_IP + yi; opt_write_u8(&opt, DHCP_OPT_MSG_TYPE, DHCPACK); - printf("DHCPS: client connected: MAC=%02x:%02x:%02x:%02x:%02x:%02x IP=%u.%u.%u.%u\n", + LWIP_DEBUGF(DHCP_DEBUG, ("DHCPS: client connected: MAC=%02x:%02x:%02x:%02x:%02x:%02x IP=%u.%u.%u.%u\n", dhcp_msg.chaddr[0], dhcp_msg.chaddr[1], dhcp_msg.chaddr[2], dhcp_msg.chaddr[3], dhcp_msg.chaddr[4], dhcp_msg.chaddr[5], - dhcp_msg.yiaddr[0], dhcp_msg.yiaddr[1], dhcp_msg.yiaddr[2], dhcp_msg.yiaddr[3]); + dhcp_msg.yiaddr[0], dhcp_msg.yiaddr[1], dhcp_msg.yiaddr[2], dhcp_msg.yiaddr[3])); break; } diff --git a/shared/netutils/netutils.h b/shared/netutils/netutils.h index b23a78e5b8..3bb9212800 100644 --- a/shared/netutils/netutils.h +++ b/shared/netutils/netutils.h @@ -33,6 +33,8 @@ #define NETUTILS_TRACE_PAYLOAD (0x0002) #define NETUTILS_TRACE_NEWLINE (0x0004) +#include "py/runtime.h" + typedef enum _netutils_endian_t { NETUTILS_LITTLE, NETUTILS_BIG, diff --git a/supervisor/fatfs_port.h b/supervisor/fatfs.h similarity index 89% rename from supervisor/fatfs_port.h rename to supervisor/fatfs.h index e76ced524d..59226aae1c 100644 --- a/supervisor/fatfs_port.h +++ b/supervisor/fatfs.h @@ -24,11 +24,11 @@ * THE SOFTWARE. */ -#ifndef MICROPY_INCLUDED_SUPERVISOR_FATFS_PORT_H -#define MICROPY_INCLUDED_SUPERVISOR_FATFS_PORT_H +#ifndef MICROPY_INCLUDED_SUPERVISOR_FATFS_H +#define MICROPY_INCLUDED_SUPERVISOR_FATFS_H #include "lib/oofatfs/ff.h" void override_fattime(DWORD time); -#endif // MICROPY_INCLUDED_SUPERVISOR_FATFS_PORT_H +#endif // MICROPY_INCLUDED_SUPERVISOR_FATFS_H diff --git a/supervisor/messages/default.h b/supervisor/messages/default.h deleted file mode 100644 index 8cdd671b31..0000000000 --- a/supervisor/messages/default.h +++ /dev/null @@ -1,99 +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. - */ - -#ifndef MICROPY_SUPERVISOR_MESSAGES_DEFAULT_H -#define MICROPY_SUPERVISOR_MESSAGES_DEFAULT_H - -#ifndef MSG_OUTPUT_SUFFIX -#define MSG_OUTPUT_SUFFIX " output:\r\n" -#endif - -#ifndef MSG_NEWLINE -#define MSG_NEWLINE "\r\n" -#endif - -#ifndef MSG_AUTORELOAD_ON -#define MSG_AUTORELOAD_ON "Auto-reload is on. Simply save files over USB to run them or enter REPL to disable.\r\n" -#endif - -#ifndef MSG_AUTORELOAD_OFF -#define MSG_AUTORELOAD_OFF "Auto-reload is off.\r\n" -#endif - -#ifndef MSG_SAFE_MODE_ON -#define MSG_SAFE_MODE_ON "Running in safe mode! Auto-reload is off.\r\n" -#endif - -#ifndef MSG_SAFE_MODE_NO_MAIN -#define MSG_SAFE_MODE_NO_MAIN "Running in safe mode! Not running saved code.\r\n" -#endif - -#ifndef MSG_SAFE_MODE_USER_REQUESTED -#define MSG_SAFE_MODE_USER_REQUESTED "You requested starting safe mode by " -#endif - -#ifndef MSG_SAFE_MODE_USER_EXIT -#define MSG_SAFE_MODE_USER_EXIT "To exit, please reset the board without " -#endif - -#ifndef MSG_BAD_SAFE_MODE -#define MSG_BAD_SAFE_MODE "You are running in safe mode which means something really bad happened." -#endif - -#ifndef MSG_SAFE_MODE_CRASH -#define MSG_SAFE_MODE_CRASH "Looks like our core CircuitPython code crashed hard. Whoops!" -#endif - -#ifndef MSG_SAFE_MODE_FILE_ISSUE -#define MSG_SAFE_MODE_FILE_ISSUE "Please file an issue here with the contents of your CIRCUITPY drive:" -#endif - -#ifndef MSG_SAFE_MODE_ISSUE_LINK -#define MSG_SAFE_MODE_ISSUE_LINK "https://github.com/adafruit/circuitpython/issues" -#endif - -#ifndef MSG_SAFE_MODE_BROWN_OUT_LINE_1 -#define MSG_SAFE_MODE_BROWN_OUT_LINE_1 "The microcontroller's power dipped. Please make sure your power supply provides" -#endif - -#ifndef MSG_SAFE_MODE_BROWN_OUT_LINE_2 -#define MSG_SAFE_MODE_BROWN_OUT_LINE_2 "enough power for the whole circuit and press reset (after ejecting CIRCUITPY)." -#endif - -#ifndef MSG_WAIT_BEFORE_REPL -#define MSG_WAIT_BEFORE_REPL "Press any key to enter the REPL. Use CTRL-D to reload." -#endif - -// Be careful, some tools depend on this. -#ifndef MSG_SOFT_REBOOT -#define MSG_SOFT_REBOOT "soft reboot" -#endif - -#ifndef MSG_DOUBLE_FILE_EXTENSION -#define MSG_DOUBLE_FILE_EXTENSION "WARNING: Your code filename has two extensions\r\n" -#endif - -#endif // MICROPY_SUPERVISOR_MESSAGES_DEFAULT_H diff --git a/supervisor/shared/bluetooth/file_transfer.c b/supervisor/shared/bluetooth/file_transfer.c index 159c639e4d..ae24c29899 100644 --- a/supervisor/shared/bluetooth/file_transfer.c +++ b/supervisor/shared/bluetooth/file_transfer.c @@ -42,7 +42,7 @@ #include "common-hal/_bleio/__init__.h" -#include "supervisor/fatfs_port.h" +#include "supervisor/fatfs.h" #include "supervisor/filesystem.h" #include "supervisor/shared/reload.h" #include "supervisor/shared/bluetooth/file_transfer.h" diff --git a/supervisor/shared/bluetooth/serial.c b/supervisor/shared/bluetooth/serial.c index 2edf3c784f..a5f4d776b3 100644 --- a/supervisor/shared/bluetooth/serial.c +++ b/supervisor/shared/bluetooth/serial.c @@ -146,7 +146,8 @@ void supervisor_start_bluetooth_serial(void) { &supervisor_ble_circuitpython_rx_characteristic, 0.1f, (uint8_t *)_incoming, sizeof(_incoming) * sizeof(uint32_t), - &rx_static_handler_entry); + &rx_static_handler_entry, + true /* watch for interrupt character */); _enabled = true; } diff --git a/supervisor/shared/external_flash/external_flash.c b/supervisor/shared/external_flash/external_flash.c index 7da45fdc99..141ad7e5f8 100644 --- a/supervisor/shared/external_flash/external_flash.c +++ b/supervisor/shared/external_flash/external_flash.c @@ -58,6 +58,9 @@ static supervisor_allocation *supervisor_cache = NULL; // Wait until both the write enable and write in progress bits have cleared. static bool wait_for_flash_ready(void) { + if (flash_device == NULL) { + return false; + } bool ok = true; // Both the write enable and write in progress bits should be low. if (flash_device->no_ready_bit) { @@ -192,6 +195,9 @@ static bool copy_block(uint32_t src_address, uint32_t dest_address) { return true; } +#define READ_JEDEC_ID_RETRY_COUNT (100) + +// If this fails, flash_device will remain NULL. void supervisor_flash_init(void) { if (flash_device != NULL) { return; @@ -220,7 +226,11 @@ void supervisor_flash_init(void) { #else // The response will be 0xff if the flash needs more time to start up. uint8_t jedec_id_response[3] = {0xff, 0xff, 0xff}; - while (jedec_id_response[0] == 0xff) { + // Response can also be 0x00 if reading before ready. When compiled with `-O2`, typically + // takes three tries to read on Grand Central M4. + + size_t count = READ_JEDEC_ID_RETRY_COUNT; + while ((count-- > 0) && (jedec_id_response[0] == 0xff || jedec_id_response[2] == 0x00)) { spi_flash_read_command(CMD_READ_JEDEC_ID, jedec_id_response, 3); } for (uint8_t i = 0; i < EXTERNAL_FLASH_DEVICE_COUNT; i++) { @@ -234,6 +244,7 @@ void supervisor_flash_init(void) { } #endif if (flash_device == NULL) { + // Flash did not respond. Give up. return; } @@ -293,6 +304,9 @@ uint32_t supervisor_flash_get_block_size(void) { // The total number of available blocks. uint32_t supervisor_flash_get_block_count(void) { + if (flash_device == NULL) { + return 0; + } // We subtract one erase sector size because we may use it as a staging area // for writes. return (flash_device->total_size - SPI_FLASH_ERASE_SIZE) / FILESYSTEM_BLOCK_SIZE; diff --git a/supervisor/shared/external_flash/spi_flash.c b/supervisor/shared/external_flash/spi_flash.c index b47508e051..abff343713 100644 --- a/supervisor/shared/external_flash/spi_flash.c +++ b/supervisor/shared/external_flash/spi_flash.c @@ -151,6 +151,7 @@ void spi_flash_init(void) { supervisor_flash_spi_bus.base.type = &busio_spi_type; common_hal_busio_spi_construct(&supervisor_flash_spi_bus, SPI_FLASH_SCK_PIN, SPI_FLASH_MOSI_PIN, SPI_FLASH_MISO_PIN, false); common_hal_busio_spi_never_reset(&supervisor_flash_spi_bus); + common_hal_busio_spi_configure(&supervisor_flash_spi_bus, SPI_FLASH_MAX_BAUDRATE, 0, 0, 8); return; } diff --git a/ports/espressif/fatfs_port.c b/supervisor/shared/fatfs.c similarity index 74% rename from ports/espressif/fatfs_port.c rename to supervisor/shared/fatfs.c index 38c2d923b8..f1452bf567 100644 --- a/ports/espressif/fatfs_port.c +++ b/supervisor/shared/fatfs.c @@ -3,7 +3,7 @@ * * The MIT License (MIT) * - * SPDX-FileCopyrightText: Copyright (c) 2013, 2014 Damien P. George + * 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,12 +24,15 @@ * THE SOFTWARE. */ +#include "supervisor/fatfs.h" + #include "py/runtime.h" #include "lib/oofatfs/ff.h" -#include "shared/timeutils/timeutils.h" +#include "shared-bindings/microcontroller/Processor.h" +#include "shared-bindings/os/__init__.h" #include "shared-bindings/rtc/RTC.h" #include "shared-bindings/time/__init__.h" -#include "supervisor/fatfs_port.h" +#include "shared/timeutils/timeutils.h" DWORD _time_override = 0; DWORD get_fattime(void) { @@ -49,3 +52,17 @@ DWORD get_fattime(void) { void override_fattime(DWORD time) { _time_override = time; } + +DWORD make_volid(void) { + DWORD result; + if (!common_hal_os_urandom((uint8_t *)&result, sizeof(result))) { + #if CIRCUITPY_MICROCONTROLLER && COMMON_HAL_MCU_PROCESSOR_UID_LENGTH >= 4 + uint8_t raw_id[COMMON_HAL_MCU_PROCESSOR_UID_LENGTH]; + common_hal_mcu_processor_get_uid(raw_id); + memcpy(&result, raw_id, sizeof(result)); + #else + result = (DWORD)common_hal_time_monotonic_ns(); + #endif + } + return result; +} diff --git a/supervisor/shared/filesystem.c b/supervisor/shared/filesystem.c index 01aba0a9ac..1eab59c384 100644 --- a/supervisor/shared/filesystem.c +++ b/supervisor/shared/filesystem.c @@ -129,6 +129,9 @@ bool filesystem_init(bool create_allowed, bool force_create) { make_empty_file(&vfs_fat->fatfs, "/.metadata_never_index"); make_empty_file(&vfs_fat->fatfs, "/.Trashes"); make_empty_file(&vfs_fat->fatfs, "/.fseventsd/no_log"); + #if CIRCUITPY_OS_GETENV + make_empty_file(&vfs_fat->fatfs, "/settings.toml"); + #endif // make a sample code.py file make_sample_code_file(&vfs_fat->fatfs); diff --git a/supervisor/shared/micropython.c b/supervisor/shared/micropython.c index ebc0aef2d1..5ee0061544 100644 --- a/supervisor/shared/micropython.c +++ b/supervisor/shared/micropython.c @@ -62,8 +62,15 @@ void mp_hal_stdout_tx_strn(const char *str, size_t len) { #ifdef CIRCUITPY_BOOT_OUTPUT_FILE if (boot_output != NULL) { // Ensure boot_out.txt is capped at 1 filesystem block and ends with a newline - if (len + boot_output->len > 508) { - vstr_add_str(boot_output, "...\n"); + #define TRUNCATED translate("[truncated due to length]") + size_t truncated_message_len = decompress_length(TRUNCATED); + size_t maxlen = 512 - truncated_message_len; // includes trailing '\0' so we do not need to account for trailing newline '\n' in vstr_add_byte + if (len + boot_output->len > maxlen) { + size_t remaining_len = maxlen - boot_output->len; + vstr_add_strn(boot_output, str, remaining_len); + char buf[truncated_message_len]; + vstr_add_str(boot_output, decompress(TRUNCATED, buf)); + vstr_add_byte(boot_output, '\n'); boot_output = NULL; } else { vstr_add_strn(boot_output, str, len); diff --git a/supervisor/shared/reload.c b/supervisor/shared/reload.c index e1ae2e6764..4e351704f8 100644 --- a/supervisor/shared/reload.c +++ b/supervisor/shared/reload.c @@ -28,6 +28,7 @@ #include "py/mphal.h" #include "py/mpstate.h" +#include "supervisor/port.h" #include "supervisor/shared/reload.h" #include "supervisor/shared/tick.h" @@ -52,6 +53,7 @@ void reload_initiate(supervisor_run_reason_t run_reason) { MP_STATE_VM(sched_state) = MP_SCHED_PENDING; } #endif + port_wake_main_task(); } void autoreload_reset() { diff --git a/supervisor/shared/safe_mode.c b/supervisor/shared/safe_mode.c index d23b78d624..5112b17ebf 100644 --- a/supervisor/shared/safe_mode.c +++ b/supervisor/shared/safe_mode.c @@ -43,20 +43,28 @@ #define SAFE_MODE_DATA_GUARD 0xad0000af #define SAFE_MODE_DATA_GUARD_MASK 0xff0000ff -static safe_mode_t current_safe_mode; +static safe_mode_t _safe_mode; + +safe_mode_t get_safe_mode(void) { + return _safe_mode; +} + +void set_safe_mode(safe_mode_t safe_mode) { + _safe_mode = safe_mode; +} safe_mode_t wait_for_safe_mode_reset(void) { uint32_t reset_state = port_get_saved_word(); - safe_mode_t safe_mode = NO_SAFE_MODE; + safe_mode_t safe_mode = SAFE_MODE_NONE; if ((reset_state & SAFE_MODE_DATA_GUARD_MASK) == SAFE_MODE_DATA_GUARD) { safe_mode = (reset_state & ~SAFE_MODE_DATA_GUARD_MASK) >> 8; } - if (safe_mode != NO_SAFE_MODE) { + if (safe_mode != SAFE_MODE_NONE) { port_set_saved_word(SAFE_MODE_DATA_GUARD); - current_safe_mode = safe_mode; + _safe_mode = safe_mode; return safe_mode; } else { - current_safe_mode = 0; + _safe_mode = SAFE_MODE_NONE; } const mcu_reset_reason_t reset_reason = common_hal_mcu_processor_get_reset_reason(); @@ -64,12 +72,12 @@ safe_mode_t wait_for_safe_mode_reset(void) { reset_reason != RESET_REASON_RESET_PIN && reset_reason != RESET_REASON_UNKNOWN && reset_reason != RESET_REASON_SOFTWARE) { - return NO_SAFE_MODE; + return SAFE_MODE_NONE; } - #ifdef CIRCUITPY_SKIP_SAFE_MODE_WAIT - return NO_SAFE_MODE; + #if CIRCUITPY_SKIP_SAFE_MODE_WAIT + return SAFE_MODE_NONE; #endif - port_set_saved_word(SAFE_MODE_DATA_GUARD | (MANUAL_SAFE_MODE << 8)); + port_set_saved_word(SAFE_MODE_DATA_GUARD | (SAFE_MODE_USER << 8)); // Wait for a while to allow for reset. #if CIRCUITPY_STATUS_LED @@ -106,11 +114,11 @@ safe_mode_t wait_for_safe_mode_reset(void) { status_led_deinit(); #endif if (boot_in_safe_mode) { - return USER_SAFE_MODE; + return SAFE_MODE_USER; } // Restore the original state of the saved word if no reset occured during our wait period. port_set_saved_word(reset_state); - return NO_SAFE_MODE; + return SAFE_MODE_NONE; } void safe_mode_on_next_reset(safe_mode_t reason) { @@ -119,7 +127,7 @@ void safe_mode_on_next_reset(safe_mode_t reason) { // Don't inline this so it's easy to break on it from GDB. void __attribute__((noinline,)) reset_into_safe_mode(safe_mode_t reason) { - if (current_safe_mode > BROWNOUT && reason > BROWNOUT) { + if (_safe_mode > SAFE_MODE_BROWNOUT && reason > SAFE_MODE_BROWNOUT) { while (true) { // This very bad because it means running in safe mode didn't save us. Only ignore brownout // because it may be due to a switch bouncing. @@ -133,105 +141,95 @@ void __attribute__((noinline,)) reset_into_safe_mode(safe_mode_t reason) { void print_safe_mode_message(safe_mode_t reason) { - if (reason == NO_SAFE_MODE) { + if (reason == SAFE_MODE_NONE) { return; } - serial_write("\r\n"); - serial_write_compressed(translate("You are in safe mode because:\n")); + serial_write_compressed(translate("\nYou are in safe mode because:\n")); const compressed_string_t *message = NULL; // First check for safe mode reasons that do not necessarily reflect bugs. switch (reason) { - case USER_SAFE_MODE: + case SAFE_MODE_BROWNOUT: + message = translate("The power dipped. Make sure you are providing enough power."); + break; + case SAFE_MODE_USER: #if defined(BOARD_USER_SAFE_MODE_ACTION) message = BOARD_USER_SAFE_MODE_ACTION; #elif defined(CIRCUITPY_BOOT_BUTTON) - message = translate("The BOOT button was pressed at start up.\n"); - #endif - #if defined(BOARD_USER_SAFE_MODE_ACTION) || defined(CIRCUITPY_BOOT_BUTTON) - // Output a user safe mode string if it's set. - serial_write_compressed(message); - message = translate("To exit, please reset the board without requesting safe mode."); - // The final piece is printed below. + message = translate("You pressed the BOOT button at start up"); + #else + message = translate("You pressed the reset button during boot."); #endif break; - case MANUAL_SAFE_MODE: - message = translate("You pressed the reset button during boot. Press again to exit safe mode."); + case SAFE_MODE_NO_CIRCUITPY: + message = translate("CIRCUITPY drive could not be found or created."); break; - case PROGRAMMATIC_SAFE_MODE: - message = translate("The `microcontroller` module was used to boot into safe mode. Press reset to exit safe mode."); + case SAFE_MODE_PROGRAMMATIC: + message = translate("The `microcontroller` module was used to boot into safe mode."); break; - case BROWNOUT: - message = translate("The microcontroller's power dipped. Make sure your power supply provides\nenough power for the whole circuit and press reset (after ejecting CIRCUITPY)."); + #if CIRCUITPY_SAFEMODE_PY + case SAFE_MODE_SAFEMODE_PY_ERROR: + message = translate("Error in safemode.py."); break; - case USB_TOO_MANY_ENDPOINTS: + #endif + case SAFE_MODE_STACK_OVERFLOW: + message = translate("Heap was corrupted because the stack was too small. Increase stack size."); + break; + case SAFE_MODE_USB_TOO_MANY_ENDPOINTS: message = translate("USB devices need more endpoints than are available."); break; - case USB_TOO_MANY_INTERFACE_NAMES: + case SAFE_MODE_USB_TOO_MANY_INTERFACE_NAMES: message = translate("USB devices specify too many interface names."); break; - case USB_BOOT_DEVICE_NOT_INTERFACE_ZERO: - message = translate("Boot device must be first device (interface #0)."); + case SAFE_MODE_USB_BOOT_DEVICE_NOT_INTERFACE_ZERO: + message = translate("Boot device must be first (interface #0)."); break; - case WATCHDOG_RESET: + case SAFE_MODE_WATCHDOG: message = translate("Internal watchdog timer expired."); break; - case NO_CIRCUITPY: - message = translate("CIRCUITPY drive could not be found or created."); - break; default: break; } if (message) { + // Non-crash safe mode. serial_write_compressed(message); - serial_write("\r\n"); - return; + } else { + // Something worse happened. + serial_write_compressed(translate("CircuitPython core code crashed hard. Whoops!\n")); + switch (reason) { + case SAFE_MODE_GC_ALLOC_OUTSIDE_VM: + message = translate("Heap allocation when VM not running."); + break; + case SAFE_MODE_FLASH_WRITE_FAIL: + message = translate("Failed to write internal flash."); + break; + case SAFE_MODE_HARD_FAULT: + message = translate("Fault detected by hardware."); + break; + case SAFE_MODE_INTERRUPT_ERROR: + message = translate("Interrupt error."); + break; + case SAFE_MODE_NLR_JUMP_FAIL: + message = translate("NLR jump failed. Likely memory corruption."); + break; + case SAFE_MODE_NO_HEAP: + message = translate("Unable to allocate the heap."); + break; + case SAFE_MODE_SDK_FATAL_ERROR: + message = translate("Third-party firmware fatal error."); + break; + default: + message = translate("Unknown reason."); + break; + } + serial_write_compressed(message); + serial_write_compressed(translate("\nPlease file an issue with your program at https://github.com/adafruit/circuitpython/issues.")); } - // Something worse happened. - - serial_write_compressed(translate("CircuitPython core code crashed hard. Whoops!\n")); - - switch (reason) { - case HARD_CRASH: - message = translate("Crash into the HardFault_Handler."); - break; - case MICROPY_NLR_JUMP_FAIL: - message = translate("NLR jump failed. Likely memory corruption."); - break; - case MICROPY_FATAL_ERROR: - message = translate("Fatal error."); - break; - case NO_HEAP: - message = translate("CircuitPython was unable to allocate the heap."); - break; - case HEAP_OVERWRITTEN: - message = translate("The CircuitPython heap was corrupted because the stack was too small.\nIncrease the stack size if you know how. If not:"); - break; - case GC_ALLOC_OUTSIDE_VM: - message = translate("Attempted heap allocation when VM not running."); - break; - #ifdef SOFTDEVICE_PRESENT - // defined in ports/nrf/bluetooth/bluetooth_common.mk - // will print "Unknown reason" if somehow encountered on other ports - case NORDIC_SOFT_DEVICE_ASSERT: - message = translate("Nordic system firmware failure assertion."); - break; - #endif - case FLASH_WRITE_FAIL: - message = translate("Failed to write internal flash."); - break; - case MEM_MANAGE: - message = translate("Invalid memory access."); - break; - default: - message = translate("Unknown reason."); - break; - } - serial_write_compressed(message); - serial_write_compressed(translate("\nPlease file an issue with the contents of your CIRCUITPY drive at \nhttps://github.com/adafruit/circuitpython/issues\n")); + // Always tell user how to get out of safe mode. + serial_write_compressed(translate("\nPress reset to exit safe mode.\n")); } diff --git a/supervisor/shared/safe_mode.h b/supervisor/shared/safe_mode.h index 0c8d018bfe..005488552e 100644 --- a/supervisor/shared/safe_mode.h +++ b/supervisor/shared/safe_mode.h @@ -30,27 +30,32 @@ #include "py/mpconfig.h" typedef enum { - NO_SAFE_MODE = 0, - BROWNOUT, - HARD_CRASH, - USER_SAFE_MODE, - HEAP_OVERWRITTEN, - MANUAL_SAFE_MODE, - MICROPY_NLR_JUMP_FAIL, - MICROPY_FATAL_ERROR, - GC_ALLOC_OUTSIDE_VM, - PROGRAMMATIC_SAFE_MODE, - NORDIC_SOFT_DEVICE_ASSERT, - FLASH_WRITE_FAIL, - MEM_MANAGE, - WATCHDOG_RESET, - USB_TOO_MANY_ENDPOINTS, - USB_TOO_MANY_INTERFACE_NAMES, - USB_BOOT_DEVICE_NOT_INTERFACE_ZERO, - NO_HEAP, - NO_CIRCUITPY, + SAFE_MODE_NONE = 0, + // BROWNOUT should be lowest after SAFE_MODE_NONE. + SAFE_MODE_BROWNOUT, + // alphabetical from here down + SAFE_MODE_FLASH_WRITE_FAIL, + SAFE_MODE_GC_ALLOC_OUTSIDE_VM, + SAFE_MODE_HARD_FAULT, + SAFE_MODE_INTERRUPT_ERROR, + SAFE_MODE_MANUAL, + SAFE_MODE_NLR_JUMP_FAIL, + SAFE_MODE_NO_CIRCUITPY, + SAFE_MODE_NO_HEAP, + SAFE_MODE_PROGRAMMATIC, + SAFE_MODE_SAFEMODE_PY_ERROR, + SAFE_MODE_SDK_FATAL_ERROR, + SAFE_MODE_STACK_OVERFLOW, + SAFE_MODE_USB_BOOT_DEVICE_NOT_INTERFACE_ZERO, + SAFE_MODE_USB_TOO_MANY_ENDPOINTS, + SAFE_MODE_USB_TOO_MANY_INTERFACE_NAMES, + SAFE_MODE_USER, + SAFE_MODE_WATCHDOG, } safe_mode_t; +safe_mode_t get_safe_mode(void); +void set_safe_mode(safe_mode_t safe_mode); + safe_mode_t wait_for_safe_mode_reset(void); void safe_mode_on_next_reset(safe_mode_t reason); diff --git a/supervisor/shared/stack.c b/supervisor/shared/stack.c index fa8d019fea..be97cee234 100644 --- a/supervisor/shared/stack.c +++ b/supervisor/shared/stack.c @@ -74,7 +74,7 @@ inline bool stack_ok(void) { inline void assert_heap_ok(void) { if (!stack_ok()) { - reset_into_safe_mode(HEAP_OVERWRITTEN); + reset_into_safe_mode(SAFE_MODE_STACK_OVERFLOW); } } diff --git a/supervisor/shared/translate/translate.c b/supervisor/shared/translate/translate.c index ae6c7524e5..b07aa584ca 100644 --- a/supervisor/shared/translate/translate.c +++ b/supervisor/shared/translate/translate.c @@ -57,6 +57,9 @@ STATIC void get_word(int n, const mchar_t **pos, const mchar_t **end) { } STATIC int put_utf8(char *buf, int u) { + if (u >= translation_offstart) { + u += translation_offset; + } if (u <= 0x7f) { *buf = u; return 1; diff --git a/supervisor/shared/usb/usb_desc.c b/supervisor/shared/usb/usb_desc.c index fa4cf9607e..e7cffee351 100644 --- a/supervisor/shared/usb/usb_desc.c +++ b/supervisor/shared/usb/usb_desc.c @@ -228,7 +228,7 @@ static void usb_build_configuration_descriptor(void) { if (usb_hid_boot_device() > 0 && descriptor_counts.current_interface > 0) { // Hosts using boot devices generally to expect them to be at interface zero, // and will not work properly otherwise. - reset_into_safe_mode(USB_BOOT_DEVICE_NOT_INTERFACE_ZERO); + reset_into_safe_mode(SAFE_MODE_USB_BOOT_DEVICE_NOT_INTERFACE_ZERO); } descriptor_buf_remaining += usb_hid_add_descriptor( descriptor_buf_remaining, &descriptor_counts, ¤t_interface_string, @@ -258,14 +258,14 @@ static void usb_build_configuration_descriptor(void) { if (descriptor_counts.current_endpoint > USB_NUM_ENDPOINT_PAIRS || descriptor_counts.num_in_endpoints > USB_NUM_IN_ENDPOINTS || descriptor_counts.num_out_endpoints > USB_NUM_OUT_ENDPOINTS) { - reset_into_safe_mode(USB_TOO_MANY_ENDPOINTS); + reset_into_safe_mode(SAFE_MODE_USB_TOO_MANY_ENDPOINTS); } } // str must not be on the heap. void usb_add_interface_string(uint8_t interface_string_index, const char str[]) { if (interface_string_index > MAX_INTERFACE_STRINGS) { - reset_into_safe_mode(USB_TOO_MANY_INTERFACE_NAMES); + reset_into_safe_mode(SAFE_MODE_USB_TOO_MANY_INTERFACE_NAMES); } collected_interface_strings[interface_string_index].char_str = str; diff --git a/supervisor/shared/web_workflow/static/directory.js b/supervisor/shared/web_workflow/static/directory.js index c1d934c1a8..a89d5e5602 100644 --- a/supervisor/shared/web_workflow/static/directory.js +++ b/supervisor/shared/web_workflow/static/directory.js @@ -95,7 +95,7 @@ async function refresh_list() { if (f.directory) { icon = "📁"; } else if(f.name.endsWith(".txt") || - f.name.endsWith(".env") || + f.name.endsWith(".toml") || f.name.endsWith(".py") || f.name.endsWith(".js") || f.name.endsWith(".json")) { diff --git a/supervisor/shared/web_workflow/static/welcome.html b/supervisor/shared/web_workflow/static/welcome.html index e773bb6a2e..efbb30e312 100644 --- a/supervisor/shared/web_workflow/static/welcome.html +++ b/supervisor/shared/web_workflow/static/welcome.html @@ -12,7 +12,7 @@

 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.

+

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 /settings.toml. Provide the password when the browser prompts for it. Leave the username blank.

Device Info:

diff --git a/supervisor/shared/web_workflow/web_workflow.c b/supervisor/shared/web_workflow/web_workflow.c index 3f0b9ad8f7..97530b970b 100644 --- a/supervisor/shared/web_workflow/web_workflow.c +++ b/supervisor/shared/web_workflow/web_workflow.c @@ -24,18 +24,20 @@ * THE SOFTWARE. */ +#include #include #include "extmod/vfs.h" #include "extmod/vfs_fat.h" #include "genhdr/mpversion.h" +#include "py/mperrno.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/fatfs.h" #include "supervisor/filesystem.h" #include "supervisor/port.h" #include "supervisor/shared/reload.h" @@ -47,8 +49,12 @@ #include "shared-bindings/hashlib/__init__.h" #include "shared-bindings/hashlib/Hash.h" + +#if CIRCUITPY_MDNS #include "shared-bindings/mdns/RemoteService.h" #include "shared-bindings/mdns/Server.h" +#endif + #include "shared-bindings/microcontroller/Processor.h" #include "shared-bindings/socketpool/__init__.h" #include "shared-bindings/socketpool/Socket.h" @@ -58,15 +64,10 @@ #include "shared-bindings/wifi/__init__.h" #endif -#if CIRCUITPY_DOTENV -#include "shared-module/dotenv/__init__.h" +#if CIRCUITPY_OS_GETENV +#include "shared-module/os/__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, @@ -95,6 +96,7 @@ typedef struct { bool expect; bool json; bool websocket; + bool new_socket; uint32_t websocket_version; // RFC6455 for websockets says this header should be 24 base64 characters long. char websocket_key[24 + 1]; @@ -109,8 +111,11 @@ static uint32_t _last_ip = 0; static wifi_radio_error_t _last_wifi_status = WIFI_RADIO_ERROR_NONE; #endif +#if CIRCUITPY_MDNS static mdns_server_obj_t mdns; -static uint32_t web_api_port = 80; +#endif + +static mp_int_t web_api_port = 80; static socketpool_socketpool_obj_t pool; static socketpool_socket_obj_t listening; @@ -195,6 +200,16 @@ STATIC void _update_encoded_ip(void) { } } +mdns_server_obj_t *supervisor_web_workflow_mdns(mp_obj_t network_interface) { + #if CIRCUITPY_MDNS + if (network_interface == &common_hal_wifi_radio_obj && + mdns.base.type == &mdns_server_type) { + return &mdns; + } + #endif + return NULL; +} + #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 || @@ -239,22 +254,33 @@ void supervisor_web_workflow_status(void) { #endif void supervisor_start_web_workflow(void) { - #if CIRCUITPY_WEB_WORKFLOW && CIRCUITPY_WIFI + #if CIRCUITPY_WEB_WORKFLOW && CIRCUITPY_WIFI && CIRCUITPY_OS_GETENV + // Skip starting the workflow if we're not starting from power on or reset. + const mcu_reset_reason_t reset_reason = common_hal_mcu_processor_get_reset_reason(); + if (reset_reason != RESET_REASON_POWER_ON && + reset_reason != RESET_REASON_RESET_PIN && + reset_reason != RESET_REASON_UNKNOWN && + reset_reason != RESET_REASON_SOFTWARE) { + return; + } 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)) { + os_getenv_err_t result = common_hal_os_getenv_str("CIRCUITPY_WIFI_SSID", ssid, sizeof(ssid)); + if (result != GETENV_OK) { return; } + + result = common_hal_os_getenv_str("CIRCUITPY_WIFI_PASSWORD", password, sizeof(password)); + if (result == GETENV_ERR_NOT_FOUND) { + // if password is unspecified, assume an open network + password[0] = '\0'; + } else if (result != GETENV_OK) { + 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); @@ -263,56 +289,56 @@ void supervisor_start_web_workflow(void) { // 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); + &common_hal_wifi_radio_obj, (uint8_t *)ssid, strlen(ssid), (uint8_t *)password, strlen(password), + 0, 8, 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); - } + mp_int_t new_port = web_api_port; + // (leaves new_port unchanged on any failure) + (void)common_hal_os_getenv_int("CIRCUITPY_WEB_API_PORT", &new_port); - bool first_start = mdns.base.type != &mdns_server_type; + bool first_start = pool.base.type != &socketpool_socketpool_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); + port_changed = false; 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; + socketpool_socket_reset(&listening); + socketpool_socket_reset(&active); websocket_init(); } + #if CIRCUITPY_MDNS + // Try to start MDNS if the user deinited it. + if (mdns.base.type != &mdns_server_type || + common_hal_mdns_server_deinited(&mdns)) { + mdns_server_construct(&mdns, true); + mdns.base.type = &mdns_server_type; + if (!common_hal_mdns_server_deinited(&mdns)) { + common_hal_mdns_server_set_instance_name(&mdns, MICROPY_HW_BOARD_NAME); + } + } + #endif 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); + #if CIRCUITPY_MDNS + if (!common_hal_mdns_server_deinited(&mdns)) { + common_hal_mdns_server_advertise_service(&mdns, "_circuitpython", "_tcp", web_api_port); + } + #endif socketpool_socket(&pool, SOCKETPOOL_AF_INET, SOCKETPOOL_SOCK_STREAM, &listening); common_hal_socketpool_socket_settimeout(&listening, 0); // Bind to any ip. @@ -320,23 +346,20 @@ void supervisor_start_web_workflow(void) { 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 + const size_t api_password_len = sizeof(_api_password) - 1; + result = common_hal_os_getenv_str("CIRCUITPY_WEB_API_PASSWORD", _api_password + 1, api_password_len); + if (result == GETENV_OK) { + _api_password[0] = ':'; + _base64_in_place(_api_password, strlen(_api_password), sizeof(_api_password) - 1); + } #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)) && + int sent = -MP_EAGAIN; + while ((sent == -MP_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) { @@ -347,9 +370,6 @@ void web_workflow_send_raw(socketpool_socket_obj_t *socket, const uint8_t *buf, } } } - 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) { @@ -361,7 +381,7 @@ static void _send_str(socketpool_socket_obj_t *socket, const char *str) { } // The last argument must be NULL! Otherwise, it won't stop. -static void _send_strs(socketpool_socket_obj_t *socket, ...) { +static __attribute__((sentinel)) void _send_strs(socketpool_socket_obj_t *socket, ...) { va_list ap; va_start(ap, socket); @@ -429,27 +449,32 @@ static bool _endswith(const char *str, const char *suffix) { } 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; + // TODO: Support DHCP hostname in addition to MDNS. + const char *end; + #if CIRCUITPY_MDNS + if (!common_hal_mdns_server_deinited(&mdns)) { + const char *local = ".local"; + const char *hostname = common_hal_mdns_server_get_hostname(&mdns); + 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; + } } + #endif _update_encoded_ip(); end = origin + strlen(http) + strlen(_our_ip_encoded); @@ -604,9 +629,10 @@ static void _reply_server_error(socketpool_socket_obj_t *socket, _request *reque _send_str(socket, "\r\n"); } +#if CIRCUITPY_MDNS 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)); + common_hal_socketpool_socket_setsockopt(socket, SOCKETPOOL_IPPROTO_TCP, SOCKETPOOL_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", @@ -628,6 +654,7 @@ static void _reply_redirect(socketpool_socket_obj_t *socket, _request *request, _cors_header(socket, request); _send_str(socket, "\r\n"); } +#endif 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)); @@ -686,16 +713,16 @@ static void _reply_with_file(socketpool_socket_obj_t *socket, _request *request, 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); + if (_endswith(filename, ".txt") || _endswith(filename, ".py") || _endswith(filename, ".toml")) { + _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); + _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); + _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); + _send_strs(socket, "Content-Type:", "application/json", ";charset=UTF-8\r\n", NULL); } else { - _send_str(socket, "Content-Type: application/octet-stream\r\n"); + _send_strs(socket, "Content-Type:", "application/octet-stream\r\n", NULL); } _cors_header(socket, request); _send_str(socket, "\r\n"); @@ -710,10 +737,9 @@ static void _reply_with_file(socketpool_socket_obj_t *socket, _request *request, 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) { + if (sent == -MP_EAGAIN) { sent = 0; } else { - ESP_LOGE(TAG, "file send error %d", sent); break; } } @@ -726,15 +752,21 @@ static void _reply_with_file(socketpool_socket_obj_t *socket, _request *request, } static void _reply_with_devices_json(socketpool_socket_obj_t *socket, _request *request) { + size_t total_results = 0; + #if CIRCUITPY_MDNS 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)); + if (!common_hal_mdns_server_deinited(&mdns)) { + 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)); + #endif 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); + #if CIRCUITPY_MDNS for (size_t i = 0; i < count; i++) { if (i > 0) { _send_chunk(socket, ","); @@ -751,6 +783,7 @@ static void _reply_with_devices_json(socketpool_socket_obj_t *socket, _request * "\"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]); } + #endif _send_chunk(socket, "]}"); // Empty chunk signals the end of the response. _send_chunk(socket, ""); @@ -762,7 +795,12 @@ static void _reply_with_version_json(socketpool_socket_obj_t *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); + const char *hostname = ""; + #if CIRCUITPY_MDNS + if (!common_hal_mdns_server_deinited(&mdns)) { + hostname = common_hal_mdns_server_get_hostname(&mdns); + } + #endif _update_encoded_ip(); // Note: this leverages the fact that C concats consecutive string literals together. mp_printf(&_socket_print, @@ -848,7 +886,6 @@ static void _write_file_and_reply(socketpool_socket_obj_t *socket, _request *req 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(); @@ -888,20 +925,19 @@ static void _write_file_and_reply(socketpool_socket_obj_t *socket, _request *req 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) { + if (len == -MP_EAGAIN) { continue; - } else { - ESP_LOGE(TAG, "other error %d", len); } error = true; break; } + total_read += len; UINT actual; f_write(&active_file, bytes, len, &actual); - if (actual != (UINT)len) { - ESP_LOGE(TAG, "didn't write whole file"); + if (actual < (UINT)len) { + error = true; + break; } - total_read += len; } f_close(&active_file); @@ -910,7 +946,10 @@ static void _write_file_and_reply(socketpool_socket_obj_t *socket, _request *req #endif override_fattime(0); - if (new_file) { + if (error) { + _discard_incoming(socket, request->content_length - total_read); + _reply_server_error(socket, request); + } else if (new_file) { _reply_created(socket, request); } else { _reply_no_content(socket, request); @@ -934,7 +973,7 @@ 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); + snprintf(encoded_len, sizeof(encoded_len), "%" PRIu32, total_length); _send_strs(socket, "HTTP/1.1 200 OK\r\n", @@ -1004,9 +1043,16 @@ static void _decode_percents(char *str) { static bool _reply(socketpool_socket_obj_t *socket, _request *request) { if (request->redirect) { - _reply_redirect(socket, request, request->path); + #if CIRCUITPY_MDNS + if (!common_hal_mdns_server_deinited(&mdns)) { + _reply_redirect(socket, request, request->path); + } else { + _reply_missing(socket, request); + } + #else + _reply_missing(socket, request); + #endif } 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) { @@ -1061,7 +1107,6 @@ static bool _reply(socketpool_socket_obj_t *socket, _request *request) { 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); @@ -1089,7 +1134,6 @@ static bool _reply(socketpool_socket_obj_t *socket, _request *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); @@ -1137,7 +1181,6 @@ static bool _reply(socketpool_socket_obj_t *socket, _request *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); @@ -1237,6 +1280,7 @@ static void _reset_request(_request *request) { request->redirect = false; request->done = false; request->in_progress = false; + request->new_socket = false; request->authenticated = false; request->expect = false; request->json = false; @@ -1257,6 +1301,7 @@ static void _process_request(socketpool_socket_obj_t *socket, _request *request) if (!request->in_progress) { autoreload_suspend(AUTORELOAD_SUSPEND_WEB); request->in_progress = true; + request->new_socket = false; } switch (request->state) { case STATE_METHOD: { @@ -1276,7 +1321,6 @@ static void _process_request(socketpool_socket_obj_t *socket, _request *request) 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. @@ -1352,7 +1396,6 @@ static void _process_request(socketpool_socket_obj_t *socket, _request *request) } 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 { @@ -1369,8 +1412,9 @@ static void _process_request(socketpool_socket_obj_t *socket, _request *request) } 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)); + common_hal_socketpool_socket_setsockopt(socket, SOCKETPOOL_IPPROTO_TCP, SOCKETPOOL_TCP_NODELAY, &nodelay, sizeof(nodelay)); socketpool_socket_send(socket, (const uint8_t *)error_response, strlen(error_response)); } if (!request->done) { @@ -1386,45 +1430,44 @@ static void _process_request(socketpool_socket_obj_t *socket, _request *request) 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; + // Track if we have more to do. For example, we should start processing a + // request immediately after we accept the socket. + bool more_to_do = true; + while (more_to_do) { + more_to_do = false; + // If we have a request in progress, continue working on it. Do this first + // so that we can accept another socket after finishing this request. + 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); } - 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); + + // Otherwise, see if we have another socket to accept. + if ((!common_hal_socketpool_socket_get_connected(&active) || + (!active_request.in_progress && !active_request.new_socket)) && + !common_hal_socketpool_socket_get_closed(&listening)) { + uint32_t ip; + uint32_t port; + int newsoc = socketpool_socket_accept(&listening, (uint8_t *)&ip, &port, &active); + if (newsoc == -EBADF) { + common_hal_socketpool_socket_close(&listening); + return; } - // TODO: Don't do this because it uses the private struct layout. - // Create the socket - active.num = newsoc; - active.pool = &pool; - active.connected = true; + if (newsoc > 0) { + common_hal_socketpool_socket_settimeout(&active, 0); - common_hal_socketpool_socket_settimeout(&active, 0); - - _reset_request(&active_request); - - lwip_fcntl(newsoc, F_SETFL, O_NONBLOCK); + _reset_request(&active_request); + // Mark new sockets, otherwise we may accept another before the first + // could start its request. + active_request.new_socket = true; + more_to_do = true; + } } - } - // 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(); } - - 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 index 166219c876..a76490aba2 100644 --- a/supervisor/shared/web_workflow/web_workflow.h +++ b/supervisor/shared/web_workflow/web_workflow.h @@ -28,6 +28,7 @@ #include +#include "shared-bindings/mdns/Server.h" #include "shared-bindings/socketpool/Socket.h" // This background function should be called repeatedly. It cannot be done based @@ -38,5 +39,8 @@ void supervisor_web_workflow_status(void); void supervisor_start_web_workflow(void); void supervisor_stop_web_workflow(void); +// Share the MDNS object with user code. +mdns_server_obj_t *supervisor_web_workflow_mdns(mp_obj_t network_interface); + // 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 index 3901c4eefe..7612066fa6 100644 --- a/supervisor/shared/web_workflow/websocket.c +++ b/supervisor/shared/web_workflow/websocket.c @@ -29,15 +29,13 @@ #include "py/ringbuf.h" #include "py/runtime.h" #include "shared/runtime/interrupt_char.h" +#include "shared-bindings/socketpool/SocketPool.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; @@ -57,24 +55,22 @@ 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; + socketpool_socket_reset(&cp_serial.socket); + cp_serial.closed = true; ringbuf_init(&_incoming_ringbuf, _buf, sizeof(_buf) - 1); } void websocket_handoff(socketpool_socket_obj_t *socket) { - cp_serial.socket = *socket; + if (!cp_serial.closed) { + common_hal_socketpool_socket_close(&cp_serial.socket); + } + socketpool_socket_move(socket, &cp_serial.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. @@ -89,9 +85,6 @@ bool websocket_connected(void) { 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; @@ -147,13 +140,10 @@ static void _read_next_frame_header(void) { // 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)); + common_hal_socketpool_socket_setsockopt(&cp_serial.socket, SOCKETPOOL_IPPROTO_TCP, SOCKETPOOL_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); } diff --git a/supervisor/stub/safe_mode.c b/supervisor/stub/safe_mode.c index b62cc05d78..ea5187da28 100644 --- a/supervisor/stub/safe_mode.c +++ b/supervisor/stub/safe_mode.c @@ -29,7 +29,7 @@ #include safe_mode_t wait_for_safe_mode_reset(void) { - return NO_SAFE_MODE; + return SAFE_MODE_NONE; } void reset_into_safe_mode(safe_mode_t reason) { diff --git a/supervisor/supervisor.mk b/supervisor/supervisor.mk index a8deb9606d..801025f41a 100644 --- a/supervisor/supervisor.mk +++ b/supervisor/supervisor.mk @@ -4,6 +4,7 @@ SRC_SUPERVISOR = \ supervisor/shared/background_callback.c \ supervisor/shared/board.c \ supervisor/shared/cpu.c \ + supervisor/shared/fatfs.c \ supervisor/shared/flash.c \ supervisor/shared/lock.c \ supervisor/shared/memory.c \ diff --git a/tests/basics/exception_chain.py b/tests/basics/exception_chain.py index c3a7d6b113..b84ff19dd6 100644 --- a/tests/basics/exception_chain.py +++ b/tests/basics/exception_chain.py @@ -1,6 +1,54 @@ -# Exception chaining is not supported, but check that basic -# exception works as expected. try: - raise Exception from None -except Exception: - print("Caught Exception") + Exception().__cause__ +except AttributeError: + print("SKIP") + raise SystemExit + +def print_exc_info(e): + print("exception", type(e), e.args) + print("context", type(e.__context__), e.__suppress_context__) + print("cause", type(e.__cause__)) + +try: + try: + 1/0 + except Exception as inner: + raise RuntimeError() from inner +except Exception as e: + print_exc_info(e) +print() + +try: + try: + 1/0 + except Exception as inner: + raise RuntimeError() from OSError() +except Exception as e: + print_exc_info(e) +print() + + +try: + try: + 1/0 + except Exception as inner: + raise RuntimeError() +except Exception as e: + print_exc_info(e) +print() + +try: + try: + 1/0 + except Exception as inner: + raise RuntimeError() from None +except Exception as e: + print_exc_info(e) + +try: + try: + raise RuntimeError() + except Exception as inner: + 1/0 +except Exception as e: + print_exc_info(e) diff --git a/tests/basics/exception_chain.py.exp b/tests/basics/exception_chain.py.exp deleted file mode 100644 index 13635b3cde..0000000000 --- a/tests/basics/exception_chain.py.exp +++ /dev/null @@ -1,2 +0,0 @@ -Warning: exception chaining not supported -Caught Exception diff --git a/tests/circuitpython/dotenv_test.py b/tests/circuitpython/dotenv_test.py deleted file mode 100644 index 109a3bf221..0000000000 --- a/tests/circuitpython/dotenv_test.py +++ /dev/null @@ -1,31 +0,0 @@ -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')}") - -for i in range(12): - key = f"sz{i}" - print(f"len({key})={len(dotenv.get_key(FILE, key))}") diff --git a/tests/circuitpython/dotenv_test.py.exp b/tests/circuitpython/dotenv_test.py.exp deleted file mode 100644 index e0ed5f1505..0000000000 --- a/tests/circuitpython/dotenv_test.py.exp +++ /dev/null @@ -1,35 +0,0 @@ -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 -len(sz0)=1 -len(sz1)=2 -len(sz2)=4 -len(sz3)=8 -len(sz4)=16 -len(sz5)=32 -len(sz6)=64 -len(sz7)=128 -len(sz8)=256 -len(sz9)=512 -len(sz10)=1024 -len(sz11)=2048 diff --git a/tests/circuitpython/getenv.py b/tests/circuitpython/getenv.py new file mode 100644 index 0000000000..68dd328cfb --- /dev/null +++ b/tests/circuitpython/getenv.py @@ -0,0 +1,89 @@ +import uos + +uos.umount("/") + + +class RAMBlockDevice: + ERASE_BLOCK_SIZE = 512 + + def __init__(self, blocks): + self.data = bytearray(blocks * self.ERASE_BLOCK_SIZE) + + def readblocks(self, block, buf, off=0): + addr = block * self.ERASE_BLOCK_SIZE + off + for i in range(len(buf)): + buf[i] = self.data[addr + i] + + def writeblocks(self, block, buf, off=None): + if off is None: + # erase, then write + off = 0 + addr = block * self.ERASE_BLOCK_SIZE + off + for i in range(len(buf)): + self.data[addr + i] = buf[i] + + def ioctl(self, op, arg): + if op == 4: # block count + return len(self.data) // self.ERASE_BLOCK_SIZE + if op == 5: # block size + return self.ERASE_BLOCK_SIZE + if op == 6: # erase block + return 0 + + +bdev = RAMBlockDevice(64) +uos.VfsFat.mkfs(bdev) +uos.mount(uos.VfsFat(bdev), "/") + +content_good = b""" +# comment +key0 = "hello world" +key1 = 7 +key2= "\\n" +key3 ="\\u00c1x" +key4 = "\\U000000c1x" +key5 = "\\f\\"\\\\" +key6 = "\\t\\r\\b" +key7 = "xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx" +key8 = "xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx" + key9 = "hello comment" # comment + key10 = 0x7f # comment +key11 = 0 +[section] +subvalue = "hi" +""" + +content_bad = [ + b'key = "\n', + b'key = """\n', + b"key =\n", + b'key="', +] + + +def run_test(key, content): + with open("/settings.toml", "wb") as f: + f.write(content) + + try: + v = uos.getenv(key) + print(key, repr(v)) + except Exception as e: + print(key, str(e)) + + +for i in range(13): + run_test(f"key{i}", content_good) + +content_good = content_good.replace(b"\n", b"\r\n") +for i in range(13): + run_test(f"key{i}", content_good) + +run_test(f"K", b"K = 7\r\n") +print(uos.getenv_int("K")) + +# Test value without trailing newline +run_test(f"noeol", b"noeol=3") + +for content in content_bad: + run_test("key", content) diff --git a/tests/circuitpython/dotenv_test.env b/tests/circuitpython/getenv.py.exp similarity index 63% rename from tests/circuitpython/dotenv_test.env rename to tests/circuitpython/getenv.py.exp index 63753b0ea4..ba1b1b3f90 100644 --- a/tests/circuitpython/dotenv_test.env +++ b/tests/circuitpython/getenv.py.exp @@ -1,37 +1,33 @@ -# 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 -sz0=x -sz1=xx -sz2=xxxx -sz3=xxxxxxxx -sz4=xxxxxxxxxxxxxxxx -sz5=xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx -sz6=xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx -sz7=xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx -sz8=xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx -sz9=xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx -sz10=xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx -sz11=xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx +key0 'hello world' +key1 7 +key2 '\n' +key3 'Áx' +key4 'Áx' +key5 '\x0c"\\' +key6 '\t\r\x08' +key7 'xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx' +key8 'xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx' +key9 'hello comment' +key10 127 +key11 0 +key12 None +key0 'hello world' +key1 7 +key2 '\n' +key3 'Áx' +key4 'Áx' +key5 '\x0c"\\' +key6 '\t\r\x08' +key7 'xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx' +key8 'xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx' +key9 'hello comment' +key10 127 +key11 0 +key12 None +K 7 +7 +noeol 3 +key Invalid byte '\n' +key Invalid byte '"' +key invalid syntax for integer with base 10: '' +key Invalid byte 'EOF' diff --git a/tests/circuitpython/traceback_test_chained.py b/tests/circuitpython/traceback_test_chained.py new file mode 100644 index 0000000000..dac99e00b4 --- /dev/null +++ b/tests/circuitpython/traceback_test_chained.py @@ -0,0 +1,74 @@ +try: + Exception().__cause__ +except AttributeError: + print("SKIP") + raise SystemExit + +try: + import traceback +except: + print("SKIP") + raise SystemExit + + +def print_exc_info(e, chain=True): + print("-" * 72) + traceback.print_exception(None, e, e.__traceback__, chain=chain) + print("-" * 72) + print() + + +try: + try: + 1 / 0 + except Exception as inner: + raise RuntimeError() from inner +except Exception as e: + print_exc_info(e, chain=False) + print_exc_info(e) +print() + +try: + try: + 1 / 0 + except Exception as inner: + raise RuntimeError() from OSError() +except Exception as e: + print_exc_info(e) +print() + + +try: + try: + 1 / 0 + except Exception as inner: + raise RuntimeError() +except Exception as e: + print_exc_info(e) +print() + +try: + try: + 1 / 0 + except Exception as inner: + raise RuntimeError() from None +except Exception as e: + print_exc_info(e) + +try: + try: + raise RuntimeError() + except Exception as inner: + 1 / 0 +except Exception as e: + print_exc_info(e) + +try: + try: + 1 / 0 + except Exception as inner: + raise inner +except Exception as e: + print_exc_info(e, chain=False) + print_exc_info(e) +print() diff --git a/tests/circuitpython/traceback_test_chained.py.exp b/tests/circuitpython/traceback_test_chained.py.exp new file mode 100644 index 0000000000..a979adc24c --- /dev/null +++ b/tests/circuitpython/traceback_test_chained.py.exp @@ -0,0 +1,76 @@ +------------------------------------------------------------------------ +Traceback (most recent call last): + File "circuitpython/traceback_test_chained.py", line 25, in +RuntimeError: +------------------------------------------------------------------------ + +------------------------------------------------------------------------ +Traceback (most recent call last): + File "circuitpython/traceback_test_chained.py", line 23, in +ZeroDivisionError: division by zero + +The above exception was the direct cause of the following exception: + +Traceback (most recent call last): + File "circuitpython/traceback_test_chained.py", line 25, in +RuntimeError: +------------------------------------------------------------------------ + + +------------------------------------------------------------------------ +OSError: + +The above exception was the direct cause of the following exception: + +Traceback (most recent call last): + File "circuitpython/traceback_test_chained.py", line 35, in +RuntimeError: +------------------------------------------------------------------------ + + +------------------------------------------------------------------------ +Traceback (most recent call last): + File "circuitpython/traceback_test_chained.py", line 43, in +ZeroDivisionError: division by zero + +During handling of the above exception, another exception occurred: + +Traceback (most recent call last): + File "circuitpython/traceback_test_chained.py", line 45, in +RuntimeError: +------------------------------------------------------------------------ + + +------------------------------------------------------------------------ +Traceback (most recent call last): + File "circuitpython/traceback_test_chained.py", line 54, in +RuntimeError: +------------------------------------------------------------------------ + +------------------------------------------------------------------------ +Traceback (most recent call last): + File "circuitpython/traceback_test_chained.py", line 60, in +RuntimeError: + +During handling of the above exception, another exception occurred: + +Traceback (most recent call last): + File "circuitpython/traceback_test_chained.py", line 62, in +ZeroDivisionError: division by zero +------------------------------------------------------------------------ + +------------------------------------------------------------------------ +Traceback (most recent call last): + File "circuitpython/traceback_test_chained.py", line 70, in + File "circuitpython/traceback_test_chained.py", line 68, in +ZeroDivisionError: division by zero +------------------------------------------------------------------------ + +------------------------------------------------------------------------ +Traceback (most recent call last): + File "circuitpython/traceback_test_chained.py", line 70, in + File "circuitpython/traceback_test_chained.py", line 68, in +ZeroDivisionError: division by zero +------------------------------------------------------------------------ + + diff --git a/tests/extmod/framebuf_subclass.py b/tests/extmod/framebuf_subclass.py index a9e3c5efc7..4cd9ea4eb5 100644 --- a/tests/extmod/framebuf_subclass.py +++ b/tests/extmod/framebuf_subclass.py @@ -34,6 +34,7 @@ fb.pixel(2, 2, 0x0708) fb2.blit(fb, 0, 0) print(bytes(fb2)) + # Test that blitting something that isn't a subclass fails with TypeError. class NotAFrameBuf: pass diff --git a/tests/extmod/uasyncio_exception.py b/tests/extmod/uasyncio_exception.py index aae55d6320..4e4f978dc2 100644 --- a/tests/extmod/uasyncio_exception.py +++ b/tests/extmod/uasyncio_exception.py @@ -9,6 +9,7 @@ except ImportError: print("SKIP") raise SystemExit + # main task raising an exception async def main(): print("main start") @@ -21,6 +22,7 @@ try: except ValueError as er: print("ValueError", er.args[0]) + # sub-task raising an exception async def task(): print("task start") @@ -40,6 +42,7 @@ try: except ValueError as er: print("ValueError", er.args[0]) + # main task raising an exception with sub-task not yet scheduled # TODO not currently working, task is never scheduled async def task(): diff --git a/tests/extmod/vfs_fat_fileio1.py b/tests/extmod/vfs_fat_fileio1.py index 10e92d6940..935f01d24f 100644 --- a/tests/extmod/vfs_fat_fileio1.py +++ b/tests/extmod/vfs_fat_fileio1.py @@ -13,7 +13,6 @@ except AttributeError: class RAMFS: - SEC_SIZE = 512 def __init__(self, blocks): diff --git a/tests/extmod/vfs_fat_fileio2.py b/tests/extmod/vfs_fat_fileio2.py index 7c75a6d044..6094b5a6f1 100644 --- a/tests/extmod/vfs_fat_fileio2.py +++ b/tests/extmod/vfs_fat_fileio2.py @@ -13,7 +13,6 @@ except AttributeError: class RAMFS: - SEC_SIZE = 512 def __init__(self, blocks): diff --git a/tests/extmod/vfs_fat_more.py b/tests/extmod/vfs_fat_more.py index 1b7b04ee63..f5de729402 100644 --- a/tests/extmod/vfs_fat_more.py +++ b/tests/extmod/vfs_fat_more.py @@ -12,7 +12,6 @@ except AttributeError: class RAMFS: - SEC_SIZE = 512 def __init__(self, blocks): diff --git a/tests/extmod/vfs_fat_oldproto.py b/tests/extmod/vfs_fat_oldproto.py index e447ff4eb3..1998319dbe 100644 --- a/tests/extmod/vfs_fat_oldproto.py +++ b/tests/extmod/vfs_fat_oldproto.py @@ -13,7 +13,6 @@ except AttributeError: class RAMFS_OLD: - SEC_SIZE = 512 def __init__(self, blocks): diff --git a/tests/extmod/vfs_fat_ramdisk.py b/tests/extmod/vfs_fat_ramdisk.py index 4b79391102..a22d480dfd 100644 --- a/tests/extmod/vfs_fat_ramdisk.py +++ b/tests/extmod/vfs_fat_ramdisk.py @@ -13,7 +13,6 @@ except AttributeError: class RAMFS: - SEC_SIZE = 512 def __init__(self, blocks): diff --git a/tests/extmod/vfs_fat_ramdisklarge.py b/tests/extmod/vfs_fat_ramdisklarge.py index 69d4a8cbbd..649a53db14 100644 --- a/tests/extmod/vfs_fat_ramdisklarge.py +++ b/tests/extmod/vfs_fat_ramdisklarge.py @@ -14,7 +14,6 @@ except AttributeError: class RAMBDevSparse: - SEC_SIZE = 512 def __init__(self, blocks): diff --git a/tests/import/module_getattr.py b/tests/import/module_getattr.py index df7a621815..9ca0d18455 100644 --- a/tests/import/module_getattr.py +++ b/tests/import/module_getattr.py @@ -8,6 +8,7 @@ try: except AttributeError: pass + # define __getattr__ def __getattr__(attr): if attr == "does_not_exist": diff --git a/tests/inlineasm/asmsum.py b/tests/inlineasm/asmsum.py index 6535a495d4..208709a25f 100644 --- a/tests/inlineasm/asmsum.py +++ b/tests/inlineasm/asmsum.py @@ -1,6 +1,5 @@ @micropython.asm_thumb def asm_sum_words(r0, r1): - # r0 = len # r1 = ptr # r2 = sum @@ -25,7 +24,6 @@ def asm_sum_words(r0, r1): @micropython.asm_thumb def asm_sum_bytes(r0, r1): - # r0 = len # r1 = ptr # r2 = sum diff --git a/tests/micropython/const2.py b/tests/micropython/const2.py index ed4720122e..d8b68c25f3 100644 --- a/tests/micropython/const2.py +++ b/tests/micropython/const2.py @@ -11,6 +11,7 @@ import micropython as X print(globals()["X"]) + # function name that matches a constant def X(): print("function X", X) @@ -18,6 +19,7 @@ def X(): globals()["X"]() + # arguments that match a constant def f(X, *Y, **Z): pass @@ -25,6 +27,7 @@ def f(X, *Y, **Z): f(1) + # class name that matches a constant class X: def f(self): @@ -33,6 +36,7 @@ class X: globals()["X"]().f() + # constant within a class class A: C1 = const(4) diff --git a/tests/micropython/heapalloc_yield_from.py b/tests/micropython/heapalloc_yield_from.py index 58788b1dbc..9507171890 100644 --- a/tests/micropython/heapalloc_yield_from.py +++ b/tests/micropython/heapalloc_yield_from.py @@ -2,6 +2,7 @@ import micropython + # Yielding from a function generator def sub_gen(a): for i in range(a): @@ -18,6 +19,7 @@ print(next(g)) print(next(g)) micropython.heap_unlock() + # Yielding from a user iterator class G: def __init__(self): diff --git a/tests/micropython/native_closure.py b/tests/micropython/native_closure.py index 07014e90da..8182cfea70 100644 --- a/tests/micropython/native_closure.py +++ b/tests/micropython/native_closure.py @@ -1,5 +1,6 @@ # test native emitter can handle closures correctly + # basic closure @micropython.native def f(): @@ -15,6 +16,7 @@ def f(): print(f()()) + # closing over an argument @micropython.native def f(x): @@ -28,6 +30,7 @@ def f(x): print(f(2)()) + # closing over an argument and a normal local @micropython.native def f(x): diff --git a/tests/micropython/native_gen.py b/tests/micropython/native_gen.py index fb42f9e25e..7ea45b1497 100644 --- a/tests/micropython/native_gen.py +++ b/tests/micropython/native_gen.py @@ -1,5 +1,6 @@ # test for native generators + # simple generator with yield and return @micropython.native def gen1(x): @@ -16,6 +17,7 @@ try: except StopIteration as e: print(e.args[0]) + # using yield from @micropython.native def gen2(x): diff --git a/tests/micropython/native_misc.py b/tests/micropython/native_misc.py index f5ef807fe1..f40fcb2407 100644 --- a/tests/micropython/native_misc.py +++ b/tests/micropython/native_misc.py @@ -1,5 +1,6 @@ # tests for natively compiled functions + # basic test @micropython.native def native_test(x): @@ -14,6 +15,7 @@ import gc gc.collect() native_test(3) + # native with 2 args @micropython.native def f(a, b): @@ -22,6 +24,7 @@ def f(a, b): f(1, 2) + # native with 3 args @micropython.native def f(a, b, c): @@ -30,6 +33,7 @@ def f(a, b, c): f(1, 2, 3) + # check not operator @micropython.native def f(a): diff --git a/tests/micropython/native_try.py b/tests/micropython/native_try.py index 492b59085c..6a2152b28c 100644 --- a/tests/micropython/native_try.py +++ b/tests/micropython/native_try.py @@ -1,5 +1,6 @@ # test native try handling + # basic try-finally @micropython.native def f(): @@ -14,6 +15,7 @@ try: except NameError: print("NameError") + # nested try-except with try-finally @micropython.native def f(): @@ -28,6 +30,7 @@ def f(): f() + # check that locals written to in try blocks keep their values @micropython.native def f(): diff --git a/tests/micropython/native_try_deep.py b/tests/micropython/native_try_deep.py index 3d31248df0..26b9243e03 100644 --- a/tests/micropython/native_try_deep.py +++ b/tests/micropython/native_try_deep.py @@ -1,5 +1,6 @@ # test native try handling + # deeply nested try (9 deep) @micropython.native def f(): diff --git a/tests/micropython/native_with.py b/tests/micropython/native_with.py index 4e20b23856..9c0b98af90 100644 --- a/tests/micropython/native_with.py +++ b/tests/micropython/native_with.py @@ -21,6 +21,7 @@ def f(): f() + # nested with and try-except @micropython.native def f(): diff --git a/tests/micropython/viper_args.py b/tests/micropython/viper_args.py index 8e3225331a..27c73fa795 100644 --- a/tests/micropython/viper_args.py +++ b/tests/micropython/viper_args.py @@ -56,6 +56,7 @@ def f6(x1: int, x2: int, x3: int, x4: int, x5: int, x6: int): f6(1, 2, 3, 4, 5, 6) + # test compiling *x, **x, * args (currently unsupported at runtime) @micropython.viper def f(*x, **y): diff --git a/tests/micropython/viper_cond.py b/tests/micropython/viper_cond.py index d5ebf837bd..752261ff50 100644 --- a/tests/micropython/viper_cond.py +++ b/tests/micropython/viper_cond.py @@ -10,6 +10,7 @@ def f(): f() + # using True as a conditional @micropython.viper def f(): @@ -20,6 +21,7 @@ def f(): f() + # using an int as a conditional @micropython.viper def g(): @@ -30,6 +32,7 @@ def g(): g() + # using an int as a conditional that has the lower 16-bits clear @micropython.viper def h(): diff --git a/tests/micropython/viper_misc.py b/tests/micropython/viper_misc.py index 41389c751d..f9267f65ca 100644 --- a/tests/micropython/viper_misc.py +++ b/tests/micropython/viper_misc.py @@ -1,5 +1,6 @@ import micropython + # viper function taking and returning ints @micropython.viper def viper_int(x: int, y: int) -> int: @@ -8,6 +9,7 @@ def viper_int(x: int, y: int) -> int: print(viper_int(1, 2)) + # viper function taking and returning objects @micropython.viper def viper_object(x: object, y: object) -> object: @@ -16,6 +18,7 @@ def viper_object(x: object, y: object) -> object: print(viper_object(1, 2)) + # return None as non-object (should return 0) @micropython.viper def viper_ret_none() -> int: @@ -24,6 +27,7 @@ def viper_ret_none() -> int: print(viper_ret_none()) + # return Ellipsis as object @micropython.viper def viper_ret_ellipsis() -> object: @@ -32,6 +36,7 @@ def viper_ret_ellipsis() -> object: print(viper_ret_ellipsis()) + # 3 args @micropython.viper def viper_3args(a: int, b: int, c: int) -> int: @@ -40,6 +45,7 @@ def viper_3args(a: int, b: int, c: int) -> int: print(viper_3args(1, 2, 3)) + # 4 args @micropython.viper def viper_4args(a: int, b: int, c: int, d: int) -> int: @@ -49,6 +55,7 @@ def viper_4args(a: int, b: int, c: int, d: int) -> int: # viper call with 4 args not yet supported # print(viper_4args(1, 2, 3, 4)) + # a local (should have automatic type int) @micropython.viper def viper_local(x: int) -> int: @@ -58,6 +65,7 @@ def viper_local(x: int) -> int: print(viper_local(3)) + # without type annotation, types should default to object @micropython.viper def viper_no_annotation(x, y): @@ -66,6 +74,7 @@ def viper_no_annotation(x, y): print(viper_no_annotation(4, 5)) + # a for loop @micropython.viper def viper_for(a: int, b: int) -> int: @@ -77,6 +86,7 @@ def viper_for(a: int, b: int) -> int: print(viper_for(10, 10000)) + # accessing a global @micropython.viper def viper_access_global(): @@ -87,6 +97,7 @@ def viper_access_global(): print(viper_access_global(), gl) + # calling print with object and int types @micropython.viper def viper_print(x, y: int): @@ -95,6 +106,7 @@ def viper_print(x, y: int): viper_print(1, 2) + # convert constants to objects in tuple @micropython.viper def viper_tuple_consts(x): @@ -103,6 +115,7 @@ def viper_tuple_consts(x): print(viper_tuple_consts(0)) + # making a tuple from an object and an int @micropython.viper def viper_tuple(x, y: int): @@ -111,6 +124,7 @@ def viper_tuple(x, y: int): print(viper_tuple(1, 2)) + # making a list from an object and an int @micropython.viper def viper_list(x, y: int): @@ -119,6 +133,7 @@ def viper_list(x, y: int): print(viper_list(1, 2)) + # making a set from an object and an int @micropython.viper def viper_set(x, y: int): @@ -127,6 +142,7 @@ def viper_set(x, y: int): print(sorted(list(viper_set(1, 2)))) + # raising an exception @micropython.viper def viper_raise(x: int): @@ -138,6 +154,7 @@ try: except OSError as e: print(repr(e)) + # calling GC after defining the function @micropython.viper def viper_gc() -> int: diff --git a/tests/micropython/viper_misc2.py b/tests/micropython/viper_misc2.py index 8f0be487d6..cc77134bd4 100644 --- a/tests/micropython/viper_misc2.py +++ b/tests/micropython/viper_misc2.py @@ -1,5 +1,6 @@ # Miscellaneous viper tests + # Test correct use of registers in load and store @micropython.viper def expand(dest: ptr8, source: ptr8, length: int): diff --git a/tests/micropython/viper_misc_intbig.py b/tests/micropython/viper_misc_intbig.py index 055c08d8e5..91673f2c10 100644 --- a/tests/micropython/viper_misc_intbig.py +++ b/tests/micropython/viper_misc_intbig.py @@ -1,5 +1,6 @@ import micropython + # unsigned ints @micropython.viper def viper_uint() -> uint: diff --git a/tests/micropython/viper_try.py b/tests/micropython/viper_try.py index 61335af221..f5822a6682 100644 --- a/tests/micropython/viper_try.py +++ b/tests/micropython/viper_try.py @@ -1,5 +1,6 @@ # test try handling within a viper function + # basic try-finally @micropython.viper def f(): @@ -14,6 +15,7 @@ try: except NameError: print("NameError") + # nested try-except with try-finally @micropython.viper def f(): @@ -28,6 +30,7 @@ def f(): f() + # check that locals written to in try blocks keep their values @micropython.viper def f(): diff --git a/tests/micropython/viper_types.py b/tests/micropython/viper_types.py index 3af148171e..3e0a4f6640 100644 --- a/tests/micropython/viper_types.py +++ b/tests/micropython/viper_types.py @@ -2,6 +2,7 @@ import micropython + # converting incoming arg to bool @micropython.viper def f1(x: bool): @@ -13,6 +14,7 @@ f1(1) f1([]) f1([1]) + # taking and returning a bool @micropython.viper def f2(x: bool) -> bool: @@ -22,6 +24,7 @@ def f2(x: bool) -> bool: print(f2([])) print(f2([1])) + # converting to bool within function @micropython.viper def f3(x) -> bool: diff --git a/tests/micropython/viper_with.py b/tests/micropython/viper_with.py index d640c8ae0f..40fbf6fb31 100644 --- a/tests/micropython/viper_with.py +++ b/tests/micropython/viper_with.py @@ -21,6 +21,7 @@ def f(): f() + # nested with and try-except @micropython.viper def f(): diff --git a/tests/misc/non_compliant.py b/tests/misc/non_compliant.py index cff1894106..1c3706ec33 100644 --- a/tests/misc/non_compliant.py +++ b/tests/misc/non_compliant.py @@ -111,6 +111,7 @@ try: except NotImplementedError: print("NotImplementedError") + # can't assign attributes to a function def f(): pass @@ -127,6 +128,7 @@ try: except TypeError: print("TypeError") + # test when object explicitly listed at not-last position in parent tuple # this is not compliant with CPython because of illegal MRO class A: @@ -140,6 +142,7 @@ class B(object, A): B().foo() + # can't assign property (or other special accessors) to already-subclassed class class A: pass diff --git a/tests/misc/sys_settrace_generator.py b/tests/misc/sys_settrace_generator.py index 43065df4ae..1199f1f4eb 100644 --- a/tests/misc/sys_settrace_generator.py +++ b/tests/misc/sys_settrace_generator.py @@ -48,11 +48,9 @@ def test_generator(): gen = make_gen() r = 0 try: - r += gen.send(None) while True: - r += gen.send(None) except StopIteration as e: diff --git a/tests/misc/sys_settrace_subdir/sys_settrace_generic.py b/tests/misc/sys_settrace_subdir/sys_settrace_generic.py index a60ca955d7..fcf034af25 100644 --- a/tests/misc/sys_settrace_subdir/sys_settrace_generic.py +++ b/tests/misc/sys_settrace_subdir/sys_settrace_generic.py @@ -1,5 +1,6 @@ print("Now comes the language constructions tests.") + # function def test_func(): def test_sub_func(): diff --git a/tests/perf_bench/bm_nqueens.py b/tests/perf_bench/bm_nqueens.py index 773dd3f7ed..160f1178aa 100644 --- a/tests/perf_bench/bm_nqueens.py +++ b/tests/perf_bench/bm_nqueens.py @@ -5,6 +5,7 @@ # author: collinwinter@google.com (Collin Winter) # n_queens function: Copyright 2009 Raymond Hettinger + # Pure-Python implementation of itertools.permutations(). def permutations(iterable, r=None): """permutations(range(3), 2) --> (0,1) (0,2) (1,0) (1,2) (2,0) (2,1)""" diff --git a/tests/perf_bench/misc_aes.py b/tests/perf_bench/misc_aes.py index 0743737cb7..8a9c58bb38 100644 --- a/tests/perf_bench/misc_aes.py +++ b/tests/perf_bench/misc_aes.py @@ -33,6 +33,7 @@ aes_s_box_table = bytes(( )) # fmt: on + # multiplication of polynomials modulo x^8 + x^4 + x^3 + x + 1 = 0x11b def aes_gf8_mul_2(x): if x & 0x80: @@ -64,6 +65,7 @@ def aes_r_con(a): ################################################################## # basic AES algorithm; see FIPS-197 + # all inputs must be size 16 def aes_add_round_key(state, w): for i in range(16): diff --git a/tests/run-internalbench.py b/tests/run-internalbench.py index 606fc3b772..24f6d5a771 100755 --- a/tests/run-internalbench.py +++ b/tests/run-internalbench.py @@ -26,7 +26,6 @@ def run_tests(pyb, test_dict): for base_test, tests in sorted(test_dict.items()): print(base_test + ":") for test_file in tests: - # run MicroPython if pyb is None: # run on PC diff --git a/tests/run-tests.py b/tests/run-tests.py index ed0cf18e45..7a7b3adbcb 100755 --- a/tests/run-tests.py +++ b/tests/run-tests.py @@ -522,8 +522,12 @@ def run_tests(pyb, tests, args, result_dir, num_threads=1): skip_tests.add("basics/scope_implicit.py") # requires checking for unbound local skip_tests.add("basics/try_finally_return2.py") # requires raise_varargs skip_tests.add("basics/unboundlocal.py") # requires checking for unbound local - skip_tests.add( - "circuitpython/traceback_test.py" + skip_tests.update( + ( + "basics/chained_exception.py", + "circuitpython/traceback_test.py", + "circuitpython/traceback_test_chained.py", + ) ) # because native doesn't have proper traceback info skip_tests.add("extmod/uasyncio_event.py") # unknown issue skip_tests.add("extmod/uasyncio_lock.py") # requires async with diff --git a/tests/stress/qstr_limit.py b/tests/stress/qstr_limit.py index d8ce0cf7cd..08b10a039f 100644 --- a/tests/stress/qstr_limit.py +++ b/tests/stress/qstr_limit.py @@ -17,6 +17,7 @@ for l in range(254, 259): continue print(var in g) + # calling a function with kwarg def f(**k): print(k) @@ -36,6 +37,7 @@ for l in range(254, 259): except RuntimeError: print("RuntimeError", l) + # hasattr, setattr, getattr class A: pass diff --git a/tests/stress/recursive_gen.py b/tests/stress/recursive_gen.py index 8c21397658..e051abb84d 100644 --- a/tests/stress/recursive_gen.py +++ b/tests/stress/recursive_gen.py @@ -1,5 +1,6 @@ # test deeply recursive generators + # simple "yield from" recursion def gen(): yield from gen() @@ -10,6 +11,7 @@ try: except RuntimeError: print("RuntimeError") + # recursion via an iterator over a generator def gen2(): for x in gen2(): diff --git a/tests/thread/mutate_bytearray.py b/tests/thread/mutate_bytearray.py index 9b52e0c016..7bacabec3a 100644 --- a/tests/thread/mutate_bytearray.py +++ b/tests/thread/mutate_bytearray.py @@ -9,6 +9,7 @@ import _thread # the shared bytearray ba = bytearray() + # main thread function def th(n, lo, hi): for repeat in range(n): diff --git a/tests/thread/mutate_dict.py b/tests/thread/mutate_dict.py index 0840dcafba..fb87190e77 100644 --- a/tests/thread/mutate_dict.py +++ b/tests/thread/mutate_dict.py @@ -9,6 +9,7 @@ import _thread # the shared dict di = {"a": "A", "b": "B", "c": "C", "d": "D"} + # main thread function def th(n, lo, hi): for repeat in range(n): diff --git a/tests/thread/mutate_instance.py b/tests/thread/mutate_instance.py index 8ba91cbde3..cc0ad9885d 100644 --- a/tests/thread/mutate_instance.py +++ b/tests/thread/mutate_instance.py @@ -6,6 +6,7 @@ import _thread + # the shared user class and instance class User: def __init__(self): @@ -16,6 +17,7 @@ class User: user = User() + # main thread function def th(n, lo, hi): for repeat in range(n): diff --git a/tests/thread/mutate_list.py b/tests/thread/mutate_list.py index 8ce15c0852..4df86b3008 100644 --- a/tests/thread/mutate_list.py +++ b/tests/thread/mutate_list.py @@ -9,6 +9,7 @@ import _thread # the shared list li = list() + # main thread function def th(n, lo, hi): for repeat in range(n): diff --git a/tests/thread/mutate_set.py b/tests/thread/mutate_set.py index 61169b8aa9..587a3a259a 100644 --- a/tests/thread/mutate_set.py +++ b/tests/thread/mutate_set.py @@ -9,6 +9,7 @@ import _thread # the shared set se = set([-1, -2, -3, -4]) + # main thread function def th(n, lo, hi): for repeat in range(n): diff --git a/tests/thread/stress_aes.py b/tests/thread/stress_aes.py index 673337563d..199fe3c88c 100644 --- a/tests/thread/stress_aes.py +++ b/tests/thread/stress_aes.py @@ -40,6 +40,7 @@ aes_s_box_table = bytes(( )) # fmt: on + # multiplication of polynomials modulo x^8 + x^4 + x^3 + x + 1 = 0x11b def aes_gf8_mul_2(x): if x & 0x80: @@ -82,6 +83,7 @@ def aes_r_con(a): # using OCB, where the sequence is xored against the plaintext. # Care must be taken to (almost) always choose a different IV. + # all inputs must be size 16 def aes_add_round_key(state, w): for i in range(16): diff --git a/tests/thread/thread_qstr1.py b/tests/thread/thread_qstr1.py index 2099f94bdb..9e7d7f0326 100644 --- a/tests/thread/thread_qstr1.py +++ b/tests/thread/thread_qstr1.py @@ -10,6 +10,7 @@ except ImportError: import time import _thread + # function to check the interned string def check(s, val): assert type(s) == str diff --git a/tests/unicode/unicode_id.py b/tests/unicode/unicode_id.py index 3a58e3f72b..32817287e9 100644 --- a/tests/unicode/unicode_id.py +++ b/tests/unicode/unicode_id.py @@ -10,6 +10,7 @@ bβ = 3 βb = 4 print(α, αβγ, bβ, βb) + # function, argument, local identifiers def α(β, γ): δ = β + γ @@ -18,6 +19,7 @@ def α(β, γ): α(1, 2) + # class, method identifiers class φ: def __init__(self): diff --git a/tests/unix/extra_coverage.py.exp b/tests/unix/extra_coverage.py.exp index 782ab95cc8..582d90e1bc 100644 --- a/tests/unix/extra_coverage.py.exp +++ b/tests/unix/extra_coverage.py.exp @@ -32,19 +32,18 @@ mport builtins micropython _asyncio _thread _uasyncio aesio array binascii bitmaptools btree cexample cmath -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 -uselect ustruct utime utimeq -uzlib zlib +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.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 uselect ustruct +utime utimeq uzlib zlib ime utime utimeq diff --git a/tools/build_board_info.py b/tools/build_board_info.py index f810d942a7..5209337b95 100755 --- a/tools/build_board_info.py +++ b/tools/build_board_info.py @@ -10,6 +10,7 @@ import subprocess import sys import sh import base64 +from io import StringIO from datetime import date from sh.contrib import git @@ -58,9 +59,13 @@ def get_languages(list_all=False): def get_version_info(): version = None - sha = git("rev-parse", "--short", "HEAD").stdout.decode("utf-8") + buffer = StringIO() + git("rev-parse", "--short", "HEAD", _out=buffer) + sha = buffer.getvalue().strip() try: - version = git("describe", "--tags", "--exact-match").stdout.decode("utf-8").strip() + buffer = StringIO() + git("describe", "--tags", "--exact-match", _out=buffer) + version = buffer.getvalue().strip() except sh.ErrorReturnCode_128: # No exact match pass diff --git a/tools/ci_changes_per_commit.py b/tools/ci_changes_per_commit.py index dd957b2a56..4d71f8e38c 100644 --- a/tools/ci_changes_per_commit.py +++ b/tools/ci_changes_per_commit.py @@ -18,7 +18,7 @@ query ($owner: String!, $name: String!, $pullNumber: Int!, $commitsPerPage: Int! } nodes { commit { - checkSuites(first: 3) { + checkSuites(first: 100) { nodes { conclusion workflowRun { @@ -39,7 +39,7 @@ query ($owner: String!, $name: String!, $pullNumber: Int!, $commitsPerPage: Int! } """ -QUERY_CHECKRUNS = """ +QUERY_CHECK_RUNS = """ query ($checkSuiteID: ID!, $afterFailedRun: String, $afterIncompleteRun: String, $includeFailedRuns: Boolean!, $includeIncompleteRuns: Boolean!) { @@ -92,7 +92,7 @@ query_variables_commits = { } -query_variables_checkruns = { +query_variables_check_runs = { "checkSuiteID": "", "afterFailedRun": None, "afterIncompleteRun": None, @@ -111,13 +111,11 @@ class Query: self.headers = headers def paginate(self, page_info, name): - has_page = ( - page_info["hasNextPage"] if name.startswith("after") else page_info["hasPreviousPage"] - ) + has_page = page_info["hasNextPage" if name.startswith("after") else "hasPreviousPage"] if has_page: - self.variables[name] = ( - page_info["endCursor"] if name.startswith("after") else page_info["startCursor"] - ) + self.variables[name] = page_info[ + "endCursor" if name.startswith("after") else "startCursor" + ] return has_page def fetch(self): @@ -129,6 +127,7 @@ class Query: if request.status_code == 200: return request.json() else: + print(request.json()) raise Exception("Query Failed: {}".format(request.status_code)) @@ -140,31 +139,34 @@ def set_output(name, value): print(f"Would set GitHub actions output {name} to '{value}'") -def get_commit_and_checksuite(query_commits): - commits = query_commits.fetch()["data"]["repository"]["pullRequest"]["commits"] - - if commits["totalCount"] > 0: - for commit in reversed(commits["nodes"]): - commit = commit["commit"] - commit_sha = commit["oid"] - if commit_sha == os.environ["EXCLUDE_COMMIT"]: - continue - checksuites = commit["checkSuites"] - if checksuites["totalCount"] > 0: - for checksuite in checksuites["nodes"]: - if checksuite["workflowRun"]["workflow"]["name"] == "Build CI": - return [ - commit_sha, - checksuite["id"] if checksuite["conclusion"] != "SUCCESS" else None, - ] - else: - if query_commits.paginate(commits["pageInfo"], "beforeCommit"): - return get_commit_and_checksuite(query_commits) - - return [None, None] +def get_commit_depth_and_check_suite(query_commits): + commit_depth = 0 + while True: + commits = query_commits.fetch()["data"]["repository"]["pullRequest"]["commits"] + if commits["totalCount"] > 0: + nodes = commits["nodes"] + nodes.reverse() + if nodes[0]["commit"]["oid"] == os.environ["EXCLUDE_COMMIT"]: + nodes.pop(0) + for commit in nodes: + commit_depth += 1 + commit = commit["commit"] + commit_sha = commit["oid"] + check_suites = commit["checkSuites"] + if check_suites["totalCount"] > 0: + for check_suite in check_suites["nodes"]: + if check_suite["workflowRun"]["workflow"]["name"] == "Build CI": + return [ + {"sha": commit_sha, "depth": commit_depth}, + check_suite["id"] + if check_suite["conclusion"] != "SUCCESS" + else None, + ] + if not query_commits.paginate(commits["pageInfo"], "beforeCommit"): + return [None, None] -def append_runs_to_list(runs, list): +def append_runs_to_list(runs, bad_runs_by_matrix): regex_matrix = re.compile("^build-[^ ]+") regex_board = re.compile("\([^ ]+\)$") for run in runs["nodes"]: @@ -172,27 +174,40 @@ def append_runs_to_list(runs, list): res_matrix = regex_matrix.search(name) if res_matrix: matrix = res_matrix.group() - if matrix not in list: - list[matrix] = [] - list[matrix].append(regex_board.search(name).group()[1:-1]) + if matrix not in bad_runs_by_matrix: + bad_runs_by_matrix[matrix] = [] + res_board = regex_board.search(name) + if res_board: + bad_runs_by_matrix[matrix].append(res_board.group()[1:-1]) -def get_bad_checkruns(query_checkruns, list={}): - checkruns = query_checkruns.fetch()["data"]["node"] +def get_bad_check_runs(query_check_runs): + more_pages = True + bad_runs_by_matrix = {} run_types = ["failed", "incomplete"] - paginate = False - for run_type in run_types: - run_type_camel = run_type.capitalize() + "Run" - run_type = run_type + "Runs" + while more_pages: + check_runs = query_check_runs.fetch()["data"]["node"] + more_pages = False - append_runs_to_list(checkruns[run_type], list) + for run_type in run_types: + run_type_camel = run_type.capitalize() + "Run" + run_type = run_type + "Runs" - if query_checkruns.paginate(checkruns[run_type]["pageInfo"], "after" + run_type_camel): - query_checkruns.variables["include" + run_type_camel] = True - paginate = True + append_runs_to_list(check_runs[run_type], bad_runs_by_matrix) - return get_bad_checkruns(query_checkruns, list) if paginate else list + if query_check_runs.paginate( + check_runs[run_type]["pageInfo"], "after" + run_type_camel + ): + query_check_runs.variables["include" + run_type_camel] = True + more_pages = True + + return bad_runs_by_matrix + + +def set_commit(commit): + set_output("commit_sha", commit["sha"]) + set_output("commit_depth", commit["depth"]) def main(): @@ -201,26 +216,26 @@ def main(): "/" ) - commit, checksuite = get_commit_and_checksuite(query_commits) + commit, check_suite = get_commit_depth_and_check_suite(query_commits) - if checksuite is None: - if commit is None: - print("No checkSuites found -> Abort") + if not check_suite: + if commit: + set_commit(commit) else: - set_output("commit", commit) + print("Abort: No check suite found") quit() - query_checkruns = Query(QUERY_CHECKRUNS, query_variables_checkruns, headers) - query_checkruns.variables["checkSuiteID"] = checksuite + query_check_runs = Query(QUERY_CHECK_RUNS, query_variables_check_runs, headers) + query_check_runs.variables["checkSuiteID"] = check_suite - checkruns = get_bad_checkruns(query_checkruns) + check_runs = get_bad_check_runs(query_check_runs) - if len(checkruns) == 0: - print("No checkRuns found -> Abort") + if not check_runs: + print("Abort: No check runs found") quit() - set_output("commit", commit) - set_output("checkruns", json.dumps(checkruns)) + set_commit(commit) + set_output("check_runs", json.dumps(check_runs)) if __name__ == "__main__": diff --git a/tools/ci_check_duplicate_usb_vid_pid.py b/tools/ci_check_duplicate_usb_vid_pid.py index 4e5c48c90d..4d9a0b162e 100644 --- a/tools/ci_check_duplicate_usb_vid_pid.py +++ b/tools/ci_check_duplicate_usb_vid_pid.py @@ -54,6 +54,7 @@ DEFAULT_CLUSTERLIST = { "espressif_esp32s3_devkitc_1_n8", "espressif_esp32s3_devkitc_1_n8r2", "espressif_esp32s3_devkitc_1_n8r8", + "espressif_esp32s3_devkitc_1_n32r8", ], "0x303A:0x7009": [ "espressif_esp32s2_devkitc_1_n4", diff --git a/tools/ci_fetch_deps.py b/tools/ci_fetch_deps.py index 515c3b198f..bdf2967af8 100644 --- a/tools/ci_fetch_deps.py +++ b/tools/ci_fetch_deps.py @@ -1,19 +1,16 @@ -import pathlib -import shlex -import subprocess +import os import sys import time +import shlex +import pathlib +import subprocess -# target will be a board, "test", "docs", "mpy-cross-mac", or "windows" - -target = sys.argv[1] -ref = sys.argv[2] - -print(target, ref) +# Target will be a board, "test", "docs", "mpy-cross-mac", or "windows" +TARGET = sys.argv[1] # Submodules needed by port builds outside of their ports directory. # Should we try and detect these? -port_deps = { +PORT_DEPS = { "atmel-samd": [ "extmod/ulab/", "lib/adafruit_floppy/", @@ -58,71 +55,87 @@ def run(title, command, check=True): try: subprocess.run(shlex.split(command), stderr=subprocess.STDOUT, check=check) finally: - print("Duration:", time.monotonic() - start, flush=True) print("::endgroup::", flush=True) + print("Duration:", time.monotonic() - start, flush=True) -run( - "Fetch back to the start of 2021 to get tag history", - 'git fetch --tags --recurse-submodules=no --shallow-since="2021-07-01" https://github.com/adafruit/circuitpython HEAD', -) -run( - "Fetch back to the start of 2021 to get commit history", - f'git fetch --recurse-submodules=no --shallow-since="2021-07-01" origin {ref}', -) -run("Init submodules", "git submodule init") -run("Submodule status", "git submodule status") +def set_output(name, value): + if "GITHUB_OUTPUT" in os.environ: + with open(os.environ["GITHUB_OUTPUT"], "at") as f: + print(f"{name}={value}", file=f) + else: + print(f"Would set GitHub actions output {name} to '{value}'") -submodules = [] -if target == "test": - submodules = ["extmod/", "lib/", "tools/", "extmod/ulab", "lib/berkeley-db-1.xx"] -elif target == "docs": - # used in .readthedocs.yml to generate RTD - submodules = ["extmod/ulab/", "frozen/"] -elif target == "mpy-cross-mac": - submodules = ["tools/"] # for huffman -elif target == "windows": - # This builds one board from a number of ports so fill out a bunch of submodules - submodules = ["extmod/", "lib/", "tools/", "ports/", "data/nvm.toml/"] -elif target == "website": - submodules = ["tools/adabot/", "frozen/"] -else: - p = list(pathlib.Path(".").glob(f"ports/*/boards/{target}/mpconfigboard.mk")) - if not p: - raise RuntimeError(f"Unsupported target: {target}") +def main(): + submodules = [] + submodules_tags = [] - config = p[0] - # Add the ports folder to init submodules - port_folder = config.parents[2] - port = port_folder.name - submodules.append(str(port_folder)) - submodules.append("tools/") # for huffman - submodules.extend(port_deps[port]) - with config.open() as f: - for line in f.readlines(): - prefix = "FROZEN_MPY_DIRS += $(TOP)/" - if line.startswith(prefix): - lib_folder = line.strip()[len(prefix) :] - # Drop everything after the second folder because the frozen - # folder may be inside the submodule. - if lib_folder.count("/") > 1: - lib_folder = lib_folder.split("/", maxsplit=2) - lib_folder = "/".join(lib_folder[:2]) - submodules.append(lib_folder) + print("Target:", TARGET) -print(submodules) -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}", - check=False, - ) + if TARGET == "scheduler": + # submodules = ["tools/"] + submodules = ["extmod/ulab", "lib/", "tools/"] + elif TARGET == "tests": + submodules = ["extmod/ulab", "lib/", "tools/"] + elif TARGET == "build-doc": + # used in .readthedocs.yml to generate RTD + submodules = ["extmod/ulab", "frozen/"] + elif TARGET == "mpy-cross" or TARGET == "mpy-cross-mac": + submodules = ["tools/"] # for huffman + elif TARGET == "windows": + # This builds one board from a number of ports so fill out a bunch of submodules + submodules = ["extmod/ulab", "lib/", "tools/", "ports/", "data/nvm.toml"] + elif TARGET == "website": + submodules = ["tools/adabot/", "frozen/"] + elif TARGET == "pre-commit": + submodules = ["extmod/ulab"] + else: + p = list(pathlib.Path(".").glob(f"ports/*/boards/{TARGET}/mpconfigboard.mk")) + if not p: + raise RuntimeError(f"Unsupported target: {TARGET}") - run( - "Fetch the submodule sha", - "git submodule foreach 'git fetch --tags --depth 1 origin $sha1 && git checkout -q $sha1'", - ) + config = p[0] + # Add the ports folder to init submodules + port_folder = config.parents[2] + port = port_folder.name + submodules.append(str(port_folder)) + submodules.append("tools/") # for huffman + submodules.extend(PORT_DEPS[port]) + with config.open() as f: + for line in f.readlines(): + prefix = "FROZEN_MPY_DIRS += $(TOP)/" + if line.startswith(prefix): + lib_folder = line.strip()[len(prefix) :] + # Drop everything after the second folder because the frozen + # folder may be inside the submodule. + if lib_folder.count("/") > 1: + lib_folder = lib_folder.split("/", maxsplit=2) + lib_folder = "/".join(lib_folder[:2]) + submodules_tags.append(lib_folder) + + print("Submodule tags[Y]:", submodules_tags) + print("Submodule tags[N]:", submodules) + + if submodules_tags: + run( + "Init the submodules with tags", + f"git submodule update --init {' '.join(submodules_tags)}", + ) + + if submodules: + run( + "Init the submodules without tags", + f"git submodule update --init --depth=1 {' '.join(submodules)}", + ) + + for submodule in submodules_tags: + if submodule.startswith("frozen"): + set_output("frozen_tags", True) + break + else: + set_output("frozen_tags", False) + + +if __name__ == "__main__": + main() diff --git a/tools/ci_set_matrix.py b/tools/ci_set_matrix.py index aeb24b9931..6e7a4f1229 100755 --- a/tools/ci_set_matrix.py +++ b/tools/ci_set_matrix.py @@ -26,6 +26,7 @@ import os import sys import json import pathlib +import subprocess from concurrent.futures import ThreadPoolExecutor tools_dir = pathlib.Path(__file__).resolve().parent @@ -45,11 +46,11 @@ PORT_TO_ARCH = { "atmel-samd": "arm", "broadcom": "aarch", "cxd56": "arm", - "espressif": "espressif", + "espressif": "esp", "litex": "riscv", "mimxrt10xx": "arm", "nrf": "arm", - "raspberrypi": "arm", + "raspberrypi": "rpi", "stm": "arm", } @@ -58,6 +59,9 @@ IGNORE = [ "tools/ci_check_duplicate_usb_vid_pid.py", ] +# Files in these directories never influence board builds +IGNORE_DIRS = ["tests", "docs", ".devcontainer"] + if len(sys.argv) > 1: print("Using files list on commandline") changed_files = sys.argv[1:] @@ -79,7 +83,7 @@ else: last_failed_jobs = json.loads(j) -def set_output(name, value): +def set_output(name: str, value): if "GITHUB_OUTPUT" in os.environ: with open(os.environ["GITHUB_OUTPUT"], "at") as f: print(f"{name}={value}", file=f) @@ -87,7 +91,7 @@ def set_output(name, value): print(f"Would set GitHub actions output {name} to '{value}'") -def set_boards_to_build(build_all): +def set_boards_to_build(build_all: bool): # Get boards in json format boards_info_json = build_board_info.get_board_mapping() all_board_ids = set() @@ -149,8 +153,7 @@ def set_boards_to_build(build_all): if p in IGNORE: continue - # Boards don't run tests or docs so ignore those as well. - if p.startswith("tests") or p.startswith("docs"): + if any([p.startswith(d) for d in IGNORE_DIRS]): continue # As a (nearly) last resort, for some certain files, we compute the settings from the @@ -201,48 +204,63 @@ def set_boards_to_build(build_all): break # Split boards by architecture. - print("Building boards:") - arch_to_boards = {"aarch": [], "arm": [], "riscv": [], "espressif": []} + arch_to_boards = {"aarch": [], "arm": [], "esp": [], "riscv": [], "rpi": []} + + # Append previously failed boards + for arch in arch_to_boards: + arch_to_job = f"build-{arch}" + if arch_to_job in last_failed_jobs: + for board in last_failed_jobs[arch_to_job]: + if not board in boards_to_build: + boards_to_build.append(board) + + build_boards = bool(boards_to_build) + print("Building boards:", build_boards) + set_output("build-boards", build_boards) + + # Append boards according to arch for board in sorted(boards_to_build): - print(" ", board) port = board_to_port.get(board) # A board can appear due to its _deletion_ (rare) # if this happens it's not in `board_to_port`. if not port: continue - arch = PORT_TO_ARCH[port] - arch_to_boards[arch].append(board) + arch_to_boards[PORT_TO_ARCH[port]].append(board) + print(" ", board) # Set the step outputs for each architecture for arch in arch_to_boards: - # Append previous failed jobs - if f"build-{arch}" in last_failed_jobs: - failed_boards = last_failed_jobs[f"build-{arch}"] - for board in failed_boards: - if not board in arch_to_boards[arch]: - print(" ", board) - arch_to_boards[arch].append(board) - # Set Output - set_output(f"boards-{arch}", json.dumps(sorted(arch_to_boards[arch]))) + set_output(f"boards-{arch}", json.dumps(arch_to_boards[arch])) -def set_docs_to_build(build_all): - if "build-doc" in last_failed_jobs: - build_all = True - - doc_match = build_all - if not build_all: - doc_pattern = re.compile( - r"^(?:docs|extmod/ulab|(?:(?:ports/\w+/bindings|shared-bindings)\S+\.c|conf\.py|tools/extract_pyi\.py|requirements-doc\.txt)$)|(?:-stubs|\.(?:md|MD|rst|RST))$" - ) - for p in changed_files: - if doc_pattern.search(p): - doc_match = True - break +def set_docs_to_build(build_doc: bool): + if not build_doc: + if "build-doc" in last_failed_jobs: + build_doc = True + else: + doc_pattern = re.compile( + r"^(?:\.github\/workflows\/|docs|extmod\/ulab|(?:(?:ports\/\w+\/bindings|shared-bindings)\S+\.c|conf\.py|tools\/extract_pyi\.py|requirements-doc\.txt)$)|(?:-stubs|\.(?:md|MD|rst|RST))$" + ) + github_workspace = os.environ.get("GITHUB_WORKSPACE") or "" + github_workspace = github_workspace and github_workspace + "/" + for p in changed_files: + if doc_pattern.search(p) and ( + ( + subprocess.run( + f"git diff -U0 $BASE_SHA...$HEAD_SHA {github_workspace + p} | grep -o -m 1 '^[+-]\/\/|'", + capture_output=True, + shell=True, + ).stdout + ) + if p.endswith(".c") + else True + ): + build_doc = True + break # Set the step outputs - print("Building docs:", doc_match) - set_output("build-doc", doc_match) + print("Building docs:", build_doc) + set_output("build-doc", build_doc) def check_changed_files(): diff --git a/tools/codeformat.py b/tools/codeformat.py index 223c2bad45..f76e5f0681 100644 --- a/tools/codeformat.py +++ b/tools/codeformat.py @@ -71,6 +71,7 @@ EXCLUSIONS = [ "ports/raspberrypi/lwip_src", ] + # None of the standard Python path matching routines implement the matching # we want, which is most like git's "pathspec" version of globs. # In particular, we want "**/" to match all directories. diff --git a/tools/describe b/tools/describe index e20c2ffa44..0f3b541e3c 100755 --- a/tools/describe +++ b/tools/describe @@ -1,3 +1,6 @@ #!/bin/sh -# Add any supplied arguments. -git describe --first-parent --dirty --tags --match "[1-9].*" "$@" +if [ -z "$CP_VERSION" ]; then + git describe --first-parent --dirty --tags --match "[1-9].*" "$@" +else + echo $CP_VERSION +fi diff --git a/tools/extract_pyi.py b/tools/extract_pyi.py index 7b87404fbc..e6bc703c02 100644 --- a/tools/extract_pyi.py +++ b/tools/extract_pyi.py @@ -215,7 +215,7 @@ def convert_folder(top_level, stub_directory): return (ok, total) error = False - for (level, msg) in find_stub_issues(tree): + for level, msg in find_stub_issues(tree): if level == "ERROR": error = True print(f"[{level}] {msg}") @@ -228,7 +228,8 @@ def convert_folder(top_level, stub_directory): imports, type_imports = extract_imports(tree) import_lines = ["from __future__ import annotations"] for type_module, used_types in type_imports.items(): - import_lines.append(f"from {type_module} import {', '.join(sorted(used_types))}") + if used_types: + import_lines.append(f"from {type_module} import {', '.join(sorted(used_types))}") import_lines.extend(f"import {m}" for m in sorted(imports)) import_body = "\n".join(import_lines) m = re.match(r'(\s*""".*?""")', stub_contents, flags=re.DOTALL) diff --git a/tools/gen_crt_bundle.py b/tools/gen_crt_bundle.py index eb314bf25e..da0d8837a9 100755 --- a/tools/gen_crt_bundle.py +++ b/tools/gen_crt_bundle.py @@ -72,7 +72,6 @@ class CertificateBundle: os.remove(ca_bundle_bin_file) def add_from_path(self, crts_path): - found = False for file_path in os.listdir(crts_path): found |= self.add_from_file(os.path.join(crts_path, file_path)) @@ -161,7 +160,6 @@ class CertificateBundle: return bundle def add_with_filter(self, crts_path, filter_path): - filter_set = set() with open(filter_path, "r", encoding="utf-8") as f: csv_reader = csv.reader(f, delimiter=",") diff --git a/tools/gendoc.py b/tools/gendoc.py index bf79b3cf5f..f3df853e49 100644 --- a/tools/gendoc.py +++ b/tools/gendoc.py @@ -11,6 +11,7 @@ import argparse import re import markdown + # given a list of (name,regex) pairs, find the first one that matches the given line def re_match_first(regexs, line): for name, regex in regexs: diff --git a/tools/mpy-tool.py b/tools/mpy-tool.py index 32b064d35f..02ea656c99 100755 --- a/tools/mpy-tool.py +++ b/tools/mpy-tool.py @@ -107,6 +107,7 @@ MP_BC_LOAD_GLOBAL = 0x12 MP_BC_LOAD_ATTR = 0x13 MP_BC_STORE_ATTR = 0x18 + # this function mirrors that in py/bc.c def mp_opcode_format(bytecode, ip, count_var_uint): opcode = bytecode[ip] diff --git a/tools/msgfmt.py b/tools/msgfmt.py new file mode 100644 index 0000000000..1ed594b84f --- /dev/null +++ b/tools/msgfmt.py @@ -0,0 +1,244 @@ +#! /usr/bin/env python3 +# Written by Martin v. Löwis + +"""Generate binary message catalog from textual translation description. +This program converts a textual Uniforum-style message catalog (.po file) into +a binary GNU catalog (.mo file). This is essentially the same function as the +GNU msgfmt program, however, it is a simpler implementation. Currently it +does not handle plural forms but it does handle message contexts. +Usage: msgfmt.py [OPTIONS] filename.po +Options: + -o file + --output-file=file + Specify the output file to write to. If omitted, output will go to a + file named filename.mo (based off the input file name). + -h + --help + Print this message and exit. + -V + --version + Display version information and exit. +""" + +import os +import sys +import ast +import getopt +import struct +import array +from email.parser import HeaderParser + +__version__ = "1.2" + +MESSAGES = {} + + +def usage(code, msg=""): + print(__doc__, file=sys.stderr) + if msg: + print(msg, file=sys.stderr) + sys.exit(code) + + +def add(ctxt, id, str, fuzzy): + "Add a non-fuzzy translation to the dictionary." + global MESSAGES + if not fuzzy and str: + if ctxt is None: + MESSAGES[id] = str + else: + MESSAGES[b"%b\x04%b" % (ctxt, id)] = str + + +def generate(): + "Return the generated output." + global MESSAGES + # the keys are sorted in the .mo file + keys = sorted(MESSAGES.keys()) + offsets = [] + ids = strs = b"" + for id in keys: + # For each string, we need size and file offset. Each string is NUL + # terminated; the NUL does not count into the size. + offsets.append((len(ids), len(id), len(strs), len(MESSAGES[id]))) + ids += id + b"\0" + strs += MESSAGES[id] + b"\0" + output = "" + # The header is 7 32-bit unsigned integers. We don't use hash tables, so + # the keys start right after the index tables. + # translated string. + keystart = 7 * 4 + 16 * len(keys) + # and the values start after the keys + valuestart = keystart + len(ids) + koffsets = [] + voffsets = [] + # The string table first has the list of keys, then the list of values. + # Each entry has first the size of the string, then the file offset. + for o1, l1, o2, l2 in offsets: + koffsets += [l1, o1 + keystart] + voffsets += [l2, o2 + valuestart] + offsets = koffsets + voffsets + output = struct.pack( + "Iiiiiii", + 0x950412DE, # Magic + 0, # Version + len(keys), # # of entries + 7 * 4, # start of key index + 7 * 4 + len(keys) * 8, # start of value index + 0, + 0, + ) # size and offset of hash table + output += array.array("i", offsets).tobytes() + output += ids + output += strs + return output + + +def make(filename, outfile): + ID = 1 + STR = 2 + CTXT = 3 + + # Compute .mo name from .po name and arguments + if filename.endswith(".po"): + infile = filename + else: + infile = filename + ".po" + if outfile is None: + outfile = os.path.splitext(infile)[0] + ".mo" + + try: + with open(infile, "rb") as f: + lines = f.readlines() + except IOError as msg: + print(msg, file=sys.stderr) + sys.exit(1) + + section = msgctxt = None + fuzzy = 0 + + # Start off assuming Latin-1, so everything decodes without failure, + # until we know the exact encoding + encoding = "latin-1" + + # Parse the catalog + lno = 0 + for l in lines: + l = l.decode(encoding) + lno += 1 + # If we get a comment line after a msgstr, this is a new entry + if l[0] == "#" and section == STR: + add(msgctxt, msgid, msgstr, fuzzy) + section = msgctxt = None + fuzzy = 0 + # Record a fuzzy mark + if l[:2] == "#," and "fuzzy" in l: + fuzzy = 1 + # Skip comments + if l[0] == "#": + continue + # Now we are in a msgid or msgctxt section, output previous section + if l.startswith("msgctxt"): + if section == STR: + add(msgctxt, msgid, msgstr, fuzzy) + section = CTXT + l = l[7:] + msgctxt = b"" + elif l.startswith("msgid") and not l.startswith("msgid_plural"): + if section == STR: + add(msgctxt, msgid, msgstr, fuzzy) + if not msgid: + # See whether there is an encoding declaration + p = HeaderParser() + charset = p.parsestr(msgstr.decode(encoding)).get_content_charset() + if charset: + encoding = charset + section = ID + l = l[5:] + msgid = msgstr = b"" + is_plural = False + # This is a message with plural forms + elif l.startswith("msgid_plural"): + if section != ID: + print( + "msgid_plural not preceded by msgid on %s:%d" % (infile, lno), file=sys.stderr + ) + sys.exit(1) + l = l[12:] + msgid += b"\0" # separator of singular and plural + is_plural = True + # Now we are in a msgstr section + elif l.startswith("msgstr"): + section = STR + if l.startswith("msgstr["): + if not is_plural: + print("plural without msgid_plural on %s:%d" % (infile, lno), file=sys.stderr) + sys.exit(1) + l = l.split("]", 1)[1] + if msgstr: + msgstr += b"\0" # Separator of the various plural forms + else: + if is_plural: + print( + "indexed msgstr required for plural on %s:%d" % (infile, lno), + file=sys.stderr, + ) + sys.exit(1) + l = l[6:] + # Skip empty lines + l = l.strip() + if not l: + continue + l = ast.literal_eval(l) + if section == CTXT: + msgctxt += l.encode(encoding) + elif section == ID: + msgid += l.encode(encoding) + elif section == STR: + msgstr += l.encode(encoding) + else: + print("Syntax error on %s:%d" % (infile, lno), "before:", file=sys.stderr) + print(l, file=sys.stderr) + sys.exit(1) + # Add last entry + if section == STR: + add(msgctxt, msgid, msgstr, fuzzy) + + # Compute output + output = generate() + + try: + with open(outfile, "wb") as f: + f.write(output) + except IOError as msg: + print(msg, file=sys.stderr) + + +def main(): + try: + opts, args = getopt.getopt(sys.argv[1:], "hVo:", ["help", "version", "output-file="]) + except getopt.error as msg: + usage(1, msg) + + outfile = None + # parse options + for opt, arg in opts: + if opt in ("-h", "--help"): + usage(0) + elif opt in ("-V", "--version"): + print("msgfmt.py", __version__) + sys.exit(0) + elif opt in ("-o", "--output-file"): + outfile = arg + # do it + if not args: + print("No input file given", file=sys.stderr) + print("Try `msgfmt --help' for more information.", file=sys.stderr) + return + + for filename in args: + make(filename, outfile) + + +if __name__ == "__main__": + main() diff --git a/tools/preprocess_frozen_modules.py b/tools/preprocess_frozen_modules.py index 30263d2e02..6c41c4cd43 100755 --- a/tools/preprocess_frozen_modules.py +++ b/tools/preprocess_frozen_modules.py @@ -46,7 +46,6 @@ def version_string(path=None, *, valid_semver=False): # with actual version info derived from git. def copy_and_process(in_dir, out_dir): for root, subdirs, files in os.walk(in_dir): - # Skip library examples directory and subfolders. relative_path_parts = Path(root).relative_to(in_dir).parts if relative_path_parts and relative_path_parts[0] in [