From 8a98283cb04b1f7dda2ca49437ab645473a6095b Mon Sep 17 00:00:00 2001 From: bsongis Date: Fri, 7 Dec 2012 19:36:28 +0000 Subject: [PATCH] [All] getADC() now uses something between SINGLE and OSMP methods --- src/open9x.cpp | 17 ++++++----------- 1 file changed, 6 insertions(+), 11 deletions(-) diff --git a/src/open9x.cpp b/src/open9x.cpp index 43624921b..f45cc40e5 100644 --- a/src/open9x.cpp +++ b/src/open9x.cpp @@ -1562,19 +1562,14 @@ void getADC() void getADC() { uint16_t temp_ana; - for (uint8_t adc_input=0; adc_input<8; adc_input++) { - temp_ana = 0; ADMUX = adc_input|ADC_VREF_TYPE; - for (uint8_t i=0; i<2;i++) { // Going from 10bits to 11 bits. - // Start the AD conversion - ADCSRA|=0x40; - // Wait for the AD conversion to complete - while ((ADCSRA & 0x10)==0); - ADCSRA|=0x10; - temp_ana += ADC; - } - s_anaFilt[adc_input] = temp_ana; + ADCSRA|=0x40; // Start the AD conversion + while (ADCSRA & 0x40); // Wait for the AD conversion to complete + temp_ana = ADC; + ADCSRA|=0x40; // Start the second AD conversion + while (ADCSRA & 0x40); // Wait for the AD conversion to complete + s_anaFilt[adc_input] = temp_ana + ADC; } } #endif