Project

General

Profile

Revision 324

Added by Kevin Woo almost 14 years ago

Commented analog.c and analog.h.

Brian forgot to update bom.c and rangefinder.c to use analog_get8 and
analog8 respecitively when he swapped the function names in analog.c.
This has been fixed. Code not tested or compiled but should be ok.

View differences:

analog.h
29 29
 * @brief Contains functions and definitions for using the ADC
30 30
 * 
31 31
 * Contains definitions and function prototypes for using the
32
 * ADC to detect analog signals on pins AN0 - AN7.
33
 * AN6 and AN7 are used for the wheel and battery.
34
	
35
 * The pins labeled E6 and E7 are external interrupt pins and are not related 
36
 * to analog.
37
	
32
 * ADC to detect analog signals on pins AN0 - AN15.
33
 * See analog.c for implementation details.
34
 *
38 35
 * @author Colony Project, CMU Robotics Club, based on firefly
39 36
 * code by Tom Lauwers
40
*/
37
 **/
41 38

  
42 39
#ifndef _ANALOG_H
43 40
#define _ANALOG_H
......
91 88
/** @brief Analog port for the battery voltage detector **/
92 89
#define BATT_PORT  AN11
93 90

  
91
/** @brief Used in analog_init to start the analog loop from the get-go **/
94 92
#define ADC_START 1
93
/** @brief Used in analog_init to not start the analog loop from the get-go **/
95 94
#define ADC_STOP 0
96

  
95
/** @brief Maximum number of analog ports to check. This number is equivalent to
96
  *     AN1 -> AN11 as AN0 and AN7 are skipped. **/
97
#define ANMAX 11
98
/** @brief For use with ADMUX register. Means that We will use AVCC (REFS0) and
99
 *      enable ADLAR. **/
97 100
#define ADMUX_OPT 0x60
98 101

  
99 102

  
......
104 107
void analog_start_loop(void);
105 108
/** @brief Stops the analog loop. Doesn't do anything if the loop is already stopped. **/
106 109
void analog_stop_loop(void);
107
/** @brief Read an 8-bit number from an analog port. Loop must be stopped for this to work. **/
110
/** @brief Returns an 8-bit analog value from the look up table. Use this instead of analog8. **/
108 111
unsigned int analog8(int which);
109
/** @brief Read a 10-bit number from an analog port. Loop must be stopped for this to work. **/
112
/** @brief Returns an 10-bit analog value from the look up table. Use this instead of analog10. **/
110 113
unsigned int analog10(int which);
111 114
/** @brief Read the position of the wheel. **/
112 115
int wheel(void);
113
/** @brief Returns an 8-bit analog value from the look up table. Use this instead of analog8. **/
116
/** @brief Read an 8-bit number from an analog port. Loop must be stopped for this to work. **/
114 117
unsigned int analog_get8(int which);
115
/** @brief Returns an 10-bit analog value from the look up table. Use this instead of analog10. **/
118
/** @brief Read a 10-bit number from an analog port. Loop must be stopped for this to work. **/
116 119
unsigned int analog_get10(int which);
117 120

  
118 121

  

Also available in: Unified diff