/*
Diplomova prace : Palubni pocitac

adc.h

Atmega128A 10 MHz XTAL

Autor: Ondrej Lutera

2011/2012

*/

#ifndef ADC_H_INCLUDED
#define ADC_H_INCLUDED

#include <avr/io.h>

#define INT_REF (1<<REFS1)|(1<<REFS0)
#define REF_VOLT 2560 //mV

#define CH1 0x00
#define CH2 0x01
#define CH3 0x02
#define CH4 0x03

#define NO_CH 0xFF
#define AD_BUSY 0xF0

void initAD(void);  /* inicializace AD vstupu */

uint8_t StartAD(uint8_t chan);      /* odstartuje prevod definovany kanalem chan */

#define BAD_CH 0xF000

uint16_t ReadAD(uint8_t chan);      /* vraci vysledek konverze kanalu chan */


#endif // ADC_H_INCLUDED
