From 87b715ad2d4f7614cb5c5463f165c450078c349e Mon Sep 17 00:00:00 2001 From: PaulStoffregen Date: Tue, 7 Oct 2014 18:27:56 -0700 Subject: [PATCH] Fix AudioInputAnalog --- input_adc.cpp | 3 ++- input_adc.h | 7 ++++--- 2 files changed, 6 insertions(+), 4 deletions(-) diff --git a/input_adc.cpp b/input_adc.cpp index 3399919c..cf272951 100644 --- a/input_adc.cpp +++ b/input_adc.cpp @@ -31,11 +31,12 @@ DMAMEM static uint16_t analog_rx_buffer[AUDIO_BLOCK_SAMPLES]; audio_block_t * AudioInputAnalog::block_left = NULL; uint16_t AudioInputAnalog::block_offset = 0; +uint16_t AudioInputAnalog::dc_average = 0; bool AudioInputAnalog::update_responsibility = false; DMAChannel AudioInputAnalog::dma(false); -AudioInputAnalog::AudioInputAnalog(uint8_t pin) : AudioStream(0, NULL) +void AudioInputAnalog::init(uint8_t pin) { uint32_t i, sum=0; diff --git a/input_adc.h b/input_adc.h index 19e9effc..0a920c83 100644 --- a/input_adc.h +++ b/input_adc.h @@ -33,17 +33,18 @@ class AudioInputAnalog : public AudioStream { public: - AudioInputAnalog(uint8_t pin); - AudioInputAnalog() : AudioStream(0, NULL) { AudioInputAnalog(A2); } + AudioInputAnalog() : AudioStream(0, NULL) { init(A2); } + AudioInputAnalog(uint8_t pin) : AudioStream(0, NULL) { init(pin); } virtual void update(void); friend void dma_ch9_isr(void); private: static audio_block_t *block_left; static uint16_t block_offset; - uint16_t dc_average; + static uint16_t dc_average; static bool update_responsibility; static DMAChannel dma; static void isr(void); + static void init(uint8_t pin); }; #endif