summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorScott Shawcroft <scott@tannewt.org>2018-09-06 14:54:55 -0700
committerScott Shawcroft <scott@tannewt.org>2018-09-06 14:54:55 -0700
commitc2e49dc87f1f2232002f0307e1f2e11369f79c22 (patch)
treeb0a76120c390a5c1ac81e7ce7aff441098003b47
parent1683eb913d5bfb4265df56bf286d9971185a3a82 (diff)
parent23b23dd2b8e3a9a401e6ba8d60728adebe51c840 (diff)
Merge remote-tracking branch 'adafruit/master' into hallowing
-rw-r--r--conf.py2
-rw-r--r--locale/de_DE.po2249
-rwxr-xr-xmain.c2
-rw-r--r--ports/atmel-samd/boards/circuitplayground_express/board.c4
-rw-r--r--ports/atmel-samd/boards/circuitplayground_express_crickit/board.c4
-rw-r--r--ports/atmel-samd/boards/gemma_m0/pins.c1
-rw-r--r--ports/atmel-samd/common-hal/analogio/AnalogIn.c2
-rw-r--r--ports/atmel-samd/common-hal/analogio/AnalogOut.c2
-rw-r--r--ports/atmel-samd/common-hal/audiobusio/I2SOut.c6
-rw-r--r--ports/atmel-samd/common-hal/audiobusio/PDMIn.c4
-rw-r--r--ports/atmel-samd/common-hal/audioio/AudioOut.c4
-rw-r--r--ports/atmel-samd/common-hal/busio/I2C.c16
-rw-r--r--ports/atmel-samd/common-hal/busio/I2C.h2
-rw-r--r--ports/atmel-samd/common-hal/busio/SPI.c6
-rw-r--r--ports/atmel-samd/common-hal/busio/UART.c10
-rw-r--r--ports/atmel-samd/common-hal/digitalio/DigitalInOut.c6
-rw-r--r--ports/atmel-samd/common-hal/i2cslave/I2CSlave.c4
-rw-r--r--ports/atmel-samd/common-hal/microcontroller/Pin.c30
-rw-r--r--ports/atmel-samd/common-hal/microcontroller/Pin.h4
-rw-r--r--ports/atmel-samd/common-hal/pulseio/PWMOut.c2
-rw-r--r--ports/atmel-samd/common-hal/pulseio/PulseIn.c4
-rw-r--r--ports/atmel-samd/common-hal/rotaryio/IncrementalEncoder.c7
-rw-r--r--ports/atmel-samd/common-hal/touchio/TouchIn.c2
m---------ports/atmel-samd/peripherals0
-rwxr-xr-xports/nrf/Makefile77
-rw-r--r--ports/nrf/board_busses.c114
-rw-r--r--ports/nrf/board_busses.h39
-rw-r--r--ports/nrf/boards/feather_nrf52832/board.c4
-rw-r--r--ports/nrf/boards/feather_nrf52832/mpconfigboard.h10
-rw-r--r--ports/nrf/boards/feather_nrf52832/mpconfigboard.mk4
-rw-r--r--ports/nrf/boards/feather_nrf52832/pins.c46
-rw-r--r--ports/nrf/boards/feather_nrf52832/pins.csv24
-rw-r--r--ports/nrf/boards/feather_nrf52840_express/mpconfigboard.h34
-rw-r--r--ports/nrf/boards/feather_nrf52840_express/mpconfigboard.mk3
-rw-r--r--ports/nrf/boards/feather_nrf52840_express/pins.c41
-rw-r--r--ports/nrf/boards/feather_nrf52840_express/pins.csv48
-rw-r--r--ports/nrf/boards/pca10040/mpconfigboard.h1
-rw-r--r--ports/nrf/boards/pca10040/mpconfigboard.mk4
-rw-r--r--ports/nrf/boards/pca10040/pins.c40
-rw-r--r--ports/nrf/boards/pca10040/pins.csv31
-rw-r--r--ports/nrf/boards/pca10056/mpconfigboard.h12
-rw-r--r--ports/nrf/boards/pca10056/mpconfigboard.mk3
-rw-r--r--ports/nrf/boards/pca10056/pins.c129
-rw-r--r--ports/nrf/boards/pca10056/pins.csv48
-rw-r--r--ports/nrf/boards/pca10059/board.c (renamed from ports/nrf/nrf_pin.h)36
-rw-r--r--ports/nrf/boards/pca10059/bootloader/6.0.0/pca10056_bootloader_6.0.0_s140.zipbin0 -> 174550 bytes
-rw-r--r--ports/nrf/boards/pca10059/mpconfigboard.h32
-rw-r--r--ports/nrf/boards/pca10059/mpconfigboard.mk17
-rw-r--r--ports/nrf/boards/pca10059/pins.c42
-rw-r--r--ports/nrf/common-hal/analogio/AnalogIn.c6
-rw-r--r--ports/nrf/common-hal/analogio/AnalogOut.c2
-rw-r--r--ports/nrf/common-hal/busio/I2C.c23
-rw-r--r--ports/nrf/common-hal/busio/I2C.h3
-rw-r--r--ports/nrf/common-hal/busio/SPI.c36
-rw-r--r--ports/nrf/common-hal/busio/SPI.h4
-rw-r--r--ports/nrf/common-hal/busio/UART.c2
-rw-r--r--ports/nrf/common-hal/digitalio/DigitalInOut.c61
-rw-r--r--ports/nrf/common-hal/digitalio/DigitalInOut.h1
-rw-r--r--ports/nrf/common-hal/microcontroller/Pin.c129
-rw-r--r--ports/nrf/common-hal/microcontroller/Pin.h27
-rw-r--r--ports/nrf/common-hal/microcontroller/__init__.c55
-rw-r--r--ports/nrf/common-hal/neopixel_write/__init__.c265
-rw-r--r--ports/nrf/common-hal/pulseio/PWMOut.c8
-rw-r--r--ports/nrf/mpconfigport.h2
-rw-r--r--ports/nrf/nrf52_af.csv48
-rw-r--r--ports/nrf/nrfx_config.h11
-rw-r--r--ports/nrf/peripherals/nrf/nrf52832/pins.c65
-rw-r--r--ports/nrf/peripherals/nrf/nrf52832/pins.h63
-rw-r--r--ports/nrf/peripherals/nrf/nrf52840/pins.c78
-rw-r--r--ports/nrf/peripherals/nrf/nrf52840/pins.h79
-rw-r--r--ports/nrf/peripherals/nrf/pins.h68
-rw-r--r--ports/nrf/supervisor/serial.c1
-rw-r--r--ports/nrf/usb/usb.c4
-rw-r--r--supervisor/shared/rgb_led_status.c8
74 files changed, 3841 insertions, 420 deletions
diff --git a/conf.py b/conf.py
index 8a7d49a43..0f363923f 100644
--- a/conf.py
+++ b/conf.py
@@ -115,9 +115,9 @@ exclude_patterns = ["**/build*",
"ports/minimal",
"ports/nrf/device",
"ports/nrf/drivers",
- "ports/nrf/hal",
"ports/nrf/modules",
"ports/nrf/nrfx",
+ "ports/nrf/peripherals",
"ports/nrf/usb",
"ports/pic16bit",
"ports/qemu-arm",
diff --git a/locale/de_DE.po b/locale/de_DE.po
new file mode 100644
index 000000000..c3883a7db
--- /dev/null
+++ b/locale/de_DE.po
@@ -0,0 +1,2249 @@
+# SOME DESCRIPTIVE TITLE.
+# Copyright (C) YEAR THE PACKAGE'S COPYRIGHT HOLDER
+# This file is distributed under the same license as the PACKAGE package.
+# FIRST AUTHOR <EMAIL@ADDRESS>, YEAR.
+#
+msgid ""
+msgstr ""
+"Project-Id-Version: \n"
+"Report-Msgid-Bugs-To: \n"
+"POT-Creation-Date: 2018-08-20 09:37-0700\n"
+"PO-Revision-Date: 2018-07-27 11:55-0700\n"
+"Last-Translator: Sebastian Plamauer\n"
+"Language-Team: \n"
+"Language: en_US\n"
+"MIME-Version: 1.0\n"
+"Content-Type: text/plain; charset=UTF-8\n"
+"Content-Transfer-Encoding: 8bit\n"
+"X-Generator: Poedit 2.1.1\n"
+
+#: extmod/machine_i2c.c:299
+msgid "invalid I2C peripheral"
+msgstr "ungültige I2C Schnittstelle"
+
+#: extmod/machine_i2c.c:340 extmod/machine_i2c.c:354 extmod/machine_i2c.c:368
+#: extmod/machine_i2c.c:392
+msgid "I2C operation not supported"
+msgstr "I2C-operation nicht unterstützt"
+
+#: extmod/machine_mem.c:45 ports/unix/modmachine.c:53
+#, c-format
+msgid "address %08x is not aligned to %d bytes"
+msgstr "Addresse %08x ist nicht an %d bytes ausgerichtet"
+
+#: extmod/machine_spi.c:57
+msgid "invalid SPI peripheral"
+msgstr "ungültige SPI Schnittstelle"
+
+#: extmod/machine_spi.c:124
+msgid "buffers must be the same length"
+msgstr "Buffer müssen gleich lang sein"
+
+#: extmod/machine_spi.c:207
+msgid "bits must be 8"
+msgstr "bits müssen 8 sein"
+
+#: extmod/machine_spi.c:210
+msgid "firstbit must be MSB"
+msgstr "das erste Bit muss MSB sein"
+
+#: extmod/machine_spi.c:215
+msgid "must specify all of sck/mosi/miso"
+msgstr "sck/mosi/miso müssen alle spezifiziert sein"
+
+#: extmod/modframebuf.c:299
+msgid "invalid format"
+msgstr "ungültiges Format"
+
+#: extmod/modubinascii.c:38 extmod/moduhashlib.c:102
+msgid "a bytes-like object is required"
+msgstr "ein Byte-ähnliches Objekt ist erforderlich"
+
+#: extmod/modubinascii.c:90
+msgid "odd-length string"
+msgstr "String mit ungerader Länge"
+
+#: extmod/modubinascii.c:101
+msgid "non-hex digit found"
+msgstr "eine nicht-hex zahl wurde gefunden"
+
+#: extmod/modubinascii.c:169
+msgid "incorrect padding"
+msgstr "falsches padding"
+
+#: extmod/moductypes.c:122
+msgid "syntax error in uctypes descriptor"
+msgstr "Syntaxfehler in uctypes Definition"
+
+#: extmod/moductypes.c:219
+msgid "Cannot unambiguously get sizeof scalar"
+msgstr "sizeof scalar kann nicht eindeutig bestimmt werden"
+
+#: extmod/moductypes.c:397
+msgid "struct: no fields"
+msgstr "struct: keine Felder"
+
+#: extmod/moductypes.c:530
+msgid "struct: cannot index"
+msgstr "struct: kann nicht indexieren"
+
+#: extmod/moductypes.c:544
+msgid "struct: index out of range"
+msgstr "struct: index außerhalb gültigen Bereichs"
+
+#: extmod/moduheapq.c:38
+msgid "heap must be a list"
+msgstr "heap muss eine list sein"
+
+#: extmod/moduheapq.c:86 extmod/modutimeq.c:147 extmod/modutimeq.c:172
+msgid "empty heap"
+msgstr "leerer heap"
+
+#: extmod/modujson.c:281
+msgid "syntax error in JSON"
+msgstr "Syntaxfehler in JSON"
+
+#: extmod/modure.c:161
+msgid "Splitting with sub-captures"
+msgstr "Teilen mit unter-captures"
+
+#: extmod/modure.c:207
+msgid "Error in regex"
+msgstr "Fehler in regex"
+
+#: extmod/modussl_axtls.c:81
+msgid "invalid key"
+msgstr "ungültiger Schlüssel"
+
+#: extmod/modussl_axtls.c:87
+msgid "invalid cert"
+msgstr "ungültiges cert"
+
+#: extmod/modutimeq.c:131
+msgid "queue overflow"
+msgstr "Warteschlangenüberlauf"
+
+#: extmod/moduzlib.c:97
+msgid "compression header"
+msgstr "kompression header"
+
+#: extmod/uos_dupterm.c:120
+msgid "invalid dupterm index"
+msgstr "ungültiger dupterm index"
+
+#: extmod/vfs_fat.c:426 py/moduerrno.c:150
+msgid "Read-only filesystem"
+msgstr "Schreibgeschützte Dateisystem"
+
+#: extmod/vfs_posix_file.c:48 ports/unix/file.c:50 py/objstringio.c:43
+msgid "I/O operation on closed file"
+msgstr "Lese/Schreibe-operation an geschlossener Datei"
+
+#: lib/embed/abort_.c:8
+msgid "abort() called"
+msgstr "abort() wurde aufgerufen"
+
+#: lib/netutils/netutils.c:83
+msgid "invalid arguments"
+msgstr "ungültige argumente"
+
+#: lib/utils/pyexec.c:97 py/builtinimport.c:253
+msgid "script compilation not supported"
+msgstr "kompilieren von Skripten ist nicht unterstützt"
+
+#: main.c:143
+msgid " output:\n"
+msgstr " Ausgabe:\n"
+
+#: main.c:157 main.c:230
+msgid ""
+"Auto-reload is on. Simply save files over USB to run them or enter REPL to "
+"disable.\n"
+msgstr "Automatisches Neuladen ist aktiv. Speichere Dateien über USB um sie "
+"auszuführen oder verbinde dich mit der REPL um zu deaktivieren.\n"
+
+#: main.c:159
+msgid "Running in safe mode! Auto-reload is off.\n"
+msgstr "Sicherheitsmodus aktiv! Automatisches Neuladen ist deaktiviert.\n"
+
+#: main.c:161 main.c:232
+msgid "Auto-reload is off.\n"
+msgstr "Automatisches Neuladen ist deaktiviert.\n"
+
+#: main.c:175
+msgid "Running in safe mode! Not running saved code.\n"
+msgstr "Sicherheitsmodus aktiv! Gespeicherter Code wird nicht ausgeführt\n"
+
+#: main.c:191
+msgid "WARNING: Your code filename has two extensions\n"
+msgstr "WARNUNG: Der Dateiname deines codes hat zwei Dateityperweiterungen\n"
+
+#: main.c:239
+msgid "You requested starting safe mode by "
+msgstr "Du hast das Starten im Sicherheitsmodus ausgelöst durch "
+
+#: main.c:242
+msgid "To exit, please reset the board without "
+msgstr "Zum beenden bitte resete das board ohne "
+
+#: main.c:249
+msgid ""
+"You are running in safe mode which means something really bad happened.\n"
+msgstr "Sicherheitsmodus aktive, etwas wirklich schlechtes ist passiert.\n"
+
+#: main.c:251
+msgid "Looks like our core CircuitPython code crashed hard. Whoops!\n"
+msgstr "CircuitPython ist abgestürzt. Ups!\n"
+
+#: main.c:252
+msgid "Please file an issue here with the contents of your CIRCUITPY drive:\n"
+msgstr "Bitte erstelle ein issue hier mit dem Inhalt deines CIRCUITPY-speichers:\n"
+
+#: main.c:255
+msgid ""
+"The microcontroller's power dipped. Please make sure your power supply "
+"provides\n"
+msgstr "Die Stromversorgung des Mikrocontrollers ist eingebrochen. Stelle sicher,"
+"dass deine Stromversorgung\n"
+
+#: main.c:256
+msgid ""
+"enough power for the whole circuit and press reset (after ejecting "
+"CIRCUITPY).\n"
+msgstr "genug Strom für den ganzen Schaltkreis liefert und drücke reset (nach dem"
+"sicheren Auswerfen von CIRCUITPY.)\n"
+
+#: main.c:260
+msgid "Press any key to enter the REPL. Use CTRL-D to reload."
+msgstr "Drücke eine Taste um dich mit der REPL zu verbinden. Drücke Strg-D zum neu"
+" laden"
+
+#: main.c:415
+msgid "soft reboot\n"
+msgstr "weicher reboot\n"
+
+#: ports/atmel-samd/audio_dma.c:285
+#: ports/atmel-samd/common-hal/audiobusio/PDMIn.c:361
+msgid "All sync event channels in use"
+msgstr "Alle sync event Kanäle werden benutzt"
+
+#: ports/atmel-samd/bindings/samd/Clock.c:135
+msgid "calibration is read only"
+msgstr "Kalibrierung ist Schreibgeschützt"
+
+#: ports/atmel-samd/bindings/samd/Clock.c:137
+msgid "calibration is out of range"
+msgstr "Kalibrierung ist außerhalb der Reichweite"
+
+#: ports/atmel-samd/board_busses.c:39
+msgid "No default I2C bus"
+msgstr "Kein Standard I2C Bus"
+
+#: ports/atmel-samd/board_busses.c:64
+msgid "No default SPI bus"
+msgstr "Kein Standard SPI Bus"
+
+#: ports/atmel-samd/board_busses.c:91
+msgid "No default UART bus"
+msgstr "Kein Standard UART Bus"
+
+#: ports/atmel-samd/common-hal/analogio/AnalogIn.c:63
+#: ports/nrf/common-hal/analogio/AnalogIn.c:39
+msgid "Pin does not have ADC capabilities"
+msgstr "Pin hat keine ADC Funktionalität"
+
+#: ports/atmel-samd/common-hal/analogio/AnalogOut.c:49
+msgid "No DAC on chip"
+msgstr "Kein DAC vorhanden"
+
+#: ports/atmel-samd/common-hal/analogio/AnalogOut.c:56
+msgid "AnalogOut not supported on given pin"
+msgstr "AnalogOut ist an diesem Pin nicht unterstützt"
+
+#: ports/atmel-samd/common-hal/audiobusio/I2SOut.c:147
+#: ports/atmel-samd/common-hal/audiobusio/I2SOut.c:150
+msgid "Invalid bit clock pin"
+msgstr "Ungülgites bit clock pin"
+
+#: ports/atmel-samd/common-hal/audiobusio/I2SOut.c:153
+msgid "Bit clock and word select must share a clock unit"
+msgstr "Bit clock und word select müssen eine clock unit teilen"
+
+#: ports/atmel-samd/common-hal/audiobusio/I2SOut.c:156
+#: ports/atmel-samd/common-hal/audiobusio/PDMIn.c:130
+msgid "Invalid data pin"
+msgstr "Ungültiger data pin"
+
+#: ports/atmel-samd/common-hal/audiobusio/I2SOut.c:169
+#: ports/atmel-samd/common-hal/audiobusio/I2SOut.c:174
+#: ports/atmel-samd/common-hal/audiobusio/PDMIn.c:145
+#: ports/atmel-samd/common-hal/audiobusio/PDMIn.c:150
+msgid "Serializer in use"
+msgstr "Serilaizer wird benutzt"
+
+#: ports/atmel-samd/common-hal/audiobusio/I2SOut.c:230
+msgid "Clock unit in use"
+msgstr "Clock unit wird benutzt"
+
+#: ports/atmel-samd/common-hal/audiobusio/I2SOut.c:240
+#: ports/atmel-samd/common-hal/audiobusio/PDMIn.c:172
+msgid "Unable to find free GCLK"
+msgstr "Konnte keinen freien GCLK finden"
+
+#: ports/atmel-samd/common-hal/audiobusio/I2SOut.c:254
+msgid "Too many channels in sample."
+msgstr "Zu viele Kanäle im sample"
+
+#: ports/atmel-samd/common-hal/audiobusio/I2SOut.c:305
+#: ports/atmel-samd/common-hal/audioio/AudioOut.c:326
+msgid "No DMA channel found"
+msgstr "Kein DMA Kanal gefunden"
+
+#: ports/atmel-samd/common-hal/audiobusio/I2SOut.c:308
+#: ports/atmel-samd/common-hal/audioio/AudioOut.c:328
+msgid "Unable to allocate buffers for signed conversion"
+msgstr "Konnte keine Buffer für Vorzeichenumwandlung allozieren"
+
+#: ports/atmel-samd/common-hal/audiobusio/PDMIn.c:109
+msgid "Invalid clock pin"
+msgstr "Ungültiger clock pin"
+
+#: ports/atmel-samd/common-hal/audiobusio/PDMIn.c:134
+msgid "Only 8 or 16 bit mono with "
+msgstr "Nur 8 oder 16 bit mono mit "
+
+#: ports/atmel-samd/common-hal/audiobusio/PDMIn.c:167
+msgid "sampling rate out of range"
+msgstr "Abtastrate außerhalb der Reichweite"
+
+#: ports/atmel-samd/common-hal/audioio/AudioOut.c:69
+msgid "DAC already in use"
+msgstr "DAC wird schon benutzt"
+
+#: ports/atmel-samd/common-hal/audioio/AudioOut.c:73
+msgid "Right channel unsupported"
+msgstr "Rechter Kanal wird nicht unterstützt"
+
+#: ports/atmel-samd/common-hal/audioio/AudioOut.c:76
+#: ports/atmel-samd/common-hal/pulseio/PWMOut.c:116
+#: ports/atmel-samd/common-hal/touchio/TouchIn.c:65
+msgid "Invalid pin"
+msgstr "Ungültiger Pin"
+
+#: ports/atmel-samd/common-hal/audioio/AudioOut.c:84
+msgid "Invalid pin for left channel"
+msgstr "Ungültiger Pin für linken Kanal"
+
+#: ports/atmel-samd/common-hal/audioio/AudioOut.c:88
+msgid "Invalid pin for right channel"
+msgstr "Ungültiger Pin für rechten Kanal"
+
+#: ports/atmel-samd/common-hal/audioio/AudioOut.c:91
+msgid "Cannot output both channels on the same pin"
+msgstr "Kann nicht beite Kanäle auf dem gleichen Pin ausgeben"
+
+#: ports/atmel-samd/common-hal/audioio/AudioOut.c:173
+#: ports/atmel-samd/common-hal/pulseio/PWMOut.c:186
+#: ports/atmel-samd/common-hal/pulseio/PulseOut.c:110
+msgid "All timers in use"
+msgstr "Alle timer werden benutzt"
+
+#: ports/atmel-samd/common-hal/audioio/AudioOut.c:215
+msgid "All event channels in use"
+msgstr "Alle event Kanälre werden benutzt"
+
+#: ports/atmel-samd/common-hal/busio/I2C.c:71
+msgid "Not enough pins available"
+msgstr "Nicht genug Pins vorhanden"
+
+#: ports/atmel-samd/common-hal/busio/I2C.c:78
+#: ports/atmel-samd/common-hal/busio/SPI.c:132
+#: ports/atmel-samd/common-hal/busio/UART.c:119
+#: ports/atmel-samd/common-hal/i2cslave/I2CSlave.c:45
+#: ports/nrf/common-hal/busio/I2C.c:58
+msgid "Invalid pins"
+msgstr "Ungültige Pins"
+
+#: ports/atmel-samd/common-hal/busio/I2C.c:101
+msgid "SDA or SCL needs a pull up"
+msgstr "SDA oder SCL brauchen pull up"
+
+#: ports/atmel-samd/common-hal/busio/I2C.c:121
+msgid "Unsupported baudrate"
+msgstr "Baudrate wird nicht unterstütz"
+
+#: ports/atmel-samd/common-hal/busio/UART.c:66
+msgid "bytes > 8 bits not supported"
+msgstr "bytes mit merh als 8 bits werden nicht unterstützt"
+
+#: ports/atmel-samd/common-hal/busio/UART.c:72
+msgid "tx and rx cannot both be None"
+msgstr "tx und rx können nicht beide None sein"
+
+#: ports/atmel-samd/common-hal/busio/UART.c:139
+msgid "Failed to allocate RX buffer"
+msgstr "Konnte keinen RX Buffer allozieren"
+
+#: ports/atmel-samd/common-hal/busio/UART.c:147
+msgid "Could not initialize UART"
+msgstr "Konnte UART nicht initialisieren"
+
+#: ports/atmel-samd/common-hal/busio/UART.c:234
+msgid "No RX pin"
+msgstr "Kein RX Pin"
+
+#: ports/atmel-samd/common-hal/busio/UART.c:284
+msgid "No TX pin"
+msgstr "Kein TX Pin"
+
+#: ports/atmel-samd/common-hal/digitalio/DigitalInOut.c:168
+#: ports/nrf/common-hal/digitalio/DigitalInOut.c:158
+msgid "Cannot get pull while in output mode"
+msgstr "Pull up im Ausgabemodus nicht möglich"
+
+#: ports/atmel-samd/common-hal/microcontroller/__init__.c:74
+#: ports/esp8266/common-hal/microcontroller/__init__.c:64
+msgid "Cannot reset into bootloader because no bootloader is present."
+msgstr "Reset zum bootloader nicht möglich da bootloader nicht vorhanden"
+
+#: ports/atmel-samd/common-hal/pulseio/PWMOut.c:120
+#: ports/atmel-samd/common-hal/pulseio/PWMOut.c:366
+#: ports/nrf/common-hal/pulseio/PWMOut.c:227
+msgid "Invalid PWM frequency"
+msgstr "Ungültige PWM Frequenz"
+
+#: ports/atmel-samd/common-hal/pulseio/PWMOut.c:184
+msgid "All timers for this pin are in use"
+msgstr "Alle timer für diesen Pin werden benutzt"
+
+#: ports/atmel-samd/common-hal/pulseio/PulseIn.c:110
+msgid "No hardware support on pin"
+msgstr "Keine Hardwareunterstützung an diesem Pin"
+
+#: ports/atmel-samd/common-hal/pulseio/PulseIn.c:113
+msgid "EXTINT channel already in use"
+msgstr "EXTINT Kanal wird benutzt"
+
+#: ports/atmel-samd/common-hal/pulseio/PulseIn.c:118
+#: ports/esp8266/common-hal/pulseio/PulseIn.c:86
+#, c-format
+msgid "Failed to allocate RX buffer of %d bytes"
+msgstr "Konnte keine RX Buffer mit %d allozieren"
+
+#: ports/atmel-samd/common-hal/pulseio/PulseIn.c:203
+#: ports/esp8266/common-hal/pulseio/PulseIn.c:151
+msgid "pop from an empty PulseIn"
+msgstr "pop von einem leeren PulseIn"
+
+#: ports/atmel-samd/common-hal/pulseio/PulseIn.c:235
+#: ports/esp8266/common-hal/pulseio/PulseIn.c:182 py/obj.c:420
+msgid "index out of range"
+msgstr "index außerhalb der Reichweite"
+
+#: ports/atmel-samd/common-hal/pulseio/PulseOut.c:178
+msgid "Another send is already active"
+msgstr "Ein anderer Sendevorgang ist schon aktiv"
+
+#: ports/atmel-samd/common-hal/rotaryio/IncrementalEncoder.c:38
+msgid "Both pins must support hardware interrupts"
+msgstr "Beide pins müssen Hardware Interrupts unterstützen"
+
+#: ports/atmel-samd/common-hal/rotaryio/IncrementalEncoder.c:46
+msgid "A hardware interrupt channel is already in use"
+msgstr "Ein Hardware Interrupt Kanal wird schon benutzt"
+
+#: ports/atmel-samd/common-hal/rtc/RTC.c:101
+msgid "calibration value out of range +/-127"
+msgstr "Kalibrierwert nicht im Bereich von +/-127"
+
+#: ports/atmel-samd/common-hal/storage/__init__.c:48
+msgid "Cannot remount '/' when USB is active."
+msgstr "Kann '/' nicht remounten when USB aktiv ist"
+
+#: ports/atmel-samd/common-hal/touchio/TouchIn.c:75
+msgid "No free GCLKs"
+msgstr "Keine freien GCLKs"
+
+#: ports/atmel-samd/common-hal/usb_hid/Device.c:78
+#: ports/nrf/common-hal/usb_hid/Device.c:45
+#, c-format
+msgid "Buffer incorrect size. Should be %d bytes."
+msgstr "Buffergröße falsch, sollte %d bytes sein."
+
+#: ports/atmel-samd/common-hal/usb_hid/Device.c:82
+#: ports/nrf/common-hal/usb_hid/Device.c:53
+msgid "USB Busy"
+msgstr "USB beschäftigt"
+
+#: ports/atmel-samd/common-hal/usb_hid/Device.c:82
+#: ports/nrf/common-hal/usb_hid/Device.c:59
+msgid "USB Error"
+msgstr "USB Fehler"
+
+#: ports/esp8266/common-hal/analogio/AnalogIn.c:43
+msgid "Pin %q does not have ADC capabilities"
+msgstr "Pin %q hat keine ADC Funktion"
+
+#: ports/esp8266/common-hal/analogio/AnalogOut.c:39
+msgid "No hardware support for analog out."
+msgstr "Keine Hardwareunterstützung für analog out"
+
+#: ports/esp8266/common-hal/busio/SPI.c:72
+msgid "Pins not valid for SPI"
+msgstr "Pins nicht gültig für SPI"
+
+#: ports/esp8266/common-hal/busio/UART.c:45
+msgid "Only tx supported on UART1 (GPIO2)."
+msgstr "UART1 (GPIO2) unterstützt nur tx"
+
+#: ports/esp8266/common-hal/busio/UART.c:67 ports/esp8266/machine_uart.c:108
+msgid "invalid data bits"
+msgstr "Ungültige Datenbits"
+
+#: ports/esp8266/common-hal/busio/UART.c:91 ports/esp8266/machine_uart.c:144
+msgid "invalid stop bits"
+msgstr "Ungültige Stopbits"
+
+#: ports/esp8266/common-hal/digitalio/DigitalInOut.c:200
+msgid "ESP8266 does not support pull down."
+msgstr "ESP8266 unterstützt pull down nicht"
+
+#: ports/esp8266/common-hal/digitalio/DigitalInOut.c:210
+msgid "GPIO16 does not support pull up."
+msgstr "GPIO16 unterstützt pull up nicht"
+
+#: ports/esp8266/common-hal/microcontroller/__init__.c:66
+msgid "ESP8226 does not support safe mode."
+msgstr "ESP8226 hat keinen Sicherheitsmodus"
+
+#: ports/esp8266/common-hal/pulseio/PWMOut.c:54
+#: ports/esp8266/common-hal/pulseio/PWMOut.c:113
+#, c-format
+msgid "Maximum PWM frequency is %dhz."
+msgstr "Maximale PWM Frequenz ist %dHz"
+
+#: ports/esp8266/common-hal/pulseio/PWMOut.c:57
+#: ports/esp8266/common-hal/pulseio/PWMOut.c:116
+msgid "Minimum PWM frequency is 1hz."
+msgstr "Minimale PWM Frequenz ist %dHz"
+
+#: ports/esp8266/common-hal/pulseio/PWMOut.c:68
+#, c-format
+msgid "Multiple PWM frequencies not supported. PWM already set to %dhz."
+msgstr ""
+
+#: ports/esp8266/common-hal/pulseio/PWMOut.c:77 ports/esp8266/machine_pwm.c:70
+#, c-format
+msgid "PWM not supported on pin %d"
+msgstr ""
+
+#: ports/esp8266/common-hal/pulseio/PulseIn.c:78
+msgid "No PulseIn support for %q"
+msgstr ""
+
+#: ports/esp8266/common-hal/storage/__init__.c:34
+msgid "Unable to remount filesystem"
+msgstr ""
+
+#: ports/esp8266/common-hal/storage/__init__.c:38
+msgid "Use esptool to erase flash and re-upload Python instead"
+msgstr ""
+
+#: ports/esp8266/esp_mphal.c:154
+msgid "C-level assert"
+msgstr ""
+
+#: ports/esp8266/machine_adc.c:57
+#, c-format
+msgid "not a valid ADC Channel: %d"
+msgstr ""
+
+#: ports/esp8266/machine_hspi.c:131 ports/esp8266/machine_hspi.c:137
+msgid "impossible baudrate"
+msgstr ""
+
+#: ports/esp8266/machine_pin.c:129
+msgid "expecting a pin"
+msgstr ""
+
+#: ports/esp8266/machine_pin.c:284
+msgid "Pin(16) doesn't support pull"
+msgstr ""
+
+#: ports/esp8266/machine_pin.c:323
+msgid "invalid pin"
+msgstr ""
+
+#: ports/esp8266/machine_pin.c:389
+msgid "pin does not have IRQ capabilities"
+msgstr ""
+
+#: ports/esp8266/machine_rtc.c:185
+msgid "buffer too long"
+msgstr ""
+
+#: ports/esp8266/machine_rtc.c:209 ports/esp8266/machine_rtc.c:223
+#: ports/esp8266/machine_rtc.c:246
+msgid "invalid alarm"
+msgstr ""
+
+#: ports/esp8266/machine_uart.c:169
+#, c-format
+msgid "UART(%d) does not exist"
+msgstr ""
+
+#: ports/esp8266/machine_uart.c:219
+msgid "UART(1) can't read"
+msgstr ""
+
+#: ports/esp8266/modesp.c:119
+msgid "len must be multiple of 4"
+msgstr ""
+
+#: ports/esp8266/modesp.c:274
+#, c-format
+msgid "memory allocation failed, allocating %u bytes for native code"
+msgstr ""
+
+#: ports/esp8266/modesp.c:317
+msgid "flash location must be below 1MByte"
+msgstr ""
+
+#: ports/esp8266/modmachine.c:63
+msgid "frequency can only be either 80Mhz or 160MHz"
+msgstr ""
+
+#: ports/esp8266/modnetwork.c:61
+msgid "STA required"
+msgstr ""
+
+#: ports/esp8266/modnetwork.c:61
+msgid "AP required"
+msgstr ""
+
+#: ports/esp8266/modnetwork.c:87
+msgid "Cannot update i/f status"
+msgstr ""
+
+#: ports/esp8266/modnetwork.c:142
+msgid "Cannot set STA config"
+msgstr ""
+
+#: ports/esp8266/modnetwork.c:144
+msgid "Cannot connect to AP"
+msgstr ""
+
+#: ports/esp8266/modnetwork.c:152
+msgid "Cannot disconnect from AP"
+msgstr ""
+
+#: ports/esp8266/modnetwork.c:173
+msgid "unknown status param"
+msgstr ""
+
+#: ports/esp8266/modnetwork.c:222
+msgid "STA must be active"
+msgstr ""
+
+#: ports/esp8266/modnetwork.c:239
+msgid "scan failed"
+msgstr ""
+
+#: ports/esp8266/modnetwork.c:306
+msgid "wifi_set_ip_info() failed"
+msgstr ""
+
+#: ports/esp8266/modnetwork.c:319
+msgid "either pos or kw args are allowed"
+msgstr ""
+
+#: ports/esp8266/modnetwork.c:329
+msgid "can't get STA config"
+msgstr ""
+
+#: ports/esp8266/modnetwork.c:331
+msgid "can't get AP config"
+msgstr ""
+
+#: ports/esp8266/modnetwork.c:346
+msgid "invalid buffer length"
+msgstr ""
+
+#: ports/esp8266/modnetwork.c:405
+msgid "can't set STA config"
+msgstr ""
+
+#: ports/esp8266/modnetwork.c:407
+msgid "can't set AP config"
+msgstr ""
+
+#: ports/esp8266/modnetwork.c:416
+msgid "can query only one param"
+msgstr ""
+
+#: ports/esp8266/modnetwork.c:469
+msgid "unknown config param"
+msgstr ""
+
+#: ports/nrf/common-hal/analogio/AnalogOut.c:37
+msgid "AnalogOut functionality not supported"
+msgstr ""
+
+#: ports/nrf/common-hal/busio/UART.c:45 ports/nrf/common-hal/busio/UART.c:49
+#: ports/nrf/common-hal/busio/UART.c:53 ports/nrf/common-hal/busio/UART.c:62
+#: ports/nrf/common-hal/busio/UART.c:68 ports/nrf/common-hal/busio/UART.c:73
+#: ports/nrf/common-hal/busio/UART.c:78 ports/nrf/common-hal/busio/UART.c:83
+#: ports/nrf/common-hal/busio/UART.c:88
+msgid "busio.UART not yet implemented"
+msgstr ""
+
+#: ports/nrf/common-hal/microcontroller/Processor.c:49
+#, c-format
+msgid "Can not get temperature. status: 0x%02x"
+msgstr ""
+
+#: ports/nrf/drivers/bluetooth/ble_drv.c:199
+msgid "Cannot apply GAP parameters."
+msgstr ""
+
+#: ports/nrf/drivers/bluetooth/ble_drv.c:213
+msgid "Cannot set PPCP parameters."
+msgstr ""
+
+#: ports/nrf/drivers/bluetooth/ble_drv.c:245
+msgid "Can not query for the device address."
+msgstr ""
+
+#: ports/nrf/drivers/bluetooth/ble_drv.c:264
+msgid "Can not add Vendor Specific 128-bit UUID."
+msgstr ""
+
+#: ports/nrf/drivers/bluetooth/ble_drv.c:284
+#: ports/nrf/drivers/bluetooth/ble_drv.c:298
+msgid "Can not add Service."
+msgstr ""
+
+#: ports/nrf/drivers/bluetooth/ble_drv.c:373
+msgid "Can not add Characteristic."
+msgstr ""
+
+#: ports/nrf/drivers/bluetooth/ble_drv.c:400
+msgid "Can not apply device name in the stack."
+msgstr ""
+
+#: ports/nrf/drivers/bluetooth/ble_drv.c:464
+#: ports/nrf/drivers/bluetooth/ble_drv.c:514
+msgid "Can not encode UUID, to check length."
+msgstr ""
+
+#: ports/nrf/drivers/bluetooth/ble_drv.c:470
+#: ports/nrf/drivers/bluetooth/ble_drv.c:520
+msgid "Can encode UUID into the advertisment packet."
+msgstr ""
+
+#: ports/nrf/drivers/bluetooth/ble_drv.c:545
+msgid "Can not fit data into the advertisment packet."
+msgstr ""
+
+#: ports/nrf/drivers/bluetooth/ble_drv.c:558
+#: ports/nrf/drivers/bluetooth/ble_drv.c:604
+#, c-format
+msgid "Can not apply advertisment data. status: 0x%02x"
+msgstr ""
+
+#: ports/nrf/drivers/bluetooth/ble_drv.c:614
+#, c-format
+msgid "Can not start advertisment. status: 0x%02x"
+msgstr ""
+
+#: ports/nrf/drivers/bluetooth/ble_drv.c:631
+#, c-format
+msgid "Can not stop advertisment. status: 0x%02x"
+msgstr ""
+
+#: ports/nrf/drivers/bluetooth/ble_drv.c:650
+#: ports/nrf/drivers/bluetooth/ble_drv.c:726
+#, c-format
+msgid "Can not read attribute value. status: 0x%02x"
+msgstr ""
+
+#: ports/nrf/drivers/bluetooth/ble_drv.c:667
+#: ports/nrf/drivers/bluetooth/ble_drv.c:756
+#, c-format
+msgid "Can not write attribute value. status: 0x%02x"
+msgstr ""
+
+#: ports/nrf/drivers/bluetooth/ble_drv.c:691
+#, c-format
+msgid "Can not notify attribute value. status: 0x%02x"
+msgstr ""
+
+#: ports/nrf/drivers/bluetooth/ble_drv.c:784
+#, c-format
+msgid "Can not start scanning. status: 0x%02x"
+msgstr ""
+
+#: ports/nrf/drivers/bluetooth/ble_drv.c:829
+#, c-format
+msgid "Can not connect. status: 0x%02x"
+msgstr ""
+
+#: ports/nrf/modules/ubluepy/ubluepy_characteristic.c:68
+#: ports/nrf/modules/ubluepy/ubluepy_service.c:80
+#: ports/nrf/modules/ubluepy/ubluepy_service.c:132
+#: ports/nrf/modules/ubluepy/ubluepy_uuid.c:137
+msgid "Invalid UUID parameter"
+msgstr ""
+
+#: ports/nrf/modules/ubluepy/ubluepy_service.c:73
+msgid "Invalid Service type"
+msgstr ""
+
+#: ports/nrf/modules/ubluepy/ubluepy_uuid.c:127
+msgid "Invalid UUID string length"
+msgstr ""
+
+#: ports/unix/modffi.c:138
+msgid "Unknown type"
+msgstr ""
+
+#: ports/unix/modffi.c:207 ports/unix/modffi.c:265
+msgid "Error in ffi_prep_cif"
+msgstr ""
+
+#: ports/unix/modffi.c:270
+msgid "ffi_prep_closure_loc"
+msgstr ""
+
+#: ports/unix/modffi.c:413
+msgid "Don't know how to pass object to native function"
+msgstr ""
+
+#: ports/unix/modusocket.c:474
+#, c-format
+msgid "[addrinfo error %d]"
+msgstr ""
+
+#: py/argcheck.c:44
+msgid "function does not take keyword arguments"
+msgstr ""
+
+#: py/argcheck.c:54 py/bc.c:85 py/objnamedtuple.c:104
+#, c-format
+msgid "function takes %d positional arguments but %d were given"
+msgstr ""
+
+#: py/argcheck.c:64
+#, c-format
+msgid "function missing %d required positional arguments"
+msgstr ""
+
+#: py/argcheck.c:72
+#, c-format
+msgid "function expected at most %d arguments, got %d"
+msgstr ""
+
+#: py/argcheck.c:97
+msgid "'%q' argument required"
+msgstr ""
+
+#: py/argcheck.c:122
+msgid "extra positional arguments given"
+msgstr ""
+
+#: py/argcheck.c:130
+msgid "extra keyword arguments given"
+msgstr ""
+
+#: py/argcheck.c:142
+msgid "argument num/types mismatch"
+msgstr ""
+
+#: py/argcheck.c:147
+msgid "keyword argument(s) not yet implemented - use normal args instead"
+msgstr ""
+
+#: py/bc.c:88 py/objnamedtuple.c:108
+msgid "%q() takes %d positional arguments but %d were given"
+msgstr ""
+
+#: py/bc.c:197 py/bc.c:215
+msgid "unexpected keyword argument"
+msgstr ""
+
+#: py/bc.c:199
+msgid "keywords must be strings"
+msgstr ""
+
+#: py/bc.c:206 py/objnamedtuple.c:138
+msgid "function got multiple values for argument '%q'"
+msgstr ""
+
+#: py/bc.c:218 py/objnamedtuple.c:130
+msgid "unexpected keyword argument '%q'"
+msgstr ""
+
+#: py/bc.c:244
+#, c-format
+msgid "function missing required positional argument #%d"
+msgstr ""
+
+#: py/bc.c:260
+msgid "function missing required keyword argument '%q'"
+msgstr ""
+
+#: py/bc.c:269
+msgid "function missing keyword-only argument"
+msgstr ""
+
+#: py/binary.c:112
+msgid "bad typecode"
+msgstr ""
+
+#: py/builtinevex.c:99
+msgid "bad compile mode"
+msgstr ""
+
+#: py/builtinimport.c:338
+msgid "cannot perform relative import"
+msgstr ""
+
+#: py/builtinimport.c:422 py/builtinimport.c:534
+msgid "module not found"
+msgstr ""
+
+#: py/builtinimport.c:425 py/builtinimport.c:537
+msgid "no module named '%q'"
+msgstr ""
+
+#: py/builtinimport.c:512
+msgid "relative import"
+msgstr ""
+
+#: py/compile.c:397 py/compile.c:542
+msgid "can't assign to expression"
+msgstr ""
+
+#: py/compile.c:416
+msgid "multiple *x in assignment"
+msgstr ""
+
+#: py/compile.c:642
+msgid "non-default argument follows default argument"
+msgstr ""
+
+#: py/compile.c:771 py/compile.c:789
+msgid "invalid micropython decorator"
+msgstr ""
+
+#: py/compile.c:943
+msgid "can't delete expression"
+msgstr ""
+
+#: py/compile.c:955
+msgid "'break' outside loop"
+msgstr ""
+
+#: py/compile.c:958
+msgid "'continue' outside loop"
+msgstr ""
+
+#: py/compile.c:969
+msgid "'return' outside function"
+msgstr ""
+
+#: py/compile.c:1169
+msgid "identifier redefined as global"
+msgstr ""
+
+#: py/compile.c:1185
+msgid "no binding for nonlocal found"
+msgstr ""
+
+#: py/compile.c:1188
+msgid "identifier redefined as nonlocal"
+msgstr ""
+
+#: py/compile.c:1197
+msgid "can't declare nonlocal in outer code"
+msgstr ""
+
+#: py/compile.c:1542
+msgid "default 'except' must be last"
+msgstr ""
+
+#: py/compile.c:2095
+msgid "*x must be assignment target"
+msgstr ""
+
+#: py/compile.c:2193
+msgid "super() can't find self"
+msgstr ""
+
+#: py/compile.c:2256
+msgid "can't have multiple *x"
+msgstr ""
+
+#: py/compile.c:2263
+msgid "can't have multiple **x"
+msgstr ""
+
+#: py/compile.c:2271
+msgid "LHS of keyword arg must be an id"
+msgstr ""
+
+#: py/compile.c:2287
+msgid "non-keyword arg after */**"
+msgstr ""
+
+#: py/compile.c:2291
+msgid "non-keyword arg after keyword arg"
+msgstr ""
+
+#: py/compile.c:2463 py/compile.c:2473 py/compile.c:2712 py/compile.c:2742
+#: py/parse.c:1176
+msgid "invalid syntax"
+msgstr ""
+
+#: py/compile.c:2465
+msgid "expecting key:value for dict"
+msgstr ""
+
+#: py/compile.c:2475
+msgid "expecting just a value for set"
+msgstr ""
+
+#: py/compile.c:2600
+msgid "'yield' outside function"
+msgstr ""
+
+#: py/compile.c:2619
+msgid "'await' outside function"
+msgstr ""
+
+#: py/compile.c:2774
+msgid "name reused for argument"
+msgstr ""
+
+#: py/compile.c:2827
+msgid "parameter annotation must be an identifier"
+msgstr ""
+
+#: py/compile.c:2969 py/compile.c:3137
+msgid "return annotation must be an identifier"
+msgstr ""
+
+#: py/compile.c:3097
+msgid "inline assembler must be a function"
+msgstr ""
+
+#: py/compile.c:3134
+msgid "unknown type"
+msgstr ""
+
+#: py/compile.c:3154
+msgid "expecting an assembler instruction"
+msgstr ""
+
+#: py/compile.c:3184
+msgid "'label' requires 1 argument"
+msgstr ""
+
+#: py/compile.c:3190
+msgid "label redefined"
+msgstr ""
+
+#: py/compile.c:3196
+msgid "'align' requires 1 argument"
+msgstr ""
+
+#: py/compile.c:3205
+msgid "'data' requires at least 2 arguments"
+msgstr ""
+
+#: py/compile.c:3212
+msgid "'data' requires integer arguments"
+msgstr ""
+
+#: py/emitinlinextensa.c:86
+msgid "can only have up to 4 parameters to Xtensa assembly"
+msgstr ""
+
+#: py/emitinlinextensa.c:91 py/emitinlinextensa.c:96
+msgid "parameters must be registers in sequence a2 to a5"
+msgstr ""
+
+#: py/emitinlinextensa.c:162
+#, c-format
+msgid "'%s' expects a register"
+msgstr ""
+
+#: py/emitinlinextensa.c:169
+#, c-format
+msgid "'%s' expects an integer"
+msgstr ""
+
+#: py/emitinlinextensa.c:174
+#, c-format
+msgid "'%s' integer %d is not within range %d..%d"
+msgstr ""
+
+#: py/emitinlinextensa.c:182
+#, c-format
+msgid "'%s' expects a label"
+msgstr ""
+
+#: py/emitinlinextensa.c:193
+msgid "label '%q' not defined"
+msgstr ""
+
+#: py/emitinlinextensa.c:327
+#, c-format
+msgid "unsupported Xtensa instruction '%s' with %d arguments"
+msgstr ""
+
+#: py/emitnative.c:183
+msgid "unknown type '%q'"
+msgstr ""
+
+#: py/emitnative.c:260
+msgid "Viper functions don't currently support more than 4 arguments"
+msgstr ""
+
+#: py/emitnative.c:742
+msgid "conversion to object"
+msgstr ""
+
+#: py/emitnative.c:921
+msgid "local '%q' used before type known"
+msgstr ""
+
+#: py/emitnative.c:1118 py/emitnative.c:1156
+msgid "can't load from '%q'"
+msgstr ""
+
+#: py/emitnative.c:1128
+msgid "can't load with '%q' index"
+msgstr ""
+
+#: py/emitnative.c:1188
+msgid "local '%q' has type '%q' but source is '%q'"
+msgstr ""
+
+#: py/emitnative.c:1289 py/emitnative.c:1379
+msgid "can't store '%q'"
+msgstr ""
+
+#: py/emitnative.c:1358 py/emitnative.c:1419
+msgid "can't store to '%q'"
+msgstr ""
+
+#: py/emitnative.c:1369
+msgid "can't store with '%q' index"
+msgstr ""
+
+#: py/emitnative.c:1540
+msgid "can't implicitly convert '%q' to 'bool'"
+msgstr ""
+
+#: py/emitnative.c:1774
+msgid "unary op %q not implemented"
+msgstr ""
+
+#: py/emitnative.c:1930
+msgid "binary op %q not implemented"
+msgstr ""
+
+#: py/emitnative.c:1951
+msgid "can't do binary op between '%q' and '%q'"
+msgstr ""
+
+#: py/emitnative.c:2126
+msgid "casting"
+msgstr ""
+
+#: py/emitnative.c:2173
+msgid "return expected '%q' but got '%q'"
+msgstr ""
+
+#: py/emitnative.c:2191
+msgid "must raise an object"
+msgstr ""
+
+#: py/emitnative.c:2201
+msgid "native yield"
+msgstr ""
+
+#: py/lexer.c:345
+msgid "unicode name escapes"
+msgstr ""
+
+#: py/modbuiltins.c:162
+msgid "chr() arg not in range(0x110000)"
+msgstr ""
+
+#: py/modbuiltins.c:171
+msgid "chr() arg not in range(256)"
+msgstr ""
+
+#: py/modbuiltins.c:285
+msgid "arg is an empty sequence"
+msgstr ""
+
+#: py/modbuiltins.c:350
+msgid "ord expects a character"
+msgstr ""
+
+#: py/modbuiltins.c:353
+#, c-format
+msgid "ord() expected a character, but string of length %d found"
+msgstr ""
+
+#: py/modbuiltins.c:363
+msgid "3-arg pow() not supported"
+msgstr ""
+
+#: py/modbuiltins.c:517
+msgid "must use keyword argument for key function"
+msgstr ""
+
+#: py/modmath.c:41 shared-bindings/math/__init__.c:53
+msgid "math domain error"
+msgstr ""
+
+#: py/modmath.c:196 py/objfloat.c:270 py/objint_longlong.c:222
+#: py/objint_mpz.c:230 py/runtime.c:619 shared-bindings/math/__init__.c:346
+msgid "division by zero"
+msgstr ""
+
+#: py/modmicropython.c:155
+msgid "schedule stack full"
+msgstr ""
+
+#: py/modstruct.c:145 py/modstruct.c:153 py/modstruct.c:234 py/modstruct.c:244
+#: shared-bindings/struct/__init__.c:103 shared-bindings/struct/__init__.c:145
+#: shared-module/struct/__init__.c:91 shared-module/struct/__init__.c:175
+msgid "buffer too small"
+msgstr ""
+
+#: py/modthread.c:240
+msgid "expecting a dict for keyword args"
+msgstr ""
+
+#: py/moduerrno.c:143 py/moduerrno.c:146
+msgid "Permission denied"
+msgstr ""
+
+#: py/moduerrno.c:144
+msgid "No such file/directory"
+msgstr ""
+
+#: py/moduerrno.c:145
+msgid "Input/output error"
+msgstr ""
+
+#: py/moduerrno.c:147
+msgid "File exists"
+msgstr ""
+
+#: py/moduerrno.c:148
+msgid "Unsupported operation"
+msgstr ""
+
+#: py/moduerrno.c:149
+msgid "Invalid argument"
+msgstr ""
+
+#: py/obj.c:90
+msgid "Traceback (most recent call last):\n"
+msgstr ""
+
+#: py/obj.c:94
+msgid " File \"%q\", line %d"
+msgstr ""
+
+#: py/obj.c:96
+msgid " File \"%q\""
+msgstr ""
+
+#: py/obj.c:100
+msgid ", in %q\n"
+msgstr ""
+
+#: py/obj.c:257
+msgid "can't convert to int"
+msgstr ""
+
+#: py/obj.c:260
+#, c-format
+msgid "can't convert %s to int"
+msgstr ""
+
+#: py/obj.c:320
+msgid "can't convert to float"
+msgstr ""
+
+#: py/obj.c:323
+#, c-format
+msgid "can't convert %s to float"
+msgstr ""
+
+#: py/obj.c:353
+msgid "can't convert to complex"
+msgstr ""
+
+#: py/obj.c:356
+#, c-format
+msgid "can't convert %s to complex"
+msgstr ""
+
+#: py/obj.c:371
+msgid "expected tuple/list"
+msgstr ""
+
+#: py/obj.c:374
+#, c-format
+msgid "object '%s' is not a tuple or list"
+msgstr ""
+
+#: py/obj.c:385
+msgid "tuple/list has wrong length"
+msgstr ""
+
+#: py/obj.c:387
+#, c-format
+msgid "requested length %d but object has length %d"
+msgstr ""
+
+#: py/obj.c:400
+msgid "indices must be integers"
+msgstr ""
+
+#: py/obj.c:403
+msgid "%q indices must be integers, not %s"
+msgstr ""
+
+#: py/obj.c:423
+msgid "%q index out of range"
+msgstr ""
+
+#: py/obj.c:455
+msgid "object has no len"
+msgstr ""
+
+#: py/obj.c:458
+#, c-format
+msgid "object of type '%s' has no len()"
+msgstr ""
+
+#: py/obj.c:496
+msgid "object does not support item deletion"
+msgstr ""
+
+#: py/obj.c:499
+#, c-format
+msgid "'%s' object does not support item deletion"
+msgstr ""
+
+#: py/obj.c:503
+msgid "object is not subscriptable"
+msgstr ""
+
+#: py/obj.c:506
+#, c-format
+msgid "'%s' object is not subscriptable"
+msgstr ""
+
+#: py/obj.c:510
+msgid "object does not support item assignment"
+msgstr ""
+
+#: py/obj.c:513
+#, c-format
+msgid "'%s' object does not support item assignment"
+msgstr ""
+
+#: py/obj.c:544
+msgid "object with buffer protocol required"
+msgstr ""
+
+#: py/objarray.c:413 py/objstr.c:427 py/objstrunicode.c:191 py/objtuple.c:187
+#: shared-bindings/nvm/ByteArray.c:85
+msgid "only slices with step=1 (aka None) are supported"
+msgstr ""
+
+#: py/objarray.c:426
+msgid "lhs and rhs should be compatible"
+msgstr ""
+
+#: py/objarray.c:444 shared-bindings/nvm/ByteArray.c:107
+msgid "array/bytes required on right side"
+msgstr ""
+
+#: py/objcomplex.c:203
+msgid "can't do truncated division of a complex number"
+msgstr ""
+
+#: py/objcomplex.c:209
+msgid "complex division by zero"
+msgstr ""
+
+#: py/objcomplex.c:237
+msgid "0.0 to a complex power"
+msgstr ""
+
+#: py/objdeque.c:107
+msgid "full"
+msgstr ""
+
+#: py/objdeque.c:127
+msgid "empty"
+msgstr ""
+
+#: py/objdict.c:314
+msgid "popitem(): dictionary is empty"
+msgstr ""
+
+#: py/objdict.c:357
+msgid "dict update sequence has wrong length"
+msgstr ""
+
+#: py/objfloat.c:308 py/parsenum.c:331
+msgid "complex values not supported"
+msgstr ""
+
+#: py/objgenerator.c:108
+msgid "can't send non-None value to a just-started generator"
+msgstr ""
+
+#: py/objgenerator.c:126
+msgid "generator already executing"
+msgstr ""
+
+#: py/objgenerator.c:229
+msgid "generator ignored GeneratorExit"
+msgstr ""
+
+#: py/objgenerator.c:251
+msgid "can't pend throw to just-started generator"
+msgstr ""
+
+#: py/objint.c:144
+msgid "can't convert inf to int"
+msgstr ""
+
+#: py/objint.c:146
+msgid "can't convert NaN to int"
+msgstr ""
+
+#: py/objint.c:163
+msgid "float too big"
+msgstr ""
+
+#: py/objint.c:328
+msgid "long int not supported in this build"
+msgstr ""
+
+#: py/objint.c:334 py/objint.c:340 py/objint.c:350 py/objint.c:358
+msgid "small int overflow"
+msgstr ""
+
+#: py/objint_longlong.c:189 py/objint_mpz.c:283 py/runtime.c:486
+msgid "negative power with no float support"
+msgstr ""
+
+#: py/objint_longlong.c:251
+msgid "ulonglong too large"
+msgstr ""
+
+#: py/objint_mpz.c:267 py/runtime.c:396 py/runtime.c:411
+msgid "negative shift count"
+msgstr ""
+
+#: py/objint_mpz.c:336
+msgid "pow() with 3 arguments requires integers"
+msgstr ""
+
+#: py/objint_mpz.c:347
+msgid "pow() 3rd argument cannot be 0"
+msgstr ""
+
+#: py/objint_mpz.c:415
+msgid "overflow converting long int to machine word"
+msgstr ""
+
+#: py/objlist.c:273
+msgid "pop from empty list"
+msgstr ""
+
+#: py/objnamedtuple.c:92
+msgid "can't set attribute"
+msgstr ""
+
+#: py/objobject.c:55
+msgid "__new__ arg must be a user-type"
+msgstr ""
+
+#: py/objrange.c:110
+msgid "zero step"
+msgstr ""
+
+#: py/objset.c:371
+msgid "pop from an empty set"
+msgstr ""
+
+#: py/objslice.c:66
+msgid "Length must be an int"
+msgstr ""
+
+#: py/objslice.c:71
+msgid "Length must be non-negative"
+msgstr ""
+
+#: py/objslice.c:86 py/sequence.c:57
+msgid "slice step cannot be zero"
+msgstr ""
+
+#: py/objslice.c:159
+msgid "Cannot subclass slice"
+msgstr ""
+
+#: py/objstr.c:261
+msgid "bytes value out of range"
+msgstr ""
+
+#: py/objstr.c:270
+msgid "wrong number of arguments"
+msgstr ""
+
+#: py/objstr.c:467
+msgid "join expects a list of str/bytes objects consistent with self object"
+msgstr ""
+
+#: py/objstr.c:542 py/objstr.c:647 py/objstr.c:1744
+msgid "empty separator"
+msgstr ""
+
+#: py/objstr.c:641
+msgid "rsplit(None,n)"
+msgstr ""
+
+#: py/objstr.c:713
+msgid "substring not found"
+msgstr ""
+
+#: py/objstr.c:770
+msgid "start/end indices"
+msgstr ""
+
+#: py/objstr.c:931
+msgid "bad format string"
+msgstr ""
+
+#: py/objstr.c:953
+msgid "single '}' encountered in format string"
+msgstr ""
+
+#: py/objstr.c:992
+msgid "bad conversion specifier"
+msgstr ""
+
+#: py/objstr.c:996
+msgid "end of format while looking for conversion specifier"
+msgstr ""
+
+#: py/objstr.c:998
+#, c-format
+msgid "unknown conversion specifier %c"
+msgstr ""
+
+#: py/objstr.c:1029
+msgid "unmatched '{' in format"
+msgstr ""
+
+#: py/objstr.c:1036
+msgid "expected ':' after format specifier"
+msgstr ""
+
+#: py/objstr.c:1050
+msgid ""
+"can't switch from automatic field numbering to manual field specification"
+msgstr ""
+
+#: py/objstr.c:1055 py/objstr.c:1083
+msgid "tuple index out of range"
+msgstr ""
+
+#: py/objstr.c:1071
+msgid "attributes not supported yet"
+msgstr ""
+
+#: py/objstr.c:1079
+msgid ""
+"can't switch from manual field specification to automatic field numbering"
+msgstr ""
+
+#: py/objstr.c:1171
+msgid "invalid format specifier"
+msgstr ""
+
+#: py/objstr.c:1192
+msgid "sign not allowed in string format specifier"
+msgstr ""
+
+#: py/objstr.c:1200
+msgid "sign not allowed with integer format specifier 'c'"
+msgstr ""
+
+#: py/objstr.c:1259
+#, c-format
+msgid "unknown format code '%c' for object of type '%s'"
+msgstr ""
+
+#: py/objstr.c:1331
+#, c-format
+msgid "unknown format code '%c' for object of type 'float'"
+msgstr ""
+
+#: py/objstr.c:1343
+msgid "'=' alignment not allowed in string format specifier"
+msgstr ""
+
+#: py/objstr.c:1367
+#, c-format
+msgid "unknown format code '%c' for object of type 'str'"
+msgstr ""
+
+#: py/objstr.c:1415
+msgid "format requires a dict"
+msgstr ""
+
+#: py/objstr.c:1424
+msgid "incomplete format key"
+msgstr ""
+
+#: py/objstr.c:1482
+msgid "incomplete format"
+msgstr ""
+
+#: py/objstr.c:1490
+msgid "not enough arguments for format string"
+msgstr ""
+
+#: py/objstr.c:1500
+#, c-format
+msgid "%%c requires int or char"
+msgstr ""
+
+#: py/objstr.c:1507
+msgid "integer required"
+msgstr ""
+
+#: py/objstr.c:1570
+#, c-format
+msgid "unsupported format character '%c' (0x%x) at index %d"
+msgstr ""
+
+#: py/objstr.c:1577
+msgid "not all arguments converted during string formatting"
+msgstr ""
+
+#: py/objstr.c:2102
+msgid "can't convert to str implicitly"
+msgstr ""
+
+#: py/objstr.c:2106
+msgid "can't convert '%q' object to %q implicitly"
+msgstr ""
+
+#: py/objstrunicode.c:134
+#, c-format
+msgid "string indices must be integers, not %s"
+msgstr ""
+
+#: py/objstrunicode.c:145 py/objstrunicode.c:164
+msgid "string index out of range"
+msgstr ""
+
+#: py/objtype.c:358
+msgid "__init__() should return None"
+msgstr ""
+
+#: py/objtype.c:360
+#, c-format
+msgid "__init__() should return None, not '%s'"
+msgstr ""
+
+#: py/objtype.c:623 py/objtype.c:1275 py/runtime.c:1065
+msgid "unreadable attribute"
+msgstr ""
+
+#: py/objtype.c:868 py/runtime.c:653
+msgid "object not callable"
+msgstr ""
+
+#: py/objtype.c:870 py/runtime.c:655
+#, c-format
+msgid "'%s' object is not callable"
+msgstr ""
+
+#: py/objtype.c:978
+msgid "type takes 1 or 3 arguments"
+msgstr ""
+
+#: py/objtype.c:989
+msgid "cannot create instance"
+msgstr ""
+
+#: py/objtype.c:991
+msgid "cannot create '%q' instances"
+msgstr ""
+
+#: py/objtype.c:1047
+msgid "can't add special method to already-subclassed class"
+msgstr ""
+
+#: py/objtype.c:1091 py/objtype.c:1097
+msgid "type is not an acceptable base type"
+msgstr ""
+
+#: py/objtype.c:1100
+msgid "type '%q' is not an acceptable base type"
+msgstr ""
+
+#: py/objtype.c:1137
+msgid "multiple inheritance not supported"
+msgstr ""
+
+#: py/objtype.c:1164
+msgid "multiple bases have instance lay-out conflict"
+msgstr ""
+
+#: py/objtype.c:1205
+msgid "first argument to super() must be type"
+msgstr ""
+
+#: py/objtype.c:1370
+msgid "issubclass() arg 2 must be a class or a tuple of classes"
+msgstr ""
+
+#: py/objtype.c:1384
+msgid "issubclass() arg 1 must be a class"
+msgstr ""
+
+#: py/parse.c:726
+msgid "constant must be an integer"
+msgstr ""
+
+#: py/parse.c:868
+msgid "Unable to init parser"
+msgstr ""
+
+#: py/parse.c:1170
+msgid "unexpected indent"
+msgstr ""
+
+#: py/parse.c:1173
+msgid "unindent does not match any outer indentation level"
+msgstr ""
+
+#: py/parsenum.c:60
+msgid "int() arg 2 must be >= 2 and <= 36"
+msgstr ""
+
+#: py/parsenum.c:151
+msgid "invalid syntax for integer"
+msgstr ""
+
+#: py/parsenum.c:155
+#, c-format
+msgid "invalid syntax for integer with base %d"
+msgstr ""
+
+#: py/parsenum.c:339
+msgid "invalid syntax for number"
+msgstr ""
+
+#: py/parsenum.c:342
+msgid "decimal numbers not supported"
+msgstr ""
+
+#: py/persistentcode.c:223
+msgid ""
+"Incompatible .mpy file. Please update all .mpy files. See http://adafru.it/"
+"mpy-update for more info."
+msgstr ""
+
+#: py/persistentcode.c:326
+msgid "can only save bytecode"
+msgstr ""
+
+#: py/runtime.c:206
+msgid "name not defined"
+msgstr ""
+
+#: py/runtime.c:209
+msgid "name '%q' is not defined"
+msgstr ""
+
+#: py/runtime.c:304 py/runtime.c:611
+msgid "unsupported type for operator"
+msgstr ""
+
+#: py/runtime.c:307
+msgid "unsupported type for %q: '%s'"
+msgstr ""
+
+#: py/runtime.c:614
+msgid "unsupported types for %q: '%s', '%s'"
+msgstr ""
+
+#: py/runtime.c:881 py/runtime.c:888 py/runtime.c:945
+msgid "wrong number of values to unpack"
+msgstr ""
+
+#: py/runtime.c:883 py/runtime.c:947
+#, c-format
+msgid "need more than %d values to unpack"
+msgstr ""
+
+#: py/runtime.c:890
+#, c-format
+msgid "too many values to unpack (expected %d)"
+msgstr ""
+
+#: py/runtime.c:984
+msgid "argument has wrong type"
+msgstr ""
+
+#: py/runtime.c:986
+msgid "argument should be a '%q' not a '%q'"
+msgstr ""
+
+#: py/runtime.c:1123 py/runtime.c:1197
+msgid "no such attribute"
+msgstr ""
+
+#: py/runtime.c:1128
+msgid "type object '%q' has no attribute '%q'"
+msgstr ""
+
+#: py/runtime.c:1132 py/runtime.c:1200
+msgid "'%s' object has no attribute '%q'"
+msgstr ""
+
+#: py/runtime.c:1238
+msgid "object not iterable"
+msgstr ""
+
+#: py/runtime.c:1241
+#, c-format
+msgid "'%s' object is not iterable"
+msgstr ""
+
+#: py/runtime.c:1260 py/runtime.c:1296
+msgid "object not an iterator"
+msgstr ""
+
+#: py/runtime.c:1262 py/runtime.c:1298
+#, c-format
+msgid "'%s' object is not an iterator"
+msgstr ""
+
+#: py/runtime.c:1401
+msgid "exceptions must derive from BaseException"
+msgstr ""
+
+#: py/runtime.c:1430
+msgid "cannot import name %q"
+msgstr ""
+
+#: py/runtime.c:1535
+msgid "memory allocation failed, heap is locked"
+msgstr ""
+
+#: py/runtime.c:1539
+#, c-format
+msgid "memory allocation failed, allocating %u bytes"
+msgstr ""
+
+#: py/runtime.c:1609
+msgid "maximum recursion depth exceeded"
+msgstr ""
+
+#: py/sequence.c:264
+msgid "object not in sequence"
+msgstr ""
+
+#: py/stream.c:96
+msgid "stream operation not supported"
+msgstr ""
+
+#: py/vm.c:255
+msgid "local variable referenced before assignment"
+msgstr ""
+
+#: py/vm.c:1142
+msgid "no active exception to reraise"
+msgstr ""
+
+#: py/vm.c:1284
+msgid "byte code not implemented"
+msgstr ""
+
+#: shared-bindings/_stage/Layer.c:71
+msgid "graphic must be 2048 bytes long"
+msgstr ""
+
+#: shared-bindings/_stage/Layer.c:77 shared-bindings/_stage/Text.c:75
+msgid "palette must be 32 bytes long"
+msgstr ""
+
+#: shared-bindings/_stage/Layer.c:84
+msgid "map buffer too small"
+msgstr ""
+
+#: shared-bindings/_stage/Text.c:69
+msgid "font must be 2048 bytes long"
+msgstr ""
+
+#: shared-bindings/_stage/Text.c:81
+msgid "chars buffer too small"
+msgstr ""
+
+#: shared-bindings/analogio/AnalogOut.c:118
+msgid "AnalogOut is only 16 bits. Value must be less than 65536."
+msgstr ""
+
+#: shared-bindings/audiobusio/I2SOut.c:225
+#: shared-bindings/audioio/AudioOut.c:223
+msgid "Not playing"
+msgstr ""
+
+#: shared-bindings/audiobusio/PDMIn.c:124
+msgid "Bit depth must be multiple of 8."
+msgstr ""
+
+#: shared-bindings/audiobusio/PDMIn.c:128
+msgid "Oversample must be multiple of 8."
+msgstr ""
+
+#: shared-bindings/audiobusio/PDMIn.c:136
+msgid "Microphone startup delay must be in range 0.0 to 1.0"
+msgstr ""
+
+#: shared-bindings/audiobusio/PDMIn.c:193
+msgid "destination_length must be an int >= 0"
+msgstr ""
+
+#: shared-bindings/audiobusio/PDMIn.c:199
+msgid "Cannot record to a file"
+msgstr ""
+
+#: shared-bindings/audiobusio/PDMIn.c:202
+msgid "Destination capacity is smaller than destination_length."
+msgstr ""
+
+#: shared-bindings/audiobusio/PDMIn.c:206
+msgid "destination buffer must be an array of type 'H' for bit_depth = 16"
+msgstr ""
+
+#: shared-bindings/audiobusio/PDMIn.c:208
+msgid ""
+"destination buffer must be a bytearray or array of type 'B' for bit_depth = 8"
+msgstr ""
+
+#: shared-bindings/audioio/RawSample.c:98
+msgid ""
+"sample_source buffer must be a bytearray or array of type 'h', 'H', 'b' or "
+"'B'"
+msgstr ""
+
+#: shared-bindings/audioio/RawSample.c:104
+msgid "buffer must be a bytes-like object"
+msgstr ""
+
+#: shared-bindings/audioio/WaveFile.c:78
+msgid "file must be a file opened in byte mode"
+msgstr ""
+
+#: shared-bindings/bitbangio/I2C.c:111 shared-bindings/bitbangio/SPI.c:121
+#: shared-bindings/busio/SPI.c:133
+msgid "Function requires lock"
+msgstr ""
+
+#: shared-bindings/bitbangio/I2C.c:195 shared-bindings/busio/I2C.c:210
+msgid "Buffer must be at least length 1"
+msgstr ""
+
+#: shared-bindings/bitbangio/SPI.c:151 shared-bindings/busio/SPI.c:168
+msgid "Invalid polarity"
+msgstr ""
+
+#: shared-bindings/bitbangio/SPI.c:155 shared-bindings/busio/SPI.c:172
+msgid "Invalid phase"
+msgstr ""
+
+#: shared-bindings/bitbangio/SPI.c:159 shared-bindings/busio/SPI.c:176
+msgid "Invalid number of bits"
+msgstr ""
+
+#: shared-bindings/bitbangio/SPI.c:284 shared-bindings/busio/SPI.c:341
+msgid "buffer slices must be of equal length"
+msgstr ""
+
+#: shared-bindings/busio/I2C.c:120
+msgid "Function requires lock."
+msgstr ""
+
+#: shared-bindings/busio/UART.c:98
+msgid "bits must be 7, 8 or 9"
+msgstr ""
+
+#: shared-bindings/busio/UART.c:110
+msgid "stop must be 1 or 2"
+msgstr ""
+
+#: shared-bindings/digitalio/DigitalInOut.c:211
+msgid "Invalid direction."
+msgstr ""
+
+#: shared-bindings/digitalio/DigitalInOut.c:240
+msgid "Cannot set value when direction is input."
+msgstr ""
+
+#: shared-bindings/digitalio/DigitalInOut.c:266
+#: shared-bindings/digitalio/DigitalInOut.c:281
+msgid "Drive mode not used when direction is input."
+msgstr ""
+
+#: shared-bindings/digitalio/DigitalInOut.c:314
+#: shared-bindings/digitalio/DigitalInOut.c:331
+msgid "Pull not used when direction is output."
+msgstr ""
+
+#: shared-bindings/digitalio/DigitalInOut.c:340
+msgid "Unsupported pull value."
+msgstr ""
+
+#: shared-bindings/gamepad/GamePad.c:100
+msgid "too many arguments"
+msgstr ""
+
+#: shared-bindings/gamepad/GamePad.c:104
+msgid "expected a DigitalInOut"
+msgstr ""
+
+#: shared-bindings/i2cslave/I2CSlave.c:98
+msgid "can't convert address to int"
+msgstr ""
+
+#: shared-bindings/i2cslave/I2CSlave.c:101
+msgid "address out of bounds"
+msgstr ""
+
+#: shared-bindings/i2cslave/I2CSlave.c:107
+msgid "addresses is empty"
+msgstr ""
+
+#: shared-bindings/microcontroller/Pin.c:89
+#: shared-bindings/neopixel_write/__init__.c:67
+#: shared-bindings/pulseio/PulseOut.c:75
+msgid "Expected a %q"
+msgstr ""
+
+#: shared-bindings/microcontroller/Pin.c:100
+msgid "%q in use"
+msgstr ""
+
+#: shared-bindings/microcontroller/__init__.c:126
+msgid "Invalid run mode."
+msgstr ""
+
+#: shared-bindings/multiterminal/__init__.c:68
+msgid "Stream missing readinto() or write() method."
+msgstr ""
+
+#: shared-bindings/nvm/ByteArray.c:99
+msgid "Slice and value different lengths."
+msgstr ""
+
+#: shared-bindings/nvm/ByteArray.c:104
+msgid "Array values should be single bytes."
+msgstr ""
+
+#: shared-bindings/nvm/ByteArray.c:111 shared-bindings/nvm/ByteArray.c:141
+msgid "Unable to write to nvm."
+msgstr ""
+
+#: shared-bindings/nvm/ByteArray.c:137
+msgid "Bytes must be between 0 and 255."
+msgstr ""
+
+#: shared-bindings/os/__init__.c:200
+msgid "No hardware random available"
+msgstr ""
+
+#: shared-bindings/pulseio/PWMOut.c:164
+msgid ""
+"PWM duty_cycle must be between 0 and 65535 inclusive (16 bit resolution)"
+msgstr ""
+
+#: shared-bindings/pulseio/PWMOut.c:195
+msgid ""
+"PWM frequency not writeable when variable_frequency is False on construction."
+msgstr ""
+
+#: shared-bindings/pulseio/PulseIn.c:275
+msgid "Cannot delete values"
+msgstr ""
+
+#: shared-bindings/pulseio/PulseIn.c:281
+msgid "Slices not supported"
+msgstr ""
+
+#: shared-bindings/pulseio/PulseIn.c:287
+msgid "index must be int"
+msgstr ""
+
+#: shared-bindings/pulseio/PulseIn.c:293
+msgid "Read-only"
+msgstr ""
+
+#: shared-bindings/pulseio/PulseOut.c:134
+msgid "Array must contain halfwords (type 'H')"
+msgstr ""
+
+#: shared-bindings/random/__init__.c:92 shared-bindings/random/__init__.c:100
+msgid "stop not reachable from start"
+msgstr ""
+
+#: shared-bindings/random/__init__.c:111
+msgid "step must be non-zero"
+msgstr ""
+
+#: shared-bindings/random/__init__.c:114
+msgid "invalid step"
+msgstr ""
+
+#: shared-bindings/random/__init__.c:146
+msgid "empty sequence"
+msgstr ""
+
+#: shared-bindings/rtc/RTC.c:40 shared-bindings/rtc/RTC.c:44
+#: shared-bindings/time/__init__.c:192
+msgid "RTC is not supported on this board"
+msgstr ""
+
+#: shared-bindings/rtc/RTC.c:52
+msgid "RTC calibration is not supported on this board"
+msgstr ""
+
+#: shared-bindings/storage/__init__.c:77
+msgid "filesystem must provide mount method"
+msgstr ""
+
+#: shared-bindings/supervisor/__init__.c:93
+msgid "Brightness must be between 0 and 255"
+msgstr ""
+
+#: shared-bindings/supervisor/__init__.c:119
+msgid "Stack size must be at least 256"
+msgstr ""
+
+#: shared-bindings/time/__init__.c:80
+msgid "sleep length must be non-negative"
+msgstr ""
+
+#: shared-bindings/time/__init__.c:90
+msgid "time.struct_time() takes exactly 1 argument"
+msgstr ""
+
+#: shared-bindings/time/__init__.c:93
+msgid "time.struct_time() takes a 9-sequence"
+msgstr ""
+
+#: shared-bindings/time/__init__.c:171 shared-bindings/time/__init__.c:252
+msgid "Tuple or struct_time argument required"
+msgstr ""
+
+#: shared-bindings/time/__init__.c:176 shared-bindings/time/__init__.c:257
+msgid "function takes exactly 9 arguments"
+msgstr ""
+
+#: shared-bindings/time/__init__.c:228 shared-bindings/time/__init__.c:261
+msgid "timestamp out of range for platform time_t"
+msgstr ""
+
+#: shared-bindings/touchio/TouchIn.c:173
+msgid "threshold must be in the range 0-65536"
+msgstr ""
+
+#: shared-bindings/util.c:38
+msgid ""
+"Object has been deinitialized and can no longer be used. Create a new object."
+msgstr ""
+
+#: shared-module/audioio/WaveFile.c:61
+msgid "Invalid wave file"
+msgstr ""
+
+#: shared-module/audioio/WaveFile.c:69
+msgid "Invalid format chunk size"
+msgstr ""
+
+#: shared-module/audioio/WaveFile.c:83
+msgid "Unsupported format"
+msgstr ""
+
+#: shared-module/audioio/WaveFile.c:99
+msgid "Data chunk must follow fmt chunk"
+msgstr ""
+
+#: shared-module/audioio/WaveFile.c:107
+msgid "Invalid file"
+msgstr ""
+
+#: shared-module/audioio/WaveFile.c:117
+msgid "Couldn't allocate first buffer"
+msgstr ""
+
+#: shared-module/audioio/WaveFile.c:123
+msgid "Couldn't allocate second buffer"
+msgstr ""
+
+#: shared-module/bitbangio/I2C.c:58
+msgid "Clock stretch too long"
+msgstr ""
+
+#: shared-module/bitbangio/SPI.c:45
+msgid "Clock pin init failed."
+msgstr ""
+
+#: shared-module/bitbangio/SPI.c:51
+msgid "MOSI pin init failed."
+msgstr ""
+
+#: shared-module/bitbangio/SPI.c:62
+msgid "MISO pin init failed."
+msgstr ""
+
+#: shared-module/bitbangio/SPI.c:122
+msgid "Cannot write without MOSI pin."
+msgstr ""
+
+#: shared-module/bitbangio/SPI.c:177
+msgid "Cannot read without MISO pin."
+msgstr ""
+
+#: shared-module/bitbangio/SPI.c:241
+msgid "Cannot transfer without MOSI and MISO pins."
+msgstr ""
+
+#: shared-module/struct/__init__.c:39
+msgid "'S' and 'O' are not supported format types"
+msgstr ""
+
+#: shared-module/struct/__init__.c:83
+msgid "too many arguments provided with the given format"
+msgstr ""
diff --git a/main.c b/main.c
index 61d10bc08..1cb73e58a 100755
--- a/main.c
+++ b/main.c
@@ -451,7 +451,7 @@ void NORETURN __fatal_error(const char *msg) {
#ifndef NDEBUG
void MP_WEAK __assert_func(const char *file, int line, const char *func, const char *expr) {
- printf("Assertion '%s' failed, at file %s:%d\n", expr, file, line);
+ mp_printf(&mp_plat_print, "Assertion '%s' failed, at file %s:%d\n", expr, file, line);
__fatal_error("Assertion failed");
}
#endif
diff --git a/ports/atmel-samd/boards/circuitplayground_express/board.c b/ports/atmel-samd/boards/circuitplayground_express/board.c
index 5c5e9f7fa..578963642 100644
--- a/ports/atmel-samd/boards/circuitplayground_express/board.c
+++ b/ports/atmel-samd/boards/circuitplayground_express/board.c
@@ -48,8 +48,8 @@ bool board_requests_safe_mode(void) {
gpio_set_pin_pull_mode(PIN_PA28, GPIO_PULL_DOWN);
bool safe_mode = gpio_get_pin_level(PIN_PA14) &&
gpio_get_pin_level(PIN_PA28);
- reset_pin(PIN_PA14);
- reset_pin(PIN_PA28);
+ reset_pin_number(PIN_PA14);
+ reset_pin_number(PIN_PA28);
return safe_mode;
}
diff --git a/ports/atmel-samd/boards/circuitplayground_express_crickit/board.c b/ports/atmel-samd/boards/circuitplayground_express_crickit/board.c
index 5c5e9f7fa..578963642 100644
--- a/ports/atmel-samd/boards/circuitplayground_express_crickit/board.c
+++ b/ports/atmel-samd/boards/circuitplayground_express_crickit/board.c
@@ -48,8 +48,8 @@ bool board_requests_safe_mode(void) {
gpio_set_pin_pull_mode(PIN_PA28, GPIO_PULL_DOWN);
bool safe_mode = gpio_get_pin_level(PIN_PA14) &&
gpio_get_pin_level(PIN_PA28);
- reset_pin(PIN_PA14);
- reset_pin(PIN_PA28);
+ reset_pin_number(PIN_PA14);
+ reset_pin_number(PIN_PA28);
return safe_mode;
}
diff --git a/ports/atmel-samd/boards/gemma_m0/pins.c b/ports/atmel-samd/boards/gemma_m0/pins.c
index 196e438e0..c9c7ea555 100644
--- a/ports/atmel-samd/boards/gemma_m0/pins.c
+++ b/ports/atmel-samd/boards/gemma_m0/pins.c
@@ -21,6 +21,7 @@ STATIC const mp_rom_map_elem_t board_global_dict_table[] = {
{ MP_ROM_QSTR(MP_QSTR_APA102_MOSI), MP_ROM_PTR(&pin_PA00) },
{ MP_ROM_QSTR(MP_QSTR_APA102_SCK), MP_ROM_PTR(&pin_PA01) },
+
{ 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) },
diff --git a/ports/atmel-samd/common-hal/analogio/AnalogIn.c b/ports/atmel-samd/common-hal/analogio/AnalogIn.c
index 65ff38362..fc11d5d19 100644
--- a/ports/atmel-samd/common-hal/analogio/AnalogIn.c
+++ b/ports/atmel-samd/common-hal/analogio/AnalogIn.c
@@ -80,7 +80,7 @@ void common_hal_analogio_analogin_deinit(analogio_analogin_obj_t *self) {
if (common_hal_analogio_analogin_deinited(self)) {
return;
}
- reset_pin(self->pin->number);
+ reset_pin_number(self->pin->number);
self->pin = mp_const_none;
}
diff --git a/ports/atmel-samd/common-hal/analogio/AnalogOut.c b/ports/atmel-samd/common-hal/analogio/AnalogOut.c
index 9be8c3936..2e42abdd4 100644
--- a/ports/atmel-samd/common-hal/analogio/AnalogOut.c
+++ b/ports/atmel-samd/common-hal/analogio/AnalogOut.c
@@ -113,7 +113,7 @@ void common_hal_analogio_analogout_deinit(analogio_analogout_obj_t *self) {
return;
}
dac_sync_disable_channel(&self->descriptor, self->channel);
- reset_pin(PIN_PA02);
+ reset_pin_number(PIN_PA02);
// Only deinit the DAC on the SAMD51 if both outputs are free.
#ifdef SAMD51
if (common_hal_mcu_pin_is_free(&pin_PA02) && common_hal_mcu_pin_is_free(&pin_PA05)) {
diff --git a/ports/atmel-samd/common-hal/audiobusio/I2SOut.c b/ports/atmel-samd/common-hal/audiobusio/I2SOut.c
index ab3091c3a..af84bb807 100644
--- a/ports/atmel-samd/common-hal/audiobusio/I2SOut.c
+++ b/ports/atmel-samd/common-hal/audiobusio/I2SOut.c
@@ -212,11 +212,11 @@ void common_hal_audiobusio_i2sout_deinit(audiobusio_i2sout_obj_t* self) {
return;
}
- reset_pin(self->bit_clock->number);
+ reset_pin_number(self->bit_clock->number);
self->bit_clock = mp_const_none;
- reset_pin(self->word_select->number);
+ reset_pin_number(self->word_select->number);
self->word_select = mp_const_none;
- reset_pin(self->data->number);
+ reset_pin_number(self->data->number);
self->data = mp_const_none;
}
diff --git a/ports/atmel-samd/common-hal/audiobusio/PDMIn.c b/ports/atmel-samd/common-hal/audiobusio/PDMIn.c
index 0adc3fb52..e38402ed9 100644
--- a/ports/atmel-samd/common-hal/audiobusio/PDMIn.c
+++ b/ports/atmel-samd/common-hal/audiobusio/PDMIn.c
@@ -235,8 +235,8 @@ void common_hal_audiobusio_pdmin_deinit(audiobusio_pdmin_obj_t* self) {
disconnect_gclk_from_peripheral(self->gclk, I2S_GCLK_ID_0 + self->clock_unit);
disable_clock_generator(self->gclk);
- reset_pin(self->clock_pin->number);
- reset_pin(self->data_pin->number);
+ reset_pin_number(self->clock_pin->number);
+ reset_pin_number(self->data_pin->number);
self->clock_pin = mp_const_none;
self->data_pin = mp_const_none;
}
diff --git a/ports/atmel-samd/common-hal/audioio/AudioOut.c b/ports/atmel-samd/common-hal/audioio/AudioOut.c
index 7df328a6a..269acabf9 100644
--- a/ports/atmel-samd/common-hal/audioio/AudioOut.c
+++ b/ports/atmel-samd/common-hal/audioio/AudioOut.c
@@ -248,10 +248,10 @@ void common_hal_audioio_audioout_deinit(audioio_audioout_obj_t* self) {
tc_set_enable(tc_insts[self->tc_index], false);
- reset_pin(self->left_channel->number);
+ reset_pin_number(self->left_channel->number);
self->left_channel = mp_const_none;
#ifdef SAMD51
- reset_pin(self->right_channel->number);
+ reset_pin_number(self->right_channel->number);
self->right_channel = mp_const_none;
#endif
}
diff --git a/ports/atmel-samd/common-hal/busio/I2C.c b/ports/atmel-samd/common-hal/busio/I2C.c
index c0643865d..dac15bcc1 100644
--- a/ports/atmel-samd/common-hal/busio/I2C.c
+++ b/ports/atmel-samd/common-hal/busio/I2C.c
@@ -96,8 +96,8 @@ void common_hal_busio_i2c_construct(busio_i2c_obj_t *self,
common_hal_mcu_delay_us(3);
if (!gpio_get_pin_level(sda->number) || !gpio_get_pin_level(scl->number)) {
- reset_pin(sda->number);
- reset_pin(scl->number);
+ reset_pin_number(sda->number);
+ reset_pin_number(scl->number);
mp_raise_RuntimeError(translate("SDA or SCL needs a pull up"));
}
gpio_set_pin_function(sda->number, sda_pinmux);
@@ -107,8 +107,8 @@ void common_hal_busio_i2c_construct(busio_i2c_obj_t *self,
samd_peripherals_sercom_clock_init(sercom, sercom_index);
if (i2c_m_sync_init(&self->i2c_desc, sercom) != ERR_NONE) {
- reset_pin(sda->number);
- reset_pin(scl->number);
+ reset_pin_number(sda->number);
+ reset_pin_number(scl->number);
mp_raise_OSError(MP_EIO);
}
@@ -116,8 +116,8 @@ void common_hal_busio_i2c_construct(busio_i2c_obj_t *self,
// Frequency must be set before the I2C device is enabled.
if (i2c_m_sync_set_baudrate(&self->i2c_desc, 0, frequency / 1000) != ERR_NONE) {
- reset_pin(sda->number);
- reset_pin(scl->number);
+ reset_pin_number(sda->number);
+ reset_pin_number(scl->number);
mp_raise_ValueError(translate("Unsupported baudrate"));
}
@@ -144,8 +144,8 @@ void common_hal_busio_i2c_deinit(busio_i2c_obj_t *self) {
i2c_m_sync_disable(&self->i2c_desc);
i2c_m_sync_deinit(&self->i2c_desc);
- reset_pin(self->sda_pin);
- reset_pin(self->scl_pin);
+ reset_pin_number(self->sda_pin);
+ reset_pin_number(self->scl_pin);
self->sda_pin = NO_PIN;
self->scl_pin = NO_PIN;
}
diff --git a/ports/atmel-samd/common-hal/busio/I2C.h b/ports/atmel-samd/common-hal/busio/I2C.h
index 366c6c469..6bec6e804 100644
--- a/ports/atmel-samd/common-hal/busio/I2C.h
+++ b/ports/atmel-samd/common-hal/busio/I2C.h
@@ -36,7 +36,7 @@
typedef struct {
mp_obj_base_t base;
struct i2c_m_sync_desc i2c_desc;
- volatile bool has_lock;
+ bool has_lock;
uint8_t scl_pin;
uint8_t sda_pin;
} busio_i2c_obj_t;
diff --git a/ports/atmel-samd/common-hal/busio/SPI.c b/ports/atmel-samd/common-hal/busio/SPI.c
index fd7f81cc2..a292f9e3d 100644
--- a/ports/atmel-samd/common-hal/busio/SPI.c
+++ b/ports/atmel-samd/common-hal/busio/SPI.c
@@ -196,9 +196,9 @@ void common_hal_busio_spi_deinit(busio_spi_obj_t *self) {
}
spi_m_sync_disable(&self->spi_desc);
spi_m_sync_deinit(&self->spi_desc);
- reset_pin(self->clock_pin);
- reset_pin(self->MOSI_pin);
- reset_pin(self->MISO_pin);
+ reset_pin_number(self->clock_pin);
+ reset_pin_number(self->MOSI_pin);
+ reset_pin_number(self->MISO_pin);
self->clock_pin = NO_PIN;
}
diff --git a/ports/atmel-samd/common-hal/busio/UART.c b/ports/atmel-samd/common-hal/busio/UART.c
index 1be245b4b..005f1897e 100644
--- a/ports/atmel-samd/common-hal/busio/UART.c
+++ b/ports/atmel-samd/common-hal/busio/UART.c
@@ -222,8 +222,8 @@ void common_hal_busio_uart_deinit(busio_uart_obj_t *self) {
struct usart_async_descriptor * const usart_desc_p = (struct usart_async_descriptor * const) &self->usart_desc;
usart_async_disable(usart_desc_p);
usart_async_deinit(usart_desc_p);
- reset_pin(self->rx_pin);
- reset_pin(self->tx_pin);
+ reset_pin_number(self->rx_pin);
+ reset_pin_number(self->tx_pin);
self->rx_pin = NO_PIN;
self->tx_pin = NO_PIN;
}
@@ -249,7 +249,7 @@ size_t common_hal_busio_uart_read(busio_uart_obj_t *self, uint8_t *data, size_t
uint64_t start_ticks = ticks_ms;
// Busy-wait until timeout or until we've read enough chars.
- while (ticks_ms - start_ticks < self->timeout_ms) {
+ while (ticks_ms - start_ticks <= self->timeout_ms) {
// Read as many chars as we can right now, up to len.
size_t num_read = io_read(io, data, len);
@@ -268,6 +268,10 @@ size_t common_hal_busio_uart_read(busio_uart_obj_t *self, uint8_t *data, size_t
#ifdef MICROPY_VM_HOOK_LOOP
MICROPY_VM_HOOK_LOOP
#endif
+ // If we are zero timeout, make sure we don't loop again (in the event
+ // we read in under 1ms)
+ if (self->timeout_ms == 0)
+ break;
}
if (total_read == 0) {
diff --git a/ports/atmel-samd/common-hal/digitalio/DigitalInOut.c b/ports/atmel-samd/common-hal/digitalio/DigitalInOut.c
index 7a48ef195..9537d6179 100644
--- a/ports/atmel-samd/common-hal/digitalio/DigitalInOut.c
+++ b/ports/atmel-samd/common-hal/digitalio/DigitalInOut.c
@@ -40,6 +40,8 @@ digitalinout_result_t common_hal_digitalio_digitalinout_construct(
digitalio_digitalinout_obj_t* self, const mcu_pin_obj_t* pin) {
claim_pin(pin);
self->pin = pin;
+ self->output = false;
+ self->open_drain = false;
// Must set pull after setting direction.
gpio_set_pin_direction(pin->number, GPIO_DIRECTION_IN);
@@ -55,7 +57,7 @@ void common_hal_digitalio_digitalinout_deinit(digitalio_digitalinout_obj_t* self
if (common_hal_digitalio_digitalinout_deinited(self)) {
return;
}
- reset_pin(self->pin->number);
+ reset_pin_number(self->pin->number);
self->pin = mp_const_none;
}
@@ -83,7 +85,7 @@ void common_hal_digitalio_digitalinout_switch_to_output(
digitalio_direction_t common_hal_digitalio_digitalinout_get_direction(
digitalio_digitalinout_obj_t* self) {
- return self->output? DIRECTION_OUTPUT : DIRECTION_INPUT;
+ return self->output ? DIRECTION_OUTPUT : DIRECTION_INPUT;
}
void common_hal_digitalio_digitalinout_set_value(
diff --git a/ports/atmel-samd/common-hal/i2cslave/I2CSlave.c b/ports/atmel-samd/common-hal/i2cslave/I2CSlave.c
index f0bbed3d7..79c1449e2 100644
--- a/ports/atmel-samd/common-hal/i2cslave/I2CSlave.c
+++ b/ports/atmel-samd/common-hal/i2cslave/I2CSlave.c
@@ -105,8 +105,8 @@ void common_hal_i2cslave_i2c_slave_deinit(i2cslave_i2c_slave_obj_t *self) {
self->sercom->I2CS.CTRLA.bit.ENABLE = 0;
- reset_pin(self->sda_pin);
- reset_pin(self->scl_pin);
+ reset_pin_number(self->sda_pin);
+ reset_pin_number(self->scl_pin);
self->sda_pin = NO_PIN;
self->scl_pin = NO_PIN;
}
diff --git a/ports/atmel-samd/common-hal/microcontroller/Pin.c b/ports/atmel-samd/common-hal/microcontroller/Pin.c
index fd063a04c..0f179a6c1 100644
--- a/ports/atmel-samd/common-hal/microcontroller/Pin.c
+++ b/ports/atmel-samd/common-hal/microcontroller/Pin.c
@@ -91,23 +91,23 @@ void reset_all_pins(void) {
#endif
}
-void reset_pin(uint8_t pin) {
- if (pin >= PORT_BITS) {
+void reset_pin_number(uint8_t pin_number) {
+ if (pin_number >= PORT_BITS) {
return;
}
#ifdef MICROPY_HW_NEOPIXEL
- if (pin == MICROPY_HW_NEOPIXEL->number) {
+ if (pin_number == MICROPY_HW_NEOPIXEL->number) {
neopixel_in_use = false;
rgb_led_status_init();
return;
}
#endif
#ifdef MICROPY_HW_APA102_MOSI
- if (pin == MICROPY_HW_APA102_MOSI->number ||
- pin == MICROPY_HW_APA102_SCK->number) {
- apa102_mosi_in_use = apa102_mosi_in_use && pin != MICROPY_HW_APA102_MOSI->number;
- apa102_sck_in_use = apa102_sck_in_use && pin != MICROPY_HW_APA102_SCK->number;
+ if (pin_number == MICROPY_HW_APA102_MOSI->number ||
+ pin_number == MICROPY_HW_APA102_SCK->number) {
+ apa102_mosi_in_use = apa102_mosi_in_use && pin_number != MICROPY_HW_APA102_MOSI->number;
+ apa102_sck_in_use = apa102_sck_in_use && pin_number != MICROPY_HW_APA102_SCK->number;
if (!apa102_sck_in_use && !apa102_mosi_in_use) {
rgb_led_status_init();
}
@@ -115,24 +115,24 @@ void reset_pin(uint8_t pin) {
}
#endif
- if (pin == PIN_PA30
+ if (pin_number == PIN_PA30
#ifdef SAMD51
) {
- gpio_set_pin_function(pin, GPIO_PIN_FUNCTION_H);
+ gpio_set_pin_function(pin_number, GPIO_PIN_FUNCTION_H);
#endif
#ifdef SAMD21
- || pin == PIN_PA31) {
- gpio_set_pin_function(pin, GPIO_PIN_FUNCTION_G);
+ || pin_number == PIN_PA31) {
+ gpio_set_pin_function(pin_number, GPIO_PIN_FUNCTION_G);
#endif
} else {
- gpio_set_pin_direction(pin, GPIO_DIRECTION_OFF);
- gpio_set_pin_function(pin, GPIO_PIN_FUNCTION_OFF);
+ gpio_set_pin_direction(pin_number, GPIO_DIRECTION_OFF);
+ gpio_set_pin_function(pin_number, GPIO_PIN_FUNCTION_OFF);
}
#ifdef SPEAKER_ENABLE_PIN
- if (pin == SPEAKER_ENABLE_PIN->number) {
+ if (pin_number == SPEAKER_ENABLE_PIN->number) {
speaker_enable_in_use = false;
- gpio_set_pin_function(pin, GPIO_PIN_FUNCTION_OFF);
+ gpio_set_pin_function(pin_number, GPIO_PIN_FUNCTION_OFF);
gpio_set_pin_direction(SPEAKER_ENABLE_PIN->number, GPIO_DIRECTION_OUT);
gpio_set_pin_level(SPEAKER_ENABLE_PIN->number, false);
}
diff --git a/ports/atmel-samd/common-hal/microcontroller/Pin.h b/ports/atmel-samd/common-hal/microcontroller/Pin.h
index 18e2d1237..dcd80997e 100644
--- a/ports/atmel-samd/common-hal/microcontroller/Pin.h
+++ b/ports/atmel-samd/common-hal/microcontroller/Pin.h
@@ -40,9 +40,9 @@ extern bool apa102_mosi_in_use;
#endif
void reset_all_pins(void);
-// reset_pin takes the pin number instead of the pointer so that objects don't
+// reset_pin_number takes the pin number instead of the pointer so that objects don't
// need to store a full pointer.
-void reset_pin(uint8_t pin);
+void reset_pin_number(uint8_t pin_number);
void claim_pin(const mcu_pin_obj_t* pin);
#endif // MICROPY_INCLUDED_ATMEL_SAMD_COMMON_HAL_MICROCONTROLLER_PIN_H
diff --git a/ports/atmel-samd/common-hal/pulseio/PWMOut.c b/ports/atmel-samd/common-hal/pulseio/PWMOut.c
index 4e1b61d78..a115a0b73 100644
--- a/ports/atmel-samd/common-hal/pulseio/PWMOut.c
+++ b/ports/atmel-samd/common-hal/pulseio/PWMOut.c
@@ -285,7 +285,7 @@ void common_hal_pulseio_pwmout_deinit(pulseio_pwmout_obj_t* self) {
}
}
}
- reset_pin(self->pin->number);
+ reset_pin_number(self->pin->number);
self->pin = mp_const_none;
}
diff --git a/ports/atmel-samd/common-hal/pulseio/PulseIn.c b/ports/atmel-samd/common-hal/pulseio/PulseIn.c
index 3313073c5..aaa69a6f8 100644
--- a/ports/atmel-samd/common-hal/pulseio/PulseIn.c
+++ b/ports/atmel-samd/common-hal/pulseio/PulseIn.c
@@ -139,6 +139,8 @@ void common_hal_pulseio_pulsein_construct(pulseio_pulsein_obj_t* self,
turn_on_cpu_interrupt(self->channel);
+ claim_pin(pin);
+
// Set config will enable the EIC.
pulsein_set_config(self, true);
}
@@ -152,7 +154,7 @@ void common_hal_pulseio_pulsein_deinit(pulseio_pulsein_obj_t* self) {
return;
}
turn_off_eic_channel(self->channel);
- reset_pin(self->pin);
+ reset_pin_number(self->pin);
self->pin = NO_PIN;
}
diff --git a/ports/atmel-samd/common-hal/rotaryio/IncrementalEncoder.c b/ports/atmel-samd/common-hal/rotaryio/IncrementalEncoder.c
index c1ceb410f..080cd61b5 100644
--- a/ports/atmel-samd/common-hal/rotaryio/IncrementalEncoder.c
+++ b/ports/atmel-samd/common-hal/rotaryio/IncrementalEncoder.c
@@ -73,6 +73,9 @@ void common_hal_rotaryio_incrementalencoder_construct(rotaryio_incrementalencode
((uint8_t) gpio_get_pin_level(self->pin_a) << 1) |
(uint8_t) gpio_get_pin_level(self->pin_b);
+ claim_pin(pin_a);
+ claim_pin(pin_b);
+
turn_on_eic_channel(self->eic_channel_a, EIC_CONFIG_SENSE0_BOTH_Val, EIC_HANDLER_INCREMENTAL_ENCODER);
turn_on_eic_channel(self->eic_channel_b, EIC_CONFIG_SENSE0_BOTH_Val, EIC_HANDLER_INCREMENTAL_ENCODER);
}
@@ -87,9 +90,9 @@ void common_hal_rotaryio_incrementalencoder_deinit(rotaryio_incrementalencoder_o
}
turn_off_eic_channel(self->eic_channel_a);
turn_off_eic_channel(self->eic_channel_b);
- reset_pin(self->pin_a);
+ reset_pin_number(self->pin_a);
self->pin_a = NO_PIN;
- reset_pin(self->pin_b);
+ reset_pin_number(self->pin_b);
self->pin_b = NO_PIN;
}
diff --git a/ports/atmel-samd/common-hal/touchio/TouchIn.c b/ports/atmel-samd/common-hal/touchio/TouchIn.c
index 7fa61d3dd..9fb3a2ea1 100644
--- a/ports/atmel-samd/common-hal/touchio/TouchIn.c
+++ b/ports/atmel-samd/common-hal/touchio/TouchIn.c
@@ -110,7 +110,7 @@ void common_hal_touchio_touchin_deinit(touchio_touchin_obj_t* self) {
}
// We leave the clocks running because they may be in use by others.
- reset_pin(self->config.pin);
+ reset_pin_number(self->config.pin);
self->config.pin = NO_PIN;
}
diff --git a/ports/atmel-samd/peripherals b/ports/atmel-samd/peripherals
-Subproject 156279784cb3d22f7f8a8d93b4bb55e2d912a5f
+Subproject b099a172dfb6345a8dac30633df4f6267489c38
diff --git a/ports/nrf/Makefile b/ports/nrf/Makefile
index f3cc0e35b..d3dc23262 100755
--- a/ports/nrf/Makefile
+++ b/ports/nrf/Makefile
@@ -24,9 +24,6 @@ ifneq ($(SD), )
include drivers/bluetooth/bluetooth_common.mk
endif
-# qstr definitions (must come before including py.mk)
-QSTR_DEFS = qstrdefsport.h $(BUILD)/pins_qstr.h
-
FROZEN_MPY_DIR = freeze
# include py core make definitions
@@ -53,6 +50,7 @@ INC += -I./nrfx/drivers/include
INC += -I../../lib/mp-readline
INC += -I./drivers/bluetooth
INC += -I./drivers
+INC += -I./peripherals
INC += -I../../lib/tinyusb/src
INC += -I./usb
@@ -97,28 +95,30 @@ SRC_NRFX = $(addprefix nrfx/,\
)
SRC_C += \
- mphalport.c \
- fatfs_port.c \
- tick.c \
background.c \
+ fatfs_port.c \
internal_flash.c \
- drivers/bluetooth/ble_drv.c \
- drivers/bluetooth/ble_uart.c \
+ mphalport.c \
+ tick.c \
boards/$(BOARD)/board.c \
- nrfx/mdk/system_$(MCU_SUB_VARIANT).c \
- nrfx/hal/nrf_nvmc.c \
+ boards/$(BOARD)/pins.c \
device/$(MCU_VARIANT)/startup_$(MCU_SUB_VARIANT).c \
+ drivers/bluetooth/ble_drv.c \
+ drivers/bluetooth/ble_uart.c \
+ lib/libc/string0.c \
+ lib/mp-readline/readline.c \
lib/oofatfs/ff.c \
lib/oofatfs/option/ccsbcs.c \
lib/timeutils/timeutils.c \
lib/utils/buffer_helper.c \
lib/utils/context_manager_helpers.c \
- lib/utils/pyexec.c \
lib/utils/interrupt_char.c \
+ lib/utils/pyexec.c \
lib/utils/stdout_helpers.c \
lib/utils/sys_stdio_mphal.c \
- lib/libc/string0.c \
- lib/mp-readline/readline.c \
+ nrfx/hal/nrf_nvmc.c \
+ nrfx/mdk/system_$(MCU_SUB_VARIANT).c \
+ peripherals/nrf/$(MCU_CHIP)/pins.c \
supervisor/shared/memory.c
DRIVERS_SRC_C += $(addprefix modules/,\
@@ -135,28 +135,29 @@ DRIVERS_SRC_C += $(addprefix modules/,\
)
SRC_COMMON_HAL += \
- board/__init__.c \
- digitalio/__init__.c \
- digitalio/DigitalInOut.c \
- microcontroller/__init__.c \
- microcontroller/Pin.c \
- microcontroller/Processor.c \
- os/__init__.c \
- time/__init__.c \
- analogio/__init__.c \
analogio/AnalogIn.c \
analogio/AnalogOut.c \
- busio/__init__.c\
+ analogio/__init__.c \
+ board/__init__.c \
busio/I2C.c \
busio/SPI.c \
busio/UART.c \
- pulseio/__init__.c \
+ busio/__init__.c\
+ digitalio/DigitalInOut.c \
+ digitalio/__init__.c \
+ microcontroller/Pin.c \
+ microcontroller/Processor.c \
+ microcontroller/__init__.c \
+ neopixel_write/__init__.c \
+ os/__init__.c \
+ pulseio/PWMOut.c \
pulseio/PulseIn.c \
pulseio/PulseOut.c \
- pulseio/PWMOut.c \
+ pulseio/__init__.c \
storage/__init__.c \
- supervisor/__init__.c \
supervisor/Runtime.c \
+ supervisor/__init__.c \
+ time/__init__.c \
ifneq ($(SD), )
SRC_COMMON_HAL += \
@@ -238,7 +239,6 @@ FROZEN_MPY_PY_FILES := $(shell find -L $(FROZEN_MPY_DIR) -type f -name '*.py')
FROZEN_MPY_MPY_FILES := $(addprefix $(BUILD)/,$(FROZEN_MPY_PY_FILES:.py=.mpy))
OBJ += $(PY_O) $(SUPERVISOR_O) $(addprefix $(BUILD)/, $(SRC_C:.c=.o))
-OBJ += $(BUILD)/pins_gen.o
OBJ += $(addprefix $(BUILD)/, $(SRC_NRFX:.c=.o))
OBJ += $(addprefix $(BUILD)/, $(DRIVERS_SRC_C:.c=.o))
OBJ += $(addprefix $(BUILD)/, $(SRC_COMMON_HAL_EXPANDED:.c=.o))
@@ -333,7 +333,7 @@ dfu-flash: $(BUILD)/dfu-package.zip
$(NRFUTIL) --verbose dfu serial --package $^ -p $(SERIAL) -b 115200 --singlebank $(DFU_TOUCH)
## Create DFU package file
-dfu-gen: $(BUILD)/dfu-package.zip
+dfu-gen: $(BUILD)/dfu-package.zip
$(BUILD)/dfu-package.zip: $(BUILD)/$(OUTPUT_FILENAME).hex
$(NRFUTIL) dfu genpkg --sd-req 0xFFFE --dev-type 0x0052 --application $^ $(BUILD)/dfu-package.zip
@@ -350,29 +350,8 @@ SRC_QSTR += $(SRC_C) $(SRC_SUPERVISOR) $(SRC_MOD) $(DRIVERS_SRC_C) $(SRC_COMMON_
# SRC_QSTR
SRC_QSTR_AUTO_DEPS +=
-# Making OBJ use an order-only depenedency on the generated pins.h file
-# has the side effect of making the pins.h file before we actually compile
-# any of the objects. The normal dependency generation will deal with the
-# case when pins.h is modified. But when it doesn't exist, we don't know
-# which source files might need it.
-$(OBJ): | $(HEADER_BUILD)/pins.h
-
-# Use a pattern rule here so that make will only call make-pins.py once to make
-# both pins_g.c and pins.h
-$(BUILD)/%_gen.c $(HEADER_BUILD)/%.h $(BUILD)/%_qstr.h: boards/$(BOARD)/%.csv $(MAKE_PINS) $(AF_FILE) $(PREFIX_FILE) | $(HEADER_BUILD)
- $(ECHO) "Create $@"
- $(Q)$(PYTHON) $(MAKE_PINS) --board $(BOARD_PINS) --af $(AF_FILE) --prefix $(PREFIX_FILE) --hdr $(GEN_PINS_HDR) --qstr $(GEN_PINS_QSTR) > $(GEN_PINS_SRC)
-
-$(BUILD)/pins_gen.o: $(BUILD)/pins_gen.c
- $(call compile_c)
-
-MAKE_PINS = boards/make-pins.py
-BOARD_PINS = boards/$(BOARD)/pins.csv
AF_FILE = $(MCU_VARIANT)_af.csv
PREFIX_FILE = boards/$(MCU_VARIANT)_prefix.c
-GEN_PINS_SRC = $(BUILD)/pins_gen.c
-GEN_PINS_HDR = $(HEADER_BUILD)/pins.h
-GEN_PINS_QSTR = $(BUILD)/pins_qstr.h
ifneq ($(FROZEN_DIR),)
# To use frozen source modules, put your .py files in a subdirectory (eg scripts/)
diff --git a/ports/nrf/board_busses.c b/ports/nrf/board_busses.c
new file mode 100644
index 000000000..91f0def6d
--- /dev/null
+++ b/ports/nrf/board_busses.c
@@ -0,0 +1,114 @@
+/*
+ * This file is part of the MicroPython project, http://micropython.org/
+ *
+ * The MIT License (MIT)
+ *
+ * Copyright (c) 2018 Scott Shawcroft for Adafruit Industries
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a copy
+ * of this software and associated documentation files (the "Software"), to deal
+ * in the Software without restriction, including without limitation the rights
+ * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+ * copies of the Software, and to permit persons to whom the Software is
+ * furnished to do so, subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice shall be included in
+ * all copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+ * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+ * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+ * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
+ * THE SOFTWARE.
+ */
+
+#include "shared-bindings/busio/I2C.h"
+#include "shared-bindings/busio/SPI.h"
+#include "shared-bindings/busio/UART.h"
+
+#include "shared-bindings/microcontroller/Pin.h"
+#include "supervisor/shared/translate.h"
+#include "mpconfigboard.h"
+#include "nrf/pins.h"
+#include "py/runtime.h"
+
+#if !defined(DEFAULT_I2C_BUS_SDA) || !defined(DEFAULT_I2C_BUS_SCL)
+ STATIC mp_obj_t board_i2c(void) {
+ mp_raise_NotImplementedError(translate("No default I2C bus"));
+ return NULL;
+ }
+#else
+ STATIC mp_obj_t i2c_singleton = NULL;
+
+ STATIC mp_obj_t board_i2c(void) {
+
+ if (i2c_singleton == NULL) {
+ busio_i2c_obj_t *self = m_new_obj(busio_i2c_obj_t);
+ self->base.type = &busio_i2c_type;
+
+ assert_pin_free(DEFAULT_I2C_BUS_SDA);
+ assert_pin_free(DEFAULT_I2C_BUS_SCL);
+ common_hal_busio_i2c_construct(self, DEFAULT_I2C_BUS_SCL, DEFAULT_I2C_BUS_SDA, 400000, 0);
+ i2c_singleton = (mp_obj_t)self;
+ }
+ return i2c_singleton;
+
+ }
+#endif
+MP_DEFINE_CONST_FUN_OBJ_0(board_i2c_obj, board_i2c);
+
+#if !defined(DEFAULT_SPI_BUS_SCK) || !defined(DEFAULT_SPI_BUS_MISO) || !defined(DEFAULT_SPI_BUS_MOSI)
+ STATIC mp_obj_t board_spi(void) {
+ mp_raise_NotImplementedError(translate("No default SPI bus"));
+ return NULL;
+ }
+#else
+ STATIC mp_obj_t spi_singleton = NULL;
+
+ STATIC mp_obj_t board_spi(void) {
+
+ if (spi_singleton == NULL) {
+ busio_spi_obj_t *self = m_new_obj(busio_spi_obj_t);
+ self->base.type = &busio_spi_type;
+ assert_pin_free(DEFAULT_SPI_BUS_SCK);
+ assert_pin_free(DEFAULT_SPI_BUS_MOSI);
+ assert_pin_free(DEFAULT_SPI_BUS_MISO);
+ const mcu_pin_obj_t* clock = MP_OBJ_TO_PTR(DEFAULT_SPI_BUS_SCK);
+ const mcu_pin_obj_t* mosi = MP_OBJ_TO_PTR(DEFAULT_SPI_BUS_MOSI);
+ const mcu_pin_obj_t* miso = MP_OBJ_TO_PTR(DEFAULT_SPI_BUS_MISO);
+ common_hal_busio_spi_construct(self, clock, mosi, miso);
+ spi_singleton = (mp_obj_t)self;
+ }
+ return spi_singleton;
+ }
+#endif
+MP_DEFINE_CONST_FUN_OBJ_0(board_spi_obj, board_spi);
+
+#if !defined(DEFAULT_UART_BUS_RX) || !defined(DEFAULT_UART_BUS_TX)
+ STATIC mp_obj_t board_uart(void) {
+ mp_raise_NotImplementedError(translate("No default UART bus"));
+ return NULL;
+ }
+#else
+ STATIC mp_obj_t uart_singleton = NULL;
+
+ STATIC mp_obj_t board_uart(void) {
+ if (uart_singleton == NULL) {
+ busio_uart_obj_t *self = m_new_obj(busio_uart_obj_t);
+ self->base.type = &busio_uart_type;
+
+ assert_pin_free(DEFAULT_UART_BUS_RX);
+ assert_pin_free(DEFAULT_UART_BUS_TX);
+
+ const mcu_pin_obj_t* rx = MP_OBJ_TO_PTR(DEFAULT_UART_BUS_RX);
+ const mcu_pin_obj_t* tx = MP_OBJ_TO_PTR(DEFAULT_UART_BUS_TX);
+
+ common_hal_busio_uart_construct(self, tx, rx, 9600, 8, PARITY_NONE, 1, 1000, 64);
+ uart_singleton = (mp_obj_t)self;
+ }
+ return uart_singleton;
+ }
+#endif
+MP_DEFINE_CONST_FUN_OBJ_0(board_uart_obj, board_uart);
diff --git a/ports/nrf/board_busses.h b/ports/nrf/board_busses.h
new file mode 100644
index 000000000..2a4bfc3d4
--- /dev/null
+++ b/ports/nrf/board_busses.h
@@ -0,0 +1,39 @@
+/*
+ * This file is part of the MicroPython project, http://micropython.org/
+ *
+ * The MIT License (MIT)
+ *
+ * Copyright (c) 2018 Scott Shawcroft for Adafruit Industries
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a copy
+ * of this software and associated documentation files (the "Software"), to deal
+ * in the Software without restriction, including without limitation the rights
+ * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+ * copies of the Software, and to permit persons to whom the Software is
+ * furnished to do so, subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice shall be included in
+ * all copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+ * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+ * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+ * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
+ * THE SOFTWARE.
+ */
+
+#ifndef MICROPY_INCLUDED_NRF_BOARD_BUSSES_H
+#define MICROPY_INCLUDED_NRF_BOARD_BUSSES_H
+
+void board_i2c(void);
+extern mp_obj_fun_builtin_fixed_t board_i2c_obj;
+
+void board_spi(void);
+extern mp_obj_fun_builtin_fixed_t board_spi_obj;
+
+void board_uart(void);
+extern mp_obj_fun_builtin_fixed_t board_uart_obj;
+
+#endif // MICROPY_INCLUDED_NRF_BOARD_BUSSES_H
diff --git a/ports/nrf/boards/feather_nrf52832/board.c b/ports/nrf/boards/feather_nrf52832/board.c
index e0b77437b..dde63b553 100644
--- a/ports/nrf/boards/feather_nrf52832/board.c
+++ b/ports/nrf/boards/feather_nrf52832/board.c
@@ -52,8 +52,8 @@ bool board_requests_safe_mode(void) {
// gpio_set_pin_pull_mode(PIN_PA28, GPIO_PULL_DOWN);
// bool safe_mode = gpio_get_pin_level(PIN_PA14) &&
// gpio_get_pin_level(PIN_PA28);
-// reset_pin(PIN_PA14);
-// reset_pin(PIN_PA28);
+// reset_pin_number(PIN_PA14);
+// reset_pin_number(PIN_PA28);
// return safe_mode;
return false;
diff --git a/ports/nrf/boards/feather_nrf52832/mpconfigboard.h b/ports/nrf/boards/feather_nrf52832/mpconfigboard.h
index 84afc5e2d..0da1abfc4 100644
--- a/ports/nrf/boards/feather_nrf52832/mpconfigboard.h
+++ b/ports/nrf/boards/feather_nrf52832/mpconfigboard.h
@@ -34,3 +34,13 @@
#define PORT_HEAP_SIZE (32 * 1024)
#define CIRCUITPY_AUTORELOAD_DELAY_MS 500
+
+#define DEFAULT_I2C_BUS_SCL (&pin_P0_26)
+#define DEFAULT_I2C_BUS_SDA (&pin_P0_25)
+
+#define DEFAULT_SPI_BUS_SCK (&pin_P0_12)
+#define DEFAULT_SPI_BUS_MOSI (&pin_P0_13)
+#define DEFAULT_SPI_BUS_MISO (&pin_P0_14)
+
+#define DEFAULT_UART_BUS_RX (&pin_P0_08)
+#define DEFAULT_UART_BUS_TX (&pin_P0_06)
diff --git a/ports/nrf/boards/feather_nrf52832/mpconfigboard.mk b/ports/nrf/boards/feather_nrf52832/mpconfigboard.mk
index c370b724e..5b1f6e939 100644
--- a/ports/nrf/boards/feather_nrf52832/mpconfigboard.mk
+++ b/ports/nrf/boards/feather_nrf52832/mpconfigboard.mk
@@ -1,6 +1,8 @@
MCU_SERIES = m4
MCU_VARIANT = nrf52
+# Historical: nrf52 means nrf52832
MCU_SUB_VARIANT = nrf52
+MCU_CHIP = nrf52832
SD ?= s132
SOFTDEV_VERSION ?= 2.0.1
@@ -8,4 +10,4 @@ LD_FILE = boards/feather_nrf52832/custom_nrf52832_dfu_app_$(SOFTDEV_VERSION).ld
BOOT_FILE = boards/feather_nrf52832/bootloader/feather52_bootloader_$(SOFTDEV_VERSION)_s132_single
BOOT_SETTING_ADDR = 0x7F000
-NRF_DEFINES += -DNRF52832_XXAA
+NRF_DEFINES += -DNRF52832_XXAA -DNRF52832
diff --git a/ports/nrf/boards/feather_nrf52832/pins.c b/ports/nrf/boards/feather_nrf52832/pins.c
new file mode 100644
index 000000000..f4d5023e1
--- /dev/null
+++ b/ports/nrf/boards/feather_nrf52832/pins.c
@@ -0,0 +1,46 @@
+#include "shared-bindings/board/__init__.h"
+
+#include "board_busses.h"
+
+STATIC const mp_rom_map_elem_t board_module_globals_table[] = {
+ { 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_SCK), MP_ROM_PTR(&pin_P0_12) },
+ { MP_ROM_QSTR(MP_QSTR_MOSI), MP_ROM_PTR(&pin_P0_13) },
+ { MP_ROM_QSTR(MP_QSTR_MISO), MP_ROM_PTR(&pin_P0_14) },
+
+ { 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_DFU), MP_ROM_PTR(&pin_P0_20) },
+
+ { MP_ROM_QSTR(MP_QSTR_NFC1), MP_ROM_PTR(&pin_P0_09) },
+ { MP_ROM_QSTR(MP_QSTR_NFC2), MP_ROM_PTR(&pin_P0_10) },
+
+ { MP_ROM_QSTR(MP_QSTR_D27), MP_ROM_PTR(&pin_P0_27) },
+
+ { MP_ROM_QSTR(MP_QSTR_D30), MP_ROM_PTR(&pin_P0_30) },
+ { MP_ROM_QSTR(MP_QSTR_A6), MP_ROM_PTR(&pin_P0_30) },
+
+ { MP_ROM_QSTR(MP_QSTR_D31), MP_ROM_PTR(&pin_P0_31) },
+ { MP_ROM_QSTR(MP_QSTR_A7), MP_ROM_PTR(&pin_P0_31) },
+
+ { MP_ROM_QSTR(MP_QSTR_D7), MP_ROM_PTR(&pin_P0_07) },
+ { MP_ROM_QSTR(MP_QSTR_D11), MP_ROM_PTR(&pin_P0_11) },
+ { MP_ROM_QSTR(MP_QSTR_D15), MP_ROM_PTR(&pin_P0_15) },
+ { MP_ROM_QSTR(MP_QSTR_D16), MP_ROM_PTR(&pin_P0_16) },
+
+ { MP_ROM_QSTR(MP_QSTR_L), MP_ROM_PTR(&pin_P0_17) },
+
+ { MP_ROM_QSTR(MP_QSTR_LED_BLUE), MP_ROM_PTR(&pin_P0_19) },
+
+ { MP_ROM_QSTR(MP_QSTR_SCL), MP_ROM_PTR(&pin_P0_26) },
+ { MP_ROM_QSTR(MP_QSTR_SDA), MP_ROM_PTR(&pin_P0_25) },
+};
+
+MP_DEFINE_CONST_DICT(board_module_globals, board_module_globals_table);
diff --git a/ports/nrf/boards/feather_nrf52832/pins.csv b/ports/nrf/boards/feather_nrf52832/pins.csv
deleted file mode 100644
index c04190064..000000000
--- a/ports/nrf/boards/feather_nrf52832/pins.csv
+++ /dev/null
@@ -1,24 +0,0 @@
-A0,P0_02
-A1,P0_03
-A2,P0_04
-A3,P0_05
-TX,P0_06
-RX,P0_08
-NFC1,P0_09
-NFC2,P0_10
-D11,P0_11
-SCK,P0_12
-MOSI,P0_13
-MISO,P0_14
-D15,P0_15
-D16,P0_16
-LED1,P0_17
-LED2,P0_19
-DFU,P0_20
-SDA,P0_25
-SCL,P0_26
-D27,P0_27
-A4,P0_28
-A5,P0_29
-A6,P0_30
-A7,P0_31
diff --git a/ports/nrf/boards/feather_nrf52840_express/mpconfigboard.h b/ports/nrf/boards/feather_nrf52840_express/mpconfigboard.h
index ce21e7386..81818741d 100644
--- a/ports/nrf/boards/feather_nrf52840_express/mpconfigboard.h
+++ b/ports/nrf/boards/feather_nrf52840_express/mpconfigboard.h
@@ -29,20 +29,16 @@
#define MICROPY_HW_BOARD_NAME "Adafruit Feather nRF52840 Express"
#define MICROPY_HW_MCU_NAME "nRF52840"
-#define MICROPY_PY_SYS_PLATFORM "Feather52840"
+#define MICROPY_PY_SYS_PLATFORM "Feather52840Express"
-// #define MICROPY_HW_NEOPIXEL NRF_GPIO_PIN_MAP(0, 13)
+#define MICROPY_HW_NEOPIXEL (&pin_P0_13)
-// #define MICROPY_QSPI_DATA0 NRF_GPIO_PIN_MAP(1, 9)
-// #define MICROPY_QSPI_DATA1 NRF_GPIO_PIN_MAP(0, 11)
-// #define MICROPY_QSPI_DATA2 NRF_GPIO_PIN_MAP(0, 12)
-// #define MICROPY_QSPI_DATA3 NRF_GPIO_PIN_MAP(0, 14)
-// #define MICROPY_QSPI_SCK NRF_GPIO_PIN_MAP(0, 8)
-// #define MICROPY_QSPI_CS NRF_GPIO_PIN_MAP(1, 8)
-
-// #define MICROPY_HW_UART_RX NRF_GPIO_PIN_MAP(0, 8)
-// #define MICROPY_HW_UART_TX NRF_GPIO_PIN_MAP(0, 6)
-// #define MICROPY_HW_UART_HWFC (0)
+#define MICROPY_QSPI_DATA0 (&pin_P1_09)
+#define MICROPY_QSPI_DATA1 (&pin_P0_11)
+#define MICROPY_QSPI_DATA2 (&pin_P0_12)
+#define MICROPY_QSPI_DATA3 (&pin_P0_14)
+#define MICROPY_QSPI_SCK (&pin_P0_08)
+#define MICROPY_QSPI_CS (&pin_P1_08)
#define CIRCUITPY_AUTORELOAD_DELAY_MS 500
@@ -64,12 +60,12 @@
#define BOARD_HAS_CRYSTAL 1
-#define DEFAULT_I2C_BUS_SCL NRF_GPIO_PIN_MAP(1, 11)
-#define DEFAULT_I2C_BUS_SDA NRF_GPIO_PIN_MAP(1, 12)
+#define DEFAULT_I2C_BUS_SCL (&pin_P1_11)
+#define DEFAULT_I2C_BUS_SDA (&pin_P1_12)
-#define DEFAULT_SPI_BUS_SCK NRF_GPIO_PIN_MAP(0, 20)
-#define DEFAULT_SPI_BUS_MOSI NRF_GPIO_PIN_MAP(0, 23)
-#define DEFAULT_SPI_BUS_MISO NRF_GPIO_PIN_MAP(0, 22)
+#define DEFAULT_SPI_BUS_SCK (&pin_P0_20)
+#define DEFAULT_SPI_BUS_MOSI (&pin_P0_23)
+#define DEFAULT_SPI_BUS_MISO (&pin_P0_22)
-#define DEFAULT_UART_BUS_RX NRF_GPIO_PIN_MAP(1, 0)
-#define DEFAULT_UART_BUS_TX NRF_GPIO_PIN_MAP(0, 24)
+#define DEFAULT_UART_BUS_RX (&pin_P1_0)
+#define DEFAULT_UART_BUS_TX (&pin_P0_24)
diff --git a/ports/nrf/boards/feather_nrf52840_express/mpconfigboard.mk b/ports/nrf/boards/feather_nrf52840_express/mpconfigboard.mk
index 5c4fde483..caf580ec4 100644
--- a/ports/nrf/boards/feather_nrf52840_express/mpconfigboard.mk
+++ b/ports/nrf/boards/feather_nrf52840_express/mpconfigboard.mk
@@ -1,6 +1,7 @@
MCU_SERIES = m4
MCU_VARIANT = nrf52
MCU_SUB_VARIANT = nrf52840
+MCU_CHIP = nrf52840
SD ?= s140
SOFTDEV_VERSION ?= 6.1.0
@@ -12,4 +13,4 @@ else
LD_FILE = boards/adafruit_$(MCU_SUB_VARIANT)_$(SD_LOWER)_v$(firstword $(subst ., ,$(SOFTDEV_VERSION))).ld
endif
-NRF_DEFINES += -DNRF52840_XXAA
+NRF_DEFINES += -DNRF52840_XXAA -DNRF52840
diff --git a/ports/nrf/boards/feather_nrf52840_express/pins.c b/ports/nrf/boards/feather_nrf52840_express/pins.c
new file mode 100644
index 000000000..0f5eab31d
--- /dev/null
+++ b/ports/nrf/boards/feather_nrf52840_express/pins.c
@@ -0,0 +1,41 @@
+#include "shared-bindings/board/__init__.h"
+
+#include "board_busses.h"
+
+STATIC const mp_rom_map_elem_t board_module_globals_table[] = {
+ { MP_ROM_QSTR(MP_QSTR_A0), MP_ROM_PTR(&pin_P0_30) },
+ { MP_ROM_QSTR(MP_QSTR_A1), MP_ROM_PTR(&pin_P0_28) },
+ { MP_ROM_QSTR(MP_QSTR_A2), MP_ROM_PTR(&pin_P0_31) },
+ { MP_ROM_QSTR(MP_QSTR_A3), MP_ROM_PTR(&pin_P0_02) },
+ { MP_ROM_QSTR(MP_QSTR_A4), MP_ROM_PTR(&pin_P0_29) },
+ { MP_ROM_QSTR(MP_QSTR_A5), MP_ROM_PTR(&pin_P0_03) },
+
+ { MP_ROM_QSTR(MP_QSTR_AREF), MP_ROM_PTR(&pin_P0_04) },
+ { MP_ROM_QSTR(MP_QSTR_VDIV), MP_ROM_PTR(&pin_P0_05) },
+
+ { MP_ROM_QSTR(MP_QSTR_D5), MP_ROM_PTR(&pin_P1_13) },
+ { MP_ROM_QSTR(MP_QSTR_D6), MP_ROM_PTR(&pin_P1_14) },
+ { MP_ROM_QSTR(MP_QSTR_D9), MP_ROM_PTR(&pin_P1_15) },
+ { MP_ROM_QSTR(MP_QSTR_D10), MP_ROM_PTR(&pin_P0_27) },
+ { MP_ROM_QSTR(MP_QSTR_D11), MP_ROM_PTR(&pin_P0_26) },
+ { MP_ROM_QSTR(MP_QSTR_D12), MP_ROM_PTR(&pin_P0_06) },
+ { MP_ROM_QSTR(MP_QSTR_D13), MP_ROM_PTR(&pin_P0_07) },
+ { MP_ROM_QSTR(MP_QSTR_L), MP_ROM_PTR(&pin_P0_07) },
+
+ { MP_ROM_QSTR(MP_QSTR_NEOPIXEL), MP_ROM_PTR(&pin_P0_13) },
+
+ { MP_ROM_QSTR(MP_QSTR_SCK), MP_ROM_PTR(&pin_P0_20) },
+ { MP_ROM_QSTR(MP_QSTR_MOSI), MP_ROM_PTR(&pin_P0_23) },
+ { MP_ROM_QSTR(MP_QSTR_MISO), MP_ROM_PTR(&pin_P0_22) },
+
+ { MP_ROM_QSTR(MP_QSTR_TXD), MP_ROM_PTR(&pin_P0_24) },
+ { MP_ROM_QSTR(MP_QSTR_RXD), MP_ROM_PTR(&pin_P1_00) },
+
+ { MP_ROM_QSTR(MP_QSTR_SCL), MP_ROM_PTR(&pin_P1_11) },
+ { MP_ROM_QSTR(MP_QSTR_SDA), MP_ROM_PTR(&pin_P1_12) },
+
+ { MP_ROM_QSTR(MP_QSTR_LED_RED), MP_ROM_PTR(&pin_P1_02) },
+ { MP_ROM_QSTR(MP_QSTR_LED_BLUE), MP_ROM_PTR(&pin_P1_10) },
+};
+
+MP_DEFINE_CONST_DICT(board_module_globals, board_module_globals_table);
diff --git a/ports/nrf/boards/feather_nrf52840_express/pins.csv b/ports/nrf/boards/feather_nrf52840_express/pins.csv
deleted file mode 100644
index 284370d06..000000000
--- a/ports/nrf/boards/feather_nrf52840_express/pins.csv
+++ /dev/null
@@ -1,48 +0,0 @@
-P0_00,P0_00
-P0_01,P0_01
-P0_02,P0_02
-P0_03,P0_03
-P0_04,P0_04
-P0_05,P0_05
-P0_06,P0_06
-P0_07,P0_07
-P0_08,P0_08
-P0_09,P0_09
-P0_10,P0_10
-P0_11,P0_11
-P0_12,P0_12
-P0_13,P0_13
-P0_14,P0_14
-P0_15,P0_15
-P0_16,P0_16
-P0_17,P0_17
-P0_18,P0_18
-P0_19,P0_19
-P0_20,P0_20
-P0_21,P0_21
-P0_22,P0_22
-P0_23,P0_23
-P0_24,P0_24
-P0_25,P0_25
-P0_26,P0_26
-P0_27,P0_27
-P0_28,P0_28
-P0_29,P0_29
-P0_30,P0_30
-P0_31,P0_31
-P1_00,P1_00
-P1_01,P1_01
-P1_02,P1_02
-P1_03,P1_03
-P1_04,P1_04
-P1_05,P1_05
-P1_06,P1_06
-P1_07,P1_07
-P1_08,P1_08
-P1_09,P1_09
-P1_10,P1_10
-P1_11,P1_11
-P1_12,P1_12
-P1_13,P1_13
-P1_14,P1_14
-P1_15,P1_15
diff --git a/ports/nrf/boards/pca10040/mpconfigboard.h b/ports/nrf/boards/pca10040/mpconfigboard.h
index 8fa001dfa..ebf808ce2 100644
--- a/ports/nrf/boards/pca10040/mpconfigboard.h
+++ b/ports/nrf/boards/pca10040/mpconfigboard.h
@@ -4,6 +4,7 @@
* The MIT License (MIT)
*
* Copyright (c) 2016 Glenn Ruben Bakke
+ * Copyright (c) 2018 Dan Halbert for Adafruit Industries
*
* Permission is hereby granted, free of charge, to any person obtaining a copy
* of this software and associated documentation files (the "Software"), to deal
diff --git a/ports/nrf/boards/pca10040/mpconfigboard.mk b/ports/nrf/boards/pca10040/mpconfigboard.mk
index 79aa85349..ad11b4f7c 100644
--- a/ports/nrf/boards/pca10040/mpconfigboard.mk
+++ b/ports/nrf/boards/pca10040/mpconfigboard.mk
@@ -1,6 +1,8 @@
MCU_SERIES = m4
MCU_VARIANT = nrf52
+# Historical: nrf52 means nrf52832
MCU_SUB_VARIANT = nrf52
+MCU_CHIP = nrf52832
SD ?= s132
SOFTDEV_VERSION ?= 5.0.0
@@ -10,4 +12,4 @@ else
LD_FILE = boards/nrf52832_512k_64k_s132_$(SOFTDEV_VERSION).ld
endif
-NRF_DEFINES += -DNRF52832_XXAA
+NRF_DEFINES += -DNRF52832_XXAA -DNRF52832
diff --git a/ports/nrf/boards/pca10040/pins.c b/ports/nrf/boards/pca10040/pins.c
new file mode 100644
index 000000000..9671358c9
--- /dev/null
+++ b/ports/nrf/boards/pca10040/pins.c
@@ -0,0 +1,40 @@
+#include "shared-bindings/board/__init__.h"
+
+#include "board_busses.h"
+
+STATIC const mp_rom_map_elem_t board_module_globals_table[] = {
+ { MP_ROM_QSTR(MP_QSTR_P0_00), MP_ROM_PTR(&pin_P0_00) },
+ { MP_ROM_QSTR(MP_QSTR_P0_01), MP_ROM_PTR(&pin_P0_01) },
+ { 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_18), MP_ROM_PTR(&pin_P0_18) },
+ { 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_DEFINE_CONST_DICT(board_module_globals, board_module_globals_table);
diff --git a/ports/nrf/boards/pca10040/pins.csv b/ports/nrf/boards/pca10040/pins.csv
deleted file mode 100644
index 220222446..000000000
--- a/ports/nrf/boards/pca10040/pins.csv
+++ /dev/null
@@ -1,31 +0,0 @@
-P0_01,P0_01
-P0_02,P0_02
-P0_03,P0_03
-P0_04,P0_04
-P0_05,P0_05
-P0_06,P0_06
-P0_07,P0_07
-P0_08,P0_08
-P0_09,P0_09
-P0_10,P0_10
-P0_11,P0_11
-P0_12,P0_12
-P0_13,P0_13
-P0_14,P0_14
-P0_15,P0_15
-P0_16,P0_16
-P0_17,P0_17
-P0_18,P0_18
-P0_19,P0_19
-P0_20,P0_20
-P0_21,P0_21
-P0_22,P0_22
-P0_23,P0_23
-P0_24,P0_24
-P0_25,P0_25
-P0_26,P0_26
-P0_27,P0_27
-P0_28,P0_28
-P0_29,P0_29
-P0_30,P0_30
-P0_31,P0_31
diff --git a/ports/nrf/boards/pca10056/mpconfigboard.h b/ports/nrf/boards/pca10056/mpconfigboard.h
index 8195e1947..de4545d62 100644
--- a/ports/nrf/boards/pca10056/mpconfigboard.h
+++ b/ports/nrf/boards/pca10056/mpconfigboard.h
@@ -24,10 +24,11 @@
* THE SOFTWARE.
*/
-#define MICROPY_HW_BOARD_NAME "PCA10056"
+#define MICROPY_HW_BOARD_NAME "PCA10056 nRF52840-DK"
#define MICROPY_HW_MCU_NAME "nRF52840"
#define MICROPY_PY_SYS_PLATFORM "nRF52840-DK"
+// See legend on bottom of board
#define MICROPY_HW_UART_RX NRF_GPIO_PIN_MAP(0, 8)
#define MICROPY_HW_UART_TX NRF_GPIO_PIN_MAP(0, 6)
#define MICROPY_HW_UART_HWFC (0)
@@ -38,3 +39,12 @@
// Temp (could be removed) 0: usb cdc (default), 1 : hwuart (jlink)
#define CFG_HWUART_FOR_SERIAL 0
+#define DEFAULT_I2C_BUS_SCL (&pin_P0_27)
+#define DEFAULT_I2C_BUS_SDA (&pin_P0_26)
+
+#define DEFAULT_SPI_BUS_SCK (&pin_P1_15)
+#define DEFAULT_SPI_BUS_MOSI (&pin_P1_13)
+#define DEFAULT_SPI_BUS_MISO (&pin_P1_14)
+
+#define DEFAULT_UART_BUS_RX (&pin_P1_01)
+#define DEFAULT_UART_BUS_TX (&pin_P1_02)
diff --git a/ports/nrf/boards/pca10056/mpconfigboard.mk b/ports/nrf/boards/pca10056/mpconfigboard.mk
index 5c4fde483..caf580ec4 100644
--- a/ports/nrf/boards/pca10056/mpconfigboard.mk
+++ b/ports/nrf/boards/pca10056/mpconfigboard.mk
@@ -1,6 +1,7 @@
MCU_SERIES = m4
MCU_VARIANT = nrf52
MCU_SUB_VARIANT = nrf52840
+MCU_CHIP = nrf52840
SD ?= s140
SOFTDEV_VERSION ?= 6.1.0
@@ -12,4 +13,4 @@ else
LD_FILE = boards/adafruit_$(MCU_SUB_VARIANT)_$(SD_LOWER)_v$(firstword $(subst ., ,$(SOFTDEV_VERSION))).ld
endif
-NRF_DEFINES += -DNRF52840_XXAA
+NRF_DEFINES += -DNRF52840_XXAA -DNRF52840
diff --git a/ports/nrf/boards/pca10056/pins.c b/ports/nrf/boards/pca10056/pins.c
new file mode 100644
index 000000000..1c208f89b
--- /dev/null
+++ b/ports/nrf/boards/pca10056/pins.c
@@ -0,0 +1,129 @@
+#include "shared-bindings/board/__init__.h"
+
+#include "board_busses.h"
+
+STATIC const mp_rom_map_elem_t board_module_globals_table[] = {
+ { MP_ROM_QSTR(MP_QSTR_P0_00), MP_ROM_PTR(&pin_P0_00) },
+ { MP_ROM_QSTR(MP_QSTR_P0_01), MP_ROM_PTR(&pin_P0_01) },
+ { 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_A0), MP_ROM_PTR(&pin_P0_03) },
+
+ { MP_ROM_QSTR(MP_QSTR_P0_04), MP_ROM_PTR(&pin_P0_04) },
+ { MP_ROM_QSTR(MP_QSTR_A1), 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_BUTTON1), MP_ROM_PTR(&pin_P0_11) },
+
+ { MP_ROM_QSTR(MP_QSTR_P0_12), MP_ROM_PTR(&pin_P0_12) },
+ { MP_ROM_QSTR(MP_QSTR_BUTTON2), MP_ROM_PTR(&pin_P0_12) },
+
+ { MP_ROM_QSTR(MP_QSTR_P0_13), MP_ROM_PTR(&pin_P0_13) },
+ { MP_ROM_QSTR(MP_QSTR_L), MP_ROM_PTR(&pin_P0_13) },
+ { MP_ROM_QSTR(MP_QSTR_LED1), MP_ROM_PTR(&pin_P0_13) },
+
+ { MP_ROM_QSTR(MP_QSTR_P0_14), MP_ROM_PTR(&pin_P0_14) },
+ { MP_ROM_QSTR(MP_QSTR_LED2), MP_ROM_PTR(&pin_P0_14) },
+
+ { MP_ROM_QSTR(MP_QSTR_P0_15), MP_ROM_PTR(&pin_P0_15) },
+ { MP_ROM_QSTR(MP_QSTR_LED3), MP_ROM_PTR(&pin_P0_15) },
+
+ { MP_ROM_QSTR(MP_QSTR_P0_16), MP_ROM_PTR(&pin_P0_16) },
+ { MP_ROM_QSTR(MP_QSTR_LED4), MP_ROM_PTR(&pin_P0_16) },
+
+ { MP_ROM_QSTR(MP_QSTR_P0_17), MP_ROM_PTR(&pin_P0_17) },
+
+ // RESET { MP_ROM_QSTR(MP_QSTR_P0_18), MP_ROM_PTR(&pin_P0_18) },
+
+ { 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_BUTTON3), MP_ROM_PTR(&pin_P0_24) },
+
+ { MP_ROM_QSTR(MP_QSTR_P0_25), MP_ROM_PTR(&pin_P0_25) },
+ { MP_ROM_QSTR(MP_QSTR_BUTTON4), MP_ROM_PTR(&pin_P0_25) },
+
+ { MP_ROM_QSTR(MP_QSTR_P0_26), MP_ROM_PTR(&pin_P0_26) },
+ { MP_ROM_QSTR(MP_QSTR_SDA), MP_ROM_PTR(&pin_P0_26) },
+
+ { MP_ROM_QSTR(MP_QSTR_P0_27), MP_ROM_PTR(&pin_P0_27) },
+ { MP_ROM_QSTR(MP_QSTR_SCL), MP_ROM_PTR(&pin_P0_27) },
+
+ { MP_ROM_QSTR(MP_QSTR_P0_28), MP_ROM_PTR(&pin_P0_28) },
+ { MP_ROM_QSTR(MP_QSTR_A2), MP_ROM_PTR(&pin_P0_28) },
+
+ { MP_ROM_QSTR(MP_QSTR_P0_29), MP_ROM_PTR(&pin_P0_29) },
+ { MP_ROM_QSTR(MP_QSTR_A3), MP_ROM_PTR(&pin_P0_29) },
+
+ { MP_ROM_QSTR(MP_QSTR_P0_30), MP_ROM_PTR(&pin_P0_30) },
+ { MP_ROM_QSTR(MP_QSTR_A4), MP_ROM_PTR(&pin_P0_30) },
+
+ { MP_ROM_QSTR(MP_QSTR_P0_31), MP_ROM_PTR(&pin_P0_31) },
+ { MP_ROM_QSTR(MP_QSTR_A5), 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_D0), MP_ROM_PTR(&pin_P1_01) },
+ { MP_ROM_QSTR(MP_QSTR_RX), MP_ROM_PTR(&pin_P1_01) },
+
+ { MP_ROM_QSTR(MP_QSTR_P1_02), MP_ROM_PTR(&pin_P1_02) },
+ { MP_ROM_QSTR(MP_QSTR_D1), MP_ROM_PTR(&pin_P1_02) },
+ { MP_ROM_QSTR(MP_QSTR_TX), MP_ROM_PTR(&pin_P1_02) },
+
+ { MP_ROM_QSTR(MP_QSTR_P1_03), MP_ROM_PTR(&pin_P1_03) },
+ { MP_ROM_QSTR(MP_QSTR_D2), MP_ROM_PTR(&pin_P1_03) },
+
+ { MP_ROM_QSTR(MP_QSTR_P1_04), MP_ROM_PTR(&pin_P1_04) },
+ { MP_ROM_QSTR(MP_QSTR_D3), MP_ROM_PTR(&pin_P1_04) },
+
+ { MP_ROM_QSTR(MP_QSTR_P1_05), MP_ROM_PTR(&pin_P1_05) },
+ { MP_ROM_QSTR(MP_QSTR_D4), MP_ROM_PTR(&pin_P1_05) },
+
+ { MP_ROM_QSTR(MP_QSTR_P1_06), MP_ROM_PTR(&pin_P1_06) },
+ { MP_ROM_QSTR(MP_QSTR_D5), MP_ROM_PTR(&pin_P1_06) },
+
+ { MP_ROM_QSTR(MP_QSTR_P1_07), MP_ROM_PTR(&pin_P1_07) },
+ { MP_ROM_QSTR(MP_QSTR_D6), MP_ROM_PTR(&pin_P1_07) },
+
+ { MP_ROM_QSTR(MP_QSTR_P1_08), MP_ROM_PTR(&pin_P1_08) },
+ { MP_ROM_QSTR(MP_QSTR_D7), 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_D8), MP_ROM_PTR(&pin_P1_10) },
+
+ { MP_ROM_QSTR(MP_QSTR_P1_11), MP_ROM_PTR(&pin_P1_11) },
+ { MP_ROM_QSTR(MP_QSTR_D9), MP_ROM_PTR(&pin_P1_11) },
+
+ { MP_ROM_QSTR(MP_QSTR_P1_12), MP_ROM_PTR(&pin_P1_12) },
+ { MP_ROM_QSTR(MP_QSTR_D10), MP_ROM_PTR(&pin_P1_12) },
+
+ { MP_ROM_QSTR(MP_QSTR_P1_13), MP_ROM_PTR(&pin_P1_13) },
+ { MP_ROM_QSTR(MP_QSTR_D11), MP_ROM_PTR(&pin_P1_13) },
+ { MP_ROM_QSTR(MP_QSTR_MOSI), MP_ROM_PTR(&pin_P1_13) },
+
+ { MP_ROM_QSTR(MP_QSTR_P1_14), MP_ROM_PTR(&pin_P1_14) },
+ { MP_ROM_QSTR(MP_QSTR_D12), MP_ROM_PTR(&pin_P1_14) },
+ { MP_ROM_QSTR(MP_QSTR_MISO), MP_ROM_PTR(&pin_P1_14) },
+
+ // Note that there is no LED on D13.
+ { MP_ROM_QSTR(MP_QSTR_P1_15), MP_ROM_PTR(&pin_P1_15) },
+ { MP_ROM_QSTR(MP_QSTR_D13), MP_ROM_PTR(&pin_P1_15) },
+ { MP_ROM_QSTR(MP_QSTR_SCK), MP_ROM_PTR(&pin_P1_15) },
+};
+
+MP_DEFINE_CONST_DICT(board_module_globals, board_module_globals_table);
diff --git a/ports/nrf/boards/pca10056/pins.csv b/ports/nrf/boards/pca10056/pins.csv
deleted file mode 100644
index 284370d06..000000000
--- a/ports/nrf/boards/pca10056/pins.csv
+++ /dev/null
@@ -1,48 +0,0 @@
-P0_00,P0_00
-P0_01,P0_01
-P0_02,P0_02
-P0_03,P0_03
-P0_04,P0_04
-P0_05,P0_05
-P0_06,P0_06
-P0_07,P0_07
-P0_08,P0_08
-P0_09,P0_09
-P0_10,P0_10
-P0_11,P0_11
-P0_12,P0_12
-P0_13,P0_13
-P0_14,P0_14
-P0_15,P0_15
-P0_16,P0_16
-P0_17,P0_17
-P0_18,P0_18
-P0_19,P0_19
-P0_20,P0_20
-P0_21,P0_21
-P0_22,P0_22
-P0_23,P0_23
-P0_24,P0_24
-P0_25,P0_25
-P0_26,P0_26
-P0_27,P0_27
-P0_28,P0_28
-P0_29,P0_29
-P0_30,P0_30
-P0_31,P0_31
-P1_00,P1_00
-P1_01,P1_01
-P1_02,P1_02
-P1_03,P1_03
-P1_04,P1_04
-P1_05,P1_05
-P1_06,P1_06
-P1_07,P1_07
-P1_08,P1_08
-P1_09,P1_09
-P1_10,P1_10
-P1_11,P1_11
-P1_12,P1_12
-P1_13,P1_13
-P1_14,P1_14
-P1_15,P1_15
diff --git a/ports/nrf/nrf_pin.h b/ports/nrf/boards/pca10059/board.c
index 7a0ebea78..0b667aa9d 100644
--- a/ports/nrf/nrf_pin.h
+++ b/ports/nrf/boards/pca10059/board.c
@@ -3,7 +3,7 @@
*
* The MIT License (MIT)
*
- * Copyright (c) 2013, 2014 Damien P. George
+ * Copyright (c) 2017 Scott Shawcroft for Adafruit Industries
*
* Permission is hereby granted, free of charge, to any person obtaining a copy
* of this software and associated documentation files (the "Software"), to deal
@@ -24,20 +24,30 @@
* THE SOFTWARE.
*/
-#ifndef __MICROPY_INCLUDED_NRF5_PIN_H__
-#define __MICROPY_INCLUDED_NRF5_PIN_H__
+#include <string.h>
+#include <stdbool.h>
+#include "boards/board.h"
+#include "nrfx.h"
+#include "usb.h"
+
+void board_init(void) {
+
+ // Clock
+ NRF_CLOCK->LFCLKSRC = (uint32_t)((CLOCK_LFCLKSRC_SRC_Xtal << CLOCK_LFCLKSRC_SRC_Pos) & CLOCK_LFCLKSRC_SRC_Msk);
+ NRF_CLOCK->TASKS_LFCLKSTART = 1UL;
+
+ usb_init();
+}
+
+bool board_requests_safe_mode(void) {
+ return false;
+}
+
+void reset_board(void) {
+
+}
-#include "py/obj.h"
-typedef struct {
- mp_obj_base_t base;
- qstr name;
- uint32_t port : 1;
- uint32_t pin : 5; // Some ARM processors use 32 bits/PORT
- uint32_t adc_channel : 4; // 0 is no ADC, ADC channel from 1 to 8
-} pin_obj_t;
-extern const mp_obj_type_t mcu_pin_type;
-#endif // __MICROPY_INCLUDED_NRF5_PIN_H__
diff --git a/ports/nrf/boards/pca10059/bootloader/6.0.0/pca10056_bootloader_6.0.0_s140.zip b/ports/nrf/boards/pca10059/bootloader/6.0.0/pca10056_bootloader_6.0.0_s140.zip
new file mode 100644
index 000000000..691f4a1ab
--- /dev/null
+++ b/ports/nrf/boards/pca10059/bootloader/6.0.0/pca10056_bootloader_6.0.0_s140.zip
Binary files differ
diff --git a/ports/nrf/boards/pca10059/mpconfigboard.h b/ports/nrf/boards/pca10059/mpconfigboard.h
new file mode 100644
index 000000000..b248011ec
--- /dev/null
+++ b/ports/nrf/boards/pca10059/mpconfigboard.h
@@ -0,0 +1,32 @@
+/*
+ * This file is part of the MicroPython project, http://micropython.org/
+ *
+ * The MIT License (MIT)
+ *
+ * Copyright (c) 2016 Glenn Ruben Bakke
+ *
+ * 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.
+ */
+
+#define MICROPY_HW_BOARD_NAME "PCA10059 nRF52840 Dongle"
+#define MICROPY_HW_MCU_NAME "nRF52840"
+#define MICROPY_PY_SYS_PLATFORM "nRF52840-DK"
+
+#define PORT_HEAP_SIZE (128 * 1024)
+#define CIRCUITPY_AUTORELOAD_DELAY_MS 500
diff --git a/ports/nrf/boards/pca10059/mpconfigboard.mk b/ports/nrf/boards/pca10059/mpconfigboard.mk
new file mode 100644
index 000000000..f399927fd
--- /dev/null
+++ b/ports/nrf/boards/pca10059/mpconfigboard.mk
@@ -0,0 +1,17 @@
+MCU_SERIES = m4
+MCU_VARIANT = nrf52
+MCU_SUB_VARIANT = nrf52840
+MCU_CHIP = nrf52840
+SD ?= s140
+SOFTDEV_VERSION ?= 6.1.0
+
+BOOT_SETTING_ADDR = 0xFF000
+BOOT_FILE = boards/$(BOARD)/bootloader/$(SOFTDEV_VERSION)/$(BOARD)_bootloader_$(SOFTDEV_VERSION)_s140
+
+ifeq ($(SD),)
+ LD_FILE = boards/nrf52840_1M_256k.ld
+else
+ LD_FILE = boards/adafruit_$(MCU_SUB_VARIANT)_$(SD_LOWER)_v$(firstword $(subst ., ,$(SOFTDEV_VERSION))).ld
+endif
+
+NRF_DEFINES += -DNRF52840_XXAA -DNRF52840
diff --git a/ports/nrf/boards/pca10059/pins.c b/ports/nrf/boards/pca10059/pins.c
new file mode 100644
index 000000000..a1916bd04
--- /dev/null
+++ b/ports/nrf/boards/pca10059/pins.c
@@ -0,0 +1,42 @@
+#include "shared-bindings/board/__init__.h"
+
+#include "board_busses.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_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_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_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_17), MP_ROM_PTR(&pin_P0_17) },
+ { MP_ROM_QSTR(MP_QSTR_P0_20), MP_ROM_PTR(&pin_P0_20) },
+ { MP_ROM_QSTR(MP_QSTR_P0_22), MP_ROM_PTR(&pin_P0_22) },
+ { MP_ROM_QSTR(MP_QSTR_P0_24), MP_ROM_PTR(&pin_P0_24) },
+ { MP_ROM_QSTR(MP_QSTR_P0_26), MP_ROM_PTR(&pin_P0_26) },
+ { MP_ROM_QSTR(MP_QSTR_P0_29), MP_ROM_PTR(&pin_P0_29) },
+ { 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_04), MP_ROM_PTR(&pin_P1_04) },
+ { MP_ROM_QSTR(MP_QSTR_P1_07), MP_ROM_PTR(&pin_P1_07) },
+ { 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_13), MP_ROM_PTR(&pin_P1_13) },
+ { MP_ROM_QSTR(MP_QSTR_P1_15), MP_ROM_PTR(&pin_P1_15) },
+
+ { MP_ROM_QSTR(MP_QSTR_LED1), MP_ROM_PTR(&pin_P0_06) },
+
+ { MP_ROM_QSTR(MP_QSTR_LED2_R), MP_ROM_PTR(&pin_P0_08) },
+ { MP_ROM_QSTR(MP_QSTR_LED2_G), MP_ROM_PTR(&pin_P1_09) },
+ { MP_ROM_QSTR(MP_QSTR_LED2_B), MP_ROM_PTR(&pin_P0_12) },
+
+ { MP_ROM_QSTR(MP_QSTR_SW1), MP_ROM_PTR(&pin_P1_06) },
+};
+
+MP_DEFINE_CONST_DICT(board_module_globals, board_module_globals_table);
diff --git a/ports/nrf/common-hal/analogio/AnalogIn.c b/ports/nrf/common-hal/analogio/AnalogIn.c
index 795191084..1e572f7cb 100644
--- a/ports/nrf/common-hal/analogio/AnalogIn.c
+++ b/ports/nrf/common-hal/analogio/AnalogIn.c
@@ -38,8 +38,9 @@ void common_hal_analogio_analogin_construct(analogio_analogin_obj_t *self, const
if (pin->adc_channel == 0)
mp_raise_ValueError(translate("Pin does not have ADC capabilities"));
- nrf_gpio_cfg_default(NRF_GPIO_PIN_MAP(pin->port, pin->pin));
+ nrf_gpio_cfg_default(pin->number);
+ claim_pin(pin);
self->pin = pin;
}
@@ -51,8 +52,9 @@ void common_hal_analogio_analogin_deinit(analogio_analogin_obj_t *self) {
if (common_hal_analogio_analogin_deinited(self))
return;
- nrf_gpio_cfg_default(NRF_GPIO_PIN_MAP(self->pin->port, self->pin->pin));
+ nrf_gpio_cfg_default(self->pin->number);
+ reset_pin_number(self->pin->number);
self->pin = mp_const_none;
}
diff --git a/ports/nrf/common-hal/analogio/AnalogOut.c b/ports/nrf/common-hal/analogio/AnalogOut.c
index 654639b59..dc0f53740 100644
--- a/ports/nrf/common-hal/analogio/AnalogOut.c
+++ b/ports/nrf/common-hal/analogio/AnalogOut.c
@@ -42,9 +42,7 @@ bool common_hal_analogio_analogout_deinited(analogio_analogout_obj_t *self) {
}
void common_hal_analogio_analogout_deinit(analogio_analogout_obj_t *self) {
-
}
void common_hal_analogio_analogout_set_value(analogio_analogout_obj_t *self, uint16_t value) {
-
}
diff --git a/ports/nrf/common-hal/busio/I2C.c b/ports/nrf/common-hal/busio/I2C.c
index 7a29da153..8ac76c304 100644
--- a/ports/nrf/common-hal/busio/I2C.c
+++ b/ports/nrf/common-hal/busio/I2C.c
@@ -54,15 +54,15 @@ static uint8_t twi_error_to_mp(const nrfx_err_t err) {
}
void common_hal_busio_i2c_construct(busio_i2c_obj_t *self, const mcu_pin_obj_t *scl, const mcu_pin_obj_t *sda, uint32_t frequency, uint32_t timeout) {
- if (scl->pin == sda->pin)
+ if (scl->number == sda->number)
mp_raise_ValueError(translate("Invalid pins"));
const nrfx_twim_t instance = NRFX_TWIM_INSTANCE(INST_NO);
self->twim = instance;
nrfx_twim_config_t config = NRFX_TWIM_DEFAULT_CONFIG;
- config.scl = NRF_GPIO_PIN_MAP(scl->port, scl->pin);
- config.sda = NRF_GPIO_PIN_MAP(sda->port, sda->pin);
+ config.scl = scl->number;
+ config.sda = sda->number;
// change freq. only if it's less than the default 400K
if (frequency < 100000) {
@@ -71,6 +71,11 @@ void common_hal_busio_i2c_construct(busio_i2c_obj_t *self, const mcu_pin_obj_t *
config.frequency = NRF_TWIM_FREQ_250K;
}
+ self->scl_pin_number = scl->number;
+ self->sda_pin_number = sda->number;
+ claim_pin(sda);
+ claim_pin(scl);
+
nrfx_err_t err = nrfx_twim_init(&self->twim, &config, NULL, NULL);
// A soft reset doesn't uninit the driver so we might end up with a invalid state
@@ -79,14 +84,15 @@ void common_hal_busio_i2c_construct(busio_i2c_obj_t *self, const mcu_pin_obj_t *
err = nrfx_twim_init(&self->twim, &config, NULL, NULL);
}
- if (err != NRFX_SUCCESS)
+ if (err != NRFX_SUCCESS) {
+ common_hal_busio_i2c_deinit(self);
mp_raise_OSError(MP_EIO);
+ }
- self->inited = true;
}
bool common_hal_busio_i2c_deinited(busio_i2c_obj_t *self) {
- return !self->inited;
+ return self->sda_pin_number == NO_PIN;
}
void common_hal_busio_i2c_deinit(busio_i2c_obj_t *self) {
@@ -95,7 +101,10 @@ void common_hal_busio_i2c_deinit(busio_i2c_obj_t *self) {
nrfx_twim_uninit(&self->twim);
- self->inited = false;
+ reset_pin_number(self->sda_pin_number);
+ reset_pin_number(self->scl_pin_number);
+ self->sda_pin_number = NO_PIN;
+ self->scl_pin_number = NO_PIN;
}
// nrfx_twim_tx doesn't support 0-length data so we fall back to the hal API
diff --git a/ports/nrf/common-hal/busio/I2C.h b/ports/nrf/common-hal/busio/I2C.h
index 331e73062..a133ff071 100644
--- a/ports/nrf/common-hal/busio/I2C.h
+++ b/ports/nrf/common-hal/busio/I2C.h
@@ -34,8 +34,9 @@
typedef struct {
mp_obj_base_t base;
nrfx_twim_t twim;
- bool inited;
bool has_lock;
+ uint8_t scl_pin_number;
+ uint8_t sda_pin_number;
} busio_i2c_obj_t;
#endif // MICROPY_INCLUDED_NRF_COMMON_HAL_BUSIO_I2C_H
diff --git a/ports/nrf/common-hal/busio/SPI.c b/ports/nrf/common-hal/busio/SPI.c
index 10974c4c5..e2d6a0daa 100644
--- a/ports/nrf/common-hal/busio/SPI.c
+++ b/ports/nrf/common-hal/busio/SPI.c
@@ -77,13 +77,25 @@ void common_hal_busio_spi_construct(busio_spi_obj_t *self, const mcu_pin_obj_t *
nrfx_spim_config_t config = NRFX_SPIM_DEFAULT_CONFIG;
config.frequency = NRF_SPIM_FREQ_8M;
- config.sck_pin = NRF_GPIO_PIN_MAP(clock->port, clock->pin);
-
- if (mosi != (mcu_pin_obj_t*)&mp_const_none_obj)
- config.mosi_pin = NRF_GPIO_PIN_MAP(mosi->port, mosi->pin);
+ config.sck_pin = clock->number;
+ self->clock_pin_number = clock->number;
+ claim_pin(clock);
+
+ if (mosi != (mcu_pin_obj_t*)&mp_const_none_obj) {
+ config.mosi_pin = mosi->number;
+ self->MOSI_pin_number = mosi->number;
+ claim_pin(mosi);
+ } else {
+ self->MOSI_pin_number = NO_PIN;
+ }
- if (miso != (mcu_pin_obj_t*)&mp_const_none_obj)
- config.miso_pin = NRF_GPIO_PIN_MAP(miso->port, miso->pin);
+ if (miso != (mcu_pin_obj_t*)&mp_const_none_obj) {
+ config.miso_pin = miso->number;
+ self->MISO_pin_number = mosi->number;
+ claim_pin(miso);
+ } else {
+ self->MISO_pin_number = NO_PIN;
+ }
nrfx_err_t err = nrfx_spim_init(&self->spim, &config, NULL, NULL);
@@ -93,14 +105,14 @@ void common_hal_busio_spi_construct(busio_spi_obj_t *self, const mcu_pin_obj_t *
err = nrfx_spim_init(&self->spim, &config, NULL, NULL);
}
- if (err != NRFX_SUCCESS)
+ if (err != NRFX_SUCCESS) {
+ common_hal_busio_spi_deinit(self);
mp_raise_OSError(MP_EIO);
-
- self->inited = true;
+ }
}
bool common_hal_busio_spi_deinited(busio_spi_obj_t *self) {
- return !self->inited;
+ return self->clock_pin_number == NO_PIN;
}
void common_hal_busio_spi_deinit(busio_spi_obj_t *self) {
@@ -109,7 +121,9 @@ void common_hal_busio_spi_deinit(busio_spi_obj_t *self) {
nrfx_spim_uninit(&self->spim);
- self->inited = false;
+ reset_pin_number(self->clock_pin_number);
+ reset_pin_number(self->MOSI_pin_number);
+ reset_pin_number(self->MISO_pin_number);
}
bool common_hal_busio_spi_configure(busio_spi_obj_t *self, uint32_t baudrate, uint8_t polarity, uint8_t phase, uint8_t bits) {
diff --git a/ports/nrf/common-hal/busio/SPI.h b/ports/nrf/common-hal/busio/SPI.h
index c3999ae94..8b637b4a5 100644
--- a/ports/nrf/common-hal/busio/SPI.h
+++ b/ports/nrf/common-hal/busio/SPI.h
@@ -33,8 +33,10 @@
typedef struct {
mp_obj_base_t base;
nrfx_spim_t spim;
- bool inited;
bool has_lock;
+ uint8_t clock_pin_number;
+ uint8_t MOSI_pin_number;
+ uint8_t MISO_pin_number;
} busio_spi_obj_t;
#endif // MICROPY_INCLUDED_NRF_COMMON_HAL_BUSIO_SPI_H
diff --git a/ports/nrf/common-hal/busio/UART.c b/ports/nrf/common-hal/busio/UART.c
index 765c987b5..f05949e15 100644
--- a/ports/nrf/common-hal/busio/UART.c
+++ b/ports/nrf/common-hal/busio/UART.c
@@ -36,8 +36,6 @@
#include "tick.h"
-#include "pins.h"
-
void common_hal_busio_uart_construct(busio_uart_obj_t *self,
const mcu_pin_obj_t * tx, const mcu_pin_obj_t * rx, uint32_t baudrate,
uint8_t bits, uart_parity_t parity, uint8_t stop, uint32_t timeout,
diff --git a/ports/nrf/common-hal/digitalio/DigitalInOut.c b/ports/nrf/common-hal/digitalio/DigitalInOut.c
index 4db9e5efa..b7a1a5001 100644
--- a/ports/nrf/common-hal/digitalio/DigitalInOut.c
+++ b/ports/nrf/common-hal/digitalio/DigitalInOut.c
@@ -32,9 +32,12 @@
digitalinout_result_t common_hal_digitalio_digitalinout_construct(
digitalio_digitalinout_obj_t *self, const mcu_pin_obj_t *pin) {
+ claim_pin(pin);
self->pin = pin;
+ self->output = false;
+ self->open_drain = false;
- nrf_gpio_cfg_input(NRF_GPIO_PIN_MAP(pin->port, pin->pin), NRF_GPIO_PIN_NOPULL);
+ nrf_gpio_cfg_input(pin->number, NRF_GPIO_PIN_NOPULL);
return DIGITALINOUT_OK;
}
@@ -47,66 +50,56 @@ void common_hal_digitalio_digitalinout_deinit(digitalio_digitalinout_obj_t *self
if (common_hal_digitalio_digitalinout_deinited(self)) {
return;
}
+ nrf_gpio_cfg_default(self->pin->number);
- const uint32_t pin = NRF_GPIO_PIN_MAP(self->pin->port, self->pin->pin);
- nrf_gpio_cfg_default(pin);
-
+ reset_pin_number(self->pin->number);
self->pin = mp_const_none;
}
void common_hal_digitalio_digitalinout_switch_to_input(
digitalio_digitalinout_obj_t *self, digitalio_pull_t pull) {
- const uint32_t pin = NRF_GPIO_PIN_MAP(self->pin->port, self->pin->pin);
-
- nrf_gpio_cfg_input(pin, NRF_GPIO_PIN_NOPULL);
-
+ self->output = false;
+ nrf_gpio_cfg_input(self->pin->number, NRF_GPIO_PIN_NOPULL);
common_hal_digitalio_digitalinout_set_pull(self, pull);
}
void common_hal_digitalio_digitalinout_switch_to_output(
digitalio_digitalinout_obj_t *self, bool value,
digitalio_drive_mode_t drive_mode) {
- const uint32_t pin = NRF_GPIO_PIN_MAP(self->pin->port, self->pin->pin);
-
+ self->output = true;
self->open_drain = (drive_mode == DRIVE_MODE_OPEN_DRAIN);
- nrf_gpio_cfg_input(pin, NRF_GPIO_PIN_NOPULL);
+ nrf_gpio_cfg_input(self->pin->number, NRF_GPIO_PIN_NOPULL);
common_hal_digitalio_digitalinout_set_value(self, value);
}
digitalio_direction_t common_hal_digitalio_digitalinout_get_direction(
digitalio_digitalinout_obj_t *self) {
- const uint32_t pin = NRF_GPIO_PIN_MAP(self->pin->port, self->pin->pin);
-
- return (nrf_gpio_pin_dir_get(pin) == NRF_GPIO_PIN_DIR_OUTPUT) ? DIRECTION_OUTPUT : DIRECTION_INPUT;
+ return self->output ? DIRECTION_OUTPUT : DIRECTION_INPUT;
}
void common_hal_digitalio_digitalinout_set_value(
digitalio_digitalinout_obj_t *self, bool value) {
- const uint32_t pin = NRF_GPIO_PIN_MAP(self->pin->port, self->pin->pin);
-
if (value && self->open_drain) {
- nrf_gpio_pin_dir_set(pin, NRF_GPIO_PIN_DIR_INPUT);
+ nrf_gpio_pin_dir_set(self->pin->number, NRF_GPIO_PIN_DIR_INPUT);
} else {
- nrf_gpio_pin_dir_set(pin, NRF_GPIO_PIN_DIR_OUTPUT);
- nrf_gpio_pin_write(pin, value);
+ nrf_gpio_pin_dir_set(self->pin->number, NRF_GPIO_PIN_DIR_OUTPUT);
+ nrf_gpio_pin_write(self->pin->number, value);
}
}
bool common_hal_digitalio_digitalinout_get_value(
digitalio_digitalinout_obj_t *self) {
- const uint32_t pin = NRF_GPIO_PIN_MAP(self->pin->port, self->pin->pin);
- const nrf_gpio_pin_dir_t dir = nrf_gpio_pin_dir_get(pin);
-
- if (dir == NRF_GPIO_PIN_DIR_INPUT) {
- if (self->open_drain)
+ if (nrf_gpio_pin_dir_get(self->pin->number) == NRF_GPIO_PIN_DIR_INPUT) {
+ if (self->open_drain) {
return true;
+ }
- return nrf_gpio_pin_read(pin);
+ return nrf_gpio_pin_read(self->pin->number);
}
- return nrf_gpio_pin_out_read(pin);
+ return nrf_gpio_pin_out_read(self->pin->number);
}
void common_hal_digitalio_digitalinout_set_drive_mode(
@@ -117,21 +110,22 @@ void common_hal_digitalio_digitalinout_set_drive_mode(
// True is implemented differently between modes so reset the value to make
// sure its correct for the new mode.
- if (value)
+ if (value) {
common_hal_digitalio_digitalinout_set_value(self, value);
+ }
}
digitalio_drive_mode_t common_hal_digitalio_digitalinout_get_drive_mode(
digitalio_digitalinout_obj_t *self) {
- if (self->open_drain)
+ if (self->open_drain) {
return DRIVE_MODE_OPEN_DRAIN;
+ }
return DRIVE_MODE_PUSH_PULL;
}
void common_hal_digitalio_digitalinout_set_pull(
digitalio_digitalinout_obj_t *self, digitalio_pull_t pull) {
- const uint32_t pin = NRF_GPIO_PIN_MAP(self->pin->port, self->pin->pin);
nrf_gpio_pin_pull_t hal_pull = NRF_GPIO_PIN_NOPULL;
switch (pull) {
@@ -146,20 +140,21 @@ void common_hal_digitalio_digitalinout_set_pull(
break;
}
- nrf_gpio_cfg_input(pin, hal_pull);
+ nrf_gpio_cfg_input(self->pin->number, hal_pull);
}
digitalio_pull_t common_hal_digitalio_digitalinout_get_pull(
digitalio_digitalinout_obj_t *self) {
- uint32_t pin = NRF_GPIO_PIN_MAP(self->pin->port, self->pin->pin);
+ uint32_t pin = self->pin->number;
+ // Changes pin to be a relative pin number in port.
NRF_GPIO_Type *reg = nrf_gpio_pin_port_decode(&pin);
- if (nrf_gpio_pin_dir_get(pin) == NRF_GPIO_PIN_DIR_OUTPUT) {
+ if (nrf_gpio_pin_dir_get(self->pin->number) == NRF_GPIO_PIN_DIR_OUTPUT) {
mp_raise_AttributeError(translate("Cannot get pull while in output mode"));
return PULL_NONE;
}
- switch (reg->PIN_CNF[self->pin->pin] & GPIO_PIN_CNF_PULL_Msk) {
+ switch (reg->PIN_CNF[pin] & GPIO_PIN_CNF_PULL_Msk) {
case NRF_GPIO_PIN_PULLUP:
return PULL_UP;
diff --git a/ports/nrf/common-hal/digitalio/DigitalInOut.h b/ports/nrf/common-hal/digitalio/DigitalInOut.h
index ee59eb498..afe8a8b42 100644
--- a/ports/nrf/common-hal/digitalio/DigitalInOut.h
+++ b/ports/nrf/common-hal/digitalio/DigitalInOut.h
@@ -32,6 +32,7 @@
typedef struct {
mp_obj_base_t base;
const mcu_pin_obj_t *pin;
+ bool output;
bool open_drain;
} digitalio_digitalinout_obj_t;
diff --git a/ports/nrf/common-hal/microcontroller/Pin.c b/ports/nrf/common-hal/microcontroller/Pin.c
index 837e813ac..7a069eeda 100644
--- a/ports/nrf/common-hal/microcontroller/Pin.c
+++ b/ports/nrf/common-hal/microcontroller/Pin.c
@@ -24,16 +24,135 @@
* THE SOFTWARE.
*/
-#include "common-hal/microcontroller/Pin.h"
+#include "shared-bindings/microcontroller/Pin.h"
+
#include "nrf_gpio.h"
#include "py/mphal.h"
-bool common_hal_mcu_pin_is_free(const mcu_pin_obj_t *pin) {
- return true;
-}
+#include "nrf/pins.h"
+#include "supervisor/shared/rgb_led_status.h"
+
+#ifdef MICROPY_HW_NEOPIXEL
+bool neopixel_in_use;
+#endif
+#ifdef MICROPY_HW_APA102_MOSI
+bool apa102_sck_in_use;
+bool apa102_mosi_in_use;
+#endif
+#ifdef SPEAKER_ENABLE_PIN
+bool speaker_enable_in_use;
+#endif
+
+// Bit mask of claimed pins on each of up to two ports. nrf52832 has one port; nrf52840 has two.
+STATIC uint32_t claimed_pins[GPIO_COUNT];
void reset_all_pins(void) {
- for (uint32_t pin = 0; pin < NUMBER_OF_PINS; ++pin)
+ for (size_t i = 0; i < GPIO_COUNT; i++) {
+ claimed_pins[i] = 0;
+ }
+
+ for (uint32_t pin = 0; pin < NUMBER_OF_PINS; ++pin) {
nrf_gpio_cfg_default(pin);
+ }
+
+ #ifdef MICROPY_HW_NEOPIXEL
+ neopixel_in_use = false;
+ #endif
+ #ifdef MICROPY_HW_APA102_MOSI
+ apa102_sck_in_use = false;
+ apa102_mosi_in_use = false;
+ #endif
+
+ // After configuring SWD because it may be shared.
+ #ifdef SPEAKER_ENABLE_PIN
+ speaker_enable_in_use = false;
+ // TODO set pin to out and turn off.
+ #endif
}
+// Mark pin as free and return it to a quiescent state.
+void reset_pin_number(uint8_t pin_number) {
+ if (pin_number == NO_PIN) {
+ return;
+ }
+
+ // Clear claimed bit.
+ claimed_pins[nrf_pin_port(pin_number)] &= ~(1 << nrf_relative_pin_number(pin_number));
+
+ #ifdef MICROPY_HW_NEOPIXEL
+ if (pin_number == MICROPY_HW_NEOPIXEL->number) {
+ neopixel_in_use = false;
+ rgb_led_status_init();
+ return;
+ }
+ #endif
+ #ifdef MICROPY_HW_APA102_MOSI
+ if (pin == MICROPY_HW_APA102_MOSI->number ||
+ pin == MICROPY_HW_APA102_SCK->number) {
+ apa102_mosi_in_use = apa102_mosi_in_use && pin_number != MICROPY_HW_APA102_MOSI->number;
+ apa102_sck_in_use = apa102_sck_in_use && pin_number != MICROPY_HW_APA102_SCK->number;
+ if (!apa102_sck_in_use && !apa102_mosi_in_use) {
+ rgb_led_status_init();
+ }
+ return;
+ }
+ #endif
+
+ #ifdef SPEAKER_ENABLE_PIN
+ if (pin_number == SPEAKER_ENABLE_PIN->number) {
+ speaker_enable_in_use = false;
+ common_hal_digitalio_digitalinout_switch_to_output(
+ nrf_gpio_pin_dir_set(pin_number, NRF_GPIO_PIN_DIR_OUTPUT);
+ nrf_gpio_pin_write(pin_number, false);
+ }
+ #endif
+}
+
+void claim_pin(const mcu_pin_obj_t* pin) {
+ // Set bit in claimed_pins bitmask.
+ claimed_pins[nrf_pin_port(pin->number)] |= 1 << nrf_relative_pin_number(pin->number);
+
+ #ifdef MICROPY_HW_NEOPIXEL
+ if (pin == MICROPY_HW_NEOPIXEL) {
+ neopixel_in_use = true;
+ }
+ #endif
+ #ifdef MICROPY_HW_APA102_MOSI
+ if (pin == MICROPY_HW_APA102_MOSI) {
+ apa102_mosi_in_use = true;
+ }
+ if (pin == MICROPY_HW_APA102_SCK) {
+ apa102_sck_in_use = true;
+ }
+ #endif
+
+ #ifdef SPEAKER_ENABLE_PIN
+ if (pin == SPEAKER_ENABLE_PIN) {
+ speaker_enable_in_use = true;
+ }
+ #endif
+}
+
+bool common_hal_mcu_pin_is_free(const mcu_pin_obj_t *pin) {
+ #ifdef MICROPY_HW_NEOPIXEL
+ if (pin == MICROPY_HW_NEOPIXEL) {
+ return !neopixel_in_use;
+ }
+ #endif
+ #ifdef MICROPY_HW_APA102_MOSI
+ if (pin == MICROPY_HW_APA102_MOSI) {
+ return !apa102_mosi_in_use;
+ }
+ if (pin == MICROPY_HW_APA102_SCK) {
+ return !apa102_sck_in_use;
+ }
+ #endif
+
+ #ifdef SPEAKER_ENABLE_PIN
+ if (pin == SPEAKER_ENABLE_PIN) {
+ return !speaker_enable_in_use;
+ }
+ #endif
+
+ return !(claimed_pins[nrf_pin_port(pin->number)] & (1 << nrf_relative_pin_number(pin->number)));
+}
diff --git a/ports/nrf/common-hal/microcontroller/Pin.h b/ports/nrf/common-hal/microcontroller/Pin.h
index 1694a8249..2cdf440b5 100644
--- a/ports/nrf/common-hal/microcontroller/Pin.h
+++ b/ports/nrf/common-hal/microcontroller/Pin.h
@@ -27,10 +27,33 @@
#ifndef MICROPY_INCLUDED_NRF_COMMON_HAL_MICROCONTROLLER_PIN_H
#define MICROPY_INCLUDED_NRF_COMMON_HAL_MICROCONTROLLER_PIN_H
-#include "nrf_pin.h"
#include "py/mphal.h"
-#define mcu_pin_obj_t pin_obj_t
+#include "peripherals/nrf/pins.h"
+
+#ifdef MICROPY_HW_NEOPIXEL
+extern bool neopixel_in_use;
+#endif
+#ifdef MICROPY_HW_APA102_MOSI
+extern bool apa102_sck_in_use;
+extern bool apa102_mosi_in_use;
+#endif
+
void reset_all_pins(void);
+// reset_pin_number takes the pin number instead of the pointer so that objects don't
+// need to store a full pointer.
+void reset_pin_number(uint8_t pin);
+void claim_pin(const mcu_pin_obj_t* pin);
+
+// Lower 5 bits of a pin number are the pin number in a port.
+// upper bits (just one bit for current chips) is port number.
+
+static inline uint8_t nrf_pin_port(uint8_t absolute_pin) {
+ return absolute_pin >> 5;
+}
+
+static inline uint8_t nrf_relative_pin_number(uint8_t absolute_pin) {
+ return absolute_pin & 0x1f;
+}
#endif // MICROPY_INCLUDED_NRF_COMMON_HAL_MICROCONTROLLER_PIN_H
diff --git a/ports/nrf/common-hal/microcontroller/__init__.c b/ports/nrf/common-hal/microcontroller/__init__.c
index e88c74136..c2e0c5b41 100644
--- a/ports/nrf/common-hal/microcontroller/__init__.c
+++ b/ports/nrf/common-hal/microcontroller/__init__.c
@@ -62,3 +62,58 @@ const mcu_processor_obj_t common_hal_mcu_processor_obj = {
.type = &mcu_processor_type,
},
};
+
+
+STATIC const mp_rom_map_elem_t mcu_pin_globals_table[] = {
+ { MP_ROM_QSTR(MP_QSTR_P0_00), MP_ROM_PTR(&pin_P0_00) },
+ { MP_ROM_QSTR(MP_QSTR_P0_01), MP_ROM_PTR(&pin_P0_01) },
+ { 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_18), MP_ROM_PTR(&pin_P0_18) },
+ { 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) },
+#ifdef NRF52840
+ { 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) },
+#endif
+};
+MP_DEFINE_CONST_DICT(mcu_pin_globals, mcu_pin_globals_table);
diff --git a/ports/nrf/common-hal/neopixel_write/__init__.c b/ports/nrf/common-hal/neopixel_write/__init__.c
new file mode 100644
index 000000000..ef5e8beb1
--- /dev/null
+++ b/ports/nrf/common-hal/neopixel_write/__init__.c
@@ -0,0 +1,265 @@
+/*
+ * This file is part of the MicroPython project, http://micropython.org/
+ *
+ * The MIT License (MIT)
+ *
+ * Copyright (c) 2018 hathach for Adafruit Industries
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a copy
+ * of this software and associated documentation files (the "Software"), to deal
+ * in the Software without restriction, including without limitation the rights
+ * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+ * copies of the Software, and to permit persons to whom the Software is
+ * furnished to do so, subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice shall be included in
+ * all copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+ * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+ * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+ * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
+ * THE SOFTWARE.
+ */
+
+#include "py/mphal.h"
+#include "shared-bindings/neopixel_write/__init__.h"
+#include "nrf_pwm.h"
+
+// https://github.com/adafruit/Adafruit_NeoPixel/blob/master/Adafruit_NeoPixel.cpp
+// [[[Begin of the Neopixel NRF52 EasyDMA implementation
+// by the Hackerspace San Salvador]]]
+// This technique uses the PWM peripheral on the NRF52. The PWM uses the
+// EasyDMA feature included on the chip. This technique loads the duty
+// cycle configuration for each cycle when the PWM is enabled. For this
+// to work we need to store a 16 bit configuration for each bit of the
+// RGB(W) values in the pixel buffer.
+// Comparator values for the PWM were hand picked and are guaranteed to
+// be 100% organic to preserve freshness and high accuracy. Current
+// parameters are:
+// * PWM Clock: 16Mhz
+// * Minimum step time: 62.5ns
+// * Time for zero in high (T0H): 0.31ms
+// * Time for one in high (T1H): 0.75ms
+// * Cycle time: 1.25us
+// * Frequency: 800Khz
+// For 400Khz we just double the calculated times.
+// ---------- BEGIN Constants for the EasyDMA implementation -----------
+// The PWM starts the duty cycle in LOW. To start with HIGH we
+// need to set the 15th bit on each register.
+
+// WS2812 (rev A) timing is 0.35 and 0.7us
+//#define MAGIC_T0H 5UL | (0x8000) // 0.3125us
+//#define MAGIC_T1H 12UL | (0x8000) // 0.75us
+
+// WS2812B (rev B) timing is 0.4 and 0.8 us
+#define MAGIC_T0H 6UL | (0x8000) // 0.375us
+#define MAGIC_T1H 13UL | (0x8000) // 0.8125us
+#define CTOPVAL 20UL // 1.25us
+
+// ---------- END Constants for the EasyDMA implementation -------------
+//
+// If there is no device available an alternative cycle-counter
+// implementation is tried.
+// The nRF52832 runs with a fixed clock of 64Mhz. The alternative
+// implementation is the same as the one used for the Teensy 3.0/1/2 but
+// with the Nordic SDK HAL & registers syntax.
+// The number of cycles was hand picked and is guaranteed to be 100%
+// organic to preserve freshness and high accuracy.
+// ---------- BEGIN Constants for cycle counter implementation ---------
+#define CYCLES_800_T0H 18 // ~0.36 uS
+#define CYCLES_800_T1H 41 // ~0.76 uS
+#define CYCLES_800 71 // ~1.25 uS
+
+// ---------- END of Constants for cycle counter implementation --------
+
+// find a free PWM device, which is not enabled and has no connected pins
+static NRF_PWM_Type* find_free_pwm (void) {
+ NRF_PWM_Type* PWM[] = {
+ NRF_PWM0, NRF_PWM1, NRF_PWM2
+#ifdef NRF_PWM3
+ , NRF_PWM3
+#endif
+ };
+
+ for ( int device = 0; device < ARRAY_SIZE(PWM); device++ ) {
+ if ( (PWM[device]->ENABLE == 0) &&
+ (PWM[device]->PSEL.OUT[0] & PWM_PSEL_OUT_CONNECT_Msk) && (PWM[device]->PSEL.OUT[1] & PWM_PSEL_OUT_CONNECT_Msk) &&
+ (PWM[device]->PSEL.OUT[2] & PWM_PSEL_OUT_CONNECT_Msk) && (PWM[device]->PSEL.OUT[3] & PWM_PSEL_OUT_CONNECT_Msk) ) {
+ return PWM[device];
+ }
+ }
+
+ return NULL;
+}
+
+void common_hal_neopixel_write (const digitalio_digitalinout_obj_t* digitalinout, uint8_t *pixels, uint32_t numBytes) {
+ // To support both the SoftDevice + Neopixels we use the EasyDMA
+ // feature from the NRF25. However this technique implies to
+ // generate a pattern and store it on the memory. The actual
+ // memory used in bytes corresponds to the following formula:
+ // totalMem = numBytes*8*2+(2*2)
+ // The two additional bytes at the end are needed to reset the
+ // sequence.
+ //
+ // If there is not enough memory, we will fall back to cycle counter
+ // using DWT
+ uint32_t pattern_size = numBytes * 8 * sizeof(uint16_t) + 2 * sizeof(uint16_t);
+ uint16_t* pixels_pattern = NULL;
+
+ NRF_PWM_Type* pwm = find_free_pwm();
+
+ // only malloc if there is PWM device available
+ if ( pwm != NULL ) {
+ pixels_pattern = (uint16_t *) m_malloc(pattern_size, false);
+ }
+
+ // Use the identified device to choose the implementation
+ // If a PWM device is available use DMA
+ if ( (pixels_pattern != NULL) && (pwm != NULL) ) {
+ uint16_t pos = 0; // bit position
+
+ for ( uint16_t n = 0; n < numBytes; n++ ) {
+ uint8_t pix = pixels[n];
+
+ for ( uint8_t mask = 0x80, i = 0; mask > 0; mask >>= 1, i++ ) {
+ pixels_pattern[pos] = (pix & mask) ? MAGIC_T1H : MAGIC_T0H;
+ pos++;
+ }
+ }
+
+ // Zero padding to indicate the end of sequence
+ pixels_pattern[++pos] = 0 | (0x8000); // Seq end
+ pixels_pattern[++pos] = 0 | (0x8000); // Seq end
+
+ // Set the wave mode to count UP
+ // Set the PWM to use the 16MHz clock
+ // Setting of the maximum count
+ // but keeping it on 16Mhz allows for more granularity just
+ // in case someone wants to do more fine-tuning of the timing.
+ nrf_pwm_configure(pwm, NRF_PWM_CLK_16MHz, NRF_PWM_MODE_UP, CTOPVAL);
+
+ // Disable loops, we want the sequence to repeat only once
+ nrf_pwm_loop_set(pwm, 0);
+
+ // On the "Common" setting the PWM uses the same pattern for the
+ // for supported sequences. The pattern is stored on half-word of 16bits
+ nrf_pwm_decoder_set(pwm, PWM_DECODER_LOAD_Common, PWM_DECODER_MODE_RefreshCount);
+
+ // Pointer to the memory storing the pattern
+ nrf_pwm_seq_ptr_set(pwm, 0, pixels_pattern);
+
+ // Calculation of the number of steps loaded from memory.
+ nrf_pwm_seq_cnt_set(pwm, 0, pattern_size / sizeof(uint16_t));
+
+ // The following settings are ignored with the current config.
+ nrf_pwm_seq_refresh_set(pwm, 0, 0);
+ nrf_pwm_seq_end_delay_set(pwm, 0, 0);
+
+ // The Neopixel implementation is a blocking algorithm. DMA
+ // allows for non-blocking operation. To "simulate" a blocking
+ // operation we enable the interruption for the end of sequence
+ // and block the execution thread until the event flag is set by
+ // the peripheral.
+ // pwm->INTEN |= (PWM_INTEN_SEQEND0_Enabled<<PWM_INTEN_SEQEND0_Pos);
+
+ // PSEL must be configured before enabling PWM
+ nrf_pwm_pins_set(pwm, (uint32_t[]) {digitalinout->pin->number, 0xFFFFFFFFUL, 0xFFFFFFFFUL, 0xFFFFFFFFUL} );
+
+ // Enable the PWM
+ nrf_pwm_enable(pwm);
+
+ // After all of this and many hours of reading the documentation
+ // we are ready to start the sequence...
+ nrf_pwm_event_clear(pwm, NRF_PWM_EVENT_SEQEND0);
+ nrf_pwm_task_trigger(pwm, NRF_PWM_TASK_SEQSTART0);
+
+ // But we have to wait for the flag to be set.
+ while ( !nrf_pwm_event_check(pwm, NRF_PWM_EVENT_SEQEND0) ) {
+#ifdef MICROPY_VM_HOOK_LOOP
+ MICROPY_VM_HOOK_LOOP
+#endif
+ }
+
+ // Before leave we clear the flag for the event.
+ nrf_pwm_event_clear(pwm, NRF_PWM_EVENT_SEQEND0);
+
+ // We need to disable the device and disconnect
+ // all the outputs before leave or the device will not
+ // be selected on the next call.
+ // TODO: Check if disabling the device causes performance issues.
+ nrf_pwm_disable(pwm);
+ nrf_pwm_pins_set(pwm, (uint32_t[]) {0xFFFFFFFFUL, 0xFFFFFFFFUL, 0xFFFFFFFFUL, 0xFFFFFFFFUL} );
+
+ m_free(pixels_pattern);
+ } // End of DMA implementation
+ // ---------------------------------------------------------------------
+ else {
+ // Fall back to DWT
+ // If you are using the Bluetooth SoftDevice we advise you to not disable
+ // the interrupts. Disabling the interrupts even for short periods of time
+ // causes the SoftDevice to stop working.
+ // Disable the interrupts only in cases where you need high performance for
+ // the LEDs and if you are not using the EasyDMA feature.
+ __disable_irq();
+
+ uint32_t decoded_pin = digitalinout->pin->number;
+ NRF_GPIO_Type* port = nrf_gpio_pin_port_decode(&decoded_pin);
+
+ uint32_t pinMask = ( 1UL << decoded_pin );
+
+ uint32_t CYCLES_X00 = CYCLES_800;
+ uint32_t CYCLES_X00_T1H = CYCLES_800_T1H;
+ uint32_t CYCLES_X00_T0H = CYCLES_800_T0H;
+
+ // Enable DWT in debug core
+ CoreDebug->DEMCR |= CoreDebug_DEMCR_TRCENA_Msk;
+ DWT->CTRL |= DWT_CTRL_CYCCNTENA_Msk;
+
+ // Tries to re-send the frame if is interrupted by the SoftDevice.
+ while ( 1 ) {
+ uint8_t *p = pixels;
+
+ uint32_t cycStart = DWT->CYCCNT;
+ uint32_t cyc = 0;
+
+ for ( uint16_t n = 0; n < numBytes; n++ ) {
+ uint8_t pix = *p++;
+
+ for ( uint8_t mask = 0x80; mask; mask >>= 1 ) {
+ while ( DWT->CYCCNT - cyc < CYCLES_X00 )
+ ;
+ cyc = DWT->CYCCNT;
+
+ port->OUTSET |= pinMask;
+
+ if ( pix & mask ) {
+ while ( DWT->CYCCNT - cyc < CYCLES_X00_T1H )
+ ;
+ } else {
+ while ( DWT->CYCCNT - cyc < CYCLES_X00_T0H )
+ ;
+ }
+
+ port->OUTCLR |= pinMask;
+ }
+ }
+ while ( DWT->CYCCNT - cyc < CYCLES_X00 )
+ ;
+
+ // If total time longer than 25%, resend the whole data.
+ // Since we are likely to be interrupted by SoftDevice
+ if ( (DWT->CYCCNT - cycStart) < (8 * numBytes * ((CYCLES_X00 * 5) / 4)) ) {
+ break;
+ }
+
+ // re-send need 300us delay
+ mp_hal_delay_us(300);
+ }
+
+ // Enable interrupts again
+ __enable_irq();
+ }
+}
diff --git a/ports/nrf/common-hal/pulseio/PWMOut.c b/ports/nrf/common-hal/pulseio/PWMOut.c
index 0f1461092..c3c51d566 100644
--- a/ports/nrf/common-hal/pulseio/PWMOut.c
+++ b/ports/nrf/common-hal/pulseio/PWMOut.c
@@ -146,7 +146,7 @@ void common_hal_pulseio_pwmout_construct(pulseio_pwmout_obj_t* self,
// check if mapped to PWM channel already
for(int i=0; i<PWM_MAX_MODULE; i++)
{
- int ch = pin2channel(pwm_arr[i], NRF_GPIO_PIN_MAP(pin->port, pin->pin));
+ int ch = pin2channel(pwm_arr[i], pin->number);
if ( ch >= 0 )
{
self->pwm = pwm_arr[i];
@@ -163,12 +163,12 @@ void common_hal_pulseio_pwmout_construct(pulseio_pwmout_obj_t* self,
if (self->pwm)
{
- nrf_gpio_cfg_output(NRF_GPIO_PIN_MAP(pin->port, pin->pin));
+ nrf_gpio_cfg_output(pin->number);
// disable before mapping pin channel
self->pwm->ENABLE = 0;
- self->pwm->PSEL.OUT[self->channel] = NRF_GPIO_PIN_MAP(pin->port, pin->pin);
+ self->pwm->PSEL.OUT[self->channel] = pin->number;
self->pwm->COUNTERTOP = (PWM_MAX_FREQ/frequency);
self->freq = frequency;
@@ -203,7 +203,7 @@ void common_hal_pulseio_pwmout_deinit(pulseio_pwmout_obj_t* self) {
}
}
- nrf_gpio_cfg_default(NRF_GPIO_PIN_MAP(self->pin->port, self->pin->pin));
+ nrf_gpio_cfg_default(self->pin->number);
self->pwm = NULL;
self->pin = mp_const_none;
diff --git a/ports/nrf/mpconfigport.h b/ports/nrf/mpconfigport.h
index 281f31917..b710808b9 100644
--- a/ports/nrf/mpconfigport.h
+++ b/ports/nrf/mpconfigport.h
@@ -180,6 +180,7 @@ extern const struct _mp_obj_module_t struct_module;
extern const struct _mp_obj_module_t time_module;
extern const struct _mp_obj_module_t supervisor_module;
extern const struct _mp_obj_module_t gamepad_module;
+extern const struct _mp_obj_module_t neopixel_write_module;
extern const struct _mp_obj_module_t usb_hid_module;
extern const struct _mp_obj_module_t bleio_module;
@@ -210,6 +211,7 @@ extern const struct _mp_obj_module_t mp_module_ubluepy;
{ MP_OBJ_NEW_QSTR (MP_QSTR_digitalio ), (mp_obj_t)&digitalio_module }, \
{ MP_OBJ_NEW_QSTR (MP_QSTR_pulseio ), (mp_obj_t)&pulseio_module }, \
{ MP_OBJ_NEW_QSTR (MP_QSTR_microcontroller ), (mp_obj_t)&microcontroller_module }, \
+ { MP_OBJ_NEW_QSTR (MP_QSTR_neopixel_write ), (mp_obj_t)&neopixel_write_module }, \
{ MP_OBJ_NEW_QSTR (MP_QSTR_bitbangio ), (mp_obj_t)&bitbangio_module }, \
{ MP_OBJ_NEW_QSTR (MP_QSTR_os ), (mp_obj_t)&os_module }, \
{ MP_OBJ_NEW_QSTR (MP_QSTR_random ), (mp_obj_t)&random_module }, \
diff --git a/ports/nrf/nrf52_af.csv b/ports/nrf/nrf52_af.csv
deleted file mode 100644
index 272d9cd09..000000000
--- a/ports/nrf/nrf52_af.csv
+++ /dev/null
@@ -1,48 +0,0 @@
-P0_00
-P0_01
-P0_02,AIN0
-P0_03,AIN1
-P0_04,AIN2
-P0_05,AIN3
-P0_06
-P0_07
-P0_08
-P0_09
-P0_10
-P0_11
-P0_12
-P0_13
-P0_14
-P0_15
-P0_16
-P0_17
-P0_18
-P0_19
-P0_20
-P0_21
-P0_22
-P0_23
-P0_24
-P0_25
-P0_26
-P0_27
-P0_28,AIN4
-P0_29,AIN5
-P0_30,AIN6
-P0_31,AIN7
-P1_00
-P1_01
-P1_02
-P1_03
-P1_04
-P1_05
-P1_06
-P1_07
-P1_08
-P1_09
-P1_10
-P1_11
-P1_12
-P1_13
-P1_14
-P1_15
diff --git a/ports/nrf/nrfx_config.h b/ports/nrf/nrfx_config.h
index 88fb973e8..fb603a896 100644
--- a/ports/nrf/nrfx_config.h
+++ b/ports/nrf/nrfx_config.h
@@ -34,4 +34,15 @@
#define NRFX_UART_DEFAULT_CONFIG_PARITY NRF_UART_PARITY_EXCLUDED
#define NRFX_UART_DEFAULT_CONFIG_BAUDRATE NRF_UART_BAUDRATE_115200
+// PWM
+#define NRFX_PWM0_ENABLED 1
+#define NRFX_PWM1_ENABLED 1
+#define NRFX_PWM2_ENABLED 1
+
+#ifdef NRF_PWM3
+#define NRFX_PWM3_ENABLED 1
+#else
+#define NRFX_PWM3_ENABLED 0
+#endif
+
#endif
diff --git a/ports/nrf/peripherals/nrf/nrf52832/pins.c b/ports/nrf/peripherals/nrf/nrf52832/pins.c
new file mode 100644
index 000000000..fdfa766ec
--- /dev/null
+++ b/ports/nrf/peripherals/nrf/nrf52832/pins.c
@@ -0,0 +1,65 @@
+/*
+ * This file is part of the MicroPython project, http://micropython.org/
+ *
+ * The MIT License (MIT)
+ *
+ * Copyright (c) 2018 Dan Halbert for Adafruit Industries
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a copy
+ * of this software and associated documentation files (the "Software"), to deal
+ * in the Software without restriction, including without limitation the rights
+ * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+ * copies of the Software, and to permit persons to whom the Software is
+ * furnished to do so, subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice shall be included in
+ * all copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+ * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+ * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+ * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
+ * THE SOFTWARE.
+ */
+
+// DO NOT include this file directly. Use shared-bindings/microcontroller/Pin.h instead to ensure
+// that all necessary includes are already included.
+
+#include "py/obj.h"
+#include "py/mphal.h"
+#include "nrf/pins.h"
+
+const mcu_pin_obj_t pin_P0_00 = PIN(P0_00, 0, 0, 0);
+const mcu_pin_obj_t pin_P0_01 = PIN(P0_01, 0, 1, 0);
+const mcu_pin_obj_t pin_P0_02 = PIN(P0_02, 0, 2, SAADC_CH_PSELP_PSELP_AnalogInput0);
+const mcu_pin_obj_t pin_P0_03 = PIN(P0_03, 0, 3, SAADC_CH_PSELP_PSELP_AnalogInput1);
+const mcu_pin_obj_t pin_P0_04 = PIN(P0_04, 0, 4, SAADC_CH_PSELP_PSELP_AnalogInput2);
+const mcu_pin_obj_t pin_P0_05 = PIN(P0_05, 0, 5, SAADC_CH_PSELP_PSELP_AnalogInput3);
+const mcu_pin_obj_t pin_P0_06 = PIN(P0_06, 0, 6, 0);
+const mcu_pin_obj_t pin_P0_07 = PIN(P0_07, 0, 7, 0);
+const mcu_pin_obj_t pin_P0_08 = PIN(P0_08, 0, 8, 0);
+const mcu_pin_obj_t pin_P0_09 = PIN(P0_09, 0, 9, 0);
+const mcu_pin_obj_t pin_P0_10 = PIN(P0_10, 0, 10, 0);
+const mcu_pin_obj_t pin_P0_11 = PIN(P0_11, 0, 11, 0);
+const mcu_pin_obj_t pin_P0_12 = PIN(P0_12, 0, 12, 0);
+const mcu_pin_obj_t pin_P0_13 = PIN(P0_13, 0, 13, 0);
+const mcu_pin_obj_t pin_P0_14 = PIN(P0_14, 0, 14, 0);
+const mcu_pin_obj_t pin_P0_15 = PIN(P0_15, 0, 15, 0);
+const mcu_pin_obj_t pin_P0_16 = PIN(P0_16, 0, 16, 0);
+const mcu_pin_obj_t pin_P0_17 = PIN(P0_17, 0, 17, 0);
+const mcu_pin_obj_t pin_P0_18 = PIN(P0_18, 0, 18, 0);
+const mcu_pin_obj_t pin_P0_19 = PIN(P0_19, 0, 19, 0);
+const mcu_pin_obj_t pin_P0_20 = PIN(P0_20, 0, 20, 0);
+const mcu_pin_obj_t pin_P0_21 = PIN(P0_21, 0, 21, 0);
+const mcu_pin_obj_t pin_P0_22 = PIN(P0_22, 0, 22, 0);
+const mcu_pin_obj_t pin_P0_23 = PIN(P0_23, 0, 23, 0);
+const mcu_pin_obj_t pin_P0_24 = PIN(P0_24, 0, 24, 0);
+const mcu_pin_obj_t pin_P0_25 = PIN(P0_25, 0, 25, 0);
+const mcu_pin_obj_t pin_P0_26 = PIN(P0_26, 0, 26, 0);
+const mcu_pin_obj_t pin_P0_27 = PIN(P0_27, 0, 27, 0);
+const mcu_pin_obj_t pin_P0_28 = PIN(P0_28, 0, 28, SAADC_CH_PSELP_PSELP_AnalogInput4);
+const mcu_pin_obj_t pin_P0_29 = PIN(P0_29, 0, 29, SAADC_CH_PSELP_PSELP_AnalogInput5);
+const mcu_pin_obj_t pin_P0_30 = PIN(P0_30, 0, 30, SAADC_CH_PSELP_PSELP_AnalogInput6);
+const mcu_pin_obj_t pin_P0_31 = PIN(P0_31, 0, 31, SAADC_CH_PSELP_PSELP_AnalogInput7);
diff --git a/ports/nrf/peripherals/nrf/nrf52832/pins.h b/ports/nrf/peripherals/nrf/nrf52832/pins.h
new file mode 100644
index 000000000..f8ef85ad0
--- /dev/null
+++ b/ports/nrf/peripherals/nrf/nrf52832/pins.h
@@ -0,0 +1,63 @@
+/*
+ * This file is part of the MicroPython project, http://micropython.org/
+ *
+ * The MIT License (MIT)
+ *
+ * Copyright (c) 2018 by Dan Halbert for Adafruit Industries
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a copy
+ * of this software and associated documentation files (the "Software"), to deal
+ * in the Software without restriction, including without limitation the rights
+ * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+ * copies of the Software, and to permit persons to whom the Software is
+ * furnished to do so, subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice shall be included in
+ * all copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+ * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+ * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+ * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
+ * THE SOFTWARE.
+ */
+
+#ifndef MICROPY_INCLUDED_NRF_PERIPHERALS_NRF52832_PINS_H
+#define MICROPY_INCLUDED_NRF_PERIPHERALS_NRF52832_PINS_H
+
+extern const mcu_pin_obj_t pin_P0_00;
+extern const mcu_pin_obj_t pin_P0_01;
+extern const mcu_pin_obj_t pin_P0_02;
+extern const mcu_pin_obj_t pin_P0_03;
+extern const mcu_pin_obj_t pin_P0_04;
+extern const mcu_pin_obj_t pin_P0_05;
+extern const mcu_pin_obj_t pin_P0_06;
+extern const mcu_pin_obj_t pin_P0_07;
+extern const mcu_pin_obj_t pin_P0_08;
+extern const mcu_pin_obj_t pin_P0_09;
+extern const mcu_pin_obj_t pin_P0_10;
+extern const mcu_pin_obj_t pin_P0_11;
+extern const mcu_pin_obj_t pin_P0_12;
+extern const mcu_pin_obj_t pin_P0_13;
+extern const mcu_pin_obj_t pin_P0_14;
+extern const mcu_pin_obj_t pin_P0_15;
+extern const mcu_pin_obj_t pin_P0_16;
+extern const mcu_pin_obj_t pin_P0_17;
+extern const mcu_pin_obj_t pin_P0_18;
+extern const mcu_pin_obj_t pin_P0_19;
+extern const mcu_pin_obj_t pin_P0_20;
+extern const mcu_pin_obj_t pin_P0_21;
+extern const mcu_pin_obj_t pin_P0_22;
+extern const mcu_pin_obj_t pin_P0_23;
+extern const mcu_pin_obj_t pin_P0_24;
+extern const mcu_pin_obj_t pin_P0_25;
+extern const mcu_pin_obj_t pin_P0_26;
+extern const mcu_pin_obj_t pin_P0_27;
+extern const mcu_pin_obj_t pin_P0_28;
+extern const mcu_pin_obj_t pin_P0_29;
+extern const mcu_pin_obj_t pin_P0_30;
+extern const mcu_pin_obj_t pin_P0_31;
+
+#endif // MICROPY_INCLUDED_NRF_PERIPHERALS_NRF52832_PINS_H
diff --git a/ports/nrf/peripherals/nrf/nrf52840/pins.c b/ports/nrf/peripherals/nrf/nrf52840/pins.c
new file mode 100644
index 000000000..b7dc8e65e
--- /dev/null
+++ b/ports/nrf/peripherals/nrf/nrf52840/pins.c
@@ -0,0 +1,78 @@
+/*
+ * This file is part of the MicroPython project, http://micropython.org/
+ *
+ * The MIT License (MIT)
+ *
+ * Copyright (c) 2018 Dan Halbert for Adafruit Industries
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a copy
+ * of this software and associated documentation files (the "Software"), to deal
+ * in the Software without restriction, including without limitation the rights
+ * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+ * copies of the Software, and to permit persons to whom the Software is
+ * furnished to do so, subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice shall be included in
+ * all copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+ * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+ * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+ * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
+ * THE SOFTWARE.
+ */
+
+#include "py/obj.h"
+#include "py/mphal.h"
+#include "nrf/pins.h"
+
+const mcu_pin_obj_t pin_P0_00 = PIN(P0_00, 0, 0, 0);
+const mcu_pin_obj_t pin_P0_01 = PIN(P0_01, 0, 1, 0);
+const mcu_pin_obj_t pin_P0_02 = PIN(P0_02, 0, 2, SAADC_CH_PSELP_PSELP_AnalogInput0);
+const mcu_pin_obj_t pin_P0_03 = PIN(P0_03, 0, 3, SAADC_CH_PSELP_PSELP_AnalogInput1);
+const mcu_pin_obj_t pin_P0_04 = PIN(P0_04, 0, 4, SAADC_CH_PSELP_PSELP_AnalogInput2);
+const mcu_pin_obj_t pin_P0_05 = PIN(P0_05, 0, 5, SAADC_CH_PSELP_PSELP_AnalogInput3);
+const mcu_pin_obj_t pin_P0_06 = PIN(P0_06, 0, 6, 0);
+const mcu_pin_obj_t pin_P0_07 = PIN(P0_07, 0, 7, 0);
+const mcu_pin_obj_t pin_P0_08 = PIN(P0_08, 0, 8, 0);
+const mcu_pin_obj_t pin_P0_09 = PIN(P0_09, 0, 9, 0);
+const mcu_pin_obj_t pin_P0_10 = PIN(P0_10, 0, 10, 0);
+const mcu_pin_obj_t pin_P0_11 = PIN(P0_11, 0, 11, 0);
+const mcu_pin_obj_t pin_P0_12 = PIN(P0_12, 0, 12, 0);
+const mcu_pin_obj_t pin_P0_13 = PIN(P0_13, 0, 13, 0);
+const mcu_pin_obj_t pin_P0_14 = PIN(P0_14, 0, 14, 0);
+const mcu_pin_obj_t pin_P0_15 = PIN(P0_15, 0, 15, 0);
+const mcu_pin_obj_t pin_P0_16 = PIN(P0_16, 0, 16, 0);
+const mcu_pin_obj_t pin_P0_17 = PIN(P0_17, 0, 17, 0);
+const mcu_pin_obj_t pin_P0_18 = PIN(P0_18, 0, 18, 0);
+const mcu_pin_obj_t pin_P0_19 = PIN(P0_19, 0, 19, 0);
+const mcu_pin_obj_t pin_P0_20 = PIN(P0_20, 0, 20, 0);
+const mcu_pin_obj_t pin_P0_21 = PIN(P0_21, 0, 21, 0);
+const mcu_pin_obj_t pin_P0_22 = PIN(P0_22, 0, 22, 0);
+const mcu_pin_obj_t pin_P0_23 = PIN(P0_23, 0, 23, 0);
+const mcu_pin_obj_t pin_P0_24 = PIN(P0_24, 0, 24, 0);
+const mcu_pin_obj_t pin_P0_25 = PIN(P0_25, 0, 25, 0);
+const mcu_pin_obj_t pin_P0_26 = PIN(P0_26, 0, 26, 0);
+const mcu_pin_obj_t pin_P0_27 = PIN(P0_27, 0, 27, 0);
+const mcu_pin_obj_t pin_P0_28 = PIN(P0_28, 0, 28, SAADC_CH_PSELP_PSELP_AnalogInput4);
+const mcu_pin_obj_t pin_P0_29 = PIN(P0_29, 0, 29, SAADC_CH_PSELP_PSELP_AnalogInput5);
+const mcu_pin_obj_t pin_P0_30 = PIN(P0_30, 0, 30, SAADC_CH_PSELP_PSELP_AnalogInput6);
+const mcu_pin_obj_t pin_P0_31 = PIN(P0_31, 0, 31, SAADC_CH_PSELP_PSELP_AnalogInput7);
+const mcu_pin_obj_t pin_P1_00 = PIN(P1_00, 1, 0, 0);
+const mcu_pin_obj_t pin_P1_01 = PIN(P1_01, 1, 1, 0);
+const mcu_pin_obj_t pin_P1_02 = PIN(P1_02, 1, 2, 0);
+const mcu_pin_obj_t pin_P1_03 = PIN(P1_03, 1, 3, 0);
+const mcu_pin_obj_t pin_P1_04 = PIN(P1_04, 1, 4, 0);
+const mcu_pin_obj_t pin_P1_05 = PIN(P1_05, 1, 5, 0);
+const mcu_pin_obj_t pin_P1_06 = PIN(P1_06, 1, 6, 0);
+const mcu_pin_obj_t pin_P1_07 = PIN(P1_07, 1, 7, 0);
+const mcu_pin_obj_t pin_P1_08 = PIN(P1_08, 1, 8, 0);
+const mcu_pin_obj_t pin_P1_09 = PIN(P1_09, 1, 9, 0);
+const mcu_pin_obj_t pin_P1_10 = PIN(P1_10, 1, 10, 0);
+const mcu_pin_obj_t pin_P1_11 = PIN(P1_11, 1, 11, 0);
+const mcu_pin_obj_t pin_P1_12 = PIN(P1_12, 1, 12, 0);
+const mcu_pin_obj_t pin_P1_13 = PIN(P1_13, 1, 13, 0);
+const mcu_pin_obj_t pin_P1_14 = PIN(P1_14, 1, 14, 0);
+const mcu_pin_obj_t pin_P1_15 = PIN(P1_15, 1, 15, 0);
diff --git a/ports/nrf/peripherals/nrf/nrf52840/pins.h b/ports/nrf/peripherals/nrf/nrf52840/pins.h
new file mode 100644
index 000000000..3ad72ff63
--- /dev/null
+++ b/ports/nrf/peripherals/nrf/nrf52840/pins.h
@@ -0,0 +1,79 @@
+/*
+ * This file is part of the MicroPython project, http://micropython.org/
+ *
+ * The MIT License (MIT)
+ *
+ * Copyright (c) 2018 by Dan Halbert for Adafruit Industries
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a copy
+ * of this software and associated documentation files (the "Software"), to deal
+ * in the Software without restriction, including without limitation the rights
+ * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+ * copies of the Software, and to permit persons to whom the Software is
+ * furnished to do so, subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice shall be included in
+ * all copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+ * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+ * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+ * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
+ * THE SOFTWARE.
+ */
+
+#ifndef MICROPY_INCLUDED_NRF_PERIPHERALS_NRF52840_PINS_H
+#define MICROPY_INCLUDED_NRF_PERIPHERALS_NRF52840_PINS_H
+
+extern const mcu_pin_obj_t pin_P0_00;
+extern const mcu_pin_obj_t pin_P0_01;
+extern const mcu_pin_obj_t pin_P0_02;
+extern const mcu_pin_obj_t pin_P0_03;
+extern const mcu_pin_obj_t pin_P0_04;
+extern const mcu_pin_obj_t pin_P0_05;
+extern const mcu_pin_obj_t pin_P0_06;
+extern const mcu_pin_obj_t pin_P0_07;
+extern const mcu_pin_obj_t pin_P0_08;
+extern const mcu_pin_obj_t pin_P0_09;
+extern const mcu_pin_obj_t pin_P0_10;
+extern const mcu_pin_obj_t pin_P0_11;
+extern const mcu_pin_obj_t pin_P0_12;
+extern const mcu_pin_obj_t pin_P0_13;
+extern const mcu_pin_obj_t pin_P0_14;
+extern const mcu_pin_obj_t pin_P0_15;
+extern const mcu_pin_obj_t pin_P0_16;
+extern const mcu_pin_obj_t pin_P0_17;
+extern const mcu_pin_obj_t pin_P0_18;
+extern const mcu_pin_obj_t pin_P0_19;
+extern const mcu_pin_obj_t pin_P0_20;
+extern const mcu_pin_obj_t pin_P0_21;
+extern const mcu_pin_obj_t pin_P0_22;
+extern const mcu_pin_obj_t pin_P0_23;
+extern const mcu_pin_obj_t pin_P0_24;
+extern const mcu_pin_obj_t pin_P0_25;
+extern const mcu_pin_obj_t pin_P0_26;
+extern const mcu_pin_obj_t pin_P0_27;
+extern const mcu_pin_obj_t pin_P0_28;
+extern const mcu_pin_obj_t pin_P0_29;
+extern const mcu_pin_obj_t pin_P0_30;
+extern const mcu_pin_obj_t pin_P0_31;
+extern const mcu_pin_obj_t pin_P1_00;
+extern const mcu_pin_obj_t pin_P1_01;
+extern const mcu_pin_obj_t pin_P1_02;
+extern const mcu_pin_obj_t pin_P1_03;
+extern const mcu_pin_obj_t pin_P1_04;
+extern const mcu_pin_obj_t pin_P1_05;
+extern const mcu_pin_obj_t pin_P1_06;
+extern const mcu_pin_obj_t pin_P1_07;
+extern const mcu_pin_obj_t pin_P1_08;
+extern const mcu_pin_obj_t pin_P1_09;
+extern const mcu_pin_obj_t pin_P1_10;
+extern const mcu_pin_obj_t pin_P1_11;
+extern const mcu_pin_obj_t pin_P1_12;
+extern const mcu_pin_obj_t pin_P1_13;
+extern const mcu_pin_obj_t pin_P1_14;
+extern const mcu_pin_obj_t pin_P1_15;
+
+#endif // MICROPY_INCLUDED_NRF_PERIPHERALS_NRF52840_PINS_H
diff --git a/ports/nrf/peripherals/nrf/pins.h b/ports/nrf/peripherals/nrf/pins.h
new file mode 100644
index 000000000..01aa9e956
--- /dev/null
+++ b/ports/nrf/peripherals/nrf/pins.h
@@ -0,0 +1,68 @@
+/*
+ * This file is part of the MicroPython project, http://micropython.org/
+ *
+ * The MIT License (MIT)
+ *
+ * Copyright (c) 2013, 2014 Damien P. George
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a copy
+ * of this software and associated documentation files (the "Software"), to deal
+ * in the Software without restriction, including without limitation the rights
+ * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+ * copies of the Software, and to permit persons to whom the Software is
+ * furnished to do so, subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice shall be included in
+ * all copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+ * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+ * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+ * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
+ * THE SOFTWARE.
+ */
+
+// DO NOT include this file directly. Use shared-bindings/microcontroller/Pin.h instead to ensure
+// that all necessary includes are already included.
+
+#ifndef __MICROPY_INCLUDED_NRF_PERIPHERALS_PINS_H__
+#define __MICROPY_INCLUDED_NRF_PERIPHERALS_PINS_H__
+
+#include <stdint.h>
+#include <stdbool.h>
+
+#include "nrf_gpio.h"
+
+typedef struct {
+ mp_obj_base_t base;
+ // These could be squeezed to fewer bits if more fields are needed.
+ uint8_t number; // port << 5 | pin number in port (0-31): 6 bits needed
+ uint8_t adc_channel; // 0 is no ADC, ADC channel from 1 to 8:
+ // 4 bits needed here; 5 bits used in periph registers
+} mcu_pin_obj_t;
+
+extern const mp_obj_type_t mcu_pin_type;
+
+// Used in device-specific pins.c
+#define PIN(p_name, p_port, p_pin, p_adc_channel) \
+{ \
+ { &mcu_pin_type }, \
+ .number = NRF_GPIO_PIN_MAP(p_port, p_pin), \
+ .adc_channel = (p_adc_channel), \
+}
+
+// Use illegal pin value to mark unassigned pins.
+#define NO_PIN 0xff
+
+// Choose based on chip, but not specifically revision (e.g., not NRF52832_XXAA)
+#ifdef NRF52832
+#include "nrf52832/pins.h"
+#endif
+
+#ifdef NRF52840
+#include "nrf52840/pins.h"
+#endif
+
+#endif // __MICROPY_INCLUDED_NRF_PERIPHERALS_PINS_H__
diff --git a/ports/nrf/supervisor/serial.c b/ports/nrf/supervisor/serial.c
index a822dc993..da7fe07fd 100644
--- a/ports/nrf/supervisor/serial.c
+++ b/ports/nrf/supervisor/serial.c
@@ -30,7 +30,6 @@
#include "ble_uart.h"
#else
#include "nrf_gpio.h"
-#include "nrf_pin.h"
#endif
#if !defined( NRF52840_XXAA) || ( defined(CFG_HWUART_FOR_SERIAL) && CFG_HWUART_FOR_SERIAL == 1 )
diff --git a/ports/nrf/usb/usb.c b/ports/nrf/usb/usb.c
index f8b5fd663..248d31e21 100644
--- a/ports/nrf/usb/usb.c
+++ b/ports/nrf/usb/usb.c
@@ -130,8 +130,8 @@ uint32_t tusb_hal_millis(void) {
void tud_cdc_line_state_cb(uint8_t itf, bool dtr, bool rts) {
(void) itf; // interface ID, not used
- // disconnected event
- if ( !dtr && !rts )
+ // DTR = false is counted as disconnected
+ if ( !dtr )
{
cdc_line_coding_t coding;
tud_cdc_get_line_coding(&coding);
diff --git a/supervisor/shared/rgb_led_status.c b/supervisor/shared/rgb_led_status.c
index aea656798..186e33ab9 100644
--- a/supervisor/shared/rgb_led_status.c
+++ b/supervisor/shared/rgb_led_status.c
@@ -71,7 +71,7 @@ void rgb_led_status_init() {
#else
if (!common_hal_busio_spi_deinited(&status_apa102)) {
// Don't use spi_deinit because that leads to infinite
- // recursion because reset_pin may call
+ // recursion because reset_pin_number may call
// rgb_led_status_init.
spi_m_sync_disable(&status_apa102.spi_desc);
}
@@ -103,11 +103,11 @@ void rgb_led_status_init() {
void reset_status_led() {
#ifdef MICROPY_HW_NEOPIXEL
- reset_pin(MICROPY_HW_NEOPIXEL->number);
+ reset_pin_number(MICROPY_HW_NEOPIXEL->number);
#endif
#if defined(MICROPY_HW_APA102_MOSI) && defined(MICROPY_HW_APA102_SCK)
- reset_pin(MICROPY_HW_APA102_MOSI->number);
- reset_pin(MICROPY_HW_APA102_SCK->number);
+ reset_pin_number(MICROPY_HW_APA102_MOSI->number);
+ reset_pin_number(MICROPY_HW_APA102_SCK->number);
#endif
}