#FTD2XX.jl API
For complete documentation see D2XX Programer's Guide
Returns number of devices.
Returns device information list. Device information list is an array of type FtDeviceListInfoNode. The fields of FtDeviceListInfoNode are flags, devicetype, id, locid, serialnumber,description, handle.
Example:
deviceinformationlist = ft_getdeviceinfolist()
Returns handle to device. Device indexes start at zero.
Returns handle to device. ft_openex allows devices to be opened by location id, serial number or description.
Example:
ft_handle = ft_openex(0x0314) # open by location
ft_handle = ft_openex(FT_SerialNumber("FTXRNZUJ")) # open by serial number
ft_handle = ft_openex(FT_Description("C232HM-EDHSL-0")) # open by description
Closes device with handle ft_handle.
Returns number of bytes returned. Data is returned by modifying buffer. Function does not return until all bytes have been received or timeout.
Returns number of bytes written. If bytestowrite is unspecified it is assumed to be the length of the buffer.
Sets the baud rate.
ft_setdatacharacteristics(ft_handle::Culong, wordlength::Integer, stopbits::Integer, parity::Integer)
Sets word length, stop bits and parity.
the following constants are exported for use with this function:
#Word Length
const FT_BITS_8 = 8
const FT_BITS_7 = 7
#Stop Bits
const FT_STOP_BITS_1 = 0
const FT_STOP_BITS_2 = 2
#Parity
const FT_PARITY_NONE = 0
const FT_PARITY_ODD = 1
const FT_PARITY_EVEN = 2
const FT_PARITY_MARK = 3
const FT_PARITY_SPACE = 4
Sets read and write timeouts in milliseconds.
Sets flow control and xon and xoff characters.
The following constants are exported:
#Flow Control
const FT_FLOW_NONE = 0x0000
const FT_FLOW_RTS_CTS = 0x0100
const FT_FLOW_DTR_DSR = 0x0200
const FT_FLOW_XON_XOFF = 0x0400
Sets DTR.
Clears DTR.
Sets RTS.
Clears RTS.
Returns modem status.
The following constants are exported:
#Modem Status (least significant byte)
const CTS = 0x10
const DSR = 0x20
const RI = 0x40
const DCD = 0x80
#Line Status (second least significant byte)
const OE = 0x02
const PE = 0x04
const FE = 0x08
const BI = 0x10
Returns number of bytes in Rx queue.
Returns tuple (devicetype, deviceid, serialnumber, description)
Sets condition for event notification.
The following constants are exported:
# Notification Events
const FT_EVENT_RXCHAR = 1
const FT_EVENT_MODEM_STATUS = 2
const FT_EVENT_LINE_STATUS = 4
Returns tuple (bytesinrxqueue, bytesintxqueue, eventstatus)
Sets and enables event and error characters.
Sets the break condition for the device.
Resets the break condition for the device.
Purge Tx and Rx buffers.
The following constants are exported:
const FT_PURGE_RX = 1
const FT_PURGE_TX = 2
Sends reset command to device.
Puts drivers in task into a wait state.
Restarts the driver's in task.
Sets deadman timeout in milliseconds.
Returns word (16bits) in EEPROM at wordoffset.
Writes a value to EEPROM at wordoffset.
###ft_eraseee(ft_handle::Culong) Erase the device EEPROM.
Returns type FtProgramData.
Programs device EEPROM with FtProgramData.
Example:
# assumes device with ft_handle has been opened.
programdata = ft_ee_read(ft_handle) # read the program data
programdata.Description = "NewDescription" # change a value
ft_ee_program(ft_handle, programdata) # write back to device
Type FtProgramData mirrors FTD2XX's FT_PROGRAM_DATA_STRUCTURE converting pointers to julia strings. See FTDI's documentation for a complete description of FT_PROGRAM_DATA_STRUCTURE and associated constants.
Returns the size of the user EEPROM area in bytes.
Reads length(buffer) bytes of the user EEPROM into buffer. Returns number of bytes read.
Writes buffer to user EEPROM. length(buffer) must be less than or equal to the size of the EEPROM user area.
Sets time in milliseconds to wait before flushing the receive buffer.
Returns the value of the latency timer in milliseconds.
Sets bit mode and bit mask. Bit mask determines which bits are inputs and outputs.
The following constants are exported:
const FT_BITMODE_RESET = 0x00
const FT_BITMODE_ASYNC_BITBANG = 0x01
const FT_BITMODE_MPSSE = 0x02
const FT_BITMODE_SYNC_BITBANG = 0x04
const FT_BITMODE_MCU_HOST = 0x08
const FT_BITMODE_FAST_SERIAL = 0x10
const FT_BITMODE_CBUS_BITBANG = 0x20
const FT_BITMODE_SYNC_FIFO = 0x40
Returns the bit mode.
ft_setusbparameters(ft_handle::Culong, intransfersize::Integer = 4096, outtransfersize::Integer = 4096)
Sets the USB input and output transfer size. Must be a multiple of 64 between 64 and 64k.
Return tuple (vid,pid) of vendor id and product id.
Adds the vendor id and product id to the table of vid's and pid's the driver will work with.
Returns driver version as a julia VersionNumber.
Returns the version of the dll as a julia VersionNumber.
Returns com port number where device is attached.
Read data from EEPROM into a device specific type. Returns tuple (eepromdata, mfg, mfgid, description, serialnumber). The second form, passing only ft_handle is perfered. Note if passed as a parameter, eepromdata is overwritten.
ft_eeprom_program(ft_handle::Culong, eepromdata::eeprom, mfg::ASCIIString,mfgid::ASCIIString, description::ASCIIString, serialnumber::ASCIIString)
Write data in a device specific type to EEPROM.
The device specific types are Fteeprom232b, Fteeprom2232, Fteeprom232r, Fteeprom2232h, Fteeprom4232h, Fteeprom232h, Fteepromxseries. Constructors for these types set the deviceType field to the appropriate constant, leaving the rest of the structure uninitialized.
The deviceType constants are:
const FT_DEVICE_232BM = 0 # for type Fteeprom232b <: Eeprom
const FT_DEVICE_232AM = 1 # discontinued device
const FT_DEVICE_100AX = 2 # discontinued device
const FT_DEVICE_UNKNOWN = 3
const FT_DEVICE_2232C = 4 # for type Fteeprom2232 <: Eeprom
const FT_DEVICE_232R = 5 # for type Fteeprom232r <: Eeprom
const FT_DEVICE_2232H = 6 # for type Fteeprom2232h <: Eeprom
const FT_DEVICE_4232H = 7 # for type Fteeprom4232h <: Eeprom
const FT_DEVICE_232H = 8 # for type Fteeprom232h <: Eeprom
const FT_DEVICE_X_SERIES = 9 # for type Fteepromxseries <: Eeprom
Example:
# assumes device with handle h is open and is device type FT_DEVICE_232H
(eepromdata,mfg,mfgid,d,sn) = ft_eeprom_read(h) # read EEPROM, autodetect type
eepromdata.PowerSaveEnable = 0x00 # change a parameter
ft_eeprom_program(h,eepromdata,mfg,mfgid,d,sn) # write back to device
# you can specify the device type. It will autodetect if not incuded.
(eepromdata,mfg,mfgid,d,sn) = ft_eeprom_read(h,Fteeprom232h()) # read EEPROM