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

DMAMEM static uint16_t analog_rx_buffer[AUDIO_BLOCK_SAMPLES]; DMAMEM static uint16_t analog_rx_buffer[AUDIO_BLOCK_SAMPLES];
audio_block_t * AudioInputAnalog::block_left = NULL; audio_block_t * AudioInputAnalog::block_left = NULL;
uint16_t AudioInputAnalog::block_offset = 0; 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_CONFIG (PDB_SC_TRGSEL(15) | PDB_SC_PDBEN | PDB_SC_CONT)
#define PDB_PERIOD 1087 // 48e6 / 44100 #define PDB_PERIOD 1087 // 48e6 / 44100
DMA_TCD2_CSR = DMA_TCD_CSR_INTHALF | DMA_TCD_CSR_INTMAJOR; DMA_TCD2_CSR = DMA_TCD_CSR_INTHALF | DMA_TCD_CSR_INTMAJOR;
DMAMUX0_CHCFG2 = DMAMUX_DISABLE; DMAMUX0_CHCFG2 = DMAMUX_DISABLE;
DMAMUX0_CHCFG2 = DMAMUX_SOURCE_ADC0 | DMAMUX_ENABLE; DMAMUX0_CHCFG2 = DMAMUX_SOURCE_ADC0 | DMAMUX_ENABLE;
//update_responsibility = update_setup();
update_responsibility = update_setup();
DMA_SERQ = 2; DMA_SERQ = 2;
NVIC_ENABLE_IRQ(IRQ_DMA_CH2); NVIC_ENABLE_IRQ(IRQ_DMA_CH2);
} }
// need to remove data from the second half // need to remove data from the second half
src = (uint16_t *)&analog_rx_buffer[AUDIO_BLOCK_SAMPLES/2]; src = (uint16_t *)&analog_rx_buffer[AUDIO_BLOCK_SAMPLES/2];
end = (uint16_t *)&analog_rx_buffer[AUDIO_BLOCK_SAMPLES]; end = (uint16_t *)&analog_rx_buffer[AUDIO_BLOCK_SAMPLES];
//if (AudioInputI2S::update_responsibility) AudioStream::update_all();
if (AudioInputAnalog::update_responsibility) AudioStream::update_all();
} else { } else {
// DMA is receiving to the second half of the buffer // DMA is receiving to the second half of the buffer
// need to remove data from the first half // need to remove data from the first half

+ 1
- 1
Audio.h View File

static audio_block_t *block_left; static audio_block_t *block_left;
static uint16_t block_offset; static uint16_t block_offset;
uint16_t dc_average; 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