libftdi 0.20

- Main Page
- Related Pages
- Modules
- Namespaces
- Classes
- Files

libftdi API documentation

Library to talk to FTDI chips. You find the latest versions of libftdi at http://www.intra2net.com/en/developer/libftdi/

The library is easy to use. Have a look at this short example:

/* simple.c
Simple libftdi usage example
This program is distributed under the GPL, version 2
*/
#include <stdio.h>
#include <ftdi.h>
int main(void)
{
int ret;
struct ftdi_context ftdic;
if (ftdi_init(&ftdic) < 0)
{
fprintf(stderr, "ftdi_init failed\n");
return EXIT_FAILURE;
}
if ((ret = ftdi_usb_open(&ftdic, 0x0403, 0x6001)) < 0)
{
fprintf(stderr, "unable to open ftdi device: %d (%s)\n", ret, ftdi_get_error_string(&ftdic));
return EXIT_FAILURE;
}
// Read out FTDIChip-ID of R type chips
if (ftdic.type == TYPE_R)
{
unsigned int chipid;
printf("ftdi_read_chipid: %d\n", ftdi_read_chipid(&ftdic, &chipid));
printf("FTDI chipid: %X\n", chipid);
}
if ((ret = ftdi_usb_close(&ftdic)) < 0)
{
fprintf(stderr, "unable to close ftdi device: %d (%s)\n", ret, ftdi_get_error_string(&ftdic));
return EXIT_FAILURE;
}
ftdi_deinit(&ftdic);
return EXIT_SUCCESS;
}

More examples can be found in the "examples" directory.