diff options
author | Dean Camera <dean@fourwalledcubicle.com> | 2009-06-22 10:23:47 +0000 |
---|---|---|
committer | Dean Camera <dean@fourwalledcubicle.com> | 2009-06-22 10:23:47 +0000 |
commit | 7d7573e4e554f4b17686a915eba0da12fbebc2ed (patch) | |
tree | db06292821cc9e9f1f99ddb163fca7902a3e80b6 /LUFA/Drivers | |
parent | a34cccf09931a54a607a56d4ded88f3b7a4752b4 (diff) | |
download | lufa-7d7573e4e554f4b17686a915eba0da12fbebc2ed.tar.gz lufa-7d7573e4e554f4b17686a915eba0da12fbebc2ed.tar.bz2 lufa-7d7573e4e554f4b17686a915eba0da12fbebc2ed.zip |
Corrected the ADC driver for the ATMEGA16U4 and ATMEGA32U4 (thanks to Opendous Inc.).
Diffstat (limited to 'LUFA/Drivers')
-rw-r--r-- | LUFA/Drivers/Peripheral/AT90USBXXX67/ADC.h | 25 | ||||
-rw-r--r-- | LUFA/Drivers/USB/LowLevel/DevChapter9.h | 2 |
2 files changed, 25 insertions, 2 deletions
diff --git a/LUFA/Drivers/Peripheral/AT90USBXXX67/ADC.h b/LUFA/Drivers/Peripheral/AT90USBXXX67/ADC.h index 358629c70..4cc7c32c3 100644 --- a/LUFA/Drivers/Peripheral/AT90USBXXX67/ADC.h +++ b/LUFA/Drivers/Peripheral/AT90USBXXX67/ADC.h @@ -163,8 +163,33 @@ */
static inline void ADC_SetupChannel(const uint8_t Channel)
{
+ #if (defined(__AVR_AT90USB1286__) || defined(__AVR_AT90USB646__) || \
+ defined(__AVR_AT90USB1287__) || defined(__AVR_AT90USB647__) || \
+ defined(__AVR_ATmega32U6__))
DDRF &= ~(1 << Channel);
DIDR0 |= (1 << Channel);
+ #elif (defined(__AVR_ATmega16U4__) || defined(__AVR_ATmega32U4__))
+ if (Channel < 8)
+ {
+ DDRF &= ~(1 << Channel);
+ DIDR0 |= (1 << Channel);
+ }
+ else if (Channel == 8)
+ {
+ DDRD &= ~(1 << 4);
+ DIDR2 |= (1 << 0);
+ }
+ else if (Channel < 11)
+ {
+ DDRD &= ~(1 << (Channel - 3));
+ DIDR2 |= (1 << (Channel - 8));
+ }
+ else
+ {
+ DDRB &= ~(1 << (Channel - 7));
+ DIDR2 |= (1 << (Channel - 8));
+ }
+ #endif
}
/** Starts the reading of the given channel, but does not wait until the conversion has completed.
diff --git a/LUFA/Drivers/USB/LowLevel/DevChapter9.h b/LUFA/Drivers/USB/LowLevel/DevChapter9.h index 505256e68..fdef72757 100644 --- a/LUFA/Drivers/USB/LowLevel/DevChapter9.h +++ b/LUFA/Drivers/USB/LowLevel/DevChapter9.h @@ -36,8 +36,6 @@ #include <avr/pgmspace.h>
#include <avr/eeprom.h>
#include <avr/boot.h>
- #include <stdlib.h>
- #include <ctype.h>
#include "../HighLevel/StdDescriptors.h"
#include "../HighLevel/Events.h"
|