Project

General

Profile

Statistics
| Revision:

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

History | View | Annotate | Download (18.3 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.5 -->
8
<div class="navigation" id="top">
9
  <div class="tabs">
10
    <ul>
11
      <li><a href="index.html"><span>Main&nbsp;Page</span></a></li>
12
      <li><a href="pages.html"><span>Related&nbsp;Pages</span></a></li>
13
      <li><a href="modules.html"><span>Modules</span></a></li>
14
      <li><a href="annotated.html"><span>Data&nbsp;Structures</span></a></li>
15
      <li><a href="files.html"><span>Files</span></a></li>
16
    </ul>
17
  </div>
18
</div>
19
<div class="contents">
20
<h1>BOM (Bearing and Orientation Module)</h1>Functions for dealing with the BOM.  
21
<a href="#_details">More...</a><table border="0" cellpadding="0" cellspacing="0">
22
<tr><td></td></tr>
23
<tr><td colspan="2"><br><h2>Defines</h2></td></tr>
24
<tr><td class="memItemLeft" nowrap align="right" valign="top"><a class="anchor" name="g3f1e6fc7eeb6d7cffde8bb03ff8dc488"></a><!-- doxytag: member="bom::BOM_ALL" ref="g3f1e6fc7eeb6d7cffde8bb03ff8dc488" args="" -->
25
#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>
26

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

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

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

    
39
<tr><td class="mdescLeft">&nbsp;</td><td class="mdescRight">RBOM - Range, Individual LED control. <br></td></tr>
40
<tr><td colspan="2"><br><h2>Functions</h2></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#g101f932380b02b48a0ca3d20ffc8c08f">bom_init</a> (char type)</td></tr>
42

    
43
<tr><td class="mdescLeft">&nbsp;</td><td class="mdescRight">Initialize the bom according to bom type.  <a href="#g101f932380b02b48a0ca3d20ffc8c08f"></a><br></td></tr>
44
<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>
45

    
46
<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>
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#gd28d2a59a5090390e20f87cfd05b0a8b">bom_get</a> (int which)</td></tr>
48

    
49
<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>
50
<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>
51

    
52
<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>
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#g8e42fe2740ecc49e7c057e9d7df9c9eb">bom_set_leds</a> (int bit_field)</td></tr>
54

    
55
<tr><td class="mdescLeft">&nbsp;</td><td class="mdescRight">Enables the selected bom leds on a BOM1.5.  <a href="#g8e42fe2740ecc49e7c057e9d7df9c9eb"></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">Turns on all BOM leds, or turns on enabled leds on a BOM1.5.  <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">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
<p>Referenced by <a class="el" href="bom_8c-source.html#l00268">get_max_bom()</a>.</p>
123

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

    
142
<p>
143
Initialize the bom according to bom type. 
144
<p>
145
Initializes the BOM. Call bom_init before reading bom values or turning bom leds.<p>
146
INCOMPLETE - No utilization of BOM1.5 RSSI capability. Probably leave this out until Cornell and Pras return<p>
147
<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>, bom_leds_on, bom_leds_off </dd></dl>
148

    
149
<p>References <a class="el" href="bom_8h-source.html#l00050">BOM10</a>, <a class="el" href="bom_8h-source.html#l00053">BOM15</a>, <a class="el" href="bom_8h-source.html#l00047">BOM_ALL</a>, <a class="el" href="bom_8c-source.html#l00228">bom_set_leds()</a>, <a class="el" href="dio_8c-source.html#l00162">digital_output()</a>, and <a class="el" href="bom_8h-source.html#l00056">RBOM</a>.</p>
150

    
151
<p>Referenced by <a class="el" href="dragonfly__lib_8c-source.html#l00068">dragonfly_init()</a>.</p>
152

    
153
</div>
154
</div><p>
155
<a class="anchor" name="g61a66e53cdee8bce139c707153143b30"></a><!-- doxytag: member="bom.c::bom_off" ref="g61a66e53cdee8bce139c707153143b30" args="(void)" -->
156
<div class="memitem">
157
<div class="memproto">
158
      <table class="memname">
159
        <tr>
160
          <td class="memname">void bom_off           </td>
161
          <td>(</td>
162
          <td class="paramtype">void&nbsp;</td>
163
          <td class="paramname">          </td>
164
          <td>&nbsp;)&nbsp;</td>
165
          <td width="100%"></td>
166
        </tr>
167
      </table>
168
</div>
169
<div class="memdoc">
170

    
171
<p>
172
Turns off all bom leds. 
173
<p>
174
Turns off all bom leds.<p>
175
<dl class="see" compact><dt><b>See also:</b></dt><dd><a class="el" href="group__bom.html#g93b665ff81fc6b58503c6ba5ba01c1bf" title="Turns on all BOM leds, or turns on enabled leds on a BOM1.5.">bom_on</a> </dd></dl>
176

    
177
<p>References <a class="el" href="bom_8h-source.html#l00050">BOM10</a>, <a class="el" href="bom_8h-source.html#l00053">BOM15</a>, <a class="el" href="dio_8c-source.html#l00162">digital_output()</a>, and <a class="el" href="bom_8h-source.html#l00056">RBOM</a>.</p>
178

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

    
197
<p>
198
Turns on all BOM leds, or turns on enabled leds on a BOM1.5. 
199
<p>
200
Flashes the BOM. If using a BOM1.5, only the emitters that have been enabled using bom_set_leds will turn on.<p>
201
<dl class="see" compact><dt><b>See also:</b></dt><dd><a class="el" href="group__bom.html#g61a66e53cdee8bce139c707153143b30" title="Turns off all bom leds.">bom_off</a>, <a class="el" href="group__bom.html#g8e42fe2740ecc49e7c057e9d7df9c9eb" title="Enables the selected bom leds on a BOM1.5.">bom_set_leds</a> </dd></dl>
202

    
203
<p>References <a class="el" href="bom_8h-source.html#l00050">BOM10</a>, <a class="el" href="bom_8h-source.html#l00053">BOM15</a>, <a class="el" href="dio_8c-source.html#l00162">digital_output()</a>, and <a class="el" href="bom_8h-source.html#l00056">RBOM</a>.</p>
204

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

    
223
<p>
224
Refresh bom_val[] with new values from analog8. analog_init and bom_init must be called for this to work. 
225
<p>
226
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>
227
<dl compact><dt><b>Parameters:</b></dt><dd>
228
  <table border="0" cellspacing="2" cellpadding="0">
229
    <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>
230
  </table>
231
</dl>
232
<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>
233

    
234
<p>References <a class="el" href="analog_8c-source.html#l00195">analog_get8()</a>, <a class="el" href="analog_8c-source.html#l00160">analog_start_loop()</a>, and <a class="el" href="analog_8c-source.html#l00174">analog_stop_loop()</a>.</p>
235

    
236
<p>Referenced by <a class="el" href="bom_8c-source.html#l00268">get_max_bom()</a>.</p>
237

    
238
</div>
239
</div><p>
240
<a class="anchor" name="g8e42fe2740ecc49e7c057e9d7df9c9eb"></a><!-- doxytag: member="bom.c::bom_set_leds" ref="g8e42fe2740ecc49e7c057e9d7df9c9eb" args="(int bit_field)" -->
241
<div class="memitem">
242
<div class="memproto">
243
      <table class="memname">
244
        <tr>
245
          <td class="memname">void bom_set_leds           </td>
246
          <td>(</td>
247
          <td class="paramtype">int&nbsp;</td>
248
          <td class="paramname"> <em>bit_field</em>          </td>
249
          <td>&nbsp;)&nbsp;</td>
250
          <td width="100%"></td>
251
        </tr>
252
      </table>
253
</div>
254
<div class="memdoc">
255

    
256
<p>
257
Enables the selected bom leds on a BOM1.5. 
258
<p>
259
Iterates through each bit in the bit_field. If the bit is set, the corresponding emitter will be enabled to turn on when <a class="el" href="group__bom.html#g93b665ff81fc6b58503c6ba5ba01c1bf" title="Turns on all BOM leds, or turns on enabled leds on a BOM1.5.">bom_on()</a> is called. bom_init must be called for this to work. Does nothing if a BOM1.0 is installed<p>
260
<dl compact><dt><b>Parameters:</b></dt><dd>
261
  <table border="0" cellspacing="2" cellpadding="0">
262
    <tr><td valign="top"></td><td valign="top"><em>bit_field</em>&nbsp;</td><td>specifies which leds should be turned on when bom_on is called. Use BOM_ALL to turn on all bom leds. Ex. if 0x0005 is passed, leds 0 and 2 will be turned on. </td></tr>
263
  </table>
264
</dl>
265

    
266
<p>References <a class="el" href="bom_8h-source.html#l00050">BOM10</a>, <a class="el" href="bom_8h-source.html#l00053">BOM15</a>, <a class="el" href="dio_8c-source.html#l00162">digital_output()</a>, and <a class="el" href="bom_8h-source.html#l00056">RBOM</a>.</p>
267

    
268
<p>Referenced by <a class="el" href="bom_8c-source.html#l00130">bom_init()</a>.</p>
269

    
270
</div>
271
</div><p>
272
<a class="anchor" name="g86753fe7440cd64e60c58ad31c62264a"></a><!-- doxytag: member="bom.c::get_max_bom" ref="g86753fe7440cd64e60c58ad31c62264a" args="(void)" -->
273
<div class="memitem">
274
<div class="memproto">
275
      <table class="memname">
276
        <tr>
277
          <td class="memname">int get_max_bom           </td>
278
          <td>(</td>
279
          <td class="paramtype">void&nbsp;</td>
280
          <td class="paramname">          </td>
281
          <td>&nbsp;)&nbsp;</td>
282
          <td width="100%"></td>
283
        </tr>
284
      </table>
285
</div>
286
<div class="memdoc">
287

    
288
<p>
289
(DEPRECATED) Gets and compares all bom values. Returns the index to the highest value element. 
290
<p>
291
(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>
292
<dl class="return" compact><dt><b>Returns:</b></dt><dd>the direction of the maximum BOM reading</dd></dl>
293
<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>
294

    
295
<p>References <a class="el" href="bom_8h-source.html#l00047">BOM_ALL</a>, <a class="el" href="bom_8c-source.html#l00203">bom_get_max()</a>, and <a class="el" href="bom_8c-source.html#l00168">bom_refresh()</a>.</p>
296

    
297
</div>
298
</div><p>
299
</div>
300
<hr size="1"><address style="text-align: right;"><small>Generated on Wed Sep 2 23:20:08 2009 for libdragonfly by&nbsp;
301
<a href="http://www.doxygen.org/index.html">
302
<img src="doxygen.png" alt="doxygen" align="middle" border="0"></a> 1.5.5 </small></address>
303
</body>
304
</html>