Application Note
AN_329 User Guide For LibFT4222
Version 1.5
Document Reference No.: FT_001060 Clearance No.: FTDI#406
65
Product Page
Document Feedback Copyright © Future Technology Devices International Limited
Error code:
FT4222_DEVICE_NOT_OPENED: The initialization API is not called.
FT4222_GPIO_NOT_SUPPORTED_IN_THIS_MODE: GPIO function is not supported in mode 2 and
mode 3
Example:
// this is an example for gpio read
FT_HANDLE ftHandle = NULL;
FT_STATUS ftStatus;
FT4222_STATUS ft4222Status;
ftStatus = FT_OpenEx("FT4222 B",FT_OPEN_BY_DESCRIPTION, &ftHandle);
if (FT_OK != ftStatus)
{
// open failed
return;
}
GPIO_Dir gpioDir[4];
gpioDir[0] = GPIO_INPUT;
gpioDir[1] = GPIO_INPUT;
gpioDir[2] = GPIO_INPUT;
gpioDir[3] = GPIO_INPUT;
FT4222_GPIO_Init(ftHandle, gpioDir);
//disable suspend out , enable gpio 2
FT4222_SetSuspendOut(ftHandle, false);
//disable interrupt , enable gpio 3
FT4222_SetWakeUpInterrupt(ftHandle, false);
BOOL value;
if(FT4222_GPIO_Read(ftHandle, (GPIO_Port)GPIO_PORT3, &value) == FT4222_OK)
{
// got gpio status
}
FT4222_UnInitialize(ftHandle);
FT_Close(ftHandle);
// for interrupt read, please refer to the example2 in FT4222_SetInterruptTrigger
3.8.3 GPIO Write
FT4222_STATUS FT4222_GPIO_Write(FT_HANDLE ftHandle, GPIO_Port portNum, BOOL bValue)
Supported Chip:
Summary:
Write value to the specified GPIO pin.
Parameters:
One of the following GPIO port: