00001 #ifndef _ANALOG_H
00002 #define _ANALOG_H
00003
00004 #include <stdint.h>
00005
00006 #define REFERENCE_AREF 0
00007 #define REFERENCE_AVCC 64
00008 #if defined (__AVR_ATmega168__) || defined (__AVR_ATmega328__) || defined (__AVR_ATmega328P__)
00009 #define REFERENCE_1V1 192
00010 #elif defined (__AVR_ATmega_644__) || defined (__AVR_ATmega644p__)
00011 #define REFERENCE_1V1 128
00012 #define REFERENCE_2V56 192
00013 #endif
00014
00015 #include "config.h"
00016
00017 #ifndef REFERENCE
00018 #warning define REFERENCE as one of
00019 #if defined (__AVR_ATmega168__) || defined (__AVR_ATmega328__) || defined (__AVR_ATmega328P__)
00020 #warning REFERENCE_AREF, REFERENCE_AVCC or REFERENCE_1V1
00021 #elif defined (__AVR_ATmega_644__) || defined (__AVR_ATmega644p__)
00022 #warning REFERENCE_AREF, REFERENCE_AVCC, REFERENCE_1V1 or REFERENCE_2V56
00023 #endif
00024 #warning in your config.h
00025 #error REFERENCE undefined
00026 #endif
00027
00028 void analog_init(void);
00029
00030 uint16_t analog_read(uint8_t channel);
00031
00032 #endif