Application Note
AN_329 User Guide For LibFT4222
Version 1.5
Document Reference No.: FT_001060 Clearance No.: FTDI#406
66
Product Page
Document Feedback Copyright © Future Technology Devices International Limited
GPIO_PORT0
GPIO_PORT1
GPIO_PORT2
GPIO_PORT3
Return Value:
FT4222_OK if successful, otherwise the return value is an FT error code.
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
FT4222_GPIO_WRITE_NOT_SUPPORTED: Direction on this port is not writing direction.
Prerequisite:
FT4222_GPIO_Init
Example:
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_OUTPUT;
gpioDir[1] = GPIO_OUTPUT;
gpioDir[2] = GPIO_OUTPUT;
gpioDir[3] = GPIO_OUTPUT;
FT4222_GPIO_Init(ftHandle, gpioDir);
//disable suspend out , enable gpio 2
FT4222_SetSuspendOut(ftHandle, false);
//disable interrupt , enable gpio 3
FT4222_SetWakeUpInterrupt(ftHandle, false);
// set gpio0/gpio1/gpio2/gpio3 output level high
FT4222_GPIO_Write(ftHandle, GPIO_PORT0, 1);
FT4222_GPIO_Write(ftHandle, GPIO_PORT1, 1);
FT4222_GPIO_Write(ftHandle, GPIO_PORT2, 1);
FT4222_GPIO_Write(ftHandle, GPIO_PORT3, 1);
FT4222_UnInitialize(ftHandle);
FT_Close(ftHandle);
3.8.4 GPIO Set Input Trigger
FT4222_STATUS FT4222_GPIO_SetInputTrigger(FT_HANDLE ftHandle, GPIO_Port portNum,
GPIO_Trigger trigger)