Merge remote-tracking branch 'upstream/main' into rp2040-alarms

This commit is contained in:
Lucian Copeland 2021-06-07 14:11:41 -04:00
commit 63c1791d87
92 changed files with 1225 additions and 183 deletions

View File

@ -154,8 +154,24 @@ jobs:
with: with:
name: mpy-cross-macos-catalina name: mpy-cross-macos-catalina
path: mpy-cross/mpy-cross path: mpy-cross/mpy-cross
- name: Select SDK for M1 build
run: sudo xcode-select -switch /Applications/Xcode_12.3.app
- name: Build mpy-cross (arm64)
run: make -C mpy-cross -j2 -f Makefile.m1 V=2
- uses: actions/upload-artifact@v2
with:
name: mpy-cross-macos-bigsur-arm64
path: mpy-cross/mpy-cross-arm64
- name: Make universal binary
run: lipo -create -output mpy-cross-macos-universal mpy-cross/mpy-cross mpy-cross/mpy-cross-arm64
- uses: actions/upload-artifact@v2
with:
name: mpy-cross-macos-universal
path: mpy-cross-macos-universal
- name: Upload mpy-cross build to S3 - name: Upload mpy-cross build to S3
run: | run: |
[ -z "$AWS_ACCESS_KEY_ID" ] || aws s3 cp mpy-cross-macos-universal s3://adafruit-circuit-python/bin/mpy-cross/mpy-cross-macos-universal-${{ env.CP_VERSION }} --no-progress --region us-east-1
[ -z "$AWS_ACCESS_KEY_ID" ] || aws s3 cp mpy-cross/mpy-cross-arm64 s3://adafruit-circuit-python/bin/mpy-cross/mpy-cross-macos-bigsur-${{ env.CP_VERSION }}-arm64 --no-progress --region us-east-1
[ -z "$AWS_ACCESS_KEY_ID" ] || aws s3 cp mpy-cross/mpy-cross s3://adafruit-circuit-python/bin/mpy-cross/mpy-cross-macos-catalina-${{ env.CP_VERSION }} --no-progress --region us-east-1 [ -z "$AWS_ACCESS_KEY_ID" ] || aws s3 cp mpy-cross/mpy-cross s3://adafruit-circuit-python/bin/mpy-cross/mpy-cross-macos-catalina-${{ env.CP_VERSION }} --no-progress --region us-east-1
env: env:
AWS_PAGER: '' AWS_PAGER: ''
@ -212,6 +228,7 @@ jobs:
- "cp_sapling_m0" - "cp_sapling_m0"
- "cp_sapling_m0_revb" - "cp_sapling_m0_revb"
- "cp_sapling_m0_spiflash" - "cp_sapling_m0_spiflash"
- "cytron_maker_pi_rp2040"
- "datalore_ip_m4" - "datalore_ip_m4"
- "datum_distance" - "datum_distance"
- "datum_imu" - "datum_imu"
@ -291,6 +308,7 @@ jobs:
- "pewpew_m4" - "pewpew_m4"
- "picoplanet" - "picoplanet"
- "pimoroni_keybow2040" - "pimoroni_keybow2040"
- "pimoroni_pga2040"
- "pimoroni_picolipo_16mb" - "pimoroni_picolipo_16mb"
- "pimoroni_picolipo_4mb" - "pimoroni_picolipo_4mb"
- "pimoroni_picosystem" - "pimoroni_picosystem"
@ -330,6 +348,7 @@ jobs:
- "sparkfun_redboard_turbo" - "sparkfun_redboard_turbo"
- "sparkfun_samd21_dev" - "sparkfun_samd21_dev"
- "sparkfun_samd21_mini" - "sparkfun_samd21_mini"
- "sparkfun_samd51_micromod"
- "sparkfun_samd51_thing_plus" - "sparkfun_samd51_thing_plus"
- "sparkfun_thing_plus_rp2040" - "sparkfun_thing_plus_rp2040"
- "spresense" - "spresense"
@ -472,7 +491,8 @@ jobs:
- "franzininho_wifi_wrover" - "franzininho_wifi_wrover"
- "lilygo_ttgo_t8_s2_st7789" - "lilygo_ttgo_t8_s2_st7789"
- "microdev_micro_s2" - "microdev_micro_s2"
- "muselab_nanoesp32_s2" - "muselab_nanoesp32_s2_wroom"
- "muselab_nanoesp32_s2_wrover"
- "targett_module_clip_wroom" - "targett_module_clip_wroom"
- "targett_module_clip_wrover" - "targett_module_clip_wrover"
- "unexpectedmaker_feathers2" - "unexpectedmaker_feathers2"

106
.github/workflows/ports_windows.yml vendored Normal file
View File

@ -0,0 +1,106 @@
name: windows port
on:
push:
pull_request:
paths:
- '.github/workflows/*.yml'
- 'tools/**'
- 'py/**'
- 'extmod/**'
- 'lib/**'
- 'ports/unix/**'
- 'ports/windows/**'
jobs:
build:
runs-on: windows-2019
defaults:
run:
# We define a custom shell script here, although `msys2.cmd` does neither exist nor is it available in the PATH yet
shell: msys2 {0}
steps:
# We want to change the configuration of the git command that actions/checkout will be using (since it is not possible to set autocrlf through the action yet, see actions/checkout#226).
- run: git config --global core.autocrlf input
shell: bash
- name: Check python coding (cmd)
run: |
python -c "import sys, locale; print(sys.getdefaultencoding(), locale.getpreferredencoding(False))"
shell: cmd
# We use a JS Action, which calls the system terminal or other custom terminals directly, if required
- uses: msys2/setup-msys2@v2
with:
update: true
install: base-devel git wget unzip gcc python-pip
# The goal of this was to test how things worked when the default file
# encoding (locale.getpreferedencoding()) was not UTF-8. However, msys2
# python does use utf-8 as the preferred file encoding, and using
# actions/setup-python python3.8 gave a broken build, so we're not really
# testing what we wanted to test.
#
# however, commandline length limits are being tested so that does some
# good.
- name: Check python coding (msys2)
run: |
locale -v
which python; python --version
python -c "import sys, locale; print(sys.getdefaultencoding(), locale.getpreferredencoding(False))"
which python3; python3 --version
python3 -c "import sys, locale; print(sys.getdefaultencoding(), locale.getpreferredencoding(False))"
- name: Install dependencies
run: |
wget --no-verbose -O gcc-arm.zip https://developer.arm.com/-/media/Files/downloads/gnu-rm/10-2020q4/gcc-arm-none-eabi-10-2020-q4-major-win32.zip
unzip -q -d /tmp gcc-arm.zip
tar -C /tmp/gcc-arm-none-* -cf - . | tar -C /usr/local -xf -
pip install wheel
# requirements_dev.txt doesn't install on windows. (with msys2 python)
# instead, pick a subset for what we want to do
pip install cascadetoml jinja2 typer
# check that installed packages work....?
which python; python --version; python -c "import cascadetoml"
which python3; python3 --version; python3 -c "import cascadetoml"
- uses: actions/checkout@v2
with:
submodules: true
fetch-depth: 0
- run: git fetch --recurse-submodules=no https://github.com/adafruit/circuitpython refs/tags/*:refs/tags/*
- name: CircuitPython version
run: |
git describe --dirty --tags
echo >>$GITHUB_ENV CP_VERSION=$(git describe --dirty --tags)
- name: build mpy-cross
run: make -j2 -C mpy-cross
- name: build rp2040
run: make -j2 -C ports/raspberrypi BOARD=adafruit_feather_rp2040 TRANSLATION=de_DE
- name: build samd21
run: make -j2 -C ports/atmel-samd BOARD=feather_m0_express TRANSLATION=zh_Latn_pinyin
- name: build samd51
run: make -j2 -C ports/atmel-samd BOARD=feather_m4_express TRANSLATION=es
- name: build nrf
run: make -j2 -C ports/nrf BOARD=feather_nrf52840_express TRANSLATION=fr
- name: build stm
run: make -j2 -C ports/stm BOARD=feather_stm32f405_express TRANSLATION=pt_BR
# I gave up trying to do esp32 builds on windows when I saw
# ERROR: Platform MINGW64_NT-10.0-17763-x86_64 appears to be unsupported
# https://github.com/espressif/esp-idf/issues/7062
#
# - name: prepare esp
# run: ports/esp32s2/esp-idf/install.bat
# shell: cmd
#
# - name: build esp
# run: . ports/esp32s2/esp-idf/export.sh && make -j2 -C ports/esp32s2 BOARD=adafruit_metro_esp32s2

3
.gitmodules vendored
View File

@ -184,3 +184,6 @@
[submodule "frozen/Adafruit_CircuitPython_MIDI"] [submodule "frozen/Adafruit_CircuitPython_MIDI"]
path = frozen/Adafruit_CircuitPython_MIDI path = frozen/Adafruit_CircuitPython_MIDI
url = https://github.com/adafruit/Adafruit_CircuitPython_MIDI url = https://github.com/adafruit/Adafruit_CircuitPython_MIDI
[submodule "frozen/Adafruit_CircuitPython_SimpleIO"]
path = frozen/Adafruit_CircuitPython_SimpleIO
url = https://github.com/adafruit/adafruit_circuitpython_simpleio

@ -1 +1 @@
Subproject commit 8ece81d95a62c2aa84a7f4d5ebaef362bbbabc45 Subproject commit f376fcca8c829b1e68236edbef6b71cb57f7e42f

@ -1 +1 @@
Subproject commit d3e7a587a2f974251f44254fae88c14a52229979 Subproject commit 61e38631b557a51376edbd02501ca51311631597

@ -1 +1 @@
Subproject commit de68b7d4575151c1648c734559e59c2932965939 Subproject commit 78b0fbbb00c0431042b460fe20a76bbc440c4793

@ -1 +1 @@
Subproject commit bdef506ca48a50607ad6a3e5a9c7cc2c9ace0e42 Subproject commit a8e9975b3f06d454f8951254d96f99755b11d962

@ -1 +1 @@
Subproject commit 7b617d33ee5746140aa38edec001f4f5c31167ce Subproject commit 7193260344306337050a165bdee4f9d0de7bb8e9

@ -0,0 +1 @@
Subproject commit 9b53bebc520d70f89d44fc989fc493d5036df925

@ -1 +1 @@
Subproject commit 6467edbed535484ebdd7492d885adf3433fb8280 Subproject commit 3c47a7323f81e961b06853814964d04db5b3817b

@ -1 +1 @@
Subproject commit 98017c57349e259fab70c6a7830436b19a55f6f4 Subproject commit 7fe6406affb1376193102cf76ded06e61316d7e6

View File

@ -94,6 +94,10 @@ msgstr "indeks %q harus bilangan bulat, bukan %s"
msgid "%q list must be a list" msgid "%q list must be a list"
msgstr "daftar %q harus berupa daftar" msgstr "daftar %q harus berupa daftar"
#: shared-bindings/usb_hid/Device.c
msgid "%q must be 0-255"
msgstr ""
#: shared-bindings/usb_hid/Device.c #: shared-bindings/usb_hid/Device.c
msgid "%q must be 1-255" msgid "%q must be 1-255"
msgstr "" msgstr ""
@ -111,7 +115,7 @@ msgid "%q must be >= 1"
msgstr "%q harus >= 1" msgstr "%q harus >= 1"
#: shared-bindings/usb_hid/Device.c #: shared-bindings/usb_hid/Device.c
msgid "%q must be None or 1-255" msgid "%q must be None or between 1 and len(report_descriptor)-1"
msgstr "" msgstr ""
#: shared-module/vectorio/Polygon.c #: shared-module/vectorio/Polygon.c

View File

@ -87,6 +87,10 @@ msgstr ""
msgid "%q list must be a list" msgid "%q list must be a list"
msgstr "" msgstr ""
#: shared-bindings/usb_hid/Device.c
msgid "%q must be 0-255"
msgstr ""
#: shared-bindings/usb_hid/Device.c #: shared-bindings/usb_hid/Device.c
msgid "%q must be 1-255" msgid "%q must be 1-255"
msgstr "" msgstr ""
@ -104,7 +108,7 @@ msgid "%q must be >= 1"
msgstr "" msgstr ""
#: shared-bindings/usb_hid/Device.c #: shared-bindings/usb_hid/Device.c
msgid "%q must be None or 1-255" msgid "%q must be None or between 1 and len(report_descriptor)-1"
msgstr "" msgstr ""
#: shared-module/vectorio/Polygon.c #: shared-module/vectorio/Polygon.c

View File

@ -90,6 +90,10 @@ msgstr "Indexy %q musí být celá čísla, nikoli %s"
msgid "%q list must be a list" msgid "%q list must be a list"
msgstr "Seznam %q musí být seznam" msgstr "Seznam %q musí být seznam"
#: shared-bindings/usb_hid/Device.c
msgid "%q must be 0-255"
msgstr ""
#: shared-bindings/usb_hid/Device.c #: shared-bindings/usb_hid/Device.c
msgid "%q must be 1-255" msgid "%q must be 1-255"
msgstr "" msgstr ""
@ -107,7 +111,7 @@ msgid "%q must be >= 1"
msgstr "%q musí být > = 1" msgstr "%q musí být > = 1"
#: shared-bindings/usb_hid/Device.c #: shared-bindings/usb_hid/Device.c
msgid "%q must be None or 1-255" msgid "%q must be None or between 1 and len(report_descriptor)-1"
msgstr "" msgstr ""
#: shared-module/vectorio/Polygon.c #: shared-module/vectorio/Polygon.c

View File

@ -95,6 +95,10 @@ msgstr "%q Indizes müssen Integer sein, nicht %s"
msgid "%q list must be a list" msgid "%q list must be a list"
msgstr "%q Liste muss eine Liste sein" msgstr "%q Liste muss eine Liste sein"
#: shared-bindings/usb_hid/Device.c
msgid "%q must be 0-255"
msgstr ""
#: shared-bindings/usb_hid/Device.c #: shared-bindings/usb_hid/Device.c
msgid "%q must be 1-255" msgid "%q must be 1-255"
msgstr "" msgstr ""
@ -112,7 +116,7 @@ msgid "%q must be >= 1"
msgstr "%q muss >= 1 sein" msgstr "%q muss >= 1 sein"
#: shared-bindings/usb_hid/Device.c #: shared-bindings/usb_hid/Device.c
msgid "%q must be None or 1-255" msgid "%q must be None or between 1 and len(report_descriptor)-1"
msgstr "" msgstr ""
#: shared-module/vectorio/Polygon.c #: shared-module/vectorio/Polygon.c

View File

@ -87,6 +87,10 @@ msgstr ""
msgid "%q list must be a list" msgid "%q list must be a list"
msgstr "" msgstr ""
#: shared-bindings/usb_hid/Device.c
msgid "%q must be 0-255"
msgstr ""
#: shared-bindings/usb_hid/Device.c #: shared-bindings/usb_hid/Device.c
msgid "%q must be 1-255" msgid "%q must be 1-255"
msgstr "" msgstr ""
@ -104,7 +108,7 @@ msgid "%q must be >= 1"
msgstr "" msgstr ""
#: shared-bindings/usb_hid/Device.c #: shared-bindings/usb_hid/Device.c
msgid "%q must be None or 1-255" msgid "%q must be None or between 1 and len(report_descriptor)-1"
msgstr "" msgstr ""
#: shared-module/vectorio/Polygon.c #: shared-module/vectorio/Polygon.c

View File

@ -96,6 +96,10 @@ msgstr ""
msgid "%q list must be a list" msgid "%q list must be a list"
msgstr "%q list must be a list" msgstr "%q list must be a list"
#: shared-bindings/usb_hid/Device.c
msgid "%q must be 0-255"
msgstr ""
#: shared-bindings/usb_hid/Device.c #: shared-bindings/usb_hid/Device.c
msgid "%q must be 1-255" msgid "%q must be 1-255"
msgstr "" msgstr ""
@ -113,7 +117,7 @@ msgid "%q must be >= 1"
msgstr "%q must be >= 1" msgstr "%q must be >= 1"
#: shared-bindings/usb_hid/Device.c #: shared-bindings/usb_hid/Device.c
msgid "%q must be None or 1-255" msgid "%q must be None or between 1 and len(report_descriptor)-1"
msgstr "" msgstr ""
#: shared-module/vectorio/Polygon.c #: shared-module/vectorio/Polygon.c

View File

@ -8,8 +8,8 @@ msgstr ""
"Project-Id-Version: \n" "Project-Id-Version: \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: 2021-05-24 21:25+0000\n" "PO-Revision-Date: 2021-05-30 13:32+0000\n"
"Last-Translator: Jose David M <jquintana202020@gmail.com>\n" "Last-Translator: Alvaro Figueroa <alvaro@greencore.co.cr>\n"
"Language-Team: \n" "Language-Team: \n"
"Language: es\n" "Language: es\n"
"MIME-Version: 1.0\n" "MIME-Version: 1.0\n"
@ -98,6 +98,10 @@ msgstr "%q indices deben ser enteros, no %s"
msgid "%q list must be a list" msgid "%q list must be a list"
msgstr "%q lista debe ser una lista" msgstr "%q lista debe ser una lista"
#: shared-bindings/usb_hid/Device.c
msgid "%q must be 0-255"
msgstr "%q debe ser de 0-255"
#: shared-bindings/usb_hid/Device.c #: shared-bindings/usb_hid/Device.c
msgid "%q must be 1-255" msgid "%q must be 1-255"
msgstr "%q debe estar entre 1-255" msgstr "%q debe estar entre 1-255"
@ -115,8 +119,8 @@ msgid "%q must be >= 1"
msgstr "%q debe ser >= 1" msgstr "%q debe ser >= 1"
#: shared-bindings/usb_hid/Device.c #: shared-bindings/usb_hid/Device.c
msgid "%q must be None or 1-255" msgid "%q must be None or between 1 and len(report_descriptor)-1"
msgstr "%q debe ser None o 1-255" msgstr "%q debe ser None o entre 1 y len(report_descriptor)-1"
#: shared-module/vectorio/Polygon.c #: shared-module/vectorio/Polygon.c
msgid "%q must be a tuple of length 2" msgid "%q must be a tuple of length 2"
@ -4448,6 +4452,9 @@ msgstr "zi debe ser de tipo flotante"
msgid "zi must be of shape (n_section, 2)" msgid "zi must be of shape (n_section, 2)"
msgstr "zi debe ser una forma (n_section,2)" msgstr "zi debe ser una forma (n_section,2)"
#~ msgid "%q must be None or 1-255"
#~ msgstr "%q debe ser None o 1-255"
#~ msgid "Only raw int or string supported for ip" #~ msgid "Only raw int or string supported for ip"
#~ msgstr "Para ip solo puede con un entero o una cadena" #~ msgstr "Para ip solo puede con un entero o una cadena"

View File

@ -86,6 +86,10 @@ msgstr "%q indeks ay dapat integers, hindi %s"
msgid "%q list must be a list" msgid "%q list must be a list"
msgstr "" msgstr ""
#: shared-bindings/usb_hid/Device.c
msgid "%q must be 0-255"
msgstr ""
#: shared-bindings/usb_hid/Device.c #: shared-bindings/usb_hid/Device.c
msgid "%q must be 1-255" msgid "%q must be 1-255"
msgstr "" msgstr ""
@ -104,7 +108,7 @@ msgid "%q must be >= 1"
msgstr "aarehas na haba dapat ang buffer slices" msgstr "aarehas na haba dapat ang buffer slices"
#: shared-bindings/usb_hid/Device.c #: shared-bindings/usb_hid/Device.c
msgid "%q must be None or 1-255" msgid "%q must be None or between 1 and len(report_descriptor)-1"
msgstr "" msgstr ""
#: shared-module/vectorio/Polygon.c #: shared-module/vectorio/Polygon.c

View File

@ -98,6 +98,10 @@ msgstr "les indices %q doivent être des entiers, pas %s"
msgid "%q list must be a list" msgid "%q list must be a list"
msgstr "La liste %q doit être une liste" msgstr "La liste %q doit être une liste"
#: shared-bindings/usb_hid/Device.c
msgid "%q must be 0-255"
msgstr ""
#: shared-bindings/usb_hid/Device.c #: shared-bindings/usb_hid/Device.c
msgid "%q must be 1-255" msgid "%q must be 1-255"
msgstr "%q doit être compris entre 1 et 255" msgstr "%q doit être compris entre 1 et 255"
@ -115,8 +119,8 @@ msgid "%q must be >= 1"
msgstr "%q doit être >= 1" msgstr "%q doit être >= 1"
#: shared-bindings/usb_hid/Device.c #: shared-bindings/usb_hid/Device.c
msgid "%q must be None or 1-255" msgid "%q must be None or between 1 and len(report_descriptor)-1"
msgstr "%q doit être None ou compris entre 1 et 255" msgstr ""
#: shared-module/vectorio/Polygon.c #: shared-module/vectorio/Polygon.c
msgid "%q must be a tuple of length 2" msgid "%q must be a tuple of length 2"
@ -4459,6 +4463,9 @@ msgstr "zi doit être de type float"
msgid "zi must be of shape (n_section, 2)" msgid "zi must be of shape (n_section, 2)"
msgstr "zi doit être de forme (n_section, 2)" msgstr "zi doit être de forme (n_section, 2)"
#~ msgid "%q must be None or 1-255"
#~ msgstr "%q doit être None ou compris entre 1 et 255"
#~ msgid "Only raw int supported for ip" #~ msgid "Only raw int supported for ip"
#~ msgstr "IP n'accepte que les chiffres entiers bruts" #~ msgstr "IP n'accepte que les chiffres entiers bruts"

View File

@ -87,6 +87,10 @@ msgstr ""
msgid "%q list must be a list" msgid "%q list must be a list"
msgstr "" msgstr ""
#: shared-bindings/usb_hid/Device.c
msgid "%q must be 0-255"
msgstr ""
#: shared-bindings/usb_hid/Device.c #: shared-bindings/usb_hid/Device.c
msgid "%q must be 1-255" msgid "%q must be 1-255"
msgstr "" msgstr ""
@ -104,7 +108,7 @@ msgid "%q must be >= 1"
msgstr "" msgstr ""
#: shared-bindings/usb_hid/Device.c #: shared-bindings/usb_hid/Device.c
msgid "%q must be None or 1-255" msgid "%q must be None or between 1 and len(report_descriptor)-1"
msgstr "" msgstr ""
#: shared-module/vectorio/Polygon.c #: shared-module/vectorio/Polygon.c

View File

@ -96,6 +96,10 @@ msgstr "gli indici %q devono essere interi, non %s"
msgid "%q list must be a list" msgid "%q list must be a list"
msgstr "lista %q deve essere una lista" msgstr "lista %q deve essere una lista"
#: shared-bindings/usb_hid/Device.c
msgid "%q must be 0-255"
msgstr ""
#: shared-bindings/usb_hid/Device.c #: shared-bindings/usb_hid/Device.c
msgid "%q must be 1-255" msgid "%q must be 1-255"
msgstr "" msgstr ""
@ -114,7 +118,7 @@ msgid "%q must be >= 1"
msgstr "slice del buffer devono essere della stessa lunghezza" msgstr "slice del buffer devono essere della stessa lunghezza"
#: shared-bindings/usb_hid/Device.c #: shared-bindings/usb_hid/Device.c
msgid "%q must be None or 1-255" msgid "%q must be None or between 1 and len(report_descriptor)-1"
msgstr "" msgstr ""
#: shared-module/vectorio/Polygon.c #: shared-module/vectorio/Polygon.c

View File

@ -92,6 +92,10 @@ msgstr ""
msgid "%q list must be a list" msgid "%q list must be a list"
msgstr "%q リストはリストでなければなりません" msgstr "%q リストはリストでなければなりません"
#: shared-bindings/usb_hid/Device.c
msgid "%q must be 0-255"
msgstr ""
#: shared-bindings/usb_hid/Device.c #: shared-bindings/usb_hid/Device.c
msgid "%q must be 1-255" msgid "%q must be 1-255"
msgstr "" msgstr ""
@ -109,7 +113,7 @@ msgid "%q must be >= 1"
msgstr "%qは1以上でなければなりません" msgstr "%qは1以上でなければなりません"
#: shared-bindings/usb_hid/Device.c #: shared-bindings/usb_hid/Device.c
msgid "%q must be None or 1-255" msgid "%q must be None or between 1 and len(report_descriptor)-1"
msgstr "" msgstr ""
#: shared-module/vectorio/Polygon.c #: shared-module/vectorio/Polygon.c

View File

@ -88,6 +88,10 @@ msgstr "%q 인덱스는 %s 가 아닌 정수 여야합니다"
msgid "%q list must be a list" msgid "%q list must be a list"
msgstr "" msgstr ""
#: shared-bindings/usb_hid/Device.c
msgid "%q must be 0-255"
msgstr ""
#: shared-bindings/usb_hid/Device.c #: shared-bindings/usb_hid/Device.c
msgid "%q must be 1-255" msgid "%q must be 1-255"
msgstr "" msgstr ""
@ -105,7 +109,7 @@ msgid "%q must be >= 1"
msgstr "%q 는 >=1이어야합니다" msgstr "%q 는 >=1이어야합니다"
#: shared-bindings/usb_hid/Device.c #: shared-bindings/usb_hid/Device.c
msgid "%q must be None or 1-255" msgid "%q must be None or between 1 and len(report_descriptor)-1"
msgstr "" msgstr ""
#: shared-module/vectorio/Polygon.c #: shared-module/vectorio/Polygon.c

View File

@ -90,6 +90,10 @@ msgstr "%q indexen moeten integers zijn, niet %s"
msgid "%q list must be a list" msgid "%q list must be a list"
msgstr "%q lijst moet een lijst zijn" msgstr "%q lijst moet een lijst zijn"
#: shared-bindings/usb_hid/Device.c
msgid "%q must be 0-255"
msgstr ""
#: shared-bindings/usb_hid/Device.c #: shared-bindings/usb_hid/Device.c
msgid "%q must be 1-255" msgid "%q must be 1-255"
msgstr "" msgstr ""
@ -107,7 +111,7 @@ msgid "%q must be >= 1"
msgstr "%q moet >= 1 zijn" msgstr "%q moet >= 1 zijn"
#: shared-bindings/usb_hid/Device.c #: shared-bindings/usb_hid/Device.c
msgid "%q must be None or 1-255" msgid "%q must be None or between 1 and len(report_descriptor)-1"
msgstr "" msgstr ""
#: shared-module/vectorio/Polygon.c #: shared-module/vectorio/Polygon.c

View File

@ -92,6 +92,10 @@ msgstr "%q indeks musi być liczbą całkowitą, a nie %s"
msgid "%q list must be a list" msgid "%q list must be a list"
msgstr "" msgstr ""
#: shared-bindings/usb_hid/Device.c
msgid "%q must be 0-255"
msgstr ""
#: shared-bindings/usb_hid/Device.c #: shared-bindings/usb_hid/Device.c
msgid "%q must be 1-255" msgid "%q must be 1-255"
msgstr "" msgstr ""
@ -109,7 +113,7 @@ msgid "%q must be >= 1"
msgstr "%q musi być >= 1" msgstr "%q musi być >= 1"
#: shared-bindings/usb_hid/Device.c #: shared-bindings/usb_hid/Device.c
msgid "%q must be None or 1-255" msgid "%q must be None or between 1 and len(report_descriptor)-1"
msgstr "" msgstr ""
#: shared-module/vectorio/Polygon.c #: shared-module/vectorio/Polygon.c

View File

@ -6,7 +6,7 @@ msgstr ""
"Project-Id-Version: PACKAGE VERSION\n" "Project-Id-Version: PACKAGE VERSION\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: 2021-05-25 17:41+0000\n" "PO-Revision-Date: 2021-05-30 13:32+0000\n"
"Last-Translator: Wellington Terumi Uemura <wellingtonuemura@gmail.com>\n" "Last-Translator: Wellington Terumi Uemura <wellingtonuemura@gmail.com>\n"
"Language-Team: \n" "Language-Team: \n"
"Language: pt_BR\n" "Language: pt_BR\n"
@ -96,6 +96,10 @@ msgstr "Os índices %q devem ser inteiros, e não %s"
msgid "%q list must be a list" msgid "%q list must be a list"
msgstr "A lista %q deve ser uma lista" msgstr "A lista %q deve ser uma lista"
#: shared-bindings/usb_hid/Device.c
msgid "%q must be 0-255"
msgstr "%q deve ser entre 0-255"
#: shared-bindings/usb_hid/Device.c #: shared-bindings/usb_hid/Device.c
msgid "%q must be 1-255" msgid "%q must be 1-255"
msgstr "%q deve ser 1-255" msgstr "%q deve ser 1-255"
@ -113,8 +117,8 @@ msgid "%q must be >= 1"
msgstr "%q deve ser >= 1" msgstr "%q deve ser >= 1"
#: shared-bindings/usb_hid/Device.c #: shared-bindings/usb_hid/Device.c
msgid "%q must be None or 1-255" msgid "%q must be None or between 1 and len(report_descriptor)-1"
msgstr "%q deve ser Nenhum ou 1-255" msgstr "%q deve ser None ou entre 1 e len(report_descriptor)-1"
#: shared-module/vectorio/Polygon.c #: shared-module/vectorio/Polygon.c
msgid "%q must be a tuple of length 2" msgid "%q must be a tuple of length 2"
@ -4458,6 +4462,9 @@ msgstr "zi deve ser de um tipo float"
msgid "zi must be of shape (n_section, 2)" msgid "zi must be of shape (n_section, 2)"
msgstr "zi deve estar na forma (n_section, 2)" msgstr "zi deve estar na forma (n_section, 2)"
#~ msgid "%q must be None or 1-255"
#~ msgstr "%q deve ser Nenhum ou 1-255"
#~ msgid "Only raw int or string supported for ip" #~ msgid "Only raw int or string supported for ip"
#~ msgstr "Apenas int ou string bruto é compatível para o ip" #~ msgstr "Apenas int ou string bruto é compatível para o ip"

View File

@ -6,7 +6,7 @@ msgstr ""
"Project-Id-Version: PACKAGE VERSION\n" "Project-Id-Version: PACKAGE VERSION\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: 2021-05-24 21:25+0000\n" "PO-Revision-Date: 2021-05-30 13:32+0000\n"
"Last-Translator: Jonny Bergdahl <jonny@bergdahl.it>\n" "Last-Translator: Jonny Bergdahl <jonny@bergdahl.it>\n"
"Language-Team: LANGUAGE <LL@li.org>\n" "Language-Team: LANGUAGE <LL@li.org>\n"
"Language: sv\n" "Language: sv\n"
@ -95,6 +95,10 @@ msgstr "Indexet %q måste vara ett heltal, inte %s"
msgid "%q list must be a list" msgid "%q list must be a list"
msgstr "%q-listan måste vara en lista" msgstr "%q-listan måste vara en lista"
#: shared-bindings/usb_hid/Device.c
msgid "%q must be 0-255"
msgstr "%q måste vara 0-255"
#: shared-bindings/usb_hid/Device.c #: shared-bindings/usb_hid/Device.c
msgid "%q must be 1-255" msgid "%q must be 1-255"
msgstr "%q måste vara 1-255" msgstr "%q måste vara 1-255"
@ -112,8 +116,8 @@ msgid "%q must be >= 1"
msgstr "%q måste vara >= 1" msgstr "%q måste vara >= 1"
#: shared-bindings/usb_hid/Device.c #: shared-bindings/usb_hid/Device.c
msgid "%q must be None or 1-255" msgid "%q must be None or between 1 and len(report_descriptor)-1"
msgstr "%q måste vara None eller 1-255" msgstr "%q måste vara None eller mellan 1 och len(report_descriptor)-1"
#: shared-module/vectorio/Polygon.c #: shared-module/vectorio/Polygon.c
msgid "%q must be a tuple of length 2" msgid "%q must be a tuple of length 2"
@ -4417,6 +4421,9 @@ msgstr "zi måste vara av typ float"
msgid "zi must be of shape (n_section, 2)" msgid "zi must be of shape (n_section, 2)"
msgstr "zi måste vara i formen (n_section, 2)" msgstr "zi måste vara i formen (n_section, 2)"
#~ msgid "%q must be None or 1-255"
#~ msgstr "%q måste vara None eller 1-255"
#~ msgid "Only raw int or string supported for ip" #~ msgid "Only raw int or string supported for ip"
#~ msgstr "Enbart int eller string stöds för ip" #~ msgstr "Enbart int eller string stöds för ip"

View File

@ -7,7 +7,7 @@ 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: 2021-05-25 17:41+0000\n" "PO-Revision-Date: 2021-06-01 13:10+0000\n"
"Last-Translator: hexthat <hexthat@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"
@ -97,6 +97,10 @@ msgstr "%q suǒyǐn bìxū shì zhěngshù, ér bùshì %s"
msgid "%q list must be a list" msgid "%q list must be a list"
msgstr "%q lièbiǎo bìxū shì lièbiǎo" msgstr "%q lièbiǎo bìxū shì lièbiǎo"
#: shared-bindings/usb_hid/Device.c
msgid "%q must be 0-255"
msgstr "%q bì xū wéi 0-255"
#: shared-bindings/usb_hid/Device.c #: shared-bindings/usb_hid/Device.c
msgid "%q must be 1-255" msgid "%q must be 1-255"
msgstr "%q bì xū wéi 1-255" msgstr "%q bì xū wéi 1-255"
@ -114,8 +118,8 @@ msgid "%q must be >= 1"
msgstr "%q bìxū dàyú huò děngyú 1" msgstr "%q bìxū dàyú huò děngyú 1"
#: shared-bindings/usb_hid/Device.c #: shared-bindings/usb_hid/Device.c
msgid "%q must be None or 1-255" msgid "%q must be None or between 1 and len(report_descriptor)-1"
msgstr "%q bì xū wéi wú huò 1-255" msgstr "%q bì xū wéi wú huò zài 1 hé len(report_descriptor)-1 zhī jiān"
#: shared-module/vectorio/Polygon.c #: shared-module/vectorio/Polygon.c
msgid "%q must be a tuple of length 2" msgid "%q must be a tuple of length 2"
@ -4414,6 +4418,9 @@ msgstr "zi bìxū wèi fú diǎn xíng"
msgid "zi must be of shape (n_section, 2)" msgid "zi must be of shape (n_section, 2)"
msgstr "zi bìxū jùyǒu xíngzhuàng (n_section,2)" msgstr "zi bìxū jùyǒu xíngzhuàng (n_section,2)"
#~ msgid "%q must be None or 1-255"
#~ msgstr "%q bì xū wéi wú huò 1-255"
#~ msgid "Only raw int supported for ip" #~ msgid "Only raw int supported for ip"
#~ msgstr "Ip jǐn zhīchí raw int" #~ msgstr "Ip jǐn zhīchí raw int"

10
mpy-cross/Makefile.m1 Normal file
View File

@ -0,0 +1,10 @@
# SPDX-FileCopyrightText: 2014 MicroPython & CircuitPython contributors (https://github.com/adafruit/circuitpython/graphs/contributors)
#
# SPDX-License-Identifier: MIT
PROG=mpy-cross-arm64
BUILD=build-arm64
include mpy-cross.mk
# Because mpy-cross.mk unconditionally overwrites CC for Darwin, we must set it BELOW the inclusion
CC := $(shell xcrun --sdk macosx11.1 --find clang) -isysroot $(shell xcrun --sdk macosx11.1 --show-sdk-path) -target arm64-apple-macos11

View File

@ -398,7 +398,8 @@ all: $(BUILD)/firmware.bin $(BUILD)/firmware.uf2
$(BUILD)/firmware.elf: $(OBJ) $(GENERATED_LD_FILE) $(BUILD)/firmware.elf: $(OBJ) $(GENERATED_LD_FILE)
$(STEPECHO) "LINK $@" $(STEPECHO) "LINK $@"
$(Q)$(CC) -o $@ $(LDFLAGS) $(OBJ) -Wl,--start-group $(LIBS) -Wl,--end-group $(Q)echo $(OBJ) > $(BUILD)/firmware.objs
$(Q)$(CC) -o $@ $(LDFLAGS) @$(BUILD)/firmware.objs -Wl,--start-group $(LIBS) -Wl,--end-group
$(Q)$(SIZE) $@ | $(PYTHON3) $(TOP)/tools/build_memory_info.py $(GENERATED_LD_FILE) $(Q)$(SIZE) $@ | $(PYTHON3) $(TOP)/tools/build_memory_info.py $(GENERATED_LD_FILE)
$(BUILD)/firmware.bin: $(BUILD)/firmware.elf $(BUILD)/firmware.bin: $(BUILD)/firmware.elf

View File

@ -26,6 +26,8 @@ STATIC const mp_rom_map_elem_t board_global_dict_table[] = {
{ MP_OBJ_NEW_QSTR(MP_QSTR_D10), MP_ROM_PTR(&pin_PA18) }, { MP_OBJ_NEW_QSTR(MP_QSTR_D10), MP_ROM_PTR(&pin_PA18) },
{ MP_OBJ_NEW_QSTR(MP_QSTR_D11), MP_ROM_PTR(&pin_PA19) }, { MP_OBJ_NEW_QSTR(MP_QSTR_D11), MP_ROM_PTR(&pin_PA19) },
{ MP_OBJ_NEW_QSTR(MP_QSTR_D12), MP_ROM_PTR(&pin_PA17) }, { MP_OBJ_NEW_QSTR(MP_QSTR_D12), MP_ROM_PTR(&pin_PA17) },
{ MP_OBJ_NEW_QSTR(MP_QSTR_LED),MP_ROM_PTR(&pin_PA16) },
{ MP_OBJ_NEW_QSTR(MP_QSTR_D13),MP_ROM_PTR(&pin_PA16) }, { MP_OBJ_NEW_QSTR(MP_QSTR_D13),MP_ROM_PTR(&pin_PA16) },
{ MP_OBJ_NEW_QSTR(MP_QSTR_SDA),MP_ROM_PTR(&pin_PB02) }, { MP_OBJ_NEW_QSTR(MP_QSTR_SDA),MP_ROM_PTR(&pin_PB02) },

View File

@ -0,0 +1,38 @@
/*
* This file is part of the MicroPython project, http://micropython.org/
*
* The MIT License (MIT)
*
* Copyright (c) 2017 Scott Shawcroft for Adafruit Industries
*
* Permission is hereby granted, free of charge, to any person obtaining a copy
* of this software and associated documentation files (the "Software"), to deal
* in the Software without restriction, including without limitation the rights
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
* copies of the Software, and to permit persons to whom the Software is
* furnished to do so, subject to the following conditions:
*
* The above copyright notice and this permission notice shall be included in
* all copies or substantial portions of the Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
* THE SOFTWARE.
*/
#include "supervisor/board.h"
#include "mpconfigboard.h"
void board_init(void) {
}
bool board_requests_safe_mode(void) {
return false;
}
void reset_board(void) {
}

View File

@ -0,0 +1,33 @@
#define MICROPY_HW_BOARD_NAME "SparkFun MicroMod SAMD51"
#define MICROPY_HW_MCU_NAME "samd51j20"
#define CIRCUITPY_MCU_FAMILY samd51
// On-board flash
#define SPI_FLASH_MOSI_PIN &pin_PA09
#define SPI_FLASH_MISO_PIN &pin_PA10
#define SPI_FLASH_SCK_PIN &pin_PA08
#define SPI_FLASH_CS_PIN &pin_PA11
// These are pins not to reset.
// SPI Data pins
#define MICROPY_PORT_A (PORT_PA08 | PORT_PA09 | PORT_PA10 | PORT_PA11)
#define MICROPY_PORT_B (0)
#define MICROPY_PORT_C (0)
#define MICROPY_PORT_D (0)
#define BOARD_HAS_CRYSTAL 1
#define DEFAULT_I2C_BUS_SCL (&pin_PA16)
#define DEFAULT_I2C_BUS_SDA (&pin_PA17)
#define DEFAULT_SPI_BUS_SCK (&pin_PA05)
#define DEFAULT_SPI_BUS_MOSI (&pin_PA04)
#define DEFAULT_SPI_BUS_MISO (&pin_PB06)
#define DEFAULT_UART_BUS_RX (&pin_PB30)
#define DEFAULT_UART_BUS_TX (&pin_PB31)
// USB is always used internally so skip the pin objects for it.
#define IGNORE_PIN_PA24 1
#define IGNORE_PIN_PA25 1

View File

@ -0,0 +1,14 @@
LD_FILE = boards/samd51x20-bootloader-external-flash.ld
USB_VID = 0x1b4f
USB_PID = 0x0020 # Used by uf2 bootloader
USB_PRODUCT = "SparkFun MicroMod SAMD51"
USB_MANUFACTURER = "SparkFun Electronics"
CHIP_VARIANT = SAMD51J20A
CHIP_FAMILY = samd51
SPI_FLASH_FILESYSTEM = 1
EXTERNAL_FLASH_DEVICES = W25Q128JVxM
LONGINT_IMPL = MPZ
CIRCUITPY_PS2IO = 1

View File

@ -0,0 +1,97 @@
#include "shared-bindings/board/__init__.h"
STATIC const mp_rom_map_elem_t board_global_dict_table[] = {
// D (digital only) pins (D0,D1)
{ MP_ROM_QSTR(MP_QSTR_D0), MP_ROM_PTR(&pin_PB04) },
{ MP_ROM_QSTR(MP_QSTR_D1), MP_ROM_PTR(&pin_PB05) },
// A (ADC) pins (A0-A4)
{ MP_ROM_QSTR(MP_QSTR_A0), MP_ROM_PTR(&pin_PA02) },
{ MP_ROM_QSTR(MP_QSTR_A1), MP_ROM_PTR(&pin_PB00) },
{ MP_ROM_QSTR(MP_QSTR_A2), MP_ROM_PTR(&pin_PB01) },
{ MP_ROM_QSTR(MP_QSTR_A3), MP_ROM_PTR(&pin_PB02) },
{ MP_ROM_QSTR(MP_QSTR_A4), MP_ROM_PTR(&pin_PB03) },
// DAC
{ MP_ROM_QSTR(MP_QSTR_DAC), MP_ROM_PTR(&pin_PA02) },
// G (General/BUS) pins (G0-G9)
{ MP_ROM_QSTR(MP_QSTR_D2), MP_ROM_PTR(&pin_PA06) },
{ MP_ROM_QSTR(MP_QSTR_G0), MP_ROM_PTR(&pin_PA06) },
{ MP_ROM_QSTR(MP_QSTR_D3), MP_ROM_PTR(&pin_PA15) },
{ MP_ROM_QSTR(MP_QSTR_G1), MP_ROM_PTR(&pin_PA06) },
{ MP_ROM_QSTR(MP_QSTR_D4), MP_ROM_PTR(&pin_PB08) },
{ MP_ROM_QSTR(MP_QSTR_G2), MP_ROM_PTR(&pin_PB08) },
{ MP_ROM_QSTR(MP_QSTR_D5), MP_ROM_PTR(&pin_PB09) },
{ MP_ROM_QSTR(MP_QSTR_G3), MP_ROM_PTR(&pin_PB09) },
{ MP_ROM_QSTR(MP_QSTR_D6), MP_ROM_PTR(&pin_PB10) },
{ MP_ROM_QSTR(MP_QSTR_G4), MP_ROM_PTR(&pin_PB10) },
{ MP_ROM_QSTR(MP_QSTR_D7), MP_ROM_PTR(&pin_PB11) },
{ MP_ROM_QSTR(MP_QSTR_G5), MP_ROM_PTR(&pin_PB11) },
{ MP_ROM_QSTR(MP_QSTR_D8), MP_ROM_PTR(&pin_PB12) },
{ MP_ROM_QSTR(MP_QSTR_G6), MP_ROM_PTR(&pin_PB12) },
{ MP_ROM_QSTR(MP_QSTR_D9), MP_ROM_PTR(&pin_PB13) },
{ MP_ROM_QSTR(MP_QSTR_G7), MP_ROM_PTR(&pin_PB13) },
{ MP_ROM_QSTR(MP_QSTR_D10), MP_ROM_PTR(&pin_PA14) },
{ MP_ROM_QSTR(MP_QSTR_G8), MP_ROM_PTR(&pin_PA14) },
{ MP_ROM_QSTR(MP_QSTR_D11), MP_ROM_PTR(&pin_PA15) },
{ MP_ROM_QSTR(MP_QSTR_G9), MP_ROM_PTR(&pin_PA15) },
{ MP_ROM_QSTR(MP_QSTR_D32), MP_ROM_PTR(&pin_PB31) },
{ MP_ROM_QSTR(MP_QSTR_D33), MP_ROM_PTR(&pin_PB30) },
{ MP_ROM_QSTR(MP_QSTR_D38), MP_ROM_PTR(&pin_PB14) },
{ MP_ROM_QSTR(MP_QSTR_G10), MP_ROM_PTR(&pin_PB14) },
{ MP_ROM_QSTR(MP_QSTR_D39), MP_ROM_PTR(&pin_PB15) },
{ MP_ROM_QSTR(MP_QSTR_G11), MP_ROM_PTR(&pin_PB15) },
// PWM pins (PWM0, PWM1)
{ MP_ROM_QSTR(MP_QSTR_PWM0), MP_ROM_PTR(&pin_PB01) },
{ MP_ROM_QSTR(MP_QSTR_PWM1), MP_ROM_PTR(&pin_PB02) },
// AUD (audio)
{ MP_ROM_QSTR(MP_QSTR_AUD_MCLK), MP_ROM_PTR(&pin_PB17) },
{ MP_ROM_QSTR(MP_QSTR_AUD_OUT), MP_ROM_PTR(&pin_PA21) },
{ MP_ROM_QSTR(MP_QSTR_AUD_IN), MP_ROM_PTR(&pin_PA22) },
{ MP_ROM_QSTR(MP_QSTR_AUD_LRCLK), MP_ROM_PTR(&pin_PA20) },
{ MP_ROM_QSTR(MP_QSTR_AUD_BCLK), MP_ROM_PTR(&pin_PB16) },
// I2C
{ MP_ROM_QSTR(MP_QSTR_SDA), MP_ROM_PTR(&pin_PA17) },
{ MP_ROM_QSTR(MP_QSTR_SDA1), MP_ROM_PTR(&pin_PA17) },
{ MP_ROM_QSTR(MP_QSTR_SCL), MP_ROM_PTR(&pin_PA16) },
{ MP_ROM_QSTR(MP_QSTR_SCL1), MP_ROM_PTR(&pin_PA16) },
{ MP_ROM_QSTR(MP_QSTR_I2C_INT), MP_ROM_PTR(&pin_PA18) },
// I2C2
{ MP_ROM_QSTR(MP_QSTR_SDA2), MP_ROM_PTR(&pin_PA13) },
{ MP_ROM_QSTR(MP_QSTR_SCL2), MP_ROM_PTR(&pin_PA12) },
// SPI
{ MP_ROM_QSTR(MP_QSTR_CIPO), MP_ROM_PTR(&pin_PA06) },
{ MP_ROM_QSTR(MP_QSTR_MISO), MP_ROM_PTR(&pin_PA06) },
{ MP_ROM_QSTR(MP_QSTR_COPI), MP_ROM_PTR(&pin_PA04) },
{ MP_ROM_QSTR(MP_QSTR_MOSI), MP_ROM_PTR(&pin_PA04) },
{ MP_ROM_QSTR(MP_QSTR_SCK), MP_ROM_PTR(&pin_PA05) },
{ MP_ROM_QSTR(MP_QSTR_CS), MP_ROM_PTR(&pin_PA07) },
// Status LED
{ MP_ROM_QSTR(MP_QSTR_LED), MP_ROM_PTR(&pin_PA23) },
// UART
{ MP_ROM_QSTR(MP_QSTR_RX), MP_ROM_PTR(&pin_PB30) },
{ MP_ROM_QSTR(MP_QSTR_RX1), MP_ROM_PTR(&pin_PB30) },
{ MP_ROM_QSTR(MP_QSTR_TX), MP_ROM_PTR(&pin_PB31) },
{ MP_ROM_QSTR(MP_QSTR_TX1), MP_ROM_PTR(&pin_PB31) },
// UART2
{ MP_ROM_QSTR(MP_QSTR_RX2), MP_ROM_PTR(&pin_PA13) },
{ MP_ROM_QSTR(MP_QSTR_TX2), MP_ROM_PTR(&pin_PA12) },
// Board objects
{ MP_ROM_QSTR(MP_QSTR_I2C), MP_ROM_PTR(&board_i2c_obj) },
{ MP_ROM_QSTR(MP_QSTR_SPI), MP_ROM_PTR(&board_spi_obj) },
{ MP_ROM_QSTR(MP_QSTR_UART), MP_ROM_PTR(&board_uart_obj) },
};
MP_DEFINE_CONST_DICT(board_module_globals, board_global_dict_table);

View File

@ -45,6 +45,8 @@
#include "samd/sercom.h" #include "samd/sercom.h"
#include "common-hal/busio/SPI.h" // for never_reset_sercom
#define UART_DEBUG(...) (void)0 #define UART_DEBUG(...) (void)0
// #define UART_DEBUG(...) mp_printf(&mp_plat_print __VA_OPT__(,) __VA_ARGS__) // #define UART_DEBUG(...) mp_printf(&mp_plat_print __VA_OPT__(,) __VA_ARGS__)
@ -152,17 +154,22 @@ void common_hal_busio_uart_construct(busio_uart_obj_t *self,
if (rx && receiver_buffer_size > 0) { if (rx && receiver_buffer_size > 0) {
self->buffer_length = receiver_buffer_size; self->buffer_length = receiver_buffer_size;
if (NULL != receiver_buffer) {
self->buffer = receiver_buffer;
} else {
// Initially allocate the UART's buffer in the long-lived part of the // Initially allocate the UART's buffer in the long-lived part of the
// heap. UARTs are generally long-lived objects, but the "make long- // heap. UARTs are generally long-lived objects, but the "make long-
// lived" machinery is incapable of moving internal pointers like // lived" machinery is incapable of moving internal pointers like
// self->buffer, so do it manually. (However, as long as internal // self->buffer, so do it manually. (However, as long as internal
// pointers like this are NOT moved, allocating the buffer // pointers like this are NOT moved, allocating the buffer
// in the long-lived pool is not strictly necessary) // in the long-lived pool is not strictly necessary)
self->buffer = (uint8_t *)gc_alloc(self->buffer_length * sizeof(uint8_t), false, true); self->buffer = (uint8_t *)gc_alloc(self->buffer_length * sizeof(uint8_t), false, true);
if (self->buffer == NULL) { if (self->buffer == NULL) {
common_hal_busio_uart_deinit(self); common_hal_busio_uart_deinit(self);
mp_raise_msg_varg(&mp_type_MemoryError, translate("Failed to allocate RX buffer of %d bytes"), self->buffer_length * sizeof(uint8_t)); mp_raise_msg_varg(&mp_type_MemoryError, translate("Failed to allocate RX buffer of %d bytes"), self->buffer_length * sizeof(uint8_t));
} }
}
} else { } else {
self->buffer_length = 0; self->buffer_length = 0;
self->buffer = NULL; self->buffer = NULL;
@ -246,6 +253,21 @@ void common_hal_busio_uart_construct(busio_uart_obj_t *self,
usart_async_enable(usart_desc_p); usart_async_enable(usart_desc_p);
} }
void common_hal_busio_uart_never_reset(busio_uart_obj_t *self) {
for (size_t i = 0; i < MP_ARRAY_SIZE(sercom_insts); i++) {
const Sercom *sercom = sercom_insts[i];
Sercom *hw = (Sercom *)(self->usart_desc.device.hw);
// Reserve pins for active UART only
if (sercom == hw) {
never_reset_sercom(hw);
never_reset_pin_number(self->rx_pin);
never_reset_pin_number(self->tx_pin);
}
}
return;
}
bool common_hal_busio_uart_deinited(busio_uart_obj_t *self) { bool common_hal_busio_uart_deinited(busio_uart_obj_t *self) {
return self->rx_pin == NO_PIN && self->tx_pin == NO_PIN; return self->rx_pin == NO_PIN && self->tx_pin == NO_PIN;
} }

View File

@ -222,6 +222,8 @@ OBJ += $(addprefix $(BUILD)/, $(SRC_MOD:.c=.o))
$(BUILD)/$(FATFS_DIR)/ff.o: COPT += -Os $(BUILD)/$(FATFS_DIR)/ff.o: COPT += -Os
$(filter $(PY_BUILD)/../extmod/vfs_fat_%.o, $(PY_O)): COPT += -Os $(filter $(PY_BUILD)/../extmod/vfs_fat_%.o, $(PY_O)): COPT += -Os
$(BUILD)/lib/protomatter/src/core.o: CFLAGS += -DESP32
# List of sources for qstr extraction # List of sources for qstr extraction
SRC_QSTR += $(SRC_C) $(SRC_SUPERVISOR) $(SRC_MOD) $(SRC_COMMON_HAL_EXPANDED) $(SRC_SHARED_MODULE_EXPANDED) SRC_QSTR += $(SRC_C) $(SRC_SUPERVISOR) $(SRC_MOD) $(SRC_COMMON_HAL_EXPANDED) $(SRC_SHARED_MODULE_EXPANDED)
# Sources that only hold QSTRs after pre-processing. # Sources that only hold QSTRs after pre-processing.

View File

@ -26,7 +26,7 @@
// Micropython setup // Micropython setup
#define MICROPY_HW_BOARD_NAME "nanoESP32-S2" #define MICROPY_HW_BOARD_NAME "nanoESP32-S2 w/Wroom"
#define MICROPY_HW_MCU_NAME "ESP32S2" #define MICROPY_HW_MCU_NAME "ESP32S2"
#define MICROPY_HW_NEOPIXEL (&pin_GPIO18) #define MICROPY_HW_NEOPIXEL (&pin_GPIO18)

View File

@ -1,6 +1,6 @@
USB_VID = 0x239A USB_VID = 0x239A
USB_PID = 0x80DE USB_PID = 0x80DE
USB_PRODUCT = "nanoESP32-S2" USB_PRODUCT = "nanoESP32-S2 w/Wroom"
USB_MANUFACTURER = "Muselab" USB_MANUFACTURER = "Muselab"
INTERNAL_FLASH_FILESYSTEM = 1 INTERNAL_FLASH_FILESYSTEM = 1

View File

@ -0,0 +1,52 @@
/*
* This file is part of the MicroPython project, http://micropython.org/
*
* The MIT License (MIT)
*
* Copyright (c) 2020 Scott Shawcroft for Adafruit Industries
*
* Permission is hereby granted, free of charge, to any person obtaining a copy
* of this software and associated documentation files (the "Software"), to deal
* in the Software without restriction, including without limitation the rights
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
* copies of the Software, and to permit persons to whom the Software is
* furnished to do so, subject to the following conditions:
*
* The above copyright notice and this permission notice shall be included in
* all copies or substantial portions of the Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
* THE SOFTWARE.
*/
#include "supervisor/board.h"
#include "mpconfigboard.h"
#include "shared-bindings/microcontroller/Pin.h"
void board_init(void) {
// USB
common_hal_never_reset_pin(&pin_GPIO19);
common_hal_never_reset_pin(&pin_GPIO20);
// Debug UART
#ifdef DEBUG
common_hal_never_reset_pin(&pin_GPIO43);
common_hal_never_reset_pin(&pin_GPIO44);
#endif /* DEBUG */
}
bool board_requests_safe_mode(void) {
return false;
}
void reset_board(void) {
}
void board_deinit(void) {
}

View File

@ -0,0 +1,38 @@
/*
* This file is part of the MicroPython project, http://micropython.org/
*
* The MIT License (MIT)
*
* Copyright (c) 2019 Scott Shawcroft for Adafruit Industries
*
* Permission is hereby granted, free of charge, to any person obtaining a copy
* of this software and associated documentation files (the "Software"), to deal
* in the Software without restriction, including without limitation the rights
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
* copies of the Software, and to permit persons to whom the Software is
* furnished to do so, subject to the following conditions:
*
* The above copyright notice and this permission notice shall be included in
* all copies or substantial portions of the Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
* THE SOFTWARE.
*/
// Micropython setup
#define MICROPY_HW_BOARD_NAME "nanoESP32-S2 w/Wrover"
#define MICROPY_HW_MCU_NAME "ESP32S2"
#define MICROPY_HW_NEOPIXEL (&pin_GPIO18)
#define CIRCUITPY_BOOT_BUTTON (&pin_GPIO0)
#define BOARD_USER_SAFE_MODE_ACTION translate("pressing boot button at start up.\n")
#define AUTORESET_DELAY_MS 500

View File

@ -0,0 +1,17 @@
USB_VID = 0x303A
USB_PID = 0x80B2
USB_PRODUCT = "nanoESP32-S2 w/Wrover"
USB_MANUFACTURER = "Muselab"
INTERNAL_FLASH_FILESYSTEM = 1
LONGINT_IMPL = MPZ
# The default queue depth of 16 overflows on release builds,
# so increase it to 32.
CFLAGS += -DCFG_TUD_TASK_QUEUE_SZ=32
CIRCUITPY_ESP_FLASH_MODE=dio
CIRCUITPY_ESP_FLASH_FREQ=40m
CIRCUITPY_ESP_FLASH_SIZE=4MB
CIRCUITPY_MODULE=wrover

View File

@ -0,0 +1,48 @@
#include "shared-bindings/board/__init__.h"
STATIC const mp_rom_map_elem_t board_global_dict_table[] = {
{ MP_ROM_QSTR(MP_QSTR_IO0), MP_ROM_PTR(&pin_GPIO0) },
{ MP_ROM_QSTR(MP_QSTR_IO1), MP_ROM_PTR(&pin_GPIO1) },
{ MP_ROM_QSTR(MP_QSTR_IO2), MP_ROM_PTR(&pin_GPIO2) },
{ MP_ROM_QSTR(MP_QSTR_IO3), MP_ROM_PTR(&pin_GPIO3) },
{ MP_ROM_QSTR(MP_QSTR_IO4), MP_ROM_PTR(&pin_GPIO4) },
{ MP_ROM_QSTR(MP_QSTR_IO5), MP_ROM_PTR(&pin_GPIO5) },
{ MP_ROM_QSTR(MP_QSTR_IO6), MP_ROM_PTR(&pin_GPIO6) },
{ MP_ROM_QSTR(MP_QSTR_IO7), MP_ROM_PTR(&pin_GPIO7) },
{ MP_ROM_QSTR(MP_QSTR_IO8), MP_ROM_PTR(&pin_GPIO8) },
{ MP_ROM_QSTR(MP_QSTR_IO9), MP_ROM_PTR(&pin_GPIO9) },
{ MP_ROM_QSTR(MP_QSTR_IO10), MP_ROM_PTR(&pin_GPIO10) },
{ MP_ROM_QSTR(MP_QSTR_IO11), MP_ROM_PTR(&pin_GPIO11) },
{ MP_ROM_QSTR(MP_QSTR_IO12), MP_ROM_PTR(&pin_GPIO12) },
{ MP_ROM_QSTR(MP_QSTR_IO13), MP_ROM_PTR(&pin_GPIO13) },
{ MP_ROM_QSTR(MP_QSTR_IO14), MP_ROM_PTR(&pin_GPIO14) },
{ MP_ROM_QSTR(MP_QSTR_IO15), MP_ROM_PTR(&pin_GPIO15) },
{ MP_ROM_QSTR(MP_QSTR_IO16), MP_ROM_PTR(&pin_GPIO16) },
{ MP_ROM_QSTR(MP_QSTR_IO17), MP_ROM_PTR(&pin_GPIO17) },
{ MP_ROM_QSTR(MP_QSTR_IO18), MP_ROM_PTR(&pin_GPIO18) },
{ MP_ROM_QSTR(MP_QSTR_IO19), MP_ROM_PTR(&pin_GPIO19) },
{ MP_ROM_QSTR(MP_QSTR_IO20), MP_ROM_PTR(&pin_GPIO20) },
{ MP_ROM_QSTR(MP_QSTR_IO21), MP_ROM_PTR(&pin_GPIO21) },
{ MP_ROM_QSTR(MP_QSTR_IO26), MP_ROM_PTR(&pin_GPIO26) },
{ MP_ROM_QSTR(MP_QSTR_IO33), MP_ROM_PTR(&pin_GPIO33) },
{ MP_ROM_QSTR(MP_QSTR_IO34), MP_ROM_PTR(&pin_GPIO34) },
{ MP_ROM_QSTR(MP_QSTR_IO35), MP_ROM_PTR(&pin_GPIO35) },
{ MP_ROM_QSTR(MP_QSTR_IO36), MP_ROM_PTR(&pin_GPIO36) },
{ MP_ROM_QSTR(MP_QSTR_IO37), MP_ROM_PTR(&pin_GPIO37) },
{ MP_ROM_QSTR(MP_QSTR_IO38), MP_ROM_PTR(&pin_GPIO38) },
{ MP_ROM_QSTR(MP_QSTR_IO39), MP_ROM_PTR(&pin_GPIO39) },
{ MP_ROM_QSTR(MP_QSTR_IO40), MP_ROM_PTR(&pin_GPIO40) },
{ MP_ROM_QSTR(MP_QSTR_IO41), MP_ROM_PTR(&pin_GPIO41) },
{ MP_ROM_QSTR(MP_QSTR_IO42), MP_ROM_PTR(&pin_GPIO42) },
{ MP_ROM_QSTR(MP_QSTR_TX), MP_ROM_PTR(&pin_GPIO43) },
{ MP_ROM_QSTR(MP_QSTR_IO43), MP_ROM_PTR(&pin_GPIO43) },
{ MP_ROM_QSTR(MP_QSTR_RX), MP_ROM_PTR(&pin_GPIO44) },
{ MP_ROM_QSTR(MP_QSTR_IO44), MP_ROM_PTR(&pin_GPIO44) },
{ MP_ROM_QSTR(MP_QSTR_IO45), MP_ROM_PTR(&pin_GPIO45) },
{ MP_ROM_QSTR(MP_QSTR_IO46), MP_ROM_PTR(&pin_GPIO46) },
{ MP_ROM_QSTR(MP_QSTR_NEOPIXEL), MP_ROM_PTR(&pin_GPIO18) },
};
MP_DEFINE_CONST_DICT(board_module_globals, board_global_dict_table);

View File

@ -51,7 +51,7 @@ STATIC void floating_gpio_reset(gpio_num_t pin_number) {
} }
void never_reset_pin_number(gpio_num_t pin_number) { void never_reset_pin_number(gpio_num_t pin_number) {
if (pin_number == -1) { if (pin_number == NO_PIN) {
return; return;
} }
never_reset_pins[pin_number / 32] |= 1 << pin_number % 32; never_reset_pins[pin_number / 32] |= 1 << pin_number % 32;
@ -63,7 +63,7 @@ void common_hal_never_reset_pin(const mcu_pin_obj_t *pin) {
// Mark pin as free and return it to a quiescent state. // Mark pin as free and return it to a quiescent state.
void reset_pin_number(gpio_num_t pin_number) { void reset_pin_number(gpio_num_t pin_number) {
if (pin_number == -1) { if (pin_number == NO_PIN) {
return; return;
} }
never_reset_pins[pin_number / 32] &= ~(1 << pin_number % 32); never_reset_pins[pin_number / 32] &= ~(1 << pin_number % 32);
@ -72,6 +72,10 @@ void reset_pin_number(gpio_num_t pin_number) {
floating_gpio_reset(pin_number); floating_gpio_reset(pin_number);
} }
void common_hal_mcu_pin_reset_number(uint8_t i) {
reset_pin_number((gpio_num_t)i);
}
void common_hal_reset_pin(const mcu_pin_obj_t *pin) { void common_hal_reset_pin(const mcu_pin_obj_t *pin) {
if (pin == NULL) { if (pin == NULL) {
return; return;
@ -109,3 +113,7 @@ bool pin_number_is_free(gpio_num_t pin_number) {
bool common_hal_mcu_pin_is_free(const mcu_pin_obj_t *pin) { bool common_hal_mcu_pin_is_free(const mcu_pin_obj_t *pin) {
return pin_number_is_free(pin->number); return pin_number_is_free(pin->number);
} }
uint8_t common_hal_mcu_pin_number(const mcu_pin_obj_t *pin) {
return pin ? pin->number : NO_PIN;
}

View File

@ -0,0 +1,75 @@
/*
* This file is part of the Micro Python project, http://micropython.org/
*
* The MIT License (MIT)
*
* Copyright (c) 2021 Jeff Epler for Adafruit Industries
*
* Permission is hereby granted, free of charge, to any person obtaining a copy
* of this software and associated documentation files (the "Software"), to deal
* in the Software without restriction, including without limitation the rights
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
* copies of the Software, and to permit persons to whom the Software is
* furnished to do so, subject to the following conditions:
*
* The above copyright notice and this permission notice shall be included in
* all copies or substantial portions of the Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
* THE SOFTWARE.
*/
#include <stddef.h>
#include "common-hal/rgbmatrix/RGBMatrix.h"
#include "peripherals/timer.h"
void *common_hal_rgbmatrix_timer_allocate(rgbmatrix_rgbmatrix_obj_t *self) {
const timer_config_t config = {
.alarm_en = false,
.counter_en = false,
.intr_type = TIMER_INTR_LEVEL,
.counter_dir = TIMER_COUNT_UP,
.auto_reload = true,
.divider = 2 // 40MHz
};
timer_index_t *timer = malloc(sizeof(timer_index_t));
bool res = peripherals_timer_init(&config, timer);
if (!res) {
return NULL;
}
peripherals_timer_never_reset(timer);
return timer;
}
extern bool _PM_esp32timerCallback(void *arg);
void common_hal_rgbmatrix_timer_enable(void *ptr) {
}
void common_hal_rgbmatrix_timer_disable(void *ptr) {
timer_index_t *timer = (timer_index_t *)ptr;
if (timer->idx == TIMER_MAX) {
return;
}
timer_pause(timer->group, timer->idx);
timer_disable_intr(timer->group, timer->idx);
timer_isr_callback_remove(timer->group, timer->idx);
}
void common_hal_rgbmatrix_timer_free(void *ptr) {
timer_index_t *timer = (timer_index_t *)ptr;
if (timer->idx == TIMER_MAX) {
return;
}
common_hal_rgbmatrix_timer_disable(ptr);
peripherals_timer_deinit(timer);
timer->idx = TIMER_MAX;
}

View File

@ -0,0 +1,37 @@
/*
* This file is part of the Micro Python project, http://micropython.org/
*
* The MIT License (MIT)
*
* Copyright (c) 2020 Jeff Epler for Adafruit Industries
*
* Permission is hereby granted, free of charge, to any person obtaining a copy
* of this software and associated documentation files (the "Software"), to deal
* in the Software without restriction, including without limitation the rights
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
* copies of the Software, and to permit persons to whom the Software is
* furnished to do so, subject to the following conditions:
*
* The above copyright notice and this permission notice shall be included in
* all copies or substantial portions of the Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
* THE SOFTWARE.
*/
#ifndef MICROPY_INCLUDED_ATMEL_SAMD_COMMON_HAL_RGBMATRIX_RGBMATRIX_H
#define MICROPY_INCLUDED_ATMEL_SAMD_COMMON_HAL_RGBMATRIX_RGBMATRIX_H
#include "shared-module/rgbmatrix/RGBMatrix.h"
void *common_hal_rgbmatrix_timer_allocate(rgbmatrix_rgbmatrix_obj_t *self);
void common_hal_rgbmatrix_timer_enable(void *);
void common_hal_rgbmatrix_timer_disable(void *);
void common_hal_rgbmatrix_timer_free(void *);
#endif

View File

@ -21,8 +21,10 @@ CIRCUITPY_AUDIOIO = 0
CIRCUITPY_CANIO = 1 CIRCUITPY_CANIO = 1
CIRCUITPY_COUNTIO = 1 CIRCUITPY_COUNTIO = 1
CIRCUITPY_DUALBANK = 1 CIRCUITPY_DUALBANK = 1
CIRCUITPY_FRAMEBUFFERIO = 1
CIRCUITPY_FREQUENCYIO = 1 CIRCUITPY_FREQUENCYIO = 1
CIRCUITPY_I2CPERIPHERAL = 0 CIRCUITPY_I2CPERIPHERAL = 0
CIRCUITPY_RGBMATRIX = 1
CIRCUITPY_ROTARYIO = 1 CIRCUITPY_ROTARYIO = 1
CIRCUITPY_NVM = 1 CIRCUITPY_NVM = 1
CIRCUITPY_PS2IO ?= 1 CIRCUITPY_PS2IO ?= 1

View File

@ -91,4 +91,6 @@ extern const mcu_pin_obj_t pin_GPIO44;
extern const mcu_pin_obj_t pin_GPIO45; extern const mcu_pin_obj_t pin_GPIO45;
extern const mcu_pin_obj_t pin_GPIO46; extern const mcu_pin_obj_t pin_GPIO46;
#define NO_PIN (GPIO_NUM_NC)
#endif // MICROPY_INCLUDED_ESP32S2_PERIPHERALS_PINS_H #endif // MICROPY_INCLUDED_ESP32S2_PERIPHERALS_PINS_H

View File

@ -26,6 +26,7 @@
#include "peripherals/timer.h" #include "peripherals/timer.h"
#define TIMER_NEVER_RESET 2
#define TIMER_FREE 1 #define TIMER_FREE 1
#define TIMER_BUSY 0 #define TIMER_BUSY 0
@ -45,7 +46,7 @@ void peripherals_timer_reset(void) {
} }
} }
void peripherals_timer_init(const timer_config_t *config, timer_index_t *timer) { bool peripherals_timer_init(const timer_config_t *config, timer_index_t *timer) {
bool break_loop = false; bool break_loop = false;
// get free timer // get free timer
@ -60,7 +61,7 @@ void peripherals_timer_init(const timer_config_t *config, timer_index_t *timer)
} else if (i == 1 && j == 1) { } else if (i == 1 && j == 1) {
timer->idx = TIMER_MAX; timer->idx = TIMER_MAX;
timer->group = TIMER_GROUP_MAX; timer->group = TIMER_GROUP_MAX;
return; return false;
} }
} }
if (break_loop) { if (break_loop) {
@ -68,11 +69,30 @@ void peripherals_timer_init(const timer_config_t *config, timer_index_t *timer)
} }
} }
timer->hw = (timer->group == 0) ? &TIMERG0 : &TIMERG1;
// initialize timer module // initialize timer module
timer_init(timer->group, timer->idx, config); timer_init(timer->group, timer->idx, config);
timer_set_counter_value(timer->group, timer->idx, 0); timer_set_counter_value(timer->group, timer->idx, 0);
return true;
} }
void peripherals_timer_deinit(timer_index_t *timer) { void peripherals_timer_deinit(timer_index_t *timer) {
if (timer->group == TIMER_GROUP_MAX || timer->idx == TIMER_MAX) {
return;
}
timer_deinit(timer->group, timer->idx); timer_deinit(timer->group, timer->idx);
int i = timer->group;
int j = timer->idx;
timer->group = TIMER_GROUP_MAX;
timer->idx = TIMER_MAX;
timer_state[i][j] = TIMER_FREE;
}
void peripherals_timer_never_reset(timer_index_t *timer) {
timer_deinit(timer->group, timer->idx);
int i = timer->group;
int j = timer->idx;
timer_state[i][j] = TIMER_NEVER_RESET;
} }

View File

@ -30,12 +30,14 @@
#include "driver/timer.h" #include "driver/timer.h"
typedef struct { typedef struct {
timg_dev_t *hw;
timer_idx_t idx; timer_idx_t idx;
timer_group_t group; timer_group_t group;
} timer_index_t; } timer_index_t;
extern void peripherals_timer_init(const timer_config_t *config, timer_index_t *timer); extern bool peripherals_timer_init(const timer_config_t *config, timer_index_t *timer);
extern void peripherals_timer_deinit(timer_index_t *timer); extern void peripherals_timer_deinit(timer_index_t *timer);
extern void peripherals_timer_reset(void); extern void peripherals_timer_reset(void);
extern void peripherals_timer_never_reset(timer_index_t *timer);
#endif // MICROPY_INCLUDED_ESP32S2_PERIPHERALS_TIMER_HANDLER_H #endif // MICROPY_INCLUDED_ESP32S2_PERIPHERALS_TIMER_HANDLER_H

View File

@ -252,7 +252,8 @@ all: $(BUILD)/firmware.bin $(BUILD)/firmware.uf2
$(BUILD)/firmware.elf: $(OBJ) $(GENERATED_LD_FILE) $(BUILD)/firmware.elf: $(OBJ) $(GENERATED_LD_FILE)
$(STEPECHO) "LINK $@" $(STEPECHO) "LINK $@"
$(Q)$(CC) -o $@ $(LDFLAGS) $(OBJ) -Wl,--start-group $(LIBS) -Wl,--end-group $(Q)echo $(OBJ) > $(BUILD)/firmware.objs
$(Q)$(CC) -o $@ $(LDFLAGS) @$(BUILD)/firmware.objs -Wl,--start-group $(LIBS) -Wl,--end-group
$(Q)$(SIZE) $@ | $(PYTHON3) $(TOP)/tools/build_memory_info.py $(GENERATED_LD_FILE) $(Q)$(SIZE) $@ | $(PYTHON3) $(TOP)/tools/build_memory_info.py $(GENERATED_LD_FILE)
$(BUILD)/firmware.bin: $(BUILD)/firmware.elf $(BUILD)/firmware.bin: $(BUILD)/firmware.elf

View File

@ -352,6 +352,8 @@ bool audio_dma_get_paused(audio_dma_t *dma) {
void audio_dma_init(audio_dma_t *dma) { void audio_dma_init(audio_dma_t *dma) {
dma->first_buffer = NULL; dma->first_buffer = NULL;
dma->second_buffer = NULL; dma->second_buffer = NULL;
dma->channel[0] = NUM_DMA_CHANNELS;
dma->channel[1] = NUM_DMA_CHANNELS;
} }
void audio_dma_deinit(audio_dma_t *dma) { void audio_dma_deinit(audio_dma_t *dma) {
@ -368,7 +370,6 @@ bool audio_dma_get_playing(audio_dma_t *dma) {
} }
if (!dma_channel_is_busy(dma->channel[0]) && if (!dma_channel_is_busy(dma->channel[0]) &&
!dma_channel_is_busy(dma->channel[1])) { !dma_channel_is_busy(dma->channel[1])) {
audio_dma_stop(dma);
return false; return false;
} }

View File

@ -0,0 +1,37 @@
/*
* This file is part of the MicroPython project, http://micropython.org/
*
* The MIT License (MIT)
*
* Copyright (c) 2021 Wai Weng for Cytron Technologies
*
* Permission is hereby granted, free of charge, to any person obtaining a copy
* of this software and associated documentation files (the "Software"), to deal
* in the Software without restriction, including without limitation the rights
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
* copies of the Software, and to permit persons to whom the Software is
* furnished to do so, subject to the following conditions:
*
* The above copyright notice and this permission notice shall be included in
* all copies or substantial portions of the Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
* THE SOFTWARE.
*/
#include "supervisor/board.h"
void board_init(void) {
}
bool board_requests_safe_mode(void) {
return false;
}
void reset_board(void) {
}

View File

@ -0,0 +1,2 @@
#define MICROPY_HW_BOARD_NAME "Cytron Maker Pi RP2040"
#define MICROPY_HW_MCU_NAME "rp2040"

View File

@ -0,0 +1,16 @@
USB_VID = 0x2E8A
USB_PID = 0x1000
USB_PRODUCT = "Maker Pi RP2040"
USB_MANUFACTURER = "Cytron"
CHIP_VARIANT = RP2040
CHIP_FAMILY = rp2
EXTERNAL_FLASH_DEVICES = "W25Q16JVxQ"
CIRCUITPY__EVE = 1
# Include these Python libraries in firmware.
FROZEN_MPY_DIRS += $(TOP)/frozen/Adafruit_CircuitPython_NeoPixel
FROZEN_MPY_DIRS += $(TOP)/frozen/Adafruit_CircuitPython_Motor
FROZEN_MPY_DIRS += $(TOP)/frozen/Adafruit_CircuitPython_SimpleIO

View File

@ -0,0 +1,59 @@
#include "shared-bindings/board/__init__.h"
STATIC const mp_rom_map_elem_t board_global_dict_table[] = {
{ MP_ROM_QSTR(MP_QSTR_GP0), MP_ROM_PTR(&pin_GPIO0) },
{ MP_ROM_QSTR(MP_QSTR_GP1), MP_ROM_PTR(&pin_GPIO1) },
{ MP_ROM_QSTR(MP_QSTR_GP2), MP_ROM_PTR(&pin_GPIO2) },
{ MP_ROM_QSTR(MP_QSTR_GP3), MP_ROM_PTR(&pin_GPIO3) },
{ MP_ROM_QSTR(MP_QSTR_GP4), MP_ROM_PTR(&pin_GPIO4) },
{ MP_ROM_QSTR(MP_QSTR_GP5), MP_ROM_PTR(&pin_GPIO5) },
{ MP_ROM_QSTR(MP_QSTR_GP6), MP_ROM_PTR(&pin_GPIO6) },
{ MP_ROM_QSTR(MP_QSTR_GP7), MP_ROM_PTR(&pin_GPIO7) },
{ MP_ROM_QSTR(MP_QSTR_M1A), MP_ROM_PTR(&pin_GPIO8) },
{ MP_ROM_QSTR(MP_QSTR_GP8), MP_ROM_PTR(&pin_GPIO8) },
{ MP_ROM_QSTR(MP_QSTR_M1B), MP_ROM_PTR(&pin_GPIO9) },
{ MP_ROM_QSTR(MP_QSTR_GP9), MP_ROM_PTR(&pin_GPIO9) },
{ MP_ROM_QSTR(MP_QSTR_M2A), MP_ROM_PTR(&pin_GPIO10) },
{ MP_ROM_QSTR(MP_QSTR_GP10), MP_ROM_PTR(&pin_GPIO10) },
{ MP_ROM_QSTR(MP_QSTR_M2B), MP_ROM_PTR(&pin_GPIO11) },
{ MP_ROM_QSTR(MP_QSTR_GP11), MP_ROM_PTR(&pin_GPIO11) },
{ MP_ROM_QSTR(MP_QSTR_GP12), MP_ROM_PTR(&pin_GPIO12) },
{ MP_ROM_QSTR(MP_QSTR_GP13), MP_ROM_PTR(&pin_GPIO13) },
{ MP_ROM_QSTR(MP_QSTR_GP14), MP_ROM_PTR(&pin_GPIO14) },
{ MP_ROM_QSTR(MP_QSTR_GP15), MP_ROM_PTR(&pin_GPIO15) },
{ MP_ROM_QSTR(MP_QSTR_GP16), MP_ROM_PTR(&pin_GPIO16) },
{ MP_ROM_QSTR(MP_QSTR_GP17), MP_ROM_PTR(&pin_GPIO17) },
{ MP_ROM_QSTR(MP_QSTR_RGB), MP_ROM_PTR(&pin_GPIO18) },
{ MP_ROM_QSTR(MP_QSTR_NEOPIXEL), MP_ROM_PTR(&pin_GPIO18) },
{ MP_ROM_QSTR(MP_QSTR_GP18), MP_ROM_PTR(&pin_GPIO18) },
{ MP_ROM_QSTR(MP_QSTR_GP19), MP_ROM_PTR(&pin_GPIO19) },
{ MP_ROM_QSTR(MP_QSTR_GP20), MP_ROM_PTR(&pin_GPIO20) },
{ MP_ROM_QSTR(MP_QSTR_GP21), MP_ROM_PTR(&pin_GPIO21) },
{ MP_ROM_QSTR(MP_QSTR_BUZZER), MP_ROM_PTR(&pin_GPIO22) },
{ MP_ROM_QSTR(MP_QSTR_GP22), MP_ROM_PTR(&pin_GPIO22) },
{ MP_ROM_QSTR(MP_QSTR_GP26_A0), MP_ROM_PTR(&pin_GPIO26) },
{ MP_ROM_QSTR(MP_QSTR_GP26), MP_ROM_PTR(&pin_GPIO26) },
{ MP_ROM_QSTR(MP_QSTR_A0), MP_ROM_PTR(&pin_GPIO26) },
{ MP_ROM_QSTR(MP_QSTR_GP27_A1), MP_ROM_PTR(&pin_GPIO27) },
{ MP_ROM_QSTR(MP_QSTR_GP27), MP_ROM_PTR(&pin_GPIO27) },
{ MP_ROM_QSTR(MP_QSTR_A1), MP_ROM_PTR(&pin_GPIO27) },
{ MP_ROM_QSTR(MP_QSTR_GP28_A2), MP_ROM_PTR(&pin_GPIO28) },
{ MP_ROM_QSTR(MP_QSTR_GP28), MP_ROM_PTR(&pin_GPIO28) },
{ MP_ROM_QSTR(MP_QSTR_A2), MP_ROM_PTR(&pin_GPIO28) },
{ MP_ROM_QSTR(MP_QSTR_A3), MP_ROM_PTR(&pin_GPIO29) },
{ MP_ROM_QSTR(MP_QSTR_VBATT), MP_ROM_PTR(&pin_GPIO29) },
{ MP_ROM_QSTR(MP_QSTR_VOLTAGE_MONITOR), MP_ROM_PTR(&pin_GPIO29) },
};
MP_DEFINE_CONST_DICT(board_module_globals, board_global_dict_table);

View File

@ -0,0 +1,37 @@
/*
* This file is part of the MicroPython project, http://micropython.org/
*
* The MIT License (MIT)
*
* Copyright (c) 2021 Scott Shawcroft for Adafruit Industries
*
* Permission is hereby granted, free of charge, to any person obtaining a copy
* of this software and associated documentation files (the "Software"), to deal
* in the Software without restriction, including without limitation the rights
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
* copies of the Software, and to permit persons to whom the Software is
* furnished to do so, subject to the following conditions:
*
* The above copyright notice and this permission notice shall be included in
* all copies or substantial portions of the Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
* THE SOFTWARE.
*/
#include "supervisor/board.h"
void board_init(void) {
}
bool board_requests_safe_mode(void) {
return false;
}
void reset_board(void) {
}

View File

@ -0,0 +1,2 @@
#define MICROPY_HW_BOARD_NAME "Pimoroni PGA2040"
#define MICROPY_HW_MCU_NAME "rp2040"

View File

@ -0,0 +1,11 @@
USB_VID = 0x2E8A
USB_PID = 0x1008
USB_PRODUCT = "PGA2040"
USB_MANUFACTURER = "Pimoroni"
CHIP_VARIANT = RP2040
CHIP_FAMILY = rp2
EXTERNAL_FLASH_DEVICES = "W25Q64JVxQ"
CIRCUITPY__EVE = 1

View File

@ -0,0 +1,47 @@
#include "shared-bindings/board/__init__.h"
STATIC const mp_rom_map_elem_t board_global_dict_table[] = {
{ MP_ROM_QSTR(MP_QSTR_GP0), MP_ROM_PTR(&pin_GPIO0) },
{ MP_ROM_QSTR(MP_QSTR_GP1), MP_ROM_PTR(&pin_GPIO1) },
{ MP_ROM_QSTR(MP_QSTR_GP2), MP_ROM_PTR(&pin_GPIO2) },
{ MP_ROM_QSTR(MP_QSTR_GP3), MP_ROM_PTR(&pin_GPIO3) },
{ MP_ROM_QSTR(MP_QSTR_GP4), MP_ROM_PTR(&pin_GPIO4) },
{ MP_ROM_QSTR(MP_QSTR_GP5), MP_ROM_PTR(&pin_GPIO5) },
{ MP_ROM_QSTR(MP_QSTR_GP6), MP_ROM_PTR(&pin_GPIO6) },
{ MP_ROM_QSTR(MP_QSTR_GP7), MP_ROM_PTR(&pin_GPIO7) },
{ MP_ROM_QSTR(MP_QSTR_GP8), MP_ROM_PTR(&pin_GPIO8) },
{ MP_ROM_QSTR(MP_QSTR_GP9), MP_ROM_PTR(&pin_GPIO9) },
{ MP_ROM_QSTR(MP_QSTR_GP10), MP_ROM_PTR(&pin_GPIO10) },
{ MP_ROM_QSTR(MP_QSTR_GP11), MP_ROM_PTR(&pin_GPIO11) },
{ MP_ROM_QSTR(MP_QSTR_GP12), MP_ROM_PTR(&pin_GPIO12) },
{ MP_ROM_QSTR(MP_QSTR_GP13), MP_ROM_PTR(&pin_GPIO13) },
{ MP_ROM_QSTR(MP_QSTR_GP14), MP_ROM_PTR(&pin_GPIO14) },
{ MP_ROM_QSTR(MP_QSTR_GP15), MP_ROM_PTR(&pin_GPIO15) },
{ MP_ROM_QSTR(MP_QSTR_GP16), MP_ROM_PTR(&pin_GPIO16) },
{ MP_ROM_QSTR(MP_QSTR_GP17), MP_ROM_PTR(&pin_GPIO17) },
{ MP_ROM_QSTR(MP_QSTR_GP18), MP_ROM_PTR(&pin_GPIO18) },
{ MP_ROM_QSTR(MP_QSTR_GP19), MP_ROM_PTR(&pin_GPIO19) },
{ MP_ROM_QSTR(MP_QSTR_GP20), MP_ROM_PTR(&pin_GPIO20) },
{ MP_ROM_QSTR(MP_QSTR_GP21), MP_ROM_PTR(&pin_GPIO21) },
{ MP_ROM_QSTR(MP_QSTR_GP22), MP_ROM_PTR(&pin_GPIO22) },
{ MP_ROM_QSTR(MP_QSTR_GP23), MP_ROM_PTR(&pin_GPIO23) },
{ MP_ROM_QSTR(MP_QSTR_GP24), MP_ROM_PTR(&pin_GPIO24) },
{ MP_ROM_QSTR(MP_QSTR_GP25), MP_ROM_PTR(&pin_GPIO25) },
{ MP_ROM_QSTR(MP_QSTR_GP26_A0), MP_ROM_PTR(&pin_GPIO26) },
{ MP_ROM_QSTR(MP_QSTR_GP26), MP_ROM_PTR(&pin_GPIO26) },
{ MP_ROM_QSTR(MP_QSTR_A0), MP_ROM_PTR(&pin_GPIO26) },
{ MP_ROM_QSTR(MP_QSTR_GP27_A1), MP_ROM_PTR(&pin_GPIO27) },
{ MP_ROM_QSTR(MP_QSTR_GP27), MP_ROM_PTR(&pin_GPIO27) },
{ MP_ROM_QSTR(MP_QSTR_A1), MP_ROM_PTR(&pin_GPIO27) },
{ MP_ROM_QSTR(MP_QSTR_GP28_A2), MP_ROM_PTR(&pin_GPIO28) },
{ MP_ROM_QSTR(MP_QSTR_GP28), MP_ROM_PTR(&pin_GPIO28) },
{ MP_ROM_QSTR(MP_QSTR_A2), MP_ROM_PTR(&pin_GPIO28) },
{ MP_ROM_QSTR(MP_QSTR_GP29_A3), MP_ROM_PTR(&pin_GPIO29) },
{ MP_ROM_QSTR(MP_QSTR_GP29), MP_ROM_PTR(&pin_GPIO29) },
{ MP_ROM_QSTR(MP_QSTR_A3), MP_ROM_PTR(&pin_GPIO29) },
};
MP_DEFINE_CONST_DICT(board_module_globals, board_global_dict_table);

View File

@ -102,6 +102,7 @@ void common_hal_audiopwmio_pwmaudioout_construct(audiopwmio_pwmaudioout_obj_t *s
} }
audio_dma_init(&self->dma); audio_dma_init(&self->dma);
self->pacing_timer = NUM_DMA_TIMERS;
self->quiescent_value = quiescent_value; self->quiescent_value = quiescent_value;
} }
@ -126,6 +127,7 @@ void common_hal_audiopwmio_pwmaudioout_deinit(audiopwmio_pwmaudioout_obj_t *self
} }
void common_hal_audiopwmio_pwmaudioout_play(audiopwmio_pwmaudioout_obj_t *self, mp_obj_t sample, bool loop) { void common_hal_audiopwmio_pwmaudioout_play(audiopwmio_pwmaudioout_obj_t *self, mp_obj_t sample, bool loop) {
if (common_hal_audiopwmio_pwmaudioout_get_playing(self)) { if (common_hal_audiopwmio_pwmaudioout_get_playing(self)) {
common_hal_audiopwmio_pwmaudioout_stop(self); common_hal_audiopwmio_pwmaudioout_stop(self);
} }
@ -135,9 +137,9 @@ void common_hal_audiopwmio_pwmaudioout_play(audiopwmio_pwmaudioout_obj_t *self,
for (size_t i = 0; i < NUM_DMA_TIMERS; i++) { for (size_t i = 0; i < NUM_DMA_TIMERS; i++) {
if (dma_hw->timer[i] == 0) { if (dma_hw->timer[i] == 0) {
pacing_timer = i; pacing_timer = i;
}
break; break;
} }
}
if (pacing_timer == NUM_DMA_TIMERS) { if (pacing_timer == NUM_DMA_TIMERS) {
mp_raise_RuntimeError(translate("No DMA pacing timer found")); mp_raise_RuntimeError(translate("No DMA pacing timer found"));
} }

View File

@ -117,9 +117,13 @@ void common_hal_pulseio_pulsein_deinit(pulseio_pulsein_obj_t *self) {
} }
void common_hal_pulseio_pulsein_pause(pulseio_pulsein_obj_t *self) { void common_hal_pulseio_pulsein_pause(pulseio_pulsein_obj_t *self) {
pio_sm_restart(self->state_machine.pio, self->state_machine.state_machine);
pio_sm_set_enabled(self->state_machine.pio, self->state_machine.state_machine, false); pio_sm_set_enabled(self->state_machine.pio, self->state_machine.state_machine, false);
last_level = self->idle_state;
level_count = 0;
result = 0;
buf_index = 0;
} }
void common_hal_pulseio_pulsein_interrupt() { void common_hal_pulseio_pulsein_interrupt() {
pulseio_pulsein_obj_t *self = save_self; pulseio_pulsein_obj_t *self = save_self;
@ -134,13 +138,13 @@ void common_hal_pulseio_pulsein_interrupt() {
} else { } else {
result = level_count; result = level_count;
last_level = level; last_level = level;
level_count = 1; level_count = 0;
// Pulses that are londger than MAX_PULSE will return MAX_PULSE // Pulses that are longer than MAX_PULSE will return MAX_PULSE
if (result > MAX_PULSE) { if (result > MAX_PULSE) {
result = MAX_PULSE; result = MAX_PULSE;
} }
// ignore pulses that are too short // return pulses that are not too short
if (result <= MAX_PULSE && result > MIN_PULSE) { if (result > MIN_PULSE) {
self->buffer[buf_index] = (uint16_t)result; self->buffer[buf_index] = (uint16_t)result;
if (self->len < self->maxlen) { if (self->len < self->maxlen) {
self->len++; self->len++;
@ -165,12 +169,6 @@ void common_hal_pulseio_pulsein_interrupt() {
} }
void common_hal_pulseio_pulsein_resume(pulseio_pulsein_obj_t *self, void common_hal_pulseio_pulsein_resume(pulseio_pulsein_obj_t *self,
uint16_t trigger_duration) { uint16_t trigger_duration) {
// exec a wait for the selected pin to change state
if (self->idle_state == true) {
pio_sm_exec(self->state_machine.pio,self->state_machine.state_machine,0x2020);
} else {
pio_sm_exec(self->state_machine.pio,self->state_machine.state_machine,0x20a0);
}
// Send the trigger pulse. // Send the trigger pulse.
if (trigger_duration > 0) { if (trigger_duration > 0) {
gpio_set_function(self->pin,GPIO_FUNC_SIO); gpio_set_function(self->pin,GPIO_FUNC_SIO);
@ -178,11 +176,17 @@ void common_hal_pulseio_pulsein_resume(pulseio_pulsein_obj_t *self,
gpio_put(self->pin, !self->idle_state); gpio_put(self->pin, !self->idle_state);
common_hal_mcu_delay_us((uint32_t)trigger_duration); common_hal_mcu_delay_us((uint32_t)trigger_duration);
gpio_set_function(self->pin,GPIO_FUNC_PIO0); gpio_set_function(self->pin,GPIO_FUNC_PIO0);
common_hal_mcu_delay_us(225); common_hal_mcu_delay_us(125);
} }
// Reconfigure the pin for PIO // Reconfigure the pin for PIO
gpio_set_function(self->pin, GPIO_FUNC_PIO0); gpio_set_function(self->pin, GPIO_FUNC_PIO0);
// exec a wait for the selected pin to change state
if (self->idle_state == true) {
pio_sm_exec(self->state_machine.pio,self->state_machine.state_machine,0x2020);
} else {
pio_sm_exec(self->state_machine.pio,self->state_machine.state_machine,0x20a0);
}
pio_sm_set_enabled(self->state_machine.pio, self->state_machine.state_machine, true); pio_sm_set_enabled(self->state_machine.pio, self->state_machine.state_machine, true);
} }

@ -1 +1 @@
Subproject commit 7a6660134ac6242e3223fe1c78b248caf6b2cbf4 Subproject commit 49c0c1613dca37eea85f168290e858cca4411d81

View File

@ -280,7 +280,8 @@ all: $(BUILD)/firmware.bin $(BUILD)/firmware.uf2
$(BUILD)/firmware.elf: $(OBJ) $(BUILD)/firmware.elf: $(OBJ)
$(STEPECHO) "LINK $@" $(STEPECHO) "LINK $@"
$(Q)$(CC) -o $@ $(LDFLAGS) $^ -Wl,--start-group $(LIBS) -Wl,--end-group $(Q)echo $^ > $(BUILD)/firmware.objs
$(Q)$(CC) -o $@ $(LDFLAGS) @$(BUILD)/firmware.objs -Wl,--start-group $(LIBS) -Wl,--end-group
$(Q)$(SIZE) $@ | $(PYTHON3) $(TOP)/tools/build_memory_info.py $(LD_FILE) $(Q)$(SIZE) $@ | $(PYTHON3) $(TOP)/tools/build_memory_info.py $(LD_FILE)
$(BUILD)/firmware.bin: $(BUILD)/firmware.elf $(BUILD)/firmware.bin: $(BUILD)/firmware.elf

View File

@ -228,7 +228,7 @@ include $(TOP)/py/mkrules.mk
test: $(PROG) $(TOP)/tests/run-tests.py test: $(PROG) $(TOP)/tests/run-tests.py
$(eval DIRNAME=ports/$(notdir $(CURDIR))) $(eval DIRNAME=ports/$(notdir $(CURDIR)))
cd $(TOP)/tests && MICROPY_MICROPYTHON=../$(DIRNAME)/$(PROG) ./run-tests.py --auto-jobs cd $(TOP)/tests && MICROPY_MICROPYTHON=../$(DIRNAME)/$(PROG) ./run-tests.py
test_full: $(PROG) $(TOP)/tests/run-tests.py test_full: $(PROG) $(TOP)/tests/run-tests.py
$(eval DIRNAME=ports/$(notdir $(CURDIR))) $(eval DIRNAME=ports/$(notdir $(CURDIR)))

View File

@ -96,6 +96,7 @@
#define MICROPY_PY_BUILTINS_SET (1) #define MICROPY_PY_BUILTINS_SET (1)
#define MICROPY_PY_BUILTINS_SLICE (1) #define MICROPY_PY_BUILTINS_SLICE (1)
#define MICROPY_PY_BUILTINS_SLICE_ATTRS (1) #define MICROPY_PY_BUILTINS_SLICE_ATTRS (1)
#define MICROPY_PY_BUILTINS_SLICE_INDICES (1)
#define MICROPY_PY_BUILTINS_STR_UNICODE (1) #define MICROPY_PY_BUILTINS_STR_UNICODE (1)
#define MICROPY_PY_CMATH (0) #define MICROPY_PY_CMATH (0)

View File

@ -142,6 +142,9 @@ static inline size_t mpz_max_num_bits(const mpz_t *z) {
return z->len * MPZ_DIG_SIZE; return z->len * MPZ_DIG_SIZE;
} }
static inline size_t mpz_num_bits(const mpz_t *z) { static inline size_t mpz_num_bits(const mpz_t *z) {
if (mpz_is_zero(z)) {
return 0;
}
size_t last_bits = (8 * (sizeof(long) - sizeof(mpz_dig_t))) - __builtin_clzl(z->dig[z->len - 1]); size_t last_bits = (8 * (sizeof(long) - sizeof(mpz_dig_t))) - __builtin_clzl(z->dig[z->len - 1]);
return z->len * MPZ_DIG_SIZE + last_bits; return z->len * MPZ_DIG_SIZE + last_bits;
} }

View File

@ -34,8 +34,13 @@
// Implemented purely as inline assembly; inside a function, we have to deal with undoing the prologue, restoring // Implemented purely as inline assembly; inside a function, we have to deal with undoing the prologue, restoring
// SP and LR. This way, we don't. // SP and LR. This way, we don't.
__asm( __asm(
#if defined(__APPLE__) && defined(__MACH__)
"_nlr_push: \n"
".global _nlr_push \n"
#else
"nlr_push: \n" "nlr_push: \n"
".global nlr_push \n" ".global nlr_push \n"
#endif
"mov x9, sp \n" "mov x9, sp \n"
"stp lr, x9, [x0, #16]\n" // 16 == offsetof(nlr_buf_t, regs) "stp lr, x9, [x0, #16]\n" // 16 == offsetof(nlr_buf_t, regs)
"stp x19, x20, [x0, #32]\n" "stp x19, x20, [x0, #32]\n"
@ -44,7 +49,11 @@ __asm(
"stp x25, x26, [x0, #80]\n" "stp x25, x26, [x0, #80]\n"
"stp x27, x28, [x0, #96]\n" "stp x27, x28, [x0, #96]\n"
"str x29, [x0, #112]\n" "str x29, [x0, #112]\n"
#if defined(__APPLE__) && defined(__MACH__)
"b _nlr_push_tail \n" // do the rest in C
#else
"b nlr_push_tail \n" // do the rest in C "b nlr_push_tail \n" // do the rest in C
#endif
); );
NORETURN void nlr_jump(void *val) { NORETURN void nlr_jump(void *val) {

View File

@ -1,8 +1,11 @@
# SPDX-FileCopyrightText: 2014 MicroPython & CircuitPython contributors (https://github.com/adafruit/circuitpython/graphs/contributors) # SPDX-FileCopyrightText: 2014 MicroPython & CircuitPython contributors (https://github.com/adafruit/circuitpython/graphs/contributors)
# #
# SPDX-License-Identifier: MIT # SPDX-License-Identifier: MIT
import os
import site
from datetime import datetime from datetime import datetime
from typing import List
from setuptools import setup from setuptools import setup
from pathlib import Path from pathlib import Path
import subprocess import subprocess
@ -25,6 +28,13 @@ if len(pieces) > 2:
pieces.pop() pieces.pop()
version = "-".join(pieces) version = "-".join(pieces)
def build_data_files_list() -> List[tuple]:
result = []
for package in os.listdir("circuitpython-stubs"):
result.append((site.getsitepackages()[0] + "/" + package + "/",
["circuitpython-stubs/{}/__init__.pyi".format(package)]))
return result
setup( setup(
name="circuitpython-stubs", name="circuitpython-stubs",
description="PEP 561 type stubs for CircuitPython", description="PEP 561 type stubs for CircuitPython",
@ -34,7 +44,6 @@ setup(
author_email="circuitpython@adafruit.com", author_email="circuitpython@adafruit.com",
version=version, version=version,
license="MIT", license="MIT",
package_data={"circuitpython-stubs": stubs}, data_files=build_data_files_list(),
packages=["circuitpython-stubs"],
setup_requires=["setuptools>=38.6.0"], setup_requires=["setuptools>=38.6.0"],
) )

View File

@ -55,7 +55,7 @@
//| //|
//| with open("/sample.bmp", "rb") as f: //| with open("/sample.bmp", "rb") as f:
//| odb = displayio.OnDiskBitmap(f) //| odb = displayio.OnDiskBitmap(f)
//| face = displayio.TileGrid(odb, pixel_shader=displayio.ColorConverter()) //| face = displayio.TileGrid(odb, pixel_shader=odb.pixel_shader)
//| splash.append(face) //| splash.append(face)
//| # Wait for the image to load. //| # Wait for the image to load.
//| board.DISPLAY.refresh(target_frames_per_second=60) //| board.DISPLAY.refresh(target_frames_per_second=60)
@ -127,8 +127,29 @@ const mp_obj_property_t displayio_ondiskbitmap_height_obj = {
}; };
//| pixel_shader: Union[ColorConverter, Palette]
//| """The image's pixel_shader. The type depends on the underlying
//| bitmap's structure. The pixel shadder can be modified (e.g., to set the
//| transparent pixel or, for paletted images, to update the palette"""
//|
STATIC mp_obj_t displayio_ondiskbitmap_obj_get_pixel_shader(mp_obj_t self_in) {
displayio_ondiskbitmap_t *self = MP_OBJ_TO_PTR(self_in);
return common_hal_displayio_ondiskbitmap_get_pixel_shader(self);
}
MP_DEFINE_CONST_FUN_OBJ_1(displayio_ondiskbitmap_get_pixel_shader_obj, displayio_ondiskbitmap_obj_get_pixel_shader);
const mp_obj_property_t displayio_ondiskbitmap_pixel_shader_obj = {
.base.type = &mp_type_property,
.proxy = {(mp_obj_t)&displayio_ondiskbitmap_get_pixel_shader_obj,
(mp_obj_t)MP_ROM_NONE,
(mp_obj_t)MP_ROM_NONE},
};
STATIC const mp_rom_map_elem_t displayio_ondiskbitmap_locals_dict_table[] = { STATIC const mp_rom_map_elem_t displayio_ondiskbitmap_locals_dict_table[] = {
{ MP_ROM_QSTR(MP_QSTR_height), MP_ROM_PTR(&displayio_ondiskbitmap_height_obj) }, { MP_ROM_QSTR(MP_QSTR_height), MP_ROM_PTR(&displayio_ondiskbitmap_height_obj) },
{ MP_ROM_QSTR(MP_QSTR_pixel_shader), MP_ROM_PTR(&displayio_ondiskbitmap_pixel_shader_obj) },
{ MP_ROM_QSTR(MP_QSTR_width), MP_ROM_PTR(&displayio_ondiskbitmap_width_obj) }, { MP_ROM_QSTR(MP_QSTR_width), MP_ROM_PTR(&displayio_ondiskbitmap_width_obj) },
}; };
STATIC MP_DEFINE_CONST_DICT(displayio_ondiskbitmap_locals_dict, displayio_ondiskbitmap_locals_dict_table); STATIC MP_DEFINE_CONST_DICT(displayio_ondiskbitmap_locals_dict, displayio_ondiskbitmap_locals_dict_table);

View File

@ -38,6 +38,6 @@ uint32_t common_hal_displayio_ondiskbitmap_get_pixel(displayio_ondiskbitmap_t *b
int16_t x, int16_t y); int16_t x, int16_t y);
uint16_t common_hal_displayio_ondiskbitmap_get_height(displayio_ondiskbitmap_t *self); uint16_t common_hal_displayio_ondiskbitmap_get_height(displayio_ondiskbitmap_t *self);
mp_obj_t common_hal_displayio_ondiskbitmap_get_pixel_shader(displayio_ondiskbitmap_t *self);
uint16_t common_hal_displayio_ondiskbitmap_get_width(displayio_ondiskbitmap_t *self); uint16_t common_hal_displayio_ondiskbitmap_get_width(displayio_ondiskbitmap_t *self);
#endif // MICROPY_INCLUDED_SHARED_BINDINGS_DISPLAYIO_ONDISKBITMAP_H #endif // MICROPY_INCLUDED_SHARED_BINDINGS_DISPLAYIO_ONDISKBITMAP_H

View File

@ -33,7 +33,9 @@
#include "shared-bindings/supervisor/RunReason.h" #include "shared-bindings/supervisor/RunReason.h"
#include "shared-bindings/supervisor/Runtime.h" #include "shared-bindings/supervisor/Runtime.h"
#if (CIRCUITPY_USB)
#include "tusb.h" #include "tusb.h"
#endif
STATIC supervisor_run_reason_t _run_reason; STATIC supervisor_run_reason_t _run_reason;

View File

@ -52,9 +52,9 @@
//| """The `console` `Serial` object is used for the REPL, and for `sys.stdin` and `sys.stdout`. //| """The `console` `Serial` object is used for the REPL, and for `sys.stdin` and `sys.stdout`.
//| `console` is ``None`` if disabled. //| `console` is ``None`` if disabled.
//| //|
//| However, note that`sys.stdin` and `sys.stdout` are text-based streams, //| However, note that `sys.stdin` and `sys.stdout` are text-based streams,
//| and the `console` object is a binary stream. //| and the `console` object is a binary stream.
//| You do not normally need to write to `console` unless you wnat to write binary data. //| You do not normally need to write to `console` unless you want to write binary data.
//| """ //| """
//| //|
//| data: Optional[Serial] //| data: Optional[Serial]

View File

@ -69,16 +69,16 @@ STATIC mp_obj_t usb_hid_device_make_new(const mp_obj_type_t *type, size_t n_args
{ MP_QSTR_usage_page, MP_ARG_KW_ONLY | MP_ARG_REQUIRED | MP_ARG_INT }, { MP_QSTR_usage_page, MP_ARG_KW_ONLY | MP_ARG_REQUIRED | MP_ARG_INT },
{ MP_QSTR_usage, MP_ARG_KW_ONLY | MP_ARG_REQUIRED | MP_ARG_INT }, { MP_QSTR_usage, MP_ARG_KW_ONLY | MP_ARG_REQUIRED | MP_ARG_INT },
{ MP_QSTR_in_report_length, MP_ARG_KW_ONLY | MP_ARG_REQUIRED | MP_ARG_INT }, { MP_QSTR_in_report_length, MP_ARG_KW_ONLY | MP_ARG_REQUIRED | MP_ARG_INT },
{ MP_QSTR_out_report_length, MP_ARG_KW_ONLY | MP_ARG_OBJ, {.u_int = 0 } }, { MP_QSTR_out_report_length, MP_ARG_KW_ONLY | MP_ARG_INT, {.u_int = 0 } },
{ MP_QSTR_report_id_index, MP_ARG_KW_ONLY | MP_ARG_REQUIRED | MP_ARG_OBJ, {.u_obj = mp_const_none } }, { MP_QSTR_report_id_index, MP_ARG_KW_ONLY | MP_ARG_REQUIRED | MP_ARG_OBJ, {.u_obj = mp_const_none } },
}; };
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, pos_args, kw_args, MP_ARRAY_SIZE(allowed_args), allowed_args, args); mp_arg_parse_all(n_args, pos_args, kw_args, MP_ARRAY_SIZE(allowed_args), allowed_args, args);
mp_buffer_info_t bufinfo; mp_buffer_info_t descriptor_bufinfo;
mp_get_buffer_raise(args[ARG_report_descriptor].u_obj, &bufinfo, MP_BUFFER_READ); mp_get_buffer_raise(args[ARG_report_descriptor].u_obj, &descriptor_bufinfo, MP_BUFFER_READ);
mp_obj_t descriptor = mp_obj_new_bytearray(bufinfo.len, bufinfo.buf); mp_obj_t descriptor = mp_obj_new_bytearray(descriptor_bufinfo.len, descriptor_bufinfo.buf);
const mp_int_t usage_page_arg = args[ARG_usage_page].u_int; const mp_int_t usage_page_arg = args[ARG_usage_page].u_int;
if (usage_page_arg <= 0 || usage_page_arg > 255) { if (usage_page_arg <= 0 || usage_page_arg > 255) {
@ -99,8 +99,8 @@ STATIC mp_obj_t usb_hid_device_make_new(const mp_obj_type_t *type, size_t n_args
const uint8_t in_report_length = in_report_length_arg; const uint8_t in_report_length = in_report_length_arg;
const mp_int_t out_report_length_arg = args[ARG_out_report_length].u_int; const mp_int_t out_report_length_arg = args[ARG_out_report_length].u_int;
if (out_report_length_arg <= 0 || out_report_length_arg > 255) { if (out_report_length_arg < 0 || out_report_length_arg > 255) {
mp_raise_ValueError_varg(translate("%q must be 1-255"), MP_QSTR_out_report_length); mp_raise_ValueError_varg(translate("%q must be 0-255"), MP_QSTR_out_report_length);
} }
const uint8_t out_report_length = out_report_length_arg; const uint8_t out_report_length = out_report_length_arg;
@ -108,8 +108,9 @@ STATIC mp_obj_t usb_hid_device_make_new(const mp_obj_type_t *type, size_t n_args
uint8_t report_id_index = 0; uint8_t report_id_index = 0;
if (report_id_index_arg != mp_const_none) { if (report_id_index_arg != mp_const_none) {
const mp_int_t report_id_index_int = mp_obj_int_get_checked(report_id_index_arg); const mp_int_t report_id_index_int = mp_obj_int_get_checked(report_id_index_arg);
if (report_id_index_int <= 0 || report_id_index_int > 255) { if (report_id_index_int <= 0 || (uint32_t)report_id_index_int >= descriptor_bufinfo.len) {
mp_raise_ValueError_varg(translate("%q must be None or 1-255"), MP_QSTR_report_id_index); mp_raise_ValueError_varg(translate("%q must be None or between 1 and len(report_descriptor)-1"),
MP_QSTR_report_id_index);
} }
report_id_index = report_id_index_int; report_id_index = report_id_index_int;
} }

View File

@ -33,7 +33,7 @@
#include "py/obj.h" #include "py/obj.h"
#include "shared-module/displayio/Palette.h" #include "shared-module/displayio/Palette.h"
typedef struct { typedef struct displayio_colorconverter {
mp_obj_base_t base; mp_obj_base_t base;
bool dither; bool dither;
uint8_t input_colorspace; uint8_t input_colorspace;

View File

@ -25,6 +25,10 @@
*/ */
#include "shared-bindings/displayio/OnDiskBitmap.h" #include "shared-bindings/displayio/OnDiskBitmap.h"
#include "shared-bindings/displayio/ColorConverter.h"
#include "shared-bindings/displayio/Palette.h"
#include "shared-module/displayio/ColorConverter.h"
#include "shared-module/displayio/Palette.h"
#include <string.h> #include <string.h>
@ -63,6 +67,11 @@ void common_hal_displayio_ondiskbitmap_construct(displayio_ondiskbitmap_t *self,
self->width = read_word(bmp_header, 9); self->width = read_word(bmp_header, 9);
self->height = read_word(bmp_header, 11); self->height = read_word(bmp_header, 11);
displayio_colorconverter_t *colorconverter = m_new_obj(displayio_colorconverter_t);
colorconverter->base.type = &displayio_colorconverter_type;
common_hal_displayio_colorconverter_construct(colorconverter, false, DISPLAYIO_COLORSPACE_RGB888);
self->colorconverter = colorconverter;
if (bits_per_pixel == 16) { if (bits_per_pixel == 16) {
if (((header_size >= 56)) || (self->bitfield_compressed)) { if (((header_size >= 56)) || (self->bitfield_compressed)) {
self->r_bitmask = read_word(bmp_header, 27); self->r_bitmask = read_word(bmp_header, 27);
@ -74,25 +83,41 @@ void common_hal_displayio_ondiskbitmap_construct(displayio_ondiskbitmap_t *self,
self->g_bitmask = 0x3e0; self->g_bitmask = 0x3e0;
self->b_bitmask = 0x1f; self->b_bitmask = 0x1f;
} }
} else if (indexed && self->bits_per_pixel != 1) { } else if (indexed) {
if (number_of_colors == 0) { if (number_of_colors == 0) {
number_of_colors = 1 << bits_per_pixel; number_of_colors = 1 << bits_per_pixel;
} }
displayio_palette_t *palette = m_new_obj(displayio_palette_t);
palette->base.type = &displayio_palette_type;
common_hal_displayio_palette_construct(palette, number_of_colors);
if (number_of_colors > 1) {
uint16_t palette_size = number_of_colors * sizeof(uint32_t); uint16_t palette_size = number_of_colors * sizeof(uint32_t);
uint16_t palette_offset = 0xe + header_size; uint16_t palette_offset = 0xe + header_size;
self->palette_data = m_malloc(palette_size, false); uint32_t *palette_data = m_malloc(palette_size, false);
f_rewind(&self->file->fp); f_rewind(&self->file->fp);
f_lseek(&self->file->fp, palette_offset); f_lseek(&self->file->fp, palette_offset);
UINT palette_bytes_read; UINT palette_bytes_read;
if (f_read(&self->file->fp, self->palette_data, palette_size, &palette_bytes_read) != FR_OK) { if (f_read(&self->file->fp, palette_data, palette_size, &palette_bytes_read) != FR_OK) {
mp_raise_OSError(MP_EIO); mp_raise_OSError(MP_EIO);
} }
if (palette_bytes_read != palette_size) { if (palette_bytes_read != palette_size) {
mp_raise_ValueError(translate("Unable to read color palette data")); mp_raise_ValueError(translate("Unable to read color palette data"));
} }
for (uint16_t i = 0; i < palette_size; i++) {
common_hal_displayio_palette_set_color(palette, i, palette_data[i]);
}
m_free(palette_data);
} else {
common_hal_displayio_palette_set_color(palette, 0, 0x0);
common_hal_displayio_palette_set_color(palette, 1, 0xffffff);
}
self->palette = palette;
} else if (!(header_size == 12 || header_size == 40 || header_size == 108 || header_size == 124)) { } else if (!(header_size == 12 || header_size == 40 || header_size == 108 || header_size == 124)) {
mp_raise_ValueError_varg(translate("Only Windows format, uncompressed BMP supported: given header size is %d"), header_size); mp_raise_ValueError_varg(translate("Only Windows format, uncompressed BMP supported: given header size is %d"), header_size);
} }
@ -148,15 +173,7 @@ uint32_t common_hal_displayio_ondiskbitmap_get_pixel(displayio_ondiskbitmap_t *s
uint8_t offset = (x % pixels_per_byte) * self->bits_per_pixel; uint8_t offset = (x % pixels_per_byte) * self->bits_per_pixel;
uint8_t mask = (1 << self->bits_per_pixel) - 1; uint8_t mask = (1 << self->bits_per_pixel) - 1;
uint8_t index = (pixel_data >> ((8 - self->bits_per_pixel) - offset)) & mask; return (pixel_data >> ((8 - self->bits_per_pixel) - offset)) & mask;
if (self->bits_per_pixel == 1) {
if (index == 1) {
return 0xFFFFFF;
} else {
return 0x000000;
}
}
return self->palette_data[index];
} else if (bytes_per_pixel == 2) { } else if (bytes_per_pixel == 2) {
if (self->g_bitmask == 0x07e0) { // 565 if (self->g_bitmask == 0x07e0) { // 565
red = ((pixel_data & self->r_bitmask) >> 11); red = ((pixel_data & self->r_bitmask) >> 11);
@ -185,3 +202,7 @@ uint16_t common_hal_displayio_ondiskbitmap_get_height(displayio_ondiskbitmap_t *
uint16_t common_hal_displayio_ondiskbitmap_get_width(displayio_ondiskbitmap_t *self) { uint16_t common_hal_displayio_ondiskbitmap_get_width(displayio_ondiskbitmap_t *self) {
return self->width; return self->width;
} }
mp_obj_t common_hal_displayio_ondiskbitmap_get_pixel_shader(displayio_ondiskbitmap_t *self) {
return MP_OBJ_FROM_PTR(self->pixel_shader_base);
}

View File

@ -43,10 +43,14 @@ typedef struct {
uint32_t r_bitmask; uint32_t r_bitmask;
uint32_t g_bitmask; uint32_t g_bitmask;
uint32_t b_bitmask; uint32_t b_bitmask;
bool bitfield_compressed;
pyb_file_obj_t *file; pyb_file_obj_t *file;
union {
mp_obj_base_t *pixel_shader_base;
struct displayio_palette *palette;
struct displayio_colorconverter *colorconverter;
};
bool bitfield_compressed;
uint8_t bits_per_pixel; uint8_t bits_per_pixel;
uint32_t *palette_data;
} displayio_ondiskbitmap_t; } displayio_ondiskbitmap_t;
#endif // MICROPY_INCLUDED_SHARED_MODULE_DISPLAYIO_ONDISKBITMAP_H #endif // MICROPY_INCLUDED_SHARED_MODULE_DISPLAYIO_ONDISKBITMAP_H

View File

@ -69,7 +69,7 @@ typedef struct {
bool opaque; bool opaque;
} displayio_output_pixel_t; } displayio_output_pixel_t;
typedef struct { typedef struct displayio_palette {
mp_obj_base_t base; mp_obj_base_t base;
_displayio_color_t *colors; _displayio_color_t *colors;
uint32_t color_count; uint32_t color_count;

View File

@ -185,6 +185,8 @@ void reset_displays(void) {
rgbmatrix_rgbmatrix_obj_t *pm = &displays[i].rgbmatrix; rgbmatrix_rgbmatrix_obj_t *pm = &displays[i].rgbmatrix;
if (!any_display_uses_this_framebuffer(&pm->base)) { if (!any_display_uses_this_framebuffer(&pm->base)) {
common_hal_rgbmatrix_rgbmatrix_deinit(pm); common_hal_rgbmatrix_rgbmatrix_deinit(pm);
} else {
common_hal_rgbmatrix_rgbmatrix_set_paused(pm, true);
} }
#endif #endif
#if CIRCUITPY_SHARPDISPLAY #if CIRCUITPY_SHARPDISPLAY

View File

@ -104,15 +104,11 @@ void common_hal_rgbmatrix_rgbmatrix_reconstruct(rgbmatrix_rgbmatrix_obj_t *self,
if (stat == PROTOMATTER_OK) { if (stat == PROTOMATTER_OK) {
_PM_protoPtr = &self->protomatter; _PM_protoPtr = &self->protomatter;
common_hal_mcu_disable_interrupts();
common_hal_rgbmatrix_timer_enable(self->timer); common_hal_rgbmatrix_timer_enable(self->timer);
stat = _PM_begin(&self->protomatter); stat = _PM_begin(&self->protomatter);
if (stat == PROTOMATTER_OK) { if (stat == PROTOMATTER_OK) {
_PM_convert_565(&self->protomatter, self->bufinfo.buf, self->width); _PM_convert_565(&self->protomatter, self->bufinfo.buf, self->width);
}
common_hal_mcu_enable_interrupts();
if (stat == PROTOMATTER_OK) {
_PM_swapbuffer_maybe(&self->protomatter); _PM_swapbuffer_maybe(&self->protomatter);
} }
} }

View File

@ -106,7 +106,7 @@ size_t common_hal_terminalio_terminal_write(terminalio_terminal_obj_t *self, con
} }
} }
if (c == ';') { if (c == ';') {
int16_t m = 0; uint16_t m = 0;
for (++j; j < 9; j++) { for (++j; j < 9; j++) {
if ('0' <= i[j] && i[j] <= '9') { if ('0' <= i[j] && i[j] <= '9') {
m = m * 10 + (i[j] - '0'); m = m * 10 + (i[j] - '0');
@ -116,6 +116,12 @@ size_t common_hal_terminalio_terminal_write(terminalio_terminal_obj_t *self, con
} }
} }
if (c == 'H') { if (c == 'H') {
if (n > 0) {
n--;
}
if (m > 0) {
m--;
}
if (n >= self->tilegrid->height_in_tiles) { if (n >= self->tilegrid->height_in_tiles) {
n = self->tilegrid->height_in_tiles - 1; n = self->tilegrid->height_in_tiles - 1;
} }

View File

@ -147,26 +147,26 @@ static const char data_cdc_comm_interface_name[] = USB_INTERFACE_NAME " CDC2 con
static const char console_cdc_data_interface_name[] = USB_INTERFACE_NAME " CDC data"; static const char console_cdc_data_interface_name[] = USB_INTERFACE_NAME " CDC data";
static const char data_cdc_data_interface_name[] = USB_INTERFACE_NAME " CDC2 data"; static const char data_cdc_data_interface_name[] = USB_INTERFACE_NAME " CDC2 data";
// .idx is set later.
static usb_cdc_serial_obj_t usb_cdc_console_obj = { static usb_cdc_serial_obj_t usb_cdc_console_obj = {
.base.type = &usb_cdc_serial_type, .base.type = &usb_cdc_serial_type,
.timeout = -1.0f, .timeout = -1.0f,
.write_timeout = -1.0f, .write_timeout = -1.0f,
.idx = 0,
}; };
static usb_cdc_serial_obj_t usb_cdc_data_obj = { static usb_cdc_serial_obj_t usb_cdc_data_obj = {
.base.type = &usb_cdc_serial_type, .base.type = &usb_cdc_serial_type,
.timeout = -1.0f, .timeout = -1.0f,
.write_timeout = -1.0f, .write_timeout = -1.0f,
.idx = 1,
}; };
static bool usb_cdc_console_is_enabled; static bool usb_cdc_console_is_enabled;
static bool usb_cdc_data_is_enabled; static bool usb_cdc_data_is_enabled;
void usb_cdc_set_defaults(void) { void usb_cdc_set_defaults(void) {
usb_cdc_console_is_enabled = CIRCUITPY_USB_CDC_CONSOLE_ENABLED_DEFAULT; common_hal_usb_cdc_enable(CIRCUITPY_USB_CDC_CONSOLE_ENABLED_DEFAULT,
usb_cdc_data_is_enabled = CIRCUITPY_USB_CDC_DATA_ENABLED_DEFAULT; CIRCUITPY_USB_CDC_DATA_ENABLED_DEFAULT);
} }
bool usb_cdc_console_enabled(void) { bool usb_cdc_console_enabled(void) {
@ -241,11 +241,21 @@ bool common_hal_usb_cdc_enable(bool console, bool data) {
// Right now these objects contain no heap objects, but if that changes, // Right now these objects contain no heap objects, but if that changes,
// they will need to be protected against gc. // they will need to be protected against gc.
// Assign only as many idx values as necessary. They must start at 0.
uint8_t idx = 0;
usb_cdc_console_is_enabled = console; usb_cdc_console_is_enabled = console;
usb_cdc_set_console(console ? MP_OBJ_FROM_PTR(&usb_cdc_console_obj) : mp_const_none); usb_cdc_set_console(console ? MP_OBJ_FROM_PTR(&usb_cdc_console_obj) : mp_const_none);
if (console) {
usb_cdc_console_obj.idx = idx;
idx++;
}
usb_cdc_data_is_enabled = data; usb_cdc_data_is_enabled = data;
usb_cdc_set_data(data ? MP_OBJ_FROM_PTR(&usb_cdc_data_obj) : mp_const_none); usb_cdc_set_data(data ? MP_OBJ_FROM_PTR(&usb_cdc_data_obj) : mp_const_none);
if (data) {
usb_cdc_data_obj.idx = idx;
}
return true; return true;
} }

View File

@ -67,7 +67,7 @@ void serial_early_init(void) {
const mcu_pin_obj_t *tx = MP_OBJ_TO_PTR(DEBUG_UART_TX); const mcu_pin_obj_t *tx = MP_OBJ_TO_PTR(DEBUG_UART_TX);
common_hal_busio_uart_construct(&debug_uart, tx, rx, NULL, NULL, NULL, common_hal_busio_uart_construct(&debug_uart, tx, rx, NULL, NULL, NULL,
false, 115200, 8, UART_PARITY_NONE, 1, 1.0f, 64, false, 115200, 8, BUSIO_UART_PARITY_NONE, 1, 1.0f, 64,
buf_array, true); buf_array, true);
common_hal_busio_uart_never_reset(&debug_uart); common_hal_busio_uart_never_reset(&debug_uart);
#endif #endif

View File

@ -77,10 +77,15 @@ void usb_init(void) {
post_usb_init(); post_usb_init();
#if MICROPY_KBD_EXCEPTION #if MICROPY_KBD_EXCEPTION && CIRCUITPY_USB_CDC
// Set Ctrl+C as wanted char, tud_cdc_rx_wanted_cb() usb_callback will be invoked when Ctrl+C is received // Set Ctrl+C as wanted char, tud_cdc_rx_wanted_cb() usb_callback will be invoked when Ctrl+C is received
// This usb_callback always got invoked regardless of mp_interrupt_char value since we only set it once here // This usb_callback always got invoked regardless of mp_interrupt_char value since we only set it once here
// Don't watch for ctrl-C if there is no REPL.
if (usb_cdc_console_enabled()) {
// Console will always be itf 0.
tud_cdc_set_wanted_char(CHAR_CTRL_C); tud_cdc_set_wanted_char(CHAR_CTRL_C);
}
#endif #endif
} }
@ -103,7 +108,7 @@ void usb_set_defaults(void) {
#endif #endif
}; };
// Some dynamic USB data must be saved after boot.py. How much is needed // Some dynamic USB data must be saved after boot.py. How much is needed?
size_t usb_boot_py_data_size(void) { size_t usb_boot_py_data_size(void) {
size_t size = 0; size_t size = 0;
@ -151,8 +156,14 @@ void usb_background(void) {
#if CFG_TUSB_OS == OPT_OS_NONE #if CFG_TUSB_OS == OPT_OS_NONE
tud_task(); tud_task();
#endif #endif
// No need to flush if there's no REPL.
#if CIRCUITPY_USB_CDC
if (usb_cdc_console_enabled()) {
// Console will always be itf 0.
tud_cdc_write_flush(); tud_cdc_write_flush();
} }
#endif
}
} }
static background_callback_t usb_callback; static background_callback_t usb_callback;
@ -205,6 +216,7 @@ void tud_cdc_line_state_cb(uint8_t itf, bool dtr, bool rts) {
// DTR = false is counted as disconnected // DTR = false is counted as disconnected
if (!dtr) { if (!dtr) {
cdc_line_coding_t coding; cdc_line_coding_t coding;
// Use whichever CDC is itf 0.
tud_cdc_get_line_coding(&coding); tud_cdc_get_line_coding(&coding);
if (coding.bit_rate == 1200) { if (coding.bit_rate == 1200) {
@ -274,13 +286,13 @@ bool tud_vendor_control_xfer_cb(uint8_t rhport, uint8_t stage, tusb_control_requ
* @param itf Interface index (for multiple cdc interfaces) * @param itf Interface index (for multiple cdc interfaces)
* @param wanted_char The wanted char (set previously) * @param wanted_char The wanted char (set previously)
*/ */
void tud_cdc_rx_wanted_cb(uint8_t itf, char wanted_char) {
(void)itf; // not used
// Only called when console is enabled.
void tud_cdc_rx_wanted_cb(uint8_t itf, char wanted_char) {
// Workaround for using lib/utils/interrupt_char.c // Workaround for using lib/utils/interrupt_char.c
// Compare mp_interrupt_char with wanted_char and ignore if not matched // Compare mp_interrupt_char with wanted_char and ignore if not matched
if (mp_interrupt_char == wanted_char) { if (mp_interrupt_char == wanted_char) {
tud_cdc_read_flush(); // flush read fifo tud_cdc_n_read_flush(itf); // flush read fifo
mp_keyboard_interrupt(); mp_keyboard_interrupt();
} }
} }

View File

@ -7,10 +7,11 @@ import platform
import argparse import argparse
import inspect import inspect
import re import re
import threading from glob import glob
import multiprocessing import multiprocessing
from multiprocessing.pool import ThreadPool from multiprocessing.pool import ThreadPool
from glob import glob import threading
import tempfile
# See stackoverflow.com/questions/2632199: __file__ nor sys.argv[0] # See stackoverflow.com/questions/2632199: __file__ nor sys.argv[0]
# are guaranteed to always work, this one should though. # are guaranteed to always work, this one should though.
@ -169,26 +170,27 @@ def run_micropython(pyb, args, test_file, is_special=False):
# if running via .mpy, first compile the .py file # if running via .mpy, first compile the .py file
if args.via_mpy: if args.via_mpy:
mpy_modname = tempfile.mktemp(dir="")
mpy_filename = mpy_modname + ".mpy"
subprocess.check_output( subprocess.check_output(
[MPYCROSS] [MPYCROSS]
+ args.mpy_cross_flags.split() + args.mpy_cross_flags.split()
+ ["-o", "mpytest.mpy", "-X", "emit=" + args.emit, test_file] + ["-o", mpy_filename, "-X", "emit=" + args.emit, test_file]
) )
cmdlist.extend(["-m", "mpytest"]) cmdlist.extend(["-m", mpy_modname])
else: else:
cmdlist.append(test_file) cmdlist.append(test_file)
# run the actual test # run the actual test
e = {"LANG": "en_US.UTF-8", "MICROPYPATH": os.environ["MICROPYPATH"]}
try: try:
output_mupy = subprocess.check_output(cmdlist, env=e, stderr=subprocess.STDOUT) output_mupy = subprocess.check_output(cmdlist, stderr=subprocess.STDOUT)
except subprocess.CalledProcessError as error: except subprocess.CalledProcessError as er:
had_crash = True had_crash = True
output_mupy = error.output + b"CRASH" output_mupy = er.output + b"CRASH"
# clean up if we had an intermediate .mpy file # clean up if we had an intermediate .mpy file
if args.via_mpy: if args.via_mpy:
rm_f("mpytest.mpy") rm_f(mpy_filename)
else: else:
# run on pyboard # run on pyboard
@ -200,7 +202,7 @@ def run_micropython(pyb, args, test_file, is_special=False):
if not is_special and e.args[0] == "exception": if not is_special and e.args[0] == "exception":
output_mupy = e.args[1] + e.args[2] + b"CRASH" output_mupy = e.args[1] + e.args[2] + b"CRASH"
else: else:
output_mupy = b"CRASH" output_mupy = bytes(e.args[0], "ascii") + b"\nCRASH"
# canonical form for all ports/platforms is to use \n for end-of-line # canonical form for all ports/platforms is to use \n for end-of-line
output_mupy = output_mupy.replace(b"\r\n", b"\n") output_mupy = output_mupy.replace(b"\r\n", b"\n")
@ -241,10 +243,9 @@ def run_micropython(pyb, args, test_file, is_special=False):
else: else:
# a regex # a regex
if lines_exp[i][1].match(lines_mupy[i_mupy]): if lines_exp[i][1].match(lines_mupy[i_mupy]):
# print("match", lines_exp[i][0], lines_mupy[i_mupy])
lines_mupy[i_mupy] = lines_exp[i][0] lines_mupy[i_mupy] = lines_exp[i][0]
else: else:
# print("don't match: %r %s" % (lines_exp[i][0], lines_mupy[i_mupy])) # DEBUG # print("don't match: %r %s" % (lines_exp[i][1], lines_mupy[i_mupy])) # DEBUG
pass pass
i_mupy += 1 i_mupy += 1
if i_mupy >= len(lines_mupy): if i_mupy >= len(lines_mupy):
@ -266,6 +267,9 @@ class ThreadSafeCounter:
self._value = start self._value = start
self._lock = threading.Lock() self._lock = threading.Lock()
def increment(self):
self.add(1)
def add(self, to_add): def add(self, to_add):
with self._lock: with self._lock:
self._value += to_add self._value += to_add
@ -306,11 +310,11 @@ def run_tests(pyb, tests, args, result_dir, num_threads=1):
if not (args.list_tests or args.write_exp): if not (args.list_tests or args.write_exp):
# Even if we run completely different tests in a different directory, # Even if we run completely different tests in a different directory,
# we need to access feature_checks from the same directory as the # we need to access feature_checks from the same directory as the
# run-tests script itself so use base_path. # run-tests.py script itself so use base_path.
# Check if micropython.native is supported, and skip such tests if it's not # Check if micropython.native is supported, and skip such tests if it's not
output = run_feature_check(pyb, args, base_path, "native_check.py") output = run_feature_check(pyb, args, base_path, "native_check.py")
if output.endswith(b"CRASH"): if output != b"native\n":
skip_native = True skip_native = True
# Check if arbitrary-precision integers are supported, and skip such tests if it's not # Check if arbitrary-precision integers are supported, and skip such tests if it's not
@ -325,7 +329,7 @@ def run_tests(pyb, tests, args, result_dir, num_threads=1):
# Check if set type (and set literals) is supported, and skip such tests if it's not # Check if set type (and set literals) is supported, and skip such tests if it's not
output = run_feature_check(pyb, args, base_path, "set_check.py") output = run_feature_check(pyb, args, base_path, "set_check.py")
if output.endswith(b"CRASH"): if output != b"{1}\n":
skip_set_type = True skip_set_type = True
# Check if slice is supported, and skip such tests if it's not # Check if slice is supported, and skip such tests if it's not
@ -335,12 +339,12 @@ def run_tests(pyb, tests, args, result_dir, num_threads=1):
# Check if async/await keywords are supported, and skip such tests if it's not # Check if async/await keywords are supported, and skip such tests if it's not
output = run_feature_check(pyb, args, base_path, "async_check.py") output = run_feature_check(pyb, args, base_path, "async_check.py")
if output.endswith(b"CRASH"): if output != b"async\n":
skip_async = True skip_async = True
# Check if const keyword (MicroPython extension) is supported, and skip such tests if it's not # Check if const keyword (MicroPython extension) is supported, and skip such tests if it's not
output = run_feature_check(pyb, args, base_path, "const.py") output = run_feature_check(pyb, args, base_path, "const.py")
if output.endswith(b"CRASH"): if output != b"1\n":
skip_const = True skip_const = True
# Check if __rOP__ special methods are supported, and skip such tests if it's not # Check if __rOP__ special methods are supported, and skip such tests if it's not
@ -365,10 +369,10 @@ def run_tests(pyb, tests, args, result_dir, num_threads=1):
upy_byteorder = run_feature_check(pyb, args, base_path, "byteorder.py") upy_byteorder = run_feature_check(pyb, args, base_path, "byteorder.py")
upy_float_precision = run_feature_check(pyb, args, base_path, "float.py") upy_float_precision = run_feature_check(pyb, args, base_path, "float.py")
if upy_float_precision.endswith(b"CRASH"): try:
upy_float_precision = 0
else:
upy_float_precision = int(upy_float_precision) upy_float_precision = int(upy_float_precision)
except ValueError:
upy_float_precision = 0
has_complex = run_feature_check(pyb, args, base_path, "complex.py") == b"complex\n" has_complex = run_feature_check(pyb, args, base_path, "complex.py") == b"complex\n"
has_coverage = run_feature_check(pyb, args, base_path, "coverage.py") == b"coverage\n" has_coverage = run_feature_check(pyb, args, base_path, "coverage.py") == b"coverage\n"
cpy_byteorder = subprocess.check_output( cpy_byteorder = subprocess.check_output(
@ -545,7 +549,7 @@ def run_tests(pyb, tests, args, result_dir, num_threads=1):
is_bytearray = test_name.startswith("bytearray") or test_name.endswith("_bytearray") is_bytearray = test_name.startswith("bytearray") or test_name.endswith("_bytearray")
is_set_type = test_name.startswith("set_") or test_name.startswith("frozenset") is_set_type = test_name.startswith("set_") or test_name.startswith("frozenset")
is_slice = test_name.find("slice") != -1 or test_name in misc_slice_tests is_slice = test_name.find("slice") != -1 or test_name in misc_slice_tests
is_async = test_name.startswith("async_") is_async = test_name.startswith(("async_", "uasyncio_"))
is_const = test_name.startswith("const") is_const = test_name.startswith("const")
is_io_module = test_name.startswith("io_") is_io_module = test_name.startswith("io_")
@ -610,8 +614,8 @@ def run_tests(pyb, tests, args, result_dir, num_threads=1):
filename_mupy = os.path.join(result_dir, test_basename + ".out") filename_mupy = os.path.join(result_dir, test_basename + ".out")
if output_expected == output_mupy: if output_expected == output_mupy:
# print("pass ", test_file) print("pass ", test_file)
passed_count.add(1) passed_count.increment()
rm_f(filename_expected) rm_f(filename_expected)
rm_f(filename_mupy) rm_f(filename_mupy)
else: else:
@ -619,17 +623,13 @@ def run_tests(pyb, tests, args, result_dir, num_threads=1):
f.write(output_expected) f.write(output_expected)
with open(filename_mupy, "wb") as f: with open(filename_mupy, "wb") as f:
f.write(output_mupy) f.write(output_mupy)
print("### Expected")
print(output_expected)
print("### Actual")
print(output_mupy)
print("FAIL ", test_file) print("FAIL ", test_file)
failed_tests.append(test_file) failed_tests.append(test_name)
test_count.add(1) test_count.increment()
if args.list_tests: if pyb or args.list_tests:
return True num_threads = 1
if num_threads > 1: if num_threads > 1:
pool = ThreadPool(num_threads) pool = ThreadPool(num_threads)
@ -638,6 +638,9 @@ def run_tests(pyb, tests, args, result_dir, num_threads=1):
for test in tests: for test in tests:
run_one_test(test) run_one_test(test)
if args.list_tests:
return True
print( print(
"{} tests performed ({} individual testcases)".format( "{} tests performed ({} individual testcases)".format(
test_count.value, testcase_count.value test_count.value, testcase_count.value
@ -645,18 +648,12 @@ def run_tests(pyb, tests, args, result_dir, num_threads=1):
) )
print("{} tests passed".format(passed_count.value)) print("{} tests passed".format(passed_count.value))
if len(skipped_tests.value) > 0: skipped_tests = sorted(skipped_tests.value)
print( if len(skipped_tests) > 0:
"{} tests skipped: {}".format( print("{} tests skipped: {}".format(len(skipped_tests), " ".join(skipped_tests)))
len(skipped_tests.value), " ".join(sorted(skipped_tests.value)) failed_tests = sorted(failed_tests.value)
) if len(failed_tests) > 0:
) print("{} tests failed: {}".format(len(failed_tests), " ".join(failed_tests)))
if len(failed_tests.value) > 0:
print(
"{} tests failed: {}".format(
len(failed_tests.value), " ".join(sorted(failed_tests.value))
)
)
return False return False
# all tests succeeded # all tests succeeded
@ -758,18 +755,11 @@ the last matching regex is used:
cmd_parser.add_argument( cmd_parser.add_argument(
"-j", "-j",
"--jobs", "--jobs",
default=1, default=multiprocessing.cpu_count(),
metavar="N", metavar="N",
type=int, type=int,
help="Number of tests to run simultaneously", help="Number of tests to run simultaneously",
) )
cmd_parser.add_argument(
"--auto-jobs",
action="store_const",
dest="jobs",
const=multiprocessing.cpu_count(),
help="Set the -j values to the CPU (thread) count",
)
cmd_parser.add_argument("files", nargs="*", help="input test files") cmd_parser.add_argument("files", nargs="*", help="input test files")
cmd_parser.add_argument( cmd_parser.add_argument(
"--print-failures", "--print-failures",
@ -869,9 +859,7 @@ the last matching regex is used:
if not args.keep_path: if not args.keep_path:
# clear search path to make sure tests use only builtin modules and those in extmod # clear search path to make sure tests use only builtin modules and those in extmod
os.environ["MICROPYPATH"] = ( os.environ["MICROPYPATH"] = os.pathsep + base_path("../extmod")
os.pathsep + base_path("../extmod") + os.pathsep + base_path(".")
)
try: try:
os.makedirs(args.result_dir, exist_ok=True) os.makedirs(args.result_dir, exist_ok=True)