
Device::FTDI - perl extension to talk to FTDI chips

Version 0.05

use Device::FTDI;
my $dev = Device::FTDI->new();
...

WARNING: this is an alpha version
This is Perl bindings to libftdi library. It allows you to communicate with FTDI chips supported by this library.

Finds all connected devices with specified vendor and product codes. Returns list of hashes describing devices. Following parameters are accepted:
Opens specified device and returns the corresponding object refference. Dies if an attempt to open the device has failed. Accepts following parameters:
vendor code. Default 0x0403.
product code. Default 0x6001.
device description string. By default undefined.
device serial ID. By default undefined.
device index. By default 0.

Most of device methods return negative value in case of error. You can get error description using "error_string" method.
Returns string describing error after last operation
Resets the device
Open selected channels on a chip, otherwise use first channel. $interface may be one of: INTERFACE_A, INTERFACE_B, INTERFACE_C, INTERFACE_D, or INTERFACE_ANY.
Clears the read buffer on the chip and the internal read buffer. Returns 0 on success or negative error code otherwise.
Clears the write buffer on the chip. Returns 0 on success or negative error code otherwise.
Clears the buffers on the chip and the internal read buffer. Returns 0 on success or negative error code otherwise.
Set flow control for ftdi chip. Allowed values for $flowctrl are: FLOW_RTS_CTS, FLOW_DTR_DSR, FLOW_XON_XOFF, FLOW_DISABLE. Returns 0 on success or negative error code otherwise.
Sets line characteristics. Last parameters may be ommited. Following values are acceptable for parameters (* marks default value):
BITS_7, BITS_8 (*)
STOP_BIT_1, STOP_BIT_2, STOP_BIT_15 (*)
PARITY_NONE (*), PARITY_EVEN, PARITY_ODD, PARITY_MARK, PARITY_SPACE
BREAK_OFF (*), BREAK_ON
Note, that you have to import constants you need. You can import all constants using :all tag.
Returns 0 on success or negative error code otherwise.
Sets the chip baudrate. Returns 0 on success or negative error code otherwise.
Sets latency timer. The FTDI chip keeps data in the internal buffer for a specific amount of time if the buffer is not full yet to decrease load on the usb bus. Latency must be between 1 and 255.
Returns 0 on success or negative error code otherwise.
Returns latency timer value or negative error code.
Sets write buffer chunk size. Default 4096. Returns 0 on success or negative error code otherwise.
Returns write buffer chunk size or negative error code.
Sets read buffer chunk size. Default 4096. Returns 0 on success or negative error code otherwise.
Returns read buffer chunk size or negative error code.
Writes data to the chip in chunks. Returns number of bytes written on success or negative error code otherwise.
Reads data from the chip (up to $size bytes) and stores it in $buffer. Returns when at least one byte is available or when the latency timer has elapsed. Automatically strips the two modem status bytes transfered during every read.
Returns number of bytes read on success or negative error code otherwise. Note, that if no data available it will return 0.
Enable/disable bitbang modes. $mask -- bitmask to configure lines, High/ON value configures a line as output. $mode may be one of the following: BITMODE_RESET, BITMODE_BITBANG, BITMODE_MPSSE, BITMODE_SYNCBB, BITMODE_MCU, BITMODE_OPTO, BITMODE_CBUS, BITMODE_SYNCFF.

FTDI, Win32::FTDI::FTD2XX, http://www.intra2net.com/en/developer/libftdi/

Pavel Shaydo, <zwon at cpan.org>

Please report any bugs or feature requests via GitHub bugtracker for this project: https://github.com/trinitum/perl-Device-FTDI/issues.

Copyright 2012 Pavel Shaydo.
This program is free software; you can redistribute it and/or modify it under the terms of either: the GNU General Public License as published by the Free Software Foundation; or the Artistic License.
See http://dev.perl.org/licenses/ for more information.