Browse Source

Fix update scheduling with AudioInputAnalog

dds
PaulStoffregen 10 years ago
parent
commit
e1e5a34c73
2 changed files with 4 additions and 3 deletions
  1. +3
    -2
      Audio.cpp
  2. +1
    -1
      Audio.h

+ 3
- 2
Audio.cpp View File

@@ -952,6 +952,7 @@ void AudioInputI2Sslave::begin(void)
DMAMEM static uint16_t analog_rx_buffer[AUDIO_BLOCK_SAMPLES];
audio_block_t * AudioInputAnalog::block_left = NULL;
uint16_t AudioInputAnalog::block_offset = 0;
bool AudioInputAnalog::update_responsibility = false;

#define PDB_CONFIG (PDB_SC_TRGSEL(15) | PDB_SC_PDBEN | PDB_SC_CONT)
#define PDB_PERIOD 1087 // 48e6 / 44100
@@ -1016,7 +1017,7 @@ void AudioInputAnalog::begin(unsigned int pin)
DMA_TCD2_CSR = DMA_TCD_CSR_INTHALF | DMA_TCD_CSR_INTMAJOR;
DMAMUX0_CHCFG2 = DMAMUX_DISABLE;
DMAMUX0_CHCFG2 = DMAMUX_SOURCE_ADC0 | DMAMUX_ENABLE;
//update_responsibility = update_setup();
update_responsibility = update_setup();
DMA_SERQ = 2;
NVIC_ENABLE_IRQ(IRQ_DMA_CH2);
}
@@ -1037,7 +1038,7 @@ void dma_ch2_isr(void)
// need to remove data from the second half
src = (uint16_t *)&analog_rx_buffer[AUDIO_BLOCK_SAMPLES/2];
end = (uint16_t *)&analog_rx_buffer[AUDIO_BLOCK_SAMPLES];
//if (AudioInputI2S::update_responsibility) AudioStream::update_all();
if (AudioInputAnalog::update_responsibility) AudioStream::update_all();
} else {
// DMA is receiving to the second half of the buffer
// need to remove data from the first half

+ 1
- 1
Audio.h View File

@@ -257,7 +257,7 @@ private:
static audio_block_t *block_left;
static uint16_t block_offset;
uint16_t dc_average;
//static bool update_responsibility; // TODO: implement and test this.
static bool update_responsibility; // TODO: implement and test this.
};



Loading…
Cancel
Save