NAME
FTDI::D2XX - Perl extension for interface to FTDI d2xx library (tested with version 0.4.16 linux, see readme for windows)
SYNOPSIS
use FTDI::D2XX;
my $FTD = FTDIId2xx->new(0); # open device with id 0
unless( $FTD->FT_Write(\@data,@data,$written) == FT_OK ) {
print "Write error";
}
# not needed due to destructor: $FTD->FT_Close();
OR
use FTDI::D2XX;
my $handle;
FTDI::D2XX::FT_Open($handle,0); # open device with id 0
unless( FTDI::D2XX::FT_Write($handle,\@data,@data,$written) == FT_OK ) {
print "Write error";
}
FTDI::D2XX::FT_Close($handle);
DESCRIPTION
This is an interface to the d2xx library from Future Technology Devices International Limited (FTDI). The basic idea for this interface comes from the Win32::FTDI:FTD2XX perl module. It was started as a port from the Windows module to linux but it became a completly new implementation. This modules does not contain any code from the Win32::FTDI:FTD2XX module. Thanks for the source code from Scott K MacPherson as a starting point.
The mainly all standard functions of the D2XX library excluding the FT_W32_* functions are implemented. The functions can be used as in the D2XX documentation or in a object oriented way.
STATUS
This is a pre-alpha version. Only small tests have been done by using a test script included in this package and an FT2232L IC. Testers are welcome.
EXPORT
FT_OK is the only default export.
Other exportable symbols are: FT_INVALID_HANDLE FT_DEVICE_NOT_FOUND FT_DEVICE_NOT_OPENED FT_IO_ERROR FT_INSUFFICIENT_RESOURCES FT_INVALID_PARAMETER FT_INVALID_BAUD_RATE FT_DEVICE_NOT_OPENED_FOR_ERASE FT_DEVICE_NOT_OPENED_FOR_WRITE FT_FAILED_TO_WRITE_DEVICE FT_EEPROM_READ_FAILED FT_EEPROM_WRITE_FAILED FT_EEPROM_ERASE_FAILED FT_EEPROM_NOT_PRESENT FT_EEPROM_NOT_PROGRAMMED FT_INVALID_ARGS FT_NOT_SUPPORTED FT_OTHER_ERROR FT_OPEN_BY_SERIAL_NUMBER FT_OPEN_BY_DESCRIPTION FT_OPEN_BY_LOCATION FT_LIST_NUMBER_ONLY FT_LIST_BY_INDEX FT_LIST_ALL FT_LIST_MASK FT_BAUD_300 FT_BAUD_600 FT_BAUD_1200 FT_BAUD_2400 FT_BAUD_4800 FT_BAUD_9600 FT_BAUD_14400 FT_BAUD_19200 FT_BAUD_38400 FT_BAUD_57600 FT_BAUD_115200 FT_BAUD_230400 FT_BAUD_460800 FT_BAUD_921600 FT_BITS_8 FT_BITS_7 FT_BITS_6 FT_BITS_5 FT_STOP_BITS_1 FT_STOP_BITS_1_5 FT_STOP_BITS_2 FT_PARITY_NONE FT_PARITY_ODD FT_PARITY_EVEN FT_PARITY_MARK FT_PARITY_SPACE FT_FLOW_NONE FT_FLOW_RTS_CTS FT_FLOW_DTR_DSR FT_FLOW_XON_XOFF FT_PURGE_RX FT_PURGE_TX FT_EVENT_RXCHAR FT_EVENT_MODEM_STATUS FT_EVENT_LINE_STATUS FT_DEFAULT_RX_TIMEOUT FT_DEFAULT_TX_TIMEOUT FT_DEVICE_BM FT_DEVICE_AM FT_DEVICE_100AX FT_DEVICE_UNKNOWN FT_DEVICE_2232C FT_DEVICE_232R FT_DEVICE_2232H FT_DEVICE_4232H FT_BITMODE_RESET FT_BITMODE_ASYNC FT_BITMODE_MPSSE FT_BITMODE_SYNC FT_BITMODE_MCUHOST FT_BITMODE_FASTOPTO FT_BITMODE_CBUS FT_BITMODE_SINGLE245 CBUS_TXDEN CBUS_PWRON CBUS_RXLED CBUS_TXLED CBUS_TXRXLED CBUS_SLEEP CBUS_CLK48 CBUS_CLK24 CBUS_CLK12 CBUS_CLK6 CBUS_IOMODE CBUS_BITBANG_WR CBUS_BITBANG_RD
FUNCTIONS and METHODS
The module provides a new constructor which connects a ftdi handle with the module by using bless. Therefore all FT_functions can be called as a method if a handle is the first parameter.
The following list describes only the differences to the original implementation by FTDI. All functions, except new() returns the status of the operation. Parameters marked by * will be changed by the function. Mosts of the * marked parameter are only feedback from the library. These scalars are not initialized by the xs code - result: $device->FT_GetBitMode($mode) works but not $device->FT_GetBitMode(\$mode) because the library generates a new variable instead of using the existing one.
New
-
Parameters: deviceID [mode]
Returns: Object Reference of the Object FTDI::D2XX
Purpose: Open a FTDI device and return the handle as a object reference. This function behaves like FT_Open with one parameter and like FT_OpenEx with two parameters.
FT_SetVIDPID
-
Parameters: Scalar, Scalar
FT_GetVIDPID
-
Parameters: Scalar*, Scalar*
FT_CreateDeviceInfoList
-
Parameters: Scalar*
FT_GetDeviceInfoDetail
-
Parameters: Scalar, Scalar*, Scalar*, Scalar*, Scalar*, Scalar*, Scalar*, Reference*
FT_Open
-
Parameters: Scalar, Reference*
FT_OpenEx
-
Parameters: Scalar, Scalar, Reference*
FT_Close
-
Parameters: Reference
FT_Read
-
Parameters: Reference, ReferenceToArray*, Scalar, Scalar*
FT_Write
-
Parameters: Reference, ReferenceToArray, Scalar, Scalar*
FT_SetBaudRate
-
Parameters: Reference, Scalar
FT_SetDivisor
-
Parameters: Reference, Scalar
FT_SetDataCharacteristics
-
Parameters: Reference, Scalar, Scalar, Scalar
FT_SetTimeouts
-
Parameters: Reference, Scalar, Scalar
FT_SetFlowControl
-
Parameters: Reference, Scalar, Scalar, Scalar
FT_SetDtr
-
Parameters: Reference
FT_ClrDtr
-
Parameters: Reference
FT_SetRts
-
Parameters: Reference
FT_ClrRts
-
Parameters: Reference
FT_GetModemStatus
-
Parameters: Reference, Scalar*
FT_GetQueueStatus
-
Parameters: Reference, Scalar*
FT_GetDeviceInfo
-
Parameters: Reference, Scalar*, Scalar*, Scalar*, Scalar*, Scalar*, Scalar
FT_GetDriverVersion
-
Parameters: Reference, Scalar* Not supported under Linux and OS X
FT_GetLibraryVersion
-
Parameters: Scalar* Not supported under Linux and OS X
FT_GetStatus
-
Parameters: Reference, Scalar*, Scalar*, Scalar*
FT_SetEventNotification
-
Currently not implemented in this module.
FT_SetChars
-
Parameters: Reference, Scalar, Scalar, Scalar, Scalar
FT_SetBreakOn
-
Parameters: Reference
FT_SetBreakOff
-
Parameters: Reference
FT_Purge
-
Parameters: Reference, Scalar
FT_ResetDevice
-
Parameters: Reference
FT_ResetPort
-
Parameters: Reference Only under Windows 2000 and higher supported.
FT_CyclePort
-
Parameters: Reference Only under Windows 2000 and higher supported.
FT_SetResetPipeRetryCount
-
Parameters: Reference, Scalar Only under Windows 2000 and higher supported.
FT_StopInTask
-
Parameters: Reference
FT_RestartInTask
-
Parameters: Reference
FT_SetDeadmanTimeout
-
Parameters: Reference, Scalar
FT_SetWaitMask
-
Parameters: Reference Not supported under Linux and OS X
FT_WaitOnMask
-
Parameters: Reference Not supported under Linux and OS X
FT_ReadEE
-
Parameters: Reference, Scalar, Scalar*
FT_WriteEE
-
Parameters: Reference, Scalar, Scalar
FT_EraseEE
-
Parameters: Reference
FT_EE_Read
-
Not implemented so far. See FT_EE_ReadToArray
FT_EE_ReadToArray
-
Parameters: Reference, ReferenceToArray* This functions read the EEPROM and saves every byte into an arrray. The conversion from array to hash will be implemented later.
FT_EE_Program
-
Not implemented so far. See FT_EE_ProgramByArray.
FT_EE_ProgramByArray
-
Parameters: Reference, ReferenceToArray This function writes to EEPROM. The conversion from hash to array will be added later.
FT_EE_UASize
-
Parameters: Reference, Scalar*
FT_EE_UARead
-
Parameters: Reference, ReferenceToArray*, Scalar, Scalar*
FT_EE_UAWrite
-
Parameters: Reference, ReferenceToArray, Scalar,
FT_SetLatencyTimer
-
Parameters: Reference, Scalar
FT_GetLatencyTimer
-
Parameters: Reference, Scalar*
FT_SetBitMode
-
Parameters: Reference, Scalar, Scalar
FT_GetBitMode
-
Parameters: Reference, Scalar*
FT_SetUSBParameters
-
Parameters: Reference, Scalar, Scalar
DEPENDENCIES
The FTDI/FTD2XX Drivers, at least CDM 2.04.16 (tested with this version under linux, see readme for windows), must be installed in conjunction with this module for it to be functional. This package does not contain the ftd2xx.h header file. Please download it from www.ftdichip.com
BUGS and THINGS TO DO
Please report bugs to me at my email address below.
See the BUGS file in the distribution for known issues and their status.
Things to Do
1) Test, test, test it
2) Complete the functions list
SEE ALSO
The list of functions showns only the difference to the FTDI D2XX Programmer's Guide. Use it as a reference.
AUTHOR
Matthias Voelker, <mvoelker@cpan.org>
COPYRIGHT AND LICENSE
Copyright (C) 2009 by Matthias Voelker This library is free software; you can redistribute it and/or modify it under the same terms as Perl itself, either Perl version 5.8.8 or, at your option, any later version of Perl 5 you may have available.
2 POD Errors
The following errors were encountered while parsing the POD:
- Around line 448:
'=item' outside of any '=over'
- Around line 679:
You forgot a '=back' before '=head1'