forked from Traumflug/Teacup_Firmware
-
Notifications
You must be signed in to change notification settings - Fork 0
/
analog.h
32 lines (25 loc) · 891 Bytes
/
analog.h
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
#ifndef _ANALOG_H
#define _ANALOG_H
#include <stdint.h>
#define REFERENCE_AREF 0
#define REFERENCE_AVCC 64
#if defined (__AVR_ATmega168__) || defined (__AVR_ATmega328__) || defined (__AVR_ATmega328P__)
#define REFERENCE_1V1 192
#elif defined (__AVR_ATmega_644__) || defined (__AVR_ATmega644p__)
#define REFERENCE_1V1 128
#define REFERENCE_2V56 192
#endif
#include "config.h"
#ifndef REFERENCE
#warning define REFERENCE as one of
#if defined (__AVR_ATmega168__) || defined (__AVR_ATmega328__) || defined (__AVR_ATmega328P__)
#warning REFERENCE_AREF, REFERENCE_AVCC or REFERENCE_1V1
#elif defined (__AVR_ATmega_644__) || defined (__AVR_ATmega644p__)
#warning REFERENCE_AREF, REFERENCE_AVCC, REFERENCE_1V1 or REFERENCE_2V56
#endif
#warning in your config.h
#error REFERENCE undefined
#endif
void analog_init(void);
uint16_t analog_read(uint8_t channel);
#endif /* _ANALOG_H */