summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorLucian Copeland <hierophect@gmail.com>2020-03-16 12:37:53 -0400
committerLucian Copeland <hierophect@gmail.com>2020-03-16 12:37:53 -0400
commitbb3ed3a827f70582f9a19ceb359b169d1b50262a (patch)
tree0d4ad5ee42de9bfb7c3b2cbb8b0d41d9f285298b
parentbb167f04fa06ca7245c3f173d4ce108e36309c67 (diff)
parent3a5f79acef1fd109aeb93e06e8a22dac5d54aa24 (diff)
Merge branch 'master' into stm32x7-setup
-rw-r--r--.github/workflows/build.yml1
-rw-r--r--.gitmodules12
-rw-r--r--conf.py2
-rw-r--r--locale/ID.po16
-rw-r--r--locale/circuitpython.pot16
-rw-r--r--locale/de_DE.po16
-rw-r--r--locale/en_US.po16
-rw-r--r--locale/en_x_pirate.po16
-rw-r--r--locale/es.po16
-rw-r--r--locale/fil.po16
-rw-r--r--locale/fr.po16
-rw-r--r--locale/it_IT.po16
-rw-r--r--locale/ko.po16
-rw-r--r--locale/pl.po16
-rw-r--r--locale/pt_BR.po16
-rw-r--r--locale/zh_Latn_pinyin.po19
-rw-r--r--ports/nrf/boards/TG-Watch02A/board.c38
-rw-r--r--ports/nrf/boards/TG-Watch02A/mpconfigboard.h61
-rw-r--r--ports/nrf/boards/TG-Watch02A/mpconfigboard.mk11
-rw-r--r--ports/nrf/boards/TG-Watch02A/pins.c51
-rw-r--r--ports/nrf/boards/pca10056/mpconfigboard.h1
-rwxr-xr-xports/stm/Makefile87
-rw-r--r--ports/stm/common-hal/pulseio/PulseIn.c238
-rw-r--r--ports/stm/common-hal/pulseio/PulseIn.h3
m---------ports/stm/st_driver0
m---------ports/stm/stm32f40
-rw-r--r--ports/stm/supervisor/port.c2
27 files changed, 579 insertions, 139 deletions
diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml
index 32c949a3a..7ff20dc7a 100644
--- a/.github/workflows/build.yml
+++ b/.github/workflows/build.yml
@@ -122,6 +122,7 @@ jobs:
fail-fast: false
matrix:
board:
+ - "TG-Watch02A"
- "aramcon_badge_2019"
- "arduino_mkr1300"
- "arduino_mkrzero"
diff --git a/.gitmodules b/.gitmodules
index 6300339d1..5c3387077 100644
--- a/.gitmodules
+++ b/.gitmodules
@@ -29,10 +29,6 @@
[submodule "tools/python-semver"]
path = tools/python-semver
url = https://github.com/k-bx/python-semver.git
-[submodule "lib/stm32lib"]
- path = lib/stm32lib
- url = https://github.com/micropython/stm32lib
- branch = work-F4-1.13.1+F7-1.5.0+L4-1.3.0
[submodule "atmel-samd/asf4"]
path = ports/atmel-samd/asf4
url = https://github.com/adafruit/asf4.git
@@ -96,9 +92,6 @@
[submodule "frozen/circuitpython-stage"]
path = frozen/circuitpython-stage
url = https://github.com/python-ugame/circuitpython-stage.git
-[submodule "ports/stm/stm32f4"]
- path = ports/stm/stm32f4
- url = https://github.com/adafruit/stm32f4.git
[submodule "ports/cxd56/spresense-exported-sdk"]
path = ports/cxd56/spresense-exported-sdk
url = https://github.com/sonydevworld/spresense-exported-sdk.git
@@ -122,4 +115,7 @@
url = https://github.com/adafruit/Adafruit_CircuitPython_ESP32SPI
[submodule "frozen/Adafruit_CircuitPython_Requests"]
path = frozen/Adafruit_CircuitPython_Requests
- url = https://github.com/adafruit/Adafruit_CircuitPython_Requests \ No newline at end of file
+ url = https://github.com/adafruit/Adafruit_CircuitPython_Requests
+[submodule "ports/stm/st_driver"]
+ path = ports/stm/st_driver
+ url = https://github.com/hathach/st_driver.git
diff --git a/conf.py b/conf.py
index 1f9f85b0b..2ea0e8dc0 100644
--- a/conf.py
+++ b/conf.py
@@ -132,7 +132,7 @@ exclude_patterns = ["**/build*",
"ports/nrf/nrfx",
"ports/nrf/peripherals",
"ports/nrf/usb",
- "ports/stm/stm32f4",
+ "ports/stm/st_driver",
"ports/stm/peripherals",
"ports/stm/ref",
"ports/unix",
diff --git a/locale/ID.po b/locale/ID.po
index dff59c1ce..03111a7a8 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: 2020-03-09 08:19-0500\n"
+"POT-Creation-Date: 2020-03-11 17:52-0400\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"
@@ -709,6 +709,7 @@ msgstr "Gagal untuk mengalokasikan buffer RX"
#: ports/atmel-samd/common-hal/pulseio/PulseIn.c
#: ports/cxd56/common-hal/pulseio/PulseIn.c
#: ports/nrf/common-hal/pulseio/PulseIn.c
+#: ports/stm32f4/common-hal/pulseio/PulseIn.c
#, c-format
msgid "Failed to allocate RX buffer of %d bytes"
msgstr "Gagal untuk megalokasikan buffer RX dari %d byte"
@@ -1165,6 +1166,10 @@ msgstr ""
msgid "Pin does not have ADC capabilities"
msgstr "Pin tidak mempunya kemampuan untuk ADC (Analog Digital Converter)"
+#: ports/stm32f4/common-hal/pulseio/PulseIn.c
+msgid "Pin number already reserved by EXTI"
+msgstr ""
+
#: py/builtinhelp.c
msgid "Plus any modules on the filesystem\n"
msgstr "Tambahkan module apapun pada filesystem\n"
@@ -1187,10 +1192,6 @@ msgstr ""
msgid "Pull not used when direction is output."
msgstr ""
-#: ports/stm32f4/common-hal/pulseio/PulseIn.c
-msgid "PulseIn not yet supported"
-msgstr ""
-
#: ports/stm32f4/common-hal/pulseio/PulseOut.c
msgid "PulseOut not supported on this chip"
msgstr ""
@@ -2231,7 +2232,8 @@ msgstr ""
#: ports/atmel-samd/common-hal/pulseio/PulseIn.c
#: ports/cxd56/common-hal/pulseio/PulseIn.c
-#: ports/nrf/common-hal/pulseio/PulseIn.c py/obj.c
+#: ports/nrf/common-hal/pulseio/PulseIn.c
+#: ports/stm32f4/common-hal/pulseio/PulseIn.c py/obj.c
msgid "index out of range"
msgstr "index keluar dari jangkauan"
@@ -2718,6 +2720,7 @@ msgstr ""
#: ports/atmel-samd/common-hal/pulseio/PulseIn.c
#: ports/cxd56/common-hal/pulseio/PulseIn.c
#: ports/nrf/common-hal/pulseio/PulseIn.c
+#: ports/stm32f4/common-hal/pulseio/PulseIn.c
msgid "pop from an empty PulseIn"
msgstr "Muncul dari PulseIn yang kosong"
@@ -2949,6 +2952,7 @@ msgstr ""
#: ports/atmel-samd/common-hal/busio/UART.c
#: ports/mimxrt10xx/common-hal/busio/UART.c ports/nrf/common-hal/busio/UART.c
+#: shared-bindings/busio/UART.c
msgid "tx and rx cannot both be None"
msgstr "tx dan rx keduanya tidak boleh kosong"
diff --git a/locale/circuitpython.pot b/locale/circuitpython.pot
index e9afe41c2..7b56d28dc 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: 2020-03-09 08:19-0500\n"
+"POT-Creation-Date: 2020-03-11 17:52-0400\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"
@@ -698,6 +698,7 @@ msgstr ""
#: ports/atmel-samd/common-hal/pulseio/PulseIn.c
#: ports/cxd56/common-hal/pulseio/PulseIn.c
#: ports/nrf/common-hal/pulseio/PulseIn.c
+#: ports/stm32f4/common-hal/pulseio/PulseIn.c
#, c-format
msgid "Failed to allocate RX buffer of %d bytes"
msgstr ""
@@ -1153,6 +1154,10 @@ msgstr ""
msgid "Pin does not have ADC capabilities"
msgstr ""
+#: ports/stm32f4/common-hal/pulseio/PulseIn.c
+msgid "Pin number already reserved by EXTI"
+msgstr ""
+
#: py/builtinhelp.c
msgid "Plus any modules on the filesystem\n"
msgstr ""
@@ -1173,10 +1178,6 @@ msgstr ""
msgid "Pull not used when direction is output."
msgstr ""
-#: ports/stm32f4/common-hal/pulseio/PulseIn.c
-msgid "PulseIn not yet supported"
-msgstr ""
-
#: ports/stm32f4/common-hal/pulseio/PulseOut.c
msgid "PulseOut not supported on this chip"
msgstr ""
@@ -2207,7 +2208,8 @@ msgstr ""
#: ports/atmel-samd/common-hal/pulseio/PulseIn.c
#: ports/cxd56/common-hal/pulseio/PulseIn.c
-#: ports/nrf/common-hal/pulseio/PulseIn.c py/obj.c
+#: ports/nrf/common-hal/pulseio/PulseIn.c
+#: ports/stm32f4/common-hal/pulseio/PulseIn.c py/obj.c
msgid "index out of range"
msgstr ""
@@ -2693,6 +2695,7 @@ msgstr ""
#: ports/atmel-samd/common-hal/pulseio/PulseIn.c
#: ports/cxd56/common-hal/pulseio/PulseIn.c
#: ports/nrf/common-hal/pulseio/PulseIn.c
+#: ports/stm32f4/common-hal/pulseio/PulseIn.c
msgid "pop from an empty PulseIn"
msgstr ""
@@ -2923,6 +2926,7 @@ msgstr ""
#: ports/atmel-samd/common-hal/busio/UART.c
#: ports/mimxrt10xx/common-hal/busio/UART.c ports/nrf/common-hal/busio/UART.c
+#: shared-bindings/busio/UART.c
msgid "tx and rx cannot both be None"
msgstr ""
diff --git a/locale/de_DE.po b/locale/de_DE.po
index b1ddf050e..78cecce64 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: 2020-03-09 08:19-0500\n"
+"POT-Creation-Date: 2020-03-11 17:52-0400\n"
"PO-Revision-Date: 2018-07-27 11:55-0700\n"
"Last-Translator: Pascal Deneaux\n"
"Language-Team: Sebastian Plamauer, Pascal Deneaux\n"
@@ -702,6 +702,7 @@ msgstr "Konnte keinen RX Buffer allozieren"
#: ports/atmel-samd/common-hal/pulseio/PulseIn.c
#: ports/cxd56/common-hal/pulseio/PulseIn.c
#: ports/nrf/common-hal/pulseio/PulseIn.c
+#: ports/stm32f4/common-hal/pulseio/PulseIn.c
#, c-format
msgid "Failed to allocate RX buffer of %d bytes"
msgstr "Konnte keine RX Buffer mit %d allozieren"
@@ -1168,6 +1169,10 @@ msgstr "Zugang verweigert"
msgid "Pin does not have ADC capabilities"
msgstr "Pin hat keine ADC Funktionalität"
+#: ports/stm32f4/common-hal/pulseio/PulseIn.c
+msgid "Pin number already reserved by EXTI"
+msgstr ""
+
#: py/builtinhelp.c
msgid "Plus any modules on the filesystem\n"
msgstr "und alle Module im Dateisystem \n"
@@ -1190,10 +1195,6 @@ msgstr ""
msgid "Pull not used when direction is output."
msgstr "Pull wird nicht verwendet, wenn die Richtung output ist."
-#: ports/stm32f4/common-hal/pulseio/PulseIn.c
-msgid "PulseIn not yet supported"
-msgstr ""
-
#: ports/stm32f4/common-hal/pulseio/PulseOut.c
msgid "PulseOut not supported on this chip"
msgstr ""
@@ -2237,7 +2238,8 @@ msgstr ""
#: ports/atmel-samd/common-hal/pulseio/PulseIn.c
#: ports/cxd56/common-hal/pulseio/PulseIn.c
-#: ports/nrf/common-hal/pulseio/PulseIn.c py/obj.c
+#: ports/nrf/common-hal/pulseio/PulseIn.c
+#: ports/stm32f4/common-hal/pulseio/PulseIn.c py/obj.c
msgid "index out of range"
msgstr "index außerhalb der Reichweite"
@@ -2731,6 +2733,7 @@ msgstr "pixel_shader muss displayio.Palette oder displayio.ColorConverter sein"
#: ports/atmel-samd/common-hal/pulseio/PulseIn.c
#: ports/cxd56/common-hal/pulseio/PulseIn.c
#: ports/nrf/common-hal/pulseio/PulseIn.c
+#: ports/stm32f4/common-hal/pulseio/PulseIn.c
msgid "pop from an empty PulseIn"
msgstr "pop von einem leeren PulseIn"
@@ -2964,6 +2967,7 @@ msgstr ""
#: ports/atmel-samd/common-hal/busio/UART.c
#: ports/mimxrt10xx/common-hal/busio/UART.c ports/nrf/common-hal/busio/UART.c
+#: shared-bindings/busio/UART.c
msgid "tx and rx cannot both be None"
msgstr "tx und rx können nicht beide None sein"
diff --git a/locale/en_US.po b/locale/en_US.po
index b41734976..f452fdaad 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: 2020-03-09 08:19-0500\n"
+"POT-Creation-Date: 2020-03-11 17:52-0400\n"
"PO-Revision-Date: 2018-07-27 11:55-0700\n"
"Last-Translator: \n"
"Language-Team: \n"
@@ -698,6 +698,7 @@ msgstr ""
#: ports/atmel-samd/common-hal/pulseio/PulseIn.c
#: ports/cxd56/common-hal/pulseio/PulseIn.c
#: ports/nrf/common-hal/pulseio/PulseIn.c
+#: ports/stm32f4/common-hal/pulseio/PulseIn.c
#, c-format
msgid "Failed to allocate RX buffer of %d bytes"
msgstr ""
@@ -1153,6 +1154,10 @@ msgstr ""
msgid "Pin does not have ADC capabilities"
msgstr ""
+#: ports/stm32f4/common-hal/pulseio/PulseIn.c
+msgid "Pin number already reserved by EXTI"
+msgstr ""
+
#: py/builtinhelp.c
msgid "Plus any modules on the filesystem\n"
msgstr ""
@@ -1173,10 +1178,6 @@ msgstr ""
msgid "Pull not used when direction is output."
msgstr ""
-#: ports/stm32f4/common-hal/pulseio/PulseIn.c
-msgid "PulseIn not yet supported"
-msgstr ""
-
#: ports/stm32f4/common-hal/pulseio/PulseOut.c
msgid "PulseOut not supported on this chip"
msgstr ""
@@ -2207,7 +2208,8 @@ msgstr ""
#: ports/atmel-samd/common-hal/pulseio/PulseIn.c
#: ports/cxd56/common-hal/pulseio/PulseIn.c
-#: ports/nrf/common-hal/pulseio/PulseIn.c py/obj.c
+#: ports/nrf/common-hal/pulseio/PulseIn.c
+#: ports/stm32f4/common-hal/pulseio/PulseIn.c py/obj.c
msgid "index out of range"
msgstr ""
@@ -2693,6 +2695,7 @@ msgstr ""
#: ports/atmel-samd/common-hal/pulseio/PulseIn.c
#: ports/cxd56/common-hal/pulseio/PulseIn.c
#: ports/nrf/common-hal/pulseio/PulseIn.c
+#: ports/stm32f4/common-hal/pulseio/PulseIn.c
msgid "pop from an empty PulseIn"
msgstr ""
@@ -2923,6 +2926,7 @@ msgstr ""
#: ports/atmel-samd/common-hal/busio/UART.c
#: ports/mimxrt10xx/common-hal/busio/UART.c ports/nrf/common-hal/busio/UART.c
+#: shared-bindings/busio/UART.c
msgid "tx and rx cannot both be None"
msgstr ""
diff --git a/locale/en_x_pirate.po b/locale/en_x_pirate.po
index b079dcd09..709571f31 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: 2020-03-09 08:19-0500\n"
+"POT-Creation-Date: 2020-03-11 17:52-0400\n"
"PO-Revision-Date: 2018-07-27 11:55-0700\n"
"Last-Translator: \n"
"Language-Team: @sommersoft, @MrCertainly\n"
@@ -702,6 +702,7 @@ msgstr ""
#: ports/atmel-samd/common-hal/pulseio/PulseIn.c
#: ports/cxd56/common-hal/pulseio/PulseIn.c
#: ports/nrf/common-hal/pulseio/PulseIn.c
+#: ports/stm32f4/common-hal/pulseio/PulseIn.c
#, c-format
msgid "Failed to allocate RX buffer of %d bytes"
msgstr ""
@@ -1157,6 +1158,10 @@ msgstr ""
msgid "Pin does not have ADC capabilities"
msgstr "Belay that! Th' Pin be not ADC capable"
+#: ports/stm32f4/common-hal/pulseio/PulseIn.c
+msgid "Pin number already reserved by EXTI"
+msgstr ""
+
#: py/builtinhelp.c
msgid "Plus any modules on the filesystem\n"
msgstr ""
@@ -1177,10 +1182,6 @@ msgstr ""
msgid "Pull not used when direction is output."
msgstr ""
-#: ports/stm32f4/common-hal/pulseio/PulseIn.c
-msgid "PulseIn not yet supported"
-msgstr ""
-
#: ports/stm32f4/common-hal/pulseio/PulseOut.c
msgid "PulseOut not supported on this chip"
msgstr ""
@@ -2211,7 +2212,8 @@ msgstr ""
#: ports/atmel-samd/common-hal/pulseio/PulseIn.c
#: ports/cxd56/common-hal/pulseio/PulseIn.c
-#: ports/nrf/common-hal/pulseio/PulseIn.c py/obj.c
+#: ports/nrf/common-hal/pulseio/PulseIn.c
+#: ports/stm32f4/common-hal/pulseio/PulseIn.c py/obj.c
msgid "index out of range"
msgstr ""
@@ -2697,6 +2699,7 @@ msgstr ""
#: ports/atmel-samd/common-hal/pulseio/PulseIn.c
#: ports/cxd56/common-hal/pulseio/PulseIn.c
#: ports/nrf/common-hal/pulseio/PulseIn.c
+#: ports/stm32f4/common-hal/pulseio/PulseIn.c
msgid "pop from an empty PulseIn"
msgstr ""
@@ -2927,6 +2930,7 @@ msgstr ""
#: ports/atmel-samd/common-hal/busio/UART.c
#: ports/mimxrt10xx/common-hal/busio/UART.c ports/nrf/common-hal/busio/UART.c
+#: shared-bindings/busio/UART.c
msgid "tx and rx cannot both be None"
msgstr ""
diff --git a/locale/es.po b/locale/es.po
index 772c38f69..9c7f3e3cb 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: 2020-03-09 08:19-0500\n"
+"POT-Creation-Date: 2020-03-11 17:52-0400\n"
"PO-Revision-Date: 2018-08-24 22:56-0500\n"
"Last-Translator: \n"
"Language-Team: \n"
@@ -704,6 +704,7 @@ msgstr "Ha fallado la asignación del buffer RX"
#: ports/atmel-samd/common-hal/pulseio/PulseIn.c
#: ports/cxd56/common-hal/pulseio/PulseIn.c
#: ports/nrf/common-hal/pulseio/PulseIn.c
+#: ports/stm32f4/common-hal/pulseio/PulseIn.c
#, c-format
msgid "Failed to allocate RX buffer of %d bytes"
msgstr "Falló la asignación del buffer RX de %d bytes"
@@ -1167,6 +1168,10 @@ msgstr "Permiso denegado"
msgid "Pin does not have ADC capabilities"
msgstr "Pin no tiene capacidad ADC"
+#: ports/stm32f4/common-hal/pulseio/PulseIn.c
+msgid "Pin number already reserved by EXTI"
+msgstr ""
+
#: py/builtinhelp.c
#, fuzzy
msgid "Plus any modules on the filesystem\n"
@@ -1189,10 +1194,6 @@ msgstr ""
msgid "Pull not used when direction is output."
msgstr "Pull no se usa cuando la dirección es output."
-#: ports/stm32f4/common-hal/pulseio/PulseIn.c
-msgid "PulseIn not yet supported"
-msgstr ""
-
#: ports/stm32f4/common-hal/pulseio/PulseOut.c
msgid "PulseOut not supported on this chip"
msgstr ""
@@ -2238,7 +2239,8 @@ msgstr ""
#: ports/atmel-samd/common-hal/pulseio/PulseIn.c
#: ports/cxd56/common-hal/pulseio/PulseIn.c
-#: ports/nrf/common-hal/pulseio/PulseIn.c py/obj.c
+#: ports/nrf/common-hal/pulseio/PulseIn.c
+#: ports/stm32f4/common-hal/pulseio/PulseIn.c py/obj.c
msgid "index out of range"
msgstr "index fuera de rango"
@@ -2731,6 +2733,7 @@ msgstr "pixel_shader debe ser displayio.Palette o displayio.ColorConverter"
#: ports/atmel-samd/common-hal/pulseio/PulseIn.c
#: ports/cxd56/common-hal/pulseio/PulseIn.c
#: ports/nrf/common-hal/pulseio/PulseIn.c
+#: ports/stm32f4/common-hal/pulseio/PulseIn.c
msgid "pop from an empty PulseIn"
msgstr "pop de un PulseIn vacío"
@@ -2964,6 +2967,7 @@ msgstr "tuple/lista se require en RHS"
#: ports/atmel-samd/common-hal/busio/UART.c
#: ports/mimxrt10xx/common-hal/busio/UART.c ports/nrf/common-hal/busio/UART.c
+#: shared-bindings/busio/UART.c
msgid "tx and rx cannot both be None"
msgstr "Ambos tx y rx no pueden ser None"
diff --git a/locale/fil.po b/locale/fil.po
index 450ed5f0e..ed31a176b 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: 2020-03-09 08:19-0500\n"
+"POT-Creation-Date: 2020-03-11 17:52-0400\n"
"PO-Revision-Date: 2018-12-20 22:15-0800\n"
"Last-Translator: Timothy <me@timothygarcia.ca>\n"
"Language-Team: fil\n"
@@ -712,6 +712,7 @@ msgstr "Nabigong ilaan ang RX buffer"
#: ports/atmel-samd/common-hal/pulseio/PulseIn.c
#: ports/cxd56/common-hal/pulseio/PulseIn.c
#: ports/nrf/common-hal/pulseio/PulseIn.c
+#: ports/stm32f4/common-hal/pulseio/PulseIn.c
#, c-format
msgid "Failed to allocate RX buffer of %d bytes"
msgstr "Nabigong ilaan ang RX buffer ng %d bytes"
@@ -1173,6 +1174,10 @@ msgstr "Walang pahintulot"
msgid "Pin does not have ADC capabilities"
msgstr "Ang pin ay walang kakayahan sa ADC"
+#: ports/stm32f4/common-hal/pulseio/PulseIn.c
+msgid "Pin number already reserved by EXTI"
+msgstr ""
+
#: py/builtinhelp.c
msgid "Plus any modules on the filesystem\n"
msgstr "Kasama ang kung ano pang modules na sa filesystem\n"
@@ -1195,10 +1200,6 @@ msgstr ""
msgid "Pull not used when direction is output."
msgstr "Pull hindi ginagamit kapag ang direksyon ay output."
-#: ports/stm32f4/common-hal/pulseio/PulseIn.c
-msgid "PulseIn not yet supported"
-msgstr ""
-
#: ports/stm32f4/common-hal/pulseio/PulseOut.c
msgid "PulseOut not supported on this chip"
msgstr ""
@@ -2253,7 +2254,8 @@ msgstr ""
#: ports/atmel-samd/common-hal/pulseio/PulseIn.c
#: ports/cxd56/common-hal/pulseio/PulseIn.c
-#: ports/nrf/common-hal/pulseio/PulseIn.c py/obj.c
+#: ports/nrf/common-hal/pulseio/PulseIn.c
+#: ports/stm32f4/common-hal/pulseio/PulseIn.c py/obj.c
msgid "index out of range"
msgstr "index wala sa sakop"
@@ -2745,6 +2747,7 @@ msgstr "pixel_shader ay dapat displayio.Palette o displayio.ColorConverter"
#: ports/atmel-samd/common-hal/pulseio/PulseIn.c
#: ports/cxd56/common-hal/pulseio/PulseIn.c
#: ports/nrf/common-hal/pulseio/PulseIn.c
+#: ports/stm32f4/common-hal/pulseio/PulseIn.c
msgid "pop from an empty PulseIn"
msgstr "pop mula sa walang laman na PulseIn"
@@ -2979,6 +2982,7 @@ msgstr ""
#: ports/atmel-samd/common-hal/busio/UART.c
#: ports/mimxrt10xx/common-hal/busio/UART.c ports/nrf/common-hal/busio/UART.c
+#: shared-bindings/busio/UART.c
msgid "tx and rx cannot both be None"
msgstr "tx at rx hindi pwedeng parehas na None"
diff --git a/locale/fr.po b/locale/fr.po
index 708176c6b..9345787c5 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: 2020-03-09 08:19-0500\n"
+"POT-Creation-Date: 2020-03-11 17:52-0400\n"
"PO-Revision-Date: 2019-04-14 20:05+0100\n"
"Last-Translator: Pierrick Couturier <arofarn@arofarn.info>\n"
"Language-Team: fr\n"
@@ -715,6 +715,7 @@ msgstr "Echec de l'allocation du tampon RX"
#: ports/atmel-samd/common-hal/pulseio/PulseIn.c
#: ports/cxd56/common-hal/pulseio/PulseIn.c
#: ports/nrf/common-hal/pulseio/PulseIn.c
+#: ports/stm32f4/common-hal/pulseio/PulseIn.c
#, c-format
msgid "Failed to allocate RX buffer of %d bytes"
msgstr "Echec de l'allocation de %d octets du tampon RX"
@@ -1187,6 +1188,10 @@ msgstr "Permission refusée"
msgid "Pin does not have ADC capabilities"
msgstr "La broche ne peut être utilisée pour l'ADC"
+#: ports/stm32f4/common-hal/pulseio/PulseIn.c
+msgid "Pin number already reserved by EXTI"
+msgstr ""
+
#: py/builtinhelp.c
#, fuzzy
msgid "Plus any modules on the filesystem\n"
@@ -1208,10 +1213,6 @@ msgstr "Appuyez sur une touche pour entrer sur REPL ou CTRL-D pour recharger."
msgid "Pull not used when direction is output."
msgstr "Le tirage 'pull' n'est pas utilisé quand la direction est 'output'."
-#: ports/stm32f4/common-hal/pulseio/PulseIn.c
-msgid "PulseIn not yet supported"
-msgstr ""
-
#: ports/stm32f4/common-hal/pulseio/PulseOut.c
msgid "PulseOut not supported on this chip"
msgstr ""
@@ -2277,7 +2278,8 @@ msgstr ""
#: ports/atmel-samd/common-hal/pulseio/PulseIn.c
#: ports/cxd56/common-hal/pulseio/PulseIn.c
-#: ports/nrf/common-hal/pulseio/PulseIn.c py/obj.c
+#: ports/nrf/common-hal/pulseio/PulseIn.c
+#: ports/stm32f4/common-hal/pulseio/PulseIn.c py/obj.c
msgid "index out of range"
msgstr "index hors gamme"
@@ -2777,6 +2779,7 @@ msgstr ""
#: ports/atmel-samd/common-hal/pulseio/PulseIn.c
#: ports/cxd56/common-hal/pulseio/PulseIn.c
#: ports/nrf/common-hal/pulseio/PulseIn.c
+#: ports/stm32f4/common-hal/pulseio/PulseIn.c
msgid "pop from an empty PulseIn"
msgstr "'pop' d'une entrée PulseIn vide"
@@ -3012,6 +3015,7 @@ msgstr "tuple ou liste requis en partie droite"
#: ports/atmel-samd/common-hal/busio/UART.c
#: ports/mimxrt10xx/common-hal/busio/UART.c ports/nrf/common-hal/busio/UART.c
+#: shared-bindings/busio/UART.c
msgid "tx and rx cannot both be None"
msgstr "tx et rx ne peuvent être 'None' tous les deux"
diff --git a/locale/it_IT.po b/locale/it_IT.po
index f4eeea46f..68cd7dd41 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: 2020-03-09 08:19-0500\n"
+"POT-Creation-Date: 2020-03-11 17:52-0400\n"
"PO-Revision-Date: 2018-10-02 16:27+0200\n"
"Last-Translator: Enrico Paganin <enrico.paganin@mail.com>\n"
"Language-Team: \n"
@@ -712,6 +712,7 @@ msgstr "Impossibile allocare buffer RX"
#: ports/atmel-samd/common-hal/pulseio/PulseIn.c
#: ports/cxd56/common-hal/pulseio/PulseIn.c
#: ports/nrf/common-hal/pulseio/PulseIn.c
+#: ports/stm32f4/common-hal/pulseio/PulseIn.c
#, c-format
msgid "Failed to allocate RX buffer of %d bytes"
msgstr "Fallita allocazione del buffer RX di %d byte"
@@ -1182,6 +1183,10 @@ msgstr "Permesso negato"
msgid "Pin does not have ADC capabilities"
msgstr "Il pin non ha capacità di ADC"
+#: ports/stm32f4/common-hal/pulseio/PulseIn.c
+msgid "Pin number already reserved by EXTI"
+msgstr ""
+
#: py/builtinhelp.c
#, fuzzy
msgid "Plus any modules on the filesystem\n"
@@ -1204,10 +1209,6 @@ msgstr ""
msgid "Pull not used when direction is output."
msgstr ""
-#: ports/stm32f4/common-hal/pulseio/PulseIn.c
-msgid "PulseIn not yet supported"
-msgstr ""
-
#: ports/stm32f4/common-hal/pulseio/PulseOut.c
msgid "PulseOut not supported on this chip"
msgstr ""
@@ -2254,7 +2255,8 @@ msgstr ""
#: ports/atmel-samd/common-hal/pulseio/PulseIn.c
#: ports/cxd56/common-hal/pulseio/PulseIn.c
-#: ports/nrf/common-hal/pulseio/PulseIn.c py/obj.c
+#: ports/nrf/common-hal/pulseio/PulseIn.c
+#: ports/stm32f4/common-hal/pulseio/PulseIn.c py/obj.c
msgid "index out of range"
msgstr "indice fuori intervallo"
@@ -2752,6 +2754,7 @@ msgstr "pixel_shader deve essere displayio.Palette o displayio.ColorConverter"
#: ports/atmel-samd/common-hal/pulseio/PulseIn.c
#: ports/cxd56/common-hal/pulseio/PulseIn.c
#: ports/nrf/common-hal/pulseio/PulseIn.c
+#: ports/stm32f4/common-hal/pulseio/PulseIn.c
msgid "pop from an empty PulseIn"
msgstr "pop sun un PulseIn vuoto"
@@ -2986,6 +2989,7 @@ msgstr ""
#: ports/atmel-samd/common-hal/busio/UART.c
#: ports/mimxrt10xx/common-hal/busio/UART.c ports/nrf/common-hal/busio/UART.c
+#: shared-bindings/busio/UART.c
msgid "tx and rx cannot both be None"
msgstr "tx e rx non possono essere entrambi None"
diff --git a/locale/ko.po b/locale/ko.po
index 96bb26d09..656adf2cb 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: 2020-03-09 08:19-0500\n"
+"POT-Creation-Date: 2020-03-11 17:52-0400\n"
"PO-Revision-Date: 2019-05-06 14:22-0700\n"
"Last-Translator: \n"
"Language-Team: LANGUAGE <LL@li.org>\n"
@@ -702,6 +702,7 @@ msgstr ""
#: ports/atmel-samd/common-hal/pulseio/PulseIn.c
#: ports/cxd56/common-hal/pulseio/PulseIn.c
#: ports/nrf/common-hal/pulseio/PulseIn.c
+#: ports/stm32f4/common-hal/pulseio/PulseIn.c
#, c-format
msgid "Failed to allocate RX buffer of %d bytes"
msgstr ""
@@ -1157,6 +1158,10 @@ msgstr ""
msgid "Pin does not have ADC capabilities"
msgstr ""
+#: ports/stm32f4/common-hal/pulseio/PulseIn.c
+msgid "Pin number already reserved by EXTI"
+msgstr ""
+
#: py/builtinhelp.c
msgid "Plus any modules on the filesystem\n"
msgstr ""
@@ -1177,10 +1182,6 @@ msgstr ""
msgid "Pull not used when direction is output."
msgstr ""
-#: ports/stm32f4/common-hal/pulseio/PulseIn.c
-msgid "PulseIn not yet supported"
-msgstr ""
-
#: ports/stm32f4/common-hal/pulseio/PulseOut.c
msgid "PulseOut not supported on this chip"
msgstr ""
@@ -2212,7 +2213,8 @@ msgstr ""
#: ports/atmel-samd/common-hal/pulseio/PulseIn.c
#: ports/cxd56/common-hal/pulseio/PulseIn.c
-#: ports/nrf/common-hal/pulseio/PulseIn.c py/obj.c
+#: ports/nrf/common-hal/pulseio/PulseIn.c
+#: ports/stm32f4/common-hal/pulseio/PulseIn.c py/obj.c
msgid "index out of range"
msgstr ""
@@ -2698,6 +2700,7 @@ msgstr ""
#: ports/atmel-samd/common-hal/pulseio/PulseIn.c
#: ports/cxd56/common-hal/pulseio/PulseIn.c
#: ports/nrf/common-hal/pulseio/PulseIn.c
+#: ports/stm32f4/common-hal/pulseio/PulseIn.c
msgid "pop from an empty PulseIn"
msgstr ""
@@ -2928,6 +2931,7 @@ msgstr ""
#: ports/atmel-samd/common-hal/busio/UART.c
#: ports/mimxrt10xx/common-hal/busio/UART.c ports/nrf/common-hal/busio/UART.c
+#: shared-bindings/busio/UART.c
msgid "tx and rx cannot both be None"
msgstr ""
diff --git a/locale/pl.po b/locale/pl.po
index 581dac8d0..6eb37254b 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: 2020-03-09 08:19-0500\n"
+"POT-Creation-Date: 2020-03-11 17:52-0400\n"
"PO-Revision-Date: 2019-03-19 18:37-0700\n"
"Last-Translator: Radomir Dopieralski <circuitpython@sheep.art.pl>\n"
"Language-Team: pl\n"
@@ -701,6 +701,7 @@ msgstr "Nie udała się alokacja bufora RX"
#: ports/atmel-samd/common-hal/pulseio/PulseIn.c
#: ports/cxd56/common-hal/pulseio/PulseIn.c
#: ports/nrf/common-hal/pulseio/PulseIn.c
+#: ports/stm32f4/common-hal/pulseio/PulseIn.c
#, c-format
msgid "Failed to allocate RX buffer of %d bytes"
msgstr "Nie udała się alokacja %d bajtów na bufor RX"
@@ -1158,6 +1159,10 @@ msgstr "Odmowa dostępu"
msgid "Pin does not have ADC capabilities"
msgstr "Nóżka nie obsługuje ADC"
+#: ports/stm32f4/common-hal/pulseio/PulseIn.c
+msgid "Pin number already reserved by EXTI"
+msgstr ""
+
#: py/builtinhelp.c
msgid "Plus any modules on the filesystem\n"
msgstr "Oraz moduły w systemie plików\n"
@@ -1178,10 +1183,6 @@ msgstr "Dowolny klawisz aby uruchomić konsolę. CTRL-D aby przeładować."
msgid "Pull not used when direction is output."
msgstr "Podciągnięcie nieużywane w trybie wyjścia."
-#: ports/stm32f4/common-hal/pulseio/PulseIn.c
-msgid "PulseIn not yet supported"
-msgstr ""
-
#: ports/stm32f4/common-hal/pulseio/PulseOut.c
msgid "PulseOut not supported on this chip"
msgstr ""
@@ -2216,7 +2217,8 @@ msgstr ""
#: ports/atmel-samd/common-hal/pulseio/PulseIn.c
#: ports/cxd56/common-hal/pulseio/PulseIn.c
-#: ports/nrf/common-hal/pulseio/PulseIn.c py/obj.c
+#: ports/nrf/common-hal/pulseio/PulseIn.c
+#: ports/stm32f4/common-hal/pulseio/PulseIn.c py/obj.c
msgid "index out of range"
msgstr "indeks poza zakresem"
@@ -2703,6 +2705,7 @@ msgstr ""
#: ports/atmel-samd/common-hal/pulseio/PulseIn.c
#: ports/cxd56/common-hal/pulseio/PulseIn.c
#: ports/nrf/common-hal/pulseio/PulseIn.c
+#: ports/stm32f4/common-hal/pulseio/PulseIn.c
msgid "pop from an empty PulseIn"
msgstr "pop z pustego PulseIn"
@@ -2934,6 +2937,7 @@ msgstr "wymagana krotka/lista po prawej stronie"
#: ports/atmel-samd/common-hal/busio/UART.c
#: ports/mimxrt10xx/common-hal/busio/UART.c ports/nrf/common-hal/busio/UART.c
+#: shared-bindings/busio/UART.c
msgid "tx and rx cannot both be None"
msgstr "tx i rx nie mogą być oba None"
diff --git a/locale/pt_BR.po b/locale/pt_BR.po
index 3dce592e3..a0f2024eb 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: 2020-03-09 08:19-0500\n"
+"POT-Creation-Date: 2020-03-11 17:52-0400\n"
"PO-Revision-Date: 2018-10-02 21:14-0000\n"
"Last-Translator: \n"
"Language-Team: \n"
@@ -707,6 +707,7 @@ msgstr "Falha ao alocar buffer RX"
#: ports/atmel-samd/common-hal/pulseio/PulseIn.c
#: ports/cxd56/common-hal/pulseio/PulseIn.c
#: ports/nrf/common-hal/pulseio/PulseIn.c
+#: ports/stm32f4/common-hal/pulseio/PulseIn.c
#, c-format
msgid "Failed to allocate RX buffer of %d bytes"
msgstr "Falha ao alocar buffer RX de %d bytes"
@@ -1168,6 +1169,10 @@ msgstr "Permissão negada"
msgid "Pin does not have ADC capabilities"
msgstr "O pino não tem recursos de ADC"
+#: ports/stm32f4/common-hal/pulseio/PulseIn.c
+msgid "Pin number already reserved by EXTI"
+msgstr ""
+
#: py/builtinhelp.c
#, fuzzy
msgid "Plus any modules on the filesystem\n"
@@ -1189,10 +1194,6 @@ msgstr ""
msgid "Pull not used when direction is output."
msgstr ""
-#: ports/stm32f4/common-hal/pulseio/PulseIn.c
-msgid "PulseIn not yet supported"
-msgstr ""
-
#: ports/stm32f4/common-hal/pulseio/PulseOut.c
msgid "PulseOut not supported on this chip"
msgstr ""
@@ -2229,7 +2230,8 @@ msgstr ""
#: ports/atmel-samd/common-hal/pulseio/PulseIn.c
#: ports/cxd56/common-hal/pulseio/PulseIn.c
-#: ports/nrf/common-hal/pulseio/PulseIn.c py/obj.c
+#: ports/nrf/common-hal/pulseio/PulseIn.c
+#: ports/stm32f4/common-hal/pulseio/PulseIn.c py/obj.c
msgid "index out of range"
msgstr "Índice fora do intervalo"
@@ -2715,6 +2717,7 @@ msgstr ""
#: ports/atmel-samd/common-hal/pulseio/PulseIn.c
#: ports/cxd56/common-hal/pulseio/PulseIn.c
#: ports/nrf/common-hal/pulseio/PulseIn.c
+#: ports/stm32f4/common-hal/pulseio/PulseIn.c
msgid "pop from an empty PulseIn"
msgstr ""
@@ -2947,6 +2950,7 @@ msgstr ""
#: ports/atmel-samd/common-hal/busio/UART.c
#: ports/mimxrt10xx/common-hal/busio/UART.c ports/nrf/common-hal/busio/UART.c
+#: shared-bindings/busio/UART.c
msgid "tx and rx cannot both be None"
msgstr "TX e RX não podem ser ambos"
diff --git a/locale/zh_Latn_pinyin.po b/locale/zh_Latn_pinyin.po
index cc23d7fc8..e93bcb1d2 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: 2020-03-09 08:19-0500\n"
+"POT-Creation-Date: 2020-03-11 17:52-0400\n"
"PO-Revision-Date: 2019-04-13 10:10-0700\n"
"Last-Translator: hexthat\n"
"Language-Team: Chinese Hanyu Pinyin\n"
@@ -709,6 +709,7 @@ msgstr "Fēnpèi RX huǎnchōng shībài"
#: ports/atmel-samd/common-hal/pulseio/PulseIn.c
#: ports/cxd56/common-hal/pulseio/PulseIn.c
#: ports/nrf/common-hal/pulseio/PulseIn.c
+#: ports/stm32f4/common-hal/pulseio/PulseIn.c
#, c-format
msgid "Failed to allocate RX buffer of %d bytes"
msgstr "Fēnpèi RX huǎnchōng qū%d zì jié shībài"
@@ -1172,6 +1173,10 @@ msgstr "Quánxiàn bèi jùjué"
msgid "Pin does not have ADC capabilities"
msgstr "Pin méiyǒu ADC nénglì"
+#: ports/stm32f4/common-hal/pulseio/PulseIn.c
+msgid "Pin number already reserved by EXTI"
+msgstr ""
+
#: py/builtinhelp.c
msgid "Plus any modules on the filesystem\n"
msgstr "Zài wénjiàn xìtǒng shàng tiānjiā rènhé mókuài\n"
@@ -1192,10 +1197,6 @@ msgstr "Àn xià rènhé jiàn jìnrù REPL. Shǐyòng CTRL-D chóngxīn jiāzà
msgid "Pull not used when direction is output."
msgstr "Fāngxiàng shūchū shí Pull méiyǒu shǐyòng."
-#: ports/stm32f4/common-hal/pulseio/PulseIn.c
-msgid "PulseIn not yet supported"
-msgstr "Shàng bù zhīchí PulseIn"
-
#: ports/stm32f4/common-hal/pulseio/PulseOut.c
msgid "PulseOut not supported on this chip"
msgstr ""
@@ -2244,7 +2245,8 @@ msgstr ""
#: ports/atmel-samd/common-hal/pulseio/PulseIn.c
#: ports/cxd56/common-hal/pulseio/PulseIn.c
-#: ports/nrf/common-hal/pulseio/PulseIn.c py/obj.c
+#: ports/nrf/common-hal/pulseio/PulseIn.c
+#: ports/stm32f4/common-hal/pulseio/PulseIn.c py/obj.c
msgid "index out of range"
msgstr "suǒyǐn chāochū fànwéi"
@@ -2732,6 +2734,7 @@ msgstr "pixel_shader bìxū shì displayio.Palette huò displayio.ColorConverter
#: ports/atmel-samd/common-hal/pulseio/PulseIn.c
#: ports/cxd56/common-hal/pulseio/PulseIn.c
#: ports/nrf/common-hal/pulseio/PulseIn.c
+#: ports/stm32f4/common-hal/pulseio/PulseIn.c
msgid "pop from an empty PulseIn"
msgstr "cóng kōng de PulseIn dànchū dànchū"
@@ -2964,6 +2967,7 @@ msgstr "RHS yāoqiú de yuán zǔ/lièbiǎo"
#: ports/atmel-samd/common-hal/busio/UART.c
#: ports/mimxrt10xx/common-hal/busio/UART.c ports/nrf/common-hal/busio/UART.c
+#: shared-bindings/busio/UART.c
msgid "tx and rx cannot both be None"
msgstr "tx hé rx bùnéng dōu shì wú"
@@ -3325,6 +3329,9 @@ msgstr "líng bù"
#~ msgid "Pixel beyond bounds of buffer"
#~ msgstr "Xiàngsù chāochū huǎnchōng qū biānjiè"
+#~ msgid "PulseIn not yet supported"
+#~ msgstr "Shàng bù zhīchí PulseIn"
+
#~ msgid "PulseOut not yet supported"
#~ msgstr "Shàng bù zhīchí PulseOut"
diff --git a/ports/nrf/boards/TG-Watch02A/board.c b/ports/nrf/boards/TG-Watch02A/board.c
new file mode 100644
index 000000000..4421970ee
--- /dev/null
+++ b/ports/nrf/boards/TG-Watch02A/board.c
@@ -0,0 +1,38 @@
+/*
+ * This file is part of the MicroPython project, http://micropython.org/
+ *
+ * The MIT License (MIT)
+ *
+ * Copyright (c) 2017 Scott Shawcroft for Adafruit Industries
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a copy
+ * of this software and associated documentation files (the "Software"), to deal
+ * in the Software without restriction, including without limitation the rights
+ * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+ * copies of the Software, and to permit persons to whom the Software is
+ * furnished to do so, subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice shall be included in
+ * all copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+ * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+ * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+ * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
+ * THE SOFTWARE.
+ */
+
+#include "boards/board.h"
+
+void board_init(void) {
+}
+
+bool board_requests_safe_mode(void) {
+ return false;
+}
+
+void reset_board(void) {
+
+}
diff --git a/ports/nrf/boards/TG-Watch02A/mpconfigboard.h b/ports/nrf/boards/TG-Watch02A/mpconfigboard.h
new file mode 100644
index 000000000..9b8a31858
--- /dev/null
+++ b/ports/nrf/boards/TG-Watch02A/mpconfigboard.h
@@ -0,0 +1,61 @@
+/*
+ * This file is part of the MicroPython project, http://micropython.org/
+ *
+ * The MIT License (MIT)
+ *
+ * Copyright (c) 2016 Glenn Ruben Bakke
+ * Copyright (c) 2018 Dan Halbert for Adafruit Industries
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a copy
+ * of this software and associated documentation files (the "Software"), to deal
+ * in the Software without restriction, including without limitation the rights
+ * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+ * copies of the Software, and to permit persons to whom the Software is
+ * furnished to do so, subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice shall be included in
+ * all copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+ * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+ * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+ * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
+ * THE SOFTWARE.
+ */
+
+#include "nrfx/hal/nrf_gpio.h"
+
+#define MICROPY_HW_BOARD_NAME "TG-Techie's TG-Watch02A"
+#define MICROPY_HW_MCU_NAME "nRF52840"
+
+#define MICROPY_HW_LED_STATUS (&pin_P0_07)
+
+#if QSPI_FLASH_FILESYSTEM
+#define MICROPY_QSPI_DATA0 NRF_GPIO_PIN_MAP(0, 17)
+#define MICROPY_QSPI_DATA1 NRF_GPIO_PIN_MAP(0, 22)
+#define MICROPY_QSPI_DATA2 NRF_GPIO_PIN_MAP(0, 23)
+#define MICROPY_QSPI_DATA3 NRF_GPIO_PIN_MAP(0, 21)
+#define MICROPY_QSPI_SCK NRF_GPIO_PIN_MAP(0, 19)
+#define MICROPY_QSPI_CS NRF_GPIO_PIN_MAP(0, 20)
+#endif
+
+#if SPI_FLASH_FILESYSTEM
+#define SPI_FLASH_MOSI_PIN &pin_P0_17
+#define SPI_FLASH_MISO_PIN &pin_P0_22
+#define SPI_FLASH_SCK_PIN &pin_P0_19
+#define SPI_FLASH_CS_PIN &pin_P0_20
+#endif
+
+#define BOARD_HAS_CRYSTAL 0
+
+#define DEFAULT_I2C_BUS_SCL (&pin_P0_11)
+#define DEFAULT_I2C_BUS_SDA (&pin_P0_12)
+
+#define DEFAULT_SPI_BUS_SCK (&pin_P0_14)
+#define DEFAULT_SPI_BUS_MOSI (&pin_P0_13)
+#define DEFAULT_SPI_BUS_MISO (&pin_P0_15)
+
+#define DEFAULT_UART_BUS_RX (&pin_P0_24)
+#define DEFAULT_UART_BUS_TX (&pin_P0_25)
diff --git a/ports/nrf/boards/TG-Watch02A/mpconfigboard.mk b/ports/nrf/boards/TG-Watch02A/mpconfigboard.mk
new file mode 100644
index 000000000..c75c6dd39
--- /dev/null
+++ b/ports/nrf/boards/TG-Watch02A/mpconfigboard.mk
@@ -0,0 +1,11 @@
+USB_VID = 0x239A
+USB_PID = 0x802A
+
+USB_PRODUCT = "TG-Watch02A"
+USB_MANUFACTURER = "TG-Tech"
+
+MCU_CHIP = nrf52840
+
+QSPI_FLASH_FILESYSTEM = 1
+EXTERNAL_FLASH_DEVICE_COUNT = 2
+EXTERNAL_FLASH_DEVICES = "GD25Q16C, W25Q128JV_SQ"
diff --git a/ports/nrf/boards/TG-Watch02A/pins.c b/ports/nrf/boards/TG-Watch02A/pins.c
new file mode 100644
index 000000000..582d954ec
--- /dev/null
+++ b/ports/nrf/boards/TG-Watch02A/pins.c
@@ -0,0 +1,51 @@
+#include "shared-bindings/board/__init__.h"
+
+STATIC const mp_rom_map_elem_t board_module_globals_table[] = {
+
+ /*Port and bus pins*/
+ { MP_ROM_QSTR(MP_QSTR_SCK), MP_ROM_PTR(&pin_P0_14) },
+ { MP_ROM_QSTR(MP_QSTR_MOSI), MP_ROM_PTR(&pin_P0_13) },
+ { MP_ROM_QSTR(MP_QSTR_MISO), MP_ROM_PTR(&pin_P0_15) },
+
+ { MP_ROM_QSTR(MP_QSTR_SCL), MP_ROM_PTR(&pin_P0_11) },
+ { MP_ROM_QSTR(MP_QSTR_SDA), MP_ROM_PTR(&pin_P0_12) },
+
+ { MP_ROM_QSTR(MP_QSTR_UART), MP_ROM_PTR(&board_uart_obj) },
+ { MP_ROM_QSTR(MP_QSTR_SPI), MP_ROM_PTR(&board_spi_obj) },
+ { MP_ROM_QSTR(MP_QSTR_I2C), MP_ROM_PTR(&board_i2c_obj) },
+
+ /*TG-Watch02A specific pins*/
+
+ //tft / display pins
+ { MP_ROM_QSTR(MP_QSTR_BACKLIGHT), MP_ROM_PTR(&pin_P0_07) },
+ { MP_ROM_QSTR(MP_QSTR_DISP_PWR), MP_ROM_PTR(&pin_P0_05) },
+ { MP_ROM_QSTR(MP_QSTR_TFT_CS), MP_ROM_PTR(&pin_P1_14) },
+ { MP_ROM_QSTR(MP_QSTR_TFT_DC), MP_ROM_PTR(&pin_P1_12) },
+ { MP_ROM_QSTR(MP_QSTR_TFT_RESET), MP_ROM_PTR(&pin_P1_01) },
+
+ //cap touch screen
+ { MP_ROM_QSTR(MP_QSTR_CTP_RESET), MP_ROM_PTR(&pin_P1_03) },
+ { MP_ROM_QSTR(MP_QSTR_CTP_INT), MP_ROM_PTR(&pin_P1_05) },
+
+ //power / battery
+ { MP_ROM_QSTR(MP_QSTR_CHRG_STAT), MP_ROM_PTR(&pin_P0_06) },
+ { MP_ROM_QSTR(MP_QSTR_BAT_VDIV), MP_ROM_PTR(&pin_P0_29) },
+ { MP_ROM_QSTR(MP_QSTR_VBUS_PRESENT), MP_ROM_PTR(&pin_P1_04) },
+
+ //sensors / outputs
+ { MP_ROM_QSTR(MP_QSTR_RTC_RESET), MP_ROM_PTR(&pin_P0_26) },
+ { MP_ROM_QSTR(MP_QSTR_RTC_INT), MP_ROM_PTR(&pin_P0_27) },
+
+ { MP_ROM_QSTR(MP_QSTR_ACCEL_INT1), MP_ROM_PTR(&pin_P1_11) },
+ { MP_ROM_QSTR(MP_QSTR_ACCEL_INT2), MP_ROM_PTR(&pin_P1_10) },
+
+ { MP_ROM_QSTR(MP_QSTR_HAPTIC_INT), MP_ROM_PTR(&pin_P1_07) },
+ { MP_ROM_QSTR(MP_QSTR_HAPTIC_ENABLE), MP_ROM_PTR(&pin_P1_06) },
+
+ //smc pins
+ { MP_ROM_QSTR(MP_QSTR_SMC_RESET), MP_ROM_PTR(&pin_P0_08) },
+ { MP_ROM_QSTR(MP_QSTR_BUTTON0), MP_ROM_PTR(&pin_P1_08) },
+ { MP_ROM_QSTR(MP_QSTR_BUTTON1), MP_ROM_PTR(&pin_P1_09) },
+};
+
+MP_DEFINE_CONST_DICT(board_module_globals, board_module_globals_table);
diff --git a/ports/nrf/boards/pca10056/mpconfigboard.h b/ports/nrf/boards/pca10056/mpconfigboard.h
index 5d0d4d3a5..4856a9570 100644
--- a/ports/nrf/boards/pca10056/mpconfigboard.h
+++ b/ports/nrf/boards/pca10056/mpconfigboard.h
@@ -5,6 +5,7 @@
*
* Copyright (c) 2016 Glenn Ruben Bakke
*
+ *
* Permission is hereby granted, free of charge, to any person obtaining a copy
* of this software and associated documentation files (the "Software"), to deal
* in the Software without restriction, including without limitation the rights
diff --git a/ports/stm/Makefile b/ports/stm/Makefile
index 3a6191c85..f8c05fd80 100755
--- a/ports/stm/Makefile
+++ b/ports/stm/Makefile
@@ -66,10 +66,10 @@ INC += -I.
INC += -I../..
INC += -I$(BUILD)
INC += -I$(BUILD)/genhdr
-INC += -I./stm32f4/STM32F4xx_HAL_Driver/Inc
-INC += -I./stm32f4/STM32F4xx_HAL_Driver/Inc/Legacy
-INC += -I./stm32f4/CMSIS/Device/ST/STM32F4xx/Include
-INC += -I./stm32f4/CMSIS/Include
+INC += -I./st_driver/STM32F4xx_HAL_Driver/Inc
+INC += -I./st_driver/STM32F4xx_HAL_Driver/Inc/Legacy
+INC += -I./st_driver/CMSIS/Device/ST/STM32F4xx/Include
+INC += -I./st_driver/CMSIS/Include
INC += -I./boards
INC += -I./boards/$(BOARD)
INC += -I./peripherals
@@ -147,46 +147,45 @@ CFLAGS += -DCFG_TUSB_MCU=OPT_MCU_STM32F4 -DCFG_TUD_CDC_RX_BUFSIZE=1024 -DCFG_TUD
######################################
SRC_STM32 = \
- stm32f4/STM32F4xx_HAL_Driver/Src/stm32f4xx_hal_adc.c \
- stm32f4/STM32F4xx_HAL_Driver/Src/stm32f4xx_hal_adc_ex.c \
- stm32f4/STM32F4xx_HAL_Driver/Src/stm32f4xx_hal_dac.c \
- stm32f4/STM32F4xx_HAL_Driver/Src/stm32f4xx_hal_dac_ex.c \
- stm32f4/STM32F4xx_HAL_Driver/Src/stm32f4xx_hal_i2c.c \
- stm32f4/STM32F4xx_HAL_Driver/Src/stm32f4xx_hal_i2c_ex.c \
- stm32f4/STM32F4xx_HAL_Driver/Src/stm32f4xx_hal_qspi.c \
- stm32f4/STM32F4xx_HAL_Driver/Src/stm32f4xx_hal_rng.c \
- stm32f4/STM32F4xx_HAL_Driver/Src/stm32f4xx_hal_rtc.c \
- stm32f4/STM32F4xx_HAL_Driver/Src/stm32f4xx_hal_rtc_ex.c \
- stm32f4/STM32F4xx_HAL_Driver/Src/stm32f4xx_hal_spi.c \
- stm32f4/STM32F4xx_HAL_Driver/Src/stm32f4xx_hal_tim.c \
- stm32f4/STM32F4xx_HAL_Driver/Src/stm32f4xx_hal_tim_ex.c \
- stm32f4/STM32F4xx_HAL_Driver/Src/stm32f4xx_hal_uart.c \
- stm32f4/STM32F4xx_HAL_Driver/Src/stm32f4xx_hal_usart.c \
- stm32f4/STM32F4xx_HAL_Driver/Src/stm32f4xx_hal_rcc.c \
- stm32f4/STM32F4xx_HAL_Driver/Src/stm32f4xx_hal_rcc_ex.c \
- stm32f4/STM32F4xx_HAL_Driver/Src/stm32f4xx_hal_flash.c \
- stm32f4/STM32F4xx_HAL_Driver/Src/stm32f4xx_hal_flash_ex.c \
- stm32f4/STM32F4xx_HAL_Driver/Src/stm32f4xx_hal_flash_ramfunc.c \
- stm32f4/STM32F4xx_HAL_Driver/Src/stm32f4xx_hal_gpio.c \
- stm32f4/STM32F4xx_HAL_Driver/Src/stm32f4xx_hal_dma_ex.c \
- stm32f4/STM32F4xx_HAL_Driver/Src/stm32f4xx_hal_dma.c \
- stm32f4/STM32F4xx_HAL_Driver/Src/stm32f4xx_hal_pwr.c \
- stm32f4/STM32F4xx_HAL_Driver/Src/stm32f4xx_hal_pwr_ex.c \
- stm32f4/STM32F4xx_HAL_Driver/Src/stm32f4xx_hal_cortex.c \
- stm32f4/STM32F4xx_HAL_Driver/Src/stm32f4xx_hal.c \
- stm32f4/STM32F4xx_HAL_Driver/Src/stm32f4xx_hal_exti.c \
- stm32f4/STM32F4xx_HAL_Driver/Src/stm32f4xx_hal_sd.c \
- stm32f4/STM32F4xx_HAL_Driver/Src/stm32f4xx_ll_gpio.c \
- stm32f4/STM32F4xx_HAL_Driver/Src/stm32f4xx_ll_adc.c \
- stm32f4/STM32F4xx_HAL_Driver/Src/stm32f4xx_ll_usb.c \
- stm32f4/STM32F4xx_HAL_Driver/Src/stm32f4xx_ll_fsmc.c \
- stm32f4/STM32F4xx_HAL_Driver/Src/stm32f4xx_ll_i2c.c \
- stm32f4/STM32F4xx_HAL_Driver/Src/stm32f4xx_ll_dma.c \
- stm32f4/STM32F4xx_HAL_Driver/Src/stm32f4xx_ll_sdmmc.c \
- stm32f4/STM32F4xx_HAL_Driver/Src/stm32f4xx_ll_usart.c \
- stm32f4/STM32F4xx_HAL_Driver/Src/stm32f4xx_ll_rcc.c \
- stm32f4/STM32F4xx_HAL_Driver/Src/stm32f4xx_ll_utils.c \
- stm32f4/STM32F4xx_HAL_Driver/Src/stm32f4xx_ll_exti.c \
+ st_driver/STM32F4xx_HAL_Driver/Src/stm32f4xx_hal_adc.c \
+ st_driver/STM32F4xx_HAL_Driver/Src/stm32f4xx_hal_adc_ex.c \
+ st_driver/STM32F4xx_HAL_Driver/Src/stm32f4xx_hal_dac.c \
+ st_driver/STM32F4xx_HAL_Driver/Src/stm32f4xx_hal_dac_ex.c \
+ st_driver/STM32F4xx_HAL_Driver/Src/stm32f4xx_hal_i2c.c \
+ st_driver/STM32F4xx_HAL_Driver/Src/stm32f4xx_hal_i2c_ex.c \
+ st_driver/STM32F4xx_HAL_Driver/Src/stm32f4xx_hal_qspi.c \
+ st_driver/STM32F4xx_HAL_Driver/Src/stm32f4xx_hal_rng.c \
+ st_driver/STM32F4xx_HAL_Driver/Src/stm32f4xx_hal_rtc.c \
+ st_driver/STM32F4xx_HAL_Driver/Src/stm32f4xx_hal_rtc_ex.c \
+ st_driver/STM32F4xx_HAL_Driver/Src/stm32f4xx_hal_spi.c \
+ st_driver/STM32F4xx_HAL_Driver/Src/stm32f4xx_hal_tim.c \
+ st_driver/STM32F4xx_HAL_Driver/Src/stm32f4xx_hal_tim_ex.c \
+ st_driver/STM32F4xx_HAL_Driver/Src/stm32f4xx_hal_uart.c \
+ st_driver/STM32F4xx_HAL_Driver/Src/stm32f4xx_hal_usart.c \
+ st_driver/STM32F4xx_HAL_Driver/Src/stm32f4xx_hal_rcc.c \
+ st_driver/STM32F4xx_HAL_Driver/Src/stm32f4xx_hal_rcc_ex.c \
+ st_driver/STM32F4xx_HAL_Driver/Src/stm32f4xx_hal_flash.c \
+ st_driver/STM32F4xx_HAL_Driver/Src/stm32f4xx_hal_flash_ex.c \
+ st_driver/STM32F4xx_HAL_Driver/Src/stm32f4xx_hal_flash_ramfunc.c \
+ st_driver/STM32F4xx_HAL_Driver/Src/stm32f4xx_hal_gpio.c \
+ st_driver/STM32F4xx_HAL_Driver/Src/stm32f4xx_hal_dma_ex.c \
+ st_driver/STM32F4xx_HAL_Driver/Src/stm32f4xx_hal_dma.c \
+ st_driver/STM32F4xx_HAL_Driver/Src/stm32f4xx_hal_pwr.c \
+ st_driver/STM32F4xx_HAL_Driver/Src/stm32f4xx_hal_pwr_ex.c \
+ st_driver/STM32F4xx_HAL_Driver/Src/stm32f4xx_hal_cortex.c \
+ st_driver/STM32F4xx_HAL_Driver/Src/stm32f4xx_hal.c \
+ st_driver/STM32F4xx_HAL_Driver/Src/stm32f4xx_hal_exti.c \
+ st_driver/STM32F4xx_HAL_Driver/Src/stm32f4xx_hal_sd.c \
+ st_driver/STM32F4xx_HAL_Driver/Src/stm32f4xx_ll_gpio.c \
+ st_driver/STM32F4xx_HAL_Driver/Src/stm32f4xx_ll_adc.c \
+ st_driver/STM32F4xx_HAL_Driver/Src/stm32f4xx_ll_fsmc.c \
+ st_driver/STM32F4xx_HAL_Driver/Src/stm32f4xx_ll_i2c.c \
+ st_driver/STM32F4xx_HAL_Driver/Src/stm32f4xx_ll_dma.c \
+ st_driver/STM32F4xx_HAL_Driver/Src/stm32f4xx_ll_sdmmc.c \
+ st_driver/STM32F4xx_HAL_Driver/Src/stm32f4xx_ll_usart.c \
+ st_driver/STM32F4xx_HAL_Driver/Src/stm32f4xx_ll_rcc.c \
+ st_driver/STM32F4xx_HAL_Driver/Src/stm32f4xx_ll_utils.c \
+ st_driver/STM32F4xx_HAL_Driver/Src/stm32f4xx_ll_exti.c \
system_stm32f4xx.c
diff --git a/ports/stm/common-hal/pulseio/PulseIn.c b/ports/stm/common-hal/pulseio/PulseIn.c
index 068936bdd..8428a2278 100644
--- a/ports/stm/common-hal/pulseio/PulseIn.c
+++ b/ports/stm/common-hal/pulseio/PulseIn.c
@@ -34,46 +34,270 @@
#include "shared-bindings/pulseio/PulseIn.h"
#include "tick.h"
+#include "stm32f4xx_hal.h"
+
+#define STM32_GPIO_PORT_SIZE 16
+
+static pulseio_pulsein_obj_t* _objs[STM32_GPIO_PORT_SIZE];
+
+static void assign_EXTI_Interrupt(pulseio_pulsein_obj_t* self, uint8_t num);
+
+static void pulsein_handler(uint8_t num) {
+ // Interrupt register must be cleared manually
+ EXTI->PR = 1 << num;
+
+ // Grab the current time first.
+ uint32_t current_us;
+ uint64_t current_ms;
+ current_tick(&current_ms, &current_us);
+
+ // current_tick gives us the remaining us until the next tick but we want the number since the last ms.
+ current_us = 1000 - current_us;
+
+ pulseio_pulsein_obj_t* self = _objs[num];
+ if ( !self ) return;
+
+ if (self->first_edge) {
+ // first pulse is opposite state from idle
+ bool state = HAL_GPIO_ReadPin(pin_port(self->pin->port), pin_mask(self->pin->number));
+ if ( self->idle_state != state ) {
+ self->first_edge = false;
+ }
+ } else {
+ uint32_t ms_diff = current_ms - self->last_ms;
+ uint16_t us_diff = current_us - self->last_us;
+ uint32_t total_diff = us_diff;
+
+ if (self->last_us > current_us) {
+ total_diff = 1000 + current_us - self->last_us;
+ if (ms_diff > 1) {
+ total_diff += (ms_diff - 1) * 1000;
+ }
+ } else {
+ total_diff += ms_diff * 1000;
+ }
+ uint16_t duration = 0xffff;
+ if (total_diff < duration) {
+ duration = total_diff;
+ }
+
+ uint16_t i = (self->start + self->len) % self->maxlen;
+ self->buffer[i] = duration;
+ if (self->len < self->maxlen) {
+ self->len++;
+ } else {
+ self->start++;
+ }
+ }
+
+ self->last_ms = current_ms;
+ self->last_us = current_us;
+}
+
void pulsein_reset(void) {
+ // Disable all active interrupts and clear array
+ for (uint i = 0; i < STM32_GPIO_PORT_SIZE; i++) {
+ if (_objs[i] != NULL) {
+ HAL_NVIC_DisableIRQ(_objs[i]->irq);
+ }
+ }
+ memset(_objs, 0, sizeof(_objs));
}
void common_hal_pulseio_pulsein_construct(pulseio_pulsein_obj_t* self, const mcu_pin_obj_t* pin,
uint16_t maxlen, bool idle_state) {
- mp_raise_NotImplementedError(translate("PulseIn not yet supported"));
+ // STM32 has one shared EXTI for each pin number, 0-15
+ uint8_t p_num = pin->number;
+ if(_objs[p_num]) {
+ mp_raise_ValueError(translate("Pin number already reserved by EXTI"));
+ }
+ _objs[p_num] = self;
+
+ // Allocate pulse buffer
+ self->buffer = (uint16_t *) m_malloc(maxlen * sizeof(uint16_t), false);
+ if (self->buffer == NULL) {
+ mp_raise_msg_varg(&mp_type_MemoryError, translate("Failed to allocate RX buffer of %d bytes"),
+ maxlen * sizeof(uint16_t));
+ }
+
+ // Set internal variables
+ self->pin = pin;
+ self->maxlen = maxlen;
+ self->idle_state = idle_state;
+ self->start = 0;
+ self->len = 0;
+ self->first_edge = true;
+ self->paused = false;
+ self->last_us = 0;
+ self->last_ms = 0;
+
+ // EXTI pins can also be read as an input
+ GPIO_InitTypeDef GPIO_InitStruct = {0};
+ GPIO_InitStruct.Pin = pin_mask(pin->number);
+ GPIO_InitStruct.Mode = GPIO_MODE_IT_RISING_FALLING;
+ GPIO_InitStruct.Pull = GPIO_NOPULL;
+ HAL_GPIO_Init(pin_port(pin->port), &GPIO_InitStruct);
+
+ // Interrupt starts immediately
+ assign_EXTI_Interrupt(self, pin->number);
+ HAL_NVIC_EnableIRQ(self->irq);
+ claim_pin(pin);
}
bool common_hal_pulseio_pulsein_deinited(pulseio_pulsein_obj_t* self) {
- return true;
+ return (self->pin == NULL);
}
void common_hal_pulseio_pulsein_deinit(pulseio_pulsein_obj_t* self) {
+ if (common_hal_pulseio_pulsein_deinited(self)) {
+ return;
+ }
+ //Remove pulsein slot from shared array
+ HAL_NVIC_DisableIRQ(self->irq);
+ _objs[self->pin->number] = NULL;
+ reset_pin_number(self->pin->port, self->pin->number);
+ self->pin = NULL;
}
void common_hal_pulseio_pulsein_pause(pulseio_pulsein_obj_t* self) {
+ HAL_NVIC_DisableIRQ(self->irq);
+ self->paused = true;
}
void common_hal_pulseio_pulsein_resume(pulseio_pulsein_obj_t* self, uint16_t trigger_duration) {
+ // Make sure we're paused.
+ if ( !self->paused ) {
+ common_hal_pulseio_pulsein_pause(self);
+ }
+
+ // Send the trigger pulse.
+ if (trigger_duration > 0) {
+ GPIO_InitTypeDef GPIO_InitStruct = {0};
+ GPIO_InitStruct.Pin = pin_mask(self->pin->number);
+ GPIO_InitStruct.Mode = GPIO_MODE_OUTPUT_PP;
+ GPIO_InitStruct.Pull = GPIO_NOPULL;
+ GPIO_InitStruct.Speed = GPIO_SPEED_FREQ_LOW;
+ HAL_GPIO_Init(pin_port(self->pin->port), &GPIO_InitStruct);
+
+ HAL_GPIO_WritePin(pin_port(self->pin->port), pin_mask(self->pin->number), !self->idle_state);
+ common_hal_mcu_delay_us((uint32_t)trigger_duration);
+ HAL_GPIO_WritePin(pin_port(self->pin->port), pin_mask(self->pin->number), self->idle_state);
+
+ GPIO_InitStruct.Pin = pin_mask(self->pin->number);
+ GPIO_InitStruct.Mode = GPIO_MODE_IT_RISING_FALLING;
+ GPIO_InitStruct.Pull = GPIO_NOPULL;
+ HAL_GPIO_Init(pin_port(self->pin->port), &GPIO_InitStruct);
+ }
+
+ self->first_edge = true;
+ self->paused = false;
+ self->last_ms = 0;
+ self->last_us = 0;
+
+ HAL_NVIC_EnableIRQ(self->irq);
}
void common_hal_pulseio_pulsein_clear(pulseio_pulsein_obj_t* self) {
+ HAL_NVIC_DisableIRQ(self->irq);
+ self->start = 0;
+ self->len = 0;
+ HAL_NVIC_EnableIRQ(self->irq);
}
uint16_t common_hal_pulseio_pulsein_get_item(pulseio_pulsein_obj_t* self, int16_t index) {
- return 0;
+ HAL_NVIC_DisableIRQ(self->irq);
+ if (index < 0) {
+ index += self->len;
+ }
+ if (index < 0 || index >= self->len) {
+ HAL_NVIC_EnableIRQ(self->irq);
+ mp_raise_IndexError(translate("index out of range"));
+ }
+ uint16_t value = self->buffer[(self->start + index) % self->maxlen];
+ HAL_NVIC_EnableIRQ(self->irq);
+ return value;
}
uint16_t common_hal_pulseio_pulsein_popleft(pulseio_pulsein_obj_t* self) {
- return 0;
+ if (self->len == 0) {
+ mp_raise_IndexError(translate("pop from an empty PulseIn"));
+ }
+ HAL_NVIC_DisableIRQ(self->irq);
+ uint16_t value = self->buffer[self->start];
+ self->start = (self->start + 1) % self->maxlen;
+ self->len--;
+ HAL_NVIC_EnableIRQ(self->irq);
+
+ return value;
}
uint16_t common_hal_pulseio_pulsein_get_maxlen(pulseio_pulsein_obj_t* self) {
- return 0;
+ return self->maxlen;
}
bool common_hal_pulseio_pulsein_get_paused(pulseio_pulsein_obj_t* self) {
- return 0;
+ return self->paused;
}
uint16_t common_hal_pulseio_pulsein_get_len(pulseio_pulsein_obj_t* self) {
- return 0;
+ return self->len;
+}
+
+static void assign_EXTI_Interrupt(pulseio_pulsein_obj_t* self, uint8_t num) {
+ if (num == 0) {
+ self->irq = EXTI0_IRQn;
+ } else if (num == 1) {
+ self->irq = EXTI1_IRQn;
+ } else if (num == 2) {
+ self->irq = EXTI2_IRQn;
+ } else if (num == 3) {
+ self->irq = EXTI3_IRQn;
+ } else if (num == 4) {
+ self->irq = EXTI4_IRQn;
+ } else if (num >= 5 && num <= 9 ) {
+ self->irq = EXTI9_5_IRQn;
+ } else if (num >= 10 && num <= 15) {
+ self->irq = EXTI15_10_IRQn;
+ }
+}
+
+void EXTI0_IRQHandler(void)
+{
+ pulsein_handler(0);
+}
+void EXTI1_IRQHandler(void)
+{
+ pulsein_handler(1);
+}
+void EXTI2_IRQHandler(void)
+{
+ pulsein_handler(2);
+}
+void EXTI3_IRQHandler(void)
+{
+ pulsein_handler(3);
+}
+void EXTI4_IRQHandler(void)
+{
+ pulsein_handler(4);
+}
+
+void EXTI9_5_IRQHandler(void)
+{
+ uint32_t pending = EXTI->PR;
+ for (uint i = 5; i <= 9; i++) {
+ if(pending & (1 << i)) {
+ pulsein_handler(i);
+ }
+ }
+}
+
+void EXTI15_10_IRQHandler(void)
+{
+ uint32_t pending = EXTI->PR;
+ for (uint i = 10; i <= 15; i++) {
+ if(pending & (1 << i)) {
+ pulsein_handler(i);
+ }
+ }
}
diff --git a/ports/stm/common-hal/pulseio/PulseIn.h b/ports/stm/common-hal/pulseio/PulseIn.h
index 2538b07ab..5456613c6 100644
--- a/ports/stm/common-hal/pulseio/PulseIn.h
+++ b/ports/stm/common-hal/pulseio/PulseIn.h
@@ -34,7 +34,8 @@
typedef struct {
mp_obj_base_t base;
- uint8_t pin;
+ const mcu_pin_obj_t* pin;
+ IRQn_Type irq;
bool idle_state;
bool paused;
volatile bool first_edge;
diff --git a/ports/stm/st_driver b/ports/stm/st_driver
new file mode 160000
+Subproject 3fc2e0f3db155b33177bb0705e0dd65cadb5841
diff --git a/ports/stm/stm32f4 b/ports/stm/stm32f4
deleted file mode 160000
-Subproject 89a356f0b44883d55c45a5d22940777a44a2b88
diff --git a/ports/stm/supervisor/port.c b/ports/stm/supervisor/port.c
index ecb4d3d15..948e9f2e4 100644
--- a/ports/stm/supervisor/port.c
+++ b/ports/stm/supervisor/port.c
@@ -36,6 +36,7 @@
#include "common-hal/busio/UART.h"
#include "common-hal/pulseio/PWMOut.h"
#include "common-hal/pulseio/PulseOut.h"
+#include "common-hal/pulseio/PulseIn.h"
#include "stm32f4/clocks.h"
#include "stm32f4/gpio.h"
@@ -62,6 +63,7 @@ void reset_port(void) {
uart_reset();
pwmout_reset();
pulseout_reset();
+ pulsein_reset();
}
void reset_to_bootloader(void) {