Revision 241
Updated libdragonfly documentation.
serial_8h-source.html | ||
---|---|---|
1 | 1 |
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"> |
2 |
<html><head><meta http-equiv="Content-Type" content="text/html;charset=iso-8859-1">
|
|
2 |
<html><head><meta http-equiv="Content-Type" content="text/html;charset=UTF-8">
|
|
3 | 3 |
<title>libdragonfly: serial.h Source File</title> |
4 | 4 |
<link href="doxygen.css" rel="stylesheet" type="text/css"> |
5 | 5 |
<link href="tabs.css" rel="stylesheet" type="text/css"> |
6 | 6 |
</head><body> |
7 |
<!-- Generated by Doxygen 1.4.6 -->
|
|
7 |
<!-- Generated by Doxygen 1.5.3 -->
|
|
8 | 8 |
<div class="tabs"> |
9 | 9 |
<ul> |
10 | 10 |
<li><a href="index.html"><span>Main Page</span></a></li> |
11 | 11 |
<li><a href="modules.html"><span>Modules</span></a></li> |
12 |
<li id="current"><a href="files.html"><span>Files</span></a></li> |
|
13 |
</ul></div> |
|
14 |
<div class="tabs"> |
|
15 |
<ul> |
|
16 |
<li><a href="files.html"><span>File List</span></a></li> |
|
17 |
<li><a href="globals.html"><span>Globals</span></a></li> |
|
18 |
</ul></div> |
|
12 |
<li class="current"><a href="files.html"><span>Files</span></a></li> |
|
13 |
<li><a href="pages.html"><span>Related Pages</span></a></li> |
|
14 |
</ul> |
|
15 |
</div> |
|
19 | 16 |
<h1>serial.h</h1><a href="serial_8h.html">Go to the documentation of this file.</a><div class="fragment"><pre class="fragment"><a name="l00001"></a>00001 |
20 |
<a name="l00012"></a>00012 <span class="comment">/*</span>
|
|
21 |
<a name="l00013"></a>00013 <span class="comment"> serial.h - Contains definitions and function prototypes for the RS232 serial port</span>
|
|
22 |
<a name="l00014"></a>00014 <span class="comment"> author(s): pkv</span>
|
|
23 |
<a name="l00015"></a>00015 <span class="comment"> </span>
|
|
24 |
<a name="l00016"></a>00016 <span class="comment"> Directions:</span>
|
|
25 |
<a name="l00017"></a>00017 <span class="comment"> Call the initialization function for the serial port you wish to use. Then, use</span>
|
|
26 |
<a name="l00018"></a>00018 <span class="comment"> either the provided functions or the stdio functions (fprintf, etc) to read and</span>
|
|
27 |
<a name="l00019"></a>00019 <span class="comment"> write characters to the serial ports.</span>
|
|
28 |
<a name="l00020"></a>00020 <span class="comment"> </span>
|
|
29 |
<a name="l00021"></a>00021 <span class="comment"> UART Mapping:</span>
|
|
30 |
<a name="l00022"></a>00022 <span class="comment"> usb_*() -> UART0</span>
|
|
31 |
<a name="l00023"></a>00023 <span class="comment"> xbee_*() -> UART1</span>
|
|
32 |
<a name="l00024"></a>00024 <span class="comment"> </span>
|
|
33 |
<a name="l00025"></a>00025 <span class="comment"> Options: (Add the following defines to your code to configure this library)</span>
|
|
34 |
<a name="l00026"></a>00026 <span class="comment"> #define USB_BAUD { 115200 | 9600 } <= pick ONE value from in here</span>
|
|
35 |
<a name="l00027"></a>00027 <span class="comment"> #define XBEE_BAUD { 115200 | 9600 } <= pick ONE value from in here</span>
|
|
36 |
<a name="l00028"></a>00028 <span class="comment"> #define USE_STDIO</span>
|
|
37 |
<a name="l00029"></a>00029 <span class="comment"> </span>
|
|
38 |
<a name="l00030"></a>00030 <span class="comment"> Note: If you enable USE_STDIO, the first init function that is called will </span>
|
|
39 |
<a name="l00031"></a>00031 <span class="comment"> automatically be linked to stdin, stdout, and stderr. To use the baud rate </span>
|
|
40 |
<a name="l00032"></a>00032 <span class="comment"> commands, add something like the following to your code:</span>
|
|
41 |
<a name="l00033"></a>00033 <span class="comment"> </span>
|
|
42 |
<a name="l00034"></a>00034 <span class="comment"> #define FOO_BAUD 9600</span>
|
|
43 |
<a name="l00035"></a>00035 <span class="comment"> </span>
|
|
44 |
<a name="l00036"></a>00036 <span class="comment"> **UNLESS YOU KNOW WHAT YOU ARE DOING, PLEASE DO NOT CHANGE THIS FILE**</span>
|
|
45 |
<a name="l00037"></a>00037 <span class="comment"> Many, many other people use this file in their code. If you change it, you will</span>
|
|
46 |
<a name="l00038"></a>00038 <span class="comment"> probably break all of their nice code. You should not need to change anything in</span>
|
|
47 |
<a name="l00039"></a>00039 <span class="comment"> here, except to accomodate new hardware.</span>
|
|
48 |
<a name="l00040"></a>00040 <span class="comment">*/</span>
|
|
49 |
<a name="l00041"></a>00041
|
|
50 |
<a name="l00042"></a>00042 <span class="preprocessor">#ifndef _SERIAL_H</span>
|
|
51 |
<a name="l00043"></a>00043 <span class="preprocessor"></span><span class="preprocessor">#define _SERIAL_H</span>
|
|
52 |
<a name="l00044"></a>00044 <span class="preprocessor"></span>
|
|
53 |
<a name="l00054"></a>00054 <span class="comment">// if no baud rate is defined for usb, default is set here</span>
|
|
54 |
<a name="l00055"></a>00055 <span class="preprocessor">#ifndef USB_BAUD</span>
|
|
55 |
<a name="l00056"></a>00056 <span class="preprocessor"></span>
|
|
56 |
<a name="l00057"></a><a class="code" href="group__usb.html#g378065b4d75b008228ee41cc335474a7">00057</a> <span class="preprocessor">#define USB_BAUD 115200</span>
|
|
57 |
<a name="l00058"></a>00058 <span class="preprocessor"></span><span class="preprocessor">#endif</span>
|
|
58 |
<a name="l00059"></a>00059 <span class="preprocessor"></span>
|
|
59 |
<a name="l00061"></a>00061 <span class="keywordtype">void</span> <a class="code" href="group__usb.html#gddfbdb66f507ffcd08b4496531ed0a3d">usb_init</a>(<span class="keywordtype">void</span>);
|
|
60 |
<a name="l00063"></a>00063 <span class="keywordtype">int</span> <a class="code" href="group__usb.html#g3ee898cfe59d05c428c56021c2ccf946">usb_putc</a>(<span class="keywordtype">char</span> c);
|
|
61 |
<a name="l00065"></a>00065 <span class="keywordtype">int</span> <a class="code" href="group__usb.html#g053a5d887edfe8e8be543ec53a3f60ae">usb_getc</a>(<span class="keywordtype">void</span>);
|
|
62 |
<a name="l00067"></a>00067 <span class="keywordtype">int</span> <a class="code" href="group__usb.html#g6b1209b19e7fd2bbedc7407e0218453c">usb_getc_nb</a>(<span class="keywordtype">char</span> *c);
|
|
63 |
<a name="l00069"></a>00069 <span class="keywordtype">int</span> <a class="code" href="group__usb.html#g6e101f68856f272f67923c4fb35a99e0">usb_puts</a>(<span class="keywordtype">char</span> *s);
|
|
64 |
<a name="l00071"></a>00071 <span class="keywordtype">int</span> <a class="code" href="group__usb.html#gcd371dedbff10f0c52dca4b3b7af9e3d">usb_puti</a>(<span class="keywordtype">int</span> value);
|
|
65 |
<a name="l00072"></a>00072 <span class="comment">//end addtogroup</span>
|
|
66 |
<a name="l00074"></a>00074
|
|
67 |
<a name="l00084"></a>00084 <span class="comment">// if no baud rate is defined for usb, default is set here</span>
|
|
68 |
<a name="l00085"></a>00085
|
|
69 |
<a name="l00086"></a>00086 <span class="comment">// if no baud rate is defined for xbee, default is set here</span>
|
|
70 |
<a name="l00087"></a>00087 <span class="preprocessor">#ifndef XBEE_BAUD</span>
|
|
71 |
<a name="l00088"></a>00088 <span class="preprocessor"></span>
|
|
72 |
<a name="l00089"></a><a class="code" href="group__xbee.html#g7125fc8f3df24a2db8e074983206b054">00089</a> <span class="preprocessor">#define XBEE_BAUD 9600</span>
|
|
73 |
<a name="l00090"></a>00090 <span class="preprocessor"></span><span class="preprocessor">#endif</span>
|
|
74 |
<a name="l00091"></a>00091 <span class="preprocessor"></span>
|
|
75 |
<a name="l00093"></a>00093 <span class="keywordtype">void</span> <a class="code" href="group__xbee.html#g964a1e8461e9c1187e5d69f521e5e107">xbee_init</a>(<span class="keywordtype">void</span>);
|
|
76 |
<a name="l00095"></a>00095 <span class="keywordtype">int</span> <a class="code" href="group__xbee.html#g70c6b231330312d4f69b9a8afb5af989">xbee_putc</a>(<span class="keywordtype">char</span> c);
|
|
77 |
<a name="l00097"></a>00097 <span class="keywordtype">int</span> <a class="code" href="group__xbee.html#g1f468ae159ba5d97bdfb3f4855d15d88">xbee_getc</a>(<span class="keywordtype">void</span>);
|
|
78 |
<a name="l00099"></a>00099 <span class="keywordtype">int</span> <a class="code" href="group__xbee.html#gfb7bd5dd535e8251bfff78854c6c15f2">xbee_getc_nb</a>(<span class="keywordtype">char</span> *c);
|
|
79 |
<a name="l00100"></a>00100 <span class="comment">//end addtogroup</span>
|
|
80 |
<a name="l00102"></a>00102
|
|
81 |
<a name="l00103"></a>00103 <span class="preprocessor">#endif</span>
|
|
82 |
<a name="l00104"></a>00104 <span class="preprocessor"></span>
|
|
83 |
</pre></div><hr size="1"><address style="align: right;"><small>Generated on Wed Sep 26 17:39:30 2007 for libdragonfly by
|
|
17 |
<a name="l00038"></a>00038 <span class="comment">/*</span>
|
|
18 |
<a name="l00039"></a>00039 <span class="comment"> serial.h - Contains definitions and function prototypes for the RS232 serial port</span>
|
|
19 |
<a name="l00040"></a>00040 <span class="comment"> author(s): pkv</span>
|
|
20 |
<a name="l00041"></a>00041 <span class="comment"> </span>
|
|
21 |
<a name="l00042"></a>00042 <span class="comment"> Directions:</span>
|
|
22 |
<a name="l00043"></a>00043 <span class="comment"> Call the initialization function for the serial port you wish to use. Then, use</span>
|
|
23 |
<a name="l00044"></a>00044 <span class="comment"> either the provided functions or the stdio functions (fprintf, etc) to read and</span>
|
|
24 |
<a name="l00045"></a>00045 <span class="comment"> write characters to the serial ports.</span>
|
|
25 |
<a name="l00046"></a>00046 <span class="comment"> </span>
|
|
26 |
<a name="l00047"></a>00047 <span class="comment"> UART Mapping:</span>
|
|
27 |
<a name="l00048"></a>00048 <span class="comment"> usb_*() -> UART0</span>
|
|
28 |
<a name="l00049"></a>00049 <span class="comment"> xbee_*() -> UART1</span>
|
|
29 |
<a name="l00050"></a>00050 <span class="comment"> </span>
|
|
30 |
<a name="l00051"></a>00051 <span class="comment"> Options: (Add the following defines to your code to configure this library)</span>
|
|
31 |
<a name="l00052"></a>00052 <span class="comment"> #define USB_BAUD { 115200 | 9600 } <= pick ONE value from in here</span>
|
|
32 |
<a name="l00053"></a>00053 <span class="comment"> #define XBEE_BAUD { 115200 | 9600 } <= pick ONE value from in here</span>
|
|
33 |
<a name="l00054"></a>00054 <span class="comment"> #define USE_STDIO</span>
|
|
34 |
<a name="l00055"></a>00055 <span class="comment"> </span>
|
|
35 |
<a name="l00056"></a>00056 <span class="comment"> Note: If you enable USE_STDIO, the first init function that is called will </span>
|
|
36 |
<a name="l00057"></a>00057 <span class="comment"> automatically be linked to stdin, stdout, and stderr. To use the baud rate </span>
|
|
37 |
<a name="l00058"></a>00058 <span class="comment"> commands, add something like the following to your code:</span>
|
|
38 |
<a name="l00059"></a>00059 <span class="comment"> </span>
|
|
39 |
<a name="l00060"></a>00060 <span class="comment"> #define FOO_BAUD 9600</span>
|
|
40 |
<a name="l00061"></a>00061 <span class="comment"> </span>
|
|
41 |
<a name="l00062"></a>00062 <span class="comment"> **UNLESS YOU KNOW WHAT YOU ARE DOING, PLEASE DO NOT CHANGE THIS FILE**</span>
|
|
42 |
<a name="l00063"></a>00063 <span class="comment"> Many, many other people use this file in their code. If you change it, you will</span>
|
|
43 |
<a name="l00064"></a>00064 <span class="comment"> probably break all of their nice code. You should not need to change anything in</span>
|
|
44 |
<a name="l00065"></a>00065 <span class="comment"> here, except to accomodate new hardware.</span>
|
|
45 |
<a name="l00066"></a>00066 <span class="comment">*/</span>
|
|
46 |
<a name="l00067"></a>00067
|
|
47 |
<a name="l00068"></a>00068 <span class="preprocessor">#ifndef _SERIAL_H</span>
|
|
48 |
<a name="l00069"></a>00069 <span class="preprocessor"></span><span class="preprocessor">#define _SERIAL_H</span>
|
|
49 |
<a name="l00070"></a>00070 <span class="preprocessor"></span>
|
|
50 |
<a name="l00080"></a>00080 <span class="comment">// if no baud rate is defined for usb, default is set here</span>
|
|
51 |
<a name="l00081"></a>00081 <span class="preprocessor">#ifndef USB_BAUD</span>
|
|
52 |
<a name="l00082"></a>00082 <span class="preprocessor"></span>
|
|
53 |
<a name="l00083"></a><a class="code" href="group__usb.html#g378065b4d75b008228ee41cc335474a7">00083</a> <span class="preprocessor">#define USB_BAUD 115200</span>
|
|
54 |
<a name="l00084"></a>00084 <span class="preprocessor"></span><span class="preprocessor">#endif</span>
|
|
55 |
<a name="l00085"></a>00085 <span class="preprocessor"></span>
|
|
56 |
<a name="l00087"></a>00087 <span class="keywordtype">void</span> <a class="code" href="group__usb.html#gddfbdb66f507ffcd08b4496531ed0a3d" title="Initialize the USB.">usb_init</a>(<span class="keywordtype">void</span>);
|
|
57 |
<a name="l00089"></a>00089 <span class="keywordtype">int</span> <a class="code" href="group__usb.html#g3ee898cfe59d05c428c56021c2ccf946" title="Print a character to USB.">usb_putc</a>(<span class="keywordtype">char</span> c);
|
|
58 |
<a name="l00091"></a>00091 <span class="keywordtype">int</span> <a class="code" href="group__usb.html#g053a5d887edfe8e8be543ec53a3f60ae" title="Read a character from USB.">usb_getc</a>(<span class="keywordtype">void</span>);
|
|
59 |
<a name="l00093"></a>00093 <span class="keywordtype">int</span> <a class="code" href="group__usb.html#g6b1209b19e7fd2bbedc7407e0218453c" title="Read a character from USB without blocking.">usb_getc_nb</a>(<span class="keywordtype">char</span> *c);
|
|
60 |
<a name="l00095"></a>00095 <span class="keywordtype">int</span> <a class="code" href="group__usb.html#g6e101f68856f272f67923c4fb35a99e0" title="Print a string to USB.">usb_puts</a>(<span class="keywordtype">char</span> *s);
|
|
61 |
<a name="l00097"></a>00097 <span class="keywordtype">int</span> <a class="code" href="group__usb.html#gcd371dedbff10f0c52dca4b3b7af9e3d" title="Print an integer to USB.">usb_puti</a>(<span class="keywordtype">int</span> value);
|
|
62 |
<a name="l00098"></a>00098 <span class="comment">//end addtogroup</span>
|
|
63 |
<a name="l00100"></a>00100
|
|
64 |
<a name="l00110"></a>00110 <span class="comment">// if no baud rate is defined for usb, default is set here</span>
|
|
65 |
<a name="l00111"></a>00111
|
|
66 |
<a name="l00112"></a>00112 <span class="comment">// if no baud rate is defined for xbee, default is set here</span>
|
|
67 |
<a name="l00113"></a>00113 <span class="preprocessor">#ifndef XBEE_BAUD</span>
|
|
68 |
<a name="l00114"></a>00114 <span class="preprocessor"></span>
|
|
69 |
<a name="l00115"></a><a class="code" href="group__xbee.html#g7125fc8f3df24a2db8e074983206b054">00115</a> <span class="preprocessor">#define XBEE_BAUD 9600</span>
|
|
70 |
<a name="l00116"></a>00116 <span class="preprocessor"></span><span class="preprocessor">#endif</span>
|
|
71 |
<a name="l00117"></a>00117 <span class="preprocessor"></span>
|
|
72 |
<a name="l00119"></a>00119 <span class="keywordtype">void</span> <a class="code" href="group__xbee.html#g964a1e8461e9c1187e5d69f521e5e107" title="Initialize the XBee.">xbee_init</a>(<span class="keywordtype">void</span>);
|
|
73 |
<a name="l00121"></a>00121 <span class="keywordtype">int</span> <a class="code" href="group__xbee.html#g70c6b231330312d4f69b9a8afb5af989" title="Print a character to the XBee.">xbee_putc</a>(<span class="keywordtype">char</span> c);
|
|
74 |
<a name="l00123"></a>00123 <span class="keywordtype">int</span> <a class="code" href="group__xbee.html#g1f468ae159ba5d97bdfb3f4855d15d88" title="Read a character from the XBee.">xbee_getc</a>(<span class="keywordtype">void</span>);
|
|
75 |
<a name="l00125"></a>00125 <span class="keywordtype">int</span> <a class="code" href="group__xbee.html#gfb7bd5dd535e8251bfff78854c6c15f2" title="Read a character from the XBee without blocking.">xbee_getc_nb</a>(<span class="keywordtype">char</span> *c);
|
|
76 |
<a name="l00126"></a>00126 <span class="comment">//end addtogroup</span>
|
|
77 |
<a name="l00128"></a>00128
|
|
78 |
<a name="l00129"></a>00129 <span class="preprocessor">#endif</span>
|
|
79 |
<a name="l00130"></a>00130 <span class="preprocessor"></span>
|
|
80 |
</pre></div><hr size="1"><address style="text-align: right;"><small>Generated on Thu Nov 8 23:15:40 2007 for libdragonfly by
|
|
84 | 81 |
<a href="http://www.doxygen.org/index.html"> |
85 |
<img src="doxygen.png" alt="doxygen" align="middle" border="0"></a> 1.4.6 </small></address>
|
|
82 |
<img src="doxygen.png" alt="doxygen" align="middle" border="0"></a> 1.5.3 </small></address>
|
|
86 | 83 |
</body> |
87 | 84 |
</html> |
Also available in: Unified diff