summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorScott Shawcroft <scott@adafruit.com>2019-11-27 15:36:04 -0800
committerGitHub <noreply@github.com>2019-11-27 15:36:04 -0800
commit83ecb1b65e24d970833d17d8322230ba05c5d527 (patch)
tree8879176ac3119b850d32bc9f3050aaead8c3ebee
parentd9c808d93886cbe071b4e1acd3730cf508dac3df (diff)
parentae52ec7c8591450b4953426f6bc21fe17d221531 (diff)
Merge pull request #2331 from dhalbert/uart-blocking-and-timeout
make UART.write be blocking on SAMD; add timeout property
-rw-r--r--locale/ID.po20
-rw-r--r--locale/circuitpython.pot8
-rw-r--r--locale/de_DE.po19
-rw-r--r--locale/en_US.po8
-rw-r--r--locale/en_x_pirate.po8
-rw-r--r--locale/es.po26
-rw-r--r--locale/fil.po28
-rw-r--r--locale/fr.po31
-rw-r--r--locale/it_IT.po25
-rw-r--r--locale/ko.po8
-rw-r--r--locale/pl.po25
-rw-r--r--locale/pt_BR.po20
-rw-r--r--locale/zh_Latn_pinyin.po28
-rw-r--r--ports/atmel-samd/boards/pyruler/mpconfigboard.mk4
-rw-r--r--ports/atmel-samd/common-hal/busio/UART.c36
-rw-r--r--ports/cxd56/common-hal/busio/UART.c12
-rw-r--r--ports/cxd56/common-hal/busio/UART.h2
-rw-r--r--ports/nrf/common-hal/busio/UART.c24
-rw-r--r--ports/stm32f4/common-hal/busio/UART.c98
-rw-r--r--shared-bindings/board/__init__.c6
-rw-r--r--shared-bindings/busio/UART.c46
-rw-r--r--shared-bindings/busio/UART.h3
-rw-r--r--shared-module/board/__init__.c2
23 files changed, 243 insertions, 244 deletions
diff --git a/locale/ID.po b/locale/ID.po
index fdbf3863b..6a0b73b6f 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-11-21 16:50-0800\n"
+"POT-Creation-Date: 2019-11-27 14:54-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"
@@ -2454,12 +2454,8 @@ msgstr ""
msgid "time.struct_time() takes a 9-sequence"
msgstr ""
-#: shared-bindings/time/__init__.c
-msgid "time.struct_time() takes exactly 1 argument"
-msgstr ""
-
#: shared-bindings/busio/UART.c
-msgid "timeout >100 (units are now seconds, not msecs)"
+msgid "timeout must be 0.0-100.0 seconds"
msgstr ""
#: shared-bindings/_bleio/CharacteristicBuffer.c
@@ -2734,7 +2730,7 @@ msgstr ""
#~ msgid "Failed to notify or indicate attribute value, err %0x04x"
#~ msgstr "Gagal untuk melaporkan nilai atribut, status: 0x%08lX"
-#, fuzzy, c-format
+#, fuzzy
#~ msgid "Failed to read CCCD value, err 0x%04x"
#~ msgstr "Gagal untuk membaca nilai atribut, status: 0x%08lX"
@@ -2742,11 +2738,11 @@ msgstr ""
#~ msgid "Failed to read attribute value, err %0x04x"
#~ msgstr "Gagal untuk membaca nilai atribut, status: 0x%08lX"
-#, fuzzy, c-format
+#, fuzzy
#~ msgid "Failed to read gatts value, err 0x%04x"
#~ msgstr "Gagal untuk menulis nilai gatts, status: 0x%08lX"
-#, fuzzy, c-format
+#, fuzzy
#~ msgid "Failed to register Vendor-Specific UUID, err 0x%04x"
#~ msgstr "Gagal untuk menambahkan Vendor Spesific UUID, status: 0x%08lX"
@@ -2766,7 +2762,7 @@ msgstr ""
#~ msgid "Failed to start scanning"
#~ msgstr "Gagal untuk melakukan scanning, status: 0x%08lX"
-#, fuzzy, c-format
+#, fuzzy
#~ msgid "Failed to start scanning, err 0x%04x"
#~ msgstr "Gagal untuk melakukan scanning, status: 0x%08lX"
@@ -2778,11 +2774,11 @@ msgstr ""
#~ msgid "Failed to stop advertising, err 0x%04x"
#~ msgstr "Gagal untuk memberhentikan advertisement, status: 0x%08lX"
-#, fuzzy, c-format
+#, fuzzy
#~ msgid "Failed to write attribute value, err 0x%04x"
#~ msgstr "Gagal untuk menulis nilai atribut, status: 0x%08lX"
-#, fuzzy, c-format
+#, fuzzy
#~ msgid "Failed to write gatts value, err 0x%04x"
#~ msgstr "Gagal untuk menulis nilai gatts, status: 0x%08lX"
diff --git a/locale/circuitpython.pot b/locale/circuitpython.pot
index 24278f33c..a24ab186a 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-11-21 16:50-0800\n"
+"POT-Creation-Date: 2019-11-27 14:54-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"
@@ -2423,12 +2423,8 @@ msgstr ""
msgid "time.struct_time() takes a 9-sequence"
msgstr ""
-#: shared-bindings/time/__init__.c
-msgid "time.struct_time() takes exactly 1 argument"
-msgstr ""
-
#: shared-bindings/busio/UART.c
-msgid "timeout >100 (units are now seconds, not msecs)"
+msgid "timeout must be 0.0-100.0 seconds"
msgstr ""
#: shared-bindings/_bleio/CharacteristicBuffer.c
diff --git a/locale/de_DE.po b/locale/de_DE.po
index ff4edd370..37937b94f 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-11-21 16:50-0800\n"
+"POT-Creation-Date: 2019-11-27 14:54-0500\n"
"PO-Revision-Date: 2018-07-27 11:55-0700\n"
"Last-Translator: Pascal Deneaux\n"
"Language-Team: Sebastian Plamauer, Pascal Deneaux\n"
@@ -2484,12 +2484,8 @@ msgstr "threshold muss im Intervall 0-65536 liegen"
msgid "time.struct_time() takes a 9-sequence"
msgstr ""
-#: shared-bindings/time/__init__.c
-msgid "time.struct_time() takes exactly 1 argument"
-msgstr ""
-
#: shared-bindings/busio/UART.c
-msgid "timeout >100 (units are now seconds, not msecs)"
+msgid "timeout must be 0.0-100.0 seconds"
msgstr ""
#: shared-bindings/_bleio/CharacteristicBuffer.c
@@ -2720,7 +2716,6 @@ msgstr ""
#~ msgid "Characteristic already in use by another Service."
#~ msgstr "Characteristic wird bereits von einem anderen Dienst verwendet."
-#, c-format
#~ msgid "Could not decode ble_uuid, err 0x%04x"
#~ msgstr "Konnte ble_uuid nicht decodieren. Status: 0x%04x"
@@ -2749,7 +2744,6 @@ msgstr ""
#~ msgid "Failed to add characteristic, err 0x%04x"
#~ msgstr "Hinzufügen des Characteristic ist gescheitert. Status: 0x%04x"
-#, c-format
#~ msgid "Failed to add descriptor, err 0x%04x"
#~ msgstr "Deskriptor konnte nicht hinzugefügt werden. Status: 0x%04x"
@@ -2789,22 +2783,18 @@ msgstr ""
#~ msgid "Failed to pair"
#~ msgstr "Koppeln fehlgeschlagen"
-#, c-format
#~ msgid "Failed to read CCCD value, err 0x%04x"
#~ msgstr "Kann CCCD value nicht lesen. Status: 0x%04x"
#~ msgid "Failed to read attribute value, err %0x04x"
#~ msgstr "Kann den Attributwert nicht lesen. Status: 0x%04x"
-#, c-format
#~ msgid "Failed to read attribute value, err 0x%04x"
#~ msgstr "Kann Attributwert nicht lesen, Status: 0x%04x"
-#, c-format
#~ msgid "Failed to read gatts value, err 0x%04x"
#~ msgstr "gatts value konnte nicht gelesen werden. Status: 0x%04x"
-#, c-format
#~ msgid "Failed to register Vendor-Specific UUID, err 0x%04x"
#~ msgstr "Kann keine herstellerspezifische UUID hinzufügen. Status: 0x%04x"
@@ -2820,7 +2810,6 @@ msgstr ""
#~ msgid "Failed to start advertising, err 0x%04x"
#~ msgstr "Kann advertisement nicht starten. Status: 0x%04x"
-#, c-format
#~ msgid "Failed to start connecting, error 0x%04x"
#~ msgstr "Verbindung konnte nicht hergestellt werden. Status: 0x%04x"
@@ -2830,7 +2819,6 @@ msgstr ""
#~ msgid "Failed to start scanning"
#~ msgstr "Der Scanvorgang kann nicht gestartet werden"
-#, c-format
#~ msgid "Failed to start scanning, err 0x%04x"
#~ msgstr "Der Scanvorgang kann nicht gestartet werden. Status: 0x%04x"
@@ -2840,15 +2828,12 @@ msgstr ""
#~ msgid "Failed to stop advertising, err 0x%04x"
#~ msgstr "Kann advertisement nicht stoppen. Status: 0x%04x"
-#, c-format
#~ msgid "Failed to write CCCD, err 0x%04x"
#~ msgstr "Konnte CCCD nicht schreiben, Status: 0x%04x"
-#, c-format
#~ msgid "Failed to write attribute value, err 0x%04x"
#~ msgstr "Kann den Attributwert nicht schreiben. Status: 0x%04x"
-#, c-format
#~ msgid "Failed to write gatts value, err 0x%04x"
#~ msgstr "gatts value konnte nicht geschrieben werden. Status: 0x%04x"
diff --git a/locale/en_US.po b/locale/en_US.po
index b8025aa98..e0e63e4fd 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-11-21 16:50-0800\n"
+"POT-Creation-Date: 2019-11-27 14:54-0500\n"
"PO-Revision-Date: 2018-07-27 11:55-0700\n"
"Last-Translator: \n"
"Language-Team: \n"
@@ -2423,12 +2423,8 @@ msgstr ""
msgid "time.struct_time() takes a 9-sequence"
msgstr ""
-#: shared-bindings/time/__init__.c
-msgid "time.struct_time() takes exactly 1 argument"
-msgstr ""
-
#: shared-bindings/busio/UART.c
-msgid "timeout >100 (units are now seconds, not msecs)"
+msgid "timeout must be 0.0-100.0 seconds"
msgstr ""
#: shared-bindings/_bleio/CharacteristicBuffer.c
diff --git a/locale/en_x_pirate.po b/locale/en_x_pirate.po
index a307167aa..b22687469 100644
--- a/locale/en_x_pirate.po
+++ b/locale/en_x_pirate.po
@@ -7,7 +7,7 @@ msgid ""
msgstr ""
"Project-Id-Version: \n"
"Report-Msgid-Bugs-To: \n"
-"POT-Creation-Date: 2019-11-21 16:50-0800\n"
+"POT-Creation-Date: 2019-11-27 14:54-0500\n"
"PO-Revision-Date: 2018-07-27 11:55-0700\n"
"Last-Translator: \n"
"Language-Team: @sommersoft, @MrCertainly\n"
@@ -2427,12 +2427,8 @@ msgstr ""
msgid "time.struct_time() takes a 9-sequence"
msgstr ""
-#: shared-bindings/time/__init__.c
-msgid "time.struct_time() takes exactly 1 argument"
-msgstr ""
-
#: shared-bindings/busio/UART.c
-msgid "timeout >100 (units are now seconds, not msecs)"
+msgid "timeout must be 0.0-100.0 seconds"
msgstr ""
#: shared-bindings/_bleio/CharacteristicBuffer.c
diff --git a/locale/es.po b/locale/es.po
index 07ad7fe1b..4e8df4195 100644
--- a/locale/es.po
+++ b/locale/es.po
@@ -7,7 +7,7 @@ msgid ""
msgstr ""
"Project-Id-Version: \n"
"Report-Msgid-Bugs-To: \n"
-"POT-Creation-Date: 2019-11-21 16:50-0800\n"
+"POT-Creation-Date: 2019-11-27 14:54-0500\n"
"PO-Revision-Date: 2018-08-24 22:56-0500\n"
"Last-Translator: \n"
"Language-Team: \n"
@@ -2487,13 +2487,9 @@ msgstr "limite debe ser en el rango 0-65536"
msgid "time.struct_time() takes a 9-sequence"
msgstr "time.struct_time() toma un sequencio 9"
-#: shared-bindings/time/__init__.c
-msgid "time.struct_time() takes exactly 1 argument"
-msgstr "time.struct_time() acepta exactamente 1 argumento"
-
#: shared-bindings/busio/UART.c
-msgid "timeout >100 (units are now seconds, not msecs)"
-msgstr "timepo muerto >100 (unidades en segundos)"
+msgid "timeout must be 0.0-100.0 seconds"
+msgstr ""
#: shared-bindings/_bleio/CharacteristicBuffer.c
msgid "timeout must be >= 0.0"
@@ -2718,7 +2714,6 @@ msgstr "paso cero"
#~ msgid "Characteristic already in use by another Service."
#~ msgstr "Características ya esta en uso por otro Serivice"
-#, c-format
#~ msgid "Could not decode ble_uuid, err 0x%04x"
#~ msgstr "No se puede descodificar ble_uuid, err 0x%04x"
@@ -2785,11 +2780,9 @@ msgstr "paso cero"
#~ msgid "Failed to notify or indicate attribute value, err %0x04x"
#~ msgstr "No se puede notificar el valor del anuncio. status: 0x%02x"
-#, c-format
#~ msgid "Failed to notify or indicate attribute value, err 0x%04x"
#~ msgstr "Error al notificar o indicar el valor del atributo, err 0x%04x"
-#, c-format
#~ msgid "Failed to read CCCD value, err 0x%04x"
#~ msgstr "No se puede leer el valor del atributo. err 0x%02x"
@@ -2797,15 +2790,13 @@ msgstr "paso cero"
#~ msgid "Failed to read attribute value, err %0x04x"
#~ msgstr "No se puede leer el valor del atributo. status 0x%02x"
-#, fuzzy, c-format
+#, fuzzy
#~ msgid "Failed to read attribute value, err 0x%04x"
#~ msgstr "Error al leer valor del atributo, err 0x%04"
-#, c-format
#~ msgid "Failed to read gatts value, err 0x%04x"
#~ msgstr "No se puede escribir el valor del atributo. status: 0x%02x"
-#, c-format
#~ msgid "Failed to register Vendor-Specific UUID, err 0x%04x"
#~ msgstr "Fallo al registrar el Vendor-Specific UUID, err 0x%04x"
@@ -2824,7 +2815,6 @@ msgstr "paso cero"
#~ msgid "Failed to start scanning"
#~ msgstr "No se puede iniciar el escaneo. status: 0x%02x"
-#, c-format
#~ msgid "Failed to start scanning, err 0x%04x"
#~ msgstr "No se puede iniciar el escaneo. err 0x%04x"
@@ -2835,11 +2825,9 @@ msgstr "paso cero"
#~ msgid "Failed to stop advertising, err 0x%04x"
#~ msgstr "No se puede detener el anuncio. err: 0x%04x"
-#, c-format
#~ msgid "Failed to write attribute value, err 0x%04x"
#~ msgstr "No se puede escribir el valor del atributo. err: 0x%04x"
-#, c-format
#~ msgid "Failed to write gatts value, err 0x%04x"
#~ msgstr "No se puede escribir el valor del atributo. err: 0x%04x"
@@ -3039,6 +3027,12 @@ msgstr "paso cero"
#~ msgid "tile index out of bounds"
#~ msgstr "el indice del tile fuera de limite"
+#~ msgid "time.struct_time() takes exactly 1 argument"
+#~ msgstr "time.struct_time() acepta exactamente 1 argumento"
+
+#~ msgid "timeout >100 (units are now seconds, not msecs)"
+#~ msgstr "timepo muerto >100 (unidades en segundos)"
+
#~ msgid "too many arguments"
#~ msgstr "muchos argumentos"
diff --git a/locale/fil.po b/locale/fil.po
index 8cf49583a..f3f2b7e3b 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-11-21 16:50-0800\n"
+"POT-Creation-Date: 2019-11-27 14:54-0500\n"
"PO-Revision-Date: 2018-12-20 22:15-0800\n"
"Last-Translator: Timothy <me@timothygarcia.ca>\n"
"Language-Team: fil\n"
@@ -2495,13 +2495,9 @@ msgstr "ang threshold ay dapat sa range 0-65536"
msgid "time.struct_time() takes a 9-sequence"
msgstr "time.struct_time() kumukuha ng 9-sequence"
-#: shared-bindings/time/__init__.c
-msgid "time.struct_time() takes exactly 1 argument"
-msgstr "time.struct_time() kumukuha ng 1 argument"
-
#: shared-bindings/busio/UART.c
-msgid "timeout >100 (units are now seconds, not msecs)"
-msgstr "timeout >100 (units ay seconds, hindi na msecs)"
+msgid "timeout must be 0.0-100.0 seconds"
+msgstr ""
#: shared-bindings/_bleio/CharacteristicBuffer.c
#, fuzzy
@@ -2789,7 +2785,7 @@ msgstr "zero step"
#~ msgid "Failed to notify or indicate attribute value, err %0x04x"
#~ msgstr "Hindi mabalitaan ang attribute value, status: 0x%08lX"
-#, fuzzy, c-format
+#, fuzzy
#~ msgid "Failed to read CCCD value, err 0x%04x"
#~ msgstr "Hindi mabasa ang value ng attribute, status: 0x%08lX"
@@ -2797,11 +2793,11 @@ msgstr "zero step"
#~ msgid "Failed to read attribute value, err %0x04x"
#~ msgstr "Hindi mabasa ang value ng attribute, status: 0x%08lX"
-#, fuzzy, c-format
+#, fuzzy
#~ msgid "Failed to read gatts value, err 0x%04x"
#~ msgstr "Hindi maisulat ang gatts value, status: 0x%08lX"
-#, fuzzy, c-format
+#, fuzzy
#~ msgid "Failed to register Vendor-Specific UUID, err 0x%04x"
#~ msgstr ""
#~ "Hindi matagumpay ang paglagay ng Vender Specific UUID, status: 0x%08lX"
@@ -2822,7 +2818,7 @@ msgstr "zero step"
#~ msgid "Failed to start scanning"
#~ msgstr "Hindi masimulaan mag i-scan, status: 0x%0xlX"
-#, fuzzy, c-format
+#, fuzzy
#~ msgid "Failed to start scanning, err 0x%04x"
#~ msgstr "Hindi masimulaan mag i-scan, status: 0x%0xlX"
@@ -2834,11 +2830,11 @@ msgstr "zero step"
#~ msgid "Failed to stop advertising, err 0x%04x"
#~ msgstr "Hindi mahinto ang advertisement, status: 0x%08lX"
-#, fuzzy, c-format
+#, fuzzy
#~ msgid "Failed to write attribute value, err 0x%04x"
#~ msgstr "Hindi maisulat ang attribute value, status: 0x%08lX"
-#, fuzzy, c-format
+#, fuzzy
#~ msgid "Failed to write gatts value, err 0x%04x"
#~ msgstr "Hindi maisulat ang gatts value, status: 0x%08lX"
@@ -3006,6 +3002,12 @@ msgstr "zero step"
#~ msgid "scan failed"
#~ msgstr "nabigo ang pag-scan"
+#~ msgid "time.struct_time() takes exactly 1 argument"
+#~ msgstr "time.struct_time() kumukuha ng 1 argument"
+
+#~ msgid "timeout >100 (units are now seconds, not msecs)"
+#~ msgstr "timeout >100 (units ay seconds, hindi na msecs)"
+
#~ msgid "too many arguments"
#~ msgstr "masyadong maraming argumento"
diff --git a/locale/fr.po b/locale/fr.po
index 3a3f81653..098bd8d1f 100644
--- a/locale/fr.po
+++ b/locale/fr.po
@@ -8,7 +8,7 @@ msgid ""
msgstr ""
"Project-Id-Version: 0.1\n"
"Report-Msgid-Bugs-To: \n"
-"POT-Creation-Date: 2019-11-21 16:50-0800\n"
+"POT-Creation-Date: 2019-11-27 14:54-0500\n"
"PO-Revision-Date: 2019-04-14 20:05+0100\n"
"Last-Translator: Pierrick Couturier <arofarn@arofarn.info>\n"
"Language-Team: fr\n"
@@ -2535,13 +2535,9 @@ msgstr "le seuil doit être dans la gamme 0-65536"
msgid "time.struct_time() takes a 9-sequence"
msgstr "time.struct_time() prend une séquence de longueur 9"
-#: shared-bindings/time/__init__.c
-msgid "time.struct_time() takes exactly 1 argument"
-msgstr "time.struct_time() prend exactement 1 argument"
-
#: shared-bindings/busio/UART.c
-msgid "timeout >100 (units are now seconds, not msecs)"
-msgstr "timeout >100 (exprimé en secondes, pas en ms)"
+msgid "timeout must be 0.0-100.0 seconds"
+msgstr ""
#: shared-bindings/_bleio/CharacteristicBuffer.c
#, fuzzy
@@ -2769,7 +2765,6 @@ msgstr "'step' nul"
#~ msgid "Characteristic already in use by another Service."
#~ msgstr "'Characteristic' déjà en utilisation par un autre service"
-#, c-format
#~ msgid "Could not decode ble_uuid, err 0x%04x"
#~ msgstr "Impossible de décoder le 'ble_uuid', err 0x%04x"
@@ -2840,12 +2835,11 @@ msgstr "'step' nul"
#~ msgid "Failed to notify or indicate attribute value, err %0x04x"
#~ msgstr "Impossible de notifier la valeur de l'attribut. status: 0x%08lX"
-#, c-format
#~ msgid "Failed to notify or indicate attribute value, err 0x%04x"
#~ msgstr ""
#~ "Impossible de notifier ou d'indiquer la valeur de l'attribut, err 0x%04x"
-#, fuzzy, c-format
+#, fuzzy
#~ msgid "Failed to read CCCD value, err 0x%04x"
#~ msgstr "Impossible de lire la valeur 'CCCD', err 0x%04x"
@@ -2853,15 +2847,14 @@ msgstr "'step' nul"
#~ msgid "Failed to read attribute value, err %0x04x"
#~ msgstr "Impossible de lire la valeur de l'attribut. status: 0x%08lX"
-#, c-format
#~ msgid "Failed to read attribute value, err 0x%04x"
#~ msgstr "Impossible de lire la valeur de l'attribut, err 0x%04x"
-#, fuzzy, c-format
+#, fuzzy
#~ msgid "Failed to read gatts value, err 0x%04x"
#~ msgstr "Impossible de lire la valeur de 'gatts', err 0x%04x"
-#, fuzzy, c-format
+#, fuzzy
#~ msgid "Failed to register Vendor-Specific UUID, err 0x%04x"
#~ msgstr "Echec de l'ajout de l'UUID du fournisseur, err 0x%04x"
@@ -2881,7 +2874,7 @@ msgstr "'step' nul"
#~ msgid "Failed to start scanning"
#~ msgstr "Impossible de commencer à scanner"
-#, fuzzy, c-format
+#, fuzzy
#~ msgid "Failed to start scanning, err 0x%04x"
#~ msgstr "Impossible de commencer à scanner, err 0x%04x"
@@ -2893,11 +2886,11 @@ msgstr "'step' nul"
#~ msgid "Failed to stop advertising, err 0x%04x"
#~ msgstr "Echec de l'arrêt de diffusion, err 0x%04x"
-#, fuzzy, c-format
+#, fuzzy
#~ msgid "Failed to write attribute value, err 0x%04x"
#~ msgstr "Impossible d'écrire la valeur de l'attribut, err 0x%04x"
-#, fuzzy, c-format
+#, fuzzy
#~ msgid "Failed to write gatts value, err 0x%04x"
#~ msgstr "Impossible d'écrire la valeur de 'gatts', err 0x%04x"
@@ -3091,6 +3084,12 @@ msgstr "'step' nul"
#~ msgid "tile index out of bounds"
#~ msgstr "indice de tuile hors limites"
+#~ msgid "time.struct_time() takes exactly 1 argument"
+#~ msgstr "time.struct_time() prend exactement 1 argument"
+
+#~ msgid "timeout >100 (units are now seconds, not msecs)"
+#~ msgstr "timeout >100 (exprimé en secondes, pas en ms)"
+
#~ msgid "too many arguments"
#~ msgstr "trop d'arguments"
diff --git a/locale/it_IT.po b/locale/it_IT.po
index 30d843142..154dda932 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-11-21 16:50-0800\n"
+"POT-Creation-Date: 2019-11-27 14:54-0500\n"
"PO-Revision-Date: 2018-10-02 16:27+0200\n"
"Last-Translator: Enrico Paganin <enrico.paganin@mail.com>\n"
"Language-Team: \n"
@@ -2494,12 +2494,8 @@ msgstr "la soglia deve essere nell'intervallo 0-65536"
msgid "time.struct_time() takes a 9-sequence"
msgstr ""
-#: shared-bindings/time/__init__.c
-msgid "time.struct_time() takes exactly 1 argument"
-msgstr "time.struct_time() prende esattamente un argomento"
-
#: shared-bindings/busio/UART.c
-msgid "timeout >100 (units are now seconds, not msecs)"
+msgid "timeout must be 0.0-100.0 seconds"
msgstr ""
#: shared-bindings/_bleio/CharacteristicBuffer.c
@@ -2790,11 +2786,10 @@ msgstr "zero step"
#~ msgid "Failed to notify or indicate attribute value, err %0x04x"
#~ msgstr "Impossibile notificare valore dell'attributo. status: 0x%02x"
-#, c-format
#~ msgid "Failed to notify or indicate attribute value, err 0x%04x"
#~ msgstr "Notificamento o indicazione di attribute value fallito, err 0x%04x"
-#, fuzzy, c-format
+#, fuzzy
#~ msgid "Failed to read CCCD value, err 0x%04x"
#~ msgstr "Impossibile leggere valore dell'attributo. status: 0x%02x"
@@ -2802,15 +2797,14 @@ msgstr "zero step"
#~ msgid "Failed to read attribute value, err %0x04x"
#~ msgstr "Impossibile leggere valore dell'attributo. status: 0x%02x"
-#, c-format
#~ msgid "Failed to read attribute value, err 0x%04x"
#~ msgstr "Tentative leggere attribute value fallito, err 0x%04x"
-#, fuzzy, c-format
+#, fuzzy
#~ msgid "Failed to read gatts value, err 0x%04x"
#~ msgstr "Impossibile scrivere valore dell'attributo. status: 0x%02x"
-#, fuzzy, c-format
+#, fuzzy
#~ msgid "Failed to register Vendor-Specific UUID, err 0x%04x"
#~ msgstr "Non è possibile aggiungere l'UUID del vendor specifico da 128-bit"
@@ -2830,7 +2824,7 @@ msgstr "zero step"
#~ msgid "Failed to start scanning"
#~ msgstr "Impossible iniziare la scansione. status: 0x%02x"
-#, fuzzy, c-format
+#, fuzzy
#~ msgid "Failed to start scanning, err 0x%04x"
#~ msgstr "Impossible iniziare la scansione. status: 0x%02x"
@@ -2842,11 +2836,11 @@ msgstr "zero step"
#~ msgid "Failed to stop advertising, err 0x%04x"
#~ msgstr "Impossibile fermare advertisement. status: 0x%02x"
-#, fuzzy, c-format
+#, fuzzy
#~ msgid "Failed to write attribute value, err 0x%04x"
#~ msgstr "Impossibile scrivere valore dell'attributo. status: 0x%02x"
-#, fuzzy, c-format
+#, fuzzy
#~ msgid "Failed to write gatts value, err 0x%04x"
#~ msgstr "Impossibile scrivere valore dell'attributo. status: 0x%02x"
@@ -3008,6 +3002,9 @@ msgstr "zero step"
#~ msgid "scan failed"
#~ msgstr "scansione fallita"
+#~ msgid "time.struct_time() takes exactly 1 argument"
+#~ msgstr "time.struct_time() prende esattamente un argomento"
+
#~ msgid "too many arguments"
#~ msgstr "troppi argomenti"
diff --git a/locale/ko.po b/locale/ko.po
index 1452bd7e7..5fc91553b 100644
--- a/locale/ko.po
+++ b/locale/ko.po
@@ -8,7 +8,7 @@ msgid ""
msgstr ""
"Project-Id-Version: PACKAGE VERSION\n"
"Report-Msgid-Bugs-To: \n"
-"POT-Creation-Date: 2019-11-21 16:50-0800\n"
+"POT-Creation-Date: 2019-11-27 14:54-0500\n"
"PO-Revision-Date: 2019-05-06 14:22-0700\n"
"Last-Translator: \n"
"Language-Team: LANGUAGE <LL@li.org>\n"
@@ -2428,12 +2428,8 @@ msgstr ""
msgid "time.struct_time() takes a 9-sequence"
msgstr ""
-#: shared-bindings/time/__init__.c
-msgid "time.struct_time() takes exactly 1 argument"
-msgstr ""
-
#: shared-bindings/busio/UART.c
-msgid "timeout >100 (units are now seconds, not msecs)"
+msgid "timeout must be 0.0-100.0 seconds"
msgstr ""
#: shared-bindings/_bleio/CharacteristicBuffer.c
diff --git a/locale/pl.po b/locale/pl.po
index ed5796432..edfce95c6 100644
--- a/locale/pl.po
+++ b/locale/pl.po
@@ -7,7 +7,7 @@ msgid ""
msgstr ""
"Project-Id-Version: \n"
"Report-Msgid-Bugs-To: \n"
-"POT-Creation-Date: 2019-11-21 16:50-0800\n"
+"POT-Creation-Date: 2019-11-27 14:54-0500\n"
"PO-Revision-Date: 2019-03-19 18:37-0700\n"
"Last-Translator: Radomir Dopieralski <circuitpython@sheep.art.pl>\n"
"Language-Team: pl\n"
@@ -2450,13 +2450,9 @@ msgstr "threshold musi być w zakresie 0-65536"
msgid "time.struct_time() takes a 9-sequence"
msgstr "time.struct_time() wymaga 9-elementowej sekwencji"
-#: shared-bindings/time/__init__.c
-msgid "time.struct_time() takes exactly 1 argument"
-msgstr "time.struct_time() wymaga jednego argumentu"
-
#: shared-bindings/busio/UART.c
-msgid "timeout >100 (units are now seconds, not msecs)"
-msgstr "timeout > 100 (jednostkami są sekundy)"
+msgid "timeout must be 0.0-100.0 seconds"
+msgstr ""
#: shared-bindings/_bleio/CharacteristicBuffer.c
msgid "timeout must be >= 0.0"
@@ -2664,7 +2660,6 @@ msgstr "zerowy krok"
#~ msgid "Characteristic already in use by another Service."
#~ msgstr "Charakterystyka w użyciu w innym serwisie"
-#, c-format
#~ msgid "Could not decode ble_uuid, err 0x%04x"
#~ msgstr "Nie można zdekodować ble_uuid, błąd 0x%04x"
@@ -2708,23 +2703,18 @@ msgstr "zerowy krok"
#~ msgid "Failed to get softdevice state"
#~ msgstr "Nie udało się odczytać stanu softdevice"
-#, c-format
#~ msgid "Failed to notify or indicate attribute value, err 0x%04x"
#~ msgstr "Nie udało się powiadomić o wartości atrybutu, błąd 0x%04x"
-#, c-format
#~ msgid "Failed to read CCCD value, err 0x%04x"
#~ msgstr "Nie udało się odczytać CCCD, błąd 0x%04x"
-#, c-format
#~ msgid "Failed to read attribute value, err 0x%04x"
#~ msgstr "Nie udało się odczytać wartości atrybutu, błąd 0x%04x"
-#, c-format
#~ msgid "Failed to read gatts value, err 0x%04x"
#~ msgstr "Nie udało się odczytać gatts, błąd 0x%04x"
-#, c-format
#~ msgid "Failed to register Vendor-Specific UUID, err 0x%04x"
#~ msgstr "Nie udało się zarejestrować UUID dostawcy, błąd 0x%04x"
@@ -2740,7 +2730,6 @@ msgstr "zerowy krok"
#~ msgid "Failed to start scanning"
#~ msgstr "Nie udało się rozpocząć skanowania"
-#, c-format
#~ msgid "Failed to start scanning, err 0x%04x"
#~ msgstr "Nie udało się rozpocząć skanowania, błąd 0x%04x"
@@ -2750,11 +2739,9 @@ msgstr "zerowy krok"
#~ msgid "Failed to stop advertising, err 0x%04x"
#~ msgstr "Nie udało się zatrzymać rozgłaszania, błąd 0x%04x"
-#, c-format
#~ msgid "Failed to write attribute value, err 0x%04x"
#~ msgstr "Nie udało się zapisać atrybutu, błąd 0x%04x"
-#, c-format
#~ msgid "Failed to write gatts value, err 0x%04x"
#~ msgstr "Nie udało się zapisać gatts, błąd 0x%04x"
@@ -2805,3 +2792,9 @@ msgstr "zerowy krok"
#~ msgid "tile index out of bounds"
#~ msgstr "indeks kafelka poza zakresem"
+
+#~ msgid "time.struct_time() takes exactly 1 argument"
+#~ msgstr "time.struct_time() wymaga jednego argumentu"
+
+#~ msgid "timeout >100 (units are now seconds, not msecs)"
+#~ msgstr "timeout > 100 (jednostkami są sekundy)"
diff --git a/locale/pt_BR.po b/locale/pt_BR.po
index 715a8345d..a2b259fc4 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-11-21 16:50-0800\n"
+"POT-Creation-Date: 2019-11-27 14:54-0500\n"
"PO-Revision-Date: 2018-10-02 21:14-0000\n"
"Last-Translator: \n"
"Language-Team: \n"
@@ -2447,12 +2447,8 @@ msgstr "Limite deve estar no alcance de 0-65536"
msgid "time.struct_time() takes a 9-sequence"
msgstr ""
-#: shared-bindings/time/__init__.c
-msgid "time.struct_time() takes exactly 1 argument"
-msgstr ""
-
#: shared-bindings/busio/UART.c
-msgid "timeout >100 (units are now seconds, not msecs)"
+msgid "timeout must be 0.0-100.0 seconds"
msgstr ""
#: shared-bindings/_bleio/CharacteristicBuffer.c
@@ -2712,7 +2708,7 @@ msgstr "passo zero"
#~ msgid "Failed to notify or indicate attribute value, err %0x04x"
#~ msgstr "Não é possível gravar o valor do atributo. status: 0x%02x"
-#, fuzzy, c-format
+#, fuzzy
#~ msgid "Failed to read CCCD value, err 0x%04x"
#~ msgstr "Não é possível ler o valor do atributo. status: 0x%02x"
@@ -2720,11 +2716,11 @@ msgstr "passo zero"
#~ msgid "Failed to read attribute value, err %0x04x"
#~ msgstr "Não é possível ler o valor do atributo. status: 0x%02x"
-#, fuzzy, c-format
+#, fuzzy
#~ msgid "Failed to read gatts value, err 0x%04x"
#~ msgstr "Não é possível gravar o valor do atributo. status: 0x%02x"
-#, fuzzy, c-format
+#, fuzzy
#~ msgid "Failed to register Vendor-Specific UUID, err 0x%04x"
#~ msgstr ""
#~ "Não é possível adicionar o UUID de 128 bits específico do fornecedor."
@@ -2745,7 +2741,7 @@ msgstr "passo zero"
#~ msgid "Failed to start scanning"
#~ msgstr "Não é possível iniciar o anúncio. status: 0x%02x"
-#, fuzzy, c-format
+#, fuzzy
#~ msgid "Failed to start scanning, err 0x%04x"
#~ msgstr "Não é possível iniciar o anúncio. status: 0x%02x"
@@ -2757,11 +2753,11 @@ msgstr "passo zero"
#~ msgid "Failed to stop advertising, err 0x%04x"
#~ msgstr "Não pode parar propaganda. status: 0x%02x"
-#, fuzzy, c-format
+#, fuzzy
#~ msgid "Failed to write attribute value, err 0x%04x"
#~ msgstr "Não é possível gravar o valor do atributo. status: 0x%02x"
-#, fuzzy, c-format
+#, fuzzy
#~ msgid "Failed to write gatts value, err 0x%04x"
#~ msgstr "Não é possível gravar o valor do atributo. status: 0x%02x"
diff --git a/locale/zh_Latn_pinyin.po b/locale/zh_Latn_pinyin.po
index fae8b1b32..b45650d87 100644
--- a/locale/zh_Latn_pinyin.po
+++ b/locale/zh_Latn_pinyin.po
@@ -7,7 +7,7 @@ msgid ""
msgstr ""
"Project-Id-Version: circuitpython-cn\n"
"Report-Msgid-Bugs-To: \n"
-"POT-Creation-Date: 2019-11-21 16:50-0800\n"
+"POT-Creation-Date: 2019-11-27 14:54-0500\n"
"PO-Revision-Date: 2019-04-13 10:10-0700\n"
"Last-Translator: hexthat\n"
"Language-Team: Chinese Hanyu Pinyin\n"
@@ -2463,13 +2463,9 @@ msgstr "yùzhí bìxū zài fànwéi 0-65536"
msgid "time.struct_time() takes a 9-sequence"
msgstr "time.struct_time() xūyào 9 xùliè"
-#: shared-bindings/time/__init__.c
-msgid "time.struct_time() takes exactly 1 argument"
-msgstr "time.struct_time() xūyào wánquán 1 cānshù"
-
#: shared-bindings/busio/UART.c
-msgid "timeout >100 (units are now seconds, not msecs)"
-msgstr "chāoshí >100 (dānwèi shì miǎo, ér bùshì háomiǎo)"
+msgid "timeout must be 0.0-100.0 seconds"
+msgstr ""
#: shared-bindings/_bleio/CharacteristicBuffer.c
msgid "timeout must be >= 0.0"
@@ -2680,7 +2676,6 @@ msgstr "líng bù"
#~ msgid "Characteristic already in use by another Service."
#~ msgstr "Qítā fúwù bùmén yǐ shǐyòng de gōngnéng."
-#, c-format
#~ msgid "Could not decode ble_uuid, err 0x%04x"
#~ msgstr "Wúfǎ jiěmǎ kě dú_uuid, err 0x%04x"
@@ -2696,7 +2691,6 @@ msgstr "líng bù"
#~ msgid "Failed to add characteristic, err 0x%04x"
#~ msgstr "Tiānjiā tèxìng shībài, err 0x%04x"
-#, c-format
#~ msgid "Failed to add descriptor, err 0x%04x"
#~ msgstr "Wúfǎ tiānjiā miáoshù fú, err 0x%04x"
@@ -2733,26 +2727,21 @@ msgstr "líng bù"
#~ msgid "Failed to get softdevice state"
#~ msgstr "Wúfǎ huòdé ruǎnjiàn shèbèi zhuàngtài"
-#, c-format
#~ msgid "Failed to notify or indicate attribute value, err 0x%04x"
#~ msgstr "Wúfǎ tōngzhī huò xiǎnshì shǔxìng zhí, err 0x%04x"
#~ msgid "Failed to pair"
#~ msgstr "Pèiduì shībài"
-#, c-format
#~ msgid "Failed to read CCCD value, err 0x%04x"
#~ msgstr "Dòu qǔ CCCD zhí, err 0x%04x shībài"
-#, c-format
#~ msgid "Failed to read attribute value, err 0x%04x"
#~ msgstr "Dòu qǔ shǔxìng zhí shībài, err 0x%04x"
-#, c-format
#~ msgid "Failed to read gatts value, err 0x%04x"
#~ msgstr "Wúfǎ dòu qǔ gatts zhí, err 0x%04x"
-#, c-format
#~ msgid "Failed to register Vendor-Specific UUID, err 0x%04x"
#~ msgstr "Wúfǎ zhùcè màizhǔ tèdìng de UUID, err 0x%04x"
@@ -2768,7 +2757,6 @@ msgstr "líng bù"
#~ msgid "Failed to start advertising, err 0x%04x"
#~ msgstr "Qǐdòng guǎnggào shībài, err 0x%04x"
-#, c-format
#~ msgid "Failed to start connecting, error 0x%04x"
#~ msgstr "Wúfǎ kāishǐ liánjiē, cuòwù 0x%04x"
@@ -2778,7 +2766,6 @@ msgstr "líng bù"
#~ msgid "Failed to start scanning"
#~ msgstr "Qǐdòng sǎomiáo shībài"
-#, c-format
#~ msgid "Failed to start scanning, err 0x%04x"
#~ msgstr "Qǐdòng sǎomiáo shībài, err 0x%04x"
@@ -2788,15 +2775,12 @@ msgstr "líng bù"
#~ msgid "Failed to stop advertising, err 0x%04x"
#~ msgstr "Wúfǎ tíngzhǐ guǎnggào, err 0x%04x"
-#, c-format
#~ msgid "Failed to write CCCD, err 0x%04x"
#~ msgstr "Wúfǎ xiě rù CCCD, cuòwù 0x%04x"
-#, c-format
#~ msgid "Failed to write attribute value, err 0x%04x"
#~ msgstr "Xiě rù shǔxìng zhí shībài, err 0x%04x"
-#, c-format
#~ msgid "Failed to write gatts value, err 0x%04x"
#~ msgstr "Xiě rù gatts zhí,err 0x%04x shībài"
@@ -2866,6 +2850,12 @@ msgstr "líng bù"
#~ msgid "tile index out of bounds"
#~ msgstr "kuài suǒyǐn chāochū fànwéi"
+#~ msgid "time.struct_time() takes exactly 1 argument"
+#~ msgstr "time.struct_time() xūyào wánquán 1 cānshù"
+
+#~ msgid "timeout >100 (units are now seconds, not msecs)"
+#~ msgstr "chāoshí >100 (dānwèi shì miǎo, ér bùshì háomiǎo)"
+
#~ msgid "too many arguments"
#~ msgstr "tài duō cānshù"
diff --git a/ports/atmel-samd/boards/pyruler/mpconfigboard.mk b/ports/atmel-samd/boards/pyruler/mpconfigboard.mk
index 9663944a3..9d9e4ba34 100644
--- a/ports/atmel-samd/boards/pyruler/mpconfigboard.mk
+++ b/ports/atmel-samd/boards/pyruler/mpconfigboard.mk
@@ -12,3 +12,7 @@ LONGINT_IMPL = NONE
CIRCUITPY_SMALL_BUILD = 1
SUPEROPT_GC = 0
+
+ifeq ($(TRANSLATION), zh_Latn_pinyin)
+CFLAGS_INLINE_LIMIT = 35
+endif
diff --git a/ports/atmel-samd/common-hal/busio/UART.c b/ports/atmel-samd/common-hal/busio/UART.c
index 2505e894a..d869f70ff 100644
--- a/ports/atmel-samd/common-hal/busio/UART.c
+++ b/ports/atmel-samd/common-hal/busio/UART.c
@@ -323,29 +323,23 @@ size_t common_hal_busio_uart_write(busio_uart_obj_t *self, const uint8_t *data,
struct io_descriptor *io;
usart_async_get_io_descriptor(usart_desc_p, &io);
+ // Start writing characters. This is non-blocking and will
+ // return immediately after setting up the write.
if (io_write(io, data, len) < 0) {
*errcode = MP_EAGAIN;
return MP_STREAM_ERROR;
}
- // Wait until write is complete or timeout.
- bool done = false;
- uint64_t start_ticks = ticks_ms;
- // Busy-wait for timeout.
- while (ticks_ms - start_ticks < self->timeout_ms) {
- if (usart_async_is_tx_empty(usart_desc_p)) {
- done = true;
+ // Busy-wait until all characters transmitted.
+ struct usart_async_status async_status;
+ while (true) {
+ usart_async_get_status(usart_desc_p, &async_status);
+ if (async_status.txcnt >= len) {
break;
}
RUN_BACKGROUND_TASKS;
}
- if (!done) {
- *errcode = MP_EAGAIN;
- return MP_STREAM_ERROR;
- }
-
- // All the characters got written.
return len;
}
@@ -368,6 +362,14 @@ void common_hal_busio_uart_set_baudrate(busio_uart_obj_t *self, uint32_t baudrat
self->baudrate = baudrate;
}
+mp_float_t common_hal_busio_uart_get_timeout(busio_uart_obj_t *self) {
+ return (mp_float_t) (self->timeout_ms / 1000.0f);
+}
+
+void common_hal_busio_uart_set_timeout(busio_uart_obj_t *self, mp_float_t timeout) {
+ self->timeout_ms = timeout * 1000;
+}
+
uint32_t common_hal_busio_uart_rx_characters_available(busio_uart_obj_t *self) {
// This assignment is only here because the usart_async routines take a *const argument.
struct usart_async_descriptor * const usart_desc_p = (struct usart_async_descriptor * const) &self->usart_desc;
@@ -383,12 +385,14 @@ void common_hal_busio_uart_clear_rx_buffer(busio_uart_obj_t *self) {
}
+// True if there are no characters still to be written.
bool common_hal_busio_uart_ready_to_tx(busio_uart_obj_t *self) {
if (self->tx_pin == NO_PIN) {
return false;
}
// This assignment is only here because the usart_async routines take a *const argument.
- const struct _usart_async_device * const usart_device_p =
- (struct _usart_async_device * const) &self->usart_desc.device;
- return _usart_async_is_byte_sent(usart_device_p);
+ struct usart_async_descriptor * const usart_desc_p = (struct usart_async_descriptor * const) &self->usart_desc;
+ struct usart_async_status async_status;
+ usart_async_get_status(usart_desc_p, &async_status);
+ return !(async_status.flags & USART_ASYNC_STATUS_BUSY);
}
diff --git a/ports/cxd56/common-hal/busio/UART.c b/ports/cxd56/common-hal/busio/UART.c
index 4a1376f19..40ae3b761 100644
--- a/ports/cxd56/common-hal/busio/UART.c
+++ b/ports/cxd56/common-hal/busio/UART.c
@@ -102,7 +102,7 @@ void common_hal_busio_uart_construct(busio_uart_obj_t *self,
self->tx_pin = tx;
self->rx_pin = rx;
self->baudrate = baudrate;
- self->timeout = timeout;
+ self->timeout_us = timeout * 1000000;
}
void common_hal_busio_uart_deinit(busio_uart_obj_t *self) {
@@ -135,7 +135,7 @@ size_t common_hal_busio_uart_read(busio_uart_obj_t *self, uint8_t *data, size_t
FD_SET(busio_uart_dev[self->number].fd, &rfds);
tv.tv_sec = 0;
- tv.tv_usec = self->timeout * 1000;
+ tv.tv_usec = self->timeout_us;
retval = select(busio_uart_dev[self->number].fd + 1, &rfds, NULL, NULL, &tv);
@@ -172,6 +172,14 @@ void common_hal_busio_uart_set_baudrate(busio_uart_obj_t *self, uint32_t baudrat
ioctl(busio_uart_dev[self->number].fd, TCFLSH, (long unsigned int)NULL);
}
+mp_float_t common_hal_busio_uart_get_timeout(busio_uart_obj_t *self) {
+ return (mp_float_t) (self->timeout_us / 1000000.0f);
+}
+
+void common_hal_busio_uart_set_timeout(busio_uart_obj_t *self, mp_float_t timeout) {
+ self->timeout_us = timeout * 1000000;
+}
+
uint32_t common_hal_busio_uart_rx_characters_available(busio_uart_obj_t *self) {
int count = 0;
diff --git a/ports/cxd56/common-hal/busio/UART.h b/ports/cxd56/common-hal/busio/UART.h
index e1d816149..a69c47056 100644
--- a/ports/cxd56/common-hal/busio/UART.h
+++ b/ports/cxd56/common-hal/busio/UART.h
@@ -37,7 +37,7 @@ typedef struct {
const mcu_pin_obj_t *tx_pin;
const mcu_pin_obj_t *rx_pin;
uint32_t baudrate;
- uint32_t timeout;
+ uint32_t timeout_us;
} busio_uart_obj_t;
void busio_uart_reset(void);
diff --git a/ports/nrf/common-hal/busio/UART.c b/ports/nrf/common-hal/busio/UART.c
index 54a66ddbe..a0ae8af00 100644
--- a/ports/nrf/common-hal/busio/UART.c
+++ b/ports/nrf/common-hal/busio/UART.c
@@ -265,19 +265,6 @@ size_t common_hal_busio_uart_write (busio_uart_obj_t *self, const uint8_t *data,
if ( len == 0 ) return 0;
- 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) ) {
- RUN_BACKGROUND_TASKS;
- }
-
- // Time up
- if ( !(ticks_ms - start_ticks < self->timeout_ms) ) {
- *errcode = MP_EAGAIN;
- return MP_STREAM_ERROR;
- }
-
// EasyDMA can only access SRAM
uint8_t * tx_buf = (uint8_t*) data;
if ( !nrfx_is_in_ram(data) ) {
@@ -290,7 +277,8 @@ size_t common_hal_busio_uart_write (busio_uart_obj_t *self, const uint8_t *data,
_VERIFY_ERR(*errcode);
(*errcode) = 0;
- while ( nrfx_uarte_tx_in_progress(self->uarte) && (ticks_ms - start_ticks < self->timeout_ms) ) {
+ // Wait for write to complete.
+ while ( nrfx_uarte_tx_in_progress(self->uarte) ) {
RUN_BACKGROUND_TASKS;
}
@@ -310,6 +298,14 @@ void common_hal_busio_uart_set_baudrate(busio_uart_obj_t *self, uint32_t baudrat
nrf_uarte_baudrate_set(self->uarte->p_reg, get_nrf_baud(baudrate));
}
+mp_float_t common_hal_busio_uart_get_timeout(busio_uart_obj_t *self) {
+ return (mp_float_t) (self->timeout_ms / 1000.0f);
+}
+
+void common_hal_busio_uart_set_timeout(busio_uart_obj_t *self, mp_float_t timeout) {
+ self->timeout_ms = timeout * 1000;
+}
+
uint32_t common_hal_busio_uart_rx_characters_available(busio_uart_obj_t *self) {
return ringbuf_count(&self->rbuf);
}
diff --git a/ports/stm32f4/common-hal/busio/UART.c b/ports/stm32f4/common-hal/busio/UART.c
index c4ab237cd..f0e0cc9eb 100644
--- a/ports/stm32f4/common-hal/busio/UART.c
+++ b/ports/stm32f4/common-hal/busio/UART.c
@@ -36,7 +36,7 @@
#include "supervisor/shared/translate.h"
#include "tick.h"
-#include "stm32f4xx_hal.h"
+#include "stm32f4xx_hal.h"
#define ALL_UARTS 0xFFFF
@@ -55,7 +55,7 @@ void uart_reset(void) {
uart_clock_disable(ALL_UARTS);
}
-STATIC USART_TypeDef * assign_uart_or_throw(busio_uart_obj_t* self, bool pin_eval,
+STATIC USART_TypeDef * assign_uart_or_throw(busio_uart_obj_t* self, bool pin_eval,
int uart_index, bool uart_taken) {
if (pin_eval) {
//assign a root pointer pointer for IRQ
@@ -82,7 +82,7 @@ void common_hal_busio_uart_construct(busio_uart_obj_t* self,
uint8_t rx_len = sizeof(mcu_uart_rx_list)/sizeof(*mcu_uart_rx_list);
bool uart_taken = false;
uint8_t uart_index = 0; //origin 0 corrected
-
+
//Can have both pins, or either
if ((tx != mp_const_none) && (rx != mp_const_none)) {
//normal find loop if both pins exist
@@ -90,7 +90,7 @@ void common_hal_busio_uart_construct(busio_uart_obj_t* self,
if (mcu_uart_tx_list[i].pin == tx) {
//rx
for (uint j = 0; j < rx_len; j++) {
- if (mcu_uart_rx_list[j].pin == rx
+ if (mcu_uart_rx_list[j].pin == rx
&& mcu_uart_rx_list[j].uart_index == mcu_uart_tx_list[i].uart_index) {
//keep looking if the UART is taken, edge case
if (reserved_uart[mcu_uart_tx_list[i].uart_index - 1]) {
@@ -106,7 +106,7 @@ void common_hal_busio_uart_construct(busio_uart_obj_t* self,
}
}
uart_index = self->tx->uart_index - 1;
- USARTx = assign_uart_or_throw(self, (self->tx != NULL && self->rx != NULL),
+ USARTx = assign_uart_or_throw(self, (self->tx != NULL && self->rx != NULL),
uart_index, uart_taken);
} else if (tx == mp_const_none) {
//If there is no tx, run only rx
@@ -123,7 +123,7 @@ void common_hal_busio_uart_construct(busio_uart_obj_t* self,
}
}
uart_index = self->rx->uart_index - 1;
- USARTx = assign_uart_or_throw(self, (self->rx != NULL),
+ USARTx = assign_uart_or_throw(self, (self->rx != NULL),
uart_index, uart_taken);
} else if (rx == mp_const_none) {
//If there is no rx, run only tx
@@ -140,7 +140,7 @@ void common_hal_busio_uart_construct(busio_uart_obj_t* self,
}
}
uart_index = self->tx->uart_index - 1;
- USARTx = assign_uart_or_throw(self, (self->tx != NULL),
+ USARTx = assign_uart_or_throw(self, (self->tx != NULL),
uart_index, uart_taken);
} else {
//both pins cannot be empty
@@ -173,7 +173,7 @@ void common_hal_busio_uart_construct(busio_uart_obj_t* self,
GPIO_InitStruct.Mode = GPIO_MODE_AF_PP;
GPIO_InitStruct.Pull = GPIO_PULLUP;
GPIO_InitStruct.Speed = GPIO_SPEED_FREQ_VERY_HIGH;
- GPIO_InitStruct.Alternate = self->rx->altfn_index;
+ GPIO_InitStruct.Alternate = self->rx->altfn_index;
HAL_GPIO_Init(pin_port(rx->port), &GPIO_InitStruct);
}
@@ -186,7 +186,7 @@ void common_hal_busio_uart_construct(busio_uart_obj_t* self,
self->handle.Init.BaudRate = baudrate;
self->handle.Init.WordLength = (bits == 9) ? UART_WORDLENGTH_9B : UART_WORDLENGTH_8B;
self->handle.Init.StopBits = (stop > 1) ? UART_STOPBITS_2 : UART_STOPBITS_1;
- self->handle.Init.Parity = (parity == PARITY_ODD) ? UART_PARITY_ODD :
+ self->handle.Init.Parity = (parity == PARITY_ODD) ? UART_PARITY_ODD :
(parity == PARITY_EVEN) ? UART_PARITY_EVEN :
UART_PARITY_NONE;
self->handle.Init.Mode = (self->tx != NULL && self->rx != NULL) ? UART_MODE_TX_RX :
@@ -234,7 +234,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)) return;
-
+
reset_pin_number(self->tx->pin->port,self->tx->pin->number);
reset_pin_number(self->rx->pin->port,self->rx->pin->number);
self->tx = mp_const_none;
@@ -279,7 +279,7 @@ size_t common_hal_busio_uart_read(busio_uart_obj_t *self, uint8_t *data, size_t
*errcode = EAGAIN;
return MP_STREAM_ERROR;
}
- return rx_bytes;
+ return rx_bytes;
}
// Write characters.
@@ -290,13 +290,15 @@ size_t common_hal_busio_uart_write(busio_uart_obj_t *self, const uint8_t *data,
bool write_err = false; //write error shouldn't disable interrupts
HAL_NVIC_DisableIRQ(self->irq);
- if (HAL_UART_Transmit(&self->handle, (uint8_t*)data, len, self->timeout_ms) != HAL_OK) {
+ if (HAL_UART_Transmit(&self->handle, (uint8_t*)data, len, HAL_MAX_DELAY) != HAL_OK) {
write_err = true;
}
HAL_UART_Receive_IT(&self->handle, &self->rx_char, 1);
HAL_NVIC_EnableIRQ(self->irq);
- if (write_err) mp_raise_ValueError(translate("UART write error"));
+ if (write_err) {
+ mp_raise_ValueError(translate("UART write error"));
+ }
return len;
}
@@ -312,7 +314,7 @@ void HAL_UART_RxCpltCallback(UART_HandleTypeDef *handle)
}
ringbuf_put_n(&context->rbuf, &context->rx_char, 1);
errflag = HAL_UART_Receive_IT(handle, &context->rx_char, 1);
-
+
return;
}
}
@@ -360,6 +362,14 @@ void common_hal_busio_uart_set_baudrate(busio_uart_obj_t *self, uint32_t baudrat
self->baudrate = baudrate;
}
+mp_float_t common_hal_busio_uart_get_timeout(busio_uart_obj_t *self) {
+ return (mp_float_t) (self->timeout_ms / 1000.0f);
+}
+
+void common_hal_busio_uart_set_timeout(busio_uart_obj_t *self, mp_float_t timeout) {
+ self->timeout_ms = timeout * 1000;
+}
+
uint32_t common_hal_busio_uart_rx_characters_available(busio_uart_obj_t *self) {
return ringbuf_count(&self->rbuf);
}
@@ -414,71 +424,71 @@ STATIC void uart_clock_enable(uint16_t mask) {
if (mask & (1 << 0)) {
__HAL_RCC_USART1_FORCE_RESET();
__HAL_RCC_USART1_RELEASE_RESET();
- __HAL_RCC_USART1_CLK_ENABLE();
+ __HAL_RCC_USART1_CLK_ENABLE();
}
#endif
#ifdef USART2
if (mask & (1 << 1)) {
__HAL_RCC_USART2_FORCE_RESET();
__HAL_RCC_USART2_RELEASE_RESET();
- __HAL_RCC_USART2_CLK_ENABLE();
+ __HAL_RCC_USART2_CLK_ENABLE();
}
#endif
#ifdef USART3
if (mask & (1 << 2)) {
__HAL_RCC_USART3_FORCE_RESET();
__HAL_RCC_USART3_RELEASE_RESET();
- __HAL_RCC_USART3_CLK_ENABLE();
+ __HAL_RCC_USART3_CLK_ENABLE();
}
#endif
#ifdef UART4
if (mask & (1 << 3)) {
__HAL_RCC_UART4_FORCE_RESET();
__HAL_RCC_UART4_RELEASE_RESET();
- __HAL_RCC_UART4_CLK_ENABLE();
+ __HAL_RCC_UART4_CLK_ENABLE();
}
#endif
#ifdef UART5
if (mask & (1 << 4)) {
__HAL_RCC_UART5_FORCE_RESET();
__HAL_RCC_UART5_RELEASE_RESET();
- __HAL_RCC_UART5_CLK_ENABLE();
+ __HAL_RCC_UART5_CLK_ENABLE();
}
#endif
#ifdef USART6
if (mask & (1 << 5)) {
__HAL_RCC_USART6_FORCE_RESET();
__HAL_RCC_USART6_RELEASE_RESET();
- __HAL_RCC_USART6_CLK_ENABLE();
- }
+ __HAL_RCC_USART6_CLK_ENABLE();
+ }
#endif
#ifdef UART7
if (mask & (1 << 6)) {
__HAL_RCC_UART7_FORCE_RESET();
__HAL_RCC_UART7_RELEASE_RESET();
- __HAL_RCC_UART7_CLK_ENABLE();
- }
+ __HAL_RCC_UART7_CLK_ENABLE();
+ }
#endif
#ifdef UART8
if (mask & (1 << 7)) {
__HAL_RCC_UART8_FORCE_RESET();
__HAL_RCC_UART8_RELEASE_RESET();
- __HAL_RCC_UART8_CLK_ENABLE();
- }
+ __HAL_RCC_UART8_CLK_ENABLE();
+ }
#endif
#ifdef UART9
if (mask & (1 << 8)) {
__HAL_RCC_UART9_FORCE_RESET();
__HAL_RCC_UART9_RELEASE_RESET();
- __HAL_RCC_UART9_CLK_ENABLE();
- }
+ __HAL_RCC_UART9_CLK_ENABLE();
+ }
#endif
#ifdef UART10
if (mask & (1 << 9)) {
__HAL_RCC_UART10_FORCE_RESET();
__HAL_RCC_UART10_RELEASE_RESET();
- __HAL_RCC_UART10_CLK_ENABLE();
- }
+ __HAL_RCC_UART10_CLK_ENABLE();
+ }
#endif
}
@@ -487,71 +497,71 @@ STATIC void uart_clock_disable(uint16_t mask) {
if (mask & (1 << 0)) {
__HAL_RCC_USART1_FORCE_RESET();
__HAL_RCC_USART1_RELEASE_RESET();
- __HAL_RCC_USART1_CLK_DISABLE();
+ __HAL_RCC_USART1_CLK_DISABLE();
}
#endif
#ifdef USART2
if (mask & (1 << 1)) {
__HAL_RCC_USART2_FORCE_RESET();
__HAL_RCC_USART2_RELEASE_RESET();
- __HAL_RCC_USART2_CLK_DISABLE();
+ __HAL_RCC_USART2_CLK_DISABLE();
}
#endif
#ifdef USART3
if (mask & (1 << 2)) {
__HAL_RCC_USART3_FORCE_RESET();
__HAL_RCC_USART3_RELEASE_RESET();
- __HAL_RCC_USART3_CLK_DISABLE();
+ __HAL_RCC_USART3_CLK_DISABLE();
}
#endif
#ifdef UART4
if (mask & (1 << 3)) {
__HAL_RCC_UART4_FORCE_RESET();
__HAL_RCC_UART4_RELEASE_RESET();
- __HAL_RCC_UART4_CLK_DISABLE();
+ __HAL_RCC_UART4_CLK_DISABLE();
}
#endif
#ifdef UART5
if (mask & (1 << 4)) {
__HAL_RCC_UART5_FORCE_RESET();
__HAL_RCC_UART5_RELEASE_RESET();
- __HAL_RCC_UART5_CLK_DISABLE();
+ __HAL_RCC_UART5_CLK_DISABLE();
}
#endif
#ifdef USART6
if (mask & (1 << 5)) {
__HAL_RCC_USART6_FORCE_RESET();
__HAL_RCC_USART6_RELEASE_RESET();
- __HAL_RCC_USART6_CLK_DISABLE();
- }
+ __HAL_RCC_USART6_CLK_DISABLE();
+ }
#endif
#ifdef UART7
if (mask & (1 << 6)) {
__HAL_RCC_UART7_FORCE_RESET();
__HAL_RCC_UART7_RELEASE_RESET();
- __HAL_RCC_UART7_CLK_DISABLE();
- }
+ __HAL_RCC_UART7_CLK_DISABLE();
+ }
#endif
#ifdef UART8
if (mask & (1 << 7)) {
__HAL_RCC_UART8_FORCE_RESET();
__HAL_RCC_UART8_RELEASE_RESET();
- __HAL_RCC_UART8_CLK_DISABLE();
- }
+ __HAL_RCC_UART8_CLK_DISABLE();
+ }
#endif
#ifdef UART9
if (mask & (1 << 8)) {
__HAL_RCC_UART9_FORCE_RESET();
__HAL_RCC_UART9_RELEASE_RESET();
- __HAL_RCC_UART9_CLK_DISABLE();
- }
+ __HAL_RCC_UART9_CLK_DISABLE();
+ }
#endif
#ifdef UART10
if (mask & (1 << 9)) {
__HAL_RCC_UART10_FORCE_RESET();
__HAL_RCC_UART10_RELEASE_RESET();
- __HAL_RCC_UART10_CLK_DISABLE();
- }
+ __HAL_RCC_UART10_CLK_DISABLE();
+ }
#endif
}
diff --git a/shared-bindings/board/__init__.c b/shared-bindings/board/__init__.c
index 47e2d64bc..3dda59fb8 100644
--- a/shared-bindings/board/__init__.c
+++ b/shared-bindings/board/__init__.c
@@ -93,6 +93,12 @@ MP_DEFINE_CONST_FUN_OBJ_0(board_spi_obj, board_spi);
//|
//| Returns the `busio.UART` object for the board designated TX and RX pins. It is a singleton.
//|
+//| The object created uses the default parameter values for `busio.UART`. If you need to set
+//| parameters that are not changeable after creation, such as ``receiver_buffer_size``,
+//| do not use `board.UART()`; instead create a `busio.UART` object explicitly with the
+//| desired parameters.
+//|
+//|
#if BOARD_UART
mp_obj_t board_uart(void) {
mp_obj_t singleton = common_hal_board_get_uart();
diff --git a/shared-bindings/busio/UART.c b/shared-bindings/busio/UART.c
index c7eef8c43..7a3b48e89 100644
--- a/shared-bindings/busio/UART.c
+++ b/shared-bindings/busio/UART.c
@@ -57,7 +57,7 @@
//| :param int bits: the number of bits per byte, 7, 8 or 9.
//| :param Parity parity: the parity used for error checking.
//| :param int stop: the number of stop bits, 1 or 2.
-//| :param float timeout: the timeout in seconds to wait for the first character and between subsequent characters. Raises ``ValueError`` if timeout >100 seconds.
+//| :param float timeout: the timeout in seconds to wait for the first character and between subsequent characters when reading. Raises ``ValueError`` if timeout >100 seconds.
//| :param int receiver_buffer_size: the character length of the read buffer (0 to disable). (When a character is 9 bits the buffer will be 2 * receiver_buffer_size bytes.)
//|
//| *New in CircuitPython 4.0:* ``timeout`` has incompatibly changed units from milliseconds to seconds.
@@ -69,6 +69,12 @@ typedef struct {
extern const busio_uart_parity_obj_t busio_uart_parity_even_obj;
extern const busio_uart_parity_obj_t busio_uart_parity_odd_obj;
+STATIC void validate_timeout(mp_float_t timeout) {
+ if (timeout < (mp_float_t) 0.0f || timeout > (mp_float_t) 100.0f) {
+ mp_raise_ValueError(translate("timeout must be 0.0-100.0 seconds"));
+ }
+}
+
STATIC mp_obj_t busio_uart_make_new(const mp_obj_type_t *type, size_t n_args, const mp_obj_t *pos_args, mp_map_t *kw_args) {
// Always initially allocate the UART object within the long-lived heap.
// This is needed to avoid crashes with certain UART implementations which
@@ -116,9 +122,7 @@ STATIC mp_obj_t busio_uart_make_new(const mp_obj_type_t *type, size_t n_args, co
}
mp_float_t timeout = mp_obj_get_float(args[ARG_timeout].u_obj);
- if (timeout > (mp_float_t)100.0) {
- mp_raise_ValueError(translate("timeout >100 (units are now seconds, not msecs)"));
- }
+ validate_timeout(timeout);
common_hal_busio_uart_construct(self, tx, rx,
args[ARG_baudrate].u_int, bits, parity, stop, timeout,
@@ -286,6 +290,35 @@ const mp_obj_property_t busio_uart_in_waiting_obj = {
(mp_obj_t)&mp_const_none_obj},
};
+//| .. attribute:: timeout
+//|
+//| The current timeout, in seconds (float).
+//|
+STATIC mp_obj_t busio_uart_obj_get_timeout(mp_obj_t self_in) {
+ busio_uart_obj_t *self = MP_OBJ_TO_PTR(self_in);
+ check_for_deinit(self);
+ return mp_obj_new_float(common_hal_busio_uart_get_timeout(self));
+}
+MP_DEFINE_CONST_FUN_OBJ_1(busio_uart_get_timeout_obj, busio_uart_obj_get_timeout);
+
+STATIC mp_obj_t busio_uart_obj_set_timeout(mp_obj_t self_in, mp_obj_t timeout) {
+ busio_uart_obj_t *self = MP_OBJ_TO_PTR(self_in);
+ check_for_deinit(self);
+ mp_float_t timeout_float = mp_obj_get_float(timeout);
+ validate_timeout(timeout_float);
+ common_hal_busio_uart_set_timeout(self, timeout_float);
+ return mp_const_none;
+}
+MP_DEFINE_CONST_FUN_OBJ_2(busio_uart_set_timeout_obj, busio_uart_obj_set_timeout);
+
+
+const mp_obj_property_t busio_uart_timeout_obj = {
+ .base.type = &mp_type_property,
+ .proxy = {(mp_obj_t)&busio_uart_get_timeout_obj,
+ (mp_obj_t)&busio_uart_set_timeout_obj,
+ (mp_obj_t)&mp_const_none_obj},
+};
+
//| .. method:: reset_input_buffer()
//|
//| Discard any unread characters in the input buffer.
@@ -355,8 +388,9 @@ STATIC const mp_rom_map_elem_t busio_uart_locals_dict_table[] = {
{ MP_OBJ_NEW_QSTR(MP_QSTR_reset_input_buffer), MP_ROM_PTR(&busio_uart_reset_input_buffer_obj) },
// Properties
- { MP_ROM_QSTR(MP_QSTR_baudrate), MP_ROM_PTR(&busio_uart_baudrate_obj) },
- { MP_ROM_QSTR(MP_QSTR_in_waiting), MP_ROM_PTR(&busio_uart_in_waiting_obj) },
+ { MP_ROM_QSTR(MP_QSTR_baudrate), MP_ROM_PTR(&busio_uart_baudrate_obj) },
+ { MP_ROM_QSTR(MP_QSTR_in_waiting), MP_ROM_PTR(&busio_uart_in_waiting_obj) },
+ { MP_ROM_QSTR(MP_QSTR_timeout), MP_ROM_PTR(&busio_uart_timeout_obj) },
// Nested Enum-like Classes.
{ MP_ROM_QSTR(MP_QSTR_Parity), MP_ROM_PTR(&busio_uart_parity_type) },
diff --git a/shared-bindings/busio/UART.h b/shared-bindings/busio/UART.h
index 776a996be..cfd2c800c 100644
--- a/shared-bindings/busio/UART.h
+++ b/shared-bindings/busio/UART.h
@@ -57,7 +57,8 @@ extern size_t common_hal_busio_uart_write(busio_uart_obj_t *self,
extern uint32_t common_hal_busio_uart_get_baudrate(busio_uart_obj_t *self);
extern void common_hal_busio_uart_set_baudrate(busio_uart_obj_t *self, uint32_t baudrate);
-
+extern mp_float_t common_hal_busio_uart_get_timeout(busio_uart_obj_t *self);
+extern void common_hal_busio_uart_set_timeout(busio_uart_obj_t *self, mp_float_t timeout);
extern uint32_t common_hal_busio_uart_rx_characters_available(busio_uart_obj_t *self);
extern void common_hal_busio_uart_clear_rx_buffer(busio_uart_obj_t *self);
diff --git a/shared-module/board/__init__.c b/shared-module/board/__init__.c
index dd07d7190..914bc4313 100644
--- a/shared-module/board/__init__.c
+++ b/shared-module/board/__init__.c
@@ -101,7 +101,7 @@ mp_obj_t common_hal_board_create_uart(void) {
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);
+ common_hal_busio_uart_construct(self, tx, rx, 9600, 8, PARITY_NONE, 1, 1.0f, 64);
MP_STATE_VM(shared_uart_bus) = MP_OBJ_FROM_PTR(self);
return MP_STATE_VM(shared_uart_bus);
}