aboutsummaryrefslogtreecommitdiff
path: root/Demos/Device
diff options
context:
space:
mode:
authorDean <Dean@d5102386-fcda-11dd-9fdb-3debd5008f28>2010-01-25 00:52:45 +0000
committerDean <Dean@d5102386-fcda-11dd-9fdb-3debd5008f28>2010-01-25 00:52:45 +0000
commit8431712c0657b8495ae8fb957eba1eff300cd917 (patch)
treed26d7195168de8550665e36dd6a443f2f22ab704 /Demos/Device
parent0f54346b219e09b620b706a3d74277632f7061c9 (diff)
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.
git-svn-id: http://lufa-lib.googlecode.com/svn/trunk@1058 d5102386-fcda-11dd-9fdb-3debd5008f28
Diffstat (limited to 'Demos/Device')
-rw-r--r--Demos/Device/ClassDriver/AudioInput/AudioInput.c2
-rw-r--r--Demos/Device/ClassDriver/AudioInput/AudioInput.h3
-rw-r--r--Demos/Device/LowLevel/AudioInput/AudioInput.c2
-rw-r--r--Demos/Device/LowLevel/AudioInput/AudioInput.h3
4 files changed, 8 insertions, 2 deletions
diff --git a/Demos/Device/ClassDriver/AudioInput/AudioInput.c b/Demos/Device/ClassDriver/AudioInput/AudioInput.c
index eeec921e..b90ee512 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 ddb64304..98fec781 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
diff --git a/Demos/Device/LowLevel/AudioInput/AudioInput.c b/Demos/Device/LowLevel/AudioInput/AudioInput.c
index 98c2e8b3..2d718e53 100644
--- a/Demos/Device/LowLevel/AudioInput/AudioInput.c
+++ b/Demos/Device/LowLevel/AudioInput/AudioInput.c
@@ -72,7 +72,7 @@ void SetupHardware(void)
USB_Init();
/* 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);
}
/** Event handler for the USB_Connect event. This indicates that the device is enumerating via the status LEDs, and
diff --git a/Demos/Device/LowLevel/AudioInput/AudioInput.h b/Demos/Device/LowLevel/AudioInput/AudioInput.h
index ace1e968..4585ab5b 100644
--- a/Demos/Device/LowLevel/AudioInput/AudioInput.h
+++ b/Demos/Device/LowLevel/AudioInput/AudioInput.h
@@ -52,6 +52,9 @@
/** 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