📄 uartsw2_8h-source.html
字号:
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"><html><head><meta http-equiv="Content-Type" content="text/html;charset=iso-8859-1"><title>Procyon AVRlib: uartsw2.h Source File</title><link href="dox.css" rel="stylesheet" type="text/css"></head><body><!-- Generated by Doxygen 1.4.2 --><div class="qindex"><a class="qindex" href="main.html">Main Page</a> | <a class="qindex" href="modules.html">Modules</a> | <a class="qindex" href="annotated.html">Data Structures</a> | <a class="qindex" href="dirs.html">Directories</a> | <a class="qindex" href="files.html">File List</a> | <a class="qindex" href="functions.html">Data Fields</a> | <a class="qindex" href="globals.html">Globals</a> | <a class="qindex" href="pages.html">Related Pages</a></div><h1>uartsw2.h</h1><a href="uartsw2_8h.html">Go to the documentation of this file.</a><div class="fragment"><pre class="fragment">00001 <span class="comment">/*! \file uartsw2.h \brief Software Interrupt-driven UART Driver. */</span>00002 <span class="comment">//*****************************************************************************</span>00003 <span class="comment">//</span>00004 <span class="comment">// File Name : 'uartsw2.h'</span>00005 <span class="comment">// Title : Software Interrupt-driven UART Driver</span>00006 <span class="comment">// Author : Pascal Stang - Copyright (C) 2002-2003</span>00007 <span class="comment">// Created : 7/20/2002</span>00008 <span class="comment">// Revised : 4/27/2004</span>00009 <span class="comment">// Version : 0.6</span>00010 <span class="comment">// Target MCU : Atmel AVR Series (intended for the ATmega16 and ATmega32)</span>00011 <span class="comment">// Editor Tabs : 4</span>00012 <span class="comment">//</span><span class="comment"></span>00013 <span class="comment">/// \ingroup driver_sw</span>00014 <span class="comment">/// \defgroup uartsw2 Software Interrupt-driven UART Driver (uartsw2.c)</span>00015 <span class="comment">/// \code #include "uartsw2.h" \endcode</span>00016 <span class="comment">/// \par Overview</span>00017 <span class="comment">/// This uart library emulates the operation of a UART (serial port) using</span>00018 <span class="comment">/// the AVR's hardware timers, I/O pins, and some software.</span>00019 <span class="comment">///</span>00020 <span class="comment">/// Specifically, this code uses:</span>00021 <span class="comment">/// -Timer 2 Output Capture for transmit timing</span>00022 <span class="comment">/// -Timer 0 Output Capture for receive timing</span>00023 <span class="comment">/// -External Interrupt 2 for receive triggering</span>00024 <span class="comment">///</span>00025 <span class="comment">/// The above resources cannot be used for other purposes while this software</span>00026 <span class="comment">/// UART is enabled. The overflow interrupts from Timer0 and Timer2 can still</span>00027 <span class="comment">/// be used for other timing, but the prescalers for these timers must not be</span>00028 <span class="comment">/// changed.</span>00029 <span class="comment">///</span>00030 <span class="comment">/// Serial output from this UART can be routed to any I/O pin. Serial input</span>00031 <span class="comment">/// for this UART must come from the External Interrupt 2 (INT2) I/O pin.</span>00032 <span class="comment">/// These options should be configured by editing your local copy of</span>00033 <span class="comment">/// "uartsw2conf.h".</span>00034 <span class="comment"></span><span class="comment">//</span>00035 <span class="comment">// This code is distributed under the GNU Public License</span>00036 <span class="comment">// which can be found at http://www.gnu.org/licenses/gpl.txt</span>00037 <span class="comment">//</span>00038 <span class="comment">//*****************************************************************************</span>00039 00040 <span class="preprocessor">#ifndef UARTSW2_H</span>00041 <span class="preprocessor"></span><span class="preprocessor">#define UARTSW2_H</span>00042 <span class="preprocessor"></span>00043 <span class="preprocessor">#include "<a class="code" href="global_8h.html">global.h</a>"</span>00044 <span class="preprocessor">#include "<a class="code" href="buffer_8h.html">buffer.h</a>"</span>00045 00046 <span class="comment">// include configuration</span>00047 <span class="preprocessor">#include "<a class="code" href="uartsw2conf_8h.html">uartsw2conf.h</a>"</span>00048 00049 <span class="comment">// constants/macros/typdefs</span>00050 00051 <span class="comment">// functions</span>00052 <span class="comment"></span>00053 <span class="comment">//! enable and initialize the software uart</span>00054 <span class="comment"></span><span class="keywordtype">void</span> <a class="code" href="uartsw_8c.html#a9">uartswInit</a>(<span class="keywordtype">void</span>);<span class="comment"></span>00055 <span class="comment">//! create and initialize the uart buffers</span>00056 <span class="comment"></span><span class="keywordtype">void</span> <a class="code" href="uartsw_8c.html#a10">uartswInitBuffers</a>(<span class="keywordtype">void</span>);<span class="comment"></span>00057 <span class="comment">//! turns off software UART</span>00058 <span class="comment"></span><span class="keywordtype">void</span> <a class="code" href="uartsw_8c.html#a11">uartswOff</a>(<span class="keywordtype">void</span>);<span class="comment"></span>00059 <span class="comment">//! returns the receive buffer structure </span>00060 <span class="comment"></span><a class="code" href="structstruct__cBuffer.html">cBuffer</a>* <a class="code" href="uartsw_8c.html#a13">uartswGetRxBuffer</a>(<span class="keywordtype">void</span>);<span class="comment"></span>00061 <span class="comment">//! sets the uart baud rate</span>00062 <span class="comment"></span><span class="keywordtype">void</span> <a class="code" href="uartsw_8c.html#a12">uartswSetBaudRate</a>(u32 baudrate);<span class="comment"></span>00063 <span class="comment">//! sends a single byte over the uart</span>00064 <span class="comment"></span><span class="keywordtype">void</span> <a class="code" href="uartsw_8c.html#a14">uartswSendByte</a>(u08 data);00065 <span class="comment"></span>00066 <span class="comment">//! gets a single byte from the uart receive buffer</span>00067 <span class="comment"></span><span class="comment">// Function returns TRUE if data was available, FALSE if not.</span>00068 <span class="comment">// Actual data is returned in variable pointed to by "data".</span>00069 <span class="comment">// example usage:</span>00070 <span class="comment">// char myReceivedByte;</span>00071 <span class="comment">// uartswReceiveByte( &myReceivedByte );</span>00072 u08 <a class="code" href="uartsw_8c.html#a15">uartswReceiveByte</a>(u08* rxData);00073 <span class="comment"></span>00074 <span class="comment">//! internal transmit bit handler</span>00075 <span class="comment"></span><span class="keywordtype">void</span> <a class="code" href="uartsw_8c.html#a16">uartswTxBitService</a>(<span class="keywordtype">void</span>);<span class="comment"></span>00076 <span class="comment">//! internal receive bit handler</span>00077 <span class="comment"></span><span class="keywordtype">void</span> <a class="code" href="uartsw_8c.html#a17">uartswRxBitService</a>(<span class="keywordtype">void</span>);00078 00079 <span class="preprocessor">#endif</span></pre></div><hr size="1"><address style="align: right;"><small>Generated on Mon Oct 24 16:03:55 2005 for Procyon AVRlib by <a href="http://www.doxygen.org/index.html"><img src="doxygen.png" alt="doxygen" align="middle" border="0"></a> 1.4.2 </small></address></body></html>
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -