Revision 891
Moved comments to headers. That was painful.
bom.h | ||
---|---|---|
39 | 39 |
#define _BOM_H |
40 | 40 |
|
41 | 41 |
/** |
42 |
* @addtogroup bom |
|
42 |
* @defgroup bom BOM (Bearing and Orientation Module) |
|
43 |
* @brief Functions for dealing with the BOM. |
|
44 |
* |
|
45 |
* The Bearing and Orientation Module / Barrel of Monkeys / BOM |
|
46 |
* is a custom sensor designed and built by the Colony Project. |
|
47 |
* It consists of a ring of 16 IR emitters and 16 IR detectors. |
|
48 |
* The BOM is most often use to determine the direction of other |
|
49 |
* robots. This module contains functions for controlling the BOM. |
|
50 |
* |
|
51 |
* Include bom.h to access these functions. |
|
52 |
* |
|
43 | 53 |
* @{ |
44 | 54 |
**/ |
45 | 55 |
|
... | ... | |
52 | 62 |
/** @brief RBOM - Range, Individual LED control **/ |
53 | 63 |
#define RBOM 2 |
54 | 64 |
|
55 |
/** @brief Initialize the bom according to bom type **/ |
|
65 |
/** |
|
66 |
* @brief Initialize the bom according to bom type |
|
67 |
* |
|
68 |
* Initializes the BOM. |
|
69 |
* Call bom_init before reading bom values or turning bom leds. |
|
70 |
* |
|
71 |
* @bugs INCOMPLETE - need to fill in init routine for BOM15 |
|
72 |
* |
|
73 |
* @see bom_refresh, bom_leds_on, bom_leds_off |
|
74 |
**/ |
|
56 | 75 |
void bom_init(char type); |
57 |
/** @brief Refresh bom_val[] with new values from analog8. analog_init and bom_init must be called for this to work. **/ |
|
76 |
|
|
77 |
/** |
|
78 |
* @brief Update the BOM readings. |
|
79 |
* |
|
80 |
* Refreshes the reading from the specified BOM LEDs. |
|
81 |
* |
|
82 |
* @param bit_field a bitfield specifying which LEDs to update. |
|
83 |
* Use BOM_ALL to refresh all values. For example, if 3 is passed, |
|
84 |
* LEDs 0 and 1 will be updated. |
|
85 |
* |
|
86 |
* @see bom_get |
|
87 |
**/ |
|
58 | 88 |
void bom_refresh(int bit_field); |
59 |
/** @brief Gets the bom reading from bom_val[which]. Call bom_refresh beforehand to read new bom values. **/ |
|
89 |
|
|
90 |
/** |
|
91 |
* @brief Gets the BOM reading for a specific LED. |
|
92 |
* |
|
93 |
* Gets the BOM reading for LED which. Call bom_refresh |
|
94 |
* beforehand to read new bom values. |
|
95 |
* |
|
96 |
* @param the LED value to return |
|
97 |
* @return the bom value |
|
98 |
* |
|
99 |
* @see bom_refresh |
|
100 |
**/ |
|
60 | 101 |
int bom_get(int which); |
61 |
/** @brief Compares all the values in bom_val[] and returns the index to the highest value element. **/ |
|
102 |
|
|
103 |
/** |
|
104 |
* @brief Return the BOM LED with the highest value. |
|
105 |
* |
|
106 |
* Returns the BOM LED with the highest reading, an integer in the range |
|
107 |
* 0 to 15. 0 is to the robot's right, and the rest are numbered counterclockwise. |
|
108 |
* |
|
109 |
* @return the LED with the highest value, or -1 if no value is lower than |
|
110 |
* BOM_VALUE_THRESHOLD |
|
111 |
**/ |
|
62 | 112 |
int bom_get_max(void); |
63 |
/** @brief Turns on the selected bom leds. Only works with BOM_ALL if using the original bom. **/ |
|
113 |
|
|
114 |
/** |
|
115 |
* @brief Turns on the selected bom leds. |
|
116 |
* |
|
117 |
* Iterates through each bit in the bit_field. For each set bit, turns on the corresponding bom led. |
|
118 |
* bom_init must be called for this to work. |
|
119 |
* With the original BOM, this only works if BOM_ALL is specified. |
|
120 |
* |
|
121 |
* @param bit_field specifies which leds should be turned on. Use BOM_ALL to turn on all bom leds. |
|
122 |
* Ex. if 0x0005 is passed, leds 0 and 2 will be turned on. |
|
123 |
**/ |
|
64 | 124 |
void bom_leds_on(int bit_field); |
65 |
/** @brief Turns off the selected bom leds. Only works with BOM_ALL if using the original bom. **/ |
|
125 |
|
|
126 |
/** |
|
127 |
* @brief Turns off the selected bom leds. Only works with BOM_ALL if using the original bom. |
|
128 |
* |
|
129 |
* Iterates through each bit in the bit_field. For each set bit, turns off the corresponding bom led. |
|
130 |
* bom_init must be called for this to work. Only works with BOM_ALL if using the original bom. |
|
131 |
* |
|
132 |
* @param bit_field specifies which leds should be turned off. Use BOM_ALL to turn off all bom leds. |
|
133 |
* Ex. if 0x000B is passed, leds 0 and 3 will be turned off. |
|
134 |
**/ |
|
66 | 135 |
void bom_leds_off(int bit_field); |
67 | 136 |
|
68 |
/** @brief (DEPRECATED) Wrapper function. See bom_refresh and bom_get_max **/ |
|
69 |
int get_max_bom(void); |
|
70 |
/** @brief (DEPRECATED) Wrapper function. See bom_leds_on. **/ |
|
137 |
/** |
|
138 |
* @brief Turns all BOM LEDs on. |
|
139 |
* |
|
140 |
* Turns on all BOM LEDs. Equivalent to bom_leds_on(BOM_ALL). |
|
141 |
* |
|
142 |
* @see bom_off |
|
143 |
**/ |
|
71 | 144 |
void bom_on(void); |
72 |
/** @brief (DEPRECATED) Wrapper function. See bom_leds_off. **/ |
|
145 |
|
|
146 |
/** |
|
147 |
* @brief Turns all BOM LEDs off. |
|
148 |
* |
|
149 |
* Turns off all BOM LEDs. Equivalent to bom_leds_off(BOM_ALL). |
|
150 |
* |
|
151 |
* @see bom_on |
|
152 |
**/ |
|
73 | 153 |
void bom_off(void); |
74 | 154 |
|
75 | 155 |
/** @} **/ |
Also available in: Unified diff