summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJeff Epler <jepler@gmail.com>2019-08-07 21:29:24 -0500
committerJeff Epler <jepler@gmail.com>2019-08-07 21:29:24 -0500
commit33b949abfa9ab798a3de9d3b9ce3d2cbdbad10d0 (patch)
tree7cc11fb5d737a78db56514a89079e227d74d6d41
parent500d1bb168e895a2661dfee5bb6cd293541c4a58 (diff)
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.
-rw-r--r--ports/atmel-samd/audio_dma.c3
-rw-r--r--ports/atmel-samd/background.c2
2 files changed, 4 insertions, 1 deletions
diff --git a/ports/atmel-samd/audio_dma.c b/ports/atmel-samd/audio_dma.c
index adf62942c..481a420cb 100644
--- a/ports/atmel-samd/audio_dma.c
+++ b/ports/atmel-samd/audio_dma.c
@@ -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
diff --git a/ports/atmel-samd/background.c b/ports/atmel-samd/background.c
index 4e88d34e7..694238070 100644
--- a/ports/atmel-samd/background.c
+++ b/ports/atmel-samd/background.c
@@ -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