EasyManua.ls Logo

FTDI LibFT4222 - Page 70

Default Icon
78 pages
Print Icon
To Next Page IconTo Next Page
To Next Page IconTo Next Page
To Previous Page IconTo Previous Page
To Previous Page IconTo Previous Page
Loading...
Application Note
AN_329 User Guide For LibFT4222
Version 1.5
Document Reference No.: FT_001060 Clearance No.: FTDI#406
69
Product Page
Document Feedback Copyright © Future Technology Devices International Limited
Parameters:
ftHandle
Handle of the device.
portNum
One of the following GPIO port:
GPIO_PORT0
GPIO_PORT1
GPIO_PORT2
GPIO_PORT3
events
Pointer to the buffer that receives the values of the trigger event queue. The
value of events will be:
GPIO_TRIGGER_RISING
GPIO_TRIGGER_FALLING
GPIO_TRIGGER_LEVEL_HIGH
GPIO_TRIGGER_LEVEL_LOW
readSize
Number of bytes to read from trigger event queue.
sizeofRead
Pointer to a variable of type uint16 which receives the number of bytes read from
the queue.
Queue data is cleared after calling this function
For GPIO :
The trigger condition needs to be set by the function
FT4222_GPIO_SetInputTrigger
For Interrupt :
The trigger condition needs to be set by the function
FT4222_SetInterruptTrigger
Return Value:
FT4222_OK if successful, otherwise the return value is a 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
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_INPUT;
gpioDir[1] = GPIO_OUTPUT;
gpioDir[2] = GPIO_OUTPUT;
gpioDir[3] = GPIO_OUTPUT;
FT4222_GPIO_Init(ftHandle, gpioDir);
uint16 queueSize;
FT4222_GPIO_SetInputTrigger(ftHandle,
GPIO_PORT0,
(GPIO_Trigger)(GPIO_TRIGGER_LEVEL_HIGH |

Table of Contents