Intra2net AG

libftdi1  1.5
libftdi API documentation

Library to talk to FTDI chips. You find the latest versions of libftdi at https://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 <stdlib.h>
#include <ftdi.h>
int main(void)
{
int ret;
struct ftdi_context *ftdi;
struct ftdi_version_info version;
if ((ftdi = ftdi_new()) == 0)
{
fprintf(stderr, "ftdi_new failed\n");
return EXIT_FAILURE;
}
printf("Initialized libftdi %s (major: %d, minor: %d, micro: %d, snapshot ver: %s)\n",
version.version_str, version.major, version.minor, version.micro,
version.snapshot_str);
if ((ret = ftdi_usb_open(ftdi, 0x0403, 0x6001)) < 0)
{
fprintf(stderr, "unable to open ftdi device: %d (%s)\n", ret, ftdi_get_error_string(ftdi));
ftdi_free(ftdi);
return EXIT_FAILURE;
}
// Read out FTDIChip-ID of R type chips
if (ftdi->type == TYPE_R)
{
unsigned int chipid;
printf("ftdi_read_chipid: %d\n", ftdi_read_chipid(ftdi, &chipid));
printf("FTDI chipid: %X\n", chipid);
}
if ((ret = ftdi_usb_close(ftdi)) < 0)
{
fprintf(stderr, "unable to close ftdi device: %d (%s)\n", ret, ftdi_get_error_string(ftdi));
ftdi_free(ftdi);
return EXIT_FAILURE;
}
ftdi_free(ftdi);
return EXIT_SUCCESS;
}

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

ftdi_usb_close
int ftdi_usb_close(struct ftdi_context *ftdi)
Definition: ftdi.c:1197
TYPE_R
@ TYPE_R
Definition: ftdi.h:51
ftdi.h
ftdi_new
struct ftdi_context * ftdi_new(void)
Definition: ftdi.c:132
ftdi_context::type
enum ftdi_chip_type type
Definition: ftdi.h:285
ftdi_get_library_version
struct ftdi_version_info ftdi_get_library_version(void)
Get libftdi library version.
Definition: ftdi.c:285
ftdi_get_error_string
const char * ftdi_get_error_string(struct ftdi_context *ftdi)
Definition: ftdi.c:4731
ftdi_usb_open
int ftdi_usb_open(struct ftdi_context *ftdi, int vendor, int product)
Definition: ftdi.c:707
ftdi_version_info
Definition: ftdi.h:505
ftdi_context
Main context structure for all libftdi functions.
Definition: ftdi.h:271
ftdi_free
void ftdi_free(struct ftdi_context *ftdi)
Definition: ftdi.c:260
ftdi_read_chipid
int ftdi_read_chipid(struct ftdi_context *ftdi, unsigned int *chipid)
Definition: ftdi.c:4520
© Intra2net AG 2024 | Legal | Contact