aboutsummaryrefslogtreecommitdiffstats
path: root/LUFA/Drivers/Board
diff options
context:
space:
mode:
authorDean Camera <dean@fourwalledcubicle.com>2010-01-25 00:52:45 +0000
committerDean Camera <dean@fourwalledcubicle.com>2010-01-25 00:52:45 +0000
commitb68f7f16499a96e85c7cef4afd9da1a5c69e6a08 (patch)
treed26d7195168de8550665e36dd6a443f2f22ab704 /LUFA/Drivers/Board
parent871d9bf1af06fe208ca16cb3b19722bec1300e63 (diff)
downloadlufa-b68f7f16499a96e85c7cef4afd9da1a5c69e6a08.tar.gz
lufa-b68f7f16499a96e85c7cef4afd9da1a5c69e6a08.tar.bz2
lufa-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 'LUFA/Drivers/Board')
-rw-r--r--LUFA/Drivers/Board/Temperature.c2
-rw-r--r--LUFA/Drivers/Board/Temperature.h9
2 files changed, 7 insertions, 4 deletions
diff --git a/LUFA/Drivers/Board/Temperature.c b/LUFA/Drivers/Board/Temperature.c
index 748e0484f..ea12bf766 100644
--- a/LUFA/Drivers/Board/Temperature.c
+++ b/LUFA/Drivers/Board/Temperature.c
@@ -45,7 +45,7 @@ static const uint16_t PROGMEM Temperature_Lookup[] = {
int8_t Temperature_GetTemperature(void)
{
- uint16_t Temp_ADC = ADC_GetChannelReading(ADC_REFERENCE_AVCC | ADC_RIGHT_ADJUSTED | TEMP_ADC_CHANNEL);
+ uint16_t Temp_ADC = ADC_GetChannelReading(ADC_REFERENCE_AVCC | ADC_RIGHT_ADJUSTED | TEMP_ADC_CHANNEL_MASK);
if (Temp_ADC > pgm_read_word(&Temperature_Lookup[0]))
return TEMP_MIN_TEMP;
diff --git a/LUFA/Drivers/Board/Temperature.h b/LUFA/Drivers/Board/Temperature.h
index f7f00342f..1b2baf2fb 100644
--- a/LUFA/Drivers/Board/Temperature.h
+++ b/LUFA/Drivers/Board/Temperature.h
@@ -79,13 +79,16 @@
/* Public Interface - May be used in end-application: */
/* Macros: */
/** ADC channel number for the temperature sensor. */
- #define TEMP_ADC_CHANNEL 0
+ #define TEMP_ADC_CHANNEL 0
+ /** ADC channel MUX mask for the temperature sensor. */
+ #define TEMP_ADC_CHANNEL_MASK ADC_CHANNEL0
+
/** Minimum returnable temperature from the \ref Temperature_GetTemperature() function. */
- #define TEMP_MIN_TEMP TEMP_TABLE_OFFSET
+ #define TEMP_MIN_TEMP TEMP_TABLE_OFFSET
/** Maximum returnable temperature from the \ref Temperature_GetTemperature() function. */
- #define TEMP_MAX_TEMP ((TEMP_TABLE_SIZE - 1) + TEMP_TABLE_OFFSET)
+ #define TEMP_MAX_TEMP ((TEMP_TABLE_SIZE - 1) + TEMP_TABLE_OFFSET)
/* Pseudo-Function Macros: */
#if defined(__DOXYGEN__)