Project

General

Profile

Statistics
| Revision:

root / trunk / docs / libdragonfly / group__bom.html @ 497

History | View | Annotate | Download (17.8 KB)

1
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
2
<html><head><meta http-equiv="Content-Type" content="text/html;charset=UTF-8">
3
<title>libdragonfly: BOM (Bearing and Orientation Module)</title>
4
<link href="doxygen.css" rel="stylesheet" type="text/css">
5
<link href="tabs.css" rel="stylesheet" type="text/css">
6
</head><body>
7
<!-- Generated by Doxygen 1.5.3 -->
8
<div class="tabs">
9
  <ul>
10
    <li><a href="index.html"><span>Main&nbsp;Page</span></a></li>
11
    <li><a href="modules.html"><span>Modules</span></a></li>
12
    <li><a href="annotated.html"><span>Data&nbsp;Structures</span></a></li>
13
    <li><a href="files.html"><span>Files</span></a></li>
14
    <li><a href="pages.html"><span>Related&nbsp;Pages</span></a></li>
15
  </ul>
16
</div>
17
<h1>BOM (Bearing and Orientation Module)</h1>Functions for dealing with the BOM.  
18
<a href="#_details">More...</a><table border="0" cellpadding="0" cellspacing="0">
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>
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>
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>
57

    
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>
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>
60

    
61
<tr><td class="mdescLeft">&nbsp;</td><td class="mdescRight">(DEPRECATED) Turns on all bom leds.  <a href="#g93b665ff81fc6b58503c6ba5ba01c1bf"></a><br></td></tr>
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>
63

    
64
<tr><td class="mdescLeft">&nbsp;</td><td class="mdescRight">(DEPRECATED) Turns off all bom leds.  <a href="#g61a66e53cdee8bce139c707153143b30"></a><br></td></tr>
65
</table>
66
<hr><a name="_details"></a><h2>Detailed Description</h2>
67
Functions for dealing with the BOM. 
68
<p>
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>
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>
205
<a class="anchor" name="g61a66e53cdee8bce139c707153143b30"></a><!-- doxytag: member="bom.c::bom_off" ref="g61a66e53cdee8bce139c707153143b30" args="(void)" -->
206
<div class="memitem">
207
<div class="memproto">
208
      <table class="memname">
209
        <tr>
210
          <td class="memname">void bom_off           </td>
211
          <td>(</td>
212
          <td class="paramtype">void&nbsp;</td>
213
          <td class="paramname">          </td>
214
          <td>&nbsp;)&nbsp;</td>
215
          <td width="100%"></td>
216
        </tr>
217
      </table>
218
</div>
219
<div class="memdoc">
220

    
221
<p>
222
(DEPRECATED) Turns off all bom leds. 
223
<p>
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>
226

    
227
</div>
228
</div><p>
229
<a class="anchor" name="g93b665ff81fc6b58503c6ba5ba01c1bf"></a><!-- doxytag: member="bom.c::bom_on" ref="g93b665ff81fc6b58503c6ba5ba01c1bf" args="(void)" -->
230
<div class="memitem">
231
<div class="memproto">
232
      <table class="memname">
233
        <tr>
234
          <td class="memname">void bom_on           </td>
235
          <td>(</td>
236
          <td class="paramtype">void&nbsp;</td>
237
          <td class="paramname">          </td>
238
          <td>&nbsp;)&nbsp;</td>
239
          <td width="100%"></td>
240
        </tr>
241
      </table>
242
</div>
243
<div class="memdoc">
244

    
245
<p>
246
(DEPRECATED) Turns on all bom leds. 
247
<p>
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>
250

    
251
</div>
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>
282
<a class="anchor" name="g86753fe7440cd64e60c58ad31c62264a"></a><!-- doxytag: member="bom.c::get_max_bom" ref="g86753fe7440cd64e60c58ad31c62264a" args="(void)" -->
283
<div class="memitem">
284
<div class="memproto">
285
      <table class="memname">
286
        <tr>
287
          <td class="memname">int get_max_bom           </td>
288
          <td>(</td>
289
          <td class="paramtype">void&nbsp;</td>
290
          <td class="paramname">          </td>
291
          <td>&nbsp;)&nbsp;</td>
292
          <td width="100%"></td>
293
        </tr>
294
      </table>
295
</div>
296
<div class="memdoc">
297

    
298
<p>
299
(DEPRECATED) Gets and compares all bom values. Returns the index to the highest value element. 
300
<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>
302
<dl class="return" compact><dt><b>Returns:</b></dt><dd>the direction of the maximum BOM reading</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>
304

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