Project

General

Profile

Revision 497

Added by Kevin Woo about 16 years ago

Updated the documentation for libdragonfly.

View differences:

group__bom.html
9 9
  <ul>
10 10
    <li><a href="index.html"><span>Main&nbsp;Page</span></a></li>
11 11
    <li><a href="modules.html"><span>Modules</span></a></li>
12
    <li><a href="annotated.html"><span>Data&nbsp;Structures</span></a></li>
12 13
    <li><a href="files.html"><span>Files</span></a></li>
13 14
    <li><a href="pages.html"><span>Related&nbsp;Pages</span></a></li>
14 15
  </ul>
......
16 17
<h1>BOM (Bearing and Orientation Module)</h1>Functions for dealing with the BOM.  
17 18
<a href="#_details">More...</a><table border="0" cellpadding="0" cellspacing="0">
18 19
<tr><td></td></tr>
20
<tr><td colspan="2"><br><h2>Defines</h2></td></tr>
21
<tr><td class="memItemLeft" nowrap align="right" valign="top"><a class="anchor" name="g3f1e6fc7eeb6d7cffde8bb03ff8dc488"></a><!-- doxytag: member="bom::BOM_ALL" ref="g3f1e6fc7eeb6d7cffde8bb03ff8dc488" args="" -->
22
#define&nbsp;</td><td class="memItemRight" valign="bottom"><a class="el" href="group__bom.html#g3f1e6fc7eeb6d7cffde8bb03ff8dc488">BOM_ALL</a>&nbsp;&nbsp;&nbsp;0xFFFF</td></tr>
23

  
24
<tr><td class="mdescLeft">&nbsp;</td><td class="mdescRight">Include all elements in the 16-bit bitfield. <br></td></tr>
25
<tr><td class="memItemLeft" nowrap align="right" valign="top"><a class="anchor" name="gd555cfe7a1fcf16c3639f797120478eb"></a><!-- doxytag: member="bom::BOM" ref="gd555cfe7a1fcf16c3639f797120478eb" args="" -->
26
#define&nbsp;</td><td class="memItemRight" valign="bottom"><a class="el" href="group__bom.html#gd555cfe7a1fcf16c3639f797120478eb">BOM</a>&nbsp;&nbsp;&nbsp;0</td></tr>
27

  
28
<tr><td class="mdescLeft">&nbsp;</td><td class="mdescRight">Original BOM - No Range, No Individual LED control. <br></td></tr>
29
<tr><td class="memItemLeft" nowrap align="right" valign="top"><a class="anchor" name="g8c5367cf01a2a7ede66be0f2a49b28d0"></a><!-- doxytag: member="bom::BOM15" ref="g8c5367cf01a2a7ede66be0f2a49b28d0" args="" -->
30
#define&nbsp;</td><td class="memItemRight" valign="bottom"><a class="el" href="group__bom.html#g8c5367cf01a2a7ede66be0f2a49b28d0">BOM15</a>&nbsp;&nbsp;&nbsp;1</td></tr>
31

  
32
<tr><td class="mdescLeft">&nbsp;</td><td class="mdescRight">BOM 1.5 - No Range, Individual LED control. <br></td></tr>
33
<tr><td class="memItemLeft" nowrap align="right" valign="top"><a class="anchor" name="g1ff400a0e77d2266138b080061f49d01"></a><!-- doxytag: member="bom::RBOM" ref="g1ff400a0e77d2266138b080061f49d01" args="" -->
34
#define&nbsp;</td><td class="memItemRight" valign="bottom"><a class="el" href="group__bom.html#g1ff400a0e77d2266138b080061f49d01">RBOM</a>&nbsp;&nbsp;&nbsp;2</td></tr>
35

  
36
<tr><td class="mdescLeft">&nbsp;</td><td class="mdescRight">RBOM - Range, Individual LED control. <br></td></tr>
19 37
<tr><td colspan="2"><br><h2>Functions</h2></td></tr>
38
<tr><td class="memItemLeft" nowrap align="right" valign="top">void&nbsp;</td><td class="memItemRight" valign="bottom"><a class="el" href="group__bom.html#g101f932380b02b48a0ca3d20ffc8c08f">bom_init</a> (char type)</td></tr>
39

  
40
<tr><td class="mdescLeft">&nbsp;</td><td class="mdescRight">Initialize the bom according to bom type.  <a href="#g101f932380b02b48a0ca3d20ffc8c08f"></a><br></td></tr>
41
<tr><td class="memItemLeft" nowrap align="right" valign="top">void&nbsp;</td><td class="memItemRight" valign="bottom"><a class="el" href="group__bom.html#gbdcdf3a1428f8145ee5eed82efdaf0fc">bom_refresh</a> (int bit_field)</td></tr>
42

  
43
<tr><td class="mdescLeft">&nbsp;</td><td class="mdescRight">Refresh bom_val[] with new values from analog8. analog_init and bom_init must be called for this to work.  <a href="#gbdcdf3a1428f8145ee5eed82efdaf0fc"></a><br></td></tr>
44
<tr><td class="memItemLeft" nowrap align="right" valign="top">int&nbsp;</td><td class="memItemRight" valign="bottom"><a class="el" href="group__bom.html#gd28d2a59a5090390e20f87cfd05b0a8b">bom_get</a> (int which)</td></tr>
45

  
46
<tr><td class="mdescLeft">&nbsp;</td><td class="mdescRight">Gets the bom reading from bom_val[which]. Call bom_refresh beforehand to read new bom values.  <a href="#gd28d2a59a5090390e20f87cfd05b0a8b"></a><br></td></tr>
47
<tr><td class="memItemLeft" nowrap align="right" valign="top">int&nbsp;</td><td class="memItemRight" valign="bottom"><a class="el" href="group__bom.html#gbce8d8dd8f11d8f5e9f9d74d84ea15db">bom_get_max</a> (void)</td></tr>
48

  
49
<tr><td class="mdescLeft">&nbsp;</td><td class="mdescRight">Compares all the values in bom_val[] and returns the index to the highest value element.  <a href="#gbce8d8dd8f11d8f5e9f9d74d84ea15db"></a><br></td></tr>
50
<tr><td class="memItemLeft" nowrap align="right" valign="top">void&nbsp;</td><td class="memItemRight" valign="bottom"><a class="el" href="group__bom.html#g2f5fae400bcc24d266c84ca441a1516c">bom_leds_on</a> (int bit_field)</td></tr>
51

  
52
<tr><td class="mdescLeft">&nbsp;</td><td class="mdescRight">Turns on the selected bom leds. Only works with BOM_ALL if using the original bom.  <a href="#g2f5fae400bcc24d266c84ca441a1516c"></a><br></td></tr>
53
<tr><td class="memItemLeft" nowrap align="right" valign="top">void&nbsp;</td><td class="memItemRight" valign="bottom"><a class="el" href="group__bom.html#gf3fb24ce85166158df75f7d5f391f3ad">bom_leds_off</a> (int bit_field)</td></tr>
54

  
55
<tr><td class="mdescLeft">&nbsp;</td><td class="mdescRight">Turns off the selected bom leds. Only works with BOM_ALL if using the original bom.  <a href="#gf3fb24ce85166158df75f7d5f391f3ad"></a><br></td></tr>
20 56
<tr><td class="memItemLeft" nowrap align="right" valign="top">int&nbsp;</td><td class="memItemRight" valign="bottom"><a class="el" href="group__bom.html#g86753fe7440cd64e60c58ad31c62264a">get_max_bom</a> (void)</td></tr>
21 57

  
22
<tr><td class="mdescLeft">&nbsp;</td><td class="mdescRight">Returns the location of the maximum BOM reading.  <a href="#g86753fe7440cd64e60c58ad31c62264a"></a><br></td></tr>
58
<tr><td class="mdescLeft">&nbsp;</td><td class="mdescRight">(DEPRECATED) Gets and compares all bom values. Returns the index to the highest value element.  <a href="#g86753fe7440cd64e60c58ad31c62264a"></a><br></td></tr>
23 59
<tr><td class="memItemLeft" nowrap align="right" valign="top">void&nbsp;</td><td class="memItemRight" valign="bottom"><a class="el" href="group__bom.html#g93b665ff81fc6b58503c6ba5ba01c1bf">bom_on</a> (void)</td></tr>
24 60

  
25
<tr><td class="mdescLeft">&nbsp;</td><td class="mdescRight">Turns the BOM on.  <a href="#g93b665ff81fc6b58503c6ba5ba01c1bf"></a><br></td></tr>
61
<tr><td class="mdescLeft">&nbsp;</td><td class="mdescRight">(DEPRECATED) Turns on all bom leds.  <a href="#g93b665ff81fc6b58503c6ba5ba01c1bf"></a><br></td></tr>
26 62
<tr><td class="memItemLeft" nowrap align="right" valign="top">void&nbsp;</td><td class="memItemRight" valign="bottom"><a class="el" href="group__bom.html#g61a66e53cdee8bce139c707153143b30">bom_off</a> (void)</td></tr>
27 63

  
28
<tr><td class="mdescLeft">&nbsp;</td><td class="mdescRight">Turns the BOM off.  <a href="#g61a66e53cdee8bce139c707153143b30"></a><br></td></tr>
64
<tr><td class="mdescLeft">&nbsp;</td><td class="mdescRight">(DEPRECATED) Turns off all bom leds.  <a href="#g61a66e53cdee8bce139c707153143b30"></a><br></td></tr>
29 65
</table>
30 66
<hr><a name="_details"></a><h2>Detailed Description</h2>
31 67
Functions for dealing with the BOM. 
32 68
<p>
33 69
The Bearing and Orientation Module / Barrel of Monkeys / BOM is a custom sensor designed and built by the Colony Project. It consists of a ring of 16 IR emitters and 16 IR detectors. The BOM is most often use to determine the direction of other robots. This module contains functions for controlling the BOM.<p>
34 70
Include <a class="el" href="bom_8h.html" title="Definitions for using the BOM.">bom.h</a> to access these functions. <hr><h2>Function Documentation</h2>
71
<a class="anchor" name="gd28d2a59a5090390e20f87cfd05b0a8b"></a><!-- doxytag: member="bom.c::bom_get" ref="gd28d2a59a5090390e20f87cfd05b0a8b" args="(int which)" -->
72
<div class="memitem">
73
<div class="memproto">
74
      <table class="memname">
75
        <tr>
76
          <td class="memname">int bom_get           </td>
77
          <td>(</td>
78
          <td class="paramtype">int&nbsp;</td>
79
          <td class="paramname"> <em>which</em>          </td>
80
          <td>&nbsp;)&nbsp;</td>
81
          <td width="100%"></td>
82
        </tr>
83
      </table>
84
</div>
85
<div class="memdoc">
86

  
87
<p>
88
Gets the bom reading from bom_val[which]. Call bom_refresh beforehand to read new bom values. 
89
<p>
90
Gets the bom reading from bom_val[which]. Call bom_refresh beforehand to read new bom values.<p>
91
<dl compact><dt><b>Parameters:</b></dt><dd>
92
  <table border="0" cellspacing="2" cellpadding="0">
93
    <tr><td valign="top"></td><td valign="top"><em>which</em>&nbsp;</td><td>which bom value to return</td></tr>
94
  </table>
95
</dl>
96
<dl class="return" compact><dt><b>Returns:</b></dt><dd>the bom value</dd></dl>
97
see bom_refresh 
98
</div>
99
</div><p>
100
<a class="anchor" name="gbce8d8dd8f11d8f5e9f9d74d84ea15db"></a><!-- doxytag: member="bom.c::bom_get_max" ref="gbce8d8dd8f11d8f5e9f9d74d84ea15db" args="(void)" -->
101
<div class="memitem">
102
<div class="memproto">
103
      <table class="memname">
104
        <tr>
105
          <td class="memname">int bom_get_max           </td>
106
          <td>(</td>
107
          <td class="paramtype">void&nbsp;</td>
108
          <td class="paramname">          </td>
109
          <td>&nbsp;)&nbsp;</td>
110
          <td width="100%"></td>
111
        </tr>
112
      </table>
113
</div>
114
<div class="memdoc">
115

  
116
<p>
117
Compares all the values in bom_val[] and returns the index to the highest value element. 
118
<p>
119
Compares all the values in bom_val[] and returns the index to the lowest (max) value element.<p>
120
<dl class="return" compact><dt><b>Returns:</b></dt><dd>index to the lowest (max) bom value element. -1 if no value is lower than BOM_VALUE_THRESHOLD </dd></dl>
121

  
122
</div>
123
</div><p>
124
<a class="anchor" name="g101f932380b02b48a0ca3d20ffc8c08f"></a><!-- doxytag: member="bom.c::bom_init" ref="g101f932380b02b48a0ca3d20ffc8c08f" args="(char type)" -->
125
<div class="memitem">
126
<div class="memproto">
127
      <table class="memname">
128
        <tr>
129
          <td class="memname">void bom_init           </td>
130
          <td>(</td>
131
          <td class="paramtype">char&nbsp;</td>
132
          <td class="paramname"> <em>type</em>          </td>
133
          <td>&nbsp;)&nbsp;</td>
134
          <td width="100%"></td>
135
        </tr>
136
      </table>
137
</div>
138
<div class="memdoc">
139

  
140
<p>
141
Initialize the bom according to bom type. 
142
<p>
143
Initializes the BOM. Call bom_init before reading bom values or turning bom leds.<p>
144
INCOMPLETE - need to fill in init routine for BOM15<p>
145
<dl class="see" compact><dt><b>See also:</b></dt><dd><a class="el" href="group__bom.html#gbdcdf3a1428f8145ee5eed82efdaf0fc" title="Refresh bom_val[] with new values from analog8. analog_init and bom_init must be...">bom_refresh</a>, <a class="el" href="group__bom.html#g2f5fae400bcc24d266c84ca441a1516c" title="Turns on the selected bom leds. Only works with BOM_ALL if using the original bom...">bom_leds_on</a>, <a class="el" href="group__bom.html#gf3fb24ce85166158df75f7d5f391f3ad" title="Turns off the selected bom leds. Only works with BOM_ALL if using the original bom...">bom_leds_off</a> </dd></dl>
146

  
147
</div>
148
</div><p>
149
<a class="anchor" name="gf3fb24ce85166158df75f7d5f391f3ad"></a><!-- doxytag: member="bom.c::bom_leds_off" ref="gf3fb24ce85166158df75f7d5f391f3ad" args="(int bit_field)" -->
150
<div class="memitem">
151
<div class="memproto">
152
      <table class="memname">
153
        <tr>
154
          <td class="memname">void bom_leds_off           </td>
155
          <td>(</td>
156
          <td class="paramtype">int&nbsp;</td>
157
          <td class="paramname"> <em>bit_field</em>          </td>
158
          <td>&nbsp;)&nbsp;</td>
159
          <td width="100%"></td>
160
        </tr>
161
      </table>
162
</div>
163
<div class="memdoc">
164

  
165
<p>
166
Turns off the selected bom leds. Only works with BOM_ALL if using the original bom. 
167
<p>
168
Iterates through each bit in the bit_field. For each set bit, turns off the corresponding bom led. bom_init must be called for this to work. Only works with BOM_ALL if using the original bom.<p>
169
<dl compact><dt><b>Parameters:</b></dt><dd>
170
  <table border="0" cellspacing="2" cellpadding="0">
171
    <tr><td valign="top"></td><td valign="top"><em>bit_field</em>&nbsp;</td><td>specifies which leds should be turned off. Use BOM_ALL to turn off all bom leds. Ex. if 0x000B is passed, leds 0 and 3 will be turned off. </td></tr>
172
  </table>
173
</dl>
174

  
175
</div>
176
</div><p>
177
<a class="anchor" name="g2f5fae400bcc24d266c84ca441a1516c"></a><!-- doxytag: member="bom.c::bom_leds_on" ref="g2f5fae400bcc24d266c84ca441a1516c" args="(int bit_field)" -->
178
<div class="memitem">
179
<div class="memproto">
180
      <table class="memname">
181
        <tr>
182
          <td class="memname">void bom_leds_on           </td>
183
          <td>(</td>
184
          <td class="paramtype">int&nbsp;</td>
185
          <td class="paramname"> <em>bit_field</em>          </td>
186
          <td>&nbsp;)&nbsp;</td>
187
          <td width="100%"></td>
188
        </tr>
189
      </table>
190
</div>
191
<div class="memdoc">
192

  
193
<p>
194
Turns on the selected bom leds. Only works with BOM_ALL if using the original bom. 
195
<p>
196
Iterates through each bit in the bit_field. For each set bit, turns on the corresponding bom led. bom_init must be called for this to work. Only works with BOM_ALL if using the original bom.<p>
197
<dl compact><dt><b>Parameters:</b></dt><dd>
198
  <table border="0" cellspacing="2" cellpadding="0">
199
    <tr><td valign="top"></td><td valign="top"><em>bit_field</em>&nbsp;</td><td>specifies which leds should be turned on. Use BOM_ALL to turn on all bom leds. Ex. if 0x0005 is passed, leds 0 and 2 will be turned on. </td></tr>
200
  </table>
201
</dl>
202

  
203
</div>
204
</div><p>
35 205
<a class="anchor" name="g61a66e53cdee8bce139c707153143b30"></a><!-- doxytag: member="bom.c::bom_off" ref="g61a66e53cdee8bce139c707153143b30" args="(void)" -->
36 206
<div class="memitem">
37 207
<div class="memproto">
......
49 219
<div class="memdoc">
50 220

  
51 221
<p>
52
Turns the BOM off. 
222
(DEPRECATED) Turns off all bom leds. 
53 223
<p>
54
Stops flashing the BOM. analog_init must be called before this function can be used.<p>
55
<dl class="see" compact><dt><b>See also:</b></dt><dd><a class="el" href="group__bom.html#g93b665ff81fc6b58503c6ba5ba01c1bf" title="Turns the BOM on.">bom_on</a>, <a class="el" href="group__analog.html#g55f66ff6f3449ef81d97b7e47f041918" title="Initialize analog ports.">analog_init</a> </dd></dl>
224
(DEPRECATED) Turns off all bom leds.<p>
225
<dl class="see" compact><dt><b>See also:</b></dt><dd><a class="el" href="group__bom.html#g93b665ff81fc6b58503c6ba5ba01c1bf" title="(DEPRECATED) Turns on all bom leds.">bom_on</a> </dd></dl>
56 226

  
57 227
</div>
58 228
</div><p>
......
73 243
<div class="memdoc">
74 244

  
75 245
<p>
76
Turns the BOM on. 
246
(DEPRECATED) Turns on all bom leds. 
77 247
<p>
78
Flashes the BOM. analog_init must be called before this function can be used.<p>
79
<dl class="see" compact><dt><b>See also:</b></dt><dd><a class="el" href="group__bom.html#g61a66e53cdee8bce139c707153143b30" title="Turns the BOM off.">bom_off</a>, <a class="el" href="group__analog.html#g55f66ff6f3449ef81d97b7e47f041918" title="Initialize analog ports.">analog_init</a> </dd></dl>
248
(DEPRECATED) Turns on all bom leds.<p>
249
<dl class="see" compact><dt><b>See also:</b></dt><dd><a class="el" href="group__bom.html#g61a66e53cdee8bce139c707153143b30" title="(DEPRECATED) Turns off all bom leds.">bom_off</a> </dd></dl>
80 250

  
81 251
</div>
82 252
</div><p>
253
<a class="anchor" name="gbdcdf3a1428f8145ee5eed82efdaf0fc"></a><!-- doxytag: member="bom.c::bom_refresh" ref="gbdcdf3a1428f8145ee5eed82efdaf0fc" args="(int bit_field)" -->
254
<div class="memitem">
255
<div class="memproto">
256
      <table class="memname">
257
        <tr>
258
          <td class="memname">void bom_refresh           </td>
259
          <td>(</td>
260
          <td class="paramtype">int&nbsp;</td>
261
          <td class="paramname"> <em>bit_field</em>          </td>
262
          <td>&nbsp;)&nbsp;</td>
263
          <td width="100%"></td>
264
        </tr>
265
      </table>
266
</div>
267
<div class="memdoc">
268

  
269
<p>
270
Refresh bom_val[] with new values from analog8. analog_init and bom_init must be called for this to work. 
271
<p>
272
Iterates through each bit in the bit_field. For each set bit, sets the corresponding bom select bits and updates the corresponding bom value with an analog_get8 reading. analog_init and bom_init must be called for this to work.<p>
273
<dl compact><dt><b>Parameters:</b></dt><dd>
274
  <table border="0" cellspacing="2" cellpadding="0">
275
    <tr><td valign="top"></td><td valign="top"><em>bit_field</em>&nbsp;</td><td>specifies which elements in bom_val[] should be updated. Use BOM_ALL to refresh all values. Ex. if 0x0003 is passed, bom_val[0] and bom_val[1] will be updated.</td></tr>
276
  </table>
277
</dl>
278
<dl class="see" compact><dt><b>See also:</b></dt><dd><a class="el" href="group__bom.html#gd28d2a59a5090390e20f87cfd05b0a8b" title="Gets the bom reading from bom_val[which]. Call bom_refresh beforehand to read new...">bom_get</a> </dd></dl>
279

  
280
</div>
281
</div><p>
83 282
<a class="anchor" name="g86753fe7440cd64e60c58ad31c62264a"></a><!-- doxytag: member="bom.c::get_max_bom" ref="g86753fe7440cd64e60c58ad31c62264a" args="(void)" -->
84 283
<div class="memitem">
85 284
<div class="memproto">
......
97 296
<div class="memdoc">
98 297

  
99 298
<p>
100
Returns the location of the maximum BOM reading. 
299
(DEPRECATED) Gets and compares all bom values. Returns the index to the highest value element. 
101 300
<p>
102
Returns the direction of the maximum BOM reading, as an integer in the range 0-15. 0 indicates to the robot's right, while the rest of the sensors are numbered counterclockwise. This is useful for determining the direction of a robot flashing its BOM, of only one robot is currently doing so. analog_init must be called before this function can be used.<p>
301
(DEPRECATED) Returns the direction of the maximum BOM reading, as an integer in the range 0-15. 0 indicates to the robot's right, while the rest of the sensors are numbered counterclockwise. This is useful for determining the direction of a robot flashing its BOM, of only one robot is currently doing so. analog_init must be called before this function can be used.<p>
103 302
<dl class="return" compact><dt><b>Returns:</b></dt><dd>the direction of the maximum BOM reading</dd></dl>
104
<dl class="see" compact><dt><b>See also:</b></dt><dd><a class="el" href="group__analog.html#g55f66ff6f3449ef81d97b7e47f041918" title="Initialize analog ports.">analog_init</a> </dd></dl>
303
<dl class="see" compact><dt><b>See also:</b></dt><dd><a class="el" href="group__analog.html#g4be2ba5e4db17e5be950af682f9ad522" title="Initialize analog ports. Will start running a loop if start_conversion is ADC_START...">analog_init</a> </dd></dl>
105 304

  
106 305
</div>
107 306
</div><p>
108
<hr size="1"><address style="text-align: right;"><small>Generated on Thu Nov 8 23:15:40 2007 for libdragonfly by&nbsp;
307
<hr size="1"><address style="text-align: right;"><small>Generated on Wed Feb 6 20:27:38 2008 for libdragonfly by&nbsp;
109 308
<a href="http://www.doxygen.org/index.html">
110 309
<img src="doxygen.png" alt="doxygen" align="middle" border="0"></a> 1.5.3 </small></address>
111 310
</body>

Also available in: Unified diff