Merge branch 'main' into picow-ap

This commit is contained in:
Bill Sideris 2022-11-30 19:11:03 +02:00 committed by GitHub
commit 362018dcca
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
115 changed files with 2147 additions and 1278 deletions

31
.devcontainer/Readme.md Normal file
View File

@ -0,0 +1,31 @@
Build CircuitPython in a Github-Devcontainer
============================================
To build CircuitPython within a Github-Devcontainer, you need to perform
the following steps.
1. checkout the code to a devcontainer
- click on the green "<> Code"-button
- select the Codespaces-tab
- choose "+ new with options..." from the "..."-menu
- in the following screen select the branch and then
- select ".devcontainer/cortex-m/devcontainer.json" instead
of "Default Codespaces configuration"
- update region as necessary
- finally, click on the green "Create codespace" button
2. Your codespace is created. Cloning the images is quite fast, but
preparing it for CircuitPython-development takes about 10 minutes.
Note that this is a one-time task.
3. During creation, you can run the command
`tail -f /workspaces/.codespaces/.persistedshare/creation.log`
to see what is going on.
4. To actually build CircuitPython, run
cd ports/raspberrypi
make -j $(nproc) BOARD=whatever TRANSLATION=xx_XX
This takes about 2m40s.

View File

@ -0,0 +1,23 @@
// For format details, see https://aka.ms/devcontainer.json. For config options, see the
// README at: https://github.com/devcontainers/templates/tree/main/src/universal
{
"name": "CircuitPython Cortex-M Build-Environment (base: Default Linux Universal)",
"image": "mcr.microsoft.com/devcontainers/universal:2-linux",
"postCreateCommand": ".devcontainer/cortex-mq/on-create.sh",
"remoteEnv": { "PATH": "/workspaces/gcc-arm-none-eabi/bin:${containerEnv:PATH}" }
// Features to add to the dev container. More info: https://containers.dev/features.
// "features": {},
// Use 'forwardPorts' to make a list of ports inside the container available locally.
// "forwardPorts": [],
// Use 'postCreateCommand' to run commands after the container is created.
// "postCreateCommand": "uname -a",
// Configure tool-specific properties.
// "customizations": {},
// Uncomment to connect as root instead. More info: https://aka.ms/dev-containers-non-root.
// "remoteUser": "root"
}

View File

@ -0,0 +1,59 @@
#!/bin/bash
# -----------------------------------------------------------------------------
# on-create.sh: postCreateCommand-hook for devcontainer.json (Cortex-M build)
#
# Author: Bernhard Bablok
#
# -----------------------------------------------------------------------------
echo -e "[on-create.sh] downloading and installing gcc-arm-non-eabi toolchain"
cd /workspaces
wget -qO gcc-arm-none-eabi.tar.bz2 https://adafru.it/Pid
tar -xjf gcc-arm-none-eabi.tar.bz2
ln -s gcc-arm-none-eabi-10-2020-q4-major gcc-arm-none-eabi
rm -f /workspaces/gcc-arm-none-eabi.tar.bz2
export PATH=/workspaces/gcc-arm-none-eabi/bin:$PATH
# add repository and install tools
echo -e "[on-create.sh] adding pybricks/ppa"
sudo add-apt-repository -y ppa:pybricks/ppa
echo -e "[on-create.sh] installing uncrustify and mtools"
sudo apt-get -y install uncrustify mtools
# dosfstools >= 4.2 needed, standard repo only has 4.1
echo -e "[on-create.sh] downloading and installing dosfstools"
wget https://github.com/dosfstools/dosfstools/releases/download/v4.2/dosfstools-4.2.tar.gz
tar -xzf dosfstools-4.2.tar.gz
cd dosfstools-4.2/
./configure
make -j $(nproc)
sudo make install
cd /workspaces
rm -fr /workspaces/dosfstools-4.2 /workspaces/dosfstools-4.2.tar.gz
# prepare source-code tree
cd /workspaces/circuitpython/
echo -e "[on-create.sh] fetching submodules"
make fetch-submodules
echo -e "[on-create.sh] fetching tags"
git fetch --tags --recurse-submodules=no --shallow-since="2021-07-01" https://github.com/adafruit/circuitpython HEAD
# additional python requirements
echo -e "[on-create.sh] pip-installing requirements"
pip install --upgrade -r requirements-dev.txt
pip install --upgrade -r requirements-doc.txt
# add pre-commit
echo -e "[on-create.sh] installing pre-commit"
pre-commit install
# create cross-compiler
echo -e "[on-create.sh] building mpy-cross"
make -j $(nproc) -C mpy-cross # time: about 36 sec
# that's it!
echo -e "[on-create.sh] setup complete"
#commands to actually build CP:
#cd ports/raspberrypi
#time make -j $(nproc) BOARD=pimoroni_tufty2040 TRANSLATION=de_DE

View File

@ -125,20 +125,30 @@ jobs:
[ -z "$AWS_ACCESS_KEY_ID" ] || aws s3 cp mpy-cross/mpy-cross.static-raspbian s3://adafruit-circuit-python/bin/mpy-cross/mpy-cross.static-raspbian-${{ env.CP_VERSION }} --no-progress --region us-east-1 [ -z "$AWS_ACCESS_KEY_ID" ] || aws s3 cp mpy-cross/mpy-cross.static-raspbian s3://adafruit-circuit-python/bin/mpy-cross/mpy-cross.static-raspbian-${{ env.CP_VERSION }} --no-progress --region us-east-1
[ -z "$AWS_ACCESS_KEY_ID" ] || aws s3 cp mpy-cross/mpy-cross.static s3://adafruit-circuit-python/bin/mpy-cross/mpy-cross.static-amd64-linux-${{ env.CP_VERSION }} --no-progress --region us-east-1 [ -z "$AWS_ACCESS_KEY_ID" ] || aws s3 cp mpy-cross/mpy-cross.static s3://adafruit-circuit-python/bin/mpy-cross/mpy-cross.static-amd64-linux-${{ env.CP_VERSION }} --no-progress --region us-east-1
[ -z "$AWS_ACCESS_KEY_ID" ] || aws s3 cp mpy-cross/mpy-cross.static.exe s3://adafruit-circuit-python/bin/mpy-cross/mpy-cross.static-x64-windows-${{ env.CP_VERSION }}.exe --no-progress --region us-east-1 [ -z "$AWS_ACCESS_KEY_ID" ] || aws s3 cp mpy-cross/mpy-cross.static.exe s3://adafruit-circuit-python/bin/mpy-cross/mpy-cross.static-x64-windows-${{ env.CP_VERSION }}.exe --no-progress --region us-east-1
- name: "Get changes" - name: Get last commit with checks
id: get-last-commit-with-checks
if: github.event_name == 'pull_request' if: github.event_name == 'pull_request'
uses: dorny/paths-filter@v2 working-directory: tools
id: filter env:
REPO: ${{ github.repository }}
PULL: ${{ github.event.number }}
GITHUB_TOKEN: ${{ github.token }}
EXCLUDE_COMMIT: ${{ github.event.after }}
run: python3 -u ci_changes_per_commit.py
- name: Get changes
id: get-changes
if: github.event_name == 'pull_request'
uses: tj-actions/changed-files@v34
with: with:
list-files: json json: true
filters: | sha: ${{ steps.get-last-commit-with-checks.outputs.commit && github.event.after }}
changed: base_sha: ${{ steps.get-last-commit-with-checks.outputs.commit }}
- '**' - name: Set matrix
- name: "Set matrix"
id: set-matrix id: set-matrix
working-directory: tools working-directory: tools
env: env:
CHANGED_FILES: ${{ steps.filter.outputs.changed_files }} CHANGED_FILES: ${{ steps.get-changes.outputs.all_changed_and_modified_files }}
LAST_FAILED_JOBS: ${{ steps.get-last-commit-with-checks.outputs.checkruns }}
run: python3 -u ci_set_matrix.py run: python3 -u ci_set_matrix.py

6
.gitmodules vendored
View File

@ -312,10 +312,12 @@
url = https://github.com/adafruit/esp32-camera/ url = https://github.com/adafruit/esp32-camera/
[submodule "ports/raspberrypi/lib/cyw43-driver"] [submodule "ports/raspberrypi/lib/cyw43-driver"]
path = ports/raspberrypi/lib/cyw43-driver path = ports/raspberrypi/lib/cyw43-driver
url = https://github.com/georgerobotics/cyw43-driver.git url = https://github.com/adafruit/cyw43-driver.git
branch = circuitpython8
[submodule "ports/raspberrypi/lib/lwip"] [submodule "ports/raspberrypi/lib/lwip"]
path = ports/raspberrypi/lib/lwip path = ports/raspberrypi/lib/lwip
url = https://github.com/lwip-tcpip/lwip.git url = https://github.com/adafruit/lwip.git
branch = circuitpython8
[submodule "lib/mbedtls"] [submodule "lib/mbedtls"]
path = lib/mbedtls path = lib/mbedtls
url = https://github.com/ARMmbed/mbedtls.git url = https://github.com/ARMmbed/mbedtls.git

View File

@ -171,6 +171,7 @@ exclude_patterns = ["**/build*",
".env", ".env",
".venv", ".venv",
".direnv", ".direnv",
".devcontainer/Readme.md",
"data", "data",
"docs/autoapi", "docs/autoapi",
"docs/README.md", "docs/README.md",

View File

@ -112,7 +112,7 @@ msgstr "%q gagal: %d"
msgid "%q in use" msgid "%q in use"
msgstr "%q sedang digunakan" msgstr "%q sedang digunakan"
#: py/obj.c py/objstr.c py/objstrunicode.c #: py/objstr.c py/objstrunicode.c
msgid "%q index out of range" msgid "%q index out of range"
msgstr "%q indeks di luar batas" msgstr "%q indeks di luar batas"
@ -177,7 +177,7 @@ msgstr "%q harus berupa string"
msgid "%q must be an int" msgid "%q must be an int"
msgstr "" msgstr ""
#: py/argcheck.c #: py/argcheck.c py/obj.c
msgid "%q must be of type %q" msgid "%q must be of type %q"
msgstr "%q harus bertipe %q" msgstr "%q harus bertipe %q"
@ -1683,6 +1683,10 @@ msgstr ""
msgid "Operation timed out" msgid "Operation timed out"
msgstr "Waktu habis" msgstr "Waktu habis"
#: ports/raspberrypi/common-hal/mdns/Server.c
msgid "Out of MDNS service slots"
msgstr ""
#: ports/espressif/common-hal/espidf/__init__.c ports/espressif/esp_error.c #: ports/espressif/common-hal/espidf/__init__.c ports/espressif/esp_error.c
msgid "Out of memory" msgid "Out of memory"
msgstr "Kehabisan memori" msgstr "Kehabisan memori"
@ -2221,6 +2225,7 @@ msgid "Unable to read color palette data"
msgstr "Tidak dapat membaca data palet warna" msgstr "Tidak dapat membaca data palet warna"
#: ports/espressif/common-hal/mdns/Server.c #: ports/espressif/common-hal/mdns/Server.c
#: ports/raspberrypi/common-hal/mdns/Server.c
msgid "Unable to start mDNS query" msgid "Unable to start mDNS query"
msgstr "" msgstr ""
@ -3184,7 +3189,7 @@ msgid "index is out of bounds"
msgstr "" msgstr ""
#: extmod/ulab/code/numpy/numerical.c extmod/ulab/code/ulab_tools.c #: extmod/ulab/code/numpy/numerical.c extmod/ulab/code/ulab_tools.c
#: ports/espressif/common-hal/pulseio/PulseIn.c py/obj.c #: ports/espressif/common-hal/pulseio/PulseIn.c
#: shared-bindings/bitmaptools/__init__.c #: shared-bindings/bitmaptools/__init__.c
msgid "index out of range" msgid "index out of range"
msgstr "index keluar dari jangkauan" msgstr "index keluar dari jangkauan"
@ -3436,10 +3441,12 @@ msgid "loopback + silent mode not supported by peripheral"
msgstr "" msgstr ""
#: ports/espressif/common-hal/mdns/Server.c #: ports/espressif/common-hal/mdns/Server.c
#: ports/raspberrypi/common-hal/mdns/Server.c
msgid "mDNS already initialized" msgid "mDNS already initialized"
msgstr "" msgstr ""
#: ports/espressif/common-hal/mdns/Server.c #: ports/espressif/common-hal/mdns/Server.c
#: ports/raspberrypi/common-hal/mdns/Server.c
msgid "mDNS only works with built-in WiFi" msgid "mDNS only works with built-in WiFi"
msgstr "" msgstr ""

View File

@ -175,7 +175,7 @@ msgstr ""
msgid "%q must be of type %q" msgid "%q must be of type %q"
msgstr "" msgstr ""
#: shared-bindings/digitalio/Pull.c #: py/objexcept.c shared-bindings/digitalio/Pull.c
msgid "%q must be of type %q or None" msgid "%q must be of type %q or None"
msgstr "" msgstr ""
@ -894,6 +894,10 @@ msgstr ""
msgid "Drive mode not used when direction is input." msgid "Drive mode not used when direction is input."
msgstr "" msgstr ""
#: py/obj.c
msgid "During handling of the above exception, another exception occurred:"
msgstr ""
#: shared-bindings/aesio/aes.c #: shared-bindings/aesio/aes.c
msgid "ECB only operates on 16 bytes at a time" msgid "ECB only operates on 16 bytes at a time"
msgstr "" msgstr ""
@ -1663,6 +1667,10 @@ msgstr ""
msgid "Operation timed out" msgid "Operation timed out"
msgstr "" msgstr ""
#: ports/raspberrypi/common-hal/mdns/Server.c
msgid "Out of MDNS service slots"
msgstr ""
#: ports/espressif/common-hal/espidf/__init__.c ports/espressif/esp_error.c #: ports/espressif/common-hal/espidf/__init__.c ports/espressif/esp_error.c
msgid "Out of memory" msgid "Out of memory"
msgstr "" msgstr ""
@ -2011,6 +2019,10 @@ msgid ""
"exit safe mode." "exit safe mode."
msgstr "" msgstr ""
#: py/obj.c
msgid "The above exception was the direct cause of the following exception:"
msgstr ""
#: ports/espressif/boards/m5stack_atom_lite/mpconfigboard.h #: ports/espressif/boards/m5stack_atom_lite/mpconfigboard.h
msgid "The central button was pressed at start up.\n" msgid "The central button was pressed at start up.\n"
msgstr "" msgstr ""
@ -2196,6 +2208,7 @@ msgid "Unable to read color palette data"
msgstr "" msgstr ""
#: ports/espressif/common-hal/mdns/Server.c #: ports/espressif/common-hal/mdns/Server.c
#: ports/raspberrypi/common-hal/mdns/Server.c
msgid "Unable to start mDNS query" msgid "Unable to start mDNS query"
msgstr "" msgstr ""
@ -3352,10 +3365,6 @@ msgstr ""
msgid "invalid syntax for number" msgid "invalid syntax for number"
msgstr "" msgstr ""
#: py/objexcept.c
msgid "invalid traceback"
msgstr ""
#: py/objtype.c #: py/objtype.c
msgid "issubclass() arg 1 must be a class" msgid "issubclass() arg 1 must be a class"
msgstr "" msgstr ""
@ -3421,10 +3430,12 @@ msgid "loopback + silent mode not supported by peripheral"
msgstr "" msgstr ""
#: ports/espressif/common-hal/mdns/Server.c #: ports/espressif/common-hal/mdns/Server.c
#: ports/raspberrypi/common-hal/mdns/Server.c
msgid "mDNS already initialized" msgid "mDNS already initialized"
msgstr "" msgstr ""
#: ports/espressif/common-hal/mdns/Server.c #: ports/espressif/common-hal/mdns/Server.c
#: ports/raspberrypi/common-hal/mdns/Server.c
msgid "mDNS only works with built-in WiFi" msgid "mDNS only works with built-in WiFi"
msgstr "" msgstr ""

View File

@ -113,7 +113,7 @@ msgstr "%q: selhání %d"
msgid "%q in use" msgid "%q in use"
msgstr "%q se právě používá" msgstr "%q se právě používá"
#: py/obj.c py/objstr.c py/objstrunicode.c #: py/objstr.c py/objstrunicode.c
msgid "%q index out of range" msgid "%q index out of range"
msgstr "Index %q je mimo rozsah" msgstr "Index %q je mimo rozsah"
@ -178,7 +178,7 @@ msgstr "%q musí být string"
msgid "%q must be an int" msgid "%q must be an int"
msgstr "%q musí být int" msgstr "%q musí být int"
#: py/argcheck.c #: py/argcheck.c py/obj.c
msgid "%q must be of type %q" msgid "%q must be of type %q"
msgstr "%q musí být typu %q" msgstr "%q musí být typu %q"
@ -1679,6 +1679,10 @@ msgstr ""
msgid "Operation timed out" msgid "Operation timed out"
msgstr "" msgstr ""
#: ports/raspberrypi/common-hal/mdns/Server.c
msgid "Out of MDNS service slots"
msgstr ""
#: ports/espressif/common-hal/espidf/__init__.c ports/espressif/esp_error.c #: ports/espressif/common-hal/espidf/__init__.c ports/espressif/esp_error.c
msgid "Out of memory" msgid "Out of memory"
msgstr "" msgstr ""
@ -2210,6 +2214,7 @@ msgid "Unable to read color palette data"
msgstr "" msgstr ""
#: ports/espressif/common-hal/mdns/Server.c #: ports/espressif/common-hal/mdns/Server.c
#: ports/raspberrypi/common-hal/mdns/Server.c
msgid "Unable to start mDNS query" msgid "Unable to start mDNS query"
msgstr "" msgstr ""
@ -3171,7 +3176,7 @@ msgid "index is out of bounds"
msgstr "" msgstr ""
#: extmod/ulab/code/numpy/numerical.c extmod/ulab/code/ulab_tools.c #: extmod/ulab/code/numpy/numerical.c extmod/ulab/code/ulab_tools.c
#: ports/espressif/common-hal/pulseio/PulseIn.c py/obj.c #: ports/espressif/common-hal/pulseio/PulseIn.c
#: shared-bindings/bitmaptools/__init__.c #: shared-bindings/bitmaptools/__init__.c
msgid "index out of range" msgid "index out of range"
msgstr "" msgstr ""
@ -3423,10 +3428,12 @@ msgid "loopback + silent mode not supported by peripheral"
msgstr "" msgstr ""
#: ports/espressif/common-hal/mdns/Server.c #: ports/espressif/common-hal/mdns/Server.c
#: ports/raspberrypi/common-hal/mdns/Server.c
msgid "mDNS already initialized" msgid "mDNS already initialized"
msgstr "" msgstr ""
#: ports/espressif/common-hal/mdns/Server.c #: ports/espressif/common-hal/mdns/Server.c
#: ports/raspberrypi/common-hal/mdns/Server.c
msgid "mDNS only works with built-in WiFi" msgid "mDNS only works with built-in WiFi"
msgstr "" msgstr ""

View File

@ -114,7 +114,7 @@ msgstr "%q Fehler: %d"
msgid "%q in use" msgid "%q in use"
msgstr "%q in Benutzung" msgstr "%q in Benutzung"
#: py/obj.c py/objstr.c py/objstrunicode.c #: py/objstr.c py/objstrunicode.c
msgid "%q index out of range" msgid "%q index out of range"
msgstr "Der Index %q befindet sich außerhalb des Bereiches" msgstr "Der Index %q befindet sich außerhalb des Bereiches"
@ -180,7 +180,7 @@ msgstr "%q muss ein String sein"
msgid "%q must be an int" msgid "%q must be an int"
msgstr "%q muss vom Typ Integer sein" msgstr "%q muss vom Typ Integer sein"
#: py/argcheck.c #: py/argcheck.c py/obj.c
msgid "%q must be of type %q" msgid "%q must be of type %q"
msgstr "%q muss vom Type %q sein" msgstr "%q muss vom Type %q sein"
@ -1700,6 +1700,10 @@ msgstr "Vorgang oder Funktion wird nicht unterstützt"
msgid "Operation timed out" msgid "Operation timed out"
msgstr "Zeit für Vorgang abgelaufen" msgstr "Zeit für Vorgang abgelaufen"
#: ports/raspberrypi/common-hal/mdns/Server.c
msgid "Out of MDNS service slots"
msgstr ""
#: ports/espressif/common-hal/espidf/__init__.c ports/espressif/esp_error.c #: ports/espressif/common-hal/espidf/__init__.c ports/espressif/esp_error.c
msgid "Out of memory" msgid "Out of memory"
msgstr "Kein Speicher mehr verfügbar" msgstr "Kein Speicher mehr verfügbar"
@ -2249,6 +2253,7 @@ msgid "Unable to read color palette data"
msgstr "Konnte Farbpalettendaten nicht lesen" msgstr "Konnte Farbpalettendaten nicht lesen"
#: ports/espressif/common-hal/mdns/Server.c #: ports/espressif/common-hal/mdns/Server.c
#: ports/raspberrypi/common-hal/mdns/Server.c
msgid "Unable to start mDNS query" msgid "Unable to start mDNS query"
msgstr "mDNS-Abfrage kann nicht gestartet werden" msgstr "mDNS-Abfrage kann nicht gestartet werden"
@ -3242,7 +3247,7 @@ msgid "index is out of bounds"
msgstr "Index ist außerhalb der Grenzen" msgstr "Index ist außerhalb der Grenzen"
#: extmod/ulab/code/numpy/numerical.c extmod/ulab/code/ulab_tools.c #: extmod/ulab/code/numpy/numerical.c extmod/ulab/code/ulab_tools.c
#: ports/espressif/common-hal/pulseio/PulseIn.c py/obj.c #: ports/espressif/common-hal/pulseio/PulseIn.c
#: shared-bindings/bitmaptools/__init__.c #: shared-bindings/bitmaptools/__init__.c
msgid "index out of range" msgid "index out of range"
msgstr "index außerhalb der Reichweite" msgstr "index außerhalb der Reichweite"
@ -3500,10 +3505,12 @@ msgid "loopback + silent mode not supported by peripheral"
msgstr "Loopback + Silent Mode wird vom Peripheriegerät nicht unterstützt" msgstr "Loopback + Silent Mode wird vom Peripheriegerät nicht unterstützt"
#: ports/espressif/common-hal/mdns/Server.c #: ports/espressif/common-hal/mdns/Server.c
#: ports/raspberrypi/common-hal/mdns/Server.c
msgid "mDNS already initialized" msgid "mDNS already initialized"
msgstr "mDNS bereits initialisiert" msgstr "mDNS bereits initialisiert"
#: ports/espressif/common-hal/mdns/Server.c #: ports/espressif/common-hal/mdns/Server.c
#: ports/raspberrypi/common-hal/mdns/Server.c
msgid "mDNS only works with built-in WiFi" msgid "mDNS only works with built-in WiFi"
msgstr "mDNS funktioniert nur mit integriertem WiFi" msgstr "mDNS funktioniert nur mit integriertem WiFi"

View File

@ -118,7 +118,7 @@ msgstr "%q αποτυχία: %d"
msgid "%q in use" msgid "%q in use"
msgstr "%q είναι σε χρήση" msgstr "%q είναι σε χρήση"
#: py/obj.c py/objstr.c py/objstrunicode.c #: py/objstr.c py/objstrunicode.c
msgid "%q index out of range" msgid "%q index out of range"
msgstr "%q δείκτης εκτός εμβέλειας" msgstr "%q δείκτης εκτός εμβέλειας"
@ -183,7 +183,7 @@ msgstr "%q πρέπει να είναι string"
msgid "%q must be an int" msgid "%q must be an int"
msgstr "%q πρέπει να είναι int" msgstr "%q πρέπει να είναι int"
#: py/argcheck.c #: py/argcheck.c py/obj.c
msgid "%q must be of type %q" msgid "%q must be of type %q"
msgstr "%q πρέπει να είναι τύπου %q" msgstr "%q πρέπει να είναι τύπου %q"
@ -1688,6 +1688,10 @@ msgstr ""
msgid "Operation timed out" msgid "Operation timed out"
msgstr "" msgstr ""
#: ports/raspberrypi/common-hal/mdns/Server.c
msgid "Out of MDNS service slots"
msgstr ""
#: ports/espressif/common-hal/espidf/__init__.c ports/espressif/esp_error.c #: ports/espressif/common-hal/espidf/__init__.c ports/espressif/esp_error.c
msgid "Out of memory" msgid "Out of memory"
msgstr "" msgstr ""
@ -2219,6 +2223,7 @@ msgid "Unable to read color palette data"
msgstr "" msgstr ""
#: ports/espressif/common-hal/mdns/Server.c #: ports/espressif/common-hal/mdns/Server.c
#: ports/raspberrypi/common-hal/mdns/Server.c
msgid "Unable to start mDNS query" msgid "Unable to start mDNS query"
msgstr "" msgstr ""
@ -3180,7 +3185,7 @@ msgid "index is out of bounds"
msgstr "" msgstr ""
#: extmod/ulab/code/numpy/numerical.c extmod/ulab/code/ulab_tools.c #: extmod/ulab/code/numpy/numerical.c extmod/ulab/code/ulab_tools.c
#: ports/espressif/common-hal/pulseio/PulseIn.c py/obj.c #: ports/espressif/common-hal/pulseio/PulseIn.c
#: shared-bindings/bitmaptools/__init__.c #: shared-bindings/bitmaptools/__init__.c
msgid "index out of range" msgid "index out of range"
msgstr "" msgstr ""
@ -3432,10 +3437,12 @@ msgid "loopback + silent mode not supported by peripheral"
msgstr "" msgstr ""
#: ports/espressif/common-hal/mdns/Server.c #: ports/espressif/common-hal/mdns/Server.c
#: ports/raspberrypi/common-hal/mdns/Server.c
msgid "mDNS already initialized" msgid "mDNS already initialized"
msgstr "" msgstr ""
#: ports/espressif/common-hal/mdns/Server.c #: ports/espressif/common-hal/mdns/Server.c
#: ports/raspberrypi/common-hal/mdns/Server.c
msgid "mDNS only works with built-in WiFi" msgid "mDNS only works with built-in WiFi"
msgstr "" msgstr ""

View File

@ -116,7 +116,7 @@ msgstr "%q failure: %d"
msgid "%q in use" msgid "%q in use"
msgstr "%q in use" msgstr "%q in use"
#: py/obj.c py/objstr.c py/objstrunicode.c #: py/objstr.c py/objstrunicode.c
msgid "%q index out of range" msgid "%q index out of range"
msgstr "%q index out of range" msgstr "%q index out of range"
@ -181,7 +181,7 @@ msgstr "%q must be a string"
msgid "%q must be an int" msgid "%q must be an int"
msgstr "" msgstr ""
#: py/argcheck.c #: py/argcheck.c py/obj.c
msgid "%q must be of type %q" msgid "%q must be of type %q"
msgstr "" msgstr ""
@ -1683,6 +1683,10 @@ msgstr "Operation or feature not supported"
msgid "Operation timed out" msgid "Operation timed out"
msgstr "Operation timed out" msgstr "Operation timed out"
#: ports/raspberrypi/common-hal/mdns/Server.c
msgid "Out of MDNS service slots"
msgstr ""
#: ports/espressif/common-hal/espidf/__init__.c ports/espressif/esp_error.c #: ports/espressif/common-hal/espidf/__init__.c ports/espressif/esp_error.c
msgid "Out of memory" msgid "Out of memory"
msgstr "Out of memory" msgstr "Out of memory"
@ -2223,6 +2227,7 @@ msgid "Unable to read color palette data"
msgstr "Unable to read colour palette data" msgstr "Unable to read colour palette data"
#: ports/espressif/common-hal/mdns/Server.c #: ports/espressif/common-hal/mdns/Server.c
#: ports/raspberrypi/common-hal/mdns/Server.c
msgid "Unable to start mDNS query" msgid "Unable to start mDNS query"
msgstr "" msgstr ""
@ -3190,7 +3195,7 @@ msgid "index is out of bounds"
msgstr "index is out of bounds" msgstr "index is out of bounds"
#: extmod/ulab/code/numpy/numerical.c extmod/ulab/code/ulab_tools.c #: extmod/ulab/code/numpy/numerical.c extmod/ulab/code/ulab_tools.c
#: ports/espressif/common-hal/pulseio/PulseIn.c py/obj.c #: ports/espressif/common-hal/pulseio/PulseIn.c
#: shared-bindings/bitmaptools/__init__.c #: shared-bindings/bitmaptools/__init__.c
msgid "index out of range" msgid "index out of range"
msgstr "index out of range" msgstr "index out of range"
@ -3442,10 +3447,12 @@ msgid "loopback + silent mode not supported by peripheral"
msgstr "loopback + silent mode not supported by peripheral" msgstr "loopback + silent mode not supported by peripheral"
#: ports/espressif/common-hal/mdns/Server.c #: ports/espressif/common-hal/mdns/Server.c
#: ports/raspberrypi/common-hal/mdns/Server.c
msgid "mDNS already initialized" msgid "mDNS already initialized"
msgstr "" msgstr ""
#: ports/espressif/common-hal/mdns/Server.c #: ports/espressif/common-hal/mdns/Server.c
#: ports/raspberrypi/common-hal/mdns/Server.c
msgid "mDNS only works with built-in WiFi" msgid "mDNS only works with built-in WiFi"
msgstr "" msgstr ""

View File

@ -118,7 +118,7 @@ msgstr "%q fallo: %d"
msgid "%q in use" msgid "%q in use"
msgstr "%q está siendo utilizado" msgstr "%q está siendo utilizado"
#: py/obj.c py/objstr.c py/objstrunicode.c #: py/objstr.c py/objstrunicode.c
msgid "%q index out of range" msgid "%q index out of range"
msgstr "%q indice fuera de rango" msgstr "%q indice fuera de rango"
@ -183,7 +183,7 @@ msgstr "%q debe ser una cadena"
msgid "%q must be an int" msgid "%q must be an int"
msgstr "" msgstr ""
#: py/argcheck.c #: py/argcheck.c py/obj.c
msgid "%q must be of type %q" msgid "%q must be of type %q"
msgstr "" msgstr ""
@ -1707,6 +1707,10 @@ msgstr "Operación no característica no soportada"
msgid "Operation timed out" msgid "Operation timed out"
msgstr "Tiempo de espera agotado" msgstr "Tiempo de espera agotado"
#: ports/raspberrypi/common-hal/mdns/Server.c
msgid "Out of MDNS service slots"
msgstr ""
#: ports/espressif/common-hal/espidf/__init__.c ports/espressif/esp_error.c #: ports/espressif/common-hal/espidf/__init__.c ports/espressif/esp_error.c
msgid "Out of memory" msgid "Out of memory"
msgstr "Memoria agotada" msgstr "Memoria agotada"
@ -2255,6 +2259,7 @@ msgid "Unable to read color palette data"
msgstr "No se pudo leer los datos de la paleta de colores" msgstr "No se pudo leer los datos de la paleta de colores"
#: ports/espressif/common-hal/mdns/Server.c #: ports/espressif/common-hal/mdns/Server.c
#: ports/raspberrypi/common-hal/mdns/Server.c
msgid "Unable to start mDNS query" msgid "Unable to start mDNS query"
msgstr "" msgstr ""
@ -3230,7 +3235,7 @@ msgid "index is out of bounds"
msgstr "el índice está fuera de límites" msgstr "el índice está fuera de límites"
#: extmod/ulab/code/numpy/numerical.c extmod/ulab/code/ulab_tools.c #: extmod/ulab/code/numpy/numerical.c extmod/ulab/code/ulab_tools.c
#: ports/espressif/common-hal/pulseio/PulseIn.c py/obj.c #: ports/espressif/common-hal/pulseio/PulseIn.c
#: shared-bindings/bitmaptools/__init__.c #: shared-bindings/bitmaptools/__init__.c
msgid "index out of range" msgid "index out of range"
msgstr "index fuera de rango" msgstr "index fuera de rango"
@ -3485,10 +3490,12 @@ msgid "loopback + silent mode not supported by peripheral"
msgstr "Loopback + modo silencioso no están soportados por periférico" msgstr "Loopback + modo silencioso no están soportados por periférico"
#: ports/espressif/common-hal/mdns/Server.c #: ports/espressif/common-hal/mdns/Server.c
#: ports/raspberrypi/common-hal/mdns/Server.c
msgid "mDNS already initialized" msgid "mDNS already initialized"
msgstr "" msgstr ""
#: ports/espressif/common-hal/mdns/Server.c #: ports/espressif/common-hal/mdns/Server.c
#: ports/raspberrypi/common-hal/mdns/Server.c
msgid "mDNS only works with built-in WiFi" msgid "mDNS only works with built-in WiFi"
msgstr "" msgstr ""

View File

@ -107,7 +107,7 @@ msgstr ""
msgid "%q in use" msgid "%q in use"
msgstr "%q ay ginagamit" msgstr "%q ay ginagamit"
#: py/obj.c py/objstr.c py/objstrunicode.c #: py/objstr.c py/objstrunicode.c
msgid "%q index out of range" msgid "%q index out of range"
msgstr "%q indeks wala sa sakop" msgstr "%q indeks wala sa sakop"
@ -172,7 +172,7 @@ msgstr ""
msgid "%q must be an int" msgid "%q must be an int"
msgstr "" msgstr ""
#: py/argcheck.c #: py/argcheck.c py/obj.c
msgid "%q must be of type %q" msgid "%q must be of type %q"
msgstr "" msgstr ""
@ -1678,6 +1678,10 @@ msgstr ""
msgid "Operation timed out" msgid "Operation timed out"
msgstr "" msgstr ""
#: ports/raspberrypi/common-hal/mdns/Server.c
msgid "Out of MDNS service slots"
msgstr ""
#: ports/espressif/common-hal/espidf/__init__.c ports/espressif/esp_error.c #: ports/espressif/common-hal/espidf/__init__.c ports/espressif/esp_error.c
msgid "Out of memory" msgid "Out of memory"
msgstr "" msgstr ""
@ -2209,6 +2213,7 @@ msgid "Unable to read color palette data"
msgstr "" msgstr ""
#: ports/espressif/common-hal/mdns/Server.c #: ports/espressif/common-hal/mdns/Server.c
#: ports/raspberrypi/common-hal/mdns/Server.c
msgid "Unable to start mDNS query" msgid "Unable to start mDNS query"
msgstr "" msgstr ""
@ -3184,7 +3189,7 @@ msgid "index is out of bounds"
msgstr "" msgstr ""
#: extmod/ulab/code/numpy/numerical.c extmod/ulab/code/ulab_tools.c #: extmod/ulab/code/numpy/numerical.c extmod/ulab/code/ulab_tools.c
#: ports/espressif/common-hal/pulseio/PulseIn.c py/obj.c #: ports/espressif/common-hal/pulseio/PulseIn.c
#: shared-bindings/bitmaptools/__init__.c #: shared-bindings/bitmaptools/__init__.c
msgid "index out of range" msgid "index out of range"
msgstr "index wala sa sakop" msgstr "index wala sa sakop"
@ -3440,10 +3445,12 @@ msgid "loopback + silent mode not supported by peripheral"
msgstr "" msgstr ""
#: ports/espressif/common-hal/mdns/Server.c #: ports/espressif/common-hal/mdns/Server.c
#: ports/raspberrypi/common-hal/mdns/Server.c
msgid "mDNS already initialized" msgid "mDNS already initialized"
msgstr "" msgstr ""
#: ports/espressif/common-hal/mdns/Server.c #: ports/espressif/common-hal/mdns/Server.c
#: ports/raspberrypi/common-hal/mdns/Server.c
msgid "mDNS only works with built-in WiFi" msgid "mDNS only works with built-in WiFi"
msgstr "" msgstr ""

View File

@ -118,7 +118,7 @@ msgstr "Échec de %q : %d"
msgid "%q in use" msgid "%q in use"
msgstr "%q en cours d'utilisation" msgstr "%q en cours d'utilisation"
#: py/obj.c py/objstr.c py/objstrunicode.c #: py/objstr.c py/objstrunicode.c
msgid "%q index out of range" msgid "%q index out of range"
msgstr "index %q hors de portée" msgstr "index %q hors de portée"
@ -183,7 +183,7 @@ msgstr "%q doit être une chaîne de caractères"
msgid "%q must be an int" msgid "%q must be an int"
msgstr "%q doit être un entier" msgstr "%q doit être un entier"
#: py/argcheck.c #: py/argcheck.c py/obj.c
msgid "%q must be of type %q" msgid "%q must be of type %q"
msgstr "%q doit être du type %q" msgstr "%q doit être du type %q"
@ -1727,6 +1727,10 @@ msgstr "Opération ou fonction non supportée"
msgid "Operation timed out" msgid "Operation timed out"
msgstr "Timeout de l'opération" msgstr "Timeout de l'opération"
#: ports/raspberrypi/common-hal/mdns/Server.c
msgid "Out of MDNS service slots"
msgstr ""
#: ports/espressif/common-hal/espidf/__init__.c ports/espressif/esp_error.c #: ports/espressif/common-hal/espidf/__init__.c ports/espressif/esp_error.c
msgid "Out of memory" msgid "Out of memory"
msgstr "Mémoire insuffisante" msgstr "Mémoire insuffisante"
@ -2280,6 +2284,7 @@ msgid "Unable to read color palette data"
msgstr "Impossible de lire les données de la palette de couleurs" msgstr "Impossible de lire les données de la palette de couleurs"
#: ports/espressif/common-hal/mdns/Server.c #: ports/espressif/common-hal/mdns/Server.c
#: ports/raspberrypi/common-hal/mdns/Server.c
msgid "Unable to start mDNS query" msgid "Unable to start mDNS query"
msgstr "Impossible de lancer la requête mDNS" msgstr "Impossible de lancer la requête mDNS"
@ -3270,7 +3275,7 @@ msgid "index is out of bounds"
msgstr "l'index est hors limites" msgstr "l'index est hors limites"
#: extmod/ulab/code/numpy/numerical.c extmod/ulab/code/ulab_tools.c #: extmod/ulab/code/numpy/numerical.c extmod/ulab/code/ulab_tools.c
#: ports/espressif/common-hal/pulseio/PulseIn.c py/obj.c #: ports/espressif/common-hal/pulseio/PulseIn.c
#: shared-bindings/bitmaptools/__init__.c #: shared-bindings/bitmaptools/__init__.c
msgid "index out of range" msgid "index out of range"
msgstr "index est hors bornes" msgstr "index est hors bornes"
@ -3529,10 +3534,12 @@ msgid "loopback + silent mode not supported by peripheral"
msgstr "loopback + silent mode non pris en charge par le périphérique" msgstr "loopback + silent mode non pris en charge par le périphérique"
#: ports/espressif/common-hal/mdns/Server.c #: ports/espressif/common-hal/mdns/Server.c
#: ports/raspberrypi/common-hal/mdns/Server.c
msgid "mDNS already initialized" msgid "mDNS already initialized"
msgstr "mDNS a déjà été initialisé" msgstr "mDNS a déjà été initialisé"
#: ports/espressif/common-hal/mdns/Server.c #: ports/espressif/common-hal/mdns/Server.c
#: ports/raspberrypi/common-hal/mdns/Server.c
msgid "mDNS only works with built-in WiFi" msgid "mDNS only works with built-in WiFi"
msgstr "mDNS ne fonctionne que avec le WiFi intégré" msgstr "mDNS ne fonctionne que avec le WiFi intégré"

View File

@ -106,7 +106,7 @@ msgstr ""
msgid "%q in use" msgid "%q in use"
msgstr "" msgstr ""
#: py/obj.c py/objstr.c py/objstrunicode.c #: py/objstr.c py/objstrunicode.c
msgid "%q index out of range" msgid "%q index out of range"
msgstr "" msgstr ""
@ -171,7 +171,7 @@ msgstr ""
msgid "%q must be an int" msgid "%q must be an int"
msgstr "" msgstr ""
#: py/argcheck.c #: py/argcheck.c py/obj.c
msgid "%q must be of type %q" msgid "%q must be of type %q"
msgstr "" msgstr ""
@ -1663,6 +1663,10 @@ msgstr ""
msgid "Operation timed out" msgid "Operation timed out"
msgstr "" msgstr ""
#: ports/raspberrypi/common-hal/mdns/Server.c
msgid "Out of MDNS service slots"
msgstr ""
#: ports/espressif/common-hal/espidf/__init__.c ports/espressif/esp_error.c #: ports/espressif/common-hal/espidf/__init__.c ports/espressif/esp_error.c
msgid "Out of memory" msgid "Out of memory"
msgstr "" msgstr ""
@ -2192,6 +2196,7 @@ msgid "Unable to read color palette data"
msgstr "" msgstr ""
#: ports/espressif/common-hal/mdns/Server.c #: ports/espressif/common-hal/mdns/Server.c
#: ports/raspberrypi/common-hal/mdns/Server.c
msgid "Unable to start mDNS query" msgid "Unable to start mDNS query"
msgstr "" msgstr ""
@ -3153,7 +3158,7 @@ msgid "index is out of bounds"
msgstr "" msgstr ""
#: extmod/ulab/code/numpy/numerical.c extmod/ulab/code/ulab_tools.c #: extmod/ulab/code/numpy/numerical.c extmod/ulab/code/ulab_tools.c
#: ports/espressif/common-hal/pulseio/PulseIn.c py/obj.c #: ports/espressif/common-hal/pulseio/PulseIn.c
#: shared-bindings/bitmaptools/__init__.c #: shared-bindings/bitmaptools/__init__.c
msgid "index out of range" msgid "index out of range"
msgstr "" msgstr ""
@ -3405,10 +3410,12 @@ msgid "loopback + silent mode not supported by peripheral"
msgstr "" msgstr ""
#: ports/espressif/common-hal/mdns/Server.c #: ports/espressif/common-hal/mdns/Server.c
#: ports/raspberrypi/common-hal/mdns/Server.c
msgid "mDNS already initialized" msgid "mDNS already initialized"
msgstr "" msgstr ""
#: ports/espressif/common-hal/mdns/Server.c #: ports/espressif/common-hal/mdns/Server.c
#: ports/raspberrypi/common-hal/mdns/Server.c
msgid "mDNS only works with built-in WiFi" msgid "mDNS only works with built-in WiFi"
msgstr "" msgstr ""

View File

@ -113,7 +113,7 @@ msgstr "%q fallito: %d"
msgid "%q in use" msgid "%q in use"
msgstr "%q in uso" msgstr "%q in uso"
#: py/obj.c py/objstr.c py/objstrunicode.c #: py/objstr.c py/objstrunicode.c
msgid "%q index out of range" msgid "%q index out of range"
msgstr "indice %q fuori intervallo" msgstr "indice %q fuori intervallo"
@ -178,7 +178,7 @@ msgstr ""
msgid "%q must be an int" msgid "%q must be an int"
msgstr "" msgstr ""
#: py/argcheck.c #: py/argcheck.c py/obj.c
msgid "%q must be of type %q" msgid "%q must be of type %q"
msgstr "" msgstr ""
@ -1685,6 +1685,10 @@ msgstr ""
msgid "Operation timed out" msgid "Operation timed out"
msgstr "" msgstr ""
#: ports/raspberrypi/common-hal/mdns/Server.c
msgid "Out of MDNS service slots"
msgstr ""
#: ports/espressif/common-hal/espidf/__init__.c ports/espressif/esp_error.c #: ports/espressif/common-hal/espidf/__init__.c ports/espressif/esp_error.c
msgid "Out of memory" msgid "Out of memory"
msgstr "" msgstr ""
@ -2219,6 +2223,7 @@ msgid "Unable to read color palette data"
msgstr "" msgstr ""
#: ports/espressif/common-hal/mdns/Server.c #: ports/espressif/common-hal/mdns/Server.c
#: ports/raspberrypi/common-hal/mdns/Server.c
msgid "Unable to start mDNS query" msgid "Unable to start mDNS query"
msgstr "" msgstr ""
@ -3192,7 +3197,7 @@ msgid "index is out of bounds"
msgstr "" msgstr ""
#: extmod/ulab/code/numpy/numerical.c extmod/ulab/code/ulab_tools.c #: extmod/ulab/code/numpy/numerical.c extmod/ulab/code/ulab_tools.c
#: ports/espressif/common-hal/pulseio/PulseIn.c py/obj.c #: ports/espressif/common-hal/pulseio/PulseIn.c
#: shared-bindings/bitmaptools/__init__.c #: shared-bindings/bitmaptools/__init__.c
msgid "index out of range" msgid "index out of range"
msgstr "indice fuori intervallo" msgstr "indice fuori intervallo"
@ -3449,10 +3454,12 @@ msgid "loopback + silent mode not supported by peripheral"
msgstr "" msgstr ""
#: ports/espressif/common-hal/mdns/Server.c #: ports/espressif/common-hal/mdns/Server.c
#: ports/raspberrypi/common-hal/mdns/Server.c
msgid "mDNS already initialized" msgid "mDNS already initialized"
msgstr "" msgstr ""
#: ports/espressif/common-hal/mdns/Server.c #: ports/espressif/common-hal/mdns/Server.c
#: ports/raspberrypi/common-hal/mdns/Server.c
msgid "mDNS only works with built-in WiFi" msgid "mDNS only works with built-in WiFi"
msgstr "" msgstr ""

View File

@ -111,7 +111,7 @@ msgstr "%q 失敗: %d"
msgid "%q in use" msgid "%q in use"
msgstr "%qは使用中" msgstr "%qは使用中"
#: py/obj.c py/objstr.c py/objstrunicode.c #: py/objstr.c py/objstrunicode.c
msgid "%q index out of range" msgid "%q index out of range"
msgstr "%q インデックスは範囲外" msgstr "%q インデックスは範囲外"
@ -176,7 +176,7 @@ msgstr ""
msgid "%q must be an int" msgid "%q must be an int"
msgstr "" msgstr ""
#: py/argcheck.c #: py/argcheck.c py/obj.c
msgid "%q must be of type %q" msgid "%q must be of type %q"
msgstr "" msgstr ""
@ -1676,6 +1676,10 @@ msgstr ""
msgid "Operation timed out" msgid "Operation timed out"
msgstr "" msgstr ""
#: ports/raspberrypi/common-hal/mdns/Server.c
msgid "Out of MDNS service slots"
msgstr ""
#: ports/espressif/common-hal/espidf/__init__.c ports/espressif/esp_error.c #: ports/espressif/common-hal/espidf/__init__.c ports/espressif/esp_error.c
msgid "Out of memory" msgid "Out of memory"
msgstr "" msgstr ""
@ -2206,6 +2210,7 @@ msgid "Unable to read color palette data"
msgstr "カラーパレットデータを読み込めません" msgstr "カラーパレットデータを読み込めません"
#: ports/espressif/common-hal/mdns/Server.c #: ports/espressif/common-hal/mdns/Server.c
#: ports/raspberrypi/common-hal/mdns/Server.c
msgid "Unable to start mDNS query" msgid "Unable to start mDNS query"
msgstr "" msgstr ""
@ -3171,7 +3176,7 @@ msgid "index is out of bounds"
msgstr "" msgstr ""
#: extmod/ulab/code/numpy/numerical.c extmod/ulab/code/ulab_tools.c #: extmod/ulab/code/numpy/numerical.c extmod/ulab/code/ulab_tools.c
#: ports/espressif/common-hal/pulseio/PulseIn.c py/obj.c #: ports/espressif/common-hal/pulseio/PulseIn.c
#: shared-bindings/bitmaptools/__init__.c #: shared-bindings/bitmaptools/__init__.c
msgid "index out of range" msgid "index out of range"
msgstr "インデクスが範囲外" msgstr "インデクスが範囲外"
@ -3424,10 +3429,12 @@ msgid "loopback + silent mode not supported by peripheral"
msgstr "" msgstr ""
#: ports/espressif/common-hal/mdns/Server.c #: ports/espressif/common-hal/mdns/Server.c
#: ports/raspberrypi/common-hal/mdns/Server.c
msgid "mDNS already initialized" msgid "mDNS already initialized"
msgstr "" msgstr ""
#: ports/espressif/common-hal/mdns/Server.c #: ports/espressif/common-hal/mdns/Server.c
#: ports/raspberrypi/common-hal/mdns/Server.c
msgid "mDNS only works with built-in WiFi" msgid "mDNS only works with built-in WiFi"
msgstr "" msgstr ""

View File

@ -107,7 +107,7 @@ msgstr ""
msgid "%q in use" msgid "%q in use"
msgstr "%q 사용 중입니다" msgstr "%q 사용 중입니다"
#: py/obj.c py/objstr.c py/objstrunicode.c #: py/objstr.c py/objstrunicode.c
msgid "%q index out of range" msgid "%q index out of range"
msgstr "%q 인덱스 범위를 벗어났습니다" msgstr "%q 인덱스 범위를 벗어났습니다"
@ -172,7 +172,7 @@ msgstr ""
msgid "%q must be an int" msgid "%q must be an int"
msgstr "" msgstr ""
#: py/argcheck.c #: py/argcheck.c py/obj.c
msgid "%q must be of type %q" msgid "%q must be of type %q"
msgstr "" msgstr ""
@ -1666,6 +1666,10 @@ msgstr ""
msgid "Operation timed out" msgid "Operation timed out"
msgstr "" msgstr ""
#: ports/raspberrypi/common-hal/mdns/Server.c
msgid "Out of MDNS service slots"
msgstr ""
#: ports/espressif/common-hal/espidf/__init__.c ports/espressif/esp_error.c #: ports/espressif/common-hal/espidf/__init__.c ports/espressif/esp_error.c
msgid "Out of memory" msgid "Out of memory"
msgstr "" msgstr ""
@ -2196,6 +2200,7 @@ msgid "Unable to read color palette data"
msgstr "" msgstr ""
#: ports/espressif/common-hal/mdns/Server.c #: ports/espressif/common-hal/mdns/Server.c
#: ports/raspberrypi/common-hal/mdns/Server.c
msgid "Unable to start mDNS query" msgid "Unable to start mDNS query"
msgstr "" msgstr ""
@ -3157,7 +3162,7 @@ msgid "index is out of bounds"
msgstr "" msgstr ""
#: extmod/ulab/code/numpy/numerical.c extmod/ulab/code/ulab_tools.c #: extmod/ulab/code/numpy/numerical.c extmod/ulab/code/ulab_tools.c
#: ports/espressif/common-hal/pulseio/PulseIn.c py/obj.c #: ports/espressif/common-hal/pulseio/PulseIn.c
#: shared-bindings/bitmaptools/__init__.c #: shared-bindings/bitmaptools/__init__.c
msgid "index out of range" msgid "index out of range"
msgstr "" msgstr ""
@ -3409,10 +3414,12 @@ msgid "loopback + silent mode not supported by peripheral"
msgstr "" msgstr ""
#: ports/espressif/common-hal/mdns/Server.c #: ports/espressif/common-hal/mdns/Server.c
#: ports/raspberrypi/common-hal/mdns/Server.c
msgid "mDNS already initialized" msgid "mDNS already initialized"
msgstr "" msgstr ""
#: ports/espressif/common-hal/mdns/Server.c #: ports/espressif/common-hal/mdns/Server.c
#: ports/raspberrypi/common-hal/mdns/Server.c
msgid "mDNS only works with built-in WiFi" msgid "mDNS only works with built-in WiFi"
msgstr "" msgstr ""

View File

@ -109,7 +109,7 @@ msgstr "%q fout: %d"
msgid "%q in use" msgid "%q in use"
msgstr "%q in gebruik" msgstr "%q in gebruik"
#: py/obj.c py/objstr.c py/objstrunicode.c #: py/objstr.c py/objstrunicode.c
msgid "%q index out of range" msgid "%q index out of range"
msgstr "%q index buiten bereik" msgstr "%q index buiten bereik"
@ -174,7 +174,7 @@ msgstr ""
msgid "%q must be an int" msgid "%q must be an int"
msgstr "" msgstr ""
#: py/argcheck.c #: py/argcheck.c py/obj.c
msgid "%q must be of type %q" msgid "%q must be of type %q"
msgstr "" msgstr ""
@ -1680,6 +1680,10 @@ msgstr ""
msgid "Operation timed out" msgid "Operation timed out"
msgstr "" msgstr ""
#: ports/raspberrypi/common-hal/mdns/Server.c
msgid "Out of MDNS service slots"
msgstr ""
#: ports/espressif/common-hal/espidf/__init__.c ports/espressif/esp_error.c #: ports/espressif/common-hal/espidf/__init__.c ports/espressif/esp_error.c
msgid "Out of memory" msgid "Out of memory"
msgstr "" msgstr ""
@ -2216,6 +2220,7 @@ msgid "Unable to read color palette data"
msgstr "Niet in staat kleurenpalet data te lezen" msgstr "Niet in staat kleurenpalet data te lezen"
#: ports/espressif/common-hal/mdns/Server.c #: ports/espressif/common-hal/mdns/Server.c
#: ports/raspberrypi/common-hal/mdns/Server.c
msgid "Unable to start mDNS query" msgid "Unable to start mDNS query"
msgstr "" msgstr ""
@ -3187,7 +3192,7 @@ msgid "index is out of bounds"
msgstr "index is buiten bereik" msgstr "index is buiten bereik"
#: extmod/ulab/code/numpy/numerical.c extmod/ulab/code/ulab_tools.c #: extmod/ulab/code/numpy/numerical.c extmod/ulab/code/ulab_tools.c
#: ports/espressif/common-hal/pulseio/PulseIn.c py/obj.c #: ports/espressif/common-hal/pulseio/PulseIn.c
#: shared-bindings/bitmaptools/__init__.c #: shared-bindings/bitmaptools/__init__.c
msgid "index out of range" msgid "index out of range"
msgstr "index is buiten bereik" msgstr "index is buiten bereik"
@ -3442,10 +3447,12 @@ msgid "loopback + silent mode not supported by peripheral"
msgstr "loopback + silent mode wordt niet ondersteund door randapparaat" msgstr "loopback + silent mode wordt niet ondersteund door randapparaat"
#: ports/espressif/common-hal/mdns/Server.c #: ports/espressif/common-hal/mdns/Server.c
#: ports/raspberrypi/common-hal/mdns/Server.c
msgid "mDNS already initialized" msgid "mDNS already initialized"
msgstr "" msgstr ""
#: ports/espressif/common-hal/mdns/Server.c #: ports/espressif/common-hal/mdns/Server.c
#: ports/raspberrypi/common-hal/mdns/Server.c
msgid "mDNS only works with built-in WiFi" msgid "mDNS only works with built-in WiFi"
msgstr "" msgstr ""

View File

@ -111,7 +111,7 @@ msgstr "%q niepowodzenie: %d"
msgid "%q in use" msgid "%q in use"
msgstr "%q w użyciu" msgstr "%q w użyciu"
#: py/obj.c py/objstr.c py/objstrunicode.c #: py/objstr.c py/objstrunicode.c
msgid "%q index out of range" msgid "%q index out of range"
msgstr "%q poza zakresem" msgstr "%q poza zakresem"
@ -176,7 +176,7 @@ msgstr ""
msgid "%q must be an int" msgid "%q must be an int"
msgstr "" msgstr ""
#: py/argcheck.c #: py/argcheck.c py/obj.c
msgid "%q must be of type %q" msgid "%q must be of type %q"
msgstr "" msgstr ""
@ -1674,6 +1674,10 @@ msgstr ""
msgid "Operation timed out" msgid "Operation timed out"
msgstr "" msgstr ""
#: ports/raspberrypi/common-hal/mdns/Server.c
msgid "Out of MDNS service slots"
msgstr ""
#: ports/espressif/common-hal/espidf/__init__.c ports/espressif/esp_error.c #: ports/espressif/common-hal/espidf/__init__.c ports/espressif/esp_error.c
msgid "Out of memory" msgid "Out of memory"
msgstr "Brak pamięci" msgstr "Brak pamięci"
@ -2203,6 +2207,7 @@ msgid "Unable to read color palette data"
msgstr "Nie można odczytać danych palety" msgstr "Nie można odczytać danych palety"
#: ports/espressif/common-hal/mdns/Server.c #: ports/espressif/common-hal/mdns/Server.c
#: ports/raspberrypi/common-hal/mdns/Server.c
msgid "Unable to start mDNS query" msgid "Unable to start mDNS query"
msgstr "" msgstr ""
@ -3165,7 +3170,7 @@ msgid "index is out of bounds"
msgstr "indeks jest poza zakresem" msgstr "indeks jest poza zakresem"
#: extmod/ulab/code/numpy/numerical.c extmod/ulab/code/ulab_tools.c #: extmod/ulab/code/numpy/numerical.c extmod/ulab/code/ulab_tools.c
#: ports/espressif/common-hal/pulseio/PulseIn.c py/obj.c #: ports/espressif/common-hal/pulseio/PulseIn.c
#: shared-bindings/bitmaptools/__init__.c #: shared-bindings/bitmaptools/__init__.c
msgid "index out of range" msgid "index out of range"
msgstr "indeks poza zakresem" msgstr "indeks poza zakresem"
@ -3417,10 +3422,12 @@ msgid "loopback + silent mode not supported by peripheral"
msgstr "" msgstr ""
#: ports/espressif/common-hal/mdns/Server.c #: ports/espressif/common-hal/mdns/Server.c
#: ports/raspberrypi/common-hal/mdns/Server.c
msgid "mDNS already initialized" msgid "mDNS already initialized"
msgstr "" msgstr ""
#: ports/espressif/common-hal/mdns/Server.c #: ports/espressif/common-hal/mdns/Server.c
#: ports/raspberrypi/common-hal/mdns/Server.c
msgid "mDNS only works with built-in WiFi" msgid "mDNS only works with built-in WiFi"
msgstr "" msgstr ""

View File

@ -115,7 +115,7 @@ msgstr "%q falha: %d"
msgid "%q in use" msgid "%q in use"
msgstr "%q em uso" msgstr "%q em uso"
#: py/obj.c py/objstr.c py/objstrunicode.c #: py/objstr.c py/objstrunicode.c
msgid "%q index out of range" msgid "%q index out of range"
msgstr "O índice %q está fora do intervalo" msgstr "O índice %q está fora do intervalo"
@ -180,7 +180,7 @@ msgstr "%q deve ser uma string"
msgid "%q must be an int" msgid "%q must be an int"
msgstr "%q deve ser um inteiro" msgstr "%q deve ser um inteiro"
#: py/argcheck.c #: py/argcheck.c py/obj.c
msgid "%q must be of type %q" msgid "%q must be of type %q"
msgstr "%q deve ser do tipo %q" msgstr "%q deve ser do tipo %q"
@ -1709,6 +1709,10 @@ msgstr "A operação ou o recurso não é suportado"
msgid "Operation timed out" msgid "Operation timed out"
msgstr "A operação expirou" msgstr "A operação expirou"
#: ports/raspberrypi/common-hal/mdns/Server.c
msgid "Out of MDNS service slots"
msgstr ""
#: ports/espressif/common-hal/espidf/__init__.c ports/espressif/esp_error.c #: ports/espressif/common-hal/espidf/__init__.c ports/espressif/esp_error.c
msgid "Out of memory" msgid "Out of memory"
msgstr "Sem memória" msgstr "Sem memória"
@ -2262,6 +2266,7 @@ msgid "Unable to read color palette data"
msgstr "Não foi possível ler os dados da paleta de cores" msgstr "Não foi possível ler os dados da paleta de cores"
#: ports/espressif/common-hal/mdns/Server.c #: ports/espressif/common-hal/mdns/Server.c
#: ports/raspberrypi/common-hal/mdns/Server.c
msgid "Unable to start mDNS query" msgid "Unable to start mDNS query"
msgstr "Não é possível iniciar a consulta mDNS" msgstr "Não é possível iniciar a consulta mDNS"
@ -3247,7 +3252,7 @@ msgid "index is out of bounds"
msgstr "o índice está fora dos limites" msgstr "o índice está fora dos limites"
#: extmod/ulab/code/numpy/numerical.c extmod/ulab/code/ulab_tools.c #: extmod/ulab/code/numpy/numerical.c extmod/ulab/code/ulab_tools.c
#: ports/espressif/common-hal/pulseio/PulseIn.c py/obj.c #: ports/espressif/common-hal/pulseio/PulseIn.c
#: shared-bindings/bitmaptools/__init__.c #: shared-bindings/bitmaptools/__init__.c
msgid "index out of range" msgid "index out of range"
msgstr "Índice fora do intervalo" msgstr "Índice fora do intervalo"
@ -3503,10 +3508,12 @@ msgid "loopback + silent mode not supported by peripheral"
msgstr "o loopback + o modo silencioso não é suportado pelo periférico" msgstr "o loopback + o modo silencioso não é suportado pelo periférico"
#: ports/espressif/common-hal/mdns/Server.c #: ports/espressif/common-hal/mdns/Server.c
#: ports/raspberrypi/common-hal/mdns/Server.c
msgid "mDNS already initialized" msgid "mDNS already initialized"
msgstr "O mDNS já foi inicializado" msgstr "O mDNS já foi inicializado"
#: ports/espressif/common-hal/mdns/Server.c #: ports/espressif/common-hal/mdns/Server.c
#: ports/raspberrypi/common-hal/mdns/Server.c
msgid "mDNS only works with built-in WiFi" msgid "mDNS only works with built-in WiFi"
msgstr "O mDNS só funciona com WiFi integrado" msgstr "O mDNS só funciona com WiFi integrado"

View File

@ -7,8 +7,8 @@ msgid ""
msgstr "" msgstr ""
"Project-Id-Version: PACKAGE VERSION\n" "Project-Id-Version: PACKAGE VERSION\n"
"Report-Msgid-Bugs-To: \n" "Report-Msgid-Bugs-To: \n"
"PO-Revision-Date: 2022-04-06 13:37+0000\n" "PO-Revision-Date: 2022-11-29 01:02+0000\n"
"Last-Translator: Jeff Epler <jepler@gmail.com>\n" "Last-Translator: Clay <code.clayt@gmail.com>\n"
"Language-Team: none\n" "Language-Team: none\n"
"Language: ru\n" "Language: ru\n"
"MIME-Version: 1.0\n" "MIME-Version: 1.0\n"
@ -16,7 +16,7 @@ msgstr ""
"Content-Transfer-Encoding: 8bit\n" "Content-Transfer-Encoding: 8bit\n"
"Plural-Forms: nplurals=3; plural=n%10==1 && n%100!=11 ? 0 : n%10>=2 && n" "Plural-Forms: nplurals=3; plural=n%10==1 && n%100!=11 ? 0 : n%10>=2 && n"
"%10<=4 && (n%100<10 || n%100>=20) ? 1 : 2;\n" "%10<=4 && (n%100<10 || n%100>=20) ? 1 : 2;\n"
"X-Generator: Weblate 4.12-dev\n" "X-Generator: Weblate 4.15-dev\n"
#: main.c #: main.c
msgid "" msgid ""
@ -31,6 +31,8 @@ msgid ""
"\n" "\n"
"Code stopped by auto-reload. Reloading soon.\n" "Code stopped by auto-reload. Reloading soon.\n"
msgstr "" msgstr ""
"\n"
"Программа остановлена автоматической перезагрузкой. Скоро перезагрузка.\n"
#: supervisor/shared/safe_mode.c #: supervisor/shared/safe_mode.c
msgid "" msgid ""
@ -71,13 +73,14 @@ msgstr "%%c требует int или char"
#: main.c #: main.c
#, c-format #, c-format
msgid "%02X" msgid "%02X"
msgstr "" msgstr "%02X"
#: shared-bindings/rgbmatrix/RGBMatrix.c #: shared-bindings/rgbmatrix/RGBMatrix.c
#, c-format #, c-format
msgid "" msgid ""
"%d address pins, %d rgb pins and %d tiles indicate a height of %d, not %d" "%d address pins, %d rgb pins and %d tiles indicate a height of %d, not %d"
msgstr "%d адресные пины, %d rgb пины и %d плитки указывают высоту %d а не %d" msgstr ""
"%d адресных пинов, %d rgb пинов и %d тайлов указывают высоту %d а не %d"
#: ports/atmel-samd/common-hal/alarm/__init__.c #: ports/atmel-samd/common-hal/alarm/__init__.c
#: ports/cxd56/common-hal/analogio/AnalogOut.c ports/cxd56/common-hal/rtc/RTC.c #: ports/cxd56/common-hal/analogio/AnalogOut.c ports/cxd56/common-hal/rtc/RTC.c
@ -90,7 +93,7 @@ msgstr "%d адресные пины, %d rgb пины и %d плитки ука
#: ports/raspberrypi/common-hal/rtc/RTC.c ports/stm/common-hal/alarm/__init__.c #: ports/raspberrypi/common-hal/rtc/RTC.c ports/stm/common-hal/alarm/__init__.c
#: ports/stm/common-hal/rtc/RTC.c #: ports/stm/common-hal/rtc/RTC.c
msgid "%q" msgid "%q"
msgstr "" msgstr "%q"
#: shared-bindings/microcontroller/Pin.c #: shared-bindings/microcontroller/Pin.c
msgid "%q and %q contain duplicate pins" msgid "%q and %q contain duplicate pins"
@ -98,7 +101,7 @@ msgstr "%q и %q содержат пины-дупликаты"
#: ports/atmel-samd/common-hal/audioio/AudioOut.c #: ports/atmel-samd/common-hal/audioio/AudioOut.c
msgid "%q and %q must be different" msgid "%q and %q must be different"
msgstr "" msgstr "%q и %q должны быть разными"
#: shared-bindings/microcontroller/Pin.c #: shared-bindings/microcontroller/Pin.c
msgid "%q contains duplicate pins" msgid "%q contains duplicate pins"
@ -114,21 +117,21 @@ msgstr "%q сбой: %d"
msgid "%q in use" msgid "%q in use"
msgstr "%q используется" msgstr "%q используется"
#: py/obj.c py/objstr.c py/objstrunicode.c #: py/objstr.c py/objstrunicode.c
msgid "%q index out of range" msgid "%q index out of range"
msgstr "Индекс %q вне диапазона" msgstr "Индекс %q вне диапазона"
#: shared-module/bitbangio/SPI.c #: shared-module/bitbangio/SPI.c
msgid "%q init failed" msgid "%q init failed"
msgstr "" msgstr "Инициализация %q не удалась"
#: shared-bindings/dualbank/__init__.c #: shared-bindings/dualbank/__init__.c
msgid "%q is %q" msgid "%q is %q"
msgstr "" msgstr "%q является %q"
#: py/argcheck.c #: py/argcheck.c
msgid "%q length must be %d" msgid "%q length must be %d"
msgstr "" msgstr "Длинна %q должна быть %d"
#: py/argcheck.c #: py/argcheck.c
msgid "%q length must be %d-%d" msgid "%q length must be %d-%d"
@ -136,11 +139,11 @@ msgstr "Длинна %q должна быть %d-%d"
#: py/argcheck.c #: py/argcheck.c
msgid "%q length must be <= %d" msgid "%q length must be <= %d"
msgstr "" msgstr "Длинна %q должна быть <= %d"
#: py/argcheck.c #: py/argcheck.c
msgid "%q length must be >= %d" msgid "%q length must be >= %d"
msgstr "" msgstr "Длинна %q должна быть >= %d"
#: shared-bindings/busio/I2C.c #: shared-bindings/busio/I2C.c
msgid "%q length must be >= 1" msgid "%q length must be >= 1"
@ -148,44 +151,44 @@ msgstr "Длинна %q должна быть >= 1"
#: py/argcheck.c #: py/argcheck.c
msgid "%q must be %d" msgid "%q must be %d"
msgstr "" msgstr "%q должно быть %d"
#: py/argcheck.c #: py/argcheck.c
msgid "%q must be %d-%d" msgid "%q must be %d-%d"
msgstr "%q должен быть %d-%d" msgstr "%q должно быть %d-%d"
#: shared-bindings/displayio/Display.c #: shared-bindings/displayio/Display.c
msgid "%q must be 1 when %q is True" msgid "%q must be 1 when %q is True"
msgstr "" msgstr "%q должно быть 1 когда %q is True"
#: py/argcheck.c shared-bindings/gifio/GifWriter.c #: py/argcheck.c shared-bindings/gifio/GifWriter.c
msgid "%q must be <= %d" msgid "%q must be <= %d"
msgstr "%q должен быть <= %d" msgstr "%q должно быть <= %d"
#: py/argcheck.c #: py/argcheck.c
msgid "%q must be >= %d" msgid "%q must be >= %d"
msgstr "%q должен быть >= %d" msgstr "%q должно быть >= %d"
#: shared-bindings/analogbufio/BufferedIn.c #: shared-bindings/analogbufio/BufferedIn.c
#: shared-bindings/audiocore/RawSample.c #: shared-bindings/audiocore/RawSample.c
msgid "%q must be a bytearray or array of type 'h', 'H', 'b', or 'B'" msgid "%q must be a bytearray or array of type 'h', 'H', 'b', or 'B'"
msgstr "" msgstr "%q должно быть bytearray или array типа 'h', 'H', 'b', или 'B'"
#: py/argcheck.c #: py/argcheck.c
msgid "%q must be a string" msgid "%q must be a string"
msgstr "%q должен быть строкой" msgstr "%q должно быть строкой"
#: py/argcheck.c #: py/argcheck.c
msgid "%q must be an int" msgid "%q must be an int"
msgstr "" msgstr "%q должно быть int"
#: py/argcheck.c #: py/argcheck.c py/obj.c
msgid "%q must be of type %q" msgid "%q must be of type %q"
msgstr "%q должен быть типа %q" msgstr "%q должно быть типа %q"
#: shared-bindings/digitalio/Pull.c #: shared-bindings/digitalio/Pull.c
msgid "%q must be of type %q or None" msgid "%q must be of type %q or None"
msgstr "" msgstr "%q должно быть типа %q или None"
#: ports/atmel-samd/common-hal/busio/UART.c #: ports/atmel-samd/common-hal/busio/UART.c
msgid "%q must be power of 2" msgid "%q must be power of 2"
@ -223,7 +226,7 @@ msgstr "%q, %q, и %q должны быть одной длинны"
#: py/objint.c shared-bindings/storage/__init__.c #: py/objint.c shared-bindings/storage/__init__.c
msgid "%q=%q" msgid "%q=%q"
msgstr "" msgstr "%q=%q"
#: ports/espressif/common-hal/espidf/__init__.c ports/espressif/esp_error.c #: ports/espressif/common-hal/espidf/__init__.c ports/espressif/esp_error.c
#, c-format #, c-format
@ -357,7 +360,7 @@ msgstr "'data' требует как минимум 2 аргумента"
#: py/compile.c #: py/compile.c
msgid "'data' requires integer arguments" msgid "'data' requires integer arguments"
msgstr "'data' требует целочисленных аргументов" msgstr "'data' требует целочисленные аргументы"
#: py/compile.c #: py/compile.c
msgid "'label' requires 1 argument" msgid "'label' requires 1 argument"
@ -598,7 +601,7 @@ msgstr "Для управления потоком требуется как RX,
#: ports/atmel-samd/boards/circuitplayground_express_displayio/mpconfigboard.h #: ports/atmel-samd/boards/circuitplayground_express_displayio/mpconfigboard.h
#: ports/atmel-samd/boards/meowmeow/mpconfigboard.h #: ports/atmel-samd/boards/meowmeow/mpconfigboard.h
msgid "Both buttons were pressed at start up.\n" msgid "Both buttons were pressed at start up.\n"
msgstr "" msgstr "Обе кнопки были нажаты при загрузке.\n"
#: ports/atmel-samd/common-hal/rotaryio/IncrementalEncoder.c #: ports/atmel-samd/common-hal/rotaryio/IncrementalEncoder.c
msgid "Both pins must support hardware interrupts" msgid "Both pins must support hardware interrupts"
@ -668,7 +671,7 @@ msgstr "Пин шины %d уже используется"
#: ports/espressif/boards/m5stack_core_basic/mpconfigboard.h #: ports/espressif/boards/m5stack_core_basic/mpconfigboard.h
#: ports/espressif/boards/m5stack_core_fire/mpconfigboard.h #: ports/espressif/boards/m5stack_core_fire/mpconfigboard.h
msgid "Button A was pressed at start up.\n" msgid "Button A was pressed at start up.\n"
msgstr "" msgstr "Кнопка A была нажата при загрузке\n"
#: shared-bindings/_bleio/UUID.c #: shared-bindings/_bleio/UUID.c
msgid "Byte buffer must be 16 bytes." msgid "Byte buffer must be 16 bytes."
@ -680,7 +683,7 @@ msgstr "Блоки CBC должны быть кратны 16 байтам"
#: supervisor/shared/safe_mode.c #: supervisor/shared/safe_mode.c
msgid "CIRCUITPY drive could not be found or created." msgid "CIRCUITPY drive could not be found or created."
msgstr "" msgstr "Не удалось найти или создать диск CIRCUITPY."
#: ports/espressif/common-hal/espidf/__init__.c ports/espressif/esp_error.c #: ports/espressif/common-hal/espidf/__init__.c ports/espressif/esp_error.c
msgid "CRC or checksum was invalid" msgid "CRC or checksum was invalid"
@ -692,7 +695,7 @@ msgstr "Вызовите super().__init__() перед обращением к
#: ports/cxd56/common-hal/camera/Camera.c #: ports/cxd56/common-hal/camera/Camera.c
msgid "Camera init" msgid "Camera init"
msgstr "" msgstr "Иницализация камеры"
#: ports/espressif/common-hal/alarm/pin/PinAlarm.c #: ports/espressif/common-hal/alarm/pin/PinAlarm.c
msgid "Can only alarm on RTC IO from deep sleep." msgid "Can only alarm on RTC IO from deep sleep."
@ -764,7 +767,7 @@ msgstr "Невозможно перемонтировать '/' пока он в
#: ports/cxd56/common-hal/microcontroller/__init__.c #: ports/cxd56/common-hal/microcontroller/__init__.c
#: ports/mimxrt10xx/common-hal/microcontroller/__init__.c #: ports/mimxrt10xx/common-hal/microcontroller/__init__.c
msgid "Cannot reset into bootloader because no bootloader is present" msgid "Cannot reset into bootloader because no bootloader is present"
msgstr "" msgstr "Не удалось перезагрузится в загрузчик так как загрузчик отсутствует"
#: ports/espressif/common-hal/socketpool/Socket.c #: ports/espressif/common-hal/socketpool/Socket.c
msgid "Cannot set socket options" msgid "Cannot set socket options"
@ -785,15 +788,18 @@ msgstr "Срез субкласса невозможен"
#: shared-module/bitbangio/SPI.c #: shared-module/bitbangio/SPI.c
msgid "Cannot transfer without MOSI and MISO pins" msgid "Cannot transfer without MOSI and MISO pins"
msgstr "" msgstr "Невозможно передать данные без пинов MOSI и MISO"
#: shared-bindings/pwmio/PWMOut.c #: shared-bindings/pwmio/PWMOut.c
msgid "Cannot vary frequency on a timer that is already in use" msgid "Cannot vary frequency on a timer that is already in use"
msgstr "Невозможно изменить частоту на таймере, который уже используется" msgstr "Невозможно изменить частоту на таймере, который уже используется"
#: ports/nrf/common-hal/alarm/pin/PinAlarm.c #: ports/nrf/common-hal/alarm/pin/PinAlarm.c
#, fuzzy
msgid "Cannot wake on pin edge, only level" msgid "Cannot wake on pin edge, only level"
msgstr "" msgstr ""
"Невозможно проснуться по изменению логического уровня (CHANGE), только по "
"уровню (LEVEL)"
#: ports/espressif/common-hal/alarm/pin/PinAlarm.c #: ports/espressif/common-hal/alarm/pin/PinAlarm.c
msgid "Cannot wake on pin edge. Only level." msgid "Cannot wake on pin edge. Only level."
@ -913,7 +919,7 @@ msgstr "Поворот дисплея должен осуществляться
#: main.c #: main.c
msgid "Done" msgid "Done"
msgstr "" msgstr "Выполнено"
#: shared-bindings/digitalio/DigitalInOut.c #: shared-bindings/digitalio/DigitalInOut.c
msgid "Drive mode not used when direction is input." msgid "Drive mode not used when direction is input."
@ -958,11 +964,12 @@ msgstr "Ожидалось(ся) %q"
#: ports/raspberrypi/bindings/cyw43/__init__.c #: ports/raspberrypi/bindings/cyw43/__init__.c
msgid "Expected a %q or %q" msgid "Expected a %q or %q"
msgstr "" msgstr "Ожидалось %q или %q"
#: shared-bindings/alarm/__init__.c #: shared-bindings/alarm/__init__.c
#, fuzzy
msgid "Expected an %q" msgid "Expected an %q"
msgstr "" msgstr "Ожидалось %q"
#: ports/espressif/common-hal/_bleio/Adapter.c #: ports/espressif/common-hal/_bleio/Adapter.c
#: ports/nrf/common-hal/_bleio/Adapter.c #: ports/nrf/common-hal/_bleio/Adapter.c
@ -992,7 +999,7 @@ msgstr "Не удалось получить mutex, ошибка 0x%04x"
#: shared-module/rgbmatrix/RGBMatrix.c #: shared-module/rgbmatrix/RGBMatrix.c
msgid "Failed to allocate %q buffer" msgid "Failed to allocate %q buffer"
msgstr "" msgstr "Не удалось выделить буфер %q"
#: ports/espressif/common-hal/wifi/__init__.c #: ports/espressif/common-hal/wifi/__init__.c
msgid "Failed to allocate Wifi memory" msgid "Failed to allocate Wifi memory"
@ -1043,17 +1050,19 @@ msgid "Filters too complex"
msgstr "Фильтры слишком сложные" msgstr "Фильтры слишком сложные"
#: ports/espressif/common-hal/dualbank/__init__.c #: ports/espressif/common-hal/dualbank/__init__.c
#, fuzzy
msgid "Firmware is duplicate" msgid "Firmware is duplicate"
msgstr "" msgstr "Прошивка является дубликатом"
#: ports/espressif/common-hal/dualbank/__init__.c #: ports/espressif/common-hal/dualbank/__init__.c
#, fuzzy
msgid "Firmware is invalid" msgid "Firmware is invalid"
msgstr "" msgstr "Прошивка является неправильной"
#: ports/espressif/common-hal/coproc/Coproc.c #: ports/espressif/common-hal/coproc/Coproc.c
#: ports/espressif/common-hal/dualbank/__init__.c #: ports/espressif/common-hal/dualbank/__init__.c
msgid "Firmware is too big" msgid "Firmware is too big"
msgstr "" msgstr "Прошивка слишком большая"
#: shared-bindings/bitmaptools/__init__.c #: shared-bindings/bitmaptools/__init__.c
msgid "For L8 colorspace, input bitmap must have 8 bits per pixel" msgid "For L8 colorspace, input bitmap must have 8 bits per pixel"
@ -1073,6 +1082,8 @@ msgstr "Формат не поддерживается"
msgid "" msgid ""
"Frequency must be 24, 150, 396, 450, 528, 600, 720, 816, 912, 960 or 1008 Mhz" "Frequency must be 24, 150, 396, 450, 528, 600, 720, 816, 912, 960 or 1008 Mhz"
msgstr "" msgstr ""
"Частота должна быть 24, 150, 396, 450, 528, 600, 720, 816, 912, 960 или 1008 "
"МГц"
#: shared-bindings/pwmio/PWMOut.c #: shared-bindings/pwmio/PWMOut.c
msgid "Frequency must match existing PWMOut using this timer" msgid "Frequency must match existing PWMOut using this timer"
@ -1087,7 +1098,7 @@ msgstr "Функция требует блокировки"
#: ports/cxd56/common-hal/gnss/GNSS.c #: ports/cxd56/common-hal/gnss/GNSS.c
msgid "GNSS init" msgid "GNSS init"
msgstr "" msgstr "Инициализация GNSS"
#: ports/espressif/common-hal/espidf/__init__.c ports/espressif/esp_error.c #: ports/espressif/common-hal/espidf/__init__.c ports/espressif/esp_error.c
msgid "Generic Failure" msgid "Generic Failure"
@ -1104,7 +1115,7 @@ msgstr "Группа уже используется"
#: ports/mimxrt10xx/common-hal/busio/SPI.c ports/nrf/common-hal/busio/SPI.c #: ports/mimxrt10xx/common-hal/busio/SPI.c ports/nrf/common-hal/busio/SPI.c
#: ports/raspberrypi/common-hal/busio/SPI.c #: ports/raspberrypi/common-hal/busio/SPI.c
msgid "Half duplex SPI is not implemented" msgid "Half duplex SPI is not implemented"
msgstr "" msgstr "Полудуплексный SPI не реализован"
#: ports/mimxrt10xx/common-hal/busio/SPI.c ports/stm/common-hal/busio/I2C.c #: ports/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 #: ports/stm/common-hal/busio/SPI.c ports/stm/common-hal/canio/CAN.c
@ -1122,7 +1133,7 @@ msgstr "Операция ввода-вывода на закрытом файл
#: ports/stm/common-hal/busio/I2C.c #: ports/stm/common-hal/busio/I2C.c
msgid "I2C init error" msgid "I2C init error"
msgstr "" msgstr "Ошибка инициализации I2C"
#: ports/raspberrypi/common-hal/busio/I2C.c #: ports/raspberrypi/common-hal/busio/I2C.c
#: ports/raspberrypi/common-hal/i2ctarget/I2CTarget.c #: ports/raspberrypi/common-hal/i2ctarget/I2CTarget.c
@ -1238,8 +1249,9 @@ msgid "Internal error #%d"
msgstr "Внутренняя ошибка #%d" msgstr "Внутренняя ошибка #%d"
#: supervisor/shared/safe_mode.c #: supervisor/shared/safe_mode.c
#, fuzzy
msgid "Internal watchdog timer expired." msgid "Internal watchdog timer expired."
msgstr "" msgstr "Внутренний сторожевой таймер истек."
#: py/argcheck.c shared-bindings/digitalio/DigitalInOut.c #: py/argcheck.c shared-bindings/digitalio/DigitalInOut.c
msgid "Invalid %q" msgid "Invalid %q"
@ -1322,12 +1334,14 @@ msgid "LHS of keyword arg must be an id"
msgstr "LHS ключевого слова arg должен быть идентификатором(id)" msgstr "LHS ключевого слова arg должен быть идентификатором(id)"
#: shared-module/displayio/Group.c #: shared-module/displayio/Group.c
#, fuzzy
msgid "Layer already in a group" msgid "Layer already in a group"
msgstr "" msgstr "Слой уже в группе (Group)"
#: shared-module/displayio/Group.c #: shared-module/displayio/Group.c
#, fuzzy
msgid "Layer must be a Group or TileGrid subclass" msgid "Layer must be a Group or TileGrid subclass"
msgstr "" msgstr "Слой должен быть группой (Group) или субклассом TileGrid."
#: ports/espressif/common-hal/espidf/__init__.c ports/espressif/esp_error.c #: ports/espressif/common-hal/espidf/__init__.c ports/espressif/esp_error.c
msgid "MAC address was invalid" msgid "MAC address was invalid"
@ -1349,7 +1363,7 @@ msgstr "Задержка включения микрофона должна бы
#: ports/raspberrypi/bindings/rp2pio/StateMachine.c #: ports/raspberrypi/bindings/rp2pio/StateMachine.c
#: ports/raspberrypi/common-hal/rp2pio/StateMachine.c #: ports/raspberrypi/common-hal/rp2pio/StateMachine.c
msgid "Mismatched data size" msgid "Mismatched data size"
msgstr "" msgstr "Размер данных различается"
#: ports/raspberrypi/common-hal/rp2pio/StateMachine.c #: ports/raspberrypi/common-hal/rp2pio/StateMachine.c
msgid "Mismatched swap flag" msgid "Mismatched swap flag"
@ -1361,7 +1375,7 @@ msgstr "Отсутствует пин MISO или MOSI"
#: ports/stm/common-hal/busio/SPI.c #: ports/stm/common-hal/busio/SPI.c
msgid "Missing MISO or MOSI pin" msgid "Missing MISO or MOSI pin"
msgstr "" msgstr "Отсутствует пин MISO или MOSI"
#: ports/raspberrypi/common-hal/rp2pio/StateMachine.c #: ports/raspberrypi/common-hal/rp2pio/StateMachine.c
#, c-format #, c-format
@ -1426,7 +1440,7 @@ msgstr "Имя слишком длинное"
#: shared-bindings/displayio/TileGrid.c #: shared-bindings/displayio/TileGrid.c
msgid "New bitmap must be same size as old bitmap" msgid "New bitmap must be same size as old bitmap"
msgstr "" msgstr "Новый bitmap должен быть того же размера что и старый"
#: ports/espressif/common-hal/_bleio/__init__.c #: ports/espressif/common-hal/_bleio/__init__.c
msgid "Nimble out of memory" msgid "Nimble out of memory"
@ -1454,13 +1468,13 @@ msgid "No DMA pacing timer found"
msgstr "" msgstr ""
#: shared-module/adafruit_bus_device/i2c_device/I2CDevice.c #: shared-module/adafruit_bus_device/i2c_device/I2CDevice.c
#, c-format #, fuzzy, c-format
msgid "No I2C device at address: 0x%x" msgid "No I2C device at address: 0x%x"
msgstr "" msgstr "Не найдено устройство I2C по адресу: %x"
#: supervisor/shared/web_workflow/web_workflow.c #: supervisor/shared/web_workflow/web_workflow.c
msgid "No IP" msgid "No IP"
msgstr "" msgstr "Нет IP"
#: ports/espressif/common-hal/busio/SPI.c #: ports/espressif/common-hal/busio/SPI.c
#: ports/mimxrt10xx/common-hal/busio/SPI.c #: ports/mimxrt10xx/common-hal/busio/SPI.c
@ -1469,7 +1483,7 @@ msgstr "Нет пина MISO"
#: ports/stm/common-hal/busio/SPI.c shared-module/bitbangio/SPI.c #: ports/stm/common-hal/busio/SPI.c shared-module/bitbangio/SPI.c
msgid "No MISO pin" msgid "No MISO pin"
msgstr "" msgstr "Нет пина MISO"
#: ports/espressif/common-hal/busio/SPI.c #: ports/espressif/common-hal/busio/SPI.c
#: ports/mimxrt10xx/common-hal/busio/SPI.c #: ports/mimxrt10xx/common-hal/busio/SPI.c
@ -1478,7 +1492,7 @@ msgstr "Нет пина MOSI"
#: ports/stm/common-hal/busio/SPI.c shared-module/bitbangio/SPI.c #: ports/stm/common-hal/busio/SPI.c shared-module/bitbangio/SPI.c
msgid "No MOSI pin" msgid "No MOSI pin"
msgstr "" msgstr "Нет пина MOSI"
#: ports/atmel-samd/common-hal/busio/UART.c #: ports/atmel-samd/common-hal/busio/UART.c
#: ports/espressif/common-hal/busio/UART.c #: ports/espressif/common-hal/busio/UART.c
@ -1564,8 +1578,9 @@ msgid "No space left on device"
msgstr "На устройстве не осталось свободного места" msgstr "На устройстве не осталось свободного места"
#: py/moduerrno.c #: py/moduerrno.c
#, fuzzy
msgid "No such device" msgid "No such device"
msgstr "" msgstr "Нет такого устройства"
#: py/moduerrno.c #: py/moduerrno.c
msgid "No such file/directory" msgid "No such file/directory"
@ -1576,8 +1591,9 @@ msgid "No timer available"
msgstr "Нет доступного таймера" msgstr "Нет доступного таймера"
#: supervisor/shared/safe_mode.c #: supervisor/shared/safe_mode.c
#, fuzzy
msgid "Nordic system firmware failure assertion." msgid "Nordic system firmware failure assertion."
msgstr "" msgstr "Сбой системной прошивки Nordic (assertion)."
#: ports/nrf/common-hal/_bleio/__init__.c #: ports/nrf/common-hal/_bleio/__init__.c
msgid "Nordic system firmware out of memory" msgid "Nordic system firmware out of memory"
@ -1595,12 +1611,14 @@ msgstr "Не подключено"
#: shared-bindings/audiobusio/I2SOut.c shared-bindings/audioio/AudioOut.c #: shared-bindings/audiobusio/I2SOut.c shared-bindings/audioio/AudioOut.c
#: shared-bindings/audiopwmio/PWMAudioOut.c #: shared-bindings/audiopwmio/PWMAudioOut.c
#, fuzzy
msgid "Not playing" msgid "Not playing"
msgstr "Не играет" msgstr "Не воспроизводится (Not playing)"
#: shared-bindings/_bleio/__init__.c #: shared-bindings/_bleio/__init__.c
#, fuzzy
msgid "Not settable" msgid "Not settable"
msgstr "Не устанавливается" msgstr "Невозможно установить"
#: ports/espressif/common-hal/paralleldisplay/ParallelBus.c #: ports/espressif/common-hal/paralleldisplay/ParallelBus.c
#, c-format #, c-format
@ -1620,11 +1638,12 @@ msgstr ""
#: supervisor/shared/bluetooth/bluetooth.c #: supervisor/shared/bluetooth/bluetooth.c
msgid "Off" msgid "Off"
msgstr "" msgstr "Выключено"
#: supervisor/shared/bluetooth/bluetooth.c #: supervisor/shared/bluetooth/bluetooth.c
#, fuzzy
msgid "Ok" msgid "Ok"
msgstr "" msgstr "Ok"
#: ports/atmel-samd/common-hal/audiobusio/PDMIn.c #: ports/atmel-samd/common-hal/audiobusio/PDMIn.c
#: ports/raspberrypi/common-hal/audiobusio/PDMIn.c #: ports/raspberrypi/common-hal/audiobusio/PDMIn.c
@ -1705,6 +1724,10 @@ msgstr ""
msgid "Operation timed out" msgid "Operation timed out"
msgstr "" msgstr ""
#: ports/raspberrypi/common-hal/mdns/Server.c
msgid "Out of MDNS service slots"
msgstr ""
#: ports/espressif/common-hal/espidf/__init__.c ports/espressif/esp_error.c #: ports/espressif/common-hal/espidf/__init__.c ports/espressif/esp_error.c
msgid "Out of memory" msgid "Out of memory"
msgstr "" msgstr ""
@ -2241,6 +2264,7 @@ msgid "Unable to read color palette data"
msgstr "" msgstr ""
#: ports/espressif/common-hal/mdns/Server.c #: ports/espressif/common-hal/mdns/Server.c
#: ports/raspberrypi/common-hal/mdns/Server.c
msgid "Unable to start mDNS query" msgid "Unable to start mDNS query"
msgstr "" msgstr ""
@ -3202,7 +3226,7 @@ msgid "index is out of bounds"
msgstr "" msgstr ""
#: extmod/ulab/code/numpy/numerical.c extmod/ulab/code/ulab_tools.c #: extmod/ulab/code/numpy/numerical.c extmod/ulab/code/ulab_tools.c
#: ports/espressif/common-hal/pulseio/PulseIn.c py/obj.c #: ports/espressif/common-hal/pulseio/PulseIn.c
#: shared-bindings/bitmaptools/__init__.c #: shared-bindings/bitmaptools/__init__.c
msgid "index out of range" msgid "index out of range"
msgstr "" msgstr ""
@ -3454,10 +3478,12 @@ msgid "loopback + silent mode not supported by peripheral"
msgstr "" msgstr ""
#: ports/espressif/common-hal/mdns/Server.c #: ports/espressif/common-hal/mdns/Server.c
#: ports/raspberrypi/common-hal/mdns/Server.c
msgid "mDNS already initialized" msgid "mDNS already initialized"
msgstr "" msgstr ""
#: ports/espressif/common-hal/mdns/Server.c #: ports/espressif/common-hal/mdns/Server.c
#: ports/raspberrypi/common-hal/mdns/Server.c
msgid "mDNS only works with built-in WiFi" msgid "mDNS only works with built-in WiFi"
msgstr "" msgstr ""

View File

@ -114,7 +114,7 @@ msgstr "%q-fel: %d"
msgid "%q in use" msgid "%q in use"
msgstr "%q används redan" msgstr "%q används redan"
#: py/obj.c py/objstr.c py/objstrunicode.c #: py/objstr.c py/objstrunicode.c
msgid "%q index out of range" msgid "%q index out of range"
msgstr "Index %q ligger utanför intervallet" msgstr "Index %q ligger utanför intervallet"
@ -181,7 +181,7 @@ msgstr "%q måste vara en sträng"
msgid "%q must be an int" msgid "%q must be an int"
msgstr "%q måste vara en int" msgstr "%q måste vara en int"
#: py/argcheck.c #: py/argcheck.c py/obj.c
msgid "%q must be of type %q" msgid "%q must be of type %q"
msgstr "%q måste vara av typen %q" msgstr "%q måste vara av typen %q"
@ -1691,6 +1691,10 @@ msgstr "Operation eller funktion stöds inte"
msgid "Operation timed out" msgid "Operation timed out"
msgstr "Åtgärden orsakade timeout" msgstr "Åtgärden orsakade timeout"
#: ports/raspberrypi/common-hal/mdns/Server.c
msgid "Out of MDNS service slots"
msgstr ""
#: ports/espressif/common-hal/espidf/__init__.c ports/espressif/esp_error.c #: ports/espressif/common-hal/espidf/__init__.c ports/espressif/esp_error.c
msgid "Out of memory" msgid "Out of memory"
msgstr "Slut på minne" msgstr "Slut på minne"
@ -2237,6 +2241,7 @@ msgid "Unable to read color palette data"
msgstr "Det går inte att läsa färgpalettdata" msgstr "Det går inte att läsa färgpalettdata"
#: ports/espressif/common-hal/mdns/Server.c #: ports/espressif/common-hal/mdns/Server.c
#: ports/raspberrypi/common-hal/mdns/Server.c
msgid "Unable to start mDNS query" msgid "Unable to start mDNS query"
msgstr "Det gick inte att starta mDNS-frågan" msgstr "Det gick inte att starta mDNS-frågan"
@ -3215,7 +3220,7 @@ msgid "index is out of bounds"
msgstr "index är utanför gränserna" msgstr "index är utanför gränserna"
#: extmod/ulab/code/numpy/numerical.c extmod/ulab/code/ulab_tools.c #: extmod/ulab/code/numpy/numerical.c extmod/ulab/code/ulab_tools.c
#: ports/espressif/common-hal/pulseio/PulseIn.c py/obj.c #: ports/espressif/common-hal/pulseio/PulseIn.c
#: shared-bindings/bitmaptools/__init__.c #: shared-bindings/bitmaptools/__init__.c
msgid "index out of range" msgid "index out of range"
msgstr "index utanför intervallet" msgstr "index utanför intervallet"
@ -3470,10 +3475,12 @@ msgid "loopback + silent mode not supported by peripheral"
msgstr "loopback + tyst läge stöds inte av kringutrustning" msgstr "loopback + tyst läge stöds inte av kringutrustning"
#: ports/espressif/common-hal/mdns/Server.c #: ports/espressif/common-hal/mdns/Server.c
#: ports/raspberrypi/common-hal/mdns/Server.c
msgid "mDNS already initialized" msgid "mDNS already initialized"
msgstr "mDNS har redan initierats" msgstr "mDNS har redan initierats"
#: ports/espressif/common-hal/mdns/Server.c #: ports/espressif/common-hal/mdns/Server.c
#: ports/raspberrypi/common-hal/mdns/Server.c
msgid "mDNS only works with built-in WiFi" msgid "mDNS only works with built-in WiFi"
msgstr "mDNS fungerar bara med inbyggt WiFi" msgstr "mDNS fungerar bara med inbyggt WiFi"

View File

@ -118,7 +118,7 @@ msgstr "%q hata: %d"
msgid "%q in use" msgid "%q in use"
msgstr "%q kullanımda" msgstr "%q kullanımda"
#: py/obj.c py/objstr.c py/objstrunicode.c #: py/objstr.c py/objstrunicode.c
msgid "%q index out of range" msgid "%q index out of range"
msgstr "%q indeksi aralık dışında" msgstr "%q indeksi aralık dışında"
@ -183,7 +183,7 @@ msgstr "%q bir string olmalıdır"
msgid "%q must be an int" msgid "%q must be an int"
msgstr "%q bir tam sayı olmalıdır" msgstr "%q bir tam sayı olmalıdır"
#: py/argcheck.c #: py/argcheck.c py/obj.c
msgid "%q must be of type %q" msgid "%q must be of type %q"
msgstr "%q, %q türünde olmalıdır" msgstr "%q, %q türünde olmalıdır"
@ -1680,6 +1680,10 @@ msgstr ""
msgid "Operation timed out" msgid "Operation timed out"
msgstr "" msgstr ""
#: ports/raspberrypi/common-hal/mdns/Server.c
msgid "Out of MDNS service slots"
msgstr ""
#: ports/espressif/common-hal/espidf/__init__.c ports/espressif/esp_error.c #: ports/espressif/common-hal/espidf/__init__.c ports/espressif/esp_error.c
msgid "Out of memory" msgid "Out of memory"
msgstr "" msgstr ""
@ -2212,6 +2216,7 @@ msgid "Unable to read color palette data"
msgstr "" msgstr ""
#: ports/espressif/common-hal/mdns/Server.c #: ports/espressif/common-hal/mdns/Server.c
#: ports/raspberrypi/common-hal/mdns/Server.c
msgid "Unable to start mDNS query" msgid "Unable to start mDNS query"
msgstr "" msgstr ""
@ -3173,7 +3178,7 @@ msgid "index is out of bounds"
msgstr "" msgstr ""
#: extmod/ulab/code/numpy/numerical.c extmod/ulab/code/ulab_tools.c #: extmod/ulab/code/numpy/numerical.c extmod/ulab/code/ulab_tools.c
#: ports/espressif/common-hal/pulseio/PulseIn.c py/obj.c #: ports/espressif/common-hal/pulseio/PulseIn.c
#: shared-bindings/bitmaptools/__init__.c #: shared-bindings/bitmaptools/__init__.c
msgid "index out of range" msgid "index out of range"
msgstr "" msgstr ""
@ -3425,10 +3430,12 @@ msgid "loopback + silent mode not supported by peripheral"
msgstr "" msgstr ""
#: ports/espressif/common-hal/mdns/Server.c #: ports/espressif/common-hal/mdns/Server.c
#: ports/raspberrypi/common-hal/mdns/Server.c
msgid "mDNS already initialized" msgid "mDNS already initialized"
msgstr "" msgstr ""
#: ports/espressif/common-hal/mdns/Server.c #: ports/espressif/common-hal/mdns/Server.c
#: ports/raspberrypi/common-hal/mdns/Server.c
msgid "mDNS only works with built-in WiFi" msgid "mDNS only works with built-in WiFi"
msgstr "" msgstr ""

View File

@ -7,8 +7,8 @@ msgstr ""
"Project-Id-Version: circuitpython-cn\n" "Project-Id-Version: circuitpython-cn\n"
"Report-Msgid-Bugs-To: \n" "Report-Msgid-Bugs-To: \n"
"POT-Creation-Date: 2021-01-04 12:55-0600\n" "POT-Creation-Date: 2021-01-04 12:55-0600\n"
"PO-Revision-Date: 2022-11-15 04:35+0000\n" "PO-Revision-Date: 2022-11-19 18:48+0000\n"
"Last-Translator: River Wang <urfdvw@gmail.com>\n" "Last-Translator: hexthat <hexthat@gmail.com>\n"
"Language-Team: Chinese Hanyu Pinyin\n" "Language-Team: Chinese Hanyu Pinyin\n"
"Language: zh_Latn_pinyin\n" "Language: zh_Latn_pinyin\n"
"MIME-Version: 1.0\n" "MIME-Version: 1.0\n"
@ -72,7 +72,7 @@ msgstr "%%c xūyào zhěngshù huòzhě zìfú"
#: main.c #: main.c
#, c-format #, c-format
msgid "%02X" msgid "%02X"
msgstr "" msgstr "%02X"
#: shared-bindings/rgbmatrix/RGBMatrix.c #: shared-bindings/rgbmatrix/RGBMatrix.c
#, c-format #, c-format
@ -117,7 +117,7 @@ msgstr "%q Shībài: %d"
msgid "%q in use" msgid "%q in use"
msgstr "%q zhèngzài bèi shǐyòng" msgstr "%q zhèngzài bèi shǐyòng"
#: py/obj.c py/objstr.c py/objstrunicode.c #: py/objstr.c py/objstrunicode.c
msgid "%q index out of range" msgid "%q index out of range"
msgstr "%q suǒyǐn chāochū fànwéi" msgstr "%q suǒyǐn chāochū fànwéi"
@ -183,7 +183,7 @@ msgstr "%q bìxū shì yí gè zì fú chuàn"
msgid "%q must be an int" msgid "%q must be an int"
msgstr "%q bìxū shì zhěng xíng" msgstr "%q bìxū shì zhěng xíng"
#: py/argcheck.c #: py/argcheck.c py/obj.c
msgid "%q must be of type %q" msgid "%q must be of type %q"
msgstr "%q bì xū shì %q lèi xíng" msgstr "%q bì xū shì %q lèi xíng"
@ -741,9 +741,8 @@ msgid "Cannot get temperature"
msgstr "Wúfǎ huòqǔ wēndù" msgstr "Wúfǎ huòqǔ wēndù"
#: shared-bindings/_bleio/Adapter.c #: shared-bindings/_bleio/Adapter.c
#, fuzzy
msgid "Cannot have scan responses for extended, connectable advertisements." msgid "Cannot have scan responses for extended, connectable advertisements."
msgstr "Nín wúfǎ sǎomiáo kuòzhǎn de, kě liánjiē de guǎnggào." msgstr "Quē fá duì tuī guǎng, kě lián jiē guǎng gào de dá fù."
#: ports/espressif/common-hal/alarm/pin/PinAlarm.c #: ports/espressif/common-hal/alarm/pin/PinAlarm.c
msgid "Cannot pull on input-only pin." msgid "Cannot pull on input-only pin."
@ -794,7 +793,7 @@ msgstr "wúfǎ shǐyòng biānyuán huànxǐng, zhǐnéng shǐyòng diànpíng"
#: ports/espressif/common-hal/alarm/pin/PinAlarm.c #: ports/espressif/common-hal/alarm/pin/PinAlarm.c
msgid "Cannot wake on pin edge. Only level." msgid "Cannot wake on pin edge. Only level."
msgstr "wúfǎ shǐyòng biānyuán huànxǐng. zhǐnéng shǐyòng diànpíng" msgstr "wúfǎ shǐyòng biānyuán huànxǐng. zhǐnéng shǐyòng diànpíng."
#: shared-bindings/_bleio/CharacteristicBuffer.c #: shared-bindings/_bleio/CharacteristicBuffer.c
msgid "CharacteristicBuffer writing not provided" msgid "CharacteristicBuffer writing not provided"
@ -864,9 +863,8 @@ msgstr "DAC zhèngzài bèi shǐyòng"
#: ports/atmel-samd/common-hal/paralleldisplay/ParallelBus.c #: ports/atmel-samd/common-hal/paralleldisplay/ParallelBus.c
#: ports/nrf/common-hal/paralleldisplay/ParallelBus.c #: ports/nrf/common-hal/paralleldisplay/ParallelBus.c
#, fuzzy
msgid "Data 0 pin must be byte aligned" msgid "Data 0 pin must be byte aligned"
msgstr "Shùjù 0 de yǐn jiǎo bìxū shì zì jié duìqí" msgstr "shù jù 0 yǐn jiǎo bì xū shì zì jié duì qí de"
#: shared-module/audiocore/WaveFile.c #: shared-module/audiocore/WaveFile.c
msgid "Data chunk must follow fmt chunk" msgid "Data chunk must follow fmt chunk"
@ -874,9 +872,8 @@ msgstr "Shùjù kuài bìxū zūnxún fmt qū kuài"
#: ports/espressif/common-hal/_bleio/Adapter.c #: ports/espressif/common-hal/_bleio/Adapter.c
#: ports/nrf/common-hal/_bleio/Adapter.c #: ports/nrf/common-hal/_bleio/Adapter.c
#, fuzzy
msgid "Data not supported with directed advertising" msgid "Data not supported with directed advertising"
msgstr "bù zhī chí dìng xiàng guǎng gào de shù jù" msgstr "wèi xiàng guǎng gào tí gòng zhī zhù de shù jù"
#: ports/espressif/common-hal/_bleio/Adapter.c #: ports/espressif/common-hal/_bleio/Adapter.c
#: ports/nrf/common-hal/_bleio/Adapter.c #: ports/nrf/common-hal/_bleio/Adapter.c
@ -1701,6 +1698,10 @@ msgstr "bù zhī chí cāo zuò huò gōng néng"
msgid "Operation timed out" msgid "Operation timed out"
msgstr "cāo zuò yǐ fēn shí" msgstr "cāo zuò yǐ fēn shí"
#: ports/raspberrypi/common-hal/mdns/Server.c
msgid "Out of MDNS service slots"
msgstr ""
#: ports/espressif/common-hal/espidf/__init__.c ports/espressif/esp_error.c #: ports/espressif/common-hal/espidf/__init__.c ports/espressif/esp_error.c
msgid "Out of memory" msgid "Out of memory"
msgstr "nèi cún bù zú" msgstr "nèi cún bù zú"
@ -2186,7 +2187,7 @@ msgstr "UART xiě rù"
#: main.c #: main.c
msgid "UID:" msgid "UID:"
msgstr "" msgstr "UID:"
#: shared-module/usb_hid/Device.c #: shared-module/usb_hid/Device.c
msgid "USB busy" msgid "USB busy"
@ -2246,6 +2247,7 @@ msgid "Unable to read color palette data"
msgstr "Wúfǎ dúqǔ tiáosèbǎn shùjù" msgstr "Wúfǎ dúqǔ tiáosèbǎn shùjù"
#: ports/espressif/common-hal/mdns/Server.c #: ports/espressif/common-hal/mdns/Server.c
#: ports/raspberrypi/common-hal/mdns/Server.c
msgid "Unable to start mDNS query" msgid "Unable to start mDNS query"
msgstr "wú fǎ qǐ dòng mDNS chá xún" msgstr "wú fǎ qǐ dòng mDNS chá xún"
@ -3225,7 +3227,7 @@ msgid "index is out of bounds"
msgstr "suǒyǐn chāochū fànwéi" msgstr "suǒyǐn chāochū fànwéi"
#: extmod/ulab/code/numpy/numerical.c extmod/ulab/code/ulab_tools.c #: extmod/ulab/code/numpy/numerical.c extmod/ulab/code/ulab_tools.c
#: ports/espressif/common-hal/pulseio/PulseIn.c py/obj.c #: ports/espressif/common-hal/pulseio/PulseIn.c
#: shared-bindings/bitmaptools/__init__.c #: shared-bindings/bitmaptools/__init__.c
msgid "index out of range" msgid "index out of range"
msgstr "suǒyǐn chāochū fànwéi" msgstr "suǒyǐn chāochū fànwéi"
@ -3478,10 +3480,12 @@ msgid "loopback + silent mode not supported by peripheral"
msgstr "Wài shè bù zhī chí huán huí + jìng yīn mó shì" msgstr "Wài shè bù zhī chí huán huí + jìng yīn mó shì"
#: ports/espressif/common-hal/mdns/Server.c #: ports/espressif/common-hal/mdns/Server.c
#: ports/raspberrypi/common-hal/mdns/Server.c
msgid "mDNS already initialized" msgid "mDNS already initialized"
msgstr "mDNS yǐ chū shǐ huà" msgstr "mDNS yǐ chū shǐ huà"
#: ports/espressif/common-hal/mdns/Server.c #: ports/espressif/common-hal/mdns/Server.c
#: ports/raspberrypi/common-hal/mdns/Server.c
msgid "mDNS only works with built-in WiFi" msgid "mDNS only works with built-in WiFi"
msgstr "mDNS jǐn shì yòng yú nèi zhì wú xiàn wǎng luò" msgstr "mDNS jǐn shì yòng yú nèi zhì wú xiàn wǎng luò"

View File

@ -22,36 +22,7 @@
# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN # OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
# THE SOFTWARE. # THE SOFTWARE.
# Select the board to build for. include ../../py/circuitpy_mkenv.mk
ifeq ($(BOARD),)
$(error You must provide a BOARD parameter)
else
ifeq ($(wildcard boards/$(BOARD)/.),)
$(error Invalid BOARD specified)
endif
endif
# If the build directory is not given, make it reflect the board name.
BUILD ?= build-$(BOARD)
include ../../py/mkenv.mk
# Board-specific
include boards/$(BOARD)/mpconfigboard.mk
# Port-specific
include mpconfigport.mk
# CircuitPython-specific
include $(TOP)/py/circuitpy_mpconfig.mk
# qstr definitions (must come before including py.mk)
QSTR_DEFS = qstrdefsport.h
# include py core make definitions
include $(TOP)/py/py.mk
include $(TOP)/supervisor/supervisor.mk
# Include make rules and variables common across CircuitPython builds.
include $(TOP)/py/circuitpy_defns.mk
CROSS_COMPILE = arm-none-eabi- CROSS_COMPILE = arm-none-eabi-
@ -108,7 +79,7 @@ endif
ifeq ($(CHIP_FAMILY), same54) ifeq ($(CHIP_FAMILY), same54)
PERIPHERALS_CHIP_FAMILY=sam_d5x_e5x PERIPHERALS_CHIP_FAMILY=sam_d5x_e5x
OPTIMIZATION_FLAGS ?= -O2 OPTIMIZATION_FLAGS ?= -Os
# TinyUSB defines # TinyUSB defines
CFLAGS += -DCFG_TUSB_MCU=OPT_MCU_SAME5X -DCFG_TUD_MIDI_RX_BUFSIZE=128 -DCFG_TUD_CDC_RX_BUFSIZE=256 -DCFG_TUD_MIDI_TX_BUFSIZE=128 -DCFG_TUD_CDC_TX_BUFSIZE=256 -DCFG_TUD_MSC_BUFSIZE=1024 CFLAGS += -DCFG_TUSB_MCU=OPT_MCU_SAME5X -DCFG_TUD_MIDI_RX_BUFSIZE=128 -DCFG_TUD_CDC_RX_BUFSIZE=256 -DCFG_TUD_MIDI_TX_BUFSIZE=128 -DCFG_TUD_CDC_TX_BUFSIZE=256 -DCFG_TUD_MSC_BUFSIZE=1024
endif endif
@ -322,7 +293,6 @@ SRC_C += \
boards/$(BOARD)/board.c \ boards/$(BOARD)/board.c \
boards/$(BOARD)/pins.c \ boards/$(BOARD)/pins.c \
eic_handler.c \ eic_handler.c \
fatfs_port.c \
lib/tinyusb/src/portable/microchip/samd/dcd_samd.c \ lib/tinyusb/src/portable/microchip/samd/dcd_samd.c \
mphalport.c \ mphalport.c \
reset.c \ reset.c \

View File

@ -405,7 +405,13 @@ void common_hal_audioio_audioout_play(audioio_audioout_obj_t *self,
if (self->right_channel == &pin_PA02) { if (self->right_channel == &pin_PA02) {
right_channel_reg = (uint32_t)&DAC->DATABUF[0].reg; right_channel_reg = (uint32_t)&DAC->DATABUF[0].reg;
} }
if (right_channel_reg == left_channel_reg + 2 && audiosample_bits_per_sample(sample) == 16) {
size_t num_channels = audiosample_channel_count(sample);
if (num_channels == 2 &&
// Are DAC channels sequential?
left_channel_reg + 2 == right_channel_reg &&
audiosample_bits_per_sample(sample) == 16) {
result = audio_dma_setup_playback(&self->left_dma, sample, loop, false, 0, result = audio_dma_setup_playback(&self->left_dma, sample, loop, false, 0,
false /* output unsigned */, false /* output unsigned */,
left_channel_reg, left_channel_reg,
@ -415,7 +421,11 @@ void common_hal_audioio_audioout_play(audioio_audioout_obj_t *self,
false /* output unsigned */, false /* output unsigned */,
left_channel_reg, left_channel_reg,
left_channel_trigger); left_channel_trigger);
if (right_channel_reg != 0 && result == AUDIO_DMA_OK) { // Don't play back on right channel unless stereo.
// TODO possibility: Set up non-incrementing DMA on one channel so they use the same samples?
// Right now, playing back mono on both channels causes sample to play twice as fast.
if (num_channels == 2 &&
right_channel_reg != 0 && result == AUDIO_DMA_OK) {
result = audio_dma_setup_playback(&self->right_dma, sample, loop, true, 1, result = audio_dma_setup_playback(&self->right_dma, sample, loop, true, 1,
false /* output unsigned */, false /* output unsigned */,
right_channel_reg, right_channel_reg,

View File

@ -114,8 +114,6 @@ CLK PA21 PCC_D? (D32) BROWN
gpio_set_pin_pull_mode(functions[i]->pin, gpio_set_pin_pull_mode(functions[i]->pin,
(i == 1 || i == 5) ? GPIO_PULL_OFF : GPIO_PULL_UP); (i == 1 || i == 5) ? GPIO_PULL_OFF : GPIO_PULL_UP);
gpio_set_pin_function(functions[i]->pin, GPIO_PIN_FUNCTION_SDIO); gpio_set_pin_function(functions[i]->pin, GPIO_PIN_FUNCTION_SDIO);
common_hal_never_reset_pin(functions[i]->obj);
} }
self->num_data = num_data; self->num_data = num_data;
@ -145,6 +143,12 @@ CLK PA21 PCC_D? (D32) BROWN
} }
if (result != SD_MMC_OK) { if (result != SD_MMC_OK) {
for (size_t i = 0; i < MP_ARRAY_SIZE(functions); i++) {
if (!functions[i]->obj) {
break;
}
reset_pin_number(functions[i]->obj->number);
}
mp_raise_OSError_msg_varg(translate("%q failure: %d"), MP_QSTR_sd_mmc_check, (int)result); mp_raise_OSError_msg_varg(translate("%q failure: %d"), MP_QSTR_sd_mmc_check, (int)result);
} }
// sd_mmc_get_capacity() is in KiB, but our "capacity" is in 512-byte blocks // sd_mmc_get_capacity() is in KiB, but our "capacity" is in 512-byte blocks

View File

@ -1,48 +0,0 @@
/*
* This file is part of the MicroPython project, http://micropython.org/
*
* The MIT License (MIT)
*
* SPDX-FileCopyrightText: Copyright (c) 2013, 2014 Damien P. George
*
* Permission is hereby granted, free of charge, to any person obtaining a copy
* of this software and associated documentation files (the "Software"), to deal
* in the Software without restriction, including without limitation the rights
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
* copies of the Software, and to permit persons to whom the Software is
* furnished to do so, subject to the following conditions:
*
* The above copyright notice and this permission notice shall be included in
* all copies or substantial portions of the Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
* THE SOFTWARE.
*/
#include "py/mphal.h"
#include "py/runtime.h"
#include "lib/oofatfs/ff.h" /* FatFs lower layer API */
#include "lib/oofatfs/diskio.h" /* FatFs lower layer API */
#include "shared/timeutils/timeutils.h"
#if CIRCUITPY_RTC
#include "shared-bindings/rtc/RTC.h"
#endif
DWORD get_fattime(void) {
#if CIRCUITPY_RTC
timeutils_struct_time_t tm;
common_hal_rtc_get_time(&tm);
return ((tm.tm_year - 1980) << 25) | (tm.tm_mon << 21) | (tm.tm_mday << 16) |
(tm.tm_hour << 11) | (tm.tm_min << 5) | (tm.tm_sec >> 1);
#else
return ((2016 - 1980) << 25) | ((9) << 21) | ((1) << 16) | ((16) << 11) | ((43) << 5) | (35 / 2);
#endif
}

View File

@ -1,35 +1,28 @@
# Select the board to build for. # This file is part of the MicroPython project, http://micropython.org/
BOARD?=raspberrypi_pi4b #
# The MIT License (MIT)
#
# SPDX-FileCopyrightText: 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.
ifeq ($(BOARD),) include ../../py/circuitpy_mkenv.mk
$(error You must provide a BOARD parameter)
else
ifeq ($(wildcard boards/$(BOARD)/.),)
$(error Invalid BOARD "$(BOARD)" specified)
endif
endif
# If the build directory is not given, make it reflect the board name.
BUILD ?= build-$(BOARD)
include ../../py/mkenv.mk
# Board-specific
include boards/$(BOARD)/mpconfigboard.mk
# Port-specific
include mpconfigport.mk
# CircuitPython-specific
include $(TOP)/py/circuitpy_mpconfig.mk
# qstr definitions (must come before including py.mk)
QSTR_DEFS = qstrdefsport.h
# include py core make definitions
include $(TOP)/py/py.mk
include $(TOP)/supervisor/supervisor.mk
# Include make rules and variables common across CircuitPython builds.
include $(TOP)/py/circuitpy_defns.mk
ifeq ($(CHIP_VARIANT), "bcm2711") ifeq ($(CHIP_VARIANT), "bcm2711")
CFLAGS += -mcpu=cortex-a72 -DBCM_VERSION=2711 CFLAGS += -mcpu=cortex-a72 -DBCM_VERSION=2711
@ -65,7 +58,6 @@ SRC_C += bindings/videocore/__init__.c \
boards/$(BOARD)/pins.c \ boards/$(BOARD)/pins.c \
background.c \ background.c \
common-hal/videocore/Framebuffer.c \ common-hal/videocore/Framebuffer.c \
fatfs_port.c \
mphalport.c \ mphalport.c \
lib/sdmmc/sdmmc_cmd.c \ lib/sdmmc/sdmmc_cmd.c \
lib/sdmmc/sdmmc_common.c \ lib/sdmmc/sdmmc_common.c \

View File

@ -1,48 +0,0 @@
/*
* This file is part of the MicroPython project, http://micropython.org/
*
* The MIT License (MIT)
*
* SPDX-FileCopyrightText: Copyright (c) 2013, 2014 Damien P. George
*
* Permission is hereby granted, free of charge, to any person obtaining a copy
* of this software and associated documentation files (the "Software"), to deal
* in the Software without restriction, including without limitation the rights
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
* copies of the Software, and to permit persons to whom the Software is
* furnished to do so, subject to the following conditions:
*
* The above copyright notice and this permission notice shall be included in
* all copies or substantial portions of the Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
* THE SOFTWARE.
*/
#include "py/mphal.h"
#include "py/runtime.h"
#include "lib/oofatfs/ff.h" /* FatFs lower layer API */
#include "lib/oofatfs/diskio.h" /* FatFs lower layer API */
#include "shared/timeutils/timeutils.h"
#if CIRCUITPY_RTC
#include "shared-bindings/rtc/RTC.h"
#endif
DWORD get_fattime(void) {
#if CIRCUITPY_RTC
timeutils_struct_time_t tm;
common_hal_rtc_get_time(&tm);
return ((tm.tm_year - 1980) << 25) | (tm.tm_mon << 21) | (tm.tm_mday << 16) |
(tm.tm_hour << 11) | (tm.tm_min << 5) | (tm.tm_sec >> 1);
#else
return ((2016 - 1980) << 25) | ((9) << 21) | ((1) << 16) | ((16) << 11) | ((43) << 5) | (35 / 2);
#endif
}

View File

@ -22,39 +22,7 @@
# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN # OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
# THE SOFTWARE. # THE SOFTWARE.
# Select the board to build for. include ../../py/circuitpy_mkenv.mk
ifeq ($(BOARD),)
$(error You must provide a BOARD parameter)
else
ifeq ($(wildcard boards/$(BOARD)/.),)
$(error Invalid BOARD specified)
endif
endif
# If the build directory is not given, make it reflect the board name.
BUILD ?= build-$(BOARD)
include ../../py/mkenv.mk
# Board-specific
include boards/$(BOARD)/mpconfigboard.mk
# Port-specific
include mpconfigport.mk
# CircuitPython-specific
include $(TOP)/py/circuitpy_mpconfig.mk
# qstr definitions (must come before including py.mk)
QSTR_DEFS = qstrdefsport.h
# include py core make definitions
include $(TOP)/py/py.mk
include $(TOP)/supervisor/supervisor.mk
# Include make rules and variables common across CircuitPython builds.
include $(TOP)/py/circuitpy_defns.mk
CROSS_COMPILE = arm-none-eabi- CROSS_COMPILE = arm-none-eabi-
@ -172,7 +140,6 @@ SRC_S = supervisor/cpu.s
SRC_C += \ SRC_C += \
background.c \ background.c \
fatfs_port.c \
mphalport.c \ mphalport.c \
boards/$(BOARD)/board.c \ boards/$(BOARD)/board.c \
boards/$(BOARD)/pins.c \ boards/$(BOARD)/pins.c \

View File

@ -1,46 +0,0 @@
/*
* This file is part of the MicroPython project, http://micropython.org/
*
* The MIT License (MIT)
*
* Copyright 2019 Sony Semiconductor Solutions Corporation
*
* Permission is hereby granted, free of charge, to any person obtaining a copy
* of this software and associated documentation files (the "Software"), to deal
* in the Software without restriction, including without limitation the rights
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
* copies of the Software, and to permit persons to whom the Software is
* furnished to do so, subject to the following conditions:
*
* The above copyright notice and this permission notice shall be included in
* all copies or substantial portions of the Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
* THE SOFTWARE.
*/
#include "py/mphal.h"
#include "py/runtime.h"
#include "lib/oofatfs/ff.h" /* FatFs lower layer API */
#include "lib/oofatfs/diskio.h" /* FatFs lower layer API */
#include "shared/timeutils/timeutils.h"
#if CIRCUITPY_RTC
#include "shared-bindings/rtc/RTC.h"
#endif
DWORD get_fattime(void) {
#if CIRCUITPY_RTC
timeutils_struct_time_t tm;
common_hal_rtc_get_time(&tm);
return ((tm.tm_year - 1980) << 25) | (tm.tm_mon << 21) | (tm.tm_mday << 16) |
(tm.tm_hour << 11) | (tm.tm_min << 5) | (tm.tm_sec >> 1);
#else
return ((2016 - 1980) << 25) | ((9) << 21) | ((1) << 16) | ((16) << 11) | ((43) << 5) | (35 / 2);
#endif
}

View File

@ -22,42 +22,7 @@
# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN # OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
# THE SOFTWARE. # THE SOFTWARE.
# Select the board to build for. include ../../py/circuitpy_mkenv.mk
ifeq ($(BOARD),)
$(error You must provide a BOARD parameter)
else
ifeq ($(wildcard boards/$(BOARD)/.),)
$(error Invalid BOARD specified)
endif
endif
# If the flash PORT is not given, use the default /dev/tty.SLAB_USBtoUART.
PORT ?= /dev/tty.SLAB_USBtoUART
# If the build directory is not given, make it reflect the board name.
BUILD ?= build-$(BOARD)
include ../../py/mkenv.mk
# Board-specific
include boards/$(BOARD)/mpconfigboard.mk
# Port-specific
include mpconfigport.mk
# CircuitPython-specific
include $(TOP)/py/circuitpy_mpconfig.mk
# qstr definitions (must come before including py.mk)
QSTR_DEFS = qstrdefsport.h
# include py core make definitions
include $(TOP)/py/py.mk
include $(TOP)/supervisor/supervisor.mk
# Include make rules and variables common across CircuitPython builds.
include $(TOP)/py/circuitpy_defns.mk
ifeq ($(IDF_TARGET),esp32c3) ifeq ($(IDF_TARGET),esp32c3)
IDF_TARGET_ARCH = riscv IDF_TARGET_ARCH = riscv
@ -250,7 +215,6 @@ endif
SRC_C += \ SRC_C += \
background.c \ background.c \
fatfs_port.c \
mphalport.c \ mphalport.c \
bindings/espidf/__init__.c \ bindings/espidf/__init__.c \
boards/$(BOARD)/board.c \ boards/$(BOARD)/board.c \
@ -458,7 +422,7 @@ esp-idf-stamp: $(BUILD)/esp-idf/config/sdkconfig.h
$(BUILD)/firmware.elf: $(OBJ) | esp-idf-stamp $(BUILD)/firmware.elf: $(OBJ) | esp-idf-stamp
$(STEPECHO) "LINK $@" $(STEPECHO) "LINK $@"
$(Q)$(CC) -o $@ $(LDFLAGS) $^ -Wl,--start-group $(ESP_IDF_COMPONENTS_EXPANDED) $(BINARY_BLOBS) $(MBEDTLS_COMPONENTS_LINK_EXPANDED) $(BUILD)/esp-idf/esp-idf/newlib/libnewlib.a -Wl,--end-group -u newlib_include_pthread_impl -Wl,--start-group $(LIBS) -Wl,--end-group $(BUILD)/esp-idf/esp-idf/pthread/libpthread.a -u __cxx_fatal_exception $(Q)$(CC) -o $@ $(LDFLAGS) $^ -Wl,--start-group $(ESP_IDF_COMPONENTS_EXPANDED) $(BINARY_BLOBS) $(MBEDTLS_COMPONENTS_LINK_EXPANDED) $(BUILD)/esp-idf/esp-idf/newlib/libnewlib.a -Wl,--end-group -u newlib_include_pthread_impl -u ld_include_highint_hdl -Wl,--start-group $(LIBS) -Wl,--end-group $(BUILD)/esp-idf/esp-idf/pthread/libpthread.a -u __cxx_fatal_exception
$(BUILD)/circuitpython-firmware.bin: $(BUILD)/firmware.elf | tools/build_memory_info.py $(BUILD)/circuitpython-firmware.bin: $(BUILD)/firmware.elf | tools/build_memory_info.py
$(STEPECHO) "Create $@" $(STEPECHO) "Create $@"

View File

@ -1,70 +1,5 @@
# Automatically generated file. DO NOT EDIT.
# Espressif IoT Development Framework (ESP-IDF) Project Configuration
#
# Bootloader config
#
CONFIG_BOOTLOADER_LOG_LEVEL_NONE=y
# CONFIG_BOOTLOADER_LOG_LEVEL_INFO is not set
CONFIG_BOOTLOADER_LOG_LEVEL=0
# end of Bootloader config
#
# Serial flasher config
#
# CONFIG_ESPTOOLPY_FLASHFREQ_26M is not set
# end of Serial flasher config
#
# Partition Table
#
CONFIG_PARTITION_TABLE_CUSTOM_FILENAME="esp-idf-config/partitions-4MB-no-uf2.csv"
CONFIG_PARTITION_TABLE_FILENAME="esp-idf-config/partitions-4MB-no-uf2.csv"
# end of Partition Table
#
# Compiler options
#
# CONFIG_COMPILER_SAVE_RESTORE_LIBCALLS is not set
# end of Compiler options
#
# Component config
#
#
#
# PHY
#
CONFIG_ESP_PHY_ENABLE_USB=y
# end of PHY
#
# ESP System Settings
#
# CONFIG_ESP_SYSTEM_USE_EH_FRAME is not set
CONFIG_ESP_CONSOLE_SECONDARY_NONE=y
# CONFIG_ESP_CONSOLE_SECONDARY_USB_SERIAL_JTAG is not set
# CONFIG_ESP_DEBUG_STUBS_ENABLE is not set
# end of ESP System Settings
# #
# LWIP # LWIP
# #
CONFIG_LWIP_LOCAL_HOSTNAME="Adafruit-QTPy-ESP32C3" CONFIG_LWIP_LOCAL_HOSTNAME="Adafruit-QTPy-ESP32C3"
# end of LWIP # end of LWIP
#
# SPI Flash driver
#
# CONFIG_SPI_FLASH_AUTO_SUSPEND is not set
# end of SPI Flash driver
# end of Component config
#
# Deprecated options for backward compatibility
#
# CONFIG_LOG_BOOTLOADER_LEVEL_INFO is not set
CONFIG_LOG_BOOTLOADER_LEVEL=0
# CONFIG_COMPILER_OPTIMIZATION_LEVEL_DEBUG is not set
# end of Deprecated options for backward compatibility

View File

@ -30,7 +30,9 @@
#define MICROPY_HW_MCU_NAME "ESP32-C3" #define MICROPY_HW_MCU_NAME "ESP32-C3"
// Status LED // Status LED
#define MICROPY_HW_LED_STATUS (&pin_GPIO19) #define CIRCUITPY_RGB_STATUS_R (&pin_GPIO3)
#define CIRCUITPY_RGB_STATUS_G (&pin_GPIO4)
#define CIRCUITPY_RGB_STATUS_B (&pin_GPIO5)
// Default bus pins // Default bus pins
#define DEFAULT_UART_BUS_RX (&pin_GPIO20) #define DEFAULT_UART_BUS_RX (&pin_GPIO20)

View File

@ -30,7 +30,9 @@
#define MICROPY_HW_MCU_NAME "ESP32-C3FN4" #define MICROPY_HW_MCU_NAME "ESP32-C3FN4"
// Status LED // Status LED
#define MICROPY_HW_LED_STATUS (&pin_GPIO19) #define CIRCUITPY_RGB_STATUS_R (&pin_GPIO3)
#define CIRCUITPY_RGB_STATUS_G (&pin_GPIO4)
#define CIRCUITPY_RGB_STATUS_B (&pin_GPIO5)
// Default bus pins // Default bus pins
#define DEFAULT_UART_BUS_RX (&pin_GPIO20) #define DEFAULT_UART_BUS_RX (&pin_GPIO20)

View File

@ -1,13 +1,5 @@
#
# PHY
#
CONFIG_ESP_PHY_ENABLE_USB=y
# end of PHY
# #
# LWIP # LWIP
# #
CONFIG_LWIP_LOCAL_HOSTNAME="beetle-esp32-c3 CONFIG_LWIP_LOCAL_HOSTNAME="beetle-esp32-c3
# end of LWIP # end of LWIP

View File

@ -1,13 +1,5 @@
#
# PHY
#
CONFIG_ESP_PHY_ENABLE_USB=y
# end of PHY
# #
# LWIP # LWIP
# #
CONFIG_LWIP_LOCAL_HOSTNAME="lolin-c3-mini" CONFIG_LWIP_LOCAL_HOSTNAME="lolin-c3-mini"
# end of LWIP # end of LWIP

View File

@ -1,70 +1,5 @@
# Automatically generated file. DO NOT EDIT.
# Espressif IoT Development Framework (ESP-IDF) Project Configuration
#
# Bootloader config
#
CONFIG_BOOTLOADER_LOG_LEVEL_NONE=y
# CONFIG_BOOTLOADER_LOG_LEVEL_INFO is not set
CONFIG_BOOTLOADER_LOG_LEVEL=0
# end of Bootloader config
#
# Serial flasher config
#
# CONFIG_ESPTOOLPY_FLASHFREQ_26M is not set
# end of Serial flasher config
#
# Partition Table
#
CONFIG_PARTITION_TABLE_CUSTOM_FILENAME="esp-idf-config/partitions-4MB-no-uf2.csv"
CONFIG_PARTITION_TABLE_FILENAME="esp-idf-config/partitions-4MB-no-uf2.csv"
# end of Partition Table
#
# Compiler options
#
# CONFIG_COMPILER_SAVE_RESTORE_LIBCALLS is not set
# end of Compiler options
#
# Component config
#
#
#
# PHY
#
CONFIG_ESP_PHY_ENABLE_USB=y
# end of PHY
#
# ESP System Settings
#
# CONFIG_ESP_SYSTEM_USE_EH_FRAME is not set
CONFIG_ESP_CONSOLE_SECONDARY_NONE=y
# CONFIG_ESP_CONSOLE_SECONDARY_USB_SERIAL_JTAG is not set
# CONFIG_ESP_DEBUG_STUBS_ENABLE is not set
# end of ESP System Settings
# #
# LWIP # LWIP
# #
CONFIG_LWIP_LOCAL_HOSTNAME="MicroDev-microC3" CONFIG_LWIP_LOCAL_HOSTNAME="MicroDev-microC3"
# end of LWIP # end of LWIP
#
# SPI Flash driver
#
# CONFIG_SPI_FLASH_AUTO_SUSPEND is not set
# end of SPI Flash driver
# end of Component config
#
# Deprecated options for backward compatibility
#
# CONFIG_LOG_BOOTLOADER_LEVEL_INFO is not set
CONFIG_LOG_BOOTLOADER_LEVEL=0
# CONFIG_COMPILER_OPTIMIZATION_LEVEL_DEBUG is not set
# end of Deprecated options for backward compatibility

View File

@ -49,8 +49,9 @@ static void uart_event_task(void *param) {
while (true) { while (true) {
if (xQueueReceive(self->event_queue, &event, portMAX_DELAY)) { if (xQueueReceive(self->event_queue, &event, portMAX_DELAY)) {
switch (event.type) { switch (event.type) {
case UART_BREAK:
case UART_PATTERN_DET: case UART_PATTERN_DET:
// When the console uart receives CTRL+C, wake the main task and schedule a keyboard interrupt // When the console uart receives CTRL+C or BREAK, wake the main task and schedule a keyboard interrupt
if (self->is_console) { if (self->is_console) {
port_wake_main_task(); port_wake_main_task();
if (mp_interrupt_char == CHAR_CTRL_C) { if (mp_interrupt_char == CHAR_CTRL_C) {

View File

@ -166,8 +166,21 @@ void common_hal_pwmio_pwmout_never_reset(pwmio_pwmout_obj_t *self) {
void common_hal_pwmio_pwmout_reset_ok(pwmio_pwmout_obj_t *self) { void common_hal_pwmio_pwmout_reset_ok(pwmio_pwmout_obj_t *self) {
never_reset_tim[self->tim_handle.timer_num] = false; never_reset_tim[self->tim_handle.timer_num] = false;
// Search if any other channel is using the timer and is never reset.
// Otherwise, we clear never_reset for the timer as well.
bool other_never_reset = false;
for (size_t i = 0; i < LEDC_CHANNEL_MAX; i++) {
if (i != self->chan_handle.channel &&
reserved_channels[i] == self->tim_handle.timer_num &&
never_reset_chan[i]) {
other_never_reset = true;
break;
}
}
if (!other_never_reset) {
never_reset_chan[self->chan_handle.channel] = false; never_reset_chan[self->chan_handle.channel] = false;
} }
}
bool common_hal_pwmio_pwmout_deinited(pwmio_pwmout_obj_t *self) { bool common_hal_pwmio_pwmout_deinited(pwmio_pwmout_obj_t *self) {
return self->deinited == true; return self->deinited == true;
@ -182,11 +195,13 @@ void common_hal_pwmio_pwmout_deinit(pwmio_pwmout_obj_t *self) {
ledc_stop(LEDC_LOW_SPEED_MODE, self->chan_handle.channel, 0); ledc_stop(LEDC_LOW_SPEED_MODE, self->chan_handle.channel, 0);
} }
reserved_channels[self->chan_handle.channel] = INDEX_EMPTY; reserved_channels[self->chan_handle.channel] = INDEX_EMPTY;
never_reset_chan[self->chan_handle.channel] = false;
// Search if any other channel is using the timer // Search if any other channel is using the timer
bool taken = false; bool taken = false;
for (size_t i = 0; i < LEDC_CHANNEL_MAX; i++) { for (size_t i = 0; i < LEDC_CHANNEL_MAX; i++) {
if (reserved_channels[i] == self->tim_handle.timer_num) { if (reserved_channels[i] == self->tim_handle.timer_num) {
taken = true; taken = true;
break;
} }
} }
// Variable frequency means there's only one channel on the timer // Variable frequency means there's only one channel on the timer
@ -195,6 +210,7 @@ void common_hal_pwmio_pwmout_deinit(pwmio_pwmout_obj_t *self) {
reserved_timer_freq[self->tim_handle.timer_num] = 0; reserved_timer_freq[self->tim_handle.timer_num] = 0;
// if timer isn't varfreq this will be off aleady // if timer isn't varfreq this will be off aleady
varfreq_timers[self->tim_handle.timer_num] = false; varfreq_timers[self->tim_handle.timer_num] = false;
never_reset_tim[self->tim_handle.timer_num] = false;
} }
common_hal_reset_pin(self->pin); common_hal_reset_pin(self->pin);
self->deinited = true; self->deinited = true;

View File

@ -240,7 +240,7 @@ socketpool_socket_obj_t *common_hal_socketpool_socket(socketpool_socketpool_obj_
return sock; return sock;
} }
int socketpool_socket_accept(socketpool_socket_obj_t *self, uint8_t *ip, uint32_t *port) { int socketpool_socket_accept(socketpool_socket_obj_t *self, uint8_t *ip, uint32_t *port, socketpool_socket_obj_t *accepted) {
struct sockaddr_in accept_addr; struct sockaddr_in accept_addr;
socklen_t socklen = sizeof(accept_addr); socklen_t socklen = sizeof(accept_addr);
int newsoc = -1; int newsoc = -1;
@ -274,12 +274,25 @@ int socketpool_socket_accept(socketpool_socket_obj_t *self, uint8_t *ip, uint32_
lwip_close(newsoc); lwip_close(newsoc);
return -MP_EBADF; return -MP_EBADF;
} }
if (accepted != NULL) {
// Close the active socket because we have another we accepted.
if (!common_hal_socketpool_socket_get_closed(accepted)) {
common_hal_socketpool_socket_close(accepted);
}
// Create the socket
accepted->num = newsoc;
accepted->pool = self->pool;
accepted->connected = true;
}
return newsoc; return newsoc;
} }
socketpool_socket_obj_t *common_hal_socketpool_socket_accept(socketpool_socket_obj_t *self, socketpool_socket_obj_t *common_hal_socketpool_socket_accept(socketpool_socket_obj_t *self,
uint8_t *ip, uint32_t *port) { uint8_t *ip, uint32_t *port) {
int newsoc = socketpool_socket_accept(self, ip, port); int newsoc = socketpool_socket_accept(self, ip, port, NULL);
if (newsoc > 0) { if (newsoc > 0) {
mark_user_socket(newsoc); mark_user_socket(newsoc);
@ -554,6 +567,15 @@ void common_hal_socketpool_socket_settimeout(socketpool_socket_obj_t *self, uint
self->timeout_ms = timeout_ms; self->timeout_ms = timeout_ms;
} }
int common_hal_socketpool_socket_setsockopt(socketpool_socket_obj_t *self, int level, int optname, const void *value, size_t optlen) {
int err = lwip_setsockopt(self->num, level, optname, value, optlen);
if (err != 0) {
return -errno;
}
return 0;
}
bool common_hal_socketpool_readable(socketpool_socket_obj_t *self) { bool common_hal_socketpool_readable(socketpool_socket_obj_t *self) {
struct timeval immediate = {0, 0}; struct timeval immediate = {0, 0};
@ -577,3 +599,18 @@ bool common_hal_socketpool_writable(socketpool_socket_obj_t *self) {
// including returning true in the error case // including returning true in the error case
return num_triggered != 0; return num_triggered != 0;
} }
void socketpool_socket_move(socketpool_socket_obj_t *self, socketpool_socket_obj_t *sock) {
*sock = *self;
self->connected = false;
self->num = -1;
}
void socketpool_socket_reset(socketpool_socket_obj_t *self) {
if (self->base.type == &socketpool_socket_type) {
return;
}
self->base.type = &socketpool_socket_type;
self->connected = false;
self->num = -1;
}

View File

@ -45,6 +45,16 @@ void common_hal_socketpool_socketpool_construct(socketpool_socketpool_obj_t *sel
mp_obj_t common_hal_socketpool_socketpool_gethostbyname(socketpool_socketpool_obj_t *self, mp_obj_t common_hal_socketpool_socketpool_gethostbyname(socketpool_socketpool_obj_t *self,
const char *host) { const char *host) {
// As of 2022, the version of lwip in esp-idf does not handle the
// trailing-dot syntax of domain names, so emulate it.
// Remove this once https://github.com/espressif/esp-idf/issues/10013 has
// been implemented
size_t strlen_host = strlen(host);
if (strlen_host && host[strlen_host - 1] == '.') {
mp_obj_t nodot = mp_obj_new_str(host, strlen_host - 1);
host = mp_obj_str_get_str(nodot);
}
const struct addrinfo hints = { const struct addrinfo hints = {
.ai_family = AF_INET, .ai_family = AF_INET,
.ai_socktype = SOCK_STREAM, .ai_socktype = SOCK_STREAM,

View File

@ -55,31 +55,31 @@ mp_obj_t common_hal_wifi_network_get_country(wifi_network_obj_t *self) {
} }
mp_obj_t common_hal_wifi_network_get_authmode(wifi_network_obj_t *self) { mp_obj_t common_hal_wifi_network_get_authmode(wifi_network_obj_t *self) {
uint8_t authmode_mask = 0; uint32_t authmode_mask = 0;
switch (self->record.authmode) { switch (self->record.authmode) {
case WIFI_AUTH_OPEN: case WIFI_AUTH_OPEN:
authmode_mask = (1 << AUTHMODE_OPEN); authmode_mask = AUTHMODE_OPEN;
break; break;
case WIFI_AUTH_WEP: case WIFI_AUTH_WEP:
authmode_mask = (1 << AUTHMODE_WEP); authmode_mask = AUTHMODE_WEP;
break; break;
case WIFI_AUTH_WPA_PSK: case WIFI_AUTH_WPA_PSK:
authmode_mask = (1 << AUTHMODE_WPA) | (1 << AUTHMODE_PSK); authmode_mask = AUTHMODE_WPA | AUTHMODE_PSK;
break; break;
case WIFI_AUTH_WPA2_PSK: case WIFI_AUTH_WPA2_PSK:
authmode_mask = (1 << AUTHMODE_WPA2) | (1 << AUTHMODE_PSK); authmode_mask = AUTHMODE_WPA2 | AUTHMODE_PSK;
break; break;
case WIFI_AUTH_WPA_WPA2_PSK: case WIFI_AUTH_WPA_WPA2_PSK:
authmode_mask = (1 << AUTHMODE_WPA) | (1 << AUTHMODE_WPA2) | (1 << AUTHMODE_PSK); authmode_mask = AUTHMODE_WPA | AUTHMODE_WPA2 | AUTHMODE_PSK;
break; break;
case WIFI_AUTH_WPA2_ENTERPRISE: case WIFI_AUTH_WPA2_ENTERPRISE:
authmode_mask = (1 << AUTHMODE_WPA2) | (1 << AUTHMODE_ENTERPRISE); authmode_mask = AUTHMODE_WPA2 | AUTHMODE_ENTERPRISE;
break; break;
case WIFI_AUTH_WPA3_PSK: case WIFI_AUTH_WPA3_PSK:
authmode_mask = (1 << AUTHMODE_WPA3) | (1 << AUTHMODE_PSK); authmode_mask = AUTHMODE_WPA3 | AUTHMODE_PSK;
break; break;
case WIFI_AUTH_WPA2_WPA3_PSK: case WIFI_AUTH_WPA2_WPA3_PSK:
authmode_mask = (1 << AUTHMODE_WPA2) | (1 << AUTHMODE_WPA3) | (1 << AUTHMODE_PSK); authmode_mask = AUTHMODE_WPA2 | AUTHMODE_WPA3 | AUTHMODE_PSK;
break; break;
default: default:
break; break;

View File

@ -205,20 +205,21 @@ void common_hal_wifi_radio_stop_station(wifi_radio_obj_t *self) {
set_mode_station(self, false); set_mode_station(self, false);
} }
void common_hal_wifi_radio_start_ap(wifi_radio_obj_t *self, uint8_t *ssid, size_t ssid_len, uint8_t *password, size_t password_len, uint8_t channel, uint8_t authmode, uint8_t max_connections) { void common_hal_wifi_radio_start_ap(wifi_radio_obj_t *self, uint8_t *ssid, size_t ssid_len, uint8_t *password, size_t password_len, uint8_t channel, uint32_t authmodes, uint8_t max_connections) {
set_mode_ap(self, true); set_mode_ap(self, true);
switch (authmode) { uint8_t authmode = 0;
case (1 << AUTHMODE_OPEN): switch (authmodes) {
case AUTHMODE_OPEN:
authmode = WIFI_AUTH_OPEN; authmode = WIFI_AUTH_OPEN;
break; break;
case ((1 << AUTHMODE_WPA) | (1 << AUTHMODE_PSK)): case AUTHMODE_WPA | AUTHMODE_PSK:
authmode = WIFI_AUTH_WPA_PSK; authmode = WIFI_AUTH_WPA_PSK;
break; break;
case ((1 << AUTHMODE_WPA2) | (1 << AUTHMODE_PSK)): case AUTHMODE_WPA2 | AUTHMODE_PSK:
authmode = WIFI_AUTH_WPA2_PSK; authmode = WIFI_AUTH_WPA2_PSK;
break; break;
case ((1 << AUTHMODE_WPA) | (1 << AUTHMODE_WPA2) | (1 << AUTHMODE_PSK)): case AUTHMODE_WPA | AUTHMODE_WPA2 | AUTHMODE_PSK:
authmode = WIFI_AUTH_WPA_WPA2_PSK; authmode = WIFI_AUTH_WPA_WPA2_PSK;
break; break;
default: default:

View File

@ -80,6 +80,12 @@ CONFIG_ESP_SLEEP_GPIO_RESET_WORKAROUND=y
# end of Hardware Settings # end of Hardware Settings
#
# PHY
#
CONFIG_ESP_PHY_ENABLE_USB=y
# end of PHY
# #
# ESP System Settings # ESP System Settings
# #
@ -97,8 +103,12 @@ CONFIG_ESP_SYSTEM_MEMPROT_MEM_ALIGN_SIZE=512
CONFIG_ESP_MAIN_TASK_AFFINITY_CPU0=y CONFIG_ESP_MAIN_TASK_AFFINITY_CPU0=y
# CONFIG_ESP_MAIN_TASK_AFFINITY_NO_AFFINITY is not set # CONFIG_ESP_MAIN_TASK_AFFINITY_NO_AFFINITY is not set
CONFIG_ESP_MAIN_TASK_AFFINITY=0x0 CONFIG_ESP_MAIN_TASK_AFFINITY=0x0
CONFIG_ESP_CONSOLE_SECONDARY_NONE=y
# CONFIG_ESP_CONSOLE_SECONDARY_USB_SERIAL_JTAG is not set
# end of ESP System Settings # end of ESP System Settings
# #
# Wi-Fi # Wi-Fi
# #

View File

@ -1,51 +0,0 @@
/*
* This file is part of the MicroPython project, http://micropython.org/
*
* The MIT License (MIT)
*
* SPDX-FileCopyrightText: Copyright (c) 2013, 2014 Damien P. George
*
* Permission is hereby granted, free of charge, to any person obtaining a copy
* of this software and associated documentation files (the "Software"), to deal
* in the Software without restriction, including without limitation the rights
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
* copies of the Software, and to permit persons to whom the Software is
* furnished to do so, subject to the following conditions:
*
* The above copyright notice and this permission notice shall be included in
* all copies or substantial portions of the Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
* THE SOFTWARE.
*/
#include "py/runtime.h"
#include "lib/oofatfs/ff.h"
#include "shared/timeutils/timeutils.h"
#include "shared-bindings/rtc/RTC.h"
#include "shared-bindings/time/__init__.h"
#include "supervisor/fatfs_port.h"
DWORD _time_override = 0;
DWORD get_fattime(void) {
if (_time_override > 0) {
return _time_override;
}
#if CIRCUITPY_RTC
timeutils_struct_time_t tm;
common_hal_rtc_get_time(&tm);
return ((tm.tm_year - 1980) << 25) | (tm.tm_mon << 21) | (tm.tm_mday << 16) |
(tm.tm_hour << 11) | (tm.tm_min << 5) | (tm.tm_sec >> 1);
#else
return ((2016 - 1980) << 25) | ((9) << 21) | ((1) << 16) | ((16) << 11) | ((43) << 5) | (35 / 2);
#endif
}
void override_fattime(DWORD time) {
_time_override = time;
}

View File

@ -22,37 +22,7 @@
# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN # OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
# THE SOFTWARE. # THE SOFTWARE.
# Select the board to build for. include ../../py/circuitpy_mkenv.mk
ifeq ($(BOARD),)
$(error You must provide a BOARD parameter)
else
ifeq ($(wildcard boards/$(BOARD)/.),)
$(error Invalid BOARD specified)
endif
endif
# If the build directory is not given, make it reflect the board name.
BUILD ?= build-$(BOARD)
include ../../py/mkenv.mk
# Board-specific
include boards/$(BOARD)/mpconfigboard.mk
# Port-specific
include mpconfigport.mk
# CircuitPython-specific
include $(TOP)/py/circuitpy_mpconfig.mk
# qstr definitions (must come before including py.mk)
QSTR_DEFS = qstrdefsport.h
# include py core make definitions
include $(TOP)/py/py.mk
include $(TOP)/supervisor/supervisor.mk
# Include make rules and variables common across CircuitPython builds.
include $(TOP)/py/circuitpy_defns.mk
CROSS_COMPILE = riscv64-unknown-elf- CROSS_COMPILE = riscv64-unknown-elf-
@ -117,7 +87,6 @@ CFLAGS += -DCFG_TUSB_MCU=OPT_MCU_VALENTYUSB_EPTRI -DCFG_TUD_CDC_RX_BUFSIZE=1024
SRC_C += \ SRC_C += \
background.c \ background.c \
fatfs_port.c \
mphalport.c \ mphalport.c \
boards/$(BOARD)/board.c \ boards/$(BOARD)/board.c \
boards/$(BOARD)/pins.c boards/$(BOARD)/pins.c

View File

@ -23,36 +23,7 @@
# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN # OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
# THE SOFTWARE. # THE SOFTWARE.
# Select the board to build for. include ../../py/circuitpy_mkenv.mk
ifeq ($(BOARD),)
$(error You must provide a BOARD parameter)
else
ifeq ($(wildcard boards/$(BOARD)/.),)
$(error Invalid BOARD specified)
endif
endif
# If the build directory is not given, make it reflect the board name.
BUILD ?= build-$(BOARD)
include ../../py/mkenv.mk
# Board-specific
include boards/$(BOARD)/mpconfigboard.mk
# Port-specific
include mpconfigport.mk
# CircuitPython-specific
include $(TOP)/py/circuitpy_mpconfig.mk
# qstr definitions (must come before including py.mk)
QSTR_DEFS = qstrdefsport.h
# include py core make definitions
include $(TOP)/py/py.mk
include $(TOP)/supervisor/supervisor.mk
# Include make rules and variables common across CircuitPython builds.
include $(TOP)/py/circuitpy_defns.mk
CROSS_COMPILE = arm-none-eabi- CROSS_COMPILE = arm-none-eabi-
@ -150,7 +121,6 @@ SRC_C += \
boards/$(BOARD)/board.c \ boards/$(BOARD)/board.c \
boards/$(BOARD)/flash_config.c \ boards/$(BOARD)/flash_config.c \
boards/$(BOARD)/pins.c \ boards/$(BOARD)/pins.c \
fatfs_port.c \
lib/tinyusb/src/portable/chipidea/ci_hs/dcd_ci_hs.c \ lib/tinyusb/src/portable/chipidea/ci_hs/dcd_ci_hs.c \
mphalport.c \ mphalport.c \
peripherals/mimxrt10xx/$(CHIP_FAMILY)/clocks.c \ peripherals/mimxrt10xx/$(CHIP_FAMILY)/clocks.c \

View File

@ -1,48 +0,0 @@
/*
* This file is part of the MicroPython project, http://micropython.org/
*
* The MIT License (MIT)
*
* SPDX-FileCopyrightText: Copyright (c) 2013, 2014 Damien P. George
*
* Permission is hereby granted, free of charge, to any person obtaining a copy
* of this software and associated documentation files (the "Software"), to deal
* in the Software without restriction, including without limitation the rights
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
* copies of the Software, and to permit persons to whom the Software is
* furnished to do so, subject to the following conditions:
*
* The above copyright notice and this permission notice shall be included in
* all copies or substantial portions of the Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
* THE SOFTWARE.
*/
#include "py/mphal.h"
#include "py/runtime.h"
#include "lib/oofatfs/ff.h" /* FatFs lower layer API */
#include "lib/oofatfs/diskio.h" /* FatFs lower layer API */
#include "shared/timeutils/timeutils.h"
#if CIRCUITPY_RTC
#include "shared-bindings/rtc/RTC.h"
#endif
DWORD get_fattime(void) {
#if CIRCUITPY_RTC
timeutils_struct_time_t tm;
common_hal_rtc_get_time(&tm);
return ((tm.tm_year - 1980) << 25) | (tm.tm_mon << 21) | (tm.tm_mday << 16) |
(tm.tm_hour << 11) | (tm.tm_min << 5) | (tm.tm_sec >> 1);
#else
return ((2016 - 1980) << 25) | ((9) << 21) | ((1) << 16) | ((16) << 11) | ((43) << 5) | (35 / 2);
#endif
}

View File

@ -22,42 +22,7 @@
# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN # OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
# THE SOFTWARE. # THE SOFTWARE.
# Select the board to build for. include ../../py/circuitpy_mkenv.mk
ifeq ($(BOARD),)
$(info You must provide a BOARD parameter with 'BOARD=')
$(info Possible values are:)
$(info $(sort $(subst /.,,$(subst boards/,,$(wildcard boards/*/.)))))
$(error BOARD not defined)
else
ifeq ($(wildcard boards/$(BOARD)/.),)
$(error Invalid BOARD specified)
endif
endif
CLI_SD := $(SD)
SD_LOWER = $(shell echo $(SD) | tr '[:upper:]' '[:lower:]')
# Build directory with SD if it's different from the default.
BUILD ?= $(if $(CLI_SD),build-$(BOARD)-$(SD_LOWER),build-$(BOARD))
include ../../py/mkenv.mk
# Board-specific
include boards/$(BOARD)/mpconfigboard.mk
# Port-specific
include mpconfigport.mk
# CircuitPython-specific
include $(TOP)/py/circuitpy_mpconfig.mk
# qstr definitions (must come before including py.mk)
QSTR_DEFS = qstrdefsport.h
# include py core make definitions
include $(TOP)/py/py.mk
include $(TOP)/supervisor/supervisor.mk
# Include make rules and variables common across CircuitPython builds.
include $(TOP)/py/circuitpy_defns.mk
ifneq ($(SD), ) ifneq ($(SD), )
include bluetooth/bluetooth_common.mk include bluetooth/bluetooth_common.mk
@ -165,7 +130,6 @@ endif
SRC_C += \ SRC_C += \
background.c \ background.c \
fatfs_port.c \
boards/$(BOARD)/board.c \ boards/$(BOARD)/board.c \
boards/$(BOARD)/pins.c \ boards/$(BOARD)/pins.c \
device/$(MCU_VARIANT)/startup_$(MCU_SUB_VARIANT).c \ device/$(MCU_VARIANT)/startup_$(MCU_SUB_VARIANT).c \

View File

@ -22,36 +22,7 @@
# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN # OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
# THE SOFTWARE. # THE SOFTWARE.
# Select the board to build for. include ../../py/circuitpy_mkenv.mk
ifeq ($(BOARD),)
$(error You must provide a BOARD parameter)
else
ifeq ($(wildcard boards/$(BOARD)/.),)
$(error Invalid BOARD specified)
endif
endif
# If the build directory is not given, make it reflect the board name.
BUILD ?= build-$(BOARD)
include ../../py/mkenv.mk
# Board-specific
include boards/$(BOARD)/mpconfigboard.mk
# Port-specific
include mpconfigport.mk
# CircuitPython-specific
include $(TOP)/py/circuitpy_mpconfig.mk
# qstr definitions (must come before including py.mk)
QSTR_DEFS = qstrdefsport.h
# include py core make definitions
include $(TOP)/py/py.mk
include $(TOP)/supervisor/supervisor.mk
# Include make rules and variables common across CircuitPython builds.
include $(TOP)/py/circuitpy_defns.mk
CROSS_COMPILE = arm-none-eabi- CROSS_COMPILE = arm-none-eabi-
@ -78,6 +49,7 @@ SRC_LWIP := \
shared/netutils/netutils.c \ shared/netutils/netutils.c \
shared/netutils/trace.c \ shared/netutils/trace.c \
shared/netutils/dhcpserver.c \ shared/netutils/dhcpserver.c \
$(wildcard lib/lwip/src/apps/mdns/*.c) \
$(wildcard lib/lwip/src/core/*.c) \ $(wildcard lib/lwip/src/core/*.c) \
$(wildcard lib/lwip/src/core/ipv4/*.c) \ $(wildcard lib/lwip/src/core/ipv4/*.c) \
lib/lwip/src/netif/ethernet.c \ lib/lwip/src/netif/ethernet.c \
@ -213,13 +185,15 @@ CFLAGS += \
-msoft-float \ -msoft-float \
-mfloat-abi=soft -mfloat-abi=soft
PICO_LDFLAGS = --specs=nosys.specs -Wl,--wrap=__aeabi_ldiv0 -Wl,--wrap=__aeabi_idiv0 -Wl,--wrap=__aeabi_lmul -Wl,--wrap=__clzsi2 -Wl,--wrap=__clzdi2 -Wl,--wrap=__ctzsi2 -Wl,--wrap=__ctzdi2 -Wl,--wrap=__popcountsi2 -Wl,--wrap=__popcountdi2 -Wl,--wrap=__clz -Wl,--wrap=__clzl -Wl,--wrap=__clzll -Wl,--wrap=__aeabi_idiv -Wl,--wrap=__aeabi_idivmod -Wl,--wrap=__aeabi_ldivmod -Wl,--wrap=__aeabi_uidiv -Wl,--wrap=__aeabi_uidivmod -Wl,--wrap=__aeabi_uldivmod -Wl,--wrap=__aeabi_dadd -Wl,--wrap=__aeabi_ddiv -Wl,--wrap=__aeabi_dmul -Wl,--wrap=__aeabi_drsub -Wl,--wrap=__aeabi_dsub -Wl,--wrap=__aeabi_cdcmpeq -Wl,--wrap=__aeabi_cdrcmple -Wl,--wrap=__aeabi_cdcmple -Wl,--wrap=__aeabi_dcmpeq -Wl,--wrap=__aeabi_dcmplt -Wl,--wrap=__aeabi_dcmple -Wl,--wrap=__aeabi_dcmpge -Wl,--wrap=__aeabi_dcmpgt -Wl,--wrap=__aeabi_dcmpun -Wl,--wrap=__aeabi_i2d -Wl,--wrap=__aeabi_l2d -Wl,--wrap=__aeabi_ui2d -Wl,--wrap=__aeabi_ul2d -Wl,--wrap=__aeabi_d2iz -Wl,--wrap=__aeabi_d2lz -Wl,--wrap=__aeabi_d2uiz -Wl,--wrap=__aeabi_d2ulz -Wl,--wrap=__aeabi_d2f -Wl,--wrap=sqrt -Wl,--wrap=cos -Wl,--wrap=sin -Wl,--wrap=tan -Wl,--wrap=atan2 -Wl,--wrap=exp -Wl,--wrap=log -Wl,--wrap=ldexp -Wl,--wrap=copysign -Wl,--wrap=trunc -Wl,--wrap=floor -Wl,--wrap=ceil -Wl,--wrap=round -Wl,--wrap=sincos -Wl,--wrap=asin -Wl,--wrap=acos -Wl,--wrap=atan -Wl,--wrap=sinh -Wl,--wrap=cosh -Wl,--wrap=tanh -Wl,--wrap=asinh -Wl,--wrap=acosh -Wl,--wrap=atanh -Wl,--wrap=exp2 -Wl,--wrap=log2 -Wl,--wrap=exp10 -Wl,--wrap=log10 -Wl,--wrap=pow -Wl,--wrap=powint -Wl,--wrap=hypot -Wl,--wrap=cbrt -Wl,--wrap=fmod -Wl,--wrap=drem -Wl,--wrap=remainder -Wl,--wrap=remquo -Wl,--wrap=expm1 -Wl,--wrap=log1p -Wl,--wrap=fma -Wl,--wrap=__aeabi_fadd -Wl,--wrap=__aeabi_fdiv -Wl,--wrap=__aeabi_fmul -Wl,--wrap=__aeabi_frsub -Wl,--wrap=__aeabi_fsub -Wl,--wrap=__aeabi_cfcmpeq -Wl,--wrap=__aeabi_cfrcmple -Wl,--wrap=__aeabi_cfcmple -Wl,--wrap=__aeabi_fcmpeq -Wl,--wrap=__aeabi_fcmplt -Wl,--wrap=__aeabi_fcmple -Wl,--wrap=__aeabi_fcmpge -Wl,--wrap=__aeabi_fcmpgt -Wl,--wrap=__aeabi_fcmpun -Wl,--wrap=__aeabi_i2f -Wl,--wrap=__aeabi_l2f -Wl,--wrap=__aeabi_ui2f -Wl,--wrap=__aeabi_ul2f -Wl,--wrap=__aeabi_f2iz -Wl,--wrap=__aeabi_f2lz -Wl,--wrap=__aeabi_f2uiz -Wl,--wrap=__aeabi_f2ulz -Wl,--wrap=__aeabi_f2d -Wl,--wrap=sqrtf -Wl,--wrap=cosf -Wl,--wrap=sinf -Wl,--wrap=tanf -Wl,--wrap=atan2f -Wl,--wrap=expf -Wl,--wrap=logf -Wl,--wrap=ldexpf -Wl,--wrap=copysignf -Wl,--wrap=truncf -Wl,--wrap=floorf -Wl,--wrap=ceilf -Wl,--wrap=roundf -Wl,--wrap=sincosf -Wl,--wrap=asinf -Wl,--wrap=acosf -Wl,--wrap=atanf -Wl,--wrap=sinhf -Wl,--wrap=coshf -Wl,--wrap=tanhf -Wl,--wrap=asinhf -Wl,--wrap=acoshf -Wl,--wrap=atanhf -Wl,--wrap=exp2f -Wl,--wrap=log2f -Wl,--wrap=exp10f -Wl,--wrap=log10f -Wl,--wrap=powf -Wl,--wrap=powintf -Wl,--wrap=hypotf -Wl,--wrap=cbrtf -Wl,--wrap=fmodf -Wl,--wrap=dremf -Wl,--wrap=remainderf -Wl,--wrap=remquof -Wl,--wrap=expm1f -Wl,--wrap=log1pf -Wl,--wrap=fmaf -Wl,--wrap=memcpy -Wl,--wrap=memset -Wl,--wrap=__aeabi_memcpy -Wl,--wrap=__aeabi_memset -Wl,--wrap=__aeabi_memcpy4 -Wl,--wrap=__aeabi_memset4 -Wl,--wrap=__aeabi_memcpy8 -Wl,--wrap=__aeabi_memset8 PICO_LDFLAGS = --specs=nosys.specs --specs=nano.specs -Wl,--wrap=__aeabi_ldiv0 -Wl,--wrap=__aeabi_idiv0 -Wl,--wrap=__aeabi_lmul -Wl,--wrap=__clzsi2 -Wl,--wrap=__clzdi2 -Wl,--wrap=__ctzsi2 -Wl,--wrap=__ctzdi2 -Wl,--wrap=__popcountsi2 -Wl,--wrap=__popcountdi2 -Wl,--wrap=__clz -Wl,--wrap=__clzl -Wl,--wrap=__clzll -Wl,--wrap=__aeabi_idiv -Wl,--wrap=__aeabi_idivmod -Wl,--wrap=__aeabi_ldivmod -Wl,--wrap=__aeabi_uidiv -Wl,--wrap=__aeabi_uidivmod -Wl,--wrap=__aeabi_uldivmod -Wl,--wrap=__aeabi_dadd -Wl,--wrap=__aeabi_ddiv -Wl,--wrap=__aeabi_dmul -Wl,--wrap=__aeabi_drsub -Wl,--wrap=__aeabi_dsub -Wl,--wrap=__aeabi_cdcmpeq -Wl,--wrap=__aeabi_cdrcmple -Wl,--wrap=__aeabi_cdcmple -Wl,--wrap=__aeabi_dcmpeq -Wl,--wrap=__aeabi_dcmplt -Wl,--wrap=__aeabi_dcmple -Wl,--wrap=__aeabi_dcmpge -Wl,--wrap=__aeabi_dcmpgt -Wl,--wrap=__aeabi_dcmpun -Wl,--wrap=__aeabi_i2d -Wl,--wrap=__aeabi_l2d -Wl,--wrap=__aeabi_ui2d -Wl,--wrap=__aeabi_ul2d -Wl,--wrap=__aeabi_d2iz -Wl,--wrap=__aeabi_d2lz -Wl,--wrap=__aeabi_d2uiz -Wl,--wrap=__aeabi_d2ulz -Wl,--wrap=__aeabi_d2f -Wl,--wrap=sqrt -Wl,--wrap=cos -Wl,--wrap=sin -Wl,--wrap=tan -Wl,--wrap=atan2 -Wl,--wrap=exp -Wl,--wrap=log -Wl,--wrap=ldexp -Wl,--wrap=copysign -Wl,--wrap=trunc -Wl,--wrap=floor -Wl,--wrap=ceil -Wl,--wrap=round -Wl,--wrap=sincos -Wl,--wrap=asin -Wl,--wrap=acos -Wl,--wrap=atan -Wl,--wrap=sinh -Wl,--wrap=cosh -Wl,--wrap=tanh -Wl,--wrap=asinh -Wl,--wrap=acosh -Wl,--wrap=atanh -Wl,--wrap=exp2 -Wl,--wrap=log2 -Wl,--wrap=exp10 -Wl,--wrap=log10 -Wl,--wrap=pow -Wl,--wrap=powint -Wl,--wrap=hypot -Wl,--wrap=cbrt -Wl,--wrap=fmod -Wl,--wrap=drem -Wl,--wrap=remainder -Wl,--wrap=remquo -Wl,--wrap=expm1 -Wl,--wrap=log1p -Wl,--wrap=fma -Wl,--wrap=__aeabi_fadd -Wl,--wrap=__aeabi_fdiv -Wl,--wrap=__aeabi_fmul -Wl,--wrap=__aeabi_frsub -Wl,--wrap=__aeabi_fsub -Wl,--wrap=__aeabi_cfcmpeq -Wl,--wrap=__aeabi_cfrcmple -Wl,--wrap=__aeabi_cfcmple -Wl,--wrap=__aeabi_fcmpeq -Wl,--wrap=__aeabi_fcmplt -Wl,--wrap=__aeabi_fcmple -Wl,--wrap=__aeabi_fcmpge -Wl,--wrap=__aeabi_fcmpgt -Wl,--wrap=__aeabi_fcmpun -Wl,--wrap=__aeabi_i2f -Wl,--wrap=__aeabi_l2f -Wl,--wrap=__aeabi_ui2f -Wl,--wrap=__aeabi_ul2f -Wl,--wrap=__aeabi_f2iz -Wl,--wrap=__aeabi_f2lz -Wl,--wrap=__aeabi_f2uiz -Wl,--wrap=__aeabi_f2ulz -Wl,--wrap=__aeabi_f2d -Wl,--wrap=sqrtf -Wl,--wrap=cosf -Wl,--wrap=sinf -Wl,--wrap=tanf -Wl,--wrap=atan2f -Wl,--wrap=expf -Wl,--wrap=logf -Wl,--wrap=ldexpf -Wl,--wrap=copysignf -Wl,--wrap=truncf -Wl,--wrap=floorf -Wl,--wrap=ceilf -Wl,--wrap=roundf -Wl,--wrap=sincosf -Wl,--wrap=asinf -Wl,--wrap=acosf -Wl,--wrap=atanf -Wl,--wrap=sinhf -Wl,--wrap=coshf -Wl,--wrap=tanhf -Wl,--wrap=asinhf -Wl,--wrap=acoshf -Wl,--wrap=atanhf -Wl,--wrap=exp2f -Wl,--wrap=log2f -Wl,--wrap=exp10f -Wl,--wrap=log10f -Wl,--wrap=powf -Wl,--wrap=powintf -Wl,--wrap=hypotf -Wl,--wrap=cbrtf -Wl,--wrap=fmodf -Wl,--wrap=dremf -Wl,--wrap=remainderf -Wl,--wrap=remquof -Wl,--wrap=expm1f -Wl,--wrap=log1pf -Wl,--wrap=fmaf -Wl,--wrap=memcpy -Wl,--wrap=memset -Wl,--wrap=__aeabi_memcpy -Wl,--wrap=__aeabi_memset -Wl,--wrap=__aeabi_memcpy4 -Wl,--wrap=__aeabi_memset4 -Wl,--wrap=__aeabi_memcpy8 -Wl,--wrap=__aeabi_memset8
# Use toolchain libm if we're not using our own. # Use toolchain libm if we're not using our own.
ifndef INTERNAL_LIBM ifndef INTERNAL_LIBM
LIBS += -lm LIBS += -lm
endif endif
LIBS += -lc
SRC_SDK := \ SRC_SDK := \
src/common/pico_sync/critical_section.c \ src/common/pico_sync/critical_section.c \
src/common/pico_sync/lock_core.c \ src/common/pico_sync/lock_core.c \
@ -272,7 +246,6 @@ SRC_C += \
background.c \ background.c \
peripherals/pins.c \ peripherals/pins.c \
lib/crypto-algorithms/sha256.c \ lib/crypto-algorithms/sha256.c \
fatfs_port.c \
lib/tinyusb/src/portable/raspberrypi/rp2040/dcd_rp2040.c \ lib/tinyusb/src/portable/raspberrypi/rp2040/dcd_rp2040.c \
lib/tinyusb/src/portable/raspberrypi/rp2040/rp2040_usb.c \ lib/tinyusb/src/portable/raspberrypi/rp2040/rp2040_usb.c \
mphalport.c \ mphalport.c \
@ -443,7 +416,7 @@ $(BUILD)/firmware.elf: $(OBJ) $(LINK_LD)
$(STEPECHO) "LINK $@" $(STEPECHO) "LINK $@"
$(Q)echo $(OBJ) > $(BUILD)/firmware.objs $(Q)echo $(OBJ) > $(BUILD)/firmware.objs
$(Q)echo $(PICO_LDFLAGS) > $(BUILD)/firmware.ldflags $(Q)echo $(PICO_LDFLAGS) > $(BUILD)/firmware.ldflags
$(Q)$(CC) -o $@ $(CFLAGS) @$(BUILD)/firmware.ldflags -Wl,-T,$(LINK_LD) -Wl,-Map=$@.map -Wl,-cref -Wl,--gc-sections @$(BUILD)/firmware.objs $(Q)$(CC) -o $@ $(CFLAGS) @$(BUILD)/firmware.ldflags -Wl,-T,$(LINK_LD) -Wl,-Map=$@.map -Wl,-cref -Wl,--gc-sections @$(BUILD)/firmware.objs -Wl,-lc
$(Q)$(SIZE) $@ | $(PYTHON) $(TOP)/tools/build_memory_info.py $(LINK_LD) $(Q)$(SIZE) $@ | $(PYTHON) $(TOP)/tools/build_memory_info.py $(LINK_LD)
$(BUILD)/firmware.bin: $(BUILD)/firmware.elf $(BUILD)/firmware.bin: $(BUILD)/firmware.elf

View File

@ -14,8 +14,8 @@ CIRCUITPY_CYW43 = 1
CIRCUITPY_SSL = 1 CIRCUITPY_SSL = 1
CIRCUITPY_SSL_MBEDTLS = 1 CIRCUITPY_SSL_MBEDTLS = 1
CIRCUITPY_HASHLIB = 1 CIRCUITPY_HASHLIB = 1
CIRCUITPY_WEB_WORKFLOW = 0 CIRCUITPY_WEB_WORKFLOW = 1
CIRCUITPY_MDNS = 0 CIRCUITPY_MDNS = 1
CIRCUITPY_SOCKETPOOL = 1 CIRCUITPY_SOCKETPOOL = 1
CIRCUITPY_WIFI = 1 CIRCUITPY_WIFI = 1

View File

@ -151,6 +151,15 @@ bool common_hal_busio_spi_configure(busio_spi_obj_t *self,
spi_set_format(self->peripheral, bits, polarity, phase, SPI_MSB_FIRST); spi_set_format(self->peripheral, bits, polarity, phase, SPI_MSB_FIRST);
// Workaround to start with clock line high if polarity=1. The hw SPI peripheral does not do this
// automatically. See https://github.com/raspberrypi/pico-sdk/issues/868 and
// https://forums.raspberrypi.com/viewtopic.php?t=336142
// TODO: scheduled to be be fixed in pico-sdk 1.5.0.
if (polarity) {
hw_clear_bits(&spi_get_hw(self->peripheral)->cr1, SPI_SSPCR1_SSE_BITS); // disable the SPI
hw_set_bits(&spi_get_hw(self->peripheral)->cr1, SPI_SSPCR1_SSE_BITS); // re-enable the SPI
}
self->polarity = polarity; self->polarity = polarity;
self->phase = phase; self->phase = phase;
self->bits = bits; self->bits = bits;

View File

@ -0,0 +1,64 @@
/*
* This file is part of the MicroPython project, http://micropython.org/
*
* The MIT License (MIT)
*
* Copyright (c) 2022 Scott Shawcroft for Adafruit Industries
*
* Permission is hereby granted, free of charge, to any person obtaining a copy
* of this software and associated documentation files (the "Software"), to deal
* in the Software without restriction, including without limitation the rights
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
* copies of the Software, and to permit persons to whom the Software is
* furnished to do so, subject to the following conditions:
*
* The above copyright notice and this permission notice shall be included in
* all copies or substantial portions of the Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
* THE SOFTWARE.
*/
#include "shared-bindings/mdns/RemoteService.h"
#include "shared-bindings/ipaddress/IPv4Address.h"
const char *common_hal_mdns_remoteservice_get_service_type(mdns_remoteservice_obj_t *self) {
return self->service_name;
}
const char *common_hal_mdns_remoteservice_get_protocol(mdns_remoteservice_obj_t *self) {
return self->protocol;
}
const char *common_hal_mdns_remoteservice_get_instance_name(mdns_remoteservice_obj_t *self) {
return self->instance_name;
}
const char *common_hal_mdns_remoteservice_get_hostname(mdns_remoteservice_obj_t *self) {
return self->hostname;
}
mp_int_t common_hal_mdns_remoteservice_get_port(mdns_remoteservice_obj_t *self) {
return self->port;
}
uint32_t mdns_remoteservice_get_ipv4_address(mdns_remoteservice_obj_t *self) {
return self->ipv4_address;
}
mp_obj_t common_hal_mdns_remoteservice_get_ipv4_address(mdns_remoteservice_obj_t *self) {
uint32_t addr = mdns_remoteservice_get_ipv4_address(self);
if (addr == 0) {
return mp_const_none;
}
return common_hal_ipaddress_new_ipv4address(addr);
}
void common_hal_mdns_remoteservice_deinit(mdns_remoteservice_obj_t *self) {
}

View File

@ -3,7 +3,7 @@
* *
* The MIT License (MIT) * The MIT License (MIT)
* *
* SPDX-FileCopyrightText: Copyright (c) 2013, 2014 Damien P. George * Copyright (c) 2022 Scott Shawcroft for Adafruit Industries
* *
* Permission is hereby granted, free of charge, to any person obtaining a copy * Permission is hereby granted, free of charge, to any person obtaining a copy
* of this software and associated documentation files (the "Software"), to deal * of this software and associated documentation files (the "Software"), to deal
@ -24,10 +24,17 @@
* THE SOFTWARE. * THE SOFTWARE.
*/ */
#include "py/runtime.h" #pragma once
#include "lib/oofatfs/ff.h"
DWORD get_fattime(void) { #include "lwip/apps/mdns.h"
// TODO: Implement this function. For now, fake it.
return ((2016 - 1980) << 25) | ((12) << 21) | ((4) << 16) | ((00) << 11) | ((18) << 5) | (23 / 2); typedef struct {
} mp_obj_base_t base;
uint32_t ipv4_address;
uint16_t port;
char protocol[5]; // RFC 6763 Section 7.2 - 4 bytes + 1 for NUL
char service_name[17]; // RFC 6763 Section 7.2 - 16 bytes + 1 for NUL
char instance_name[64]; // RFC 6763 Section 7.2 - 63 bytes + 1 for NUL
char hostname[64]; // RFC 6762 Appendix A - 63 bytes for label + 1 for NUL
mp_obj_t next;
} mdns_remoteservice_obj_t;

View File

@ -0,0 +1,307 @@
/*
* This file is part of the MicroPython project, http://micropython.org/
*
* The MIT License (MIT)
*
* Copyright (c) 2022 Scott Shawcroft for Adafruit Industries
*
* Permission is hereby granted, free of charge, to any person obtaining a copy
* of this software and associated documentation files (the "Software"), to deal
* in the Software without restriction, including without limitation the rights
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
* copies of the Software, and to permit persons to whom the Software is
* furnished to do so, subject to the following conditions:
*
* The above copyright notice and this permission notice shall be included in
* all copies or substantial portions of the Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
* THE SOFTWARE.
*/
#include "shared-bindings/mdns/Server.h"
#include "py/gc.h"
#include "py/runtime.h"
#include "shared/runtime/interrupt_char.h"
#include "shared-bindings/mdns/RemoteService.h"
#include "shared-bindings/wifi/__init__.h"
#include "supervisor/shared/tick.h"
#include "lwip/apps/mdns.h"
#include "lwip/prot/dns.h"
STATIC bool inited = false;
#define NETIF_STA (&cyw43_state.netif[CYW43_ITF_STA])
#define NETIF_AP (&cyw43_state.netif[CYW43_ITF_AP])
void mdns_server_construct(mdns_server_obj_t *self, bool workflow) {
if (inited) {
return;
}
mdns_resp_init();
inited = true;
uint8_t mac[6];
wifi_radio_get_mac_address(&common_hal_wifi_radio_obj, mac);
snprintf(self->default_hostname, sizeof(self->default_hostname), "cpy-%02x%02x%02x", mac[3], mac[4], mac[5]);
common_hal_mdns_server_set_hostname(self, self->default_hostname);
if (workflow) {
// Add a second host entry to respond to "circuitpython.local" queries as well.
#if MDNS_MAX_SECONDARY_HOSTNAMES > 0
mdns_resp_add_secondary_hostname(NETIF_STA, "circuitpython");
#endif
}
}
void common_hal_mdns_server_construct(mdns_server_obj_t *self, mp_obj_t network_interface) {
if (network_interface != MP_OBJ_FROM_PTR(&common_hal_wifi_radio_obj)) {
mp_raise_ValueError(translate("mDNS only works with built-in WiFi"));
return;
}
if (inited) {
mp_raise_RuntimeError(translate("mDNS already initialized"));
}
mdns_server_construct(self, false);
}
void common_hal_mdns_server_deinit(mdns_server_obj_t *self) {
inited = false;
mdns_resp_remove_netif(NETIF_STA);
}
bool common_hal_mdns_server_deinited(mdns_server_obj_t *self) {
return !mdns_resp_netif_active(NETIF_STA);
}
const char *common_hal_mdns_server_get_hostname(mdns_server_obj_t *self) {
return self->hostname;
}
void common_hal_mdns_server_set_hostname(mdns_server_obj_t *self, const char *hostname) {
if (mdns_resp_netif_active(NETIF_STA)) {
mdns_resp_rename_netif(NETIF_STA, hostname);
} else {
mdns_resp_add_netif(NETIF_STA, hostname);
}
self->hostname = hostname;
}
const char *common_hal_mdns_server_get_instance_name(mdns_server_obj_t *self) {
return self->instance_name;
}
void common_hal_mdns_server_set_instance_name(mdns_server_obj_t *self, const char *instance_name) {
self->instance_name = instance_name;
}
typedef struct {
uint8_t request_id;
size_t i;
mdns_remoteservice_obj_t *out;
size_t out_len;
} nonalloc_search_state_t;
STATIC void copy_data_into_remote_service(struct mdns_answer *answer, const char *varpart, int varlen, mdns_remoteservice_obj_t *out) {
if (varlen > 0) {
if (answer->info.type == DNS_RRTYPE_A) {
char *hostname = out->hostname;
size_t len = MIN(63, answer->info.domain.name[0]);
memcpy(hostname, answer->info.domain.name + 1, len);
hostname[len] = '\0';
out->ipv4_address = varpart[0] | varpart[1] << 8 | varpart[2] << 16 | varpart[3] << 24;
}
if (answer->info.type == DNS_RRTYPE_SRV) {
// This isn't a null terminated string. Its length encoded.
uint8_t *domain = answer->info.domain.name;
char *instance_name = out->instance_name;
size_t offset = 0;
uint8_t iname_len = domain[offset++];
size_t len = MIN(63, iname_len);
memcpy(instance_name, domain + offset, len);
offset += iname_len;
instance_name[len] = '\0';
uint8_t sn_len = domain[offset++];
char *service_name = out->service_name;
len = MIN(16, sn_len);
memcpy(service_name, domain + offset, len);
offset += sn_len;
service_name[len] = '\0';
uint8_t proto_len = domain[offset++];
char *protocol = out->protocol;
len = MIN(4, proto_len);
memcpy(protocol, domain + offset, len);
offset += proto_len;
protocol[len] = '\0';
out->port = varpart[4] << 8 | varpart[5];
}
}
}
STATIC void search_result_cb(struct mdns_answer *answer, const char *varpart, int varlen, int flags, void *arg) {
nonalloc_search_state_t *state = arg;
state->out[state->i].base.type = &mdns_remoteservice_type;
copy_data_into_remote_service(answer, varpart, varlen, &state->out[state->i]);
if ((flags & MDNS_SEARCH_RESULT_LAST) != 0) {
state->i += 1;
}
if (state->i == state->out_len) {
mdns_search_stop(state->request_id);
state->request_id = MDNS_MAX_REQUESTS;
}
}
size_t mdns_server_find(mdns_server_obj_t *self, const char *service_type, const char *protocol,
mp_float_t timeout, mdns_remoteservice_obj_t *out, size_t out_len) {
enum mdns_sd_proto proto = DNSSD_PROTO_UDP;
if (strcmp(protocol, "_tcp") == 0) {
proto = DNSSD_PROTO_TCP;
}
nonalloc_search_state_t state;
state.i = 0;
state.out = out;
state.out_len = out_len;
err_t err = mdns_search_service(NULL, service_type, proto,
NETIF_STA, &search_result_cb, &state,
&state.request_id);
if (err != ERR_OK) {
return 0;
}
uint64_t start_ticks = supervisor_ticks_ms64();
uint64_t timeout_ms = timeout * 1000;
while (state.request_id < MDNS_MAX_REQUESTS &&
!mp_hal_is_interrupted() &&
supervisor_ticks_ms64() - start_ticks < timeout_ms) {
RUN_BACKGROUND_TASKS;
}
if (state.request_id < MDNS_MAX_REQUESTS) {
mdns_search_stop(state.request_id);
state.request_id = MDNS_MAX_REQUESTS;
}
return state.i;
}
typedef struct {
uint8_t request_id;
mdns_remoteservice_obj_t *head;
size_t count;
} alloc_search_state_t;
STATIC void alloc_search_result_cb(struct mdns_answer *answer, const char *varpart, int varlen, int flags, void *arg) {
alloc_search_state_t *state = arg;
if ((flags & MDNS_SEARCH_RESULT_FIRST) != 0) {
// first
mdns_remoteservice_obj_t *service = gc_alloc(sizeof(mdns_remoteservice_obj_t), 0, false);
mp_printf(&mp_plat_print, "found service %p\n", service);
if (service == NULL) {
// alloc fails
mdns_search_stop(state->request_id);
state->request_id = MDNS_MAX_REQUESTS;
if (state->count == 0) {
m_malloc_fail(sizeof(mdns_remoteservice_obj_t));
}
return;
}
service->base.type = &mdns_remoteservice_type;
state->count++;
service->next = state->head;
state->head = service;
}
copy_data_into_remote_service(answer, varpart, varlen, state->head);
}
mp_obj_t common_hal_mdns_server_find(mdns_server_obj_t *self, const char *service_type, const char *protocol, mp_float_t timeout) {
enum mdns_sd_proto proto = DNSSD_PROTO_UDP;
if (strcmp(protocol, "_tcp") == 0) {
proto = DNSSD_PROTO_TCP;
}
alloc_search_state_t state;
state.count = 0;
state.head = NULL;
err_t err = mdns_search_service(NULL, service_type, proto,
NETIF_STA, &alloc_search_result_cb, &state,
&state.request_id);
if (err != ERR_OK) {
mp_raise_RuntimeError(translate("Unable to start mDNS query"));
}
uint64_t start_ticks = supervisor_ticks_ms64();
uint64_t timeout_ms = timeout * 1000;
while (state.request_id < MDNS_MAX_REQUESTS &&
!mp_hal_is_interrupted() &&
supervisor_ticks_ms64() - start_ticks < timeout_ms) {
RUN_BACKGROUND_TASKS;
}
if (state.request_id < MDNS_MAX_REQUESTS) {
mdns_search_stop(state.request_id);
state.request_id = MDNS_MAX_REQUESTS;
}
mp_obj_tuple_t *tuple = MP_OBJ_TO_PTR(mp_obj_new_tuple(state.count, NULL));
mdns_remoteservice_obj_t *next = state.head;
uint8_t added = 0;
while (next != NULL) {
mdns_remoteservice_obj_t *cur = next;
tuple->items[added] = MP_OBJ_FROM_PTR(cur);
next = cur->next;
// Set next back to NULL so that each service object is independently
// tracked for GC.
cur->next = NULL;
added++;
}
return MP_OBJ_FROM_PTR(tuple);
}
void common_hal_mdns_server_advertise_service(mdns_server_obj_t *self, const char *service_type, const char *protocol, mp_int_t port) {
enum mdns_sd_proto proto = DNSSD_PROTO_UDP;
if (strcmp(protocol, "_tcp") == 0) {
proto = DNSSD_PROTO_TCP;
}
// Remove the existing service if it was already added.
int8_t existing_slot = MDNS_MAX_SERVICES;
for (int i = 0; i < MDNS_MAX_SERVICES; i++) {
if (self->service_type[i] != NULL &&
(service_type == self->service_type[i] ||
strcmp(service_type, self->service_type[i]) == 0)) {
existing_slot = i;
break;
}
}
if (existing_slot < MDNS_MAX_SERVICES) {
mdns_resp_del_service(NETIF_STA, existing_slot);
}
int8_t slot = mdns_resp_add_service(NETIF_STA, self->instance_name, service_type, proto, port, NULL, NULL);
if (slot < 0) {
mp_raise_RuntimeError(translate("Out of MDNS service slots"));
return;
}
self->service_type[slot] = service_type;
}

View File

@ -3,7 +3,7 @@
* *
* The MIT License (MIT) * The MIT License (MIT)
* *
* SPDX-FileCopyrightText: Copyright (c) 2013, 2014 Damien P. George * Copyright (c) 2022 Scott Shawcroft for Adafruit Industries
* *
* Permission is hereby granted, free of charge, to any person obtaining a copy * Permission is hereby granted, free of charge, to any person obtaining a copy
* of this software and associated documentation files (the "Software"), to deal * of this software and associated documentation files (the "Software"), to deal
@ -24,10 +24,17 @@
* THE SOFTWARE. * THE SOFTWARE.
*/ */
#include "py/runtime.h" #pragma once
#include "lib/oofatfs/ff.h"
DWORD get_fattime(void) { #include "py/obj.h"
// TODO: Implement this function. For now, fake it.
return ((2016 - 1980) << 25) | ((12) << 21) | ((4) << 16) | ((00) << 11) | ((18) << 5) | (23 / 2); #include "lwip/apps/mdns_opts.h"
}
typedef struct {
mp_obj_base_t base;
const char *hostname;
const char *instance_name;
// "cpy-" "XXXXXX" "\0"
char default_hostname[4 + 6 + 1];
const char *service_type[MDNS_MAX_SERVICES];
} mdns_server_obj_t;

View File

@ -0,0 +1 @@
// No mdns module functions.

View File

@ -166,6 +166,7 @@ static inline void exec_user_callback(socketpool_socket_obj_t *socket) {
mp_sched_schedule(socket->callback, MP_OBJ_FROM_PTR(socket)); mp_sched_schedule(socket->callback, MP_OBJ_FROM_PTR(socket));
} }
#endif #endif
supervisor_workflow_request_background();
} }
#if MICROPY_PY_LWIP_SOCK_RAW #if MICROPY_PY_LWIP_SOCK_RAW
@ -745,57 +746,47 @@ socketpool_socket_obj_t *common_hal_socketpool_socket(socketpool_socketpool_obj_
return socket; return socket;
} }
int socketpool_socket_accept(socketpool_socket_obj_t *self, uint8_t *ip, uint32_t *port) { int socketpool_socket_accept(socketpool_socket_obj_t *self, uint8_t *ip, uint32_t *port, socketpool_socket_obj_t *accepted) {
if (self->type != MOD_NETWORK_SOCK_STREAM) {
return -MP_EOPNOTSUPP;
}
if (common_hal_socketpool_socket_get_closed(self)) {
return -MP_EBADF; return -MP_EBADF;
} }
socketpool_socket_obj_t *common_hal_socketpool_socket_accept(socketpool_socket_obj_t *socket,
uint8_t *ip, uint32_t *port) {
if (socket->type != MOD_NETWORK_SOCK_STREAM) {
mp_raise_OSError(MP_EOPNOTSUPP);
}
// Create new socket object, do it here because we must not raise an out-of-memory
// exception when the LWIP concurrency lock is held
socketpool_socket_obj_t *socket2 = m_new_ll_obj_with_finaliser(socketpool_socket_obj_t);
socket2->base.type = &socketpool_socket_type;
MICROPY_PY_LWIP_ENTER MICROPY_PY_LWIP_ENTER
if (socket->pcb.tcp == NULL) { if (self->pcb.tcp == NULL) {
MICROPY_PY_LWIP_EXIT MICROPY_PY_LWIP_EXIT
m_del_obj(socketpool_socket_obj_t, socket2); return -MP_EBADF;
mp_raise_OSError(MP_EBADF);
} }
// I need to do this because "tcp_accepted", later, is a macro. // I need to do this because "tcp_accepted", later, is a macro.
struct tcp_pcb *listener = socket->pcb.tcp; struct tcp_pcb *listener = self->pcb.tcp;
if (listener->state != LISTEN) { if (listener->state != LISTEN) {
MICROPY_PY_LWIP_EXIT MICROPY_PY_LWIP_EXIT
m_del_obj(socketpool_socket_obj_t, socket2); return -MP_EINVAL;
mp_raise_OSError(MP_EINVAL);
} }
// accept incoming connection // accept incoming connection
struct tcp_pcb *volatile *incoming_connection = &lwip_socket_incoming_array(socket)[socket->incoming.connection.iget]; struct tcp_pcb *volatile *incoming_connection = &lwip_socket_incoming_array(self)[self->incoming.connection.iget];
if (*incoming_connection == NULL) { if (*incoming_connection == NULL) {
if (socket->timeout == 0) { if (self->timeout == 0) {
MICROPY_PY_LWIP_EXIT MICROPY_PY_LWIP_EXIT
m_del_obj(socketpool_socket_obj_t, socket2); return -MP_EAGAIN;
mp_raise_OSError(MP_EAGAIN); } else if (self->timeout != (unsigned)-1) {
} else if (socket->timeout != (unsigned)-1) { mp_uint_t retries = self->timeout / 100;
mp_uint_t retries = socket->timeout / 100; while (*incoming_connection == NULL && !mp_hal_is_interrupted()) {
while (*incoming_connection == NULL) {
MICROPY_PY_LWIP_EXIT MICROPY_PY_LWIP_EXIT
if (retries-- == 0) { if (retries-- == 0) {
m_del_obj(socketpool_socket_obj_t, socket2); return -MP_ETIMEDOUT;
mp_raise_OSError(MP_ETIMEDOUT);
} }
mp_hal_delay_ms(100); mp_hal_delay_ms(100);
MICROPY_PY_LWIP_REENTER MICROPY_PY_LWIP_REENTER
} }
} else { } else {
while (*incoming_connection == NULL) { while (*incoming_connection == NULL && !mp_hal_is_interrupted()) {
MICROPY_PY_LWIP_EXIT MICROPY_PY_LWIP_EXIT
poll_sockets(); poll_sockets();
MICROPY_PY_LWIP_REENTER MICROPY_PY_LWIP_REENTER
@ -803,43 +794,75 @@ socketpool_socket_obj_t *common_hal_socketpool_socket_accept(socketpool_socket_o
} }
} }
if (*incoming_connection == NULL) {
// We were interrupted.
return 0;
}
// Close the accepted socket because we have another we accepted.
if (!common_hal_socketpool_socket_get_closed(accepted)) {
common_hal_socketpool_socket_close(accepted);
}
// We get a new pcb handle... // We get a new pcb handle...
socket2->pcb.tcp = *incoming_connection; accepted->pcb.tcp = *incoming_connection;
if (++socket->incoming.connection.iget >= socket->incoming.connection.alloc) { if (++self->incoming.connection.iget >= self->incoming.connection.alloc) {
socket->incoming.connection.iget = 0; self->incoming.connection.iget = 0;
} }
*incoming_connection = NULL; *incoming_connection = NULL;
// ...and set up the new socket for it. // ...and set up the new socket for it.
socket2->domain = MOD_NETWORK_AF_INET; accepted->domain = MOD_NETWORK_AF_INET;
socket2->type = MOD_NETWORK_SOCK_STREAM; accepted->type = MOD_NETWORK_SOCK_STREAM;
socket2->incoming.pbuf = NULL; accepted->incoming.pbuf = NULL;
socket2->timeout = socket->timeout; accepted->timeout = self->timeout;
socket2->state = STATE_CONNECTED; accepted->state = STATE_CONNECTED;
socket2->recv_offset = 0; accepted->recv_offset = 0;
socket2->callback = MP_OBJ_NULL; accepted->callback = MP_OBJ_NULL;
tcp_arg(socket2->pcb.tcp, (void *)socket2); tcp_arg(accepted->pcb.tcp, (void *)accepted);
tcp_err(socket2->pcb.tcp, _lwip_tcp_error); tcp_err(accepted->pcb.tcp, _lwip_tcp_error);
tcp_recv(socket2->pcb.tcp, _lwip_tcp_recv); tcp_recv(accepted->pcb.tcp, _lwip_tcp_recv);
tcp_accepted(listener); tcp_accepted(listener);
MICROPY_PY_LWIP_EXIT MICROPY_PY_LWIP_EXIT
// output values
memcpy(ip, &(accepted->pcb.tcp->remote_ip), NETUTILS_IPV4ADDR_BUFSIZE);
*port = (mp_uint_t)accepted->pcb.tcp->remote_port;
return 1;
}
socketpool_socket_obj_t *common_hal_socketpool_socket_accept(socketpool_socket_obj_t *socket,
uint8_t *ip, uint32_t *port) {
// Create new socket object, do it here because we must not raise an out-of-memory
// exception when the LWIP concurrency lock is held
socketpool_socket_obj_t *accepted = m_new_ll_obj_with_finaliser(socketpool_socket_obj_t);
socketpool_socket_reset(accepted);
int ret = socketpool_socket_accept(socket, ip, port, accepted);
if (ret <= 0) {
m_del_obj(socketpool_socket_obj_t, accepted);
if (ret == 0) {
// Interrupted.
return mp_const_none;
}
mp_raise_OSError(-ret);
}
DEBUG_printf("registering socket in socketpool_socket_accept()\n"); DEBUG_printf("registering socket in socketpool_socket_accept()\n");
if (!register_open_socket(socket2)) { if (!register_open_socket(accepted)) {
DEBUG_printf("collecting garbage to open socket\n"); DEBUG_printf("collecting garbage to open socket\n");
gc_collect(); gc_collect();
if (!register_open_socket(socket2)) { if (!register_open_socket(accepted)) {
mp_raise_RuntimeError(translate("Out of sockets")); mp_raise_RuntimeError(translate("Out of sockets"));
} }
} }
mark_user_socket(socket2); mark_user_socket(accepted);
// output values return MP_OBJ_FROM_PTR(accepted);
memcpy(ip, &(socket2->pcb.tcp->remote_ip), NETUTILS_IPV4ADDR_BUFSIZE);
*port = (mp_uint_t)socket2->pcb.tcp->remote_port;
return MP_OBJ_FROM_PTR(socket2);
} }
bool common_hal_socketpool_socket_bind(socketpool_socket_obj_t *socket, bool common_hal_socketpool_socket_bind(socketpool_socket_obj_t *socket,
@ -847,21 +870,26 @@ bool common_hal_socketpool_socket_bind(socketpool_socket_obj_t *socket,
// get address // get address
ip_addr_t bind_addr; ip_addr_t bind_addr;
const ip_addr_t *bind_addr_ptr = &bind_addr;
if (hostlen > 0) {
int error = socketpool_resolve_host(socket->pool, host, &bind_addr); int error = socketpool_resolve_host(socket->pool, host, &bind_addr);
if (error != 0) { if (error != 0) {
mp_raise_OSError(EHOSTUNREACH); mp_raise_OSError(EHOSTUNREACH);
} }
} else {
bind_addr_ptr = IP_ANY_TYPE;
}
ip_set_option(socket->pcb.ip, SOF_REUSEADDR); ip_set_option(socket->pcb.ip, SOF_REUSEADDR);
err_t err = ERR_ARG; err_t err = ERR_ARG;
switch (socket->type) { switch (socket->type) {
case MOD_NETWORK_SOCK_STREAM: { case MOD_NETWORK_SOCK_STREAM: {
err = tcp_bind(socket->pcb.tcp, &bind_addr, port); err = tcp_bind(socket->pcb.tcp, bind_addr_ptr, port);
break; break;
} }
case MOD_NETWORK_SOCK_DGRAM: { case MOD_NETWORK_SOCK_DGRAM: {
err = udp_bind(socket->pcb.udp, &bind_addr, port); err = udp_bind(socket->pcb.udp, bind_addr_ptr, port);
break; break;
} }
} }
@ -1164,6 +1192,20 @@ void common_hal_socketpool_socket_settimeout(socketpool_socket_obj_t *self, uint
self->timeout = timeout_ms; self->timeout = timeout_ms;
} }
int common_hal_socketpool_socket_setsockopt(socketpool_socket_obj_t *self, int level, int optname, const void *value, size_t optlen) {
if (level == SOCKETPOOL_IPPROTO_TCP && optname == SOCKETPOOL_TCP_NODELAY) {
int one = 1;
bool enable = optlen == sizeof(&one) && memcmp(value, &one, optlen);
if (enable) {
tcp_set_flags(self->pcb.tcp, TF_NODELAY);
} else {
tcp_clear_flags(self->pcb.tcp, TF_NODELAY);
}
return 0;
}
return -MP_EOPNOTSUPP;
}
bool common_hal_socketpool_readable(socketpool_socket_obj_t *self) { bool common_hal_socketpool_readable(socketpool_socket_obj_t *self) {
MICROPY_PY_LWIP_ENTER; MICROPY_PY_LWIP_ENTER;
@ -1206,3 +1248,32 @@ bool common_hal_socketpool_writable(socketpool_socket_obj_t *self) {
return result; return result;
} }
void socketpool_socket_move(socketpool_socket_obj_t *self, socketpool_socket_obj_t *sock) {
*sock = *self;
self->state = _ERR_BADF;
// Reregister the callbacks with the new socket copy.
MICROPY_PY_LWIP_ENTER;
tcp_arg(self->pcb.tcp, NULL);
tcp_err(self->pcb.tcp, NULL);
tcp_recv(self->pcb.tcp, NULL);
self->pcb.tcp = NULL;
tcp_arg(sock->pcb.tcp, (void *)sock);
tcp_err(sock->pcb.tcp, _lwip_tcp_error);
tcp_recv(sock->pcb.tcp, _lwip_tcp_recv);
MICROPY_PY_LWIP_EXIT;
}
void socketpool_socket_reset(socketpool_socket_obj_t *self) {
if (self->base.type == &socketpool_socket_type) {
return;
}
self->base.type = &socketpool_socket_type;
self->pcb.tcp = NULL;
self->state = _ERR_BADF;
}

View File

@ -55,18 +55,18 @@ mp_obj_t common_hal_wifi_network_get_country(wifi_network_obj_t *self) {
mp_obj_t common_hal_wifi_network_get_authmode(wifi_network_obj_t *self) { mp_obj_t common_hal_wifi_network_get_authmode(wifi_network_obj_t *self) {
uint8_t authmode_mask = 0; uint8_t authmode_mask = 0;
if (self->record.auth_mode == 0) { if (self->record.auth_mode == 0) {
authmode_mask = (1 << AUTHMODE_OPEN); authmode_mask = AUTHMODE_OPEN;
} }
if (self->record.auth_mode & 1) { if (self->record.auth_mode & 1) {
authmode_mask |= (1 << AUTHMODE_PSK); authmode_mask |= AUTHMODE_PSK;
} }
; ;
if (self->record.auth_mode & 2) { if (self->record.auth_mode & 2) {
authmode_mask |= (1 << AUTHMODE_WPA); authmode_mask |= AUTHMODE_WPA;
} }
; ;
if (self->record.auth_mode & 4) { if (self->record.auth_mode & 4) {
authmode_mask |= (1 << AUTHMODE_WPA2); authmode_mask |= AUTHMODE_WPA2;
} }
; ;
mp_obj_t authmode_list = mp_obj_new_list(0, NULL); mp_obj_t authmode_list = mp_obj_new_list(0, NULL);

View File

@ -42,10 +42,6 @@
#include "shared-bindings/time/__init__.h" #include "shared-bindings/time/__init__.h"
#include "shared-module/ipaddress/__init__.h" #include "shared-module/ipaddress/__init__.h"
#if CIRCUITPY_MDNS
#include "components/mdns/include/mdns.h"
#endif
#include "lwip/sys.h" #include "lwip/sys.h"
#include "lwip/dns.h" #include "lwip/dns.h"
#include "lwip/icmp.h" #include "lwip/icmp.h"
@ -73,13 +69,12 @@ NORETURN static void ro_attribute(int attr) {
} }
bool common_hal_wifi_radio_get_enabled(wifi_radio_obj_t *self) { bool common_hal_wifi_radio_get_enabled(wifi_radio_obj_t *self) {
return true; return self->enabled;
} }
void common_hal_wifi_radio_set_enabled(wifi_radio_obj_t *self, bool enabled) { void common_hal_wifi_radio_set_enabled(wifi_radio_obj_t *self, bool enabled) {
if (!enabled) { self->enabled = enabled;
ro_attribute(MP_QSTR_enabled); // TODO: Actually enable and disable the WiFi module at this point.
}
} }
mp_obj_t common_hal_wifi_radio_get_hostname(wifi_radio_obj_t *self) { mp_obj_t common_hal_wifi_radio_get_hostname(wifi_radio_obj_t *self) {
@ -96,6 +91,10 @@ void common_hal_wifi_radio_set_hostname(wifi_radio_obj_t *self, const char *host
netif_set_hostname(NETIF_AP, self->hostname); netif_set_hostname(NETIF_AP, self->hostname);
} }
void wifi_radio_get_mac_address(wifi_radio_obj_t *self, uint8_t *mac) {
memcpy(mac, cyw43_state.mac, MAC_ADDRESS_LENGTH);
}
mp_obj_t common_hal_wifi_radio_get_mac_address(wifi_radio_obj_t *self) { mp_obj_t common_hal_wifi_radio_get_mac_address(wifi_radio_obj_t *self) {
return mp_obj_new_bytes(cyw43_state.mac, MAC_ADDRESS_LENGTH); return mp_obj_new_bytes(cyw43_state.mac, MAC_ADDRESS_LENGTH);
} }
@ -282,6 +281,13 @@ mp_obj_t common_hal_wifi_radio_get_ipv4_subnet_ap(wifi_radio_obj_t *self) {
return common_hal_ipaddress_new_ipv4address(NETIF_AP->netmask.addr); return common_hal_ipaddress_new_ipv4address(NETIF_AP->netmask.addr);
} }
uint32_t wifi_radio_get_ipv4_address(wifi_radio_obj_t *self) {
if (cyw43_tcpip_link_status(&cyw43_state, CYW43_ITF_STA) != CYW43_LINK_UP) {
return 0;
}
return NETIF_STA->ip_addr.addr;
}
mp_obj_t common_hal_wifi_radio_get_ipv4_address(wifi_radio_obj_t *self) { mp_obj_t common_hal_wifi_radio_get_ipv4_address(wifi_radio_obj_t *self) {
if (cyw43_tcpip_link_status(&cyw43_state, CYW43_ITF_STA) != CYW43_LINK_UP) { if (cyw43_tcpip_link_status(&cyw43_state, CYW43_ITF_STA) != CYW43_LINK_UP) {
return mp_const_none; return mp_const_none;

View File

@ -35,6 +35,7 @@ typedef struct {
mp_obj_base_t base; mp_obj_base_t base;
char hostname[254]; // hostname max is 253 chars, + 1 for trailing NUL char hostname[254]; // hostname max is 253 chars, + 1 for trailing NUL
wifi_scannednetworks_obj_t *current_scan; wifi_scannednetworks_obj_t *current_scan;
bool enabled;
} wifi_radio_obj_t; } wifi_radio_obj_t;
extern void common_hal_wifi_radio_gc_collect(wifi_radio_obj_t *self); extern void common_hal_wifi_radio_gc_collect(wifi_radio_obj_t *self);

View File

@ -1,48 +0,0 @@
/*
* This file is part of the MicroPython project, http://micropython.org/
*
* The MIT License (MIT)
*
* SPDX-FileCopyrightText: Copyright (c) 2013, 2014 Damien P. George
*
* Permission is hereby granted, free of charge, to any person obtaining a copy
* of this software and associated documentation files (the "Software"), to deal
* in the Software without restriction, including without limitation the rights
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
* copies of the Software, and to permit persons to whom the Software is
* furnished to do so, subject to the following conditions:
*
* The above copyright notice and this permission notice shall be included in
* all copies or substantial portions of the Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
* THE SOFTWARE.
*/
#include "py/mphal.h"
#include "py/runtime.h"
#include "lib/oofatfs/ff.h" /* FatFs lower layer API */
#include "lib/oofatfs/diskio.h" /* FatFs lower layer API */
#include "shared/timeutils/timeutils.h"
#if CIRCUITPY_RTC
#include "shared-bindings/rtc/RTC.h"
#endif
DWORD get_fattime(void) {
#if CIRCUITPY_RTC
timeutils_struct_time_t tm;
common_hal_rtc_get_time(&tm);
return ((tm.tm_year - 1980) << 25) | (tm.tm_mon << 21) | (tm.tm_mday << 16) |
(tm.tm_hour << 11) | (tm.tm_min << 5) | (tm.tm_sec >> 1);
#else
return ((2016 - 1980) << 25) | ((9) << 21) | ((1) << 16) | ((16) << 11) | ((43) << 5) | (35 / 2);
#endif
}

@ -1 +1 @@
Subproject commit 195dfcc10bb6f379e3dea45147590db2203d3c7b Subproject commit 746e0636033d0550b7652688124a77a6a1639cf9

@ -1 +1 @@
Subproject commit 239918ccc173cb2c2a62f41a40fd893f57faf1d6 Subproject commit d26459c32c83aa14a6d4e30237d91cee36e0adbd

View File

@ -54,6 +54,14 @@
#define LWIP_DHCP_DOES_ACD_CHECK 0 #define LWIP_DHCP_DOES_ACD_CHECK 0
#define SO_REUSE 1 #define SO_REUSE 1
#if CIRCUITPY_MDNS
#define LWIP_IGMP 1
#define LWIP_MDNS_RESPONDER 1
#define LWIP_NUM_NETIF_CLIENT_DATA 1
#define LWIP_NETIF_EXT_STATUS_CALLBACK 1
#define MDNS_MAX_SECONDARY_HOSTNAMES 1
#endif
#ifndef NDEBUG #ifndef NDEBUG
#define LWIP_DEBUG 1 #define LWIP_DEBUG 1
#define LWIP_STATS 1 #define LWIP_STATS 1
@ -88,6 +96,7 @@
#define PPP_DEBUG LWIP_DBG_OFF #define PPP_DEBUG LWIP_DBG_OFF
#define SLIP_DEBUG LWIP_DBG_OFF #define SLIP_DEBUG LWIP_DBG_OFF
#define DHCP_DEBUG LWIP_DBG_OFF #define DHCP_DEBUG LWIP_DBG_OFF
#define MDNS_DEBUG LWIP_DBG_OFF
#define LWIP_TIMEVAL_PRIVATE 0 #define LWIP_TIMEVAL_PRIVATE 0

View File

@ -23,37 +23,7 @@
# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN # OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
# THE SOFTWARE. # THE SOFTWARE.
# Select the board to build for. include ../../py/circuitpy_mkenv.mk
ifeq ($(BOARD),)
$(error You must provide a BOARD parameter)
else
ifeq ($(wildcard boards/$(BOARD)/.),)
$(error Invalid BOARD specified)
endif
endif
# If the build directory is not given, make it reflect the board name.
BUILD ?= build-$(BOARD)
include ../../py/mkenv.mk
# Board-specific
include boards/$(BOARD)/mpconfigboard.mk
# Port-specific
include mpconfigport.mk
# CircuitPython-specific
include $(TOP)/py/circuitpy_mpconfig.mk
# qstr definitions (must come before including py.mk)
QSTR_DEFS = qstrdefsport.h
# include py core make definitions
include $(TOP)/py/py.mk
include $(TOP)/supervisor/supervisor.mk
# Include make rules and variables common across CircuitPython builds.
include $(TOP)/py/circuitpy_defns.mk
CROSS_COMPILE = arm-none-eabi- CROSS_COMPILE = arm-none-eabi-
@ -221,7 +191,6 @@ SRC_STM32 += boards/system_stm32$(MCU_SERIES_LOWER)xx.c
SRC_C += \ SRC_C += \
background.c \ background.c \
fatfs_port.c \
mphalport.c \ mphalport.c \
boards/$(BOARD)/board.c \ boards/$(BOARD)/board.c \
boards/$(BOARD)/pins.c \ boards/$(BOARD)/pins.c \

View File

@ -65,6 +65,7 @@
#define MICROPY_PY_UCRYPTOLIB (1) #define MICROPY_PY_UCRYPTOLIB (1)
#define MICROPY_PY_UCRYPTOLIB_CTR (1) #define MICROPY_PY_UCRYPTOLIB_CTR (1)
#define MICROPY_PY_MICROPYTHON_HEAP_LOCKED (1) #define MICROPY_PY_MICROPYTHON_HEAP_LOCKED (1)
#define MICROPY_CPYTHON_EXCEPTION_CHAIN (1)
// use vfs's functions for import stat and builtin open // use vfs's functions for import stat and builtin open
#define mp_import_stat mp_vfs_import_stat #define mp_import_stat mp_vfs_import_stat

70
py/circuitpy_mkenv.mk Normal file
View File

@ -0,0 +1,70 @@
# This file is part of the MicroPython project, http://micropython.org/
#
# The MIT License (MIT)
#
# SPDX-FileCopyrightText: Copyright (c) 2022 MicroDev
#
# Permission is hereby granted, free of charge, to any person obtaining a copy
# of this software and associated documentation files (the "Software"), to deal
# in the Software without restriction, including without limitation the rights
# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
# copies of the Software, and to permit persons to whom the Software is
# furnished to do so, subject to the following conditions:
#
# The above copyright notice and this permission notice shall be included in
# all copies or substantial portions of the Software.
#
# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
# THE SOFTWARE.
# Common Makefile items that can be shared across CircuitPython ports.
# Select the board to build for.
define show_board_error
$(info Valid boards:)
$(shell printf '%s\n' $(patsubst boards/%/mpconfigboard.mk,%,$(wildcard boards/*/mpconfigboard.mk)) | column -xc $$(tput cols || echo 80) 1>&2)
$(error Rerun with $(MAKE) BOARD=<board>)
endef
ifeq ($(BOARD),)
$(info No BOARD specified)
$(call show_board_error)
else
ifeq ($(wildcard boards/$(BOARD)/.),)
$(info Invalid BOARD specified)
$(call show_board_error)
endif
endif
# If the flash PORT is not given, use the default /dev/tty.SLAB_USBtoUART.
PORT ?= /dev/tty.SLAB_USBtoUART
# If the build directory is not given, make it reflect the board name.
BUILD ?= build-$(BOARD)
include ../../py/mkenv.mk
# Board-specific
include boards/$(BOARD)/mpconfigboard.mk
# Port-specific
include mpconfigport.mk
# CircuitPython-specific
include $(TOP)/py/circuitpy_mpconfig.mk
# qstr definitions (must come before including py.mk)
QSTR_DEFS = qstrdefsport.h
# include py core make definitions
include $(TOP)/py/py.mk
include $(TOP)/supervisor/supervisor.mk
# Include make rules and variables common across CircuitPython builds.
include $(TOP)/py/circuitpy_defns.mk

View File

@ -224,6 +224,9 @@ typedef long mp_off_t;
#ifndef MICROPY_CPYTHON_COMPAT #ifndef MICROPY_CPYTHON_COMPAT
#define MICROPY_CPYTHON_COMPAT (CIRCUITPY_FULL_BUILD) #define MICROPY_CPYTHON_COMPAT (CIRCUITPY_FULL_BUILD)
#endif #endif
#ifndef MICROPY_CPYTHON_EXCEPTION_CHAIN
#define MICROPY_CPYTHON_EXCEPTION_CHAIN (CIRCUITPY_FULL_BUILD)
#endif
#define MICROPY_PY_BUILTINS_POW3 (CIRCUITPY_BUILTINS_POW3) #define MICROPY_PY_BUILTINS_POW3 (CIRCUITPY_BUILTINS_POW3)
#define MICROPY_PY_FSTRINGS (1) #define MICROPY_PY_FSTRINGS (1)
#define MICROPY_MODULE_WEAK_LINKS (0) #define MICROPY_MODULE_WEAK_LINKS (0)

View File

@ -773,6 +773,16 @@ typedef long long mp_longint_impl_t;
#define MICROPY_WARNINGS (0) #define MICROPY_WARNINGS (0)
#endif #endif
// Whether to support chained exceptions
#ifndef MICROPY_CPYTHON_EXCEPTION_CHAIN
#define MICROPY_CPYTHON_EXCEPTION_CHAIN (0)
#endif
// Whether the statically allocated GeneratorExit exception may be const
#ifndef MICROPY_CONST_GENERATOREXIT_OBJ
#define MICROPY_CONST_GENERATOREXIT_OBJ (!MICROPY_CPYTHON_EXCEPTION_CHAIN)
#endif
// Whether to support warning categories // Whether to support warning categories
#ifndef MICROPY_WARNINGS_CATEGORY #ifndef MICROPY_WARNINGS_CATEGORY
#define MICROPY_WARNINGS_CATEGORY (0) #define MICROPY_WARNINGS_CATEGORY (0)

View File

@ -142,9 +142,33 @@ void mp_obj_print(mp_obj_t o_in, mp_print_kind_t kind) {
mp_obj_print_helper(MP_PYTHON_PRINTER, o_in, kind); mp_obj_print_helper(MP_PYTHON_PRINTER, o_in, kind);
} }
static void mp_obj_print_inner_exception(const mp_print_t *print, mp_obj_t self_in, mp_int_t limit) {
#if MICROPY_CPYTHON_EXCEPTION_CHAIN
mp_obj_exception_t *self = mp_obj_exception_get_native(self_in);
const compressed_string_t *msg = MP_ERROR_TEXT("During handling of the above exception, another exception occurred:");
mp_obj_exception_t *inner = NULL;
if (self->cause) {
msg = MP_ERROR_TEXT("The above exception was the direct cause of the following exception:");
inner = self->cause;
} else if (!self->suppress_context) {
inner = self->context;
}
if (inner && !inner->marked) {
inner->marked = true;
mp_obj_print_exception_with_limit(print, MP_OBJ_FROM_PTR(inner), limit);
inner->marked = false;
mp_printf(print, "\n");
mp_cprintf(print, msg);
mp_printf(print, "\n\n");
}
#endif
}
// helper function to print an exception with traceback // helper function to print an exception with traceback
void mp_obj_print_exception_with_limit(const mp_print_t *print, mp_obj_t exc, mp_int_t limit) { void mp_obj_print_exception_with_limit(const mp_print_t *print, mp_obj_t exc, mp_int_t limit) {
if (mp_obj_is_exception_instance(exc) && stack_ok()) { if (mp_obj_is_exception_instance(exc) && stack_ok()) {
mp_obj_print_inner_exception(print, exc, limit);
size_t n, *values; size_t n, *values;
mp_obj_exception_get_traceback(exc, &n, &values); mp_obj_exception_get_traceback(exc, &n, &values);
if (n > 0) { if (n > 0) {

View File

@ -791,7 +791,9 @@ extern const struct _mp_obj_dict_t mp_const_empty_dict_obj;
extern const struct _mp_obj_traceback_t mp_const_empty_traceback_obj; extern const struct _mp_obj_traceback_t mp_const_empty_traceback_obj;
extern const struct _mp_obj_singleton_t mp_const_ellipsis_obj; extern const struct _mp_obj_singleton_t mp_const_ellipsis_obj;
extern const struct _mp_obj_singleton_t mp_const_notimplemented_obj; extern const struct _mp_obj_singleton_t mp_const_notimplemented_obj;
extern const struct _mp_obj_exception_t mp_const_GeneratorExit_obj; #if MICROPY_CONST_GENERATOREXIT_OBJ
extern const struct _mp_obj_exception_t mp_static_GeneratorExit_obj;
#endif
// Fixed empty map. Useful when calling keyword-receiving functions // Fixed empty map. Useful when calling keyword-receiving functions
// without any keywords from C, etc. // without any keywords from C, etc.

View File

@ -218,19 +218,45 @@ void mp_obj_exception_attr(mp_obj_t self_in, qstr attr, mp_obj_t *dest) {
mp_obj_exception_t *self = MP_OBJ_TO_PTR(self_in); mp_obj_exception_t *self = MP_OBJ_TO_PTR(self_in);
if (dest[0] != MP_OBJ_NULL) { if (dest[0] != MP_OBJ_NULL) {
// store/delete attribute // store/delete attribute
if (self == &mp_const_GeneratorExit_obj) { #if MICROPY_CONST_GENERATOREXIT_OBJ
if (self == &mp_static_GeneratorExit_obj) {
mp_raise_AttributeError(MP_ERROR_TEXT("can't set attribute")); mp_raise_AttributeError(MP_ERROR_TEXT("can't set attribute"));
} }
#endif
if (attr == MP_QSTR___traceback__) { if (attr == MP_QSTR___traceback__) {
if (dest[1] == mp_const_none) { if (dest[1] == mp_const_none) {
self->traceback = (mp_obj_traceback_t *)&mp_const_empty_traceback_obj; self->traceback = (mp_obj_traceback_t *)&mp_const_empty_traceback_obj;
} else { } else {
if (!mp_obj_is_type(dest[1], &mp_type_traceback)) { if (!mp_obj_is_type(dest[1], &mp_type_traceback)) {
mp_raise_TypeError(MP_ERROR_TEXT("invalid traceback")); mp_raise_TypeError_varg(MP_ERROR_TEXT("%q must be of type %q or None"), MP_QSTR___context__, MP_QSTR_traceback);
} }
self->traceback = MP_OBJ_TO_PTR(dest[1]); self->traceback = MP_OBJ_TO_PTR(dest[1]);
} }
dest[0] = MP_OBJ_NULL; // indicate success dest[0] = MP_OBJ_NULL; // indicate success
#if MICROPY_CPYTHON_EXCEPTION_CHAIN
} else if (attr == MP_QSTR___cause__) {
if (dest[1] == mp_const_none) {
self->cause = NULL;
} else if (!mp_obj_is_type(dest[1], &mp_type_BaseException)) {
self->cause = dest[1];
} else {
mp_raise_TypeError_varg(MP_ERROR_TEXT("%q must be of type %q or None"), attr, MP_QSTR_BaseException);
}
self->suppress_context = true;
dest[0] = MP_OBJ_NULL; // indicate success
} else if (attr == MP_QSTR___context__) {
if (dest[1] == mp_const_none) {
self->context = NULL;
} else if (!mp_obj_is_type(dest[1], &mp_type_BaseException)) {
self->context = dest[1];
} else {
mp_raise_TypeError_varg(MP_ERROR_TEXT("%q must be of type %q or None"), attr, MP_QSTR_BaseException);
}
dest[0] = MP_OBJ_NULL; // indicate success
} else if (attr == MP_QSTR___suppress_context__) {
self->suppress_context = mp_obj_is_true(dest[1]);
dest[0] = MP_OBJ_NULL; // indicate success
#endif
} }
return; return;
} }
@ -240,6 +266,14 @@ void mp_obj_exception_attr(mp_obj_t self_in, qstr attr, mp_obj_t *dest) {
dest[0] = mp_obj_exception_get_value(self_in); dest[0] = mp_obj_exception_get_value(self_in);
} else if (attr == MP_QSTR___traceback__) { } else if (attr == MP_QSTR___traceback__) {
dest[0] = (self->traceback) ? MP_OBJ_FROM_PTR(self->traceback) : mp_const_none; dest[0] = (self->traceback) ? MP_OBJ_FROM_PTR(self->traceback) : mp_const_none;
#if MICROPY_CPYTHON_EXCEPTION_CHAIN
} else if (attr == MP_QSTR___cause__) {
dest[0] = (self->cause) ? MP_OBJ_FROM_PTR(self->cause) : mp_const_none;
} else if (attr == MP_QSTR___context__) {
dest[0] = (self->context) ? MP_OBJ_FROM_PTR(self->context) : mp_const_none;
} else if (attr == MP_QSTR___suppress_context__) {
dest[0] = mp_obj_new_bool(self->suppress_context);
#endif
#if MICROPY_CPYTHON_COMPAT #if MICROPY_CPYTHON_COMPAT
} else if (mp_obj_is_subclass_fast(MP_OBJ_FROM_PTR(self->base.type), MP_OBJ_FROM_PTR(&mp_type_OSError))) { } else if (mp_obj_is_subclass_fast(MP_OBJ_FROM_PTR(self->base.type), MP_OBJ_FROM_PTR(&mp_type_OSError))) {
if (attr == MP_QSTR_errno) { if (attr == MP_QSTR_errno) {

View File

@ -34,6 +34,11 @@ typedef struct _mp_obj_exception_t {
mp_obj_base_t base; mp_obj_base_t base;
mp_obj_tuple_t *args; mp_obj_tuple_t *args;
mp_obj_traceback_t *traceback; mp_obj_traceback_t *traceback;
#if MICROPY_CPYTHON_EXCEPTION_CHAIN
struct _mp_obj_exception_t *cause, *context;
bool suppress_context;
bool marked;
#endif
} mp_obj_exception_t; } mp_obj_exception_t;
void mp_obj_exception_print(const mp_print_t *print, mp_obj_t o_in, mp_print_kind_t kind); void mp_obj_exception_print(const mp_print_t *print, mp_obj_t o_in, mp_print_kind_t kind);

View File

@ -38,7 +38,12 @@
#include "supervisor/shared/translate/translate.h" #include "supervisor/shared/translate/translate.h"
// Instance of GeneratorExit exception - needed by generator.close() // Instance of GeneratorExit exception - needed by generator.close()
const mp_obj_exception_t mp_const_GeneratorExit_obj = {{&mp_type_GeneratorExit}, (mp_obj_tuple_t *)&mp_const_empty_tuple_obj, (mp_obj_traceback_t *)&mp_const_empty_traceback_obj}; #if MICROPY_CONST_GENERATOREXIT_OBJ
const
#else
static
#endif
mp_obj_exception_t mp_static_GeneratorExit_obj = {{&mp_type_GeneratorExit}, (mp_obj_tuple_t *)&mp_const_empty_tuple_obj, (mp_obj_traceback_t *)&mp_const_empty_traceback_obj};
/******************************************************************************/ /******************************************************************************/
/* generator wrapper */ /* generator wrapper */
@ -362,9 +367,19 @@ STATIC mp_obj_t gen_instance_throw(size_t n_args, const mp_obj_t *args) {
} }
STATIC MP_DEFINE_CONST_FUN_OBJ_VAR_BETWEEN(gen_instance_throw_obj, 2, 4, gen_instance_throw); STATIC MP_DEFINE_CONST_FUN_OBJ_VAR_BETWEEN(gen_instance_throw_obj, 2, 4, gen_instance_throw);
static mp_obj_t generatorexit(void) {
#if MICROPY_CPYTHON_EXCEPTION_CHAIN
MP_STATIC_ASSERT(!MICROPY_CONST_GENERATOREXIT_OBJ);
mp_static_GeneratorExit_obj.context = NULL;
mp_static_GeneratorExit_obj.cause = NULL;
mp_static_GeneratorExit_obj.suppress_context = false;
#endif
return MP_OBJ_FROM_PTR(&mp_static_GeneratorExit_obj);
}
STATIC mp_obj_t gen_instance_close(mp_obj_t self_in) { STATIC mp_obj_t gen_instance_close(mp_obj_t self_in) {
mp_obj_t ret; mp_obj_t ret;
switch (mp_obj_gen_resume(self_in, mp_const_none, MP_OBJ_FROM_PTR(&mp_const_GeneratorExit_obj), &ret)) { switch (mp_obj_gen_resume(self_in, mp_const_none, generatorexit(), &ret)) {
case MP_VM_RETURN_YIELD: case MP_VM_RETURN_YIELD:
mp_raise_msg(&mp_type_RuntimeError, MP_ERROR_TEXT("generator ignored GeneratorExit")); mp_raise_msg(&mp_type_RuntimeError, MP_ERROR_TEXT("generator ignored GeneratorExit"));

53
py/vm.c
View File

@ -183,6 +183,15 @@
#define TRACE_TICK(current_ip, current_sp, is_exception) #define TRACE_TICK(current_ip, current_sp, is_exception)
#endif // MICROPY_PY_SYS_SETTRACE #endif // MICROPY_PY_SYS_SETTRACE
STATIC mp_obj_t get_active_exception(mp_exc_stack_t *exc_sp, mp_exc_stack_t *exc_stack) {
for (mp_exc_stack_t *e = exc_sp; e >= exc_stack; --e) {
if (e->prev_exc != NULL) {
return MP_OBJ_FROM_PTR(e->prev_exc);
}
}
return MP_OBJ_NULL;
}
// fastn has items in reverse order (fastn[0] is local[0], fastn[-1] is local[1], etc) // fastn has items in reverse order (fastn[0] is local[0], fastn[-1] is local[1], etc)
// sp points to bottom of stack which grows up // sp points to bottom of stack which grows up
// returns: // returns:
@ -1129,13 +1138,7 @@ unwind_return:
ENTRY(MP_BC_RAISE_LAST): { ENTRY(MP_BC_RAISE_LAST): {
MARK_EXC_IP_SELECTIVE(); MARK_EXC_IP_SELECTIVE();
// search for the inner-most previous exception, to reraise it // search for the inner-most previous exception, to reraise it
mp_obj_t obj = MP_OBJ_NULL; mp_obj_t obj = get_active_exception(exc_sp, exc_stack);
for (mp_exc_stack_t *e = exc_sp; e >= exc_stack; --e) {
if (e->prev_exc != NULL) {
obj = MP_OBJ_FROM_PTR(e->prev_exc);
break;
}
}
if (obj == MP_OBJ_NULL) { if (obj == MP_OBJ_NULL) {
obj = mp_obj_new_exception_msg(&mp_type_RuntimeError, MP_ERROR_TEXT("no active exception to reraise")); obj = mp_obj_new_exception_msg(&mp_type_RuntimeError, MP_ERROR_TEXT("no active exception to reraise"));
} }
@ -1145,14 +1148,30 @@ unwind_return:
ENTRY(MP_BC_RAISE_OBJ): { ENTRY(MP_BC_RAISE_OBJ): {
MARK_EXC_IP_SELECTIVE(); MARK_EXC_IP_SELECTIVE();
mp_obj_t obj = mp_make_raise_obj(TOP()); mp_obj_t obj = mp_make_raise_obj(TOP());
#if MICROPY_CPYTHON_EXCEPTION_CHAIN
mp_obj_t active_exception = get_active_exception(exc_sp, exc_stack);
if (active_exception != MP_OBJ_NULL) {
mp_store_attr(obj, MP_QSTR___context__, active_exception);
}
#endif
RAISE(obj); RAISE(obj);
} }
ENTRY(MP_BC_RAISE_FROM): { ENTRY(MP_BC_RAISE_FROM): {
MARK_EXC_IP_SELECTIVE(); MARK_EXC_IP_SELECTIVE();
mp_warning(NULL, "exception chaining not supported"); mp_obj_t cause = POP();
sp--; // ignore (pop) "from" argument
mp_obj_t obj = mp_make_raise_obj(TOP()); mp_obj_t obj = mp_make_raise_obj(TOP());
#if MICROPY_CPYTHON_EXCEPTION_CHAIN
// search for the inner-most previous exception, to chain it
mp_obj_t active_exception = get_active_exception(exc_sp, exc_stack);
if (active_exception != MP_OBJ_NULL) {
mp_store_attr(obj, MP_QSTR___context__, active_exception);
}
mp_store_attr(obj, MP_QSTR___cause__, cause);
#else
(void)cause;
mp_warning(NULL, "exception chaining not supported");
#endif
RAISE(obj); RAISE(obj);
} }
@ -1391,7 +1410,10 @@ unwind_loop:
// - constant GeneratorExit object, because it's const // - constant GeneratorExit object, because it's const
// - exceptions re-raised by END_FINALLY // - exceptions re-raised by END_FINALLY
// - exceptions re-raised explicitly by "raise" // - exceptions re-raised explicitly by "raise"
if (nlr.ret_val != &mp_const_GeneratorExit_obj if ( true
#if MICROPY_CONST_GENERATOREXIT_OBJ
&& nlr.ret_val != &mp_static_GeneratorExit_obj
#endif
&& *code_state->ip != MP_BC_END_FINALLY && *code_state->ip != MP_BC_END_FINALLY
&& *code_state->ip != MP_BC_RAISE_LAST) { && *code_state->ip != MP_BC_RAISE_LAST) {
const byte *ip = code_state->fun_bc->bytecode; const byte *ip = code_state->fun_bc->bytecode;
@ -1434,10 +1456,19 @@ unwind_loop:
// catch exception and pass to byte code // catch exception and pass to byte code
code_state->ip = exc_sp->handler; code_state->ip = exc_sp->handler;
mp_obj_t *sp = MP_TAGPTR_PTR(exc_sp->val_sp); mp_obj_t *sp = MP_TAGPTR_PTR(exc_sp->val_sp);
#if MICROPY_CPYTHON_EXCEPTION_CHAIN
mp_obj_t active_exception = get_active_exception(exc_sp, exc_stack);
#endif
// save this exception in the stack so it can be used in a reraise, if needed // save this exception in the stack so it can be used in a reraise, if needed
exc_sp->prev_exc = nlr.ret_val; exc_sp->prev_exc = nlr.ret_val;
mp_obj_t obj = MP_OBJ_FROM_PTR(nlr.ret_val);
#if MICROPY_CPYTHON_EXCEPTION_CHAIN
if (active_exception != MP_OBJ_NULL) {
mp_store_attr(obj, MP_QSTR___context__, active_exception);
}
#endif
// push exception object so it can be handled by bytecode // push exception object so it can be handled by bytecode
PUSH(MP_OBJ_FROM_PTR(nlr.ret_val)); PUSH(obj);
code_state->sp = sp; code_state->sp = sp;
#if MICROPY_STACKLESS #if MICROPY_STACKLESS

View File

@ -31,6 +31,13 @@
extern const mp_obj_type_t pixelbuf_pixelbuf_type; extern const mp_obj_type_t pixelbuf_pixelbuf_type;
typedef union {
struct {
uint8_t r, g, b, w;
};
uint32_t rgbw;
} color_u;
void common_hal_adafruit_pixelbuf_pixelbuf_construct(pixelbuf_pixelbuf_obj_t *self, size_t n, void common_hal_adafruit_pixelbuf_pixelbuf_construct(pixelbuf_pixelbuf_obj_t *self, size_t n,
pixelbuf_byteorder_details_t *byteorder, mp_float_t brightness, bool auto_write, uint8_t *header, pixelbuf_byteorder_details_t *byteorder, mp_float_t brightness, bool auto_write, uint8_t *header,
size_t header_len, uint8_t *trailer, size_t trailer_len); size_t header_len, uint8_t *trailer, size_t trailer_len);

View File

@ -159,7 +159,7 @@ STATIC mp_obj_t i2ctarget_i2c_target_request(size_t n_args, const mp_obj_t *pos_
bool forever = false; bool forever = false;
uint64_t timeout_end = 0; uint64_t timeout_end = 0;
if (timeout_ms <= 0) { if (timeout_ms == 0) {
forever = true; forever = true;
} else if (timeout_ms > 0) { } else if (timeout_ms > 0) {
timeout_end = common_hal_time_monotonic_ms() + timeout_ms; timeout_end = common_hal_time_monotonic_ms() + timeout_ms;

View File

@ -344,38 +344,36 @@ STATIC mp_obj_t socketpool_socket_setblocking(mp_obj_t self_in, mp_obj_t blockin
} }
STATIC MP_DEFINE_CONST_FUN_OBJ_2(socketpool_socket_setblocking_obj, socketpool_socket_setblocking); STATIC MP_DEFINE_CONST_FUN_OBJ_2(socketpool_socket_setblocking_obj, socketpool_socket_setblocking);
// //| def setsockopt(self, level: int, optname: int, value: int) -> None: //| def setsockopt(self, level: int, optname: int, value: int) -> None:
// //| """Sets socket options""" //| """Sets socket options"""
// //| ... //| ...
// //| STATIC mp_obj_t socketpool_socket_setsockopt(size_t n_args, const mp_obj_t *args) {
// STATIC mp_obj_t socketpool_socket_setsockopt(size_t n_args, const mp_obj_t *args) { socketpool_socket_obj_t *self = MP_OBJ_TO_PTR(args[0]);
// // mod_network_socket_obj_t *self = MP_OBJ_TO_PTR(args[0]); mp_int_t level = mp_obj_get_int(args[1]);
mp_int_t opt = mp_obj_get_int(args[2]);
// // mp_int_t level = mp_obj_get_int(args[1]); const void *optval;
// // mp_int_t opt = mp_obj_get_int(args[2]); mp_uint_t optlen;
mp_int_t val;
if (mp_obj_is_integer(args[3])) {
val = mp_obj_get_int_truncated(args[3]);
optval = &val;
optlen = sizeof(val);
} else {
mp_buffer_info_t bufinfo;
mp_get_buffer_raise(args[3], &bufinfo, MP_BUFFER_READ);
optval = bufinfo.buf;
optlen = bufinfo.len;
}
// // const void *optval; int _errno = common_hal_socketpool_socket_setsockopt(self, level, opt, optval, optlen);
// // mp_uint_t optlen; if (_errno < 0) {
// // mp_int_t val; mp_raise_OSError(-_errno);
// // if (mp_obj_is_integer(args[3])) { }
// // val = mp_obj_get_int_truncated(args[3]);
// // optval = &val;
// // optlen = sizeof(val);
// // } else {
// // mp_buffer_info_t bufinfo;
// // mp_get_buffer_raise(args[3], &bufinfo, MP_BUFFER_READ);
// // optval = bufinfo.buf;
// // optlen = bufinfo.len;
// // }
// // int _errno; return mp_const_none;
// // if (self->nic_type->setsockopt(self, level, opt, optval, optlen, &_errno) != 0) { }
// // mp_raise_OSError(_errno); STATIC MP_DEFINE_CONST_FUN_OBJ_VAR_BETWEEN(socketpool_socket_setsockopt_obj, 4, 4, socketpool_socket_setsockopt);
// // }
// return mp_const_none;
// }
// STATIC MP_DEFINE_CONST_FUN_OBJ_VAR_BETWEEN(socketpool_socket_setsockopt_obj, 4, 4, socketpool_socket_setsockopt);
//| def settimeout(self, value: int) -> None: //| def settimeout(self, value: int) -> None:
@ -417,7 +415,7 @@ STATIC const mp_rom_map_elem_t socketpool_socket_locals_dict_table[] = {
{ MP_ROM_QSTR(MP_QSTR_sendall), MP_ROM_PTR(&socketpool_socket_sendall_obj) }, { MP_ROM_QSTR(MP_QSTR_sendall), MP_ROM_PTR(&socketpool_socket_sendall_obj) },
{ MP_ROM_QSTR(MP_QSTR_sendto), MP_ROM_PTR(&socketpool_socket_sendto_obj) }, { MP_ROM_QSTR(MP_QSTR_sendto), MP_ROM_PTR(&socketpool_socket_sendto_obj) },
{ MP_ROM_QSTR(MP_QSTR_setblocking), MP_ROM_PTR(&socketpool_socket_setblocking_obj) }, { MP_ROM_QSTR(MP_QSTR_setblocking), MP_ROM_PTR(&socketpool_socket_setblocking_obj) },
// { MP_ROM_QSTR(MP_QSTR_setsockopt), MP_ROM_PTR(&socketpool_socket_setsockopt_obj) }, { MP_ROM_QSTR(MP_QSTR_setsockopt), MP_ROM_PTR(&socketpool_socket_setsockopt_obj) },
{ MP_ROM_QSTR(MP_QSTR_settimeout), MP_ROM_PTR(&socketpool_socket_settimeout_obj) }, { MP_ROM_QSTR(MP_QSTR_settimeout), MP_ROM_PTR(&socketpool_socket_settimeout_obj) },
}; };

View File

@ -46,13 +46,22 @@ mp_uint_t common_hal_socketpool_socket_send(socketpool_socket_obj_t *self, const
mp_uint_t common_hal_socketpool_socket_sendto(socketpool_socket_obj_t *self, mp_uint_t common_hal_socketpool_socket_sendto(socketpool_socket_obj_t *self,
const char *host, size_t hostlen, uint32_t port, const uint8_t *buf, uint32_t len); const char *host, size_t hostlen, uint32_t port, const uint8_t *buf, uint32_t len);
void common_hal_socketpool_socket_settimeout(socketpool_socket_obj_t *self, uint32_t timeout_ms); void common_hal_socketpool_socket_settimeout(socketpool_socket_obj_t *self, uint32_t timeout_ms);
int common_hal_socketpool_socket_setsockopt(socketpool_socket_obj_t *self, int level, int optname, const void *value, size_t optlen);
bool common_hal_socketpool_readable(socketpool_socket_obj_t *self); bool common_hal_socketpool_readable(socketpool_socket_obj_t *self);
bool common_hal_socketpool_writable(socketpool_socket_obj_t *self); bool common_hal_socketpool_writable(socketpool_socket_obj_t *self);
// Non-allocating versions for internal use. // Non-allocating versions for internal use.
int socketpool_socket_accept(socketpool_socket_obj_t *self, uint8_t *ip, uint32_t *port); int socketpool_socket_accept(socketpool_socket_obj_t *self, uint8_t *ip, uint32_t *port, socketpool_socket_obj_t *accepted);
void socketpool_socket_close(socketpool_socket_obj_t *self); void socketpool_socket_close(socketpool_socket_obj_t *self);
int socketpool_socket_send(socketpool_socket_obj_t *self, const uint8_t *buf, uint32_t len); int socketpool_socket_send(socketpool_socket_obj_t *self, const uint8_t *buf, uint32_t len);
int socketpool_socket_recv_into(socketpool_socket_obj_t *self, int socketpool_socket_recv_into(socketpool_socket_obj_t *self,
const uint8_t *buf, uint32_t len); const uint8_t *buf, uint32_t len);
// Moves self to sock without closing the real socket. self will think its closed afterwards.
void socketpool_socket_move(socketpool_socket_obj_t *self, socketpool_socket_obj_t *sock);
// Resets the socket object state so it appears closed and disconnected. This only works on
// uninitialized memory.
void socketpool_socket_reset(socketpool_socket_obj_t *self);
#endif // MICROPY_INCLUDED_SHARED_BINDINGS_SOCKETPOOL_SOCKET_H #endif // MICROPY_INCLUDED_SHARED_BINDINGS_SOCKETPOOL_SOCKET_H

View File

@ -36,6 +36,8 @@
#include "shared-bindings/socketpool/Socket.h" #include "shared-bindings/socketpool/Socket.h"
#include "shared-bindings/socketpool/SocketPool.h" #include "shared-bindings/socketpool/SocketPool.h"
#define SOCKETPOOL_EAI_NONAME (-2)
//| class SocketPool: //| class SocketPool:
//| """A pool of socket resources available for the given radio. Only one //| """A pool of socket resources available for the given radio. Only one
//| SocketPool can be created for each radio. //| SocketPool can be created for each radio.
@ -52,7 +54,6 @@
//| returned by :py:attr:`wifi.radio` //| 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) { 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); mp_arg_check_num(n_args, n_kw, 1, 1, false);
@ -65,12 +66,23 @@ STATIC mp_obj_t socketpool_socketpool_make_new(const mp_obj_type_t *type, size_t
return MP_OBJ_FROM_PTR(s); return MP_OBJ_FROM_PTR(s);
} }
//| class gaierror(OSError):
//| """Errors raised by getaddrinfo"""
//|
MP_DEFINE_EXCEPTION(gaierror, OSError)
//|
//| AF_INET: int //| AF_INET: int
//| AF_INET6: int //| AF_INET6: int
//|
//| SOCK_STREAM: int //| SOCK_STREAM: int
//| SOCK_DGRAM: int //| SOCK_DGRAM: int
//| SOCK_RAW: int //| SOCK_RAW: int
//| EAI_NONAME: int
//| //|
//| TCP_NODELAY: int
//|
//| IPPROTO_TCP: int
//| def socket(self, family: int = AF_INET, type: int = SOCK_STREAM) -> socketpool.Socket: //| def socket(self, family: int = AF_INET, type: int = SOCK_STREAM) -> socketpool.Socket:
//| """Create a new socket //| """Create a new socket
//| //|
@ -143,7 +155,11 @@ STATIC mp_obj_t socketpool_socketpool_getaddrinfo(size_t n_args, const mp_obj_t
} }
if (ip_str == mp_const_none) { if (ip_str == mp_const_none) {
mp_raise_OSError(-2); // socket.EAI_NONAME from CPython mp_obj_t exc_args[2] = {
MP_OBJ_NEW_SMALL_INT(SOCKETPOOL_EAI_NONAME),
MP_OBJ_NEW_QSTR(MP_QSTR_Name_space_or_space_service_space_not_space_known),
};
nlr_raise(mp_obj_new_exception_args(&mp_type_gaierror, 2, exc_args));
} }
mp_obj_tuple_t *tuple = MP_OBJ_TO_PTR(mp_obj_new_tuple(5, NULL)); mp_obj_tuple_t *tuple = MP_OBJ_TO_PTR(mp_obj_new_tuple(5, NULL));
@ -162,6 +178,7 @@ STATIC MP_DEFINE_CONST_FUN_OBJ_KW(socketpool_socketpool_getaddrinfo_obj, 1, sock
STATIC const mp_rom_map_elem_t socketpool_socketpool_locals_dict_table[] = { STATIC const mp_rom_map_elem_t socketpool_socketpool_locals_dict_table[] = {
{ MP_ROM_QSTR(MP_QSTR_socket), MP_ROM_PTR(&socketpool_socketpool_socket_obj) }, { MP_ROM_QSTR(MP_QSTR_socket), MP_ROM_PTR(&socketpool_socketpool_socket_obj) },
{ MP_ROM_QSTR(MP_QSTR_getaddrinfo), MP_ROM_PTR(&socketpool_socketpool_getaddrinfo_obj) }, { MP_ROM_QSTR(MP_QSTR_getaddrinfo), MP_ROM_PTR(&socketpool_socketpool_getaddrinfo_obj) },
{ MP_ROM_QSTR(MP_QSTR_gaierror), MP_ROM_PTR(&mp_type_gaierror) },
// class constants // class constants
{ MP_ROM_QSTR(MP_QSTR_AF_INET), MP_ROM_INT(SOCKETPOOL_AF_INET) }, { MP_ROM_QSTR(MP_QSTR_AF_INET), MP_ROM_INT(SOCKETPOOL_AF_INET) },
@ -170,6 +187,12 @@ STATIC const mp_rom_map_elem_t socketpool_socketpool_locals_dict_table[] = {
{ MP_ROM_QSTR(MP_QSTR_SOCK_STREAM), MP_ROM_INT(SOCKETPOOL_SOCK_STREAM) }, { MP_ROM_QSTR(MP_QSTR_SOCK_STREAM), MP_ROM_INT(SOCKETPOOL_SOCK_STREAM) },
{ MP_ROM_QSTR(MP_QSTR_SOCK_DGRAM), MP_ROM_INT(SOCKETPOOL_SOCK_DGRAM) }, { MP_ROM_QSTR(MP_QSTR_SOCK_DGRAM), MP_ROM_INT(SOCKETPOOL_SOCK_DGRAM) },
{ MP_ROM_QSTR(MP_QSTR_SOCK_RAW), MP_ROM_INT(SOCKETPOOL_SOCK_RAW) }, { MP_ROM_QSTR(MP_QSTR_SOCK_RAW), MP_ROM_INT(SOCKETPOOL_SOCK_RAW) },
{ MP_ROM_QSTR(MP_QSTR_TCP_NODELAY), MP_ROM_INT(SOCKETPOOL_TCP_NODELAY) },
{ MP_ROM_QSTR(MP_QSTR_IPPROTO_TCP), MP_ROM_INT(SOCKETPOOL_IPPROTO_TCP) },
{ MP_ROM_QSTR(MP_QSTR_EAI_NONAME), MP_ROM_INT(SOCKETPOOL_EAI_NONAME) },
}; };
STATIC MP_DEFINE_CONST_DICT(socketpool_socketpool_locals_dict, socketpool_socketpool_locals_dict_table); STATIC MP_DEFINE_CONST_DICT(socketpool_socketpool_locals_dict, socketpool_socketpool_locals_dict_table);

View File

@ -34,16 +34,24 @@
extern const mp_obj_type_t socketpool_socketpool_type; extern const mp_obj_type_t socketpool_socketpool_type;
typedef enum { typedef enum {
SOCKETPOOL_SOCK_STREAM, SOCKETPOOL_SOCK_STREAM = 1,
SOCKETPOOL_SOCK_DGRAM, SOCKETPOOL_SOCK_DGRAM = 2,
SOCKETPOOL_SOCK_RAW SOCKETPOOL_SOCK_RAW = 3
} socketpool_socketpool_sock_t; } socketpool_socketpool_sock_t;
typedef enum { typedef enum {
SOCKETPOOL_AF_INET, SOCKETPOOL_AF_INET = 2,
SOCKETPOOL_AF_INET6 SOCKETPOOL_AF_INET6 = 10
} socketpool_socketpool_addressfamily_t; } socketpool_socketpool_addressfamily_t;
typedef enum {
SOCKETPOOL_IPPROTO_TCP = 6,
} socketpool_socketpool_ipproto_t;
typedef enum {
SOCKETPOOL_TCP_NODELAY = 1,
} socketpool_socketpool_tcpopt_t;
void common_hal_socketpool_socketpool_construct(socketpool_socketpool_obj_t *self, mp_obj_t radio); void common_hal_socketpool_socketpool_construct(socketpool_socketpool_obj_t *self, mp_obj_t radio);
socketpool_socket_obj_t *common_hal_socketpool_socket(socketpool_socketpool_obj_t *self, socketpool_socket_obj_t *common_hal_socketpool_socket(socketpool_socketpool_obj_t *self,

View File

@ -197,7 +197,7 @@ MP_DEFINE_CONST_FUN_OBJ_KW(supervisor_set_next_code_file_obj, 0, supervisor_set_
//| //|
//| def ticks_add(ticks, delta): //| def ticks_add(ticks, delta):
//| "Add a delta to a base number of ticks, performing wraparound at 2**29ms." //| "Add a delta to a base number of ticks, performing wraparound at 2**29ms."
//| return (a + b) % _TICKS_PERIOD //| return (ticks + delta) % _TICKS_PERIOD
//| //|
//| def ticks_diff(ticks1, ticks2): //| def ticks_diff(ticks1, ticks2):
//| "Compute the signed difference between two ticks values, assuming that they are within 2**28 ticks" //| "Compute the signed difference between two ticks values, assuming that they are within 2**28 ticks"

View File

@ -109,6 +109,9 @@ MP_PROPERTY_GETSET(vectorio_circle_color_index_obj,
//| y: int //| y: int
//| """Y position of the center point of the circle in the parent.""" //| """Y position of the center point of the circle in the parent."""
//| //|
//| hidden: bool
//| """Hide the circle or not."""
//|
//| location: Tuple[int, int] //| location: Tuple[int, int]
//| """(X,Y) position of the center point of the circle in the parent.""" //| """(X,Y) position of the center point of the circle in the parent."""
//| //|
@ -123,6 +126,7 @@ STATIC const mp_rom_map_elem_t vectorio_circle_locals_dict_table[] = {
{ MP_ROM_QSTR(MP_QSTR_radius), MP_ROM_PTR(&vectorio_circle_radius_obj) }, { MP_ROM_QSTR(MP_QSTR_radius), MP_ROM_PTR(&vectorio_circle_radius_obj) },
{ MP_ROM_QSTR(MP_QSTR_x), MP_ROM_PTR(&vectorio_vector_shape_x_obj) }, { MP_ROM_QSTR(MP_QSTR_x), MP_ROM_PTR(&vectorio_vector_shape_x_obj) },
{ MP_ROM_QSTR(MP_QSTR_y), MP_ROM_PTR(&vectorio_vector_shape_y_obj) }, { MP_ROM_QSTR(MP_QSTR_y), MP_ROM_PTR(&vectorio_vector_shape_y_obj) },
{ MP_ROM_QSTR(MP_QSTR_hidden), MP_ROM_PTR(&vectorio_vector_shape_hidden_obj) },
{ MP_ROM_QSTR(MP_QSTR_color_index), MP_ROM_PTR(&vectorio_circle_color_index_obj) }, { MP_ROM_QSTR(MP_QSTR_color_index), MP_ROM_PTR(&vectorio_circle_color_index_obj) },
{ MP_ROM_QSTR(MP_QSTR_location), MP_ROM_PTR(&vectorio_vector_shape_location_obj) }, { MP_ROM_QSTR(MP_QSTR_location), MP_ROM_PTR(&vectorio_vector_shape_location_obj) },
{ MP_ROM_QSTR(MP_QSTR_pixel_shader), MP_ROM_PTR(&vectorio_vector_shape_pixel_shader_obj) }, { MP_ROM_QSTR(MP_QSTR_pixel_shader), MP_ROM_PTR(&vectorio_vector_shape_pixel_shader_obj) },

View File

@ -118,6 +118,9 @@ MP_PROPERTY_GETSET(vectorio_polygon_color_index_obj,
//| y: int //| y: int
//| """Y position of the 0,0 origin in the points list.""" //| """Y position of the 0,0 origin in the points list."""
//| //|
//| hidden: bool
//| """Hide the polygon or not."""
//|
//| location: Tuple[int, int] //| location: Tuple[int, int]
//| """(X,Y) position of the 0,0 origin in the points list.""" //| """(X,Y) position of the 0,0 origin in the points list."""
//| //|
@ -132,6 +135,7 @@ STATIC const mp_rom_map_elem_t vectorio_polygon_locals_dict_table[] = {
{ MP_ROM_QSTR(MP_QSTR_points), MP_ROM_PTR(&vectorio_polygon_points_obj) }, { MP_ROM_QSTR(MP_QSTR_points), MP_ROM_PTR(&vectorio_polygon_points_obj) },
{ MP_ROM_QSTR(MP_QSTR_x), MP_ROM_PTR(&vectorio_vector_shape_x_obj) }, { MP_ROM_QSTR(MP_QSTR_x), MP_ROM_PTR(&vectorio_vector_shape_x_obj) },
{ MP_ROM_QSTR(MP_QSTR_y), MP_ROM_PTR(&vectorio_vector_shape_y_obj) }, { MP_ROM_QSTR(MP_QSTR_y), MP_ROM_PTR(&vectorio_vector_shape_y_obj) },
{ MP_ROM_QSTR(MP_QSTR_hidden), MP_ROM_PTR(&vectorio_vector_shape_hidden_obj) },
{ MP_ROM_QSTR(MP_QSTR_color_index), MP_ROM_PTR(&vectorio_polygon_color_index_obj) }, { MP_ROM_QSTR(MP_QSTR_color_index), MP_ROM_PTR(&vectorio_polygon_color_index_obj) },
{ MP_ROM_QSTR(MP_QSTR_location), MP_ROM_PTR(&vectorio_vector_shape_location_obj) }, { MP_ROM_QSTR(MP_QSTR_location), MP_ROM_PTR(&vectorio_vector_shape_location_obj) },
{ MP_ROM_QSTR(MP_QSTR_pixel_shader), MP_ROM_PTR(&vectorio_vector_shape_pixel_shader_obj) }, { MP_ROM_QSTR(MP_QSTR_pixel_shader), MP_ROM_PTR(&vectorio_vector_shape_pixel_shader_obj) },

View File

@ -139,6 +139,9 @@ const mp_obj_property_t vectorio_rectangle_color_index_obj = {
//| y: int //| y: int
//| """Y position of the top left corner of the rectangle in the parent.""" //| """Y position of the top left corner of the rectangle in the parent."""
//| //|
//| hidden: bool
//| """Hide the rectangle or not."""
//|
//| location: Tuple[int, int] //| location: Tuple[int, int]
//| """(X,Y) position of the top left corner of the rectangle in the parent.""" //| """(X,Y) position of the top left corner of the rectangle in the parent."""
//| //|
@ -152,6 +155,7 @@ STATIC const mp_rom_map_elem_t vectorio_rectangle_locals_dict_table[] = {
// Properties // Properties
{ MP_ROM_QSTR(MP_QSTR_x), MP_ROM_PTR(&vectorio_vector_shape_x_obj) }, { MP_ROM_QSTR(MP_QSTR_x), MP_ROM_PTR(&vectorio_vector_shape_x_obj) },
{ MP_ROM_QSTR(MP_QSTR_y), MP_ROM_PTR(&vectorio_vector_shape_y_obj) }, { MP_ROM_QSTR(MP_QSTR_y), MP_ROM_PTR(&vectorio_vector_shape_y_obj) },
{ MP_ROM_QSTR(MP_QSTR_hidden), MP_ROM_PTR(&vectorio_vector_shape_hidden_obj) },
{ MP_ROM_QSTR(MP_QSTR_color_index), MP_ROM_PTR(&vectorio_rectangle_color_index_obj) }, { MP_ROM_QSTR(MP_QSTR_color_index), MP_ROM_PTR(&vectorio_rectangle_color_index_obj) },
{ MP_ROM_QSTR(MP_QSTR_width), MP_ROM_PTR(&vectorio_rectangle_width_obj) }, { MP_ROM_QSTR(MP_QSTR_width), MP_ROM_PTR(&vectorio_rectangle_width_obj) },
{ MP_ROM_QSTR(MP_QSTR_height), MP_ROM_PTR(&vectorio_rectangle_height_obj) }, { MP_ROM_QSTR(MP_QSTR_height), MP_ROM_PTR(&vectorio_rectangle_height_obj) },

View File

@ -181,6 +181,33 @@ MP_PROPERTY_GETSET(vectorio_vector_shape_location_obj,
(mp_obj_t)&vectorio_vector_shape_set_location_obj); (mp_obj_t)&vectorio_vector_shape_set_location_obj);
// Stub checker does not approve of these shared properties.
// hidden: bool
// """Hide the shape or not."""
//
STATIC mp_obj_t vectorio_vector_shape_obj_get_hidden(mp_obj_t wrapper_shape) {
// Relies on the fact that only vector_shape impl gets matched with a VectorShape.
const vectorio_draw_protocol_t *draw_protocol = mp_proto_get(MP_QSTR_protocol_draw, wrapper_shape);
vectorio_vector_shape_t *self = MP_OBJ_TO_PTR(draw_protocol->draw_get_protocol_self(wrapper_shape));
return mp_obj_new_bool(common_hal_vectorio_vector_shape_get_hidden(self));
}
MP_DEFINE_CONST_FUN_OBJ_1(vectorio_vector_shape_get_hidden_obj, vectorio_vector_shape_obj_get_hidden);
STATIC mp_obj_t vectorio_vector_shape_obj_set_hidden(mp_obj_t wrapper_shape, mp_obj_t hidden_obj) {
// Relies on the fact that only vector_shape impl gets matched with a VectorShape.
const vectorio_draw_protocol_t *draw_protocol = mp_proto_get(MP_QSTR_protocol_draw, wrapper_shape);
vectorio_vector_shape_t *self = MP_OBJ_TO_PTR(draw_protocol->draw_get_protocol_self(wrapper_shape));
common_hal_vectorio_vector_shape_set_hidden(self, mp_obj_is_true(hidden_obj));
return mp_const_none;
}
MP_DEFINE_CONST_FUN_OBJ_2(vectorio_vector_shape_set_hidden_obj, vectorio_vector_shape_obj_set_hidden);
MP_PROPERTY_GETSET(vectorio_vector_shape_hidden_obj,
(mp_obj_t)&vectorio_vector_shape_get_hidden_obj,
(mp_obj_t)&vectorio_vector_shape_set_hidden_obj);
// pixel_shader: Union[ColorConverter, Palette] // pixel_shader: Union[ColorConverter, Palette]
// """The pixel shader of the shape.""" // """The pixel shader of the shape."""
// //

View File

@ -31,6 +31,9 @@ void common_hal_vectorio_vector_shape_set_location(vectorio_vector_shape_t *self
mp_int_t common_hal_vectorio_vector_shape_get_y(vectorio_vector_shape_t *self); mp_int_t common_hal_vectorio_vector_shape_get_y(vectorio_vector_shape_t *self);
void common_hal_vectorio_vector_shape_set_y(vectorio_vector_shape_t *self, mp_int_t y); void common_hal_vectorio_vector_shape_set_y(vectorio_vector_shape_t *self, mp_int_t y);
mp_int_t common_hal_vectorio_vector_shape_get_hidden(vectorio_vector_shape_t *self);
void common_hal_vectorio_vector_shape_set_hidden(vectorio_vector_shape_t *self, bool hidden);
mp_obj_t common_hal_vectorio_vector_shape_get_pixel_shader(vectorio_vector_shape_t *self); mp_obj_t common_hal_vectorio_vector_shape_get_pixel_shader(vectorio_vector_shape_t *self);
void common_hal_vectorio_vector_shape_set_pixel_shader(vectorio_vector_shape_t *self, mp_obj_t pixel_shader); void common_hal_vectorio_vector_shape_set_pixel_shader(vectorio_vector_shape_t *self, mp_obj_t pixel_shader);
@ -40,6 +43,7 @@ void vectorio_vector_shape_update_transform(vectorio_vector_shape_t *self, displ
extern vectorio_draw_protocol_impl_t vectorio_vector_shape_draw_protocol_impl; extern vectorio_draw_protocol_impl_t vectorio_vector_shape_draw_protocol_impl;
extern const mp_obj_property_getset_t vectorio_vector_shape_x_obj; extern const mp_obj_property_getset_t vectorio_vector_shape_x_obj;
extern const mp_obj_property_getset_t vectorio_vector_shape_y_obj; extern const mp_obj_property_getset_t vectorio_vector_shape_y_obj;
extern const mp_obj_property_getset_t vectorio_vector_shape_hidden_obj;
extern const mp_obj_property_getset_t vectorio_vector_shape_location_obj; extern const mp_obj_property_getset_t vectorio_vector_shape_location_obj;
extern const mp_obj_property_getset_t vectorio_vector_shape_pixel_shader_obj; extern const mp_obj_property_getset_t vectorio_vector_shape_pixel_shader_obj;
extern const mp_obj_fun_builtin_fixed_t vectorio_vector_shape_contains_obj; extern const mp_obj_fun_builtin_fixed_t vectorio_vector_shape_contains_obj;

View File

@ -30,13 +30,13 @@
#include "py/enum.h" #include "py/enum.h"
typedef enum { typedef enum {
AUTHMODE_OPEN, AUTHMODE_OPEN = 1 << 0,
AUTHMODE_WEP, AUTHMODE_WEP = 1 << 1,
AUTHMODE_WPA, AUTHMODE_WPA = 1 << 2,
AUTHMODE_WPA2, AUTHMODE_WPA2 = 1 << 3,
AUTHMODE_WPA3, AUTHMODE_WPA3 = 1 << 4,
AUTHMODE_PSK, AUTHMODE_PSK = 1 << 5,
AUTHMODE_ENTERPRISE AUTHMODE_ENTERPRISE = 1 << 6,
} wifi_authmode_t; } wifi_authmode_t;
extern const mp_obj_type_t wifi_authmode_type; extern const mp_obj_type_t wifi_authmode_type;

View File

@ -44,7 +44,6 @@
//| //|
//| """ //| """
//| ... //| ...
//|
STATIC mp_obj_t wifi_monitor_make_new(const mp_obj_type_t *type, size_t n_args, size_t n_kw, const mp_obj_t *all_args) { STATIC mp_obj_t wifi_monitor_make_new(const mp_obj_type_t *type, size_t n_args, size_t n_kw, const mp_obj_t *all_args) {
enum { ARG_channel, ARG_queue }; enum { ARG_channel, ARG_queue };
static const mp_arg_t allowed_args[] = { static const mp_arg_t allowed_args[] = {
@ -103,7 +102,6 @@ MP_PROPERTY_GETTER(wifi_monitor_queue_obj,
//| def deinit(self) -> None: //| def deinit(self) -> None:
//| """De-initialize `wifi.Monitor` singleton.""" //| """De-initialize `wifi.Monitor` singleton."""
//| ... //| ...
//|
STATIC mp_obj_t wifi_monitor_obj_deinit(mp_obj_t self_in) { STATIC mp_obj_t wifi_monitor_obj_deinit(mp_obj_t self_in) {
common_hal_wifi_monitor_deinit(self_in); common_hal_wifi_monitor_deinit(self_in);
return mp_const_none; return mp_const_none;
@ -113,7 +111,6 @@ STATIC MP_DEFINE_CONST_FUN_OBJ_1(wifi_monitor_deinit_obj, wifi_monitor_obj_deini
//| def lost(self) -> int: //| def lost(self) -> int:
//| """Returns the packet loss count. The counter resets after each poll.""" //| """Returns the packet loss count. The counter resets after each poll."""
//| ... //| ...
//|
STATIC mp_obj_t wifi_monitor_obj_get_lost(mp_obj_t self_in) { STATIC mp_obj_t wifi_monitor_obj_get_lost(mp_obj_t self_in) {
return common_hal_wifi_monitor_get_lost(self_in); return common_hal_wifi_monitor_get_lost(self_in);
} }
@ -122,7 +119,6 @@ MP_DEFINE_CONST_FUN_OBJ_1(wifi_monitor_lost_obj, wifi_monitor_obj_get_lost);
//| def queued(self) -> int: //| def queued(self) -> int:
//| """Returns the packet queued count.""" //| """Returns the packet queued count."""
//| ... //| ...
//|
STATIC mp_obj_t wifi_monitor_obj_get_queued(mp_obj_t self_in) { STATIC mp_obj_t wifi_monitor_obj_get_queued(mp_obj_t self_in) {
if (common_hal_wifi_monitor_deinited()) { if (common_hal_wifi_monitor_deinited()) {
return mp_obj_new_int_from_uint(0); return mp_obj_new_int_from_uint(0);

View File

@ -140,11 +140,11 @@ MP_PROPERTY_GETSET(wifi_radio_hostname_obj,
//| mac_address: ReadableBuffer //| mac_address: ReadableBuffer
//| """MAC address for the station. When the address is altered after interface is connected //| """MAC address for the station. When the address is altered after interface is connected
//| the changes would only be reflected once the interface reconnects.""" //| the changes would only be reflected once the interface reconnects."""
STATIC mp_obj_t wifi_radio_get_mac_address(mp_obj_t self_in) { STATIC mp_obj_t _wifi_radio_get_mac_address(mp_obj_t self_in) {
wifi_radio_obj_t *self = MP_OBJ_TO_PTR(self_in); wifi_radio_obj_t *self = MP_OBJ_TO_PTR(self_in);
return MP_OBJ_FROM_PTR(common_hal_wifi_radio_get_mac_address(self)); return MP_OBJ_FROM_PTR(common_hal_wifi_radio_get_mac_address(self));
} }
MP_DEFINE_CONST_FUN_OBJ_1(wifi_radio_get_mac_address_obj, wifi_radio_get_mac_address); MP_DEFINE_CONST_FUN_OBJ_1(wifi_radio_get_mac_address_obj, _wifi_radio_get_mac_address);
STATIC mp_obj_t wifi_radio_set_mac_address(mp_obj_t self_in, mp_obj_t mac_address_in) { STATIC mp_obj_t wifi_radio_set_mac_address(mp_obj_t self_in, mp_obj_t mac_address_in) {
mp_buffer_info_t mac_address; mp_buffer_info_t mac_address;
@ -282,10 +282,10 @@ MP_DEFINE_CONST_FUN_OBJ_1(wifi_radio_stop_station_obj, wifi_radio_stop_station);
//| def start_ap( //| def start_ap(
//| self, //| self,
//| ssid: Union[str | ReadableBuffer], //| ssid: Union[str | ReadableBuffer],
//| password: Union[str | ReadableBuffer] = "", //| password: Union[str | ReadableBuffer] = b"",
//| *, //| *,
//| channel: Optional[int] = 1, //| channel: int = 1,
//| authmode: Optional[AuthMode], //| authmode: Optional[AuthMode] = None,
//| max_connections: Optional[int] = 4 //| max_connections: Optional[int] = 4
//| ) -> None: //| ) -> None:
//| """Starts an Access Point with the specified ssid and password. //| """Starts an Access Point with the specified ssid and password.
@ -293,10 +293,11 @@ MP_DEFINE_CONST_FUN_OBJ_1(wifi_radio_stop_station_obj, wifi_radio_stop_station);
//| If ``channel`` is given, the access point will use that channel unless //| If ``channel`` is given, the access point will use that channel unless
//| a station is already operating on a different channel. //| a station is already operating on a different channel.
//| //|
//| If ``authmode`` is given, the access point will use that Authentication //| If ``authmode`` is not None, the access point will use that Authentication
//| mode. If a password is given, ``authmode`` must not be ``OPEN``. //| mode. If a non-empty password is given, ``authmode`` must not be ``OPEN``.
//| If ``authmode`` isn't given, ``OPEN`` will be used when password isn't provided, //| If ``authmode`` is not given or is None,
//| otherwise ``WPA_WPA2_PSK``. //| ``OPEN`` will be used when the password is the empty string,
//| otherwise ``authmode`` will be ``WPA_WPA2_PSK``.
//| //|
//| If ``max_connections`` is given, the access point will allow up to //| If ``max_connections`` is given, the access point will allow up to
//| that number of stations to connect.""" //| that number of stations to connect."""
@ -305,9 +306,9 @@ STATIC mp_obj_t wifi_radio_start_ap(size_t n_args, const mp_obj_t *pos_args, mp_
enum { ARG_ssid, ARG_password, ARG_channel, ARG_authmode, ARG_max_connections }; enum { ARG_ssid, ARG_password, ARG_channel, ARG_authmode, ARG_max_connections };
static const mp_arg_t allowed_args[] = { static const mp_arg_t allowed_args[] = {
{ MP_QSTR_ssid, MP_ARG_REQUIRED | MP_ARG_OBJ }, { MP_QSTR_ssid, MP_ARG_REQUIRED | MP_ARG_OBJ },
{ MP_QSTR_password, MP_ARG_OBJ, {.u_obj = MP_OBJ_NULL} }, { MP_QSTR_password, MP_ARG_OBJ, {.u_obj = mp_const_empty_bytes} },
{ MP_QSTR_channel, MP_ARG_KW_ONLY | MP_ARG_INT, {.u_int = 1} }, { MP_QSTR_channel, MP_ARG_KW_ONLY | MP_ARG_INT, {.u_int = 1} },
{ MP_QSTR_authmode, MP_ARG_KW_ONLY | MP_ARG_OBJ, {.u_obj = MP_OBJ_NULL} }, { MP_QSTR_authmode, MP_ARG_KW_ONLY | MP_ARG_OBJ, {.u_obj = mp_const_none } },
{ MP_QSTR_max_connections, MP_ARG_KW_ONLY | MP_ARG_INT, {.u_int = 4} }, { MP_QSTR_max_connections, MP_ARG_KW_ONLY | MP_ARG_INT, {.u_int = 4} },
}; };
@ -315,12 +316,13 @@ STATIC mp_obj_t wifi_radio_start_ap(size_t n_args, const mp_obj_t *pos_args, mp_
mp_arg_val_t args[MP_ARRAY_SIZE(allowed_args)]; mp_arg_val_t args[MP_ARRAY_SIZE(allowed_args)];
mp_arg_parse_all(n_args - 1, pos_args + 1, kw_args, MP_ARRAY_SIZE(allowed_args), allowed_args, args); mp_arg_parse_all(n_args - 1, pos_args + 1, kw_args, MP_ARRAY_SIZE(allowed_args), allowed_args, args);
uint8_t authmode = 0; // 0 indicates mode wasn't given.
if (args[ARG_authmode].u_obj != MP_OBJ_NULL) { uint32_t authmodes = 0;
if (args[ARG_authmode].u_obj != mp_const_none) {
mp_obj_iter_buf_t iter_buf; mp_obj_iter_buf_t iter_buf;
mp_obj_t item, iterable = mp_getiter(args[ARG_authmode].u_obj, &iter_buf); mp_obj_t item, iterable = mp_getiter(args[ARG_authmode].u_obj, &iter_buf);
while ((item = mp_iternext(iterable)) != MP_OBJ_STOP_ITERATION) { while ((item = mp_iternext(iterable)) != MP_OBJ_STOP_ITERATION) {
authmode |= (1 << (wifi_authmode_t)cp_enum_value(&wifi_authmode_type, item)); authmodes |= cp_enum_value(&wifi_authmode_type, item);
} }
} }
@ -329,20 +331,24 @@ STATIC mp_obj_t wifi_radio_start_ap(size_t n_args, const mp_obj_t *pos_args, mp_
mp_arg_validate_length_range(ssid.len, 1, 32, MP_QSTR_ssid); mp_arg_validate_length_range(ssid.len, 1, 32, MP_QSTR_ssid);
mp_buffer_info_t password; mp_buffer_info_t password;
password.len = 0;
if (args[ARG_password].u_obj != MP_OBJ_NULL) {
if (authmode == 1) {
mp_raise_ValueError(translate("AuthMode.OPEN is not used with password"));
} else if (authmode == 0) {
authmode = (1 << AUTHMODE_WPA) | (1 << AUTHMODE_WPA2) | (1 << AUTHMODE_PSK);
}
mp_get_buffer_raise(args[ARG_password].u_obj, &password, MP_BUFFER_READ); mp_get_buffer_raise(args[ARG_password].u_obj, &password, MP_BUFFER_READ);
mp_arg_validate_length_range(password.len, 8, 63, MP_QSTR_password); if (authmodes == 0) {
if (password.len == 0) {
authmodes = AUTHMODE_OPEN;
} else { } else {
authmode = 1; authmodes = AUTHMODE_WPA | AUTHMODE_WPA2 | AUTHMODE_PSK;
}
} }
common_hal_wifi_radio_start_ap(self, ssid.buf, ssid.len, password.buf, password.len, args[ARG_channel].u_int, authmode, args[ARG_max_connections].u_int); if (authmodes == AUTHMODE_OPEN && password.len > 0) {
mp_raise_ValueError(translate("AuthMode.OPEN is not used with password"));
}
if (authmodes != AUTHMODE_OPEN) {
mp_arg_validate_length_range(password.len, 8, 63, MP_QSTR_password);
}
common_hal_wifi_radio_start_ap(self, ssid.buf, ssid.len, password.buf, password.len, args[ARG_channel].u_int, authmodes, args[ARG_max_connections].u_int);
return mp_const_none; return mp_const_none;
} }
STATIC MP_DEFINE_CONST_FUN_OBJ_KW(wifi_radio_start_ap_obj, 1, wifi_radio_start_ap); STATIC MP_DEFINE_CONST_FUN_OBJ_KW(wifi_radio_start_ap_obj, 1, wifi_radio_start_ap);
@ -359,10 +365,10 @@ MP_DEFINE_CONST_FUN_OBJ_1(wifi_radio_stop_ap_obj, wifi_radio_stop_ap);
//| def connect( //| def connect(
//| self, //| self,
//| ssid: Union[str | ReadableBuffer], //| ssid: Union[str | ReadableBuffer],
//| password: Union[str | ReadableBuffer] = "", //| password: Union[str | ReadableBuffer] = b"",
//| *, //| *,
//| channel: Optional[int] = 0, //| channel: int = 0,
//| bssid: Optional[Union[str | ReadableBuffer]] = "", //| bssid: Optional[Union[str | ReadableBuffer]] = None,
//| timeout: Optional[float] = None //| timeout: Optional[float] = None
//| ) -> None: //| ) -> None:
//| """Connects to the given ssid and waits for an ip address. Reconnections are handled //| """Connects to the given ssid and waits for an ip address. Reconnections are handled
@ -371,20 +377,20 @@ MP_DEFINE_CONST_FUN_OBJ_1(wifi_radio_stop_ap_obj, wifi_radio_stop_ap);
//| By default, this will scan all channels and connect to the access point (AP) with the //| By default, this will scan all channels and connect to the access point (AP) with the
//| given ``ssid`` and greatest signal strength (rssi). //| given ``ssid`` and greatest signal strength (rssi).
//| //|
//| If ``channel`` is given, the scan will begin with the given channel and connect to //| If ``channel`` is non-zero, the scan will begin with the given channel and connect to
//| the first AP with the given ``ssid``. This can speed up the connection time //| the first AP with the given ``ssid``. This can speed up the connection time
//| significantly because a full scan doesn't occur. //| significantly because a full scan doesn't occur.
//| //|
//| If ``bssid`` is given, the scan will start at the first channel or the one given and //| If ``bssid`` is given and not None, the scan will start at the first channel or the one given and
//| connect to the AP with the given ``bssid`` and ``ssid``.""" //| connect to the AP with the given ``bssid`` and ``ssid``."""
//| ... //| ...
STATIC mp_obj_t wifi_radio_connect(size_t n_args, const mp_obj_t *pos_args, mp_map_t *kw_args) { STATIC mp_obj_t wifi_radio_connect(size_t n_args, const mp_obj_t *pos_args, mp_map_t *kw_args) {
enum { ARG_ssid, ARG_password, ARG_channel, ARG_bssid, ARG_timeout }; enum { ARG_ssid, ARG_password, ARG_channel, ARG_bssid, ARG_timeout };
static const mp_arg_t allowed_args[] = { static const mp_arg_t allowed_args[] = {
{ MP_QSTR_ssid, MP_ARG_REQUIRED | MP_ARG_OBJ }, { MP_QSTR_ssid, MP_ARG_REQUIRED | MP_ARG_OBJ },
{ MP_QSTR_password, MP_ARG_OBJ, {.u_obj = MP_OBJ_NULL} }, { MP_QSTR_password, MP_ARG_OBJ, {.u_obj = mp_const_empty_bytes} },
{ MP_QSTR_channel, MP_ARG_KW_ONLY | MP_ARG_INT, {.u_int = 0} }, { MP_QSTR_channel, MP_ARG_KW_ONLY | MP_ARG_INT, {.u_int = 0} },
{ MP_QSTR_bssid, MP_ARG_KW_ONLY | MP_ARG_OBJ, {.u_obj = MP_OBJ_NULL} }, { MP_QSTR_bssid, MP_ARG_KW_ONLY | MP_ARG_OBJ, {.u_obj = mp_const_none} },
{ MP_QSTR_timeout, MP_ARG_KW_ONLY | MP_ARG_OBJ, {.u_obj = mp_const_none} }, { MP_QSTR_timeout, MP_ARG_KW_ONLY | MP_ARG_OBJ, {.u_obj = mp_const_none} },
}; };
@ -404,17 +410,19 @@ STATIC mp_obj_t wifi_radio_connect(size_t n_args, const mp_obj_t *pos_args, mp_m
mp_buffer_info_t password; mp_buffer_info_t password;
password.len = 0; password.len = 0;
if (args[ARG_password].u_obj != MP_OBJ_NULL) { if (args[ARG_password].u_obj != mp_const_none) {
mp_get_buffer_raise(args[ARG_password].u_obj, &password, MP_BUFFER_READ); mp_get_buffer_raise(args[ARG_password].u_obj, &password, MP_BUFFER_READ);
if (password.len != 0) {
mp_arg_validate_length_range(password.len, 8, 63, MP_QSTR_password); mp_arg_validate_length_range(password.len, 8, 63, MP_QSTR_password);
} }
}
#define MAC_ADDRESS_LENGTH 6 #define MAC_ADDRESS_LENGTH 6
mp_buffer_info_t bssid; mp_buffer_info_t bssid;
bssid.len = 0; bssid.len = 0;
// Should probably make sure bssid is just bytes and not something else too // Should probably make sure bssid is just bytes and not something else too
if (args[ARG_bssid].u_obj != MP_OBJ_NULL) { if (args[ARG_bssid].u_obj != mp_const_none) {
mp_get_buffer_raise(args[ARG_bssid].u_obj, &bssid, MP_BUFFER_READ); mp_get_buffer_raise(args[ARG_bssid].u_obj, &bssid, MP_BUFFER_READ);
if (bssid.len != MAC_ADDRESS_LENGTH) { if (bssid.len != MAC_ADDRESS_LENGTH) {
mp_raise_ValueError(translate("Invalid BSSID")); mp_raise_ValueError(translate("Invalid BSSID"));

View File

@ -77,6 +77,8 @@ extern void common_hal_wifi_radio_set_enabled(wifi_radio_obj_t *self, bool enabl
extern mp_obj_t common_hal_wifi_radio_get_hostname(wifi_radio_obj_t *self); extern mp_obj_t common_hal_wifi_radio_get_hostname(wifi_radio_obj_t *self);
extern void common_hal_wifi_radio_set_hostname(wifi_radio_obj_t *self, const char *hostname); extern void common_hal_wifi_radio_set_hostname(wifi_radio_obj_t *self, const char *hostname);
extern void wifi_radio_get_mac_address(wifi_radio_obj_t *self, uint8_t *mac);
extern mp_obj_t common_hal_wifi_radio_get_mac_address(wifi_radio_obj_t *self); extern mp_obj_t common_hal_wifi_radio_get_mac_address(wifi_radio_obj_t *self);
extern void common_hal_wifi_radio_set_mac_address(wifi_radio_obj_t *self, const uint8_t *mac); extern void common_hal_wifi_radio_set_mac_address(wifi_radio_obj_t *self, const uint8_t *mac);
extern mp_obj_t common_hal_wifi_radio_get_mac_address_ap(wifi_radio_obj_t *self); extern mp_obj_t common_hal_wifi_radio_get_mac_address_ap(wifi_radio_obj_t *self);
@ -91,7 +93,7 @@ extern void common_hal_wifi_radio_stop_scanning_networks(wifi_radio_obj_t *self)
extern void common_hal_wifi_radio_start_station(wifi_radio_obj_t *self); extern void common_hal_wifi_radio_start_station(wifi_radio_obj_t *self);
extern void common_hal_wifi_radio_stop_station(wifi_radio_obj_t *self); extern void common_hal_wifi_radio_stop_station(wifi_radio_obj_t *self);
extern void common_hal_wifi_radio_start_ap(wifi_radio_obj_t *self, uint8_t *ssid, size_t ssid_len, uint8_t *password, size_t password_len, uint8_t channel, uint8_t authmode, uint8_t max_connections); extern void common_hal_wifi_radio_start_ap(wifi_radio_obj_t *self, uint8_t *ssid, size_t ssid_len, uint8_t *password, size_t password_len, uint8_t channel, uint32_t authmodes, uint8_t max_connections);
extern void common_hal_wifi_radio_stop_ap(wifi_radio_obj_t *self); extern void common_hal_wifi_radio_stop_ap(wifi_radio_obj_t *self);
extern void common_hal_wifi_radio_start_dhcp_client(wifi_radio_obj_t *self); extern void common_hal_wifi_radio_start_dhcp_client(wifi_radio_obj_t *self);

View File

@ -143,8 +143,10 @@ void common_hal_adafruit_pixelbuf_pixelbuf_set_brightness(mp_obj_t self_in, mp_f
STATIC uint8_t _pixelbuf_get_as_uint8(mp_obj_t obj) { STATIC uint8_t _pixelbuf_get_as_uint8(mp_obj_t obj) {
if (mp_obj_is_small_int(obj)) { if (mp_obj_is_small_int(obj)) {
return MP_OBJ_SMALL_INT_VALUE(obj); return MP_OBJ_SMALL_INT_VALUE(obj);
#if MICROPY_LONGINT_IMPL != MICROPY_LONGINT_IMPL_NONE
} else if (mp_obj_is_int(obj)) { } else if (mp_obj_is_int(obj)) {
return mp_obj_get_int_truncated(obj); return mp_obj_get_int_truncated(obj);
#endif
} else if (mp_obj_is_float(obj)) { } else if (mp_obj_is_float(obj)) {
return (uint8_t)mp_obj_get_float(obj); return (uint8_t)mp_obj_get_float(obj);
} }
@ -152,50 +154,56 @@ STATIC uint8_t _pixelbuf_get_as_uint8(mp_obj_t obj) {
translate("can't convert %q to %q"), mp_obj_get_type_qstr(obj), MP_QSTR_int); translate("can't convert %q to %q"), mp_obj_get_type_qstr(obj), MP_QSTR_int);
} }
STATIC void _pixelbuf_parse_color(pixelbuf_pixelbuf_obj_t *self, mp_obj_t color, uint8_t *r, uint8_t *g, uint8_t *b, uint8_t *w) { STATIC color_u _pixelbuf_parse_color(pixelbuf_pixelbuf_obj_t *self, mp_obj_t color) {
color_u result;
pixelbuf_byteorder_details_t *byteorder = &self->byteorder; pixelbuf_byteorder_details_t *byteorder = &self->byteorder;
// w is shared between white in NeoPixels and brightness in dotstars (so that DotStars can have // w is shared between white in NeoPixels and brightness in dotstars (so that DotStars can have
// per-pixel brightness). Set the defaults here in case it isn't set below. // per-pixel brightness). Set the defaults here in case it isn't set below.
if (byteorder->is_dotstar) { if (byteorder->is_dotstar) {
*w = 255; result.w = 255;
} else { } else {
*w = 0; result.w = 0;
} }
if (mp_obj_is_int(color) || mp_obj_is_float(color)) { if (mp_obj_is_int(color) || mp_obj_is_float(color)) {
mp_int_t value = mp_obj_is_int(color) ? mp_obj_get_int_truncated(color) : (mp_int_t)mp_obj_get_float(color); mp_int_t value = mp_obj_is_int(color) ? mp_obj_get_int_truncated(color) : (mp_int_t)mp_obj_get_float(color);
*r = value >> 16 & 0xff; result.r = value >> 16 & 0xff;
*g = (value >> 8) & 0xff; result.g = (value >> 8) & 0xff;
*b = value & 0xff; result.b = value & 0xff;
} else { } else {
mp_obj_t *items; mp_obj_t *items;
size_t len; size_t len;
mp_obj_get_array(color, &len, &items); mp_obj_get_array(color, &len, &items);
mp_arg_validate_length_range(len, 3, 4, MP_QSTR_color); mp_arg_validate_length_range(len, 3, 4, MP_QSTR_color);
*r = _pixelbuf_get_as_uint8(items[PIXEL_R]); result.r = _pixelbuf_get_as_uint8(items[PIXEL_R]);
*g = _pixelbuf_get_as_uint8(items[PIXEL_G]); result.g = _pixelbuf_get_as_uint8(items[PIXEL_G]);
*b = _pixelbuf_get_as_uint8(items[PIXEL_B]); result.b = _pixelbuf_get_as_uint8(items[PIXEL_B]);
if (len > 3) { if (len > 3) {
if (mp_obj_is_float(items[PIXEL_W])) { if (mp_obj_is_float(items[PIXEL_W])) {
*w = 255 * mp_obj_get_float(items[PIXEL_W]); result.w = 255 * mp_obj_get_float(items[PIXEL_W]);
} else { } else {
*w = mp_obj_get_int_truncated(items[PIXEL_W]); result.w = mp_obj_get_int_truncated(items[PIXEL_W]);
} }
return; return result;
} }
} }
// Int colors can't set white directly so convert to white when all components are equal. // Int colors can't set white directly so convert to white when all components are equal.
// Also handles RGBW values assigned an RGB tuple. // Also handles RGBW values assigned an RGB tuple.
if (!byteorder->is_dotstar && byteorder->bpp == 4 && byteorder->has_white && *r == *g && *r == *b) { if (!byteorder->is_dotstar && byteorder->bpp == 4 && byteorder->has_white && result.r == result.g && result.r == result.b) {
*w = *r; result.w = result.r;
*r = 0; result.r = 0;
*g = 0; result.g = 0;
*b = 0; result.b = 0;
} }
return result;
} }
STATIC void _pixelbuf_set_pixel_color(pixelbuf_pixelbuf_obj_t *self, size_t index, uint8_t r, uint8_t g, uint8_t b, uint8_t w) { STATIC void _pixelbuf_set_pixel_color(pixelbuf_pixelbuf_obj_t *self, size_t index, color_u rgbw) {
uint8_t r = rgbw.r;
uint8_t g = rgbw.g;
uint8_t b = rgbw.b;
uint8_t w = rgbw.w;
// DotStars don't have white, instead they have 5 bit brightness so pack it into w. Shift right // DotStars don't have white, instead they have 5 bit brightness so pack it into w. Shift right
// by three to leave the top five bits. // by three to leave the top five bits.
if (self->bytes_per_pixel == 4 && self->byteorder.is_dotstar) { if (self->bytes_per_pixel == 4 && self->byteorder.is_dotstar) {
@ -234,12 +242,8 @@ STATIC void _pixelbuf_set_pixel_color(pixelbuf_pixelbuf_obj_t *self, size_t inde
} }
STATIC void _pixelbuf_set_pixel(pixelbuf_pixelbuf_obj_t *self, size_t index, mp_obj_t value) { STATIC void _pixelbuf_set_pixel(pixelbuf_pixelbuf_obj_t *self, size_t index, mp_obj_t value) {
uint8_t r; color_u rgbw = _pixelbuf_parse_color(self, value);
uint8_t g; _pixelbuf_set_pixel_color(self, index, rgbw);
uint8_t b;
uint8_t w;
_pixelbuf_parse_color(self, value, &r, &g, &b, &w);
_pixelbuf_set_pixel_color(self, index, r, g, b, w);
} }
void common_hal_adafruit_pixelbuf_pixelbuf_set_pixels(mp_obj_t self_in, size_t start, mp_int_t step, size_t slice_len, mp_obj_t *values, void common_hal_adafruit_pixelbuf_pixelbuf_set_pixels(mp_obj_t self_in, size_t start, mp_int_t step, size_t slice_len, mp_obj_t *values,
@ -318,14 +322,10 @@ void common_hal_adafruit_pixelbuf_pixelbuf_show(mp_obj_t self_in) {
void common_hal_adafruit_pixelbuf_pixelbuf_fill(mp_obj_t self_in, mp_obj_t fill_color) { void common_hal_adafruit_pixelbuf_pixelbuf_fill(mp_obj_t self_in, mp_obj_t fill_color) {
pixelbuf_pixelbuf_obj_t *self = native_pixelbuf(self_in); pixelbuf_pixelbuf_obj_t *self = native_pixelbuf(self_in);
uint8_t r; color_u rgbw = _pixelbuf_parse_color(self, fill_color);
uint8_t g;
uint8_t b;
uint8_t w;
_pixelbuf_parse_color(self, fill_color, &r, &g, &b, &w);
for (size_t i = 0; i < self->pixel_count; i++) { for (size_t i = 0; i < self->pixel_count; i++) {
_pixelbuf_set_pixel_color(self, i, r, g, b, w); _pixelbuf_set_pixel_color(self, i, rgbw);
} }
if (self->auto_write) { if (self->auto_write) {
common_hal_adafruit_pixelbuf_pixelbuf_show(self_in); common_hal_adafruit_pixelbuf_pixelbuf_show(self_in);

View File

@ -293,6 +293,16 @@ void common_hal_vectorio_vector_shape_set_location(vectorio_vector_shape_t *self
} }
} }
mp_int_t common_hal_vectorio_vector_shape_get_hidden(vectorio_vector_shape_t *self) {
VECTORIO_SHAPE_DEBUG("%p get_hidden\n", self);
return self->hidden;
}
void common_hal_vectorio_vector_shape_set_hidden(vectorio_vector_shape_t *self, bool hidden) {
VECTORIO_SHAPE_DEBUG("%p set_hidden %d\n", self, x);
self->hidden = hidden;
common_hal_vectorio_vector_shape_set_dirty(self);
}
mp_obj_t common_hal_vectorio_vector_shape_get_pixel_shader(vectorio_vector_shape_t *self) { mp_obj_t common_hal_vectorio_vector_shape_get_pixel_shader(vectorio_vector_shape_t *self) {
VECTORIO_SHAPE_DEBUG("%p get_pixel_shader\n", self); VECTORIO_SHAPE_DEBUG("%p get_pixel_shader\n", self);
@ -315,6 +325,11 @@ bool vectorio_vector_shape_fill_area(vectorio_vector_shape_t *self, const _displ
uint64_t start = common_hal_time_monotonic_ns(); uint64_t start = common_hal_time_monotonic_ns();
uint64_t pixel_time = 0; uint64_t pixel_time = 0;
#endif #endif
if (self->hidden) {
return false;
}
VECTORIO_SHAPE_DEBUG("%p fill_area: fill: {(%5d,%5d), (%5d,%5d)}", VECTORIO_SHAPE_DEBUG("%p fill_area: fill: {(%5d,%5d), (%5d,%5d)}",
self, self,
area->x1, area->y1, area->x2, area->y2 area->x1, area->y1, area->x2, area->y2

View File

@ -37,6 +37,7 @@ typedef struct {
displayio_area_t ephemeral_dirty_area; displayio_area_t ephemeral_dirty_area;
displayio_area_t current_area; displayio_area_t current_area;
bool current_area_dirty; bool current_area_dirty;
bool hidden;
} vectorio_vector_shape_t; } vectorio_vector_shape_t;
displayio_area_t *vectorio_vector_shape_get_refresh_areas(vectorio_vector_shape_t *self, displayio_area_t *tail); displayio_area_t *vectorio_vector_shape_get_refresh_areas(vectorio_vector_shape_t *self, displayio_area_t *tail);

View File

@ -24,11 +24,11 @@
* THE SOFTWARE. * THE SOFTWARE.
*/ */
#ifndef MICROPY_INCLUDED_SUPERVISOR_FATFS_PORT_H #ifndef MICROPY_INCLUDED_SUPERVISOR_FATFS_H
#define MICROPY_INCLUDED_SUPERVISOR_FATFS_PORT_H #define MICROPY_INCLUDED_SUPERVISOR_FATFS_H
#include "lib/oofatfs/ff.h" #include "lib/oofatfs/ff.h"
void override_fattime(DWORD time); void override_fattime(DWORD time);
#endif // MICROPY_INCLUDED_SUPERVISOR_FATFS_PORT_H #endif // MICROPY_INCLUDED_SUPERVISOR_FATFS_H

Some files were not shown because too many files have changed in this diff Show More