File tree Expand file tree Collapse file tree 2 files changed +8
-0
lines changed Expand file tree Collapse file tree 2 files changed +8
-0
lines changed Original file line number Diff line number Diff line change @@ -352,6 +352,8 @@ bool audio_dma_get_paused(audio_dma_t *dma) {
352
352
void audio_dma_init (audio_dma_t * dma ) {
353
353
dma -> first_buffer = NULL ;
354
354
dma -> second_buffer = NULL ;
355
+ dma -> channel [0 ] = NUM_DMA_CHANNELS ;
356
+ dma -> channel [1 ] = NUM_DMA_CHANNELS ;
355
357
}
356
358
357
359
void audio_dma_deinit (audio_dma_t * dma ) {
Original file line number Diff line number Diff line change @@ -127,6 +127,12 @@ void common_hal_audiopwmio_pwmaudioout_deinit(audiopwmio_pwmaudioout_obj_t *self
127
127
128
128
void common_hal_audiopwmio_pwmaudioout_play (audiopwmio_pwmaudioout_obj_t * self , mp_obj_t sample , bool loop ) {
129
129
130
+ if (self -> dma .channel [0 ] < NUM_DMA_CHANNELS ) {
131
+ if (common_hal_audiopwmio_pwmaudioout_get_playing (self )) {
132
+ common_hal_audiopwmio_pwmaudioout_stop (self );
133
+ }
134
+ }
135
+
130
136
// TODO: Share pacing timers based on frequency.
131
137
size_t pacing_timer = NUM_DMA_TIMERS ;
132
138
for (size_t i = 0 ; i < NUM_DMA_TIMERS ; i ++ ) {
You can’t perform that action at this time.
0 commit comments