Fix incorrect ADC driver documentation for the parameters of ADC_Init(), fix incorrect call to ADC_Init() in the TemperatureDatalogger project.

pull/1469/head
Dean Camera 14 years ago
parent 1afe51faa1
commit 009eebf229

@ -31,7 +31,8 @@
/** \file
* \brief ADC peripheral driver for the U7, U6 and U4 USB AVRs.
*
* ADC driver for the AT90USB1287, AT90USB1286, AT90USB647, AT90USB646, ATMEGA16U4 and ATMEGA32U4 AVRs.
* On-chip Analogue-to-Digital converter (ADC) driver for supported U4, U6 and U7 model AVRs that contain an ADC
* peripheral internally.
*
* \note This file should not be included directly. It is automatically included as needed by the ADC driver
* dispatch header located in LUFA/Drivers/Peripheral/ADC.h.
@ -40,7 +41,8 @@
/** \ingroup Group_ADC
* @defgroup Group_ADC_AVRU4U6U7 Series U4, U6 and U7 Model ADC Driver
*
* ADC driver for the AT90USB1287, AT90USB1286, AT90USB647, AT90USB646, ATMEGA16U4 and ATMEGA32U4 AVRs.
* On-chip Analogue-to-Digital converter (ADC) driver for supported U4, U6 and U7 model AVRs that contain an ADC
* peripheral internally.
*
* \note This file should not be included directly. It is automatically included as needed by the ADC driver
* dispatch header located in LUFA/Drivers/Peripheral/ADC.h.
@ -208,35 +210,35 @@
*
* \note The channel number must be specified as an integer, and NOT a ADC_CHANNELx mask.
*
* \param[in] Channel ADC channel number to set up for conversions.
* \param[in] ChannelIndex ADC channel number to set up for conversions.
*/
static inline void ADC_SetupChannel(const uint8_t Channel)
static inline void ADC_SetupChannel(const uint8_t ChannelIndex)
{
#if (defined(__AVR_AT90USB1286__) || defined(__AVR_AT90USB646__) || \
defined(__AVR_AT90USB1287__) || defined(__AVR_AT90USB647__) || \
defined(__AVR_ATmega32U6__))
DDRF &= ~(1 << Channel);
DIDR0 |= (1 << Channel);
DDRF &= ~(1 << ChannelIndex);
DIDR0 |= (1 << ChannelIndex);
#elif (defined(__AVR_ATmega16U4__) || defined(__AVR_ATmega32U4__))
if (Channel < 8)
if (ChannelIndex < 8)
{
DDRF &= ~(1 << Channel);
DIDR0 |= (1 << Channel);
DDRF &= ~(1 << ChannelIndex);
DIDR0 |= (1 << ChannelIndex);
}
else if (Channel == 8)
else if (ChannelIndex == 8)
{
DDRD &= ~(1 << 4);
DIDR2 |= (1 << 0);
}
else if (Channel < 11)
else if (ChannelIndex < 11)
{
DDRD &= ~(1 << (Channel - 3));
DIDR2 |= (1 << (Channel - 8));
DDRD &= ~(1 << (ChannelIndex - 3));
DIDR2 |= (1 << (ChannelIndex - 8));
}
else
{
DDRB &= ~(1 << (Channel - 7));
DIDR2 |= (1 << (Channel - 8));
DDRB &= ~(1 << (ChannelIndex - 7));
DIDR2 |= (1 << (ChannelIndex - 8));
}
#endif
}
@ -251,35 +253,35 @@
*
* \note The channel number must be specified as an integer, and NOT a ADC_CHANNELx mask.
*
* \param[in] Channel ADC channel number to set up for conversions.
* \param[in] ChannelIndex ADC channel number to set up for conversions.
*/
static inline void ADC_DisableChannel(const uint8_t Channel)
static inline void ADC_DisableChannel(const uint8_t ChannelIndex)
{
#if (defined(__AVR_AT90USB1286__) || defined(__AVR_AT90USB646__) || \
defined(__AVR_AT90USB1287__) || defined(__AVR_AT90USB647__) || \
defined(__AVR_ATmega32U6__))
DDRF &= ~(1 << Channel);
DIDR0 &= ~(1 << Channel);
DDRF &= ~(1 << ChannelIndex);
DIDR0 &= ~(1 << ChannelIndex);
#elif (defined(__AVR_ATmega16U4__) || defined(__AVR_ATmega32U4__))
if (Channel < 8)
if (ChannelIndex < 8)
{
DDRF &= ~(1 << Channel);
DIDR0 &= ~(1 << Channel);
DDRF &= ~(1 << ChannelIndex);
DIDR0 &= ~(1 << ChannelIndex);
}
else if (Channel == 8)
else if (ChannelIndex == 8)
{
DDRD &= ~(1 << 4);
DIDR2 &= ~(1 << 0);
}
else if (Channel < 11)
else if (ChannelIndex < 11)
{
DDRD &= ~(1 << (Channel - 3));
DIDR2 &= ~(1 << (Channel - 8));
DDRD &= ~(1 << (ChannelIndex - 3));
DIDR2 &= ~(1 << (ChannelIndex - 8));
}
else
{
DDRB &= ~(1 << (Channel - 7));
DIDR2 &= ~(1 << (Channel - 8));
DDRB &= ~(1 << (ChannelIndex - 7));
DIDR2 &= ~(1 << (ChannelIndex - 8));
}
#endif
}
@ -292,7 +294,7 @@
* conversions. If the ADC is in single conversion mode (or the channel to convert from is to be changed),
* this function must be called each time a conversion is to take place.
*
* \param[in] MUXMask Mask comprising of an ADC channel mask, reference mask and adjustment mask.
* \param[in] MUXMask ADC channel mask, reference mask and adjustment mask.
*/
static inline void ADC_StartReading(const uint16_t MUXMask)
{
@ -354,7 +356,7 @@
* The "mode" parameter should be a mask comprised of a conversion mode (free running or single) and
* prescaler masks.
*
* \param[in] Mode Mask of ADC settings, including adjustment, prescale, mode and reference.
* \param[in] Mode Mask of ADC prescale and mode settings.
*/
static inline void ADC_Init(uint8_t Mode) ATTR_ALWAYS_INLINE;
static inline void ADC_Init(uint8_t Mode)

@ -49,6 +49,7 @@
* - Ghetto Drum, a MIDI drum controller: http://noisybox.net/art/gdrum/
* - IR Remote to Keyboard decoder: http://netzhansa.blogspot.com/2010/04/our-living-room-hi-fi-setup-needs-mp3.html
* - LED Panel controller: http://projects.peterpolidoro.net/caltech/panelscontroller/panelscontroller.htm
* - Single LED Matrix Display: http://guysoft.wordpress.com/2009/10/08/bumble-b/
* - Linux Secure Storage Dongle: http://github.com/TomMD/teensy
* - MakeTV Episode Dispenser: http://www.youtube.com/watch?v=BkWUi18hl3g
* - MidiMonster, a USB-to-MIDI gateway board: http://www.dorkbotpdx.org/wiki/midimonster
@ -61,6 +62,7 @@
* - SD Card reader: http://elasticsheep.com/2010/04/teensy2-usb-mass-storage-with-an-sd-card/
* - SEGA Megadrive/Genesis Development Cartridge: http://www.makestuff.eu/wordpress/?page_id=398
* - Stripe Snoop, a Magnetic Card reader: http://www.ossguy.com/ss_usb/
* - Teensy SD Card .WAV file player: http://elasticsheep.com/2010/04/teensy2-usb-wav-player-part-1/
* - Touchscreen Input Device: http://capnstech.blogspot.com/2010/07/touchscreen-update.html
* - USB Interface for Playstation Portable Devices: http://forums.ps2dev.org/viewtopic.php?t=11001
* - Userial, a USB to Serial converter with SPI, I2C and other protocols: http://www.tty1.net/userial/

@ -57,7 +57,7 @@ void V2Protocol_Init(void)
/* Initialize the ADC converter for VTARGET level detection on supported AVR models */
ADC_Init(ADC_FREE_RUNNING | ADC_PRESCALE_128);
ADC_SetupChannel(VTARGET_ADC_CHANNEL);
ADC_StartReading(VTARGET_ADC_CHANNEL_MASK | ADC_RIGHT_ADJUSTED | ADC_REFERENCE_AVCC);
ADC_StartReading(ADC_REFERENCE_AVCC | ADC_RIGHT_ADJUSTED | VTARGET_ADC_CHANNEL_MASK);
#endif
/* Timeout timer initialization (10ms period) */

@ -201,7 +201,7 @@ void SetupHardware(void)
/* Hardware Initialization */
LEDs_Init();
SPI_Init(SPI_SPEED_FCPU_DIV_2 | SPI_SCK_LEAD_FALLING | SPI_SAMPLE_TRAILING | SPI_MODE_MASTER);
ADC_Init(ADC_REFERENCE_AVCC | ADC_FREE_RUNNING | ADC_PRESCALE_128);
ADC_Init(ADC_FREE_RUNNING | ADC_PRESCALE_128);
Temperature_Init();
Dataflash_Init();
USB_Init();

Loading…
Cancel
Save