root / trunk / code / lib / include / libdragonfly / analog.h @ 7
History | View | Annotate | Download (1.77 KB)
1 | 7 | bcoltin | /**
|
---|---|---|---|
2 | *
|
||
3 | * @file analog.h
|
||
4 | * @brief Contains functions and definitions for using the ADC
|
||
5 | *
|
||
6 | * Contains definitions and function prototypes for using the
|
||
7 | * ADC to detect analog signals on pins AN0 - AN7.
|
||
8 | * AN6 and AN7 are used for the wheel and battery.
|
||
9 | |||
10 | * The pins labeled E6 and E7 are external interrupt pins and are not related
|
||
11 | * to analog.
|
||
12 | |||
13 | * @author Colony Project, CMU Robotics Club, based on firefly
|
||
14 | * code by Tom Lauwers
|
||
15 | */
|
||
16 | |||
17 | #ifndef _ANALOG_H
|
||
18 | #define _ANALOG_H
|
||
19 | |||
20 | /**
|
||
21 | * @addtogroup analog
|
||
22 | * @{
|
||
23 | **/
|
||
24 | |||
25 | /** @brief Analog port 0 **/
|
||
26 | #define AN0 0x00 |
||
27 | /** @brief Analog port 1 **/
|
||
28 | #define AN1 0x01 |
||
29 | /** @brief Analog port 2 **/
|
||
30 | #define AN2 0x02 |
||
31 | /** @brief Analog port 3 **/
|
||
32 | #define AN3 0x03 |
||
33 | /** @brief Analog port 4 **/
|
||
34 | #define AN4 0x04 |
||
35 | /** @brief Analog port 5 **/
|
||
36 | #define AN5 0x05 |
||
37 | /** @brief Analog port 6 **/
|
||
38 | #define AN6 0x06 |
||
39 | /** @brief Analog port 7 **/
|
||
40 | #define AN7 0x07 |
||
41 | /** @brief Analog port 8 **/
|
||
42 | #define AN8 0x08 |
||
43 | /** @brief Analog port 9 **/
|
||
44 | #define AN9 0x09 |
||
45 | /** @brief Analog port 10 **/
|
||
46 | #define AN10 0x0a |
||
47 | /** @brief Analog port 11 **/
|
||
48 | #define AN11 0x0b |
||
49 | /** @brief Analog port 12 **/
|
||
50 | #define AN12 0x0c |
||
51 | /** @brief Analog port 13 **/
|
||
52 | #define AN13 0x0d |
||
53 | /** @brief Analog port 14 **/
|
||
54 | #define AN14 0x0e |
||
55 | /** @brief Analog port 15 **/
|
||
56 | #define AN15 0x0f |
||
57 | |||
58 | /** @brief EXT_MUX analog port **/
|
||
59 | #define EXT_MUX AN7
|
||
60 | /** @brief Analog port for the wheel **/
|
||
61 | #define WHEEL_PORT AN10
|
||
62 | /** @brief Analog port for the battery voltage detector **/
|
||
63 | #define BATT_PORT AN11
|
||
64 | |||
65 | /** @brief Initialize analog ports. **/
|
||
66 | void analog_init(void); |
||
67 | /** @brief Read an 8-bit number from an analog port. **/
|
||
68 | unsigned int analog8(int which); |
||
69 | /** @brief Read a 10-bit number from an analog port. **/
|
||
70 | unsigned int analog10(int which); |
||
71 | /** @brief Read the position of the wheel. **/
|
||
72 | int wheel(void); |
||
73 | |||
74 | /**@}**/ //end group |
||
75 | |||
76 | #endif |