Project

General

Profile

Statistics
| Revision:

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

History | View | Annotate | Download (18.2 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="tabs.css" rel="stylesheet" type="text/css">
5
<link href="doxygen.css" rel="stylesheet" type="text/css">
6
</head><body>
7
<!-- Generated by Doxygen 1.5.9 -->
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>
22
<p>
23
<table border="0" cellpadding="0" cellspacing="0">
24
<tr><td></td></tr>
25
<tr><td colspan="2"><br><h2>Defines</h2></td></tr>
26
<tr><td class="memItemLeft" nowrap align="right" valign="top"><a class="anchor" name="g3f1e6fc7eeb6d7cffde8bb03ff8dc488"></a><!-- doxytag: member="bom::BOM_ALL" ref="g3f1e6fc7eeb6d7cffde8bb03ff8dc488" args="" -->
27
#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>
28

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

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

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

    
41
<tr><td class="mdescLeft">&nbsp;</td><td class="mdescRight">RBOM - Range, Individual LED control. <br></td></tr>
42
<tr><td colspan="2"><br><h2>Functions</h2></td></tr>
43
<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>
44

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

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

    
51
<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>
52
<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>
53

    
54
<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>
55
<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>
56

    
57
<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>
58
<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>
59

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

    
63
<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>
64
<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>
65

    
66
<tr><td class="mdescLeft">&nbsp;</td><td class="mdescRight">Turns off all bom leds.  <a href="#g61a66e53cdee8bce139c707153143b30"></a><br></td></tr>
67
</table>
68
<hr><a name="_details"></a><h2>Detailed Description</h2>
69
Functions for dealing with the BOM. 
70
<p>
71
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>
72
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>
73
<a class="anchor" name="gd28d2a59a5090390e20f87cfd05b0a8b"></a><!-- doxytag: member="bom.c::bom_get" ref="gd28d2a59a5090390e20f87cfd05b0a8b" args="(int which)" -->
74
<div class="memitem">
75
<div class="memproto">
76
      <table class="memname">
77
        <tr>
78
          <td class="memname">int bom_get           </td>
79
          <td>(</td>
80
          <td class="paramtype">int&nbsp;</td>
81
          <td class="paramname"> <em>which</em>          </td>
82
          <td>&nbsp;)&nbsp;</td>
83
          <td></td>
84
        </tr>
85
      </table>
86
</div>
87
<div class="memdoc">
88

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

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

    
124
<p>Referenced by <a class="el" href="bom_8c_source.html#l00268">get_max_bom()</a>.</p>
125

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

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

    
151
<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>
152

    
153
<p>Referenced by <a class="el" href="dragonfly__lib_8c_source.html#l00068">dragonfly_init()</a>.</p>
154

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

    
173
<p>
174
Turns off all bom leds. 
175
<p>
176
Turns off all bom leds.<p>
177
<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>
178

    
179
<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>
180

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

    
199
<p>
200
Turns on all BOM leds, or turns on enabled leds on a BOM1.5. 
201
<p>
202
Flashes the BOM. If using a BOM1.5, only the emitters that have been enabled using bom_set_leds will turn on.<p>
203
<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>
204

    
205
<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>
206

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

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

    
236
<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>
237

    
238
<p>Referenced by <a class="el" href="bom_8c_source.html#l00268">get_max_bom()</a>.</p>
239

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

    
258
<p>
259
Enables the selected bom leds on a BOM1.5. 
260
<p>
261
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>
262
<dl compact><dt><b>Parameters:</b></dt><dd>
263
  <table border="0" cellspacing="2" cellpadding="0">
264
    <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>
265
  </table>
266
</dl>
267

    
268
<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>
269

    
270
<p>Referenced by <a class="el" href="bom_8c_source.html#l00130">bom_init()</a>.</p>
271

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

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

    
297
<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>
298

    
299
</div>
300
</div><p>
301
</div>
302
<hr size="1"><address style="text-align: right;"><small>Generated on Mon Sep 7 19:07:28 2009 for libdragonfly by&nbsp;
303
<a href="http://www.doxygen.org/index.html">
304
<img src="doxygen.png" alt="doxygen" align="middle" border="0"></a> 1.5.9 </small></address>
305
</body>
306
</html>