Merge pull request #2000 from jepler/nrf-pwm-audio

Implement PWM audio out for the nrf port
crypto-aes
Scott Shawcroft 4 years ago committed by GitHub
commit b675a27e16
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

@ -8,7 +8,7 @@ msgid ""
msgstr ""
"Project-Id-Version: PACKAGE VERSION\n"
"Report-Msgid-Bugs-To: \n"
"POT-Creation-Date: 2019-07-25 22:48-0700\n"
"POT-Creation-Date: 2019-07-31 16:30-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"
@ -255,6 +255,7 @@ msgstr "Semua timer untuk pin ini sedang digunakan"
#: ports/atmel-samd/common-hal/audioio/AudioOut.c
#: ports/atmel-samd/common-hal/frequencyio/FrequencyIn.c
#: ports/atmel-samd/common-hal/pulseio/PulseOut.c
#: ports/nrf/common-hal/audiopwmio/PWMAudioOut.c
#: ports/nrf/common-hal/pulseio/PulseOut.c shared-bindings/pulseio/PWMOut.c
#: shared-module/_pew/PewPew.c
msgid "All timers in use"
@ -329,6 +330,11 @@ msgstr ""
msgid "Buffer incorrect size. Should be %d bytes."
msgstr ""
#: ports/nrf/common-hal/audiopwmio/PWMAudioOut.c
#, c-format
msgid "Buffer length %d too big. It must be less than %d"
msgstr ""
#: shared-bindings/bitbangio/I2C.c shared-bindings/busio/I2C.c
msgid "Buffer must be at least length 1"
msgstr ""
@ -951,6 +957,7 @@ msgid "Not connected"
msgstr "Tidak dapat menyambungkan ke AP"
#: shared-bindings/audiobusio/I2SOut.c shared-bindings/audioio/AudioOut.c
#: shared-bindings/audiopwmio/PWMAudioOut.c
msgid "Not playing"
msgstr ""
@ -1080,6 +1087,7 @@ msgid "Sample rate must be positive"
msgstr ""
#: ports/atmel-samd/common-hal/audioio/AudioOut.c
#: ports/nrf/common-hal/audiopwmio/PWMAudioOut.c
#, c-format
msgid "Sample rate too high. It must be less than %d"
msgstr "Nilai sampel terlalu tinggi. Nilai harus kurang dari %d"

@ -8,7 +8,7 @@ msgid ""
msgstr ""
"Project-Id-Version: PACKAGE VERSION\n"
"Report-Msgid-Bugs-To: \n"
"POT-Creation-Date: 2019-07-25 22:48-0700\n"
"POT-Creation-Date: 2019-07-31 16:30-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"
@ -253,6 +253,7 @@ msgstr ""
#: ports/atmel-samd/common-hal/audioio/AudioOut.c
#: ports/atmel-samd/common-hal/frequencyio/FrequencyIn.c
#: ports/atmel-samd/common-hal/pulseio/PulseOut.c
#: ports/nrf/common-hal/audiopwmio/PWMAudioOut.c
#: ports/nrf/common-hal/pulseio/PulseOut.c shared-bindings/pulseio/PWMOut.c
#: shared-module/_pew/PewPew.c
msgid "All timers in use"
@ -325,6 +326,11 @@ msgstr ""
msgid "Buffer incorrect size. Should be %d bytes."
msgstr ""
#: ports/nrf/common-hal/audiopwmio/PWMAudioOut.c
#, c-format
msgid "Buffer length %d too big. It must be less than %d"
msgstr ""
#: shared-bindings/bitbangio/I2C.c shared-bindings/busio/I2C.c
msgid "Buffer must be at least length 1"
msgstr ""
@ -935,6 +941,7 @@ msgid "Not connected"
msgstr ""
#: shared-bindings/audiobusio/I2SOut.c shared-bindings/audioio/AudioOut.c
#: shared-bindings/audiopwmio/PWMAudioOut.c
msgid "Not playing"
msgstr ""
@ -1060,6 +1067,7 @@ msgid "Sample rate must be positive"
msgstr ""
#: ports/atmel-samd/common-hal/audioio/AudioOut.c
#: ports/nrf/common-hal/audiopwmio/PWMAudioOut.c
#, c-format
msgid "Sample rate too high. It must be less than %d"
msgstr ""

@ -7,7 +7,7 @@ msgid ""
msgstr ""
"Project-Id-Version: \n"
"Report-Msgid-Bugs-To: \n"
"POT-Creation-Date: 2019-07-25 22:48-0700\n"
"POT-Creation-Date: 2019-07-31 16:30-0500\n"
"PO-Revision-Date: 2018-07-27 11:55-0700\n"
"Last-Translator: Pascal Deneaux\n"
"Language-Team: Sebastian Plamauer, Pascal Deneaux\n"
@ -255,6 +255,7 @@ msgstr "Alle timer für diesen Pin werden bereits benutzt"
#: ports/atmel-samd/common-hal/audioio/AudioOut.c
#: ports/atmel-samd/common-hal/frequencyio/FrequencyIn.c
#: ports/atmel-samd/common-hal/pulseio/PulseOut.c
#: ports/nrf/common-hal/audiopwmio/PWMAudioOut.c
#: ports/nrf/common-hal/pulseio/PulseOut.c shared-bindings/pulseio/PWMOut.c
#: shared-module/_pew/PewPew.c
msgid "All timers in use"
@ -329,6 +330,11 @@ msgstr "Die Helligkeit ist nicht einstellbar"
msgid "Buffer incorrect size. Should be %d bytes."
msgstr "Der Puffergröße ist inkorrekt. Sie sollte %d bytes haben."
#: ports/nrf/common-hal/audiopwmio/PWMAudioOut.c
#, c-format
msgid "Buffer length %d too big. It must be less than %d"
msgstr ""
#: shared-bindings/bitbangio/I2C.c shared-bindings/busio/I2C.c
msgid "Buffer must be at least length 1"
msgstr "Der Puffer muss eine Mindestenslänge von 1 haben"
@ -948,6 +954,7 @@ msgid "Not connected"
msgstr "Nicht verbunden"
#: shared-bindings/audiobusio/I2SOut.c shared-bindings/audioio/AudioOut.c
#: shared-bindings/audiopwmio/PWMAudioOut.c
msgid "Not playing"
msgstr "Spielt nicht"
@ -1077,6 +1084,7 @@ msgid "Sample rate must be positive"
msgstr "Abtastrate muss positiv sein"
#: ports/atmel-samd/common-hal/audioio/AudioOut.c
#: ports/nrf/common-hal/audiopwmio/PWMAudioOut.c
#, c-format
msgid "Sample rate too high. It must be less than %d"
msgstr "Abtastrate zu hoch. Wert muss unter %d liegen"

@ -7,7 +7,7 @@ msgid ""
msgstr ""
"Project-Id-Version: \n"
"Report-Msgid-Bugs-To: \n"
"POT-Creation-Date: 2019-07-25 22:48-0700\n"
"POT-Creation-Date: 2019-07-31 16:30-0500\n"
"PO-Revision-Date: 2018-07-27 11:55-0700\n"
"Last-Translator: \n"
"Language-Team: \n"
@ -253,6 +253,7 @@ msgstr ""
#: ports/atmel-samd/common-hal/audioio/AudioOut.c
#: ports/atmel-samd/common-hal/frequencyio/FrequencyIn.c
#: ports/atmel-samd/common-hal/pulseio/PulseOut.c
#: ports/nrf/common-hal/audiopwmio/PWMAudioOut.c
#: ports/nrf/common-hal/pulseio/PulseOut.c shared-bindings/pulseio/PWMOut.c
#: shared-module/_pew/PewPew.c
msgid "All timers in use"
@ -325,6 +326,11 @@ msgstr ""
msgid "Buffer incorrect size. Should be %d bytes."
msgstr ""
#: ports/nrf/common-hal/audiopwmio/PWMAudioOut.c
#, c-format
msgid "Buffer length %d too big. It must be less than %d"
msgstr ""
#: shared-bindings/bitbangio/I2C.c shared-bindings/busio/I2C.c
msgid "Buffer must be at least length 1"
msgstr ""
@ -935,6 +941,7 @@ msgid "Not connected"
msgstr ""
#: shared-bindings/audiobusio/I2SOut.c shared-bindings/audioio/AudioOut.c
#: shared-bindings/audiopwmio/PWMAudioOut.c
msgid "Not playing"
msgstr ""
@ -1060,6 +1067,7 @@ msgid "Sample rate must be positive"
msgstr ""
#: ports/atmel-samd/common-hal/audioio/AudioOut.c
#: ports/nrf/common-hal/audiopwmio/PWMAudioOut.c
#, c-format
msgid "Sample rate too high. It must be less than %d"
msgstr ""

@ -7,7 +7,7 @@ msgid ""
msgstr ""
"Project-Id-Version: \n"
"Report-Msgid-Bugs-To: \n"
"POT-Creation-Date: 2019-07-25 22:48-0700\n"
"POT-Creation-Date: 2019-07-31 16:30-0500\n"
"PO-Revision-Date: 2018-07-27 11:55-0700\n"
"Last-Translator: \n"
"Language-Team: @sommersoft, @MrCertainly\n"
@ -255,6 +255,7 @@ msgstr ""
#: ports/atmel-samd/common-hal/audioio/AudioOut.c
#: ports/atmel-samd/common-hal/frequencyio/FrequencyIn.c
#: ports/atmel-samd/common-hal/pulseio/PulseOut.c
#: ports/nrf/common-hal/audiopwmio/PWMAudioOut.c
#: ports/nrf/common-hal/pulseio/PulseOut.c shared-bindings/pulseio/PWMOut.c
#: shared-module/_pew/PewPew.c
msgid "All timers in use"
@ -329,6 +330,11 @@ msgstr ""
msgid "Buffer incorrect size. Should be %d bytes."
msgstr ""
#: ports/nrf/common-hal/audiopwmio/PWMAudioOut.c
#, c-format
msgid "Buffer length %d too big. It must be less than %d"
msgstr ""
#: shared-bindings/bitbangio/I2C.c shared-bindings/busio/I2C.c
msgid "Buffer must be at least length 1"
msgstr ""
@ -939,6 +945,7 @@ msgid "Not connected"
msgstr ""
#: shared-bindings/audiobusio/I2SOut.c shared-bindings/audioio/AudioOut.c
#: shared-bindings/audiopwmio/PWMAudioOut.c
msgid "Not playing"
msgstr ""
@ -1064,6 +1071,7 @@ msgid "Sample rate must be positive"
msgstr ""
#: ports/atmel-samd/common-hal/audioio/AudioOut.c
#: ports/nrf/common-hal/audiopwmio/PWMAudioOut.c
#, c-format
msgid "Sample rate too high. It must be less than %d"
msgstr ""

@ -7,7 +7,7 @@ msgid ""
msgstr ""
"Project-Id-Version: \n"
"Report-Msgid-Bugs-To: \n"
"POT-Creation-Date: 2019-07-25 22:48-0700\n"
"POT-Creation-Date: 2019-07-31 16:30-0500\n"
"PO-Revision-Date: 2018-08-24 22:56-0500\n"
"Last-Translator: \n"
"Language-Team: \n"
@ -257,6 +257,7 @@ msgstr "Todos los timers para este pin están siendo utilizados"
#: ports/atmel-samd/common-hal/audioio/AudioOut.c
#: ports/atmel-samd/common-hal/frequencyio/FrequencyIn.c
#: ports/atmel-samd/common-hal/pulseio/PulseOut.c
#: ports/nrf/common-hal/audiopwmio/PWMAudioOut.c
#: ports/nrf/common-hal/pulseio/PulseOut.c shared-bindings/pulseio/PWMOut.c
#: shared-module/_pew/PewPew.c
msgid "All timers in use"
@ -333,6 +334,11 @@ msgstr "El brillo no se puede ajustar"
msgid "Buffer incorrect size. Should be %d bytes."
msgstr "Tamaño de buffer incorrecto. Debe ser de %d bytes."
#: ports/nrf/common-hal/audiopwmio/PWMAudioOut.c
#, c-format
msgid "Buffer length %d too big. It must be less than %d"
msgstr ""
#: shared-bindings/bitbangio/I2C.c shared-bindings/busio/I2C.c
msgid "Buffer must be at least length 1"
msgstr "Buffer debe ser de longitud 1 como minimo"
@ -950,6 +956,7 @@ msgid "Not connected"
msgstr "No conectado"
#: shared-bindings/audiobusio/I2SOut.c shared-bindings/audioio/AudioOut.c
#: shared-bindings/audiopwmio/PWMAudioOut.c
msgid "Not playing"
msgstr "No reproduciendo"
@ -1088,6 +1095,7 @@ msgid "Sample rate must be positive"
msgstr "Sample rate debe ser positivo"
#: ports/atmel-samd/common-hal/audioio/AudioOut.c
#: ports/nrf/common-hal/audiopwmio/PWMAudioOut.c
#, c-format
msgid "Sample rate too high. It must be less than %d"
msgstr "Frecuencia de muestreo demasiado alta. Debe ser menor a %d"

@ -7,7 +7,7 @@ msgid ""
msgstr ""
"Project-Id-Version: \n"
"Report-Msgid-Bugs-To: \n"
"POT-Creation-Date: 2019-07-25 22:48-0700\n"
"POT-Creation-Date: 2019-07-31 16:30-0500\n"
"PO-Revision-Date: 2018-12-20 22:15-0800\n"
"Last-Translator: Timothy <me@timothygarcia.ca>\n"
"Language-Team: fil\n"
@ -257,6 +257,7 @@ msgstr "Lahat ng timers para sa pin na ito ay ginagamit"
#: ports/atmel-samd/common-hal/audioio/AudioOut.c
#: ports/atmel-samd/common-hal/frequencyio/FrequencyIn.c
#: ports/atmel-samd/common-hal/pulseio/PulseOut.c
#: ports/nrf/common-hal/audiopwmio/PWMAudioOut.c
#: ports/nrf/common-hal/pulseio/PulseOut.c shared-bindings/pulseio/PWMOut.c
#: shared-module/_pew/PewPew.c
msgid "All timers in use"
@ -331,6 +332,11 @@ msgstr ""
msgid "Buffer incorrect size. Should be %d bytes."
msgstr "Mali ang size ng buffer. Dapat %d bytes."
#: ports/nrf/common-hal/audiopwmio/PWMAudioOut.c
#, c-format
msgid "Buffer length %d too big. It must be less than %d"
msgstr ""
#: shared-bindings/bitbangio/I2C.c shared-bindings/busio/I2C.c
msgid "Buffer must be at least length 1"
msgstr "Buffer dapat ay hindi baba sa 1 na haba"
@ -960,6 +966,7 @@ msgid "Not connected"
msgstr "Hindi maka connect sa AP"
#: shared-bindings/audiobusio/I2SOut.c shared-bindings/audioio/AudioOut.c
#: shared-bindings/audiopwmio/PWMAudioOut.c
msgid "Not playing"
msgstr "Hindi playing"
@ -1093,6 +1100,7 @@ msgid "Sample rate must be positive"
msgstr "Sample rate ay dapat positibo"
#: ports/atmel-samd/common-hal/audioio/AudioOut.c
#: ports/nrf/common-hal/audiopwmio/PWMAudioOut.c
#, c-format
msgid "Sample rate too high. It must be less than %d"
msgstr "Sample rate ay masyadong mataas. Ito ay dapat hindi hiigit sa %d"

@ -8,7 +8,7 @@ msgid ""
msgstr ""
"Project-Id-Version: 0.1\n"
"Report-Msgid-Bugs-To: \n"
"POT-Creation-Date: 2019-07-25 22:48-0700\n"
"POT-Creation-Date: 2019-07-31 16:30-0500\n"
"PO-Revision-Date: 2019-04-14 20:05+0100\n"
"Last-Translator: Pierrick Couturier <arofarn@arofarn.info>\n"
"Language-Team: fr\n"
@ -260,6 +260,7 @@ msgstr "Tous les timers pour cette broche sont utilisés"
#: ports/atmel-samd/common-hal/audioio/AudioOut.c
#: ports/atmel-samd/common-hal/frequencyio/FrequencyIn.c
#: ports/atmel-samd/common-hal/pulseio/PulseOut.c
#: ports/nrf/common-hal/audiopwmio/PWMAudioOut.c
#: ports/nrf/common-hal/pulseio/PulseOut.c shared-bindings/pulseio/PWMOut.c
#: shared-module/_pew/PewPew.c
msgid "All timers in use"
@ -336,6 +337,11 @@ msgstr "Luminosité non-ajustable"
msgid "Buffer incorrect size. Should be %d bytes."
msgstr "Tampon de taille incorrect. Devrait être de %d octets."
#: ports/nrf/common-hal/audiopwmio/PWMAudioOut.c
#, c-format
msgid "Buffer length %d too big. It must be less than %d"
msgstr ""
#: shared-bindings/bitbangio/I2C.c shared-bindings/busio/I2C.c
msgid "Buffer must be at least length 1"
msgstr "Le tampon doit être de longueur au moins 1"
@ -969,6 +975,7 @@ msgid "Not connected"
msgstr "Non connecté"
#: shared-bindings/audiobusio/I2SOut.c shared-bindings/audioio/AudioOut.c
#: shared-bindings/audiopwmio/PWMAudioOut.c
msgid "Not playing"
msgstr "Ne joue pas"
@ -1110,6 +1117,7 @@ msgid "Sample rate must be positive"
msgstr "Le taux d'échantillonage doit être positif"
#: ports/atmel-samd/common-hal/audioio/AudioOut.c
#: ports/nrf/common-hal/audiopwmio/PWMAudioOut.c
#, c-format
msgid "Sample rate too high. It must be less than %d"
msgstr "Taux d'échantillonage trop élevé. Doit être inf. à %d"

@ -8,7 +8,7 @@ msgid ""
msgstr ""
"Project-Id-Version: PACKAGE VERSION\n"
"Report-Msgid-Bugs-To: \n"
"POT-Creation-Date: 2019-07-25 22:48-0700\n"
"POT-Creation-Date: 2019-07-31 16:30-0500\n"
"PO-Revision-Date: 2018-10-02 16:27+0200\n"
"Last-Translator: Enrico Paganin <enrico.paganin@mail.com>\n"
"Language-Team: \n"
@ -256,6 +256,7 @@ msgstr "Tutti i timer per questo pin sono in uso"
#: ports/atmel-samd/common-hal/audioio/AudioOut.c
#: ports/atmel-samd/common-hal/frequencyio/FrequencyIn.c
#: ports/atmel-samd/common-hal/pulseio/PulseOut.c
#: ports/nrf/common-hal/audiopwmio/PWMAudioOut.c
#: ports/nrf/common-hal/pulseio/PulseOut.c shared-bindings/pulseio/PWMOut.c
#: shared-module/_pew/PewPew.c
msgid "All timers in use"
@ -331,6 +332,11 @@ msgstr "Illiminazione non è regolabile"
msgid "Buffer incorrect size. Should be %d bytes."
msgstr "Buffer di lunghezza non valida. Dovrebbe essere di %d bytes."
#: ports/nrf/common-hal/audiopwmio/PWMAudioOut.c
#, c-format
msgid "Buffer length %d too big. It must be less than %d"
msgstr ""
#: shared-bindings/bitbangio/I2C.c shared-bindings/busio/I2C.c
msgid "Buffer must be at least length 1"
msgstr "Il buffer deve essere lungo almeno 1"
@ -959,6 +965,7 @@ msgid "Not connected"
msgstr "Impossible connettersi all'AP"
#: shared-bindings/audiobusio/I2SOut.c shared-bindings/audioio/AudioOut.c
#: shared-bindings/audiopwmio/PWMAudioOut.c
msgid "Not playing"
msgstr "In pausa"
@ -1098,6 +1105,7 @@ msgid "Sample rate must be positive"
msgstr "STA deve essere attiva"
#: ports/atmel-samd/common-hal/audioio/AudioOut.c
#: ports/nrf/common-hal/audiopwmio/PWMAudioOut.c
#, c-format
msgid "Sample rate too high. It must be less than %d"
msgstr ""

@ -7,7 +7,7 @@ msgid ""
msgstr ""
"Project-Id-Version: \n"
"Report-Msgid-Bugs-To: \n"
"POT-Creation-Date: 2019-07-25 22:48-0700\n"
"POT-Creation-Date: 2019-07-31 16:30-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"
@ -254,6 +254,7 @@ msgstr "Wszystkie timery tej nóżki w użyciu"
#: ports/atmel-samd/common-hal/audioio/AudioOut.c
#: ports/atmel-samd/common-hal/frequencyio/FrequencyIn.c
#: ports/atmel-samd/common-hal/pulseio/PulseOut.c
#: ports/nrf/common-hal/audiopwmio/PWMAudioOut.c
#: ports/nrf/common-hal/pulseio/PulseOut.c shared-bindings/pulseio/PWMOut.c
#: shared-module/_pew/PewPew.c
msgid "All timers in use"
@ -328,6 +329,11 @@ msgstr "Jasność nie jest regulowana"
msgid "Buffer incorrect size. Should be %d bytes."
msgstr "Zła wielkość bufora. Powinno być %d bajtów."
#: ports/nrf/common-hal/audiopwmio/PWMAudioOut.c
#, c-format
msgid "Buffer length %d too big. It must be less than %d"
msgstr ""
#: shared-bindings/bitbangio/I2C.c shared-bindings/busio/I2C.c
msgid "Buffer must be at least length 1"
msgstr "Bufor musi mieć długość 1 lub więcej"
@ -945,6 +951,7 @@ msgid "Not connected"
msgstr "Nie podłączono"
#: shared-bindings/audiobusio/I2SOut.c shared-bindings/audioio/AudioOut.c
#: shared-bindings/audiopwmio/PWMAudioOut.c
msgid "Not playing"
msgstr "Nic nie jest odtwarzane"
@ -1070,6 +1077,7 @@ msgid "Sample rate must be positive"
msgstr "Częstotliwość próbkowania musi być dodatnia"
#: ports/atmel-samd/common-hal/audioio/AudioOut.c
#: ports/nrf/common-hal/audiopwmio/PWMAudioOut.c
#, c-format
msgid "Sample rate too high. It must be less than %d"
msgstr "Zbyt wysoka częstotliwość próbkowania. Musi być mniejsza niż %d"

@ -8,7 +8,7 @@ msgid ""
msgstr ""
"Project-Id-Version: PACKAGE VERSION\n"
"Report-Msgid-Bugs-To: \n"
"POT-Creation-Date: 2019-07-25 22:48-0700\n"
"POT-Creation-Date: 2019-07-31 16:30-0500\n"
"PO-Revision-Date: 2018-10-02 21:14-0000\n"
"Last-Translator: \n"
"Language-Team: \n"
@ -256,6 +256,7 @@ msgstr "Todos os temporizadores para este pino estão em uso"
#: ports/atmel-samd/common-hal/audioio/AudioOut.c
#: ports/atmel-samd/common-hal/frequencyio/FrequencyIn.c
#: ports/atmel-samd/common-hal/pulseio/PulseOut.c
#: ports/nrf/common-hal/audiopwmio/PWMAudioOut.c
#: ports/nrf/common-hal/pulseio/PulseOut.c shared-bindings/pulseio/PWMOut.c
#: shared-module/_pew/PewPew.c
msgid "All timers in use"
@ -328,6 +329,11 @@ msgstr ""
msgid "Buffer incorrect size. Should be %d bytes."
msgstr "Buffer de tamanho incorreto. Deve ser %d bytes."
#: ports/nrf/common-hal/audiopwmio/PWMAudioOut.c
#, c-format
msgid "Buffer length %d too big. It must be less than %d"
msgstr ""
#: shared-bindings/bitbangio/I2C.c shared-bindings/busio/I2C.c
msgid "Buffer must be at least length 1"
msgstr ""
@ -951,6 +957,7 @@ msgid "Not connected"
msgstr "Não é possível conectar-se ao AP"
#: shared-bindings/audiobusio/I2SOut.c shared-bindings/audioio/AudioOut.c
#: shared-bindings/audiopwmio/PWMAudioOut.c
msgid "Not playing"
msgstr ""
@ -1080,6 +1087,7 @@ msgid "Sample rate must be positive"
msgstr ""
#: ports/atmel-samd/common-hal/audioio/AudioOut.c
#: ports/nrf/common-hal/audiopwmio/PWMAudioOut.c
#, c-format
msgid "Sample rate too high. It must be less than %d"
msgstr "Taxa de amostragem muito alta. Deve ser menor que %d"

@ -7,7 +7,7 @@ msgid ""
msgstr ""
"Project-Id-Version: circuitpython-cn\n"
"Report-Msgid-Bugs-To: \n"
"POT-Creation-Date: 2019-07-25 22:48-0700\n"
"POT-Creation-Date: 2019-07-31 16:30-0500\n"
"PO-Revision-Date: 2019-04-13 10:10-0700\n"
"Last-Translator: hexthat\n"
"Language-Team: Chinese Hanyu Pinyin\n"
@ -255,6 +255,7 @@ msgstr "Cǐ yǐn jiǎo de suǒyǒu jìshí qì zhèngzài shǐyòng"
#: ports/atmel-samd/common-hal/audioio/AudioOut.c
#: ports/atmel-samd/common-hal/frequencyio/FrequencyIn.c
#: ports/atmel-samd/common-hal/pulseio/PulseOut.c
#: ports/nrf/common-hal/audiopwmio/PWMAudioOut.c
#: ports/nrf/common-hal/pulseio/PulseOut.c shared-bindings/pulseio/PWMOut.c
#: shared-module/_pew/PewPew.c
msgid "All timers in use"
@ -329,6 +330,11 @@ msgstr "Liàngdù wúfǎ tiáozhěng"
msgid "Buffer incorrect size. Should be %d bytes."
msgstr "Huǎnchōng qū dàxiǎo bù zhèngquè. Yīnggāi shì %d zì jié."
#: ports/nrf/common-hal/audiopwmio/PWMAudioOut.c
#, c-format
msgid "Buffer length %d too big. It must be less than %d"
msgstr ""
#: shared-bindings/bitbangio/I2C.c shared-bindings/busio/I2C.c
msgid "Buffer must be at least length 1"
msgstr "Huǎnchōng qū bìxū zhìshǎo chángdù 1"
@ -945,6 +951,7 @@ msgid "Not connected"
msgstr "Wèi liánjiē"
#: shared-bindings/audiobusio/I2SOut.c shared-bindings/audioio/AudioOut.c
#: shared-bindings/audiopwmio/PWMAudioOut.c
msgid "Not playing"
msgstr "Wèi bòfàng"
@ -1075,6 +1082,7 @@ msgid "Sample rate must be positive"
msgstr "Cǎiyàng lǜ bìxū wèi zhèng shù"
#: ports/atmel-samd/common-hal/audioio/AudioOut.c
#: ports/nrf/common-hal/audiopwmio/PWMAudioOut.c
#, c-format
msgid "Sample rate too high. It must be less than %d"
msgstr "Cǎiyàng lǜ tài gāo. Tā bìxū xiǎoyú %d"
@ -1128,8 +1136,9 @@ msgstr ""
msgid ""
"The `microcontroller` module was used to boot into safe mode. Press reset to "
"exit safe mode.\n"
msgstr "“Wēi kòngzhì qì” mókuài yòng yú qǐdòng ānquán móshì. Àn chóng zhì kě "
"tuìchū ānquán móshì.\n"
msgstr ""
"“Wēi kòngzhì qì” mókuài yòng yú qǐdòng ānquán móshì. Àn chóng zhì kě tuìchū "
"ānquán móshì.\n"
#: supervisor/shared/safe_mode.c
msgid ""

@ -33,6 +33,10 @@
#include "shared-module/displayio/__init__.h"
#endif
#if CIRCUITPY_AUDIOPWMIO
#include "common-hal/audiopwmio/PWMAudioOut.h"
#endif
static bool running_background_tasks = false;
void background_tasks_reset(void) {
@ -47,6 +51,9 @@ void run_background_tasks(void) {
running_background_tasks = true;
filesystem_background();
usb_background();
#if CIRCUITPY_AUDIOPWMIO
audiopwmout_background();
#endif
#if CIRCUITPY_DISPLAYIO
displayio_refresh_displays();

@ -0,0 +1,316 @@
/*
* This file is part of the MicroPython project, http://micropython.org/
*
* The MIT License (MIT)
*
* Copyright (c) 2019 Jeff Epler 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 <stdint.h>
#include <string.h>
#include "extmod/vfs_fat.h"
#include "py/gc.h"
#include "py/mperrno.h"
#include "py/runtime.h"
#include "common-hal/audiopwmio/PWMAudioOut.h"
#include "common-hal/pulseio/PWMOut.h"
#include "shared-bindings/audiopwmio/PWMAudioOut.h"
#include "shared-bindings/microcontroller/__init__.h"
#include "shared-bindings/microcontroller/Pin.h"
#include "supervisor/shared/translate.h"
// TODO: This should be the same size as PWMOut.c:pwms[], but there's no trivial way to accomplish that
STATIC audiopwmio_pwmaudioout_obj_t* active_audio[4];
#define F_TARGET (62500)
#define F_PWM (16000000)
// return the REFRESH value, store the TOP value in an out-parameter
// Tested for key values (worst relative error = 0.224% = 3.84 cents)
// 8000: top = 250 refresh = 7 [ 8000.0]
// 22050: top = 242 refresh = 2 [22038.5]
// 24000: top = 222 refresh = 2 [24024.0]
// 44100: top = 181 refresh = 1 [44198.8]
// 48000: top = 167 refresh = 1 [47904.1]
STATIC uint32_t calculate_pwm_parameters(uint32_t sample_rate, uint32_t *top_out) {
// the desired frequency is the closest integer multiple of sample_rate not less than F_TARGET
uint32_t desired_frequency = (F_TARGET + sample_rate - 1) / sample_rate * sample_rate;
// The top value is the PWM frequency divided by the desired frequency (round to nearest)
uint32_t top = (F_PWM + desired_frequency/2) / desired_frequency;
// The actual frequency is the PWM frequency divided by the top value (round to nearest)
uint32_t actual_frequency = (F_PWM + top/2) / top;
// The multiplier is the actual frequency divided by the sample rate (round to nearest)
uint32_t multiplier = (actual_frequency + sample_rate/2) / sample_rate;
*top_out = top;
return multiplier - 1;
}
STATIC void activate_audiopwmout_obj(audiopwmio_pwmaudioout_obj_t *self) {
for(size_t i=0; i < MP_ARRAY_SIZE(active_audio); i++) {
if(!active_audio[i]) {
active_audio[i] = self;
break;
}
}
}
STATIC void deactivate_audiopwmout_obj(audiopwmio_pwmaudioout_obj_t *self) {
for(size_t i=0; i < MP_ARRAY_SIZE(active_audio); i++) {
if(active_audio[i] == self)
active_audio[i] = NULL;
}
}
void audiopwmout_reset() {
for(size_t i=0; i < MP_ARRAY_SIZE(active_audio); i++)
active_audio[i] = NULL;
}
STATIC void fill_buffers(audiopwmio_pwmaudioout_obj_t *self, int buf) {
self->pwm->EVENTS_SEQSTARTED[1-buf] = 0;
uint16_t *dev_buffer = self->buffers[buf];
uint8_t *buffer;
uint32_t buffer_length;
audioio_get_buffer_result_t get_buffer_result =
audiosample_get_buffer(self->sample, false, 0,
&buffer, &buffer_length);
if (get_buffer_result == GET_BUFFER_ERROR) {
common_hal_audiopwmio_pwmaudioout_stop(self);
return;
}
uint32_t num_samples = buffer_length / self->bytes_per_sample / self->spacing;
if(self->bytes_per_sample == 1) {
uint8_t offset = self->signed_to_unsigned ? 0x80 : 0;
uint16_t scale = self->scale;
for(uint32_t i=0; i<buffer_length/self->spacing; i++) {
uint8_t rawval = (*buffer++ + offset);
uint16_t val = (uint16_t)(((uint32_t)rawval * (uint32_t)scale) >> 8);
*dev_buffer++ = val;
if(self->spacing == 1)
*dev_buffer++ = val;
}
} else {
uint16_t offset = self->signed_to_unsigned ? 0x8000 : 0;
uint16_t scale = self->scale;
uint16_t *buffer16 = (uint16_t*)buffer;
for(uint32_t i=0; i<buffer_length/2/self->spacing; i++) {
uint16_t rawval = (*buffer16++ + offset);
uint16_t val = (uint16_t)((rawval * (uint32_t)scale) >> 16);
*dev_buffer++ = val;
if(self->spacing == 1)
*dev_buffer++ = val;
}
}
self->pwm->SEQ[buf].PTR = (intptr_t)self->buffers[buf];
self->pwm->SEQ[buf].CNT = num_samples*2;
if (self->loop && get_buffer_result == GET_BUFFER_DONE) {
audiosample_reset_buffer(self->sample, false, 0);
} else if(get_buffer_result == GET_BUFFER_DONE) {
self->pwm->SHORTS = NRF_PWM_SHORT_SEQEND0_STOP_MASK | NRF_PWM_SHORT_SEQEND1_STOP_MASK;
self->stopping = true;
}
}
STATIC void audiopwmout_background_obj(audiopwmio_pwmaudioout_obj_t *self) {
if(!common_hal_audiopwmio_pwmaudioout_get_playing(self))
return;
if(self->stopping) {
bool stopped =
(self->pwm->EVENTS_SEQEND[0] || !self->pwm->EVENTS_SEQSTARTED[0]) &&
(self->pwm->EVENTS_SEQEND[1] || !self->pwm->EVENTS_SEQSTARTED[1]);
if(stopped)
self->pwm->TASKS_STOP = 1;
} else if(!self->paused && !self->single_buffer) {
if(self->pwm->EVENTS_SEQSTARTED[0]) fill_buffers(self, 1);
if(self->pwm->EVENTS_SEQSTARTED[1]) fill_buffers(self, 0);
}
}
void audiopwmout_background() {
for(size_t i=0; i < MP_ARRAY_SIZE(active_audio); i++) {
if(!active_audio[i]) continue;
audiopwmout_background_obj(active_audio[i]);
}
}
void common_hal_audiopwmio_pwmaudioout_construct(audiopwmio_pwmaudioout_obj_t* self,
const mcu_pin_obj_t* left_channel, const mcu_pin_obj_t* right_channel, uint16_t quiescent_value) {
assert_pin_free(left_channel);
assert_pin_free(right_channel);
self->pwm = pwmout_allocate(256, PWM_PRESCALER_PRESCALER_DIV_1, true, NULL, NULL);
if(!self->pwm) {
mp_raise_RuntimeError(translate("All timers in use"));
}
self->pwm->PRESCALER = PWM_PRESCALER_PRESCALER_DIV_1;
// two uint16_t values per sample when Grouped
// n.b. SEQ[#].CNT "counts" are 2 per sample (left and right channels)
self->pwm->DECODER = PWM_DECODER_LOAD_Grouped;
// we use channels 0 and 2 because these are GROUPED; it lets us save half
// the space for sample data (no additional optimization is possible for
// single channel)
self->pwm->PSEL.OUT[0] = self->left_channel_number = left_channel->number;
claim_pin(left_channel);
if(right_channel)
{
self->pwm->PSEL.OUT[2] = self->right_channel_number = right_channel->number;
claim_pin(right_channel);
}
self->quiescent_value = quiescent_value >> 8;
self->pwm->ENABLE = 1;
// TODO: Ramp from 0 to quiescent value
}
bool common_hal_audiopwmio_pwmaudioout_deinited(audiopwmio_pwmaudioout_obj_t* self) {
return !self->pwm;
}
void common_hal_audiopwmio_pwmaudioout_deinit(audiopwmio_pwmaudioout_obj_t* self) {
if (common_hal_audiopwmio_pwmaudioout_deinited(self)) {
return;
}
// TODO: ramp the pwm down from quiescent value to 0
self->pwm->ENABLE = 0;
if(self->left_channel_number)
reset_pin_number(self->left_channel_number);
if(self->right_channel_number)
reset_pin_number(self->right_channel_number);
pwmout_free_channel(self->pwm, 0);
pwmout_free_channel(self->pwm, 2);
self->pwm = NULL;
m_free(self->buffers[0]);
self->buffers[0] = NULL;
m_free(self->buffers[1]);
self->buffers[1] = NULL;
}
void common_hal_audiopwmio_pwmaudioout_play(audiopwmio_pwmaudioout_obj_t* self, mp_obj_t sample, bool loop) {
if (common_hal_audiopwmio_pwmaudioout_get_playing(self)) {
common_hal_audiopwmio_pwmaudioout_stop(self);
}
self->sample = sample;
self->loop = loop;
uint32_t sample_rate = audiosample_sample_rate(sample);
uint32_t max_sample_rate = 62500;
if (sample_rate > max_sample_rate) {
mp_raise_ValueError_varg(translate("Sample rate too high. It must be less than %d"), max_sample_rate);
}
self->bytes_per_sample = audiosample_bits_per_sample(sample) / 8;
uint32_t max_buffer_length;
audiosample_get_buffer_structure(sample, /* single channel */ false,
&self->single_buffer, &self->signed_to_unsigned, &max_buffer_length,
&self->spacing);
if(max_buffer_length > UINT16_MAX) {
mp_raise_ValueError_varg(translate("Buffer length %d too big. It must be less than %d"), max_buffer_length, UINT16_MAX);
}
self->buffer_length = (uint16_t)max_buffer_length;
self->buffers[0] = m_malloc(self->buffer_length * 2 * sizeof(uint16_t), false);
if(!self->single_buffer)
self->buffers[1] = m_malloc(self->buffer_length * 2 * sizeof(uint16_t), false);
uint32_t top;
self->pwm->SEQ[0].REFRESH = self->pwm->SEQ[1].REFRESH = calculate_pwm_parameters(sample_rate, &top);
self->scale = top-1;
self->pwm->COUNTERTOP = top;
self->pwm->LOOP = 1;
audiosample_reset_buffer(self->sample, false, 0);
activate_audiopwmout_obj(self);
fill_buffers(self, 0);
self->pwm->SEQ[1].PTR = self->pwm->SEQ[0].PTR;
self->pwm->SEQ[1].CNT = self->pwm->SEQ[0].CNT;
self->pwm->EVENTS_SEQSTARTED[0] = 0;
self->pwm->EVENTS_SEQSTARTED[1] = 0;
self->pwm->EVENTS_STOPPED = 0;
self->pwm->SHORTS = NRF_PWM_SHORT_LOOPSDONE_SEQSTART0_MASK;
self->pwm->TASKS_SEQSTART[0] = 1;
self->playing = true;
self->stopping = false;
self->paused = false;
}
void common_hal_audiopwmio_pwmaudioout_stop(audiopwmio_pwmaudioout_obj_t* self) {
deactivate_audiopwmout_obj(self);
self->pwm->TASKS_STOP = 1;
self->stopping = false;
self->paused = false;
m_free(self->buffers[0]);
self->buffers[0] = NULL;
m_free(self->buffers[1]);
self->buffers[1] = NULL;
}
bool common_hal_audiopwmio_pwmaudioout_get_playing(audiopwmio_pwmaudioout_obj_t* self) {
if(!self->paused && self->pwm->EVENTS_STOPPED) {
self->playing = false;
self->pwm->EVENTS_STOPPED = 0;
}
return self->playing;
}
/* pause/resume present difficulties for the NRF PWM audio module.
*
* A PWM sequence can be stopped in its tracks by sending a TASKS_STOP event,
* but there's no way to pick up the sequence where it was stopped; you could
* start at the start of one of the two sequences, but especially for "single buffer"
* sample, this seems undesirable.
*
* Or, you can stop at the end of a sequence so that you don't duplicate anything
* when restarting, but again this is unsatisfactory for a "single buffer" sample.
*
* For now, I've taken the coward's way and left these methods unimplemented.
* Perhaps the way forward is to divide even "single buffer" samples into tasks of
* only a few ms long, so that they can be stopped/restarted quickly enough that it
* feels instant. (This also saves on memory, for long in-memory "single buffer"
* samples, since we have to locally take a resampled copy!)
*/
void common_hal_audiopwmio_pwmaudioout_pause(audiopwmio_pwmaudioout_obj_t* self) {
self->paused = true;
self->pwm->SHORTS = NRF_PWM_SHORT_SEQEND1_STOP_MASK;
}
void common_hal_audiopwmio_pwmaudioout_resume(audiopwmio_pwmaudioout_obj_t* self) {
self->paused = false;
self->pwm->SHORTS = NRF_PWM_SHORT_LOOPSDONE_SEQSTART0_MASK;
if (self->pwm->EVENTS_STOPPED) {
self->pwm->EVENTS_STOPPED = 0;
self->pwm->TASKS_SEQSTART[0] = 1;
}
}
bool common_hal_audiopwmio_pwmaudioout_get_paused(audiopwmio_pwmaudioout_obj_t* self) {
return self->paused;
}

@ -0,0 +1,59 @@
/*
* This file is part of the MicroPython project, http://micropython.org/
*
* The MIT License (MIT)
*
* Copyright (c) 2019 Jeff Epler for Adafruit Industries
*
* Permission is hereby granted, free of charge, to any person obtaining a copy
* of this software and associated documentation files (the "Software"), to deal
* in the Software without restriction, including without limitation the rights
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
* copies of the Software, and to permit persons to whom the Software is
* furnished to do so, subject to the following conditions:
*
* The above copyright notice and this permission notice shall be included in
* all copies or substantial portions of the Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
* THE SOFTWARE.
*/
#ifndef MICROPY_INCLUDED_NRF_COMMON_HAL_AUDIOPWM_AUDIOOUT_H
#define MICROPY_INCLUDED_NRF_COMMON_HAL_AUDIOPWM_AUDIOOUT_H
#include "common-hal/microcontroller/Pin.h"
typedef struct {
mp_obj_base_t base;
mp_obj_t *sample;
NRF_PWM_Type *pwm;
uint16_t *buffers[2];
uint16_t buffer_length;
uint16_t quiescent_value;
uint16_t scale;
uint8_t left_channel_number;
uint8_t right_channel_number;
uint8_t spacing;
uint8_t bytes_per_sample;
bool playing;
bool stopping;
bool paused;
bool loop;
bool signed_to_unsigned;
bool single_buffer;
} audiopwmio_pwmaudioout_obj_t;
void audiopwmout_reset(void);
void audiopwmout_background(void);
#endif

@ -57,6 +57,12 @@ STATIC uint16_t pwm_seq[MP_ARRAY_SIZE(pwms)][CHANNELS_PER_PWM];
static uint8_t never_reset_pwm[MP_ARRAY_SIZE(pwms)];
STATIC int pwm_idx(NRF_PWM_Type *pwm) {
for(size_t i=0; i < MP_ARRAY_SIZE(pwms); i++)
if(pwms[i] == pwm) return i;
return -1;
}
void common_hal_pulseio_pwmout_never_reset(pulseio_pwmout_obj_t *self) {
for(size_t i=0; i < MP_ARRAY_SIZE(pwms); i++) {
NRF_PWM_Type* pwm = pwms[i];
@ -133,29 +139,11 @@ bool convert_frequency(uint32_t frequency, uint16_t *countertop, nrf_pwm_clk_t *
return false;
}
pwmout_result_t common_hal_pulseio_pwmout_construct(pulseio_pwmout_obj_t* self,
const mcu_pin_obj_t* pin,
uint16_t duty,
uint32_t frequency,
bool variable_frequency) {
// We don't use the nrfx driver here because we want to dynamically allocate channels
// as needed in an already-enabled PWM.
uint16_t countertop;
nrf_pwm_clk_t base_clock;
if (frequency == 0 || !convert_frequency(frequency, &countertop, &base_clock)) {
return PWMOUT_INVALID_FREQUENCY;
}
self->pwm = NULL;
self->channel = CHANNELS_PER_PWM; // out-of-range value.
bool pwm_already_in_use;
NRF_PWM_Type* pwm;
size_t pwm_index = 0;
for (; pwm_index < MP_ARRAY_SIZE(pwms); pwm_index++) {
pwm = pwms[pwm_index];
pwm_already_in_use = pwm->ENABLE & SPIM_ENABLE_ENABLE_Msk;
NRF_PWM_Type *pwmout_allocate(uint16_t countertop, nrf_pwm_clk_t base_clock,
bool variable_frequency, int8_t *channel_out, bool *pwm_already_in_use_out) {
for (size_t pwm_index = 0; pwm_index < MP_ARRAY_SIZE(pwms); pwm_index++) {
NRF_PWM_Type *pwm = pwms[pwm_index];
bool pwm_already_in_use = pwm->ENABLE & SPIM_ENABLE_ENABLE_Msk;
if (pwm_already_in_use) {
if (variable_frequency) {
// Variable frequency requires exclusive use of a PWM, so try the next one.
@ -168,28 +156,65 @@ pwmout_result_t common_hal_pulseio_pwmout_construct(pulseio_pwmout_obj_t* self,
for (size_t chan = 0; chan < CHANNELS_PER_PWM; chan++) {
if (pwm->PSEL.OUT[chan] == 0xFFFFFFFF) {
// Channel is free.
self->pwm = pwm;
self->channel = chan;
break;
if(channel_out)
*channel_out = chan;
if(pwm_already_in_use_out)
*pwm_already_in_use_out = pwm_already_in_use;
return pwm;
}
}
// Did we find a channel? If not, loop and check the next pwm.
if (self->pwm != NULL) {
break;
}
}
} else {
// PWM not yet in use, so we can start to use it. Use channel 0.
self->pwm = pwm;
self->channel = 0;
break;
if(channel_out)
*channel_out = 0;
if(pwm_already_in_use_out)
*pwm_already_in_use_out = pwm_already_in_use;
return pwm;
}
}
return NULL;
}
void pwmout_free_channel(NRF_PWM_Type *pwm, int8_t channel) {
// Disconnect pin from channel.
pwm->PSEL.OUT[channel] = 0xFFFFFFFF;
for(int i=0; i < CHANNELS_PER_PWM; i++) {
if (pwm->PSEL.OUT[i] != 0xFFFFFFFF) {
// Some channel is still being used, so don't disable.
return;
}
}
nrf_pwm_disable(pwm);
}
pwmout_result_t common_hal_pulseio_pwmout_construct(pulseio_pwmout_obj_t* self,
const mcu_pin_obj_t* pin,
uint16_t duty,
uint32_t frequency,
bool variable_frequency) {
// We don't use the nrfx driver here because we want to dynamically allocate channels
// as needed in an already-enabled PWM.
uint16_t countertop;
nrf_pwm_clk_t base_clock;
if (frequency == 0 || !convert_frequency(frequency, &countertop, &base_clock)) {
return PWMOUT_INVALID_FREQUENCY;
}
int8_t channel;
bool pwm_already_in_use;
self->pwm = pwmout_allocate(countertop, base_clock, variable_frequency,
&channel, &pwm_already_in_use);
if (self->pwm == NULL) {
return PWMOUT_ALL_TIMERS_IN_USE;
}
self->channel = channel;
self->pin_number = pin->number;
claim_pin(pin);
@ -200,17 +225,17 @@ pwmout_result_t common_hal_pulseio_pwmout_construct(pulseio_pwmout_obj_t* self,
nrf_gpio_cfg_output(self->pin_number);
// disable before mapping pin channel
nrf_pwm_disable(pwm);
nrf_pwm_disable(self->pwm);
if (!pwm_already_in_use) {
reset_single_pwmout(pwm_index);
nrf_pwm_configure(pwm, base_clock, NRF_PWM_MODE_UP, countertop);
reset_single_pwmout(pwm_idx(self->pwm));
nrf_pwm_configure(self->pwm, base_clock, NRF_PWM_MODE_UP, countertop);
}
// Connect channel to pin, without disturbing other channels.
pwm->PSEL.OUT[self->channel] = pin->number;
self->pwm->PSEL.OUT[self->channel] = pin->number;
nrf_pwm_enable(pwm);
nrf_pwm_enable(self->pwm);
common_hal_pulseio_pwmout_set_duty_cycle(self, duty);
return PWMOUT_OK;
@ -230,17 +255,7 @@ void common_hal_pulseio_pwmout_deinit(pulseio_pwmout_obj_t* self) {
NRF_PWM_Type* pwm = self->pwm;
self->pwm = NULL;
// Disconnect pin from channel.
pwm->PSEL.OUT[self->channel] = 0xFFFFFFFF;
for(int i=0; i < CHANNELS_PER_PWM; i++) {
if (self->pwm->PSEL.OUT[i] != 0xFFFFFFFF) {
// Some channel is still being used, so don't disable.
return;
}
}
nrf_pwm_disable(pwm);
pwmout_free_channel(pwm, self->channel);
}
void common_hal_pulseio_pwmout_set_duty_cycle(pulseio_pwmout_obj_t* self, uint16_t duty_cycle) {

@ -41,5 +41,8 @@ typedef struct {
} pulseio_pwmout_obj_t;
void pwmout_reset(void);
NRF_PWM_Type *pwmout_allocate(uint16_t countertop, nrf_pwm_clk_t base_clock,
bool variable_frequency, int8_t *channel_out, bool *pwm_already_in_use_out);
void pwmout_free_channel(NRF_PWM_Type *pwm, int8_t channel);
#endif // MICROPY_INCLUDED_NRF_COMMON_HAL_PULSEIO_PWMOUT_H

@ -10,8 +10,10 @@ USB_SERIAL_NUMBER_LENGTH = 16
# All nRF ports have longints.
LONGINT_IMPL = MPZ
# No DAC, so no regular audio.
# Audio via PWM
CIRCUITPY_AUDIOCORE = 1
CIRCUITPY_AUDIOIO = 0
CIRCUITPY_AUDIOPWMIO = 1
# No I2S yet.
CIRCUITPY_AUDIOBUSIO = 0

@ -50,6 +50,10 @@
#include "shared-bindings/rtc/__init__.h"
#ifdef CIRCUITPY_AUDIOPWMIO
#include "common-hal/audiopwmio/PWMAudioOut.h"
#endif
static void power_warning_handler(void) {
reset_into_safe_mode(BROWNOUT);
}
@ -94,6 +98,10 @@ void reset_port(void) {
spi_reset();
uart_reset();
#ifdef CIRCUITPY_AUDIOPWMIO
audiopwmout_reset();
#endif
#if CIRCUITPY_PULSEIO
pwmout_reset();
pulseout_reset();

@ -108,6 +108,9 @@ endif
ifeq ($(CIRCUITPY_AUDIOIO),1)
SRC_PATTERNS += audioio/%
endif
ifeq ($(CIRCUITPY_AUDIOPWMIO),1)
SRC_PATTERNS += audiopwmio/%
endif
ifeq ($(CIRCUITPY_AUDIOCORE),1)
SRC_PATTERNS += audiocore/%
endif
@ -223,6 +226,8 @@ $(filter $(SRC_PATTERNS), \
audiobusio/__init__.c \
audiobusio/I2SOut.c \
audiobusio/PDMIn.c \
audiopwmio/__init__.c \
audiopwmio/PWMAudioOut.c \
audioio/__init__.c \
audioio/AudioOut.c \
bleio/__init__.c \
@ -303,6 +308,7 @@ $(filter $(SRC_PATTERNS), \
_stage/Layer.c \
_stage/Text.c \
_stage/__init__.c \
audiopwmio/__init__.c \
audioio/__init__.c \
audiocore/__init__.c \
audiocore/Mixer.c \

@ -244,6 +244,13 @@ extern const struct _mp_obj_module_t audioio_module;
#define AUDIOIO_MODULE
#endif
#if CIRCUITPY_AUDIOPWMIO
#define AUDIOPWMIO_MODULE { MP_OBJ_NEW_QSTR(MP_QSTR_audiopwmio), (mp_obj_t)&audiopwmio_module },
extern const struct _mp_obj_module_t audiopwmio_module;
#else
#define AUDIOPWMIO_MODULE
#endif
#if CIRCUITPY_BITBANGIO
#define BITBANGIO_MODULE { MP_OBJ_NEW_QSTR(MP_QSTR_bitbangio), (mp_obj_t)&bitbangio_module },
extern const struct _mp_obj_module_t bitbangio_module;
@ -573,6 +580,7 @@ extern const struct _mp_obj_module_t ustack_module;
AUDIOBUSIO_MODULE \
AUDIOCORE_MODULE \
AUDIOIO_MODULE \
AUDIOPWMIO_MODULE \
BITBANGIO_MODULE \
BLEIO_MODULE \
BOARD_MODULE \

@ -74,9 +74,18 @@ CIRCUITPY_AUDIOIO = $(CIRCUITPY_FULL_BUILD)
endif
CFLAGS += -DCIRCUITPY_AUDIOIO=$(CIRCUITPY_AUDIOIO)
ifndef CIRCUITPY_AUDIOPWMIO
CIRCUITPY_AUDIOPWMIO = 0
endif
CFLAGS += -DCIRCUITPY_AUDIOPWMIO=$(CIRCUITPY_AUDIOPWMIO)
ifndef CIRCUITPY_AUDIOCORE
ifeq ($(CIRCUITPY_AUDIOPWMIO),1)
CIRCUITPY_AUDIOCORE = $(CIRCUITPY_AUDIOPWMIO)
else
CIRCUITPY_AUDIOCORE = $(CIRCUITPY_AUDIOIO)
endif
endif
CFLAGS += -DCIRCUITPY_AUDIOCORE=$(CIRCUITPY_AUDIOCORE)
ifndef CIRCUITPY_BITBANGIO

@ -56,7 +56,7 @@
//| using `UDA1334 Breakout <https://www.adafruit.com/product/3678>`_::
//|
//| import audiobusio
//| import audioio
//| import audiocore
//| import board
//| import array
//| import time
@ -68,7 +68,7 @@
//| for i in range(length):
//| sine_wave[i] = int(math.sin(math.pi * 2 * i / 18) * (2 ** 15) + 2 ** 15)
//|
//| sine_wave = audiobusio.RawSample(sine_wave, sample_rate=8000)
//| sine_wave = audiocore.RawSample(sine_wave, sample_rate=8000)
//| i2s = audiobusio.I2SOut(board.D1, board.D0, board.D9)
//| i2s.play(sine_wave, loop=True)
//| time.sleep(1)
@ -78,12 +78,13 @@
//|
//| import board
//| import audioio
//| import audiocore
//| import audiobusio
//| import digitalio
//|
//|
//| f = open("cplay-5.1-16bit-16khz.wav", "rb")
//| wav = audioio.WaveFile(f)
//| wav = audiocore.WaveFile(f)
//|
//| a = audiobusio.I2SOut(board.D1, board.D0, board.D9)
//|
@ -163,7 +164,7 @@ STATIC MP_DEFINE_CONST_FUN_OBJ_VAR_BETWEEN(audiobusio_i2sout___exit___obj, 4, 4,
//| Plays the sample once when loop=False and continuously when loop=True. </