Defines | Functions

adc_drv.h File Reference

This file contains the low level macros and definition for the ADC. More...

This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Defines

#define ADHSM   7
#define ADC_ADC1_ADC0_x200   0x0B
#define ADC_ADC1_ADC0_x10   0x09
#define ADC_ADC1_ADC0_x40   0x26
#define ADC_TEMP_SENSOR_CHANNEL   0x27
#define ADC_GND_CHANNEL   0x1F
#define ADC_BG_CHANNEL   0x1E
#define Enable_adc()   (ADCSRA |= (1<<ADEN))
#define Right_adjust_adc_result()   (ADMUX &= ~(1<<ADLAR))
#define Left_adjust_adc_result()   (ADMUX |= (1<<ADLAR))
#define Enable_adc_high_speed_mode()   (ADCSRB |= (1<<ADHSM))
#define Disable_adc_high_speed_mode()   (ADCSRB &= ~(1<<ADHSM))
#define Enable_internal_vref()   (ADMUX |= ((1<<REFS1)|(1<<REFS0)) )
#define Enable_external_vref()   (ADMUX &= ~((1<<REFS1)|(1<<REFS0)) )
#define Enable_vcc_vref()
#define Enable_all_it()   (SREG |= (0x80) )
#define Disable_all_it()   (SREG &= ~(0x80) )
#define Enable_adc_it()   (ADCSRA |= (1<<ADIE) )
#define Disable_adc_it()   (ADCSRA &= ~(1<<ADIE) )
#define Clear_adc_flag()   (ADCSRA |= (1<<ADIF) )
#define Set_adc_prescaler(prescaler)
#define MUX4_0_MSK   ((1<<MUX4)|(1<<MUX3)|(1<<MUX2)|(1<<MUX1)|(1<<MUX0))
#define Clear_adc_mux()   ADMUX &= ~(MUX4_0_MSK),(ADCSRB &= ~(1<<MUX5))
#define Select_adc_channel(channel)   (Clear_adc_mux(), ADCSRB |= (channel>>5)<<MUX5, ADMUX |= (channel&MUX4_0_MSK))
#define Start_conv()   (ADCSRA |= (1<<ADSC) )
#define Start_conv_channel(channel)   (Select_adc_channel(channel), Start_conv() )
#define Start_conv_idle()   (SMCR |= (1<<SM0)|(1<<SE) )
#define Start_conv_idle_channel(channel)   (Select_adc_channel(channel), Start_conv_idle() )
#define Clear_sleep_mode()   (SMCR &= ~(1<<SM0)|(1<<SE) )
#define Adc_get_8_bits_result()   ((U8)(ADCH))
#define Adc_get_10_bits_result()   ((U16)(ADCL+((U16)(ADCH<<8))))
#define Disable_adc()   (ADCSRA &= ~(1<<ADEN))
#define Is_adc_conv_finished()   ((ADCSRA & (1<<ADIF)) ? TRUE : FALSE)
#define Is_adc_conv_not_finished()   ((ADCSRA | ~(1<<ADIF)) ? TRUE : FALSE)

Functions

void init_adc (void)
 Configures the ADC accordingly to the ADC Define Configuration values.

Detailed Description

This file contains the low level macros and definition for the ADC.

Author:
Atmel Corporation: http://www.atmel.com
Support and FAQ: http://support.atmel.no/

Definition in file adc_drv.h.


Define Documentation

#define ADHSM   7

Definition at line 50 of file adc_drv.h.