<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> <html xmlns="http://www.w3.org/1999/xhtml"> <head> <meta http-equiv="Content-Type" content="text/xhtml;charset=UTF-8"/> <title>libftdi: libftdi API documentation</title> <link href="tabs.css" rel="stylesheet" type="text/css"/> <link href="doxygen.css" rel="stylesheet" type="text/css"/> </head> <body> <!-- Generated by Doxygen 1.6.2-20100208 --> <div class="navigation" id="top"> <div class="tabs"> <ul> <li class="current"><a href="index.html"><span>Main Page</span></a></li> <li><a href="pages.html"><span>Related Pages</span></a></li> <li><a href="modules.html"><span>Modules</span></a></li> <li><a href="namespaces.html"><span>Namespaces</span></a></li> <li><a href="annotated.html"><span>Classes</span></a></li> <li><a href="files.html"><span>Files</span></a></li> </ul> </div> </div> <div class="contents"> <h1>libftdi API documentation </h1><h3 class="version">0.17 </h3><p>Library to talk to FTDI chips. You find the latest versions of libftdi at <a href="http://www.intra2net.com/en/developer/libftdi/">http://www.intra2net.com/en/developer/libftdi/</a></p> <p>The library is easy to use. Have a look at this short example: </p> <div class="fragment"><pre class="fragment"><span class="comment">/* simple.c</span> <span class="comment"></span> <span class="comment"> Simple libftdi usage example</span> <span class="comment"></span> <span class="comment"> This program is distributed under the GPL, version 2</span> <span class="comment">*/</span> <span class="preprocessor">#include <stdio.h></span> <span class="preprocessor">#include <<a class="code" href="ftdi_8h.html">ftdi.h</a>></span> <span class="keywordtype">int</span> main(<span class="keywordtype">void</span>) { <span class="keywordtype">int</span> ret; <span class="keyword">struct </span><a class="code" href="structftdi__context.html" title="Main context structure for all libftdi functions.">ftdi_context</a> ftdic; <span class="keywordflow">if</span> (<a class="code" href="group__libftdi.html#ga21e2ed53cad4fa8242022afe1e12d2ee">ftdi_init</a>(&ftdic) < 0) { fprintf(stderr, <span class="stringliteral">"ftdi_init failed\n"</span>); <span class="keywordflow">return</span> EXIT_FAILURE; } <span class="keywordflow">if</span> ((ret = <a class="code" href="group__libftdi.html#ga95d4689db18fc1fd70011f6504ab8c40">ftdi_usb_open</a>(&ftdic, 0x0403, 0x6001)) < 0) { fprintf(stderr, <span class="stringliteral">"unable to open ftdi device: %d (%s)\n"</span>, ret, <a class="code" href="group__libftdi.html#ga28c84d963760d7396e5a2992e63a9354">ftdi_get_error_string</a>(&ftdic)); <span class="keywordflow">return</span> EXIT_FAILURE; } <span class="comment">// Read out FTDIChip-ID of R type chips</span> <span class="keywordflow">if</span> (ftdic.type == <a class="code" href="ftdi_8h.html#a026dc3f26fbc7f5ef67c75f0739385cea60949f421ca5df446c9fb4322093bc8a">TYPE_R</a>) { <span class="keywordtype">unsigned</span> <span class="keywordtype">int</span> chipid; printf(<span class="stringliteral">"ftdi_read_chipid: %d\n"</span>, <a class="code" href="group__libftdi.html#gab978a76c2cc0dbfbc1fd6350db848300">ftdi_read_chipid</a>(&ftdic, &chipid)); printf(<span class="stringliteral">"FTDI chipid: %X\n"</span>, chipid); } <span class="keywordflow">if</span> ((ret = <a class="code" href="group__libftdi.html#ga9536eff48c7ae9313b2a97320743ee3b">ftdi_usb_close</a>(&ftdic)) < 0) { fprintf(stderr, <span class="stringliteral">"unable to close ftdi device: %d (%s)\n"</span>, ret, <a class="code" href="group__libftdi.html#ga28c84d963760d7396e5a2992e63a9354">ftdi_get_error_string</a>(&ftdic)); <span class="keywordflow">return</span> EXIT_FAILURE; } <a class="code" href="group__libftdi.html#ga72838200be98d88737d532f9eee1e7be">ftdi_deinit</a>(&ftdic); <span class="keywordflow">return</span> EXIT_SUCCESS; } </pre></div><p>More examples can be found in the "examples" directory. </p> </div> <hr size="1"><address style="text-align: right;"><small> Generated for libftdi by <a href="http://www.doxygen.org/ index.html"><img src="doxygen.png" alt="doxygen" align="middle" border="0"></a> 1.6.2-20100208</small></address> </body> </html>