summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorScott Shawcroft <scott@tannewt.org>2019-02-13 17:31:55 -0800
committerGitHub <noreply@github.com>2019-02-13 17:31:55 -0800
commita1a49590716915e28e97020c368b68b267c2b409 (patch)
tree22eea0c06e2e230adbadb67ad4c518a97db7fd8e
parentd6cbd5be925c50d28f2bc37536b0e01c9c88d153 (diff)
parentab4194f7528dd7df242abc087c6af0c05875cb49 (diff)
Merge pull request #1541 from dhalbert/nrf-two-uarts
nrf: Add second UARTE to busio.UART. Init uarts on startup.
-rw-r--r--locale/ID.po32
-rw-r--r--locale/circuitpython.pot28
-rw-r--r--locale/de_DE.po32
-rw-r--r--locale/en_US.po28
-rw-r--r--locale/es.po32
-rw-r--r--locale/fil.po32
-rw-r--r--locale/fr.po34
-rw-r--r--locale/it_IT.po34
-rw-r--r--locale/pt_BR.po32
-rw-r--r--ports/nrf/common-hal/busio/UART.c208
-rw-r--r--ports/nrf/common-hal/busio/UART.h4
-rw-r--r--ports/nrf/nrfx_config.h1
-rw-r--r--ports/nrf/supervisor/port.c2
13 files changed, 224 insertions, 275 deletions
diff --git a/locale/ID.po b/locale/ID.po
index cf0b40e0a..83a8ea2b4 100644
--- a/locale/ID.po
+++ b/locale/ID.po
@@ -8,7 +8,7 @@ msgid ""
msgstr ""
"Project-Id-Version: PACKAGE VERSION\n"
"Report-Msgid-Bugs-To: \n"
-"POT-Creation-Date: 2019-02-12 15:01-0800\n"
+"POT-Creation-Date: 2019-02-12 22:32-0500\n"
"PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n"
"Last-Translator: FULL NAME <EMAIL@ADDRESS>\n"
"Language-Team: LANGUAGE <LL@li.org>\n"
@@ -347,12 +347,12 @@ msgid "bytes > 8 bits not supported"
msgstr "byte > 8 bit tidak didukung"
#: ports/atmel-samd/common-hal/busio/UART.c:73
-#: ports/nrf/common-hal/busio/UART.c:91
+#: ports/nrf/common-hal/busio/UART.c:149
msgid "tx and rx cannot both be None"
msgstr "tx dan rx keduanya tidak boleh kosong"
#: ports/atmel-samd/common-hal/busio/UART.c:146
-#: ports/nrf/common-hal/busio/UART.c:132
+#: ports/nrf/common-hal/busio/UART.c:188
msgid "Failed to allocate RX buffer"
msgstr "Gagal untuk mengalokasikan buffer RX"
@@ -361,12 +361,12 @@ msgid "Could not initialize UART"
msgstr "Tidak dapat menginisialisasi UART"
#: ports/atmel-samd/common-hal/busio/UART.c:241
-#: ports/nrf/common-hal/busio/UART.c:174
+#: ports/nrf/common-hal/busio/UART.c:230
msgid "No RX pin"
msgstr "Tidak pin RX"
#: ports/atmel-samd/common-hal/busio/UART.c:300
-#: ports/nrf/common-hal/busio/UART.c:209
+#: ports/nrf/common-hal/busio/UART.c:265
msgid "No TX pin"
msgstr "Tidak ada pin TX"
@@ -850,27 +850,24 @@ msgstr "Semua perangkat I2C sedang digunakan"
msgid "All SPI peripherals are in use"
msgstr "Semua perangkat SPI sedang digunakan"
-#: ports/nrf/common-hal/busio/UART.c:49
+#: ports/nrf/common-hal/busio/UART.c:47
#, c-format
msgid "error = 0x%08lX"
msgstr "error = 0x%08lX"
-#: ports/nrf/common-hal/busio/UART.c:95
+#: ports/nrf/common-hal/busio/UART.c:145
+#, fuzzy
+msgid "All UART peripherals are in use"
+msgstr "Semua perangkat I2C sedang digunakan"
+
+#: ports/nrf/common-hal/busio/UART.c:153
msgid "Invalid buffer size"
msgstr "Ukuran buffer tidak valid"
-#: ports/nrf/common-hal/busio/UART.c:99
+#: ports/nrf/common-hal/busio/UART.c:157
msgid "Odd parity is not supported"
msgstr "Parity ganjil tidak didukung"
-#: ports/nrf/common-hal/busio/UART.c:335 ports/nrf/common-hal/busio/UART.c:339
-#: ports/nrf/common-hal/busio/UART.c:344 ports/nrf/common-hal/busio/UART.c:349
-#: ports/nrf/common-hal/busio/UART.c:355 ports/nrf/common-hal/busio/UART.c:360
-#: ports/nrf/common-hal/busio/UART.c:365 ports/nrf/common-hal/busio/UART.c:369
-#: ports/nrf/common-hal/busio/UART.c:377
-msgid "busio.UART not available"
-msgstr "busio.UART tidak tersedia"
-
#: ports/nrf/common-hal/microcontroller/Processor.c:48
#, fuzzy
msgid "Cannot get temperature"
@@ -2880,3 +2877,6 @@ msgstr ""
#~ "Please file an issue here with the contents of your CIRCUITPY drive:\n"
#~ msgstr ""
#~ "Silahkan taruh masalah disini dengan isi dari CIRCUITPY drive: anda \n"
+
+#~ msgid "busio.UART not available"
+#~ msgstr "busio.UART tidak tersedia"
diff --git a/locale/circuitpython.pot b/locale/circuitpython.pot
index 316766572..f9c0263c0 100644
--- a/locale/circuitpython.pot
+++ b/locale/circuitpython.pot
@@ -8,7 +8,7 @@ msgid ""
msgstr ""
"Project-Id-Version: PACKAGE VERSION\n"
"Report-Msgid-Bugs-To: \n"
-"POT-Creation-Date: 2019-02-12 15:01-0800\n"
+"POT-Creation-Date: 2019-02-12 22:32-0500\n"
"PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n"
"Last-Translator: FULL NAME <EMAIL@ADDRESS>\n"
"Language-Team: LANGUAGE <LL@li.org>\n"
@@ -340,12 +340,12 @@ msgid "bytes > 8 bits not supported"
msgstr ""
#: ports/atmel-samd/common-hal/busio/UART.c:73
-#: ports/nrf/common-hal/busio/UART.c:91
+#: ports/nrf/common-hal/busio/UART.c:149
msgid "tx and rx cannot both be None"
msgstr ""
#: ports/atmel-samd/common-hal/busio/UART.c:146
-#: ports/nrf/common-hal/busio/UART.c:132
+#: ports/nrf/common-hal/busio/UART.c:188
msgid "Failed to allocate RX buffer"
msgstr ""
@@ -354,12 +354,12 @@ msgid "Could not initialize UART"
msgstr ""
#: ports/atmel-samd/common-hal/busio/UART.c:241
-#: ports/nrf/common-hal/busio/UART.c:174
+#: ports/nrf/common-hal/busio/UART.c:230
msgid "No RX pin"
msgstr ""
#: ports/atmel-samd/common-hal/busio/UART.c:300
-#: ports/nrf/common-hal/busio/UART.c:209
+#: ports/nrf/common-hal/busio/UART.c:265
msgid "No TX pin"
msgstr ""
@@ -824,25 +824,21 @@ msgstr ""
msgid "All SPI peripherals are in use"
msgstr ""
-#: ports/nrf/common-hal/busio/UART.c:49
+#: ports/nrf/common-hal/busio/UART.c:47
#, c-format
msgid "error = 0x%08lX"
msgstr ""
-#: ports/nrf/common-hal/busio/UART.c:95
-msgid "Invalid buffer size"
+#: ports/nrf/common-hal/busio/UART.c:145
+msgid "All UART peripherals are in use"
msgstr ""
-#: ports/nrf/common-hal/busio/UART.c:99
-msgid "Odd parity is not supported"
+#: ports/nrf/common-hal/busio/UART.c:153
+msgid "Invalid buffer size"
msgstr ""
-#: ports/nrf/common-hal/busio/UART.c:335 ports/nrf/common-hal/busio/UART.c:339
-#: ports/nrf/common-hal/busio/UART.c:344 ports/nrf/common-hal/busio/UART.c:349
-#: ports/nrf/common-hal/busio/UART.c:355 ports/nrf/common-hal/busio/UART.c:360
-#: ports/nrf/common-hal/busio/UART.c:365 ports/nrf/common-hal/busio/UART.c:369
-#: ports/nrf/common-hal/busio/UART.c:377
-msgid "busio.UART not available"
+#: ports/nrf/common-hal/busio/UART.c:157
+msgid "Odd parity is not supported"
msgstr ""
#: ports/nrf/common-hal/microcontroller/Processor.c:48
diff --git a/locale/de_DE.po b/locale/de_DE.po
index c9fe9c691..509bc0488 100644
--- a/locale/de_DE.po
+++ b/locale/de_DE.po
@@ -7,7 +7,7 @@ msgid ""
msgstr ""
"Project-Id-Version: \n"
"Report-Msgid-Bugs-To: \n"
-"POT-Creation-Date: 2019-02-12 15:01-0800\n"
+"POT-Creation-Date: 2019-02-12 22:32-0500\n"
"PO-Revision-Date: 2018-07-27 11:55-0700\n"
"Last-Translator: Sebastian Plamauer\n"
"Language-Team: \n"
@@ -345,12 +345,12 @@ msgid "bytes > 8 bits not supported"
msgstr "bytes mit mehr als 8 bits werden nicht unterstützt"
#: ports/atmel-samd/common-hal/busio/UART.c:73
-#: ports/nrf/common-hal/busio/UART.c:91
+#: ports/nrf/common-hal/busio/UART.c:149
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:146
-#: ports/nrf/common-hal/busio/UART.c:132
+#: ports/nrf/common-hal/busio/UART.c:188
msgid "Failed to allocate RX buffer"
msgstr "Konnte keinen RX Buffer allozieren"
@@ -359,12 +359,12 @@ msgid "Could not initialize UART"
msgstr "Konnte UART nicht initialisieren"
#: ports/atmel-samd/common-hal/busio/UART.c:241
-#: ports/nrf/common-hal/busio/UART.c:174
+#: ports/nrf/common-hal/busio/UART.c:230
msgid "No RX pin"
msgstr "Kein RX Pin"
#: ports/atmel-samd/common-hal/busio/UART.c:300
-#: ports/nrf/common-hal/busio/UART.c:209
+#: ports/nrf/common-hal/busio/UART.c:265
msgid "No TX pin"
msgstr "Kein TX Pin"
@@ -833,27 +833,24 @@ msgstr "Alle I2C-Peripheriegeräte sind in Benutzung"
msgid "All SPI peripherals are in use"
msgstr "Alle SPI-Peripheriegeräte sind in Benutzung"
-#: ports/nrf/common-hal/busio/UART.c:49
+#: ports/nrf/common-hal/busio/UART.c:47
#, c-format
msgid "error = 0x%08lX"
msgstr "error = 0x%08lX"
-#: ports/nrf/common-hal/busio/UART.c:95
+#: ports/nrf/common-hal/busio/UART.c:145
+#, fuzzy
+msgid "All UART peripherals are in use"
+msgstr "Alle I2C-Peripheriegeräte sind in Benutzung"
+
+#: ports/nrf/common-hal/busio/UART.c:153
msgid "Invalid buffer size"
msgstr "Ungültige Puffergröße"
-#: ports/nrf/common-hal/busio/UART.c:99
+#: ports/nrf/common-hal/busio/UART.c:157
msgid "Odd parity is not supported"
msgstr "Ungerade Parität wird nicht unterstützt"
-#: ports/nrf/common-hal/busio/UART.c:335 ports/nrf/common-hal/busio/UART.c:339
-#: ports/nrf/common-hal/busio/UART.c:344 ports/nrf/common-hal/busio/UART.c:349
-#: ports/nrf/common-hal/busio/UART.c:355 ports/nrf/common-hal/busio/UART.c:360
-#: ports/nrf/common-hal/busio/UART.c:365 ports/nrf/common-hal/busio/UART.c:369
-#: ports/nrf/common-hal/busio/UART.c:377
-msgid "busio.UART not available"
-msgstr "busio.UART nicht verfügbar"
-
#: ports/nrf/common-hal/microcontroller/Processor.c:48
msgid "Cannot get temperature"
msgstr "Kann Temperatur nicht holen"
@@ -2854,3 +2851,6 @@ msgstr ""
#~ msgid "All PWM peripherals are in use"
#~ msgstr "Alle PWM-Peripheriegeräte werden verwendet"
+
+#~ msgid "busio.UART not available"
+#~ msgstr "busio.UART nicht verfügbar"
diff --git a/locale/en_US.po b/locale/en_US.po
index 54b8577c6..327a7f5f5 100644
--- a/locale/en_US.po
+++ b/locale/en_US.po
@@ -7,7 +7,7 @@ msgid ""
msgstr ""
"Project-Id-Version: \n"
"Report-Msgid-Bugs-To: \n"
-"POT-Creation-Date: 2019-02-12 15:01-0800\n"
+"POT-Creation-Date: 2019-02-12 22:32-0500\n"
"PO-Revision-Date: 2018-07-27 11:55-0700\n"
"Last-Translator: \n"
"Language-Team: \n"
@@ -340,12 +340,12 @@ msgid "bytes > 8 bits not supported"
msgstr ""
#: ports/atmel-samd/common-hal/busio/UART.c:73
-#: ports/nrf/common-hal/busio/UART.c:91
+#: ports/nrf/common-hal/busio/UART.c:149
msgid "tx and rx cannot both be None"
msgstr ""
#: ports/atmel-samd/common-hal/busio/UART.c:146
-#: ports/nrf/common-hal/busio/UART.c:132
+#: ports/nrf/common-hal/busio/UART.c:188
msgid "Failed to allocate RX buffer"
msgstr ""
@@ -354,12 +354,12 @@ msgid "Could not initialize UART"
msgstr ""
#: ports/atmel-samd/common-hal/busio/UART.c:241
-#: ports/nrf/common-hal/busio/UART.c:174
+#: ports/nrf/common-hal/busio/UART.c:230
msgid "No RX pin"
msgstr ""
#: ports/atmel-samd/common-hal/busio/UART.c:300
-#: ports/nrf/common-hal/busio/UART.c:209
+#: ports/nrf/common-hal/busio/UART.c:265
msgid "No TX pin"
msgstr ""
@@ -824,25 +824,21 @@ msgstr ""
msgid "All SPI peripherals are in use"
msgstr ""
-#: ports/nrf/common-hal/busio/UART.c:49
+#: ports/nrf/common-hal/busio/UART.c:47
#, c-format
msgid "error = 0x%08lX"
msgstr ""
-#: ports/nrf/common-hal/busio/UART.c:95
-msgid "Invalid buffer size"
+#: ports/nrf/common-hal/busio/UART.c:145
+msgid "All UART peripherals are in use"
msgstr ""
-#: ports/nrf/common-hal/busio/UART.c:99
-msgid "Odd parity is not supported"
+#: ports/nrf/common-hal/busio/UART.c:153
+msgid "Invalid buffer size"
msgstr ""
-#: ports/nrf/common-hal/busio/UART.c:335 ports/nrf/common-hal/busio/UART.c:339
-#: ports/nrf/common-hal/busio/UART.c:344 ports/nrf/common-hal/busio/UART.c:349
-#: ports/nrf/common-hal/busio/UART.c:355 ports/nrf/common-hal/busio/UART.c:360
-#: ports/nrf/common-hal/busio/UART.c:365 ports/nrf/common-hal/busio/UART.c:369
-#: ports/nrf/common-hal/busio/UART.c:377
-msgid "busio.UART not available"
+#: ports/nrf/common-hal/busio/UART.c:157
+msgid "Odd parity is not supported"
msgstr ""
#: ports/nrf/common-hal/microcontroller/Processor.c:48
diff --git a/locale/es.po b/locale/es.po
index c911d85b5..8183e64ea 100644
--- a/locale/es.po
+++ b/locale/es.po
@@ -8,7 +8,7 @@ msgid ""
msgstr ""
"Project-Id-Version: \n"
"Report-Msgid-Bugs-To: \n"
-"POT-Creation-Date: 2019-02-12 15:01-0800\n"
+"POT-Creation-Date: 2019-02-12 22:32-0500\n"
"PO-Revision-Date: 2018-08-24 22:56-0500\n"
"Last-Translator: \n"
"Language-Team: \n"
@@ -346,12 +346,12 @@ msgid "bytes > 8 bits not supported"
msgstr "bytes > 8 bits no soportados"
#: ports/atmel-samd/common-hal/busio/UART.c:73
-#: ports/nrf/common-hal/busio/UART.c:91
+#: ports/nrf/common-hal/busio/UART.c:149
msgid "tx and rx cannot both be None"
msgstr "Ambos tx y rx no pueden ser None"
#: ports/atmel-samd/common-hal/busio/UART.c:146
-#: ports/nrf/common-hal/busio/UART.c:132
+#: ports/nrf/common-hal/busio/UART.c:188
msgid "Failed to allocate RX buffer"
msgstr "Ha fallado la asignación del buffer RX"
@@ -360,12 +360,12 @@ msgid "Could not initialize UART"
msgstr "No se puede inicializar la UART"
#: ports/atmel-samd/common-hal/busio/UART.c:241
-#: ports/nrf/common-hal/busio/UART.c:174
+#: ports/nrf/common-hal/busio/UART.c:230
msgid "No RX pin"
msgstr "Sin pin RX"
#: ports/atmel-samd/common-hal/busio/UART.c:300
-#: ports/nrf/common-hal/busio/UART.c:209
+#: ports/nrf/common-hal/busio/UART.c:265
msgid "No TX pin"
msgstr "Sin pin TX"
@@ -847,27 +847,24 @@ msgstr "Todos los timers están siendo usados"
msgid "All SPI peripherals are in use"
msgstr "Todos los timers están siendo usados"
-#: ports/nrf/common-hal/busio/UART.c:49
+#: ports/nrf/common-hal/busio/UART.c:47
#, c-format
msgid "error = 0x%08lX"
msgstr "error = 0x%08lx"
-#: ports/nrf/common-hal/busio/UART.c:95
+#: ports/nrf/common-hal/busio/UART.c:145
+#, fuzzy
+msgid "All UART peripherals are in use"
+msgstr "Todos los timers están siendo usados"
+
+#: ports/nrf/common-hal/busio/UART.c:153
msgid "Invalid buffer size"
msgstr "Tamaño de buffer inválido"
-#: ports/nrf/common-hal/busio/UART.c:99
+#: ports/nrf/common-hal/busio/UART.c:157
msgid "Odd parity is not supported"
msgstr "Paridad impar no soportada"
-#: ports/nrf/common-hal/busio/UART.c:335 ports/nrf/common-hal/busio/UART.c:339
-#: ports/nrf/common-hal/busio/UART.c:344 ports/nrf/common-hal/busio/UART.c:349
-#: ports/nrf/common-hal/busio/UART.c:355 ports/nrf/common-hal/busio/UART.c:360
-#: ports/nrf/common-hal/busio/UART.c:365 ports/nrf/common-hal/busio/UART.c:369
-#: ports/nrf/common-hal/busio/UART.c:377
-msgid "busio.UART not available"
-msgstr "busio.UART no disponible"
-
#: ports/nrf/common-hal/microcontroller/Processor.c:48
#, fuzzy
msgid "Cannot get temperature"
@@ -2975,3 +2972,6 @@ msgstr ""
#~ msgid "Can not apply advertisement data. status: 0x%02x"
#~ msgstr "No se puede aplicar los datos de anuncio. status: 0x%02x"
+
+#~ msgid "busio.UART not available"
+#~ msgstr "busio.UART no disponible"
diff --git a/locale/fil.po b/locale/fil.po
index 187b35eb5..3adc339e6 100644
--- a/locale/fil.po
+++ b/locale/fil.po
@@ -7,7 +7,7 @@ msgid ""
msgstr ""
"Project-Id-Version: \n"
"Report-Msgid-Bugs-To: \n"
-"POT-Creation-Date: 2019-02-12 15:01-0800\n"
+"POT-Creation-Date: 2019-02-12 22:32-0500\n"
"PO-Revision-Date: 2018-12-20 22:15-0800\n"
"Last-Translator: Timothy <me@timothygarcia.ca>\n"
"Language-Team: fil\n"
@@ -344,12 +344,12 @@ msgid "bytes > 8 bits not supported"
msgstr "hindi sinusuportahan ang bytes > 8 bits"
#: ports/atmel-samd/common-hal/busio/UART.c:73
-#: ports/nrf/common-hal/busio/UART.c:91
+#: ports/nrf/common-hal/busio/UART.c:149
msgid "tx and rx cannot both be None"
msgstr "tx at rx hindi pwedeng parehas na None"
#: ports/atmel-samd/common-hal/busio/UART.c:146
-#: ports/nrf/common-hal/busio/UART.c:132
+#: ports/nrf/common-hal/busio/UART.c:188
msgid "Failed to allocate RX buffer"
msgstr "Nabigong ilaan ang RX buffer"
@@ -358,12 +358,12 @@ msgid "Could not initialize UART"
msgstr "Hindi ma-initialize ang UART"
#: ports/atmel-samd/common-hal/busio/UART.c:241
-#: ports/nrf/common-hal/busio/UART.c:174
+#: ports/nrf/common-hal/busio/UART.c:230
msgid "No RX pin"
msgstr "Walang RX pin"
#: ports/atmel-samd/common-hal/busio/UART.c:300
-#: ports/nrf/common-hal/busio/UART.c:209
+#: ports/nrf/common-hal/busio/UART.c:265
msgid "No TX pin"
msgstr "Walang TX pin"
@@ -848,27 +848,24 @@ msgstr "Lahat ng I2C peripherals ginagamit"
msgid "All SPI peripherals are in use"
msgstr "Lahat ng SPI peripherals ay ginagamit"
-#: ports/nrf/common-hal/busio/UART.c:49
+#: ports/nrf/common-hal/busio/UART.c:47
#, c-format
msgid "error = 0x%08lX"
msgstr "error = 0x%08lX"
-#: ports/nrf/common-hal/busio/UART.c:95
+#: ports/nrf/common-hal/busio/UART.c:145
+#, fuzzy
+msgid "All UART peripherals are in use"
+msgstr "Lahat ng I2C peripherals ginagamit"
+
+#: ports/nrf/common-hal/busio/UART.c:153
msgid "Invalid buffer size"
msgstr "Mali ang buffer size"
-#: ports/nrf/common-hal/busio/UART.c:99
+#: ports/nrf/common-hal/busio/UART.c:157
msgid "Odd parity is not supported"
msgstr "Odd na parity ay hindi supportado"
-#: ports/nrf/common-hal/busio/UART.c:335 ports/nrf/common-hal/busio/UART.c:339
-#: ports/nrf/common-hal/busio/UART.c:344 ports/nrf/common-hal/busio/UART.c:349
-#: ports/nrf/common-hal/busio/UART.c:355 ports/nrf/common-hal/busio/UART.c:360
-#: ports/nrf/common-hal/busio/UART.c:365 ports/nrf/common-hal/busio/UART.c:369
-#: ports/nrf/common-hal/busio/UART.c:377
-msgid "busio.UART not available"
-msgstr "busio.UART hindi available"
-
#: ports/nrf/common-hal/microcontroller/Processor.c:48
#, fuzzy
msgid "Cannot get temperature"
@@ -2981,3 +2978,6 @@ msgstr ""
#~ msgid "Can not apply advertisement data. status: 0x%02x"
#~ msgstr "Hindi ma i-apply ang advertisement data. status: 0x%02x"
+
+#~ msgid "busio.UART not available"
+#~ msgstr "busio.UART hindi available"
diff --git a/locale/fr.po b/locale/fr.po
index b26b7da37..674ef675e 100644
--- a/locale/fr.po
+++ b/locale/fr.po
@@ -7,7 +7,7 @@ msgid ""
msgstr ""
"Project-Id-Version: 0.1\n"
"Report-Msgid-Bugs-To: \n"
-"POT-Creation-Date: 2019-02-12 15:01-0800\n"
+"POT-Creation-Date: 2019-02-12 22:32-0500\n"
"PO-Revision-Date: 2018-12-23 20:05+0100\n"
"Last-Translator: Pierrick Couturier <arofarn@arofarn.info>\n"
"Language-Team: fr\n"
@@ -341,12 +341,12 @@ msgid "bytes > 8 bits not supported"
msgstr "octets > 8 bits non supporté"
#: ports/atmel-samd/common-hal/busio/UART.c:73
-#: ports/nrf/common-hal/busio/UART.c:91
+#: ports/nrf/common-hal/busio/UART.c:149
msgid "tx and rx cannot both be None"
msgstr "tx et rx ne peuvent être None tous les deux"
#: ports/atmel-samd/common-hal/busio/UART.c:146
-#: ports/nrf/common-hal/busio/UART.c:132
+#: ports/nrf/common-hal/busio/UART.c:188
msgid "Failed to allocate RX buffer"
msgstr "Echec de l'allocation du tampon RX"
@@ -355,12 +355,12 @@ msgid "Could not initialize UART"
msgstr "L'UART n'a pu être initialisé"
#: ports/atmel-samd/common-hal/busio/UART.c:241
-#: ports/nrf/common-hal/busio/UART.c:174
+#: ports/nrf/common-hal/busio/UART.c:230
msgid "No RX pin"
msgstr "Pas de broche RX"
#: ports/atmel-samd/common-hal/busio/UART.c:300
-#: ports/nrf/common-hal/busio/UART.c:209
+#: ports/nrf/common-hal/busio/UART.c:265
msgid "No TX pin"
msgstr "Pas de broche TX"
@@ -846,30 +846,26 @@ msgstr "Tous les périphériques I2C sont utilisés"
msgid "All SPI peripherals are in use"
msgstr "Tous les périphériques SPI sont utilisés"
-#: ports/nrf/common-hal/busio/UART.c:49
+#: ports/nrf/common-hal/busio/UART.c:47
#, c-format
msgid "error = 0x%08lX"
msgstr "erreur = 0x%08lX"
-#: ports/nrf/common-hal/busio/UART.c:95
+#: ports/nrf/common-hal/busio/UART.c:145
+#, fuzzy
+msgid "All UART peripherals are in use"
+msgstr "Tous les périphériques I2C sont utilisés"
+
+#: ports/nrf/common-hal/busio/UART.c:153
#, fuzzy
msgid "Invalid buffer size"
msgstr "longueur de tampon invalide"
-#: ports/nrf/common-hal/busio/UART.c:99
+#: ports/nrf/common-hal/busio/UART.c:157
#, fuzzy
msgid "Odd parity is not supported"
msgstr "parité impaire non supportée"
-#: ports/nrf/common-hal/busio/UART.c:335 ports/nrf/common-hal/busio/UART.c:339
-#: ports/nrf/common-hal/busio/UART.c:344 ports/nrf/common-hal/busio/UART.c:349
-#: ports/nrf/common-hal/busio/UART.c:355 ports/nrf/common-hal/busio/UART.c:360
-#: ports/nrf/common-hal/busio/UART.c:365 ports/nrf/common-hal/busio/UART.c:369
-#: ports/nrf/common-hal/busio/UART.c:377
-#, fuzzy
-msgid "busio.UART not available"
-msgstr "busio.UART n'est pas disponible"
-
#: ports/nrf/common-hal/microcontroller/Processor.c:48
#, fuzzy
msgid "Cannot get temperature"
@@ -3010,3 +3006,7 @@ msgstr ""
#~ msgid "Can not query for the device address."
#~ msgstr "Impossible d'obtenir l'adresse du périphérique"
+
+#, fuzzy
+#~ msgid "busio.UART not available"
+#~ msgstr "busio.UART n'est pas disponible"
diff --git a/locale/it_IT.po b/locale/it_IT.po
index b322b1017..4b797418e 100644
--- a/locale/it_IT.po
+++ b/locale/it_IT.po
@@ -8,7 +8,7 @@ msgid ""
msgstr ""
"Project-Id-Version: PACKAGE VERSION\n"
"Report-Msgid-Bugs-To: \n"
-"POT-Creation-Date: 2019-02-12 15:01-0800\n"
+"POT-Creation-Date: 2019-02-12 22:32-0500\n"
"PO-Revision-Date: 2018-10-02 16:27+0200\n"
"Last-Translator: Enrico Paganin <enrico.paganin@mail.com>\n"
"Language-Team: \n"
@@ -345,12 +345,12 @@ msgid "bytes > 8 bits not supported"
msgstr "byte > 8 bit non supportati"
#: ports/atmel-samd/common-hal/busio/UART.c:73
-#: ports/nrf/common-hal/busio/UART.c:91
+#: ports/nrf/common-hal/busio/UART.c:149
msgid "tx and rx cannot both be None"
msgstr "tx e rx non possono essere entrambi None"
#: ports/atmel-samd/common-hal/busio/UART.c:146
-#: ports/nrf/common-hal/busio/UART.c:132
+#: ports/nrf/common-hal/busio/UART.c:188
msgid "Failed to allocate RX buffer"
msgstr "Impossibile allocare buffer RX"
@@ -359,12 +359,12 @@ msgid "Could not initialize UART"
msgstr "Impossibile inizializzare l'UART"
#: ports/atmel-samd/common-hal/busio/UART.c:241
-#: ports/nrf/common-hal/busio/UART.c:174
+#: ports/nrf/common-hal/busio/UART.c:230
msgid "No RX pin"
msgstr "Nessun pin RX"
#: ports/atmel-samd/common-hal/busio/UART.c:300
-#: ports/nrf/common-hal/busio/UART.c:209
+#: ports/nrf/common-hal/busio/UART.c:265
msgid "No TX pin"
msgstr "Nessun pin TX"
@@ -847,30 +847,26 @@ msgstr "Tutte le periferiche I2C sono in uso"
msgid "All SPI peripherals are in use"
msgstr "Tutte le periferiche SPI sono in uso"
-#: ports/nrf/common-hal/busio/UART.c:49
+#: ports/nrf/common-hal/busio/UART.c:47
#, c-format
msgid "error = 0x%08lX"
msgstr ""
-#: ports/nrf/common-hal/busio/UART.c:95
+#: ports/nrf/common-hal/busio/UART.c:145
+#, fuzzy
+msgid "All UART peripherals are in use"
+msgstr "Tutte le periferiche I2C sono in uso"
+
+#: ports/nrf/common-hal/busio/UART.c:153
#, fuzzy
msgid "Invalid buffer size"
msgstr "lunghezza del buffer non valida"
-#: ports/nrf/common-hal/busio/UART.c:99
+#: ports/nrf/common-hal/busio/UART.c:157
#, fuzzy
msgid "Odd parity is not supported"
msgstr "operazione I2C non supportata"
-#: ports/nrf/common-hal/busio/UART.c:335 ports/nrf/common-hal/busio/UART.c:339
-#: ports/nrf/common-hal/busio/UART.c:344 ports/nrf/common-hal/busio/UART.c:349
-#: ports/nrf/common-hal/busio/UART.c:355 ports/nrf/common-hal/busio/UART.c:360
-#: ports/nrf/common-hal/busio/UART.c:365 ports/nrf/common-hal/busio/UART.c:369
-#: ports/nrf/common-hal/busio/UART.c:377
-#, fuzzy
-msgid "busio.UART not available"
-msgstr "busio.UART non ancora implementato"
-
#: ports/nrf/common-hal/microcontroller/Processor.c:48
#, fuzzy
msgid "Cannot get temperature"
@@ -2975,3 +2971,7 @@ msgstr ""
#~ msgid "Can not encode UUID, to check length."
#~ msgstr "Non è possibile codificare l'UUID, lunghezza da controllare."
+
+#, fuzzy
+#~ msgid "busio.UART not available"
+#~ msgstr "busio.UART non ancora implementato"
diff --git a/locale/pt_BR.po b/locale/pt_BR.po
index 1817cabc2..23a504f95 100644
--- a/locale/pt_BR.po
+++ b/locale/pt_BR.po
@@ -8,7 +8,7 @@ msgid ""
msgstr ""
"Project-Id-Version: PACKAGE VERSION\n"
"Report-Msgid-Bugs-To: \n"
-"POT-Creation-Date: 2019-02-12 15:01-0800\n"
+"POT-Creation-Date: 2019-02-12 22:32-0500\n"
"PO-Revision-Date: 2018-10-02 21:14-0000\n"
"Last-Translator: \n"
"Language-Team: \n"
@@ -340,12 +340,12 @@ msgid "bytes > 8 bits not supported"
msgstr "bytes > 8 bits não suportado"
#: ports/atmel-samd/common-hal/busio/UART.c:73
-#: ports/nrf/common-hal/busio/UART.c:91
+#: ports/nrf/common-hal/busio/UART.c:149
msgid "tx and rx cannot both be None"
msgstr "TX e RX não podem ser ambos"
#: ports/atmel-samd/common-hal/busio/UART.c:146
-#: ports/nrf/common-hal/busio/UART.c:132
+#: ports/nrf/common-hal/busio/UART.c:188
msgid "Failed to allocate RX buffer"
msgstr "Falha ao alocar buffer RX"
@@ -354,12 +354,12 @@ msgid "Could not initialize UART"
msgstr "Não foi possível inicializar o UART"
#: ports/atmel-samd/common-hal/busio/UART.c:241
-#: ports/nrf/common-hal/busio/UART.c:174
+#: ports/nrf/common-hal/busio/UART.c:230
msgid "No RX pin"
msgstr "Nenhum pino RX"
#: ports/atmel-samd/common-hal/busio/UART.c:300
-#: ports/nrf/common-hal/busio/UART.c:209
+#: ports/nrf/common-hal/busio/UART.c:265
msgid "No TX pin"
msgstr "Nenhum pino TX"
@@ -836,29 +836,26 @@ msgstr "Todos os periféricos I2C estão em uso"
msgid "All SPI peripherals are in use"
msgstr "Todos os periféricos SPI estão em uso"
-#: ports/nrf/common-hal/busio/UART.c:49
+#: ports/nrf/common-hal/busio/UART.c:47
#, c-format
msgid "error = 0x%08lX"
msgstr "erro = 0x%08lX"
-#: ports/nrf/common-hal/busio/UART.c:95
+#: ports/nrf/common-hal/busio/UART.c:145
+#, fuzzy
+msgid "All UART peripherals are in use"
+msgstr "Todos os periféricos I2C estão em uso"
+
+#: ports/nrf/common-hal/busio/UART.c:153
#, fuzzy
msgid "Invalid buffer size"
msgstr "Arquivo inválido"
-#: ports/nrf/common-hal/busio/UART.c:99
+#: ports/nrf/common-hal/busio/UART.c:157
#, fuzzy
msgid "Odd parity is not supported"
msgstr "I2C operação não suportada"
-#: ports/nrf/common-hal/busio/UART.c:335 ports/nrf/common-hal/busio/UART.c:339
-#: ports/nrf/common-hal/busio/UART.c:344 ports/nrf/common-hal/busio/UART.c:349
-#: ports/nrf/common-hal/busio/UART.c:355 ports/nrf/common-hal/busio/UART.c:360
-#: ports/nrf/common-hal/busio/UART.c:365 ports/nrf/common-hal/busio/UART.c:369
-#: ports/nrf/common-hal/busio/UART.c:377
-msgid "busio.UART not available"
-msgstr "busio.UART não disponível"
-
#: ports/nrf/common-hal/microcontroller/Processor.c:48
#, fuzzy
msgid "Cannot get temperature"
@@ -2888,3 +2885,6 @@ msgstr ""
#, fuzzy
#~ msgid "All PWM peripherals are in use"
#~ msgstr "Todos os temporizadores em uso"
+
+#~ msgid "busio.UART not available"
+#~ msgstr "busio.UART não disponível"
diff --git a/ports/nrf/common-hal/busio/UART.c b/ports/nrf/common-hal/busio/UART.c
index 43868f506..593914afc 100644
--- a/ports/nrf/common-hal/busio/UART.c
+++ b/ports/nrf/common-hal/busio/UART.c
@@ -39,8 +39,6 @@
#include "nrfx_uarte.h"
#include <string.h>
-#ifdef NRF52840_XXAA
-
// expression to examine, and return value in case of failing
#define _VERIFY_ERR(_exp) \
do {\
@@ -50,7 +48,49 @@
}\
}while(0)
-static uint32_t get_nrf_baud (uint32_t baudrate);
+static nrfx_uarte_t nrfx_uartes[] = {
+#if NRFX_CHECK(NRFX_UARTE0_ENABLED)
+ NRFX_UARTE_INSTANCE(0),
+#endif
+#if NRFX_CHECK(NRFX_UARTE1_ENABLED)
+ NRFX_UARTE_INSTANCE(1),
+#endif
+};
+
+static uint32_t get_nrf_baud (uint32_t baudrate) {
+
+ static const struct {
+ const uint32_t boundary;
+ nrf_uarte_baudrate_t uarte_baudraute;
+ } baudrate_map[] = {
+ { 1200, NRF_UARTE_BAUDRATE_1200 },
+ { 2400, NRF_UARTE_BAUDRATE_2400 },
+ { 4800, NRF_UARTE_BAUDRATE_4800 },
+ { 9600, NRF_UARTE_BAUDRATE_9600 },
+ { 14400, NRF_UARTE_BAUDRATE_14400 },
+ { 19200, NRF_UARTE_BAUDRATE_19200 },
+ { 28800, NRF_UARTE_BAUDRATE_28800 },
+ { 38400, NRF_UARTE_BAUDRATE_38400 },
+ { 57600, NRF_UARTE_BAUDRATE_57600 },
+ { 76800, NRF_UARTE_BAUDRATE_76800 },
+ { 115200, NRF_UARTE_BAUDRATE_115200 },
+ { 230400, NRF_UARTE_BAUDRATE_230400 },
+ { 250000, NRF_UARTE_BAUDRATE_250000 },
+ { 460800, NRF_UARTE_BAUDRATE_460800 },
+ { 921600, NRF_UARTE_BAUDRATE_921600 },
+ { 0, NRF_UARTE_BAUDRATE_1000000 },
+ };
+
+ size_t i = 0;
+ uint32_t boundary;
+ do {
+ boundary = baudrate_map[i].boundary;
+ if (baudrate <= boundary || boundary == 0) {
+ return baudrate_map[i].uarte_baudraute;
+ }
+ i++;
+ } while (true);
+}
static void uart_callback_irq (const nrfx_uarte_event_t * event, void * context) {
busio_uart_obj_t* self = (busio_uart_obj_t*) context;
@@ -60,7 +100,7 @@ static void uart_callback_irq (const nrfx_uarte_event_t * event, void * context)
ringbuf_put_n(&self->rbuf, event->data.rxtx.p_data, event->data.rxtx.bytes);
// keep receiving
- (void) nrfx_uarte_rx(&self->uarte, &self->rx_char, 1);
+ (void) nrfx_uarte_rx(self->uarte, &self->rx_char, 1);
break;
case NRFX_UARTE_EVT_TX_DONE:
@@ -74,7 +114,7 @@ static void uart_callback_irq (const nrfx_uarte_event_t * event, void * context)
ringbuf_put_n(&self->rbuf, event->data.error.rxtx.p_data, event->data.error.rxtx.bytes);
// Keep receiving
- (void) nrfx_uarte_rx(&self->uarte, &self->rx_char, 1);
+ (void) nrfx_uarte_rx(self->uarte, &self->rx_char, 1);
break;
default:
@@ -82,11 +122,29 @@ static void uart_callback_irq (const nrfx_uarte_event_t * event, void * context)
}
}
+void uart_reset(void) {
+ for (size_t i = 0 ; i < MP_ARRAY_SIZE(nrfx_uartes); i++) {
+ nrf_uarte_disable(nrfx_uartes[i].p_reg);
+ }
+}
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, mp_float_t timeout,
uint8_t receiver_buffer_size) {
+ // Find a free UART peripheral.
+ self->uarte = NULL;
+ for (size_t i = 0 ; i < MP_ARRAY_SIZE(nrfx_uartes); i++) {
+ if ((nrfx_uartes[i].p_reg->ENABLE & UARTE_ENABLE_ENABLE_Msk) == 0) {
+ self->uarte = &nrfx_uartes[i];
+ break;
+ }
+ }
+
+ if (self->uarte == NULL) {
+ mp_raise_ValueError(translate("All UART peripherals are in use"));
+ }
+
if ( (tx == mp_const_none) && (rx == mp_const_none) ) {
mp_raise_ValueError(translate("tx and rx cannot both be None"));
}
@@ -111,10 +169,8 @@ void common_hal_busio_uart_construct (busio_uart_obj_t *self,
.interrupt_priority = 7
};
- // support only 1 instance for now
- self->uarte = (nrfx_uarte_t ) NRFX_UARTE_INSTANCE(0);
- nrfx_uarte_uninit(&self->uarte);
- _VERIFY_ERR(nrfx_uarte_init(&self->uarte, &config, uart_callback_irq));
+ nrfx_uarte_uninit(self->uarte);
+ _VERIFY_ERR(nrfx_uarte_init(self->uarte, &config, uart_callback_irq));
// Init buffer for rx
if ( rx != mp_const_none ) {
@@ -128,7 +184,7 @@ void common_hal_busio_uart_construct (busio_uart_obj_t *self,
ringbuf_alloc(&self->rbuf, receiver_buffer_size, true);
if ( !self->rbuf.buf ) {
- nrfx_uarte_uninit(&self->uarte);
+ nrfx_uarte_uninit(self->uarte);
mp_raise_msg(&mp_type_MemoryError, translate("Failed to allocate RX buffer"));
}
@@ -147,7 +203,7 @@ void common_hal_busio_uart_construct (busio_uart_obj_t *self,
self->timeout_ms = timeout * 1000;
// Initial wait for incoming byte
- _VERIFY_ERR(nrfx_uarte_rx(&self->uarte, &self->rx_char, 1));
+ _VERIFY_ERR(nrfx_uarte_rx(self->uarte, &self->rx_char, 1));
}
bool common_hal_busio_uart_deinited(busio_uart_obj_t *self) {
@@ -156,7 +212,7 @@ bool common_hal_busio_uart_deinited(busio_uart_obj_t *self) {
void common_hal_busio_uart_deinit(busio_uart_obj_t *self) {
if ( !common_hal_busio_uart_deinited(self) ) {
- nrfx_uarte_uninit(&self->uarte);
+ nrfx_uarte_uninit(self->uarte);
reset_pin_number(self->tx_pin_number);
reset_pin_number(self->rx_pin_number);
self->tx_pin_number = NO_PIN;
@@ -170,7 +226,7 @@ void common_hal_busio_uart_deinit(busio_uart_obj_t *self) {
// Read characters.
size_t common_hal_busio_uart_read(busio_uart_obj_t *self, uint8_t *data, size_t len, int *errcode) {
- if ( nrf_uarte_rx_pin_get(self->uarte.p_reg) == NRF_UARTE_PSEL_DISCONNECTED ) {
+ if ( nrf_uarte_rx_pin_get(self->uarte->p_reg) == NRF_UARTE_PSEL_DISCONNECTED ) {
mp_raise_ValueError(translate("No RX pin"));
}
@@ -189,7 +245,7 @@ size_t common_hal_busio_uart_read(busio_uart_obj_t *self, uint8_t *data, size_t
}
// prevent conflict with uart irq
- NVIC_DisableIRQ(nrfx_get_irq_number(self->uarte.p_reg));
+ NVIC_DisableIRQ(nrfx_get_irq_number(self->uarte->p_reg));
// copy received data
rx_bytes = ringbuf_count(&self->rbuf);
@@ -198,14 +254,14 @@ size_t common_hal_busio_uart_read(busio_uart_obj_t *self, uint8_t *data, size_t
data[i] = ringbuf_get(&self->rbuf);
}
- NVIC_EnableIRQ(nrfx_get_irq_number(self->uarte.p_reg));
+ NVIC_EnableIRQ(nrfx_get_irq_number(self->uarte->p_reg));
return rx_bytes;
}
// Write characters.
size_t common_hal_busio_uart_write (busio_uart_obj_t *self, const uint8_t *data, size_t len, int *errcode) {
- if ( nrf_uarte_tx_pin_get(self->uarte.p_reg) == NRF_UARTE_PSEL_DISCONNECTED ) {
+ if ( nrf_uarte_tx_pin_get(self->uarte->p_reg) == NRF_UARTE_PSEL_DISCONNECTED ) {
mp_raise_ValueError(translate("No TX pin"));
}
@@ -214,7 +270,7 @@ size_t common_hal_busio_uart_write (busio_uart_obj_t *self, const uint8_t *data,
uint64_t start_ticks = ticks_ms;
// Wait for on-going transfer to complete
- while ( nrfx_uarte_tx_in_progress(&self->uarte) && (ticks_ms - start_ticks < self->timeout_ms) ) {
+ while ( nrfx_uarte_tx_in_progress(self->uarte) && (ticks_ms - start_ticks < self->timeout_ms) ) {
#ifdef MICROPY_VM_HOOK_LOOP
MICROPY_VM_HOOK_LOOP
#endif
@@ -229,15 +285,16 @@ size_t common_hal_busio_uart_write (busio_uart_obj_t *self, const uint8_t *data,
// EasyDMA can only access SRAM
uint8_t * tx_buf = (uint8_t*) data;
if ( !nrfx_is_in_ram(data) ) {
+ // TODO: If this is not too big, we could allocate it on the stack.
tx_buf = (uint8_t *) gc_alloc(len, false, false);
memcpy(tx_buf, data, len);
}
- (*errcode) = nrfx_uarte_tx(&self->uarte, tx_buf, len);
+ (*errcode) = nrfx_uarte_tx(self->uarte, tx_buf, len);
_VERIFY_ERR(*errcode);
(*errcode) = 0;
- while ( nrfx_uarte_tx_in_progress(&self->uarte) && (ticks_ms - start_ticks < self->timeout_ms) ) {
+ while ( nrfx_uarte_tx_in_progress(self->uarte) && (ticks_ms - start_ticks < self->timeout_ms) ) {
#ifdef MICROPY_VM_HOOK_LOOP
MICROPY_VM_HOOK_LOOP
#endif
@@ -256,7 +313,7 @@ uint32_t common_hal_busio_uart_get_baudrate(busio_uart_obj_t *self) {
void common_hal_busio_uart_set_baudrate(busio_uart_obj_t *self, uint32_t baudrate) {
self->baudrate = baudrate;
- nrf_uarte_baudrate_set(self->uarte.p_reg, get_nrf_baud(baudrate));
+ nrf_uarte_baudrate_set(self->uarte->p_reg, get_nrf_baud(baudrate));
}
uint32_t common_hal_busio_uart_rx_characters_available(busio_uart_obj_t *self) {
@@ -265,116 +322,11 @@ uint32_t common_hal_busio_uart_rx_characters_available(busio_uart_obj_t *self) {
void common_hal_busio_uart_clear_rx_buffer(busio_uart_obj_t *self) {
// prevent conflict with uart irq
- NVIC_DisableIRQ(nrfx_get_irq_number(self->uarte.p_reg));
+ NVIC_DisableIRQ(nrfx_get_irq_number(self->uarte->p_reg));
ringbuf_clear(&self->rbuf);
- NVIC_EnableIRQ(nrfx_get_irq_number(self->uarte.p_reg));
+ NVIC_EnableIRQ(nrfx_get_irq_number(self->uarte->p_reg));
}
bool common_hal_busio_uart_ready_to_tx(busio_uart_obj_t *self) {
- return !nrfx_uarte_tx_in_progress(&self->uarte);
-}
-
-static uint32_t get_nrf_baud (uint32_t baudrate)
-{
- if ( baudrate <= 1200 ) {
- return NRF_UARTE_BAUDRATE_1200;
- }
- else if ( baudrate <= 2400 ) {
- return NRF_UARTE_BAUDRATE_2400;
- }
- else if ( baudrate <= 4800 ) {
- return NRF_UARTE_BAUDRATE_4800;
- }
- else if ( baudrate <= 9600 ) {
- return NRF_UARTE_BAUDRATE_9600;
- }
- else if ( baudrate <= 14400 ) {
- return NRF_UARTE_BAUDRATE_14400;
- }
- else if ( baudrate <= 19200 ) {
- return NRF_UARTE_BAUDRATE_19200;
- }
- else if ( baudrate <= 28800 ) {
- return NRF_UARTE_BAUDRATE_28800;
- }
- else if ( baudrate <= 38400 ) {
- return NRF_UARTE_BAUDRATE_38400;
- }
- else if ( baudrate <= 57600 ) {
- return NRF_UARTE_BAUDRATE_57600;
- }
- else if ( baudrate <= 76800 ) {
- return NRF_UARTE_BAUDRATE_76800;
- }
- else if ( baudrate <= 115200 ) {
- return NRF_UARTE_BAUDRATE_115200;
- }
- else if ( baudrate <= 230400 ) {
- return NRF_UARTE_BAUDRATE_230400;
- }
- else if ( baudrate <= 250000 ) {
- return NRF_UARTE_BAUDRATE_250000;
- }
- else if ( baudrate <= 460800 ) {
- return NRF_UARTE_BAUDRATE_460800;
- }
- else if ( baudrate <= 921600 ) {
- return NRF_UARTE_BAUDRATE_921600;
- }
- else {
- return NRF_UARTE_BAUDRATE_1000000;
- }
-}
-
-#else
-
-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, float timeout,
- uint8_t receiver_buffer_size) {
- mp_raise_NotImplementedError(translate("busio.UART not available"));
-}
-
-bool common_hal_busio_uart_deinited (busio_uart_obj_t *self) {
- mp_raise_NotImplementedError(translate("busio.UART not available"));
- return true;
-}
-
-void common_hal_busio_uart_deinit (busio_uart_obj_t *self) {
- mp_raise_NotImplementedError(translate("busio.UART not available"));
-}
-
-// Read characters.
-size_t common_hal_busio_uart_read (busio_uart_obj_t *self, uint8_t *data, size_t len, int *errcode) {
- mp_raise_NotImplementedError(translate("busio.UART not available"));
- return 0;
+ return !nrfx_uarte_tx_in_progress(self->uarte);
}
-
-// Write characters.
-size_t common_hal_busio_uart_write (busio_uart_obj_t *self, const uint8_t *data, size_t len, int *errcode) {
- mp_raise_NotImplementedError(translate("busio.UART not available"));
- return 0;
-}
-
-uint32_t common_hal_busio_uart_get_baudrate (busio_uart_obj_t *self) {
- mp_raise_NotImplementedError(translate("busio.UART not available"));
- return self->baudrate;
-}
-
-void common_hal_busio_uart_set_baudrate (busio_uart_obj_t *self, uint32_t baudrate) {
- mp_raise_NotImplementedError(translate("busio.UART not available"));
-}
-
-uint32_t common_hal_busio_uart_rx_characters_available (busio_uart_obj_t *self) {
- mp_raise_NotImplementedError(translate("busio.UART not available"));
-}
-
-void common_hal_busio_uart_clear_rx_buffer (busio_uart_obj_t *self) {
-
-}
-
-bool common_hal_busio_uart_ready_to_tx (busio_uart_obj_t *self) {
- mp_raise_NotImplementedError(translate("busio.UART not available"));
- return false;
-}
-#endif
diff --git a/ports/nrf/common-hal/busio/UART.h b/ports/nrf/common-hal/busio/UART.h
index a8081dc1e..58432001c 100644
--- a/ports/nrf/common-hal/busio/UART.h
+++ b/ports/nrf/common-hal/busio/UART.h
@@ -36,7 +36,7 @@
typedef struct {
mp_obj_base_t base;
- nrfx_uarte_t uarte;
+ nrfx_uarte_t *uarte;
uint32_t baudrate;
uint32_t timeout_ms;
@@ -48,4 +48,6 @@ typedef struct {
uint8_t rx_pin_number;
} busio_uart_obj_t;
+void uart_reset(void);
+
#endif // MICROPY_INCLUDED_NRF_COMMON_HAL_BUSIO_UART_H
diff --git a/ports/nrf/nrfx_config.h b/ports/nrf/nrfx_config.h
index 8676bd7f8..62ceaea19 100644
--- a/ports/nrf/nrfx_config.h
+++ b/ports/nrf/nrfx_config.h
@@ -52,6 +52,7 @@
// UART
#define NRFX_UARTE_ENABLED 1
#define NRFX_UARTE0_ENABLED 1
+#define NRFX_UARTE1_ENABLED 1
// PWM
#define NRFX_PWM0_ENABLED 1
diff --git a/ports/nrf/supervisor/port.c b/ports/nrf/supervisor/port.c
index b2e98fd5b..fd077a46a 100644
--- a/ports/nrf/supervisor/port.c
+++ b/ports/nrf/supervisor/port.c
@@ -41,6 +41,7 @@
#include "common-hal/bleio/__init__.h"
#include "common-hal/busio/I2C.h"
#include "common-hal/busio/SPI.h"
+#include "common-hal/busio/UART.h"
#include "common-hal/pulseio/PWMOut.h"
#include "common-hal/pulseio/PulseOut.h"
#include "common-hal/pulseio/PulseIn.h"
@@ -84,6 +85,7 @@ void reset_port(void) {
i2c_reset();
spi_reset();
+ uart_reset();
pwmout_reset();
pulseout_reset();
pulsein_reset();