diff options
| author | Scott Shawcroft <scott@adafruit.com> | 2020-03-03 13:11:24 -0800 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2020-03-03 13:11:24 -0800 |
| commit | 6468ca04a494590a74e60043597ac6be9b368b91 (patch) | |
| tree | bd868bfa2855f6819cbdb257638756b9cca3cd34 | |
| parent | 2fea811c307d8fa5f30bf960617509c1eea2b61a (diff) | |
| parent | 3178462218210b33abc0c06e74591ca270ac52c6 (diff) | |
Merge pull request #2668 from hierophect/stm32-pulseout
STM32: Add PulseOut support
| -rw-r--r-- | locale/ID.po | 9 | ||||
| -rw-r--r-- | locale/circuitpython.pot | 9 | ||||
| -rw-r--r-- | locale/de_DE.po | 9 | ||||
| -rw-r--r-- | locale/en_US.po | 9 | ||||
| -rw-r--r-- | locale/en_x_pirate.po | 9 | ||||
| -rw-r--r-- | locale/es.po | 9 | ||||
| -rw-r--r-- | locale/fil.po | 9 | ||||
| -rw-r--r-- | locale/fr.po | 9 | ||||
| -rw-r--r-- | locale/it_IT.po | 9 | ||||
| -rw-r--r-- | locale/ko.po | 9 | ||||
| -rw-r--r-- | locale/pl.po | 9 | ||||
| -rw-r--r-- | locale/pt_BR.po | 9 | ||||
| -rw-r--r-- | locale/zh_Latn_pinyin.po | 14 | ||||
| -rw-r--r-- | ports/stm32f4/common-hal/pulseio/PWMOut.c | 2 | ||||
| -rw-r--r-- | ports/stm32f4/common-hal/pulseio/PulseOut.c | 163 | ||||
| -rw-r--r-- | ports/stm32f4/common-hal/pulseio/PulseOut.h | 2 | ||||
| -rw-r--r-- | ports/stm32f4/peripherals/stm32f4/periph.h | 7 | ||||
| -rw-r--r-- | ports/stm32f4/supervisor/port.c | 2 |
18 files changed, 253 insertions, 45 deletions
diff --git a/locale/ID.po b/locale/ID.po index 9978600ea..45a310902 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-02 09:12-0600\n" +"POT-Creation-Date: 2020-03-02 11:20-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" @@ -914,10 +914,13 @@ msgstr "Pin untuk channel kanan tidak valid" #: ports/atmel-samd/common-hal/i2cslave/I2CSlave.c #: ports/cxd56/common-hal/busio/I2C.c ports/cxd56/common-hal/busio/SPI.c #: ports/cxd56/common-hal/busio/UART.c ports/nrf/common-hal/busio/I2C.c -#: ports/stm32f4/common-hal/pulseio/PWMOut.c msgid "Invalid pins" msgstr "Pin-pin tidak valid" +#: ports/stm32f4/common-hal/pulseio/PWMOut.c +msgid "Invalid pins for PWMOut" +msgstr "" + #: shared-bindings/bitbangio/SPI.c shared-bindings/busio/SPI.c msgid "Invalid polarity" msgstr "" @@ -1189,7 +1192,7 @@ msgid "PulseIn not yet supported" msgstr "" #: ports/stm32f4/common-hal/pulseio/PulseOut.c -msgid "PulseOut not yet supported" +msgid "PulseOut not supported on this chip" msgstr "" #: ports/stm32f4/common-hal/os/__init__.c diff --git a/locale/circuitpython.pot b/locale/circuitpython.pot index d44fe8d19..4c0dabfb1 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-02 09:12-0600\n" +"POT-Creation-Date: 2020-03-02 11:20-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" @@ -903,10 +903,13 @@ msgstr "" #: ports/atmel-samd/common-hal/i2cslave/I2CSlave.c #: ports/cxd56/common-hal/busio/I2C.c ports/cxd56/common-hal/busio/SPI.c #: ports/cxd56/common-hal/busio/UART.c ports/nrf/common-hal/busio/I2C.c -#: ports/stm32f4/common-hal/pulseio/PWMOut.c msgid "Invalid pins" msgstr "" +#: ports/stm32f4/common-hal/pulseio/PWMOut.c +msgid "Invalid pins for PWMOut" +msgstr "" + #: shared-bindings/bitbangio/SPI.c shared-bindings/busio/SPI.c msgid "Invalid polarity" msgstr "" @@ -1175,7 +1178,7 @@ msgid "PulseIn not yet supported" msgstr "" #: ports/stm32f4/common-hal/pulseio/PulseOut.c -msgid "PulseOut not yet supported" +msgid "PulseOut not supported on this chip" msgstr "" #: ports/stm32f4/common-hal/os/__init__.c diff --git a/locale/de_DE.po b/locale/de_DE.po index 0d85f1931..35529b768 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-02 09:12-0600\n" +"POT-Creation-Date: 2020-03-02 11:20-0500\n" "PO-Revision-Date: 2018-07-27 11:55-0700\n" "Last-Translator: Pascal Deneaux\n" "Language-Team: Sebastian Plamauer, Pascal Deneaux\n" @@ -911,10 +911,13 @@ msgstr "Ungültiger Pin für rechten Kanal" #: ports/atmel-samd/common-hal/i2cslave/I2CSlave.c #: ports/cxd56/common-hal/busio/I2C.c ports/cxd56/common-hal/busio/SPI.c #: ports/cxd56/common-hal/busio/UART.c ports/nrf/common-hal/busio/I2C.c -#: ports/stm32f4/common-hal/pulseio/PWMOut.c msgid "Invalid pins" msgstr "Ungültige Pins" +#: ports/stm32f4/common-hal/pulseio/PWMOut.c +msgid "Invalid pins for PWMOut" +msgstr "" + #: shared-bindings/bitbangio/SPI.c shared-bindings/busio/SPI.c msgid "Invalid polarity" msgstr "Ungültige Polarität" @@ -1192,7 +1195,7 @@ msgid "PulseIn not yet supported" msgstr "" #: ports/stm32f4/common-hal/pulseio/PulseOut.c -msgid "PulseOut not yet supported" +msgid "PulseOut not supported on this chip" msgstr "" #: ports/stm32f4/common-hal/os/__init__.c diff --git a/locale/en_US.po b/locale/en_US.po index bd21a7e0f..c422703c4 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-02 09:12-0600\n" +"POT-Creation-Date: 2020-03-02 11:20-0500\n" "PO-Revision-Date: 2018-07-27 11:55-0700\n" "Last-Translator: \n" "Language-Team: \n" @@ -903,10 +903,13 @@ msgstr "" #: ports/atmel-samd/common-hal/i2cslave/I2CSlave.c #: ports/cxd56/common-hal/busio/I2C.c ports/cxd56/common-hal/busio/SPI.c #: ports/cxd56/common-hal/busio/UART.c ports/nrf/common-hal/busio/I2C.c -#: ports/stm32f4/common-hal/pulseio/PWMOut.c msgid "Invalid pins" msgstr "" +#: ports/stm32f4/common-hal/pulseio/PWMOut.c +msgid "Invalid pins for PWMOut" +msgstr "" + #: shared-bindings/bitbangio/SPI.c shared-bindings/busio/SPI.c msgid "Invalid polarity" msgstr "" @@ -1175,7 +1178,7 @@ msgid "PulseIn not yet supported" msgstr "" #: ports/stm32f4/common-hal/pulseio/PulseOut.c -msgid "PulseOut not yet supported" +msgid "PulseOut not supported on this chip" msgstr "" #: ports/stm32f4/common-hal/os/__init__.c diff --git a/locale/en_x_pirate.po b/locale/en_x_pirate.po index e6b3d36ca..1f897f0ce 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-02 09:12-0600\n" +"POT-Creation-Date: 2020-03-02 11:20-0500\n" "PO-Revision-Date: 2018-07-27 11:55-0700\n" "Last-Translator: \n" "Language-Team: @sommersoft, @MrCertainly\n" @@ -907,10 +907,13 @@ msgstr "Belay that! Invalid pin for starboard-side channel" #: ports/atmel-samd/common-hal/i2cslave/I2CSlave.c #: ports/cxd56/common-hal/busio/I2C.c ports/cxd56/common-hal/busio/SPI.c #: ports/cxd56/common-hal/busio/UART.c ports/nrf/common-hal/busio/I2C.c -#: ports/stm32f4/common-hal/pulseio/PWMOut.c msgid "Invalid pins" msgstr "" +#: ports/stm32f4/common-hal/pulseio/PWMOut.c +msgid "Invalid pins for PWMOut" +msgstr "" + #: shared-bindings/bitbangio/SPI.c shared-bindings/busio/SPI.c msgid "Invalid polarity" msgstr "" @@ -1179,7 +1182,7 @@ msgid "PulseIn not yet supported" msgstr "" #: ports/stm32f4/common-hal/pulseio/PulseOut.c -msgid "PulseOut not yet supported" +msgid "PulseOut not supported on this chip" msgstr "" #: ports/stm32f4/common-hal/os/__init__.c diff --git a/locale/es.po b/locale/es.po index 35b8c565f..3fed75dfe 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-02 09:12-0600\n" +"POT-Creation-Date: 2020-03-02 11:20-0500\n" "PO-Revision-Date: 2018-08-24 22:56-0500\n" "Last-Translator: \n" "Language-Team: \n" @@ -911,10 +911,13 @@ msgstr "Pin inválido para canal derecho" #: ports/atmel-samd/common-hal/i2cslave/I2CSlave.c #: ports/cxd56/common-hal/busio/I2C.c ports/cxd56/common-hal/busio/SPI.c #: ports/cxd56/common-hal/busio/UART.c ports/nrf/common-hal/busio/I2C.c -#: ports/stm32f4/common-hal/pulseio/PWMOut.c msgid "Invalid pins" msgstr "pines inválidos" +#: ports/stm32f4/common-hal/pulseio/PWMOut.c +msgid "Invalid pins for PWMOut" +msgstr "" + #: shared-bindings/bitbangio/SPI.c shared-bindings/busio/SPI.c msgid "Invalid polarity" msgstr "Polaridad inválida" @@ -1191,7 +1194,7 @@ msgid "PulseIn not yet supported" msgstr "" #: ports/stm32f4/common-hal/pulseio/PulseOut.c -msgid "PulseOut not yet supported" +msgid "PulseOut not supported on this chip" msgstr "" #: ports/stm32f4/common-hal/os/__init__.c diff --git a/locale/fil.po b/locale/fil.po index ec1a88d82..be1158ec6 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-02 09:12-0600\n" +"POT-Creation-Date: 2020-03-02 11:20-0500\n" "PO-Revision-Date: 2018-12-20 22:15-0800\n" "Last-Translator: Timothy <me@timothygarcia.ca>\n" "Language-Team: fil\n" @@ -919,10 +919,13 @@ msgstr "Mali ang pin para sa kanang channel" #: ports/atmel-samd/common-hal/i2cslave/I2CSlave.c #: ports/cxd56/common-hal/busio/I2C.c ports/cxd56/common-hal/busio/SPI.c #: ports/cxd56/common-hal/busio/UART.c ports/nrf/common-hal/busio/I2C.c -#: ports/stm32f4/common-hal/pulseio/PWMOut.c msgid "Invalid pins" msgstr "Mali ang pins" +#: ports/stm32f4/common-hal/pulseio/PWMOut.c +msgid "Invalid pins for PWMOut" +msgstr "" + #: shared-bindings/bitbangio/SPI.c shared-bindings/busio/SPI.c msgid "Invalid polarity" msgstr "Mali ang polarity" @@ -1197,7 +1200,7 @@ msgid "PulseIn not yet supported" msgstr "" #: ports/stm32f4/common-hal/pulseio/PulseOut.c -msgid "PulseOut not yet supported" +msgid "PulseOut not supported on this chip" msgstr "" #: ports/stm32f4/common-hal/os/__init__.c diff --git a/locale/fr.po b/locale/fr.po index a79d8444b..e06d6336d 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-02 09:12-0600\n" +"POT-Creation-Date: 2020-03-02 11:20-0500\n" "PO-Revision-Date: 2019-04-14 20:05+0100\n" "Last-Translator: Pierrick Couturier <arofarn@arofarn.info>\n" "Language-Team: fr\n" @@ -925,10 +925,13 @@ msgstr "Broche invalide pour le canal droit" #: ports/atmel-samd/common-hal/i2cslave/I2CSlave.c #: ports/cxd56/common-hal/busio/I2C.c ports/cxd56/common-hal/busio/SPI.c #: ports/cxd56/common-hal/busio/UART.c ports/nrf/common-hal/busio/I2C.c -#: ports/stm32f4/common-hal/pulseio/PWMOut.c msgid "Invalid pins" msgstr "Broches invalides" +#: ports/stm32f4/common-hal/pulseio/PWMOut.c +msgid "Invalid pins for PWMOut" +msgstr "" + #: shared-bindings/bitbangio/SPI.c shared-bindings/busio/SPI.c msgid "Invalid polarity" msgstr "Polarité invalide" @@ -1210,7 +1213,7 @@ msgid "PulseIn not yet supported" msgstr "" #: ports/stm32f4/common-hal/pulseio/PulseOut.c -msgid "PulseOut not yet supported" +msgid "PulseOut not supported on this chip" msgstr "" #: ports/stm32f4/common-hal/os/__init__.c diff --git a/locale/it_IT.po b/locale/it_IT.po index 172f00878..a43e4e247 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-02 09:12-0600\n" +"POT-Creation-Date: 2020-03-02 11:20-0500\n" "PO-Revision-Date: 2018-10-02 16:27+0200\n" "Last-Translator: Enrico Paganin <enrico.paganin@mail.com>\n" "Language-Team: \n" @@ -921,10 +921,13 @@ msgstr "Pin non valido per il canale destro" #: ports/atmel-samd/common-hal/i2cslave/I2CSlave.c #: ports/cxd56/common-hal/busio/I2C.c ports/cxd56/common-hal/busio/SPI.c #: ports/cxd56/common-hal/busio/UART.c ports/nrf/common-hal/busio/I2C.c -#: ports/stm32f4/common-hal/pulseio/PWMOut.c msgid "Invalid pins" msgstr "Pin non validi" +#: ports/stm32f4/common-hal/pulseio/PWMOut.c +msgid "Invalid pins for PWMOut" +msgstr "" + #: shared-bindings/bitbangio/SPI.c shared-bindings/busio/SPI.c msgid "Invalid polarity" msgstr "Polarità non valida" @@ -1206,7 +1209,7 @@ msgid "PulseIn not yet supported" msgstr "" #: ports/stm32f4/common-hal/pulseio/PulseOut.c -msgid "PulseOut not yet supported" +msgid "PulseOut not supported on this chip" msgstr "" #: ports/stm32f4/common-hal/os/__init__.c diff --git a/locale/ko.po b/locale/ko.po index 81dcd8809..2b2a401aa 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-02 09:12-0600\n" +"POT-Creation-Date: 2020-03-02 11:20-0500\n" "PO-Revision-Date: 2019-05-06 14:22-0700\n" "Last-Translator: \n" "Language-Team: LANGUAGE <LL@li.org>\n" @@ -907,10 +907,13 @@ msgstr "오른쪽 채널 핀이 잘못되었습니다" #: ports/atmel-samd/common-hal/i2cslave/I2CSlave.c #: ports/cxd56/common-hal/busio/I2C.c ports/cxd56/common-hal/busio/SPI.c #: ports/cxd56/common-hal/busio/UART.c ports/nrf/common-hal/busio/I2C.c -#: ports/stm32f4/common-hal/pulseio/PWMOut.c msgid "Invalid pins" msgstr "핀이 유효하지 않습니다" +#: ports/stm32f4/common-hal/pulseio/PWMOut.c +msgid "Invalid pins for PWMOut" +msgstr "" + #: shared-bindings/bitbangio/SPI.c shared-bindings/busio/SPI.c msgid "Invalid polarity" msgstr "" @@ -1179,7 +1182,7 @@ msgid "PulseIn not yet supported" msgstr "" #: ports/stm32f4/common-hal/pulseio/PulseOut.c -msgid "PulseOut not yet supported" +msgid "PulseOut not supported on this chip" msgstr "" #: ports/stm32f4/common-hal/os/__init__.c diff --git a/locale/pl.po b/locale/pl.po index 764c75881..f6863ca59 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-02 09:12-0600\n" +"POT-Creation-Date: 2020-03-02 11:20-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" @@ -908,10 +908,13 @@ msgstr "Zła nóżka dla prawego kanału" #: ports/atmel-samd/common-hal/i2cslave/I2CSlave.c #: ports/cxd56/common-hal/busio/I2C.c ports/cxd56/common-hal/busio/SPI.c #: ports/cxd56/common-hal/busio/UART.c ports/nrf/common-hal/busio/I2C.c -#: ports/stm32f4/common-hal/pulseio/PWMOut.c msgid "Invalid pins" msgstr "Złe nóżki" +#: ports/stm32f4/common-hal/pulseio/PWMOut.c +msgid "Invalid pins for PWMOut" +msgstr "" + #: shared-bindings/bitbangio/SPI.c shared-bindings/busio/SPI.c msgid "Invalid polarity" msgstr "Zła polaryzacja" @@ -1180,7 +1183,7 @@ msgid "PulseIn not yet supported" msgstr "" #: ports/stm32f4/common-hal/pulseio/PulseOut.c -msgid "PulseOut not yet supported" +msgid "PulseOut not supported on this chip" msgstr "" #: ports/stm32f4/common-hal/os/__init__.c diff --git a/locale/pt_BR.po b/locale/pt_BR.po index 81a7974f3..371a6bcf6 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-02 09:12-0600\n" +"POT-Creation-Date: 2020-03-02 11:20-0500\n" "PO-Revision-Date: 2018-10-02 21:14-0000\n" "Last-Translator: \n" "Language-Team: \n" @@ -914,10 +914,13 @@ msgstr "Pino inválido para canal direito" #: ports/atmel-samd/common-hal/i2cslave/I2CSlave.c #: ports/cxd56/common-hal/busio/I2C.c ports/cxd56/common-hal/busio/SPI.c #: ports/cxd56/common-hal/busio/UART.c ports/nrf/common-hal/busio/I2C.c -#: ports/stm32f4/common-hal/pulseio/PWMOut.c msgid "Invalid pins" msgstr "Pinos inválidos" +#: ports/stm32f4/common-hal/pulseio/PWMOut.c +msgid "Invalid pins for PWMOut" +msgstr "" + #: shared-bindings/bitbangio/SPI.c shared-bindings/busio/SPI.c msgid "Invalid polarity" msgstr "" @@ -1191,7 +1194,7 @@ msgid "PulseIn not yet supported" msgstr "" #: ports/stm32f4/common-hal/pulseio/PulseOut.c -msgid "PulseOut not yet supported" +msgid "PulseOut not supported on this chip" msgstr "" #: ports/stm32f4/common-hal/os/__init__.c diff --git a/locale/zh_Latn_pinyin.po b/locale/zh_Latn_pinyin.po index d650ac52a..682d6c0e3 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-02 09:12-0600\n" +"POT-Creation-Date: 2020-03-02 11:20-0500\n" "PO-Revision-Date: 2019-04-13 10:10-0700\n" "Last-Translator: hexthat\n" "Language-Team: Chinese Hanyu Pinyin\n" @@ -916,10 +916,13 @@ msgstr "Yòuxián tōngdào yǐn jiǎo wúxiào" #: ports/atmel-samd/common-hal/i2cslave/I2CSlave.c #: ports/cxd56/common-hal/busio/I2C.c ports/cxd56/common-hal/busio/SPI.c #: ports/cxd56/common-hal/busio/UART.c ports/nrf/common-hal/busio/I2C.c -#: ports/stm32f4/common-hal/pulseio/PWMOut.c msgid "Invalid pins" msgstr "Wúxiào de yǐn jiǎo" +#: ports/stm32f4/common-hal/pulseio/PWMOut.c +msgid "Invalid pins for PWMOut" +msgstr "" + #: shared-bindings/bitbangio/SPI.c shared-bindings/busio/SPI.c msgid "Invalid polarity" msgstr "Wúxiào liǎng jí zhí" @@ -1194,8 +1197,8 @@ msgid "PulseIn not yet supported" msgstr "Shàng bù zhīchí PulseIn" #: ports/stm32f4/common-hal/pulseio/PulseOut.c -msgid "PulseOut not yet supported" -msgstr "Shàng bù zhīchí PulseOut" +msgid "PulseOut not supported on this chip" +msgstr "" #: ports/stm32f4/common-hal/os/__init__.c msgid "RNG DeInit Error" @@ -3294,6 +3297,9 @@ msgstr "líng bù" #~ msgid "Pixel beyond bounds of buffer" #~ msgstr "Xiàngsù chāochū huǎnchōng qū biānjiè" +#~ msgid "PulseOut not yet supported" +#~ msgstr "Shàng bù zhīchí PulseOut" + #~ msgid "Range out of bounds" #~ msgstr "Fànwéi chāochū biānjiè" diff --git a/ports/stm32f4/common-hal/pulseio/PWMOut.c b/ports/stm32f4/common-hal/pulseio/PWMOut.c index 50bacbb51..4bb3afae4 100644 --- a/ports/stm32f4/common-hal/pulseio/PWMOut.c +++ b/ports/stm32f4/common-hal/pulseio/PWMOut.c @@ -163,7 +163,7 @@ pwmout_result_t common_hal_pulseio_pwmout_construct(pulseio_pwmout_obj_t* self, } else if (var_freq_mismatch) { mp_raise_ValueError(translate("Cannot vary frequency on a timer that is already in use")); } else { - mp_raise_ValueError(translate("Invalid pins")); + mp_raise_ValueError(translate("Invalid pins for PWMOut")); } } diff --git a/ports/stm32f4/common-hal/pulseio/PulseOut.c b/ports/stm32f4/common-hal/pulseio/PulseOut.c index d393afc5c..d82525ea1 100644 --- a/ports/stm32f4/common-hal/pulseio/PulseOut.c +++ b/ports/stm32f4/common-hal/pulseio/PulseOut.c @@ -35,21 +35,180 @@ #include "shared-bindings/pulseio/PWMOut.h" #include "supervisor/shared/translate.h" +#include "stm32f4xx_hal.h" +#include "common-hal/microcontroller/Pin.h" +#include "tick.h" + +// A single timer is shared amongst all PulseOut objects under the assumption that +// the code is single threaded. +STATIC uint8_t refcount = 0; + +STATIC uint16_t *pulse_array = NULL; +STATIC volatile uint16_t pulse_array_index = 0; +STATIC uint16_t pulse_array_length; + +//Timer is shared, must be accessible by interrupt +STATIC TIM_HandleTypeDef t7_handle; +pulseio_pulseout_obj_t *curr_pulseout = NULL; + +STATIC void turn_on(pulseio_pulseout_obj_t *pulseout) { + // Turn on PWM + HAL_TIM_PWM_Start(&(pulseout->pwmout->handle), pulseout->pwmout->channel); +} + +STATIC void turn_off(pulseio_pulseout_obj_t *pulseout) { + // Turn off PWM + HAL_TIM_PWM_Stop(&(pulseout->pwmout->handle), pulseout->pwmout->channel); + // Make sure pin is low. + HAL_GPIO_WritePin(pin_port(pulseout->pwmout->tim->pin->port), + pin_mask(pulseout->pwmout->tim->pin->number), 0); +} + +STATIC void start_timer(void) { + // Set the new period + t7_handle.Init.Period = pulse_array[pulse_array_index] - 1; + HAL_TIM_Base_Init(&t7_handle); + + // TIM7 has limited HAL support, set registers manually + t7_handle.Instance->SR = 0; // Prevent the SR from triggering an interrupt + t7_handle.Instance->CR1 |= TIM_CR1_CEN; // Resume timer + t7_handle.Instance->CR1 |= TIM_CR1_URS; // Disable non-overflow interrupts + __HAL_TIM_ENABLE_IT(&t7_handle, TIM_IT_UPDATE); + +} + +STATIC void pulseout_event_handler(void) { + if (curr_pulseout->pwmout == NULL) { + return; //invalid interrupt + } + + HAL_GPIO_WritePin(pin_port(2),pin_mask(6), 1); + HAL_GPIO_WritePin(pin_port(2),pin_mask(6), 0); + + pulse_array_index++; + + // No more pulses. Turn off output and don't restart. + if (pulse_array_index >= pulse_array_length) { + turn_off(curr_pulseout); + return; + } + + // Alternate on and off, starting with on. + if (pulse_array_index % 2 == 0) { + turn_on(curr_pulseout); + } else { + turn_off(curr_pulseout); + } + + // Count up to the next given value. + start_timer(); +} void pulseout_reset() { + #if HAS_BASIC_TIM + __HAL_RCC_TIM7_CLK_DISABLE(); + refcount = 0; + #endif } void common_hal_pulseio_pulseout_construct(pulseio_pulseout_obj_t* self, const pulseio_pwmout_obj_t* carrier) { - mp_raise_NotImplementedError(translate("PulseOut not yet supported")); +#if !(HAS_BASIC_TIM) + mp_raise_NotImplementedError(translate("PulseOut not supported on this chip")); +#else + // Add to active PulseOuts + refcount++; + + // Calculate a 1 ms period + uint32_t source, clk_div; + source = HAL_RCC_GetPCLK1Freq(); // TIM7 is on APB1 + clk_div = RCC->CFGR & RCC_CFGR_PPRE1; + // APB quirk, see See DM00031020 Rev 4, page 115. + if (clk_div != 0) { + // APB prescaler for this timer is > 1 + source *= 2; + } + + uint32_t prescaler = source/1000000; //1us intervals + + __HAL_RCC_TIM7_CLK_ENABLE(); + HAL_NVIC_SetPriority(TIM7_IRQn, 4, 0); + HAL_NVIC_EnableIRQ(TIM7_IRQn); + + // Timers 6 and 7 have no pins, so using them doesn't affect PWM availability + t7_handle.Instance = TIM7; + t7_handle.Init.Period = 100; //immediately replaced. + t7_handle.Init.Prescaler = prescaler - 1; + t7_handle.Init.ClockDivision = TIM_CLOCKDIVISION_DIV1; + t7_handle.Init.CounterMode = TIM_COUNTERMODE_UP; + t7_handle.Init.AutoReloadPreload = TIM_AUTORELOAD_PRELOAD_DISABLE; + + HAL_TIM_Base_Init(&t7_handle); + t7_handle.Instance->SR = 0; + + // The HAL can't work with const, recast required. + self->pwmout = (pulseio_pwmout_obj_t*)carrier; + + turn_off(self); +#endif } bool common_hal_pulseio_pulseout_deinited(pulseio_pulseout_obj_t* self) { - return true; + return self->pwmout == NULL; } void common_hal_pulseio_pulseout_deinit(pulseio_pulseout_obj_t* self) { + if (common_hal_pulseio_pulseout_deinited(self)) { + return; + } + turn_on(self); + self->pwmout = NULL; + + refcount--; + if (refcount == 0) { + #if HAS_BASIC_TIM + __HAL_RCC_TIM7_CLK_DISABLE(); + #endif + } } void common_hal_pulseio_pulseout_send(pulseio_pulseout_obj_t* self, uint16_t* pulses, uint16_t length) { + pulse_array = pulses; + pulse_array_index = 0; + pulse_array_length = length; + curr_pulseout = self; + + turn_on(self); + + // Count up to the next given value. + start_timer(); + + // Use when debugging, or issues are irrecoverable + // uint32_t starttime = supervisor_ticks_ms64(); + // uint32_t timeout = 10000; + while(pulse_array_index < length) { + // Do other things while we wait. The interrupts will handle sending the + // signal. + RUN_BACKGROUND_TASKS; + + // Use when debugging, or issues are irrecoverable + // if ((supervisor_ticks_ms64() - starttime ) > timeout ) { + // mp_raise_RuntimeError(translate("Error: Send Timeout")); + // } + } + //turn off timer counter. + t7_handle.Instance->CR1 &= ~TIM_CR1_CEN; +} + +void TIM7_IRQHandler(void) +{ + // Detect TIM Update event + if (__HAL_TIM_GET_FLAG(&t7_handle, TIM_FLAG_UPDATE) != RESET) + { + if (__HAL_TIM_GET_IT_SOURCE(&t7_handle, TIM_IT_UPDATE) != RESET) + { + __HAL_TIM_CLEAR_IT(&t7_handle, TIM_IT_UPDATE); + pulseout_event_handler(); + } + } } diff --git a/ports/stm32f4/common-hal/pulseio/PulseOut.h b/ports/stm32f4/common-hal/pulseio/PulseOut.h index 45823d28a..aa97396d0 100644 --- a/ports/stm32f4/common-hal/pulseio/PulseOut.h +++ b/ports/stm32f4/common-hal/pulseio/PulseOut.h @@ -34,7 +34,7 @@ typedef struct { mp_obj_base_t base; - const pulseio_pwmout_obj_t *pwmout; + pulseio_pwmout_obj_t *pwmout; } pulseio_pulseout_obj_t; void pulseout_reset(void); diff --git a/ports/stm32f4/peripherals/stm32f4/periph.h b/ports/stm32f4/peripherals/stm32f4/periph.h index 969a8e79b..d311afe4a 100644 --- a/ports/stm32f4/peripherals/stm32f4/periph.h +++ b/ports/stm32f4/peripherals/stm32f4/periph.h @@ -138,23 +138,26 @@ typedef struct { .pin = tim_pin, \ } -//Starter Lines +//Access Lines #ifdef STM32F401xE #define HAS_DAC 0 #define HAS_TRNG 0 +#define HAS_BASIC_TIM 0 #include "stm32f401xe/periph.h" #endif #ifdef STM32F411xE #define HAS_DAC 0 #define HAS_TRNG 0 +#define HAS_BASIC_TIM 0 #include "stm32f411xe/periph.h" #endif #ifdef STM32F412Zx #define HAS_DAC 0 #define HAS_TRNG 1 +#define HAS_BASIC_TIM 1 #include "stm32f412zx/periph.h" #endif @@ -163,12 +166,14 @@ typedef struct { #ifdef STM32F405xx #define HAS_DAC 1 #define HAS_TRNG 1 +#define HAS_BASIC_TIM 1 #include "stm32f405xx/periph.h" #endif #ifdef STM32F407xx #define HAS_DAC 1 #define HAS_TRNG 1 +#define HAS_BASIC_TIM 1 #include "stm32f407xx/periph.h" #endif diff --git a/ports/stm32f4/supervisor/port.c b/ports/stm32f4/supervisor/port.c index e9e4720d7..ecb4d3d15 100644 --- a/ports/stm32f4/supervisor/port.c +++ b/ports/stm32f4/supervisor/port.c @@ -35,6 +35,7 @@ #include "common-hal/busio/SPI.h" #include "common-hal/busio/UART.h" #include "common-hal/pulseio/PWMOut.h" +#include "common-hal/pulseio/PulseOut.h" #include "stm32f4/clocks.h" #include "stm32f4/gpio.h" @@ -60,6 +61,7 @@ void reset_port(void) { spi_reset(); uart_reset(); pwmout_reset(); + pulseout_reset(); } void reset_to_bootloader(void) { |
