hw_adc.h

Go to the documentation of this file.
00001 
00042 #ifndef HW_ADC_H
00043 #define HW_ADC_H
00044 
00045 #include <avr/io.h>
00046 
00047 #define START_CONVERTION (ADCSRA |= BV(ADSC))
00048 #define ENABLE_ADC (ADCSRA |= BV(ADEN))
00049 #define SET_AI_ADLAR (ADMUX &= ~BV(ADLAR))
00050 
00052 #define STABILIZING_AI_CHANNEL_TIME 125
00053 
00055 #define ADC_CHANNEL_NUM 4
00056 
00057 void adc_set_active_ain(int ai);
00058 void adc_init(void);
00059 void adc_set_vref_avcc(void);
00060 int adc_read_ai_channel(int channel);
00061 
00062 #endif // HW_ADC_H
00063