LUFA Library
ADC_AVR8.h File Reference

ADC Peripheral Driver (AVR8) More...

Macros

ADC Reference Configuration Masks
#define ADC_REFERENCE_AREF   0
 
#define ADC_REFERENCE_AVCC   (1 << REFS0)
 
#define ADC_REFERENCE_INT2560MV   ((1 << REFS1) | (1 << REFS0))
 
ADC Result Adjustment Configuration Masks
#define ADC_LEFT_ADJUSTED   (1 << ADLAR)
 
#define ADC_RIGHT_ADJUSTED   (0 << ADLAR)
 
ADC Mode Configuration Masks
#define ADC_FREE_RUNNING   (1 << ADATE)
 
#define ADC_SINGLE_CONVERSION   (0 << ADATE)
 
ADC Prescaler Configuration Masks
#define ADC_PRESCALE_2   (1 << ADPS0)
 
#define ADC_PRESCALE_4   (1 << ADPS1)
 
#define ADC_PRESCALE_8   ((1 << ADPS0) | (1 << ADPS1))
 
#define ADC_PRESCALE_16   (1 << ADPS2)
 
#define ADC_PRESCALE_32   ((1 << ADPS2) | (1 << ADPS0))
 
#define ADC_PRESCALE_64   ((1 << ADPS2) | (1 << ADPS1))
 
#define ADC_PRESCALE_128   ((1 << ADPS2) | (1 << ADPS1) | (1 << ADPS0))
 
ADC MUX Masks
#define ADC_CHANNEL0   (0x00 << MUX0)
 
#define ADC_CHANNEL1   (0x01 << MUX0)
 
#define ADC_CHANNEL2   (0x02 << MUX0)
 
#define ADC_CHANNEL3   (0x03 << MUX0)
 
#define ADC_CHANNEL4   (0x04 << MUX0)
 
#define ADC_CHANNEL5   (0x05 << MUX0)
 
#define ADC_CHANNEL6   (0x06 << MUX0)
 
#define ADC_CHANNEL7   (0x07 << MUX0)
 
#define ADC_CHANNEL8   ((1 << 8) | (0x00 << MUX0))
 
#define ADC_CHANNEL9   ((1 << 8) | (0x01 << MUX0))
 
#define ADC_CHANNEL10   ((1 << 8) | (0x02 << MUX0))
 
#define ADC_CHANNEL11   ((1 << 8) | (0x03 << MUX0))
 
#define ADC_CHANNEL12   ((1 << 8) | (0x04 << MUX0))
 
#define ADC_CHANNEL13   ((1 << 8) | (0x05 << MUX0))
 
#define ADC_INT_TEMP_SENS   ((1 << 8) | (0x07 << MUX0))
 
#define ADC_1100MV_BANDGAP   (0x1E << MUX0)
 
#define ADC_GET_CHANNEL_MASK(Channel)   CONCAT_EXPANDED(ADC_CHANNEL, Channel)
 

Functions

static void ADC_Disable (void) ATTR_ALWAYS_INLINE
 
static void ADC_DisableChannel (const uint8_t ChannelIndex)
 
static uint16_t ADC_GetChannelReading (const uint16_t MUXMask) ATTR_WARN_UNUSED_RESULT
 
static uint16_t ADC_GetResult (void) ATTR_WARN_UNUSED_RESULT ATTR_ALWAYS_INLINE
 
static bool ADC_GetStatus (void) ATTR_WARN_UNUSED_RESULT ATTR_ALWAYS_INLINE
 
static void ADC_Init (const uint8_t Mode) ATTR_ALWAYS_INLINE
 
static bool ADC_IsReadingComplete (void) ATTR_WARN_UNUSED_RESULT ATTR_ALWAYS_INLINE
 
static void ADC_SetupChannel (const uint8_t ChannelIndex)
 
static void ADC_StartReading (const uint16_t MUXMask)
 

Detailed Description

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.