?lang_form? ?lang_select? ?lang_submit? ?lang_endform?
{HEADER END}
{FILE START}

library

?curdirlinks? - Rev 6

?prevdifflink? - Blame - ?getfile?

<!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: Command-line Implementation (cmdline.c)</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&nbsp;Page</a> | <a class="qindex" href="modules.html">Modules</a> | <a class="qindex" href="annotated.html">Data&nbsp;Structures</a> | <a class="qindex" href="dirs.html">Directories</a> | <a class="qindex" href="files.html">File&nbsp;List</a> | <a class="qindex" href="functions.html">Data&nbsp;Fields</a> | <a class="qindex" href="globals.html">Globals</a> | <a class="qindex" href="pages.html">Related&nbsp;Pages</a></div>
<h1>Command-line Implementation (cmdline.c)<br>
<small>
[<a class="el" href="group__general.html">General Libraries</a>]</small>
</h1><hr><a name="_details"></a><h2>Detailed Description</h2>
<div class="fragment"><pre class="fragment"><span class="preprocessor"> #include "<a class="code" href="cmdline_8h.html">cmdline.h</a>"</span> 
</pre></div> <dl compact><dt><b>Overview</b></dt><dd>This Command-Line interface library is meant to provide a reusable terminal-like user interface much like a DOS command line or UNIX terminal. A terminal with VT100 support is assumed on the user's end. Common line-editing is supported, including backspace, arrow keys, and even a small command-history buffer.</dd></dl>
<dl compact><dt><b>Note:</b></dt><dd>One can imagine more efficient ways to implement the command and function database contained in this library, however, this is a decent and functional first cut. I may someday get around to making some improvements.</dd></dl>
<dl compact><dt><b>Operation</b></dt><dd>The cmdline library does the following things for you:<ul>
<li>Prints command prompts</li><li>Gathers a command string from the user (with editing features)</li><li>Parses the command string when the user presses [ENTER]</li><li>Compares the entered command to the command database -- Executes the corresponding function if a match is found -- Reports an error if no match is found -Provides functions to retrieve the command arguments: --as strings --as decimal integers --as hex integers</li></ul>
</dd></dl>
Supported editing features include:<ul>
<li>Backspace support</li><li>Mid-line editing, inserting and deleting (left/right-arrows)</li><li>Command History (up-arrow) (currently only one command deep)</li></ul>
<p>
To use the cmdline system, you will need to associate command strings (commands the user will be typing) with your function that you wish to have called when the user enters that command. This is done by using the <a class="el" href="group__cmdline.html#ga2">cmdlineAddCommand()</a> function.<p>
To setup the cmdline system, you must do these things:<ul>
<li>Initialize it: <a class="el" href="group__cmdline.html#ga1">cmdlineInit()</a></li><li>Add one or more commands to the database: <a class="el" href="group__cmdline.html#ga2">cmdlineAddCommand()</a></li><li>Set an output function for your terminal: <a class="el" href="group__cmdline.html#ga3">cmdlineSetOutputFunc()</a></li></ul>
<p>
To operate the cmdline system, you must do these things repeatedly:<ul>
<li>Pass user input from the terminal to: <a class="el" href="group__cmdline.html#ga3">cmdlineSetOutputFunc()</a></li><li>Call <a class="el" href="group__cmdline.html#ga5">cmdlineMainLoop()</a> from your program's main loop</li></ul>
<p>
The cmdline library does not assume an input or output device, but can be configured to use any user function for output using <a class="el" href="group__cmdline.html#ga3">cmdlineSetOutputFunc()</a> and accepts input by calling <a class="el" href="group__cmdline.html#ga4">cmdlineInputFunc()</a>. This means the cmdline library can operate over any interface including UART (serial port), I2c, ethernet, etc.<p>
FOR MORE INFORMATION ABOUT USING cmdline SEE THE AVRLIB EXAMPLE ***** CODE IN THE avrlib/examples DIRECTORY ***** 
<p>
<table border="0" cellpadding="0" cellspacing="0">
<tr><td></td></tr>
<tr><td colspan="2"><br><h2>Typedefs</h2></td></tr>
<tr><td class="memItemLeft" nowrap align="right" valign="top"><a class="anchor" name="ga0" doxytag="cmdline::CmdlineFuncPtrType"></a>
typedef void(*&nbsp;</td><td class="memItemRight" valign="bottom"><b>CmdlineFuncPtrType</b> )(void)</td></tr>

<tr><td colspan="2"><br><h2>Functions</h2></td></tr>
<tr><td class="memItemLeft" nowrap align="right" valign="top"><a class="anchor" name="ga1" doxytag="cmdline::cmdlineInit"></a>
void&nbsp;</td><td class="memItemRight" valign="bottom"><a class="el" href="group__cmdline.html#ga1">cmdlineInit</a> (void)</td></tr>

<tr><td class="mdescLeft">&nbsp;</td><td class="mdescRight">initalize the command line system <br></td></tr>
<tr><td class="memItemLeft" nowrap align="right" valign="top"><a class="anchor" name="ga2" doxytag="cmdline::cmdlineAddCommand"></a>
void&nbsp;</td><td class="memItemRight" valign="bottom"><a class="el" href="group__cmdline.html#ga2">cmdlineAddCommand</a> (u08 *newCmdString, CmdlineFuncPtrType newCmdFuncPtr)</td></tr>

<tr><td class="mdescLeft">&nbsp;</td><td class="mdescRight">add a new command to the database of known commands <br></td></tr>
<tr><td class="memItemLeft" nowrap align="right" valign="top"><a class="anchor" name="ga3" doxytag="cmdline::cmdlineSetOutputFunc"></a>
void&nbsp;</td><td class="memItemRight" valign="bottom"><a class="el" href="group__cmdline.html#ga3">cmdlineSetOutputFunc</a> (void(*output_func)(unsigned char c))</td></tr>

<tr><td class="mdescLeft">&nbsp;</td><td class="mdescRight">sets the function used for sending characters to the user terminal <br></td></tr>
<tr><td class="memItemLeft" nowrap align="right" valign="top"><a class="anchor" name="ga4" doxytag="cmdline::cmdlineInputFunc"></a>
void&nbsp;</td><td class="memItemRight" valign="bottom"><a class="el" href="group__cmdline.html#ga4">cmdlineInputFunc</a> (unsigned char c)</td></tr>

<tr><td class="mdescLeft">&nbsp;</td><td class="mdescRight">call this function to pass input charaters from the user terminal <br></td></tr>
<tr><td class="memItemLeft" nowrap align="right" valign="top"><a class="anchor" name="ga5" doxytag="cmdline::cmdlineMainLoop"></a>
void&nbsp;</td><td class="memItemRight" valign="bottom"><a class="el" href="group__cmdline.html#ga5">cmdlineMainLoop</a> (void)</td></tr>

<tr><td class="mdescLeft">&nbsp;</td><td class="mdescRight">call this function in your program's main loop <br></td></tr>
<tr><td class="memItemLeft" nowrap align="right" valign="top"><a class="anchor" name="ga6" doxytag="cmdline::cmdlineRepaint"></a>
void&nbsp;</td><td class="memItemRight" valign="bottom"><b>cmdlineRepaint</b> (void)</td></tr>

<tr><td class="memItemLeft" nowrap align="right" valign="top"><a class="anchor" name="ga7" doxytag="cmdline::cmdlineDoHistory"></a>
void&nbsp;</td><td class="memItemRight" valign="bottom"><b>cmdlineDoHistory</b> (u08 action)</td></tr>

<tr><td class="memItemLeft" nowrap align="right" valign="top"><a class="anchor" name="ga8" doxytag="cmdline::cmdlineProcessInputString"></a>
void&nbsp;</td><td class="memItemRight" valign="bottom"><b>cmdlineProcessInputString</b> (void)</td></tr>

<tr><td class="memItemLeft" nowrap align="right" valign="top"><a class="anchor" name="ga9" doxytag="cmdline::cmdlinePrintPrompt"></a>
void&nbsp;</td><td class="memItemRight" valign="bottom"><b>cmdlinePrintPrompt</b> (void)</td></tr>

<tr><td class="memItemLeft" nowrap align="right" valign="top"><a class="anchor" name="ga10" doxytag="cmdline::cmdlinePrintError"></a>
void&nbsp;</td><td class="memItemRight" valign="bottom"><b>cmdlinePrintError</b> (void)</td></tr>

<tr><td class="memItemLeft" nowrap align="right" valign="top"><a class="anchor" name="ga11" doxytag="cmdline::cmdlineGetArgStr"></a>
u08 *&nbsp;</td><td class="memItemRight" valign="bottom"><a class="el" href="group__cmdline.html#ga11">cmdlineGetArgStr</a> (u08 argnum)</td></tr>

<tr><td class="mdescLeft">&nbsp;</td><td class="mdescRight">returns a string pointer to argument number [argnum] on the command line <br></td></tr>
<tr><td class="memItemLeft" nowrap align="right" valign="top"><a class="anchor" name="ga12" doxytag="cmdline::cmdlineGetArgInt"></a>
long&nbsp;</td><td class="memItemRight" valign="bottom"><a class="el" href="group__cmdline.html#ga12">cmdlineGetArgInt</a> (u08 argnum)</td></tr>

<tr><td class="mdescLeft">&nbsp;</td><td class="mdescRight">returns the decimal integer interpretation of argument number [argnum] <br></td></tr>
<tr><td class="memItemLeft" nowrap align="right" valign="top"><a class="anchor" name="ga13" doxytag="cmdline::cmdlineGetArgHex"></a>
long&nbsp;</td><td class="memItemRight" valign="bottom"><a class="el" href="group__cmdline.html#ga13">cmdlineGetArgHex</a> (u08 argnum)</td></tr>

<tr><td class="mdescLeft">&nbsp;</td><td class="mdescRight">returns the hex integer interpretation of argument number [argnum] <br></td></tr>
</table>
<hr size="1"><address style="align: right;"><small>Generated on Sun Oct 29 03:41:09 2006 for Procyon AVRlib by&nbsp;
<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>
{FILE END}
{FOOTER START}

Powered by WebSVN v2.8.3