diff --git a/.github/actions/fetch_submodules/action.yml b/.github/actions/fetch_submodules/action.yml new file mode 100644 index 0000000000..407259967c --- /dev/null +++ b/.github/actions/fetch_submodules/action.yml @@ -0,0 +1,82 @@ +name: 'Fetch Submodules' + +inputs: + submodules: + description: 'The submodules to cache' + required: false + default: '["extmod/ulab", "lib/", "tools/"]' + type: string + + cache: + description: 'The cache action to use' + required: false + default: 'restore' + type: choice + options: + - cache + - restore + + version: + description: 'Whether to generate CP version' + required: false + default: false + type: boolean + +outputs: + frozen: + description: 'Whether frozen submodules were fetched' + value: ${{ steps.cp-deps.outputs.frozen_tags }} + + version: + description: 'The CP version' + value: ${{ steps.cp-version.outputs.cp-version }} + +runs: + using: "composite" + steps: + - name: Create submodule status + id: create-submodule-status + run: | + git submodule status ${{ join(fromJSON(inputs.submodules), ' ') }} >> submodule_status + echo $(cut -d ' ' -f 2 submodule_status) | echo "submodules=[\"$(sed "s/ /\", \"/g")\"]" >> $GITHUB_OUTPUT + shell: bash + + - name: Cache submodules + if: ${{ inputs.cache == 'cache' }} + uses: actions/cache@v3 + with: + path: ".git/modules/\n${{ join(fromJSON(steps.create-submodule-status.outputs.submodules), '\n') }}" + key: submodules-common-${{ hashFiles('submodule_status') }} + enableCrossOsArchive: true + + - name: Restore submodules + if: ${{ inputs.cache == 'restore' }} + uses: actions/cache/restore@v3 + with: + path: ".git/modules/\n${{ join(fromJSON(steps.create-submodule-status.outputs.submodules), '\n') }}" + key: submodules-common-${{ hashFiles('submodule_status') }} + enableCrossOsArchive: true + + - name: Remove submodule status + run: rm submodule_status + shell: bash + + - name: CircuitPython dependencies + id: cp-deps + run: python tools/ci_fetch_deps.py ${{ matrix.board || github.job }} + shell: bash + + - name: CircuitPython version + id: cp-version + if: ${{ inputs.version == 'true' }} + run: | + echo "::group::Fetch history and tags" + git fetch --no-recurse-submodules --shallow-since="2021-07-01" --tags https://github.com/adafruit/circuitpython HEAD + git fetch --no-recurse-submodules --shallow-since="2021-07-01" origin $GITHUB_SHA + git repack -d + echo "::endgroup::" + CP_VERSION=$(tools/describe) + echo "$CP_VERSION" + echo "CP_VERSION=$CP_VERSION" >> $GITHUB_ENV + echo "cp-version=$CP_VERSION" >> $GITHUB_OUTPUT + shell: bash diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index b1f9698d4a..f7d57041e6 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -21,41 +21,43 @@ jobs: 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 }} boards-aarch: ${{ steps.set-matrix.outputs.boards-aarch }} + boards-arm: ${{ steps.set-matrix.outputs.boards-arm }} + boards-espressif: ${{ steps.set-matrix.outputs.boards-espressif }} + boards-riscv: ${{ steps.set-matrix.outputs.boards-riscv }} + cp-version: ${{ steps.set-up-submodules.outputs.version }} steps: - name: Dump GitHub context run: echo "$GITHUB_CONTEXT" env: GITHUB_CONTEXT: ${{ toJson(github) }} - - 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.x" - - 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: Duplicate USB VID/PID check + run: python3 -u -m tools.ci_check_duplicate_usb_vid_pid + - name: Set up submodules + id: set-up-submodules + uses: ./.github/actions/fetch_submodules + with: + cache: "cache" + version: true - 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 + pip install -r requirements-dev.txt - name: Versions run: | gcc --version python3 --version - - 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 @@ -114,13 +116,16 @@ jobs: 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')) + - 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')) env: AWS_PAGER: '' AWS_ACCESS_KEY_ID: ${{ secrets.AWS_ACCESS_KEY_ID }} AWS_SECRET_ACCESS_KEY: ${{ secrets.AWS_SECRET_ACCESS_KEY }} run: | + pip install awscli [ -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 @@ -160,29 +165,26 @@ jobs: mpy-cross-mac: runs-on: macos-11 + needs: test + if: >- + needs.test.outputs.boards-aarch != '[]' || + needs.test.outputs.boards-arm != '[]' || + needs.test.outputs.boards-espressif != '[]' || + needs.test.outputs.boards-riscv != '[]' + env: + CP_VERSION: ${{ needs.test.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/fetch_submodules - name: Versions run: | gcc --version @@ -219,30 +221,29 @@ jobs: build-doc: - runs-on: ubuntu-20.04 + runs-on: ubuntu-22.04 needs: test if: ${{ needs.test.outputs.build-doc == 'True' }} + env: + CP_VERSION: ${{ needs.test.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/fetch_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 + pip install -r requirements-doc.txt - name: Build and Validate Stubs run: make check-stubs -j2 - uses: actions/upload-artifact@v3 @@ -262,13 +263,16 @@ 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')) + - 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')) env: AWS_PAGER: '' AWS_ACCESS_KEY_ID: ${{ secrets.AWS_ACCESS_KEY_ID }} AWS_SECRET_ACCESS_KEY: ${{ secrets.AWS_SECRET_ACCESS_KEY }} run: | + pip install awscli 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 @@ -282,225 +286,33 @@ jobs: [ -z "$TWINE_USERNAME" ] || twine upload circuitpython-stubs/dist/* - 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')) - - - 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')) - - - 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: git submodule update --init $IDF_PATH - env: - IDF_PATH: ${{ github.workspace }}/ports/espressif/esp-idf - - name: Install IDF tools - 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 - 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 - 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 + runs-on: ubuntu-22.04 needs: test + if: ${{ needs.test.outputs.boards-aarch != '[]' }} + env: + CP_VERSION: ${{ needs.test.outputs.cp-version }} 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 + - 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 ${{ matrix.board }} ${{ github.sha }} + - name: Set up python + uses: actions/setup-python@v4 + with: + python-version: "3.x" + - name: Set up submodules + id: set-up-submodules + uses: ./.github/actions/fetch_submodules - name: Install dependencies run: | sudo apt-get install -y gettext mtools - pip install -r requirements-ci.txt -r requirements-dev.txt + pip install -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 @@ -522,11 +334,12 @@ jobs: arm-none-eabi-gcc --version python3 --version mkfs.fat --version || true - - name: mpy-cross + - name: Build mpy-cross + if: ${{ steps.set-up-submodules.outputs.frozen == 'True' }} run: make -C mpy-cross -j2 - name: Setup build failure matcher run: echo "::add-matcher::$GITHUB_WORKSPACE/.github/workflows/match-build-fail.json" - - name: build + - name: Build run: python3 -u build_release_files.py working-directory: tools env: @@ -536,9 +349,231 @@ jobs: 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" + 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: | + pip install awscli + [ -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 }} + + + build-arm: + runs-on: ubuntu-22.04 + needs: test + if: ${{ needs.test.outputs.boards-arm != '[]' }} + env: + CP_VERSION: ${{ needs.test.outputs.cp-version }} + strategy: + fail-fast: false + matrix: + board: ${{ fromJSON(needs.test.outputs.boards-arm) }} + 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 + id: set-up-submodules + uses: ./.github/actions/fetch_submodules + - 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-dev.txt + - name: Versions + run: | + gcc --version + arm-none-eabi-gcc --version + python3 --version + - name: Build mpy-cross + if: ${{ steps.set-up-submodules.outputs.frozen == 'True' }} + run: make -C mpy-cross -j2 + - name: Setup build failure matcher + run: echo "::add-matcher::$GITHUB_WORKSPACE/.github/workflows/match-build-fail.json" + - 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 + 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: | + pip install awscli + [ -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 }} + + + build-espressif: + runs-on: ubuntu-22.04 + needs: test + if: ${{ needs.test.outputs.boards-espressif != '[]' }} + env: + CP_VERSION: ${{ needs.test.outputs.cp-version }} + IDF_PATH: ${{ github.workspace }}/ports/espressif/esp-idf + IDF_TOOLS_PATH: ${{ github.workspace }}/.idf_tools + strategy: + fail-fast: false + matrix: + board: ${{ fromJSON(needs.test.outputs.boards-espressif) }} + steps: + - name: Set up repository + uses: actions/checkout@v3 + with: + submodules: false + fetch-depth: 1 + - name: Set up python + id: setup-python + uses: actions/setup-python@v4 + with: + python-version: "3.10" + - 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 + - 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 }}-Python-${{ steps.setup-python.outputs.python-version }}-tools-idf-${{ steps.idf-commit.outputs.commit }} + - name: Initialize IDF submodules + run: git submodule update --init --depth=1 --recursive $IDF_PATH + - name: Install IDF tools + 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 + - name: Set up submodules + id: set-up-submodules + uses: ./.github/actions/fetch_submodules + - name: Install dependencies + run: | + source $IDF_PATH/export.sh + sudo apt-get install -y gettext ninja-build + pip install -r requirements-dev.txt + - name: Versions + run: | + source $IDF_PATH/export.sh + gcc --version + python3 --version + ninja --version + cmake --version + - name: Build mpy-cross + if: ${{ steps.set-up-submodules.outputs.frozen == 'True' }} + run: make -C mpy-cross -j2 + - name: Setup build failure matcher + run: echo "::add-matcher::$GITHUB_WORKSPACE/.github/workflows/match-build-fail.json" + - name: Build + run: | + source $IDF_PATH/export.sh + 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 + 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: | + pip install awscli + [ -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 }} + + + build-riscv: + runs-on: ubuntu-22.04 + needs: test + if: ${{ needs.test.outputs.boards-riscv != '[]' }} + env: + CP_VERSION: ${{ needs.test.outputs.cp-version }} + strategy: + fail-fast: false + matrix: + board: ${{ fromJSON(needs.test.outputs.boards-riscv) }} + 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 + id: set-up-submodules + uses: ./.github/actions/fetch_submodules + - name: Install dependencies + run: | + sudo apt-get install -y gettext + pip install -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: Build mpy-cross + if: ${{ steps.set-up-submodules.outputs.frozen == 'True' }} + run: make -C mpy-cross -j2 + - name: Setup build failure matcher + run: echo "::add-matcher::$GITHUB_WORKSPACE/.github/workflows/match-build-fail.json" + - 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 + 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: | + pip install awscli + [ -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')) diff --git a/.github/workflows/create_website_pr.yml b/.github/workflows/create_website_pr.yml index 75de556c68..19004d9bea 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.x" - - name: Get CP deps - run: python tools/ci_fetch_deps.py website ${{ github.sha }} - - name: Install deps - run: | - pip install -r requirements-dev.txt + - name: Set up submodules + uses: ./.github/actions/fetch_submodules + with: + version: true + - name: Install dependencies + run: pip install -r requirements-dev.txt - 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..66d09c2418 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/fetch_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 a23dcd1d11..02aed6e9b4 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.x" - - name: Install deps + - name: CircuitPython dependencies + run: python tools/ci_fetch_deps.py ${{ github.job }} + - name: Install dependencies 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 + - 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/.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/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/extmod/ulab b/extmod/ulab index e68bb707b2..f2dd2230c4 160000 --- a/extmod/ulab +++ b/extmod/ulab @@ -1 +1 @@ -Subproject commit e68bb707b20ee326d84ab75fc9fb35f2e85b87e3 +Subproject commit f2dd2230c4fdf1aa5c7a160782efdde18e8204bb 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/locale/ID.po b/locale/ID.po index 962284a846..546828a14d 100644 --- a/locale/ID.po +++ b/locale/ID.po @@ -671,6 +671,7 @@ msgstr "Pin bus %d sudah digunakan" #: ports/espressif/boards/m5stack_core_basic/mpconfigboard.h #: ports/espressif/boards/m5stack_core_fire/mpconfigboard.h +#: ports/espressif/boards/m5stack_stick_c/mpconfigboard.h msgid "Button A was pressed at start up.\n" msgstr "" @@ -2509,6 +2510,10 @@ msgstr "" msgid "array has too many dimensions" msgstr "" +#: extmod/ulab/code/ndarray.c +msgid "array is too big" +msgstr "" + #: py/objarray.c shared-bindings/alarm/SleepMemory.c #: shared-bindings/memorymap/AddressRange.c shared-bindings/nvm/ByteArray.c msgid "array/bytes required on right side" @@ -2937,6 +2942,10 @@ msgstr "" msgid "div/mod not implemented for uint" msgstr "" +#: extmod/ulab/code/numpy/create.c +msgid "divide by zero" +msgstr "" + #: py/runtime.c msgid "division by zero" msgstr "" @@ -2978,9 +2987,9 @@ msgstr "" msgid "error = 0x%08lX" msgstr "error = 0x%08lX" -#: ports/espressif/common-hal/esp32_camera/Camera.c +#: ports/espressif/common-hal/espcamera/Camera.c msgid "" -"esp32_camera.Camera requires reserved PSRAM to be configured. See the " +"espcamera.Camera requires reserved PSRAM to be configured. See the " "documentation for instructions." msgstr "" @@ -3357,7 +3366,7 @@ msgstr "key tidak valid" msgid "invalid micropython decorator" msgstr "micropython decorator tidak valid" -#: ports/espressif/common-hal/esp32_camera/Camera.c +#: ports/espressif/common-hal/espcamera/Camera.c msgid "invalid setting" msgstr "" @@ -3614,7 +3623,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 "" @@ -3751,6 +3760,10 @@ msgstr "" msgid "only mono is supported" msgstr "" +#: extmod/ulab/code/numpy/create.c +msgid "only ndarrays can be concatenated" +msgstr "" + #: ports/stm/common-hal/audiobusio/PDMIn.c msgid "only oversample=64 is supported" msgstr "" diff --git a/locale/circuitpython.pot b/locale/circuitpython.pot index da9e0ac0f2..10993652aa 100644 --- a/locale/circuitpython.pot +++ b/locale/circuitpython.pot @@ -2485,6 +2485,10 @@ msgstr "" msgid "array has too many dimensions" msgstr "" +#: extmod/ulab/code/ndarray.c +msgid "array is too big" +msgstr "" + #: py/objarray.c shared-bindings/alarm/SleepMemory.c #: shared-bindings/memorymap/AddressRange.c shared-bindings/nvm/ByteArray.c msgid "array/bytes required on right side" @@ -2913,6 +2917,10 @@ msgstr "" msgid "div/mod not implemented for uint" msgstr "" +#: extmod/ulab/code/numpy/create.c +msgid "divide by zero" +msgstr "" + #: py/runtime.c msgid "division by zero" msgstr "" @@ -2954,9 +2962,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 "" @@ -3333,7 +3341,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 "" @@ -3590,7 +3598,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 +3734,10 @@ msgstr "" msgid "only mono is supported" msgstr "" +#: extmod/ulab/code/numpy/create.c +msgid "only ndarrays can be concatenated" +msgstr "" + #: ports/stm/common-hal/audiobusio/PDMIn.c msgid "only oversample=64 is supported" msgstr "" diff --git a/locale/cs.po b/locale/cs.po index 4b49cbe531..51ed1674f7 100644 --- a/locale/cs.po +++ b/locale/cs.po @@ -672,6 +672,7 @@ msgstr "Sběrnicový pin %d je již používán" #: ports/espressif/boards/m5stack_core_basic/mpconfigboard.h #: ports/espressif/boards/m5stack_core_fire/mpconfigboard.h +#: ports/espressif/boards/m5stack_stick_c/mpconfigboard.h msgid "Button A was pressed at start up.\n" msgstr "" @@ -2496,6 +2497,10 @@ msgstr "" msgid "array has too many dimensions" msgstr "" +#: extmod/ulab/code/ndarray.c +msgid "array is too big" +msgstr "" + #: py/objarray.c shared-bindings/alarm/SleepMemory.c #: shared-bindings/memorymap/AddressRange.c shared-bindings/nvm/ByteArray.c msgid "array/bytes required on right side" @@ -2924,6 +2929,10 @@ msgstr "" msgid "div/mod not implemented for uint" msgstr "" +#: extmod/ulab/code/numpy/create.c +msgid "divide by zero" +msgstr "" + #: py/runtime.c msgid "division by zero" msgstr "" @@ -2965,9 +2974,9 @@ msgstr "" msgid "error = 0x%08lX" msgstr "" -#: ports/espressif/common-hal/esp32_camera/Camera.c +#: ports/espressif/common-hal/espcamera/Camera.c msgid "" -"esp32_camera.Camera requires reserved PSRAM to be configured. See the " +"espcamera.Camera requires reserved PSRAM to be configured. See the " "documentation for instructions." msgstr "" @@ -3344,7 +3353,7 @@ msgstr "" msgid "invalid micropython decorator" msgstr "" -#: ports/espressif/common-hal/esp32_camera/Camera.c +#: ports/espressif/common-hal/espcamera/Camera.c msgid "invalid setting" msgstr "" @@ -3601,7 +3610,7 @@ msgstr "" msgid "no response from SD card" msgstr "" -#: ports/espressif/common-hal/esp32_camera/Camera.c py/objobject.c py/runtime.c +#: ports/espressif/common-hal/espcamera/Camera.c py/objobject.c py/runtime.c msgid "no such attribute" msgstr "" @@ -3737,6 +3746,10 @@ msgstr "" msgid "only mono is supported" msgstr "" +#: extmod/ulab/code/numpy/create.c +msgid "only ndarrays can be concatenated" +msgstr "" + #: ports/stm/common-hal/audiobusio/PDMIn.c msgid "only oversample=64 is supported" msgstr "" diff --git a/locale/de_DE.po b/locale/de_DE.po index 1a3bdbca56..594e2005cc 100644 --- a/locale/de_DE.po +++ b/locale/de_DE.po @@ -675,6 +675,7 @@ msgstr "Bus-Pin %d wird schon benutzt" #: ports/espressif/boards/m5stack_core_basic/mpconfigboard.h #: ports/espressif/boards/m5stack_core_fire/mpconfigboard.h +#: ports/espressif/boards/m5stack_stick_c/mpconfigboard.h msgid "Button A was pressed at start up.\n" msgstr "Beim Starten wurde Taste A gedrückt.\n" @@ -2554,6 +2555,10 @@ msgstr "Array- und Indexlänge müssen gleich sein" msgid "array has too many dimensions" msgstr "Das Array hat zu viele Dimensionen" +#: extmod/ulab/code/ndarray.c +msgid "array is too big" +msgstr "" + #: py/objarray.c shared-bindings/alarm/SleepMemory.c #: shared-bindings/memorymap/AddressRange.c shared-bindings/nvm/ByteArray.c msgid "array/bytes required on right side" @@ -2994,6 +2999,10 @@ msgstr "Abmessungen stimmen nicht überein" msgid "div/mod not implemented for uint" msgstr "div/mod für uint nicht implementiert" +#: extmod/ulab/code/numpy/create.c +msgid "divide by zero" +msgstr "durch Null dividieren" + #: py/runtime.c msgid "division by zero" msgstr "Division durch Null" @@ -3035,13 +3044,11 @@ msgstr "epoch_time wird auf diesem Board nicht unterstützt" msgid "error = 0x%08lX" msgstr "Fehler = 0x%08lX" -#: ports/espressif/common-hal/esp32_camera/Camera.c +#: ports/espressif/common-hal/espcamera/Camera.c msgid "" -"esp32_camera.Camera requires reserved PSRAM to be configured. See the " +"espcamera.Camera requires reserved PSRAM to be configured. See the " "documentation for instructions." msgstr "" -"esp32_camera.Camera benötigt reservierten PSRAM um konfiguriert werden zu " -"können. Sieh in der Dokumentation für eine Anleitung nach." #: py/runtime.c msgid "exceptions must derive from BaseException" @@ -3418,7 +3425,7 @@ msgstr "ungültiger Schlüssel" msgid "invalid micropython decorator" msgstr "ungültiger micropython decorator" -#: ports/espressif/common-hal/esp32_camera/Camera.c +#: ports/espressif/common-hal/espcamera/Camera.c msgid "invalid setting" msgstr "Invalide Einstellung" @@ -3681,7 +3688,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" @@ -3819,6 +3826,10 @@ msgstr "nur eine bit_depth=16 wird unterstützt" msgid "only mono is supported" msgstr "nur Mono wird unterstützt" +#: extmod/ulab/code/numpy/create.c +msgid "only ndarrays can be concatenated" +msgstr "" + #: ports/stm/common-hal/audiobusio/PDMIn.c msgid "only oversample=64 is supported" msgstr "" @@ -4431,6 +4442,13 @@ msgstr "zi muss eine Gleitkommazahl sein" msgid "zi must be of shape (n_section, 2)" msgstr "zi muss die Form (n_section, 2) haben" +#~ msgid "" +#~ "esp32_camera.Camera requires reserved PSRAM to be configured. See the " +#~ "documentation for instructions." +#~ msgstr "" +#~ "esp32_camera.Camera benötigt reservierten PSRAM um konfiguriert werden zu " +#~ "können. Sieh in der Dokumentation für eine Anleitung nach." + #~ msgid "%q must be of type %q" #~ msgstr "%q muss vom Type %q sein" @@ -4499,9 +4517,6 @@ msgstr "zi muss die Form (n_section, 2) haben" #~ msgid "complex division by zero" #~ msgstr "Komplexe Division durch null" -#~ msgid "divide by zero" -#~ msgstr "durch Null dividieren" - #~ msgid "int() arg 2 must be >= 2 and <= 36" #~ msgstr "int() arg 2 muss >= 2 und <= 36 sein" diff --git a/locale/el.po b/locale/el.po index f48b8e08db..7c816d4a9f 100644 --- a/locale/el.po +++ b/locale/el.po @@ -678,6 +678,7 @@ msgstr "Bus pin %d είναι ήδη σε χρήση" #: ports/espressif/boards/m5stack_core_basic/mpconfigboard.h #: ports/espressif/boards/m5stack_core_fire/mpconfigboard.h +#: ports/espressif/boards/m5stack_stick_c/mpconfigboard.h msgid "Button A was pressed at start up.\n" msgstr "" @@ -2505,6 +2506,10 @@ msgstr "" msgid "array has too many dimensions" msgstr "" +#: extmod/ulab/code/ndarray.c +msgid "array is too big" +msgstr "" + #: py/objarray.c shared-bindings/alarm/SleepMemory.c #: shared-bindings/memorymap/AddressRange.c shared-bindings/nvm/ByteArray.c msgid "array/bytes required on right side" @@ -2933,6 +2938,10 @@ msgstr "" msgid "div/mod not implemented for uint" msgstr "" +#: extmod/ulab/code/numpy/create.c +msgid "divide by zero" +msgstr "" + #: py/runtime.c msgid "division by zero" msgstr "" @@ -2974,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 "" @@ -3353,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 "" @@ -3610,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 "" @@ -3746,6 +3755,10 @@ msgstr "" msgid "only mono is supported" msgstr "" +#: extmod/ulab/code/numpy/create.c +msgid "only ndarrays can be concatenated" +msgstr "" + #: ports/stm/common-hal/audiobusio/PDMIn.c msgid "only oversample=64 is supported" msgstr "" diff --git a/locale/en_GB.po b/locale/en_GB.po index dee3f6f4c3..ece9ec14f3 100644 --- a/locale/en_GB.po +++ b/locale/en_GB.po @@ -675,6 +675,7 @@ msgstr "Bus pin %d is already in use" #: ports/espressif/boards/m5stack_core_basic/mpconfigboard.h #: ports/espressif/boards/m5stack_core_fire/mpconfigboard.h +#: ports/espressif/boards/m5stack_stick_c/mpconfigboard.h msgid "Button A was pressed at start up.\n" msgstr "" @@ -2512,6 +2513,10 @@ msgstr "array and index length must be equal" msgid "array has too many dimensions" msgstr "" +#: extmod/ulab/code/ndarray.c +msgid "array is too big" +msgstr "" + #: py/objarray.c shared-bindings/alarm/SleepMemory.c #: shared-bindings/memorymap/AddressRange.c shared-bindings/nvm/ByteArray.c msgid "array/bytes required on right side" @@ -2943,6 +2948,10 @@ msgstr "dimensions do not match" msgid "div/mod not implemented for uint" msgstr "div/mod not implemented for uint" +#: extmod/ulab/code/numpy/create.c +msgid "divide by zero" +msgstr "divide by zero" + #: py/runtime.c msgid "division by zero" msgstr "division by zero" @@ -2984,9 +2993,9 @@ msgstr "epoch_time not supported on this board" msgid "error = 0x%08lX" msgstr "error = 0x%08lX" -#: ports/espressif/common-hal/esp32_camera/Camera.c +#: ports/espressif/common-hal/espcamera/Camera.c msgid "" -"esp32_camera.Camera requires reserved PSRAM to be configured. See the " +"espcamera.Camera requires reserved PSRAM to be configured. See the " "documentation for instructions." msgstr "" @@ -3363,7 +3372,7 @@ msgstr "invalid key" msgid "invalid micropython decorator" msgstr "invalid micropython decorator" -#: ports/espressif/common-hal/esp32_camera/Camera.c +#: ports/espressif/common-hal/espcamera/Camera.c msgid "invalid setting" msgstr "" @@ -3620,7 +3629,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" @@ -3756,6 +3765,10 @@ msgstr "only bit_depth=16 is supported" msgid "only mono is supported" msgstr "" +#: extmod/ulab/code/numpy/create.c +msgid "only ndarrays can be concatenated" +msgstr "" + #: ports/stm/common-hal/audiobusio/PDMIn.c msgid "only oversample=64 is supported" msgstr "" @@ -4407,9 +4420,6 @@ msgstr "zi must be of shape (n_section, 2)" #~ msgid "complex division by zero" #~ msgstr "complex division by zero" -#~ msgid "divide by zero" -#~ msgstr "divide by zero" - #~ msgid "int() arg 2 must be >= 2 and <= 36" #~ msgstr "int() arg 2 must be >= 2 and <= 36" diff --git a/locale/es.po b/locale/es.po index 7a8c1ee940..d40e92464c 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-12-31 17:50+0000\n" -"Last-Translator: Orlando Caro \n" +"PO-Revision-Date: 2023-02-01 22:11+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.15.1-dev\n" +"X-Generator: Weblate 4.16-dev\n" #: main.c msgid "" @@ -72,7 +72,7 @@ msgstr "%%c requiere int o char" #: main.c #, c-format msgid "%02X" -msgstr "" +msgstr "%02X" #: shared-module/os/getenv.c #, c-format @@ -98,7 +98,7 @@ msgstr "" #: ports/raspberrypi/common-hal/rtc/RTC.c ports/stm/common-hal/alarm/__init__.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" @@ -118,7 +118,7 @@ msgstr "%q fallo: %d" #: py/argcheck.c msgid "%q in %q must be of type %q, not %q" -msgstr "" +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 @@ -141,7 +141,7 @@ msgstr "%q es %q" #: ports/raspberrypi/common-hal/wifi/Radio.c msgid "%q is read-only for this board" -msgstr "" +msgstr "%q es solamente de lectura en esta tarjeta" #: py/argcheck.c shared-bindings/usb_hid/Device.c msgid "%q length must be %d" @@ -190,11 +190,11 @@ msgstr "%q debe ser un byte-matriz o matriz de tipo 'h', 'H', 'b', o '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 "" +msgstr "%q debe ser del tipo %q o %q, y no %q" #: py/argcheck.c py/obj.c py/objstrunicode.c msgid "%q must be of type %q, not %q" -msgstr "" +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" @@ -680,6 +680,7 @@ msgstr "Bus pin %d ya está siendo utilizado" #: ports/espressif/boards/m5stack_core_basic/mpconfigboard.h #: ports/espressif/boards/m5stack_core_fire/mpconfigboard.h +#: ports/espressif/boards/m5stack_stick_c/mpconfigboard.h msgid "Button A was pressed at start up.\n" msgstr "Botón A fue presionado al inicio.\n" @@ -692,9 +693,8 @@ msgid "CBC blocks must be multiples of 16 bytes" msgstr "Los bloques CBC deben ser múltiplos de 16 bytes" #: supervisor/shared/safe_mode.c -#, fuzzy msgid "CIRCUITPY drive could not be found or created." -msgstr "CIRCUITPY dispositivo de guardo no pudo ser encontrado o creado." +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" @@ -776,6 +776,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" @@ -796,7 +798,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" @@ -804,7 +806,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." @@ -923,7 +925,7 @@ 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." @@ -931,7 +933,7 @@ 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 "" +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" @@ -964,7 +966,7 @@ msgstr "Error: fallo al vincular" #: shared-bindings/alarm/__init__.c msgid "Expected a kind of %q" -msgstr "" +msgstr "Esperando un tipo %q" #: ports/espressif/common-hal/_bleio/Adapter.c #: ports/nrf/common-hal/_bleio/Adapter.c @@ -994,7 +996,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" @@ -1040,7 +1042,7 @@ msgstr "El archivo ya existe" #: shared-module/os/getenv.c msgid "File not found" -msgstr "" +msgstr "Archivo no encontrado" #: ports/atmel-samd/common-hal/canio/Listener.c #: ports/espressif/common-hal/canio/Listener.c @@ -1050,23 +1052,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/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" @@ -1076,6 +1081,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" @@ -1089,7 +1096,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" @@ -1108,7 +1115,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 @@ -1126,7 +1133,7 @@ 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 @@ -1219,11 +1226,11 @@ 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" @@ -1232,7 +1239,7 @@ 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 @@ -1241,7 +1248,7 @@ msgstr "Error interno #%d" #: supervisor/shared/safe_mode.c msgid "Internal watchdog timer expired." -msgstr "" +msgstr "El temporizador interno watchdog terminó." #: py/argcheck.c shared-bindings/digitalio/DigitalInOut.c msgid "Invalid %q" @@ -1266,7 +1273,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 @@ -1280,7 +1287,7 @@ msgstr "Inválido bits por valor" #: shared-module/os/getenv.c #, c-format msgid "Invalid byte %.*s" -msgstr "" +msgstr "byte %.*s Inválido" #: ports/atmel-samd/common-hal/imagecapture/ParallelImageCapture.c #, c-format @@ -1297,7 +1304,7 @@ msgstr "Acceso a memoria no válido." #: ports/espressif/common-hal/wifi/Radio.c msgid "Invalid multicast MAC address" -msgstr "" +msgstr "Dirección MAC de multidifusión inválida" #: ports/espressif/common-hal/espidf/__init__.c ports/espressif/esp_error.c msgid "Invalid size" @@ -1314,7 +1321,7 @@ msgstr "Estado invalido" #: shared-module/os/getenv.c msgid "Invalid unicode escape" -msgstr "" +msgstr "Unicode del caracter \"escape\" inválido" #: shared-bindings/aesio/aes.c msgid "Key must be 16, 24, or 32 bytes long" @@ -1322,11 +1329,11 @@ msgstr "La llave debe tener 16, 24 o 32 bytes de longitud" #: shared-module/os/getenv.c msgid "Key not found" -msgstr "" +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" @@ -1334,11 +1341,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" @@ -1346,7 +1353,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 @@ -1360,11 +1367,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" @@ -1372,7 +1379,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 @@ -1411,7 +1418,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." @@ -1436,7 +1443,7 @@ msgstr "Error NVS" #: shared-bindings/socketpool/SocketPool.c msgid "Name or service not known" -msgstr "" +msgstr "Nombre o servicio desconocido" #: py/qstr.c msgid "Name too long" @@ -1444,11 +1451,11 @@ 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 @@ -1474,11 +1481,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 @@ -1487,7 +1494,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 @@ -1496,7 +1503,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 @@ -1518,7 +1525,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" @@ -1577,7 +1584,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" @@ -1613,7 +1620,7 @@ msgstr "No reproduciendo" #: 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 "" @@ -1628,11 +1635,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 @@ -1680,22 +1687,22 @@ msgstr "" #: 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 "" +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 @@ -1708,7 +1715,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" @@ -1720,7 +1727,7 @@ msgstr "Tiempo de espera agotado" #: ports/raspberrypi/common-hal/mdns/Server.c msgid "Out of MDNS service slots" -msgstr "" +msgstr "No hay slots MDNS de servicio" #: ports/espressif/common-hal/espidf/__init__.c ports/espressif/esp_error.c msgid "Out of memory" @@ -1752,7 +1759,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" @@ -1812,7 +1819,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" @@ -1855,7 +1862,7 @@ msgstr "El tamaño del programa no es correcto" #: ports/espressif/common-hal/espulp/ULP.c msgid "Program too long" -msgstr "" +msgstr "El programa es demasiado grande" #: shared-bindings/digitalio/DigitalInOut.c msgid "Pull not used when direction is output." @@ -1868,7 +1875,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" @@ -1881,7 +1888,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 @@ -1912,7 +1919,7 @@ 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" @@ -1945,7 +1952,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 @@ -1963,7 +1970,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" @@ -1971,11 +1978,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 @@ -2022,7 +2029,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" @@ -2038,7 +2045,7 @@ 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 "" +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" @@ -2058,7 +2065,7 @@ msgstr "Lectura de temperatura expirada" #: supervisor/shared/safe_mode.c msgid "The BOOT button was pressed at start up.\n" -msgstr "" +msgstr "El boton BOOT fur presionado durante el arranque.\n" #: supervisor/shared/safe_mode.c msgid "" @@ -2070,11 +2077,11 @@ msgstr "" #: ports/espressif/boards/adafruit_feather_esp32_v2/mpconfigboard.h msgid "The SW38 button was pressed at start up.\n" -msgstr "" +msgstr "El boton SW38 fue presionado durante el arranque.\n" #: ports/espressif/boards/hardkernel_odroid_go/mpconfigboard.h msgid "The VOLUME button was pressed at start up.\n" -msgstr "" +msgstr "El boton de Volumen fue presionado durante el arranque.\n" #: supervisor/shared/safe_mode.c msgid "" @@ -2086,18 +2093,18 @@ msgstr "" #: py/obj.c msgid "The above exception was the direct cause of the following exception:" -msgstr "" +msgstr "La excepción fue la causa directa de la excepción siguiente:" #: 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 "The central button was pressed at start up.\n" -msgstr "" +msgstr "El boton central fue presionado durante el arranque.\n" #: ports/nrf/boards/aramcon2_badge/mpconfigboard.h msgid "The left button was pressed at start up.\n" -msgstr "" +msgstr "El boton izquierdo fue presionado durante el arranque.\n" #: shared-bindings/rgbmatrix/RGBMatrix.c msgid "The length of rgb_pins must be 6, 12, 18, 24, or 30" @@ -2132,13 +2139,15 @@ msgstr "El signo del sample no iguala al del mixer" #: 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" @@ -2166,11 +2175,11 @@ msgstr "" #: supervisor/shared/safe_mode.c msgid "To exit, please reset the board without requesting safe mode." -msgstr "" +msgstr "Para salir, por favor reinicialice la tarjeta sin pedir safe mode." #: 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." @@ -2205,24 +2214,24 @@ 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 "" +msgstr "Inicialización de UART" #: 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" @@ -2284,11 +2293,11 @@ 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/memorymap/AddressRange.c msgid "Unable to write to address." -msgstr "" +msgstr "Imposible de escribir en esa dirección." #: shared-bindings/nvm/ByteArray.c msgid "Unable to write to nvm." @@ -2310,12 +2319,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 @@ -2340,7 +2349,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 @@ -2350,12 +2359,12 @@ 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 @@ -2373,7 +2382,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" @@ -2385,7 +2394,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" @@ -2443,22 +2452,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 "" +msgstr "Wifi est en modo de access point." #: ports/raspberrypi/common-hal/wifi/Radio.c msgid "Wifi is in station mode." -msgstr "" +msgstr "Wifi esta en modo station." #: ports/raspberrypi/common-hal/wifi/Radio.c msgid "Wifi is not enabled" -msgstr "" +msgstr "Wifi no esta activado" #: main.c msgid "Woken up by alarm.\n" @@ -2547,7 +2561,11 @@ 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/memorymap/AddressRange.c shared-bindings/nvm/ByteArray.c @@ -2580,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" @@ -2604,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" @@ -2662,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" @@ -2699,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" @@ -2755,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" @@ -2772,7 +2790,7 @@ msgstr "no se puede asignar el atributo" #: py/runtime.c msgid "can't set attribute '%q'" -msgstr "" +msgstr "no se puede configurar el attributo '%q'" #: py/emitnative.c msgid "can't store '%q'" @@ -2802,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" @@ -2810,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" @@ -2838,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" @@ -2910,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" @@ -2984,13 +3002,17 @@ msgstr "las dimensiones no concuerdan" msgid "div/mod not implemented for uint" msgstr "div/mod no implementado para uint" +#: extmod/ulab/code/numpy/create.c +msgid "divide by zero" +msgstr "divide por cero" + #: py/runtime.c msgid "division by zero" msgstr "división por cero" #: 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" @@ -2998,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" @@ -3025,11 +3047,13 @@ 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" @@ -3079,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" @@ -3160,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 @@ -3247,7 +3271,7 @@ msgstr "el índice está fuera de límites" #: shared-bindings/_pixelmap/PixelMap.c msgid "index must be tuple or int" -msgstr "" +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 @@ -3261,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" @@ -3297,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" @@ -3310,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" @@ -3326,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" @@ -3364,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" @@ -3382,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" @@ -3404,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" @@ -3495,12 +3519,12 @@ 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" @@ -3527,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" @@ -3561,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" @@ -3569,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" @@ -3630,7 +3654,7 @@ msgstr "cuenta de corrimientos negativo" #: shared-bindings/_pixelmap/PixelMap.c msgid "nested index must be int" -msgstr "" +msgstr "indice anidado debe ser int" #: shared-module/sdcardio/SDCard.c msgid "no SD card" @@ -3665,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" @@ -3715,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" @@ -3777,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" @@ -3802,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 @@ -3830,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" @@ -3908,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" @@ -3945,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" @@ -4064,15 +4092,15 @@ 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" @@ -4140,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" @@ -4412,6 +4440,13 @@ msgstr "zi debe ser de tipo flotante" msgid "zi must be of shape (n_section, 2)" msgstr "zi debe ser una forma (n_section,2)" +#~ msgid "" +#~ "esp32_camera.Camera requires reserved PSRAM to be configured. See the " +#~ "documentation for instructions." +#~ msgstr "" +#~ "esp32_camera. la camara necesita PSRAM reservada para ser configurada. " +#~ "Vea la documentacion para mas instrucciones." + #~ msgid "%q must be of type %q" #~ msgstr "%q debe ser de typo %q" @@ -4462,9 +4497,6 @@ msgstr "zi debe ser una forma (n_section,2)" #~ msgid "complex division by zero" #~ msgstr "división compleja por cero" -#~ msgid "divide by zero" -#~ msgstr "divide por cero" - #~ msgid "int() arg 2 must be >= 2 and <= 36" #~ msgstr "int() arg 2 debe ser >= 2 y <= 36" diff --git a/locale/fil.po b/locale/fil.po index e44a5a5acd..64a40976f5 100644 --- a/locale/fil.po +++ b/locale/fil.po @@ -668,6 +668,7 @@ msgstr "Ginagamit na ang DAC" #: ports/espressif/boards/m5stack_core_basic/mpconfigboard.h #: ports/espressif/boards/m5stack_core_fire/mpconfigboard.h +#: ports/espressif/boards/m5stack_stick_c/mpconfigboard.h msgid "Button A was pressed at start up.\n" msgstr "" @@ -2496,6 +2497,10 @@ msgstr "" msgid "array has too many dimensions" msgstr "" +#: extmod/ulab/code/ndarray.c +msgid "array is too big" +msgstr "" + #: py/objarray.c shared-bindings/alarm/SleepMemory.c #: shared-bindings/memorymap/AddressRange.c shared-bindings/nvm/ByteArray.c msgid "array/bytes required on right side" @@ -2935,6 +2940,10 @@ msgstr "" msgid "div/mod not implemented for uint" msgstr "" +#: extmod/ulab/code/numpy/create.c +msgid "divide by zero" +msgstr "" + #: py/runtime.c msgid "division by zero" msgstr "dibisyon ng zero" @@ -2976,9 +2985,9 @@ msgstr "" msgid "error = 0x%08lX" msgstr "" -#: ports/espressif/common-hal/esp32_camera/Camera.c +#: ports/espressif/common-hal/espcamera/Camera.c msgid "" -"esp32_camera.Camera requires reserved PSRAM to be configured. See the " +"espcamera.Camera requires reserved PSRAM to be configured. See the " "documentation for instructions." msgstr "" @@ -3356,7 +3365,7 @@ msgstr "mali ang key" msgid "invalid micropython decorator" msgstr "mali ang micropython decorator" -#: ports/espressif/common-hal/esp32_camera/Camera.c +#: ports/espressif/common-hal/espcamera/Camera.c msgid "invalid setting" msgstr "" @@ -3617,7 +3626,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" @@ -3754,6 +3763,10 @@ msgstr "" msgid "only mono is supported" msgstr "" +#: extmod/ulab/code/numpy/create.c +msgid "only ndarrays can be concatenated" +msgstr "" + #: ports/stm/common-hal/audiobusio/PDMIn.c msgid "only oversample=64 is supported" msgstr "" diff --git a/locale/fr.po b/locale/fr.po index 6eb2e23cf7..28f95530cb 100644 --- a/locale/fr.po +++ b/locale/fr.po @@ -681,6 +681,7 @@ msgstr "La broche %d du bus est déjà utilisée" #: ports/espressif/boards/m5stack_core_basic/mpconfigboard.h #: ports/espressif/boards/m5stack_core_fire/mpconfigboard.h +#: ports/espressif/boards/m5stack_stick_c/mpconfigboard.h msgid "Button A was pressed at start up.\n" msgstr "Le bouton A était pressé au démarrage.\n" @@ -2580,6 +2581,10 @@ msgstr "la taille de la matrice et de l'index doivent être égaux" msgid "array has too many dimensions" msgstr "la tableau à trop de dimensions" +#: extmod/ulab/code/ndarray.c +msgid "array is too big" +msgstr "" + #: py/objarray.c shared-bindings/alarm/SleepMemory.c #: shared-bindings/memorymap/AddressRange.c shared-bindings/nvm/ByteArray.c msgid "array/bytes required on right side" @@ -3021,6 +3026,10 @@ msgstr "les dimensions ne correspondent pas" msgid "div/mod not implemented for uint" msgstr "div/mod ne sont pas implémentés pour uint" +#: extmod/ulab/code/numpy/create.c +msgid "divide by zero" +msgstr "division par zéro" + #: py/runtime.c msgid "division by zero" msgstr "division par zéro" @@ -3062,13 +3071,11 @@ msgstr "epoch_time n'est pas supporté sur ce panneau" msgid "error = 0x%08lX" msgstr "erreur = 0x%08lX" -#: ports/espressif/common-hal/esp32_camera/Camera.c +#: ports/espressif/common-hal/espcamera/Camera.c msgid "" -"esp32_camera.Camera requires reserved PSRAM to be configured. See the " +"espcamera.Camera requires reserved PSRAM to be configured. See the " "documentation for instructions." msgstr "" -"esp32_camera.Camera nécessite la configuration de PSRAM réservée. Se référer " -"à la documentation." #: py/runtime.c msgid "exceptions must derive from BaseException" @@ -3445,7 +3452,7 @@ msgstr "clé invalide" msgid "invalid micropython decorator" msgstr "décorateur micropython invalide" -#: ports/espressif/common-hal/esp32_camera/Camera.c +#: ports/espressif/common-hal/espcamera/Camera.c msgid "invalid setting" msgstr "réglage invalide" @@ -3707,7 +3714,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" @@ -3846,6 +3853,10 @@ msgstr "seul bit_depth = 16 est pris en charge" msgid "only mono is supported" msgstr "" +#: extmod/ulab/code/numpy/create.c +msgid "only ndarrays can be concatenated" +msgstr "" + #: ports/stm/common-hal/audiobusio/PDMIn.c msgid "only oversample=64 is supported" msgstr "" @@ -4456,6 +4467,13 @@ msgstr "zi doit être de type float" msgid "zi must be of shape (n_section, 2)" msgstr "zi doit être de forme (n_section, 2)" +#~ msgid "" +#~ "esp32_camera.Camera requires reserved PSRAM to be configured. See the " +#~ "documentation for instructions." +#~ msgstr "" +#~ "esp32_camera.Camera nécessite la configuration de PSRAM réservée. Se " +#~ "référer à la documentation." + #~ msgid "%q must be of type %q" #~ msgstr "%q doit être du type %q" @@ -4521,9 +4539,6 @@ msgstr "zi doit être de forme (n_section, 2)" #~ msgid "complex division by zero" #~ msgstr "division complexe par zéro" -#~ msgid "divide by zero" -#~ msgstr "division par zéro" - #~ msgid "int() arg 2 must be >= 2 and <= 36" #~ msgstr "" #~ "Le deuxième argument de int() doit être compris entre 2 et 36 inclus" diff --git a/locale/hi.po b/locale/hi.po index 79177b1701..4fc15e35b4 100644 --- a/locale/hi.po +++ b/locale/hi.po @@ -663,6 +663,7 @@ msgstr "" #: ports/espressif/boards/m5stack_core_basic/mpconfigboard.h #: ports/espressif/boards/m5stack_core_fire/mpconfigboard.h +#: ports/espressif/boards/m5stack_stick_c/mpconfigboard.h msgid "Button A was pressed at start up.\n" msgstr "" @@ -2478,6 +2479,10 @@ msgstr "" msgid "array has too many dimensions" msgstr "" +#: extmod/ulab/code/ndarray.c +msgid "array is too big" +msgstr "" + #: py/objarray.c shared-bindings/alarm/SleepMemory.c #: shared-bindings/memorymap/AddressRange.c shared-bindings/nvm/ByteArray.c msgid "array/bytes required on right side" @@ -2906,6 +2911,10 @@ msgstr "" msgid "div/mod not implemented for uint" msgstr "" +#: extmod/ulab/code/numpy/create.c +msgid "divide by zero" +msgstr "" + #: py/runtime.c msgid "division by zero" msgstr "" @@ -2947,9 +2956,9 @@ msgstr "" msgid "error = 0x%08lX" msgstr "" -#: ports/espressif/common-hal/esp32_camera/Camera.c +#: ports/espressif/common-hal/espcamera/Camera.c msgid "" -"esp32_camera.Camera requires reserved PSRAM to be configured. See the " +"espcamera.Camera requires reserved PSRAM to be configured. See the " "documentation for instructions." msgstr "" @@ -3326,7 +3335,7 @@ msgstr "" msgid "invalid micropython decorator" msgstr "" -#: ports/espressif/common-hal/esp32_camera/Camera.c +#: ports/espressif/common-hal/espcamera/Camera.c msgid "invalid setting" msgstr "" @@ -3583,7 +3592,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 "" @@ -3719,6 +3728,10 @@ msgstr "" msgid "only mono is supported" msgstr "" +#: extmod/ulab/code/numpy/create.c +msgid "only ndarrays can be concatenated" +msgstr "" + #: ports/stm/common-hal/audiobusio/PDMIn.c msgid "only oversample=64 is supported" msgstr "" diff --git a/locale/it_IT.po b/locale/it_IT.po index 9e7fbfce01..85167249c6 100644 --- a/locale/it_IT.po +++ b/locale/it_IT.po @@ -675,6 +675,7 @@ msgstr "Bus pin %d è già in uso" #: ports/espressif/boards/m5stack_core_basic/mpconfigboard.h #: ports/espressif/boards/m5stack_core_fire/mpconfigboard.h +#: ports/espressif/boards/m5stack_stick_c/mpconfigboard.h msgid "Button A was pressed at start up.\n" msgstr "" @@ -2506,6 +2507,10 @@ msgstr "" msgid "array has too many dimensions" msgstr "" +#: extmod/ulab/code/ndarray.c +msgid "array is too big" +msgstr "" + #: py/objarray.c shared-bindings/alarm/SleepMemory.c #: shared-bindings/memorymap/AddressRange.c shared-bindings/nvm/ByteArray.c msgid "array/bytes required on right side" @@ -2943,6 +2948,10 @@ msgstr "" msgid "div/mod not implemented for uint" msgstr "" +#: extmod/ulab/code/numpy/create.c +msgid "divide by zero" +msgstr "" + #: py/runtime.c msgid "division by zero" msgstr "divisione per zero" @@ -2984,9 +2993,9 @@ msgstr "" msgid "error = 0x%08lX" msgstr "errore = 0x%08lX" -#: ports/espressif/common-hal/esp32_camera/Camera.c +#: ports/espressif/common-hal/espcamera/Camera.c msgid "" -"esp32_camera.Camera requires reserved PSRAM to be configured. See the " +"espcamera.Camera requires reserved PSRAM to be configured. See the " "documentation for instructions." msgstr "" @@ -3364,7 +3373,7 @@ msgstr "chiave non valida" msgid "invalid micropython decorator" msgstr "decoratore non valido in micropython" -#: ports/espressif/common-hal/esp32_camera/Camera.c +#: ports/espressif/common-hal/espcamera/Camera.c msgid "invalid setting" msgstr "" @@ -3626,7 +3635,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" @@ -3765,6 +3774,10 @@ msgstr "" msgid "only mono is supported" msgstr "" +#: extmod/ulab/code/numpy/create.c +msgid "only ndarrays can be concatenated" +msgstr "" + #: ports/stm/common-hal/audiobusio/PDMIn.c msgid "only oversample=64 is supported" msgstr "" diff --git a/locale/ja.po b/locale/ja.po index 0c8387fe73..5f2c6a7aa2 100644 --- a/locale/ja.po +++ b/locale/ja.po @@ -675,6 +675,7 @@ msgstr "Busピン%dはすでに使用中" #: ports/espressif/boards/m5stack_core_basic/mpconfigboard.h #: ports/espressif/boards/m5stack_core_fire/mpconfigboard.h +#: ports/espressif/boards/m5stack_stick_c/mpconfigboard.h msgid "Button A was pressed at start up.\n" msgstr "" @@ -2498,6 +2499,10 @@ msgstr "" msgid "array has too many dimensions" msgstr "" +#: extmod/ulab/code/ndarray.c +msgid "array is too big" +msgstr "" + #: py/objarray.c shared-bindings/alarm/SleepMemory.c #: shared-bindings/memorymap/AddressRange.c shared-bindings/nvm/ByteArray.c msgid "array/bytes required on right side" @@ -2930,6 +2935,10 @@ msgstr "" msgid "div/mod not implemented for uint" msgstr "" +#: extmod/ulab/code/numpy/create.c +msgid "divide by zero" +msgstr "" + #: py/runtime.c msgid "division by zero" msgstr "ゼロ除算 (division by zero)" @@ -2971,9 +2980,9 @@ msgstr "" msgid "error = 0x%08lX" msgstr "error = 0x1%08lX" -#: ports/espressif/common-hal/esp32_camera/Camera.c +#: ports/espressif/common-hal/espcamera/Camera.c msgid "" -"esp32_camera.Camera requires reserved PSRAM to be configured. See the " +"espcamera.Camera requires reserved PSRAM to be configured. See the " "documentation for instructions." msgstr "" @@ -3351,7 +3360,7 @@ msgstr "不正な鍵" msgid "invalid micropython decorator" msgstr "不正なmicropythonデコレータ" -#: ports/espressif/common-hal/esp32_camera/Camera.c +#: ports/espressif/common-hal/espcamera/Camera.c msgid "invalid setting" msgstr "" @@ -3608,7 +3617,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 "指定の属性はありません" @@ -3744,6 +3753,10 @@ msgstr "bit_depth=16のみ対応しています" msgid "only mono is supported" msgstr "" +#: extmod/ulab/code/numpy/create.c +msgid "only ndarrays can be concatenated" +msgstr "" + #: ports/stm/common-hal/audiobusio/PDMIn.c msgid "only oversample=64 is supported" msgstr "" diff --git a/locale/ko.po b/locale/ko.po index 59cc20b1e1..8a4ebc9082 100644 --- a/locale/ko.po +++ b/locale/ko.po @@ -666,6 +666,7 @@ msgstr "" #: ports/espressif/boards/m5stack_core_basic/mpconfigboard.h #: ports/espressif/boards/m5stack_core_fire/mpconfigboard.h +#: ports/espressif/boards/m5stack_stick_c/mpconfigboard.h msgid "Button A was pressed at start up.\n" msgstr "" @@ -2482,6 +2483,10 @@ msgstr "" msgid "array has too many dimensions" msgstr "" +#: extmod/ulab/code/ndarray.c +msgid "array is too big" +msgstr "" + #: py/objarray.c shared-bindings/alarm/SleepMemory.c #: shared-bindings/memorymap/AddressRange.c shared-bindings/nvm/ByteArray.c msgid "array/bytes required on right side" @@ -2910,6 +2915,10 @@ msgstr "" msgid "div/mod not implemented for uint" msgstr "" +#: extmod/ulab/code/numpy/create.c +msgid "divide by zero" +msgstr "" + #: py/runtime.c msgid "division by zero" msgstr "" @@ -2951,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 "" @@ -3330,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 "" @@ -3587,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 "" @@ -3723,6 +3732,10 @@ msgstr "" msgid "only mono is supported" msgstr "" +#: extmod/ulab/code/numpy/create.c +msgid "only ndarrays can be concatenated" +msgstr "" + #: ports/stm/common-hal/audiobusio/PDMIn.c msgid "only oversample=64 is supported" msgstr "" diff --git a/locale/nl.po b/locale/nl.po index b8310d5ced..5122a036bc 100644 --- a/locale/nl.po +++ b/locale/nl.po @@ -668,6 +668,7 @@ msgstr "Bus pin %d al in gebruik" #: ports/espressif/boards/m5stack_core_basic/mpconfigboard.h #: ports/espressif/boards/m5stack_core_fire/mpconfigboard.h +#: ports/espressif/boards/m5stack_stick_c/mpconfigboard.h msgid "Button A was pressed at start up.\n" msgstr "" @@ -2508,6 +2509,10 @@ msgstr "array en indexlengte moeten gelijk zijn" msgid "array has too many dimensions" msgstr "" +#: extmod/ulab/code/ndarray.c +msgid "array is too big" +msgstr "" + #: py/objarray.c shared-bindings/alarm/SleepMemory.c #: shared-bindings/memorymap/AddressRange.c shared-bindings/nvm/ByteArray.c msgid "array/bytes required on right side" @@ -2939,6 +2944,10 @@ msgstr "" msgid "div/mod not implemented for uint" msgstr "" +#: extmod/ulab/code/numpy/create.c +msgid "divide by zero" +msgstr "" + #: py/runtime.c msgid "division by zero" msgstr "deling door nul" @@ -2980,9 +2989,9 @@ msgstr "epoch_time niet ondersteund op dit bord" msgid "error = 0x%08lX" msgstr "fout = 0x%08lX" -#: ports/espressif/common-hal/esp32_camera/Camera.c +#: ports/espressif/common-hal/espcamera/Camera.c msgid "" -"esp32_camera.Camera requires reserved PSRAM to be configured. See the " +"espcamera.Camera requires reserved PSRAM to be configured. See the " "documentation for instructions." msgstr "" @@ -3360,7 +3369,7 @@ msgstr "ongeldige sleutel" msgid "invalid micropython decorator" msgstr "ongeldige micropython decorator" -#: ports/espressif/common-hal/esp32_camera/Camera.c +#: ports/espressif/common-hal/espcamera/Camera.c msgid "invalid setting" msgstr "" @@ -3620,7 +3629,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" @@ -3756,6 +3765,10 @@ msgstr "alleen bit_depth=16 wordt ondersteund" msgid "only mono is supported" msgstr "" +#: extmod/ulab/code/numpy/create.c +msgid "only ndarrays can be concatenated" +msgstr "" + #: ports/stm/common-hal/audiobusio/PDMIn.c msgid "only oversample=64 is supported" msgstr "" diff --git a/locale/pl.po b/locale/pl.po index ac54e220ad..41c0c432a7 100644 --- a/locale/pl.po +++ b/locale/pl.po @@ -670,6 +670,7 @@ msgstr "Nóżka magistrali %d jest w użyciu" #: ports/espressif/boards/m5stack_core_basic/mpconfigboard.h #: ports/espressif/boards/m5stack_core_fire/mpconfigboard.h +#: ports/espressif/boards/m5stack_stick_c/mpconfigboard.h msgid "Button A was pressed at start up.\n" msgstr "" @@ -2489,6 +2490,10 @@ msgstr "" msgid "array has too many dimensions" msgstr "" +#: extmod/ulab/code/ndarray.c +msgid "array is too big" +msgstr "" + #: py/objarray.c shared-bindings/alarm/SleepMemory.c #: shared-bindings/memorymap/AddressRange.c shared-bindings/nvm/ByteArray.c msgid "array/bytes required on right side" @@ -2918,6 +2923,10 @@ msgstr "" msgid "div/mod not implemented for uint" msgstr "" +#: extmod/ulab/code/numpy/create.c +msgid "divide by zero" +msgstr "" + #: py/runtime.c msgid "division by zero" msgstr "dzielenie przez zero" @@ -2959,9 +2968,9 @@ msgstr "" msgid "error = 0x%08lX" msgstr "błąd = 0x%08lX" -#: ports/espressif/common-hal/esp32_camera/Camera.c +#: ports/espressif/common-hal/espcamera/Camera.c msgid "" -"esp32_camera.Camera requires reserved PSRAM to be configured. See the " +"espcamera.Camera requires reserved PSRAM to be configured. See the " "documentation for instructions." msgstr "" @@ -3338,7 +3347,7 @@ msgstr "zły klucz" msgid "invalid micropython decorator" msgstr "zły dekorator micropythona" -#: ports/espressif/common-hal/esp32_camera/Camera.c +#: ports/espressif/common-hal/espcamera/Camera.c msgid "invalid setting" msgstr "" @@ -3595,7 +3604,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" @@ -3731,6 +3740,10 @@ msgstr "obsługiwane jest tylko bit_depth=16" msgid "only mono is supported" msgstr "" +#: extmod/ulab/code/numpy/create.c +msgid "only ndarrays can be concatenated" +msgstr "" + #: ports/stm/common-hal/audiobusio/PDMIn.c msgid "only oversample=64 is supported" msgstr "" diff --git a/locale/pt_BR.po b/locale/pt_BR.po index 2bddd54617..b6a5eccd37 100644 --- a/locale/pt_BR.po +++ b/locale/pt_BR.po @@ -6,7 +6,7 @@ msgstr "" "Project-Id-Version: PACKAGE VERSION\n" "Report-Msgid-Bugs-To: \n" "POT-Creation-Date: 2021-01-04 12:55-0600\n" -"PO-Revision-Date: 2023-01-13 18:51+0000\n" +"PO-Revision-Date: 2023-01-29 16:16+0000\n" "Last-Translator: Wellington Terumi Uemura \n" "Language-Team: \n" "Language: pt_BR\n" @@ -14,7 +14,7 @@ msgstr "" "Content-Type: text/plain; charset=UTF-8\n" "Content-Transfer-Encoding: 8bit\n" "Plural-Forms: nplurals=2; plural=n > 1;\n" -"X-Generator: Weblate 4.15.1-dev\n" +"X-Generator: Weblate 4.16-dev\n" #: main.c msgid "" @@ -683,6 +683,7 @@ msgstr "O pino bus %d já está em uso" #: ports/espressif/boards/m5stack_core_basic/mpconfigboard.h #: ports/espressif/boards/m5stack_core_fire/mpconfigboard.h +#: ports/espressif/boards/m5stack_stick_c/mpconfigboard.h msgid "Button A was pressed at start up.\n" msgstr "O botão A foi pressionado na inicialização.\n" @@ -2561,6 +2562,10 @@ msgstr "a matriz e comprimento do índice devem ser iguais" msgid "array has too many dimensions" msgstr "a matriz possui muitas dimensões" +#: extmod/ulab/code/ndarray.c +msgid "array is too big" +msgstr "" + #: py/objarray.c shared-bindings/alarm/SleepMemory.c #: shared-bindings/memorymap/AddressRange.c shared-bindings/nvm/ByteArray.c msgid "array/bytes required on right side" @@ -2998,6 +3003,10 @@ msgstr "as dimensões não coincidem" msgid "div/mod not implemented for uint" msgstr "div/mod não implementado para uint" +#: extmod/ulab/code/numpy/create.c +msgid "divide by zero" +msgstr "divido por zero" + #: py/runtime.c msgid "division by zero" msgstr "divisão por zero" @@ -3039,13 +3048,13 @@ 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" @@ -3421,7 +3430,7 @@ msgstr "chave inválida" msgid "invalid micropython decorator" msgstr "o decorador micropython é inválido" -#: ports/espressif/common-hal/esp32_camera/Camera.c +#: ports/espressif/common-hal/espcamera/Camera.c msgid "invalid setting" msgstr "configuração inválida" @@ -3683,7 +3692,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" @@ -3819,6 +3828,10 @@ msgstr "apenas bit_depth = 16 é compatível" msgid "only mono is supported" msgstr "Apenas o mono é compatível" +#: extmod/ulab/code/numpy/create.c +msgid "only ndarrays can be concatenated" +msgstr "" + #: ports/stm/common-hal/audiobusio/PDMIn.c msgid "only oversample=64 is supported" msgstr "apenas oversample=64 é compatível" @@ -4431,6 +4444,13 @@ msgstr "zi deve ser de um tipo float" msgid "zi must be of shape (n_section, 2)" msgstr "zi deve estar na forma (n_section, 2)" +#~ msgid "" +#~ "esp32_camera.Camera requires reserved PSRAM to be configured. See the " +#~ "documentation for instructions." +#~ msgstr "" +#~ "esp32_camera.Camera requer que uma reserva PSRAM seja configurada. " +#~ "Consulte a documentação para obter mais informações." + #~ msgid "%q must be of type %q" #~ msgstr "%q deve ser do tipo %q" @@ -4502,9 +4522,6 @@ msgstr "zi deve estar na forma (n_section, 2)" #~ msgid "complex division by zero" #~ msgstr "divisão complexa por zero" -#~ msgid "divide by zero" -#~ msgstr "divido por zero" - #~ msgid "int() arg 2 must be >= 2 and <= 36" #~ msgstr "int() arg 2 deve ser >= 2 e <= 36" diff --git a/locale/ru.po b/locale/ru.po index 86b977f6f3..205c1a1c0e 100644 --- a/locale/ru.po +++ b/locale/ru.po @@ -680,6 +680,7 @@ msgstr "Пин шины %d уже используется" #: ports/espressif/boards/m5stack_core_basic/mpconfigboard.h #: ports/espressif/boards/m5stack_core_fire/mpconfigboard.h +#: ports/espressif/boards/m5stack_stick_c/mpconfigboard.h msgid "Button A was pressed at start up.\n" msgstr "Кнопка A была нажата при загрузке\n" @@ -2546,6 +2547,10 @@ msgstr "" msgid "array has too many dimensions" msgstr "" +#: extmod/ulab/code/ndarray.c +msgid "array is too big" +msgstr "" + #: py/objarray.c shared-bindings/alarm/SleepMemory.c #: shared-bindings/memorymap/AddressRange.c shared-bindings/nvm/ByteArray.c msgid "array/bytes required on right side" @@ -2974,6 +2979,10 @@ msgstr "" msgid "div/mod not implemented for uint" msgstr "" +#: extmod/ulab/code/numpy/create.c +msgid "divide by zero" +msgstr "" + #: py/runtime.c msgid "division by zero" msgstr "" @@ -3015,9 +3024,9 @@ msgstr "" msgid "error = 0x%08lX" msgstr "" -#: ports/espressif/common-hal/esp32_camera/Camera.c +#: ports/espressif/common-hal/espcamera/Camera.c msgid "" -"esp32_camera.Camera requires reserved PSRAM to be configured. See the " +"espcamera.Camera requires reserved PSRAM to be configured. See the " "documentation for instructions." msgstr "" @@ -3394,7 +3403,7 @@ msgstr "" msgid "invalid micropython decorator" msgstr "" -#: ports/espressif/common-hal/esp32_camera/Camera.c +#: ports/espressif/common-hal/espcamera/Camera.c msgid "invalid setting" msgstr "" @@ -3651,7 +3660,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 "" @@ -3787,6 +3796,10 @@ msgstr "" msgid "only mono is supported" msgstr "" +#: extmod/ulab/code/numpy/create.c +msgid "only ndarrays can be concatenated" +msgstr "" + #: ports/stm/common-hal/audiobusio/PDMIn.c msgid "only oversample=64 is supported" msgstr "" diff --git a/locale/sv.po b/locale/sv.po index 132b296fb9..29fd45ca87 100644 --- a/locale/sv.po +++ b/locale/sv.po @@ -6,7 +6,7 @@ msgstr "" "Project-Id-Version: PACKAGE VERSION\n" "Report-Msgid-Bugs-To: \n" "POT-Creation-Date: 2021-01-04 12:55-0600\n" -"PO-Revision-Date: 2023-01-13 18:51+0000\n" +"PO-Revision-Date: 2023-01-29 16:16+0000\n" "Last-Translator: Jonny Bergdahl \n" "Language-Team: LANGUAGE \n" "Language: sv\n" @@ -14,7 +14,7 @@ msgstr "" "Content-Type: text/plain; charset=UTF-8\n" "Content-Transfer-Encoding: 8bit\n" "Plural-Forms: nplurals=2; plural=n != 1;\n" -"X-Generator: Weblate 4.15.1-dev\n" +"X-Generator: Weblate 4.16-dev\n" #: main.c msgid "" @@ -675,6 +675,7 @@ msgstr "Busspinne %d används redan" #: ports/espressif/boards/m5stack_core_basic/mpconfigboard.h #: ports/espressif/boards/m5stack_core_fire/mpconfigboard.h +#: ports/espressif/boards/m5stack_stick_c/mpconfigboard.h msgid "Button A was pressed at start up.\n" msgstr "Knapp A trycktes ned vid start.\n" @@ -2534,6 +2535,10 @@ msgstr "array och indexlängd måste vara lika" msgid "array has too many dimensions" msgstr "array har för många dimensioner" +#: extmod/ulab/code/ndarray.c +msgid "array is too big" +msgstr "" + #: py/objarray.c shared-bindings/alarm/SleepMemory.c #: shared-bindings/memorymap/AddressRange.c shared-bindings/nvm/ByteArray.c msgid "array/bytes required on right side" @@ -2967,6 +2972,10 @@ msgstr "dimensioner matchar inte" msgid "div/mod not implemented for uint" msgstr "div/mod inte implementerat för uint" +#: extmod/ulab/code/numpy/create.c +msgid "divide by zero" +msgstr "division med noll" + #: py/runtime.c msgid "division by zero" msgstr "division med noll" @@ -3008,12 +3017,12 @@ 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 @@ -3389,7 +3398,7 @@ msgstr "ogiltig nyckel" msgid "invalid micropython decorator" msgstr "ogiltig mikropython-dekorator" -#: ports/espressif/common-hal/esp32_camera/Camera.c +#: ports/espressif/common-hal/espcamera/Camera.c msgid "invalid setting" msgstr "ogiltig inställning" @@ -3649,7 +3658,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" @@ -3785,6 +3794,10 @@ msgstr "bara bit_depth=16 stöds" msgid "only mono is supported" msgstr "endast mono stöds" +#: extmod/ulab/code/numpy/create.c +msgid "only ndarrays can be concatenated" +msgstr "" + #: ports/stm/common-hal/audiobusio/PDMIn.c msgid "only oversample=64 is supported" msgstr "endast oversample=64 stöds" @@ -4393,6 +4406,13 @@ msgstr "zi måste vara av typ float" msgid "zi must be of shape (n_section, 2)" msgstr "zi måste vara i formen (n_section, 2)" +#~ msgid "" +#~ "esp32_camera.Camera requires reserved PSRAM to be configured. See the " +#~ "documentation for instructions." +#~ msgstr "" +#~ "esp32_camera.Camera kräver reserverad PSRAM att konfigureras. Se " +#~ "dokumentationen för instruktioner." + #~ msgid "%q must be of type %q" #~ msgstr "%q måste vara av typen %q" @@ -4464,9 +4484,6 @@ msgstr "zi måste vara i formen (n_section, 2)" #~ msgid "complex division by zero" #~ msgstr "komplex division med noll" -#~ msgid "divide by zero" -#~ msgstr "division med noll" - #~ msgid "int() arg 2 must be >= 2 and <= 36" #~ msgstr "int() arg 2 måste vara >= 2 och <= 36" diff --git a/locale/tr.po b/locale/tr.po index 5a8f259dac..85a0d6af12 100644 --- a/locale/tr.po +++ b/locale/tr.po @@ -678,6 +678,7 @@ msgstr "Veriyolu pini %d kullanımda" #: ports/espressif/boards/m5stack_core_basic/mpconfigboard.h #: ports/espressif/boards/m5stack_core_fire/mpconfigboard.h +#: ports/espressif/boards/m5stack_stick_c/mpconfigboard.h msgid "Button A was pressed at start up.\n" msgstr "Başlatma sırasında A düğmesine basıldı.\n" @@ -2504,6 +2505,10 @@ msgstr "" msgid "array has too many dimensions" msgstr "" +#: extmod/ulab/code/ndarray.c +msgid "array is too big" +msgstr "" + #: py/objarray.c shared-bindings/alarm/SleepMemory.c #: shared-bindings/memorymap/AddressRange.c shared-bindings/nvm/ByteArray.c msgid "array/bytes required on right side" @@ -2932,6 +2937,10 @@ msgstr "" msgid "div/mod not implemented for uint" msgstr "" +#: extmod/ulab/code/numpy/create.c +msgid "divide by zero" +msgstr "" + #: py/runtime.c msgid "division by zero" msgstr "" @@ -2973,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 "" @@ -3352,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 "" @@ -3609,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 "" @@ -3745,6 +3754,10 @@ msgstr "" msgid "only mono is supported" msgstr "" +#: extmod/ulab/code/numpy/create.c +msgid "only ndarrays can be concatenated" +msgstr "" + #: ports/stm/common-hal/audiobusio/PDMIn.c msgid "only oversample=64 is supported" msgstr "" diff --git a/locale/zh_Latn_pinyin.po b/locale/zh_Latn_pinyin.po index 60b66d2b72..121a54dcbb 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-30 16:14+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 "" @@ -118,7 +118,7 @@ msgstr "%q Shībài: %d" #: py/argcheck.c msgid "%q in %q must be of type %q, not %q" -msgstr "" +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 @@ -141,7 +141,7 @@ msgstr "%q shì %q" #: ports/raspberrypi/common-hal/wifi/Radio.c msgid "%q is read-only for this board" -msgstr "" +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" @@ -181,7 +181,7 @@ msgstr "%q bìxū >= %d" #: shared-bindings/analogbufio/BufferedIn.c msgid "%q must be a bytearray or array of type 'H' or 'B'" -msgstr "" +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'" @@ -191,11 +191,11 @@ msgstr "" #: 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 "" +msgstr "%q de lèi xíng bì xū shì %q huò %q, ér bù shì %q" #: py/argcheck.c py/obj.c py/objstrunicode.c msgid "%q must be of type %q, not %q" -msgstr "" +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" @@ -220,7 +220,7 @@ msgstr "%q yǐn jiǎo wúxiào" #: py/objrange.c py/objslice.c shared-bindings/random/__init__.c msgid "%q step cannot be zero" -msgstr "" +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" @@ -421,7 +421,7 @@ msgstr "dìzhǐ chángdù bìxū shì %d zìjié" #: ports/espressif/common-hal/memorymap/AddressRange.c msgid "Address range not allowed" -msgstr "" +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" @@ -517,7 +517,7 @@ 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 "" +msgstr "jiǎn suǒ '%s' shí chū cuò:\n" #: ports/stm/common-hal/audiopwmio/PWMAudioOut.c msgid "Another PWMAudioOut is already active" @@ -677,6 +677,7 @@ msgstr "Zǒngxiàn yǐnjiǎo %d yǐjīng zài shǐyòng zhōng" #: ports/espressif/boards/m5stack_core_basic/mpconfigboard.h #: ports/espressif/boards/m5stack_core_fire/mpconfigboard.h +#: ports/espressif/boards/m5stack_stick_c/mpconfigboard.h msgid "Button A was pressed at start up.\n" msgstr "qǐ dòng shí àn xià àn niǔ A.\n" @@ -925,6 +926,7 @@ 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" @@ -957,7 +959,7 @@ msgstr "cuò wù: bǎng dìng shī bài" #: shared-bindings/alarm/__init__.c msgid "Expected a kind of %q" -msgstr "" +msgstr "yù qī yì zhǒng %q" #: ports/espressif/common-hal/_bleio/Adapter.c #: ports/nrf/common-hal/_bleio/Adapter.c @@ -1033,7 +1035,7 @@ msgstr "Wénjiàn cúnzài" #: shared-module/os/getenv.c msgid "File not found" -msgstr "" +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 @@ -1274,7 +1276,7 @@ msgstr "Měi gè zhí de wèi wúxiào" #: shared-module/os/getenv.c #, c-format msgid "Invalid byte %.*s" -msgstr "" +msgstr "wú xiào zì jié %.*s" #: ports/atmel-samd/common-hal/imagecapture/ParallelImageCapture.c #, c-format @@ -1308,7 +1310,7 @@ msgstr "wú xiào zhuàng tài" #: shared-module/os/getenv.c msgid "Invalid unicode escape" -msgstr "" +msgstr "wú xiào de unicode zhuǎn yì" #: shared-bindings/aesio/aes.c msgid "Key must be 16, 24, or 32 bytes long" @@ -1316,7 +1318,7 @@ 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 "" +msgstr "wèi zhǎo dào mì yào" #: shared-module/is31fl3741/FrameBuffer.c msgid "LED mappings must match display size" @@ -1427,7 +1429,7 @@ msgstr "NVS cuò wù" #: shared-bindings/socketpool/SocketPool.c msgid "Name or service not known" -msgstr "" +msgstr "míng chēng huò fú wù wèi zhī" #: py/qstr.c msgid "Name too long" @@ -1674,7 +1676,7 @@ 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 "" +msgstr "zhǐ néng shè zhì yí gè %q." #: ports/espressif/common-hal/i2ctarget/I2CTarget.c #: ports/raspberrypi/common-hal/i2ctarget/I2CTarget.c @@ -1842,7 +1844,7 @@ msgstr "chéng xù dà xiǎo wú xiào" #: ports/espressif/common-hal/espulp/ULP.c msgid "Program too long" -msgstr "" +msgstr "chéng xù tài cháng" #: shared-bindings/digitalio/DigitalInOut.c msgid "Pull not used when direction is output." @@ -2024,7 +2026,7 @@ 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 "" +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" @@ -2072,7 +2074,7 @@ msgstr "" #: py/obj.c msgid "The above exception was the direct cause of the following exception:" -msgstr "" +msgstr "shàng shù yì cháng shì yǐ xià yì cháng de zhí jiē yuán yīn:" #: ports/espressif/boards/m5stack_atom_echo/mpconfigboard.h #: ports/espressif/boards/m5stack_atom_lite/mpconfigboard.h @@ -2275,7 +2277,7 @@ msgstr "wú fǎ qǐ dòng mDNS chá xún" #: shared-bindings/memorymap/AddressRange.c msgid "Unable to write to address." -msgstr "" +msgstr "Wú fǎ xiě rù dì zhǐ." #: shared-bindings/nvm/ByteArray.c msgid "Unable to write to nvm." @@ -2440,15 +2442,15 @@ msgstr "Wi-Fi: " #: ports/raspberrypi/common-hal/wifi/Radio.c msgid "Wifi is in access point mode." -msgstr "" +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 "" +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 "" +msgstr "wú xiàn wǎng luò wèi qǐ yòng" #: main.c msgid "Woken up by alarm.\n" @@ -2539,6 +2541,10 @@ msgstr "shù zǔ hé suǒ yǐn cháng dù bì xū xiāng děng" msgid "array has too many dimensions" msgstr "shùzǔ yǒu tài duō wéidù" +#: extmod/ulab/code/ndarray.c +msgid "array is too big" +msgstr "" + #: py/objarray.c shared-bindings/alarm/SleepMemory.c #: shared-bindings/memorymap/AddressRange.c shared-bindings/nvm/ByteArray.c msgid "array/bytes required on right side" @@ -2761,7 +2767,7 @@ msgstr "wúfǎ shèzhì shǔxìng" #: py/runtime.c msgid "can't set attribute '%q'" -msgstr "" +msgstr "wú fǎ shè zhì shǔ xìng '%q'" #: py/emitnative.c msgid "can't store '%q'" @@ -2973,6 +2979,10 @@ msgstr "chǐ cùn bù pǐ pèi" msgid "div/mod not implemented for uint" msgstr "div/ mó zǔ wèi wéi wèi shí xiàn" +#: extmod/ulab/code/numpy/create.c +msgid "divide by zero" +msgstr "chú yǐ líng" + #: py/runtime.c msgid "division by zero" msgstr "bèi líng chú" @@ -3014,13 +3024,11 @@ msgstr "epoch_time bǎn bù zhī chí cǐ bǎn běn" msgid "error = 0x%08lX" msgstr "cuòwù = 0x%08lX" -#: ports/espressif/common-hal/esp32_camera/Camera.c +#: ports/espressif/common-hal/espcamera/Camera.c msgid "" -"esp32_camera.Camera requires reserved PSRAM to be configured. See the " +"espcamera.Camera requires reserved PSRAM to be configured. See the " "documentation for instructions." msgstr "" -"esp32_camera. shè xiàng jī xū yào pèi zhì yù liú de PSRAM. yǒu guān shuō " -"míng, qǐng cān yuè wén dàng." #: py/runtime.c msgid "exceptions must derive from BaseException" @@ -3238,7 +3246,7 @@ msgstr "suǒyǐn chāochū fànwéi" #: shared-bindings/_pixelmap/PixelMap.c msgid "index must be tuple or int" -msgstr "" +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 @@ -3395,7 +3403,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" @@ -3618,7 +3626,7 @@ msgstr "fù zhuǎnyí jìshù" #: shared-bindings/_pixelmap/PixelMap.c msgid "nested index must be int" -msgstr "" +msgstr "qiàn tào suǒ yǐn bì xū shì int" #: shared-module/sdcardio/SDCard.c msgid "no SD card" @@ -3653,7 +3661,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" @@ -3789,6 +3797,10 @@ msgstr "Jǐn zhīchí wèi shēndù = 16" msgid "only mono is supported" msgstr "jǐn zhī chí dān shēng dào" +#: extmod/ulab/code/numpy/create.c +msgid "only ndarrays can be concatenated" +msgstr "" + #: ports/stm/common-hal/audiobusio/PDMIn.c msgid "only oversample=64 is supported" msgstr "jǐn zhī chí guò cǎi yàng =64" @@ -4399,6 +4411,13 @@ msgstr "zi bìxū wèi fú diǎn xíng" msgid "zi must be of shape (n_section, 2)" msgstr "zi bìxū jùyǒu xíngzhuàng (n_section,2)" +#~ msgid "" +#~ "esp32_camera.Camera requires reserved PSRAM to be configured. See the " +#~ "documentation for instructions." +#~ msgstr "" +#~ "esp32_camera. shè xiàng jī xū yào pèi zhì yù liú de PSRAM. yǒu guān shuō " +#~ "míng, qǐng cān yuè wén dàng." + #~ msgid "%q must be of type %q" #~ msgstr "%q bì xū shì %q lèi xíng" @@ -4467,9 +4486,6 @@ msgstr "zi bìxū jùyǒu xíngzhuàng (n_section,2)" #~ msgid "complex division by zero" #~ msgstr "fùzá de fēngé wèi 0" -#~ msgid "divide by zero" -#~ msgstr "chú yǐ líng" - #~ msgid "int() arg 2 must be >= 2 and <= 36" #~ msgstr "zhěngshù() cānshù 2 bìxū > = 2 qiě <= 36" diff --git a/ports/atmel-samd/boards/pewpew_m4/mpconfigboard.mk b/ports/atmel-samd/boards/pewpew_m4/mpconfigboard.mk index 32be4805d7..0560da84fe 100644 --- a/ports/atmel-samd/boards/pewpew_m4/mpconfigboard.mk +++ b/ports/atmel-samd/boards/pewpew_m4/mpconfigboard.mk @@ -11,6 +11,7 @@ LONGINT_IMPL = NONE CIRCUITPY_FULL_BUILD = 0 +CIRCUITPY_ANALOGIO = 0 CIRCUITPY_ALARM = 0 CIRCUITPY_AUDIOBUSIO = 0 CIRCUITPY_AUDIOMP3 = 0 @@ -31,14 +32,13 @@ CIRCUITPY_ROTARYIO = 0 CIRCUITPY_RTC = 0 CIRCUITPY_SAMD = 0 CIRCUITPY_TOUCHIO = 0 -CIRCUITPY_USB_CDC = 0 CIRCUITPY_USB_HID = 0 CIRCUITPY_USB_MIDI = 0 CIRCUITPY_VECTORIO = 0 CIRCUITPY_BUSDEVICE = 0 CIRCUITPY_BITMAPTOOLS = 0 +CIRCUITPY_WATCHDOG = 0 -CIRCUITPY_ANALOGIO = 1 CIRCUITPY_AUDIOIO = 1 CIRCUITPY_AUDIOMIXER = 1 CIRCUITPY_DISPLAYIO = 1 diff --git a/ports/broadcom/common-hal/rtc/RTC.c b/ports/broadcom/common-hal/rtc/RTC.c new file mode 100644 index 0000000000..8f6743cb05 --- /dev/null +++ b/ports/broadcom/common-hal/rtc/RTC.c @@ -0,0 +1,58 @@ +/* + * This file is part of the MicroPython project, http://micropython.org/ + * + * The MIT License (MIT) + * + * 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 + * in the Software without restriction, including without limitation the rights + * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell + * copies of the Software, and to permit persons to whom the Software is + * furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice shall be included in + * all copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE + * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER + * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, + * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN + * THE SOFTWARE. + */ + +#include + +#include "py/obj.h" +#include "py/runtime.h" +#include "shared/timeutils/timeutils.h" +#include "supervisor/port.h" + +// This is the time in seconds since 2000 that the RTC was started. +// TODO: Change the offset to ticks so that it can be a subsecond adjustment. +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/broadcom/common-hal/rtc/RTC.h b/ports/broadcom/common-hal/rtc/RTC.h new file mode 100644 index 0000000000..09ae4ea86f --- /dev/null +++ b/ports/broadcom/common-hal/rtc/RTC.h @@ -0,0 +1,33 @@ +/* + * This file is part of the MicroPython project, http://micropython.org/ + * + * The MIT License (MIT) + * + * Copyright (c) 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 + * 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_BROADCOM_COMMON_HAL_RTC_RTC_H +#define MICROPY_INCLUDED_BROADCOM_COMMON_HAL_RTC_RTC_H + +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..fcb86674c5 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" 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 8e326e18ab..d844fc88bd 100644 --- a/ports/espressif/Makefile +++ b/ports/espressif/Makefile @@ -254,10 +254,10 @@ endif SRC_C += $(wildcard common-hal/espidf/*.c) -ifneq ($(CIRCUITPY_ESP32_CAMERA),0) +ifneq ($(CIRCUITPY_ESPCAMERA),0) SRC_CAMERA := \ - $(wildcard common-hal/esp32_camera/*.c) \ - $(wildcard bindings/esp32_camera/*.c) + $(wildcard common-hal/espcamera/*.c) \ + $(wildcard bindings/espcamera/*.c) SRC_C += $(SRC_CAMERA) CFLAGS += -isystem esp32-camera/driver/include CFLAGS += -isystem esp32-camera/conversions/include @@ -344,7 +344,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 @@ -396,7 +396,7 @@ BINARY_BLOBS += esp-idf/components/xtensa/$(IDF_TARGET)/libxt_hal.a ESP_IDF_COMPONENTS_EXPANDED += esp-idf/components/xtensa/$(IDF_TARGET)/libxt_hal.a endif -ifneq ($(CIRCUITPY_ESP32_CAMERA),0) +ifneq ($(CIRCUITPY_ESPCAMERA),0) ESP_IDF_COMPONENTS_EXPANDED += $(BUILD)/esp-idf/esp-idf/esp32-camera/libesp32-camera.a #$(error $(ESP_IDF_COMPONENTS_EXPANDED)) endif diff --git a/ports/espressif/bindings/esp32_camera/Camera.c b/ports/espressif/bindings/esp32_camera/Camera.c deleted file mode 100644 index 114795c106..0000000000 --- a/ports/espressif/bindings/esp32_camera/Camera.c +++ /dev/null @@ -1,1001 +0,0 @@ -/* - * This file is part of the MicroPython project, http://micropython.org/ - * - * The MIT License (MIT) - * - * Copyright (c) 2022 Jeff Epler for Adafruit Industries - * - * Permission is hereby granted, free of charge, to any person obtaining a copy - * of this software and associated documentation files (the "Software"), to deal - * in the Software without restriction, including without limitation the rights - * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell - * copies of the Software, and to permit persons to whom the Software is - * furnished to do so, subject to the following conditions: - * - * The above copyright notice and this permission notice shall be included in - * all copies or substantial portions of the Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR - * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, - * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE - * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER - * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, - * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN - * THE SOFTWARE. - */ - -#include - -#include "py/mphal.h" -#include "py/obj.h" -#include "py/objproperty.h" -#include "py/runtime.h" - -#include "bindings/esp32_camera/__init__.h" -#include "bindings/esp32_camera/Camera.h" -#include "common-hal/esp32_camera/Camera.h" - -#include "shared-bindings/displayio/Bitmap.h" -#include "shared-bindings/microcontroller/Pin.h" -#include "shared-bindings/util.h" -#include "esp_camera.h" -#include "sensor.h" - -//| class Camera: -//| def __init__( -//| self, -//| *, -//| data_pins: List[microcontroller.Pin], -//| pixel_clock_pin: microcontroller.Pin, -//| vsync_pin: microcontroller.Pin, -//| href_pin: microcontroller.Pin, -//| i2c: busio.I2C, -//| external_clock_pin: Optional[microcontroller.Pin] = None, -//| external_clock_frequency: int = 20_000_000, -//| powerdown_pin: Optional[microcontroller.Pin] = None, -//| reset_pin: Optional[microcontroller.Pin] = None, -//| pixel_format: PixelFormat = PixelFormat.RGB565, -//| frame_size: FrameSize = FrameSize.QQVGA, -//| jpeg_quality: int = 15, -//| framebuffer_count: int = 1, -//| grab_mode: GrabMode = GrabMode.WHEN_EMPTY, -//| ) -> None: -//| """ -//| Configure and initialize a camera with the given properties -//| -//| This driver requires that the ``CIRCUITPY_RESERVED_PSRAM`` in ``settings.toml`` be large enough to hold the camera frambuffer(s). Generally, boards with built-in cameras will have a default setting that is large enough. If the constructor raises a MemoryError or an IDFError, this probably indicates the setting is too small and should be increased. -//| -//| -//| .. important:: -//| -//| Not all supported sensors have all -//| of the properties listed below. For instance, the -//| OV5640 supports `denoise`, but the -//| OV2640 does not. The underlying esp32-camera -//| library does not provide a reliable API to check -//| which settings are supported. CircuitPython makes -//| a best effort to determine when an unsupported -//| property is set and will raise an exception in -//| that case. -//| -//| :param data_pins: The 8 data data_pins used for image data transfer from the camera module, least significant bit first -//| :param pixel_clock_pin: The pixel clock output from the camera module -//| :param vsync_pin: The vertical sync pulse output from the camera module -//| :param href_pin: The horizontal reference output from the camera module -//| :param i2c: The I2C bus connected to the camera module -//| :param external_clock_pin: The pin on which to generate the external clock -//| :param external_clock_frequency: The frequency generated on the external clock pin -//| :param powerdown_pin: The powerdown input to the camera module -//| :param reset_pin: The reset input to the camera module -//| :param pixel_format: The pixel format of the captured image -//| :param frame_size: The size of captured image -//| :param jpeg_quality: For `PixelFormat.JPEG`, the quality. Higher numbers increase quality. If the quality is too high, the JPEG data will be larger than the availalble buffer size and the image will be unusable or truncated. The exact range of appropriate values depends on the sensor and must be determined empirically. -//| :param framebuffer_count: The number of framebuffers (1 for single-buffered and 2 for double-buffered) -//| :param grab_mode: When to grab a new frame -//| """ -STATIC mp_obj_t esp32_camera_camera_make_new(const mp_obj_type_t *type, size_t n_args, size_t n_kw, const mp_obj_t *all_args) { - enum { ARG_data_pins, ARG_pixel_clock_pin, ARG_vsync_pin, ARG_href_pin, ARG_i2c, ARG_external_clock_pin, ARG_external_clock_frequency, ARG_powerdown_pin, ARG_reset_pin, ARG_pixel_format, ARG_frame_size, ARG_jpeg_quality, ARG_framebuffer_count, ARG_grab_mode, NUM_ARGS }; - static const mp_arg_t allowed_args[] = { - { MP_QSTR_data_pins, MP_ARG_OBJ | MP_ARG_KW_ONLY | MP_ARG_REQUIRED }, - { MP_QSTR_pixel_clock_pin, MP_ARG_OBJ | MP_ARG_KW_ONLY | MP_ARG_REQUIRED }, - { MP_QSTR_vsync_pin, MP_ARG_OBJ | MP_ARG_KW_ONLY | MP_ARG_REQUIRED }, - { MP_QSTR_href_pin, MP_ARG_OBJ | MP_ARG_KW_ONLY | MP_ARG_REQUIRED }, - { MP_QSTR_i2c, MP_ARG_OBJ | MP_ARG_KW_ONLY | MP_ARG_REQUIRED }, - { MP_QSTR_external_clock_pin, MP_ARG_OBJ | MP_ARG_KW_ONLY, { .u_obj = MP_ROM_NONE } }, - { MP_QSTR_external_clock_frequency, MP_ARG_INT | MP_ARG_KW_ONLY, { .u_int = 20000000L } }, - { MP_QSTR_powerdown_pin, MP_ARG_OBJ | MP_ARG_KW_ONLY, { .u_obj = MP_ROM_NONE } }, - { MP_QSTR_reset_pin, MP_ARG_OBJ | MP_ARG_KW_ONLY, { .u_obj = MP_ROM_NONE } }, - { MP_QSTR_pixel_format, MP_ARG_OBJ | MP_ARG_KW_ONLY, { .u_obj = MP_ROM_PTR((void *)&pixel_format_RGB565_obj) } }, - { MP_QSTR_frame_size, MP_ARG_OBJ | MP_ARG_KW_ONLY, { .u_obj = MP_ROM_PTR((void *)&frame_size_QQVGA_obj) } }, - { MP_QSTR_jpeg_quality, MP_ARG_INT | MP_ARG_KW_ONLY, { .u_int = 15 } }, - { MP_QSTR_framebuffer_count, MP_ARG_INT | MP_ARG_KW_ONLY, { .u_int = 1 } }, - { MP_QSTR_grab_mode, MP_ARG_OBJ | MP_ARG_KW_ONLY, { .u_obj = MP_ROM_PTR((void *)&grab_mode_WHEN_EMPTY_obj) } }, - }; - - mp_arg_val_t args[MP_ARRAY_SIZE(allowed_args)]; - MP_STATIC_ASSERT(MP_ARRAY_SIZE(allowed_args) == NUM_ARGS); - mp_arg_parse_all_kw_array(n_args, n_kw, all_args, MP_ARRAY_SIZE(allowed_args), allowed_args, args); - - uint8_t data_pins[8]; - uint8_t data_pin_count; - validate_pins(MP_QSTR_data_pins, data_pins, MP_ARRAY_SIZE(data_pins), args[ARG_data_pins].u_obj, &data_pin_count); - mp_arg_validate_length(data_pin_count, 8, MP_QSTR_data_pins); - - const mcu_pin_obj_t *pixel_clock_pin = - validate_obj_is_free_pin(args[ARG_pixel_clock_pin].u_obj, MP_QSTR_pixel_clock_pin); - const mcu_pin_obj_t *vsync_pin = - validate_obj_is_free_pin(args[ARG_vsync_pin].u_obj, MP_QSTR_vsync_pin); - const mcu_pin_obj_t *href_pin = - validate_obj_is_free_pin(args[ARG_href_pin].u_obj, MP_QSTR_href_pin); - busio_i2c_obj_t *i2c = MP_OBJ_TO_PTR(mp_arg_validate_type(args[ARG_i2c].u_obj, &busio_i2c_type, MP_QSTR_i2c)); - const mcu_pin_obj_t *external_clock_pin = - validate_obj_is_free_pin_or_none(args[ARG_external_clock_pin].u_obj, MP_QSTR_external_clock_pin); - const mcu_pin_obj_t *powerdown_pin = - validate_obj_is_free_pin_or_none(args[ARG_powerdown_pin].u_obj, MP_QSTR_powerdown_pin); - const mcu_pin_obj_t *reset_pin = - validate_obj_is_free_pin_or_none(args[ARG_reset_pin].u_obj, MP_QSTR_reset_pin); - const mp_int_t external_clock_frequency = - mp_arg_validate_int_range(args[ARG_external_clock_frequency].u_int, 0, 40000000, MP_QSTR_external_clock_frequency); - - camera_grab_mode_t grab_mode = validate_grab_mode(args[ARG_grab_mode].u_obj, MP_QSTR_grab_mode); - framesize_t frame_size = validate_frame_size(args[ARG_frame_size].u_obj, MP_QSTR_frame_size); - pixformat_t pixel_format = validate_pixel_format(args[ARG_pixel_format].u_obj, MP_QSTR_pixel_format); - mp_int_t jpeg_quality = mp_arg_validate_int_range(args[ARG_jpeg_quality].u_int, 2, 55, MP_QSTR_jpeg_quality); - mp_int_t framebuffer_count = mp_arg_validate_int_range(args[ARG_framebuffer_count].u_int, 1, 2, MP_QSTR_framebuffer_count); - - esp32_camera_camera_obj_t *self = m_new_obj(esp32_camera_camera_obj_t); - self->base.type = &esp32_camera_camera_type; - common_hal_esp32_camera_camera_construct( - self, - data_pins, - external_clock_pin, - pixel_clock_pin, - vsync_pin, - href_pin, - powerdown_pin, - reset_pin, - i2c, - external_clock_frequency, - pixel_format, - frame_size, - jpeg_quality, - framebuffer_count, - grab_mode); - return MP_OBJ_FROM_PTR(self); -} - -//| def deinit(self) -> None: -//| """Deinitialises the camera and releases all memory resources for reuse.""" -//| ... -STATIC mp_obj_t esp32_camera_camera_deinit(mp_obj_t self_in) { - esp32_camera_camera_obj_t *self = MP_OBJ_TO_PTR(self_in); - common_hal_esp32_camera_camera_deinit(self); - return mp_const_none; -} -STATIC MP_DEFINE_CONST_FUN_OBJ_1(esp32_camera_camera_deinit_obj, esp32_camera_camera_deinit); - -STATIC void check_for_deinit(esp32_camera_camera_obj_t *self) { - if (common_hal_esp32_camera_camera_deinited(self)) { - raise_deinited_error(); - } -} - -//| def __enter__(self) -> Camera: -//| """No-op used by Context Managers.""" -//| ... -// Provided by context manager helper. - -//| def __exit__(self) -> None: -//| """Automatically deinitializes the hardware when exiting a context. See -//| :ref:`lifetime-and-contextmanagers` for more info.""" -//| ... -STATIC mp_obj_t esp32_camera_camera_obj___exit__(size_t n_args, const mp_obj_t *args) { - (void)n_args; - return esp32_camera_camera_deinit(args[0]); -} -STATIC MP_DEFINE_CONST_FUN_OBJ_VAR_BETWEEN(esp32_camera_camera___exit___obj, 4, 4, esp32_camera_camera_obj___exit__); - -//| frame_available: bool -//| """True if a frame is available, False otherwise""" - -STATIC mp_obj_t esp32_camera_camera_frame_available_get(const mp_obj_t self_in) { - esp32_camera_camera_obj_t *self = MP_OBJ_TO_PTR(self_in); - check_for_deinit(self); - return mp_obj_new_bool(esp_camera_fb_available()); -} -STATIC MP_DEFINE_CONST_FUN_OBJ_1(esp32_camera_camera_frame_available_get_obj, esp32_camera_camera_frame_available_get); - -MP_PROPERTY_GETTER(esp32_camera_camera_frame_available_obj, - (mp_obj_t)&esp32_camera_camera_frame_available_get_obj); - -//| def take( -//| self, timeout: Optional[float] = 0.25 -//| ) -> Optional[displayio.Bitmap | ReadableBuffer]: -//| """Record a frame. Wait up to 'timeout' seconds for a frame to be captured. -//| -//| In the case of timeout, `None` is returned. -//| If `pixel_format` is `PixelFormat.JPEG`, the returned value is a read-only `memoryview`. -//| Otherwise, the returned value is a read-only `displayio.Bitmap`. -//| """ -STATIC mp_obj_t esp32_camera_camera_take(size_t n_args, const mp_obj_t *args) { - esp32_camera_camera_obj_t *self = MP_OBJ_TO_PTR(args[0]); - mp_float_t timeout = n_args < 2 ? MICROPY_FLOAT_CONST(0.25) : mp_obj_get_float(args[1]); - check_for_deinit(self); - camera_fb_t *result = common_hal_esp32_camera_camera_take(self, (int)MICROPY_FLOAT_C_FUN(round)(timeout * 1000)); - if (!result) { - return mp_const_none; - } - pixformat_t format = common_hal_esp32_camera_camera_get_pixel_format(self); - if (format == PIXFORMAT_JPEG) { - return mp_obj_new_memoryview('b', result->len, result->buf); - } else { - int width = common_hal_esp32_camera_camera_get_width(self); - int height = common_hal_esp32_camera_camera_get_height(self); - displayio_bitmap_t *bitmap = m_new_obj(displayio_bitmap_t); - bitmap->base.type = &displayio_bitmap_type; - common_hal_displayio_bitmap_construct_from_buffer(bitmap, width, height, (format == PIXFORMAT_RGB565) ? 16 : 8, (uint32_t *)(void *)result->buf, true); - return bitmap; - } -} -STATIC MP_DEFINE_CONST_FUN_OBJ_VAR_BETWEEN(esp32_camera_camera_take_obj, 1, 2, esp32_camera_camera_take); - - -//| def reconfigure( -//| self, -//| frame_size: Optional[FrameSize] = None, -//| pixel_format: Optional[PixelFormat] = None, -//| grab_mode: Optional[GrabMode] = None, -//| framebuffer_count: Optional[int] = None, -//| ) -> None: -//| """Change multiple related camera settings simultaneously -//| -//| Because these settings interact in complex ways, and take longer than -//| the other properties to set, they are set together in a single function call. -//| -//| If an argument is unspecified or None, then the setting is unchanged.""" - -STATIC mp_obj_t esp32_camera_camera_reconfigure(mp_uint_t n_args, const mp_obj_t *pos_args, mp_map_t *kw_args) { - esp32_camera_camera_obj_t *self = MP_OBJ_TO_PTR(pos_args[0]); - check_for_deinit(self); - - enum { ARG_frame_size, ARG_pixel_format, ARG_grab_mode, ARG_framebuffer_count }; - static const mp_arg_t allowed_args[] = { - { MP_QSTR_frame_size, MP_ARG_OBJ, {.u_obj = MP_ROM_NONE} }, - { MP_QSTR_pixel_format, MP_ARG_OBJ, {.u_obj = MP_ROM_NONE} }, - { MP_QSTR_grab_mode, MP_ARG_OBJ, {.u_obj = MP_ROM_NONE} }, - { MP_QSTR_framebuffer_count, MP_ARG_OBJ, {.u_obj = MP_ROM_NONE} }, - }; - - mp_arg_val_t args[MP_ARRAY_SIZE(allowed_args)]; - mp_arg_parse_all(n_args - 1, pos_args + 1, kw_args, MP_ARRAY_SIZE(allowed_args), allowed_args, args); - - framesize_t frame_size = - args[ARG_frame_size].u_obj != MP_ROM_NONE - ? validate_frame_size(args[ARG_frame_size].u_obj, MP_QSTR_frame_size) - : common_hal_esp32_camera_camera_get_frame_size(self); - pixformat_t pixel_format = - args[ARG_pixel_format].u_obj != MP_ROM_NONE - ? validate_pixel_format(args[ARG_pixel_format].u_obj, MP_QSTR_pixel_format) - : common_hal_esp32_camera_camera_get_pixel_format(self); - camera_grab_mode_t grab_mode = - args[ARG_grab_mode].u_obj != MP_ROM_NONE - ? validate_grab_mode(args[ARG_grab_mode].u_obj, MP_QSTR_grab_mode) - : common_hal_esp32_camera_camera_get_grab_mode(self); - bool framebuffer_count = - args[ARG_framebuffer_count].u_obj != MP_ROM_NONE - ? mp_obj_get_int(args[ARG_framebuffer_count].u_obj) - : common_hal_esp32_camera_camera_get_framebuffer_count(self); - - common_hal_esp32_camera_camera_reconfigure(self, frame_size, pixel_format, grab_mode, framebuffer_count); - - return mp_const_none; -} -MP_DEFINE_CONST_FUN_OBJ_KW(esp32_camera_camera_reconfigure_obj, 1, esp32_camera_camera_reconfigure); - -//| pixel_format: PixelFormat -//| """The pixel format of captured frames""" - -STATIC mp_obj_t esp32_camera_camera_get_pixel_format(const mp_obj_t self_in) { - esp32_camera_camera_obj_t *self = MP_OBJ_TO_PTR(self_in); - check_for_deinit(self); - return cp_enum_find(&esp32_camera_pixel_format_type, common_hal_esp32_camera_camera_get_pixel_format(self)); -} -STATIC MP_DEFINE_CONST_FUN_OBJ_1(esp32_camera_camera_get_pixel_format_obj, esp32_camera_camera_get_pixel_format); - -MP_PROPERTY_GETTER(esp32_camera_camera_pixel_format_obj, - (mp_obj_t)&esp32_camera_camera_get_pixel_format_obj); - - -//| frame_size: FrameSize -//| """The size of captured frames""" - -STATIC mp_obj_t esp32_camera_camera_get_frame_size(const mp_obj_t self_in) { - esp32_camera_camera_obj_t *self = MP_OBJ_TO_PTR(self_in); - check_for_deinit(self); - return cp_enum_find(&esp32_camera_frame_size_type, common_hal_esp32_camera_camera_get_frame_size(self)); -} -STATIC MP_DEFINE_CONST_FUN_OBJ_1(esp32_camera_camera_get_frame_size_obj, esp32_camera_camera_get_frame_size); - -MP_PROPERTY_GETTER(esp32_camera_camera_frame_size_obj, - (mp_obj_t)&esp32_camera_camera_get_frame_size_obj); - -//| contrast: int -//| """The sensor contrast. Positive values increase contrast, negative values lower it. The total range is device-specific but is often from -2 to +2 inclusive.""" - -STATIC mp_obj_t esp32_camera_camera_get_contrast(const mp_obj_t self_in) { - esp32_camera_camera_obj_t *self = MP_OBJ_TO_PTR(self_in); - check_for_deinit(self); - return MP_OBJ_NEW_SMALL_INT(common_hal_esp32_camera_camera_get_contrast(self)); -} -STATIC MP_DEFINE_CONST_FUN_OBJ_1(esp32_camera_camera_get_contrast_obj, esp32_camera_camera_get_contrast); - -STATIC mp_obj_t esp32_camera_camera_set_contrast(const mp_obj_t self_in, const mp_obj_t arg) { - esp32_camera_camera_obj_t *self = MP_OBJ_TO_PTR(self_in); - check_for_deinit(self); - common_hal_esp32_camera_camera_set_contrast(self, mp_obj_get_int(arg)); - return mp_const_none; -} -STATIC MP_DEFINE_CONST_FUN_OBJ_2(esp32_camera_camera_set_contrast_obj, esp32_camera_camera_set_contrast); -MP_PROPERTY_GETSET(esp32_camera_camera_contrast_obj, - (mp_obj_t)&esp32_camera_camera_get_contrast_obj, - (mp_obj_t)&esp32_camera_camera_set_contrast_obj); - -//| brightness: int -//| """The sensor brightness. Positive values increase brightness, negative values lower it. The total range is device-specific but is often from -2 to +2 inclusive.""" - -STATIC mp_obj_t esp32_camera_camera_get_brightness(const mp_obj_t self_in) { - esp32_camera_camera_obj_t *self = MP_OBJ_TO_PTR(self_in); - check_for_deinit(self); - return MP_OBJ_NEW_SMALL_INT(common_hal_esp32_camera_camera_get_brightness(self)); -} -STATIC MP_DEFINE_CONST_FUN_OBJ_1(esp32_camera_camera_get_brightness_obj, esp32_camera_camera_get_brightness); - -STATIC mp_obj_t esp32_camera_camera_set_brightness(const mp_obj_t self_in, const mp_obj_t arg) { - esp32_camera_camera_obj_t *self = MP_OBJ_TO_PTR(self_in); - check_for_deinit(self); - common_hal_esp32_camera_camera_set_brightness(self, mp_obj_get_int(arg)); - return mp_const_none; -} -STATIC MP_DEFINE_CONST_FUN_OBJ_2(esp32_camera_camera_set_brightness_obj, esp32_camera_camera_set_brightness); -MP_PROPERTY_GETSET(esp32_camera_camera_brightness_obj, - (mp_obj_t)&esp32_camera_camera_get_brightness_obj, - (mp_obj_t)&esp32_camera_camera_set_brightness_obj); - -//| saturation: int -//| """The sensor saturation. Positive values increase saturation (more vibrant colors), negative values lower it (more muted colors). The total range is device-specific but the value is often from -2 to +2 inclusive.""" - -STATIC mp_obj_t esp32_camera_camera_get_saturation(const mp_obj_t self_in) { - esp32_camera_camera_obj_t *self = MP_OBJ_TO_PTR(self_in); - check_for_deinit(self); - return MP_OBJ_NEW_SMALL_INT(common_hal_esp32_camera_camera_get_saturation(self)); -} -STATIC MP_DEFINE_CONST_FUN_OBJ_1(esp32_camera_camera_get_saturation_obj, esp32_camera_camera_get_saturation); - -STATIC mp_obj_t esp32_camera_camera_set_saturation(const mp_obj_t self_in, const mp_obj_t arg) { - esp32_camera_camera_obj_t *self = MP_OBJ_TO_PTR(self_in); - check_for_deinit(self); - common_hal_esp32_camera_camera_set_saturation(self, mp_obj_get_int(arg)); - return mp_const_none; -} -STATIC MP_DEFINE_CONST_FUN_OBJ_2(esp32_camera_camera_set_saturation_obj, esp32_camera_camera_set_saturation); -MP_PROPERTY_GETSET(esp32_camera_camera_saturation_obj, - (mp_obj_t)&esp32_camera_camera_get_saturation_obj, - (mp_obj_t)&esp32_camera_camera_set_saturation_obj); - -//| sharpness: int -//| """The sensor sharpness. Positive values increase sharpness (more defined edges), negative values lower it (softer edges). The total range is device-specific but the value is often from -2 to +2 inclusive.""" - -STATIC mp_obj_t esp32_camera_camera_get_sharpness(const mp_obj_t self_in) { - esp32_camera_camera_obj_t *self = MP_OBJ_TO_PTR(self_in); - check_for_deinit(self); - return MP_OBJ_NEW_SMALL_INT(common_hal_esp32_camera_camera_get_sharpness(self)); -} -STATIC MP_DEFINE_CONST_FUN_OBJ_1(esp32_camera_camera_get_sharpness_obj, esp32_camera_camera_get_sharpness); - -STATIC mp_obj_t esp32_camera_camera_set_sharpness(const mp_obj_t self_in, const mp_obj_t arg) { - esp32_camera_camera_obj_t *self = MP_OBJ_TO_PTR(self_in); - check_for_deinit(self); - common_hal_esp32_camera_camera_set_sharpness(self, mp_obj_get_int(arg)); - return mp_const_none; -} -STATIC MP_DEFINE_CONST_FUN_OBJ_2(esp32_camera_camera_set_sharpness_obj, esp32_camera_camera_set_sharpness); -MP_PROPERTY_GETSET(esp32_camera_camera_sharpness_obj, - (mp_obj_t)&esp32_camera_camera_get_sharpness_obj, - (mp_obj_t)&esp32_camera_camera_set_sharpness_obj); - -//| denoise: int -//| """The sensor 'denoise' setting. Any camera sensor has inherent 'noise', especially in low brightness environments. Software algorithms can decrease noise at the expense of fine detail. A larger value increases the amount of software noise removal. The total range is device-specific but the value is often from 0 to 10.""" - -STATIC mp_obj_t esp32_camera_camera_get_denoise(const mp_obj_t self_in) { - esp32_camera_camera_obj_t *self = MP_OBJ_TO_PTR(self_in); - check_for_deinit(self); - return MP_OBJ_NEW_SMALL_INT(common_hal_esp32_camera_camera_get_denoise(self)); -} -STATIC MP_DEFINE_CONST_FUN_OBJ_1(esp32_camera_camera_get_denoise_obj, esp32_camera_camera_get_denoise); - -STATIC mp_obj_t esp32_camera_camera_set_denoise(const mp_obj_t self_in, const mp_obj_t arg) { - esp32_camera_camera_obj_t *self = MP_OBJ_TO_PTR(self_in); - check_for_deinit(self); - common_hal_esp32_camera_camera_set_denoise(self, mp_obj_get_int(arg)); - return mp_const_none; -} -STATIC MP_DEFINE_CONST_FUN_OBJ_2(esp32_camera_camera_set_denoise_obj, esp32_camera_camera_set_denoise); -MP_PROPERTY_GETSET(esp32_camera_camera_denoise_obj, - (mp_obj_t)&esp32_camera_camera_get_denoise_obj, - (mp_obj_t)&esp32_camera_camera_set_denoise_obj); - -//| gain_ceiling: GainCeiling -//| """The sensor 'gain ceiling' setting. "Gain" is an analog multiplier applied to the raw sensor data. The 'ceiling' is the maximum gain value that the sensor will use. A higher gain means that the sensor has a greater response to light, but also makes sensor noise more visible.""" - -STATIC mp_obj_t esp32_camera_camera_get_gain_ceiling(const mp_obj_t self_in) { - esp32_camera_camera_obj_t *self = MP_OBJ_TO_PTR(self_in); - check_for_deinit(self); - return cp_enum_find(&esp32_camera_gain_ceiling_type, common_hal_esp32_camera_camera_get_gainceiling(self)); -} -STATIC MP_DEFINE_CONST_FUN_OBJ_1(esp32_camera_camera_get_gain_ceiling_obj, esp32_camera_camera_get_gain_ceiling); - -STATIC mp_obj_t esp32_camera_camera_set_gain_ceiling(const mp_obj_t self_in, const mp_obj_t arg) { - esp32_camera_camera_obj_t *self = MP_OBJ_TO_PTR(self_in); - check_for_deinit(self); - common_hal_esp32_camera_camera_set_gainceiling(self, validate_gain_ceiling(arg, MP_QSTR_gain_ceiling)); - return mp_const_none; -} -STATIC MP_DEFINE_CONST_FUN_OBJ_2(esp32_camera_camera_set_gain_ceiling_obj, esp32_camera_camera_set_gain_ceiling); -MP_PROPERTY_GETSET(esp32_camera_camera_gain_ceiling_obj, - (mp_obj_t)&esp32_camera_camera_get_gain_ceiling_obj, - (mp_obj_t)&esp32_camera_camera_set_gain_ceiling_obj); - -//| quality: int -//| """The 'quality' setting when capturing JPEG images. This is similar to the quality setting when exporting a jpeg image from photo editing software. Typical values range from 5 to 40, with higher numbers leading to larger image sizes and better overall image quality. However, when the quality is set to a high number, the total size of the JPEG data can exceed the size of an internal buffer, causing image capture to fail.""" - -STATIC mp_obj_t esp32_camera_camera_get_quality(const mp_obj_t self_in) { - esp32_camera_camera_obj_t *self = MP_OBJ_TO_PTR(self_in); - check_for_deinit(self); - return MP_OBJ_NEW_SMALL_INT(common_hal_esp32_camera_camera_get_quality(self)); -} -STATIC MP_DEFINE_CONST_FUN_OBJ_1(esp32_camera_camera_get_quality_obj, esp32_camera_camera_get_quality); - -STATIC mp_obj_t esp32_camera_camera_set_quality(const mp_obj_t self_in, const mp_obj_t arg) { - esp32_camera_camera_obj_t *self = MP_OBJ_TO_PTR(self_in); - check_for_deinit(self); - common_hal_esp32_camera_camera_set_quality(self, mp_obj_get_int(arg)); - return mp_const_none; -} -STATIC MP_DEFINE_CONST_FUN_OBJ_2(esp32_camera_camera_set_quality_obj, esp32_camera_camera_set_quality); -MP_PROPERTY_GETSET(esp32_camera_camera_quality_obj, - (mp_obj_t)&esp32_camera_camera_get_quality_obj, - (mp_obj_t)&esp32_camera_camera_set_quality_obj); - -//| colorbar: bool -//| """When `True`, a test pattern image is captured and the real sensor data is not used.""" - -STATIC mp_obj_t esp32_camera_camera_get_colorbar(const mp_obj_t self_in) { - esp32_camera_camera_obj_t *self = MP_OBJ_TO_PTR(self_in); - check_for_deinit(self); - return mp_obj_new_bool(common_hal_esp32_camera_camera_get_colorbar(self)); -} -STATIC MP_DEFINE_CONST_FUN_OBJ_1(esp32_camera_camera_get_colorbar_obj, esp32_camera_camera_get_colorbar); - -STATIC mp_obj_t esp32_camera_camera_set_colorbar(const mp_obj_t self_in, const mp_obj_t arg) { - esp32_camera_camera_obj_t *self = MP_OBJ_TO_PTR(self_in); - check_for_deinit(self); - common_hal_esp32_camera_camera_set_colorbar(self, mp_obj_is_true(arg)); - return mp_const_none; -} -STATIC MP_DEFINE_CONST_FUN_OBJ_2(esp32_camera_camera_set_colorbar_obj, esp32_camera_camera_set_colorbar); -MP_PROPERTY_GETSET(esp32_camera_camera_colorbar_obj, - (mp_obj_t)&esp32_camera_camera_get_colorbar_obj, - (mp_obj_t)&esp32_camera_camera_set_colorbar_obj); - -//| whitebal: bool -//| """When `True`, the camera attempts to automatically control white balance. When `False`, the `wb_mode` setting is used instead.""" - -STATIC mp_obj_t esp32_camera_camera_get_whitebal(const mp_obj_t self_in) { - esp32_camera_camera_obj_t *self = MP_OBJ_TO_PTR(self_in); - check_for_deinit(self); - return mp_obj_new_bool(common_hal_esp32_camera_camera_get_whitebal(self)); -} -STATIC MP_DEFINE_CONST_FUN_OBJ_1(esp32_camera_camera_get_whitebal_obj, esp32_camera_camera_get_whitebal); - -STATIC mp_obj_t esp32_camera_camera_set_whitebal(const mp_obj_t self_in, const mp_obj_t arg) { - esp32_camera_camera_obj_t *self = MP_OBJ_TO_PTR(self_in); - check_for_deinit(self); - common_hal_esp32_camera_camera_set_whitebal(self, mp_obj_is_true(arg)); - return mp_const_none; -} -STATIC MP_DEFINE_CONST_FUN_OBJ_2(esp32_camera_camera_set_whitebal_obj, esp32_camera_camera_set_whitebal); -MP_PROPERTY_GETSET(esp32_camera_camera_whitebal_obj, - (mp_obj_t)&esp32_camera_camera_get_whitebal_obj, - (mp_obj_t)&esp32_camera_camera_set_whitebal_obj); - -//| gain_ctrl: bool -//| """When `True`, the camera attempts to automatically control the sensor gain, up to the value in the `gain_ceiling` property. When `False`, the `agc_gain` setting is used instead.""" - -STATIC mp_obj_t esp32_camera_camera_get_gain_ctrl(const mp_obj_t self_in) { - esp32_camera_camera_obj_t *self = MP_OBJ_TO_PTR(self_in); - check_for_deinit(self); - return mp_obj_new_bool(common_hal_esp32_camera_camera_get_gain_ctrl(self)); -} -STATIC MP_DEFINE_CONST_FUN_OBJ_1(esp32_camera_camera_get_gain_ctrl_obj, esp32_camera_camera_get_gain_ctrl); - -STATIC mp_obj_t esp32_camera_camera_set_gain_ctrl(const mp_obj_t self_in, const mp_obj_t arg) { - esp32_camera_camera_obj_t *self = MP_OBJ_TO_PTR(self_in); - check_for_deinit(self); - common_hal_esp32_camera_camera_set_gain_ctrl(self, mp_obj_is_true(arg)); - return mp_const_none; -} -STATIC MP_DEFINE_CONST_FUN_OBJ_2(esp32_camera_camera_set_gain_ctrl_obj, esp32_camera_camera_set_gain_ctrl); -MP_PROPERTY_GETSET(esp32_camera_camera_gain_ctrl_obj, - (mp_obj_t)&esp32_camera_camera_get_gain_ctrl_obj, - (mp_obj_t)&esp32_camera_camera_set_gain_ctrl_obj); - -//| exposure_ctrl: bool -//| """When `True` the camera attempts to automatically control the exposure. When `False`, the `aec_value` setting is used instead.""" - -STATIC mp_obj_t esp32_camera_camera_get_exposure_ctrl(const mp_obj_t self_in) { - esp32_camera_camera_obj_t *self = MP_OBJ_TO_PTR(self_in); - check_for_deinit(self); - return mp_obj_new_bool(common_hal_esp32_camera_camera_get_exposure_ctrl(self)); -} -STATIC MP_DEFINE_CONST_FUN_OBJ_1(esp32_camera_camera_get_exposure_ctrl_obj, esp32_camera_camera_get_exposure_ctrl); - -STATIC mp_obj_t esp32_camera_camera_set_exposure_ctrl(const mp_obj_t self_in, const mp_obj_t arg) { - esp32_camera_camera_obj_t *self = MP_OBJ_TO_PTR(self_in); - check_for_deinit(self); - common_hal_esp32_camera_camera_set_exposure_ctrl(self, mp_obj_is_true(arg)); - return mp_const_none; -} -STATIC MP_DEFINE_CONST_FUN_OBJ_2(esp32_camera_camera_set_exposure_ctrl_obj, esp32_camera_camera_set_exposure_ctrl); -MP_PROPERTY_GETSET(esp32_camera_camera_exposure_ctrl_obj, - (mp_obj_t)&esp32_camera_camera_get_exposure_ctrl_obj, - (mp_obj_t)&esp32_camera_camera_set_exposure_ctrl_obj); - -//| hmirror: bool -//| """When `True` the camera image is mirrored left-to-right""" - -STATIC mp_obj_t esp32_camera_camera_get_hmirror(const mp_obj_t self_in) { - esp32_camera_camera_obj_t *self = MP_OBJ_TO_PTR(self_in); - check_for_deinit(self); - return mp_obj_new_bool(common_hal_esp32_camera_camera_get_hmirror(self)); -} -STATIC MP_DEFINE_CONST_FUN_OBJ_1(esp32_camera_camera_get_hmirror_obj, esp32_camera_camera_get_hmirror); - -STATIC mp_obj_t esp32_camera_camera_set_hmirror(const mp_obj_t self_in, const mp_obj_t arg) { - esp32_camera_camera_obj_t *self = MP_OBJ_TO_PTR(self_in); - check_for_deinit(self); - common_hal_esp32_camera_camera_set_hmirror(self, mp_obj_is_true(arg)); - return mp_const_none; -} -STATIC MP_DEFINE_CONST_FUN_OBJ_2(esp32_camera_camera_set_hmirror_obj, esp32_camera_camera_set_hmirror); -MP_PROPERTY_GETSET(esp32_camera_camera_hmirror_obj, - (mp_obj_t)&esp32_camera_camera_get_hmirror_obj, - (mp_obj_t)&esp32_camera_camera_set_hmirror_obj); - -//| vflip: bool -//| """When `True` the camera image is flipped top-to-bottom""" - -STATIC mp_obj_t esp32_camera_camera_get_vflip(const mp_obj_t self_in) { - esp32_camera_camera_obj_t *self = MP_OBJ_TO_PTR(self_in); - check_for_deinit(self); - return mp_obj_new_bool(common_hal_esp32_camera_camera_get_vflip(self)); -} -STATIC MP_DEFINE_CONST_FUN_OBJ_1(esp32_camera_camera_get_vflip_obj, esp32_camera_camera_get_vflip); - -STATIC mp_obj_t esp32_camera_camera_set_vflip(const mp_obj_t self_in, const mp_obj_t arg) { - esp32_camera_camera_obj_t *self = MP_OBJ_TO_PTR(self_in); - check_for_deinit(self); - common_hal_esp32_camera_camera_set_vflip(self, mp_obj_is_true(arg)); - return mp_const_none; -} -STATIC MP_DEFINE_CONST_FUN_OBJ_2(esp32_camera_camera_set_vflip_obj, esp32_camera_camera_set_vflip); -MP_PROPERTY_GETSET(esp32_camera_camera_vflip_obj, - (mp_obj_t)&esp32_camera_camera_get_vflip_obj, - (mp_obj_t)&esp32_camera_camera_set_vflip_obj); - -//| aec2: bool -//| """When `True` the sensor's "night mode" is enabled, extending the range of automatic gain control.""" - -STATIC mp_obj_t esp32_camera_camera_get_aec2(const mp_obj_t self_in) { - esp32_camera_camera_obj_t *self = MP_OBJ_TO_PTR(self_in); - check_for_deinit(self); - return mp_obj_new_bool(common_hal_esp32_camera_camera_get_aec2(self)); -} -STATIC MP_DEFINE_CONST_FUN_OBJ_1(esp32_camera_camera_get_aec2_obj, esp32_camera_camera_get_aec2); - -STATIC mp_obj_t esp32_camera_camera_set_aec2(const mp_obj_t self_in, const mp_obj_t arg) { - esp32_camera_camera_obj_t *self = MP_OBJ_TO_PTR(self_in); - check_for_deinit(self); - common_hal_esp32_camera_camera_set_aec2(self, mp_obj_is_true(arg)); - return mp_const_none; -} -STATIC MP_DEFINE_CONST_FUN_OBJ_2(esp32_camera_camera_set_aec2_obj, esp32_camera_camera_set_aec2); -MP_PROPERTY_GETSET(esp32_camera_camera_aec2_obj, - (mp_obj_t)&esp32_camera_camera_get_aec2_obj, - (mp_obj_t)&esp32_camera_camera_set_aec2_obj); - -//| awb_gain: bool -//| """Access the awb_gain property of the camera sensor""" - -STATIC mp_obj_t esp32_camera_camera_get_awb_gain(const mp_obj_t self_in) { - esp32_camera_camera_obj_t *self = MP_OBJ_TO_PTR(self_in); - check_for_deinit(self); - return mp_obj_new_bool(common_hal_esp32_camera_camera_get_awb_gain(self)); -} -STATIC MP_DEFINE_CONST_FUN_OBJ_1(esp32_camera_camera_get_awb_gain_obj, esp32_camera_camera_get_awb_gain); - -STATIC mp_obj_t esp32_camera_camera_set_awb_gain(const mp_obj_t self_in, const mp_obj_t arg) { - esp32_camera_camera_obj_t *self = MP_OBJ_TO_PTR(self_in); - check_for_deinit(self); - common_hal_esp32_camera_camera_set_awb_gain(self, mp_obj_is_true(arg)); - return mp_const_none; -} -STATIC MP_DEFINE_CONST_FUN_OBJ_2(esp32_camera_camera_set_awb_gain_obj, esp32_camera_camera_set_awb_gain); -MP_PROPERTY_GETSET(esp32_camera_camera_awb_gain_obj, - (mp_obj_t)&esp32_camera_camera_get_awb_gain_obj, - (mp_obj_t)&esp32_camera_camera_set_awb_gain_obj); - -//| agc_gain: int -//| """Access the gain level of the sensor. Higher values produce brighter images. Typical settings range from 0 to 30. """ - -STATIC mp_obj_t esp32_camera_camera_get_agc_gain(const mp_obj_t self_in) { - esp32_camera_camera_obj_t *self = MP_OBJ_TO_PTR(self_in); - check_for_deinit(self); - return MP_OBJ_NEW_SMALL_INT(common_hal_esp32_camera_camera_get_agc_gain(self)); -} -STATIC MP_DEFINE_CONST_FUN_OBJ_1(esp32_camera_camera_get_agc_gain_obj, esp32_camera_camera_get_agc_gain); - -STATIC mp_obj_t esp32_camera_camera_set_agc_gain(const mp_obj_t self_in, const mp_obj_t arg) { - esp32_camera_camera_obj_t *self = MP_OBJ_TO_PTR(self_in); - check_for_deinit(self); - common_hal_esp32_camera_camera_set_agc_gain(self, mp_obj_get_int(arg)); - return mp_const_none; -} -STATIC MP_DEFINE_CONST_FUN_OBJ_2(esp32_camera_camera_set_agc_gain_obj, esp32_camera_camera_set_agc_gain); -MP_PROPERTY_GETSET(esp32_camera_camera_agc_gain_obj, - (mp_obj_t)&esp32_camera_camera_get_agc_gain_obj, - (mp_obj_t)&esp32_camera_camera_set_agc_gain_obj); - -//| aec_value: int -//| """Access the exposure value of the camera. Higher values produce brighter images. Typical settings range from 0 to 1200.""" - -STATIC mp_obj_t esp32_camera_camera_get_aec_value(const mp_obj_t self_in) { - esp32_camera_camera_obj_t *self = MP_OBJ_TO_PTR(self_in); - check_for_deinit(self); - return MP_OBJ_NEW_SMALL_INT(common_hal_esp32_camera_camera_get_aec_value(self)); -} -STATIC MP_DEFINE_CONST_FUN_OBJ_1(esp32_camera_camera_get_aec_value_obj, esp32_camera_camera_get_aec_value); - -STATIC mp_obj_t esp32_camera_camera_set_aec_value(const mp_obj_t self_in, const mp_obj_t arg) { - esp32_camera_camera_obj_t *self = MP_OBJ_TO_PTR(self_in); - check_for_deinit(self); - common_hal_esp32_camera_camera_set_aec_value(self, mp_obj_get_int(arg)); - return mp_const_none; -} -STATIC MP_DEFINE_CONST_FUN_OBJ_2(esp32_camera_camera_set_aec_value_obj, esp32_camera_camera_set_aec_value); -MP_PROPERTY_GETSET(esp32_camera_camera_aec_value_obj, - (mp_obj_t)&esp32_camera_camera_get_aec_value_obj, - (mp_obj_t)&esp32_camera_camera_set_aec_value_obj); - -//| special_effect: int -//| """Enable a "special effect". Zero is no special effect. On OV5640, special effects range from 0 to 6 inclusive and select various color modes.""" - -STATIC mp_obj_t esp32_camera_camera_get_special_effect(const mp_obj_t self_in) { - esp32_camera_camera_obj_t *self = MP_OBJ_TO_PTR(self_in); - check_for_deinit(self); - return MP_OBJ_NEW_SMALL_INT(common_hal_esp32_camera_camera_get_special_effect(self)); -} -STATIC MP_DEFINE_CONST_FUN_OBJ_1(esp32_camera_camera_get_special_effect_obj, esp32_camera_camera_get_special_effect); - -STATIC mp_obj_t esp32_camera_camera_set_special_effect(const mp_obj_t self_in, const mp_obj_t arg) { - esp32_camera_camera_obj_t *self = MP_OBJ_TO_PTR(self_in); - check_for_deinit(self); - common_hal_esp32_camera_camera_set_special_effect(self, mp_obj_get_int(arg)); - return mp_const_none; -} -STATIC MP_DEFINE_CONST_FUN_OBJ_2(esp32_camera_camera_set_special_effect_obj, esp32_camera_camera_set_special_effect); -MP_PROPERTY_GETSET(esp32_camera_camera_special_effect_obj, - (mp_obj_t)&esp32_camera_camera_get_special_effect_obj, - (mp_obj_t)&esp32_camera_camera_set_special_effect_obj); - -//| wb_mode: int -//| """The white balance mode. 0 is automatic white balance. Typical values range from 0 to 4 inclusive.""" - -STATIC mp_obj_t esp32_camera_camera_get_wb_mode(const mp_obj_t self_in) { - esp32_camera_camera_obj_t *self = MP_OBJ_TO_PTR(self_in); - check_for_deinit(self); - return MP_OBJ_NEW_SMALL_INT(common_hal_esp32_camera_camera_get_wb_mode(self)); -} -STATIC MP_DEFINE_CONST_FUN_OBJ_1(esp32_camera_camera_get_wb_mode_obj, esp32_camera_camera_get_wb_mode); - -STATIC mp_obj_t esp32_camera_camera_set_wb_mode(const mp_obj_t self_in, const mp_obj_t arg) { - esp32_camera_camera_obj_t *self = MP_OBJ_TO_PTR(self_in); - check_for_deinit(self); - common_hal_esp32_camera_camera_set_wb_mode(self, mp_obj_get_int(arg)); - return mp_const_none; -} -STATIC MP_DEFINE_CONST_FUN_OBJ_2(esp32_camera_camera_set_wb_mode_obj, esp32_camera_camera_set_wb_mode); -MP_PROPERTY_GETSET(esp32_camera_camera_wb_mode_obj, - (mp_obj_t)&esp32_camera_camera_get_wb_mode_obj, - (mp_obj_t)&esp32_camera_camera_set_wb_mode_obj); - -//| ae_level: int -//| """The exposure offset for automatic exposure. Typical values range from -2 to +2.""" - -STATIC mp_obj_t esp32_camera_camera_get_ae_level(const mp_obj_t self_in) { - esp32_camera_camera_obj_t *self = MP_OBJ_TO_PTR(self_in); - check_for_deinit(self); - return MP_OBJ_NEW_SMALL_INT(common_hal_esp32_camera_camera_get_ae_level(self)); -} -STATIC MP_DEFINE_CONST_FUN_OBJ_1(esp32_camera_camera_get_ae_level_obj, esp32_camera_camera_get_ae_level); - -STATIC mp_obj_t esp32_camera_camera_set_ae_level(const mp_obj_t self_in, const mp_obj_t arg) { - esp32_camera_camera_obj_t *self = MP_OBJ_TO_PTR(self_in); - check_for_deinit(self); - common_hal_esp32_camera_camera_set_ae_level(self, mp_obj_get_int(arg)); - return mp_const_none; -} -STATIC MP_DEFINE_CONST_FUN_OBJ_2(esp32_camera_camera_set_ae_level_obj, esp32_camera_camera_set_ae_level); -MP_PROPERTY_GETSET(esp32_camera_camera_ae_level_obj, - (mp_obj_t)&esp32_camera_camera_get_ae_level_obj, - (mp_obj_t)&esp32_camera_camera_set_ae_level_obj); - -//| dcw: bool -//| """When `True` an advanced white balance mode is selected.""" - -STATIC mp_obj_t esp32_camera_camera_get_dcw(const mp_obj_t self_in) { - esp32_camera_camera_obj_t *self = MP_OBJ_TO_PTR(self_in); - check_for_deinit(self); - return mp_obj_new_bool(common_hal_esp32_camera_camera_get_dcw(self)); -} -STATIC MP_DEFINE_CONST_FUN_OBJ_1(esp32_camera_camera_get_dcw_obj, esp32_camera_camera_get_dcw); - -STATIC mp_obj_t esp32_camera_camera_set_dcw(const mp_obj_t self_in, const mp_obj_t arg) { - esp32_camera_camera_obj_t *self = MP_OBJ_TO_PTR(self_in); - check_for_deinit(self); - common_hal_esp32_camera_camera_set_dcw(self, mp_obj_is_true(arg)); - return mp_const_none; -} -STATIC MP_DEFINE_CONST_FUN_OBJ_2(esp32_camera_camera_set_dcw_obj, esp32_camera_camera_set_dcw); -MP_PROPERTY_GETSET(esp32_camera_camera_dcw_obj, - (mp_obj_t)&esp32_camera_camera_get_dcw_obj, - (mp_obj_t)&esp32_camera_camera_set_dcw_obj); - -//| bpc: bool -//| """When `True`, "black point compensation" is enabled. This can make black parts of the image darker.""" - -STATIC mp_obj_t esp32_camera_camera_get_bpc(const mp_obj_t self_in) { - esp32_camera_camera_obj_t *self = MP_OBJ_TO_PTR(self_in); - check_for_deinit(self); - return mp_obj_new_bool(common_hal_esp32_camera_camera_get_bpc(self)); -} -STATIC MP_DEFINE_CONST_FUN_OBJ_1(esp32_camera_camera_get_bpc_obj, esp32_camera_camera_get_bpc); - -STATIC mp_obj_t esp32_camera_camera_set_bpc(const mp_obj_t self_in, const mp_obj_t arg) { - esp32_camera_camera_obj_t *self = MP_OBJ_TO_PTR(self_in); - check_for_deinit(self); - common_hal_esp32_camera_camera_set_bpc(self, mp_obj_is_true(arg)); - return mp_const_none; -} -STATIC MP_DEFINE_CONST_FUN_OBJ_2(esp32_camera_camera_set_bpc_obj, esp32_camera_camera_set_bpc); -MP_PROPERTY_GETSET(esp32_camera_camera_bpc_obj, - (mp_obj_t)&esp32_camera_camera_get_bpc_obj, - (mp_obj_t)&esp32_camera_camera_set_bpc_obj); - -//| wpc: bool -//| """When `True`, "white point compensation" is enabled. This can make white parts of the image whiter.""" - -STATIC mp_obj_t esp32_camera_camera_get_wpc(const mp_obj_t self_in) { - esp32_camera_camera_obj_t *self = MP_OBJ_TO_PTR(self_in); - check_for_deinit(self); - return mp_obj_new_bool(common_hal_esp32_camera_camera_get_wpc(self)); -} -STATIC MP_DEFINE_CONST_FUN_OBJ_1(esp32_camera_camera_get_wpc_obj, esp32_camera_camera_get_wpc); - -STATIC mp_obj_t esp32_camera_camera_set_wpc(const mp_obj_t self_in, const mp_obj_t arg) { - esp32_camera_camera_obj_t *self = MP_OBJ_TO_PTR(self_in); - check_for_deinit(self); - common_hal_esp32_camera_camera_set_wpc(self, mp_obj_is_true(arg)); - return mp_const_none; -} -STATIC MP_DEFINE_CONST_FUN_OBJ_2(esp32_camera_camera_set_wpc_obj, esp32_camera_camera_set_wpc); -MP_PROPERTY_GETSET(esp32_camera_camera_wpc_obj, - (mp_obj_t)&esp32_camera_camera_get_wpc_obj, - (mp_obj_t)&esp32_camera_camera_set_wpc_obj); - -//| raw_gma: bool -//| """When `True`, raw gamma mode is enabled.""" - -STATIC mp_obj_t esp32_camera_camera_get_raw_gma(const mp_obj_t self_in) { - esp32_camera_camera_obj_t *self = MP_OBJ_TO_PTR(self_in); - check_for_deinit(self); - return mp_obj_new_bool(common_hal_esp32_camera_camera_get_raw_gma(self)); -} -STATIC MP_DEFINE_CONST_FUN_OBJ_1(esp32_camera_camera_get_raw_gma_obj, esp32_camera_camera_get_raw_gma); - -STATIC mp_obj_t esp32_camera_camera_set_raw_gma(const mp_obj_t self_in, const mp_obj_t arg) { - esp32_camera_camera_obj_t *self = MP_OBJ_TO_PTR(self_in); - check_for_deinit(self); - common_hal_esp32_camera_camera_set_raw_gma(self, mp_obj_is_true(arg)); - return mp_const_none; -} -STATIC MP_DEFINE_CONST_FUN_OBJ_2(esp32_camera_camera_set_raw_gma_obj, esp32_camera_camera_set_raw_gma); -MP_PROPERTY_GETSET(esp32_camera_camera_raw_gma_obj, - (mp_obj_t)&esp32_camera_camera_get_raw_gma_obj, - (mp_obj_t)&esp32_camera_camera_set_raw_gma_obj); - -//| lenc: bool -//| """Enable "lens correction". This can help compensate for light fall-off at the edge of the sensor area.""" - -STATIC mp_obj_t esp32_camera_camera_get_lenc(const mp_obj_t self_in) { - esp32_camera_camera_obj_t *self = MP_OBJ_TO_PTR(self_in); - check_for_deinit(self); - return mp_obj_new_bool(common_hal_esp32_camera_camera_get_lenc(self)); -} -STATIC MP_DEFINE_CONST_FUN_OBJ_1(esp32_camera_camera_get_lenc_obj, esp32_camera_camera_get_lenc); - -STATIC mp_obj_t esp32_camera_camera_set_lenc(const mp_obj_t self_in, const mp_obj_t arg) { - esp32_camera_camera_obj_t *self = MP_OBJ_TO_PTR(self_in); - check_for_deinit(self); - common_hal_esp32_camera_camera_set_lenc(self, mp_obj_is_true(arg)); - return mp_const_none; -} -STATIC MP_DEFINE_CONST_FUN_OBJ_2(esp32_camera_camera_set_lenc_obj, esp32_camera_camera_set_lenc); -MP_PROPERTY_GETSET(esp32_camera_camera_lenc_obj, - (mp_obj_t)&esp32_camera_camera_get_lenc_obj, - (mp_obj_t)&esp32_camera_camera_set_lenc_obj); - -//| max_frame_size: FrameSize -//| """The maximum frame size that can be captured""" -STATIC mp_obj_t esp32_camera_camera_get_max_frame_size(const mp_obj_t self_in) { - esp32_camera_camera_obj_t *self = MP_OBJ_TO_PTR(self_in); - check_for_deinit(self); - return cp_enum_find(&esp32_camera_frame_size_type, common_hal_esp32_camera_camera_get_max_frame_size(self)); -} -STATIC MP_DEFINE_CONST_FUN_OBJ_1(esp32_camera_camera_get_max_frame_size_obj, esp32_camera_camera_get_max_frame_size); - -MP_PROPERTY_GETTER(esp32_camera_camera_max_frame_size_obj, - (mp_obj_t)&esp32_camera_camera_get_max_frame_size_obj); - - -//| address: int -//| """The I2C (SCCB) address of the sensor""" -STATIC mp_obj_t esp32_camera_camera_get_address(const mp_obj_t self_in) { - esp32_camera_camera_obj_t *self = MP_OBJ_TO_PTR(self_in); - check_for_deinit(self); - return MP_OBJ_NEW_SMALL_INT(common_hal_esp32_camera_camera_get_address(self)); -} -STATIC MP_DEFINE_CONST_FUN_OBJ_1(esp32_camera_camera_get_address_obj, esp32_camera_camera_get_address); - -MP_PROPERTY_GETTER(esp32_camera_camera_address_obj, - (mp_obj_t)&esp32_camera_camera_get_address_obj); - - -//| sensor_name: str -//| """The name of the sensor""" -STATIC mp_obj_t esp32_camera_camera_get_sensor_name(const mp_obj_t self_in) { - esp32_camera_camera_obj_t *self = MP_OBJ_TO_PTR(self_in); - check_for_deinit(self); - const char *sensor_name = common_hal_esp32_camera_camera_get_sensor_name(self); - return mp_obj_new_str(sensor_name, strlen(sensor_name)); -} -STATIC MP_DEFINE_CONST_FUN_OBJ_1(esp32_camera_camera_get_sensor_name_obj, esp32_camera_camera_get_sensor_name); - -MP_PROPERTY_GETTER(esp32_camera_camera_sensor_name_obj, - (mp_obj_t)&esp32_camera_camera_get_sensor_name_obj); - - -//| supports_jpeg: bool -//| """True if the sensor can capture images in JPEG format""" -STATIC mp_obj_t esp32_camera_camera_get_supports_jpeg(const mp_obj_t self_in) { - esp32_camera_camera_obj_t *self = MP_OBJ_TO_PTR(self_in); - check_for_deinit(self); - return mp_obj_new_bool(common_hal_esp32_camera_camera_get_supports_jpeg(self)); -} -STATIC MP_DEFINE_CONST_FUN_OBJ_1(esp32_camera_camera_get_supports_jpeg_obj, esp32_camera_camera_get_supports_jpeg); - -MP_PROPERTY_GETTER(esp32_camera_camera_supports_jpeg_obj, - (mp_obj_t)&esp32_camera_camera_get_supports_jpeg_obj); - -//| height: int -//| """The height of the image being captured""" -STATIC mp_obj_t esp32_camera_camera_get_height(const mp_obj_t self_in) { - esp32_camera_camera_obj_t *self = MP_OBJ_TO_PTR(self_in); - check_for_deinit(self); - return MP_OBJ_NEW_SMALL_INT(common_hal_esp32_camera_camera_get_height(self)); -} -STATIC MP_DEFINE_CONST_FUN_OBJ_1(esp32_camera_camera_get_height_obj, esp32_camera_camera_get_height); - -MP_PROPERTY_GETTER(esp32_camera_camera_height_obj, - (mp_obj_t)&esp32_camera_camera_get_height_obj); - -//| width: int -//| """The width of the image being captured""" -STATIC mp_obj_t esp32_camera_camera_get_width(const mp_obj_t self_in) { - esp32_camera_camera_obj_t *self = MP_OBJ_TO_PTR(self_in); - check_for_deinit(self); - return MP_OBJ_NEW_SMALL_INT(common_hal_esp32_camera_camera_get_width(self)); -} -STATIC MP_DEFINE_CONST_FUN_OBJ_1(esp32_camera_camera_get_width_obj, esp32_camera_camera_get_width); - -MP_PROPERTY_GETTER(esp32_camera_camera_width_obj, - (mp_obj_t)&esp32_camera_camera_get_width_obj); - -//| grab_mode: GrabMode -//| """The grab mode of the camera""" -STATIC mp_obj_t esp32_camera_camera_get_grab_mode(const mp_obj_t self_in) { - esp32_camera_camera_obj_t *self = MP_OBJ_TO_PTR(self_in); - check_for_deinit(self); - return cp_enum_find(&esp32_camera_grab_mode_type, common_hal_esp32_camera_camera_get_grab_mode(self)); -} -STATIC MP_DEFINE_CONST_FUN_OBJ_1(esp32_camera_camera_get_grab_mode_obj, esp32_camera_camera_get_grab_mode); - -MP_PROPERTY_GETTER(esp32_camera_camera_grab_mode_obj, - (mp_obj_t)&esp32_camera_camera_get_grab_mode_obj); - - -//| framebuffer_count: int -//| """True if double buffering is used""" -//| -STATIC mp_obj_t esp32_camera_camera_get_framebuffer_count(const mp_obj_t self_in) { - esp32_camera_camera_obj_t *self = MP_OBJ_TO_PTR(self_in); - check_for_deinit(self); - return MP_OBJ_NEW_SMALL_INT(common_hal_esp32_camera_camera_get_framebuffer_count(self)); -} -STATIC MP_DEFINE_CONST_FUN_OBJ_1(esp32_camera_camera_get_framebuffer_count_obj, esp32_camera_camera_get_framebuffer_count); - -MP_PROPERTY_GETTER(esp32_camera_camera_framebuffer_count_obj, - (mp_obj_t)&esp32_camera_camera_get_framebuffer_count_obj); - - -STATIC const mp_rom_map_elem_t esp32_camera_camera_locals_table[] = { - { MP_ROM_QSTR(MP_QSTR_address), MP_ROM_PTR(&esp32_camera_camera_address_obj) }, - { MP_ROM_QSTR(MP_QSTR_aec2), MP_ROM_PTR(&esp32_camera_camera_aec2_obj) }, - { MP_ROM_QSTR(MP_QSTR_aec_value), MP_ROM_PTR(&esp32_camera_camera_aec_value_obj) }, - { MP_ROM_QSTR(MP_QSTR_ae_level), MP_ROM_PTR(&esp32_camera_camera_ae_level_obj) }, - { MP_ROM_QSTR(MP_QSTR_agc_gain), MP_ROM_PTR(&esp32_camera_camera_agc_gain_obj) }, - { MP_ROM_QSTR(MP_QSTR_awb_gain), MP_ROM_PTR(&esp32_camera_camera_awb_gain_obj) }, - { MP_ROM_QSTR(MP_QSTR_bpc), MP_ROM_PTR(&esp32_camera_camera_bpc_obj) }, - { MP_ROM_QSTR(MP_QSTR_brightness), MP_ROM_PTR(&esp32_camera_camera_brightness_obj) }, - { MP_ROM_QSTR(MP_QSTR_colorbar), MP_ROM_PTR(&esp32_camera_camera_colorbar_obj) }, - { MP_ROM_QSTR(MP_QSTR_contrast), MP_ROM_PTR(&esp32_camera_camera_contrast_obj) }, - { MP_ROM_QSTR(MP_QSTR_dcw), MP_ROM_PTR(&esp32_camera_camera_dcw_obj) }, - { MP_ROM_QSTR(MP_QSTR_deinit), MP_ROM_PTR(&esp32_camera_camera_deinit_obj) }, - { MP_ROM_QSTR(MP_QSTR_denoise), MP_ROM_PTR(&esp32_camera_camera_denoise_obj) }, - { MP_ROM_QSTR(MP_QSTR_framebuffer_count), MP_ROM_PTR(&esp32_camera_camera_framebuffer_count_obj) }, - { MP_ROM_QSTR(MP_QSTR___enter__), MP_ROM_PTR(&mp_identity_obj) }, - { MP_ROM_QSTR(MP_QSTR___exit__), MP_ROM_PTR(&esp32_camera_camera___exit___obj) }, - { MP_ROM_QSTR(MP_QSTR_exposure_ctrl), MP_ROM_PTR(&esp32_camera_camera_exposure_ctrl_obj) }, - { MP_ROM_QSTR(MP_QSTR_frame_available), MP_ROM_PTR(&esp32_camera_camera_frame_available_obj) }, - { MP_ROM_QSTR(MP_QSTR_frame_size), MP_ROM_PTR(&esp32_camera_camera_frame_size_obj) }, - { MP_ROM_QSTR(MP_QSTR_gain_ceiling), MP_ROM_PTR(&esp32_camera_camera_gain_ceiling_obj) }, - { MP_ROM_QSTR(MP_QSTR_gain_ctrl), MP_ROM_PTR(&esp32_camera_camera_gain_ctrl_obj) }, - { MP_ROM_QSTR(MP_QSTR_grab_mode), MP_ROM_PTR(&esp32_camera_camera_grab_mode_obj) }, - { MP_ROM_QSTR(MP_QSTR_height), MP_ROM_PTR(&esp32_camera_camera_height_obj) }, - { MP_ROM_QSTR(MP_QSTR_hmirror), MP_ROM_PTR(&esp32_camera_camera_hmirror_obj) }, - { MP_ROM_QSTR(MP_QSTR_lenc), MP_ROM_PTR(&esp32_camera_camera_lenc_obj) }, - { MP_ROM_QSTR(MP_QSTR_max_frame_size), MP_ROM_PTR(&esp32_camera_camera_max_frame_size_obj) }, - { MP_ROM_QSTR(MP_QSTR_pixel_format), MP_ROM_PTR(&esp32_camera_camera_pixel_format_obj) }, - { MP_ROM_QSTR(MP_QSTR_quality), MP_ROM_PTR(&esp32_camera_camera_quality_obj) }, - { MP_ROM_QSTR(MP_QSTR_raw_gma), MP_ROM_PTR(&esp32_camera_camera_raw_gma_obj) }, - { MP_ROM_QSTR(MP_QSTR_reconfigure), MP_ROM_PTR(&esp32_camera_camera_reconfigure_obj) }, - { MP_ROM_QSTR(MP_QSTR_saturation), MP_ROM_PTR(&esp32_camera_camera_saturation_obj) }, - { MP_ROM_QSTR(MP_QSTR_sensor_name), MP_ROM_PTR(&esp32_camera_camera_sensor_name_obj) }, - { MP_ROM_QSTR(MP_QSTR_sharpness), MP_ROM_PTR(&esp32_camera_camera_sharpness_obj) }, - { MP_ROM_QSTR(MP_QSTR_special_effect), MP_ROM_PTR(&esp32_camera_camera_special_effect_obj) }, - { MP_ROM_QSTR(MP_QSTR_supports_jpeg), MP_ROM_PTR(&esp32_camera_camera_supports_jpeg_obj) }, - { MP_ROM_QSTR(MP_QSTR_take), MP_ROM_PTR(&esp32_camera_camera_take_obj) }, - { MP_ROM_QSTR(MP_QSTR_vflip), MP_ROM_PTR(&esp32_camera_camera_vflip_obj) }, - { MP_ROM_QSTR(MP_QSTR_wb_mode), MP_ROM_PTR(&esp32_camera_camera_wb_mode_obj) }, - { MP_ROM_QSTR(MP_QSTR_whitebal), MP_ROM_PTR(&esp32_camera_camera_whitebal_obj) }, - { MP_ROM_QSTR(MP_QSTR_width), MP_ROM_PTR(&esp32_camera_camera_width_obj) }, - { MP_ROM_QSTR(MP_QSTR_wpc), MP_ROM_PTR(&esp32_camera_camera_wpc_obj) }, -}; - -STATIC MP_DEFINE_CONST_DICT(esp32_camera_camera_locals_dict, esp32_camera_camera_locals_table); - -const mp_obj_type_t esp32_camera_camera_type = { - .base = { &mp_type_type }, - .name = MP_QSTR_Camera, - .make_new = esp32_camera_camera_make_new, - .locals_dict = (mp_obj_t)&esp32_camera_camera_locals_dict, -}; diff --git a/ports/espressif/bindings/espcamera/Camera.c b/ports/espressif/bindings/espcamera/Camera.c new file mode 100644 index 0000000000..824bc7d3dc --- /dev/null +++ b/ports/espressif/bindings/espcamera/Camera.c @@ -0,0 +1,1001 @@ +/* + * This file is part of the MicroPython project, http://micropython.org/ + * + * The MIT License (MIT) + * + * Copyright (c) 2022 Jeff Epler for Adafruit Industries + * + * Permission is hereby granted, free of charge, to any person obtaining a copy + * of this software and associated documentation files (the "Software"), to deal + * in the Software without restriction, including without limitation the rights + * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell + * copies of the Software, and to permit persons to whom the Software is + * furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice shall be included in + * all copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE + * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER + * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, + * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN + * THE SOFTWARE. + */ + +#include + +#include "py/mphal.h" +#include "py/obj.h" +#include "py/objproperty.h" +#include "py/runtime.h" + +#include "bindings/espcamera/__init__.h" +#include "bindings/espcamera/Camera.h" +#include "common-hal/espcamera/Camera.h" + +#include "shared-bindings/displayio/Bitmap.h" +#include "shared-bindings/microcontroller/Pin.h" +#include "shared-bindings/util.h" +#include "esp_camera.h" +#include "sensor.h" + +//| class Camera: +//| def __init__( +//| self, +//| *, +//| data_pins: List[microcontroller.Pin], +//| pixel_clock_pin: microcontroller.Pin, +//| vsync_pin: microcontroller.Pin, +//| href_pin: microcontroller.Pin, +//| i2c: busio.I2C, +//| external_clock_pin: Optional[microcontroller.Pin] = None, +//| external_clock_frequency: int = 20_000_000, +//| powerdown_pin: Optional[microcontroller.Pin] = None, +//| reset_pin: Optional[microcontroller.Pin] = None, +//| pixel_format: PixelFormat = PixelFormat.RGB565, +//| frame_size: FrameSize = FrameSize.QQVGA, +//| jpeg_quality: int = 15, +//| framebuffer_count: int = 1, +//| grab_mode: GrabMode = GrabMode.WHEN_EMPTY, +//| ) -> None: +//| """ +//| Configure and initialize a camera with the given properties +//| +//| This driver requires that the ``CIRCUITPY_RESERVED_PSRAM`` in ``settings.toml`` be large enough to hold the camera frambuffer(s). Generally, boards with built-in cameras will have a default setting that is large enough. If the constructor raises a MemoryError or an IDFError, this probably indicates the setting is too small and should be increased. +//| +//| +//| .. important:: +//| +//| Not all supported sensors have all +//| of the properties listed below. For instance, the +//| OV5640 supports `denoise`, but the +//| OV2640 does not. The underlying esp32-camera +//| library does not provide a reliable API to check +//| which settings are supported. CircuitPython makes +//| a best effort to determine when an unsupported +//| property is set and will raise an exception in +//| that case. +//| +//| :param data_pins: The 8 data data_pins used for image data transfer from the camera module, least significant bit first +//| :param pixel_clock_pin: The pixel clock output from the camera module +//| :param vsync_pin: The vertical sync pulse output from the camera module +//| :param href_pin: The horizontal reference output from the camera module +//| :param i2c: The I2C bus connected to the camera module +//| :param external_clock_pin: The pin on which to generate the external clock +//| :param external_clock_frequency: The frequency generated on the external clock pin +//| :param powerdown_pin: The powerdown input to the camera module +//| :param reset_pin: The reset input to the camera module +//| :param pixel_format: The pixel format of the captured image +//| :param frame_size: The size of captured image +//| :param jpeg_quality: For `PixelFormat.JPEG`, the quality. Higher numbers increase quality. If the quality is too high, the JPEG data will be larger than the availalble buffer size and the image will be unusable or truncated. The exact range of appropriate values depends on the sensor and must be determined empirically. +//| :param framebuffer_count: The number of framebuffers (1 for single-buffered and 2 for double-buffered) +//| :param grab_mode: When to grab a new frame +//| """ +STATIC mp_obj_t espcamera_camera_make_new(const mp_obj_type_t *type, size_t n_args, size_t n_kw, const mp_obj_t *all_args) { + enum { ARG_data_pins, ARG_pixel_clock_pin, ARG_vsync_pin, ARG_href_pin, ARG_i2c, ARG_external_clock_pin, ARG_external_clock_frequency, ARG_powerdown_pin, ARG_reset_pin, ARG_pixel_format, ARG_frame_size, ARG_jpeg_quality, ARG_framebuffer_count, ARG_grab_mode, NUM_ARGS }; + static const mp_arg_t allowed_args[] = { + { MP_QSTR_data_pins, MP_ARG_OBJ | MP_ARG_KW_ONLY | MP_ARG_REQUIRED }, + { MP_QSTR_pixel_clock_pin, MP_ARG_OBJ | MP_ARG_KW_ONLY | MP_ARG_REQUIRED }, + { MP_QSTR_vsync_pin, MP_ARG_OBJ | MP_ARG_KW_ONLY | MP_ARG_REQUIRED }, + { MP_QSTR_href_pin, MP_ARG_OBJ | MP_ARG_KW_ONLY | MP_ARG_REQUIRED }, + { MP_QSTR_i2c, MP_ARG_OBJ | MP_ARG_KW_ONLY | MP_ARG_REQUIRED }, + { MP_QSTR_external_clock_pin, MP_ARG_OBJ | MP_ARG_KW_ONLY, { .u_obj = MP_ROM_NONE } }, + { MP_QSTR_external_clock_frequency, MP_ARG_INT | MP_ARG_KW_ONLY, { .u_int = 20000000L } }, + { MP_QSTR_powerdown_pin, MP_ARG_OBJ | MP_ARG_KW_ONLY, { .u_obj = MP_ROM_NONE } }, + { MP_QSTR_reset_pin, MP_ARG_OBJ | MP_ARG_KW_ONLY, { .u_obj = MP_ROM_NONE } }, + { MP_QSTR_pixel_format, MP_ARG_OBJ | MP_ARG_KW_ONLY, { .u_obj = MP_ROM_PTR((void *)&pixel_format_RGB565_obj) } }, + { MP_QSTR_frame_size, MP_ARG_OBJ | MP_ARG_KW_ONLY, { .u_obj = MP_ROM_PTR((void *)&frame_size_QQVGA_obj) } }, + { MP_QSTR_jpeg_quality, MP_ARG_INT | MP_ARG_KW_ONLY, { .u_int = 15 } }, + { MP_QSTR_framebuffer_count, MP_ARG_INT | MP_ARG_KW_ONLY, { .u_int = 1 } }, + { MP_QSTR_grab_mode, MP_ARG_OBJ | MP_ARG_KW_ONLY, { .u_obj = MP_ROM_PTR((void *)&grab_mode_WHEN_EMPTY_obj) } }, + }; + + mp_arg_val_t args[MP_ARRAY_SIZE(allowed_args)]; + MP_STATIC_ASSERT(MP_ARRAY_SIZE(allowed_args) == NUM_ARGS); + mp_arg_parse_all_kw_array(n_args, n_kw, all_args, MP_ARRAY_SIZE(allowed_args), allowed_args, args); + + uint8_t data_pins[8]; + uint8_t data_pin_count; + validate_pins(MP_QSTR_data_pins, data_pins, MP_ARRAY_SIZE(data_pins), args[ARG_data_pins].u_obj, &data_pin_count); + mp_arg_validate_length(data_pin_count, 8, MP_QSTR_data_pins); + + const mcu_pin_obj_t *pixel_clock_pin = + validate_obj_is_free_pin(args[ARG_pixel_clock_pin].u_obj, MP_QSTR_pixel_clock_pin); + const mcu_pin_obj_t *vsync_pin = + validate_obj_is_free_pin(args[ARG_vsync_pin].u_obj, MP_QSTR_vsync_pin); + const mcu_pin_obj_t *href_pin = + validate_obj_is_free_pin(args[ARG_href_pin].u_obj, MP_QSTR_href_pin); + busio_i2c_obj_t *i2c = MP_OBJ_TO_PTR(mp_arg_validate_type(args[ARG_i2c].u_obj, &busio_i2c_type, MP_QSTR_i2c)); + const mcu_pin_obj_t *external_clock_pin = + validate_obj_is_free_pin_or_none(args[ARG_external_clock_pin].u_obj, MP_QSTR_external_clock_pin); + const mcu_pin_obj_t *powerdown_pin = + validate_obj_is_free_pin_or_none(args[ARG_powerdown_pin].u_obj, MP_QSTR_powerdown_pin); + const mcu_pin_obj_t *reset_pin = + validate_obj_is_free_pin_or_none(args[ARG_reset_pin].u_obj, MP_QSTR_reset_pin); + const mp_int_t external_clock_frequency = + mp_arg_validate_int_range(args[ARG_external_clock_frequency].u_int, 0, 40000000, MP_QSTR_external_clock_frequency); + + camera_grab_mode_t grab_mode = validate_grab_mode(args[ARG_grab_mode].u_obj, MP_QSTR_grab_mode); + framesize_t frame_size = validate_frame_size(args[ARG_frame_size].u_obj, MP_QSTR_frame_size); + pixformat_t pixel_format = validate_pixel_format(args[ARG_pixel_format].u_obj, MP_QSTR_pixel_format); + mp_int_t jpeg_quality = mp_arg_validate_int_range(args[ARG_jpeg_quality].u_int, 2, 55, MP_QSTR_jpeg_quality); + mp_int_t framebuffer_count = mp_arg_validate_int_range(args[ARG_framebuffer_count].u_int, 1, 2, MP_QSTR_framebuffer_count); + + espcamera_camera_obj_t *self = m_new_obj(espcamera_camera_obj_t); + self->base.type = &espcamera_camera_type; + common_hal_espcamera_camera_construct( + self, + data_pins, + external_clock_pin, + pixel_clock_pin, + vsync_pin, + href_pin, + powerdown_pin, + reset_pin, + i2c, + external_clock_frequency, + pixel_format, + frame_size, + jpeg_quality, + framebuffer_count, + grab_mode); + return MP_OBJ_FROM_PTR(self); +} + +//| def deinit(self) -> None: +//| """Deinitialises the camera and releases all memory resources for reuse.""" +//| ... +STATIC mp_obj_t espcamera_camera_deinit(mp_obj_t self_in) { + espcamera_camera_obj_t *self = MP_OBJ_TO_PTR(self_in); + common_hal_espcamera_camera_deinit(self); + return mp_const_none; +} +STATIC MP_DEFINE_CONST_FUN_OBJ_1(espcamera_camera_deinit_obj, espcamera_camera_deinit); + +STATIC void check_for_deinit(espcamera_camera_obj_t *self) { + if (common_hal_espcamera_camera_deinited(self)) { + raise_deinited_error(); + } +} + +//| def __enter__(self) -> Camera: +//| """No-op used by Context Managers.""" +//| ... +// Provided by context manager helper. + +//| def __exit__(self) -> None: +//| """Automatically deinitializes the hardware when exiting a context. See +//| :ref:`lifetime-and-contextmanagers` for more info.""" +//| ... +STATIC mp_obj_t espcamera_camera_obj___exit__(size_t n_args, const mp_obj_t *args) { + (void)n_args; + return espcamera_camera_deinit(args[0]); +} +STATIC MP_DEFINE_CONST_FUN_OBJ_VAR_BETWEEN(espcamera_camera___exit___obj, 4, 4, espcamera_camera_obj___exit__); + +//| frame_available: bool +//| """True if a frame is available, False otherwise""" + +STATIC mp_obj_t espcamera_camera_frame_available_get(const mp_obj_t self_in) { + espcamera_camera_obj_t *self = MP_OBJ_TO_PTR(self_in); + check_for_deinit(self); + return mp_obj_new_bool(esp_camera_fb_available()); +} +STATIC MP_DEFINE_CONST_FUN_OBJ_1(espcamera_camera_frame_available_get_obj, espcamera_camera_frame_available_get); + +MP_PROPERTY_GETTER(espcamera_camera_frame_available_obj, + (mp_obj_t)&espcamera_camera_frame_available_get_obj); + +//| def take( +//| self, timeout: Optional[float] = 0.25 +//| ) -> Optional[displayio.Bitmap | ReadableBuffer]: +//| """Record a frame. Wait up to 'timeout' seconds for a frame to be captured. +//| +//| In the case of timeout, `None` is returned. +//| If `pixel_format` is `PixelFormat.JPEG`, the returned value is a read-only `memoryview`. +//| Otherwise, the returned value is a read-only `displayio.Bitmap`. +//| """ +STATIC mp_obj_t espcamera_camera_take(size_t n_args, const mp_obj_t *args) { + espcamera_camera_obj_t *self = MP_OBJ_TO_PTR(args[0]); + mp_float_t timeout = n_args < 2 ? MICROPY_FLOAT_CONST(0.25) : mp_obj_get_float(args[1]); + check_for_deinit(self); + camera_fb_t *result = common_hal_espcamera_camera_take(self, (int)MICROPY_FLOAT_C_FUN(round)(timeout * 1000)); + if (!result) { + return mp_const_none; + } + pixformat_t format = common_hal_espcamera_camera_get_pixel_format(self); + if (format == PIXFORMAT_JPEG) { + return mp_obj_new_memoryview('b', result->len, result->buf); + } else { + int width = common_hal_espcamera_camera_get_width(self); + int height = common_hal_espcamera_camera_get_height(self); + displayio_bitmap_t *bitmap = m_new_obj(displayio_bitmap_t); + bitmap->base.type = &displayio_bitmap_type; + common_hal_displayio_bitmap_construct_from_buffer(bitmap, width, height, (format == PIXFORMAT_RGB565) ? 16 : 8, (uint32_t *)(void *)result->buf, true); + return bitmap; + } +} +STATIC MP_DEFINE_CONST_FUN_OBJ_VAR_BETWEEN(espcamera_camera_take_obj, 1, 2, espcamera_camera_take); + + +//| def reconfigure( +//| self, +//| frame_size: Optional[FrameSize] = None, +//| pixel_format: Optional[PixelFormat] = None, +//| grab_mode: Optional[GrabMode] = None, +//| framebuffer_count: Optional[int] = None, +//| ) -> None: +//| """Change multiple related camera settings simultaneously +//| +//| Because these settings interact in complex ways, and take longer than +//| the other properties to set, they are set together in a single function call. +//| +//| If an argument is unspecified or None, then the setting is unchanged.""" + +STATIC mp_obj_t espcamera_camera_reconfigure(mp_uint_t n_args, const mp_obj_t *pos_args, mp_map_t *kw_args) { + espcamera_camera_obj_t *self = MP_OBJ_TO_PTR(pos_args[0]); + check_for_deinit(self); + + enum { ARG_frame_size, ARG_pixel_format, ARG_grab_mode, ARG_framebuffer_count }; + static const mp_arg_t allowed_args[] = { + { MP_QSTR_frame_size, MP_ARG_OBJ, {.u_obj = MP_ROM_NONE} }, + { MP_QSTR_pixel_format, MP_ARG_OBJ, {.u_obj = MP_ROM_NONE} }, + { MP_QSTR_grab_mode, MP_ARG_OBJ, {.u_obj = MP_ROM_NONE} }, + { MP_QSTR_framebuffer_count, MP_ARG_OBJ, {.u_obj = MP_ROM_NONE} }, + }; + + mp_arg_val_t args[MP_ARRAY_SIZE(allowed_args)]; + mp_arg_parse_all(n_args - 1, pos_args + 1, kw_args, MP_ARRAY_SIZE(allowed_args), allowed_args, args); + + framesize_t frame_size = + args[ARG_frame_size].u_obj != MP_ROM_NONE + ? validate_frame_size(args[ARG_frame_size].u_obj, MP_QSTR_frame_size) + : common_hal_espcamera_camera_get_frame_size(self); + pixformat_t pixel_format = + args[ARG_pixel_format].u_obj != MP_ROM_NONE + ? validate_pixel_format(args[ARG_pixel_format].u_obj, MP_QSTR_pixel_format) + : common_hal_espcamera_camera_get_pixel_format(self); + camera_grab_mode_t grab_mode = + args[ARG_grab_mode].u_obj != MP_ROM_NONE + ? validate_grab_mode(args[ARG_grab_mode].u_obj, MP_QSTR_grab_mode) + : common_hal_espcamera_camera_get_grab_mode(self); + bool framebuffer_count = + args[ARG_framebuffer_count].u_obj != MP_ROM_NONE + ? mp_obj_get_int(args[ARG_framebuffer_count].u_obj) + : common_hal_espcamera_camera_get_framebuffer_count(self); + + common_hal_espcamera_camera_reconfigure(self, frame_size, pixel_format, grab_mode, framebuffer_count); + + return mp_const_none; +} +MP_DEFINE_CONST_FUN_OBJ_KW(espcamera_camera_reconfigure_obj, 1, espcamera_camera_reconfigure); + +//| pixel_format: PixelFormat +//| """The pixel format of captured frames""" + +STATIC mp_obj_t espcamera_camera_get_pixel_format(const mp_obj_t self_in) { + espcamera_camera_obj_t *self = MP_OBJ_TO_PTR(self_in); + check_for_deinit(self); + return cp_enum_find(&espcamera_pixel_format_type, common_hal_espcamera_camera_get_pixel_format(self)); +} +STATIC MP_DEFINE_CONST_FUN_OBJ_1(espcamera_camera_get_pixel_format_obj, espcamera_camera_get_pixel_format); + +MP_PROPERTY_GETTER(espcamera_camera_pixel_format_obj, + (mp_obj_t)&espcamera_camera_get_pixel_format_obj); + + +//| frame_size: FrameSize +//| """The size of captured frames""" + +STATIC mp_obj_t espcamera_camera_get_frame_size(const mp_obj_t self_in) { + espcamera_camera_obj_t *self = MP_OBJ_TO_PTR(self_in); + check_for_deinit(self); + return cp_enum_find(&espcamera_frame_size_type, common_hal_espcamera_camera_get_frame_size(self)); +} +STATIC MP_DEFINE_CONST_FUN_OBJ_1(espcamera_camera_get_frame_size_obj, espcamera_camera_get_frame_size); + +MP_PROPERTY_GETTER(espcamera_camera_frame_size_obj, + (mp_obj_t)&espcamera_camera_get_frame_size_obj); + +//| contrast: int +//| """The sensor contrast. Positive values increase contrast, negative values lower it. The total range is device-specific but is often from -2 to +2 inclusive.""" + +STATIC mp_obj_t espcamera_camera_get_contrast(const mp_obj_t self_in) { + espcamera_camera_obj_t *self = MP_OBJ_TO_PTR(self_in); + check_for_deinit(self); + return MP_OBJ_NEW_SMALL_INT(common_hal_espcamera_camera_get_contrast(self)); +} +STATIC MP_DEFINE_CONST_FUN_OBJ_1(espcamera_camera_get_contrast_obj, espcamera_camera_get_contrast); + +STATIC mp_obj_t espcamera_camera_set_contrast(const mp_obj_t self_in, const mp_obj_t arg) { + espcamera_camera_obj_t *self = MP_OBJ_TO_PTR(self_in); + check_for_deinit(self); + common_hal_espcamera_camera_set_contrast(self, mp_obj_get_int(arg)); + return mp_const_none; +} +STATIC MP_DEFINE_CONST_FUN_OBJ_2(espcamera_camera_set_contrast_obj, espcamera_camera_set_contrast); +MP_PROPERTY_GETSET(espcamera_camera_contrast_obj, + (mp_obj_t)&espcamera_camera_get_contrast_obj, + (mp_obj_t)&espcamera_camera_set_contrast_obj); + +//| brightness: int +//| """The sensor brightness. Positive values increase brightness, negative values lower it. The total range is device-specific but is often from -2 to +2 inclusive.""" + +STATIC mp_obj_t espcamera_camera_get_brightness(const mp_obj_t self_in) { + espcamera_camera_obj_t *self = MP_OBJ_TO_PTR(self_in); + check_for_deinit(self); + return MP_OBJ_NEW_SMALL_INT(common_hal_espcamera_camera_get_brightness(self)); +} +STATIC MP_DEFINE_CONST_FUN_OBJ_1(espcamera_camera_get_brightness_obj, espcamera_camera_get_brightness); + +STATIC mp_obj_t espcamera_camera_set_brightness(const mp_obj_t self_in, const mp_obj_t arg) { + espcamera_camera_obj_t *self = MP_OBJ_TO_PTR(self_in); + check_for_deinit(self); + common_hal_espcamera_camera_set_brightness(self, mp_obj_get_int(arg)); + return mp_const_none; +} +STATIC MP_DEFINE_CONST_FUN_OBJ_2(espcamera_camera_set_brightness_obj, espcamera_camera_set_brightness); +MP_PROPERTY_GETSET(espcamera_camera_brightness_obj, + (mp_obj_t)&espcamera_camera_get_brightness_obj, + (mp_obj_t)&espcamera_camera_set_brightness_obj); + +//| saturation: int +//| """The sensor saturation. Positive values increase saturation (more vibrant colors), negative values lower it (more muted colors). The total range is device-specific but the value is often from -2 to +2 inclusive.""" + +STATIC mp_obj_t espcamera_camera_get_saturation(const mp_obj_t self_in) { + espcamera_camera_obj_t *self = MP_OBJ_TO_PTR(self_in); + check_for_deinit(self); + return MP_OBJ_NEW_SMALL_INT(common_hal_espcamera_camera_get_saturation(self)); +} +STATIC MP_DEFINE_CONST_FUN_OBJ_1(espcamera_camera_get_saturation_obj, espcamera_camera_get_saturation); + +STATIC mp_obj_t espcamera_camera_set_saturation(const mp_obj_t self_in, const mp_obj_t arg) { + espcamera_camera_obj_t *self = MP_OBJ_TO_PTR(self_in); + check_for_deinit(self); + common_hal_espcamera_camera_set_saturation(self, mp_obj_get_int(arg)); + return mp_const_none; +} +STATIC MP_DEFINE_CONST_FUN_OBJ_2(espcamera_camera_set_saturation_obj, espcamera_camera_set_saturation); +MP_PROPERTY_GETSET(espcamera_camera_saturation_obj, + (mp_obj_t)&espcamera_camera_get_saturation_obj, + (mp_obj_t)&espcamera_camera_set_saturation_obj); + +//| sharpness: int +//| """The sensor sharpness. Positive values increase sharpness (more defined edges), negative values lower it (softer edges). The total range is device-specific but the value is often from -2 to +2 inclusive.""" + +STATIC mp_obj_t espcamera_camera_get_sharpness(const mp_obj_t self_in) { + espcamera_camera_obj_t *self = MP_OBJ_TO_PTR(self_in); + check_for_deinit(self); + return MP_OBJ_NEW_SMALL_INT(common_hal_espcamera_camera_get_sharpness(self)); +} +STATIC MP_DEFINE_CONST_FUN_OBJ_1(espcamera_camera_get_sharpness_obj, espcamera_camera_get_sharpness); + +STATIC mp_obj_t espcamera_camera_set_sharpness(const mp_obj_t self_in, const mp_obj_t arg) { + espcamera_camera_obj_t *self = MP_OBJ_TO_PTR(self_in); + check_for_deinit(self); + common_hal_espcamera_camera_set_sharpness(self, mp_obj_get_int(arg)); + return mp_const_none; +} +STATIC MP_DEFINE_CONST_FUN_OBJ_2(espcamera_camera_set_sharpness_obj, espcamera_camera_set_sharpness); +MP_PROPERTY_GETSET(espcamera_camera_sharpness_obj, + (mp_obj_t)&espcamera_camera_get_sharpness_obj, + (mp_obj_t)&espcamera_camera_set_sharpness_obj); + +//| denoise: int +//| """The sensor 'denoise' setting. Any camera sensor has inherent 'noise', especially in low brightness environments. Software algorithms can decrease noise at the expense of fine detail. A larger value increases the amount of software noise removal. The total range is device-specific but the value is often from 0 to 10.""" + +STATIC mp_obj_t espcamera_camera_get_denoise(const mp_obj_t self_in) { + espcamera_camera_obj_t *self = MP_OBJ_TO_PTR(self_in); + check_for_deinit(self); + return MP_OBJ_NEW_SMALL_INT(common_hal_espcamera_camera_get_denoise(self)); +} +STATIC MP_DEFINE_CONST_FUN_OBJ_1(espcamera_camera_get_denoise_obj, espcamera_camera_get_denoise); + +STATIC mp_obj_t espcamera_camera_set_denoise(const mp_obj_t self_in, const mp_obj_t arg) { + espcamera_camera_obj_t *self = MP_OBJ_TO_PTR(self_in); + check_for_deinit(self); + common_hal_espcamera_camera_set_denoise(self, mp_obj_get_int(arg)); + return mp_const_none; +} +STATIC MP_DEFINE_CONST_FUN_OBJ_2(espcamera_camera_set_denoise_obj, espcamera_camera_set_denoise); +MP_PROPERTY_GETSET(espcamera_camera_denoise_obj, + (mp_obj_t)&espcamera_camera_get_denoise_obj, + (mp_obj_t)&espcamera_camera_set_denoise_obj); + +//| gain_ceiling: GainCeiling +//| """The sensor 'gain ceiling' setting. "Gain" is an analog multiplier applied to the raw sensor data. The 'ceiling' is the maximum gain value that the sensor will use. A higher gain means that the sensor has a greater response to light, but also makes sensor noise more visible.""" + +STATIC mp_obj_t espcamera_camera_get_gain_ceiling(const mp_obj_t self_in) { + espcamera_camera_obj_t *self = MP_OBJ_TO_PTR(self_in); + check_for_deinit(self); + return cp_enum_find(&espcamera_gain_ceiling_type, common_hal_espcamera_camera_get_gainceiling(self)); +} +STATIC MP_DEFINE_CONST_FUN_OBJ_1(espcamera_camera_get_gain_ceiling_obj, espcamera_camera_get_gain_ceiling); + +STATIC mp_obj_t espcamera_camera_set_gain_ceiling(const mp_obj_t self_in, const mp_obj_t arg) { + espcamera_camera_obj_t *self = MP_OBJ_TO_PTR(self_in); + check_for_deinit(self); + common_hal_espcamera_camera_set_gainceiling(self, validate_gain_ceiling(arg, MP_QSTR_gain_ceiling)); + return mp_const_none; +} +STATIC MP_DEFINE_CONST_FUN_OBJ_2(espcamera_camera_set_gain_ceiling_obj, espcamera_camera_set_gain_ceiling); +MP_PROPERTY_GETSET(espcamera_camera_gain_ceiling_obj, + (mp_obj_t)&espcamera_camera_get_gain_ceiling_obj, + (mp_obj_t)&espcamera_camera_set_gain_ceiling_obj); + +//| quality: int +//| """The 'quality' setting when capturing JPEG images. This is similar to the quality setting when exporting a jpeg image from photo editing software. Typical values range from 5 to 40, with higher numbers leading to larger image sizes and better overall image quality. However, when the quality is set to a high number, the total size of the JPEG data can exceed the size of an internal buffer, causing image capture to fail.""" + +STATIC mp_obj_t espcamera_camera_get_quality(const mp_obj_t self_in) { + espcamera_camera_obj_t *self = MP_OBJ_TO_PTR(self_in); + check_for_deinit(self); + return MP_OBJ_NEW_SMALL_INT(common_hal_espcamera_camera_get_quality(self)); +} +STATIC MP_DEFINE_CONST_FUN_OBJ_1(espcamera_camera_get_quality_obj, espcamera_camera_get_quality); + +STATIC mp_obj_t espcamera_camera_set_quality(const mp_obj_t self_in, const mp_obj_t arg) { + espcamera_camera_obj_t *self = MP_OBJ_TO_PTR(self_in); + check_for_deinit(self); + common_hal_espcamera_camera_set_quality(self, mp_obj_get_int(arg)); + return mp_const_none; +} +STATIC MP_DEFINE_CONST_FUN_OBJ_2(espcamera_camera_set_quality_obj, espcamera_camera_set_quality); +MP_PROPERTY_GETSET(espcamera_camera_quality_obj, + (mp_obj_t)&espcamera_camera_get_quality_obj, + (mp_obj_t)&espcamera_camera_set_quality_obj); + +//| colorbar: bool +//| """When `True`, a test pattern image is captured and the real sensor data is not used.""" + +STATIC mp_obj_t espcamera_camera_get_colorbar(const mp_obj_t self_in) { + espcamera_camera_obj_t *self = MP_OBJ_TO_PTR(self_in); + check_for_deinit(self); + return mp_obj_new_bool(common_hal_espcamera_camera_get_colorbar(self)); +} +STATIC MP_DEFINE_CONST_FUN_OBJ_1(espcamera_camera_get_colorbar_obj, espcamera_camera_get_colorbar); + +STATIC mp_obj_t espcamera_camera_set_colorbar(const mp_obj_t self_in, const mp_obj_t arg) { + espcamera_camera_obj_t *self = MP_OBJ_TO_PTR(self_in); + check_for_deinit(self); + common_hal_espcamera_camera_set_colorbar(self, mp_obj_is_true(arg)); + return mp_const_none; +} +STATIC MP_DEFINE_CONST_FUN_OBJ_2(espcamera_camera_set_colorbar_obj, espcamera_camera_set_colorbar); +MP_PROPERTY_GETSET(espcamera_camera_colorbar_obj, + (mp_obj_t)&espcamera_camera_get_colorbar_obj, + (mp_obj_t)&espcamera_camera_set_colorbar_obj); + +//| whitebal: bool +//| """When `True`, the camera attempts to automatically control white balance. When `False`, the `wb_mode` setting is used instead.""" + +STATIC mp_obj_t espcamera_camera_get_whitebal(const mp_obj_t self_in) { + espcamera_camera_obj_t *self = MP_OBJ_TO_PTR(self_in); + check_for_deinit(self); + return mp_obj_new_bool(common_hal_espcamera_camera_get_whitebal(self)); +} +STATIC MP_DEFINE_CONST_FUN_OBJ_1(espcamera_camera_get_whitebal_obj, espcamera_camera_get_whitebal); + +STATIC mp_obj_t espcamera_camera_set_whitebal(const mp_obj_t self_in, const mp_obj_t arg) { + espcamera_camera_obj_t *self = MP_OBJ_TO_PTR(self_in); + check_for_deinit(self); + common_hal_espcamera_camera_set_whitebal(self, mp_obj_is_true(arg)); + return mp_const_none; +} +STATIC MP_DEFINE_CONST_FUN_OBJ_2(espcamera_camera_set_whitebal_obj, espcamera_camera_set_whitebal); +MP_PROPERTY_GETSET(espcamera_camera_whitebal_obj, + (mp_obj_t)&espcamera_camera_get_whitebal_obj, + (mp_obj_t)&espcamera_camera_set_whitebal_obj); + +//| gain_ctrl: bool +//| """When `True`, the camera attempts to automatically control the sensor gain, up to the value in the `gain_ceiling` property. When `False`, the `agc_gain` setting is used instead.""" + +STATIC mp_obj_t espcamera_camera_get_gain_ctrl(const mp_obj_t self_in) { + espcamera_camera_obj_t *self = MP_OBJ_TO_PTR(self_in); + check_for_deinit(self); + return mp_obj_new_bool(common_hal_espcamera_camera_get_gain_ctrl(self)); +} +STATIC MP_DEFINE_CONST_FUN_OBJ_1(espcamera_camera_get_gain_ctrl_obj, espcamera_camera_get_gain_ctrl); + +STATIC mp_obj_t espcamera_camera_set_gain_ctrl(const mp_obj_t self_in, const mp_obj_t arg) { + espcamera_camera_obj_t *self = MP_OBJ_TO_PTR(self_in); + check_for_deinit(self); + common_hal_espcamera_camera_set_gain_ctrl(self, mp_obj_is_true(arg)); + return mp_const_none; +} +STATIC MP_DEFINE_CONST_FUN_OBJ_2(espcamera_camera_set_gain_ctrl_obj, espcamera_camera_set_gain_ctrl); +MP_PROPERTY_GETSET(espcamera_camera_gain_ctrl_obj, + (mp_obj_t)&espcamera_camera_get_gain_ctrl_obj, + (mp_obj_t)&espcamera_camera_set_gain_ctrl_obj); + +//| exposure_ctrl: bool +//| """When `True` the camera attempts to automatically control the exposure. When `False`, the `aec_value` setting is used instead.""" + +STATIC mp_obj_t espcamera_camera_get_exposure_ctrl(const mp_obj_t self_in) { + espcamera_camera_obj_t *self = MP_OBJ_TO_PTR(self_in); + check_for_deinit(self); + return mp_obj_new_bool(common_hal_espcamera_camera_get_exposure_ctrl(self)); +} +STATIC MP_DEFINE_CONST_FUN_OBJ_1(espcamera_camera_get_exposure_ctrl_obj, espcamera_camera_get_exposure_ctrl); + +STATIC mp_obj_t espcamera_camera_set_exposure_ctrl(const mp_obj_t self_in, const mp_obj_t arg) { + espcamera_camera_obj_t *self = MP_OBJ_TO_PTR(self_in); + check_for_deinit(self); + common_hal_espcamera_camera_set_exposure_ctrl(self, mp_obj_is_true(arg)); + return mp_const_none; +} +STATIC MP_DEFINE_CONST_FUN_OBJ_2(espcamera_camera_set_exposure_ctrl_obj, espcamera_camera_set_exposure_ctrl); +MP_PROPERTY_GETSET(espcamera_camera_exposure_ctrl_obj, + (mp_obj_t)&espcamera_camera_get_exposure_ctrl_obj, + (mp_obj_t)&espcamera_camera_set_exposure_ctrl_obj); + +//| hmirror: bool +//| """When `True` the camera image is mirrored left-to-right""" + +STATIC mp_obj_t espcamera_camera_get_hmirror(const mp_obj_t self_in) { + espcamera_camera_obj_t *self = MP_OBJ_TO_PTR(self_in); + check_for_deinit(self); + return mp_obj_new_bool(common_hal_espcamera_camera_get_hmirror(self)); +} +STATIC MP_DEFINE_CONST_FUN_OBJ_1(espcamera_camera_get_hmirror_obj, espcamera_camera_get_hmirror); + +STATIC mp_obj_t espcamera_camera_set_hmirror(const mp_obj_t self_in, const mp_obj_t arg) { + espcamera_camera_obj_t *self = MP_OBJ_TO_PTR(self_in); + check_for_deinit(self); + common_hal_espcamera_camera_set_hmirror(self, mp_obj_is_true(arg)); + return mp_const_none; +} +STATIC MP_DEFINE_CONST_FUN_OBJ_2(espcamera_camera_set_hmirror_obj, espcamera_camera_set_hmirror); +MP_PROPERTY_GETSET(espcamera_camera_hmirror_obj, + (mp_obj_t)&espcamera_camera_get_hmirror_obj, + (mp_obj_t)&espcamera_camera_set_hmirror_obj); + +//| vflip: bool +//| """When `True` the camera image is flipped top-to-bottom""" + +STATIC mp_obj_t espcamera_camera_get_vflip(const mp_obj_t self_in) { + espcamera_camera_obj_t *self = MP_OBJ_TO_PTR(self_in); + check_for_deinit(self); + return mp_obj_new_bool(common_hal_espcamera_camera_get_vflip(self)); +} +STATIC MP_DEFINE_CONST_FUN_OBJ_1(espcamera_camera_get_vflip_obj, espcamera_camera_get_vflip); + +STATIC mp_obj_t espcamera_camera_set_vflip(const mp_obj_t self_in, const mp_obj_t arg) { + espcamera_camera_obj_t *self = MP_OBJ_TO_PTR(self_in); + check_for_deinit(self); + common_hal_espcamera_camera_set_vflip(self, mp_obj_is_true(arg)); + return mp_const_none; +} +STATIC MP_DEFINE_CONST_FUN_OBJ_2(espcamera_camera_set_vflip_obj, espcamera_camera_set_vflip); +MP_PROPERTY_GETSET(espcamera_camera_vflip_obj, + (mp_obj_t)&espcamera_camera_get_vflip_obj, + (mp_obj_t)&espcamera_camera_set_vflip_obj); + +//| aec2: bool +//| """When `True` the sensor's "night mode" is enabled, extending the range of automatic gain control.""" + +STATIC mp_obj_t espcamera_camera_get_aec2(const mp_obj_t self_in) { + espcamera_camera_obj_t *self = MP_OBJ_TO_PTR(self_in); + check_for_deinit(self); + return mp_obj_new_bool(common_hal_espcamera_camera_get_aec2(self)); +} +STATIC MP_DEFINE_CONST_FUN_OBJ_1(espcamera_camera_get_aec2_obj, espcamera_camera_get_aec2); + +STATIC mp_obj_t espcamera_camera_set_aec2(const mp_obj_t self_in, const mp_obj_t arg) { + espcamera_camera_obj_t *self = MP_OBJ_TO_PTR(self_in); + check_for_deinit(self); + common_hal_espcamera_camera_set_aec2(self, mp_obj_is_true(arg)); + return mp_const_none; +} +STATIC MP_DEFINE_CONST_FUN_OBJ_2(espcamera_camera_set_aec2_obj, espcamera_camera_set_aec2); +MP_PROPERTY_GETSET(espcamera_camera_aec2_obj, + (mp_obj_t)&espcamera_camera_get_aec2_obj, + (mp_obj_t)&espcamera_camera_set_aec2_obj); + +//| awb_gain: bool +//| """Access the awb_gain property of the camera sensor""" + +STATIC mp_obj_t espcamera_camera_get_awb_gain(const mp_obj_t self_in) { + espcamera_camera_obj_t *self = MP_OBJ_TO_PTR(self_in); + check_for_deinit(self); + return mp_obj_new_bool(common_hal_espcamera_camera_get_awb_gain(self)); +} +STATIC MP_DEFINE_CONST_FUN_OBJ_1(espcamera_camera_get_awb_gain_obj, espcamera_camera_get_awb_gain); + +STATIC mp_obj_t espcamera_camera_set_awb_gain(const mp_obj_t self_in, const mp_obj_t arg) { + espcamera_camera_obj_t *self = MP_OBJ_TO_PTR(self_in); + check_for_deinit(self); + common_hal_espcamera_camera_set_awb_gain(self, mp_obj_is_true(arg)); + return mp_const_none; +} +STATIC MP_DEFINE_CONST_FUN_OBJ_2(espcamera_camera_set_awb_gain_obj, espcamera_camera_set_awb_gain); +MP_PROPERTY_GETSET(espcamera_camera_awb_gain_obj, + (mp_obj_t)&espcamera_camera_get_awb_gain_obj, + (mp_obj_t)&espcamera_camera_set_awb_gain_obj); + +//| agc_gain: int +//| """Access the gain level of the sensor. Higher values produce brighter images. Typical settings range from 0 to 30. """ + +STATIC mp_obj_t espcamera_camera_get_agc_gain(const mp_obj_t self_in) { + espcamera_camera_obj_t *self = MP_OBJ_TO_PTR(self_in); + check_for_deinit(self); + return MP_OBJ_NEW_SMALL_INT(common_hal_espcamera_camera_get_agc_gain(self)); +} +STATIC MP_DEFINE_CONST_FUN_OBJ_1(espcamera_camera_get_agc_gain_obj, espcamera_camera_get_agc_gain); + +STATIC mp_obj_t espcamera_camera_set_agc_gain(const mp_obj_t self_in, const mp_obj_t arg) { + espcamera_camera_obj_t *self = MP_OBJ_TO_PTR(self_in); + check_for_deinit(self); + common_hal_espcamera_camera_set_agc_gain(self, mp_obj_get_int(arg)); + return mp_const_none; +} +STATIC MP_DEFINE_CONST_FUN_OBJ_2(espcamera_camera_set_agc_gain_obj, espcamera_camera_set_agc_gain); +MP_PROPERTY_GETSET(espcamera_camera_agc_gain_obj, + (mp_obj_t)&espcamera_camera_get_agc_gain_obj, + (mp_obj_t)&espcamera_camera_set_agc_gain_obj); + +//| aec_value: int +//| """Access the exposure value of the camera. Higher values produce brighter images. Typical settings range from 0 to 1200.""" + +STATIC mp_obj_t espcamera_camera_get_aec_value(const mp_obj_t self_in) { + espcamera_camera_obj_t *self = MP_OBJ_TO_PTR(self_in); + check_for_deinit(self); + return MP_OBJ_NEW_SMALL_INT(common_hal_espcamera_camera_get_aec_value(self)); +} +STATIC MP_DEFINE_CONST_FUN_OBJ_1(espcamera_camera_get_aec_value_obj, espcamera_camera_get_aec_value); + +STATIC mp_obj_t espcamera_camera_set_aec_value(const mp_obj_t self_in, const mp_obj_t arg) { + espcamera_camera_obj_t *self = MP_OBJ_TO_PTR(self_in); + check_for_deinit(self); + common_hal_espcamera_camera_set_aec_value(self, mp_obj_get_int(arg)); + return mp_const_none; +} +STATIC MP_DEFINE_CONST_FUN_OBJ_2(espcamera_camera_set_aec_value_obj, espcamera_camera_set_aec_value); +MP_PROPERTY_GETSET(espcamera_camera_aec_value_obj, + (mp_obj_t)&espcamera_camera_get_aec_value_obj, + (mp_obj_t)&espcamera_camera_set_aec_value_obj); + +//| special_effect: int +//| """Enable a "special effect". Zero is no special effect. On OV5640, special effects range from 0 to 6 inclusive and select various color modes.""" + +STATIC mp_obj_t espcamera_camera_get_special_effect(const mp_obj_t self_in) { + espcamera_camera_obj_t *self = MP_OBJ_TO_PTR(self_in); + check_for_deinit(self); + return MP_OBJ_NEW_SMALL_INT(common_hal_espcamera_camera_get_special_effect(self)); +} +STATIC MP_DEFINE_CONST_FUN_OBJ_1(espcamera_camera_get_special_effect_obj, espcamera_camera_get_special_effect); + +STATIC mp_obj_t espcamera_camera_set_special_effect(const mp_obj_t self_in, const mp_obj_t arg) { + espcamera_camera_obj_t *self = MP_OBJ_TO_PTR(self_in); + check_for_deinit(self); + common_hal_espcamera_camera_set_special_effect(self, mp_obj_get_int(arg)); + return mp_const_none; +} +STATIC MP_DEFINE_CONST_FUN_OBJ_2(espcamera_camera_set_special_effect_obj, espcamera_camera_set_special_effect); +MP_PROPERTY_GETSET(espcamera_camera_special_effect_obj, + (mp_obj_t)&espcamera_camera_get_special_effect_obj, + (mp_obj_t)&espcamera_camera_set_special_effect_obj); + +//| wb_mode: int +//| """The white balance mode. 0 is automatic white balance. Typical values range from 0 to 4 inclusive.""" + +STATIC mp_obj_t espcamera_camera_get_wb_mode(const mp_obj_t self_in) { + espcamera_camera_obj_t *self = MP_OBJ_TO_PTR(self_in); + check_for_deinit(self); + return MP_OBJ_NEW_SMALL_INT(common_hal_espcamera_camera_get_wb_mode(self)); +} +STATIC MP_DEFINE_CONST_FUN_OBJ_1(espcamera_camera_get_wb_mode_obj, espcamera_camera_get_wb_mode); + +STATIC mp_obj_t espcamera_camera_set_wb_mode(const mp_obj_t self_in, const mp_obj_t arg) { + espcamera_camera_obj_t *self = MP_OBJ_TO_PTR(self_in); + check_for_deinit(self); + common_hal_espcamera_camera_set_wb_mode(self, mp_obj_get_int(arg)); + return mp_const_none; +} +STATIC MP_DEFINE_CONST_FUN_OBJ_2(espcamera_camera_set_wb_mode_obj, espcamera_camera_set_wb_mode); +MP_PROPERTY_GETSET(espcamera_camera_wb_mode_obj, + (mp_obj_t)&espcamera_camera_get_wb_mode_obj, + (mp_obj_t)&espcamera_camera_set_wb_mode_obj); + +//| ae_level: int +//| """The exposure offset for automatic exposure. Typical values range from -2 to +2.""" + +STATIC mp_obj_t espcamera_camera_get_ae_level(const mp_obj_t self_in) { + espcamera_camera_obj_t *self = MP_OBJ_TO_PTR(self_in); + check_for_deinit(self); + return MP_OBJ_NEW_SMALL_INT(common_hal_espcamera_camera_get_ae_level(self)); +} +STATIC MP_DEFINE_CONST_FUN_OBJ_1(espcamera_camera_get_ae_level_obj, espcamera_camera_get_ae_level); + +STATIC mp_obj_t espcamera_camera_set_ae_level(const mp_obj_t self_in, const mp_obj_t arg) { + espcamera_camera_obj_t *self = MP_OBJ_TO_PTR(self_in); + check_for_deinit(self); + common_hal_espcamera_camera_set_ae_level(self, mp_obj_get_int(arg)); + return mp_const_none; +} +STATIC MP_DEFINE_CONST_FUN_OBJ_2(espcamera_camera_set_ae_level_obj, espcamera_camera_set_ae_level); +MP_PROPERTY_GETSET(espcamera_camera_ae_level_obj, + (mp_obj_t)&espcamera_camera_get_ae_level_obj, + (mp_obj_t)&espcamera_camera_set_ae_level_obj); + +//| dcw: bool +//| """When `True` an advanced white balance mode is selected.""" + +STATIC mp_obj_t espcamera_camera_get_dcw(const mp_obj_t self_in) { + espcamera_camera_obj_t *self = MP_OBJ_TO_PTR(self_in); + check_for_deinit(self); + return mp_obj_new_bool(common_hal_espcamera_camera_get_dcw(self)); +} +STATIC MP_DEFINE_CONST_FUN_OBJ_1(espcamera_camera_get_dcw_obj, espcamera_camera_get_dcw); + +STATIC mp_obj_t espcamera_camera_set_dcw(const mp_obj_t self_in, const mp_obj_t arg) { + espcamera_camera_obj_t *self = MP_OBJ_TO_PTR(self_in); + check_for_deinit(self); + common_hal_espcamera_camera_set_dcw(self, mp_obj_is_true(arg)); + return mp_const_none; +} +STATIC MP_DEFINE_CONST_FUN_OBJ_2(espcamera_camera_set_dcw_obj, espcamera_camera_set_dcw); +MP_PROPERTY_GETSET(espcamera_camera_dcw_obj, + (mp_obj_t)&espcamera_camera_get_dcw_obj, + (mp_obj_t)&espcamera_camera_set_dcw_obj); + +//| bpc: bool +//| """When `True`, "black point compensation" is enabled. This can make black parts of the image darker.""" + +STATIC mp_obj_t espcamera_camera_get_bpc(const mp_obj_t self_in) { + espcamera_camera_obj_t *self = MP_OBJ_TO_PTR(self_in); + check_for_deinit(self); + return mp_obj_new_bool(common_hal_espcamera_camera_get_bpc(self)); +} +STATIC MP_DEFINE_CONST_FUN_OBJ_1(espcamera_camera_get_bpc_obj, espcamera_camera_get_bpc); + +STATIC mp_obj_t espcamera_camera_set_bpc(const mp_obj_t self_in, const mp_obj_t arg) { + espcamera_camera_obj_t *self = MP_OBJ_TO_PTR(self_in); + check_for_deinit(self); + common_hal_espcamera_camera_set_bpc(self, mp_obj_is_true(arg)); + return mp_const_none; +} +STATIC MP_DEFINE_CONST_FUN_OBJ_2(espcamera_camera_set_bpc_obj, espcamera_camera_set_bpc); +MP_PROPERTY_GETSET(espcamera_camera_bpc_obj, + (mp_obj_t)&espcamera_camera_get_bpc_obj, + (mp_obj_t)&espcamera_camera_set_bpc_obj); + +//| wpc: bool +//| """When `True`, "white point compensation" is enabled. This can make white parts of the image whiter.""" + +STATIC mp_obj_t espcamera_camera_get_wpc(const mp_obj_t self_in) { + espcamera_camera_obj_t *self = MP_OBJ_TO_PTR(self_in); + check_for_deinit(self); + return mp_obj_new_bool(common_hal_espcamera_camera_get_wpc(self)); +} +STATIC MP_DEFINE_CONST_FUN_OBJ_1(espcamera_camera_get_wpc_obj, espcamera_camera_get_wpc); + +STATIC mp_obj_t espcamera_camera_set_wpc(const mp_obj_t self_in, const mp_obj_t arg) { + espcamera_camera_obj_t *self = MP_OBJ_TO_PTR(self_in); + check_for_deinit(self); + common_hal_espcamera_camera_set_wpc(self, mp_obj_is_true(arg)); + return mp_const_none; +} +STATIC MP_DEFINE_CONST_FUN_OBJ_2(espcamera_camera_set_wpc_obj, espcamera_camera_set_wpc); +MP_PROPERTY_GETSET(espcamera_camera_wpc_obj, + (mp_obj_t)&espcamera_camera_get_wpc_obj, + (mp_obj_t)&espcamera_camera_set_wpc_obj); + +//| raw_gma: bool +//| """When `True`, raw gamma mode is enabled.""" + +STATIC mp_obj_t espcamera_camera_get_raw_gma(const mp_obj_t self_in) { + espcamera_camera_obj_t *self = MP_OBJ_TO_PTR(self_in); + check_for_deinit(self); + return mp_obj_new_bool(common_hal_espcamera_camera_get_raw_gma(self)); +} +STATIC MP_DEFINE_CONST_FUN_OBJ_1(espcamera_camera_get_raw_gma_obj, espcamera_camera_get_raw_gma); + +STATIC mp_obj_t espcamera_camera_set_raw_gma(const mp_obj_t self_in, const mp_obj_t arg) { + espcamera_camera_obj_t *self = MP_OBJ_TO_PTR(self_in); + check_for_deinit(self); + common_hal_espcamera_camera_set_raw_gma(self, mp_obj_is_true(arg)); + return mp_const_none; +} +STATIC MP_DEFINE_CONST_FUN_OBJ_2(espcamera_camera_set_raw_gma_obj, espcamera_camera_set_raw_gma); +MP_PROPERTY_GETSET(espcamera_camera_raw_gma_obj, + (mp_obj_t)&espcamera_camera_get_raw_gma_obj, + (mp_obj_t)&espcamera_camera_set_raw_gma_obj); + +//| lenc: bool +//| """Enable "lens correction". This can help compensate for light fall-off at the edge of the sensor area.""" + +STATIC mp_obj_t espcamera_camera_get_lenc(const mp_obj_t self_in) { + espcamera_camera_obj_t *self = MP_OBJ_TO_PTR(self_in); + check_for_deinit(self); + return mp_obj_new_bool(common_hal_espcamera_camera_get_lenc(self)); +} +STATIC MP_DEFINE_CONST_FUN_OBJ_1(espcamera_camera_get_lenc_obj, espcamera_camera_get_lenc); + +STATIC mp_obj_t espcamera_camera_set_lenc(const mp_obj_t self_in, const mp_obj_t arg) { + espcamera_camera_obj_t *self = MP_OBJ_TO_PTR(self_in); + check_for_deinit(self); + common_hal_espcamera_camera_set_lenc(self, mp_obj_is_true(arg)); + return mp_const_none; +} +STATIC MP_DEFINE_CONST_FUN_OBJ_2(espcamera_camera_set_lenc_obj, espcamera_camera_set_lenc); +MP_PROPERTY_GETSET(espcamera_camera_lenc_obj, + (mp_obj_t)&espcamera_camera_get_lenc_obj, + (mp_obj_t)&espcamera_camera_set_lenc_obj); + +//| max_frame_size: FrameSize +//| """The maximum frame size that can be captured""" +STATIC mp_obj_t espcamera_camera_get_max_frame_size(const mp_obj_t self_in) { + espcamera_camera_obj_t *self = MP_OBJ_TO_PTR(self_in); + check_for_deinit(self); + return cp_enum_find(&espcamera_frame_size_type, common_hal_espcamera_camera_get_max_frame_size(self)); +} +STATIC MP_DEFINE_CONST_FUN_OBJ_1(espcamera_camera_get_max_frame_size_obj, espcamera_camera_get_max_frame_size); + +MP_PROPERTY_GETTER(espcamera_camera_max_frame_size_obj, + (mp_obj_t)&espcamera_camera_get_max_frame_size_obj); + + +//| address: int +//| """The I2C (SCCB) address of the sensor""" +STATIC mp_obj_t espcamera_camera_get_address(const mp_obj_t self_in) { + espcamera_camera_obj_t *self = MP_OBJ_TO_PTR(self_in); + check_for_deinit(self); + return MP_OBJ_NEW_SMALL_INT(common_hal_espcamera_camera_get_address(self)); +} +STATIC MP_DEFINE_CONST_FUN_OBJ_1(espcamera_camera_get_address_obj, espcamera_camera_get_address); + +MP_PROPERTY_GETTER(espcamera_camera_address_obj, + (mp_obj_t)&espcamera_camera_get_address_obj); + + +//| sensor_name: str +//| """The name of the sensor""" +STATIC mp_obj_t espcamera_camera_get_sensor_name(const mp_obj_t self_in) { + espcamera_camera_obj_t *self = MP_OBJ_TO_PTR(self_in); + check_for_deinit(self); + const char *sensor_name = common_hal_espcamera_camera_get_sensor_name(self); + return mp_obj_new_str(sensor_name, strlen(sensor_name)); +} +STATIC MP_DEFINE_CONST_FUN_OBJ_1(espcamera_camera_get_sensor_name_obj, espcamera_camera_get_sensor_name); + +MP_PROPERTY_GETTER(espcamera_camera_sensor_name_obj, + (mp_obj_t)&espcamera_camera_get_sensor_name_obj); + + +//| supports_jpeg: bool +//| """True if the sensor can capture images in JPEG format""" +STATIC mp_obj_t espcamera_camera_get_supports_jpeg(const mp_obj_t self_in) { + espcamera_camera_obj_t *self = MP_OBJ_TO_PTR(self_in); + check_for_deinit(self); + return mp_obj_new_bool(common_hal_espcamera_camera_get_supports_jpeg(self)); +} +STATIC MP_DEFINE_CONST_FUN_OBJ_1(espcamera_camera_get_supports_jpeg_obj, espcamera_camera_get_supports_jpeg); + +MP_PROPERTY_GETTER(espcamera_camera_supports_jpeg_obj, + (mp_obj_t)&espcamera_camera_get_supports_jpeg_obj); + +//| height: int +//| """The height of the image being captured""" +STATIC mp_obj_t espcamera_camera_get_height(const mp_obj_t self_in) { + espcamera_camera_obj_t *self = MP_OBJ_TO_PTR(self_in); + check_for_deinit(self); + return MP_OBJ_NEW_SMALL_INT(common_hal_espcamera_camera_get_height(self)); +} +STATIC MP_DEFINE_CONST_FUN_OBJ_1(espcamera_camera_get_height_obj, espcamera_camera_get_height); + +MP_PROPERTY_GETTER(espcamera_camera_height_obj, + (mp_obj_t)&espcamera_camera_get_height_obj); + +//| width: int +//| """The width of the image being captured""" +STATIC mp_obj_t espcamera_camera_get_width(const mp_obj_t self_in) { + espcamera_camera_obj_t *self = MP_OBJ_TO_PTR(self_in); + check_for_deinit(self); + return MP_OBJ_NEW_SMALL_INT(common_hal_espcamera_camera_get_width(self)); +} +STATIC MP_DEFINE_CONST_FUN_OBJ_1(espcamera_camera_get_width_obj, espcamera_camera_get_width); + +MP_PROPERTY_GETTER(espcamera_camera_width_obj, + (mp_obj_t)&espcamera_camera_get_width_obj); + +//| grab_mode: GrabMode +//| """The grab mode of the camera""" +STATIC mp_obj_t espcamera_camera_get_grab_mode(const mp_obj_t self_in) { + espcamera_camera_obj_t *self = MP_OBJ_TO_PTR(self_in); + check_for_deinit(self); + return cp_enum_find(&espcamera_grab_mode_type, common_hal_espcamera_camera_get_grab_mode(self)); +} +STATIC MP_DEFINE_CONST_FUN_OBJ_1(espcamera_camera_get_grab_mode_obj, espcamera_camera_get_grab_mode); + +MP_PROPERTY_GETTER(espcamera_camera_grab_mode_obj, + (mp_obj_t)&espcamera_camera_get_grab_mode_obj); + + +//| framebuffer_count: int +//| """True if double buffering is used""" +//| +STATIC mp_obj_t espcamera_camera_get_framebuffer_count(const mp_obj_t self_in) { + espcamera_camera_obj_t *self = MP_OBJ_TO_PTR(self_in); + check_for_deinit(self); + return MP_OBJ_NEW_SMALL_INT(common_hal_espcamera_camera_get_framebuffer_count(self)); +} +STATIC MP_DEFINE_CONST_FUN_OBJ_1(espcamera_camera_get_framebuffer_count_obj, espcamera_camera_get_framebuffer_count); + +MP_PROPERTY_GETTER(espcamera_camera_framebuffer_count_obj, + (mp_obj_t)&espcamera_camera_get_framebuffer_count_obj); + + +STATIC const mp_rom_map_elem_t espcamera_camera_locals_table[] = { + { MP_ROM_QSTR(MP_QSTR_address), MP_ROM_PTR(&espcamera_camera_address_obj) }, + { MP_ROM_QSTR(MP_QSTR_aec2), MP_ROM_PTR(&espcamera_camera_aec2_obj) }, + { MP_ROM_QSTR(MP_QSTR_aec_value), MP_ROM_PTR(&espcamera_camera_aec_value_obj) }, + { MP_ROM_QSTR(MP_QSTR_ae_level), MP_ROM_PTR(&espcamera_camera_ae_level_obj) }, + { MP_ROM_QSTR(MP_QSTR_agc_gain), MP_ROM_PTR(&espcamera_camera_agc_gain_obj) }, + { MP_ROM_QSTR(MP_QSTR_awb_gain), MP_ROM_PTR(&espcamera_camera_awb_gain_obj) }, + { MP_ROM_QSTR(MP_QSTR_bpc), MP_ROM_PTR(&espcamera_camera_bpc_obj) }, + { MP_ROM_QSTR(MP_QSTR_brightness), MP_ROM_PTR(&espcamera_camera_brightness_obj) }, + { MP_ROM_QSTR(MP_QSTR_colorbar), MP_ROM_PTR(&espcamera_camera_colorbar_obj) }, + { MP_ROM_QSTR(MP_QSTR_contrast), MP_ROM_PTR(&espcamera_camera_contrast_obj) }, + { MP_ROM_QSTR(MP_QSTR_dcw), MP_ROM_PTR(&espcamera_camera_dcw_obj) }, + { MP_ROM_QSTR(MP_QSTR_deinit), MP_ROM_PTR(&espcamera_camera_deinit_obj) }, + { MP_ROM_QSTR(MP_QSTR_denoise), MP_ROM_PTR(&espcamera_camera_denoise_obj) }, + { MP_ROM_QSTR(MP_QSTR_framebuffer_count), MP_ROM_PTR(&espcamera_camera_framebuffer_count_obj) }, + { MP_ROM_QSTR(MP_QSTR___enter__), MP_ROM_PTR(&mp_identity_obj) }, + { MP_ROM_QSTR(MP_QSTR___exit__), MP_ROM_PTR(&espcamera_camera___exit___obj) }, + { MP_ROM_QSTR(MP_QSTR_exposure_ctrl), MP_ROM_PTR(&espcamera_camera_exposure_ctrl_obj) }, + { MP_ROM_QSTR(MP_QSTR_frame_available), MP_ROM_PTR(&espcamera_camera_frame_available_obj) }, + { MP_ROM_QSTR(MP_QSTR_frame_size), MP_ROM_PTR(&espcamera_camera_frame_size_obj) }, + { MP_ROM_QSTR(MP_QSTR_gain_ceiling), MP_ROM_PTR(&espcamera_camera_gain_ceiling_obj) }, + { MP_ROM_QSTR(MP_QSTR_gain_ctrl), MP_ROM_PTR(&espcamera_camera_gain_ctrl_obj) }, + { MP_ROM_QSTR(MP_QSTR_grab_mode), MP_ROM_PTR(&espcamera_camera_grab_mode_obj) }, + { MP_ROM_QSTR(MP_QSTR_height), MP_ROM_PTR(&espcamera_camera_height_obj) }, + { MP_ROM_QSTR(MP_QSTR_hmirror), MP_ROM_PTR(&espcamera_camera_hmirror_obj) }, + { MP_ROM_QSTR(MP_QSTR_lenc), MP_ROM_PTR(&espcamera_camera_lenc_obj) }, + { MP_ROM_QSTR(MP_QSTR_max_frame_size), MP_ROM_PTR(&espcamera_camera_max_frame_size_obj) }, + { MP_ROM_QSTR(MP_QSTR_pixel_format), MP_ROM_PTR(&espcamera_camera_pixel_format_obj) }, + { MP_ROM_QSTR(MP_QSTR_quality), MP_ROM_PTR(&espcamera_camera_quality_obj) }, + { MP_ROM_QSTR(MP_QSTR_raw_gma), MP_ROM_PTR(&espcamera_camera_raw_gma_obj) }, + { MP_ROM_QSTR(MP_QSTR_reconfigure), MP_ROM_PTR(&espcamera_camera_reconfigure_obj) }, + { MP_ROM_QSTR(MP_QSTR_saturation), MP_ROM_PTR(&espcamera_camera_saturation_obj) }, + { MP_ROM_QSTR(MP_QSTR_sensor_name), MP_ROM_PTR(&espcamera_camera_sensor_name_obj) }, + { MP_ROM_QSTR(MP_QSTR_sharpness), MP_ROM_PTR(&espcamera_camera_sharpness_obj) }, + { MP_ROM_QSTR(MP_QSTR_special_effect), MP_ROM_PTR(&espcamera_camera_special_effect_obj) }, + { MP_ROM_QSTR(MP_QSTR_supports_jpeg), MP_ROM_PTR(&espcamera_camera_supports_jpeg_obj) }, + { MP_ROM_QSTR(MP_QSTR_take), MP_ROM_PTR(&espcamera_camera_take_obj) }, + { MP_ROM_QSTR(MP_QSTR_vflip), MP_ROM_PTR(&espcamera_camera_vflip_obj) }, + { MP_ROM_QSTR(MP_QSTR_wb_mode), MP_ROM_PTR(&espcamera_camera_wb_mode_obj) }, + { MP_ROM_QSTR(MP_QSTR_whitebal), MP_ROM_PTR(&espcamera_camera_whitebal_obj) }, + { MP_ROM_QSTR(MP_QSTR_width), MP_ROM_PTR(&espcamera_camera_width_obj) }, + { MP_ROM_QSTR(MP_QSTR_wpc), MP_ROM_PTR(&espcamera_camera_wpc_obj) }, +}; + +STATIC MP_DEFINE_CONST_DICT(espcamera_camera_locals_dict, espcamera_camera_locals_table); + +const mp_obj_type_t espcamera_camera_type = { + .base = { &mp_type_type }, + .name = MP_QSTR_Camera, + .make_new = espcamera_camera_make_new, + .locals_dict = (mp_obj_t)&espcamera_camera_locals_dict, +}; diff --git a/ports/espressif/bindings/esp32_camera/Camera.h b/ports/espressif/bindings/espcamera/Camera.h similarity index 72% rename from ports/espressif/bindings/esp32_camera/Camera.h rename to ports/espressif/bindings/espcamera/Camera.h index f190808531..c6d8182090 100644 --- a/ports/espressif/bindings/esp32_camera/Camera.h +++ b/ports/espressif/bindings/espcamera/Camera.h @@ -33,11 +33,11 @@ #include "shared-bindings/busio/I2C.h" -extern const mp_obj_type_t esp32_camera_camera_type; -typedef struct esp32_camera_camera_obj esp32_camera_camera_obj_t; +extern const mp_obj_type_t espcamera_camera_type; +typedef struct espcamera_camera_obj espcamera_camera_obj_t; -extern void common_hal_esp32_camera_camera_construct( - esp32_camera_camera_obj_t *self, +extern void common_hal_espcamera_camera_construct( + espcamera_camera_obj_t *self, uint8_t data_pins[8], const mcu_pin_obj_t *external_clock_pin, const mcu_pin_obj_t *pixel_clock_pin, @@ -53,11 +53,11 @@ extern void common_hal_esp32_camera_camera_construct( mp_int_t framebuffer_count, camera_grab_mode_t grab_mode); -extern void common_hal_esp32_camera_camera_deinit(esp32_camera_camera_obj_t *self); -extern bool common_hal_esp32_camera_camera_deinited(esp32_camera_camera_obj_t *self); -extern bool common_hal_esp32_camera_camera_available(esp32_camera_camera_obj_t *self); -extern camera_fb_t *common_hal_esp32_camera_camera_take(esp32_camera_camera_obj_t *self, int timeout_ms); -extern void common_hal_esp32_camera_camera_reconfigure(esp32_camera_camera_obj_t *self, framesize_t frame_size, pixformat_t pixel_format, camera_grab_mode_t grab_mode, mp_int_t framebuffer_count); +extern void common_hal_espcamera_camera_deinit(espcamera_camera_obj_t *self); +extern bool common_hal_espcamera_camera_deinited(espcamera_camera_obj_t *self); +extern bool common_hal_espcamera_camera_available(espcamera_camera_obj_t *self); +extern camera_fb_t *common_hal_espcamera_camera_take(espcamera_camera_obj_t *self, int timeout_ms); +extern void common_hal_espcamera_camera_reconfigure(espcamera_camera_obj_t *self, framesize_t frame_size, pixformat_t pixel_format, camera_grab_mode_t grab_mode, mp_int_t framebuffer_count); #define DECLARE_SENSOR_GETSET(type, name, field_name, setter_function_name) \ DECLARE_SENSOR_GET(type, name, field_name, setter_function_name) \ @@ -70,10 +70,10 @@ extern void common_hal_esp32_camera_camera_reconfigure(esp32_camera_camera_obj_t DECLARE_SENSOR_GET(type, name, status.status_field_name, setter_function_name) #define DECLARE_SENSOR_GET(type, name, status_field_name, setter_function_name) \ - extern type common_hal_esp32_camera_camera_get_##name(esp32_camera_camera_obj_t * self); + extern type common_hal_espcamera_camera_get_##name(espcamera_camera_obj_t * self); #define DECLARE_SENSOR_SET(type, name, setter_function_name) \ - extern void common_hal_esp32_camera_camera_set_##name(esp32_camera_camera_obj_t * self, type value); + extern void common_hal_espcamera_camera_set_##name(espcamera_camera_obj_t * self, type value); DECLARE_SENSOR_GET(pixformat_t, pixel_format, pixformat, set_pixformat) DECLARE_SENSOR_STATUS_GET(framesize_t, frame_size, framesize, set_framesize) @@ -104,13 +104,13 @@ DECLARE_SENSOR_STATUS_GETSET(bool, raw_gma, raw_gma, set_raw_gma); DECLARE_SENSOR_STATUS_GETSET(bool, lenc, lenc, set_lenc); // From settings -extern camera_grab_mode_t common_hal_esp32_camera_camera_get_grab_mode(esp32_camera_camera_obj_t *self); -extern int common_hal_esp32_camera_camera_get_framebuffer_count(esp32_camera_camera_obj_t *self); +extern camera_grab_mode_t common_hal_espcamera_camera_get_grab_mode(espcamera_camera_obj_t *self); +extern int common_hal_espcamera_camera_get_framebuffer_count(espcamera_camera_obj_t *self); // From camera_sensor_info_t -extern int common_hal_esp32_camera_camera_get_address(esp32_camera_camera_obj_t *self); -extern const char *common_hal_esp32_camera_camera_get_sensor_name(esp32_camera_camera_obj_t *self); -extern const bool common_hal_esp32_camera_camera_get_supports_jpeg(esp32_camera_camera_obj_t *self); -extern framesize_t common_hal_esp32_camera_camera_get_max_frame_size(esp32_camera_camera_obj_t *self); -extern int common_hal_esp32_camera_camera_get_width(esp32_camera_camera_obj_t *self); -extern int common_hal_esp32_camera_camera_get_height(esp32_camera_camera_obj_t *self); +extern int common_hal_espcamera_camera_get_address(espcamera_camera_obj_t *self); +extern const char *common_hal_espcamera_camera_get_sensor_name(espcamera_camera_obj_t *self); +extern const bool common_hal_espcamera_camera_get_supports_jpeg(espcamera_camera_obj_t *self); +extern framesize_t common_hal_espcamera_camera_get_max_frame_size(espcamera_camera_obj_t *self); +extern int common_hal_espcamera_camera_get_width(espcamera_camera_obj_t *self); +extern int common_hal_espcamera_camera_get_height(espcamera_camera_obj_t *self); diff --git a/ports/espressif/bindings/esp32_camera/__init__.c b/ports/espressif/bindings/espcamera/__init__.c similarity index 53% rename from ports/espressif/bindings/esp32_camera/__init__.c rename to ports/espressif/bindings/espcamera/__init__.c index 36c837106c..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, obj, 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, obj, 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, obj, 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, obj, arg_name); + return cp_enum_value(&espcamera_gain_ceiling_type, obj, arg_name); } -STATIC const mp_rom_map_elem_t esp32_camera_module_globals_table[] = { - { MP_ROM_QSTR(MP_QSTR___name__), MP_ROM_QSTR(MP_QSTR_esp32_camera) }, - { MP_ROM_QSTR(MP_QSTR_Camera), MP_ROM_PTR(&esp32_camera_camera_type), }, - { MP_ROM_QSTR(MP_QSTR_FrameSize), &esp32_camera_frame_size_type }, - { MP_ROM_QSTR(MP_QSTR_GainCeiling), &esp32_camera_gain_ceiling_type }, - { MP_ROM_QSTR(MP_QSTR_GrabMode), &esp32_camera_grab_mode_type }, - { MP_ROM_QSTR(MP_QSTR_PixelFormat), &esp32_camera_pixel_format_type }, +STATIC const mp_rom_map_elem_t espcamera_module_globals_table[] = { + { MP_ROM_QSTR(MP_QSTR___name__), MP_ROM_QSTR(MP_QSTR_espcamera) }, + { MP_ROM_QSTR(MP_QSTR_Camera), MP_ROM_PTR(&espcamera_camera_type), }, + { MP_ROM_QSTR(MP_QSTR_FrameSize), &espcamera_frame_size_type }, + { MP_ROM_QSTR(MP_QSTR_GainCeiling), &espcamera_gain_ceiling_type }, + { MP_ROM_QSTR(MP_QSTR_GrabMode), &espcamera_grab_mode_type }, + { MP_ROM_QSTR(MP_QSTR_PixelFormat), &espcamera_pixel_format_type }, }; -STATIC MP_DEFINE_CONST_DICT(esp32_camera_module_globals, esp32_camera_module_globals_table); +STATIC MP_DEFINE_CONST_DICT(espcamera_module_globals, espcamera_module_globals_table); -const mp_obj_module_t esp32_camera_module = { +const mp_obj_module_t espcamera_module = { .base = { &mp_type_module }, - .globals = (mp_obj_dict_t *)&esp32_camera_module_globals, + .globals = (mp_obj_dict_t *)&espcamera_module_globals, }; -MP_REGISTER_MODULE(MP_QSTR_esp32_camera, esp32_camera_module, CIRCUITPY_ESP32_CAMERA); +MP_REGISTER_MODULE(MP_QSTR_espcamera, espcamera_module, CIRCUITPY_ESPCAMERA); diff --git a/ports/espressif/bindings/esp32_camera/__init__.h b/ports/espressif/bindings/espcamera/__init__.h similarity index 88% rename from ports/espressif/bindings/esp32_camera/__init__.h rename to ports/espressif/bindings/espcamera/__init__.h index a0e7290ff9..6e55ac3870 100644 --- a/ports/espressif/bindings/esp32_camera/__init__.h +++ b/ports/espressif/bindings/espcamera/__init__.h @@ -31,13 +31,13 @@ #include "esp_camera.h" -extern const mp_obj_type_t esp32_camera_grab_mode_type; +extern const mp_obj_type_t espcamera_grab_mode_type; extern const cp_enum_obj_t grab_mode_WHEN_EMPTY_obj; -extern const mp_obj_type_t esp32_camera_pixel_format_type; +extern const mp_obj_type_t espcamera_pixel_format_type; extern const cp_enum_obj_t pixel_format_RGB565_obj; -extern const mp_obj_type_t esp32_camera_frame_size_type; +extern const mp_obj_type_t espcamera_frame_size_type; extern const cp_enum_obj_t frame_size_QQVGA_obj; -extern const mp_obj_type_t esp32_camera_gain_ceiling_type; +extern const mp_obj_type_t espcamera_gain_ceiling_type; extern camera_grab_mode_t validate_grab_mode(mp_obj_t obj, qstr arg_name); extern pixformat_t validate_pixel_format(mp_obj_t obj, qstr arg_name); diff --git a/ports/espressif/bindings/espidf/__init__.c b/ports/espressif/bindings/espidf/__init__.c index 12781000ae..c1ef9da1e0 100644 --- a/ports/espressif/bindings/espidf/__init__.c +++ b/ports/espressif/bindings/espidf/__init__.c @@ -37,6 +37,7 @@ //| """Direct access to a few ESP-IDF details. This module *should not* include any functionality //| that could be implemented by other frameworks. It should only include ESP-IDF specific //| things.""" +//| //| def heap_caps_get_total_size() -> int: //| """Return the total size of the ESP-IDF, which includes the CircuitPython heap.""" @@ -72,7 +73,8 @@ MP_DEFINE_CONST_FUN_OBJ_0(espidf_heap_caps_get_largest_free_block_obj, espidf_he //| """Erase all data in the non-volatile storage (nvs), including data stored by with `microcontroller.nvm` //| //| This is necessary when upgrading from CircuitPython 6.3.0 or earlier to CircuitPython 7.0.0, because the -//| layout of data in nvs has changed. The old data will be lost when you perform this operation.""" +//| layout of data in nvs has changed. The old data will be lost when you perform this operation. +//| """ //| STATIC mp_obj_t espidf_erase_nvs(void) { ESP_ERROR_CHECK(nvs_flash_deinit()); diff --git a/ports/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 index 201226d93f..c9666fb143 100644 --- a/ports/espressif/bindings/espulp/ULP.c +++ b/ports/espressif/bindings/espulp/ULP.c @@ -28,19 +28,35 @@ #include "shared-bindings/util.h" #include "bindings/espulp/ULP.h" +#include "py/enum.h" #include "py/runtime.h" +#include "py/objproperty.h" //| class ULP: -//| def __init__(self): +//| def __init__(self, arch: 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.""" +//| 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); + + common_hal_espulp_ulp_construct(self, arch); + return MP_OBJ_FROM_PTR(self); } @@ -124,7 +140,6 @@ STATIC MP_DEFINE_CONST_FUN_OBJ_KW(espulp_ulp_run_obj, 2, espulp_ulp_run); //| def halt(self) -> None: //| """Halts the running program and releases the pins given in `run()`.""" //| ... -//| STATIC mp_obj_t espulp_ulp_halt(mp_obj_t self_in) { espulp_ulp_obj_t *self = MP_OBJ_TO_PTR(self_in); check_for_deinit(self); @@ -134,12 +149,27 @@ STATIC mp_obj_t espulp_ulp_halt(mp_obj_t self_in) { } STATIC MP_DEFINE_CONST_FUN_OBJ_1(espulp_ulp_halt_obj, espulp_ulp_halt); +//| arch: 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_deinit), MP_ROM_PTR(&espulp_ulp_deinit_obj) }, + { MP_ROM_QSTR(MP_QSTR___enter__), MP_ROM_PTR(&mp_identity_obj) }, + { MP_ROM_QSTR(MP_QSTR___exit__), MP_ROM_PTR(&espulp_ulp___exit___obj) }, + { MP_ROM_QSTR(MP_QSTR_run), MP_ROM_PTR(&espulp_ulp_run_obj) }, + { MP_ROM_QSTR(MP_QSTR_halt), MP_ROM_PTR(&espulp_ulp_halt_obj) }, + { MP_ROM_QSTR(MP_QSTR_arch), MP_ROM_PTR(&espulp_ulp_arch_obj) }, }; STATIC MP_DEFINE_CONST_DICT(espulp_ulp_locals_dict, espulp_ulp_locals_table); diff --git a/ports/espressif/bindings/espulp/ULP.h b/ports/espressif/bindings/espulp/ULP.h index 9f9c3ecf7f..490cbef1ca 100644 --- a/ports/espressif/bindings/espulp/ULP.h +++ b/ports/espressif/bindings/espulp/ULP.h @@ -29,10 +29,9 @@ #include "py/obj.h" #include "common-hal/espulp/ULP.h" - extern const mp_obj_type_t espulp_ulp_type; -void common_hal_espulp_ulp_construct(espulp_ulp_obj_t *self); +void common_hal_espulp_ulp_construct(espulp_ulp_obj_t *self, espulp_architecture_t arch); bool common_hal_espulp_ulp_deinited(espulp_ulp_obj_t *self); void common_hal_espulp_ulp_deinit(espulp_ulp_obj_t *self); diff --git a/ports/espressif/bindings/espulp/ULPAlarm.c b/ports/espressif/bindings/espulp/ULPAlarm.c index e77fe7f834..6efd1c98ef 100644 --- a/ports/espressif/bindings/espulp/ULPAlarm.c +++ b/ports/espressif/bindings/espulp/ULPAlarm.c @@ -27,25 +27,36 @@ #include "bindings/espulp/ULPAlarm.h" #include "py/runtime.h" +#include "py/objproperty.h" //| class ULPAlarm: //| """Trigger an alarm when the ULP requests wake-up.""" //| -//| def __init__(self) -> None: +//| def __init__(self, ulp: ULP) -> None: //| """Create an alarm that will be triggered when the ULP requests wake-up. //| //| The alarm is not active until it is passed to an `alarm`-enabling function, such as //| `alarm.light_sleep_until_alarms()` or `alarm.exit_and_deep_sleep_until_alarms()`. //| -//| """ +//| :param ULP ulp: The ulp instance""" //| ... //| -STATIC mp_obj_t espulp_ulpalarm_make_new(const mp_obj_type_t *type, - size_t n_args, size_t n_kw, const mp_obj_t *all_args) { +STATIC mp_obj_t espulp_ulpalarm_make_new(const mp_obj_type_t *type, size_t n_args, size_t n_kw, const mp_obj_t *all_args) { + enum { ARG_ulp }; + static const mp_arg_t allowed_args[] = { + { MP_QSTR_ulp, MP_ARG_REQUIRED | MP_ARG_OBJ }, + }; + + mp_arg_val_t args[MP_ARRAY_SIZE(allowed_args)]; + mp_arg_parse_all_kw_array(n_args, n_kw, all_args, MP_ARRAY_SIZE(allowed_args), allowed_args, args); espulp_ulpalarm_obj_t *self = m_new_obj(espulp_ulpalarm_obj_t); self->base.type = &espulp_ulpalarm_type; - common_hal_espulp_ulpalarm_construct(self); + + espulp_ulp_obj_t *ulp = mp_arg_validate_type(args[ARG_ulp].u_obj, &espulp_ulp_type, MP_QSTR_ulp); + + common_hal_espulp_ulpalarm_construct(self, ulp); + return MP_OBJ_FROM_PTR(self); } diff --git a/ports/espressif/bindings/espulp/ULPAlarm.h b/ports/espressif/bindings/espulp/ULPAlarm.h index 75e96c0a45..f2b2e69bba 100644 --- a/ports/espressif/bindings/espulp/ULPAlarm.h +++ b/ports/espressif/bindings/espulp/ULPAlarm.h @@ -30,4 +30,4 @@ extern const mp_obj_type_t espulp_ulpalarm_type; -void common_hal_espulp_ulpalarm_construct(espulp_ulpalarm_obj_t *self); +void common_hal_espulp_ulpalarm_construct(espulp_ulpalarm_obj_t *self, espulp_ulp_obj_t *ulp); diff --git a/ports/espressif/bindings/espulp/__init__.c b/ports/espressif/bindings/espulp/__init__.c index b51cbebf5e..f2b688dda4 100644 --- a/ports/espressif/bindings/espulp/__init__.c +++ b/ports/espressif/bindings/espulp/__init__.c @@ -25,9 +25,11 @@ */ #include "shared-bindings/util.h" + #include "bindings/espulp/__init__.h" #include "bindings/espulp/ULP.h" #include "bindings/espulp/ULPAlarm.h" +#include "bindings/espulp/Architecture.h" #include "py/runtime.h" @@ -80,6 +82,7 @@ STATIC const mp_rom_map_elem_t espulp_module_globals_table[] = { // module classes { MP_ROM_QSTR(MP_QSTR_ULP), MP_OBJ_FROM_PTR(&espulp_ulp_type) }, { MP_ROM_QSTR(MP_QSTR_ULPAlarm), MP_OBJ_FROM_PTR(&espulp_ulpalarm_type) }, + { MP_ROM_QSTR(MP_QSTR_Architecture), MP_ROM_PTR(&espulp_architecture_type) }, }; STATIC MP_DEFINE_CONST_DICT(espulp_module_globals, espulp_module_globals_table); diff --git a/ports/espressif/boards/adafruit_feather_esp32s2_reverse_tft/mpconfigboard.mk b/ports/espressif/boards/adafruit_feather_esp32s2_reverse_tft/mpconfigboard.mk index 6f6b949d13..920b748e3d 100644 --- a/ports/espressif/boards/adafruit_feather_esp32s2_reverse_tft/mpconfigboard.mk +++ b/ports/espressif/boards/adafruit_feather_esp32s2_reverse_tft/mpconfigboard.mk @@ -1,5 +1,5 @@ USB_VID = 0x239A -USB_PID = 0x8128 +USB_PID = 0x80EE USB_PRODUCT = "Feather ESP32-S2 Reverse TFT" USB_MANUFACTURER = "Adafruit" diff --git a/ports/espressif/boards/adafruit_feather_esp32s2_reverse_tft/pins.c b/ports/espressif/boards/adafruit_feather_esp32s2_reverse_tft/pins.c index 0a331c93fd..32718700b1 100644 --- a/ports/espressif/boards/adafruit_feather_esp32s2_reverse_tft/pins.c +++ b/ports/espressif/boards/adafruit_feather_esp32s2_reverse_tft/pins.c @@ -67,6 +67,10 @@ STATIC const mp_rom_map_elem_t board_module_globals_table[] = { { MP_ROM_QSTR(MP_QSTR_BUTTON), MP_ROM_PTR(&pin_GPIO0) }, { MP_ROM_QSTR(MP_QSTR_BOOT0), MP_ROM_PTR(&pin_GPIO0) }, + { MP_ROM_QSTR(MP_QSTR_D0), MP_ROM_PTR(&pin_GPIO0) }, + + { MP_ROM_QSTR(MP_QSTR_D1), MP_ROM_PTR(&pin_GPIO1) }, + { MP_ROM_QSTR(MP_QSTR_D2), MP_ROM_PTR(&pin_GPIO2) }, { MP_ROM_QSTR(MP_QSTR_I2C), MP_ROM_PTR(&board_i2c_obj) }, { MP_ROM_QSTR(MP_QSTR_STEMMA_I2C), MP_ROM_PTR(&board_i2c_obj) }, diff --git a/ports/espressif/boards/adafruit_feather_esp32s2_tftback_nopsram/board.c b/ports/espressif/boards/adafruit_feather_esp32s2_tftback_nopsram/board.c deleted file mode 100644 index e0edec2fa2..0000000000 --- a/ports/espressif/boards/adafruit_feather_esp32s2_tftback_nopsram/board.c +++ /dev/null @@ -1,108 +0,0 @@ -/* - * This file is part of the MicroPython project, http://micropython.org/ - * - * The MIT License (MIT) - * - * Copyright (c) 2020 Scott Shawcroft for Adafruit Industries - * - * Permission is hereby granted, free of charge, to any person obtaining a copy - * of this software and associated documentation files (the "Software"), to deal - * in the Software without restriction, including without limitation the rights - * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell - * copies of the Software, and to permit persons to whom the Software is - * furnished to do so, subject to the following conditions: - * - * The above copyright notice and this permission notice shall be included in - * all copies or substantial portions of the Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR - * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, - * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE - * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER - * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, - * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN - * THE SOFTWARE. - */ - -#include "supervisor/board.h" -#include "mpconfigboard.h" -#include "shared-bindings/busio/SPI.h" -#include "shared-bindings/displayio/FourWire.h" -#include "shared-bindings/microcontroller/Pin.h" -#include "shared-module/displayio/__init__.h" -#include "shared-module/displayio/mipi_constants.h" - -/* -displayio_fourwire_obj_t board_display_obj; - -#define DELAY 0x80 - -uint8_t display_init_sequence[] = { - 0x01, 0 | DELAY, 150, // SWRESET - 0x11, 0 | DELAY, 255, // SLPOUT - 0x36, 1, 0x00, // _MADCTL bottom to top refresh in vsync aligned order. - 0x3a, 1, 0x55, // COLMOD - 16bit color - 0x21, 0 | DELAY, 10, // _INVON - 0x13, 0 | DELAY, 10, // _NORON - 0x29, 0 | DELAY, 255, // _DISPON -}; - -*/ - -void board_init(void) { - // Debug UART - #ifdef DEBUG - common_hal_never_reset_pin(&pin_GPIO43); - common_hal_never_reset_pin(&pin_GPIO44); - #endif /* DEBUG */ - - /* - busio_spi_obj_t* spi = &displays[0].fourwire_bus.inline_bus; - common_hal_busio_spi_construct(spi, &pin_GPIO36, &pin_GPIO35, NULL); - common_hal_busio_spi_never_reset(spi); - - displayio_fourwire_obj_t* bus = &displays[0].fourwire_bus; - bus->base.type = &displayio_fourwire_type; - common_hal_displayio_fourwire_construct(bus, - spi, - &pin_GPIO40, // TFT_DC Command or data - &pin_GPIO42, // TFT_CS Chip select - &pin_GPIO41, // TFT_RST Reset - 4000000, // Baudrate - 0, // Polarity - 0); // Phase - - displayio_display_obj_t* display = &displays[0].display; - display->base.type = &displayio_display_type; - common_hal_displayio_display_construct(display, - bus, - 240, // Width (after rotation) - 135, // Height (after rotation) - 0, // column start - 0, // row start - 0, // rotation - 16, // Color depth - false, // Grayscale - false, // Pixels in a byte share a row. Only used for depth < 8 - 1, // bytes per cell. Only valid for depths < 8 - false, // reverse_pixels_in_byte. Only valid for depths < 8 - true, // reverse_pixels_in_word - MIPI_COMMAND_SET_COLUMN_ADDRESS, // Set column command - MIPI_COMMAND_SET_PAGE_ADDRESS, // Set row command - MIPI_COMMAND_WRITE_MEMORY_START, // Write memory command - display_init_sequence, - sizeof(display_init_sequence), - &pin_GPIO7, // backlight pin - NO_BRIGHTNESS_COMMAND, - 1.0f, // brightness - false, // single_byte_bounds - false, // data_as_commands - true, // auto_refresh - 60, // native_frames_per_second - true, // backlight_on_high - false, // not SH1107 - 50000); // backlight pwm frequency - */ -} - -// Use the MP_WEAK supervisor/shared/board.c versions of routines not defined here. diff --git a/ports/espressif/boards/adafruit_feather_esp32s2_tftback_nopsram/mpconfigboard.mk b/ports/espressif/boards/adafruit_feather_esp32s2_tftback_nopsram/mpconfigboard.mk deleted file mode 100644 index b07161cee3..0000000000 --- a/ports/espressif/boards/adafruit_feather_esp32s2_tftback_nopsram/mpconfigboard.mk +++ /dev/null @@ -1,15 +0,0 @@ -USB_VID = 0x239A -USB_PID = 0x80EE -USB_PRODUCT = "Feather ESP32S2 TFT no PSRAM" -USB_MANUFACTURER = "Adafruit" - -IDF_TARGET = esp32s2 - -CIRCUITPY_ESP_FLASH_MODE = dio -CIRCUITPY_ESP_FLASH_FREQ = 40m -CIRCUITPY_ESP_FLASH_SIZE = 4MB - -FROZEN_MPY_DIRS += $(TOP)/frozen/Adafruit_CircuitPython_Requests -FROZEN_MPY_DIRS += $(TOP)/frozen/Adafruit_CircuitPython_NeoPixel -FROZEN_MPY_DIRS += $(TOP)/frozen/Adafruit_CircuitPython_Register -CIRCUITPY_ESP32_CAMERA = 0 diff --git a/ports/espressif/boards/adafruit_feather_esp32s2_tftback_nopsram/pins.c b/ports/espressif/boards/adafruit_feather_esp32s2_tftback_nopsram/pins.c deleted file mode 100644 index 54b9051d73..0000000000 --- a/ports/espressif/boards/adafruit_feather_esp32s2_tftback_nopsram/pins.c +++ /dev/null @@ -1,75 +0,0 @@ -#include "shared-bindings/board/__init__.h" - -#include "shared-module/displayio/__init__.h" - -STATIC const mp_rom_map_elem_t board_module_globals_table[] = { - CIRCUITPYTHON_BOARD_DICT_STANDARD_ITEMS - - { MP_ROM_QSTR(MP_QSTR_D0), MP_ROM_PTR(&pin_GPIO0) }, - - { MP_ROM_QSTR(MP_QSTR_D3), MP_ROM_PTR(&pin_GPIO3) }, - { MP_ROM_QSTR(MP_QSTR_SDA), MP_ROM_PTR(&pin_GPIO3) }, - - { MP_ROM_QSTR(MP_QSTR_D4), MP_ROM_PTR(&pin_GPIO4) }, - { MP_ROM_QSTR(MP_QSTR_SCL), MP_ROM_PTR(&pin_GPIO4) }, - - { MP_ROM_QSTR(MP_QSTR_D5), MP_ROM_PTR(&pin_GPIO5) }, - { MP_ROM_QSTR(MP_QSTR_D6), MP_ROM_PTR(&pin_GPIO6) }, - - { MP_ROM_QSTR(MP_QSTR_TFT_BACKLIGHT), MP_ROM_PTR(&pin_GPIO7) }, - - { MP_ROM_QSTR(MP_QSTR_D8), MP_ROM_PTR(&pin_GPIO8) }, - { MP_ROM_QSTR(MP_QSTR_A5), MP_ROM_PTR(&pin_GPIO8) }, - - { MP_ROM_QSTR(MP_QSTR_D9), MP_ROM_PTR(&pin_GPIO9) }, - { MP_ROM_QSTR(MP_QSTR_D10), MP_ROM_PTR(&pin_GPIO10) }, - { MP_ROM_QSTR(MP_QSTR_D11), MP_ROM_PTR(&pin_GPIO11) }, - { MP_ROM_QSTR(MP_QSTR_D12), MP_ROM_PTR(&pin_GPIO12) }, - - { MP_ROM_QSTR(MP_QSTR_LED), MP_ROM_PTR(&pin_GPIO13) }, - { MP_ROM_QSTR(MP_QSTR_D13), MP_ROM_PTR(&pin_GPIO13) }, - { MP_ROM_QSTR(MP_QSTR_L), MP_ROM_PTR(&pin_GPIO13) }, - - { MP_ROM_QSTR(MP_QSTR_D14), MP_ROM_PTR(&pin_GPIO14) }, - { MP_ROM_QSTR(MP_QSTR_A4), MP_ROM_PTR(&pin_GPIO14) }, - - { MP_ROM_QSTR(MP_QSTR_D15), MP_ROM_PTR(&pin_GPIO15) }, - { MP_ROM_QSTR(MP_QSTR_A3), MP_ROM_PTR(&pin_GPIO15) }, - - { MP_ROM_QSTR(MP_QSTR_D16), MP_ROM_PTR(&pin_GPIO16) }, - { MP_ROM_QSTR(MP_QSTR_A2), MP_ROM_PTR(&pin_GPIO16) }, - - { MP_ROM_QSTR(MP_QSTR_D17), MP_ROM_PTR(&pin_GPIO17) }, - { MP_ROM_QSTR(MP_QSTR_A1), MP_ROM_PTR(&pin_GPIO17) }, - - { MP_ROM_QSTR(MP_QSTR_D18), MP_ROM_PTR(&pin_GPIO18) }, - { MP_ROM_QSTR(MP_QSTR_A0), MP_ROM_PTR(&pin_GPIO18) }, - - { MP_ROM_QSTR(MP_QSTR_NEOPIXEL_POWER), MP_ROM_PTR(&pin_GPIO21) }, - { MP_ROM_QSTR(MP_QSTR_NEOPIXEL), MP_ROM_PTR(&pin_GPIO33) }, - - { MP_ROM_QSTR(MP_QSTR_D35), MP_ROM_PTR(&pin_GPIO35) }, - { MP_ROM_QSTR(MP_QSTR_MOSI), MP_ROM_PTR(&pin_GPIO35) }, - - { MP_ROM_QSTR(MP_QSTR_D36), MP_ROM_PTR(&pin_GPIO36) }, - { MP_ROM_QSTR(MP_QSTR_SCK), MP_ROM_PTR(&pin_GPIO36) }, - - { MP_ROM_QSTR(MP_QSTR_D37), MP_ROM_PTR(&pin_GPIO37) }, - { MP_ROM_QSTR(MP_QSTR_MISO), MP_ROM_PTR(&pin_GPIO37) }, - - { MP_ROM_QSTR(MP_QSTR_D38), MP_ROM_PTR(&pin_GPIO38) }, - { MP_ROM_QSTR(MP_QSTR_RX), MP_ROM_PTR(&pin_GPIO38) }, - - { MP_ROM_QSTR(MP_QSTR_D39), MP_ROM_PTR(&pin_GPIO39) }, - { MP_ROM_QSTR(MP_QSTR_TX), MP_ROM_PTR(&pin_GPIO39) }, - - { MP_ROM_QSTR(MP_QSTR_TFT_DC), MP_ROM_PTR(&pin_GPIO40) }, - { MP_ROM_QSTR(MP_QSTR_TFT_RESET), MP_ROM_PTR(&pin_GPIO41) }, - { MP_ROM_QSTR(MP_QSTR_TFT_CS), MP_ROM_PTR(&pin_GPIO42) }, - - { MP_ROM_QSTR(MP_QSTR_I2C), MP_ROM_PTR(&board_i2c_obj) }, - { MP_ROM_QSTR(MP_QSTR_SPI), MP_ROM_PTR(&board_spi_obj) }, - - // { MP_ROM_QSTR(MP_QSTR_DISPLAY), MP_ROM_PTR(&displays[0].display)} -}; -MP_DEFINE_CONST_DICT(board_module_globals, board_module_globals_table); diff --git a/ports/espressif/boards/adafruit_feather_esp32s2_tftback_nopsram/sdkconfig b/ports/espressif/boards/adafruit_feather_esp32s2_tftback_nopsram/sdkconfig deleted file mode 100644 index 5b9c86dcc3..0000000000 --- a/ports/espressif/boards/adafruit_feather_esp32s2_tftback_nopsram/sdkconfig +++ /dev/null @@ -1,6 +0,0 @@ -# CONFIG_ESP32S2_SPIRAM_SUPPORT is not set -# -# LWIP -# -CONFIG_LWIP_LOCAL_HOSTNAME="espressif" -# end of LWIP 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/pins.c b/ports/espressif/boards/adafruit_feather_esp32s3_reverse_tft/pins.c index 0a331c93fd..32718700b1 100644 --- a/ports/espressif/boards/adafruit_feather_esp32s3_reverse_tft/pins.c +++ b/ports/espressif/boards/adafruit_feather_esp32s3_reverse_tft/pins.c @@ -67,6 +67,10 @@ STATIC const mp_rom_map_elem_t board_module_globals_table[] = { { MP_ROM_QSTR(MP_QSTR_BUTTON), MP_ROM_PTR(&pin_GPIO0) }, { MP_ROM_QSTR(MP_QSTR_BOOT0), MP_ROM_PTR(&pin_GPIO0) }, + { MP_ROM_QSTR(MP_QSTR_D0), MP_ROM_PTR(&pin_GPIO0) }, + + { MP_ROM_QSTR(MP_QSTR_D1), MP_ROM_PTR(&pin_GPIO1) }, + { MP_ROM_QSTR(MP_QSTR_D2), MP_ROM_PTR(&pin_GPIO2) }, { MP_ROM_QSTR(MP_QSTR_I2C), MP_ROM_PTR(&board_i2c_obj) }, { MP_ROM_QSTR(MP_QSTR_STEMMA_I2C), MP_ROM_PTR(&board_i2c_obj) }, 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/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/espressif/boards/brainboardz_neuron/mpconfigboard.h b/ports/espressif/boards/brainboardz_neuron/mpconfigboard.h new file mode 100755 index 0000000000..9507917ead --- /dev/null +++ b/ports/espressif/boards/brainboardz_neuron/mpconfigboard.h @@ -0,0 +1,33 @@ +/* + * This file is part of the MicroPython project, http://micropython.org/ + * + * The MIT License (MIT) + * + * Copyright (c) 2019 Scott Shawcroft for Adafruit Industries + * + * Permission is hereby granted, free of charge, to any person obtaining a copy + * of this software and associated documentation files (the "Software"), to deal + * in the Software without restriction, including without limitation the rights + * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell + * copies of the Software, and to permit persons to whom the Software is + * furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice shall be included in + * all copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE + * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER + * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, + * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN + * THE SOFTWARE. + */ + +// Micropython setup + +#define MICROPY_HW_BOARD_NAME "Neuron" +#define MICROPY_HW_MCU_NAME "ESP32S3" + +#define DEFAULT_UART_BUS_RX (&pin_GPIO44) +#define DEFAULT_UART_BUS_TX (&pin_GPIO43) diff --git a/ports/espressif/boards/brainboardz_neuron/mpconfigboard.mk b/ports/espressif/boards/brainboardz_neuron/mpconfigboard.mk new file mode 100755 index 0000000000..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 3921140b5c..5862ee1192 100644 --- a/ports/espressif/boards/crcibernetica-ideaboard/mpconfigboard.mk +++ b/ports/espressif/boards/crcibernetica-ideaboard/mpconfigboard.mk @@ -6,7 +6,7 @@ IDF_TARGET = esp32 CIRCUITPY_ESP_FLASH_MODE = dio CIRCUITPY_ESP_FLASH_FREQ = 40m CIRCUITPY_ESP_FLASH_SIZE = 8MB -CIRCUITPY_ESP32_CAMERA = 0 +CIRCUITPY_ESPCAMERA = 0 # Include these Python libraries in firmware FROZEN_MPY_DIRS += $(TOP)/frozen/Adafruit_CircuitPython_Requests diff --git a/ports/espressif/boards/doit_esp32_devkit_v1/mpconfigboard.mk b/ports/espressif/boards/doit_esp32_devkit_v1/mpconfigboard.mk index 7aa352e16e..23f905dfdf 100644 --- a/ports/espressif/boards/doit_esp32_devkit_v1/mpconfigboard.mk +++ b/ports/espressif/boards/doit_esp32_devkit_v1/mpconfigboard.mk @@ -6,4 +6,4 @@ IDF_TARGET = esp32 CIRCUITPY_ESP_FLASH_MODE = dio CIRCUITPY_ESP_FLASH_FREQ = 40m CIRCUITPY_ESP_FLASH_SIZE = 4MB -CIRCUITPY_ESP32_CAMERA = 0 +CIRCUITPY_ESPCAMERA = 0 diff --git a/ports/espressif/boards/electroniccats_bastwifi/mpconfigboard.mk b/ports/espressif/boards/electroniccats_bastwifi/mpconfigboard.mk index 67e88a1639..73acab519c 100644 --- a/ports/espressif/boards/electroniccats_bastwifi/mpconfigboard.mk +++ b/ports/espressif/boards/electroniccats_bastwifi/mpconfigboard.mk @@ -10,4 +10,4 @@ CIRCUITPY_NEOPIXEL_WRITE = 0 CIRCUITPY_ESP_FLASH_MODE = dio CIRCUITPY_ESP_FLASH_FREQ = 40m CIRCUITPY_ESP_FLASH_SIZE = 4MB -CIRCUITPY_ESP32_CAMERA = 0 +CIRCUITPY_ESPCAMERA = 0 diff --git a/ports/espressif/boards/espressif_esp32s2_devkitc_1_n4/mpconfigboard.mk b/ports/espressif/boards/espressif_esp32s2_devkitc_1_n4/mpconfigboard.mk index 31e79b2425..d92eff48d0 100644 --- a/ports/espressif/boards/espressif_esp32s2_devkitc_1_n4/mpconfigboard.mk +++ b/ports/espressif/boards/espressif_esp32s2_devkitc_1_n4/mpconfigboard.mk @@ -8,4 +8,4 @@ IDF_TARGET = esp32s2 CIRCUITPY_ESP_FLASH_MODE = dio CIRCUITPY_ESP_FLASH_FREQ = 40m CIRCUITPY_ESP_FLASH_SIZE = 4MB -CIRCUITPY_ESP32_CAMERA = 0 +CIRCUITPY_ESPCAMERA = 0 diff --git a/ports/espressif/boards/espressif_esp32s3_box/mpconfigboard.mk b/ports/espressif/boards/espressif_esp32s3_box/mpconfigboard.mk index 7ffb076348..5a2a4794bd 100644 --- a/ports/espressif/boards/espressif_esp32s3_box/mpconfigboard.mk +++ b/ports/espressif/boards/espressif_esp32s3_box/mpconfigboard.mk @@ -9,4 +9,4 @@ CIRCUITPY_ESP_FLASH_MODE = dio CIRCUITPY_ESP_FLASH_FREQ = 40m CIRCUITPY_ESP_FLASH_SIZE = 16MB -CIRCUITPY_ESP32_CAMERA = 0 +CIRCUITPY_ESPCAMERA = 0 diff --git a/ports/espressif/boards/espressif_esp32s3_box_lite/mpconfigboard.mk b/ports/espressif/boards/espressif_esp32s3_box_lite/mpconfigboard.mk index f4a746026a..a4bd29fa52 100644 --- a/ports/espressif/boards/espressif_esp32s3_box_lite/mpconfigboard.mk +++ b/ports/espressif/boards/espressif_esp32s3_box_lite/mpconfigboard.mk @@ -9,4 +9,4 @@ CIRCUITPY_ESP_FLASH_MODE = dio CIRCUITPY_ESP_FLASH_FREQ = 40m CIRCUITPY_ESP_FLASH_SIZE = 16MB -CIRCUITPY_ESP32_CAMERA = 0 +CIRCUITPY_ESPCAMERA = 0 diff --git a/ports/espressif/boards/espressif_esp32s3_devkitc_1_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/adafruit_feather_esp32s2_tftback_nopsram/mpconfigboard.h b/ports/espressif/boards/espressif_esp32s3_devkitc_1_n32r8/mpconfigboard.h similarity index 71% rename from ports/espressif/boards/adafruit_feather_esp32s2_tftback_nopsram/mpconfigboard.h rename to ports/espressif/boards/espressif_esp32s3_devkitc_1_n32r8/mpconfigboard.h index b4034568c0..26410bb210 100644 --- a/ports/espressif/boards/adafruit_feather_esp32s2_tftback_nopsram/mpconfigboard.h +++ b/ports/espressif/boards/espressif_esp32s3_devkitc_1_n32r8/mpconfigboard.h @@ -26,19 +26,14 @@ // Micropython setup -#define MICROPY_HW_BOARD_NAME "Feather ESP32S2 without PSRAM" -#define MICROPY_HW_MCU_NAME "ESP32S2" +#define MICROPY_HW_BOARD_NAME "ESP32-S3-DevKitC-1-N32R8" +#define MICROPY_HW_MCU_NAME "ESP32S3" -#define MICROPY_HW_NEOPIXEL (&pin_GPIO33) -#define CIRCUITPY_STATUS_LED_POWER (&pin_GPIO21) +#define MICROPY_HW_NEOPIXEL (&pin_GPIO48) -#define MICROPY_HW_LED_STATUS (&pin_GPIO13) +#define CIRCUITPY_BOOT_BUTTON (&pin_GPIO0) -#define DEFAULT_I2C_BUS_SCL (&pin_GPIO4) -#define DEFAULT_I2C_BUS_SDA (&pin_GPIO3) +#define DEFAULT_UART_BUS_RX (&pin_GPIO44) +#define DEFAULT_UART_BUS_TX (&pin_GPIO43) -#define DEFAULT_SPI_BUS_SCK (&pin_GPIO36) -#define DEFAULT_SPI_BUS_MOSI (&pin_GPIO35) -#define DEFAULT_SPI_BUS_MISO (&pin_GPIO37) - -#define DOUBLE_TAP_PIN (&pin_GPIO34) +#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/lilygo_ttgo_t8_esp32_s2_wroom/mpconfigboard.mk b/ports/espressif/boards/lilygo_ttgo_t8_esp32_s2_wroom/mpconfigboard.mk index b5cc1bae7c..3244d38869 100644 --- a/ports/espressif/boards/lilygo_ttgo_t8_esp32_s2_wroom/mpconfigboard.mk +++ b/ports/espressif/boards/lilygo_ttgo_t8_esp32_s2_wroom/mpconfigboard.mk @@ -8,4 +8,4 @@ IDF_TARGET = esp32s2 CIRCUITPY_ESP_FLASH_MODE = dio CIRCUITPY_ESP_FLASH_FREQ = 40m CIRCUITPY_ESP_FLASH_SIZE = 4MB -CIRCUITPY_ESP32_CAMERA = 0 +CIRCUITPY_ESPCAMERA = 0 diff --git a/ports/espressif/boards/lolin_s3/mpconfigboard.mk b/ports/espressif/boards/lolin_s3/mpconfigboard.mk index b0b146b03c..c81e3e6fb9 100644 --- a/ports/espressif/boards/lolin_s3/mpconfigboard.mk +++ b/ports/espressif/boards/lolin_s3/mpconfigboard.mk @@ -10,4 +10,4 @@ CIRCUITPY_ESP_FLASH_FREQ = 80m CIRCUITPY_ESP_FLASH_SIZE = 16MB OPTIMIZATION_FLAGS = -Os -CIRCUITPY_ESP32_CAMERA = 0 +CIRCUITPY_ESPCAMERA = 0 diff --git a/ports/espressif/boards/m5stack_atom_echo/mpconfigboard.mk b/ports/espressif/boards/m5stack_atom_echo/mpconfigboard.mk index 663ceaad81..63ed093f0a 100644 --- a/ports/espressif/boards/m5stack_atom_echo/mpconfigboard.mk +++ b/ports/espressif/boards/m5stack_atom_echo/mpconfigboard.mk @@ -7,4 +7,4 @@ CIRCUITPY_ESP_FLASH_MODE = dio CIRCUITPY_ESP_FLASH_FREQ = 40m CIRCUITPY_ESP_FLASH_SIZE = 4MB -CIRCUITPY_ESP32_CAMERA = 0 +CIRCUITPY_ESPCAMERA = 0 diff --git a/ports/espressif/boards/m5stack_atom_lite/mpconfigboard.mk b/ports/espressif/boards/m5stack_atom_lite/mpconfigboard.mk index 6adf65d2bc..e1ba503b8c 100644 --- a/ports/espressif/boards/m5stack_atom_lite/mpconfigboard.mk +++ b/ports/espressif/boards/m5stack_atom_lite/mpconfigboard.mk @@ -7,4 +7,4 @@ CIRCUITPY_ESP_FLASH_MODE = dio CIRCUITPY_ESP_FLASH_FREQ = 40m CIRCUITPY_ESP_FLASH_SIZE = 4MB -CIRCUITPY_ESP32_CAMERA = 0 +CIRCUITPY_ESPCAMERA = 0 diff --git a/ports/espressif/boards/m5stack_atom_matrix/mpconfigboard.mk b/ports/espressif/boards/m5stack_atom_matrix/mpconfigboard.mk index c34fa9d836..ecf9319584 100644 --- a/ports/espressif/boards/m5stack_atom_matrix/mpconfigboard.mk +++ b/ports/espressif/boards/m5stack_atom_matrix/mpconfigboard.mk @@ -7,4 +7,4 @@ CIRCUITPY_ESP_FLASH_MODE = dio CIRCUITPY_ESP_FLASH_FREQ = 40m CIRCUITPY_ESP_FLASH_SIZE = 4MB -CIRCUITPY_ESP32_CAMERA = 0 +CIRCUITPY_ESPCAMERA = 0 diff --git a/ports/espressif/boards/m5stack_atom_u/mpconfigboard.mk b/ports/espressif/boards/m5stack_atom_u/mpconfigboard.mk index 18bb6d3dc0..f271671113 100644 --- a/ports/espressif/boards/m5stack_atom_u/mpconfigboard.mk +++ b/ports/espressif/boards/m5stack_atom_u/mpconfigboard.mk @@ -7,4 +7,4 @@ CIRCUITPY_ESP_FLASH_MODE = dio CIRCUITPY_ESP_FLASH_FREQ = 40m CIRCUITPY_ESP_FLASH_SIZE = 4MB -CIRCUITPY_ESP32_CAMERA = 0 +CIRCUITPY_ESPCAMERA = 0 diff --git a/ports/espressif/boards/m5stack_core_basic/mpconfigboard.mk b/ports/espressif/boards/m5stack_core_basic/mpconfigboard.mk index 1abf68428c..dedcde81e6 100644 --- a/ports/espressif/boards/m5stack_core_basic/mpconfigboard.mk +++ b/ports/espressif/boards/m5stack_core_basic/mpconfigboard.mk @@ -6,4 +6,4 @@ IDF_TARGET = esp32 CIRCUITPY_ESP_FLASH_MODE = qio CIRCUITPY_ESP_FLASH_FREQ = 80m CIRCUITPY_ESP_FLASH_SIZE = 16MB -CIRCUITPY_ESP32_CAMERA = 0 +CIRCUITPY_ESPCAMERA = 0 diff --git a/ports/espressif/boards/m5stack_core_fire/mpconfigboard.mk b/ports/espressif/boards/m5stack_core_fire/mpconfigboard.mk index 7a66a977b1..82e462012c 100644 --- a/ports/espressif/boards/m5stack_core_fire/mpconfigboard.mk +++ b/ports/espressif/boards/m5stack_core_fire/mpconfigboard.mk @@ -6,4 +6,4 @@ IDF_TARGET = esp32 CIRCUITPY_ESP_FLASH_MODE = qio CIRCUITPY_ESP_FLASH_FREQ = 80m CIRCUITPY_ESP_FLASH_SIZE = 16MB -CIRCUITPY_ESP32_CAMERA = 0 +CIRCUITPY_ESPCAMERA = 0 diff --git a/ports/espressif/boards/m5stack_stick_c/mpconfigboard.mk b/ports/espressif/boards/m5stack_stick_c/mpconfigboard.mk index b82fb5ef74..5910605915 100644 --- a/ports/espressif/boards/m5stack_stick_c/mpconfigboard.mk +++ b/ports/espressif/boards/m5stack_stick_c/mpconfigboard.mk @@ -6,4 +6,4 @@ IDF_TARGET = esp32 CIRCUITPY_ESP_FLASH_MODE = qio CIRCUITPY_ESP_FLASH_FREQ = 80m CIRCUITPY_ESP_FLASH_SIZE = 4MB -CIRCUITPY_ESP32_CAMERA = 0 +CIRCUITPY_ESPCAMERA = 0 diff --git a/ports/espressif/boards/maker_badge/mpconfigboard.mk b/ports/espressif/boards/maker_badge/mpconfigboard.mk index 75d713d904..687f91ad60 100644 --- a/ports/espressif/boards/maker_badge/mpconfigboard.mk +++ b/ports/espressif/boards/maker_badge/mpconfigboard.mk @@ -3,7 +3,7 @@ USB_PID = 0x2030 USB_PRODUCT = "Maker badge" USB_MANUFACTURER = "Czech maker" -CIRCUITPY_ESP32_CAMERA = 0 +CIRCUITPY_ESPCAMERA = 0 CIRCUITPY_ESP_FLASH_MODE=dio CIRCUITPY_ESP_FLASH_FREQ=40m diff --git a/ports/espressif/boards/mixgo_ce_serial/mpconfigboard.mk b/ports/espressif/boards/mixgo_ce_serial/mpconfigboard.mk index 490675e467..1e4ed0b859 100644 --- a/ports/espressif/boards/mixgo_ce_serial/mpconfigboard.mk +++ b/ports/espressif/boards/mixgo_ce_serial/mpconfigboard.mk @@ -9,9 +9,9 @@ CIRCUITPY_ESP_FLASH_MODE = dio CIRCUITPY_ESP_FLASH_FREQ = 40m CIRCUITPY_ESP_FLASH_SIZE = 4MB -CIRCUITPY_ESP32_CAMERA = 0 +CIRCUITPY_ESPCAMERA = 0 FROZEN_MPY_DIRS += $(TOP)/frozen/Adafruit_CircuitPython_Requests FROZEN_MPY_DIRS += $(TOP)/frozen/Adafruit_CircuitPython_NeoPixel FROZEN_MPY_DIRS += $(TOP)/frozen/mixgo_cp_lib/mixgoce_lib -CIRCUITPY_ESP32_CAMERA = 0 +CIRCUITPY_ESPCAMERA = 0 diff --git a/ports/espressif/boards/mixgo_ce_udisk/mpconfigboard.mk b/ports/espressif/boards/mixgo_ce_udisk/mpconfigboard.mk index 5c6649ce6e..e9cd0c6d4a 100644 --- a/ports/espressif/boards/mixgo_ce_udisk/mpconfigboard.mk +++ b/ports/espressif/boards/mixgo_ce_udisk/mpconfigboard.mk @@ -9,9 +9,9 @@ CIRCUITPY_ESP_FLASH_MODE = dio CIRCUITPY_ESP_FLASH_FREQ = 40m CIRCUITPY_ESP_FLASH_SIZE = 4MB -CIRCUITPY_ESP32_CAMERA = 0 +CIRCUITPY_ESPCAMERA = 0 FROZEN_MPY_DIRS += $(TOP)/frozen/Adafruit_CircuitPython_Requests FROZEN_MPY_DIRS += $(TOP)/frozen/Adafruit_CircuitPython_NeoPixel FROZEN_MPY_DIRS += $(TOP)/frozen/mixgo_cp_lib/mixgoce_lib -CIRCUITPY_ESP32_CAMERA = 0 +CIRCUITPY_ESPCAMERA = 0 diff --git a/ports/espressif/boards/morpheans_morphesp-240/mpconfigboard.mk b/ports/espressif/boards/morpheans_morphesp-240/mpconfigboard.mk index abd2fc12e9..18dd435c53 100644 --- a/ports/espressif/boards/morpheans_morphesp-240/mpconfigboard.mk +++ b/ports/espressif/boards/morpheans_morphesp-240/mpconfigboard.mk @@ -8,4 +8,4 @@ IDF_TARGET = esp32s2 CIRCUITPY_ESP_FLASH_MODE = dio CIRCUITPY_ESP_FLASH_FREQ = 40m CIRCUITPY_ESP_FLASH_SIZE = 4MB -CIRCUITPY_ESP32_CAMERA = 0 +CIRCUITPY_ESPCAMERA = 0 diff --git a/ports/espressif/boards/muselab_nanoesp32_s2_wroom/mpconfigboard.mk b/ports/espressif/boards/muselab_nanoesp32_s2_wroom/mpconfigboard.mk index f2a622bc08..04fde1e562 100644 --- a/ports/espressif/boards/muselab_nanoesp32_s2_wroom/mpconfigboard.mk +++ b/ports/espressif/boards/muselab_nanoesp32_s2_wroom/mpconfigboard.mk @@ -8,4 +8,4 @@ IDF_TARGET = esp32s2 CIRCUITPY_ESP_FLASH_MODE = dio CIRCUITPY_ESP_FLASH_FREQ = 40m CIRCUITPY_ESP_FLASH_SIZE = 4MB -CIRCUITPY_ESP32_CAMERA = 0 +CIRCUITPY_ESPCAMERA = 0 diff --git a/ports/espressif/boards/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/common-hal/_bleio/CharacteristicBuffer.c b/ports/espressif/common-hal/_bleio/CharacteristicBuffer.c index 8edb40ca85..cfc6018708 100644 --- a/ports/espressif/common-hal/_bleio/CharacteristicBuffer.c +++ b/ports/espressif/common-hal/_bleio/CharacteristicBuffer.c @@ -52,7 +52,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); } } @@ -72,9 +84,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) { @@ -90,7 +104,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/esp32_camera/Camera.c b/ports/espressif/common-hal/espcamera/Camera.c similarity index 83% rename from ports/espressif/common-hal/esp32_camera/Camera.c rename to ports/espressif/common-hal/espcamera/Camera.c index 34ad1fbbb9..e3e5ef49f9 100644 --- a/ports/espressif/common-hal/esp32_camera/Camera.c +++ b/ports/espressif/common-hal/espcamera/Camera.c @@ -27,9 +27,9 @@ #include "py/mperrno.h" #include "py/runtime.h" -#include "bindings/esp32_camera/Camera.h" +#include "bindings/espcamera/Camera.h" #include "bindings/espidf/__init__.h" -#include "common-hal/esp32_camera/Camera.h" +#include "common-hal/espcamera/Camera.h" #include "shared-bindings/busio/I2C.h" #include "shared-bindings/microcontroller/Pin.h" #include "shared-bindings/util.h" @@ -38,10 +38,10 @@ #include "esp32-camera/driver/private_include/cam_hal.h" #if !CONFIG_SPIRAM -#error esp32_camera only works on boards configured with spiram, disable it in mpconfigboard.mk +#error espcamera only works on boards configured with spiram, disable it in mpconfigboard.mk #endif -static void i2c_lock(esp32_camera_camera_obj_t *self) { +static void i2c_lock(espcamera_camera_obj_t *self) { if (common_hal_busio_i2c_deinited(self->i2c)) { raise_deinited_error(); } @@ -50,7 +50,7 @@ static void i2c_lock(esp32_camera_camera_obj_t *self) { } } -static void i2c_unlock(esp32_camera_camera_obj_t *self) { +static void i2c_unlock(espcamera_camera_obj_t *self) { common_hal_busio_i2c_unlock(self->i2c); } @@ -60,8 +60,8 @@ static void maybe_claim_pin(const mcu_pin_obj_t *pin) { } } -void common_hal_esp32_camera_camera_construct( - esp32_camera_camera_obj_t *self, +void common_hal_espcamera_camera_construct( + espcamera_camera_obj_t *self, uint8_t data_pins[8], const mcu_pin_obj_t *external_clock_pin, const mcu_pin_obj_t *pixel_clock_pin, @@ -79,7 +79,7 @@ void common_hal_esp32_camera_camera_construct( if (common_hal_espidf_get_reserved_psram() == 0) { mp_raise_msg(&mp_type_MemoryError, translate( - "esp32_camera.Camera requires reserved PSRAM to be configured. " + "espcamera.Camera requires reserved PSRAM to be configured. " "See the documentation for instructions.")); } for (int i = 0; i < 8; i++) { @@ -140,8 +140,8 @@ void common_hal_esp32_camera_camera_construct( CHECK_ESP_RESULT(result); } -extern void common_hal_esp32_camera_camera_deinit(esp32_camera_camera_obj_t *self) { - if (common_hal_esp32_camera_camera_deinited(self)) { +extern void common_hal_espcamera_camera_deinit(espcamera_camera_obj_t *self) { + if (common_hal_espcamera_camera_deinited(self)) { return; } @@ -165,15 +165,15 @@ extern void common_hal_esp32_camera_camera_deinit(esp32_camera_camera_obj_t *sel self->camera_config.xclk_freq_hz = 0; } -bool common_hal_esp32_camera_camera_deinited(esp32_camera_camera_obj_t *self) { +bool common_hal_espcamera_camera_deinited(espcamera_camera_obj_t *self) { return !self->camera_config.xclk_freq_hz; } -bool common_hal_esp32_camera_camera_available(esp32_camera_camera_obj_t *self) { +bool common_hal_espcamera_camera_available(espcamera_camera_obj_t *self) { return esp_camera_fb_available(); } -camera_fb_t *common_hal_esp32_camera_camera_take(esp32_camera_camera_obj_t *self, int timeout_ms) { +camera_fb_t *common_hal_espcamera_camera_take(espcamera_camera_obj_t *self, int timeout_ms) { if (self->buffer_to_return) { esp_camera_fb_return(self->buffer_to_return); self->buffer_to_return = NULL; @@ -189,7 +189,7 @@ camera_fb_t *common_hal_esp32_camera_camera_take(esp32_camera_camera_obj_t *self SENSOR_GETSET(type, name, status.status_field_name, setter_function_name) #define SENSOR_GET(type, name, status_field_name, setter_function_name) \ - type common_hal_esp32_camera_camera_get_##name(esp32_camera_camera_obj_t * self) { \ + type common_hal_espcamera_camera_get_##name(espcamera_camera_obj_t * self) { \ i2c_lock(self); \ sensor_t *sensor = esp_camera_sensor_get(); \ i2c_unlock(self); \ @@ -200,7 +200,7 @@ camera_fb_t *common_hal_esp32_camera_camera_take(esp32_camera_camera_obj_t *self } #define SENSOR_SET(type, name, setter_function_name) \ - void common_hal_esp32_camera_camera_set_##name(esp32_camera_camera_obj_t * self, type value) { \ + void common_hal_espcamera_camera_set_##name(espcamera_camera_obj_t * self, type value) { \ i2c_lock(self); \ sensor_t *sensor = esp_camera_sensor_get(); \ i2c_unlock(self); \ @@ -212,15 +212,15 @@ camera_fb_t *common_hal_esp32_camera_camera_take(esp32_camera_camera_obj_t *self } \ } -pixformat_t common_hal_esp32_camera_camera_get_pixel_format(esp32_camera_camera_obj_t *self) { +pixformat_t common_hal_espcamera_camera_get_pixel_format(espcamera_camera_obj_t *self) { return self->camera_config.pixel_format; } -framesize_t common_hal_esp32_camera_camera_get_frame_size(esp32_camera_camera_obj_t *self) { +framesize_t common_hal_espcamera_camera_get_frame_size(espcamera_camera_obj_t *self) { return self->camera_config.frame_size; } -void common_hal_esp32_camera_camera_reconfigure(esp32_camera_camera_obj_t *self, framesize_t frame_size, pixformat_t pixel_format, camera_grab_mode_t grab_mode, mp_int_t framebuffer_count) { +void common_hal_espcamera_camera_reconfigure(espcamera_camera_obj_t *self, framesize_t frame_size, pixformat_t pixel_format, camera_grab_mode_t grab_mode, mp_int_t framebuffer_count) { sensor_t *sensor = esp_camera_sensor_get(); camera_sensor_info_t *sensor_info = esp_camera_sensor_get_info(&sensor->id); @@ -272,46 +272,46 @@ SENSOR_STATUS_GETSET(bool, wpc, wpc, set_wpc); SENSOR_STATUS_GETSET(bool, raw_gma, raw_gma, set_raw_gma); SENSOR_STATUS_GETSET(bool, lenc, lenc, set_lenc); -const char *common_hal_esp32_camera_camera_get_sensor_name(esp32_camera_camera_obj_t *self) { +const char *common_hal_espcamera_camera_get_sensor_name(espcamera_camera_obj_t *self) { sensor_t *sensor = esp_camera_sensor_get(); camera_sensor_info_t *sensor_info = esp_camera_sensor_get_info(&sensor->id); return sensor_info->name; } -const bool common_hal_esp32_camera_camera_get_supports_jpeg(esp32_camera_camera_obj_t *self) { +const bool common_hal_espcamera_camera_get_supports_jpeg(espcamera_camera_obj_t *self) { sensor_t *sensor = esp_camera_sensor_get(); camera_sensor_info_t *sensor_info = esp_camera_sensor_get_info(&sensor->id); return sensor_info->support_jpeg; } -const framesize_t common_hal_esp32_camera_camera_get_max_frame_size(esp32_camera_camera_obj_t *self) { +const framesize_t common_hal_espcamera_camera_get_max_frame_size(espcamera_camera_obj_t *self) { sensor_t *sensor = esp_camera_sensor_get(); camera_sensor_info_t *sensor_info = esp_camera_sensor_get_info(&sensor->id); return sensor_info->max_size; } -const int common_hal_esp32_camera_camera_get_address(esp32_camera_camera_obj_t *self) { +const int common_hal_espcamera_camera_get_address(espcamera_camera_obj_t *self) { sensor_t *sensor = esp_camera_sensor_get(); camera_sensor_info_t *sensor_info = esp_camera_sensor_get_info(&sensor->id); return sensor_info->sccb_addr; } -const int common_hal_esp32_camera_camera_get_width(esp32_camera_camera_obj_t *self) { +const int common_hal_espcamera_camera_get_width(espcamera_camera_obj_t *self) { sensor_t *sensor = esp_camera_sensor_get(); framesize_t framesize = sensor->status.framesize; return resolution[framesize].width; } -const int common_hal_esp32_camera_camera_get_height(esp32_camera_camera_obj_t *self) { +const int common_hal_espcamera_camera_get_height(espcamera_camera_obj_t *self) { sensor_t *sensor = esp_camera_sensor_get(); framesize_t framesize = sensor->status.framesize; return resolution[framesize].height; } -const camera_grab_mode_t common_hal_esp32_camera_camera_get_grab_mode(esp32_camera_camera_obj_t *self) { +const camera_grab_mode_t common_hal_espcamera_camera_get_grab_mode(espcamera_camera_obj_t *self) { return self->camera_config.grab_mode; } -const int common_hal_esp32_camera_camera_get_framebuffer_count(esp32_camera_camera_obj_t *self) { +const int common_hal_espcamera_camera_get_framebuffer_count(espcamera_camera_obj_t *self) { return self->camera_config.fb_count; } diff --git a/ports/espressif/common-hal/esp32_camera/Camera.h b/ports/espressif/common-hal/espcamera/Camera.h similarity index 96% rename from ports/espressif/common-hal/esp32_camera/Camera.h rename to ports/espressif/common-hal/espcamera/Camera.h index 4f34fa54cd..007686a523 100644 --- a/ports/espressif/common-hal/esp32_camera/Camera.h +++ b/ports/espressif/common-hal/espcamera/Camera.h @@ -31,10 +31,10 @@ #include "shared-bindings/pwmio/PWMOut.h" #include "common-hal/busio/I2C.h" -typedef struct esp32_camera_camera_obj { +typedef struct espcamera_camera_obj { mp_obj_base_t base; camera_config_t camera_config; camera_fb_t *buffer_to_return; pwmio_pwmout_obj_t pwm; busio_i2c_obj_t *i2c; -} esp32_camera_obj_t; +} espcamera_obj_t; diff --git a/ports/espressif/common-hal/espulp/ULP.c b/ports/espressif/common-hal/espulp/ULP.c index 4d30a94dfc..3350f6d45c 100644 --- a/ports/espressif/common-hal/espulp/ULP.c +++ b/ports/espressif/common-hal/espulp/ULP.c @@ -31,7 +31,10 @@ #include "shared-bindings/microcontroller/Pin.h" -#if defined(CONFIG_IDF_TARGET_ESP32S2) +#if defined(CONFIG_IDF_TARGET_ESP32) +#include "esp32/ulp.h" +#define ULP_COPROC_RESERVE_MEM (CONFIG_ESP32_ULP_COPROC_RESERVE_MEM) +#elif defined(CONFIG_IDF_TARGET_ESP32S2) #include "esp32s2/ulp.h" #include "esp32s2/ulp_riscv.h" #define ULP_COPROC_RESERVE_MEM (CONFIG_ESP32S2_ULP_COPROC_RESERVE_MEM) @@ -56,7 +59,14 @@ void common_hal_espulp_ulp_run(espulp_ulp_obj_t *self, uint32_t *program, size_t if (length > ULP_COPROC_RESERVE_MEM) { mp_raise_ValueError(translate("Program too long")); } - if (GET_PERI_REG_MASK(RTC_CNTL_ULP_CP_TIMER_REG, RTC_CNTL_ULP_CP_SLP_TIMER_EN)) { + + if ( + #ifdef CONFIG_IDF_TARGET_ESP32 + GET_PERI_REG_MASK(RTC_CNTL_STATE0_REG, RTC_CNTL_ULP_CP_SLP_TIMER_EN) + #else + GET_PERI_REG_MASK(RTC_CNTL_ULP_CP_TIMER_REG, RTC_CNTL_ULP_CP_SLP_TIMER_EN) + #endif + ) { mp_raise_RuntimeError(translate("Already running")); } @@ -78,13 +88,29 @@ void common_hal_espulp_ulp_run(espulp_ulp_obj_t *self, uint32_t *program, size_t } pins_used = pin_mask; - - ulp_riscv_load_binary((const uint8_t *)program, length); ulp_set_wakeup_period(0, 20000); - ulp_riscv_run(); + + switch (self->arch) { + case FSM: + ulp_load_binary(0, (const uint8_t *)program, length); + ulp_run(0); + break; + case RISCV: + #ifndef CONFIG_IDF_TARGET_ESP32 + ulp_riscv_load_binary((const uint8_t *)program, length); + ulp_riscv_run(); + break; + #endif + default: + mp_raise_NotImplementedError(NULL); + break; + } } void common_hal_espulp_ulp_halt(espulp_ulp_obj_t *self) { + #ifdef CONFIG_IDF_TARGET_ESP32 + mp_raise_NotImplementedError(NULL); + #else // To-do idf v5.0: use following functions // ulp_riscv_timer_stop(); // ulp_riscv_halt(); @@ -97,6 +123,7 @@ void common_hal_espulp_ulp_halt(espulp_ulp_obj_t *self) { // resets the processor SET_PERI_REG_MASK(RTC_CNTL_COCPU_CTRL_REG, RTC_CNTL_COCPU_SHUT_RESET_EN); + #endif // Release pins we were using. for (uint8_t i = 0; i < 32; i++) { @@ -106,13 +133,21 @@ void common_hal_espulp_ulp_halt(espulp_ulp_obj_t *self) { } } -void common_hal_espulp_ulp_construct(espulp_ulp_obj_t *self) { +void common_hal_espulp_ulp_construct(espulp_ulp_obj_t *self, espulp_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; } diff --git a/ports/espressif/common-hal/espulp/ULP.h b/ports/espressif/common-hal/espulp/ULP.h index f73b21d123..360dd0c9fd 100644 --- a/ports/espressif/common-hal/espulp/ULP.h +++ b/ports/espressif/common-hal/espulp/ULP.h @@ -27,8 +27,10 @@ #pragma once #include "py/obj.h" +#include "bindings/espulp/Architecture.h" typedef struct { mp_obj_base_t base; + espulp_architecture_t arch; bool inited; } espulp_ulp_obj_t; diff --git a/ports/espressif/common-hal/espulp/ULPAlarm.c b/ports/espressif/common-hal/espulp/ULPAlarm.c index ec1fb8bc45..3717d2ab71 100644 --- a/ports/espressif/common-hal/espulp/ULPAlarm.c +++ b/ports/espressif/common-hal/espulp/ULPAlarm.c @@ -37,8 +37,8 @@ static volatile bool woke_up = false; static bool alarm_set = false; -void common_hal_espulp_ulpalarm_construct(espulp_ulpalarm_obj_t *self) { - +void common_hal_espulp_ulpalarm_construct(espulp_ulpalarm_obj_t *self, espulp_ulp_obj_t *ulp) { + self->ulp = ulp; } mp_obj_t espulp_ulpalarm_find_triggered_alarm(const size_t n_alarms, const mp_obj_t *alarms) { @@ -52,7 +52,6 @@ mp_obj_t espulp_ulpalarm_find_triggered_alarm(const size_t n_alarms, const mp_ob mp_obj_t espulp_ulpalarm_record_wake_alarm(void) { espulp_ulpalarm_obj_t *const alarm = &alarm_wake_alarm.ulp_alarm; - alarm->base.type = &espulp_ulpalarm_type; return alarm; } @@ -81,8 +80,25 @@ void espulp_ulpalarm_set_alarm(const bool deep_sleep, const size_t n_alarms, con } // enable ulp interrupt - rtc_isr_register(&ulp_interrupt, NULL, RTC_CNTL_COCPU_INT_ST); - REG_SET_BIT(RTC_CNTL_INT_ENA_REG, RTC_CNTL_COCPU_INT_ENA); + switch (alarm->ulp->arch) { + case FSM: + #ifdef CONFIG_IDF_TARGET_ESP32 + rtc_isr_register(&ulp_interrupt, NULL, RTC_CNTL_ULP_CP_INT_RAW); + #else + rtc_isr_register(&ulp_interrupt, NULL, RTC_CNTL_ULP_CP_INT_ST); + #endif + REG_SET_BIT(RTC_CNTL_INT_ENA_REG, RTC_CNTL_ULP_CP_INT_ENA); + break; + case RISCV: + #ifndef CONFIG_IDF_TARGET_ESP32 + rtc_isr_register(&ulp_interrupt, NULL, RTC_CNTL_COCPU_INT_ST); + REG_SET_BIT(RTC_CNTL_INT_ENA_REG, RTC_CNTL_COCPU_INT_ENA); + break; + #endif + default: + mp_raise_NotImplementedError(NULL); + break; + } alarm_set = true; } @@ -91,9 +107,13 @@ void espulp_ulpalarm_prepare_for_deep_sleep(void) { if (!alarm_set) { return; } + // disable ulp interrupt rtc_isr_deregister(&ulp_interrupt, NULL); + REG_CLR_BIT(RTC_CNTL_INT_ENA_REG, RTC_CNTL_ULP_CP_INT_ENA); + #ifndef CONFIG_IDF_TARGET_ESP32 REG_CLR_BIT(RTC_CNTL_INT_ENA_REG, RTC_CNTL_COCPU_INT_ENA); + #endif // enable ulp wakeup esp_sleep_enable_ulp_wakeup(); diff --git a/ports/espressif/common-hal/espulp/ULPAlarm.h b/ports/espressif/common-hal/espulp/ULPAlarm.h index 5d2610c6a3..99d21180fd 100644 --- a/ports/espressif/common-hal/espulp/ULPAlarm.h +++ b/ports/espressif/common-hal/espulp/ULPAlarm.h @@ -29,8 +29,11 @@ #include "py/obj.h" #include "py/runtime.h" +#include "bindings/espulp/ULP.h" + typedef struct { mp_obj_base_t base; + espulp_ulp_obj_t *ulp; } espulp_ulpalarm_obj_t; mp_obj_t espulp_ulpalarm_find_triggered_alarm(const size_t n_alarms, const mp_obj_t *alarms); diff --git a/ports/espressif/esp-idf b/ports/espressif/esp-idf index 8d0f1abce7..630c2724fc 160000 --- a/ports/espressif/esp-idf +++ b/ports/espressif/esp-idf @@ -1 +1 @@ -Subproject commit 8d0f1abce769ad4a212c1bb0337999cacd7ee83d +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-esp32.defaults b/ports/espressif/esp-idf-config/sdkconfig-esp32.defaults index 483e0f9b87..b6c5a938b1 100644 --- a/ports/espressif/esp-idf-config/sdkconfig-esp32.defaults +++ b/ports/espressif/esp-idf-config/sdkconfig-esp32.defaults @@ -313,8 +313,8 @@ CONFIG_SPIRAM_SPIWP_SD3_PIN=7 # CONFIG_ESP32_TRAX is not set CONFIG_ESP32_TRACEMEM_RESERVE_DRAM=0x0 -# CONFIG_ESP32_ULP_COPROC_ENABLED is not set -CONFIG_ESP32_ULP_COPROC_RESERVE_MEM=0 +CONFIG_ESP32_ULP_COPROC_ENABLED=y +CONFIG_ESP32_ULP_COPROC_RESERVE_MEM=4080 CONFIG_ESP32_DEBUG_OCDAWARE=y CONFIG_ESP32_BROWNOUT_DET=y CONFIG_ESP32_BROWNOUT_DET_LVL_SEL_0=y diff --git a/ports/espressif/mpconfigport.mk b/ports/espressif/mpconfigport.mk index 035fa75278..6cf91a4912 100644 --- a/ports/espressif/mpconfigport.mk +++ b/ports/espressif/mpconfigport.mk @@ -24,13 +24,15 @@ CIRCUITPY_BLEIO_HCI = 0 CIRCUITPY_CANIO ?= 1 CIRCUITPY_COUNTIO ?= 1 CIRCUITPY_DUALBANK ?= 1 -CIRCUITPY_ESP32_CAMERA ?= 1 +CIRCUITPY_ESPCAMERA ?= 1 CIRCUITPY_ESPIDF ?= 1 +CIRCUITPY_ESPULP ?= 1 CIRCUITPY_FRAMEBUFFERIO ?= 1 CIRCUITPY_FREQUENCYIO ?= 1 CIRCUITPY_HASHLIB ?= 1 CIRCUITPY_I2CTARGET ?= 1 CIRCUITPY_IMAGECAPTURE = 0 +CIRCUITPY_MEMORYMAP ?= 1 CIRCUITPY_NVM ?= 1 CIRCUITPY_PS2IO ?= 1 CIRCUITPY_RGBMATRIX ?= 1 @@ -53,8 +55,10 @@ else ifeq ($(IDF_TARGET),esp32c3) CIRCUITPY_ALARM = 0 CIRCUITPY_AUDIOBUSIO = 0 CIRCUITPY_COUNTIO = 0 -CIRCUITPY_ESP32_CAMERA = 0 +CIRCUITPY_ESPCAMERA = 0 +CIRCUITPY_ESPULP = 0 CIRCUITPY_FREQUENCYIO = 0 +CIRCUITPY_MEMORYMAP = 0 CIRCUITPY_PARALLELDISPLAY = 0 CIRCUITPY_ROTARYIO = 0 CIRCUITPY_TOUCHIO ?= 1 @@ -65,14 +69,10 @@ CIRCUITPY_USB = 0 else ifeq ($(IDF_TARGET),esp32s2) # Modules CIRCUITPY_BLEIO = 0 -CIRCUITPY_ESPULP = 1 -CIRCUITPY_MEMORYMAP = 1 else ifeq ($(IDF_TARGET),esp32s3) # Modules CIRCUITPY_PARALLELDISPLAY = 0 -CIRCUITPY_ESPULP = 1 -CIRCUITPY_MEMORYMAP = 1 endif # No room for dualbank on boards with 2MB flash @@ -82,8 +82,8 @@ endif # Modules dependent on other modules CIRCUITPY_ESPNOW ?= $(CIRCUITPY_WIFI) -CIRCUITPY_GIFIO ?= $(CIRCUITPY_ESP32_CAMERA) -CIRCUITPY_QRIO ?= $(CIRCUITPY_ESP32_CAMERA) +CIRCUITPY_GIFIO ?= $(CIRCUITPY_ESPCAMERA) +CIRCUITPY_QRIO ?= $(CIRCUITPY_ESPCAMERA) # Features dependent on other features ifneq ($(CIRCUITPY_USB),0) diff --git a/ports/espressif/supervisor/port.c b/ports/espressif/supervisor/port.c index be33b87cca..7e1a73bed8 100644 --- a/ports/espressif/supervisor/port.c +++ b/ports/espressif/supervisor/port.c @@ -79,7 +79,7 @@ #include "shared-bindings/_bleio/__init__.h" #endif -#if CIRCUITPY_ESP32_CAMERA +#if CIRCUITPY_ESPCAMERA #include "esp_camera.h" #endif @@ -342,7 +342,7 @@ safe_mode_t port_init(void) { void reset_port(void) { // TODO deinit for esp32-camera - #if CIRCUITPY_ESP32_CAMERA + #if CIRCUITPY_ESPCAMERA esp_camera_deinit(); #endif diff --git a/ports/mimxrt10xx/Makefile b/ports/mimxrt10xx/Makefile index 080a65e8fe..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 \ 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/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..7bf853fb30 100644 --- a/ports/nrf/common-hal/microcontroller/__init__.c +++ b/ports/nrf/common-hal/microcontroller/__init__.c @@ -82,10 +82,10 @@ 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); diff --git a/ports/raspberrypi/bindings/rp2pio/StateMachine.c b/ports/raspberrypi/bindings/rp2pio/StateMachine.c index 5301086709..ada9f46020 100644 --- a/ports/raspberrypi/bindings/rp2pio/StateMachine.c +++ b/ports/raspberrypi/bindings/rp2pio/StateMachine.c @@ -94,7 +94,6 @@ //| wrap_target: int = 0, //| wrap: int = -1, //| ) -> None: -//| //| """Construct a StateMachine object on the given pins with the given program. //| //| :param ReadableBuffer program: the program to run with the state machine @@ -659,7 +658,8 @@ MP_DEFINE_CONST_FUN_OBJ_KW(rp2pio_statemachine_readinto_obj, 2, rp2pio_statemach //| :param int in_start: Start of the slice of ``buffer_in`` to read into: ``buffer_in[in_start:in_end]`` //| :param int in_end: End of the slice; this index is not included. Defaults to ``len(buffer_in)`` //| :param bool swap_out: For 2- and 4-byte elements, swap (reverse) the byte order for the buffer being transmitted (written) -//| :param bool swap_in: For 2- and 4-rx elements, swap (reverse) the byte order for the buffer being received (read)""" +//| :param bool swap_in: For 2- and 4-rx elements, swap (reverse) the byte order for the buffer being received (read) +//| """ //| ... STATIC mp_obj_t rp2pio_statemachine_write_readinto(size_t n_args, const mp_obj_t *pos_args, mp_map_t *kw_args) { diff --git a/ports/raspberrypi/bindings/rp2pio/__init__.c b/ports/raspberrypi/bindings/rp2pio/__init__.c index ce3be4aa52..193a3a2025 100644 --- a/ports/raspberrypi/bindings/rp2pio/__init__.c +++ b/ports/raspberrypi/bindings/rp2pio/__init__.c @@ -38,6 +38,7 @@ //| Learn guide `_. //| //| """ +//| //| def pins_are_sequential(pins: List[microcontroller.Pin]) -> bool: //| """Return True if the pins have sequential GPIO numbers, False otherwise""" diff --git a/ports/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/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/stm/boards/swan_r5/tests/board_voltage.py b/ports/stm/boards/swan_r5/tests/board_voltage.py index 6191067fde..2cb0ad4cc0 100644 --- a/ports/stm/boards/swan_r5/tests/board_voltage.py +++ b/ports/stm/boards/swan_r5/tests/board_voltage.py @@ -44,6 +44,7 @@ PASS = "PASS" FAIL = "FAIL" NA = "N/A" + # Determine if given value is a number def _is_number(val): try: @@ -61,7 +62,6 @@ def _deinit_pins(gpios): # Toggle IO pins while waiting for answer def _toggle_wait(pin_gpios): - timestamp = time.monotonic() led_state = False failed = [] @@ -96,7 +96,6 @@ def buildPin(pin): def run_test(pins): - """ Toggles all available GPIO on and off repeatedly. @@ -114,7 +113,6 @@ def run_test(pins): gpio_pins = analog_pins + digital_pins if gpio_pins: - # Print out the LEDs found print("GPIO pins found:", end=" ") for pin in gpio_pins: diff --git a/ports/stm/tools/parse_af_csv.py b/ports/stm/tools/parse_af_csv.py index 3e48d4145d..e3188e2e24 100644 --- a/ports/stm/tools/parse_af_csv.py +++ b/ports/stm/tools/parse_af_csv.py @@ -31,6 +31,7 @@ import sys # # See examples/stm32f405.csv for example formatting. + # Most peripherals (SPI, I2C) output 3 values: # peripheral index, alt function, pin string def evaluate_periph(inper, inlist, periph, subtype, altfn, pin): diff --git a/py/circuitpy_mpconfig.mk b/py/circuitpy_mpconfig.mk index 03ff0f9d95..0c69bce570 100644 --- a/py/circuitpy_mpconfig.mk +++ b/py/circuitpy_mpconfig.mk @@ -221,9 +221,8 @@ CFLAGS += -DCIRCUITPY_OS_GETENV=$(CIRCUITPY_OS_GETENV) CIRCUITPY_ERRNO ?= $(CIRCUITPY_FULL_BUILD) CFLAGS += -DCIRCUITPY_ERRNO=$(CIRCUITPY_ERRNO) -# CIRCUITPY_ESPIDF and CIRCUITPY_ESPULP is handled in the espressif tree. -# Only for ESP32S chips. -# Assume not a ESP build. +# Espressif specific modules. +# Assume not an Espressif build. CIRCUITPY_ESPIDF ?= 0 CFLAGS += -DCIRCUITPY_ESPIDF=$(CIRCUITPY_ESPIDF) @@ -233,8 +232,8 @@ CFLAGS += -DCIRCUITPY_ESPNOW=$(CIRCUITPY_ESPNOW) CIRCUITPY_ESPULP ?= 0 CFLAGS += -DCIRCUITPY_ESPULP=$(CIRCUITPY_ESPULP) -CIRCUITPY_ESP32_CAMERA ?= 0 -CFLAGS += -DCIRCUITPY_ESP32_CAMERA=$(CIRCUITPY_ESP32_CAMERA) +CIRCUITPY_ESPCAMERA ?= 0 +CFLAGS += -DCIRCUITPY_ESPCAMERA=$(CIRCUITPY_ESPCAMERA) CIRCUITPY__EVE ?= 0 CFLAGS += -DCIRCUITPY__EVE=$(CIRCUITPY__EVE) @@ -397,6 +396,11 @@ CFLAGS += -DCIRCUITPY_SETTABLE_PROCESSOR_FREQUENCY=$(CIRCUITPY_SETTABLE_PROCESSO CIRCUITPY_SHARPDISPLAY ?= $(CIRCUITPY_FRAMEBUFFERIO) CFLAGS += -DCIRCUITPY_SHARPDISPLAY=$(CIRCUITPY_SHARPDISPLAY) +# Disable the safe mode blink at boot. Speeds up boot time, but makes it +# impossible to enter safe mode by pressing buttons on boot. +CIRCUITPY_SKIP_SAFE_MODE_WAIT ?= 0 +CFLAGS += -DCIRCUITPY_SKIP_SAFE_MODE_WAIT=$(CIRCUITPY_SKIP_SAFE_MODE_WAIT) + CIRCUITPY_SOCKETPOOL ?= $(CIRCUITPY_WIFI) CFLAGS += -DCIRCUITPY_SOCKETPOOL=$(CIRCUITPY_SOCKETPOOL) diff --git a/py/genlast.py b/py/genlast.py index 460271af81..1c5089fdfc 100644 --- a/py/genlast.py +++ b/py/genlast.py @@ -59,7 +59,6 @@ def maybe_preprocess(command, output_dir, fn): if __name__ == "__main__": - idx1 = sys.argv.index("--") idx2 = sys.argv.index("--", idx1 + 1) output_dir = sys.argv[1] diff --git a/py/makeqstrdata.py b/py/makeqstrdata.py index 2abbdedefd..d16bb0d09a 100644 --- a/py/makeqstrdata.py +++ b/py/makeqstrdata.py @@ -249,6 +249,7 @@ static_qstr_list = [ "zip", ] + # this must match the equivalent function in qstr.c def compute_hash(qstr, bytes_hash): hash = 5381 diff --git a/py/maketranslationdata.py b/py/maketranslationdata.py index fbf396c73f..a07f70265c 100644 --- a/py/maketranslationdata.py +++ b/py/maketranslationdata.py @@ -84,6 +84,7 @@ C_ESCAPES = { '"': '\\"', } + # this must match the equivalent function in qstr.c def compute_hash(qstr, bytes_hash): hash = 5381 @@ -277,7 +278,7 @@ def compute_huffman_coding(translation_name, translations, f): counter = collections.Counter() for t in texts: - for (found, word) in extractor.iter_words(t): + for found, word in extractor.iter_words(t): if not found: for substr in iter_substrings(word, minlen=2, maxlen=11): counter[substr] += 1 diff --git a/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/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 59c6c354a4..f34d3af5c5 100644 --- a/shared-bindings/_bleio/__init__.c +++ b/shared-bindings/_bleio/__init__.c @@ -58,6 +58,7 @@ //| adapter: Adapter //| """BLE Adapter used to manage device discovery and connections. //| This object is the sole instance of `_bleio.Adapter`.""" +//| //| class BluetoothError(Exception): //| """Catchall exception for Bluetooth related errors.""" diff --git a/shared-bindings/_eve/__init__.c b/shared-bindings/_eve/__init__.c index bd0cf9b4ea..5975ee1ca1 100644 --- a/shared-bindings/_eve/__init__.c +++ b/shared-bindings/_eve/__init__.c @@ -93,7 +93,8 @@ STATIC MP_DEFINE_CONST_FUN_OBJ_2(cc_obj, _cc); //| :param int func: specifies the test function, one of ``NEVER``, ``LESS``, ``LEQUAL``, ``GREATER``, ``GEQUAL``, ``EQUAL``, ``NOTEQUAL``, or ``ALWAYS``. Range 0-7. The initial value is ALWAYS(7) //| :param int ref: specifies the reference value for the alpha test. Range 0-255. The initial value is 0 //| -//| These values are part of the graphics context and are saved and restored by :meth:`SaveContext` and :meth:`RestoreContext`.""" +//| These values are part of the graphics context and are saved and restored by :meth:`SaveContext` and :meth:`RestoreContext`. +//| """ //| ... STATIC mp_obj_t _alphafunc(mp_obj_t self, mp_obj_t a0, mp_obj_t a1) { @@ -109,7 +110,8 @@ STATIC MP_DEFINE_CONST_FUN_OBJ_3(alphafunc_obj, _alphafunc); //| //| :param int prim: graphics primitive. //| -//| Valid primitives are ``BITMAPS``, ``POINTS``, ``LINES``, ``LINE_STRIP``, ``EDGE_STRIP_R``, ``EDGE_STRIP_L``, ``EDGE_STRIP_A``, ``EDGE_STRIP_B`` and ``RECTS``.""" +//| Valid primitives are ``BITMAPS``, ``POINTS``, ``LINES``, ``LINE_STRIP``, ``EDGE_STRIP_R``, ``EDGE_STRIP_L``, ``EDGE_STRIP_A``, ``EDGE_STRIP_B`` and ``RECTS``. +//| """ //| ... STATIC mp_obj_t _begin(mp_obj_t self, mp_obj_t a0) { @@ -137,7 +139,8 @@ STATIC MP_DEFINE_CONST_FUN_OBJ_2(bitmapextformat_obj, _bitmapextformat); //| //| :param int handle: bitmap handle. Range 0-31. The initial value is 0 //| -//| This value is part of the graphics context and is saved and restored by :meth:`SaveContext` and :meth:`RestoreContext`.""" +//| This value is part of the graphics context and is saved and restored by :meth:`SaveContext` and :meth:`RestoreContext`. +//| """ //| ... STATIC mp_obj_t _bitmaphandle(mp_obj_t self, mp_obj_t a0) { @@ -218,7 +221,8 @@ STATIC MP_DEFINE_CONST_FUN_OBJ_VAR_BETWEEN(bitmapsize_obj, 6, 6, _bitmapsize); //| def BitmapSource(self, addr: int) -> None: //| """Set the source address for bitmap graphics //| -//| :param int addr: Bitmap start address, pixel-aligned. May be in SRAM or flash. Range 0-16777215""" +//| :param int addr: Bitmap start address, pixel-aligned. May be in SRAM or flash. Range 0-16777215 +//| """ //| ... STATIC mp_obj_t _bitmapsource(mp_obj_t self, mp_obj_t a0) { @@ -255,7 +259,8 @@ STATIC MP_DEFINE_CONST_FUN_OBJ_VAR_BETWEEN(bitmapswizzle_obj, 5, 5, _bitmapswizz //| //| The initial value is **p** = 0, **v** = 256. This represents the value 1.0. //| -//| These values are part of the graphics context and are saved and restored by :meth:`SaveContext` and :meth:`RestoreContext`.""" +//| These values are part of the graphics context and are saved and restored by :meth:`SaveContext` and :meth:`RestoreContext`. +//| """ //| ... STATIC mp_obj_t _bitmaptransforma(mp_obj_t self, mp_obj_t a0, mp_obj_t a1) { @@ -274,7 +279,8 @@ STATIC MP_DEFINE_CONST_FUN_OBJ_3(bitmaptransforma_obj, _bitmaptransforma); //| //| The initial value is **p** = 0, **v** = 0. This represents the value 0.0. //| -//| These values are part of the graphics context and are saved and restored by :meth:`SaveContext` and :meth:`RestoreContext`.""" +//| These values are part of the graphics context and are saved and restored by :meth:`SaveContext` and :meth:`RestoreContext`. +//| """ //| ... STATIC mp_obj_t _bitmaptransformb(mp_obj_t self, mp_obj_t a0, mp_obj_t a1) { @@ -290,7 +296,8 @@ STATIC MP_DEFINE_CONST_FUN_OBJ_3(bitmaptransformb_obj, _bitmaptransformb); //| //| :param int v: The :math:`c` component of the bitmap transform matrix, in signed 15.8 bit fixed-point form. Range 0-16777215. The initial value is 0 //| -//| This value is part of the graphics context and is saved and restored by :meth:`SaveContext` and :meth:`RestoreContext`.""" +//| This value is part of the graphics context and is saved and restored by :meth:`SaveContext` and :meth:`RestoreContext`. +//| """ //| ... STATIC mp_obj_t _bitmaptransformc(mp_obj_t self, mp_obj_t a0) { @@ -308,7 +315,8 @@ STATIC MP_DEFINE_CONST_FUN_OBJ_2(bitmaptransformc_obj, _bitmaptransformc); //| //| The initial value is **p** = 0, **v** = 0. This represents the value 0.0. //| -//| These values are part of the graphics context and are saved and restored by :meth:`SaveContext` and :meth:`RestoreContext`.""" +//| These values are part of the graphics context and are saved and restored by :meth:`SaveContext` and :meth:`RestoreContext`. +//| """ //| ... STATIC mp_obj_t _bitmaptransformd(mp_obj_t self, mp_obj_t a0, mp_obj_t a1) { @@ -327,7 +335,8 @@ STATIC MP_DEFINE_CONST_FUN_OBJ_3(bitmaptransformd_obj, _bitmaptransformd); //| //| The initial value is **p** = 0, **v** = 256. This represents the value 1.0. //| -//| These values are part of the graphics context and are saved and restored by :meth:`SaveContext` and :meth:`RestoreContext`.""" +//| These values are part of the graphics context and are saved and restored by :meth:`SaveContext` and :meth:`RestoreContext`. +//| """ //| ... STATIC mp_obj_t _bitmaptransforme(mp_obj_t self, mp_obj_t a0, mp_obj_t a1) { @@ -343,7 +352,8 @@ STATIC MP_DEFINE_CONST_FUN_OBJ_3(bitmaptransforme_obj, _bitmaptransforme); //| //| :param int v: The :math:`f` component of the bitmap transform matrix, in signed 15.8 bit fixed-point form. Range 0-16777215. The initial value is 0 //| -//| This value is part of the graphics context and is saved and restored by :meth:`SaveContext` and :meth:`RestoreContext`.""" +//| This value is part of the graphics context and is saved and restored by :meth:`SaveContext` and :meth:`RestoreContext`. +//| """ //| ... STATIC mp_obj_t _bitmaptransformf(mp_obj_t self, mp_obj_t a0) { @@ -359,7 +369,8 @@ STATIC MP_DEFINE_CONST_FUN_OBJ_2(bitmaptransformf_obj, _bitmaptransformf); //| :param int src: specifies how the source blending factor is computed. One of ``ZERO``, ``ONE``, ``SRC_ALPHA``, ``DST_ALPHA``, ``ONE_MINUS_SRC_ALPHA`` or ``ONE_MINUS_DST_ALPHA``. Range 0-7. The initial value is SRC_ALPHA(2) //| :param int dst: specifies how the destination blending factor is computed, one of the same constants as **src**. Range 0-7. The initial value is ONE_MINUS_SRC_ALPHA(4) //| -//| These values are part of the graphics context and are saved and restored by :meth:`SaveContext` and :meth:`RestoreContext`.""" +//| These values are part of the graphics context and are saved and restored by :meth:`SaveContext` and :meth:`RestoreContext`. +//| """ //| ... STATIC mp_obj_t _blendfunc(mp_obj_t self, mp_obj_t a0, mp_obj_t a1) { @@ -388,7 +399,8 @@ STATIC MP_DEFINE_CONST_FUN_OBJ_2(call_obj, _call); //| //| :param int cell: bitmap cell number. Range 0-127. The initial value is 0 //| -//| This value is part of the graphics context and is saved and restored by :meth:`SaveContext` and :meth:`RestoreContext`.""" +//| This value is part of the graphics context and is saved and restored by :meth:`SaveContext` and :meth:`RestoreContext`. +//| """ //| ... STATIC mp_obj_t _cell(mp_obj_t self, mp_obj_t a0) { @@ -403,7 +415,8 @@ STATIC MP_DEFINE_CONST_FUN_OBJ_2(cell_obj, _cell); //| //| :param int alpha: alpha value used when the color buffer is cleared. Range 0-255. The initial value is 0 //| -//| This value is part of the graphics context and is saved and restored by :meth:`SaveContext` and :meth:`RestoreContext`.""" +//| This value is part of the graphics context and is saved and restored by :meth:`SaveContext` and :meth:`RestoreContext`. +//| """ //| ... STATIC mp_obj_t _clearcolora(mp_obj_t self, mp_obj_t a0) { @@ -420,7 +433,8 @@ STATIC MP_DEFINE_CONST_FUN_OBJ_2(clearcolora_obj, _clearcolora); //| :param int green: green value used when the color buffer is cleared. Range 0-255. The initial value is 0 //| :param int blue: blue value used when the color buffer is cleared. Range 0-255. The initial value is 0 //| -//| These values are part of the graphics context and are saved and restored by :meth:`SaveContext` and :meth:`RestoreContext`.""" +//| These values are part of the graphics context and are saved and restored by :meth:`SaveContext` and :meth:`RestoreContext`. +//| """ //| ... STATIC mp_obj_t _clearcolorrgb(size_t n_args, const mp_obj_t *args) { @@ -454,7 +468,8 @@ STATIC MP_DEFINE_CONST_FUN_OBJ_VAR_BETWEEN(clear_obj, 1, 4, _clear); //| //| :param int s: value used when the stencil buffer is cleared. Range 0-255. The initial value is 0 //| -//| This value is part of the graphics context and is saved and restored by :meth:`SaveContext` and :meth:`RestoreContext`.""" +//| This value is part of the graphics context and is saved and restored by :meth:`SaveContext` and :meth:`RestoreContext`. +//| """ //| ... STATIC mp_obj_t _clearstencil(mp_obj_t self, mp_obj_t a0) { @@ -469,7 +484,8 @@ STATIC MP_DEFINE_CONST_FUN_OBJ_2(clearstencil_obj, _clearstencil); //| //| :param int s: value used when the tag buffer is cleared. Range 0-255. The initial value is 0 //| -//| This value is part of the graphics context and is saved and restored by :meth:`SaveContext` and :meth:`RestoreContext`.""" +//| This value is part of the graphics context and is saved and restored by :meth:`SaveContext` and :meth:`RestoreContext`. +//| """ STATIC mp_obj_t _cleartag(mp_obj_t self, mp_obj_t a0) { uint32_t s = mp_obj_get_int_truncated(a0); @@ -483,7 +499,8 @@ STATIC MP_DEFINE_CONST_FUN_OBJ_2(cleartag_obj, _cleartag); //| //| :param int alpha: alpha for the current color. Range 0-255. The initial value is 255 //| -//| This value is part of the graphics context and is saved and restored by :meth:`SaveContext` and :meth:`RestoreContext`.""" +//| This value is part of the graphics context and is saved and restored by :meth:`SaveContext` and :meth:`RestoreContext`. +//| """ //| ... STATIC mp_obj_t _colora(mp_obj_t self, mp_obj_t a0) { @@ -501,7 +518,8 @@ STATIC MP_DEFINE_CONST_FUN_OBJ_2(colora_obj, _colora); //| :param int b: allow updates to the frame buffer blue component. Range 0-1. The initial value is 1 //| :param int a: allow updates to the frame buffer alpha component. Range 0-1. The initial value is 1 //| -//| These values are part of the graphics context and are saved and restored by :meth:`SaveContext` and :meth:`RestoreContext`.""" +//| These values are part of the graphics context and are saved and restored by :meth:`SaveContext` and :meth:`RestoreContext`. +//| """ //| ... STATIC mp_obj_t _colormask(size_t n_args, const mp_obj_t *args) { @@ -521,7 +539,8 @@ STATIC MP_DEFINE_CONST_FUN_OBJ_VAR_BETWEEN(colormask_obj, 5, 5, _colormask); //| :param int green: green for the current color. Range 0-255. The initial value is 255 //| :param int blue: blue for the current color. Range 0-255. The initial value is 255 //| -//| These values are part of the graphics context and are saved and restored by :meth:`SaveContext` and :meth:`RestoreContext`.""" +//| These values are part of the graphics context and are saved and restored by :meth:`SaveContext` and :meth:`RestoreContext`. +//| """ //| ... STATIC mp_obj_t _colorrgb(size_t n_args, const mp_obj_t *args) { @@ -547,7 +566,8 @@ STATIC MP_DEFINE_CONST_FUN_OBJ_1(display_obj, _display); //| def End(self) -> None: //| """End drawing a graphics primitive //| -//| :meth:`Vertex2ii` and :meth:`Vertex2f` calls are ignored until the next :meth:`Begin`.""" +//| :meth:`Vertex2ii` and :meth:`Vertex2f` calls are ignored until the next :meth:`Begin`. +//| """ //| ... STATIC mp_obj_t _end(mp_obj_t self) { @@ -599,7 +619,8 @@ STATIC MP_DEFINE_CONST_FUN_OBJ_1(nop_obj, _nop); //| //| :param int addr: Address in graphics SRAM, 2-byte aligned. Range 0-4194303. The initial value is 0 //| -//| This value is part of the graphics context and is saved and restored by :meth:`SaveContext` and :meth:`RestoreContext`.""" +//| This value is part of the graphics context and is saved and restored by :meth:`SaveContext` and :meth:`RestoreContext`. +//| """ //| ... STATIC mp_obj_t _palettesource(mp_obj_t self, mp_obj_t a0) { @@ -648,7 +669,8 @@ STATIC MP_DEFINE_CONST_FUN_OBJ_1(savecontext_obj, _savecontext); //| :param int width: The width of the scissor clip rectangle, in pixels. Range 0-4095. The initial value is hsize //| :param int height: The height of the scissor clip rectangle, in pixels. Range 0-4095. The initial value is 2048 //| -//| These values are part of the graphics context and are saved and restored by :meth:`SaveContext` and :meth:`RestoreContext`.""" +//| These values are part of the graphics context and are saved and restored by :meth:`SaveContext` and :meth:`RestoreContext`. +//| """ //| ... STATIC mp_obj_t _scissorsize(mp_obj_t self, mp_obj_t a0, mp_obj_t a1) { @@ -665,7 +687,8 @@ STATIC MP_DEFINE_CONST_FUN_OBJ_3(scissorsize_obj, _scissorsize); //| :param int x: The :math:`x` coordinate of the scissor clip rectangle, in pixels. Range 0-2047. The initial value is 0 //| :param int y: The :math:`y` coordinate of the scissor clip rectangle, in pixels. Range 0-2047. The initial value is 0 //| -//| These values are part of the graphics context and are saved and restored by :meth:`SaveContext` and :meth:`RestoreContext`.""" +//| These values are part of the graphics context and are saved and restored by :meth:`SaveContext` and :meth:`RestoreContext`. +//| """ //| ... STATIC mp_obj_t _scissorxy(mp_obj_t self, mp_obj_t a0, mp_obj_t a1) { @@ -683,7 +706,8 @@ STATIC MP_DEFINE_CONST_FUN_OBJ_3(scissorxy_obj, _scissorxy); //| :param int ref: specifies the reference value for the stencil test. Range 0-255. The initial value is 0 //| :param int mask: specifies a mask that is ANDed with the reference value and the stored stencil value. Range 0-255. The initial value is 255 //| -//| These values are part of the graphics context and are saved and restored by :meth:`SaveContext` and :meth:`RestoreContext`.""" +//| These values are part of the graphics context and are saved and restored by :meth:`SaveContext` and :meth:`RestoreContext`. +//| """ //| ... STATIC mp_obj_t _stencilfunc(size_t n_args, const mp_obj_t *args) { @@ -700,7 +724,8 @@ STATIC MP_DEFINE_CONST_FUN_OBJ_VAR_BETWEEN(stencilfunc_obj, 4, 4, _stencilfunc); //| //| :param int mask: the mask used to enable writing stencil bits. Range 0-255. The initial value is 255 //| -//| This value is part of the graphics context and is saved and restored by :meth:`SaveContext` and :meth:`RestoreContext`.""" +//| This value is part of the graphics context and is saved and restored by :meth:`SaveContext` and :meth:`RestoreContext`. +//| """ //| ... STATIC mp_obj_t _stencilmask(mp_obj_t self, mp_obj_t a0) { @@ -716,7 +741,8 @@ STATIC MP_DEFINE_CONST_FUN_OBJ_2(stencilmask_obj, _stencilmask); //| :param int sfail: specifies the action to take when the stencil test fails, one of ``KEEP``, ``ZERO``, ``REPLACE``, ``INCR``, ``INCR_WRAP``, ``DECR``, ``DECR_WRAP``, and ``INVERT``. Range 0-7. The initial value is KEEP(1) //| :param int spass: specifies the action to take when the stencil test passes, one of the same constants as **sfail**. Range 0-7. The initial value is KEEP(1) //| -//| These values are part of the graphics context and are saved and restored by :meth:`SaveContext` and :meth:`RestoreContext`.""" +//| These values are part of the graphics context and are saved and restored by :meth:`SaveContext` and :meth:`RestoreContext`. +//| """ //| ... STATIC mp_obj_t _stencilop(mp_obj_t self, mp_obj_t a0, mp_obj_t a1) { @@ -732,7 +758,8 @@ STATIC MP_DEFINE_CONST_FUN_OBJ_3(stencilop_obj, _stencilop); //| //| :param int mask: allow updates to the tag buffer. Range 0-1. The initial value is 1 //| -//| This value is part of the graphics context and is saved and restored by :meth:`SaveContext` and :meth:`RestoreContext`.""" +//| This value is part of the graphics context and is saved and restored by :meth:`SaveContext` and :meth:`RestoreContext`. +//| """ //| ... STATIC mp_obj_t _tagmask(mp_obj_t self, mp_obj_t a0) { @@ -747,7 +774,8 @@ STATIC MP_DEFINE_CONST_FUN_OBJ_2(tagmask_obj, _tagmask); //| //| :param int s: tag value. Range 0-255. The initial value is 255 //| -//| This value is part of the graphics context and is saved and restored by :meth:`SaveContext` and :meth:`RestoreContext`.""" +//| This value is part of the graphics context and is saved and restored by :meth:`SaveContext` and :meth:`RestoreContext`. +//| """ //| ... STATIC mp_obj_t _tag(mp_obj_t self, mp_obj_t a0) { @@ -857,7 +885,8 @@ STATIC MP_DEFINE_CONST_FUN_OBJ_3(vertex2f_obj, _vertex2f); //| //| :param float width: line width in pixels. Range 0-511. The initial value is 1 //| -//| This value is part of the graphics context and is saved and restored by :meth:`SaveContext` and :meth:`RestoreContext`.""" +//| This value is part of the graphics context and is saved and restored by :meth:`SaveContext` and :meth:`RestoreContext`. +//| """ //| ... STATIC mp_obj_t _linewidth(mp_obj_t self, mp_obj_t a0) { @@ -872,7 +901,8 @@ STATIC MP_DEFINE_CONST_FUN_OBJ_2(linewidth_obj, _linewidth); //| //| :param float size: point diameter in pixels. Range 0-1023. The initial value is 1 //| -//| This value is part of the graphics context and is saved and restored by :meth:`SaveContext` and :meth:`RestoreContext`.""" +//| This value is part of the graphics context and is saved and restored by :meth:`SaveContext` and :meth:`RestoreContext`. +//| """ //| ... STATIC mp_obj_t _pointsize(mp_obj_t self, mp_obj_t a0) { @@ -887,7 +917,8 @@ STATIC MP_DEFINE_CONST_FUN_OBJ_2(pointsize_obj, _pointsize); //| //| :param float x: signed x-coordinate in pixels. Range ±4095. The initial value is 0 //| -//| This value is part of the graphics context and is saved and restored by :meth:`SaveContext` and :meth:`RestoreContext`.""" +//| This value is part of the graphics context and is saved and restored by :meth:`SaveContext` and :meth:`RestoreContext`. +//| """ //| ... STATIC mp_obj_t _vertextranslatex(mp_obj_t self, mp_obj_t a0) { @@ -902,7 +933,8 @@ STATIC MP_DEFINE_CONST_FUN_OBJ_2(vertextranslatex_obj, _vertextranslatex); //| //| :param float y: signed y-coordinate in pixels. Range ±4095. The initial value is 0 //| -//| This value is part of the graphics context and is saved and restored by :meth:`SaveContext` and :meth:`RestoreContext`.""" +//| This value is part of the graphics context and is saved and restored by :meth:`SaveContext` and :meth:`RestoreContext`. +//| """ //| ... @@ -918,7 +950,8 @@ STATIC MP_DEFINE_CONST_FUN_OBJ_2(vertextranslatey_obj, _vertextranslatey); //| //| :param int frac: Number of fractional bits in X,Y coordinates, 0-4. Range 0-7. The initial value is 4 //| -//| This value is part of the graphics context and is saved and restored by :meth:`SaveContext` and :meth:`RestoreContext`.""" +//| This value is part of the graphics context and is saved and restored by :meth:`SaveContext` and :meth:`RestoreContext`. +//| """ //| ... // } diff --git a/shared-bindings/adafruit_bus_device/i2c_device/I2CDevice.c b/shared-bindings/adafruit_bus_device/i2c_device/I2CDevice.c index d2b7f0c6ce..a77179c886 100644 --- a/shared-bindings/adafruit_bus_device/i2c_device/I2CDevice.c +++ b/shared-bindings/adafruit_bus_device/i2c_device/I2CDevice.c @@ -43,7 +43,6 @@ //| """I2C Device Manager""" //| //| def __init__(self, i2c: busio.I2C, device_address: int, probe: bool = True) -> None: -//| //| """Represents a single I2C device and manages locking the bus and the device //| address. //| diff --git a/shared-bindings/adafruit_bus_device/spi_device/SPIDevice.c b/shared-bindings/adafruit_bus_device/spi_device/SPIDevice.c index 6626d27f77..6108247aa1 100644 --- a/shared-bindings/adafruit_bus_device/spi_device/SPIDevice.c +++ b/shared-bindings/adafruit_bus_device/spi_device/SPIDevice.c @@ -51,7 +51,6 @@ //| phase: int = 0, //| extra_clocks: int = 0 //| ) -> None: -//| //| """ //| Represents a single SPI device and manages locking the bus and the device address. //| diff --git a/shared-bindings/adafruit_pixelbuf/PixelBuf.c b/shared-bindings/adafruit_pixelbuf/PixelBuf.c index cf18804ec9..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 }; diff --git a/shared-bindings/alarm/__init__.c b/shared-bindings/alarm/__init__.c index f61482682f..29c9b49d3f 100644 --- a/shared-bindings/alarm/__init__.c +++ b/shared-bindings/alarm/__init__.c @@ -73,6 +73,7 @@ //| """The most recently triggered alarm. If CircuitPython was sleeping, the alarm that woke it from sleep. //| If no alarm occured since the last hard reset or soft restart, value is ``None``. //| """ +//| // wake_alarm is implemented as a dictionary entry, so there's no code here. diff --git a/shared-bindings/atexit/__init__.c b/shared-bindings/atexit/__init__.c index 914cac582b..9a91e0bc80 100644 --- a/shared-bindings/atexit/__init__.c +++ b/shared-bindings/atexit/__init__.c @@ -37,11 +37,11 @@ //| |see_cpython_module| :mod:`cpython:atexit`. //| """ //| ... +//| //| def register( //| func: Callable[..., Any], *args: Optional[Any], **kwargs: Optional[Any] //| ) -> Callable[..., Any]: -//| //| """Register func as a function to be executed at termination. //| //| Any optional arguments that are to be passed to func must be passed as arguments to `register()`. @@ -65,7 +65,6 @@ STATIC mp_obj_t atexit_register(size_t n_args, const mp_obj_t *pos_args, mp_map_ STATIC MP_DEFINE_CONST_FUN_OBJ_KW(atexit_register_obj, 1, atexit_register); //| def unregister(func: Callable[..., Any]) -> None: -//| //| """Remove func from the list of functions to be run at termination. //| //| `unregister()` silently does nothing if func was not previously registered. If func has been registered more than once, diff --git a/shared-bindings/audiomixer/MixerVoice.c b/shared-bindings/audiomixer/MixerVoice.c index 0bdef1f4cd..16a1be520f 100644 --- a/shared-bindings/audiomixer/MixerVoice.c +++ b/shared-bindings/audiomixer/MixerVoice.c @@ -62,7 +62,8 @@ STATIC mp_obj_t audiomixer_mixervoice_make_new(const mp_obj_type_t *type, size_t //| //| Sample must be an `audiocore.WaveFile`, `audiocore.RawSample`, `audiomixer.Mixer` or `audiomp3.MP3Decoder`. //| -//| The sample must match the `audiomixer.Mixer`'s encoding settings given in the constructor.""" +//| The sample must match the `audiomixer.Mixer`'s encoding settings given in the constructor. +//| """ //| ... STATIC mp_obj_t audiomixer_mixervoice_obj_play(size_t n_args, const mp_obj_t *pos_args, mp_map_t *kw_args) { enum { ARG_sample, ARG_loop }; diff --git a/shared-bindings/audiomp3/MP3Decoder.c b/shared-bindings/audiomp3/MP3Decoder.c index 4a8805b294..68e78cb0d5 100644 --- a/shared-bindings/audiomp3/MP3Decoder.c +++ b/shared-bindings/audiomp3/MP3Decoder.c @@ -45,7 +45,6 @@ //| """ //| //| def __init__(self, file: Union[str, typing.BinaryIO], buffer: WriteableBuffer) -> None: -//| //| """Load a .mp3 file for playback with `audioio.AudioOut` or `audiobusio.I2SOut`. //| //| :param Union[str, typing.BinaryIO] file: The name of a mp3 file (preferred) or an already opened mp3 file diff --git a/shared-bindings/bitmaptools/__init__.c b/shared-bindings/bitmaptools/__init__.c index 33e3257770..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 @@ -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; diff --git a/shared-bindings/bitops/__init__.c b/shared-bindings/bitops/__init__.c index ea4e70ae3a..3107b310db 100644 --- a/shared-bindings/bitops/__init__.c +++ b/shared-bindings/bitops/__init__.c @@ -30,6 +30,7 @@ #include "shared-bindings/bitops/__init__.h" //| """Routines for low-level manipulation of binary data""" +//| //| def bit_transpose( //| input: ReadableBuffer, output: WriteableBuffer, width: int = 8 diff --git a/shared-bindings/board/__init__.c b/shared-bindings/board/__init__.c index e4003d4f6b..971ed2f676 100644 --- a/shared-bindings/board/__init__.c +++ b/shared-bindings/board/__init__.c @@ -58,10 +58,12 @@ //| """Board ID string. The unique identifier for the board model in //| circuitpython, as well as on circuitpython.org. //| Example: "hallowing_m0_express".""" +//| //| def I2C() -> busio.I2C: //| """Returns the `busio.I2C` object for the board's designated I2C bus(es). -//| The object created is a singleton, and uses the default parameter values for `busio.I2C`.""" +//| The object created is a singleton, and uses the default parameter values for `busio.I2C`. +//| """ //| ... //| #if CIRCUITPY_BOARD_I2C @@ -78,7 +80,8 @@ MP_DEFINE_CONST_FUN_OBJ_0(board_i2c_obj, board_i2c_0); //| def SPI() -> busio.SPI: //| """Returns the `busio.SPI` object for the board's designated SPI bus(es). -//| The object created is a singleton, and uses the default parameter values for `busio.SPI`.""" +//| The object created is a singleton, and uses the default parameter values for `busio.SPI`. +//| """ //| ... //| #if CIRCUITPY_BOARD_SPI @@ -95,7 +98,8 @@ MP_DEFINE_CONST_FUN_OBJ_0(board_spi_obj, board_spi_0); //| def UART() -> busio.UART: //| """Returns the `busio.UART` object for the board's designated UART bus(es). -//| The object created is a singleton, and uses the default parameter values for `busio.UART`.""" +//| The object created is a singleton, and uses the default parameter values for `busio.UART`. +//| """ //| ... //| #if CIRCUITPY_BOARD_UART diff --git a/shared-bindings/busio/I2C.c b/shared-bindings/busio/I2C.c index de373aaeb4..5cf52eaa1a 100644 --- a/shared-bindings/busio/I2C.c +++ b/shared-bindings/busio/I2C.c @@ -48,7 +48,6 @@ //| frequency: int = 100000, //| timeout: int = 255 //| ) -> None: -//| //| """I2C is a two-wire protocol for communicating between devices. At the //| physical level it consists of 2 wires: SCL and SDA, the clock and data //| lines respectively. diff --git a/shared-bindings/busio/SPI.c b/shared-bindings/busio/SPI.c index af985ed632..ccdceb5760 100644 --- a/shared-bindings/busio/SPI.c +++ b/shared-bindings/busio/SPI.c @@ -61,7 +61,6 @@ //| MISO: Optional[microcontroller.Pin] = None, //| half_duplex: bool = False, //| ) -> None: -//| //| """Construct an SPI object on the given pins. //| //| .. note:: The SPI peripherals allocated in order of desirability, if possible, diff --git a/shared-bindings/canio/__init__.c b/shared-bindings/canio/__init__.c index 0416e5cb39..ecef7ebde6 100644 --- a/shared-bindings/canio/__init__.c +++ b/shared-bindings/canio/__init__.c @@ -58,6 +58,7 @@ //| For more information on working with this module, refer to //| `this Learn Guide on using it `_. //| """ +//| #include "py/obj.h" #include "py/enum.h" diff --git a/shared-bindings/displayio/Display.c b/shared-bindings/displayio/Display.c index 448aa25b79..47b1de8914 100644 --- a/shared-bindings/displayio/Display.c +++ b/shared-bindings/displayio/Display.c @@ -41,6 +41,7 @@ //| _DisplayBus = Union["FourWire", "paralleldisplay.ParallelBus", "I2CDisplay"] //| """:py:class:`FourWire`, :py:class:`paralleldisplay.ParallelBus` or :py:class:`I2CDisplay`""" +//| //| class Display: //| """Manage updating a display over a display bus @@ -282,7 +283,8 @@ MP_DEFINE_CONST_FUN_OBJ_2(displayio_display_show_obj, displayio_display_obj_show //| //| :param Optional[int] target_frames_per_second: The target frame rate that :py:func:`refresh` should try to //| achieve. Set to `None` for immediate refresh. -//| :param int minimum_frames_per_second: The minimum number of times the screen should be updated per second.""" +//| :param int minimum_frames_per_second: The minimum number of times the screen should be updated per second. +//| """ //| ... STATIC mp_obj_t displayio_display_obj_refresh(size_t n_args, const mp_obj_t *pos_args, mp_map_t *kw_args) { enum { ARG_target_frames_per_second, ARG_minimum_frames_per_second }; @@ -445,7 +447,8 @@ MP_PROPERTY_GETSET(displayio_display_root_group_obj, //| """Extract the pixels from a single row //| //| :param int y: The top edge of the area -//| :param ~circuitpython_typing.WriteableBuffer buffer: The buffer in which to place the pixel data""" +//| :param ~circuitpython_typing.WriteableBuffer buffer: The buffer in which to place the pixel data +//| """ //| ... //| STATIC mp_obj_t displayio_display_obj_fill_row(size_t n_args, const mp_obj_t *pos_args, mp_map_t *kw_args) { diff --git a/shared-bindings/displayio/EPaperDisplay.c b/shared-bindings/displayio/EPaperDisplay.c index 6fde664670..4745223ad3 100644 --- a/shared-bindings/displayio/EPaperDisplay.c +++ b/shared-bindings/displayio/EPaperDisplay.c @@ -117,7 +117,8 @@ //| :param float seconds_per_frame: Minimum number of seconds between screen refreshes //| :param bool always_toggle_chip_select: When True, chip select is toggled every byte //| :param bool grayscale: When true, the color ram is the low bit of 2-bit grayscale -//| :param bool two_byte_sequence_length: When true, use two bytes to define sequence length""" +//| :param bool two_byte_sequence_length: When true, use two bytes to define sequence length +//| """ //| ... STATIC mp_obj_t displayio_epaperdisplay_make_new(const mp_obj_type_t *type, size_t n_args, size_t n_kw, const mp_obj_t *all_args) { enum { ARG_display_bus, ARG_start_sequence, ARG_stop_sequence, ARG_width, ARG_height, diff --git a/shared-bindings/displayio/I2CDisplay.c b/shared-bindings/displayio/I2CDisplay.c index 14edf7b0be..f2647b0b16 100644 --- a/shared-bindings/displayio/I2CDisplay.c +++ b/shared-bindings/displayio/I2CDisplay.c @@ -59,7 +59,8 @@ //| //| :param busio.I2C i2c_bus: The I2C bus that make up the clock and data lines //| :param int device_address: The I2C address of the device -//| :param microcontroller.Pin reset: Reset pin. When None only software reset can be used""" +//| :param microcontroller.Pin reset: Reset pin. When None only software reset can be used +//| """ //| ... STATIC mp_obj_t displayio_i2cdisplay_make_new(const mp_obj_type_t *type, size_t n_args, size_t n_kw, const mp_obj_t *all_args) { enum { ARG_i2c_bus, ARG_device_address, ARG_reset }; diff --git a/shared-bindings/dualbank/__init__.c b/shared-bindings/dualbank/__init__.c index 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 51124984bf..030b924c1e 100644 --- a/shared-bindings/framebufferio/FramebufferDisplay.c +++ b/shared-bindings/framebufferio/FramebufferDisplay.c @@ -58,7 +58,8 @@ //| //| :param ~circuitpython_typing.FrameBuffer framebuffer: The framebuffer that the display is connected to //| :param bool auto_refresh: Automatically refresh the screen -//| :param int rotation: The rotation of the display in degrees clockwise. Must be in 90 degree increments (0, 90, 180, 270)""" +//| :param int rotation: The rotation of the display in degrees clockwise. Must be in 90 degree increments (0, 90, 180, 270) +//| """ //| ... STATIC mp_obj_t framebufferio_framebufferdisplay_make_new(const mp_obj_type_t *type, size_t n_args, size_t n_kw, const mp_obj_t *all_args) { enum { ARG_framebuffer, ARG_rotation, ARG_auto_refresh, NUM_ARGS }; @@ -134,7 +135,8 @@ MP_DEFINE_CONST_FUN_OBJ_2(framebufferio_framebufferdisplay_show_obj, framebuffer //| without calls to this.) //| //| :param int target_frames_per_second: How many times a second `refresh` should be called and the screen updated. -//| :param int minimum_frames_per_second: The minimum number of times the screen should be updated per second.""" +//| :param int minimum_frames_per_second: The minimum number of times the screen should be updated per second. +//| """ //| ... STATIC mp_obj_t framebufferio_framebufferdisplay_obj_refresh(size_t n_args, const mp_obj_t *pos_args, mp_map_t *kw_args) { enum { ARG_target_frames_per_second, ARG_minimum_frames_per_second }; @@ -263,7 +265,8 @@ MP_PROPERTY_GETTER(framebufferio_framebufferframebuffer_obj, //| """Extract the pixels from a single row //| //| :param int y: The top edge of the area -//| :param ~circuitpython_typing.WriteableBuffer buffer: The buffer in which to place the pixel data""" +//| :param ~circuitpython_typing.WriteableBuffer buffer: The buffer in which to place the pixel data +//| """ //| ... STATIC mp_obj_t framebufferio_framebufferdisplay_obj_fill_row(size_t n_args, const mp_obj_t *pos_args, mp_map_t *kw_args) { enum { ARG_y, ARG_buffer }; diff --git a/shared-bindings/getpass/__init__.c b/shared-bindings/getpass/__init__.c index 340b8fd7c6..811d78e03d 100644 --- a/shared-bindings/getpass/__init__.c +++ b/shared-bindings/getpass/__init__.c @@ -33,9 +33,9 @@ //| //| """ //| ... +//| //| def getpass(prompt: Optional[str] = "Password: ", stream: Optional[io.FileIO] = None) -> str: -//| //| """Prompt the user without echoing. //| //| :param str prompt: The user is prompted using the string ``prompt``, which defaults to ``'Password: '``. diff --git a/shared-bindings/hashlib/Hash.c b/shared-bindings/hashlib/Hash.c index f385885b4d..e3cbbc39d3 100644 --- a/shared-bindings/hashlib/Hash.c +++ b/shared-bindings/hashlib/Hash.c @@ -49,7 +49,8 @@ MP_PROPERTY_GETTER(hashlib_hash_digest_size_obj, (mp_obj_t)&hashlib_hash_digest_ //| def update(self, data: ReadableBuffer) -> None: //| """Update the hash with the given bytes. //| -//| :param ~circuitpython_typing.ReadableBuffer data: Update the hash from data in this buffer""" +//| :param ~circuitpython_typing.ReadableBuffer data: Update the hash from data in this buffer +//| """ //| ... mp_obj_t hashlib_hash_update(mp_obj_t self_in, mp_obj_t buf_in) { mp_check_self(mp_obj_is_type(self_in, &hashlib_hash_type)); diff --git a/shared-bindings/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/math/__init__.c b/shared-bindings/math/__init__.c index 42a32749da..8aee44ffb8 100644 --- a/shared-bindings/math/__init__.c +++ b/shared-bindings/math/__init__.c @@ -86,6 +86,7 @@ STATIC NORETURN void math_error(void) { //| //| pi: float //| """the ratio of a circle's circumference to its diameter""" +//| //| def acos(x: float) -> float: //| """Return the inverse cosine of ``x``.""" diff --git a/shared-bindings/memorymonitor/__init__.c b/shared-bindings/memorymonitor/__init__.c index 12c91cd150..7b05acd095 100644 --- a/shared-bindings/memorymonitor/__init__.c +++ b/shared-bindings/memorymonitor/__init__.c @@ -34,6 +34,7 @@ #include "shared-bindings/memorymonitor/AllocationSize.h" //| """Memory monitoring helpers""" +//| //| class AllocationError(Exception): //| """Catchall exception for allocation related errors.""" diff --git a/shared-bindings/microcontroller/__init__.c b/shared-bindings/microcontroller/__init__.c index 5716f7270e..2c1fdd5b58 100644 --- a/shared-bindings/microcontroller/__init__.c +++ b/shared-bindings/microcontroller/__init__.c @@ -60,6 +60,7 @@ //| """CPU information and control, such as ``cpus[0].temperature`` and ``cpus[1].frequency`` //| (clock frequency) on chips with more than 1 cpu. The index selects which cpu. //| This object is an instance of `microcontroller.Processor`.""" +//| //| def delay_us(delay: int) -> None: //| """Dedicated delay method used for very short delays. **Do not** do long delays diff --git a/shared-bindings/msgpack/__init__.c b/shared-bindings/msgpack/__init__.c index d505e3a6d8..7773d6d190 100644 --- a/shared-bindings/msgpack/__init__.c +++ b/shared-bindings/msgpack/__init__.c @@ -84,6 +84,7 @@ //| print(f"{data} -> {buffer.getvalue()} -> {decoded}") //| //| """ +//| //| def pack( //| obj: object, diff --git a/shared-bindings/neopixel_write/__init__.c b/shared-bindings/neopixel_write/__init__.c index 66c36af34b..cc0e2a041a 100644 --- a/shared-bindings/neopixel_write/__init__.c +++ b/shared-bindings/neopixel_write/__init__.c @@ -109,7 +109,8 @@ STATIC void check_for_deinit(digitalio_digitalinout_obj_t *self) { //| """Write buf out on the given DigitalInOut. //| //| :param ~digitalio.DigitalInOut digitalinout: the DigitalInOut to output with -//| :param ~circuitpython_typing.ReadableBuffer buf: The bytes to clock out. No assumption is made about color order""" +//| :param ~circuitpython_typing.ReadableBuffer buf: The bytes to clock out. No assumption is made about color order +//| """ //| ... //| STATIC mp_obj_t neopixel_write_neopixel_write_(mp_obj_t digitalinout_obj, mp_obj_t buf) { diff --git a/shared-bindings/rainbowio/__init__.c b/shared-bindings/rainbowio/__init__.c index 0dfdcd3a45..324f43198e 100644 --- a/shared-bindings/rainbowio/__init__.c +++ b/shared-bindings/rainbowio/__init__.c @@ -33,7 +33,8 @@ //| //| def colorwheel(n: float) -> int: //| """C implementation of the common colorwheel() function found in many examples. -//| Returns the colorwheel RGB value as an integer value for n (usable in neopixel and dotstar).""" +//| Returns the colorwheel RGB value as an integer value for n (usable in neopixel and dotstar). +//| """ //| ... //| STATIC mp_obj_t rainbowio_colorwheel(mp_obj_t n) { diff --git a/shared-bindings/random/__init__.c b/shared-bindings/random/__init__.c index fcf432931e..33cd9e90d0 100644 --- a/shared-bindings/random/__init__.c +++ b/shared-bindings/random/__init__.c @@ -47,6 +47,7 @@ //| from typing import TypeVar //| //| _T = TypeVar("_T") +//| //| def seed(seed: int) -> None: //| """Sets the starting seed of the random number generation. Further calls to diff --git a/shared-bindings/rtc/__init__.c b/shared-bindings/rtc/__init__.c index 64adfe7d9e..0220745c0f 100644 --- a/shared-bindings/rtc/__init__.c +++ b/shared-bindings/rtc/__init__.c @@ -36,6 +36,7 @@ //| The `rtc` module provides support for a Real Time Clock. You can access and manage the //| RTC using :class:`rtc.RTC`. It also backs the :func:`time.time` and :func:`time.localtime` //| functions using the onboard RTC if present.""" +//| void rtc_reset(void) { MP_STATE_VM(rtc_time_source) = (mp_obj_t)&rtc_rtc_obj; diff --git a/shared-bindings/sdcardio/SDCard.c b/shared-bindings/sdcardio/SDCard.c index 960d4a733e..ce67834774 100644 --- a/shared-bindings/sdcardio/SDCard.c +++ b/shared-bindings/sdcardio/SDCard.c @@ -126,7 +126,6 @@ MP_DEFINE_CONST_FUN_OBJ_1(sdcardio_sdcard_deinit_obj, sdcardio_sdcard_deinit); //| def readblocks(self, start_block: int, buf: WriteableBuffer) -> None: -//| //| """Read one or more blocks from the card //| //| :param int start_block: The block to start reading from @@ -166,7 +165,6 @@ MP_DEFINE_CONST_FUN_OBJ_1(sdcardio_sdcard_sync_obj, sdcardio_sdcard_sync); //| def writeblocks(self, start_block: int, buf: ReadableBuffer) -> None: -//| //| """Write one or more blocks to the card //| //| :param int start_block: The block to start writing from diff --git a/shared-bindings/sdioio/SDCard.c b/shared-bindings/sdioio/SDCard.c index f4cc4a9bb1..776b20fafe 100644 --- a/shared-bindings/sdioio/SDCard.c +++ b/shared-bindings/sdioio/SDCard.c @@ -160,7 +160,6 @@ STATIC mp_obj_t sdioio_sdcard_count(mp_obj_t self_in) { MP_DEFINE_CONST_FUN_OBJ_1(sdioio_sdcard_count_obj, sdioio_sdcard_count); //| def readblocks(self, start_block: int, buf: WriteableBuffer) -> None: -//| //| """Read one or more blocks from the card //| //| :param int start_block: The block to start reading from @@ -182,7 +181,6 @@ STATIC mp_obj_t sdioio_sdcard_readblocks(mp_obj_t self_in, mp_obj_t start_block_ MP_DEFINE_CONST_FUN_OBJ_3(sdioio_sdcard_readblocks_obj, sdioio_sdcard_readblocks); //| def writeblocks(self, start_block: int, buf: ReadableBuffer) -> None: -//| //| """Write one or more blocks to the card //| //| :param int start_block: The block to start writing from diff --git a/shared-bindings/socketpool/Socket.c b/shared-bindings/socketpool/Socket.c index fbf78a4cdc..9d439b5bd4 100644 --- a/shared-bindings/socketpool/Socket.c +++ b/shared-bindings/socketpool/Socket.c @@ -379,7 +379,8 @@ STATIC MP_DEFINE_CONST_FUN_OBJ_VAR_BETWEEN(socketpool_socket_setsockopt_obj, 4, //| def settimeout(self, value: int) -> None: //| """Set the timeout value for this socket. //| -//| :param ~int value: timeout in seconds. 0 means non-blocking. None means block indefinitely.""" +//| :param ~int value: timeout in seconds. 0 means non-blocking. None means block indefinitely. +//| """ //| ... //| STATIC mp_obj_t socketpool_socket_settimeout(mp_obj_t self_in, mp_obj_t timeout_in) { diff --git a/shared-bindings/socketpool/SocketPool.c b/shared-bindings/socketpool/SocketPool.c index f056c741f3..3023721378 100644 --- a/shared-bindings/socketpool/SocketPool.c +++ b/shared-bindings/socketpool/SocketPool.c @@ -52,6 +52,7 @@ //| returned by :py:attr:`wifi.radio` //| """ //| ... +//| STATIC mp_obj_t socketpool_socketpool_make_new(const mp_obj_type_t *type, size_t n_args, size_t n_kw, const mp_obj_t *args) { mp_arg_check_num(n_args, n_kw, 1, 1, false); diff --git a/shared-bindings/ssl/SSLSocket.c b/shared-bindings/ssl/SSLSocket.c index d6f4ad051c..e0e7911715 100644 --- a/shared-bindings/ssl/SSLSocket.c +++ b/shared-bindings/ssl/SSLSocket.c @@ -240,7 +240,8 @@ STATIC MP_DEFINE_CONST_FUN_OBJ_2(ssl_sslsocket_send_obj, ssl_sslsocket_send); //| def settimeout(self, value: int) -> None: //| """Set the timeout value for this socket. //| -//| :param ~int value: timeout in seconds. 0 means non-blocking. None means block indefinitely.""" +//| :param ~int value: timeout in seconds. 0 means non-blocking. None means block indefinitely. +//| """ //| ... STATIC mp_obj_t ssl_sslsocket_settimeout(mp_obj_t self_in, mp_obj_t timeout_in) { ssl_sslsocket_obj_t *self = MP_OBJ_TO_PTR(self_in); diff --git a/shared-bindings/ssl/__init__.c b/shared-bindings/ssl/__init__.c index 9204c92790..6967860054 100644 --- a/shared-bindings/ssl/__init__.c +++ b/shared-bindings/ssl/__init__.c @@ -36,6 +36,7 @@ //| //| |see_cpython_module| :mod:`cpython:ssl`. //| """ +//| //| def create_default_context() -> ssl.SSLContext: //| """Return the default SSLContext.""" diff --git a/shared-bindings/storage/__init__.c b/shared-bindings/storage/__init__.c index ad8b847fd5..8e2eee6511 100644 --- a/shared-bindings/storage/__init__.c +++ b/shared-bindings/storage/__init__.c @@ -166,8 +166,11 @@ MP_DEFINE_CONST_FUN_OBJ_1(storage_getmount_obj, storage_getmount); //| extended by setting this to `True`. If this isn't provided or //| set to `None` (default), the existing configuration will be used. //| +//| .. note:: New firmware starts with storage extended. In case of an existing +//| filesystem (e.g. uf2 load), the existing extension setting is preserved. +//| //| .. warning:: All the data on ``CIRCUITPY`` will be lost, and -//| CircuitPython will restart on certain boards.""" +//| CircuitPython will restart on certain boards.""" //| ... //| diff --git a/shared-bindings/struct/__init__.c b/shared-bindings/struct/__init__.c index 59bc78005d..5b63a15f15 100644 --- a/shared-bindings/struct/__init__.c +++ b/shared-bindings/struct/__init__.c @@ -46,6 +46,7 @@ //| //| Supported format codes: *b*, *B*, *x*, *h*, *H*, *i*, *I*, *l*, *L*, *q*, *Q*, //| *s*, *P*, *f*, *d* (the latter 2 depending on the floating-point support).""" +//| //| def calcsize(fmt: str) -> int: diff --git a/shared-bindings/supervisor/__init__.c b/shared-bindings/supervisor/__init__.c index 37f35e2e18..2c84fbc0dd 100644 --- a/shared-bindings/supervisor/__init__.c +++ b/shared-bindings/supervisor/__init__.c @@ -59,6 +59,7 @@ //| The status bar reports the current IP or BLE connection, what file is running, //| the last exception name and location, and firmware version information. //| This object is the sole instance of `supervisor.StatusBar`.""" +//| //| def reload() -> None: //| """Reload the main Python code and run it (equivalent to hitting Ctrl-D at the REPL).""" diff --git a/shared-bindings/traceback/__init__.c b/shared-bindings/traceback/__init__.c index 153587e919..3ad601eb39 100644 --- a/shared-bindings/traceback/__init__.c +++ b/shared-bindings/traceback/__init__.c @@ -37,6 +37,7 @@ //| |see_cpython_module| :mod:`cpython:traceback`. //| """ //| ... +//| STATIC void traceback_exception_common(bool is_print_exception, mp_print_t *print, size_t n_args, const mp_obj_t *pos_args, mp_map_t *kw_args) { enum { ARG_exc, ARG_value, ARG_tb, ARG_limit, ARG_file, ARG_chain }; diff --git a/shared-bindings/uheap/__init__.c b/shared-bindings/uheap/__init__.c index 376be78ef1..40aa869225 100644 --- a/shared-bindings/uheap/__init__.c +++ b/shared-bindings/uheap/__init__.c @@ -32,6 +32,7 @@ #include "shared-bindings/uheap/__init__.h" //| """Heap size analysis""" +//| //| def info(object: object) -> int: //| """Prints memory debugging info for the given object and returns the diff --git a/shared-bindings/usb/core/__init__.c b/shared-bindings/usb/core/__init__.c index 84d202945a..faeef23a88 100644 --- a/shared-bindings/usb/core/__init__.c +++ b/shared-bindings/usb/core/__init__.c @@ -40,6 +40,7 @@ //| //| This is a subset of the PyUSB core module. //| """ +//| //| class USBError(OSError): //| """Catchall exception for USB related errors.""" diff --git a/shared-bindings/usb_cdc/__init__.c b/shared-bindings/usb_cdc/__init__.c index e23e289309..b4e712e854 100644 --- a/shared-bindings/usb_cdc/__init__.c +++ b/shared-bindings/usb_cdc/__init__.c @@ -62,6 +62,7 @@ //| """A `Serial` object that can be used to send and receive binary data to and from //| the host. //| Note that `data` is *disabled* by default. ``data`` is ``None`` if disabled.""" +//| //| def disable() -> None: //| """Do not present any USB CDC device to the host. diff --git a/shared-bindings/usb_hid/__init__.c b/shared-bindings/usb_hid/__init__.c index 9cb9303143..5c61cc52de 100644 --- a/shared-bindings/usb_hid/__init__.c +++ b/shared-bindings/usb_hid/__init__.c @@ -47,6 +47,7 @@ //| containing a `Device` that describes the boot device chosen (keyboard or mouse). //| The request for a boot device overrides any other HID devices. //| """ +//| //| def disable() -> None: //| """Do not present any USB HID devices to the host computer. diff --git a/shared-bindings/usb_midi/__init__.c b/shared-bindings/usb_midi/__init__.c index 982cd144da..d3d5cf2626 100644 --- a/shared-bindings/usb_midi/__init__.c +++ b/shared-bindings/usb_midi/__init__.c @@ -42,6 +42,7 @@ //| //| ports: Tuple[Union[PortIn, PortOut], ...] //| """Tuple of all MIDI ports. Each item is ether `PortIn` or `PortOut`.""" +//| //| def disable() -> None: //| """Disable presenting a USB MIDI device to the host. diff --git a/shared-bindings/ustack/__init__.c b/shared-bindings/ustack/__init__.c index b42fb2a614..17bdcbb1c0 100644 --- a/shared-bindings/ustack/__init__.c +++ b/shared-bindings/ustack/__init__.c @@ -35,6 +35,7 @@ //| """Stack information and analysis""" +//| #if MICROPY_MAX_STACK_USAGE //| def max_stack_usage() -> int: diff --git a/shared-bindings/vectorio/Circle.c b/shared-bindings/vectorio/Circle.c index 87cd46ad9a..9896876a8a 100644 --- a/shared-bindings/vectorio/Circle.c +++ b/shared-bindings/vectorio/Circle.c @@ -24,7 +24,8 @@ //| :param int radius: The radius of the circle in pixels //| :param int x: Initial x position of the axis. //| :param int y: Initial y position of the axis. -//| :param int color_index: Initial color_index to use when selecting color from the palette.""" +//| :param int color_index: Initial color_index to use when selecting color from the palette. +//| """ static mp_obj_t vectorio_circle_make_new(const mp_obj_type_t *type, size_t n_args, size_t n_kw, const mp_obj_t *all_args) { enum { ARG_pixel_shader, ARG_radius, ARG_x, ARG_y, ARG_color_index }; static const mp_arg_t allowed_args[] = { diff --git a/shared-bindings/vectorio/Polygon.c b/shared-bindings/vectorio/Polygon.c index 6ad102e6e6..b188fc4955 100644 --- a/shared-bindings/vectorio/Polygon.c +++ b/shared-bindings/vectorio/Polygon.c @@ -32,7 +32,8 @@ //| :param List[Tuple[int,int]] points: Vertices for the polygon //| :param int x: Initial screen x position of the 0,0 origin in the points list. //| :param int y: Initial screen y position of the 0,0 origin in the points list. -//| :param int color_index: Initial color_index to use when selecting color from the palette.""" +//| :param int color_index: Initial color_index to use when selecting color from the palette. +//| """ static mp_obj_t vectorio_polygon_make_new(const mp_obj_type_t *type, size_t n_args, size_t n_kw, const mp_obj_t *all_args) { enum { ARG_pixel_shader, ARG_points_list, ARG_x, ARG_y, ARG_color_index }; static const mp_arg_t allowed_args[] = { diff --git a/shared-bindings/vectorio/Rectangle.c b/shared-bindings/vectorio/Rectangle.c index a4f3e12e69..ad864f2c2d 100644 --- a/shared-bindings/vectorio/Rectangle.c +++ b/shared-bindings/vectorio/Rectangle.c @@ -25,7 +25,8 @@ //| :param int height: The number of pixels high //| :param int x: Initial x position of the top left corner. //| :param int y: Initial y position of the top left corner. -//| :param int color_index: Initial color_index to use when selecting color from the palette.""" +//| :param int color_index: Initial color_index to use when selecting color from the palette. +//| """ static mp_obj_t vectorio_rectangle_make_new(const mp_obj_type_t *type, size_t n_args, size_t n_kw, const mp_obj_t *all_args) { enum { ARG_pixel_shader, ARG_width, ARG_height, ARG_x, ARG_y, ARG_color_index }; static const mp_arg_t allowed_args[] = { diff --git a/shared-bindings/watchdog/__init__.c b/shared-bindings/watchdog/__init__.c index df55ab7c16..5281f1c3fc 100644 --- a/shared-bindings/watchdog/__init__.c +++ b/shared-bindings/watchdog/__init__.c @@ -49,6 +49,7 @@ //| w.timeout=2.5 # Set a timeout of 2.5 seconds //| w.mode = WatchDogMode.RAISE //| w.feed()""" +//| //| class WatchDogTimeout(Exception): //| """Exception raised when the watchdog timer is set to diff --git a/shared-bindings/zlib/__init__.c b/shared-bindings/zlib/__init__.c index d9c2a01810..ba02914638 100644 --- a/shared-bindings/zlib/__init__.c +++ b/shared-bindings/zlib/__init__.c @@ -46,6 +46,7 @@ //| The `zlib` module allows limited functionality similar to the CPython zlib library. //| This module allows to decompress binary data compressed with DEFLATE algorithm //| (commonly used in zlib library and gzip archiver). Compression is not yet implemented.""" +//| //| def zlib_decompress( //| data: bytes, wbits: Optional[int] = 0, bufsize: Optional[int] = 0 diff --git a/shared-module/bitmaptools/__init__.c b/shared-module/bitmaptools/__init__.c index 67b5254b32..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); } diff --git a/shared-module/displayio/Bitmap.c b/shared-module/displayio/Bitmap.c index 6c64830dce..dc82d04e05 100644 --- a/shared-module/displayio/Bitmap.c +++ b/shared-module/displayio/Bitmap.c @@ -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/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/safe_mode.c b/supervisor/shared/safe_mode.c index d23b78d624..c7e93e6393 100644 --- a/supervisor/shared/safe_mode.c +++ b/supervisor/shared/safe_mode.c @@ -66,7 +66,7 @@ safe_mode_t wait_for_safe_mode_reset(void) { reset_reason != RESET_REASON_SOFTWARE) { return NO_SAFE_MODE; } - #ifdef CIRCUITPY_SKIP_SAFE_MODE_WAIT + #if CIRCUITPY_SKIP_SAFE_MODE_WAIT return NO_SAFE_MODE; #endif port_set_saved_word(SAFE_MODE_DATA_GUARD | (MANUAL_SAFE_MODE << 8)); diff --git a/tests/extmod/framebuf_subclass.py b/tests/extmod/framebuf_subclass.py index a9e3c5efc7..4cd9ea4eb5 100644 --- a/tests/extmod/framebuf_subclass.py +++ b/tests/extmod/framebuf_subclass.py @@ -34,6 +34,7 @@ fb.pixel(2, 2, 0x0708) fb2.blit(fb, 0, 0) print(bytes(fb2)) + # Test that blitting something that isn't a subclass fails with TypeError. class NotAFrameBuf: pass diff --git a/tests/extmod/uasyncio_exception.py b/tests/extmod/uasyncio_exception.py index aae55d6320..4e4f978dc2 100644 --- a/tests/extmod/uasyncio_exception.py +++ b/tests/extmod/uasyncio_exception.py @@ -9,6 +9,7 @@ except ImportError: print("SKIP") raise SystemExit + # main task raising an exception async def main(): print("main start") @@ -21,6 +22,7 @@ try: except ValueError as er: print("ValueError", er.args[0]) + # sub-task raising an exception async def task(): print("task start") @@ -40,6 +42,7 @@ try: except ValueError as er: print("ValueError", er.args[0]) + # main task raising an exception with sub-task not yet scheduled # TODO not currently working, task is never scheduled async def task(): diff --git a/tests/extmod/vfs_fat_fileio1.py b/tests/extmod/vfs_fat_fileio1.py index 10e92d6940..935f01d24f 100644 --- a/tests/extmod/vfs_fat_fileio1.py +++ b/tests/extmod/vfs_fat_fileio1.py @@ -13,7 +13,6 @@ except AttributeError: class RAMFS: - SEC_SIZE = 512 def __init__(self, blocks): diff --git a/tests/extmod/vfs_fat_fileio2.py b/tests/extmod/vfs_fat_fileio2.py index 7c75a6d044..6094b5a6f1 100644 --- a/tests/extmod/vfs_fat_fileio2.py +++ b/tests/extmod/vfs_fat_fileio2.py @@ -13,7 +13,6 @@ except AttributeError: class RAMFS: - SEC_SIZE = 512 def __init__(self, blocks): diff --git a/tests/extmod/vfs_fat_more.py b/tests/extmod/vfs_fat_more.py index 1b7b04ee63..f5de729402 100644 --- a/tests/extmod/vfs_fat_more.py +++ b/tests/extmod/vfs_fat_more.py @@ -12,7 +12,6 @@ except AttributeError: class RAMFS: - SEC_SIZE = 512 def __init__(self, blocks): diff --git a/tests/extmod/vfs_fat_oldproto.py b/tests/extmod/vfs_fat_oldproto.py index e447ff4eb3..1998319dbe 100644 --- a/tests/extmod/vfs_fat_oldproto.py +++ b/tests/extmod/vfs_fat_oldproto.py @@ -13,7 +13,6 @@ except AttributeError: class RAMFS_OLD: - SEC_SIZE = 512 def __init__(self, blocks): diff --git a/tests/extmod/vfs_fat_ramdisk.py b/tests/extmod/vfs_fat_ramdisk.py index 4b79391102..a22d480dfd 100644 --- a/tests/extmod/vfs_fat_ramdisk.py +++ b/tests/extmod/vfs_fat_ramdisk.py @@ -13,7 +13,6 @@ except AttributeError: class RAMFS: - SEC_SIZE = 512 def __init__(self, blocks): diff --git a/tests/extmod/vfs_fat_ramdisklarge.py b/tests/extmod/vfs_fat_ramdisklarge.py index 69d4a8cbbd..649a53db14 100644 --- a/tests/extmod/vfs_fat_ramdisklarge.py +++ b/tests/extmod/vfs_fat_ramdisklarge.py @@ -14,7 +14,6 @@ except AttributeError: class RAMBDevSparse: - SEC_SIZE = 512 def __init__(self, blocks): diff --git a/tests/import/module_getattr.py b/tests/import/module_getattr.py index df7a621815..9ca0d18455 100644 --- a/tests/import/module_getattr.py +++ b/tests/import/module_getattr.py @@ -8,6 +8,7 @@ try: except AttributeError: pass + # define __getattr__ def __getattr__(attr): if attr == "does_not_exist": diff --git a/tests/inlineasm/asmsum.py b/tests/inlineasm/asmsum.py index 6535a495d4..208709a25f 100644 --- a/tests/inlineasm/asmsum.py +++ b/tests/inlineasm/asmsum.py @@ -1,6 +1,5 @@ @micropython.asm_thumb def asm_sum_words(r0, r1): - # r0 = len # r1 = ptr # r2 = sum @@ -25,7 +24,6 @@ def asm_sum_words(r0, r1): @micropython.asm_thumb def asm_sum_bytes(r0, r1): - # r0 = len # r1 = ptr # r2 = sum diff --git a/tests/micropython/const2.py b/tests/micropython/const2.py index ed4720122e..d8b68c25f3 100644 --- a/tests/micropython/const2.py +++ b/tests/micropython/const2.py @@ -11,6 +11,7 @@ import micropython as X print(globals()["X"]) + # function name that matches a constant def X(): print("function X", X) @@ -18,6 +19,7 @@ def X(): globals()["X"]() + # arguments that match a constant def f(X, *Y, **Z): pass @@ -25,6 +27,7 @@ def f(X, *Y, **Z): f(1) + # class name that matches a constant class X: def f(self): @@ -33,6 +36,7 @@ class X: globals()["X"]().f() + # constant within a class class A: C1 = const(4) diff --git a/tests/micropython/heapalloc_yield_from.py b/tests/micropython/heapalloc_yield_from.py index 58788b1dbc..9507171890 100644 --- a/tests/micropython/heapalloc_yield_from.py +++ b/tests/micropython/heapalloc_yield_from.py @@ -2,6 +2,7 @@ import micropython + # Yielding from a function generator def sub_gen(a): for i in range(a): @@ -18,6 +19,7 @@ print(next(g)) print(next(g)) micropython.heap_unlock() + # Yielding from a user iterator class G: def __init__(self): diff --git a/tests/micropython/native_closure.py b/tests/micropython/native_closure.py index 07014e90da..8182cfea70 100644 --- a/tests/micropython/native_closure.py +++ b/tests/micropython/native_closure.py @@ -1,5 +1,6 @@ # test native emitter can handle closures correctly + # basic closure @micropython.native def f(): @@ -15,6 +16,7 @@ def f(): print(f()()) + # closing over an argument @micropython.native def f(x): @@ -28,6 +30,7 @@ def f(x): print(f(2)()) + # closing over an argument and a normal local @micropython.native def f(x): diff --git a/tests/micropython/native_gen.py b/tests/micropython/native_gen.py index fb42f9e25e..7ea45b1497 100644 --- a/tests/micropython/native_gen.py +++ b/tests/micropython/native_gen.py @@ -1,5 +1,6 @@ # test for native generators + # simple generator with yield and return @micropython.native def gen1(x): @@ -16,6 +17,7 @@ try: except StopIteration as e: print(e.args[0]) + # using yield from @micropython.native def gen2(x): diff --git a/tests/micropython/native_misc.py b/tests/micropython/native_misc.py index f5ef807fe1..f40fcb2407 100644 --- a/tests/micropython/native_misc.py +++ b/tests/micropython/native_misc.py @@ -1,5 +1,6 @@ # tests for natively compiled functions + # basic test @micropython.native def native_test(x): @@ -14,6 +15,7 @@ import gc gc.collect() native_test(3) + # native with 2 args @micropython.native def f(a, b): @@ -22,6 +24,7 @@ def f(a, b): f(1, 2) + # native with 3 args @micropython.native def f(a, b, c): @@ -30,6 +33,7 @@ def f(a, b, c): f(1, 2, 3) + # check not operator @micropython.native def f(a): diff --git a/tests/micropython/native_try.py b/tests/micropython/native_try.py index 492b59085c..6a2152b28c 100644 --- a/tests/micropython/native_try.py +++ b/tests/micropython/native_try.py @@ -1,5 +1,6 @@ # test native try handling + # basic try-finally @micropython.native def f(): @@ -14,6 +15,7 @@ try: except NameError: print("NameError") + # nested try-except with try-finally @micropython.native def f(): @@ -28,6 +30,7 @@ def f(): f() + # check that locals written to in try blocks keep their values @micropython.native def f(): diff --git a/tests/micropython/native_try_deep.py b/tests/micropython/native_try_deep.py index 3d31248df0..26b9243e03 100644 --- a/tests/micropython/native_try_deep.py +++ b/tests/micropython/native_try_deep.py @@ -1,5 +1,6 @@ # test native try handling + # deeply nested try (9 deep) @micropython.native def f(): diff --git a/tests/micropython/native_with.py b/tests/micropython/native_with.py index 4e20b23856..9c0b98af90 100644 --- a/tests/micropython/native_with.py +++ b/tests/micropython/native_with.py @@ -21,6 +21,7 @@ def f(): f() + # nested with and try-except @micropython.native def f(): diff --git a/tests/micropython/viper_args.py b/tests/micropython/viper_args.py index 8e3225331a..27c73fa795 100644 --- a/tests/micropython/viper_args.py +++ b/tests/micropython/viper_args.py @@ -56,6 +56,7 @@ def f6(x1: int, x2: int, x3: int, x4: int, x5: int, x6: int): f6(1, 2, 3, 4, 5, 6) + # test compiling *x, **x, * args (currently unsupported at runtime) @micropython.viper def f(*x, **y): diff --git a/tests/micropython/viper_cond.py b/tests/micropython/viper_cond.py index d5ebf837bd..752261ff50 100644 --- a/tests/micropython/viper_cond.py +++ b/tests/micropython/viper_cond.py @@ -10,6 +10,7 @@ def f(): f() + # using True as a conditional @micropython.viper def f(): @@ -20,6 +21,7 @@ def f(): f() + # using an int as a conditional @micropython.viper def g(): @@ -30,6 +32,7 @@ def g(): g() + # using an int as a conditional that has the lower 16-bits clear @micropython.viper def h(): diff --git a/tests/micropython/viper_misc.py b/tests/micropython/viper_misc.py index 41389c751d..f9267f65ca 100644 --- a/tests/micropython/viper_misc.py +++ b/tests/micropython/viper_misc.py @@ -1,5 +1,6 @@ import micropython + # viper function taking and returning ints @micropython.viper def viper_int(x: int, y: int) -> int: @@ -8,6 +9,7 @@ def viper_int(x: int, y: int) -> int: print(viper_int(1, 2)) + # viper function taking and returning objects @micropython.viper def viper_object(x: object, y: object) -> object: @@ -16,6 +18,7 @@ def viper_object(x: object, y: object) -> object: print(viper_object(1, 2)) + # return None as non-object (should return 0) @micropython.viper def viper_ret_none() -> int: @@ -24,6 +27,7 @@ def viper_ret_none() -> int: print(viper_ret_none()) + # return Ellipsis as object @micropython.viper def viper_ret_ellipsis() -> object: @@ -32,6 +36,7 @@ def viper_ret_ellipsis() -> object: print(viper_ret_ellipsis()) + # 3 args @micropython.viper def viper_3args(a: int, b: int, c: int) -> int: @@ -40,6 +45,7 @@ def viper_3args(a: int, b: int, c: int) -> int: print(viper_3args(1, 2, 3)) + # 4 args @micropython.viper def viper_4args(a: int, b: int, c: int, d: int) -> int: @@ -49,6 +55,7 @@ def viper_4args(a: int, b: int, c: int, d: int) -> int: # viper call with 4 args not yet supported # print(viper_4args(1, 2, 3, 4)) + # a local (should have automatic type int) @micropython.viper def viper_local(x: int) -> int: @@ -58,6 +65,7 @@ def viper_local(x: int) -> int: print(viper_local(3)) + # without type annotation, types should default to object @micropython.viper def viper_no_annotation(x, y): @@ -66,6 +74,7 @@ def viper_no_annotation(x, y): print(viper_no_annotation(4, 5)) + # a for loop @micropython.viper def viper_for(a: int, b: int) -> int: @@ -77,6 +86,7 @@ def viper_for(a: int, b: int) -> int: print(viper_for(10, 10000)) + # accessing a global @micropython.viper def viper_access_global(): @@ -87,6 +97,7 @@ def viper_access_global(): print(viper_access_global(), gl) + # calling print with object and int types @micropython.viper def viper_print(x, y: int): @@ -95,6 +106,7 @@ def viper_print(x, y: int): viper_print(1, 2) + # convert constants to objects in tuple @micropython.viper def viper_tuple_consts(x): @@ -103,6 +115,7 @@ def viper_tuple_consts(x): print(viper_tuple_consts(0)) + # making a tuple from an object and an int @micropython.viper def viper_tuple(x, y: int): @@ -111,6 +124,7 @@ def viper_tuple(x, y: int): print(viper_tuple(1, 2)) + # making a list from an object and an int @micropython.viper def viper_list(x, y: int): @@ -119,6 +133,7 @@ def viper_list(x, y: int): print(viper_list(1, 2)) + # making a set from an object and an int @micropython.viper def viper_set(x, y: int): @@ -127,6 +142,7 @@ def viper_set(x, y: int): print(sorted(list(viper_set(1, 2)))) + # raising an exception @micropython.viper def viper_raise(x: int): @@ -138,6 +154,7 @@ try: except OSError as e: print(repr(e)) + # calling GC after defining the function @micropython.viper def viper_gc() -> int: diff --git a/tests/micropython/viper_misc2.py b/tests/micropython/viper_misc2.py index 8f0be487d6..cc77134bd4 100644 --- a/tests/micropython/viper_misc2.py +++ b/tests/micropython/viper_misc2.py @@ -1,5 +1,6 @@ # Miscellaneous viper tests + # Test correct use of registers in load and store @micropython.viper def expand(dest: ptr8, source: ptr8, length: int): diff --git a/tests/micropython/viper_misc_intbig.py b/tests/micropython/viper_misc_intbig.py index 055c08d8e5..91673f2c10 100644 --- a/tests/micropython/viper_misc_intbig.py +++ b/tests/micropython/viper_misc_intbig.py @@ -1,5 +1,6 @@ import micropython + # unsigned ints @micropython.viper def viper_uint() -> uint: diff --git a/tests/micropython/viper_try.py b/tests/micropython/viper_try.py index 61335af221..f5822a6682 100644 --- a/tests/micropython/viper_try.py +++ b/tests/micropython/viper_try.py @@ -1,5 +1,6 @@ # test try handling within a viper function + # basic try-finally @micropython.viper def f(): @@ -14,6 +15,7 @@ try: except NameError: print("NameError") + # nested try-except with try-finally @micropython.viper def f(): @@ -28,6 +30,7 @@ def f(): f() + # check that locals written to in try blocks keep their values @micropython.viper def f(): diff --git a/tests/micropython/viper_types.py b/tests/micropython/viper_types.py index 3af148171e..3e0a4f6640 100644 --- a/tests/micropython/viper_types.py +++ b/tests/micropython/viper_types.py @@ -2,6 +2,7 @@ import micropython + # converting incoming arg to bool @micropython.viper def f1(x: bool): @@ -13,6 +14,7 @@ f1(1) f1([]) f1([1]) + # taking and returning a bool @micropython.viper def f2(x: bool) -> bool: @@ -22,6 +24,7 @@ def f2(x: bool) -> bool: print(f2([])) print(f2([1])) + # converting to bool within function @micropython.viper def f3(x) -> bool: diff --git a/tests/micropython/viper_with.py b/tests/micropython/viper_with.py index d640c8ae0f..40fbf6fb31 100644 --- a/tests/micropython/viper_with.py +++ b/tests/micropython/viper_with.py @@ -21,6 +21,7 @@ def f(): f() + # nested with and try-except @micropython.viper def f(): diff --git a/tests/misc/non_compliant.py b/tests/misc/non_compliant.py index cff1894106..1c3706ec33 100644 --- a/tests/misc/non_compliant.py +++ b/tests/misc/non_compliant.py @@ -111,6 +111,7 @@ try: except NotImplementedError: print("NotImplementedError") + # can't assign attributes to a function def f(): pass @@ -127,6 +128,7 @@ try: except TypeError: print("TypeError") + # test when object explicitly listed at not-last position in parent tuple # this is not compliant with CPython because of illegal MRO class A: @@ -140,6 +142,7 @@ class B(object, A): B().foo() + # can't assign property (or other special accessors) to already-subclassed class class A: pass diff --git a/tests/misc/sys_settrace_generator.py b/tests/misc/sys_settrace_generator.py index 43065df4ae..1199f1f4eb 100644 --- a/tests/misc/sys_settrace_generator.py +++ b/tests/misc/sys_settrace_generator.py @@ -48,11 +48,9 @@ def test_generator(): gen = make_gen() r = 0 try: - r += gen.send(None) while True: - r += gen.send(None) except StopIteration as e: diff --git a/tests/misc/sys_settrace_subdir/sys_settrace_generic.py b/tests/misc/sys_settrace_subdir/sys_settrace_generic.py index a60ca955d7..fcf034af25 100644 --- a/tests/misc/sys_settrace_subdir/sys_settrace_generic.py +++ b/tests/misc/sys_settrace_subdir/sys_settrace_generic.py @@ -1,5 +1,6 @@ print("Now comes the language constructions tests.") + # function def test_func(): def test_sub_func(): diff --git a/tests/perf_bench/bm_nqueens.py b/tests/perf_bench/bm_nqueens.py index 773dd3f7ed..160f1178aa 100644 --- a/tests/perf_bench/bm_nqueens.py +++ b/tests/perf_bench/bm_nqueens.py @@ -5,6 +5,7 @@ # author: collinwinter@google.com (Collin Winter) # n_queens function: Copyright 2009 Raymond Hettinger + # Pure-Python implementation of itertools.permutations(). def permutations(iterable, r=None): """permutations(range(3), 2) --> (0,1) (0,2) (1,0) (1,2) (2,0) (2,1)""" diff --git a/tests/perf_bench/misc_aes.py b/tests/perf_bench/misc_aes.py index 0743737cb7..8a9c58bb38 100644 --- a/tests/perf_bench/misc_aes.py +++ b/tests/perf_bench/misc_aes.py @@ -33,6 +33,7 @@ aes_s_box_table = bytes(( )) # fmt: on + # multiplication of polynomials modulo x^8 + x^4 + x^3 + x + 1 = 0x11b def aes_gf8_mul_2(x): if x & 0x80: @@ -64,6 +65,7 @@ def aes_r_con(a): ################################################################## # basic AES algorithm; see FIPS-197 + # all inputs must be size 16 def aes_add_round_key(state, w): for i in range(16): diff --git a/tests/run-internalbench.py b/tests/run-internalbench.py index 606fc3b772..24f6d5a771 100755 --- a/tests/run-internalbench.py +++ b/tests/run-internalbench.py @@ -26,7 +26,6 @@ def run_tests(pyb, test_dict): for base_test, tests in sorted(test_dict.items()): print(base_test + ":") for test_file in tests: - # run MicroPython if pyb is None: # run on PC diff --git a/tests/stress/qstr_limit.py b/tests/stress/qstr_limit.py index d8ce0cf7cd..08b10a039f 100644 --- a/tests/stress/qstr_limit.py +++ b/tests/stress/qstr_limit.py @@ -17,6 +17,7 @@ for l in range(254, 259): continue print(var in g) + # calling a function with kwarg def f(**k): print(k) @@ -36,6 +37,7 @@ for l in range(254, 259): except RuntimeError: print("RuntimeError", l) + # hasattr, setattr, getattr class A: pass diff --git a/tests/stress/recursive_gen.py b/tests/stress/recursive_gen.py index 8c21397658..e051abb84d 100644 --- a/tests/stress/recursive_gen.py +++ b/tests/stress/recursive_gen.py @@ -1,5 +1,6 @@ # test deeply recursive generators + # simple "yield from" recursion def gen(): yield from gen() @@ -10,6 +11,7 @@ try: except RuntimeError: print("RuntimeError") + # recursion via an iterator over a generator def gen2(): for x in gen2(): diff --git a/tests/thread/mutate_bytearray.py b/tests/thread/mutate_bytearray.py index 9b52e0c016..7bacabec3a 100644 --- a/tests/thread/mutate_bytearray.py +++ b/tests/thread/mutate_bytearray.py @@ -9,6 +9,7 @@ import _thread # the shared bytearray ba = bytearray() + # main thread function def th(n, lo, hi): for repeat in range(n): diff --git a/tests/thread/mutate_dict.py b/tests/thread/mutate_dict.py index 0840dcafba..fb87190e77 100644 --- a/tests/thread/mutate_dict.py +++ b/tests/thread/mutate_dict.py @@ -9,6 +9,7 @@ import _thread # the shared dict di = {"a": "A", "b": "B", "c": "C", "d": "D"} + # main thread function def th(n, lo, hi): for repeat in range(n): diff --git a/tests/thread/mutate_instance.py b/tests/thread/mutate_instance.py index 8ba91cbde3..cc0ad9885d 100644 --- a/tests/thread/mutate_instance.py +++ b/tests/thread/mutate_instance.py @@ -6,6 +6,7 @@ import _thread + # the shared user class and instance class User: def __init__(self): @@ -16,6 +17,7 @@ class User: user = User() + # main thread function def th(n, lo, hi): for repeat in range(n): diff --git a/tests/thread/mutate_list.py b/tests/thread/mutate_list.py index 8ce15c0852..4df86b3008 100644 --- a/tests/thread/mutate_list.py +++ b/tests/thread/mutate_list.py @@ -9,6 +9,7 @@ import _thread # the shared list li = list() + # main thread function def th(n, lo, hi): for repeat in range(n): diff --git a/tests/thread/mutate_set.py b/tests/thread/mutate_set.py index 61169b8aa9..587a3a259a 100644 --- a/tests/thread/mutate_set.py +++ b/tests/thread/mutate_set.py @@ -9,6 +9,7 @@ import _thread # the shared set se = set([-1, -2, -3, -4]) + # main thread function def th(n, lo, hi): for repeat in range(n): diff --git a/tests/thread/stress_aes.py b/tests/thread/stress_aes.py index 673337563d..199fe3c88c 100644 --- a/tests/thread/stress_aes.py +++ b/tests/thread/stress_aes.py @@ -40,6 +40,7 @@ aes_s_box_table = bytes(( )) # fmt: on + # multiplication of polynomials modulo x^8 + x^4 + x^3 + x + 1 = 0x11b def aes_gf8_mul_2(x): if x & 0x80: @@ -82,6 +83,7 @@ def aes_r_con(a): # using OCB, where the sequence is xored against the plaintext. # Care must be taken to (almost) always choose a different IV. + # all inputs must be size 16 def aes_add_round_key(state, w): for i in range(16): diff --git a/tests/thread/thread_qstr1.py b/tests/thread/thread_qstr1.py index 2099f94bdb..9e7d7f0326 100644 --- a/tests/thread/thread_qstr1.py +++ b/tests/thread/thread_qstr1.py @@ -10,6 +10,7 @@ except ImportError: import time import _thread + # function to check the interned string def check(s, val): assert type(s) == str diff --git a/tests/unicode/unicode_id.py b/tests/unicode/unicode_id.py index 3a58e3f72b..32817287e9 100644 --- a/tests/unicode/unicode_id.py +++ b/tests/unicode/unicode_id.py @@ -10,6 +10,7 @@ bβ = 3 βb = 4 print(α, αβγ, bβ, βb) + # function, argument, local identifiers def α(β, γ): δ = β + γ @@ -18,6 +19,7 @@ def α(β, γ): α(1, 2) + # class, method identifiers class φ: def __init__(self): diff --git a/tools/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 04ae6fb0e1..5cf2279314 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,73 +55,84 @@ 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}', -) -# See https://stackoverflow.com/questions/63878612/git-fatal-error-in-object-unshallow-sha-1#comment118418373_63879454 -run('Fix for bug "fatal: error in object: unshallow"', "git repack -d") -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 == "test": + submodules = ["extmod/ulab", "lib/", "tools/"] + elif TARGET == "build-doc": + # 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/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/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 5f4f9c9561..e6bc703c02 100644 --- a/tools/extract_pyi.py +++ b/tools/extract_pyi.py @@ -215,7 +215,7 @@ def convert_folder(top_level, stub_directory): return (ok, total) error = False - for (level, msg) in find_stub_issues(tree): + for level, msg in find_stub_issues(tree): if level == "ERROR": error = True print(f"[{level}] {msg}") diff --git a/tools/gen_crt_bundle.py b/tools/gen_crt_bundle.py index eb314bf25e..da0d8837a9 100755 --- a/tools/gen_crt_bundle.py +++ b/tools/gen_crt_bundle.py @@ -72,7 +72,6 @@ class CertificateBundle: os.remove(ca_bundle_bin_file) def add_from_path(self, crts_path): - found = False for file_path in os.listdir(crts_path): found |= self.add_from_file(os.path.join(crts_path, file_path)) @@ -161,7 +160,6 @@ class CertificateBundle: return bundle def add_with_filter(self, crts_path, filter_path): - filter_set = set() with open(filter_path, "r", encoding="utf-8") as f: csv_reader = csv.reader(f, delimiter=",") diff --git a/tools/gendoc.py b/tools/gendoc.py index bf79b3cf5f..f3df853e49 100644 --- a/tools/gendoc.py +++ b/tools/gendoc.py @@ -11,6 +11,7 @@ import argparse import re import markdown + # given a list of (name,regex) pairs, find the first one that matches the given line def re_match_first(regexs, line): for name, regex in regexs: diff --git a/tools/mpy-tool.py b/tools/mpy-tool.py index 32b064d35f..02ea656c99 100755 --- a/tools/mpy-tool.py +++ b/tools/mpy-tool.py @@ -107,6 +107,7 @@ MP_BC_LOAD_GLOBAL = 0x12 MP_BC_LOAD_ATTR = 0x13 MP_BC_STORE_ATTR = 0x18 + # this function mirrors that in py/bc.c def mp_opcode_format(bytecode, ip, count_var_uint): opcode = bytecode[ip] diff --git a/tools/preprocess_frozen_modules.py b/tools/preprocess_frozen_modules.py index 30263d2e02..6c41c4cd43 100755 --- a/tools/preprocess_frozen_modules.py +++ b/tools/preprocess_frozen_modules.py @@ -46,7 +46,6 @@ def version_string(path=None, *, valid_semver=False): # with actual version info derived from git. def copy_and_process(in_dir, out_dir): for root, subdirs, files in os.walk(in_dir): - # Skip library examples directory and subfolders. relative_path_parts = Path(root).relative_to(in_dir).parts if relative_path_parts and relative_path_parts[0] in [