Merge branch 'adafruit_main' into bitmaptools_paint_fill

This commit is contained in:
foamyguy 2021-08-13 09:49:24 -05:00
commit 0bbb0f1d06
118 changed files with 3549 additions and 1065 deletions

View File

@ -232,6 +232,7 @@ jobs:
- "bdmicro_vina_d51_pcb7"
- "bless_dev_board_multi_sensor"
- "blm_badge"
- "bluemicro840"
- "capablerobot_usbhub"
- "catwan_usbstick"
- "circuitbrains_basic_m0"
@ -325,11 +326,13 @@ jobs:
- "pewpew10"
- "pewpew_m4"
- "picoplanet"
- "pimoroni_interstate75"
- "pimoroni_keybow2040"
- "pimoroni_pga2040"
- "pimoroni_picolipo_16mb"
- "pimoroni_picolipo_4mb"
- "pimoroni_picosystem"
- "pimoroni_plasma2040"
- "pimoroni_tiny2040"
- "pitaya_go"
- "pyb_nano_v2"
@ -369,6 +372,7 @@ jobs:
- "sparkfun_samd21_mini"
- "sparkfun_samd51_micromod"
- "sparkfun_samd51_thing_plus"
- "sparkfun_stm32f405_micromod"
- "sparkfun_thing_plus_rp2040"
- "spresense"
- "stackrduino_m0_pro"
@ -460,7 +464,7 @@ jobs:
- name: Install deps
run: |
sudo apt-get install -y gettext
pip install requests sh click setuptools awscli
pip install -r requirements-dev.txt
wget https://static.dev.sifive.com/dev-tools/riscv64-unknown-elf-gcc-8.3.0-2019.08.0-x86_64-linux-centos6.tar.gz
sudo tar -C /usr --strip-components=1 -xaf riscv64-unknown-elf-gcc-8.3.0-2019.08.0-x86_64-linux-centos6.tar.gz
- name: Versions
@ -515,6 +519,7 @@ jobs:
- "gravitech_cucumber_rs"
- "lilygo_ttgo_t8_s2_st7789"
- "microdev_micro_s2"
- "morpheans_morphesp-240"
- "muselab_nanoesp32_s2_wroom"
- "muselab_nanoesp32_s2_wrover"
- "targett_module_clip_wroom"

View File

@ -152,7 +152,6 @@ shared-bindings/ustack/__init__.rst shared-bindings/ustack/
shared-bindings/vectorio/Circle.rst shared-bindings/vectorio/#vectorio.Circle
shared-bindings/vectorio/Polygon.rst shared-bindings/vectorio/#vectorio.Polygon
shared-bindings/vectorio/Rectangle.rst shared-bindings/vectorio/#vectorio.Rectangle
shared-bindings/vectorio/VectorShape.rst shared-bindings/vectorio/#vectorio.VectorShape
shared-bindings/vectorio/__init__.rst shared-bindings/vectorio/
shared-bindings/watchdog/WatchDogMode.rst shared-bindings/watchdog/#watchdog.WatchDogMode
shared-bindings/watchdog/WatchDogTimer.rst shared-bindings/watchdog/#watchdog.WatchDogTimer

View File

@ -149,7 +149,7 @@ STATIC int parse_compile_execute(const void *source, mp_parse_input_kind_t input
mp_hal_stdout_tx_strn("\x04", 1);
}
// check for SystemExit
if (mp_obj_is_subclass_fast(MP_OBJ_FROM_PTR(((mp_obj_base_t *)nlr.ret_val)->type), MP_OBJ_FROM_PTR(&mp_type_SystemExit))) {
if (mp_obj_is_subclass_fast(mp_obj_get_type((mp_obj_t)nlr.ret_val), MP_OBJ_FROM_PTR(&mp_type_SystemExit))) {
// at the moment, the value of SystemExit is unused
ret = pyexec_system_exit;
#if CIRCUITPY_ALARM

View File

@ -42,11 +42,11 @@ msgstr ""
"Harap ajukan masalah dengan konten drive CIRCUITPY Anda di\n"
"https://github.com/adafruit/circuitpython/issues\n"
#: py/obj.c shared-bindings/traceback/__init__.c
#: py/obj.c
msgid " File \"%q\""
msgstr " File \"%q\""
#: py/obj.c shared-bindings/traceback/__init__.c
#: py/obj.c
msgid " File \"%q\", line %d"
msgstr " File \"%q\", baris %d"
@ -325,11 +325,15 @@ msgstr "'yield from' di dalam fungsi async"
msgid "'yield' outside function"
msgstr "'yield' diluar fungsi"
#: shared-module/vectorio/VectorShape.c
msgid "(x,y) integers required"
msgstr ""
#: py/compile.c
msgid "*x must be assignment target"
msgstr "*x harus menjadi target assignment"
#: py/obj.c shared-bindings/traceback/__init__.c
#: py/obj.c
msgid ", in %q\n"
msgstr ", dalam %q\n"
@ -496,6 +500,10 @@ msgstr ""
msgid "Attempted heap allocation when VM not running."
msgstr ""
#: ports/raspberrypi/audio_dma.c
msgid "Audio conversion not implemented"
msgstr ""
#: shared-bindings/wifi/Radio.c
msgid "AuthMode.OPEN is not used with password"
msgstr ""
@ -1233,6 +1241,10 @@ msgstr "Otentikasi tidak cukup"
msgid "Insufficient encryption"
msgstr "Enkripsi tidak cukup"
#: ports/raspberrypi/audio_dma.c
msgid "Internal audio buffer too small"
msgstr ""
#: ports/stm/common-hal/busio/UART.c
msgid "Internal define error"
msgstr "Kesalahan definisi internal"
@ -2245,7 +2257,7 @@ msgstr ""
msgid "Touch alarms not available"
msgstr ""
#: py/obj.c shared-bindings/traceback/__init__.c
#: py/obj.c
msgid "Traceback (most recent call last):\n"
msgstr "Traceback (bagian terakhir dari panggilan terkini):\n"
@ -3495,10 +3507,6 @@ msgstr ""
msgid "lhs and rhs should be compatible"
msgstr ""
#: shared-bindings/traceback/__init__.c
msgid "limit should be an int"
msgstr ""
#: py/emitnative.c
msgid "local '%q' has type '%q' but source is '%q'"
msgstr ""
@ -3946,6 +3954,10 @@ msgstr ""
#: ports/esp32s2/boards/espressif_saola_1_wrover/mpconfigboard.h
#: ports/esp32s2/boards/franzininho_wifi_wroom/mpconfigboard.h
#: ports/esp32s2/boards/franzininho_wifi_wrover/mpconfigboard.h
#: ports/esp32s2/boards/gravitech_cucumber_m/mpconfigboard.h
#: ports/esp32s2/boards/gravitech_cucumber_ms/mpconfigboard.h
#: ports/esp32s2/boards/gravitech_cucumber_r/mpconfigboard.h
#: ports/esp32s2/boards/gravitech_cucumber_rs/mpconfigboard.h
#: ports/esp32s2/boards/lilygo_ttgo_t8_s2_st7789/mpconfigboard.h
#: ports/esp32s2/boards/microdev_micro_s2/mpconfigboard.h
#: ports/esp32s2/boards/muselab_nanoesp32_s2_wroom/mpconfigboard.h
@ -4144,7 +4156,7 @@ msgstr ""
msgid "stop not reachable from start"
msgstr ""
#: py/stream.c
#: py/stream.c shared-bindings/getpass/__init__.c
msgid "stream operation not supported"
msgstr ""
@ -4353,7 +4365,7 @@ msgid "unreadable attribute"
msgstr ""
#: shared-bindings/displayio/TileGrid.c shared-bindings/vectorio/VectorShape.c
#: shared-module/vectorio/Polygon.c
#: shared-module/vectorio/Polygon.c shared-module/vectorio/VectorShape.c
msgid "unsupported %q type"
msgstr ""

View File

@ -35,11 +35,11 @@ msgid ""
"https://github.com/adafruit/circuitpython/issues\n"
msgstr ""
#: py/obj.c shared-bindings/traceback/__init__.c
#: py/obj.c
msgid " File \"%q\""
msgstr ""
#: py/obj.c shared-bindings/traceback/__init__.c
#: py/obj.c
msgid " File \"%q\", line %d"
msgstr ""
@ -318,11 +318,15 @@ msgstr ""
msgid "'yield' outside function"
msgstr ""
#: shared-module/vectorio/VectorShape.c
msgid "(x,y) integers required"
msgstr ""
#: py/compile.c
msgid "*x must be assignment target"
msgstr ""
#: py/obj.c shared-bindings/traceback/__init__.c
#: py/obj.c
msgid ", in %q\n"
msgstr ""
@ -489,6 +493,10 @@ msgstr ""
msgid "Attempted heap allocation when VM not running."
msgstr ""
#: ports/raspberrypi/audio_dma.c
msgid "Audio conversion not implemented"
msgstr ""
#: shared-bindings/wifi/Radio.c
msgid "AuthMode.OPEN is not used with password"
msgstr ""
@ -1213,6 +1221,10 @@ msgstr ""
msgid "Insufficient encryption"
msgstr ""
#: ports/raspberrypi/audio_dma.c
msgid "Internal audio buffer too small"
msgstr ""
#: ports/stm/common-hal/busio/UART.c
msgid "Internal define error"
msgstr ""
@ -2211,7 +2223,7 @@ msgstr ""
msgid "Touch alarms not available"
msgstr ""
#: py/obj.c shared-bindings/traceback/__init__.c
#: py/obj.c
msgid "Traceback (most recent call last):\n"
msgstr ""
@ -3453,10 +3465,6 @@ msgstr ""
msgid "lhs and rhs should be compatible"
msgstr ""
#: shared-bindings/traceback/__init__.c
msgid "limit should be an int"
msgstr ""
#: py/emitnative.c
msgid "local '%q' has type '%q' but source is '%q'"
msgstr ""
@ -3903,6 +3911,10 @@ msgstr ""
#: ports/esp32s2/boards/espressif_saola_1_wrover/mpconfigboard.h
#: ports/esp32s2/boards/franzininho_wifi_wroom/mpconfigboard.h
#: ports/esp32s2/boards/franzininho_wifi_wrover/mpconfigboard.h
#: ports/esp32s2/boards/gravitech_cucumber_m/mpconfigboard.h
#: ports/esp32s2/boards/gravitech_cucumber_ms/mpconfigboard.h
#: ports/esp32s2/boards/gravitech_cucumber_r/mpconfigboard.h
#: ports/esp32s2/boards/gravitech_cucumber_rs/mpconfigboard.h
#: ports/esp32s2/boards/lilygo_ttgo_t8_s2_st7789/mpconfigboard.h
#: ports/esp32s2/boards/microdev_micro_s2/mpconfigboard.h
#: ports/esp32s2/boards/muselab_nanoesp32_s2_wroom/mpconfigboard.h
@ -4101,7 +4113,7 @@ msgstr ""
msgid "stop not reachable from start"
msgstr ""
#: py/stream.c
#: py/stream.c shared-bindings/getpass/__init__.c
msgid "stream operation not supported"
msgstr ""
@ -4310,7 +4322,7 @@ msgid "unreadable attribute"
msgstr ""
#: shared-bindings/displayio/TileGrid.c shared-bindings/vectorio/VectorShape.c
#: shared-module/vectorio/Polygon.c
#: shared-module/vectorio/Polygon.c shared-module/vectorio/VectorShape.c
msgid "unsupported %q type"
msgstr ""

View File

@ -38,11 +38,11 @@ msgstr ""
"Založte prosím problém s obsahem vaší jednotky CIRCUITPY na adrese\n"
"https://github.com/adafruit/circuitpython/issues\n"
#: py/obj.c shared-bindings/traceback/__init__.c
#: py/obj.c
msgid " File \"%q\""
msgstr " Soubor \"%q\""
#: py/obj.c shared-bindings/traceback/__init__.c
#: py/obj.c
msgid " File \"%q\", line %d"
msgstr " Soubor \"%q\", řádek %d"
@ -321,11 +321,15 @@ msgstr ""
msgid "'yield' outside function"
msgstr ""
#: shared-module/vectorio/VectorShape.c
msgid "(x,y) integers required"
msgstr ""
#: py/compile.c
msgid "*x must be assignment target"
msgstr ""
#: py/obj.c shared-bindings/traceback/__init__.c
#: py/obj.c
msgid ", in %q\n"
msgstr ""
@ -492,6 +496,10 @@ msgstr ""
msgid "Attempted heap allocation when VM not running."
msgstr ""
#: ports/raspberrypi/audio_dma.c
msgid "Audio conversion not implemented"
msgstr ""
#: shared-bindings/wifi/Radio.c
msgid "AuthMode.OPEN is not used with password"
msgstr ""
@ -1216,6 +1224,10 @@ msgstr ""
msgid "Insufficient encryption"
msgstr ""
#: ports/raspberrypi/audio_dma.c
msgid "Internal audio buffer too small"
msgstr ""
#: ports/stm/common-hal/busio/UART.c
msgid "Internal define error"
msgstr ""
@ -2214,7 +2226,7 @@ msgstr ""
msgid "Touch alarms not available"
msgstr ""
#: py/obj.c shared-bindings/traceback/__init__.c
#: py/obj.c
msgid "Traceback (most recent call last):\n"
msgstr ""
@ -3456,10 +3468,6 @@ msgstr ""
msgid "lhs and rhs should be compatible"
msgstr ""
#: shared-bindings/traceback/__init__.c
msgid "limit should be an int"
msgstr ""
#: py/emitnative.c
msgid "local '%q' has type '%q' but source is '%q'"
msgstr ""
@ -3906,6 +3914,10 @@ msgstr ""
#: ports/esp32s2/boards/espressif_saola_1_wrover/mpconfigboard.h
#: ports/esp32s2/boards/franzininho_wifi_wroom/mpconfigboard.h
#: ports/esp32s2/boards/franzininho_wifi_wrover/mpconfigboard.h
#: ports/esp32s2/boards/gravitech_cucumber_m/mpconfigboard.h
#: ports/esp32s2/boards/gravitech_cucumber_ms/mpconfigboard.h
#: ports/esp32s2/boards/gravitech_cucumber_r/mpconfigboard.h
#: ports/esp32s2/boards/gravitech_cucumber_rs/mpconfigboard.h
#: ports/esp32s2/boards/lilygo_ttgo_t8_s2_st7789/mpconfigboard.h
#: ports/esp32s2/boards/microdev_micro_s2/mpconfigboard.h
#: ports/esp32s2/boards/muselab_nanoesp32_s2_wroom/mpconfigboard.h
@ -4104,7 +4116,7 @@ msgstr ""
msgid "stop not reachable from start"
msgstr ""
#: py/stream.c
#: py/stream.c shared-bindings/getpass/__init__.c
msgid "stream operation not supported"
msgstr ""
@ -4313,7 +4325,7 @@ msgid "unreadable attribute"
msgstr ""
#: shared-bindings/displayio/TileGrid.c shared-bindings/vectorio/VectorShape.c
#: shared-module/vectorio/Polygon.c
#: shared-module/vectorio/Polygon.c shared-module/vectorio/VectorShape.c
msgid "unsupported %q type"
msgstr ""

View File

@ -41,11 +41,11 @@ msgstr ""
"Bitte melden Sie ein Problem mit dem Inhalt Ihres CIRCUITPY-Laufwerks unter\n"
"https://github.com/adafruit/circuitpython/issues\n"
#: py/obj.c shared-bindings/traceback/__init__.c
#: py/obj.c
msgid " File \"%q\""
msgstr " Datei \"%q\""
#: py/obj.c shared-bindings/traceback/__init__.c
#: py/obj.c
msgid " File \"%q\", line %d"
msgstr " Datei \"%q\", Zeile %d"
@ -327,11 +327,15 @@ msgstr "'yield from' innerhalb einer async Funktion"
msgid "'yield' outside function"
msgstr "'yield' außerhalb einer Funktion"
#: shared-module/vectorio/VectorShape.c
msgid "(x,y) integers required"
msgstr ""
#: py/compile.c
msgid "*x must be assignment target"
msgstr "*x muss Zuordnungsziel sein"
#: py/obj.c shared-bindings/traceback/__init__.c
#: py/obj.c
msgid ", in %q\n"
msgstr ", in %q\n"
@ -498,6 +502,10 @@ msgstr "Versuche %d Blöcke zu allokieren"
msgid "Attempted heap allocation when VM not running."
msgstr ""
#: ports/raspberrypi/audio_dma.c
msgid "Audio conversion not implemented"
msgstr ""
#: shared-bindings/wifi/Radio.c
msgid "AuthMode.OPEN is not used with password"
msgstr ""
@ -1233,6 +1241,10 @@ msgstr "Unzureichende Authentifizierung"
msgid "Insufficient encryption"
msgstr "Unzureichende Verschlüsselung"
#: ports/raspberrypi/audio_dma.c
msgid "Internal audio buffer too small"
msgstr ""
#: ports/stm/common-hal/busio/UART.c
msgid "Internal define error"
msgstr "Interner Definitionsfehler"
@ -2246,7 +2258,7 @@ msgstr ""
msgid "Touch alarms not available"
msgstr ""
#: py/obj.c shared-bindings/traceback/__init__.c
#: py/obj.c
msgid "Traceback (most recent call last):\n"
msgstr "Zurückverfolgung (jüngste Aufforderung zuletzt):\n"
@ -3519,10 +3531,6 @@ msgstr "Der Pegel muss zwischen 0 und 1 liegen"
msgid "lhs and rhs should be compatible"
msgstr "lhs und rhs sollten kompatibel sein"
#: shared-bindings/traceback/__init__.c
msgid "limit should be an int"
msgstr ""
#: py/emitnative.c
msgid "local '%q' has type '%q' but source is '%q'"
msgstr "Lokales '%q' hat den Typ '%q', aber die Quelle ist '%q'"
@ -3975,6 +3983,10 @@ msgstr "pow () mit 3 Argumenten erfordert Integer"
#: ports/esp32s2/boards/espressif_saola_1_wrover/mpconfigboard.h
#: ports/esp32s2/boards/franzininho_wifi_wroom/mpconfigboard.h
#: ports/esp32s2/boards/franzininho_wifi_wrover/mpconfigboard.h
#: ports/esp32s2/boards/gravitech_cucumber_m/mpconfigboard.h
#: ports/esp32s2/boards/gravitech_cucumber_ms/mpconfigboard.h
#: ports/esp32s2/boards/gravitech_cucumber_r/mpconfigboard.h
#: ports/esp32s2/boards/gravitech_cucumber_rs/mpconfigboard.h
#: ports/esp32s2/boards/lilygo_ttgo_t8_s2_st7789/mpconfigboard.h
#: ports/esp32s2/boards/microdev_micro_s2/mpconfigboard.h
#: ports/esp32s2/boards/muselab_nanoesp32_s2_wroom/mpconfigboard.h
@ -4175,7 +4187,7 @@ msgstr "stop muss 1 oder 2 sein"
msgid "stop not reachable from start"
msgstr "stop ist von start aus nicht erreichbar"
#: py/stream.c
#: py/stream.c shared-bindings/getpass/__init__.c
msgid "stream operation not supported"
msgstr "stream operation ist nicht unterstützt"
@ -4389,7 +4401,7 @@ msgid "unreadable attribute"
msgstr "nicht lesbares Attribut"
#: shared-bindings/displayio/TileGrid.c shared-bindings/vectorio/VectorShape.c
#: shared-module/vectorio/Polygon.c
#: shared-module/vectorio/Polygon.c shared-module/vectorio/VectorShape.c
msgid "unsupported %q type"
msgstr "Nicht unterstützter %q-Typ"

View File

@ -35,11 +35,11 @@ msgid ""
"https://github.com/adafruit/circuitpython/issues\n"
msgstr ""
#: py/obj.c shared-bindings/traceback/__init__.c
#: py/obj.c
msgid " File \"%q\""
msgstr ""
#: py/obj.c shared-bindings/traceback/__init__.c
#: py/obj.c
msgid " File \"%q\", line %d"
msgstr ""
@ -318,11 +318,15 @@ msgstr ""
msgid "'yield' outside function"
msgstr ""
#: shared-module/vectorio/VectorShape.c
msgid "(x,y) integers required"
msgstr ""
#: py/compile.c
msgid "*x must be assignment target"
msgstr ""
#: py/obj.c shared-bindings/traceback/__init__.c
#: py/obj.c
msgid ", in %q\n"
msgstr ""
@ -489,6 +493,10 @@ msgstr ""
msgid "Attempted heap allocation when VM not running."
msgstr ""
#: ports/raspberrypi/audio_dma.c
msgid "Audio conversion not implemented"
msgstr ""
#: shared-bindings/wifi/Radio.c
msgid "AuthMode.OPEN is not used with password"
msgstr ""
@ -1213,6 +1221,10 @@ msgstr ""
msgid "Insufficient encryption"
msgstr ""
#: ports/raspberrypi/audio_dma.c
msgid "Internal audio buffer too small"
msgstr ""
#: ports/stm/common-hal/busio/UART.c
msgid "Internal define error"
msgstr ""
@ -2211,7 +2223,7 @@ msgstr ""
msgid "Touch alarms not available"
msgstr ""
#: py/obj.c shared-bindings/traceback/__init__.c
#: py/obj.c
msgid "Traceback (most recent call last):\n"
msgstr ""
@ -3453,10 +3465,6 @@ msgstr ""
msgid "lhs and rhs should be compatible"
msgstr ""
#: shared-bindings/traceback/__init__.c
msgid "limit should be an int"
msgstr ""
#: py/emitnative.c
msgid "local '%q' has type '%q' but source is '%q'"
msgstr ""
@ -3903,6 +3911,10 @@ msgstr ""
#: ports/esp32s2/boards/espressif_saola_1_wrover/mpconfigboard.h
#: ports/esp32s2/boards/franzininho_wifi_wroom/mpconfigboard.h
#: ports/esp32s2/boards/franzininho_wifi_wrover/mpconfigboard.h
#: ports/esp32s2/boards/gravitech_cucumber_m/mpconfigboard.h
#: ports/esp32s2/boards/gravitech_cucumber_ms/mpconfigboard.h
#: ports/esp32s2/boards/gravitech_cucumber_r/mpconfigboard.h
#: ports/esp32s2/boards/gravitech_cucumber_rs/mpconfigboard.h
#: ports/esp32s2/boards/lilygo_ttgo_t8_s2_st7789/mpconfigboard.h
#: ports/esp32s2/boards/microdev_micro_s2/mpconfigboard.h
#: ports/esp32s2/boards/muselab_nanoesp32_s2_wroom/mpconfigboard.h
@ -4101,7 +4113,7 @@ msgstr ""
msgid "stop not reachable from start"
msgstr ""
#: py/stream.c
#: py/stream.c shared-bindings/getpass/__init__.c
msgid "stream operation not supported"
msgstr ""
@ -4310,7 +4322,7 @@ msgid "unreadable attribute"
msgstr ""
#: shared-bindings/displayio/TileGrid.c shared-bindings/vectorio/VectorShape.c
#: shared-module/vectorio/Polygon.c
#: shared-module/vectorio/Polygon.c shared-module/vectorio/VectorShape.c
msgid "unsupported %q type"
msgstr ""

View File

@ -43,11 +43,11 @@ msgstr ""
"Please file an issue with the contents of your CIRCUITPY drive at \n"
"https://github.com/adafruit/circuitpython/issues\n"
#: py/obj.c shared-bindings/traceback/__init__.c
#: py/obj.c
msgid " File \"%q\""
msgstr " File \"%q\""
#: py/obj.c shared-bindings/traceback/__init__.c
#: py/obj.c
msgid " File \"%q\", line %d"
msgstr " File \"%q\", line %d"
@ -327,11 +327,15 @@ msgstr "'yield from' inside async function"
msgid "'yield' outside function"
msgstr "'yield' outside function"
#: shared-module/vectorio/VectorShape.c
msgid "(x,y) integers required"
msgstr ""
#: py/compile.c
msgid "*x must be assignment target"
msgstr "*x must be assignment target"
#: py/obj.c shared-bindings/traceback/__init__.c
#: py/obj.c
msgid ", in %q\n"
msgstr ", in %q\n"
@ -498,6 +502,10 @@ msgstr "Attempt to allocate %d blocks"
msgid "Attempted heap allocation when VM not running."
msgstr ""
#: ports/raspberrypi/audio_dma.c
msgid "Audio conversion not implemented"
msgstr ""
#: shared-bindings/wifi/Radio.c
msgid "AuthMode.OPEN is not used with password"
msgstr ""
@ -1228,6 +1236,10 @@ msgstr "Insufficient authentication"
msgid "Insufficient encryption"
msgstr "Insufficient encryption"
#: ports/raspberrypi/audio_dma.c
msgid "Internal audio buffer too small"
msgstr ""
#: ports/stm/common-hal/busio/UART.c
msgid "Internal define error"
msgstr "Internal define error"
@ -2235,7 +2247,7 @@ msgstr ""
msgid "Touch alarms not available"
msgstr ""
#: py/obj.c shared-bindings/traceback/__init__.c
#: py/obj.c
msgid "Traceback (most recent call last):\n"
msgstr "Traceback (most recent call last):\n"
@ -3488,10 +3500,6 @@ msgstr "level must be between 0 and 1"
msgid "lhs and rhs should be compatible"
msgstr "lhs and rhs should be compatible"
#: shared-bindings/traceback/__init__.c
msgid "limit should be an int"
msgstr ""
#: py/emitnative.c
msgid "local '%q' has type '%q' but source is '%q'"
msgstr "local '%q' has type '%q' but source is '%q'"
@ -3938,6 +3946,10 @@ msgstr "pow() with 3 arguments requires integers"
#: ports/esp32s2/boards/espressif_saola_1_wrover/mpconfigboard.h
#: ports/esp32s2/boards/franzininho_wifi_wroom/mpconfigboard.h
#: ports/esp32s2/boards/franzininho_wifi_wrover/mpconfigboard.h
#: ports/esp32s2/boards/gravitech_cucumber_m/mpconfigboard.h
#: ports/esp32s2/boards/gravitech_cucumber_ms/mpconfigboard.h
#: ports/esp32s2/boards/gravitech_cucumber_r/mpconfigboard.h
#: ports/esp32s2/boards/gravitech_cucumber_rs/mpconfigboard.h
#: ports/esp32s2/boards/lilygo_ttgo_t8_s2_st7789/mpconfigboard.h
#: ports/esp32s2/boards/microdev_micro_s2/mpconfigboard.h
#: ports/esp32s2/boards/muselab_nanoesp32_s2_wroom/mpconfigboard.h
@ -4138,7 +4150,7 @@ msgstr "stop must be 1 or 2"
msgid "stop not reachable from start"
msgstr "stop not reachable from start"
#: py/stream.c
#: py/stream.c shared-bindings/getpass/__init__.c
msgid "stream operation not supported"
msgstr "stream operation not supported"
@ -4347,7 +4359,7 @@ msgid "unreadable attribute"
msgstr "unreadable attribute"
#: shared-bindings/displayio/TileGrid.c shared-bindings/vectorio/VectorShape.c
#: shared-module/vectorio/Polygon.c
#: shared-module/vectorio/Polygon.c shared-module/vectorio/VectorShape.c
msgid "unsupported %q type"
msgstr "unsupported %q type"

View File

@ -44,11 +44,11 @@ msgstr ""
"Presente un problema con el contenido de su unidad CIRCUITPY en\n"
"https://github.com/adafruit/circuitpython/issues\n"
#: py/obj.c shared-bindings/traceback/__init__.c
#: py/obj.c
msgid " File \"%q\""
msgstr " Archivo \"%q\""
#: py/obj.c shared-bindings/traceback/__init__.c
#: py/obj.c
msgid " File \"%q\", line %d"
msgstr " Archivo \"%q\", línea %d"
@ -329,11 +329,15 @@ msgstr "'yield from' dentro de una función asincrónica"
msgid "'yield' outside function"
msgstr "'yield' fuera de una función"
#: shared-module/vectorio/VectorShape.c
msgid "(x,y) integers required"
msgstr ""
#: py/compile.c
msgid "*x must be assignment target"
msgstr "*x debe ser objetivo de la tarea"
#: py/obj.c shared-bindings/traceback/__init__.c
#: py/obj.c
msgid ", in %q\n"
msgstr ", en %q\n"
@ -502,6 +506,10 @@ msgstr "Tratando de localizar %d bloques"
msgid "Attempted heap allocation when VM not running."
msgstr "Asignación del montículo mientras la VM no esta ejecutándose."
#: ports/raspberrypi/audio_dma.c
msgid "Audio conversion not implemented"
msgstr ""
#: shared-bindings/wifi/Radio.c
msgid "AuthMode.OPEN is not used with password"
msgstr "AuthMode.OPEN no se usa con contraseña"
@ -1246,6 +1254,10 @@ msgstr "Autenticación insuficiente"
msgid "Insufficient encryption"
msgstr "Cifrado insuficiente"
#: ports/raspberrypi/audio_dma.c
msgid "Internal audio buffer too small"
msgstr ""
#: ports/stm/common-hal/busio/UART.c
msgid "Internal define error"
msgstr "Error interno de definición"
@ -2273,7 +2285,7 @@ msgstr "La cantidad total de datos es mas grande que %q"
msgid "Touch alarms not available"
msgstr "Alarmas táctiles no disponibles"
#: py/obj.c shared-bindings/traceback/__init__.c
#: py/obj.c
msgid "Traceback (most recent call last):\n"
msgstr "Traceback (ultima llamada reciente):\n"
@ -3538,10 +3550,6 @@ msgstr "el nivel debe ser entre 0 y 1"
msgid "lhs and rhs should be compatible"
msgstr "lhs y rhs deben ser compatibles"
#: shared-bindings/traceback/__init__.c
msgid "limit should be an int"
msgstr ""
#: py/emitnative.c
msgid "local '%q' has type '%q' but source is '%q'"
msgstr "la variable local '%q' tiene el tipo '%q' pero la fuente es '%q'"
@ -3992,6 +4000,10 @@ msgstr "pow() con 3 argumentos requiere enteros"
#: ports/esp32s2/boards/espressif_saola_1_wrover/mpconfigboard.h
#: ports/esp32s2/boards/franzininho_wifi_wroom/mpconfigboard.h
#: ports/esp32s2/boards/franzininho_wifi_wrover/mpconfigboard.h
#: ports/esp32s2/boards/gravitech_cucumber_m/mpconfigboard.h
#: ports/esp32s2/boards/gravitech_cucumber_ms/mpconfigboard.h
#: ports/esp32s2/boards/gravitech_cucumber_r/mpconfigboard.h
#: ports/esp32s2/boards/gravitech_cucumber_rs/mpconfigboard.h
#: ports/esp32s2/boards/lilygo_ttgo_t8_s2_st7789/mpconfigboard.h
#: ports/esp32s2/boards/microdev_micro_s2/mpconfigboard.h
#: ports/esp32s2/boards/muselab_nanoesp32_s2_wroom/mpconfigboard.h
@ -4192,7 +4204,7 @@ msgstr "stop debe ser 1 ó 2"
msgid "stop not reachable from start"
msgstr "stop no se puede alcanzar del principio"
#: py/stream.c
#: py/stream.c shared-bindings/getpass/__init__.c
msgid "stream operation not supported"
msgstr "operación stream no soportada"
@ -4402,7 +4414,7 @@ msgid "unreadable attribute"
msgstr "atributo no legible"
#: shared-bindings/displayio/TileGrid.c shared-bindings/vectorio/VectorShape.c
#: shared-module/vectorio/Polygon.c
#: shared-module/vectorio/Polygon.c shared-module/vectorio/VectorShape.c
msgid "unsupported %q type"
msgstr "tipo de %q no soportado"

View File

@ -34,11 +34,11 @@ msgid ""
"https://github.com/adafruit/circuitpython/issues\n"
msgstr ""
#: py/obj.c shared-bindings/traceback/__init__.c
#: py/obj.c
msgid " File \"%q\""
msgstr " File \"%q\""
#: py/obj.c shared-bindings/traceback/__init__.c
#: py/obj.c
msgid " File \"%q\", line %d"
msgstr " File \"%q\", line %d"
@ -320,11 +320,15 @@ msgstr ""
msgid "'yield' outside function"
msgstr "'yield' sa labas ng function"
#: shared-module/vectorio/VectorShape.c
msgid "(x,y) integers required"
msgstr ""
#: py/compile.c
msgid "*x must be assignment target"
msgstr "*x ay dapat na assignment target"
#: py/obj.c shared-bindings/traceback/__init__.c
#: py/obj.c
msgid ", in %q\n"
msgstr ", sa %q\n"
@ -492,6 +496,10 @@ msgstr ""
msgid "Attempted heap allocation when VM not running."
msgstr ""
#: ports/raspberrypi/audio_dma.c
msgid "Audio conversion not implemented"
msgstr ""
#: shared-bindings/wifi/Radio.c
msgid "AuthMode.OPEN is not used with password"
msgstr ""
@ -1228,6 +1236,10 @@ msgstr ""
msgid "Insufficient encryption"
msgstr ""
#: ports/raspberrypi/audio_dma.c
msgid "Internal audio buffer too small"
msgstr ""
#: ports/stm/common-hal/busio/UART.c
msgid "Internal define error"
msgstr ""
@ -2231,7 +2243,7 @@ msgstr ""
msgid "Touch alarms not available"
msgstr ""
#: py/obj.c shared-bindings/traceback/__init__.c
#: py/obj.c
msgid "Traceback (most recent call last):\n"
msgstr "Traceback (pinakahuling huling tawag): \n"
@ -3498,10 +3510,6 @@ msgstr ""
msgid "lhs and rhs should be compatible"
msgstr "lhs at rhs ay dapat magkasundo"
#: shared-bindings/traceback/__init__.c
msgid "limit should be an int"
msgstr ""
#: py/emitnative.c
msgid "local '%q' has type '%q' but source is '%q'"
msgstr "local '%q' ay may type '%q' pero ang source ay '%q'"
@ -3950,6 +3958,10 @@ msgstr "pow() na may 3 argumento kailangan ng integers"
#: ports/esp32s2/boards/espressif_saola_1_wrover/mpconfigboard.h
#: ports/esp32s2/boards/franzininho_wifi_wroom/mpconfigboard.h
#: ports/esp32s2/boards/franzininho_wifi_wrover/mpconfigboard.h
#: ports/esp32s2/boards/gravitech_cucumber_m/mpconfigboard.h
#: ports/esp32s2/boards/gravitech_cucumber_ms/mpconfigboard.h
#: ports/esp32s2/boards/gravitech_cucumber_r/mpconfigboard.h
#: ports/esp32s2/boards/gravitech_cucumber_rs/mpconfigboard.h
#: ports/esp32s2/boards/lilygo_ttgo_t8_s2_st7789/mpconfigboard.h
#: ports/esp32s2/boards/microdev_micro_s2/mpconfigboard.h
#: ports/esp32s2/boards/muselab_nanoesp32_s2_wroom/mpconfigboard.h
@ -4151,7 +4163,7 @@ msgstr "stop dapat 1 o 2"
msgid "stop not reachable from start"
msgstr "stop hindi maabot sa simula"
#: py/stream.c
#: py/stream.c shared-bindings/getpass/__init__.c
msgid "stream operation not supported"
msgstr "stream operation hindi sinusuportahan"
@ -4361,7 +4373,7 @@ msgid "unreadable attribute"
msgstr "hindi mabasa ang attribute"
#: shared-bindings/displayio/TileGrid.c shared-bindings/vectorio/VectorShape.c
#: shared-module/vectorio/Polygon.c
#: shared-module/vectorio/Polygon.c shared-module/vectorio/VectorShape.c
msgid "unsupported %q type"
msgstr "Hindi supportadong tipo ng %q"

View File

@ -44,11 +44,11 @@ msgstr ""
"l'adresse\n"
"https://github.com/adafruit/circuitpython/issues\n"
#: py/obj.c shared-bindings/traceback/__init__.c
#: py/obj.c
msgid " File \"%q\""
msgstr " Fichier \"%q\""
#: py/obj.c shared-bindings/traceback/__init__.c
#: py/obj.c
msgid " File \"%q\", line %d"
msgstr " Fichier \"%q\", ligne %d"
@ -329,11 +329,15 @@ msgstr "'yield from' dans une fonction async"
msgid "'yield' outside function"
msgstr "'yield' dehors d'une fonction"
#: shared-module/vectorio/VectorShape.c
msgid "(x,y) integers required"
msgstr ""
#: py/compile.c
msgid "*x must be assignment target"
msgstr "*x doit être la cible de l'assignement"
#: py/obj.c shared-bindings/traceback/__init__.c
#: py/obj.c
msgid ", in %q\n"
msgstr ", dans %q\n"
@ -504,6 +508,10 @@ msgstr ""
"Tentative d'allocation à la pile quand la Machine Virtuelle n'est pas en "
"exécution."
#: ports/raspberrypi/audio_dma.c
msgid "Audio conversion not implemented"
msgstr ""
#: shared-bindings/wifi/Radio.c
msgid "AuthMode.OPEN is not used with password"
msgstr "AuthMode.OPEN n'est pas utilisé avec un mot de passe"
@ -1256,6 +1264,10 @@ msgstr "Authentification insuffisante"
msgid "Insufficient encryption"
msgstr "Chiffrement insuffisant"
#: ports/raspberrypi/audio_dma.c
msgid "Internal audio buffer too small"
msgstr ""
#: ports/stm/common-hal/busio/UART.c
msgid "Internal define error"
msgstr "Erreur de définition interne"
@ -2273,7 +2285,7 @@ msgstr "Quantité de données à écrire est plus que %q"
msgid "Touch alarms not available"
msgstr ""
#: py/obj.c shared-bindings/traceback/__init__.c
#: py/obj.c
msgid "Traceback (most recent call last):\n"
msgstr "Traceback (appels les plus récents en dernier) :\n"
@ -3548,10 +3560,6 @@ msgstr "le niveau doit être compris entre 0 et 1"
msgid "lhs and rhs should be compatible"
msgstr "Les parties gauches et droites doivent être compatibles"
#: shared-bindings/traceback/__init__.c
msgid "limit should be an int"
msgstr ""
#: py/emitnative.c
msgid "local '%q' has type '%q' but source is '%q'"
msgstr "la variable locale '%q' a le type '%q' mais la source est '%q'"
@ -4003,6 +4011,10 @@ msgstr "pow() avec 3 arguments nécessite des entiers"
#: ports/esp32s2/boards/espressif_saola_1_wrover/mpconfigboard.h
#: ports/esp32s2/boards/franzininho_wifi_wroom/mpconfigboard.h
#: ports/esp32s2/boards/franzininho_wifi_wrover/mpconfigboard.h
#: ports/esp32s2/boards/gravitech_cucumber_m/mpconfigboard.h
#: ports/esp32s2/boards/gravitech_cucumber_ms/mpconfigboard.h
#: ports/esp32s2/boards/gravitech_cucumber_r/mpconfigboard.h
#: ports/esp32s2/boards/gravitech_cucumber_rs/mpconfigboard.h
#: ports/esp32s2/boards/lilygo_ttgo_t8_s2_st7789/mpconfigboard.h
#: ports/esp32s2/boards/microdev_micro_s2/mpconfigboard.h
#: ports/esp32s2/boards/muselab_nanoesp32_s2_wroom/mpconfigboard.h
@ -4203,7 +4215,7 @@ msgstr "stop doit être 1 ou 2"
msgid "stop not reachable from start"
msgstr "stop n'est pas accessible au démarrage"
#: py/stream.c
#: py/stream.c shared-bindings/getpass/__init__.c
msgid "stream operation not supported"
msgstr "opération de flux non supportée"
@ -4413,7 +4425,7 @@ msgid "unreadable attribute"
msgstr "attribut illisible"
#: shared-bindings/displayio/TileGrid.c shared-bindings/vectorio/VectorShape.c
#: shared-module/vectorio/Polygon.c
#: shared-module/vectorio/Polygon.c shared-module/vectorio/VectorShape.c
msgid "unsupported %q type"
msgstr "type %q non pris on charge"

View File

@ -35,11 +35,11 @@ msgid ""
"https://github.com/adafruit/circuitpython/issues\n"
msgstr ""
#: py/obj.c shared-bindings/traceback/__init__.c
#: py/obj.c
msgid " File \"%q\""
msgstr ""
#: py/obj.c shared-bindings/traceback/__init__.c
#: py/obj.c
msgid " File \"%q\", line %d"
msgstr ""
@ -318,11 +318,15 @@ msgstr ""
msgid "'yield' outside function"
msgstr ""
#: shared-module/vectorio/VectorShape.c
msgid "(x,y) integers required"
msgstr ""
#: py/compile.c
msgid "*x must be assignment target"
msgstr ""
#: py/obj.c shared-bindings/traceback/__init__.c
#: py/obj.c
msgid ", in %q\n"
msgstr ""
@ -489,6 +493,10 @@ msgstr ""
msgid "Attempted heap allocation when VM not running."
msgstr ""
#: ports/raspberrypi/audio_dma.c
msgid "Audio conversion not implemented"
msgstr ""
#: shared-bindings/wifi/Radio.c
msgid "AuthMode.OPEN is not used with password"
msgstr ""
@ -1213,6 +1221,10 @@ msgstr ""
msgid "Insufficient encryption"
msgstr ""
#: ports/raspberrypi/audio_dma.c
msgid "Internal audio buffer too small"
msgstr ""
#: ports/stm/common-hal/busio/UART.c
msgid "Internal define error"
msgstr ""
@ -2211,7 +2223,7 @@ msgstr ""
msgid "Touch alarms not available"
msgstr ""
#: py/obj.c shared-bindings/traceback/__init__.c
#: py/obj.c
msgid "Traceback (most recent call last):\n"
msgstr ""
@ -3453,10 +3465,6 @@ msgstr ""
msgid "lhs and rhs should be compatible"
msgstr ""
#: shared-bindings/traceback/__init__.c
msgid "limit should be an int"
msgstr ""
#: py/emitnative.c
msgid "local '%q' has type '%q' but source is '%q'"
msgstr ""
@ -3903,6 +3911,10 @@ msgstr ""
#: ports/esp32s2/boards/espressif_saola_1_wrover/mpconfigboard.h
#: ports/esp32s2/boards/franzininho_wifi_wroom/mpconfigboard.h
#: ports/esp32s2/boards/franzininho_wifi_wrover/mpconfigboard.h
#: ports/esp32s2/boards/gravitech_cucumber_m/mpconfigboard.h
#: ports/esp32s2/boards/gravitech_cucumber_ms/mpconfigboard.h
#: ports/esp32s2/boards/gravitech_cucumber_r/mpconfigboard.h
#: ports/esp32s2/boards/gravitech_cucumber_rs/mpconfigboard.h
#: ports/esp32s2/boards/lilygo_ttgo_t8_s2_st7789/mpconfigboard.h
#: ports/esp32s2/boards/microdev_micro_s2/mpconfigboard.h
#: ports/esp32s2/boards/muselab_nanoesp32_s2_wroom/mpconfigboard.h
@ -4101,7 +4113,7 @@ msgstr ""
msgid "stop not reachable from start"
msgstr ""
#: py/stream.c
#: py/stream.c shared-bindings/getpass/__init__.c
msgid "stream operation not supported"
msgstr ""
@ -4310,7 +4322,7 @@ msgid "unreadable attribute"
msgstr ""
#: shared-bindings/displayio/TileGrid.c shared-bindings/vectorio/VectorShape.c
#: shared-module/vectorio/Polygon.c
#: shared-module/vectorio/Polygon.c shared-module/vectorio/VectorShape.c
msgid "unsupported %q type"
msgstr ""

View File

@ -43,11 +43,11 @@ msgstr ""
"Per favore, segnala il problema con il contenuto del tuo CIRCUITPY a\n"
"https://github.com/adafruit/circuitpython/issues\n"
#: py/obj.c shared-bindings/traceback/__init__.c
#: py/obj.c
msgid " File \"%q\""
msgstr " File \"%q\""
#: py/obj.c shared-bindings/traceback/__init__.c
#: py/obj.c
msgid " File \"%q\", line %d"
msgstr " File \"%q\", riga %d"
@ -329,11 +329,15 @@ msgstr "'yield from' è nella funzione sincronizzazione"
msgid "'yield' outside function"
msgstr "'yield' al di fuori della funzione"
#: shared-module/vectorio/VectorShape.c
msgid "(x,y) integers required"
msgstr ""
#: py/compile.c
msgid "*x must be assignment target"
msgstr "*x deve essere il bersaglio del assegnamento"
#: py/obj.c shared-bindings/traceback/__init__.c
#: py/obj.c
msgid ", in %q\n"
msgstr ", in %q\n"
@ -501,6 +505,10 @@ msgstr "Provo ad allocare %d blocchi"
msgid "Attempted heap allocation when VM not running."
msgstr ""
#: ports/raspberrypi/audio_dma.c
msgid "Audio conversion not implemented"
msgstr ""
#: shared-bindings/wifi/Radio.c
msgid "AuthMode.OPEN is not used with password"
msgstr ""
@ -1237,6 +1245,10 @@ msgstr ""
msgid "Insufficient encryption"
msgstr ""
#: ports/raspberrypi/audio_dma.c
msgid "Internal audio buffer too small"
msgstr ""
#: ports/stm/common-hal/busio/UART.c
msgid "Internal define error"
msgstr ""
@ -2252,7 +2264,7 @@ msgstr ""
msgid "Touch alarms not available"
msgstr ""
#: py/obj.c shared-bindings/traceback/__init__.c
#: py/obj.c
msgid "Traceback (most recent call last):\n"
msgstr "Traceback (chiamata più recente per ultima):\n"
@ -3512,10 +3524,6 @@ msgstr ""
msgid "lhs and rhs should be compatible"
msgstr "lhs e rhs devono essere compatibili"
#: shared-bindings/traceback/__init__.c
msgid "limit should be an int"
msgstr ""
#: py/emitnative.c
msgid "local '%q' has type '%q' but source is '%q'"
msgstr "local '%q' ha tipo '%q' ma sorgente è '%q'"
@ -3968,6 +3976,10 @@ msgstr "pow() con 3 argomenti richiede interi"
#: ports/esp32s2/boards/espressif_saola_1_wrover/mpconfigboard.h
#: ports/esp32s2/boards/franzininho_wifi_wroom/mpconfigboard.h
#: ports/esp32s2/boards/franzininho_wifi_wrover/mpconfigboard.h
#: ports/esp32s2/boards/gravitech_cucumber_m/mpconfigboard.h
#: ports/esp32s2/boards/gravitech_cucumber_ms/mpconfigboard.h
#: ports/esp32s2/boards/gravitech_cucumber_r/mpconfigboard.h
#: ports/esp32s2/boards/gravitech_cucumber_rs/mpconfigboard.h
#: ports/esp32s2/boards/lilygo_ttgo_t8_s2_st7789/mpconfigboard.h
#: ports/esp32s2/boards/microdev_micro_s2/mpconfigboard.h
#: ports/esp32s2/boards/muselab_nanoesp32_s2_wroom/mpconfigboard.h
@ -4169,7 +4181,7 @@ msgstr ""
msgid "stop not reachable from start"
msgstr "stop non raggiungibile dall'inizio"
#: py/stream.c
#: py/stream.c shared-bindings/getpass/__init__.c
msgid "stream operation not supported"
msgstr "operazione di stream non supportata"
@ -4379,7 +4391,7 @@ msgid "unreadable attribute"
msgstr "attributo non leggibile"
#: shared-bindings/displayio/TileGrid.c shared-bindings/vectorio/VectorShape.c
#: shared-module/vectorio/Polygon.c
#: shared-module/vectorio/Polygon.c shared-module/vectorio/VectorShape.c
msgid "unsupported %q type"
msgstr "tipo di %q non supportato"

View File

@ -40,11 +40,11 @@ msgstr ""
"CIRCUITPYドライブの内容を添えて問題を以下で報告してください\n"
"https://github.com/adafruit/circuitpython/issues\n"
#: py/obj.c shared-bindings/traceback/__init__.c
#: py/obj.c
msgid " File \"%q\""
msgstr " ファイル \"%q\""
#: py/obj.c shared-bindings/traceback/__init__.c
#: py/obj.c
msgid " File \"%q\", line %d"
msgstr " ファイル \"%q\", 行 %d"
@ -323,11 +323,15 @@ msgstr ""
msgid "'yield' outside function"
msgstr "関数外でのyield"
#: shared-module/vectorio/VectorShape.c
msgid "(x,y) integers required"
msgstr ""
#: py/compile.c
msgid "*x must be assignment target"
msgstr "*xは代入先でなければなりません"
#: py/obj.c shared-bindings/traceback/__init__.c
#: py/obj.c
msgid ", in %q\n"
msgstr ""
@ -494,6 +498,10 @@ msgstr "%d個のブロックの確保を試みました"
msgid "Attempted heap allocation when VM not running."
msgstr ""
#: ports/raspberrypi/audio_dma.c
msgid "Audio conversion not implemented"
msgstr ""
#: shared-bindings/wifi/Radio.c
msgid "AuthMode.OPEN is not used with password"
msgstr ""
@ -1224,6 +1232,10 @@ msgstr "認証が不十分"
msgid "Insufficient encryption"
msgstr "暗号化が不十分"
#: ports/raspberrypi/audio_dma.c
msgid "Internal audio buffer too small"
msgstr ""
#: ports/stm/common-hal/busio/UART.c
msgid "Internal define error"
msgstr "内部定義エラー"
@ -2225,7 +2237,7 @@ msgstr ""
msgid "Touch alarms not available"
msgstr ""
#: py/obj.c shared-bindings/traceback/__init__.c
#: py/obj.c
msgid "Traceback (most recent call last):\n"
msgstr "トレースバック(最新の呼び出しが末尾):\n"
@ -3473,10 +3485,6 @@ msgstr "levelは0から1の間でなければなりません"
msgid "lhs and rhs should be compatible"
msgstr "左辺と右辺が互換でなければなりません"
#: shared-bindings/traceback/__init__.c
msgid "limit should be an int"
msgstr ""
#: py/emitnative.c
msgid "local '%q' has type '%q' but source is '%q'"
msgstr ""
@ -3925,6 +3933,10 @@ msgstr "pow()の第3引数には整数が必要"
#: ports/esp32s2/boards/espressif_saola_1_wrover/mpconfigboard.h
#: ports/esp32s2/boards/franzininho_wifi_wroom/mpconfigboard.h
#: ports/esp32s2/boards/franzininho_wifi_wrover/mpconfigboard.h
#: ports/esp32s2/boards/gravitech_cucumber_m/mpconfigboard.h
#: ports/esp32s2/boards/gravitech_cucumber_ms/mpconfigboard.h
#: ports/esp32s2/boards/gravitech_cucumber_r/mpconfigboard.h
#: ports/esp32s2/boards/gravitech_cucumber_rs/mpconfigboard.h
#: ports/esp32s2/boards/lilygo_ttgo_t8_s2_st7789/mpconfigboard.h
#: ports/esp32s2/boards/microdev_micro_s2/mpconfigboard.h
#: ports/esp32s2/boards/muselab_nanoesp32_s2_wroom/mpconfigboard.h
@ -4124,7 +4136,7 @@ msgstr "stopは1または2のいずれか"
msgid "stop not reachable from start"
msgstr ""
#: py/stream.c
#: py/stream.c shared-bindings/getpass/__init__.c
msgid "stream operation not supported"
msgstr "ストリーム操作は非対応"
@ -4333,7 +4345,7 @@ msgid "unreadable attribute"
msgstr "読み込み不可能な属性"
#: shared-bindings/displayio/TileGrid.c shared-bindings/vectorio/VectorShape.c
#: shared-module/vectorio/Polygon.c
#: shared-module/vectorio/Polygon.c shared-module/vectorio/VectorShape.c
msgid "unsupported %q type"
msgstr "非対応の型 %q"

View File

@ -36,11 +36,11 @@ msgid ""
"https://github.com/adafruit/circuitpython/issues\n"
msgstr ""
#: py/obj.c shared-bindings/traceback/__init__.c
#: py/obj.c
msgid " File \"%q\""
msgstr " 파일 \"%q\""
#: py/obj.c shared-bindings/traceback/__init__.c
#: py/obj.c
msgid " File \"%q\", line %d"
msgstr " 파일 \"%q\", 라인 %d"
@ -319,11 +319,15 @@ msgstr ""
msgid "'yield' outside function"
msgstr "'yield' 는 함수 외부에 존재합니다"
#: shared-module/vectorio/VectorShape.c
msgid "(x,y) integers required"
msgstr ""
#: py/compile.c
msgid "*x must be assignment target"
msgstr ""
#: py/obj.c shared-bindings/traceback/__init__.c
#: py/obj.c
msgid ", in %q\n"
msgstr ", 에서 %q\n"
@ -490,6 +494,10 @@ msgstr ""
msgid "Attempted heap allocation when VM not running."
msgstr ""
#: ports/raspberrypi/audio_dma.c
msgid "Audio conversion not implemented"
msgstr ""
#: shared-bindings/wifi/Radio.c
msgid "AuthMode.OPEN is not used with password"
msgstr ""
@ -1216,6 +1224,10 @@ msgstr ""
msgid "Insufficient encryption"
msgstr ""
#: ports/raspberrypi/audio_dma.c
msgid "Internal audio buffer too small"
msgstr ""
#: ports/stm/common-hal/busio/UART.c
msgid "Internal define error"
msgstr ""
@ -2214,7 +2226,7 @@ msgstr ""
msgid "Touch alarms not available"
msgstr ""
#: py/obj.c shared-bindings/traceback/__init__.c
#: py/obj.c
msgid "Traceback (most recent call last):\n"
msgstr ""
@ -3457,10 +3469,6 @@ msgstr ""
msgid "lhs and rhs should be compatible"
msgstr ""
#: shared-bindings/traceback/__init__.c
msgid "limit should be an int"
msgstr ""
#: py/emitnative.c
msgid "local '%q' has type '%q' but source is '%q'"
msgstr ""
@ -3907,6 +3915,10 @@ msgstr ""
#: ports/esp32s2/boards/espressif_saola_1_wrover/mpconfigboard.h
#: ports/esp32s2/boards/franzininho_wifi_wroom/mpconfigboard.h
#: ports/esp32s2/boards/franzininho_wifi_wrover/mpconfigboard.h
#: ports/esp32s2/boards/gravitech_cucumber_m/mpconfigboard.h
#: ports/esp32s2/boards/gravitech_cucumber_ms/mpconfigboard.h
#: ports/esp32s2/boards/gravitech_cucumber_r/mpconfigboard.h
#: ports/esp32s2/boards/gravitech_cucumber_rs/mpconfigboard.h
#: ports/esp32s2/boards/lilygo_ttgo_t8_s2_st7789/mpconfigboard.h
#: ports/esp32s2/boards/microdev_micro_s2/mpconfigboard.h
#: ports/esp32s2/boards/muselab_nanoesp32_s2_wroom/mpconfigboard.h
@ -4105,7 +4117,7 @@ msgstr ""
msgid "stop not reachable from start"
msgstr ""
#: py/stream.c
#: py/stream.c shared-bindings/getpass/__init__.c
msgid "stream operation not supported"
msgstr ""
@ -4314,7 +4326,7 @@ msgid "unreadable attribute"
msgstr ""
#: shared-bindings/displayio/TileGrid.c shared-bindings/vectorio/VectorShape.c
#: shared-module/vectorio/Polygon.c
#: shared-module/vectorio/Polygon.c shared-module/vectorio/VectorShape.c
msgid "unsupported %q type"
msgstr ""

View File

@ -38,11 +38,11 @@ msgstr ""
"Meld een probleem met de inhoud van de CIRCUITPY drive op:\n"
"https://github.com/adafruit/circuitpython/issues\n"
#: py/obj.c shared-bindings/traceback/__init__.c
#: py/obj.c
msgid " File \"%q\""
msgstr " Bestand"
#: py/obj.c shared-bindings/traceback/__init__.c
#: py/obj.c
msgid " File \"%q\", line %d"
msgstr " Bestand \"%q\", regel %d"
@ -321,11 +321,15 @@ msgstr "'yield from' binnen asynchrone functie"
msgid "'yield' outside function"
msgstr "'yield' buiten de functie"
#: shared-module/vectorio/VectorShape.c
msgid "(x,y) integers required"
msgstr ""
#: py/compile.c
msgid "*x must be assignment target"
msgstr "*x moet een assignment target zijn"
#: py/obj.c shared-bindings/traceback/__init__.c
#: py/obj.c
msgid ", in %q\n"
msgstr ", in %q\n"
@ -492,6 +496,10 @@ msgstr "Poging om %d blokken toe te wijzen"
msgid "Attempted heap allocation when VM not running."
msgstr ""
#: ports/raspberrypi/audio_dma.c
msgid "Audio conversion not implemented"
msgstr ""
#: shared-bindings/wifi/Radio.c
msgid "AuthMode.OPEN is not used with password"
msgstr ""
@ -1225,6 +1233,10 @@ msgstr "Onvoldoende authenticatie"
msgid "Insufficient encryption"
msgstr "Onvoldoende encryptie"
#: ports/raspberrypi/audio_dma.c
msgid "Internal audio buffer too small"
msgstr ""
#: ports/stm/common-hal/busio/UART.c
msgid "Internal define error"
msgstr "Interne define fout"
@ -2237,7 +2249,7 @@ msgstr ""
msgid "Touch alarms not available"
msgstr ""
#: py/obj.c shared-bindings/traceback/__init__.c
#: py/obj.c
msgid "Traceback (most recent call last):\n"
msgstr "Traceback (meest recente call laatst):\n"
@ -3498,10 +3510,6 @@ msgstr "level moet tussen 0 en 1 liggen"
msgid "lhs and rhs should be compatible"
msgstr "lhs en rhs moeten compatibel zijn"
#: shared-bindings/traceback/__init__.c
msgid "limit should be an int"
msgstr ""
#: py/emitnative.c
msgid "local '%q' has type '%q' but source is '%q'"
msgstr "lokale '%q' is van type '%q' maar bron is '%q'"
@ -3949,6 +3957,10 @@ msgstr "pow() met 3 argumenten vereist integers"
#: ports/esp32s2/boards/espressif_saola_1_wrover/mpconfigboard.h
#: ports/esp32s2/boards/franzininho_wifi_wroom/mpconfigboard.h
#: ports/esp32s2/boards/franzininho_wifi_wrover/mpconfigboard.h
#: ports/esp32s2/boards/gravitech_cucumber_m/mpconfigboard.h
#: ports/esp32s2/boards/gravitech_cucumber_ms/mpconfigboard.h
#: ports/esp32s2/boards/gravitech_cucumber_r/mpconfigboard.h
#: ports/esp32s2/boards/gravitech_cucumber_rs/mpconfigboard.h
#: ports/esp32s2/boards/lilygo_ttgo_t8_s2_st7789/mpconfigboard.h
#: ports/esp32s2/boards/microdev_micro_s2/mpconfigboard.h
#: ports/esp32s2/boards/muselab_nanoesp32_s2_wroom/mpconfigboard.h
@ -4149,7 +4161,7 @@ msgstr "stop moet 1 of 2 zijn"
msgid "stop not reachable from start"
msgstr "stop is niet bereikbaar vanaf start"
#: py/stream.c
#: py/stream.c shared-bindings/getpass/__init__.c
msgid "stream operation not supported"
msgstr "stream operatie niet ondersteund"
@ -4358,7 +4370,7 @@ msgid "unreadable attribute"
msgstr "onleesbaar attribuut"
#: shared-bindings/displayio/TileGrid.c shared-bindings/vectorio/VectorShape.c
#: shared-module/vectorio/Polygon.c
#: shared-module/vectorio/Polygon.c shared-module/vectorio/VectorShape.c
msgid "unsupported %q type"
msgstr "niet ondersteund %q type"

View File

@ -40,11 +40,11 @@ msgstr ""
"Zgłoś problem z zawartością dysku CIRCUITPY pod adresem\n"
"https://github.com/adafruit/circuitpython/issues\n"
#: py/obj.c shared-bindings/traceback/__init__.c
#: py/obj.c
msgid " File \"%q\""
msgstr " Plik \"%q\""
#: py/obj.c shared-bindings/traceback/__init__.c
#: py/obj.c
msgid " File \"%q\", line %d"
msgstr " Plik \"%q\", linia %d"
@ -323,11 +323,15 @@ msgstr "'yield from' wewnątrz funkcji asynchronicznej"
msgid "'yield' outside function"
msgstr "'yield' poza funkcją"
#: shared-module/vectorio/VectorShape.c
msgid "(x,y) integers required"
msgstr ""
#: py/compile.c
msgid "*x must be assignment target"
msgstr "*x musi być obiektem przypisania"
#: py/obj.c shared-bindings/traceback/__init__.c
#: py/obj.c
msgid ", in %q\n"
msgstr ", w %q\n"
@ -494,6 +498,10 @@ msgstr "Próba przydzielenia %d bloków"
msgid "Attempted heap allocation when VM not running."
msgstr ""
#: ports/raspberrypi/audio_dma.c
msgid "Audio conversion not implemented"
msgstr ""
#: shared-bindings/wifi/Radio.c
msgid "AuthMode.OPEN is not used with password"
msgstr ""
@ -1224,6 +1232,10 @@ msgstr "Niewystarczające uwierzytelnienie"
msgid "Insufficient encryption"
msgstr "Niewystarczające szyfrowanie"
#: ports/raspberrypi/audio_dma.c
msgid "Internal audio buffer too small"
msgstr ""
#: ports/stm/common-hal/busio/UART.c
msgid "Internal define error"
msgstr ""
@ -2222,7 +2234,7 @@ msgstr ""
msgid "Touch alarms not available"
msgstr ""
#: py/obj.c shared-bindings/traceback/__init__.c
#: py/obj.c
msgid "Traceback (most recent call last):\n"
msgstr "Ślad wyjątku (najnowsze wywołanie na końcu):\n"
@ -3471,10 +3483,6 @@ msgstr ""
msgid "lhs and rhs should be compatible"
msgstr "lewa i prawa strona powinny być kompatybilne"
#: shared-bindings/traceback/__init__.c
msgid "limit should be an int"
msgstr ""
#: py/emitnative.c
msgid "local '%q' has type '%q' but source is '%q'"
msgstr "local '%q' jest typu '%q' lecz źródło jest '%q'"
@ -3922,6 +3930,10 @@ msgstr "trzyargumentowe pow() wymaga liczb całkowitych"
#: ports/esp32s2/boards/espressif_saola_1_wrover/mpconfigboard.h
#: ports/esp32s2/boards/franzininho_wifi_wroom/mpconfigboard.h
#: ports/esp32s2/boards/franzininho_wifi_wrover/mpconfigboard.h
#: ports/esp32s2/boards/gravitech_cucumber_m/mpconfigboard.h
#: ports/esp32s2/boards/gravitech_cucumber_ms/mpconfigboard.h
#: ports/esp32s2/boards/gravitech_cucumber_r/mpconfigboard.h
#: ports/esp32s2/boards/gravitech_cucumber_rs/mpconfigboard.h
#: ports/esp32s2/boards/lilygo_ttgo_t8_s2_st7789/mpconfigboard.h
#: ports/esp32s2/boards/microdev_micro_s2/mpconfigboard.h
#: ports/esp32s2/boards/muselab_nanoesp32_s2_wroom/mpconfigboard.h
@ -4121,7 +4133,7 @@ msgstr "stop musi być 1 lub 2"
msgid "stop not reachable from start"
msgstr "stop nie jest osiągalne ze start"
#: py/stream.c
#: py/stream.c shared-bindings/getpass/__init__.c
msgid "stream operation not supported"
msgstr "operacja na strumieniu nieobsługiwana"
@ -4330,7 +4342,7 @@ msgid "unreadable attribute"
msgstr "nieczytelny atrybut"
#: shared-bindings/displayio/TileGrid.c shared-bindings/vectorio/VectorShape.c
#: shared-module/vectorio/Polygon.c
#: shared-module/vectorio/Polygon.c shared-module/vectorio/VectorShape.c
msgid "unsupported %q type"
msgstr "zły typ %q"

View File

@ -6,7 +6,7 @@ msgstr ""
"Project-Id-Version: PACKAGE VERSION\n"
"Report-Msgid-Bugs-To: \n"
"POT-Creation-Date: 2021-01-04 12:55-0600\n"
"PO-Revision-Date: 2021-07-24 15:35+0000\n"
"PO-Revision-Date: 2021-08-10 02:41+0000\n"
"Last-Translator: Wellington Terumi Uemura <wellingtonuemura@gmail.com>\n"
"Language-Team: \n"
"Language: pt_BR\n"
@ -14,7 +14,7 @@ msgstr ""
"Content-Type: text/plain; charset=UTF-8\n"
"Content-Transfer-Encoding: 8bit\n"
"Plural-Forms: nplurals=2; plural=n > 1;\n"
"X-Generator: Weblate 4.7.2-dev\n"
"X-Generator: Weblate 4.8-dev\n"
#: main.c
msgid ""
@ -42,11 +42,11 @@ msgstr ""
"Registre um problema com o conteúdo do seu controlador no CIRCUITPY\n"
"https://github.com/adafruit/circuitpython/issues\n"
#: py/obj.c shared-bindings/traceback/__init__.c
#: py/obj.c
msgid " File \"%q\""
msgstr " Arquivo \"%q\""
#: py/obj.c shared-bindings/traceback/__init__.c
#: py/obj.c
msgid " File \"%q\", line %d"
msgstr " Arquivo \"%q\", linha %d"
@ -331,11 +331,15 @@ msgstr "'yield a partir' de dentro da função async"
msgid "'yield' outside function"
msgstr "função externa 'yield'"
#: shared-module/vectorio/VectorShape.c
msgid "(x,y) integers required"
msgstr "(x,y) é obrigatório o uso de números inteiros"
#: py/compile.c
msgid "*x must be assignment target"
msgstr "*x deve ser o destino da atribuição"
#: py/obj.c shared-bindings/traceback/__init__.c
#: py/obj.c
msgid ", in %q\n"
msgstr ", em %q\n"
@ -503,6 +507,10 @@ msgid "Attempted heap allocation when VM not running."
msgstr ""
"Tentativa de alocação das pilhas quando o VM não estiver em funcionamento."
#: ports/raspberrypi/audio_dma.c
msgid "Audio conversion not implemented"
msgstr ""
#: shared-bindings/wifi/Radio.c
msgid "AuthMode.OPEN is not used with password"
msgstr "O AuthMode.OPEN não é usado com senha"
@ -1247,6 +1255,10 @@ msgstr "Autenticação insuficiente"
msgid "Insufficient encryption"
msgstr "Criptografia insuficiente"
#: ports/raspberrypi/audio_dma.c
msgid "Internal audio buffer too small"
msgstr ""
#: ports/stm/common-hal/busio/UART.c
msgid "Internal define error"
msgstr "Erro interno de definição"
@ -2276,7 +2288,7 @@ msgstr "O total dos dados que serão escritos é maior do que %q"
msgid "Touch alarms not available"
msgstr "Alarmes de toque não estão disponíveis"
#: py/obj.c shared-bindings/traceback/__init__.c
#: py/obj.c
msgid "Traceback (most recent call last):\n"
msgstr "Traceback (a última chamada mais recente):\n"
@ -3164,7 +3176,7 @@ msgstr "o arquivo deve ser um arquivo aberto no modo byte"
#: shared-bindings/traceback/__init__.c
msgid "file write is not available"
msgstr ""
msgstr "a gravação de arquivos não está disponível"
#: shared-bindings/storage/__init__.c
msgid "filesystem must provide mount method"
@ -3456,7 +3468,7 @@ msgstr "element_size %d é inválido, deve ser, 1, 2, ou 4"
#: shared-bindings/traceback/__init__.c
msgid "invalid exception"
msgstr ""
msgstr "exceção inválida"
#: extmod/modframebuf.c
msgid "invalid format"
@ -3497,7 +3509,7 @@ msgstr "sintaxe inválida para o número"
#: py/objexcept.c shared-bindings/traceback/__init__.c
msgid "invalid traceback"
msgstr ""
msgstr "rastreamento inválido"
#: py/objtype.c
msgid "issubclass() arg 1 must be a class"
@ -3546,10 +3558,6 @@ msgstr "o nível deve estar entre 0 e 1"
msgid "lhs and rhs should be compatible"
msgstr "o lhs e rhs devem ser compatíveis"
#: shared-bindings/traceback/__init__.c
msgid "limit should be an int"
msgstr ""
#: py/emitnative.c
msgid "local '%q' has type '%q' but source is '%q'"
msgstr "o local '%q' tem o tipo '%q', porém a origem é '%q'"
@ -4003,6 +4011,10 @@ msgstr "o pow() com 3 argumentos requer números inteiros"
#: ports/esp32s2/boards/espressif_saola_1_wrover/mpconfigboard.h
#: ports/esp32s2/boards/franzininho_wifi_wroom/mpconfigboard.h
#: ports/esp32s2/boards/franzininho_wifi_wrover/mpconfigboard.h
#: ports/esp32s2/boards/gravitech_cucumber_m/mpconfigboard.h
#: ports/esp32s2/boards/gravitech_cucumber_ms/mpconfigboard.h
#: ports/esp32s2/boards/gravitech_cucumber_r/mpconfigboard.h
#: ports/esp32s2/boards/gravitech_cucumber_rs/mpconfigboard.h
#: ports/esp32s2/boards/lilygo_ttgo_t8_s2_st7789/mpconfigboard.h
#: ports/esp32s2/boards/microdev_micro_s2/mpconfigboard.h
#: ports/esp32s2/boards/muselab_nanoesp32_s2_wroom/mpconfigboard.h
@ -4203,7 +4215,7 @@ msgstr "o stop deve ser 1 ou 2"
msgid "stop not reachable from start"
msgstr "stop não está acessível a partir do início"
#: py/stream.c
#: py/stream.c shared-bindings/getpass/__init__.c
msgid "stream operation not supported"
msgstr "a operação do fluxo não é compatível"
@ -4412,7 +4424,7 @@ msgid "unreadable attribute"
msgstr "atributo ilegível"
#: shared-bindings/displayio/TileGrid.c shared-bindings/vectorio/VectorShape.c
#: shared-module/vectorio/Polygon.c
#: shared-module/vectorio/Polygon.c shared-module/vectorio/VectorShape.c
msgid "unsupported %q type"
msgstr "tipo %q não suportado"
@ -4533,6 +4545,9 @@ msgstr "zi deve ser de um tipo float"
msgid "zi must be of shape (n_section, 2)"
msgstr "zi deve estar na forma (n_section, 2)"
#~ msgid "limit should be an int"
#~ msgstr "o limite deve ser um inteiro"
#~ msgid "no available NIC"
#~ msgstr "não há uma Placa de Rede disponível"

View File

@ -6,7 +6,7 @@ msgstr ""
"Project-Id-Version: PACKAGE VERSION\n"
"Report-Msgid-Bugs-To: \n"
"POT-Creation-Date: 2021-01-04 12:55-0600\n"
"PO-Revision-Date: 2021-08-07 04:00+0000\n"
"PO-Revision-Date: 2021-08-10 02:41+0000\n"
"Last-Translator: Jonny Bergdahl <jonny@bergdahl.it>\n"
"Language-Team: LANGUAGE <LL@li.org>\n"
"Language: sv\n"
@ -42,11 +42,11 @@ msgstr ""
"Vänligen skapa ett ärende med innehållet i din CIRCUITPY-enhet på\n"
"https://github.com/adafruit/circuitpython/issues\n"
#: py/obj.c shared-bindings/traceback/__init__.c
#: py/obj.c
msgid " File \"%q\""
msgstr " Filen \"%q\""
#: py/obj.c shared-bindings/traceback/__init__.c
#: py/obj.c
msgid " File \"%q\", line %d"
msgstr " Fil \"%q\", rad %d"
@ -326,11 +326,15 @@ msgstr "'yield from' i async-funktion"
msgid "'yield' outside function"
msgstr "'yield' utanför funktion"
#: shared-module/vectorio/VectorShape.c
msgid "(x,y) integers required"
msgstr "(x,y) heltal krävs"
#: py/compile.c
msgid "*x must be assignment target"
msgstr "*x måste vara mål för tilldelning"
#: py/obj.c shared-bindings/traceback/__init__.c
#: py/obj.c
msgid ", in %q\n"
msgstr ", i %q\n"
@ -497,6 +501,10 @@ msgstr "Försök att tilldela %d block"
msgid "Attempted heap allocation when VM not running."
msgstr "Försök till heap-allokering när den virtuella maskinen inte är igång."
#: ports/raspberrypi/audio_dma.c
msgid "Audio conversion not implemented"
msgstr ""
#: shared-bindings/wifi/Radio.c
msgid "AuthMode.OPEN is not used with password"
msgstr "AuthMode.OPEN används inte med lösenord"
@ -1232,6 +1240,10 @@ msgstr "Otillräcklig autentisering"
msgid "Insufficient encryption"
msgstr "Otillräcklig kryptering"
#: ports/raspberrypi/audio_dma.c
msgid "Internal audio buffer too small"
msgstr ""
#: ports/stm/common-hal/busio/UART.c
msgid "Internal define error"
msgstr "Internt define-fel"
@ -2251,7 +2263,7 @@ msgstr "Totala data att skriva är större än %q"
msgid "Touch alarms not available"
msgstr "Touchalarm är inte tillgängligt"
#: py/obj.c shared-bindings/traceback/__init__.c
#: py/obj.c
msgid "Traceback (most recent call last):\n"
msgstr "Traceback (senaste anrop):\n"
@ -3511,10 +3523,6 @@ msgstr "level ska ligga mellan 0 och 1"
msgid "lhs and rhs should be compatible"
msgstr "lhs och rhs måste vara kompatibla"
#: shared-bindings/traceback/__init__.c
msgid "limit should be an int"
msgstr "limit måste vara en int"
#: py/emitnative.c
msgid "local '%q' has type '%q' but source is '%q'"
msgstr "lokala '%q' har typ '%q' men källan är '%q'"
@ -3962,6 +3970,10 @@ msgstr "pow() med 3 argument kräver heltal"
#: ports/esp32s2/boards/espressif_saola_1_wrover/mpconfigboard.h
#: ports/esp32s2/boards/franzininho_wifi_wroom/mpconfigboard.h
#: ports/esp32s2/boards/franzininho_wifi_wrover/mpconfigboard.h
#: ports/esp32s2/boards/gravitech_cucumber_m/mpconfigboard.h
#: ports/esp32s2/boards/gravitech_cucumber_ms/mpconfigboard.h
#: ports/esp32s2/boards/gravitech_cucumber_r/mpconfigboard.h
#: ports/esp32s2/boards/gravitech_cucumber_rs/mpconfigboard.h
#: ports/esp32s2/boards/lilygo_ttgo_t8_s2_st7789/mpconfigboard.h
#: ports/esp32s2/boards/microdev_micro_s2/mpconfigboard.h
#: ports/esp32s2/boards/muselab_nanoesp32_s2_wroom/mpconfigboard.h
@ -4162,7 +4174,7 @@ msgstr "stop måste vara 1 eller 2"
msgid "stop not reachable from start"
msgstr "stop kan inte nås från start"
#: py/stream.c
#: py/stream.c shared-bindings/getpass/__init__.c
msgid "stream operation not supported"
msgstr "stream-åtgärd stöds inte"
@ -4371,7 +4383,7 @@ msgid "unreadable attribute"
msgstr "attribut kan inte läsas"
#: shared-bindings/displayio/TileGrid.c shared-bindings/vectorio/VectorShape.c
#: shared-module/vectorio/Polygon.c
#: shared-module/vectorio/Polygon.c shared-module/vectorio/VectorShape.c
msgid "unsupported %q type"
msgstr "typ %q stöds inte"
@ -4492,6 +4504,9 @@ msgstr "zi måste vara av typ float"
msgid "zi must be of shape (n_section, 2)"
msgstr "zi måste vara i formen (n_section, 2)"
#~ msgid "limit should be an int"
#~ msgstr "limit måste vara en int"
#~ msgid "no available NIC"
#~ msgstr "ingen tillgänglig NIC"

View File

@ -43,11 +43,11 @@ msgstr ""
"Qǐng tōngguò https://github.com/adafruit/circuitpython/issues\n"
"tíjiāo yǒuguān nín de CIRCUITPY qūdòngqì nèiróng de wèntí \n"
#: py/obj.c shared-bindings/traceback/__init__.c
#: py/obj.c
msgid " File \"%q\""
msgstr " Wénjiàn \"%q\""
#: py/obj.c shared-bindings/traceback/__init__.c
#: py/obj.c
msgid " File \"%q\", line %d"
msgstr " Wénjiàn \"%q\", dì %d xíng"
@ -328,11 +328,15 @@ msgstr "Yì bù hán shù zhōng de 'yield from'"
msgid "'yield' outside function"
msgstr "'yield' wàibù gōngnéng"
#: shared-module/vectorio/VectorShape.c
msgid "(x,y) integers required"
msgstr ""
#: py/compile.c
msgid "*x must be assignment target"
msgstr "*x bìxū shì rènwù mùbiāo"
#: py/obj.c shared-bindings/traceback/__init__.c
#: py/obj.c
msgid ", in %q\n"
msgstr ", zài %q\n"
@ -499,6 +503,10 @@ msgstr "cháng shì fēn pèi %d kuài"
msgid "Attempted heap allocation when VM not running."
msgstr "dāng VM bú yùn xíng shí, cháng shì duī fēn pèi."
#: ports/raspberrypi/audio_dma.c
msgid "Audio conversion not implemented"
msgstr ""
#: shared-bindings/wifi/Radio.c
msgid "AuthMode.OPEN is not used with password"
msgstr "AuthMode.OPEN wèi shǐ yòng mì mǎ"
@ -1235,6 +1243,10 @@ msgstr "Rènzhèng bùzú"
msgid "Insufficient encryption"
msgstr "Jiāmì bùzú"
#: ports/raspberrypi/audio_dma.c
msgid "Internal audio buffer too small"
msgstr ""
#: ports/stm/common-hal/busio/UART.c
msgid "Internal define error"
msgstr "Nèibù dìngyì cuòwù"
@ -2252,7 +2264,7 @@ msgstr "yào biān xiě de zǒng shù jù dà yú %q"
msgid "Touch alarms not available"
msgstr "bù kě yòng chù mō bào jǐng qì"
#: py/obj.c shared-bindings/traceback/__init__.c
#: py/obj.c
msgid "Traceback (most recent call last):\n"
msgstr "Traceback (Zuìjìn yīcì dǎ diànhuà):\n"
@ -3512,10 +3524,6 @@ msgstr "Level bìxū jiè yú 0 hé 1 zhī jiān"
msgid "lhs and rhs should be compatible"
msgstr "lhs hé rhs yīnggāi jiānróng"
#: shared-bindings/traceback/__init__.c
msgid "limit should be an int"
msgstr ""
#: py/emitnative.c
msgid "local '%q' has type '%q' but source is '%q'"
msgstr "bendì '%q' bāohán lèixíng '%q' dàn yuán shì '%q'"
@ -3962,6 +3970,10 @@ msgstr "pow() yǒu 3 cānshù xūyào zhěngshù"
#: ports/esp32s2/boards/espressif_saola_1_wrover/mpconfigboard.h
#: ports/esp32s2/boards/franzininho_wifi_wroom/mpconfigboard.h
#: ports/esp32s2/boards/franzininho_wifi_wrover/mpconfigboard.h
#: ports/esp32s2/boards/gravitech_cucumber_m/mpconfigboard.h
#: ports/esp32s2/boards/gravitech_cucumber_ms/mpconfigboard.h
#: ports/esp32s2/boards/gravitech_cucumber_r/mpconfigboard.h
#: ports/esp32s2/boards/gravitech_cucumber_rs/mpconfigboard.h
#: ports/esp32s2/boards/lilygo_ttgo_t8_s2_st7789/mpconfigboard.h
#: ports/esp32s2/boards/microdev_micro_s2/mpconfigboard.h
#: ports/esp32s2/boards/muselab_nanoesp32_s2_wroom/mpconfigboard.h
@ -4162,7 +4174,7 @@ msgstr "tíngzhǐ bìxū wèi 1 huò 2"
msgid "stop not reachable from start"
msgstr "tíngzhǐ wúfǎ cóng kāishǐ zhōng zhǎodào"
#: py/stream.c
#: py/stream.c shared-bindings/getpass/__init__.c
msgid "stream operation not supported"
msgstr "bù zhīchí liú cāozuò"
@ -4371,7 +4383,7 @@ msgid "unreadable attribute"
msgstr "bùkě dú shǔxìng"
#: shared-bindings/displayio/TileGrid.c shared-bindings/vectorio/VectorShape.c
#: shared-module/vectorio/Polygon.c
#: shared-module/vectorio/Polygon.c shared-module/vectorio/VectorShape.c
msgid "unsupported %q type"
msgstr "bù zhīchí %q lèixíng"

View File

@ -157,7 +157,13 @@ void audio_dma_load_next_block(audio_dma_t *dma) {
if (dma->loop) {
audiosample_reset_buffer(dma->sample, dma->single_channel_output, dma->audio_channel);
} else {
descriptor->DESCADDR.reg = 0;
if ((output_buffer_length == 0) && dma_transfer_status(SHARED_RX_CHANNEL) & 0x3) {
// Nothing further to read and previous buffer is finished.
audio_dma_stop(dma);
} else {
// Break descriptor chain.
descriptor->DESCADDR.reg = 0;
}
}
}
descriptor->BTCTRL.bit.VALID = true;
@ -214,21 +220,23 @@ audio_dma_result audio_dma_setup_playback(audio_dma_t *dma,
if (output_signed != samples_signed) {
output_spacing = 1;
max_buffer_length /= dma->spacing;
dma->first_buffer = (uint8_t *)m_realloc(dma->first_buffer, max_buffer_length);
if (dma->first_buffer == NULL) {
}
dma->first_buffer = (uint8_t *)m_realloc(dma->first_buffer, max_buffer_length);
if (dma->first_buffer == NULL) {
return AUDIO_DMA_MEMORY_ERROR;
}
dma->first_buffer_free = true;
if (!single_buffer) {
dma->second_buffer = (uint8_t *)m_realloc(dma->second_buffer, max_buffer_length);
if (dma->second_buffer == NULL) {
return AUDIO_DMA_MEMORY_ERROR;
}
dma->first_buffer_free = true;
if (!single_buffer) {
dma->second_buffer = (uint8_t *)m_realloc(dma->second_buffer, max_buffer_length);
if (dma->second_buffer == NULL) {
return AUDIO_DMA_MEMORY_ERROR;
}
}
dma->signed_to_unsigned = !output_signed && samples_signed;
dma->unsigned_to_signed = output_signed && !samples_signed;
}
dma->signed_to_unsigned = !output_signed && samples_signed;
dma->unsigned_to_signed = output_signed && !samples_signed;
dma->event_channel = 0xff;
if (!single_buffer) {
dma->second_descriptor = (DmacDescriptor *)m_malloc(sizeof(DmacDescriptor), false);
@ -265,13 +273,13 @@ audio_dma_result audio_dma_setup_playback(audio_dma_t *dma,
#ifdef SAM_D5X_E5X
int irq = dma->event_channel < 4 ? EVSYS_0_IRQn + dma->event_channel : EVSYS_4_IRQn;
// Only disable and clear on SAMD51 because the SAMD21 shares EVSYS with ticks.
NVIC_DisableIRQ(irq);
NVIC_ClearPendingIRQ(irq);
#else
int irq = EVSYS_IRQn;
#endif
NVIC_DisableIRQ(irq);
NVIC_ClearPendingIRQ(irq);
DmacDescriptor *first_descriptor = dma_descriptor(dma_channel);
setup_audio_descriptor(first_descriptor, dma->beat_size, output_spacing, output_register_address);
if (single_buffer) {
@ -366,7 +374,7 @@ STATIC void dma_callback_fun(void *arg) {
audio_dma_load_next_block(dma);
}
void evsyshandler_common(void) {
void audio_evsys_handler(void) {
for (uint8_t i = 0; i < AUDIO_DMA_CHANNEL_COUNT; i++) {
audio_dma_t *dma = audio_dma_state[i];
if (dma == NULL) {
@ -380,26 +388,4 @@ void evsyshandler_common(void) {
}
}
#ifdef SAM_D5X_E5X
void EVSYS_0_Handler(void) {
evsyshandler_common();
}
void EVSYS_1_Handler(void) {
evsyshandler_common();
}
void EVSYS_2_Handler(void) {
evsyshandler_common();
}
void EVSYS_3_Handler(void) {
evsyshandler_common();
}
void EVSYS_4_Handler(void) {
evsyshandler_common();
}
#else
void EVSYS_Handler(void) {
evsyshandler_common();
}
#endif
#endif

View File

@ -99,4 +99,6 @@ void audio_dma_background(void);
uint8_t find_sync_event_channel_raise(void);
void audio_evsys_handler(void);
#endif // MICROPY_INCLUDED_ATMEL_SAMD_AUDIO_DMA_H

View File

@ -2,6 +2,7 @@
#define MICROPY_HW_MCU_NAME "samd21e18"
#define MICROPY_HW_NEOPIXEL (&pin_PA15)
#define MICROPY_HW_NEOPIXEL_COUNT (2)
#define IGNORE_PIN_PA01 1
#define IGNORE_PIN_PA02 1

View File

@ -14,11 +14,14 @@ CIRCUITPY_FULL_BUILD = 0
CIRCUITPY_ANALOGIO = 0
CIRCUITPY_AUDIOCORE = 0
CIRCUITPY_BUSIO_SPI = 0
CIRCUITPY_BUSIO_UART = 0
CIRCUITPY_PULSEIO = 0
CIRCUITPY_PWMIO = 0
CIRCUITPY_ROTARYIO = 0
CIRCUITPY_RTC = 0
CIRCUITPY_USB_MIDI = 0
CIRCUITPY_GETPASS = 0
CIRCUITPY_TRACEBACK = 0
CIRCUITPY_PIXELBUF = 1

View File

@ -16,3 +16,16 @@
// USB is always used internally so skip the pin objects for it.
#define IGNORE_PIN_PA24 1
#define IGNORE_PIN_PA25 1
// USD ID
#define IGNORE_PIN_PA18 1
// Hooked to the external crystal
#define IGNORE_PIN_PA00 1
#define IGNORE_PIN_PA01 1
// SWD only
#define IGNORE_PIN_PA30 1
#define IGNORE_PIN_PA31 1
// Not connected
#define IGNORE_PIN_PA28 1

View File

@ -16,3 +16,11 @@
// USB is always used internally so skip the pin objects for it.
#define IGNORE_PIN_PA24 1
#define IGNORE_PIN_PA25 1
// Not connected
#define IGNORE_PIN_PA00 1
#define IGNORE_PIN_PA01 1
// SWD only
#define IGNORE_PIN_PA30 1
#define IGNORE_PIN_PA31 1

View File

@ -52,6 +52,8 @@ STATIC const mp_rom_map_elem_t board_global_dict_table[] = {
{ MP_OBJ_NEW_QSTR(MP_QSTR_D10), MP_ROM_PTR(&pin_PB22) },
{ MP_OBJ_NEW_QSTR(MP_QSTR_D11), MP_ROM_PTR(&pin_PB23) },
{ MP_OBJ_NEW_QSTR(MP_QSTR_D12), MP_ROM_PTR(&pin_PB00) },
{ MP_OBJ_NEW_QSTR(MP_QSTR_LED), MP_ROM_PTR(&pin_PB01) },
{ MP_OBJ_NEW_QSTR(MP_QSTR_D13), MP_ROM_PTR(&pin_PB01) },
{ MP_OBJ_NEW_QSTR(MP_QSTR_TX3), MP_ROM_PTR(&pin_PB16) },

View File

@ -9,3 +9,5 @@ CHIP_FAMILY = samd21
INTERNAL_FLASH_FILESYSTEM = 1
LONGINT_IMPL = NONE
CIRCUITPY_FULL_BUILD = 0
CIRCUITPY_GETPASS = 0

View File

@ -1,8 +1,11 @@
#define MICROPY_HW_BOARD_NAME "SparkFun MicroMod SAMD51"
#define MICROPY_HW_BOARD_NAME "SparkFun MicroMod SAMD51 Processor"
#define MICROPY_HW_MCU_NAME "samd51j20"
#define CIRCUITPY_MCU_FAMILY samd51
// Status LED
#define MICROPY_HW_LED_STATUS (&pin_PA23)
// On-board flash
#define SPI_FLASH_MOSI_PIN &pin_PA09
#define SPI_FLASH_MISO_PIN &pin_PA10

View File

@ -1,7 +1,7 @@
LD_FILE = boards/samd51x20-bootloader-external-flash.ld
USB_VID = 0x1b4f
USB_PID = 0x0020 # Used by uf2 bootloader
USB_PRODUCT = "SparkFun MicroMod SAMD51"
USB_PRODUCT = "SparkFun MicroMod SAMD51 Processor"
USB_MANUFACTURER = "SparkFun Electronics"
CHIP_VARIANT = SAMD51J20A

View File

@ -1,97 +1,224 @@
/*
* This file is part of the MicroPython project, http://micropython.org/
*
* The MIT License (MIT)
*
* Copyright (c) 2017 Scott Shawcroft for Adafruit Industries
* Copyright (c) 2021 Chris Wilson
*
* Permission is hereby granted, free of charge, to any person obtaining a copy
* of this software and associated documentation files (the "Software"), to deal
* in the Software without restriction, including without limitation the rights
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
* copies of the Software, and to permit persons to whom the Software is
* furnished to do so, subject to the following conditions:
*
* The above copyright notice and this permission notice shall be included in
* all copies or substantial portions of the Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
* THE SOFTWARE.
*/
#include "shared-bindings/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) },
// The SparkFun MicroMod spec uses a zero-based peripheral numbering scheme.
// The 0th peripheral is the default and the "0" is omitted from the
// peripheral name (e.g. "I2C" instead of "I2C0").
//
// For more details, see https://www.sparkfun.com/micromod#tech-specs
// 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) },
// MicroMod built-in status LED pin
// Requirement from the "Designing with MicroMod" SparkFun article:
// "... every Processor Board shall include one status LED connected to a
// pin that is not connected to the board edge."
{ MP_ROM_QSTR(MP_QSTR_LED), MP_ROM_PTR(&pin_PA23) }, // MicroMod LED (PA23)
// DAC
{ MP_ROM_QSTR(MP_QSTR_DAC), MP_ROM_PTR(&pin_PA02) },
// MicroMod USB bus input voltage (+5V) pin
// { MP_ROM_QSTR(MP_QSTR_USB_VIN), MP_ROM_PTR() }, // MicroMod USB_VIN (not connected)
// 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) },
// MicroMod +3.3V enable pin
{ MP_ROM_QSTR(MP_QSTR_P3V3_EN), MP_ROM_PTR(&pin_PA19) }, // MicroMod 3.3V_EN (PA19)
// 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) },
// MicroMod battery voltage sense pin
{ MP_ROM_QSTR(MP_QSTR_BATT_VIN3), MP_ROM_PTR(&pin_PB03) }, // MicroMod BATT_VIN/3 (PB03)
// 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) },
// MicroMod reset pin
// { MP_ROM_QSTR(MP_QSTR_RESET), MP_ROM_PTR() }, // MicroMod RESET# (SAMD51 has a dedicated HW RESETN pin)
// 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) },
// MicroMod boot pin
// { MP_ROM_QSTR(MP_QSTR_BOOT), MP_ROM_PTR() }, // MicroMod BOOT (not connected)
{ MP_ROM_QSTR(MP_QSTR_I2C_INT), MP_ROM_PTR(&pin_PA18) },
// MicroMod USB device pins
// USB device is always used internally by CircuitPython, so skip creating
// the pin objects for it. See explicit ignores in mpconfigboard.h.
// { MP_ROM_QSTR(MP_QSTR_USB_DM), MP_ROM_PTR(&pin_PA24) }, // MicroMod USB_D- (PA24)
// { MP_ROM_QSTR(MP_QSTR_USB_DP), MP_ROM_PTR(&pin_PA25) }, // MicroMod USB_D+ (PA25)
// I2C2
{ MP_ROM_QSTR(MP_QSTR_SDA2), MP_ROM_PTR(&pin_PA13) },
{ MP_ROM_QSTR(MP_QSTR_SCL2), MP_ROM_PTR(&pin_PA12) },
// MicroMod USB host pins
// { MP_ROM_QSTR(MP_QSTR_USBHOST_DM), MP_ROM_PTR() }, // MicroMod USBHOST_D- (not connected)
// { MP_ROM_QSTR(MP_QSTR_USBHOST_DP), MP_ROM_PTR() }, // MicroMod USBHOST_D+ (not connected)
// 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) },
// MicroMod CAN pins
{ MP_ROM_QSTR(MP_QSTR_CAN_RX), MP_ROM_PTR(&pin_PB15) }, // MicroMod CAN_RX (PB15)
{ MP_ROM_QSTR(MP_QSTR_CAN_TX), MP_ROM_PTR(&pin_PB14) }, // MicroMod CAN_TX (PB14)
// Status LED
{ MP_ROM_QSTR(MP_QSTR_LED), MP_ROM_PTR(&pin_PA23) },
// Note: MicroMod UART (UART0) is not present in the edge connector pinout
// because the primary debug serial port is exposed as a virtual serial port
// over USB.
// 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) },
// MicroMod UART1 pins
{ MP_ROM_QSTR(MP_QSTR_UART_TX1), MP_ROM_PTR(&pin_PB31) }, // MicroMod UART_TX1 | CircuitPython TX (PB31)
{ MP_ROM_QSTR(MP_QSTR_UART_RX1), MP_ROM_PTR(&pin_PB30) }, // MicroMod UART_RX1 | CircuitPython RX (PB30)
// { MP_ROM_QSTR(MP_QSTR_UART_RTS1), MP_ROM_PTR() }, // MicroMod RTS1 (not connected)
// { MP_ROM_QSTR(MP_QSTR_UART_CTS1), MP_ROM_PTR() }, // MicroMod CTS1 (not connected)
// UART2
{ MP_ROM_QSTR(MP_QSTR_RX2), MP_ROM_PTR(&pin_PA13) },
{ MP_ROM_QSTR(MP_QSTR_TX2), MP_ROM_PTR(&pin_PA12) },
// CircuitPython default UART pins
{ MP_ROM_QSTR(MP_QSTR_TX), MP_ROM_PTR(&pin_PB31) }, // CircuitPython TX | MicroMod UART_TX1 (PB31)
{ MP_ROM_QSTR(MP_QSTR_RX), MP_ROM_PTR(&pin_PB30) }, // CircuitPython RX | MicroMod UART_RX1 (PB30)
// MicroMod UART2 pins
{ MP_ROM_QSTR(MP_QSTR_UART_TX2), MP_ROM_PTR(&pin_PA12) }, // MicroMod UART_TX2 (PA12)
{ MP_ROM_QSTR(MP_QSTR_UART_RX2), MP_ROM_PTR(&pin_PA13) }, // MicroMod UART_RX2 (PA13)
// 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) },
// MicroMod I2C pins
{ MP_ROM_QSTR(MP_QSTR_I2C_SDA), MP_ROM_PTR(&pin_PA17) }, // MicroMod I2C_SDA | CircuitPython SDA (PA17)
{ MP_ROM_QSTR(MP_QSTR_I2C_SCL), MP_ROM_PTR(&pin_PA16) }, // MicroMod I2C_SCL | CircuitPython SCL (PA16)
// CircuitPython default I2C pins
{ MP_ROM_QSTR(MP_QSTR_SDA), MP_ROM_PTR(&pin_PA17) }, // CircuitPython SDA | MicroMod I2C_SDA (PA17)
{ MP_ROM_QSTR(MP_QSTR_SCL), MP_ROM_PTR(&pin_PA16) }, // CircuitPython SCL | MicroMod I2C_SCL (PA16)
// MicroMod I2C interrupt pin
{ MP_ROM_QSTR(MP_QSTR_I2C_INT), MP_ROM_PTR(&pin_PA18) }, // MicroMod I2C_INT (PA18)
// MicroMod I2C1 pins
{ MP_ROM_QSTR(MP_QSTR_I2C_SDA1), MP_ROM_PTR(&pin_PA13) }, // MicroMod I2C_SDA1 (PA13)
{ MP_ROM_QSTR(MP_QSTR_I2C_SCL1), MP_ROM_PTR(&pin_PA12) }, // MicroMod I2C_SCL1 (PA12)
// MicroMod SPI pins
{ MP_ROM_QSTR(MP_QSTR_SPI_CIPO), MP_ROM_PTR(&pin_PA06) }, // MicroMod SPI_CIPO | CircuitPython CIPO (PA06)
{ MP_ROM_QSTR(MP_QSTR_SPI_MISO), MP_ROM_PTR(&pin_PA06) }, // MicroMod SPI_MISO | CircuitPython MISO (PA06)
{ MP_ROM_QSTR(MP_QSTR_SPI_COPI), MP_ROM_PTR(&pin_PA04) }, // MicroMod SPI_COPI | CircuitPython COPI | LED_DAT (PA04)
{ MP_ROM_QSTR(MP_QSTR_SPI_MOSI), MP_ROM_PTR(&pin_PA04) }, // MicroMod SPI_MOSI | CircuitPython MOSI (PA04)
{ MP_ROM_QSTR(MP_QSTR_SPI_SCK), MP_ROM_PTR(&pin_PA05) }, // MicroMod SPI_SCK | CircuitPython SCK | LED_CLK (PA05)
{ MP_ROM_QSTR(MP_QSTR_SPI_CS), MP_ROM_PTR(&pin_PA07) }, // MicroMod SPI_CS | CircuitPython CS (PA07)
// CircuitPython default SPI pins
{ MP_ROM_QSTR(MP_QSTR_CIPO), MP_ROM_PTR(&pin_PA06) }, // CircuitPython CIPO | MicroMod SPI_CIPO (PA06)
{ MP_ROM_QSTR(MP_QSTR_MISO), MP_ROM_PTR(&pin_PA06) }, // CircuitPython MISO | MicroMod SPI_MISO (PA06)
{ MP_ROM_QSTR(MP_QSTR_COPI), MP_ROM_PTR(&pin_PA04) }, // CircuitPython COPI | MicroMod SPI_COPI | LED_DAT (PA04)
{ MP_ROM_QSTR(MP_QSTR_MOSI), MP_ROM_PTR(&pin_PA04) }, // CircuitPython MOSI | MicroMod SPI_MOSI (PA04)
{ MP_ROM_QSTR(MP_QSTR_SCK), MP_ROM_PTR(&pin_PA05) }, // CircuitPython SCK | MicroMod SPI_SCK | LED_CLK (PA05)
{ MP_ROM_QSTR(MP_QSTR_CS), MP_ROM_PTR(&pin_PA07) }, // CircuitPython CS | MicroMod SPI_CS (PA07)
// MicroMod 2-wire serial LED pins
{ MP_ROM_QSTR(MP_QSTR_LED_DAT), MP_ROM_PTR(&pin_PA04) }, // MicroMod LED_DAT | SPI_COPI (PA04)
{ MP_ROM_QSTR(MP_QSTR_LED_CLK), MP_ROM_PTR(&pin_PA05) }, // MicroMod LED_CLK | SPI_SCK (PA05)
// MicroMod SDIO pins
// { MP_ROM_QSTR(MP_QSTR_SDIO_CLK), MP_ROM_PTR() }, // MicroMod SDIO_SCK | SPI_SCK1 (not connected)
// { MP_ROM_QSTR(MP_QSTR_SDIO_CMD), MP_ROM_PTR() }, // MicroMod SDIO_CMD | SPI_COPI1 (not connected)
// { MP_ROM_QSTR(MP_QSTR_SDIO_DATA0), MP_ROM_PTR() }, // MicroMod SDIO_DATA0 | SPI_CIPO1 (not connected)
// { MP_ROM_QSTR(MP_QSTR_SDIO_DATA1), MP_ROM_PTR() }, // MicroMod SDIO_DATA1 (not connected)
// { MP_ROM_QSTR(MP_QSTR_SDIO_DATA2), MP_ROM_PTR() }, // MicroMod SDIO_DATA2 (not connected)
// { MP_ROM_QSTR(MP_QSTR_SDIO_DATA3), MP_ROM_PTR() }, // MicroMod SDIO_DATA3 | SPI_CS1 (not connected)
// MicroMod SPI1 pins
// { MP_ROM_QSTR(MP_QSTR_SPI_CIPO1), MP_ROM_PTR() }, // MicroMod SPI_CIPO1 | SDIO_DATA0 (not connected)
// { MP_ROM_QSTR(MP_QSTR_SPI_MISO1), MP_ROM_PTR() }, // MicroMod SPI_MISO1 (not connected)
// { MP_ROM_QSTR(MP_QSTR_SPI_COPI1), MP_ROM_PTR() }, // MicroMod SPI_COPI1 | SDIO_CMD (not connected)
// { MP_ROM_QSTR(MP_QSTR_SPI_MOSI1), MP_ROM_PTR() }, // MicroMod SPI_MOSI1 (not connected)
// { MP_ROM_QSTR(MP_QSTR_SPI_SCK1), MP_ROM_PTR() }, // MicroMod SPI_SCK1 | SDIO_SCK (not connected)
// { MP_ROM_QSTR(MP_QSTR_SPI_CS1), MP_ROM_PTR() }, // MicroMod SPI_CS1 | SDIO_DATA3 (not connected)
// MicroMod audio pins
{ MP_ROM_QSTR(MP_QSTR_AUD_MCLK), MP_ROM_PTR(&pin_PB17) }, // MicroMod AUD_MCLK (PB17)
{ MP_ROM_QSTR(MP_QSTR_AUD_OUT), MP_ROM_PTR(&pin_PA21) }, // MicroMod AUD_OUT | I2S_OUT | PCM_OUT | CAM_MCLK (PA21)
{ MP_ROM_QSTR(MP_QSTR_AUD_IN), MP_ROM_PTR(&pin_PA22) }, // MicroMod AUD_IN | I2S_IN | PCM_IN | CAM_PCLK (PA22)
{ MP_ROM_QSTR(MP_QSTR_AUD_LRCLK), MP_ROM_PTR(&pin_PA20) }, // MicroMod AUD_LRCLK | I2S_WS | PCM_SYNC | PDM_DATA (PA20)
{ MP_ROM_QSTR(MP_QSTR_AUD_BCLK), MP_ROM_PTR(&pin_PB16) }, // MicroMod AUD_BCLK | I2S_SCK | PCM_CLK | PDM_CLK (PB16)
// MicroMod I2S pins
{ MP_ROM_QSTR(MP_QSTR_I2S_OUT), MP_ROM_PTR(&pin_PA21) }, // MicroMod I2S_OUT | AUD_OUT | PCM_OUT | CAM_MCLK (PA21)
{ MP_ROM_QSTR(MP_QSTR_I2S_IN), MP_ROM_PTR(&pin_PA22) }, // MicroMod I2S_IN | AUD_IN | PCM_IN | CAM_PCLK (PA22)
{ MP_ROM_QSTR(MP_QSTR_I2S_WS), MP_ROM_PTR(&pin_PA20) }, // MicroMod I2S_WS | AUD_LRCLK | PCM_SYNC | PDM_DATA (PA20)
{ MP_ROM_QSTR(MP_QSTR_I2S_SCK), MP_ROM_PTR(&pin_PB16) }, // MicroMod I2S_SCK | AUD_BCLK | PCM_CLK | PDM_CLK (PB16)
// MicroMod PCM pins
{ MP_ROM_QSTR(MP_QSTR_PCM_OUT), MP_ROM_PTR(&pin_PA21) }, // MicroMod PCM_OUT | AUD_OUT | I2S_OUT | CAM_MCLK (PA21)
{ MP_ROM_QSTR(MP_QSTR_PCM_IN), MP_ROM_PTR(&pin_PA22) }, // MicroMod PCM_IN | AUD_IN | I2S_IN | CAM_PCLK (PA22)
{ MP_ROM_QSTR(MP_QSTR_PCM_SYNC), MP_ROM_PTR(&pin_PA20) }, // MicroMod PCM_SYNC | AUD_LRCLK | I2S_WS | PDM_DATA (PA20)
{ MP_ROM_QSTR(MP_QSTR_PCM_CLK), MP_ROM_PTR(&pin_PB16) }, // MicroMod PCM_CLK | AUD_BCLK | I2S_SCK | PDM_CLK (PB16)
// MicroMod PDM pins
{ MP_ROM_QSTR(MP_QSTR_PDM_DATA), MP_ROM_PTR(&pin_PA20) }, // MicroMod PDM_DATA | AUD_LRCLK | I2S_WS | PCM_SYNC (PA20)
{ MP_ROM_QSTR(MP_QSTR_PDM_CLK), MP_ROM_PTR(&pin_PB16) }, // MicroMod PDM_CLK | AUD_BCLK | I2S_SCK | PCM_CLK (PB16)
// MicroMod SWD pins
{ MP_ROM_QSTR(MP_QSTR_SWDIO), MP_ROM_PTR(&pin_PA31) }, // MicroMod SWDIO (PA31)
{ MP_ROM_QSTR(MP_QSTR_SWCLK), MP_ROM_PTR(&pin_PA30) }, // MicroMod SWDCK (PA30)
// { MP_ROM_QSTR(MP_QSTR_SWO), MP_ROM_PTR() }, // MicroMod SWO | G11 (not connected)
// MicroMod ADC pins
{ MP_ROM_QSTR(MP_QSTR_A0), MP_ROM_PTR(&pin_PA02) }, // MicroMod A0 (PA02)
{ MP_ROM_QSTR(MP_QSTR_A1), MP_ROM_PTR(&pin_PB00) }, // MicroMod A1 (PB00)
// MicroMod PWM pins
{ MP_ROM_QSTR(MP_QSTR_PWM0), MP_ROM_PTR(&pin_PB01) }, // MicroMod PWM0 (PB01)
{ MP_ROM_QSTR(MP_QSTR_PWM1), MP_ROM_PTR(&pin_PB02) }, // MicroMod PWM1 (PB02)
// MicroMod digital pins
{ MP_ROM_QSTR(MP_QSTR_D0), MP_ROM_PTR(&pin_PB04) }, // MicroMod D0 (PB04)
{ MP_ROM_QSTR(MP_QSTR_D1), MP_ROM_PTR(&pin_PB05) }, // MicroMod D1 | CAM_TRIG (PB05)
// MicroMod general purpose pins
{ MP_ROM_QSTR(MP_QSTR_G0), MP_ROM_PTR(&pin_PB06) }, // MicroMod G0 | BUS0 (PB06)
{ MP_ROM_QSTR(MP_QSTR_G1), MP_ROM_PTR(&pin_PB07) }, // MicroMod G1 | BUS1 (PB07)
{ MP_ROM_QSTR(MP_QSTR_G2), MP_ROM_PTR(&pin_PB08) }, // MicroMod G2 | BUS2 (PB08)
{ MP_ROM_QSTR(MP_QSTR_G3), MP_ROM_PTR(&pin_PB09) }, // MicroMod G3 | BUS3 (PB09)
{ MP_ROM_QSTR(MP_QSTR_G4), MP_ROM_PTR(&pin_PB10) }, // MicroMod G4 | BUS4 (PB10)
{ MP_ROM_QSTR(MP_QSTR_G5), MP_ROM_PTR(&pin_PB11) }, // MicroMod G5 | BUS5 (PB11)
{ MP_ROM_QSTR(MP_QSTR_G6), MP_ROM_PTR(&pin_PB12) }, // MicroMod G6 | BUS6 (PB12)
{ MP_ROM_QSTR(MP_QSTR_G7), MP_ROM_PTR(&pin_PB13) }, // MicroMod G7 | BUS7 (PB13)
{ MP_ROM_QSTR(MP_QSTR_G8), MP_ROM_PTR(&pin_PA14) }, // MicroMod G8 (PA14)
{ MP_ROM_QSTR(MP_QSTR_G9), MP_ROM_PTR(&pin_PA15) }, // MicroMod G9 | ADC_D- | CAM_HSYNC (PA15)
// { MP_ROM_QSTR(MP_QSTR_G10), MP_ROM_PTR() }, // MicroMod G10 | ADC_D+ | CAM_VSYNC (not connected)
{ MP_ROM_QSTR(MP_QSTR_G11), MP_ROM_PTR(&pin_PA27) }, // MicroMod G11 | SWO (PA27)
// MicroMod 8-bit bus pins
{ MP_ROM_QSTR(MP_QSTR_BUS0), MP_ROM_PTR(&pin_PB06) }, // MicroMod BUS0 | G0 (PB06)
{ MP_ROM_QSTR(MP_QSTR_BUS1), MP_ROM_PTR(&pin_PB07) }, // MicroMod BUS1 | G1 (PB07)
{ MP_ROM_QSTR(MP_QSTR_BUS2), MP_ROM_PTR(&pin_PB08) }, // MicroMod BUS2 | G2 (PB08)
{ MP_ROM_QSTR(MP_QSTR_BUS3), MP_ROM_PTR(&pin_PB09) }, // MicroMod BUS3 | G3 (PB09)
{ MP_ROM_QSTR(MP_QSTR_BUS4), MP_ROM_PTR(&pin_PB10) }, // MicroMod BUS4 | G4 (PB10)
{ MP_ROM_QSTR(MP_QSTR_BUS5), MP_ROM_PTR(&pin_PB11) }, // MicroMod BUS5 | G5 (PB11)
{ MP_ROM_QSTR(MP_QSTR_BUS6), MP_ROM_PTR(&pin_PB12) }, // MicroMod BUS6 | G6 (PB12)
{ MP_ROM_QSTR(MP_QSTR_BUS7), MP_ROM_PTR(&pin_PB13) }, // MicroMod BUS7 | G7 (PB13)
// MicroMod differential ADC input pins
// { MP_ROM_QSTR(MP_QSTR_ADC_DM), MP_ROM_PTR(&pin_PA15) }, // MicroMod ADC_D- | G9 | CAM_HSYNC (PA15)
// { MP_ROM_QSTR(MP_QSTR_ADC_DP), MP_ROM_PTR() }, // MicroMod ADC_D+ | G10 | CAM_VSYNC (not connected)
// MicroMod camera pins
// { MP_ROM_QSTR(MP_QSTR_CAM_MCLK), MP_ROM_PTR(&pin_PA21) }, // MicroMod CAM_MCLK | AUD_OUT | I2S_OUT | PCM_OUT (PA21)
// { MP_ROM_QSTR(MP_QSTR_CAM_PCLK), MP_ROM_PTR(&pin_PA22) }, // MicroMod CAM_PCLK | AUD_IN | I2S_IN | PCM_IN (PA22)
// { MP_ROM_QSTR(MP_QSTR_CAM_TRIG), MP_ROM_PTR(&pin_PB05) }, // MicroMod CAM_TRIG | D1 (PB05)
// { MP_ROM_QSTR(MP_QSTR_CAM_HSYNC), MP_ROM_PTR(&pin_PA15 }, // MicroMod CAM_HSYNC | ADC_D- | G9 (PA15)
// { MP_ROM_QSTR(MP_QSTR_CAM_VSYNC), MP_ROM_PTR() }, // MicroMod CAM_VSYNC | ADC_D+ | G10 (not connected)
// Module-specific aliases (not part of the MicroMod spec)
{ MP_ROM_QSTR(MP_QSTR_HOST_ENABLE), MP_ROM_PTR(&pin_PA27) }, // HOST_ENABLE | G11 | SWO (PA27)
// CircuitPython board objects
{ MP_ROM_QSTR(MP_QSTR_I2C), MP_ROM_PTR(&board_i2c_obj) }, // CircuitPython I2C
{ MP_ROM_QSTR(MP_QSTR_SPI), MP_ROM_PTR(&board_spi_obj) }, // CircuitPython SPI
{ MP_ROM_QSTR(MP_QSTR_UART), MP_ROM_PTR(&board_uart_obj) }, // CircuitPython UART
};
MP_DEFINE_CONST_DICT(board_module_globals, board_global_dict_table);

View File

@ -71,7 +71,7 @@
void i2sout_reset(void) {
// Make sure the I2S peripheral is running so we can see if the resources we need are free.
#ifdef SAM_D5X_E5X
// Connect the clock units to the 2mhz clock. It can't disable without it.
// Connect the clock units to the 2MHz clock. It can't disable without it.
connect_gclk_to_peripheral(5, I2S_GCLK_ID_0);
connect_gclk_to_peripheral(5, I2S_GCLK_ID_1);
#endif
@ -83,7 +83,7 @@ void i2sout_reset(void) {
// Make sure the I2S peripheral is running so we can see if the resources we need are free.
#ifdef SAM_D5X_E5X
// Connect the clock units to the 2mhz clock by default. They can't reset without it.
// Connect the clock units to the 2MHz clock by default. They can't reset without it.
disconnect_gclk_from_peripheral(5, I2S_GCLK_ID_0);
disconnect_gclk_from_peripheral(5, I2S_GCLK_ID_1);
@ -222,7 +222,6 @@ void common_hal_audiobusio_i2sout_deinit(audiobusio_i2sout_obj_t *self) {
reset_pin_number(self->word_select->number);
self->word_select = NULL;
reset_pin_number(self->data->number);
self->data = NULL;
}
void common_hal_audiobusio_i2sout_play(audiobusio_i2sout_obj_t *self,
@ -288,7 +287,7 @@ void common_hal_audiobusio_i2sout_play(audiobusio_i2sout_obj_t *self,
I2S->TXCTRL.reg = serctrl;
#endif
// The DFLL is always a 48mhz clock
// The DFLL is always a 48MHz clock
enable_clock_generator(self->gclk, CLOCK_48MHZ, divisor);
connect_gclk_to_peripheral(self->gclk, I2S_GCLK_ID_0 + self->clock_unit);

View File

@ -272,6 +272,9 @@ void common_hal_pulseio_pulsein_deinit(pulseio_pulsein_obj_t *self) {
void common_hal_pulseio_pulsein_pause(pulseio_pulsein_obj_t *self) {
uint32_t mask = 1 << self->channel;
EIC->INTENCLR.reg = mask << EIC_INTENSET_EXTINT_Pos;
#ifdef SAMD21
rtc_end_pulse();
#endif
}
void common_hal_pulseio_pulsein_resume(pulseio_pulsein_obj_t *self,
@ -299,6 +302,9 @@ void common_hal_pulseio_pulsein_resume(pulseio_pulsein_obj_t *self,
EIC->INTFLAG.reg = mask << EIC_INTFLAG_EXTINT_Pos;
EIC->INTENSET.reg = mask << EIC_INTENSET_EXTINT_Pos;
#ifdef SAMD21
rtc_start_pulse();
#endif
pulsein_set_config(self, true);
}

View File

@ -91,26 +91,19 @@
#if CIRCUITPY_PEW
#include "common-hal/_pew/PewPew.h"
#endif
volatile bool hold_interrupt = false;
static volatile bool sleep_ok = true;
#ifdef SAMD21
static void rtc_set_continuous(bool continuous) {
while (RTC->MODE0.STATUS.bit.SYNCBUSY) {
;
}
RTC->MODE0.READREQ.reg = (continuous ? RTC_READREQ_RCONT : 0) | 0x0010;
while (RTC->MODE0.STATUS.bit.SYNCBUSY) {
;
}
}
static uint8_t _tick_event_channel = 0;
// Sleeping requires a register write that can stall interrupt handling. Turning
// off sleeps allows for more accurate interrupt timing. (Python still thinks
// it is sleeping though.)
void rtc_start_pulse(void) {
rtc_set_continuous(true);
hold_interrupt = true;
sleep_ok = false;
}
void rtc_end_pulse(void) {
hold_interrupt = false;
rtc_set_continuous(false);
sleep_ok = true;
}
#endif
@ -161,6 +154,20 @@ static void save_usb_clock_calibration(void) {
}
#endif
static void rtc_continuous_mode(void) {
#ifdef SAMD21
while (RTC->MODE0.STATUS.bit.SYNCBUSY) {
}
RTC->MODE0.READREQ.reg = RTC_READREQ_RCONT | 0x0010;
while (RTC->MODE0.STATUS.bit.SYNCBUSY) {
}
// Do the first request and wait for it.
RTC->MODE0.READREQ.reg = RTC_READREQ_RREQ | RTC_READREQ_RCONT | 0x0010;
while (RTC->MODE0.STATUS.bit.SYNCBUSY) {
}
#endif
}
static void rtc_init(void) {
#ifdef SAMD21
_gclk_enable_channel(RTC_GCLK_ID, GCLK_CLKCTRL_GEN_GCLK2_Val);
@ -168,9 +175,17 @@ static void rtc_init(void) {
while (RTC->MODE0.CTRL.bit.SWRST != 0) {
}
// Turn on periodic events to use as tick. We control whether it interrupts
// us with the EVSYS INTEN register.
RTC->MODE0.EVCTRL.reg = RTC_MODE0_EVCTRL_PEREO2;
RTC->MODE0.CTRL.reg = RTC_MODE0_CTRL_ENABLE |
RTC_MODE0_CTRL_MODE_COUNT32 |
RTC_MODE0_CTRL_PRESCALER_DIV2;
// Turn on continuous sync of the count register. This will speed up all
// tick reads.
rtc_continuous_mode();
#endif
#ifdef SAM_D5X_E5X
hri_mclk_set_APBAMASK_RTC_bit(MCLK);
@ -363,6 +378,9 @@ void reset_port(void) {
#endif
reset_event_system();
#ifdef SAMD21
_tick_event_channel = EVSYS_SYNCH_NUM;
#endif
reset_all_pins();
@ -430,21 +448,14 @@ uint32_t port_get_saved_word(void) {
// TODO: Move this to an RTC backup register so we can preserve it when only the BACKUP power domain
// is enabled.
static volatile uint64_t overflowed_ticks = 0;
#ifdef SAMD21
static volatile bool _ticks_enabled = false;
#endif
static uint32_t _get_count(uint64_t *overflow_count) {
#ifdef SAM_D5X_E5X
while ((RTC->MODE0.SYNCBUSY.reg & (RTC_MODE0_SYNCBUSY_COUNTSYNC | RTC_MODE0_SYNCBUSY_COUNT)) != 0) {
}
#endif
#ifdef SAMD21
// Request a read so we don't stall the bus later. See section 14.3.1.5 Read Request
RTC->MODE0.READREQ.reg = RTC_READREQ_RREQ | 0x0010;
while (RTC->MODE0.STATUS.bit.SYNCBUSY != 0) {
}
#endif
// SAMD21 does continuous sync so we don't need to wait here.
// Disable interrupts so we can grab the count and the overflow.
common_hal_mcu_disable_interrupts();
uint32_t count = RTC->MODE0.COUNT.reg;
@ -458,29 +469,6 @@ static uint32_t _get_count(uint64_t *overflow_count) {
volatile bool _woken_up;
static void _port_interrupt_after_ticks(uint32_t ticks) {
uint32_t current_ticks = _get_count(NULL);
if (ticks > 1 << 28) {
// We'll interrupt sooner with an overflow.
return;
}
#ifdef SAMD21
if (hold_interrupt) {
return;
}
#endif
uint32_t target = current_ticks + (ticks << 4);
RTC->MODE0.COMP[0].reg = target;
#ifdef SAM_D5X_E5X
while ((RTC->MODE0.SYNCBUSY.reg & (RTC_MODE0_SYNCBUSY_COMP0)) != 0) {
}
#endif
RTC->MODE0.INTFLAG.reg = RTC_MODE0_INTFLAG_CMP0;
RTC->MODE0.INTENSET.reg = RTC_MODE0_INTENSET_CMP0;
current_ticks = _get_count(NULL);
_woken_up = current_ticks >= target;
}
void RTC_Handler(void) {
uint32_t intflag = RTC->MODE0.INTFLAG.reg;
if (intflag & RTC_MODE0_INTFLAG_OVF) {
@ -497,19 +485,10 @@ void RTC_Handler(void) {
}
#endif
if (intflag & RTC_MODE0_INTFLAG_CMP0) {
// Clear the interrupt because we may have hit a sleep and _ticks_enabled
// Clear the interrupt because we may have hit a sleep
RTC->MODE0.INTFLAG.reg = RTC_MODE0_INTFLAG_CMP0;
_woken_up = true;
#ifdef SAMD21
if (_ticks_enabled) {
// Do things common to all ports when the tick occurs.
supervisor_tick();
// Check _ticks_enabled again because a tick handler may have turned it off.
if (_ticks_enabled) {
_port_interrupt_after_ticks(1);
}
}
#endif
// SAMD21 ticks are handled by EVSYS
#ifdef SAM_D5X_E5X
RTC->MODE0.INTENCLR.reg = RTC_MODE0_INTENCLR_CMP0;
#endif
@ -526,6 +505,39 @@ uint64_t port_get_raw_ticks(uint8_t *subticks) {
return overflow_count + current_ticks / 16;
}
void evsyshandler_common(void) {
#ifdef SAMD21
if (_tick_event_channel < EVSYS_SYNCH_NUM && event_interrupt_active(_tick_event_channel)) {
supervisor_tick();
}
#endif
#if CIRCUITPY_AUDIOIO || CIRCUITPY_AUDIOBUSIO
audio_evsys_handler();
#endif
}
#ifdef SAM_D5X_E5X
void EVSYS_0_Handler(void) {
evsyshandler_common();
}
void EVSYS_1_Handler(void) {
evsyshandler_common();
}
void EVSYS_2_Handler(void) {
evsyshandler_common();
}
void EVSYS_3_Handler(void) {
evsyshandler_common();
}
void EVSYS_4_Handler(void) {
evsyshandler_common();
}
#else
void EVSYS_Handler(void) {
evsyshandler_common();
}
#endif
// Enable 1/1024 second tick.
void port_enable_tick(void) {
#ifdef SAM_D5X_E5X
@ -533,9 +545,23 @@ void port_enable_tick(void) {
RTC->MODE0.INTENSET.reg = RTC_MODE0_INTENSET_PER2;
#endif
#ifdef SAMD21
// TODO: Switch to using the PER *event* from the RTC to generate an interrupt via EVSYS.
_ticks_enabled = true;
_port_interrupt_after_ticks(1);
// SAMD21 ticks won't survive port_reset(). This *should* be ok since it'll
// be triggered by ticks and no Python will be running.
if (_tick_event_channel >= EVSYS_SYNCH_NUM) {
turn_on_event_system();
_tick_event_channel = find_sync_event_channel();
}
// This turns on both the event detected interrupt (EVD) and overflow (OVR).
init_event_channel_interrupt(_tick_event_channel, CORE_GCLK, EVSYS_ID_GEN_RTC_PER_2);
// Disable overflow interrupt because we ignore it.
if (_tick_event_channel >= 8) {
uint8_t value = 1 << (_tick_event_channel - 8);
EVSYS->INTENCLR.reg = EVSYS_INTENSET_OVRp8(value);
} else {
uint8_t value = 1 << _tick_event_channel;
EVSYS->INTENCLR.reg = EVSYS_INTENSET_OVR(value);
}
NVIC_EnableIRQ(EVSYS_IRQn);
#endif
}
@ -545,21 +571,48 @@ void port_disable_tick(void) {
RTC->MODE0.INTENCLR.reg = RTC_MODE0_INTENCLR_PER2;
#endif
#ifdef SAMD21
_ticks_enabled = false;
RTC->MODE0.INTENCLR.reg = RTC_MODE0_INTENCLR_CMP0;
if (_tick_event_channel >= 8) {
uint8_t value = 1 << (_tick_event_channel - 8);
EVSYS->INTENCLR.reg = EVSYS_INTENSET_EVDp8(value);
} else {
uint8_t value = 1 << _tick_event_channel;
EVSYS->INTENCLR.reg = EVSYS_INTENSET_EVD(value);
}
#endif
}
// This is called by sleep, we ignore it when our ticks are enabled because
// they'll wake us up earlier. If we don't, we'll mess up ticks by overwriting
// the next RTC wake up time.
void port_interrupt_after_ticks(uint32_t ticks) {
uint32_t current_ticks = _get_count(NULL);
if (ticks > 1 << 28) {
// We'll interrupt sooner with an overflow.
return;
}
#ifdef SAMD21
if (_ticks_enabled) {
if (!sleep_ok) {
return;
}
#endif
_port_interrupt_after_ticks(ticks);
uint32_t target = current_ticks + (ticks << 4);
#ifdef SAMD21
// Try and avoid a bus stall when writing COMP by checking for an obvious
// existing sync.
while (RTC->MODE0.STATUS.bit.SYNCBUSY == 1) {
}
#endif
// Writing the COMP register can take up to 180us to synchronize. During
// this time, the bus will stall and no interrupts will be serviced.
RTC->MODE0.COMP[0].reg = target;
#ifdef SAM_D5X_E5X
while ((RTC->MODE0.SYNCBUSY.reg & (RTC_MODE0_SYNCBUSY_COMP0)) != 0) {
}
#endif
RTC->MODE0.INTFLAG.reg = RTC_MODE0_INTFLAG_CMP0;
RTC->MODE0.INTENSET.reg = RTC_MODE0_INTENSET_CMP0;
// Set continuous mode again because setting COMP may disable it.
rtc_continuous_mode();
current_ticks = _get_count(NULL);
_woken_up = current_ticks >= target;
}
void port_idle_until_interrupt(void) {
@ -571,7 +624,7 @@ void port_idle_until_interrupt(void) {
}
#endif
common_hal_mcu_disable_interrupts();
if (!tud_task_event_ready() && !hold_interrupt && !_woken_up) {
if (!tud_task_event_ready() && sleep_ok && !_woken_up) {
__DSB();
__WFI();
}

View File

@ -64,9 +64,9 @@ STATIC const mp_rom_map_elem_t board_global_dict_table[] = {
{ MP_ROM_QSTR(MP_QSTR_DAC1), MP_ROM_PTR(&pin_GPIO17) },
{ MP_ROM_QSTR(MP_QSTR_DAC2), MP_ROM_PTR(&pin_GPIO18) },
{ MP_ROM_QSTR(MP_QSTR_MISO), MP_ROM_PTR(&pin_GPIO35) },
{ MP_ROM_QSTR(MP_QSTR_MISO), MP_ROM_PTR(&pin_GPIO37) },
{ MP_ROM_QSTR(MP_QSTR_SCK), MP_ROM_PTR(&pin_GPIO36) },
{ MP_ROM_QSTR(MP_QSTR_MOSI), MP_ROM_PTR(&pin_GPIO37) },
{ MP_ROM_QSTR(MP_QSTR_MOSI), MP_ROM_PTR(&pin_GPIO35) },
{ MP_ROM_QSTR(MP_QSTR_NEOPIXEL), MP_ROM_PTR(&pin_GPIO40) },

View File

@ -0,0 +1,227 @@
/*
* This file is part of the MicroPython project, http://micropython.org/
*
* The MIT License (MIT)
*
* Copyright (c) 2020 Scott Shawcroft for Adafruit Industries
*
* Permission is hereby granted, free of charge, to any person obtaining a copy
* of this software and associated documentation files (the "Software"), to deal
* in the Software without restriction, including without limitation the rights
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
* copies of the Software, and to permit persons to whom the Software is
* furnished to do so, subject to the following conditions:
*
* The above copyright notice and this permission notice shall be included in
* all copies or substantial portions of the Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
* THE SOFTWARE.
*/
#include "supervisor/board.h"
#include "mpconfigboard.h"
#include "shared-bindings/microcontroller/Pin.h"
#include "shared-module/displayio/__init__.h"
#include "shared-module/displayio/mipi_constants.h"
#define DELAY 0x80
// From Arduino-ST7789 library https://github.com/ananevilya/Arduino-ST7789-Library/blob/master/Arduino_ST7789.cpp
#define ST7789_TFTWIDTH 240
#define ST7789_TFTHEIGHT 240
#define ST7789_240x240_XSTART 0
#define ST7789_240x240_YSTART 0
#define ST7789_NOP 0x00
#define ST7789_SWRESET 0x01
#define ST7789_RDDID 0x04
#define ST7789_RDDST 0x09
#define ST7789_SLPIN 0x10
#define ST7789_SLPOUT 0x11
#define ST7789_PTLON 0x12
#define ST7789_NORON 0x13
#define ST7789_INVOFF 0x20
#define ST7789_INVON 0x21
#define ST7789_DISPOFF 0x28
#define ST7789_DISPON 0x29
#define ST7789_CASET 0x2A
#define ST7789_RASET 0x2B
#define ST7789_RAMWR 0x2C
#define ST7789_RAMRD 0x2E
#define ST7789_PTLAR 0x30
#define ST7789_COLMOD 0x3A
#define ST7789_MADCTL 0x36
#define ST7789_VSCSAD 0x37
#define ST7789_PORCTRL 0xB2
#define ST7789_GCTRL 0xB7
#define ST7789_VCOMS 0xBB
#define ST7789_LCMCTRL 0xC0
#define ST7789_IDSET 0xC1
#define ST7789_VDVVRHEN 0xC2
#define ST7789_VRHS 0xC3
#define ST7789_VDVS 0xC4
#define ST7789_VCMOFSET 0xC5
#define ST7789_FRCTRL2 0xC6
#define ST7789_CABCCTRL 0xC7
#define ST7789_REGSEL1 0xC8
#define ST7789_REGSEL2 0xCA
#define ST7789_PWMFRSEL 0xCC
#define ST7789_PWCTRL1 0xD0
#define ST7789_VAPVANEN 0xD2
#define ST7789_PVGAMCTRL 0xE0
#define ST7789_NVGAMCTRL 0xE1
#define ST7789_MADCTL_MY 0x80
#define ST7789_MADCTL_MX 0x40
#define ST7789_MADCTL_MV 0x20
#define ST7789_MADCTL_ML 0x10
#define ST7789_MADCTL_RGB 0x00
#define ST7789_RDID1 0xDA
#define ST7789_RDID2 0xDB
#define ST7789_RDID3 0xDC
#define ST7789_RDID4 0xDD
#define DISPLAY_MADCTL (ST7789_MADCTL_RGB)
#define DISPLAY_VSCSAD 0
// The init_sequence is bitpacked to minimize the ram impact. Every command begins with a
// command byte followed by a byte to determine the parameter count and delay. When the top bit
// of the second byte is 1 (0x80), a delay will occur after the command parameters are sent.
// The remaining 7 bits are the parameter count excluding any delay byte. The bytes following
// are the parameters. When the delay bit is set, a single byte after the parameters specifies
// the delay duration in milliseconds. The value 0xff will lead to an extra long 500 ms delay
// instead of 255 ms.uint8_t display_init_sequence[] = {
// display init sequence according to LilyGO example app
uint8_t display_init_sequence[] = {
// From Lilygo example
// sw reset
0x01, 0 | DELAY, 150,
// sleep out
0x11, 0 | DELAY, 120,
// normal display mode on
0x13, 0,
// display and color format settings
0x36, 1, DISPLAY_MADCTL,
0xB6, 2, 0x0A, 0x82,
0x3A, 1 | DELAY, 0x55, 10,
// ST7789V frame rate setting
0xB2, 5, 0x0C, 0x0C, 0x00, 0x33, 0x33,
// voltages: VGH / VGL
0xB7, 1, 0x35,
// ST7789V power setting
0xBB, 1, 0x28,
0xC0, 1, 0x0C,
0xC2, 2, 0x01, 0xFF,
0xC3, 1, 0x10,
0xC4, 1, 0x20,
0xC6, 1, 0x0F,
0xD0, 2, 0xA4, 0xA1,
// ST7789V gamma setting
0xE0, 14, 0xD0, 0x00, 0x02, 0x07, 0x0A, 0x28, 0x32, 0x44, 0x42, 0x06, 0x0E, 0x12, 0x14, 0x17,
0xE1, 14, 0xD0, 0x00, 0x02, 0x07, 0x0A, 0x28, 0x31, 0x54, 0x47, 0x0E, 0x1C, 0x17, 0x1B, 0x1E,
0x21, 0,
// display on
0x21, 0 | DELAY, 10, // _INVON
0x29, 0 | DELAY, 120
};
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_GPIO6);
common_hal_never_reset_pin(&pin_GPIO7);
#endif /* DEBUG */
// Display
busio_spi_obj_t *spi = &displays[0].fourwire_bus.inline_bus;
common_hal_busio_spi_construct(
spi,
&pin_GPIO12, // CLK
&pin_GPIO11, // MOSI
NULL // MISO not connected
);
common_hal_busio_spi_never_reset(spi);
displayio_fourwire_obj_t *bus = &displays[0].fourwire_bus;
bus->base.type = &displayio_fourwire_type;
common_hal_displayio_fourwire_construct(
bus,
spi,
&pin_GPIO14, // DC
&pin_GPIO10, // CS
&pin_GPIO9, // RST
40000000, // baudrate
0, // polarity
0 // phase
);
// workaround as board_init() is called before reset_port() in main.c
pwmout_reset();
displayio_display_obj_t *display = &displays[0].display;
display->base.type = &displayio_display_type;
common_hal_displayio_display_construct(
display,
bus,
240, // width (after rotation)
240, // height (after rotation)
0, // column start
80, // row start
0, // rotation
16, // color depth
false, // grayscale
false, // pixels in a byte share a row. Only valid for depths < 8
1, // bytes per cell. Only valid for depths < 8
false, // reverse_pixels_in_byte. Only valid for depths < 8
true, // reverse_pixels_in_word
MIPI_COMMAND_SET_COLUMN_ADDRESS, // set column command
MIPI_COMMAND_SET_PAGE_ADDRESS, // set row command
MIPI_COMMAND_WRITE_MEMORY_START, // write memory command
0x37, // set vertical scroll command
display_init_sequence,
sizeof(display_init_sequence),
NULL, // There is no backlight pin, defined for now.
NO_BRIGHTNESS_COMMAND,
1.0f, // brightness (ignored)
true, // auto_brightness
false, // single_byte_bounds
false, // data_as_commands
true, // auto_refresh
60, // native_frames_per_second
false, // backlight_on_high
false // SH1107_addressing
);
}
bool board_requests_safe_mode(void) {
return false;
}
void reset_board(void) {
}
void board_deinit(void) {
common_hal_displayio_release_displays();
}

View File

@ -0,0 +1,44 @@
/*
* 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 "MORPHEANS MorphESP-240"
#define MICROPY_HW_MCU_NAME "ESP32S2"
#define MICROPY_HW_NEOPIXEL (&pin_GPIO16)
#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
#define DEFAULT_I2C_BUS_SCL (&pin_GPIO7)
#define DEFAULT_I2C_BUS_SDA (&pin_GPIO6)
#define DEFAULT_SPI_BUS_SCK (&pin_GPIO12)
#define DEFAULT_SPI_BUS_MOSI (&pin_GPIO11)
#define DEFAULT_SPI_BUS_MISO (&pin_GPIO13)

View File

@ -0,0 +1,17 @@
USB_VID = 0x303a
USB_PID = 0x80B7
USB_PRODUCT = "MORPHESP-240"
USB_MANUFACTURER = "MORPHEANS"
INTERNAL_FLASH_FILESYSTEM = 1
LONGINT_IMPL = MPZ
# The default queue depth of 16 overflows on release builds,
# so increase it to 32.
CFLAGS += -DCFG_TUD_TASK_QUEUE_SZ=32
CIRCUITPY_ESP_FLASH_MODE = dio
CIRCUITPY_ESP_FLASH_FREQ = 40m
CIRCUITPY_ESP_FLASH_SIZE = 4MB
CIRCUITPY_MODULE = wroom

View File

@ -0,0 +1,58 @@
#include "shared-bindings/board/__init__.h"
#include "shared-module/displayio/__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_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_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_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_IO45), MP_ROM_PTR(&pin_GPIO45) },
{ MP_ROM_QSTR(MP_QSTR_IO46), MP_ROM_PTR(&pin_GPIO46) },
// Serial UART on breakout board
{ MP_ROM_QSTR(MP_QSTR_TX), MP_ROM_PTR(&pin_GPIO17) },
{ MP_ROM_QSTR(MP_QSTR_RX), MP_ROM_PTR(&pin_GPIO18) },
// I2C on breakout board.
{ MP_ROM_QSTR(MP_QSTR_SDA), MP_ROM_PTR(&pin_GPIO6) },
{ MP_ROM_QSTR(MP_QSTR_SCL), MP_ROM_PTR(&pin_GPIO7) },
// WS2812B RGB LED
{ MP_ROM_QSTR(MP_QSTR_NEOPIXEL), MP_ROM_PTR(&pin_GPIO16) },
// SPI on breakout board
{ MP_ROM_QSTR(MP_QSTR_MOSI), MP_ROM_PTR(&pin_GPIO11) },
{ MP_ROM_QSTR(MP_QSTR_CLK), MP_ROM_PTR(&pin_GPIO12) },
{ MP_ROM_QSTR(MP_QSTR_MISO), MP_ROM_PTR(&pin_GPIO13) },
// 1.3" 240x240 LCD ST7789
{ MP_ROM_QSTR(MP_QSTR_LCD_MOSI), MP_ROM_PTR(&pin_GPIO11) },
{ MP_ROM_QSTR(MP_QSTR_LCD_CLK), MP_ROM_PTR(&pin_GPIO12) },
{ MP_ROM_QSTR(MP_QSTR_LCD_CS), MP_ROM_PTR(&pin_GPIO10) },
{ MP_ROM_QSTR(MP_QSTR_LCD_RST), MP_ROM_PTR(&pin_GPIO9) },
{ MP_ROM_QSTR(MP_QSTR_LCD_D_C), MP_ROM_PTR(&pin_GPIO14) },
{ MP_ROM_QSTR(MP_QSTR_DISPLAY), MP_ROM_PTR(&displays[0].display) },
};
MP_DEFINE_CONST_DICT(board_module_globals, board_global_dict_table);

View File

@ -0,0 +1,6 @@
#
# LWIP
#
CONFIG_LWIP_LOCAL_HOSTNAME="MORPHESP-240"
CONFIG_LWIP_DNS_SUPPORT_MDNS_QUERIES=y
# end of LWIP

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"
void board_init(void) {
}
bool board_requests_safe_mode(void) {
return false;
}
void reset_board(void) {
}

View File

@ -0,0 +1,46 @@
/*
* This file is part of the MicroPython project, http://micropython.org/
*
* The MIT License (MIT)
*
* Copyright (c) 2016 Glenn Ruben Bakke
* Copyright (c) 2021 Pierre Constantineau
*
*
* 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 "nrfx/hal/nrf_gpio.h"
#define MICROPY_HW_BOARD_NAME "BlueMicro840"
#define MICROPY_HW_MCU_NAME "nRF52840"
#define BOARD_HAS_CRYSTAL 1
#define MICROPY_HW_LED_STATUS (&pin_P1_04) // RED
#define DEFAULT_I2C_BUS_SCL (&pin_P0_17) // 0.17 - same position as Pro Micro
#define DEFAULT_I2C_BUS_SDA (&pin_P0_15) // 0.15 - same position as Pro Micro
#define DEFAULT_SPI_BUS_SCK (&pin_P0_24) // 0.24 - same position as Pro Micro
#define DEFAULT_SPI_BUS_MOSI (&pin_P0_10) // 0.10 - same position as Pro Micro
#define DEFAULT_SPI_BUS_MISO (&pin_P0_09) // 0.09 - same position as Pro Micro
#define DEFAULT_UART_BUS_RX (&pin_P0_08) // 0.08 - same position as Pro Micro
#define DEFAULT_UART_BUS_TX (&pin_P0_06) // 0.06 - same position as Pro Micro

View File

@ -0,0 +1,8 @@
USB_VID = 0x1D50
USB_PID = 0x6161
USB_PRODUCT = "BlueMicro840"
USB_MANUFACTURER = "nrf52.jpconstantineau.com"
MCU_CHIP = nrf52840
INTERNAL_FLASH_FILESYSTEM = 1

View File

@ -0,0 +1,76 @@
#include "shared-bindings/board/__init__.h"
STATIC const mp_rom_map_elem_t board_module_globals_table[] = {
{ MP_ROM_QSTR(MP_QSTR_P0_02), MP_ROM_PTR(&pin_P0_02) },
{ MP_ROM_QSTR(MP_QSTR_P0_03), MP_ROM_PTR(&pin_P0_03) },
{ MP_ROM_QSTR(MP_QSTR_P0_04), MP_ROM_PTR(&pin_P0_04) },
{ MP_ROM_QSTR(MP_QSTR_P0_05), MP_ROM_PTR(&pin_P0_05) },
{ MP_ROM_QSTR(MP_QSTR_P0_06), MP_ROM_PTR(&pin_P0_06) },
{ MP_ROM_QSTR(MP_QSTR_P0_07), MP_ROM_PTR(&pin_P0_07) },
{ MP_ROM_QSTR(MP_QSTR_P0_08), MP_ROM_PTR(&pin_P0_08) },
{ MP_ROM_QSTR(MP_QSTR_P0_09), MP_ROM_PTR(&pin_P0_09) },
{ MP_ROM_QSTR(MP_QSTR_P0_10), MP_ROM_PTR(&pin_P0_10) },
{ MP_ROM_QSTR(MP_QSTR_P0_11), MP_ROM_PTR(&pin_P0_11) },
{ MP_ROM_QSTR(MP_QSTR_P0_12), MP_ROM_PTR(&pin_P0_12) },
{ MP_ROM_QSTR(MP_QSTR_P0_13), MP_ROM_PTR(&pin_P0_13) },
{ MP_ROM_QSTR(MP_QSTR_P0_14), MP_ROM_PTR(&pin_P0_14) },
{ MP_ROM_QSTR(MP_QSTR_P0_15), MP_ROM_PTR(&pin_P0_15) },
{ MP_ROM_QSTR(MP_QSTR_P0_16), MP_ROM_PTR(&pin_P0_16) },
{ MP_ROM_QSTR(MP_QSTR_P0_17), MP_ROM_PTR(&pin_P0_17) },
{ MP_ROM_QSTR(MP_QSTR_P0_19), MP_ROM_PTR(&pin_P0_19) },
{ MP_ROM_QSTR(MP_QSTR_P0_20), MP_ROM_PTR(&pin_P0_20) },
{ MP_ROM_QSTR(MP_QSTR_P0_21), MP_ROM_PTR(&pin_P0_21) },
{ MP_ROM_QSTR(MP_QSTR_P0_22), MP_ROM_PTR(&pin_P0_22) },
{ MP_ROM_QSTR(MP_QSTR_P0_23), MP_ROM_PTR(&pin_P0_23) },
{ MP_ROM_QSTR(MP_QSTR_P0_24), MP_ROM_PTR(&pin_P0_24) },
{ MP_ROM_QSTR(MP_QSTR_P0_25), MP_ROM_PTR(&pin_P0_25) },
{ MP_ROM_QSTR(MP_QSTR_P0_26), MP_ROM_PTR(&pin_P0_26) },
{ MP_ROM_QSTR(MP_QSTR_P0_27), MP_ROM_PTR(&pin_P0_27) },
{ MP_ROM_QSTR(MP_QSTR_P0_28), MP_ROM_PTR(&pin_P0_28) },
{ MP_ROM_QSTR(MP_QSTR_P0_29), MP_ROM_PTR(&pin_P0_29) },
{ MP_ROM_QSTR(MP_QSTR_P0_30), MP_ROM_PTR(&pin_P0_30) },
{ MP_ROM_QSTR(MP_QSTR_P0_31), MP_ROM_PTR(&pin_P0_31) },
{ MP_ROM_QSTR(MP_QSTR_P1_00), MP_ROM_PTR(&pin_P1_00) },
{ MP_ROM_QSTR(MP_QSTR_P1_01), MP_ROM_PTR(&pin_P1_01) },
{ MP_ROM_QSTR(MP_QSTR_P1_02), MP_ROM_PTR(&pin_P1_02) },
{ MP_ROM_QSTR(MP_QSTR_P1_03), MP_ROM_PTR(&pin_P1_03) },
{ MP_ROM_QSTR(MP_QSTR_P1_04), MP_ROM_PTR(&pin_P1_04) },
{ MP_ROM_QSTR(MP_QSTR_P1_05), MP_ROM_PTR(&pin_P1_05) },
{ MP_ROM_QSTR(MP_QSTR_P1_06), MP_ROM_PTR(&pin_P1_06) },
{ MP_ROM_QSTR(MP_QSTR_P1_07), MP_ROM_PTR(&pin_P1_07) },
{ MP_ROM_QSTR(MP_QSTR_P1_08), MP_ROM_PTR(&pin_P1_08) },
{ MP_ROM_QSTR(MP_QSTR_P1_09), MP_ROM_PTR(&pin_P1_09) },
{ MP_ROM_QSTR(MP_QSTR_P1_10), MP_ROM_PTR(&pin_P1_10) },
{ MP_ROM_QSTR(MP_QSTR_P1_11), MP_ROM_PTR(&pin_P1_11) },
{ MP_ROM_QSTR(MP_QSTR_P1_12), MP_ROM_PTR(&pin_P1_12) },
{ MP_ROM_QSTR(MP_QSTR_P1_13), MP_ROM_PTR(&pin_P1_13) },
{ MP_ROM_QSTR(MP_QSTR_P1_14), MP_ROM_PTR(&pin_P1_14) },
{ MP_ROM_QSTR(MP_QSTR_P1_15), MP_ROM_PTR(&pin_P1_15) },
{ MP_ROM_QSTR(MP_QSTR_A0), MP_ROM_PTR(&pin_P0_02) },
{ MP_ROM_QSTR(MP_QSTR_A1), MP_ROM_PTR(&pin_P0_03) },
{ MP_ROM_QSTR(MP_QSTR_A2), MP_ROM_PTR(&pin_P0_04) },
{ MP_ROM_QSTR(MP_QSTR_A3), MP_ROM_PTR(&pin_P0_05) },
{ MP_ROM_QSTR(MP_QSTR_A4), MP_ROM_PTR(&pin_P0_28) },
{ MP_ROM_QSTR(MP_QSTR_A5), MP_ROM_PTR(&pin_P0_29) },
{ MP_ROM_QSTR(MP_QSTR_A6), MP_ROM_PTR(&pin_P0_30) },
{ MP_ROM_QSTR(MP_QSTR_A7), MP_ROM_PTR(&pin_P0_31) },
{ MP_ROM_QSTR(MP_QSTR_SDA), MP_ROM_PTR(&pin_P0_15) },
{ MP_ROM_QSTR(MP_QSTR_SCL), MP_ROM_PTR(&pin_P0_17) },
{ MP_ROM_QSTR(MP_QSTR_RX), MP_ROM_PTR(&pin_P0_08) },
{ MP_ROM_QSTR(MP_QSTR_TX), MP_ROM_PTR(&pin_P0_06) },
{ MP_ROM_QSTR(MP_QSTR_MISO), MP_ROM_PTR(&pin_P0_09) },
{ MP_ROM_QSTR(MP_QSTR_MOSI), MP_ROM_PTR(&pin_P0_10) },
{ MP_ROM_QSTR(MP_QSTR_SCK), MP_ROM_PTR(&pin_P0_24) },
{ MP_ROM_QSTR(MP_QSTR_LED1), MP_ROM_PTR(&pin_P1_04) },
{ MP_ROM_QSTR(MP_QSTR_LED2), MP_ROM_PTR(&pin_P1_10) },
{ MP_ROM_QSTR(MP_QSTR_RED_LED), MP_ROM_PTR(&pin_P1_04) },
{ MP_ROM_QSTR(MP_QSTR_BLUE_LED), MP_ROM_PTR(&pin_P1_10) },
{ MP_ROM_QSTR(MP_QSTR_VOLTAGE_MONITOR), MP_ROM_PTR(&pin_P0_31) },
{ MP_ROM_QSTR(MP_QSTR_BATTERY), MP_ROM_PTR(&pin_P0_31) },
{ MP_ROM_QSTR(MP_QSTR_VCC_ON), MP_ROM_PTR(&pin_P0_12) },
{ MP_ROM_QSTR(MP_QSTR_UART), MP_ROM_PTR(&board_uart_obj) },
{ MP_ROM_QSTR(MP_QSTR_I2C), MP_ROM_PTR(&board_i2c_obj) },
{ MP_ROM_QSTR(MP_QSTR_SPI), MP_ROM_PTR(&board_spi_obj) },
};
MP_DEFINE_CONST_DICT(board_module_globals, board_module_globals_table);

View File

@ -10,56 +10,64 @@ We've also routed two I<sup>2</sup>C buses, 2 SPI buses, eleven GPIO, dedicated
CircuitPython pin definitions, while simialr to other boards represent a slight departure from just the typical `A` and `D` pin definitions. The majority of general pins are labled as `G` (or alternatively, `BUS`,) as the MicroMod system they build on uses those names to specify pins that may not be specficially analog or digital.
This can be somewhat confusing, especially around the analog pins. Here's a quick pin-map. This pin map will use the label either on the [SparkFun MicroMod ATP Carrier Board](https://www.sparkfun.com/products/16885), or the pin name on the [graphical datasheet](https://cdn.sparkfun.com/assets/learn_tutorials/1/4/0/1/MicroMod_nRF52840_v1.0_Graphical_Datasheet.pdf). Some of the aditional aliases are just names to make naming consistent (e.g.: RTS/CTS), but they also can refer to additional functionality a pin may have (e.g.: NFC pins)
This can be somewhat confusing, especially around the analog pins. Here's a quick pin-map:
MicroMod Pin # | ATP Pin Label | Pin Definition | Additional Definitons | Pin/Port Reference | Notes
:--------------|:--------------|:--------------|:-----------------------|:-------------------|:------
8 | G11 | | | (Not Connected) |
10 | D0 | D0 | | P0_27 |
11 | BOOT | BOOT | BUTTON1 | P0_07 |
12 | SDA | SDA | | P0_08 |
13 | RTS1 | RTS | RTS1 | P1_02 |
14 | SCL | SCL | | P0_11 |
15 | CTS1 | CTS | CTS1 | P1_09 |
16 | /I2C INT | I2C_INT | P0_15 |
17 | TX | TX | TX1 | P1_03 |
18 | D1 | D1 | CAM_TRIG | P1_08 |
19 | RX | RX | RX1 | P1_10 |
20 | RX2 | RX2 | | P1_05 |
22 | TX2 | TX2 | | P1_07 |
32 | PWM0 | PWM0 | P0_06 |
34 | A0 | A0 | ADC0 | P0_04 | Attached to AIN2
38 | A1 | A1 | ADC1 | P0_05 | Attached to AIN3
11 | BOOT | BOOT | | P0_07 |
12 | SDA | I2C_SDA | SDA | P0_08 |
13 | RTS1 | UART_RTS1 | | P1_02 |
14 | SCL | I2C_SCL | SCL | P0_11 |
15 | CTS1 | UART_CTS1 | | P1_09 |
16 | /I2C INT | I2C_INT | |P0_15|
17 | TX | UART_TX1 | TX | P1_03 |
18 | D1 | D1 | | P1_08 |
19 | RX | UART_RX1 | RX | P1_10 |
20 | RX2 | UART_RX2 | | P1_05 |
22 | TX2 | UART_TX2 | | P1_07 |
32 | PWM0 | PWM0 | |P0_06|
34 | A0 | A0 | | P0_04 | Attached to AIN2
38 | A1 | A1 | | P0_05 | Attached to AIN3
40 | G0 | G0 | BUS0 | P0_29 | Attached to AIN5
42 | G1 | G1 | BUS1 | P0_03 | Attached to AIN1
44 | G2 | G2 | BUS2 | P1_13 |
46 | G3 | G3 | BUS3 | P1_12 |
47 | PWM1 | PWM1 | P0_16 |
47 | PWM1 | PWM1 | |P0_16|
48 | G4 | G4 | BUS4 | P1_11 |
49 | BATT_VIN | BATT_VIN3 | | P0_30 | Attached to AIN6, will be battery voltage / 3. |
49 | BATT_VIN | BATT_VIN3 | | P0_30 | Attached to AIN6, will be battery voltage / 3.
50 | PDM_CLK | PDM_CLK | | P0_25 |
51 | SDA1 | SDA1 | | P1_01 |
51 | SDA1 | I2C_SDA1 | | P1_01 |
52 | PDM_DATA | PDM_DATA | | P0_26 |
53 | SCL1 | SCL1 | | P0_24 |
55 | /CS | CS | | P0_20 |
57 | SCK | SCK | | P0_28 | Attached to AIN4
59 | COPI | COPI | MOSI | P0_31 | Attached to AIN7
61 | CIPO | CIPO | MISO | P0_02 |
63 | G10 | G10 | NFC2, ADC_DP, CAM_VSYNC | P0_10 | Attached to NFC2
65 | G9 | G9 | NFC1, ADC_DM, CAM_HSYNC | P0_09 | Attached to NFC1
53 | SCL1 | I2C_SCL1 | | P0_24 |
55 | /CS | SPI_CS | | P0_20 |
57 | SCK | SPI_SCK | LED_CLK | P0_28 | Attached to AIN4
59 | COPI | SPI_COPI | SPI_MOSI, LED_DAT | P0_31 | Attached to AIN7
60 | SCK1 | SDIO_SCK | SPI_SCK1 | |
61 | CIPO | SPI_CIPO | SPI_MISO | P0_02 |
62 | COPI1 | SDIO_CMD | SPI_COPI1 | |
63 | G10 | G10 | | P0_10 | Attached to NFC2
64 | CIPO1 | SDIO_DATA0 | SPI_CIPO1 | |
65 | G9 | G9 | | P0_09 | Attached to NFC1
66 | DAT1 | SDIO_DATA1 | | |
67 | G8 | G8 | | P1_14 |
68 | DAT2 | SDIO_DATA2 | | |
69 | G7 | G7 | BUS7 | P1_04 |
70 | CS1 | SDIO_DATA3 | SPI_CS1 | |
71 | G6 | G6 | BUS6 | P1_06 |
73 | G5 | G5 | BUS5 | P0_15 |
## Peripheral Naming
CircuitPython attempts to stay in line with the naming of the serial peripheral naming in the MicroMod system. The bare UART pins are also named <pin>1. The UART 2 pins are named <pin>2. However, the I2C names on MicroMod are <I2C pin> and <I2C pin>1. Perhaps this will change in the future, but as of [Interface v1](https://cdn.sparkfun.com/assets/learn_tutorials/1/2/0/6/SparkFun_MicroMod_Interface_v1.0_-_Pin_Descriptions.pdf), it may lead to some confusion.
The SparkFun MicroMod spec uses a zero-based peripheral numbering scheme. The 0th peripheral is the default and the "0" is omitted from the peripheral name. For example, the first I2C peripheral is named `I2C` (instead of `I2C0`) and the second I2C peripheral is named `I2C1`. Note: MicroMod `UART` is not present in the edge connector pinout because the primary debug serial port (i.e.`UART0`) is exposed as a virtual serial port over USB. As a result, the first UART peripheral in the edge connector pinout is `UART1` and the second UART peripheral is `UART2`.
For more details, see https://www.sparkfun.com/micromod#tech-specs.
## Bootloader Notes
The MicroMod nRF52840 Processor needs to have the [Adafruit nRF52 UF2 bootloader](https://github.com/adafruit/Adafruit_nRF52_Bootloader/pull/194) flashed on it. [[TODO: LINK TO BUILD]]
The MicroMod nRF52840 Processor needs to have the [Adafruit nRF52 UF2 bootloader](https://github.com/adafruit/Adafruit_nRF52_Bootloader/releases/latest) flashed on it.
## Hardware Reference

View File

@ -27,9 +27,12 @@
#include "nrfx/hal/nrf_gpio.h"
#define MICROPY_HW_BOARD_NAME "SparkFun MicroMod nRF52840"
#define MICROPY_HW_BOARD_NAME "SparkFun MicroMod nRF52840 Processor"
#define MICROPY_HW_MCU_NAME "nRF52840"
// Status LED
#define MICROPY_HW_LED_STATUS (&pin_P0_13)
#define DEFAULT_I2C_BUS_SCL (&pin_P0_11)
#define DEFAULT_I2C_BUS_SDA (&pin_P0_08)

View File

@ -1,6 +1,6 @@
USB_VID = 0x1B4F
USB_PID = 0x0021
USB_PRODUCT = "SFE_nRF52840_MicroMod"
USB_PRODUCT = "SparkFun MicroMod nRF52840 Processor"
USB_MANUFACTURER = "SparkFun Electronics"
MCU_CHIP = nrf52840

View File

@ -1,113 +1,221 @@
/*
* This file is part of the MicroPython project, http://micropython.org/
*
* The MIT License (MIT)
*
* Copyright (c) 2017 Scott Shawcroft for Adafruit Industries
* Copyright (c) 2021 Chris Wilson
*
* Permission is hereby granted, free of charge, to any person obtaining a copy
* of this software and associated documentation files (the "Software"), to deal
* in the Software without restriction, including without limitation the rights
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
* copies of the Software, and to permit persons to whom the Software is
* furnished to do so, subject to the following conditions:
*
* The above copyright notice and this permission notice shall be included in
* all copies or substantial portions of the Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
* THE SOFTWARE.
*/
#include "shared-bindings/board/__init__.h"
STATIC const mp_rom_map_elem_t board_module_globals_table[] = {
// D pins (D0-D1)
{ MP_ROM_QSTR(MP_QSTR_D0), MP_ROM_PTR(&pin_P0_27) }, // 0.27 - D0
{ MP_ROM_QSTR(MP_QSTR_D1), MP_ROM_PTR(&pin_P1_08) }, // 1.08 - D1 | CAM_TRIG
{ MP_ROM_QSTR(MP_QSTR_CAM_TRIG), MP_ROM_PTR(&pin_P1_08) }, // CAM_TRIG alias
// The SparkFun MicroMod spec uses a zero-based peripheral numbering scheme.
// The 0th peripheral is the default and the "0" is omitted from the
// peripheral name (e.g. "I2C" instead of "I2C0").
//
// For more details, see https://www.sparkfun.com/micromod#tech-specs
// A pins (A0-A1)
{ MP_ROM_QSTR(MP_QSTR_A0), MP_ROM_PTR(&pin_P0_04) }, // 0.04 - A0 | ADC0 (AIN2)
{ MP_ROM_QSTR(MP_QSTR_ADC0), MP_ROM_PTR(&pin_P0_04) }, // ADC0 alias
{ MP_ROM_QSTR(MP_QSTR_A1), MP_ROM_PTR(&pin_P0_05) }, // 0.05 - A1 | ADC1 (AIN3)
{ MP_ROM_QSTR(MP_QSTR_ADC1), MP_ROM_PTR(&pin_P0_05) }, // ADC1 alias
// MicroMod built-in status LED pin
// Requirement from the "Designing with MicroMod" SparkFun article:
// "... every Processor Board shall include one status LED connected to a
// pin that is not connected to the board edge."
{ MP_ROM_QSTR(MP_QSTR_LED), MP_ROM_PTR(&pin_P0_13) }, // MicroMod LED (P0.13)
// G pins (G0-G11, G11 NC)
{ MP_ROM_QSTR(MP_QSTR_G0), MP_ROM_PTR(&pin_P0_29) }, // 0.29 - G0 | GPIO0 | BUS0 (AIN5)
{ MP_ROM_QSTR(MP_QSTR_BUS0), MP_ROM_PTR(&pin_P0_29) }, // BUS0 alias
{ MP_ROM_QSTR(MP_QSTR_G1), MP_ROM_PTR(&pin_P0_03) }, // 0.03 - G1 | GPIO1 | BUS1 (AIN1)
{ MP_ROM_QSTR(MP_QSTR_BUS1), MP_ROM_PTR(&pin_P0_03) }, // BUS1 alias
{ MP_ROM_QSTR(MP_QSTR_G2), MP_ROM_PTR(&pin_P1_13) }, // 1.13 - G2 | GPIO2 | BUS2
{ MP_ROM_QSTR(MP_QSTR_BUS2), MP_ROM_PTR(&pin_P1_13) }, // BUS2 alias
{ MP_ROM_QSTR(MP_QSTR_G3), MP_ROM_PTR(&pin_P1_12) }, // 1.12 - G3 | GPIO3 | BUS3
{ MP_ROM_QSTR(MP_QSTR_BUS3), MP_ROM_PTR(&pin_P1_12) }, // BUS3 alias
{ MP_ROM_QSTR(MP_QSTR_G4), MP_ROM_PTR(&pin_P1_11) }, // 1.11 - G4 | GPIO4 | BUS4
{ MP_ROM_QSTR(MP_QSTR_BUS4), MP_ROM_PTR(&pin_P1_11) }, // BUS4 alias
{ MP_ROM_QSTR(MP_QSTR_G5), MP_ROM_PTR(&pin_P0_17) }, // 0.17 - G5 | GPIO5 | BUS5
{ MP_ROM_QSTR(MP_QSTR_BUS5), MP_ROM_PTR(&pin_P0_17) }, // BUS5 alias
{ MP_ROM_QSTR(MP_QSTR_G6), MP_ROM_PTR(&pin_P1_06) }, // 1.06 - G6 | GPIO6 | BUS6
{ MP_ROM_QSTR(MP_QSTR_BUS6), MP_ROM_PTR(&pin_P1_06) }, // BUS6 alias
{ MP_ROM_QSTR(MP_QSTR_G7), MP_ROM_PTR(&pin_P1_04) }, // 1.04 - G7 | GPIO7 | BUS7
{ MP_ROM_QSTR(MP_QSTR_BUS7), MP_ROM_PTR(&pin_P1_04) }, // BUS7 alias
{ MP_ROM_QSTR(MP_QSTR_G8), MP_ROM_PTR(&pin_P1_14) }, // 1.14 - G8 | GPIO8
{ MP_ROM_QSTR(MP_QSTR_G9), MP_ROM_PTR(&pin_P0_09) }, // 0.09 - G9 | GPIO9/NFC1 | ADC_D- | CAM_HSYNC (NFC1)
{ MP_ROM_QSTR(MP_QSTR_NFC1), MP_ROM_PTR(&pin_P0_09) }, // NFC1 alias
{ MP_ROM_QSTR(MP_QSTR_ADC_DM), MP_ROM_PTR(&pin_P0_09) }, // ADC_DM alias
{ MP_ROM_QSTR(MP_QSTR_CAM_HSYNC), MP_ROM_PTR(&pin_P0_09) }, // CAM_HSYNC alias
{ MP_ROM_QSTR(MP_QSTR_G10), MP_ROM_PTR(&pin_P0_10) }, // 0.10 - G10 | GPIO10/NFC2 | ADC_D+ | CAM_VSYNC (NFC2)
{ MP_ROM_QSTR(MP_QSTR_NFC2), MP_ROM_PTR(&pin_P0_10) }, // NFC2 alias
{ MP_ROM_QSTR(MP_QSTR_ADC_DP), MP_ROM_PTR(&pin_P0_10) }, // ADC_DP alias
{ MP_ROM_QSTR(MP_QSTR_CAM_VSYNC), MP_ROM_PTR(&pin_P0_10) }, // CAM_VSYNC alias
// NC - G11
// MicroMod USB bus input voltage (+5V) pin
// { MP_ROM_QSTR(MP_QSTR_USB_VIN), MP_ROM_PTR() }, // MicroMod USB_VIN (MDBT50Q-P1M has a dedicated HW VBUS pin)
// PWM pins (PWM0-PWM1)
{ MP_ROM_QSTR(MP_QSTR_PWM0), MP_ROM_PTR(&pin_P0_06) }, // 0.06 - PWM0
{ MP_ROM_QSTR(MP_QSTR_PWM1), MP_ROM_PTR(&pin_P0_16) }, // 0.16 - PWM1
// MicroMod +3.3V enable pin
{ MP_ROM_QSTR(MP_QSTR_P3V3_EN), MP_ROM_PTR(&pin_P1_15) }, // MicroMod 3.3V_EN (P1.15)
// PDM
{ MP_ROM_QSTR(MP_QSTR_PDM_CLK), MP_ROM_PTR(&pin_P0_25) }, // 0.25 - PDM_CLK | AUD_BCLK
{ MP_ROM_QSTR(MP_QSTR_PDM_DATA), MP_ROM_PTR(&pin_P0_26) }, // 0.26 - PDM_DATA | AUD_LRCLK
// MicroMod battery voltage sense pin
{ MP_ROM_QSTR(MP_QSTR_BATT_VIN3), MP_ROM_PTR(&pin_P0_30) }, // MicroMod BATT_VIN/3 (P0.30)
// Battery Voltage Monitor
{ MP_ROM_QSTR(MP_QSTR_BATT_VIN3), MP_ROM_PTR(&pin_P0_30) }, // 0.30 - BATT_VIN/3 (AIN6)
// MicroMod reset pin
{ MP_ROM_QSTR(MP_QSTR_RESET), MP_ROM_PTR(&pin_P0_18) }, // MicroMod RESET# (P0.18)
// I2C
{ MP_ROM_QSTR(MP_QSTR_SDA), MP_ROM_PTR(&pin_P0_08) }, // 0.08 - SDA
{ MP_ROM_QSTR(MP_QSTR_SCL), MP_ROM_PTR(&pin_P0_11) }, // 0.11 - SCL (TRACEDATA2)
// MicroMod boot pin
{ MP_ROM_QSTR(MP_QSTR_BOOT), MP_ROM_PTR(&pin_P0_07) }, // MicroMod BOOT (P0.07)
{ MP_ROM_QSTR(MP_QSTR_I2C_INT), MP_ROM_PTR(&pin_P0_15) }, // 0.15 - I2C_INT
// MicroMod USB device pins
// USB device is always used internally by CircuitPython, so skip creating
// the pin objects for it.
// { MP_ROM_QSTR(MP_QSTR_USB_DM), MP_ROM_PTR() }, // MicroMod USB_D- (MDBT50Q-P1M has a dedicated HW D- pin)
// { MP_ROM_QSTR(MP_QSTR_USB_DP), MP_ROM_PTR() }, // MicroMod USB_D+ (MDBT50Q-P1M has a dedicated HW D+ pin)
{ MP_ROM_QSTR(MP_QSTR_SDA1), MP_ROM_PTR(&pin_P1_01) }, // 1.01 - SDA1
{ MP_ROM_QSTR(MP_QSTR_SCL1), MP_ROM_PTR(&pin_P0_24) }, // 0.24 - SCL1
// MicroMod USB host pins
// { MP_ROM_QSTR(MP_QSTR_USBHOST_DM), MP_ROM_PTR() }, // MicroMod USBHOST_D- (not supported)
// { MP_ROM_QSTR(MP_QSTR_USBHOST_DP), MP_ROM_PTR() }, // MicroMod USBHOST_D+ (not supported)
// SPI
{ MP_ROM_QSTR(MP_QSTR_CIPO), MP_ROM_PTR(&pin_P0_02) }, // 0.02 - CIPO | SPI_CIPO
{ MP_ROM_QSTR(MP_QSTR_MISO), MP_ROM_PTR(&pin_P0_02) }, // MISO alias
{ MP_ROM_QSTR(MP_QSTR_COPI), MP_ROM_PTR(&pin_P0_31) }, // 0.31 - COPI | SPI_COPI (AIN7)
{ MP_ROM_QSTR(MP_QSTR_MOSI), MP_ROM_PTR(&pin_P0_31) }, // MOSI alias
{ MP_ROM_QSTR(MP_QSTR_SCK), MP_ROM_PTR(&pin_P0_28) }, // 0.28 - SCK | SPI_SCK (AIN4)
{ MP_ROM_QSTR(MP_QSTR_CS), MP_ROM_PTR(&pin_P0_20) }, // 0.20 - /CS | SPI_/CS
// MicroMod CAN pins
// { MP_ROM_QSTR(MP_QSTR_CAN_RX), MP_ROM_PTR() }, // MicroMod CAN_RX (not supported)
// { MP_ROM_QSTR(MP_QSTR_CAN_TX), MP_ROM_PTR() }, // MicroMod CAN_TX (not supported)
// QSPI, used by flash on this board, but is broken out
// on the MicroMod connector, to to the SDIO pins.
{ MP_ROM_QSTR(MP_QSTR_SDIO_CLK), MP_ROM_PTR(&pin_P0_19) }, // 0.00 - SDIO SCK | Used as: QSPI flash SCK
{ MP_ROM_QSTR(MP_QSTR_SPI_SCK1), MP_ROM_PTR(&pin_P0_19) }, // SPI_SCK1 alias
{ MP_ROM_QSTR(MP_QSTR_SDIO_CMD), MP_ROM_PTR(&pin_P0_14) }, // 0.00 - SDIO CMD | Used as: QSPI flash D0 (or SDI)
{ MP_ROM_QSTR(MP_QSTR_SPI_COPI1), MP_ROM_PTR(&pin_P0_14) }, // SPI_COPI1 alias
{ MP_ROM_QSTR(MP_QSTR_SDIO_DATA0), MP_ROM_PTR(&pin_P0_21) },// 0.00 - SDIO DATA0 | Used as: QSPI flash D1 (or SDO)
{ MP_ROM_QSTR(MP_QSTR_SPI_CIPO1), MP_ROM_PTR(&pin_P0_21) }, // SPI_CIPO1 alias
{ MP_ROM_QSTR(MP_QSTR_SDIO_DATA1), MP_ROM_PTR(&pin_P0_22) },// 0.00 - SDIO DATA1 | Unused for flash.
{ MP_ROM_QSTR(MP_QSTR_SDIO_DATA2), MP_ROM_PTR(&pin_P0_23) },// 0.00 - SDIO DATA2 | Used as: QSPI flash D2
{ MP_ROM_QSTR(MP_QSTR_SDIO_DATA3), MP_ROM_PTR(&pin_P1_00) },// 0.00 - SDIO DATA3 | Use das: QSPI flash D3 (or /HOLD)
{ MP_ROM_QSTR(MP_QSTR_SPI_CS1), MP_ROM_PTR(&pin_P1_00) }, // SPI_CS1 alias
// Note: MicroMod UART (UART0) is not present in the edge connector pinout
// because the primary debug serial port is exposed as a virtual serial port
// over USB.
// Reset Pin
{ MP_ROM_QSTR(MP_QSTR_RESET), MP_ROM_PTR(&pin_P1_14) }, // 0.18 - /RESET (NRESET)
// MicroMod UART1 pins
{ MP_ROM_QSTR(MP_QSTR_UART_TX1), MP_ROM_PTR(&pin_P1_03) }, // MicroMod UART_TX1 | CircuitPython TX (P1.03)
{ MP_ROM_QSTR(MP_QSTR_UART_RX1), MP_ROM_PTR(&pin_P1_10) }, // MicroMod UART_RX1 | CircuitPython RX (P1.10)
{ MP_ROM_QSTR(MP_QSTR_UART_RTS1), MP_ROM_PTR(&pin_P1_02) }, // MicroMod RTS1 (P1.02)
{ MP_ROM_QSTR(MP_QSTR_UART_CTS1), MP_ROM_PTR(&pin_P1_09) }, // MicroMod CTS1 (P1.09)
// LED
{ MP_ROM_QSTR(MP_QSTR_LED1), MP_ROM_PTR(&pin_P0_13) }, // 0.13 - LED_BUILTIN | STAT | Blue LED
// CircuitPython default UART pins
{ MP_ROM_QSTR(MP_QSTR_TX), MP_ROM_PTR(&pin_P1_03) }, // CircuitPython TX | MicroMod UART_TX1 (P1.03)
{ MP_ROM_QSTR(MP_QSTR_RX), MP_ROM_PTR(&pin_P1_10) }, // CircuitPython RX | MicroMod UART_RX1 (P1.10)
// Button
{ MP_ROM_QSTR(MP_QSTR_BUTTON1), MP_ROM_PTR(&pin_P0_07) }, // 0.07 - /BOOT [Active Low] (TRACECLK) - Is button on carriers.
{ MP_ROM_QSTR(MP_QSTR_BOOT), MP_ROM_PTR(&pin_P0_07) }, // BOOT alias
// MicroMod UART2 pins
{ MP_ROM_QSTR(MP_QSTR_UART_TX2), MP_ROM_PTR(&pin_P1_07) }, // MicroMod UART_TX2 (P1.07)
{ MP_ROM_QSTR(MP_QSTR_UART_RX2), MP_ROM_PTR(&pin_P1_05) }, // MicroMod UART_RX2 (P1.05)
// UART
{ MP_ROM_QSTR(MP_QSTR_RX), MP_ROM_PTR(&pin_P1_10) }, // 1.10 - UART RX | RX1
{ MP_ROM_QSTR(MP_QSTR_RX1), MP_ROM_PTR(&pin_P1_10) }, // RX1 alias
{ MP_ROM_QSTR(MP_QSTR_TX), MP_ROM_PTR(&pin_P1_03) }, // 1.03 - UART TX | TX1
{ MP_ROM_QSTR(MP_QSTR_TX1), MP_ROM_PTR(&pin_P1_03) }, // TX1 alias
{ MP_ROM_QSTR(MP_QSTR_CTS), MP_ROM_PTR(&pin_P1_09) }, // 1.09 - UART CTS | CTS1 (TRACEDATA3)
{ MP_ROM_QSTR(MP_QSTR_CTS1), MP_ROM_PTR(&pin_P1_09) }, // CTS1 alias
{ MP_ROM_QSTR(MP_QSTR_RTS), MP_ROM_PTR(&pin_P1_02) }, // 1.02 - UART RTS | RTS1
{ MP_ROM_QSTR(MP_QSTR_RTS1), MP_ROM_PTR(&pin_P1_02) }, // RTS1 alias
// MicroMod I2C pins
{ MP_ROM_QSTR(MP_QSTR_I2C_SDA), MP_ROM_PTR(&pin_P0_08) }, // MicroMod I2C_SDA (P0.08)
{ MP_ROM_QSTR(MP_QSTR_I2C_SCL), MP_ROM_PTR(&pin_P0_11) }, // MicroMod I2C_SCL (P0.11)
{ MP_ROM_QSTR(MP_QSTR_RX2), MP_ROM_PTR(&pin_P1_05) }, // 1.05 - UART RX | RX2
{ MP_ROM_QSTR(MP_QSTR_TX2), MP_ROM_PTR(&pin_P1_07) }, // 1.07 - UART TX | TX2
// CircuitPython default I2C pins
{ MP_ROM_QSTR(MP_QSTR_SDA), MP_ROM_PTR(&pin_P0_08) }, // CircuitPython SDA | MicroMod I2C_SDA (P0.08)
{ MP_ROM_QSTR(MP_QSTR_SCL), MP_ROM_PTR(&pin_P0_11) }, // CircuitPython SCL | MicroMod I2C_SCL (P0.11)
// Board Objects
{ MP_ROM_QSTR(MP_QSTR_UART), MP_ROM_PTR(&board_uart_obj) },
{ MP_ROM_QSTR(MP_QSTR_SPI), MP_ROM_PTR(&board_spi_obj) },
{ MP_ROM_QSTR(MP_QSTR_I2C), MP_ROM_PTR(&board_i2c_obj) },
// MicroMod I2C interrupt pin
{ MP_ROM_QSTR(MP_QSTR_I2C_INT), MP_ROM_PTR(&pin_P0_15) }, // MicroMod I2C_INT (P0.15)
// MicroMod I2C1 pins
{ MP_ROM_QSTR(MP_QSTR_I2C_SDA1), MP_ROM_PTR(&pin_P1_01) }, // MicroMod I2C_SDA1 (P1.01)
{ MP_ROM_QSTR(MP_QSTR_I2C_SCL1), MP_ROM_PTR(&pin_P0_24) }, // MicroMod I2C_SCL1 (P0.24)
// MicroMod SPI pins
{ MP_ROM_QSTR(MP_QSTR_SPI_CIPO), MP_ROM_PTR(&pin_P0_02) }, // MicroMod SPI_CIPO | CircuitPython CIPO (P0.02)
{ MP_ROM_QSTR(MP_QSTR_SPI_MISO), MP_ROM_PTR(&pin_P0_02) }, // MicroMod SPI_MISO | CircuitPython MISO (P0.02)
{ MP_ROM_QSTR(MP_QSTR_SPI_COPI), MP_ROM_PTR(&pin_P0_31) }, // MicroMod SPI_COPI | CircuitPython COPI | LED_DAT (P0.31)
{ MP_ROM_QSTR(MP_QSTR_SPI_MOSI), MP_ROM_PTR(&pin_P0_31) }, // MicroMod SPI_MOSI | CircuitPython MOSI (P0.31)
{ MP_ROM_QSTR(MP_QSTR_SPI_SCK), MP_ROM_PTR(&pin_P0_28) }, // MicroMod SPI_SCK | CircuitPython SCK | LED_CLK (P0.28)
{ MP_ROM_QSTR(MP_QSTR_SPI_CS), MP_ROM_PTR(&pin_P0_20) }, // MicroMod SPI_CS | CircuitPython CS (P0.20)
// CircuitPython default SPI pins
{ MP_ROM_QSTR(MP_QSTR_CIPO), MP_ROM_PTR(&pin_P0_02) }, // CircuitPython CIPO | MicroMod SPI_CIPO (P0.02)
{ MP_ROM_QSTR(MP_QSTR_MISO), MP_ROM_PTR(&pin_P0_02) }, // CircuitPython MISO | MicroMod SPI_MISO (P0.02)
{ MP_ROM_QSTR(MP_QSTR_COPI), MP_ROM_PTR(&pin_P0_31) }, // CircuitPython COPI | MicroMod SPI_COPI | LED_DAT (P0.31)
{ MP_ROM_QSTR(MP_QSTR_MOSI), MP_ROM_PTR(&pin_P0_31) }, // CircuitPython MOSI | MicroMod SPI_MOSI (P0.31)
{ MP_ROM_QSTR(MP_QSTR_SCK), MP_ROM_PTR(&pin_P0_28) }, // CircuitPython SCK | MicroMod SPI_SCK | LED_CLK (P0.28)
{ MP_ROM_QSTR(MP_QSTR_CS), MP_ROM_PTR(&pin_P0_20) }, // CircuitPython CS | MicroMod SPI_CS (P0.20)
// MicroMod 2-wire serial LED pins
{ MP_ROM_QSTR(MP_QSTR_LED_DAT), MP_ROM_PTR(&pin_P0_31) }, // MicroMod LED_DAT | SPI_COPI (P0.31)
{ MP_ROM_QSTR(MP_QSTR_LED_CLK), MP_ROM_PTR(&pin_P0_28) }, // MicroMod LED_CLK | SPI_SCK (P0.28)
// MicroMod SDIO pins
{ MP_ROM_QSTR(MP_QSTR_SDIO_CLK), MP_ROM_PTR(&pin_P0_19) }, // MicroMod SDIO_SCK | SPI_SCK1 (P0.19)
{ MP_ROM_QSTR(MP_QSTR_SDIO_CMD), MP_ROM_PTR(&pin_P0_14) }, // MicroMod SDIO_CMD | SPI_COPI1 (P0.14)
{ MP_ROM_QSTR(MP_QSTR_SDIO_DATA0), MP_ROM_PTR(&pin_P0_21) }, // MicroMod SDIO_DATA0 | SPI_CIPO1 (P0.21)
{ MP_ROM_QSTR(MP_QSTR_SDIO_DATA1), MP_ROM_PTR(&pin_P0_22) }, // MicroMod SDIO_DATA1 (P0.22)
{ MP_ROM_QSTR(MP_QSTR_SDIO_DATA2), MP_ROM_PTR(&pin_P0_23) }, // MicroMod SDIO_DATA2 (P0.23)
{ MP_ROM_QSTR(MP_QSTR_SDIO_DATA3), MP_ROM_PTR(&pin_P1_00) }, // MicroMod SDIO_DATA3 | SPI_CS1 (P1.00)
// MicroMod SPI1 pins
{ MP_ROM_QSTR(MP_QSTR_SPI_CIPO1), MP_ROM_PTR(&pin_P0_21) }, // MicroMod SPI_CIPO1 | SDIO_DATA0 (P0.21)
{ MP_ROM_QSTR(MP_QSTR_SPI_MISO1), MP_ROM_PTR(&pin_P0_21) }, // MicroMod SPI_MISO1 (P0.21)
{ MP_ROM_QSTR(MP_QSTR_SPI_COPI1), MP_ROM_PTR(&pin_P0_14) }, // MicroMod SPI_COPI1 | SDIO_CMD (P0.14)
{ MP_ROM_QSTR(MP_QSTR_SPI_MOSI1), MP_ROM_PTR(&pin_P0_14) }, // MicroMod SPI_MOSI1 (P0.14)
{ MP_ROM_QSTR(MP_QSTR_SPI_SCK1), MP_ROM_PTR(&pin_P0_19) }, // MicroMod SPI_SCK1 | SDIO_SCK (P0.19)
{ MP_ROM_QSTR(MP_QSTR_SPI_CS1), MP_ROM_PTR(&pin_P1_00) }, // MicroMod SPI_CS1 | SDIO_DATA3 (P1.00)
// MicroMod audio pins (not supported by MDBT50Q-P1M)
// { MP_ROM_QSTR(MP_QSTR_AUD_MCLK), MP_ROM_PTR() }, // MicroMod AUD_MCLK (not connected)
// { MP_ROM_QSTR(MP_QSTR_AUD_OUT), MP_ROM_PTR() }, // MicroMod AUD_OUT | I2S_OUT | PCM_OUT | CAM_MCLK (not connected)
// { MP_ROM_QSTR(MP_QSTR_AUD_IN), MP_ROM_PTR() }, // MicroMod AUD_IN | I2S_IN | PCM_IN | CAM_PCLK (not connected)
// { MP_ROM_QSTR(MP_QSTR_AUD_LRCLK), MP_ROM_PTR(&pin_P0_26) },// MicroMod AUD_LRCLK | I2S_WS | PCM_SYNC | PDM_DATA (P0.26)
// { MP_ROM_QSTR(MP_QSTR_AUD_BCLK), MP_ROM_PTR(&pin_P0_25) }, // MicroMod AUD_BCLK | I2S_SCK | PCM_CLK | PDM_CLK (P0.25)
// MicroMod I2S pins (not supported by MDBT50Q-P1M)
// { MP_ROM_QSTR(MP_QSTR_I2S_OUT), MP_ROM_PTR() }, // MicroMod I2S_OUT | AUD_OUT | PCM_OUT | CAM_MCLK (not connected)
// { MP_ROM_QSTR(MP_QSTR_I2S_IN), MP_ROM_PTR() }, // MicroMod I2S_IN | AUD_IN | PCM_IN | CAM_PCLK (not connected)
// { MP_ROM_QSTR(MP_QSTR_I2S_WS), MP_ROM_PTR(&pin_P0_26) }, // MicroMod I2S_WS | AUD_LRCLK | PCM_SYNC | PDM_DATA (P0.26)
// { MP_ROM_QSTR(MP_QSTR_I2S_SCK), MP_ROM_PTR(&pin_P0_25) }, // MicroMod I2S_SCK | AUD_BCLK | PCM_CLK | PDM_CLK (P0.25)
// MicroMod PCM pins (not supported by MDBT50Q-P1M)
// { MP_ROM_QSTR(MP_QSTR_PCM_OUT), MP_ROM_PTR() }, // MicroMod PCM_OUT | AUD_OUT | I2S_OUT | CAM_MCLK (not connected)
// { MP_ROM_QSTR(MP_QSTR_PCM_IN), MP_ROM_PTR() }, // MicroMod PCM_IN | AUD_IN | I2S_IN | CAM_PCLK (not connected)
// { MP_ROM_QSTR(MP_QSTR_PCM_SYNC), MP_ROM_PTR(&pin_P0_26) }, // MicroMod PCM_SYNC | AUD_LRCLK | I2S_WS | PDM_DATA (P0.26)
// { MP_ROM_QSTR(MP_QSTR_PCM_CLK), MP_ROM_PTR(&pin_P0_25) }, // MicroMod PCM_CLK | AUD_BCLK | I2S_SCK | PDM_CLK (P0.25)
// MicroMod PDM pins
{ MP_ROM_QSTR(MP_QSTR_PDM_DATA), MP_ROM_PTR(&pin_P0_26) }, // MicroMod PDM_DATA | AUD_LRCLK | I2S_WS | PCM_SYNC (P0.26)
{ MP_ROM_QSTR(MP_QSTR_PDM_CLK), MP_ROM_PTR(&pin_P0_25) }, // MicroMod PDM_CLK | AUD_BCLK | I2S_SCK | PCM_CLK (P0.25)
// MicroMod SWD pins
// { MP_ROM_QSTR(MP_QSTR_SWDIO), MP_ROM_PTR() }, // MicroMod SWDIO (MDBT50Q-P1M has a dedicated HW SWDIO pin)
// { MP_ROM_QSTR(MP_QSTR_SWCLK), MP_ROM_PTR() }, // MicroMod SWDCK (MDBT50Q-P1M has a dedicated HW SWDCLK pin)
// { MP_ROM_QSTR(MP_QSTR_SWO), MP_ROM_PTR() }, // MicroMod SWO | G11 (not supported)
// MicroMod ADC pins
{ MP_ROM_QSTR(MP_QSTR_A0), MP_ROM_PTR(&pin_P0_05) }, // MicroMod A0 (P0.05)
{ MP_ROM_QSTR(MP_QSTR_A1), MP_ROM_PTR(&pin_P0_04) }, // MicroMod A1 (P0.04)
// MicroMod PWM pins
{ MP_ROM_QSTR(MP_QSTR_PWM0), MP_ROM_PTR(&pin_P0_06) }, // MicroMod PWM0 (P0.06)
{ MP_ROM_QSTR(MP_QSTR_PWM1), MP_ROM_PTR(&pin_P0_16) }, // MicroMod PWM1 (P0.16)
// MicroMod digital pins
{ MP_ROM_QSTR(MP_QSTR_D0), MP_ROM_PTR(&pin_P0_27) }, // MicroMod D0 (P0.27)
{ MP_ROM_QSTR(MP_QSTR_D1), MP_ROM_PTR(&pin_P1_08) }, // MicroMod D1 | CAM_TRIG (P1.08)
// MicroMod general purpose pins
{ MP_ROM_QSTR(MP_QSTR_G0), MP_ROM_PTR(&pin_P0_29) }, // MicroMod G0 | BUS0 (P0.29)
{ MP_ROM_QSTR(MP_QSTR_G1), MP_ROM_PTR(&pin_P0_03) }, // MicroMod G1 | BUS1 (P0.03)
{ MP_ROM_QSTR(MP_QSTR_G2), MP_ROM_PTR(&pin_P1_13) }, // MicroMod G2 | BUS2 (P1.13)
{ MP_ROM_QSTR(MP_QSTR_G3), MP_ROM_PTR(&pin_P1_12) }, // MicroMod G3 | BUS3 (P1.12)
{ MP_ROM_QSTR(MP_QSTR_G4), MP_ROM_PTR(&pin_P1_11) }, // MicroMod G4 | BUS4 (P1.11)
{ MP_ROM_QSTR(MP_QSTR_G5), MP_ROM_PTR(&pin_P0_17) }, // MicroMod G5 | BUS5 (P0.17)
{ MP_ROM_QSTR(MP_QSTR_G6), MP_ROM_PTR(&pin_P1_06) }, // MicroMod G6 | BUS6 (P1.06)
{ MP_ROM_QSTR(MP_QSTR_G7), MP_ROM_PTR(&pin_P1_04) }, // MicroMod G7 | BUS7 (P1.04)
{ MP_ROM_QSTR(MP_QSTR_G8), MP_ROM_PTR(&pin_P1_14) }, // MicroMod G8 (P1.14)
{ MP_ROM_QSTR(MP_QSTR_G9), MP_ROM_PTR(&pin_P0_09) }, // MicroMod G9 | ADC_D- | CAM_HSYNC (P0.09)
{ MP_ROM_QSTR(MP_QSTR_G10), MP_ROM_PTR(&pin_P0_10) }, // MicroMod G10 | ADC_D+ | CAM_VSYNC (P0.10)
// { MP_ROM_QSTR(MP_QSTR_G11), MP_ROM_PTR() }, // MicroMod G11 | SWO (not connected)
// MicroMod 8-bit bus pins
{ MP_ROM_QSTR(MP_QSTR_BUS0), MP_ROM_PTR(&pin_P0_29) }, // MicroMod BUS0 | G0 (P0.29)
{ MP_ROM_QSTR(MP_QSTR_BUS1), MP_ROM_PTR(&pin_P0_03) }, // MicroMod BUS1 | G1 (P0.03)
{ MP_ROM_QSTR(MP_QSTR_BUS2), MP_ROM_PTR(&pin_P1_13) }, // MicroMod BUS2 | G2 (P1.13)
{ MP_ROM_QSTR(MP_QSTR_BUS3), MP_ROM_PTR(&pin_P1_12) }, // MicroMod BUS3 | G3 (P1.12)
{ MP_ROM_QSTR(MP_QSTR_BUS4), MP_ROM_PTR(&pin_P1_11) }, // MicroMod BUS4 | G4 (P1.11)
{ MP_ROM_QSTR(MP_QSTR_BUS5), MP_ROM_PTR(&pin_P0_17) }, // MicroMod BUS5 | G5 (P0.17)
{ MP_ROM_QSTR(MP_QSTR_BUS6), MP_ROM_PTR(&pin_P1_06) }, // MicroMod BUS6 | G6 (P1.06)
{ MP_ROM_QSTR(MP_QSTR_BUS7), MP_ROM_PTR(&pin_P1_04) }, // MicroMod BUS7 | G7 (P1.04)
// MicroMod differential ADC input pins (not supported by MDBT50Q-P1M)
// { MP_ROM_QSTR(MP_QSTR_ADC_DM), MP_ROM_PTR(&pin_P0_09) }, // MicroMod ADC_D- | G9 | CAM_HSYNC (P0.09)
// { MP_ROM_QSTR(MP_QSTR_ADC_DP), MP_ROM_PTR(&pin_P0_10) }, // MicroMod ADC_D+ | G10 | CAM_VSYNC (P0.10)
// MicroMod camera pins (not supported by MDBT50Q-P1M)
// { MP_ROM_QSTR(MP_QSTR_CAM_MCLK), MP_ROM_PTR() }, // MicroMod CAM_MCLK | AUD_OUT | I2S_OUT | PCM_OUT (not connected)
// { MP_ROM_QSTR(MP_QSTR_CAM_PCLK), MP_ROM_PTR() }, // MicroMod CAM_PCLK | AUD_IN | I2S_IN | PCM_IN (not connected)
// { MP_ROM_QSTR(MP_QSTR_CAM_TRIG), MP_ROM_PTR(&pin_P1_08) }, // MicroMod CAM_TRIG | D1 (P1.08)
// { MP_ROM_QSTR(MP_QSTR_CAM_HSYNC), MP_ROM_PTR(&pin_P0_09) },// MicroMod CAM_HSYNC | ADC_D- | G9 (P0.09)
// { MP_ROM_QSTR(MP_QSTR_CAM_VSYNC), MP_ROM_PTR(&pin_P0_10) },// MicroMod CAM_VSYNC | ADC_D+ | G10 (P0.10)
// CircuitPython board objects
{ MP_ROM_QSTR(MP_QSTR_I2C), MP_ROM_PTR(&board_i2c_obj) }, // CircuitPython I2C
{ MP_ROM_QSTR(MP_QSTR_SPI), MP_ROM_PTR(&board_spi_obj) }, // CircuitPython SPI
{ MP_ROM_QSTR(MP_QSTR_UART), MP_ROM_PTR(&board_uart_obj) }, // CircuitPython UART
};
MP_DEFINE_CONST_DICT(board_module_globals, board_module_globals_table);

View File

@ -28,6 +28,7 @@
#include "shared-bindings/audiocore/RawSample.h"
#include "shared-bindings/audiocore/WaveFile.h"
#include "shared-bindings/microcontroller/__init__.h"
#include "supervisor/background_callback.h"
#include "py/mpstate.h"
@ -37,10 +38,8 @@
#if CIRCUITPY_AUDIOPWMIO || CIRCUITPY_AUDIOBUSIO
#define AUDIO_DMA_CHANNEL_COUNT NUM_DMA_CHANNELS
void audio_dma_reset(void) {
for (size_t channel = 0; channel < AUDIO_DMA_CHANNEL_COUNT; channel++) {
for (size_t channel = 0; channel < NUM_DMA_CHANNELS; channel++) {
if (MP_STATE_PORT(playing_audio)[channel] == NULL) {
continue;
}
@ -49,116 +48,152 @@ void audio_dma_reset(void) {
}
}
void audio_dma_convert_signed(audio_dma_t *dma, uint8_t *buffer, uint32_t buffer_length,
uint8_t **output_buffer, uint32_t *output_buffer_length) {
if (dma->first_buffer_free) {
*output_buffer = dma->first_buffer;
} else {
*output_buffer = dma->second_buffer;
}
STATIC void audio_dma_convert_samples(
audio_dma_t *dma,
uint8_t *input, uint32_t input_length,
uint8_t *available_output_buffer, uint32_t available_output_buffer_length,
uint8_t **output, uint32_t *output_length) {
#pragma GCC diagnostic push
#pragma GCC diagnostic ignored "-Wcast-align"
// Check whether a conversion is necessary
if (dma->signed_to_unsigned ||
dma->unsigned_to_signed ||
dma->sample_spacing > 1 ||
(dma->sample_resolution != dma->output_resolution)) {
*output_buffer_length = buffer_length / dma->sample_spacing;
// Must convert.
// Write the conversion into the passed-in output buffer
*output = available_output_buffer;
*output_length = input_length / dma->sample_spacing;
if (*output_length > available_output_buffer_length) {
mp_raise_RuntimeError(translate("Internal audio buffer too small"));
}
uint32_t out_i = 0;
if (dma->sample_resolution <= 8 && dma->output_resolution > 8) {
// reading bytes, writing 16-bit words, so output buffer will be bigger.
*output_length = *output_length * 2;
if (*output_length > available_output_buffer_length) {
mp_raise_RuntimeError(translate("Internal audio buffer too small"));
}
size_t shift = dma->output_resolution - dma->sample_resolution;
for (uint32_t i = 0; i < buffer_length; i += dma->sample_spacing) {
for (uint32_t i = 0; i < input_length; i += dma->sample_spacing) {
if (dma->signed_to_unsigned) {
((uint16_t *)*output_buffer)[out_i] = ((uint16_t)((int8_t *)buffer)[i] + 0x80) << shift;
((uint16_t *)*output)[out_i] = ((uint16_t)((int8_t *)input)[i] + 0x80) << shift;
} else if (dma->unsigned_to_signed) {
((int16_t *)*output_buffer)[out_i] = ((int16_t)((uint8_t *)buffer)[i] - 0x80) << shift;
((int16_t *)*output)[out_i] = ((int16_t)((uint8_t *)input)[i] - 0x80) << shift;
} else {
((uint16_t *)*output_buffer)[out_i] = ((uint16_t)((uint8_t *)buffer)[i]) << shift;
((uint16_t *)*output)[out_i] = ((uint16_t)((uint8_t *)input)[i]) << shift;
}
out_i += 1;
}
} else if (dma->sample_resolution <= 8 && dma->output_resolution <= 8) {
for (uint32_t i = 0; i < buffer_length; i += dma->sample_spacing) {
for (uint32_t i = 0; i < input_length; i += dma->sample_spacing) {
if (dma->signed_to_unsigned) {
((uint8_t *)*output_buffer)[out_i] = ((int8_t *)buffer)[i] + 0x80;
((uint8_t *)*output)[out_i] = ((int8_t *)input)[i] + 0x80;
} else if (dma->unsigned_to_signed) {
((int8_t *)*output_buffer)[out_i] = ((uint8_t *)buffer)[i] - 0x80;
((int8_t *)*output)[out_i] = ((uint8_t *)input)[i] - 0x80;
} else {
((uint8_t *)*output_buffer)[out_i] = ((uint8_t *)buffer)[i];
((uint8_t *)*output)[out_i] = ((uint8_t *)input)[i];
}
out_i += 1;
}
} else if (dma->sample_resolution > 8 && dma->output_resolution > 8) {
size_t shift = 16 - dma->output_resolution;
for (uint32_t i = 0; i < buffer_length / 2; i += dma->sample_spacing) {
for (uint32_t i = 0; i < input_length / 2; i += dma->sample_spacing) {
if (dma->signed_to_unsigned) {
((uint16_t *)*output_buffer)[out_i] = ((int16_t *)buffer)[i] + 0x8000;
((uint16_t *)*output)[out_i] = ((int16_t *)input)[i] + 0x8000;
} else if (dma->unsigned_to_signed) {
((int16_t *)*output_buffer)[out_i] = ((uint16_t *)buffer)[i] - 0x8000;
((int16_t *)*output)[out_i] = ((uint16_t *)input)[i] - 0x8000;
} else {
((uint16_t *)*output_buffer)[out_i] = ((uint16_t *)buffer)[i];
((uint16_t *)*output)[out_i] = ((uint16_t *)input)[i];
}
if (dma->output_resolution < 16) {
if (dma->output_signed) {
((int16_t *)*output_buffer)[out_i] = ((int16_t *)*output_buffer)[out_i] >> shift;
((int16_t *)*output)[out_i] = ((int16_t *)*output)[out_i] >> shift;
} else {
((uint16_t *)*output_buffer)[out_i] = ((uint16_t *)*output_buffer)[out_i] >> shift;
((uint16_t *)*output)[out_i] = ((uint16_t *)*output)[out_i] >> shift;
}
}
out_i += 1;
}
} else {
// (dma->sample_resolution > 8 && dma->output_resolution <= 8)
// Not currently used, but might be in the future.
mp_raise_RuntimeError(translate("Audio conversion not implemented"));
}
} else {
*output_buffer = buffer;
*output_buffer_length = buffer_length;
// No conversion necessary. Designate the input buffer as the output buffer.
*output = input;
*output_length = input_length;
}
#pragma GCC diagnostic pop
dma->first_buffer_free = !dma->first_buffer_free;
}
void audio_dma_load_next_block(audio_dma_t *dma) {
uint8_t dma_channel = dma->channel[1];
if (dma->first_channel_free) {
dma_channel = dma->channel[0];
}
dma->first_channel_free = !dma->first_channel_free;
// channel_idx is 0 or 1.
STATIC void audio_dma_load_next_block(audio_dma_t *dma, size_t buffer_idx) {
size_t dma_channel = dma->channel[buffer_idx];
uint8_t *output_buffer;
uint32_t output_buffer_length;
audioio_get_buffer_result_t get_buffer_result;
uint8_t *buffer;
uint32_t buffer_length;
uint8_t *sample_buffer;
uint32_t sample_buffer_length;
get_buffer_result = audiosample_get_buffer(dma->sample,
dma->single_channel_output, dma->audio_channel, &buffer, &buffer_length);
dma->single_channel_output, dma->audio_channel, &sample_buffer, &sample_buffer_length);
if (get_buffer_result == GET_BUFFER_ERROR) {
audio_dma_stop(dma);
return;
}
audio_dma_convert_signed(dma, buffer, buffer_length, &output_buffer, &output_buffer_length);
// Convert the sample format resolution and signedness, as necessary.
// The input sample buffer is what was read from a file, Mixer, or a raw sample buffer.
// The output buffer is one of the DMA buffers (passed in), or if no conversion was done,
// the original sample buffer (to save copying).
// If we don't have an output buffer, save the pointer to first_buffer for use in the single
// buffer special case.
if (dma->first_buffer == NULL) {
dma->first_buffer = output_buffer;
}
// audio_dma_convert_samples() will write the converted samples into the given output
// buffer if necessary. If no conversion was needed, it will return the sample buffer
// as the output buffer.
uint8_t *output_buffer;
uint32_t output_buffer_length;
audio_dma_convert_samples(dma, sample_buffer, sample_buffer_length,
dma->buffer[buffer_idx], dma->buffer_length[buffer_idx],
&output_buffer, &output_buffer_length);
dma_channel_set_trans_count(dma_channel, output_buffer_length / dma->output_size, false /* trigger */);
dma_channel_set_read_addr(dma_channel, output_buffer, false /* trigger */);
dma_channel_set_trans_count(dma_channel, output_buffer_length / dma->output_size, false /* trigger */);
if (get_buffer_result == GET_BUFFER_DONE) {
if (dma->loop) {
audiosample_reset_buffer(dma->sample, dma->single_channel_output, dma->audio_channel);
} else {
// Set channel trigger to ourselves so we don't keep going.
dma_channel_hw_t *c = &dma_hw->ch[dma_channel];
c->al1_ctrl = (c->al1_ctrl & ~DMA_CH0_CTRL_TRIG_CHAIN_TO_BITS) | (dma_channel << DMA_CH0_CTRL_TRIG_CHAIN_TO_LSB);
c->al1_ctrl =
(c->al1_ctrl & ~DMA_CH0_CTRL_TRIG_CHAIN_TO_BITS) |
(dma_channel << DMA_CH0_CTRL_TRIG_CHAIN_TO_LSB);
if (output_buffer_length == 0 &&
!dma_channel_is_busy(dma->channel[0]) &&
!dma_channel_is_busy(dma->channel[1])) {
// No data has been read, and both DMA channels have now finished, so it's safe to stop.
audio_dma_stop(dma);
dma->playing_in_progress = false;
}
}
}
}
// Playback should be shutdown before calling this.
audio_dma_result audio_dma_setup_playback(audio_dma_t *dma,
audio_dma_result audio_dma_setup_playback(
audio_dma_t *dma,
mp_obj_t sample,
bool loop,
bool single_channel_output,
@ -167,6 +202,7 @@ audio_dma_result audio_dma_setup_playback(audio_dma_t *dma,
uint8_t output_resolution,
uint32_t output_register_address,
uint8_t dma_trigger_source) {
// Use two DMA channels to play because the DMA can't wrap to itself without the
// buffer being power of two aligned.
int dma_channel_0_maybe = dma_claim_unused_channel(false);
@ -191,12 +227,15 @@ audio_dma_result audio_dma_setup_playback(audio_dma_t *dma,
dma->unsigned_to_signed = false;
dma->output_signed = output_signed;
dma->sample_spacing = 1;
dma->first_channel_free = true;
dma->output_resolution = output_resolution;
dma->sample_resolution = audiosample_bits_per_sample(sample);
dma->output_register_address = output_register_address;
audiosample_reset_buffer(sample, single_channel_output, audio_channel);
bool single_buffer;
bool single_buffer; // True if data fits in one single buffer.
bool samples_signed;
uint32_t max_buffer_length;
audiosample_get_buffer_structure(sample, single_channel_output, &single_buffer, &samples_signed,
@ -210,22 +249,25 @@ audio_dma_result audio_dma_setup_playback(audio_dma_t *dma,
dma->sample_spacing > 1 ||
(dma->sample_resolution != dma->output_resolution)) {
max_buffer_length /= dma->sample_spacing;
dma->first_buffer = (uint8_t *)m_realloc(dma->first_buffer, max_buffer_length);
if (dma->first_buffer == NULL) {
}
dma->buffer[0] = (uint8_t *)m_realloc(dma->buffer[0], max_buffer_length);
dma->buffer_length[0] = max_buffer_length;
if (dma->buffer[0] == NULL) {
return AUDIO_DMA_MEMORY_ERROR;
}
if (!single_buffer) {
dma->buffer[1] = (uint8_t *)m_realloc(dma->buffer[1], max_buffer_length);
dma->buffer_length[1] = max_buffer_length;
if (dma->buffer[1] == NULL) {
return AUDIO_DMA_MEMORY_ERROR;
}
dma->first_buffer_free = true;
if (!single_buffer) {
dma->second_buffer = (uint8_t *)m_realloc(dma->second_buffer, max_buffer_length);
if (dma->second_buffer == NULL) {
return AUDIO_DMA_MEMORY_ERROR;
}
}
dma->signed_to_unsigned = !output_signed && samples_signed;
dma->unsigned_to_signed = output_signed && !samples_signed;
}
dma->signed_to_unsigned = !output_signed && samples_signed;
dma->unsigned_to_signed = output_signed && !samples_signed;
if (output_resolution > 8) {
dma->output_size = 2;
} else {
@ -248,9 +290,11 @@ audio_dma_result audio_dma_setup_playback(audio_dma_t *dma,
channel_config_set_dreq(&c, dma_trigger_source);
channel_config_set_read_increment(&c, true);
channel_config_set_write_increment(&c, false);
// Chain to the other channel by default.
channel_config_set_chain_to(&c, dma->channel[(i + 1) % 2]);
dma_channel_set_config(dma->channel[i], &c, false /* trigger */);
dma_channel_set_write_addr(dma->channel[i], (void *)output_register_address, false /* trigger */);
}
@ -260,9 +304,9 @@ audio_dma_result audio_dma_setup_playback(audio_dma_t *dma,
MP_STATE_PORT(playing_audio)[dma->channel[1]] = dma;
// Load the first two blocks up front.
audio_dma_load_next_block(dma);
audio_dma_load_next_block(dma, 0);
if (!single_buffer) {
audio_dma_load_next_block(dma);
audio_dma_load_next_block(dma, 1);
}
// Special case the DMA for a single buffer. It's commonly used for a single wave length of sound
@ -279,16 +323,17 @@ audio_dma_result audio_dma_setup_playback(audio_dma_t *dma,
channel_config_set_chain_to(&c, dma->channel[1]); // Chain to ourselves so we stop.
dma_channel_configure(dma->channel[1], &c,
&dma_hw->ch[dma->channel[0]].al3_read_addr_trig, // write address
&dma->first_buffer, // read address
&dma->buffer[0], // read address
1, // transaction count
false); // trigger
} else {
// Enable our DMA channels on DMA0 to the CPU. This will wake us up when
// Enable our DMA channels on DMA_IRQ_0 to the CPU. This will wake us up when
// we're WFI.
dma_hw->inte0 |= (1 << dma->channel[0]) | (1 << dma->channel[1]);
irq_set_mask_enabled(1 << DMA_IRQ_0, true);
}
dma->playing_in_progress = true;
dma_channel_start(dma->channel[0]);
return AUDIO_DMA_OK;
@ -296,7 +341,14 @@ audio_dma_result audio_dma_setup_playback(audio_dma_t *dma,
void audio_dma_stop(audio_dma_t *dma) {
// Disable our interrupts.
dma_hw->inte0 &= ~((1 << dma->channel[0]) | (1 << dma->channel[1]));
uint32_t channel_mask = 0;
if (dma->channel[0] < NUM_DMA_CHANNELS) {
channel_mask |= 1 << dma->channel[0];
}
if (dma->channel[1] < NUM_DMA_CHANNELS) {
channel_mask |= 1 << dma->channel[1];
}
dma_hw->inte0 &= ~channel_mask;
irq_set_mask_enabled(1 << DMA_IRQ_0, false);
// Run any remaining audio tasks because we remove ourselves from
@ -305,6 +357,10 @@ void audio_dma_stop(audio_dma_t *dma) {
for (size_t i = 0; i < 2; i++) {
size_t channel = dma->channel[i];
if (channel == NUM_DMA_CHANNELS) {
// Channel not in use.
continue;
}
dma_channel_config c = dma_channel_get_default_config(dma->channel[i]);
channel_config_set_enable(&c, false);
@ -313,6 +369,7 @@ void audio_dma_stop(audio_dma_t *dma) {
if (dma_channel_is_busy(channel)) {
dma_channel_abort(channel);
}
dma_channel_set_read_addr(channel, NULL, false /* trigger */);
dma_channel_set_write_addr(channel, NULL, false /* trigger */);
dma_channel_set_trans_count(channel, 0, false /* trigger */);
@ -320,6 +377,7 @@ void audio_dma_stop(audio_dma_t *dma) {
MP_STATE_PORT(playing_audio)[channel] = NULL;
dma->channel[i] = NUM_DMA_CHANNELS;
}
dma->playing_in_progress = false;
// Hold onto our buffers.
}
@ -344,7 +402,7 @@ void audio_dma_resume(audio_dma_t *dma) {
}
bool audio_dma_get_paused(audio_dma_t *dma) {
if (dma->channel[0] >= AUDIO_DMA_CHANNEL_COUNT) {
if (dma->channel[0] >= NUM_DMA_CHANNELS) {
return false;
}
uint32_t control = dma_hw->ch[dma->channel[0]].ctrl_trig;
@ -353,30 +411,26 @@ bool audio_dma_get_paused(audio_dma_t *dma) {
}
void audio_dma_init(audio_dma_t *dma) {
dma->first_buffer = NULL;
dma->second_buffer = NULL;
dma->buffer[0] = NULL;
dma->buffer[1] = NULL;
dma->channel[0] = NUM_DMA_CHANNELS;
dma->channel[1] = NUM_DMA_CHANNELS;
}
void audio_dma_deinit(audio_dma_t *dma) {
m_free(dma->first_buffer);
dma->first_buffer = NULL;
m_free(dma->buffer[0]);
dma->buffer[0] = NULL;
m_free(dma->second_buffer);
dma->second_buffer = NULL;
m_free(dma->buffer[1]);
dma->buffer[1] = NULL;
}
bool audio_dma_get_playing(audio_dma_t *dma) {
if (dma->channel[0] == NUM_DMA_CHANNELS) {
return false;
}
if (!dma_channel_is_busy(dma->channel[0]) &&
!dma_channel_is_busy(dma->channel[1])) {
return false;
}
return true;
return dma->playing_in_progress;
}
// WARN(tannewt): DO NOT print from here, or anything it calls. Printing calls
@ -389,7 +443,25 @@ STATIC void dma_callback_fun(void *arg) {
return;
}
audio_dma_load_next_block(dma);
common_hal_mcu_disable_interrupts();
uint32_t channels_to_load_mask = dma->channels_to_load_mask;
dma->channels_to_load_mask = 0;
common_hal_mcu_enable_interrupts();
// Load the blocks for the requested channels.
uint32_t channel = 0;
while (channels_to_load_mask) {
if (channels_to_load_mask & 1) {
if (dma->channel[0] == channel) {
audio_dma_load_next_block(dma, 0);
}
if (dma->channel[1] == channel) {
audio_dma_load_next_block(dma, 1);
}
}
channels_to_load_mask >>= 1;
channel++;
}
}
void isr_dma_0(void) {
@ -397,6 +469,8 @@ void isr_dma_0(void) {
uint32_t mask = 1 << i;
if ((dma_hw->intr & mask) != 0 && MP_STATE_PORT(playing_audio)[i] != NULL) {
audio_dma_t *dma = MP_STATE_PORT(playing_audio)[i];
// Record all channels whose DMA has completed; they need loading.
dma->channels_to_load_mask |= mask;
background_callback_add(&dma->callback, dma_callback_fun, (void *)dma);
dma_hw->ints0 = mask;
}

View File

@ -43,12 +43,13 @@ typedef struct {
bool signed_to_unsigned;
bool unsigned_to_signed;
bool output_signed;
bool first_channel_free;
bool first_buffer_free;
bool playing_in_progress;
uint8_t output_resolution; // in bits
uint8_t sample_resolution; // in bits
uint8_t *first_buffer;
uint8_t *second_buffer;
uint8_t *buffer[2];
size_t buffer_length[2];
uint32_t channels_to_load_mask;
uint32_t output_register_address;
background_callback_t callback;
} audio_dma_t;

View File

@ -69,7 +69,7 @@ void board_init(void) {
&pin_GPIO24, // Command or data
&pin_GPIO22, // Chip select
&pin_GPIO23, // Reset
1000000, // Baudrate
10000000, // Baudrate
0, // Polarity
0); // Phase

View File

@ -0,0 +1,40 @@
/*
* 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) {
}
void board_deinit(void) {
}

View File

@ -0,0 +1,10 @@
#define MICROPY_HW_BOARD_NAME "Pimoroni Interstate 75"
#define MICROPY_HW_MCU_NAME "rp2040"
#define CIRCUITPY_RGB_STATUS_INVERTED_PWM
#define CIRCUITPY_RGB_STATUS_R (&pin_GPIO16)
#define CIRCUITPY_RGB_STATUS_G (&pin_GPIO17)
#define CIRCUITPY_RGB_STATUS_B (&pin_GPIO18)
#define DEFAULT_I2C_BUS_SCL (&pin_GPIO21)
#define DEFAULT_I2C_BUS_SDA (&pin_GPIO20)

View File

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

View File

@ -0,0 +1 @@
// Put board-specific pico-sdk definitions here. This file must exist.

View File

@ -0,0 +1,52 @@
#include "shared-bindings/board/__init__.h"
STATIC const mp_rom_map_elem_t board_global_dict_table[] = {
{ MP_ROM_QSTR(MP_QSTR_R0), MP_ROM_PTR(&pin_GPIO0) },
{ MP_ROM_QSTR(MP_QSTR_G0), MP_ROM_PTR(&pin_GPIO1) },
{ MP_ROM_QSTR(MP_QSTR_B0), MP_ROM_PTR(&pin_GPIO2) },
{ MP_ROM_QSTR(MP_QSTR_R1), MP_ROM_PTR(&pin_GPIO3) },
{ MP_ROM_QSTR(MP_QSTR_G1), MP_ROM_PTR(&pin_GPIO4) },
{ MP_ROM_QSTR(MP_QSTR_B1), MP_ROM_PTR(&pin_GPIO5) },
{ MP_ROM_QSTR(MP_QSTR_ROW_A), MP_ROM_PTR(&pin_GPIO6) },
{ MP_ROM_QSTR(MP_QSTR_ROW_B), MP_ROM_PTR(&pin_GPIO7) },
{ MP_ROM_QSTR(MP_QSTR_ROW_C), MP_ROM_PTR(&pin_GPIO8) },
{ MP_ROM_QSTR(MP_QSTR_ROW_D), MP_ROM_PTR(&pin_GPIO9) },
{ MP_ROM_QSTR(MP_QSTR_ROW_E), MP_ROM_PTR(&pin_GPIO10) },
{ MP_ROM_QSTR(MP_QSTR_CLK), MP_ROM_PTR(&pin_GPIO11) },
{ MP_ROM_QSTR(MP_QSTR_LAT), MP_ROM_PTR(&pin_GPIO12) },
{ MP_ROM_QSTR(MP_QSTR_OE), MP_ROM_PTR(&pin_GPIO13) },
{ MP_ROM_QSTR(MP_QSTR_SW_A), MP_ROM_PTR(&pin_GPIO14) },
{ MP_ROM_QSTR(MP_QSTR_LED_R), MP_ROM_PTR(&pin_GPIO16) },
{ MP_ROM_QSTR(MP_QSTR_LED_G), MP_ROM_PTR(&pin_GPIO17) },
{ MP_ROM_QSTR(MP_QSTR_LED_B), MP_ROM_PTR(&pin_GPIO18) },
{ MP_ROM_QSTR(MP_QSTR_INT), MP_ROM_PTR(&pin_GPIO19) },
{ MP_ROM_QSTR(MP_QSTR_GP19), MP_ROM_PTR(&pin_GPIO19) },
{ MP_ROM_QSTR(MP_QSTR_SDA), MP_ROM_PTR(&pin_GPIO20) },
{ MP_ROM_QSTR(MP_QSTR_GP20), MP_ROM_PTR(&pin_GPIO20) },
{ MP_ROM_QSTR(MP_QSTR_SCL), MP_ROM_PTR(&pin_GPIO21) },
{ MP_ROM_QSTR(MP_QSTR_GP21), MP_ROM_PTR(&pin_GPIO21) },
{ MP_ROM_QSTR(MP_QSTR_USER_SW), MP_ROM_PTR(&pin_GPIO23) },
{ 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_CURRENT_SENSE), MP_ROM_PTR(&pin_GPIO29) },
{ MP_ROM_QSTR(MP_QSTR_I2C), MP_ROM_PTR(&board_i2c_obj) },
};
MP_DEFINE_CONST_DICT(board_module_globals, board_global_dict_table);

View File

@ -0,0 +1,40 @@
/*
* 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) {
}
void board_deinit(void) {
}

View File

@ -0,0 +1,10 @@
#define MICROPY_HW_BOARD_NAME "Pimoroni Plasma 2040"
#define MICROPY_HW_MCU_NAME "rp2040"
#define CIRCUITPY_RGB_STATUS_INVERTED_PWM
#define CIRCUITPY_RGB_STATUS_R (&pin_GPIO16)
#define CIRCUITPY_RGB_STATUS_G (&pin_GPIO17)
#define CIRCUITPY_RGB_STATUS_B (&pin_GPIO18)
#define DEFAULT_I2C_BUS_SCL (&pin_GPIO21)
#define DEFAULT_I2C_BUS_SDA (&pin_GPIO20)

View File

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

View File

@ -0,0 +1 @@
// Put board-specific pico-sdk definitions here. This file must exist.

View File

@ -0,0 +1,41 @@
#include "shared-bindings/board/__init__.h"
STATIC const mp_rom_map_elem_t board_global_dict_table[] = {
{ MP_ROM_QSTR(MP_QSTR_SW_A), MP_ROM_PTR(&pin_GPIO12) },
{ MP_ROM_QSTR(MP_QSTR_SW_B), MP_ROM_PTR(&pin_GPIO13) },
{ MP_ROM_QSTR(MP_QSTR_CLK), MP_ROM_PTR(&pin_GPIO14) },
{ MP_ROM_QSTR(MP_QSTR_GP14), MP_ROM_PTR(&pin_GPIO14) },
{ MP_ROM_QSTR(MP_QSTR_DATA), MP_ROM_PTR(&pin_GPIO15) },
{ MP_ROM_QSTR(MP_QSTR_GP15), MP_ROM_PTR(&pin_GPIO15) },
{ MP_ROM_QSTR(MP_QSTR_LED_R), MP_ROM_PTR(&pin_GPIO16) },
{ MP_ROM_QSTR(MP_QSTR_LED_G), MP_ROM_PTR(&pin_GPIO17) },
{ MP_ROM_QSTR(MP_QSTR_LED_B), MP_ROM_PTR(&pin_GPIO18) },
{ MP_ROM_QSTR(MP_QSTR_INT), MP_ROM_PTR(&pin_GPIO19) },
{ MP_ROM_QSTR(MP_QSTR_GP19), MP_ROM_PTR(&pin_GPIO19) },
{ MP_ROM_QSTR(MP_QSTR_SDA), MP_ROM_PTR(&pin_GPIO20) },
{ MP_ROM_QSTR(MP_QSTR_GP20), MP_ROM_PTR(&pin_GPIO20) },
{ MP_ROM_QSTR(MP_QSTR_SCL), MP_ROM_PTR(&pin_GPIO21) },
{ MP_ROM_QSTR(MP_QSTR_GP21), MP_ROM_PTR(&pin_GPIO21) },
{ MP_ROM_QSTR(MP_QSTR_USER_SW), MP_ROM_PTR(&pin_GPIO23) },
{ 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_CURRENT_SENSE), MP_ROM_PTR(&pin_GPIO29) },
{ MP_ROM_QSTR(MP_QSTR_I2C), MP_ROM_PTR(&board_i2c_obj) },
};
MP_DEFINE_CONST_DICT(board_module_globals, board_global_dict_table);

View File

@ -1,12 +1,15 @@
#define MICROPY_HW_BOARD_NAME "SparkFun MicroMod ATP - RP2040"
#define MICROPY_HW_BOARD_NAME "SparkFun MicroMod RP2040 Processor"
#define MICROPY_HW_MCU_NAME "rp2040"
// Status LED
#define MICROPY_HW_LED_STATUS (&pin_GPIO25)
#define DEFAULT_I2C_BUS_SCL (&pin_GPIO5)
#define DEFAULT_I2C_BUS_SDA (&pin_GPIO4)
#define DEFAULT_SPI_BUS_SCK (&pin_GPIO14)
#define DEFAULT_SPI_BUS_MOSI (&pin_GPIO15)
#define DEFAULT_SPI_BUS_MISO (&pin_GPIO12)
#define DEFAULT_SPI_BUS_SCK (&pin_GPIO22)
#define DEFAULT_SPI_BUS_MOSI (&pin_GPIO23)
#define DEFAULT_SPI_BUS_MISO (&pin_GPIO20)
#define DEFAULT_UART_BUS_RX (&pin_GPIO1)
#define DEFAULT_UART_BUS_TX (&pin_GPIO0)

View File

@ -1,7 +1,7 @@
USB_VID = 0x1B4F
USB_PID = 0x0024
USB_PRODUCT = "MicroMod RP2040"
USB_MANUFACTURER = "SparkFun"
USB_PRODUCT = "SparkFun MicroMod RP2040 Processor"
USB_MANUFACTURER = "SparkFun Electronics"
CHIP_VARIANT = RP2040
CHIP_FAMILY = rp2

View File

@ -1,105 +1,223 @@
/*
* This file is part of the MicroPython project, http://micropython.org/
*
* The MIT License (MIT)
*
* Copyright (c) 2017 Scott Shawcroft for Adafruit Industries
* Copyright (c) 2021 Chris Wilson
*
* Permission is hereby granted, free of charge, to any person obtaining a copy
* of this software and associated documentation files (the "Software"), to deal
* in the Software without restriction, including without limitation the rights
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
* copies of the Software, and to permit persons to whom the Software is
* furnished to do so, subject to the following conditions:
*
* The above copyright notice and this permission notice shall be included in
* all copies or substantial portions of the Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
* THE SOFTWARE.
*/
#include "shared-bindings/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_GPIO6) }, // GPIO6 - D0
{ MP_ROM_QSTR(MP_QSTR_D1), MP_ROM_PTR(&pin_GPIO7) }, // GPIO7 - D1
// The SparkFun MicroMod spec uses a zero-based peripheral numbering scheme.
// The 0th peripheral is the default and the "0" is omitted from the
// peripheral name (e.g. "I2C" instead of "I2C0").
//
// For more details, see https://www.sparkfun.com/micromod#tech-specs
// A (ADC) pins (A0,A1)
{ MP_ROM_QSTR(MP_QSTR_A0), MP_ROM_PTR(&pin_GPIO26) }, // GPIO26 - A0 | ADC0
{ MP_ROM_QSTR(MP_QSTR_ADC0), MP_ROM_PTR(&pin_GPIO26) }, // ADC0 alias
{ MP_ROM_QSTR(MP_QSTR_A1), MP_ROM_PTR(&pin_GPIO27) }, // GPIO27 - A1 | ADC1
{ MP_ROM_QSTR(MP_QSTR_ADC1), MP_ROM_PTR(&pin_GPIO27) }, // ADC1 alias
// MicroMod built-in status LED pin
// Requirement from the "Designing with MicroMod" SparkFun article:
// "... every Processor Board shall include one status LED connected to a
// pin that is not connected to the board edge."
// Note: GPIO25 is connected to both the status LED and edge connector pin
// G10, which doesn't comply with the requirement above...
{ MP_ROM_QSTR(MP_QSTR_LED), MP_ROM_PTR(&pin_GPIO25) }, // MicroMod LED (GPIO25)
// G (General/BUS) pins (G0-G7, G8 NC, G9-G10, G11 NC)
{ MP_ROM_QSTR(MP_QSTR_G0), MP_ROM_PTR(&pin_GPIO16) }, // GPIO16 - G0 | BUS0
{ MP_ROM_QSTR(MP_QSTR_BUS0), MP_ROM_PTR(&pin_GPIO16) }, // BUS0 alias
{ MP_ROM_QSTR(MP_QSTR_G1), MP_ROM_PTR(&pin_GPIO17) }, // GPIO17 - G1 | BUS1
{ MP_ROM_QSTR(MP_QSTR_BUS1), MP_ROM_PTR(&pin_GPIO17) }, // BUS1 alias
{ MP_ROM_QSTR(MP_QSTR_G2), MP_ROM_PTR(&pin_GPIO18) }, // GPIO18 - G2 | BUS2
{ MP_ROM_QSTR(MP_QSTR_BUS2), MP_ROM_PTR(&pin_GPIO18) }, // BUS2 alias
{ MP_ROM_QSTR(MP_QSTR_G3), MP_ROM_PTR(&pin_GPIO19) }, // GPIO19 - G3 | BUS3
{ MP_ROM_QSTR(MP_QSTR_BUS3), MP_ROM_PTR(&pin_GPIO19) }, // BUS3 alias
{ MP_ROM_QSTR(MP_QSTR_G4), MP_ROM_PTR(&pin_GPIO20) }, // GPIO20 - G4 | BUS4 | SPI_CIPO
{ MP_ROM_QSTR(MP_QSTR_BUS4), MP_ROM_PTR(&pin_GPIO20) }, // BUS4 alias
{ MP_ROM_QSTR(MP_QSTR_G5), MP_ROM_PTR(&pin_GPIO21) }, // GPIO21 - G5 | BUS5 | SPI_CS
{ MP_ROM_QSTR(MP_QSTR_BUS5), MP_ROM_PTR(&pin_GPIO21) }, // BUS5 alias
{ MP_ROM_QSTR(MP_QSTR_G6), MP_ROM_PTR(&pin_GPIO22) }, // GPIO22 - G6 | BUS6 | SPI_SCK
{ MP_ROM_QSTR(MP_QSTR_BUS6), MP_ROM_PTR(&pin_GPIO22) }, // BUS6 alias
{ MP_ROM_QSTR(MP_QSTR_G7), MP_ROM_PTR(&pin_GPIO23) }, // GPIO23 - G7 | BUS7 | SPI_COPI
{ MP_ROM_QSTR(MP_QSTR_BUS7), MP_ROM_PTR(&pin_GPIO23) }, // BUS7 alias
// NC - G8
{ MP_ROM_QSTR(MP_QSTR_G9), MP_ROM_PTR(&pin_GPIO28) }, // GPIO28- G9 | BUS9 | ADC_D- | CAM_HSYNC
{ MP_ROM_QSTR(MP_QSTR_BUS9), MP_ROM_PTR(&pin_GPIO28) }, // BUS9 alias
{ MP_ROM_QSTR(MP_QSTR_ADC_DM), MP_ROM_PTR(&pin_GPIO28) }, // ADC_DM alias
{ MP_ROM_QSTR(MP_QSTR_CAM_HSYNC), MP_ROM_PTR(&pin_GPIO28) }, // CAM_HSYNC alias
{ MP_ROM_QSTR(MP_QSTR_G10), MP_ROM_PTR(&pin_GPIO25) }, // GPIO25 - G10 | BUS10 | ADC_D+ | CAM_VSYNC
{ MP_ROM_QSTR(MP_QSTR_BUS10), MP_ROM_PTR(&pin_GPIO25) }, // BUS10 alias
{ MP_ROM_QSTR(MP_QSTR_ADC_DP), MP_ROM_PTR(&pin_GPIO25) }, // ADC_DP alias
{ MP_ROM_QSTR(MP_QSTR_CAM_VSYNC), MP_ROM_PTR(&pin_GPIO25) }, // CAM_VSYNC alias
// NC - G11
// MicroMod USB bus input voltage (+5V) pin
// { MP_ROM_QSTR(MP_QSTR_USB_VIN), MP_ROM_PTR() }, // MicroMod USB_VIN (not connected)
// PWM pins (PWM0,PWM1)
{ MP_ROM_QSTR(MP_QSTR_PWM0), MP_ROM_PTR(&pin_GPIO13) }, // GPIO13 - PWM0
{ MP_ROM_QSTR(MP_QSTR_PWM1), MP_ROM_PTR(&pin_GPIO24) }, // GPIO24 - PWM1 | AUD_MCLK
// MicroMod +3.3V enable pin
// { MP_ROM_QSTR(MP_QSTR_P3V3_EN), MP_ROM_PTR() }, // MicroMod 3.3V_EN (not connected)
// AUD (audio)
{ MP_ROM_QSTR(MP_QSTR_AUD_MCLK), MP_ROM_PTR(&pin_GPIO24) }, // GPIO24 - AUD_MCLK | PWM1
{ MP_ROM_QSTR(MP_QSTR_AUD_OUT), MP_ROM_PTR(&pin_GPIO10) }, // GPIO10 - AUD_OUT | SDIO_DAT2
{ MP_ROM_QSTR(MP_QSTR_AUD_IN), MP_ROM_PTR(&pin_GPIO11) }, // GPIO11 - AUD_IN | SDIO_DAT1
{ MP_ROM_QSTR(MP_QSTR_AUD_LRCLK), MP_ROM_PTR(&pin_GPIO2) }, // GPIO2 - AUD_LRCLK | CTS1
{ MP_ROM_QSTR(MP_QSTR_AUD_BCLK), MP_ROM_PTR(&pin_GPIO3) }, // GPIO3 - AUD_BCLK | UART_RTS1
// MicroMod battery voltage sense pin
{ MP_ROM_QSTR(MP_QSTR_BATT_VIN3), MP_ROM_PTR(&pin_GPIO29) }, // MicroMod BATT_VIN/3 (GPIO29)
// Battery Voltage Monitor
{ MP_ROM_QSTR(MP_QSTR_BATT_VIN3), MP_ROM_PTR(&pin_GPIO29) }, // GPIO29 - BATT_VIN/3 (ADC03)
// MicroMod reset pin
// { MP_ROM_QSTR(MP_QSTR_RESET), MP_ROM_PTR() }, // MicroMod RESET# (RP2040 has a dedicated HW RUN pin)
// MicroMod boot pin
// { MP_ROM_QSTR(MP_QSTR_BOOT), MP_ROM_PTR() }, // MicroMod BOOT (RP2040 does not have a dedicated BOOT pin)
// I2C
{ MP_ROM_QSTR(MP_QSTR_SDA), MP_ROM_PTR(&pin_GPIO4) }, // GPIO4 - SDA
{ MP_ROM_QSTR(MP_QSTR_SCL), MP_ROM_PTR(&pin_GPIO5) }, // GPIO5 - SCL
// MicroMod USB device pins
// USB device is always used internally by CircuitPython, so skip creating
// the pin objects for it.
// { MP_ROM_QSTR(MP_QSTR_USB_DM), MP_ROM_PTR() }, // MicroMod USB_D- (RP2040 has a dedicated HW USB_DM pin)
// { MP_ROM_QSTR(MP_QSTR_USB_DP), MP_ROM_PTR() }, // MicroMod USB_D+ (RP2040 has a dedicated HW USB_DP pin)
{ MP_ROM_QSTR(MP_QSTR_I2C_INT), MP_ROM_PTR(&pin_GPIO8) }, // GPIO9 - I2C_INT | TX2
// MicroMod USB host pins
// { MP_ROM_QSTR(MP_QSTR_USBHOST_DM), MP_ROM_PTR() }, // MicroMod USBHOST_D- (RP2040 has a dedicated HW USB_DM pin)
// { MP_ROM_QSTR(MP_QSTR_USBHOST_DP), MP_ROM_PTR() }, // MicroMod USBHOST_D+ (RP2040 has a dedicated HW USB_DP pin)
// SPI
{ MP_ROM_QSTR(MP_QSTR_CIPO), MP_ROM_PTR(&pin_GPIO20) }, // GPIO20 - CIPO | SPI_CIPO | G4
{ MP_ROM_QSTR(MP_QSTR_MISO), MP_ROM_PTR(&pin_GPIO20) }, // MISO alias
{ MP_ROM_QSTR(MP_QSTR_COPI), MP_ROM_PTR(&pin_GPIO23) }, // GPIO23 - COPI | SPI_COPI | G7
{ MP_ROM_QSTR(MP_QSTR_MOSI), MP_ROM_PTR(&pin_GPIO23) }, // MOSI alias
{ MP_ROM_QSTR(MP_QSTR_SCK), MP_ROM_PTR(&pin_GPIO22) }, // GPIO22 - SCK | SPI_SCK | G6
{ MP_ROM_QSTR(MP_QSTR_CS), MP_ROM_PTR(&pin_GPIO21) }, // GPIO21 - /CS | SPI_/CS | G5
// MicroMod CAN pins
// { MP_ROM_QSTR(MP_QSTR_CAN_RX), MP_ROM_PTR() }, // MicroMod CAN_RX (not supported)
// { MP_ROM_QSTR(MP_QSTR_CAN_TX), MP_ROM_PTR() }, // MicroMod CAN_TX (not supported)
// SDI/SPI1
{ MP_ROM_QSTR(MP_QSTR_SDIO_CLK), MP_ROM_PTR(&pin_GPIO14) }, // GPIO14 - SDIO SCK | SDIO_CLK
{ MP_ROM_QSTR(MP_QSTR_SPI_SCK1), MP_ROM_PTR(&pin_GPIO14) }, // SPI_SCK1 alias
{ MP_ROM_QSTR(MP_QSTR_SDIO_CMD), MP_ROM_PTR(&pin_GPIO15) }, // GPIO15 - SDIO CMD | SDIO_CMD
{ MP_ROM_QSTR(MP_QSTR_SPI_COPI1), MP_ROM_PTR(&pin_GPIO15) },// SPI_COPI1 alias
{ MP_ROM_QSTR(MP_QSTR_SDIO_DATA0), MP_ROM_PTR(&pin_GPIO12) },// GPIO12 - SDIO DATA0 | SDIO_DATA0
{ MP_ROM_QSTR(MP_QSTR_SPI_CIPO1), MP_ROM_PTR(&pin_GPIO12) }, // SPI_CIPO1 alias
{ MP_ROM_QSTR(MP_QSTR_SDIO_DATA1), MP_ROM_PTR(&pin_GPIO11) },// GPIO11 - SDIO DATA1 | SDIO_DATA1 | AUD_IN
{ MP_ROM_QSTR(MP_QSTR_SDIO_DATA2), MP_ROM_PTR(&pin_GPIO10) },// GPIO10 - SDIO DATA2 | SDIO_DATA2 | AUD_OUT
{ MP_ROM_QSTR(MP_QSTR_SDIO_DATA3), MP_ROM_PTR(&pin_GPIO9) },// GPIO9 - SDIO DATA3 | SDIO_DATA3 | SPI_CS1
{ MP_ROM_QSTR(MP_QSTR_SPI_CS1), MP_ROM_PTR(&pin_GPIO9) }, // SPI_CS1 alias
// Note: MicroMod UART (UART0) is not present in the edge connector pinout
// because the primary debug serial port is exposed as a virtual serial port
// over USB.
// Status LED
{ MP_ROM_QSTR(MP_QSTR_LED1), MP_ROM_PTR(&pin_GPIO25) }, // GPIO25 - LED_BUILTIN | STAT | Blue LED | G10
// MicroMod UART1 pins
{ MP_ROM_QSTR(MP_QSTR_UART_TX1), MP_ROM_PTR(&pin_GPIO0) }, // MicroMod UART_TX1 | CircuitPython TX (GPIO0)
{ MP_ROM_QSTR(MP_QSTR_UART_RX1), MP_ROM_PTR(&pin_GPIO1) }, // MicroMod UART_RX1 | CircuitPython RX (GPIO1)
{ MP_ROM_QSTR(MP_QSTR_UART_RTS1), MP_ROM_PTR(&pin_GPIO3) }, // MicroMod RTS1 (GPIO3)
{ MP_ROM_QSTR(MP_QSTR_UART_CTS1), MP_ROM_PTR(&pin_GPIO2) }, // MicroMod CTS1 (GPIO2)
// UART
{ MP_ROM_QSTR(MP_QSTR_RX), MP_ROM_PTR(&pin_GPIO1) }, // GPIO1 - UART RX | UART_RX1 | RX1
{ MP_ROM_QSTR(MP_QSTR_RX1), MP_ROM_PTR(&pin_GPIO1) }, // RX1 alias
{ MP_ROM_QSTR(MP_QSTR_TX), MP_ROM_PTR(&pin_GPIO0) }, // GPIO0 - UART TX | UART_TX1 | TX1
{ MP_ROM_QSTR(MP_QSTR_TX1), MP_ROM_PTR(&pin_GPIO0) }, // TX1 alias
{ MP_ROM_QSTR(MP_QSTR_CTS), MP_ROM_PTR(&pin_GPIO2) }, // GPIO2 - UART CTS | CTS1 (TRACEDATA3)
{ MP_ROM_QSTR(MP_QSTR_CTS1), MP_ROM_PTR(&pin_GPIO2) }, // CTS1 alias
{ MP_ROM_QSTR(MP_QSTR_RTS), MP_ROM_PTR(&pin_GPIO3) }, // GPIO3 - UART RTS | RTS1
{ MP_ROM_QSTR(MP_QSTR_RTS1), MP_ROM_PTR(&pin_GPIO3) }, // RTS1 alias
// CircuitPython default UART pins
{ MP_ROM_QSTR(MP_QSTR_TX), MP_ROM_PTR(&pin_GPIO0) }, // CircuitPython TX | MicroMod UART_TX1 (GPIO0)
{ MP_ROM_QSTR(MP_QSTR_RX), MP_ROM_PTR(&pin_GPIO1) }, // CircuitPython RX | MicroMod UART_RX1 (GPIO1)
{ MP_ROM_QSTR(MP_QSTR_RX2), MP_ROM_PTR(&pin_GPIO9) }, // GPIO9 - UART RX | UART_RX2 | RX2 | SDIO_DAT3 | SPI_CS1
{ MP_ROM_QSTR(MP_QSTR_TX2), MP_ROM_PTR(&pin_GPIO8) }, // GPIO8 - UART TX | UART_TX2 | TX2 | I2C_INT
// MicroMod UART2 pins
{ MP_ROM_QSTR(MP_QSTR_UART_TX2), MP_ROM_PTR(&pin_GPIO8) }, // MicroMod UART_TX2 (GPIO8)
{ MP_ROM_QSTR(MP_QSTR_UART_RX2), MP_ROM_PTR(&pin_GPIO9) }, // MicroMod UART_RX2 (GPIO9)
// 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) },
// MicroMod I2C pins
{ MP_ROM_QSTR(MP_QSTR_I2C_SDA), MP_ROM_PTR(&pin_GPIO4) }, // MicroMod I2C_SDA | CircuitPython SDA (GPIO4)
{ MP_ROM_QSTR(MP_QSTR_I2C_SCL), MP_ROM_PTR(&pin_GPIO5) }, // MicroMod I2C_SCL | CircuitPython SCL (GPIO5)
// CircuitPython default I2C pins
{ MP_ROM_QSTR(MP_QSTR_SDA), MP_ROM_PTR(&pin_GPIO4) }, // CircuitPython SDA | MicroMod I2C_SDA (GPIO4)
{ MP_ROM_QSTR(MP_QSTR_SCL), MP_ROM_PTR(&pin_GPIO5) }, // CircuitPython SCL | MicroMod I2C_SCL (GPIO5)
// MicroMod I2C interrupt pin
{ MP_ROM_QSTR(MP_QSTR_I2C_INT), MP_ROM_PTR(&pin_GPIO8) }, // MicroMod I2C_INT (GPIO8)
// MicroMod I2C1 pins
// { MP_ROM_QSTR(MP_QSTR_I2C_SDA1), MP_ROM_PTR() }, // MicroMod I2C_SDA1 (not connected)
// { MP_ROM_QSTR(MP_QSTR_I2C_SCL1), MP_ROM_PTR() }, // MicroMod I2C_SCL1 (not connected)
// MicroMod SPI pins
{ MP_ROM_QSTR(MP_QSTR_SPI_CIPO), MP_ROM_PTR(&pin_GPIO20) }, // MicroMod SPI_CIPO | CircuitPython CIPO (GPIO20)
{ MP_ROM_QSTR(MP_QSTR_SPI_MISO), MP_ROM_PTR(&pin_GPIO20) }, // MicroMod SPI_MISO | CircuitPython MISO (GPIO20)
{ MP_ROM_QSTR(MP_QSTR_SPI_COPI), MP_ROM_PTR(&pin_GPIO23) }, // MicroMod SPI_COPI | CircuitPython COPI | LED_DAT (GPIO23)
{ MP_ROM_QSTR(MP_QSTR_SPI_MOSI), MP_ROM_PTR(&pin_GPIO23) }, // MicroMod SPI_MOSI | CircuitPython MOSI (GPIO23)
{ MP_ROM_QSTR(MP_QSTR_SPI_SCK), MP_ROM_PTR(&pin_GPIO22) }, // MicroMod SPI_SCK | CircuitPython SCK | LED_CLK (GPIO22)
{ MP_ROM_QSTR(MP_QSTR_SPI_CS), MP_ROM_PTR(&pin_GPIO21) }, // MicroMod SPI_CS | CircuitPython CS (GPIO21)
// CircuitPython default SPI pins
{ MP_ROM_QSTR(MP_QSTR_CIPO), MP_ROM_PTR(&pin_GPIO20) }, // CircuitPython CIPO | MicroMod SPI_CIPO (GPIO20)
{ MP_ROM_QSTR(MP_QSTR_MISO), MP_ROM_PTR(&pin_GPIO20) }, // CircuitPython MISO | MicroMod SPI_MISO (GPIO20)
{ MP_ROM_QSTR(MP_QSTR_COPI), MP_ROM_PTR(&pin_GPIO23) }, // CircuitPython COPI | MicroMod SPI_COPI | LED_DAT (GPIO23)
{ MP_ROM_QSTR(MP_QSTR_MOSI), MP_ROM_PTR(&pin_GPIO23) }, // CircuitPython MOSI | MicroMod SPI_MOSI (GPIO23)
{ MP_ROM_QSTR(MP_QSTR_SCK), MP_ROM_PTR(&pin_GPIO22) }, // CircuitPython SCK | MicroMod SPI_SCK | LED_CLK (GPIO22)
{ MP_ROM_QSTR(MP_QSTR_CS), MP_ROM_PTR(&pin_GPIO21) }, // CircuitPython CS | MicroMod SPI_CS (GPIO21)
// MicroMod 2-wire serial LED pins
{ MP_ROM_QSTR(MP_QSTR_LED_DAT), MP_ROM_PTR(&pin_GPIO23) }, // MicroMod LED_DAT | SPI_COPI
{ MP_ROM_QSTR(MP_QSTR_LED_CLK), MP_ROM_PTR(&pin_GPIO22) }, // MicroMod LED_CLK | SPI_SCK
// MicroMod SDIO pins
{ MP_ROM_QSTR(MP_QSTR_SDIO_CLK), MP_ROM_PTR(&pin_GPIO14) }, // MicroMod SDIO_SCK | SPI_SCK1 (GPIO14)
{ MP_ROM_QSTR(MP_QSTR_SDIO_CMD), MP_ROM_PTR(&pin_GPIO15) }, // MicroMod SDIO_CMD | SPI_COPI1 (GPIO15)
{ MP_ROM_QSTR(MP_QSTR_SDIO_DATA0), MP_ROM_PTR(&pin_GPIO12) }, // MicroMod SDIO_DATA0 | SPI_CIPO1 (GPIO12)
{ MP_ROM_QSTR(MP_QSTR_SDIO_DATA1), MP_ROM_PTR(&pin_GPIO11) }, // MicroMod SDIO_DATA1 (GPIO11)
{ MP_ROM_QSTR(MP_QSTR_SDIO_DATA2), MP_ROM_PTR(&pin_GPIO10) }, // MicroMod SDIO_DATA2 (GPIO10)
{ MP_ROM_QSTR(MP_QSTR_SDIO_DATA3), MP_ROM_PTR(&pin_GPIO9) }, // MicroMod SDIO_DATA3 | SPI_CS1 (GPIO9)
// MicroMod SPI1 pins
{ MP_ROM_QSTR(MP_QSTR_SPI_CIPO1), MP_ROM_PTR(&pin_GPIO12) }, // MicroMod SPI_CIPO1 | SDIO_DATA0 (GPIO12)
{ MP_ROM_QSTR(MP_QSTR_SPI_MISO1), MP_ROM_PTR(&pin_GPIO12) }, // MicroMod SPI_MISO1 (GPIO12)
{ MP_ROM_QSTR(MP_QSTR_SPI_COPI1), MP_ROM_PTR(&pin_GPIO15) }, // MicroMod SPI_COPI1 | SDIO_CMD (GPIO15)
{ MP_ROM_QSTR(MP_QSTR_SPI_MOSI1), MP_ROM_PTR(&pin_GPIO15) }, // MicroMod SPI_MOSI1 (GPIO15)
{ MP_ROM_QSTR(MP_QSTR_SPI_SCK1), MP_ROM_PTR(&pin_GPIO14) }, // MicroMod SPI_SCK1 | SDIO_SCK (GPIO14)
{ MP_ROM_QSTR(MP_QSTR_SPI_CS1), MP_ROM_PTR(&pin_GPIO9) }, // MicroMod SPI_CS1 | SDIO_DATA3 (GPIO9)
// MicroMod audio pins
{ MP_ROM_QSTR(MP_QSTR_AUD_MCLK), MP_ROM_PTR(&pin_GPIO24) }, // MicroMod AUD_MCLK (GPIO24)
{ MP_ROM_QSTR(MP_QSTR_AUD_OUT), MP_ROM_PTR(&pin_GPIO10) }, // MicroMod AUD_OUT | I2S_OUT | PCM_OUT | CAM_MCLK (GPIO10)
{ MP_ROM_QSTR(MP_QSTR_AUD_IN), MP_ROM_PTR(&pin_GPIO11) }, // MicroMod AUD_IN | I2S_IN | PCM_IN | CAM_PCLK (GPIO11)
{ MP_ROM_QSTR(MP_QSTR_AUD_LRCLK), MP_ROM_PTR(&pin_GPIO2) }, // MicroMod AUD_LRCLK | I2S_WS | PCM_SYNC | PDM_DATA (GPIO2)
{ MP_ROM_QSTR(MP_QSTR_AUD_BCLK), MP_ROM_PTR(&pin_GPIO3) }, // MicroMod AUD_BCLK | I2S_SCK | PCM_CLK | PDM_CLK (GPIO3)
// MicroMod I2S pins
{ MP_ROM_QSTR(MP_QSTR_I2S_OUT), MP_ROM_PTR(&pin_GPIO10) }, // MicroMod I2S_OUT | AUD_OUT | PCM_OUT | CAM_MCLK (GPIO10)
{ MP_ROM_QSTR(MP_QSTR_I2S_IN), MP_ROM_PTR(&pin_GPIO11) }, // MicroMod I2S_IN | AUD_IN | PCM_IN | CAM_PCLK (GPIO11)
{ MP_ROM_QSTR(MP_QSTR_I2S_WS), MP_ROM_PTR(&pin_GPIO2) }, // MicroMod I2S_WS | AUD_LRCLK | PCM_SYNC | PDM_DATA (GPIO2)
{ MP_ROM_QSTR(MP_QSTR_I2S_SCK), MP_ROM_PTR(&pin_GPIO3) }, // MicroMod I2S_SCK | AUD_BCLK | PCM_CLK | PDM_CLK (GPIO3)
// MicroMod PCM pins
{ MP_ROM_QSTR(MP_QSTR_PCM_OUT), MP_ROM_PTR(&pin_GPIO10) }, // MicroMod PCM_OUT | AUD_OUT | I2S_OUT | CAM_MCLK (GPIO10)
{ MP_ROM_QSTR(MP_QSTR_PCM_IN), MP_ROM_PTR(&pin_GPIO11) }, // MicroMod PCM_IN | AUD_IN | I2S_IN | CAM_PCLK (GPIO11)
{ MP_ROM_QSTR(MP_QSTR_PCM_SYNC), MP_ROM_PTR(&pin_GPIO2) }, // MicroMod PCM_SYNC | AUD_LRCLK | I2S_WS | PDM_DATA (GPIO2)
{ MP_ROM_QSTR(MP_QSTR_PCM_CLK), MP_ROM_PTR(&pin_GPIO3) }, // MicroMod PCM_CLK | AUD_BCLK | I2S_SCK | PDM_CLK (GPIO3)
// MicroMod PDM pins
{ MP_ROM_QSTR(MP_QSTR_PDM_DATA), MP_ROM_PTR(&pin_GPIO2) }, // MicroMod PDM_DATA | AUD_LRCLK | I2S_WS | PCM_SYNC (GPIO2)
{ MP_ROM_QSTR(MP_QSTR_PDM_CLK), MP_ROM_PTR(&pin_GPIO3) }, // MicroMod PDM_CLK | AUD_BCLK | I2S_SCK | PCM_CLK (GPIO3)
// MicroMod SWD pins
// { MP_ROM_QSTR(MP_QSTR_SWDIO), MP_ROM_PTR() }, // MicroMod SWDIO (RP2040 has a dedicated HW SWDIO pin)
// { MP_ROM_QSTR(MP_QSTR_SWCLK), MP_ROM_PTR() }, // MicroMod SWDCK (RP2040 has a dedicated HW SWCLK pin)
// { MP_ROM_QSTR(MP_QSTR_SWO), MP_ROM_PTR() }, // MicroMod SWO | G11 (not supported)
// MicroMod ADC pins
{ MP_ROM_QSTR(MP_QSTR_A0), MP_ROM_PTR(&pin_GPIO26) }, // MicroMod A0 (GPIO26)
{ MP_ROM_QSTR(MP_QSTR_A1), MP_ROM_PTR(&pin_GPIO27) }, // MicroMod A1 (GPIO27)
// MicroMod PWM pins
{ MP_ROM_QSTR(MP_QSTR_PWM0), MP_ROM_PTR(&pin_GPIO13) }, // MicroMod PWM0 (GPIO13)
{ MP_ROM_QSTR(MP_QSTR_PWM1), MP_ROM_PTR(&pin_GPIO24) }, // MicroMod PWM1 (GPIO24)
// MicroMod digital pins
{ MP_ROM_QSTR(MP_QSTR_D0), MP_ROM_PTR(&pin_GPIO6) }, // MicroMod D0 (GPIO6)
{ MP_ROM_QSTR(MP_QSTR_D1), MP_ROM_PTR(&pin_GPIO7) }, // MicroMod D1 | CAM_TRIG (GPIO7)
// MicroMod general purpose pins
{ MP_ROM_QSTR(MP_QSTR_G0), MP_ROM_PTR(&pin_GPIO16) }, // MicroMod G0 | BUS0 (GPIO16)
{ MP_ROM_QSTR(MP_QSTR_G1), MP_ROM_PTR(&pin_GPIO17) }, // MicroMod G1 | BUS1 (GPIO17)
{ MP_ROM_QSTR(MP_QSTR_G2), MP_ROM_PTR(&pin_GPIO18) }, // MicroMod G2 | BUS2 (GPIO18)
{ MP_ROM_QSTR(MP_QSTR_G3), MP_ROM_PTR(&pin_GPIO19) }, // MicroMod G3 | BUS3 (GPIO19)
{ MP_ROM_QSTR(MP_QSTR_G4), MP_ROM_PTR(&pin_GPIO20) }, // MicroMod G4 | BUS4 (GPIO20)
{ MP_ROM_QSTR(MP_QSTR_G5), MP_ROM_PTR(&pin_GPIO21) }, // MicroMod G5 | BUS5 (GPIO21)
{ MP_ROM_QSTR(MP_QSTR_G6), MP_ROM_PTR(&pin_GPIO22) }, // MicroMod G6 | BUS6 (GPIO22)
{ MP_ROM_QSTR(MP_QSTR_G7), MP_ROM_PTR(&pin_GPIO23) }, // MicroMod G7 | BUS7 (GPIO23)
// { MP_ROM_QSTR(MP_QSTR_G8), MP_ROM_PTR() }, // MicroMod G8 (not connected)
{ MP_ROM_QSTR(MP_QSTR_G9), MP_ROM_PTR(&pin_GPIO28) }, // MicroMod G9 | ADC_D- | CAM_HSYNC (GPIO28)
{ MP_ROM_QSTR(MP_QSTR_G10), MP_ROM_PTR(&pin_GPIO25) }, // MicroMod G10 | ADC_D+ | CAM_VSYNC (GPIO25)
// { MP_ROM_QSTR(MP_QSTR_G11), MP_ROM_PTR() }, // MicroMod G11 | SWO (not connected)
// MicroMod 8-bit bus pins
{ MP_ROM_QSTR(MP_QSTR_BUS0), MP_ROM_PTR(&pin_GPIO16) }, // MicroMod BUS0 | G0 (GPIO16)
{ MP_ROM_QSTR(MP_QSTR_BUS1), MP_ROM_PTR(&pin_GPIO17) }, // MicroMod BUS1 | G1 (GPIO17)
{ MP_ROM_QSTR(MP_QSTR_BUS2), MP_ROM_PTR(&pin_GPIO18) }, // MicroMod BUS2 | G2 (GPIO18)
{ MP_ROM_QSTR(MP_QSTR_BUS3), MP_ROM_PTR(&pin_GPIO19) }, // MicroMod BUS3 | G3 (GPIO19)
{ MP_ROM_QSTR(MP_QSTR_BUS4), MP_ROM_PTR(&pin_GPIO20) }, // MicroMod BUS4 | G4 (GPIO20)
{ MP_ROM_QSTR(MP_QSTR_BUS5), MP_ROM_PTR(&pin_GPIO21) }, // MicroMod BUS5 | G5 (GPIO21)
{ MP_ROM_QSTR(MP_QSTR_BUS6), MP_ROM_PTR(&pin_GPIO22) }, // MicroMod BUS6 | G6 (GPIO22)
{ MP_ROM_QSTR(MP_QSTR_BUS7), MP_ROM_PTR(&pin_GPIO23) }, // MicroMod BUS7 | G7 (GPIO23)
// MicroMod differential ADC input pins (not supported by RP2040)
// { MP_ROM_QSTR(MP_QSTR_ADC_DM), MP_ROM_PTR(&pin_GPIO28) }, // MicroMod ADC_D- | G9 | CAM_HSYNC (GPIO28)
// { MP_ROM_QSTR(MP_QSTR_ADC_DP), MP_ROM_PTR(&pin_GPIO25) }, // MicroMod ADC_D+ | G10 | CAM_VSYNC (GPIO25)
// MicroMod camera pins
{ MP_ROM_QSTR(MP_QSTR_CAM_MCLK), MP_ROM_PTR(&pin_GPIO10) }, // MicroMod CAM_MCLK | AUD_OUT | I2S_OUT | PCM_OUT (GPIO10)
{ MP_ROM_QSTR(MP_QSTR_CAM_PCLK), MP_ROM_PTR(&pin_GPIO11) }, // MicroMod CAM_PCLK | AUD_IN | I2S_IN | PCM_IN (GPIO11)
{ MP_ROM_QSTR(MP_QSTR_CAM_TRIG), MP_ROM_PTR(&pin_GPIO7) }, // MicroMod CAM_TRIG | D1 (GPIO7)
{ MP_ROM_QSTR(MP_QSTR_CAM_HSYNC), MP_ROM_PTR(&pin_GPIO28) }, // MicroMod CAM_HSYNC | ADC_D- | G9 (GPIO28)
{ MP_ROM_QSTR(MP_QSTR_CAM_VSYNC), MP_ROM_PTR(&pin_GPIO25) }, // MicroMod CAM_VSYNC | ADC_D+ | G10 (GPIO25)
// CircuitPython board objects
{ MP_ROM_QSTR(MP_QSTR_I2C), MP_ROM_PTR(&board_i2c_obj) }, // CircuitPython I2C
{ MP_ROM_QSTR(MP_QSTR_SPI), MP_ROM_PTR(&board_spi_obj) }, // CircuitPython SPI
{ MP_ROM_QSTR(MP_QSTR_UART), MP_ROM_PTR(&board_uart_obj) }, // CircuitPython UART
};
MP_DEFINE_CONST_DICT(board_module_globals, board_global_dict_table);

View File

@ -117,7 +117,8 @@ void common_hal_audiobusio_i2sout_construct(audiobusio_i2sout_obj_t *self,
}
// Use the state machine to manage pins.
common_hal_rp2pio_statemachine_construct(&self->state_machine,
common_hal_rp2pio_statemachine_construct(
&self->state_machine,
program, program_len,
44100 * 32 * 6, // Clock at 44.1 khz to warm the DAC up.
NULL, 0,

View File

@ -38,7 +38,6 @@
#include "shared-bindings/microcontroller/__init__.h"
#include "shared-bindings/microcontroller/Pin.h"
#include "shared-bindings/microcontroller/Processor.h"
#include "supervisor/shared/tick.h"
#include "supervisor/shared/translate.h"
#include "src/rp2040/hardware_structs/include/hardware/structs/dma.h"
@ -158,27 +157,6 @@ void common_hal_audiopwmio_pwmaudioout_play(audiopwmio_pwmaudioout_obj_t *self,
tx_register += self->left_pwm.channel * sizeof(uint16_t);
}
audio_dma_result result = audio_dma_setup_playback(
&self->dma,
sample,
loop,
false, // single channel
0, // audio channel
false, // output signed
BITS_PER_SAMPLE,
(uint32_t)tx_register, // output register: PWM cc register
0x3b + pacing_timer); // data request line
if (result == AUDIO_DMA_DMA_BUSY) {
common_hal_audiopwmio_pwmaudioout_stop(self);
mp_raise_RuntimeError(translate("No DMA channel found"));
}
if (result == AUDIO_DMA_MEMORY_ERROR) {
common_hal_audiopwmio_pwmaudioout_stop(self);
mp_raise_RuntimeError(translate("Unable to allocate buffers for signed conversion"));
}
// OK! We got all of the resources we need and dma is ready.
self->pacing_timer = pacing_timer;
// Playback with two independent clocks. One is the sample rate which
@ -215,6 +193,27 @@ void common_hal_audiopwmio_pwmaudioout_play(audiopwmio_pwmaudioout_obj_t *self,
}
dma_hw->timer[pacing_timer] = best_numerator << 16 | best_denominator;
audio_dma_result result = audio_dma_setup_playback(
&self->dma,
sample,
loop,
false, // single channel
0, // audio channel
false, // output signed
BITS_PER_SAMPLE,
(uint32_t)tx_register, // output register: PWM cc register
0x3b + pacing_timer); // data request line
if (result == AUDIO_DMA_DMA_BUSY) {
common_hal_audiopwmio_pwmaudioout_stop(self);
mp_raise_RuntimeError(translate("No DMA channel found"));
}
if (result == AUDIO_DMA_MEMORY_ERROR) {
common_hal_audiopwmio_pwmaudioout_stop(self);
mp_raise_RuntimeError(translate("Unable to allocate buffers for signed conversion"));
}
// OK! We got all of the resources we need and dma is ready.
}
void common_hal_audiopwmio_pwmaudioout_stop(audiopwmio_pwmaudioout_obj_t *self) {
@ -226,9 +225,11 @@ void common_hal_audiopwmio_pwmaudioout_stop(audiopwmio_pwmaudioout_obj_t *self)
audio_dma_stop(&self->dma);
// Set to quiescent level.
pwm_hw->slice[self->left_pwm.slice].cc = self->quiescent_value;
common_hal_pwmio_pwmout_set_duty_cycle(&self->left_pwm, self->quiescent_value);
pwmio_pwmout_set_top(&self->left_pwm, PWM_TOP);
if (self->stereo) {
pwm_hw->slice[self->right_pwm.slice].cc = self->quiescent_value;
common_hal_pwmio_pwmout_set_duty_cycle(&self->right_pwm, self->quiescent_value);
pwmio_pwmout_set_top(&self->right_pwm, PWM_TOP);
}
}

View File

@ -0,0 +1,39 @@
/*
* 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,65 @@
/*
* This file is part of the MicroPython project, http://micropython.org/
*
* The MIT License (MIT)
*
* Copyright (c) 2021 Chris Wilson
*
* 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 "SparkFun STM32 MicroMod Processor"
#define MICROPY_HW_MCU_NAME "STM32F405RG"
#define FLASH_SIZE (0x100000)
#define FLASH_PAGE_SIZE (0x4000)
#define HSE_VALUE ((uint32_t)12000000)
#define LSE_VALUE ((uint32_t)32768)
#define BOARD_HAS_LOW_SPEED_CRYSTAL (1)
// Status LED
#define MICROPY_HW_LED_STATUS (&pin_PA15)
// On-board SPI flash
#define SPI_FLASH_MOSI_PIN (&pin_PC12)
#define SPI_FLASH_MISO_PIN (&pin_PC11)
#define SPI_FLASH_SCK_PIN (&pin_PC10)
#define SPI_FLASH_CS_PIN (&pin_PC03)
// Bootloader only
#ifdef UF2_BOOTLOADER_ENABLED
#define BOARD_VTOR_DEFER (1) // Leave VTOR relocation to bootloader
#endif
#define DEFAULT_I2C_BUS_SCL (&pin_PB10)
#define DEFAULT_I2C_BUS_SDA (&pin_PB11)
#define DEFAULT_SPI_BUS_SCK (&pin_PA05)
#define DEFAULT_SPI_BUS_MOSI (&pin_PA07)
#define DEFAULT_SPI_BUS_MISO (&pin_PA06)
#define DEFAULT_UART_BUS_RX (&pin_PA03)
#define DEFAULT_UART_BUS_TX (&pin_PA02)
// USB is always used internally so skip the pin objects for it.
#define IGNORE_PIN_PA11 (1)
#define IGNORE_PIN_PA12 (1)

View File

@ -0,0 +1,19 @@
USB_VID = 0X1B4F
USB_PID = 0x0027
USB_PRODUCT = "SparkFun STM32 MicroMod Processor"
USB_MANUFACTURER = "SparkFun Electronics"
SPI_FLASH_FILESYSTEM = 1
EXTERNAL_FLASH_DEVICES = W25Q128JVxM
MCU_SERIES = F4
MCU_VARIANT = STM32F405xx
MCU_PACKAGE = LQFP64
LD_COMMON = boards/common_default.ld
LD_DEFAULT = boards/STM32F405_default.ld
# UF2 boot option
LD_BOOT = boards/STM32F405_boot.ld
UF2_OFFSET = 0x8010000
CIRCUITPY_RGBMATRIX ?= 1

View File

@ -0,0 +1,224 @@
/*
* This file is part of the MicroPython project, http://micropython.org/
*
* The MIT License (MIT)
*
* Copyright (c) 2021 Chris Wilson
*
* Permission is hereby granted, free of charge, to any person obtaining a copy
* of this software and associated documentation files (the "Software"), to deal
* in the Software without restriction, including without limitation the rights
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
* copies of the Software, and to permit persons to whom the Software is
* furnished to do so, subject to the following conditions:
*
* The above copyright notice and this permission notice shall be included in
* all copies or substantial portions of the Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
* THE SOFTWARE.
*/
#include "shared-bindings/board/__init__.h"
STATIC const mp_rom_map_elem_t board_module_globals_table[] = {
// The SparkFun MicroMod spec uses a zero-based peripheral numbering scheme.
// The 0th peripheral is the default and the "0" is omitted from the
// peripheral name (e.g. "I2C" instead of "I2C0").
//
// For more details, see https://www.sparkfun.com/micromod#tech-specs
// MicroMod built-in status LED pin
// Requirement from the "Designing with MicroMod" SparkFun article:
// "... every Processor Board shall include one status LED connected to a
// pin that is not connected to the board edge."
{ MP_ROM_QSTR(MP_QSTR_LED), MP_ROM_PTR(&pin_PA15) }, // MicroMod LED (PA15)
// MicroMod USB bus input voltage (+5V) pin
// { MP_ROM_QSTR(MP_QSTR_USB_VIN), MP_ROM_PTR() }, // MicroMod USB_VIN (not connected)
// MicroMod +3.3V enable pin
// { MP_ROM_QSTR(MP_QSTR_P3V3_EN), MP_ROM_PTR() }, // MicroMod 3.3V_EN (not connected)
// MicroMod battery voltage sense pin
{ MP_ROM_QSTR(MP_QSTR_BATT_VIN3), MP_ROM_PTR(&pin_PA01) }, // MicroMod BATT_VIN/3 (PA1)
// MicroMod reset pin
// { MP_ROM_QSTR(MP_QSTR_RESET), MP_ROM_PTR() }, // MicroMod RESET# (STM32 has a dedicated HW NRST pin)
// MicroMod boot pin
// { MP_ROM_QSTR(MP_QSTR_BOOT), MP_ROM_PTR() }, // MicroMod BOOT (STM32 has a dedicated HW BOOT0 pin)
// MicroMod USB device pins
// USB device is always used internally by CircuitPython, so skip creating
// the pin objects for it. See explicit ignores in mpconfigboard.h.
// { MP_ROM_QSTR(MP_QSTR_USB_DM), MP_ROM_PTR(&pin_PA11) }, // MicroMod USB_D- (PA11)
// { MP_ROM_QSTR(MP_QSTR_USB_DP), MP_ROM_PTR(&pin_PA12) }, // MicroMod USB_D+ (PA12)
// MicroMod USB host pins
{ MP_ROM_QSTR(MP_QSTR_USBHOST_DM), MP_ROM_PTR(&pin_PB14) }, // MicroMod USBHOST_D- (PB14)
{ MP_ROM_QSTR(MP_QSTR_USBHOST_DP), MP_ROM_PTR(&pin_PB15) }, // MicroMod USBHOST_D+ (PB15)
// MicroMod CAN pins
{ MP_ROM_QSTR(MP_QSTR_CAN_RX), MP_ROM_PTR(&pin_PB08) }, // MicroMod CAN_RX (PB8)
{ MP_ROM_QSTR(MP_QSTR_CAN_TX), MP_ROM_PTR(&pin_PB09) }, // MicroMod CAN_TX (PB9)
// Note: MicroMod UART (UART0) is not present in the edge connector pinout
// because the primary debug serial port is exposed as a virtual serial port
// over USB.
// MicroMod UART1 pins
{ MP_ROM_QSTR(MP_QSTR_UART_TX1), MP_ROM_PTR(&pin_PA02) }, // MicroMod UART_TX1 | CircuitPython TX (PA2)
{ MP_ROM_QSTR(MP_QSTR_UART_RX1), MP_ROM_PTR(&pin_PA03) }, // MicroMod UART_RX1 | CircuitPython RX (PA3)
// { MP_ROM_QSTR(MP_QSTR_UART_RTS1), MP_ROM_PTR() }, // MicroMod RTS1 (not connected)
// { MP_ROM_QSTR(MP_QSTR_UART_CTS1), MP_ROM_PTR() }, // MicroMod CTS1 (not connected)
// CircuitPython default UART pins
{ MP_ROM_QSTR(MP_QSTR_TX), MP_ROM_PTR(&pin_PA02) }, // CircuitPython TX | MicroMod UART_TX1 (PA2)
{ MP_ROM_QSTR(MP_QSTR_RX), MP_ROM_PTR(&pin_PA03) }, // CircuitPython RX | MicroMod UART_RX1 (PA3)
// MicroMod UART2 pins
// { MP_ROM_QSTR(MP_QSTR_UART_TX2), MP_ROM_PTR() }, // MicroMod UART_TX2 (not connected)
// { MP_ROM_QSTR(MP_QSTR_UART_RX2), MP_ROM_PTR() }, // MicroMod UART_RX2 (not connected)
// MicroMod I2C pins
{ MP_ROM_QSTR(MP_QSTR_I2C_SDA), MP_ROM_PTR(&pin_PB11) }, // MicroMod I2C_SDA | CircuitPython SDA (PB11)
{ MP_ROM_QSTR(MP_QSTR_I2C_SCL), MP_ROM_PTR(&pin_PB10) }, // MicroMod I2C_SCL | CircuitPython SCL (PB10)
// CircuitPython default I2C pins
{ MP_ROM_QSTR(MP_QSTR_SDA), MP_ROM_PTR(&pin_PB11) }, // CircuitPython SDA | MicroMod I2C_SDA (PB11)
{ MP_ROM_QSTR(MP_QSTR_SCL), MP_ROM_PTR(&pin_PB10) }, // CircuitPython SCL | MicroMod I2C_SCL (PB10)
// MicroMod I2C interrupt pin
{ MP_ROM_QSTR(MP_QSTR_I2C_INT), MP_ROM_PTR(&pin_PB01) }, // MicroMod I2C_INT (PB1)
// MicroMod I2C1 pins
{ MP_ROM_QSTR(MP_QSTR_I2C_SDA1), MP_ROM_PTR(&pin_PB07) }, // MicroMod I2C_SDA1 (PB7)
{ MP_ROM_QSTR(MP_QSTR_I2C_SCL1), MP_ROM_PTR(&pin_PB06) }, // MicroMod I2C_SCL1 (PB6)
// MicroMod SPI pins
{ MP_ROM_QSTR(MP_QSTR_SPI_CIPO), MP_ROM_PTR(&pin_PA06) }, // MicroMod SPI_CIPO | CircuitPython CIPO (PA6)
{ MP_ROM_QSTR(MP_QSTR_SPI_MISO), MP_ROM_PTR(&pin_PA06) }, // MicroMod SPI_MISO | CircuitPython MISO (PA6)
{ MP_ROM_QSTR(MP_QSTR_SPI_COPI), MP_ROM_PTR(&pin_PA07) }, // MicroMod SPI_COPI | CircuitPython COPI | LED_DAT (PA7)
{ MP_ROM_QSTR(MP_QSTR_SPI_MOSI), MP_ROM_PTR(&pin_PA07) }, // MicroMod SPI_MOSI | CircuitPython MOSI (PA7)
{ MP_ROM_QSTR(MP_QSTR_SPI_SCK), MP_ROM_PTR(&pin_PA05) }, // MicroMod SPI_SCK | CircuitPython SCK | LED_CLK (PA5)
{ MP_ROM_QSTR(MP_QSTR_SPI_CS), MP_ROM_PTR(&pin_PA04) }, // MicroMod SPI_CS | CircuitPython CS (PC4)
// CircuitPython default SPI pins
{ MP_ROM_QSTR(MP_QSTR_CIPO), MP_ROM_PTR(&pin_PA06) }, // CircuitPython CIPO | MicroMod SPI_CIPO (PA6)
{ MP_ROM_QSTR(MP_QSTR_MISO), MP_ROM_PTR(&pin_PA06) }, // CircuitPython MISO | MicroMod SPI_MISO (PA6)
{ MP_ROM_QSTR(MP_QSTR_COPI), MP_ROM_PTR(&pin_PA07) }, // CircuitPython COPI | MicroMod SPI_COPI | LED_DAT (PA7)
{ MP_ROM_QSTR(MP_QSTR_MOSI), MP_ROM_PTR(&pin_PA07) }, // CircuitPython MOSI | MicroMod SPI_MOSI (PA7)
{ MP_ROM_QSTR(MP_QSTR_SCK), MP_ROM_PTR(&pin_PA05) }, // CircuitPython SCK | MicroMod SPI_SCK | LED_CLK (PA5)
{ MP_ROM_QSTR(MP_QSTR_CS), MP_ROM_PTR(&pin_PA04) }, // CircuitPython CS | MicroMod SPI_CS (PC4)
// MicroMod 2-wire serial LED pins
{ MP_ROM_QSTR(MP_QSTR_LED_DAT), MP_ROM_PTR(&pin_PA07) }, // MicroMod LED_DAT | SPI_COPI (PA7)
{ MP_ROM_QSTR(MP_QSTR_LED_CLK), MP_ROM_PTR(&pin_PA05) }, // MicroMod LED_CLK | SPI_SCK (PA5)
// MicroMod SDIO pins
// { MP_ROM_QSTR(MP_QSTR_SDIO_CLK), MP_ROM_PTR() }, // MicroMod SDIO_SCK | SPI_SCK1 (not connected)
// { MP_ROM_QSTR(MP_QSTR_SDIO_CMD), MP_ROM_PTR() }, // MicroMod SDIO_CMD | SPI_COPI1 (not connected)
// { MP_ROM_QSTR(MP_QSTR_SDIO_DATA0), MP_ROM_PTR() }, // MicroMod SDIO_DATA0 | SPI_CIPO1 (not connected)
// { MP_ROM_QSTR(MP_QSTR_SDIO_DATA1), MP_ROM_PTR() }, // MicroMod SDIO_DATA1 (not connected)
// { MP_ROM_QSTR(MP_QSTR_SDIO_DATA2), MP_ROM_PTR() }, // MicroMod SDIO_DATA2 (not connected)
// { MP_ROM_QSTR(MP_QSTR_SDIO_DATA3), MP_ROM_PTR() }, // MicroMod SDIO_DATA3 | SPI_CS1 (not connected)
// MicroMod SPI1 pins
// { MP_ROM_QSTR(MP_QSTR_SPI_CIPO1), MP_ROM_PTR() }, // MicroMod SPI_CIPO1 | SDIO_DATA0 (not connected)
// { MP_ROM_QSTR(MP_QSTR_SPI_MISO1), MP_ROM_PTR() }, // MicroMod SPI_MISO1 (not connected)
// { MP_ROM_QSTR(MP_QSTR_SPI_COPI1), MP_ROM_PTR() }, // MicroMod SPI_COPI1 | SDIO_CMD (not connected)
// { MP_ROM_QSTR(MP_QSTR_SPI_MOSI1), MP_ROM_PTR() }, // MicroMod SPI_MOSI1 (not connected)
// { MP_ROM_QSTR(MP_QSTR_SPI_SCK1), MP_ROM_PTR() }, // MicroMod SPI_SCK1 | SDIO_SCK (not connected)
// { MP_ROM_QSTR(MP_QSTR_SPI_CS1), MP_ROM_PTR() }, // MicroMod SPI_CS1 | SDIO_DATA3 (not connected)
// MicroMod audio pins
// { MP_ROM_QSTR(MP_QSTR_AUD_MCLK), MP_ROM_PTR() }, // MicroMod AUD_MCLK (not connected)
// { MP_ROM_QSTR(MP_QSTR_AUD_OUT), MP_ROM_PTR(&pin_PB04) }, // MicroMod AUD_OUT | I2S_OUT | PCM_OUT | CAM_MCLK (PB4)
// { MP_ROM_QSTR(MP_QSTR_AUD_IN), MP_ROM_PTR(&pin_PB05) }, // MicroMod AUD_IN | I2S_IN | PCM_IN | CAM_PCLK (PB5)
// { MP_ROM_QSTR(MP_QSTR_AUD_LRCLK), MP_ROM_PTR(&pin_PA04) }, // MicroMod AUD_LRCLK | I2S_WS | PCM_SYNC | PDM_DATA (PA4)
// { MP_ROM_QSTR(MP_QSTR_AUD_BCLK), MP_ROM_PTR(&pin_PB03) }, // MicroMod AUD_BCLK | I2S_SCK | PCM_CLK | PDM_CLK (PB3)
// MicroMod I2S pins
{ MP_ROM_QSTR(MP_QSTR_I2S_OUT), MP_ROM_PTR(&pin_PB04) }, // MicroMod I2S_OUT | AUD_OUT | PCM_OUT | CAM_MCLK (PB4)
{ MP_ROM_QSTR(MP_QSTR_I2S_IN), MP_ROM_PTR(&pin_PB05) }, // MicroMod I2S_IN | AUD_IN | PCM_IN | CAM_PCLK (PB5)
{ MP_ROM_QSTR(MP_QSTR_I2S_WS), MP_ROM_PTR(&pin_PA04) }, // MicroMod I2S_WS | AUD_LRCLK | PCM_SYNC | PDM_DATA (PA4)
{ MP_ROM_QSTR(MP_QSTR_I2S_SCK), MP_ROM_PTR(&pin_PB03) }, // MicroMod I2S_SCK | AUD_BCLK | PCM_CLK | PDM_CLK (PB3)
// MicroMod PCM pins
{ MP_ROM_QSTR(MP_QSTR_PCM_OUT), MP_ROM_PTR(&pin_PB04) }, // MicroMod PCM_OUT | AUD_OUT | I2S_OUT | CAM_MCLK (PB4)
{ MP_ROM_QSTR(MP_QSTR_PCM_IN), MP_ROM_PTR(&pin_PB05) }, // MicroMod PCM_IN | AUD_IN | I2S_IN | CAM_PCLK (PB5)
{ MP_ROM_QSTR(MP_QSTR_PCM_SYNC), MP_ROM_PTR(&pin_PA04) }, // MicroMod PCM_SYNC | AUD_LRCLK | I2S_WS | PDM_DATA (PA4)
{ MP_ROM_QSTR(MP_QSTR_PCM_CLK), MP_ROM_PTR(&pin_PB03) }, // MicroMod PCM_CLK | AUD_BCLK | I2S_SCK | PDM_CLK (PB3)
// MicroMod PDM pins
{ MP_ROM_QSTR(MP_QSTR_PDM_DATA), MP_ROM_PTR(&pin_PA04) }, // MicroMod PDM_DATA | AUD_LRCLK | I2S_WS | PCM_SYNC (PA4)
{ MP_ROM_QSTR(MP_QSTR_PDM_CLK), MP_ROM_PTR(&pin_PB03) }, // MicroMod PDM_CLK | AUD_BCLK | I2S_SCK | PCM_CLK (PB3)
// MicroMod SWD pins
{ MP_ROM_QSTR(MP_QSTR_SWDIO), MP_ROM_PTR(&pin_PA13) }, // MicroMod SWDIO (PA13)
{ MP_ROM_QSTR(MP_QSTR_SWCLK), MP_ROM_PTR(&pin_PA14) }, // MicroMod SWDCK (PA14)
// { MP_ROM_QSTR(MP_QSTR_SWO), MP_ROM_PTR() }, // MicroMod SWO | G11 (not connected)
// MicroMod ADC pins
{ MP_ROM_QSTR(MP_QSTR_A0), MP_ROM_PTR(&pin_PC05) }, // MicroMod A0 (PC5)
{ MP_ROM_QSTR(MP_QSTR_A1), MP_ROM_PTR(&pin_PB00) }, // MicroMod A1 (PB0)
// MicroMod PWM pins
{ MP_ROM_QSTR(MP_QSTR_PWM0), MP_ROM_PTR(&pin_PC06) }, // MicroMod PWM0 (PC6)
{ MP_ROM_QSTR(MP_QSTR_PWM1), MP_ROM_PTR(&pin_PC07) }, // MicroMod PWM1 (PC7)
// MicroMod digital pins
{ MP_ROM_QSTR(MP_QSTR_D0), MP_ROM_PTR(&pin_PC00) }, // MicroMod D0 (PC0)
{ MP_ROM_QSTR(MP_QSTR_D1), MP_ROM_PTR(&pin_PC01) }, // MicroMod D1 | CAM_TRIG (PC1)
// MicroMod general purpose pins
{ MP_ROM_QSTR(MP_QSTR_G0), MP_ROM_PTR(&pin_PD02) }, // MicroMod G0 | BUS0 (PD2)
{ MP_ROM_QSTR(MP_QSTR_G1), MP_ROM_PTR(&pin_PA08) }, // MicroMod G1 | BUS1 (PA8)
{ MP_ROM_QSTR(MP_QSTR_G2), MP_ROM_PTR(&pin_PA00) }, // MicroMod G2 | BUS2 (PA0)
{ MP_ROM_QSTR(MP_QSTR_G3), MP_ROM_PTR(&pin_PC08) }, // MicroMod G3 | BUS3 (PC8)
{ MP_ROM_QSTR(MP_QSTR_G4), MP_ROM_PTR(&pin_PC09) }, // MicroMod G4 | BUS4 (PC9)
{ MP_ROM_QSTR(MP_QSTR_G5), MP_ROM_PTR(&pin_PC13) }, // MicroMod G5 | BUS5 (PC13)
{ MP_ROM_QSTR(MP_QSTR_G6), MP_ROM_PTR(&pin_PC02) }, // MicroMod G6 | BUS6 (PC2)
// { MP_ROM_QSTR(MP_QSTR_G7), MP_ROM_PTR() }, // MicroMod G7 | BUS7 (not connected)
// { MP_ROM_QSTR(MP_QSTR_G8), MP_ROM_PTR() }, // MicroMod G8 (not connected)
// { MP_ROM_QSTR(MP_QSTR_G9), MP_ROM_PTR() }, // MicroMod G9 | ADC_D- | CAM_HSYNC (not connected)
{ MP_ROM_QSTR(MP_QSTR_G10), MP_ROM_PTR(&pin_PB13) }, // MicroMod G10 | ADC_D+ | CAM_VSYNC (PB13)
{ MP_ROM_QSTR(MP_QSTR_G11), MP_ROM_PTR(&pin_PB12) }, // MicroMod G11 | SWO (PB12)
// MicroMod 8-bit bus pins
{ MP_ROM_QSTR(MP_QSTR_BUS0), MP_ROM_PTR(&pin_PD02) }, // MicroMod BUS0 | G0 (PD2)
{ MP_ROM_QSTR(MP_QSTR_BUS1), MP_ROM_PTR(&pin_PA08) }, // MicroMod BUS1 | G1 (PA8)
{ MP_ROM_QSTR(MP_QSTR_BUS2), MP_ROM_PTR(&pin_PA00) }, // MicroMod BUS2 | G2 (PA0)
{ MP_ROM_QSTR(MP_QSTR_BUS3), MP_ROM_PTR(&pin_PC08) }, // MicroMod BUS3 | G3 (PC8)
{ MP_ROM_QSTR(MP_QSTR_BUS4), MP_ROM_PTR(&pin_PC09) }, // MicroMod BUS4 | G4 (PC9)
{ MP_ROM_QSTR(MP_QSTR_BUS5), MP_ROM_PTR(&pin_PC13) }, // MicroMod BUS5 | G5 (PC13)
{ MP_ROM_QSTR(MP_QSTR_BUS6), MP_ROM_PTR(&pin_PC02) }, // MicroMod BUS6 | G6 (PC2)
// { MP_ROM_QSTR(MP_QSTR_BUS7), MP_ROM_PTR() }, // MicroMod BUS7 | G7 (not connected)
// MicroMod differential ADC input pins
// { MP_ROM_QSTR(MP_QSTR_ADC_DM), MP_ROM_PTR() }, // MicroMod ADC_D- | G9 | CAM_HSYNC (not connected)
// { MP_ROM_QSTR(MP_QSTR_ADC_DP), MP_ROM_PTR(&pin_PB13) }, // MicroMod ADC_D+ | G10 | CAM_VSYNC (PB13)
// MicroMod camera pins
// { MP_ROM_QSTR(MP_QSTR_CAM_MCLK), MP_ROM_PTR(&pin_PB04) }, // MicroMod CAM_MCLK | AUD_OUT | I2S_OUT | PCM_OUT (PB4)
// { MP_ROM_QSTR(MP_QSTR_CAM_PCLK), MP_ROM_PTR(&pin_PB05) }, // MicroMod CAM_PCLK | AUD_IN | I2S_IN | PCM_IN (PB5)
// { MP_ROM_QSTR(MP_QSTR_CAM_TRIG), MP_ROM_PTR(&pin_PC01) }, // MicroMod CAM_TRIG | D1 (PC1)
// { MP_ROM_QSTR(MP_QSTR_CAM_HSYNC), MP_ROM_PTR() }, // MicroMod CAM_HSYNC | ADC_D- | G9 (not connected)
// { MP_ROM_QSTR(MP_QSTR_CAM_VSYNC), MP_ROM_PTR(&pin_PB13) }, // MicroMod CAM_VSYNC | ADC_D+ | G10 (PB13)
// Module-specific aliases (not part of the MicroMod spec)
{ MP_ROM_QSTR(MP_QSTR_HOST_VBUS), MP_ROM_PTR(&pin_PB13) }, // HOST_VBUS | G10 | ADC_D+ | CAM_VSYNC (PB13)
{ MP_ROM_QSTR(MP_QSTR_HOST_ID), MP_ROM_PTR(&pin_PB12) }, // HOST_ID | G11 | SWO (PB12)
// CircuitPython board objects
{ MP_ROM_QSTR(MP_QSTR_I2C), MP_ROM_PTR(&board_i2c_obj) }, // CircuitPython I2C
{ MP_ROM_QSTR(MP_QSTR_SPI), MP_ROM_PTR(&board_spi_obj) }, // CircuitPython SPI
{ MP_ROM_QSTR(MP_QSTR_UART), MP_ROM_PTR(&board_uart_obj) }, // CircuitPython UART
};
MP_DEFINE_CONST_DICT(board_module_globals, board_module_globals_table);

View File

@ -131,10 +131,7 @@ STATIC void mp_help_print_modules(void) {
#if MICROPY_ENABLE_EXTERNAL_IMPORT
// let the user know there may be other modules available from the filesystem
const compressed_string_t *compressed = translate("Plus any modules on the filesystem\n");
char decompressed[decompress_length(compressed)];
decompress(compressed, decompressed);
mp_print_str(MP_PYTHON_PRINTER, decompressed);
mp_printf(MP_PYTHON_PRINTER, "%S", translate("Plus any modules on the filesystem\n"));
#endif
}
#endif
@ -150,18 +147,10 @@ STATIC void mp_help_print_obj(const mp_obj_t obj) {
const mp_obj_type_t *type = mp_obj_get_type(obj);
// try to print something sensible about the given object
const compressed_string_t *compressed = translate("object ");
char decompressed_object[decompress_length(compressed)];
decompress(compressed, decompressed_object);
mp_print_str(MP_PYTHON_PRINTER, decompressed_object);
mp_cprintf(MP_PYTHON_PRINTER, translate("object "));
mp_obj_print(obj, PRINT_STR);
compressed = translate(" is of type %q\n");
char decompressed_typestring[decompress_length(compressed)];
decompress(compressed, decompressed_typestring);
mp_printf(MP_PYTHON_PRINTER, decompressed_typestring, type->name);
mp_cprintf(MP_PYTHON_PRINTER, translate(" is of type %q\n"), type->name);
mp_map_t *map = NULL;
if (type == &mp_type_module) {
@ -186,11 +175,9 @@ STATIC void mp_help_print_obj(const mp_obj_t obj) {
STATIC mp_obj_t mp_builtin_help(size_t n_args, const mp_obj_t *args) {
if (n_args == 0) {
// print a general help message. Translate only works on single strings on one line.
const compressed_string_t *compressed =
translate("Welcome to Adafruit CircuitPython %s!\n\nPlease visit learn.adafruit.com/category/circuitpython for project guides.\n\nTo list built-in modules please do `help(\"modules\")`.\n");
char decompressed[decompress_length(compressed)];
decompress(compressed, decompressed);
mp_printf(MP_PYTHON_PRINTER, decompressed, MICROPY_GIT_TAG);
mp_cprintf(MP_PYTHON_PRINTER,
translate("Welcome to Adafruit CircuitPython %s!\n\nPlease visit learn.adafruit.com/category/circuitpython for project guides.\n\nTo list built-in modules please do `help(\"modules\")`.\n"),
MICROPY_GIT_TAG);
} else {
// try to print something sensible about the given object
mp_help_print_obj(args[0]);

View File

@ -188,6 +188,9 @@ endif
ifeq ($(CIRCUITPY_GAMEPADSHIFT),1)
SRC_PATTERNS += gamepadshift/%
endif
ifeq ($(CIRCUITPY_GETPASS),1)
SRC_PATTERNS += getpass/%
endif
ifeq ($(CIRCUITPY_GNSS),1)
SRC_PATTERNS += gnss/%
endif
@ -519,6 +522,7 @@ SRC_SHARED_MODULE_ALL = \
fontio/__init__.c \
framebufferio/FramebufferDisplay.c \
framebufferio/__init__.c \
getpass/__init__.c \
ipaddress/IPv4Address.c \
ipaddress/__init__.c \
keypad/__init__.c \

View File

@ -483,6 +483,13 @@ extern const struct _mp_obj_module_t gamepadshift_module;
#define GAMEPAD_ROOT_POINTERS
#endif
#if CIRCUITPY_GETPASS
extern const struct _mp_obj_module_t getpass_module;
#define GETPASS_MODULE { MP_OBJ_NEW_QSTR(MP_QSTR_getpass), (mp_obj_t)&getpass_module },
#else
#define GETPASS_MODULE
#endif
#if CIRCUITPY_GNSS
extern const struct _mp_obj_module_t gnss_module;
#define GNSS_MODULE { MP_OBJ_NEW_QSTR(MP_QSTR_gnss), (mp_obj_t)&gnss_module },
@ -896,6 +903,7 @@ extern const struct _mp_obj_module_t msgpack_module;
FRAMEBUFFERIO_MODULE \
FREQUENCYIO_MODULE \
GAMEPADSHIFT_MODULE \
GETPASS_MODULE \
GNSS_MODULE \
I2CPERIPHERAL_MODULE \
IPADDRESS_MODULE \

View File

@ -121,9 +121,15 @@ CFLAGS += -DCIRCUITPY_BUILTINS_POW3=$(CIRCUITPY_BUILTINS_POW3)
CIRCUITPY_BUSIO ?= 1
CFLAGS += -DCIRCUITPY_BUSIO=$(CIRCUITPY_BUSIO)
# These two flags pretend to implement their class but raise a ValueError due to
# unsupported pins. This should be used sparingly on boards that don't break out
# generic IO but need parts of busio.
CIRCUITPY_BUSIO_SPI ?= 1
CFLAGS += -DCIRCUITPY_BUSIO_SPI=$(CIRCUITPY_BUSIO_SPI)
CIRCUITPY_BUSIO_UART ?= 1
CFLAGS += -DCIRCUITPY_BUSIO_UART=$(CIRCUITPY_BUSIO_UART)
CIRCUITPY_CAMERA ?= 0
CFLAGS += -DCIRCUITPY_CAMERA=$(CIRCUITPY_CAMERA)
@ -184,6 +190,9 @@ CFLAGS += -DCIRCUITPY_FREQUENCYIO=$(CIRCUITPY_FREQUENCYIO)
CIRCUITPY_GAMEPADSHIFT ?= 0
CFLAGS += -DCIRCUITPY_GAMEPADSHIFT=$(CIRCUITPY_GAMEPADSHIFT)
CIRCUITPY_GETPASS ?= $(CIRCUITPY_FULL_BUILD)
CFLAGS += -DCIRCUITPY_GETPASS=$(CIRCUITPY_GETPASS)
CIRCUITPY_GNSS ?= 0
CFLAGS += -DCIRCUITPY_GNSS=$(CIRCUITPY_GNSS)
@ -327,7 +336,7 @@ CFLAGS += -DCIRCUITPY_TOUCHIO_USE_NATIVE=$(CIRCUITPY_TOUCHIO_USE_NATIVE)
CIRCUITPY_TOUCHIO ?= 1
CFLAGS += -DCIRCUITPY_TOUCHIO=$(CIRCUITPY_TOUCHIO)
CIRCUITPY_TRACEBACK ?= 1
CIRCUITPY_TRACEBACK ?= $(CIRCUITPY_FULL_BUILD)
CFLAGS += -DCIRCUITPY_TRACEBACK=$(CIRCUITPY_TRACEBACK)
# For debugging.

View File

@ -376,6 +376,13 @@ int mp_print_float(const mp_print_t *print, mp_float_t f, char fmt, int flags, c
}
#endif
static int print_str_common(const mp_print_t *print, const char *str, int prec, size_t len, int flags, int fill, int width) {
if (prec >= 0 && (size_t)prec < len) {
len = prec;
}
return mp_print_strn(print, str, len, flags, fill, width);
}
int mp_printf(const mp_print_t *print, const char *fmt, ...) {
va_list ap;
va_start(ap, fmt);
@ -484,19 +491,24 @@ int mp_vprintf(const mp_print_t *print, const char *fmt, va_list args) {
qstr qst = va_arg(args, qstr);
size_t len;
const char *str = (const char *)qstr_data(qst, &len);
if (prec >= 0 && (size_t)prec < len) {
len = prec;
}
chrs += mp_print_strn(print, str, len, flags, fill, width);
chrs += print_str_common(print, str, prec, len, flags, fill, width);
break;
}
case 'S': {
compressed_string_t *arg = va_arg(args, compressed_string_t *);
size_t len_with_nul = decompress_length(arg);
size_t len = len_with_nul - 1;
char str[len_with_nul];
decompress(arg, str);
chrs += print_str_common(print, str, prec, len, flags, fill, width);
break;
}
case 's': {
const char *str = va_arg(args, const char *);
#ifndef NDEBUG
// With debugging enabled, catch printing of null string pointers
if (prec != 0 && str == NULL) {
chrs += mp_print_strn(print, "(null)", 6, flags, fill, width);
break;
if (str == NULL) {
str = "(null)";
}
#endif
size_t len = strlen(str);
@ -574,3 +586,19 @@ int mp_vprintf(const mp_print_t *print, const char *fmt, va_list args) {
}
return chrs;
}
int mp_cprintf(const mp_print_t *print, const compressed_string_t *compressed_fmt, ...) {
va_list ap;
va_start(ap, compressed_fmt);
int ret = mp_vcprintf(print, compressed_fmt, ap);
va_end(ap);
return ret;
}
int mp_vcprintf(const mp_print_t *print, const compressed_string_t *compressed_fmt, va_list args) {
char fmt[decompress_length(compressed_fmt)];
// TODO: Optimise this to format-while-decompressing (and not require the temp stack space).
decompress(compressed_fmt, fmt);
return mp_vprintf(print, fmt, args);
}

View File

@ -71,4 +71,10 @@ int mp_printf(const mp_print_t *print, const char *fmt, ...);
int mp_vprintf(const mp_print_t *print, const char *fmt, va_list args);
#endif
struct compressed_string;
int mp_cprintf(const mp_print_t *print, const struct compressed_string *compressed_fmt, ...);
#ifdef va_start
int mp_vcprintf(const mp_print_t *print, const struct compressed_string *compressed_fmt, va_list args);
#endif
#endif // MICROPY_INCLUDED_PY_MPPRINT_H

View File

@ -143,41 +143,55 @@ void mp_obj_print(mp_obj_t o_in, mp_print_kind_t kind) {
}
// helper function to print an exception with traceback
void mp_obj_print_exception(const mp_print_t *print, mp_obj_t exc) {
void mp_obj_print_exception_with_limit(const mp_print_t *print, mp_obj_t exc, mp_int_t limit) {
if (mp_obj_is_exception_instance(exc) && stack_ok()) {
size_t n, *values;
mp_obj_exception_get_traceback(exc, &n, &values);
if (n > 0) {
assert(n % 3 == 0);
// Decompress the format strings
const compressed_string_t *traceback = MP_ERROR_TEXT("Traceback (most recent call last):\n");
char decompressed[decompress_length(traceback)];
decompress(traceback, decompressed);
#if MICROPY_ENABLE_SOURCE_LINE
const compressed_string_t *frame = MP_ERROR_TEXT(" File \"%q\", line %d");
#else
const compressed_string_t *frame = MP_ERROR_TEXT(" File \"%q\"");
#endif
char decompressed_frame[decompress_length(frame)];
decompress(frame, decompressed_frame);
const compressed_string_t *block_fmt = MP_ERROR_TEXT(", in %q\n");
char decompressed_block[decompress_length(block_fmt)];
decompress(block_fmt, decompressed_block);
// Set traceback formatting
// Default: Print full traceback
limit = limit * 3;
mp_int_t i = n - 3, j;
if (limit > 0) {
// Print upto limit traceback
// entries from caller's frame
if ((unsigned)limit > n) {
limit = n;
}
limit = n - limit;
} else if (limit < 0) {
// Print upto limit traceback
// entries from last
if ((unsigned)-limit > n) {
limit = -n;
}
i = 0, limit = limit + 3;
}
// Print the traceback
mp_print_str(print, decompressed);
for (int i = n - 3; i >= 0; i -= 3) {
mp_cprintf(print, MP_ERROR_TEXT("Traceback (most recent call last):\n"));
for (; i >= limit; i -= 3) {
j = (i < 0) ? -i : i;
#if MICROPY_ENABLE_SOURCE_LINE
mp_printf(print, decompressed_frame, values[i], (int)values[i + 1]);
mp_cprintf(print, frame, values[j], (int)values[j + 1]);
#else
mp_printf(print, decompressed_frame, values[i]);
mp_cprintf(print, frame, values[j]);
#endif
// the block name can be NULL if it's unknown
qstr block = values[i + 2];
// The block name can be NULL if it's unknown
qstr block = values[j + 2];
if (block == MP_QSTRnull) {
mp_print_str(print, "\n");
} else {
mp_printf(print, decompressed_block, block);
mp_cprintf(print, block_fmt, block);
}
}
}
@ -186,6 +200,10 @@ void mp_obj_print_exception(const mp_print_t *print, mp_obj_t exc) {
mp_print_str(print, "\n");
}
void mp_obj_print_exception(const mp_print_t *print, mp_obj_t exc) {
mp_obj_print_exception_with_limit(print, exc, 0);
}
bool PLACE_IN_ITCM(mp_obj_is_true)(mp_obj_t arg) {
if (arg == mp_const_false) {
return 0;

View File

@ -888,6 +888,7 @@ mp_obj_t mp_obj_cast_to_native_base(mp_obj_t self_in, mp_const_obj_t native_type
void mp_obj_print_helper(const mp_print_t *print, mp_obj_t o_in, mp_print_kind_t kind);
void mp_obj_print(mp_obj_t o, mp_print_kind_t kind);
void mp_obj_print_exception(const mp_print_t *print, mp_obj_t exc);
void mp_obj_print_exception_with_limit(const mp_print_t *print, mp_obj_t exc, mp_int_t limit);
bool mp_obj_is_true(mp_obj_t arg);
bool mp_obj_is_callable(mp_obj_t o_in);

View File

@ -465,12 +465,9 @@ mp_obj_t mp_obj_new_exception_msg_vlist(const mp_obj_type_t *exc_type, const com
o_str->data = NULL;
} else {
// We have some memory to format the string.
// TODO: Optimise this to format-while-decompressing (and not require the temp stack space).
struct _exc_printer_t exc_pr = {!used_emg_buf, o_str_alloc, 0, o_str_buf};
mp_print_t print = {&exc_pr, exc_add_strn};
char fmt_decompressed[decompress_length(fmt)];
decompress(fmt, fmt_decompressed);
mp_vprintf(&print, fmt_decompressed, ap);
mp_vcprintf(&print, fmt, ap);
exc_pr.buf[exc_pr.len] = '\0';
o_str->len = exc_pr.len;
o_str->data = exc_pr.buf;

View File

@ -7,6 +7,7 @@ jinja2
typer
requests
requests-cache
sh
click
setuptools

View File

@ -104,7 +104,7 @@ STATIC mp_obj_t busio_spi_make_new(const mp_obj_type_t *type, size_t n_args, con
common_hal_busio_spi_construct(self, clock, mosi, miso);
return MP_OBJ_FROM_PTR(self);
#else
mp_raise_NotImplementedError(NULL);
mp_raise_ValueError(translate("Invalid pins"));
#endif // CIRCUITPY_BUSIO_SPI
}

View File

@ -72,13 +72,16 @@ typedef struct {
extern const busio_uart_parity_obj_t busio_uart_parity_even_obj;
extern const busio_uart_parity_obj_t busio_uart_parity_odd_obj;
#if CIRCUITPY_BUSIO_UART
STATIC void validate_timeout(mp_float_t timeout) {
if (timeout < (mp_float_t)0.0f || timeout > (mp_float_t)100.0f) {
mp_raise_ValueError(translate("timeout must be 0.0-100.0 seconds"));
}
}
#endif // CIRCUITPY_BUSIO_UART
STATIC mp_obj_t busio_uart_make_new(const mp_obj_type_t *type, size_t n_args, const mp_obj_t *pos_args, mp_map_t *kw_args) {
#if CIRCUITPY_BUSIO_UART
// Always initially allocate the UART object within the long-lived heap.
// This is needed to avoid crashes with certain UART implementations which
// cannot accomodate being moved after creation. (See
@ -141,8 +144,12 @@ STATIC mp_obj_t busio_uart_make_new(const mp_obj_type_t *type, size_t n_args, co
args[ARG_baudrate].u_int, bits, parity, stop, timeout,
args[ARG_receiver_buffer_size].u_int, NULL, false);
return (mp_obj_t)self;
#else
mp_raise_ValueError(translate("Invalid pins"));
#endif // CIRCUITPY_BUSIO_UART
}
#if CIRCUITPY_BUSIO_UART
// Helper to ensure we have the native super class instead of a subclass.
busio_uart_obj_t *native_uart(mp_obj_t uart_obj) {
@ -358,6 +365,7 @@ STATIC mp_obj_t busio_uart_obj_reset_input_buffer(mp_obj_t self_in) {
return mp_const_none;
}
STATIC MP_DEFINE_CONST_FUN_OBJ_1(busio_uart_reset_input_buffer_obj, busio_uart_obj_reset_input_buffer);
#endif // CIRCUITPY_BUSIO_UART
//| class Parity:
//| """Enum-like class to define the parity used to verify correct data transfer."""
@ -400,6 +408,7 @@ const mp_obj_type_t busio_uart_parity_type = {
};
STATIC const mp_rom_map_elem_t busio_uart_locals_dict_table[] = {
#if CIRCUITPY_BUSIO_UART
{ MP_ROM_QSTR(MP_QSTR___del__), MP_ROM_PTR(&busio_uart_deinit_obj) },
{ MP_ROM_QSTR(MP_QSTR_deinit), MP_ROM_PTR(&busio_uart_deinit_obj) },
{ MP_ROM_QSTR(MP_QSTR___enter__), MP_ROM_PTR(&default___enter___obj) },
@ -417,12 +426,14 @@ STATIC const mp_rom_map_elem_t busio_uart_locals_dict_table[] = {
{ MP_ROM_QSTR(MP_QSTR_baudrate), MP_ROM_PTR(&busio_uart_baudrate_obj) },
{ MP_ROM_QSTR(MP_QSTR_in_waiting), MP_ROM_PTR(&busio_uart_in_waiting_obj) },
{ MP_ROM_QSTR(MP_QSTR_timeout), MP_ROM_PTR(&busio_uart_timeout_obj) },
#endif // CIRCUITPY_BUSIO_UART
// Nested Enum-like Classes.
{ MP_ROM_QSTR(MP_QSTR_Parity), MP_ROM_PTR(&busio_uart_parity_type) },
};
STATIC MP_DEFINE_CONST_DICT(busio_uart_locals_dict, busio_uart_locals_dict_table);
#if CIRCUITPY_BUSIO_UART
STATIC const mp_stream_p_t uart_stream_p = {
MP_PROTO_IMPLEMENT(MP_QSTR_protocol_stream)
.read = busio_uart_read,
@ -445,3 +456,11 @@ const mp_obj_type_t busio_uart_type = {
.protocol = &uart_stream_p,
),
};
#else
const mp_obj_type_t busio_uart_type = {
{ &mp_type_type },
.name = MP_QSTR_UART,
.make_new = busio_uart_make_new,
.locals_dict = (mp_obj_dict_t *)&busio_uart_locals_dict,
};
#endif // CIRCUITPY_BUSIO_UART

View File

@ -230,14 +230,14 @@ STATIC mp_obj_t displayio_display_obj_show(mp_obj_t self_in, mp_obj_t group_in)
}
MP_DEFINE_CONST_FUN_OBJ_2(displayio_display_show_obj, displayio_display_obj_show);
//| def refresh(self, *, target_frames_per_second: Optional[int] = None, minimum_frames_per_second: int = 1) -> bool:
//| def refresh(self, *, target_frames_per_second: Optional[int] = None, minimum_frames_per_second: int = 0) -> bool:
//| """When auto refresh is off, waits for the target frame rate and then refreshes the display,
//| returning True. If the call has taken too long since the last refresh call for the given
//| target frame rate, then the refresh returns False immediately without updating the screen to
//| hopefully help getting caught up.
//|
//| If the time since the last successful refresh is below the minimum frame rate, then an
//| exception will be raised. Set ``minimum_frames_per_second`` to 0 to disable.
//| exception will be raised. The default ``minimum_frames_per_second`` of 0 disables this behavior.
//|
//| When auto refresh is off, ``display.refresh()`` or ``display.refresh(target_frames_per_second=None)``
//| will update the display immediately.
@ -254,7 +254,7 @@ STATIC mp_obj_t displayio_display_obj_refresh(size_t n_args, const mp_obj_t *pos
enum { ARG_target_frames_per_second, ARG_minimum_frames_per_second };
static const mp_arg_t allowed_args[] = {
{ MP_QSTR_target_frames_per_second, MP_ARG_OBJ | MP_ARG_KW_ONLY, {.u_obj = mp_const_none} },
{ MP_QSTR_minimum_frames_per_second, MP_ARG_KW_ONLY | MP_ARG_INT, {.u_int = 1} },
{ MP_QSTR_minimum_frames_per_second, MP_ARG_KW_ONLY | MP_ARG_INT, {.u_int = 0} },
};
mp_arg_val_t args[MP_ARRAY_SIZE(allowed_args)];

View File

@ -54,7 +54,9 @@
//| width: int, height: int, ram_width: int, ram_height: int,
//| colstart: int = 0, rowstart: int = 0, rotation: int = 0,
//| set_column_window_command: Optional[int] = None,
//| set_row_window_command: Optional[int] = None, single_byte_bounds: bool = False,
//| set_row_window_command: Optional[int] = None,
//| set_current_column_command: Optional[int] = None,
//| set_current_row_command: Optional[int] = None,
//| write_black_ram_command: int, black_bits_inverted: bool = False,
//| write_color_ram_command: Optional[int] = None,
//| color_bits_inverted: bool = False, highlight_color: int = 0x000000,

View File

@ -183,7 +183,7 @@ const mp_obj_property_t displayio_group_y_obj = {
MP_ROM_NONE},
};
//| def append(self, layer: Union[vectorio.VectorShape, Group, TileGrid]) -> None:
//| def append(self, layer: Union[vectorio.Circle, vectorio.Rectangle, vectorio.Polygon, Group, TileGrid]) -> None:
//| """Append a layer to the group. It will be drawn above other layers."""
//| ...
//|
@ -194,7 +194,7 @@ STATIC mp_obj_t displayio_group_obj_append(mp_obj_t self_in, mp_obj_t layer) {
}
MP_DEFINE_CONST_FUN_OBJ_2(displayio_group_append_obj, displayio_group_obj_append);
//| def insert(self, index: int, layer: Union[vectorio.VectorShape, Group, TileGrid]) -> None:
//| def insert(self, index: int, layer: Union[vectorio.Circle, vectorio.Rectangle, vectorio.Polygon, Group, TileGrid]) -> None:
//| """Insert a layer into the group."""
//| ...
//|
@ -210,7 +210,7 @@ STATIC mp_obj_t displayio_group_obj_insert(mp_obj_t self_in, mp_obj_t index_obj,
MP_DEFINE_CONST_FUN_OBJ_3(displayio_group_insert_obj, displayio_group_obj_insert);
//| def index(self, layer: Union[vectorio.VectorShape, Group, TileGrid]) -> int:
//| def index(self, layer: Union[vectorio.Circle, vectorio.Rectangle, vectorio.Polygon, Group, TileGrid]) -> int:
//| """Returns the index of the first copy of layer. Raises ValueError if not found."""
//| ...
//|
@ -224,7 +224,7 @@ STATIC mp_obj_t displayio_group_obj_index(mp_obj_t self_in, mp_obj_t layer) {
}
MP_DEFINE_CONST_FUN_OBJ_2(displayio_group_index_obj, displayio_group_obj_index);
//| def pop(self, i: int = -1) -> Union[vectorio.VectorShape, Group, TileGrid]:
//| def pop(self, i: int = -1) -> Union[vectorio.Circle, vectorio.Rectangle, vectorio.Polygon, Group, TileGrid]:
//| """Remove the ith item and return it."""
//| ...
//|
@ -247,7 +247,7 @@ STATIC mp_obj_t displayio_group_obj_pop(size_t n_args, const mp_obj_t *pos_args,
MP_DEFINE_CONST_FUN_OBJ_KW(displayio_group_pop_obj, 1, displayio_group_obj_pop);
//| def remove(self, layer: Union[vectorio.VectorShape, Group, TileGrid]) -> None:
//| def remove(self, layer: Union[vectorio.Circle, vectorio.Rectangle, vectorio.Polygon, Group, TileGrid]) -> None:
//| """Remove the first copy of layer. Raises ValueError if it is not present."""
//| ...
//|
@ -280,7 +280,7 @@ STATIC mp_obj_t group_unary_op(mp_unary_op_t op, mp_obj_t self_in) {
}
}
//| def __getitem__(self, index: int) -> Union[vectorio.VectorShape, Group, TileGrid]:
//| def __getitem__(self, index: int) -> Union[vectorio.Circle, vectorio.Rectangle, vectorio.Polygon, Group, TileGrid]:
//| """Returns the value at the given index.
//|
//| This allows you to::
@ -288,7 +288,7 @@ STATIC mp_obj_t group_unary_op(mp_unary_op_t op, mp_obj_t self_in) {
//| print(group[0])"""
//| ...
//|
//| def __setitem__(self, index: int, value: Union[vectorio.VectorShape, Group, TileGrid]) -> None:
//| def __setitem__(self, index: int, value: Union[vectorio.Circle, vectorio.Rectangle, vectorio.Polygon, Group, TileGrid]) -> None:
//| """Sets the value at the given index.
//|
//| This allows you to::

View File

@ -0,0 +1,86 @@
/*
* This file is part of the Micro Python project, http://micropython.org/
*
* The MIT License (MIT)
*
* Copyright (c) 2021 microDev
*
* Permission is hereby granted, free of charge, to any person obtaining a copy
* of this software and associated documentation files (the "Software"), to deal
* in the Software without restriction, including without limitation the rights
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
* copies of the Software, and to permit persons to whom the Software is
* furnished to do so, subject to the following conditions:
*
* The above copyright notice and this permission notice shall be included in
* all copies or substantial portions of the Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
* THE SOFTWARE.
*/
#include "py/stream.h"
#include "shared-module/getpass/__init__.h"
//| """Getpass Module
//|
//| This module provides a way to get input from user without echoing it.
//|
//| """
//| ...
//|
//| def getpass(prompt: Optional[str] = 'Password: ', stream: Optional[io.FileIO] = None) -> str:
//|
//| """Prompt the user without echoing.
//|
//| :param str prompt: The user is prompted using the string ``prompt``, which defaults to ``'Password: '``.
//| :param io.FileIO stream: The ``prompt`` is written to the file-like object ``stream`` if provided.
//|
//| """
//| ...
//|
STATIC mp_obj_t getpass_getpass(size_t n_args, const mp_obj_t *pos_args, mp_map_t *kw_args) {
enum { ARG_prompt, ARG_stream };
static const mp_arg_t allowed_args[] = {
{ MP_QSTR_prompt, MP_ARG_OBJ, {.u_obj = mp_const_none} },
{ MP_QSTR_stream, MP_ARG_OBJ, {.u_obj = mp_const_none} },
};
mp_arg_val_t args[MP_ARRAY_SIZE(allowed_args)];
mp_arg_parse_all(n_args, pos_args, kw_args, MP_ARRAY_SIZE(allowed_args), allowed_args, args);
const char *prompt = (args[ARG_prompt].u_obj == mp_const_none) ? "Password: " : mp_obj_str_get_str(args[ARG_prompt].u_obj);
mp_print_t print = {.data = NULL};
if (args[ARG_stream].u_obj != mp_const_none) {
#if MICROPY_PY_IO && MICROPY_PY_SYS_STDFILES
mp_get_stream_raise(args[ARG_stream].u_obj, MP_STREAM_OP_WRITE);
print.data = MP_OBJ_TO_PTR(args[ARG_stream].u_obj);
print.print_strn = mp_stream_write_adaptor;
#else
mp_raise_NotImplementedError(translate("stream operation not supported"));
#endif
}
return shared_module_getpass_getpass(prompt, ((print.data) ? &print : NULL));
}
STATIC MP_DEFINE_CONST_FUN_OBJ_KW(getpass_getpass_obj, 0, getpass_getpass);
STATIC const mp_rom_map_elem_t getpass_module_globals_table[] = {
// module name
{ MP_ROM_QSTR(MP_QSTR___name__), MP_ROM_QSTR(MP_QSTR_getpass) },
// module functions
{ MP_ROM_QSTR(MP_QSTR_getpass), MP_ROM_PTR(&getpass_getpass_obj) },
};
STATIC MP_DEFINE_CONST_DICT(getpass_module_globals, getpass_module_globals_table);
const mp_obj_module_t getpass_module = {
.base = { &mp_type_module },
.globals = (mp_obj_dict_t *)&getpass_module_globals,
};

View File

@ -38,6 +38,75 @@
//| ...
//|
STATIC void traceback_exception_common(mp_print_t *print, mp_obj_t value, mp_obj_t tb_obj, mp_obj_t limit_obj) {
if (!mp_obj_is_exception_instance(value)) {
mp_raise_TypeError(translate("invalid exception"));
}
mp_obj_exception_t exc = *(mp_obj_exception_t *)MP_OBJ_TO_PTR(value);
mp_int_t limit = 0;
bool print_tb = true;
if (limit_obj != mp_const_none) {
limit = mp_obj_get_int(limit_obj);
print_tb = (limit != 0);
}
if (tb_obj != mp_const_none && print_tb) {
if (!mp_obj_is_type(tb_obj, &mp_type_traceback)) {
mp_raise_TypeError(translate("invalid traceback"));
}
exc.traceback = MP_OBJ_TO_PTR(tb_obj);
} else {
exc.traceback = (mp_obj_traceback_t *)&mp_const_empty_traceback_obj;
}
shared_module_traceback_print_exception(&exc, print, limit);
}
//| def format_exception(etype: Type[BaseException], value: BaseException, tb: TracebackType,
//| limit: Optional[int] = None, chain: Optional[bool] = True) -> None:
//| """Format a stack trace and the exception information.
//|
//| The arguments have the same meaning as the corresponding arguments
//| to print_exception(). The return value is a list of strings, each
//| ending in a newline and some containing internal newlines. When
//| these lines are concatenated and printed, exactly the same text is
//| printed as does print_exception().
//|
//| .. note: Setting `chain` will have no effect as chained exceptions are not yet implemented.
//|
//| :param Type[BaseException] etype: This is ignored and inferred from the type of ``value``.
//| :param BaseException value: The exception. Must be an instance of `BaseException`.
//| :param TracebackType tb: The traceback object. If `None`, the traceback will not be printed.
//| :param int limit: Print up to limit stack trace entries (starting from the callers frame) if limit is positive.
//| Otherwise, print the last ``abs(limit)`` entries. If limit is omitted or None, all entries are printed.
//| :param bool chain: If `True` then chained exceptions will be printed (note: not yet implemented).
//|
//| """
//| ...
//|
STATIC mp_obj_t traceback_format_exception(size_t n_args, const mp_obj_t *pos_args, mp_map_t *kw_args) {
enum { ARG_etype, ARG_value, ARG_tb, ARG_limit, ARG_chain };
static const mp_arg_t allowed_args[] = {
{ MP_QSTR_etype, MP_ARG_OBJ | MP_ARG_REQUIRED },
{ MP_QSTR_value, MP_ARG_OBJ | MP_ARG_REQUIRED },
{ MP_QSTR_tb, MP_ARG_OBJ | MP_ARG_REQUIRED },
{ MP_QSTR_limit, MP_ARG_OBJ, {.u_obj = mp_const_none} },
{ MP_QSTR_chain, MP_ARG_BOOL, {.u_bool = true} },
};
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_print_t print;
vstr_t vstr;
vstr_init_print(&vstr, 0, &print);
traceback_exception_common(&print, args[ARG_value].u_obj, args[ARG_tb].u_obj, args[ARG_limit].u_obj);
return mp_obj_new_str_from_vstr(&mp_type_str, &vstr);
}
STATIC MP_DEFINE_CONST_FUN_OBJ_KW(traceback_format_exception_obj, 3, traceback_format_exception);
//| def print_exception(etype: Type[BaseException], value: BaseException, tb: TracebackType,
//| limit: Optional[int] = None, file: Optional[io.FileIO] = None, chain: Optional[bool] = True) -> None:
//|
@ -57,6 +126,7 @@
//| """
//| ...
//|
STATIC mp_obj_t traceback_print_exception(size_t n_args, const mp_obj_t *pos_args, mp_map_t *kw_args) {
enum { ARG_etype, ARG_value, ARG_tb, ARG_limit, ARG_file, ARG_chain };
static const mp_arg_t allowed_args[] = {
@ -71,11 +141,6 @@ STATIC mp_obj_t traceback_print_exception(size_t n_args, const mp_obj_t *pos_arg
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);
if (!mp_obj_is_exception_instance(args[ARG_value].u_obj)) {
mp_raise_TypeError(translate("invalid exception"));
}
mp_obj_exception_t exc = *(mp_obj_exception_t *)MP_OBJ_TO_PTR(args[ARG_value].u_obj);
mp_print_t print = mp_plat_print;
if (args[ARG_file].u_obj != mp_const_none) {
#if MICROPY_PY_IO && MICROPY_PY_SYS_STDFILES
@ -87,25 +152,7 @@ STATIC mp_obj_t traceback_print_exception(size_t n_args, const mp_obj_t *pos_arg
#endif
}
mp_int_t limit = 0;
bool print_tb = true;
if (args[ARG_limit].u_obj != mp_const_none) {
if (!mp_obj_get_int_maybe(args[ARG_limit].u_obj, &limit)) {
mp_raise_TypeError(translate("limit should be an int"));
}
print_tb = (limit != 0);
}
if (args[ARG_tb].u_obj != mp_const_none && print_tb) {
if (!mp_obj_is_type(args[ARG_tb].u_obj, &mp_type_traceback)) {
mp_raise_TypeError(translate("invalid traceback"));
}
exc.traceback = MP_OBJ_TO_PTR(args[ARG_tb].u_obj);
} else {
exc.traceback = NULL;
}
shared_module_traceback_print_exception(&exc, &print, limit);
traceback_exception_common(&print, args[ARG_value].u_obj, args[ARG_tb].u_obj, args[ARG_limit].u_obj);
return mp_const_none;
}
STATIC MP_DEFINE_CONST_FUN_OBJ_KW(traceback_print_exception_obj, 3, traceback_print_exception);
@ -114,6 +161,7 @@ STATIC const mp_rom_map_elem_t traceback_module_globals_table[] = {
// module name
{ MP_ROM_QSTR(MP_QSTR___name__), MP_ROM_QSTR(MP_QSTR_traceback) },
// module functions
{ MP_ROM_QSTR(MP_QSTR_format_exception), MP_ROM_PTR(&traceback_format_exception_obj) },
{ MP_ROM_QSTR(MP_QSTR_print_exception), MP_ROM_PTR(&traceback_print_exception_obj) },
};
STATIC MP_DEFINE_CONST_DICT(traceback_module_globals, traceback_module_globals_table);

View File

@ -1,5 +1,6 @@
#include "shared-bindings/vectorio/__init__.h"
#include "shared-bindings/vectorio/Circle.h"
#include "shared-bindings/vectorio/VectorShape.h"
#include <stdint.h>
@ -11,15 +12,21 @@
//| class Circle:
//|
//| def __init__(self, radius: int) -> None:
//| def __init__(self, pixel_shader: Union[displayio.ColorConverter, displayio.Palette], radius: int, x: int, y: int) -> None:
//| """Circle is positioned on screen by its center point.
//|
//| :param radius: The radius of the circle in pixels"""
//| :param pixel_shader: The pixel shader that produces colors from values
//| :param radius: The radius of the circle in pixels
//| :param x: Initial x position of the axis.
//| :param y: Initial y position of the axis."""
//|
static mp_obj_t vectorio_circle_make_new(const mp_obj_type_t *type, size_t n_args, const mp_obj_t *pos_args, mp_map_t *kw_args) {
enum { ARG_radius };
enum { ARG_pixel_shader, ARG_radius, ARG_x, ARG_y };
static const mp_arg_t allowed_args[] = {
{ MP_QSTR_pixel_shader, MP_ARG_OBJ | MP_ARG_KW_ONLY | MP_ARG_REQUIRED },
{ MP_QSTR_radius, MP_ARG_REQUIRED | MP_ARG_INT },
{ MP_QSTR_x, MP_ARG_INT | MP_ARG_KW_ONLY, {.u_int = 0} },
{ MP_QSTR_y, MP_ARG_INT | MP_ARG_KW_ONLY, {.u_int = 0} },
};
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);
@ -33,9 +40,22 @@ static mp_obj_t vectorio_circle_make_new(const mp_obj_type_t *type, size_t n_arg
self->base.type = &vectorio_circle_type;
common_hal_vectorio_circle_construct(self, radius);
// VectorShape parts
mp_obj_t pixel_shader = args[ARG_pixel_shader].u_obj;
int16_t x = args[ARG_x].u_int;
int16_t y = args[ARG_y].u_int;
mp_obj_t vector_shape = vectorio_vector_shape_make_new(self, pixel_shader, x, y);
self->draw_protocol_instance = vector_shape;
return MP_OBJ_FROM_PTR(self);
}
STATIC const vectorio_draw_protocol_t circle_draw_protocol = {
MP_PROTO_IMPLEMENT(MP_QSTR_protocol_draw)
.draw_get_protocol_self = (draw_get_protocol_self_fun)common_hal_vectorio_circle_get_draw_protocol,
.draw_protocol_impl = &vectorio_vector_shape_draw_protocol_impl
};
//| radius : int
//| """The radius of the circle in pixels."""
@ -62,13 +82,22 @@ const mp_obj_property_t vectorio_circle_radius_obj = {
STATIC const mp_rom_map_elem_t vectorio_circle_locals_dict_table[] = {
// Properties
{ MP_ROM_QSTR(MP_QSTR_radius), MP_ROM_PTR(&vectorio_circle_radius_obj) },
{ MP_ROM_QSTR(MP_QSTR_x), MP_ROM_PTR(&vectorio_vector_shape_x_obj) },
{ MP_ROM_QSTR(MP_QSTR_y), MP_ROM_PTR(&vectorio_vector_shape_y_obj) },
{ MP_ROM_QSTR(MP_QSTR_location), MP_ROM_PTR(&vectorio_vector_shape_location_obj) },
{ MP_ROM_QSTR(MP_QSTR_pixel_shader), MP_ROM_PTR(&vectorio_vector_shape_pixel_shader_obj) },
};
STATIC MP_DEFINE_CONST_DICT(vectorio_circle_locals_dict, vectorio_circle_locals_dict_table);
const mp_obj_type_t vectorio_circle_type = {
{ &mp_type_type },
.name = MP_QSTR_Circle,
.flags = MP_TYPE_FLAG_EXTENDED,
.make_new = vectorio_circle_make_new,
.locals_dict = (mp_obj_dict_t *)&vectorio_circle_locals_dict,
MP_TYPE_EXTENDED_FIELDS(
.protocol = &circle_draw_protocol,
),
};

View File

@ -19,4 +19,6 @@ void common_hal_vectorio_circle_get_area(void *circle, displayio_area_t *out_are
int16_t common_hal_vectorio_circle_get_radius(void *circle);
void common_hal_vectorio_circle_set_radius(void *circle, int16_t radius);
mp_obj_t common_hal_vectorio_circle_get_draw_protocol(void *circle);
#endif // MICROPY_INCLUDED_SHARED_BINDINGS_VECTORIO_CIRCLE_H

View File

@ -1,6 +1,7 @@
#include "shared-bindings/vectorio/__init__.h"
#include "shared-module/vectorio/__init__.h"
#include "shared-bindings/vectorio/Polygon.h"
#include "shared-bindings/vectorio/VectorShape.h"
#include <stdint.h>
@ -16,15 +17,21 @@
//| class Polygon:
//| def __init__(self, points: List[Tuple[int, int]]) -> None:
//| def __init__(self, pixel_shader: Union[displayio.ColorConverter, displayio.Palette], points: List[Tuple[int, int]], x: int, y: int) -> None:
//| """Represents a closed shape by ordered vertices
//|
//| :param points: Vertices for the polygon"""
//| :param pixel_shader: The pixel shader that produces colors from values
//| :param points: Vertices for the polygon
//| :param x: Initial screen x position of the 0,0 origin in the points list.
//| :param y: Initial screen y position of the 0,0 origin in the points list."""
//|
static mp_obj_t vectorio_polygon_make_new(const mp_obj_type_t *type, size_t n_args, const mp_obj_t *pos_args, mp_map_t *kw_args) {
enum { ARG_points_list };
enum { ARG_pixel_shader, ARG_points_list, ARG_x, ARG_y };
static const mp_arg_t allowed_args[] = {
{ MP_QSTR_pixel_shader, MP_ARG_OBJ | MP_ARG_KW_ONLY | MP_ARG_REQUIRED },
{ MP_QSTR_points, MP_ARG_REQUIRED | MP_ARG_OBJ, {.u_obj = MP_OBJ_NULL} },
{ MP_QSTR_x, MP_ARG_INT | MP_ARG_KW_ONLY, {.u_int = 0} },
{ MP_QSTR_y, MP_ARG_INT | MP_ARG_KW_ONLY, {.u_int = 0} },
};
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);
@ -38,9 +45,22 @@ static mp_obj_t vectorio_polygon_make_new(const mp_obj_type_t *type, size_t n_ar
common_hal_vectorio_polygon_construct(self, args[ARG_points_list].u_obj);
// VectorShape parts
mp_obj_t pixel_shader = args[ARG_pixel_shader].u_obj;
int16_t x = args[ARG_x].u_int;
int16_t y = args[ARG_y].u_int;
mp_obj_t vector_shape = vectorio_vector_shape_make_new(self, pixel_shader, x, y);
self->draw_protocol_instance = vector_shape;
return MP_OBJ_FROM_PTR(self);
}
STATIC const vectorio_draw_protocol_t polygon_draw_protocol = {
MP_PROTO_IMPLEMENT(MP_QSTR_protocol_draw)
.draw_get_protocol_self = (draw_get_protocol_self_fun)common_hal_vectorio_polygon_get_draw_protocol,
.draw_protocol_impl = &vectorio_vector_shape_draw_protocol_impl
};
//| points: List[Tuple[int, int]]
//| """Set a new look and shape for this polygon"""
@ -67,13 +87,22 @@ const mp_obj_property_t vectorio_polygon_points_obj = {
};
STATIC const mp_rom_map_elem_t vectorio_polygon_locals_dict_table[] = {
// Properties
{ MP_ROM_QSTR(MP_QSTR_points), MP_ROM_PTR(&vectorio_polygon_points_obj) },
{ MP_ROM_QSTR(MP_QSTR_x), MP_ROM_PTR(&vectorio_vector_shape_x_obj) },
{ MP_ROM_QSTR(MP_QSTR_y), MP_ROM_PTR(&vectorio_vector_shape_y_obj) },
{ MP_ROM_QSTR(MP_QSTR_location), MP_ROM_PTR(&vectorio_vector_shape_location_obj) },
{ MP_ROM_QSTR(MP_QSTR_pixel_shader), MP_ROM_PTR(&vectorio_vector_shape_pixel_shader_obj) },
};
STATIC MP_DEFINE_CONST_DICT(vectorio_polygon_locals_dict, vectorio_polygon_locals_dict_table);
const mp_obj_type_t vectorio_polygon_type = {
{ &mp_type_type },
.name = MP_QSTR_Polygon,
.flags = MP_TYPE_FLAG_EXTENDED,
.make_new = vectorio_polygon_make_new,
.locals_dict = (mp_obj_dict_t *)&vectorio_polygon_locals_dict,
MP_TYPE_EXTENDED_FIELDS(
.protocol = &polygon_draw_protocol,
),
};

View File

@ -20,5 +20,7 @@ void common_hal_vectorio_polygon_get_area(void *polygon, displayio_area_t *out_a
mp_obj_t common_hal_vectorio_polygon_get_points(vectorio_polygon_t *self);
void common_hal_vectorio_polygon_set_points(vectorio_polygon_t *self, mp_obj_t points_list);
mp_obj_t common_hal_vectorio_polygon_get_draw_protocol(void *polygon);
#endif // MICROPY_INCLUDED_SHARED_BINDINGS_VECTORIO_POLYGON_H

View File

@ -1,5 +1,7 @@
#include "shared-bindings/vectorio/__init__.h"
#include "shared-bindings/vectorio/Rectangle.h"
#include "shared-module/vectorio/VectorShape.h"
#include "shared-bindings/vectorio/VectorShape.h"
#include <stdint.h>
@ -8,17 +10,23 @@
#include "supervisor/shared/translate.h"
//| class Rectangle:
//| def __init__(self, width: int, height: int) -> None:
//| def __init__(self, pixel_shader: Union[displayio.ColorConverter, displayio.Palette], width: int, height: int, x: int, y: int) -> None:
//| """Represents a rectangle by defining its bounds
//|
//| :param pixel_shader: The pixel shader that produces colors from values
//| :param width: The number of pixels wide
//| :param height: The number of pixels high"""
//| :param height: The number of pixels high
//| :param x: Initial x position of the top left corner.
//| :param y: Initial y position of the top left corner."""
//|
static mp_obj_t vectorio_rectangle_make_new(const mp_obj_type_t *type, size_t n_args, const mp_obj_t *pos_args, mp_map_t *kw_args) {
enum { ARG_width, ARG_height };
enum { ARG_pixel_shader, ARG_width, ARG_height, ARG_x, ARG_y };
static const mp_arg_t allowed_args[] = {
{ MP_QSTR_pixel_shader, MP_ARG_OBJ | MP_ARG_KW_ONLY | MP_ARG_REQUIRED },
{ MP_QSTR_width, MP_ARG_REQUIRED | MP_ARG_INT },
{ MP_QSTR_height, MP_ARG_REQUIRED | MP_ARG_INT },
{ MP_QSTR_x, MP_ARG_INT | MP_ARG_KW_ONLY, {.u_int = 0} },
{ MP_QSTR_y, MP_ARG_INT | MP_ARG_KW_ONLY, {.u_int = 0} },
};
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);
@ -36,17 +44,38 @@ static mp_obj_t vectorio_rectangle_make_new(const mp_obj_type_t *type, size_t n_
self->base.type = &vectorio_rectangle_type;
common_hal_vectorio_rectangle_construct(self, width, height);
// VectorShape parts
mp_obj_t pixel_shader = args[ARG_pixel_shader].u_obj;
int16_t x = args[ARG_x].u_int;
int16_t y = args[ARG_y].u_int;
mp_obj_t vector_shape = vectorio_vector_shape_make_new(self, pixel_shader, x, y);
self->draw_protocol_instance = vector_shape;
return MP_OBJ_FROM_PTR(self);
}
STATIC const vectorio_draw_protocol_t rectangle_draw_protocol = {
MP_PROTO_IMPLEMENT(MP_QSTR_protocol_draw)
.draw_get_protocol_self = (draw_get_protocol_self_fun)common_hal_vectorio_rectangle_get_draw_protocol,
.draw_protocol_impl = &vectorio_vector_shape_draw_protocol_impl
};
STATIC const mp_rom_map_elem_t vectorio_rectangle_locals_dict_table[] = {
// Properties
{ MP_ROM_QSTR(MP_QSTR_x), MP_ROM_PTR(&vectorio_vector_shape_x_obj) },
{ MP_ROM_QSTR(MP_QSTR_y), MP_ROM_PTR(&vectorio_vector_shape_y_obj) },
{ MP_ROM_QSTR(MP_QSTR_location), MP_ROM_PTR(&vectorio_vector_shape_location_obj) },
{ MP_ROM_QSTR(MP_QSTR_pixel_shader), MP_ROM_PTR(&vectorio_vector_shape_pixel_shader_obj) },
};
STATIC MP_DEFINE_CONST_DICT(vectorio_rectangle_locals_dict, vectorio_rectangle_locals_dict_table);
const mp_obj_type_t vectorio_rectangle_type = {
{ &mp_type_type },
.name = MP_QSTR_Rectangle,
.flags = MP_TYPE_FLAG_EXTENDED,
.make_new = vectorio_rectangle_make_new,
.locals_dict = (mp_obj_dict_t *)&vectorio_rectangle_locals_dict,
MP_TYPE_EXTENDED_FIELDS(
.protocol = &rectangle_draw_protocol,
),
};

View File

@ -12,4 +12,6 @@ uint32_t common_hal_vectorio_rectangle_get_pixel(void *rectangle, int16_t x, int
void common_hal_vectorio_rectangle_get_area(void *rectangle, displayio_area_t *out_area);
mp_obj_t common_hal_vectorio_rectangle_get_draw_protocol(void *rectangle);
#endif // MICROPY_INCLUDED_SHARED_BINDINGS_VECTORIO_RECTANGLE_H

View File

@ -19,37 +19,16 @@
#include "supervisor/shared/translate.h"
//| class VectorShape:
//| def __init__(self, shape: Union[Polygon, Rectangle, Circle], pixel_shader: Union[displayio.ColorConverter, displayio.Palette], x: int=0, y: int=0) -> None:
//| """Binds a vector shape to a location and pixel color
//|
//| :param shape: The shape to draw.
//| :param pixel_shader: The pixel shader that produces colors from values
//| :param x: Initial x position of the center axis of the shape within the parent.
//| :param y: Initial y position of the center axis of the shape within the parent."""
//| ...
//|
STATIC mp_obj_t vectorio_vector_shape_make_new(const mp_obj_type_t *type, size_t n_args, const mp_obj_t *pos_args, mp_map_t *kw_args) {
enum { ARG_shape, ARG_pixel_shader, ARG_x, ARG_y };
static const mp_arg_t allowed_args[] = {
{ MP_QSTR_shape, MP_ARG_OBJ | MP_ARG_KW_ONLY | MP_ARG_REQUIRED },
{ MP_QSTR_pixel_shader, MP_ARG_OBJ | MP_ARG_KW_ONLY | MP_ARG_REQUIRED },
{ MP_QSTR_x, MP_ARG_INT | MP_ARG_KW_ONLY, {.u_int = 0} },
{ MP_QSTR_y, MP_ARG_INT | MP_ARG_KW_ONLY, {.u_int = 0} },
};
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_obj_t pixel_shader = args[ARG_pixel_shader].u_obj;
// shape: The shape implementation to draw.
// pixel_shader: The pixel shader that produces colors from values. The shader can be a displayio.Palette(1); it will be asked to color pixel value 0.
// x: Initial x position of the center axis of the shape within the parent.
// y: Initial y position of the center axis of the shape within the parent."""
mp_obj_t vectorio_vector_shape_make_new(const mp_obj_t shape, const mp_obj_t pixel_shader, int16_t x, int16_t y) {
if (!mp_obj_is_type(pixel_shader, &displayio_colorconverter_type) &&
!mp_obj_is_type(pixel_shader, &displayio_palette_type)) {
mp_raise_TypeError_varg(translate("unsupported %q type"), MP_QSTR_pixel_shader);
}
int16_t x = args[ARG_x].u_int;
int16_t y = args[ARG_y].u_int;
mp_obj_t shape = args[ARG_shape].u_obj;
vectorio_ishape_t ishape;
// Wire up shape functions
if (mp_obj_is_type(shape, &vectorio_polygon_type)) {
@ -92,18 +71,32 @@ STATIC mp_obj_t vectorio_vector_shape_make_new(const mp_obj_type_t *type, size_t
return MP_OBJ_FROM_PTR(self);
}
vectorio_draw_protocol_impl_t vectorio_vector_shape_draw_protocol_impl = {
.draw_fill_area = (draw_fill_area_fun)vectorio_vector_shape_fill_area,
.draw_get_dirty_area = (draw_get_dirty_area_fun)vectorio_vector_shape_get_dirty_area,
.draw_update_transform = (draw_update_transform_fun)vectorio_vector_shape_update_transform,
.draw_finish_refresh = (draw_finish_refresh_fun)vectorio_vector_shape_finish_refresh,
.draw_get_refresh_areas = (draw_get_refresh_areas_fun)vectorio_vector_shape_get_refresh_areas,
};
// Stub checker does not approve of these shared properties.
// x: int
// """X position of the center point of the shape in the parent."""
//
STATIC mp_obj_t vectorio_vector_shape_obj_get_x(mp_obj_t wrapper_shape) {
// Relies on the fact that only vector_shape impl gets matched with a VectorShape.
const vectorio_draw_protocol_t *draw_protocol = mp_proto_get(MP_QSTR_protocol_draw, wrapper_shape);
vectorio_vector_shape_t *self = MP_OBJ_TO_PTR(draw_protocol->draw_get_protocol_self(wrapper_shape));
//| x: int
//| """X position of the center point of the shape in the parent."""
//|
STATIC mp_obj_t vectorio_vector_shape_obj_get_x(mp_obj_t self_in) {
vectorio_vector_shape_t *self = MP_OBJ_TO_PTR(self_in);
return MP_OBJ_NEW_SMALL_INT(common_hal_vectorio_vector_shape_get_x(self));
}
MP_DEFINE_CONST_FUN_OBJ_1(vectorio_vector_shape_get_x_obj, vectorio_vector_shape_obj_get_x);
STATIC mp_obj_t vectorio_vector_shape_obj_set_x(mp_obj_t self_in, mp_obj_t x_obj) {
vectorio_vector_shape_t *self = MP_OBJ_TO_PTR(self_in);
STATIC mp_obj_t vectorio_vector_shape_obj_set_x(mp_obj_t wrapper_shape, mp_obj_t x_obj) {
// Relies on the fact that only vector_shape impl gets matched with a VectorShape.
const vectorio_draw_protocol_t *draw_protocol = mp_proto_get(MP_QSTR_protocol_draw, wrapper_shape);
vectorio_vector_shape_t *self = MP_OBJ_TO_PTR(draw_protocol->draw_get_protocol_self(wrapper_shape));
mp_int_t x = mp_obj_get_int(x_obj);
common_hal_vectorio_vector_shape_set_x(self, x);
@ -119,17 +112,22 @@ const mp_obj_property_t vectorio_vector_shape_x_obj = {
};
//| y: int
//| """Y position of the center point of the shape in the parent."""
//|
STATIC mp_obj_t vectorio_vector_shape_obj_get_y(mp_obj_t self_in) {
vectorio_vector_shape_t *self = MP_OBJ_TO_PTR(self_in);
// y: int
// """Y position of the center point of the shape in the parent."""
//
STATIC mp_obj_t vectorio_vector_shape_obj_get_y(mp_obj_t wrapper_shape) {
// Relies on the fact that only vector_shape impl gets matched with a VectorShape.
const vectorio_draw_protocol_t *draw_protocol = mp_proto_get(MP_QSTR_protocol_draw, wrapper_shape);
vectorio_vector_shape_t *self = MP_OBJ_TO_PTR(draw_protocol->draw_get_protocol_self(wrapper_shape));
return MP_OBJ_NEW_SMALL_INT(common_hal_vectorio_vector_shape_get_y(self));
}
MP_DEFINE_CONST_FUN_OBJ_1(vectorio_vector_shape_get_y_obj, vectorio_vector_shape_obj_get_y);
STATIC mp_obj_t vectorio_vector_shape_obj_set_y(mp_obj_t self_in, mp_obj_t y_obj) {
vectorio_vector_shape_t *self = MP_OBJ_TO_PTR(self_in);
STATIC mp_obj_t vectorio_vector_shape_obj_set_y(mp_obj_t wrapper_shape, mp_obj_t y_obj) {
// Relies on the fact that only vector_shape impl gets matched with a VectorShape.
const vectorio_draw_protocol_t *draw_protocol = mp_proto_get(MP_QSTR_protocol_draw, wrapper_shape);
vectorio_vector_shape_t *self = MP_OBJ_TO_PTR(draw_protocol->draw_get_protocol_self(wrapper_shape));
mp_int_t y = mp_obj_get_int(y_obj);
common_hal_vectorio_vector_shape_set_y(self, y);
@ -145,17 +143,53 @@ const mp_obj_property_t vectorio_vector_shape_y_obj = {
};
//| pixel_shader: Union[displayio.ColorConverter, displayio.Palette]
//| """The pixel shader of the shape."""
//|
STATIC mp_obj_t vectorio_vector_shape_obj_get_pixel_shader(mp_obj_t self_in) {
vectorio_vector_shape_t *self = MP_OBJ_TO_PTR(self_in);
// location: Tuple[int, int]
// """location of the center point of the shape in the parent."""
//
STATIC mp_obj_t vectorio_vector_shape_obj_get_location(mp_obj_t wrapper_shape) {
// Relies on the fact that only vector_shape impl gets matched with a VectorShape.
const vectorio_draw_protocol_t *draw_protocol = mp_proto_get(MP_QSTR_protocol_draw, wrapper_shape);
vectorio_vector_shape_t *self = MP_OBJ_TO_PTR(draw_protocol->draw_get_protocol_self(wrapper_shape));
return MP_OBJ_TO_PTR(common_hal_vectorio_vector_shape_get_location(self));
}
MP_DEFINE_CONST_FUN_OBJ_1(vectorio_vector_shape_get_location_obj, vectorio_vector_shape_obj_get_location);
STATIC mp_obj_t vectorio_vector_shape_obj_set_location(mp_obj_t wrapper_shape, mp_obj_t location_obj) {
// Relies on the fact that only vector_shape impl gets matched with a VectorShape.
const vectorio_draw_protocol_t *draw_protocol = mp_proto_get(MP_QSTR_protocol_draw, wrapper_shape);
vectorio_vector_shape_t *self = MP_OBJ_TO_PTR(draw_protocol->draw_get_protocol_self(wrapper_shape));
common_hal_vectorio_vector_shape_set_location(self, location_obj);
return mp_const_none;
}
MP_DEFINE_CONST_FUN_OBJ_2(vectorio_vector_shape_set_location_obj, vectorio_vector_shape_obj_set_location);
const mp_obj_property_t vectorio_vector_shape_location_obj = {
.base.type = &mp_type_property,
.proxy = {(mp_obj_t)&vectorio_vector_shape_get_location_obj,
(mp_obj_t)&vectorio_vector_shape_set_location_obj,
MP_ROM_NONE},
};
// pixel_shader: Union[ColorConverter, Palette]
// """The pixel shader of the shape."""
//
STATIC mp_obj_t vectorio_vector_shape_obj_get_pixel_shader(mp_obj_t wrapper_shape) {
// Relies on the fact that only vector_shape impl gets matched with a VectorShape.
const vectorio_draw_protocol_t *draw_protocol = mp_proto_get(MP_QSTR_protocol_draw, wrapper_shape);
vectorio_vector_shape_t *self = MP_OBJ_TO_PTR(draw_protocol->draw_get_protocol_self(wrapper_shape));
return common_hal_vectorio_vector_shape_get_pixel_shader(self);
}
MP_DEFINE_CONST_FUN_OBJ_1(vectorio_vector_shape_get_pixel_shader_obj, vectorio_vector_shape_obj_get_pixel_shader);
STATIC mp_obj_t vectorio_vector_shape_obj_set_pixel_shader(mp_obj_t self_in, mp_obj_t pixel_shader) {
vectorio_vector_shape_t *self = MP_OBJ_TO_PTR(self_in);
STATIC mp_obj_t vectorio_vector_shape_obj_set_pixel_shader(mp_obj_t wrapper_shape, mp_obj_t pixel_shader) {
// Relies on the fact that only vector_shape impl gets matched with a VectorShape.
const vectorio_draw_protocol_t *draw_protocol = mp_proto_get(MP_QSTR_protocol_draw, wrapper_shape);
vectorio_vector_shape_t *self = MP_OBJ_TO_PTR(draw_protocol->draw_get_protocol_self(wrapper_shape));
if (!mp_obj_is_type(pixel_shader, &displayio_palette_type) && !mp_obj_is_type(pixel_shader, &displayio_colorconverter_type)) {
mp_raise_TypeError(translate("pixel_shader must be displayio.Palette or displayio.ColorConverter"));
}
@ -175,16 +209,11 @@ const mp_obj_property_t vectorio_vector_shape_pixel_shader_obj = {
STATIC const mp_rom_map_elem_t vectorio_vector_shape_locals_dict_table[] = {
// Properties
{ MP_ROM_QSTR(MP_QSTR_x), MP_ROM_PTR(&vectorio_vector_shape_x_obj) },
{ MP_ROM_QSTR(MP_QSTR_y), MP_ROM_PTR(&vectorio_vector_shape_y_obj) },
{ MP_ROM_QSTR(MP_QSTR_pixel_shader), MP_ROM_PTR(&vectorio_vector_shape_pixel_shader_obj) },
};
STATIC MP_DEFINE_CONST_DICT(vectorio_vector_shape_locals_dict, vectorio_vector_shape_locals_dict_table);
const mp_obj_type_t vectorio_vector_shape_type = {
{ &mp_type_type },
.name = MP_QSTR_VectorShape,
.make_new = vectorio_vector_shape_make_new,
.locals_dict = (mp_obj_dict_t *)&vectorio_vector_shape_locals_dict,
};

View File

@ -1,11 +1,19 @@
#ifndef MICROPY_INCLUDED_SHARED_BINDINGS_VECTORIO_SHAPE_H
#define MICROPY_INCLUDED_SHARED_BINDINGS_VECTORIO_SHAPE_H
#include "py/objproperty.h"
#include "py/objtuple.h"
#include "shared-bindings/vectorio/__init__.h"
#include "shared-module/vectorio/VectorShape.h"
#include "shared-module/displayio/area.h"
extern const mp_obj_type_t vectorio_vector_shape_type;
// Python shared bindings constructor
mp_obj_t vectorio_vector_shape_make_new(const mp_obj_t shape, const mp_obj_t pixel_shader, int16_t x, int16_t y);
// C data constructor
void common_hal_vectorio_vector_shape_construct(vectorio_vector_shape_t *self,
vectorio_ishape_t ishape,
mp_obj_t pixel_shader, uint16_t x, uint16_t y);
@ -15,13 +23,22 @@ void common_hal_vectorio_vector_shape_set_dirty(void *self);
mp_int_t common_hal_vectorio_vector_shape_get_x(vectorio_vector_shape_t *self);
void common_hal_vectorio_vector_shape_set_x(vectorio_vector_shape_t *self, mp_int_t x);
mp_obj_tuple_t *common_hal_vectorio_vector_shape_get_location(vectorio_vector_shape_t *self);
void common_hal_vectorio_vector_shape_set_location(vectorio_vector_shape_t *self, mp_obj_t xy);
mp_int_t common_hal_vectorio_vector_shape_get_y(vectorio_vector_shape_t *self);
void common_hal_vectorio_vector_shape_set_y(vectorio_vector_shape_t *self, mp_int_t y);
mp_obj_t common_hal_vectorio_vector_shape_get_pixel_shader(vectorio_vector_shape_t *self);
void common_hal_vectorio_vector_shape_set_pixel_shader(vectorio_vector_shape_t *self, mp_obj_t pixel_shader);
void vectorio_vector_shape_update_transform(vectorio_vector_shape_t *self, displayio_buffer_transform_t *group_transform);
// Composable property definition for shapes that use VectorShape
extern vectorio_draw_protocol_impl_t vectorio_vector_shape_draw_protocol_impl;
extern const mp_obj_property_t vectorio_vector_shape_x_obj;
extern const mp_obj_property_t vectorio_vector_shape_y_obj;
extern const mp_obj_property_t vectorio_vector_shape_location_obj;
extern const mp_obj_property_t vectorio_vector_shape_pixel_shader_obj;
#endif // MICROPY_INCLUDED_SHARED_BINDINGS_VECTORIO_SHAPE_H

View File

@ -6,7 +6,6 @@
#include "shared-bindings/vectorio/Circle.h"
#include "shared-bindings/vectorio/Polygon.h"
#include "shared-bindings/vectorio/Rectangle.h"
#include "shared-bindings/vectorio/VectorShape.h"
//| """Lightweight 2d shapes for displays"""
//|
@ -16,7 +15,6 @@ STATIC const mp_rom_map_elem_t vectorio_module_globals_table[] = {
{ MP_ROM_QSTR(MP_QSTR_Circle), MP_ROM_PTR(&vectorio_circle_type) },
{ MP_ROM_QSTR(MP_QSTR_Polygon), MP_ROM_PTR(&vectorio_polygon_type) },
{ MP_ROM_QSTR(MP_QSTR_Rectangle), MP_ROM_PTR(&vectorio_rectangle_type) },
{ MP_ROM_QSTR(MP_QSTR_VectorShape), MP_ROM_PTR(&vectorio_vector_shape_type) },
};
STATIC MP_DEFINE_CONST_DICT(vectorio_module_globals, vectorio_module_globals_table);

View File

@ -0,0 +1,41 @@
#ifndef SHARED_MODULE_VECTORIO__INIT__H
#define SHARED_MODULE_VECTORIO__INIT__H
#include <stdbool.h>
#include <stdint.h>
#include "py/obj.h"
#include "py/proto.h"
#include "shared-module/displayio/area.h"
#include "shared-module/displayio/Palette.h"
// Returns the object on which the rest of the draw protocol methods are invoked.
typedef mp_obj_t (*draw_get_protocol_self_fun)(mp_obj_t protocol_container);
typedef bool (*draw_fill_area_fun)(mp_obj_t draw_protocol_self, const _displayio_colorspace_t *colorspace, const displayio_area_t *area, uint32_t *mask, uint32_t *buffer);
typedef bool (*draw_get_dirty_area_fun)(mp_obj_t draw_protocol_self, displayio_area_t *current_dirty_area);
typedef void (*draw_update_transform_fun)(mp_obj_t draw_protocol_self, displayio_buffer_transform_t *group_transform);
typedef void (*draw_finish_refresh_fun)(mp_obj_t draw_protocol_self);
typedef displayio_area_t *(*draw_get_refresh_areas_fun)(mp_obj_t draw_protocol_self, displayio_area_t *tail);
typedef struct _vectorio_draw_protocol_impl_t {
draw_fill_area_fun draw_fill_area;
draw_get_dirty_area_fun draw_get_dirty_area;
draw_update_transform_fun draw_update_transform;
draw_finish_refresh_fun draw_finish_refresh;
draw_get_refresh_areas_fun draw_get_refresh_areas;
} vectorio_draw_protocol_impl_t;
// Draw protocol
typedef struct _vectorio_draw_protocol_t {
MP_PROTOCOL_HEAD // MP_QSTR_protocol_draw
// Instance of the draw protocol
draw_get_protocol_self_fun draw_get_protocol_self;
// Implementation functions for the draw protocol
vectorio_draw_protocol_impl_t *draw_protocol_impl;
} vectorio_draw_protocol_t;
#endif

View File

@ -206,7 +206,7 @@ audioio_get_buffer_result_t audioio_wavefile_get_buffer(audioio_wavefile_obj_t *
}
if (need_more_data) {
uint16_t num_bytes_to_load = self->len;
uint32_t num_bytes_to_load = self->len;
if (num_bytes_to_load > self->bytes_remaining) {
num_bytes_to_load = self->bytes_remaining;
}

View File

@ -144,10 +144,10 @@ static void _update_child_transforms(displayio_group_t *self) {
for (size_t i = 0; i < self->members->len; i++) {
mp_obj_t layer;
#if CIRCUITPY_VECTORIO
layer = mp_obj_cast_to_native_base(
self->members->items[i], &vectorio_vector_shape_type);
if (layer != MP_OBJ_NULL) {
vectorio_vector_shape_update_transform(layer, &self->absolute_transform);
const vectorio_draw_protocol_t *draw_protocol = mp_proto_get(MP_QSTR_protocol_draw, self->members->items[i]);
if (draw_protocol != NULL) {
layer = draw_protocol->draw_get_protocol_self(self->members->items[i]);
draw_protocol->draw_protocol_impl->draw_update_transform(layer, &self->absolute_transform);
continue;
}
#endif
@ -241,15 +241,14 @@ void common_hal_displayio_group_set_y(displayio_group_t *self, mp_int_t y) {
}
static void _add_layer(displayio_group_t *self, mp_obj_t layer) {
mp_obj_t native_layer;
#if CIRCUITPY_VECTORIO
native_layer = mp_obj_cast_to_native_base(layer, &vectorio_vector_shape_type);
if (native_layer != MP_OBJ_NULL) {
vectorio_vector_shape_update_transform(native_layer, &self->absolute_transform);
const vectorio_draw_protocol_t *draw_protocol = mp_proto_get(MP_QSTR_protocol_draw, layer);
if (draw_protocol != NULL) {
draw_protocol->draw_protocol_impl->draw_update_transform(draw_protocol->draw_get_protocol_self(layer), &self->absolute_transform);
return;
}
#endif
native_layer = mp_obj_cast_to_native_base(layer, &displayio_tilegrid_type);
mp_obj_t native_layer = mp_obj_cast_to_native_base(layer, &displayio_tilegrid_type);
if (native_layer != MP_OBJ_NULL) {
displayio_tilegrid_t *tilegrid = native_layer;
if (tilegrid->in_group) {
@ -283,12 +282,12 @@ static void _remove_layer(displayio_group_t *self, size_t index) {
displayio_area_t layer_area;
bool rendered_last_frame = false;
#if CIRCUITPY_VECTORIO
layer = mp_obj_cast_to_native_base(
self->members->items[index], &vectorio_vector_shape_type);
if (layer != MP_OBJ_NULL) {
bool has_dirty_area = vectorio_vector_shape_get_dirty_area(layer, &layer_area);
const vectorio_draw_protocol_t *draw_protocol = mp_proto_get(MP_QSTR_protocol_draw, self->members->items[index]);
if (draw_protocol != NULL) {
layer = draw_protocol->draw_get_protocol_self(self->members->items[index]);
bool has_dirty_area = draw_protocol->draw_protocol_impl->draw_get_dirty_area(layer, &layer_area);
rendered_last_frame = has_dirty_area;
vectorio_vector_shape_update_transform(layer, NULL);
draw_protocol->draw_protocol_impl->draw_update_transform(layer, NULL);
}
#endif
layer = mp_obj_cast_to_native_base(
@ -362,10 +361,10 @@ bool displayio_group_fill_area(displayio_group_t *self, const _displayio_colorsp
for (int32_t i = self->members->len - 1; i >= 0; i--) {
mp_obj_t layer;
#if CIRCUITPY_VECTORIO
layer = mp_obj_cast_to_native_base(
self->members->items[i], &vectorio_vector_shape_type);
if (layer != MP_OBJ_NULL) {
if (vectorio_vector_shape_fill_area(layer, colorspace, area, mask, buffer)) {
const vectorio_draw_protocol_t *draw_protocol = mp_proto_get(MP_QSTR_protocol_draw, self->members->items[i]);
if (draw_protocol != NULL) {
layer = draw_protocol->draw_get_protocol_self(self->members->items[i]);
if (draw_protocol->draw_protocol_impl->draw_fill_area(layer, colorspace, area, mask, buffer)) {
return true;
}
continue;
@ -396,10 +395,10 @@ void displayio_group_finish_refresh(displayio_group_t *self) {
for (int32_t i = self->members->len - 1; i >= 0; i--) {
mp_obj_t layer;
#if CIRCUITPY_VECTORIO
layer = mp_obj_cast_to_native_base(
self->members->items[i], &vectorio_vector_shape_type);
if (layer != MP_OBJ_NULL) {
vectorio_vector_shape_finish_refresh(layer);
const vectorio_draw_protocol_t *draw_protocol = mp_proto_get(MP_QSTR_protocol_draw, self->members->items[i]);
if (draw_protocol != NULL) {
layer = draw_protocol->draw_get_protocol_self(self->members->items[i]);
draw_protocol->draw_protocol_impl->draw_finish_refresh(layer);
continue;
}
#endif
@ -427,10 +426,10 @@ displayio_area_t *displayio_group_get_refresh_areas(displayio_group_t *self, dis
for (int32_t i = self->members->len - 1; i >= 0; i--) {
mp_obj_t layer;
#if CIRCUITPY_VECTORIO
layer = mp_obj_cast_to_native_base(
self->members->items[i], &vectorio_vector_shape_type);
if (layer != MP_OBJ_NULL) {
tail = vectorio_vector_shape_get_refresh_areas(layer, tail);
const vectorio_draw_protocol_t *draw_protocol = mp_proto_get(MP_QSTR_protocol_draw, self->members->items[i]);
if (draw_protocol != NULL) {
layer = draw_protocol->draw_get_protocol_self(self->members->items[i]);
tail = draw_protocol->draw_protocol_impl->draw_get_refresh_areas(layer, tail);
continue;
}
#endif

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