samd: audio_dma, audio_background: Gate with CIRCUITPY_ defines

Some ports which actually don't have audioio or audiobusio were still
calling into audio_dma_background().  This wasn't an error until
the assignment to audio_dma_state in audio_dma_stop was added, though
it's not clear why.
This commit is contained in:
Jeff Epler 2019-08-07 21:29:24 -05:00
parent 500d1bb168
commit 33b949abfa
2 changed files with 4 additions and 1 deletions

View File

@ -35,6 +35,8 @@
#include "py/mpstate.h"
#include "py/runtime.h"
#if CIRCUITPY_AUDIOIO || CIRCUITPY_AUDIOBUSIO
static audio_dma_t* audio_dma_state[AUDIO_DMA_CHANNEL_COUNT];
// This cannot be in audio_dma_state because it's volatile.
@ -348,3 +350,4 @@ void audio_dma_background(void) {
audio_dma_pending[i] = false;
}
}
#endif

View File

@ -56,7 +56,7 @@ void run_background_tasks(void) {
assert_heap_ok();
running_background_tasks = true;
#if (defined(SAMD21) && defined(PIN_PA02)) || defined(SAMD51)
#if CIRCUITPY_AUDIOIO || CIRCUITPY_AUDIOBUSIO
audio_dma_background();
#endif
#if CIRCUITPY_DISPLAYIO