Project

General

Profile

Statistics
| Revision:

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

History | View | Annotate | Download (18.1 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.4 -->
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) Wrapper function. See bom_refresh and bom_get_max  <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) Wrapper function. See bom_leds_on.  <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) Wrapper function. See bom_leds_off.  <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
<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> </dd></dl>
98

    
99
</div>
100
</div><p>
101
<a class="anchor" name="gbce8d8dd8f11d8f5e9f9d74d84ea15db"></a><!-- doxytag: member="bom.c::bom_get_max" ref="gbce8d8dd8f11d8f5e9f9d74d84ea15db" args="(void)" -->
102
<div class="memitem">
103
<div class="memproto">
104
      <table class="memname">
105
        <tr>
106
          <td class="memname">int bom_get_max           </td>
107
          <td>(</td>
108
          <td class="paramtype">void&nbsp;</td>
109
          <td class="paramname">          </td>
110
          <td>&nbsp;)&nbsp;</td>
111
          <td width="100%"></td>
112
        </tr>
113
      </table>
114
</div>
115
<div class="memdoc">
116

    
117
<p>
118
Compares all the values in bom_val[] and returns the index to the highest value element. 
119
<p>
120
Compares all the values in bom_val[] and returns the index to the lowest (max) value element. 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.<p>
121
<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>
122

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

    
141
<p>
142
Initialize the bom according to bom type. 
143
<p>
144
Initializes the BOM. Call bom_init before reading bom values or turning bom leds.<p>
145
INCOMPLETE - need to fill in init routine for BOM15<p>
146
<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>
147

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

    
166
<p>
167
Turns off the selected bom leds. Only works with BOM_ALL if using the original bom. 
168
<p>
169
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>
170
<dl compact><dt><b>Parameters:</b></dt><dd>
171
  <table border="0" cellspacing="2" cellpadding="0">
172
    <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>
173
  </table>
174
</dl>
175

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

    
194
<p>
195
Turns on the selected bom leds. Only works with BOM_ALL if using the original bom. 
196
<p>
197
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>
198
<dl compact><dt><b>Parameters:</b></dt><dd>
199
  <table border="0" cellspacing="2" cellpadding="0">
200
    <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>
201
  </table>
202
</dl>
203

    
204
</div>
205
</div><p>
206
<a class="anchor" name="g61a66e53cdee8bce139c707153143b30"></a><!-- doxytag: member="bom.c::bom_off" ref="g61a66e53cdee8bce139c707153143b30" args="(void)" -->
207
<div class="memitem">
208
<div class="memproto">
209
      <table class="memname">
210
        <tr>
211
          <td class="memname">void bom_off           </td>
212
          <td>(</td>
213
          <td class="paramtype">void&nbsp;</td>
214
          <td class="paramname">          </td>
215
          <td>&nbsp;)&nbsp;</td>
216
          <td width="100%"></td>
217
        </tr>
218
      </table>
219
</div>
220
<div class="memdoc">
221

    
222
<p>
223
(DEPRECATED) Wrapper function. See bom_leds_off. 
224
<p>
225
(DEPRECATED) Turns off all bom leds.<p>
226
<dl class="see" compact><dt><b>See also:</b></dt><dd><a class="el" href="group__bom.html#g93b665ff81fc6b58503c6ba5ba01c1bf" title="(DEPRECATED) Wrapper function. See bom_leds_on.">bom_on</a> </dd></dl>
227

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

    
246
<p>
247
(DEPRECATED) Wrapper function. See bom_leds_on. 
248
<p>
249
(DEPRECATED) Turns on all bom leds.<p>
250
<dl class="see" compact><dt><b>See also:</b></dt><dd><a class="el" href="group__bom.html#g61a66e53cdee8bce139c707153143b30" title="(DEPRECATED) Wrapper function. See bom_leds_off.">bom_off</a> </dd></dl>
251

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

    
270
<p>
271
Refresh bom_val[] with new values from analog8. analog_init and bom_init must be called for this to work. 
272
<p>
273
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>
274
<dl compact><dt><b>Parameters:</b></dt><dd>
275
  <table border="0" cellspacing="2" cellpadding="0">
276
    <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>
277
  </table>
278
</dl>
279
<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>
280

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

    
299
<p>
300
(DEPRECATED) Wrapper function. See bom_refresh and bom_get_max 
301
<p>
302
(DEPRECATED) Wrapper function for new BOM code. Refreshes buffer and returns the max bom value.<p>
303
<dl class="return" compact><dt><b>Returns:</b></dt><dd>the direction of the maximum BOM reading</dd></dl>
304
<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#gbce8d8dd8f11d8f5e9f9d74d84ea15db" title="Compares all the values in bom_val[] and returns the index to the highest value element...">bom_get_max</a> </dd></dl>
305

    
306
</div>
307
</div><p>
308
<hr size="1"><address style="text-align: right;"><small>Generated on Mon Oct 6 15:44:34 2008 for libdragonfly by&nbsp;
309
<a href="http://www.doxygen.org/index.html">
310
<img src="doxygen.png" alt="doxygen" align="middle" border="0"></a> 1.5.4 </small></address>
311
</body>
312
</html>