Merge pull request #2075 from jepler/nrf-pdm-audioin
nrf: implement audiobusio.PDMIn
This commit is contained in:
commit
308efbeb04
12
locale/ID.po
12
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"
|
||||
|
@ -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"
|
||||
|
@ -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"
|
||||
|
@ -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"
|
||||
|
@ -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"
|
||||
|
12
locale/es.po
12
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"
|
||||
|
@ -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"
|
||||
|
10
locale/fr.po
10
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"
|
||||
|
@ -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"
|
||||
|
||||
|
14
locale/pl.po
14
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"
|
||||
|
@ -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"
|
||||
|
@ -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'"
|
||||
|
||||
|
70
ports/nrf/common-hal/audiobusio/I2SOut.c
Normal file
70
ports/nrf/common-hal/audiobusio/I2SOut.c
Normal file
@ -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);
|
||||
}
|
36
ports/nrf/common-hal/audiobusio/I2SOut.h
Normal file
36
ports/nrf/common-hal/audiobusio/I2SOut.h
Normal file
@ -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
|
130
ports/nrf/common-hal/audiobusio/PDMIn.c
Normal file
130
ports/nrf/common-hal/audiobusio/PDMIn.c
Normal file
@ -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;
|
||||
}
|
||||
}
|
40
ports/nrf/common-hal/audiobusio/PDMIn.h
Normal file
40
ports/nrf/common-hal/audiobusio/PDMIn.h
Normal file
@ -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
|
0
ports/nrf/common-hal/audiobusio/__init__.c
Normal file
0
ports/nrf/common-hal/audiobusio/__init__.c
Normal file
@ -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
|
||||
|
@ -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")
|
||||
|
Loading…
x
Reference in New Issue
Block a user