Application Note
AN_329 User Guide For LibFT4222
Version 1.5
Document Reference No.: FT_001060 Clearance No.: FTDI#406
10
Product Page
Document Feedback Copyright © Future Technology Devices International Limited
3 Application Programming Interface (API)
LibFT4222 supports SPI, I
2
C and GPIO communication using high-level APIs. In addition, it
provides chip configuration APIs, such as FT4222_SetClock.
After calling FT_Open, the FT4222H is required to be initialized by one of the following initial
functions:
FT4222_SPIMaster_Init
FT4222_SPISlave_Init
FT4222_I2CMaster_Init
FT4222_I2CSlave_Init
FT4222_GPIO_Init
The initialization functions help developers to switch the FT4222H into a specific mode.
At the end of the application, FT4222_Uninitialize should be called to release allocated resources,
before calling FT_Close.
All the APIs return an FT4222_STATUS, which extends FT_STATUS that is defined in the D2XX
driver. FT4222_STATUS defines additional values to report FT4222H specific status.
All definitions with prefix “FT_” is defined in the D2XX driver.
3.1 Typedefs
The following typedefs have been defined for keeping cross platform portability:
typedef unsigned long DWORD
typedef unsigned char uint8
typedef unsigned short uint16
typedef unsigned long uint32
typedef signed char int8
typedef signed short int16
typedef signed long int32
typedef unsigned char bool
Please refer to Appendix A for more enumeration and structure definitions.
3.2 FT4222 General Functions
The functions listed in this section are system-wise configuration functions.
3.2.1 Open and Close
An application of LibFT4222 should open the device and get a handle for subsequent accesses by
calling FT_Open or FT_OpenEx. Both are D2XX API. Please refer to the D2XX Programmers Guide
for more details. In addition, please note that the FT4222H assigns different functions to different
interfaces. For example, under mode 0, interface A is assigned as SPI or I
2
C interface, and
interface B is assigned as GPIO interface.
After finishing using the device, FT_Close should be called to release the device.
3.2.2 Un-initialize
FT4222_STATUS FT4222_UnInitialize (FT_HANDLE ftHandle)
Supported Chip: