aboutsummaryrefslogtreecommitdiff
path: root/Demos/Device/ClassDriver
diff options
context:
space:
mode:
authorDean Camera <[email protected]>2010-01-25 00:52:45 +0000
committerDean Camera <[email protected]>2010-01-25 00:52:45 +0000
commitb68f7f16499a96e85c7cef4afd9da1a5c69e6a08 (patch)
treed26d7195168de8550665e36dd6a443f2f22ab704 /Demos/Device/ClassDriver
parent871d9bf1af06fe208ca16cb3b19722bec1300e63 (diff)
downloadqmk_firmware-b68f7f16499a96e85c7cef4afd9da1a5c69e6a08.tar.gz
qmk_firmware-b68f7f16499a96e85c7cef4afd9da1a5c69e6a08.zip
Added explicit ADC channel masks for the standard set of ADC channels, as the single-ended channel MUX masks are not equal to the channel number on some AVR models. Changed demos to use the new channel masks when using the ADC driver.
Diffstat (limited to 'Demos/Device/ClassDriver')
-rw-r--r--Demos/Device/ClassDriver/AudioInput/AudioInput.c2
-rw-r--r--Demos/Device/ClassDriver/AudioInput/AudioInput.h3
2 files changed, 4 insertions, 1 deletions
diff --git a/Demos/Device/ClassDriver/AudioInput/AudioInput.c b/Demos/Device/ClassDriver/AudioInput/AudioInput.c
index eeec921ee4..b90ee51259 100644
--- a/Demos/Device/ClassDriver/AudioInput/AudioInput.c
+++ b/Demos/Device/ClassDriver/AudioInput/AudioInput.c
@@ -86,7 +86,7 @@ void SetupHardware(void)
ADC_SetupChannel(MIC_IN_ADC_CHANNEL);
/* Start the ADC conversion in free running mode */
- ADC_StartReading(ADC_REFERENCE_AVCC | ADC_RIGHT_ADJUSTED | MIC_IN_ADC_CHANNEL);
+ ADC_StartReading(ADC_REFERENCE_AVCC | ADC_RIGHT_ADJUSTED | MIC_IN_ADC_MUX_MASK);
}
/** Processes the next audio sample by reading the last ADC conversion and writing it to the audio
diff --git a/Demos/Device/ClassDriver/AudioInput/AudioInput.h b/Demos/Device/ClassDriver/AudioInput/AudioInput.h
index ddb6430456..98fec78133 100644
--- a/Demos/Device/ClassDriver/AudioInput/AudioInput.h
+++ b/Demos/Device/ClassDriver/AudioInput/AudioInput.h
@@ -52,6 +52,9 @@
/* Macros: */
/** ADC channel number for the microphone input. */
#define MIC_IN_ADC_CHANNEL 2
+
+ /** ADC channel MUX mask for the microphone input. */
+ #define MIC_IN_ADC_MUX_MASK ADC_CHANNEL2
/** Maximum ADC sample value for the microphone input. */
#define SAMPLE_MAX_RANGE 0xFFFF