summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDan Halbert <halbert@adafruit.com>2019-08-19 11:36:43 -0400
committerGitHub <noreply@github.com>2019-08-19 11:36:43 -0400
commit308efbeb040239bb34ec9909435eaffdb690361f (patch)
tree2d085f6cb9110b49713aa6424b928b5ebc16ca4c
parent9343d09321ec8b92cce01827d8be7f71f186236e (diff)
parent1a818c60cb5a81ec7504efb76018d3c34c069a8d (diff)
Merge pull request #2075 from jepler/nrf-pdm-audioin
nrf: implement audiobusio.PDMIn
-rw-r--r--locale/ID.po12
-rw-r--r--locale/circuitpython.pot10
-rw-r--r--locale/de_DE.po10
-rw-r--r--locale/en_US.po10
-rw-r--r--locale/en_x_pirate.po10
-rw-r--r--locale/es.po12
-rw-r--r--locale/fil.po10
-rw-r--r--locale/fr.po10
-rw-r--r--locale/it_IT.po16
-rw-r--r--locale/pl.po14
-rw-r--r--locale/pt_BR.po10
-rw-r--r--locale/zh_Latn_pinyin.po12
-rw-r--r--ports/nrf/common-hal/audiobusio/I2SOut.c70
-rw-r--r--ports/nrf/common-hal/audiobusio/I2SOut.h36
-rw-r--r--ports/nrf/common-hal/audiobusio/PDMIn.c130
-rw-r--r--ports/nrf/common-hal/audiobusio/PDMIn.h40
-rw-r--r--ports/nrf/common-hal/audiobusio/__init__.c0
-rw-r--r--ports/nrf/mpconfigport.mk4
-rw-r--r--tools/check_translations.py4
19 files changed, 396 insertions, 24 deletions
diff --git a/locale/ID.po b/locale/ID.po
index 438dca55f..a4ca0124d 100644
--- a/locale/ID.po
+++ b/locale/ID.po
@@ -8,7 +8,7 @@ msgid ""
msgstr ""
"Project-Id-Version: PACKAGE VERSION\n"
"Report-Msgid-Bugs-To: \n"
-"POT-Creation-Date: 2019-08-15 21:44-0400\n"
+"POT-Creation-Date: 2019-08-19 10:22-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"
@@ -1134,7 +1134,7 @@ msgid "Slices not supported"
msgstr ""
#: ports/nrf/common-hal/bleio/Adapter.c
-#, c-format
+#, fuzzy, c-format
msgid "Soft device assert, id: 0x%08lX, pc: 0x%08lX"
msgstr "Dukungan soft device, id: 0x%08lX, pc: 0x%08l"
@@ -2280,6 +2280,14 @@ msgstr "panjang data string memiliki keganjilan (odd-length)"
msgid "offset out of bounds"
msgstr "modul tidak ditemukan"
+#: ports/nrf/common-hal/audiobusio/PDMIn.c
+msgid "only bit_depth=16 is supported"
+msgstr ""
+
+#: ports/nrf/common-hal/audiobusio/PDMIn.c
+msgid "only sample_rate=16000 is supported"
+msgstr ""
+
#: py/objarray.c py/objstr.c py/objstrunicode.c py/objtuple.c
#: shared-bindings/nvm/ByteArray.c
msgid "only slices with step=1 (aka None) are supported"
diff --git a/locale/circuitpython.pot b/locale/circuitpython.pot
index 8cfbcfe85..d0a5646e0 100644
--- a/locale/circuitpython.pot
+++ b/locale/circuitpython.pot
@@ -8,7 +8,7 @@ msgid ""
msgstr ""
"Project-Id-Version: PACKAGE VERSION\n"
"Report-Msgid-Bugs-To: \n"
-"POT-Creation-Date: 2019-08-15 21:44-0400\n"
+"POT-Creation-Date: 2019-08-19 10:22-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"
@@ -2244,6 +2244,14 @@ msgstr ""
msgid "offset out of bounds"
msgstr ""
+#: ports/nrf/common-hal/audiobusio/PDMIn.c
+msgid "only bit_depth=16 is supported"
+msgstr ""
+
+#: ports/nrf/common-hal/audiobusio/PDMIn.c
+msgid "only sample_rate=16000 is supported"
+msgstr ""
+
#: py/objarray.c py/objstr.c py/objstrunicode.c py/objtuple.c
#: shared-bindings/nvm/ByteArray.c
msgid "only slices with step=1 (aka None) are supported"
diff --git a/locale/de_DE.po b/locale/de_DE.po
index 7551b1e6d..6c932572d 100644
--- a/locale/de_DE.po
+++ b/locale/de_DE.po
@@ -7,7 +7,7 @@ msgid ""
msgstr ""
"Project-Id-Version: \n"
"Report-Msgid-Bugs-To: \n"
-"POT-Creation-Date: 2019-08-15 21:44-0400\n"
+"POT-Creation-Date: 2019-08-19 10:22-0400\n"
"PO-Revision-Date: 2018-07-27 11:55-0700\n"
"Last-Translator: Pascal Deneaux\n"
"Language-Team: Sebastian Plamauer, Pascal Deneaux\n"
@@ -2291,6 +2291,14 @@ msgstr "String mit ungerader Länge"
msgid "offset out of bounds"
msgstr "offset außerhalb der Grenzen"
+#: ports/nrf/common-hal/audiobusio/PDMIn.c
+msgid "only bit_depth=16 is supported"
+msgstr ""
+
+#: ports/nrf/common-hal/audiobusio/PDMIn.c
+msgid "only sample_rate=16000 is supported"
+msgstr ""
+
#: py/objarray.c py/objstr.c py/objstrunicode.c py/objtuple.c
#: shared-bindings/nvm/ByteArray.c
msgid "only slices with step=1 (aka None) are supported"
diff --git a/locale/en_US.po b/locale/en_US.po
index fd176c869..46e719637 100644
--- a/locale/en_US.po
+++ b/locale/en_US.po
@@ -7,7 +7,7 @@ msgid ""
msgstr ""
"Project-Id-Version: \n"
"Report-Msgid-Bugs-To: \n"
-"POT-Creation-Date: 2019-08-15 21:44-0400\n"
+"POT-Creation-Date: 2019-08-19 10:22-0400\n"
"PO-Revision-Date: 2018-07-27 11:55-0700\n"
"Last-Translator: \n"
"Language-Team: \n"
@@ -2244,6 +2244,14 @@ msgstr ""
msgid "offset out of bounds"
msgstr ""
+#: ports/nrf/common-hal/audiobusio/PDMIn.c
+msgid "only bit_depth=16 is supported"
+msgstr ""
+
+#: ports/nrf/common-hal/audiobusio/PDMIn.c
+msgid "only sample_rate=16000 is supported"
+msgstr ""
+
#: py/objarray.c py/objstr.c py/objstrunicode.c py/objtuple.c
#: shared-bindings/nvm/ByteArray.c
msgid "only slices with step=1 (aka None) are supported"
diff --git a/locale/en_x_pirate.po b/locale/en_x_pirate.po
index f0aa99293..55b907023 100644
--- a/locale/en_x_pirate.po
+++ b/locale/en_x_pirate.po
@@ -7,7 +7,7 @@ msgid ""
msgstr ""
"Project-Id-Version: \n"
"Report-Msgid-Bugs-To: \n"
-"POT-Creation-Date: 2019-08-15 21:44-0400\n"
+"POT-Creation-Date: 2019-08-19 10:22-0400\n"
"PO-Revision-Date: 2018-07-27 11:55-0700\n"
"Last-Translator: \n"
"Language-Team: @sommersoft, @MrCertainly\n"
@@ -2248,6 +2248,14 @@ msgstr ""
msgid "offset out of bounds"
msgstr ""
+#: ports/nrf/common-hal/audiobusio/PDMIn.c
+msgid "only bit_depth=16 is supported"
+msgstr ""
+
+#: ports/nrf/common-hal/audiobusio/PDMIn.c
+msgid "only sample_rate=16000 is supported"
+msgstr ""
+
#: py/objarray.c py/objstr.c py/objstrunicode.c py/objtuple.c
#: shared-bindings/nvm/ByteArray.c
msgid "only slices with step=1 (aka None) are supported"
diff --git a/locale/es.po b/locale/es.po
index c90be4e02..62d9da9d6 100644
--- a/locale/es.po
+++ b/locale/es.po
@@ -7,7 +7,7 @@ msgid ""
msgstr ""
"Project-Id-Version: \n"
"Report-Msgid-Bugs-To: \n"
-"POT-Creation-Date: 2019-08-15 21:44-0400\n"
+"POT-Creation-Date: 2019-08-19 10:22-0400\n"
"PO-Revision-Date: 2018-08-24 22:56-0500\n"
"Last-Translator: \n"
"Language-Team: \n"
@@ -635,7 +635,7 @@ msgstr "No se puede leer el valor del atributo. err 0x%02x"
#: ports/nrf/common-hal/bleio/Characteristic.c
#: ports/nrf/common-hal/bleio/Descriptor.c
-#, c-format
+#, fuzzy, c-format
msgid "Failed to read attribute value, err 0x%04x"
msgstr "Error al leer valor del atributo, err 0x%04"
@@ -2307,6 +2307,14 @@ msgstr "string de longitud impar"
msgid "offset out of bounds"
msgstr "address fuera de límites"
+#: ports/nrf/common-hal/audiobusio/PDMIn.c
+msgid "only bit_depth=16 is supported"
+msgstr ""
+
+#: ports/nrf/common-hal/audiobusio/PDMIn.c
+msgid "only sample_rate=16000 is supported"
+msgstr ""
+
#: py/objarray.c py/objstr.c py/objstrunicode.c py/objtuple.c
#: shared-bindings/nvm/ByteArray.c
msgid "only slices with step=1 (aka None) are supported"
diff --git a/locale/fil.po b/locale/fil.po
index d2535cc38..f585372d2 100644
--- a/locale/fil.po
+++ b/locale/fil.po
@@ -7,7 +7,7 @@ msgid ""
msgstr ""
"Project-Id-Version: \n"
"Report-Msgid-Bugs-To: \n"
-"POT-Creation-Date: 2019-08-15 21:44-0400\n"
+"POT-Creation-Date: 2019-08-19 10:22-0400\n"
"PO-Revision-Date: 2018-12-20 22:15-0800\n"
"Last-Translator: Timothy <me@timothygarcia.ca>\n"
"Language-Team: fil\n"
@@ -2316,6 +2316,14 @@ msgstr "odd-length string"
msgid "offset out of bounds"
msgstr "wala sa sakop ang address"
+#: ports/nrf/common-hal/audiobusio/PDMIn.c
+msgid "only bit_depth=16 is supported"
+msgstr ""
+
+#: ports/nrf/common-hal/audiobusio/PDMIn.c
+msgid "only sample_rate=16000 is supported"
+msgstr ""
+
#: py/objarray.c py/objstr.c py/objstrunicode.c py/objtuple.c
#: shared-bindings/nvm/ByteArray.c
msgid "only slices with step=1 (aka None) are supported"
diff --git a/locale/fr.po b/locale/fr.po
index 999d8c4f0..5308d1be0 100644
--- a/locale/fr.po
+++ b/locale/fr.po
@@ -8,7 +8,7 @@ msgid ""
msgstr ""
"Project-Id-Version: 0.1\n"
"Report-Msgid-Bugs-To: \n"
-"POT-Creation-Date: 2019-08-15 21:44-0400\n"
+"POT-Creation-Date: 2019-08-19 10:22-0400\n"
"PO-Revision-Date: 2019-04-14 20:05+0100\n"
"Last-Translator: Pierrick Couturier <arofarn@arofarn.info>\n"
"Language-Team: fr\n"
@@ -2352,6 +2352,14 @@ msgstr "chaîne de longueur impaire"
msgid "offset out of bounds"
msgstr "adresse hors limites"
+#: ports/nrf/common-hal/audiobusio/PDMIn.c
+msgid "only bit_depth=16 is supported"
+msgstr ""
+
+#: ports/nrf/common-hal/audiobusio/PDMIn.c
+msgid "only sample_rate=16000 is supported"
+msgstr ""
+
#: py/objarray.c py/objstr.c py/objstrunicode.c py/objtuple.c
#: shared-bindings/nvm/ByteArray.c
msgid "only slices with step=1 (aka None) are supported"
diff --git a/locale/it_IT.po b/locale/it_IT.po
index 411c9125a..8ab16aefb 100644
--- a/locale/it_IT.po
+++ b/locale/it_IT.po
@@ -8,7 +8,7 @@ msgid ""
msgstr ""
"Project-Id-Version: PACKAGE VERSION\n"
"Report-Msgid-Bugs-To: \n"
-"POT-Creation-Date: 2019-08-15 21:44-0400\n"
+"POT-Creation-Date: 2019-08-19 10:22-0400\n"
"PO-Revision-Date: 2018-10-02 16:27+0200\n"
"Last-Translator: Enrico Paganin <enrico.paganin@mail.com>\n"
"Language-Team: \n"
@@ -112,7 +112,7 @@ msgid "'%s' expects {r0, r1, ...}"
msgstr "'%s' aspetta un registro"
#: py/emitinlinextensa.c
-#, c-format
+#, fuzzy, c-format
msgid "'%s' integer %d is not within range %d..%d"
msgstr "intero '%s' non è nell'intervallo %d..%d"
@@ -1562,7 +1562,7 @@ msgid "can't assign to expression"
msgstr "impossibile assegnare all'espressione"
#: py/obj.c
-#, c-format
+#, fuzzy, c-format
msgid "can't convert %s to complex"
msgstr "non è possibile convertire a complex"
@@ -2312,6 +2312,14 @@ msgstr "stringa di lunghezza dispari"
msgid "offset out of bounds"
msgstr "indirizzo fuori limite"
+#: ports/nrf/common-hal/audiobusio/PDMIn.c
+msgid "only bit_depth=16 is supported"
+msgstr ""
+
+#: ports/nrf/common-hal/audiobusio/PDMIn.c
+msgid "only sample_rate=16000 is supported"
+msgstr ""
+
#: py/objarray.c py/objstr.c py/objstrunicode.c py/objtuple.c
#: shared-bindings/nvm/ByteArray.c
msgid "only slices with step=1 (aka None) are supported"
@@ -2633,7 +2641,7 @@ msgid "unindent does not match any outer indentation level"
msgstr ""
#: py/objstr.c
-#, c-format
+#, fuzzy, c-format
msgid "unknown conversion specifier %c"
msgstr "specificatore di conversione %s sconosciuto"
diff --git a/locale/pl.po b/locale/pl.po
index caa5df76d..8b1600200 100644
--- a/locale/pl.po
+++ b/locale/pl.po
@@ -7,7 +7,7 @@ msgid ""
msgstr ""
"Project-Id-Version: \n"
"Report-Msgid-Bugs-To: \n"
-"POT-Creation-Date: 2019-08-15 21:44-0400\n"
+"POT-Creation-Date: 2019-08-19 10:22-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"
@@ -559,12 +559,12 @@ msgid "Failed sending command."
msgstr ""
#: ports/nrf/sd_mutex.c
-#, c-format
+#, fuzzy, c-format
msgid "Failed to acquire mutex, err 0x%04x"
msgstr "Nie udało się uzyskać blokady, błąd 0x$04x"
#: ports/nrf/common-hal/bleio/Service.c
-#, c-format
+#, fuzzy, c-format
msgid "Failed to add characteristic, err 0x%04x"
msgstr "Nie udało się dodać charakterystyki, błąd 0x$04x"
@@ -2269,6 +2269,14 @@ msgstr "łańcuch o nieparzystej długości"
msgid "offset out of bounds"
msgstr "offset poza zakresem"
+#: ports/nrf/common-hal/audiobusio/PDMIn.c
+msgid "only bit_depth=16 is supported"
+msgstr ""
+
+#: ports/nrf/common-hal/audiobusio/PDMIn.c
+msgid "only sample_rate=16000 is supported"
+msgstr ""
+
#: py/objarray.c py/objstr.c py/objstrunicode.c py/objtuple.c
#: shared-bindings/nvm/ByteArray.c
msgid "only slices with step=1 (aka None) are supported"
diff --git a/locale/pt_BR.po b/locale/pt_BR.po
index 79a83d2f6..0191a0d78 100644
--- a/locale/pt_BR.po
+++ b/locale/pt_BR.po
@@ -8,7 +8,7 @@ msgid ""
msgstr ""
"Project-Id-Version: PACKAGE VERSION\n"
"Report-Msgid-Bugs-To: \n"
-"POT-Creation-Date: 2019-08-15 21:44-0400\n"
+"POT-Creation-Date: 2019-08-19 10:22-0400\n"
"PO-Revision-Date: 2018-10-02 21:14-0000\n"
"Last-Translator: \n"
"Language-Team: \n"
@@ -2270,6 +2270,14 @@ msgstr ""
msgid "offset out of bounds"
msgstr ""
+#: ports/nrf/common-hal/audiobusio/PDMIn.c
+msgid "only bit_depth=16 is supported"
+msgstr ""
+
+#: ports/nrf/common-hal/audiobusio/PDMIn.c
+msgid "only sample_rate=16000 is supported"
+msgstr ""
+
#: py/objarray.c py/objstr.c py/objstrunicode.c py/objtuple.c
#: shared-bindings/nvm/ByteArray.c
msgid "only slices with step=1 (aka None) are supported"
diff --git a/locale/zh_Latn_pinyin.po b/locale/zh_Latn_pinyin.po
index a42f8bae4..15b57d281 100644
--- a/locale/zh_Latn_pinyin.po
+++ b/locale/zh_Latn_pinyin.po
@@ -7,7 +7,7 @@ msgid ""
msgstr ""
"Project-Id-Version: circuitpython-cn\n"
"Report-Msgid-Bugs-To: \n"
-"POT-Creation-Date: 2019-08-15 21:44-0400\n"
+"POT-Creation-Date: 2019-08-19 10:22-0400\n"
"PO-Revision-Date: 2019-04-13 10:10-0700\n"
"Last-Translator: hexthat\n"
"Language-Team: Chinese Hanyu Pinyin\n"
@@ -2283,6 +2283,14 @@ msgstr "jīshù zìfú chuàn"
msgid "offset out of bounds"
msgstr "piānlí biānjiè"
+#: ports/nrf/common-hal/audiobusio/PDMIn.c
+msgid "only bit_depth=16 is supported"
+msgstr ""
+
+#: ports/nrf/common-hal/audiobusio/PDMIn.c
+msgid "only sample_rate=16000 is supported"
+msgstr ""
+
#: py/objarray.c py/objstr.c py/objstrunicode.c py/objtuple.c
#: shared-bindings/nvm/ByteArray.c
msgid "only slices with step=1 (aka None) are supported"
@@ -2603,7 +2611,7 @@ msgid "unknown conversion specifier %c"
msgstr "wèizhī de zhuǎnhuàn biāozhù %c"
#: py/objstr.c
-#, c-format
+#, fuzzy, c-format
msgid "unknown format code '%c' for object of type '%s'"
msgstr "lèixíng '%s' duìxiàng wèizhī de géshì dàimǎ '%c'"
diff --git a/ports/nrf/common-hal/audiobusio/I2SOut.c b/ports/nrf/common-hal/audiobusio/I2SOut.c
new file mode 100644
index 000000000..8be1fb2f8
--- /dev/null
+++ b/ports/nrf/common-hal/audiobusio/I2SOut.c
@@ -0,0 +1,70 @@
+/*
+ * 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 "common-hal/microcontroller/Pin.h"
+#include "common-hal/audiobusio/I2SOut.h"
+
+#include "py/obj.h"
+#include "py/runtime.h"
+
+void common_hal_audiobusio_i2sout_construct(audiobusio_i2sout_obj_t* self,
+ const mcu_pin_obj_t* bit_clock, const mcu_pin_obj_t* word_select,
+ const mcu_pin_obj_t* data, bool left_justified) {
+ mp_raise_NotImplementedError(NULL);
+}
+
+bool common_hal_audiobusio_i2sout_deinited(audiobusio_i2sout_obj_t* self) {
+ mp_raise_NotImplementedError(NULL);
+}
+
+void common_hal_audiobusio_i2sout_deinit(audiobusio_i2sout_obj_t* self) {
+ mp_raise_NotImplementedError(NULL);
+}
+
+void common_hal_audiobusio_i2sout_play(audiobusio_i2sout_obj_t* self,
+ mp_obj_t sample, bool loop) {
+ mp_raise_NotImplementedError(NULL);
+}
+
+void common_hal_audiobusio_i2sout_pause(audiobusio_i2sout_obj_t* self) {
+ mp_raise_NotImplementedError(NULL);
+}
+
+void common_hal_audiobusio_i2sout_resume(audiobusio_i2sout_obj_t* self) {
+ mp_raise_NotImplementedError(NULL);
+}
+
+bool common_hal_audiobusio_i2sout_get_paused(audiobusio_i2sout_obj_t* self) {
+ mp_raise_NotImplementedError(NULL);
+}
+
+void common_hal_audiobusio_i2sout_stop(audiobusio_i2sout_obj_t* self) {
+ mp_raise_NotImplementedError(NULL);
+}
+
+bool common_hal_audiobusio_i2sout_get_playing(audiobusio_i2sout_obj_t* self) {
+ mp_raise_NotImplementedError(NULL);
+}
diff --git a/ports/nrf/common-hal/audiobusio/I2SOut.h b/ports/nrf/common-hal/audiobusio/I2SOut.h
new file mode 100644
index 000000000..01c944e72
--- /dev/null
+++ b/ports/nrf/common-hal/audiobusio/I2SOut.h
@@ -0,0 +1,36 @@
+/*
+ * 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_AUDIOBUSIO_I2SOUT_H
+#define MICROPY_INCLUDED_NRF_COMMON_HAL_AUDIOBUSIO_I2SOUT_H
+
+#include "py/obj.h"
+
+typedef struct {
+ mp_obj_base_t base;
+} audiobusio_i2sout_obj_t;
+
+#endif // MICROPY_INCLUDED_NRF_COMMON_HAL_AUDIOBUSIO_I2SOUT_H
diff --git a/ports/nrf/common-hal/audiobusio/PDMIn.c b/ports/nrf/common-hal/audiobusio/PDMIn.c
new file mode 100644
index 000000000..a7f9c9d74
--- /dev/null
+++ b/ports/nrf/common-hal/audiobusio/PDMIn.c
@@ -0,0 +1,130 @@
+/*
+ * 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 "common-hal/audiobusio/PDMIn.h"
+#include "shared-bindings/microcontroller/Pin.h"
+
+#include "py/runtime.h"
+
+__attribute__((used))
+NRF_PDM_Type *nrf_pdm = NRF_PDM;
+
+static uint32_t dummy_buffer[4];
+
+void common_hal_audiobusio_pdmin_construct(audiobusio_pdmin_obj_t* self,
+ const mcu_pin_obj_t* clock_pin,
+ const mcu_pin_obj_t* data_pin,
+ uint32_t sample_rate,
+ uint8_t bit_depth,
+ bool mono,
+ uint8_t oversample) {
+ assert_pin_free(clock_pin);
+ assert_pin_free(data_pin);
+ claim_pin(clock_pin);
+ claim_pin(data_pin);
+
+ self->mono = mono;
+ self->clock_pin_number = clock_pin->number;
+ self->data_pin_number = data_pin->number;
+
+ if (sample_rate != 16000) {
+ mp_raise_ValueError(translate("only sample_rate=16000 is supported"));
+ }
+ if (bit_depth != 16) {
+ mp_raise_ValueError(translate("only bit_depth=16 is supported"));
+ }
+ nrf_pdm->PSEL.CLK = self->clock_pin_number;
+ nrf_pdm->PSEL.DIN = self->data_pin_number;
+ nrf_pdm->PDMCLKCTRL = PDM_PDMCLKCTRL_FREQ_Default; // For Ratio64
+ nrf_pdm->RATIO = PDM_RATIO_RATIO_Ratio64;
+ nrf_pdm->GAINL = PDM_GAINL_GAINL_DefaultGain;
+ nrf_pdm->GAINR = PDM_GAINR_GAINR_DefaultGain;
+ nrf_pdm->ENABLE = 1;
+
+ nrf_pdm->SAMPLE.PTR = (uintptr_t)&dummy_buffer;
+ nrf_pdm->SAMPLE.MAXCNT = 1;
+ nrf_pdm->TASKS_START = 1;
+}
+
+bool common_hal_audiobusio_pdmin_deinited(audiobusio_pdmin_obj_t* self) {
+ return !self->clock_pin_number;
+}
+
+void common_hal_audiobusio_pdmin_deinit(audiobusio_pdmin_obj_t* self) {
+ nrf_pdm->ENABLE = 0;
+
+ reset_pin_number(self->clock_pin_number);
+ self->clock_pin_number = 0;
+ reset_pin_number(self->data_pin_number);
+ self->data_pin_number = 0;
+}
+
+uint8_t common_hal_audiobusio_pdmin_get_bit_depth(audiobusio_pdmin_obj_t* self) {
+ return 16;
+}
+
+uint32_t common_hal_audiobusio_pdmin_get_sample_rate(audiobusio_pdmin_obj_t* self) {
+ return 16000;
+}
+
+uint32_t common_hal_audiobusio_pdmin_record_to_buffer(audiobusio_pdmin_obj_t* self,
+ uint16_t* output_buffer, uint32_t output_buffer_length) {
+ // Note: Adafruit's module has SELECT pulled to GND, which makes the DATA
+ // valid when the CLK is low, therefore it must be sampled on the rising edge.
+ if (self->mono) {
+ nrf_pdm->MODE = PDM_MODE_OPERATION_Stereo | PDM_MODE_EDGE_LeftRising;
+ } else {
+ nrf_pdm->MODE = PDM_MODE_OPERATION_Mono | PDM_MODE_EDGE_LeftRising;
+ }
+
+ // step 1. Redirect to real buffer
+ nrf_pdm->SAMPLE.PTR = (uintptr_t)output_buffer;
+ nrf_pdm->SAMPLE.MAXCNT = output_buffer_length;
+
+ // a delay is the safest simple way to ensure that the above requested sample has started
+ mp_hal_delay_us(200);
+ nrf_pdm->EVENTS_END = 0;
+
+ // step 2. Registers are double buffered, so pre-redirect back to dummy buffer
+ nrf_pdm->SAMPLE.PTR = (uintptr_t)&dummy_buffer;
+ nrf_pdm->SAMPLE.MAXCNT = 1;
+
+ // Step 3. wait for PDM to end
+ while (!nrf_pdm->EVENTS_END) {
+ MICROPY_VM_HOOK_LOOP;
+ }
+
+ // Step 4. They want unsigned
+ for (uint32_t i=0; i<output_buffer_length; i++) {
+ output_buffer[i] += 32768;
+ }
+
+ if (self->mono) {
+ return (output_buffer_length / 2) * 2;
+ } else {
+ return (output_buffer_length / 4) * 4;
+ }
+}
diff --git a/ports/nrf/common-hal/audiobusio/PDMIn.h b/ports/nrf/common-hal/audiobusio/PDMIn.h
new file mode 100644
index 000000000..d921e42ff
--- /dev/null
+++ b/ports/nrf/common-hal/audiobusio/PDMIn.h
@@ -0,0 +1,40 @@
+/*
+ * 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_AUDIOBUSIO_AUDIOOUT_H
+#define MICROPY_INCLUDED_NRF_COMMON_HAL_AUDIOBUSIO_AUDIOOUT_H
+
+#include "common-hal/microcontroller/Pin.h"
+
+#include "py/obj.h"
+
+typedef struct {
+ mp_obj_base_t base;
+ uint8_t clock_pin_number, data_pin_number;
+ bool mono;
+} audiobusio_pdmin_obj_t;
+
+#endif
diff --git a/ports/nrf/common-hal/audiobusio/__init__.c b/ports/nrf/common-hal/audiobusio/__init__.c
new file mode 100644
index 000000000..e69de29bb
--- /dev/null
+++ b/ports/nrf/common-hal/audiobusio/__init__.c
diff --git a/ports/nrf/mpconfigport.mk b/ports/nrf/mpconfigport.mk
index 57879bbaa..55920b3f4 100644
--- a/ports/nrf/mpconfigport.mk
+++ b/ports/nrf/mpconfigport.mk
@@ -14,9 +14,7 @@ LONGINT_IMPL = MPZ
CIRCUITPY_AUDIOCORE = 1
CIRCUITPY_AUDIOIO = 0
CIRCUITPY_AUDIOPWMIO = 1
-
-# No I2S yet.
-CIRCUITPY_AUDIOBUSIO = 0
+CIRCUITPY_AUDIOBUSIO = 1
# No I2CSlave implementation
CIRCUITPY_I2CSLAVE = 0
diff --git a/tools/check_translations.py b/tools/check_translations.py
index 4bea040bf..7c008d3da 100644
--- a/tools/check_translations.py
+++ b/tools/check_translations.py
@@ -16,8 +16,10 @@ for po_filename in po_filenames:
po_file = polib.pofile(po_filename)
po_ids = set([x.msgid for x in po_file])
- if all_ids - po_ids:
+ missing = all_ids - po_ids
+ if missing:
print("Missing message id. Please run `make translate`")
+ print(missing)
sys.exit(-1)
else:
print("ok")