Merge pull request #1204 from tannewt/merge_3x

Merge in AudioOut fix from 3.x
This commit is contained in:
Kattni 2018-09-21 13:15:51 -04:00 committed by GitHub
commit 839b791253
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
8 changed files with 85 additions and 42 deletions

View File

@ -8,7 +8,7 @@ msgid ""
msgstr ""
"Project-Id-Version: PACKAGE VERSION\n"
"Report-Msgid-Bugs-To: \n"
"POT-Creation-Date: 2018-09-20 21:52-0400\n"
"POT-Creation-Date: 2018-09-21 12:23-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"
@ -291,12 +291,12 @@ msgid "Too many channels in sample."
msgstr ""
#: ports/atmel-samd/common-hal/audiobusio/I2SOut.c:305
#: ports/atmel-samd/common-hal/audioio/AudioOut.c:326
#: ports/atmel-samd/common-hal/audioio/AudioOut.c:339
msgid "No DMA channel found"
msgstr ""
#: ports/atmel-samd/common-hal/audiobusio/I2SOut.c:308
#: ports/atmel-samd/common-hal/audioio/AudioOut.c:328
#: ports/atmel-samd/common-hal/audioio/AudioOut.c:341
msgid "Unable to allocate buffers for signed conversion"
msgstr ""
@ -338,16 +338,21 @@ msgstr ""
msgid "Cannot output both channels on the same pin"
msgstr ""
#: ports/atmel-samd/common-hal/audioio/AudioOut.c:173
#: ports/atmel-samd/common-hal/audioio/AudioOut.c:176
#: ports/atmel-samd/common-hal/pulseio/PWMOut.c:189
#: ports/atmel-samd/common-hal/pulseio/PulseOut.c:110
msgid "All timers in use"
msgstr ""
#: ports/atmel-samd/common-hal/audioio/AudioOut.c:215
#: ports/atmel-samd/common-hal/audioio/AudioOut.c:218
msgid "All event channels in use"
msgstr ""
#: ports/atmel-samd/common-hal/audioio/AudioOut.c:297
#, c-format
msgid "Sample rate too high. It must be less than %d"
msgstr ""
#: ports/atmel-samd/common-hal/busio/I2C.c:71
msgid "Not enough pins available"
msgstr ""

View File

@ -7,7 +7,7 @@ msgid ""
msgstr ""
"Project-Id-Version: \n"
"Report-Msgid-Bugs-To: \n"
"POT-Creation-Date: 2018-09-20 21:52-0400\n"
"POT-Creation-Date: 2018-09-21 12:23-0400\n"
"PO-Revision-Date: 2018-07-27 11:55-0700\n"
"Last-Translator: Sebastian Plamauer\n"
"Language-Team: \n"
@ -300,12 +300,12 @@ msgid "Too many channels in sample."
msgstr "Zu viele Kanäle im sample"
#: ports/atmel-samd/common-hal/audiobusio/I2SOut.c:305
#: ports/atmel-samd/common-hal/audioio/AudioOut.c:326
#: ports/atmel-samd/common-hal/audioio/AudioOut.c:339
msgid "No DMA channel found"
msgstr "Kein DMA Kanal gefunden"
#: ports/atmel-samd/common-hal/audiobusio/I2SOut.c:308
#: ports/atmel-samd/common-hal/audioio/AudioOut.c:328
#: ports/atmel-samd/common-hal/audioio/AudioOut.c:341
msgid "Unable to allocate buffers for signed conversion"
msgstr "Konnte keine Buffer für Vorzeichenumwandlung allozieren"
@ -347,16 +347,21 @@ msgstr "Ungültiger Pin für rechten Kanal"
msgid "Cannot output both channels on the same pin"
msgstr "Kann nicht beite Kanäle auf dem gleichen Pin ausgeben"
#: ports/atmel-samd/common-hal/audioio/AudioOut.c:173
#: ports/atmel-samd/common-hal/audioio/AudioOut.c:176
#: ports/atmel-samd/common-hal/pulseio/PWMOut.c:189
#: ports/atmel-samd/common-hal/pulseio/PulseOut.c:110
msgid "All timers in use"
msgstr "Alle timer werden benutzt"
#: ports/atmel-samd/common-hal/audioio/AudioOut.c:215
#: ports/atmel-samd/common-hal/audioio/AudioOut.c:218
msgid "All event channels in use"
msgstr "Alle event Kanälre werden benutzt"
#: ports/atmel-samd/common-hal/audioio/AudioOut.c:297
#, c-format
msgid "Sample rate too high. It must be less than %d"
msgstr ""
#: ports/atmel-samd/common-hal/busio/I2C.c:71
msgid "Not enough pins available"
msgstr "Nicht genug Pins vorhanden"

View File

@ -7,7 +7,7 @@ msgid ""
msgstr ""
"Project-Id-Version: \n"
"Report-Msgid-Bugs-To: \n"
"POT-Creation-Date: 2018-09-20 21:52-0400\n"
"POT-Creation-Date: 2018-09-21 12:23-0400\n"
"PO-Revision-Date: 2018-07-27 11:55-0700\n"
"Last-Translator: \n"
"Language-Team: \n"
@ -291,12 +291,12 @@ msgid "Too many channels in sample."
msgstr ""
#: ports/atmel-samd/common-hal/audiobusio/I2SOut.c:305
#: ports/atmel-samd/common-hal/audioio/AudioOut.c:326
#: ports/atmel-samd/common-hal/audioio/AudioOut.c:339
msgid "No DMA channel found"
msgstr ""
#: ports/atmel-samd/common-hal/audiobusio/I2SOut.c:308
#: ports/atmel-samd/common-hal/audioio/AudioOut.c:328
#: ports/atmel-samd/common-hal/audioio/AudioOut.c:341
msgid "Unable to allocate buffers for signed conversion"
msgstr ""
@ -338,16 +338,21 @@ msgstr ""
msgid "Cannot output both channels on the same pin"
msgstr ""
#: ports/atmel-samd/common-hal/audioio/AudioOut.c:173
#: ports/atmel-samd/common-hal/audioio/AudioOut.c:176
#: ports/atmel-samd/common-hal/pulseio/PWMOut.c:189
#: ports/atmel-samd/common-hal/pulseio/PulseOut.c:110
msgid "All timers in use"
msgstr ""
#: ports/atmel-samd/common-hal/audioio/AudioOut.c:215
#: ports/atmel-samd/common-hal/audioio/AudioOut.c:218
msgid "All event channels in use"
msgstr ""
#: ports/atmel-samd/common-hal/audioio/AudioOut.c:297
#, c-format
msgid "Sample rate too high. It must be less than %d"
msgstr ""
#: ports/atmel-samd/common-hal/busio/I2C.c:71
msgid "Not enough pins available"
msgstr ""

View File

@ -7,7 +7,7 @@ msgid ""
msgstr ""
"Project-Id-Version: \n"
"Report-Msgid-Bugs-To: \n"
"POT-Creation-Date: 2018-09-20 21:52-0400\n"
"POT-Creation-Date: 2018-09-21 12:23-0400\n"
"PO-Revision-Date: 2018-08-24 22:56-0500\n"
"Last-Translator: \n"
"Language-Team: \n"
@ -307,12 +307,12 @@ msgid "Too many channels in sample."
msgstr ""
#: ports/atmel-samd/common-hal/audiobusio/I2SOut.c:305
#: ports/atmel-samd/common-hal/audioio/AudioOut.c:326
#: ports/atmel-samd/common-hal/audioio/AudioOut.c:339
msgid "No DMA channel found"
msgstr ""
#: ports/atmel-samd/common-hal/audiobusio/I2SOut.c:308
#: ports/atmel-samd/common-hal/audioio/AudioOut.c:328
#: ports/atmel-samd/common-hal/audioio/AudioOut.c:341
msgid "Unable to allocate buffers for signed conversion"
msgstr "No se pudieron asignar buffers para la conversión con signo"
@ -354,16 +354,21 @@ msgstr ""
msgid "Cannot output both channels on the same pin"
msgstr "No es posible utilizar el mismo pin para ambos canales"
#: ports/atmel-samd/common-hal/audioio/AudioOut.c:173
#: ports/atmel-samd/common-hal/audioio/AudioOut.c:176
#: ports/atmel-samd/common-hal/pulseio/PWMOut.c:189
#: ports/atmel-samd/common-hal/pulseio/PulseOut.c:110
msgid "All timers in use"
msgstr "Todos los timers estan siendo utilizados"
#: ports/atmel-samd/common-hal/audioio/AudioOut.c:215
#: ports/atmel-samd/common-hal/audioio/AudioOut.c:218
msgid "All event channels in use"
msgstr "Todos los canales de eventos estan siendo utilizados"
#: ports/atmel-samd/common-hal/audioio/AudioOut.c:297
#, c-format
msgid "Sample rate too high. It must be less than %d"
msgstr ""
#: ports/atmel-samd/common-hal/busio/I2C.c:71
msgid "Not enough pins available"
msgstr "No hay suficientes pines disponibles"

View File

@ -7,7 +7,7 @@ msgid ""
msgstr ""
"Project-Id-Version: \n"
"Report-Msgid-Bugs-To: \n"
"POT-Creation-Date: 2018-09-20 21:52-0400\n"
"POT-Creation-Date: 2018-09-21 12:23-0400\n"
"PO-Revision-Date: 2018-08-30 23:04-0700\n"
"Last-Translator: Timothy <me@timothygarcia.ca>\n"
"Language-Team: fil\n"
@ -303,12 +303,12 @@ msgid "Too many channels in sample."
msgstr "Sobra ang channels sa sample."
#: ports/atmel-samd/common-hal/audiobusio/I2SOut.c:305
#: ports/atmel-samd/common-hal/audioio/AudioOut.c:326
#: ports/atmel-samd/common-hal/audioio/AudioOut.c:339
msgid "No DMA channel found"
msgstr "Walang DMA channel na mahanap"
#: ports/atmel-samd/common-hal/audiobusio/I2SOut.c:308
#: ports/atmel-samd/common-hal/audioio/AudioOut.c:328
#: ports/atmel-samd/common-hal/audioio/AudioOut.c:341
msgid "Unable to allocate buffers for signed conversion"
msgstr "Hindi ma-allocate ang buffers para sa naka-sign na conversion"
@ -350,16 +350,21 @@ msgstr "Mali ang pin para sa kanang channel"
msgid "Cannot output both channels on the same pin"
msgstr "Hindi maaaring output ang mga parehong channel sa parehong pin"
#: ports/atmel-samd/common-hal/audioio/AudioOut.c:173
#: ports/atmel-samd/common-hal/audioio/AudioOut.c:176
#: ports/atmel-samd/common-hal/pulseio/PWMOut.c:189
#: ports/atmel-samd/common-hal/pulseio/PulseOut.c:110
msgid "All timers in use"
msgstr "Lahat ng timer ginagamit"
#: ports/atmel-samd/common-hal/audioio/AudioOut.c:215
#: ports/atmel-samd/common-hal/audioio/AudioOut.c:218
msgid "All event channels in use"
msgstr "Lahat ng event channels ginagamit"
#: ports/atmel-samd/common-hal/audioio/AudioOut.c:297
#, c-format
msgid "Sample rate too high. It must be less than %d"
msgstr ""
#: ports/atmel-samd/common-hal/busio/I2C.c:71
msgid "Not enough pins available"
msgstr "Hindi sapat ang magagamit na pins"

View File

@ -7,7 +7,7 @@ msgid ""
msgstr ""
"Project-Id-Version: 0.1\n"
"Report-Msgid-Bugs-To: \n"
"POT-Creation-Date: 2018-09-20 21:52-0400\n"
"POT-Creation-Date: 2018-09-21 12:23-0400\n"
"PO-Revision-Date: 2018-08-14 11:01+0200\n"
"Last-Translator: Pierrick Couturier <arofarn@arofarn.info>\n"
"Language-Team: fr\n"
@ -298,12 +298,12 @@ msgid "Too many channels in sample."
msgstr "Trop de canaux dans l'échantillon."
#: ports/atmel-samd/common-hal/audiobusio/I2SOut.c:305
#: ports/atmel-samd/common-hal/audioio/AudioOut.c:326
#: ports/atmel-samd/common-hal/audioio/AudioOut.c:339
msgid "No DMA channel found"
msgstr "Aucun canal DMA trouvé"
#: ports/atmel-samd/common-hal/audiobusio/I2SOut.c:308
#: ports/atmel-samd/common-hal/audioio/AudioOut.c:328
#: ports/atmel-samd/common-hal/audioio/AudioOut.c:341
msgid "Unable to allocate buffers for signed conversion"
msgstr "Impossible d'allouer des tampons pour une conversion signée"
@ -345,16 +345,21 @@ msgstr "Broche invalide pour le canal droit"
msgid "Cannot output both channels on the same pin"
msgstr "On ne peut mettre les deux canaux sur la même broche"
#: ports/atmel-samd/common-hal/audioio/AudioOut.c:173
#: ports/atmel-samd/common-hal/audioio/AudioOut.c:176
#: ports/atmel-samd/common-hal/pulseio/PWMOut.c:189
#: ports/atmel-samd/common-hal/pulseio/PulseOut.c:110
msgid "All timers in use"
msgstr "Tous les timers sont utilisés"
#: ports/atmel-samd/common-hal/audioio/AudioOut.c:215
#: ports/atmel-samd/common-hal/audioio/AudioOut.c:218
msgid "All event channels in use"
msgstr "Tous les canaux d'événements sont utilisés"
#: ports/atmel-samd/common-hal/audioio/AudioOut.c:297
#, c-format
msgid "Sample rate too high. It must be less than %d"
msgstr ""
#: ports/atmel-samd/common-hal/busio/I2C.c:71
msgid "Not enough pins available"
msgstr "Pas assez de broches disponibles"
@ -2400,10 +2405,10 @@ msgstr "'S' et 'O' ne sont pas des types de format supportés"
msgid "too many arguments provided with the given format"
msgstr "trop d'arguments fournis avec ce format"
#, fuzzy
#~ msgid "palette must be displayio.Palette"
#~ msgstr "la palette doit être longue de 32 octets"
#, fuzzy
#~ msgid "value_size must be power of two"
#~ msgstr "'len' doit être un multiple de 4"
#, fuzzy
#~ msgid "palette must be displayio.Palette"
#~ msgstr "la palette doit être longue de 32 octets"

View File

@ -385,7 +385,7 @@
// <i> Select the clock source for DAC.
#ifndef CONF_GCLK_DAC_SRC
#define CONF_GCLK_DAC_SRC GCLK_CLKCTRL_GEN_GCLK1_Val
#define CONF_GCLK_DAC_SRC GCLK_CLKCTRL_GEN_GCLK0_Val
#endif
/**
@ -393,7 +393,7 @@
* \brief DAC's Clock frequency
*/
#ifndef CONF_GCLK_DAC_FREQUENCY
#define CONF_GCLK_DAC_FREQUENCY 320000
#define CONF_GCLK_DAC_FREQUENCY 48000000
#endif
// <y> USB Clock Source

View File

@ -110,13 +110,14 @@ void common_hal_audioio_audioout_construct(audioio_audioout_obj_t* self,
_pm_enable_bus_clock(PM_BUS_APBC, DAC);
#endif
// SAMD21: This clock should be <= 12 MHz, per datasheet section 47.6.3.
// SAMD51: This clock should be <= 350kHz, per datasheet table 37-6.
// SAMD51: This clock should be <= 12 MHz, per datasheet section 47.6.3.
// SAMD21: This clock is 48mhz despite the datasheet saying it must only be <= 350kHz, per
// datasheet table 37-6. It's incorrect because the max output rate is 350ksps and is only
// achieved when the GCLK is more than 8mhz.
_gclk_enable_channel(DAC_GCLK_ID, CONF_GCLK_DAC_SRC);
DAC->CTRLA.bit.SWRST = 1;
while (DAC->CTRLA.bit.SWRST == 1) {}
DAC->CTRLA.bit.SWRST = 1;
while (DAC->CTRLA.bit.SWRST == 1) {}
bool channel0_enabled = true;
#ifdef SAMD51
@ -127,9 +128,11 @@ void common_hal_audioio_audioout_construct(audioio_audioout_obj_t* self,
if (channel0_enabled) {
#ifdef SAMD21
DAC->EVCTRL.reg |= DAC_EVCTRL_STARTEI;
// We disable the voltage pump because we always run at 3.3v.
DAC->CTRLB.reg = DAC_CTRLB_REFSEL_AVCC |
DAC_CTRLB_LEFTADJ |
DAC_CTRLB_EOEN;
DAC_CTRLB_EOEN |
DAC_CTRLB_VPD;
#endif
#ifdef SAMD51
DAC->EVCTRL.reg |= DAC_EVCTRL_STARTEI0;
@ -283,6 +286,16 @@ void common_hal_audioio_audioout_play(audioio_audioout_obj_t* self,
common_hal_audioio_audioout_stop(self);
}
audio_dma_result result = AUDIO_DMA_OK;
uint32_t sample_rate = audiosample_sample_rate(sample);
#ifdef SAMD21
uint32_t max_sample_rate = 350000;
#endif
#ifdef SAMD51
uint32_t max_sample_rate = 1000000;
#endif
if (sample_rate > max_sample_rate) {
mp_raise_ValueError_varg(translate("Sample rate too high. It must be less than %d"), max_sample_rate);
}
#ifdef SAMD21
result = audio_dma_setup_playback(&self->left_dma, sample, loop, true, 0,
false /* output unsigned */,